@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,382 @@
|
|
|
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
|
+
import type { z } from 'zod/v4';
|
|
11
|
+
import type { StorageDocumentStoreInterface } from './document-store';
|
|
12
|
+
import type { StorageKeyValueInterface } from './key-value';
|
|
13
|
+
import type { StorageRepositoryInterface, RepositoryOptions } from './repository';
|
|
14
|
+
import type { StorageRecordInterface } from './record';
|
|
15
|
+
import type { StorageRecordDescriptor } from '../schemas/record';
|
|
16
|
+
import type { StorageCapability, StorageDrive, StorageEntry } from '../schemas/adapter-descriptor';
|
|
17
|
+
/**
|
|
18
|
+
* Universal SQL database handle interface.
|
|
19
|
+
*
|
|
20
|
+
* Abstracts the underlying SQL driver (bun:sqlite, better-sqlite3, postgres, etc.)
|
|
21
|
+
* to keep storage core universal (no Node/Bun/SQL imports in core).
|
|
22
|
+
*
|
|
23
|
+
* Exposes only the surface area that storage core actually uses.
|
|
24
|
+
*/
|
|
25
|
+
export interface SqlDatabaseHandle {
|
|
26
|
+
exec(sql: string): void;
|
|
27
|
+
query<T, P extends any[] = unknown[]>(sql: string): SqlStatement<T, P>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Prepared SQL statement returned by SqlDatabaseHandle.query()
|
|
31
|
+
*/
|
|
32
|
+
export interface SqlStatement<T, P extends any[] = unknown[]> {
|
|
33
|
+
all(...params: P): T[];
|
|
34
|
+
get(...params: P): T | undefined;
|
|
35
|
+
run(...params: P): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Storage protocols supported by adapters
|
|
39
|
+
*/
|
|
40
|
+
export type StorageProtocol = 'document' | 'keyvalue' | 'repository' | 'record';
|
|
41
|
+
/**
|
|
42
|
+
* Storage adapter capabilities
|
|
43
|
+
*/
|
|
44
|
+
export interface StorageAdapterCapabilities {
|
|
45
|
+
/** Supported protocols */
|
|
46
|
+
protocols: StorageProtocol[];
|
|
47
|
+
/**
|
|
48
|
+
* Coarse-grained capability flags mirroring the descriptor's
|
|
49
|
+
* `capabilities[]`. `browse` indicates `list(driveId, path)` +
|
|
50
|
+
* `listDrives()` are implemented.
|
|
51
|
+
*/
|
|
52
|
+
capabilities?: StorageCapability[];
|
|
53
|
+
/** Whether adapter requires pair schema (key + value) for main storage */
|
|
54
|
+
requiresPairSchema: boolean;
|
|
55
|
+
/** Whether adapter supports transactions */
|
|
56
|
+
supportsTransactions: boolean;
|
|
57
|
+
/** Whether adapter supports TTL (for caches) */
|
|
58
|
+
supportsTTL: boolean;
|
|
59
|
+
/** Whether adapter supports full-text search */
|
|
60
|
+
supportsFTS: boolean;
|
|
61
|
+
/** Whether adapter is persistent (survives restarts) */
|
|
62
|
+
persistent: boolean;
|
|
63
|
+
/** Whether adapter supports change subscriptions */
|
|
64
|
+
supportsSubscription: boolean;
|
|
65
|
+
/** Whether adapter supports hierarchical/recursive queries */
|
|
66
|
+
supportsHierarchy: boolean;
|
|
67
|
+
/** Whether adapter supports computed fields (aggregations) */
|
|
68
|
+
supportsComputedFields: boolean;
|
|
69
|
+
/** Whether adapter supports cross-table side effects */
|
|
70
|
+
supportsSideEffects: boolean;
|
|
71
|
+
/** Whether adapter supports raw SQL queries */
|
|
72
|
+
supportsRawQueries: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Main storage adapter interface
|
|
76
|
+
*
|
|
77
|
+
* @typeParam TConfig - Adapter-specific configuration type
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // LocalDB adapter (consumer hardware)
|
|
82
|
+
* interface LocalDBConfig {
|
|
83
|
+
* basePath: string;
|
|
84
|
+
* dbName?: string;
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* class LocalDBAdapter implements StorageAdapterInterface<LocalDBConfig> {
|
|
88
|
+
* configure(config: LocalDBConfig) { ... }
|
|
89
|
+
* documentStore(namespace, schema) { ... }
|
|
90
|
+
* repository(tableName, schema) { ... }
|
|
91
|
+
* record(descriptor) { ... }
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export interface StorageAdapterInterface<TConfig extends Record<string, unknown> = Record<string, unknown>> {
|
|
96
|
+
/**
|
|
97
|
+
* Unique adapter identifier
|
|
98
|
+
*/
|
|
99
|
+
readonly id: string;
|
|
100
|
+
/**
|
|
101
|
+
* Adapter capabilities
|
|
102
|
+
*/
|
|
103
|
+
readonly capabilities: StorageAdapterCapabilities;
|
|
104
|
+
/**
|
|
105
|
+
* Configure the adapter with adapter-specific options
|
|
106
|
+
* @param config Adapter-specific configuration
|
|
107
|
+
*/
|
|
108
|
+
configure(config: TConfig): void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if adapter is configured and ready
|
|
111
|
+
*/
|
|
112
|
+
isConfigured(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Get a document store for a namespace
|
|
115
|
+
*
|
|
116
|
+
* @param namespace Storage namespace (e.g., 'ai.config')
|
|
117
|
+
* @param schema Zod schema for validation
|
|
118
|
+
* @param manifest Storage manifest descriptor (contains adapter-specific config)
|
|
119
|
+
* @returns Document store interface
|
|
120
|
+
* @throws If adapter doesn't support document protocol
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const store = adapter.documentStore('ai.config', aiConfigSchema, manifest);
|
|
125
|
+
* const config = await store.load();
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
documentStore<T>(namespace: string, schema: z.ZodType<T>, manifest?: unknown): StorageDocumentStoreInterface<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Get a key-value store for a namespace
|
|
131
|
+
*
|
|
132
|
+
* @param namespace Storage namespace (e.g., 'cache')
|
|
133
|
+
* @param keySchema Zod schema for keys
|
|
134
|
+
* @param valueSchema Zod schema for values
|
|
135
|
+
* @returns Key-value store interface
|
|
136
|
+
* @throws If adapter doesn't support keyvalue protocol
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const kv = adapter.keyValueStore('cache', z.string(), userSchema);
|
|
141
|
+
* await kv.set('user:123', userData);
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
keyValueStore<TKey, TValue>(namespace: string, keySchema: z.ZodType<TKey>, valueSchema: z.ZodType<TValue>): StorageKeyValueInterface<TKey, TValue>;
|
|
145
|
+
/**
|
|
146
|
+
* Get a repository for a table/collection
|
|
147
|
+
*
|
|
148
|
+
* @param tableName Table or collection name
|
|
149
|
+
* @param schema Zod schema for records
|
|
150
|
+
* @param options Repository options
|
|
151
|
+
* @returns Repository interface
|
|
152
|
+
* @throws If adapter doesn't support repository protocol
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* const repo = adapter.repository('providers', providerSchema);
|
|
157
|
+
* const providers = await repo.list({ limit: 10 });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
repository<T>(tableName: string, schema: z.ZodType<T>, options?: RepositoryOptions): StorageRepositoryInterface<T>;
|
|
161
|
+
/**
|
|
162
|
+
* Get a storage record interface for CRUD operations on a single table.
|
|
163
|
+
*
|
|
164
|
+
* This is the new pattern for storage that uses descriptors to define
|
|
165
|
+
* schema, relations, indexes, and advanced features.
|
|
166
|
+
*
|
|
167
|
+
* @param descriptor - Storage record descriptor
|
|
168
|
+
* @returns Storage record interface with CRUD and advanced operations
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* const todos = adapter.record(todoDescriptor);
|
|
173
|
+
* await todos.initialize();
|
|
174
|
+
*
|
|
175
|
+
* // Basic CRUD
|
|
176
|
+
* await todos.create({ sessionId: '...', title: '...' });
|
|
177
|
+
* const allTodos = await todos.list({ where: { sessionId: '...' }});
|
|
178
|
+
*
|
|
179
|
+
* // FTS (if adapter supports it)
|
|
180
|
+
* const results = await todos.search('implement feature');
|
|
181
|
+
*
|
|
182
|
+
* // Hierarchy (if adapter supports it)
|
|
183
|
+
* const tree = await todos.getTree({ where: { sessionId: '...' }});
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
record<T = unknown>(descriptor: StorageRecordDescriptor): StorageRecordInterface<T>;
|
|
187
|
+
/**
|
|
188
|
+
* Enumerate the top-level "drives" exposed by this adapter.
|
|
189
|
+
*
|
|
190
|
+
* A drive is the unit of selection before drilling into folders —
|
|
191
|
+
* for SharePoint, a site; for OneDrive, the user's default drive; etc.
|
|
192
|
+
*
|
|
193
|
+
* Only adapters that declare the `browse` capability in their
|
|
194
|
+
* descriptor are required to implement this method. Adapters that
|
|
195
|
+
* don't browse omit it.
|
|
196
|
+
*
|
|
197
|
+
* @returns Promise resolving to all drives the current credential can see.
|
|
198
|
+
*/
|
|
199
|
+
listDrives?(): Promise<StorageDrive[]>;
|
|
200
|
+
/**
|
|
201
|
+
* Enumerate files + directories inside a drive at the given path.
|
|
202
|
+
*
|
|
203
|
+
* Only adapters that declare the `browse` capability are required to
|
|
204
|
+
* implement this method. Adapters that don't browse omit it.
|
|
205
|
+
*
|
|
206
|
+
* @param driveId - Drive identifier from `listDrives()`.
|
|
207
|
+
* @param path - Path relative to the drive root. Use `''` (or omit
|
|
208
|
+
* when calling with two args) for the drive's top level. Segments
|
|
209
|
+
* joined with `/`.
|
|
210
|
+
* @returns Promise resolving to the entries at that path.
|
|
211
|
+
*/
|
|
212
|
+
list?(driveId: string, path?: string): Promise<StorageEntry[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Ensure adapter is fully initialized and database is ready for use.
|
|
215
|
+
* Unlike initialize(), this also creates the database connection on first access.
|
|
216
|
+
* Called by StorageRecord before accessing the database.
|
|
217
|
+
*/
|
|
218
|
+
ensureReady(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Get the underlying database connection.
|
|
221
|
+
* Must call ensureReady() first.
|
|
222
|
+
*
|
|
223
|
+
* @returns The raw database connection (e.g., bun:sqlite Database)
|
|
224
|
+
* @throws If database is not initialized
|
|
225
|
+
*/
|
|
226
|
+
getDatabaseConnection(): unknown;
|
|
227
|
+
/**
|
|
228
|
+
* Initialize the adapter (create tables, connect, etc.)
|
|
229
|
+
* Called automatically on first use if not called explicitly.
|
|
230
|
+
*/
|
|
231
|
+
initialize(): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Close connections and clean up
|
|
234
|
+
*/
|
|
235
|
+
close(): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Check adapter health
|
|
238
|
+
*/
|
|
239
|
+
healthCheck(): Promise<StorageHealthStatus>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Health check result
|
|
243
|
+
*/
|
|
244
|
+
export interface StorageHealthStatus {
|
|
245
|
+
healthy: boolean;
|
|
246
|
+
latencyMs?: number;
|
|
247
|
+
error?: string;
|
|
248
|
+
details?: Record<string, unknown>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Extended adapter descriptor for storage adapters
|
|
252
|
+
* Adds storage-specific fields to the base AdapterDescriptor
|
|
253
|
+
*/
|
|
254
|
+
export interface StorageAdapterDescriptorFields {
|
|
255
|
+
/** Storage protocols supported */
|
|
256
|
+
protocols: StorageProtocol[];
|
|
257
|
+
/** Whether adapter requires pair schema */
|
|
258
|
+
requiresPairSchema: boolean;
|
|
259
|
+
/** Additional capability flags */
|
|
260
|
+
supportsTransactions?: boolean;
|
|
261
|
+
supportsTTL?: boolean;
|
|
262
|
+
supportsFTS?: boolean;
|
|
263
|
+
persistent?: boolean;
|
|
264
|
+
supportsHierarchy?: boolean;
|
|
265
|
+
supportsComputedFields?: boolean;
|
|
266
|
+
supportsSideEffects?: boolean;
|
|
267
|
+
supportsRawQueries?: boolean;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Config for file-based adapters (JSON, SQLite)
|
|
271
|
+
*/
|
|
272
|
+
export interface FileBasedAdapterConfig {
|
|
273
|
+
/** Base path for storage files */
|
|
274
|
+
basePath: string;
|
|
275
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
276
|
+
[key: string]: unknown;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Config for LocalDB adapter (SQLite)
|
|
280
|
+
*/
|
|
281
|
+
export interface LocalDBAdapterConfig extends FileBasedAdapterConfig {
|
|
282
|
+
/** Database file name (default: 'vibes.db') */
|
|
283
|
+
dbName?: string;
|
|
284
|
+
/** Workspace root used for scope template resolution */
|
|
285
|
+
workspacePath?: string;
|
|
286
|
+
/** WAL mode (default: true) */
|
|
287
|
+
walMode?: boolean;
|
|
288
|
+
/** Whether to use custom tables instead of generic vibes_* tables */
|
|
289
|
+
customTables?: boolean;
|
|
290
|
+
/** Migration key for custom tables (required if customTables = true) */
|
|
291
|
+
migrationKey?: string;
|
|
292
|
+
/** Custom table name for single-table manifests */
|
|
293
|
+
tableName?: string;
|
|
294
|
+
/** Manifest ID this config is associated with */
|
|
295
|
+
manifestId?: string;
|
|
296
|
+
/** Namespace of the manifest */
|
|
297
|
+
namespace?: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Config for JSON adapter
|
|
301
|
+
*/
|
|
302
|
+
export interface JSONAdapterConfig extends FileBasedAdapterConfig {
|
|
303
|
+
/** Optional filename override for document manifests */
|
|
304
|
+
filename?: string;
|
|
305
|
+
/** Pretty print JSON (default: false in prod) */
|
|
306
|
+
prettyPrint?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Config for Memory adapter
|
|
310
|
+
*/
|
|
311
|
+
export interface MemoryAdapterConfig {
|
|
312
|
+
/** Maximum items per namespace (for cache eviction) */
|
|
313
|
+
maxItems?: number;
|
|
314
|
+
/** Default TTL in milliseconds */
|
|
315
|
+
defaultTTL?: number;
|
|
316
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
317
|
+
[key: string]: unknown;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Config for Cloud Direct adapter (running ON cloud)
|
|
321
|
+
*/
|
|
322
|
+
export interface CloudDirectAdapterConfig {
|
|
323
|
+
/** Database connection string */
|
|
324
|
+
connectionString: string;
|
|
325
|
+
/** Database schema (for Postgres) */
|
|
326
|
+
schema?: string;
|
|
327
|
+
/** Connection pool size */
|
|
328
|
+
poolSize?: number;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Config for Cloud API adapter (consumer → cloud bridge)
|
|
332
|
+
*/
|
|
333
|
+
export interface CloudAPIAdapterConfig {
|
|
334
|
+
/** API endpoint URL (full origin, e.g. `https://ai.vibes.dev`). Optional
|
|
335
|
+
* when `ownerApp` is set — the adapter then resolves the origin from
|
|
336
|
+
* `config/environment.apps[ownerApp]` at init time. */
|
|
337
|
+
apiEndpoint?: string;
|
|
338
|
+
/** Owning app id (e.g. `'ai'`, `'tools'`, `'platform'`). When set, the
|
|
339
|
+
* adapter looks up `config/environment.apps[ownerApp]` to determine
|
|
340
|
+
* the base origin for requests. Lets storage manifests declare which
|
|
341
|
+
* cloud worker hosts their data without hardcoding origins per
|
|
342
|
+
* environment. Pairs with the runtime's `config/environment` kind so
|
|
343
|
+
* the same descriptor works in local / staging / production. */
|
|
344
|
+
ownerApp?: string;
|
|
345
|
+
/** API authentication token */
|
|
346
|
+
apiToken?: string;
|
|
347
|
+
/** Request timeout in milliseconds */
|
|
348
|
+
timeout?: number;
|
|
349
|
+
/** Index signature for Record<string, unknown> compatibility */
|
|
350
|
+
[key: string]: unknown;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Cloud settings client interface for API-based storage.
|
|
354
|
+
* Generic methods allow type-safe storage operations.
|
|
355
|
+
*/
|
|
356
|
+
export interface CloudSettingsClient {
|
|
357
|
+
/** Get settings from cloud */
|
|
358
|
+
get<T>(namespace: string): Promise<T | null>;
|
|
359
|
+
/** Set settings in cloud */
|
|
360
|
+
set<T>(namespace: string, data: T): Promise<void>;
|
|
361
|
+
/** Reconcile a records collection against its canonical CRUD endpoint */
|
|
362
|
+
reconcile<T extends Record<string, unknown>>(namespace: string, data: T): Promise<void>;
|
|
363
|
+
/** Perform a raw request against a configured cloud endpoint */
|
|
364
|
+
request<T>(path: string, options?: RequestInit): Promise<T | null>;
|
|
365
|
+
/** Delete settings from cloud */
|
|
366
|
+
delete(namespace: string): Promise<void>;
|
|
367
|
+
/** Check if settings exist */
|
|
368
|
+
exists(namespace: string): Promise<boolean>;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Config for Encrypted adapter (decorator)
|
|
372
|
+
*/
|
|
373
|
+
export interface EncryptedAdapterConfig extends FileBasedAdapterConfig {
|
|
374
|
+
/** Encryption key (derived from user secret) */
|
|
375
|
+
encryptionKey?: string;
|
|
376
|
+
/** Key derivation parameters */
|
|
377
|
+
keyDerivation?: {
|
|
378
|
+
salt?: string;
|
|
379
|
+
iterations?: number;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/interfaces/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,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AAiC;IACjC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,8BAA8B;IAC9B,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACrE,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,aAAa,CAAC,EAAE;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/interfaces/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
import type { z } from 'zod/v4';
|
|
8
|
+
/**
|
|
9
|
+
* Callback for change subscriptions
|
|
10
|
+
*/
|
|
11
|
+
export type DocumentChangeCallback<T> = (data: T | null) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Unsubscribe function returned by subscribe()
|
|
14
|
+
*/
|
|
15
|
+
export type Unsubscribe = () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Document store for single-document storage
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const store = adapter.documentStore('ai.config', aiConfigSchema);
|
|
22
|
+
* const config = await store.load();
|
|
23
|
+
* await store.save({ ...config, temperature: 0.7 });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface StorageDocumentStoreInterface<T> {
|
|
27
|
+
/**
|
|
28
|
+
* Load the document
|
|
29
|
+
* @returns The document or null if not found
|
|
30
|
+
*/
|
|
31
|
+
load(): Promise<T | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Save the document
|
|
34
|
+
* @param data The document to save
|
|
35
|
+
*/
|
|
36
|
+
save(data: T): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the document exists
|
|
39
|
+
*/
|
|
40
|
+
exists(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete the document
|
|
43
|
+
*/
|
|
44
|
+
delete(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Get the storage path/location (for debugging)
|
|
47
|
+
*/
|
|
48
|
+
getPath(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Subscribe to changes to this document.
|
|
51
|
+
* Returns an unsubscribe function.
|
|
52
|
+
* Only supported if adapter capabilities include supportsSubscription.
|
|
53
|
+
* @param callback Function called when document changes
|
|
54
|
+
* @returns Unsubscribe function
|
|
55
|
+
*/
|
|
56
|
+
subscribe?(callback: DocumentChangeCallback<T>): Unsubscribe;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Factory type for creating document stores
|
|
60
|
+
*/
|
|
61
|
+
export type DocumentStoreFactory<T> = (namespace: string, schema: z.ZodType<T>) => StorageDocumentStoreInterface<T>;
|
|
62
|
+
//# sourceMappingURL=document-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-store.d.ts","sourceRoot":"","sources":["../../src/interfaces/document-store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC/C;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAE1B;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3B;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;OAEG;IACH,OAAO,IAAI,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAChB,6BAA6B,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-store.js","sourceRoot":"","sources":["../../src/interfaces/document-store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export { type StorageAdapterInterface, type StorageAdapterCapabilities, type StorageAdapterDescriptorFields, type StorageProtocol, type StorageHealthStatus, type CloudSettingsClient, type FileBasedAdapterConfig, type LocalDBAdapterConfig, type JSONAdapterConfig, type MemoryAdapterConfig, type CloudDirectAdapterConfig, type CloudAPIAdapterConfig, type EncryptedAdapterConfig } from './adapter';
|
|
11
|
+
export { type StorageDocumentStoreInterface, type DocumentStoreFactory } from './document-store';
|
|
12
|
+
export { type StorageKeyValueInterface, type KeyValueSetOptions, type KeyValueStoreFactory } from './key-value';
|
|
13
|
+
export { type StorageRepositoryInterface, type RepositoryCreateInput, type RepositoryUpdateInput, type RepositoryQuery, type QueryCondition, type RepositoryListOptions, type RepositoryFindOptions, type RepositoryOrderBy, type RepositoryPage, type RepositoryMeta, type RepositoryFactory, type RepositoryOptions } from './repository';
|
|
14
|
+
export { type WhereFilter, type OrderBy, type IncludeRelations, type PaginationOptions, type QueryOptions, type QueryResult, type CreateInput, type CreateManyOptions, type UpdateInput, type UpdateOptions, type UpdateResult, type DeleteOptions, type DeleteResult, type LoadedRelation, type RecordWithRelations, type TransactionContext, type TransactionFn, type AggregationFunction, type AggregationOptions, type AggregationResult, type StreamOptions, type StorageRecordInterface } from './record';
|
|
15
|
+
export { type QueryBuilderDatabase } from './query-builder';
|
|
16
|
+
export { type StorageTableInterface, type StorageSchemaInterface, type MigrationStatus, type MigrationOptions, type MigrationResult, type BackupOptions, type BackupResult, type RestoreOptions, type RestoreResult, type SyncStatus, type SyncOptions, type SyncResult, type CrossTableQueryOptions, type SchemaStatistics, type SchemaHealthStatus } from './schema';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index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sBAAsB,EAC3B,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,OAAO,EAEN,KAAK,qBAAqB,EAE1B,KAAK,sBAAsB,EAE3B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EAEf,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
// Main adapter interface
|
|
11
|
+
export {} from './adapter.js';
|
|
12
|
+
// Document store interface
|
|
13
|
+
export {} from './document-store.js';
|
|
14
|
+
// Key-value interface
|
|
15
|
+
export {} from './key-value.js';
|
|
16
|
+
// Repository interface
|
|
17
|
+
export {} from './repository.js';
|
|
18
|
+
// Storage record interface (single table CRUD)
|
|
19
|
+
export {} from './record';
|
|
20
|
+
// Query-builder database interface (Drizzle-ORM-compatible)
|
|
21
|
+
export {} from './query-builder.js';
|
|
22
|
+
// Storage schema interface (multi-table schemas)
|
|
23
|
+
export {} from './schema';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yBAAyB;AACzB,OAAO,EAeN,MAAM,WAAW,CAAC;AAEnB,2BAA2B;AAC3B,OAAO,EAAiE,MAAM,kBAAkB,CAAC;AAEjG,sBAAsB;AACtB,OAAO,EAIN,MAAM,aAAa,CAAC;AAErB,uBAAuB;AACvB,OAAO,EAaN,MAAM,cAAc,CAAC;AAEtB,+CAA+C;AAC/C,OAAO,EAgCN,MAAM,UAAU,CAAC;AAElB,4DAA4D;AAC5D,OAAO,EAA6B,MAAM,iBAAiB,CAAC;AAE5D,iDAAiD;AACjD,OAAO,EAuBN,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Key-Value Interface
|
|
3
|
+
*
|
|
4
|
+
* Key-value store for adapters that require pair schemas (key + value).
|
|
5
|
+
* Examples: Redis, KV stores, caches.
|
|
6
|
+
*/
|
|
7
|
+
import type { z } from 'zod/v4';
|
|
8
|
+
/**
|
|
9
|
+
* Key-value store for pair-schema storage
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const kv = adapter.keyValueStore('cache', keySchema, valueSchema);
|
|
14
|
+
* await kv.set('user:123', { name: 'Alice' });
|
|
15
|
+
* const user = await kv.get('user:123');
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface StorageKeyValueInterface<TKey, TValue> {
|
|
19
|
+
/**
|
|
20
|
+
* Get a value by key
|
|
21
|
+
* @param key The key to look up
|
|
22
|
+
* @returns The value or null if not found
|
|
23
|
+
*/
|
|
24
|
+
get(key: TKey): Promise<TValue | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Set a value for a key
|
|
27
|
+
* @param key The key
|
|
28
|
+
* @param value The value to store
|
|
29
|
+
* @param options Optional TTL and other settings
|
|
30
|
+
*/
|
|
31
|
+
set(key: TKey, value: TValue, options?: KeyValueSetOptions): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a key
|
|
34
|
+
* @param key The key to delete
|
|
35
|
+
* @returns true if deleted, false if not found
|
|
36
|
+
*/
|
|
37
|
+
delete(key: TKey): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a key exists
|
|
40
|
+
* @param key The key to check
|
|
41
|
+
*/
|
|
42
|
+
has(key: TKey): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Get multiple values by keys
|
|
45
|
+
* @param keys The keys to look up
|
|
46
|
+
* @returns Map of key to value (missing keys omitted)
|
|
47
|
+
*/
|
|
48
|
+
getMany(keys: TKey[]): Promise<Map<TKey, TValue>>;
|
|
49
|
+
/**
|
|
50
|
+
* Set multiple key-value pairs
|
|
51
|
+
* @param entries The entries to set
|
|
52
|
+
*/
|
|
53
|
+
setMany(entries: Array<[TKey, TValue]>): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Delete multiple keys
|
|
56
|
+
* @param keys The keys to delete
|
|
57
|
+
* @returns Number of keys deleted
|
|
58
|
+
*/
|
|
59
|
+
deleteMany(keys: TKey[]): Promise<number>;
|
|
60
|
+
/**
|
|
61
|
+
* Iterate over all keys
|
|
62
|
+
* @param pattern Optional pattern to filter keys (adapter-specific)
|
|
63
|
+
*/
|
|
64
|
+
keys(pattern?: string): AsyncIterable<TKey>;
|
|
65
|
+
/**
|
|
66
|
+
* Iterate over all entries
|
|
67
|
+
* @param pattern Optional pattern to filter keys (adapter-specific)
|
|
68
|
+
*/
|
|
69
|
+
entries(pattern?: string): AsyncIterable<[TKey, TValue]>;
|
|
70
|
+
/**
|
|
71
|
+
* Count keys
|
|
72
|
+
* @param pattern Optional pattern to filter keys
|
|
73
|
+
*/
|
|
74
|
+
count(pattern?: string): Promise<number>;
|
|
75
|
+
/**
|
|
76
|
+
* Clear all entries in this namespace
|
|
77
|
+
*/
|
|
78
|
+
clear(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Options for set operations
|
|
82
|
+
*/
|
|
83
|
+
export interface KeyValueSetOptions {
|
|
84
|
+
/** Time-to-live in milliseconds (for caches) */
|
|
85
|
+
ttl?: number;
|
|
86
|
+
/** Only set if key doesn't exist */
|
|
87
|
+
nx?: boolean;
|
|
88
|
+
/** Only set if key exists */
|
|
89
|
+
xx?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Factory type for creating key-value stores
|
|
93
|
+
*/
|
|
94
|
+
export type KeyValueStoreFactory<TKey, TValue> = (namespace: string, keySchema: z.ZodType<TKey>, valueSchema: z.ZodType<TValue>) => StorageKeyValueInterface<TKey, TValue>;
|
|
95
|
+
//# sourceMappingURL=key-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-value.d.ts","sourceRoot":"","sources":["../../src/interfaces/key-value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB,CAAC,IAAI,EAAE,MAAM;IACrD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpC;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAElD;;;OAGG;IACH,OAAO,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