@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,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collection operations over the in-memory store.
|
|
5
|
+
*
|
|
6
|
+
* Every semantic decision — filtering, sorting, paging — is delegated to
|
|
7
|
+
* `query/`, the module the SQLite adapter also validates through. Anything
|
|
8
|
+
* decided here instead would be a place the two adapters could drift.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { DiagnosticCodes } from "../../contract/errors.js";
|
|
12
|
+
import { raise } from "../../diagnostics/errors.js";
|
|
13
|
+
import { throwIfFaulted } from "../../diagnostics/faults.js";
|
|
14
|
+
import { assertRecordWithinBudget } from "../../query/budgets.js";
|
|
15
|
+
import { evaluateFilter } from "../../query/filter.js";
|
|
16
|
+
import { applyCursor, buildPage, resolvePageSize } from "../../query/paginate.js";
|
|
17
|
+
import { sortRecords, withStableTiebreaker } from "../../query/sort.js";
|
|
18
|
+
import { validateQuery } from "../../query/validate.js";
|
|
19
|
+
import { hasSoftDelete, hasTimestamps } from "../../schema/declare.js";
|
|
20
|
+
import { collectionMap, encodePayload, toStoredRecord } from "./store.js";
|
|
21
|
+
function notFound(collection, id) {
|
|
22
|
+
raise(DiagnosticCodes.RECORD_NOT_FOUND, {
|
|
23
|
+
message: 'record not found',
|
|
24
|
+
detail: {
|
|
25
|
+
collection,
|
|
26
|
+
recordId: id
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function createMemoryCollection(context) {
|
|
31
|
+
const {
|
|
32
|
+
schema
|
|
33
|
+
} = context;
|
|
34
|
+
const rows = () => collectionMap(context.store, schema.name);
|
|
35
|
+
const readable = includeSoftDeleted => {
|
|
36
|
+
const out = [];
|
|
37
|
+
for (const row of rows().values()) {
|
|
38
|
+
if (!includeSoftDeleted && row.deletedAt != null) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
out.push(toStoredRecord(row));
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
async insert(record) {
|
|
47
|
+
context.assertOpen();
|
|
48
|
+
throwIfFaulted('write');
|
|
49
|
+
assertRecordWithinBudget(schema.name, record.data);
|
|
50
|
+
if (rows().has(record.id)) {
|
|
51
|
+
// Overwriting silently is how a caller loses data without ever
|
|
52
|
+
// seeing a failure.
|
|
53
|
+
raise(DiagnosticCodes.RECORD_CONFLICT, {
|
|
54
|
+
message: 'record already exists',
|
|
55
|
+
detail: {
|
|
56
|
+
collection: schema.name,
|
|
57
|
+
recordId: record.id
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const now = context.now();
|
|
62
|
+
rows().set(record.id, {
|
|
63
|
+
id: record.id,
|
|
64
|
+
payload: encodePayload(record.data),
|
|
65
|
+
createdAt: hasTimestamps(schema) ? now : undefined,
|
|
66
|
+
updatedAt: hasTimestamps(schema) ? now : undefined,
|
|
67
|
+
deletedAt: hasSoftDelete(schema) ? null : undefined
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
operation: 'created',
|
|
71
|
+
id: record.id
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
async update(id, record) {
|
|
75
|
+
context.assertOpen();
|
|
76
|
+
throwIfFaulted('write');
|
|
77
|
+
assertRecordWithinBudget(schema.name, record.data);
|
|
78
|
+
const existing = rows().get(id);
|
|
79
|
+
if (!existing || existing.deletedAt != null) {
|
|
80
|
+
notFound(schema.name, id);
|
|
81
|
+
}
|
|
82
|
+
existing.payload = encodePayload(record.data);
|
|
83
|
+
if (hasTimestamps(schema)) {
|
|
84
|
+
existing.updatedAt = context.now();
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
operation: 'updated',
|
|
88
|
+
id
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
async upsert(record) {
|
|
92
|
+
context.assertOpen();
|
|
93
|
+
throwIfFaulted('write');
|
|
94
|
+
assertRecordWithinBudget(schema.name, record.data);
|
|
95
|
+
const existing = rows().get(record.id);
|
|
96
|
+
const now = context.now();
|
|
97
|
+
if (existing) {
|
|
98
|
+
existing.payload = encodePayload(record.data);
|
|
99
|
+
if (hasTimestamps(schema)) {
|
|
100
|
+
existing.updatedAt = now;
|
|
101
|
+
}
|
|
102
|
+
existing.deletedAt = hasSoftDelete(schema) ? null : undefined;
|
|
103
|
+
return {
|
|
104
|
+
operation: 'updated',
|
|
105
|
+
id: record.id
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
rows().set(record.id, {
|
|
109
|
+
id: record.id,
|
|
110
|
+
payload: encodePayload(record.data),
|
|
111
|
+
createdAt: hasTimestamps(schema) ? now : undefined,
|
|
112
|
+
updatedAt: hasTimestamps(schema) ? now : undefined,
|
|
113
|
+
deletedAt: hasSoftDelete(schema) ? null : undefined
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
operation: 'created',
|
|
117
|
+
id: record.id
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
async get(id) {
|
|
121
|
+
context.assertOpen();
|
|
122
|
+
throwIfFaulted('read');
|
|
123
|
+
const row = rows().get(id);
|
|
124
|
+
if (!row || row.deletedAt != null) {
|
|
125
|
+
notFound(schema.name, id);
|
|
126
|
+
}
|
|
127
|
+
return toStoredRecord(row);
|
|
128
|
+
},
|
|
129
|
+
async find(id) {
|
|
130
|
+
context.assertOpen();
|
|
131
|
+
throwIfFaulted('read');
|
|
132
|
+
const row = rows().get(id);
|
|
133
|
+
if (!row || row.deletedAt != null) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return toStoredRecord(row);
|
|
137
|
+
},
|
|
138
|
+
async delete(id) {
|
|
139
|
+
context.assertOpen();
|
|
140
|
+
throwIfFaulted('write');
|
|
141
|
+
if (!rows().delete(id)) {
|
|
142
|
+
notFound(schema.name, id);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
operation: 'deleted',
|
|
146
|
+
id
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
async softDelete(id) {
|
|
150
|
+
context.assertOpen();
|
|
151
|
+
throwIfFaulted('write');
|
|
152
|
+
if (!hasSoftDelete(schema)) {
|
|
153
|
+
raise(DiagnosticCodes.CONFIG_INVALID, {
|
|
154
|
+
message: 'collection does not declare soft delete',
|
|
155
|
+
detail: {
|
|
156
|
+
collection: schema.name
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const row = rows().get(id);
|
|
161
|
+
if (!row || row.deletedAt != null) {
|
|
162
|
+
notFound(schema.name, id);
|
|
163
|
+
}
|
|
164
|
+
row.deletedAt = context.now();
|
|
165
|
+
return {
|
|
166
|
+
operation: 'deleted',
|
|
167
|
+
id
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
async restore(id) {
|
|
171
|
+
context.assertOpen();
|
|
172
|
+
throwIfFaulted('write');
|
|
173
|
+
if (!hasSoftDelete(schema)) {
|
|
174
|
+
raise(DiagnosticCodes.CONFIG_INVALID, {
|
|
175
|
+
message: 'collection does not declare soft delete',
|
|
176
|
+
detail: {
|
|
177
|
+
collection: schema.name
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const row = rows().get(id);
|
|
182
|
+
if (!row || row.deletedAt == null) {
|
|
183
|
+
notFound(schema.name, id);
|
|
184
|
+
}
|
|
185
|
+
row.deletedAt = null;
|
|
186
|
+
return {
|
|
187
|
+
operation: 'restored',
|
|
188
|
+
id
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
async list(query) {
|
|
192
|
+
context.assertOpen();
|
|
193
|
+
throwIfFaulted('read');
|
|
194
|
+
validateQuery(schema, query);
|
|
195
|
+
const sort = withStableTiebreaker(query?.sort);
|
|
196
|
+
const size = resolvePageSize(query?.page);
|
|
197
|
+
let matched = readable(query?.includeSoftDeleted === true);
|
|
198
|
+
if (query?.filter) {
|
|
199
|
+
matched = matched.filter(record => evaluateFilter(record.data, query.filter));
|
|
200
|
+
}
|
|
201
|
+
const ordered = applyCursor(sortRecords(matched, sort), sort, query?.page?.cursor);
|
|
202
|
+
return buildPage(ordered.slice(0, size + 1), sort, size);
|
|
203
|
+
},
|
|
204
|
+
async count(filter) {
|
|
205
|
+
context.assertOpen();
|
|
206
|
+
throwIfFaulted('read');
|
|
207
|
+
if (filter) {
|
|
208
|
+
validateQuery(schema, {
|
|
209
|
+
filter
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const matched = readable(false);
|
|
213
|
+
if (!filter) {
|
|
214
|
+
return matched.length;
|
|
215
|
+
}
|
|
216
|
+
return matched.filter(record => evaluateFilter(record.data, filter)).length;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DiagnosticCodes","raise","throwIfFaulted","assertRecordWithinBudget","evaluateFilter","applyCursor","buildPage","resolvePageSize","sortRecords","withStableTiebreaker","validateQuery","hasSoftDelete","hasTimestamps","collectionMap","encodePayload","toStoredRecord","notFound","collection","id","RECORD_NOT_FOUND","message","detail","recordId","createMemoryCollection","context","schema","rows","store","name","readable","includeSoftDeleted","out","row","values","deletedAt","push","insert","record","assertOpen","data","has","RECORD_CONFLICT","now","set","payload","createdAt","undefined","updatedAt","operation","update","existing","get","upsert","find","delete","softDelete","CONFIG_INVALID","restore","list","query","sort","size","page","matched","filter","ordered","cursor","slice","count","length"],"sourceRoot":"../../../../src","sources":["testing/memory-adapter/collection.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,0BAAuB;AAUvD,SAASC,KAAK,QAAQ,6BAA0B;AAChD,SAASC,cAAc,QAAQ,6BAA0B;AACzD,SAASC,wBAAwB,QAAQ,wBAAqB;AAC9D,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QAAQ,yBAAsB;AAC9E,SAASC,WAAW,EAAEC,oBAAoB,QAAQ,qBAAkB;AACpE,SAASC,aAAa,QAAQ,yBAAsB;AACpD,SAASC,aAAa,EAAEC,aAAa,QAAQ,yBAAsB;AACnE,SAASC,aAAa,EAAEC,aAAa,EAAEC,cAAc,QAA+B,YAAS;AAS7F,SAASC,QAAQA,CAACC,UAAkB,EAAEC,EAAU,EAAS;EACxDjB,KAAK,CAACD,eAAe,CAACmB,gBAAgB,EAAE;IACvCC,OAAO,EAAE,kBAAkB;IAC3BC,MAAM,EAAE;MAAEJ,UAAU;MAAEK,QAAQ,EAAEJ;IAAG;EACpC,CAAC,CAAC;AACH;AAEA,OAAO,SAASK,sBAAsBA,CACrCC,OAA0B,EACP;EACnB,MAAM;IAAEC;EAAO,CAAC,GAAGD,OAAO;EAC1B,MAAME,IAAI,GAAGA,CAAA,KAAMb,aAAa,CAACW,OAAO,CAACG,KAAK,EAAEF,MAAM,CAACG,IAAI,CAAC;EAE5D,MAAMC,QAAQ,GAAIC,kBAA2B,IAAwB;IACpE,MAAMC,GAAsB,GAAG,EAAE;IACjC,KAAK,MAAMC,GAAG,IAAIN,IAAI,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I,MAAM,CAAC;MAClF,OAAO5D,SAAS,CAAC2D,OAAO,CAACE,KAAK,CAAC,CAAC,EAAEN,IAAI,GAAG,CAAC,CAAC,EAAED,IAAI,EAAEC,IAAI,CAAC;IACzD,CAAC;IAED,MAAMO,KAAKA,CAACJ,MAAmB,EAAmB;MACjDxC,OAAO,CAACc,UAAU,CAAC,CAAC;MACpBpC,cAAc,CAAC,MAAM,CAAC;MACtB,IAAI8D,MAAM,EAAE;QACXtD,aAAa,CAACe,MAAM,EAAE;UAAEuC;QAAO,CAAC,CAAC;MAClC;MACA,MAAMD,OAAO,GAAGlC,QAAQ,CAAC,KAAK,CAAC;MAC/B,IAAI,CAACmC,MAAM,EAAE;QACZ,OAAOD,OAAO,CAACM,MAAM;MACtB;MACA,OAAON,OAAO,CAACC,MAAM,CAAC3B,MAAM,IAAIjC,cAAc,CAACiC,MAAM,CAACE,IAAI,EAAEyB,MAAM,CAAC,CAAC,CAACK,MAAM;IAC5E;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The in-memory adapter.
|
|
5
|
+
*
|
|
6
|
+
* Not a convenience: op-sqlite is native and unreachable from Jest, so this
|
|
7
|
+
* is the only way the package's own guarantees are testable in CI
|
|
8
|
+
* (research.md R8). Documented divergences are listed in the package README.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { createTransactionQueue } from "../../sqlite/transaction-queue.js";
|
|
12
|
+
import { DiagnosticCodes } from "../../contract/errors.js";
|
|
13
|
+
import { acquireKey } from "../../crypto/key-provider.js";
|
|
14
|
+
import { instrument } from "../../diagnostics/dev-log.js";
|
|
15
|
+
import { raise } from "../../diagnostics/errors.js";
|
|
16
|
+
import { assertBatchWithinBudget } from "../../query/budgets.js";
|
|
17
|
+
import { validateConfig } from "../../schema/validate-config.js";
|
|
18
|
+
import { resolveScope } from "../../scope/validate.js";
|
|
19
|
+
import { runMigrations } from "./migrations.js";
|
|
20
|
+
import { createMemoryCollection } from "./collection.js";
|
|
21
|
+
import { collectionMap, dropDatabase, dropScope, existingScopeStore, scopeStoreFor } from "./store.js";
|
|
22
|
+
import { createMemoryAttachments } from "./attachments.js";
|
|
23
|
+
import { throwIfFaulted } from "../faults.js";
|
|
24
|
+
function schemaIndex(collections) {
|
|
25
|
+
return new Map(collections.map(collection => [collection.name, collection]));
|
|
26
|
+
}
|
|
27
|
+
function cloneCollections(store) {
|
|
28
|
+
const copy = new Map();
|
|
29
|
+
for (const [name, rows] of store.collections) {
|
|
30
|
+
copy.set(name, new Map([...rows].map(([id, row]) => [id, {
|
|
31
|
+
...row
|
|
32
|
+
}])));
|
|
33
|
+
}
|
|
34
|
+
return copy;
|
|
35
|
+
}
|
|
36
|
+
export function createMemoryAdapter(options = {}) {
|
|
37
|
+
const now = options.now ?? (() => Date.now());
|
|
38
|
+
async function open(config) {
|
|
39
|
+
validateConfig(config);
|
|
40
|
+
throwIfFaulted('open');
|
|
41
|
+
const scope = resolveScope(config.scope);
|
|
42
|
+
const existing = existingScopeStore(config.name, scope.key);
|
|
43
|
+
if (existing?.deletionState === 'deleting') {
|
|
44
|
+
// A deletion that was interrupted must never look complete.
|
|
45
|
+
raise(DiagnosticCodes.SCOPE_DELETED, {
|
|
46
|
+
message: 'scope deletion was interrupted',
|
|
47
|
+
detail: {
|
|
48
|
+
scopeKey: scope.key
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const store = scopeStoreFor(config.name, scope.key);
|
|
53
|
+
const encryptionRequested = config.encryption?.enabled === true;
|
|
54
|
+
if (store.schemaVersion > 0 && store.encrypted !== encryptionRequested) {
|
|
55
|
+
raise(DiagnosticCodes.ENCRYPTION_MISMATCH, {
|
|
56
|
+
message: 'encryption posture does not match the stored database'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (encryptionRequested) {
|
|
60
|
+
// The same acquisition path the on-device adapter uses, so a locked
|
|
61
|
+
// keychain and a provider returning nothing stay as distinguishable
|
|
62
|
+
// here as they are on a phone (SC-020b). Released immediately: the
|
|
63
|
+
// in-memory store has nothing to encrypt with it.
|
|
64
|
+
const key = await acquireKey(config.encryption, scope);
|
|
65
|
+
key.release();
|
|
66
|
+
}
|
|
67
|
+
store.encrypted = encryptionRequested;
|
|
68
|
+
store.backupIncluded = config.backup?.includeInPlatformBackup === true;
|
|
69
|
+
const schemas = schemaIndex(config.collections);
|
|
70
|
+
for (const collection of config.collections) {
|
|
71
|
+
collectionMap(store, collection.name);
|
|
72
|
+
}
|
|
73
|
+
await runMigrations(store, config, now);
|
|
74
|
+
let closed = false;
|
|
75
|
+
const assertOpen = () => {
|
|
76
|
+
if (closed) {
|
|
77
|
+
raise(DiagnosticCodes.CLOSED_HANDLE, {
|
|
78
|
+
message: 'handle is closed'
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (store.deletionState === 'deleting') {
|
|
82
|
+
raise(DiagnosticCodes.SCOPE_DELETED, {
|
|
83
|
+
message: 'scope was deleted beneath this handle',
|
|
84
|
+
detail: {
|
|
85
|
+
scopeKey: scope.key
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The same isolation the SQLite connection gives: a transaction holds the
|
|
93
|
+
* handle until it settles, and work through the handle meanwhile waits
|
|
94
|
+
* rather than landing inside the transaction's snapshot and vanishing
|
|
95
|
+
* with its rollback. Only what the transaction hands out runs inside it.
|
|
96
|
+
*/
|
|
97
|
+
const queue = createTransactionQueue();
|
|
98
|
+
const queued = ops => Object.fromEntries(Object.entries(ops).map(([key, value]) => [key, typeof value === 'function' ? (...args) => queue.run(() => value(...args)) : value]));
|
|
99
|
+
|
|
100
|
+
/** Artifact deletions held back until the transaction that caused them commits. */
|
|
101
|
+
|
|
102
|
+
/** FR-070 for the memory adapter, with the SQLite adapter's ordering and reporting. */
|
|
103
|
+
const cascadeFor = (collection, id, deferred) => {
|
|
104
|
+
const removedArtifacts = [];
|
|
105
|
+
for (const reference of [...store.attachments.values()]) {
|
|
106
|
+
if (reference.owner?.collection !== collection || reference.owner?.id !== id) continue;
|
|
107
|
+
store.attachments.delete(reference.id);
|
|
108
|
+
if (deferred) {
|
|
109
|
+
deferred.add(reference.id);
|
|
110
|
+
} else {
|
|
111
|
+
store.artifacts.delete(reference.id);
|
|
112
|
+
}
|
|
113
|
+
removedArtifacts.push(reference.id);
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
removedRecords: 0,
|
|
117
|
+
removedArtifacts,
|
|
118
|
+
orphanedReferences: [],
|
|
119
|
+
failedRemovals: []
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
const rawCollectionFor = (name, deferred) => {
|
|
123
|
+
assertOpen();
|
|
124
|
+
const schema = schemas.get(name);
|
|
125
|
+
if (!schema) {
|
|
126
|
+
raise(DiagnosticCodes.CONFIG_INVALID, {
|
|
127
|
+
message: 'collection is not declared',
|
|
128
|
+
detail: {
|
|
129
|
+
collection: name
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const ops = instrument(name, 'memory', createMemoryCollection({
|
|
134
|
+
store,
|
|
135
|
+
schema,
|
|
136
|
+
now,
|
|
137
|
+
assertOpen
|
|
138
|
+
}));
|
|
139
|
+
if (config.cascadeAttachments !== true) {
|
|
140
|
+
return ops;
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
...ops,
|
|
144
|
+
async delete(id) {
|
|
145
|
+
const outcome = await ops.delete(id);
|
|
146
|
+
return {
|
|
147
|
+
...outcome,
|
|
148
|
+
cascade: cascadeFor(name, id, deferred)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const collectionFor = name => queued(rawCollectionFor(name));
|
|
154
|
+
const backupPosture = {
|
|
155
|
+
requested: store.backupIncluded ? 'included' : 'excluded',
|
|
156
|
+
observed: store.backupIncluded ? 'included' : 'excluded',
|
|
157
|
+
enforcedBy: 'package'
|
|
158
|
+
};
|
|
159
|
+
const rawAttachments = createMemoryAttachments({
|
|
160
|
+
store,
|
|
161
|
+
options,
|
|
162
|
+
now,
|
|
163
|
+
assertOpen
|
|
164
|
+
});
|
|
165
|
+
const attachments = queued(rawAttachments());
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* One transaction against the store. Snapshot-and-restore rather than a
|
|
169
|
+
* write log: simpler to reason about, and rollback fidelity is what US4
|
|
170
|
+
* tests. Runs only inside `exclusive`, so the snapshot never captures,
|
|
171
|
+
* nor its restore erases, a write made from outside.
|
|
172
|
+
*/
|
|
173
|
+
const runTransaction = async fn => {
|
|
174
|
+
const snapshot = cloneCollections(store);
|
|
175
|
+
const attachmentSnapshot = new Map(store.attachments);
|
|
176
|
+
const pendingArtifactRemovals = [];
|
|
177
|
+
const deferred = {
|
|
178
|
+
add: id => pendingArtifactRemovals.push(id)
|
|
179
|
+
};
|
|
180
|
+
let settled = false;
|
|
181
|
+
const assertLive = () => {
|
|
182
|
+
if (settled) {
|
|
183
|
+
raise(DiagnosticCodes.TRANSACTION_STATE, {
|
|
184
|
+
message: 'transaction already settled'
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const rollback = () => {
|
|
189
|
+
store.collections = snapshot;
|
|
190
|
+
store.attachments = attachmentSnapshot;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// A collection taken from the transaction keeps refusing once it
|
|
194
|
+
// settles, as the SQLite executor does; otherwise a write after abort
|
|
195
|
+
// would land straight in the store.
|
|
196
|
+
const live = ops => Object.fromEntries(Object.entries(ops).map(([key, value]) => [key, typeof value === 'function' ?
|
|
197
|
+
// Async so a refusal rejects, as the SQLite executor's does.
|
|
198
|
+
async (...args) => {
|
|
199
|
+
assertLive();
|
|
200
|
+
return value(...args);
|
|
201
|
+
} : value]));
|
|
202
|
+
const tx = {
|
|
203
|
+
collection: name => {
|
|
204
|
+
assertLive();
|
|
205
|
+
return live(rawCollectionFor(name, deferred));
|
|
206
|
+
},
|
|
207
|
+
attachments: () => {
|
|
208
|
+
assertLive();
|
|
209
|
+
return rawAttachments(deferred);
|
|
210
|
+
},
|
|
211
|
+
async abort() {
|
|
212
|
+
assertLive();
|
|
213
|
+
settled = true;
|
|
214
|
+
rollback();
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
try {
|
|
218
|
+
const result = await fn(tx);
|
|
219
|
+
if (!settled) {
|
|
220
|
+
throwIfFaulted('commit');
|
|
221
|
+
settled = true;
|
|
222
|
+
// Committed: the artifacts whose references went may go too.
|
|
223
|
+
for (const id of pendingArtifactRemovals) {
|
|
224
|
+
store.artifacts.delete(id);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
} catch (error) {
|
|
229
|
+
if (!settled) {
|
|
230
|
+
settled = true;
|
|
231
|
+
rollback();
|
|
232
|
+
}
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const handle = {
|
|
237
|
+
scopeKey: scope.key,
|
|
238
|
+
schemaVersion: store.schemaVersion,
|
|
239
|
+
backupPosture,
|
|
240
|
+
isEncrypted: store.encrypted,
|
|
241
|
+
collection: collectionFor,
|
|
242
|
+
transaction(fn) {
|
|
243
|
+
assertOpen();
|
|
244
|
+
return queue.runTransaction(() => runTransaction(fn));
|
|
245
|
+
},
|
|
246
|
+
batch(operations) {
|
|
247
|
+
assertOpen();
|
|
248
|
+
assertBatchWithinBudget(operations.length);
|
|
249
|
+
return queue.runTransaction(() => runTransaction(async tx => {
|
|
250
|
+
const outcomes = [];
|
|
251
|
+
for (const operation of operations) {
|
|
252
|
+
const ops = tx.collection(operation.collection);
|
|
253
|
+
switch (operation.type) {
|
|
254
|
+
case 'insert':
|
|
255
|
+
outcomes.push(await ops.insert(operation.record));
|
|
256
|
+
break;
|
|
257
|
+
case 'update':
|
|
258
|
+
outcomes.push(await ops.update(operation.id, {
|
|
259
|
+
data: operation.data
|
|
260
|
+
}));
|
|
261
|
+
break;
|
|
262
|
+
case 'upsert':
|
|
263
|
+
outcomes.push(await ops.upsert(operation.record));
|
|
264
|
+
break;
|
|
265
|
+
case 'delete':
|
|
266
|
+
outcomes.push(await ops.delete(operation.id));
|
|
267
|
+
break;
|
|
268
|
+
case 'softDelete':
|
|
269
|
+
outcomes.push(await ops.softDelete(operation.id));
|
|
270
|
+
break;
|
|
271
|
+
default:
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
applied: outcomes.length,
|
|
277
|
+
outcomes
|
|
278
|
+
};
|
|
279
|
+
}));
|
|
280
|
+
},
|
|
281
|
+
attachments: () => attachments,
|
|
282
|
+
async explain(collection, _query) {
|
|
283
|
+
assertOpen();
|
|
284
|
+
// Documented divergence: index declarations are validated but
|
|
285
|
+
// have no performance effect in memory (FR-096).
|
|
286
|
+
return {
|
|
287
|
+
collection,
|
|
288
|
+
usesIndex: false,
|
|
289
|
+
detail: 'memory adapter does not use indexes'
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
async close() {
|
|
293
|
+
closed = true;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
return handle;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Backs both `deleteScopeData` and `resetScope`. They differ in intent and
|
|
301
|
+
* in what they let a consumer conclude, not in what they do to the store —
|
|
302
|
+
* keeping them as separate exported names is what makes the destructive one
|
|
303
|
+
* impossible to call by accident.
|
|
304
|
+
*/
|
|
305
|
+
async function removeScope(config) {
|
|
306
|
+
const scope = resolveScope(config.scope);
|
|
307
|
+
const store = existingScopeStore(config.name, scope.key);
|
|
308
|
+
if (!store) {
|
|
309
|
+
// Deleting nothing is success, not an error (FR-062).
|
|
310
|
+
return {
|
|
311
|
+
scopeKey: scope.key,
|
|
312
|
+
removedRecords: 0,
|
|
313
|
+
removedArtifacts: [],
|
|
314
|
+
orphanedReferences: [],
|
|
315
|
+
failedRemovals: []
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
store.deletionState = 'deleting';
|
|
319
|
+
let removedRecords = 0;
|
|
320
|
+
for (const rows of store.collections.values()) {
|
|
321
|
+
removedRecords += rows.size;
|
|
322
|
+
}
|
|
323
|
+
const removedArtifacts = [...store.artifacts.keys()];
|
|
324
|
+
dropScope(config.name, scope.key);
|
|
325
|
+
return {
|
|
326
|
+
scopeKey: scope.key,
|
|
327
|
+
removedRecords,
|
|
328
|
+
removedArtifacts,
|
|
329
|
+
orphanedReferences: [],
|
|
330
|
+
failedRemovals: []
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
name: 'memory',
|
|
335
|
+
open,
|
|
336
|
+
deleteScopeData: config => removeScope(config),
|
|
337
|
+
resetScope: config => removeScope(config),
|
|
338
|
+
async deleteDatabase(config) {
|
|
339
|
+
dropDatabase(config.name);
|
|
340
|
+
return {
|
|
341
|
+
removedRecords: 0,
|
|
342
|
+
removedArtifacts: [],
|
|
343
|
+
orphanedReferences: [],
|
|
344
|
+
failedRemovals: []
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
export { Budgets } from "../../contract/config.js";
|
|
350
|
+
export { activeFaults } from "../faults.js";
|
|
351
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTransactionQueue","DiagnosticCodes","acquireKey","instrument","raise","assertBatchWithinBudget","validateConfig","resolveScope","runMigrations","createMemoryCollection","collectionMap","dropDatabase","dropScope","existingScopeStore","scopeStoreFor","createMemoryAttachments","throwIfFaulted","schemaIndex","collections","Map","map","collection","name","cloneCollections","store","copy","rows","set","id","row","createMemoryAdapter","options","now","Date","open","config","scope","existing","key","deletionState","SCOPE_DELETED","message","detail","scopeKey","encryptionRequested","encryption","enabled","schemaVersion","encrypted","ENCRYPTION_MISMATCH","release","backupIncluded","backup","includeInPlatformBackup","schemas","closed","assertOpen","CLOSED_HANDLE","queue","queued","ops","Object","fromEntries","entries","value","args","run","cascadeFor","deferred","removedArtifacts","reference","attachments","values","owner","delete","add","artifacts","push","removedRecords","orphanedReferences","failedRemovals","rawCollectionFor","schema","get","CONFIG_INVALID","cascadeAttachments","outcome","cascade","collectionFor","backupPosture","requested","observed","enforcedBy","rawAttachments","runTransaction","fn","snapshot","attachmentSnapshot","pendingArtifactRemovals","settled","assertLive","TRANSACTION_STATE","rollback","live","tx","abort","result","error","handle","isEncrypted","transaction","batch","operations","length","outcomes","operation","type","insert","record","update","data","upsert","softDelete","applied","explain","_query","usesIndex","close","removeScope","size","keys","deleteScopeData","resetScope","deleteDatabase","Budgets","activeFaults"],"sourceRoot":"../../../../src","sources":["testing/memory-adapter/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,mCAAgC;AAQvE,SAASC,eAAe,QAAQ,0BAAuB;AAWvD,SAASC,UAAU,QAAQ,8BAA2B;AACtD,SAASC,UAAU,QAAQ,8BAA2B;AACtD,SAASC,KAAK,QAAQ,6BAA0B;AAChD,SAASC,uBAAuB,QAAQ,wBAAqB;AAC7D,SAASC,cAAc,QAAQ,iCAA8B;AAC7D,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,sBAAsB,QAAQ,iBAAc;AACrD,SACCC,aAAa,EACbC,YAAY,EACZC,SAAS,EACTC,kBAAkB,EAClBC,aAAa,QAEP,YAAS;AAChB,SAASC,uBAAuB,QAAQ,kBAAe;AACvD,SAASC,cAAc,QAAQ,cAAW;AAa1C,SAASC,WAAWA,CAACC,WAA+B,EAAiC;EACpF,OAAO,IAAIC,GAAG,CAACD,WAAW,CAACE,GAAG,CAACC,UAAU,IAAI,CAACA,UAAU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