@substrat-run/adapter-cloudflare 0.137.0 → 0.139.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.
@@ -9,7 +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 type { PrincipalId, ScopeId, TenantId } from '@substrat-run/contracts';
12
+ import { type EntityRef, type PrincipalId, type ScopeId, type TenantId } from '@substrat-run/contracts';
13
+ import { type VouchedWithin } from '@substrat-run/kernel';
13
14
  /**
14
15
  * The path the coordinator fetches on the scope stub to open a subscription.
15
16
  *
@@ -31,6 +32,41 @@ export declare const LIVE_SUBSCRIBE_PATH = "/_substrat/live";
31
32
  export declare const LIVE_PRINCIPAL_HEADER = "x-substrat-live-principal";
32
33
  export declare const LIVE_TENANT_HEADER = "x-substrat-live-tenant";
33
34
  export declare const LIVE_SCOPE_HEADER = "x-substrat-live-scope";
35
+ /**
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
38
+ * the principal is. Absent means an unnarrowed feed.
39
+ */
40
+ export declare const LIVE_WITHIN_HEADER = "x-substrat-live-within";
41
+ /** A subscription's narrowing, as it is carried on the header and kept on the socket. */
42
+ export interface LiveWithin {
43
+ readonly entityType: string;
44
+ readonly entityId: string;
45
+ /**
46
+ * Set when the vertical vouched for the root (`vouchedWithin`): its stated reason, and
47
+ * the principal's own check is then NOT applied. Absent: the check is ANDed with the walk.
48
+ */
49
+ readonly vouched?: string;
50
+ }
51
+ /** Header-safe: a reason may carry any character, and a header value may not. */
52
+ export declare function encodeLiveWithin(within: LiveWithin): string;
53
+ /**
54
+ * Read a narrowing back — from the header, or from a socket's attachment. `undefined`
55
+ * for a value that is not one, so the caller can refuse it rather than open the feed
56
+ * wider than was asked: a malformed narrowing is never read as "no narrowing".
57
+ */
58
+ export declare function readLiveWithin(value: unknown): LiveWithin | undefined;
59
+ /**
60
+ * What `subscribe`'s `within` argument asks for, as the narrowing the scope keeps.
61
+ *
62
+ * Only two shapes are accepted: a value `vouchedWithin` built, and a plain `EntityRef`.
63
+ * Anything else throws — in particular an object that LOOKS vouched (`{ entity, because }`)
64
+ * but was not built by `vouchedWithin`: read as a plain ref it has no type or id, and the
65
+ * only other reading would drop the principal's check on the caller's say-so.
66
+ */
67
+ export declare function liveWithinOf(within: EntityRef | VouchedWithin | undefined): LiveWithin | undefined;
68
+ /** `readLiveWithin` over the header's encoding. */
69
+ export declare function decodeLiveWithin(header: string): LiveWithin | undefined;
34
70
  /**
35
71
  * Set on every refusal this surface returns, so a client can tell "no push here, poll"
36
72
  * from "your request was wrong" without parsing a body or guessing from a status.
@@ -78,6 +114,8 @@ export interface LiveSubscription {
78
114
  readonly scopeId: ScopeId;
79
115
  /** When the subscription was accepted (ISO 8601) — for the roster read, and for logs. */
80
116
  readonly since: string;
117
+ /** The root the feed is narrowed to (#1853). Absent on an unnarrowed one, and on every socket opened before it existed. */
118
+ readonly within?: LiveWithin;
81
119
  }
82
120
  /**
83
121
  * Read a socket's subscription back, or `null` if it does not have a usable one.
@@ -1 +1 @@
1
- {"version":3,"file":"live-reads.d.ts","sourceRoot":"","sources":["../src/live-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;;;;;;;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;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE7E;;;;;;;;;;;;;;;GAeG;AACH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G,OAAO,CAE1D"}
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Live reads (#938) — the wire between the coordinator and the scope's Durable Object.
3
+ *
4
+ * The two halves of the live-read path live in different files for different reasons:
5
+ * `host.ts` owns the door (who is asking, and whether this connection can carry a push
6
+ * at all) and `scope-do.ts` owns the subscription and the fan-out (which committed
7
+ * events this subscriber may be told about). Everything they must agree on is here, so
8
+ * neither end can drift from the other by editing its own file.
9
+ *
10
+ * Nothing in this module reaches the network or the database. It is names and shapes.
11
+ */
12
+ import { substratError } from '@substrat-run/contracts';
13
+ import { isVouchedWithin } from '@substrat-run/kernel';
1
14
  /**
2
15
  * The path the coordinator fetches on the scope stub to open a subscription.
3
16
  *
@@ -19,6 +32,66 @@ export const LIVE_SUBSCRIBE_PATH = '/_substrat/live';
19
32
  export const LIVE_PRINCIPAL_HEADER = 'x-substrat-live-principal';
20
33
  export const LIVE_TENANT_HEADER = 'x-substrat-live-tenant';
21
34
  export const LIVE_SCOPE_HEADER = 'x-substrat-live-scope';
35
+ /**
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
38
+ * the principal is. Absent means an unnarrowed feed.
39
+ */
40
+ export const LIVE_WITHIN_HEADER = 'x-substrat-live-within';
41
+ /** Header-safe: a reason may carry any character, and a header value may not. */
42
+ export function encodeLiveWithin(within) {
43
+ return encodeURIComponent(JSON.stringify(within));
44
+ }
45
+ /**
46
+ * Read a narrowing back — from the header, or from a socket's attachment. `undefined`
47
+ * for a value that is not one, so the caller can refuse it rather than open the feed
48
+ * wider than was asked: a malformed narrowing is never read as "no narrowing".
49
+ */
50
+ export function readLiveWithin(value) {
51
+ if (typeof value !== 'object' || value === null)
52
+ return undefined;
53
+ const w = value;
54
+ if (typeof w.entityType !== 'string' || w.entityType === '')
55
+ return undefined;
56
+ if (typeof w.entityId !== 'string' || w.entityId === '')
57
+ return undefined;
58
+ if (w.vouched !== undefined && (typeof w.vouched !== 'string' || w.vouched.trim() === ''))
59
+ return undefined;
60
+ return {
61
+ entityType: w.entityType,
62
+ entityId: w.entityId,
63
+ ...(w.vouched !== undefined ? { vouched: w.vouched } : {}),
64
+ };
65
+ }
66
+ /**
67
+ * What `subscribe`'s `within` argument asks for, as the narrowing the scope keeps.
68
+ *
69
+ * Only two shapes are accepted: a value `vouchedWithin` built, and a plain `EntityRef`.
70
+ * Anything else throws — in particular an object that LOOKS vouched (`{ entity, because }`)
71
+ * but was not built by `vouchedWithin`: read as a plain ref it has no type or id, and the
72
+ * only other reading would drop the principal's check on the caller's say-so.
73
+ */
74
+ export function liveWithinOf(within) {
75
+ if (within === undefined)
76
+ return undefined;
77
+ if (isVouchedWithin(within)) {
78
+ return { entityType: within.entity.entityType, entityId: within.entity.entityId, vouched: within.because };
79
+ }
80
+ 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()');
83
+ }
84
+ return { entityType: plain.entityType, entityId: plain.entityId };
85
+ }
86
+ /** `readLiveWithin` over the header's encoding. */
87
+ export function decodeLiveWithin(header) {
88
+ try {
89
+ return readLiveWithin(JSON.parse(decodeURIComponent(header)));
90
+ }
91
+ catch {
92
+ return undefined;
93
+ }
94
+ }
22
95
  /**
23
96
  * Set on every refusal this surface returns, so a client can tell "no push here, poll"
24
97
  * from "your request was wrong" without parsing a body or guessing from a status.
@@ -72,11 +145,17 @@ export function readSubscription(attachment) {
72
145
  return null;
73
146
  if (typeof a.since !== 'string')
74
147
  return null;
148
+ // Present but unreadable is NOT "unnarrowed": that would widen the feed past what was
149
+ // asked for, and a vouched one past anything the principal could read.
150
+ const within = a.within === undefined ? undefined : readLiveWithin(a.within);
151
+ if (a.within !== undefined && !within)
152
+ return null;
75
153
  return {
76
154
  principal: a.principal,
77
155
  tenantId: a.tenantId,
78
156
  scopeId: a.scopeId,
79
157
  since: a.since,
158
+ ...(within ? { within } : {}),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;IACnD,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;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,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"}
@@ -1,6 +1,6 @@
1
1
  import { DurableObject } from 'cloudflare:workers';
2
- import { type WireFailure } from '@substrat-run/contracts';
3
2
  import { type SwitchSql, type ModuleRegistration, type OperationHandler } from '@substrat-run/kernel';
3
+ import { type DoReply } from './do-reply.js';
4
4
  /**
5
5
  * `defineScopeDO` — one Durable Object per scope, the CF analogue of a single
6
6
  * `SqliteScopeHost` scope runtime (D-14). It closes over a CODE-TIME module set
@@ -38,12 +38,7 @@ export type TenantVerdict = 'recorded' | 'inferred' | 'foreign' | 'unknown';
38
38
  * What a capability attachment verb (#1686) answers: its value, or its failure as DATA —
39
39
  * `invoke`'s envelope discipline, since a throw across the RPC keeps only its message.
40
40
  */
41
- export type CapabilityAttachmentReply<T> = {
42
- value: T;
43
- failure?: undefined;
44
- } | {
45
- failure: WireFailure;
46
- };
41
+ export type CapabilityAttachmentReply<T> = DoReply<T>;
47
42
  /**
48
43
  * The kernel's two-method SQL handle (`SwitchSql`) over a Durable Object's storage — what the
49
44
  * shared switch rules (#1666) and the directory's switch record (#1674) run through. One
@@ -1 +1 @@
1
- {"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAcL,KAAK,WAAW,EAyCjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAuCL,KAAK,SAAS,EAsBd,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAsFtB,MAAM,sBAAsB,CAAC;AAgG9B;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAwED,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAqhB5E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAgDxG;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAOxD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAwDxD;AAkBD,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,CAs2LjE"}
1
+ {"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA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