diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abeaa32085..e501eb169b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,6 @@ jobs: uses: ./.github/workflows/console.yml with: node_version: "20" - buf_version: "latest" docs: uses: ./.github/workflows/docs.yml diff --git a/.github/workflows/console.yml b/.github/workflows/console.yml index 04bdcb2227..b2f8119190 100644 --- a/.github/workflows/console.yml +++ b/.github/workflows/console.yml @@ -6,9 +6,6 @@ on: node_version: required: true type: string - buf_version: - required: true - type: string outputs: cache_key: value: ${{ jobs.build.outputs.cache_key }} @@ -35,11 +32,6 @@ jobs: restore-keys: | console- path: ${{ env.cache_path }} - - if: ${{ steps.cache.outputs.cache-hit != 'true' }} - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} - version: ${{ inputs.buf_version }} - if: ${{ steps.cache.outputs.cache-hit != 'true' }} uses: pnpm/action-setup@v4 - if: ${{ steps.cache.outputs.cache-hit != 'true' }} diff --git a/apps/login/readme.md b/apps/login/readme.md deleted file mode 100644 index cdde703f48..0000000000 --- a/apps/login/readme.md +++ /dev/null @@ -1,263 +0,0 @@ -# ZITADEL TypeScript with Turborepo - -This repository contains all TypeScript and JavaScript packages and applications you need to create your own ZITADEL -Login UI. - -collage of login screens - -[![npm package](https://img.shields.io/npm/v/@zitadel/proto.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@zitadel/proto) -[![npm package](https://img.shields.io/npm/v/@zitadel/client.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@zitadel/client) - -**⚠️ This repo and packages are in beta state and subject to change ⚠️** - -The scope of functionality of this repo and packages is under active development. - -The `@zitadel/client` package is 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 -a [GitHub issue](https://github.com/zitadel/typescript/issues). - -## Developing Your Own ZITADEL Login UI - -We think the easiest path of getting up and running, is the following: - -1. Fork and clone this repository -1. Rename the file .github/dependabot.example.yml to .github/dependabot.yml so you don't miss version and security updates. -1. [Run the ZITADEL Cloud login UI locally](#run-login-ui) -1. Make changes to the code and see the effects live on your local machine -1. Study the rest of this README.md and get familiar and comfortable with how everything works. -1. Decide on a way of how you want to build and run your login UI. - You can reuse ZITADEL Clouds way. - But if you need more freedom, you can also import the packages you need into your self built application. - -## Included Apps And Packages - -- `login`: The login UI used by ZITADEL Cloud, powered by Next.js -- `@zitadel/client`: shared client utilities for node and browser environments -- `@zitadel/proto`: Protocol Buffers (proto) definitions used by ZITADEL projects - -Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). - -### Login - -The login is currently in a work in progress state. -The goal is to implement a login UI, using the session API of ZITADEL, which also implements the OIDC Standard and is -ready to use for everyone. - -In the first phase we want to have a MVP login ready with the OIDC Standard and a basic feature set. In a second step -the features will be extended. - -This list should show the current implementation state, and also what is missing. -You can already use the current state, and extend it with your needs. - -#### Features list - -- [x] Local User Registration (with Password) -- [x] User Registration and Login with external Provider - - [x] Google - - [x] GitHub - - [x] GitHub Enterprise - - [x] GitLab - - [x] GitLab Enterprise - - [x] Azure - - [x] Apple - - [x] Generic OIDC - - [x] Generic OAuth - - [x] Generic JWT - - [x] LDAP - - [x] SAML SP -- Multifactor Registration an Login - - [x] Passkeys - - [x] TOTP - - [x] OTP: Email Code - - [x] OTP: SMS Code -- [x] Password Change/Reset -- [x] Domain Discovery -- [x] Branding -- OIDC Standard - - - [x] Authorization Code Flow with PKCE - - [x] AuthRequest `hintUserId` - - [x] AuthRequest `loginHint` - - [x] AuthRequest `prompt` - - [x] Login - - [x] Select Account - - [ ] Consent - - [x] Create - - Scopes - - [x] `openid email profile address`` - - [x] `offline access` - - [x] `urn:zitadel:iam:org:idp:id:{idp_id}` - - [x] `urn:zitadel:iam:org:project:id:zitadel:aud` - - [x] `urn:zitadel:iam:org:id:{orgid}` - - [x] `urn:zitadel:iam:org:domain:primary:{domain}` - - [ ] AuthRequest UI locales - - #### Flow diagram - - This diagram shows the available pages and flows. - - > Note that back navigation or retries are not displayed. - -```mermaid - flowchart TD - A[Start] --> register - A[Start] --> accounts - A[Start] --> loginname - loginname -- signInWithIDP --> idp-success - loginname -- signInWithIDP --> idp-failure - idp-success --> B[signedin] - loginname --> password - loginname -- hasPasskey --> passkey - loginname -- allowRegister --> register - passkey-add --passwordAllowed --> password - passkey -- hasPassword --> password - passkey --> B[signedin] - password -- hasMFA --> mfa - password -- allowPasskeys --> passkey-add - password -- reset --> password-set - email -- reset --> password-set - password-set --> B[signedin] - password-change --> B[signedin] - password -- userstate=initial --> password-change - - mfa --> otp - otp --> B[signedin] - mfa--> u2f - u2f -->B[signedin] - register -- password/passkey --> B[signedin] - password --> B[signedin] - password-- forceMFA -->mfaset - mfaset --> u2fset - mfaset --> otpset - u2fset --> B[signedin] - otpset --> B[signedin] - accounts--> loginname - password -- not verified yet -->verify - register-- withpassword -->verify - passkey-- notVerified --> verify - verify --> B[signedin] -``` - -You can find a more detailed documentation of the different pages [here](./apps/login/readme.md). - -#### Custom translations - -The new login uses the [SettingsApi](https://zitadel.com/docs/apis/resources/settings_service_v2/settings-service-get-hosted-login-translation) to load custom translations. -Translations can be overriden at both the instance and organization levels. -To find the keys more easily, you can inspect the HTML and search for a `data-i18n-key` attribute, or look at the defaults in `/apps/login/locales/[locale].ts`. -![Custom Translations](.github/custom-i18n.png) - -## Tooling - -- [TypeScript](https://www.typescriptlang.org/) for static type checking -- [ESLint](https://eslint.org/) for code linting -- [Prettier](https://prettier.io) for code formatting - -## Useful Commands - -- `make login-quality` - Check the quality of your code against a production build without installing any dependencies besides Docker -- `pnpm generate` - Build proto stubs for the client package -- `pnpm dev` - Develop all packages and the login app -- `pnpm build` - Build all packages and the login app -- `pnpm clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script) - -Learn more about developing the login UI in the [contribution guide](/CONTRIBUTING.md). - -## Versioning And Publishing Packages - -Package publishing has been configured using [Changesets](https://github.com/changesets/changesets). -Here is their [documentation](https://github.com/changesets/changesets#documentation) for more information about the -workflow. - -The [GitHub Action](https://github.com/changesets/action) needs an `NPM_TOKEN` and `GITHUB_TOKEN` in the repository -settings. The [Changesets bot](https://github.com/apps/changeset-bot) should also be installed on the GitHub repository. - -Read the [changesets documentation](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md) -for more information about this automation - -### Run Login UI - -To run the application make sure to install the dependencies with - -```sh -pnpm install -``` - -then generate the GRPC stubs with - -```sh -pnpm generate -``` - -To run the application against a local ZITADEL instance, run the following command: - -```sh -pnpm run-zitadel -``` - -This sets up ZITADEL using docker compose and writes the configuration to the file `apps/login/.env.local`. - -
-Alternatively, use another environment -You can develop against any ZITADEL instance in which you have sufficient rights to execute the following steps. -Just create or overwrite the file `apps/login/.env.local` yourself. -Add your instances base URL to the file at the key `ZITADEL_API_URL`. -Go to your instance and create a service user for the login application. -The login application creates users on your primary organization and reads policy data. -For the sake of simplicity, just make the service user an instance member with the role `IAM_OWNER`. -Create a PAT and copy it to the file `apps/login/.env.local` using the key `ZITADEL_SERVICE_USER_TOKEN`. - -The file should look similar to this: - -``` -ZITADEL_API_URL=https://zitadel-tlx3du.us1.zitadel.cloud -ZITADEL_SERVICE_USER_TOKEN=1S6w48thfWFI2klgfwkCnhXJLf9FQ457E-_3H74ePQxfO3Af0Tm4V5Xi-ji7urIl_xbn-Rk -``` - -
- -Start the login application in dev mode: - -```sh -pnpm dev -``` - -Open the login application with your favorite browser at `localhost:3000`. -Change the source code and see the changes live in your browser. - -Make sure the application still behaves as expected by running all tests - -```sh -pnpm test -``` - -To satisfy your unique workflow requirements, check out the package.json in the root directory for more detailed scripts. - -### Run Login UI Acceptance tests - -To run the acceptance tests you need a running ZITADEL environment and a component which receives HTTP requests for the emails and sms's. -This component should also be able to return the content of these notifications, as the codes and links are used in the login flows. -There is a basic implementation in Golang available under [the sink package](./acceptance/sink). - -To setup ZITADEL with the additional Sink container for handling the notifications: - -```sh -pnpm run-sink -``` - -Then you can start the acceptance tests with: - -```sh -pnpm test:acceptance -``` - -### Deploy to Vercel - -To deploy your own version on Vercel, navigate to your instance and create a service user. -Then create a personal access token (PAT), copy and set it as ZITADEL_SERVICE_USER_TOKEN, then navigate to your instance -settings and make sure it gets IAM_OWNER permissions. -Finally set your instance url as ZITADEL_API_URL. Make sure to set it without trailing slash. - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fzitadel%2Ftypescript&env=ZITADEL_API_URL,ZITADEL_SERVICE_USER_TOKEN&root-directory=apps/login&envDescription=Setup%20a%20service%20account%20with%20IAM_LOGIN_CLIENT%20membership%20on%20your%20instance%20and%20provide%20its%20personal%20access%20token.&project-name=zitadel-login&repository-name=zitadel-login) diff --git a/console/package.json b/console/package.json index c95cc5b674..0c9fab065d 100644 --- a/console/package.json +++ b/console/package.json @@ -26,7 +26,7 @@ "@angular/platform-browser-dynamic": "^16.2.12", "@angular/router": "^16.2.12", "@angular/service-worker": "^16.2.12", - "@bufbuild/protobuf": "^2.2.2", + "@bufbuild/protobuf": "^2.6.1", "@connectrpc/connect": "^2.0.0", "@connectrpc/connect-web": "^2.0.0", "@ctrl/ngx-codemirror": "^6.1.0", @@ -70,7 +70,7 @@ "@angular/cli": "^16.2.15", "@angular/compiler-cli": "^16.2.5", "@angular/language-service": "^18.2.4", - "@bufbuild/buf": "^1.41.0", + "@bufbuild/buf": "^1.55.1", "@netlify/framework-info": "^9.8.13", "@types/file-saver": "^2.0.7", "@types/google-protobuf": "^3.15.3", diff --git a/console/src/app/modules/policies/oidc-webkeys/oidc-webkeys.component.ts b/console/src/app/modules/policies/oidc-webkeys/oidc-webkeys.component.ts index 16d3f056c1..1b2e8d743d 100644 --- a/console/src/app/modules/policies/oidc-webkeys/oidc-webkeys.component.ts +++ b/console/src/app/modules/policies/oidc-webkeys/oidc-webkeys.component.ts @@ -12,8 +12,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { State, WebKey } from '@zitadel/proto/zitadel/webkey/v2beta/key_pb'; import { CreateWebKeyRequestSchema } from '@zitadel/proto/zitadel/webkey/v2beta/webkey_service_pb'; import { RSAHasher, RSABits, ECDSACurve } from '@zitadel/proto/zitadel/webkey/v2beta/key_pb'; -import { NewFeatureService } from 'src/app/services/new-feature.service'; -import { ActivatedRoute, Router } from '@angular/router'; const CACHE_WARNING_MS = 5 * 60 * 1000; // 5 minutes diff --git a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts index 5eb48d8c78..2a769b9e79 100644 --- a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts +++ b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts @@ -411,7 +411,10 @@ export class UserDetailComponent implements OnInit { public sendSetPasswordNotification(user: UserV2): void { this.newMgmtService - .sendHumanResetPasswordNotification(user.userId, SendHumanResetPasswordNotificationRequest_Type.EMAIL) + .sendHumanResetPasswordNotification({ + userId: user.userId, + type: SendHumanResetPasswordNotificationRequest_Type.EMAIL, + }) .then(() => { this.toast.showInfo('USER.TOAST.PASSWORDNOTIFICATIONSENT', true); this.refreshChanges$.emit(); diff --git a/console/src/app/services/action.service.ts b/console/src/app/services/action.service.ts index dabe2faf01..a3aec6b92d 100644 --- a/console/src/app/services/action.service.ts +++ b/console/src/app/services/action.service.ts @@ -5,6 +5,7 @@ import { CreateTargetRequestSchema, CreateTargetResponse, DeleteTargetRequestSchema, + DeleteTargetResponse, GetTargetRequestSchema, GetTargetResponse, ListExecutionFunctionsRequestSchema, @@ -37,7 +38,7 @@ export class ActionService { return this.grpcService.actionNew.createTarget(req); } - public deleteTarget(req: MessageInitShape): Promise { + public deleteTarget(req: MessageInitShape): Promise { return this.grpcService.actionNew.deleteTarget(req); } diff --git a/console/src/app/services/grpc.service.ts b/console/src/app/services/grpc.service.ts index 3e83de7d38..1abf392868 100644 --- a/console/src/app/services/grpc.service.ts +++ b/console/src/app/services/grpc.service.ts @@ -21,12 +21,9 @@ import { createUserServiceClient, createSessionServiceClient, createOrganizationServiceClient, - // @ts-ignore } from '@zitadel/client/v2'; -//@ts-ignore import { createAdminServiceClient, createAuthServiceClient, createManagementServiceClient } from '@zitadel/client/v1'; import { createGrpcWebTransport } from '@connectrpc/connect-web'; -// @ts-ignore import { createClientFor } from '@zitadel/client'; import { WebKeyService } from '@zitadel/proto/zitadel/webkey/v2beta/webkey_service_pb'; @@ -86,30 +83,10 @@ export class GrpcService { ], }; - this.auth = new AuthServiceClient( - env.api, - null, - // @ts-ignore - interceptors, - ); - this.mgmt = new ManagementServiceClient( - env.api, - null, - // @ts-ignore - interceptors, - ); - this.admin = new AdminServiceClient( - env.api, - null, - // @ts-ignore - interceptors, - ); - this.user = new UserServiceClient( - env.api, - null, - // @ts-ignore - interceptors, - ); + this.auth = new AuthServiceClient(env.api, null, interceptors); + this.mgmt = new ManagementServiceClient(env.api, null, interceptors); + this.admin = new AdminServiceClient(env.api, null, interceptors); + this.user = new UserServiceClient(env.api, null, interceptors); const transport = createGrpcWebTransport({ baseUrl: env.api, diff --git a/console/src/app/services/new-auth.service.ts b/console/src/app/services/new-auth.service.ts index d503fe397b..efb9c66e6a 100644 --- a/console/src/app/services/new-auth.service.ts +++ b/console/src/app/services/new-auth.service.ts @@ -41,27 +41,27 @@ export class NewAuthService { } public listMyMultiFactors(): Promise { - return this.grpcService.authNew.listMyAuthFactors(create(ListMyAuthFactorsRequestSchema), null); + return this.grpcService.authNew.listMyAuthFactors(create(ListMyAuthFactorsRequestSchema)); } public removeMyAuthFactorOTPSMS(): Promise { - return this.grpcService.authNew.removeMyAuthFactorOTPSMS(create(RemoveMyAuthFactorOTPSMSRequestSchema), null); + return this.grpcService.authNew.removeMyAuthFactorOTPSMS(create(RemoveMyAuthFactorOTPSMSRequestSchema)); } public getMyLoginPolicy(): Promise { - return this.grpcService.authNew.getMyLoginPolicy(create(GetMyLoginPolicyRequestSchema), null); + return this.grpcService.authNew.getMyLoginPolicy(create(GetMyLoginPolicyRequestSchema)); } public removeMyMultiFactorOTP(): Promise { - return this.grpcService.authNew.removeMyAuthFactorOTP(create(RemoveMyAuthFactorOTPRequestSchema), null); + return this.grpcService.authNew.removeMyAuthFactorOTP(create(RemoveMyAuthFactorOTPRequestSchema)); } public removeMyMultiFactorU2F(tokenId: string): Promise { - return this.grpcService.authNew.removeMyAuthFactorU2F(create(RemoveMyAuthFactorU2FRequestSchema, { tokenId }), null); + return this.grpcService.authNew.removeMyAuthFactorU2F(create(RemoveMyAuthFactorU2FRequestSchema, { tokenId })); } public removeMyAuthFactorOTPEmail(): Promise { - return this.grpcService.authNew.removeMyAuthFactorOTPEmail(create(RemoveMyAuthFactorOTPEmailRequestSchema), null); + return this.grpcService.authNew.removeMyAuthFactorOTPEmail(create(RemoveMyAuthFactorOTPEmailRequestSchema)); } public getMyPasswordComplexityPolicy(): Promise { diff --git a/console/src/app/services/new-mgmt.service.ts b/console/src/app/services/new-mgmt.service.ts index 250838e746..efcaa9cd10 100644 --- a/console/src/app/services/new-mgmt.service.ts +++ b/console/src/app/services/new-mgmt.service.ts @@ -70,11 +70,10 @@ export class NewMgmtService { } public sendHumanResetPasswordNotification( - userId: string, - type: SendHumanResetPasswordNotificationRequest_Type, + req: MessageInitShape, ): Promise { return this.grpcService.mgmtNew.sendHumanResetPasswordNotification( - create(SendHumanResetPasswordNotificationRequestSchema, { userId, type }), + create(SendHumanResetPasswordNotificationRequestSchema, req), ); } diff --git a/console/src/app/services/webkeys.service.ts b/console/src/app/services/webkeys.service.ts index 9a26be4712..b70b60da81 100644 --- a/console/src/app/services/webkeys.service.ts +++ b/console/src/app/services/webkeys.service.ts @@ -16,18 +16,18 @@ export class WebKeysService { constructor(private readonly grpcService: GrpcService) {} public ListWebKeys(): Promise { - return this.grpcService.webKey.listWebKeys({}); + return this.grpcService.webKey['listWebKeys']({}); } public DeleteWebKey(id: string): Promise { - return this.grpcService.webKey.deleteWebKey({ id }); + return this.grpcService.webKey['deleteWebKey']({ id }); } public CreateWebKey(req: MessageInitShape): Promise { - return this.grpcService.webKey.createWebKey(req); + return this.grpcService.webKey['createWebKey'](req); } public ActivateWebKey(id: string): Promise { - return this.grpcService.webKey.activateWebKey({ id }); + return this.grpcService.webKey['activateWebKey']({ id }); } } diff --git a/package.json b/package.json index 97a0943116..744ef66c04 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "changeset": "changeset", "devcontainer": "devcontainer", "devcontainer:lint-unit": "pnpm devcontainer up --config .devcontainer/turbo-lint-unit/devcontainer.json --workspace-folder . --remove-existing-container", - "devcontainer:integration:login": "pnpm devcontainer up --config .devcontainer/login-integration/devcontainer.json --workspace-folder . --remove-existing-container" + "devcontainer:integration:login": "pnpm devcontainer up --config .devcontainer/login-integration/devcontainer.json --workspace-folder . --remove-existing-container", + "generate": "turbo run generate" }, "pnpm": { "overrides": { diff --git a/packages/zitadel-client/node/package.json b/packages/zitadel-client/node/package.json new file mode 100644 index 0000000000..0245d755cb --- /dev/null +++ b/packages/zitadel-client/node/package.json @@ -0,0 +1,6 @@ +{ + "name": "@zitadel/client-node", + "main": "../dist/node.js", + "types": "../dist/node.d.ts", + "type": "module" +} diff --git a/packages/zitadel-client/package.json b/packages/zitadel-client/package.json index 0a9684b8c3..9dcdcc324e 100644 --- a/packages/zitadel-client/package.json +++ b/packages/zitadel-client/package.json @@ -13,31 +13,53 @@ "require": "./dist/index.cjs" }, "./v1": { - "types": "./dist/v1.d.ts", + "types": { + "import": "./dist/v1.d.ts", + "require": "./dist/v1.d.cts", + "default": "./dist/v1.d.ts" + }, "import": "./dist/v1.js", "require": "./dist/v1.cjs" }, "./v2": { - "types": "./dist/v2.d.ts", + "types": { + "import": "./dist/v2.d.ts", + "require": "./dist/v2.d.cts", + "default": "./dist/v2.d.ts" + }, "import": "./dist/v2.js", "require": "./dist/v2.cjs" }, "./v3alpha": { - "types": "./dist/v3alpha.d.ts", + "types": { + "import": "./dist/v3alpha.d.ts", + "require": "./dist/v3alpha.d.cts", + "default": "./dist/v3alpha.d.ts" + }, "import": "./dist/v3alpha.js", "require": "./dist/v3alpha.cjs" }, "./node": { - "types": "./dist/node.d.ts", + "types": { + "import": "./dist/node.d.ts", + "require": "./dist/node.d.cts", + "default": "./dist/node.d.ts" + }, "import": "./dist/node.js", "require": "./dist/node.cjs" }, "./web": { - "types": "./dist/web.d.ts", + "types": { + "import": "./dist/web.d.ts", + "require": "./dist/web.d.cts", + "default": "./dist/web.d.ts" + }, "import": "./dist/web.js", "require": "./dist/web.cjs" } }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "files": [ "dist/**" ], diff --git a/packages/zitadel-client/v1/package.json b/packages/zitadel-client/v1/package.json new file mode 100644 index 0000000000..653354b919 --- /dev/null +++ b/packages/zitadel-client/v1/package.json @@ -0,0 +1,6 @@ +{ + "name": "@zitadel/client-v1", + "main": "../dist/v1.js", + "types": "../dist/v1.d.ts", + "type": "module" +} diff --git a/packages/zitadel-client/v2/package.json b/packages/zitadel-client/v2/package.json new file mode 100644 index 0000000000..6466dd136c --- /dev/null +++ b/packages/zitadel-client/v2/package.json @@ -0,0 +1,6 @@ +{ + "name": "@zitadel/client-v2", + "main": "../dist/v2.js", + "types": "../dist/v2.d.ts", + "type": "module" +} diff --git a/packages/zitadel-client/v3alpha/package.json b/packages/zitadel-client/v3alpha/package.json new file mode 100644 index 0000000000..27bf54f799 --- /dev/null +++ b/packages/zitadel-client/v3alpha/package.json @@ -0,0 +1,6 @@ +{ + "name": "@zitadel/client-v3alpha", + "main": "../dist/v3alpha.js", + "types": "../dist/v3alpha.d.ts", + "type": "module" +} diff --git a/packages/zitadel-client/web/package.json b/packages/zitadel-client/web/package.json new file mode 100644 index 0000000000..fd55cc9c5c --- /dev/null +++ b/packages/zitadel-client/web/package.json @@ -0,0 +1,6 @@ +{ + "name": "@zitadel/client-web", + "main": "../dist/web.js", + "types": "../dist/web.d.ts", + "type": "module" +} diff --git a/packages/zitadel-proto/.gitignore b/packages/zitadel-proto/.gitignore index 20bdea6767..0a725b8969 100644 --- a/packages/zitadel-proto/.gitignore +++ b/packages/zitadel-proto/.gitignore @@ -3,3 +3,6 @@ google protoc-gen-openapiv2 validate node_modules +cjs +es +types diff --git a/packages/zitadel-proto/buf.gen.yaml b/packages/zitadel-proto/buf.gen.yaml index 84ecfaea9d..9601096d5b 100644 --- a/packages/zitadel-proto/buf.gen.yaml +++ b/packages/zitadel-proto/buf.gen.yaml @@ -3,8 +3,24 @@ managed: enabled: true plugins: - remote: buf.build/bufbuild/es:v2.2.0 - out: . + out: es include_imports: true opt: + - target=js + - json_types=true + - import_extension=js + - remote: buf.build/bufbuild/es:v2.2.0 + out: cjs + include_imports: true + opt: + - target=js + - json_types=true + - import_extension=js + - js_import_style=legacy_commonjs + - remote: buf.build/bufbuild/es:v2.2.0 + out: types + include_imports: true + opt: + - target=dts - json_types=true - import_extension=js diff --git a/packages/zitadel-proto/package.json b/packages/zitadel-proto/package.json index 639b414792..780ae13ce3 100644 --- a/packages/zitadel-proto/package.json +++ b/packages/zitadel-proto/package.json @@ -6,21 +6,76 @@ "access": "public" }, "type": "module", - "files": [ - "zitadel/**", - "validate/**", - "google/**", - "protoc-gen-openapiv2/**" - ], + "main": "./cjs/index.js", + "types": "./types/index.d.ts", + "exports": { + "./zitadel/*": { + "types": "./types/zitadel/*.d.ts", + "import": "./es/zitadel/*.js", + "require": "./cjs/zitadel/*.js" + }, + "./zitadel/*.js": { + "types": "./types/zitadel/*.d.ts", + "import": "./es/zitadel/*.js", + "require": "./cjs/zitadel/*.js" + }, + "./validate/*": { + "types": "./types/validate/*.d.ts", + "import": "./es/validate/*.js", + "require": "./cjs/validate/*.js" + }, + "./validate/*.js": { + "types": "./types/validate/*.d.ts", + "import": "./es/validate/*.js", + "require": "./cjs/validate/*.js" + }, + "./google/*": { + "types": "./types/google/*.d.ts", + "import": "./es/google/*.js", + "require": "./cjs/google/*.js" + }, + "./google/*.js": { + "types": "./types/google/*.d.ts", + "import": "./es/google/*.js", + "require": "./cjs/google/*.js" + }, + "./protoc-gen-openapiv2/*": { + "types": "./types/protoc-gen-openapiv2/*.d.ts", + "import": "./es/protoc-gen-openapiv2/*.js", + "require": "./cjs/protoc-gen-openapiv2/*.js" + }, + "./protoc-gen-openapiv2/*.js": { + "types": "./types/protoc-gen-openapiv2/*.d.ts", + "import": "./es/protoc-gen-openapiv2/*.js", + "require": "./cjs/protoc-gen-openapiv2/*.js" + } + }, + "typesVersions": { + "*": { + "zitadel/*": [ + "./types/zitadel/*" + ], + "validate/*": [ + "./types/validate/*" + ], + "google/*": [ + "./types/google/*" + ], + "protoc-gen-openapiv2/*": [ + "./types/protoc-gen-openapiv2/*" + ] + } + }, "sideEffects": false, "scripts": { - "generate": "buf generate ../../proto --path ../../proto/zitadel", - "clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate" + "generate": "pnpm exec buf generate ../../proto", + "clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate cjs types es" }, "dependencies": { - "@bufbuild/protobuf": "^2.2.2" + "@bufbuild/protobuf": "^2.6.1" }, "devDependencies": { - "@bufbuild/buf": "^1.53.0" + "@bufbuild/buf": "^1.55.1", + "glob": "^11.0.0" } } diff --git a/packages/zitadel-proto/turbo.json b/packages/zitadel-proto/turbo.json index ee259461b7..76e7fc47ad 100644 --- a/packages/zitadel-proto/turbo.json +++ b/packages/zitadel-proto/turbo.json @@ -2,7 +2,15 @@ "extends": ["//"], "tasks": { "generate": { - "outputs": ["zitadel/**"] + "outputs": [ + "zitadel/**", + "google/**", + "validate/**", + "protoc-gen-openapiv2/**", + "cjs/**", + "es/**", + "types/**" + ] } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af5661494b..bb644cf767 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -264,7 +264,7 @@ importers: specifier: ^16.2.12 version: 16.2.12(@angular/common@16.2.12(@angular/core@16.2.12(rxjs@7.8.2)(zone.js@0.13.3))(rxjs@7.8.2))(@angular/core@16.2.12(rxjs@7.8.2)(zone.js@0.13.3)) '@bufbuild/protobuf': - specifier: ^2.2.2 + specifier: ^2.6.1 version: 2.6.1 '@connectrpc/connect': specifier: ^2.0.0 @@ -391,7 +391,7 @@ importers: specifier: ^18.2.4 version: 18.2.13 '@bufbuild/buf': - specifier: ^1.41.0 + specifier: ^1.55.1 version: 1.55.1 '@netlify/framework-info': specifier: ^9.8.13 @@ -643,12 +643,15 @@ importers: packages/zitadel-proto: dependencies: '@bufbuild/protobuf': - specifier: ^2.2.2 + specifier: ^2.6.1 version: 2.6.1 devDependencies: '@bufbuild/buf': - specifier: ^1.53.0 + specifier: ^1.55.1 version: 1.55.1 + glob: + specifier: ^11.0.0 + version: 11.0.3 packages: @@ -3105,6 +3108,14 @@ packages: '@inkeep/cxkit-types@0.5.95': resolution: {integrity: sha512-UCRBGKWjkR10wPVf0fUlnp59I3q0Uo0xF+IsoWfbr8ksxXKoCw5P1+bNeXYUZpbtRpi/Fjq15TXdbOy1pIUvUA==} + '@isaacs/balanced-match@4.0.1': + resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==} + engines: {node: 20 || >=22} + + '@isaacs/brace-expansion@5.0.0': + resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==} + engines: {node: 20 || >=22} + '@isaacs/cliui@8.0.2': resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -8403,6 +8414,11 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@11.0.3: + resolution: {integrity: sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.1.4: resolution: {integrity: sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==} deprecated: Glob versions prior to v9 are no longer supported @@ -9232,6 +9248,10 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jackspeak@4.1.1: + resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==} + engines: {node: 20 || >=22} + jake@10.9.2: resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} engines: {node: '>=10'} @@ -9768,6 +9788,10 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@11.1.0: + resolution: {integrity: sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==} + engines: {node: 20 || >=22} + lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} @@ -10315,6 +10339,10 @@ packages: minimalistic-assert@1.0.1: resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@10.0.3: + resolution: {integrity: sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==} + engines: {node: 20 || >=22} + minimatch@3.0.5: resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==} @@ -11023,6 +11051,10 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} + path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + path-to-regexp@0.1.12: resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==} @@ -18360,6 +18392,12 @@ snapshots: '@inkeep/cxkit-types@0.5.95': {} + '@isaacs/balanced-match@4.0.1': {} + + '@isaacs/brace-expansion@5.0.0': + dependencies: + '@isaacs/balanced-match': 4.0.1 + '@isaacs/cliui@8.0.2': dependencies: string-width: 5.1.2 @@ -22865,7 +22903,7 @@ snapshots: copy-webpack-plugin@11.0.0(webpack@5.100.2(@swc/core@1.13.1(@swc/helpers@0.5.17))): dependencies: - fast-glob: 3.3.3 + fast-glob: 3.3.1 glob-parent: 6.0.2 globby: 13.2.2 normalize-path: 3.0.0 @@ -25014,6 +25052,15 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 1.11.1 + glob@11.0.3: + dependencies: + foreground-child: 3.3.1 + jackspeak: 4.1.1 + minimatch: 10.0.3 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + glob@7.1.4: dependencies: fs.realpath: 1.0.0 @@ -26064,6 +26111,10 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jackspeak@4.1.1: + dependencies: + '@isaacs/cliui': 8.0.2 + jake@10.9.2: dependencies: async: 3.2.6 @@ -26675,6 +26726,8 @@ snapshots: lru-cache@10.4.3: {} + lru-cache@11.1.0: {} + lru-cache@5.1.1: dependencies: yallist: 3.1.1 @@ -27809,6 +27862,10 @@ snapshots: minimalistic-assert@1.0.1: {} + minimatch@10.0.3: + dependencies: + '@isaacs/brace-expansion': 5.0.0 + minimatch@3.0.5: dependencies: brace-expansion: 1.1.12 @@ -28722,6 +28779,11 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 + path-scurry@2.0.0: + dependencies: + lru-cache: 11.1.0 + minipass: 7.1.2 + path-to-regexp@0.1.12: {} path-to-regexp@1.9.0: