@substrat-run/control-plane-api 0.146.0 → 0.148.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 +69 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +986 -383
- package/dist/api.js.map +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/deploy.d.ts +46 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +53 -1
- package/dist/deploy.js.map +1 -1
- package/dist/errors.d.ts +19 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lake-gateway.d.ts +54 -0
- package/dist/lake-gateway.d.ts.map +1 -0
- package/dist/lake-gateway.js +158 -0
- package/dist/lake-gateway.js.map +1 -0
- package/dist/platform-entry.d.ts +23 -1
- package/dist/platform-entry.d.ts.map +1 -1
- package/dist/platform-entry.generated.d.ts +9 -1
- package/dist/platform-entry.generated.d.ts.map +1 -1
- package/dist/platform-entry.generated.js +10 -2
- package/dist/platform-entry.generated.js.map +1 -1
- package/dist/platform-entry.js +31 -1
- package/dist/platform-entry.js.map +1 -1
- package/dist/platform-scope-stores.d.ts +151 -0
- package/dist/platform-scope-stores.d.ts.map +1 -0
- package/dist/platform-scope-stores.js +241 -0
- package/dist/platform-scope-stores.js.map +1 -0
- package/dist/r2-sql-engine.d.ts +50 -0
- package/dist/r2-sql-engine.d.ts.map +1 -0
- package/dist/r2-sql-engine.js +126 -0
- package/dist/r2-sql-engine.js.map +1 -0
- package/dist/scope-copy-cleanup.d.ts +12 -0
- package/dist/scope-copy-cleanup.d.ts.map +1 -1
- package/dist/scope-copy-cleanup.js +14 -3
- package/dist/scope-copy-cleanup.js.map +1 -1
- package/dist/staff-client.d.ts +9 -1
- package/dist/staff-client.d.ts.map +1 -1
- package/dist/staff-client.js.map +1 -1
- package/dist/store-entry.d.ts +90 -0
- package/dist/store-entry.d.ts.map +1 -0
- package/dist/store-entry.generated.d.ts +60 -0
- package/dist/store-entry.generated.d.ts.map +1 -0
- package/dist/store-entry.generated.js +62 -0
- package/dist/store-entry.generated.js.map +1 -0
- package/dist/store-entry.js +178 -0
- package/dist/store-entry.js.map +1 -0
- package/dist/store-releases.d.ts +147 -0
- package/dist/store-releases.d.ts.map +1 -0
- package/dist/store-releases.js +298 -0
- package/dist/store-releases.js.map +1 -0
- package/dist/store-script.d.ts +80 -0
- package/dist/store-script.d.ts.map +1 -0
- package/dist/store-script.js +173 -0
- package/dist/store-script.js.map +1 -0
- package/dist/vertical-client.d.ts +19 -2
- package/dist/vertical-client.d.ts.map +1 -1
- package/dist/vertical-client.js +10 -1
- package/dist/vertical-client.js.map +1 -1
- package/dist/wfp.js +1 -1
- package/dist/wfp.js.map +1 -1
- package/package.json +7 -6
package/dist/browser.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `test/browser-entry.test.ts` holds that line.
|
|
8
8
|
*/
|
|
9
9
|
export { ControlPlaneStaffClient } from './staff-client.js';
|
|
10
|
-
export type { AdminLogPage, AuditLogQuery, BindHostnameInput, ConnectionHealthQuery, ConnectorCallsBucket, DoNamespace, EgressReport, IssuesQuery, MembersReading, ObservedEgressRow, OpsFailuresQuery, PageQuery, PlatformRuntime, ProvisionScopeInput, RebindScopeResult, RecentLogEvent, ScopeHealth, ServiceMetricsRow, StaffMember, SweepRunsQuery, SystemSwitchesQuery, TenantStores, } from './staff-client.js';
|
|
10
|
+
export type { AdminLogPage, AuditLogQuery, BindHostnameInput, ConnectionHealthQuery, ConnectorCallsBucket, DoNamespace, EgressReport, IssuesQuery, MembersReading, ObservedEgressRow, OpsFailuresQuery, PageQuery, PlatformRuntime, ProvisionScopeInput, RebindScopeResult, RecentLogEvent, ReprovisionedScope, ScopeHealth, ServiceMetricsRow, StaffMember, SweepRunsQuery, SystemSwitchesQuery, TenantStores, } from './staff-client.js';
|
|
11
11
|
export * from '@substrat-run/control-plane-client';
|
|
12
12
|
//# sourceMappingURL=browser.d.ts.map
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,cAAc,oCAAoC,CAAC"}
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AA0B5D,2FAA2F;AAC3F,0FAA0F;AAC1F,cAAc,oCAAoC,CAAC"}
|
package/dist/deploy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { scopeStoreScriptName, type ScopeStoreNeed, type StoreKindRegistration, type StoreKindRelease } from '@substrat-run/contracts';
|
|
1
2
|
import type { AssetRouting, DeclaredBinding, DeployManifest } from '@substrat-run/contracts';
|
|
2
3
|
/**
|
|
3
4
|
* The deploy seam (self-serve-deploy.md). A `substrat push` uploads a *built* worker
|
|
@@ -131,6 +132,51 @@ export type FetchVerticalModulesFn = (deploymentRef: string) => Promise<Vertical
|
|
|
131
132
|
* `DeployVerticalFn`; undefined when the bytes cannot be produced.
|
|
132
133
|
*/
|
|
133
134
|
export type FetchVerticalAssetFn = (deploymentRef: string, asset: Pick<AssetUpload, 'path' | 'hash'>) => Promise<Uint8Array | undefined>;
|
|
135
|
+
/**
|
|
136
|
+
* The script a kind is uploaded as, for one vertical (#2210). Defined in contracts beside the
|
|
137
|
+
* vertical script names it must never collide with (L20).
|
|
138
|
+
*/
|
|
139
|
+
export { scopeStoreScriptName };
|
|
140
|
+
/** One store script to upload. The serving script is not given the namespace or the key. */
|
|
141
|
+
export interface ScopeStoreUploadPlan {
|
|
142
|
+
readonly scripts: readonly {
|
|
143
|
+
readonly kind: string;
|
|
144
|
+
/** Every pinned release of the kind (D-63). Which one a script runs is not the plan's. */
|
|
145
|
+
readonly releases: readonly StoreKindRelease[];
|
|
146
|
+
readonly vertical: string;
|
|
147
|
+
readonly scriptName: string;
|
|
148
|
+
readonly className: string;
|
|
149
|
+
}[];
|
|
150
|
+
/** Empty (L1). A vertical reaches a store through the platform, not a binding of its own. */
|
|
151
|
+
readonly bindings: readonly [];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Which store scripts a vertical's stores need (#2210). One script per (kind, vertical), shared
|
|
155
|
+
* by every binding of that kind, named by {@link scopeStoreScriptName}, which carries no release:
|
|
156
|
+
* a new release of the kind is uploaded into the same name. A kind that is not in `kinds` is
|
|
157
|
+
* refused. The default registry is empty. The upload itself is `createScopeStoreEnsurer`.
|
|
158
|
+
*/
|
|
159
|
+
export declare function scopeStoreUploadPlan(input: {
|
|
160
|
+
readonly vertical: string;
|
|
161
|
+
readonly stores: readonly ScopeStoreNeed[];
|
|
162
|
+
readonly kinds?: readonly StoreKindRegistration[];
|
|
163
|
+
}): ScopeStoreUploadPlan;
|
|
164
|
+
/**
|
|
165
|
+
* The bindings a vertical's upload carries (#2210), the per-version push and the serving upload
|
|
166
|
+
* alike: the version's own declared bindings, then the platform's (the serving upload's
|
|
167
|
+
* ledger-derived stores; none on a push). A declared scope store adds none (RFC scope-stores §10.2, L1):
|
|
168
|
+
* its kind is still checked against `kinds`, so a version whose kind is not registered is
|
|
169
|
+
* refused here as at push.
|
|
170
|
+
*/
|
|
171
|
+
export declare function verticalUploadBindings<B>(input: {
|
|
172
|
+
readonly vertical: string;
|
|
173
|
+
readonly manifest: {
|
|
174
|
+
readonly bindings: readonly DeclaredBinding[];
|
|
175
|
+
readonly scopeStores: readonly ScopeStoreNeed[];
|
|
176
|
+
};
|
|
177
|
+
readonly platformBindings: readonly B[];
|
|
178
|
+
readonly kinds?: readonly StoreKindRegistration[];
|
|
179
|
+
}): (DeclaredBinding | B)[];
|
|
134
180
|
/**
|
|
135
181
|
* The §4 sandbox contract. Throws a `forbidden` `substratError` (403 — the upload is well-formed
|
|
136
182
|
* and still refused) if a declared binding is not one of the vertical's OWN admissible
|
package/dist/deploy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,oBAAoB,EAKpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACzG,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;0FACsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B;mFAC+E;IAC/E,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtE,8DAA8D;IAC9D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;mEAE+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;2EACuE;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;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI,CA6C7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;0FAC0F;AAC1F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
package/dist/deploy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADMISSIBLE_BINDING_TYPES, PLATFORM_BINDING_PREFIX, substratError, verticalScriptStem } from '@substrat-run/contracts';
|
|
1
|
+
import { ADMISSIBLE_BINDING_TYPES, assertDeclaredScopeStores, PLATFORM_BINDING_PREFIX, scopeStoreScriptName, STORE_KINDS, storeNamesOfBindings, substratError, verticalScriptStem, } from '@substrat-run/contracts';
|
|
2
2
|
/**
|
|
3
3
|
* The deploy seam (self-serve-deploy.md). A `substrat push` uploads a *built* worker
|
|
4
4
|
* bundle; this layer forwards it to the platform's runtime (a Workers-for-Platforms
|
|
@@ -52,6 +52,51 @@ const NAMED_REFUSALS = {
|
|
|
52
52
|
service: 'a vertical is one serving script; it reaches the platform through the router (K-27), never a service binding',
|
|
53
53
|
dispatch_namespace: "the platform's Workers-for-Platforms dispatch fabric is never a vertical's to bind",
|
|
54
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* The script a kind is uploaded as, for one vertical (#2210). Defined in contracts beside the
|
|
57
|
+
* vertical script names it must never collide with (L20).
|
|
58
|
+
*/
|
|
59
|
+
export { scopeStoreScriptName };
|
|
60
|
+
/**
|
|
61
|
+
* Which store scripts a vertical's stores need (#2210). One script per (kind, vertical), shared
|
|
62
|
+
* by every binding of that kind, named by {@link scopeStoreScriptName}, which carries no release:
|
|
63
|
+
* a new release of the kind is uploaded into the same name. A kind that is not in `kinds` is
|
|
64
|
+
* refused. The default registry is empty. The upload itself is `createScopeStoreEnsurer`.
|
|
65
|
+
*/
|
|
66
|
+
export function scopeStoreUploadPlan(input) {
|
|
67
|
+
const kinds = input.kinds ?? STORE_KINDS;
|
|
68
|
+
const scripts = [];
|
|
69
|
+
const seen = new Set();
|
|
70
|
+
for (const store of input.stores) {
|
|
71
|
+
const kind = kinds.find((candidate) => candidate.kind === store.kind);
|
|
72
|
+
if (!kind) {
|
|
73
|
+
throw substratError('forbidden', `deploy refused: scope store '${store.binding}' declares kind '${store.kind}', which is not registered. ` +
|
|
74
|
+
`A store kind is platform code, registered in this repo.`);
|
|
75
|
+
}
|
|
76
|
+
if (seen.has(kind.kind))
|
|
77
|
+
continue;
|
|
78
|
+
seen.add(kind.kind);
|
|
79
|
+
scripts.push({
|
|
80
|
+
kind: kind.kind,
|
|
81
|
+
releases: kind.releases,
|
|
82
|
+
vertical: input.vertical,
|
|
83
|
+
scriptName: scopeStoreScriptName(input.vertical, kind.kind),
|
|
84
|
+
className: kind.className,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return { scripts, bindings: [] };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The bindings a vertical's upload carries (#2210), the per-version push and the serving upload
|
|
91
|
+
* alike: the version's own declared bindings, then the platform's (the serving upload's
|
|
92
|
+
* ledger-derived stores; none on a push). A declared scope store adds none (RFC scope-stores §10.2, L1):
|
|
93
|
+
* its kind is still checked against `kinds`, so a version whose kind is not registered is
|
|
94
|
+
* refused here as at push.
|
|
95
|
+
*/
|
|
96
|
+
export function verticalUploadBindings(input) {
|
|
97
|
+
const plan = scopeStoreUploadPlan({ vertical: input.vertical, stores: input.manifest.scopeStores, kinds: input.kinds });
|
|
98
|
+
return [...input.manifest.bindings, ...input.platformBindings, ...plan.bindings];
|
|
99
|
+
}
|
|
55
100
|
/**
|
|
56
101
|
* The §4 sandbox contract. Throws a `forbidden` `substratError` (403 — the upload is well-formed
|
|
57
102
|
* and still refused) if a declared binding is not one of the vertical's OWN admissible
|
|
@@ -81,6 +126,13 @@ const NAMED_REFUSALS = {
|
|
|
81
126
|
* the platform mints a live D1 per tenant and attaches it to the serving script — #301 PR-2.)
|
|
82
127
|
*/
|
|
83
128
|
export function assertSandboxContract(m) {
|
|
129
|
+
// The same derivation push applies (#2224): an own DO binding is an own store.
|
|
130
|
+
assertDeclaredScopeStores({
|
|
131
|
+
...storeNamesOfBindings(m.bindings),
|
|
132
|
+
tenantStores: m.tenantStores,
|
|
133
|
+
blobStores: m.blobStores,
|
|
134
|
+
scopeStores: m.scopeStores,
|
|
135
|
+
});
|
|
84
136
|
const own = new Set(m.doClasses);
|
|
85
137
|
const admissible = new Set(ADMISSIBLE_BINDING_TYPES);
|
|
86
138
|
const doc = 'self-serve-deploy.md §4';
|
package/dist/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,kBAAkB,GAInB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,uFAAuF;AACvF,oFAAoF;AACpF,2CAA2C;AAC3C,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAwFzG;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAE/B,cAAc;IADzB,YACW,cAAsB,EAC/B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;8BAHN,cAAc;QAIvB,IAAI,CAA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C9D,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAClE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;0FAC0F;AAC1F,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import type { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
2
|
-
import { type Problem } from '@substrat-run/contracts';
|
|
2
|
+
import { type ErrorCode, type Problem } from '@substrat-run/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* The log line the API writes when it answers a failure that is NOT a problem document
|
|
5
|
+
* (#113) — the tripwire in `createControlPlaneApi`. Named once, because the package's test
|
|
6
|
+
* setup fails a test on it and an operator searches for it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NON_PROBLEM_REFUSAL = "control-plane.non-problem-refusal";
|
|
3
9
|
export interface ApiError {
|
|
4
10
|
status: ContentfulStatusCode;
|
|
5
11
|
body: Problem;
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* A body built from a code this layer decided, rather than one the throw declared. The
|
|
15
|
+
* status follows from the catalog, so a route that refuses by code cannot pick a status
|
|
16
|
+
* the code does not mean.
|
|
17
|
+
*/
|
|
18
|
+
export declare const coded: (code: ErrorCode, message: string) => ApiError;
|
|
19
|
+
/**
|
|
20
|
+
* A body for a status and nothing else — `about:blank`. Two kinds of answer take it: a
|
|
21
|
+
* status raised somewhere else and relayed (not ours to type), and a status this layer
|
|
22
|
+
* answers that the closed taxonomy has no code for (501, 422, 502).
|
|
23
|
+
*/
|
|
24
|
+
export declare const relayed: (status: number, message: string) => ApiError;
|
|
7
25
|
/**
|
|
8
26
|
* Map a `HostAdmin` throw onto a problem document — #113.
|
|
9
27
|
*
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAML,KAAK,SAAS,EACd,KAAK,OAAO,EACb,MAAM,yBAAyB,CAAC;AAKjC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,sCAAsC,CAAC;AAEvE,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,SAAU,SAAS,WAAW,MAAM,KAAG,QAGvD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAY,MAAM,WAAW,MAAM,KAAG,QAGxD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAqD/C"}
|
package/dist/errors.js
CHANGED
|
@@ -2,13 +2,27 @@ import { errorCodeOf, PROBLEM_CATALOG, problemForStatus, substratError, toProble
|
|
|
2
2
|
import { SecretBoxUnconfiguredError } from '@substrat-run/kernel';
|
|
3
3
|
import { ControlPlaneError } from '@substrat-run/control-plane-client';
|
|
4
4
|
import { ConnectionRelayError } from './connection-relay.js';
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The log line the API writes when it answers a failure that is NOT a problem document
|
|
7
|
+
* (#113) — the tripwire in `createControlPlaneApi`. Named once, because the package's test
|
|
8
|
+
* setup fails a test on it and an operator searches for it.
|
|
9
|
+
*/
|
|
10
|
+
export const NON_PROBLEM_REFUSAL = 'control-plane.non-problem-refusal';
|
|
11
|
+
/**
|
|
12
|
+
* A body built from a code this layer decided, rather than one the throw declared. The
|
|
13
|
+
* status follows from the catalog, so a route that refuses by code cannot pick a status
|
|
14
|
+
* the code does not mean.
|
|
15
|
+
*/
|
|
16
|
+
export const coded = (code, message) => ({
|
|
7
17
|
status: PROBLEM_CATALOG[code].status,
|
|
8
18
|
body: toProblem(substratError(code, message)),
|
|
9
19
|
});
|
|
10
|
-
/**
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A body for a status and nothing else — `about:blank`. Two kinds of answer take it: a
|
|
22
|
+
* status raised somewhere else and relayed (not ours to type), and a status this layer
|
|
23
|
+
* answers that the closed taxonomy has no code for (501, 422, 502).
|
|
24
|
+
*/
|
|
25
|
+
export const relayed = (status, message) => ({
|
|
12
26
|
status: status,
|
|
13
27
|
body: problemForStatus(status, message),
|
|
14
28
|
});
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,SAAS,GAGV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../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F;IACrF,qFAAqF;IACrF,mFAAmF;IACnF,uEAAuE;IACvE,EAAE;IACF,4EAA4E;IAC5E,uFAAuF;IACvF,2FAA2F;IAC3F,wFAAwF;IACxF,qDAAqD;IACrD,IAAI,GAAG,YAAY,0BAA0B,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,aAAa,EAAE,CAAC;QACpF,OAAO,KAAK,CAAC,aAAa,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChF,CAAC;IACD,uFAAuF;IACvF,uFAAuF;IACvF,+EAA+E;IAC/E,qFAAqF;IACrF,gBAAgB;IAChB,IAAI,GAAG,YAAY,oBAAoB;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAEjF,uFAAuF;IACvF,yFAAyF;IACzF,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACnD,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,MAA8B,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IACpG,CAAC;IAED,uFAAuF;IACvF,wFAAwF;IACxF,+EAA+E;IAC/E,uFAAuF;IACvF,4DAA4D;IAC5D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,CAAC;AAC/E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { mintTenantToken, verifyTenantToken, tenantTokenAuth } from './tenant-to
|
|
|
14
14
|
export type { PlatformActorAuth, StaffIdentity, StaffSessionReader, StaffActorResolver, BuilderIdentity, BuilderAuth, TenantServiceIdentity, TenantServiceAuth, Principal, } from './auth.js';
|
|
15
15
|
export * from './browser.js';
|
|
16
16
|
export { VerticalClient, AUDITED_CALL_DEADLINE_MS } from './vertical-client.js';
|
|
17
|
-
export { assertNoUnreachableScopeCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
17
|
+
export { assertNoUnreachableScopeCopies, claimScopeScriptReap, drainScopeScriptCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
18
18
|
export { BIRTH_WINDOW_MS, backfillScopeScriptCopies, type CopyBackfillPage, } from './scope-copy-backfill.js';
|
|
19
19
|
export { scopeDeployment, versionReachedAt } from './scope-deployment.js';
|
|
20
20
|
export { hostedCrossVerticalReach } from './cross-vertical.js';
|
|
@@ -28,10 +28,16 @@ export { attributeFailure, terminalFailureNote } from './failure-attribution.js'
|
|
|
28
28
|
export { sendEmailHandler, sendFailureStatus, retryAfterSecondsOf, MAX_EMAIL_SEND_ATTEMPTS, EMAIL_RETRY_BASE_MS, EMAIL_RETRY_MAX_MS, type EmailSent, type SendEmailDeps, } from './email-intent.js';
|
|
29
29
|
export { isTerminalDispatchFailure, isTerminalProviderError, providerErrorStatus, RETRYABLE_CLIENT_STATUSES, } from './provider-error.js';
|
|
30
30
|
export type { VerticalClientOptions, ProvisionInstanceInput, ProvisionedInstance, ConfigureInstanceInput, } from './vertical-client.js';
|
|
31
|
+
export { callPlatformScopeStore, callPlatformScopeStoreAt, platformScopeStoresFor, runningVersionStoresOf, scopeStoresOf, unrouteScope, unreachablePlatformScopeStores, type PlatformScopeStoreDispatch, type PlatformScopeStores, type DeclaredScopeStore, declaredStoresOf, } from './platform-scope-stores.js';
|
|
31
32
|
export { assertSandboxContract, deployManifest, deploymentRefFor, stableDeploymentRefFor, nextMigrationTag, DeployUploadError, upstreamStatusOf, } from './deploy.js';
|
|
32
33
|
export type { DeployVerticalFn, FetchVerticalAssetFn, FetchVerticalModulesFn, RecoverAssetContentFn, VerticalBundle, DeclaredBinding, DeployManifest, } from './deploy.js';
|
|
33
34
|
export { createWfpUploader, createWfpModulesFetcher, createWfpBindingsPatcher } from './wfp.js';
|
|
35
|
+
export { createScopeStoreEnsurer, createStoreCanaryEnsurer, STORE_BUILD_VAR, STORE_RELEASE_VAR } from './store-script.js';
|
|
36
|
+
export { ROLLOUT_FLEET_MAX, ROLLOUT_HOLD_TTL_MS, ROLLOUT_VERTICALS_PER_REQUEST, canaryObjectName, canaryStoreRelease, decodeStoreKindRelease, runStoreKindRollout, storeKindRelease, storeReleaseKey, storedReleaseLoader, type CanaryCall, type StoreKindRolloutDeps, type StoreKindRolloutResult, type StoreReleaseBytes, } from './store-releases.js';
|
|
37
|
+
export type { ScopeStoreEnsurerOptions, StoreKindReleaseArtifact } from './store-script.js';
|
|
34
38
|
export { withPlatformEntry, platformEntrySkipReason, platformSweeperDecision, PLATFORM_ENTRY_MODULE, PLATFORM_SWEEPER_MODULE, } from './platform-entry.js';
|
|
39
|
+
export { withStoreEntry, withPythonStoreEntry, STORE_ENTRY_MODULE, STORE_ENTRY_PYTHON_MODULE, STORE_ENTRY_PYTHON_SOURCE, STORE_ENTRY_PYTHON_VERIFIER_SOURCE, STORE_OBJECT_CLASS, STORE_RESERVED_MODULES, STORE_VERIFIER_MODULE, } from './store-entry.js';
|
|
40
|
+
export type { StoreEntryOptions, PythonStoreKindRelease, PythonStoreScript } from './store-entry.js';
|
|
35
41
|
export type { WfpUploaderOptions, PatchScriptBindingsFn, ScriptBindingSpec, D1BindingSpec, R2BindingSpec, } from './wfp.js';
|
|
36
42
|
export { blobStoreBindings, collectBlobStoreHandles, collectTenantStoreHandles, tenantStoreBindings, } from './tenant-stores.js';
|
|
37
43
|
export { auditedChange, settleUnrecordedOutcomes, supersededUnknowns, withAuditedOutcomes, OUTCOME_CONFLICT_LOG, MALFORMED_OPERATION_ID_LOG, SETTLE_GRACE_MS, UNRECORDED_OUTCOME_LOG, } from './audited-change.js';
|
|
@@ -57,6 +63,9 @@ export type { CfObservabilityOptions } from './cf-observability.js';
|
|
|
57
63
|
export type { ScopeBackup, ScopeBackupStore, DirectoryBackup, DirectoryBackupStore, } from './backups.js';
|
|
58
64
|
export { createR2AccessLogSink, createR2BackupStore, createR2DirectoryBackupStore, createR2EventSink, pruneAccessLogBatches, pruneScopeBackups, } from './r2-backups.js';
|
|
59
65
|
export { createPipelinesEventSink } from './pipelines-sink.js';
|
|
66
|
+
export type { LakeQueryEngine } from './lake-gateway.js';
|
|
67
|
+
export { createR2SqlEngine } from './r2-sql-engine.js';
|
|
68
|
+
export type { R2SqlEngineOptions } from './r2-sql-engine.js';
|
|
60
69
|
export { backupDirectoryIfDue } from './directory-backup.js';
|
|
61
70
|
export type { DirectoryBackupOptions, DirectoryBackupResult } from './directory-backup.js';
|
|
62
71
|
export { maskDump, maskRecords, MASKED } from './mask.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,EAAE,MAAM,uBAAuB,CAAC;AACjH,YAAY,EAAE,0BAA0B,EAAE,2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E,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EACV,WAAW,EACX,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;AAG/D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAI7D,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,7 +11,7 @@ export { mintTenantToken, verifyTenantToken, tenantTokenAuth } from './tenant-to
|
|
|
11
11
|
// (`./browser`): a bundler resolving the root entry would pull the whole server.
|
|
12
12
|
export * from './browser.js';
|
|
13
13
|
export { VerticalClient, AUDITED_CALL_DEADLINE_MS } from './vertical-client.js';
|
|
14
|
-
export { assertNoUnreachableScopeCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
14
|
+
export { assertNoUnreachableScopeCopies, claimScopeScriptReap, drainScopeScriptCopies, retryScopeScriptCopy, retryScopeScriptCopies, reapScopeScriptCopies, settleExpiredScopeScriptCopies, sweepScopeScriptCopies, } from './scope-copy-cleanup.js';
|
|
15
15
|
export { BIRTH_WINDOW_MS, backfillScopeScriptCopies, } from './scope-copy-backfill.js';
|
|
16
16
|
export { scopeDeployment, versionReachedAt } from './scope-deployment.js';
|
|
17
17
|
// #1705 PR 2: the cross-vertical phase's reach for a control plane whose scopes live elsewhere.
|
|
@@ -25,9 +25,13 @@ export { attributeFailure, terminalFailureNote } from './failure-attribution.js'
|
|
|
25
25
|
export { sendEmailHandler, sendFailureStatus, retryAfterSecondsOf, MAX_EMAIL_SEND_ATTEMPTS, EMAIL_RETRY_BASE_MS, EMAIL_RETRY_MAX_MS, } from './email-intent.js';
|
|
26
26
|
// #1978: moved here from the kernel — the drain is its only reader.
|
|
27
27
|
export { isTerminalDispatchFailure, isTerminalProviderError, providerErrorStatus, RETRYABLE_CLIENT_STATUSES, } from './provider-error.js';
|
|
28
|
+
export { callPlatformScopeStore, callPlatformScopeStoreAt, platformScopeStoresFor, runningVersionStoresOf, scopeStoresOf, unrouteScope, unreachablePlatformScopeStores, declaredStoresOf, } from './platform-scope-stores.js';
|
|
28
29
|
export { assertSandboxContract, deployManifest, deploymentRefFor, stableDeploymentRefFor, nextMigrationTag, DeployUploadError, upstreamStatusOf, } from './deploy.js';
|
|
29
30
|
export { createWfpUploader, createWfpModulesFetcher, createWfpBindingsPatcher } from './wfp.js';
|
|
31
|
+
export { createScopeStoreEnsurer, createStoreCanaryEnsurer, STORE_BUILD_VAR, STORE_RELEASE_VAR } from './store-script.js';
|
|
32
|
+
export { ROLLOUT_FLEET_MAX, ROLLOUT_HOLD_TTL_MS, ROLLOUT_VERTICALS_PER_REQUEST, canaryObjectName, canaryStoreRelease, decodeStoreKindRelease, runStoreKindRollout, storeKindRelease, storeReleaseKey, storedReleaseLoader, } from './store-releases.js';
|
|
30
33
|
export { withPlatformEntry, platformEntrySkipReason, platformSweeperDecision, PLATFORM_ENTRY_MODULE, PLATFORM_SWEEPER_MODULE, } from './platform-entry.js';
|
|
34
|
+
export { withStoreEntry, withPythonStoreEntry, STORE_ENTRY_MODULE, STORE_ENTRY_PYTHON_MODULE, STORE_ENTRY_PYTHON_SOURCE, STORE_ENTRY_PYTHON_VERIFIER_SOURCE, STORE_OBJECT_CLASS, STORE_RESERVED_MODULES, STORE_VERIFIER_MODULE, } from './store-entry.js';
|
|
31
35
|
export { blobStoreBindings, collectBlobStoreHandles, collectTenantStoreHandles, tenantStoreBindings, } from './tenant-stores.js';
|
|
32
36
|
export { auditedChange, settleUnrecordedOutcomes, supersededUnknowns, withAuditedOutcomes, OUTCOME_CONFLICT_LOG, MALFORMED_OPERATION_ID_LOG, SETTLE_GRACE_MS, UNRECORDED_OUTCOME_LOG, } from './audited-change.js';
|
|
33
37
|
export { createCustomHostnameProvisioner, mapCfStatus, extractRecords, reconcilePendingHostnames, isCustomHostname, validateBindableHostname, } from './custom-hostnames.js';
|
|
@@ -50,6 +54,7 @@ createR2EventSink, pruneAccessLogBatches, pruneScopeBackups, } from './r2-backup
|
|
|
50
54
|
// The same seam's Pipelines shape — kernel-design §5.3's Cloudflare row for event
|
|
51
55
|
// transport. Which one a deployment binds is its choice; the drain never learns.
|
|
52
56
|
export { createPipelinesEventSink } from './pipelines-sink.js';
|
|
57
|
+
export { createR2SqlEngine } from './r2-sql-engine.js';
|
|
53
58
|
// #40 — the scheduled directory copy. Exported as a function the CP worker's cron calls,
|
|
54
59
|
// not as a route with a timer behind it: this package stays library-only, exactly as the
|
|
55
60
|
// platform-request drain does (the recurrence has to come from a deployment, #444).
|
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,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EACL,yBAAyB,GAG1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAYxF,uFAAuF;AACvF,iFAAiF;AACjF,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,8BAA8B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,
|
|
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;AA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AE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAStE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B;AAC5B,iFAAiF;AACjF,mFAAmF;AACnF,gFAAgF;AAChF,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,kFAAkF;AAClF,iFAAiF;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,yFAAyF;AACzF,yFAAyF;AACzF,oFAAoF;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type LakeEventsInput, type LakeEventsPage, type TenantId } from '@substrat-run/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The Tier-2 lake's query gateway (#1334) — the one path by which anything in the product
|
|
4
|
+
* reads `kernel.events`, and the place the tenant boundary is held for it.
|
|
5
|
+
*
|
|
6
|
+
* Every tenant's events share one Iceberg table, and the sink cannot partition it, so
|
|
7
|
+
* nothing below this file knows whose row is whose. Isolation is therefore made here, in
|
|
8
|
+
* three layers, each enough on its own:
|
|
9
|
+
*
|
|
10
|
+
* 1. **The tenant is an argument, never an input.** `compileLakeEvents` takes it apart from
|
|
11
|
+
* the filters, and the filter schema (`lakeEventsInput`) has no tenant field and refuses
|
|
12
|
+
* unknown keys. The caller's only way to name a tenant is the route's path segment, which
|
|
13
|
+
* the API's authentication has already confined.
|
|
14
|
+
* 2. **The predicate is written first, by the only producer of SQL.** No caller supplies
|
|
15
|
+
* SQL, an identifier or a fragment: the query is a closed shape, every column is from
|
|
16
|
+
* the list below, and every value is a literal that passes `LAKE_LITERAL` — an alphabet
|
|
17
|
+
* with no quote in it — or is refused. `tenant_id = '<tenant>'` is the first conjunct of
|
|
18
|
+
* every WHERE, and the filters can only AND onto it.
|
|
19
|
+
* 3. **The answer is checked, not trusted.** Every row must carry the tenant asked for. One
|
|
20
|
+
* that does not fails the whole read with nothing returned: a defect in the layers above
|
|
21
|
+
* becomes an error rather than a disclosure.
|
|
22
|
+
*
|
|
23
|
+
* The engine is a seam (`LakeQueryEngine`) because §5.3 says it is replaceable — Iceberg is
|
|
24
|
+
* the contract, R2 SQL is today's reader, DuckDB over the same catalog the fallback. The
|
|
25
|
+
* gateway is where the contract lives, so swapping the engine changes none of the above.
|
|
26
|
+
*/
|
|
27
|
+
/** The query engine over the lake: one SQL statement in, rows keyed by column name out. */
|
|
28
|
+
export interface LakeQueryEngine {
|
|
29
|
+
query(sql: string): Promise<readonly Record<string, unknown>[]>;
|
|
30
|
+
}
|
|
31
|
+
/** A row the engine handed back for a tenant other than the one asked about. */
|
|
32
|
+
export declare class LakeTenantMismatchError extends Error {
|
|
33
|
+
readonly expected: TenantId;
|
|
34
|
+
constructor(expected: TenantId);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One page of a tenant's events, newest first, as SQL.
|
|
38
|
+
*
|
|
39
|
+
* No `DISTINCT`. The drain is at-least-once, so a retried batch lands twice, but asking the
|
|
40
|
+
* engine to dedupe makes it dedupe the whole filtered set before it can apply the limit, and
|
|
41
|
+
* R2 SQL names large deduplicating sorts as a timeout risk. Duplicates share an id and the
|
|
42
|
+
* order is by id, so they arrive adjacent; `queryLakeEvents` collapses them, and pages off
|
|
43
|
+
* the engine's own window so a duplicate can shorten a page but never end the walk early.
|
|
44
|
+
* Keyset on `id` (a ULID, so time-ordered) rather than on `occurred_at`, so the cursor is a
|
|
45
|
+
* string comparison every engine agrees on. One row over the limit is asked for, to know
|
|
46
|
+
* whether there is a next page without a second query.
|
|
47
|
+
*/
|
|
48
|
+
export declare function compileLakeEvents(tenantId: TenantId, input: LakeEventsInput): string;
|
|
49
|
+
/**
|
|
50
|
+
* One page of `tenantId`'s lake events. Throws `LakeTenantMismatchError` — and returns
|
|
51
|
+
* nothing — if the engine answers with any row of another tenant.
|
|
52
|
+
*/
|
|
53
|
+
export declare function queryLakeEvents(engine: LakeQueryEngine, tenantId: TenantId, input: LakeEventsInput): Promise<LakeEventsPage>;
|
|
54
|
+
//# sourceMappingURL=lake-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lake-gateway.d.ts","sourceRoot":"","sources":["../src/lake-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,2FAA2F;AAC3F,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;CACjE;AA4BD,gFAAgF;AAChF,qBAAa,uBAAwB,SAAQ,KAAK;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAAvC,YAAqB,QAAQ,EAAE,QAAQ,EAGtC;CACF;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,CAkBpF;AA6CD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,cAAc,CAAC,CAuBzB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { LAKE_LITERAL, actor as actorSchema, lakeEvent, } from '@substrat-run/contracts';
|
|
2
|
+
/** The lake's one table — `LAKE.namespace`.`LAKE.table` in `scripts/lake-provision.mjs`. */
|
|
3
|
+
const LAKE_TABLE = 'kernel.events';
|
|
4
|
+
/**
|
|
5
|
+
* The envelope columns a lake read returns. Deliberately NOT `payload`, `subject_id`,
|
|
6
|
+
* `authorization` or `impersonation`: erasure does not reach the lake yet, so what was said
|
|
7
|
+
* stays out of every answer until it does. `impersonated` is derived, so the fact of a staff
|
|
8
|
+
* session is visible and the session's own record is not.
|
|
9
|
+
*/
|
|
10
|
+
const COLUMNS = [
|
|
11
|
+
'id',
|
|
12
|
+
'type',
|
|
13
|
+
'schema_version',
|
|
14
|
+
'occurred_at',
|
|
15
|
+
'tenant_id',
|
|
16
|
+
'scope_id',
|
|
17
|
+
'actor',
|
|
18
|
+
'entity_type',
|
|
19
|
+
'entity_id',
|
|
20
|
+
'pii_class',
|
|
21
|
+
'operation',
|
|
22
|
+
'version',
|
|
23
|
+
'caused_by',
|
|
24
|
+
'invocation_id',
|
|
25
|
+
];
|
|
26
|
+
/** A row the engine handed back for a tenant other than the one asked about. */
|
|
27
|
+
export class LakeTenantMismatchError extends Error {
|
|
28
|
+
expected;
|
|
29
|
+
constructor(expected) {
|
|
30
|
+
super(`lake gateway: the engine returned a row outside tenant ${expected}; the read is refused whole`);
|
|
31
|
+
this.expected = expected;
|
|
32
|
+
this.name = 'LakeTenantMismatchError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A value as a SQL string literal. Refuses anything outside `LAKE_LITERAL` rather than
|
|
37
|
+
* escaping it — every caller has already parsed its value against a narrower schema, so a
|
|
38
|
+
* refusal here means a schema and this file have parted company, which must be loud.
|
|
39
|
+
*/
|
|
40
|
+
function literal(value) {
|
|
41
|
+
if (!LAKE_LITERAL.test(value))
|
|
42
|
+
throw new Error(`lake gateway: refusing a literal outside the lake alphabet`);
|
|
43
|
+
return `'${value}'`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One page of a tenant's events, newest first, as SQL.
|
|
47
|
+
*
|
|
48
|
+
* No `DISTINCT`. The drain is at-least-once, so a retried batch lands twice, but asking the
|
|
49
|
+
* engine to dedupe makes it dedupe the whole filtered set before it can apply the limit, and
|
|
50
|
+
* R2 SQL names large deduplicating sorts as a timeout risk. Duplicates share an id and the
|
|
51
|
+
* order is by id, so they arrive adjacent; `queryLakeEvents` collapses them, and pages off
|
|
52
|
+
* the engine's own window so a duplicate can shorten a page but never end the walk early.
|
|
53
|
+
* Keyset on `id` (a ULID, so time-ordered) rather than on `occurred_at`, so the cursor is a
|
|
54
|
+
* string comparison every engine agrees on. One row over the limit is asked for, to know
|
|
55
|
+
* whether there is a next page without a second query.
|
|
56
|
+
*/
|
|
57
|
+
export function compileLakeEvents(tenantId, input) {
|
|
58
|
+
const where = [`tenant_id = ${literal(tenantId)}`];
|
|
59
|
+
if (input.scopeId !== undefined)
|
|
60
|
+
where.push(`scope_id = ${literal(input.scopeId)}`);
|
|
61
|
+
if (input.type !== undefined)
|
|
62
|
+
where.push(`type = ${literal(input.type)}`);
|
|
63
|
+
if (input.entityType !== undefined)
|
|
64
|
+
where.push(`entity_type = ${literal(input.entityType)}`);
|
|
65
|
+
if (input.entityId !== undefined)
|
|
66
|
+
where.push(`entity_id = ${literal(input.entityId)}`);
|
|
67
|
+
// The shipper sends the decoded actor (`pipelines-sink.ts`), so a principal is its bare id.
|
|
68
|
+
if (input.actor !== undefined)
|
|
69
|
+
where.push(`actor = ${literal(input.actor)}`);
|
|
70
|
+
if (input.operation !== undefined)
|
|
71
|
+
where.push(`operation = ${literal(input.operation)}`);
|
|
72
|
+
if (input.version !== undefined)
|
|
73
|
+
where.push(`version = ${literal(input.version)}`);
|
|
74
|
+
if (input.impersonated)
|
|
75
|
+
where.push('impersonation IS NOT NULL');
|
|
76
|
+
if (input.since !== undefined)
|
|
77
|
+
where.push(`occurred_at >= ${literal(input.since)}`);
|
|
78
|
+
if (input.until !== undefined)
|
|
79
|
+
where.push(`occurred_at < ${literal(input.until)}`);
|
|
80
|
+
if (input.cursor !== undefined)
|
|
81
|
+
where.push(`id < ${literal(input.cursor)}`);
|
|
82
|
+
return (`SELECT ${COLUMNS.join(', ')}, (impersonation IS NOT NULL) AS impersonated ` +
|
|
83
|
+
`FROM ${LAKE_TABLE} WHERE ${where.join(' AND ')} ORDER BY id DESC LIMIT ${input.limit + 1}`);
|
|
84
|
+
}
|
|
85
|
+
/** The stored actor, decoded the way `timelineEntry` decodes it, or the self-naming marker. */
|
|
86
|
+
function decodeActor(raw) {
|
|
87
|
+
const direct = actorSchema.safeParse(raw);
|
|
88
|
+
if (direct.success)
|
|
89
|
+
return direct.data;
|
|
90
|
+
if (typeof raw === 'string') {
|
|
91
|
+
try {
|
|
92
|
+
const parsed = actorSchema.safeParse(JSON.parse(raw));
|
|
93
|
+
if (parsed.success)
|
|
94
|
+
return parsed.data;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// not JSON: falls through to the marker
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { system: 'undecodable' };
|
|
101
|
+
}
|
|
102
|
+
/** The column as an ISO instant, whether the engine hands back epoch millis or text. */
|
|
103
|
+
function instantOf(raw) {
|
|
104
|
+
const ms = typeof raw === 'number' ? raw : typeof raw === 'string' ? Date.parse(raw) : Number.NaN;
|
|
105
|
+
if (!Number.isFinite(ms))
|
|
106
|
+
throw new Error('lake gateway: a row carried no readable occurred_at');
|
|
107
|
+
return new Date(ms).toISOString();
|
|
108
|
+
}
|
|
109
|
+
const nullableString = (raw) => (typeof raw === 'string' ? raw : null);
|
|
110
|
+
function toEvent(row) {
|
|
111
|
+
return lakeEvent.parse({
|
|
112
|
+
id: row.id,
|
|
113
|
+
type: row.type,
|
|
114
|
+
schemaVersion: Number(row.schema_version),
|
|
115
|
+
occurredAt: instantOf(row.occurred_at),
|
|
116
|
+
scopeId: row.scope_id,
|
|
117
|
+
actor: decodeActor(row.actor),
|
|
118
|
+
entityType: row.entity_type,
|
|
119
|
+
entityId: row.entity_id,
|
|
120
|
+
piiClass: row.pii_class,
|
|
121
|
+
operation: nullableString(row.operation),
|
|
122
|
+
version: nullableString(row.version),
|
|
123
|
+
causedBy: nullableString(row.caused_by),
|
|
124
|
+
invocationId: nullableString(row.invocation_id),
|
|
125
|
+
impersonated: row.impersonated === true || row.impersonated === 1,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One page of `tenantId`'s lake events. Throws `LakeTenantMismatchError` — and returns
|
|
130
|
+
* nothing — if the engine answers with any row of another tenant.
|
|
131
|
+
*/
|
|
132
|
+
export async function queryLakeEvents(engine, tenantId, input) {
|
|
133
|
+
const rows = await engine.query(compileLakeEvents(tenantId, input));
|
|
134
|
+
// Every row, before any is decoded or dropped: the check is about what the engine
|
|
135
|
+
// returned, not about what this page would have shown.
|
|
136
|
+
if (rows.some((r) => r.tenant_id !== tenantId))
|
|
137
|
+
throw new LakeTenantMismatchError(tenantId);
|
|
138
|
+
// The page is the engine's first `limit` rows, deduplicated by id, and the next page starts
|
|
139
|
+
// after the last of THOSE rows. Deciding "more" from the deduplicated list instead would
|
|
140
|
+
// end the walk early whenever a duplicate fell inside the window: `limit + 1` rows with
|
|
141
|
+
// one copy among them dedupe to `limit` events and read as the last page.
|
|
142
|
+
const window = rows.slice(0, input.limit);
|
|
143
|
+
const more = rows.length > input.limit;
|
|
144
|
+
const seen = new Set();
|
|
145
|
+
const page = [];
|
|
146
|
+
for (const row of window) {
|
|
147
|
+
const event = toEvent(row);
|
|
148
|
+
if (seen.has(event.id))
|
|
149
|
+
continue;
|
|
150
|
+
seen.add(event.id);
|
|
151
|
+
page.push(event);
|
|
152
|
+
}
|
|
153
|
+
// Rows arrive ordered by id, so the window's last row is a copy of the last event or that
|
|
154
|
+
// event itself: its id is the cursor either way.
|
|
155
|
+
const nextCursor = more ? (page[page.length - 1]?.id ?? null) : null;
|
|
156
|
+
return { events: page, nextCursor, consistency: 'eventual' };
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=lake-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lake-gateway.js","sourceRoot":"","sources":["../src/lake-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,IAAI,WAAW,EACpB,SAAS,GAKV,MAAM,yBAAyB,CAAC;AAiCjC,4FAA4F;AAC5F,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,GAAG;IACd,IAAI;IACJ,MAAM;IACN,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,UAAU;IACV,OAAO;IACP,aAAa;IACb,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;IACT,WAAW;IACX,eAAe;CACP,CAAC;AAEX,gFAAgF;AAChF,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC3B,QAAQ;IAA7B,YAAqB,QAAkB;QACrC,KAAK,CAAC,0DAA0D,QAAQ,6BAA6B,CAAC,CAAC;wBADpF,QAAQ;QAE3B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAC7G,OAAO,IAAI,KAAK,GAAG,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAA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