zitejs 0.10.0-start.21 → 0.10.0-start.22

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 (112) hide show
  1. package/dist/cjs/auth/client.d.ts +2 -2
  2. package/dist/cjs/check/start/sourceRules.js +3 -0
  3. package/dist/cjs/cli.js +6 -0
  4. package/dist/cjs/dev/index.js +15 -0
  5. package/dist/cjs/dev/signin.d.ts +16 -0
  6. package/dist/cjs/dev/signin.js +76 -0
  7. package/dist/cjs/internal/appMode.d.ts +11 -0
  8. package/dist/cjs/internal/appMode.js +4 -1
  9. package/dist/cjs/internal/appToken.d.ts +17 -0
  10. package/dist/cjs/internal/appToken.js +26 -0
  11. package/dist/cjs/internal/platformFetch.d.ts +2 -0
  12. package/dist/cjs/internal/platformFetch.js +13 -0
  13. package/dist/cjs/internal/serviceUrls.d.ts +7 -0
  14. package/dist/cjs/internal/serviceUrls.js +16 -0
  15. package/dist/cjs/runtime/index.d.ts +1 -1
  16. package/dist/cjs/start/aiUsage.d.ts +23 -0
  17. package/dist/cjs/start/aiUsage.js +151 -0
  18. package/dist/cjs/start/devApp.d.ts +1 -0
  19. package/dist/cjs/start/devApp.js +6 -0
  20. package/dist/cjs/start/entries.js +4 -0
  21. package/dist/cjs/start/provider.d.ts +24 -0
  22. package/dist/cjs/start/provider.js +159 -0
  23. package/dist/cjs/start/types.d.ts +320 -0
  24. package/dist/cjs/start/types.js +2 -0
  25. package/dist/cjs/upload/index.js +73 -22
  26. package/dist/cjs/upload/index.test.js +35 -2
  27. package/dist/esm/auth/client.d.ts +2 -2
  28. package/dist/esm/check/start/sourceRules.js +3 -0
  29. package/dist/esm/cli.js +6 -0
  30. package/dist/esm/dev/index.js +15 -0
  31. package/dist/esm/dev/signin.d.ts +16 -0
  32. package/dist/esm/dev/signin.js +72 -0
  33. package/dist/esm/internal/appMode.d.ts +11 -0
  34. package/dist/esm/internal/appMode.js +2 -0
  35. package/dist/esm/internal/appToken.d.ts +17 -0
  36. package/dist/esm/internal/appToken.js +22 -0
  37. package/dist/esm/internal/platformFetch.d.ts +2 -0
  38. package/dist/esm/internal/platformFetch.js +8 -0
  39. package/dist/esm/internal/serviceUrls.d.ts +7 -0
  40. package/dist/esm/internal/serviceUrls.js +12 -0
  41. package/dist/esm/runtime/index.d.ts +1 -1
  42. package/dist/esm/signin/conformance.d.ts +100 -0
  43. package/dist/esm/signin/conformance.js +471 -0
  44. package/dist/esm/signin/cookies.d.ts +28 -0
  45. package/dist/esm/signin/cookies.js +59 -0
  46. package/dist/esm/signin/encoding.d.ts +9 -0
  47. package/dist/esm/signin/encoding.js +39 -0
  48. package/dist/esm/signin/endpoints.d.ts +12 -0
  49. package/dist/esm/signin/endpoints.js +29 -0
  50. package/dist/esm/signin/http.d.ts +25 -0
  51. package/dist/esm/signin/http.js +69 -0
  52. package/dist/esm/signin/index.d.ts +8 -0
  53. package/dist/esm/signin/index.js +9 -0
  54. package/dist/esm/signin/keys.d.ts +39 -0
  55. package/dist/esm/signin/keys.js +80 -0
  56. package/dist/esm/signin/paths.d.ts +2 -0
  57. package/dist/esm/signin/paths.js +2 -0
  58. package/dist/esm/signin/seal.d.ts +8 -0
  59. package/dist/esm/signin/seal.js +35 -0
  60. package/dist/esm/signin/signin.d.ts +60 -0
  61. package/dist/esm/signin/signin.js +340 -0
  62. package/dist/esm/signin/transport.d.ts +111 -0
  63. package/dist/esm/signin/transport.js +1 -0
  64. package/dist/esm/signin/verify.d.ts +77 -0
  65. package/dist/esm/signin/verify.js +155 -0
  66. package/dist/esm/start/airtable/index.d.ts +1 -1
  67. package/dist/esm/start/analytics.d.ts +5 -0
  68. package/dist/esm/start/analytics.js +77 -0
  69. package/dist/esm/start/data/index.d.ts +3 -3
  70. package/dist/esm/start/data/index.js +1 -1
  71. package/dist/esm/start/devApp.d.ts +1 -0
  72. package/dist/esm/start/devApp.js +3 -0
  73. package/dist/esm/start/devSignIn.d.ts +1 -0
  74. package/dist/esm/start/devSignIn.js +3 -0
  75. package/dist/esm/start/direct.d.ts +40 -0
  76. package/dist/esm/start/direct.js +313 -0
  77. package/dist/esm/start/entries.js +4 -0
  78. package/dist/esm/start/fetch.d.ts +1 -0
  79. package/dist/esm/start/fetch.js +4 -0
  80. package/dist/esm/start/instance.js +6 -2
  81. package/dist/esm/start/localSignIn.d.ts +18 -0
  82. package/dist/esm/start/localSignIn.js +73 -0
  83. package/dist/esm/start/outbound.d.ts +10 -1
  84. package/dist/esm/start/outbound.js +132 -22
  85. package/dist/esm/start/pageHead.d.ts +36 -0
  86. package/dist/esm/start/pageHead.js +178 -0
  87. package/dist/esm/start/provider.d.ts +24 -0
  88. package/dist/esm/start/provider.js +150 -0
  89. package/dist/esm/start/router.d.ts +6 -2
  90. package/dist/esm/start/router.js +41 -2
  91. package/dist/esm/start/server.d.ts +13 -6
  92. package/dist/esm/start/server.js +173 -42
  93. package/dist/esm/start/telemetry.d.ts +10 -0
  94. package/dist/esm/start/telemetry.js +74 -0
  95. package/dist/esm/start/types.d.ts +117 -2
  96. package/dist/esm/start/uploads.d.ts +2 -0
  97. package/dist/esm/start/uploads.js +52 -0
  98. package/dist/esm/start/version.d.ts +1 -1
  99. package/dist/esm/start/version.js +1 -1
  100. package/dist/esm/start/vite.d.ts +12 -1
  101. package/dist/esm/start/vite.js +116 -4
  102. package/dist/esm/start/workspaceSchema.d.ts +1 -0
  103. package/dist/esm/start/workspaceSchema.js +3 -0
  104. package/dist/esm/upload/index.js +74 -23
  105. package/dist/esm/upload/index.test.js +35 -2
  106. package/package.json +21 -11
  107. package/dist/cjs/auth-server/index.d.ts +0 -369
  108. package/dist/cjs/auth-server/index.js +0 -119
  109. package/dist/esm/auth-server/index.d.ts +0 -369
  110. package/dist/esm/auth-server/index.js +0 -116
  111. package/dist/esm/start/problems.d.ts +0 -19
  112. package/dist/esm/start/problems.js +0 -8
@@ -963,6 +963,9 @@ export function sourceProblems(sources, { internal = false, kind } = {}) {
963
963
  if (source === "cloudflare:workers") {
964
964
  report("cloudflare-env", "error", path, statement, "read the app's environment from process.env, not cloudflare:workers");
965
965
  }
966
+ if (importsModule(source, "zitejs/signin")) {
967
+ report("platform-import", "error", path, statement, "zitejs/signin is the platform's sign-in client, which runs for you; send people to sign in with loginWithRedirect() from zitejs/auth, or a link to loginHref() from zitejs/start");
968
+ }
966
969
  const typeOnly = values !== "all" && values.length === 0;
967
970
  // Loading a module is fine without a request; only calling one of its server functions isn't.
968
971
  const target = callsWorkflow ? resolveImport(path, source, paths) : undefined;
package/dist/esm/cli.js CHANGED
@@ -48,6 +48,12 @@ async function main() {
48
48
  console.error(' check Typecheck and build every app and automation; a Start app is typechecked with tsgo against its regenerated route tree and its source checked by rule (--json for a report)');
49
49
  console.error(' bundle Bundle endpoints (src/api/*.ts, or an automation\'s src/index.ts) for cloudflare-lambda');
50
50
  console.error(' describe Print what a built TanStack Start app declares: functions, routes, access');
51
+ console.error('');
52
+ console.error("A Start app under `vite dev` reaches Zite's data and services with these, from the app's .env:");
53
+ console.error(" ZITE_DEV_API_KEY Your Zite API key, as the MCP takes it: mints dev tokens for the app zite.config.json's id names; each lasts 15 minutes and is renewed before it expires");
54
+ console.error(' ZITE_DEV_TOKEN A dev token to use as it is instead, never renewed');
55
+ console.error(' ZITE_URLS JSON naming the platform: {"baseRunner","backend","aiGateway"?,"runs"?,"email"?,"pdf"?,"uploads"?,"steps"?}; a service it doesn\'t name is the backend\'s');
56
+ console.error(' ZITE_DEV_USER JSON of the signed-in stand-in: {"id","email","name"?,"roles"?,"isInternal"?}; unset, nobody is');
51
57
  process.exit(1);
52
58
  }
53
59
  }
@@ -4,6 +4,7 @@ import { dirname, join, resolve } from "path";
4
4
  import { findWorkspaceRoot, listSourceDirs, } from "../sourceRoots.js";
5
5
  import { isStartAppDir, regenerateStartEntries, workspaceHasStartApps, } from "../start/entries.js";
6
6
  import { runSync } from "../sync/index.js";
7
+ import { writeDevSignIn } from "./signin.js";
7
8
  import { generateDbTs, generateApiTs, generateBackendWrapperTs, generateAirtableTs, findEmailIntegrationId, generateEmailSdk, generateIntegrationsIndex, } from "../sync/lib.js";
8
9
  import { gettableIntegrations, } from "../integrations/rules.js";
9
10
  const debounceTimers = new Map();
@@ -235,6 +236,20 @@ export async function runDev() {
235
236
  regenerateAppIntegrationsIndex(app);
236
237
  regenerateStartEntries(app);
237
238
  }
239
+ // Sign-in under `vite dev`: each Start app's issuer, dev client and session secret.
240
+ for (const app of appDirs) {
241
+ if (!isStartAppDir(app.path))
242
+ continue;
243
+ try {
244
+ const result = await writeDevSignIn(app.path);
245
+ console.log(result.written
246
+ ? `Sign-in for ${app.path} under vite dev: ${result.clientId} at ${result.issuer}`
247
+ : `No sign-in for ${app.path} under vite dev: ${result.reason}`);
248
+ }
249
+ catch (err) {
250
+ console.warn(`Couldn't set up sign-in for ${app.path}:`, err instanceof Error ? err.message : err);
251
+ }
252
+ }
238
253
  // 3. Watch each dir's src/api/ for endpoint changes
239
254
  let watchingAny = false;
240
255
  for (const app of appDirs) {
@@ -0,0 +1,16 @@
1
+ export declare const DEV_ENV_FILE: string;
2
+ type Env = Record<string, string | undefined>;
3
+ export type DevSignInResult = {
4
+ written: true;
5
+ issuer: string;
6
+ clientId: string;
7
+ } | {
8
+ written: false;
9
+ reason: string;
10
+ };
11
+ /**
12
+ * Writes the app's `.zite/dev.env` from its dev token's `appUrl`: issuer `<appUrl>/auth`, client `<app>:dev`. Keeps
13
+ * the secret a previous run wrote, so sessions outlive a restart.
14
+ */
15
+ export declare function writeDevSignIn(appDir: string, shell?: Env): Promise<DevSignInResult>;
16
+ export {};
@@ -0,0 +1,72 @@
1
+ // `zitejs dev`'s share of sign-in under `vite dev` (T5 design §5.9): the app's issuer and dev client, and a secret
2
+ // that seals its session cookie, in `.zite/dev.env`, which `zite()` hands the module.
3
+ import { randomBytes } from "node:crypto";
4
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { parse } from "dotenv";
7
+ import { appTokenClaims } from "../internal/appToken.js";
8
+ import { LOCAL_ENV, localUrls, mintDevToken } from "../start/provider.js";
9
+ export const DEV_ENV_FILE = join(".zite", "dev.env");
10
+ const readEnvFile = (path) => {
11
+ try {
12
+ return parse(readFileSync(path, "utf-8"));
13
+ }
14
+ catch {
15
+ return {};
16
+ }
17
+ };
18
+ /** The app's env as `vite dev` reads it: its `.env`, then `.env.local`, over the shell's. */
19
+ const appEnvOf = (appDir, shell) => ({
20
+ ...readEnvFile(join(appDir, ".env")),
21
+ ...readEnvFile(join(appDir, ".env.local")),
22
+ ...shell,
23
+ });
24
+ const appIdOf = (appDir) => {
25
+ try {
26
+ const { id } = JSON.parse(readFileSync(join(appDir, "zite.config.json"), "utf-8"));
27
+ return typeof id === "string" && id ? id : undefined;
28
+ }
29
+ catch {
30
+ return undefined;
31
+ }
32
+ };
33
+ // `.zite/` is otherwise committed, generated code; the secret must never be.
34
+ const ignoreDevEnv = (appDir) => {
35
+ const path = join(appDir, ".zite", ".gitignore");
36
+ const current = existsSync(path) ? readFileSync(path, "utf-8") : "";
37
+ if (current.split(/\r?\n/).includes("dev.env"))
38
+ return;
39
+ writeFileSync(path, `${current}${current && !current.endsWith("\n") ? "\n" : ""}dev.env\n`);
40
+ };
41
+ /**
42
+ * Writes the app's `.zite/dev.env` from its dev token's `appUrl`: issuer `<appUrl>/auth`, client `<app>:dev`. Keeps
43
+ * the secret a previous run wrote, so sessions outlive a restart.
44
+ */
45
+ export async function writeDevSignIn(appDir, shell = process.env) {
46
+ const env = appEnvOf(appDir, shell);
47
+ const appId = appIdOf(appDir);
48
+ if (!appId)
49
+ return { written: false, reason: "zite.config.json names no app id" };
50
+ const apiKey = env[LOCAL_ENV.apiKey];
51
+ const given = env[LOCAL_ENV.token];
52
+ if (!given && !apiKey)
53
+ return { written: false, reason: `neither ${LOCAL_ENV.token} nor ${LOCAL_ENV.apiKey} is set` };
54
+ const token = given ?? (await mintDevToken(localUrls(env[LOCAL_ENV.urls]).backend, appId, apiKey));
55
+ const appUrl = appTokenClaims(token)?.appUrl;
56
+ if (!appUrl)
57
+ return { written: false, reason: "the app has no live URL yet; publish it once to sign in under vite dev" };
58
+ const issuer = `${new URL(appUrl).origin}/auth`;
59
+ const clientId = `${appId}:dev`;
60
+ const path = join(appDir, DEV_ENV_FILE);
61
+ const previous = readEnvFile(path).ZITE_AUTH_SECRET;
62
+ const secret = previous && previous.length >= 32 ? previous : randomBytes(32).toString("base64url");
63
+ mkdirSync(join(appDir, ".zite"), { recursive: true });
64
+ ignoreDevEnv(appDir);
65
+ writeFileSync(path, [
66
+ "# Written by `zitejs dev` for sign-in under `vite dev`. The secret seals your session cookie: never commit it.",
67
+ `ZITE_SIGNIN='${JSON.stringify({ issuer, clientId })}'`,
68
+ `ZITE_AUTH_SECRET=${secret}`,
69
+ "",
70
+ ].join("\n"), { mode: 0o600 });
71
+ return { written: true, issuer, clientId };
72
+ }
@@ -1,3 +1,14 @@
1
+ /** As Start's `PlatformProvider`: the request's app token, and where the backend and uploads are. */
2
+ type Provider = {
3
+ token(): Promise<string | undefined>;
4
+ urls?: {
5
+ backend: string;
6
+ uploads?: string;
7
+ };
8
+ };
1
9
  export declare const keepRenderedMode: (mode: string | undefined) => void;
2
10
  /** The mode the platform served this request or page in; undefined outside a Start app. */
3
11
  export declare const platformMode: () => string | undefined;
12
+ /** The request's way to the platform on its app token; undefined in the browser and outside a Start request. */
13
+ export declare const platformProvider: () => Provider | undefined;
14
+ export {};
@@ -8,3 +8,5 @@ export const keepRenderedMode = (mode) => {
8
8
  };
9
9
  /** The mode the platform served this request or page in; undefined outside a Start app. */
10
10
  export const platformMode = () => globalThis[HOST_STORE_KEY]?.getStore()?.mode ?? globalThis[RENDERED_MODE];
11
+ /** The request's way to the platform on its app token; undefined in the browser and outside a Start request. */
12
+ export const platformProvider = () => globalThis[HOST_STORE_KEY]?.getStore()?.provider;
@@ -0,0 +1,17 @@
1
+ /** The claims zitejs reads from its own app token. It never verifies one: the platform does, and zitejs only reads what it was handed. */
2
+ export type AppTokenClaims = {
3
+ /** Seconds since the epoch. */
4
+ exp: number;
5
+ app?: string;
6
+ /** The build it was minted for; a dev token's is the app's newest. */
7
+ build?: number;
8
+ base?: string | null;
9
+ mode?: string;
10
+ /** The org's settings version the token was minted under. */
11
+ ver?: number | null;
12
+ /** Whether the org's plan shows Zite's badge. */
13
+ branding?: boolean;
14
+ appUrl?: string | null;
15
+ };
16
+ /** The token's payload, or undefined for anything that isn't one. */
17
+ export declare const appTokenClaims: (token: string) => AppTokenClaims | undefined;
@@ -0,0 +1,22 @@
1
+ // Isomorphic: the upload client reads the app id from it too.
2
+ const PREFIX = "zite_app_v1.";
3
+ const decodeSegment = (segment) => {
4
+ const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
5
+ const bytes = Uint8Array.from(atob(base64 + "=".repeat((4 - (base64.length % 4)) % 4)), (c) => c.charCodeAt(0));
6
+ return JSON.parse(new TextDecoder().decode(bytes));
7
+ };
8
+ /** The token's payload, or undefined for anything that isn't one. */
9
+ export const appTokenClaims = (token) => {
10
+ if (!token.startsWith(PREFIX))
11
+ return undefined;
12
+ const payload = token.slice(PREFIX.length).split(".")[1];
13
+ if (!payload)
14
+ return undefined;
15
+ try {
16
+ const claims = decodeSegment(payload);
17
+ return claims && typeof claims.exp === "number" ? claims : undefined;
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ };
@@ -0,0 +1,2 @@
1
+ export declare const isPlatformRequest: (input: unknown) => boolean;
2
+ export declare const platformFetch: (request: Request) => Promise<Response>;
@@ -0,0 +1,8 @@
1
+ // The platform's own requests on the app token. The outbound fetch passes them through unlogged, so the token never
2
+ // reaches the run log. On globalThis, as that wrapper is, for two copies of zitejs in one bundle.
3
+ const PLATFORM_REQUESTS = Symbol.for("zitejs:platform-requests");
4
+ export const isPlatformRequest = (input) => input instanceof Request && (globalThis[PLATFORM_REQUESTS]?.has(input) ?? false);
5
+ export const platformFetch = (request) => {
6
+ (globalThis[PLATFORM_REQUESTS] ??= new WeakSet()).add(request);
7
+ return fetch(request);
8
+ };
@@ -0,0 +1,7 @@
1
+ export type ServiceName = "email" | "pdf" | "uploads" | "steps";
2
+ /** Where a service answers this app on its token: the URL the platform named for it, else the backend's route. */
3
+ export declare const serviceUrl: (urls: {
4
+ backend: string;
5
+ } & Partial<Record<ServiceName, string>>, name: ServiceName) => string;
6
+ /** A Start page's upload session, which the app's own server asks the platform for on its token. */
7
+ export declare const UPLOAD_SESSION_PATH = "/__zite/uploads/session";
@@ -0,0 +1,12 @@
1
+ // Isomorphic, and nothing of Start: classic's upload client reads it too.
2
+ // What answered each before the platform named their URLs, which a host from then still relies on.
3
+ const BACKEND_ROUTES = {
4
+ email: "/v1/start/app/email",
5
+ pdf: "/v1/start/app/pdf",
6
+ uploads: "/v1/start/app/uploads/session",
7
+ steps: "/v1/start/app/runs/steps",
8
+ };
9
+ /** Where a service answers this app on its token: the URL the platform named for it, else the backend's route. */
10
+ export const serviceUrl = (urls, name) => urls[name] ?? `${urls.backend}${BACKEND_ROUTES[name]}`;
11
+ /** A Start page's upload session, which the app's own server asks the platform for on its token. */
12
+ export const UPLOAD_SESSION_PATH = "/__zite/uploads/session";
@@ -183,7 +183,7 @@ export declare function createSqlClient(): (params: {
183
183
  query: string;
184
184
  params?: unknown[];
185
185
  }) => Promise<SqlResult>;
186
- /** Must agree with `User` in `zitejs/auth` and `ZiteAuthUser` in `zitejs/auth-server` — the three used to disagree on whether the name fields were nullable or optional. */
186
+ /** Must agree with `User` in `zitejs/auth`; the two used to disagree on whether the name fields were nullable or optional. */
187
187
  export interface AuthUser {
188
188
  id: string;
189
189
  name: string;
@@ -0,0 +1,100 @@
1
+ export type Runner = "zite" | "local";
2
+ /** What a runner hands the scenarios. Every request goes through `fetch`, as a browser's network stack would send it. */
3
+ export type ConformanceTarget = {
4
+ runner: Runner;
5
+ /** The app's origin, as the browser sees it. */
6
+ appOrigin: string;
7
+ /** `https://<host>/auth`, the issuer identities name. */
8
+ issuer: string;
9
+ /** `<app>:<mode>`, the module's client. */
10
+ clientId: string;
11
+ /** The org settings version identities carry; omit where the module doesn't check it (off Zite). */
12
+ ver?: number | null;
13
+ /** How long the identity server issues identities for, in seconds; set short, so expiry is waited for. */
14
+ identityLifetimeS: number;
15
+ /** A path in the app answering what app code received: `{ user, cookie }`. */
16
+ echoPath: string;
17
+ /** Sends one request to any origin without following redirects. */
18
+ fetch(request: Request): Promise<Response>;
19
+ /** A new user the identity server signs in, with these role ids. Answers the email. */
20
+ createUser(roles?: string[]): Promise<string>;
21
+ /** On the identity server's sign-in page, which `page` answered at `url`: signs `email` in. Answers where it sends the browser next. */
22
+ completeSignIn(browser: Browser, url: string, email: string): Promise<string>;
23
+ /** An identity token signed as the identity server signs one, or with another key or header, for forgeries. */
24
+ mint(input: {
25
+ claims: Record<string, unknown>;
26
+ header?: Record<string, unknown>;
27
+ key?: "identity" | "stranger" | "app-token";
28
+ }): Promise<string>;
29
+ setRoles(email: string, roles: string[]): Promise<void>;
30
+ /** Removes the user, as the workspace does. */
31
+ removeUser(email: string): Promise<void>;
32
+ /** Whether app code answered: nothing under the sign-in prefixes may reach it. */
33
+ appAnswered(response: Response): boolean;
34
+ /** Requests the identity server has received so far. */
35
+ identityServerCalls(): number;
36
+ /** Runs `run` with `ZITE_DEV_USER` set to `user`'s stand-in, off Zite. */
37
+ withDevUser?<T>(user: {
38
+ id: string;
39
+ email: string;
40
+ }, run: () => Promise<T>): Promise<T>;
41
+ };
42
+ type Stored = {
43
+ value: string;
44
+ expiresAt?: number;
45
+ attributes: string;
46
+ };
47
+ type Init = Omit<RequestInit, "headers" | "redirect"> & {
48
+ headers?: Record<string, string>;
49
+ };
50
+ /** A cookie jar per host and manual redirects: enough of a browser for sign-in's cross-origin hops. */
51
+ export declare class Browser {
52
+ private readonly target;
53
+ private readonly jars;
54
+ readonly seenSetCookies: Array<{
55
+ host: string;
56
+ cookie: string;
57
+ }>;
58
+ constructor(target: ConformanceTarget);
59
+ private jar;
60
+ /** The cookies a request to `url` carries, as a Cookie header. */
61
+ cookieHeader(url: string): string | null;
62
+ get(url: string, name: string): Stored | undefined;
63
+ set(url: string, name: string, value: string): void;
64
+ /** Every cookie this browser holds for `url`'s host, to copy into another browser. */
65
+ copyFrom(other: Browser, url: string): void;
66
+ private store;
67
+ /** One request with this browser's cookies; stores what it sets. */
68
+ request(url: string, init?: Init): Promise<Response>;
69
+ /** A top-level navigation, following redirects. */
70
+ navigate(url: string, init?: Init): Promise<{
71
+ url: string;
72
+ response: Response;
73
+ }>;
74
+ }
75
+ export type ScenarioContext = {
76
+ target: ConformanceTarget;
77
+ browser(): Browser;
78
+ /** Throws, with what was seen, unless `ok`. */
79
+ check(ok: boolean, what: string, seen?: unknown): void;
80
+ };
81
+ export type Scenario = {
82
+ id: string;
83
+ title: string;
84
+ runners: readonly Runner[];
85
+ /** Absent for a scenario only the dispatcher's runner implements. */
86
+ run?(context: ScenarioContext): Promise<void>;
87
+ };
88
+ export type ScenarioResult = {
89
+ id: string;
90
+ title: string;
91
+ status: "pass" | "fail" | "skipped";
92
+ detail?: string;
93
+ };
94
+ export declare const scenarios: readonly Scenario[];
95
+ /** Runs every scenario this runner can, in order. Scenarios for the other runner are reported skipped. */
96
+ export declare const runConformance: (target: ConformanceTarget, options?: {
97
+ only?: readonly string[];
98
+ onResult?: (result: ScenarioResult) => void;
99
+ }) => Promise<ScenarioResult[]>;
100
+ export {};