@mesofact/runtime 0.8.29
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 +19 -0
- package/dist/adapters/r2.d.ts +24 -0
- package/dist/adapters/r2.d.ts.map +1 -0
- package/dist/adapters/r2.js +136 -0
- package/dist/adapters/r2.js.map +1 -0
- package/dist/adapters/sqlite.d.ts +25 -0
- package/dist/adapters/sqlite.d.ts.map +1 -0
- package/dist/adapters/sqlite.js +131 -0
- package/dist/adapters/sqlite.js.map +1 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +139 -0
- package/dist/config.js.map +1 -0
- package/dist/contract.d.ts +40 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +5 -0
- package/dist/contract.js.map +1 -0
- package/dist/errors.d.ts +29 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/head.d.ts +32 -0
- package/dist/head.d.ts.map +1 -0
- package/dist/head.js +93 -0
- package/dist/head.js.map +1 -0
- package/dist/health.d.ts +14 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +85 -0
- package/dist/health.js.map +1 -0
- package/dist/hooks.d.ts +28 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +64 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hydration.d.ts +6 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/hydration.js +68 -0
- package/dist/hydration.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +68 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +9 -0
- package/dist/manifest.js.map +1 -0
- package/dist/routes.d.ts +67 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +130 -0
- package/dist/routes.js.map +1 -0
- package/dist/source.d.ts +36 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +52 -0
- package/dist/source.js.map +1 -0
- package/dist/track-ctx.d.ts +13 -0
- package/dist/track-ctx.d.ts.map +1 -0
- package/dist/track-ctx.js +15 -0
- package/dist/track-ctx.js.map +1 -0
- package/dist/validate.d.ts +20 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +333 -0
- package/dist/validate.js.map +1 -0
- package/package.json +40 -0
- package/src/adapters/r2.ts +163 -0
- package/src/adapters/sqlite.ts +182 -0
- package/src/config.ts +213 -0
- package/src/contract.ts +82 -0
- package/src/errors.ts +52 -0
- package/src/head.ts +130 -0
- package/src/health.ts +99 -0
- package/src/hooks.ts +72 -0
- package/src/hydration.ts +72 -0
- package/src/index.ts +113 -0
- package/src/manifest.ts +104 -0
- package/src/routes.ts +320 -0
- package/src/source.ts +91 -0
- package/src/track-ctx.ts +29 -0
- package/src/validate.ts +388 -0
package/dist/errors.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Typed errors adapters throw. Render functions can catch and return
|
|
2
|
+
// fallback HTML, or rethrow to let mesofact decide (stale-on-error / 503).
|
|
3
|
+
// See `.yah/docs/architecture/mesofact.md` §"Adapter API surface".
|
|
4
|
+
export class SourceError extends Error {
|
|
5
|
+
source;
|
|
6
|
+
retryable;
|
|
7
|
+
constructor(message, source, retryable, options) {
|
|
8
|
+
super(message, options);
|
|
9
|
+
this.name = new.target.name;
|
|
10
|
+
this.source = source;
|
|
11
|
+
this.retryable = retryable;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class SourceUnavailableError extends SourceError {
|
|
15
|
+
constructor(source, options) {
|
|
16
|
+
super(`source unavailable: ${source}`, source, true, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class SourceTimeoutError extends SourceError {
|
|
20
|
+
timeout_ms;
|
|
21
|
+
constructor(source, timeout_ms, options) {
|
|
22
|
+
super(`source timeout after ${timeout_ms}ms: ${source}`, source, true, options);
|
|
23
|
+
this.timeout_ms = timeout_ms;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class SourceQueryError extends SourceError {
|
|
27
|
+
constructor(source, message, options) {
|
|
28
|
+
super(`source query error (${source}): ${message}`, source, false, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class RowNotFoundError extends SourceError {
|
|
32
|
+
table;
|
|
33
|
+
id;
|
|
34
|
+
constructor(source, table, id) {
|
|
35
|
+
super(`row not found: ${source}.${table}[${id}]`, source, false);
|
|
36
|
+
this.table = table;
|
|
37
|
+
this.id = id;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,2EAA2E;AAC3E,mEAAmE;AAEnE,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAS;IACf,SAAS,CAAU;IAE5B,YACE,OAAe,EACf,MAAc,EACd,SAAkB,EAClB,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE,OAAmC,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IACrD,YAAY,MAAc,EAAE,OAA6B;QACvD,KAAK,CAAC,uBAAuB,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACxC,UAAU,CAAS;IAE5B,YAAY,MAAc,EAAE,UAAkB,EAAE,OAA6B;QAC3E,KAAK,CAAC,wBAAwB,UAAU,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAChF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,YAAY,MAAc,EAAE,OAAe,EAAE,OAA6B;QACxE,KAAK,CAAC,uBAAuB,MAAM,MAAM,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACtC,KAAK,CAAS;IACd,EAAE,CAAS;IAEpB,YAAY,MAAc,EAAE,KAAa,EAAE,EAAU;QACnD,KAAK,CAAC,kBAAkB,MAAM,IAAI,KAAK,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF"}
|
package/dist/head.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type OpenGraph = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
siteName?: string;
|
|
8
|
+
};
|
|
9
|
+
export type TwitterCard = {
|
|
10
|
+
card?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
image?: string;
|
|
14
|
+
site?: string;
|
|
15
|
+
creator?: string;
|
|
16
|
+
};
|
|
17
|
+
export type HeadLink = {
|
|
18
|
+
rel: string;
|
|
19
|
+
href: string;
|
|
20
|
+
};
|
|
21
|
+
export type Head = {
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
canonical?: string;
|
|
25
|
+
og?: OpenGraph;
|
|
26
|
+
twitter?: TwitterCard;
|
|
27
|
+
noindex?: boolean;
|
|
28
|
+
links?: readonly HeadLink[];
|
|
29
|
+
};
|
|
30
|
+
export declare function renderHead(head: Head): string;
|
|
31
|
+
export declare function weaveHead(html: string, head: Head): string;
|
|
32
|
+
//# sourceMappingURL=head.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../src/head.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAExB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IAItB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC7B,CAAC;AAuBF,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAuC7C;AAKD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAM1D"}
|
package/dist/head.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Typed <head> contract (W270 §4). A render MAY return a `head` value on its
|
|
2
|
+
// RenderResult; the prerenderer / SSG dispatch weaves it into the document
|
|
3
|
+
// head at the same seam as the hydration tags. Consumers return structured
|
|
4
|
+
// data — they never hand-assemble head markup or escape it themselves.
|
|
5
|
+
//
|
|
6
|
+
// Escaping lives HERE, one audited implementation, same posture as
|
|
7
|
+
// `escapeJsonForScriptTag` (hydration.ts): all interpolated values are HTML-
|
|
8
|
+
// escaped, attribute values additionally escape the quote that closes the
|
|
9
|
+
// attribute. Meta keys (`og:title`, `twitter:card`, …) are framework-owned
|
|
10
|
+
// literals and are never interpolated from consumer data.
|
|
11
|
+
//
|
|
12
|
+
// Also ported byte-for-byte into the deno_core SSG runtime shim at
|
|
13
|
+
// `crates/mesofact-ssr/js/runtime_shim.js` — keep the two in lockstep so both
|
|
14
|
+
// pipelines emit the same head bytes (same rule as the hydration helpers).
|
|
15
|
+
// Escape a value destined for HTML text content (`<title>…`): the three
|
|
16
|
+
// characters that can open a tag / entity. `&` first so we never double-encode
|
|
17
|
+
// the escapes we introduce.
|
|
18
|
+
function escapeHtmlText(value) {
|
|
19
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
20
|
+
}
|
|
21
|
+
// Escape a value destined for a double-quoted attribute: text escaping plus
|
|
22
|
+
// the closing quote.
|
|
23
|
+
function escapeHtmlAttr(value) {
|
|
24
|
+
return escapeHtmlText(value).replace(/"/g, """);
|
|
25
|
+
}
|
|
26
|
+
// key is a framework-owned literal (og:title, twitter:card, …); only content
|
|
27
|
+
// is consumer-supplied, so only content is escaped.
|
|
28
|
+
function metaTag(attr, key, content) {
|
|
29
|
+
return `<meta ${attr}="${key}" content="${escapeHtmlAttr(content)}">`;
|
|
30
|
+
}
|
|
31
|
+
// Render a Head into the concatenated head-tag markup (no wrapping <head>).
|
|
32
|
+
// Order is stable and deterministic so prerendered bytes are reproducible.
|
|
33
|
+
export function renderHead(head) {
|
|
34
|
+
const tags = [];
|
|
35
|
+
if (head.title !== undefined)
|
|
36
|
+
tags.push(`<title>${escapeHtmlText(head.title)}</title>`);
|
|
37
|
+
if (head.description !== undefined)
|
|
38
|
+
tags.push(metaTag("name", "description", head.description));
|
|
39
|
+
if (head.canonical !== undefined) {
|
|
40
|
+
tags.push(`<link rel="canonical" href="${escapeHtmlAttr(head.canonical)}">`);
|
|
41
|
+
}
|
|
42
|
+
if (head.noindex)
|
|
43
|
+
tags.push(`<meta name="robots" content="noindex">`);
|
|
44
|
+
const og = head.og;
|
|
45
|
+
if (og) {
|
|
46
|
+
if (og.title !== undefined)
|
|
47
|
+
tags.push(metaTag("property", "og:title", og.title));
|
|
48
|
+
if (og.description !== undefined) {
|
|
49
|
+
tags.push(metaTag("property", "og:description", og.description));
|
|
50
|
+
}
|
|
51
|
+
if (og.type !== undefined)
|
|
52
|
+
tags.push(metaTag("property", "og:type", og.type));
|
|
53
|
+
if (og.url !== undefined)
|
|
54
|
+
tags.push(metaTag("property", "og:url", og.url));
|
|
55
|
+
if (og.image !== undefined)
|
|
56
|
+
tags.push(metaTag("property", "og:image", og.image));
|
|
57
|
+
if (og.siteName !== undefined)
|
|
58
|
+
tags.push(metaTag("property", "og:site_name", og.siteName));
|
|
59
|
+
}
|
|
60
|
+
const tw = head.twitter;
|
|
61
|
+
if (tw) {
|
|
62
|
+
if (tw.card !== undefined)
|
|
63
|
+
tags.push(metaTag("name", "twitter:card", tw.card));
|
|
64
|
+
if (tw.title !== undefined)
|
|
65
|
+
tags.push(metaTag("name", "twitter:title", tw.title));
|
|
66
|
+
if (tw.description !== undefined) {
|
|
67
|
+
tags.push(metaTag("name", "twitter:description", tw.description));
|
|
68
|
+
}
|
|
69
|
+
if (tw.image !== undefined)
|
|
70
|
+
tags.push(metaTag("name", "twitter:image", tw.image));
|
|
71
|
+
if (tw.site !== undefined)
|
|
72
|
+
tags.push(metaTag("name", "twitter:site", tw.site));
|
|
73
|
+
if (tw.creator !== undefined)
|
|
74
|
+
tags.push(metaTag("name", "twitter:creator", tw.creator));
|
|
75
|
+
}
|
|
76
|
+
for (const link of head.links ?? []) {
|
|
77
|
+
tags.push(`<link rel="${escapeHtmlAttr(link.rel)}" href="${escapeHtmlAttr(link.href)}">`);
|
|
78
|
+
}
|
|
79
|
+
return tags.join("");
|
|
80
|
+
}
|
|
81
|
+
// Weave a Head into a rendered document: inject the head markup immediately
|
|
82
|
+
// before the last </head> (case-insensitive). A document without one gets the
|
|
83
|
+
// markup prepended. A head that renders to nothing leaves the html untouched.
|
|
84
|
+
export function weaveHead(html, head) {
|
|
85
|
+
const markup = renderHead(head);
|
|
86
|
+
if (markup === "")
|
|
87
|
+
return html;
|
|
88
|
+
const idx = html.toLowerCase().lastIndexOf("</head>");
|
|
89
|
+
if (idx === -1)
|
|
90
|
+
return markup + html;
|
|
91
|
+
return html.slice(0, idx) + markup + html.slice(idx);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=head.js.map
|
package/dist/head.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head.js","sourceRoot":"","sources":["../src/head.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,EAAE;AACF,mEAAmE;AACnE,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,mEAAmE;AACnE,8EAA8E;AAC9E,2EAA2E;AA6C3E,wEAAwE;AACxE,+EAA+E;AAC/E,4BAA4B;AAC5B,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,E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,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/health.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** One named readiness condition. `check` should be fast and side-effect free —
|
|
2
|
+
* probes run on the kubelet's schedule, per replica. */
|
|
3
|
+
export type ReadyCheck = {
|
|
4
|
+
/** Operator-facing name in `?verbose` output. A noun (`db`, `cache`). */
|
|
5
|
+
name: string;
|
|
6
|
+
check: () => boolean | Promise<boolean>;
|
|
7
|
+
};
|
|
8
|
+
/** Build the Fetch handler for a `mode:"ssr"` `/readyz` route.
|
|
9
|
+
*
|
|
10
|
+
* Every check runs, even after one fails: reporting only the first failure
|
|
11
|
+
* hides a second broken subsystem behind the first. A check that throws counts
|
|
12
|
+
* as failed — an exception is not an assertion of readiness. */
|
|
13
|
+
export declare function defineReadyz(checks: readonly ReadyCheck[]): (req: Request) => Promise<Response>;
|
|
14
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAsCA;yDACyD;AACzD,MAAM,MAAM,UAAU,GAAG;IACvB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF;;;;iEAIiE;AACjE,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,GAC5B,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAkCrC"}
|
package/dist/health.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// `defineReadyz` — the TSX half of mesofact's `/readyz` probe.
|
|
2
|
+
//
|
|
3
|
+
// mesofact serves `/livez` and `/readyz` itself, in Rust
|
|
4
|
+
// (`crates/mesofact/src/health.rs`), gated on the things only the engine can
|
|
5
|
+
// know: is the SSR isolate up, is there a tree to serve, are we draining. An
|
|
6
|
+
// app opts into contributing its own readiness by declaring the path as an
|
|
7
|
+
// ordinary SSR route — there is no config key and no manifest field:
|
|
8
|
+
//
|
|
9
|
+
// // mesofact.routes.ts
|
|
10
|
+
// { route: "/readyz", mode: "ssr", entrypoint: "src/readyz.ts", cache_policy: { ttl: 0 } }
|
|
11
|
+
//
|
|
12
|
+
// The Rust handler notices the app claimed the path, dispatches to it while
|
|
13
|
+
// answering the probe, and folds the response status into its own listing as a
|
|
14
|
+
// check named `app`. Anything outside 2xx takes the pod out of rotation.
|
|
15
|
+
//
|
|
16
|
+
// # The contract, and its one asymmetry
|
|
17
|
+
//
|
|
18
|
+
// An app verdict is **additive**: it can only make the process less ready. A
|
|
19
|
+
// 200 from here cannot un-drain a terminating process or overrule a dead
|
|
20
|
+
// isolate, because those are exactly the states in which app code is the
|
|
21
|
+
// unreliable narrator. Design your checks accordingly — this is the place to
|
|
22
|
+
// say "my database pool is exhausted", not "ignore the engine, I'm fine".
|
|
23
|
+
//
|
|
24
|
+
// # Vanilla, or this helper
|
|
25
|
+
//
|
|
26
|
+
// The route is a plain Fetch handler, so vanilla works and owes nothing to this
|
|
27
|
+
// module:
|
|
28
|
+
//
|
|
29
|
+
// export default async () =>
|
|
30
|
+
// (await db.ping()) ? new Response("ok") : new Response("db", { status: 503 });
|
|
31
|
+
//
|
|
32
|
+
// `defineReadyz` is the opt-in ergonomic layer: it runs named checks and emits
|
|
33
|
+
// the *same* wire format the Rust side emits — the kube-apiserver `[+]name ok`
|
|
34
|
+
// listing under `?verbose`. Matching formats is the point. An operator running
|
|
35
|
+
// `curl localhost:3000/readyz?verbose` should not be able to tell which
|
|
36
|
+
// language answered, and when the Rust side aggregates, the two listings nest
|
|
37
|
+
// instead of clashing.
|
|
38
|
+
/** Build the Fetch handler for a `mode:"ssr"` `/readyz` route.
|
|
39
|
+
*
|
|
40
|
+
* Every check runs, even after one fails: reporting only the first failure
|
|
41
|
+
* hides a second broken subsystem behind the first. A check that throws counts
|
|
42
|
+
* as failed — an exception is not an assertion of readiness. */
|
|
43
|
+
export function defineReadyz(checks) {
|
|
44
|
+
return async (req) => {
|
|
45
|
+
const results = await Promise.all(checks.map(async (c) => {
|
|
46
|
+
try {
|
|
47
|
+
return { name: c.name, pass: (await c.check()) === true };
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return { name: c.name, pass: false };
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
const ok = results.every((r) => r.pass);
|
|
54
|
+
const status = ok ? 200 : 503;
|
|
55
|
+
const headers = {
|
|
56
|
+
"content-type": "text/plain; charset=utf-8",
|
|
57
|
+
// A cached 200 outlives the condition it described, which is the exact
|
|
58
|
+
// failure the probe exists to catch.
|
|
59
|
+
"cache-control": "no-cache, no-store, must-revalidate",
|
|
60
|
+
};
|
|
61
|
+
if (!isVerbose(req)) {
|
|
62
|
+
return new Response(ok ? "ok\n" : "readyz check failed\n", {
|
|
63
|
+
status,
|
|
64
|
+
headers,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const listing = results
|
|
68
|
+
.map((r) => (r.pass ? `[+]${r.name} ok\n` : `[-]${r.name} failed\n`))
|
|
69
|
+
.join("");
|
|
70
|
+
const trailer = ok ? "readyz check passed\n" : "readyz check failed\n";
|
|
71
|
+
return new Response(listing + trailer, { status, headers });
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** `?verbose` / `?verbose=1`, matching the Rust `is_verbose`. A malformed URL
|
|
75
|
+
* means the non-verbose body, never a crash — a probe that 500s because it
|
|
76
|
+
* could not parse its own URL is worse than one that answers tersely. */
|
|
77
|
+
function isVerbose(req) {
|
|
78
|
+
try {
|
|
79
|
+
return new URL(req.url).searchParams.has("verbose");
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingUR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|
+
* `readyz` is the one hook that predates this declaration site, so it has two
|
|
4
|
+
* ways in (see {@link HOOK_ROUTE_CLAIMS}) and its module's contract is a
|
|
5
|
+
* Fetch handler rather than a plain Mode 2 function. Hooks added from here on
|
|
6
|
+
* are `(input) => verdict`. */
|
|
7
|
+
export declare const HOOK_NAMES: readonly ["readyz"];
|
|
8
|
+
export type HookName = (typeof HOOK_NAMES)[number];
|
|
9
|
+
/** The `hooks` block of `defineRoutes` — hook name → entrypoint path, relative
|
|
10
|
+
* to the project root, bundled to `dist/server/hooks/<name>.js`. */
|
|
11
|
+
export type HooksConfig = {
|
|
12
|
+
readonly [K in HookName]?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Hooks that may *alternatively* be declared by claiming a route, which is
|
|
15
|
+
* how `/readyz` shipped (R756-F5) before hooks existed.
|
|
16
|
+
*
|
|
17
|
+
* Route-claiming still works and is still the shortest path for an app that
|
|
18
|
+
* wants its readiness handler reachable as an ordinary Fetch handler. The
|
|
19
|
+
* `hooks` declaration is the better one for everything else: the module is
|
|
20
|
+
* not a route, so it never enters `ssr_prefixes`, is never forwarded to the
|
|
21
|
+
* SSR origin by the edge Worker, and is never shadowed by the Rust probe
|
|
22
|
+
* route it would otherwise collide with. Declaring both is rejected — two
|
|
23
|
+
* opt-ins for one verdict is ambiguous, not additive. */
|
|
24
|
+
export declare const HOOK_ROUTE_CLAIMS: {
|
|
25
|
+
readonly [K in HookName]?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function isHookName(name: string): name is HookName;
|
|
28
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAyCA;;;;;gCAKgC;AAChC,eAAO,MAAM,UAAU,qBAAsB,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;qEACqE;AACrE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM;CAAE,CAAC;AAEhE;;;;;;;;;0DAS0D;AAC1D,eAAO,MAAM,iBAAiB,EAAE;IAAE,QAAQ,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM;CAElE,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,QAAQ,CAEzD"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Mode 2 hook declaration — W311 §2 "Open Decision 1", answered by R756-F6.
|
|
2
|
+
//
|
|
3
|
+
// # What a hook is
|
|
4
|
+
//
|
|
5
|
+
// mesofact's TSX override surface has two modes (W311 §2). Mode 1 is the
|
|
6
|
+
// general API: `mode:"ssr"` route, `Request -> Response`, the app owns the
|
|
7
|
+
// wire. Mode 2 is the endpoint callback: a small `input -> verdict`, and
|
|
8
|
+
// **Rust** owns the HTTP. R756-F3 shipped Mode 2's wire verb
|
|
9
|
+
// (`__mesofact_ssr.invoke(bundle, hookName, input)`) but hardcoded its single
|
|
10
|
+
// hook name, because `/readyz` — Mode 2's only consumer — could reuse the
|
|
11
|
+
// route-claim opt-in it already had. A hook that is *not* a path (`onRequest`,
|
|
12
|
+
// `onError`, an auth gate) has no route to claim, so it needs a declaration
|
|
13
|
+
// site. This is that site.
|
|
14
|
+
//
|
|
15
|
+
// # Why a top-level `hooks` key, and not a per-route `middleware` field
|
|
16
|
+
//
|
|
17
|
+
// W311 named two candidates and deliberately picked neither. The `hooks` key
|
|
18
|
+
// wins on the doc's own terms:
|
|
19
|
+
//
|
|
20
|
+
// - A per-route `middleware` field is a *chain*, and "a general TS
|
|
21
|
+
// middleware chain" is an explicit W311 non-goal — it has ordering
|
|
22
|
+
// semantics (what runs before what, who may short-circuit, how errors
|
|
23
|
+
// propagate) that Mode 2 does not have and does not want.
|
|
24
|
+
// - Mode 2's defining property is that Rust owns the HTTP. A hook is
|
|
25
|
+
// therefore engine-addressed — the engine decides when to call `readyz`,
|
|
26
|
+
// not a route table — so the declaration belongs beside `routes`, not
|
|
27
|
+
// inside one.
|
|
28
|
+
// - Hook names are a **closed set** for the same reason: only the engine
|
|
29
|
+
// invokes a hook, so a name the engine does not know is dead code and a
|
|
30
|
+
// silent typo. Adding one is three deliberate edits — a name here, an
|
|
31
|
+
// adapter in `crates/mesofact-ssr/js/ssr_harness.js`, and the Rust call
|
|
32
|
+
// site that decides when it runs — and each is a real contract statement.
|
|
33
|
+
//
|
|
34
|
+
// # Adding a hook
|
|
35
|
+
//
|
|
36
|
+
// Add the name to `HOOK_NAMES`, teach `ssr_harness.js` how to call it (the
|
|
37
|
+
// default is plain Mode 2 — `(input) => verdict`, JSON both ways), and write
|
|
38
|
+
// the Rust call site. `hooks` in the manifest carries name → bundled module;
|
|
39
|
+
// `mesofact::ssr::spawn` registers each one on every isolate in the pool and
|
|
40
|
+
// `SsrChild::invoke_hook(name, input)` calls it.
|
|
41
|
+
/** Every hook name the engine knows how to invoke.
|
|
42
|
+
*
|
|
43
|
+
* `readyz` is the one hook that predates this declaration site, so it has two
|
|
44
|
+
* ways in (see {@link HOOK_ROUTE_CLAIMS}) and its module's contract is a
|
|
45
|
+
* Fetch handler rather than a plain Mode 2 function. Hooks added from here on
|
|
46
|
+
* are `(input) => verdict`. */
|
|
47
|
+
export const HOOK_NAMES = ["readyz"];
|
|
48
|
+
/** Hooks that may *alternatively* be declared by claiming a route, which is
|
|
49
|
+
* how `/readyz` shipped (R756-F5) before hooks existed.
|
|
50
|
+
*
|
|
51
|
+
* Route-claiming still works and is still the shortest path for an app that
|
|
52
|
+
* wants its readiness handler reachable as an ordinary Fetch handler. The
|
|
53
|
+
* `hooks` declaration is the better one for everything else: the module is
|
|
54
|
+
* not a route, so it never enters `ssr_prefixes`, is never forwarded to the
|
|
55
|
+
* SSR origin by the edge Worker, and is never shadowed by the Rust probe
|
|
56
|
+
* route it would otherwise collide with. Declaring both is rejected — two
|
|
57
|
+
* opt-ins for one verdict is ambiguous, not additive. */
|
|
58
|
+
export const HOOK_ROUTE_CLAIMS = {
|
|
59
|
+
readyz: "/readyz",
|
|
60
|
+
};
|
|
61
|
+
export function isHookName(name) {
|
|
62
|
+
return HOOK_NAMES.includes(name);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,6DAA6D;AAC7D,8EAA8E;AAC9E,0EAA0E;AAC1E,+EAA+E;AAC/E,4EAA4E;AAC5E,2BAA2B;AAC3B,EAAE;AACF,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,+BAA+B;AAC/B,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,0EAA0E;AAC1E,8DAA8D;AAC9D,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,kBAAkB;AAClB,2EAA2E;AAC3E,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,EAAE;AACF,kBAAkB;AAClB,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,iDAAiD;AAEjD;;;;;gCAKgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,CAAU,CAAC;AAQ9C;;;;;;;;;0DAS0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAA0C;IACtE,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAQ,UAAgC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const SPA_STATE_SCRIPT_ID: "__MESOFACT_STATE__";
|
|
2
|
+
export declare const SSR_DATA_SCRIPT_ID: "__mesofact_data__";
|
|
3
|
+
export declare function escapeJsonForScriptTag(value: unknown): string;
|
|
4
|
+
export declare function hydrationDataTag(data: unknown): string;
|
|
5
|
+
export declare function hydrationScriptTag(src: string): string;
|
|
6
|
+
//# sourceMappingURL=hydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,EAAG,oBAA6B,CAAC;AAKjE,eAAO,MAAM,kBAAkB,EAAG,mBAA4B,CAAC;AAY/D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiB7D;AAKD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEtD;AAOD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGtD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Hydration handoff — helpers an SSR route's Fetch handler calls to inline
|
|
2
|
+
// server-resolved data into the response body for the client to read on
|
|
3
|
+
// mount. Disposable when RSC streaming lands; until then this is the
|
|
4
|
+
// Universal cell's contract (W173 § "Hydration handoff").
|
|
5
|
+
//
|
|
6
|
+
// API surface is intentionally minimal — two pure functions. The handler
|
|
7
|
+
// composes them into its own HTML response, which means the consumer keeps
|
|
8
|
+
// full control over the document shell. The trade-off is that the consumer
|
|
9
|
+
// has to know its own build_id + hashed client-script name (read from the
|
|
10
|
+
// manifest at boot, or inject via env). Acceptable for the dogfood window;
|
|
11
|
+
// revisit when more consumers exist.
|
|
12
|
+
//
|
|
13
|
+
// Also published standalone as the `@mesofact/runtime/hydration` subpath
|
|
14
|
+
// export (R513-B11): this file must stay free of imports (or only import
|
|
15
|
+
// other import-free, browser-safe modules) so a client bundle can read
|
|
16
|
+
// `SPA_STATE_SCRIPT_ID` without dragging in the `@mesofact/runtime` barrel,
|
|
17
|
+
// which re-exports server-only code (`track-ctx.ts` → `node:async_hooks`,
|
|
18
|
+
// `config.ts` → `node:fs`) that rolldown can't tree-shake past.
|
|
19
|
+
// Build-time SPA shell consumes this id; the prerender weaves it in.
|
|
20
|
+
export const SPA_STATE_SCRIPT_ID = "__MESOFACT_STATE__";
|
|
21
|
+
// Per-request SSR Universal handoff consumes this id; see W173 § "Hydration
|
|
22
|
+
// handoff" — the name is fixed (not configurable) so the client snippet can
|
|
23
|
+
// be copy-pasteable across consumers.
|
|
24
|
+
export const SSR_DATA_SCRIPT_ID = "__mesofact_data__";
|
|
25
|
+
// JSON-encode `value` and escape the characters that could close the parent
|
|
26
|
+
// `<script>` tag early or be reinterpreted by the HTML parser:
|
|
27
|
+
//
|
|
28
|
+
// `<`, `>`, `&` — `</script>`, `<!--`, `<![CDATA[`, `&` injection
|
|
29
|
+
// U+2028 / U+2029 — JS line separators valid in JSON but break inline
|
|
30
|
+
// scripts when not escaped
|
|
31
|
+
//
|
|
32
|
+
// `JSON.parse` decodes the `\uXXXX` escapes transparently, so the client
|
|
33
|
+
// reads back the original value via `JSON.parse(el.textContent)` with no
|
|
34
|
+
// special handling. Non-negotiable per W173 § "XSS escape rule".
|
|
35
|
+
export function escapeJsonForScriptTag(value) {
|
|
36
|
+
return JSON.stringify(value).replace(/[<>&\u2028\u2029]/g, (c) => {
|
|
37
|
+
switch (c) {
|
|
38
|
+
case "<":
|
|
39
|
+
return "\\u003c";
|
|
40
|
+
case ">":
|
|
41
|
+
return "\\u003e";
|
|
42
|
+
case "&":
|
|
43
|
+
return "\\u0026";
|
|
44
|
+
case "\u2028":
|
|
45
|
+
return "\\u2028";
|
|
46
|
+
case "\u2029":
|
|
47
|
+
return "\\u2029";
|
|
48
|
+
default:
|
|
49
|
+
return c;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Serialize `data` into the data-handoff `<script>` tag an SSR route's
|
|
54
|
+
// Fetch handler inlines into its response body. Read back on the client via
|
|
55
|
+
// `JSON.parse(document.getElementById("__mesofact_data__").textContent)`.
|
|
56
|
+
export function hydrationDataTag(data) {
|
|
57
|
+
return `<script id="${SSR_DATA_SCRIPT_ID}" type="application/json">${escapeJsonForScriptTag(data)}</script>`;
|
|
58
|
+
}
|
|
59
|
+
// Build the module-script tag that loads the route's hydrate bundle. `src`
|
|
60
|
+
// is escaped against `"`, `<`, and `&` so a manifest-derived URL containing
|
|
61
|
+
// a stray quote can't break the attribute or the tag boundary; belt-and-
|
|
62
|
+
// braces — the manifest paths the build emits don't contain quotes, but
|
|
63
|
+
// consumers may compose paths from request data.
|
|
64
|
+
export function hydrationScriptTag(src) {
|
|
65
|
+
const safeSrc = src.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
66
|
+
return `<script type="module" src="${safeSrc}"></script>`;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=hydration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,qEAAqE;AACrE,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,qCAAqC;AACrC,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,uEAAuE;AACvE,4EAA4E;AAC5E,0EAA0E;AAC1E,gEAAgE;AAEhE,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAA6B,CAAC;AAEjE,4EAA4E;AAC5E,4EAA4E;AAC5E,sCAAsC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAA4B,CAAC;AAE/D,4EAA4E;AAC5E,+DAA+D;AAC/D,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,iEAAiE;AACjE,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE;QAC/D,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,GAAG;gBACN,OAAO,SAAS,CAAC;YACnB,KAAK,GAAG;gBACN,OAAO,SAAS,CAAC;YACnB,KAAK,GAAG;gBACN,OAAO,SAAS,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,SAAS,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,SAAS,CAAC;YACnB;gBACE,OAAO,CAAC,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uEAAuE;AACvE,4EAA4E;AAC5E,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,OAAO,eAAe,kBAAkB,6BAA6B,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC;AAC/G,CAAC;AAED,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,wEAAwE;AACxE,iDAAiD;AACjD,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzF,OAAO,8BAA8B,OAAO,aAAa,CAAC;AAC5D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { Region, User, Project, RenderRequest, CachePolicy, Hydration, RenderResult, RenderFn, } from "./contract.js";
|
|
2
|
+
export type { ListOpts, R2Object, Source, BlobSource, KeyValueSource, } from "./source.js";
|
|
3
|
+
export { BaseSource } from "./source.js";
|
|
4
|
+
export { SourceError, SourceUnavailableError, SourceTimeoutError, SourceQueryError, RowNotFoundError, } from "./errors.js";
|
|
5
|
+
export type { RouteMode, Placement, Requires, CachePolicyConfig, PrerenderConfig, RouteEntry, ErrorRoutes, RoutesConfig, RetryOn, RetryPolicy, QueuePolicy, ResiliencePolicy, } from "./routes.js";
|
|
6
|
+
export { defineRoutes, DEFAULT_RESILIENCE_TIMEOUT_MS } from "./routes.js";
|
|
7
|
+
export type { HookName, HooksConfig } from "./hooks.js";
|
|
8
|
+
export { HOOK_NAMES, HOOK_ROUTE_CLAIMS, isHookName } from "./hooks.js";
|
|
9
|
+
export type { ManifestVersion, ManifestCachePolicy, ManifestHydration, ManifestPrerender, ManifestRoute, ManifestStaticAsset, ManifestErrorRoutes, ManifestHook, ManifestHooks, Manifest, ResolvedPlacement, } from "./manifest.js";
|
|
10
|
+
export { MANIFEST_VERSION } from "./manifest.js";
|
|
11
|
+
export type { SourceScope, SourceCatalog, ValidationError, ValidationErrorKind, ValidationResult, } from "./validate.js";
|
|
12
|
+
export { validate } from "./validate.js";
|
|
13
|
+
export { runInTrackCtx, currentTrackCtx } from "./track-ctx.js";
|
|
14
|
+
export type { TrackCtx } from "./track-ctx.js";
|
|
15
|
+
export { SPA_STATE_SCRIPT_ID, SSR_DATA_SCRIPT_ID, escapeJsonForScriptTag, hydrationDataTag, hydrationScriptTag, } from "./hydration.js";
|
|
16
|
+
export type { OpenGraph, TwitterCard, HeadLink, Head } from "./head.js";
|
|
17
|
+
export { renderHead, weaveHead } from "./head.js";
|
|
18
|
+
export { defineReadyz } from "./health.js";
|
|
19
|
+
export type { ReadyCheck } from "./health.js";
|
|
20
|
+
export { R2Adapter, r2, registerR2, clearR2Registry } from "./adapters/r2.js";
|
|
21
|
+
export type { R2Config } from "./adapters/r2.js";
|
|
22
|
+
export { SqliteAdapter, sqlite, registerSqlite, clearSqliteRegistry } from "./adapters/sqlite.js";
|
|
23
|
+
export type { SqliteConfig, SqliteRunner } from "./adapters/sqlite.js";
|
|
24
|
+
export { loadConfig, parseConfig, registerSourcesFromConfig, ConfigError, } from "./config.js";
|
|
25
|
+
export type { BuildConfig, MesofactConfig, R2SourceConfig, SqliteSourceConfig, SourceConfig, } from "./config.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,MAAM,EACN,IAAI,EACJ,OAAO,EACP,aAAa,EACb,WAAW,EACX,SAAS,EACT,YAAY,EACZ,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE1E,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvE,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,QAAQ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|
+
// @mesofact/runtime — render contract types and adapter API.
|
|
2
|
+
// See `.yah/docs/architecture/mesofact.md`.
|
|
3
|
+
export { BaseSource } from "./source.js";
|
|
4
|
+
export { SourceError, SourceUnavailableError, SourceTimeoutError, SourceQueryError, RowNotFoundError, } from "./errors.js";
|
|
5
|
+
export { defineRoutes, DEFAULT_RESILIENCE_TIMEOUT_MS } from "./routes.js";
|
|
6
|
+
export { HOOK_NAMES, HOOK_ROUTE_CLAIMS, isHookName } from "./hooks.js";
|
|
7
|
+
export { MANIFEST_VERSION } from "./manifest.js";
|
|
8
|
+
export { validate } from "./validate.js";
|
|
9
|
+
export { runInTrackCtx, currentTrackCtx } from "./track-ctx.js";
|
|
10
|
+
export { SPA_STATE_SCRIPT_ID, SSR_DATA_SCRIPT_ID, escapeJsonForScriptTag, hydrationDataTag, hydrationScriptTag, } from "./hydration.js";
|
|
11
|
+
export { renderHead, weaveHead } from "./head.js";
|
|
12
|
+
export { defineReadyz } from "./health.js";
|
|
13
|
+
export { R2Adapter, r2, registerR2, clearR2Registry } from "./adapters/r2.js";
|
|
14
|
+
export { SqliteAdapter, sqlite, registerSqlite, clearSqliteRegistry } from "./adapters/sqlite.js";
|
|
15
|
+
export { loadConfig, parseConfig, registerSourcesFromConfig, ConfigError, } from "./config.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,4CAA4C;AAoB5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAiBrB,OAAO,EAAE,YAAY,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAgBvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAUjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGlG,OAAO,EACL,UAAU,EACV,WAAW,EACX,yBAAyB,EACzB,WAAW,GACZ,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HookName } from "./hooks.js";
|
|
2
|
+
import type { Placement, ResiliencePolicy, RouteMode, Requires } from "./routes.js";
|
|
3
|
+
export type ResolvedPlacement = Exclude<Placement, "auto">;
|
|
4
|
+
export declare const MANIFEST_VERSION: "1";
|
|
5
|
+
export type ManifestVersion = typeof MANIFEST_VERSION;
|
|
6
|
+
export type ManifestCachePolicy = {
|
|
7
|
+
ttl: number;
|
|
8
|
+
swr?: number;
|
|
9
|
+
negative_ttl?: number;
|
|
10
|
+
vary?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type ManifestHydration = {
|
|
13
|
+
script: string;
|
|
14
|
+
code_split: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export type ManifestPrerender = {
|
|
17
|
+
params: ReadonlyArray<Record<string, string>>;
|
|
18
|
+
} | {
|
|
19
|
+
from: string;
|
|
20
|
+
query: string;
|
|
21
|
+
param: string;
|
|
22
|
+
} | {
|
|
23
|
+
from_data: string;
|
|
24
|
+
items_key: string;
|
|
25
|
+
param: string;
|
|
26
|
+
} | {
|
|
27
|
+
deferred: true;
|
|
28
|
+
};
|
|
29
|
+
export type ManifestRoute = {
|
|
30
|
+
route: string;
|
|
31
|
+
mode: RouteMode;
|
|
32
|
+
render_entrypoint: string;
|
|
33
|
+
requires?: readonly Requires[];
|
|
34
|
+
source_reads?: readonly string[];
|
|
35
|
+
data_inputs?: readonly string[];
|
|
36
|
+
cache_policy: ManifestCachePolicy;
|
|
37
|
+
concurrency?: number;
|
|
38
|
+
hydration?: ManifestHydration;
|
|
39
|
+
prerender?: ManifestPrerender;
|
|
40
|
+
placement?: ResolvedPlacement;
|
|
41
|
+
resilience?: ResiliencePolicy;
|
|
42
|
+
};
|
|
43
|
+
export type ManifestStaticAsset = {
|
|
44
|
+
key: string;
|
|
45
|
+
content_hash: string;
|
|
46
|
+
content_type: string;
|
|
47
|
+
immutable: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type ManifestErrorRoutes = {
|
|
50
|
+
"404"?: string;
|
|
51
|
+
"5xx"?: string;
|
|
52
|
+
};
|
|
53
|
+
export type ManifestHook = {
|
|
54
|
+
entrypoint: string;
|
|
55
|
+
};
|
|
56
|
+
export type ManifestHooks = {
|
|
57
|
+
readonly [K in HookName]?: ManifestHook;
|
|
58
|
+
};
|
|
59
|
+
export type Manifest = {
|
|
60
|
+
version: ManifestVersion;
|
|
61
|
+
build_id: string;
|
|
62
|
+
routes: readonly ManifestRoute[];
|
|
63
|
+
static_assets: readonly ManifestStaticAsset[];
|
|
64
|
+
error_routes?: ManifestErrorRoutes;
|
|
65
|
+
hooks?: ManifestHooks;
|
|
66
|
+
ssr_prefixes?: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.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AC/B,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAIjC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,YAAY,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAE9B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAK9B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,MAAM,MAAM,YAAY,GAAG;IAGzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,YAAY;CAAE,CAAC;AAExE,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,aAAa,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAInC,KAAK,CAAC,EAAE,aAAa,CAAC;IAKtB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Manifest types — the single document the build emits and the proxy boots
|
|
2
|
+
// from. Authored shape lives in `routes.ts` (RoutesConfig); the build enriches
|
|
3
|
+
// it with `build_id`, `static_assets`, hydration, and resolved entrypoint
|
|
4
|
+
// paths.
|
|
5
|
+
//
|
|
6
|
+
// Versioned independently of the mesofact binary; major bumps force restart.
|
|
7
|
+
// See `.yah/docs/architecture/mesofact.md` §"Manifest schema".
|
|
8
|
+
export const MANIFEST_VERSION = "1";
|
|
9
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,SAAS;AACT,EAAE;AACF,6EAA6E;AAC7E,+DAA+D;AAU/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,CAAC"}
|