@substrat-run/adapter-cloudflare 0.82.0 → 0.84.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/host.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AttachmentRecord, type BlobStoreHandle, type ConnectionId, type ModuleId, type DomainEvent, type EntitlementGrant, type EntityRef, type ProjectedConnectionGrant, type ProjectedConnectionKey, type ProjectedIdentityLink, type PermissionKey, type PlatformActorId, type PrincipalId, type ResolvedIdentity, type QueryScopeInput, type ReadScopeTableInput, type RoleDefinition, type ScopeDump, type ScopeDumpTable, type ScopeId, type PlatformRequest, type PlatformRequestFilter, type PlatformRequestId, type PlatformRequestStatus, type ScopeTable, type ScopeQueryResult, type ScopeTablePage, type TenantId, type TenantStoreHandle } from '@substrat-run/contracts';
1
+ import { type AttachmentRecord, type BlobStoreHandle, type ConnectionId, type ModuleId, type DomainEvent, type EntitlementGrant, type EntityRef, type ProjectedConnectionGrant, type ProjectedConnectionKey, type ProjectedIdentityLink, type PermissionKey, type PlatformActorId, type PrincipalId, type ResolvedIdentity, type QueryScopeInput, type ReadScopeTableInput, type RoleDefinition, type ScopeDump, type ScopeDumpTable, type ScopeId, type PlatformRequest, type PlatformRequestFilter, type PlatformRequestId, type PlatformRequestStatus, type PlatformRequestFailure, type ScopeTable, type ScopeQueryResult, type ScopeTablePage, type TenantId, type TenantStoreHandle } from '@substrat-run/contracts';
2
2
  import { type BlobStoreProvisionInput, type ScopeAttachments, type AttachmentUploadInput, type OpenedAttachment, type ExecutorDeadLetter, type ExecutorDrainReport, type ExecutorHandler, type ExecutorRetryPolicy, type MigrateScopeOutcome, type MigrationFrontier, type ConnectorHandler, type ConnectorOptions, type FetchLike, type SecretBox, type HostAdmin, type ModuleRegistration, type OperationHandler, type PermissionChecker, type ProvisionScopeInput, type ScheduleRegistration, type ScheduleRunReport, type ScopeHost, type ScopeStub, type ScopeStubOptions, type TenantRelationalStore, type TenantStoreProvisionInput } from '@substrat-run/kernel';
3
3
  import { type D1TenantStores } from './d1.js';
4
4
  import { type R2BlobStores } from './r2.js';
@@ -54,6 +54,12 @@ export interface ConnectorDelegation {
54
54
  scopeId: ScopeId;
55
55
  vertical: string;
56
56
  attachmentId: string;
57
+ /**
58
+ * The delivery this read is for (#726 remedy B). The serving deployment resolves it
59
+ * against its OWN outbox to decide what may be read — so what crosses this seam is
60
+ * the name of a delivery, not a claim about which entity the platform may reach.
61
+ */
62
+ eventId?: string;
57
63
  }): Promise<OpenedAttachment | null>;
58
64
  /** Write the scope-local `connection:<id>` grant tuple in the serving deployment. */
59
65
  grant(args: {
@@ -219,6 +225,7 @@ export declare class CloudflareScopeHost implements ScopeHost {
219
225
  status: PlatformRequestStatus;
220
226
  result?: unknown;
221
227
  lastError?: string | null;
228
+ failure?: PlatformRequestFailure | null;
222
229
  }): Promise<void>;
223
230
  migrationFrontier(): MigrationFrontier;
224
231
  /**
@@ -341,7 +348,9 @@ export declare class CloudflareScopeHost implements ScopeHost {
341
348
  */
342
349
  private requireBlobStores;
343
350
  attachments(principal: PrincipalId, tenantId: TenantId, scopeId: ScopeId): Promise<ScopeAttachments>;
344
- getConnectorAttachments(connectionId: ConnectionId, scopeId: ScopeId): Promise<ScopeAttachments>;
351
+ getConnectorAttachments(connectionId: ConnectionId, scopeId: ScopeId, forEvent?: {
352
+ eventId: string;
353
+ }): Promise<ScopeAttachments>;
345
354
  /** Resolve the per-tenant R2 blob store, or fail closed exactly as `attachments` did. */
346
355
  private resolveAttachmentStore;
347
356
  /**
@@ -413,6 +422,15 @@ export declare class CloudflareScopeHost implements ScopeHost {
413
422
  private subjectKeysFor;
414
423
  private recordAccess;
415
424
  private recordAdmin;
425
+ /**
426
+ * The scope's own answer to "what may this connection do here" (#726 gap 1).
427
+ *
428
+ * Read from the ScopeDO's delivered tuples rather than the directory's grant rows:
429
+ * the two are different facts, and the one a caller wants when asking whether a
430
+ * dispatch will be refused is what this deployment would actually enforce. The
431
+ * directory's view stays on `HostAdmin.listConnectionGrants`.
432
+ */
433
+ connectionGrantsInScope(tenantId: TenantId, scopeId: ScopeId): Promise<ProjectedConnectionGrant[]>;
416
434
  private writeScopeTuple;
417
435
  /**
418
436
  * The connection's CURRENT public sealing key, minted on first ask (#687).
@@ -552,7 +570,7 @@ export declare class CloudflareScopeHost implements ScopeHost {
552
570
  * delivered `connection:<id>` tuple. `null` for an id this scope does not know,
553
571
  * so a caller falls back rather than failing a dispatch over a missing file.
554
572
  */
555
- connectorAttachmentOpenLocal(connectionId: ConnectionId, tenantId: TenantId, scopeId: ScopeId, attachmentId: string): Promise<OpenedAttachment | null>;
573
+ connectorAttachmentOpenLocal(connectionId: ConnectionId, tenantId: TenantId, scopeId: ScopeId, attachmentId: string, eventId?: string): Promise<OpenedAttachment | null>;
556
574
  /**
557
575
  * The delivery half of `grantToConnection` for a scope served HERE (#574): write
558
576
  * the scope-local `connection:<id>` grant tuple the permission checker reads.
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAwCpB,KAAK,YAAY,EAEjB,KAAK,QAAQ,EAUb,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAKd,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAI1B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAQhB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,KAAK,cAAc,EAGnB,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KAAK,OAAO,EAIZ,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE1B,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEnB,KAAK,QAAQ,EA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f;IAYD,sEAAsE;IAChE,oBAAoB,CACxB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC,CAGlB;IAED,qFAAqF;IAC/E,8BAA8B,CAClC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAI3B;IAED;;;;;;OAMG;IACG,4BAA4B,CAChC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAYlC;IAED;;;;;;OAMG;IACG,mBAAmB,CACvB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,aAAa,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAQf;CACF"}
package/dist/host.js CHANGED
@@ -1,4 +1,4 @@
1
- import { fromWireFailure, accessLogEntry, adminLogEntry, opsFailureEntry, attachmentRecord, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalChannel, verticalVersion, connection, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, entitlementGrant, entitlementGrantInput, instant, meterReading, subjectRef, createConnectionInput, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, subjectShredReceipt, platformRequest, connectorDispatchKind, outboundOfManifestJson, substratError, } from '@substrat-run/contracts';
1
+ import { fromWireFailure, accessLogEntry, adminLogEntry, opsFailureEntry, attachmentRecord, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalChannel, verticalVersion, connection, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, entitlementGrant, entitlementGrantInput, instant, meterReading, subjectRef, createConnectionInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, subjectShredReceipt, platformRequest, connectorDispatchKind, outboundOfManifestJson, substratError, } from '@substrat-run/contracts';
2
2
  import { normalizeHostname, toRouteTarget } from './route-resolver.js';
3
3
  import { attachmentBlobKey, entitlementDenial, foldMeterReading, parseValidationRecords, resolveScopeRecord, ulid, backoffAt, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, openSealed, } from '@substrat-run/kernel';
4
4
  import { tenantStoreDatabaseName } from './d1.js';
@@ -31,6 +31,7 @@ function rowToPlatformRequest(r) {
31
31
  status: r.status,
32
32
  attempts: r.attempts,
33
33
  lastError: r.last_error,
34
+ failure: r.last_failure == null ? null : JSON.parse(r.last_failure),
34
35
  result: r.result === null ? null : JSON.parse(r.result),
35
36
  requestedAt: r.requested_at,
36
37
  settledAt: r.settled_at,
@@ -158,7 +159,9 @@ export class CloudflareScopeHost {
158
159
  * taken from the event's scope, never from an argument — so a connector cannot
159
160
  * reach a credential another vertical connected even by accident.
160
161
  */
161
- async connectorContext(tenantId, scopeId, timeoutMs) {
162
+ async connectorContext(tenantId, scopeId, timeoutMs,
163
+ /** The delivery this context is FOR (#726) — the dispatch capability's whole basis. */
164
+ eventId) {
162
165
  const scope = await this.cp.getScopeRecord(tenantId, scopeId);
163
166
  const vertical = scope?.vertical ?? null;
164
167
  const admin = this.admin;
@@ -187,7 +190,13 @@ export class CloudflareScopeHost {
187
190
  // delegated read verb when the serving deployment is elsewhere (#574) —
188
191
  // the control plane holds the directory and the credential but not the
189
192
  // vertical's R2, so the bytes come back over the seam.
190
- openAttachment: (attachmentId) => this.getConnectorAttachments(open.id, scopeId).then((a) => a.open(attachmentId)),
193
+ // #726 gap 1: this connection's live grants IN THIS SCOPE, so a connector can
194
+ // assert its preconditions at the top of a dispatch rather than meeting a
195
+ // missing grant as a refusal several calls later.
196
+ grants: async () => (await this.connectionGrantsInScope(tenantId, scopeId))
197
+ .filter((g) => g.connectionId === open.id)
198
+ .map((g) => g.permission),
199
+ openAttachment: (attachmentId) => this.getConnectorAttachments(open.id, scopeId, { eventId }).then((a) => a.open(attachmentId)),
191
200
  // #687: open a cell the scope sealed TO this connection. The keyId-indexed
192
201
  // map goes in, never out — a connector receives the plaintext of one cell,
193
202
  // not a private key it could mislay. Retired keys are in the map too, so a
@@ -259,7 +268,7 @@ export class CloudflareScopeHost {
259
268
  report.routedToPlatform += 1;
260
269
  }
261
270
  else if (executor.kind === 'connector') {
262
- await executor.handler(await this.connectorContext(tenantId, scopeId, executor.timeoutMs), event);
271
+ await executor.handler(await this.connectorContext(tenantId, scopeId, executor.timeoutMs, event.id), event);
263
272
  await stub.recordExecutorAttempt(event.id, deliveryId, null, null);
264
273
  report.delivered += 1;
265
274
  }
@@ -305,7 +314,7 @@ export class CloudflareScopeHost {
305
314
  await this.cp.validateScopeAccess(tenantId, scopeId);
306
315
  this.causedBy = event.id;
307
316
  try {
308
- await handler(await this.connectorContext(tenantId, scopeId, options?.timeoutMs ?? 30_000), event);
317
+ await handler(await this.connectorContext(tenantId, scopeId, options?.timeoutMs ?? 30_000, event.id), event);
309
318
  }
310
319
  finally {
311
320
  this.causedBy = null;
@@ -329,7 +338,7 @@ export class CloudflareScopeHost {
329
338
  async settlePlatformRequest(tenantId, scopeId, id, outcome) {
330
339
  await this.cp.validateScopeAccess(tenantId, scopeId);
331
340
  await this.migrateAndRecord(scopeId);
332
- await this.scopeStub(scopeId).settlePlatformRequest(id, outcome.status, outcome.result === undefined ? null : JSON.stringify(outcome.result), outcome.lastError ?? null);
341
+ await this.scopeStub(scopeId).settlePlatformRequest(id, outcome.status, outcome.result === undefined ? null : JSON.stringify(outcome.result), outcome.lastError ?? null, outcome.failure == null ? null : JSON.stringify(outcome.failure));
333
342
  }
334
343
  migrationFrontier() {
335
344
  return { total: this.migrationTotal };
@@ -700,7 +709,7 @@ export class CloudflareScopeHost {
700
709
  const store = await this.resolveAttachmentStore(tenantId);
701
710
  return this.buildAttachmentSurface({ principal }, tenantId, scopeId, store);
702
711
  }
703
- async getConnectorAttachments(connectionId, scopeId) {
712
+ async getConnectorAttachments(connectionId, scopeId, forEvent) {
704
713
  // The exact door `getConnectorScope` opens — same (tenant, vertical) gate — but it
705
714
  // returns the attachment surface instead of the invoke stub, gated as the connection
706
715
  // rather than a principal (#476).
@@ -739,6 +748,10 @@ export class CloudflareScopeHost {
739
748
  scopeId,
740
749
  vertical,
741
750
  attachmentId,
751
+ // #726 remedy B: the delivery, resolved at the far end against the
752
+ // deployment's own outbox. Absent outside a dispatch, where the ordinary
753
+ // permission check still applies.
754
+ eventId: forEvent?.eventId,
742
755
  }),
743
756
  list: notDelegated('list'),
744
757
  remove: notDelegated('remove'),
@@ -746,7 +759,7 @@ export class CloudflareScopeHost {
746
759
  }
747
760
  await this.migrateAndRecord(scopeId);
748
761
  const store = await this.resolveAttachmentStore(conn.tenant_id);
749
- return this.buildAttachmentSurface({ connectionId }, conn.tenant_id, scopeId, store);
762
+ return this.buildAttachmentSurface({ connectionId }, conn.tenant_id, scopeId, store, forEvent);
750
763
  }
751
764
  /** Resolve the per-tenant R2 blob store, or fail closed exactly as `attachments` did. */
752
765
  async resolveAttachmentStore(tenantId) {
@@ -768,7 +781,9 @@ export class CloudflareScopeHost {
768
781
  * to the DO so its permission gate resolves against `connection:<id>` grants (and a denial is
769
782
  * attributed to the connection, not a laundered principal). Bytes never cross the DO boundary.
770
783
  */
771
- buildAttachmentSurface(subject, tenantId, scopeId, store) {
784
+ buildAttachmentSurface(subject, tenantId, scopeId, store,
785
+ /** The delivery admitting this surface's reads (#726 remedy B), when there is one. */
786
+ forEvent) {
772
787
  const connectionId = 'connectionId' in subject ? subject.connectionId : undefined;
773
788
  const createdBy = 'principal' in subject ? subject.principal : subject.connectionId;
774
789
  // The DO needs SOME principal-shaped value for `ctx.principal`; for a connection it is
@@ -810,7 +825,7 @@ export class CloudflareScopeHost {
810
825
  },
811
826
  list: (entity) => stub.attachmentList(entity, asPrincipalId, tenantId, scopeId, connectionId),
812
827
  open: async (attachmentId) => {
813
- const record = await stub.attachmentAuthorize(attachmentId, 'read', asPrincipalId, tenantId, scopeId, connectionId);
828
+ const record = await stub.attachmentAuthorize(attachmentId, 'read', asPrincipalId, tenantId, scopeId, connectionId, forEvent?.eventId);
814
829
  if (!record)
815
830
  return null;
816
831
  const obj = await store.get(attachmentBlobKey(scopeId, record.id));
@@ -2582,6 +2597,50 @@ export class CloudflareScopeHost {
2582
2597
  at: new Date().toISOString(),
2583
2598
  });
2584
2599
  }
2600
+ /**
2601
+ * The scope's own answer to "what may this connection do here" (#726 gap 1).
2602
+ *
2603
+ * Read from the ScopeDO's delivered tuples rather than the directory's grant rows:
2604
+ * the two are different facts, and the one a caller wants when asking whether a
2605
+ * dispatch will be refused is what this deployment would actually enforce. The
2606
+ * directory's view stays on `HostAdmin.listConnectionGrants`.
2607
+ */
2608
+ async connectionGrantsInScope(tenantId, scopeId) {
2609
+ await this.cp.validateScopeAccess(tenantId, scopeId);
2610
+ await this.migrateAndRecord(scopeId);
2611
+ const now = new Date().toISOString();
2612
+ // Both stores again, but the CF split is not the pure adapter's. The DO holds the
2613
+ // scope's own tuples plus whatever tenant-level ones were PROJECTED into it (the
2614
+ // CP-less shape); a scope with a live control plane has its tenant-level grants in
2615
+ // the directory instead, where the checker reads them from (`cp.tenantTuples`). Read
2616
+ // only the DO and a tenant-wide grant would be reported absent on exactly the
2617
+ // deployments that have a control plane — the fleet — while being enforced.
2618
+ const rows = [
2619
+ ...(await this.scopeStub(scopeId).listConnectionGrants(now)),
2620
+ ...(await this.cp.dumpTenantTuples(tenantId))
2621
+ .filter((r) => r.subject.startsWith('connection:') &&
2622
+ r.relation.startsWith('granted:') &&
2623
+ r.revoked_at === null &&
2624
+ (r.expires_at === null || r.expires_at > now))
2625
+ .map((r) => ({ subject: r.subject, relation: r.relation, expires_at: r.expires_at })),
2626
+ ];
2627
+ // One tuple per (connection, permission) however many stores answered.
2628
+ const seen = new Set();
2629
+ return rows
2630
+ .filter((r) => {
2631
+ const key = `${r.subject}\u0000${r.relation}`;
2632
+ if (seen.has(key))
2633
+ return false;
2634
+ seen.add(key);
2635
+ return true;
2636
+ })
2637
+ .sort((a, b) => a.subject.localeCompare(b.subject) || a.relation.localeCompare(b.relation))
2638
+ .map((r) => projectedConnectionGrant.parse({
2639
+ connectionId: r.subject.slice('connection:'.length),
2640
+ permission: r.relation.slice('granted:'.length),
2641
+ ...(r.expires_at ? { expiresAt: r.expires_at } : {}),
2642
+ }));
2643
+ }
2585
2644
  async writeScopeTuple(scopeId, subject, relation, object, expiresAt) {
2586
2645
  await this.scopeStub(scopeId).writeTuple(subject, relation, object, expiresAt);
2587
2646
  }
@@ -2896,10 +2955,13 @@ export class CloudflareScopeHost {
2896
2955
  * delivered `connection:<id>` tuple. `null` for an id this scope does not know,
2897
2956
  * so a caller falls back rather than failing a dispatch over a missing file.
2898
2957
  */
2899
- async connectorAttachmentOpenLocal(connectionId, tenantId, scopeId, attachmentId) {
2958
+ async connectorAttachmentOpenLocal(connectionId, tenantId, scopeId, attachmentId, eventId) {
2900
2959
  await this.migrateAndRecord(scopeId);
2901
2960
  const store = await this.resolveAttachmentStore(tenantId);
2902
- return this.buildAttachmentSurface({ connectionId }, tenantId, scopeId, store).open(attachmentId);
2961
+ return this.buildAttachmentSurface({ connectionId }, tenantId, scopeId, store,
2962
+ // #726 remedy B: the platform named a delivery; this deployment decides what that
2963
+ // delivery reaches, from its own spine row. Absent ⇒ the ordinary grant check.
2964
+ eventId === undefined ? undefined : { eventId }).open(attachmentId);
2903
2965
  }
2904
2966
  /**
2905
2967
  * The delivery half of `grantToConnection` for a scope served HERE (#574): write