mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:37:31 +00:00
fix: grpc web transport export
This commit is contained in:
5
.changeset/shiny-islands-sparkle.md
Normal file
5
.changeset/shiny-islands-sparkle.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@zitadel/client": patch
|
||||
---
|
||||
|
||||
fix export for grpcweb transport
|
@@ -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": [
|
||||
|
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
15
packages/zitadel-client/src/web.ts
Normal file
15
packages/zitadel-client/src/web.ts
Normal file
@@ -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)],
|
||||
});
|
||||
}
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user