Skip to content

Commit

Permalink
Merge pull request #284 from yordis/upgrade-buf-1
Browse files Browse the repository at this point in the history
chore: upgrade buf connect v2
  • Loading branch information
peintnermax authored Nov 20, 2024
2 parents 699abeb + e279b34 commit 1360645
Show file tree
Hide file tree
Showing 11 changed files with 269 additions and 227 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Login UI.

The scope of functionality of this repo and packages is under active development.

The `@zitadel/client` and `@zitadel/node` packages are using [@connectrpc/connect](https://github.com/connectrpc/connect-es#readme) and its [2.0.0-alpha](https://github.com/connectrpc/connect-es/releases/tag/v2.0.0-alpha.1) release which might still change.
The `@zitadel/client` and `@zitadel/node` packages are using [@connectrpc/connect](https://github.com/connectrpc/connect-es#readme).

You can read the [contribution guide](/CONTRIBUTING.md) on how to contribute.
Questions can be raised in our [Discord channel](https://discord.gg/erh5Brh7jE) or as
Expand Down
1 change: 0 additions & 1 deletion apps/login/src/lib/self.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { getSession } from "./zitadel";
const transport = (token: string) =>
createServerTransport(token, {
baseUrl: process.env.ZITADEL_API_URL!,
httpVersion: "2",
});

const sessionService = (sessionId: string) => {
Expand Down
7 changes: 1 addition & 6 deletions apps/login/src/lib/zitadel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ const CACHE_REVALIDATION_INTERVAL_IN_SECONDS = process.env

const transport = createServerTransport(
process.env.ZITADEL_SERVICE_USER_TOKEN!,
{
baseUrl: process.env.ZITADEL_API_URL!,
httpVersion: "2",
},
{ baseUrl: process.env.ZITADEL_API_URL! },
);

export const sessionService = createSessionServiceClient(transport);
Expand Down Expand Up @@ -652,7 +649,6 @@ export async function createPasskeyRegistrationLink(
) {
// const transport = createServerTransport(token, {
// baseUrl: process.env.ZITADEL_API_URL!,
// httpVersion: "2",
// });

// const service = createUserServiceClient(transport);
Expand Down Expand Up @@ -680,7 +676,6 @@ export async function registerU2F(
) {
// const transport = createServerTransport(token, {
// baseUrl: process.env.ZITADEL_API_URL!,
// httpVersion: "2",
// });

// const service = createUserServiceClient(transport);
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"scripts": {
"generate": "turbo run generate",
"build": "turbo run build",
"build:packages": "turbo run build --filter=./packages/*",
"build:apps": "turbo run build --filter=./apps/*",
"test": "turbo run test",
"start": "turbo run start",
"start:built": "turbo run start:built",
Expand Down
4 changes: 2 additions & 2 deletions packages/zitadel-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"dependencies": {
"@bufbuild/protobuf": "^2.0.0",
"@connectrpc/connect": "2.0.0-alpha.1",
"@bufbuild/protobuf": "^2.2.2",
"@connectrpc/connect": "^2.0.0",
"@zitadel/proto": "workspace:*"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/zitadel-client/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DescService } from "@bufbuild/protobuf";
import { Timestamp, timestampDate } from "@bufbuild/protobuf/wkt";
import { createPromiseClient, Transport } from "@connectrpc/connect";
import { createClient, Transport } from "@connectrpc/connect";

export function createClientFor<TService extends DescService>(service: TService) {
return (transport: Transport) => createPromiseClient(service, transport);
return (transport: Transport) => createClient(service, transport);
}

export function toDate(timestamp: Timestamp | undefined): Date | undefined {
Expand Down
9 changes: 5 additions & 4 deletions packages/zitadel-client/src/v2.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { create } from "@bufbuild/protobuf";
import { FeatureService } from "@zitadel/proto/zitadel/feature/v2/feature_service_pb";
import { IdentityProviderService } from "@zitadel/proto/zitadel/idp/v2/idp_service_pb";
import { RequestContext } from "@zitadel/proto/zitadel/object/v2/object_pb";
import { RequestContextSchema } from "@zitadel/proto/zitadel/object/v2/object_pb";
import { OIDCService } from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
import { OrganizationService } from "@zitadel/proto/zitadel/org/v2/org_service_pb";
import { SessionService } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
Expand All @@ -17,8 +18,8 @@ export const createOrganizationServiceClient = createClientFor(OrganizationServi
export const createFeatureServiceClient = createClientFor(FeatureService);
export const createIdpServiceClient = createClientFor(IdentityProviderService);

export function makeReqCtx(orgId: string | undefined): Partial<RequestContext> {
return {
export function makeReqCtx(orgId: string | undefined) {
return create(RequestContextSchema, {
resourceOwner: orgId ? { case: "orgId", value: orgId } : { case: "instance", value: true },
};
});
}
8 changes: 4 additions & 4 deletions packages/zitadel-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
},
"peerDependencies": {
"@zitadel/client": "workspace:*",
"@connectrpc/connect": "^2.0.0-alpha.1"
"@connectrpc/connect": "^2.0.0"
},
"dependencies": {
"@connectrpc/connect-node": "^2.0.0-alpha.1",
"@connectrpc/connect-web": "^2.0.0-alpha.1",
"@connectrpc/connect-node": "^2.0.0",
"@connectrpc/connect-web": "^2.0.0",
"jose": "^5.3.0"
},
"devDependencies": {
"@connectrpc/connect": "^2.0.0-alpha.1",
"@connectrpc/connect": "^2.0.0",
"@types/node": "^22.9.0",
"@zitadel/client": "workspace:*",
"@zitadel/tsconfig": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/zitadel-proto/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: v2
managed:
enabled: true
plugins:
- remote: buf.build/bufbuild/es:v2.0.0
- remote: buf.build/bufbuild/es:v2.2.0
out: .
include_imports: true
opt:
Expand Down
6 changes: 3 additions & 3 deletions packages/zitadel-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"sideEffects": false,
"scripts": {
"generate": "buf generate https://github.com/zitadel/zitadel.git --path ./proto/zitadel",
"clean": "rm -rf zitadel && rm -rf .turbo && rm -rf node_modules"
"clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate"
},
"dependencies": {
"@bufbuild/protobuf": "^2.0.0"
"@bufbuild/protobuf": "^2.2.2"
},
"devDependencies": {
"@bufbuild/buf": "^1.46.0"
"@bufbuild/buf": "^1.47.2"
}
}
Loading

0 comments on commit 1360645

Please sign in to comment.