@zitadel/testing 1.0.0-alpha.24 → 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.
Files changed (41) hide show
  1. package/README.md +33 -19
  2. package/dist/app-runner.cjs +4 -3
  3. package/dist/app-runner.cjs.map +1 -1
  4. package/dist/app-runner.d.mts +1 -1
  5. package/dist/app-runner.mjs +4 -3
  6. package/dist/app-runner.mjs.map +1 -1
  7. package/dist/{handshake-BnAPXC6s.mjs → handshake-CwlxMjW0.mjs} +7 -4
  8. package/dist/handshake-CwlxMjW0.mjs.map +1 -0
  9. package/dist/{handshake-BOsVBPtn.cjs → handshake-D6MXSUcd.cjs} +7 -4
  10. package/dist/handshake-D6MXSUcd.cjs.map +1 -0
  11. package/dist/index.cjs +4 -2
  12. package/dist/index.d.mts +10 -16
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs +3 -3
  15. package/dist/{orchestration-C640_1Lg.mjs → orchestration-Clldecyr.mjs} +1 -1
  16. package/dist/{orchestration-C640_1Lg.mjs.map → orchestration-Clldecyr.mjs.map} +1 -1
  17. package/dist/{orchestration-D7QBgQ0l.cjs → orchestration-gIDANMcF.cjs} +1 -1
  18. package/dist/{orchestration-D7QBgQ0l.cjs.map → orchestration-gIDANMcF.cjs.map} +1 -1
  19. package/dist/playwright.cjs +12 -5
  20. package/dist/playwright.cjs.map +1 -1
  21. package/dist/playwright.d.mts +42 -41
  22. package/dist/playwright.d.mts.map +1 -1
  23. package/dist/playwright.mjs +10 -6
  24. package/dist/playwright.mjs.map +1 -1
  25. package/dist/{app-env-DlrV_ePR.d.mts → session-BrSkzPpy.d.mts} +37 -7
  26. package/dist/session-BrSkzPpy.d.mts.map +1 -0
  27. package/dist/{src-3iEZwMxn.cjs → src-BbHs0YmP.cjs} +918 -201
  28. package/dist/src-BbHs0YmP.cjs.map +1 -0
  29. package/dist/{src-Dkt0HHu8.mjs → src-DKJ1hMV8.mjs} +37 -14
  30. package/dist/src-DKJ1hMV8.mjs.map +1 -0
  31. package/dist/supervisor.cjs +3 -3
  32. package/dist/supervisor.cjs.map +1 -1
  33. package/dist/supervisor.d.mts +1 -1
  34. package/dist/supervisor.mjs +3 -3
  35. package/dist/supervisor.mjs.map +1 -1
  36. package/package.json +11 -8
  37. package/dist/app-env-DlrV_ePR.d.mts.map +0 -1
  38. package/dist/handshake-BOsVBPtn.cjs.map +0 -1
  39. package/dist/handshake-BnAPXC6s.mjs.map +0 -1
  40. package/dist/src-3iEZwMxn.cjs.map +0 -1
  41. package/dist/src-Dkt0HHu8.mjs.map +0 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ the real login journey immediately.
14
14
 
15
15
  The repo previously had two extremes: the demo e2e suites run against
16
16
  `@zitadel/api-mock` (fast, but fake — no user store, no real crypto), and
17
- `cli-journey-e2e` runs the real packaged product but creates users by clicking
17
+ the CLI journey (`e2e/journey`) runs the real packaged product but creates users by clicking
18
18
  through the registration UI, serialized per suite. This kit fills the middle:
19
19
  **real server, programmatic seeding, parallel-safe per-test users.**
20
20
 
@@ -92,7 +92,14 @@ export default defineConfig({
92
92
 
93
93
  Most app tests don't want to re-test login. `authenticatedPage` seeds a user,
94
94
  drives the real login flow headlessly (the same Flow API the login UI renders),
95
- and injects the resulting session cookie into a dedicated browser context:
95
+ and injects the resulting session cookie into a dedicated browser context. It
96
+ injects it under both names a session cookie can have on an app's origin, so it
97
+ works for any app. Behind a server SDK (Next.js, Nuxt, SvelteKit, SolidStart,
98
+ TanStack Start, Qwik Router), and behind the dev proxy `zitadel setup` writes for
99
+ an SPA, the session is in `sessionCookieName(projectId)`,
100
+ `__nextgen_session_<projectId>`, so that the apps and the Console on one host
101
+ each keep their own. Behind a proxy that passes the server's cookie through, it
102
+ is the server's `SESSION_COOKIE_NAME`:
96
103
 
97
104
  ```ts
98
105
  test("member sees the dashboard", async ({ authenticatedPage }) => {
@@ -104,12 +111,15 @@ test("member sees the dashboard", async ({ authenticatedPage }) => {
104
111
  Underneath sits `seed.session()`, whose `sessionToken` also drives session
105
112
  APIs without any browser — backend tests call the instance directly with the
106
113
  cookie header (`cookie: __nextgen_session=<sessionToken>`, the SDK
107
- middleware's own headless pattern). Scope: password flows (the shipped
108
- `password-first` presets). A flow step demanding anything beyond the user's
109
- email and password — a challenge, another factor — fails with the step name;
110
- log in through the UI for those. `seed.identity()` complements registration
111
- specs: an unused email+password that creates nothing, so the flow under test
112
- must create the user.
114
+ middleware's own headless pattern; `SESSION_COOKIE_NAME` holds the name, which
115
+ is the server's).
116
+ Scope: password flows (the shipped `password-first` presets). A flow step
117
+ demanding anything beyond the user's email and password — a challenge,
118
+ another factor — fails with the step name; log in through the UI for those.
119
+ `seed.identity()` complements registration specs: an unused email+password
120
+ that creates nothing, so the flow under test must create the user. It needs
121
+ no instance, so a spec without `withZitadel()` — against an app you started
122
+ yourself — imports it as `identity()`.
113
123
 
114
124
  ### Drive the login flow
115
125
 
@@ -170,9 +180,9 @@ for local tests; raw IP origins like `127.0.0.1` are invalid. The default
170
180
  step; boot `preset: "passkey-first"` for one-tap discoverable-credential
171
181
  login flows.
172
182
 
173
- The two in-repo consumers are `apps/demo-next-e2e/playwright.real.config.mts`
174
- and `apps/console-e2e/playwright.real.config.mts` — run them with
175
- `moon run demo-next-e2e:e2e-real` / `moon run console-e2e:e2e-real`.
183
+ The two in-repo consumers are `e2e/demo-next/playwright.real.config.mts`
184
+ and `e2e/console/playwright.real.config.mts` — run them with
185
+ `moon run e2e:demo-next-real` / `moon run e2e:console-real`.
176
186
 
177
187
  ### Composable pieces
178
188
 
@@ -191,12 +201,15 @@ import {
191
201
  startLocalZitadel, // boot + bootstrap an ephemeral instance
192
202
  connectZitadel, // attach to an existing instance via its handle
193
203
  writeHandshake, readHandshakeSync, waitForHandshake,
204
+ identity, // unused { email, password }, no instance needed
205
+ SESSION_COOKIE_NAME, // "__nextgen_session", the server's name
206
+ sessionCookieName, // (projectId) => "__nextgen_session_<projectId>", an app's
194
207
  } from "@zitadel/testing";
195
208
 
196
209
  const z = await startLocalZitadel({
197
210
  port, // default: free port
198
211
  dir, // default: temp dir, removed on stop (caller dirs are kept)
199
- appOrigins, // registered as the project's preview_origins
212
+ appOrigins, // registered as the project's origins
200
213
  useCase, // "minimal" (default) | "consumer" | "business"
201
214
  preset, // "password-first" (default)
202
215
  serverBinary, // ZITADEL_SERVER_BINARY override (path to a built server binary)
@@ -225,7 +238,8 @@ per test, `zitadel` per worker, `passkey` on demand), the flow ceremonies
225
238
  `withZitadel(options)` returning `{ webServer }` for the config,
226
239
  `enableVirtualPasskey(page)` for non-fixture pages, and
227
240
  `nextAppEnv`/`applyAppEnvTemplate` for the env-template mechanism described
228
- above.
241
+ above. `identity()`, `SESSION_COOKIE_NAME` and `sessionCookieName` are on
242
+ both entry points, so a Playwright spec imports everything from this one.
229
243
 
230
244
  ## How it works
231
245
 
@@ -239,7 +253,7 @@ above.
239
253
  Templates come from `@zitadel/config/defaults`.
240
254
  - **Seeding** is `POST /users` (the body names the schema in `schema` and puts
241
255
  the schema-defined content under `attributes`) +
242
- `PUT /users/{id}/password` with `is_change_required: false`.
256
+ `PUT /users/{id}/password` with the user's `password`.
243
257
 
244
258
  ## Credentials: the boot contract
245
259
 
@@ -286,7 +300,7 @@ or export.
286
300
  **One instance per suite, one fresh user per test.** Emails are unique per
287
301
  project, so per-test `seed.user()` calls are isolation enough for login-flow
288
302
  tests, and tests run fully parallel against the shared instance
289
- (demonstrated by `demo-next-e2e:e2e-real`, 2 workers).
303
+ (demonstrated by `e2e:demo-next-real`, 2 workers).
290
304
 
291
305
  Typical timings with the SQLite local default (dated estimates from a July 2026 dev build — orders of magnitude, not a benchmark; remeasure locally before relying on them):
292
306
 
@@ -297,7 +311,7 @@ Typical timings with the SQLite local default (dated estimates from a July 2026
297
311
  | Stop | typically under a second |
298
312
  | Bootstrap (project + schema + flow) | ~100ms |
299
313
  | Seed one user (create + password) | ~50ms |
300
- | Full `e2e-real` suite (boot + Next dev + 2 browser tests) | ~25s |
314
+ | Full `e2e:demo-next-real` suite (boot + Next dev + 2 browser tests) | ~25s |
301
315
 
302
316
  **Instance-per-worker is not worth it for browser e2e**: the app dev server
303
317
  boots once with one project's env, and every extra worker would pay the full
@@ -321,7 +335,7 @@ own suites run `moon run server:build` and point the kit at the result via
321
335
  `serverBinaryHint` exists for this). Most in-repo moon tasks set
322
336
  `NEXTGEN_SERVER_LOGIN_ENABLED=false` / `NEXTGEN_SERVER_CONSOLE_ENABLED=false`
323
337
  because they drive the app-embedded login, not the server-hosted `/ui/*`; the
324
- exception is `console-e2e:e2e-embedded`, which keeps both surfaces on and
338
+ exception is `e2e:console-embedded`, which keeps both surfaces on and
325
339
  omits `app` — the binary-served `/ui/*` pages are its subject. Customer
326
340
  installs need none of this.
327
341
 
@@ -342,8 +356,8 @@ Zitadel" when the app under test and Playwright share one machine. The layers
342
356
  on top, in intended order:
343
357
 
344
358
  1. **Registration fixtures.** Landed: `zitadel.identity()` plus the
345
- demo-next-e2e registration spec driving the real registration UI and
346
- verifying the created user through the API. `cli-journey-e2e` keeps the
359
+ demo-next real-lane registration spec driving the real registration UI and
360
+ verifying the created user through the API. The CLI journey keeps the
347
361
  packaged-product registration coverage.
348
362
  2. **Email/OTP capture.** `zitadel.email.waitForCode(address)` for
349
363
  verification flows. Blocked on a server-side story (dev SMTP sink or
@@ -1,5 +1,5 @@
1
- const require_handshake = require("./handshake-BOsVBPtn.cjs");
2
- const require_orchestration = require("./orchestration-D7QBgQ0l.cjs");
1
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
2
+ const require_orchestration = require("./orchestration-gIDANMcF.cjs");
3
3
  let node_child_process = require("node:child_process");
4
4
  //#region src/app-runner.ts
5
5
  /**
@@ -11,7 +11,8 @@ let node_child_process = require("node:child_process");
11
11
  const LOG = "[zitadel-testing-app]";
12
12
  async function main() {
13
13
  const config = require_orchestration.parseAppRunnerConfig(process.env[require_orchestration.APP_RUNNER_CONFIG_ENV]);
14
- const handle = await require_handshake.waitForHandshake(require_orchestration.requireHandshakePath(process.env), config.handshakeTimeoutMs ?? 18e4);
14
+ const handshakePath = require_orchestration.requireHandshakePath(process.env);
15
+ const handle = await require_handshake.waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 18e4);
15
16
  console.log(`${LOG} starting ${config.command.join(" ")} against ${handle.baseUrl}`);
16
17
  const [bin, ...args] = config.command;
17
18
  const child = (0, node_child_process.spawn)(bin, args, {
@@ -1 +1 @@
1
- {"version":3,"file":"app-runner.cjs","names":["parseAppRunnerConfig","APP_RUNNER_CONFIG_ENV","waitForHandshake","requireHandshakePath","applyAppEnvTemplate"],"sources":["../src/app-runner.ts"],"sourcesContent":["/**\n * Playwright webServer entry generated by `withZitadel()`: waits for the\n * supervisor's handshake, then runs the app's dev server with the instance\n * env applied. Signals forward to the child so Playwright teardown stops the\n * app cleanly. Configuration arrives as JSON in ZITADEL_TESTING_APP_RUNNER.\n */\nimport { spawn } from \"node:child_process\";\n\nimport { applyAppEnvTemplate } from \"./app-env\";\nimport { waitForHandshake } from \"./handshake\";\nimport { APP_RUNNER_CONFIG_ENV, parseAppRunnerConfig, requireHandshakePath } from \"./orchestration\";\n\nconst LOG = \"[zitadel-testing-app]\";\n\nasync function main(): Promise<void> {\n const config = parseAppRunnerConfig(process.env[APP_RUNNER_CONFIG_ENV]);\n const handshakePath = requireHandshakePath(process.env);\n\n const handle = await waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 180_000);\n console.log(`${LOG} starting ${config.command.join(\" \")} against ${handle.baseUrl}`);\n\n const [bin, ...args] = config.command;\n const child = spawn(bin as string, args, {\n cwd: config.cwd,\n stdio: \"inherit\",\n env: {\n ...process.env,\n ...applyAppEnvTemplate(config.env ?? {}, handle),\n },\n });\n child.on(\"exit\", (code) => {\n process.exit(code ?? 1);\n });\n for (const signal of [\"SIGTERM\", \"SIGINT\"] as const) {\n process.on(signal, () => child.kill(signal));\n }\n}\n\nmain().catch((error: unknown) => {\n console.error(`${LOG} ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM;AAEZ,eAAe,OAAsB;CACnC,MAAM,SAASA,sBAAAA,qBAAqB,QAAQ,IAAIC,sBAAAA,uBAAuB;CAGvE,MAAM,SAAS,MAAMC,kBAAAA,iBAFCC,sBAAAA,qBAAqB,QAAQ,IAEA,EAAE,OAAO,sBAAsB,KAAQ;AAC1F,SAAQ,IAAI,GAAG,IAAI,YAAY,OAAO,QAAQ,KAAK,IAAI,CAAC,WAAW,OAAO,UAAU;CAEpF,MAAM,CAAC,KAAK,GAAG,QAAQ,OAAO;CAC9B,MAAM,SAAA,GAAA,mBAAA,OAAc,KAAe,MAAM;EACvC,KAAK,OAAO;EACZ,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,GAAGC,kBAAAA,oBAAoB,OAAO,OAAO,EAAE,EAAE,OAAO;GACjD;EACF,CAAC;AACF,OAAM,GAAG,SAAS,SAAS;AACzB,UAAQ,KAAK,QAAQ,EAAE;GACvB;AACF,MAAK,MAAM,UAAU,CAAC,WAAW,SAAS,CACxC,SAAQ,GAAG,cAAc,MAAM,KAAK,OAAO,CAAC;;AAIhD,MAAM,CAAC,OAAO,UAAmB;AAC/B,SAAQ,MAAM,GAAG,IAAI,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AACjF,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"app-runner.cjs","names":["parseAppRunnerConfig","APP_RUNNER_CONFIG_ENV","requireHandshakePath","waitForHandshake","spawn","applyAppEnvTemplate"],"sources":["../src/app-runner.ts"],"sourcesContent":["/**\n * Playwright webServer entry generated by `withZitadel()`: waits for the\n * supervisor's handshake, then runs the app's dev server with the instance\n * env applied. Signals forward to the child so Playwright teardown stops the\n * app cleanly. Configuration arrives as JSON in ZITADEL_TESTING_APP_RUNNER.\n */\nimport { spawn } from \"node:child_process\";\n\nimport { applyAppEnvTemplate } from \"./app-env\";\nimport { waitForHandshake } from \"./handshake\";\nimport { APP_RUNNER_CONFIG_ENV, parseAppRunnerConfig, requireHandshakePath } from \"./orchestration\";\n\nconst LOG = \"[zitadel-testing-app]\";\n\nasync function main(): Promise<void> {\n const config = parseAppRunnerConfig(process.env[APP_RUNNER_CONFIG_ENV]);\n const handshakePath = requireHandshakePath(process.env);\n\n const handle = await waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 180_000);\n console.log(`${LOG} starting ${config.command.join(\" \")} against ${handle.baseUrl}`);\n\n const [bin, ...args] = config.command;\n const child = spawn(bin as string, args, {\n cwd: config.cwd,\n stdio: \"inherit\",\n env: {\n ...process.env,\n ...applyAppEnvTemplate(config.env ?? {}, handle),\n },\n });\n child.on(\"exit\", (code) => {\n process.exit(code ?? 1);\n });\n for (const signal of [\"SIGTERM\", \"SIGINT\"] as const) {\n process.on(signal, () => child.kill(signal));\n }\n}\n\nmain().catch((error: unknown) => {\n console.error(`${LOG} ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM;AAEZ,eAAe,OAAsB;CACnC,MAAM,SAASA,sBAAAA,qBAAqB,QAAQ,IAAIC,sBAAAA,sBAAsB;CACtE,MAAM,gBAAgBC,sBAAAA,qBAAqB,QAAQ,GAAG;CAEtD,MAAM,SAAS,MAAMC,kBAAAA,iBAAiB,eAAe,OAAO,sBAAsB,IAAO;CACzF,QAAQ,IAAI,GAAG,IAAI,YAAY,OAAO,QAAQ,KAAK,GAAG,EAAE,WAAW,OAAO,SAAS;CAEnF,MAAM,CAAC,KAAK,GAAG,QAAQ,OAAO;CAC9B,MAAM,SAAA,GAAQC,mBAAAA,MAAAA,CAAM,KAAe,MAAM;EACvC,KAAK,OAAO;EACZ,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,GAAGC,kBAAAA,oBAAoB,OAAO,OAAO,CAAC,GAAG,MAAM;EACjD;CACF,CAAC;CACD,MAAM,GAAG,SAAS,SAAS;EACzB,QAAQ,KAAK,QAAQ,CAAC;CACxB,CAAC;CACD,KAAK,MAAM,UAAU,CAAC,WAAW,QAAQ,GACvC,QAAQ,GAAG,cAAc,MAAM,KAAK,MAAM,CAAC;AAE/C;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,MAAM,GAAG,IAAI,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;CAChF,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,5 +1,5 @@
1
- import { i as applyAppEnvTemplate, n as waitForHandshake } from "./handshake-BnAPXC6s.mjs";
2
- import { i as parseAppRunnerConfig, o as requireHandshakePath, t as APP_RUNNER_CONFIG_ENV } from "./orchestration-C640_1Lg.mjs";
1
+ import { i as applyAppEnvTemplate, n as waitForHandshake } from "./handshake-CwlxMjW0.mjs";
2
+ import { i as parseAppRunnerConfig, o as requireHandshakePath, t as APP_RUNNER_CONFIG_ENV } from "./orchestration-Clldecyr.mjs";
3
3
  import { spawn } from "node:child_process";
4
4
  //#region src/app-runner.ts
5
5
  /**
@@ -11,7 +11,8 @@ import { spawn } from "node:child_process";
11
11
  const LOG = "[zitadel-testing-app]";
12
12
  async function main() {
13
13
  const config = parseAppRunnerConfig(process.env[APP_RUNNER_CONFIG_ENV]);
14
- const handle = await waitForHandshake(requireHandshakePath(process.env), config.handshakeTimeoutMs ?? 18e4);
14
+ const handshakePath = requireHandshakePath(process.env);
15
+ const handle = await waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 18e4);
15
16
  console.log(`${LOG} starting ${config.command.join(" ")} against ${handle.baseUrl}`);
16
17
  const [bin, ...args] = config.command;
17
18
  const child = spawn(bin, args, {
@@ -1 +1 @@
1
- {"version":3,"file":"app-runner.mjs","names":[],"sources":["../src/app-runner.ts"],"sourcesContent":["/**\n * Playwright webServer entry generated by `withZitadel()`: waits for the\n * supervisor's handshake, then runs the app's dev server with the instance\n * env applied. Signals forward to the child so Playwright teardown stops the\n * app cleanly. Configuration arrives as JSON in ZITADEL_TESTING_APP_RUNNER.\n */\nimport { spawn } from \"node:child_process\";\n\nimport { applyAppEnvTemplate } from \"./app-env\";\nimport { waitForHandshake } from \"./handshake\";\nimport { APP_RUNNER_CONFIG_ENV, parseAppRunnerConfig, requireHandshakePath } from \"./orchestration\";\n\nconst LOG = \"[zitadel-testing-app]\";\n\nasync function main(): Promise<void> {\n const config = parseAppRunnerConfig(process.env[APP_RUNNER_CONFIG_ENV]);\n const handshakePath = requireHandshakePath(process.env);\n\n const handle = await waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 180_000);\n console.log(`${LOG} starting ${config.command.join(\" \")} against ${handle.baseUrl}`);\n\n const [bin, ...args] = config.command;\n const child = spawn(bin as string, args, {\n cwd: config.cwd,\n stdio: \"inherit\",\n env: {\n ...process.env,\n ...applyAppEnvTemplate(config.env ?? {}, handle),\n },\n });\n child.on(\"exit\", (code) => {\n process.exit(code ?? 1);\n });\n for (const signal of [\"SIGTERM\", \"SIGINT\"] as const) {\n process.on(signal, () => child.kill(signal));\n }\n}\n\nmain().catch((error: unknown) => {\n console.error(`${LOG} ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM;AAEZ,eAAe,OAAsB;CACnC,MAAM,SAAS,qBAAqB,QAAQ,IAAI,uBAAuB;CAGvE,MAAM,SAAS,MAAM,iBAFC,qBAAqB,QAAQ,IAEA,EAAE,OAAO,sBAAsB,KAAQ;AAC1F,SAAQ,IAAI,GAAG,IAAI,YAAY,OAAO,QAAQ,KAAK,IAAI,CAAC,WAAW,OAAO,UAAU;CAEpF,MAAM,CAAC,KAAK,GAAG,QAAQ,OAAO;CAC9B,MAAM,QAAQ,MAAM,KAAe,MAAM;EACvC,KAAK,OAAO;EACZ,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,GAAG,oBAAoB,OAAO,OAAO,EAAE,EAAE,OAAO;GACjD;EACF,CAAC;AACF,OAAM,GAAG,SAAS,SAAS;AACzB,UAAQ,KAAK,QAAQ,EAAE;GACvB;AACF,MAAK,MAAM,UAAU,CAAC,WAAW,SAAS,CACxC,SAAQ,GAAG,cAAc,MAAM,KAAK,OAAO,CAAC;;AAIhD,MAAM,CAAC,OAAO,UAAmB;AAC/B,SAAQ,MAAM,GAAG,IAAI,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AACjF,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"app-runner.mjs","names":[],"sources":["../src/app-runner.ts"],"sourcesContent":["/**\n * Playwright webServer entry generated by `withZitadel()`: waits for the\n * supervisor's handshake, then runs the app's dev server with the instance\n * env applied. Signals forward to the child so Playwright teardown stops the\n * app cleanly. Configuration arrives as JSON in ZITADEL_TESTING_APP_RUNNER.\n */\nimport { spawn } from \"node:child_process\";\n\nimport { applyAppEnvTemplate } from \"./app-env\";\nimport { waitForHandshake } from \"./handshake\";\nimport { APP_RUNNER_CONFIG_ENV, parseAppRunnerConfig, requireHandshakePath } from \"./orchestration\";\n\nconst LOG = \"[zitadel-testing-app]\";\n\nasync function main(): Promise<void> {\n const config = parseAppRunnerConfig(process.env[APP_RUNNER_CONFIG_ENV]);\n const handshakePath = requireHandshakePath(process.env);\n\n const handle = await waitForHandshake(handshakePath, config.handshakeTimeoutMs ?? 180_000);\n console.log(`${LOG} starting ${config.command.join(\" \")} against ${handle.baseUrl}`);\n\n const [bin, ...args] = config.command;\n const child = spawn(bin as string, args, {\n cwd: config.cwd,\n stdio: \"inherit\",\n env: {\n ...process.env,\n ...applyAppEnvTemplate(config.env ?? {}, handle),\n },\n });\n child.on(\"exit\", (code) => {\n process.exit(code ?? 1);\n });\n for (const signal of [\"SIGTERM\", \"SIGINT\"] as const) {\n process.on(signal, () => child.kill(signal));\n }\n}\n\nmain().catch((error: unknown) => {\n console.error(`${LOG} ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM;AAEZ,eAAe,OAAsB;CACnC,MAAM,SAAS,qBAAqB,QAAQ,IAAI,sBAAsB;CACtE,MAAM,gBAAgB,qBAAqB,QAAQ,GAAG;CAEtD,MAAM,SAAS,MAAM,iBAAiB,eAAe,OAAO,sBAAsB,IAAO;CACzF,QAAQ,IAAI,GAAG,IAAI,YAAY,OAAO,QAAQ,KAAK,GAAG,EAAE,WAAW,OAAO,SAAS;CAEnF,MAAM,CAAC,KAAK,GAAG,QAAQ,OAAO;CAC9B,MAAM,QAAQ,MAAM,KAAe,MAAM;EACvC,KAAK,OAAO;EACZ,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,GAAG,oBAAoB,OAAO,OAAO,CAAC,GAAG,MAAM;EACjD;CACF,CAAC;CACD,MAAM,GAAG,SAAS,SAAS;EACzB,QAAQ,KAAK,QAAQ,CAAC;CACxB,CAAC;CACD,KAAK,MAAM,UAAU,CAAC,WAAW,QAAQ,GACvC,QAAQ,GAAG,cAAc,MAAM,KAAK,MAAM,CAAC;AAE/C;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,MAAM,GAAG,IAAI,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;CAChF,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -4,12 +4,15 @@ import { readFileSync } from "node:fs";
4
4
  import { setTimeout } from "node:timers/promises";
5
5
  //#region src/app-env.ts
6
6
  /**
7
- * The env shape `@zitadel/sdk-next` apps read. Other frameworks pass their own
8
- * template — the console maps the same handle fields to `VITE_*`/`CONSOLE_*`
9
- * names, for example.
7
+ * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.
8
+ * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the
9
+ * widgets the public copy. Other frameworks pass their own template — the
10
+ * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for
11
+ * example.
10
12
  */
11
13
  const nextAppEnv = {
12
14
  ZITADEL_URL: "baseUrl",
15
+ ZITADEL_PROJECT_ID: "projectId",
13
16
  NEXT_PUBLIC_ZITADEL_PROJECT_ID: "projectId",
14
17
  ZITADEL_PROJECT_SECRET: "projectSecret"
15
18
  };
@@ -80,4 +83,4 @@ function validatePlatform(value, source) {
80
83
  //#endregion
81
84
  export { nextAppEnv as a, applyAppEnvTemplate as i, waitForHandshake as n, writeHandshake as r, readHandshakeSync as t };
82
85
 
83
- //# sourceMappingURL=handshake-BnAPXC6s.mjs.map
86
+ //# sourceMappingURL=handshake-CwlxMjW0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-CwlxMjW0.mjs","names":["sleep"],"sources":["../src/app-env.ts","../src/handshake.ts"],"sourcesContent":["import type { InstanceHandle } from \"./types\";\n\n/**\n * Handle fields a template may reference: the flat string facts. Structured\n * fields (e.g. `platform`) are not env-var material — consumers read those\n * from the handle directly.\n */\ntype StringHandleField = {\n [K in keyof InstanceHandle]-?: InstanceHandle[K] extends string | undefined ? K : never;\n}[keyof InstanceHandle];\n\n/**\n * Declarative mapping from an app's env var names to InstanceHandle fields.\n * A template (not a function) so it can cross process boundaries: the\n * Playwright config serializes it into the app-runner's environment, where it\n * is applied to the handle read from the handshake file.\n */\nexport type AppEnvTemplate = Record<string, StringHandleField>;\n\n/**\n * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.\n * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the\n * widgets the public copy. Other frameworks pass their own template — the\n * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for\n * example.\n */\nexport const nextAppEnv: AppEnvTemplate = {\n ZITADEL_URL: \"baseUrl\",\n ZITADEL_PROJECT_ID: \"projectId\",\n NEXT_PUBLIC_ZITADEL_PROJECT_ID: \"projectId\",\n ZITADEL_PROJECT_SECRET: \"projectSecret\",\n};\n\nexport function applyAppEnvTemplate(\n template: AppEnvTemplate,\n handle: InstanceHandle,\n): Record<string, string> {\n const env: Record<string, string> = {};\n for (const [name, field] of Object.entries(template)) {\n const value = handle[field];\n if (typeof value !== \"string\" || value.length === 0) {\n // Fail instead of silently dropping the var: an app booted without one\n // of its env vars produces a much harder-to-read failure downstream.\n throw new Error(\n `app env template maps \"${name}\" to handle field \"${field}\", which the instance handle does not carry`,\n );\n }\n env[name] = value;\n }\n return env;\n}\n","import { readFileSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nimport type { InstanceHandle, PlatformCredentials } from \"./types\";\n\n/**\n * The handshake file carries an InstanceHandle across process boundaries:\n * written by the script that boots + bootstraps the instance, read by\n * Playwright workers (fixtures) and the app dev-server wrapper.\n */\nexport async function writeHandshake(path: string, handle: InstanceHandle): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, `${JSON.stringify(handle, null, 2)}\\n`, { mode: 0o600 });\n}\n\nexport function readHandshakeSync(path: string): InstanceHandle {\n const contents = readFileSync(path, \"utf8\");\n let value: unknown;\n try {\n value = JSON.parse(contents);\n } catch (error) {\n throw new Error(`handshake file ${path} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n return validateHandle(value, path);\n}\n\nexport async function waitForHandshake(path: string, timeoutMs = 60_000): Promise<InstanceHandle> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return validateHandle(JSON.parse(await readFile(path, \"utf8\")), path);\n } catch (error) {\n if (Date.now() >= deadline) {\n throw new Error(\n `handshake file not readable within ${timeoutMs}ms: ${path} (${(error as Error).message})`,\n { cause: error },\n );\n }\n await sleep(250);\n }\n }\n}\n\nfunction validateHandle(value: unknown, source: string): InstanceHandle {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(`handshake file ${source} is not an object`);\n }\n const handle = value as Partial<InstanceHandle>;\n for (const field of [\"baseUrl\", \"projectId\", \"projectSecret\", \"schemaId\"] as const) {\n if (typeof handle[field] !== \"string\" || handle[field].length === 0) {\n throw new Error(`handshake file ${source} is missing \"${field}\"`);\n }\n }\n if (!URL.canParse(handle.baseUrl as string)) {\n throw new Error(`handshake file ${source} has a malformed \"baseUrl\": ${handle.baseUrl}`);\n }\n if (handle.platform !== undefined) {\n validatePlatform(handle.platform, source);\n }\n return handle as InstanceHandle;\n}\n\n/**\n * The handshake is the cross-process contract, so a malformed platform block\n * must fail here with the field name, not later with a less actionable error.\n */\nfunction validatePlatform(value: unknown, source: string): void {\n const fail = (detail: string): never => {\n throw new Error(`handshake file ${source} has a malformed \"platform\" block: ${detail}`);\n };\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n fail(\"not an object\");\n }\n const platform = value as Partial<PlatformCredentials>;\n for (const field of [\"projectId\", \"publishableKey\"] as const) {\n if (typeof platform[field] !== \"string\" || platform[field].length === 0) {\n fail(`\"${field}\" is required`);\n }\n }\n // Unknown extra fields pass through on purpose: future platform\n // credentials join additively, and an older reader must not reject a\n // newer producer's handle.\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,aAA6B;CACxC,aAAa;CACb,oBAAoB;CACpB,gCAAgC;CAChC,wBAAwB;AAC1B;AAEA,SAAgB,oBACd,UACA,QACwB;CACxB,MAAM,MAA8B,CAAC;CACrC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG;EACpD,MAAM,QAAQ,OAAO;EACrB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAGhD,MAAM,IAAI,MACR,0BAA0B,KAAK,qBAAqB,MAAM,4CAC5D;EAEF,IAAI,QAAQ;CACd;CACA,OAAO;AACT;;;;;;;;ACtCA,eAAsB,eAAe,MAAc,QAAuC;CACxF,MAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC9C,MAAM,UAAU,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;AAC/E;AAEA,SAAgB,kBAAkB,MAA8B;CAC9D,MAAM,WAAW,aAAa,MAAM,MAAM;CAC1C,IAAI;CACJ,IAAI;EACF,QAAQ,KAAK,MAAM,QAAQ;CAC7B,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,kBAAkB,KAAK,0BAA2B,MAAgB,WAAW,EAC3F,OAAO,MACT,CAAC;CACH;CACA,OAAO,eAAe,OAAO,IAAI;AACnC;AAEA,eAAsB,iBAAiB,MAAc,YAAY,KAAiC;CAChG,MAAM,WAAW,KAAK,IAAI,IAAI;CAC9B,SACE,IAAI;EACF,OAAO,eAAe,KAAK,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,GAAG,IAAI;CACtE,SAAS,OAAO;EACd,IAAI,KAAK,IAAI,KAAK,UAChB,MAAM,IAAI,MACR,sCAAsC,UAAU,MAAM,KAAK,IAAK,MAAgB,QAAQ,IACxF,EAAE,OAAO,MAAM,CACjB;EAEF,MAAMA,WAAM,GAAG;CACjB;AAEJ;AAEA,SAAS,eAAe,OAAgB,QAAgC;CACtE,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,MAAM,kBAAkB,OAAO,kBAAkB;CAE7D,MAAM,SAAS;CACf,KAAK,MAAM,SAAS;EAAC;EAAW;EAAa;EAAiB;CAAU,GACtE,IAAI,OAAO,OAAO,WAAW,YAAY,OAAO,MAAM,CAAC,WAAW,GAChE,MAAM,IAAI,MAAM,kBAAkB,OAAO,eAAe,MAAM,EAAE;CAGpE,IAAI,CAAC,IAAI,SAAS,OAAO,OAAiB,GACxC,MAAM,IAAI,MAAM,kBAAkB,OAAO,8BAA8B,OAAO,SAAS;CAEzF,IAAI,OAAO,aAAa,KAAA,GACtB,iBAAiB,OAAO,UAAU,MAAM;CAE1C,OAAO;AACT;;;;;AAMA,SAAS,iBAAiB,OAAgB,QAAsB;CAC9D,MAAM,QAAQ,WAA0B;EACtC,MAAM,IAAI,MAAM,kBAAkB,OAAO,qCAAqC,QAAQ;CACxF;CACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,KAAK,eAAe;CAEtB,MAAM,WAAW;CACjB,KAAK,MAAM,SAAS,CAAC,aAAa,gBAAgB,GAChD,IAAI,OAAO,SAAS,WAAW,YAAY,SAAS,MAAM,CAAC,WAAW,GACpE,KAAK,IAAI,MAAM,cAAc;AAMnC"}
@@ -4,12 +4,15 @@ let node_path = require("node:path");
4
4
  let node_timers_promises = require("node:timers/promises");
5
5
  //#region src/app-env.ts
6
6
  /**
7
- * The env shape `@zitadel/sdk-next` apps read. Other frameworks pass their own
8
- * template — the console maps the same handle fields to `VITE_*`/`CONSOLE_*`
9
- * names, for example.
7
+ * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.
8
+ * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the
9
+ * widgets the public copy. Other frameworks pass their own template — the
10
+ * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for
11
+ * example.
10
12
  */
11
13
  const nextAppEnv = {
12
14
  ZITADEL_URL: "baseUrl",
15
+ ZITADEL_PROJECT_ID: "projectId",
13
16
  NEXT_PUBLIC_ZITADEL_PROJECT_ID: "projectId",
14
17
  ZITADEL_PROJECT_SECRET: "projectSecret"
15
18
  };
@@ -109,4 +112,4 @@ Object.defineProperty(exports, "writeHandshake", {
109
112
  }
110
113
  });
111
114
 
112
- //# sourceMappingURL=handshake-BOsVBPtn.cjs.map
115
+ //# sourceMappingURL=handshake-D6MXSUcd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-D6MXSUcd.cjs","names":["mkdir","dirname","writeFile","readFileSync","readFile","sleep"],"sources":["../src/app-env.ts","../src/handshake.ts"],"sourcesContent":["import type { InstanceHandle } from \"./types\";\n\n/**\n * Handle fields a template may reference: the flat string facts. Structured\n * fields (e.g. `platform`) are not env-var material — consumers read those\n * from the handle directly.\n */\ntype StringHandleField = {\n [K in keyof InstanceHandle]-?: InstanceHandle[K] extends string | undefined ? K : never;\n}[keyof InstanceHandle];\n\n/**\n * Declarative mapping from an app's env var names to InstanceHandle fields.\n * A template (not a function) so it can cross process boundaries: the\n * Playwright config serializes it into the app-runner's environment, where it\n * is applied to the handle read from the handshake file.\n */\nexport type AppEnvTemplate = Record<string, StringHandleField>;\n\n/**\n * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.\n * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the\n * widgets the public copy. Other frameworks pass their own template — the\n * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for\n * example.\n */\nexport const nextAppEnv: AppEnvTemplate = {\n ZITADEL_URL: \"baseUrl\",\n ZITADEL_PROJECT_ID: \"projectId\",\n NEXT_PUBLIC_ZITADEL_PROJECT_ID: \"projectId\",\n ZITADEL_PROJECT_SECRET: \"projectSecret\",\n};\n\nexport function applyAppEnvTemplate(\n template: AppEnvTemplate,\n handle: InstanceHandle,\n): Record<string, string> {\n const env: Record<string, string> = {};\n for (const [name, field] of Object.entries(template)) {\n const value = handle[field];\n if (typeof value !== \"string\" || value.length === 0) {\n // Fail instead of silently dropping the var: an app booted without one\n // of its env vars produces a much harder-to-read failure downstream.\n throw new Error(\n `app env template maps \"${name}\" to handle field \"${field}\", which the instance handle does not carry`,\n );\n }\n env[name] = value;\n }\n return env;\n}\n","import { readFileSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nimport type { InstanceHandle, PlatformCredentials } from \"./types\";\n\n/**\n * The handshake file carries an InstanceHandle across process boundaries:\n * written by the script that boots + bootstraps the instance, read by\n * Playwright workers (fixtures) and the app dev-server wrapper.\n */\nexport async function writeHandshake(path: string, handle: InstanceHandle): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, `${JSON.stringify(handle, null, 2)}\\n`, { mode: 0o600 });\n}\n\nexport function readHandshakeSync(path: string): InstanceHandle {\n const contents = readFileSync(path, \"utf8\");\n let value: unknown;\n try {\n value = JSON.parse(contents);\n } catch (error) {\n throw new Error(`handshake file ${path} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n return validateHandle(value, path);\n}\n\nexport async function waitForHandshake(path: string, timeoutMs = 60_000): Promise<InstanceHandle> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return validateHandle(JSON.parse(await readFile(path, \"utf8\")), path);\n } catch (error) {\n if (Date.now() >= deadline) {\n throw new Error(\n `handshake file not readable within ${timeoutMs}ms: ${path} (${(error as Error).message})`,\n { cause: error },\n );\n }\n await sleep(250);\n }\n }\n}\n\nfunction validateHandle(value: unknown, source: string): InstanceHandle {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(`handshake file ${source} is not an object`);\n }\n const handle = value as Partial<InstanceHandle>;\n for (const field of [\"baseUrl\", \"projectId\", \"projectSecret\", \"schemaId\"] as const) {\n if (typeof handle[field] !== \"string\" || handle[field].length === 0) {\n throw new Error(`handshake file ${source} is missing \"${field}\"`);\n }\n }\n if (!URL.canParse(handle.baseUrl as string)) {\n throw new Error(`handshake file ${source} has a malformed \"baseUrl\": ${handle.baseUrl}`);\n }\n if (handle.platform !== undefined) {\n validatePlatform(handle.platform, source);\n }\n return handle as InstanceHandle;\n}\n\n/**\n * The handshake is the cross-process contract, so a malformed platform block\n * must fail here with the field name, not later with a less actionable error.\n */\nfunction validatePlatform(value: unknown, source: string): void {\n const fail = (detail: string): never => {\n throw new Error(`handshake file ${source} has a malformed \"platform\" block: ${detail}`);\n };\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n fail(\"not an object\");\n }\n const platform = value as Partial<PlatformCredentials>;\n for (const field of [\"projectId\", \"publishableKey\"] as const) {\n if (typeof platform[field] !== \"string\" || platform[field].length === 0) {\n fail(`\"${field}\" is required`);\n }\n }\n // Unknown extra fields pass through on purpose: future platform\n // credentials join additively, and an older reader must not reject a\n // newer producer's handle.\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,aAA6B;CACxC,aAAa;CACb,oBAAoB;CACpB,gCAAgC;CAChC,wBAAwB;AAC1B;AAEA,SAAgB,oBACd,UACA,QACwB;CACxB,MAAM,MAA8B,CAAC;CACrC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG;EACpD,MAAM,QAAQ,OAAO;EACrB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAGhD,MAAM,IAAI,MACR,0BAA0B,KAAK,qBAAqB,MAAM,4CAC5D;EAEF,IAAI,QAAQ;CACd;CACA,OAAO;AACT;;;;;;;;ACtCA,eAAsB,eAAe,MAAc,QAAuC;CACxF,OAAA,GAAMA,iBAAAA,MAAAA,EAAAA,GAAMC,UAAAA,QAAAA,CAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC9C,OAAA,GAAMC,iBAAAA,UAAAA,CAAU,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;AAC/E;AAEA,SAAgB,kBAAkB,MAA8B;CAC9D,MAAM,YAAA,GAAWC,QAAAA,aAAAA,CAAa,MAAM,MAAM;CAC1C,IAAI;CACJ,IAAI;EACF,QAAQ,KAAK,MAAM,QAAQ;CAC7B,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,kBAAkB,KAAK,0BAA2B,MAAgB,WAAW,EAC3F,OAAO,MACT,CAAC;CACH;CACA,OAAO,eAAe,OAAO,IAAI;AACnC;AAEA,eAAsB,iBAAiB,MAAc,YAAY,KAAiC;CAChG,MAAM,WAAW,KAAK,IAAI,IAAI;CAC9B,SACE,IAAI;EACF,OAAO,eAAe,KAAK,MAAM,OAAA,GAAMC,iBAAAA,SAAAA,CAAS,MAAM,MAAM,CAAC,GAAG,IAAI;CACtE,SAAS,OAAO;EACd,IAAI,KAAK,IAAI,KAAK,UAChB,MAAM,IAAI,MACR,sCAAsC,UAAU,MAAM,KAAK,IAAK,MAAgB,QAAQ,IACxF,EAAE,OAAO,MAAM,CACjB;EAEF,OAAA,GAAMC,qBAAAA,WAAAA,CAAM,GAAG;CACjB;AAEJ;AAEA,SAAS,eAAe,OAAgB,QAAgC;CACtE,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,MAAM,kBAAkB,OAAO,kBAAkB;CAE7D,MAAM,SAAS;CACf,KAAK,MAAM,SAAS;EAAC;EAAW;EAAa;EAAiB;CAAU,GACtE,IAAI,OAAO,OAAO,WAAW,YAAY,OAAO,MAAM,CAAC,WAAW,GAChE,MAAM,IAAI,MAAM,kBAAkB,OAAO,eAAe,MAAM,EAAE;CAGpE,IAAI,CAAC,IAAI,SAAS,OAAO,OAAiB,GACxC,MAAM,IAAI,MAAM,kBAAkB,OAAO,8BAA8B,OAAO,SAAS;CAEzF,IAAI,OAAO,aAAa,KAAA,GACtB,iBAAiB,OAAO,UAAU,MAAM;CAE1C,OAAO;AACT;;;;;AAMA,SAAS,iBAAiB,OAAgB,QAAsB;CAC9D,MAAM,QAAQ,WAA0B;EACtC,MAAM,IAAI,MAAM,kBAAkB,OAAO,qCAAqC,QAAQ;CACxF;CACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,KAAK,eAAe;CAEtB,MAAM,WAAW;CACjB,KAAK,MAAM,SAAS,CAAC,aAAa,gBAAgB,GAChD,IAAI,OAAO,SAAS,WAAW,YAAY,SAAS,MAAM,CAAC,WAAW,GACpE,KAAK,IAAI,MAAM,cAAc;AAMnC"}
package/dist/index.cjs CHANGED
@@ -1,13 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-3iEZwMxn.cjs");
3
- const require_handshake = require("./handshake-BOsVBPtn.cjs");
2
+ const require_src = require("./src-BbHs0YmP.cjs");
3
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
4
4
  exports.SESSION_COOKIE_NAME = require_src.SESSION_COOKIE_NAME;
5
5
  exports.applyAppEnvTemplate = require_handshake.applyAppEnvTemplate;
6
6
  exports.bootLocalServer = require_src.bootLocalServer;
7
7
  exports.bootstrapProject = require_src.bootstrapProject;
8
8
  exports.connectZitadel = require_src.connectZitadel;
9
+ exports.identity = require_src.identity;
9
10
  exports.nextAppEnv = require_handshake.nextAppEnv;
10
11
  exports.readHandshakeSync = require_handshake.readHandshakeSync;
12
+ exports.sessionCookieName = require_src.sessionCookieName;
11
13
  exports.startLocalZitadel = require_src.startLocalZitadel;
12
14
  exports.waitForHandshake = require_handshake.waitForHandshake;
13
15
  exports.writeHandshake = require_handshake.writeHandshake;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,5 @@
1
- import { a as Identity, c as LocalZitadelRuntime, d as SeedSessionInput, f as SeedUserInput, h as SessionCookie, i as ConnectedZitadel, l as MintedSession, m as SeededUser, n as applyAppEnvTemplate, o as InstanceHandle, p as SeedUsersTemplate, r as nextAppEnv, s as LocalZitadel, t as AppEnvTemplate, u as PlatformCredentials } from "./app-env-DlrV_ePR.mjs";
2
- import { ZitadelClient } from "@zitadel/api/client";
1
+ import { _ as SeededUser, a as applyAppEnvTemplate, c as Identity, d as LocalZitadelRuntime, f as MintedSession, g as SeedUsersTemplate, h as SeedUserInput, i as AppEnvTemplate, l as InstanceHandle, m as SeedSessionInput, n as sessionCookieName, o as nextAppEnv, p as PlatformCredentials, r as identity, s as ConnectedZitadel, t as SESSION_COOKIE_NAME, u as LocalZitadel, v as SessionCookie } from "./session-BrSkzPpy.mjs";
3
2
  import { SetupPreset, SetupUseCase } from "@zitadel/config/defaults";
4
-
5
3
  //#region src/bootstrap.d.ts
6
4
  interface BootstrapProjectOptions {
7
5
  baseUrl: string;
@@ -27,7 +25,7 @@ interface BootstrappedProject {
27
25
  * bearer for everything else; the schema is uploaded without `$id` so the
28
26
  * server assigns an opaque id, which the flow must then reference.
29
27
  */
30
- declare function bootstrapProject(options: BootstrapProjectOptions): Promise<BootstrappedProject>;
28
+ export declare function bootstrapProject(options: BootstrapProjectOptions): Promise<BootstrappedProject>;
31
29
  //#endregion
32
30
  //#region src/lifecycle.d.ts
33
31
  interface BootServerOptions {
@@ -57,7 +55,7 @@ interface BootedServer {
57
55
  * wait, process-group stop), so this module stays a thin adapter; swapping it
58
56
  * for direct library calls later must not change the shape returned here.
59
57
  */
60
- declare function bootLocalServer(options?: BootServerOptions): Promise<BootedServer>;
58
+ export declare function bootLocalServer(options?: BootServerOptions): Promise<BootedServer>;
61
59
  //#endregion
62
60
  //#region src/handshake.d.ts
63
61
  /**
@@ -65,28 +63,24 @@ declare function bootLocalServer(options?: BootServerOptions): Promise<BootedSer
65
63
  * written by the script that boots + bootstraps the instance, read by
66
64
  * Playwright workers (fixtures) and the app dev-server wrapper.
67
65
  */
68
- declare function writeHandshake(path: string, handle: InstanceHandle): Promise<void>;
69
- declare function readHandshakeSync(path: string): InstanceHandle;
70
- declare function waitForHandshake(path: string, timeoutMs?: number): Promise<InstanceHandle>;
71
- //#endregion
72
- //#region src/session.d.ts
73
- /** Mirrors the server's session cookie (internal/api/session.go). */
74
- declare const SESSION_COOKIE_NAME = "__nextgen_session";
66
+ export declare function writeHandshake(path: string, handle: InstanceHandle): Promise<void>;
67
+ export declare function readHandshakeSync(path: string): InstanceHandle;
68
+ export declare function waitForHandshake(path: string, timeoutMs?: number): Promise<InstanceHandle>;
75
69
  //#endregion
76
70
  //#region src/index.d.ts
77
- type StartLocalZitadelOptions = BootServerOptions & Omit<BootstrapProjectOptions, "baseUrl">;
71
+ export type StartLocalZitadelOptions = BootServerOptions & Omit<BootstrapProjectOptions, "baseUrl">;
78
72
  /**
79
73
  * Attach to an already-bootstrapped instance/project. Lifecycle-free on
80
74
  * purpose: this is the entry point for Playwright workers (via the handshake
81
75
  * file) and, later, for seeding remote instances.
82
76
  */
83
- declare function connectZitadel(handle: InstanceHandle): ConnectedZitadel;
77
+ export declare function connectZitadel(handle: InstanceHandle): ConnectedZitadel;
84
78
  /**
85
79
  * Boot an ephemeral local instance (binary runtime + SQLite by default, no
86
80
  * Docker) and bootstrap a project + default schema + login flow on it. The
87
81
  * result can seed loginable password users immediately.
88
82
  */
89
- declare function startLocalZitadel(options?: StartLocalZitadelOptions): Promise<LocalZitadel>;
83
+ export declare function startLocalZitadel(options?: StartLocalZitadelOptions): Promise<LocalZitadel>;
90
84
  //#endregion
91
- export { type AppEnvTemplate, type BootServerOptions, type BootedServer, type BootstrapProjectOptions, type BootstrappedProject, type ConnectedZitadel, type Identity, type InstanceHandle, type LocalZitadel, type LocalZitadelRuntime, type MintedSession, type PlatformCredentials, SESSION_COOKIE_NAME, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type SessionCookie, StartLocalZitadelOptions, applyAppEnvTemplate, bootLocalServer, bootstrapProject, connectZitadel, nextAppEnv, readHandshakeSync, startLocalZitadel, waitForHandshake, writeHandshake };
85
+ export { type AppEnvTemplate, type BootServerOptions, type BootedServer, type BootstrapProjectOptions, type BootstrappedProject, type ConnectedZitadel, type Identity, type InstanceHandle, type LocalZitadel, type LocalZitadelRuntime, type MintedSession, type PlatformCredentials, SESSION_COOKIE_NAME, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type SessionCookie, applyAppEnvTemplate, identity, nextAppEnv, sessionCookieName };
92
86
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/bootstrap.ts","../src/lifecycle.ts","../src/handshake.ts","../src/session.ts","../src/index.ts"],"mappings":";;;;;UASiB,uBAAA;EACf,OAAA;EACA,WAAA;;AAFF;;;EAOE,UAAA;EACA,MAAA,GAAS,WAAA;EACT,OAAA,GAAU,YAAA;AAAA;AAAA,UAGK,mBAAA;EACf,SAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,MAAA;AAAA;;;;;;;iBAWoB,gBAAA,CACpB,OAAA,EAAS,uBAAA,GACR,OAAA,CAAQ,mBAAA;;;UCzBM,iBAAA;;EAEf,IAAA;;ADPF;;;ECYE,GAAA;EDXA;ECaA,YAAA;EDPA;ECSA,IAAA;EDRS;ECUT,MAAA;EACA,SAAA;AAAA;AAAA,UAGe,YAAA;EACf,OAAA;EACA,OAAA,EAAS,mBAAA;EACT,IAAA,IAAQ,OAAA;AAAA;;;;;;;iBASY,eAAA,CAAgB,OAAA,GAAS,iBAAA,GAAyB,OAAA,CAAQ,YAAA;;;;;;;ADlChF;iBEGsB,cAAA,CAAe,IAAA,UAAc,MAAA,EAAQ,cAAA,GAAiB,OAAA;AAAA,iBAK5D,iBAAA,CAAkB,IAAA,WAAe,cAAA;AAAA,iBAa3B,gBAAA,CAAiB,IAAA,UAAc,SAAA,YAAqB,OAAA,CAAQ,cAAA;;;;cCvBrE,mBAAA;;;KCED,wBAAA,GAA2B,iBAAA,GACrC,IAAA,CAAK,uBAAA;;AJDP;;;;iBIQgB,cAAA,CAAe,MAAA,EAAQ,cAAA,GAAiB,gBAAA;;;;;;iBA6BlC,iBAAA,CACpB,OAAA,GAAS,wBAAA,GACR,OAAA,CAAQ,YAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/bootstrap.ts","../src/lifecycle.ts","../src/handshake.ts","../src/index.ts"],"mappings":";;;UASiB;EACf;EACA;;;;;EAKA;EACA,SAAS;EACT,UAAU;;UAGK;EACf;EACA;EACA;EACA;EACA;;;;;;;;wBAWoB,iBACpB,SAAS,0BACR,QAAQ;;;UCzBM;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;EACA;;UAGe;EACf;EACA,SAAS;EACT,QAAQ;;;;;;;;wBASY,gBAAgB,UAAS,oBAAyB,QAAQ;;;;;;;;wBC/B1D,eAAe,cAAc,QAAQ,iBAAiB;wBAK5D,kBAAkB,eAAe;wBAa3B,iBAAiB,cAAc,qBAAqB,QAAQ;;;YCrBtE,2BAA2B,oBAAoB,KAAK;;;;;;wBAOhD,eAAe,QAAQ,iBAAiB;;;;;;wBA6BlC,kBACpB,UAAS,2BACR,QAAQ"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as nextAppEnv, i as applyAppEnvTemplate, n as waitForHandshake, r as writeHandshake, t as readHandshakeSync } from "./handshake-BnAPXC6s.mjs";
2
- import { a as bootstrapProject, i as bootLocalServer, n as startLocalZitadel, r as SESSION_COOKIE_NAME, t as connectZitadel } from "./src-Dkt0HHu8.mjs";
3
- export { SESSION_COOKIE_NAME, applyAppEnvTemplate, bootLocalServer, bootstrapProject, connectZitadel, nextAppEnv, readHandshakeSync, startLocalZitadel, waitForHandshake, writeHandshake };
1
+ import { a as nextAppEnv, i as applyAppEnvTemplate, n as waitForHandshake, r as writeHandshake, t as readHandshakeSync } from "./handshake-CwlxMjW0.mjs";
2
+ import { a as identity, i as sessionCookieName, n as startLocalZitadel, o as bootLocalServer, r as SESSION_COOKIE_NAME, s as bootstrapProject, t as connectZitadel } from "./src-DKJ1hMV8.mjs";
3
+ export { SESSION_COOKIE_NAME, applyAppEnvTemplate, bootLocalServer, bootstrapProject, connectZitadel, identity, nextAppEnv, readHandshakeSync, sessionCookieName, startLocalZitadel, waitForHandshake, writeHandshake };
@@ -35,4 +35,4 @@ function parseJsonEnv(raw, name) {
35
35
  //#endregion
36
36
  export { parseSupervisorConfig as a, parseAppRunnerConfig as i, HANDSHAKE_ENV as n, requireHandshakePath as o, SUPERVISOR_CONFIG_ENV as r, APP_RUNNER_CONFIG_ENV as t };
37
37
 
38
- //# sourceMappingURL=orchestration-C640_1Lg.mjs.map
38
+ //# sourceMappingURL=orchestration-Clldecyr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-C640_1Lg.mjs","names":[],"sources":["../src/orchestration.ts"],"sourcesContent":["import type { SetupPreset, SetupUseCase } from \"@zitadel/config/defaults\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\n\n/**\n * The contract between `withZitadel()` (evaluated in the Playwright config\n * process) and the two executables it points webServer entries at. Options\n * travel as JSON in these env vars because a webServer command is a plain\n * string — there is no richer channel.\n */\nexport const SUPERVISOR_CONFIG_ENV = \"ZITADEL_TESTING_SUPERVISOR\";\nexport const APP_RUNNER_CONFIG_ENV = \"ZITADEL_TESTING_APP_RUNNER\";\n/** Read by the executables and the Playwright fixtures alike. */\nexport const HANDSHAKE_ENV = \"ZITADEL_TESTING_HANDSHAKE\";\n\nexport interface SupervisorConfig {\n /** Fixed port: the config process must know the health URL up front. */\n port: number;\n appOrigins?: string[];\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. how to build it. */\n serverBinaryHint?: string;\n dir?: string;\n keep?: boolean;\n projectName?: string;\n preset?: SetupPreset;\n useCase?: SetupUseCase;\n timeoutMs?: number;\n}\n\nexport interface AppRunnerConfig {\n /** Spawn argv; executed without a shell. */\n command: string[];\n cwd?: string;\n env?: AppEnvTemplate;\n handshakeTimeoutMs?: number;\n}\n\nexport function parseSupervisorConfig(raw: string | undefined): SupervisorConfig {\n const value = parseJsonEnv(raw, SUPERVISOR_CONFIG_ENV) as Partial<SupervisorConfig>;\n if (typeof value.port !== \"number\" || !Number.isInteger(value.port) || value.port <= 0) {\n throw new Error(`${SUPERVISOR_CONFIG_ENV} must carry a positive integer \"port\"`);\n }\n return value as SupervisorConfig;\n}\n\nexport function parseAppRunnerConfig(raw: string | undefined): AppRunnerConfig {\n const value = parseJsonEnv(raw, APP_RUNNER_CONFIG_ENV) as Partial<AppRunnerConfig>;\n if (\n !Array.isArray(value.command) ||\n value.command.length === 0 ||\n value.command.some((part) => typeof part !== \"string\" || part.length === 0)\n ) {\n throw new Error(`${APP_RUNNER_CONFIG_ENV} must carry a non-empty string[] \"command\"`);\n }\n return value as AppRunnerConfig;\n}\n\nexport function requireHandshakePath(env: NodeJS.ProcessEnv): string {\n const path = env[HANDSHAKE_ENV];\n if (!path) {\n throw new Error(\n `${HANDSHAKE_ENV} is not set. These entry points are meant to be launched ` +\n `by the webServer entries that withZitadel() generates.`,\n );\n }\n return path;\n}\n\nfunction parseJsonEnv(raw: string | undefined, name: string): unknown {\n if (!raw) {\n throw new Error(\n `${name} is not set. This entry point is meant to be launched by the ` +\n `webServer entries that withZitadel() generates.`,\n );\n }\n try {\n return JSON.parse(raw);\n } catch (error) {\n throw new Error(`${name} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,gBAAgB;AAyB7B,SAAgB,sBAAsB,KAA2C;CAC/E,MAAM,QAAQ,aAAa,KAAK,sBAAsB;AACtD,KAAI,OAAO,MAAM,SAAS,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,IAAI,MAAM,QAAQ,EACnF,OAAM,IAAI,MAAM,GAAG,sBAAsB,uCAAuC;AAElF,QAAO;;AAGT,SAAgB,qBAAqB,KAA0C;CAC7E,MAAM,QAAQ,aAAa,KAAK,sBAAsB;AACtD,KACE,CAAC,MAAM,QAAQ,MAAM,QAAQ,IAC7B,MAAM,QAAQ,WAAW,KACzB,MAAM,QAAQ,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,EAAE,CAE3E,OAAM,IAAI,MAAM,GAAG,sBAAsB,4CAA4C;AAEvF,QAAO;;AAGT,SAAgB,qBAAqB,KAAgC;CACnE,MAAM,OAAO,IAAI;AACjB,KAAI,CAAC,KACH,OAAM,IAAI,MACR,GAAG,cAAc,iHAElB;AAEH,QAAO;;AAGT,SAAS,aAAa,KAAyB,MAAuB;AACpE,KAAI,CAAC,IACH,OAAM,IAAI,MACR,GAAG,KAAK,8GAET;AAEH,KAAI;AACF,SAAO,KAAK,MAAM,IAAI;UACf,OAAO;AACd,QAAM,IAAI,MAAM,GAAG,KAAK,0BAA2B,MAAgB,WAAW,EAC5E,OAAO,OACR,CAAC"}
1
+ {"version":3,"file":"orchestration-Clldecyr.mjs","names":[],"sources":["../src/orchestration.ts"],"sourcesContent":["import type { SetupPreset, SetupUseCase } from \"@zitadel/config/defaults\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\n\n/**\n * The contract between `withZitadel()` (evaluated in the Playwright config\n * process) and the two executables it points webServer entries at. Options\n * travel as JSON in these env vars because a webServer command is a plain\n * string — there is no richer channel.\n */\nexport const SUPERVISOR_CONFIG_ENV = \"ZITADEL_TESTING_SUPERVISOR\";\nexport const APP_RUNNER_CONFIG_ENV = \"ZITADEL_TESTING_APP_RUNNER\";\n/** Read by the executables and the Playwright fixtures alike. */\nexport const HANDSHAKE_ENV = \"ZITADEL_TESTING_HANDSHAKE\";\n\nexport interface SupervisorConfig {\n /** Fixed port: the config process must know the health URL up front. */\n port: number;\n appOrigins?: string[];\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. how to build it. */\n serverBinaryHint?: string;\n dir?: string;\n keep?: boolean;\n projectName?: string;\n preset?: SetupPreset;\n useCase?: SetupUseCase;\n timeoutMs?: number;\n}\n\nexport interface AppRunnerConfig {\n /** Spawn argv; executed without a shell. */\n command: string[];\n cwd?: string;\n env?: AppEnvTemplate;\n handshakeTimeoutMs?: number;\n}\n\nexport function parseSupervisorConfig(raw: string | undefined): SupervisorConfig {\n const value = parseJsonEnv(raw, SUPERVISOR_CONFIG_ENV) as Partial<SupervisorConfig>;\n if (typeof value.port !== \"number\" || !Number.isInteger(value.port) || value.port <= 0) {\n throw new Error(`${SUPERVISOR_CONFIG_ENV} must carry a positive integer \"port\"`);\n }\n return value as SupervisorConfig;\n}\n\nexport function parseAppRunnerConfig(raw: string | undefined): AppRunnerConfig {\n const value = parseJsonEnv(raw, APP_RUNNER_CONFIG_ENV) as Partial<AppRunnerConfig>;\n if (\n !Array.isArray(value.command) ||\n value.command.length === 0 ||\n value.command.some((part) => typeof part !== \"string\" || part.length === 0)\n ) {\n throw new Error(`${APP_RUNNER_CONFIG_ENV} must carry a non-empty string[] \"command\"`);\n }\n return value as AppRunnerConfig;\n}\n\nexport function requireHandshakePath(env: NodeJS.ProcessEnv): string {\n const path = env[HANDSHAKE_ENV];\n if (!path) {\n throw new Error(\n `${HANDSHAKE_ENV} is not set. These entry points are meant to be launched ` +\n `by the webServer entries that withZitadel() generates.`,\n );\n }\n return path;\n}\n\nfunction parseJsonEnv(raw: string | undefined, name: string): unknown {\n if (!raw) {\n throw new Error(\n `${name} is not set. This entry point is meant to be launched by the ` +\n `webServer entries that withZitadel() generates.`,\n );\n }\n try {\n return JSON.parse(raw);\n } catch (error) {\n throw new Error(`${name} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,gBAAgB;AAyB7B,SAAgB,sBAAsB,KAA2C;CAC/E,MAAM,QAAQ,aAAa,KAAK,qBAAqB;CACrD,IAAI,OAAO,MAAM,SAAS,YAAY,CAAC,OAAO,UAAU,MAAM,IAAI,KAAK,MAAM,QAAQ,GACnF,MAAM,IAAI,MAAM,GAAG,sBAAsB,sCAAsC;CAEjF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAA0C;CAC7E,MAAM,QAAQ,aAAa,KAAK,qBAAqB;CACrD,IACE,CAAC,MAAM,QAAQ,MAAM,OAAO,KAC5B,MAAM,QAAQ,WAAW,KACzB,MAAM,QAAQ,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,CAAC,GAE1E,MAAM,IAAI,MAAM,GAAG,sBAAsB,2CAA2C;CAEtF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAgC;CACnE,MAAM,OAAO,IAAI;CACjB,IAAI,CAAC,MACH,MAAM,IAAI,MACR,GAAG,cAAc,gHAEnB;CAEF,OAAO;AACT;AAEA,SAAS,aAAa,KAAyB,MAAuB;CACpE,IAAI,CAAC,KACH,MAAM,IAAI,MACR,GAAG,KAAK,6GAEV;CAEF,IAAI;EACF,OAAO,KAAK,MAAM,GAAG;CACvB,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,GAAG,KAAK,0BAA2B,MAAgB,WAAW,EAC5E,OAAO,MACT,CAAC;CACH;AACF"}
@@ -70,4 +70,4 @@ Object.defineProperty(exports, "requireHandshakePath", {
70
70
  }
71
71
  });
72
72
 
73
- //# sourceMappingURL=orchestration-D7QBgQ0l.cjs.map
73
+ //# sourceMappingURL=orchestration-gIDANMcF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-D7QBgQ0l.cjs","names":[],"sources":["../src/orchestration.ts"],"sourcesContent":["import type { SetupPreset, SetupUseCase } from \"@zitadel/config/defaults\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\n\n/**\n * The contract between `withZitadel()` (evaluated in the Playwright config\n * process) and the two executables it points webServer entries at. Options\n * travel as JSON in these env vars because a webServer command is a plain\n * string — there is no richer channel.\n */\nexport const SUPERVISOR_CONFIG_ENV = \"ZITADEL_TESTING_SUPERVISOR\";\nexport const APP_RUNNER_CONFIG_ENV = \"ZITADEL_TESTING_APP_RUNNER\";\n/** Read by the executables and the Playwright fixtures alike. */\nexport const HANDSHAKE_ENV = \"ZITADEL_TESTING_HANDSHAKE\";\n\nexport interface SupervisorConfig {\n /** Fixed port: the config process must know the health URL up front. */\n port: number;\n appOrigins?: string[];\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. how to build it. */\n serverBinaryHint?: string;\n dir?: string;\n keep?: boolean;\n projectName?: string;\n preset?: SetupPreset;\n useCase?: SetupUseCase;\n timeoutMs?: number;\n}\n\nexport interface AppRunnerConfig {\n /** Spawn argv; executed without a shell. */\n command: string[];\n cwd?: string;\n env?: AppEnvTemplate;\n handshakeTimeoutMs?: number;\n}\n\nexport function parseSupervisorConfig(raw: string | undefined): SupervisorConfig {\n const value = parseJsonEnv(raw, SUPERVISOR_CONFIG_ENV) as Partial<SupervisorConfig>;\n if (typeof value.port !== \"number\" || !Number.isInteger(value.port) || value.port <= 0) {\n throw new Error(`${SUPERVISOR_CONFIG_ENV} must carry a positive integer \"port\"`);\n }\n return value as SupervisorConfig;\n}\n\nexport function parseAppRunnerConfig(raw: string | undefined): AppRunnerConfig {\n const value = parseJsonEnv(raw, APP_RUNNER_CONFIG_ENV) as Partial<AppRunnerConfig>;\n if (\n !Array.isArray(value.command) ||\n value.command.length === 0 ||\n value.command.some((part) => typeof part !== \"string\" || part.length === 0)\n ) {\n throw new Error(`${APP_RUNNER_CONFIG_ENV} must carry a non-empty string[] \"command\"`);\n }\n return value as AppRunnerConfig;\n}\n\nexport function requireHandshakePath(env: NodeJS.ProcessEnv): string {\n const path = env[HANDSHAKE_ENV];\n if (!path) {\n throw new Error(\n `${HANDSHAKE_ENV} is not set. These entry points are meant to be launched ` +\n `by the webServer entries that withZitadel() generates.`,\n );\n }\n return path;\n}\n\nfunction parseJsonEnv(raw: string | undefined, name: string): unknown {\n if (!raw) {\n throw new Error(\n `${name} is not set. This entry point is meant to be launched by the ` +\n `webServer entries that withZitadel() generates.`,\n );\n }\n try {\n return JSON.parse(raw);\n } catch (error) {\n throw new Error(`${name} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,gBAAgB;AAyB7B,SAAgB,sBAAsB,KAA2C;CAC/E,MAAM,QAAQ,aAAa,KAAK,sBAAsB;AACtD,KAAI,OAAO,MAAM,SAAS,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,IAAI,MAAM,QAAQ,EACnF,OAAM,IAAI,MAAM,GAAG,sBAAsB,uCAAuC;AAElF,QAAO;;AAGT,SAAgB,qBAAqB,KAA0C;CAC7E,MAAM,QAAQ,aAAa,KAAK,sBAAsB;AACtD,KACE,CAAC,MAAM,QAAQ,MAAM,QAAQ,IAC7B,MAAM,QAAQ,WAAW,KACzB,MAAM,QAAQ,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,EAAE,CAE3E,OAAM,IAAI,MAAM,GAAG,sBAAsB,4CAA4C;AAEvF,QAAO;;AAGT,SAAgB,qBAAqB,KAAgC;CACnE,MAAM,OAAO,IAAI;AACjB,KAAI,CAAC,KACH,OAAM,IAAI,MACR,GAAG,cAAc,iHAElB;AAEH,QAAO;;AAGT,SAAS,aAAa,KAAyB,MAAuB;AACpE,KAAI,CAAC,IACH,OAAM,IAAI,MACR,GAAG,KAAK,8GAET;AAEH,KAAI;AACF,SAAO,KAAK,MAAM,IAAI;UACf,OAAO;AACd,QAAM,IAAI,MAAM,GAAG,KAAK,0BAA2B,MAAgB,WAAW,EAC5E,OAAO,OACR,CAAC"}
1
+ {"version":3,"file":"orchestration-gIDANMcF.cjs","names":[],"sources":["../src/orchestration.ts"],"sourcesContent":["import type { SetupPreset, SetupUseCase } from \"@zitadel/config/defaults\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\n\n/**\n * The contract between `withZitadel()` (evaluated in the Playwright config\n * process) and the two executables it points webServer entries at. Options\n * travel as JSON in these env vars because a webServer command is a plain\n * string — there is no richer channel.\n */\nexport const SUPERVISOR_CONFIG_ENV = \"ZITADEL_TESTING_SUPERVISOR\";\nexport const APP_RUNNER_CONFIG_ENV = \"ZITADEL_TESTING_APP_RUNNER\";\n/** Read by the executables and the Playwright fixtures alike. */\nexport const HANDSHAKE_ENV = \"ZITADEL_TESTING_HANDSHAKE\";\n\nexport interface SupervisorConfig {\n /** Fixed port: the config process must know the health URL up front. */\n port: number;\n appOrigins?: string[];\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. how to build it. */\n serverBinaryHint?: string;\n dir?: string;\n keep?: boolean;\n projectName?: string;\n preset?: SetupPreset;\n useCase?: SetupUseCase;\n timeoutMs?: number;\n}\n\nexport interface AppRunnerConfig {\n /** Spawn argv; executed without a shell. */\n command: string[];\n cwd?: string;\n env?: AppEnvTemplate;\n handshakeTimeoutMs?: number;\n}\n\nexport function parseSupervisorConfig(raw: string | undefined): SupervisorConfig {\n const value = parseJsonEnv(raw, SUPERVISOR_CONFIG_ENV) as Partial<SupervisorConfig>;\n if (typeof value.port !== \"number\" || !Number.isInteger(value.port) || value.port <= 0) {\n throw new Error(`${SUPERVISOR_CONFIG_ENV} must carry a positive integer \"port\"`);\n }\n return value as SupervisorConfig;\n}\n\nexport function parseAppRunnerConfig(raw: string | undefined): AppRunnerConfig {\n const value = parseJsonEnv(raw, APP_RUNNER_CONFIG_ENV) as Partial<AppRunnerConfig>;\n if (\n !Array.isArray(value.command) ||\n value.command.length === 0 ||\n value.command.some((part) => typeof part !== \"string\" || part.length === 0)\n ) {\n throw new Error(`${APP_RUNNER_CONFIG_ENV} must carry a non-empty string[] \"command\"`);\n }\n return value as AppRunnerConfig;\n}\n\nexport function requireHandshakePath(env: NodeJS.ProcessEnv): string {\n const path = env[HANDSHAKE_ENV];\n if (!path) {\n throw new Error(\n `${HANDSHAKE_ENV} is not set. These entry points are meant to be launched ` +\n `by the webServer entries that withZitadel() generates.`,\n );\n }\n return path;\n}\n\nfunction parseJsonEnv(raw: string | undefined, name: string): unknown {\n if (!raw) {\n throw new Error(\n `${name} is not set. This entry point is meant to be launched by the ` +\n `webServer entries that withZitadel() generates.`,\n );\n }\n try {\n return JSON.parse(raw);\n } catch (error) {\n throw new Error(`${name} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,gBAAgB;AAyB7B,SAAgB,sBAAsB,KAA2C;CAC/E,MAAM,QAAQ,aAAa,KAAK,qBAAqB;CACrD,IAAI,OAAO,MAAM,SAAS,YAAY,CAAC,OAAO,UAAU,MAAM,IAAI,KAAK,MAAM,QAAQ,GACnF,MAAM,IAAI,MAAM,GAAG,sBAAsB,sCAAsC;CAEjF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAA0C;CAC7E,MAAM,QAAQ,aAAa,KAAK,qBAAqB;CACrD,IACE,CAAC,MAAM,QAAQ,MAAM,OAAO,KAC5B,MAAM,QAAQ,WAAW,KACzB,MAAM,QAAQ,MAAM,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,CAAC,GAE1E,MAAM,IAAI,MAAM,GAAG,sBAAsB,2CAA2C;CAEtF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAgC;CACnE,MAAM,OAAO,IAAI;CACjB,IAAI,CAAC,MACH,MAAM,IAAI,MACR,GAAG,cAAc,gHAEnB;CAEF,OAAO;AACT;AAEA,SAAS,aAAa,KAAyB,MAAuB;CACpE,IAAI,CAAC,KACH,MAAM,IAAI,MACR,GAAG,KAAK,6GAEV;CAEF,IAAI;EACF,OAAO,KAAK,MAAM,GAAG;CACvB,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,GAAG,KAAK,0BAA2B,MAAgB,WAAW,EAC5E,OAAO,MACT,CAAC;CACH;AACF"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-3iEZwMxn.cjs");
3
- const require_handshake = require("./handshake-BOsVBPtn.cjs");
4
- const require_orchestration = require("./orchestration-D7QBgQ0l.cjs");
2
+ const require_src = require("./src-BbHs0YmP.cjs");
3
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
4
+ const require_orchestration = require("./orchestration-gIDANMcF.cjs");
5
5
  let node_fs = require("node:fs");
6
6
  let node_url = require("node:url");
7
7
  let node_path = require("node:path");
@@ -111,7 +111,7 @@ function flowAction(page, action, options = {}) {
111
111
  */
112
112
  function flowField(page, field, options = {}) {
113
113
  let candidates = page.getByTestId(`zitadel-input-${field}`).or(page.getByTestId(`zitadel-field-${field}`).locator("input"));
114
- if (options.label) candidates = candidates.or(widgetRoot(page).getByLabel(options.label));
114
+ if (options.label) candidates = candidates.or(widgetRoot(page).getByRole("textbox", { name: options.label }));
115
115
  return candidates.first();
116
116
  }
117
117
  /** Click a flow action (auto-waits like any locator click). */
@@ -262,7 +262,7 @@ function withZitadel(options, resolveEntry = entryPoint) {
262
262
  const origin = URL.canParse(appOrigin) ? new URL(appOrigin) : void 0;
263
263
  if (!origin || origin.protocol !== "http:" && origin.protocol !== "https:" || origin.pathname !== "/" || origin.search !== "" || origin.hash !== "") throw new Error(`withZitadel: appOrigin must be an origin like "http://localhost:3002", got "${appOrigin}"`);
264
264
  if (app === void 0) {
265
- const loopbackHosts = new Set([
265
+ const loopbackHosts = /* @__PURE__ */ new Set([
266
266
  "localhost",
267
267
  "127.0.0.1",
268
268
  "[::1]"
@@ -381,6 +381,10 @@ const test = _playwright_test.test.extend({
381
381
  await context.addCookies([{
382
382
  ...cookie,
383
383
  url: baseURL
384
+ }, {
385
+ ...cookie,
386
+ name: require_src.sessionCookieName(zitadel.handle.projectId),
387
+ url: baseURL
384
388
  }]);
385
389
  await use({
386
390
  page: await context.newPage(),
@@ -391,6 +395,7 @@ const test = _playwright_test.test.extend({
391
395
  }
392
396
  });
393
397
  //#endregion
398
+ exports.SESSION_COOKIE_NAME = require_src.SESSION_COOKIE_NAME;
394
399
  exports.applyAppEnvTemplate = require_handshake.applyAppEnvTemplate;
395
400
  exports.clickFlowAction = clickFlowAction;
396
401
  exports.enableVirtualPasskey = enableVirtualPasskey;
@@ -403,11 +408,13 @@ Object.defineProperty(exports, "expect", {
403
408
  exports.fillFlowField = fillFlowField;
404
409
  exports.flowAction = flowAction;
405
410
  exports.flowField = flowField;
411
+ exports.identity = require_src.identity;
406
412
  exports.loginWithPasskey = loginWithPasskey;
407
413
  exports.loginWithPassword = loginWithPassword;
408
414
  exports.nextAppEnv = require_handshake.nextAppEnv;
409
415
  exports.registerWithPasskey = registerWithPasskey;
410
416
  exports.registerWithPassword = registerWithPassword;
417
+ exports.sessionCookieName = require_src.sessionCookieName;
411
418
  exports.test = test;
412
419
  exports.withZitadel = withZitadel;
413
420