mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:47:32 +00:00
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
@@ -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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"packageManager": "pnpm@9.1.2+sha256.19c17528f9ca20bd442e4ca42f00f1b9808a9cb419383cd04ba32ef19322aba7",
|
||||
"packageManager": "pnpm@10.0.0",
|
||||
"private": true,
|
||||
"name": "typescript-monorepo",
|
||||
"scripts": {
|
||||
|
@@ -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" })
|
||||
|
Reference in New Issue
Block a user