@zitadel/sdk-core 0.1.0-alpha.9 → 1.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,206 +1,215 @@
1
+ import type { ZitadelProject } from "@zitadel/api/config";
2
+ import type { CreateFlow201Step, CreateFlow201StepComplete, CreateFlowBodyPurpose } from "@zitadel/api/generated/model";
3
+ /** Re-exported so consumers can type the `purpose` prop without a deep import. */
4
+ export type { CreateFlowBodyPurpose } from "@zitadel/api/generated/model";
1
5
  /**
2
- * Shared types for the Nextgen SDK middleware layer.
3
- *
4
- * These types are consumed by both `sdk-next` and `sdk-nuxt`. Each SDK
5
- * re-exports them from its own public surface so consumers don't need
6
- * to add a direct `sdk-core` dependency.
6
+ * The SPA widget contract shared by every SPA SDK (`sdk-react`, `sdk-vue`,
7
+ * `sdk-angular`, `sdk-solid`, `sdk-svelte`, `sdk-qwik`): the widget event detail
8
+ * types plus the config/handler/props types derived from them. Each SPA SDK
9
+ * re-exports these from its own public surface so consumers don't need a direct
10
+ * `sdk-core` dependency. The middleware-layer types (`sdk-next`, `sdk-nuxt`) now
11
+ * live in `@zitadel/sdk-core/middleware`.
7
12
  */
13
+ /** Payload of the `zitadel-flow-step` event. */
14
+ export interface ZitadelFlowStepDetail {
15
+ readonly step: CreateFlow201Step;
16
+ }
17
+ /** Payload of the `zitadel-flow-input` event. */
18
+ export interface ZitadelFlowInputDetail {
19
+ readonly name: string;
20
+ readonly value: string;
21
+ }
22
+ /** Payload of the `zitadel-flow-complete` event. */
23
+ export interface ZitadelFlowCompleteDetail {
24
+ readonly behavior: CreateFlow201StepComplete;
25
+ readonly redirect_uri?: string;
26
+ readonly handoff_token?: string;
27
+ readonly handoff_token_expires_at?: string;
28
+ }
29
+ /** Payload of the `zitadel-flow-error` event. */
30
+ export interface ZitadelFlowErrorDetail {
31
+ readonly message: string;
32
+ }
33
+ /** Payload of the `zitadel-signout` event. */
34
+ export interface ZitadelSignoutDetail {
35
+ /** The signed-out user's display rendering ("" when none was resolved). */
36
+ readonly display: string;
37
+ /** The signed-out user's login identifier ("" when none was resolved). */
38
+ readonly identifier: string;
39
+ }
40
+ /** Events emitted by `<zitadel-login>`, keyed to their detail payload. */
41
+ export interface ZitadelLoginEventMap {
42
+ "zitadel-flow-step": ZitadelFlowStepDetail;
43
+ "zitadel-flow-input": ZitadelFlowInputDetail;
44
+ "zitadel-flow-complete": ZitadelFlowCompleteDetail;
45
+ "zitadel-flow-error": ZitadelFlowErrorDetail;
46
+ }
47
+ /** Events emitted by `<zitadel-logout>`, keyed to their detail payload. */
48
+ export interface ZitadelLogoutEventMap {
49
+ "zitadel-signout": ZitadelSignoutDetail;
50
+ }
8
51
  /**
9
- * The authenticated session for a signed-in user.
52
+ * Events emitted by `<zitadel-session>`, keyed to their detail payload.
53
+ * `zitadel-signout` reuses {@link ZitadelSignoutDetail} so the post-sign-in
54
+ * card and the avatar menu speak the same sign-out contract.
10
55
  */
11
- export type NextgenSession = {
12
- /** The user's unique identifier (`sub` claim). */
13
- userId: string;
14
- /** The user's email address, or `null` if not present in the token. */
15
- email: string | null;
16
- /** The user's display name, or `null` if not present in the token. */
17
- name: string | null;
18
- /** The raw verified JWT. */
19
- token: string;
56
+ export interface ZitadelSessionEventMap {
57
+ "zitadel-signout": ZitadelSignoutDetail;
58
+ }
59
+ /**
60
+ * Maps each `<zitadel-login>` event to the callback prop the SDKs expose. The
61
+ * `satisfies Record<keyof ZitadelLoginEventMap, …>` is the drift lock: every
62
+ * event needs exactly one handler entry — a missing one, or an extra one left
63
+ * behind for a removed event, fails `tsc`. Everything below derives from this.
64
+ */
65
+ export declare const ZITADEL_LOGIN_EVENT_HANDLERS: {
66
+ readonly "zitadel-flow-step": "onFlowStep";
67
+ readonly "zitadel-flow-input": "onFlowInput";
68
+ readonly "zitadel-flow-complete": "onFlowComplete";
69
+ readonly "zitadel-flow-error": "onFlowError";
20
70
  };
21
- /** Auth state when the user is signed in. */
22
- export type AuthState = {
23
- isAuthenticated: true;
24
- session: NextgenSession;
71
+ /** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
72
+ export declare const ZITADEL_LOGOUT_EVENT_HANDLERS: {
73
+ readonly "zitadel-signout": "onSignout";
25
74
  };
26
- /** Auth state when the user is not signed in. */
27
- export type UnauthState = {
28
- isAuthenticated: false;
29
- session: null;
75
+ /** Maps the `<zitadel-session>` event to the callback prop the SDKs expose. */
76
+ export declare const ZITADEL_SESSION_EVENT_HANDLERS: {
77
+ readonly "zitadel-signout": "onSignout";
30
78
  };
31
- /** Union of all possible auth states. */
32
- export type AuthResult = AuthState | UnauthState;
33
- /**
34
- * Options passed to the SDK middleware factory (`nextgenMiddleware` in
35
- * sdk-next, `createNextgenMiddleware` in sdk-nuxt).
36
- */
37
- export type NextgenMiddlewareOptions = {
38
- /**
39
- * Full URL of the Zitadel auth backend.
40
- * @default process.env.ZITADEL_URL ?? "http://localhost:8080"
41
- */
42
- url?: string;
43
- /**
44
- * URL path prefix that is reverse-proxied to the auth backend.
45
- * @default "/__nextgen"
46
- */
47
- proxyPath?: string;
79
+ /** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
80
+ export declare const ZITADEL_LOGIN_EVENTS: (keyof ZitadelLoginEventMap)[];
81
+ /** Runtime list of `<zitadel-logout>` event names. */
82
+ export declare const ZITADEL_LOGOUT_EVENTS: (keyof ZitadelLogoutEventMap)[];
83
+ /** Runtime list of `<zitadel-session>` event names. */
84
+ export declare const ZITADEL_SESSION_EVENTS: (keyof ZitadelSessionEventMap)[];
85
+ /** Configuration props shared by every `ZitadelLogin` wrapper. */
86
+ export interface ZitadelLoginConfig {
87
+ /** The SDK handle from `configureZitadel(...)`. */
88
+ readonly project?: ZitadelProject;
89
+ /** Discrete project id, read when no {@link project} handle is supplied. */
90
+ readonly projectId?: string;
91
+ /** Reverse-proxy path prefix the widget calls. */
92
+ readonly proxyPath?: string;
48
93
  /**
49
- * Pathnames that require a valid session. Requests to these routes without
50
- * a valid token are redirected to {@link loginPath}.
51
- * Entries ending with `*` match any sub-path (e.g. `"/admin*"`).
52
- * @default []
94
+ * Sizing/chrome mode. `widget` (default) is content-sized and paints no
95
+ * page chrome for embedding inside an existing layout. `page` claims
96
+ * the viewport, paints the surface background, loads the brand font, and
97
+ * focuses the first field — for dedicated login routes.
98
+ * @default "widget"
53
99
  */
54
- protectedRoutes?: string[];
100
+ readonly variant?: "widget" | "page";
55
101
  /**
56
- * Pathnames that are completely skipped by the middleware no JWT
57
- * verification, no protection check, no header tunnelling.
58
- * Useful for webhooks, health-check endpoints, or any route where
59
- * running auth logic is undesirable.
60
- * Entries ending with `*` match any sub-path (e.g. `"/public*"`).
61
- * @default []
102
+ * Colour mode. Unset defers to the tenant's `branding.theme.mode`, then to
103
+ * the variant default `dark` for `page`, `auto` (follow
104
+ * `prefers-color-scheme`) for `widget`. Set it when your app's surface is
105
+ * fixed so the widget doesn't render a dark card on a light page.
62
106
  */
63
- ignoredRoutes?: string[];
107
+ readonly theme?: "light" | "dark" | "auto";
64
108
  /**
65
- * Pathname to redirect unauthenticated users to.
66
- * A `next` query parameter is appended with the originally requested path.
67
- * @default "/login"
109
+ * Visually hide the widget's own heading block while keeping it in the
110
+ * accessibility tree for embeds whose page already carries the heading
111
+ * (a brand-voice title above the card) so the card doesn't repeat it.
112
+ * @default false
68
113
  */
69
- loginPath?: string;
114
+ readonly suppressHeader?: boolean;
115
+ /** Flow purpose. @default "login" */
116
+ readonly purpose?: CreateFlowBodyPurpose;
70
117
  /**
71
- * Reserved for future use. Local PEM public key for offline JWT verification.
118
+ * Selects a specific flow definition by its `name` (the `name` field in
119
+ * the flow file). Omit to run the project's default flow for the purpose.
72
120
  */
73
- jwtKey?: string;
121
+ readonly flowName?: string;
122
+ /** Where to navigate after a completed sign-in. */
123
+ readonly postSignInUrl?: string;
74
124
  /**
75
- * Restrict accepted JWT `alg` header values. Tokens whose algorithm is not
76
- * in this list are rejected before JWKS is fetched.
77
- * @default ["RS256", "ES256"]
78
- */
79
- allowedAlgorithms?: string[];
80
- /**
81
- * Clock skew tolerance in milliseconds applied to `exp`, `nbf`, and `iat`
82
- * claim validation.
83
- * @default 5000
84
- */
85
- clockSkewMs?: number;
86
- /**
87
- * Expected value(s) of the `aud` claim. When omitted, audience is not
88
- * validated. Pass a single string or an array when a token may carry
89
- * multiple audiences.
125
+ * Copy overrides merged over the builtin locale dictionaries, keyed by
126
+ * primary language subtag. Each dictionary may be partial — the widget
127
+ * merges it over the builtin copy — so presets like the components'
128
+ * `businessLocales` overlay are directly assignable. This is how custom
129
+ * flow steps and actions get labels (keys follow `<step>.title`,
130
+ * `<step>.action.<name>`, `<step>.field.<field>`):
131
+ *
132
+ * ```tsx
133
+ * <ZitadelLogin locales={{ en: { "identifier.title": "Welcome back" } }} />
134
+ * ```
90
135
  */
91
- audience?: string | string[];
136
+ readonly locales?: Record<string, Partial<Record<string, string>>>;
137
+ /** BCP-47 language override; defaults to the browser language. */
138
+ readonly lang?: string;
139
+ }
140
+ /** Configuration props shared by every `ZitadelLogout` wrapper. */
141
+ export interface ZitadelLogoutConfig {
142
+ /** The SDK handle from `configureZitadel(...)`. */
143
+ readonly project?: ZitadelProject;
144
+ /** Discrete project id, read when no {@link project} handle is supplied. */
145
+ readonly projectId?: string;
146
+ /** Reverse-proxy path prefix the widget calls. */
147
+ readonly proxyPath?: string;
148
+ /** Where to navigate after sign-out. */
149
+ readonly postSignOutUrl?: string;
92
150
  /**
93
- * Accepted values for the JWT header `typ` claim (case-insensitive).
94
- * Tokens whose `typ` is not in this list are rejected.
95
- * Set to `[]` to disable token-type checking entirely.
96
- * @default ["JWT", "at+JWT"]
151
+ * Colour mode. Unset defaults to `auto` (follow `prefers-color-scheme`)
152
+ * the control lives inside the app's own chrome. Set it when the
153
+ * surrounding surface is fixed.
97
154
  */
98
- allowedTokenTypes?: string[];
155
+ readonly theme?: "light" | "dark" | "auto";
156
+ }
157
+ /** Configuration props shared by every `ZitadelSession` wrapper. */
158
+ export interface ZitadelSessionConfig {
159
+ /** The SDK handle from `configureZitadel(...)`. */
160
+ readonly project?: ZitadelProject;
161
+ /** Discrete project id, read when no {@link project} handle is supplied. */
162
+ readonly projectId?: string;
163
+ /** Reverse-proxy path prefix the widget calls. */
164
+ readonly proxyPath?: string;
165
+ /** Where to navigate after sign-out. */
166
+ readonly postSignOutUrl?: string;
167
+ /** Heading text override. */
168
+ readonly heading?: string;
169
+ /** Logout action label override. */
170
+ readonly logoutLabel?: string;
99
171
  /**
100
- * Timeout in milliseconds for JWKS endpoint requests.
101
- * Requests that do not complete within this window are aborted and the
102
- * token is rejected, treating the request as unauthenticated.
103
- * @default 5000
172
+ * Sizing/chrome mode. `widget` (default) is content-sized and paints no
173
+ * page chrome for embedding the signed-in card inside an existing
174
+ * layout. `page` claims the viewport and paints the surface background
175
+ * for dedicated signed-in routes.
176
+ * @default "widget"
104
177
  */
105
- jwksTimeoutMs?: number;
178
+ readonly variant?: "widget" | "page";
106
179
  /**
107
- * Timeout in milliseconds for upstream proxy requests.
108
- * Requests that do not complete within this window are aborted with a
109
- * network error. Defaults to 5 000 ms.
110
- * @default 5000
180
+ * Colour mode. Unset defers to the variant default — `dark` for `page`,
181
+ * `auto` (follow `prefers-color-scheme`) for `widget`. Set it when your
182
+ * app's surface is fixed so the card doesn't render dark on a light page.
111
183
  */
112
- proxyTimeoutMs?: number;
184
+ readonly theme?: "light" | "dark" | "auto";
113
185
  /**
114
- * Timeout in milliseconds for opaque (non-JWT) session token validation
115
- * via the backend's `GET /sessions/me` endpoint. Tokens that cannot be
116
- * validated within this window are treated as invalid.
117
- * @default 5000
186
+ * Visually hide the widget's own heading block while keeping it in the
187
+ * accessibility tree for embeds whose page already carries the heading
188
+ * (a brand-voice title above the card) so the card doesn't repeat it.
189
+ * @default false
118
190
  */
119
- opaqueTokenTimeoutMs?: number;
120
- /**
121
- * Optional hook called when a `POST /sessions/exchange` response is
122
- * proxied back to the browser. Receives the upstream `Response` after
123
- * hop-by-hop stripping and cookie upgrading. Return a modified
124
- * `Response` to add custom headers, extra `Set-Cookie` values, or
125
- * transform the body.
126
- *
127
- * The callback runs on the server it has access to the full response
128
- * including `Set-Cookie` headers that are `HttpOnly` and invisible to
129
- * client-side JavaScript. It fires **after** the upstream has processed
130
- * the exchange; it cannot prevent the exchange itself (return a 403
131
- * `Response` to block the browser from receiving it).
132
- *
133
- * **Capabilities:**
134
- *
135
- * - **Add or modify cookies** append `Set-Cookie` headers for
136
- * user-preferences, analytics IDs, or any server-side state.
137
- * - **Make additional fetch calls** — enrich the session by calling
138
- * your own backend, a profile service, or any external API. The
139
- * response body can be read with `response.json()` to extract
140
- * session details like `user_id`.
141
- * - **Map or transform response properties** — reshape the JSON body
142
- * before it reaches the browser (e.g. strip internal fields, add
143
- * computed properties).
144
- * - **Logging and auditing** — clone the response, read its body for
145
- * audit trails, and return the original unchanged.
146
- *
147
- * @example Add a cookie
148
- * ```ts
149
- * onExchangeResponse: async (response) => {
150
- * const headers = new Headers(response.headers);
151
- * headers.append("Set-Cookie", "theme=dark; Path=/; SameSite=Lax");
152
- * return new Response(response.body, {
153
- * status: response.status,
154
- * headers,
155
- * });
156
- * },
157
- * ```
158
- *
159
- * @example Fetch additional data and set a cookie from it
160
- * ```ts
161
- * onExchangeResponse: async (response) => {
162
- * const body = await response.json();
163
- * const profile = await fetch(
164
- * `https://api.example.com/users/${body.session.user_id}`,
165
- * );
166
- * const { locale } = await profile.json();
167
- * const headers = new Headers(response.headers);
168
- * headers.append("Set-Cookie", `locale=${locale}; Path=/; SameSite=Lax`);
169
- * return new Response(JSON.stringify(body), {
170
- * status: response.status,
171
- * headers,
172
- * });
173
- * },
174
- * ```
175
- *
176
- * @example Log the exchange for auditing (pass-through)
177
- * ```ts
178
- * onExchangeResponse: async (response) => {
179
- * const cloned = response.clone();
180
- * const body = await cloned.json();
181
- * await auditLog.record("session_exchange", body.session.session_id);
182
- * return response;
183
- * },
184
- * ```
185
- *
186
- * @example Modify existing cookies (e.g. tighten the session cookie path)
187
- * ```ts
188
- * onExchangeResponse: async (response) => {
189
- * const headers = new Headers();
190
- * for (const [key, value] of response.headers.entries()) {
191
- * if (key.toLowerCase() !== "set-cookie") headers.set(key, value);
192
- * }
193
- * for (const cookie of response.headers.getSetCookie()) {
194
- * if (cookie.startsWith("__nextgen_session=")) {
195
- * headers.append("set-cookie", cookie.replace("Path=/", "Path=/app"));
196
- * } else {
197
- * headers.append("set-cookie", cookie);
198
- * }
199
- * }
200
- * return new Response(response.body, { status: response.status, headers });
201
- * },
202
- * ```
203
- */
204
- onExchangeResponse?: (response: Response) => Response | Promise<Response>;
191
+ readonly suppressHeader?: boolean;
192
+ }
193
+ /**
194
+ * Plain-callback handlers for the `<zitadel-login>` events, derived from
195
+ * {@link ZitadelLoginEventMap} and {@link ZITADEL_LOGIN_EVENT_HANDLERS} so the
196
+ * prop set can never drift from the events it forwards.
197
+ */
198
+ export type ZitadelLoginHandlers = {
199
+ readonly [E in keyof ZitadelLoginEventMap as (typeof ZITADEL_LOGIN_EVENT_HANDLERS)[E]]?: (detail: ZitadelLoginEventMap[E]) => void;
200
+ };
201
+ /** Plain-callback handler for the `<zitadel-logout>` event (derived, as above). */
202
+ export type ZitadelLogoutHandlers = {
203
+ readonly [E in keyof ZitadelLogoutEventMap as (typeof ZITADEL_LOGOUT_EVENT_HANDLERS)[E]]?: (detail: ZitadelLogoutEventMap[E]) => void;
204
+ };
205
+ /** Plain-callback handlers for the `<zitadel-session>` events (derived, as above). */
206
+ export type ZitadelSessionHandlers = {
207
+ readonly [E in keyof ZitadelSessionEventMap as (typeof ZITADEL_SESSION_EVENT_HANDLERS)[E]]?: (detail: ZitadelSessionEventMap[E]) => void;
205
208
  };
209
+ /** Full prop set for a `ZitadelLogin` wrapper (config + plain-callback handlers). */
210
+ export type ZitadelLoginProps = ZitadelLoginConfig & ZitadelLoginHandlers;
211
+ /** Full prop set for a `ZitadelLogout` wrapper (config + plain-callback handlers). */
212
+ export type ZitadelLogoutProps = ZitadelLogoutConfig & ZitadelLogoutHandlers;
213
+ /** Full prop set for a `ZitadelSession` wrapper (config + plain-callback handlers). */
214
+ export type ZitadelSessionProps = ZitadelSessionConfig & ZitadelSessionHandlers;
206
215
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sEAAsE;IACtE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG;IAAE,eAAe,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAE3E,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG;IAAE,eAAe,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAEpE,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,iBA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I,CAAC,OAAO,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC3F,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAC9B,IAAI;CACV,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE1E,sFAAsF;AACtF,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAE7E,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC"}
package/dist/types.js CHANGED
@@ -1,8 +1,26 @@
1
1
  /**
2
- * Shared types for the Nextgen SDK middleware layer.
3
- *
4
- * These types are consumed by both `sdk-next` and `sdk-nuxt`. Each SDK
5
- * re-exports them from its own public surface so consumers don't need
6
- * to add a direct `sdk-core` dependency.
2
+ * Maps each `<zitadel-login>` event to the callback prop the SDKs expose. The
3
+ * `satisfies Record<keyof ZitadelLoginEventMap, …>` is the drift lock: every
4
+ * event needs exactly one handler entry a missing one, or an extra one left
5
+ * behind for a removed event, fails `tsc`. Everything below derives from this.
7
6
  */
8
- export {};
7
+ export const ZITADEL_LOGIN_EVENT_HANDLERS = {
8
+ "zitadel-flow-step": "onFlowStep",
9
+ "zitadel-flow-input": "onFlowInput",
10
+ "zitadel-flow-complete": "onFlowComplete",
11
+ "zitadel-flow-error": "onFlowError",
12
+ };
13
+ /** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
14
+ export const ZITADEL_LOGOUT_EVENT_HANDLERS = {
15
+ "zitadel-signout": "onSignout",
16
+ };
17
+ /** Maps the `<zitadel-session>` event to the callback prop the SDKs expose. */
18
+ export const ZITADEL_SESSION_EVENT_HANDLERS = {
19
+ "zitadel-signout": "onSignout",
20
+ };
21
+ /** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
22
+ export const ZITADEL_LOGIN_EVENTS = Object.keys(ZITADEL_LOGIN_EVENT_HANDLERS);
23
+ /** Runtime list of `<zitadel-logout>` event names. */
24
+ export const ZITADEL_LOGOUT_EVENTS = Object.keys(ZITADEL_LOGOUT_EVENT_HANDLERS);
25
+ /** Runtime list of `<zitadel-session>` event names. */
26
+ export const ZITADEL_SESSION_EVENTS = Object.keys(ZITADEL_SESSION_EVENT_HANDLERS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zitadel/sdk-core",
3
- "version": "0.1.0-alpha.9",
3
+ "version": "1.0.0-alpha.21",
4
4
  "description": "Core types and shared utilities for Zitadel SDKs",
5
5
  "homepage": "https://github.com/zitadel/nextgen/tree/main/packages/sdk-core#readme",
6
6
  "bugs": {
@@ -41,10 +41,29 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
+ "dependencies": {
45
+ "@zitadel/api": "1.0.0-alpha.21"
46
+ },
47
+ "devDependencies": {
48
+ "@eslint/js": "^9.0.0",
49
+ "@eslint/json": "^0.11.0",
50
+ "@eslint/markdown": "^6.0.0",
51
+ "eslint": "^9.0.0",
52
+ "eslint-config-prettier": "^10.0.0",
53
+ "eslint-import-resolver-typescript": "^3.7.0",
54
+ "eslint-plugin-import": "^2.31.0",
55
+ "eslint-plugin-perfectionist": "^4.0.0",
56
+ "eslint-plugin-prettier": "^5.0.0",
57
+ "prettier": "^3.0.0",
58
+ "typescript": "^6.0.3",
59
+ "typescript-eslint": "^8.0.0",
60
+ "vite": "^7.3.5",
61
+ "vitest": "^3.0.0"
62
+ },
44
63
  "scripts": {
45
64
  "build": "tsc -p tsconfig.lib.json",
46
65
  "typecheck": "tsc --noEmit -p tsconfig.json",
47
66
  "test": "vitest run",
48
- "lint": "oxlint ."
67
+ "lint": "eslint ."
49
68
  }
50
69
  }