@substrat-run/adapter-cloudflare 0.229.0 → 0.231.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.
Files changed (86) hide show
  1. package/dist/broker-lake.d.ts +27 -2
  2. package/dist/broker-lake.d.ts.map +1 -1
  3. package/dist/broker-lake.js +57 -3
  4. package/dist/broker-lake.js.map +1 -1
  5. package/dist/control-plane-do.d.ts +57 -18
  6. package/dist/control-plane-do.d.ts.map +1 -1
  7. package/dist/control-plane-do.js +154 -70
  8. package/dist/control-plane-do.js.map +1 -1
  9. package/dist/delivery-broker-do.d.ts +13 -1
  10. package/dist/delivery-broker-do.d.ts.map +1 -1
  11. package/dist/delivery-broker-do.js +43 -3
  12. package/dist/delivery-broker-do.js.map +1 -1
  13. package/dist/directory-cutover.d.ts +93 -1
  14. package/dist/directory-cutover.d.ts.map +1 -1
  15. package/dist/directory-cutover.js +91 -2
  16. package/dist/directory-cutover.js.map +1 -1
  17. package/dist/directory-objects.d.ts +12 -0
  18. package/dist/directory-objects.d.ts.map +1 -1
  19. package/dist/directory-objects.js +8 -1
  20. package/dist/directory-objects.js.map +1 -1
  21. package/dist/directory-placement.d.ts.map +1 -1
  22. package/dist/directory-placement.js +1 -0
  23. package/dist/directory-placement.js.map +1 -1
  24. package/dist/directory-tenant-connect-links.d.ts +40 -0
  25. package/dist/directory-tenant-connect-links.d.ts.map +1 -0
  26. package/dist/directory-tenant-connect-links.js +48 -0
  27. package/dist/directory-tenant-connect-links.js.map +1 -0
  28. package/dist/directory-tenant-identities.d.ts +30 -0
  29. package/dist/directory-tenant-identities.d.ts.map +1 -0
  30. package/dist/directory-tenant-identities.js +64 -0
  31. package/dist/directory-tenant-identities.js.map +1 -0
  32. package/dist/directory-tenant-tuples.d.ts +69 -3
  33. package/dist/directory-tenant-tuples.d.ts.map +1 -1
  34. package/dist/directory-tenant-tuples.js +52 -0
  35. package/dist/directory-tenant-tuples.js.map +1 -1
  36. package/dist/host.d.ts +27 -1
  37. package/dist/host.d.ts.map +1 -1
  38. package/dist/host.js +81 -9
  39. package/dist/host.js.map +1 -1
  40. package/dist/index.d.ts +6 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +9 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/peer-call-target.d.ts +16 -2
  45. package/dist/peer-call-target.d.ts.map +1 -1
  46. package/dist/peer-call-target.js +36 -6
  47. package/dist/peer-call-target.js.map +1 -1
  48. package/dist/route-read-model-publisher.d.ts.map +1 -1
  49. package/dist/route-read-model-publisher.js +4 -0
  50. package/dist/route-read-model-publisher.js.map +1 -1
  51. package/dist/route-resolver.d.ts +19 -2
  52. package/dist/route-resolver.d.ts.map +1 -1
  53. package/dist/route-resolver.js +25 -5
  54. package/dist/route-resolver.js.map +1 -1
  55. package/dist/scope-do.d.ts +19 -0
  56. package/dist/scope-do.d.ts.map +1 -1
  57. package/dist/scope-do.js +294 -8
  58. package/dist/scope-do.js.map +1 -1
  59. package/dist/scope-facets.d.ts +121 -0
  60. package/dist/scope-facets.d.ts.map +1 -0
  61. package/dist/scope-facets.js +98 -0
  62. package/dist/scope-facets.js.map +1 -0
  63. package/dist/scope-supervisor-do.d.ts +112 -0
  64. package/dist/scope-supervisor-do.d.ts.map +1 -0
  65. package/dist/scope-supervisor-do.js +529 -0
  66. package/dist/scope-supervisor-do.js.map +1 -0
  67. package/dist/scope-work.d.ts +1 -1
  68. package/dist/scope-work.js +1 -1
  69. package/dist/scope-work.js.map +1 -1
  70. package/dist/supplied-pass-box.d.ts +77 -0
  71. package/dist/supplied-pass-box.d.ts.map +1 -0
  72. package/dist/supplied-pass-box.js +265 -0
  73. package/dist/supplied-pass-box.js.map +1 -0
  74. package/dist/tenant-due-index-do.d.ts +76 -0
  75. package/dist/tenant-due-index-do.d.ts.map +1 -0
  76. package/dist/tenant-due-index-do.js +90 -0
  77. package/dist/tenant-due-index-do.js.map +1 -0
  78. package/dist/tenant-due-nudge.d.ts +67 -0
  79. package/dist/tenant-due-nudge.d.ts.map +1 -0
  80. package/dist/tenant-due-nudge.js +77 -0
  81. package/dist/tenant-due-nudge.js.map +1 -0
  82. package/dist/tenant-due-work-do.d.ts +53 -0
  83. package/dist/tenant-due-work-do.d.ts.map +1 -1
  84. package/dist/tenant-due-work-do.js +204 -5
  85. package/dist/tenant-due-work-do.js.map +1 -1
  86. package/package.json +12 -12
package/dist/host.js CHANGED
@@ -3,9 +3,9 @@ import { env as ambientEnv } from 'cloudflare:workers';
3
3
  import { isRewindRefusal, REWIND_REFUSED } from './rewind-refusal.js';
4
4
  import { isSystemDoorMoved, SYSTEM_DOOR_MOVED, SYSTEM_DOOR_REGATES } from './system-door.js';
5
5
  import { EXECUTOR_ROUTE_NOT_DUE } from './executor-route.js';
6
- import { delegatedReadParams, operationSeriesCount, fromWireFailure, isSubstratError, exportReadInput, exportedBatch, importBatch, importResult, pushedImport, importState, importsOfManifestJson, connectionLandingsOfManifestJson, connectorsOfManifestJson, exportsOfManifestJson, assertNoBindingShapeBreak, assertScopeTypesKept, importCursorMove, importCursorMoveAt, importCursorMoved, accessLogEntry, adminLogEntry, opsFailureEntry, opsFailureFingerprint, issueEntry, findingEntry, findingRuleEntry, sweepRunEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunsPayload, modelUsageEntry, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalTraceSampling, deploymentWireAuth, verticalChannel, verticalVersion, connection, capabilityExchange, mintedCapability, boundedBecomeMint, boundedBindLinkMint, boundedBecomeRevoke, boundedUnbind, entityRef, becomeLinkState, principalBecomeCapabilityInput, principalBindLinkInput, capabilityGrant, principalId, connectionGrant, connectionRevoke, connectionGrantRecord, connectionSecret, systemGrant, systemSwitch, systemSwitchOutcome, systemScheduleEntry, systemSwitchRecord, entitlementGrant, entitlementGrantInput, capabilityFilter, instant, meterReading, scopeStorageSample, requestDay, requestRollupDay, costDay, meterDay, meterDayTake, staleScope, staleScopeTake, verticalOwnerPeriod, subjectRef, createConnectionInput, connectLinkFilter, connectLinkKey, consumeConnectLinkInput, mintConnectLinkInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, delegatedReadRecord, ownerTransferAudit, memberChangeAudit, peerBindingAudit, connectionBindingAudit, copyMarkAudit, orphanSweepAudit, deliveryRedriveAudit, brokerDeadLetterAudit, subjectShredReceipt, subjectAccessReceipt, connectorDispatchKind, callsOfManifestJson, outboundOfManifestJson, SCOPE_GATE_REASONS, substratError, MODULE_OBJECTS_NOT_CARRIED, errorCodeOf, redrainEventsInput, coverage, peerCoverage, peerGrantsEntry, peerSwitch, peerSwitchOutcome, verticalCaller, verticalResolution, peerInstanceResolution, peerBinding as peerBindingSchema, appEnvironment as appEnvironmentSchema, environmentServeAcknowledgement, environmentEffects as environmentEffectsSchema, connectionReach as connectionReachSchema, verticalSlug, entityObjectRef, ATTACHMENT_BLOB_BINDING, blobStoreBindingName, lifecycleDelivery, scopeLifecycle, storeDriverDumpPageBytes, } from '@substrat-run/contracts';
6
+ import { delegatedReadParams, operationSeriesCount, fromWireFailure, isSubstratError, exportReadInput, exportedBatch, importBatch, importResult, pushedImport, importState, importsOfManifestJson, connectionLandingsOfManifestJson, connectorsOfManifestJson, exportsOfManifestJson, assertNoBindingShapeBreak, assertScopeTypesKept, importCursorMove, importCursorMoveAt, importCursorMoved, accessLogEntry, adminLogEntry, opsFailureEntry, opsFailureFingerprint, issueEntry, findingEntry, findingRuleEntry, sweepRunEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunsPayload, modelUsageEntry, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, storedVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalTraceSampling, deploymentWireAuth, verticalChannel, verticalVersion, connection, capabilityExchange, mintedCapability, boundedBecomeMint, boundedBindLinkMint, boundedBecomeRevoke, boundedUnbind, entityRef, becomeLinkState, principalBecomeCapabilityInput, principalBindLinkInput, capabilityGrant, principalId, connectionGrant, connectionRevoke, connectionGrantRecord, connectionSecret, systemGrant, systemSwitch, systemSwitchOutcome, systemScheduleEntry, systemSwitchRecord, entitlementGrant, entitlementGrantInput, capabilityFilter, instant, meterReading, scopeStorageSample, requestDay, requestRollupDay, costDay, meterDay, meterDayTake, staleScope, staleScopeTake, verticalOwnerPeriod, subjectRef, createConnectionInput, connectLinkFilter, connectLinkKey, consumeConnectLinkInput, mintConnectLinkInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, delegatedReadRecord, ownerTransferAudit, memberChangeAudit, peerBindingAudit, connectionBindingAudit, copyMarkAudit, orphanSweepAudit, deliveryRedriveAudit, brokerDeadLetterAudit, subjectShredReceipt, subjectAccessReceipt, connectorDispatchKind, callsOfManifestJson, outboundOfManifestJson, SCOPE_GATE_REASONS, substratError, MODULE_OBJECTS_NOT_CARRIED, errorCodeOf, redrainEventsInput, coverage, peerCoverage, peerGrantsEntry, peerSwitch, peerSwitchOutcome, verticalCaller, verticalResolution, peerInstanceResolution, peerBinding as peerBindingSchema, appEnvironment as appEnvironmentSchema, environmentServeAcknowledgement, environmentEffects as environmentEffectsSchema, connectionReach as connectionReachSchema, verticalSlug, entityObjectRef, ATTACHMENT_BLOB_BINDING, blobStoreBindingName, lifecycleDelivery, scopeLifecycle, storeDriverDumpPageBytes, } from '@substrat-run/contracts';
7
7
  import { normalizeHostname, toRouteTarget } from './route-resolver.js';
8
- import { prePromoteSnapshotExpiresAt } from '@substrat-run/kernel';
8
+ import { prePromoteSnapshotExpiresAt, jobSystemKeysOf, containerPassRegistration, registeredContainerPasses, serveContainerPassDoor, passDoorRequestOf, } from '@substrat-run/kernel';
9
9
  import { breakingWithinMajorRefusal, earlierMajorReleaseTarget, earlierMajorsOf, releaseWithinMajorRefusal } from '@substrat-run/kernel';
10
10
  import { classify as classifyRelease } from '@substrat-run/model-view/bump';
11
11
  import { ACCESS_SUMMARY_METHOD, AccessSummary, openAccessSummary } from '@substrat-run/kernel';
@@ -465,6 +465,8 @@ export class CloudflareScopeHost {
465
465
  crossVertical = new CrossVerticalRegistry();
466
466
  /** Module id → its declared recurring schedules (#383), for `registeredSchedules`/`runDueSchedules`. */
467
467
  moduleSchedules = new Map();
468
+ /** #3752: the keys each module's declared jobs hold as its system principal (`jobSystemKeysOf`). */
469
+ moduleJobKeys = new Map();
468
470
  /** #1706: every registered module's `peers`, as declared — read as one union per peer. */
469
471
  peerSources = [];
470
472
  /** #1232: declared freshness per module. Registered UNCONDITIONALLY — the schedule
@@ -489,6 +491,8 @@ export class CloudflareScopeHost {
489
491
  orphanSweepClock;
490
492
  /** The parsers attachment text is extracted with (K-43); the host's own, never imported here. */
491
493
  attachmentExtractors;
494
+ /** D-85 (#3752): `CloudflareScopeHostOptions.containerPasses`. */
495
+ containerPasses;
492
496
  attachmentTextBounds;
493
497
  executors = new Map();
494
498
  /**
@@ -575,6 +579,7 @@ export class CloudflareScopeHost {
575
579
  this.orphanSweepClock = options.orphanSweepClock ?? (() => new Date().toISOString());
576
580
  assertAttachmentExtractors(options.attachmentExtractors ?? []);
577
581
  this.attachmentExtractors = options.attachmentExtractors ?? [];
582
+ this.containerPasses = options.containerPasses;
578
583
  this.attachmentTextBounds = resolveAttachmentTextBounds(options.attachmentTextBounds);
579
584
  // #2498: whatever fetch is injected, a sized stream body reaches it converted (`fetchLikeOf`).
580
585
  this.fetchImpl = fetchLikeOf(options.fetch ?? globalFetch);
@@ -1018,7 +1023,15 @@ export class CloudflareScopeHost {
1018
1023
  };
1019
1024
  return runDueJobRuns({
1020
1025
  store: this.jobStore(tenantId, scopeId),
1021
- handlerFor: (run) => kernelJobFor(run, kernelJobs) ?? this.jobs.get(`${run.module_id}/${run.job}`),
1026
+ handlerFor: (run) => kernelJobFor(run, kernelJobs) ??
1027
+ // D-85 (#3752): a container placement hands the pass off; its end comes back through the door,
1028
+ // and the scope announces it (`job.run-ended`) in the transaction that writes it.
1029
+ containerPassRegistration(this.containerPasses ?? registeredContainerPasses(), run, {
1030
+ tenantId,
1031
+ scopeId,
1032
+ door: async (ticket) => this.containerPassDoorDeps(tenantId, scopeId, ticket),
1033
+ }) ??
1034
+ this.jobs.get(`${run.module_id}/${run.job}`),
1022
1035
  // D-85: a declared job's run with no handler here fails on its record instead of waiting forever.
1023
1036
  declared: (run) => this.declaredJobs.get(run.job)?.moduleId === run.module_id,
1024
1037
  now: () => new Date().toISOString(),
@@ -1030,6 +1043,31 @@ export class CloudflareScopeHost {
1030
1043
  limit: options?.limit,
1031
1044
  });
1032
1045
  }
1046
+ /** D-85 (#3752): what one detached container pass's door works with: its run's store and its module's files. */
1047
+ containerPassDoorDeps(tenantId, scopeId, ticket) {
1048
+ return {
1049
+ store: this.jobStore(tenantId, scopeId),
1050
+ ticket,
1051
+ now: () => new Date().toISOString(),
1052
+ files: () => this.getSystemAttachments(ticket.moduleId, tenantId, scopeId),
1053
+ };
1054
+ }
1055
+ /**
1056
+ * D-85 (#3752): the door one detached container pass reaches its run through, served by this
1057
+ * (the vertical's own) host, so the pass runs against the kernel the vertical shipped. The platform's
1058
+ * pass box calls it for every request its container makes to `run.substrat.internal`, with the
1059
+ * ticket the launch carried; `bundle` is the pass's code and `ended` tells the box the pass is over.
1060
+ * Every write is conditional on the ticket's lease, so a box that serves a stale ticket changes
1061
+ * nothing (`lease_lost`, 409).
1062
+ */
1063
+ async serveContainerPass(tenantId, scopeId, ticket, request, options = {}) {
1064
+ const reply = await serveContainerPassDoor(passDoorRequestOf(request), {
1065
+ ...this.containerPassDoorDeps(tenantId, scopeId, ticket),
1066
+ ...options,
1067
+ });
1068
+ const body = reply.body === null || typeof reply.body === 'string' ? reply.body : reply.body.stream;
1069
+ return new Response(body, { status: reply.status, headers: reply.headers });
1070
+ }
1033
1071
  async jobRuns(tenantId, scopeId, filter) {
1034
1072
  await this.validateScopeAccess(tenantId, scopeId, 'jobRuns');
1035
1073
  await this.migrateAndRecord(scopeId);
@@ -1945,6 +1983,9 @@ export class CloudflareScopeHost {
1945
1983
  if (registration.jobs)
1946
1984
  this.jobDeclarers.push({ manifest, jobs: registration.jobs });
1947
1985
  this.declaredJobs = jobs;
1986
+ const jobKeys = jobSystemKeysOf(registration.jobs);
1987
+ if (jobKeys.length > 0)
1988
+ this.moduleJobKeys.set(manifest.id, jobKeys);
1948
1989
  noteReservedKeys(this.reservedKeys, manifest);
1949
1990
  noteDeclaredKeys(this.declaredKeys, manifest);
1950
1991
  if (manifest.schedules && manifest.schedules.length > 0) {
@@ -2108,14 +2149,17 @@ export class CloudflareScopeHost {
2108
2149
  // not a grant, so no reconcile can seat it away; `restoreToSystem` is the only way back.
2109
2150
  // (`grantToSystem` still clears a tuple's tombstone, but it does not move the switch.)
2110
2151
  const seats = [];
2111
- for (const [moduleId, schedules] of this.moduleSchedules) {
2152
+ for (const moduleId of new Set([...this.moduleSchedules.keys(), ...this.moduleJobKeys.keys()])) {
2112
2153
  // #2993 part 3: only the modules this scope's type runs seat their schedules' grants.
2113
2154
  if (!scopeTypeRuns(this.scopeTypePlan, scopeType, moduleId))
2114
2155
  continue;
2115
2156
  const perms = new Set();
2116
- for (const s of schedules)
2157
+ for (const s of this.moduleSchedules.get(moduleId) ?? [])
2117
2158
  for (const p of s.permissions)
2118
2159
  perms.add(p);
2160
+ // #3752: and the keys its declared jobs' passes hold, seated the same way.
2161
+ for (const p of this.moduleJobKeys.get(moduleId) ?? [])
2162
+ perms.add(p);
2119
2163
  for (const perm of perms) {
2120
2164
  seats.push({ subject: `system:${moduleId}`, relation: `granted:${perm}`, object: `scope:${input.scopeId}`, expires_at: null });
2121
2165
  }
@@ -2370,11 +2414,34 @@ export class CloudflareScopeHost {
2370
2414
  async systemAttachmentsThrough(door, moduleId, tenantId, scopeId) {
2371
2415
  const store = await this.resolveAttachmentStore(tenantId);
2372
2416
  const stub = this.scopeStub(scopeId);
2417
+ const authorize = (attachmentId) => door.through(async (instance) => unwrapReply(await stub.systemAttachmentAuthorizeReply(attachmentId, moduleId, tenantId, scopeId, instance)));
2373
2418
  return {
2374
2419
  open: async (attachmentId) => {
2375
- const record = await door.through(async (instance) => unwrapReply(await stub.systemAttachmentAuthorizeReply(attachmentId, moduleId, tenantId, scopeId, instance)));
2420
+ const record = await authorize(attachmentId);
2376
2421
  return record ? this.openAttachmentBytes(store, scopeId, record) : null;
2377
2422
  },
2423
+ // #3752: a container pass reads a file as it is read, never whole into the worker.
2424
+ openStream: async (attachmentId, options) => {
2425
+ const record = await authorize(attachmentId);
2426
+ return record ? openAttachmentByteStream(store, attachmentBlobKey(scopeId, record.id), record, workerdSha256, options?.range) : null;
2427
+ },
2428
+ // #3752: a module's own file (a container pass's output). Bytes first, row second, as every
2429
+ // upload: an answered refusal compensates the object away (`compensatingRefusal`).
2430
+ upload: async (input) => {
2431
+ const id = ulid();
2432
+ const key = attachmentBlobKey(scopeId, id);
2433
+ const fields = {
2434
+ id,
2435
+ entity: input.entity,
2436
+ filename: input.filename,
2437
+ contentType: input.contentType,
2438
+ visibility: input.visibility,
2439
+ createdBy: JSON.stringify({ system: moduleId }),
2440
+ createdAt: new Date().toISOString(),
2441
+ };
2442
+ const record = await putAttachmentBytes(store, key, fields, input.body, workerdSha256);
2443
+ return door.through(async (instance) => unwrapReply(await compensatingRefusal(store, key, () => stub.systemAttachmentAddReply(record, moduleId, tenantId, scopeId, instance))));
2444
+ },
2378
2445
  remove: async (attachmentId) => {
2379
2446
  const removed = await door.through(async (instance) => unwrapReply(await stub.systemAttachmentRemoveReply(attachmentId, moduleId, tenantId, scopeId, instance)));
2380
2447
  // Row (and event) first, bytes second: at worst an orphaned object, never a dangling row.
@@ -4412,6 +4479,7 @@ export class CloudflareScopeHost {
4412
4479
  origin: r.origin_json ? JSON.parse(r.origin_json) : null,
4413
4480
  outbound,
4414
4481
  calls,
4482
+ bundleDigest: r.bundle_digest ?? null,
4415
4483
  createdAt: r.created_at,
4416
4484
  });
4417
4485
  const mapOrg = (r) => orgSchema.parse({
@@ -5671,7 +5739,8 @@ export class CloudflareScopeHost {
5671
5739
  return rows.map(mapVertical);
5672
5740
  },
5673
5741
  publishVersion: async (actor, input) => {
5674
- const parsed = publishVersionInput.parse(input);
5742
+ // #3612: the stored input, whose `bundleDigest` only the control plane's own push sets.
5743
+ const parsed = storedVersionInput.parse(input);
5675
5744
  const owning = await this.cp.readVertical(parsed.verticalSlug);
5676
5745
  if (!owning) {
5677
5746
  throw substratError('not_found', `unknown vertical '${parsed.verticalSlug}'`);
@@ -9467,11 +9536,14 @@ export class CloudflareScopeHost {
9467
9536
  /** #2993 part 3: only the modules this type runs seat their schedule and peer grants. */
9468
9537
  scopeType) {
9469
9538
  return [
9470
- ...[...this.moduleSchedules].filter(([modId]) => scopeTypeRuns(this.scopeTypePlan, scopeType, modId)).flatMap(([modId, schedules]) => {
9539
+ ...[...new Set([...this.moduleSchedules.keys(), ...this.moduleJobKeys.keys()])].filter((modId) => scopeTypeRuns(this.scopeTypePlan, scopeType, modId)).flatMap((modId) => {
9471
9540
  const perms = new Set();
9472
- for (const s of schedules)
9541
+ for (const s of this.moduleSchedules.get(modId) ?? [])
9473
9542
  for (const p of s.permissions)
9474
9543
  perms.add(p);
9544
+ // #3752: and the keys its declared jobs' passes hold.
9545
+ for (const p of this.moduleJobKeys.get(modId) ?? [])
9546
+ perms.add(p);
9475
9547
  return [...perms].map((perm) => ({ subject: `system:${modId}`, relation: `granted:${perm}`, object: `scope:${scopeId}`, expires_at: null }));
9476
9548
  }),
9477
9549
  ...peerSeats(collectPeers(this.peerSourcesOf(scopeType)), scopeId).map((seat) => ({ ...seat, expires_at: null })),