@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.
Files changed (382) hide show
  1. package/dist/addon/addon-api-factory.d.ts +36 -0
  2. package/dist/addon/addon-api-factory.d.ts.map +1 -0
  3. package/dist/addon-routes/addon-route-registry.d.ts +38 -0
  4. package/dist/addon-routes/addon-route-registry.d.ts.map +1 -0
  5. package/dist/auth/api-key-manager.d.ts +27 -0
  6. package/dist/auth/api-key-manager.d.ts.map +1 -0
  7. package/dist/auth/auth-manager.d.ts +47 -0
  8. package/dist/auth/auth-manager.d.ts.map +1 -0
  9. package/dist/auth/parse-record.d.ts +19 -0
  10. package/dist/auth/parse-record.d.ts.map +1 -0
  11. package/dist/auth/scoped-token-manager.d.ts +18 -0
  12. package/dist/auth/scoped-token-manager.d.ts.map +1 -0
  13. package/dist/auth/user-manager.d.ts +34 -0
  14. package/dist/auth/user-manager.d.ts.map +1 -0
  15. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +54 -0
  16. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts.map +1 -0
  17. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +223 -217
  18. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js.map +1 -1
  19. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +216 -7
  20. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs.map +1 -1
  21. package/dist/builtins/addon-pages-aggregator/index.d.ts +2 -0
  22. package/dist/builtins/addon-pages-aggregator/index.d.ts.map +1 -0
  23. package/dist/builtins/addon-pages-aggregator/index.js +6 -221
  24. package/dist/builtins/addon-pages-aggregator/index.mjs +2 -9
  25. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +33 -0
  26. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts.map +1 -0
  27. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +199 -197
  28. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js.map +1 -1
  29. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +192 -7
  30. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs.map +1 -1
  31. package/dist/builtins/addon-widgets-aggregator/index.d.ts +2 -0
  32. package/dist/builtins/addon-widgets-aggregator/index.d.ts.map +1 -0
  33. package/dist/builtins/addon-widgets-aggregator/index.js +6 -201
  34. package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -9
  35. package/dist/builtins/alerts/alerts.addon.d.ts +82 -0
  36. package/dist/builtins/alerts/alerts.addon.d.ts.map +1 -0
  37. package/dist/builtins/alerts/alerts.addon.js +590 -430
  38. package/dist/builtins/alerts/alerts.addon.js.map +1 -1
  39. package/dist/builtins/alerts/alerts.addon.mjs +595 -7
  40. package/dist/builtins/alerts/alerts.addon.mjs.map +1 -1
  41. package/dist/builtins/alerts/index.d.ts +2 -0
  42. package/dist/builtins/alerts/index.d.ts.map +1 -0
  43. package/dist/builtins/alerts/index.js +3 -443
  44. package/dist/builtins/alerts/index.mjs +2 -8
  45. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts +8 -0
  46. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +1 -0
  47. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +56 -0
  48. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +1 -0
  49. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +50 -0
  50. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +1 -0
  51. package/dist/builtins/auth-orchestrator/index.d.ts +2 -0
  52. package/dist/builtins/auth-orchestrator/index.d.ts.map +1 -0
  53. package/dist/builtins/auth-orchestrator/index.js +7 -0
  54. package/dist/builtins/auth-orchestrator/index.mjs +2 -0
  55. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +148 -0
  56. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts.map +1 -0
  57. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +7639 -0
  58. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js.map +1 -0
  59. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +7627 -0
  60. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs.map +1 -0
  61. package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +24 -0
  62. package/dist/builtins/backup-orchestrator/cron-helpers.d.ts.map +1 -0
  63. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +73 -0
  64. package/dist/builtins/backup-orchestrator/destination-policy.d.ts.map +1 -0
  65. package/dist/builtins/backup-orchestrator/download-helpers.d.ts +13 -0
  66. package/dist/builtins/backup-orchestrator/download-helpers.d.ts.map +1 -0
  67. package/dist/builtins/backup-orchestrator/index.d.ts +3 -0
  68. package/dist/builtins/backup-orchestrator/index.d.ts.map +1 -0
  69. package/dist/builtins/backup-orchestrator/index.js +7 -0
  70. package/dist/builtins/backup-orchestrator/index.mjs +2 -0
  71. package/dist/builtins/backup-orchestrator/manifest-store.d.ts +78 -0
  72. package/dist/builtins/backup-orchestrator/manifest-store.d.ts.map +1 -0
  73. package/dist/builtins/console-logging/console-destination.d.ts +14 -0
  74. package/dist/builtins/console-logging/console-destination.d.ts.map +1 -0
  75. package/dist/builtins/console-logging/console-logging.addon.d.ts +26 -0
  76. package/dist/builtins/console-logging/console-logging.addon.d.ts.map +1 -0
  77. package/dist/builtins/console-logging/index.d.ts +4 -0
  78. package/dist/builtins/console-logging/index.d.ts.map +1 -0
  79. package/dist/builtins/console-logging/index.js +99 -235
  80. package/dist/builtins/console-logging/index.js.map +1 -1
  81. package/dist/builtins/console-logging/index.mjs +95 -9
  82. package/dist/builtins/console-logging/index.mjs.map +1 -1
  83. package/dist/builtins/device-manager/device-event-propagator.d.ts +27 -0
  84. package/dist/builtins/device-manager/device-event-propagator.d.ts.map +1 -0
  85. package/dist/builtins/device-manager/device-manager.addon.d.ts +259 -0
  86. package/dist/builtins/device-manager/device-manager.addon.d.ts.map +1 -0
  87. package/dist/builtins/device-manager/device-manager.addon.js +2125 -2127
  88. package/dist/builtins/device-manager/device-manager.addon.js.map +1 -1
  89. package/dist/builtins/device-manager/device-manager.addon.mjs +2145 -7
  90. package/dist/builtins/device-manager/device-manager.addon.mjs.map +1 -1
  91. package/dist/builtins/device-manager/index.d.ts +3 -0
  92. package/dist/builtins/device-manager/index.d.ts.map +1 -0
  93. package/dist/builtins/device-manager/index.js +6 -2156
  94. package/dist/builtins/device-manager/index.mjs +2 -10
  95. package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +45 -0
  96. package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts.map +1 -0
  97. package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +16 -0
  98. package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts.map +1 -0
  99. package/dist/builtins/hub-forwarder/index.d.ts +4 -0
  100. package/dist/builtins/hub-forwarder/index.d.ts.map +1 -0
  101. package/dist/builtins/hub-forwarder/index.js +150 -291
  102. package/dist/builtins/hub-forwarder/index.js.map +1 -1
  103. package/dist/builtins/hub-forwarder/index.mjs +145 -9
  104. package/dist/builtins/hub-forwarder/index.mjs.map +1 -1
  105. package/dist/builtins/local-auth/auth-schema.d.ts +12 -0
  106. package/dist/builtins/local-auth/auth-schema.d.ts.map +1 -0
  107. package/dist/builtins/local-auth/index.d.ts +2 -0
  108. package/dist/builtins/local-auth/index.d.ts.map +1 -0
  109. package/dist/builtins/local-auth/index.js +3 -623
  110. package/dist/builtins/local-auth/index.mjs +2 -8
  111. package/dist/builtins/local-auth/local-auth.addon.d.ts +17 -0
  112. package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -0
  113. package/dist/builtins/local-auth/local-auth.addon.js +6861 -589
  114. package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
  115. package/dist/builtins/local-auth/local-auth.addon.mjs +6883 -7
  116. package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
  117. package/dist/builtins/local-network/index.d.ts +3 -0
  118. package/dist/builtins/local-network/index.d.ts.map +1 -0
  119. package/dist/builtins/local-network/index.js +9 -0
  120. package/dist/builtins/local-network/index.mjs +2 -0
  121. package/dist/builtins/local-network/local-network.addon.d.ts +110 -0
  122. package/dist/builtins/local-network/local-network.addon.d.ts.map +1 -0
  123. package/dist/builtins/local-network/local-network.addon.js +399 -0
  124. package/dist/builtins/local-network/local-network.addon.js.map +1 -0
  125. package/dist/builtins/local-network/local-network.addon.mjs +387 -0
  126. package/dist/builtins/local-network/local-network.addon.mjs.map +1 -0
  127. package/dist/builtins/mesh-orchestrator/index.d.ts +2 -0
  128. package/dist/builtins/mesh-orchestrator/index.d.ts.map +1 -0
  129. package/dist/builtins/mesh-orchestrator/index.js +7 -0
  130. package/dist/builtins/mesh-orchestrator/index.mjs +2 -0
  131. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts +9 -0
  132. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts.map +1 -0
  133. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js +83 -0
  134. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js.map +1 -0
  135. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs +77 -0
  136. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs.map +1 -0
  137. package/dist/builtins/native-metrics/index.d.ts +3 -0
  138. package/dist/builtins/native-metrics/index.d.ts.map +1 -0
  139. package/dist/builtins/native-metrics/native-metrics-provider.d.ts +49 -0
  140. package/dist/builtins/native-metrics/native-metrics-provider.d.ts.map +1 -0
  141. package/dist/builtins/native-metrics/native-metrics.addon.d.ts +74 -0
  142. package/dist/builtins/native-metrics/native-metrics.addon.d.ts.map +1 -0
  143. package/dist/builtins/native-metrics/native-metrics.addon.js +887 -861
  144. package/dist/builtins/native-metrics/native-metrics.addon.js.map +1 -1
  145. package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -5
  146. package/dist/builtins/native-metrics/native-metrics.addon.mjs.map +1 -1
  147. package/dist/builtins/platform-probe/index.d.ts +12 -0
  148. package/dist/builtins/platform-probe/index.d.ts.map +1 -0
  149. package/dist/builtins/platform-probe/index.js +539 -0
  150. package/dist/builtins/platform-probe/index.js.map +1 -0
  151. package/dist/builtins/platform-probe/index.mjs +530 -0
  152. package/dist/builtins/platform-probe/index.mjs.map +1 -0
  153. package/dist/builtins/platform-probe/inference-config-resolver.d.ts +30 -0
  154. package/dist/builtins/platform-probe/inference-config-resolver.d.ts.map +1 -0
  155. package/dist/builtins/platform-probe/platform-scorer.d.ts +22 -0
  156. package/dist/builtins/platform-probe/platform-scorer.d.ts.map +1 -0
  157. package/dist/builtins/remote-access-orchestrator/index.d.ts +2 -0
  158. package/dist/builtins/remote-access-orchestrator/index.d.ts.map +1 -0
  159. package/dist/builtins/remote-access-orchestrator/index.js +7 -0
  160. package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
  161. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +9 -0
  162. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts.map +1 -0
  163. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +72 -0
  164. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js.map +1 -0
  165. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +66 -0
  166. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs.map +1 -0
  167. package/dist/builtins/snapshot/index.d.ts +3 -0
  168. package/dist/builtins/snapshot/index.d.ts.map +1 -0
  169. package/dist/builtins/snapshot/index.js +481 -491
  170. package/dist/builtins/snapshot/index.js.map +1 -1
  171. package/dist/builtins/snapshot/index.mjs +475 -464
  172. package/dist/builtins/snapshot/index.mjs.map +1 -1
  173. package/dist/builtins/snapshot/snapshot.addon.d.ts +121 -0
  174. package/dist/builtins/snapshot/snapshot.addon.d.ts.map +1 -0
  175. package/dist/builtins/sqlite-storage/config-store.d.ts +9 -0
  176. package/dist/builtins/sqlite-storage/config-store.d.ts.map +1 -0
  177. package/dist/builtins/sqlite-storage/device-store.d.ts +24 -0
  178. package/dist/builtins/sqlite-storage/device-store.d.ts.map +1 -0
  179. package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +87 -0
  180. package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts.map +1 -0
  181. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
  182. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts.map +1 -0
  183. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +312 -56
  184. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js.map +1 -1
  185. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +305 -7
  186. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs.map +1 -1
  187. package/dist/builtins/sqlite-storage/index.d.ts +12 -0
  188. package/dist/builtins/sqlite-storage/index.d.ts.map +1 -0
  189. package/dist/builtins/sqlite-storage/index.js +229 -1001
  190. package/dist/builtins/sqlite-storage/index.js.map +1 -1
  191. package/dist/builtins/sqlite-storage/index.mjs +268 -26
  192. package/dist/builtins/sqlite-storage/index.mjs.map +1 -1
  193. package/dist/builtins/sqlite-storage/integration-registry.d.ts +28 -0
  194. package/dist/builtins/sqlite-storage/integration-registry.d.ts.map +1 -0
  195. package/dist/builtins/sqlite-storage/settings-store.d.ts +40 -0
  196. package/dist/builtins/sqlite-storage/settings-store.d.ts.map +1 -0
  197. package/dist/builtins/sqlite-storage/sql-schema.d.ts +33 -0
  198. package/dist/builtins/sqlite-storage/sql-schema.d.ts.map +1 -0
  199. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +94 -0
  200. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts.map +1 -0
  201. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +15 -0
  202. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts.map +1 -0
  203. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +586 -653
  204. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
  205. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +582 -7
  206. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -1
  207. package/dist/builtins/storage-orchestrator/index.d.ts +7 -0
  208. package/dist/builtins/storage-orchestrator/index.d.ts.map +1 -0
  209. package/dist/builtins/storage-orchestrator/index.js +9 -0
  210. package/dist/builtins/storage-orchestrator/index.mjs +2 -0
  211. package/dist/builtins/storage-orchestrator/location-store.d.ts +50 -0
  212. package/dist/builtins/storage-orchestrator/location-store.d.ts.map +1 -0
  213. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +60 -0
  214. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts.map +1 -0
  215. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +755 -0
  216. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js.map +1 -0
  217. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +746 -0
  218. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs.map +1 -0
  219. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +121 -0
  220. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts.map +1 -0
  221. package/dist/builtins/system-backup/system-backup.service.d.ts +138 -0
  222. package/dist/builtins/system-backup/system-backup.service.d.ts.map +1 -0
  223. package/dist/builtins/system-config/index.d.ts +2 -0
  224. package/dist/builtins/system-config/index.d.ts.map +1 -0
  225. package/dist/builtins/system-config/index.js +6 -188
  226. package/dist/builtins/system-config/index.mjs +2 -10
  227. package/dist/builtins/system-config/system-config.addon.d.ts +11 -0
  228. package/dist/builtins/system-config/system-config.addon.d.ts.map +1 -0
  229. package/dist/builtins/system-config/system-config.addon.js +227 -180
  230. package/dist/builtins/system-config/system-config.addon.js.map +1 -1
  231. package/dist/builtins/system-config/system-config.addon.mjs +226 -7
  232. package/dist/builtins/system-config/system-config.addon.mjs.map +1 -1
  233. package/dist/builtins/turn-orchestrator/index.d.ts +2 -0
  234. package/dist/builtins/turn-orchestrator/index.d.ts.map +1 -0
  235. package/dist/builtins/turn-orchestrator/index.js +7 -0
  236. package/dist/builtins/turn-orchestrator/index.mjs +2 -0
  237. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts +10 -0
  238. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts.map +1 -0
  239. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js +78 -0
  240. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js.map +1 -0
  241. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs +72 -0
  242. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs.map +1 -0
  243. package/dist/builtins/winston-logging/index.d.ts +4 -0
  244. package/dist/builtins/winston-logging/index.d.ts.map +1 -0
  245. package/dist/builtins/winston-logging/index.js +153 -300
  246. package/dist/builtins/winston-logging/index.js.map +1 -1
  247. package/dist/builtins/winston-logging/index.mjs +144 -9
  248. package/dist/builtins/winston-logging/index.mjs.map +1 -1
  249. package/dist/builtins/winston-logging/winston-destination.d.ts +22 -0
  250. package/dist/builtins/winston-logging/winston-destination.d.ts.map +1 -0
  251. package/dist/builtins/winston-logging/winston-logging.addon.d.ts +20 -0
  252. package/dist/builtins/winston-logging/winston-logging.addon.d.ts.map +1 -0
  253. package/dist/chunk-C13QxCFV.js +50 -0
  254. package/dist/chunk-hT5z_Zn9.mjs +35 -0
  255. package/dist/download/model-download-service.d.ts +42 -0
  256. package/dist/download/model-download-service.d.ts.map +1 -0
  257. package/dist/download/model-downloader.d.ts +32 -0
  258. package/dist/download/model-downloader.d.ts.map +1 -0
  259. package/dist/events/event-bus.d.ts +11 -0
  260. package/dist/events/event-bus.d.ts.map +1 -0
  261. package/dist/events/system-event-bus.d.ts +15 -0
  262. package/dist/events/system-event-bus.d.ts.map +1 -0
  263. package/dist/feature/feature-manager.d.ts +12 -0
  264. package/dist/feature/feature-manager.d.ts.map +1 -0
  265. package/dist/formatter-C-5An4Bl.mjs +164 -0
  266. package/dist/formatter-C-5An4Bl.mjs.map +1 -0
  267. package/dist/formatter-Dr_6NNZc.js +169 -0
  268. package/dist/formatter-Dr_6NNZc.js.map +1 -0
  269. package/dist/index.d.ts +76 -1696
  270. package/dist/index.d.ts.map +1 -0
  271. package/dist/index.js +7780 -8035
  272. package/dist/index.js.map +1 -1
  273. package/dist/index.mjs +7707 -2148
  274. package/dist/index.mjs.map +1 -1
  275. package/dist/lifecycle/lifecycle-state-machine.d.ts +29 -0
  276. package/dist/lifecycle/lifecycle-state-machine.d.ts.map +1 -0
  277. package/dist/logging/formatter.d.ts +31 -0
  278. package/dist/logging/formatter.d.ts.map +1 -0
  279. package/dist/logging/log-manager.d.ts +52 -0
  280. package/dist/logging/log-manager.d.ts.map +1 -0
  281. package/dist/logging/log-ring-buffer.d.ts +48 -0
  282. package/dist/logging/log-ring-buffer.d.ts.map +1 -0
  283. package/dist/logging/scoped-logger.d.ts +18 -0
  284. package/dist/logging/scoped-logger.d.ts.map +1 -0
  285. package/dist/network/network-quality.d.ts +12 -0
  286. package/dist/network/network-quality.d.ts.map +1 -0
  287. package/dist/notification/notification-service.d.ts +38 -0
  288. package/dist/notification/notification-service.d.ts.map +1 -0
  289. package/dist/notification/toast-service.d.ts +23 -0
  290. package/dist/notification/toast-service.d.ts.map +1 -0
  291. package/dist/pipeline/engine-manager-resolver.d.ts +16 -0
  292. package/dist/pipeline/engine-manager-resolver.d.ts.map +1 -0
  293. package/dist/pipeline/pipeline-runner.d.ts +9 -0
  294. package/dist/pipeline/pipeline-runner.d.ts.map +1 -0
  295. package/dist/pipeline/pipeline-validator.d.ts +14 -0
  296. package/dist/pipeline/pipeline-validator.d.ts.map +1 -0
  297. package/dist/process/resource-monitor.d.ts +12 -0
  298. package/dist/process/resource-monitor.d.ts.map +1 -0
  299. package/dist/python/python-env-manager.d.ts +13 -0
  300. package/dist/python/python-env-manager.d.ts.map +1 -0
  301. package/dist/repl/interfaces.d.ts +32 -0
  302. package/dist/repl/interfaces.d.ts.map +1 -0
  303. package/dist/repl/repl-engine.d.ts +9 -0
  304. package/dist/repl/repl-engine.d.ts.map +1 -0
  305. package/dist/resource-monitor-CmuWlmap.js +76 -0
  306. package/dist/resource-monitor-CmuWlmap.js.map +1 -0
  307. package/dist/resource-monitor-DcQdKGYU.mjs +59 -0
  308. package/dist/resource-monitor-DcQdKGYU.mjs.map +1 -0
  309. package/dist/storage/fs-storage-backend.d.ts +41 -0
  310. package/dist/storage/fs-storage-backend.d.ts.map +1 -0
  311. package/dist/storage/storage-location-manager.d.ts +24 -0
  312. package/dist/storage/storage-location-manager.d.ts.map +1 -0
  313. package/dist/storage/storage-manager.d.ts +77 -0
  314. package/dist/storage/storage-manager.d.ts.map +1 -0
  315. package/dist/tls/cert-manager.d.ts +27 -0
  316. package/dist/tls/cert-manager.d.ts.map +1 -0
  317. package/dist/tls/index.d.ts +2 -0
  318. package/dist/tls/index.d.ts.map +1 -0
  319. package/package.json +119 -23
  320. package/dist/builtins/addon-pages-aggregator/index.js.map +0 -1
  321. package/dist/builtins/addon-pages-aggregator/index.mjs.map +0 -1
  322. package/dist/builtins/addon-widgets-aggregator/index.js.map +0 -1
  323. package/dist/builtins/addon-widgets-aggregator/index.mjs.map +0 -1
  324. package/dist/builtins/alerts/index.js.map +0 -1
  325. package/dist/builtins/alerts/index.mjs.map +0 -1
  326. package/dist/builtins/device-manager/index.js.map +0 -1
  327. package/dist/builtins/device-manager/index.mjs.map +0 -1
  328. package/dist/builtins/local-auth/index.js.map +0 -1
  329. package/dist/builtins/local-auth/index.mjs.map +0 -1
  330. package/dist/builtins/local-backup/index.js +0 -173
  331. package/dist/builtins/local-backup/index.js.map +0 -1
  332. package/dist/builtins/local-backup/index.mjs +0 -10
  333. package/dist/builtins/local-backup/index.mjs.map +0 -1
  334. package/dist/builtins/system-config/index.js.map +0 -1
  335. package/dist/builtins/system-config/index.mjs.map +0 -1
  336. package/dist/chunk-2CIYKDRN.mjs +0 -1
  337. package/dist/chunk-2CIYKDRN.mjs.map +0 -1
  338. package/dist/chunk-2F76X6NL.mjs +0 -136
  339. package/dist/chunk-2F76X6NL.mjs.map +0 -1
  340. package/dist/chunk-2QUFBZ7M.mjs +0 -1
  341. package/dist/chunk-2QUFBZ7M.mjs.map +0 -1
  342. package/dist/chunk-3BK2Y7GY.mjs +0 -593
  343. package/dist/chunk-3BK2Y7GY.mjs.map +0 -1
  344. package/dist/chunk-4OOHFJHT.mjs +0 -421
  345. package/dist/chunk-4OOHFJHT.mjs.map +0 -1
  346. package/dist/chunk-4XHB7IHT.mjs +0 -809
  347. package/dist/chunk-4XHB7IHT.mjs.map +0 -1
  348. package/dist/chunk-6M2HSSTQ.mjs +0 -98
  349. package/dist/chunk-6M2HSSTQ.mjs.map +0 -1
  350. package/dist/chunk-7FI7SQS7.mjs +0 -135
  351. package/dist/chunk-7FI7SQS7.mjs.map +0 -1
  352. package/dist/chunk-ED57RCQE.mjs +0 -171
  353. package/dist/chunk-ED57RCQE.mjs.map +0 -1
  354. package/dist/chunk-FZN56HGQ.mjs +0 -626
  355. package/dist/chunk-FZN56HGQ.mjs.map +0 -1
  356. package/dist/chunk-GL4OOB25.mjs +0 -51
  357. package/dist/chunk-GL4OOB25.mjs.map +0 -1
  358. package/dist/chunk-KDG2NTDB.mjs +0 -137
  359. package/dist/chunk-KDG2NTDB.mjs.map +0 -1
  360. package/dist/chunk-NRBQWBDM.mjs +0 -191
  361. package/dist/chunk-NRBQWBDM.mjs.map +0 -1
  362. package/dist/chunk-O4V246GG.mjs +0 -2137
  363. package/dist/chunk-O4V246GG.mjs.map +0 -1
  364. package/dist/chunk-QT57H266.mjs +0 -163
  365. package/dist/chunk-QT57H266.mjs.map +0 -1
  366. package/dist/chunk-QX4RH25I.mjs +0 -141
  367. package/dist/chunk-QX4RH25I.mjs.map +0 -1
  368. package/dist/chunk-TB562PZX.mjs +0 -86
  369. package/dist/chunk-TB562PZX.mjs.map +0 -1
  370. package/dist/chunk-TDYPZXK5.mjs +0 -1
  371. package/dist/chunk-TDYPZXK5.mjs.map +0 -1
  372. package/dist/chunk-UJI4LN5P.mjs +0 -36
  373. package/dist/chunk-UJI4LN5P.mjs.map +0 -1
  374. package/dist/chunk-W6RTHQGP.mjs +0 -1
  375. package/dist/chunk-W6RTHQGP.mjs.map +0 -1
  376. package/dist/chunk-ZELBCPDC.mjs +0 -369
  377. package/dist/chunk-ZELBCPDC.mjs.map +0 -1
  378. package/dist/index.d.mts +0 -1696
  379. package/dist/resource-monitor-UZUGPIAU.mjs +0 -9
  380. package/dist/resource-monitor-UZUGPIAU.mjs.map +0 -1
  381. package/dist/storage-location-manager-HFNB3PCS.mjs +0 -7
  382. 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