@docsxai/engine 0.2.1-rc.1 → 0.3.0-rc.2
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 +18 -5
- package/dist/address-class.d.ts +14 -0
- package/dist/address-class.js +151 -0
- package/dist/auth/api-login.d.ts +3 -3
- package/dist/auth/email-otp.d.ts +60 -60
- package/dist/auth/jwt-injection.d.ts +45 -45
- package/dist/auth/pat-header.d.ts +2 -2
- package/dist/auth/types.d.ts +2 -2
- package/dist/auth/ui-form.d.ts +54 -54
- package/dist/auth/webauthn.d.ts +22 -22
- package/dist/backend-client-contracts.d.ts +4 -2
- package/dist/backend-client-token.js +2 -1
- package/dist/calibrate.d.ts +2 -2
- package/dist/calibrate.js +5 -0
- package/dist/cli-backend-errors.d.ts +7 -0
- package/dist/cli-backend-errors.js +65 -0
- package/dist/cli-commands-authoring.js +57 -51
- package/dist/cli-commands-backend.js +49 -42
- package/dist/cli-commands-docpack.d.ts +5 -0
- package/dist/cli-commands-docpack.js +106 -66
- package/dist/cli-commands-pack.d.ts +2 -0
- package/dist/cli-commands-pack.js +65 -0
- package/dist/cli-commands-session.js +120 -125
- package/dist/cli-messages.d.ts +17 -0
- package/dist/cli-messages.js +80 -0
- package/dist/cli-retired.d.ts +6 -0
- package/dist/cli-retired.js +12 -0
- package/dist/cli-run-summary.d.ts +15 -0
- package/dist/cli-run-summary.js +33 -0
- package/dist/cli-usage.d.ts +1 -1
- package/dist/cli-usage.js +78 -5
- package/dist/cli-verify.d.ts +14 -0
- package/dist/cli-verify.js +54 -0
- package/dist/cli.js +15 -2
- package/dist/deprecation.d.ts +19 -0
- package/dist/deprecation.js +32 -0
- package/dist/diagnose.d.ts +25 -0
- package/dist/diagnose.js +69 -3
- package/dist/diff-compute.js +1 -0
- package/dist/doc-pack-io.d.ts +14 -0
- package/dist/doc-pack-io.js +121 -14
- package/dist/doc-pack.d.ts +2282 -387
- package/dist/doc-pack.js +135 -43
- package/dist/doctor-checks-plugins.js +4 -3
- package/dist/doctor-checks.d.ts +1 -1
- package/dist/doctor-checks.js +31 -6
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.js +27 -3
- package/dist/driver-budget.d.ts +6 -0
- package/dist/driver-budget.js +15 -0
- package/dist/egress-guard.d.ts +58 -0
- package/dist/egress-guard.js +136 -0
- package/dist/environment-spec.d.ts +67 -0
- package/dist/environment-spec.js +38 -0
- package/dist/export/playwright-test.js +42 -10
- package/dist/flow-file.d.ts +9 -3
- package/dist/flow-file.js +21 -1
- package/dist/flow-halt.d.ts +16 -0
- package/dist/flow-halt.js +76 -0
- package/dist/flow-hidden.d.ts +9 -0
- package/dist/flow-hidden.js +20 -0
- package/dist/flow-lint.js +91 -1
- package/dist/flow-matrix-lint.d.ts +10 -0
- package/dist/flow-matrix-lint.js +40 -0
- package/dist/flow-matrix.d.ts +44 -0
- package/dist/flow-matrix.js +238 -0
- package/dist/flow-name-rules.d.ts +15 -0
- package/dist/flow-name-rules.js +39 -0
- package/dist/flow-runtime.d.ts +52 -22
- package/dist/flow-runtime.js +63 -117
- package/dist/flow-success.d.ts +3 -0
- package/dist/flow-success.js +37 -0
- package/dist/flow-tree.d.ts +2 -0
- package/dist/flow-tree.js +17 -5
- package/dist/flow-wait.d.ts +3 -0
- package/dist/flow-wait.js +22 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/matrix-spec.d.ts +145 -0
- package/dist/matrix-spec.js +120 -0
- package/dist/page-hide.d.ts +10 -0
- package/dist/page-hide.js +45 -0
- package/dist/page-settle.d.ts +39 -0
- package/dist/page-settle.js +142 -0
- package/dist/playwright-driver.d.ts +28 -8
- package/dist/playwright-driver.js +73 -28
- package/dist/plugins/manifest.d.ts +9 -9
- package/dist/run-flows.d.ts +40 -0
- package/dist/run-flows.js +129 -0
- package/dist/style.d.ts +2 -2
- package/dist/upload-path.d.ts +15 -0
- package/dist/upload-path.js +63 -0
- package/dist/verify-compare.d.ts +43 -0
- package/dist/verify-compare.js +237 -0
- package/dist/verify-determinism.d.ts +16 -0
- package/dist/verify-determinism.js +88 -0
- package/dist/verify-report.d.ts +53 -0
- package/dist/verify-report.js +141 -0
- package/dist/verify-tree.d.ts +27 -0
- package/dist/verify-tree.js +95 -0
- package/dist/viewer-bin.d.ts +6 -0
- package/dist/viewer-bin.js +24 -0
- package/dist/zip.d.ts +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -6,11 +6,14 @@ The engine **never** calls a model API. Calibration-time inference is supplied b
|
|
|
6
6
|
|
|
7
7
|
## Surface
|
|
8
8
|
|
|
9
|
-
- **Flow-file** — declarative YAML at `<workspace>/flows/<name>.flow.yaml`: `prerequisites` + `locators` + `steps[]` (`action`, `target`, `wait_for`, `success`, `annotation` / `annotations`, per-step `redactions`). Hand-editable; schema-validated. `extends:` composition for shared preambles (with `environment` merged per-key, child wins; `redactions` concatenated).
|
|
9
|
+
- **Flow-file** — declarative YAML at `<workspace>/flows/<name>.flow.yaml`: `prerequisites` + `locators` + `steps[]` (`action`, `target`, `wait_for`, `success`, `annotation` / `annotations`, per-step `redactions`, `timeout_ms`). Actions: `navigate`, `click`, `fill`, `upload`, `press`, `hover`, `select`, `check`, `uncheck`, `wait`, `hide`, `show`. Hand-editable; schema-validated. `extends:` composition for shared preambles (with `environment` merged per-key, child wins; `redactions` concatenated).
|
|
10
10
|
- **Execution environment** — optional `environment` block (`EnvironmentSpec`): frozen `clock` (Playwright clock API), `locale`, `timezone`, `viewport` (`VIEWPORT_PRESETS`: desktop / tablet / mobile, or explicit size), `color_scheme`, `reduced_motion`. Applied at context creation by `launchPlaywrightSession({ environment })`; on CDP-attached sessions only the clock applies (one stderr warning lists skipped fields). `contextOptions` passes `httpCredentials` / `clientCertificates` / `extraHTTPHeaders` through to `browser.newContext`.
|
|
11
|
+
- **Request guard (opt-in)** — `DOCSX_EGRESS_GUARD=1` (or `launchPlaywrightSession({ egressGuard })`) routes every request of the browser context through `egress-guard.ts`: a host that is, or resolves (`dns.lookup`, all addresses) to, a link-local or cloud-metadata address is aborted, redirect hops and WebSocket connections included, and a failed lookup aborts too (the printed reason is generic: `address not allowed`); `DOCSX_EGRESS_DENY_PRIVATE=1` adds loopback and private ranges. Both take `1`, `true` or `yes`. Off by default for a local `run`; the backend runner turns it on for webhook runs. It does not stop DNS rebinding (`SECURITY.md`). An `upload` step reads only regular files under the workspace (`upload-path.ts`). The address rules in `address-class.ts` are a byte-identical copy of the backend's.
|
|
12
|
+
- **Hiding + step timeouts** — `hide` sets `visibility: hidden !important` on every element its `target` matches until a `show` (no target lifts all, a target lifts the `hide` that used the same selector). `PlaywrightDriver` marks the elements with a data attribute and adopts a fixed stylesheet keyed on it (`page-hide.ts`, in-page and engine-owned; the selector is data, never CSS or script). The rule lives on each element's own root, so it reaches shadow trees, and constructable stylesheets are not blocked by a page's CSP. Visibility keeps the box, so nothing reflows; there is deliberately no `display: none` option and no general CSS-injection step. The driver keeps the selectors and re-marks before every screenshot (halt shots included), so the hiding survives navigations and re-renders. `hide` waits for the element to exist (`attached`) and throws when none does, so `optional: true` covers dev-only UI such as `nextjs-portal`. A step's `timeout_ms` (100–30000) is passed to the driver call (`click(selector, timeoutMs?)`, `hideElements(selector, timeoutMs?)`, …); unset, nothing is passed and Playwright's 30 s default applies, so existing flows and non-optional steps are unchanged. `optional` does not shorten the wait by itself, so a missing optional target costs 30 s unless `timeout_ms` is set; `lint` R011 says so. `BrowserDriver` gains `hideElements` / `showElements` (required). The pure `hiddenAtEachStep` (`flow-hidden.ts`) tells `lint` (R013) and `diagnose` which selectors an earlier `hide` hid.
|
|
11
13
|
- **Redactions** — flow-level + per-step `RedactionSpec[]` (`{ selector }` or `{ region }`, style `box` | `pixelate`) masked deterministically before any screenshot (halt shots included) hits disk. The pure pixel transform is `applyRedactions` in `redact.ts`.
|
|
12
|
-
- **`BrowserDriver`** interface — what the runtime needs from a browser. The `PlaywrightDriver` implementation includes the `actionable()` predicate (see [`docs/actionability-contract.md`](../../docs/actionability-contract.md)) that browser-bridge consumers can mirror, plus a real `element_stable` wait (bounding-box polling, 10 s best-effort budget).
|
|
14
|
+
- **`BrowserDriver`** interface — what the runtime needs from a browser. The `PlaywrightDriver` implementation includes the `actionable()` predicate (see [`docs/actionability-contract.md`](../../docs/actionability-contract.md)) that browser-bridge consumers can mirror, plus a real `element_stable` wait (bounding-box polling, 10 s best-effort budget). `waitForSettled?`, `hideElements?`, `showElements?` and `nearbyBoxes?` are **optional** methods (behind `wait_for: settled`, the `hide` and `show` actions and `annotations.obstacles`), so a driver written before they existed still compiles; the runtime halts a step that needs a missing method with a message naming it (`obstacles` only when the workspace turned it on), and never calls a method the flow does not use. `PlaywrightDriver` runs the fixed in-page poll in `page-settle.ts` (fonts loaded, visible images complete, viewport box geometry unchanged for two consecutive polls, every 50 ms, bounded by the step's `timeout_ms`, default 10 s) and rejects with `settled: page did not settle within N ms ...` naming what kept moving; `inferHaltCause` turns that into the `[page never settled: ...]` prefix.
|
|
13
15
|
- **Annotation obstacles** — opt-in (`.docsxai.json` → `"annotations": { "obstacles": true }`, default off). After a step's screenshot, `runFlow` asks the driver for `nearbyBoxes(selector, 320)`: the visible text (per rendered line) and interactive elements around the target, in screenshot pixels, the target's subtree and elements containing it excluded. The pure `selectObstacles` (`obstacles.ts`) rounds boxes outward to whole pixels, clips them to the screenshot, drops duplicates, boxes inside the target and boxes covered by another kept box, caps at the 40 nearest and sorts by y, x, width, height. The result lands as `obstacles` on the annotation record, where the viewer's `burn` uses it to keep callouts off page content. The scan reads the page's own DOM (no iframe or shadow-root content) and runs only through the driver, so any `BrowserDriver` must implement `nearbyBoxes`. Off or absent, records and screenshots are unchanged.
|
|
16
|
+
- **Per-annotation placement** — a step annotation takes an optional `placement` object (`AnnotationPlacement`: `inside`, `side`, `align`, `pin_arrow`, `max_width`, `obstacle_radius`, `obstacle_limit`), bounded like `obstacles` (finite numbers in range, `max_width` 120 to 560, `obstacle_radius` 0 to 2000 CSS px, `obstacle_limit` 1 to 40) and copied onto the annotation record when set. `runFlow` scans with the annotation's own `obstacle_radius` and keeps its own `obstacle_limit` nearest boxes; the burner reads the rest. Absent, records and scans are exactly as before.
|
|
14
17
|
- **Auth strategies** — `auth/strategy.yaml` descriptor + a catalogue of scripted strategies (`api-login`, `ui-form` with a TOTP hop, `email-otp`, `webauthn`, `jwt-injection`, `http-basic`, `pat-header`, `mtls`, `test-backdoor`) alongside the human-in-the-loop `manual-capture`. See [Auth strategies](#auth-strategies) below.
|
|
15
18
|
- **CLI** — `docsxai <command>`. See `--help` or the [top-level README](../../README.md) for the full surface; this package's `dist/cli.js` is the binary.
|
|
16
19
|
|
|
@@ -21,9 +24,11 @@ init scaffold a workspace
|
|
|
21
24
|
capture-auth cache an authed session
|
|
22
25
|
calibrate extract a flow-file from a structured guide
|
|
23
26
|
inspect discover [data-testid] locators on the live page
|
|
24
|
-
run execute flows headless; emit annotations + screenshots
|
|
27
|
+
run execute flows headless; emit annotations + screenshots (`--verify-determinism` byte-compares N isolated runs)
|
|
25
28
|
render build the static viewer (spawns the @docsxai/viewer bin)
|
|
26
|
-
|
|
29
|
+
burn bake annotations into PNG copies (spawns the same bin's `burn`)
|
|
30
|
+
pack build the screenshot pack: burn, optimise, hash-name, manifest; `--check` compares a rebuild with the committed pack (spawns the viewer bin's `pack`)
|
|
31
|
+
lint static checks across flow-files (R001-R016; `extraRules` injectable via `lintFlow`)
|
|
27
32
|
flow-tree visualise the `extends` graph
|
|
28
33
|
diagnose halt-context + recommendations after a halt
|
|
29
34
|
doctor environment + workspace health-check (✓/✗ + one-line fixes; no plugin code runs)
|
|
@@ -38,6 +43,8 @@ push upload the doc pack to the backend as a new revision
|
|
|
38
43
|
pull fetch a backend revision's artifacts into the workspace
|
|
39
44
|
```
|
|
40
45
|
|
|
46
|
+
A flow with a top-level `matrix:` (`locales`, `color_schemes`, `viewports`; at most 64 variants) expands at parse time (`expandFlow` in `flow-matrix.ts`, schema in `matrix-spec.ts`) into one flow per variant, each under its own `environment`, with `only`/`skip` on steps and annotations and `copy_by_locale` on annotations. `run` starts one session per variant (`run-flows.ts`) and writes `docs/<flow>/<variant>/{screenshots/, annotations.json, halts/}`; `annotations.json` records the variant, and a halt message names it. Without a matrix the layout and every output byte are unchanged. `lint` (R015, R016), `flow-tree` and `diagnose --variant` read the matrix. Design note: `docs/ai-context/architecture/flow-matrix-decision.md`.
|
|
47
|
+
|
|
41
48
|
`run` has a sub-3-second iteration mode for long-async flows: `--start-from <step-id> --cdp <endpoint>` skips every step before the target and attaches to an already-warm Chrome.
|
|
42
49
|
|
|
43
50
|
`zip` packages the doc pack in-process (via fflate) — no system `zip` binary required — and **deterministically**: entries are sorted, every entry's mtime is pinned to the zip epoch (1980-01-01), and the compression level is fixed, so the same doc pack always produces a byte-identical archive. Includes `flows/`, `docs/`, `.docsxai.json`, `auth/strategy.yaml`, `README.md`; excludes `.auth/`, `**/halts/`, and (unless `--include-viewer`) `.viewer/`. Symlinks that point outside the workspace are never followed into the archive.
|
|
@@ -46,9 +53,15 @@ pull fetch a backend revision's artifacts into the workspace
|
|
|
46
53
|
|
|
47
54
|
`baseline` + `diff` are the drift-detection pair. `baseline` snapshots `flows/` + `docs/` (step `.md`s, `annotations.json`, `screenshots/`, `locators.yaml`) into `<workspace>/.baseline/` (or `--out <dir>`); `diff` compares the live workspace against it (`diffDocPacks` on the library surface) and emits a deterministic `docsxai/drift@1` report — per flow: id-keyed step field deltas, annotation moves beyond a pixel tolerance, screenshot pixel diffs via pngjs (changed-pixel count / pct / changed-region bbox; dimension changes flagged distinctly; `ignore_regions` excluded), prose line-change counts, and locator changes. `--format md` (`formatDriftReportMarkdown`) is PR-comment-ready; `--fail-on warn|fail` exits 1 at/above the threshold (defaults: ≥1% changed pixels = warn, ≥5% = fail, structural change = warn). The engine detects and reports; proposing flow-file patches stays with the host agent (`diagnose`).
|
|
48
55
|
|
|
56
|
+
`run --verify-determinism [--runs <2-5>] [--format json|md|text]` runs the selected flows N times (default 2) through the same flow loop as a plain `run` (`runFlowsInSessions`), each into its own output root under `<workspace>/.docsxai-verify/run-<k>/` (`PlaywrightSessionOptions.outputRoot` redirects the screenshots; `upload` sources still resolve against the workspace), then byte-compares every file under the roots (`compareRuns` in `verify-compare.ts`, exported). The first differing artefact is named by path with a cause: JSON key path, PNG changed-pixel count and region (the `diffPngBuffers` of `diff`), first differing text line, or sizes. A halt is recorded as `docs/<flow>/halts/halt-context.json` in the run root, so halt context is compared like any artefact; a halted flow makes the verdict `halted` (exit 1). Run 1's tree is copied into the workspace only when every run agrees and none halted; otherwise the workspace is untouched. The roots are removed by their listing (unlink each file, rmdir each directory deepest first; `verify-tree.ts`), never recursively. The `docsxai/verify-determinism@1` report has no timestamps or paths and is ordered by ordinal path then run: exit 0 identical, 1 differing or halted, 2 usage. Nightly recipes for GitHub Actions, GitLab CI and Woodpecker are in `docs/ci-recipes.md` and `examples/ci/`.
|
|
57
|
+
|
|
49
58
|
`export playwright` renders each flow (with `extends` resolved) as a self-contained Playwright `.spec.ts` (`exportFlowAsPlaywrightTest`) into `<workspace>/.export/tests/`: locator consts, steps as page actions, `wait_for` as waits, `success` as `expect()` assertions, `environment` as `test.use()` + `page.clock.setFixedTime`, `optional` steps in try/catch. Deterministic; generated files carry a "regenerate, don't hand-edit" header.
|
|
50
59
|
|
|
51
|
-
`render`
|
|
60
|
+
`render` and `burn` locate the viewer bin in order: `DOCSX_VIEWER_BIN` (path to the viewer's bin script or an executable), the `@docsxai/viewer` package installed next to the engine (its `bin` run with the current Node), then `docsxai-viewer` on PATH. A launch failure reports all three attempts.
|
|
61
|
+
|
|
62
|
+
`burn <workspace-dir> [--flow <name>] [--out <dir>] [--report <file>] [--no-connector-outline]` bakes the annotations into PNG copies by running the viewer's `burn` through that same resolution (the engine does not depend on `@docsxai/viewer`). It checks the workspace has a `docs/` directory, passes the flags through, and returns the viewer's exit code; an unknown flag or a path-like `--flow` exits 2.
|
|
63
|
+
|
|
64
|
+
`pack <workspace-or-raw-dir> [--from-raw] [--out <dir>] [--public-prefix <path>] [--no-optimise] [--generated-for <text>]` and `pack <workspace-or-raw-dir> --check --against <pack-dir> [--from-raw] [--threshold <pct>]` (`cli-commands-pack.ts`) are the screenshot-pack pair. The old `drift` command is retired: `cli-retired.ts` maps it to `pack --check` with a deprecation warning (`deprecation.ts`). Like `burn`, the engine validates the argv edge (an unknown flag, a flag with no value, a second positional, no `--against`, a `--threshold` that is not a number >= 0 all exit 2), then runs the viewer's `pack` or `drift` through the same bin resolution (`runViewerBin` in `viewer-bin.ts`) and returns its exit code. The viewer owns the logic (burn, `oxipng`, hashing, manifest, drift); the engine does not import it. See the [viewer README](../viewer/README.md#screenshot-pack).
|
|
52
65
|
|
|
53
66
|
## Auth strategies
|
|
54
67
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Why an address is refused: link-local ranges and cloud instance-metadata endpoints. */
|
|
2
|
+
export declare const LINK_LOCAL_OR_METADATA = "link-local or cloud-metadata";
|
|
3
|
+
/** Why an address is refused under `denyPrivate`: loopback, RFC 1918, CGNAT, ULA and the like. */
|
|
4
|
+
export declare const LOOPBACK_OR_PRIVATE = "loopback or private-network";
|
|
5
|
+
export type Ipv4 = [number, number, number, number];
|
|
6
|
+
export declare function parseIpv4(host: string): Ipv4 | null;
|
|
7
|
+
/** The eight 16-bit groups of an IPv6 literal (brackets and a zone id optional), or null. */
|
|
8
|
+
export declare function parseIpv6(host: string): number[] | null;
|
|
9
|
+
/**
|
|
10
|
+
* Why `hostname` (as `URL.hostname` prints it, or an address a resolver returned) is refused, or
|
|
11
|
+
* null: an IPv4 or IPv6 literal in any spelling the URL parser normalises, or one of the names
|
|
12
|
+
* that always mean the local machine or a metadata service. A DNS name is not resolved here.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hostProblem(hostname: string, denyPrivate: boolean): string | null;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Address classification shared by two packages that cannot import each other: the backend's
|
|
2
|
+
// `app_url` filter and the engine's request guard each carry a byte-identical copy of this file
|
|
3
|
+
// (`packages/backend/src/address-class.ts`, `packages/engine/src/address-class.ts`), and a test in
|
|
4
|
+
// `packages/docsxai/test` fails when the two differ. Edit both together.
|
|
5
|
+
//
|
|
6
|
+
// jscpd:ignore-start
|
|
7
|
+
/** Why an address is refused: link-local ranges and cloud instance-metadata endpoints. */
|
|
8
|
+
export const LINK_LOCAL_OR_METADATA = "link-local or cloud-metadata";
|
|
9
|
+
/** Why an address is refused under `denyPrivate`: loopback, RFC 1918, CGNAT, ULA and the like. */
|
|
10
|
+
export const LOOPBACK_OR_PRIVATE = "loopback or private-network";
|
|
11
|
+
const METADATA_HOSTNAMES = new Set(["metadata.google.internal", "instance-data"]);
|
|
12
|
+
const LOCAL_HOSTNAMES = new Set([
|
|
13
|
+
"localhost",
|
|
14
|
+
"localhost.localdomain",
|
|
15
|
+
"ip6-localhost",
|
|
16
|
+
"ip6-loopback",
|
|
17
|
+
]);
|
|
18
|
+
export function parseIpv4(host) {
|
|
19
|
+
const m = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
|
|
20
|
+
if (!m)
|
|
21
|
+
return null;
|
|
22
|
+
const parts = m.slice(1).map(Number);
|
|
23
|
+
return parts.every((n) => n <= 255) ? parts : null;
|
|
24
|
+
}
|
|
25
|
+
/** The eight 16-bit groups of an IPv6 literal (brackets and a zone id optional), or null. */
|
|
26
|
+
export function parseIpv6(host) {
|
|
27
|
+
const bare = host.replace(/^\[|\]$/g, "").replace(/%.*$/, "");
|
|
28
|
+
if (!bare.includes(":"))
|
|
29
|
+
return null;
|
|
30
|
+
const halves = bare.split("::");
|
|
31
|
+
if (halves.length > 2)
|
|
32
|
+
return null;
|
|
33
|
+
const toGroups = (part) => {
|
|
34
|
+
if (part === "")
|
|
35
|
+
return [];
|
|
36
|
+
const groups = [];
|
|
37
|
+
const pieces = part.split(":");
|
|
38
|
+
for (const [i, piece] of pieces.entries()) {
|
|
39
|
+
if (piece.includes(".")) {
|
|
40
|
+
const v4 = i === pieces.length - 1 ? parseIpv4(piece) : null;
|
|
41
|
+
if (!v4)
|
|
42
|
+
return null;
|
|
43
|
+
groups.push(v4[0] * 256 + v4[1], v4[2] * 256 + v4[3]);
|
|
44
|
+
}
|
|
45
|
+
else if (/^[0-9a-f]{1,4}$/i.test(piece)) {
|
|
46
|
+
groups.push(parseInt(piece, 16));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return groups;
|
|
53
|
+
};
|
|
54
|
+
const head = toGroups(halves[0]);
|
|
55
|
+
const tail = halves.length === 2 ? toGroups(halves[1]) : [];
|
|
56
|
+
if (!head || !tail)
|
|
57
|
+
return null;
|
|
58
|
+
if (halves.length === 1)
|
|
59
|
+
return head.length === 8 ? head : null;
|
|
60
|
+
const fill = 8 - head.length - tail.length;
|
|
61
|
+
return fill >= 1 ? [...head, ...new Array(fill).fill(0), ...tail] : null;
|
|
62
|
+
}
|
|
63
|
+
/** Why an IPv4 address is refused, or null. */
|
|
64
|
+
function ipv4Problem(ip, denyPrivate) {
|
|
65
|
+
const [a, b, c, d] = ip;
|
|
66
|
+
const metadata = (a === 169 && b === 254) ||
|
|
67
|
+
(a === 100 && b === 100 && c === 100 && d === 200) ||
|
|
68
|
+
(a === 168 && b === 63 && c === 129 && d === 16);
|
|
69
|
+
if (metadata)
|
|
70
|
+
return LINK_LOCAL_OR_METADATA;
|
|
71
|
+
if (!denyPrivate)
|
|
72
|
+
return null;
|
|
73
|
+
const isPrivate = a === 0 ||
|
|
74
|
+
a === 10 ||
|
|
75
|
+
a === 127 ||
|
|
76
|
+
(a === 100 && b >= 64 && b <= 127) ||
|
|
77
|
+
(a === 172 && b >= 16 && b <= 31) ||
|
|
78
|
+
(a === 192 && b === 168);
|
|
79
|
+
return isPrivate ? LOOPBACK_OR_PRIVATE : null;
|
|
80
|
+
}
|
|
81
|
+
/** The IPv4 address held in groups `i` and `i + 1`, each XORed with `mask`. */
|
|
82
|
+
function v4At(g, i, mask = 0) {
|
|
83
|
+
const hi = (g[i] ?? 0) ^ mask;
|
|
84
|
+
const lo = (g[i + 1] ?? 0) ^ mask;
|
|
85
|
+
return [hi >> 8, hi & 255, lo >> 8, lo & 255];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The IPv4 addresses an IPv6 address stands for: IPv4-mapped, IPv4-compatible, NAT64
|
|
89
|
+
* (`64:ff9b::/96` and the local-use `64:ff9b:1::/48`), 6to4 (`2002::/16`, the address in groups 1
|
|
90
|
+
* and 2) and Teredo (`2001::/32`, the server in groups 2 and 3 and the client, stored inverted, in
|
|
91
|
+
* groups 6 and 7).
|
|
92
|
+
*/
|
|
93
|
+
function embeddedIpv4(g) {
|
|
94
|
+
const at = (i) => g[i] ?? 0;
|
|
95
|
+
const zeros = (from, to) => g.slice(from, to).every((n) => n === 0);
|
|
96
|
+
if (zeros(0, 5) && at(5) === 0xffff)
|
|
97
|
+
return [v4At(g, 6)];
|
|
98
|
+
if (zeros(0, 6) && at(6) !== 0)
|
|
99
|
+
return [v4At(g, 6)];
|
|
100
|
+
if (at(0) === 0x64 && at(1) === 0xff9b && (zeros(2, 6) || at(2) === 1))
|
|
101
|
+
return [v4At(g, 6)];
|
|
102
|
+
if (at(0) === 0x2002)
|
|
103
|
+
return [v4At(g, 1)];
|
|
104
|
+
if (at(0) === 0x2001 && at(1) === 0)
|
|
105
|
+
return [v4At(g, 2), v4At(g, 6, 0xffff)];
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
/** Why an IPv6 address is refused, or null. An embedded IPv4 address is checked as IPv4. */
|
|
109
|
+
function ipv6Problem(g, denyPrivate) {
|
|
110
|
+
const at = (i) => g[i] ?? 0;
|
|
111
|
+
const zeros = (from, to) => g.slice(from, to).every((n) => n === 0);
|
|
112
|
+
for (const v4 of embeddedIpv4(g)) {
|
|
113
|
+
const embedded = ipv4Problem(v4, denyPrivate);
|
|
114
|
+
if (embedded)
|
|
115
|
+
return embedded;
|
|
116
|
+
}
|
|
117
|
+
const metadata = at(0) === 0xfd00 && at(1) === 0x0ec2 && zeros(2, 7) && at(7) === 0x254;
|
|
118
|
+
if ((at(0) & 0xffc0) === 0xfe80 || metadata)
|
|
119
|
+
return LINK_LOCAL_OR_METADATA;
|
|
120
|
+
if (!denyPrivate)
|
|
121
|
+
return null;
|
|
122
|
+
const unspecified = zeros(0, 8);
|
|
123
|
+
const loopback = zeros(0, 7) && at(7) === 1;
|
|
124
|
+
const uniqueLocal = (at(0) & 0xfe00) === 0xfc00;
|
|
125
|
+
const siteLocal = (at(0) & 0xffc0) === 0xfec0;
|
|
126
|
+
const localNat64 = at(0) === 0x64 && at(1) === 0xff9b && at(2) === 1;
|
|
127
|
+
return unspecified || loopback || uniqueLocal || siteLocal || localNat64
|
|
128
|
+
? LOOPBACK_OR_PRIVATE
|
|
129
|
+
: null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Why `hostname` (as `URL.hostname` prints it, or an address a resolver returned) is refused, or
|
|
133
|
+
* null: an IPv4 or IPv6 literal in any spelling the URL parser normalises, or one of the names
|
|
134
|
+
* that always mean the local machine or a metadata service. A DNS name is not resolved here.
|
|
135
|
+
*/
|
|
136
|
+
export function hostProblem(hostname, denyPrivate) {
|
|
137
|
+
const host = hostname.toLowerCase().replace(/\.+$/, "");
|
|
138
|
+
const v4 = parseIpv4(host);
|
|
139
|
+
if (v4)
|
|
140
|
+
return ipv4Problem(v4, denyPrivate);
|
|
141
|
+
const v6 = parseIpv6(host);
|
|
142
|
+
if (v6)
|
|
143
|
+
return ipv6Problem(v6, denyPrivate);
|
|
144
|
+
if (METADATA_HOSTNAMES.has(host))
|
|
145
|
+
return LINK_LOCAL_OR_METADATA;
|
|
146
|
+
if (denyPrivate && (LOCAL_HOSTNAMES.has(host) || host.endsWith(".localhost"))) {
|
|
147
|
+
return LOOPBACK_OR_PRIVATE;
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
// jscpd:ignore-end
|
package/dist/auth/api-login.d.ts
CHANGED
|
@@ -34,9 +34,9 @@ export declare const ApiLoginOptions: z.ZodObject<{
|
|
|
34
34
|
equals?: unknown;
|
|
35
35
|
}>]>>;
|
|
36
36
|
}, "strict", z.ZodTypeAny, {
|
|
37
|
-
login_url: string;
|
|
38
37
|
method: string;
|
|
39
|
-
|
|
38
|
+
login_url: string;
|
|
39
|
+
body_format: "json" | "form";
|
|
40
40
|
success_check?: {
|
|
41
41
|
cookie: string;
|
|
42
42
|
} | {
|
|
@@ -48,7 +48,7 @@ export declare const ApiLoginOptions: z.ZodObject<{
|
|
|
48
48
|
}, {
|
|
49
49
|
login_url: string;
|
|
50
50
|
method?: string | undefined;
|
|
51
|
-
body_format?: "
|
|
51
|
+
body_format?: "json" | "form" | undefined;
|
|
52
52
|
success_check?: {
|
|
53
53
|
cookie: string;
|
|
54
54
|
} | {
|
package/dist/auth/email-otp.d.ts
CHANGED
|
@@ -47,17 +47,17 @@ export declare const EmailOtpInboxOptions: z.ZodObject<{
|
|
|
47
47
|
/** How long to wait for the code mail. Default 30000. */
|
|
48
48
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
49
49
|
}, "strict", z.ZodTypeAny, {
|
|
50
|
-
provider: string;
|
|
51
50
|
options: Record<string, unknown>;
|
|
52
|
-
to_env?: string | undefined;
|
|
53
|
-
code_pattern: string;
|
|
54
51
|
timeout_ms: number;
|
|
52
|
+
provider: string;
|
|
53
|
+
code_pattern: string;
|
|
54
|
+
to_env?: string | undefined;
|
|
55
55
|
}, {
|
|
56
|
-
provider?: string | undefined;
|
|
57
56
|
options?: Record<string, unknown> | undefined;
|
|
57
|
+
timeout_ms?: number | undefined;
|
|
58
|
+
provider?: string | undefined;
|
|
58
59
|
to_env?: string | undefined;
|
|
59
60
|
code_pattern?: string | undefined;
|
|
60
|
-
timeout_ms?: number | undefined;
|
|
61
61
|
}>;
|
|
62
62
|
export type EmailOtpInboxOptions = z.infer<typeof EmailOtpInboxOptions>;
|
|
63
63
|
export declare const EmailOtpOptions: z.ZodEffects<z.ZodObject<{
|
|
@@ -76,12 +76,12 @@ export declare const EmailOtpOptions: z.ZodEffects<z.ZodObject<{
|
|
|
76
76
|
selector: z.ZodString;
|
|
77
77
|
value_env: z.ZodOptional<z.ZodString>;
|
|
78
78
|
}, "strict", z.ZodTypeAny, {
|
|
79
|
-
action: "click" | "fill";
|
|
80
79
|
selector: string;
|
|
80
|
+
action: "fill" | "click";
|
|
81
81
|
value_env?: string | undefined;
|
|
82
82
|
}, {
|
|
83
|
-
action: "click" | "fill";
|
|
84
83
|
selector: string;
|
|
84
|
+
action: "fill" | "click";
|
|
85
85
|
value_env?: string | undefined;
|
|
86
86
|
}>, "many">>;
|
|
87
87
|
inbox: z.ZodObject<{
|
|
@@ -95,110 +95,110 @@ export declare const EmailOtpOptions: z.ZodEffects<z.ZodObject<{
|
|
|
95
95
|
/** How long to wait for the code mail. Default 30000. */
|
|
96
96
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
97
97
|
}, "strict", z.ZodTypeAny, {
|
|
98
|
-
provider: string;
|
|
99
98
|
options: Record<string, unknown>;
|
|
100
|
-
to_env?: string | undefined;
|
|
101
|
-
code_pattern: string;
|
|
102
99
|
timeout_ms: number;
|
|
100
|
+
provider: string;
|
|
101
|
+
code_pattern: string;
|
|
102
|
+
to_env?: string | undefined;
|
|
103
103
|
}, {
|
|
104
|
-
provider?: string | undefined;
|
|
105
104
|
options?: Record<string, unknown> | undefined;
|
|
105
|
+
timeout_ms?: number | undefined;
|
|
106
|
+
provider?: string | undefined;
|
|
106
107
|
to_env?: string | undefined;
|
|
107
108
|
code_pattern?: string | undefined;
|
|
108
|
-
timeout_ms?: number | undefined;
|
|
109
109
|
}>;
|
|
110
110
|
}, "strict", z.ZodTypeAny, {
|
|
111
|
+
timeout_ms: number;
|
|
111
112
|
login_url: string;
|
|
113
|
+
ignore_https_errors: boolean;
|
|
114
|
+
otp_selector: string;
|
|
115
|
+
submit_selector: string;
|
|
112
116
|
username_selector: string;
|
|
113
117
|
password_selector: string;
|
|
114
|
-
submit_selector: string;
|
|
115
|
-
otp_selector: string;
|
|
116
|
-
otp_submit_selector?: string | undefined;
|
|
117
|
-
success_selector?: string | undefined;
|
|
118
|
-
url_matches?: string | undefined;
|
|
119
|
-
timeout_ms: number;
|
|
120
|
-
ignore_https_errors: boolean;
|
|
121
118
|
pre_steps: {
|
|
122
|
-
action: "click" | "fill";
|
|
123
119
|
selector: string;
|
|
120
|
+
action: "fill" | "click";
|
|
124
121
|
value_env?: string | undefined;
|
|
125
122
|
}[];
|
|
126
123
|
inbox: {
|
|
127
|
-
provider: string;
|
|
128
124
|
options: Record<string, unknown>;
|
|
129
|
-
to_env?: string | undefined;
|
|
130
|
-
code_pattern: string;
|
|
131
125
|
timeout_ms: number;
|
|
126
|
+
provider: string;
|
|
127
|
+
code_pattern: string;
|
|
128
|
+
to_env?: string | undefined;
|
|
132
129
|
};
|
|
130
|
+
url_matches?: string | undefined;
|
|
131
|
+
success_selector?: string | undefined;
|
|
132
|
+
otp_submit_selector?: string | undefined;
|
|
133
133
|
}, {
|
|
134
134
|
login_url: string;
|
|
135
|
+
otp_selector: string;
|
|
136
|
+
submit_selector: string;
|
|
135
137
|
username_selector: string;
|
|
136
138
|
password_selector: string;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
inbox: {
|
|
140
|
+
options?: Record<string, unknown> | undefined;
|
|
141
|
+
timeout_ms?: number | undefined;
|
|
142
|
+
provider?: string | undefined;
|
|
143
|
+
to_env?: string | undefined;
|
|
144
|
+
code_pattern?: string | undefined;
|
|
145
|
+
};
|
|
142
146
|
timeout_ms?: number | undefined;
|
|
147
|
+
url_matches?: string | undefined;
|
|
143
148
|
ignore_https_errors?: boolean | undefined;
|
|
149
|
+
success_selector?: string | undefined;
|
|
144
150
|
pre_steps?: {
|
|
145
|
-
action: "click" | "fill";
|
|
146
151
|
selector: string;
|
|
152
|
+
action: "fill" | "click";
|
|
147
153
|
value_env?: string | undefined;
|
|
148
154
|
}[] | undefined;
|
|
149
|
-
|
|
150
|
-
provider?: string | undefined;
|
|
151
|
-
options?: Record<string, unknown> | undefined;
|
|
152
|
-
to_env?: string | undefined;
|
|
153
|
-
code_pattern?: string | undefined;
|
|
154
|
-
timeout_ms?: number | undefined;
|
|
155
|
-
};
|
|
155
|
+
otp_submit_selector?: string | undefined;
|
|
156
156
|
}>, {
|
|
157
|
+
timeout_ms: number;
|
|
157
158
|
login_url: string;
|
|
159
|
+
ignore_https_errors: boolean;
|
|
160
|
+
otp_selector: string;
|
|
161
|
+
submit_selector: string;
|
|
158
162
|
username_selector: string;
|
|
159
163
|
password_selector: string;
|
|
160
|
-
submit_selector: string;
|
|
161
|
-
otp_selector: string;
|
|
162
|
-
otp_submit_selector?: string | undefined;
|
|
163
|
-
success_selector?: string | undefined;
|
|
164
|
-
url_matches?: string | undefined;
|
|
165
|
-
timeout_ms: number;
|
|
166
|
-
ignore_https_errors: boolean;
|
|
167
164
|
pre_steps: {
|
|
168
|
-
action: "click" | "fill";
|
|
169
165
|
selector: string;
|
|
166
|
+
action: "fill" | "click";
|
|
170
167
|
value_env?: string | undefined;
|
|
171
168
|
}[];
|
|
172
169
|
inbox: {
|
|
173
|
-
provider: string;
|
|
174
170
|
options: Record<string, unknown>;
|
|
175
|
-
to_env?: string | undefined;
|
|
176
|
-
code_pattern: string;
|
|
177
171
|
timeout_ms: number;
|
|
172
|
+
provider: string;
|
|
173
|
+
code_pattern: string;
|
|
174
|
+
to_env?: string | undefined;
|
|
178
175
|
};
|
|
176
|
+
url_matches?: string | undefined;
|
|
177
|
+
success_selector?: string | undefined;
|
|
178
|
+
otp_submit_selector?: string | undefined;
|
|
179
179
|
}, {
|
|
180
180
|
login_url: string;
|
|
181
|
+
otp_selector: string;
|
|
182
|
+
submit_selector: string;
|
|
181
183
|
username_selector: string;
|
|
182
184
|
password_selector: string;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
inbox: {
|
|
186
|
+
options?: Record<string, unknown> | undefined;
|
|
187
|
+
timeout_ms?: number | undefined;
|
|
188
|
+
provider?: string | undefined;
|
|
189
|
+
to_env?: string | undefined;
|
|
190
|
+
code_pattern?: string | undefined;
|
|
191
|
+
};
|
|
188
192
|
timeout_ms?: number | undefined;
|
|
193
|
+
url_matches?: string | undefined;
|
|
189
194
|
ignore_https_errors?: boolean | undefined;
|
|
195
|
+
success_selector?: string | undefined;
|
|
190
196
|
pre_steps?: {
|
|
191
|
-
action: "click" | "fill";
|
|
192
197
|
selector: string;
|
|
198
|
+
action: "fill" | "click";
|
|
193
199
|
value_env?: string | undefined;
|
|
194
200
|
}[] | undefined;
|
|
195
|
-
|
|
196
|
-
provider?: string | undefined;
|
|
197
|
-
options?: Record<string, unknown> | undefined;
|
|
198
|
-
to_env?: string | undefined;
|
|
199
|
-
code_pattern?: string | undefined;
|
|
200
|
-
timeout_ms?: number | undefined;
|
|
201
|
-
};
|
|
201
|
+
otp_submit_selector?: string | undefined;
|
|
202
202
|
}>;
|
|
203
203
|
export type EmailOtpOptions = z.infer<typeof EmailOtpOptions>;
|
|
204
204
|
export declare class EmailOtpStrategy implements AuthStrategy {
|
|
@@ -26,119 +26,119 @@ export declare const JwtInjectionOptions: z.ZodEffects<z.ZodObject<{
|
|
|
26
26
|
}, "strict", z.ZodTypeAny, {
|
|
27
27
|
name: string;
|
|
28
28
|
value_template: string;
|
|
29
|
-
domain?: string | undefined;
|
|
30
29
|
path?: string | undefined;
|
|
30
|
+
domain?: string | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
name: string;
|
|
33
|
-
value_template?: string | undefined;
|
|
34
|
-
domain?: string | undefined;
|
|
35
33
|
path?: string | undefined;
|
|
34
|
+
domain?: string | undefined;
|
|
35
|
+
value_template?: string | undefined;
|
|
36
36
|
}>, "many">>;
|
|
37
37
|
}, "strict", z.ZodTypeAny, {
|
|
38
|
+
cookies?: {
|
|
39
|
+
name: string;
|
|
40
|
+
value_template: string;
|
|
41
|
+
path?: string | undefined;
|
|
42
|
+
domain?: string | undefined;
|
|
43
|
+
}[] | undefined;
|
|
38
44
|
localStorage?: {
|
|
39
45
|
key: string;
|
|
40
46
|
value_template: string;
|
|
41
47
|
}[] | undefined;
|
|
48
|
+
}, {
|
|
42
49
|
cookies?: {
|
|
43
50
|
name: string;
|
|
44
|
-
value_template: string;
|
|
45
|
-
domain?: string | undefined;
|
|
46
51
|
path?: string | undefined;
|
|
52
|
+
domain?: string | undefined;
|
|
53
|
+
value_template?: string | undefined;
|
|
47
54
|
}[] | undefined;
|
|
48
|
-
}, {
|
|
49
55
|
localStorage?: {
|
|
50
56
|
key: string;
|
|
51
57
|
value_template?: string | undefined;
|
|
52
58
|
}[] | undefined;
|
|
59
|
+
}>, {
|
|
53
60
|
cookies?: {
|
|
54
61
|
name: string;
|
|
55
|
-
value_template
|
|
56
|
-
domain?: string | undefined;
|
|
62
|
+
value_template: string;
|
|
57
63
|
path?: string | undefined;
|
|
64
|
+
domain?: string | undefined;
|
|
58
65
|
}[] | undefined;
|
|
59
|
-
}>, {
|
|
60
66
|
localStorage?: {
|
|
61
67
|
key: string;
|
|
62
68
|
value_template: string;
|
|
63
69
|
}[] | undefined;
|
|
70
|
+
}, {
|
|
64
71
|
cookies?: {
|
|
65
72
|
name: string;
|
|
66
|
-
value_template: string;
|
|
67
|
-
domain?: string | undefined;
|
|
68
73
|
path?: string | undefined;
|
|
74
|
+
domain?: string | undefined;
|
|
75
|
+
value_template?: string | undefined;
|
|
69
76
|
}[] | undefined;
|
|
70
|
-
}, {
|
|
71
77
|
localStorage?: {
|
|
72
78
|
key: string;
|
|
73
79
|
value_template?: string | undefined;
|
|
74
80
|
}[] | undefined;
|
|
75
|
-
cookies?: {
|
|
76
|
-
name: string;
|
|
77
|
-
value_template?: string | undefined;
|
|
78
|
-
domain?: string | undefined;
|
|
79
|
-
path?: string | undefined;
|
|
80
|
-
}[] | undefined;
|
|
81
81
|
}>;
|
|
82
82
|
}, "strict", z.ZodTypeAny, {
|
|
83
|
-
token_env?: string | undefined;
|
|
84
|
-
token_url?: string | undefined;
|
|
85
83
|
inject: {
|
|
86
|
-
localStorage?: {
|
|
87
|
-
key: string;
|
|
88
|
-
value_template: string;
|
|
89
|
-
}[] | undefined;
|
|
90
84
|
cookies?: {
|
|
91
85
|
name: string;
|
|
92
86
|
value_template: string;
|
|
93
|
-
domain?: string | undefined;
|
|
94
87
|
path?: string | undefined;
|
|
88
|
+
domain?: string | undefined;
|
|
89
|
+
}[] | undefined;
|
|
90
|
+
localStorage?: {
|
|
91
|
+
key: string;
|
|
92
|
+
value_template: string;
|
|
95
93
|
}[] | undefined;
|
|
96
94
|
};
|
|
97
|
-
}, {
|
|
98
95
|
token_env?: string | undefined;
|
|
99
96
|
token_url?: string | undefined;
|
|
97
|
+
}, {
|
|
100
98
|
inject: {
|
|
101
|
-
localStorage?: {
|
|
102
|
-
key: string;
|
|
103
|
-
value_template?: string | undefined;
|
|
104
|
-
}[] | undefined;
|
|
105
99
|
cookies?: {
|
|
106
100
|
name: string;
|
|
107
|
-
value_template?: string | undefined;
|
|
108
|
-
domain?: string | undefined;
|
|
109
101
|
path?: string | undefined;
|
|
102
|
+
domain?: string | undefined;
|
|
103
|
+
value_template?: string | undefined;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
localStorage?: {
|
|
106
|
+
key: string;
|
|
107
|
+
value_template?: string | undefined;
|
|
110
108
|
}[] | undefined;
|
|
111
109
|
};
|
|
112
|
-
}>, {
|
|
113
110
|
token_env?: string | undefined;
|
|
114
111
|
token_url?: string | undefined;
|
|
112
|
+
}>, {
|
|
115
113
|
inject: {
|
|
116
|
-
localStorage?: {
|
|
117
|
-
key: string;
|
|
118
|
-
value_template: string;
|
|
119
|
-
}[] | undefined;
|
|
120
114
|
cookies?: {
|
|
121
115
|
name: string;
|
|
122
116
|
value_template: string;
|
|
123
|
-
domain?: string | undefined;
|
|
124
117
|
path?: string | undefined;
|
|
118
|
+
domain?: string | undefined;
|
|
119
|
+
}[] | undefined;
|
|
120
|
+
localStorage?: {
|
|
121
|
+
key: string;
|
|
122
|
+
value_template: string;
|
|
125
123
|
}[] | undefined;
|
|
126
124
|
};
|
|
127
|
-
}, {
|
|
128
125
|
token_env?: string | undefined;
|
|
129
126
|
token_url?: string | undefined;
|
|
127
|
+
}, {
|
|
130
128
|
inject: {
|
|
131
|
-
localStorage?: {
|
|
132
|
-
key: string;
|
|
133
|
-
value_template?: string | undefined;
|
|
134
|
-
}[] | undefined;
|
|
135
129
|
cookies?: {
|
|
136
130
|
name: string;
|
|
137
|
-
value_template?: string | undefined;
|
|
138
|
-
domain?: string | undefined;
|
|
139
131
|
path?: string | undefined;
|
|
132
|
+
domain?: string | undefined;
|
|
133
|
+
value_template?: string | undefined;
|
|
134
|
+
}[] | undefined;
|
|
135
|
+
localStorage?: {
|
|
136
|
+
key: string;
|
|
137
|
+
value_template?: string | undefined;
|
|
140
138
|
}[] | undefined;
|
|
141
139
|
};
|
|
140
|
+
token_env?: string | undefined;
|
|
141
|
+
token_url?: string | undefined;
|
|
142
142
|
}>;
|
|
143
143
|
export type JwtInjectionOptions = z.infer<typeof JwtInjectionOptions>;
|
|
144
144
|
/** Decode a JWT's payload (base64url, **no signature verification**) — claims-reading only. */
|
|
@@ -6,11 +6,11 @@ export declare const PatHeaderOptions: z.ZodObject<{
|
|
|
6
6
|
/** `{{token}}` template for the header value. Default `Bearer {{token}}`. */
|
|
7
7
|
value_template: z.ZodDefault<z.ZodString>;
|
|
8
8
|
}, "strict", z.ZodTypeAny, {
|
|
9
|
-
header: string;
|
|
10
9
|
value_template: string;
|
|
10
|
+
header: string;
|
|
11
11
|
}, {
|
|
12
|
-
header?: string | undefined;
|
|
13
12
|
value_template?: string | undefined;
|
|
13
|
+
header?: string | undefined;
|
|
14
14
|
}>;
|
|
15
15
|
export type PatHeaderOptions = z.infer<typeof PatHeaderOptions>;
|
|
16
16
|
export declare class PatHeaderStrategy implements AuthStrategy {
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -71,8 +71,8 @@ export declare class NotImplementedStrategyError extends Error {
|
|
|
71
71
|
constructor(name: string);
|
|
72
72
|
}
|
|
73
73
|
export declare class AuthStrategyConfigError extends Error {
|
|
74
|
-
readonly cause?: unknown;
|
|
75
|
-
constructor(message: string, cause?: unknown);
|
|
74
|
+
readonly cause?: unknown | undefined;
|
|
75
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
76
76
|
}
|
|
77
77
|
/** Validate a strategy's `options` record against its schema; config errors name the offending key, never values. */
|
|
78
78
|
export declare function parseStrategyOptions<S extends z.ZodTypeAny>(strategy: string, schema: S, options: Record<string, unknown>): z.infer<S>;
|