@substrat-run/adapter-cloudflare 0.138.0 → 0.140.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/README.md +2 -2
- package/dist/checker.d.ts.map +1 -1
- package/dist/checker.js +4 -0
- package/dist/checker.js.map +1 -1
- package/dist/control-plane-do.d.ts +95 -26
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +290 -35
- package/dist/control-plane-do.js.map +1 -1
- package/dist/host.d.ts +55 -14
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +347 -69
- package/dist/host.js.map +1 -1
- package/dist/live-reads.d.ts +30 -7
- package/dist/live-reads.d.ts.map +1 -1
- package/dist/live-reads.js +43 -9
- package/dist/live-reads.js.map +1 -1
- package/dist/route-resolver.d.ts +1 -1
- package/dist/route-resolver.d.ts.map +1 -1
- package/dist/route-resolver.js +7 -0
- package/dist/route-resolver.js.map +1 -1
- package/dist/scope-do.d.ts +29 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +811 -257
- package/dist/scope-do.js.map +1 -1
- package/dist/sql.d.ts +7 -1
- package/dist/sql.d.ts.map +1 -1
- package/dist/sql.js +29 -3
- package/dist/sql.js.map +1 -1
- package/package.json +12 -10
package/dist/live-reads.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Nothing in this module reaches the network or the database. It is names and shapes.
|
|
11
11
|
*/
|
|
12
12
|
import { type EntityRef, type PrincipalId, type ScopeId, type TenantId } from '@substrat-run/contracts';
|
|
13
|
-
import { type VouchedWithin } from '@substrat-run/kernel';
|
|
13
|
+
import { type CheckedWithin, type VouchedWithin } from '@substrat-run/kernel';
|
|
14
14
|
/**
|
|
15
15
|
* The path the coordinator fetches on the scope stub to open a subscription.
|
|
16
16
|
*
|
|
@@ -34,10 +34,17 @@ export declare const LIVE_TENANT_HEADER = "x-substrat-live-tenant";
|
|
|
34
34
|
export declare const LIVE_SCOPE_HEADER = "x-substrat-live-scope";
|
|
35
35
|
/**
|
|
36
36
|
* The `within` root a subscription is narrowed to (#1853), and whether the vertical
|
|
37
|
-
* vouched for it — `encodeLiveWithin`'s output, asserted by the coordinator exactly as
|
|
37
|
+
* vouched for it or the principal is checked on it (#938) — `encodeLiveWithin`'s output, asserted by the coordinator exactly as
|
|
38
38
|
* the principal is. Absent means an unnarrowed feed.
|
|
39
39
|
*/
|
|
40
40
|
export declare const LIVE_WITHIN_HEADER = "x-substrat-live-within";
|
|
41
|
+
/**
|
|
42
|
+
* When the credential that proved the principal stops being valid (#938), as ISO 8601 —
|
|
43
|
+
* asserted by the coordinator from `subscribe`'s `expiresAt`. Absent: no expiry was given.
|
|
44
|
+
*/
|
|
45
|
+
export declare const LIVE_EXPIRES_HEADER = "x-substrat-live-expires";
|
|
46
|
+
/** An instant as the scope keeps it (`toISOString`), or `undefined` for one that is not an instant. */
|
|
47
|
+
export declare function liveInstant(value: unknown): string | undefined;
|
|
41
48
|
/** A subscription's narrowing, as it is carried on the header and kept on the socket. */
|
|
42
49
|
export interface LiveWithin {
|
|
43
50
|
readonly entityType: string;
|
|
@@ -47,6 +54,12 @@ export interface LiveWithin {
|
|
|
47
54
|
* the principal's own check is then NOT applied. Absent: the check is ANDed with the walk.
|
|
48
55
|
*/
|
|
49
56
|
readonly vouched?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Set for a `checkedWithin` root (#938): the key the principal must pass ON THE ROOT, at
|
|
59
|
+
* the handshake and on every pass with a row beneath it. The per-row check is then NOT
|
|
60
|
+
* applied. Never set together with `vouched`.
|
|
61
|
+
*/
|
|
62
|
+
readonly checked?: string;
|
|
50
63
|
}
|
|
51
64
|
/** Header-safe: a reason may carry any character, and a header value may not. */
|
|
52
65
|
export declare function encodeLiveWithin(within: LiveWithin): string;
|
|
@@ -59,12 +72,13 @@ export declare function readLiveWithin(value: unknown): LiveWithin | undefined;
|
|
|
59
72
|
/**
|
|
60
73
|
* What `subscribe`'s `within` argument asks for, as the narrowing the scope keeps.
|
|
61
74
|
*
|
|
62
|
-
* Only
|
|
63
|
-
* Anything else throws — in particular an object that LOOKS
|
|
64
|
-
*
|
|
65
|
-
* only other reading would
|
|
75
|
+
* Only three shapes are accepted: a value `vouchedWithin` built, one `checkedWithin` built,
|
|
76
|
+
* and a plain `EntityRef`. Anything else throws — in particular an object that LOOKS
|
|
77
|
+
* built (`{ entity, because }`, `{ entity, permission }`) but was not: read as a plain ref
|
|
78
|
+
* it has no type or id, and the only other reading would replace the principal's per-row
|
|
79
|
+
* check on the caller's say-so.
|
|
66
80
|
*/
|
|
67
|
-
export declare function liveWithinOf(within: EntityRef | VouchedWithin | undefined): LiveWithin | undefined;
|
|
81
|
+
export declare function liveWithinOf(within: EntityRef | VouchedWithin | CheckedWithin | undefined): LiveWithin | undefined;
|
|
68
82
|
/** `readLiveWithin` over the header's encoding. */
|
|
69
83
|
export declare function decodeLiveWithin(header: string): LiveWithin | undefined;
|
|
70
84
|
/**
|
|
@@ -116,6 +130,8 @@ export interface LiveSubscription {
|
|
|
116
130
|
readonly since: string;
|
|
117
131
|
/** The root the feed is narrowed to (#1853). Absent on an unnarrowed one, and on every socket opened before it existed. */
|
|
118
132
|
readonly within?: LiveWithin;
|
|
133
|
+
/** When the session that opened it ends (#938); the scope closes the socket at it. */
|
|
134
|
+
readonly expiresAt?: string;
|
|
119
135
|
}
|
|
120
136
|
/**
|
|
121
137
|
* Read a socket's subscription back, or `null` if it does not have a usable one.
|
|
@@ -140,6 +156,13 @@ export declare function readSubscription(attachment: unknown): LiveSubscription
|
|
|
140
156
|
* reaching it means something unusual happened rather than something normal being cut off.
|
|
141
157
|
*/
|
|
142
158
|
export declare const LIVE_FANOUT_LIMIT = 200;
|
|
159
|
+
/**
|
|
160
|
+
* How many times one row is decided for one subscriber before it is given up on (#938, Codex
|
|
161
|
+
* #2077 r4). A decision is redone when the store wrote while it was being taken; the pass runs
|
|
162
|
+
* inside the scope's queue, so a write landing then is rare, and one landing on every attempt
|
|
163
|
+
* means the store is busy enough that the client's poll is the better answer for this row.
|
|
164
|
+
*/
|
|
165
|
+
export declare const LIVE_DECIDE_ATTEMPTS = 3;
|
|
143
166
|
/** Is this request asking to be upgraded to a WebSocket? Defined in the kernel (#1859). */
|
|
144
167
|
export { isUpgradeRequest } from '@substrat-run/kernel';
|
|
145
168
|
/**
|
package/dist/live-reads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-reads.d.ts","sourceRoot":"","sources":["../src/live-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"live-reads.d.ts","sourceRoot":"","sources":["../src/live-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAoC,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AACjE,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9D;AAED,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ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M,oBAAoB,IAAI,CAAC;AAEtC,2FAA2F;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE1D"}
|
package/dist/live-reads.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Nothing in this module reaches the network or the database. It is names and shapes.
|
|
11
11
|
*/
|
|
12
|
-
import { substratError } from '@substrat-run/contracts';
|
|
13
|
-
import { isVouchedWithin } from '@substrat-run/kernel';
|
|
12
|
+
import { permissionKey, substratError, } from '@substrat-run/contracts';
|
|
13
|
+
import { isCheckedWithin, isVouchedWithin } from '@substrat-run/kernel';
|
|
14
14
|
/**
|
|
15
15
|
* The path the coordinator fetches on the scope stub to open a subscription.
|
|
16
16
|
*
|
|
@@ -34,10 +34,22 @@ export const LIVE_TENANT_HEADER = 'x-substrat-live-tenant';
|
|
|
34
34
|
export const LIVE_SCOPE_HEADER = 'x-substrat-live-scope';
|
|
35
35
|
/**
|
|
36
36
|
* The `within` root a subscription is narrowed to (#1853), and whether the vertical
|
|
37
|
-
* vouched for it — `encodeLiveWithin`'s output, asserted by the coordinator exactly as
|
|
37
|
+
* vouched for it or the principal is checked on it (#938) — `encodeLiveWithin`'s output, asserted by the coordinator exactly as
|
|
38
38
|
* the principal is. Absent means an unnarrowed feed.
|
|
39
39
|
*/
|
|
40
40
|
export const LIVE_WITHIN_HEADER = 'x-substrat-live-within';
|
|
41
|
+
/**
|
|
42
|
+
* When the credential that proved the principal stops being valid (#938), as ISO 8601 —
|
|
43
|
+
* asserted by the coordinator from `subscribe`'s `expiresAt`. Absent: no expiry was given.
|
|
44
|
+
*/
|
|
45
|
+
export const LIVE_EXPIRES_HEADER = 'x-substrat-live-expires';
|
|
46
|
+
/** An instant as the scope keeps it (`toISOString`), or `undefined` for one that is not an instant. */
|
|
47
|
+
export function liveInstant(value) {
|
|
48
|
+
if (typeof value !== 'string')
|
|
49
|
+
return undefined;
|
|
50
|
+
const ms = Date.parse(value);
|
|
51
|
+
return Number.isFinite(ms) ? new Date(ms).toISOString() : undefined;
|
|
52
|
+
}
|
|
41
53
|
/** Header-safe: a reason may carry any character, and a header value may not. */
|
|
42
54
|
export function encodeLiveWithin(within) {
|
|
43
55
|
return encodeURIComponent(JSON.stringify(within));
|
|
@@ -57,19 +69,26 @@ export function readLiveWithin(value) {
|
|
|
57
69
|
return undefined;
|
|
58
70
|
if (w.vouched !== undefined && (typeof w.vouched !== 'string' || w.vouched.trim() === ''))
|
|
59
71
|
return undefined;
|
|
72
|
+
if (w.checked !== undefined && !permissionKey.safeParse(w.checked).success)
|
|
73
|
+
return undefined;
|
|
74
|
+
// Both would mean two different filters, and neither reading is the one that was asked for.
|
|
75
|
+
if (w.vouched !== undefined && w.checked !== undefined)
|
|
76
|
+
return undefined;
|
|
60
77
|
return {
|
|
61
78
|
entityType: w.entityType,
|
|
62
79
|
entityId: w.entityId,
|
|
63
80
|
...(w.vouched !== undefined ? { vouched: w.vouched } : {}),
|
|
81
|
+
...(w.checked !== undefined ? { checked: w.checked } : {}),
|
|
64
82
|
};
|
|
65
83
|
}
|
|
66
84
|
/**
|
|
67
85
|
* What `subscribe`'s `within` argument asks for, as the narrowing the scope keeps.
|
|
68
86
|
*
|
|
69
|
-
* Only
|
|
70
|
-
* Anything else throws — in particular an object that LOOKS
|
|
71
|
-
*
|
|
72
|
-
* only other reading would
|
|
87
|
+
* Only three shapes are accepted: a value `vouchedWithin` built, one `checkedWithin` built,
|
|
88
|
+
* and a plain `EntityRef`. Anything else throws — in particular an object that LOOKS
|
|
89
|
+
* built (`{ entity, because }`, `{ entity, permission }`) but was not: read as a plain ref
|
|
90
|
+
* it has no type or id, and the only other reading would replace the principal's per-row
|
|
91
|
+
* check on the caller's say-so.
|
|
73
92
|
*/
|
|
74
93
|
export function liveWithinOf(within) {
|
|
75
94
|
if (within === undefined)
|
|
@@ -77,9 +96,12 @@ export function liveWithinOf(within) {
|
|
|
77
96
|
if (isVouchedWithin(within)) {
|
|
78
97
|
return { entityType: within.entity.entityType, entityId: within.entity.entityId, vouched: within.because };
|
|
79
98
|
}
|
|
99
|
+
if (isCheckedWithin(within)) {
|
|
100
|
+
return { entityType: within.entity.entityType, entityId: within.entity.entityId, checked: within.permission };
|
|
101
|
+
}
|
|
80
102
|
const plain = readLiveWithin(within);
|
|
81
|
-
if (!plain || 'vouched' in within) {
|
|
82
|
-
throw substratError('validation_failed', 'live reads: `within` must be an EntityRef, or a value built by vouchedWithin()');
|
|
103
|
+
if (!plain || 'vouched' in within || 'checked' in within) {
|
|
104
|
+
throw substratError('validation_failed', 'live reads: `within` must be an EntityRef, or a value built by vouchedWithin() or checkedWithin()');
|
|
83
105
|
}
|
|
84
106
|
return { entityType: plain.entityType, entityId: plain.entityId };
|
|
85
107
|
}
|
|
@@ -150,12 +172,17 @@ export function readSubscription(attachment) {
|
|
|
150
172
|
const within = a.within === undefined ? undefined : readLiveWithin(a.within);
|
|
151
173
|
if (a.within !== undefined && !within)
|
|
152
174
|
return null;
|
|
175
|
+
// The same rule for an expiry: one that cannot be read is not "never expires".
|
|
176
|
+
const expiresAt = a.expiresAt === undefined ? undefined : liveInstant(a.expiresAt);
|
|
177
|
+
if (a.expiresAt !== undefined && !expiresAt)
|
|
178
|
+
return null;
|
|
153
179
|
return {
|
|
154
180
|
principal: a.principal,
|
|
155
181
|
tenantId: a.tenantId,
|
|
156
182
|
scopeId: a.scopeId,
|
|
157
183
|
since: a.since,
|
|
158
184
|
...(within ? { within } : {}),
|
|
185
|
+
...(expiresAt ? { expiresAt } : {}),
|
|
159
186
|
};
|
|
160
187
|
}
|
|
161
188
|
/**
|
|
@@ -171,6 +198,13 @@ export function readSubscription(attachment) {
|
|
|
171
198
|
* reaching it means something unusual happened rather than something normal being cut off.
|
|
172
199
|
*/
|
|
173
200
|
export const LIVE_FANOUT_LIMIT = 200;
|
|
201
|
+
/**
|
|
202
|
+
* How many times one row is decided for one subscriber before it is given up on (#938, Codex
|
|
203
|
+
* #2077 r4). A decision is redone when the store wrote while it was being taken; the pass runs
|
|
204
|
+
* inside the scope's queue, so a write landing then is rare, and one landing on every attempt
|
|
205
|
+
* means the store is busy enough that the client's poll is the better answer for this row.
|
|
206
|
+
*/
|
|
207
|
+
export const LIVE_DECIDE_ATTEMPTS = 3;
|
|
174
208
|
/** Is this request asking to be upgraded to a WebSocket? Defined in the kernel (#1859). */
|
|
175
209
|
export { isUpgradeRequest } from '@substrat-run/kernel';
|
|
176
210
|
/**
|
package/dist/live-reads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-reads.js","sourceRoot":"","sources":["../src/live-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"live-reads.js","sourceRoot":"","sources":["../src/live-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,aAAa,EACb,aAAa,GAKd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,eAAe,EAA0C,MAAM,sBAAsB,CAAC;AAEhH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE7D,uGAAuG;AACvG,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAA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AI,CAAC;IACnD,+EAA+E;IAC/E,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnF,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IACzD,OAAO;QACL,SAAS,EAAE,CAAC,CAAC,SAAwB;QACrC,QAAQ,EAAE,CAAC,CAAC,QAAoB;QAChC,OAAO,EAAE,CAAC,CAAC,OAAkB;QAC7B,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,2FAA2F;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC;AACjD,CAAC"}
|
package/dist/route-resolver.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface PeerCallTargetRowLike {
|
|
|
64
64
|
state: 'ok' | 'unknown' | 'not-primary' | 'inactive';
|
|
65
65
|
status: string | null;
|
|
66
66
|
};
|
|
67
|
-
outcome: 'resolved' | 'not-installed' | 'ambiguous';
|
|
67
|
+
outcome: 'resolved' | 'not-installed' | 'ambiguous' | 'bound-unavailable';
|
|
68
68
|
count: number;
|
|
69
69
|
target: {
|
|
70
70
|
scope_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-resolver.d.ts","sourceRoot":"","sources":["../src/route-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AAEH,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;mFAE+E;IAC/E,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;2FACuF;IACvF,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;mCAE+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;0EACsE;IACtE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAOD,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;AAEnF;yDACyD;AACzD,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CA2CpF;AAED,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,aAAc,MAAM,KAAG,MAAgC,CAAC;AAEtF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,aAAa,CAgBvF;AAgBD,yDAAyD;AACzD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QAAE,KAAK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AgB,CAAC,CA6EnE"}
|
package/dist/route-resolver.js
CHANGED
|
@@ -152,6 +152,13 @@ export function createPeerCallResolver(controlPlane) {
|
|
|
152
152
|
'bind the instance first',
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
+
if (row.outcome === 'bound-unavailable') {
|
|
156
|
+
return {
|
|
157
|
+
outcome: 'refused',
|
|
158
|
+
code: 'conflict',
|
|
159
|
+
message: `the bound instance of '${target}' is unavailable; rebind or clear this app's peer binding`,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
155
162
|
if (row.outcome === 'not-installed' || !row.target) {
|
|
156
163
|
return {
|
|
157
164
|
outcome: 'refused',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-resolver.js","sourceRoot":"","sources":["../src/route-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,GAGtB,MAAM,yBAAyB,CAAC;AA+CjC;yDACyD;AACzD,MAAM,UAAU,aAAa,CAAC,GAA6B;IACzD,gGAAgG;IAChG,gFAAgF;IAChF,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,mFAAmF;IACnF,iFAAiF;IACjF,+EAA+E;IAC/E,IAAI,aAAa,GAAoB,IAAI,CAAC;IAC1C,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAY,CAAC;YACxD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,kFAAkF;QACpF,CAAC;IACH,CAAC;IACD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E,MAAM,CAAC,KAAK,GAAG,CAAC;SACxB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/scope-do.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DurableObject } from 'cloudflare:workers';
|
|
2
2
|
import { type SwitchSql, type ModuleRegistration, type OperationHandler } from '@substrat-run/kernel';
|
|
3
3
|
import { type DoReply } from './do-reply.js';
|
|
4
|
+
import { splitSqlStatements } from '@substrat-run/kernel';
|
|
4
5
|
/**
|
|
5
6
|
* `defineScopeDO` — one Durable Object per scope, the CF analogue of a single
|
|
6
7
|
* `SqliteScopeHost` scope runtime (D-14). It closes over a CODE-TIME module set
|
|
@@ -39,12 +40,39 @@ export type TenantVerdict = 'recorded' | 'inferred' | 'foreign' | 'unknown';
|
|
|
39
40
|
* `invoke`'s envelope discipline, since a throw across the RPC keeps only its message.
|
|
40
41
|
*/
|
|
41
42
|
export type CapabilityAttachmentReply<T> = DoReply<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Split a SQL blob (a migration, the kernel/directory DDL) into its statements,
|
|
45
|
+
* honouring SQL syntax.
|
|
46
|
+
*
|
|
47
|
+
* The DO's `SqlStorage.exec` runs one statement per call, so a multi-statement
|
|
48
|
+
* blob is split on `;`. A naive `sql.split(';')` breaks the moment a `;` appears inside a
|
|
49
|
+
* `--`/`/* */` comment or a string literal — it truncates the statement and the DO
|
|
50
|
+
* reports "incomplete input". The SQLite adapter never hit this because
|
|
51
|
+
* better-sqlite3's `exec` takes the whole blob; this is what made a migration that
|
|
52
|
+
* passed on SQLite fail only on Durable Objects (the divergence this fix closes).
|
|
53
|
+
*
|
|
54
|
+
* So this is a small SQL-aware scanner: it skips line and block comments, copies
|
|
55
|
+
* string literals through verbatim (including the `''` escape), and splits only on
|
|
56
|
+
* a top-level `;`. Comments are dropped from the emitted statements — which also
|
|
57
|
+
* means a trailing comment can never become a comment-only "statement" that
|
|
58
|
+
* `exec` rejects. Blank fragments are skipped.
|
|
59
|
+
*
|
|
60
|
+
* **A trigger body is not top level.** `CREATE TRIGGER … BEGIN …; …; END;` carries
|
|
61
|
+
* semicolons that belong to the trigger, and splitting on them produces four
|
|
62
|
+
* fragments that are each a syntax error — the same "incomplete input" this
|
|
63
|
+
* function exists to prevent, from the other direction. So inside a `CREATE
|
|
64
|
+
* TRIGGER` the scanner keeps accumulating until a `;` that follows `END`. Found by
|
|
65
|
+
* #827's derived search index, which is the first thing in the repo to emit a
|
|
66
|
+
* trigger: it passed on better-sqlite3 (whose `exec` takes the whole blob) and
|
|
67
|
+
* failed every scope on the DO host.
|
|
68
|
+
*/
|
|
42
69
|
/**
|
|
43
70
|
* The kernel's two-method SQL handle (`SwitchSql`) over a Durable Object's storage — what the
|
|
44
71
|
* shared switch rules (#1666) and the directory's switch record (#1674) run through. One
|
|
45
72
|
* wrapper for both DOs, as the pure adapter has one `switchSqlOf`.
|
|
46
73
|
*/
|
|
47
74
|
export declare function switchSqlOver(sql: SqlStorage): SwitchSql;
|
|
48
|
-
|
|
75
|
+
/** The splitter both adapters run migrations through — the kernel's, re-exported for this package's callers. */
|
|
76
|
+
export { splitSqlStatements };
|
|
49
77
|
export declare function defineScopeDO(modules: ModuleRegistration[], bareOps: Record<string, OperationHandler<never, unknown>>): new (ctx: DurableObjectState, env: ScopeDoEnv) => DurableObject;
|
|
50
78
|
//# sourceMappingURL=scope-do.d.ts.map
|
package/dist/scope-do.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA2DnD,OAAO,EA6DL,KAAK,SAAS,EAsBd,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAqGtB,MAAM,sBAAsB,CAAC;AA6C9B,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAkBL,kBAAkB,EAgEnB,MAAM,sBAAsB,CAAC;AAyB9B;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAoFD,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAkjB5E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAmBtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAOxD;AAED,gHAAgH;AAChH,OAAO,EAAE,kBAAkB,EAAE,CAAC;AA2B9B,wBAAgB,aAAa,CAC3B,OAAO,EAAE,kBAAkB,EAAE,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,GACxD,KAAK,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,KAAK,aAAa,CA2yNjE"}
|