@camstack/core 0.1.15 → 0.1.17
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/dist/addon/addon-api-factory.d.ts +36 -0
- package/dist/addon/addon-api-factory.d.ts.map +1 -0
- package/dist/addon-routes/addon-route-registry.d.ts +38 -0
- package/dist/addon-routes/addon-route-registry.d.ts.map +1 -0
- package/dist/auth/api-key-manager.d.ts +27 -0
- package/dist/auth/api-key-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.d.ts +47 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/parse-record.d.ts +19 -0
- package/dist/auth/parse-record.d.ts.map +1 -0
- package/dist/auth/scoped-token-manager.d.ts +18 -0
- package/dist/auth/scoped-token-manager.d.ts.map +1 -0
- package/dist/auth/user-manager.d.ts +34 -0
- package/dist/auth/user-manager.d.ts.map +1 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +54 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts.map +1 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +223 -217
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js.map +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +216 -7
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs.map +1 -1
- package/dist/builtins/addon-pages-aggregator/index.d.ts +2 -0
- package/dist/builtins/addon-pages-aggregator/index.d.ts.map +1 -0
- package/dist/builtins/addon-pages-aggregator/index.js +6 -221
- package/dist/builtins/addon-pages-aggregator/index.mjs +2 -9
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +33 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +199 -197
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js.map +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +192 -7
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs.map +1 -1
- package/dist/builtins/addon-widgets-aggregator/index.d.ts +2 -0
- package/dist/builtins/addon-widgets-aggregator/index.d.ts.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/index.js +6 -201
- package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -9
- package/dist/builtins/alerts/alerts.addon.d.ts +82 -0
- package/dist/builtins/alerts/alerts.addon.d.ts.map +1 -0
- package/dist/builtins/alerts/alerts.addon.js +590 -430
- package/dist/builtins/alerts/alerts.addon.js.map +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +595 -7
- package/dist/builtins/alerts/alerts.addon.mjs.map +1 -1
- package/dist/builtins/alerts/index.d.ts +2 -0
- package/dist/builtins/alerts/index.d.ts.map +1 -0
- package/dist/builtins/alerts/index.js +3 -443
- package/dist/builtins/alerts/index.mjs +2 -8
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts +8 -0
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +56 -0
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +1 -0
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +50 -0
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/auth-orchestrator/index.d.ts +2 -0
- package/dist/builtins/auth-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/auth-orchestrator/index.js +7 -0
- package/dist/builtins/auth-orchestrator/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +148 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +7639 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js.map +1 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +7627 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +24 -0
- package/dist/builtins/backup-orchestrator/cron-helpers.d.ts.map +1 -0
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +73 -0
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts.map +1 -0
- package/dist/builtins/backup-orchestrator/download-helpers.d.ts +13 -0
- package/dist/builtins/backup-orchestrator/download-helpers.d.ts.map +1 -0
- package/dist/builtins/backup-orchestrator/index.d.ts +3 -0
- package/dist/builtins/backup-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/backup-orchestrator/index.js +7 -0
- package/dist/builtins/backup-orchestrator/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/manifest-store.d.ts +78 -0
- package/dist/builtins/backup-orchestrator/manifest-store.d.ts.map +1 -0
- package/dist/builtins/console-logging/console-destination.d.ts +14 -0
- package/dist/builtins/console-logging/console-destination.d.ts.map +1 -0
- package/dist/builtins/console-logging/console-logging.addon.d.ts +26 -0
- package/dist/builtins/console-logging/console-logging.addon.d.ts.map +1 -0
- package/dist/builtins/console-logging/index.d.ts +4 -0
- package/dist/builtins/console-logging/index.d.ts.map +1 -0
- package/dist/builtins/console-logging/index.js +99 -235
- package/dist/builtins/console-logging/index.js.map +1 -1
- package/dist/builtins/console-logging/index.mjs +95 -9
- package/dist/builtins/console-logging/index.mjs.map +1 -1
- package/dist/builtins/device-manager/device-event-propagator.d.ts +27 -0
- package/dist/builtins/device-manager/device-event-propagator.d.ts.map +1 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts +259 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts.map +1 -0
- package/dist/builtins/device-manager/device-manager.addon.js +2125 -2127
- package/dist/builtins/device-manager/device-manager.addon.js.map +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +2145 -7
- package/dist/builtins/device-manager/device-manager.addon.mjs.map +1 -1
- package/dist/builtins/device-manager/index.d.ts +3 -0
- package/dist/builtins/device-manager/index.d.ts.map +1 -0
- package/dist/builtins/device-manager/index.js +6 -2156
- package/dist/builtins/device-manager/index.mjs +2 -10
- package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +45 -0
- package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts.map +1 -0
- package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +16 -0
- package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts.map +1 -0
- package/dist/builtins/hub-forwarder/index.d.ts +4 -0
- package/dist/builtins/hub-forwarder/index.d.ts.map +1 -0
- package/dist/builtins/hub-forwarder/index.js +150 -291
- package/dist/builtins/hub-forwarder/index.js.map +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +145 -9
- package/dist/builtins/hub-forwarder/index.mjs.map +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +12 -0
- package/dist/builtins/local-auth/auth-schema.d.ts.map +1 -0
- package/dist/builtins/local-auth/index.d.ts +2 -0
- package/dist/builtins/local-auth/index.d.ts.map +1 -0
- package/dist/builtins/local-auth/index.js +3 -623
- package/dist/builtins/local-auth/index.mjs +2 -8
- package/dist/builtins/local-auth/local-auth.addon.d.ts +17 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -0
- package/dist/builtins/local-auth/local-auth.addon.js +6861 -589
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +6883 -7
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
- package/dist/builtins/local-network/index.d.ts +3 -0
- package/dist/builtins/local-network/index.d.ts.map +1 -0
- package/dist/builtins/local-network/index.js +9 -0
- package/dist/builtins/local-network/index.mjs +2 -0
- package/dist/builtins/local-network/local-network.addon.d.ts +110 -0
- package/dist/builtins/local-network/local-network.addon.d.ts.map +1 -0
- package/dist/builtins/local-network/local-network.addon.js +399 -0
- package/dist/builtins/local-network/local-network.addon.js.map +1 -0
- package/dist/builtins/local-network/local-network.addon.mjs +387 -0
- package/dist/builtins/local-network/local-network.addon.mjs.map +1 -0
- package/dist/builtins/mesh-orchestrator/index.d.ts +2 -0
- package/dist/builtins/mesh-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/mesh-orchestrator/index.js +7 -0
- package/dist/builtins/mesh-orchestrator/index.mjs +2 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts +9 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js +83 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js.map +1 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs +77 -0
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/native-metrics/index.d.ts +3 -0
- package/dist/builtins/native-metrics/index.d.ts.map +1 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts +49 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts.map +1 -0
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts +74 -0
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts.map +1 -0
- package/dist/builtins/native-metrics/native-metrics.addon.js +887 -861
- package/dist/builtins/native-metrics/native-metrics.addon.js.map +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -5
- package/dist/builtins/native-metrics/native-metrics.addon.mjs.map +1 -1
- package/dist/builtins/platform-probe/index.d.ts +12 -0
- package/dist/builtins/platform-probe/index.d.ts.map +1 -0
- package/dist/builtins/platform-probe/index.js +539 -0
- package/dist/builtins/platform-probe/index.js.map +1 -0
- package/dist/builtins/platform-probe/index.mjs +530 -0
- package/dist/builtins/platform-probe/index.mjs.map +1 -0
- package/dist/builtins/platform-probe/inference-config-resolver.d.ts +30 -0
- package/dist/builtins/platform-probe/inference-config-resolver.d.ts.map +1 -0
- package/dist/builtins/platform-probe/platform-scorer.d.ts +22 -0
- package/dist/builtins/platform-probe/platform-scorer.d.ts.map +1 -0
- package/dist/builtins/remote-access-orchestrator/index.d.ts +2 -0
- package/dist/builtins/remote-access-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/remote-access-orchestrator/index.js +7 -0
- package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +9 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +72 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js.map +1 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +66 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/snapshot/index.d.ts +3 -0
- package/dist/builtins/snapshot/index.d.ts.map +1 -0
- package/dist/builtins/snapshot/index.js +481 -491
- package/dist/builtins/snapshot/index.js.map +1 -1
- package/dist/builtins/snapshot/index.mjs +475 -464
- package/dist/builtins/snapshot/index.mjs.map +1 -1
- package/dist/builtins/snapshot/snapshot.addon.d.ts +121 -0
- package/dist/builtins/snapshot/snapshot.addon.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/config-store.d.ts +9 -0
- package/dist/builtins/sqlite-storage/config-store.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/device-store.d.ts +24 -0
- package/dist/builtins/sqlite-storage/device-store.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +87 -0
- package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +312 -56
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +305 -7
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs.map +1 -1
- package/dist/builtins/sqlite-storage/index.d.ts +12 -0
- package/dist/builtins/sqlite-storage/index.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/index.js +229 -1001
- package/dist/builtins/sqlite-storage/index.js.map +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +268 -26
- package/dist/builtins/sqlite-storage/index.mjs.map +1 -1
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +28 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/settings-store.d.ts +40 -0
- package/dist/builtins/sqlite-storage/settings-store.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/sql-schema.d.ts +33 -0
- package/dist/builtins/sqlite-storage/sql-schema.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +94 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +15 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts.map +1 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +586 -653
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +582 -7
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -1
- package/dist/builtins/storage-orchestrator/index.d.ts +7 -0
- package/dist/builtins/storage-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/storage-orchestrator/index.js +9 -0
- package/dist/builtins/storage-orchestrator/index.mjs +2 -0
- package/dist/builtins/storage-orchestrator/location-store.d.ts +50 -0
- package/dist/builtins/storage-orchestrator/location-store.d.ts.map +1 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +60 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +755 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js.map +1 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +746 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +121 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts.map +1 -0
- package/dist/builtins/system-backup/system-backup.service.d.ts +138 -0
- package/dist/builtins/system-backup/system-backup.service.d.ts.map +1 -0
- package/dist/builtins/system-config/index.d.ts +2 -0
- package/dist/builtins/system-config/index.d.ts.map +1 -0
- package/dist/builtins/system-config/index.js +6 -188
- package/dist/builtins/system-config/index.mjs +2 -10
- package/dist/builtins/system-config/system-config.addon.d.ts +11 -0
- package/dist/builtins/system-config/system-config.addon.d.ts.map +1 -0
- package/dist/builtins/system-config/system-config.addon.js +227 -180
- package/dist/builtins/system-config/system-config.addon.js.map +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +226 -7
- package/dist/builtins/system-config/system-config.addon.mjs.map +1 -1
- package/dist/builtins/turn-orchestrator/index.d.ts +2 -0
- package/dist/builtins/turn-orchestrator/index.d.ts.map +1 -0
- package/dist/builtins/turn-orchestrator/index.js +7 -0
- package/dist/builtins/turn-orchestrator/index.mjs +2 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts +10 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts.map +1 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js +78 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js.map +1 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs +72 -0
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs.map +1 -0
- package/dist/builtins/winston-logging/index.d.ts +4 -0
- package/dist/builtins/winston-logging/index.d.ts.map +1 -0
- package/dist/builtins/winston-logging/index.js +153 -300
- package/dist/builtins/winston-logging/index.js.map +1 -1
- package/dist/builtins/winston-logging/index.mjs +144 -9
- package/dist/builtins/winston-logging/index.mjs.map +1 -1
- package/dist/builtins/winston-logging/winston-destination.d.ts +22 -0
- package/dist/builtins/winston-logging/winston-destination.d.ts.map +1 -0
- package/dist/builtins/winston-logging/winston-logging.addon.d.ts +20 -0
- package/dist/builtins/winston-logging/winston-logging.addon.d.ts.map +1 -0
- package/dist/chunk-C13QxCFV.js +50 -0
- package/dist/chunk-hT5z_Zn9.mjs +35 -0
- package/dist/download/model-download-service.d.ts +42 -0
- package/dist/download/model-download-service.d.ts.map +1 -0
- package/dist/download/model-downloader.d.ts +32 -0
- package/dist/download/model-downloader.d.ts.map +1 -0
- package/dist/events/event-bus.d.ts +11 -0
- package/dist/events/event-bus.d.ts.map +1 -0
- package/dist/events/system-event-bus.d.ts +15 -0
- package/dist/events/system-event-bus.d.ts.map +1 -0
- package/dist/feature/feature-manager.d.ts +12 -0
- package/dist/feature/feature-manager.d.ts.map +1 -0
- package/dist/formatter-C-5An4Bl.mjs +164 -0
- package/dist/formatter-C-5An4Bl.mjs.map +1 -0
- package/dist/formatter-Dr_6NNZc.js +169 -0
- package/dist/formatter-Dr_6NNZc.js.map +1 -0
- package/dist/index.d.ts +76 -1696
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7780 -8035
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7707 -2148
- package/dist/index.mjs.map +1 -1
- package/dist/lifecycle/lifecycle-state-machine.d.ts +29 -0
- package/dist/lifecycle/lifecycle-state-machine.d.ts.map +1 -0
- package/dist/logging/formatter.d.ts +31 -0
- package/dist/logging/formatter.d.ts.map +1 -0
- package/dist/logging/log-manager.d.ts +52 -0
- package/dist/logging/log-manager.d.ts.map +1 -0
- package/dist/logging/log-ring-buffer.d.ts +48 -0
- package/dist/logging/log-ring-buffer.d.ts.map +1 -0
- package/dist/logging/scoped-logger.d.ts +18 -0
- package/dist/logging/scoped-logger.d.ts.map +1 -0
- package/dist/network/network-quality.d.ts +12 -0
- package/dist/network/network-quality.d.ts.map +1 -0
- package/dist/notification/notification-service.d.ts +38 -0
- package/dist/notification/notification-service.d.ts.map +1 -0
- package/dist/notification/toast-service.d.ts +23 -0
- package/dist/notification/toast-service.d.ts.map +1 -0
- package/dist/pipeline/engine-manager-resolver.d.ts +16 -0
- package/dist/pipeline/engine-manager-resolver.d.ts.map +1 -0
- package/dist/pipeline/pipeline-runner.d.ts +9 -0
- package/dist/pipeline/pipeline-runner.d.ts.map +1 -0
- package/dist/pipeline/pipeline-validator.d.ts +14 -0
- package/dist/pipeline/pipeline-validator.d.ts.map +1 -0
- package/dist/process/resource-monitor.d.ts +12 -0
- package/dist/process/resource-monitor.d.ts.map +1 -0
- package/dist/python/python-env-manager.d.ts +13 -0
- package/dist/python/python-env-manager.d.ts.map +1 -0
- package/dist/repl/interfaces.d.ts +32 -0
- package/dist/repl/interfaces.d.ts.map +1 -0
- package/dist/repl/repl-engine.d.ts +9 -0
- package/dist/repl/repl-engine.d.ts.map +1 -0
- package/dist/resource-monitor-CmuWlmap.js +76 -0
- package/dist/resource-monitor-CmuWlmap.js.map +1 -0
- package/dist/resource-monitor-DcQdKGYU.mjs +59 -0
- package/dist/resource-monitor-DcQdKGYU.mjs.map +1 -0
- package/dist/storage/fs-storage-backend.d.ts +41 -0
- package/dist/storage/fs-storage-backend.d.ts.map +1 -0
- package/dist/storage/storage-location-manager.d.ts +24 -0
- package/dist/storage/storage-location-manager.d.ts.map +1 -0
- package/dist/storage/storage-manager.d.ts +77 -0
- package/dist/storage/storage-manager.d.ts.map +1 -0
- package/dist/tls/cert-manager.d.ts +27 -0
- package/dist/tls/cert-manager.d.ts.map +1 -0
- package/dist/tls/index.d.ts +2 -0
- package/dist/tls/index.d.ts.map +1 -0
- package/package.json +119 -23
- package/dist/builtins/addon-pages-aggregator/index.js.map +0 -1
- package/dist/builtins/addon-pages-aggregator/index.mjs.map +0 -1
- package/dist/builtins/addon-widgets-aggregator/index.js.map +0 -1
- package/dist/builtins/addon-widgets-aggregator/index.mjs.map +0 -1
- package/dist/builtins/alerts/index.js.map +0 -1
- package/dist/builtins/alerts/index.mjs.map +0 -1
- package/dist/builtins/device-manager/index.js.map +0 -1
- package/dist/builtins/device-manager/index.mjs.map +0 -1
- package/dist/builtins/local-auth/index.js.map +0 -1
- package/dist/builtins/local-auth/index.mjs.map +0 -1
- package/dist/builtins/local-backup/index.js +0 -173
- package/dist/builtins/local-backup/index.js.map +0 -1
- package/dist/builtins/local-backup/index.mjs +0 -10
- package/dist/builtins/local-backup/index.mjs.map +0 -1
- package/dist/builtins/system-config/index.js.map +0 -1
- package/dist/builtins/system-config/index.mjs.map +0 -1
- package/dist/chunk-2CIYKDRN.mjs +0 -1
- package/dist/chunk-2CIYKDRN.mjs.map +0 -1
- package/dist/chunk-2F76X6NL.mjs +0 -136
- package/dist/chunk-2F76X6NL.mjs.map +0 -1
- package/dist/chunk-2QUFBZ7M.mjs +0 -1
- package/dist/chunk-2QUFBZ7M.mjs.map +0 -1
- package/dist/chunk-3BK2Y7GY.mjs +0 -593
- package/dist/chunk-3BK2Y7GY.mjs.map +0 -1
- package/dist/chunk-4OOHFJHT.mjs +0 -421
- package/dist/chunk-4OOHFJHT.mjs.map +0 -1
- package/dist/chunk-4XHB7IHT.mjs +0 -809
- package/dist/chunk-4XHB7IHT.mjs.map +0 -1
- package/dist/chunk-6M2HSSTQ.mjs +0 -98
- package/dist/chunk-6M2HSSTQ.mjs.map +0 -1
- package/dist/chunk-7FI7SQS7.mjs +0 -135
- package/dist/chunk-7FI7SQS7.mjs.map +0 -1
- package/dist/chunk-ED57RCQE.mjs +0 -171
- package/dist/chunk-ED57RCQE.mjs.map +0 -1
- package/dist/chunk-FZN56HGQ.mjs +0 -626
- package/dist/chunk-FZN56HGQ.mjs.map +0 -1
- package/dist/chunk-GL4OOB25.mjs +0 -51
- package/dist/chunk-GL4OOB25.mjs.map +0 -1
- package/dist/chunk-KDG2NTDB.mjs +0 -137
- package/dist/chunk-KDG2NTDB.mjs.map +0 -1
- package/dist/chunk-NRBQWBDM.mjs +0 -191
- package/dist/chunk-NRBQWBDM.mjs.map +0 -1
- package/dist/chunk-O4V246GG.mjs +0 -2137
- package/dist/chunk-O4V246GG.mjs.map +0 -1
- package/dist/chunk-QT57H266.mjs +0 -163
- package/dist/chunk-QT57H266.mjs.map +0 -1
- package/dist/chunk-QX4RH25I.mjs +0 -141
- package/dist/chunk-QX4RH25I.mjs.map +0 -1
- package/dist/chunk-TB562PZX.mjs +0 -86
- package/dist/chunk-TB562PZX.mjs.map +0 -1
- package/dist/chunk-TDYPZXK5.mjs +0 -1
- package/dist/chunk-TDYPZXK5.mjs.map +0 -1
- package/dist/chunk-UJI4LN5P.mjs +0 -36
- package/dist/chunk-UJI4LN5P.mjs.map +0 -1
- package/dist/chunk-W6RTHQGP.mjs +0 -1
- package/dist/chunk-W6RTHQGP.mjs.map +0 -1
- package/dist/chunk-ZELBCPDC.mjs +0 -369
- package/dist/chunk-ZELBCPDC.mjs.map +0 -1
- package/dist/index.d.mts +0 -1696
- package/dist/resource-monitor-UZUGPIAU.mjs +0 -9
- package/dist/resource-monitor-UZUGPIAU.mjs.map +0 -1
- package/dist/storage-location-manager-HFNB3PCS.mjs +0 -7
- package/dist/storage-location-manager-HFNB3PCS.mjs.map +0 -1
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_chunk = require("../../chunk-C13QxCFV.js");
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
|
+
let _camstack_types = require("@camstack/types");
|
|
9
|
+
//#region src/builtins/storage-orchestrator/storage-orchestrator.service.ts
|
|
10
|
+
var StorageOrchestratorService = class {
|
|
11
|
+
locations = /* @__PURE__ */ new Map();
|
|
12
|
+
constructor(logger, getProviders, locationStore = null) {
|
|
13
|
+
this.logger = logger;
|
|
14
|
+
this.getProviders = getProviders;
|
|
15
|
+
this.locationStore = locationStore;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hydrate the in-memory map from the persistence layer. Called once
|
|
19
|
+
* by the addon during `onInitialize`, before the eager seed pass.
|
|
20
|
+
* Idempotent — running it twice with the same store contents
|
|
21
|
+
* produces the same map. No-op when the service was constructed
|
|
22
|
+
* without a store.
|
|
23
|
+
*
|
|
24
|
+
* Errors loading individual rows are tolerated: the bad row is
|
|
25
|
+
* skipped and logged so a single corrupted record doesn't lock the
|
|
26
|
+
* whole orchestrator out of boot. (The store-side validation pass
|
|
27
|
+
* before insert means only schema-invalid SQL state can produce
|
|
28
|
+
* such a row.)
|
|
29
|
+
*/
|
|
30
|
+
async initialize() {
|
|
31
|
+
if (!this.locationStore) return;
|
|
32
|
+
const rows = await this.locationStore.loadAll();
|
|
33
|
+
let upgraded = 0;
|
|
34
|
+
for (const loc of rows) if (!loc.isSystem && loc.id === `${loc.type}:default`) {
|
|
35
|
+
const upgradedLoc = {
|
|
36
|
+
...loc,
|
|
37
|
+
isSystem: true
|
|
38
|
+
};
|
|
39
|
+
this.locations.set(upgradedLoc.id, upgradedLoc);
|
|
40
|
+
this.locationStore.upsert(upgradedLoc).catch((err) => {
|
|
41
|
+
this.logger.warn("storage-orchestrator: isSystem upgrade persist failed", { meta: {
|
|
42
|
+
id: upgradedLoc.id,
|
|
43
|
+
error: err instanceof Error ? err.message : String(err)
|
|
44
|
+
} });
|
|
45
|
+
});
|
|
46
|
+
upgraded++;
|
|
47
|
+
} else this.locations.set(loc.id, loc);
|
|
48
|
+
this.logger.info("storage-orchestrator: hydrated locations from store", { meta: {
|
|
49
|
+
loaded: this.locations.size,
|
|
50
|
+
isSystemUpgraded: upgraded
|
|
51
|
+
} });
|
|
52
|
+
}
|
|
53
|
+
listLocations(filter) {
|
|
54
|
+
const all = [...this.locations.values()];
|
|
55
|
+
return filter?.type ? all.filter((l) => l.type === filter.type) : all;
|
|
56
|
+
}
|
|
57
|
+
getDefaultLocation(type) {
|
|
58
|
+
for (const loc of this.locations.values()) if (loc.type === type && loc.isDefault) return loc;
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Insert or update a location. If `isDefault: true`, atomically
|
|
63
|
+
* demotes any other default for the same type — operators always see
|
|
64
|
+
* exactly one default per type.
|
|
65
|
+
*
|
|
66
|
+
* When a persistence store is wired (Task 6), the new record AND any
|
|
67
|
+
* implicitly-demoted siblings are persisted before the in-memory map
|
|
68
|
+
* mutation returns. Persistence errors propagate to the caller.
|
|
69
|
+
*/
|
|
70
|
+
upsertLocation(input) {
|
|
71
|
+
const now = Date.now();
|
|
72
|
+
const existing = this.locations.get(input.id);
|
|
73
|
+
if (!existing) {
|
|
74
|
+
if (_camstack_types.STORAGE_LOCATION_CARDINALITY[input.type] === "singleton") {
|
|
75
|
+
const already = [...this.locations.values()].find((l) => l.type === input.type);
|
|
76
|
+
if (already) throw new Error(`Storage type "${input.type}" is singleton — only one location allowed (existing: "${already.id}"). Edit it instead of adding a new one.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (existing?.isSystem === true) input = {
|
|
80
|
+
...input,
|
|
81
|
+
isSystem: true
|
|
82
|
+
};
|
|
83
|
+
const next = {
|
|
84
|
+
...input,
|
|
85
|
+
createdAt: existing?.createdAt ?? now,
|
|
86
|
+
updatedAt: now
|
|
87
|
+
};
|
|
88
|
+
const demoted = [];
|
|
89
|
+
if (next.isDefault) {
|
|
90
|
+
for (const [otherId, otherLoc] of this.locations) if (otherLoc.type === next.type && otherLoc.id !== next.id && otherLoc.isDefault) {
|
|
91
|
+
const updated = {
|
|
92
|
+
...otherLoc,
|
|
93
|
+
isDefault: false,
|
|
94
|
+
updatedAt: now
|
|
95
|
+
};
|
|
96
|
+
this.locations.set(otherId, updated);
|
|
97
|
+
demoted.push(updated);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.locations.set(next.id, next);
|
|
101
|
+
this.logger.debug("storage-orchestrator: upsertLocation", { meta: {
|
|
102
|
+
id: next.id,
|
|
103
|
+
type: next.type,
|
|
104
|
+
providerId: next.providerId,
|
|
105
|
+
isDefault: next.isDefault
|
|
106
|
+
} });
|
|
107
|
+
if (this.locationStore) {
|
|
108
|
+
const store = this.locationStore;
|
|
109
|
+
(async () => {
|
|
110
|
+
try {
|
|
111
|
+
for (const d of demoted) await store.upsert(d);
|
|
112
|
+
await store.upsert(next);
|
|
113
|
+
} catch (err) {
|
|
114
|
+
this.logger.error("storage-orchestrator: upsert persistence failed", { meta: {
|
|
115
|
+
id: next.id,
|
|
116
|
+
error: err instanceof Error ? err.message : String(err)
|
|
117
|
+
} });
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
}
|
|
121
|
+
return next;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Remove a location. Refuses to remove the default of a type unless a
|
|
125
|
+
* sibling default exists (defensive — `upsertLocation` already ensures
|
|
126
|
+
* at most one default per type, but the logic guards against future
|
|
127
|
+
* bypass paths e.g. SQLite migration that imports two defaults).
|
|
128
|
+
*
|
|
129
|
+
* Persistence (Task 6) mirrors the delete asynchronously, with errors
|
|
130
|
+
* routed to the logger — see `upsertLocation` for the rationale.
|
|
131
|
+
*/
|
|
132
|
+
deleteLocation(id) {
|
|
133
|
+
const loc = this.locations.get(id);
|
|
134
|
+
if (!loc) throw new Error(`Storage location "${id}" not found`);
|
|
135
|
+
if (loc.isSystem) throw new Error(`Storage location "${id}" is system-managed and cannot be deleted. Edit its config (path / providerId) instead.`);
|
|
136
|
+
if (loc.isDefault) {
|
|
137
|
+
if (![...this.locations.values()].find((l) => l.type === loc.type && l.id !== id && l.isDefault)) throw new Error(`Cannot delete default location "${id}" for type "${loc.type}" — promote another location to default first`);
|
|
138
|
+
}
|
|
139
|
+
this.locations.delete(id);
|
|
140
|
+
if (this.locationStore) this.locationStore.delete(id).catch((err) => {
|
|
141
|
+
this.logger.error("storage-orchestrator: delete persistence failed", { meta: {
|
|
142
|
+
id,
|
|
143
|
+
error: err instanceof Error ? err.message : String(err)
|
|
144
|
+
} });
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Resolve a `StorageLocationRef` to a concrete `StorageLocation`.
|
|
149
|
+
* - bare type (e.g. `'backups'`) → default location of that type
|
|
150
|
+
* - fully-qualified id (e.g. `'backups:nas-01'`) → that exact instance
|
|
151
|
+
*
|
|
152
|
+
* Throws an actionable error when nothing matches — every consumer of
|
|
153
|
+
* the singleton `storage` cap funnels through here, so the error
|
|
154
|
+
* message is what operators see when the orchestrator's view of the
|
|
155
|
+
* world doesn't match expectations.
|
|
156
|
+
*/
|
|
157
|
+
resolveRef(ref) {
|
|
158
|
+
if (ref.includes(":")) {
|
|
159
|
+
const loc = this.locations.get(ref);
|
|
160
|
+
if (!loc) throw new Error(`Storage location "${ref}" not found`);
|
|
161
|
+
return loc;
|
|
162
|
+
}
|
|
163
|
+
const parsed = _camstack_types.StorageLocationTypeSchema.safeParse(ref);
|
|
164
|
+
if (!parsed.success) throw new Error(`Invalid storage location ref "${ref}" — expected a StorageLocationType or a fully-qualified id (\`<type>:<slug>\`)`);
|
|
165
|
+
const def = this.getDefaultLocation(parsed.data);
|
|
166
|
+
if (!def) throw new Error(`No default storage location configured for type "${parsed.data}" — register one or pass a fully-qualified id (\`<type>:<slug>\`)`);
|
|
167
|
+
return def;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Find the storage-provider that backs a given location. Lookup is by
|
|
171
|
+
* `location.providerId` against `getProviderInfo().providerId` from
|
|
172
|
+
* each registered collection provider. Throws with both the missing
|
|
173
|
+
* providerId and the offending location id so the operator can pick
|
|
174
|
+
* the right place to fix the config.
|
|
175
|
+
*/
|
|
176
|
+
async getProviderFor(location) {
|
|
177
|
+
const providers = this.getProviders();
|
|
178
|
+
for (const p of providers) if ((await p.getProviderInfo()).providerId === location.providerId) return p;
|
|
179
|
+
throw new Error(`No storage-provider registered for providerId "${location.providerId}" (location "${location.id}")`);
|
|
180
|
+
}
|
|
181
|
+
/** Convenience: lookup by id (returns `undefined` if not found). */
|
|
182
|
+
getLocationById(id) {
|
|
183
|
+
return this.locations.get(id);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Seed one default `StorageLocation` per `supportedTypes` entry that
|
|
187
|
+
* doesn't already have one. Idempotent — re-running with the same
|
|
188
|
+
* provider info on a populated map is a no-op (each entry already
|
|
189
|
+
* resolves on `id === <type>:default`).
|
|
190
|
+
*
|
|
191
|
+
* Convention: the bare-type ref `'backups'` resolves via
|
|
192
|
+
* `getDefaultLocation('backups')` (walks `isDefault === true`); the
|
|
193
|
+
* actual stored `id` is `'backups:default'` so it satisfies the
|
|
194
|
+
* `^[a-z][a-z0-9-]*:[a-z0-9-]+$` regex on `StorageLocationSchema.id`.
|
|
195
|
+
*
|
|
196
|
+
* `basePath` is the provider's storage root (e.g. the filesystem
|
|
197
|
+
* provider's `<CAMSTACK_DATA>` dir). Each location's `config.basePath`
|
|
198
|
+
* is set to `<basePath>/<DEFAULT_LOCATION_SUBDIRS[type]>` — except
|
|
199
|
+
* when the subdir is already absolute (today only `cache` →
|
|
200
|
+
* `/tmp/camstack-cache`), in which case it's used verbatim. The
|
|
201
|
+
* filesystem provider re-derives the same path on its own — this
|
|
202
|
+
* config field is purely an operator-visible record of what was
|
|
203
|
+
* provisioned. Task 7 will refactor providers to honour the
|
|
204
|
+
* location's `config.basePath` directly.
|
|
205
|
+
*/
|
|
206
|
+
seedDefaults(input) {
|
|
207
|
+
let added = 0;
|
|
208
|
+
for (const type of input.supportedTypes) {
|
|
209
|
+
if (this.hasAnyLocationOfType(type)) continue;
|
|
210
|
+
const subdir = _camstack_types.DEFAULT_LOCATION_SUBDIRS[type];
|
|
211
|
+
const fullPath = node_path.isAbsolute(subdir) ? subdir : node_path.join(input.basePath, subdir);
|
|
212
|
+
const id = `${type}:default`;
|
|
213
|
+
this.upsertLocation({
|
|
214
|
+
id,
|
|
215
|
+
type,
|
|
216
|
+
displayName: DEFAULT_DISPLAY_NAMES[type],
|
|
217
|
+
providerId: input.providerId,
|
|
218
|
+
config: { basePath: fullPath },
|
|
219
|
+
isDefault: true,
|
|
220
|
+
isSystem: true
|
|
221
|
+
});
|
|
222
|
+
added++;
|
|
223
|
+
}
|
|
224
|
+
if (added > 0) this.logger.info("storage-orchestrator: seeded default locations", { meta: {
|
|
225
|
+
providerId: input.providerId,
|
|
226
|
+
added,
|
|
227
|
+
basePath: input.basePath
|
|
228
|
+
} });
|
|
229
|
+
}
|
|
230
|
+
/** Internal: check whether any location of the given type exists. */
|
|
231
|
+
hasAnyLocationOfType(type) {
|
|
232
|
+
for (const loc of this.locations.values()) if (loc.type === type) return true;
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Operator-facing names for the default seeded location of each
|
|
238
|
+
* `StorageLocationType`. Kept in this module (not in `interfaces/`)
|
|
239
|
+
* because they're a concern of the orchestrator's seed step — operator
|
|
240
|
+
* UI reads `location.displayName` after seeding.
|
|
241
|
+
*/
|
|
242
|
+
var DEFAULT_DISPLAY_NAMES = {
|
|
243
|
+
"data": "Local Data",
|
|
244
|
+
"media": "Local Media",
|
|
245
|
+
"recordings": "Local Recordings",
|
|
246
|
+
"recordings-high": "Local Recordings (High)",
|
|
247
|
+
"recordings-low": "Local Recordings (Low)",
|
|
248
|
+
"recordings-clips": "Local Recordings (Clips)",
|
|
249
|
+
"event-images": "Local Event Images",
|
|
250
|
+
"models": "Local Models",
|
|
251
|
+
"addons-data": "Local Addons Data",
|
|
252
|
+
"cache": "Local Cache",
|
|
253
|
+
"logs": "Local Logs",
|
|
254
|
+
"backups": "Local Backups"
|
|
255
|
+
};
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/builtins/storage-orchestrator/location-store.ts
|
|
258
|
+
var STORAGE_LOCATIONS_TABLE = "storage_locations";
|
|
259
|
+
var STORAGE_LOCATIONS_SCHEMA = {
|
|
260
|
+
columns: [
|
|
261
|
+
{
|
|
262
|
+
name: "id",
|
|
263
|
+
type: "TEXT",
|
|
264
|
+
primaryKey: true
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "type",
|
|
268
|
+
type: "TEXT",
|
|
269
|
+
notNull: true
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "display_name",
|
|
273
|
+
type: "TEXT",
|
|
274
|
+
notNull: true
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "provider_id",
|
|
278
|
+
type: "TEXT",
|
|
279
|
+
notNull: true
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "config",
|
|
283
|
+
type: "TEXT",
|
|
284
|
+
notNull: true,
|
|
285
|
+
defaultValue: "{}"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "is_default",
|
|
289
|
+
type: "INTEGER",
|
|
290
|
+
notNull: true,
|
|
291
|
+
defaultValue: 0
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "is_system",
|
|
295
|
+
type: "INTEGER",
|
|
296
|
+
notNull: true,
|
|
297
|
+
defaultValue: 0
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "created_at",
|
|
301
|
+
type: "INTEGER",
|
|
302
|
+
notNull: true
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "updated_at",
|
|
306
|
+
type: "INTEGER",
|
|
307
|
+
notNull: true
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
indexes: [{
|
|
311
|
+
name: "idx_storage_locations_type",
|
|
312
|
+
columns: ["type"]
|
|
313
|
+
}]
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* SQLite-backed implementation of `ILocationStore` — uses the
|
|
317
|
+
* `settings-store` cap's structured-table surface (`ensureTable` /
|
|
318
|
+
* `tableInsert` / `tableUpdate` / `tableDelete` / `tableQuery`). Wired
|
|
319
|
+
* to the live `ISettingsBackend` provider obtained from
|
|
320
|
+
* `kernel.capabilityRegistry.getSingleton('settings-store')`.
|
|
321
|
+
*
|
|
322
|
+
* The cap-router surface (`ctx.api.settingsStore.*`) does NOT expose
|
|
323
|
+
* the `tableXxx` methods — they're only on the raw `ISettingsBackend`.
|
|
324
|
+
* Same constraint that drives `IntegrationRegistry` to take a direct
|
|
325
|
+
* provider reference instead of going through the cap.
|
|
326
|
+
*/
|
|
327
|
+
var SqliteLocationStore = class {
|
|
328
|
+
tableEnsured = false;
|
|
329
|
+
constructor(backend) {
|
|
330
|
+
this.backend = backend;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Lazy `ensureTable` — keeps the constructor cheap and async-free.
|
|
334
|
+
* Called from every mutation/read path; the backend's `ensureTable`
|
|
335
|
+
* is itself idempotent (additive migration), so repeated calls are
|
|
336
|
+
* effectively no-ops after the first.
|
|
337
|
+
*/
|
|
338
|
+
async ensureTable() {
|
|
339
|
+
if (this.tableEnsured) return;
|
|
340
|
+
if (!this.backend.ensureTable) throw new Error("SqliteLocationStore: settings backend does not implement ensureTable — expected the SQLite settings backend, got a backend without structured-table support");
|
|
341
|
+
await this.backend.ensureTable(STORAGE_LOCATIONS_TABLE, STORAGE_LOCATIONS_SCHEMA);
|
|
342
|
+
this.tableEnsured = true;
|
|
343
|
+
}
|
|
344
|
+
async loadAll() {
|
|
345
|
+
await this.ensureTable();
|
|
346
|
+
if (!this.backend.tableQuery) return [];
|
|
347
|
+
const rows = await this.backend.tableQuery(STORAGE_LOCATIONS_TABLE, { orderBy: {
|
|
348
|
+
field: "created_at",
|
|
349
|
+
direction: "asc"
|
|
350
|
+
} });
|
|
351
|
+
const out = [];
|
|
352
|
+
for (const row of rows) {
|
|
353
|
+
const mapped = mapRowToLocation(row);
|
|
354
|
+
if (mapped) out.push(mapped);
|
|
355
|
+
}
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Replace-or-insert. Implemented as `delete` + `insert` rather than
|
|
360
|
+
* the conditional `tableUpdate` path because the orchestrator
|
|
361
|
+
* serializes every mutation through the in-memory map before
|
|
362
|
+
* dispatching to the store — there's no contention to lose, and the
|
|
363
|
+
* delete-then-insert path is unconditionally simpler.
|
|
364
|
+
*/
|
|
365
|
+
async upsert(loc) {
|
|
366
|
+
await this.ensureTable();
|
|
367
|
+
if (!this.backend.tableDelete || !this.backend.tableInsert) throw new Error("SqliteLocationStore: backend missing tableDelete/tableInsert");
|
|
368
|
+
await this.backend.tableDelete(STORAGE_LOCATIONS_TABLE, { id: loc.id });
|
|
369
|
+
await this.backend.tableInsert(STORAGE_LOCATIONS_TABLE, mapLocationToRow(loc));
|
|
370
|
+
}
|
|
371
|
+
async delete(id) {
|
|
372
|
+
await this.ensureTable();
|
|
373
|
+
if (!this.backend.tableDelete) throw new Error("SqliteLocationStore: backend missing tableDelete");
|
|
374
|
+
await this.backend.tableDelete(STORAGE_LOCATIONS_TABLE, { id });
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
function mapLocationToRow(loc) {
|
|
378
|
+
return {
|
|
379
|
+
id: loc.id,
|
|
380
|
+
type: loc.type,
|
|
381
|
+
display_name: loc.displayName,
|
|
382
|
+
provider_id: loc.providerId,
|
|
383
|
+
config: JSON.stringify(loc.config),
|
|
384
|
+
is_default: loc.isDefault ? 1 : 0,
|
|
385
|
+
is_system: loc.isSystem ? 1 : 0,
|
|
386
|
+
created_at: loc.createdAt,
|
|
387
|
+
updated_at: loc.updatedAt
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Decode a row read from the structured table. Returns `null` when the
|
|
392
|
+
* row's `type` doesn't parse against the Zod enum — the caller skips
|
|
393
|
+
* the row and logs. Defensive against schema drift across upgrades
|
|
394
|
+
* (e.g. an older build wrote a since-removed `recordings-archive`
|
|
395
|
+
* type and the new build no longer recognises it).
|
|
396
|
+
*/
|
|
397
|
+
function mapRowToLocation(row) {
|
|
398
|
+
const typeRaw = row["type"];
|
|
399
|
+
const parsedType = _camstack_types.StorageLocationTypeSchema.safeParse(typeRaw);
|
|
400
|
+
if (!parsedType.success) return null;
|
|
401
|
+
const type = parsedType.data;
|
|
402
|
+
const id = String(row["id"] ?? "");
|
|
403
|
+
if (!id) return null;
|
|
404
|
+
const configRaw = row["config"];
|
|
405
|
+
const config = typeof configRaw === "string" && configRaw.length > 0 ? (0, _camstack_types.parseJsonObject)(configRaw) ?? {} : {};
|
|
406
|
+
return {
|
|
407
|
+
id,
|
|
408
|
+
type,
|
|
409
|
+
displayName: String(row["display_name"] ?? ""),
|
|
410
|
+
providerId: String(row["provider_id"] ?? ""),
|
|
411
|
+
config,
|
|
412
|
+
isDefault: row["is_default"] === 1 || row["is_default"] === true,
|
|
413
|
+
isSystem: row["is_system"] === 1 || row["is_system"] === true,
|
|
414
|
+
createdAt: Number(row["created_at"] ?? 0),
|
|
415
|
+
updatedAt: Number(row["updated_at"] ?? 0)
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/builtins/storage-orchestrator/storage-orchestrator.addon.ts
|
|
420
|
+
/**
|
|
421
|
+
* `storage-orchestrator` builtin — singleton owner of the consumer-
|
|
422
|
+
* facing `storage` cap.
|
|
423
|
+
*
|
|
424
|
+
* Responsibilities:
|
|
425
|
+
* - Hold the `locationId → StorageLocation` map (in-memory; Task 6
|
|
426
|
+
* adds persistence).
|
|
427
|
+
* - Resolve `StorageLocationRef` → concrete `StorageLocation`.
|
|
428
|
+
* - Dispatch every cap method to the right `storage-provider`
|
|
429
|
+
* (collection cap, registered by `filesystem-storage` and future
|
|
430
|
+
* SFTP / S3 / WebDAV addons).
|
|
431
|
+
* - Track ownership of upload / download sessions so chunked I/O
|
|
432
|
+
* (which carries no `location` after the first hop) can route
|
|
433
|
+
* subsequent chunks to the same provider.
|
|
434
|
+
* - First-boot seed defaults from each provider's
|
|
435
|
+
* `getProviderInfo().supportedLocationTypes` (Task 5). Re-runs on
|
|
436
|
+
* every `capability:provider-registered` event so providers that
|
|
437
|
+
* register after the orchestrator boots also get seeded — the
|
|
438
|
+
* `hasAnyLocationOfType` guard makes the operation idempotent.
|
|
439
|
+
*
|
|
440
|
+
* Task 6 will plug a persistence backend in front of the in-memory map.
|
|
441
|
+
* Task 7 will migrate consumers off the legacy storage shim.
|
|
442
|
+
*/
|
|
443
|
+
var STORAGE_PROVIDER_CAP_NAME = "storage-provider";
|
|
444
|
+
/**
|
|
445
|
+
* Raw event category emitted by `CapabilityRegistry.registerProvider` —
|
|
446
|
+
* not in the typed `EventCategory` enum because it lives in the kernel
|
|
447
|
+
* infra layer (every cap-bound event is a custom-shape payload).
|
|
448
|
+
*/
|
|
449
|
+
var CAP_PROVIDER_REGISTERED_CATEGORY = "capability:provider-registered";
|
|
450
|
+
var StorageOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
451
|
+
service = null;
|
|
452
|
+
/**
|
|
453
|
+
* `uploadId` → providerId. Populated on `beginUpload`, consulted on
|
|
454
|
+
* every subsequent `writeChunk` / `finalizeUpload` / `abortUpload`,
|
|
455
|
+
* cleared on terminal calls. The provider holds the actual session
|
|
456
|
+
* state (open file descriptor, buffered offsets, …) — we just
|
|
457
|
+
* remember which provider owns it.
|
|
458
|
+
*/
|
|
459
|
+
uploadOwners = /* @__PURE__ */ new Map();
|
|
460
|
+
/** Symmetric to `uploadOwners` for download sessions. */
|
|
461
|
+
downloadOwners = /* @__PURE__ */ new Map();
|
|
462
|
+
/**
|
|
463
|
+
* Disposers run on `onShutdown` — currently the eventBus subscription
|
|
464
|
+
* for `capability:provider-registered` events used by the lazy seed
|
|
465
|
+
* fallback. Stored separately from the `BaseAddon` disposer chain so
|
|
466
|
+
* it can be inspected in tests.
|
|
467
|
+
*/
|
|
468
|
+
seedSubscriptionDisposers = [];
|
|
469
|
+
constructor() {
|
|
470
|
+
super({});
|
|
471
|
+
}
|
|
472
|
+
async onInitialize() {
|
|
473
|
+
const getProviders = () => {
|
|
474
|
+
const reg = this.ctx.kernel.capabilityRegistry;
|
|
475
|
+
if (!reg) return [];
|
|
476
|
+
return reg.getCollection(STORAGE_PROVIDER_CAP_NAME);
|
|
477
|
+
};
|
|
478
|
+
const locationStore = this.resolveLocationStore();
|
|
479
|
+
const service = new StorageOrchestratorService(this.ctx.logger, getProviders, locationStore);
|
|
480
|
+
this.service = service;
|
|
481
|
+
await service.initialize();
|
|
482
|
+
const provider = {
|
|
483
|
+
listLocations: async ({ type }) => {
|
|
484
|
+
return type !== void 0 ? service.listLocations({ type }) : service.listLocations();
|
|
485
|
+
},
|
|
486
|
+
getDefaultLocation: async ({ type }) => service.getDefaultLocation(type),
|
|
487
|
+
upsertLocation: async (input) => service.upsertLocation(input),
|
|
488
|
+
deleteLocation: async ({ id }) => {
|
|
489
|
+
service.deleteLocation(id);
|
|
490
|
+
},
|
|
491
|
+
testLocation: async ({ id }) => {
|
|
492
|
+
const loc = service.getLocationById(id);
|
|
493
|
+
if (!loc) return {
|
|
494
|
+
ok: false,
|
|
495
|
+
error: `Location "${id}" not found`
|
|
496
|
+
};
|
|
497
|
+
try {
|
|
498
|
+
return (await service.getProviderFor(loc)).testLocation({ config: loc.config });
|
|
499
|
+
} catch (err) {
|
|
500
|
+
return {
|
|
501
|
+
ok: false,
|
|
502
|
+
error: err instanceof Error ? err.message : String(err)
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
listProviders: async () => {
|
|
507
|
+
const providers = getProviders();
|
|
508
|
+
const out = [];
|
|
509
|
+
for (const p of providers) try {
|
|
510
|
+
const info = await p.getProviderInfo();
|
|
511
|
+
out.push({
|
|
512
|
+
providerId: info.providerId,
|
|
513
|
+
displayName: info.displayName,
|
|
514
|
+
supportedLocationTypes: info.supportedLocationTypes,
|
|
515
|
+
configSchema: info.configSchema
|
|
516
|
+
});
|
|
517
|
+
} catch (err) {
|
|
518
|
+
this.ctx.logger.warn("storage-orchestrator: getProviderInfo failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
519
|
+
}
|
|
520
|
+
return out;
|
|
521
|
+
},
|
|
522
|
+
testConfig: async ({ providerId, config }) => {
|
|
523
|
+
const providers = getProviders();
|
|
524
|
+
for (const p of providers) try {
|
|
525
|
+
if ((await p.getProviderInfo()).providerId !== providerId) continue;
|
|
526
|
+
return p.testLocation({ config });
|
|
527
|
+
} catch (err) {
|
|
528
|
+
return {
|
|
529
|
+
ok: false,
|
|
530
|
+
error: err instanceof Error ? err.message : String(err)
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
ok: false,
|
|
535
|
+
error: `No storage-provider registered for providerId "${providerId}"`
|
|
536
|
+
};
|
|
537
|
+
},
|
|
538
|
+
resolve: async ({ location, relativePath }) => {
|
|
539
|
+
const loc = service.resolveRef(location);
|
|
540
|
+
return (await service.getProviderFor(loc)).resolve({
|
|
541
|
+
location: loc,
|
|
542
|
+
relativePath
|
|
543
|
+
});
|
|
544
|
+
},
|
|
545
|
+
write: async ({ location, relativePath, data }) => {
|
|
546
|
+
const loc = service.resolveRef(location);
|
|
547
|
+
return (await service.getProviderFor(loc)).write({
|
|
548
|
+
location: loc,
|
|
549
|
+
relativePath,
|
|
550
|
+
data
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
read: async ({ location, relativePath }) => {
|
|
554
|
+
const loc = service.resolveRef(location);
|
|
555
|
+
return (await service.getProviderFor(loc)).read({
|
|
556
|
+
location: loc,
|
|
557
|
+
relativePath
|
|
558
|
+
});
|
|
559
|
+
},
|
|
560
|
+
exists: async ({ location, relativePath }) => {
|
|
561
|
+
const loc = service.resolveRef(location);
|
|
562
|
+
return (await service.getProviderFor(loc)).exists({
|
|
563
|
+
location: loc,
|
|
564
|
+
relativePath
|
|
565
|
+
});
|
|
566
|
+
},
|
|
567
|
+
list: async ({ location, prefix }) => {
|
|
568
|
+
const loc = service.resolveRef(location);
|
|
569
|
+
const p = await service.getProviderFor(loc);
|
|
570
|
+
return prefix !== void 0 ? p.list({
|
|
571
|
+
location: loc,
|
|
572
|
+
prefix
|
|
573
|
+
}) : p.list({ location: loc });
|
|
574
|
+
},
|
|
575
|
+
delete: async ({ location, relativePath }) => {
|
|
576
|
+
const loc = service.resolveRef(location);
|
|
577
|
+
return (await service.getProviderFor(loc)).delete({
|
|
578
|
+
location: loc,
|
|
579
|
+
relativePath
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
getAvailableSpace: async ({ location }) => {
|
|
583
|
+
const loc = service.resolveRef(location);
|
|
584
|
+
return (await service.getProviderFor(loc)).getAvailableSpace({ location: loc });
|
|
585
|
+
},
|
|
586
|
+
beginUpload: async ({ location, relativePath, sizeBytes }) => {
|
|
587
|
+
const loc = service.resolveRef(location);
|
|
588
|
+
const p = await service.getProviderFor(loc);
|
|
589
|
+
const result = sizeBytes !== void 0 ? await p.beginUpload({
|
|
590
|
+
location: loc,
|
|
591
|
+
relativePath,
|
|
592
|
+
sizeBytes
|
|
593
|
+
}) : await p.beginUpload({
|
|
594
|
+
location: loc,
|
|
595
|
+
relativePath
|
|
596
|
+
});
|
|
597
|
+
this.uploadOwners.set(result.uploadId, loc.providerId);
|
|
598
|
+
return result;
|
|
599
|
+
},
|
|
600
|
+
writeChunk: async (input) => {
|
|
601
|
+
return (await this.resolveByUploadId(input.uploadId)).writeChunk(input);
|
|
602
|
+
},
|
|
603
|
+
finalizeUpload: async (input) => {
|
|
604
|
+
const p = await this.resolveByUploadId(input.uploadId);
|
|
605
|
+
try {
|
|
606
|
+
return await p.finalizeUpload(input);
|
|
607
|
+
} finally {
|
|
608
|
+
this.uploadOwners.delete(input.uploadId);
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
abortUpload: async (input) => {
|
|
612
|
+
const p = await this.resolveByUploadId(input.uploadId);
|
|
613
|
+
try {
|
|
614
|
+
return await p.abortUpload(input);
|
|
615
|
+
} finally {
|
|
616
|
+
this.uploadOwners.delete(input.uploadId);
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
beginDownload: async ({ location, relativePath }) => {
|
|
620
|
+
const loc = service.resolveRef(location);
|
|
621
|
+
const result = await (await service.getProviderFor(loc)).beginDownload({
|
|
622
|
+
location: loc,
|
|
623
|
+
relativePath
|
|
624
|
+
});
|
|
625
|
+
this.downloadOwners.set(result.downloadId, loc.providerId);
|
|
626
|
+
return result;
|
|
627
|
+
},
|
|
628
|
+
readChunk: async (input) => {
|
|
629
|
+
return (await this.resolveByDownloadId(input.downloadId)).readChunk(input);
|
|
630
|
+
},
|
|
631
|
+
endDownload: async (input) => {
|
|
632
|
+
const p = await this.resolveByDownloadId(input.downloadId);
|
|
633
|
+
try {
|
|
634
|
+
return await p.endDownload(input);
|
|
635
|
+
} finally {
|
|
636
|
+
this.downloadOwners.delete(input.downloadId);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
await this.seedFromAllProviders();
|
|
641
|
+
const eventBus = this.ctx.eventBus;
|
|
642
|
+
if (eventBus) {
|
|
643
|
+
const unsub = eventBus.subscribe({ category: CAP_PROVIDER_REGISTERED_CATEGORY }, (event) => {
|
|
644
|
+
if (event.data?.capability !== STORAGE_PROVIDER_CAP_NAME) return;
|
|
645
|
+
this.seedFromAllProviders();
|
|
646
|
+
});
|
|
647
|
+
this.seedSubscriptionDisposers.push(unsub);
|
|
648
|
+
}
|
|
649
|
+
this.ctx.logger.info("Storage orchestrator initialized");
|
|
650
|
+
return [{
|
|
651
|
+
capability: _camstack_types.storageCapability,
|
|
652
|
+
provider
|
|
653
|
+
}];
|
|
654
|
+
}
|
|
655
|
+
async onShutdown() {
|
|
656
|
+
for (const dispose of this.seedSubscriptionDisposers) try {
|
|
657
|
+
dispose();
|
|
658
|
+
} catch {}
|
|
659
|
+
this.seedSubscriptionDisposers.length = 0;
|
|
660
|
+
this.uploadOwners.clear();
|
|
661
|
+
this.downloadOwners.clear();
|
|
662
|
+
this.service = null;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Resolve the live `ISettingsBackend` from the capability registry
|
|
666
|
+
* and wrap it in a `SqliteLocationStore`. Returns `null` when the
|
|
667
|
+
* settings-store cap isn't registered yet — the service falls back
|
|
668
|
+
* to in-memory only. Production boot order (sqlite-settings runs
|
|
669
|
+
* before the orchestrator) makes this the rare path.
|
|
670
|
+
*/
|
|
671
|
+
resolveLocationStore() {
|
|
672
|
+
const reg = this.ctx.kernel.capabilityRegistry;
|
|
673
|
+
if (!reg) return null;
|
|
674
|
+
const backend = reg.getSingleton("settings-store");
|
|
675
|
+
if (!backend) {
|
|
676
|
+
this.ctx.logger.warn("storage-orchestrator: no settings-store provider — running in-memory only");
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
if (!backend.ensureTable || !backend.tableInsert) {
|
|
680
|
+
this.ctx.logger.warn("storage-orchestrator: settings backend lacks structured-table support — running in-memory only");
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
return new SqliteLocationStore(backend);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Walk every registered `storage-provider` collection provider and
|
|
687
|
+
* call `service.seedDefaults` for each. Idempotent — re-running on
|
|
688
|
+
* a populated map is a no-op (each location's `id` is already in the
|
|
689
|
+
* service's map).
|
|
690
|
+
*
|
|
691
|
+
* `basePath` is derived per-call:
|
|
692
|
+
* - Filesystem providers (and any provider whose `getProviderInfo`
|
|
693
|
+
* doesn't include a `basePath` field) fall back to
|
|
694
|
+
* `process.env.CAMSTACK_DATA ?? path.resolve(process.cwd(), 'camstack-data')`.
|
|
695
|
+
* - Future remote providers (SFTP/S3/WebDAV) will report their own
|
|
696
|
+
* base path through the wizard config — they're not relevant for
|
|
697
|
+
* first-boot seeding (operators add them through the admin UI).
|
|
698
|
+
*/
|
|
699
|
+
async seedFromAllProviders() {
|
|
700
|
+
if (!this.service) return;
|
|
701
|
+
const reg = this.ctx.kernel.capabilityRegistry;
|
|
702
|
+
if (!reg) return;
|
|
703
|
+
const providers = reg.getCollection(STORAGE_PROVIDER_CAP_NAME);
|
|
704
|
+
if (providers.length === 0) return;
|
|
705
|
+
const basePath = process.env["CAMSTACK_DATA"] ?? node_path.resolve(process.cwd(), "camstack-data");
|
|
706
|
+
for (const p of providers) try {
|
|
707
|
+
const info = await p.getProviderInfo();
|
|
708
|
+
this.service.seedDefaults({
|
|
709
|
+
providerId: info.providerId,
|
|
710
|
+
supportedTypes: info.supportedLocationTypes,
|
|
711
|
+
basePath
|
|
712
|
+
});
|
|
713
|
+
} catch (err) {
|
|
714
|
+
this.ctx.logger.warn("storage-orchestrator: seed failed for provider", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
async resolveByUploadId(uploadId) {
|
|
718
|
+
const providerId = this.uploadOwners.get(uploadId);
|
|
719
|
+
if (!providerId) throw new Error(`Unknown uploadId "${uploadId}" — orchestrator has no record of beginUpload`);
|
|
720
|
+
return this.providerByProviderId(providerId, `uploadId "${uploadId}"`);
|
|
721
|
+
}
|
|
722
|
+
async resolveByDownloadId(downloadId) {
|
|
723
|
+
const providerId = this.downloadOwners.get(downloadId);
|
|
724
|
+
if (!providerId) throw new Error(`Unknown downloadId "${downloadId}" — orchestrator has no record of beginDownload`);
|
|
725
|
+
return this.providerByProviderId(providerId, `downloadId "${downloadId}"`);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Look up a `storage-provider` by `providerId` only — used for
|
|
729
|
+
* upload / download dispatch where the original `StorageLocation` is
|
|
730
|
+
* no longer in scope. Throws if the provider has gone away (e.g.
|
|
731
|
+
* addon unloaded mid-session).
|
|
732
|
+
*/
|
|
733
|
+
async providerByProviderId(providerId, sessionDescriptor) {
|
|
734
|
+
if (!this.service) throw new Error("storage-orchestrator: service not initialized");
|
|
735
|
+
const probe = {
|
|
736
|
+
id: `__session:${sessionDescriptor}`,
|
|
737
|
+
type: "data",
|
|
738
|
+
displayName: sessionDescriptor,
|
|
739
|
+
providerId,
|
|
740
|
+
config: {},
|
|
741
|
+
isDefault: false,
|
|
742
|
+
isSystem: false,
|
|
743
|
+
createdAt: 0,
|
|
744
|
+
updatedAt: 0
|
|
745
|
+
};
|
|
746
|
+
return this.service.getProviderFor(probe);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
//#endregion
|
|
750
|
+
exports.SqliteLocationStore = SqliteLocationStore;
|
|
751
|
+
exports.StorageOrchestratorAddon = StorageOrchestratorAddon;
|
|
752
|
+
exports.default = StorageOrchestratorAddon;
|
|
753
|
+
exports.StorageOrchestratorService = StorageOrchestratorService;
|
|
754
|
+
|
|
755
|
+
//# sourceMappingURL=storage-orchestrator.addon.js.map
|