diff --git a/packages/zitadel-client/CHANGELOG.md b/packages/zitadel-client/CHANGELOG.md index 0144cbc0dd..cdc9c34fc5 100644 --- a/packages/zitadel-client/CHANGELOG.md +++ b/packages/zitadel-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @zitadel/client +## 1.0.5 + +### Patch Changes + +- 4fa22c0: fix export for grpcweb transport + ## 1.0.4 ### Patch Changes diff --git a/packages/zitadel-client/package.json b/packages/zitadel-client/package.json index f3e1cbbce9..222068068f 100644 --- a/packages/zitadel-client/package.json +++ b/packages/zitadel-client/package.json @@ -1,6 +1,6 @@ { "name": "@zitadel/client", - "version": "1.0.4", + "version": "1.0.5", "license": "MIT", "publishConfig": { "access": "public" @@ -31,6 +31,11 @@ "types": "./dist/node.d.ts", "import": "./dist/node.js", "require": "./dist/node.cjs" + }, + "./web": { + "types": "./dist/web.d.ts", + "import": "./dist/web.js", + "require": "./dist/web.cjs" } }, "files": [ diff --git a/packages/zitadel-client/src/node.ts b/packages/zitadel-client/src/node.ts index 57dd1dac94..0b15310d2c 100644 --- a/packages/zitadel-client/src/node.ts +++ b/packages/zitadel-client/src/node.ts @@ -1,5 +1,4 @@ import { createGrpcTransport, GrpcTransportOptions } from "@connectrpc/connect-node"; -import { createGrpcWebTransport } from "@connectrpc/connect-web"; import { importPKCS8, SignJWT } from "jose"; import { NewAuthorizationBearerInterceptor } from "./interceptors.js"; @@ -15,18 +14,6 @@ export function createServerTransport(token: string, opts: GrpcTransportOptions) }); } -/** - * Create a client transport using grpc web with the given token and configuration options. - * @param token - * @param opts - */ -export function createClientTransport(token: string, opts: GrpcTransportOptions) { - return createGrpcWebTransport({ - ...opts, - interceptors: [...(opts.interceptors || []), NewAuthorizationBearerInterceptor(token)], - }); -} - export async function newSystemToken({ audience, subject, diff --git a/packages/zitadel-client/src/web.ts b/packages/zitadel-client/src/web.ts new file mode 100644 index 0000000000..a6007557c1 --- /dev/null +++ b/packages/zitadel-client/src/web.ts @@ -0,0 +1,15 @@ +import { GrpcTransportOptions } from "@connectrpc/connect-node"; +import { createGrpcWebTransport } from "@connectrpc/connect-web"; +import { NewAuthorizationBearerInterceptor } from "./interceptors"; + +/** + * Create a client transport using grpc web with the given token and configuration options. + * @param token + * @param opts + */ +export function createClientTransport(token: string, opts: GrpcTransportOptions) { + return createGrpcWebTransport({ + ...opts, + interceptors: [...(opts.interceptors || []), NewAuthorizationBearerInterceptor(token)], + }); +} diff --git a/packages/zitadel-client/tsup.config.ts b/packages/zitadel-client/tsup.config.ts index bb1644b766..3c9eeb8b83 100644 --- a/packages/zitadel-client/tsup.config.ts +++ b/packages/zitadel-client/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig, Options } from "tsup"; export default defineConfig((options: Options) => ({ - entry: ["src/index.ts", "src/v1.ts", "src/v2.ts", "src/v3alpha.ts", "src/node.ts"], + entry: ["src/index.ts", "src/v1.ts", "src/v2.ts", "src/v3alpha.ts", "src/node.ts", "src/web.ts"], format: ["esm", "cjs"], treeshake: false, splitting: true,