Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ import { v1 } from "@authzed/authzed-node";
const client = v1.NewClient("t_your_token_here_1234567deadbeef");
```

Each API version is also available as a subpath export, so its members can be imported directly:

```js
import { NewClient, ClientSecurity } from "@authzed/authzed-node/v1";

const client = NewClient("t_your_token_here_1234567deadbeef");
```

Or to use a custom certificate authority, load the CA certificate and pass the file reference to `NewClientWithCustomCert`.

```js
Expand Down
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
"main": "dist/src/index.cjs",
"module": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"typesVersions": {
"*": {
"v1": [
"./dist/src/v1.d.ts"
]
}
},
"exports": {
"./package.json": "./package.json",
".": {
Expand All @@ -35,6 +42,15 @@
},
"require": "./dist/src/index.cjs",
"import": "./dist/src/index.js"
},
"./v1": {
"types": {
"import": "./dist/src/v1.d.ts",
"require": "./dist/src/v1.d.cts",
"default": "./dist/src/v1.d.ts"
},
"require": "./dist/src/v1.cjs",
"import": "./dist/src/v1.js"
}
},
"scripts": {
Expand All @@ -46,7 +62,7 @@
"format": "pnpm oxfmt",
"format:check": "pnpm oxfmt --check",
"build": "pnpm tsc",
"postbuild": "rollup dist/src/index.js --file dist/src/index.cjs --format cjs && cp dist/src/index.d.ts dist/src/index.d.cts",
"postbuild": "rollup dist/src/index.js --file dist/src/index.cjs --format cjs && cp dist/src/index.d.ts dist/src/index.d.cts && rollup dist/src/v1.js --file dist/src/v1.cjs --format cjs && cp dist/src/v1.d.ts dist/src/v1.d.cts",
"prepublishOnly": "pnpm build",
"build-js-client": "pnpm tsc --declaration false --outDir js-dist"
},
Expand Down
Loading