mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-15 05:37:38 +00:00
Merge pull request #334 from zitadel/fix-missing-client-transport
fix: add grpc-web transport, fix release pnpm version
This commit is contained in:
5
.changeset/fluffy-berries-thank.md
Normal file
5
.changeset/fluffy-berries-thank.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@zitadel/client": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
add missing client transport utility
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -21,8 +21,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
|
||||||
version: 10
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -68,8 +68,8 @@ jobs:
|
|||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- uses: actions/cache@v4.0.2
|
- name: Setup Cypress binary cache
|
||||||
name: Setup Cypress binary cache
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/Cypress
|
path: ~/.cache/Cypress
|
||||||
key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }}
|
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
|
- run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d ' ' -f 2)" >> $GITHUB_ENV
|
||||||
if: ${{ startsWith(matrix.command, 'test:acceptance') }}
|
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
|
id: playwright-cache
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/ms-playwright
|
path: ~/.cache/ms-playwright
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
import { createGrpcTransport, GrpcTransportOptions } from "@connectrpc/connect-node";
|
import { createGrpcTransport, GrpcTransportOptions } from "@connectrpc/connect-node";
|
||||||
|
import { createGrpcWebTransport } from "@connectrpc/connect-web";
|
||||||
import { importPKCS8, SignJWT } from "jose";
|
import { importPKCS8, SignJWT } from "jose";
|
||||||
import { NewAuthorizationBearerInterceptor } from "./interceptors";
|
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 token
|
||||||
* @param opts
|
* @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() {
|
export async function newSystemToken() {
|
||||||
return await new SignJWT({})
|
return await new SignJWT({})
|
||||||
.setProtectedHeader({ alg: "RS256" })
|
.setProtectedHeader({ alg: "RS256" })
|
||||||
|
Reference in New Issue
Block a user