@vibesdotdev/storage 0.0.1 → 1.0.0-rc.3
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/LICENSE +18 -0
- package/README.md +87 -63
- package/dist/adapters/cloud-api/cloud-api.adapter.descriptor.d.ts +10 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.descriptor.js +40 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.descriptor.js.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.impl.d.ts +93 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.impl.js +437 -0
- package/dist/adapters/cloud-api/cloud-api.adapter.impl.js.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.fetch-client.d.ts +59 -0
- package/dist/adapters/cloud-api/cloud-api.fetch-client.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.fetch-client.js +357 -0
- package/dist/adapters/cloud-api/cloud-api.fetch-client.js.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.record.d.ts +85 -0
- package/dist/adapters/cloud-api/cloud-api.record.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.record.helpers.d.ts +71 -0
- package/dist/adapters/cloud-api/cloud-api.record.helpers.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.record.helpers.js +270 -0
- package/dist/adapters/cloud-api/cloud-api.record.helpers.js.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.record.js +351 -0
- package/dist/adapters/cloud-api/cloud-api.record.js.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.test-utils.d.ts +38 -0
- package/dist/adapters/cloud-api/cloud-api.test-utils.d.ts.map +1 -0
- package/dist/adapters/cloud-api/cloud-api.test-utils.js +139 -0
- package/dist/adapters/cloud-api/cloud-api.test-utils.js.map +1 -0
- package/dist/adapters/cloud-api/index.d.ts +10 -0
- package/dist/adapters/cloud-api/index.d.ts.map +1 -0
- package/dist/adapters/cloud-api/index.js +10 -0
- package/dist/adapters/cloud-api/index.js.map +1 -0
- package/dist/adapters/cloud-api/storage-adapter-cloud-api.plugin.d.ts +9 -0
- package/dist/adapters/cloud-api/storage-adapter-cloud-api.plugin.d.ts.map +1 -0
- package/dist/adapters/cloud-api/storage-adapter-cloud-api.plugin.js +21 -0
- package/dist/adapters/cloud-api/storage-adapter-cloud-api.plugin.js.map +1 -0
- package/dist/adapters/drizzle/batch-type-proof.d.ts +21 -0
- package/dist/adapters/drizzle/batch-type-proof.d.ts.map +1 -0
- package/dist/adapters/drizzle/batch-type-proof.js +2 -0
- package/dist/adapters/drizzle/batch-type-proof.js.map +1 -0
- package/dist/adapters/drizzle/canonical.adapter.descriptor.d.ts +4 -0
- package/dist/adapters/drizzle/canonical.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/drizzle/canonical.adapter.descriptor.js +29 -0
- package/dist/adapters/drizzle/canonical.adapter.descriptor.js.map +1 -0
- package/dist/adapters/drizzle/contracts.d.ts +24 -0
- package/dist/adapters/drizzle/contracts.d.ts.map +1 -0
- package/dist/adapters/drizzle/contracts.js +5 -0
- package/dist/adapters/drizzle/contracts.js.map +1 -0
- package/dist/adapters/drizzle/docs/storage.adapters.drizzle.docs.descriptor.d.ts +4 -0
- package/dist/adapters/drizzle/docs/storage.adapters.drizzle.docs.descriptor.d.ts.map +1 -0
- package/dist/adapters/drizzle/docs/storage.adapters.drizzle.docs.descriptor.js +187 -0
- package/dist/adapters/drizzle/docs/storage.adapters.drizzle.docs.descriptor.js.map +1 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.impl.d.ts +15 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.impl.d.ts.map +1 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.impl.js +59 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.impl.js.map +1 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.plugin.d.ts +5 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.plugin.d.ts.map +1 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.plugin.js +27 -0
- package/dist/adapters/drizzle/drizzle-journal.migration-format.plugin.js.map +1 -0
- package/dist/adapters/drizzle/drizzle.adapter.descriptor.d.ts +2 -0
- package/dist/adapters/drizzle/drizzle.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/drizzle/drizzle.adapter.descriptor.js +3 -0
- package/dist/adapters/drizzle/drizzle.adapter.descriptor.js.map +1 -0
- package/dist/adapters/drizzle/drizzle.adapter.impl.d.ts +37 -0
- package/dist/adapters/drizzle/drizzle.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/drizzle/drizzle.adapter.impl.js +1163 -0
- package/dist/adapters/drizzle/drizzle.adapter.impl.js.map +1 -0
- package/dist/adapters/drizzle/extensions.d.ts +5 -0
- package/dist/adapters/drizzle/extensions.d.ts.map +1 -0
- package/dist/adapters/drizzle/extensions.js +30 -0
- package/dist/adapters/drizzle/extensions.js.map +1 -0
- package/dist/adapters/drizzle/index.d.ts +12 -0
- package/dist/adapters/drizzle/index.d.ts.map +1 -0
- package/dist/adapters/drizzle/index.js +12 -0
- package/dist/adapters/drizzle/index.js.map +1 -0
- package/dist/adapters/drizzle/libsql-migrator.d.ts +23 -0
- package/dist/adapters/drizzle/libsql-migrator.d.ts.map +1 -0
- package/dist/adapters/drizzle/libsql-migrator.js +67 -0
- package/dist/adapters/drizzle/libsql-migrator.js.map +1 -0
- package/dist/adapters/drizzle/libsql.d.ts +15 -0
- package/dist/adapters/drizzle/libsql.d.ts.map +1 -0
- package/dist/adapters/drizzle/libsql.js +19 -0
- package/dist/adapters/drizzle/libsql.js.map +1 -0
- package/dist/adapters/drizzle/migration-files.d.ts +15 -0
- package/dist/adapters/drizzle/migration-files.d.ts.map +1 -0
- package/dist/adapters/drizzle/migration-files.js +54 -0
- package/dist/adapters/drizzle/migration-files.js.map +1 -0
- package/dist/adapters/drizzle/migration-statements.d.ts +7 -0
- package/dist/adapters/drizzle/migration-statements.d.ts.map +1 -0
- package/dist/adapters/drizzle/migration-statements.js +14 -0
- package/dist/adapters/drizzle/migration-statements.js.map +1 -0
- package/dist/adapters/drizzle/persistence-errors.d.ts +33 -0
- package/dist/adapters/drizzle/persistence-errors.d.ts.map +1 -0
- package/dist/adapters/drizzle/persistence-errors.js +75 -0
- package/dist/adapters/drizzle/persistence-errors.js.map +1 -0
- package/dist/adapters/drizzle/persistence-factory.d.ts +100 -0
- package/dist/adapters/drizzle/persistence-factory.d.ts.map +1 -0
- package/dist/adapters/drizzle/persistence-factory.js +391 -0
- package/dist/adapters/drizzle/persistence-factory.js.map +1 -0
- package/dist/adapters/drizzle/persistence.client.d.ts +73 -0
- package/dist/adapters/drizzle/persistence.client.d.ts.map +1 -0
- package/dist/adapters/drizzle/persistence.client.js +238 -0
- package/dist/adapters/drizzle/persistence.client.js.map +1 -0
- package/dist/adapters/drizzle/providers.d.ts +19 -0
- package/dist/adapters/drizzle/providers.d.ts.map +1 -0
- package/dist/adapters/drizzle/providers.js +62 -0
- package/dist/adapters/drizzle/providers.js.map +1 -0
- package/dist/adapters/drizzle/record-ddl.d.ts +13 -0
- package/dist/adapters/drizzle/record-ddl.d.ts.map +1 -0
- package/dist/adapters/drizzle/record-ddl.js +70 -0
- package/dist/adapters/drizzle/record-ddl.js.map +1 -0
- package/dist/adapters/drizzle/record-table.d.ts +59 -0
- package/dist/adapters/drizzle/record-table.d.ts.map +1 -0
- package/dist/adapters/drizzle/record-table.js +87 -0
- package/dist/adapters/drizzle/record-table.js.map +1 -0
- package/dist/adapters/drizzle/schemas/record-migration.d.ts +30 -0
- package/dist/adapters/drizzle/schemas/record-migration.d.ts.map +1 -0
- package/dist/adapters/drizzle/schemas/record-migration.js +12 -0
- package/dist/adapters/drizzle/schemas/record-migration.js.map +1 -0
- package/dist/adapters/drizzle/storage-adapter-drizzle.plugin.d.ts +26 -0
- package/dist/adapters/drizzle/storage-adapter-drizzle.plugin.d.ts.map +1 -0
- package/dist/adapters/drizzle/storage-adapter-drizzle.plugin.js +90 -0
- package/dist/adapters/drizzle/storage-adapter-drizzle.plugin.js.map +1 -0
- package/dist/adapters/drizzle/storage-drizzle-db.context.d.ts +53 -0
- package/dist/adapters/drizzle/storage-drizzle-db.context.d.ts.map +1 -0
- package/dist/adapters/drizzle/storage-drizzle-db.context.js +8 -0
- package/dist/adapters/drizzle/storage-drizzle-db.context.js.map +1 -0
- package/dist/adapters/drizzle/test.d.ts +60 -0
- package/dist/adapters/drizzle/test.d.ts.map +1 -0
- package/dist/adapters/drizzle/test.js +49 -0
- package/dist/adapters/drizzle/test.js.map +1 -0
- package/dist/adapters/drizzle/transforms.d.ts +42 -0
- package/dist/adapters/drizzle/transforms.d.ts.map +1 -0
- package/dist/adapters/drizzle/transforms.js +147 -0
- package/dist/adapters/drizzle/transforms.js.map +1 -0
- package/dist/adapters/filesystem/filesystem.adapter.descriptor.d.ts +13 -0
- package/dist/adapters/filesystem/filesystem.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/filesystem/filesystem.adapter.descriptor.js +34 -0
- package/dist/adapters/filesystem/filesystem.adapter.descriptor.js.map +1 -0
- package/dist/adapters/filesystem/filesystem.adapter.impl.d.ts +57 -0
- package/dist/adapters/filesystem/filesystem.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/filesystem/filesystem.adapter.impl.js +257 -0
- package/dist/adapters/filesystem/filesystem.adapter.impl.js.map +1 -0
- package/dist/adapters/filesystem/index.d.ts +10 -0
- package/dist/adapters/filesystem/index.d.ts.map +1 -0
- package/dist/adapters/filesystem/index.js +10 -0
- package/dist/adapters/filesystem/index.js.map +1 -0
- package/dist/adapters/filesystem/storage-adapter-filesystem.plugin.d.ts +11 -0
- package/dist/adapters/filesystem/storage-adapter-filesystem.plugin.d.ts.map +1 -0
- package/dist/adapters/filesystem/storage-adapter-filesystem.plugin.js +25 -0
- package/dist/adapters/filesystem/storage-adapter-filesystem.plugin.js.map +1 -0
- package/dist/adapters/fixture/fixture.adapter.descriptor.d.ts +14 -0
- package/dist/adapters/fixture/fixture.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/fixture/fixture.adapter.descriptor.js +35 -0
- package/dist/adapters/fixture/fixture.adapter.descriptor.js.map +1 -0
- package/dist/adapters/fixture/fixture.adapter.impl.d.ts +41 -0
- package/dist/adapters/fixture/fixture.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/fixture/fixture.adapter.impl.js +162 -0
- package/dist/adapters/fixture/fixture.adapter.impl.js.map +1 -0
- package/dist/adapters/fixture/index.d.ts +9 -0
- package/dist/adapters/fixture/index.d.ts.map +1 -0
- package/dist/adapters/fixture/index.js +9 -0
- package/dist/adapters/fixture/index.js.map +1 -0
- package/dist/adapters/fixture/storage-adapter-fixture.plugin.d.ts +10 -0
- package/dist/adapters/fixture/storage-adapter-fixture.plugin.d.ts.map +1 -0
- package/dist/adapters/fixture/storage-adapter-fixture.plugin.js +21 -0
- package/dist/adapters/fixture/storage-adapter-fixture.plugin.js.map +1 -0
- package/dist/adapters/idb/idb-backend.d.ts +33 -0
- package/dist/adapters/idb/idb-backend.d.ts.map +1 -0
- package/dist/adapters/idb/idb-backend.js +217 -0
- package/dist/adapters/idb/idb-backend.js.map +1 -0
- package/dist/adapters/idb/idb.adapter.descriptor.d.ts +14 -0
- package/dist/adapters/idb/idb.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/idb/idb.adapter.descriptor.js +35 -0
- package/dist/adapters/idb/idb.adapter.descriptor.js.map +1 -0
- package/dist/adapters/idb/idb.adapter.impl.d.ts +56 -0
- package/dist/adapters/idb/idb.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/idb/idb.adapter.impl.js +227 -0
- package/dist/adapters/idb/idb.adapter.impl.js.map +1 -0
- package/dist/adapters/idb/index.d.ts +10 -0
- package/dist/adapters/idb/index.d.ts.map +1 -0
- package/dist/adapters/idb/index.js +10 -0
- package/dist/adapters/idb/index.js.map +1 -0
- package/dist/adapters/idb/storage-adapter-idb.plugin.d.ts +11 -0
- package/dist/adapters/idb/storage-adapter-idb.plugin.d.ts.map +1 -0
- package/dist/adapters/idb/storage-adapter-idb.plugin.js +22 -0
- package/dist/adapters/idb/storage-adapter-idb.plugin.js.map +1 -0
- package/dist/adapters/json/filesystem-binding.d.ts +14 -0
- package/dist/adapters/json/filesystem-binding.d.ts.map +1 -0
- package/dist/adapters/json/filesystem-binding.js +7 -0
- package/dist/adapters/json/filesystem-binding.js.map +1 -0
- package/dist/adapters/json/index.d.ts +10 -0
- package/dist/adapters/json/index.d.ts.map +1 -0
- package/dist/adapters/json/index.js +10 -0
- package/dist/adapters/json/index.js.map +1 -0
- package/dist/adapters/json/json.adapter.descriptor.d.ts +10 -0
- package/dist/adapters/json/json.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/json/json.adapter.descriptor.js +38 -0
- package/dist/adapters/json/json.adapter.descriptor.js.map +1 -0
- package/dist/adapters/json/json.adapter.impl.d.ts +59 -0
- package/dist/adapters/json/json.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/json/json.adapter.impl.js +395 -0
- package/dist/adapters/json/json.adapter.impl.js.map +1 -0
- package/dist/adapters/json/storage-adapter-json.plugin.d.ts +9 -0
- package/dist/adapters/json/storage-adapter-json.plugin.d.ts.map +1 -0
- package/dist/adapters/json/storage-adapter-json.plugin.js +21 -0
- package/dist/adapters/json/storage-adapter-json.plugin.js.map +1 -0
- package/dist/adapters/localdb/index.d.ts +9 -0
- package/dist/adapters/localdb/index.d.ts.map +1 -0
- package/dist/adapters/localdb/index.js +9 -0
- package/dist/adapters/localdb/index.js.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.descriptor.d.ts +10 -0
- package/dist/adapters/localdb/localdb.adapter.descriptor.d.ts.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.descriptor.js +37 -0
- package/dist/adapters/localdb/localdb.adapter.descriptor.js.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.impl.d.ts +237 -0
- package/dist/adapters/localdb/localdb.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.impl.js +1370 -0
- package/dist/adapters/localdb/localdb.adapter.impl.js.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.loader.consumer.d.ts +2 -0
- package/dist/adapters/localdb/localdb.adapter.loader.consumer.d.ts.map +1 -0
- package/dist/adapters/localdb/localdb.adapter.loader.consumer.js +2 -0
- package/dist/adapters/localdb/localdb.adapter.loader.consumer.js.map +1 -0
- package/dist/adapters/localdb/localdb.inputs.d.ts +3 -0
- package/dist/adapters/localdb/localdb.inputs.d.ts.map +1 -0
- package/dist/adapters/localdb/localdb.inputs.js +3 -0
- package/dist/adapters/localdb/localdb.inputs.js.map +1 -0
- package/dist/adapters/localdb/migration-failure.d.ts +3 -0
- package/dist/adapters/localdb/migration-failure.d.ts.map +1 -0
- package/dist/adapters/localdb/migration-failure.js +16 -0
- package/dist/adapters/localdb/migration-failure.js.map +1 -0
- package/dist/adapters/localdb/outcome.d.ts +13 -0
- package/dist/adapters/localdb/outcome.d.ts.map +1 -0
- package/dist/adapters/localdb/outcome.js +12 -0
- package/dist/adapters/localdb/outcome.js.map +1 -0
- package/dist/adapters/localdb/repository-query.d.ts +19 -0
- package/dist/adapters/localdb/repository-query.d.ts.map +1 -0
- package/dist/adapters/localdb/repository-query.js +127 -0
- package/dist/adapters/localdb/repository-query.js.map +1 -0
- package/dist/adapters/localdb/storage-adapter-localdb.plugin.d.ts +14 -0
- package/dist/adapters/localdb/storage-adapter-localdb.plugin.d.ts.map +1 -0
- package/dist/adapters/localdb/storage-adapter-localdb.plugin.js +30 -0
- package/dist/adapters/localdb/storage-adapter-localdb.plugin.js.map +1 -0
- package/dist/adapters/memory/index.d.ts +9 -0
- package/dist/adapters/memory/index.d.ts.map +1 -0
- package/dist/adapters/memory/index.js +9 -0
- package/dist/adapters/memory/index.js.map +1 -0
- package/dist/adapters/memory/memory-root-store.d.ts +20 -0
- package/dist/adapters/memory/memory-root-store.d.ts.map +1 -0
- package/dist/adapters/memory/memory-root-store.js +49 -0
- package/dist/adapters/memory/memory-root-store.js.map +1 -0
- package/dist/adapters/memory/memory.adapter.impl.d.ts +61 -0
- package/dist/adapters/memory/memory.adapter.impl.d.ts.map +1 -0
- package/dist/adapters/memory/memory.adapter.impl.js +718 -0
- package/dist/adapters/memory/memory.adapter.impl.js.map +1 -0
- package/dist/adapters/memory/memory.adapter.storage-adapter-memory.descriptor.d.ts +10 -0
- package/dist/adapters/memory/memory.adapter.storage-adapter-memory.descriptor.d.ts.map +1 -0
- package/dist/adapters/memory/memory.adapter.storage-adapter-memory.descriptor.js +37 -0
- package/dist/adapters/memory/memory.adapter.storage-adapter-memory.descriptor.js.map +1 -0
- package/dist/adapters/memory/storage-adapter-memory.plugin.d.ts +9 -0
- package/dist/adapters/memory/storage-adapter-memory.plugin.d.ts.map +1 -0
- package/dist/adapters/memory/storage-adapter-memory.plugin.js +44 -0
- package/dist/adapters/memory/storage-adapter-memory.plugin.js.map +1 -0
- package/dist/adapters/parse-adapter-input.d.ts +22 -0
- package/dist/adapters/parse-adapter-input.d.ts.map +1 -0
- package/dist/adapters/parse-adapter-input.js +36 -0
- package/dist/adapters/parse-adapter-input.js.map +1 -0
- package/dist/adapters/select-adapter.d.ts +36 -0
- package/dist/adapters/select-adapter.d.ts.map +1 -0
- package/dist/adapters/select-adapter.js +88 -0
- package/dist/adapters/select-adapter.js.map +1 -0
- package/dist/adapters/validate-for-persist.d.ts +21 -0
- package/dist/adapters/validate-for-persist.d.ts.map +1 -0
- package/dist/adapters/validate-for-persist.js +36 -0
- package/dist/adapters/validate-for-persist.js.map +1 -0
- package/dist/backup/backup.plugin.d.ts +276 -0
- package/dist/backup/backup.plugin.d.ts.map +1 -0
- package/dist/backup/backup.plugin.js +72 -0
- package/dist/backup/backup.plugin.js.map +1 -0
- package/dist/backup/channels/backup.channel.d.ts +21 -0
- package/dist/backup/channels/backup.channel.d.ts.map +1 -0
- package/dist/backup/channels/backup.channel.js +89 -0
- package/dist/backup/channels/backup.channel.js.map +1 -0
- package/dist/backup/config/storage.backup.config.descriptor.d.ts +57 -0
- package/dist/backup/config/storage.backup.config.descriptor.d.ts.map +1 -0
- package/dist/backup/config/storage.backup.config.descriptor.js +53 -0
- package/dist/backup/config/storage.backup.config.descriptor.js.map +1 -0
- package/dist/backup/core/hash.d.ts +8 -0
- package/dist/backup/core/hash.d.ts.map +1 -0
- package/dist/backup/core/hash.js +10 -0
- package/dist/backup/core/hash.js.map +1 -0
- package/dist/backup/core/homes.d.ts +13 -0
- package/dist/backup/core/homes.d.ts.map +1 -0
- package/dist/backup/core/homes.js +54 -0
- package/dist/backup/core/homes.js.map +1 -0
- package/dist/backup/core/index.d.ts +17 -0
- package/dist/backup/core/index.d.ts.map +1 -0
- package/dist/backup/core/index.js +12 -0
- package/dist/backup/core/index.js.map +1 -0
- package/dist/backup/core/io.d.ts +76 -0
- package/dist/backup/core/io.d.ts.map +1 -0
- package/dist/backup/core/io.js +177 -0
- package/dist/backup/core/io.js.map +1 -0
- package/dist/backup/core/paths.d.ts +50 -0
- package/dist/backup/core/paths.d.ts.map +1 -0
- package/dist/backup/core/paths.js +75 -0
- package/dist/backup/core/paths.js.map +1 -0
- package/dist/backup/core/readiness.d.ts +9 -0
- package/dist/backup/core/readiness.d.ts.map +1 -0
- package/dist/backup/core/readiness.js +104 -0
- package/dist/backup/core/readiness.js.map +1 -0
- package/dist/backup/core/recovery.d.ts +11 -0
- package/dist/backup/core/recovery.d.ts.map +1 -0
- package/dist/backup/core/recovery.js +75 -0
- package/dist/backup/core/recovery.js.map +1 -0
- package/dist/backup/core/registry.d.ts +13 -0
- package/dist/backup/core/registry.d.ts.map +1 -0
- package/dist/backup/core/registry.js +18 -0
- package/dist/backup/core/registry.js.map +1 -0
- package/dist/backup/core/restore.d.ts +36 -0
- package/dist/backup/core/restore.d.ts.map +1 -0
- package/dist/backup/core/restore.js +280 -0
- package/dist/backup/core/restore.js.map +1 -0
- package/dist/backup/core/rotate.d.ts +19 -0
- package/dist/backup/core/rotate.d.ts.map +1 -0
- package/dist/backup/core/rotate.js +153 -0
- package/dist/backup/core/rotate.js.map +1 -0
- package/dist/backup/core/rotation.d.ts +19 -0
- package/dist/backup/core/rotation.d.ts.map +1 -0
- package/dist/backup/core/rotation.js +100 -0
- package/dist/backup/core/rotation.js.map +1 -0
- package/dist/backup/core/snapshot.d.ts +45 -0
- package/dist/backup/core/snapshot.d.ts.map +1 -0
- package/dist/backup/core/snapshot.js +217 -0
- package/dist/backup/core/snapshot.js.map +1 -0
- package/dist/backup/docs/backup.disaster-recovery.docs.descriptor.d.ts +19 -0
- package/dist/backup/docs/backup.disaster-recovery.docs.descriptor.d.ts.map +1 -0
- package/dist/backup/docs/backup.disaster-recovery.docs.descriptor.js +42 -0
- package/dist/backup/docs/backup.disaster-recovery.docs.descriptor.js.map +1 -0
- package/dist/backup/index.d.ts +19 -0
- package/dist/backup/index.d.ts.map +1 -0
- package/dist/backup/index.js +16 -0
- package/dist/backup/index.js.map +1 -0
- package/dist/backup/jobs/backup.snapshot.descriptor.d.ts +95 -0
- package/dist/backup/jobs/backup.snapshot.descriptor.d.ts.map +1 -0
- package/dist/backup/jobs/backup.snapshot.descriptor.js +33 -0
- package/dist/backup/jobs/backup.snapshot.descriptor.js.map +1 -0
- package/dist/backup/jobs/backup.snapshot.impl.d.ts +59 -0
- package/dist/backup/jobs/backup.snapshot.impl.d.ts.map +1 -0
- package/dist/backup/jobs/backup.snapshot.impl.js +393 -0
- package/dist/backup/jobs/backup.snapshot.impl.js.map +1 -0
- package/dist/backup/jobs/backup.snapshot.schema.d.ts +3 -0
- package/dist/backup/jobs/backup.snapshot.schema.d.ts.map +1 -0
- package/dist/backup/jobs/backup.snapshot.schema.js +3 -0
- package/dist/backup/jobs/backup.snapshot.schema.js.map +1 -0
- package/dist/backup/kinds/backup-preflight.kind.d.ts +16 -0
- package/dist/backup/kinds/backup-preflight.kind.d.ts.map +1 -0
- package/dist/backup/kinds/backup-preflight.kind.js +27 -0
- package/dist/backup/kinds/backup-preflight.kind.js.map +1 -0
- package/dist/backup/kinds/backup-recovery-plan.kind.d.ts +11 -0
- package/dist/backup/kinds/backup-recovery-plan.kind.d.ts.map +1 -0
- package/dist/backup/kinds/backup-recovery-plan.kind.js +16 -0
- package/dist/backup/kinds/backup-recovery-plan.kind.js.map +1 -0
- package/dist/backup/kinds/backup-target.kind.d.ts +16 -0
- package/dist/backup/kinds/backup-target.kind.d.ts.map +1 -0
- package/dist/backup/kinds/backup-target.kind.js +21 -0
- package/dist/backup/kinds/backup-target.kind.js.map +1 -0
- package/dist/backup/schemas/core.d.ts +169 -0
- package/dist/backup/schemas/core.d.ts.map +1 -0
- package/dist/backup/schemas/core.js +117 -0
- package/dist/backup/schemas/core.js.map +1 -0
- package/dist/backup/schemas/disaster-recovery.d.ts +512 -0
- package/dist/backup/schemas/disaster-recovery.d.ts.map +1 -0
- package/dist/backup/schemas/disaster-recovery.js +410 -0
- package/dist/backup/schemas/disaster-recovery.js.map +1 -0
- package/dist/backup/schemas/index.d.ts +10 -0
- package/dist/backup/schemas/index.d.ts.map +1 -0
- package/dist/backup/schemas/index.js +10 -0
- package/dist/backup/schemas/index.js.map +1 -0
- package/dist/backup/schemas/job.d.ts +102 -0
- package/dist/backup/schemas/job.d.ts.map +1 -0
- package/dist/backup/schemas/job.js +47 -0
- package/dist/backup/schemas/job.js.map +1 -0
- package/dist/backup/schemas/preflight.d.ts +38 -0
- package/dist/backup/schemas/preflight.d.ts.map +1 -0
- package/dist/backup/schemas/preflight.js +21 -0
- package/dist/backup/schemas/preflight.js.map +1 -0
- package/dist/backup/schemas/snapshot.d.ts +110 -0
- package/dist/backup/schemas/snapshot.d.ts.map +1 -0
- package/dist/backup/schemas/snapshot.js +84 -0
- package/dist/backup/schemas/snapshot.js.map +1 -0
- package/dist/backup/schemas/target.d.ts +95 -0
- package/dist/backup/schemas/target.d.ts.map +1 -0
- package/dist/backup/schemas/target.js +105 -0
- package/dist/backup/schemas/target.js.map +1 -0
- package/dist/backup/storage/snapshot.record.descriptor.d.ts +10 -0
- package/dist/backup/storage/snapshot.record.descriptor.d.ts.map +1 -0
- package/dist/backup/storage/snapshot.record.descriptor.js +41 -0
- package/dist/backup/storage/snapshot.record.descriptor.js.map +1 -0
- package/dist/backup/targets/awareness-bus.target.descriptor.d.ts +10 -0
- package/dist/backup/targets/awareness-bus.target.descriptor.d.ts.map +1 -0
- package/dist/backup/targets/awareness-bus.target.descriptor.js +32 -0
- package/dist/backup/targets/awareness-bus.target.descriptor.js.map +1 -0
- package/dist/backup/targets/presence-identity.target.descriptor.d.ts +10 -0
- package/dist/backup/targets/presence-identity.target.descriptor.d.ts.map +1 -0
- package/dist/backup/targets/presence-identity.target.descriptor.js +40 -0
- package/dist/backup/targets/presence-identity.target.descriptor.js.map +1 -0
- package/dist/backup/targets/presence-inner.target.descriptor.d.ts +10 -0
- package/dist/backup/targets/presence-inner.target.descriptor.d.ts.map +1 -0
- package/dist/backup/targets/presence-inner.target.descriptor.js +36 -0
- package/dist/backup/targets/presence-inner.target.descriptor.js.map +1 -0
- package/dist/backup/targets/storage-records.target.descriptor.d.ts +16 -0
- package/dist/backup/targets/storage-records.target.descriptor.d.ts.map +1 -0
- package/dist/backup/targets/storage-records.target.descriptor.js +38 -0
- package/dist/backup/targets/storage-records.target.descriptor.js.map +1 -0
- package/dist/bridge/index.d.ts +2 -2
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js +1 -1
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/storage-kind-bridge.d.ts +13 -2
- package/dist/bridge/storage-kind-bridge.d.ts.map +1 -1
- package/dist/bridge/storage-kind-bridge.js +72 -69
- package/dist/bridge/storage-kind-bridge.js.map +1 -1
- package/dist/bridge/types.d.ts +4 -3
- package/dist/bridge/types.d.ts.map +1 -1
- package/dist/cli/backup/backup.cli-group.descriptor.d.ts +9 -0
- package/dist/cli/backup/backup.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/backup/backup.cli-group.descriptor.js +16 -0
- package/dist/cli/backup/backup.cli-group.descriptor.js.map +1 -0
- package/dist/cli/backup/commands/backup.now.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/backup/commands/backup.now.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.now.cli-command.descriptor.js +24 -0
- package/dist/cli/backup/commands/backup.now.cli-command.descriptor.js.map +1 -0
- package/dist/cli/backup/commands/backup.now.cli-command.impl.d.ts +26 -0
- package/dist/cli/backup/commands/backup.now.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.now.cli-command.impl.js +61 -0
- package/dist/cli/backup/commands/backup.now.cli-command.impl.js.map +1 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.descriptor.js +24 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.descriptor.js.map +1 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.impl.d.ts +23 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.impl.js +50 -0
- package/dist/cli/backup/commands/backup.restore.cli-command.impl.js.map +1 -0
- package/dist/cli/backup/commands/backup.status.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/backup/commands/backup.status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.status.cli-command.descriptor.js +19 -0
- package/dist/cli/backup/commands/backup.status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/backup/commands/backup.status.cli-command.impl.d.ts +21 -0
- package/dist/cli/backup/commands/backup.status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.status.cli-command.impl.js +76 -0
- package/dist/cli/backup/commands/backup.status.cli-command.impl.js.map +1 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.descriptor.js +20 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.descriptor.js.map +1 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.impl.d.ts +20 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.impl.js +48 -0
- package/dist/cli/backup/commands/backup.verify.cli-command.impl.js.map +1 -0
- package/dist/cli/backup/plugin.d.ts +5 -0
- package/dist/cli/backup/plugin.d.ts.map +1 -0
- package/dist/cli/backup/plugin.js +30 -0
- package/dist/cli/backup/plugin.js.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts +1 -1
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts.map +1 -1
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts +8 -1
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/list/storage.list.cli-command.impl.js +17 -8
- package/dist/cli/commands/list/storage.list.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts +1 -1
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts.map +1 -1
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts +9 -1
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js +110 -76
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts +1 -1
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts.map +1 -1
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts +9 -1
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js +131 -108
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts +1 -1
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts.map +1 -1
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts +12 -1
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js +34 -26
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts +1 -1
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts.map +1 -1
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts +11 -1
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js +89 -42
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/sync/sync-command-input.d.ts +20 -0
- package/dist/cli/commands/sync/sync-command-input.d.ts.map +1 -0
- package/dist/cli/commands/sync/sync-command-input.js +20 -0
- package/dist/cli/commands/sync/sync-command-input.js.map +1 -0
- package/dist/cli/gc/commands/gc.run.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/gc/commands/gc.run.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/gc/commands/gc.run.cli-command.descriptor.js +20 -0
- package/dist/cli/gc/commands/gc.run.cli-command.descriptor.js.map +1 -0
- package/dist/cli/gc/commands/gc.run.cli-command.impl.d.ts +24 -0
- package/dist/cli/gc/commands/gc.run.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/gc/commands/gc.run.cli-command.impl.js +104 -0
- package/dist/cli/gc/commands/gc.run.cli-command.impl.js.map +1 -0
- package/dist/cli/gc/commands/gc.status.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/gc/commands/gc.status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/gc/commands/gc.status.cli-command.descriptor.js +19 -0
- package/dist/cli/gc/commands/gc.status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/gc/commands/gc.status.cli-command.impl.d.ts +21 -0
- package/dist/cli/gc/commands/gc.status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/gc/commands/gc.status.cli-command.impl.js +74 -0
- package/dist/cli/gc/commands/gc.status.cli-command.impl.js.map +1 -0
- package/dist/cli/gc/gc.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/gc/gc.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/gc/gc.cli-group.descriptor.js +11 -0
- package/dist/cli/gc/gc.cli-group.descriptor.js.map +1 -0
- package/dist/cli/gc/plugin.d.ts +5 -0
- package/dist/cli/gc/plugin.d.ts.map +1 -0
- package/dist/cli/gc/plugin.js +28 -0
- package/dist/cli/gc/plugin.js.map +1 -0
- package/dist/cli/plugin.d.ts +17 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +51 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/storage.cli-group.descriptor.d.ts +1 -1
- package/dist/cli/storage.cli-group.descriptor.d.ts.map +1 -1
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts +1 -1
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts.map +1 -1
- package/dist/cli/types.d.ts +4 -20
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +3 -4
- package/dist/cli/types.js.map +1 -1
- package/dist/client/browse-adapter.d.ts +49 -0
- package/dist/client/browse-adapter.d.ts.map +1 -0
- package/dist/client/browse-adapter.js +99 -0
- package/dist/client/browse-adapter.js.map +1 -0
- package/dist/client/diagnose-adapter.d.ts +9 -0
- package/dist/client/diagnose-adapter.d.ts.map +1 -0
- package/dist/client/diagnose-adapter.js +9 -0
- package/dist/client/diagnose-adapter.js.map +1 -0
- package/dist/client/index.d.ts +7 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/list-browsable-adapters.d.ts +4 -3
- package/dist/client/list-browsable-adapters.d.ts.map +1 -1
- package/dist/client/list-browsable-adapters.js +3 -8
- package/dist/client/list-browsable-adapters.js.map +1 -1
- package/dist/client/object-adapter.d.ts +33 -0
- package/dist/client/object-adapter.d.ts.map +1 -0
- package/dist/client/object-adapter.js +45 -0
- package/dist/client/object-adapter.js.map +1 -0
- package/dist/client/storage-explorer-capability.d.ts +81 -0
- package/dist/client/storage-explorer-capability.d.ts.map +1 -0
- package/dist/client/storage-explorer-capability.impl.worker.d.ts +23 -0
- package/dist/client/storage-explorer-capability.impl.worker.d.ts.map +1 -0
- package/dist/client/storage-explorer-capability.impl.worker.js +124 -0
- package/dist/client/storage-explorer-capability.impl.worker.js.map +1 -0
- package/dist/client/storage-explorer-capability.js +125 -0
- package/dist/client/storage-explorer-capability.js.map +1 -0
- package/dist/client/storage-failure.d.ts +43 -0
- package/dist/client/storage-failure.d.ts.map +1 -0
- package/dist/client/storage-failure.js +100 -0
- package/dist/client/storage-failure.js.map +1 -0
- package/dist/daemon/commands/browse.d.ts +29 -0
- package/dist/daemon/commands/browse.d.ts.map +1 -0
- package/dist/daemon/commands/browse.js +91 -0
- package/dist/daemon/commands/browse.js.map +1 -0
- package/dist/daemon/commands/sync.d.ts +1 -1
- package/dist/daemon/commands/sync.d.ts.map +1 -1
- package/dist/daemon/commands/sync.js +60 -52
- package/dist/daemon/commands/sync.js.map +1 -1
- package/dist/docs/records.docs.descriptor.d.ts +1 -1
- package/dist/docs/records.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/records.docs.descriptor.js +136 -151
- package/dist/docs/records.docs.descriptor.js.map +1 -1
- package/dist/docs/storage.adapters.docs.descriptor.d.ts +4 -0
- package/dist/docs/storage.adapters.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/storage.adapters.docs.descriptor.js +175 -0
- package/dist/docs/storage.adapters.docs.descriptor.js.map +1 -0
- package/dist/docs/storage.browse.docs.descriptor.d.ts +4 -0
- package/dist/docs/storage.browse.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/storage.browse.docs.descriptor.js +74 -0
- package/dist/docs/storage.browse.docs.descriptor.js.map +1 -0
- package/dist/docs/storage.docs.descriptor.d.ts +4 -0
- package/dist/docs/storage.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/storage.docs.descriptor.js +51 -0
- package/dist/docs/storage.docs.descriptor.js.map +1 -0
- package/dist/docs/storage.manifests.docs.descriptor.d.ts +4 -0
- package/dist/docs/storage.manifests.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/{manifests.docs.descriptor.js → storage.manifests.docs.descriptor.js} +69 -34
- package/dist/docs/storage.manifests.docs.descriptor.js.map +1 -0
- package/dist/docs/sync.docs.descriptor.d.ts +1 -1
- package/dist/docs/sync.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/sync.docs.descriptor.js +140 -150
- package/dist/docs/sync.docs.descriptor.js.map +1 -1
- package/dist/docs/transform.docs.descriptor.d.ts +4 -0
- package/dist/docs/transform.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/transform.docs.descriptor.js +134 -0
- package/dist/docs/transform.docs.descriptor.js.map +1 -0
- package/dist/host-files.d.ts +35 -0
- package/dist/host-files.d.ts.map +1 -0
- package/dist/host-files.js +60 -0
- package/dist/host-files.js.map +1 -0
- package/dist/index.d.ts +15 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/interfaces/adapter.d.ts +166 -47
- package/dist/interfaces/adapter.d.ts.map +1 -1
- package/dist/interfaces/document-store.d.ts +41 -1
- package/dist/interfaces/document-store.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +8 -7
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/index.js +9 -7
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/object-store.d.ts +54 -0
- package/dist/interfaces/object-store.d.ts.map +1 -0
- package/dist/interfaces/object-store.js +13 -0
- package/dist/interfaces/object-store.js.map +1 -0
- package/dist/interfaces/query-builder.d.ts +2 -30
- package/dist/interfaces/query-builder.d.ts.map +1 -1
- package/dist/interfaces/query-builder.js +0 -9
- package/dist/interfaces/query-builder.js.map +1 -1
- package/dist/interfaces/record/index.d.ts +1 -1
- package/dist/interfaces/record/index.d.ts.map +1 -1
- package/dist/interfaces/record/index.js +1 -1
- package/dist/interfaces/record/index.js.map +1 -1
- package/dist/interfaces/record/interface.d.ts +30 -9
- package/dist/interfaces/record/interface.d.ts.map +1 -1
- package/dist/interfaces/schema/index.d.ts +2 -2
- package/dist/interfaces/schema/index.d.ts.map +1 -1
- package/dist/interfaces/schema/index.js +2 -2
- package/dist/interfaces/schema/index.js.map +1 -1
- package/dist/interfaces/schema/schema-interface.d.ts +9 -8
- package/dist/interfaces/schema/schema-interface.d.ts.map +1 -1
- package/dist/interfaces/schema/table-interface.d.ts +4 -3
- package/dist/interfaces/schema/table-interface.d.ts.map +1 -1
- package/dist/interfaces/storage-consumer-fs.d.ts +25 -27
- package/dist/interfaces/storage-consumer-fs.d.ts.map +1 -1
- package/dist/interfaces/storage-consumer-fs.js +29 -30
- package/dist/interfaces/storage-consumer-fs.js.map +1 -1
- package/dist/manifest/base.d.ts +104 -22
- package/dist/manifest/base.d.ts.map +1 -1
- package/dist/manifest/base.js +393 -151
- package/dist/manifest/base.js.map +1 -1
- package/dist/manifest/cloud-sync.browser.d.ts +3 -0
- package/dist/manifest/cloud-sync.browser.d.ts.map +1 -0
- package/dist/manifest/cloud-sync.browser.js +3 -0
- package/dist/manifest/cloud-sync.browser.js.map +1 -0
- package/dist/manifest/cloud-sync.consumer.d.ts +2 -6
- package/dist/manifest/cloud-sync.consumer.d.ts.map +1 -1
- package/dist/manifest/cloud-sync.consumer.js +2 -81
- package/dist/manifest/cloud-sync.consumer.js.map +1 -1
- package/dist/manifest/cloud-sync.core.d.ts +30 -0
- package/dist/manifest/cloud-sync.core.d.ts.map +1 -0
- package/dist/manifest/cloud-sync.core.js +67 -0
- package/dist/manifest/cloud-sync.core.js.map +1 -0
- package/dist/manifest/cloud-sync.d.ts +3 -0
- package/dist/manifest/cloud-sync.d.ts.map +1 -0
- package/dist/manifest/cloud-sync.js +8 -0
- package/dist/manifest/cloud-sync.js.map +1 -0
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/source-policy.d.ts +21 -4
- package/dist/manifest/source-policy.d.ts.map +1 -1
- package/dist/manifest/source-policy.js +48 -50
- package/dist/manifest/source-policy.js.map +1 -1
- package/dist/migration-format/index.d.ts +3 -0
- package/dist/migration-format/index.d.ts.map +1 -0
- package/dist/migration-format/index.js +3 -0
- package/dist/migration-format/index.js.map +1 -0
- package/dist/migration-format/migration-format.kind.d.ts +5 -0
- package/dist/migration-format/migration-format.kind.d.ts.map +1 -0
- package/dist/migration-format/migration-format.kind.js +18 -0
- package/dist/migration-format/migration-format.kind.js.map +1 -0
- package/dist/path-format.d.ts +4 -0
- package/dist/path-format.d.ts.map +1 -0
- package/dist/path-format.js +71 -0
- package/dist/path-format.js.map +1 -0
- package/dist/path-policy.d.ts +28 -0
- package/dist/path-policy.d.ts.map +1 -0
- package/dist/path-policy.js +123 -0
- package/dist/path-policy.js.map +1 -0
- package/dist/paths.d.ts +14 -5
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +17 -150
- package/dist/paths.js.map +1 -1
- package/dist/policy/context.d.ts +3 -2
- package/dist/policy/context.d.ts.map +1 -1
- package/dist/policy/context.js +13 -16
- package/dist/policy/context.js.map +1 -1
- package/dist/policy/index.d.ts +3 -3
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +3 -3
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/overrides.d.ts +5 -39
- package/dist/policy/overrides.d.ts.map +1 -1
- package/dist/policy/overrides.js +19 -24
- package/dist/policy/overrides.js.map +1 -1
- package/dist/policy/persistence.d.ts +2 -35
- package/dist/policy/persistence.d.ts.map +1 -1
- package/dist/policy/persistence.js +2 -12
- package/dist/policy/persistence.js.map +1 -1
- package/dist/policy/types.d.ts +5 -5
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/record/array-fields.d.ts +15 -0
- package/dist/record/array-fields.d.ts.map +1 -0
- package/dist/record/array-fields.js +80 -0
- package/dist/record/array-fields.js.map +1 -0
- package/dist/record/atomic.d.ts +5 -0
- package/dist/record/atomic.d.ts.map +1 -0
- package/dist/record/atomic.js +10 -0
- package/dist/record/atomic.js.map +1 -0
- package/dist/record/base.d.ts +177 -39
- package/dist/record/base.d.ts.map +1 -1
- package/dist/record/base.js +1708 -525
- package/dist/record/base.js.map +1 -1
- package/dist/record/columns.d.ts +23 -0
- package/dist/record/columns.d.ts.map +1 -0
- package/dist/record/columns.js +161 -0
- package/dist/record/columns.js.map +1 -0
- package/dist/record/delivery.d.ts +57 -0
- package/dist/record/delivery.d.ts.map +1 -0
- package/dist/record/delivery.js +262 -0
- package/dist/record/delivery.js.map +1 -0
- package/dist/record/events.js +1 -1
- package/dist/record/events.js.map +1 -1
- package/dist/record/extensions.d.ts +17 -14
- package/dist/record/extensions.d.ts.map +1 -1
- package/dist/record/extensions.js +79 -53
- package/dist/record/extensions.js.map +1 -1
- package/dist/record/failure-condition.d.ts +14 -0
- package/dist/record/failure-condition.d.ts.map +1 -0
- package/dist/record/failure-condition.js +17 -0
- package/dist/record/failure-condition.js.map +1 -0
- package/dist/record/index.d.ts +5 -1
- package/dist/record/index.d.ts.map +1 -1
- package/dist/record/index.js +5 -1
- package/dist/record/index.js.map +1 -1
- package/dist/record/merge.d.ts +21 -0
- package/dist/record/merge.d.ts.map +1 -0
- package/dist/record/merge.js +147 -0
- package/dist/record/merge.js.map +1 -0
- package/dist/record/relations.d.ts +23 -0
- package/dist/record/relations.d.ts.map +1 -0
- package/dist/record/relations.js +164 -0
- package/dist/record/relations.js.map +1 -0
- package/dist/record/revision.d.ts +5 -0
- package/dist/record/revision.d.ts.map +1 -0
- package/dist/record/revision.js +11 -0
- package/dist/record/revision.js.map +1 -0
- package/dist/record/schema-coordination.client.d.ts +16 -0
- package/dist/record/schema-coordination.client.d.ts.map +1 -0
- package/dist/record/schema-coordination.client.js +59 -0
- package/dist/record/schema-coordination.client.js.map +1 -0
- package/dist/record/storage.record-delivery.reconcile.descriptor.d.ts +74 -0
- package/dist/record/storage.record-delivery.reconcile.descriptor.d.ts.map +1 -0
- package/dist/record/storage.record-delivery.reconcile.descriptor.js +54 -0
- package/dist/record/storage.record-delivery.reconcile.descriptor.js.map +1 -0
- package/dist/record/storage.record-delivery.reconcile.impl.d.ts +22 -0
- package/dist/record/storage.record-delivery.reconcile.impl.d.ts.map +1 -0
- package/dist/record/storage.record-delivery.reconcile.impl.js +52 -0
- package/dist/record/storage.record-delivery.reconcile.impl.js.map +1 -0
- package/dist/resolver/storage-backed-resolver.d.ts +12 -5
- package/dist/resolver/storage-backed-resolver.d.ts.map +1 -1
- package/dist/resolver/storage-backed-resolver.js +129 -48
- package/dist/resolver/storage-backed-resolver.js.map +1 -1
- package/dist/retention/capacity.d.ts +37 -0
- package/dist/retention/capacity.d.ts.map +1 -0
- package/dist/retention/capacity.js +71 -0
- package/dist/retention/capacity.js.map +1 -0
- package/dist/retention/catalog-chunks.d.ts +11 -0
- package/dist/retention/catalog-chunks.d.ts.map +1 -0
- package/dist/retention/catalog-chunks.js +62 -0
- package/dist/retention/catalog-chunks.js.map +1 -0
- package/dist/retention/reclaim.d.ts +59 -0
- package/dist/retention/reclaim.d.ts.map +1 -0
- package/dist/retention/reclaim.js +259 -0
- package/dist/retention/reclaim.js.map +1 -0
- package/dist/retention/roots.d.ts +141 -0
- package/dist/retention/roots.d.ts.map +1 -0
- package/dist/retention/roots.js +223 -0
- package/dist/retention/roots.js.map +1 -0
- package/dist/retention/scratch-custody.d.ts +40 -0
- package/dist/retention/scratch-custody.d.ts.map +1 -0
- package/dist/retention/scratch-custody.js +15 -0
- package/dist/retention/scratch-custody.js.map +1 -0
- package/dist/retention/startup-sweep.d.ts +57 -0
- package/dist/retention/startup-sweep.d.ts.map +1 -0
- package/dist/retention/startup-sweep.js +137 -0
- package/dist/retention/startup-sweep.js.map +1 -0
- package/dist/retention/storage.retention-sweep.descriptor.d.ts +82 -0
- package/dist/retention/storage.retention-sweep.descriptor.d.ts.map +1 -0
- package/dist/retention/storage.retention-sweep.descriptor.js +42 -0
- package/dist/retention/storage.retention-sweep.descriptor.js.map +1 -0
- package/dist/retention/storage.retention-sweep.impl.d.ts +22 -0
- package/dist/retention/storage.retention-sweep.impl.d.ts.map +1 -0
- package/dist/retention/storage.retention-sweep.impl.js +78 -0
- package/dist/retention/storage.retention-sweep.impl.js.map +1 -0
- package/dist/retention/storage.retention-sweep.schema.d.ts +3 -0
- package/dist/retention/storage.retention-sweep.schema.d.ts.map +1 -0
- package/dist/retention/storage.retention-sweep.schema.js +3 -0
- package/dist/retention/storage.retention-sweep.schema.js.map +1 -0
- package/dist/retention/sweep.d.ts +31 -0
- package/dist/retention/sweep.d.ts.map +1 -0
- package/dist/retention/sweep.js +190 -0
- package/dist/retention/sweep.js.map +1 -0
- package/dist/retention/tmp-scratch.d.ts +35 -0
- package/dist/retention/tmp-scratch.d.ts.map +1 -0
- package/dist/retention/tmp-scratch.js +149 -0
- package/dist/retention/tmp-scratch.js.map +1 -0
- package/dist/schemas/adapter-config.d.ts +42 -0
- package/dist/schemas/adapter-config.d.ts.map +1 -0
- package/dist/schemas/adapter-config.js +21 -0
- package/dist/schemas/adapter-config.js.map +1 -0
- package/dist/schemas/adapter-configuration-diagnostic.d.ts +35 -0
- package/dist/schemas/adapter-configuration-diagnostic.d.ts.map +1 -0
- package/dist/schemas/adapter-configuration-diagnostic.js +30 -0
- package/dist/schemas/adapter-configuration-diagnostic.js.map +1 -0
- package/dist/schemas/adapter-descriptor.d.ts +215 -5
- package/dist/schemas/adapter-descriptor.d.ts.map +1 -1
- package/dist/schemas/adapter-descriptor.js +158 -4
- package/dist/schemas/adapter-descriptor.js.map +1 -1
- package/dist/schemas/cloud-api.d.ts +99 -0
- package/dist/schemas/cloud-api.d.ts.map +1 -0
- package/dist/schemas/cloud-api.js +55 -0
- package/dist/schemas/cloud-api.js.map +1 -0
- package/dist/schemas/cloud-endpoints.d.ts +25 -0
- package/dist/schemas/cloud-endpoints.d.ts.map +1 -0
- package/dist/schemas/cloud-endpoints.js +38 -0
- package/dist/schemas/cloud-endpoints.js.map +1 -0
- package/dist/schemas/document-identity.d.ts +40 -0
- package/dist/schemas/document-identity.d.ts.map +1 -0
- package/dist/schemas/document-identity.js +21 -0
- package/dist/schemas/document-identity.js.map +1 -0
- package/dist/schemas/document-revision.d.ts +37 -0
- package/dist/schemas/document-revision.d.ts.map +1 -0
- package/dist/schemas/document-revision.js +14 -0
- package/dist/schemas/document-revision.js.map +1 -0
- package/dist/schemas/drizzle/config.d.ts +83 -0
- package/dist/schemas/drizzle/config.d.ts.map +1 -0
- package/dist/schemas/drizzle/config.js +55 -0
- package/dist/schemas/drizzle/config.js.map +1 -0
- package/dist/schemas/drizzle/connection.d.ts +41 -0
- package/dist/schemas/drizzle/connection.d.ts.map +1 -0
- package/dist/schemas/drizzle/connection.js +23 -0
- package/dist/schemas/drizzle/connection.js.map +1 -0
- package/dist/schemas/drizzle/journal-read.d.ts +11 -0
- package/dist/schemas/drizzle/journal-read.d.ts.map +1 -0
- package/dist/schemas/drizzle/journal-read.js +2 -0
- package/dist/schemas/drizzle/journal-read.js.map +1 -0
- package/dist/schemas/drizzle/persistence-config.d.ts +39 -0
- package/dist/schemas/drizzle/persistence-config.d.ts.map +1 -0
- package/dist/schemas/drizzle/persistence-config.js +71 -0
- package/dist/schemas/drizzle/persistence-config.js.map +1 -0
- package/dist/schemas/drizzle/persistence.d.ts +102 -0
- package/dist/schemas/drizzle/persistence.d.ts.map +1 -0
- package/dist/schemas/drizzle/persistence.js +28 -0
- package/dist/schemas/drizzle/persistence.js.map +1 -0
- package/dist/schemas/drizzle/ports.d.ts +39 -0
- package/dist/schemas/drizzle/ports.d.ts.map +1 -0
- package/dist/schemas/drizzle/ports.js +2 -0
- package/dist/schemas/drizzle/ports.js.map +1 -0
- package/dist/schemas/drizzle/providers.d.ts +64 -0
- package/dist/schemas/drizzle/providers.d.ts.map +1 -0
- package/dist/schemas/drizzle/providers.js +19 -0
- package/dist/schemas/drizzle/providers.js.map +1 -0
- package/dist/schemas/drizzle/raw-sql.d.ts +33 -0
- package/dist/schemas/drizzle/raw-sql.d.ts.map +1 -0
- package/dist/schemas/drizzle/raw-sql.js +34 -0
- package/dist/schemas/drizzle/raw-sql.js.map +1 -0
- package/dist/schemas/explorer/capability.d.ts +41 -0
- package/dist/schemas/explorer/capability.d.ts.map +1 -0
- package/dist/schemas/explorer/capability.js +14 -0
- package/dist/schemas/explorer/capability.js.map +1 -0
- package/dist/schemas/explorer/overview.d.ts +41 -0
- package/dist/schemas/explorer/overview.d.ts.map +1 -0
- package/dist/schemas/explorer/overview.js +45 -0
- package/dist/schemas/explorer/overview.js.map +1 -0
- package/dist/schemas/explorer/refs.d.ts +38 -0
- package/dist/schemas/explorer/refs.d.ts.map +1 -0
- package/dist/schemas/explorer/refs.js +21 -0
- package/dist/schemas/explorer/refs.js.map +1 -0
- package/dist/schemas/explorer/rpc.d.ts +211 -0
- package/dist/schemas/explorer/rpc.d.ts.map +1 -0
- package/dist/schemas/explorer/rpc.js +103 -0
- package/dist/schemas/explorer/rpc.js.map +1 -0
- package/dist/schemas/explorer/views.d.ts +99 -0
- package/dist/schemas/explorer/views.d.ts.map +1 -0
- package/dist/schemas/explorer/views.js +84 -0
- package/dist/schemas/explorer/views.js.map +1 -0
- package/dist/schemas/index.d.ts +16 -8
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +12 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/localdb/inputs.d.ts +80 -0
- package/dist/schemas/localdb/inputs.d.ts.map +1 -0
- package/dist/schemas/localdb/inputs.js +99 -0
- package/dist/schemas/localdb/inputs.js.map +1 -0
- package/dist/schemas/localdb/query.d.ts +28 -0
- package/dist/schemas/localdb/query.d.ts.map +1 -0
- package/dist/schemas/localdb/query.js +27 -0
- package/dist/schemas/localdb/query.js.map +1 -0
- package/dist/schemas/manifest-descriptor.d.ts +15 -5
- package/dist/schemas/manifest-descriptor.d.ts.map +1 -1
- package/dist/schemas/manifest-descriptor.js +2 -2
- package/dist/schemas/manifest-descriptor.js.map +1 -1
- package/dist/schemas/memory-store.d.ts +8 -0
- package/dist/schemas/memory-store.d.ts.map +1 -0
- package/dist/schemas/memory-store.js +7 -0
- package/dist/schemas/memory-store.js.map +1 -0
- package/dist/schemas/migration-format.d.ts +50 -0
- package/dist/schemas/migration-format.d.ts.map +1 -0
- package/dist/schemas/migration-format.js +17 -0
- package/dist/schemas/migration-format.js.map +1 -0
- package/dist/schemas/policy/overrides.d.ts +41 -0
- package/dist/schemas/policy/overrides.d.ts.map +1 -0
- package/dist/schemas/policy/overrides.js +14 -0
- package/dist/schemas/policy/overrides.js.map +1 -0
- package/dist/schemas/policy/persistence.d.ts +62 -0
- package/dist/schemas/policy/persistence.d.ts.map +1 -0
- package/dist/schemas/policy/persistence.js +24 -0
- package/dist/schemas/policy/persistence.js.map +1 -0
- package/dist/schemas/record/atomic.d.ts +41 -0
- package/dist/schemas/record/atomic.d.ts.map +1 -0
- package/dist/schemas/record/atomic.js +12 -0
- package/dist/schemas/record/atomic.js.map +1 -0
- package/dist/schemas/record/batch.d.ts +53 -0
- package/dist/schemas/record/batch.d.ts.map +1 -0
- package/dist/schemas/record/batch.js +36 -0
- package/dist/schemas/record/batch.js.map +1 -0
- package/dist/schemas/record/columns.d.ts +44 -0
- package/dist/schemas/record/columns.d.ts.map +1 -0
- package/dist/schemas/record/columns.js +25 -0
- package/dist/schemas/record/columns.js.map +1 -0
- package/dist/schemas/record/delivery.d.ts +54 -0
- package/dist/schemas/record/delivery.d.ts.map +1 -0
- package/dist/schemas/record/delivery.js +23 -0
- package/dist/schemas/record/delivery.js.map +1 -0
- package/dist/schemas/record/descriptor.d.ts +153 -51
- package/dist/schemas/record/descriptor.d.ts.map +1 -1
- package/dist/schemas/record/descriptor.js +61 -11
- package/dist/schemas/record/descriptor.js.map +1 -1
- package/dist/schemas/record/index.d.ts +8 -2
- package/dist/schemas/record/index.d.ts.map +1 -1
- package/dist/schemas/record/index.js +5 -1
- package/dist/schemas/record/index.js.map +1 -1
- package/dist/schemas/record/query-values.d.ts +62 -0
- package/dist/schemas/record/query-values.d.ts.map +1 -0
- package/dist/schemas/record/query-values.js +33 -0
- package/dist/schemas/record/query-values.js.map +1 -0
- package/dist/schemas/record/relation.d.ts +1 -1
- package/dist/schemas/record/relation.d.ts.map +1 -1
- package/dist/schemas/record/relation.js +8 -4
- package/dist/schemas/record/relation.js.map +1 -1
- package/dist/schemas/record/revision.d.ts +92 -0
- package/dist/schemas/record/revision.d.ts.map +1 -0
- package/dist/schemas/record/revision.js +39 -0
- package/dist/schemas/record/revision.js.map +1 -0
- package/dist/schemas/retention/jobs.d.ts +103 -0
- package/dist/schemas/retention/jobs.d.ts.map +1 -0
- package/dist/schemas/retention/jobs.js +72 -0
- package/dist/schemas/retention/jobs.js.map +1 -0
- package/dist/schemas/retention/results.d.ts +153 -0
- package/dist/schemas/retention/results.d.ts.map +1 -0
- package/dist/schemas/retention/results.js +84 -0
- package/dist/schemas/retention/results.js.map +1 -0
- package/dist/schemas/schema/descriptor.d.ts +14 -4
- package/dist/schemas/schema/descriptor.d.ts.map +1 -1
- package/dist/schemas/schema/descriptor.js +3 -3
- package/dist/schemas/schema/descriptor.js.map +1 -1
- package/dist/schemas/schema/index.d.ts +1 -1
- package/dist/schemas/schema/index.d.ts.map +1 -1
- package/dist/schemas/schema/index.js +1 -1
- package/dist/schemas/schema/index.js.map +1 -1
- package/dist/schemas/storage-provider.d.ts +79 -0
- package/dist/schemas/storage-provider.d.ts.map +1 -0
- package/dist/schemas/storage-provider.js +54 -0
- package/dist/schemas/storage-provider.js.map +1 -0
- package/dist/schemas/storage-ref.d.ts +39 -0
- package/dist/schemas/storage-ref.d.ts.map +1 -0
- package/dist/schemas/storage-ref.js +64 -0
- package/dist/schemas/storage-ref.js.map +1 -0
- package/dist/schemas/sync/command.d.ts +15 -0
- package/dist/schemas/sync/command.d.ts.map +1 -0
- package/dist/schemas/sync/command.js +10 -0
- package/dist/schemas/sync/command.js.map +1 -0
- package/dist/schemas/sync/crud.d.ts +26 -0
- package/dist/schemas/sync/crud.d.ts.map +1 -0
- package/dist/schemas/sync/crud.js +16 -0
- package/dist/schemas/sync/crud.js.map +1 -0
- package/dist/schemas/sync/document.d.ts +4 -0
- package/dist/schemas/sync/document.d.ts.map +1 -0
- package/dist/schemas/sync/document.js +4 -0
- package/dist/schemas/sync/document.js.map +1 -0
- package/dist/schemas/sync/local-first.d.ts +26 -0
- package/dist/schemas/sync/local-first.d.ts.map +1 -0
- package/dist/schemas/sync/local-first.js +14 -0
- package/dist/schemas/sync/local-first.js.map +1 -0
- package/dist/schemas/sync/results.d.ts +61 -0
- package/dist/schemas/sync/results.d.ts.map +1 -0
- package/dist/schemas/sync/results.js +47 -0
- package/dist/schemas/sync/results.js.map +1 -0
- package/dist/schemas/sync-bridge-descriptor.d.ts +34 -15
- package/dist/schemas/sync-bridge-descriptor.d.ts.map +1 -1
- package/dist/schemas/sync-bridge-descriptor.js +9 -2
- package/dist/schemas/sync-bridge-descriptor.js.map +1 -1
- package/dist/schemas/sync-memory.d.ts +7 -0
- package/dist/schemas/sync-memory.d.ts.map +1 -0
- package/dist/schemas/sync-memory.js +4 -0
- package/dist/schemas/sync-memory.js.map +1 -0
- package/dist/schemas/tools/views.d.ts +83 -0
- package/dist/schemas/tools/views.d.ts.map +1 -0
- package/dist/schemas/tools/views.js +57 -0
- package/dist/schemas/tools/views.js.map +1 -0
- package/dist/schemas/tools/widgets.d.ts +41 -0
- package/dist/schemas/tools/widgets.d.ts.map +1 -0
- package/dist/schemas/tools/widgets.js +13 -0
- package/dist/schemas/tools/widgets.js.map +1 -0
- package/dist/schemas/transform.d.ts +32 -0
- package/dist/schemas/transform.d.ts.map +1 -0
- package/dist/schemas/transform.js +18 -0
- package/dist/schemas/transform.js.map +1 -0
- package/dist/schemas/zod-schema-value.d.ts +8 -0
- package/dist/schemas/zod-schema-value.d.ts.map +1 -0
- package/dist/schemas/zod-schema-value.js +8 -0
- package/dist/schemas/zod-schema-value.js.map +1 -0
- package/dist/server/manifest-route.d.ts +18 -10
- package/dist/server/manifest-route.d.ts.map +1 -1
- package/dist/server/manifest-route.js +88 -90
- package/dist/server/manifest-route.js.map +1 -1
- package/dist/storage-explorer.consumer.plugin.d.ts +10 -0
- package/dist/storage-explorer.consumer.plugin.d.ts.map +1 -0
- package/dist/storage-explorer.consumer.plugin.js +24 -0
- package/dist/storage-explorer.consumer.plugin.js.map +1 -0
- package/dist/storage-policy.context.descriptor.js +1 -1
- package/dist/storage-policy.context.descriptor.js.map +1 -1
- package/dist/storage-policy.context.server.d.ts +7 -9
- package/dist/storage-policy.context.server.d.ts.map +1 -1
- package/dist/storage-policy.context.server.js +7 -20
- package/dist/storage-policy.context.server.js.map +1 -1
- package/dist/storage.consumer.plugin.d.ts +3 -0
- package/dist/storage.consumer.plugin.d.ts.map +1 -0
- package/dist/storage.consumer.plugin.js +15 -0
- package/dist/storage.consumer.plugin.js.map +1 -0
- package/dist/storage.node.plugin.d.ts +3 -0
- package/dist/storage.node.plugin.d.ts.map +1 -0
- package/dist/storage.node.plugin.js +12 -0
- package/dist/storage.node.plugin.js.map +1 -0
- package/dist/storage.plugin.d.ts +10 -16
- package/dist/storage.plugin.d.ts.map +1 -1
- package/dist/storage.plugin.js +150 -91
- package/dist/storage.plugin.js.map +1 -1
- package/dist/svelte/components/ConnectStorageProviderDialog.svelte +345 -0
- package/dist/svelte/components/ConnectStorageProviderDialog.svelte.d.ts +17 -0
- package/dist/svelte/components/ConnectStorageProviderDialog.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PlatformStorageExplorer.svelte +57 -0
- package/dist/svelte/components/PlatformStorageExplorer.svelte.d.ts +23 -0
- package/dist/svelte/components/PlatformStorageExplorer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageBrowser.svelte +436 -0
- package/dist/svelte/components/StorageBrowser.svelte.d.ts +51 -0
- package/dist/svelte/components/StorageBrowser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageBrowserPage.svelte +71 -0
- package/dist/svelte/components/StorageBrowserPage.svelte.d.ts +23 -0
- package/dist/svelte/components/StorageBrowserPage.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageCollectionManager.svelte +193 -0
- package/dist/svelte/components/StorageCollectionManager.svelte.d.ts +14 -0
- package/dist/svelte/components/StorageCollectionManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageDetailsPane.svelte +160 -0
- package/dist/svelte/components/StorageDetailsPane.svelte.d.ts +11 -0
- package/dist/svelte/components/StorageDetailsPane.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageDropzone.svelte +76 -0
- package/dist/svelte/components/StorageDropzone.svelte.d.ts +9 -0
- package/dist/svelte/components/StorageDropzone.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageExplorer.svelte +954 -0
- package/dist/svelte/components/StorageExplorer.svelte.d.ts +48 -0
- package/dist/svelte/components/StorageExplorer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageFileBrowser.svelte +201 -0
- package/dist/svelte/components/StorageFileBrowser.svelte.d.ts +18 -0
- package/dist/svelte/components/StorageFileBrowser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageFileCard.svelte +162 -0
- package/dist/svelte/components/StorageFileCard.svelte.d.ts +10 -0
- package/dist/svelte/components/StorageFileCard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StoragePathBar.svelte +104 -0
- package/dist/svelte/components/StoragePathBar.svelte.d.ts +19 -0
- package/dist/svelte/components/StoragePathBar.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageProviderSelect.svelte +163 -0
- package/dist/svelte/components/StorageProviderSelect.svelte.d.ts +20 -0
- package/dist/svelte/components/StorageProviderSelect.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageProviderSidebar.svelte +187 -0
- package/dist/svelte/components/StorageProviderSidebar.svelte.d.ts +30 -0
- package/dist/svelte/components/StorageProviderSidebar.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageReadinessNotice.svelte +181 -0
- package/dist/svelte/components/StorageReadinessNotice.svelte.d.ts +32 -0
- package/dist/svelte/components/StorageReadinessNotice.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageSearchBox.svelte +106 -0
- package/dist/svelte/components/StorageSearchBox.svelte.d.ts +19 -0
- package/dist/svelte/components/StorageSearchBox.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageToolbar.svelte +160 -0
- package/dist/svelte/components/StorageToolbar.svelte.d.ts +26 -0
- package/dist/svelte/components/StorageToolbar.svelte.d.ts.map +1 -0
- package/dist/svelte/components/StorageUploadChip.svelte +116 -0
- package/dist/svelte/components/StorageUploadChip.svelte.d.ts +13 -0
- package/dist/svelte/components/StorageUploadChip.svelte.d.ts.map +1 -0
- package/dist/svelte/components/index.d.ts +14 -0
- package/dist/svelte/components/index.d.ts.map +1 -0
- package/dist/svelte/components/index.js +12 -0
- package/dist/svelte/components/storage-media.d.ts +14 -0
- package/dist/svelte/components/storage-media.d.ts.map +1 -0
- package/dist/svelte/components/storage-media.js +13 -0
- package/dist/svelte/index.d.ts +14 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +13 -0
- package/dist/svelte/note-store-failure.d.ts +15 -0
- package/dist/svelte/note-store-failure.d.ts.map +1 -0
- package/dist/svelte/note-store-failure.js +21 -0
- package/dist/svelte/platform-storage-port.d.ts +86 -0
- package/dist/svelte/platform-storage-port.d.ts.map +1 -0
- package/dist/svelte/platform-storage-port.js +71 -0
- package/dist/svelte/storage-browse-runtime.d.ts +65 -0
- package/dist/svelte/storage-browse-runtime.d.ts.map +1 -0
- package/dist/svelte/storage-browse-runtime.js +68 -0
- package/dist/svelte/storage-connection.d.ts +23 -0
- package/dist/svelte/storage-connection.d.ts.map +1 -0
- package/dist/svelte/storage-connection.js +40 -0
- package/dist/svelte/storage-display.d.ts +6 -0
- package/dist/svelte/storage-display.d.ts.map +1 -0
- package/dist/svelte/storage-display.js +58 -0
- package/dist/svelte/storage-explorer-runtime.d.ts +120 -0
- package/dist/svelte/storage-explorer-runtime.d.ts.map +1 -0
- package/dist/svelte/storage-explorer-runtime.js +251 -0
- package/dist/svelte/storage-explorer.load.d.ts +22 -0
- package/dist/svelte/storage-explorer.load.d.ts.map +1 -0
- package/dist/svelte/storage-explorer.load.js +37 -0
- package/dist/svelte/storage-refs-runtime.d.ts +36 -0
- package/dist/svelte/storage-refs-runtime.d.ts.map +1 -0
- package/dist/svelte/storage-refs-runtime.js +47 -0
- package/dist/svelte/storage-runtime.d.ts +30 -0
- package/dist/svelte/storage-runtime.d.ts.map +1 -0
- package/dist/svelte/storage-runtime.js +39 -0
- package/dist/svelte/storage-svelte.plugin.d.ts +40 -0
- package/dist/svelte/storage-svelte.plugin.d.ts.map +1 -0
- package/dist/svelte/storage-svelte.plugin.js +50 -0
- package/dist/svelte/storage-upload-runtime.d.ts +8 -0
- package/dist/svelte/storage-upload-runtime.d.ts.map +1 -0
- package/dist/svelte/storage-upload-runtime.js +12 -0
- package/dist/svelte/stores/index.d.ts +4 -0
- package/dist/svelte/stores/index.d.ts.map +1 -0
- package/dist/svelte/stores/index.js +3 -0
- package/dist/svelte/stores/storage-browse.svelte.d.ts +70 -0
- package/dist/svelte/stores/storage-browse.svelte.d.ts.map +1 -0
- package/dist/svelte/stores/storage-browse.svelte.js +133 -0
- package/dist/svelte/stores/storage-providers.svelte.d.ts +32 -0
- package/dist/svelte/stores/storage-providers.svelte.d.ts.map +1 -0
- package/dist/svelte/stores/storage-providers.svelte.js +73 -0
- package/dist/svelte/stores/storage-refs.svelte.d.ts +57 -0
- package/dist/svelte/stores/storage-refs.svelte.d.ts.map +1 -0
- package/dist/svelte/stores/storage-refs.svelte.js +90 -0
- package/dist/svelte/styles.css +14 -0
- package/dist/svelte/test-assets.d.ts +8 -0
- package/dist/svelte/tool-widgets/StorageBrowseToolCard.svelte +109 -0
- package/dist/svelte/tool-widgets/StorageBrowseToolCard.svelte.d.ts +9 -0
- package/dist/svelte/tool-widgets/StorageBrowseToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/StorageCopyToolCard.svelte +87 -0
- package/dist/svelte/tool-widgets/StorageCopyToolCard.svelte.d.ts +9 -0
- package/dist/svelte/tool-widgets/StorageCopyToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/StorageSearchToolCard.svelte +94 -0
- package/dist/svelte/tool-widgets/StorageSearchToolCard.svelte.d.ts +9 -0
- package/dist/svelte/tool-widgets/StorageSearchToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/format.d.ts +15 -0
- package/dist/svelte/tool-widgets/format.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/format.js +32 -0
- package/dist/svelte/tool-widgets/index.d.ts +2 -0
- package/dist/svelte/tool-widgets/index.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/index.js +12 -0
- package/dist/svelte/tool-widgets/runtime.d.ts +9 -0
- package/dist/svelte/tool-widgets/runtime.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/runtime.js +42 -0
- package/dist/sync/cloud-document.d.ts +24 -0
- package/dist/sync/cloud-document.d.ts.map +1 -0
- package/dist/sync/cloud-document.js +47 -0
- package/dist/sync/cloud-document.js.map +1 -0
- package/dist/sync/cloud-pull.d.ts +9 -3
- package/dist/sync/cloud-pull.d.ts.map +1 -1
- package/dist/sync/cloud-pull.js +85 -86
- package/dist/sync/cloud-pull.js.map +1 -1
- package/dist/sync/cloud-record-crud-config.d.ts +7 -17
- package/dist/sync/cloud-record-crud-config.d.ts.map +1 -1
- package/dist/sync/cloud-record-crud-config.js +17 -9
- package/dist/sync/cloud-record-crud-config.js.map +1 -1
- package/dist/sync/local-first.d.ts +61 -0
- package/dist/sync/local-first.d.ts.map +1 -0
- package/dist/sync/local-first.js +121 -0
- package/dist/sync/local-first.js.map +1 -0
- package/dist/sync/record-sync-bridge.d.ts +35 -3
- package/dist/sync/record-sync-bridge.d.ts.map +1 -1
- package/dist/sync/record-sync-bridge.js +50 -46
- package/dist/sync/record-sync-bridge.js.map +1 -1
- package/dist/sync/resolve-sync-target.d.ts +16 -17
- package/dist/sync/resolve-sync-target.d.ts.map +1 -1
- package/dist/sync/resolve-sync-target.js +18 -43
- package/dist/sync/resolve-sync-target.js.map +1 -1
- package/dist/sync/runtime-sync-state.d.ts +18 -0
- package/dist/sync/runtime-sync-state.d.ts.map +1 -0
- package/dist/sync/runtime-sync-state.js +12 -0
- package/dist/sync/runtime-sync-state.js.map +1 -0
- package/dist/sync/schemas/cloud-pull.d.ts +9 -5
- package/dist/sync/schemas/cloud-pull.d.ts.map +1 -1
- package/dist/sync/schemas/index.d.ts +3 -3
- package/dist/sync/schemas/index.d.ts.map +1 -1
- package/dist/sync/schemas/index.js +3 -3
- package/dist/sync/schemas/index.js.map +1 -1
- package/dist/sync/schemas/sync-helpers.d.ts +4 -2
- package/dist/sync/schemas/sync-helpers.d.ts.map +1 -1
- package/dist/sync/schemas/sync-state.d.ts +7 -5
- package/dist/sync/schemas/sync-state.d.ts.map +1 -1
- package/dist/sync/schemas/sync-state.js +1 -0
- package/dist/sync/schemas/sync-state.js.map +1 -1
- package/dist/sync/sync-bridge.d.ts +39 -31
- package/dist/sync/sync-bridge.d.ts.map +1 -1
- package/dist/sync/sync-bridge.js +427 -196
- package/dist/sync/sync-bridge.js.map +1 -1
- package/dist/sync/sync-manifest.d.ts +7 -19
- package/dist/sync/sync-manifest.d.ts.map +1 -1
- package/dist/sync/sync-manifest.js +125 -84
- package/dist/sync/sync-manifest.js.map +1 -1
- package/dist/sync/sync-state.browser.d.ts +37 -0
- package/dist/sync/sync-state.browser.d.ts.map +1 -0
- package/dist/sync/sync-state.browser.js +136 -0
- package/dist/sync/sync-state.browser.js.map +1 -0
- package/dist/sync/sync-state.client.d.ts +71 -0
- package/dist/sync/sync-state.client.d.ts.map +1 -0
- package/dist/sync/sync-state.client.js +78 -0
- package/dist/sync/sync-state.client.js.map +1 -0
- package/dist/sync/sync-state.consumer.d.ts +44 -17
- package/dist/sync/sync-state.consumer.d.ts.map +1 -1
- package/dist/sync/sync-state.consumer.js +161 -87
- package/dist/sync/sync-state.consumer.js.map +1 -1
- package/dist/sync/sync-state.core.d.ts +40 -0
- package/dist/sync/sync-state.core.d.ts.map +1 -0
- package/dist/sync/sync-state.core.js +130 -0
- package/dist/sync/sync-state.core.js.map +1 -0
- package/dist/sync/sync-state.descriptor.d.ts +39 -0
- package/dist/sync/sync-state.descriptor.d.ts.map +1 -0
- package/dist/sync/sync-state.descriptor.js +23 -0
- package/dist/sync/sync-state.descriptor.js.map +1 -0
- package/dist/testing.d.ts +31 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +82 -0
- package/dist/testing.js.map +1 -0
- package/dist/tools/descriptors.d.ts +312 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +98 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/impl.d.ts +72 -0
- package/dist/tools/impl.d.ts.map +1 -0
- package/dist/tools/impl.js +572 -0
- package/dist/tools/impl.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schemas.d.ts +136 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +113 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/widget-views.d.ts +9 -0
- package/dist/tools/widget-views.d.ts.map +1 -0
- package/dist/tools/widget-views.js +119 -0
- package/dist/tools/widget-views.js.map +1 -0
- package/dist/transform/index.d.ts +7 -18
- package/dist/transform/index.d.ts.map +1 -1
- package/dist/transform/index.js +16 -14
- package/dist/transform/index.js.map +1 -1
- package/dist/transform/transform-descriptor.d.ts +1 -21
- package/dist/transform/transform-descriptor.d.ts.map +1 -1
- package/dist/transform/transform-descriptor.js +1 -29
- package/dist/transform/transform-descriptor.js.map +1 -1
- package/dist/tui/plugin.d.ts +26 -0
- package/dist/tui/plugin.d.ts.map +1 -0
- package/dist/tui/plugin.js +107 -0
- package/dist/tui/plugin.js.map +1 -0
- package/dist/tui/storage-explorer.descriptor.d.ts +25 -4
- package/dist/tui/storage-explorer.descriptor.d.ts.map +1 -1
- package/dist/tui/storage-explorer.descriptor.js +7 -3
- package/dist/tui/storage-explorer.descriptor.js.map +1 -1
- package/dist/tui/storage-explorer.impl.consumer.d.ts +23 -6
- package/dist/tui/storage-explorer.impl.consumer.d.ts.map +1 -1
- package/dist/tui/storage-explorer.impl.consumer.js +231 -8
- package/dist/tui/storage-explorer.impl.consumer.js.map +1 -1
- package/dist/tui/storage-open.descriptor.d.ts +16 -3
- package/dist/tui/storage-open.descriptor.d.ts.map +1 -1
- package/dist/tui/storage-open.descriptor.js +5 -1
- package/dist/tui/storage-open.descriptor.js.map +1 -1
- package/dist/tui/storage-open.impl.consumer.d.ts +6 -1
- package/dist/tui/storage-open.impl.consumer.d.ts.map +1 -1
- package/dist/tui/storage-open.impl.consumer.js.map +1 -1
- package/dist/tui/storage-signed-out-ui.d.ts +21 -0
- package/dist/tui/storage-signed-out-ui.d.ts.map +1 -0
- package/dist/tui/storage-signed-out-ui.js +34 -0
- package/dist/tui/storage-signed-out-ui.js.map +1 -0
- package/dist/tui/storage.tui-state.descriptor.d.ts +61 -0
- package/dist/tui/storage.tui-state.descriptor.d.ts.map +1 -0
- package/dist/tui/storage.tui-state.descriptor.js +52 -0
- package/dist/tui/storage.tui-state.descriptor.js.map +1 -0
- package/dist/tui/storage.tui-state.impl.consumer.d.ts +29 -0
- package/dist/tui/storage.tui-state.impl.consumer.d.ts.map +1 -0
- package/dist/tui/storage.tui-state.impl.consumer.js +207 -0
- package/dist/tui/storage.tui-state.impl.consumer.js.map +1 -0
- package/dist/tui/storage.tui-state.key.d.ts +27 -0
- package/dist/tui/storage.tui-state.key.d.ts.map +1 -0
- package/dist/tui/storage.tui-state.key.js +12 -0
- package/dist/tui/storage.tui-state.key.js.map +1 -0
- package/dist/tui/tool-widgets/StorageBrowseToolWidget.impl.consumer.d.ts +14 -0
- package/dist/tui/tool-widgets/StorageBrowseToolWidget.impl.consumer.d.ts.map +1 -0
- package/dist/tui/tool-widgets/StorageBrowseToolWidget.impl.consumer.js +28 -0
- package/dist/tui/tool-widgets/StorageBrowseToolWidget.impl.consumer.js.map +1 -0
- package/dist/tui/tool-widgets/StorageCopyToolWidget.impl.consumer.d.ts +14 -0
- package/dist/tui/tool-widgets/StorageCopyToolWidget.impl.consumer.d.ts.map +1 -0
- package/dist/tui/tool-widgets/StorageCopyToolWidget.impl.consumer.js +21 -0
- package/dist/tui/tool-widgets/StorageCopyToolWidget.impl.consumer.js.map +1 -0
- package/dist/tui/tool-widgets/StorageSearchToolWidget.impl.consumer.d.ts +14 -0
- package/dist/tui/tool-widgets/StorageSearchToolWidget.impl.consumer.d.ts.map +1 -0
- package/dist/tui/tool-widgets/StorageSearchToolWidget.impl.consumer.js +22 -0
- package/dist/tui/tool-widgets/StorageSearchToolWidget.impl.consumer.js.map +1 -0
- package/dist/tui/tool-widgets/format.d.ts +19 -0
- package/dist/tui/tool-widgets/format.d.ts.map +1 -0
- package/dist/tui/tool-widgets/format.js +53 -0
- package/dist/tui/tool-widgets/format.js.map +1 -0
- package/dist/tui/tool-widgets/storage.browse.tool-widget.descriptor.d.ts +14 -0
- package/dist/tui/tool-widgets/storage.browse.tool-widget.descriptor.d.ts.map +1 -0
- package/dist/tui/tool-widgets/storage.browse.tool-widget.descriptor.js +14 -0
- package/dist/tui/tool-widgets/storage.browse.tool-widget.descriptor.js.map +1 -0
- package/dist/tui/tool-widgets/storage.copy.tool-widget.descriptor.d.ts +14 -0
- package/dist/tui/tool-widgets/storage.copy.tool-widget.descriptor.d.ts.map +1 -0
- package/dist/tui/tool-widgets/storage.copy.tool-widget.descriptor.js +14 -0
- package/dist/tui/tool-widgets/storage.copy.tool-widget.descriptor.js.map +1 -0
- package/dist/tui/tool-widgets/storage.search.tool-widget.descriptor.d.ts +14 -0
- package/dist/tui/tool-widgets/storage.search.tool-widget.descriptor.d.ts.map +1 -0
- package/dist/tui/tool-widgets/storage.search.tool-widget.descriptor.js +14 -0
- package/dist/tui/tool-widgets/storage.search.tool-widget.descriptor.js.map +1 -0
- package/dist/utils/caller-bearer.d.ts +13 -0
- package/dist/utils/caller-bearer.d.ts.map +1 -0
- package/dist/utils/caller-bearer.js +17 -0
- package/dist/utils/caller-bearer.js.map +1 -0
- package/dist/utils/error-context.d.ts +9 -1
- package/dist/utils/error-context.d.ts.map +1 -1
- package/dist/utils/error-context.js +7 -14
- package/dist/utils/error-context.js.map +1 -1
- package/dist/utils/failure-of.d.ts +20 -0
- package/dist/utils/failure-of.d.ts.map +1 -0
- package/dist/utils/failure-of.js +35 -0
- package/dist/utils/failure-of.js.map +1 -0
- package/dist/workers-port.d.ts +37 -0
- package/dist/workers-port.d.ts.map +1 -0
- package/dist/workers-port.js +60 -0
- package/dist/workers-port.js.map +1 -0
- package/package.json +644 -148
- package/SPEC.md +0 -60
- package/dist/adapters/index.d.ts +0 -14
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -15
- package/dist/adapters/index.js.map +0 -1
- package/dist/cli/context.consumer.d.ts +0 -26
- package/dist/cli/context.consumer.d.ts.map +0 -1
- package/dist/cli/context.consumer.js +0 -164
- package/dist/cli/context.consumer.js.map +0 -1
- package/dist/docs/adapters.docs.descriptor.d.ts +0 -4
- package/dist/docs/adapters.docs.descriptor.d.ts.map +0 -1
- package/dist/docs/adapters.docs.descriptor.js +0 -223
- package/dist/docs/adapters.docs.descriptor.js.map +0 -1
- package/dist/docs/manifests.docs.descriptor.d.ts +0 -4
- package/dist/docs/manifests.docs.descriptor.d.ts.map +0 -1
- package/dist/docs/manifests.docs.descriptor.js.map +0 -1
- package/src/adapters/index.ts +0 -13
- package/src/bridge/index.ts +0 -2
- package/src/bridge/storage-kind-bridge.ts +0 -131
- package/src/bridge/types.ts +0 -46
- package/src/cli/commands/list/storage.list.cli-command.descriptor.ts +0 -20
- package/src/cli/commands/list/storage.list.cli-command.impl.ts +0 -72
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.ts +0 -28
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.ts +0 -171
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.ts +0 -28
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.impl.ts +0 -213
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.ts +0 -22
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.ts +0 -129
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.ts +0 -17
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.impl.ts +0 -192
- package/src/cli/context.consumer.ts +0 -195
- package/src/cli/storage.cli-group.descriptor.ts +0 -13
- package/src/cli/storage.sync.cli-group.descriptor.ts +0 -14
- package/src/cli/types.ts +0 -25
- package/src/client/index.ts +0 -10
- package/src/client/list-browsable-adapters.ts +0 -42
- package/src/daemon/commands/sync.ts +0 -225
- package/src/docs/adapters.docs.descriptor.ts +0 -225
- package/src/docs/manifests.docs.descriptor.ts +0 -318
- package/src/docs/records.docs.descriptor.ts +0 -271
- package/src/docs/sync.docs.descriptor.ts +0 -281
- package/src/index.ts +0 -109
- package/src/interfaces/adapter.ts +0 -451
- package/src/interfaces/document-store.ts +0 -74
- package/src/interfaces/index.ts +0 -117
- package/src/interfaces/key-value.ts +0 -112
- package/src/interfaces/query-builder.ts +0 -31
- package/src/interfaces/record/index.ts +0 -58
- package/src/interfaces/record/interface.ts +0 -723
- package/src/interfaces/repository.ts +0 -300
- package/src/interfaces/schema/index.ts +0 -37
- package/src/interfaces/schema/schema-interface.ts +0 -586
- package/src/interfaces/schema/table-interface.ts +0 -314
- package/src/interfaces/storage-consumer-fs.ts +0 -66
- package/src/manifest/base.ts +0 -594
- package/src/manifest/cloud-sync.consumer.ts +0 -120
- package/src/manifest/index.ts +0 -7
- package/src/manifest/source-policy.ts +0 -74
- package/src/paths.ts +0 -171
- package/src/policy/context.ts +0 -30
- package/src/policy/index.ts +0 -20
- package/src/policy/overrides.ts +0 -46
- package/src/policy/persistence.ts +0 -117
- package/src/policy/types.ts +0 -28
- package/src/record/base.ts +0 -1872
- package/src/record/events.ts +0 -56
- package/src/record/extensions.ts +0 -308
- package/src/record/index.ts +0 -7
- package/src/resolver/storage-backed-resolver.ts +0 -255
- package/src/schemas/adapter-descriptor.ts +0 -128
- package/src/schemas/index.ts +0 -104
- package/src/schemas/manifest-descriptor.ts +0 -143
- package/src/schemas/record/descriptor.ts +0 -621
- package/src/schemas/record/index.ts +0 -60
- package/src/schemas/record/relation.ts +0 -49
- package/src/schemas/schema/descriptor.ts +0 -278
- package/src/schemas/schema/index.ts +0 -14
- package/src/schemas/sync-bridge-descriptor.ts +0 -143
- package/src/server/manifest-route.ts +0 -319
- package/src/storage-policy.context.descriptor.ts +0 -17
- package/src/storage-policy.context.server.ts +0 -34
- package/src/storage.plugin.ts +0 -264
- package/src/sync/cloud-pull.ts +0 -202
- package/src/sync/cloud-record-crud-config.ts +0 -41
- package/src/sync/record-sync-bridge.ts +0 -183
- package/src/sync/resolve-sync-target.ts +0 -57
- package/src/sync/schemas/cloud-pull.ts +0 -26
- package/src/sync/schemas/index.ts +0 -18
- package/src/sync/schemas/sync-helpers.ts +0 -18
- package/src/sync/schemas/sync-state.ts +0 -41
- package/src/sync/sync-bridge.ts +0 -763
- package/src/sync/sync-manifest.ts +0 -212
- package/src/sync/sync-state.consumer.ts +0 -144
- package/src/transform/index.ts +0 -130
- package/src/transform/transform-descriptor.ts +0 -53
- package/src/tui/storage-explorer.descriptor.ts +0 -32
- package/src/tui/storage-explorer.impl.consumer.ts +0 -14
- package/src/tui/storage-open.descriptor.ts +0 -31
- package/src/tui/storage-open.impl.consumer.ts +0 -14
- package/src/utils/error-context.ts +0 -19
|
@@ -0,0 +1,1370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalDB Storage Adapter Implementation
|
|
3
|
+
*
|
|
4
|
+
* SQLite-based persistent storage for consumer hardware.
|
|
5
|
+
* Implements StorageAdapterInterface with document, key-value, and repository support.
|
|
6
|
+
*
|
|
7
|
+
* SERVER-ONLY: opens SQLite through LocalDB's host driver and reaches the
|
|
8
|
+
* filesystem through the runtime's `filesystem/adapter` kind. Do not import in
|
|
9
|
+
* browser bundles.
|
|
10
|
+
*/
|
|
11
|
+
import { CapabilityError, createRuntimeImplementation, valueFreeFailure } from '@vibesdotdev/kernel';
|
|
12
|
+
import { DocumentRevisionMetadataSchema, DocumentRevisionSchema } from "../../schemas/document-revision.js";
|
|
13
|
+
import { StorageRecord } from '@vibesdotdev/storage/record';
|
|
14
|
+
import { resolveGlobalStorageBasePath, resolveScopePathTemplate } from '@vibesdotdev/storage/paths';
|
|
15
|
+
import { fileSystemOf, localdb, LocalDatabase, migrationRegistry } from '@vibesdotdev/localdb';
|
|
16
|
+
import { sqliteFailureCondition } from '@vibesdotdev/localdb/sqlite-driver';
|
|
17
|
+
import { getLogger } from '@vibesdotdev/logging';
|
|
18
|
+
import { isAppliedMigrationFailure } from "./migration-failure.js";
|
|
19
|
+
import { attempt, settle } from "./outcome.js";
|
|
20
|
+
import { DbRowsSchema, IdentifiedItemSchema, isAbsoluteHostPath, KeyTextSchema, LocalDBConfigFieldsSchema, LocalDBManifestHintsSchema, LocalDBScopeInputsSchema, RowsLayerSchema, SQL_IDENTIFIER } from "./localdb.inputs.js";
|
|
21
|
+
import { matchesRepositoryQuery, repositoryFieldsOf, RepositoryFieldsSchema, RepositoryKeySchema, sortRepositoryRows } from "./repository-query.js";
|
|
22
|
+
import { parseAdapterInput } from "../parse-adapter-input.js";
|
|
23
|
+
import { readStoredLayer, validateForPersist } from "../validate-for-persist.js";
|
|
24
|
+
/** The database file a configuration names when it names none. */
|
|
25
|
+
const DEFAULT_DB_NAME = 'vibes-storage.db';
|
|
26
|
+
/** How many times an atomic document update re-reads and retries before it reports contention. */
|
|
27
|
+
const DOCUMENT_UPDATE_ATTEMPTS = 64;
|
|
28
|
+
/**
|
|
29
|
+
* Escape a `LIKE` pattern's metacharacters (`%`, `_`, and the escape char)
|
|
30
|
+
* with the pattern's declared escape, so a literal namespace prefix with `%`
|
|
31
|
+
* or `_` (URL-encoded partition ids may contain neither, but be explicit)
|
|
32
|
+
* cannot widen the `SELECT DISTINCT namespace` discovery scan.
|
|
33
|
+
*/
|
|
34
|
+
function escapeSqlLike(literal) {
|
|
35
|
+
return literal.replaceAll('\\', '\\\\').replaceAll('%', '\\%').replaceAll('_', '\\_');
|
|
36
|
+
}
|
|
37
|
+
const STORAGE_MIGRATIONS = [
|
|
38
|
+
{
|
|
39
|
+
version: 1,
|
|
40
|
+
name: 'Create storage tables',
|
|
41
|
+
up: (db) => {
|
|
42
|
+
// Document store
|
|
43
|
+
db.exec(`
|
|
44
|
+
CREATE TABLE IF NOT EXISTS vibes_documents (
|
|
45
|
+
namespace TEXT PRIMARY KEY,
|
|
46
|
+
data TEXT NOT NULL,
|
|
47
|
+
updated_at TEXT DEFAULT CURRENT_TIMESTAMP
|
|
48
|
+
)
|
|
49
|
+
`);
|
|
50
|
+
// Key-value store
|
|
51
|
+
db.exec(`
|
|
52
|
+
CREATE TABLE IF NOT EXISTS vibes_kv (
|
|
53
|
+
namespace TEXT NOT NULL,
|
|
54
|
+
key TEXT NOT NULL,
|
|
55
|
+
value TEXT NOT NULL,
|
|
56
|
+
expires_at INTEGER,
|
|
57
|
+
PRIMARY KEY (namespace, key)
|
|
58
|
+
)
|
|
59
|
+
`);
|
|
60
|
+
db.exec(`CREATE INDEX IF NOT EXISTS vibes_kv_expires ON vibes_kv(expires_at) WHERE expires_at IS NOT NULL`);
|
|
61
|
+
// Repository store
|
|
62
|
+
db.exec(`
|
|
63
|
+
CREATE TABLE IF NOT EXISTS vibes_repository (
|
|
64
|
+
tablename TEXT NOT NULL,
|
|
65
|
+
id TEXT NOT NULL,
|
|
66
|
+
data TEXT NOT NULL,
|
|
67
|
+
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
|
68
|
+
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
|
69
|
+
PRIMARY KEY (tablename, id)
|
|
70
|
+
)
|
|
71
|
+
`);
|
|
72
|
+
db.exec(`CREATE INDEX IF NOT EXISTS vibes_repository_tablename ON vibes_repository(tablename)`);
|
|
73
|
+
},
|
|
74
|
+
down: (db) => {
|
|
75
|
+
db.exec(`DROP TABLE IF EXISTS vibes_documents`);
|
|
76
|
+
db.exec(`DROP TABLE IF EXISTS vibes_kv`);
|
|
77
|
+
db.exec(`DROP TABLE IF EXISTS vibes_repository`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
version: 2,
|
|
82
|
+
name: 'Persist document revisions',
|
|
83
|
+
up: (db) => {
|
|
84
|
+
db.exec(`ALTER TABLE vibes_documents ADD COLUMN __vibes_revision TEXT NOT NULL DEFAULT ''`);
|
|
85
|
+
db.exec(`UPDATE vibes_documents SET __vibes_revision = lower(hex(randomblob(16)))`);
|
|
86
|
+
db.exec(`CREATE TRIGGER storage_document_revision_insert AFTER INSERT ON vibes_documents
|
|
87
|
+
BEGIN UPDATE vibes_documents SET __vibes_revision = lower(hex(randomblob(16))) WHERE namespace = NEW.namespace; END`);
|
|
88
|
+
db.exec(`CREATE TRIGGER storage_document_revision_update AFTER UPDATE OF data ON vibes_documents
|
|
89
|
+
BEGIN UPDATE vibes_documents SET __vibes_revision = lower(hex(randomblob(16))) WHERE namespace = NEW.namespace; END`);
|
|
90
|
+
},
|
|
91
|
+
down: (db) => {
|
|
92
|
+
db.exec('DROP TRIGGER IF EXISTS storage_document_revision_insert');
|
|
93
|
+
db.exec('DROP TRIGGER IF EXISTS storage_document_revision_update');
|
|
94
|
+
db.exec('ALTER TABLE vibes_documents DROP COLUMN __vibes_revision');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
// Migration registration: once per process, on the first opening call's
|
|
99
|
+
// runtime. The registry is one per process, so it is asked first.
|
|
100
|
+
function ensureMigrationsRegistered(runtime) {
|
|
101
|
+
if (localdb.listNamespaces(runtime).includes('storage.localdb'))
|
|
102
|
+
return;
|
|
103
|
+
localdb.registerMigrations(runtime, 'storage.localdb', STORAGE_MIGRATIONS);
|
|
104
|
+
}
|
|
105
|
+
/** A configuration refusal: `INVALID_INPUT` with its specific reason, value-free. */
|
|
106
|
+
function invalidConfiguration(message, reason) {
|
|
107
|
+
return new CapabilityError(message, 'INVALID_INPUT', { reason, retryable: false });
|
|
108
|
+
}
|
|
109
|
+
/** The manifest descriptor's LocalDB hints, read once through the adapters' guard. */
|
|
110
|
+
function readManifestHints(manifest) {
|
|
111
|
+
return parseAdapterInput(LocalDBManifestHintsSchema, manifest, {
|
|
112
|
+
message: 'storage.localdb could not read the manifest descriptor it was handed.',
|
|
113
|
+
code: 'INVALID_INPUT',
|
|
114
|
+
reason: 'storage-localdb-manifest-invalid'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// LocalDB Adapter Implementation
|
|
118
|
+
/**
|
|
119
|
+
* The `storage.localdb` adapter. A class: the `storage/adapter` kind constructs
|
|
120
|
+
* one per runtime (`new LocalDBStorageAdapter(descriptor, context)`), so one
|
|
121
|
+
* runtime's `configure()` never re-points another runtime's adapter. Database
|
|
122
|
+
* handles come from LocalDB's process pool, which dedupes by namespace and
|
|
123
|
+
* path and counts each runtime's references, so two instances holding one file
|
|
124
|
+
* share one connection and neither's release closes the other's.
|
|
125
|
+
*/
|
|
126
|
+
export class LocalDBStorageAdapter {
|
|
127
|
+
id = 'storage.localdb';
|
|
128
|
+
capabilities = {
|
|
129
|
+
protocols: ['document', 'keyvalue', 'repository'],
|
|
130
|
+
requiresPairSchema: false,
|
|
131
|
+
supportsTransactions: true,
|
|
132
|
+
supportsTTL: true,
|
|
133
|
+
supportsFTS: true,
|
|
134
|
+
persistent: true,
|
|
135
|
+
supportsSubscription: false,
|
|
136
|
+
supportsHierarchy: true,
|
|
137
|
+
supportsComputedFields: true,
|
|
138
|
+
supportsSideEffects: true,
|
|
139
|
+
supportsRawQueries: true
|
|
140
|
+
};
|
|
141
|
+
config = null;
|
|
142
|
+
database = null;
|
|
143
|
+
initialized = false;
|
|
144
|
+
/**
|
|
145
|
+
* Cache of scope-resolved databases keyed by dbPath.
|
|
146
|
+
* When a manifest has a different scope (e.g., 'global') than the adapter's
|
|
147
|
+
* configured basePath, we resolve a separate database from the localdb pool.
|
|
148
|
+
*/
|
|
149
|
+
scopedDatabases = new Map();
|
|
150
|
+
/**
|
|
151
|
+
* Cache of `storage/record` databases keyed by dbPath.
|
|
152
|
+
*
|
|
153
|
+
* Distinct from `scopedDatabases` above: that pool resolves a MANIFEST's
|
|
154
|
+
* (`storage/manifest`, document-store) own scope→path mapping, which is a
|
|
155
|
+
* different formula than a `StorageRecord`'s scope→path mapping
|
|
156
|
+
* (`StorageRecord.getBasePath()`) — e.g. manifest global-scope resolves
|
|
157
|
+
* via `resolveGlobalStorageBasePath()` (`{home}/.vibes[-dev]/storage[/profile/x]`)
|
|
158
|
+
* while a record's global scope resolves to the canonical Vibes home
|
|
159
|
+
* (`VIBES_HOME` or `{home}/.vibes[-dev]`, with no `/storage` nesting or
|
|
160
|
+
* profile split). Pooling records through the manifest formula would
|
|
161
|
+
* silently retarget every existing local record
|
|
162
|
+
* store to a different, empty file. This pool is keyed off the CALLER's
|
|
163
|
+
* already-resolved `{ basePath, dbName }` (see `getRecordDatabaseConnection`)
|
|
164
|
+
* instead of re-deriving scope here, so it preserves the exact path
|
|
165
|
+
* `StorageRecord` has always used while still being race-free.
|
|
166
|
+
*/
|
|
167
|
+
recordDatabases = new Map();
|
|
168
|
+
/**
|
|
169
|
+
* Check and apply a manifest's or record's configuration. Synchronous: the
|
|
170
|
+
* manifest and record bases call it on every access. Each refusal is
|
|
171
|
+
* `INVALID_INPUT` with its own reason and a value-free message. Whether the
|
|
172
|
+
* base path is writable is not decided here (configuration is not a write,
|
|
173
|
+
* and existing stores stay readable in read-only processes): the first open
|
|
174
|
+
* creates the directory and refuses `UNAVAILABLE`
|
|
175
|
+
* `storage-localdb-base-path-unwritable` when it cannot.
|
|
176
|
+
*/
|
|
177
|
+
configure(config) {
|
|
178
|
+
const fields = parseAdapterInput(LocalDBConfigFieldsSchema, config, {
|
|
179
|
+
message: 'storage.localdb could not read its configuration.',
|
|
180
|
+
code: 'INVALID_INPUT',
|
|
181
|
+
reason: 'storage-localdb-config-invalid'
|
|
182
|
+
});
|
|
183
|
+
const basePath = fields.basePath;
|
|
184
|
+
if (basePath === undefined || basePath.trim() === '') {
|
|
185
|
+
throw invalidConfiguration('storage.localdb requires a non-empty basePath.', 'storage-localdb-base-path-required');
|
|
186
|
+
}
|
|
187
|
+
if (!isAbsoluteHostPath(basePath)) {
|
|
188
|
+
throw invalidConfiguration('storage.localdb requires an absolute basePath.', 'storage-localdb-base-path-relative');
|
|
189
|
+
}
|
|
190
|
+
if (fields.dbName !== undefined && (fields.dbName.includes('/') || fields.dbName.includes('\\'))) {
|
|
191
|
+
throw invalidConfiguration('storage.localdb dbName must be a filename, not a path.', 'storage-localdb-db-name-invalid');
|
|
192
|
+
}
|
|
193
|
+
if (fields.customTables === true && !fields.migrationKey) {
|
|
194
|
+
throw invalidConfiguration('storage.localdb customTables requires a migrationKey.', 'storage-localdb-migration-key-required');
|
|
195
|
+
}
|
|
196
|
+
if (fields.migrationKey !== undefined && fields.migrationKey.trim() === '') {
|
|
197
|
+
throw invalidConfiguration('storage.localdb migrationKey must be a non-empty string.', 'storage-localdb-migration-key-empty');
|
|
198
|
+
}
|
|
199
|
+
if (fields.tableName && !SQL_IDENTIFIER.test(fields.tableName)) {
|
|
200
|
+
throw invalidConfiguration('storage.localdb tableName must be a valid SQL identifier.', 'storage-localdb-table-name-invalid');
|
|
201
|
+
}
|
|
202
|
+
// If the default (non-scoped) database path changes — e.g. the active
|
|
203
|
+
// VIBES_PROFILE switched between two reads in the same process, which
|
|
204
|
+
// moves the global-scope storage path under {base}/profile/<name>/storage —
|
|
205
|
+
// drop the cached default handle so the next access re-opens the correct
|
|
206
|
+
// database. Without this, ensureInitialized() would return the stale
|
|
207
|
+
// previously-initialized handle (only a health-check, no path comparison)
|
|
208
|
+
// and reads would resolve against the wrong profile's data. The old handle
|
|
209
|
+
// stays in the localdb pool (keyed by path) and is reused if that path
|
|
210
|
+
// returns, so this only re-points the adapter, it does not leak.
|
|
211
|
+
const priorDbPath = this.config ? `${this.config.basePath}/${this.config.dbName ?? DEFAULT_DB_NAME}` : null;
|
|
212
|
+
const nextDbPath = `${basePath}/${fields.dbName ?? DEFAULT_DB_NAME}`;
|
|
213
|
+
if (priorDbPath !== null && priorDbPath !== nextDbPath) {
|
|
214
|
+
this.database = null;
|
|
215
|
+
this.initialized = false;
|
|
216
|
+
}
|
|
217
|
+
this.config = config;
|
|
218
|
+
}
|
|
219
|
+
isConfigured() {
|
|
220
|
+
return this.config !== null && !!this.config.basePath;
|
|
221
|
+
}
|
|
222
|
+
/** The configuration, or the typed refusal for an adapter used before `configure()`. */
|
|
223
|
+
requireConfig() {
|
|
224
|
+
if (!this.config) {
|
|
225
|
+
throw new CapabilityError('storage.localdb was used before it was configured.', 'INTERNAL', {
|
|
226
|
+
reason: 'storage-adapter-unconfigured',
|
|
227
|
+
retryable: false
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return this.config;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The runtime the adapter's current call serves: the configuring manifest's
|
|
234
|
+
* or record's. LocalDB opens, releases and probes on it and reports there
|
|
235
|
+
* (C083a); an adapter configured without one is refused, typed.
|
|
236
|
+
*/
|
|
237
|
+
requireRuntime() {
|
|
238
|
+
const runtime = this.config?.runtime;
|
|
239
|
+
if (!runtime) {
|
|
240
|
+
throw new CapabilityError('storage.localdb was configured without the runtime its databases open and report on.', 'INTERNAL', { reason: 'storage-adapter-unconfigured' });
|
|
241
|
+
}
|
|
242
|
+
return runtime;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Create `path` (recursively) through the runtime's filesystem kind. A
|
|
246
|
+
* directory that cannot be created refuses `UNAVAILABLE`
|
|
247
|
+
* `storage-localdb-base-path-unwritable`, the filesystem's failure as cause.
|
|
248
|
+
*/
|
|
249
|
+
async ensureDirectory(runtime, path) {
|
|
250
|
+
const files = await fileSystemOf(runtime);
|
|
251
|
+
const created = await settle(files.mkdir(path, { recursive: true }));
|
|
252
|
+
if (created.failed) {
|
|
253
|
+
throw new CapabilityError('storage.localdb could not create its database directory; the base path is not writable.', 'UNAVAILABLE', { reason: 'storage-localdb-base-path-unwritable', retryable: false, cause: created.cause });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/** Whether the database file at `dbPath` exists, asked of the runtime's filesystem kind. */
|
|
257
|
+
async databaseFileExists(runtime, dbPath) {
|
|
258
|
+
const files = await fileSystemOf(runtime);
|
|
259
|
+
return files.exists(dbPath);
|
|
260
|
+
}
|
|
261
|
+
async ensureInitialized() {
|
|
262
|
+
const runtime = this.requireRuntime();
|
|
263
|
+
assertStorageRuntimeLive(runtime, 'database work');
|
|
264
|
+
if (this.initialized && this.database) {
|
|
265
|
+
const healthy = this.database.healthCheck(runtime);
|
|
266
|
+
if (healthy)
|
|
267
|
+
return;
|
|
268
|
+
// Stale/closed handle (e.g. after shared recovery): release and recreate.
|
|
269
|
+
const dbPath = this.getDbPath();
|
|
270
|
+
// Recovery proceeds with a fresh handle; the release failure is reported, not lost.
|
|
271
|
+
await localdb.releaseDatabase(runtime, 'storage.localdb', dbPath).catch(logReleaseFailure(runtime, dbPath, 'stale'));
|
|
272
|
+
this.database = null;
|
|
273
|
+
this.initialized = false;
|
|
274
|
+
}
|
|
275
|
+
if (!this.initialized) {
|
|
276
|
+
await this.initialize();
|
|
277
|
+
}
|
|
278
|
+
// Now initialize the database on first access
|
|
279
|
+
if (!this.database) {
|
|
280
|
+
await this.ensureDirectory(runtime, this.requireConfig().basePath);
|
|
281
|
+
// Always use the generic storage.localdb namespace for the adapter's
|
|
282
|
+
// own database. Custom-table migrations (e.g. 'ai') are per-manifest
|
|
283
|
+
// and applied lazily via ensureCustomMigrations() in getScopedDb().
|
|
284
|
+
ensureMigrationsRegistered(runtime);
|
|
285
|
+
this.database = await localdb.getDatabase(runtime, 'storage.localdb', this.getDbPath(), 'storage-adapter');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/** The adapter's default database, opened (on the configured runtime) if it is not yet. */
|
|
289
|
+
async openDefaultDatabase() {
|
|
290
|
+
await this.ensureInitialized();
|
|
291
|
+
return this.defaultConnection();
|
|
292
|
+
}
|
|
293
|
+
/** The open default database, or the typed refusal when none is open yet. */
|
|
294
|
+
defaultConnection() {
|
|
295
|
+
if (!this.database) {
|
|
296
|
+
throw new CapabilityError('storage.localdb has no open default database; call ensureReady() first.', 'INTERNAL', {
|
|
297
|
+
reason: 'storage-localdb-not-ready',
|
|
298
|
+
retryable: false
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return this.database.getDatabase();
|
|
302
|
+
}
|
|
303
|
+
getDbPath() {
|
|
304
|
+
const config = this.requireConfig();
|
|
305
|
+
return `${config.basePath}/${config.dbName ?? DEFAULT_DB_NAME}`;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The workspace root and path roots the configuring manifest handed over.
|
|
309
|
+
* A filesystem manifest always sets both; their absence is a configuration
|
|
310
|
+
* defect, reported as such rather than answered from ambient state.
|
|
311
|
+
*/
|
|
312
|
+
configuredScopeInputs() {
|
|
313
|
+
return parseAdapterInput(LocalDBScopeInputsSchema, { workspacePath: this.config?.workspacePath, roots: this.config?.roots }, {
|
|
314
|
+
message: 'storage.localdb was configured without a workspace path and path roots.',
|
|
315
|
+
code: 'INTERNAL',
|
|
316
|
+
reason: 'storage-adapter-unconfigured'
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Resolve the correct SQLite database for a manifest's scope.
|
|
321
|
+
*
|
|
322
|
+
* Manifests sharing this runtime's adapter may have different scopes
|
|
323
|
+
* (e.g., 'global' vs 'project') that map to different database files.
|
|
324
|
+
* This method resolves the correct database from the localdb pool based on
|
|
325
|
+
* the manifest descriptor's scope, falling back to the adapter's configured
|
|
326
|
+
* default when no scope override is needed.
|
|
327
|
+
*
|
|
328
|
+
* For manifests with customTables=true, the migrationKey determines which
|
|
329
|
+
* migrations run against the database (e.g., 'ai' runs AI table migrations).
|
|
330
|
+
*/
|
|
331
|
+
resolveScopedManifestTarget(hints) {
|
|
332
|
+
const config = this.requireConfig();
|
|
333
|
+
let basePath = config.basePath;
|
|
334
|
+
// The configuring manifest or record resolved the workspace and roots on
|
|
335
|
+
// its own runtime (`getAdapterConfig`); nothing here is ambient.
|
|
336
|
+
const { workspacePath: workspaceRoot, roots } = this.configuredScopeInputs();
|
|
337
|
+
if (hints?.scope && hints.scope !== 'auto') {
|
|
338
|
+
const scopePath = hints.scopePaths?.[hints.scope];
|
|
339
|
+
if (scopePath) {
|
|
340
|
+
basePath = scopePath.includes('{')
|
|
341
|
+
? resolveScopePathTemplate(scopePath, workspaceRoot, roots)
|
|
342
|
+
: scopePath;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
switch (hints.scope) {
|
|
346
|
+
case 'global':
|
|
347
|
+
basePath = resolveGlobalStorageBasePath(roots);
|
|
348
|
+
break;
|
|
349
|
+
case 'project':
|
|
350
|
+
case 'local':
|
|
351
|
+
basePath = `${workspaceRoot}/.vibes/storage`;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
const migrationKey = hints?.customTables && hints.migrationKey ? hints.migrationKey : 'storage.localdb';
|
|
357
|
+
// The manifest's own adapterConfig dbName is the contract (e.g. work.items
|
|
358
|
+
// declares work.db). Falling through to the adapter INSTANCE's dbName made
|
|
359
|
+
// the scoped file depend on host bootstrap config — the compiled CLI and
|
|
360
|
+
// the from-source CLI resolved different files for the same manifest
|
|
361
|
+
// (workspace.db vs work.db), splitting the store.
|
|
362
|
+
const dbName = hints?.adapterConfig?.['storage.localdb']?.dbName ?? config.dbName ?? DEFAULT_DB_NAME;
|
|
363
|
+
return { workspaceRoot, basePath, dbPath: `${basePath}/${dbName}`, migrationKey };
|
|
364
|
+
}
|
|
365
|
+
async getScopedDb(target) {
|
|
366
|
+
const { basePath, dbPath, migrationKey } = target;
|
|
367
|
+
// The runtime that configured the target above, read at the same moment.
|
|
368
|
+
const runtime = this.requireRuntime();
|
|
369
|
+
assertStorageRuntimeLive(runtime, 'scoped database work');
|
|
370
|
+
// Always resolve through the `dbPath`-keyed `scopedDatabases` pool below —
|
|
371
|
+
// never shortcut to the adapter's mutable `this.database`/`this.config` via
|
|
372
|
+
// `this.getDbPath()`. Manifests that share this runtime's adapter call
|
|
373
|
+
// `configure()` on it on every access; when two manifests with DIFFERENT
|
|
374
|
+
// scopes resolve concurrently (e.g. the `auth` config manifest and a
|
|
375
|
+
// project-scoped workspace catalog during plugin activation), a sibling's
|
|
376
|
+
// `configure()` could land between this function's `await` points and a
|
|
377
|
+
// later re-read, handing THIS manifest a handle open on a DIFFERENT
|
|
378
|
+
// manifest's file. That was a production bug: `vibes auth status` got a
|
|
379
|
+
// connection to an unrelated project-scoped db and reported "Not
|
|
380
|
+
// authenticated" while the credential row sat in the global-scope file.
|
|
381
|
+
//
|
|
382
|
+
// `dbPath` is a plain local value resolved once by the caller, never
|
|
383
|
+
// re-derived from shared mutable state, so keying everything off it here
|
|
384
|
+
// is race free. `localdb.getDatabase()` already dedupes by
|
|
385
|
+
// `${namespace}:${dbPath}`, so this doesn't open a redundant connection
|
|
386
|
+
// when `dbPath` coincides with the adapter's default.
|
|
387
|
+
const existingScoped = this.scopedDatabases.get(dbPath);
|
|
388
|
+
if (existingScoped) {
|
|
389
|
+
const healthy = existingScoped.healthCheck(runtime);
|
|
390
|
+
if (!healthy) {
|
|
391
|
+
await localdb.releaseDatabase(runtime, 'storage.localdb', dbPath).catch(logReleaseFailure(runtime, dbPath, 'unhealthy'));
|
|
392
|
+
this.scopedDatabases.delete(dbPath);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
let scoped = this.scopedDatabases.get(dbPath);
|
|
396
|
+
if (!scoped) {
|
|
397
|
+
await this.ensureDirectory(runtime, basePath);
|
|
398
|
+
ensureMigrationsRegistered(runtime);
|
|
399
|
+
scoped = await localdb.getDatabase(runtime, 'storage.localdb', dbPath, 'storage-adapter-scoped');
|
|
400
|
+
this.scopedDatabases.set(dbPath, scoped);
|
|
401
|
+
}
|
|
402
|
+
// For custom tables, ensure custom migrations have run on the scoped db
|
|
403
|
+
if (migrationKey !== 'storage.localdb') {
|
|
404
|
+
await this.ensureCustomMigrations(runtime, migrationKey, scoped.getDatabase());
|
|
405
|
+
}
|
|
406
|
+
return scoped.getDatabase();
|
|
407
|
+
}
|
|
408
|
+
getOpenedDatabasePath(connection, fallbackPath) {
|
|
409
|
+
const databases = connection.prepare('PRAGMA database_list').all();
|
|
410
|
+
return databases.find((database) => database.name === 'main')?.file || fallbackPath;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Track which custom migration keys have been applied to which databases
|
|
414
|
+
* to avoid redundant migration attempts.
|
|
415
|
+
*/
|
|
416
|
+
appliedCustomMigrations = new Set();
|
|
417
|
+
/**
|
|
418
|
+
* Ensure custom table migrations have been applied to a specific database.
|
|
419
|
+
* Runs any pending migrations of `migrationKey` against the target
|
|
420
|
+
* connection. A failure that means the migrations are already applied
|
|
421
|
+
* (another registrar, or a statement finding what it creates) counts as
|
|
422
|
+
* applied; any other refuses `INTERNAL` `storage-localdb-migration-failed`,
|
|
423
|
+
* the failure as cause and the key (a manifest-declared identifier) in details.
|
|
424
|
+
*/
|
|
425
|
+
async ensureCustomMigrations(runtime, migrationKey, db) {
|
|
426
|
+
const cacheKey = `${migrationKey}:${db.path}`;
|
|
427
|
+
if (this.appliedCustomMigrations.has(cacheKey))
|
|
428
|
+
return;
|
|
429
|
+
// Run pending migrations directly against the current connection.
|
|
430
|
+
// Avoiding localdb.getDatabase(namespace, dbPath) prevents cross-namespace
|
|
431
|
+
// recovery from invalidating shared handles for this dbPath.
|
|
432
|
+
const migrated = await settle(this.runPendingMigrations(runtime, migrationKey, db));
|
|
433
|
+
if (migrated.failed && !isAppliedMigrationFailure(migrated.cause, migrationKey)) {
|
|
434
|
+
throw new CapabilityError("storage.localdb could not apply a manifest's custom migrations.", 'INTERNAL', {
|
|
435
|
+
reason: 'storage-localdb-migration-failed',
|
|
436
|
+
retryable: false,
|
|
437
|
+
details: { migrationKey },
|
|
438
|
+
cause: migrated.cause
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
this.appliedCustomMigrations.add(cacheKey);
|
|
442
|
+
}
|
|
443
|
+
async runPendingMigrations(runtime, migrationKey, db) {
|
|
444
|
+
if (migrationRegistry.needsMigration(runtime, db, migrationKey)) {
|
|
445
|
+
await migrationRegistry.runMigrations(runtime, db, migrationKey);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
// Document Store
|
|
449
|
+
documentStore(namespace, schema, manifest) {
|
|
450
|
+
const hints = readManifestHints(manifest);
|
|
451
|
+
const target = () => this.resolveScopedManifestTarget(hints);
|
|
452
|
+
const scopedDb = () => this.getScopedDb(target());
|
|
453
|
+
const defaultDbPath = () => this.getDbPath();
|
|
454
|
+
// Determine if this manifest uses a dedicated table
|
|
455
|
+
if (hints?.customTables === true) {
|
|
456
|
+
const tableConfig = hints.adapterConfig?.['storage.localdb'];
|
|
457
|
+
const tableName = tableConfig?.tableName;
|
|
458
|
+
if (!tableName) {
|
|
459
|
+
throw new CapabilityError("A storage manifest with customTables needs a tableName in adapterConfig['storage.localdb'].", 'INVALID_INPUT', { reason: 'storage-localdb-table-name-required', retryable: false, details: { namespace } });
|
|
460
|
+
}
|
|
461
|
+
if (!SQL_IDENTIFIER.test(tableName)) {
|
|
462
|
+
throw new CapabilityError("A storage manifest's dedicated tableName must be a valid SQL identifier.", 'INVALID_INPUT', { reason: 'storage-localdb-table-name-invalid', retryable: false, details: { namespace } });
|
|
463
|
+
}
|
|
464
|
+
return dedicatedTableStore(schema, tableName, tableConfig?.transforms, scopedDb, defaultDbPath);
|
|
465
|
+
}
|
|
466
|
+
// Default path: generic vibes_documents blob store
|
|
467
|
+
/**
|
|
468
|
+
* The stored JSON text of this namespace's document, or `null` when there
|
|
469
|
+
* is none. A read probe must not materialize the database file: a missing
|
|
470
|
+
* store answers null from the resolved path alone (pinned by
|
|
471
|
+
* localdb.adapter.impl.test.ts "does not create a database ...").
|
|
472
|
+
*/
|
|
473
|
+
const readDocumentText = async () => {
|
|
474
|
+
const runtime = this.requireRuntime();
|
|
475
|
+
assertStorageRuntimeLive(runtime, 'document reads');
|
|
476
|
+
const resolved = target();
|
|
477
|
+
if (!(await this.databaseFileExists(runtime, resolved.dbPath)))
|
|
478
|
+
return null;
|
|
479
|
+
const db = await this.getScopedDb(resolved);
|
|
480
|
+
const row = db
|
|
481
|
+
.prepare('SELECT data FROM vibes_documents WHERE namespace = ?')
|
|
482
|
+
.get(namespace);
|
|
483
|
+
return row ? row.data : null;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Immediate child namespaces, without reading their documents. The
|
|
487
|
+
* document store is namespace-addressed (`vibes_documents` keyed by
|
|
488
|
+
* `namespace`), so a `SELECT DISTINCT` restricted to exact children of
|
|
489
|
+
* `namespace/` is the full discovery contract. Grandchildren and other
|
|
490
|
+
* families are excluded by the escaped `LIKE` pair, and a missing
|
|
491
|
+
* store answers `[]` like the read probe above.
|
|
492
|
+
*/
|
|
493
|
+
const discoverChildNamespaces = async () => {
|
|
494
|
+
const runtime = this.requireRuntime();
|
|
495
|
+
assertStorageRuntimeLive(runtime, 'namespace discovery');
|
|
496
|
+
const resolved = target();
|
|
497
|
+
if (!(await this.databaseFileExists(runtime, resolved.dbPath)))
|
|
498
|
+
return [];
|
|
499
|
+
const db = await this.getScopedDb(resolved);
|
|
500
|
+
const prefix = `${namespace}/`;
|
|
501
|
+
// SAFETY: The query selects only the TEXT namespace column; LIKE excludes null values.
|
|
502
|
+
const rows = db
|
|
503
|
+
.prepare(`SELECT DISTINCT namespace FROM vibes_documents
|
|
504
|
+
WHERE namespace LIKE ? ESCAPE '\\'
|
|
505
|
+
AND namespace NOT LIKE ? ESCAPE '\\'`)
|
|
506
|
+
.all(`${escapeSqlLike(prefix)}%`, `${escapeSqlLike(prefix)}%/%`);
|
|
507
|
+
const children = rows
|
|
508
|
+
.map((row) => row.namespace)
|
|
509
|
+
.filter((child) => child.length > prefix.length)
|
|
510
|
+
.sort();
|
|
511
|
+
return [...new Set(children)];
|
|
512
|
+
};
|
|
513
|
+
const revisionDatabase = async () => {
|
|
514
|
+
const runtime = this.requireRuntime();
|
|
515
|
+
assertStorageRuntimeLive(runtime, 'document revision reads');
|
|
516
|
+
const resolved = target();
|
|
517
|
+
if (!(await this.databaseFileExists(runtime, resolved.dbPath)))
|
|
518
|
+
return null;
|
|
519
|
+
return this.getScopedDb(resolved);
|
|
520
|
+
};
|
|
521
|
+
const revisionMetadata = async () => {
|
|
522
|
+
const db = await revisionDatabase();
|
|
523
|
+
if (!db)
|
|
524
|
+
return null;
|
|
525
|
+
const row = db.prepare('SELECT __vibes_revision AS revision FROM vibes_documents WHERE namespace = ?').get(namespace);
|
|
526
|
+
return row ? DocumentRevisionMetadataSchema.parse(row) : null;
|
|
527
|
+
};
|
|
528
|
+
return {
|
|
529
|
+
revisions: {
|
|
530
|
+
metadata: revisionMetadata,
|
|
531
|
+
readAtRevision: async (expected, options) => {
|
|
532
|
+
const revision = DocumentRevisionSchema.parse(expected);
|
|
533
|
+
if (options?.signal?.aborted)
|
|
534
|
+
throw new CapabilityError('The document read was cancelled.', 'CANCELLED', { reason: 'storage-load-cancelled' });
|
|
535
|
+
const db = await revisionDatabase();
|
|
536
|
+
if (options?.signal?.aborted)
|
|
537
|
+
throw new CapabilityError('The document read was cancelled.', 'CANCELLED', { reason: 'storage-load-cancelled' });
|
|
538
|
+
if (!db)
|
|
539
|
+
return { status: 'not-found' };
|
|
540
|
+
const row = db.prepare('SELECT data FROM vibes_documents WHERE namespace = ? AND __vibes_revision = ?').get(namespace, revision);
|
|
541
|
+
if (row)
|
|
542
|
+
return { status: 'read', revision, value: schema.parse(JSON.parse(row.data)) };
|
|
543
|
+
const current = await revisionMetadata();
|
|
544
|
+
return current ? { status: 'changed', revision: current.revision } : { status: 'not-found' };
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
async load() {
|
|
548
|
+
const text = await readDocumentText();
|
|
549
|
+
return text === null ? null : schema.parse(JSON.parse(text));
|
|
550
|
+
},
|
|
551
|
+
async loadStored() {
|
|
552
|
+
const text = await readDocumentText();
|
|
553
|
+
return text === null ? null : readStoredLayer(schema, JSON.parse(text));
|
|
554
|
+
},
|
|
555
|
+
async save(data) {
|
|
556
|
+
// Persist the caller's validated input, never the parse output (defaults are read-time only).
|
|
557
|
+
const validated = validateForPersist(schema, data);
|
|
558
|
+
const db = await scopedDb();
|
|
559
|
+
db.prepare(`INSERT INTO vibes_documents (namespace, data, updated_at)
|
|
560
|
+
VALUES (?, ?, datetime('now'))
|
|
561
|
+
ON CONFLICT(namespace) DO UPDATE SET data = excluded.data, updated_at = datetime('now')`).run(namespace, JSON.stringify(validated));
|
|
562
|
+
},
|
|
563
|
+
/**
|
|
564
|
+
* Optimistic read-transform-write. A write that loses to a concurrent
|
|
565
|
+
* writer re-reads and retries; after DOCUMENT_UPDATE_ATTEMPTS lost
|
|
566
|
+
* rounds it refuses `CONFLICT` `localdb-document-contention`
|
|
567
|
+
* (retryable: the caller may try again once the contention passes).
|
|
568
|
+
*/
|
|
569
|
+
async update(transform) {
|
|
570
|
+
const db = await scopedDb();
|
|
571
|
+
for (let round = 0; round < DOCUMENT_UPDATE_ATTEMPTS; round++) {
|
|
572
|
+
const row = db
|
|
573
|
+
.prepare('SELECT data FROM vibes_documents WHERE namespace = ?')
|
|
574
|
+
.get(namespace);
|
|
575
|
+
const current = row ? schema.parse(JSON.parse(row.data)) : null;
|
|
576
|
+
// Persist the transform's validated result; hand the caller the parsed value.
|
|
577
|
+
const next = validateForPersist(schema, await transform(current));
|
|
578
|
+
const updated = schema.parse(next);
|
|
579
|
+
const serialized = JSON.stringify(next);
|
|
580
|
+
const result = row
|
|
581
|
+
? db
|
|
582
|
+
.prepare(`UPDATE vibes_documents
|
|
583
|
+
SET data = ?, updated_at = datetime('now')
|
|
584
|
+
WHERE namespace = ? AND data = ?`)
|
|
585
|
+
.run(serialized, namespace, row.data)
|
|
586
|
+
: db
|
|
587
|
+
.prepare(`INSERT INTO vibes_documents (namespace, data, updated_at)
|
|
588
|
+
VALUES (?, ?, datetime('now'))
|
|
589
|
+
ON CONFLICT(namespace) DO NOTHING`)
|
|
590
|
+
.run(namespace, serialized);
|
|
591
|
+
if (result.changes > 0)
|
|
592
|
+
return updated;
|
|
593
|
+
}
|
|
594
|
+
throw new CapabilityError('An atomic document update lost to concurrent writers on every retry.', 'CONFLICT', {
|
|
595
|
+
reason: 'localdb-document-contention',
|
|
596
|
+
retryable: true,
|
|
597
|
+
details: { namespace, attempts: DOCUMENT_UPDATE_ATTEMPTS },
|
|
598
|
+
recoveryHint: 'Retry the update once the concurrent writes settle.'
|
|
599
|
+
});
|
|
600
|
+
},
|
|
601
|
+
async exists() {
|
|
602
|
+
return (await readDocumentText()) !== null;
|
|
603
|
+
},
|
|
604
|
+
async delete() {
|
|
605
|
+
const db = await scopedDb();
|
|
606
|
+
db.prepare('DELETE FROM vibes_documents WHERE namespace = ?').run(namespace);
|
|
607
|
+
},
|
|
608
|
+
listChildNamespaces: discoverChildNamespaces,
|
|
609
|
+
getPath() {
|
|
610
|
+
return `localdb://${defaultDbPath()}/${namespace}`;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
// Key-Value Store
|
|
615
|
+
keyValueStore(namespace, keySchema, valueSchema) {
|
|
616
|
+
const open = () => this.openDefaultDatabase();
|
|
617
|
+
const reportingRuntime = () => this.requireRuntime();
|
|
618
|
+
const serializeKey = (key) => {
|
|
619
|
+
const validated = keySchema.parse(key);
|
|
620
|
+
const asText = KeyTextSchema.safeParse(validated);
|
|
621
|
+
return asText.success ? asText.data : JSON.stringify(validated);
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* The key a stored row names, or `undefined` for a row that does not
|
|
625
|
+
* satisfy the key schema (skipped, as before). A string key is stored as
|
|
626
|
+
* its own text; any other key as JSON (`serializeKey`). A row whose text
|
|
627
|
+
* fits neither is malformed against the declared contract: it is skipped
|
|
628
|
+
* and reported once on the runtime the call serves.
|
|
629
|
+
*/
|
|
630
|
+
const decodeKey = (stored) => {
|
|
631
|
+
const asText = keySchema.safeParse(stored);
|
|
632
|
+
if (asText.success)
|
|
633
|
+
return asText.data;
|
|
634
|
+
const decoded = attempt(() => JSON.parse(stored));
|
|
635
|
+
if (decoded.failed) {
|
|
636
|
+
const logger = getLogger('storage:localdb-adapter', reportingRuntime());
|
|
637
|
+
logger.warn('storage.localdb: skipped a key-value row whose key is neither text nor JSON', {
|
|
638
|
+
namespace,
|
|
639
|
+
error: valueFreeFailure(decoded.cause)
|
|
640
|
+
});
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
643
|
+
const asJson = keySchema.safeParse(decoded.value);
|
|
644
|
+
return asJson.success ? asJson.data : undefined;
|
|
645
|
+
};
|
|
646
|
+
const cleanExpired = (db) => {
|
|
647
|
+
db.prepare(`DELETE FROM vibes_kv WHERE namespace = ? AND expires_at IS NOT NULL AND expires_at < ?`).run(namespace, Date.now());
|
|
648
|
+
};
|
|
649
|
+
const get = async (key) => {
|
|
650
|
+
const db = await open();
|
|
651
|
+
cleanExpired(db);
|
|
652
|
+
const row = db
|
|
653
|
+
.prepare(`SELECT value FROM vibes_kv WHERE namespace = ? AND key = ?`)
|
|
654
|
+
.get(namespace, serializeKey(key));
|
|
655
|
+
if (!row)
|
|
656
|
+
return null;
|
|
657
|
+
return valueSchema.parse(JSON.parse(row.value));
|
|
658
|
+
};
|
|
659
|
+
const set = async (key, value, options) => {
|
|
660
|
+
const db = await open();
|
|
661
|
+
const k = serializeKey(key);
|
|
662
|
+
// Handle nx/xx options
|
|
663
|
+
if (options?.nx || options?.xx) {
|
|
664
|
+
const exists = db
|
|
665
|
+
.prepare(`SELECT COUNT(*) as count FROM vibes_kv WHERE namespace = ? AND key = ? AND (expires_at IS NULL OR expires_at > ?)`)
|
|
666
|
+
.get(namespace, k, Date.now())?.count ?? 0;
|
|
667
|
+
if (options.nx && exists > 0)
|
|
668
|
+
return;
|
|
669
|
+
if (options.xx && exists === 0)
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
const validated = valueSchema.parse(value);
|
|
673
|
+
const expiresAt = options?.ttl ? Date.now() + options.ttl : null;
|
|
674
|
+
db.prepare(`INSERT INTO vibes_kv (namespace, key, value, expires_at)
|
|
675
|
+
VALUES (?, ?, ?, ?)
|
|
676
|
+
ON CONFLICT(namespace, key) DO UPDATE SET value = excluded.value, expires_at = excluded.expires_at`).run(namespace, k, JSON.stringify(validated), expiresAt);
|
|
677
|
+
};
|
|
678
|
+
const remove = async (key) => {
|
|
679
|
+
const db = await open();
|
|
680
|
+
const result = db
|
|
681
|
+
.prepare('DELETE FROM vibes_kv WHERE namespace = ? AND key = ?')
|
|
682
|
+
.run(namespace, serializeKey(key));
|
|
683
|
+
return result.changes > 0;
|
|
684
|
+
};
|
|
685
|
+
return {
|
|
686
|
+
get,
|
|
687
|
+
set,
|
|
688
|
+
delete: remove,
|
|
689
|
+
async has(key) {
|
|
690
|
+
const db = await open();
|
|
691
|
+
cleanExpired(db);
|
|
692
|
+
const row = db
|
|
693
|
+
.prepare(`SELECT COUNT(*) as count FROM vibes_kv WHERE namespace = ? AND key = ? AND (expires_at IS NULL OR expires_at > ?)`)
|
|
694
|
+
.get(namespace, serializeKey(key), Date.now());
|
|
695
|
+
return (row?.count ?? 0) > 0;
|
|
696
|
+
},
|
|
697
|
+
async getMany(keys) {
|
|
698
|
+
const result = new Map();
|
|
699
|
+
for (const key of keys) {
|
|
700
|
+
const value = await get(key);
|
|
701
|
+
if (value !== null) {
|
|
702
|
+
result.set(key, value);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return result;
|
|
706
|
+
},
|
|
707
|
+
async setMany(entries) {
|
|
708
|
+
for (const [key, value] of entries) {
|
|
709
|
+
await set(key, value);
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
async deleteMany(keys) {
|
|
713
|
+
let count = 0;
|
|
714
|
+
for (const key of keys) {
|
|
715
|
+
if (await remove(key))
|
|
716
|
+
count++;
|
|
717
|
+
}
|
|
718
|
+
return count;
|
|
719
|
+
},
|
|
720
|
+
async *keys(pattern) {
|
|
721
|
+
const db = await open();
|
|
722
|
+
cleanExpired(db);
|
|
723
|
+
const query = pattern
|
|
724
|
+
? `SELECT key FROM vibes_kv WHERE namespace = ? AND key LIKE ? AND (expires_at IS NULL OR expires_at > ?)`
|
|
725
|
+
: `SELECT key FROM vibes_kv WHERE namespace = ? AND (expires_at IS NULL OR expires_at > ?)`;
|
|
726
|
+
const rows = pattern
|
|
727
|
+
? db.prepare(query).all(namespace, `%${pattern}%`, Date.now())
|
|
728
|
+
: db.prepare(query).all(namespace, Date.now());
|
|
729
|
+
for (const row of rows) {
|
|
730
|
+
const key = decodeKey(row.key);
|
|
731
|
+
if (key !== undefined)
|
|
732
|
+
yield key;
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
async *entries(pattern) {
|
|
736
|
+
const db = await open();
|
|
737
|
+
cleanExpired(db);
|
|
738
|
+
const query = pattern
|
|
739
|
+
? `SELECT key, value FROM vibes_kv WHERE namespace = ? AND key LIKE ? AND (expires_at IS NULL OR expires_at > ?)`
|
|
740
|
+
: `SELECT key, value FROM vibes_kv WHERE namespace = ? AND (expires_at IS NULL OR expires_at > ?)`;
|
|
741
|
+
const rows = pattern
|
|
742
|
+
? db.prepare(query).all(namespace, `%${pattern}%`, Date.now())
|
|
743
|
+
: db.prepare(query).all(namespace, Date.now());
|
|
744
|
+
for (const row of rows) {
|
|
745
|
+
const key = decodeKey(row.key);
|
|
746
|
+
if (key === undefined)
|
|
747
|
+
continue;
|
|
748
|
+
const valueResult = valueSchema.safeParse(JSON.parse(row.value));
|
|
749
|
+
if (!valueResult.success)
|
|
750
|
+
continue;
|
|
751
|
+
yield [key, valueResult.data];
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
async count(pattern) {
|
|
755
|
+
const db = await open();
|
|
756
|
+
cleanExpired(db);
|
|
757
|
+
const query = pattern
|
|
758
|
+
? `SELECT COUNT(*) as count FROM vibes_kv WHERE namespace = ? AND key LIKE ? AND (expires_at IS NULL OR expires_at > ?)`
|
|
759
|
+
: `SELECT COUNT(*) as count FROM vibes_kv WHERE namespace = ? AND (expires_at IS NULL OR expires_at > ?)`;
|
|
760
|
+
const row = pattern
|
|
761
|
+
? db.prepare(query).get(namespace, `%${pattern}%`, Date.now())
|
|
762
|
+
: db.prepare(query).get(namespace, Date.now());
|
|
763
|
+
return row?.count ?? 0;
|
|
764
|
+
},
|
|
765
|
+
async clear() {
|
|
766
|
+
const db = await open();
|
|
767
|
+
db.prepare('DELETE FROM vibes_kv WHERE namespace = ?').run(namespace);
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
// Record (New Pattern)
|
|
772
|
+
/**
|
|
773
|
+
* Get a storage record interface for CRUD operations on a single table.
|
|
774
|
+
*
|
|
775
|
+
* This is the new pattern for storage that properly integrates with the runtime system.
|
|
776
|
+
* Use this for modules that need structured storage with relations and queries.
|
|
777
|
+
*
|
|
778
|
+
* @param descriptor - Storage record descriptor
|
|
779
|
+
* @returns Storage record interface with CRUD operations
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
* ```typescript
|
|
783
|
+
* const todos = adapter.record(todoDescriptor);
|
|
784
|
+
* await todos.create({ sessionId: '...', title: '...' });
|
|
785
|
+
* const allTodos = await todos.list({ where: { sessionId: '...' }});
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
record(descriptor, context) {
|
|
789
|
+
// A record this adapter hands out is bound to the runtime its caller
|
|
790
|
+
// names: that runtime's roots place the record's files and its HookBus
|
|
791
|
+
// carries its events.
|
|
792
|
+
if (!context?.runtime) {
|
|
793
|
+
throw new CapabilityError('A storage.localdb record needs the runtime context it will read and write through.', 'INVALID_INPUT', { reason: 'storage-record-context-required', retryable: false, details: { recordId: descriptor.id } });
|
|
794
|
+
}
|
|
795
|
+
return new StorageRecord(descriptor, context);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Create FTS virtual table for a record descriptor
|
|
799
|
+
*/
|
|
800
|
+
createFtsTables(descriptor, db) {
|
|
801
|
+
if (!descriptor.fts)
|
|
802
|
+
return;
|
|
803
|
+
const ftsConfig = descriptor.fts;
|
|
804
|
+
const ftsTable = ftsConfig.tableName || `${descriptor.tableName}_fts`;
|
|
805
|
+
const fields = ftsConfig.fields;
|
|
806
|
+
const tokenizer = ftsConfig.tokenizer || 'unicode61';
|
|
807
|
+
db.exec(`
|
|
808
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS ${ftsTable} USING fts5(
|
|
809
|
+
${fields.join(', ')},
|
|
810
|
+
content='${descriptor.tableName}',
|
|
811
|
+
tokenize='${tokenizer}'
|
|
812
|
+
)
|
|
813
|
+
`);
|
|
814
|
+
db.exec(`
|
|
815
|
+
CREATE TRIGGER IF NOT EXISTS ${descriptor.tableName}_ai AFTER INSERT ON ${descriptor.tableName} BEGIN
|
|
816
|
+
INSERT INTO ${ftsTable}(rowid, ${fields.join(', ')})
|
|
817
|
+
VALUES (NEW.rowid, ${fields.map((f) => `NEW.${f}`).join(', ')});
|
|
818
|
+
END
|
|
819
|
+
`);
|
|
820
|
+
db.exec(`
|
|
821
|
+
CREATE TRIGGER IF NOT EXISTS ${descriptor.tableName}_ad AFTER DELETE ON ${descriptor.tableName} BEGIN
|
|
822
|
+
INSERT INTO ${ftsTable}(${ftsTable}, rowid, ${fields.join(', ')})
|
|
823
|
+
VALUES('delete', OLD.rowid, ${fields.map((f) => `OLD.${f}`).join(', ')});
|
|
824
|
+
END
|
|
825
|
+
`);
|
|
826
|
+
db.exec(`
|
|
827
|
+
CREATE TRIGGER IF NOT EXISTS ${descriptor.tableName}_au AFTER UPDATE ON ${descriptor.tableName} BEGIN
|
|
828
|
+
INSERT INTO ${ftsTable}(${ftsTable}, rowid, ${fields.join(', ')})
|
|
829
|
+
VALUES('delete', OLD.rowid, ${fields.map((f) => `OLD.${f}`).join(', ')});
|
|
830
|
+
INSERT INTO ${ftsTable}(rowid, ${fields.join(', ')})
|
|
831
|
+
VALUES (NEW.rowid, ${fields.map((f) => `NEW.${f}`).join(', ')});
|
|
832
|
+
END
|
|
833
|
+
`);
|
|
834
|
+
}
|
|
835
|
+
// Repository (Legacy Pattern)
|
|
836
|
+
repository(tableName, schema, options) {
|
|
837
|
+
const open = () => this.openDefaultDatabase();
|
|
838
|
+
const primaryKey = options?.primaryKey ?? 'id';
|
|
839
|
+
const autoId = options?.autoId ?? true;
|
|
840
|
+
const autoTimestamps = options?.autoTimestamps ?? true;
|
|
841
|
+
const generateId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
842
|
+
/** A caller's create or update input, read once through the adapters' guard. */
|
|
843
|
+
const readInput = (data) => parseAdapterInput(RepositoryFieldsSchema, data, {
|
|
844
|
+
message: 'storage.localdb repository input must be an object of fields.',
|
|
845
|
+
code: 'INVALID_INPUT',
|
|
846
|
+
reason: 'storage-localdb-repository-input-invalid',
|
|
847
|
+
details: { tableName }
|
|
848
|
+
});
|
|
849
|
+
const stamp = (fields, isNew) => {
|
|
850
|
+
if (!autoTimestamps)
|
|
851
|
+
return fields;
|
|
852
|
+
const now = new Date().toISOString();
|
|
853
|
+
return isNew ? { ...fields, createdAt: now, updatedAt: now } : { ...fields, updatedAt: now };
|
|
854
|
+
};
|
|
855
|
+
/** The primary-key value a row or input names, as the id column stores it. */
|
|
856
|
+
const keyOf = (fields, field = primaryKey) => {
|
|
857
|
+
const key = RepositoryKeySchema.safeParse(fields[field]);
|
|
858
|
+
return key.success ? String(key.data) : undefined;
|
|
859
|
+
};
|
|
860
|
+
const readAll = async () => {
|
|
861
|
+
const db = await open();
|
|
862
|
+
const rows = db
|
|
863
|
+
.prepare('SELECT data FROM vibes_repository WHERE tablename = ?')
|
|
864
|
+
.all(tableName);
|
|
865
|
+
return rows.map((row) => schema.parse(JSON.parse(row.data)));
|
|
866
|
+
};
|
|
867
|
+
return {
|
|
868
|
+
// Create
|
|
869
|
+
async create(data) {
|
|
870
|
+
const db = await open();
|
|
871
|
+
const fields = readInput(data);
|
|
872
|
+
const id = keyOf(fields) ?? (autoId ? generateId() : undefined);
|
|
873
|
+
if (id === undefined) {
|
|
874
|
+
throw new CapabilityError('A storage.localdb repository record names no primary key value.', 'INVALID_INPUT', {
|
|
875
|
+
reason: 'storage-localdb-primary-key-missing',
|
|
876
|
+
retryable: false,
|
|
877
|
+
details: { tableName, primaryKey }
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
const validated = schema.parse(stamp({ ...fields, [primaryKey]: id }, true));
|
|
881
|
+
db.prepare(`INSERT INTO vibes_repository (tablename, id, data, created_at, updated_at)
|
|
882
|
+
VALUES (?, ?, ?, datetime('now'), datetime('now'))`).run(tableName, id, JSON.stringify(validated));
|
|
883
|
+
return validated;
|
|
884
|
+
},
|
|
885
|
+
createMany(data) {
|
|
886
|
+
return Promise.all(data.map((d) => this.create(d)));
|
|
887
|
+
},
|
|
888
|
+
// Read
|
|
889
|
+
async get(id) {
|
|
890
|
+
const db = await open();
|
|
891
|
+
const row = db
|
|
892
|
+
.prepare('SELECT data FROM vibes_repository WHERE tablename = ? AND id = ?')
|
|
893
|
+
.get(tableName, id);
|
|
894
|
+
if (!row)
|
|
895
|
+
return null;
|
|
896
|
+
return schema.parse(JSON.parse(row.data));
|
|
897
|
+
},
|
|
898
|
+
async getOrThrow(id) {
|
|
899
|
+
const data = await this.get(id);
|
|
900
|
+
if (!data) {
|
|
901
|
+
throw new CapabilityError('No storage.localdb repository record has that id.', 'NOT_FOUND', {
|
|
902
|
+
reason: 'record-absent',
|
|
903
|
+
retryable: false,
|
|
904
|
+
details: { tableName, id }
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
return data;
|
|
908
|
+
},
|
|
909
|
+
async getMany(ids) {
|
|
910
|
+
const result = new Map();
|
|
911
|
+
for (const id of ids) {
|
|
912
|
+
const data = await this.get(id);
|
|
913
|
+
if (data)
|
|
914
|
+
result.set(id, data);
|
|
915
|
+
}
|
|
916
|
+
return result;
|
|
917
|
+
},
|
|
918
|
+
async list(opts) {
|
|
919
|
+
const all = await readAll();
|
|
920
|
+
const offset = opts?.offset ?? 0;
|
|
921
|
+
const limit = opts?.limit ?? 100;
|
|
922
|
+
if (opts?.orderBy)
|
|
923
|
+
sortRepositoryRows(all, opts.orderBy);
|
|
924
|
+
return {
|
|
925
|
+
data: all.slice(offset, offset + limit),
|
|
926
|
+
total: all.length,
|
|
927
|
+
hasMore: offset + limit < all.length
|
|
928
|
+
};
|
|
929
|
+
},
|
|
930
|
+
async find(query, opts) {
|
|
931
|
+
let filtered = (await readAll()).filter((row) => matchesRepositoryQuery(row, query));
|
|
932
|
+
if (opts?.orderBy)
|
|
933
|
+
sortRepositoryRows(filtered, opts.orderBy);
|
|
934
|
+
// Pagination
|
|
935
|
+
if (opts?.offset || opts?.limit) {
|
|
936
|
+
const offset = opts.offset ?? 0;
|
|
937
|
+
const limit = opts.limit ?? 100;
|
|
938
|
+
filtered = filtered.slice(offset, offset + limit);
|
|
939
|
+
}
|
|
940
|
+
return filtered;
|
|
941
|
+
},
|
|
942
|
+
async findOne(query) {
|
|
943
|
+
const results = await this.find(query, { limit: 1 });
|
|
944
|
+
return results[0] ?? null;
|
|
945
|
+
},
|
|
946
|
+
async count(query) {
|
|
947
|
+
if (!query) {
|
|
948
|
+
const db = await open();
|
|
949
|
+
const row = db
|
|
950
|
+
.prepare('SELECT COUNT(*) as count FROM vibes_repository WHERE tablename = ?')
|
|
951
|
+
.get(tableName);
|
|
952
|
+
return row?.count ?? 0;
|
|
953
|
+
}
|
|
954
|
+
return (await readAll()).filter((row) => matchesRepositoryQuery(row, query)).length;
|
|
955
|
+
},
|
|
956
|
+
async exists(id) {
|
|
957
|
+
const db = await open();
|
|
958
|
+
const row = db
|
|
959
|
+
.prepare('SELECT COUNT(*) as count FROM vibes_repository WHERE tablename = ? AND id = ?')
|
|
960
|
+
.get(tableName, id);
|
|
961
|
+
return (row?.count ?? 0) > 0;
|
|
962
|
+
},
|
|
963
|
+
async existsWhere(query) {
|
|
964
|
+
return (await this.count(query)) > 0;
|
|
965
|
+
},
|
|
966
|
+
// Update
|
|
967
|
+
async update(id, data) {
|
|
968
|
+
const db = await open();
|
|
969
|
+
const changes = readInput(data);
|
|
970
|
+
const existing = await this.get(id);
|
|
971
|
+
if (!existing)
|
|
972
|
+
return null;
|
|
973
|
+
const validated = schema.parse(stamp({ ...repositoryFieldsOf(existing), ...changes }, false));
|
|
974
|
+
db.prepare(`UPDATE vibes_repository SET data = ?, updated_at = datetime('now') WHERE tablename = ? AND id = ?`).run(JSON.stringify(validated), tableName, id);
|
|
975
|
+
return validated;
|
|
976
|
+
},
|
|
977
|
+
async updateOrThrow(id, data) {
|
|
978
|
+
const result = await this.update(id, data);
|
|
979
|
+
if (!result) {
|
|
980
|
+
throw new CapabilityError('No storage.localdb repository record has that id.', 'NOT_FOUND', {
|
|
981
|
+
reason: 'record-absent',
|
|
982
|
+
retryable: false,
|
|
983
|
+
details: { tableName, id }
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
return result;
|
|
987
|
+
},
|
|
988
|
+
async updateMany(query, data) {
|
|
989
|
+
const matching = await this.find(query);
|
|
990
|
+
let count = 0;
|
|
991
|
+
for (const record of matching) {
|
|
992
|
+
const id = keyOf(repositoryFieldsOf(record));
|
|
993
|
+
if (id === undefined)
|
|
994
|
+
continue;
|
|
995
|
+
await this.update(id, data);
|
|
996
|
+
count++;
|
|
997
|
+
}
|
|
998
|
+
return count;
|
|
999
|
+
},
|
|
1000
|
+
async upsert(data, uniqueKey) {
|
|
1001
|
+
const keyField = uniqueKey === undefined ? primaryKey : String(uniqueKey);
|
|
1002
|
+
const id = keyOf(readInput(data), keyField);
|
|
1003
|
+
if (id !== undefined && (await this.exists(id))) {
|
|
1004
|
+
const updated = await this.update(id, data);
|
|
1005
|
+
if (updated)
|
|
1006
|
+
return updated;
|
|
1007
|
+
}
|
|
1008
|
+
return this.create(data);
|
|
1009
|
+
},
|
|
1010
|
+
// Delete
|
|
1011
|
+
async delete(id) {
|
|
1012
|
+
const db = await open();
|
|
1013
|
+
const result = db
|
|
1014
|
+
.prepare('DELETE FROM vibes_repository WHERE tablename = ? AND id = ?')
|
|
1015
|
+
.run(tableName, id);
|
|
1016
|
+
return result.changes > 0;
|
|
1017
|
+
},
|
|
1018
|
+
async deleteMany(ids) {
|
|
1019
|
+
let count = 0;
|
|
1020
|
+
for (const id of ids) {
|
|
1021
|
+
if (await this.delete(id))
|
|
1022
|
+
count++;
|
|
1023
|
+
}
|
|
1024
|
+
return count;
|
|
1025
|
+
},
|
|
1026
|
+
async deleteWhere(query) {
|
|
1027
|
+
const matching = await this.find(query);
|
|
1028
|
+
let count = 0;
|
|
1029
|
+
for (const record of matching) {
|
|
1030
|
+
const id = keyOf(repositoryFieldsOf(record));
|
|
1031
|
+
if (id !== undefined && (await this.delete(id)))
|
|
1032
|
+
count++;
|
|
1033
|
+
}
|
|
1034
|
+
return count;
|
|
1035
|
+
},
|
|
1036
|
+
// Meta
|
|
1037
|
+
meta() {
|
|
1038
|
+
return {
|
|
1039
|
+
tableName,
|
|
1040
|
+
schema,
|
|
1041
|
+
primaryKey,
|
|
1042
|
+
autoFields: {
|
|
1043
|
+
id: autoId,
|
|
1044
|
+
createdAt: autoTimestamps,
|
|
1045
|
+
updatedAt: autoTimestamps
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
// Database Access (public API for StorageRecord)
|
|
1052
|
+
async ensureReady() {
|
|
1053
|
+
await this.ensureInitialized();
|
|
1054
|
+
}
|
|
1055
|
+
getDatabaseConnection() {
|
|
1056
|
+
return this.defaultConnection();
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Get the scoped database connection for a specific manifest.
|
|
1060
|
+
*
|
|
1061
|
+
* Custom-table manifests (e.g. work.items, knowledge bases) live in
|
|
1062
|
+
* dedicated SQLite files under scope-specific paths. This method
|
|
1063
|
+
* resolves the right file, registers the manifest's custom
|
|
1064
|
+
* migrations, and returns the open connection. The plain
|
|
1065
|
+
* `getDatabaseConnection()` always returns the adapter's default
|
|
1066
|
+
* database, which is the wrong target for scoped manifests.
|
|
1067
|
+
*/
|
|
1068
|
+
async getScopedDatabaseConnection(manifest) {
|
|
1069
|
+
return this.getScopedDb(this.resolveScopedManifestTarget(readManifestHints(manifest)));
|
|
1070
|
+
}
|
|
1071
|
+
/** Open a manifest's scoped connection and report the immutable target it used. */
|
|
1072
|
+
async getScopedDatabaseConnectionWithIdentity(manifest) {
|
|
1073
|
+
const target = this.resolveScopedManifestTarget(readManifestHints(manifest));
|
|
1074
|
+
const connection = await this.getScopedDb(target);
|
|
1075
|
+
const { workspaceRoot } = target;
|
|
1076
|
+
const dbPath = this.getOpenedDatabasePath(connection, target.dbPath);
|
|
1077
|
+
return { connection, identity: { workspaceRoot, dbPath } };
|
|
1078
|
+
}
|
|
1079
|
+
/** Resolve the same manifest target used by getScopedDatabaseConnection(). */
|
|
1080
|
+
async getScopedDatabaseConnectionIdentity(manifest) {
|
|
1081
|
+
const target = this.resolveScopedManifestTarget(readManifestHints(manifest));
|
|
1082
|
+
const connection = await this.getScopedDb(target);
|
|
1083
|
+
return {
|
|
1084
|
+
workspaceRoot: target.workspaceRoot,
|
|
1085
|
+
dbPath: this.getOpenedDatabasePath(connection, target.dbPath)
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Get the database connection for a `storage/record`'s already-resolved
|
|
1090
|
+
* `{ basePath, dbName }` target — the `StorageRecord`/base.ts analogue of
|
|
1091
|
+
* `getScopedDatabaseConnection` above.
|
|
1092
|
+
*
|
|
1093
|
+
* Every `StorageRecord` on this runtime that resolves `storage.localdb`
|
|
1094
|
+
* shares this adapter, and `configure()` re-points its `this.config` on
|
|
1095
|
+
* every call. Two records with different descriptors (different
|
|
1096
|
+
* `scope`/`dbName`) resolved concurrently — e.g. during runtime plugin
|
|
1097
|
+
* activation — could otherwise race: `getDatabaseConnection()` reads
|
|
1098
|
+
* whichever `this.database` is installed at the moment it's called, which
|
|
1099
|
+
* may belong to a SIBLING record's dbName. Live forensics of that failure
|
|
1100
|
+
* mode: stray `brain_state`/`session_state` tables inside `awareness.db`,
|
|
1101
|
+
* frozen partial `awareness_*` tables inside `sessions.db`.
|
|
1102
|
+
*
|
|
1103
|
+
* `basePath`/`dbName` are the CALLER's already-resolved values (computed
|
|
1104
|
+
* from the record's own immutable descriptor/context, never from this
|
|
1105
|
+
* adapter's mutable fields), and `dbPath` is deterministic from them
|
|
1106
|
+
* alone — so pooling by `dbPath` here (mirroring `scopedDatabases` above)
|
|
1107
|
+
* is race-free regardless of what any other record's concurrent
|
|
1108
|
+
* `configure()` call does to `this.config` in between.
|
|
1109
|
+
*
|
|
1110
|
+
* Deliberately NOT the same pool/formula as `getScopedDb` (used by
|
|
1111
|
+
* `getScopedDatabaseConnection`): that method re-derives basePath from a
|
|
1112
|
+
* MANIFEST's scope, which is a different mapping than a record's own
|
|
1113
|
+
* `StorageRecord.getBasePath()` — reusing it here would silently retarget
|
|
1114
|
+
* every existing local record store (e.g. `~/.vibes/awareness.db`) at a
|
|
1115
|
+
* different, empty file.
|
|
1116
|
+
*/
|
|
1117
|
+
async getRecordDatabaseConnection(config) {
|
|
1118
|
+
assertStorageRuntimeLive(config.runtime, 'record database work');
|
|
1119
|
+
const dbPath = `${config.basePath}/${config.dbName ?? DEFAULT_DB_NAME}`;
|
|
1120
|
+
const existing = this.recordDatabases.get(dbPath);
|
|
1121
|
+
if (existing) {
|
|
1122
|
+
const healthy = existing.healthCheck(config.runtime);
|
|
1123
|
+
if (healthy)
|
|
1124
|
+
return existing.getDatabase();
|
|
1125
|
+
await localdb.releaseDatabase(config.runtime, 'storage.localdb', dbPath).catch(logReleaseFailure(config.runtime, dbPath, 'unhealthy'));
|
|
1126
|
+
this.recordDatabases.delete(dbPath);
|
|
1127
|
+
}
|
|
1128
|
+
await this.ensureDirectory(config.runtime, config.basePath);
|
|
1129
|
+
ensureMigrationsRegistered(config.runtime);
|
|
1130
|
+
const localDatabase = await localdb.getDatabase(config.runtime, 'storage.localdb', dbPath, 'storage-record');
|
|
1131
|
+
this.recordDatabases.set(dbPath, localDatabase);
|
|
1132
|
+
return localDatabase.getDatabase();
|
|
1133
|
+
}
|
|
1134
|
+
// Lifecycle
|
|
1135
|
+
async initialize() {
|
|
1136
|
+
if (this.initialized)
|
|
1137
|
+
return;
|
|
1138
|
+
// Configured or refused, typed; the database itself opens on first access.
|
|
1139
|
+
this.requireConfig();
|
|
1140
|
+
this.initialized = true;
|
|
1141
|
+
}
|
|
1142
|
+
async close() {
|
|
1143
|
+
// Release scoped databases
|
|
1144
|
+
for (const [dbPath] of this.scopedDatabases) {
|
|
1145
|
+
await localdb.releaseDatabase(this.requireRuntime(), 'storage.localdb', dbPath);
|
|
1146
|
+
}
|
|
1147
|
+
this.scopedDatabases.clear();
|
|
1148
|
+
this.appliedCustomMigrations.clear();
|
|
1149
|
+
// Release record databases
|
|
1150
|
+
for (const [dbPath] of this.recordDatabases) {
|
|
1151
|
+
await localdb.releaseDatabase(this.requireRuntime(), 'storage.localdb', dbPath);
|
|
1152
|
+
}
|
|
1153
|
+
this.recordDatabases.clear();
|
|
1154
|
+
if (!this.initialized || !this.database)
|
|
1155
|
+
return;
|
|
1156
|
+
// Release from localdb cache (this also closes the database)
|
|
1157
|
+
await localdb.releaseDatabase(this.requireRuntime(), 'storage.localdb', this.getDbPath());
|
|
1158
|
+
this.database = null;
|
|
1159
|
+
this.initialized = false;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Probe real connectivity (opening the default database if needed). A
|
|
1163
|
+
* failed probe answers unhealthy with a fixed, value-free `error` and the
|
|
1164
|
+
* failure's value-free facts in `details.failure`; the failure's own text
|
|
1165
|
+
* (which may carry a path) never leaves.
|
|
1166
|
+
*/
|
|
1167
|
+
async healthCheck() {
|
|
1168
|
+
const start = Date.now();
|
|
1169
|
+
const probed = await settle(this.openDefaultDatabase());
|
|
1170
|
+
if (probed.failed) {
|
|
1171
|
+
return {
|
|
1172
|
+
healthy: false,
|
|
1173
|
+
latencyMs: Date.now() - start,
|
|
1174
|
+
error: 'storage.localdb health check failed',
|
|
1175
|
+
details: { failure: valueFreeFailure(probed.cause) }
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
const healthy = this.database ? this.database.healthCheck(this.requireRuntime()) : false;
|
|
1179
|
+
return {
|
|
1180
|
+
healthy,
|
|
1181
|
+
latencyMs: Date.now() - start,
|
|
1182
|
+
details: {
|
|
1183
|
+
dbPath: this.getDbPath()
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* A dedicated-table manifest's document store: per-row reads and writes on its
|
|
1190
|
+
* own SQLite table (`tableName`, a checked SQL identifier).
|
|
1191
|
+
*/
|
|
1192
|
+
function dedicatedTableStore(schema, tableName, transforms, scopedDb, defaultDbPath) {
|
|
1193
|
+
/**
|
|
1194
|
+
* Run one statement on the table. A table that does not exist yet (LocalDB's
|
|
1195
|
+
* driver condition `missing-table`) is confirmed absence and answers
|
|
1196
|
+
* `absent`; every other failure rethrows.
|
|
1197
|
+
*/
|
|
1198
|
+
const onTable = (run, absent) => {
|
|
1199
|
+
const ran = attempt(run);
|
|
1200
|
+
if (!ran.failed)
|
|
1201
|
+
return ran.value;
|
|
1202
|
+
if (sqliteFailureCondition(ran.cause) === 'missing-table')
|
|
1203
|
+
return absent;
|
|
1204
|
+
throw ran.cause;
|
|
1205
|
+
};
|
|
1206
|
+
/**
|
|
1207
|
+
* The rows as the stored layer, handed to `read`: the array the schema
|
|
1208
|
+
* accepts (most schemas use z.array()), else the record keyed by id
|
|
1209
|
+
* (z.record()). Nothing is defaulted here; `null` when the table is absent
|
|
1210
|
+
* or empty.
|
|
1211
|
+
*/
|
|
1212
|
+
const readRows = async (read) => {
|
|
1213
|
+
const db = await scopedDb();
|
|
1214
|
+
const rows = onTable(() => db.prepare(`SELECT * FROM ${tableName}`).all(), null);
|
|
1215
|
+
if (rows === null || rows.length === 0)
|
|
1216
|
+
return null;
|
|
1217
|
+
// Transform rows from snake_case DB format to camelCase
|
|
1218
|
+
const transformed = transforms?.fromDb ? transforms.fromDb.parse(rows) : rows;
|
|
1219
|
+
const items = Array.isArray(transformed) ? transformed : [transformed];
|
|
1220
|
+
if (schema.safeParse(items).success)
|
|
1221
|
+
return read(items);
|
|
1222
|
+
// Schema expects Record<string, T> — reconstruct from rows
|
|
1223
|
+
const keyed = new Map();
|
|
1224
|
+
for (const item of items) {
|
|
1225
|
+
const identified = IdentifiedItemSchema.safeParse(item);
|
|
1226
|
+
if (identified.success)
|
|
1227
|
+
keyed.set(String(identified.data.id), item);
|
|
1228
|
+
}
|
|
1229
|
+
return read(Object.fromEntries(keyed));
|
|
1230
|
+
};
|
|
1231
|
+
return {
|
|
1232
|
+
async load() {
|
|
1233
|
+
return readRows((stored) => schema.parse(stored));
|
|
1234
|
+
},
|
|
1235
|
+
async loadStored() {
|
|
1236
|
+
return readRows((stored) => readStoredLayer(schema, stored));
|
|
1237
|
+
},
|
|
1238
|
+
async save(data) {
|
|
1239
|
+
// Persist the caller's validated input, never the parse output (defaults are read-time only).
|
|
1240
|
+
const validated = validateForPersist(schema, data);
|
|
1241
|
+
const db = await scopedDb();
|
|
1242
|
+
// Normalize to array of items (handles both array and record formats)
|
|
1243
|
+
const layer = RowsLayerSchema.safeParse(validated);
|
|
1244
|
+
const items = !layer.success ? [] : Array.isArray(layer.data) ? layer.data : Object.values(layer.data);
|
|
1245
|
+
// Transform items to snake_case DB format, then bind each cell.
|
|
1246
|
+
const rows = parseAdapterInput(DbRowsSchema, transforms?.toDb ? transforms.toDb.parse(items) : items, {
|
|
1247
|
+
message: 'storage.localdb could not bind the rows of a dedicated-table document.',
|
|
1248
|
+
code: 'INVALID_INPUT',
|
|
1249
|
+
reason: 'storage-localdb-rows-invalid'
|
|
1250
|
+
});
|
|
1251
|
+
if (rows.length === 0) {
|
|
1252
|
+
// Empty data — delete all rows
|
|
1253
|
+
db.prepare(`DELETE FROM ${tableName}`).run();
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
// Use a transaction for atomicity
|
|
1257
|
+
db.exec('BEGIN TRANSACTION');
|
|
1258
|
+
try {
|
|
1259
|
+
const incomingIds = new Set();
|
|
1260
|
+
for (const row of rows) {
|
|
1261
|
+
const id = row.id;
|
|
1262
|
+
if (id)
|
|
1263
|
+
incomingIds.add(id);
|
|
1264
|
+
// Build column list from row keys, excluding undefined values
|
|
1265
|
+
const columns = [];
|
|
1266
|
+
const values = [];
|
|
1267
|
+
for (const [column, value] of Object.entries(row)) {
|
|
1268
|
+
if (value === undefined)
|
|
1269
|
+
continue;
|
|
1270
|
+
columns.push(column);
|
|
1271
|
+
values.push(value);
|
|
1272
|
+
}
|
|
1273
|
+
const placeholders = columns.map(() => '?');
|
|
1274
|
+
// Upsert: INSERT OR REPLACE
|
|
1275
|
+
db.prepare(`INSERT OR REPLACE INTO ${tableName} (${columns.join(', ')}) VALUES (${placeholders.join(', ')})`).run(...values);
|
|
1276
|
+
}
|
|
1277
|
+
// Delete rows not in the incoming set
|
|
1278
|
+
if (incomingIds.size > 0) {
|
|
1279
|
+
const existingRows = db.prepare(`SELECT id FROM ${tableName}`).all();
|
|
1280
|
+
for (const existing of existingRows) {
|
|
1281
|
+
if (!incomingIds.has(existing.id)) {
|
|
1282
|
+
db.prepare(`DELETE FROM ${tableName} WHERE id = ?`).run(existing.id);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
db.exec('COMMIT');
|
|
1287
|
+
}
|
|
1288
|
+
catch (error) {
|
|
1289
|
+
db.exec('ROLLBACK');
|
|
1290
|
+
throw error;
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
async exists() {
|
|
1294
|
+
const db = await scopedDb();
|
|
1295
|
+
const row = onTable(() => db.prepare(`SELECT COUNT(*) as count FROM ${tableName}`).get(), null);
|
|
1296
|
+
return (row?.count ?? 0) > 0;
|
|
1297
|
+
},
|
|
1298
|
+
async delete() {
|
|
1299
|
+
const db = await scopedDb();
|
|
1300
|
+
onTable(() => db.prepare(`DELETE FROM ${tableName}`).run(), null);
|
|
1301
|
+
},
|
|
1302
|
+
getPath() {
|
|
1303
|
+
return `localdb://${defaultDbPath()}/${tableName}`;
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Recovery continues with a fresh handle; a failed release of the stale or
|
|
1309
|
+
* unhealthy one is reported once, value-free, on the runtime this call serves.
|
|
1310
|
+
*/
|
|
1311
|
+
function logReleaseFailure(runtime, dbPath, handle) {
|
|
1312
|
+
return (error) => {
|
|
1313
|
+
const logger = getLogger('storage:localdb-adapter', runtime);
|
|
1314
|
+
logger.warn('storage.localdb: releasing a database handle failed', {
|
|
1315
|
+
dbPath,
|
|
1316
|
+
handle,
|
|
1317
|
+
error: valueFreeFailure(error)
|
|
1318
|
+
});
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* The adapter begins database work only on a live runtime (RC07). Its opens,
|
|
1323
|
+
* migrations and queries report on the runtime the call serves (C083a); a
|
|
1324
|
+
* runtime whose disposal began (`finalizing` or `disposed`) is closing its
|
|
1325
|
+
* Logging and LocalDB connections, so work started there is refused before it
|
|
1326
|
+
* begins, typed as a cancellation (`CANCELLED` `runtime-disposed`): its
|
|
1327
|
+
* runtime ended, which the caller treats as a confirmed end. Releasing
|
|
1328
|
+
* handles stays available; that is how the runtime gives them back.
|
|
1329
|
+
*/
|
|
1330
|
+
function assertStorageRuntimeLive(runtime, operation) {
|
|
1331
|
+
const { phase } = runtime.lifecycle;
|
|
1332
|
+
if (phase === 'live')
|
|
1333
|
+
return;
|
|
1334
|
+
throw new CapabilityError(`storage.localdb starts no ${operation} on a runtime whose disposal began.`, 'CANCELLED', {
|
|
1335
|
+
reason: 'runtime-disposed',
|
|
1336
|
+
retryable: false,
|
|
1337
|
+
cause: runtime.lifecycle.signal.reason,
|
|
1338
|
+
details: { operation, phase },
|
|
1339
|
+
recoveryHint: 'Use the live runtime handed to this call.'
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
// Implementation Export
|
|
1343
|
+
export default createRuntimeImplementation({
|
|
1344
|
+
id: 'storage.localdb',
|
|
1345
|
+
kind: 'storage/adapter',
|
|
1346
|
+
constraint: {
|
|
1347
|
+
hardware: ['consumer'] // Only works on consumer hardware with local filesystem
|
|
1348
|
+
},
|
|
1349
|
+
// A class: the storage/adapter kind constructs one per runtime, so one
|
|
1350
|
+
// runtime's configure() never re-points another runtime's adapter.
|
|
1351
|
+
implementation: LocalDBStorageAdapter
|
|
1352
|
+
});
|
|
1353
|
+
// Testing Utilities
|
|
1354
|
+
/**
|
|
1355
|
+
* Create a fresh LocalDB adapter instance (for testing)
|
|
1356
|
+
* @param basePath - Base directory for the database file
|
|
1357
|
+
* @param dbName - Optional database filename (default: unique timestamp-based name)
|
|
1358
|
+
*/
|
|
1359
|
+
export function createTestLocalDBAdapter(basePath, dbName,
|
|
1360
|
+
/**
|
|
1361
|
+
* The workspace, roots and runtime a manifest would hand over, for a test
|
|
1362
|
+
* that reads the adapter directly; without a runtime, opening a database
|
|
1363
|
+
* refuses (`storage-adapter-unconfigured`) until a manifest configures one.
|
|
1364
|
+
*/
|
|
1365
|
+
scope) {
|
|
1366
|
+
const adapter = new LocalDBStorageAdapter();
|
|
1367
|
+
adapter.configure({ basePath, dbName: dbName ?? `test-${Date.now()}.db`, ...scope });
|
|
1368
|
+
return adapter;
|
|
1369
|
+
}
|
|
1370
|
+
//# sourceMappingURL=localdb.adapter.impl.js.map
|