@zitadel/testing 1.0.0-alpha.24 → 1.0.0-alpha.25
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 +1 -1
- package/dist/{app-env-DlrV_ePR.d.mts → app-env-CAfV3fk_.d.mts} +2 -3
- package/dist/app-env-CAfV3fk_.d.mts.map +1 -0
- package/dist/app-runner.cjs +4 -3
- package/dist/app-runner.cjs.map +1 -1
- package/dist/app-runner.d.mts +1 -1
- package/dist/app-runner.mjs +4 -3
- package/dist/app-runner.mjs.map +1 -1
- package/dist/{handshake-BnAPXC6s.mjs → handshake-BBrTG-5P.mjs} +1 -1
- package/dist/{handshake-BnAPXC6s.mjs.map → handshake-BBrTG-5P.mjs.map} +1 -1
- package/dist/{handshake-BOsVBPtn.cjs → handshake-Cds_mGAO.cjs} +1 -1
- package/dist/handshake-Cds_mGAO.cjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts +11 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{orchestration-C640_1Lg.mjs → orchestration-Clldecyr.mjs} +1 -1
- package/dist/{orchestration-C640_1Lg.mjs.map → orchestration-Clldecyr.mjs.map} +1 -1
- package/dist/{orchestration-D7QBgQ0l.cjs → orchestration-gIDANMcF.cjs} +1 -1
- package/dist/{orchestration-D7QBgQ0l.cjs.map → orchestration-gIDANMcF.cjs.map} +1 -1
- package/dist/playwright.cjs +4 -4
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.d.mts +37 -38
- package/dist/playwright.d.mts.map +1 -1
- package/dist/playwright.mjs +4 -4
- package/dist/playwright.mjs.map +1 -1
- package/dist/{src-3iEZwMxn.cjs → src-CXX_iT7z.cjs} +264 -44
- package/dist/src-CXX_iT7z.cjs.map +1 -0
- package/dist/{src-Dkt0HHu8.mjs → src-DhQK55R7.mjs} +6 -9
- package/dist/src-DhQK55R7.mjs.map +1 -0
- package/dist/supervisor.cjs +3 -3
- package/dist/supervisor.cjs.map +1 -1
- package/dist/supervisor.d.mts +1 -1
- package/dist/supervisor.mjs +3 -3
- package/dist/supervisor.mjs.map +1 -1
- package/package.json +9 -8
- package/dist/app-env-DlrV_ePR.d.mts.map +0 -1
- package/dist/handshake-BOsVBPtn.cjs.map +0 -1
- package/dist/src-3iEZwMxn.cjs.map +0 -1
- package/dist/src-Dkt0HHu8.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_handshake = require("./handshake-
|
|
1
|
+
const require_handshake = require("./handshake-Cds_mGAO.cjs");
|
|
2
2
|
require("node:fs");
|
|
3
3
|
require("node:url");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -35,20 +35,55 @@ function getApiAuthToken() {
|
|
|
35
35
|
function setApiAuthToken(token) {
|
|
36
36
|
apiAuthToken = token;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The CSRF token for the first-party browser surfaces (ADR 053 §5). A
|
|
40
|
+
* state-changing request that the `__nextgen_session` cookie authenticates must
|
|
41
|
+
* carry the session's token — `csrf_token` from `GET /sessions/me/csrf` — in the
|
|
42
|
+
* `X-Zitadel-CSRF` header. The app sets it once it has loaded its session;
|
|
43
|
+
* `runtime/fetch.ts` then adds the header to unsafe requests. Unset (every
|
|
44
|
+
* other caller), nothing is added.
|
|
45
|
+
*
|
|
46
|
+
* The token belongs to the server that issued it, so it is stored with that
|
|
47
|
+
* server's origin and only sent there: another client on the same page, with
|
|
48
|
+
* another base URL, never carries it to a different host. The origin defaults
|
|
49
|
+
* to the page's own, which is where a same-origin app's API lives; with no
|
|
50
|
+
* origin to go by (no page, or an unparsable request URL), nothing is sent.
|
|
51
|
+
*
|
|
52
|
+
* Unlike the bearer slot, the app sets this one rather than the client, so it
|
|
53
|
+
* lives on `globalThis` under a {@link Symbol.for} key, like the project slot in
|
|
54
|
+
* `config.ts`: a second copy of this module (an SDK pinning another version)
|
|
55
|
+
* must read the token the app's copy wrote.
|
|
56
|
+
*/
|
|
57
|
+
const CSRF_SLOT = Symbol.for("@zitadel/api/auth:csrf");
|
|
58
|
+
function csrfSlot() {
|
|
59
|
+
const global = globalThis;
|
|
60
|
+
const existing = global[CSRF_SLOT];
|
|
61
|
+
if (existing) return existing;
|
|
62
|
+
const slot = {};
|
|
63
|
+
global[CSRF_SLOT] = slot;
|
|
64
|
+
return slot;
|
|
65
|
+
}
|
|
66
|
+
/** The token to send to `origin`, if it was issued there. */
|
|
67
|
+
function apiCsrfTokenFor(origin) {
|
|
68
|
+
const slot = csrfSlot();
|
|
69
|
+
return origin !== void 0 && slot.tokenOrigin === origin ? slot.token : void 0;
|
|
70
|
+
}
|
|
71
|
+
/** The rejection handler for a refusal from `origin`, if it was registered for it. */
|
|
72
|
+
function apiCsrfRejectionHandlerFor(origin) {
|
|
73
|
+
const slot = csrfSlot();
|
|
74
|
+
return origin !== void 0 && slot.handlerOrigin === origin ? slot.onRejected : void 0;
|
|
75
|
+
}
|
|
50
76
|
//#endregion
|
|
51
77
|
//#region ../api/dist/runtime/fetch.mjs
|
|
78
|
+
/** The header the session-bound CSRF token travels in (ADR 053 §5). */
|
|
79
|
+
const CSRF_HEADER = "X-Zitadel-CSRF";
|
|
80
|
+
const SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
81
|
+
"GET",
|
|
82
|
+
"HEAD",
|
|
83
|
+
"OPTIONS"
|
|
84
|
+
]);
|
|
85
|
+
/** The code the server answers a refused CSRF check with. */
|
|
86
|
+
const CSRF_INVALID = "auth.csrf_invalid";
|
|
52
87
|
/**
|
|
53
88
|
* Framework-neutral failure type the orval-generated client throws on
|
|
54
89
|
* any non-2xx response. Carries the HTTP status, the parsed error body
|
|
@@ -73,39 +108,157 @@ var ApiError = class extends Error {
|
|
|
73
108
|
}
|
|
74
109
|
};
|
|
75
110
|
/**
|
|
111
|
+
* Thrown when a request got no response at all: the connection was refused or
|
|
112
|
+
* reset, the host did not resolve, or the server accepted the connection but
|
|
113
|
+
* did not answer in time. The counterpart to {@link ApiError}, which is a
|
|
114
|
+
* response that came back with a failing status.
|
|
115
|
+
*
|
|
116
|
+
* `fetch` only rejects when no response arrived, so this is decided by the
|
|
117
|
+
* fact that it rejected, never by how a runtime words the failure. The
|
|
118
|
+
* runtime's own error stays on `cause` for debugging.
|
|
119
|
+
*/
|
|
120
|
+
var NetworkError = class extends Error {
|
|
121
|
+
url;
|
|
122
|
+
/** `timeout` when a deadline cut the request off, `unreachable` otherwise. */
|
|
123
|
+
reason;
|
|
124
|
+
constructor(url, reason, message, options) {
|
|
125
|
+
super(message, options);
|
|
126
|
+
this.name = "NetworkError";
|
|
127
|
+
this.url = url;
|
|
128
|
+
this.reason = reason;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
let requestPolicy = {};
|
|
132
|
+
function setRequestPolicy(policy) {
|
|
133
|
+
requestPolicy = policy;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
76
136
|
* The orval `mutator` for the fetch client. Every generated operation
|
|
77
137
|
* routes its request through this function instead of the global
|
|
78
138
|
* `fetch`. We pin three concerns here so generated call sites stay
|
|
79
139
|
* focused on the shape of one HTTP call:
|
|
80
140
|
*
|
|
81
141
|
* - bearer auth — read from `runtime/auth.ts` and attached automatically;
|
|
142
|
+
* - the CSRF header — the session-bound token from `runtime/auth.ts`, on
|
|
143
|
+
* unsafe methods to the origin it was issued for, when a first-party surface
|
|
144
|
+
* has set one; an unsafe request to that origin refused with
|
|
145
|
+
* `403 auth.csrf_invalid` asks the registered rejection handler for a fresh
|
|
146
|
+
* token and is retried once with it, only if the handler returns one (the
|
|
147
|
+
* session still belongs to the same person);
|
|
82
148
|
* - non-2xx → throw — orval's stock client parses the body regardless
|
|
83
149
|
* of status, so callers would have to inspect every response. Throw
|
|
84
150
|
* `ApiError` on `!res.ok` so failures interrupt control flow;
|
|
85
151
|
* - body parsing — return the parsed JSON typed as `T` (the operation's
|
|
86
152
|
* return type, threaded through by orval), or `undefined` for the
|
|
87
|
-
* spec's `204`/`205`/`304` no-body responses
|
|
153
|
+
* spec's `204`/`205`/`304` no-body responses;
|
|
154
|
+
* - no response → throw {@link NetworkError}, or the abort reason when the
|
|
155
|
+
* caller cancelled (see {@link request}).
|
|
88
156
|
*/
|
|
89
157
|
async function customFetch(url, options) {
|
|
158
|
+
const policy = requestPolicy;
|
|
90
159
|
const token = getApiAuthToken();
|
|
91
160
|
const headers = new Headers(options.headers);
|
|
92
161
|
if (token && !headers.has("authorization")) headers.set("authorization", `Bearer ${token}`);
|
|
93
|
-
const
|
|
162
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
163
|
+
const unsafe = !SAFE_METHODS.has(method) && !headers.has("X-Zitadel-CSRF");
|
|
164
|
+
const target = originOf(url);
|
|
165
|
+
const csrfToken = apiCsrfTokenFor(target);
|
|
166
|
+
if (unsafe && csrfToken) headers.set(CSRF_HEADER, csrfToken);
|
|
167
|
+
let { res, rawBody: parsed } = await request(url, {
|
|
94
168
|
...options,
|
|
95
169
|
headers
|
|
96
|
-
});
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
170
|
+
}, policy, readBody);
|
|
171
|
+
const onRejected = apiCsrfRejectionHandlerFor(target);
|
|
172
|
+
if (unsafe && onRejected && res.status === 403 && apiErrorCode(parsed) === CSRF_INVALID && !isStream(options.body)) {
|
|
173
|
+
const fresh = await onRejected().catch(() => void 0);
|
|
174
|
+
if (fresh && fresh !== csrfToken) {
|
|
175
|
+
headers.set(CSRF_HEADER, fresh);
|
|
176
|
+
({res, rawBody: parsed} = await request(url, {
|
|
177
|
+
...options,
|
|
178
|
+
headers
|
|
179
|
+
}, policy, readBody));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
103
182
|
if (!res.ok) {
|
|
104
183
|
const message = `${options.method ?? "GET"} ${url} returned ${res.status}`;
|
|
105
184
|
throw new ApiError(res.status, url, parsed, message);
|
|
106
185
|
}
|
|
107
186
|
return parsed;
|
|
108
187
|
}
|
|
188
|
+
/** The parsed body, or `undefined` for the spec's no-body responses. */
|
|
189
|
+
async function readBody(res) {
|
|
190
|
+
if ([
|
|
191
|
+
204,
|
|
192
|
+
205,
|
|
193
|
+
304
|
|
194
|
+
].includes(res.status)) return void 0;
|
|
195
|
+
const rawBody = await res.text();
|
|
196
|
+
return rawBody ? safeJsonParse(rawBody) : void 0;
|
|
197
|
+
}
|
|
198
|
+
/** The request's origin, resolved against the page for a relative URL. */
|
|
199
|
+
function originOf(url) {
|
|
200
|
+
try {
|
|
201
|
+
return new URL(url, globalThis.location?.href).origin;
|
|
202
|
+
} catch {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function isStream(body) {
|
|
207
|
+
return typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* `fetch` bound by a {@link RequestPolicy}, with its failures typed.
|
|
211
|
+
*
|
|
212
|
+
* The policy's signal, its deadline and any signal on `init` are combined, and
|
|
213
|
+
* `read` runs under them too, so a server that sends headers and then stalls
|
|
214
|
+
* mid-body is cut off as well. When the request does not complete:
|
|
215
|
+
*
|
|
216
|
+
* - a deadline fired → {@link NetworkError} with reason `timeout`;
|
|
217
|
+
* - any other abort → the signal's own reason, rethrown untouched, because a
|
|
218
|
+
* cancellation is the caller's decision and the caller knows what it means;
|
|
219
|
+
* - anything else → {@link NetworkError} with reason `unreachable`.
|
|
220
|
+
*
|
|
221
|
+
* Exported for the few callers that need the raw {@link Response} (a
|
|
222
|
+
* `Set-Cookie` header the generated client does not expose).
|
|
223
|
+
*/
|
|
224
|
+
async function request(url, init, policy = {}, read) {
|
|
225
|
+
const signals = [init.signal, policy.signal].filter((signal) => signal != null);
|
|
226
|
+
if (policy.timeoutMs !== void 0) signals.push(AbortSignal.timeout(policy.timeoutMs));
|
|
227
|
+
const signal = signals.length > 0 ? AbortSignal.any(signals) : void 0;
|
|
228
|
+
const method = init.method ?? "GET";
|
|
229
|
+
try {
|
|
230
|
+
const res = await fetch(url, {
|
|
231
|
+
...init,
|
|
232
|
+
signal
|
|
233
|
+
});
|
|
234
|
+
return {
|
|
235
|
+
res,
|
|
236
|
+
rawBody: read ? await read(res) : void 0
|
|
237
|
+
};
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (signal?.aborted) {
|
|
240
|
+
const reason = signal.reason;
|
|
241
|
+
if (reason instanceof DOMException && reason.name === "TimeoutError") throw new NetworkError(url, "timeout", `${method} ${url} timed out`, { cause: reason });
|
|
242
|
+
throw reason;
|
|
243
|
+
}
|
|
244
|
+
const code = errnoOf(error);
|
|
245
|
+
throw new NetworkError(url, "unreachable", `${method} ${url} got no response${code ? ` (${code})` : ""}`, { cause: error });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The errno a runtime attached to a failed request, if any, for the message.
|
|
250
|
+
* Undici nests it on `cause`, inside an `AggregateError` when it tried more
|
|
251
|
+
* than one address. Only ever used to describe the failure, never to decide
|
|
252
|
+
* that it was one.
|
|
253
|
+
*/
|
|
254
|
+
function errnoOf(error) {
|
|
255
|
+
let node = error;
|
|
256
|
+
for (let depth = 0; depth < 4 && typeof node === "object" && node !== null; depth += 1) {
|
|
257
|
+
const { code, errors } = node;
|
|
258
|
+
if (typeof code === "string") return code;
|
|
259
|
+
node = Array.isArray(errors) ? errors[0] : node.cause;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
109
262
|
/**
|
|
110
263
|
* `JSON.parse` wrapped so a non-JSON body (e.g. an HTML 502 from a
|
|
111
264
|
* proxy) becomes `{ raw: "<text>" }` instead of throwing inside
|
|
@@ -119,6 +272,30 @@ function safeJsonParse(text) {
|
|
|
119
272
|
return { raw: text };
|
|
120
273
|
}
|
|
121
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* The `code` of the server's `{code, message, details}` error envelope: from an
|
|
277
|
+
* {@link ApiError}, or from a parsed response body. `undefined` when there is
|
|
278
|
+
* none, e.g. an HTML error page from a proxy.
|
|
279
|
+
*/
|
|
280
|
+
function apiErrorCode(errorOrBody) {
|
|
281
|
+
const body = errorOrBody instanceof ApiError ? errorOrBody.body : errorOrBody;
|
|
282
|
+
return isRecord(body) && typeof body.code === "string" ? body.code : void 0;
|
|
283
|
+
}
|
|
284
|
+
function isRecord(value) {
|
|
285
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region ../api/dist/rolldown-runtime-D7D4PA-g.mjs
|
|
289
|
+
var __defProp = Object.defineProperty;
|
|
290
|
+
var __exportAll = (all, no_symbols) => {
|
|
291
|
+
let target = {};
|
|
292
|
+
for (var name in all) __defProp(target, name, {
|
|
293
|
+
get: all[name],
|
|
294
|
+
enumerable: true
|
|
295
|
+
});
|
|
296
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
297
|
+
return target;
|
|
298
|
+
};
|
|
122
299
|
//#endregion
|
|
123
300
|
//#region ../api/dist/generated/endpoints/zitadelNextGen.mjs
|
|
124
301
|
/**
|
|
@@ -196,6 +373,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
196
373
|
getGetIdpByIdUrl: () => getGetIdpByIdUrl,
|
|
197
374
|
getGetIdpRevisionByIdUrl: () => getGetIdpRevisionByIdUrl,
|
|
198
375
|
getGetLiveUrl: () => getGetLiveUrl,
|
|
376
|
+
getGetMySessionCsrfTokenUrl: () => getGetMySessionCsrfTokenUrl,
|
|
199
377
|
getGetMySessionUrl: () => getGetMySessionUrl,
|
|
200
378
|
getGetMyUserUrl: () => getGetMyUserUrl,
|
|
201
379
|
getGetProjectUrl: () => getGetProjectUrl,
|
|
@@ -226,6 +404,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
226
404
|
getListUserTeamsUrl: () => getListUserTeamsUrl,
|
|
227
405
|
getLive: () => getLive,
|
|
228
406
|
getMySession: () => getMySession,
|
|
407
|
+
getMySessionCsrfToken: () => getMySessionCsrfToken,
|
|
229
408
|
getMyUser: () => getMyUser,
|
|
230
409
|
getPatchMyUserUrl: () => getPatchMyUserUrl,
|
|
231
410
|
getPatchProjectUrl: () => getPatchProjectUrl,
|
|
@@ -366,8 +545,8 @@ const getQueryUsersUrl = (params) => {
|
|
|
366
545
|
* project is listed.
|
|
367
546
|
*
|
|
368
547
|
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
369
|
-
* session cookie (`nextgenSession`).
|
|
370
|
-
*
|
|
548
|
+
* session cookie (`nextgenSession`). Cookie-authenticated requests
|
|
549
|
+
* follow the scheme's CSRF rules (`nextgenSession`).
|
|
371
550
|
* @summary Query users
|
|
372
551
|
*/
|
|
373
552
|
const queryUsers = async (queryUsersBody, params, options) => {
|
|
@@ -719,6 +898,27 @@ const getSubmitFlowStepUrl = (id) => {
|
|
|
719
898
|
* If a stacked flow (e.g., recovery pivoted from login) finishes, the server
|
|
720
899
|
* auto-pops to the parent flow and returns the parent's next step — the
|
|
721
900
|
* frontend never sees a `complete` for intermediate flows.
|
|
901
|
+
*
|
|
902
|
+
* ## External sign-in
|
|
903
|
+
*
|
|
904
|
+
* `{action: "sso", sso_provider_id, return_target}` on a step that offers
|
|
905
|
+
* `sso_providers` returns the engine-emitted `sso-redirect` step, whose
|
|
906
|
+
* `redirect_url` the frontend navigates to.
|
|
907
|
+
*
|
|
908
|
+
* - The flow state does not change, but `_zflow` is re-sealed like on
|
|
909
|
+
* every response, so its ten-minute window restarts at this submission;
|
|
910
|
+
* the external sign-in and the return must complete within it.
|
|
911
|
+
* - A second `Set-Cookie` line carries the browser-binding cookie the
|
|
912
|
+
* callback checks: `HttpOnly`, `Path=/`, `SameSite=Lax`.
|
|
913
|
+
* - On every host except http loopback it is `__Host-_zsso` with `Secure`.
|
|
914
|
+
* - When the request host is http loopback (local development, where
|
|
915
|
+
* Safari rejects `Secure`), it is `_zsso` with no `Secure`; the
|
|
916
|
+
* `__Host-` prefix is dropped because it requires `Secure`.
|
|
917
|
+
*
|
|
918
|
+
* A connection whose `client_id` is a `${{ NAME }}` reference has it filled
|
|
919
|
+
* from the project's variables. A provider the engine cannot start a
|
|
920
|
+
* sign-in with, including a reference with no variable behind it,
|
|
921
|
+
* re-renders the step with `error.sso_unavailable`.
|
|
722
922
|
* @summary Submit step data and advance
|
|
723
923
|
*/
|
|
724
924
|
const submitFlowStep = async (id, submitFlowStepBody, options) => {
|
|
@@ -1263,6 +1463,25 @@ const revokeMySession = async (options) => {
|
|
|
1263
1463
|
method: "DELETE"
|
|
1264
1464
|
});
|
|
1265
1465
|
};
|
|
1466
|
+
const getGetMySessionCsrfTokenUrl = () => {
|
|
1467
|
+
return `${getProxyPath()}/sessions/me/csrf`;
|
|
1468
|
+
};
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns the session-bound token for cross-site request forgery protection
|
|
1471
|
+
* (ADR 053 §5). Browser code sends it in the `X-Zitadel-CSRF` header on the
|
|
1472
|
+
* state-changing requests the session cookie authenticates that require it
|
|
1473
|
+
* — see the `nextgenSession` scheme. It authorizes nothing on its own: the
|
|
1474
|
+
* HttpOnly cookie is still the credential, and a cross-site page cannot
|
|
1475
|
+
* read this response. It stays the same for the life of the session, so a
|
|
1476
|
+
* client fetches it once per session.
|
|
1477
|
+
* @summary Get my session's CSRF token
|
|
1478
|
+
*/
|
|
1479
|
+
const getMySessionCsrfToken = async (options) => {
|
|
1480
|
+
return customFetch(getGetMySessionCsrfTokenUrl(), {
|
|
1481
|
+
...options,
|
|
1482
|
+
method: "GET"
|
|
1483
|
+
});
|
|
1484
|
+
};
|
|
1266
1485
|
const getCreateSchemaUrl = (params) => {
|
|
1267
1486
|
const normalizedParams = new URLSearchParams();
|
|
1268
1487
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -1925,8 +2144,8 @@ const getCreateGrantUrl = (params) => {
|
|
|
1925
2144
|
*
|
|
1926
2145
|
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
1927
2146
|
* session cookie (`nextgenSession`). Session callers are authorized as
|
|
1928
|
-
* the human against the target project (home may differ).
|
|
1929
|
-
*
|
|
2147
|
+
* the human against the target project (home may differ). Cookie-authenticated
|
|
2148
|
+
* requests follow the scheme's CSRF rules (`nextgenSession`).
|
|
1930
2149
|
* @summary Create grant
|
|
1931
2150
|
*/
|
|
1932
2151
|
const createGrant = async (createGrantBody, params, options) => {
|
|
@@ -1971,8 +2190,8 @@ const getQueryGrantsUrl = (params) => {
|
|
|
1971
2190
|
* the project Check may expand without those scopes.
|
|
1972
2191
|
*
|
|
1973
2192
|
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
1974
|
-
* session cookie (`nextgenSession`).
|
|
1975
|
-
*
|
|
2193
|
+
* session cookie (`nextgenSession`). Cookie-authenticated requests
|
|
2194
|
+
* follow the scheme's CSRF rules (`nextgenSession`).
|
|
1976
2195
|
* @summary Query grants
|
|
1977
2196
|
*/
|
|
1978
2197
|
const queryGrants = async (queryGrantsBody, params, options) => {
|
|
@@ -2023,8 +2242,8 @@ const getGetGrantUrl = (id, params) => {
|
|
|
2023
2242
|
* Check may expand without those scopes.
|
|
2024
2243
|
*
|
|
2025
2244
|
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
2026
|
-
* session cookie (`nextgenSession`).
|
|
2027
|
-
*
|
|
2245
|
+
* session cookie (`nextgenSession`). Cookie-authenticated requests
|
|
2246
|
+
* follow the scheme's CSRF rules (`nextgenSession`).
|
|
2028
2247
|
* @summary Get grant
|
|
2029
2248
|
*/
|
|
2030
2249
|
const getGrant = async (id, params, options) => {
|
|
@@ -2048,8 +2267,8 @@ const getDeleteGrantUrl = (id, params) => {
|
|
|
2048
2267
|
* revoked so the unique binding can be reused.
|
|
2049
2268
|
*
|
|
2050
2269
|
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
2051
|
-
* session cookie (`nextgenSession`).
|
|
2052
|
-
*
|
|
2270
|
+
* session cookie (`nextgenSession`). Cookie-authenticated requests
|
|
2271
|
+
* follow the scheme's CSRF rules (`nextgenSession`).
|
|
2053
2272
|
* @summary Revoke grant
|
|
2054
2273
|
*/
|
|
2055
2274
|
const deleteGrant = async (id, params, options) => {
|
|
@@ -2381,12 +2600,16 @@ function createZitadelClient(opts) {
|
|
|
2381
2600
|
return (...args) => {
|
|
2382
2601
|
setProxyPath(baseUrl);
|
|
2383
2602
|
setApiAuthToken(opts.token);
|
|
2603
|
+
setRequestPolicy({
|
|
2604
|
+
signal: opts.signal,
|
|
2605
|
+
timeoutMs: opts.timeoutMs
|
|
2606
|
+
});
|
|
2384
2607
|
return value(...args);
|
|
2385
2608
|
};
|
|
2386
2609
|
} });
|
|
2387
2610
|
}
|
|
2388
2611
|
//#endregion
|
|
2389
|
-
//#region ../config/dist/defaults-
|
|
2612
|
+
//#region ../config/dist/defaults-COLBFU3S.mjs
|
|
2390
2613
|
var default_human_user_default = {
|
|
2391
2614
|
title: "DefaultHumanUserSchema",
|
|
2392
2615
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -2885,9 +3108,9 @@ function requireString(value, label) {
|
|
|
2885
3108
|
//#region src/cli.ts
|
|
2886
3109
|
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
2887
3110
|
function resolveCliBin() {
|
|
2888
|
-
const require = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
2889
|
-
const pkgPath = require.resolve("@zitadel/cli/package.json");
|
|
2890
|
-
const rel = require(pkgPath).bin?.zitadel;
|
|
3111
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
3112
|
+
const pkgPath = require$1.resolve("@zitadel/cli/package.json");
|
|
3113
|
+
const rel = require$1(pkgPath).bin?.zitadel;
|
|
2891
3114
|
if (!rel) throw new Error("@zitadel/cli does not declare a `zitadel` bin entry");
|
|
2892
3115
|
return (0, node_path.join)((0, node_path.dirname)(pkgPath), rel);
|
|
2893
3116
|
}
|
|
@@ -3108,8 +3331,7 @@ function identity() {
|
|
|
3108
3331
|
/**
|
|
3109
3332
|
* Create a user that can immediately complete the password login flow:
|
|
3110
3333
|
* `POST /users` (the body carries `schema: <schema id>` and the schema-defined
|
|
3111
|
-
* content under `attributes`) followed by `PUT /users/{id}/password
|
|
3112
|
-
* `is_change_required: false`.
|
|
3334
|
+
* content under `attributes`) followed by `PUT /users/{id}/password`.
|
|
3113
3335
|
*
|
|
3114
3336
|
* Defaults mint a unique email per call (email is x-unique per project), which
|
|
3115
3337
|
* is what makes per-test seeding parallel-safe on a shared instance.
|
|
@@ -3125,10 +3347,7 @@ async function seedUser(client, context, input = {}) {
|
|
|
3125
3347
|
email
|
|
3126
3348
|
}
|
|
3127
3349
|
}, { project_id: context.projectId })).id, "user id");
|
|
3128
|
-
await client.setUserPassword(id, {
|
|
3129
|
-
password,
|
|
3130
|
-
is_change_required: false
|
|
3131
|
-
});
|
|
3350
|
+
await client.setUserPassword(id, { password });
|
|
3132
3351
|
return {
|
|
3133
3352
|
id,
|
|
3134
3353
|
email,
|
|
@@ -3291,7 +3510,8 @@ function connectZitadel(handle) {
|
|
|
3291
3510
|
identity,
|
|
3292
3511
|
seedSession: async (input = {}) => {
|
|
3293
3512
|
const { user: existing, flowDefinitionName, origin, ...userInput } = input;
|
|
3294
|
-
|
|
3513
|
+
const user = existing ?? await seedUser(api, context, userInput);
|
|
3514
|
+
return mintSession(api, handle, context, user, {
|
|
3295
3515
|
flowDefinitionName,
|
|
3296
3516
|
origin: origin ?? handle.appOrigin
|
|
3297
3517
|
});
|
|
@@ -3368,4 +3588,4 @@ Object.defineProperty(exports, "startLocalZitadel", {
|
|
|
3368
3588
|
}
|
|
3369
3589
|
});
|
|
3370
3590
|
|
|
3371
|
-
//# sourceMappingURL=src-
|
|
3591
|
+
//# sourceMappingURL=src-CXX_iT7z.cjs.map
|