diff --git a/.changeset/fluffy-berries-thank.md b/.changeset/fluffy-berries-thank.md new file mode 100644 index 0000000000..fd7ab452d4 --- /dev/null +++ b/.changeset/fluffy-berries-thank.md @@ -0,0 +1,5 @@ +--- +"@zitadel/client": patch +--- + +add missing client transport utility diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04094bd0c2..b490b82283 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,8 +21,6 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 - with: - version: 10 - name: Install dependencies run: pnpm install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cac00bde39..fbab967ded 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,8 +68,8 @@ jobs: node-version: 20.x cache: 'pnpm' - - uses: actions/cache@v4.0.2 - name: Setup Cypress binary cache + - name: Setup Cypress binary cache + uses: actions/cache@v4 with: path: ~/.cache/Cypress key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -86,8 +86,8 @@ jobs: - run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d ' ' -f 2)" >> $GITHUB_ENV if: ${{ startsWith(matrix.command, 'test:acceptance') }} - - uses: actions/cache@v4.0.2 - name: Setup Playwright binary cache + - name: Setup Playwright binary cache + uses: actions/cache@v4 id: playwright-cache with: path: ~/.cache/ms-playwright diff --git a/packages/zitadel-client/src/node.ts b/packages/zitadel-client/src/node.ts index c5900bb592..8f70a4edf1 100644 --- a/packages/zitadel-client/src/node.ts +++ b/packages/zitadel-client/src/node.ts @@ -1,9 +1,10 @@ import { createGrpcTransport, GrpcTransportOptions } from "@connectrpc/connect-node"; +import { createGrpcWebTransport } from "@connectrpc/connect-web"; import { importPKCS8, SignJWT } from "jose"; import { NewAuthorizationBearerInterceptor } from "./interceptors"; /** - * Create a server transport with the given token and configuration options. + * Create a server transport using grpc with the given token and configuration options. * @param token * @param opts */ @@ -14,6 +15,18 @@ 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() { return await new SignJWT({}) .setProtectedHeader({ alg: "RS256" })