@substrat-run/adapter-cloudflare 0.180.0 → 0.184.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/control-plane-do.d.ts +21 -0
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +23 -0
- package/dist/control-plane-do.js.map +1 -1
- package/dist/host.d.ts +23 -13
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +72 -57
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +62 -18
- package/dist/scope-do.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { CloudflareScopeHost } from './host.js';
|
|
|
17
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
|
+
export type { DirectoryInventory } from './control-plane-do.js';
|
|
20
21
|
export { OperationQueue } from './serialization.js';
|
|
21
22
|
export { doScopedSql } from './sql.js';
|
|
22
23
|
export { createDoTupleChecker } from './checker.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB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S,OAAO,EAAE,GAAG,MAAM,CAQxD;AAuPD;;;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;AACzD;;;;GAIG;AACH,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAAO,GAClD,KAAK,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,KAAK,aAAa,CAAC,UAAU,CAAC,CAkqR7E"}
|
package/dist/scope-do.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
4
|
import { ATTACHMENT_ADDED, ATTACHMENT_REMOVED, CAPTURE_REFUSALS, attachmentRecord, domainEvent, domainEventInput, eventId, instant, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, toWireFailure, grantRefFromProof, principalId, principalBecomeCapabilityInput, principalBindLinkInput, scopeId as scopeIdOf, tenantId as tenantIdOf, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, MAX_PENDING_SWEEP_RUNS, SWEEP_RUNS_KIND, SCOPE_DUMP_PAGE_MAX_BYTES, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, listLimitOf, pageOf, countedPageOf, requestFingerprint, substratError, errorCodeOf, assertReplayableDump, DUMP_OBJECTS_QUERY, dumpObjectsOf, replayDumpObjects, dumpObjectsAudit, 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, assertModuleDeclared, noteDeclaredKeys, noteReservedKeys, SCOPE_SEATED_ROLES_SQL, inUnitRoleRefusal, loadedRoleSetRefusedRole, reservedRoleSetRefusedRole, reservedGrantRefusal, reservedRoleRefusal, reservedShapeRefusal, effectiveRoleGrantQuery, switchRecordedOff, switchSystemSchedules, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, OUTBOX_PRUNED_DDL, outboxSubscribersOf, pruneDrainedOutbox, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, PermissionDenied, assertImpersonationAdmitted, assertImpersonationWrites, assertModuleEnqueueableKind, impersonationStampOf, createAtomic, NotSearchable, isSearchIndexTable, searchIndexPlans, NotListable, listIndexPlans, moduleMigrations, REGISTERED_MIGRATIONS, registeredMigrationsOf, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSetDivergence, migrationSteps, planMigrations, listQuery, cursorOf, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, ATTACHMENT_BYTES_SQL, ATTACHMENT_CONDEMNED_DDL, ATTACHMENT_SWEEP_LICENCE_DDL, ATTACHMENT_SWEEP_LICENCE_TABLE, WIRE_NONCE_DDL, WIRE_NONCE_FULL, claimWireNonceIn, isWireNonceTable, isWireNonceWrite, clearOrphanSweepLicence, condemnLicensedOrphanAttachments, consumeOrphanSweepLicence, licensedOrphanIds, recordOrphanSweepLicence, refuseUnlicensedOrphanSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, 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, noteTransitionInto, withTransitions, 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';
|
|
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, assertModuleDeclared, noteDeclaredKeys, noteReservedKeys, SCOPE_SEATED_ROLES_SQL, inUnitRoleRefusal, loadedRoleSetRefusedRole, reservedRoleSetRefusedRole, reservedGrantRefusal, reservedRoleRefusal, reservedShapeRefusal, effectiveRoleGrantQuery, switchRecordedOff, switchSystemSchedules, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, OUTBOX_PRUNED_DDL, outboxSubscribersOf, pruneDrainedOutbox, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, PermissionDenied, assertImpersonationAdmitted, assertImpersonationWrites, assertModuleEnqueueableKind, impersonationStampOf, createAtomic, NotSearchable, isSearchIndexTable, rowCountTable, searchIndexPlans, NotListable, listIndexPlans, moduleMigrations, REGISTERED_MIGRATIONS, registeredMigrationsOf, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSetDivergence, migrationSteps, planMigrations, listQuery, cursorOf, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, ATTACHMENT_BYTES_SQL, ATTACHMENT_CONDEMNED_DDL, ATTACHMENT_SWEEP_LICENCE_DDL, ATTACHMENT_SWEEP_LICENCE_TABLE, WIRE_NONCE_DDL, WIRE_NONCE_FULL, claimWireNonceIn, isWireNonceTable, isWireNonceWrite, clearOrphanSweepLicence, condemnLicensedOrphanAttachments, consumeOrphanSweepLicence, licensedOrphanIds, recordOrphanSweepLicence, refuseUnlicensedOrphanSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, 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, noteTransitionInto, withTransitions, 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
6
|
import { isUpgradeRequest, readSubscription, LIVE_DECIDE_ATTEMPTS, LIVE_FANOUT_LIMIT, 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, liveRefusal, liveRefusalStatus, } from './live-reads.js';
|
|
7
7
|
import { replyOf } from './do-reply.js';
|
|
8
8
|
import { OperationQueue } from './serialization.js';
|
|
@@ -1523,6 +1523,27 @@ options = {}) {
|
|
|
1523
1523
|
const { verdict } = this.tenantVerdict(tenantId);
|
|
1524
1524
|
return verdict === 'recorded' || verdict === 'inferred';
|
|
1525
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* #2035: whether the ownerless reconcile may seat this scope for `tenantId` — it serves it, or
|
|
1528
|
+
* the platform's word may record it where a lifecycle delivery's would (`backfills`). False for a
|
|
1529
|
+
* foreign scope and for a DO nothing provisioned or loaded here. Read only, without migrating:
|
|
1530
|
+
* the receipt is written by `seatTuplesFor`, which judges this rule again in the unit that
|
|
1531
|
+
* applies the seat and the recorded-off positions, so no door admits the scope before they
|
|
1532
|
+
* hold, and a failed seat records nothing.
|
|
1533
|
+
*/
|
|
1534
|
+
seatsTenant(tenantId) {
|
|
1535
|
+
const { verdict } = this.tenantVerdict(tenantId);
|
|
1536
|
+
return verdict === 'recorded' || this.backfills(verdict);
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* #2016: whether the platform's word may record the tenant on a scope with no receipt — one
|
|
1540
|
+
* provisioned before the receipt (its role rows agree), or one whose tenant nothing recorded
|
|
1541
|
+
* although it holds data (a load from a world that keeps its roles elsewhere). A DO never
|
|
1542
|
+
* provisioned here records nothing, or `servesTenant` would answer for a scope it does not hold.
|
|
1543
|
+
*/
|
|
1544
|
+
backfills(verdict) {
|
|
1545
|
+
return verdict === 'inferred' || (verdict === 'unknown' && this.holdsData());
|
|
1546
|
+
}
|
|
1526
1547
|
/**
|
|
1527
1548
|
* #2541: this scope's database size, or null when the deployment does not hold it. The held
|
|
1528
1549
|
* check and the read are ONE call: a reap or wipe cannot land between them, so a scope that
|
|
@@ -1613,8 +1634,8 @@ options = {}) {
|
|
|
1613
1634
|
/**
|
|
1614
1635
|
* #2016: what one door into this scope needs from its storage on a CP-less host, in ONE call —
|
|
1615
1636
|
* how `tenantId` reads against the scope (`tenantVerdict`), and the lifecycle the platform
|
|
1616
|
-
* delivered (#1713). The coordinator refuses a foreign pair before any guard,
|
|
1617
|
-
* lookup runs, and
|
|
1637
|
+
* delivered (#1713). The coordinator refuses a foreign or an `unknown` pair before any guard,
|
|
1638
|
+
* handler or store lookup runs, and logs the `unknown` refusal (#2035). Read without migrating, like
|
|
1618
1639
|
* `servesTenant`.
|
|
1619
1640
|
*/
|
|
1620
1641
|
admission(tenantId) {
|
|
@@ -2062,13 +2083,36 @@ options = {}) {
|
|
|
2062
2083
|
* and the re-assert in which a sweep could run the grants just seated.
|
|
2063
2084
|
*/
|
|
2064
2085
|
async seatTuples(tuples, switchOff) {
|
|
2065
|
-
return this.queue.enqueue(() => this.revision.transactionSync(() =>
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2086
|
+
return this.queue.enqueue(() => this.revision.transactionSync(() => this.seatIn(tuples, switchOff)));
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* #2035: the ownerless reconcile's seat — `seatTuples`' unit, with the tenant recorded LAST in
|
|
2090
|
+
* it. The receipt opens every door, so it lands with the seat and the recorded-off positions or
|
|
2091
|
+
* not at all. `seatsTenant`'s rule is judged again before the unit's first write (the seat's
|
|
2092
|
+
* own tuples would read as state), against what holds now: a scope reaped or recorded for
|
|
2093
|
+
* another tenant since the host asked is refused untouched, as data, so the host answers K-3's
|
|
2094
|
+
* uniform refusal and no other tenant is named.
|
|
2095
|
+
*/
|
|
2096
|
+
async seatTuplesFor(tenantId, tuples, switchOff) {
|
|
2097
|
+
return this.queue.enqueue(async () => {
|
|
2098
|
+
// Read before the unit, as `projectInUnit` reads it.
|
|
2099
|
+
const reaped = await this.isReaped();
|
|
2100
|
+
return this.revision.transactionSync(() => {
|
|
2101
|
+
if (reaped || !this.seatsTenant(tenantId))
|
|
2102
|
+
return { refused: 'tenant' };
|
|
2103
|
+
const switchedOff = this.seatIn(tuples, switchOff);
|
|
2104
|
+
this.sql.exec(`INSERT OR IGNORE INTO _substrat_meta (key, value) VALUES (?, ?)`, PROVISIONED_FOR_KEY, tenantId);
|
|
2105
|
+
return { switchedOff };
|
|
2106
|
+
});
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
/** The seat and the recorded-off positions, in the caller's unit. */
|
|
2110
|
+
seatIn(tuples, switchOff) {
|
|
2111
|
+
for (const t of tuples) {
|
|
2112
|
+
const seat = seatScopeTuple(t.subject, t.relation, t.object, t.expires_at);
|
|
2113
|
+
this.sql.exec(seat.sql, ...seat.params);
|
|
2114
|
+
}
|
|
2115
|
+
return switchOff ? switchRecordedOff(this.switchSql(), switchOff) : [];
|
|
2072
2116
|
}
|
|
2073
2117
|
/** A declared entity-grant shape's grant to one person on one entity (#2071), as ONE unit. */
|
|
2074
2118
|
async grantEntityShape(principal, entity, permissions) {
|
|
@@ -4556,10 +4600,11 @@ options = {}) {
|
|
|
4556
4600
|
/**
|
|
4557
4601
|
* #119: the purge gate's facts (`PurgeGateFacts`), from this scope's own storage: the module's
|
|
4558
4602
|
* switch, the lifecycle the platform delivered (#1713), the copy classification (#2009) and the
|
|
4559
|
-
* tenant receipt (`tenantVerdict` — `
|
|
4603
|
+
* tenant receipt (`tenantVerdict` — only `foreign` is refused here). A directory-backed
|
|
4560
4604
|
* deployment records no receipt and delivers neither a lifecycle nor a copy classification here,
|
|
4561
|
-
* so on one those read clear: this object enforces the kill
|
|
4562
|
-
* is the authority for tenant, lifecycle, copy and the rewind
|
|
4605
|
+
* so on one those read clear and `unknown` is its every scope: this object enforces the kill
|
|
4606
|
+
* switch, and the coordinator's gate is the authority for tenant, lifecycle, copy and the rewind
|
|
4607
|
+
* hold. On a CP-less host that gate has already refused an `unknown` pair at the door (#2035).
|
|
4563
4608
|
*/
|
|
4564
4609
|
purgeGateFacts(moduleId, tenantId) {
|
|
4565
4610
|
const now = new Date().toISOString();
|
|
@@ -5126,10 +5171,8 @@ options = {}) {
|
|
|
5126
5171
|
if (verdict === 'foreign') {
|
|
5127
5172
|
return { refused: 'tenant', message: `lifecycle delivery ${foreignTenant(held, tenantId)}` };
|
|
5128
5173
|
}
|
|
5129
|
-
// The back-fill:
|
|
5130
|
-
|
|
5131
|
-
// elsewhere). The directory's word records it; a DO never provisioned here records nothing.
|
|
5132
|
-
const backfill = verdict === 'inferred' || (verdict === 'unknown' && this.holdsData());
|
|
5174
|
+
// The back-fill (`backfills`): the directory's word records the tenant.
|
|
5175
|
+
const backfill = verdict !== null && this.backfills(verdict);
|
|
5133
5176
|
let out;
|
|
5134
5177
|
this.revision.transactionSync(() => {
|
|
5135
5178
|
// A write the carry fences on, not bookkeeping: it happens once per legacy scope, and
|
|
@@ -5427,10 +5470,11 @@ options = {}) {
|
|
|
5427
5470
|
const names = this.sql
|
|
5428
5471
|
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT GLOB '_cf_*' ORDER BY name`)
|
|
5429
5472
|
.toArray().map((r) => r.name);
|
|
5473
|
+
const known = new Set(names);
|
|
5430
5474
|
const count = (sql) => Number(this.sql.exec(sql).toArray()[0].c);
|
|
5431
5475
|
return names.map((name) => ({
|
|
5432
5476
|
name,
|
|
5433
|
-
rowCount: count(`SELECT COUNT(*) AS c FROM "${name}"`),
|
|
5477
|
+
rowCount: count(`SELECT COUNT(*) AS c FROM "${rowCountTable(name, known)}"`),
|
|
5434
5478
|
system: isSystemTable(name),
|
|
5435
5479
|
// #2531: rows whose `revoked_at` is null, for any table with that column (`ScopeTable.liveRowCount`).
|
|
5436
5480
|
// Scope health reads it for `_substrat_roles`, where a dropped role is kept revoked.
|