@camstack/core 0.1.15 → 0.1.16
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 +102 -0
- package/dist/builtins/local-network/local-network.addon.d.ts.map +1 -0
- package/dist/builtins/local-network/local-network.addon.js +404 -0
- package/dist/builtins/local-network/local-network.addon.js.map +1 -0
- package/dist/builtins/local-network/local-network.addon.mjs +392 -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
package/dist/chunk-FZN56HGQ.mjs
DELETED
|
@@ -1,626 +0,0 @@
|
|
|
1
|
-
// src/builtins/sqlite-storage/sqlite-settings.addon.ts
|
|
2
|
-
import { BaseAddon, RUNTIME_DEFAULTS, errMsg, settingsStoreCapability } from "@camstack/types";
|
|
3
|
-
|
|
4
|
-
// src/builtins/sqlite-storage/sqlite-settings-backend.ts
|
|
5
|
-
import Database from "better-sqlite3";
|
|
6
|
-
import { randomUUID } from "crypto";
|
|
7
|
-
import { asJsonObject, parseJsonUnknown } from "@camstack/types";
|
|
8
|
-
function parseRowData(raw) {
|
|
9
|
-
return asJsonObject(parseJsonUnknown(raw)) ?? {};
|
|
10
|
-
}
|
|
11
|
-
var SqliteSettingsBackend = class _SqliteSettingsBackend {
|
|
12
|
-
// Domain schemas (auth, analytics events, …) live in the addons that
|
|
13
|
-
// own them — same pattern as `pipeline-analytics` (`event-store.ts`,
|
|
14
|
-
// `track-store.ts`, `media-store.ts`) and `local-auth` (`auth-schema.ts`).
|
|
15
|
-
// The backend exposes `declareCollection` and stays out of domain
|
|
16
|
-
// knowledge.
|
|
17
|
-
constructor(dbPath, runtimeDefaults) {
|
|
18
|
-
this.dbPath = dbPath;
|
|
19
|
-
this.runtimeDefaults = runtimeDefaults ?? {};
|
|
20
|
-
}
|
|
21
|
-
dbPath;
|
|
22
|
-
db = null;
|
|
23
|
-
structuredTables = /* @__PURE__ */ new Set();
|
|
24
|
-
/** Map from scoped collection name → set of column names (non-id) that
|
|
25
|
-
* the structured schema owns. Routes set/get/insert/update/query to
|
|
26
|
-
* typed columns. Every collection MUST be declared here before use. */
|
|
27
|
-
declaredCollections = /* @__PURE__ */ new Map();
|
|
28
|
-
runtimeDefaults;
|
|
29
|
-
/**
|
|
30
|
-
* Canonical key/value collections — declared with a `(id TEXT PK,
|
|
31
|
-
* data TEXT NOT NULL)` schema at boot so existing JSON-blob rows
|
|
32
|
-
* keep working through the structured path. Generates SQL identical
|
|
33
|
-
* to the previous legacy path; only the routing is unified.
|
|
34
|
-
*/
|
|
35
|
-
static CANONICAL_KV_COLLECTIONS = [
|
|
36
|
-
"system-settings",
|
|
37
|
-
"addon-settings",
|
|
38
|
-
"addon-device-settings",
|
|
39
|
-
"addon-devices",
|
|
40
|
-
"device-runtime-state",
|
|
41
|
-
"sections",
|
|
42
|
-
"provider-settings",
|
|
43
|
-
"device-settings",
|
|
44
|
-
"alerts"
|
|
45
|
-
];
|
|
46
|
-
async initialize() {
|
|
47
|
-
const dir = this.dbPath.substring(0, this.dbPath.lastIndexOf("/"));
|
|
48
|
-
if (dir) {
|
|
49
|
-
const fs = await import("fs");
|
|
50
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
51
|
-
}
|
|
52
|
-
this.db = new Database(this.dbPath);
|
|
53
|
-
this.db.pragma("journal_mode = WAL");
|
|
54
|
-
this.db.pragma("foreign_keys = ON");
|
|
55
|
-
for (const collection of _SqliteSettingsBackend.CANONICAL_KV_COLLECTIONS) {
|
|
56
|
-
await this.ensureTable(collection, {
|
|
57
|
-
columns: [
|
|
58
|
-
{ name: "id", type: "TEXT", primaryKey: true, notNull: true },
|
|
59
|
-
{ name: "data", type: "TEXT", notNull: true }
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
this.declaredCollections.set(collection, {
|
|
63
|
-
primaryKey: "id",
|
|
64
|
-
columns: /* @__PURE__ */ new Set(["data"])
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const isEmpty = await this.isEmpty({ collection: "system-settings" });
|
|
68
|
-
if (isEmpty) {
|
|
69
|
-
await this.seedDefaults();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
requireDeclared(scoped) {
|
|
73
|
-
const decl = this.declaredCollections.get(scoped);
|
|
74
|
-
if (!decl) {
|
|
75
|
-
throw new Error(`SqliteSettingsBackend: collection "${scoped}" is not declared. Call declareCollection() first or add it to CANONICAL_KV_COLLECTIONS.`);
|
|
76
|
-
}
|
|
77
|
-
return decl;
|
|
78
|
-
}
|
|
79
|
-
async shutdown() {
|
|
80
|
-
this.db?.close();
|
|
81
|
-
this.db = null;
|
|
82
|
-
}
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
// ISettingsBackend implementation
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
async get({ namespace, collection, key }) {
|
|
87
|
-
const scoped = this.scopedName(namespace, collection);
|
|
88
|
-
const decl = this.requireDeclared(scoped);
|
|
89
|
-
const cols = [`"${decl.primaryKey}"`, ...[...decl.columns].map((c) => `"${c}"`)].join(", ");
|
|
90
|
-
const row = this.getDb().prepare(`SELECT ${cols} FROM "${scoped}" WHERE "${decl.primaryKey}" = ?`).get(key);
|
|
91
|
-
if (!row) return void 0;
|
|
92
|
-
if (decl.columns.size === 1 && decl.columns.has("data")) {
|
|
93
|
-
const raw = row["data"];
|
|
94
|
-
return typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
95
|
-
}
|
|
96
|
-
const data = {};
|
|
97
|
-
for (const c of decl.columns) {
|
|
98
|
-
const v = row[c];
|
|
99
|
-
if (typeof v === "string" && (v.startsWith("{") || v.startsWith("["))) {
|
|
100
|
-
try {
|
|
101
|
-
data[c] = JSON.parse(v);
|
|
102
|
-
} catch {
|
|
103
|
-
data[c] = v;
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
data[c] = v ?? null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
|
-
async set({ namespace, collection, key, value }) {
|
|
112
|
-
const scoped = this.scopedName(namespace, collection);
|
|
113
|
-
const decl = this.requireDeclared(scoped);
|
|
114
|
-
const row = { [decl.primaryKey]: key };
|
|
115
|
-
if (decl.columns.size === 1 && decl.columns.has("data")) {
|
|
116
|
-
row["data"] = JSON.stringify(value);
|
|
117
|
-
} else {
|
|
118
|
-
const valueObj = value !== null && typeof value === "object" ? value : {};
|
|
119
|
-
for (const [k, v] of Object.entries(valueObj)) {
|
|
120
|
-
if (decl.columns.has(k)) row[k] = this.serializeColumnValue(v);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const keys = Object.keys(row);
|
|
124
|
-
const cols = keys.map((k) => `"${k}"`).join(", ");
|
|
125
|
-
const placeholders = keys.map(() => "?").join(", ");
|
|
126
|
-
const updates = keys.filter((k) => k !== decl.primaryKey).map((k) => `"${k}" = excluded."${k}"`).join(", ");
|
|
127
|
-
const values = keys.map((k) => row[k]);
|
|
128
|
-
const sql = updates.length > 0 ? `INSERT INTO "${scoped}" (${cols}) VALUES (${placeholders}) ON CONFLICT("${decl.primaryKey}") DO UPDATE SET ${updates}` : `INSERT INTO "${scoped}" (${cols}) VALUES (${placeholders}) ON CONFLICT("${decl.primaryKey}") DO NOTHING`;
|
|
129
|
-
this.getDb().prepare(sql).run(...values);
|
|
130
|
-
}
|
|
131
|
-
async query({ namespace, collection, filter }) {
|
|
132
|
-
const scoped = this.scopedName(namespace, collection);
|
|
133
|
-
const decl = this.requireDeclared(scoped);
|
|
134
|
-
return this.queryDeclared(scoped, decl, filter);
|
|
135
|
-
}
|
|
136
|
-
async insert({ namespace, collection, record }) {
|
|
137
|
-
const scoped = this.scopedName(namespace, collection);
|
|
138
|
-
const decl = this.requireDeclared(scoped);
|
|
139
|
-
const id = record.id || randomUUID();
|
|
140
|
-
const row = { [decl.primaryKey]: id };
|
|
141
|
-
if (decl.columns.size === 1 && decl.columns.has("data")) {
|
|
142
|
-
row["data"] = JSON.stringify(record.data);
|
|
143
|
-
} else {
|
|
144
|
-
for (const [k, v] of Object.entries(record.data)) {
|
|
145
|
-
if (decl.columns.has(k)) row[k] = this.serializeColumnValue(v);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
await this.tableInsert(scoped, row);
|
|
149
|
-
}
|
|
150
|
-
async update({ namespace, collection, id, data }) {
|
|
151
|
-
const scoped = this.scopedName(namespace, collection);
|
|
152
|
-
const decl = this.requireDeclared(scoped);
|
|
153
|
-
const updates = {};
|
|
154
|
-
if (decl.columns.size === 1 && decl.columns.has("data")) {
|
|
155
|
-
updates["data"] = JSON.stringify(data);
|
|
156
|
-
} else {
|
|
157
|
-
for (const [k, v] of Object.entries(data)) {
|
|
158
|
-
if (decl.columns.has(k)) updates[k] = this.serializeColumnValue(v);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (Object.keys(updates).length > 0) {
|
|
162
|
-
await this.tableUpdate(scoped, { [decl.primaryKey]: id }, updates);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
async delete({ namespace, collection, key }) {
|
|
166
|
-
const scoped = this.scopedName(namespace, collection);
|
|
167
|
-
const decl = this.requireDeclared(scoped);
|
|
168
|
-
await this.tableDelete(scoped, { [decl.primaryKey]: key });
|
|
169
|
-
}
|
|
170
|
-
async count({ namespace, collection, filter }) {
|
|
171
|
-
const scoped = this.scopedName(namespace, collection);
|
|
172
|
-
const decl = this.requireDeclared(scoped);
|
|
173
|
-
const isKvShape = decl.columns.size === 1 && decl.columns.has("data");
|
|
174
|
-
const isColumn = (f) => f === decl.primaryKey || decl.columns.has(f);
|
|
175
|
-
const fieldExpr = (f) => {
|
|
176
|
-
if (isColumn(f)) return `"${f}"`;
|
|
177
|
-
if (isKvShape) return `json_extract("data", '$.${f}')`;
|
|
178
|
-
return "";
|
|
179
|
-
};
|
|
180
|
-
let sql = `SELECT COUNT(*) AS cnt FROM "${scoped}"`;
|
|
181
|
-
const params = [];
|
|
182
|
-
if (filter?.where) {
|
|
183
|
-
const clauses = [];
|
|
184
|
-
for (const [field, value] of Object.entries(filter.where)) {
|
|
185
|
-
const expr = fieldExpr(field);
|
|
186
|
-
if (!expr) continue;
|
|
187
|
-
clauses.push(`${expr} = ?`);
|
|
188
|
-
params.push(this.serializeColumnValue(value));
|
|
189
|
-
}
|
|
190
|
-
if (clauses.length > 0) sql += ` WHERE ${clauses.join(" AND ")}`;
|
|
191
|
-
}
|
|
192
|
-
const row = this.getDb().prepare(sql).get(...params);
|
|
193
|
-
return row?.cnt ?? 0;
|
|
194
|
-
}
|
|
195
|
-
async isEmpty({ namespace, collection }) {
|
|
196
|
-
const scoped = this.scopedName(namespace, collection);
|
|
197
|
-
this.requireDeclared(scoped);
|
|
198
|
-
return await this.tableCount(scoped) === 0;
|
|
199
|
-
}
|
|
200
|
-
async queryDeclared(table, decl, filter) {
|
|
201
|
-
const isKvShape = decl.columns.size === 1 && decl.columns.has("data");
|
|
202
|
-
const cols = [`"${decl.primaryKey}"`, ...[...decl.columns].map((c) => `"${c}"`)].join(", ");
|
|
203
|
-
let sql = `SELECT ${cols} FROM "${table}"`;
|
|
204
|
-
const params = [];
|
|
205
|
-
const whereClauses = [];
|
|
206
|
-
const isColumn = (f) => f === decl.primaryKey || decl.columns.has(f);
|
|
207
|
-
const fieldExpr = (f) => {
|
|
208
|
-
if (isColumn(f)) return `"${f}"`;
|
|
209
|
-
if (isKvShape) return `json_extract("data", '$.${f}')`;
|
|
210
|
-
return "";
|
|
211
|
-
};
|
|
212
|
-
if (filter?.where) {
|
|
213
|
-
for (const [field, value] of Object.entries(filter.where)) {
|
|
214
|
-
const expr = fieldExpr(field);
|
|
215
|
-
if (!expr) continue;
|
|
216
|
-
whereClauses.push(`${expr} = ?`);
|
|
217
|
-
params.push(this.serializeColumnValue(value));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
if (filter?.whereIn) {
|
|
221
|
-
for (const [field, values] of Object.entries(filter.whereIn)) {
|
|
222
|
-
const expr = fieldExpr(field);
|
|
223
|
-
if (!expr) continue;
|
|
224
|
-
const placeholders = values.map(() => "?").join(", ");
|
|
225
|
-
whereClauses.push(`${expr} IN (${placeholders})`);
|
|
226
|
-
for (const v of values) params.push(this.serializeColumnValue(v));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (filter?.whereBetween) {
|
|
230
|
-
for (const [field, [low, high]] of Object.entries(filter.whereBetween)) {
|
|
231
|
-
const expr = fieldExpr(field);
|
|
232
|
-
if (!expr) continue;
|
|
233
|
-
whereClauses.push(`${expr} BETWEEN ? AND ?`);
|
|
234
|
-
params.push(this.serializeColumnValue(low), this.serializeColumnValue(high));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if (whereClauses.length > 0) sql += ` WHERE ${whereClauses.join(" AND ")}`;
|
|
238
|
-
if (filter?.orderBy) {
|
|
239
|
-
const expr = fieldExpr(filter.orderBy.field);
|
|
240
|
-
if (expr) {
|
|
241
|
-
const dir = filter.orderBy.direction === "desc" ? "DESC" : "ASC";
|
|
242
|
-
sql += ` ORDER BY ${expr} ${dir}`;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (filter?.limit !== void 0) {
|
|
246
|
-
sql += ` LIMIT ?`;
|
|
247
|
-
params.push(filter.limit);
|
|
248
|
-
}
|
|
249
|
-
if (filter?.offset !== void 0) {
|
|
250
|
-
sql += ` OFFSET ?`;
|
|
251
|
-
params.push(filter.offset);
|
|
252
|
-
}
|
|
253
|
-
const rows = this.getDb().prepare(sql).all(...params);
|
|
254
|
-
return rows.map((r) => {
|
|
255
|
-
const id = String(r[decl.primaryKey] ?? "");
|
|
256
|
-
if (isKvShape) {
|
|
257
|
-
const v = r["data"];
|
|
258
|
-
if (typeof v === "string" && (v.startsWith("{") || v.startsWith("["))) {
|
|
259
|
-
try {
|
|
260
|
-
return { id, data: JSON.parse(v) };
|
|
261
|
-
} catch {
|
|
262
|
-
return { id, data: { value: v } };
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return { id, data: v == null ? {} : { value: v } };
|
|
266
|
-
}
|
|
267
|
-
const data = { [decl.primaryKey]: r[decl.primaryKey] ?? null };
|
|
268
|
-
for (const c of decl.columns) {
|
|
269
|
-
const v = r[c];
|
|
270
|
-
if (typeof v === "string" && (v.startsWith("{") || v.startsWith("["))) {
|
|
271
|
-
try {
|
|
272
|
-
data[c] = JSON.parse(v);
|
|
273
|
-
} catch {
|
|
274
|
-
data[c] = v;
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
data[c] = v ?? null;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return { id, data };
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
// ---------------------------------------------------------------------------
|
|
284
|
-
// Legacy SettingsStore compatibility (used by ConfigManager.setSettingsStore)
|
|
285
|
-
// ---------------------------------------------------------------------------
|
|
286
|
-
/** Get a system setting by dot-notation key */
|
|
287
|
-
getSystem(key) {
|
|
288
|
-
this.requireDeclared("system-settings");
|
|
289
|
-
const row = this.getDb().prepare('SELECT data FROM "system-settings" WHERE id = ?').get(key);
|
|
290
|
-
if (!row) return void 0;
|
|
291
|
-
return JSON.parse(row.data);
|
|
292
|
-
}
|
|
293
|
-
/** Set a system setting */
|
|
294
|
-
setSystem(key, value) {
|
|
295
|
-
this.requireDeclared("system-settings");
|
|
296
|
-
this.getDb().prepare('INSERT INTO "system-settings" (id, data) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data').run(key, JSON.stringify(value));
|
|
297
|
-
}
|
|
298
|
-
/** Get all system settings as flat key-value */
|
|
299
|
-
getAllSystem() {
|
|
300
|
-
this.requireDeclared("system-settings");
|
|
301
|
-
const rows = this.getDb().prepare('SELECT id, data FROM "system-settings"').all();
|
|
302
|
-
return Object.fromEntries(rows.map((r) => [r.id, JSON.parse(r.data)]));
|
|
303
|
-
}
|
|
304
|
-
/** Get all settings for an addon */
|
|
305
|
-
getAllAddon(addonId) {
|
|
306
|
-
this.requireDeclared("addon-settings");
|
|
307
|
-
const rows = this.getDb().prepare(`SELECT id, data FROM "addon-settings" WHERE json_extract(data, '$.addonId') = ?`).all(addonId);
|
|
308
|
-
if (rows.length === 0) return {};
|
|
309
|
-
const result = {};
|
|
310
|
-
for (const row of rows) {
|
|
311
|
-
const parsed = parseRowData(row.data);
|
|
312
|
-
const key = row.id.startsWith(`${addonId}.`) ? row.id.slice(addonId.length + 1) : row.id;
|
|
313
|
-
const isWrapper = parsed !== null && typeof parsed === "object" && "addonId" in parsed && "key" in parsed;
|
|
314
|
-
if (isWrapper) {
|
|
315
|
-
const wrapper = parsed;
|
|
316
|
-
if ("value" in wrapper) {
|
|
317
|
-
result[key] = wrapper.value;
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
result[key] = parsed;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return result;
|
|
324
|
-
}
|
|
325
|
-
/** Bulk-set all settings for an addon */
|
|
326
|
-
setAllAddon(addonId, config) {
|
|
327
|
-
this.requireDeclared("addon-settings");
|
|
328
|
-
const db = this.getDb();
|
|
329
|
-
const deleteStmt = db.prepare(`DELETE FROM "addon-settings" WHERE id LIKE ? || '%'`);
|
|
330
|
-
const insertStmt = db.prepare('INSERT INTO "addon-settings" (id, data) VALUES (?, ?)');
|
|
331
|
-
db.transaction(() => {
|
|
332
|
-
deleteStmt.run(`${addonId}.`);
|
|
333
|
-
for (const [key, value] of Object.entries(config)) {
|
|
334
|
-
if (value === void 0) continue;
|
|
335
|
-
insertStmt.run(`${addonId}.${key}`, JSON.stringify({ addonId, key, value }));
|
|
336
|
-
}
|
|
337
|
-
})();
|
|
338
|
-
}
|
|
339
|
-
/** Get all settings for a provider */
|
|
340
|
-
getAllProvider(providerId) {
|
|
341
|
-
return this.getAllScoped("provider-settings", providerId);
|
|
342
|
-
}
|
|
343
|
-
/** Set a provider setting */
|
|
344
|
-
setProvider(providerId, key, value) {
|
|
345
|
-
this.setScopedKey("provider-settings", providerId, key, value);
|
|
346
|
-
}
|
|
347
|
-
/** Get all settings for a device */
|
|
348
|
-
getAllDevice(deviceId) {
|
|
349
|
-
return this.getAllScoped("device-settings", deviceId);
|
|
350
|
-
}
|
|
351
|
-
/** Set a device setting */
|
|
352
|
-
setDevice(deviceId, key, value) {
|
|
353
|
-
this.setScopedKey("device-settings", deviceId, key, value);
|
|
354
|
-
}
|
|
355
|
-
// ── Addon-device settings (per-device overrides of an addon's config) ──
|
|
356
|
-
//
|
|
357
|
-
// Storage key format: "<addonId>:<deviceId>.<field>" inside the
|
|
358
|
-
// "addon-device-settings" collection. Uses the same JSON-blob layout
|
|
359
|
-
// as the other scoped collections so no schema change is required.
|
|
360
|
-
getAddonDevice(addonId, deviceId) {
|
|
361
|
-
return this.getAllScoped("addon-device-settings", `${addonId}:${deviceId}`);
|
|
362
|
-
}
|
|
363
|
-
setAddonDevice(addonId, deviceId, values) {
|
|
364
|
-
this.requireDeclared("addon-device-settings");
|
|
365
|
-
const db = this.getDb();
|
|
366
|
-
const prefix = `${addonId}:${deviceId}.`;
|
|
367
|
-
const deleteStmt = db.prepare(`DELETE FROM "addon-device-settings" WHERE id LIKE ? || '%'`);
|
|
368
|
-
const insertStmt = db.prepare(
|
|
369
|
-
`INSERT INTO "addon-device-settings" (id, data) VALUES (?, ?)
|
|
370
|
-
ON CONFLICT(id) DO UPDATE SET data = excluded.data`
|
|
371
|
-
);
|
|
372
|
-
db.transaction(() => {
|
|
373
|
-
deleteStmt.run(prefix);
|
|
374
|
-
for (const [key, value] of Object.entries(values)) {
|
|
375
|
-
insertStmt.run(
|
|
376
|
-
`${prefix}${key}`,
|
|
377
|
-
JSON.stringify({ addonId, deviceId, key, value })
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
})();
|
|
381
|
-
}
|
|
382
|
-
clearAddonDevice(addonId, deviceId) {
|
|
383
|
-
this.requireDeclared("addon-device-settings");
|
|
384
|
-
const prefix = `${addonId}:${deviceId}.`;
|
|
385
|
-
this.getDb().prepare(`DELETE FROM "addon-device-settings" WHERE id LIKE ? || '%'`).run(prefix);
|
|
386
|
-
}
|
|
387
|
-
/** Seed system-settings with runtime defaults (first boot) */
|
|
388
|
-
async seedDefaults() {
|
|
389
|
-
this.requireDeclared("system-settings");
|
|
390
|
-
const insert = this.getDb().prepare(
|
|
391
|
-
'INSERT OR IGNORE INTO "system-settings" (id, data) VALUES (?, ?)'
|
|
392
|
-
);
|
|
393
|
-
this.getDb().transaction(() => {
|
|
394
|
-
for (const [key, value] of Object.entries(this.runtimeDefaults)) {
|
|
395
|
-
insert.run(key, JSON.stringify(value));
|
|
396
|
-
}
|
|
397
|
-
})();
|
|
398
|
-
}
|
|
399
|
-
// ---------------------------------------------------------------------------
|
|
400
|
-
// Private helpers
|
|
401
|
-
// ---------------------------------------------------------------------------
|
|
402
|
-
/**
|
|
403
|
-
* Expose the raw better-sqlite3 Database instance for components that
|
|
404
|
-
* need direct SQL access (e.g. DeviceStore, ConfigStore).
|
|
405
|
-
* Returns null if the backend has not been initialized yet.
|
|
406
|
-
*/
|
|
407
|
-
getDatabase() {
|
|
408
|
-
return this.db;
|
|
409
|
-
}
|
|
410
|
-
getDb() {
|
|
411
|
-
if (!this.db) throw new Error("SqliteSettingsBackend not initialized \u2014 call initialize() first");
|
|
412
|
-
return this.db;
|
|
413
|
-
}
|
|
414
|
-
getAllScoped(collection, scopeId) {
|
|
415
|
-
this.requireDeclared(collection);
|
|
416
|
-
const rows = this.getDb().prepare(`SELECT id, data FROM "${collection}" WHERE id LIKE ? || '.%'`).all(scopeId);
|
|
417
|
-
const result = {};
|
|
418
|
-
for (const row of rows) {
|
|
419
|
-
const key = row.id.slice(scopeId.length + 1);
|
|
420
|
-
const parsed = parseRowData(row.data);
|
|
421
|
-
result[key] = parsed.value ?? parsed;
|
|
422
|
-
}
|
|
423
|
-
return result;
|
|
424
|
-
}
|
|
425
|
-
setScopedKey(collection, scopeId, key, value) {
|
|
426
|
-
this.requireDeclared(collection);
|
|
427
|
-
this.getDb().prepare(`INSERT INTO "${collection}" (id, data) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data`).run(`${scopeId}.${key}`, JSON.stringify({ scopeId, key, value }));
|
|
428
|
-
}
|
|
429
|
-
// ── Declared collections (typed SQL tables behind the generic cap) ──
|
|
430
|
-
scopedName(namespace, collection) {
|
|
431
|
-
return namespace ? `${namespace}:${collection}` : collection;
|
|
432
|
-
}
|
|
433
|
-
async declareCollection(input) {
|
|
434
|
-
const table = this.scopedName(input.namespace, input.collection);
|
|
435
|
-
if (this.declaredCollections.has(table)) return;
|
|
436
|
-
const hasId = input.columns.some((c) => c.primaryKey === true);
|
|
437
|
-
const columns = hasId ? input.columns : [{ name: "id", type: "TEXT", primaryKey: true, notNull: true }, ...input.columns];
|
|
438
|
-
const schema = {
|
|
439
|
-
columns: columns.map((c) => ({
|
|
440
|
-
name: c.name,
|
|
441
|
-
// SQLite treats JSON as TEXT; we serialize object values on write
|
|
442
|
-
// and parse on read.
|
|
443
|
-
type: c.type === "JSON" ? "TEXT" : c.type,
|
|
444
|
-
...c.primaryKey !== void 0 ? { primaryKey: c.primaryKey } : {},
|
|
445
|
-
...c.notNull !== void 0 ? { notNull: c.notNull } : {},
|
|
446
|
-
...c.unique !== void 0 ? { unique: c.unique } : {}
|
|
447
|
-
})),
|
|
448
|
-
...input.indexes ? { indexes: input.indexes.map((i) => ({
|
|
449
|
-
name: i.name,
|
|
450
|
-
columns: i.columns,
|
|
451
|
-
...i.unique !== void 0 ? { unique: i.unique } : {}
|
|
452
|
-
})) } : {}
|
|
453
|
-
};
|
|
454
|
-
await this.ensureTable(table, schema);
|
|
455
|
-
const pkCol = columns.find((c) => c.primaryKey === true);
|
|
456
|
-
const primaryKey = pkCol ? pkCol.name : "id";
|
|
457
|
-
const columnNames = new Set(columns.filter((c) => c.name !== primaryKey).map((c) => c.name));
|
|
458
|
-
this.declaredCollections.set(table, { primaryKey, columns: columnNames });
|
|
459
|
-
}
|
|
460
|
-
/** Serialise per-column values for SQL binding: objects → JSON, booleans → 0/1. */
|
|
461
|
-
serializeColumnValue(v) {
|
|
462
|
-
if (v === null || v === void 0) return v ?? null;
|
|
463
|
-
if (typeof v === "boolean") return v ? 1 : 0;
|
|
464
|
-
if (typeof v === "object") return JSON.stringify(v);
|
|
465
|
-
return v;
|
|
466
|
-
}
|
|
467
|
-
// ── Structured table operations ────────────────────────────────────
|
|
468
|
-
async ensureTable(table, schema) {
|
|
469
|
-
if (this.structuredTables.has(table)) return;
|
|
470
|
-
const colDefs = schema.columns.map((col) => {
|
|
471
|
-
const parts = [`"${col.name}" ${col.type}`];
|
|
472
|
-
if (col.primaryKey) parts.push("PRIMARY KEY");
|
|
473
|
-
if (col.notNull) parts.push("NOT NULL");
|
|
474
|
-
if (col.unique) parts.push("UNIQUE");
|
|
475
|
-
if (col.defaultValue !== void 0) {
|
|
476
|
-
parts.push(`DEFAULT ${typeof col.defaultValue === "string" ? `'${col.defaultValue}'` : col.defaultValue === null ? "NULL" : String(col.defaultValue)}`);
|
|
477
|
-
}
|
|
478
|
-
return parts.join(" ");
|
|
479
|
-
});
|
|
480
|
-
const existingCols = this.getDb().prepare(`PRAGMA table_info("${table}")`).all();
|
|
481
|
-
if (existingCols.length > 0) {
|
|
482
|
-
const existingNames = new Set(existingCols.map((c) => c.name));
|
|
483
|
-
const declaredNames = new Set(schema.columns.map((c) => c.name));
|
|
484
|
-
const missingDeclared = schema.columns.some((c) => !existingNames.has(c.name));
|
|
485
|
-
const isLegacyKv = existingCols.length <= 2 && existingNames.has("data") && !declaredNames.has("data");
|
|
486
|
-
if (isLegacyKv || missingDeclared) {
|
|
487
|
-
try {
|
|
488
|
-
this.getDb().exec(`DROP TABLE "${table}"`);
|
|
489
|
-
} catch {
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
this.getDb().exec(`CREATE TABLE IF NOT EXISTS "${table}" (${colDefs.join(", ")})`);
|
|
494
|
-
if (schema.indexes) {
|
|
495
|
-
for (const idx of schema.indexes) {
|
|
496
|
-
const unique = idx.unique ? "UNIQUE " : "";
|
|
497
|
-
const cols = idx.columns.map((c) => `"${c}"`).join(", ");
|
|
498
|
-
this.getDb().exec(`CREATE ${unique}INDEX IF NOT EXISTS "${idx.name}" ON "${table}" (${cols})`);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
this.structuredTables.add(table);
|
|
502
|
-
}
|
|
503
|
-
async tableInsert(table, row) {
|
|
504
|
-
const keys = Object.keys(row);
|
|
505
|
-
const cols = keys.map((k) => `"${k}"`).join(", ");
|
|
506
|
-
const placeholders = keys.map(() => "?").join(", ");
|
|
507
|
-
const values = keys.map((k) => {
|
|
508
|
-
const v = row[k];
|
|
509
|
-
return typeof v === "object" && v !== null ? JSON.stringify(v) : v;
|
|
510
|
-
});
|
|
511
|
-
this.getDb().prepare(`INSERT INTO "${table}" (${cols}) VALUES (${placeholders})`).run(...values);
|
|
512
|
-
}
|
|
513
|
-
async tableUpdate(table, filter, updates) {
|
|
514
|
-
const setClauses = [];
|
|
515
|
-
const setValues = [];
|
|
516
|
-
for (const [k, v] of Object.entries(updates)) {
|
|
517
|
-
setClauses.push(`"${k}" = ?`);
|
|
518
|
-
setValues.push(typeof v === "object" && v !== null ? JSON.stringify(v) : v);
|
|
519
|
-
}
|
|
520
|
-
const { whereSql, whereValues } = this.buildWhere(filter);
|
|
521
|
-
const result = this.getDb().prepare(`UPDATE "${table}" SET ${setClauses.join(", ")}${whereSql}`).run(...setValues, ...whereValues);
|
|
522
|
-
return result.changes;
|
|
523
|
-
}
|
|
524
|
-
async tableDelete(table, filter) {
|
|
525
|
-
const { whereSql, whereValues } = this.buildWhere(filter);
|
|
526
|
-
const result = this.getDb().prepare(`DELETE FROM "${table}"${whereSql}`).run(...whereValues);
|
|
527
|
-
return result.changes;
|
|
528
|
-
}
|
|
529
|
-
async tableQuery(table, options) {
|
|
530
|
-
let sql = `SELECT * FROM "${table}"`;
|
|
531
|
-
const values = [];
|
|
532
|
-
if (options?.where) {
|
|
533
|
-
const { whereSql, whereValues } = this.buildWhere(options.where);
|
|
534
|
-
sql += whereSql;
|
|
535
|
-
values.push(...whereValues);
|
|
536
|
-
}
|
|
537
|
-
if (options?.orderBy) {
|
|
538
|
-
sql += ` ORDER BY "${options.orderBy.field}" ${options.orderBy.direction === "desc" ? "DESC" : "ASC"}`;
|
|
539
|
-
}
|
|
540
|
-
if (options?.limit !== void 0) {
|
|
541
|
-
sql += ` LIMIT ?`;
|
|
542
|
-
values.push(options.limit);
|
|
543
|
-
}
|
|
544
|
-
if (options?.offset !== void 0) {
|
|
545
|
-
sql += ` OFFSET ?`;
|
|
546
|
-
values.push(options.offset);
|
|
547
|
-
}
|
|
548
|
-
const rows = this.getDb().prepare(sql).all(...values);
|
|
549
|
-
return rows.flatMap((r) => asJsonObject(r) ? [asJsonObject(r)] : []);
|
|
550
|
-
}
|
|
551
|
-
async tableGet(table, filter) {
|
|
552
|
-
const { whereSql, whereValues } = this.buildWhere(filter);
|
|
553
|
-
const row = this.getDb().prepare(`SELECT * FROM "${table}"${whereSql} LIMIT 1`).get(...whereValues);
|
|
554
|
-
return asJsonObject(row);
|
|
555
|
-
}
|
|
556
|
-
async tableCount(table, filter) {
|
|
557
|
-
let sql = `SELECT COUNT(*) as count FROM "${table}"`;
|
|
558
|
-
const values = [];
|
|
559
|
-
if (filter) {
|
|
560
|
-
const { whereSql, whereValues } = this.buildWhere(filter);
|
|
561
|
-
sql += whereSql;
|
|
562
|
-
values.push(...whereValues);
|
|
563
|
-
}
|
|
564
|
-
const row = asJsonObject(this.getDb().prepare(sql).get(...values));
|
|
565
|
-
return typeof row?.count === "number" ? row.count : 0;
|
|
566
|
-
}
|
|
567
|
-
buildWhere(filter) {
|
|
568
|
-
const conditions = [];
|
|
569
|
-
const values = [];
|
|
570
|
-
for (const [k, v] of Object.entries(filter)) {
|
|
571
|
-
conditions.push(`"${k}" = ?`);
|
|
572
|
-
values.push(typeof v === "object" && v !== null ? JSON.stringify(v) : v);
|
|
573
|
-
}
|
|
574
|
-
const whereSql = conditions.length > 0 ? ` WHERE ${conditions.join(" AND ")}` : "";
|
|
575
|
-
return { whereSql, whereValues: values };
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// src/builtins/sqlite-storage/sqlite-settings.addon.ts
|
|
580
|
-
var SqliteSettingsAddon = class extends BaseAddon {
|
|
581
|
-
backend = null;
|
|
582
|
-
constructor() {
|
|
583
|
-
super({});
|
|
584
|
-
}
|
|
585
|
-
async onInitialize() {
|
|
586
|
-
const addonId = this.ctx.id.replace("addon:", "");
|
|
587
|
-
let pathSource = "fallback (hardcoded)";
|
|
588
|
-
const dbPath = await this.ctx.api.storage.resolve.query({ location: "addons-data", relativePath: `${addonId}/camstack.db` }).then((p) => {
|
|
589
|
-
pathSource = "storage capability (addons-data)";
|
|
590
|
-
return p;
|
|
591
|
-
}).catch(() => {
|
|
592
|
-
if (this.ctx.dataDir) {
|
|
593
|
-
pathSource = "dataDir";
|
|
594
|
-
return `${this.ctx.dataDir}/camstack.db`;
|
|
595
|
-
}
|
|
596
|
-
return "camstack-data/addons-data/sqlite-settings/camstack.db";
|
|
597
|
-
});
|
|
598
|
-
let dbExists = false;
|
|
599
|
-
try {
|
|
600
|
-
const fs = await import("fs");
|
|
601
|
-
dbExists = fs.existsSync(dbPath);
|
|
602
|
-
} catch (err) {
|
|
603
|
-
this.ctx.logger.warn("Failed to check DB file existence", { meta: { error: errMsg(err) } });
|
|
604
|
-
}
|
|
605
|
-
this.ctx.logger.info("DB path resolved", { meta: { pathSource, dbPath } });
|
|
606
|
-
this.ctx.logger.info("DB file status", { meta: { dbExists } });
|
|
607
|
-
this.backend = new SqliteSettingsBackend(dbPath, { ...RUNTIME_DEFAULTS });
|
|
608
|
-
await this.backend.initialize();
|
|
609
|
-
this.ctx.logger.info("Initialized successfully");
|
|
610
|
-
return [{ capability: settingsStoreCapability, provider: this.backend }];
|
|
611
|
-
}
|
|
612
|
-
async onShutdown() {
|
|
613
|
-
await this.backend?.shutdown();
|
|
614
|
-
}
|
|
615
|
-
getBackend() {
|
|
616
|
-
return this.backend;
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
var sqlite_settings_addon_default = SqliteSettingsAddon;
|
|
620
|
-
|
|
621
|
-
export {
|
|
622
|
-
SqliteSettingsBackend,
|
|
623
|
-
SqliteSettingsAddon,
|
|
624
|
-
sqlite_settings_addon_default
|
|
625
|
-
};
|
|
626
|
-
//# sourceMappingURL=chunk-FZN56HGQ.mjs.map
|