@chipmobilesdk/rn-local-db 0.4.0 → 0.5.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/CHANGELOG.md +137 -0
- package/README.md +69 -8
- package/lib/commonjs/adapter/budgets.js +79 -0
- package/lib/commonjs/adapter/budgets.js.map +1 -0
- package/lib/commonjs/adapter/collection.js +236 -0
- package/lib/commonjs/adapter/collection.js.map +1 -0
- package/lib/commonjs/adapter/deletion.js +291 -0
- package/lib/commonjs/adapter/deletion.js.map +1 -0
- package/lib/commonjs/adapter/handle.js +259 -0
- package/lib/commonjs/adapter/handle.js.map +1 -0
- package/lib/commonjs/adapter/index.js +67 -0
- package/lib/commonjs/adapter/index.js.map +1 -0
- package/lib/commonjs/adapter/lifecycle.js +176 -0
- package/lib/commonjs/adapter/lifecycle.js.map +1 -0
- package/lib/commonjs/adapter/schema-sync.js +124 -0
- package/lib/commonjs/adapter/schema-sync.js.map +1 -0
- package/lib/commonjs/adapter/transaction.js +58 -0
- package/lib/commonjs/adapter/transaction.js.map +1 -0
- package/lib/commonjs/artifacts/availability.js +90 -0
- package/lib/commonjs/artifacts/availability.js.map +1 -0
- package/lib/commonjs/artifacts/cascade.js +80 -0
- package/lib/commonjs/artifacts/cascade.js.map +1 -0
- package/lib/commonjs/artifacts/paths.js +31 -0
- package/lib/commonjs/artifacts/paths.js.map +1 -0
- package/lib/commonjs/artifacts/reconcile.js +55 -0
- package/lib/commonjs/artifacts/reconcile.js.map +1 -0
- package/lib/commonjs/artifacts/store.js +300 -0
- package/lib/commonjs/artifacts/store.js.map +1 -0
- package/lib/commonjs/contract/adapter.js +6 -0
- package/lib/commonjs/contract/adapter.js.map +1 -0
- package/lib/commonjs/contract/attachment.js +2 -0
- package/lib/commonjs/contract/attachment.js.map +1 -0
- package/lib/commonjs/contract/backup.js +2 -0
- package/lib/commonjs/contract/backup.js.map +1 -0
- package/lib/commonjs/contract/config.js +31 -0
- package/lib/commonjs/contract/config.js.map +1 -0
- package/lib/commonjs/contract/encryption.js +6 -0
- package/lib/commonjs/contract/encryption.js.map +1 -0
- package/lib/commonjs/contract/errors.js +64 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/migration.js +6 -0
- package/lib/commonjs/contract/migration.js.map +1 -0
- package/lib/commonjs/contract/query.js +6 -0
- package/lib/commonjs/contract/query.js.map +1 -0
- package/lib/commonjs/contract/record.js +6 -0
- package/lib/commonjs/contract/record.js.map +1 -0
- package/lib/commonjs/contract/schema.js +2 -0
- package/lib/commonjs/contract/schema.js.map +1 -0
- package/lib/commonjs/contract/scope.js +2 -0
- package/lib/commonjs/contract/scope.js.map +1 -0
- package/lib/commonjs/contract/transaction.js +6 -0
- package/lib/commonjs/contract/transaction.js.map +1 -0
- package/lib/commonjs/crypto/chunked-cipher.js +147 -0
- package/lib/commonjs/crypto/chunked-cipher.js.map +1 -0
- package/lib/commonjs/crypto/derive.js +61 -0
- package/lib/commonjs/crypto/derive.js.map +1 -0
- package/lib/commonjs/crypto/key-provider.js +70 -0
- package/lib/commonjs/crypto/key-provider.js.map +1 -0
- package/lib/commonjs/crypto/provider.js +54 -0
- package/lib/commonjs/crypto/provider.js.map +1 -0
- package/lib/commonjs/diagnostics/dev-log.js +127 -0
- package/lib/commonjs/diagnostics/dev-log.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +57 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/faults.js +54 -0
- package/lib/commonjs/diagnostics/faults.js.map +1 -0
- package/lib/commonjs/diagnostics/map-native.js +98 -0
- package/lib/commonjs/diagnostics/map-native.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +110 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/index.js +70 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/migration/executor.js +136 -0
- package/lib/commonjs/migration/executor.js.map +1 -0
- package/lib/commonjs/migration/ledger.js +64 -0
- package/lib/commonjs/migration/ledger.js.map +1 -0
- package/lib/commonjs/migration/validate-chain.js +76 -0
- package/lib/commonjs/migration/validate-chain.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/platform/backup-android-verify.js +76 -0
- package/lib/commonjs/platform/backup-android-verify.js.map +1 -0
- package/lib/commonjs/platform/backup-ios.js +50 -0
- package/lib/commonjs/platform/backup-ios.js.map +1 -0
- package/lib/commonjs/platform/bytes.js +158 -0
- package/lib/commonjs/platform/bytes.js.map +1 -0
- package/lib/commonjs/platform/fs.js +59 -0
- package/lib/commonjs/platform/fs.js.map +1 -0
- package/lib/commonjs/platform/location.js +129 -0
- package/lib/commonjs/platform/location.js.map +1 -0
- package/lib/commonjs/query/budgets.js +95 -0
- package/lib/commonjs/query/budgets.js.map +1 -0
- package/lib/commonjs/query/compare.js +97 -0
- package/lib/commonjs/query/compare.js.map +1 -0
- package/lib/commonjs/query/cursor.js +97 -0
- package/lib/commonjs/query/cursor.js.map +1 -0
- package/lib/commonjs/query/filter.js +82 -0
- package/lib/commonjs/query/filter.js.map +1 -0
- package/lib/commonjs/query/paginate.js +48 -0
- package/lib/commonjs/query/paginate.js.map +1 -0
- package/lib/commonjs/query/sort.js +61 -0
- package/lib/commonjs/query/sort.js.map +1 -0
- package/lib/commonjs/query/validate.js +180 -0
- package/lib/commonjs/query/validate.js.map +1 -0
- package/lib/commonjs/schema/declare.js +47 -0
- package/lib/commonjs/schema/declare.js.map +1 -0
- package/lib/commonjs/schema/validate-config.js +115 -0
- package/lib/commonjs/schema/validate-config.js.map +1 -0
- package/lib/commonjs/scope/hash.js +107 -0
- package/lib/commonjs/scope/hash.js.map +1 -0
- package/lib/commonjs/scope/normalize.js +73 -0
- package/lib/commonjs/scope/normalize.js.map +1 -0
- package/lib/commonjs/scope/validate.js +81 -0
- package/lib/commonjs/scope/validate.js.map +1 -0
- package/lib/commonjs/sqlite/adapter.js +31 -0
- package/lib/commonjs/sqlite/adapter.js.map +1 -0
- package/lib/commonjs/sqlite/batch.js +218 -0
- package/lib/commonjs/sqlite/batch.js.map +1 -0
- package/lib/commonjs/sqlite/catalog.js +81 -0
- package/lib/commonjs/sqlite/catalog.js.map +1 -0
- package/lib/commonjs/sqlite/connection.js +210 -0
- package/lib/commonjs/sqlite/connection.js.map +1 -0
- package/lib/commonjs/sqlite/index-coverage.js +42 -0
- package/lib/commonjs/sqlite/index-coverage.js.map +1 -0
- package/lib/commonjs/sqlite/native.js +54 -0
- package/lib/commonjs/sqlite/native.js.map +1 -0
- package/lib/commonjs/sqlite/row-codec.js +192 -0
- package/lib/commonjs/sqlite/row-codec.js.map +1 -0
- package/lib/commonjs/sqlite/sql-builder.js +253 -0
- package/lib/commonjs/sqlite/sql-builder.js.map +1 -0
- package/lib/commonjs/sqlite/statements.js +54 -0
- package/lib/commonjs/sqlite/statements.js.map +1 -0
- package/lib/commonjs/sqlite/transaction-queue.js +79 -0
- package/lib/commonjs/sqlite/transaction-queue.js.map +1 -0
- package/lib/commonjs/sqlite/transactions.js +33 -0
- package/lib/commonjs/sqlite/transactions.js.map +1 -0
- package/lib/commonjs/sqlite/values.js +31 -0
- package/lib/commonjs/sqlite/values.js.map +1 -0
- package/lib/commonjs/testing/conformance/attachments.js +180 -0
- package/lib/commonjs/testing/conformance/attachments.js.map +1 -0
- package/lib/commonjs/testing/conformance/encryption.js +187 -0
- package/lib/commonjs/testing/conformance/encryption.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +103 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/conformance/lifecycle.js +134 -0
- package/lib/commonjs/testing/conformance/lifecycle.js.map +1 -0
- package/lib/commonjs/testing/conformance/migrations.js +167 -0
- package/lib/commonjs/testing/conformance/migrations.js.map +1 -0
- package/lib/commonjs/testing/conformance/queries.js +278 -0
- package/lib/commonjs/testing/conformance/queries.js.map +1 -0
- package/lib/commonjs/testing/conformance/records.js +224 -0
- package/lib/commonjs/testing/conformance/records.js.map +1 -0
- package/lib/commonjs/testing/conformance/scopes.js +107 -0
- package/lib/commonjs/testing/conformance/scopes.js.map +1 -0
- package/lib/commonjs/testing/conformance/transactions.js +228 -0
- package/lib/commonjs/testing/conformance/transactions.js.map +1 -0
- package/lib/commonjs/testing/faults.js +38 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +59 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/attachments.js +145 -0
- package/lib/commonjs/testing/memory-adapter/attachments.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/collection.js +224 -0
- package/lib/commonjs/testing/memory-adapter/collection.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/index.js +366 -0
- package/lib/commonjs/testing/memory-adapter/index.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/migrations.js +126 -0
- package/lib/commonjs/testing/memory-adapter/migrations.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/reset.js +49 -0
- package/lib/commonjs/testing/memory-adapter/reset.js.map +1 -0
- package/lib/commonjs/testing/memory-adapter/store.js +107 -0
- package/lib/commonjs/testing/memory-adapter/store.js.map +1 -0
- package/lib/module/adapter/budgets.js +51 -0
- package/lib/module/adapter/budgets.js.map +1 -0
- package/lib/module/adapter/collection.js +232 -0
- package/lib/module/adapter/collection.js.map +1 -0
- package/lib/module/adapter/deletion.js +280 -0
- package/lib/module/adapter/deletion.js.map +1 -0
- package/lib/module/adapter/handle.js +254 -0
- package/lib/module/adapter/handle.js.map +1 -0
- package/lib/module/adapter/index.js +59 -0
- package/lib/module/adapter/index.js.map +1 -0
- package/lib/module/adapter/lifecycle.js +172 -0
- package/lib/module/adapter/lifecycle.js.map +1 -0
- package/lib/module/adapter/schema-sync.js +121 -0
- package/lib/module/adapter/schema-sync.js.map +1 -0
- package/lib/module/adapter/transaction.js +54 -0
- package/lib/module/adapter/transaction.js.map +1 -0
- package/lib/module/artifacts/availability.js +86 -0
- package/lib/module/artifacts/availability.js.map +1 -0
- package/lib/module/artifacts/cascade.js +75 -0
- package/lib/module/artifacts/cascade.js.map +1 -0
- package/lib/module/artifacts/paths.js +26 -0
- package/lib/module/artifacts/paths.js.map +1 -0
- package/lib/module/artifacts/reconcile.js +51 -0
- package/lib/module/artifacts/reconcile.js.map +1 -0
- package/lib/module/artifacts/store.js +289 -0
- package/lib/module/artifacts/store.js.map +1 -0
- package/lib/module/contract/adapter.js +4 -0
- package/lib/module/contract/adapter.js.map +1 -0
- package/lib/module/contract/attachment.js +2 -0
- package/lib/module/contract/attachment.js.map +1 -0
- package/lib/module/contract/backup.js +2 -0
- package/lib/module/contract/backup.js.map +1 -0
- package/lib/module/contract/config.js +27 -0
- package/lib/module/contract/config.js.map +1 -0
- package/lib/module/contract/encryption.js +4 -0
- package/lib/module/contract/encryption.js.map +1 -0
- package/lib/module/contract/errors.js +60 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/migration.js +4 -0
- package/lib/module/contract/migration.js.map +1 -0
- package/lib/module/contract/query.js +4 -0
- package/lib/module/contract/query.js.map +1 -0
- package/lib/module/contract/record.js +4 -0
- package/lib/module/contract/record.js.map +1 -0
- package/lib/module/contract/schema.js +2 -0
- package/lib/module/contract/schema.js.map +1 -0
- package/lib/module/contract/scope.js +2 -0
- package/lib/module/contract/scope.js.map +1 -0
- package/lib/module/contract/transaction.js +4 -0
- package/lib/module/contract/transaction.js.map +1 -0
- package/lib/module/crypto/chunked-cipher.js +134 -0
- package/lib/module/crypto/chunked-cipher.js.map +1 -0
- package/lib/module/crypto/derive.js +56 -0
- package/lib/module/crypto/derive.js.map +1 -0
- package/lib/module/crypto/key-provider.js +67 -0
- package/lib/module/crypto/key-provider.js.map +1 -0
- package/lib/module/crypto/provider.js +49 -0
- package/lib/module/crypto/provider.js.map +1 -0
- package/lib/module/diagnostics/dev-log.js +120 -0
- package/lib/module/diagnostics/dev-log.js.map +1 -0
- package/lib/module/diagnostics/errors.js +44 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/faults.js +47 -0
- package/lib/module/diagnostics/faults.js.map +1 -0
- package/lib/module/diagnostics/map-native.js +93 -0
- package/lib/module/diagnostics/map-native.js.map +1 -0
- package/lib/module/diagnostics/redact.js +102 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/index.js +28 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/migration/executor.js +132 -0
- package/lib/module/migration/executor.js.map +1 -0
- package/lib/module/migration/ledger.js +57 -0
- package/lib/module/migration/ledger.js.map +1 -0
- package/lib/module/migration/validate-chain.js +70 -0
- package/lib/module/migration/validate-chain.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/platform/backup-android-verify.js +69 -0
- package/lib/module/platform/backup-android-verify.js.map +1 -0
- package/lib/module/platform/backup-ios.js +44 -0
- package/lib/module/platform/backup-ios.js.map +1 -0
- package/lib/module/platform/bytes.js +148 -0
- package/lib/module/platform/bytes.js.map +1 -0
- package/lib/module/platform/fs.js +54 -0
- package/lib/module/platform/fs.js.map +1 -0
- package/lib/module/platform/location.js +120 -0
- package/lib/module/platform/location.js.map +1 -0
- package/lib/module/query/budgets.js +88 -0
- package/lib/module/query/budgets.js.map +1 -0
- package/lib/module/query/compare.js +90 -0
- package/lib/module/query/compare.js.map +1 -0
- package/lib/module/query/cursor.js +91 -0
- package/lib/module/query/cursor.js.map +1 -0
- package/lib/module/query/filter.js +78 -0
- package/lib/module/query/filter.js.map +1 -0
- package/lib/module/query/paginate.js +40 -0
- package/lib/module/query/paginate.js.map +1 -0
- package/lib/module/query/sort.js +53 -0
- package/lib/module/query/sort.js.map +1 -0
- package/lib/module/query/validate.js +173 -0
- package/lib/module/query/validate.js.map +1 -0
- package/lib/module/schema/declare.js +37 -0
- package/lib/module/schema/declare.js.map +1 -0
- package/lib/module/schema/validate-config.js +111 -0
- package/lib/module/schema/validate-config.js.map +1 -0
- package/lib/module/scope/hash.js +102 -0
- package/lib/module/scope/hash.js.map +1 -0
- package/lib/module/scope/normalize.js +67 -0
- package/lib/module/scope/normalize.js.map +1 -0
- package/lib/module/scope/validate.js +76 -0
- package/lib/module/scope/validate.js.map +1 -0
- package/lib/module/sqlite/adapter.js +27 -0
- package/lib/module/sqlite/adapter.js.map +1 -0
- package/lib/module/sqlite/batch.js +214 -0
- package/lib/module/sqlite/batch.js.map +1 -0
- package/lib/module/sqlite/catalog.js +72 -0
- package/lib/module/sqlite/catalog.js.map +1 -0
- package/lib/module/sqlite/connection.js +206 -0
- package/lib/module/sqlite/connection.js.map +1 -0
- package/lib/module/sqlite/index-coverage.js +38 -0
- package/lib/module/sqlite/index-coverage.js.map +1 -0
- package/lib/module/sqlite/native.js +48 -0
- package/lib/module/sqlite/native.js.map +1 -0
- package/lib/module/sqlite/row-codec.js +176 -0
- package/lib/module/sqlite/row-codec.js.map +1 -0
- package/lib/module/sqlite/sql-builder.js +247 -0
- package/lib/module/sqlite/sql-builder.js.map +1 -0
- package/lib/module/sqlite/statements.js +49 -0
- package/lib/module/sqlite/statements.js.map +1 -0
- package/lib/module/sqlite/transaction-queue.js +75 -0
- package/lib/module/sqlite/transaction-queue.js.map +1 -0
- package/lib/module/sqlite/transactions.js +29 -0
- package/lib/module/sqlite/transactions.js.map +1 -0
- package/lib/module/sqlite/values.js +24 -0
- package/lib/module/sqlite/values.js.map +1 -0
- package/lib/module/testing/conformance/attachments.js +176 -0
- package/lib/module/testing/conformance/attachments.js.map +1 -0
- package/lib/module/testing/conformance/encryption.js +183 -0
- package/lib/module/testing/conformance/encryption.js.map +1 -0
- package/lib/module/testing/conformance/index.js +97 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/conformance/lifecycle.js +130 -0
- package/lib/module/testing/conformance/lifecycle.js.map +1 -0
- package/lib/module/testing/conformance/migrations.js +163 -0
- package/lib/module/testing/conformance/migrations.js.map +1 -0
- package/lib/module/testing/conformance/queries.js +274 -0
- package/lib/module/testing/conformance/queries.js.map +1 -0
- package/lib/module/testing/conformance/records.js +220 -0
- package/lib/module/testing/conformance/records.js.map +1 -0
- package/lib/module/testing/conformance/scopes.js +103 -0
- package/lib/module/testing/conformance/scopes.js.map +1 -0
- package/lib/module/testing/conformance/transactions.js +224 -0
- package/lib/module/testing/conformance/transactions.js.map +1 -0
- package/lib/module/testing/faults.js +16 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +16 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/memory-adapter/attachments.js +142 -0
- package/lib/module/testing/memory-adapter/attachments.js.map +1 -0
- package/lib/module/testing/memory-adapter/collection.js +220 -0
- package/lib/module/testing/memory-adapter/collection.js.map +1 -0
- package/lib/module/testing/memory-adapter/index.js +351 -0
- package/lib/module/testing/memory-adapter/index.js.map +1 -0
- package/lib/module/testing/memory-adapter/migrations.js +122 -0
- package/lib/module/testing/memory-adapter/migrations.js.map +1 -0
- package/lib/module/testing/memory-adapter/reset.js +44 -0
- package/lib/module/testing/memory-adapter/reset.js.map +1 -0
- package/lib/module/testing/memory-adapter/store.js +94 -0
- package/lib/module/testing/memory-adapter/store.js.map +1 -0
- package/lib/typescript/commonjs/adapter/budgets.d.ts +19 -0
- package/lib/typescript/commonjs/adapter/budgets.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/collection.d.ts +25 -0
- package/lib/typescript/commonjs/adapter/collection.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/deletion.d.ts +48 -0
- package/lib/typescript/commonjs/adapter/deletion.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/handle.d.ts +30 -0
- package/lib/typescript/commonjs/adapter/handle.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/index.d.ts +30 -0
- package/lib/typescript/commonjs/adapter/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/lifecycle.d.ts +25 -0
- package/lib/typescript/commonjs/adapter/lifecycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/schema-sync.d.ts +19 -0
- package/lib/typescript/commonjs/adapter/schema-sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/transaction.d.ts +32 -0
- package/lib/typescript/commonjs/adapter/transaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/availability.d.ts +19 -0
- package/lib/typescript/commonjs/artifacts/availability.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/cascade.d.ts +26 -0
- package/lib/typescript/commonjs/artifacts/cascade.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/paths.d.ts +16 -0
- package/lib/typescript/commonjs/artifacts/paths.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/reconcile.d.ts +23 -0
- package/lib/typescript/commonjs/artifacts/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/artifacts/store.d.ts +45 -0
- package/lib/typescript/commonjs/artifacts/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/adapter.d.ts +55 -0
- package/lib/typescript/commonjs/contract/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/attachment.d.ts +84 -0
- package/lib/typescript/commonjs/contract/attachment.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/backup.d.ts +26 -0
- package/lib/typescript/commonjs/contract/backup.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/config.d.ts +50 -0
- package/lib/typescript/commonjs/contract/config.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/encryption.d.ts +31 -0
- package/lib/typescript/commonjs/contract/encryption.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +50 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/migration.d.ts +37 -0
- package/lib/typescript/commonjs/contract/migration.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/query.d.ts +79 -0
- package/lib/typescript/commonjs/contract/query.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/record.d.ts +43 -0
- package/lib/typescript/commonjs/contract/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/schema.d.ts +33 -0
- package/lib/typescript/commonjs/contract/schema.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/scope.d.ts +33 -0
- package/lib/typescript/commonjs/contract/scope.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/transaction.d.ts +66 -0
- package/lib/typescript/commonjs/contract/transaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts +57 -0
- package/lib/typescript/commonjs/crypto/chunked-cipher.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/derive.d.ts +28 -0
- package/lib/typescript/commonjs/crypto/derive.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/key-provider.d.ts +30 -0
- package/lib/typescript/commonjs/crypto/key-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/crypto/provider.d.ts +35 -0
- package/lib/typescript/commonjs/crypto/provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/dev-log.d.ts +35 -0
- package/lib/typescript/commonjs/diagnostics/dev-log.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +34 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/faults.d.ts +26 -0
- package/lib/typescript/commonjs/diagnostics/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/map-native.d.ts +31 -0
- package/lib/typescript/commonjs/diagnostics/map-native.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +70 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +30 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/executor.d.ts +40 -0
- package/lib/typescript/commonjs/migration/executor.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/ledger.d.ts +34 -0
- package/lib/typescript/commonjs/migration/ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/migration/validate-chain.d.ts +20 -0
- package/lib/typescript/commonjs/migration/validate-chain.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/platform/backup-android-verify.d.ts +30 -0
- package/lib/typescript/commonjs/platform/backup-android-verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/backup-ios.d.ts +26 -0
- package/lib/typescript/commonjs/platform/backup-ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/bytes.d.ts +36 -0
- package/lib/typescript/commonjs/platform/bytes.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/fs.d.ts +47 -0
- package/lib/typescript/commonjs/platform/fs.d.ts.map +1 -0
- package/lib/typescript/commonjs/platform/location.d.ts +53 -0
- package/lib/typescript/commonjs/platform/location.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/budgets.d.ts +23 -0
- package/lib/typescript/commonjs/query/budgets.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/compare.d.ts +42 -0
- package/lib/typescript/commonjs/query/compare.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/cursor.d.ts +27 -0
- package/lib/typescript/commonjs/query/cursor.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/filter.d.ts +11 -0
- package/lib/typescript/commonjs/query/filter.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/paginate.d.ts +15 -0
- package/lib/typescript/commonjs/query/paginate.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/sort.d.ts +19 -0
- package/lib/typescript/commonjs/query/sort.d.ts.map +1 -0
- package/lib/typescript/commonjs/query/validate.d.ts +15 -0
- package/lib/typescript/commonjs/query/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/schema/declare.d.ts +20 -0
- package/lib/typescript/commonjs/schema/declare.d.ts.map +1 -0
- package/lib/typescript/commonjs/schema/validate-config.d.ts +11 -0
- package/lib/typescript/commonjs/schema/validate-config.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/hash.d.ts +24 -0
- package/lib/typescript/commonjs/scope/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/normalize.d.ts +46 -0
- package/lib/typescript/commonjs/scope/normalize.d.ts.map +1 -0
- package/lib/typescript/commonjs/scope/validate.d.ts +15 -0
- package/lib/typescript/commonjs/scope/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/adapter.d.ts +16 -0
- package/lib/typescript/commonjs/sqlite/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/batch.d.ts +25 -0
- package/lib/typescript/commonjs/sqlite/batch.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/catalog.d.ts +34 -0
- package/lib/typescript/commonjs/sqlite/catalog.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/connection.d.ts +58 -0
- package/lib/typescript/commonjs/sqlite/connection.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/index-coverage.d.ts +18 -0
- package/lib/typescript/commonjs/sqlite/index-coverage.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/native.d.ts +48 -0
- package/lib/typescript/commonjs/sqlite/native.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/row-codec.d.ts +69 -0
- package/lib/typescript/commonjs/sqlite/row-codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/sql-builder.d.ts +34 -0
- package/lib/typescript/commonjs/sqlite/sql-builder.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/statements.d.ts +26 -0
- package/lib/typescript/commonjs/sqlite/statements.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts +31 -0
- package/lib/typescript/commonjs/sqlite/transaction-queue.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/transactions.d.ts +26 -0
- package/lib/typescript/commonjs/sqlite/transactions.d.ts.map +1 -0
- package/lib/typescript/commonjs/sqlite/values.d.ts +13 -0
- package/lib/typescript/commonjs/sqlite/values.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/attachments.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/encryption.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/encryption.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +58 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/lifecycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/migrations.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/migrations.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/queries.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/queries.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/records.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/records.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/scopes.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/scopes.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/transactions.d.ts +4 -0
- package/lib/typescript/commonjs/testing/conformance/transactions.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +13 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +13 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts +23 -0
- package/lib/typescript/commonjs/testing/memory-adapter/attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts +19 -0
- package/lib/typescript/commonjs/testing/memory-adapter/collection.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/memory-adapter/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts +11 -0
- package/lib/typescript/commonjs/testing/memory-adapter/migrations.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts +23 -0
- package/lib/typescript/commonjs/testing/memory-adapter/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts +54 -0
- package/lib/typescript/commonjs/testing/memory-adapter/store.d.ts.map +1 -0
- package/lib/typescript/module/adapter/budgets.d.ts +19 -0
- package/lib/typescript/module/adapter/budgets.d.ts.map +1 -0
- package/lib/typescript/module/adapter/collection.d.ts +25 -0
- package/lib/typescript/module/adapter/collection.d.ts.map +1 -0
- package/lib/typescript/module/adapter/deletion.d.ts +48 -0
- package/lib/typescript/module/adapter/deletion.d.ts.map +1 -0
- package/lib/typescript/module/adapter/handle.d.ts +30 -0
- package/lib/typescript/module/adapter/handle.d.ts.map +1 -0
- package/lib/typescript/module/adapter/index.d.ts +30 -0
- package/lib/typescript/module/adapter/index.d.ts.map +1 -0
- package/lib/typescript/module/adapter/lifecycle.d.ts +25 -0
- package/lib/typescript/module/adapter/lifecycle.d.ts.map +1 -0
- package/lib/typescript/module/adapter/schema-sync.d.ts +19 -0
- package/lib/typescript/module/adapter/schema-sync.d.ts.map +1 -0
- package/lib/typescript/module/adapter/transaction.d.ts +32 -0
- package/lib/typescript/module/adapter/transaction.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/availability.d.ts +19 -0
- package/lib/typescript/module/artifacts/availability.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/cascade.d.ts +26 -0
- package/lib/typescript/module/artifacts/cascade.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/paths.d.ts +16 -0
- package/lib/typescript/module/artifacts/paths.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/reconcile.d.ts +23 -0
- package/lib/typescript/module/artifacts/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/artifacts/store.d.ts +45 -0
- package/lib/typescript/module/artifacts/store.d.ts.map +1 -0
- package/lib/typescript/module/contract/adapter.d.ts +55 -0
- package/lib/typescript/module/contract/adapter.d.ts.map +1 -0
- package/lib/typescript/module/contract/attachment.d.ts +84 -0
- package/lib/typescript/module/contract/attachment.d.ts.map +1 -0
- package/lib/typescript/module/contract/backup.d.ts +26 -0
- package/lib/typescript/module/contract/backup.d.ts.map +1 -0
- package/lib/typescript/module/contract/config.d.ts +50 -0
- package/lib/typescript/module/contract/config.d.ts.map +1 -0
- package/lib/typescript/module/contract/encryption.d.ts +31 -0
- package/lib/typescript/module/contract/encryption.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +50 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/migration.d.ts +37 -0
- package/lib/typescript/module/contract/migration.d.ts.map +1 -0
- package/lib/typescript/module/contract/query.d.ts +79 -0
- package/lib/typescript/module/contract/query.d.ts.map +1 -0
- package/lib/typescript/module/contract/record.d.ts +43 -0
- package/lib/typescript/module/contract/record.d.ts.map +1 -0
- package/lib/typescript/module/contract/schema.d.ts +33 -0
- package/lib/typescript/module/contract/schema.d.ts.map +1 -0
- package/lib/typescript/module/contract/scope.d.ts +33 -0
- package/lib/typescript/module/contract/scope.d.ts.map +1 -0
- package/lib/typescript/module/contract/transaction.d.ts +66 -0
- package/lib/typescript/module/contract/transaction.d.ts.map +1 -0
- package/lib/typescript/module/crypto/chunked-cipher.d.ts +57 -0
- package/lib/typescript/module/crypto/chunked-cipher.d.ts.map +1 -0
- package/lib/typescript/module/crypto/derive.d.ts +28 -0
- package/lib/typescript/module/crypto/derive.d.ts.map +1 -0
- package/lib/typescript/module/crypto/key-provider.d.ts +30 -0
- package/lib/typescript/module/crypto/key-provider.d.ts.map +1 -0
- package/lib/typescript/module/crypto/provider.d.ts +35 -0
- package/lib/typescript/module/crypto/provider.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/dev-log.d.ts +35 -0
- package/lib/typescript/module/diagnostics/dev-log.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +34 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/faults.d.ts +26 -0
- package/lib/typescript/module/diagnostics/faults.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/map-native.d.ts +31 -0
- package/lib/typescript/module/diagnostics/map-native.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +70 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +30 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/migration/executor.d.ts +40 -0
- package/lib/typescript/module/migration/executor.d.ts.map +1 -0
- package/lib/typescript/module/migration/ledger.d.ts +34 -0
- package/lib/typescript/module/migration/ledger.d.ts.map +1 -0
- package/lib/typescript/module/migration/validate-chain.d.ts +20 -0
- package/lib/typescript/module/migration/validate-chain.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/platform/backup-android-verify.d.ts +30 -0
- package/lib/typescript/module/platform/backup-android-verify.d.ts.map +1 -0
- package/lib/typescript/module/platform/backup-ios.d.ts +26 -0
- package/lib/typescript/module/platform/backup-ios.d.ts.map +1 -0
- package/lib/typescript/module/platform/bytes.d.ts +36 -0
- package/lib/typescript/module/platform/bytes.d.ts.map +1 -0
- package/lib/typescript/module/platform/fs.d.ts +47 -0
- package/lib/typescript/module/platform/fs.d.ts.map +1 -0
- package/lib/typescript/module/platform/location.d.ts +53 -0
- package/lib/typescript/module/platform/location.d.ts.map +1 -0
- package/lib/typescript/module/query/budgets.d.ts +23 -0
- package/lib/typescript/module/query/budgets.d.ts.map +1 -0
- package/lib/typescript/module/query/compare.d.ts +42 -0
- package/lib/typescript/module/query/compare.d.ts.map +1 -0
- package/lib/typescript/module/query/cursor.d.ts +27 -0
- package/lib/typescript/module/query/cursor.d.ts.map +1 -0
- package/lib/typescript/module/query/filter.d.ts +11 -0
- package/lib/typescript/module/query/filter.d.ts.map +1 -0
- package/lib/typescript/module/query/paginate.d.ts +15 -0
- package/lib/typescript/module/query/paginate.d.ts.map +1 -0
- package/lib/typescript/module/query/sort.d.ts +19 -0
- package/lib/typescript/module/query/sort.d.ts.map +1 -0
- package/lib/typescript/module/query/validate.d.ts +15 -0
- package/lib/typescript/module/query/validate.d.ts.map +1 -0
- package/lib/typescript/module/schema/declare.d.ts +20 -0
- package/lib/typescript/module/schema/declare.d.ts.map +1 -0
- package/lib/typescript/module/schema/validate-config.d.ts +11 -0
- package/lib/typescript/module/schema/validate-config.d.ts.map +1 -0
- package/lib/typescript/module/scope/hash.d.ts +24 -0
- package/lib/typescript/module/scope/hash.d.ts.map +1 -0
- package/lib/typescript/module/scope/normalize.d.ts +46 -0
- package/lib/typescript/module/scope/normalize.d.ts.map +1 -0
- package/lib/typescript/module/scope/validate.d.ts +15 -0
- package/lib/typescript/module/scope/validate.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/adapter.d.ts +16 -0
- package/lib/typescript/module/sqlite/adapter.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/batch.d.ts +25 -0
- package/lib/typescript/module/sqlite/batch.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/catalog.d.ts +34 -0
- package/lib/typescript/module/sqlite/catalog.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/connection.d.ts +58 -0
- package/lib/typescript/module/sqlite/connection.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/index-coverage.d.ts +18 -0
- package/lib/typescript/module/sqlite/index-coverage.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/native.d.ts +48 -0
- package/lib/typescript/module/sqlite/native.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/row-codec.d.ts +69 -0
- package/lib/typescript/module/sqlite/row-codec.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/sql-builder.d.ts +34 -0
- package/lib/typescript/module/sqlite/sql-builder.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/statements.d.ts +26 -0
- package/lib/typescript/module/sqlite/statements.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/transaction-queue.d.ts +31 -0
- package/lib/typescript/module/sqlite/transaction-queue.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/transactions.d.ts +26 -0
- package/lib/typescript/module/sqlite/transactions.d.ts.map +1 -0
- package/lib/typescript/module/sqlite/values.d.ts +13 -0
- package/lib/typescript/module/sqlite/values.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/attachments.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/attachments.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/encryption.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/encryption.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +58 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/lifecycle.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/lifecycle.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/migrations.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/migrations.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/queries.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/queries.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/records.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/records.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/scopes.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/scopes.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/transactions.d.ts +4 -0
- package/lib/typescript/module/testing/conformance/transactions.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +13 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +13 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/attachments.d.ts +23 -0
- package/lib/typescript/module/testing/memory-adapter/attachments.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/collection.d.ts +19 -0
- package/lib/typescript/module/testing/memory-adapter/collection.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/index.d.ts +22 -0
- package/lib/typescript/module/testing/memory-adapter/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/migrations.d.ts +11 -0
- package/lib/typescript/module/testing/memory-adapter/migrations.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/reset.d.ts +23 -0
- package/lib/typescript/module/testing/memory-adapter/reset.d.ts.map +1 -0
- package/lib/typescript/module/testing/memory-adapter/store.d.ts +54 -0
- package/lib/typescript/module/testing/memory-adapter/store.d.ts.map +1 -0
- package/package.json +51 -16
- package/src/crypto/provider.ts +7 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Migration execution for the in-memory adapter.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the on-device rules exactly, because migration behaviour is the
|
|
7
|
+
* thing consumers most need to test without a device: ordered, at most once
|
|
8
|
+
* per scope, atomic per step, and loud on failure (FR-047 to FR-057).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { DiagnosticCodes } from "../../contract/errors.js";
|
|
12
|
+
import { raise } from "../../diagnostics/errors.js";
|
|
13
|
+
import { throwIfFaulted } from "../faults.js";
|
|
14
|
+
export async function runMigrations(store, config, now) {
|
|
15
|
+
const migrations = [...(config.migrations ?? [])].sort((a, b) => a.version - b.version);
|
|
16
|
+
if (store.schemaVersion > config.schemaVersion) {
|
|
17
|
+
// Opening anyway would mean a newer database read by older code, which
|
|
18
|
+
// silently drops whatever the newer schema added.
|
|
19
|
+
raise(DiagnosticCodes.SCHEMA_DOWNGRADE, {
|
|
20
|
+
message: 'recorded schema version is newer than the declared one',
|
|
21
|
+
detail: {
|
|
22
|
+
recordedVersion: store.schemaVersion,
|
|
23
|
+
version: config.schemaVersion
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
for (const migration of migrations) {
|
|
28
|
+
if (migration.version <= store.schemaVersion) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const snapshot = new Map([...store.collections].map(([name, rows]) => [name, new Map(rows)]));
|
|
32
|
+
try {
|
|
33
|
+
throwIfFaulted('migration');
|
|
34
|
+
// A migration gets collection access but no handle-level surface:
|
|
35
|
+
// it must not open another scope or start a nested transaction.
|
|
36
|
+
const context = {
|
|
37
|
+
collection: name => {
|
|
38
|
+
if (!store.collections.has(name)) {
|
|
39
|
+
store.collections.set(name, new Map());
|
|
40
|
+
}
|
|
41
|
+
return migrationCollection(store, name);
|
|
42
|
+
},
|
|
43
|
+
abort: async () => {
|
|
44
|
+
throw new Error('migration aborted');
|
|
45
|
+
},
|
|
46
|
+
execute: async () => {
|
|
47
|
+
// The memory adapter has no SQL. Documented divergence.
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
await migration.migrate(context);
|
|
51
|
+
store.schemaVersion = migration.version;
|
|
52
|
+
store.ledger.set(migration.version, {
|
|
53
|
+
version: migration.version,
|
|
54
|
+
attemptedAt: now(),
|
|
55
|
+
outcome: 'applied'
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Leave the recorded version untouched so the next open retries
|
|
59
|
+
// from the same place rather than skipping ahead (FR-051).
|
|
60
|
+
store.collections = snapshot;
|
|
61
|
+
store.ledger.set(migration.version, {
|
|
62
|
+
version: migration.version,
|
|
63
|
+
attemptedAt: now(),
|
|
64
|
+
outcome: 'failed',
|
|
65
|
+
failureCode: error.code ?? DiagnosticCodes.MIGRATION_FAILED
|
|
66
|
+
});
|
|
67
|
+
raise(DiagnosticCodes.MIGRATION_FAILED, {
|
|
68
|
+
message: 'migration failed',
|
|
69
|
+
migration: {
|
|
70
|
+
recordedVersion: store.schemaVersion,
|
|
71
|
+
failingVersion: migration.version,
|
|
72
|
+
outcome: 'failed'
|
|
73
|
+
},
|
|
74
|
+
cause: error
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (migrations.length === 0) {
|
|
79
|
+
store.schemaVersion = config.schemaVersion;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function migrationCollection(store, name) {
|
|
83
|
+
const rows = store.collections.get(name);
|
|
84
|
+
return {
|
|
85
|
+
async insert(record) {
|
|
86
|
+
rows.set(record.id, {
|
|
87
|
+
id: record.id,
|
|
88
|
+
payload: JSON.stringify(record.data)
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
operation: 'created',
|
|
92
|
+
id: record.id
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
async upsert(record) {
|
|
96
|
+
const existed = rows.has(record.id);
|
|
97
|
+
rows.set(record.id, {
|
|
98
|
+
id: record.id,
|
|
99
|
+
payload: JSON.stringify(record.data)
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
operation: existed ? 'updated' : 'created',
|
|
103
|
+
id: record.id
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
async delete(id) {
|
|
107
|
+
rows.delete(id);
|
|
108
|
+
return {
|
|
109
|
+
operation: 'deleted',
|
|
110
|
+
id
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
async find(id) {
|
|
114
|
+
const row = rows.get(id);
|
|
115
|
+
return row ? {
|
|
116
|
+
id: row.id,
|
|
117
|
+
data: JSON.parse(row.payload)
|
|
118
|
+
} : null;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DiagnosticCodes","raise","throwIfFaulted","runMigrations","store","config","now","migrations","sort","a","b","version","schemaVersion","SCHEMA_DOWNGRADE","message","detail","recordedVersion","migration","snapshot","Map","collections","map","name","rows","context","collection","has","set","migrationCollection","abort","Error","execute","migrate","ledger","attemptedAt","outcome","error","failureCode","code","MIGRATION_FAILED","failingVersion","cause","length","get","insert","record","id","payload","JSON","stringify","data","operation","upsert","existed","delete","find","row","parse"],"sourceRoot":"../../../../src","sources":["testing/memory-adapter/migrations.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test lifecycle helpers.
|
|
5
|
+
*
|
|
6
|
+
* `seedRecords` deliberately goes through the same write operations
|
|
7
|
+
* production code uses (FR-094). Seeding by poking the store directly would
|
|
8
|
+
* skip budget checks and timestamp handling, so tests would pass against data
|
|
9
|
+
* the package would have refused to store.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { clearFaults } from "../faults.js";
|
|
13
|
+
import { existingScopeStore, resetAllMemoryStores } from "./store.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The conformance suite's "reach past the package" hooks, implemented for the
|
|
17
|
+
* in-memory store. On device the equivalent unlinks the file directly.
|
|
18
|
+
*/
|
|
19
|
+
export const memoryConformanceHooks = {
|
|
20
|
+
async removeArtifactBehindTheScenes(scopeKey, attachmentId) {
|
|
21
|
+
existingScopeStore('conformance', scopeKey)?.artifacts.delete(attachmentId);
|
|
22
|
+
},
|
|
23
|
+
async removeReferenceBehindTheScenes(scopeKey, attachmentId) {
|
|
24
|
+
existingScopeStore('conformance', scopeKey)?.attachments.delete(attachmentId);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Return every in-memory database to a known-empty state (FR-093). */
|
|
29
|
+
export async function resetMemoryAdapter(_adapter) {
|
|
30
|
+
resetAllMemoryStores();
|
|
31
|
+
clearFaults();
|
|
32
|
+
}
|
|
33
|
+
export async function seedRecords(adapter, config, collection, records) {
|
|
34
|
+
const handle = await adapter.open(config);
|
|
35
|
+
try {
|
|
36
|
+
const ops = handle.collection(collection);
|
|
37
|
+
for (const record of records) {
|
|
38
|
+
await ops.upsert(record);
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
await handle.close();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=reset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clearFaults","existingScopeStore","resetAllMemoryStores","memoryConformanceHooks","removeArtifactBehindTheScenes","scopeKey","attachmentId","artifacts","delete","removeReferenceBehindTheScenes","attachments","resetMemoryAdapter","_adapter","seedRecords","adapter","config","collection","records","handle","open","ops","record","upsert","close"],"sourceRoot":"../../../../src","sources":["testing/memory-adapter/reset.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,WAAW,QAAQ,cAAW;AACvC,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,YAAS;;AAElE;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG;EACrC,MAAMC,6BAA6BA,CAACC,QAAgB,EAAEC,YAAoB,EAAiB;IAC1FL,kBAAkB,CAAC,aAAa,EAAEI,QAAQ,CAAC,EAAEE,SAAS,CAACC,MAAM,CAACF,YAAY,CAAC;EAC5E,CAAC;EACD,MAAMG,8BAA8BA,CAACJ,QAAgB,EAAEC,YAAoB,EAAiB;IAC3FL,kBAAkB,CAAC,aAAa,EAAEI,QAAQ,CAAC,EAAEK,WAAW,CAACF,MAAM,CAACF,YAAY,CAAC;EAC9E;AACD,CAAC;;AAED;AACA,OAAO,eAAeK,kBAAkBA,CAACC,QAAyB,EAAiB;EAClFV,oBAAoB,CAAC,CAAC;EACtBF,WAAW,CAAC,CAAC;AACd;AAEA,OAAO,eAAea,WAAWA,CAChCC,OAAuB,EACvBC,MAAsB,EACtBC,UAAkB,EAClBC,OAAyB,EACT;EAChB,MAAMC,MAAM,GAAG,MAAMJ,OAAO,CAACK,IAAI,CAACJ,MAAM,CAAC;EACzC,IAAI;IACH,MAAMK,GAAG,GAAGF,MAAM,CAACF,UAAU,CAAIA,UAAU,CAAC;IAC5C,KAAK,MAAMK,MAAM,IAAIJ,OAAO,EAAE;MAC7B,MAAMG,GAAG,CAACE,MAAM,CAACD,MAAM,CAAC;IACzB;EACD,CAAC,SAAS;IACT,MAAMH,MAAM,CAACK,KAAK,CAAC,CAAC;EACrB;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The in-memory store behind the test adapter.
|
|
5
|
+
*
|
|
6
|
+
* Scope isolation is structural here for the same reason it is on device: one
|
|
7
|
+
* store per scope, held in a registry keyed by scope digest. A handle holds a
|
|
8
|
+
* reference to its own store and has no way to reach another (FR-011).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const databases = new Map();
|
|
12
|
+
export function databaseFor(name) {
|
|
13
|
+
let database = databases.get(name);
|
|
14
|
+
if (!database) {
|
|
15
|
+
database = {
|
|
16
|
+
name,
|
|
17
|
+
scopes: new Map()
|
|
18
|
+
};
|
|
19
|
+
databases.set(name, database);
|
|
20
|
+
}
|
|
21
|
+
return database;
|
|
22
|
+
}
|
|
23
|
+
export function scopeStoreFor(name, scopeKey) {
|
|
24
|
+
const database = databaseFor(name);
|
|
25
|
+
let store = database.scopes.get(scopeKey);
|
|
26
|
+
if (!store) {
|
|
27
|
+
store = {
|
|
28
|
+
scopeKey,
|
|
29
|
+
schemaVersion: 0,
|
|
30
|
+
ledger: new Map(),
|
|
31
|
+
collections: new Map(),
|
|
32
|
+
attachments: new Map(),
|
|
33
|
+
artifacts: new Map(),
|
|
34
|
+
deletionState: 'active',
|
|
35
|
+
encrypted: false,
|
|
36
|
+
backupIncluded: false
|
|
37
|
+
};
|
|
38
|
+
database.scopes.set(scopeKey, store);
|
|
39
|
+
}
|
|
40
|
+
return store;
|
|
41
|
+
}
|
|
42
|
+
export function existingScopeStore(name, scopeKey) {
|
|
43
|
+
return databases.get(name)?.scopes.get(scopeKey);
|
|
44
|
+
}
|
|
45
|
+
export function dropScope(name, scopeKey) {
|
|
46
|
+
databases.get(name)?.scopes.delete(scopeKey);
|
|
47
|
+
}
|
|
48
|
+
export function dropDatabase(name) {
|
|
49
|
+
databases.delete(name);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Between tests (FR-093). */
|
|
53
|
+
export function resetAllMemoryStores() {
|
|
54
|
+
databases.clear();
|
|
55
|
+
}
|
|
56
|
+
export function collectionMap(store, collection) {
|
|
57
|
+
let rows = store.collections.get(collection);
|
|
58
|
+
if (!rows) {
|
|
59
|
+
rows = new Map();
|
|
60
|
+
store.collections.set(collection, rows);
|
|
61
|
+
}
|
|
62
|
+
return rows;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Deep copy through serialization on the way in and out.
|
|
67
|
+
*
|
|
68
|
+
* The same discipline as the SQLite adapter's payload column: a consumer that
|
|
69
|
+
* mutates the object it handed us must not change what is stored (FR-022),
|
|
70
|
+
* and what we hand back must not be a live reference into the store.
|
|
71
|
+
*/
|
|
72
|
+
export function encodePayload(data) {
|
|
73
|
+
return JSON.stringify(data ?? {});
|
|
74
|
+
}
|
|
75
|
+
export function decodePayload(payload) {
|
|
76
|
+
return JSON.parse(payload);
|
|
77
|
+
}
|
|
78
|
+
export function toStoredRecord(row) {
|
|
79
|
+
const record = {
|
|
80
|
+
id: row.id,
|
|
81
|
+
data: decodePayload(row.payload)
|
|
82
|
+
};
|
|
83
|
+
if (row.createdAt !== undefined) {
|
|
84
|
+
record.createdAt = row.createdAt;
|
|
85
|
+
}
|
|
86
|
+
if (row.updatedAt !== undefined) {
|
|
87
|
+
record.updatedAt = row.updatedAt;
|
|
88
|
+
}
|
|
89
|
+
if (row.deletedAt !== undefined) {
|
|
90
|
+
record.deletedAt = row.deletedAt;
|
|
91
|
+
}
|
|
92
|
+
return record;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["databases","Map","databaseFor","name","database","get","scopes","set","scopeStoreFor","scopeKey","store","schemaVersion","ledger","collections","attachments","artifacts","deletionState","encrypted","backupIncluded","existingScopeStore","dropScope","delete","dropDatabase","resetAllMemoryStores","clear","collectionMap","collection","rows","encodePayload","data","JSON","stringify","decodePayload","payload","parse","toStoredRecord","row","record","id","createdAt","undefined","updatedAt","deletedAt"],"sourceRoot":"../../../../src","sources":["testing/memory-adapter/store.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAyB,CAAC;AAEnD,OAAO,SAASC,WAAWA,CAACC,IAAY,EAAkB;EACzD,IAAIC,QAAQ,GAAGJ,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC;EAClC,IAAI,CAACC,QAAQ,EAAE;IACdA,QAAQ,GAAG;MAAED,IAAI;MAAEG,MAAM,EAAE,IAAIL,GAAG,CAAC;IAAE,CAAC;IACtCD,SAAS,CAACO,GAAG,CAACJ,IAAI,EAAEC,QAAQ,CAAC;EAC9B;EACA,OAAOA,QAAQ;AAChB;AAEA,OAAO,SAASI,aAAaA,CAACL,IAAY,EAAEM,QAAgB,EAAoB;EAC/E,MAAML,QAAQ,GAAGF,WAAW,CAACC,IAAI,CAAC;EAClC,IAAIO,KAAK,GAAGN,QAAQ,CAACE,MAAM,CAACD,GAAG,CAACI,QAAQ,CAAC;EACzC,IAAI,CAACC,KAAK,EAAE;IACXA,KAAK,GAAG;MACPD,QAAQ;MACRE,aAAa,EAAE,CAAC;MAChBC,MAAM,EAAE,IAAIX,GAAG,CAAC,CAAC;MACjBY,WAAW,EAAE,IAAIZ,GAAG,CAAC,CAAC;MACtBa,WAAW,EAAE,IAAIb,GAAG,CAAC,CAAC;MACtBc,SAAS,EAAE,IAAId,GAAG,CAAC,CAAC;MACpBe,aAAa,EAAE,QAAQ;MACvBC,SAAS,EAAE,KAAK;MAChBC,cAAc,EAAE;IACjB,CAAC;IACDd,QAAQ,CAACE,MAAM,CAACC,GAAG,CAACE,QAAQ,EAAEC,KAAK,CAAC;EACrC;EACA,OAAOA,KAAK;AACb;AAEA,OAAO,SAASS,kBAAkBA,CAAChB,IAAY,EAAEM,QAAgB,EAAgC;EAChG,OAAOT,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC,EAAEG,MAAM,CAACD,GAAG,CAACI,QAAQ,CAAC;AACjD;AAEA,OAAO,SAASW,SAASA,CAACjB,IAAY,EAAEM,QAAgB,EAAQ;EAC/DT,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC,EAAEG,MAAM,CAACe,MAAM,CAACZ,QAAQ,CAAC;AAC7C;AAEA,OAAO,SAASa,YAAYA,CAACnB,IAAY,EAAQ;EAChDH,SAAS,CAACqB,MAAM,CAAClB,IAAI,CAAC;AACvB;;AAEA;AACA,OAAO,SAASoB,oBAAoBA,CAAA,EAAS;EAC5CvB,SAAS,CAACwB,KAAK,CAAC,CAAC;AAClB;AAEA,OAAO,SAASC,aAAaA,CAACf,KAAuB,EAAEgB,UAAkB,EAA0B;EAClG,IAAIC,IAAI,GAAGjB,KAAK,CAACG,WAAW,CAACR,GAAG,CAACqB,UAAU,CAAC;EAC5C,IAAI,CAACC,IAAI,EAAE;IACVA,IAAI,GAAG,IAAI1B,GAAG,CAAC,CAAC;IAChBS,KAAK,CAACG,WAAW,CAACN,GAAG,CAACmB,UAAU,EAAEC,IAAI,CAAC;EACxC;EACA,OAAOA,IAAI;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,IAAwB,EAAU;EAC/D,OAAOC,IAAI,CAACC,SAAS,CAACF,IAAI,IAAI,CAAC,CAAC,CAAC;AAClC;AAEA,OAAO,SAASG,aAAaA,CAA+BC,OAAe,EAAK;EAC/E,OAAOH,IAAI,CAACI,KAAK,CAACD,OAAO,CAAC;AAC3B;AAEA,OAAO,SAASE,cAAcA,CAA+BC,GAAc,EAAmB;EAC7F,MAAMC,MAAuB,GAAG;IAC/BC,EAAE,EAAEF,GAAG,CAACE,EAAE;IACVT,IAAI,EAAEG,aAAa,CAAII,GAAG,CAACH,OAAO;EACnC,CAAC;EACD,IAAIG,GAAG,CAACG,SAAS,KAAKC,SAAS,EAAE;IAChCH,MAAM,CAACE,SAAS,GAAGH,GAAG,CAACG,SAAS;EACjC;EACA,IAAIH,GAAG,CAACK,SAAS,KAAKD,SAAS,EAAE;IAChCH,MAAM,CAACI,SAAS,GAAGL,GAAG,CAACK,SAAS;EACjC;EACA,IAAIL,GAAG,CAACM,SAAS,KAAKF,SAAS,EAAE;IAChCH,MAAM,CAACK,SAAS,GAAGN,GAAG,CAACM,SAAS;EACjC;EACA,OAAOL,MAAM;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the FR-088 budgets are actually enforced.
|
|
3
|
+
*
|
|
4
|
+
* The checks live in `query/budgets.ts` so both adapters share them; this
|
|
5
|
+
* module is the adapter-layer entry point, and exists so there is one place
|
|
6
|
+
* to answer "which budgets are hard?" — per-record size, batch size, page
|
|
7
|
+
* size, and artifact size, each with a typed error (FR-088a).
|
|
8
|
+
*
|
|
9
|
+
* The rest are soft by design. Exceeding 100,000 records in a collection is
|
|
10
|
+
* slow, not an error, and refusing the 100,001st write would destroy data an
|
|
11
|
+
* app already holds. Degraded behavior is documented in the README instead.
|
|
12
|
+
*/
|
|
13
|
+
import { assertArtifactWithinBudget, assertBatchWithinBudget, assertRecordWithinBudget, serializedSize } from '../query/budgets';
|
|
14
|
+
export { assertArtifactWithinBudget, assertBatchWithinBudget, assertRecordWithinBudget, serializedSize, };
|
|
15
|
+
export declare function acquireHandleSlot(): void;
|
|
16
|
+
export declare function releaseHandleSlot(): void;
|
|
17
|
+
/** Between tests. */
|
|
18
|
+
export declare function resetHandleSlots(): void;
|
|
19
|
+
//# sourceMappingURL=budgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budgets.d.ts","sourceRoot":"","sources":["../../../../src/adapter/budgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EACN,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,GACd,CAAC;AAYF,wBAAgB,iBAAiB,IAAI,IAAI,CAQxC;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED,qBAAqB;AACrB,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection operations against a SQLite executor.
|
|
3
|
+
*
|
|
4
|
+
* The executor is either the connection or the transaction in flight on it,
|
|
5
|
+
* which is what gives read-your-own-writes for free (FR-043): a read inside a
|
|
6
|
+
* transaction runs on the same handle that made the writes, so it sees them,
|
|
7
|
+
* and a reader outside does not.
|
|
8
|
+
*
|
|
9
|
+
* Every semantic decision that could differ between the two adapters —
|
|
10
|
+
* which operators mean what, how nulls sort, what a cursor points at — is
|
|
11
|
+
* delegated to `query/`. This file decides only how to say it in SQL.
|
|
12
|
+
*/
|
|
13
|
+
import type { StorableRecordData } from '../contract/record';
|
|
14
|
+
import type { CollectionSchema } from '../contract/schema';
|
|
15
|
+
import type { CollectionOps } from '../contract/transaction';
|
|
16
|
+
import type { Executor } from '../sqlite/connection';
|
|
17
|
+
export type SqlCollectionContext = {
|
|
18
|
+
/** Resolved per call, so a transaction can swap in its own executor. */
|
|
19
|
+
executor(): Executor;
|
|
20
|
+
schema: CollectionSchema;
|
|
21
|
+
now(): number;
|
|
22
|
+
assertUsable(): void;
|
|
23
|
+
};
|
|
24
|
+
export declare function createSqlCollection<T extends StorableRecordData>(context: SqlCollectionContext): CollectionOps<T>;
|
|
25
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../../src/adapter/collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAEX,kBAAkB,EAGlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAOrD,MAAM,MAAM,oBAAoB,GAAG;IAClC,wEAAwE;IACxE,QAAQ,IAAI,QAAQ,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,IAAI,MAAM,CAAC;IACd,YAAY,IAAI,IAAI,CAAC;CACrB,CAAC;AAWF,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,kBAAkB,EAC/D,OAAO,EAAE,oBAAoB,GAC3B,aAAa,CAAC,CAAC,CAAC,CA0NlB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletion, and the ordering that makes an interrupted one visible.
|
|
3
|
+
*
|
|
4
|
+
* These are module-level functions rather than handle methods because they
|
|
5
|
+
* must work whether or not a handle is open on the target (FR-059) — a
|
|
6
|
+
* sign-out that already closed the handle still has to be able to delete, and
|
|
7
|
+
* an app recovering from a crash has no handle to call a method on.
|
|
8
|
+
*
|
|
9
|
+
* The order is: **mark `deleting` first, clear the catalog row last**
|
|
10
|
+
* (FR-061, FR-063). A crash at any point in between leaves the flag set, so
|
|
11
|
+
* the next open reports a scope mid-deletion rather than presenting it as
|
|
12
|
+
* complete. Clearing the row first would be the natural way to write this and
|
|
13
|
+
* would produce exactly the failure FR-063 exists to prevent: an
|
|
14
|
+
* interruption that looks like a success, leaving a user's data on disk after
|
|
15
|
+
* they asked for it to be gone.
|
|
16
|
+
*
|
|
17
|
+
* Nothing here ever runs on its own. No expiry, no sweep, no deletion on
|
|
18
|
+
* close or on app upgrade (FR-058) — the package deletes when asked, where
|
|
19
|
+
* asked, and not otherwise.
|
|
20
|
+
*/
|
|
21
|
+
import type { DeletionOutcome } from '../contract/attachment';
|
|
22
|
+
import type { DatabaseTargetConfig, ScopeTargetConfig } from '../contract/config';
|
|
23
|
+
import type { ResolvedScope } from '../contract/scope';
|
|
24
|
+
export declare function markScopeInvalidated(name: string, scopeKey: string): void;
|
|
25
|
+
export declare function clearScopeInvalidation(name: string, scopeKey: string): void;
|
|
26
|
+
export declare function isScopeInvalidated(name: string, scopeKey: string): boolean;
|
|
27
|
+
export declare function clearAllInvalidations(): void;
|
|
28
|
+
/** Returns the function that takes the handle out of the registry again. */
|
|
29
|
+
export declare function registerOpenHandle(name: string, scopeKey: string, revoke: () => Promise<void>): () => void;
|
|
30
|
+
/** Deleting a scope that holds nothing is success, not an error (FR-062). */
|
|
31
|
+
export declare function emptyOutcome(scope?: ResolvedScope): DeletionOutcome;
|
|
32
|
+
/**
|
|
33
|
+
* Remove one scope's data. Every collection in that scope, and nothing
|
|
34
|
+
* outside it (FR-059, SC-012).
|
|
35
|
+
*/
|
|
36
|
+
export declare function deleteScopeData(config: ScopeTargetConfig): Promise<DeletionOutcome>;
|
|
37
|
+
/**
|
|
38
|
+
* Discard one scope and leave it ready for a clean first-run migration
|
|
39
|
+
* (FR-057a).
|
|
40
|
+
*
|
|
41
|
+
* Destructive, separately named, and never reachable from `openDatabase`. An
|
|
42
|
+
* automatic fallback here would turn a bad migration shipped to production
|
|
43
|
+
* into silent data loss for every user who launched the app.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resetScope(config: ScopeTargetConfig): Promise<DeletionOutcome>;
|
|
46
|
+
/** Remove the whole database directory: catalog, every scope, every artifact. */
|
|
47
|
+
export declare function deleteDatabase(config: DatabaseTargetConfig): Promise<DeletionOutcome>;
|
|
48
|
+
//# sourceMappingURL=deletion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deletion.d.ts","sourceRoot":"","sources":["../../../../src/adapter/deletion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAyBvD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEzE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAWD,4EAA4E;AAC5E,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACzB,MAAM,IAAI,CAWZ;AAmBD,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,eAAe,CAQnE;AAmID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAEnF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAE9E;AAED,iFAAiF;AACjF,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CA6B3F"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handle an open returns: collections, transactions, batches and
|
|
3
|
+
* attachments over one connection, bound to one scope.
|
|
4
|
+
*
|
|
5
|
+
* Scope is bound here and nowhere else. The handle carries its scope key and
|
|
6
|
+
* no operation on it accepts a scope argument, so there is no `switchScope`
|
|
7
|
+
* to misuse and no read that could address another scope (FR-008a, FR-015).
|
|
8
|
+
*/
|
|
9
|
+
import type { DatabaseHandle } from '../contract/adapter';
|
|
10
|
+
import type { EffectivePosture } from '../contract/backup';
|
|
11
|
+
import type { DatabaseConfig } from '../contract/config';
|
|
12
|
+
import type { CollectionSchema } from '../contract/schema';
|
|
13
|
+
import type { ResolvedScope } from '../contract/scope';
|
|
14
|
+
import type { KeyHandle } from '../crypto/key-provider';
|
|
15
|
+
import type { StorageLayout } from '../platform/location';
|
|
16
|
+
import type { Connection } from '../sqlite/connection';
|
|
17
|
+
export declare function schemaFor(schemas: ReadonlyMap<string, CollectionSchema>, name: string): CollectionSchema;
|
|
18
|
+
export type HandleContext = {
|
|
19
|
+
config: DatabaseConfig;
|
|
20
|
+
connection: Connection;
|
|
21
|
+
key: KeyHandle | null;
|
|
22
|
+
layout: StorageLayout;
|
|
23
|
+
now(): number;
|
|
24
|
+
schemaVersion: number;
|
|
25
|
+
schemas: ReadonlyMap<string, CollectionSchema>;
|
|
26
|
+
scope: ResolvedScope;
|
|
27
|
+
posture: EffectivePosture;
|
|
28
|
+
};
|
|
29
|
+
export declare function buildHandle(context: HandleContext): DatabaseHandle;
|
|
30
|
+
//# sourceMappingURL=handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../../../src/adapter/handle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAkBvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAQjE,wBAAgB,SAAS,CACxB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,IAAI,EAAE,MAAM,GACV,gBAAgB,CASlB;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,GAAG,IAAI,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/C,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAoOlE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public lifecycle functions.
|
|
3
|
+
*
|
|
4
|
+
* Scope deletion and reset are module-level rather than handle methods: they
|
|
5
|
+
* must work whether or not a handle is open on the target (FR-059), and
|
|
6
|
+
* `resetScope` in particular must never be reachable as a fallback from
|
|
7
|
+
* `openDatabase` (FR-057a).
|
|
8
|
+
*
|
|
9
|
+
* The active adapter is resolved lazily so a consuming app that only ever
|
|
10
|
+
* uses the in-memory adapter in tests never loads the native peers.
|
|
11
|
+
*/
|
|
12
|
+
import type { DatabaseHandle, StorageAdapter } from '../contract/adapter';
|
|
13
|
+
import type { DatabaseConfig, DatabaseTargetConfig, ScopeTargetConfig } from '../contract/config';
|
|
14
|
+
import type { DeletionOutcome } from '../contract/attachment';
|
|
15
|
+
/**
|
|
16
|
+
* Swap the adapter. Intended for tests and for the demo app's in-memory
|
|
17
|
+
* mode; production code never calls this.
|
|
18
|
+
*/
|
|
19
|
+
export declare function setStorageAdapter(adapter: StorageAdapter | null): void;
|
|
20
|
+
export declare function openDatabase(config: DatabaseConfig): Promise<DatabaseHandle>;
|
|
21
|
+
export declare function deleteScopeData(config: ScopeTargetConfig): Promise<DeletionOutcome>;
|
|
22
|
+
export declare function deleteDatabase(config: DatabaseTargetConfig): Promise<DeletionOutcome>;
|
|
23
|
+
/**
|
|
24
|
+
* Destructive. Discards one scope's data and leaves it ready for a clean
|
|
25
|
+
* first-run migration. Named apart from `deleteScopeData` deliberately: one
|
|
26
|
+
* is a lifecycle operation, the other is an admission that a database is
|
|
27
|
+
* broken.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resetScope(config: ScopeTargetConfig): Promise<DeletionOutcome>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAEtE;AAkBD,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAE5E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAEnF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAE9E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opening and closing a database.
|
|
3
|
+
*
|
|
4
|
+
* The order of operations here is the design, not an implementation detail:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Validate everything first.** Configuration, scope, and the migration
|
|
7
|
+
* chain are checked before a file is touched, so a developer error is
|
|
8
|
+
* reported against an untouched database (FR-006, FR-053).
|
|
9
|
+
* 2. **Consult the catalog before opening the scope file.** A posture
|
|
10
|
+
* mismatch is detectable there; discovering it from SQLCipher's "file is
|
|
11
|
+
* not a database" would report corruption for what is actually an app
|
|
12
|
+
* configuration change (FR-101).
|
|
13
|
+
* 3. **Migrate before returning.** Nothing observes a half-migrated schema,
|
|
14
|
+
* because there is no handle to observe it with until the chain completes
|
|
15
|
+
* (FR-055). A failure returns no handle at all (FR-050).
|
|
16
|
+
*
|
|
17
|
+
* The handle itself is built in `handle.ts`.
|
|
18
|
+
*/
|
|
19
|
+
import type { DatabaseHandle } from '../contract/adapter';
|
|
20
|
+
import type { DatabaseConfig } from '../contract/config';
|
|
21
|
+
export type OpenOptions = {
|
|
22
|
+
now?: () => number;
|
|
23
|
+
};
|
|
24
|
+
export declare function openSqliteDatabase(config: DatabaseConfig, options?: OpenOptions): Promise<DatabaseHandle>;
|
|
25
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/adapter/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAsBzD,MAAM,MAAM,WAAW,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACnB,CAAC;AAkDF,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CA2FzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bringing the physical tables in line with the declared schema, and skipping
|
|
3
|
+
* that work when nothing changed (LDB-07, LDB-11).
|
|
4
|
+
*
|
|
5
|
+
* Until 0.4.0 every open ran the whole set — CREATE TABLE, PRAGMA table_info,
|
|
6
|
+
* CREATE INDEX per index, for every collection — some sixty native round-trips
|
|
7
|
+
* for ten collections, on the startup path. The applied schema is now recorded
|
|
8
|
+
* in `_meta`; an open whose declaration matches it runs no DDL at all.
|
|
9
|
+
*/
|
|
10
|
+
import type { DatabaseConfig } from '../contract/config';
|
|
11
|
+
import type { Connection } from '../sqlite/connection';
|
|
12
|
+
export interface SchemaSync {
|
|
13
|
+
/** True when the stored schema already matched, so `_meta` exists and no DDL ran. */
|
|
14
|
+
readonly unchanged: boolean;
|
|
15
|
+
/** Records the declaration as applied. Call once the open has succeeded. */
|
|
16
|
+
record(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function syncSchema(connection: Connection, config: DatabaseConfig): Promise<SchemaSync>;
|
|
19
|
+
//# sourceMappingURL=schema-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-sync.d.ts","sourceRoot":"","sources":["../../../../src/adapter/schema-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAgHvD,MAAM,WAAW,UAAU;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,4EAA4E;IAC5E,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAsB,UAAU,CAC/B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,cAAc,GACpB,OAAO,CAAC,UAAU,CAAC,CAoBrB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Transaction` a consumer actually holds.
|
|
3
|
+
*
|
|
4
|
+
* Two rules live here rather than in either adapter, so both are held to the
|
|
5
|
+
* same standard:
|
|
6
|
+
*
|
|
7
|
+
* **Read-your-own-writes** (FR-043). Every collection reached through `tx`
|
|
8
|
+
* runs against the transaction's executor, so a read inside sees the writes
|
|
9
|
+
* made inside. A collection reached through the handle during a transaction
|
|
10
|
+
* would not, and handing one out would be a quiet correctness trap.
|
|
11
|
+
*
|
|
12
|
+
* **Terminal state is terminal** (FR-044). After a commit or an abort, using
|
|
13
|
+
* the transaction raises rather than silently writing outside it — the
|
|
14
|
+
* failure mode where a caller's cleanup code lands in the database after the
|
|
15
|
+
* rollback it was supposed to be part of.
|
|
16
|
+
*/
|
|
17
|
+
import type { StorableRecordData } from '../contract/record';
|
|
18
|
+
import type { CollectionOps, Transaction } from '../contract/transaction';
|
|
19
|
+
import type { Attachments } from '../contract/adapter';
|
|
20
|
+
export type TransactionHost = {
|
|
21
|
+
collection<T extends StorableRecordData>(name: string): CollectionOps<T>;
|
|
22
|
+
attachments(): Attachments;
|
|
23
|
+
rollback(): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export type ManagedTransaction = {
|
|
26
|
+
transaction: Transaction;
|
|
27
|
+
/** True once the body committed or aborted. */
|
|
28
|
+
isSettled(): boolean;
|
|
29
|
+
settle(): void;
|
|
30
|
+
};
|
|
31
|
+
export declare function createTransaction(host: TransactionHost): ManagedTransaction;
|
|
32
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/adapter/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,MAAM,MAAM,eAAe,GAAG;IAC7B,UAAU,CAAC,CAAC,SAAS,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IACzE,WAAW,IAAI,WAAW,CAAC;IAC3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,+CAA+C;IAC/C,SAAS,IAAI,OAAO,CAAC;IACrB,MAAM,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,kBAAkB,CAkC3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Is this artifact still there?", answered without opening it.
|
|
3
|
+
*
|
|
4
|
+
* `stat()` and, for an encrypted artifact, the 22-byte header. Never a
|
|
5
|
+
* content byte and never a decryption (FR-073e, FR-107b). An availability
|
|
6
|
+
* check that decrypted would make a gallery screen showing fifty thumbnails
|
|
7
|
+
* decrypt fifty artifacts to answer a question none of them asked, and would
|
|
8
|
+
* put key material in play for an operation that does not need it.
|
|
9
|
+
*
|
|
10
|
+
* The four states are deliberately four rather than two. `missing` is data
|
|
11
|
+
* that is gone; `undecryptable` is data that exists under a key that does not
|
|
12
|
+
* open it, which is often recoverable and always a different conversation to
|
|
13
|
+
* have with the user (FR-107c).
|
|
14
|
+
*/
|
|
15
|
+
import type { AttachmentAvailability } from '../contract/attachment';
|
|
16
|
+
import type { Executor } from '../sqlite/connection';
|
|
17
|
+
import { type ArtifactContext } from './store';
|
|
18
|
+
export declare function artifactAvailability(context: ArtifactContext, executor: Executor, id: string): Promise<AttachmentAvailability>;
|
|
19
|
+
//# sourceMappingURL=availability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../../../src/artifacts/availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9D,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,sBAAsB,CAAC,CAuCjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cascading artifact removal.
|
|
3
|
+
*
|
|
4
|
+
* The package deletes the files, because the Q2 clarification made it the
|
|
5
|
+
* owner of them (FR-073c). That is the single riskiest thing this package
|
|
6
|
+
* does — POL-011(b)'s media-and-files row exists for it — so two rules hold
|
|
7
|
+
* without exception: every path goes through the boundary guard in
|
|
8
|
+
* `paths.ts`, and the outcome reports what was removed **and what could not
|
|
9
|
+
* be**, never a bare success (FR-071).
|
|
10
|
+
*
|
|
11
|
+
* A failed removal is reported rather than retried or swallowed. A file the
|
|
12
|
+
* package could not delete is still on disk holding the user's data, and an
|
|
13
|
+
* app that told them "deleted" would have said something untrue.
|
|
14
|
+
*/
|
|
15
|
+
import type { AttachmentOwner, DeletionOutcome } from '../contract/attachment';
|
|
16
|
+
import type { Executor } from '../sqlite/connection';
|
|
17
|
+
import { type ArtifactContext, type DeferredUnlinks } from './store';
|
|
18
|
+
export type { DeferredUnlinks };
|
|
19
|
+
/** Unlinks one artifact file. True when the file is gone afterwards, whoever removed it. */
|
|
20
|
+
export declare function unlinkArtifact(path: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Everything belonging to one record, for the FR-070 cascade. Inside a
|
|
23
|
+
* transaction pass `deferred`: the files are removed only once it commits.
|
|
24
|
+
*/
|
|
25
|
+
export declare function cascadeForOwner(context: ArtifactContext, executor: Executor, owner: AttachmentOwner, deferred?: DeferredUnlinks): Promise<DeletionOutcome>;
|
|
26
|
+
//# sourceMappingURL=cascade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascade.d.ts","sourceRoot":"","sources":["../../../../src/artifacts/cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAGN,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,4FAA4F;AAC5F,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnE;AAyCD;;;GAGG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,eAAe,EACtB,QAAQ,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC,CAQ1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every artifact path, resolved through one guard.
|
|
3
|
+
*
|
|
4
|
+
* POL-011(b) flags media-and-files as a risk precisely because this package
|
|
5
|
+
* deletes files from disk on cascade. The mitigation is structural rather
|
|
6
|
+
* than procedural: no code in `artifacts/` builds a path by string
|
|
7
|
+
* concatenation, and the one function that turns an attachment id into a path
|
|
8
|
+
* refuses anything escaping the managed root (FR-073, FR-073f).
|
|
9
|
+
*
|
|
10
|
+
* That is what makes SC-013a's filesystem tracing pass reliably rather than
|
|
11
|
+
* usually — there is no second path to audit.
|
|
12
|
+
*/
|
|
13
|
+
import { type StorageLayout } from '../platform/location';
|
|
14
|
+
export declare function artifactsDirectory(layout: StorageLayout, scopeKey: string): string;
|
|
15
|
+
export declare function artifactPath(layout: StorageLayout, scopeKey: string, attachmentId: string): string;
|
|
16
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../../src/artifacts/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,wBAAgB,YAAY,CAC3B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GAClB,MAAM,CAKR"}
|