@substrat-run/control-plane-api 0.141.0 → 0.142.0
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/dist/api.d.ts.map +1 -1
- package/dist/api.js +18 -0
- package/dist/api.js.map +1 -1
- package/dist/cf-observability.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/platform-entry.d.ts +4 -4
- package/dist/platform-entry.generated.d.ts +1 -1
- package/dist/platform-entry.generated.d.ts.map +1 -1
- package/dist/platform-entry.generated.js +3 -3
- package/dist/platform-entry.generated.js.map +1 -1
- package/dist/platform-entry.js +6 -6
- package/dist/platform-entry.js.map +1 -1
- package/dist/provider-error.d.ts +34 -5
- package/dist/provider-error.d.ts.map +1 -1
- package/dist/provider-error.js +60 -5
- package/dist/provider-error.js.map +1 -1
- package/dist/scope-copy-backfill.d.ts +106 -0
- package/dist/scope-copy-backfill.d.ts.map +1 -0
- package/dist/scope-copy-backfill.js +418 -0
- package/dist/scope-copy-backfill.js.map +1 -0
- package/dist/scope-copy-cleanup.d.ts +10 -0
- package/dist/scope-copy-cleanup.d.ts.map +1 -1
- package/dist/scope-copy-cleanup.js +12 -6
- package/dist/scope-copy-cleanup.js.map +1 -1
- package/dist/vertical-client.d.ts.map +1 -1
- package/dist/vertical-client.js +9 -5
- package/dist/vertical-client.js.map +1 -1
- package/package.json +6 -6
package/dist/cf-observability.js
CHANGED
|
@@ -1178,8 +1178,8 @@ export function createCfObservabilityReader(opts) {
|
|
|
1178
1178
|
*
|
|
1179
1179
|
* ## The connector-call dataset's published ordinals
|
|
1180
1180
|
*
|
|
1181
|
-
* Written by
|
|
1182
|
-
* (`packages/
|
|
1181
|
+
* Written by adapter-cloudflare's `connectorCallDataPoint` from `CONNECTOR_CALL_DATA_POINT_LAYOUT`
|
|
1182
|
+
* (`packages/adapter-cloudflare/src/connector-calls.ts`), through the control plane's
|
|
1183
1183
|
* `CONNECTOR_ANALYTICS` binding — its OWN dataset, never the router's, because the two
|
|
1184
1184
|
* shapes' ordinals mean different things. Each position carries an OpenTelemetry
|
|
1185
1185
|
* semantic-convention name (checked against `@opentelemetry/semantic-conventions` 1.43.0,
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type { PlatformActorAuth, StaffIdentity, StaffSessionReader, StaffActorRe
|
|
|
13
13
|
export * from './browser.js';
|
|
14
14
|
export { VerticalClient, AUDITED_CALL_DEADLINE_MS } from './vertical-client.js';
|
|
15
15
|
export { assertNoUnreachableScopeCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
16
|
+
export { BIRTH_WINDOW_MS, backfillScopeScriptCopies, type CopyBackfillPage, } from './scope-copy-backfill.js';
|
|
16
17
|
export { versionReachedAt } from './scope-deployment.js';
|
|
17
18
|
export { hostedCrossVerticalReach } from './cross-vertical.js';
|
|
18
19
|
export { retireAllPreviewClients, retireClientsOfReapedScope, tenantIssuers, wirePreviewAuth } from './preview-auth.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,2BAA2B,EAA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ACX,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B,EAI5B,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAM3F,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACnG,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { mintTenantToken, verifyTenantToken, tenantTokenAuth } from './tenant-to
|
|
|
11
11
|
export * from './browser.js';
|
|
12
12
|
export { VerticalClient, AUDITED_CALL_DEADLINE_MS } from './vertical-client.js';
|
|
13
13
|
export { assertNoUnreachableScopeCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
14
|
+
export { BIRTH_WINDOW_MS, backfillScopeScriptCopies, } from './scope-copy-backfill.js';
|
|
14
15
|
export { versionReachedAt } from './scope-deployment.js';
|
|
15
16
|
// #1705 PR 2: the cross-vertical phase's reach for a control plane whose scopes live elsewhere.
|
|
16
17
|
export { hostedCrossVerticalReach } from './cross-vertical.js';
|
|
@@ -21,7 +22,7 @@ export { drainScopePlatformRequests, MAX_PLATFORM_REQUEST_ATTEMPTS, provisionSib
|
|
|
21
22
|
export { reconcilePayloadFor, reconcileThenReassert, reviewedEntityGrants, switchCarryFor } from './reconcile.js';
|
|
22
23
|
export { attributeFailure, terminalFailureNote } from './failure-attribution.js';
|
|
23
24
|
export { sendEmailHandler, sendFailureStatus, retryAfterSecondsOf, MAX_EMAIL_SEND_ATTEMPTS, EMAIL_RETRY_BASE_MS, EMAIL_RETRY_MAX_MS, } from './email-intent.js';
|
|
24
|
-
// #1978:
|
|
25
|
+
// #1978: moved here from the kernel — the drain is its only reader.
|
|
25
26
|
export { isTerminalDispatchFailure, isTerminalProviderError, providerErrorStatus, RETRYABLE_CLIENT_STATUSES, } from './provider-error.js';
|
|
26
27
|
export { assertSandboxContract, deployManifest, deploymentRefFor, stableDeploymentRefFor, nextMigrationTag, DeployUploadError, upstreamStatusOf, } from './deploy.js';
|
|
27
28
|
export { createWfpUploader, createWfpModulesFetcher, createWfpBindingsPatcher } from './wfp.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEjH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sB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uFAAuF;AACvF,yFAAyF;AACzF,uFAAuF;AACvF,yFAAyF;AACzF,+EAA+E;AAC/E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG3E,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/platform-entry.d.ts
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* neither made it impossible, and a vertical that forgot served an empty Logs view that
|
|
8
8
|
* read as "no traffic". So the platform no longer asks: at upload it puts its own entry
|
|
9
9
|
* module in front of the bundle's, and that module wraps the vertical's default export
|
|
10
|
-
* with
|
|
10
|
+
* with vertical-host's `withInvocationLog`.
|
|
11
11
|
*
|
|
12
12
|
* Three facts about bundles decide the shape:
|
|
13
13
|
*
|
|
14
|
-
* - **A bundle that mounts the middleware too is fine.** A current
|
|
14
|
+
* - **A bundle that mounts the middleware too is fine.** A current middleware
|
|
15
15
|
* finds the platform's stamp on the request and steps aside, so the request is logged
|
|
16
16
|
* once, and the operation route still writes its record onto the one line.
|
|
17
|
-
* - **An older
|
|
17
|
+
* - **An older one does not know to step aside**, so wrapping it would log every request
|
|
18
18
|
* twice. A bundle that writes the line itself (it carries the line's marker) but not the
|
|
19
19
|
* shared stamp registry is uploaded as it is: it already logs, and re-pushing on a
|
|
20
|
-
* current
|
|
20
|
+
* current vertical-host is what moves it over.
|
|
21
21
|
* - **The archive script is the bundle store** that promote and backout re-upload from, so
|
|
22
22
|
* a re-served bundle already holds a platform entry. It is replaced with the current
|
|
23
23
|
* one, never stacked: the manifest's `entry` is always the vertical's own module.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export declare const PLATFORM_ENTRY_MODULE = "substrat-platform-entry.js";
|
|
8
8
|
/** The import specifier the uploader replaces with `./<the bundle's entry>`. */
|
|
9
9
|
export declare const PLATFORM_ENTRY_PLACEHOLDER = "__SUBSTRAT_VERTICAL_ENTRY__";
|
|
10
|
-
/** The entry itself —
|
|
10
|
+
/** The entry itself — 10202 bytes of ESM. */
|
|
11
11
|
export declare const PLATFORM_ENTRY_SOURCE: string;
|
|
12
12
|
/**
|
|
13
13
|
* The scope sweeper the platform supplies (#1902) — uploaded beside the entry, which
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-entry.generated.d.ts","sourceRoot":"","sources":["../src/platform-entry.generated.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,gCAAgC,CAAC;AAExE,6CAA6C;AAC7C,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"platform-entry.generated.d.ts","sourceRoot":"","sources":["../src/platform-entry.generated.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,gCAAgC,CAAC;AAExE,6CAA6C;AAC7C,eAAO,MAAM,qBAAqB,EAAE,MAAo4U,CAAC;AAEz6U;;;GAGG;AACH,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAEtE,8CAA8C;AAC9C,eAAO,MAAM,uBAAuB,EAAE,MAAuxT,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by tools/platform-entry-emit.mts from packages/
|
|
1
|
+
// GENERATED by tools/platform-entry-emit.mts from packages/vertical-host/src/invocation-log.ts and packages/adapter-cloudflare/src/scope-sweeper-do.ts — do not edit by hand.
|
|
2
2
|
// Re-emit with `pnpm lint:platform-entry`; CI runs it with `--check`.
|
|
3
3
|
/**
|
|
4
4
|
* The platform's entry module (#1893): uploaded in front of a vertical's bundle and made its
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
export const PLATFORM_ENTRY_MODULE = 'substrat-platform-entry.js';
|
|
10
10
|
/** The import specifier the uploader replaces with `./<the bundle's entry>`. */
|
|
11
11
|
export const PLATFORM_ENTRY_PLACEHOLDER = '__SUBSTRAT_VERTICAL_ENTRY__';
|
|
12
|
-
/** The entry itself —
|
|
13
|
-
export const PLATFORM_ENTRY_SOURCE = "// packages/contracts/dist/invocation-record.js\nvar INVOCATION_RECORD_HEADER = \"x-substrat-invocation-record\";\nvar INVOCATION_RECORD_FIELD_MAX = 128;\nvar FIELDS = [\"operation\", \"problemCode\", \"principalKind\"];\nfunction encodeInvocationRecord(record) {\n const params = new URLSearchParams();\n for (const key of FIELDS) {\n const v = record[key];\n if (typeof v === \"string\" && v !== \"\")\n params.set(key, v.slice(0, INVOCATION_RECORD_FIELD_MAX));\n }\n const value = params.toString();\n return value === \"\" ? null : value;\n}\nvar FIELD_COVERAGE_HEADER = \"x-substrat-field-coverage\";\nfunction invocationLevelOf(status, threw, problemCode) {\n if (threw || status === null || status >= 500)\n return \"error\";\n if (status >= 400)\n return \"warn\";\n if (problemCode)\n return \"warn\";\n return \"info\";\n}\n\n// packages/kernel/src/ulid.ts\nvar B32 = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nvar MAX_ULID_TIME = 2 ** 48 - 1;\nvar ULID_SHAPE = /^[0-9A-HJKMNP-TV-Z]{26}$/;\nvar unencodable = (t) => `not an encodable ULID instant: ${t} (want 0..${MAX_ULID_TIME})`;\nfunction encodeTime(time) {\n let ts = \"\";\n let t = time;\n for (let i = 0; i < 10; i++) {\n ts = B32[t % 32] + ts;\n t = Math.floor(t / 32);\n }\n return ts;\n}\nfunction createUlid() {\n let lastTime = -1;\n const lastRand = new Array(16).fill(0);\n function freshRandom() {\n const bytes = crypto.getRandomValues(new Uint8Array(16));\n for (let i = 0; i < 16; i++) lastRand[i] = bytes[i] % 32;\n }\n function incrementRandom() {\n for (let i = 15; i >= 0; i--) {\n if (lastRand[i] < 31) {\n lastRand[i]++;\n return true;\n }\n lastRand[i] = 0;\n }\n return false;\n }\n const mint = ((now = Date.now()) => {\n if (!Number.isSafeInteger(now)) throw new RangeError(unencodable(now));\n let time = now;\n if (time <= lastTime) {\n time = lastTime;\n if (!incrementRandom()) {\n time = lastTime + 1;\n freshRandom();\n }\n } else {\n freshRandom();\n }\n if (time < 0 || time > MAX_ULID_TIME) throw new RangeError(unencodable(time));\n lastTime = time;\n let r = \"\";\n for (const d of lastRand) r += B32[d];\n return encodeTime(time) + r;\n });\n mint.seedFrom = (id) => {\n const time = ulidTime(id);\n if (time < lastTime) return;\n const rand = [];\n for (const ch of id.slice(10)) rand.push(B32.indexOf(ch));\n if (time === lastTime) {\n let ahead = false;\n for (let i = 0; i < 16; i++) {\n if (rand[i] !== lastRand[i]) {\n ahead = rand[i] > lastRand[i];\n break;\n }\n }\n if (!ahead) return;\n }\n lastTime = time;\n for (let i = 0; i < 16; i++) lastRand[i] = rand[i];\n };\n return mint;\n}\nvar processUlid = createUlid();\nfunction ulid(now = Date.now()) {\n return processUlid(now);\n}\nfunction ulidTime(id) {\n if (!ULID_SHAPE.test(id)) throw new Error(`not a ULID: ${id}`);\n let t = 0;\n for (const ch of id.slice(0, 10)) t = t * 32 + B32.indexOf(ch);\n if (t > MAX_ULID_TIME) throw new Error(`not a ULID: ${id}`);\n return t;\n}\n\n// packages/kernel/src/platform-call.ts\nfunction secretMatches(presented, expected) {\n if (!presented || presented.length !== expected.length) return false;\n let diff = 0;\n for (let i = 0; i < expected.length; i++) {\n diff |= presented.charCodeAt(i) ^ expected.charCodeAt(i);\n }\n return diff === 0;\n}\n\n// packages/kernel/src/routed-node.ts\nvar ROUTED_ID = /^[0-9A-HJKMNP-TV-Z]{26}$/;\nvar RouterAssertionError = class extends Error {\n};\nfunction readRoutedNode(headers, options = {}) {\n const rawTenant = headers.get(\"x-substrat-tenant\");\n const rawScope = headers.get(\"x-substrat-scope\");\n if (!rawTenant && !rawScope) return null;\n const { expectedSecret, allowUnsigned = false } = options;\n if (expectedSecret) {\n if (!secretMatches(headers.get(\"x-substrat-router\"), expectedSecret)) {\n throw new RouterAssertionError(\"router assertion is not signed by a known router\");\n }\n } else if (!allowUnsigned) {\n throw new RouterAssertionError(\n \"router assertion cannot be verified: this worker has no ROUTER_SECRET configured\"\n );\n }\n if (!rawTenant || !rawScope) {\n throw new RouterAssertionError(\"router assertion is incomplete\");\n }\n if (!ROUTED_ID.test(rawTenant) || !ROUTED_ID.test(rawScope)) {\n throw new RouterAssertionError(\"router assertion carries a malformed id\");\n }\n return {\n tenantId: rawTenant,\n scopeId: rawScope,\n surface: headers.get(\"x-substrat-surface\") ?? \"app\",\n verticalSlug: headers.get(\"x-substrat-vertical\")\n };\n}\n\n// packages/kernel/src/invocation-log.ts\nfunction invocationLine(f) {\n const emitted = f.emitted;\n return {\n substrat: \"invocation\",\n ...f.kind ? { kind: f.kind } : {},\n tenantId: f.tenantId,\n scopeId: f.scopeId,\n vertical: f.vertical ?? null,\n surface: f.surface ?? null,\n method: f.method ?? null,\n path: f.path ?? null,\n status: f.status ?? null,\n threw: f.threw,\n durationMs: f.durationMs,\n invocationId: f.invocationId,\n level: f.level,\n operation: f.operation ?? null,\n problemCode: f.problemCode ?? null,\n principalKind: f.principalKind ?? null,\n eventCount: emitted ? emitted.total : null,\n eventTypes: emitted ? distinct(emitted.events.map((e) => e.type)) : [],\n entities: emitted && f.withEntities !== false ? distinct(emitted.events.map((e) => e.entity)) : [],\n versionId: f.versionId ?? null,\n ...f.outputFields ? { outputFields: f.outputFields, ...f.fieldCoverageId ? { fieldCoverageId: f.fieldCoverageId } : {} } : {},\n ...f.async ?? {}\n };\n}\nfunction distinct(values) {\n return [...new Set(values)];\n}\nfunction versionIdOf(env) {\n const v = env?.SUBSTRAT_VERSION_ID;\n return typeof v === \"string\" && v.length > 0 ? v : null;\n}\nfunction pathOf(url) {\n try {\n return new URL(url).pathname;\n } catch {\n return \"/\";\n }\n}\nvar STAMPS = /* @__PURE__ */ Symbol.for(\"substrat.invocation-stamp\");\nfunction stamps() {\n const g = globalThis;\n return g[STAMPS] ??= /* @__PURE__ */ new WeakMap();\n}\nfunction invocationStampOf(request) {\n return stamps().get(request);\n}\nfunction beginStamp(request, env, options) {\n const stamp = { invocationId: ulid(), record: {} };\n const fieldCoverageId = armedFieldCoverageId(request.headers, env, options);\n if (fieldCoverageId) stamp.fieldCoverageId = fieldCoverageId;\n stamps().set(request, stamp);\n return stamp;\n}\nfunction armedFieldCoverageId(headers, env, options) {\n let id;\n try {\n id = headers.get(FIELD_COVERAGE_HEADER);\n } catch {\n return void 0;\n }\n if (id === null || !ROUTED_ID.test(id)) return void 0;\n return routedNodeOrNull(headers, env, options) !== null ? id : void 0;\n}\nfunction writeInvocationLine(stamp, done, options) {\n try {\n writeLineOrThrow(stamp, done, options);\n } catch (e) {\n try {\n console.log(JSON.stringify({ substrat: \"invocation-log-fault\", detail: String(e) }));\n } catch {\n }\n }\n}\nfunction writeLineOrThrow(stamp, done, options) {\n const node = routedNodeOrNull(done.request.headers, done.env, options);\n if (!node) return;\n const { record, invocationId } = stamp;\n const line = invocationLine({\n tenantId: node.tenantId,\n scopeId: node.scopeId,\n vertical: node.verticalSlug,\n surface: node.surface,\n method: done.request.method,\n path: pathOf(done.request.url),\n status: done.status,\n threw: done.threw,\n durationMs: Date.now() - done.started,\n invocationId,\n level: invocationLevelOf(done.status, done.threw, record.problemCode),\n operation: record.operation,\n problemCode: record.problemCode,\n principalKind: record.principalKind,\n ...record.emitted ? { emitted: record.emitted } : {},\n versionId: versionIdOf(done.env),\n ...record.outputFields ? { outputFields: record.outputFields } : {},\n ...stamp.fieldCoverageId ? { fieldCoverageId: stamp.fieldCoverageId } : {}\n });\n console.log(JSON.stringify(line));\n}\nvar OTHER_HANDLERS = [\"scheduled\", \"queue\", \"email\", \"tail\", \"trace\", \"alarm\", \"test\"];\nfunction withInvocationLog(worker, options = {}) {\n const inner = worker?.fetch;\n if (typeof inner !== \"function\") return worker;\n const wrapped = {\n async fetch(request, env, ctx) {\n if (invocationStampOf(request)) return inner.call(worker, request, env, ctx);\n const started = Date.now();\n const stamp = beginStamp(request, env, options);\n let status = null;\n let threw = false;\n try {\n const response = await inner.call(worker, request, env, ctx);\n status = response.status;\n handRecordToRouter(response, stamp.record, request, env, options);\n return response;\n } catch (e) {\n threw = true;\n throw e;\n } finally {\n writeInvocationLine(stamp, { request, env, status, threw, started }, options);\n }\n }\n };\n for (const name of OTHER_HANDLERS) {\n const h = worker[name];\n if (typeof h === \"function\") wrapped[name] = h.bind(worker);\n }\n return wrapped;\n}\nfunction handRecordToRouter(response, record, request, env, options) {\n try {\n const value = encodeInvocationRecord(record);\n if (value === null || !routedNodeOrNull(request.headers, env, options)) return;\n response.headers?.set?.(\n INVOCATION_RECORD_HEADER,\n value\n );\n } catch {\n }\n}\nfunction routedNodeOrNull(headers, env, options) {\n try {\n return readRoutedNode(headers, {\n expectedSecret: options.routerSecret?.(env),\n allowUnsigned: options.allowUnsigned?.(env) ?? false\n });\n } catch (e) {\n if (!(e instanceof RouterAssertionError)) console.log(JSON.stringify({ substrat: \"invocation-log-fault\", detail: String(e) }));\n return null;\n }\n}\n\n// substrat-platform-entry.ts\nimport * as vertical from \"__SUBSTRAT_VERTICAL_ENTRY__\";\nexport * from \"__SUBSTRAT_VERTICAL_ENTRY__\";\nvar substrat_platform_entry_default = withInvocationLog(vertical.default, {\n routerSecret: (env) => env.ROUTER_SECRET,\n allowUnsigned: (env) => env.ALLOW_DEV_NODE === \"true\"\n});\nexport {\n substrat_platform_entry_default as default\n};\n";
|
|
12
|
+
/** The entry itself — 10202 bytes of ESM. */
|
|
13
|
+
export const PLATFORM_ENTRY_SOURCE = "// packages/contracts/dist/invocation-record.js\nvar INVOCATION_RECORD_HEADER = \"x-substrat-invocation-record\";\nvar INVOCATION_RECORD_FIELD_MAX = 128;\nvar FIELDS = [\"operation\", \"problemCode\", \"principalKind\"];\nfunction encodeInvocationRecord(record) {\n const params = new URLSearchParams();\n for (const key of FIELDS) {\n const v = record[key];\n if (typeof v === \"string\" && v !== \"\")\n params.set(key, v.slice(0, INVOCATION_RECORD_FIELD_MAX));\n }\n const value = params.toString();\n return value === \"\" ? null : value;\n}\nvar FIELD_COVERAGE_HEADER = \"x-substrat-field-coverage\";\nfunction invocationLevelOf(status, threw, problemCode) {\n if (threw || status === null || status >= 500)\n return \"error\";\n if (status >= 400)\n return \"warn\";\n if (problemCode)\n return \"warn\";\n return \"info\";\n}\n\n// packages/kernel/dist/invocation-line.js\nfunction invocationLine(f) {\n const emitted = f.emitted;\n return {\n substrat: \"invocation\",\n ...f.kind ? { kind: f.kind } : {},\n tenantId: f.tenantId,\n scopeId: f.scopeId,\n vertical: f.vertical ?? null,\n surface: f.surface ?? null,\n method: f.method ?? null,\n path: f.path ?? null,\n status: f.status ?? null,\n threw: f.threw,\n durationMs: f.durationMs,\n invocationId: f.invocationId,\n level: f.level,\n operation: f.operation ?? null,\n problemCode: f.problemCode ?? null,\n principalKind: f.principalKind ?? null,\n eventCount: emitted ? emitted.total : null,\n eventTypes: emitted ? distinct(emitted.events.map((e) => e.type)) : [],\n entities: emitted && f.withEntities !== false ? distinct(emitted.events.map((e) => e.entity)) : [],\n versionId: f.versionId ?? null,\n ...f.outputFields ? { outputFields: f.outputFields, ...f.fieldCoverageId ? { fieldCoverageId: f.fieldCoverageId } : {} } : {},\n ...f.async ?? {}\n };\n}\nfunction distinct(values) {\n return [...new Set(values)];\n}\n\n// packages/kernel/dist/ulid.js\nvar B32 = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nvar MAX_ULID_TIME = 2 ** 48 - 1;\nvar ULID_SHAPE = /^[0-9A-HJKMNP-TV-Z]{26}$/;\nvar unencodable = (t) => `not an encodable ULID instant: ${t} (want 0..${MAX_ULID_TIME})`;\nfunction encodeTime(time) {\n let ts = \"\";\n let t = time;\n for (let i = 0; i < 10; i++) {\n ts = B32[t % 32] + ts;\n t = Math.floor(t / 32);\n }\n return ts;\n}\nfunction createUlid() {\n let lastTime = -1;\n const lastRand = new Array(16).fill(0);\n function freshRandom() {\n const bytes = crypto.getRandomValues(new Uint8Array(16));\n for (let i = 0; i < 16; i++)\n lastRand[i] = bytes[i] % 32;\n }\n function incrementRandom() {\n for (let i = 15; i >= 0; i--) {\n if (lastRand[i] < 31) {\n lastRand[i]++;\n return true;\n }\n lastRand[i] = 0;\n }\n return false;\n }\n const mint = ((now = Date.now()) => {\n if (!Number.isSafeInteger(now))\n throw new RangeError(unencodable(now));\n let time = now;\n if (time <= lastTime) {\n time = lastTime;\n if (!incrementRandom()) {\n time = lastTime + 1;\n freshRandom();\n }\n } else {\n freshRandom();\n }\n if (time < 0 || time > MAX_ULID_TIME)\n throw new RangeError(unencodable(time));\n lastTime = time;\n let r = \"\";\n for (const d of lastRand)\n r += B32[d];\n return encodeTime(time) + r;\n });\n mint.seedFrom = (id) => {\n const time = ulidTime(id);\n if (time < lastTime)\n return;\n const rand = [];\n for (const ch of id.slice(10))\n rand.push(B32.indexOf(ch));\n if (time === lastTime) {\n let ahead = false;\n for (let i = 0; i < 16; i++) {\n if (rand[i] !== lastRand[i]) {\n ahead = rand[i] > lastRand[i];\n break;\n }\n }\n if (!ahead)\n return;\n }\n lastTime = time;\n for (let i = 0; i < 16; i++)\n lastRand[i] = rand[i];\n };\n return mint;\n}\nvar processUlid = createUlid();\nfunction ulid(now = Date.now()) {\n return processUlid(now);\n}\nfunction ulidTime(id) {\n if (!ULID_SHAPE.test(id))\n throw new Error(`not a ULID: ${id}`);\n let t = 0;\n for (const ch of id.slice(0, 10))\n t = t * 32 + B32.indexOf(ch);\n if (t > MAX_ULID_TIME)\n throw new Error(`not a ULID: ${id}`);\n return t;\n}\n\n// packages/contracts/dist/wire-auth.js\nfunction secretMatches(presented, expected) {\n const given = presented ?? \"\";\n let diff = given.length ^ expected.length | (given.length === 0 ? 1 : 0);\n for (let i = 0; i < expected.length; i++) {\n diff |= (i < given.length ? given.charCodeAt(i) : 0) ^ expected.charCodeAt(i);\n }\n return diff === 0;\n}\n\n// packages/vertical-host/src/routed-node.ts\nvar ROUTED_ID = /^[0-9A-HJKMNP-TV-Z]{26}$/;\nvar RouterAssertionError = class extends Error {\n};\nfunction readRoutedNode(headers, options = {}) {\n const rawTenant = headers.get(\"x-substrat-tenant\");\n const rawScope = headers.get(\"x-substrat-scope\");\n if (!rawTenant && !rawScope) return null;\n const { expectedSecret, allowUnsigned = false } = options;\n if (expectedSecret) {\n if (!secretMatches(headers.get(\"x-substrat-router\"), expectedSecret)) {\n throw new RouterAssertionError(\"router assertion is not signed by a known router\");\n }\n } else if (!allowUnsigned) {\n throw new RouterAssertionError(\n \"router assertion cannot be verified: this worker has no ROUTER_SECRET configured\"\n );\n }\n if (!rawTenant || !rawScope) {\n throw new RouterAssertionError(\"router assertion is incomplete\");\n }\n if (!ROUTED_ID.test(rawTenant) || !ROUTED_ID.test(rawScope)) {\n throw new RouterAssertionError(\"router assertion carries a malformed id\");\n }\n return {\n tenantId: rawTenant,\n scopeId: rawScope,\n surface: headers.get(\"x-substrat-surface\") ?? \"app\",\n verticalSlug: headers.get(\"x-substrat-vertical\")\n };\n}\n\n// packages/vertical-host/src/invocation-log.ts\nfunction versionIdOf(env) {\n const v = env?.SUBSTRAT_VERSION_ID;\n return typeof v === \"string\" && v.length > 0 ? v : null;\n}\nfunction pathOf(url) {\n try {\n return new URL(url).pathname;\n } catch {\n return \"/\";\n }\n}\nvar STAMPS = /* @__PURE__ */ Symbol.for(\"substrat.invocation-stamp\");\nfunction stamps() {\n const g = globalThis;\n return g[STAMPS] ??= /* @__PURE__ */ new WeakMap();\n}\nfunction invocationStampOf(request) {\n return stamps().get(request);\n}\nfunction beginStamp(request, env, options) {\n const stamp = { invocationId: ulid(), record: {} };\n const fieldCoverageId = armedFieldCoverageId(request.headers, env, options);\n if (fieldCoverageId) stamp.fieldCoverageId = fieldCoverageId;\n stamps().set(request, stamp);\n return stamp;\n}\nfunction armedFieldCoverageId(headers, env, options) {\n let id;\n try {\n id = headers.get(FIELD_COVERAGE_HEADER);\n } catch {\n return void 0;\n }\n if (id === null || !ROUTED_ID.test(id)) return void 0;\n return routedNodeOrNull(headers, env, options) !== null ? id : void 0;\n}\nfunction writeInvocationLine(stamp, done, options) {\n try {\n writeLineOrThrow(stamp, done, options);\n } catch (e) {\n try {\n console.log(JSON.stringify({ substrat: \"invocation-log-fault\", detail: String(e) }));\n } catch {\n }\n }\n}\nfunction writeLineOrThrow(stamp, done, options) {\n const node = routedNodeOrNull(done.request.headers, done.env, options);\n if (!node) return;\n const { record, invocationId } = stamp;\n const line = invocationLine({\n tenantId: node.tenantId,\n scopeId: node.scopeId,\n vertical: node.verticalSlug,\n surface: node.surface,\n method: done.request.method,\n path: pathOf(done.request.url),\n status: done.status,\n threw: done.threw,\n durationMs: Date.now() - done.started,\n invocationId,\n level: invocationLevelOf(done.status, done.threw, record.problemCode),\n operation: record.operation,\n problemCode: record.problemCode,\n principalKind: record.principalKind,\n ...record.emitted ? { emitted: record.emitted } : {},\n versionId: versionIdOf(done.env),\n ...record.outputFields ? { outputFields: record.outputFields } : {},\n ...stamp.fieldCoverageId ? { fieldCoverageId: stamp.fieldCoverageId } : {}\n });\n console.log(JSON.stringify(line));\n}\nvar OTHER_HANDLERS = [\"scheduled\", \"queue\", \"email\", \"tail\", \"trace\", \"alarm\", \"test\"];\nfunction withInvocationLog(worker, options = {}) {\n const inner = worker?.fetch;\n if (typeof inner !== \"function\") return worker;\n const wrapped = {\n async fetch(request, env, ctx) {\n if (invocationStampOf(request)) return inner.call(worker, request, env, ctx);\n const started = Date.now();\n const stamp = beginStamp(request, env, options);\n let status = null;\n let threw = false;\n try {\n const response = await inner.call(worker, request, env, ctx);\n status = response.status;\n handRecordToRouter(response, stamp.record, request, env, options);\n return response;\n } catch (e) {\n threw = true;\n throw e;\n } finally {\n writeInvocationLine(stamp, { request, env, status, threw, started }, options);\n }\n }\n };\n for (const name of OTHER_HANDLERS) {\n const h = worker[name];\n if (typeof h === \"function\") wrapped[name] = h.bind(worker);\n }\n return wrapped;\n}\nfunction handRecordToRouter(response, record, request, env, options) {\n try {\n const value = encodeInvocationRecord(record);\n if (value === null || !routedNodeOrNull(request.headers, env, options)) return;\n response.headers?.set?.(\n INVOCATION_RECORD_HEADER,\n value\n );\n } catch {\n }\n}\nfunction routedNodeOrNull(headers, env, options) {\n try {\n return readRoutedNode(headers, {\n expectedSecret: options.routerSecret?.(env),\n allowUnsigned: options.allowUnsigned?.(env) ?? false\n });\n } catch (e) {\n if (!(e instanceof RouterAssertionError)) console.log(JSON.stringify({ substrat: \"invocation-log-fault\", detail: String(e) }));\n return null;\n }\n}\n\n// substrat-platform-entry.ts\nimport * as vertical from \"__SUBSTRAT_VERTICAL_ENTRY__\";\nexport * from \"__SUBSTRAT_VERTICAL_ENTRY__\";\nvar substrat_platform_entry_default = withInvocationLog(vertical.default, {\n routerSecret: (env) => env.ROUTER_SECRET,\n allowUnsigned: (env) => env.ALLOW_DEV_NODE === \"true\"\n});\nexport {\n substrat_platform_entry_default as default\n};\n";
|
|
14
14
|
/**
|
|
15
15
|
* The scope sweeper the platform supplies (#1902) — uploaded beside the entry, which
|
|
16
16
|
* re-exports its class, when a vertical declares schedules and brings no sweeper of its own.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-entry.generated.js","sourceRoot":"","sources":["../src/platform-entry.generated.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"platform-entry.generated.js","sourceRoot":"","sources":["../src/platform-entry.generated.ts"],"names":[],"mappings":"AAAA,8KAA8K;AAC9K,sEAAsE;AAEtE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAElE,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AAExE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAW,23UAA23U,CAAC;AAEz6U;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAW,8wTAA8wT,CAAC"}
|
package/dist/platform-entry.js
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* neither made it impossible, and a vertical that forgot served an empty Logs view that
|
|
8
8
|
* read as "no traffic". So the platform no longer asks: at upload it puts its own entry
|
|
9
9
|
* module in front of the bundle's, and that module wraps the vertical's default export
|
|
10
|
-
* with
|
|
10
|
+
* with vertical-host's `withInvocationLog`.
|
|
11
11
|
*
|
|
12
12
|
* Three facts about bundles decide the shape:
|
|
13
13
|
*
|
|
14
|
-
* - **A bundle that mounts the middleware too is fine.** A current
|
|
14
|
+
* - **A bundle that mounts the middleware too is fine.** A current middleware
|
|
15
15
|
* finds the platform's stamp on the request and steps aside, so the request is logged
|
|
16
16
|
* once, and the operation route still writes its record onto the one line.
|
|
17
|
-
* - **An older
|
|
17
|
+
* - **An older one does not know to step aside**, so wrapping it would log every request
|
|
18
18
|
* twice. A bundle that writes the line itself (it carries the line's marker) but not the
|
|
19
19
|
* shared stamp registry is uploaded as it is: it already logs, and re-pushing on a
|
|
20
|
-
* current
|
|
20
|
+
* current vertical-host is what moves it over.
|
|
21
21
|
* - **The archive script is the bundle store** that promote and backout re-upload from, so
|
|
22
22
|
* a re-served bundle already holds a platform entry. It is replaced with the current
|
|
23
23
|
* one, never stacked: the manifest's `entry` is always the vertical's own module.
|
|
@@ -35,7 +35,7 @@ export { PLATFORM_ENTRY_MODULE, PLATFORM_SWEEPER_MODULE };
|
|
|
35
35
|
const PLATFORM_MODULES = new Set([PLATFORM_ENTRY_MODULE, PLATFORM_SWEEPER_MODULE]);
|
|
36
36
|
/** The line `invocationLog` writes, as it appears in any build: `substrat:"invocation"`. */
|
|
37
37
|
const WRITES_THE_LINE = /substrat['"]?\s*:\s*["']invocation["']/;
|
|
38
|
-
/** The registry a current
|
|
38
|
+
/** The registry a current middleware shares with the platform's copy. */
|
|
39
39
|
const SHARES_THE_STAMP = 'substrat.invocation-stamp';
|
|
40
40
|
const isScript = (m) => m.contentType.includes('javascript') || /\.(m?js|cjs)$/.test(m.name);
|
|
41
41
|
/**
|
|
@@ -58,7 +58,7 @@ export function platformEntrySkipReason(bundle) {
|
|
|
58
58
|
writes ||= WRITES_THE_LINE.test(text);
|
|
59
59
|
shares ||= text.includes(SHARES_THE_STAMP);
|
|
60
60
|
if (writes && shares)
|
|
61
|
-
break; // a current
|
|
61
|
+
break; // a current middleware: nothing further could change the answer
|
|
62
62
|
}
|
|
63
63
|
if (writes && !shares)
|
|
64
64
|
return 'the bundle writes the invocation line with a kernel that predates the platform stamp';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-entry.js","sourceRoot":"","sources":["../src/platform-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,CAAC;AAE1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC,CAAC;AAEnF,4FAA4F;AAC5F,MAAM,eAAe,GAAG,wCAAwC,CAAC;AACjE,
|
|
1
|
+
{"version":3,"file":"platform-entry.js","sourceRoot":"","sources":["../src/platform-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB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AC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnH,GAAG,GAAG;SACP;QACD,GAAG,CAAC,MAAM;YACR,CAAC,CAAC;gBACE,mFAAmF;gBACnF,0DAA0D;gBAC1D,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,IAAI,CAAC;gBAC1D,QAAQ,EAAE;oBACR,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;oBAC1B,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,wBAAwB,EAAE,UAAU,EAAE,sBAAsB,EAAE;oBACxG,+FAA+F;oBAC/F,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,wBAAwB,EAAwC;iBACzH;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
package/dist/provider-error.d.ts
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 4xx statuses that are nevertheless worth retrying: the provider is refusing this attempt,
|
|
3
|
+
* not the request. Timeouts and locks clear on their own; a rate limit is an instruction to
|
|
4
|
+
* come back later, which is exactly what the next drain pass does.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RETRYABLE_CLIENT_STATUSES: ReadonlySet<number>;
|
|
7
|
+
/**
|
|
8
|
+
* The HTTP status an error carries, if it carries one. Structural on purpose (see above):
|
|
9
|
+
* `ScriveApiError` and any future connector's error type both satisfy it without a shared base
|
|
10
|
+
* class, and an error that carries no status — a network failure, a bug — reads as `undefined`,
|
|
11
|
+
* which is the honest answer and keeps it retryable.
|
|
12
|
+
*/
|
|
13
|
+
export declare function providerErrorStatus(error: unknown): number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Is this delivery over? — the DRAIN's question, and the only one that decides retries.
|
|
16
|
+
*
|
|
17
|
+
* A non-retryable 4xx, whoever raised it: attempt 101 carries the identical bytes past the
|
|
18
|
+
* identical check. Deliberately blind to WHO refused, because terminality does not depend on
|
|
19
|
+
* it — our own `validation_failed` is as final as the provider's 409, and both statuses come
|
|
20
|
+
* from the same structural read (`SubstratError` carries its catalog status; a connector's
|
|
21
|
+
* error carries the provider's).
|
|
22
|
+
*/
|
|
23
|
+
export declare function isTerminalDispatchFailure(error: unknown): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The PROVIDER refused the request — a 4xx that came back over the wire, not one we raised.
|
|
26
|
+
*
|
|
27
|
+
* The exclusion is the whole point (#841). This predicate reads a bare numeric `status`, and
|
|
28
|
+
* every `SubstratError` carries one from the problem catalog — so a `permission denied:
|
|
29
|
+
* protocol:read` raised on our own side of egress answered `true` here, and the drain
|
|
30
|
+
* captioned it "a client error the provider will refuse identically on retry". Scrive never
|
|
31
|
+
* saw that request. An operator who reads that sentence goes and audits their Scrive account.
|
|
3
32
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
33
|
+
* Terminality was never the part that was wrong, so it did not move: see
|
|
34
|
+
* {@link isTerminalDispatchFailure}, which is what the drain now asks. This one answers only
|
|
35
|
+
* "may we quote this as the provider's words", and one of ours never may.
|
|
7
36
|
*/
|
|
8
|
-
export
|
|
37
|
+
export declare function isTerminalProviderError(error: unknown): boolean;
|
|
9
38
|
//# sourceMappingURL=provider-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-error.d.ts","sourceRoot":"","sources":["../src/provider-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider-error.d.ts","sourceRoot":"","sources":["../src/provider-error.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAiC,CAAC;AAE5F;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAItE;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/D"}
|
package/dist/provider-error.js
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Is a failed outbound call worth trying again? (#618)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The platform retries a connector delivery by re-draining its `connector:<provider>` intent,
|
|
5
|
+
* and until now every failure looked the same to that loop: a throw meant "transient", so a
|
|
6
|
+
* provider answering `409 requires valid personal number field` was retried a hundred times
|
|
7
|
+
* over two days. That answer is not a fault to wait out — it is the provider telling the
|
|
8
|
+
* CALLER its request is wrong, and attempt 101 carries the identical bytes.
|
|
9
|
+
*
|
|
10
|
+
* The rule lives in one place rather than in any one connector because both ends need it
|
|
11
|
+
* (here beside the drain since #1978, out of the kernel): a connector decides what status to raise, the drain decides whether to keep the intent
|
|
12
|
+
* drainable, and they must not disagree. It is deliberately STRUCTURAL — any error carrying a
|
|
13
|
+
* numeric `status` — so the drain never has to import a provider's error class to classify it,
|
|
14
|
+
* and a connector gets the behaviour by raising the status it already knows.
|
|
15
|
+
*/
|
|
16
|
+
import { isSubstratError } from '@substrat-run/contracts';
|
|
17
|
+
/**
|
|
18
|
+
* 4xx statuses that are nevertheless worth retrying: the provider is refusing this attempt,
|
|
19
|
+
* not the request. Timeouts and locks clear on their own; a rate limit is an instruction to
|
|
20
|
+
* come back later, which is exactly what the next drain pass does.
|
|
21
|
+
*/
|
|
22
|
+
export const RETRYABLE_CLIENT_STATUSES = new Set([408, 423, 425, 429]);
|
|
23
|
+
/**
|
|
24
|
+
* The HTTP status an error carries, if it carries one. Structural on purpose (see above):
|
|
25
|
+
* `ScriveApiError` and any future connector's error type both satisfy it without a shared base
|
|
26
|
+
* class, and an error that carries no status — a network failure, a bug — reads as `undefined`,
|
|
27
|
+
* which is the honest answer and keeps it retryable.
|
|
28
|
+
*/
|
|
29
|
+
export function providerErrorStatus(error) {
|
|
30
|
+
if (typeof error !== 'object' || error === null)
|
|
31
|
+
return undefined;
|
|
32
|
+
const status = error.status;
|
|
33
|
+
return typeof status === 'number' && Number.isFinite(status) ? status : undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Is this delivery over? — the DRAIN's question, and the only one that decides retries.
|
|
37
|
+
*
|
|
38
|
+
* A non-retryable 4xx, whoever raised it: attempt 101 carries the identical bytes past the
|
|
39
|
+
* identical check. Deliberately blind to WHO refused, because terminality does not depend on
|
|
40
|
+
* it — our own `validation_failed` is as final as the provider's 409, and both statuses come
|
|
41
|
+
* from the same structural read (`SubstratError` carries its catalog status; a connector's
|
|
42
|
+
* error carries the provider's).
|
|
43
|
+
*/
|
|
44
|
+
export function isTerminalDispatchFailure(error) {
|
|
45
|
+
const status = providerErrorStatus(error);
|
|
46
|
+
return status !== undefined && status >= 400 && status < 500 && !RETRYABLE_CLIENT_STATUSES.has(status);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The PROVIDER refused the request — a 4xx that came back over the wire, not one we raised.
|
|
50
|
+
*
|
|
51
|
+
* The exclusion is the whole point (#841). This predicate reads a bare numeric `status`, and
|
|
52
|
+
* every `SubstratError` carries one from the problem catalog — so a `permission denied:
|
|
53
|
+
* protocol:read` raised on our own side of egress answered `true` here, and the drain
|
|
54
|
+
* captioned it "a client error the provider will refuse identically on retry". Scrive never
|
|
55
|
+
* saw that request. An operator who reads that sentence goes and audits their Scrive account.
|
|
56
|
+
*
|
|
57
|
+
* Terminality was never the part that was wrong, so it did not move: see
|
|
58
|
+
* {@link isTerminalDispatchFailure}, which is what the drain now asks. This one answers only
|
|
59
|
+
* "may we quote this as the provider's words", and one of ours never may.
|
|
7
60
|
*/
|
|
8
|
-
export
|
|
61
|
+
export function isTerminalProviderError(error) {
|
|
62
|
+
return !isSubstratError(error) && isTerminalDispatchFailure(error);
|
|
63
|
+
}
|
|
9
64
|
//# sourceMappingURL=provider-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-error.js","sourceRoot":"","sources":["../src/provider-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"provider-error.js","sourceRoot":"","sources":["../src/provider-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,MAAM,GAAI,KAA8B,CAAC,MAAM,CAAC;IACtD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACpF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzG,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAc;IACpD,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type ScopeCopyCleanup } from './scope-copy-cleanup.js';
|
|
2
|
+
/**
|
|
3
|
+
* The backfill of copies made before the directory's copy ledger existed (#1722).
|
|
4
|
+
*
|
|
5
|
+
* A copy move records both its scripts in the ledger before it writes, so reap and erasure reach
|
|
6
|
+
* every copy made since. A scope's data lived in other scripts before that, and nothing names
|
|
7
|
+
* those copies to reap or erasure. The admin log is never swept, so a scope's own rows say where
|
|
8
|
+
* it was routed, and so where its store was. This walks the log, oldest first, one page per
|
|
9
|
+
* call, and records each such script the ledger does not know yet as `retained`.
|
|
10
|
+
*
|
|
11
|
+
* **Where a scope's data lived** is derived from the scope's whole timeline, never from one row:
|
|
12
|
+
* - **A pin.** Each `setScopeServingRef` row names the serving script before and after; while
|
|
13
|
+
* pinned, the scope's route was that script. The pin at birth is the first such row's `before`,
|
|
14
|
+
* or the directory's current pin when the scope has none. An unpin routes the scope to what it
|
|
15
|
+
* falls back on, the version bound then (or its slug, never bound), which is a home too.
|
|
16
|
+
* - **A bind while unpinned.** A `bindScopeVersion` row names a version (and a promote's row the
|
|
17
|
+
* version before it), whose registry row names its script. It is a home only while the scope was
|
|
18
|
+
* not pinned: a pinned scope's bind (a private vertical's promote moves the pointer of every
|
|
19
|
+
* served install) routes nothing there, and its script never held the scope's store.
|
|
20
|
+
* - **Birth by slug.** A non-preview scope born unpinned was provisioned through its vertical's
|
|
21
|
+
* slug, into the script of the version on `prod` at that instant (`listChannelHistory`), and no
|
|
22
|
+
* later row names that script unless a bind happens to. A preview is born by its own bind.
|
|
23
|
+
* - **A fork** is born into the script its source was routed to at that instant, whatever pin its
|
|
24
|
+
* own row took, derived the same way from the source's timeline (the source's slug resolves to
|
|
25
|
+
* its vertical's serving script when that vertical served in place then).
|
|
26
|
+
*
|
|
27
|
+
* What cannot be derived is a **failure**: reported in every response, written as an ops record on
|
|
28
|
+
* a real run (`scope.copy-backfill`), never marked clean, and reported again on a re-run. That is a
|
|
29
|
+
* row naming no version, a version the registry no longer holds or that names no script, a scope
|
|
30
|
+
* or fork source whose directory row is gone, a scope with no `provisionScope` row (its other rows
|
|
31
|
+
* are still derived), a slug with no `prod` version at the time or one that changed while the store
|
|
32
|
+
* may have been born (from `BIRTH_WINDOW_MS` before the birth row to the scope's activation: the
|
|
33
|
+
* row can come before or after the birth, see `slugAt`), a script no deployment answers for, and a
|
|
34
|
+
* store that cannot be read.
|
|
35
|
+
*
|
|
36
|
+
* - **Never a wipe, never a phantom.** `retained` is reached by reap and erasure and is never swept.
|
|
37
|
+
* A real run reads one thing, the derived home's `_substrat_meta`, for the tombstone that proves
|
|
38
|
+
* an earlier wipe ran. A dry run touches no store at all: it resolves each script's deployment and
|
|
39
|
+
* reports what a real run would check.
|
|
40
|
+
* - **Taken over by the ledger.** Once a move's own entry for the same script settles `done`, the
|
|
41
|
+
* backfilled entry settles with it (`COPY_BACKFILL_SUPERSEDE_SQL`).
|
|
42
|
+
* - **Idempotent and resumable.** `backfillScopeScriptCopy` writes nothing for a script the ledger
|
|
43
|
+
* already names for the scope; `nextCursor` is the last row read. Admin-log ids are minted before
|
|
44
|
+
* their row is written, so a row in flight while a page is read can sort below the cursor and be
|
|
45
|
+
* skipped. That is harmless here: the rows this exists for were written before the ledger existed.
|
|
46
|
+
* - **No race with a live move.** The entry is never pending, so no move's confirmation and no lease
|
|
47
|
+
* sweep acts on it; a reap claim refuses it, and an erasure that read the inventory first refuses
|
|
48
|
+
* to finalize on the changed count and is retried.
|
|
49
|
+
* - **Erasures that came first.** Each recorded entry is audited as `backfillScopeCopy` with the
|
|
50
|
+
* erasure epoch it was written under, and every erasure records its own (`ErasureEpochStamp`). A
|
|
51
|
+
* subject whose last erasure did not reach the latest recorded copy (`erasedBeforeBackfill`) is
|
|
52
|
+
* reported by every run, and a real run writes an ops record for each scope (`erased-before`).
|
|
53
|
+
* Erasing them again is the operator's call.
|
|
54
|
+
*/
|
|
55
|
+
export declare const BACKFILL_PAGE_MAX = 200;
|
|
56
|
+
/**
|
|
57
|
+
* How long BEFORE its `provisionScope` row a store may have been born. `POST /verticals/:slug/instances`
|
|
58
|
+
* provisions in the vertical first and writes the directory row after, inside one request, whose
|
|
59
|
+
* `retryTransient` waits about three seconds at most: fifteen minutes is a generous margin over
|
|
60
|
+
* that, not a measured bound. The other side of the window has no constant (`birthEnd`).
|
|
61
|
+
*/
|
|
62
|
+
export declare const BIRTH_WINDOW_MS: number;
|
|
63
|
+
export type CopyBackfillOutcome =
|
|
64
|
+
/** Dry run: a derived home whose deployment resolves; a real run checks its store, then records it. */
|
|
65
|
+
'would-record' | 'recorded'
|
|
66
|
+
/** The ledger already names this script for the scope. */
|
|
67
|
+
| 'ledgered'
|
|
68
|
+
/** The scope routes to this script now: the route reaches it. */
|
|
69
|
+
| 'route'
|
|
70
|
+
/** The store holds a wipe's tombstone: nothing of the scope is left there. */
|
|
71
|
+
| 'wiped' | 'failure';
|
|
72
|
+
export interface CopyBackfillEntry {
|
|
73
|
+
/** The admin-log row the script was derived from. */
|
|
74
|
+
fromLogId: string;
|
|
75
|
+
tenantId: string | null;
|
|
76
|
+
scopeId: string | null;
|
|
77
|
+
scriptRef: string | null;
|
|
78
|
+
outcome: CopyBackfillOutcome;
|
|
79
|
+
/** Why a failure is one. */
|
|
80
|
+
reason?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface CopyBackfillPage {
|
|
83
|
+
dryRun: boolean;
|
|
84
|
+
/** The last row read: pass it back as `cursor` to go on. */
|
|
85
|
+
nextCursor: string | null;
|
|
86
|
+
/** The page came back short: the log has no more rows after `nextCursor`. */
|
|
87
|
+
done: boolean;
|
|
88
|
+
rowsRead: number;
|
|
89
|
+
entries: CopyBackfillEntry[];
|
|
90
|
+
counts: Record<CopyBackfillOutcome, number>;
|
|
91
|
+
/**
|
|
92
|
+
* Scopes on this page with a backfilled copy and subjects erased there before it was recorded:
|
|
93
|
+
* those erasures never reached it, so each subject must be erased again. Reported, never run.
|
|
94
|
+
*/
|
|
95
|
+
erasedBefore: {
|
|
96
|
+
tenantId: string;
|
|
97
|
+
scopeId: string;
|
|
98
|
+
subjects: string[];
|
|
99
|
+
}[];
|
|
100
|
+
}
|
|
101
|
+
export declare function backfillScopeScriptCopies(input: ScopeCopyCleanup, opts: {
|
|
102
|
+
dryRun: boolean;
|
|
103
|
+
cursor?: string;
|
|
104
|
+
limit?: number;
|
|
105
|
+
}): Promise<CopyBackfillPage>;
|
|
106
|
+
//# sourceMappingURL=scope-copy-backfill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-copy-backfill.d.ts","sourceRoot":"","sources":["../src/scope-copy-backfill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAc,CAAC;AAE3C,MAAM,MAAM,mBAAmB;AAC7B,uGAAuG;AACrG,cAAc,GACd,UAAU;AACZ,0DAA0D;GACxD,UAAU;AACZ,iEAAiE;GAC/D,OAAO;AACT,8EAA8E;GAC5E,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,M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