@vibesdotdev/storage 0.0.1
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/README.md +75 -0
- package/SPEC.md +60 -0
- package/dist/adapters/index.d.ts +14 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/bridge/index.d.ts +3 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +2 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/storage-kind-bridge.d.ts +27 -0
- package/dist/bridge/storage-kind-bridge.d.ts.map +1 -0
- package/dist/bridge/storage-kind-bridge.js +110 -0
- package/dist/bridge/storage-kind-bridge.js.map +1 -0
- package/dist/bridge/types.d.ts +45 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/bridge/types.js +8 -0
- package/dist/bridge/types.js.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.js +18 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts +11 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.js +48 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js +26 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js +136 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js +26 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js +165 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js +20 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts +12 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js +95 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js +15 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js +150 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js.map +1 -0
- package/dist/cli/context.consumer.d.ts +26 -0
- package/dist/cli/context.consumer.d.ts.map +1 -0
- package/dist/cli/context.consumer.js +164 -0
- package/dist/cli/context.consumer.js.map +1 -0
- package/dist/cli/storage.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/storage.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/storage.cli-group.descriptor.js +11 -0
- package/dist/cli/storage.cli-group.descriptor.js.map +1 -0
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/storage.sync.cli-group.descriptor.js +12 -0
- package/dist/cli/storage.sync.cli-group.descriptor.js.map +1 -0
- package/dist/cli/types.d.ts +26 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +11 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/list-browsable-adapters.d.ts +31 -0
- package/dist/client/list-browsable-adapters.d.ts.map +1 -0
- package/dist/client/list-browsable-adapters.js +40 -0
- package/dist/client/list-browsable-adapters.js.map +1 -0
- package/dist/daemon/commands/sync.d.ts +23 -0
- package/dist/daemon/commands/sync.d.ts.map +1 -0
- package/dist/daemon/commands/sync.js +169 -0
- package/dist/daemon/commands/sync.js.map +1 -0
- package/dist/docs/adapters.docs.descriptor.d.ts +4 -0
- package/dist/docs/adapters.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/adapters.docs.descriptor.js +223 -0
- package/dist/docs/adapters.docs.descriptor.js.map +1 -0
- package/dist/docs/manifests.docs.descriptor.d.ts +4 -0
- package/dist/docs/manifests.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/manifests.docs.descriptor.js +316 -0
- package/dist/docs/manifests.docs.descriptor.js.map +1 -0
- package/dist/docs/records.docs.descriptor.d.ts +4 -0
- package/dist/docs/records.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/records.docs.descriptor.js +269 -0
- package/dist/docs/records.docs.descriptor.js.map +1 -0
- package/dist/docs/sync.docs.descriptor.d.ts +4 -0
- package/dist/docs/sync.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/sync.docs.descriptor.js +279 -0
- package/dist/docs/sync.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/adapter.d.ts +382 -0
- package/dist/interfaces/adapter.d.ts.map +1 -0
- package/dist/interfaces/adapter.js +11 -0
- package/dist/interfaces/adapter.js.map +1 -0
- package/dist/interfaces/document-store.d.ts +62 -0
- package/dist/interfaces/document-store.d.ts.map +1 -0
- package/dist/interfaces/document-store.js +8 -0
- package/dist/interfaces/document-store.js.map +1 -0
- package/dist/interfaces/index.d.ts +17 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +24 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/key-value.d.ts +95 -0
- package/dist/interfaces/key-value.d.ts.map +1 -0
- package/dist/interfaces/key-value.js +8 -0
- package/dist/interfaces/key-value.js.map +1 -0
- package/dist/interfaces/query-builder.d.ts +31 -0
- package/dist/interfaces/query-builder.d.ts.map +1 -0
- package/dist/interfaces/query-builder.js +11 -0
- package/dist/interfaces/query-builder.js.map +1 -0
- package/dist/interfaces/record/index.d.ts +7 -0
- package/dist/interfaces/record/index.d.ts.map +1 -0
- package/dist/interfaces/record/index.js +7 -0
- package/dist/interfaces/record/index.js.map +1 -0
- package/dist/interfaces/record/interface.d.ts +593 -0
- package/dist/interfaces/record/interface.d.ts.map +1 -0
- package/dist/interfaces/record/interface.js +49 -0
- package/dist/interfaces/record/interface.js.map +1 -0
- package/dist/interfaces/repository.d.ts +262 -0
- package/dist/interfaces/repository.d.ts.map +1 -0
- package/dist/interfaces/repository.js +8 -0
- package/dist/interfaces/repository.js.map +1 -0
- package/dist/interfaces/schema/index.d.ts +8 -0
- package/dist/interfaces/schema/index.d.ts.map +1 -0
- package/dist/interfaces/schema/index.js +10 -0
- package/dist/interfaces/schema/index.js.map +1 -0
- package/dist/interfaces/schema/schema-interface.d.ts +516 -0
- package/dist/interfaces/schema/schema-interface.d.ts.map +1 -0
- package/dist/interfaces/schema/schema-interface.js +31 -0
- package/dist/interfaces/schema/schema-interface.js.map +1 -0
- package/dist/interfaces/schema/table-interface.d.ts +250 -0
- package/dist/interfaces/schema/table-interface.d.ts.map +1 -0
- package/dist/interfaces/schema/table-interface.js +31 -0
- package/dist/interfaces/schema/table-interface.js.map +1 -0
- package/dist/interfaces/storage-consumer-fs.d.ts +40 -0
- package/dist/interfaces/storage-consumer-fs.d.ts.map +1 -0
- package/dist/interfaces/storage-consumer-fs.js +42 -0
- package/dist/interfaces/storage-consumer-fs.js.map +1 -0
- package/dist/manifest/base.d.ts +187 -0
- package/dist/manifest/base.d.ts.map +1 -0
- package/dist/manifest/base.js +516 -0
- package/dist/manifest/base.js.map +1 -0
- package/dist/manifest/cloud-sync.consumer.d.ts +7 -0
- package/dist/manifest/cloud-sync.consumer.d.ts.map +1 -0
- package/dist/manifest/cloud-sync.consumer.js +82 -0
- package/dist/manifest/cloud-sync.consumer.js.map +1 -0
- package/dist/manifest/index.d.ts +7 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +7 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/source-policy.d.ts +8 -0
- package/dist/manifest/source-policy.d.ts.map +1 -0
- package/dist/manifest/source-policy.js +62 -0
- package/dist/manifest/source-policy.js.map +1 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +152 -0
- package/dist/paths.js.map +1 -0
- package/dist/policy/context.d.ts +9 -0
- package/dist/policy/context.d.ts.map +1 -0
- package/dist/policy/context.js +29 -0
- package/dist/policy/context.js.map +1 -0
- package/dist/policy/index.d.ts +4 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +4 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/overrides.d.ts +40 -0
- package/dist/policy/overrides.d.ts.map +1 -0
- package/dist/policy/overrides.js +37 -0
- package/dist/policy/overrides.js.map +1 -0
- package/dist/policy/persistence.d.ts +38 -0
- package/dist/policy/persistence.d.ts.map +1 -0
- package/dist/policy/persistence.js +65 -0
- package/dist/policy/persistence.js.map +1 -0
- package/dist/policy/types.d.ts +21 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +7 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/record/base.d.ts +186 -0
- package/dist/record/base.d.ts.map +1 -0
- package/dist/record/base.js +1437 -0
- package/dist/record/base.js.map +1 -0
- package/dist/record/events.d.ts +71 -0
- package/dist/record/events.d.ts.map +1 -0
- package/dist/record/events.js +52 -0
- package/dist/record/events.js.map +1 -0
- package/dist/record/extensions.d.ts +51 -0
- package/dist/record/extensions.d.ts.map +1 -0
- package/dist/record/extensions.js +222 -0
- package/dist/record/extensions.js.map +1 -0
- package/dist/record/index.d.ts +7 -0
- package/dist/record/index.d.ts.map +1 -0
- package/dist/record/index.js +7 -0
- package/dist/record/index.js.map +1 -0
- package/dist/resolver/storage-backed-resolver.d.ts +23 -0
- package/dist/resolver/storage-backed-resolver.d.ts.map +1 -0
- package/dist/resolver/storage-backed-resolver.js +187 -0
- package/dist/resolver/storage-backed-resolver.js.map +1 -0
- package/dist/schemas/adapter-descriptor.d.ts +108 -0
- package/dist/schemas/adapter-descriptor.d.ts.map +1 -0
- package/dist/schemas/adapter-descriptor.js +101 -0
- package/dist/schemas/adapter-descriptor.js.map +1 -0
- package/dist/schemas/index.d.ts +14 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +12 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/manifest-descriptor.d.ts +110 -0
- package/dist/schemas/manifest-descriptor.d.ts.map +1 -0
- package/dist/schemas/manifest-descriptor.js +114 -0
- package/dist/schemas/manifest-descriptor.js.map +1 -0
- package/dist/schemas/record/descriptor.d.ts +570 -0
- package/dist/schemas/record/descriptor.d.ts.map +1 -0
- package/dist/schemas/record/descriptor.js +389 -0
- package/dist/schemas/record/descriptor.js.map +1 -0
- package/dist/schemas/record/index.d.ts +8 -0
- package/dist/schemas/record/index.d.ts.map +1 -0
- package/dist/schemas/record/index.js +7 -0
- package/dist/schemas/record/index.js.map +1 -0
- package/dist/schemas/record/relation.d.ts +36 -0
- package/dist/schemas/record/relation.d.ts.map +1 -0
- package/dist/schemas/record/relation.js +37 -0
- package/dist/schemas/record/relation.js.map +1 -0
- package/dist/schemas/schema/descriptor.d.ts +231 -0
- package/dist/schemas/schema/descriptor.d.ts.map +1 -0
- package/dist/schemas/schema/descriptor.js +205 -0
- package/dist/schemas/schema/descriptor.js.map +1 -0
- package/dist/schemas/schema/index.d.ts +7 -0
- package/dist/schemas/schema/index.d.ts.map +1 -0
- package/dist/schemas/schema/index.js +7 -0
- package/dist/schemas/schema/index.js.map +1 -0
- package/dist/schemas/sync-bridge-descriptor.d.ts +124 -0
- package/dist/schemas/sync-bridge-descriptor.d.ts.map +1 -0
- package/dist/schemas/sync-bridge-descriptor.js +67 -0
- package/dist/schemas/sync-bridge-descriptor.js.map +1 -0
- package/dist/server/manifest-route.d.ts +92 -0
- package/dist/server/manifest-route.d.ts.map +1 -0
- package/dist/server/manifest-route.js +226 -0
- package/dist/server/manifest-route.js.map +1 -0
- package/dist/storage-policy.context.descriptor.d.ts +16 -0
- package/dist/storage-policy.context.descriptor.d.ts.map +1 -0
- package/dist/storage-policy.context.descriptor.js +16 -0
- package/dist/storage-policy.context.descriptor.js.map +1 -0
- package/dist/storage-policy.context.server.d.ts +14 -0
- package/dist/storage-policy.context.server.d.ts.map +1 -0
- package/dist/storage-policy.context.server.js +27 -0
- package/dist/storage-policy.context.server.js.map +1 -0
- package/dist/storage.plugin.d.ts +38 -0
- package/dist/storage.plugin.d.ts.map +1 -0
- package/dist/storage.plugin.js +204 -0
- package/dist/storage.plugin.js.map +1 -0
- package/dist/sync/cloud-pull.d.ts +15 -0
- package/dist/sync/cloud-pull.d.ts.map +1 -0
- package/dist/sync/cloud-pull.js +130 -0
- package/dist/sync/cloud-pull.js.map +1 -0
- package/dist/sync/cloud-record-crud-config.d.ts +19 -0
- package/dist/sync/cloud-record-crud-config.d.ts.map +1 -0
- package/dist/sync/cloud-record-crud-config.js +22 -0
- package/dist/sync/cloud-record-crud-config.js.map +1 -0
- package/dist/sync/record-sync-bridge.d.ts +5 -0
- package/dist/sync/record-sync-bridge.d.ts.map +1 -0
- package/dist/sync/record-sync-bridge.js +121 -0
- package/dist/sync/record-sync-bridge.js.map +1 -0
- package/dist/sync/resolve-sync-target.d.ts +23 -0
- package/dist/sync/resolve-sync-target.d.ts.map +1 -0
- package/dist/sync/resolve-sync-target.js +45 -0
- package/dist/sync/resolve-sync-target.js.map +1 -0
- package/dist/sync/schemas/cloud-pull.d.ts +25 -0
- package/dist/sync/schemas/cloud-pull.d.ts.map +1 -0
- package/dist/sync/schemas/cloud-pull.js +7 -0
- package/dist/sync/schemas/cloud-pull.js.map +1 -0
- package/dist/sync/schemas/index.d.ts +9 -0
- package/dist/sync/schemas/index.d.ts.map +1 -0
- package/dist/sync/schemas/index.js +9 -0
- package/dist/sync/schemas/index.js.map +1 -0
- package/dist/sync/schemas/sync-helpers.d.ts +17 -0
- package/dist/sync/schemas/sync-helpers.d.ts.map +1 -0
- package/dist/sync/schemas/sync-helpers.js +7 -0
- package/dist/sync/schemas/sync-helpers.js.map +1 -0
- package/dist/sync/schemas/sync-state.d.ts +65 -0
- package/dist/sync/schemas/sync-state.d.ts.map +1 -0
- package/dist/sync/schemas/sync-state.js +32 -0
- package/dist/sync/schemas/sync-state.js.map +1 -0
- package/dist/sync/sync-bridge.d.ts +80 -0
- package/dist/sync/sync-bridge.d.ts.map +1 -0
- package/dist/sync/sync-bridge.js +617 -0
- package/dist/sync/sync-bridge.js.map +1 -0
- package/dist/sync/sync-manifest.d.ts +20 -0
- package/dist/sync/sync-manifest.d.ts.map +1 -0
- package/dist/sync/sync-manifest.js +140 -0
- package/dist/sync/sync-manifest.js.map +1 -0
- package/dist/sync/sync-state.consumer.d.ts +23 -0
- package/dist/sync/sync-state.consumer.d.ts.map +1 -0
- package/dist/sync/sync-state.consumer.js +111 -0
- package/dist/sync/sync-state.consumer.js.map +1 -0
- package/dist/transform/index.d.ts +75 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +81 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/transform-descriptor.d.ts +51 -0
- package/dist/transform/transform-descriptor.d.ts.map +1 -0
- package/dist/transform/transform-descriptor.js +30 -0
- package/dist/transform/transform-descriptor.js.map +1 -0
- package/dist/tui/storage-explorer.descriptor.d.ts +14 -0
- package/dist/tui/storage-explorer.descriptor.d.ts.map +1 -0
- package/dist/tui/storage-explorer.descriptor.js +29 -0
- package/dist/tui/storage-explorer.descriptor.js.map +1 -0
- package/dist/tui/storage-explorer.impl.consumer.d.ts +11 -0
- package/dist/tui/storage-explorer.impl.consumer.d.ts.map +1 -0
- package/dist/tui/storage-explorer.impl.consumer.js +13 -0
- package/dist/tui/storage-explorer.impl.consumer.js.map +1 -0
- package/dist/tui/storage-open.descriptor.d.ts +14 -0
- package/dist/tui/storage-open.descriptor.d.ts.map +1 -0
- package/dist/tui/storage-open.descriptor.js +28 -0
- package/dist/tui/storage-open.descriptor.js.map +1 -0
- package/dist/tui/storage-open.impl.consumer.d.ts +11 -0
- package/dist/tui/storage-open.impl.consumer.d.ts.map +1 -0
- package/dist/tui/storage-open.impl.consumer.js +13 -0
- package/dist/tui/storage-open.impl.consumer.js.map +1 -0
- package/dist/utils/error-context.d.ts +2 -0
- package/dist/utils/error-context.d.ts.map +1 -0
- package/dist/utils/error-context.js +17 -0
- package/dist/utils/error-context.js.map +1 -0
- package/package.json +241 -0
- package/src/adapters/index.ts +13 -0
- package/src/bridge/index.ts +2 -0
- package/src/bridge/storage-kind-bridge.ts +131 -0
- package/src/bridge/types.ts +46 -0
- package/src/cli/commands/list/storage.list.cli-command.descriptor.ts +20 -0
- package/src/cli/commands/list/storage.list.cli-command.impl.ts +72 -0
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.ts +28 -0
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.ts +171 -0
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.ts +28 -0
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.impl.ts +213 -0
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.ts +22 -0
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.ts +129 -0
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.ts +17 -0
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.impl.ts +192 -0
- package/src/cli/context.consumer.ts +195 -0
- package/src/cli/storage.cli-group.descriptor.ts +13 -0
- package/src/cli/storage.sync.cli-group.descriptor.ts +14 -0
- package/src/cli/types.ts +25 -0
- package/src/client/index.ts +10 -0
- package/src/client/list-browsable-adapters.ts +42 -0
- package/src/daemon/commands/sync.ts +225 -0
- package/src/docs/adapters.docs.descriptor.ts +225 -0
- package/src/docs/manifests.docs.descriptor.ts +318 -0
- package/src/docs/records.docs.descriptor.ts +271 -0
- package/src/docs/sync.docs.descriptor.ts +281 -0
- package/src/index.ts +109 -0
- package/src/interfaces/adapter.ts +451 -0
- package/src/interfaces/document-store.ts +74 -0
- package/src/interfaces/index.ts +117 -0
- package/src/interfaces/key-value.ts +112 -0
- package/src/interfaces/query-builder.ts +31 -0
- package/src/interfaces/record/index.ts +58 -0
- package/src/interfaces/record/interface.ts +723 -0
- package/src/interfaces/repository.ts +300 -0
- package/src/interfaces/schema/index.ts +37 -0
- package/src/interfaces/schema/schema-interface.ts +586 -0
- package/src/interfaces/schema/table-interface.ts +314 -0
- package/src/interfaces/storage-consumer-fs.ts +66 -0
- package/src/manifest/base.ts +594 -0
- package/src/manifest/cloud-sync.consumer.ts +120 -0
- package/src/manifest/index.ts +7 -0
- package/src/manifest/source-policy.ts +74 -0
- package/src/paths.ts +171 -0
- package/src/policy/context.ts +30 -0
- package/src/policy/index.ts +20 -0
- package/src/policy/overrides.ts +46 -0
- package/src/policy/persistence.ts +117 -0
- package/src/policy/types.ts +28 -0
- package/src/record/base.ts +1872 -0
- package/src/record/events.ts +56 -0
- package/src/record/extensions.ts +308 -0
- package/src/record/index.ts +7 -0
- package/src/resolver/storage-backed-resolver.ts +255 -0
- package/src/schemas/adapter-descriptor.ts +128 -0
- package/src/schemas/index.ts +104 -0
- package/src/schemas/manifest-descriptor.ts +143 -0
- package/src/schemas/record/descriptor.ts +621 -0
- package/src/schemas/record/index.ts +60 -0
- package/src/schemas/record/relation.ts +49 -0
- package/src/schemas/schema/descriptor.ts +278 -0
- package/src/schemas/schema/index.ts +14 -0
- package/src/schemas/sync-bridge-descriptor.ts +143 -0
- package/src/server/manifest-route.ts +319 -0
- package/src/storage-policy.context.descriptor.ts +17 -0
- package/src/storage-policy.context.server.ts +34 -0
- package/src/storage.plugin.ts +264 -0
- package/src/sync/cloud-pull.ts +202 -0
- package/src/sync/cloud-record-crud-config.ts +41 -0
- package/src/sync/record-sync-bridge.ts +183 -0
- package/src/sync/resolve-sync-target.ts +57 -0
- package/src/sync/schemas/cloud-pull.ts +26 -0
- package/src/sync/schemas/index.ts +18 -0
- package/src/sync/schemas/sync-helpers.ts +18 -0
- package/src/sync/schemas/sync-state.ts +41 -0
- package/src/sync/sync-bridge.ts +763 -0
- package/src/sync/sync-manifest.ts +212 -0
- package/src/sync/sync-state.consumer.ts +144 -0
- package/src/transform/index.ts +130 -0
- package/src/transform/transform-descriptor.ts +53 -0
- package/src/tui/storage-explorer.descriptor.ts +32 -0
- package/src/tui/storage-explorer.impl.consumer.ts +14 -0
- package/src/tui/storage-open.descriptor.ts +31 -0
- package/src/tui/storage-open.impl.consumer.ts +14 -0
- package/src/utils/error-context.ts +19 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Adapter Interface
|
|
3
|
+
*
|
|
4
|
+
* Main interface for storage adapters. Adapters provide access to
|
|
5
|
+
* document stores, key-value stores, repositories, and records.
|
|
6
|
+
*
|
|
7
|
+
* Each adapter can specify its own config type and declare which
|
|
8
|
+
* storage protocols and features it supports.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { z } from 'zod/v4';
|
|
12
|
+
import type { StorageDocumentStoreInterface } from './document-store';
|
|
13
|
+
import type { StorageKeyValueInterface } from './key-value';
|
|
14
|
+
import type { StorageRepositoryInterface, RepositoryOptions } from './repository';
|
|
15
|
+
import type { StorageRecordInterface } from './record';
|
|
16
|
+
import type { StorageRecordDescriptor } from '../schemas/record';
|
|
17
|
+
import type { StorageCapability, StorageDrive, StorageEntry } from '../schemas/adapter-descriptor';
|
|
18
|
+
|
|
19
|
+
// UNIVERSAL SQL DATABASE HANDLE
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Universal SQL database handle interface.
|
|
23
|
+
*
|
|
24
|
+
* Abstracts the underlying SQL driver (bun:sqlite, better-sqlite3, postgres, etc.)
|
|
25
|
+
* to keep storage core universal (no Node/Bun/SQL imports in core).
|
|
26
|
+
*
|
|
27
|
+
* Exposes only the surface area that storage core actually uses.
|
|
28
|
+
*/
|
|
29
|
+
export interface SqlDatabaseHandle {
|
|
30
|
+
exec(sql: string): void;
|
|
31
|
+
query<T, P extends any[] = unknown[]>(sql: string): SqlStatement<T, P>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Prepared SQL statement returned by SqlDatabaseHandle.query()
|
|
36
|
+
*/
|
|
37
|
+
export interface SqlStatement<T, P extends any[] = unknown[]> {
|
|
38
|
+
all(...params: P): T[];
|
|
39
|
+
get(...params: P): T | undefined;
|
|
40
|
+
run(...params: P): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// PROTOCOLS & CAPABILITIES
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Storage protocols supported by adapters
|
|
47
|
+
*/
|
|
48
|
+
export type StorageProtocol = 'document' | 'keyvalue' | 'repository' | 'record';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Storage adapter capabilities
|
|
52
|
+
*/
|
|
53
|
+
export interface StorageAdapterCapabilities {
|
|
54
|
+
/** Supported protocols */
|
|
55
|
+
protocols: StorageProtocol[];
|
|
56
|
+
/**
|
|
57
|
+
* Coarse-grained capability flags mirroring the descriptor's
|
|
58
|
+
* `capabilities[]`. `browse` indicates `list(driveId, path)` +
|
|
59
|
+
* `listDrives()` are implemented.
|
|
60
|
+
*/
|
|
61
|
+
capabilities?: StorageCapability[];
|
|
62
|
+
/** Whether adapter requires pair schema (key + value) for main storage */
|
|
63
|
+
requiresPairSchema: boolean;
|
|
64
|
+
/** Whether adapter supports transactions */
|
|
65
|
+
supportsTransactions: boolean;
|
|
66
|
+
/** Whether adapter supports TTL (for caches) */
|
|
67
|
+
supportsTTL: boolean;
|
|
68
|
+
/** Whether adapter supports full-text search */
|
|
69
|
+
supportsFTS: boolean;
|
|
70
|
+
/** Whether adapter is persistent (survives restarts) */
|
|
71
|
+
persistent: boolean;
|
|
72
|
+
/** Whether adapter supports change subscriptions */
|
|
73
|
+
supportsSubscription: boolean;
|
|
74
|
+
/** Whether adapter supports hierarchical/recursive queries */
|
|
75
|
+
supportsHierarchy: boolean;
|
|
76
|
+
/** Whether adapter supports computed fields (aggregations) */
|
|
77
|
+
supportsComputedFields: boolean;
|
|
78
|
+
/** Whether adapter supports cross-table side effects */
|
|
79
|
+
supportsSideEffects: boolean;
|
|
80
|
+
/** Whether adapter supports raw SQL queries */
|
|
81
|
+
supportsRawQueries: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// MAIN ADAPTER INTERFACE
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Main storage adapter interface
|
|
88
|
+
*
|
|
89
|
+
* @typeParam TConfig - Adapter-specific configuration type
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* // LocalDB adapter (consumer hardware)
|
|
94
|
+
* interface LocalDBConfig {
|
|
95
|
+
* basePath: string;
|
|
96
|
+
* dbName?: string;
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* class LocalDBAdapter implements StorageAdapterInterface<LocalDBConfig> {
|
|
100
|
+
* configure(config: LocalDBConfig) { ... }
|
|
101
|
+
* documentStore(namespace, schema) { ... }
|
|
102
|
+
* repository(tableName, schema) { ... }
|
|
103
|
+
* record(descriptor) { ... }
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export interface StorageAdapterInterface<
|
|
108
|
+
TConfig extends Record<string, unknown> = Record<string, unknown>
|
|
109
|
+
> {
|
|
110
|
+
/**
|
|
111
|
+
* Unique adapter identifier
|
|
112
|
+
*/
|
|
113
|
+
readonly id: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Adapter capabilities
|
|
117
|
+
*/
|
|
118
|
+
readonly capabilities: StorageAdapterCapabilities;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Configure the adapter with adapter-specific options
|
|
122
|
+
* @param config Adapter-specific configuration
|
|
123
|
+
*/
|
|
124
|
+
configure(config: TConfig): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Check if adapter is configured and ready
|
|
128
|
+
*/
|
|
129
|
+
isConfigured(): boolean;
|
|
130
|
+
|
|
131
|
+
// Document Store (single-doc storage)
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get a document store for a namespace
|
|
135
|
+
*
|
|
136
|
+
* @param namespace Storage namespace (e.g., 'ai.config')
|
|
137
|
+
* @param schema Zod schema for validation
|
|
138
|
+
* @param manifest Storage manifest descriptor (contains adapter-specific config)
|
|
139
|
+
* @returns Document store interface
|
|
140
|
+
* @throws If adapter doesn't support document protocol
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const store = adapter.documentStore('ai.config', aiConfigSchema, manifest);
|
|
145
|
+
* const config = await store.load();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
documentStore<T>(
|
|
149
|
+
namespace: string,
|
|
150
|
+
schema: z.ZodType<T>,
|
|
151
|
+
manifest?: unknown
|
|
152
|
+
): StorageDocumentStoreInterface<T>;
|
|
153
|
+
|
|
154
|
+
// Key-Value Store (pair-schema storage)
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get a key-value store for a namespace
|
|
158
|
+
*
|
|
159
|
+
* @param namespace Storage namespace (e.g., 'cache')
|
|
160
|
+
* @param keySchema Zod schema for keys
|
|
161
|
+
* @param valueSchema Zod schema for values
|
|
162
|
+
* @returns Key-value store interface
|
|
163
|
+
* @throws If adapter doesn't support keyvalue protocol
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const kv = adapter.keyValueStore('cache', z.string(), userSchema);
|
|
168
|
+
* await kv.set('user:123', userData);
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
keyValueStore<TKey, TValue>(
|
|
172
|
+
namespace: string,
|
|
173
|
+
keySchema: z.ZodType<TKey>,
|
|
174
|
+
valueSchema: z.ZodType<TValue>
|
|
175
|
+
): StorageKeyValueInterface<TKey, TValue>;
|
|
176
|
+
|
|
177
|
+
// Repository (structured records - legacy pattern)
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get a repository for a table/collection
|
|
181
|
+
*
|
|
182
|
+
* @param tableName Table or collection name
|
|
183
|
+
* @param schema Zod schema for records
|
|
184
|
+
* @param options Repository options
|
|
185
|
+
* @returns Repository interface
|
|
186
|
+
* @throws If adapter doesn't support repository protocol
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const repo = adapter.repository('providers', providerSchema);
|
|
191
|
+
* const providers = await repo.list({ limit: 10 });
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
repository<T>(
|
|
195
|
+
tableName: string,
|
|
196
|
+
schema: z.ZodType<T>,
|
|
197
|
+
options?: RepositoryOptions
|
|
198
|
+
): StorageRepositoryInterface<T>;
|
|
199
|
+
|
|
200
|
+
// Record (new descriptor-driven pattern)
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get a storage record interface for CRUD operations on a single table.
|
|
204
|
+
*
|
|
205
|
+
* This is the new pattern for storage that uses descriptors to define
|
|
206
|
+
* schema, relations, indexes, and advanced features.
|
|
207
|
+
*
|
|
208
|
+
* @param descriptor - Storage record descriptor
|
|
209
|
+
* @returns Storage record interface with CRUD and advanced operations
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const todos = adapter.record(todoDescriptor);
|
|
214
|
+
* await todos.initialize();
|
|
215
|
+
*
|
|
216
|
+
* // Basic CRUD
|
|
217
|
+
* await todos.create({ sessionId: '...', title: '...' });
|
|
218
|
+
* const allTodos = await todos.list({ where: { sessionId: '...' }});
|
|
219
|
+
*
|
|
220
|
+
* // FTS (if adapter supports it)
|
|
221
|
+
* const results = await todos.search('implement feature');
|
|
222
|
+
*
|
|
223
|
+
* // Hierarchy (if adapter supports it)
|
|
224
|
+
* const tree = await todos.getTree({ where: { sessionId: '...' }});
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
record<T = unknown>(descriptor: StorageRecordDescriptor): StorageRecordInterface<T>;
|
|
228
|
+
|
|
229
|
+
// Browse (optional — adapters declaring `browse` capability implement these)
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Enumerate the top-level "drives" exposed by this adapter.
|
|
233
|
+
*
|
|
234
|
+
* A drive is the unit of selection before drilling into folders —
|
|
235
|
+
* for SharePoint, a site; for OneDrive, the user's default drive; etc.
|
|
236
|
+
*
|
|
237
|
+
* Only adapters that declare the `browse` capability in their
|
|
238
|
+
* descriptor are required to implement this method. Adapters that
|
|
239
|
+
* don't browse omit it.
|
|
240
|
+
*
|
|
241
|
+
* @returns Promise resolving to all drives the current credential can see.
|
|
242
|
+
*/
|
|
243
|
+
listDrives?(): Promise<StorageDrive[]>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Enumerate files + directories inside a drive at the given path.
|
|
247
|
+
*
|
|
248
|
+
* Only adapters that declare the `browse` capability are required to
|
|
249
|
+
* implement this method. Adapters that don't browse omit it.
|
|
250
|
+
*
|
|
251
|
+
* @param driveId - Drive identifier from `listDrives()`.
|
|
252
|
+
* @param path - Path relative to the drive root. Use `''` (or omit
|
|
253
|
+
* when calling with two args) for the drive's top level. Segments
|
|
254
|
+
* joined with `/`.
|
|
255
|
+
* @returns Promise resolving to the entries at that path.
|
|
256
|
+
*/
|
|
257
|
+
list?(driveId: string, path?: string): Promise<StorageEntry[]>;
|
|
258
|
+
|
|
259
|
+
// Database Access
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Ensure adapter is fully initialized and database is ready for use.
|
|
263
|
+
* Unlike initialize(), this also creates the database connection on first access.
|
|
264
|
+
* Called by StorageRecord before accessing the database.
|
|
265
|
+
*/
|
|
266
|
+
ensureReady(): Promise<void>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get the underlying database connection.
|
|
270
|
+
* Must call ensureReady() first.
|
|
271
|
+
*
|
|
272
|
+
* @returns The raw database connection (e.g., bun:sqlite Database)
|
|
273
|
+
* @throws If database is not initialized
|
|
274
|
+
*/
|
|
275
|
+
getDatabaseConnection(): unknown;
|
|
276
|
+
|
|
277
|
+
// Lifecycle
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Initialize the adapter (create tables, connect, etc.)
|
|
281
|
+
* Called automatically on first use if not called explicitly.
|
|
282
|
+
*/
|
|
283
|
+
initialize(): Promise<void>;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Close connections and clean up
|
|
287
|
+
*/
|
|
288
|
+
close(): Promise<void>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Check adapter health
|
|
292
|
+
*/
|
|
293
|
+
healthCheck(): Promise<StorageHealthStatus>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// HEALTH STATUS
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Health check result
|
|
300
|
+
*/
|
|
301
|
+
export interface StorageHealthStatus {
|
|
302
|
+
healthy: boolean;
|
|
303
|
+
latencyMs?: number;
|
|
304
|
+
error?: string;
|
|
305
|
+
details?: Record<string, unknown>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ADAPTER DESCRIPTOR EXTENSION
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Extended adapter descriptor for storage adapters
|
|
312
|
+
* Adds storage-specific fields to the base AdapterDescriptor
|
|
313
|
+
*/
|
|
314
|
+
export interface StorageAdapterDescriptorFields {
|
|
315
|
+
/** Storage protocols supported */
|
|
316
|
+
protocols: StorageProtocol[];
|
|
317
|
+
/** Whether adapter requires pair schema */
|
|
318
|
+
requiresPairSchema: boolean;
|
|
319
|
+
/** Additional capability flags */
|
|
320
|
+
supportsTransactions?: boolean;
|
|
321
|
+
supportsTTL?: boolean;
|
|
322
|
+
supportsFTS?: boolean;
|
|
323
|
+
persistent?: boolean;
|
|
324
|
+
supportsHierarchy?: boolean;
|
|
325
|
+
supportsComputedFields?: boolean;
|
|
326
|
+
supportsSideEffects?: boolean;
|
|
327
|
+
supportsRawQueries?: boolean;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// CONFIG TYPES FOR COMMON ADAPTERS
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Config for file-based adapters (JSON, SQLite)
|
|
334
|
+
*/
|
|
335
|
+
export interface FileBasedAdapterConfig {
|
|
336
|
+
/** Base path for storage files */
|
|
337
|
+
basePath: string;
|
|
338
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
339
|
+
[key: string]: unknown;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Config for LocalDB adapter (SQLite)
|
|
344
|
+
*/
|
|
345
|
+
export interface LocalDBAdapterConfig extends FileBasedAdapterConfig {
|
|
346
|
+
/** Database file name (default: 'vibes.db') */
|
|
347
|
+
dbName?: string;
|
|
348
|
+
/** Workspace root used for scope template resolution */
|
|
349
|
+
workspacePath?: string;
|
|
350
|
+
/** WAL mode (default: true) */
|
|
351
|
+
walMode?: boolean;
|
|
352
|
+
/** Whether to use custom tables instead of generic vibes_* tables */
|
|
353
|
+
customTables?: boolean;
|
|
354
|
+
/** Migration key for custom tables (required if customTables = true) */
|
|
355
|
+
migrationKey?: string;
|
|
356
|
+
/** Custom table name for single-table manifests */
|
|
357
|
+
tableName?: string;
|
|
358
|
+
/** Manifest ID this config is associated with */
|
|
359
|
+
manifestId?: string;
|
|
360
|
+
/** Namespace of the manifest */
|
|
361
|
+
namespace?: string;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Config for JSON adapter
|
|
366
|
+
*/
|
|
367
|
+
export interface JSONAdapterConfig extends FileBasedAdapterConfig {
|
|
368
|
+
/** Optional filename override for document manifests */
|
|
369
|
+
filename?: string;
|
|
370
|
+
/** Pretty print JSON (default: false in prod) */
|
|
371
|
+
prettyPrint?: boolean;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Config for Memory adapter
|
|
376
|
+
*/
|
|
377
|
+
export interface MemoryAdapterConfig {
|
|
378
|
+
/** Maximum items per namespace (for cache eviction) */
|
|
379
|
+
maxItems?: number;
|
|
380
|
+
/** Default TTL in milliseconds */
|
|
381
|
+
defaultTTL?: number;
|
|
382
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
383
|
+
[key: string]: unknown;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Config for Cloud Direct adapter (running ON cloud)
|
|
388
|
+
*/
|
|
389
|
+
export interface CloudDirectAdapterConfig {
|
|
390
|
+
/** Database connection string */
|
|
391
|
+
connectionString: string;
|
|
392
|
+
/** Database schema (for Postgres) */
|
|
393
|
+
schema?: string;
|
|
394
|
+
/** Connection pool size */
|
|
395
|
+
poolSize?: number;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Config for Cloud API adapter (consumer → cloud bridge)
|
|
400
|
+
*/
|
|
401
|
+
export interface CloudAPIAdapterConfig {
|
|
402
|
+
/** API endpoint URL (full origin, e.g. `https://ai.vibes.dev`). Optional
|
|
403
|
+
* when `ownerApp` is set — the adapter then resolves the origin from
|
|
404
|
+
* `config/environment.apps[ownerApp]` at init time. */
|
|
405
|
+
apiEndpoint?: string;
|
|
406
|
+
/** Owning app id (e.g. `'ai'`, `'tools'`, `'platform'`). When set, the
|
|
407
|
+
* adapter looks up `config/environment.apps[ownerApp]` to determine
|
|
408
|
+
* the base origin for requests. Lets storage manifests declare which
|
|
409
|
+
* cloud worker hosts their data without hardcoding origins per
|
|
410
|
+
* environment. Pairs with the runtime's `config/environment` kind so
|
|
411
|
+
* the same descriptor works in local / staging / production. */
|
|
412
|
+
ownerApp?: string;
|
|
413
|
+
/** API authentication token */
|
|
414
|
+
apiToken?: string;
|
|
415
|
+
/** Request timeout in milliseconds */
|
|
416
|
+
timeout?: number;
|
|
417
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
418
|
+
[key: string]: unknown;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Cloud settings client interface for API-based storage.
|
|
423
|
+
* Generic methods allow type-safe storage operations.
|
|
424
|
+
*/
|
|
425
|
+
export interface CloudSettingsClient {
|
|
426
|
+
/** Get settings from cloud */
|
|
427
|
+
get<T>(namespace: string): Promise<T | null>;
|
|
428
|
+
/** Set settings in cloud */
|
|
429
|
+
set<T>(namespace: string, data: T): Promise<void>;
|
|
430
|
+
/** Reconcile a records collection against its canonical CRUD endpoint */
|
|
431
|
+
reconcile<T extends Record<string, unknown>>(namespace: string, data: T): Promise<void>;
|
|
432
|
+
/** Perform a raw request against a configured cloud endpoint */
|
|
433
|
+
request<T>(path: string, options?: RequestInit): Promise<T | null>;
|
|
434
|
+
/** Delete settings from cloud */
|
|
435
|
+
delete(namespace: string): Promise<void>;
|
|
436
|
+
/** Check if settings exist */
|
|
437
|
+
exists(namespace: string): Promise<boolean>;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Config for Encrypted adapter (decorator)
|
|
442
|
+
*/
|
|
443
|
+
export interface EncryptedAdapterConfig extends FileBasedAdapterConfig {
|
|
444
|
+
/** Encryption key (derived from user secret) */
|
|
445
|
+
encryptionKey?: string;
|
|
446
|
+
/** Key derivation parameters */
|
|
447
|
+
keyDerivation?: {
|
|
448
|
+
salt?: string;
|
|
449
|
+
iterations?: number;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Document Store Interface
|
|
3
|
+
*
|
|
4
|
+
* Simple document store for loading/saving single documents.
|
|
5
|
+
* Schema validation is handled by the adapter.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { z } from 'zod/v4';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Callback for change subscriptions
|
|
12
|
+
*/
|
|
13
|
+
export type DocumentChangeCallback<T> = (data: T | null) => void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Unsubscribe function returned by subscribe()
|
|
17
|
+
*/
|
|
18
|
+
export type Unsubscribe = () => void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Document store for single-document storage
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const store = adapter.documentStore('ai.config', aiConfigSchema);
|
|
26
|
+
* const config = await store.load();
|
|
27
|
+
* await store.save({ ...config, temperature: 0.7 });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export interface StorageDocumentStoreInterface<T> {
|
|
31
|
+
/**
|
|
32
|
+
* Load the document
|
|
33
|
+
* @returns The document or null if not found
|
|
34
|
+
*/
|
|
35
|
+
load(): Promise<T | null>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Save the document
|
|
39
|
+
* @param data The document to save
|
|
40
|
+
*/
|
|
41
|
+
save(data: T): Promise<void>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if the document exists
|
|
45
|
+
*/
|
|
46
|
+
exists(): Promise<boolean>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Delete the document
|
|
50
|
+
*/
|
|
51
|
+
delete(): Promise<void>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the storage path/location (for debugging)
|
|
55
|
+
*/
|
|
56
|
+
getPath(): string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to changes to this document.
|
|
60
|
+
* Returns an unsubscribe function.
|
|
61
|
+
* Only supported if adapter capabilities include supportsSubscription.
|
|
62
|
+
* @param callback Function called when document changes
|
|
63
|
+
* @returns Unsubscribe function
|
|
64
|
+
*/
|
|
65
|
+
subscribe?(callback: DocumentChangeCallback<T>): Unsubscribe;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Factory type for creating document stores
|
|
70
|
+
*/
|
|
71
|
+
export type DocumentStoreFactory<T> = (
|
|
72
|
+
namespace: string,
|
|
73
|
+
schema: z.ZodType<T>
|
|
74
|
+
) => StorageDocumentStoreInterface<T>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Core interfaces for the storage module:
|
|
5
|
+
* - StorageAdapterInterface: Main adapter with document, key-value, and repository support
|
|
6
|
+
* - StorageDocumentStoreInterface: Single-document storage
|
|
7
|
+
* - StorageKeyValueInterface: Key-value storage (pair schema)
|
|
8
|
+
* - StorageRepositoryInterface: Structured record storage with queries
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Main adapter interface
|
|
12
|
+
export {
|
|
13
|
+
type StorageAdapterInterface,
|
|
14
|
+
type StorageAdapterCapabilities,
|
|
15
|
+
type StorageAdapterDescriptorFields,
|
|
16
|
+
type StorageProtocol,
|
|
17
|
+
type StorageHealthStatus,
|
|
18
|
+
type CloudSettingsClient,
|
|
19
|
+
// Config types
|
|
20
|
+
type FileBasedAdapterConfig,
|
|
21
|
+
type LocalDBAdapterConfig,
|
|
22
|
+
type JSONAdapterConfig,
|
|
23
|
+
type MemoryAdapterConfig,
|
|
24
|
+
type CloudDirectAdapterConfig,
|
|
25
|
+
type CloudAPIAdapterConfig,
|
|
26
|
+
type EncryptedAdapterConfig
|
|
27
|
+
} from './adapter';
|
|
28
|
+
|
|
29
|
+
// Document store interface
|
|
30
|
+
export { type StorageDocumentStoreInterface, type DocumentStoreFactory } from './document-store';
|
|
31
|
+
|
|
32
|
+
// Key-value interface
|
|
33
|
+
export {
|
|
34
|
+
type StorageKeyValueInterface,
|
|
35
|
+
type KeyValueSetOptions,
|
|
36
|
+
type KeyValueStoreFactory
|
|
37
|
+
} from './key-value';
|
|
38
|
+
|
|
39
|
+
// Repository interface
|
|
40
|
+
export {
|
|
41
|
+
type StorageRepositoryInterface,
|
|
42
|
+
type RepositoryCreateInput,
|
|
43
|
+
type RepositoryUpdateInput,
|
|
44
|
+
type RepositoryQuery,
|
|
45
|
+
type QueryCondition,
|
|
46
|
+
type RepositoryListOptions,
|
|
47
|
+
type RepositoryFindOptions,
|
|
48
|
+
type RepositoryOrderBy,
|
|
49
|
+
type RepositoryPage,
|
|
50
|
+
type RepositoryMeta,
|
|
51
|
+
type RepositoryFactory,
|
|
52
|
+
type RepositoryOptions
|
|
53
|
+
} from './repository';
|
|
54
|
+
|
|
55
|
+
// Storage record interface (single table CRUD)
|
|
56
|
+
export {
|
|
57
|
+
// Query types
|
|
58
|
+
type WhereFilter,
|
|
59
|
+
type OrderBy,
|
|
60
|
+
type IncludeRelations,
|
|
61
|
+
type PaginationOptions,
|
|
62
|
+
type QueryOptions,
|
|
63
|
+
type QueryResult,
|
|
64
|
+
// Create types
|
|
65
|
+
type CreateInput,
|
|
66
|
+
type CreateManyOptions,
|
|
67
|
+
// Update types
|
|
68
|
+
type UpdateInput,
|
|
69
|
+
type UpdateOptions,
|
|
70
|
+
type UpdateResult,
|
|
71
|
+
// Delete types
|
|
72
|
+
type DeleteOptions,
|
|
73
|
+
type DeleteResult,
|
|
74
|
+
// Relation types
|
|
75
|
+
type LoadedRelation,
|
|
76
|
+
type RecordWithRelations,
|
|
77
|
+
// Transaction types
|
|
78
|
+
type TransactionContext,
|
|
79
|
+
type TransactionFn,
|
|
80
|
+
// Aggregation types
|
|
81
|
+
type AggregationFunction,
|
|
82
|
+
type AggregationOptions,
|
|
83
|
+
type AggregationResult,
|
|
84
|
+
// Stream types
|
|
85
|
+
type StreamOptions,
|
|
86
|
+
// Main interface
|
|
87
|
+
type StorageRecordInterface
|
|
88
|
+
} from './record';
|
|
89
|
+
|
|
90
|
+
// Query-builder database interface (Drizzle-ORM-compatible)
|
|
91
|
+
export { type QueryBuilderDatabase } from './query-builder';
|
|
92
|
+
|
|
93
|
+
// Storage schema interface (multi-table schemas)
|
|
94
|
+
export {
|
|
95
|
+
// Table interface
|
|
96
|
+
type StorageTableInterface,
|
|
97
|
+
// Main interface
|
|
98
|
+
type StorageSchemaInterface,
|
|
99
|
+
// Migration types
|
|
100
|
+
type MigrationStatus,
|
|
101
|
+
type MigrationOptions,
|
|
102
|
+
type MigrationResult,
|
|
103
|
+
// Backup types
|
|
104
|
+
type BackupOptions,
|
|
105
|
+
type BackupResult,
|
|
106
|
+
type RestoreOptions,
|
|
107
|
+
type RestoreResult,
|
|
108
|
+
// Sync types
|
|
109
|
+
type SyncStatus,
|
|
110
|
+
type SyncOptions,
|
|
111
|
+
type SyncResult,
|
|
112
|
+
// Query types
|
|
113
|
+
type CrossTableQueryOptions,
|
|
114
|
+
// Metadata types
|
|
115
|
+
type SchemaStatistics,
|
|
116
|
+
type SchemaHealthStatus
|
|
117
|
+
} from './schema';
|