Carries 359 template commits, tag v0.2.0 plus one documentation commit: the generator-built feature index with its app, bounded-context and feature declarations, the src/platform kernel and scale tooling, the 2026-09-24 src review fixes, and the 2026-09-25 maturity review round with its CHANGELOG [보안]/[계약] rows. 691 of the 824 template paths are applied, 85 of them merged with product changes; 127 are not carried. Product identity is unchanged: name, version 0.1.0, routes, design and the TechLog domain. Three decisions worth naming. TechLog stays composed directly, as the last two syncs recorded; its directory carries a NOT_INSTALLED marker that says so, and every installed-* composer takes the template's projection with TechLog added on top. The reference sample is no longer installed: the template now installs a feature only through feature-module.ts and context-routes.ts, which load the screens this product deleted, so its three operations, six schemas and one topic leave the registries, recorded as registry change evidence. And AppRouter mounts the platform and TechLog routes only; the template's bounded-context route gateway waits for a generator-installed feature. Required fixes: readSubject on the BFF session owner (without it every HTTP Studio session would close as integration-failed), zod through the facade in nine TechLog files, noUnusedLocals, and public/config.json written out to match the local profile. Derived baselines were recomputed after reproducing both sides' values: CI contract 101 commands / 106 references / 141 artifacts, gate shape c9adcf85; registry approval 2dc6c3a3; the runtime config schema baseline equals the schema at8210d48. Verified here: types, lint, architecture, adapter inventory, CI contract, i18n, design system, diagnostics, browser security, dev release manifest, TechLog contract and build pass; 220 component, 155 integration, 15 contract, 418 TechLog, 43 reference-feature, 18 recipe and 46 release-coherence tests pass, and 2381 of 2383 unit tests. Reproduced at8210d48first and unchanged: check:registries (byte-identical), test:runtime-schema, verify:documentation. Brought by the template and escalated rather than suppressed: check:request-fanout on TechLog's cursor pagination, check:remediation-ledger (fails upstream too), the shared-chunk hash test, and the registry-dependent sample removal and second-feature tests. Playwright suites were not run. Full record, the five open questions and the follow-ups in docs/operations/template-sync-2026-09-29.md. (cherry picked from commit b2170cf265dea45dc9cc05d3c61e627e97f31cdb)
1289 lines
41 KiB
TypeScript
1289 lines
41 KiB
TypeScript
import type {
|
|
IndexedDbMaintenanceBatchInput,
|
|
IndexedDbMaintenanceBatchReceipt,
|
|
IndexedDbMaintenancePort,
|
|
IndexedDbReceiptPruneBatchReceipt,
|
|
} from "../../../application/ports/browser-file-storage/indexeddb-port.ts";
|
|
import type {
|
|
BrowserDataFailure,
|
|
BrowserDataResult,
|
|
} from "../../../application/ports/browser-file-storage/shared.ts";
|
|
import {
|
|
abortedResult,
|
|
browserDataFailure,
|
|
browserDataSuccess,
|
|
mapIndexedDbException,
|
|
} from "../../browser-file-storage/result.ts";
|
|
import {
|
|
openIndexedDbDatabase,
|
|
type IndexedDbTranslate,
|
|
} from "../../platform/indexeddb-connection.ts";
|
|
import {
|
|
openIndexedDbTransaction,
|
|
runIndexedDbTransaction,
|
|
walkIndexedDbCursor,
|
|
type IndexedDbBudget,
|
|
type IndexedDbTransactionContext,
|
|
} from "../../platform/indexeddb-transaction.ts";
|
|
import {
|
|
createIndexedDbDatasetBinding,
|
|
indexedDbPhysicalDatabaseName,
|
|
verifyIndexedDbDatasetBinding,
|
|
} from "./indexeddb-governance.ts";
|
|
import {
|
|
countBucket,
|
|
failureOf,
|
|
INDEXEDDB_DATASET_BUDGET_KEY,
|
|
isPositiveInteger,
|
|
isStoredDatasetBudget,
|
|
isStoredReceipt,
|
|
isStoredRecord,
|
|
isStoredRetentionRecord,
|
|
isValidBoundaryIdentifier,
|
|
measureRecordBytes,
|
|
type StoredDatasetBudget,
|
|
type StoredRecord,
|
|
type StoredRetentionRecord,
|
|
} from "./indexeddb-records.ts";
|
|
import type {
|
|
IndexedDbMaintenanceDependencies,
|
|
IndexedDbObservation,
|
|
} from "./indexeddb-types.ts";
|
|
|
|
type StoredCheckpoint = Readonly<{
|
|
checkpointKey: string;
|
|
migrationId: string;
|
|
targetCodecVersion: number;
|
|
lastKey: string | null;
|
|
state: "MORE" | "COMPLETE";
|
|
}>;
|
|
|
|
type CheckpointState = Readonly<{
|
|
persisted: StoredCheckpoint | null;
|
|
effective: Readonly<{
|
|
lastKey: string | null;
|
|
state: "MORE" | "COMPLETE";
|
|
}>;
|
|
}>;
|
|
|
|
type ScanBatch = Readonly<{
|
|
rows: readonly StoredRecord[];
|
|
reachedEnd: boolean;
|
|
budgetExhausted: boolean;
|
|
}>;
|
|
|
|
type PreparedRecord<WireValue> = Readonly<{
|
|
source: StoredRecord;
|
|
needsMigration: boolean;
|
|
migratedPayload: WireValue | undefined;
|
|
measuredBytes: number | undefined;
|
|
}>;
|
|
|
|
const SAFE_IDENTIFIER = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
|
|
const MAX_BATCH_ROWS = 500;
|
|
const MAX_BATCH_DURATION_MS = 30_000;
|
|
|
|
function isStoredCheckpoint(
|
|
value: unknown,
|
|
checkpointKey: string,
|
|
): value is StoredCheckpoint {
|
|
if (!value || typeof value !== "object") return false;
|
|
const checkpoint = value as Partial<StoredCheckpoint>;
|
|
return (
|
|
checkpoint.checkpointKey === checkpointKey &&
|
|
typeof checkpoint.migrationId === "string" &&
|
|
SAFE_IDENTIFIER.test(checkpoint.migrationId) &&
|
|
isPositiveInteger(checkpoint.targetCodecVersion) &&
|
|
(checkpoint.lastKey === null ||
|
|
isValidBoundaryIdentifier(checkpoint.lastKey)) &&
|
|
(checkpoint.state === "MORE" ||
|
|
checkpoint.state === "COMPLETE")
|
|
);
|
|
}
|
|
|
|
function sameCheckpoint(
|
|
left: StoredCheckpoint | null,
|
|
right: StoredCheckpoint | null,
|
|
): boolean {
|
|
if (left === null || right === null) return left === right;
|
|
return (
|
|
left.checkpointKey === right.checkpointKey &&
|
|
left.migrationId === right.migrationId &&
|
|
left.targetCodecVersion === right.targetCodecVersion &&
|
|
left.lastKey === right.lastKey &&
|
|
left.state === right.state
|
|
);
|
|
}
|
|
|
|
function invalidInput(): BrowserDataResult<never> {
|
|
return browserDataFailure("INVALID_INPUT", "INDEXEDDB_MIGRATE");
|
|
}
|
|
|
|
function migrationFailed(): BrowserDataResult<never> {
|
|
return browserDataFailure("MIGRATION_FAILED", "INDEXEDDB_MIGRATE", {
|
|
recovery: "READ_ONLY",
|
|
});
|
|
}
|
|
|
|
function unavailable(): BrowserDataResult<never> {
|
|
return browserDataFailure("UNAVAILABLE", "INDEXEDDB_MIGRATE", {
|
|
retryable: true,
|
|
recovery: "REOPEN",
|
|
});
|
|
}
|
|
|
|
function unsupported(): BrowserDataResult<never> {
|
|
return browserDataFailure("UNSUPPORTED", "INDEXEDDB_MIGRATE", {
|
|
recovery: "ONLINE_ONLY",
|
|
});
|
|
}
|
|
|
|
function invalidInputFailure(): BrowserDataFailure {
|
|
return failureOf(invalidInput());
|
|
}
|
|
|
|
function migrationFailure(): BrowserDataFailure {
|
|
return failureOf(migrationFailed());
|
|
}
|
|
|
|
function corruptFailure(): BrowserDataFailure {
|
|
return failureOf(
|
|
browserDataFailure("CORRUPT_DATA", "INDEXEDDB_MIGRATE", {
|
|
recovery: "READ_ONLY",
|
|
}),
|
|
);
|
|
}
|
|
|
|
function unsupportedFailure(): BrowserDataFailure {
|
|
return failureOf(unsupported());
|
|
}
|
|
|
|
function mappedFailure(error: unknown): BrowserDataFailure {
|
|
return failureOf(mapIndexedDbException(error, "INDEXEDDB_MIGRATE"));
|
|
}
|
|
|
|
function defaultNow(): number {
|
|
return typeof globalThis.performance === "undefined"
|
|
? Date.now()
|
|
: globalThis.performance.now();
|
|
}
|
|
|
|
/**
|
|
* Creates an opt-in one-shot maintenance adapter. Every batch opens and closes
|
|
* its own exact-version connection so the repository runtime does not expose a
|
|
* native connection or transaction across its public boundary.
|
|
*/
|
|
export function createIndexedDbMaintenance<WireValue>(
|
|
inputDependencies: IndexedDbMaintenanceDependencies<WireValue>,
|
|
): IndexedDbMaintenancePort {
|
|
const expectedBinding = createIndexedDbDatasetBinding(
|
|
inputDependencies.scope,
|
|
inputDependencies.storagePolicy,
|
|
);
|
|
const storagePolicySnapshot = expectedBinding.storagePolicy;
|
|
const migrationPolicySource =
|
|
inputDependencies.migrationPolicy;
|
|
const dependencies: IndexedDbMaintenanceDependencies<WireValue> =
|
|
Object.freeze({
|
|
...inputDependencies,
|
|
scope: expectedBinding.scope,
|
|
storagePolicy: storagePolicySnapshot,
|
|
migrationPolicy: Object.freeze({
|
|
migrationId: migrationPolicySource.migrationId,
|
|
targetCodecVersion:
|
|
migrationPolicySource.targetCodecVersion,
|
|
measureStoredBytes:
|
|
migrationPolicySource.measureStoredBytes.bind(
|
|
migrationPolicySource,
|
|
),
|
|
isOldWriterDrainConfirmed:
|
|
migrationPolicySource.isOldWriterDrainConfirmed.bind(
|
|
migrationPolicySource,
|
|
),
|
|
migrate: migrationPolicySource.migrate.bind(
|
|
migrationPolicySource,
|
|
),
|
|
}),
|
|
...(inputDependencies.keyRange
|
|
? {
|
|
keyRange: Object.freeze({
|
|
lowerBound:
|
|
inputDependencies.keyRange.lowerBound.bind(
|
|
inputDependencies.keyRange,
|
|
),
|
|
upperBound:
|
|
inputDependencies.keyRange.upperBound.bind(
|
|
inputDependencies.keyRange,
|
|
),
|
|
}),
|
|
}
|
|
: {}),
|
|
...(inputDependencies.durability
|
|
? {
|
|
durability: Object.freeze({
|
|
...inputDependencies.durability,
|
|
}),
|
|
}
|
|
: {}),
|
|
});
|
|
const databaseName = indexedDbPhysicalDatabaseName(
|
|
expectedBinding.scope,
|
|
);
|
|
if (
|
|
(dependencies.databaseNameAssertion !== undefined &&
|
|
dependencies.databaseNameAssertion !== databaseName) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.recordStore) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.governanceStore) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.retentionStore) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.checkpointStore) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.checkpointKey) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.idempotencyStore) ||
|
|
!SAFE_IDENTIFIER.test(
|
|
dependencies.idempotencyExpiryIndex,
|
|
) ||
|
|
!SAFE_IDENTIFIER.test(dependencies.migrationPolicy.migrationId) ||
|
|
new Set([
|
|
dependencies.recordStore,
|
|
dependencies.governanceStore,
|
|
dependencies.retentionStore,
|
|
dependencies.checkpointStore,
|
|
dependencies.idempotencyStore,
|
|
]).size !== 5 ||
|
|
!isPositiveInteger(dependencies.schemaVersion) ||
|
|
!isPositiveInteger(
|
|
dependencies.migrationPolicy.targetCodecVersion,
|
|
)
|
|
) {
|
|
throw new TypeError("IndexedDB maintenance configuration is invalid.");
|
|
}
|
|
|
|
const factory =
|
|
dependencies.factory ??
|
|
(typeof globalThis.indexedDB === "undefined"
|
|
? undefined
|
|
: globalThis.indexedDB);
|
|
const keyRange =
|
|
dependencies.keyRange ??
|
|
(typeof globalThis.IDBKeyRange === "undefined"
|
|
? undefined
|
|
: globalThis.IDBKeyRange);
|
|
const now = dependencies.now ?? defaultNow;
|
|
const nowEpochMilliseconds =
|
|
dependencies.nowEpochMilliseconds ?? Date.now;
|
|
|
|
function observe(event: IndexedDbObservation): void {
|
|
try {
|
|
dependencies.observe?.(Object.freeze(event));
|
|
} catch {
|
|
// Maintenance correctness is independent from observation.
|
|
}
|
|
}
|
|
|
|
function observeResult<Value>(
|
|
result: BrowserDataResult<Value>,
|
|
count = 0,
|
|
): BrowserDataResult<Value> {
|
|
observe({
|
|
operation: "INDEXEDDB_MIGRATE",
|
|
outcome: result.ok
|
|
? "SUCCESS"
|
|
: result.error.code === "ABORTED"
|
|
? "ABORTED"
|
|
: result.error.code === "BLOCKED"
|
|
? "BLOCKED"
|
|
: "FAILED",
|
|
schemaVersion: dependencies.schemaVersion,
|
|
countBucket: countBucket(count),
|
|
...(result.ok ? {} : { failureCode: result.error.code }),
|
|
});
|
|
return result;
|
|
}
|
|
|
|
function clock(): BrowserDataResult<number> {
|
|
try {
|
|
const value = now();
|
|
return Number.isFinite(value)
|
|
? browserDataSuccess(value)
|
|
: invalidInput();
|
|
} catch {
|
|
return unavailable();
|
|
}
|
|
}
|
|
|
|
function epochClock(): BrowserDataResult<number> {
|
|
try {
|
|
const value = nowEpochMilliseconds();
|
|
return Number.isSafeInteger(value) && value >= 0
|
|
? browserDataSuccess(value)
|
|
: invalidInput();
|
|
} catch {
|
|
return unavailable();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* STO-06. Maintenance uses `mapIndexedDbException`, the one IndexedDB table
|
|
* in `browser-file-storage/result.ts` that the runtime and the OPFS journal
|
|
* share (05-11).
|
|
*
|
|
* One translator covers the whole adapter because the operation label is the
|
|
* constant `INDEXEDDB_MIGRATE` here — the runtime needs one per operation.
|
|
*/
|
|
const translate: IndexedDbTranslate<BrowserDataFailure> = (cause) => {
|
|
switch (cause.kind) {
|
|
case "NATIVE_EXCEPTION":
|
|
return mappedFailure(cause.error);
|
|
case "BLOCKED":
|
|
case "BLOCKED_DEADLINE":
|
|
return failureOf(
|
|
browserDataFailure("BLOCKED", "INDEXEDDB_MIGRATE", {
|
|
retryable: true,
|
|
recovery: "RELOAD_OTHER_CONTEXTS",
|
|
}),
|
|
);
|
|
case "CALLER_ABORT":
|
|
return failureOf(
|
|
browserDataFailure("ABORTED", "INDEXEDDB_MIGRATE"),
|
|
);
|
|
case "CLOSED":
|
|
case "NO_VALUE_PRODUCED":
|
|
// A transaction that committed without producing a value is retried,
|
|
// not reconciled. `CLOSED` cannot reach here — maintenance opens a
|
|
// connection per batch instead of holding a cached handle — and is
|
|
// mapped alongside it so the union stays total.
|
|
return failureOf(unavailable());
|
|
case "UPGRADE_REJECTED":
|
|
// Maintenance owns no schema. Any upgrade means the database is not
|
|
// the one this batch was configured against.
|
|
return migrationFailure();
|
|
case "ADMISSION_REJECTED":
|
|
return cause.detail === "POLICY"
|
|
? failureOf(
|
|
browserDataFailure("POLICY_REJECTED", "INDEXEDDB_MIGRATE", {
|
|
recovery: storagePolicySnapshot.unavailableFallback,
|
|
}),
|
|
)
|
|
: migrationFailure();
|
|
case "UNSUPPORTED":
|
|
return unsupportedFailure();
|
|
default: {
|
|
const exhaustive: never = cause;
|
|
return exhaustive;
|
|
}
|
|
}
|
|
};
|
|
|
|
function validBatchInput(
|
|
input: IndexedDbMaintenanceBatchInput,
|
|
): boolean {
|
|
return (
|
|
isPositiveInteger(input.maxRows) &&
|
|
input.maxRows <= MAX_BATCH_ROWS &&
|
|
isPositiveInteger(input.maxDurationMs) &&
|
|
input.maxDurationMs <= MAX_BATCH_DURATION_MS
|
|
);
|
|
}
|
|
|
|
function openExactVersion(
|
|
signal: AbortSignal | undefined,
|
|
): Promise<BrowserDataResult<IDBDatabase>> {
|
|
const cancelled = abortedResult(signal, "INDEXEDDB_MIGRATE");
|
|
if (cancelled) return Promise.resolve(cancelled);
|
|
if (!factory) return Promise.resolve(unsupported());
|
|
|
|
return openIndexedDbDatabase<BrowserDataFailure>({
|
|
factory,
|
|
databaseName,
|
|
version: dependencies.schemaVersion,
|
|
translate,
|
|
signal,
|
|
// No `blockedTimeoutMs`, and therefore no `timers`. The blocked event is
|
|
// terminal for maintenance: a batch is an opt-in background pass, so
|
|
// hanging it for a deadline in the hope another context goes away costs
|
|
// more than reporting BLOCKED and letting the caller retry.
|
|
//
|
|
// No `upgrade` either. The kernel reads an omitted callback as "any
|
|
// upgrade is unexpected" and rejects it, which is what maintenance has
|
|
// always done: it migrates records under a schema somebody else owns and
|
|
// must never create or change one.
|
|
admit: async (database) => {
|
|
for (const store of [
|
|
dependencies.recordStore,
|
|
dependencies.governanceStore,
|
|
dependencies.retentionStore,
|
|
dependencies.checkpointStore,
|
|
dependencies.idempotencyStore,
|
|
]) {
|
|
if (!database.objectStoreNames.contains(store)) {
|
|
return { kind: "REJECT", detail: "STORE" };
|
|
}
|
|
}
|
|
try {
|
|
openIndexedDbTransaction(
|
|
database,
|
|
[dependencies.idempotencyStore],
|
|
"readonly",
|
|
)
|
|
.objectStore(dependencies.idempotencyStore)
|
|
.index(dependencies.idempotencyExpiryIndex);
|
|
} catch {
|
|
return { kind: "REJECT", detail: "INDEX" };
|
|
}
|
|
// Maintenance never holds the connection past a batch, so the listener
|
|
// belongs here rather than on a cached handle: `admit` runs on the
|
|
// successful open path only, which is exactly the window the batch
|
|
// owns the connection for.
|
|
database.onversionchange = () => database.close();
|
|
const binding = await verifyIndexedDbDatasetBinding(
|
|
database,
|
|
dependencies.governanceStore,
|
|
expectedBinding,
|
|
signal,
|
|
);
|
|
if (binding.ok) return { kind: "ADMIT" };
|
|
return binding.reason === "ABORTED"
|
|
? { kind: "FAIL", cause: { kind: "CALLER_ABORT" } }
|
|
: binding.reason === "NATIVE_ERROR"
|
|
? {
|
|
kind: "FAIL",
|
|
cause: { kind: "NATIVE_EXCEPTION", error: binding.error },
|
|
}
|
|
: { kind: "REJECT", detail: "POLICY" };
|
|
},
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Durability is named explicitly on both sides because maintenance rewrites
|
|
* records: a write that is only queued when the tab goes away would leave a
|
|
* checkpoint claiming rows that were never stored. The kernel falls back to
|
|
* the no-options form on an engine that rejects the bag.
|
|
*/
|
|
function runTransaction<Value>(
|
|
database: IDBDatabase,
|
|
stores: readonly string[],
|
|
mode: "readonly" | "readwrite",
|
|
signal: AbortSignal | undefined,
|
|
queue: (
|
|
transaction: IDBTransaction,
|
|
context: IndexedDbTransactionContext<Value, BrowserDataFailure>,
|
|
) => void,
|
|
): Promise<BrowserDataResult<Value>> {
|
|
return runIndexedDbTransaction<Value, BrowserDataFailure>({
|
|
database,
|
|
stores,
|
|
mode,
|
|
translate,
|
|
signal,
|
|
durability:
|
|
mode === "readonly"
|
|
? dependencies.durability?.read ?? "default"
|
|
: dependencies.durability?.write ?? "strict",
|
|
queue,
|
|
});
|
|
}
|
|
|
|
async function readCheckpoint(
|
|
database: IDBDatabase,
|
|
signal: AbortSignal | undefined,
|
|
): Promise<BrowserDataResult<CheckpointState>> {
|
|
return await runTransaction(
|
|
database,
|
|
[dependencies.checkpointStore],
|
|
"readonly",
|
|
signal,
|
|
(transaction, context) => {
|
|
const request = transaction
|
|
.objectStore(dependencies.checkpointStore)
|
|
.get(dependencies.checkpointKey);
|
|
request.onerror = () => context.requestFailed(request.error);
|
|
request.onsuccess = () => {
|
|
if (request.result === undefined) {
|
|
context.succeed({
|
|
persisted: null,
|
|
effective: { lastKey: null, state: "MORE" },
|
|
});
|
|
return;
|
|
}
|
|
if (
|
|
!isStoredCheckpoint(
|
|
request.result,
|
|
dependencies.checkpointKey,
|
|
)
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
const persisted = request.result;
|
|
const currentPolicy =
|
|
persisted.migrationId ===
|
|
dependencies.migrationPolicy.migrationId &&
|
|
persisted.targetCodecVersion ===
|
|
dependencies.migrationPolicy.targetCodecVersion;
|
|
context.succeed({
|
|
persisted,
|
|
effective: currentPolicy
|
|
? {
|
|
lastKey: persisted.lastKey,
|
|
state: persisted.state,
|
|
}
|
|
: { lastKey: null, state: "MORE" },
|
|
});
|
|
};
|
|
},
|
|
);
|
|
}
|
|
|
|
async function scanBatch(
|
|
database: IDBDatabase,
|
|
checkpoint: CheckpointState,
|
|
input: IndexedDbMaintenanceBatchInput,
|
|
deadline: number,
|
|
): Promise<BrowserDataResult<ScanBatch>> {
|
|
return await runTransaction(
|
|
database,
|
|
[dependencies.recordStore],
|
|
"readonly",
|
|
input.signal,
|
|
(transaction, context) => {
|
|
let query: IDBKeyRange | undefined;
|
|
try {
|
|
query =
|
|
checkpoint.effective.lastKey === null
|
|
? undefined
|
|
: keyRange?.lowerBound(
|
|
checkpoint.effective.lastKey,
|
|
true,
|
|
);
|
|
} catch {
|
|
context.fail(invalidInputFailure());
|
|
return;
|
|
}
|
|
if (checkpoint.effective.lastKey !== null && !query) {
|
|
context.fail(unsupportedFailure());
|
|
return;
|
|
}
|
|
|
|
const rows: StoredRecord[] = [];
|
|
// The scan bounds on rows it read, so the counter the kernel offers is
|
|
// the right one here. The time check comes first so a batch that ran
|
|
// out of both answers `budgetExhausted` the way it does today.
|
|
const budget: IndexedDbBudget<BrowserDataFailure> = {
|
|
admit: (scannedRows) => {
|
|
const currentTime = clock();
|
|
if (!currentTime.ok) return currentTime;
|
|
if (currentTime.value >= deadline) {
|
|
return browserDataSuccess("TIME_BUDGET" as const);
|
|
}
|
|
return browserDataSuccess(
|
|
scannedRows >= input.maxRows
|
|
? ("ROW_BUDGET" as const)
|
|
: ("CONTINUE" as const),
|
|
);
|
|
},
|
|
};
|
|
walkIndexedDbCursor<BrowserDataFailure>({
|
|
request: transaction
|
|
.objectStore(dependencies.recordStore)
|
|
.openCursor(query),
|
|
sink: context,
|
|
translate,
|
|
budget,
|
|
signal: input.signal,
|
|
visit: ({ cursor }) => {
|
|
if (
|
|
!isStoredRecord(cursor.value) ||
|
|
cursor.value.codecVersion >
|
|
dependencies.migrationPolicy.targetCodecVersion
|
|
) {
|
|
context.fail(migrationFailure());
|
|
// `fail` aborts, so the walk has nowhere to go. Suspending
|
|
// without ever resuming says that without asking the pump for
|
|
// another row or claiming a summary the scan never reached.
|
|
return { kind: "SUSPEND" };
|
|
}
|
|
rows.push({
|
|
key: cursor.value.key,
|
|
codecVersion: cursor.value.codecVersion,
|
|
revision: cursor.value.revision,
|
|
payload: cursor.value.payload,
|
|
});
|
|
return { kind: "CONTINUE" };
|
|
},
|
|
done: (summary) => {
|
|
if (summary.reason === "ABORTED") return;
|
|
context.succeed({
|
|
rows: Object.freeze(rows),
|
|
reachedEnd: summary.reason === "EXHAUSTED",
|
|
budgetExhausted: summary.reason === "TIME_BUDGET",
|
|
});
|
|
},
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
async function prepareRecords(
|
|
scan: ScanBatch,
|
|
input: IndexedDbMaintenanceBatchInput,
|
|
deadline: number,
|
|
): Promise<
|
|
BrowserDataResult<
|
|
Readonly<{
|
|
records: readonly PreparedRecord<WireValue>[];
|
|
budgetExhausted: boolean;
|
|
}>
|
|
>
|
|
> {
|
|
const prepared: PreparedRecord<WireValue>[] = [];
|
|
let budgetExhausted = scan.budgetExhausted;
|
|
for (const source of scan.rows) {
|
|
const cancelled = abortedResult(
|
|
input.signal,
|
|
"INDEXEDDB_MIGRATE",
|
|
);
|
|
if (cancelled) return cancelled;
|
|
const currentTime = clock();
|
|
if (!currentTime.ok) return currentTime;
|
|
if (currentTime.value >= deadline) {
|
|
budgetExhausted = true;
|
|
break;
|
|
}
|
|
if (
|
|
source.codecVersion ===
|
|
dependencies.migrationPolicy.targetCodecVersion
|
|
) {
|
|
prepared.push({
|
|
source,
|
|
needsMigration: false,
|
|
migratedPayload: undefined,
|
|
measuredBytes: undefined,
|
|
});
|
|
continue;
|
|
}
|
|
|
|
let migrated;
|
|
try {
|
|
migrated = await dependencies.migrationPolicy.migrate({
|
|
key: source.key,
|
|
fromCodecVersion: source.codecVersion,
|
|
payload: source.payload,
|
|
signal: input.signal,
|
|
});
|
|
} catch {
|
|
return migrationFailed();
|
|
}
|
|
if (input.signal?.aborted) {
|
|
return browserDataFailure(
|
|
"ABORTED",
|
|
"INDEXEDDB_MIGRATE",
|
|
);
|
|
}
|
|
if (!migrated.ok) return migrationFailed();
|
|
let migratedPayload: WireValue;
|
|
try {
|
|
// Keep the prepared batch independent from objects retained by an
|
|
// asynchronous migration policy and fail before opening a write
|
|
// transaction when the result is not structured-cloneable.
|
|
migratedPayload = structuredClone(migrated.value);
|
|
} catch {
|
|
return migrationFailed();
|
|
}
|
|
const measuredBytes = measureRecordBytes(source.key, () =>
|
|
dependencies.migrationPolicy.measureStoredBytes(migratedPayload),
|
|
);
|
|
if (measuredBytes === null) return migrationFailed();
|
|
const afterMigration = clock();
|
|
if (!afterMigration.ok) return afterMigration;
|
|
if (afterMigration.value >= deadline) {
|
|
budgetExhausted = true;
|
|
}
|
|
prepared.push({
|
|
source,
|
|
needsMigration: true,
|
|
migratedPayload,
|
|
measuredBytes,
|
|
});
|
|
}
|
|
return browserDataSuccess({
|
|
records: Object.freeze(prepared),
|
|
budgetExhausted,
|
|
});
|
|
}
|
|
|
|
async function commitPrepared(
|
|
database: IDBDatabase,
|
|
checkpoint: CheckpointState,
|
|
prepared: readonly PreparedRecord<WireValue>[],
|
|
scan: ScanBatch,
|
|
budgetExhausted: boolean,
|
|
deadline: number,
|
|
signal: AbortSignal | undefined,
|
|
): Promise<
|
|
BrowserDataResult<IndexedDbMaintenanceBatchReceipt>
|
|
> {
|
|
return await runTransaction(
|
|
database,
|
|
[
|
|
dependencies.recordStore,
|
|
dependencies.governanceStore,
|
|
dependencies.retentionStore,
|
|
dependencies.checkpointStore,
|
|
],
|
|
"readwrite",
|
|
signal,
|
|
(transaction, context) => {
|
|
const records = transaction.objectStore(
|
|
dependencies.recordStore,
|
|
);
|
|
const checkpoints = transaction.objectStore(
|
|
dependencies.checkpointStore,
|
|
);
|
|
const governance = transaction.objectStore(
|
|
dependencies.governanceStore,
|
|
);
|
|
const retention = transaction.objectStore(
|
|
dependencies.retentionStore,
|
|
);
|
|
let migratedRows = 0;
|
|
let concurrentlyChangedRows = 0;
|
|
let safeRows = 0;
|
|
let lastSafeKey = checkpoint.effective.lastKey;
|
|
|
|
const finishWithCheckpoint = () => {
|
|
const complete =
|
|
safeRows === prepared.length &&
|
|
prepared.length === scan.rows.length &&
|
|
scan.reachedEnd;
|
|
const stored: StoredCheckpoint = Object.freeze({
|
|
checkpointKey: dependencies.checkpointKey,
|
|
migrationId:
|
|
dependencies.migrationPolicy.migrationId,
|
|
targetCodecVersion:
|
|
dependencies.migrationPolicy.targetCodecVersion,
|
|
lastKey: lastSafeKey,
|
|
state: complete ? "COMPLETE" : "MORE",
|
|
});
|
|
let request: IDBRequest<IDBValidKey>;
|
|
try {
|
|
request = checkpoints.put(stored);
|
|
} catch (error) {
|
|
context.fail(mappedFailure(error));
|
|
return;
|
|
}
|
|
request.onerror = () =>
|
|
context.requestFailed(request.error);
|
|
request.onsuccess = () =>
|
|
context.succeed(
|
|
Object.freeze({
|
|
state: stored.state,
|
|
scannedRows: prepared.length,
|
|
checkpointedRows: safeRows,
|
|
migratedRows,
|
|
concurrentlyChangedRows,
|
|
budgetExhausted,
|
|
}),
|
|
);
|
|
};
|
|
|
|
const processRecord = (index: number) => {
|
|
const preparedRecord = prepared[index];
|
|
if (!preparedRecord) {
|
|
finishWithCheckpoint();
|
|
return;
|
|
}
|
|
// STO-06. The commit chain runs entirely inside IndexedDB callbacks,
|
|
// so without this check up to `maxRows` records keep executing past
|
|
// the caller's invocation deadline. The budget is only ever checked
|
|
// before a record's first write, so a started record still finishes
|
|
// atomically and the checkpoint stays exactly at the last safe key.
|
|
const currentTime = clock();
|
|
if (!currentTime.ok) {
|
|
// A broken clock aborts rather than committing an unbounded batch.
|
|
context.fail(currentTime.error);
|
|
return;
|
|
}
|
|
if (currentTime.value >= deadline) {
|
|
budgetExhausted = true;
|
|
finishWithCheckpoint();
|
|
return;
|
|
}
|
|
let request: IDBRequest<unknown>;
|
|
try {
|
|
request = records.get(preparedRecord.source.key);
|
|
} catch (error) {
|
|
context.fail(mappedFailure(error));
|
|
return;
|
|
}
|
|
request.onerror = () =>
|
|
context.requestFailed(request.error);
|
|
request.onsuccess = () => {
|
|
const live = request.result;
|
|
if (live === undefined) {
|
|
concurrentlyChangedRows += 1;
|
|
safeRows += 1;
|
|
lastSafeKey = preparedRecord.source.key;
|
|
processRecord(index + 1);
|
|
return;
|
|
}
|
|
if (
|
|
!isStoredRecord(
|
|
live,
|
|
preparedRecord.source.key,
|
|
)
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
if (
|
|
live.codecVersion ===
|
|
dependencies.migrationPolicy.targetCodecVersion
|
|
) {
|
|
if (
|
|
live.codecVersion !==
|
|
preparedRecord.source.codecVersion ||
|
|
live.revision !== preparedRecord.source.revision
|
|
) {
|
|
concurrentlyChangedRows += 1;
|
|
}
|
|
safeRows += 1;
|
|
lastSafeKey = preparedRecord.source.key;
|
|
processRecord(index + 1);
|
|
return;
|
|
}
|
|
if (
|
|
live.codecVersion !==
|
|
preparedRecord.source.codecVersion ||
|
|
live.revision !== preparedRecord.source.revision
|
|
) {
|
|
concurrentlyChangedRows += 1;
|
|
finishWithCheckpoint();
|
|
return;
|
|
}
|
|
if (
|
|
!preparedRecord.needsMigration ||
|
|
preparedRecord.measuredBytes === undefined
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
const measuredBytes = preparedRecord.measuredBytes;
|
|
const sidecarRequest = retention.get(live.key);
|
|
sidecarRequest.onerror = () =>
|
|
context.requestFailed(sidecarRequest.error);
|
|
sidecarRequest.onsuccess = () => {
|
|
if (
|
|
!isStoredRetentionRecord(
|
|
sidecarRequest.result,
|
|
live.key,
|
|
)
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
const previousSidecar = sidecarRequest.result;
|
|
const budgetRequest = governance.get(
|
|
INDEXEDDB_DATASET_BUDGET_KEY,
|
|
);
|
|
budgetRequest.onerror = () =>
|
|
context.requestFailed(budgetRequest.error);
|
|
budgetRequest.onsuccess = () => {
|
|
if (
|
|
!isStoredDatasetBudget(budgetRequest.result) ||
|
|
budgetRequest.result.usedBytes <
|
|
previousSidecar.measuredBytes
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
const usedBytes =
|
|
budgetRequest.result.usedBytes -
|
|
previousSidecar.measuredBytes +
|
|
measuredBytes;
|
|
if (
|
|
!Number.isSafeInteger(usedBytes) ||
|
|
usedBytes < 0 ||
|
|
usedBytes >
|
|
storagePolicySnapshot.hardBudgetBytes
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
const writeRequest = records.put({
|
|
key: live.key,
|
|
codecVersion:
|
|
dependencies.migrationPolicy
|
|
.targetCodecVersion,
|
|
revision: live.revision,
|
|
payload: preparedRecord.migratedPayload,
|
|
} satisfies StoredRecord);
|
|
writeRequest.onerror = () =>
|
|
context.requestFailed(writeRequest.error);
|
|
writeRequest.onsuccess = () => {
|
|
const retentionRequest = retention.put({
|
|
...previousSidecar,
|
|
measuredBytes,
|
|
} satisfies StoredRetentionRecord);
|
|
retentionRequest.onerror = () =>
|
|
context.requestFailed(
|
|
retentionRequest.error,
|
|
);
|
|
retentionRequest.onsuccess = () => {
|
|
const budgetWrite = governance.put({
|
|
...budgetRequest.result,
|
|
usedBytes,
|
|
} satisfies StoredDatasetBudget);
|
|
budgetWrite.onerror = () =>
|
|
context.requestFailed(budgetWrite.error);
|
|
budgetWrite.onsuccess = () => {
|
|
migratedRows += 1;
|
|
safeRows += 1;
|
|
lastSafeKey = preparedRecord.source.key;
|
|
processRecord(index + 1);
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
const checkpointRequest = checkpoints.get(
|
|
dependencies.checkpointKey,
|
|
);
|
|
checkpointRequest.onerror = () =>
|
|
context.requestFailed(checkpointRequest.error);
|
|
checkpointRequest.onsuccess = () => {
|
|
let liveCheckpoint: StoredCheckpoint | null = null;
|
|
if (checkpointRequest.result !== undefined) {
|
|
if (
|
|
!isStoredCheckpoint(
|
|
checkpointRequest.result,
|
|
dependencies.checkpointKey,
|
|
)
|
|
) {
|
|
context.fail(migrationFailure());
|
|
return;
|
|
}
|
|
liveCheckpoint = checkpointRequest.result;
|
|
}
|
|
if (
|
|
!sameCheckpoint(
|
|
liveCheckpoint,
|
|
checkpoint.persisted,
|
|
)
|
|
) {
|
|
context.succeed(
|
|
Object.freeze({
|
|
state: "MORE" as const,
|
|
scannedRows: prepared.length,
|
|
checkpointedRows: 0,
|
|
migratedRows: 0,
|
|
concurrentlyChangedRows: 1,
|
|
budgetExhausted,
|
|
}),
|
|
);
|
|
return;
|
|
}
|
|
processRecord(0);
|
|
};
|
|
},
|
|
);
|
|
}
|
|
|
|
async function migrateCodecBatch(
|
|
sourceInput: IndexedDbMaintenanceBatchInput,
|
|
): Promise<
|
|
BrowserDataResult<IndexedDbMaintenanceBatchReceipt>
|
|
> {
|
|
if (!validBatchInput(sourceInput)) {
|
|
return observeResult(invalidInput());
|
|
}
|
|
const input: IndexedDbMaintenanceBatchInput = Object.freeze({
|
|
maxRows: sourceInput.maxRows,
|
|
maxDurationMs: sourceInput.maxDurationMs,
|
|
...(sourceInput.signal ? { signal: sourceInput.signal } : {}),
|
|
});
|
|
const started = clock();
|
|
if (!started.ok) return observeResult(started);
|
|
const deadline = started.value + input.maxDurationMs;
|
|
if (!Number.isFinite(deadline)) {
|
|
return observeResult(invalidInput());
|
|
}
|
|
let oldWriterDrainConfirmed: boolean;
|
|
try {
|
|
oldWriterDrainConfirmed =
|
|
await dependencies.migrationPolicy.isOldWriterDrainConfirmed(
|
|
input.signal,
|
|
);
|
|
} catch {
|
|
return observeResult(unavailable());
|
|
}
|
|
if (input.signal?.aborted) {
|
|
return observeResult(
|
|
browserDataFailure("ABORTED", "INDEXEDDB_MIGRATE"),
|
|
);
|
|
}
|
|
if (oldWriterDrainConfirmed !== true) {
|
|
return observeResult(
|
|
browserDataFailure("BLOCKED", "INDEXEDDB_MIGRATE", {
|
|
retryable: true,
|
|
recovery: "RELOAD_OTHER_CONTEXTS",
|
|
}),
|
|
);
|
|
}
|
|
const opened = await openExactVersion(input.signal);
|
|
if (!opened.ok) return observeResult(opened);
|
|
const database = opened.value;
|
|
|
|
try {
|
|
const checkpoint = await readCheckpoint(
|
|
database,
|
|
input.signal,
|
|
);
|
|
if (!checkpoint.ok) return observeResult(checkpoint);
|
|
if (checkpoint.value.effective.state === "COMPLETE") {
|
|
return observeResult(
|
|
browserDataSuccess(
|
|
Object.freeze({
|
|
state: "COMPLETE",
|
|
scannedRows: 0,
|
|
checkpointedRows: 0,
|
|
migratedRows: 0,
|
|
concurrentlyChangedRows: 0,
|
|
budgetExhausted: false,
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
|
|
const scan = await scanBatch(
|
|
database,
|
|
checkpoint.value,
|
|
input,
|
|
deadline,
|
|
);
|
|
if (!scan.ok) return observeResult(scan);
|
|
const prepared = await prepareRecords(
|
|
scan.value,
|
|
input,
|
|
deadline,
|
|
);
|
|
if (!prepared.ok) return observeResult(prepared);
|
|
if (
|
|
prepared.value.records.length === 0 &&
|
|
!scan.value.reachedEnd
|
|
) {
|
|
return observeResult(
|
|
browserDataSuccess(
|
|
Object.freeze({
|
|
state: "MORE",
|
|
scannedRows: 0,
|
|
checkpointedRows: 0,
|
|
migratedRows: 0,
|
|
concurrentlyChangedRows: 0,
|
|
budgetExhausted:
|
|
prepared.value.budgetExhausted,
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
|
|
const committed = await commitPrepared(
|
|
database,
|
|
checkpoint.value,
|
|
prepared.value.records,
|
|
scan.value,
|
|
prepared.value.budgetExhausted,
|
|
deadline,
|
|
input.signal,
|
|
);
|
|
return observeResult(
|
|
committed,
|
|
committed.ok ? committed.value.migratedRows : 0,
|
|
);
|
|
} finally {
|
|
database.close();
|
|
}
|
|
}
|
|
|
|
async function pruneExpiredReceipts(
|
|
sourceInput: IndexedDbMaintenanceBatchInput,
|
|
): Promise<
|
|
BrowserDataResult<IndexedDbReceiptPruneBatchReceipt>
|
|
> {
|
|
if (!validBatchInput(sourceInput)) {
|
|
return observeResult(invalidInput());
|
|
}
|
|
const input: IndexedDbMaintenanceBatchInput = Object.freeze({
|
|
maxRows: sourceInput.maxRows,
|
|
maxDurationMs: sourceInput.maxDurationMs,
|
|
...(sourceInput.signal ? { signal: sourceInput.signal } : {}),
|
|
});
|
|
const started = clock();
|
|
if (!started.ok) return observeResult(started);
|
|
const cutoff = epochClock();
|
|
if (!cutoff.ok) return observeResult(cutoff);
|
|
const deadline = started.value + input.maxDurationMs;
|
|
if (!Number.isFinite(deadline)) {
|
|
return observeResult(invalidInput());
|
|
}
|
|
const opened = await openExactVersion(input.signal);
|
|
if (!opened.ok) return observeResult(opened);
|
|
const database = opened.value;
|
|
// 05-05. A corrupt receipt is left in place and counted, not a stop: one
|
|
// bad row used to end every later prune, so receipts piled up until every
|
|
// write failed with LIMIT_EXCEEDED. A receipt count already at zero stays
|
|
// there. Both are reported as one CORRUPT_DATA observation.
|
|
let corruptRows = 0;
|
|
|
|
try {
|
|
const pruned = await runTransaction<
|
|
IndexedDbReceiptPruneBatchReceipt
|
|
>(
|
|
database,
|
|
[
|
|
dependencies.governanceStore,
|
|
dependencies.idempotencyStore,
|
|
],
|
|
"readwrite",
|
|
input.signal,
|
|
(transaction, context) => {
|
|
const store = transaction.objectStore(
|
|
dependencies.idempotencyStore,
|
|
);
|
|
const governance = transaction.objectStore(
|
|
dependencies.governanceStore,
|
|
);
|
|
let range: IDBKeyRange;
|
|
try {
|
|
if (!keyRange) {
|
|
context.fail(unsupportedFailure());
|
|
return;
|
|
}
|
|
range = keyRange.upperBound(cutoff.value);
|
|
} catch {
|
|
context.fail(invalidInputFailure());
|
|
return;
|
|
}
|
|
let deletedRows = 0;
|
|
// The prune bounds on rows it deleted, not on rows it read, so the
|
|
// counter stays here while the kernel counts scanned rows for the
|
|
// receipt. A row past the cutoff is corrupt data, not a stop
|
|
// condition, so the walk never reports STOPPED.
|
|
const budget: IndexedDbBudget<BrowserDataFailure> = {
|
|
admit: () => {
|
|
const currentTime = clock();
|
|
if (!currentTime.ok) return currentTime;
|
|
if (currentTime.value >= deadline) {
|
|
return browserDataSuccess("TIME_BUDGET" as const);
|
|
}
|
|
return browserDataSuccess(
|
|
deletedRows >= input.maxRows
|
|
? ("ROW_BUDGET" as const)
|
|
: ("CONTINUE" as const),
|
|
);
|
|
},
|
|
};
|
|
walkIndexedDbCursor<BrowserDataFailure>({
|
|
request: store
|
|
.index(dependencies.idempotencyExpiryIndex)
|
|
.openCursor(range),
|
|
sink: context,
|
|
translate,
|
|
budget,
|
|
signal: input.signal,
|
|
visit: ({ cursor, resume }) => {
|
|
if (
|
|
!isStoredReceipt(cursor.value) ||
|
|
cursor.value.idempotencyKey !==
|
|
String(cursor.primaryKey) ||
|
|
cursor.value.expiresAtEpochMs > cutoff.value
|
|
) {
|
|
corruptRows += 1;
|
|
return { kind: "CONTINUE" };
|
|
}
|
|
let deleteRequest: IDBRequest<undefined>;
|
|
try {
|
|
deleteRequest = store.delete(cursor.primaryKey);
|
|
} catch (error) {
|
|
context.fail(mappedFailure(error));
|
|
return { kind: "SUSPEND" };
|
|
}
|
|
deleteRequest.onerror = () =>
|
|
context.requestFailed(deleteRequest.error);
|
|
deleteRequest.onsuccess = () => {
|
|
const budgetRequest = governance.get(
|
|
INDEXEDDB_DATASET_BUDGET_KEY,
|
|
);
|
|
budgetRequest.onerror = () =>
|
|
context.requestFailed(budgetRequest.error);
|
|
budgetRequest.onsuccess = () => {
|
|
if (!isStoredDatasetBudget(budgetRequest.result)) {
|
|
context.fail(corruptFailure());
|
|
return;
|
|
}
|
|
if (budgetRequest.result.receiptCount < 1) {
|
|
corruptRows += 1;
|
|
deletedRows += 1;
|
|
resume({ kind: "CONTINUE" });
|
|
return;
|
|
}
|
|
const budgetWrite = governance.put({
|
|
...budgetRequest.result,
|
|
receiptCount:
|
|
budgetRequest.result.receiptCount - 1,
|
|
} satisfies StoredDatasetBudget);
|
|
budgetWrite.onerror = () =>
|
|
context.requestFailed(budgetWrite.error);
|
|
budgetWrite.onsuccess = () => {
|
|
deletedRows += 1;
|
|
resume({ kind: "CONTINUE" });
|
|
};
|
|
};
|
|
};
|
|
// The receipt is only counted once its whole delete chain
|
|
// commits, so the cursor stays parked until `resume`.
|
|
return { kind: "SUSPEND" };
|
|
},
|
|
done: (summary) => {
|
|
if (summary.reason === "ABORTED") return;
|
|
context.succeed(
|
|
Object.freeze({
|
|
state:
|
|
summary.reason === "EXHAUSTED"
|
|
? ("COMPLETE" as const)
|
|
: ("MORE" as const),
|
|
scannedRows: summary.scannedRows,
|
|
deletedRows,
|
|
budgetExhausted: summary.reason === "TIME_BUDGET",
|
|
}),
|
|
);
|
|
},
|
|
});
|
|
},
|
|
);
|
|
if (corruptRows > 0) {
|
|
observe({
|
|
operation: "INDEXEDDB_MIGRATE",
|
|
outcome: "FAILED",
|
|
schemaVersion: dependencies.schemaVersion,
|
|
countBucket: countBucket(corruptRows),
|
|
failureCode: "CORRUPT_DATA",
|
|
});
|
|
}
|
|
return observeResult(
|
|
pruned,
|
|
pruned.ok ? pruned.value.deletedRows : 0,
|
|
);
|
|
} finally {
|
|
database.close();
|
|
}
|
|
}
|
|
|
|
return Object.freeze({
|
|
migrateCodecBatch,
|
|
pruneExpiredReceipts,
|
|
});
|
|
}
|