@zitadel/sdk-core 1.0.0-alpha.25 → 1.0.0-alpha.28
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/README.md +58 -3
- package/dist/index.d.mts +23 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +40 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{jwt.d.ts → jwt.d.mts} +97 -83
- package/dist/jwt.d.mts.map +1 -0
- package/dist/jwt.mjs +465 -0
- package/dist/jwt.mjs.map +1 -0
- package/dist/middleware.d.mts +556 -0
- package/dist/middleware.d.mts.map +1 -0
- package/dist/middleware.mjs +764 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/types.d.mts +301 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +78 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +20 -13
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -42
- package/dist/jwt.d.ts.map +0 -1
- package/dist/jwt.js +0 -415
- package/dist/middleware.d.ts +0 -206
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -131
- package/dist/types.d.ts +0 -226
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -27
package/dist/middleware.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants and utility functions for the SDK middleware proxy layer.
|
|
3
|
-
*
|
|
4
|
-
* These are consumed by both `sdk-next` and `sdk-nuxt` to avoid duplicating
|
|
5
|
-
* pure, framework-agnostic logic.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Headers that must never be forwarded to an upstream service.
|
|
9
|
-
* These are connection-level headers that are meaningful only between
|
|
10
|
-
* two directly connected peers and become invalid when proxied.
|
|
11
|
-
*/
|
|
12
|
-
export declare const HOP_BY_HOP: ReadonlySet<string>;
|
|
13
|
-
/**
|
|
14
|
-
* SDK-internal headers that must never be forwarded to the upstream backend.
|
|
15
|
-
* These headers carry session data between the middleware and server components;
|
|
16
|
-
* forwarding them upstream would expose internal state and allow header injection.
|
|
17
|
-
*/
|
|
18
|
-
export declare const INTERNAL_HEADERS: ReadonlySet<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns `true` when `pathname` matches at least one entry in `routes`.
|
|
21
|
-
*
|
|
22
|
-
* An entry ending with `*` matches any path that starts with the prefix
|
|
23
|
-
* before the `*`. All other entries require an exact match.
|
|
24
|
-
*
|
|
25
|
-
* @param pathname - The URL pathname to test.
|
|
26
|
-
* @param routes - The list of route patterns to match against.
|
|
27
|
-
* @returns `true` if at least one pattern matches.
|
|
28
|
-
*/
|
|
29
|
-
export declare function matchesRoutes(pathname: string, routes: readonly string[]): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Filters upstream response headers for proxying: strips hop-by-hop headers
|
|
32
|
-
* and `set-cookie` (handled separately via `getSetCookie()`), and reduces
|
|
33
|
-
* `location` to a redirect that can only land on this app.
|
|
34
|
-
*
|
|
35
|
-
* `location` was stripped outright until the identity-provider callback
|
|
36
|
-
* needed it: the provider returns the browser to `/__nextgen/idp/callback`,
|
|
37
|
-
* and the engine answers `303` back to the page the sign-in started on. That
|
|
38
|
-
* is a top-level navigation with no JavaScript in the loop, so a dropped
|
|
39
|
-
* `Location` leaves the browser on an empty page. Outbound redirects to a
|
|
40
|
-
* provider do not travel this way -- they arrive as `step.redirect_url` in a
|
|
41
|
-
* JSON body and the widget navigates -- so nothing legitimate points off-origin.
|
|
42
|
-
*
|
|
43
|
-
* @param upstream - The upstream response headers.
|
|
44
|
-
* @param selfUrl - The app's own request URL, which is both the origin a
|
|
45
|
-
* redirect must land on and the base a relative one resolves against.
|
|
46
|
-
* Omitting it keeps the old behaviour of dropping every redirect.
|
|
47
|
-
* @returns A new `Headers` object with filtered headers.
|
|
48
|
-
*/
|
|
49
|
-
export declare function filterResponseHeaders(upstream: Headers, selfUrl?: string): Headers;
|
|
50
|
-
/**
|
|
51
|
-
* The authenticated session for a signed-in user. Identity follows the
|
|
52
|
-
* user-ref vocabulary (ADR 058): render `display`, falling back to
|
|
53
|
-
* `identifier`, then `userId`.
|
|
54
|
-
*/
|
|
55
|
-
export type NextgenSession = {
|
|
56
|
-
/** The user's unique identifier (`sub` claim). */
|
|
57
|
-
userId: string;
|
|
58
|
-
/**
|
|
59
|
-
* The user schema's designated identifier value (the login identifier,
|
|
60
|
-
* e.g. an email address or username), or `null` when unresolved. On the
|
|
61
|
-
* JWT path this carries the `email` claim.
|
|
62
|
-
*/
|
|
63
|
-
identifier: string | null;
|
|
64
|
-
/**
|
|
65
|
-
* The schema property `identifier` came from (e.g. `"email"`), or `null`
|
|
66
|
-
* when unknown — JWT-claim identities carry no property attribution.
|
|
67
|
-
*/
|
|
68
|
-
identifierProperty: string | null;
|
|
69
|
-
/** The user's display name rendering, or `null` when the schema designates none. */
|
|
70
|
-
display: string | null;
|
|
71
|
-
/** The raw verified JWT. */
|
|
72
|
-
token: string;
|
|
73
|
-
};
|
|
74
|
-
/** Auth state when the user is signed in. */
|
|
75
|
-
export type AuthState = {
|
|
76
|
-
isAuthenticated: true;
|
|
77
|
-
session: NextgenSession;
|
|
78
|
-
};
|
|
79
|
-
/** Auth state when the user is not signed in. */
|
|
80
|
-
export type UnauthState = {
|
|
81
|
-
isAuthenticated: false;
|
|
82
|
-
session: null;
|
|
83
|
-
};
|
|
84
|
-
/** Union of all possible auth states. */
|
|
85
|
-
export type AuthResult = AuthState | UnauthState;
|
|
86
|
-
/**
|
|
87
|
-
* The client-safe session exposed to app UI (headers, account menus).
|
|
88
|
-
* Identical to {@link NextgenSession} but omits `token` — the raw session
|
|
89
|
-
* token must never reach client-side JavaScript, whether through an SSR
|
|
90
|
-
* payload or a client-side fetch result.
|
|
91
|
-
*/
|
|
92
|
-
export type ClientSession = {
|
|
93
|
-
/** The user's unique identifier (`sub` claim). */
|
|
94
|
-
userId: string;
|
|
95
|
-
/** The designated identifier value (login identifier), or `null`. */
|
|
96
|
-
identifier: string | null;
|
|
97
|
-
/** The schema property the identifier came from, or `null`. */
|
|
98
|
-
identifierProperty: string | null;
|
|
99
|
-
/** The display name rendering, or `null`. */
|
|
100
|
-
display: string | null;
|
|
101
|
-
};
|
|
102
|
-
/** Client-safe auth state when the user is signed in. */
|
|
103
|
-
export type ClientAuthState = {
|
|
104
|
-
isAuthenticated: true;
|
|
105
|
-
session: ClientSession;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Union of all possible client-safe auth states. Returned by the client
|
|
109
|
-
* session reads (`useAuth()` in sdk-nuxt, `getSession()` in sdk-next).
|
|
110
|
-
* Token is intentionally absent — use the server-side helpers when the raw
|
|
111
|
-
* token is needed.
|
|
112
|
-
*/
|
|
113
|
-
export type ClientAuthResult = ClientAuthState | UnauthState;
|
|
114
|
-
/**
|
|
115
|
-
* Options passed to the SDK middleware factory (`nextgenMiddleware` in
|
|
116
|
-
* sdk-next, `createNextgenMiddleware` in sdk-nuxt).
|
|
117
|
-
*/
|
|
118
|
-
export type NextgenMiddlewareOptions = {
|
|
119
|
-
/**
|
|
120
|
-
* Full URL of the Zitadel auth backend.
|
|
121
|
-
* @default process.env.ZITADEL_URL ?? "http://localhost:8080"
|
|
122
|
-
*/
|
|
123
|
-
url?: string;
|
|
124
|
-
/**
|
|
125
|
-
* URL path prefix that is reverse-proxied to the auth backend.
|
|
126
|
-
*
|
|
127
|
-
* Sign-in with an external provider currently requires the default: the
|
|
128
|
-
* provider returns to `/__nextgen/idp/callback`, which is proxied only under
|
|
129
|
-
* the default prefix.
|
|
130
|
-
* @default "/__nextgen"
|
|
131
|
-
*/
|
|
132
|
-
proxyPath?: string;
|
|
133
|
-
/**
|
|
134
|
-
* Pathnames that require a valid session. Requests to these routes without
|
|
135
|
-
* a valid token are redirected to {@link loginPath}.
|
|
136
|
-
* Entries ending with `*` match any sub-path (e.g. `"/admin*"`).
|
|
137
|
-
* @default []
|
|
138
|
-
*/
|
|
139
|
-
protectedRoutes?: string[];
|
|
140
|
-
/**
|
|
141
|
-
* Pathnames that are completely skipped by the middleware — no JWT
|
|
142
|
-
* verification, no protection check, no header tunnelling.
|
|
143
|
-
* Useful for webhooks, health-check endpoints, or any route where
|
|
144
|
-
* running auth logic is undesirable.
|
|
145
|
-
* Entries ending with `*` match any sub-path (e.g. `"/public*"`).
|
|
146
|
-
* @default []
|
|
147
|
-
*/
|
|
148
|
-
ignoredRoutes?: string[];
|
|
149
|
-
/**
|
|
150
|
-
* Pathname to redirect unauthenticated users to.
|
|
151
|
-
* A `next` query parameter is appended with the originally requested path.
|
|
152
|
-
* @default "/login"
|
|
153
|
-
*/
|
|
154
|
-
loginPath?: string;
|
|
155
|
-
/**
|
|
156
|
-
* Reserved for future use. Local PEM public key for offline JWT verification.
|
|
157
|
-
*/
|
|
158
|
-
jwtKey?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Restrict accepted JWT `alg` header values. Tokens whose algorithm is not
|
|
161
|
-
* in this list are rejected before JWKS is fetched.
|
|
162
|
-
* @default ["RS256", "ES256"]
|
|
163
|
-
*/
|
|
164
|
-
allowedAlgorithms?: string[];
|
|
165
|
-
/**
|
|
166
|
-
* Clock skew tolerance in milliseconds applied to `exp`, `nbf`, and `iat`
|
|
167
|
-
* claim validation.
|
|
168
|
-
* @default 5000
|
|
169
|
-
*/
|
|
170
|
-
clockSkewMs?: number;
|
|
171
|
-
/**
|
|
172
|
-
* Expected value(s) of the `aud` claim. When omitted, audience is not
|
|
173
|
-
* validated. Pass a single string or an array when a token may carry
|
|
174
|
-
* multiple audiences.
|
|
175
|
-
*/
|
|
176
|
-
audience?: string | string[];
|
|
177
|
-
/**
|
|
178
|
-
* Accepted values for the JWT header `typ` claim (case-insensitive).
|
|
179
|
-
* Tokens whose `typ` is not in this list are rejected.
|
|
180
|
-
* Set to `[]` to disable token-type checking entirely.
|
|
181
|
-
* @default ["JWT", "at+JWT"]
|
|
182
|
-
*/
|
|
183
|
-
allowedTokenTypes?: string[];
|
|
184
|
-
/**
|
|
185
|
-
* Timeout in milliseconds for JWKS endpoint requests.
|
|
186
|
-
* Requests that do not complete within this window are aborted and the
|
|
187
|
-
* token is rejected, treating the request as unauthenticated.
|
|
188
|
-
* @default 5000
|
|
189
|
-
*/
|
|
190
|
-
jwksTimeoutMs?: number;
|
|
191
|
-
/**
|
|
192
|
-
* Timeout in milliseconds for upstream proxy requests.
|
|
193
|
-
* Requests that do not complete within this window are aborted with a
|
|
194
|
-
* network error. Defaults to 5 000 ms.
|
|
195
|
-
* @default 5000
|
|
196
|
-
*/
|
|
197
|
-
proxyTimeoutMs?: number;
|
|
198
|
-
/**
|
|
199
|
-
* Timeout in milliseconds for opaque (non-JWT) session token validation
|
|
200
|
-
* via the backend's `GET /sessions/me` endpoint. Tokens that cannot be
|
|
201
|
-
* validated within this window are treated as invalid.
|
|
202
|
-
* @default 5000
|
|
203
|
-
*/
|
|
204
|
-
opaqueTokenTimeoutMs?: number;
|
|
205
|
-
};
|
|
206
|
-
//# sourceMappingURL=middleware.d.ts.map
|
package/dist/middleware.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAazC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAqC,CAAC;AAIvF;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAUlF;AA2CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAiBlF;AAID;;;;GAIG;AACH,MAAM,MAAM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H,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,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
package/dist/middleware.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants and utility functions for the SDK middleware proxy layer.
|
|
3
|
-
*
|
|
4
|
-
* These are consumed by both `sdk-next` and `sdk-nuxt` to avoid duplicating
|
|
5
|
-
* pure, framework-agnostic logic.
|
|
6
|
-
*/
|
|
7
|
-
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
8
|
-
/**
|
|
9
|
-
* Headers that must never be forwarded to an upstream service.
|
|
10
|
-
* These are connection-level headers that are meaningful only between
|
|
11
|
-
* two directly connected peers and become invalid when proxied.
|
|
12
|
-
*/
|
|
13
|
-
export const HOP_BY_HOP = new Set([
|
|
14
|
-
"connection",
|
|
15
|
-
// host is not a hop-by-hop header per RFC 7230, but it must be stripped so
|
|
16
|
-
// the fetch implementation derives the correct Host from the upstream URL
|
|
17
|
-
// rather than forwarding the client's Host and causing SNI/vhost mismatches.
|
|
18
|
-
"host",
|
|
19
|
-
"keep-alive",
|
|
20
|
-
"proxy-authenticate",
|
|
21
|
-
"proxy-authorization",
|
|
22
|
-
"te",
|
|
23
|
-
"trailer",
|
|
24
|
-
"transfer-encoding",
|
|
25
|
-
"upgrade",
|
|
26
|
-
]);
|
|
27
|
-
/**
|
|
28
|
-
* SDK-internal headers that must never be forwarded to the upstream backend.
|
|
29
|
-
* These headers carry session data between the middleware and server components;
|
|
30
|
-
* forwarding them upstream would expose internal state and allow header injection.
|
|
31
|
-
*/
|
|
32
|
-
export const INTERNAL_HEADERS = new Set(["x-nextgen-auth-token"]);
|
|
33
|
-
// ─── Route matching ──────────────────────────────────────────────────────────
|
|
34
|
-
/**
|
|
35
|
-
* Returns `true` when `pathname` matches at least one entry in `routes`.
|
|
36
|
-
*
|
|
37
|
-
* An entry ending with `*` matches any path that starts with the prefix
|
|
38
|
-
* before the `*`. All other entries require an exact match.
|
|
39
|
-
*
|
|
40
|
-
* @param pathname - The URL pathname to test.
|
|
41
|
-
* @param routes - The list of route patterns to match against.
|
|
42
|
-
* @returns `true` if at least one pattern matches.
|
|
43
|
-
*/
|
|
44
|
-
export function matchesRoutes(pathname, routes) {
|
|
45
|
-
if (routes.length === 0) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
return routes.some((pattern) => {
|
|
49
|
-
if (pattern.endsWith("*")) {
|
|
50
|
-
return pathname.startsWith(pattern.slice(0, -1));
|
|
51
|
-
}
|
|
52
|
-
return pathname === pattern;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
// ─── Response header filtering ───────────────────────────────────────────────
|
|
56
|
-
/**
|
|
57
|
-
* An upstream `Location`, pointed back at this app.
|
|
58
|
-
*
|
|
59
|
-
* Only the path, query and fragment survive; whatever origin the upstream
|
|
60
|
-
* named is discarded and the result is re-based onto the request's own URL.
|
|
61
|
-
* That keeps both properties the blanket strip was protecting -- an internal
|
|
62
|
-
* hostname can never reach the browser, and the redirect can only ever land on
|
|
63
|
-
* this app -- without needing to know what this app's public origin is.
|
|
64
|
-
*
|
|
65
|
-
* Comparing origins instead would have required that knowledge, and there is
|
|
66
|
-
* no reliable source for it: `X-Forwarded-Host` is attacker-settable on a
|
|
67
|
-
* direct request, and the request's own host is wrong behind a proxy that
|
|
68
|
-
* terminates TLS or rewrites it. Discarding the origin sidesteps the question
|
|
69
|
-
* -- a redirect to another origin becomes the same path on this one rather
|
|
70
|
-
* than being dropped, so a deployment behind such a proxy works instead of
|
|
71
|
-
* landing on a blank page.
|
|
72
|
-
*
|
|
73
|
-
* Nothing legitimate on this path points off-origin anyway: an outbound
|
|
74
|
-
* redirect to a provider travels as `step.redirect_url` in a JSON body and the
|
|
75
|
-
* widget performs it, never as a proxied header.
|
|
76
|
-
*
|
|
77
|
-
* A relative reference resolves against the path it came from (RFC 3986 §5),
|
|
78
|
-
* so `next?flow=x` answered to `/__nextgen/idp/callback` means
|
|
79
|
-
* `/__nextgen/idp/next?flow=x`. An unparseable value is the one case with
|
|
80
|
-
* nothing to forward.
|
|
81
|
-
*/
|
|
82
|
-
function ontoThisApp(location, selfUrl) {
|
|
83
|
-
if (selfUrl === undefined || selfUrl === "") {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
const base = new URL(selfUrl);
|
|
88
|
-
const target = new URL(location, base);
|
|
89
|
-
return new URL(`${target.pathname}${target.search}${target.hash}`, base).toString();
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Filters upstream response headers for proxying: strips hop-by-hop headers
|
|
97
|
-
* and `set-cookie` (handled separately via `getSetCookie()`), and reduces
|
|
98
|
-
* `location` to a redirect that can only land on this app.
|
|
99
|
-
*
|
|
100
|
-
* `location` was stripped outright until the identity-provider callback
|
|
101
|
-
* needed it: the provider returns the browser to `/__nextgen/idp/callback`,
|
|
102
|
-
* and the engine answers `303` back to the page the sign-in started on. That
|
|
103
|
-
* is a top-level navigation with no JavaScript in the loop, so a dropped
|
|
104
|
-
* `Location` leaves the browser on an empty page. Outbound redirects to a
|
|
105
|
-
* provider do not travel this way -- they arrive as `step.redirect_url` in a
|
|
106
|
-
* JSON body and the widget navigates -- so nothing legitimate points off-origin.
|
|
107
|
-
*
|
|
108
|
-
* @param upstream - The upstream response headers.
|
|
109
|
-
* @param selfUrl - The app's own request URL, which is both the origin a
|
|
110
|
-
* redirect must land on and the base a relative one resolves against.
|
|
111
|
-
* Omitting it keeps the old behaviour of dropping every redirect.
|
|
112
|
-
* @returns A new `Headers` object with filtered headers.
|
|
113
|
-
*/
|
|
114
|
-
export function filterResponseHeaders(upstream, selfUrl) {
|
|
115
|
-
const filtered = new Headers();
|
|
116
|
-
upstream.forEach((value, key) => {
|
|
117
|
-
const name = key.toLowerCase();
|
|
118
|
-
if (HOP_BY_HOP.has(name) || name === "set-cookie") {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (name === "location") {
|
|
122
|
-
const onThisApp = ontoThisApp(value, selfUrl);
|
|
123
|
-
if (onThisApp !== undefined) {
|
|
124
|
-
filtered.set("location", onThisApp);
|
|
125
|
-
}
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
filtered.set(key, value);
|
|
129
|
-
});
|
|
130
|
-
return filtered;
|
|
131
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
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";
|
|
5
|
-
/**
|
|
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`.
|
|
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
|
-
/**
|
|
30
|
-
* Payload of the `zitadel-flow-redirect` event — the widget is handing the
|
|
31
|
-
* browser to an identity provider. Distinct from `zitadel-flow-complete`:
|
|
32
|
-
* nobody is signed in yet, and the flow resumes when the provider returns.
|
|
33
|
-
*/
|
|
34
|
-
export interface ZitadelFlowRedirectDetail {
|
|
35
|
-
readonly redirect_url: string;
|
|
36
|
-
readonly step: CreateFlow201Step;
|
|
37
|
-
}
|
|
38
|
-
/** Payload of the `zitadel-flow-error` event. */
|
|
39
|
-
export interface ZitadelFlowErrorDetail {
|
|
40
|
-
readonly message: string;
|
|
41
|
-
}
|
|
42
|
-
/** Payload of the `zitadel-signout` event. */
|
|
43
|
-
export interface ZitadelSignoutDetail {
|
|
44
|
-
/** The signed-out user's display rendering ("" when none was resolved). */
|
|
45
|
-
readonly display: string;
|
|
46
|
-
/** The signed-out user's login identifier ("" when none was resolved). */
|
|
47
|
-
readonly identifier: string;
|
|
48
|
-
}
|
|
49
|
-
/** Events emitted by `<zitadel-login>`, keyed to their detail payload. */
|
|
50
|
-
export interface ZitadelLoginEventMap {
|
|
51
|
-
"zitadel-flow-step": ZitadelFlowStepDetail;
|
|
52
|
-
"zitadel-flow-input": ZitadelFlowInputDetail;
|
|
53
|
-
"zitadel-flow-complete": ZitadelFlowCompleteDetail;
|
|
54
|
-
"zitadel-flow-redirect": ZitadelFlowRedirectDetail;
|
|
55
|
-
"zitadel-flow-error": ZitadelFlowErrorDetail;
|
|
56
|
-
}
|
|
57
|
-
/** Events emitted by `<zitadel-logout>`, keyed to their detail payload. */
|
|
58
|
-
export interface ZitadelLogoutEventMap {
|
|
59
|
-
"zitadel-signout": ZitadelSignoutDetail;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Events emitted by `<zitadel-session>`, keyed to their detail payload.
|
|
63
|
-
* `zitadel-signout` reuses {@link ZitadelSignoutDetail} so the post-sign-in
|
|
64
|
-
* card and the avatar menu speak the same sign-out contract.
|
|
65
|
-
*/
|
|
66
|
-
export interface ZitadelSessionEventMap {
|
|
67
|
-
"zitadel-signout": ZitadelSignoutDetail;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Maps each `<zitadel-login>` event to the callback prop the SDKs expose. The
|
|
71
|
-
* `satisfies Record<keyof ZitadelLoginEventMap, …>` is the drift lock: every
|
|
72
|
-
* event needs exactly one handler entry — a missing one, or an extra one left
|
|
73
|
-
* behind for a removed event, fails `tsc`. Everything below derives from this.
|
|
74
|
-
*/
|
|
75
|
-
export declare const ZITADEL_LOGIN_EVENT_HANDLERS: {
|
|
76
|
-
readonly "zitadel-flow-step": "onFlowStep";
|
|
77
|
-
readonly "zitadel-flow-input": "onFlowInput";
|
|
78
|
-
readonly "zitadel-flow-complete": "onFlowComplete";
|
|
79
|
-
readonly "zitadel-flow-redirect": "onFlowRedirect";
|
|
80
|
-
readonly "zitadel-flow-error": "onFlowError";
|
|
81
|
-
};
|
|
82
|
-
/** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
|
|
83
|
-
export declare const ZITADEL_LOGOUT_EVENT_HANDLERS: {
|
|
84
|
-
readonly "zitadel-signout": "onSignout";
|
|
85
|
-
};
|
|
86
|
-
/** Maps the `<zitadel-session>` event to the callback prop the SDKs expose. */
|
|
87
|
-
export declare const ZITADEL_SESSION_EVENT_HANDLERS: {
|
|
88
|
-
readonly "zitadel-signout": "onSignout";
|
|
89
|
-
};
|
|
90
|
-
/** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
|
|
91
|
-
export declare const ZITADEL_LOGIN_EVENTS: (keyof ZitadelLoginEventMap)[];
|
|
92
|
-
/** Runtime list of `<zitadel-logout>` event names. */
|
|
93
|
-
export declare const ZITADEL_LOGOUT_EVENTS: (keyof ZitadelLogoutEventMap)[];
|
|
94
|
-
/** Runtime list of `<zitadel-session>` event names. */
|
|
95
|
-
export declare const ZITADEL_SESSION_EVENTS: (keyof ZitadelSessionEventMap)[];
|
|
96
|
-
/** Configuration props shared by every `ZitadelLogin` wrapper. */
|
|
97
|
-
export interface ZitadelLoginConfig {
|
|
98
|
-
/** The SDK handle from `configureZitadel(...)`. */
|
|
99
|
-
readonly project?: ZitadelProject;
|
|
100
|
-
/** Discrete project id, read when no {@link project} handle is supplied. */
|
|
101
|
-
readonly projectId?: string;
|
|
102
|
-
/** Reverse-proxy path prefix the widget calls. */
|
|
103
|
-
readonly proxyPath?: string;
|
|
104
|
-
/**
|
|
105
|
-
* Sizing/chrome mode. `widget` (default) is content-sized and paints no
|
|
106
|
-
* page chrome — for embedding inside an existing layout. `page` claims
|
|
107
|
-
* the viewport, paints the surface background, loads the brand font, and
|
|
108
|
-
* focuses the first field — for dedicated login routes.
|
|
109
|
-
* @default "widget"
|
|
110
|
-
*/
|
|
111
|
-
readonly variant?: "widget" | "page";
|
|
112
|
-
/**
|
|
113
|
-
* Colour mode. Unset defers to the tenant's `branding.theme.mode`, then to
|
|
114
|
-
* the variant default — `dark` for `page`, `auto` (follow
|
|
115
|
-
* `prefers-color-scheme`) for `widget`. Set it when your app's surface is
|
|
116
|
-
* fixed so the widget doesn't render a dark card on a light page.
|
|
117
|
-
*/
|
|
118
|
-
readonly theme?: "light" | "dark" | "auto";
|
|
119
|
-
/**
|
|
120
|
-
* Visually hide the widget's own heading block while keeping it in the
|
|
121
|
-
* accessibility tree — for embeds whose page already carries the heading
|
|
122
|
-
* (a brand-voice title above the card) so the card doesn't repeat it.
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
readonly suppressHeader?: boolean;
|
|
126
|
-
/** Flow purpose. @default "login" */
|
|
127
|
-
readonly purpose?: CreateFlowBodyPurpose;
|
|
128
|
-
/**
|
|
129
|
-
* Selects a specific flow definition by its `name` (the `name` field in
|
|
130
|
-
* the flow file). Omit to run the project's default flow for the purpose.
|
|
131
|
-
*/
|
|
132
|
-
readonly flowName?: string;
|
|
133
|
-
/** Where to navigate after a completed sign-in. */
|
|
134
|
-
readonly postSignInUrl?: string;
|
|
135
|
-
/**
|
|
136
|
-
* Copy overrides merged over the builtin locale dictionaries, keyed by
|
|
137
|
-
* primary language subtag. Each dictionary may be partial — the widget
|
|
138
|
-
* merges it over the builtin copy — so presets like the components'
|
|
139
|
-
* `businessLocales` overlay are directly assignable. This is how custom
|
|
140
|
-
* flow steps and actions get labels (keys follow `<step>.title`,
|
|
141
|
-
* `<step>.action.<name>`, `<step>.field.<field>`):
|
|
142
|
-
*
|
|
143
|
-
* ```tsx
|
|
144
|
-
* <ZitadelLogin locales={{ en: { "identifier.title": "Welcome back" } }} />
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
readonly locales?: Record<string, Partial<Record<string, string>>>;
|
|
148
|
-
/** BCP-47 language override; defaults to the browser language. */
|
|
149
|
-
readonly lang?: string;
|
|
150
|
-
}
|
|
151
|
-
/** Configuration props shared by every `ZitadelLogout` wrapper. */
|
|
152
|
-
export interface ZitadelLogoutConfig {
|
|
153
|
-
/** The SDK handle from `configureZitadel(...)`. */
|
|
154
|
-
readonly project?: ZitadelProject;
|
|
155
|
-
/** Discrete project id, read when no {@link project} handle is supplied. */
|
|
156
|
-
readonly projectId?: string;
|
|
157
|
-
/** Reverse-proxy path prefix the widget calls. */
|
|
158
|
-
readonly proxyPath?: string;
|
|
159
|
-
/** Where to navigate after sign-out. */
|
|
160
|
-
readonly postSignOutUrl?: string;
|
|
161
|
-
/**
|
|
162
|
-
* Colour mode. Unset defaults to `auto` (follow `prefers-color-scheme`) —
|
|
163
|
-
* the control lives inside the app's own chrome. Set it when the
|
|
164
|
-
* surrounding surface is fixed.
|
|
165
|
-
*/
|
|
166
|
-
readonly theme?: "light" | "dark" | "auto";
|
|
167
|
-
}
|
|
168
|
-
/** Configuration props shared by every `ZitadelSession` wrapper. */
|
|
169
|
-
export interface ZitadelSessionConfig {
|
|
170
|
-
/** The SDK handle from `configureZitadel(...)`. */
|
|
171
|
-
readonly project?: ZitadelProject;
|
|
172
|
-
/** Discrete project id, read when no {@link project} handle is supplied. */
|
|
173
|
-
readonly projectId?: string;
|
|
174
|
-
/** Reverse-proxy path prefix the widget calls. */
|
|
175
|
-
readonly proxyPath?: string;
|
|
176
|
-
/** Where to navigate after sign-out. */
|
|
177
|
-
readonly postSignOutUrl?: string;
|
|
178
|
-
/** Heading text override. */
|
|
179
|
-
readonly heading?: string;
|
|
180
|
-
/** Logout action label override. */
|
|
181
|
-
readonly logoutLabel?: string;
|
|
182
|
-
/**
|
|
183
|
-
* Sizing/chrome mode. `widget` (default) is content-sized and paints no
|
|
184
|
-
* page chrome — for embedding the signed-in card inside an existing
|
|
185
|
-
* layout. `page` claims the viewport and paints the surface background —
|
|
186
|
-
* for dedicated signed-in routes.
|
|
187
|
-
* @default "widget"
|
|
188
|
-
*/
|
|
189
|
-
readonly variant?: "widget" | "page";
|
|
190
|
-
/**
|
|
191
|
-
* Colour mode. Unset defers to the variant default — `dark` for `page`,
|
|
192
|
-
* `auto` (follow `prefers-color-scheme`) for `widget`. Set it when your
|
|
193
|
-
* app's surface is fixed so the card doesn't render dark on a light page.
|
|
194
|
-
*/
|
|
195
|
-
readonly theme?: "light" | "dark" | "auto";
|
|
196
|
-
/**
|
|
197
|
-
* Visually hide the widget's own heading block while keeping it in the
|
|
198
|
-
* accessibility tree — for embeds whose page already carries the heading
|
|
199
|
-
* (a brand-voice title above the card) so the card doesn't repeat it.
|
|
200
|
-
* @default false
|
|
201
|
-
*/
|
|
202
|
-
readonly suppressHeader?: boolean;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Plain-callback handlers for the `<zitadel-login>` events, derived from
|
|
206
|
-
* {@link ZitadelLoginEventMap} and {@link ZITADEL_LOGIN_EVENT_HANDLERS} so the
|
|
207
|
-
* prop set can never drift from the events it forwards.
|
|
208
|
-
*/
|
|
209
|
-
export type ZitadelLoginHandlers = {
|
|
210
|
-
readonly [E in keyof ZitadelLoginEventMap as (typeof ZITADEL_LOGIN_EVENT_HANDLERS)[E]]?: (detail: ZitadelLoginEventMap[E]) => void;
|
|
211
|
-
};
|
|
212
|
-
/** Plain-callback handler for the `<zitadel-logout>` event (derived, as above). */
|
|
213
|
-
export type ZitadelLogoutHandlers = {
|
|
214
|
-
readonly [E in keyof ZitadelLogoutEventMap as (typeof ZITADEL_LOGOUT_EVENT_HANDLERS)[E]]?: (detail: ZitadelLogoutEventMap[E]) => void;
|
|
215
|
-
};
|
|
216
|
-
/** Plain-callback handlers for the `<zitadel-session>` events (derived, as above). */
|
|
217
|
-
export type ZitadelSessionHandlers = {
|
|
218
|
-
readonly [E in keyof ZitadelSessionEventMap as (typeof ZITADEL_SESSION_EVENT_HANDLERS)[E]]?: (detail: ZitadelSessionEventMap[E]) => void;
|
|
219
|
-
};
|
|
220
|
-
/** Full prop set for a `ZitadelLogin` wrapper (config + plain-callback handlers). */
|
|
221
|
-
export type ZitadelLoginProps = ZitadelLoginConfig & ZitadelLoginHandlers;
|
|
222
|
-
/** Full prop set for a `ZitadelLogout` wrapper (config + plain-callback handlers). */
|
|
223
|
-
export type ZitadelLogoutProps = ZitadelLogoutConfig & ZitadelLogoutHandlers;
|
|
224
|
-
/** Full prop set for a `ZitadelSession` wrapper (config + plain-callback handlers). */
|
|
225
|
-
export type ZitadelSessionProps = ZitadelSessionConfig & ZitadelSessionHandlers;
|
|
226
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,kFAAkF;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;GAOG;AAEH,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;A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AC9B,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
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
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.
|
|
6
|
-
*/
|
|
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-redirect": "onFlowRedirect",
|
|
12
|
-
"zitadel-flow-error": "onFlowError",
|
|
13
|
-
};
|
|
14
|
-
/** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
|
|
15
|
-
export const ZITADEL_LOGOUT_EVENT_HANDLERS = {
|
|
16
|
-
"zitadel-signout": "onSignout",
|
|
17
|
-
};
|
|
18
|
-
/** Maps the `<zitadel-session>` event to the callback prop the SDKs expose. */
|
|
19
|
-
export const ZITADEL_SESSION_EVENT_HANDLERS = {
|
|
20
|
-
"zitadel-signout": "onSignout",
|
|
21
|
-
};
|
|
22
|
-
/** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
|
|
23
|
-
export const ZITADEL_LOGIN_EVENTS = Object.keys(ZITADEL_LOGIN_EVENT_HANDLERS);
|
|
24
|
-
/** Runtime list of `<zitadel-logout>` event names. */
|
|
25
|
-
export const ZITADEL_LOGOUT_EVENTS = Object.keys(ZITADEL_LOGOUT_EVENT_HANDLERS);
|
|
26
|
-
/** Runtime list of `<zitadel-session>` event names. */
|
|
27
|
-
export const ZITADEL_SESSION_EVENTS = Object.keys(ZITADEL_SESSION_EVENT_HANDLERS);
|