@chipmobilesdk/rn-local-db 0.3.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 +160 -1
- package/README.md +99 -19
- 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/skills/sdk-rn-local-db/SKILL.md +1 -1
- package/src/adapter/budgets.ts +1 -10
- package/src/adapter/collection.ts +38 -66
- package/src/adapter/deletion.ts +48 -0
- package/src/adapter/handle.ts +311 -0
- package/src/adapter/lifecycle.ts +10 -338
- package/src/adapter/schema-sync.ts +155 -0
- package/src/artifacts/cascade.ts +0 -14
- package/src/artifacts/store.ts +60 -10
- package/src/contract/attachment.ts +24 -3
- package/src/contract/migration.ts +4 -1
- package/src/crypto/provider.ts +7 -3
- package/src/diagnostics/dev-log.ts +5 -1
- package/src/migration/executor.ts +27 -6
- package/src/migration/ledger.ts +18 -27
- package/src/platform/fs.ts +2 -8
- package/src/platform/location.ts +0 -3
- package/src/query/budgets.ts +32 -5
- package/src/schema/validate-config.ts +3 -53
- package/src/sqlite/batch.ts +40 -51
- package/src/sqlite/connection.ts +0 -9
- package/src/sqlite/row-codec.ts +5 -2
- package/src/sqlite/statements.ts +74 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/memory-adapter/attachments.ts +146 -0
- package/src/testing/memory-adapter/index.ts +13 -111
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transactions and batches.
|
|
3
|
+
*
|
|
4
|
+
* A transaction never spans two scopes (FR-038): with one database file per
|
|
5
|
+
* scope, a cross-scope transaction is not expressible rather than merely
|
|
6
|
+
* discouraged.
|
|
7
|
+
*/
|
|
8
|
+
import type { FilterNode, Query, ResultPage } from './query.js';
|
|
9
|
+
import type { RecordInput, StorableRecordData, StoredRecord, WriteOutcome } from './record.js';
|
|
10
|
+
import type { Attachments } from './adapter.js';
|
|
11
|
+
/** Collection operations, available on a handle and inside a transaction. */
|
|
12
|
+
export type CollectionOps<T extends StorableRecordData = StorableRecordData> = {
|
|
13
|
+
insert(record: RecordInput<T>): Promise<WriteOutcome>;
|
|
14
|
+
update(id: string, record: Partial<RecordInput<T>> & {
|
|
15
|
+
data: T;
|
|
16
|
+
}): Promise<WriteOutcome>;
|
|
17
|
+
upsert(record: RecordInput<T>): Promise<WriteOutcome>;
|
|
18
|
+
/** Rejects with RECORD_NOT_FOUND when absent (FR-027). */
|
|
19
|
+
get(id: string): Promise<StoredRecord<T>>;
|
|
20
|
+
/** Null-returning variant, so absence stays distinguishable at the call site. */
|
|
21
|
+
find(id: string): Promise<StoredRecord<T> | null>;
|
|
22
|
+
delete(id: string): Promise<WriteOutcome>;
|
|
23
|
+
softDelete(id: string): Promise<WriteOutcome>;
|
|
24
|
+
restore(id: string): Promise<WriteOutcome>;
|
|
25
|
+
list(query?: Query): Promise<ResultPage<T>>;
|
|
26
|
+
count(filter?: FilterNode): Promise<number>;
|
|
27
|
+
};
|
|
28
|
+
export type Transaction = {
|
|
29
|
+
collection<T extends StorableRecordData = StorableRecordData>(name: string): CollectionOps<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Attachments whose references join this transaction (FR-072): they roll
|
|
32
|
+
* back with it, and cascaded files are removed only once it commits. Added
|
|
33
|
+
* in 0.2.0 — the handle's own `attachments()` no longer reaches into an
|
|
34
|
+
* in-flight transaction.
|
|
35
|
+
*/
|
|
36
|
+
attachments(): Attachments;
|
|
37
|
+
/** Discards every write in this transaction (FR-041). */
|
|
38
|
+
abort(): Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
export type BatchOperation = {
|
|
41
|
+
type: 'insert';
|
|
42
|
+
collection: string;
|
|
43
|
+
record: RecordInput;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'update';
|
|
46
|
+
collection: string;
|
|
47
|
+
id: string;
|
|
48
|
+
data: StorableRecordData;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'upsert';
|
|
51
|
+
collection: string;
|
|
52
|
+
record: RecordInput;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'delete';
|
|
55
|
+
collection: string;
|
|
56
|
+
id: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'softDelete';
|
|
59
|
+
collection: string;
|
|
60
|
+
id: string;
|
|
61
|
+
};
|
|
62
|
+
export type BatchOutcome = {
|
|
63
|
+
applied: number;
|
|
64
|
+
outcomes: WriteOutcome[];
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/contract/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAU,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAW,CAAC;AAE7C,6EAA6E;AAC7E,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAAI;IAC9E,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACzF,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACtD,0DAA0D;IAC1D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,iFAAiF;IACjF,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,UAAU,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAC9F;;;;;OAKG;IACH,WAAW,IAAI,WAAW,CAAC;IAC3B,yDAAyD;IACzD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chunked AES-256-GCM artifact format.
|
|
3
|
+
*
|
|
4
|
+
* Whole-file encryption was rejected because a 100 MB artifact would have to
|
|
5
|
+
* be held in memory twice — plaintext and ciphertext — which breaks FR-107a's
|
|
6
|
+
* flat memory bound and every PERF-001 budget along with it (research.md R4).
|
|
7
|
+
* Chunking keeps exactly one 256 KB chunk in flight regardless of artifact
|
|
8
|
+
* size.
|
|
9
|
+
*
|
|
10
|
+
* ```text
|
|
11
|
+
* [ header 22 bytes ] magic | format version | chunk size | chunk count | plaintext size
|
|
12
|
+
* [ chunk 0 ] ciphertext(≤ chunkSize) | auth tag (16)
|
|
13
|
+
* [ chunk 1 ] …
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The auth tag follows each chunk rather than sitting in the header, which is
|
|
17
|
+
* a deliberate departure from the sketch in storage-layout.md. A tag is only
|
|
18
|
+
* known after its chunk has been encrypted, and the filesystem peer appends —
|
|
19
|
+
* it cannot seek back to patch a header. Collecting every tag before writing
|
|
20
|
+
* anything would mean buffering the whole ciphertext, which is the thing this
|
|
21
|
+
* format exists to avoid. Inline tags keep the write append-only and leave
|
|
22
|
+
* every chunk at a computable offset.
|
|
23
|
+
*
|
|
24
|
+
* A failing tag on read is `ATTACHMENT_UNDECRYPTABLE`, deliberately distinct
|
|
25
|
+
* from `ATTACHMENT_MISSING` (FR-107c): one is a wrong key or a tampered file
|
|
26
|
+
* and may be recoverable, the other is data that is simply gone.
|
|
27
|
+
*/
|
|
28
|
+
export declare const MAGIC = "LDB1";
|
|
29
|
+
export declare const FORMAT_VERSION = 1;
|
|
30
|
+
export declare const HEADER_BYTES = 22;
|
|
31
|
+
export declare const TAG_BYTES = 16;
|
|
32
|
+
export declare const ALGORITHM = "aes-256-gcm";
|
|
33
|
+
export type ArtifactHeader = {
|
|
34
|
+
formatVersion: number;
|
|
35
|
+
chunkSize: number;
|
|
36
|
+
chunkCount: number;
|
|
37
|
+
plaintextSize: number;
|
|
38
|
+
};
|
|
39
|
+
export declare function chunkCountFor(plaintextSize: number, chunkSize: number): number;
|
|
40
|
+
export declare function encodeHeader(header: ArtifactHeader): Uint8Array;
|
|
41
|
+
export declare function decodeHeader(bytes: Uint8Array): ArtifactHeader;
|
|
42
|
+
/** Plaintext length of chunk `index`; the last one is usually short. */
|
|
43
|
+
export declare function chunkPlaintextLength(header: ArtifactHeader, index: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Byte offset of chunk `index` in the file.
|
|
46
|
+
*
|
|
47
|
+
* Every chunk but the last is full, so the offset is arithmetic rather than a
|
|
48
|
+
* table lookup — which is what lets a range read seek straight to the chunk
|
|
49
|
+
* it needs instead of walking the file.
|
|
50
|
+
*/
|
|
51
|
+
export declare function chunkOffset(header: ArtifactHeader, index: number): number;
|
|
52
|
+
export declare function encryptedLength(header: ArtifactHeader): number;
|
|
53
|
+
/** One chunk in, ciphertext with its tag appended out. */
|
|
54
|
+
export declare function encryptChunk(key: Uint8Array, index: number, plaintext: Uint8Array): Uint8Array;
|
|
55
|
+
export declare function decryptChunk(key: Uint8Array, index: number, stored: Uint8Array): Uint8Array;
|
|
56
|
+
export declare function headerFor(plaintextSize: number, chunkSize?: number): ArtifactHeader;
|
|
57
|
+
//# sourceMappingURL=chunked-cipher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunked-cipher.d.ts","sourceRoot":"","sources":["../../../../src/crypto/chunked-cipher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASH,eAAO,MAAM,KAAK,SAAS,CAAC;AAC5B,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,SAAS,gBAAgB,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,UAAU,CAe/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAa9D;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAM9D;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAO9F;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAqB3F;AAED,wBAAgB,SAAS,CACxB,aAAa,EAAE,MAAM,EACrB,SAAS,SAA+B,GACtC,cAAc,CAOhB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-artifact key derivation.
|
|
3
|
+
*
|
|
4
|
+
* The database key is handed straight to SQLCipher. Using that same material
|
|
5
|
+
* as the AES-GCM key for artifacts would mean the two keystreams share a
|
|
6
|
+
* secret, so a weakness in either one — a nonce collision in the artifact
|
|
7
|
+
* format, a padding oracle in the database format — becomes a weakness in
|
|
8
|
+
* both. HKDF costs one hash and removes the coupling entirely (research.md
|
|
9
|
+
* R4).
|
|
10
|
+
*
|
|
11
|
+
* The artifact id is the HKDF `info`, so two artifacts under the same
|
|
12
|
+
* database key derive different subkeys. That is what makes the deterministic
|
|
13
|
+
* nonce scheme safe: a nonce is only ever reused with a different key.
|
|
14
|
+
*/
|
|
15
|
+
/** 32 bytes, one artifact, one database key. */
|
|
16
|
+
export declare function deriveArtifactKey(databaseKey: string, scopeKey: string, attachmentId: string): Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* Deterministic 12-byte nonce from the chunk index.
|
|
19
|
+
*
|
|
20
|
+
* Deterministic rather than random because a random nonce would have to be
|
|
21
|
+
* stored per chunk, and because uniqueness is already guaranteed one level
|
|
22
|
+
* up: the key is unique per artifact, so an index that is unique within the
|
|
23
|
+
* artifact is unique under that key. The remaining four bytes are a fixed
|
|
24
|
+
* domain tag rather than padding, so a nonce from this scheme can never
|
|
25
|
+
* collide with one from a future scheme that uses the same counter space.
|
|
26
|
+
*/
|
|
27
|
+
export declare function nonceForChunk(index: number): Uint8Array;
|
|
28
|
+
//# sourceMappingURL=derive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../../src/crypto/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH,gDAAgD;AAChD,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GAClB,UAAU,CAWZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CASvD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key acquisition, scoped to one handle's lifetime.
|
|
3
|
+
*
|
|
4
|
+
* The package never generates, derives from its own material, persists,
|
|
5
|
+
* caches beyond the handle, transmits, or returns a key (FR-098). What it
|
|
6
|
+
* does is ask the app for one at open and hold it exactly as long as the
|
|
7
|
+
* connection that needs it — which is also why no keychain library appears in
|
|
8
|
+
* this package's dependencies (LIB-004).
|
|
9
|
+
*
|
|
10
|
+
* The provider receives the resolved scope, so an app can key per identity.
|
|
11
|
+
* That is not a convenience: it is what makes destroying one identity's key a
|
|
12
|
+
* meaningful answer to a deletion request, rather than a gesture that leaves
|
|
13
|
+
* the data readable under a shared key (FR-104).
|
|
14
|
+
*/
|
|
15
|
+
import type { EncryptionConfig } from '../contract/encryption.js';
|
|
16
|
+
import type { ResolvedScope } from '../contract/scope.js';
|
|
17
|
+
/**
|
|
18
|
+
* A key with an explicit end of life.
|
|
19
|
+
*
|
|
20
|
+
* Handing the string around directly would leave copies wherever it was
|
|
21
|
+
* passed. A handle that can be released gives the connection one place to
|
|
22
|
+
* drop it, and gives `key-hygiene.test.ts` something to assert against.
|
|
23
|
+
*/
|
|
24
|
+
export type KeyHandle = {
|
|
25
|
+
value(): string;
|
|
26
|
+
release(): void;
|
|
27
|
+
readonly released: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function acquireKey(encryption: EncryptionConfig, scope: ResolvedScope): Promise<KeyHandle>;
|
|
30
|
+
//# sourceMappingURL=key-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-provider.d.ts","sourceRoot":"","sources":["../../../../src/crypto/key-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAmB,CAAC;AAIvD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,IAAI,MAAM,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAsB,UAAU,CAC/B,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,aAAa,GAClB,OAAO,CAAC,SAAS,CAAC,CAwCpB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cipher peer, behind one lazy accessor.
|
|
3
|
+
*
|
|
4
|
+
* Marked optional in `peerDependenciesMeta`: an app that never enables
|
|
5
|
+
* encryption should not have to install a native crypto module. That makes
|
|
6
|
+
* "the peer is absent" a supported state rather than a broken install, so it
|
|
7
|
+
* reports `ENCRYPTION_UNAVAILABLE` — the same code as a missing SQLCipher
|
|
8
|
+
* build flag, because from the app's side it is the same problem: encryption
|
|
9
|
+
* was asked for and cannot be delivered (research.md R1a).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The two things this package asks of a cipher: AES-256-GCM for artifacts, and
|
|
13
|
+
* HKDF to derive each artifact's subkey. Hashing is not among them — the scope
|
|
14
|
+
* digest is SHA-256 in plain TypeScript (`scope/hash.ts`), because it runs on
|
|
15
|
+
* every scope resolution including the ones that never open an encrypted
|
|
16
|
+
* database, where a native module may not be installed at all (WS4-08).
|
|
17
|
+
*/
|
|
18
|
+
export type CipherModule = {
|
|
19
|
+
createCipheriv(algorithm: string, key: Uint8Array, iv: Uint8Array): {
|
|
20
|
+
update(data: Uint8Array): Uint8Array;
|
|
21
|
+
final(): Uint8Array;
|
|
22
|
+
getAuthTag(): Uint8Array;
|
|
23
|
+
};
|
|
24
|
+
createDecipheriv(algorithm: string, key: Uint8Array, iv: Uint8Array): {
|
|
25
|
+
update(data: Uint8Array): Uint8Array;
|
|
26
|
+
final(): Uint8Array;
|
|
27
|
+
setAuthTag(tag: Uint8Array): void;
|
|
28
|
+
};
|
|
29
|
+
hkdfSync(digest: string, key: Uint8Array, salt: Uint8Array, info: Uint8Array, length: number): ArrayBuffer;
|
|
30
|
+
};
|
|
31
|
+
/** Swap the module. Tests only; `null` goes back to the real one. */
|
|
32
|
+
export declare function setCipherModule(module: CipherModule | null): void;
|
|
33
|
+
export declare function isCipherAvailable(): boolean;
|
|
34
|
+
export declare function cipherModule(): CipherModule;
|
|
35
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/crypto/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,cAAc,CACb,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,GACZ;QACF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;QACrC,KAAK,IAAI,UAAU,CAAC;QACpB,UAAU,IAAI,UAAU,CAAC;KACzB,CAAC;IACF,gBAAgB,CACf,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,GACZ;QACF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;QACrC,KAAK,IAAI,UAAU,CAAC;QACpB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;KAClC,CAAC;IACF,QAAQ,CACP,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACZ,WAAW,CAAC;CACf,CAAC;AAYF,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI,CAEjE;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,YAAY,IAAI,YAAY,CAQ3C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development-only diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* Operation names, durations, and counts are safe to report. Record payloads,
|
|
5
|
+
* field values, and query parameters are not — in any build, including this
|
|
6
|
+
* one (FR-080, FR-081). There is deliberately no path here that accepts a
|
|
7
|
+
* payload, so a future caller cannot pass one by accident.
|
|
8
|
+
*/
|
|
9
|
+
export type DiagnosticEvent = {
|
|
10
|
+
operation: string;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
count?: number | undefined;
|
|
13
|
+
collection?: string;
|
|
14
|
+
adapter?: 'sqlite' | 'memory';
|
|
15
|
+
/** A diagnostic code when the operation failed. Never a message. */
|
|
16
|
+
outcome?: string;
|
|
17
|
+
};
|
|
18
|
+
export type DiagnosticLogger = (event: DiagnosticEvent) => void;
|
|
19
|
+
/** Passing null removes the logger. */
|
|
20
|
+
export declare function setDiagnosticLogger(next: DiagnosticLogger | null): void;
|
|
21
|
+
export declare function logDiagnostic(event: DiagnosticEvent): void;
|
|
22
|
+
export declare function isLogging(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Wrap a collection so every operation reports its name, duration, and result
|
|
25
|
+
* count — and nothing else.
|
|
26
|
+
*
|
|
27
|
+
* Wrapping once here rather than instrumenting each operation in the adapters
|
|
28
|
+
* is what keeps the guarantee checkable: there is one place that decides what
|
|
29
|
+
* a log line may contain, and it has no access to a payload to leak even if a
|
|
30
|
+
* future change wanted one. The wrapper is applied only when a logger is
|
|
31
|
+
* installed and the build is a development build, so a production bundle pays
|
|
32
|
+
* nothing and emits nothing (FR-081).
|
|
33
|
+
*/
|
|
34
|
+
export declare function instrument<T extends object>(collection: string, adapter: 'sqlite' | 'memory', operations: T): T;
|
|
35
|
+
//# sourceMappingURL=dev-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-log.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/dev-log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AAIhE,uCAAuC;AACvC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAEvE;AAkBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAY1D;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,QAAQ,GAAG,QAAQ,EAC5B,UAAU,EAAE,CAAC,GACX,CAAC,CAuCH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single error type the package raises.
|
|
3
|
+
*
|
|
4
|
+
* Everything is redacted on the way in (see redact.ts), so there is no path
|
|
5
|
+
* by which a field value, query parameter, scope component, or key reaches an
|
|
6
|
+
* error object at all.
|
|
7
|
+
*/
|
|
8
|
+
import { SdkError } from '@chipmobilesdk/rn-core';
|
|
9
|
+
import { DiagnosticCodes, type DiagnosticCode } from '../contract/errors.js';
|
|
10
|
+
import type { MigrationFailureDetail } from '../contract/migration.js';
|
|
11
|
+
export type StorageErrorInit = {
|
|
12
|
+
/**
|
|
13
|
+
* A message this package authored. Never foreign text — a native or
|
|
14
|
+
* consumer-thrown message goes in `cause`, which reduces it to an
|
|
15
|
+
* identifier. `authored-messages.test.ts` checks every call site.
|
|
16
|
+
*/
|
|
17
|
+
message?: string;
|
|
18
|
+
detail?: Record<string, unknown> | undefined;
|
|
19
|
+
migration?: MigrationFailureDetail | undefined;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** The package's error; an `SdkError` (`@chipmobilesdk/rn-core`) with `pkg: 'rn-local-db'`. */
|
|
23
|
+
export declare class StorageError extends SdkError<DiagnosticCode> {
|
|
24
|
+
readonly detail?: Record<string, string | number | boolean> | undefined;
|
|
25
|
+
readonly migration?: MigrationFailureDetail | undefined;
|
|
26
|
+
constructor(code: DiagnosticCode, init?: StorageErrorInit);
|
|
27
|
+
}
|
|
28
|
+
export declare function isStorageError(value: unknown): value is StorageError;
|
|
29
|
+
/** So no consumer ever has to parse a message string (FR-082). */
|
|
30
|
+
export declare function isCode(value: unknown, code: DiagnosticCode): boolean;
|
|
31
|
+
export declare function raise(code: DiagnosticCode, init?: StorageErrorInit): never;
|
|
32
|
+
export { DiagnosticCodes };
|
|
33
|
+
export type { DiagnosticCode };
|
|
34
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAmB,KAAK,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAAuB,CAAC;AAGpE,MAAM,MAAM,gBAAgB,GAAG;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,SAAS,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,+FAA+F;AAC/F,qBAAa,YAAa,SAAQ,QAAQ,CAAC,cAAc,CAAC;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;gBAE5C,IAAI,EAAE,cAAc,EAAE,IAAI,GAAE,gBAAqB;CAe7D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,kEAAkE;AAClE,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAE1E;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fault registry.
|
|
3
|
+
*
|
|
4
|
+
* It lives here rather than under `testing/` because FR-095 wants every
|
|
5
|
+
* documented failure reachable from a real app running the real adapter — the
|
|
6
|
+
* demo's fault-injection panel exercises the on-device path, not a simulation
|
|
7
|
+
* of it. So the check has to exist in production code.
|
|
8
|
+
*
|
|
9
|
+
* What does *not* exist in production code is a way to inject: `injectFault`
|
|
10
|
+
* and `clearFaults` are exported only from the `./testing` entrypoint. With
|
|
11
|
+
* nothing injected this is one lookup in an empty map, which is the price of
|
|
12
|
+
* being able to prove a recovery path works before a user finds it broken.
|
|
13
|
+
*/
|
|
14
|
+
import type { DiagnosticCode } from '../contract/errors.js';
|
|
15
|
+
export type FaultPoint = 'open' | 'read' | 'write' | 'commit' | 'migration' | 'attachmentWrite' | 'keyProvider';
|
|
16
|
+
export type FaultSpec = {
|
|
17
|
+
at: FaultPoint;
|
|
18
|
+
code: DiagnosticCode;
|
|
19
|
+
/** Fire this many times, then stop. Omit for "until cleared". */
|
|
20
|
+
times?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function injectFault(spec: FaultSpec): void;
|
|
23
|
+
export declare function clearFaults(): void;
|
|
24
|
+
export declare function activeFaults(): FaultPoint[];
|
|
25
|
+
export declare function throwIfFaulted(point: FaultPoint): void;
|
|
26
|
+
//# sourceMappingURL=faults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faults.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/faults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAGzD,MAAM,MAAM,UAAU,GACrB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,iBAAiB,GAAG,aAAa,CAAC;AAExF,MAAM,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,UAAU,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAKjD;AAED,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,wBAAgB,YAAY,IAAI,UAAU,EAAE,CAE3C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAatD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native error to diagnostic code.
|
|
3
|
+
*
|
|
4
|
+
* The three failures FR-076 insists stay apart — a full disk, a filesystem
|
|
5
|
+
* the app cannot reach, and a corrupt database — arrive from SQLite and from
|
|
6
|
+
* the filesystem peer as ordinary errors with a string on them. Collapsing
|
|
7
|
+
* them into one write failure would be the easy thing and the wrong one: an
|
|
8
|
+
* app frees space for the first, retries after unlock for the second, and has
|
|
9
|
+
* to offer a reset for the third.
|
|
10
|
+
*
|
|
11
|
+
* Only the code is derived here. The message never travels — it is redacted
|
|
12
|
+
* at construction by `StorageError` (FR-079).
|
|
13
|
+
*/
|
|
14
|
+
import { type DiagnosticCode } from '../contract/errors.js';
|
|
15
|
+
export type NativeContext = {
|
|
16
|
+
/** Where the failure happened, so ambiguous signatures resolve correctly. */
|
|
17
|
+
operation: 'open' | 'read' | 'write' | 'transaction' | 'attachment' | 'delete';
|
|
18
|
+
/**
|
|
19
|
+
* Whether the database was opened with a key. "File is not a database" is
|
|
20
|
+
* SQLCipher's answer to a wrong key and SQLite's answer to a corrupt file;
|
|
21
|
+
* the only thing that separates them is whether a key was in play.
|
|
22
|
+
*/
|
|
23
|
+
encrypted?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare function mapNativeError(error: unknown, context: NativeContext): DiagnosticCode;
|
|
26
|
+
/**
|
|
27
|
+
* Re-raise a native failure as a typed one, preserving an error the package
|
|
28
|
+
* already classified rather than reclassifying it as a generic write failure.
|
|
29
|
+
*/
|
|
30
|
+
export declare function raiseNative(error: unknown, context: NativeContext): never;
|
|
31
|
+
//# sourceMappingURL=map-native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-native.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/map-native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAG1E,MAAM,MAAM,aAAa,GAAG;IAC3B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC/E;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAqBF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CA0CrF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAYzE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction, applied at construction rather than at logging time.
|
|
3
|
+
*
|
|
4
|
+
* The distinction matters: an error object that never held a payload cannot
|
|
5
|
+
* leak one through a consumer's crash reporter, which is where these leaks
|
|
6
|
+
* actually happen in practice. Redacting on the way out of a logger would
|
|
7
|
+
* still leave the values sitting on the object for anything else to pick up
|
|
8
|
+
* (FR-079, FR-099).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The allowlist IS the mechanism. Every key here has been reviewed as
|
|
12
|
+
* incapable of carrying user data: identifiers the app already knows, sizes,
|
|
13
|
+
* counts, and version numbers.
|
|
14
|
+
*
|
|
15
|
+
* A denylist was tried and removed. It rejected `recordId` because the name
|
|
16
|
+
* contains "record", which is the failure mode denylists always have — they
|
|
17
|
+
* guess from names. A closed allowlist cannot guess, and adding to it is a
|
|
18
|
+
* deliberate act with a reviewer attached.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SAFE_DETAIL_KEYS: Set<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Reduce foreign text to an identifier, or to nothing.
|
|
23
|
+
*
|
|
24
|
+
* "Foreign" means text this package did not author: a SQLite message, a
|
|
25
|
+
* filesystem error, an `Error` a consumer's own migration threw. Any of them
|
|
26
|
+
* can contain anything — SQLite quotes bound parameters back, and a migration
|
|
27
|
+
* that fails on a constraint routinely names the value that violated it.
|
|
28
|
+
*
|
|
29
|
+
* An earlier version of this tried to keep the readable part: the text before
|
|
30
|
+
* the first colon, if it "looked like a class of failure". That heuristic
|
|
31
|
+
* fails on the case that matters. `Patient reported chest pain` looks exactly
|
|
32
|
+
* like a class of failure — short, no punctuation, no digits — and is a
|
|
33
|
+
* medical record. There is no shape test that separates prose describing a
|
|
34
|
+
* failure from prose describing a person, so there is no version of the
|
|
35
|
+
* heuristic worth keeping.
|
|
36
|
+
*
|
|
37
|
+
* What survives is a leading `SQLITE_*` / `ENOENT`-style identifier, which is
|
|
38
|
+
* a closed vocabulary of engine and libc constants and cannot be a value.
|
|
39
|
+
* Everything else becomes `[redacted]`. A developer who needs more can
|
|
40
|
+
* reproduce with the development logger; a crash report cannot.
|
|
41
|
+
*/
|
|
42
|
+
export declare function redactForeignText(text: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* A message this package wrote itself.
|
|
45
|
+
*
|
|
46
|
+
* Every `raise()` call site passes a string literal, and the handful that
|
|
47
|
+
* interpolate do so with a value from a closed set — an operator name, a
|
|
48
|
+
* fault point, a sanitized identifier. `authored-messages.test.ts` enforces
|
|
49
|
+
* that mechanically against the source, so this is a checked property rather
|
|
50
|
+
* than a convention someone has to remember.
|
|
51
|
+
*
|
|
52
|
+
* So no filtering happens here: filtering a message the package wrote would
|
|
53
|
+
* destroy the only readable part of the error for no gain. Foreign text never
|
|
54
|
+
* reaches this function — it goes through `redactForeignText` above.
|
|
55
|
+
*/
|
|
56
|
+
export declare function sanitizeAuthoredMessage(message: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Reduce a consumer-supplied identifier to a bounded, punctuation-free token.
|
|
59
|
+
*
|
|
60
|
+
* A field name is worth naming — FR-034 exists so a typo is distinguishable
|
|
61
|
+
* from a deliberate choice, and "which field?" is the whole answer. But the
|
|
62
|
+
* name arrives from the consumer, so it is capped and stripped rather than
|
|
63
|
+
* trusted verbatim.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sanitizeIdentifier(identifier: string): string;
|
|
66
|
+
/** Keep only keys on the allowlist, and only primitive values. */
|
|
67
|
+
export declare function redactDetail(detail: Record<string, unknown> | undefined): Record<string, string | number | boolean> | undefined;
|
|
68
|
+
/** Reduce an unknown thrown value to a message-shaped string, redacted. */
|
|
69
|
+
export declare function redactCause(cause: unknown): string | undefined;
|
|
70
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,aAiB3B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,CAGvD;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAW9D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@chipmobilesdk/rn-local-db`
|
|
3
|
+
*
|
|
4
|
+
* Offline-first, scope-isolated local storage for ChipMobileSdk apps.
|
|
5
|
+
*
|
|
6
|
+
* What is deliberately absent is part of the contract: there is no
|
|
7
|
+
* `switchScope`, and no read, write, or query operation accepts a scope
|
|
8
|
+
* argument. Scope is bound to a handle at open time and immutable, so a
|
|
9
|
+
* cross-scope leak is not expressible rather than merely prevented.
|
|
10
|
+
*
|
|
11
|
+
* The underlying engine, the physical layout, key material, and the query
|
|
12
|
+
* translation are private and unreachable by deep import.
|
|
13
|
+
*/
|
|
14
|
+
export { deleteDatabase, deleteScopeData, openDatabase, resetScope } from './adapter/index.js';
|
|
15
|
+
export { DiagnosticCodes, StorageError, isCode, isStorageError } from './diagnostics/errors.js';
|
|
16
|
+
export { setDiagnosticLogger, type DiagnosticLogger } from './diagnostics/dev-log.js';
|
|
17
|
+
export { Budgets } from './contract/config.js';
|
|
18
|
+
export type { DatabaseConfig, DatabaseTargetConfig, ScopeTargetConfig } from './contract/config.js';
|
|
19
|
+
export type { ResolvedScope, ScopeDescriptor, ScopeKind } from './contract/scope.js';
|
|
20
|
+
export type { CollectionSchema, FieldDeclaration, FieldType, IndexDeclaration, } from './contract/schema.js';
|
|
21
|
+
export type { RecordInput, StorableRecordData, StorableValue, StoredRecord, WriteOperation, WriteOutcome, } from './contract/record.js';
|
|
22
|
+
export type { ComparisonNode, FilterNode, FilterValue, IndexCoverageReport, LogicalNode, PageRequest, Query, ResultPage, SortDirection, SortKey, } from './contract/query.js';
|
|
23
|
+
export type { BatchOperation, BatchOutcome, CollectionOps, Transaction, } from './contract/transaction.js';
|
|
24
|
+
export type { Migration, MigrationContext, MigrationFailureDetail, MigrationLedgerEntry, MigrationOutcome, } from './contract/migration.js';
|
|
25
|
+
export type { AttachmentAvailability, AttachmentAvailabilityState, AttachmentInput, AttachmentOwner, AttachmentReference, ByteRange, DeletionOutcome, ReconciliationReport, } from './contract/attachment.js';
|
|
26
|
+
export type { EncryptionConfig, EncryptionPosture, KeyProvider } from './contract/encryption.js';
|
|
27
|
+
export type { BackupConfig, BackupPostureValue, EffectivePosture } from './contract/backup.js';
|
|
28
|
+
export type { DiagnosticCode } from './contract/errors.js';
|
|
29
|
+
export type { Attachments, DatabaseHandle, StorageAdapter } from './contract/adapter.js';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAW,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,yBAAsB,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAAuB,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAmB,CAAC;AAG5C,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,sBAAmB,CAAC;AACjG,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAkB,CAAC;AAClF,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GAChB,MAAM,sBAAmB,CAAC;AAC3B,YAAY,EACX,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,GACZ,MAAM,sBAAmB,CAAC;AAC3B,YAAY,EACX,cAAc,EACd,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,KAAK,EACL,UAAU,EACV,aAAa,EACb,OAAO,GACP,MAAM,qBAAkB,CAAC;AAC1B,YAAY,EACX,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,GACX,MAAM,2BAAwB,CAAC;AAChC,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,yBAAsB,CAAC;AAC9B,YAAY,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,oBAAoB,GACpB,MAAM,0BAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAAuB,CAAC;AAC9F,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAmB,CAAC;AAC5F,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAmB,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The migration executor.
|
|
3
|
+
*
|
|
4
|
+
* Four rules, each of which exists because the alternative loses data:
|
|
5
|
+
*
|
|
6
|
+
* - **Ascending, and pending only.** A migration whose version is at or below
|
|
7
|
+
* the recorded one has already run against this scope (FR-047, FR-049).
|
|
8
|
+
* - **One transaction per migration.** A failure unwinds that migration and
|
|
9
|
+
* nothing else, so the recorded version and the data always agree.
|
|
10
|
+
* - **The recorded version moves only on success**, inside the same
|
|
11
|
+
* transaction as the migration's own writes. Writing it separately would
|
|
12
|
+
* leave a window where a crash records a migration that did not happen.
|
|
13
|
+
* - **A failure returns no handle** (FR-050). Half-migrated data behind a
|
|
14
|
+
* working handle is the failure this whole design exists to prevent, and it
|
|
15
|
+
* is worse than being unable to open at all: the app writes to it.
|
|
16
|
+
*
|
|
17
|
+
* A retry starts from the same version rather than skipping ahead (FR-051),
|
|
18
|
+
* which is what makes a transient failure — a locked keychain, a full disk
|
|
19
|
+
* mid-migration — recoverable on the next launch instead of permanent.
|
|
20
|
+
*/
|
|
21
|
+
import type { DatabaseConfig } from '../contract/config.js';
|
|
22
|
+
import type { CollectionSchema } from '../contract/schema.js';
|
|
23
|
+
import type { Connection } from '../sqlite/connection.js';
|
|
24
|
+
export type MigrationRunContext = {
|
|
25
|
+
connection: Connection;
|
|
26
|
+
config: DatabaseConfig;
|
|
27
|
+
schemaFor(name: string): CollectionSchema;
|
|
28
|
+
now(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Called before a migration failure is raised. The executor does not own
|
|
31
|
+
* the connection, so it asks rather than closing directly — but the close
|
|
32
|
+
* has to happen before the error escapes, or a caller catching it could
|
|
33
|
+
* still be holding something usable (FR-050).
|
|
34
|
+
*/
|
|
35
|
+
closeOnFailure(): Promise<void>;
|
|
36
|
+
/** The bookkeeping tables are known to exist, so creating them is skipped (LDB-07). */
|
|
37
|
+
ledgerReady?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare function runMigrations(context: MigrationRunContext): Promise<number>;
|
|
40
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/migration/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAIzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AAK3D,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,yBAAsB,CAAC;AAUjE,MAAM,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC1C,GAAG,IAAI,MAAM,CAAC;IACd;;;;;OAKG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AA4BF,wBAAsB,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsEjF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-scope migration ledger.
|
|
3
|
+
*
|
|
4
|
+
* Per scope, not per database, and that is the whole reason FR-054 works: a
|
|
5
|
+
* scope created after a migration shipped starts at version 0 and is migrated
|
|
6
|
+
* on first open, rather than being assumed current because some other scope
|
|
7
|
+
* already ran the chain.
|
|
8
|
+
*
|
|
9
|
+
* The ledger records a **code**, never a message (FR-079). A migration that
|
|
10
|
+
* failed because a domain constraint was violated could otherwise write the
|
|
11
|
+
* offending value into a table that outlives the failure — a payload leak
|
|
12
|
+
* with a long half-life, sitting in a file the next crash report might carry.
|
|
13
|
+
*/
|
|
14
|
+
import type { MigrationOutcome } from '../contract/migration.js';
|
|
15
|
+
import type { Executor } from '../sqlite/connection.js';
|
|
16
|
+
/** Physical layout version, independent of the app's schema version. */
|
|
17
|
+
export declare const FORMAT_VERSION = 1;
|
|
18
|
+
export declare function ensureLedger(executor: Executor): Promise<void>;
|
|
19
|
+
export type RecordedVersions = {
|
|
20
|
+
/** The app's schema version this scope has been migrated to. */
|
|
21
|
+
schema: number;
|
|
22
|
+
/** The physical layout this package wrote the file with. */
|
|
23
|
+
format: number;
|
|
24
|
+
};
|
|
25
|
+
/** Both versions in one read: every open asks for them. */
|
|
26
|
+
export declare function readVersions(executor: Executor): Promise<RecordedVersions>;
|
|
27
|
+
export declare function writeSchemaVersion(executor: Executor, version: number): Promise<void>;
|
|
28
|
+
export declare function recordAttempt(executor: Executor, entry: {
|
|
29
|
+
version: number;
|
|
30
|
+
attemptedAt: number;
|
|
31
|
+
outcome: MigrationOutcome;
|
|
32
|
+
failureCode?: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../../src/migration/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAsB,CAAC;AAGrD,wEAAwE;AACxE,eAAO,MAAM,cAAc,IAAI,CAAC;AAchC,wBAAsB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWpE;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,2DAA2D;AAC3D,wBAAsB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAShF;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3F;AAED,wBAAsB,aAAa,CAClC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9F,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration chain validation, run before any migration executes (FR-053).
|
|
3
|
+
*
|
|
4
|
+
* Validating first is what stops a half-run chain from being the thing that
|
|
5
|
+
* discovers the problem. A duplicate version, a gap, or a chain that does not
|
|
6
|
+
* reach the declared `schemaVersion` are all configuration errors the
|
|
7
|
+
* developer can fix; discovering them after migration 3 of 5 has already
|
|
8
|
+
* rewritten a user's data is not.
|
|
9
|
+
*
|
|
10
|
+
* A gap is refused rather than skipped over deliberately. A user upgrading
|
|
11
|
+
* from the version inside the gap has no path across it, and opening anyway
|
|
12
|
+
* would hand them a database the code believes is current and is not.
|
|
13
|
+
*/
|
|
14
|
+
import type { DatabaseConfig } from '../contract/config.js';
|
|
15
|
+
import type { Migration } from '../contract/migration.js';
|
|
16
|
+
export declare function validateMigrationChain(config: DatabaseConfig): void;
|
|
17
|
+
/** Ascending, because the order a consumer declared them in is not a contract. */
|
|
18
|
+
export declare function orderedMigrations(config: DatabaseConfig): Migration[];
|
|
19
|
+
export declare function pendingMigrations(config: DatabaseConfig, recordedVersion: number): Migration[];
|
|
20
|
+
//# sourceMappingURL=validate-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-chain.d.ts","sourceRoot":"","sources":["../../../../src/migration/validate-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAAuB,CAAC;AAOvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAgCnE;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,CAErE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,SAAS,EAAE,CAE9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|