@substrat-run/adapter-sqlite 0.130.1 → 0.132.1
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/index.d.ts +23 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +89 -22
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlobStoreHandle, type ImportBatch, type ImportResult, type PeerCoverage, type VerticalCaller, type CapabilityExchange, type ConnectionId, type ModuleId, type DomainEvent, type PlatformRequestId, type PlatformRequest, type PlatformRequestFilter, type PlatformRequestStatus, type PlatformRequestFailure, type ProjectedConnectionGrant, type PermissionKey, type PlatformActorId, type PrincipalId, type ScopeDump, type ScopeId, type ImpersonationSessionId, type TenantId, type TenantStoreHandle } from '@substrat-run/contracts';
|
|
1
|
+
import { type BlobStoreHandle, type ImportBatch, type ImportResult, type Coverage, type PeerCoverage, type VerticalCaller, type CapabilityExchange, type ConnectionId, type ModuleId, type DomainEvent, type PlatformRequestId, type PlatformRequest, type PlatformRequestFilter, type PlatformRequestStatus, type PlatformRequestFailure, type ProjectedConnectionGrant, type PermissionKey, type PlatformActorId, type OnBehalfOf, type PrincipalId, type ScopeDump, type ScopeId, type ImpersonationSessionId, type TenantId, type TenantStoreHandle } from '@substrat-run/contracts';
|
|
2
2
|
import { type ModuleLogSink, type FreshnessReport, type FreshnessRegistration, type BlobStoreProvisionInput, type ScopeAttachments, type ExecutorDeadLetter, type ExecutorDrainReport, type MigrateScopeOutcome, type MigrationFrontier, type ExecutorHandler, type ExecutorRetryPolicy, type ConnectorHandler, type ConnectorOptions, type Clock, 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, type JobDriveReport, type JobHandler, type JobRun, type JobRunFilter, type StartJobRunInput, type ConnectorCallRecorder } from '@substrat-run/kernel';
|
|
3
3
|
/**
|
|
4
4
|
* A fault in the database itself (full, corrupt, I/O), as opposed to one statement failing.
|
|
@@ -170,6 +170,12 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
170
170
|
* so there is no window where it belongs to a different event.
|
|
171
171
|
*/
|
|
172
172
|
private causedBy;
|
|
173
|
+
/**
|
|
174
|
+
* #977: the person an attributed admin view's actions are taken for. Only ever set on a
|
|
175
|
+
* VIEW (`attributed`, a Proxy whose `onBehalfOf` answers from the view), so a host shared across
|
|
176
|
+
* requests never carries one request's person into another's audit row.
|
|
177
|
+
*/
|
|
178
|
+
private readonly onBehalfOf;
|
|
173
179
|
private readonly systemPrincipal;
|
|
174
180
|
private readonly secretBox;
|
|
175
181
|
private readonly fetchImpl;
|
|
@@ -278,6 +284,7 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
278
284
|
* ATTACHMENTS (the convention the deploy vocabulary documents). */
|
|
279
285
|
private attachmentStore;
|
|
280
286
|
attachments(principal: PrincipalId, tenantId: TenantId, scopeId: ScopeId): Promise<ScopeAttachments>;
|
|
287
|
+
getSystemAttachments(moduleId: ModuleId, tenantId: TenantId, scopeId: ScopeId): Promise<Pick<ScopeAttachments, 'open'>>;
|
|
281
288
|
/**
|
|
282
289
|
* The attachment surface (#473) — `attachmentTargets` consumed at last. Metadata facts
|
|
283
290
|
* live in `_substrat_attachments` inside the scope DB and move under the scope's strict
|
|
@@ -405,6 +412,19 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
405
412
|
* and the tuple ref it walks is the slug alone.
|
|
406
413
|
*/
|
|
407
414
|
peerCovers(tenantId: TenantId, scopeId: ScopeId, vertical: string, permissions: readonly PermissionKey[]): Promise<PeerCoverage[]>;
|
|
415
|
+
/**
|
|
416
|
+
* `ctx.canAssign`'s bound for a principal the host names (#1931) — the same resolution, inside
|
|
417
|
+
* the scope's actor task so no invoke's open transaction is read half-done.
|
|
418
|
+
*/
|
|
419
|
+
canAssign(tenantId: TenantId, scopeId: ScopeId, principal: PrincipalId, roleKey: string): Promise<Coverage>;
|
|
420
|
+
assignScopeRoleBounded(tenantId: TenantId, scopeId: ScopeId, caller: PrincipalId, assignee: PrincipalId, roleKey: string): Promise<Coverage>;
|
|
421
|
+
/**
|
|
422
|
+
* §5.1's assignment bound, resolved against the SAME role table the checker expands
|
|
423
|
+
* — not a vertical's compile-time `ROLES` array. A tenant's projected role is what
|
|
424
|
+
* assignment would actually confer, and that is what has to be bounded. The one
|
|
425
|
+
* resolution both `ctx.canAssign` and the host's `canAssign` answer from.
|
|
426
|
+
*/
|
|
427
|
+
private assignmentBound;
|
|
408
428
|
/** #1705: what this deployment imports — the sweep's reason to call no scope when it is empty. */
|
|
409
429
|
registeredImports(): {
|
|
410
430
|
from: string;
|
|
@@ -611,6 +631,8 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
611
631
|
private tenantHoldsEntitlement;
|
|
612
632
|
/** Every key the tenant is granted, expiry flagged — the "held" half of a denial (#691). */
|
|
613
633
|
private heldEntitlements;
|
|
634
|
+
/** #977: this host, with every admin row it writes naming who the actor acted for. */
|
|
635
|
+
attributed(onBehalfOf: OnBehalfOf): this;
|
|
614
636
|
private buildAdmin;
|
|
615
637
|
/**
|
|
616
638
|
* The directory's own migration path (control-plane.md §7: "the directory
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAeL,KAAK,eAAe,EAcpB,KAAK,WAAW,EAEhB,KAAK,YAAY,EAuBjB,KAAK,YAAY,EAIjB,KAAK,cAAc,EAwCnB,KAAK,kBAAkB,EAMvB,KAAK,YAAY,EAGjB,KAAK,QAAQ,EAeb,KAAK,WAAW,EAIhB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,q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O,CAAC,kBAAkB;IA+E1B,OAAO,CAAC,OAAO;CA6ChB"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,8 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync
|
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
4
|
import { accessLogEntry, adminLogEntry, delegatedReadParams, opsFailureEntry, opsFailureFingerprint, issueEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunEntry, modelUsageEntry, ATTACHMENT_ADDED, ATTACHMENT_REMOVED, attachmentRecord, createTenantInput, domainEvent, domainEventInput, exportReadInput, importBatch, importCursorMove, exportsOfManifestJson, importsOfManifestJson, entitlementGrant, entitlementGrantInput, eventId, meterReading, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, identityLink, identityPool, instant, connection, capabilityGrant, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, systemSwitch, systemSwitchRecord, peerSwitch, verticalCaller, verticalSlug as verticalSlugOf, subjectRef, requestFingerprint, createConnectionInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, routeTarget, registerVerticalInput, vertical as verticalSchema, verticalChannel, verticalVersion, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, grantRefFromProof, org as orgSchema, orgMembership, principalId, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, subjectShredReceipt, SCOPE_TABLE_PAGE_DEFAULT, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, verticalServingState, callsOfManifestJson, outboundOfManifestJson, listLimitOf, substratError, assertReplayableDump, delegatedReadRecord, ownerTransferAudit, redrainEventsInput, REDRAIN_BATCH, } from '@substrat-run/contracts';
|
|
5
|
-
import { actorOf, asPrincipal, assertAllowed, assertNoSecret, assertPermissionKey, CAPABILITY_DDL, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, capabilityTokenHash, createCapabilityVerbs, createEntityEdgeVerbs, exchangeCapability as exchangeCapabilitySecret, guardSecrets, mintBecomeCapability, plausibleSessionToken, redactSecrets, redactSecretText, moduleLog, consoleLogSink, resolveCapabilitySession, revokeCapabilityAsPlatform, assertReadOnlyQuery, attachmentBlobKey, entitlementDenial, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, OPS_FAILURE_RETENTION_DAYS, SWEEP_RUN_RETENTION_DAYS, SWEEP_RUNS_INTENT_INDEX, sweepRunsIntentHasKind, MODEL_USAGE_RETENTION_DAYS, foldModelUsage, backoffAt, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, JOB_RUN_PATCH_SQL, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, switchSystemSchedules, admitPeer, collectPeers, peerSeats, resolveVerticalInstanceFrom, switchPeer, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, systemSwitchedOffMessage, tenantSystemSwitchedOffMessage, SYSTEM_SWITCHES_BACKFILL_SQL, SYSTEM_SWITCHES_DDL, forgetSystemSwitchesOf, listSystemSwitchRecords, recordSystemSwitchedOff, recordSystemSwitchedOn, restoreSystemSwitchRecord, scopesSwitchedOffFor, switchedOffModulesOf, inUnitMovesToAudit, staleCarryRevertRow, staleCarryReverts, systemSwitchRecordsOf, systemSwitchesTableExists, withRecorded, VERSION_MIGRATIONS_DDL, splitManifestMigrations, splitVersionMigrationsBatch, versionMigrationsOf, writeVersionMigrations, denialListQuery, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, IMPERSONATION_COLUMNS, IMPERSONATION_DDL, ImpersonationRefused, assertImpersonationWrites, assertModuleEnqueueableKind, assertSessionUsable, impersonationByIdQuery, impersonationListQuery, impersonationRowValues, impersonationStampOf, mapImpersonationRow, newImpersonationSession, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, noSealingKeyMessage, openSealed, sealTo, ConnectionSealingKeyUnavailableError, PermissionDenied, createAtomic, NotSearchable, NotListable, listIndexMigrations, listIndexPlans, listQuery, cursorOf, moduleMigrations, isSearchIndexTable, searchIndexDdl, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, IMPORT_CURSORS_SQL, IMPORT_CURSOR_OF_SQL, OUTBOX_MARK_SQL, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, exportedSinceQuery, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, importCursorSourceOf, exportBreaksOf, exportBreakRefusal, bindExportBreaksOf, bindExportBreakRefusal, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, jobRunListLimit, jobRunOf, runDueJobRuns, startJobRun, IDEMPOTENCY_DDL, REFUSALS_DDL, refusalInsert, refusedTransitionOf, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, readLifecycleFlow, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, } from '@substrat-run/kernel';
|
|
5
|
+
import { actorOf, asPrincipal, assertAllowed, assertNoSecret, assertPermissionKey, CAPABILITY_DDL, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, capabilityTokenHash, createCapabilityVerbs, createEntityEdgeVerbs, exchangeCapability as exchangeCapabilitySecret, guardSecrets, mintBecomeCapability, plausibleSessionToken, redactSecrets, redactSecretText, moduleLog, consoleLogSink, resolveCapabilitySession, revokeCapabilityAsPlatform, assertReadOnlyQuery, attachmentBlobKey, entitlementDenial, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, OPS_FAILURE_RETENTION_DAYS, SWEEP_RUN_RETENTION_DAYS, SWEEP_RUNS_INTENT_INDEX, sweepRunsIntentHasKind, MODEL_USAGE_RETENTION_DAYS, foldModelUsage, backoffAt, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, JOB_RUN_PATCH_SQL, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, switchSystemSchedules, admitPeer, collectPeers, peerSeats, resolveVerticalInstanceFrom, switchPeer, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, systemSwitchedOffMessage, tenantSystemSwitchedOffMessage, SYSTEM_SWITCHES_BACKFILL_SQL, SYSTEM_SWITCHES_DDL, forgetSystemSwitchesOf, listSystemSwitchRecords, recordSystemSwitchedOff, recordSystemSwitchedOn, restoreSystemSwitchRecord, scopesSwitchedOffFor, switchedOffModulesOf, inUnitMovesToAudit, staleCarryRevertRow, staleCarryReverts, systemSwitchRecordsOf, systemSwitchesTableExists, withRecorded, VERSION_MIGRATIONS_DDL, splitManifestMigrations, splitVersionMigrationsBatch, versionMigrationsOf, writeVersionMigrations, denialListQuery, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, IMPERSONATION_COLUMNS, IMPERSONATION_DDL, ImpersonationRefused, assertImpersonationWrites, assertModuleEnqueueableKind, assertSessionUsable, impersonationByIdQuery, impersonationListQuery, impersonationRowValues, impersonationStampOf, mapImpersonationRow, newImpersonationSession, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, noSealingKeyMessage, openSealed, sealTo, ConnectionSealingKeyUnavailableError, PermissionDenied, createAtomic, NotSearchable, NotListable, listIndexMigrations, listIndexPlans, listQuery, cursorOf, moduleMigrations, isSearchIndexTable, searchIndexDdl, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, IMPORT_CURSORS_SQL, IMPORT_CURSOR_OF_SQL, OUTBOX_MARK_SQL, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, exportedSinceQuery, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, importCursorSourceOf, exportBreaksOf, exportBreakRefusal, bindExportBreaksOf, bindExportBreakRefusal, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, jobRunListLimit, jobRunOf, runDueJobRuns, startJobRun, IDEMPOTENCY_DDL, REFUSALS_DDL, refusalInsert, refusedTransitionOf, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, readLifecycleFlow, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, unknownRoleError, } from '@substrat-run/kernel';
|
|
6
|
+
import { attributedHost } from '@substrat-run/kernel';
|
|
6
7
|
import { LEGACY_SCOPE_ROWS_BACKFILL, assertNoSpineReference, assertSpineTablesBuilt, dumpRowsInsert, isSpineTable, loadDirectoryDump, repointScopeGrants, spineColumnAdditions } from '@substrat-run/kernel';
|
|
7
8
|
import { ScopeActor } from './actor.js';
|
|
8
9
|
import { createTupleChecker } from './checker.js';
|
|
@@ -233,6 +234,8 @@ const KERNEL_DDL = `
|
|
|
233
234
|
module_id TEXT NOT NULL,
|
|
234
235
|
version TEXT NOT NULL,
|
|
235
236
|
applied_at TEXT NOT NULL,
|
|
237
|
+
duration_ms INTEGER,
|
|
238
|
+
rows_changed INTEGER,
|
|
236
239
|
PRIMARY KEY (module_id, version)
|
|
237
240
|
);
|
|
238
241
|
CREATE TABLE IF NOT EXISTS _substrat_tuples (
|
|
@@ -549,6 +552,12 @@ export class SqliteScopeHost {
|
|
|
549
552
|
* so there is no window where it belongs to a different event.
|
|
550
553
|
*/
|
|
551
554
|
causedBy = null;
|
|
555
|
+
/**
|
|
556
|
+
* #977: the person an attributed admin view's actions are taken for. Only ever set on a
|
|
557
|
+
* VIEW (`attributed`, a Proxy whose `onBehalfOf` answers from the view), so a host shared across
|
|
558
|
+
* requests never carries one request's person into another's audit row.
|
|
559
|
+
*/
|
|
560
|
+
onBehalfOf = null;
|
|
552
561
|
systemPrincipal = principalId.parse(ulid());
|
|
553
562
|
secretBox;
|
|
554
563
|
fetchImpl;
|
|
@@ -1051,6 +1060,10 @@ export class SqliteScopeHost {
|
|
|
1051
1060
|
-- what joins the connector seam's two halves: the module's emit and the
|
|
1052
1061
|
-- executor's effect. Null for a staff member acting directly.
|
|
1053
1062
|
caused_by TEXT,
|
|
1063
|
+
-- #977: the person the action was taken for (JSON OnBehalfOf: principal, tenant,
|
|
1064
|
+
-- K-42 impersonation), read off a verified credential. Null when no customer
|
|
1065
|
+
-- session carried the call.
|
|
1066
|
+
on_behalf_of TEXT,
|
|
1054
1067
|
at TEXT NOT NULL
|
|
1055
1068
|
);
|
|
1056
1069
|
-- Read-path indexes for the console (control-plane.md §4.5). The admin log
|
|
@@ -1864,6 +1877,17 @@ export class SqliteScopeHost {
|
|
|
1864
1877
|
const store = this.attachmentStore(tenantId, scopeRow?.vertical ?? null);
|
|
1865
1878
|
return this.buildAttachments(rt, asPrincipal(principal), store);
|
|
1866
1879
|
}
|
|
1880
|
+
async getSystemAttachments(moduleId, tenantId, scopeId) {
|
|
1881
|
+
// The same registered-module and lifecycle gate as a system invoke. The
|
|
1882
|
+
// attachment surface checks the target's read key as system:<moduleId>.
|
|
1883
|
+
await this.getSystemScope(moduleId, tenantId, scopeId);
|
|
1884
|
+
const rt = this.runtime(tenantId, scopeId);
|
|
1885
|
+
const row = this.directory
|
|
1886
|
+
.prepare('SELECT vertical FROM scopes WHERE scope_id = ?')
|
|
1887
|
+
.get(scopeId);
|
|
1888
|
+
const surface = this.buildAttachments(rt, { kind: 'system', id: moduleId }, this.attachmentStore(tenantId, row?.vertical ?? null));
|
|
1889
|
+
return { open: surface.open };
|
|
1890
|
+
}
|
|
1867
1891
|
/**
|
|
1868
1892
|
* The attachment surface (#473) — `attachmentTargets` consumed at last. Metadata facts
|
|
1869
1893
|
* live in `_substrat_attachments` inside the scope DB and move under the scope's strict
|
|
@@ -2801,6 +2825,41 @@ export class SqliteScopeHost {
|
|
|
2801
2825
|
const missing = new Set(coverage.covered ? [] : coverage.missing);
|
|
2802
2826
|
return permissions.map((permission) => ({ permission, held: !missing.has(permission) }));
|
|
2803
2827
|
}
|
|
2828
|
+
/**
|
|
2829
|
+
* `ctx.canAssign`'s bound for a principal the host names (#1931) — the same resolution, inside
|
|
2830
|
+
* the scope's actor task so no invoke's open transaction is read half-done.
|
|
2831
|
+
*/
|
|
2832
|
+
async canAssign(tenantId, scopeId, principal, roleKey) {
|
|
2833
|
+
const rt = await this.openActiveScope(tenantId, scopeId);
|
|
2834
|
+
const subject = asPrincipal(principalId.parse(principal));
|
|
2835
|
+
return rt.actor.enqueue(() => this.assignmentBound(subject, tenantId, scopeId, roleKey));
|
|
2836
|
+
}
|
|
2837
|
+
async assignScopeRoleBounded(tenantId, scopeId, caller, assignee, roleKey) {
|
|
2838
|
+
const rt = await this.openActiveScope(tenantId, scopeId);
|
|
2839
|
+
const subject = asPrincipal(principalId.parse(caller));
|
|
2840
|
+
const target = principalId.parse(assignee);
|
|
2841
|
+
return rt.actor.turn(async () => {
|
|
2842
|
+
const bound = await this.assignmentBound(subject, tenantId, scopeId, roleKey);
|
|
2843
|
+
if (bound.covered) {
|
|
2844
|
+
rt.db.prepare(`INSERT OR REPLACE INTO _substrat_tuples (subject, relation, object, expires_at)
|
|
2845
|
+
VALUES (?, ?, ?, NULL)`).run(`principal:${target}`, `role:${roleKey}`, `scope:${scopeId}`);
|
|
2846
|
+
}
|
|
2847
|
+
return bound;
|
|
2848
|
+
});
|
|
2849
|
+
}
|
|
2850
|
+
/**
|
|
2851
|
+
* §5.1's assignment bound, resolved against the SAME role table the checker expands
|
|
2852
|
+
* — not a vertical's compile-time `ROLES` array. A tenant's projected role is what
|
|
2853
|
+
* assignment would actually confer, and that is what has to be bounded. The one
|
|
2854
|
+
* resolution both `ctx.canAssign` and the host's `canAssign` answer from.
|
|
2855
|
+
*/
|
|
2856
|
+
async assignmentBound(subject, tenantId, scopeId, roleKey) {
|
|
2857
|
+
const role = this.roles.get(`${tenantId}/${roleKey}`);
|
|
2858
|
+
if (!role) {
|
|
2859
|
+
throw unknownRoleError(roleKey);
|
|
2860
|
+
}
|
|
2861
|
+
return this.checker.covers(subject, role.permissions, { tenantId, scopeId });
|
|
2862
|
+
}
|
|
2804
2863
|
/** #1705: what this deployment imports — the sweep's reason to call no scope when it is empty. */
|
|
2805
2864
|
registeredImports() {
|
|
2806
2865
|
return this.crossVertical.consumes();
|
|
@@ -4165,9 +4224,11 @@ export class SqliteScopeHost {
|
|
|
4165
4224
|
recordAdmin(actor, action, target, before, after) {
|
|
4166
4225
|
this.directory
|
|
4167
4226
|
.prepare(`INSERT INTO _substrat_admin_log
|
|
4168
|
-
(id, actor, action, tenant_id, scope_id, vertical, before, after, caused_by, at)
|
|
4169
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
4170
|
-
.run(ulid(), actor, action, target.tenantId ?? null, target.scopeId ?? null, target.vertical ?? null, before == null ? null : JSON.stringify(before), after == null ? null : JSON.stringify(after), this.causedBy,
|
|
4227
|
+
(id, actor, action, tenant_id, scope_id, vertical, before, after, caused_by, on_behalf_of, at)
|
|
4228
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
4229
|
+
.run(ulid(), actor, action, target.tenantId ?? null, target.scopeId ?? null, target.vertical ?? null, before == null ? null : JSON.stringify(before), after == null ? null : JSON.stringify(after), this.causedBy,
|
|
4230
|
+
// #977: set only on an attributed view (`attributed`), never on the host itself.
|
|
4231
|
+
this.onBehalfOf === null ? null : JSON.stringify(this.onBehalfOf), new Date().toISOString());
|
|
4171
4232
|
}
|
|
4172
4233
|
tenantHoldsEntitlement(tenantId, key) {
|
|
4173
4234
|
// An expired grant fails closed, exactly as if revoked (#33) — evaluated
|
|
@@ -4187,7 +4248,16 @@ export class SqliteScopeHost {
|
|
|
4187
4248
|
WHERE tenant_id = ? ORDER BY entitlement_key`)
|
|
4188
4249
|
.all(tenantId).map((r) => ({ key: r.entitlement_key, expired: r.expires_at !== null && r.expires_at <= now }));
|
|
4189
4250
|
}
|
|
4251
|
+
/** #977: this host, with every admin row it writes naming who the actor acted for. */
|
|
4252
|
+
attributed(onBehalfOf) {
|
|
4253
|
+
return attributedHost(this, onBehalfOf, this.buildAdmin);
|
|
4254
|
+
}
|
|
4190
4255
|
buildAdmin() {
|
|
4256
|
+
// #977: an admin whose audit rows say on whose behalf it acts. Built over a VIEW of this
|
|
4257
|
+
// host rather than by setting a field on it: the view inherits every method and every
|
|
4258
|
+
// shared structure (the directory, the maps), and owns only the attribution — plus its
|
|
4259
|
+
// own `admin`, so a host helper that calls `this.admin.…` from inside the view stays
|
|
4260
|
+
// attributed. Race-free by construction, whoever else is using the host.
|
|
4191
4261
|
const mapTenant = (r) => tenantSchema.parse({
|
|
4192
4262
|
id: r.tenant_id,
|
|
4193
4263
|
slug: r.slug,
|
|
@@ -5939,7 +6009,7 @@ export class SqliteScopeHost {
|
|
|
5939
6009
|
scopeAppliedMigrations: async (actor, tenantId, scopeId) => {
|
|
5940
6010
|
const db = this.scopeReadDbFor(tenantId, scopeId);
|
|
5941
6011
|
const rows = db
|
|
5942
|
-
.prepare(`SELECT module_id, version, applied_at FROM _substrat_migrations
|
|
6012
|
+
.prepare(`SELECT module_id, version, applied_at, duration_ms, rows_changed FROM _substrat_migrations
|
|
5943
6013
|
ORDER BY applied_at DESC, module_id, version LIMIT 100`)
|
|
5944
6014
|
.all();
|
|
5945
6015
|
this.recordAccess(actor, 'scopeAppliedMigrations', { tenantId, scopeId }, null, rows.length);
|
|
@@ -5947,6 +6017,8 @@ export class SqliteScopeHost {
|
|
|
5947
6017
|
moduleId: r.module_id,
|
|
5948
6018
|
version: r.version,
|
|
5949
6019
|
appliedAt: r.applied_at ?? null,
|
|
6020
|
+
durationMs: r.duration_ms,
|
|
6021
|
+
rowsChanged: r.rows_changed,
|
|
5950
6022
|
}));
|
|
5951
6023
|
},
|
|
5952
6024
|
scopeMigrationBookmarks: async (actor, tenantId, scopeId) => {
|
|
@@ -7240,6 +7312,7 @@ export class SqliteScopeHost {
|
|
|
7240
7312
|
before: r.before === null ? null : JSON.parse(r.before),
|
|
7241
7313
|
after: r.after === null ? null : JSON.parse(r.after),
|
|
7242
7314
|
causedBy: r.caused_by,
|
|
7315
|
+
onBehalfOf: r.on_behalf_of ? JSON.parse(r.on_behalf_of) : null,
|
|
7243
7316
|
at: r.at,
|
|
7244
7317
|
}));
|
|
7245
7318
|
},
|
|
@@ -7671,6 +7744,8 @@ export class SqliteScopeHost {
|
|
|
7671
7744
|
// under several accounts. Existing data always satisfies the wider key.
|
|
7672
7745
|
this.directory.exec('DROP INDEX IF EXISTS _substrat_connections_live');
|
|
7673
7746
|
this.ensureColumn(this.directory, '_substrat_admin_log', 'caused_by', 'caused_by TEXT');
|
|
7747
|
+
// #977: after the rebuild above, like `caused_by`.
|
|
7748
|
+
this.ensureColumn(this.directory, '_substrat_admin_log', 'on_behalf_of', 'on_behalf_of TEXT');
|
|
7674
7749
|
// #1172: which version this scope's provision hook last ran against. Null on every
|
|
7675
7750
|
// existing row, which reads as "unknown, reconcile once" rather than "up to date".
|
|
7676
7751
|
this.ensureColumn(this.directory, 'scopes', 'provisioned_version_id', 'provisioned_version_id TEXT');
|
|
@@ -7907,21 +7982,7 @@ export class SqliteScopeHost {
|
|
|
7907
7982
|
}
|
|
7908
7983
|
return decision;
|
|
7909
7984
|
};
|
|
7910
|
-
|
|
7911
|
-
* §5.1's assignment bound, resolved against the SAME role table the checker expands
|
|
7912
|
-
* — not a vertical's compile-time `ROLES` array. A tenant's projected role is what
|
|
7913
|
-
* assignment would actually confer, and that is what has to be bounded.
|
|
7914
|
-
*/
|
|
7915
|
-
const runCanAssign = async (roleKey) => {
|
|
7916
|
-
const role = this.roles.get(`${rt.tenantId}/${roleKey}`);
|
|
7917
|
-
if (!role) {
|
|
7918
|
-
throw substratError('not_found', `no such role in this tenant: ${roleKey}`);
|
|
7919
|
-
}
|
|
7920
|
-
return checker.covers(subject, role.permissions, {
|
|
7921
|
-
tenantId: rt.tenantId,
|
|
7922
|
-
scopeId: rt.scopeId,
|
|
7923
|
-
});
|
|
7924
|
-
};
|
|
7985
|
+
const runCanAssign = (roleKey) => this.assignmentBound(subject, rt.tenantId, rt.scopeId, roleKey);
|
|
7925
7986
|
// ctx.emit's writer, and the kernel's own events' (#1864): one path to the outbox, with the
|
|
7926
7987
|
// reserved-type refusal applied to module code only. Never handed to module code as-is.
|
|
7927
7988
|
const writeEvent = (event, author) => {
|
|
@@ -8231,14 +8292,17 @@ export class SqliteScopeHost {
|
|
|
8231
8292
|
.prepare('SELECT 1 FROM _substrat_migrations WHERE module_id = ? AND version = ?')
|
|
8232
8293
|
.get(moduleId, migration.version);
|
|
8233
8294
|
if (!already) {
|
|
8295
|
+
const started = performance.now();
|
|
8296
|
+
const before = rt.db.prepare('SELECT total_changes() AS n').get().n;
|
|
8234
8297
|
// #1898: a migration runs on the scope's own handle, not `ctx.sql`, so the
|
|
8235
8298
|
// spine guard's REFERENCES rule is applied here.
|
|
8236
8299
|
assertNoSpineReference(migration.sql, `migration ${key}`);
|
|
8237
8300
|
rt.db.exec(migration.sql);
|
|
8238
8301
|
assertTablesWithinColumnLimit(rt.db);
|
|
8302
|
+
const after = rt.db.prepare('SELECT total_changes() AS n').get().n;
|
|
8239
8303
|
rt.db
|
|
8240
|
-
.prepare('INSERT INTO _substrat_migrations (module_id, version, applied_at) VALUES (?, ?, ?)')
|
|
8241
|
-
.run(moduleId, migration.version, this.clock());
|
|
8304
|
+
.prepare('INSERT INTO _substrat_migrations (module_id, version, applied_at, duration_ms, rows_changed) VALUES (?, ?, ?, ?, ?)')
|
|
8305
|
+
.run(moduleId, migration.version, this.clock(), Math.max(0, Math.round(performance.now() - started)), after - before);
|
|
8242
8306
|
}
|
|
8243
8307
|
rt.db.exec('COMMIT');
|
|
8244
8308
|
}
|
|
@@ -8418,6 +8482,9 @@ export class SqliteScopeHost {
|
|
|
8418
8482
|
// Every column here is nullable with no DEFAULT (`attempts` is grandfathered): a restore may
|
|
8419
8483
|
// have added it bare already, and then `ensureColumn` finds it and adds nothing (#1883).
|
|
8420
8484
|
// `lint:spine-ddl` refuses one that is not.
|
|
8485
|
+
// #1763: old journal rows keep NULL, meaning their cost was never recorded.
|
|
8486
|
+
this.ensureColumn(db, '_substrat_migrations', 'duration_ms', 'duration_ms INTEGER');
|
|
8487
|
+
this.ensureColumn(db, '_substrat_migrations', 'rows_changed', 'rows_changed INTEGER');
|
|
8421
8488
|
// KERNEL_DDL is all IF NOT EXISTS, so a scope DB created before K-21 keeps the
|
|
8422
8489
|
// old shape — ALTER the tombstone in.
|
|
8423
8490
|
this.ensureColumn(db, '_substrat_tuples', 'revoked_at', 'revoked_at TEXT');
|