@warlock.js/core 5.34.1 → 5.34.3
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/CHANGELOG.md +24 -0
- package/esm/e2e/browser.d.mts.map +1 -1
- package/esm/e2e/browser.mjs +3 -1
- package/esm/e2e/browser.mjs.map +1 -1
- package/esm/e2e/types.d.mts +6 -0
- package/esm/e2e/types.d.mts.map +1 -1
- package/esm/e2e/types.mjs.map +1 -1
- package/esm/http/error-response.d.mts +12 -0
- package/esm/http/error-response.d.mts.map +1 -0
- package/esm/http/error-response.mjs +41 -0
- package/esm/http/error-response.mjs.map +1 -0
- package/esm/http/index.d.mts +3 -2
- package/esm/http/response.d.mts +2 -0
- package/esm/http/response.d.mts.map +1 -1
- package/esm/http/response.mjs +2 -0
- package/esm/http/response.mjs.map +1 -1
- package/esm/http/server.d.mts.map +1 -1
- package/esm/http/server.mjs +2 -0
- package/esm/http/server.mjs.map +1 -1
- package/esm/http/types.d.mts +7 -0
- package/esm/http/types.d.mts.map +1 -1
- package/esm/index.d.mts +3 -2
- package/esm/upgrade/codemods/toolchain-templates.mjs +3 -1
- package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -1
- package/llms-full.txt +323 -60
- package/llms.txt +56 -54
- package/package.json +13 -13
- package/skills/configure-app/SKILL.md +27 -0
- package/skills/generate-openapi/SKILL.md +1 -1
- package/skills/index.md +4 -4
- package/skills/{report-framework-issue.md → report-framework-issue/SKILL.md} +5 -0
- package/skills/send-response/SKILL.md +27 -0
- package/skills/test-browser/SKILL.md +1 -0
- package/skills/upgrade-from-5-29/SKILL.md +4 -0
- package/skills/warlock-check/SKILL.md +1 -1
- package/skills/warlock-trace/SKILL.md +2 -2
- package/skills/write-cli-command/SKILL.md +2 -2
- package/skills/README.md +0 -76
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
|
|
7
7
|
> ⚠ **Versioning: `@warlock.js/*` does not follow SemVer strictly — breaking changes may ship in a minor.** This is a deliberate decision, not an oversight: the framework is pre-adoption and the cost of a major per behaviour fix currently outweighs the benefit. **Pin an exact version or a tilde range (`~4.13.0`) if you need to opt into changes rather than receive them.** Every breaking change is marked **BREAKING** in its entry and summarised in an _Upgrading_ section at the top of the release. **This policy will change once the framework has consumers beyond its author.**
|
|
8
8
|
|
|
9
|
+
## 5.34.3 - 2026-10-20
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `warlock e2e` waits up to `browser.startupTimeoutMs` (new option, default 30 seconds instead of a fixed 15) for the browser's DevTools endpoint, so a slow first launch on a busy machine no longer fails the run.
|
|
14
|
+
- `ResponseStatus` includes 413 (`CONTENT_TOO_LARGE`) and 422 (`UNPROCESSABLE_ENTITY`), the statuses `response.contentTooLarge()` and `response.unprocessableEntity()` send, so `responseSchema` can declare them.
|
|
15
|
+
- Type Fastify error-response hook and test handler parameters explicitly, and align upgrade fixture expectations with the enabled explicit-any, brace and console rules.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Opt-in `http.errorResponse` formats JSON error bodies at the transport boundary, including framework validation, unmatched routes, early parsing errors, rate limits and server errors, with a correlated request ID. Existing bodies remain unchanged unless configured.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Keep the upgrade toolchain's enabled explicit-any, brace and console rules in sync with the new-app scaffold.
|
|
24
|
+
|
|
25
|
+
- Condensed the package agent skill description to at most 450 characters, with API names and package routing guidance.
|
|
26
|
+
|
|
27
|
+
## 5.34.2 - 2026-10-19
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Export framework issue-reporting guidance as a proper skill topic; complete index coverage for browser testing and upgrade guidance, and include package orientation in LLM projections.
|
|
32
|
+
|
|
9
33
|
## 5.34.1 - 2026-10-19
|
|
10
34
|
|
|
11
35
|
### Added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/e2e/browser.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"browser.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/e2e/browser.ts"],"mappings":";wBA8CsB,kBACpB,gCACC"}
|
package/esm/e2e/browser.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { access, mkdir, readFile } from "node:fs/promises";
|
|
|
7
7
|
import { setTimeout } from "node:timers/promises";
|
|
8
8
|
|
|
9
9
|
//#region ../../packages/core/src/e2e/browser.ts
|
|
10
|
+
/** Default wait for the browser's DevTools endpoint; first launches can be slow. */
|
|
11
|
+
const DEFAULT_STARTUP_TIMEOUT_MS = 3e4;
|
|
10
12
|
function browserCandidates(platform, env) {
|
|
11
13
|
const names = platform === "win32" ? ["chrome.exe", "msedge.exe"] : [
|
|
12
14
|
"google-chrome",
|
|
@@ -54,7 +56,7 @@ var OwnedBrowser = class {
|
|
|
54
56
|
], this.root, isolatedEnvironment(this.root, {}), this.root, this.evidence.processes, (owned) => {
|
|
55
57
|
this.process = owned;
|
|
56
58
|
});
|
|
57
|
-
const deadline = Date.now() +
|
|
59
|
+
const deadline = Date.now() + (options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS);
|
|
58
60
|
let reason = "DevToolsActivePort is not ready";
|
|
59
61
|
while (Date.now() < deadline) {
|
|
60
62
|
signal?.throwIfAborted();
|
package/esm/e2e/browser.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.mjs","names":["delay"],"sources":["../../../../../../../../packages/core/src/e2e/browser.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { access, mkdir, readFile } from \"node:fs/promises\";\nimport { delimiter, join, resolve } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { CdpConnection } from \"./cdp\";\nimport { isolatedEnvironment } from \"./fixture\";\nimport { OwnedProcess } from \"./owned-process\";\nimport type { BrowserOptions, E2EEvidence } from \"./types\";\n\nexport function browserCandidates(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): string[] {\n const names =\n platform === \"win32\"\n ? [\"chrome.exe\", \"msedge.exe\"]\n : [\n \"google-chrome\",\n \"google-chrome-stable\",\n \"chromium\",\n \"chromium-browser\",\n \"microsoft-edge\",\n \"microsoft-edge-stable\",\n ];\n const paths = (env.PATH ?? \"\")\n .split(platform === \"win32\" ? \";\" : delimiter)\n .filter(Boolean)\n .flatMap((path) => names.map((name) => join(path, name)));\n if (platform === \"darwin\")\n paths.push(\n \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\",\n \"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge\",\n join(env.HOME ?? \"\", \"Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"),\n join(env.HOME ?? \"\", \"Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge\"),\n );\n if (platform === \"win32\")\n for (const root of [env.PROGRAMFILES, env[\"PROGRAMFILES(X86)\"], env.LOCALAPPDATA].filter(\n (path): path is string => Boolean(path),\n ))\n paths.push(\n join(root, \"Google\", \"Chrome\", \"Application\", \"chrome.exe\"),\n join(root, \"Microsoft\", \"Edge\", \"Application\", \"msedge.exe\"),\n );\n return paths;\n}\n\nexport async function findBrowserBinary(\n override = process.env.WARLOCK_E2E_BROWSER,\n): Promise<string | undefined> {\n const candidates = override\n ? [resolve(override)]\n : browserCandidates(process.platform, process.env);\n for (const candidate of candidates) {\n try {\n await access(candidate, process.platform === \"win32\" ? constants.F_OK : constants.X_OK);\n return candidate;\n } catch {\n /* Try the next known installation. */\n }\n }\n if (override) throw new Error(`Browser override is not executable: ${override}`);\n return undefined;\n}\n\nexport class OwnedBrowser {\n connection?: CdpConnection;\n process?: OwnedProcess;\n constructor(\n private root: string,\n private evidence: E2EEvidence,\n ) {}\n\n async start(options: BrowserOptions = {}, signal?: AbortSignal): Promise<CdpConnection> {\n const binary = await findBrowserBinary(options.binary);\n if (!binary)\n throw new Error(\n \"No Chrome or Edge binary found. Install one or set --browser / WARLOCK_E2E_BROWSER to its executable path.\",\n );\n if (\n options.args?.some(\n (arg) =>\n !arg.startsWith(\"--\") || /^--(?:user-data-dir|remote-debugging|headless)/.test(arg),\n )\n )\n throw new Error(\n \"Browser args must be flags and cannot replace the owned profile, debugging endpoint, or headless mode\",\n );\n const profile = join(this.root, \"browser-profile\");\n await mkdir(profile, { recursive: true });\n // Headless flag: https://developer.chrome.com/docs/chromium/headless\n // Port 0 and discovery: https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target\n // Profile required by Chrome 136+: https://developer.chrome.com/blog/remote-debugging-port\n this.process = await OwnedProcess.start(\n \"browser\",\n [\n binary,\n \"--headless\",\n \"--remote-debugging-port=0\",\n `--user-data-dir=${profile}`,\n ...(options.args ?? []),\n \"about:blank\",\n ],\n this.root,\n isolatedEnvironment(this.root, {}),\n this.root,\n this.evidence.processes,\n (owned) => {\n this.process = owned;\n },\n );\n const deadline = Date.now() +
|
|
1
|
+
{"version":3,"file":"browser.mjs","names":["delay"],"sources":["../../../../../../../../packages/core/src/e2e/browser.ts"],"sourcesContent":["import { constants } from \"node:fs\";\nimport { access, mkdir, readFile } from \"node:fs/promises\";\nimport { delimiter, join, resolve } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { CdpConnection } from \"./cdp\";\nimport { isolatedEnvironment } from \"./fixture\";\nimport { OwnedProcess } from \"./owned-process\";\nimport type { BrowserOptions, E2EEvidence } from \"./types\";\n\n/** Default wait for the browser's DevTools endpoint; first launches can be slow. */\nconst DEFAULT_STARTUP_TIMEOUT_MS = 30_000;\n\nexport function browserCandidates(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): string[] {\n const names =\n platform === \"win32\"\n ? [\"chrome.exe\", \"msedge.exe\"]\n : [\n \"google-chrome\",\n \"google-chrome-stable\",\n \"chromium\",\n \"chromium-browser\",\n \"microsoft-edge\",\n \"microsoft-edge-stable\",\n ];\n const paths = (env.PATH ?? \"\")\n .split(platform === \"win32\" ? \";\" : delimiter)\n .filter(Boolean)\n .flatMap((path) => names.map((name) => join(path, name)));\n if (platform === \"darwin\")\n paths.push(\n \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\",\n \"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge\",\n join(env.HOME ?? \"\", \"Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"),\n join(env.HOME ?? \"\", \"Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge\"),\n );\n if (platform === \"win32\")\n for (const root of [env.PROGRAMFILES, env[\"PROGRAMFILES(X86)\"], env.LOCALAPPDATA].filter(\n (path): path is string => Boolean(path),\n ))\n paths.push(\n join(root, \"Google\", \"Chrome\", \"Application\", \"chrome.exe\"),\n join(root, \"Microsoft\", \"Edge\", \"Application\", \"msedge.exe\"),\n );\n return paths;\n}\n\nexport async function findBrowserBinary(\n override = process.env.WARLOCK_E2E_BROWSER,\n): Promise<string | undefined> {\n const candidates = override\n ? [resolve(override)]\n : browserCandidates(process.platform, process.env);\n for (const candidate of candidates) {\n try {\n await access(candidate, process.platform === \"win32\" ? constants.F_OK : constants.X_OK);\n return candidate;\n } catch {\n /* Try the next known installation. */\n }\n }\n if (override) throw new Error(`Browser override is not executable: ${override}`);\n return undefined;\n}\n\nexport class OwnedBrowser {\n connection?: CdpConnection;\n process?: OwnedProcess;\n constructor(\n private root: string,\n private evidence: E2EEvidence,\n ) {}\n\n async start(options: BrowserOptions = {}, signal?: AbortSignal): Promise<CdpConnection> {\n const binary = await findBrowserBinary(options.binary);\n if (!binary)\n throw new Error(\n \"No Chrome or Edge binary found. Install one or set --browser / WARLOCK_E2E_BROWSER to its executable path.\",\n );\n if (\n options.args?.some(\n (arg) =>\n !arg.startsWith(\"--\") || /^--(?:user-data-dir|remote-debugging|headless)/.test(arg),\n )\n )\n throw new Error(\n \"Browser args must be flags and cannot replace the owned profile, debugging endpoint, or headless mode\",\n );\n const profile = join(this.root, \"browser-profile\");\n await mkdir(profile, { recursive: true });\n // Headless flag: https://developer.chrome.com/docs/chromium/headless\n // Port 0 and discovery: https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target\n // Profile required by Chrome 136+: https://developer.chrome.com/blog/remote-debugging-port\n this.process = await OwnedProcess.start(\n \"browser\",\n [\n binary,\n \"--headless\",\n \"--remote-debugging-port=0\",\n `--user-data-dir=${profile}`,\n ...(options.args ?? []),\n \"about:blank\",\n ],\n this.root,\n isolatedEnvironment(this.root, {}),\n this.root,\n this.evidence.processes,\n (owned) => {\n this.process = owned;\n },\n );\n const deadline = Date.now() + (options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS);\n let reason = \"DevToolsActivePort is not ready\";\n while (Date.now() < deadline) {\n signal?.throwIfAborted();\n this.process.assertRunning();\n try {\n const port = Number(\n (await readFile(join(profile, \"DevToolsActivePort\"), \"utf8\")).split(\"\\n\")[0],\n );\n if (!Number.isInteger(port) || port <= 0 || port > 65535)\n throw new Error(\"Invalid owned browser debugging port\");\n // HTTP discovery endpoints: https://chromedevtools.github.io/devtools-protocol/#http-endpoints\n const response = await fetch(`http://127.0.0.1:${port}/json/list`, {\n signal: AbortSignal.timeout(1000),\n });\n if (!response.ok) throw new Error(`CDP discovery returned HTTP ${response.status}`);\n const targets = (await response.json()) as {\n type: string;\n url: string;\n webSocketDebuggerUrl?: string;\n }[];\n const target = targets.find(\n (candidate) => candidate.type === \"page\" && candidate.url === \"about:blank\",\n );\n if (!target?.webSocketDebuggerUrl)\n throw new Error(\"Owned browser has no about:blank page target\");\n const endpoint = new URL(target.webSocketDebuggerUrl);\n if (\n endpoint.protocol !== \"ws:\" ||\n endpoint.hostname !== \"127.0.0.1\" ||\n Number(endpoint.port) !== port\n )\n throw new Error(\"CDP discovery returned a non-owned endpoint\");\n this.connection = await CdpConnection.connect(endpoint.href);\n return this.connection;\n } catch (error) {\n reason = String(error);\n await delay(50);\n }\n }\n throw new Error(`Browser startup timed out: ${reason}\\n${this.process.logs().slice(-8000)}`);\n }\n\n async stop(): Promise<void> {\n this.connection?.close();\n await this.process?.stop();\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,6BAA6B;AAEnC,SAAgB,kBAAkB,UAA2B,KAAkC;CAC7F,MAAM,QACJ,aAAa,UACT,CAAC,cAAc,YAAY,IAC3B;EACE;EACA;EACA;EACA;EACA;EACA;CACF;CACN,MAAM,SAAS,IAAI,QAAQ,GAAE,CAC1B,MAAM,aAAa,UAAU,MAAM,SAAS,CAAC,CAC7C,OAAO,OAAO,CAAC,CACf,SAAS,SAAS,MAAM,KAAK,SAAS,KAAK,MAAM,IAAI,CAAC,CAAC;CAC1D,IAAI,aAAa,UACf,MAAM,KACJ,gEACA,kEACA,KAAK,IAAI,QAAQ,IAAI,6DAA6D,GAClF,KAAK,IAAI,QAAQ,IAAI,+DAA+D,CACtF;CACF,IAAI,aAAa,SACf,KAAK,MAAM,QAAQ;EAAC,IAAI;EAAc,IAAI;EAAsB,IAAI;CAAY,CAAC,CAAC,QAC/E,SAAyB,QAAQ,IAAI,CACxC,GACE,MAAM,KACJ,KAAK,MAAM,UAAU,UAAU,eAAe,YAAY,GAC1D,KAAK,MAAM,aAAa,QAAQ,eAAe,YAAY,CAC7D;CACJ,OAAO;AACT;AAEA,eAAsB,kBACpB,WAAW,QAAQ,IAAI,qBACM;CAC7B,MAAM,aAAa,WACf,CAAC,QAAQ,QAAQ,CAAC,IAClB,kBAAkB,QAAQ,UAAU,QAAQ,GAAG;CACnD,KAAK,MAAM,aAAa,YACtB,IAAI;EACF,MAAM,OAAO,WAAW,QAAQ,aAAa,UAAU,UAAU,OAAO,UAAU,IAAI;EACtF,OAAO;CACT,QAAQ,CAER;CAEF,IAAI,UAAU,MAAM,IAAI,MAAM,uCAAuC,UAAU;AAEjF;AAEA,IAAa,eAAb,MAA0B;CAGxB,YACE,AAAQ,MACR,AAAQ,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I,CAAC,QAAQ,sBACX,MAAM,IAAI,MAAM,8CAA8C;IAChE,MAAM,WAAW,IAAI,IAAI,OAAO,oBAAoB;IACpD,IACE,SAAS,aAAa,SACtB,SAAS,aAAa,eACtB,OAAO,SAAS,IAAI,MAAM,MAE1B,MAAM,IAAI,MAAM,6CAA6C;IAC/D,KAAK,aAAa,MAAM,cAAc,QAAQ,SAAS,IAAI;IAC3D,OAAO,KAAK;GACd,SAAS,OAAO;IACd,SAAS,OAAO,KAAK;IACrB,MAAMA,WAAM,EAAE;GAChB;EACF;EACA,MAAM,IAAI,MAAM,8BAA8B,OAAO,IAAI,KAAK,QAAQ,KAAK,CAAC,CAAC,MAAM,IAAK,GAAG;CAC7F;CAEA,MAAM,OAAsB;EAC1B,KAAK,YAAY,MAAM;EACvB,MAAM,KAAK,SAAS,KAAK;CAC3B;AACF"}
|
package/esm/e2e/types.d.mts
CHANGED
|
@@ -42,6 +42,12 @@ export type BrowserOptions = {
|
|
|
42
42
|
binary?: string;
|
|
43
43
|
/** Additional Chrome flags, e.g. --no-sandbox in a controlled root container. */
|
|
44
44
|
args?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* How long to wait for the browser to report its DevTools endpoint.
|
|
47
|
+
* A first launch with a fresh profile on a busy machine can be slow.
|
|
48
|
+
* @default 30_000
|
|
49
|
+
*/
|
|
50
|
+
startupTimeoutMs?: number;
|
|
45
51
|
};
|
|
46
52
|
export type NetworkFailure = {
|
|
47
53
|
at: string;
|
package/esm/e2e/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/e2e/types.ts"],"mappings":";;YAEY,oBAAoB,uBAAuB;YAC3C,mBAAmB;YACnB;EAAa;EAAc;EAAe;EAAgB;;qBACzD,2BAA2B;YAK5B;;EAEV;EACA;;EAEA;EACA;;EAEA;;YAEU;EACV;;EAEA,QAAQ,YAAY,SAAS,mBAAmB;;EAEhD,QAAQ,YAAY,SAAS,mBAAmB;;EAEhD,MAAM,2BAA2B,SAAS,mBAAmB;;EAE7D;;EAEA,WAAW,SAAS,0BAA0B;;EAE9C;EACA;;EAEA;EACA;;YAEU;EACV;;EAEA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA;;YAEU;EAAiB;EAAY;EAAe;EAAc;;YAC1D;EACV;EACA;EACA;EACA;EACA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,SAAS;EACT,iBAAiB;EACjB;IAAe;IAAc;IAAc,UAAU;;EACrD,WAAW;EACX;;YAEU;EAAqB,KAAK;EAAS;EAAiB,YAAY;;YAChE,aAAa;EACvB,MAAM;EACN,UAAU;EACV;EACA,QAAQ;EACR,OAAO,GAAG,cAAc,cAAc,QAAQ,OAAO,QAAQ;;YAEnD;EACV,KAAK;EACL,UAAU;EACV,qBAAqB;EACrB,qBAAqB;EACrB,uBAAuB;;EAEvB,uBAAuB;EACvB;EACA,MAAM,SAAS,eAAe;;YAEpB;EACV;EACA;EACA;EACA,SAAS;;wBAGK,UAAU,MAAM,UAAU"}
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/e2e/types.ts"],"mappings":";;YAEY,oBAAoB,uBAAuB;YAC3C,mBAAmB;YACnB;EAAa;EAAc;EAAe;EAAgB;;qBACzD,2BAA2B;YAK5B;;EAEV;EACA;;EAEA;EACA;;EAEA;;YAEU;EACV;;EAEA,QAAQ,YAAY,SAAS,mBAAmB;;EAEhD,QAAQ,YAAY,SAAS,mBAAmB;;EAEhD,MAAM,2BAA2B,SAAS,mBAAmB;;EAE7D;;EAEA,WAAW,SAAS,0BAA0B;;EAE9C;EACA;;EAEA;EACA;;YAEU;EACV;;EAEA;;;;;;EAMA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA;;YAEU;EAAiB;EAAY;EAAe;EAAc;;YAC1D;EACV;EACA;EACA;EACA;EACA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA;;YAEU;EACV;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,SAAS;EACT,iBAAiB;EACjB;IAAe;IAAc;IAAc,UAAU;;EACrD,WAAW;EACX;;YAEU;EAAqB,KAAK;EAAS;EAAiB,YAAY;;YAChE,aAAa;EACvB,MAAM;EACN,UAAU;EACV;EACA,QAAQ;EACR,OAAO,GAAG,cAAc,cAAc,QAAQ,OAAO,QAAQ;;YAEnD;EACV,KAAK;EACL,UAAU;EACV,qBAAqB;EACrB,qBAAqB;EACrB,uBAAuB;;EAEvB,uBAAuB;EACvB;EACA,MAAM,SAAS,eAAe;;YAEpB;EACV;EACA;EACA;EACA,SAAS;;wBAGK,UAAU,MAAM,UAAU"}
|
package/esm/e2e/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../../../../../../../packages/core/src/e2e/types.ts"],"sourcesContent":["import type { BrowserPage } from \"./page\";\n\nexport type Command = readonly [executable: string, ...args: string[]];\nexport type Pattern = string | RegExp;\nexport type Viewport = { name: string; width: number; height: number; mobile?: boolean };\nexport const defaultViewports: readonly Viewport[] = [\n { name: \"desktop\", width: 1280, height: 800 },\n { name: \"phone\", width: 390, height: 844, mobile: true },\n];\n\nexport type FixtureContext = {\n /** Disposable copy of the app. All commands run here. */\n directory: string;\n dataRoot: string;\n /** OS-selected ephemeral port, reserved until immediately before app startup. */\n port: number;\n url: string;\n /** Write an actual port here when the app binds port 0 itself. */\n portFile: string;\n};\nexport type AppFixtureOptions = {\n directory?: string;\n /** Optional build, executed inside the disposable copy before start. */\n build?: Command | ((fixture: FixtureContext) => Command);\n /** Defaults to [process.execPath, \"dist/app.js\"]. Must stay in the foreground. */\n start?: Command | ((fixture: FixtureContext) => Command);\n /** Only these app variables are added to the isolated environment. */\n env?: Record<string, string> | ((fixture: FixtureContext) => Record<string, string>);\n /** Directories prepended to PATH, for fixture-owned fake engines/binaries. */\n path?: string[];\n /** Prepare data/fake binaries in the disposable fixture before build/start. */\n prepare?: (fixture: FixtureContext) => void | Promise<void>;\n /** Additional relative directories to omit when copying app files. */\n exclude?: string[];\n readyPath?: string;\n /** If true, await portFile instead of using the preallocated port. */\n portFromFile?: boolean;\n startupTimeoutMs?: number;\n};\nexport type BrowserOptions = {\n binary?: string;\n /** Additional Chrome flags, e.g. --no-sandbox in a controlled root container. */\n args?: string[];\n};\nexport type NetworkFailure = {\n at: string;\n url: string;\n status?: number;\n errorText?: string;\n canceled?: boolean;\n allowed?: boolean;\n};\nexport type ConsoleEntry = { at: string; level: string; text: string; allowed?: boolean };\nexport type StepEvidence = {\n name: string;\n startedAt: string;\n durationMs: number;\n status: \"passed\" | \"failed\";\n error?: string;\n};\nexport type ProcessEvidence = {\n role: string;\n pid: number;\n childPid?: number;\n command: string[];\n ownerFile: string;\n stopped?: boolean;\n};\nexport type E2EEvidence = {\n schemaVersion: 1;\n startedAt: string;\n durationMs: number;\n status: \"running\" | \"passed\" | \"failed\";\n url?: string;\n steps: StepEvidence[];\n console: ConsoleEntry[];\n networkFailures: NetworkFailure[];\n screenshots: { name: string; file: string; viewport: Viewport }[];\n processes: ProcessEvidence[];\n errors: string[];\n};\nexport type NetworkAllowance = { url: Pattern; status?: number; errorText?: Pattern };\nexport type E2EContext = FixtureContext & {\n page: BrowserPage;\n evidence: E2EEvidence;\n outputDirectory: string;\n signal: AbortSignal;\n step: <T>(name: string, action: () => Promise<T>) => Promise<T>;\n};\nexport type E2ESpec = {\n app: AppFixtureOptions;\n browser?: BrowserOptions;\n viewports?: readonly Viewport[];\n allowConsoleErrors?: Pattern[];\n allowNetworkFailures?: NetworkAllowance[];\n /** Long-lived HTTP requests excluded from the final network-idle barrier. */\n allowPendingRequests?: Pattern[];\n timeoutMs?: number;\n run: (context: E2EContext) => Promise<void>;\n};\nexport type RunE2EOptions = {\n browser?: string;\n path?: string[];\n outputDirectory?: string;\n signal?: AbortSignal;\n};\n\nexport function defineE2E(spec: E2ESpec): E2ESpec {\n return spec;\n}\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\nexport function matches(pattern: Pattern, value: string): boolean {\n // A fresh regexp avoids stateful /g and /y allowlists changing their verdict.\n return typeof pattern === \"string\"\n ? value.includes(pattern)\n : new RegExp(pattern.source, pattern.flags).test(value);\n}\n"],"mappings":";AAKA,MAAa,mBAAwC,CACnD;CAAE,MAAM;CAAW,OAAO;CAAM,QAAQ;AAAI,GAC5C;CAAE,MAAM;CAAS,OAAO;CAAK,QAAQ;CAAK,QAAQ;AAAK,CACzD;
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../../../../../../packages/core/src/e2e/types.ts"],"sourcesContent":["import type { BrowserPage } from \"./page\";\n\nexport type Command = readonly [executable: string, ...args: string[]];\nexport type Pattern = string | RegExp;\nexport type Viewport = { name: string; width: number; height: number; mobile?: boolean };\nexport const defaultViewports: readonly Viewport[] = [\n { name: \"desktop\", width: 1280, height: 800 },\n { name: \"phone\", width: 390, height: 844, mobile: true },\n];\n\nexport type FixtureContext = {\n /** Disposable copy of the app. All commands run here. */\n directory: string;\n dataRoot: string;\n /** OS-selected ephemeral port, reserved until immediately before app startup. */\n port: number;\n url: string;\n /** Write an actual port here when the app binds port 0 itself. */\n portFile: string;\n};\nexport type AppFixtureOptions = {\n directory?: string;\n /** Optional build, executed inside the disposable copy before start. */\n build?: Command | ((fixture: FixtureContext) => Command);\n /** Defaults to [process.execPath, \"dist/app.js\"]. Must stay in the foreground. */\n start?: Command | ((fixture: FixtureContext) => Command);\n /** Only these app variables are added to the isolated environment. */\n env?: Record<string, string> | ((fixture: FixtureContext) => Record<string, string>);\n /** Directories prepended to PATH, for fixture-owned fake engines/binaries. */\n path?: string[];\n /** Prepare data/fake binaries in the disposable fixture before build/start. */\n prepare?: (fixture: FixtureContext) => void | Promise<void>;\n /** Additional relative directories to omit when copying app files. */\n exclude?: string[];\n readyPath?: string;\n /** If true, await portFile instead of using the preallocated port. */\n portFromFile?: boolean;\n startupTimeoutMs?: number;\n};\nexport type BrowserOptions = {\n binary?: string;\n /** Additional Chrome flags, e.g. --no-sandbox in a controlled root container. */\n args?: string[];\n /**\n * How long to wait for the browser to report its DevTools endpoint.\n * A first launch with a fresh profile on a busy machine can be slow.\n * @default 30_000\n */\n startupTimeoutMs?: number;\n};\nexport type NetworkFailure = {\n at: string;\n url: string;\n status?: number;\n errorText?: string;\n canceled?: boolean;\n allowed?: boolean;\n};\nexport type ConsoleEntry = { at: string; level: string; text: string; allowed?: boolean };\nexport type StepEvidence = {\n name: string;\n startedAt: string;\n durationMs: number;\n status: \"passed\" | \"failed\";\n error?: string;\n};\nexport type ProcessEvidence = {\n role: string;\n pid: number;\n childPid?: number;\n command: string[];\n ownerFile: string;\n stopped?: boolean;\n};\nexport type E2EEvidence = {\n schemaVersion: 1;\n startedAt: string;\n durationMs: number;\n status: \"running\" | \"passed\" | \"failed\";\n url?: string;\n steps: StepEvidence[];\n console: ConsoleEntry[];\n networkFailures: NetworkFailure[];\n screenshots: { name: string; file: string; viewport: Viewport }[];\n processes: ProcessEvidence[];\n errors: string[];\n};\nexport type NetworkAllowance = { url: Pattern; status?: number; errorText?: Pattern };\nexport type E2EContext = FixtureContext & {\n page: BrowserPage;\n evidence: E2EEvidence;\n outputDirectory: string;\n signal: AbortSignal;\n step: <T>(name: string, action: () => Promise<T>) => Promise<T>;\n};\nexport type E2ESpec = {\n app: AppFixtureOptions;\n browser?: BrowserOptions;\n viewports?: readonly Viewport[];\n allowConsoleErrors?: Pattern[];\n allowNetworkFailures?: NetworkAllowance[];\n /** Long-lived HTTP requests excluded from the final network-idle barrier. */\n allowPendingRequests?: Pattern[];\n timeoutMs?: number;\n run: (context: E2EContext) => Promise<void>;\n};\nexport type RunE2EOptions = {\n browser?: string;\n path?: string[];\n outputDirectory?: string;\n signal?: AbortSignal;\n};\n\nexport function defineE2E(spec: E2ESpec): E2ESpec {\n return spec;\n}\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\nexport function matches(pattern: Pattern, value: string): boolean {\n // A fresh regexp avoids stateful /g and /y allowlists changing their verdict.\n return typeof pattern === \"string\"\n ? value.includes(pattern)\n : new RegExp(pattern.source, pattern.flags).test(value);\n}\n"],"mappings":";AAKA,MAAa,mBAAwC,CACnD;CAAE,MAAM;CAAW,OAAO;CAAM,QAAQ;AAAI,GAC5C;CAAE,MAAM;CAAS,OAAO;CAAK,QAAQ;CAAK,QAAQ;AAAK,CACzD;AAyGA,SAAgB,UAAU,MAAwB;CAChD,OAAO;AACT;AACA,SAAgB,aAAa,OAAwB;CACnD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;AACA,SAAgB,QAAQ,SAAkB,OAAwB;CAEhE,OAAO,OAAO,YAAY,WACtB,MAAM,SAAS,OAAO,IACtB,IAAI,OAAO,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK;AAC1D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./server.mjs";
|
|
2
|
+
//#region ../../packages/core/src/http/error-response.d.ts
|
|
3
|
+
/** JSON error body and correlation data available at the transport boundary. */
|
|
4
|
+
export type HttpErrorResponseContext = {
|
|
5
|
+
status: number;
|
|
6
|
+
body: unknown;
|
|
7
|
+
requestId: string;
|
|
8
|
+
};
|
|
9
|
+
/** Return a JSON object, or undefined to retain the original response. */
|
|
10
|
+
export type HttpErrorResponseFormatter = (context: HttpErrorResponseContext) => Record<string, unknown> | undefined;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=error-response.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-response.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/error-response.ts"],"mappings":";;;YAMY;EACV;EACA;EACA;;;YAIU,8BACV,SAAS,6BACN"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import baseConfig from "@mongez/config";
|
|
2
|
+
import { log } from "@warlock.js/logger";
|
|
3
|
+
|
|
4
|
+
//#region ../../packages/core/src/http/error-response.ts
|
|
5
|
+
/**
|
|
6
|
+
* Format JSON errors from both Warlock and Fastify, including early rejections.
|
|
7
|
+
* HTML, files, and streams retain their own response contracts.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function registerErrorResponseFormatter(server) {
|
|
11
|
+
const formatter = baseConfig.get("http.errorResponse");
|
|
12
|
+
if (typeof formatter !== "function") return;
|
|
13
|
+
server.addHook("onSend", async (request, reply, payload) => {
|
|
14
|
+
const contentType = String(reply.getHeader("content-type") ?? "");
|
|
15
|
+
if (reply.statusCode < 400 || reply.statusCode > 599 || !/^application\/(?:[\w.-]+\+)?json(?:\s*;|$)/i.test(contentType) || typeof payload !== "string" && !Buffer.isBuffer(payload)) return payload;
|
|
16
|
+
const headerName = baseConfig.get("http.requestId.header", "X-Request-Id");
|
|
17
|
+
const requestId = String(reply.getHeader(headerName) ?? request.id);
|
|
18
|
+
try {
|
|
19
|
+
const body = JSON.parse(payload.toString());
|
|
20
|
+
const formatted = formatter({
|
|
21
|
+
status: reply.statusCode,
|
|
22
|
+
body,
|
|
23
|
+
requestId
|
|
24
|
+
});
|
|
25
|
+
if (formatted === void 0) return payload;
|
|
26
|
+
const serialized = JSON.stringify(formatted);
|
|
27
|
+
if (serialized === void 0) return payload;
|
|
28
|
+
if (baseConfig.get("http.requestId.enabled", true) !== false) reply.header(headerName, requestId);
|
|
29
|
+
reply.header("Cache-Control", "private, no-store");
|
|
30
|
+
reply.removeHeader("content-length");
|
|
31
|
+
return serialized;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
log.error("http", "error-response", error, { requestId });
|
|
34
|
+
return payload;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { registerErrorResponseFormatter };
|
|
41
|
+
//# sourceMappingURL=error-response.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-response.mjs","names":["config"],"sources":["../../../../../../../../packages/core/src/http/error-response.ts"],"sourcesContent":["import config from \"@mongez/config\";\nimport { log } from \"@warlock.js/logger\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { FastifyInstance } from \"./server\";\n\n/** JSON error body and correlation data available at the transport boundary. */\nexport type HttpErrorResponseContext = {\n status: number;\n body: unknown;\n requestId: string;\n};\n\n/** Return a JSON object, or undefined to retain the original response. */\nexport type HttpErrorResponseFormatter = (\n context: HttpErrorResponseContext,\n) => Record<string, unknown> | undefined;\n\n/**\n * Format JSON errors from both Warlock and Fastify, including early rejections.\n * HTML, files, and streams retain their own response contracts.\n * @internal\n */\nexport function registerErrorResponseFormatter(server: FastifyInstance): void {\n const formatter = config.get(\"http.errorResponse\") as HttpErrorResponseFormatter | undefined;\n\n if (typeof formatter !== \"function\") {\n return;\n }\n\n server.addHook(\n \"onSend\",\n async (request: FastifyRequest, reply: FastifyReply, payload: unknown) => {\n const contentType = String(reply.getHeader(\"content-type\") ?? \"\");\n\n if (\n reply.statusCode < 400 ||\n reply.statusCode > 599 ||\n !/^application\\/(?:[\\w.-]+\\+)?json(?:\\s*;|$)/i.test(contentType) ||\n (typeof payload !== \"string\" && !Buffer.isBuffer(payload))\n ) {\n return payload;\n }\n\n const headerName = config.get(\"http.requestId.header\", \"X-Request-Id\");\n // Warlock stamps its Request.id on routed responses. Before a Warlock\n // Request exists (e.g. parsing, global rate limiting, unmatched routes),\n // use Fastify's request.id and echo that same value for correlation.\n const requestId = String(reply.getHeader(headerName) ?? request.id);\n\n try {\n const body: unknown = JSON.parse(payload.toString());\n const formatted = formatter({ status: reply.statusCode, body, requestId });\n\n if (formatted === undefined) {\n return payload;\n }\n\n const serialized = JSON.stringify(formatted);\n\n if (serialized === undefined) {\n return payload;\n }\n\n if (config.get(\"http.requestId.enabled\", true) !== false) {\n reply.header(headerName, requestId);\n }\n\n reply.header(\"Cache-Control\", \"private, no-store\");\n reply.removeHeader(\"content-length\");\n\n return serialized;\n } catch (error) {\n log.error(\"http\", \"error-response\", error, { requestId });\n\n return payload;\n }\n },\n );\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,+BAA+B,QAA+B;CAC5E,MAAM,YAAYA,WAAO,IAAI,oBAAoB;CAEjD,IAAI,OAAO,cAAc,YACvB;CAGF,OAAO,QACL,UACA,OAAO,SAAyB,OAAqB,YAAqB;EACxE,MAAM,cAAc,OAAO,MAAM,UAAU,cAAc,KAAK,EAAE;EAEhE,IACE,MAAM,aAAa,OACnB,MAAM,aAAa,OACnB,CAAC,8CAA8C,KAAK,WAAW,KAC9D,OAAO,YAAY,YAAY,CAAC,OAAO,SAAS,OAAO,GAExD,OAAO;EAGT,MAAM,aAAaA,WAAO,IAAI,yBAAyB,cAAc;EAIrE,MAAM,YAAY,OAAO,MAAM,UAAU,UAAU,KAAK,QAAQ,EAAE;EAElE,IAAI;GACF,MAAM,OAAgB,KAAK,MAAM,QAAQ,SAAS,CAAC;GACnD,MAAM,YAAY,UAAU;IAAE,QAAQ,MAAM;IAAY;IAAM;GAAU,CAAC;GAEzE,IAAI,cAAc,QAChB,OAAO;GAGT,MAAM,aAAa,KAAK,UAAU,SAAS;GAE3C,IAAI,eAAe,QACjB,OAAO;GAGT,IAAIA,WAAO,IAAI,0BAA0B,IAAI,MAAM,OACjD,MAAM,OAAO,YAAY,SAAS;GAGpC,MAAM,OAAO,iBAAiB,mBAAmB;GACjD,MAAM,aAAa,gBAAgB;GAEnC,OAAO;EACT,SAAS,OAAO;GACd,IAAI,MAAM,QAAQ,kBAAkB,OAAO,EAAE,UAAU,CAAC;GAExD,OAAO;EACT;CACF,CACF;AACF"}
|
package/esm/http/index.d.mts
CHANGED
|
@@ -9,6 +9,8 @@ import { FileValidationOptions, UploadedFile, UploadedFileJson } from "./uploade
|
|
|
9
9
|
import { Request, RequestTranslator } from "./request.mjs";
|
|
10
10
|
import { CspConfig, DEFAULT_CSP_DIRECTIVES, InvalidCspDirectiveError, applyCspHeader, buildCspHeaderValue, mergeCspDirectives, resolveCspConfig, serializeCspDirectives, validateCspConfigAtBoot, validateCspDirectives } from "./csp.mjs";
|
|
11
11
|
import { HttpErrorMapper, HttpErrorMapping } from "./error-mapper.mjs";
|
|
12
|
+
import { ClosableServer, FastifyInstance, beginHttpDrain, closeServerWithTimeout, getHttpServer, startHttpServer, trackConnectionsForDrain } from "./server.mjs";
|
|
13
|
+
import { HttpErrorResponseContext, HttpErrorResponseFormatter } from "./error-response.mjs";
|
|
12
14
|
import { HttpTracingConfig, TracingContext, TracingHooks, TracingPhaseInfo, TracingRequestEndInfo } from "./tracing/tracing.type.mjs";
|
|
13
15
|
import { DecodedAccessToken, HttpConfigurations, HttpServerOptions, PartialMiddleware, RequestEvent, RequestLocals, ResponseEvent, ResponseSSEController, ResponseSSEMessageOptions, ResponseSSEOptions, ResponseStreamController, ResponseStreamOptions, ReturnedResponse } from "./types.mjs";
|
|
14
16
|
import { defaultHttpConfigurations, httpConfig } from "./config.mjs";
|
|
@@ -40,7 +42,6 @@ import { anyMatch, ipMatches } from "./middleware/utils/cidr-match.mjs";
|
|
|
40
42
|
import { buildIdempotencyCacheKey, hashBody, isValidIdempotencyKey } from "./middleware/utils/idempotency-key.mjs";
|
|
41
43
|
import { parseSize } from "./middleware/utils/parse-size.mjs";
|
|
42
44
|
import "./middleware/index.mjs";
|
|
43
|
-
import { ClosableServer, FastifyInstance, beginHttpDrain, closeServerWithTimeout, getHttpServer, startHttpServer, trackConnectionsForDrain } from "./server.mjs";
|
|
44
45
|
import { registerHttpPlugins, resolvePublicRoot } from "./plugins.mjs";
|
|
45
46
|
import { assertConfiguredHttpPortIsFree, preflightConfiguredHttpPort, remedyLines, shouldPreflightHttpPort } from "./boot-port-preflight.mjs";
|
|
46
47
|
import { PortInUseError, assertPortIsAvailable, isPortAvailable } from "./port-preflight.mjs";
|
|
@@ -53,4 +54,4 @@ import { TracingContextSource, buildTracingContext, dispatchPhase, dispatchReque
|
|
|
53
54
|
import { RequestContextStore, requestContext, useCurrentUser, useRequest, useRequestStore } from "./context/request-context.mjs";
|
|
54
55
|
import { requestMemo } from "./context/request-memo.mjs";
|
|
55
56
|
import { ModelResourceRegistry, Serialized, SerializedWire } from "./serialized.mjs";
|
|
56
|
-
export { BadRequestError, type CacheMiddlewareOptions, ClosableServer, type ConcurrencyLimitOptions, ConditionalRequestInput, ConditionalRequestOutcome, ConflictError, CookieJarUnavailableError, CookieOptions, CspConfig, CsrfOriginCheckReason, CsrfOriginVerdict, DEFAULT_CSP_DIRECTIVES, DecodedAccessToken, DetectedImageFormat, EntityTag, FastifyInstance, FileNamingStrategy, FileValidationOptions, ForbiddenError, GenerateImageVariantsOptions, GeneratedImageDescriptor, GeneratedImageVariant, HealthCheck, HealthStatus, HttpConfigurations, HttpError, HttpErrorCodes, type HttpErrorMapper, type HttpErrorMapping, HttpLoggingConfig, HttpReadyReport, HttpServerOptions, HttpServerRebuiltListener, HttpTracingConfig, type IdempotencyOptions, ImageTransformCallback, ImageTransformConfig, ImageVariantDefinition, ImageVariantFit, ImageVariantOutputFormat, ImageVariantsConfigError, InvalidCspDirectiveError, type IpFilterOptions, type MaintenanceOptions, ModelResourceRegistry, NotAcceptableError, NotAllowedError, PartialMiddleware, PipeableReactStream, PortInUseError, PrefixConfig, PrefixOptions, PrivateRequestLoggingRule, PurgeImageVariantsOptions, type RateLimitOptions, Request, RequestContextStore, RequestController, RequestEvent, RequestLocals, RequestLog, RequestLogSnapshot, RequestLogSource, RequestLoggingOptions, RequestTranslator, ResolveImageVariantInput, ResolvedImageVariant, ResolvedImageVariantsConfig, ResourceNotFoundError, Response, ResponseEvent, ResponseSSEController, ResponseSSEMessageOptions, ResponseSSEOptions, ResponseStatus, ResponseStreamController, ResponseStreamOptions, ReturnedResponse, SafeRedirectOptions, SaveAsOptions, SaveOptions, SendBufferOptions, SendFileOptions, Serialized, SerializedWire, ServerError, StreamReactResponseOptions, TracingContext, TracingContextSource, TracingHooks, TracingPhaseInfo, TracingRequestEndInfo, UPLOADS_DEFAULTS, URL_CREDENTIAL_PARAMS, UnAuthorizedError, UploadedFile, UploadedFileControllerOptions, UploadedFileImageOptions, UploadedFileJson, UploadedFileQuery, UploadsConfigurations, UploadsImagesConfigurations, VariantOutputFormat, VariantSourceFormat, XMLable, anyMatch, applyCspHeader, assertConfiguredHttpPortIsFree, assertPortIsAvailable, beginHttpDrain, buildCspHeaderValue, buildIdempotencyCacheKey, buildRequestLogSnapshot, buildTracingContext, closeServerWithTimeout, createHttpApplication, createRequestStore, createUploadedFileController, defaultHttpConfigurations, deriveTraceId, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, escapeHeaderValue, evaluateConditionalRequest, generateImageVariants, getHttpReadyReport, getHttpServer, hashBody, health, httpConfig, ipMatches, isAllowedCsrfOrigin, isPortAvailable, isSafeRedirect, isTracingEnabled, isValidIdempotencyKey, logResponse, matchesIfMatch, matchesIfNoneMatch, mergeCspDirectives, middleware, normalizeOrigin, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseEntityTag, parseEntityTagList, parseSize, parseTraceparentTraceId, preflightConfiguredHttpPort, purgeImageVariants, redactQueryCredentials, redactUrlCredentials, registerHttpPlugins, registerTracingHooks, remedyLines, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveImageVariant, resolvePublicRoot, resolveRequestLoggingOptions, resolveTracingConfig, runDefaultCsrfGuard, safeRedirect, serializeCspDirectives, setHttpReadyReport, shouldPreflightHttpPort, startHttpServer, stopHttpApplication, streamReactResponse, strongEntityTagMatch, t, toSingleLineSseField, trackConnectionsForDrain, uploadedFileController, uploadsConfig, useCurrentUser, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, weakEntityTagMatch, wrapResponseInDataKey };
|
|
57
|
+
export { BadRequestError, type CacheMiddlewareOptions, ClosableServer, type ConcurrencyLimitOptions, ConditionalRequestInput, ConditionalRequestOutcome, ConflictError, CookieJarUnavailableError, CookieOptions, CspConfig, CsrfOriginCheckReason, CsrfOriginVerdict, DEFAULT_CSP_DIRECTIVES, DecodedAccessToken, DetectedImageFormat, EntityTag, FastifyInstance, FileNamingStrategy, FileValidationOptions, ForbiddenError, GenerateImageVariantsOptions, GeneratedImageDescriptor, GeneratedImageVariant, HealthCheck, HealthStatus, HttpConfigurations, HttpError, HttpErrorCodes, type HttpErrorMapper, type HttpErrorMapping, type HttpErrorResponseContext, type HttpErrorResponseFormatter, HttpLoggingConfig, HttpReadyReport, HttpServerOptions, HttpServerRebuiltListener, HttpTracingConfig, type IdempotencyOptions, ImageTransformCallback, ImageTransformConfig, ImageVariantDefinition, ImageVariantFit, ImageVariantOutputFormat, ImageVariantsConfigError, InvalidCspDirectiveError, type IpFilterOptions, type MaintenanceOptions, ModelResourceRegistry, NotAcceptableError, NotAllowedError, PartialMiddleware, PipeableReactStream, PortInUseError, PrefixConfig, PrefixOptions, PrivateRequestLoggingRule, PurgeImageVariantsOptions, type RateLimitOptions, Request, RequestContextStore, RequestController, RequestEvent, RequestLocals, RequestLog, RequestLogSnapshot, RequestLogSource, RequestLoggingOptions, RequestTranslator, ResolveImageVariantInput, ResolvedImageVariant, ResolvedImageVariantsConfig, ResourceNotFoundError, Response, ResponseEvent, ResponseSSEController, ResponseSSEMessageOptions, ResponseSSEOptions, ResponseStatus, ResponseStreamController, ResponseStreamOptions, ReturnedResponse, SafeRedirectOptions, SaveAsOptions, SaveOptions, SendBufferOptions, SendFileOptions, Serialized, SerializedWire, ServerError, StreamReactResponseOptions, TracingContext, TracingContextSource, TracingHooks, TracingPhaseInfo, TracingRequestEndInfo, UPLOADS_DEFAULTS, URL_CREDENTIAL_PARAMS, UnAuthorizedError, UploadedFile, UploadedFileControllerOptions, UploadedFileImageOptions, UploadedFileJson, UploadedFileQuery, UploadsConfigurations, UploadsImagesConfigurations, VariantOutputFormat, VariantSourceFormat, XMLable, anyMatch, applyCspHeader, assertConfiguredHttpPortIsFree, assertPortIsAvailable, beginHttpDrain, buildCspHeaderValue, buildIdempotencyCacheKey, buildRequestLogSnapshot, buildTracingContext, closeServerWithTimeout, createHttpApplication, createRequestStore, createUploadedFileController, defaultHttpConfigurations, deriveTraceId, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, escapeHeaderValue, evaluateConditionalRequest, generateImageVariants, getHttpReadyReport, getHttpServer, hashBody, health, httpConfig, ipMatches, isAllowedCsrfOrigin, isPortAvailable, isSafeRedirect, isTracingEnabled, isValidIdempotencyKey, logResponse, matchesIfMatch, matchesIfNoneMatch, mergeCspDirectives, middleware, normalizeOrigin, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseEntityTag, parseEntityTagList, parseSize, parseTraceparentTraceId, preflightConfiguredHttpPort, purgeImageVariants, redactQueryCredentials, redactUrlCredentials, registerHttpPlugins, registerTracingHooks, remedyLines, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveImageVariant, resolvePublicRoot, resolveRequestLoggingOptions, resolveTracingConfig, runDefaultCsrfGuard, safeRedirect, serializeCspDirectives, setHttpReadyReport, shouldPreflightHttpPort, startHttpServer, stopHttpApplication, streamReactResponse, strongEntityTagMatch, t, toSingleLineSseField, trackConnectionsForDrain, uploadedFileController, uploadsConfig, useCurrentUser, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, weakEntityTagMatch, wrapResponseInDataKey };
|
package/esm/http/response.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/response.ts"],"mappings":";;;;;;;;;;;;;;;KA4CK,0CAA0C,sBAAsB;;;;;;;;;;;;;YAczD,gBAAgB;;;;;;EAM1B;;oBAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;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Ae,aAAa,qBAAoB,QAAA;;;;EAO/D,SAAS,cAAc,oBAAiB,QAAA;;;;EAOlC,aAAa,kBAAkB,oBAAiB,QAAA;;;;EAgDtD,mBAAmB;;;;;;;;;EAab,aAAa,QAAQ,mBAAgB,QAAA"}
|
|
1
|
+
{"version":3,"file":"response.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/response.ts"],"mappings":";;;;;;;;;;;;;;;KA4CK,0CAA0C,sBAAsB;;;;;;;;;;;;;YAczD,gBAAgB;;;;;;EAM1B;;oBAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;YAMU;EACV;EACA;EACA;EACA;;;;;YAMU,oBAAoB;EAC9B;EACA;;;;;;;wBA0Bc,qBAAqB;qBAIxB;;;;YAID,OAAQ;;;;;;;;;;;;;;;;;EAkBX,cAAe;;;;YAKZ;;;;YAKA;;;;EAKH,SAAU;;;;YAKP,QAAM;;;;;;EAOT;;;;MAKI,sBAAG,8BAAA;;;;MAOH;;;;MAOA,KAAK;;;;EAOT,UAAU;;;;EASV,OAAO;;;;EASP,YAAY,UAAU;;;;EAetB;;;;EASA,SAAS,OAAO;;;;MASZ;;;;EAOJ,eAAe;;;;MASX;;;;MAOA;;;;MAOA;;;;SAOG,GACZ,OAAO,eACP,WAAW,UAAU,oBACpB;;;;mBAOoB,QAAQ,OAAO,kBAAkB,cAAW;;;;YAanD,aAAS;;;;EAOZ,MAAM,aAAa;;;;EAkDzB,IAAI,iBAAiB,QAAO;;;;MAkBxB;;;;;;;EAUE,KAAK,YAAY,qBAAqB,0BAAuB,QAAQ;;;;;;YAyFxE,eAAe;;YA8Df,WAAO,+BAAA,yCAAA,iCAAA,gCAAA,8BAAA,6CAAA,iCAAA;;YASP,WAAO,+BAAA,yCAAA,iCAAA,gCAAA,8BAAA,6CAAA,iCAAA;;YASP,QAAQ,YAAS,+BAAA,yCAAA,iCAA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A;;;;;EAYT,SAAS,aAA0D,QAAA;;;;EAOnE,SAAS,aAA0C,QAAA;;;;EAOnD,gBAAgB,YAAS,QAAA;;;;;EAQzB,oBAAoB,YAAS,QAAA;;;;;;;;;;;;;;;;UAmB5B;UA2BA;;;;EAgEK,SAAS,mBAAmB,aAAa,mBAAmB,kBAAe,QAAA;;;;;EAyEjF,WAAW,QAAQ,QAAQ,mBAAmB,oBAAiB,+BAAA,yCAAA,iCAAA,gCAAA,8BAAA,6CAAA,iCAAA;;;;;EAkBzD,UACX;IACA,oBAAoB,KAAK;MAAsC;SAAuB;;;;;;EAuCjF,eAAe,eAAe,aAAa,qBAAoB,QAAA;;;;EAO/D,SAAS,cAAc,oBAAiB,QAAA;;;;EAOlC,aAAa,kBAAkB,oBAAiB,QAAA;;;;EAgDtD,mBAAmB;;;;;;;;;EAab,aAAa,QAAQ,mBAAgB,QAAA"}
|
package/esm/http/response.mjs
CHANGED
|
@@ -37,6 +37,8 @@ let ResponseStatus = /* @__PURE__ */ function(ResponseStatus) {
|
|
|
37
37
|
ResponseStatus[ResponseStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
38
38
|
ResponseStatus[ResponseStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
39
39
|
ResponseStatus[ResponseStatus["CONFLICT"] = 409] = "CONFLICT";
|
|
40
|
+
ResponseStatus[ResponseStatus["CONTENT_TOO_LARGE"] = 413] = "CONTENT_TOO_LARGE";
|
|
41
|
+
ResponseStatus[ResponseStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
40
42
|
ResponseStatus[ResponseStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
41
43
|
ResponseStatus[ResponseStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
42
44
|
ResponseStatus[ResponseStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|