@substrat-run/adapter-cloudflare 0.141.0 → 0.143.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/connector-calls.d.ts +74 -7
- package/dist/connector-calls.d.ts.map +1 -1
- package/dist/connector-calls.js +56 -6
- package/dist/connector-calls.js.map +1 -1
- package/dist/control-plane-do.d.ts +20 -3
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +59 -10
- package/dist/control-plane-do.js.map +1 -1
- package/dist/host.d.ts +74 -11
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +139 -43
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/live-reads.d.ts +10 -2
- package/dist/live-reads.d.ts.map +1 -1
- package/dist/live-reads.js +10 -2
- package/dist/live-reads.js.map +1 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +91 -18
- package/dist/scope-do.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* driving `drainDue`/`runDueSchedules` per scope (#461)
|
|
15
15
|
*/
|
|
16
16
|
export { CloudflareScopeHost } from './host.js';
|
|
17
|
-
export type { CloudflareScopeHostOptions, ConnectorDelegation, EventDrainDelegation, PeerSwitchDelegation, ImportCursorDelegation, SystemSwitchDelegation, LifecycleDelegation, LifecycleDeliveryReport, } from './host.js';
|
|
17
|
+
export type { CloudflareScopeHostOptions, ConnectorDelegation, EventDrainDelegation, PeerSwitchDelegation, ImportCursorDelegation, CapabilityDelegation, SystemSwitchDelegation, LifecycleDelegation, LifecycleDeliveryReport, } from './host.js';
|
|
18
18
|
export { defineScopeDO } from './scope-do.js';
|
|
19
19
|
export { ControlPlaneDO } from './control-plane-do.js';
|
|
20
20
|
export { OperationQueue } from './serialization.js';
|
package/dist/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B,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACjF,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,oCAAoC,EACpC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,6 @@ export { createD1TenantStores, d1TenantRelationalStore, tenantStoreDatabaseName,
|
|
|
27
27
|
export { blobStoreBucketName, createR2BlobStores, r2TenantBlobStore, } from './r2.js';
|
|
28
28
|
export { createRouteResolver } from './route-resolver.js';
|
|
29
29
|
export { cloudflareClientContext, cloudflareGeo } from './client-context.js';
|
|
30
|
-
// #1978:
|
|
30
|
+
// #1978: moved here from the kernel — the hosted connector-call recorder.
|
|
31
31
|
export { analyticsEngineConnectorCallRecorder, CONNECTOR_CALL_DATA_POINT_LAYOUT, connectorCallDataPoint, } from './connector-calls.js';
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,6FAA6F;AAC7F,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,6BAA6B,GAK9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQjF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7E,0EAA0E;AAC1E,OAAO,EACL,oCAAoC,EACpC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC"}
|
package/dist/live-reads.d.ts
CHANGED
|
@@ -91,11 +91,19 @@ export declare function decodeLiveWithin(header: string): LiveWithin | undefined
|
|
|
91
91
|
* fact the client can log, display, and report.
|
|
92
92
|
*
|
|
93
93
|
* Defined in `@substrat-run/contracts` (#1859, #1978), because the pure host's `501` names
|
|
94
|
-
* it too and a vertical's dev server should not import this adapter to spell it.
|
|
94
|
+
* it too and a vertical's dev server should not import this adapter to spell it. The close
|
|
95
|
+
* codes (`LIVE_CLOSE`) live there for the same reason: a browser reads them.
|
|
95
96
|
* Re-exported here so `host.ts` and `scope-do.ts` keep reading every wire name from this
|
|
96
97
|
* one file.
|
|
97
98
|
*/
|
|
98
|
-
export { LIVE_MODE_HEADER, type LiveRefusal } from '@substrat-run/contracts';
|
|
99
|
+
export { LIVE_CLOSE, LIVE_MODE_HEADER, type LiveRefusal } from '@substrat-run/contracts';
|
|
100
|
+
/**
|
|
101
|
+
* How many live sockets one principal may hold on one scope (#938). A tab holds one per
|
|
102
|
+
* feed (the desk's, and one per open conversation in ticket0's portal), and each socket is
|
|
103
|
+
* work on every post-commit pass, so a principal opening more is a cost on everybody else
|
|
104
|
+
* writing to the scope. Eight covers several tabs; past it a socket is closed `4429`.
|
|
105
|
+
*/
|
|
106
|
+
export declare const LIVE_SOCKETS_PER_PRINCIPAL = 8;
|
|
99
107
|
/**
|
|
100
108
|
* Cloudflare's own per-request marker for orange-to-orange routing.
|
|
101
109
|
*
|
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;;;;;;;;;;GAU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,SAAS,GAAG,UAAU,GAAG,SAAS,CAgBlH;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAMvE;AAED;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEzF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2HAA2H;IAC3H,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAsB7E;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,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
|
@@ -124,11 +124,19 @@ export function decodeLiveWithin(header) {
|
|
|
124
124
|
* fact the client can log, display, and report.
|
|
125
125
|
*
|
|
126
126
|
* Defined in `@substrat-run/contracts` (#1859, #1978), because the pure host's `501` names
|
|
127
|
-
* it too and a vertical's dev server should not import this adapter to spell it.
|
|
127
|
+
* it too and a vertical's dev server should not import this adapter to spell it. The close
|
|
128
|
+
* codes (`LIVE_CLOSE`) live there for the same reason: a browser reads them.
|
|
128
129
|
* Re-exported here so `host.ts` and `scope-do.ts` keep reading every wire name from this
|
|
129
130
|
* one file.
|
|
130
131
|
*/
|
|
131
|
-
export { LIVE_MODE_HEADER } from '@substrat-run/contracts';
|
|
132
|
+
export { LIVE_CLOSE, LIVE_MODE_HEADER } from '@substrat-run/contracts';
|
|
133
|
+
/**
|
|
134
|
+
* How many live sockets one principal may hold on one scope (#938). A tab holds one per
|
|
135
|
+
* feed (the desk's, and one per open conversation in ticket0's portal), and each socket is
|
|
136
|
+
* work on every post-commit pass, so a principal opening more is a cost on everybody else
|
|
137
|
+
* writing to the scope. Eight covers several tabs; past it a socket is closed `4429`.
|
|
138
|
+
*/
|
|
139
|
+
export const LIVE_SOCKETS_PER_PRINCIPAL = 8;
|
|
132
140
|
/**
|
|
133
141
|
* Cloudflare's own per-request marker for orange-to-orange routing.
|
|
134
142
|
*
|
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,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,uB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,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA4DnD,OAAO,EA2DL,KAAK,SAAS,EAsBd,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAqGtB,MAAM,sBAAsB,CAAC;AAmD9B,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAkBL,kBAAkB,EAsEnB,MAAM,sBAAsB,CAAC;AA0B9B;;;;;;;;;;;;;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;AAsjB5E;;;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,CAAC,UAAU,CAAC,CA46N7E"}
|
package/dist/scope-do.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { REWIND_REFUSED } from './rewind-refusal.js';
|
|
2
2
|
import { SYSTEM_DOOR_MOVED } from './system-door.js';
|
|
3
3
|
import { DurableObject } from 'cloudflare:workers';
|
|
4
|
-
import { ATTACHMENT_ADDED, ATTACHMENT_REMOVED, attachmentRecord, domainEvent, domainEventInput, eventId, instant, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, toWireFailure, grantRefFromProof, principalId, scopeId as scopeIdOf, tenantId as tenantIdOf, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, MAX_PENDING_SWEEP_RUNS, SWEEP_RUNS_KIND, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, listLimitOf, pageOf, countedPageOf, requestFingerprint, substratError, errorCodeOf, assertReplayableDump, REDRAIN_BATCH, } from '@substrat-run/contracts';
|
|
5
|
-
import { ulid,
|
|
6
|
-
import { isUpgradeRequest, readSubscription, LIVE_DECIDE_ATTEMPTS, LIVE_FANOUT_LIMIT, LIVE_MODE_HEADER, LIVE_PRINCIPAL_HEADER, LIVE_SCOPE_HEADER, LIVE_SUBSCRIBE_PATH, LIVE_TENANT_HEADER, LIVE_WITHIN_HEADER, LIVE_EXPIRES_HEADER, decodeLiveWithin, liveInstant, } from './live-reads.js';
|
|
4
|
+
import { ATTACHMENT_ADDED, ATTACHMENT_REMOVED, attachmentRecord, domainEvent, domainEventInput, eventId, instant, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, toWireFailure, grantRefFromProof, principalId, principalBecomeCapabilityInput, scopeId as scopeIdOf, tenantId as tenantIdOf, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, MAX_PENDING_SWEEP_RUNS, SWEEP_RUNS_KIND, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, listLimitOf, pageOf, countedPageOf, requestFingerprint, substratError, errorCodeOf, assertReplayableDump, REDRAIN_BATCH, } from '@substrat-run/contracts';
|
|
5
|
+
import { ulid, DO_SQL_LIMITS, unknownRoleError, createUlid, assertAllowed, ConnectionSealingKeyUnavailableError, noSealingKeyMessage, sealTo, assertReadOnlyQuery, entitlementDenial, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, eraseSubjectFromModules, moduleErasurePlan, redactSubjectScopeText, assertRowLimit, assertRowOffset, JOB_RUN_PATCH_SQL, JOB_RUN_CLAIM_SQL, JOB_RUN_RENEW_SQL, JOB_RUN_BEGIN_SQL, JOB_RUN_MISS_SQL, JOB_RUN_MISS_SETTLE_SQL, admissionMissOutcome, JOB_LEASE_EXPIRED_NOTE, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, delegatedRevokeSql, writeExplicitTupleIn, grantEntityShapeIn, topUpEntityGrantShapes, applyScopeRoleChange, changeScopeRole, revokeScopeRoles, scopeRoleHolders, effectiveRoleGrantQuery, switchRecordedOff, switchSystemSchedules, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, PermissionDenied, assertImpersonationWrites, assertModuleEnqueueableKind, impersonationStampOf, createAtomic, NotSearchable, isSearchIndexTable, searchIndexPlans, NotListable, listIndexPlans, moduleMigrations, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSteps, planMigrations, listQuery, cursorOf, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, attachmentRecordOfRow, enqueueAttachmentText, reconcileAttachmentText, queueAttachmentTextBackfill, startAttachmentTextBackfill, recordAttachmentText, searchAttachments, IDEMPOTENCY_DDL, REFUSALS_TABLE_DDL, REFUSALS_INDEX, refusalInsert, refusalOf, markGuardRefusal, REFUSALS_REBUILD, refusalsAdmitGuards, assertIdempotencyKey, assertPermissionKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, emptyImportResult, IMPORT_CURSORS_SQL, IMPORT_CURSOR_OF_SQL, OUTBOX_MARK_SQL, exportedSinceQuery, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, JOB_RUN_DUE_AT, jobRunListLimit, SYSTEM_DOOR_WAIT, ancestorsWithin, } from '@substrat-run/kernel';
|
|
6
|
+
import { isUpgradeRequest, readSubscription, LIVE_DECIDE_ATTEMPTS, LIVE_FANOUT_LIMIT, LIVE_MODE_HEADER, LIVE_PRINCIPAL_HEADER, LIVE_SCOPE_HEADER, LIVE_SUBSCRIBE_PATH, LIVE_TENANT_HEADER, LIVE_WITHIN_HEADER, LIVE_EXPIRES_HEADER, LIVE_CLOSE, LIVE_SOCKETS_PER_PRINCIPAL, decodeLiveWithin, liveInstant, } from './live-reads.js';
|
|
7
7
|
import { replyOf } from './do-reply.js';
|
|
8
8
|
import { OperationQueue } from './serialization.js';
|
|
9
9
|
import { assertNoWorkerdStorage, doScopedSql, doBuiltColumnsOf, doRedactionSql, doSpineSql } from './sql.js';
|
|
10
|
-
import { actorOf, admitPeer, collectPeers, switchPeer, peerSubjectRef, subjectGrantState, assertNoSecret, CAPABILITY_DDL, COPY_ORIGIN_DDL, ENTITY_STATE_MOVES_DDL, SWITCH_FENCES_DDL, TABLE_OWNERS_DDL, assertMigrationLeavesLedgerAlone, recordOwnershipSteps, runMigrationStatements, splitSqlStatements, executableSqlStatements, blankSqlComments, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, createCapabilityVerbs, createEntityEdgeVerbs, createEntityStateVerbs, createTrashedReads, CONTINUATION_POSITION_CAP, visibleContinuation, searchStateWhere, uncheckedView, addStatePlans, assertNoCallerPurge, isUnreachableParent, PURGE_BATCH, heldPurgePass, lifecycleRefusal, purgeHeldBy, purgeDueOf, purgeOnlyKeysOf, runPurgePass, refuseTrashedTarget, registerTrashTargets, withheldKeysFor, statefulTablesOf, afterMigration, afterRuntimeDdl, derivesAnything, repairDerivedObjects, StateColumnLost, exchangeCapability, guardSecrets, mintBecomeCapability, redactSecrets, redactSecretText, moduleLog, asyncInvocationId, asyncLinePass, resolveCapabilitySession, revokeCapabilityAsPlatform, readCapabilityPage, domainEventOf, facetEvents, readDeadLetters, readLifecycleFlow, readOperationSeries, readHistory, readInvocation, readUndrainedOutbox, walkEventCause, walkEventEffects, } from '@substrat-run/kernel';
|
|
10
|
+
import { actorOf, admitPeer, collectPeers, switchPeer, peerSubjectRef, subjectGrantState, assertNoSecret, CAPABILITY_DDL, COPY_ORIGIN_DDL, ENTITY_STATE_MOVES_DDL, SWITCH_FENCES_DDL, TABLE_OWNERS_DDL, assertMigrationLeavesLedgerAlone, recordOwnershipSteps, runMigrationStatements, splitSqlStatements, executableSqlStatements, blankSqlComments, CAPABILITY_EXCHANGE_OPERATION, CAPABILITY_BECOME_MINT_OPERATION, becomeMintCheck, mintBecomeCapabilityAsPrincipal, revokeBecomeCapabilityAsPrincipal, readBecomeLinkStates, capabilityAttachmentWriteRefused, createCapabilityVerbs, createEntityEdgeVerbs, createEntityStateVerbs, createTrashedReads, CONTINUATION_POSITION_CAP, visibleContinuation, searchStateWhere, uncheckedView, addStatePlans, assertNoCallerPurge, isUnreachableParent, PURGE_BATCH, heldPurgePass, lifecycleRefusal, purgeHeldBy, purgeDueOf, purgeOnlyKeysOf, runPurgePass, refuseTrashedTarget, assertBoundOperations, registerTrashTargets, withheldKeysFor, statefulTablesOf, afterMigration, afterRuntimeDdl, derivesAnything, repairDerivedObjects, StateColumnLost, exchangeCapability, guardSecrets, mintBecomeCapability, redactSecrets, redactSecretText, moduleLog, asyncInvocationId, asyncLinePass, resolveCapabilitySession, revokeCapabilityAsPlatform, readCapabilityPage, domainEventOf, facetEvents, readDeadLetters, readLifecycleFlow, readOperationSeries, readHistory, readInvocation, readUndrainedOutbox, walkEventCause, walkEventEffects, } from '@substrat-run/kernel';
|
|
11
11
|
import { COPY_RESTORE_FENCE_LAPSED, copyRestoreFenceLapsed } from '@substrat-run/kernel';
|
|
12
12
|
import { createDoTupleChecker, createLocalControlPlaneReader, scopeTupleReader } from './checker.js';
|
|
13
13
|
import { settlePlatformRequestIn } from '@substrat-run/kernel';
|
|
14
14
|
import { CARRIED_AWAY_KEY, COPY_MARK_CLEARED_KEY, KEPT_COPY_REFUSAL, KEPT_DIVERGENT_KEY, LOAD_STAMP_KEY, STORE_LOCAL_META_KEYS, WRITE_REVISION_KEY, carriedAwayDump, isCopyMarkInsert, isWriteStatement, assertSpineTablesBuilt, capabilitiesForLoad, clearCopyMarker, dumpRowsInsert, isSpineTable, markCopyOrigin, repointScopeGrants, settleCopiedWork, emittedHere, IS_COPY_SQL, isCopyLoad, isLifecycleWrite, readLifecycle, settleLifecycleAfterLoad, writeLifecycle, spineColumnAdditions } from '@substrat-run/kernel';
|
|
15
|
-
import { GRANT_CHILDREN_INDEX_DDL, grantedEntitiesForContext } from '@substrat-run/kernel';
|
|
15
|
+
import { GRANT_CHILDREN_INDEX_DDL, SHAPE_MARKER_INDEX_DDL, grantedEntitiesForContext } from '@substrat-run/kernel';
|
|
16
16
|
/** A scope's migration journal: `module@version` → the SQL digest it recorded (#2066). */
|
|
17
17
|
function readAppliedMigrations(sql) {
|
|
18
18
|
const rows = sql.exec('SELECT module_id, version, sql_digest FROM _substrat_migrations').toArray();
|
|
@@ -220,6 +220,7 @@ const KERNEL_DDL = `
|
|
|
220
220
|
PRIMARY KEY (subject, relation, object)
|
|
221
221
|
);
|
|
222
222
|
${GRANT_CHILDREN_INDEX_DDL};
|
|
223
|
+
${SHAPE_MARKER_INDEX_DDL};
|
|
223
224
|
CREATE TABLE IF NOT EXISTS _substrat_deliveries (
|
|
224
225
|
event_id TEXT NOT NULL,
|
|
225
226
|
consumer_module TEXT NOT NULL,
|
|
@@ -832,8 +833,10 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
832
833
|
// -- module registration (port of SqliteScopeHost.registerModule) ---------
|
|
833
834
|
registerModule(registration) {
|
|
834
835
|
const manifest = registration.manifest;
|
|
836
|
+
// #1835: the binder's own value, or nothing registers — as in the pure adapter.
|
|
837
|
+
assertBoundOperations(manifest.id, registration.operations);
|
|
835
838
|
// #119: refused before anything is recorded, as in the pure adapter.
|
|
836
|
-
const trashTargets = registerTrashTargets(manifest.id, new Set(Object.keys(registration.operations ?? {})), registration.
|
|
839
|
+
const trashTargets = registerTrashTargets(manifest.id, new Set(Object.keys(registration.operations?.handlers ?? {})), registration.operations?.inputs, manifest.entityStates, manifest.schedules);
|
|
837
840
|
this.purgeOnlyKeys.set(manifest.id, purgeOnlyKeysOf(manifest.schedules ?? []));
|
|
838
841
|
for (const schedule of manifest.schedules ?? []) {
|
|
839
842
|
if (schedule.purge)
|
|
@@ -929,31 +932,31 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
929
932
|
}
|
|
930
933
|
// #893: a schema declared for an operation this module does not bind
|
|
931
934
|
// enforces nothing while reading as coverage — refused, as in the pure adapter.
|
|
932
|
-
const declaredInputs = registration.
|
|
933
|
-
const ownOps = new Set(Object.keys(registration.operations ?? {}));
|
|
935
|
+
const declaredInputs = registration.operations?.inputs ?? {};
|
|
936
|
+
const ownOps = new Set(Object.keys(registration.operations?.handlers ?? {}));
|
|
934
937
|
const unbound = Object.keys(declaredInputs).filter((name) => !ownOps.has(name));
|
|
935
938
|
if (unbound.length > 0) {
|
|
936
|
-
throw new Error(`${manifest.id} declares
|
|
939
|
+
throw new Error(`${manifest.id} declares operations.inputs for unbound operation(s): ` +
|
|
937
940
|
`${unbound.sort().join(', ')} — a schema on nothing reads as a parse that is not there`);
|
|
938
941
|
}
|
|
939
942
|
// Same rule for a declared precondition, and it matters more: a
|
|
940
943
|
// `concurrency` on an unbound name is a guarantee nothing enforces.
|
|
941
|
-
const declaredConcurrency = registration.
|
|
944
|
+
const declaredConcurrency = registration.operations?.concurrency ?? {};
|
|
942
945
|
const unguarded = Object.keys(declaredConcurrency).filter((name) => !ownOps.has(name));
|
|
943
946
|
if (unguarded.length > 0) {
|
|
944
|
-
throw new Error(`${manifest.id} declares
|
|
947
|
+
throw new Error(`${manifest.id} declares operations.concurrency for unbound operation(s): ` +
|
|
945
948
|
`${unguarded.sort().join(', ')} — a precondition on nothing reads as a guard that is not there`);
|
|
946
949
|
}
|
|
947
950
|
// #116: same rule again for an opt-out — one on an unbound name reads as a
|
|
948
951
|
// deliberate exclusion of an operation that is not there.
|
|
949
|
-
const declaredOptOuts = registration.
|
|
952
|
+
const declaredOptOuts = registration.operations?.idempotencyOptOuts ?? [];
|
|
950
953
|
const unboundOptOuts = declaredOptOuts.filter((name) => !ownOps.has(name));
|
|
951
954
|
if (unboundOptOuts.length > 0) {
|
|
952
955
|
throw new Error(`${manifest.id} declares idempotency: false for unbound operation(s): ` +
|
|
953
956
|
`${[...unboundOptOuts].sort().join(', ')} — an opt-out on nothing reads as an ` +
|
|
954
957
|
'exclusion someone decided, of an operation that does not exist');
|
|
955
958
|
}
|
|
956
|
-
for (const [name, handler] of Object.entries(registration.operations ?? {})) {
|
|
959
|
+
for (const [name, handler] of Object.entries(registration.operations?.handlers ?? {})) {
|
|
957
960
|
this.defineOperation(name, handler);
|
|
958
961
|
// The schema follows the HANDLER, not the name: a withdrawn operation
|
|
959
962
|
// never binds, and has nothing to parse for.
|
|
@@ -1647,19 +1650,39 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
1647
1650
|
}
|
|
1648
1651
|
/**
|
|
1649
1652
|
* One bounded pass of a declared shape's reconcile (#2071), with its events, in ONE
|
|
1650
|
-
* transaction: how many it topped up, how many it took retired keys from (#2082), and
|
|
1651
|
-
*
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1653
|
+
* transaction: how many it topped up, how many it took retired keys from (#2082), and where
|
|
1654
|
+
* the next pass resumes (#2083), `null` once the scope is done.
|
|
1655
|
+
*
|
|
1656
|
+
* A host from before #2083 passes no `after` at all (a new one passes `null` to start) and
|
|
1657
|
+
* loops until `done`, starting each call over. A bounded pass started over never gets past a
|
|
1658
|
+
* window of finished markers, so that host would call forever; for it, this call runs the
|
|
1659
|
+
* whole reconcile here instead, a transaction per pass, and answers `done: true`. Drop the
|
|
1660
|
+
* branch and `done` once no host that predates the cursor can address a ScopeDO built from this.
|
|
1661
|
+
*/
|
|
1662
|
+
async topUpEntityGrantShapes(tenantId, scopeId, shapes, limit, after) {
|
|
1663
|
+
const pass = (from) => this.queue.enqueue(() => this.revision.transactionSync(() => topUpEntityGrantShapes(this.switchSql(), {
|
|
1655
1664
|
tenantId,
|
|
1656
1665
|
scopeId,
|
|
1657
1666
|
shapes,
|
|
1658
1667
|
now: new Date().toISOString(),
|
|
1659
1668
|
limit,
|
|
1669
|
+
after: from,
|
|
1660
1670
|
mintEventId: (ms) => this.mintEventId(ms),
|
|
1661
1671
|
version: this.env.SUBSTRAT_VERSION_ID ?? null,
|
|
1662
1672
|
})));
|
|
1673
|
+
if (after !== undefined) {
|
|
1674
|
+
const one = await pass(after);
|
|
1675
|
+
return { ...one, done: one.next === null };
|
|
1676
|
+
}
|
|
1677
|
+
let [toppedUp, retired, retirementsLeftOpen, from] = [0, 0, 0, null];
|
|
1678
|
+
do {
|
|
1679
|
+
const one = await pass(from);
|
|
1680
|
+
toppedUp += one.toppedUp;
|
|
1681
|
+
retired += one.retired;
|
|
1682
|
+
retirementsLeftOpen += one.retirementsLeftOpen;
|
|
1683
|
+
from = one.next;
|
|
1684
|
+
} while (from);
|
|
1685
|
+
return { toppedUp, retired, retirementsLeftOpen, next: null, done: true };
|
|
1663
1686
|
}
|
|
1664
1687
|
/**
|
|
1665
1688
|
* The dispatch capability's admission (#726 remedy B): this delivery may read the
|
|
@@ -3504,6 +3527,9 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
3504
3527
|
// pseudo-operation name — the actor is the capability, as on every event it
|
|
3505
3528
|
// goes on to cause.
|
|
3506
3529
|
emit: (capability, event) => kernelEmit(this.operationContext(principalId.parse(ulid()), tenantId, scopeId, undefined, undefined, undefined, undefined, undefined, CAPABILITY_EXCHANGE_OPERATION, capability, [], now), event),
|
|
3530
|
+
holdings: this.checker.holdings
|
|
3531
|
+
? (principal) => this.checker.holdings({ kind: 'principal', id: principal }, { tenantId, scopeId })
|
|
3532
|
+
: undefined,
|
|
3507
3533
|
}, secret, mode);
|
|
3508
3534
|
});
|
|
3509
3535
|
if (outcome)
|
|
@@ -3511,6 +3537,49 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
3511
3537
|
return outcome;
|
|
3512
3538
|
});
|
|
3513
3539
|
}
|
|
3540
|
+
/**
|
|
3541
|
+
* A principal's `become` mint (#1686) — a member invite's link. The kernel's
|
|
3542
|
+
* `becomeMintCheck` and the write in ONE queued body and one storage transaction, so
|
|
3543
|
+
* nothing the target or the caller holds moves between the check and the mint; a refusal
|
|
3544
|
+
* writes nothing. On the spine as `capability.become-minted`, the caller its actor.
|
|
3545
|
+
*/
|
|
3546
|
+
async mintBecomeCapabilityBoundedFor(tenantId, scopeId, caller, input) {
|
|
3547
|
+
await this.ensureMigrations();
|
|
3548
|
+
const minter = principalId.parse(caller);
|
|
3549
|
+
const parsed = principalBecomeCapabilityInput.parse(input);
|
|
3550
|
+
return await this.queue.enqueue(async () => {
|
|
3551
|
+
const checked = await becomeMintCheck({ sql: doSpineSql(this.sql), checker: this.checker }, minter, parsed.principal, { tenantId, scopeId });
|
|
3552
|
+
if (!checked.ok)
|
|
3553
|
+
return checked;
|
|
3554
|
+
const liveSince = this.liveHighWaterMark();
|
|
3555
|
+
const now = instant.parse(new Date().toISOString());
|
|
3556
|
+
let minted;
|
|
3557
|
+
await this.revision.transaction(async () => {
|
|
3558
|
+
minted = await mintBecomeCapabilityAsPrincipal({
|
|
3559
|
+
sql: doSpineSql(this.sql),
|
|
3560
|
+
now,
|
|
3561
|
+
emit: (event) => kernelEmit(this.operationContext(minter, tenantId, scopeId, undefined, undefined, undefined, undefined, undefined, CAPABILITY_BECOME_MINT_OPERATION, undefined, [], now), event),
|
|
3562
|
+
}, minter, parsed, checked.targetDigest);
|
|
3563
|
+
});
|
|
3564
|
+
await this.settleCommitted(tenantId, scopeId, liveSince, null);
|
|
3565
|
+
return { ok: true, minted: minted };
|
|
3566
|
+
});
|
|
3567
|
+
}
|
|
3568
|
+
/** Where each named `become` link stands (#1686) — a pending-invite list's read. */
|
|
3569
|
+
async becomeLinkStatesFor(tenantId, scopeId, ids) {
|
|
3570
|
+
await this.ensureMigrations();
|
|
3571
|
+
return this.queue.enqueue(() => readBecomeLinkStates(doSpineSql(this.sql), ids, instant.parse(new Date().toISOString()), this.checker.holdings
|
|
3572
|
+
? (principal) => this.checker.holdings({ kind: 'principal', id: principal }, { tenantId, scopeId })
|
|
3573
|
+
: undefined));
|
|
3574
|
+
}
|
|
3575
|
+
/**
|
|
3576
|
+
* Revoke a `become` capability a principal minted (#1686) — withdrawing a member invite's
|
|
3577
|
+
* link, with `by` recorded as the revoker. False for any other capability.
|
|
3578
|
+
*/
|
|
3579
|
+
async revokeBecomeCapabilityFor(tenantId, scopeId, id, by) {
|
|
3580
|
+
await this.ensureMigrations();
|
|
3581
|
+
return await this.queue.enqueue(() => revokeBecomeCapabilityAsPrincipal({ sql: doSpineSql(this.sql), checker: this.checker, node: { tenantId, scopeId }, now: instant.parse(new Date().toISOString()) }, id, principalId.parse(by)));
|
|
3582
|
+
}
|
|
3514
3583
|
/**
|
|
3515
3584
|
* The platform's mint (#1672, `HostAdmin.mintCapability`) — a `become` capability,
|
|
3516
3585
|
* serialized on the queue with every other spine write. One INSERT, so it needs no
|
|
@@ -4638,6 +4707,10 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
4638
4707
|
'ALTER TABLE _substrat_tuples ADD COLUMN revoked_at TEXT',
|
|
4639
4708
|
// #2126: NULL keeps every existing capability's attachment behavior unchanged.
|
|
4640
4709
|
'ALTER TABLE _substrat_capabilities ADD COLUMN attachments TEXT',
|
|
4710
|
+
// #1686: NULL on every row already there — none is a principal-minted become.
|
|
4711
|
+
'ALTER TABLE _substrat_capabilities ADD COLUMN target_digest TEXT',
|
|
4712
|
+
// #1686: why the kernel revoked a link itself; NULL for every revoke already there.
|
|
4713
|
+
'ALTER TABLE _substrat_capabilities ADD COLUMN revoked_reason TEXT',
|
|
4641
4714
|
// #1632: legacy runs retain an unknown subject; no content-based backfill.
|
|
4642
4715
|
'ALTER TABLE _substrat_job_runs ADD COLUMN subject_id TEXT',
|
|
4643
4716
|
// #2034: the lease. NULL = nobody holds the run, which is right for every row already there.
|