From ef1c8013ebacdf0a2579bbc0e0dabfeb1420c16f Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Wed, 8 Jan 2025 14:20:16 +0100 Subject: [PATCH 1/3] add grpc-web transport, fix release pnpm version --- .changeset/fluffy-berries-thank.md | 5 +++++ .github/workflows/release.yml | 2 +- package.json | 2 +- packages/zitadel-client/src/node.ts | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .changeset/fluffy-berries-thank.md 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..1c2a6a67ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.0.0 - name: Install dependencies run: pnpm install diff --git a/package.json b/package.json index 82d893f238..63c0fea951 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "packageManager": "pnpm@9.1.2+sha256.19c17528f9ca20bd442e4ca42f00f1b9808a9cb419383cd04ba32ef19322aba7", + "packageManager": "pnpm@10.0.0", "private": true, "name": "typescript-monorepo", "scripts": { 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" }) From 7703685b8406cddbba982272c7d3f9d2a4ea2a19 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Wed, 8 Jan 2025 14:57:09 +0100 Subject: [PATCH 2/3] ? --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cac00bde39..ffa3a88f3a 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') }} @@ -81,13 +81,16 @@ jobs: - name: Install Dependencies run: pnpm install --frozen-lockfile + - name: Install Cypress + run: pnpm exec cypress install + # We can cache the Playwright binary independently from the pnpm cache, because we install it separately. # After pnpm install --frozen-lockfile, we can get the version so we only have to download the binary once per version. - 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 From 1c668f278c22c12b4bf7ca73eb869dbfdc5ff2c4 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Wed, 8 Jan 2025 15:00:35 +0100 Subject: [PATCH 3/3] revert pnpm version --- .github/workflows/release.yml | 2 -- .github/workflows/test.yml | 3 --- package.json | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c2a6a67ed..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.0.0 - name: Install dependencies run: pnpm install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ffa3a88f3a..fbab967ded 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,9 +81,6 @@ jobs: - name: Install Dependencies run: pnpm install --frozen-lockfile - - name: Install Cypress - run: pnpm exec cypress install - # We can cache the Playwright binary independently from the pnpm cache, because we install it separately. # After pnpm install --frozen-lockfile, we can get the version so we only have to download the binary once per version. - run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d ' ' -f 2)" >> $GITHUB_ENV diff --git a/package.json b/package.json index 63c0fea951..82d893f238 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "packageManager": "pnpm@10.0.0", + "packageManager": "pnpm@9.1.2+sha256.19c17528f9ca20bd442e4ca42f00f1b9808a9cb419383cd04ba32ef19322aba7", "private": true, "name": "typescript-monorepo", "scripts": {