@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.
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 +102 -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 +404 -0
  124. package/dist/builtins/local-network/local-network.addon.js.map +1 -0
  125. package/dist/builtins/local-network/local-network.addon.mjs +392 -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
@@ -1,305 +1,158 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/builtins/winston-logging/index.ts
31
- var winston_logging_exports = {};
32
- __export(winston_logging_exports, {
33
- WinstonDestination: () => WinstonDestination,
34
- WinstonLoggingAddon: () => WinstonLoggingAddon,
35
- default: () => WinstonLoggingAddon
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
36
4
  });
37
- module.exports = __toCommonJS(winston_logging_exports);
38
-
39
- // src/builtins/winston-logging/winston-logging.addon.ts
40
- var import_types = require("@camstack/types");
41
-
42
- // src/builtins/winston-logging/winston-destination.ts
43
- var winston = __toESM(require("winston"));
44
- var import_winston_daily_rotate_file = __toESM(require("winston-daily-rotate-file"));
45
- var path = __toESM(require("path"));
46
-
47
- // src/logging/formatter.ts
48
- var USE_COLOR = (() => {
49
- try {
50
- if (typeof process === "undefined") return false;
51
- const env = process.env ?? {};
52
- if (env["NO_COLOR"]) return false;
53
- const force = env["FORCE_COLOR"];
54
- if (force !== void 0) return force !== "" && force !== "0" && force !== "false";
55
- return Boolean(process.stdout?.isTTY);
56
- } catch {
57
- return false;
58
- }
59
- })();
60
- var NO_COLOR = (() => {
61
- try {
62
- return Boolean(process?.env?.["NO_COLOR"]);
63
- } catch {
64
- return false;
65
- }
66
- })();
67
- var RESET = "\x1B[0m";
68
- var ANSI = {
69
- green: "\x1B[32m",
70
- yellow: "\x1B[33m",
71
- red: "\x1B[31m",
72
- cyan: "\x1B[36m",
73
- gray: "\x1B[90m"
74
- };
75
- var COLOR_BY_LEVEL = {
76
- debug: ANSI.gray,
77
- info: ANSI.green,
78
- warn: ANSI.yellow,
79
- error: ANSI.red
80
- };
81
- function paint(color, text, enabled) {
82
- return enabled ? `${color}${text}${RESET}` : text;
83
- }
84
- function colorizeLevel(level, text, enabled) {
85
- if (!enabled) return text;
86
- const code = COLOR_BY_LEVEL[level];
87
- return code ? `${code}${text}${RESET}` : text;
88
- }
89
- function padRight(value, width) {
90
- if (value.length >= width) return value.slice(0, width);
91
- return value + " ".repeat(width - value.length);
92
- }
93
- function resolveAgent(tags) {
94
- const agentId = tags?.agentId;
95
- if (typeof agentId === "string" && agentId.length > 0) return agentId;
96
- const nodeId = tags?.nodeId;
97
- if (typeof nodeId === "string" && nodeId.length > 0) {
98
- return nodeId.includes("/") ? nodeId.split("/")[0] : nodeId;
99
- }
100
- return null;
101
- }
102
- function resolveAddon(entry) {
103
- const addonId = entry.tags?.addonId;
104
- if (typeof addonId === "string" && addonId.length > 0) return addonId;
105
- return "system";
106
- }
107
- function resolveDevice(tags) {
108
- const name = tags?.deviceName;
109
- if (typeof name === "string" && name.length > 0) return name;
110
- const id = tags?.deviceId;
111
- if (typeof id === "number" && Number.isFinite(id)) return `#${id}`;
112
- return null;
113
- }
114
- function buildBrand(entry) {
115
- const agent = resolveAgent(entry.tags) ?? "?";
116
- const addon = resolveAddon(entry);
117
- return `${agent}/${addon}`;
118
- }
119
- function buildDeviceContext(entry) {
120
- return resolveDevice(entry.tags);
121
- }
122
- function formatTimestamp(value) {
123
- const date = value instanceof Date ? value : new Date(typeof value === "string" ? value : Date.now());
124
- return date.toLocaleString("en-US", {
125
- month: "numeric",
126
- day: "numeric",
127
- year: "numeric",
128
- hour: "numeric",
129
- minute: "2-digit",
130
- second: "2-digit",
131
- hour12: true
132
- });
133
- }
134
- function formatMeta(meta) {
135
- if (!meta) return "";
136
- const keys = Object.keys(meta);
137
- if (keys.length === 0) return "";
138
- const parts = [];
139
- for (const key of keys) {
140
- const value = meta[key];
141
- parts.push(`${key}=${formatMetaValue(value)}`);
142
- }
143
- return `{${parts.join(" ")}}`;
144
- }
145
- function formatMetaValue(value) {
146
- if (value === null) return "null";
147
- if (value === void 0) return "undefined";
148
- if (typeof value === "string") {
149
- return /\s|"/.test(value) ? JSON.stringify(value) : value;
150
- }
151
- if (typeof value === "number" || typeof value === "boolean") return String(value);
152
- if (value instanceof Error) return JSON.stringify(value.message);
153
- try {
154
- return JSON.stringify(value);
155
- } catch {
156
- return String(value);
157
- }
158
- }
159
- var PID = typeof process !== "undefined" && typeof process.pid === "number" ? String(process.pid) : "?";
160
- function formatLogLine(entry, options) {
161
- const wantsColor = options?.colorize ?? USE_COLOR;
162
- const colorize = wantsColor && !NO_COLOR;
163
- const levelColor = COLOR_BY_LEVEL[entry.level];
164
- const brand = paint(ANSI.green, `[${buildBrand(entry)}]`, colorize);
165
- const entryPid = entry.tags?.pid;
166
- const pid = typeof entryPid === "number" ? String(entryPid) : PID;
167
- const timestamp = formatTimestamp(entry.timestamp);
168
- const level = colorizeLevel(entry.level, padRight(entry.level.toUpperCase(), 5), colorize);
169
- const device = buildDeviceContext(entry);
170
- const ctxPart = device ? " " + paint(ANSI.yellow, `[${device}]`, colorize) : "";
171
- const scope = typeof entry.scope === "string" && entry.scope.length > 0 ? entry.scope : null;
172
- const scopePart = scope ? " " + paint(ANSI.cyan, `(${scope})`, colorize) : "";
173
- const metaText = formatMeta(entry.meta);
174
- const metaPart = metaText ? " " + paint(ANSI.gray, metaText, colorize) : "";
175
- const message = colorize && levelColor ? `${levelColor}${entry.message}${RESET}` : entry.message;
176
- return `${brand} ${pid} - ${timestamp} ${level}${ctxPart}${scopePart} ${message}${metaPart}`;
177
- }
178
-
179
- // src/builtins/winston-logging/winston-destination.ts
5
+ const require_chunk = require("../../chunk-C13QxCFV.js");
6
+ const require_formatter = require("../../formatter-Dr_6NNZc.js");
7
+ let node_path = require("node:path");
8
+ node_path = require_chunk.__toESM(node_path);
9
+ let _camstack_types = require("@camstack/types");
10
+ let winston = require("winston");
11
+ winston = require_chunk.__toESM(winston);
12
+ let winston_daily_rotate_file = require("winston-daily-rotate-file");
13
+ winston_daily_rotate_file = require_chunk.__toESM(winston_daily_rotate_file);
14
+ //#region src/builtins/winston-logging/winston-destination.ts
15
+ /**
16
+ * Rotated-file log destination. Console output goes through the shared
17
+ * `formatLogLine` so every console sink (Winston, ConsoleDestination,
18
+ * HubForwarderDestination) emits identical lines. File output keeps a
19
+ * structured JSON shape so log tooling can query tags/meta.
20
+ */
180
21
  var WinstonDestination = class {
181
- logger = null;
182
- async initialize(config) {
183
- const {
184
- level = "info",
185
- retentionDays = 30,
186
- logsDir = path.join("camstack-data", "logs")
187
- } = config ?? {};
188
- const consoleFormat = winston.format.printf((info) => {
189
- const rendered = info._rendered;
190
- return typeof rendered === "string" ? rendered : String(info.message);
191
- });
192
- const stripRendered = winston.format((info) => {
193
- delete info["_rendered"];
194
- return info;
195
- });
196
- const fileFormat = winston.format.combine(
197
- winston.format.timestamp(),
198
- stripRendered(),
199
- winston.format.json()
200
- );
201
- void consoleFormat;
202
- this.logger = winston.createLogger({
203
- level,
204
- transports: [
205
- new import_winston_daily_rotate_file.default({
206
- dirname: logsDir,
207
- filename: "camstack-%DATE%.log",
208
- datePattern: "YYYY-MM-DD",
209
- maxFiles: `${retentionDays}d`,
210
- format: fileFormat
211
- })
212
- ]
213
- });
214
- }
215
- write(entry) {
216
- if (!this.logger) return;
217
- const ts = entry.timestamp instanceof Date ? entry.timestamp.toISOString() : String(entry.timestamp);
218
- const rendered = formatLogLine(entry, { colorize: true });
219
- this.logger.log({
220
- level: entry.level,
221
- message: entry.message,
222
- _rendered: rendered,
223
- timestamp: ts,
224
- scope: entry.scope,
225
- ...entry.tags ? { tags: entry.tags } : {},
226
- ...entry.meta ? { meta: entry.meta } : {}
227
- });
228
- }
229
- async query(_filter) {
230
- return [];
231
- }
232
- async shutdown() {
233
- if (!this.logger) return;
234
- await new Promise((resolve) => {
235
- this.logger.on("finish", resolve);
236
- this.logger.end();
237
- });
238
- this.logger = null;
239
- }
22
+ logger = null;
23
+ async initialize(config) {
24
+ const { level = "info", retentionDays = 30, logsDir = node_path.join("camstack-data", "logs") } = config ?? {};
25
+ winston.format.printf((info) => {
26
+ const rendered = info._rendered;
27
+ return typeof rendered === "string" ? rendered : String(info.message);
28
+ });
29
+ const stripRendered = winston.format((info) => {
30
+ delete info["_rendered"];
31
+ return info;
32
+ });
33
+ const fileFormat = winston.format.combine(winston.format.timestamp(), stripRendered(), winston.format.json());
34
+ this.logger = winston.createLogger({
35
+ level,
36
+ transports: [new winston_daily_rotate_file.default({
37
+ dirname: logsDir,
38
+ filename: "camstack-%DATE%.log",
39
+ datePattern: "YYYY-MM-DD",
40
+ maxFiles: `${retentionDays}d`,
41
+ format: fileFormat
42
+ })]
43
+ });
44
+ }
45
+ write(entry) {
46
+ if (!this.logger) return;
47
+ const ts = entry.timestamp instanceof Date ? entry.timestamp.toISOString() : String(entry.timestamp);
48
+ const rendered = require_formatter.formatLogLine(entry, { colorize: true });
49
+ this.logger.log({
50
+ level: entry.level,
51
+ message: entry.message,
52
+ _rendered: rendered,
53
+ timestamp: ts,
54
+ scope: entry.scope,
55
+ ...entry.tags ? { tags: entry.tags } : {},
56
+ ...entry.meta ? { meta: entry.meta } : {}
57
+ });
58
+ }
59
+ async query(_filter) {
60
+ return [];
61
+ }
62
+ async shutdown() {
63
+ if (!this.logger) return;
64
+ await new Promise((resolve) => {
65
+ this.logger.on("finish", resolve);
66
+ this.logger.end();
67
+ });
68
+ this.logger = null;
69
+ }
240
70
  };
241
-
242
- // src/builtins/winston-logging/winston-logging.addon.ts
243
- var WinstonLoggingAddon = class extends import_types.BaseAddon {
244
- destination = null;
245
- constructor() {
246
- super({ level: "info", retentionDays: 30 });
247
- }
248
- async onInitialize() {
249
- const logsDir = await this.ctx.api.storage.resolve.query({ location: "logs", relativePath: "" }).catch(() => "camstack-data/logs");
250
- this.destination = new WinstonDestination();
251
- await this.destination.initialize({ ...this.config, logsDir });
252
- this.ctx.logger.info("Winston logging initialized");
253
- return [{ capability: import_types.logDestinationCapability, provider: this.destination }];
254
- }
255
- async onShutdown() {
256
- await this.destination?.shutdown();
257
- }
258
- getDestination() {
259
- if (!this.destination) throw new Error("Winston not initialized");
260
- return this.destination;
261
- }
262
- globalSettingsSchema() {
263
- return this.schema({
264
- sections: [
265
- {
266
- id: "winston-logging",
267
- title: "Logging",
268
- description: "Global log verbosity + retention for rotated log files on this node.",
269
- columns: 2,
270
- fields: [
271
- this.field({
272
- type: "select",
273
- key: "level",
274
- label: "Log Level",
275
- default: "info",
276
- options: [
277
- { value: "debug", label: "Debug" },
278
- { value: "info", label: "Info" },
279
- { value: "warn", label: "Warn" },
280
- { value: "error", label: "Error" }
281
- ]
282
- }),
283
- this.field({
284
- type: "number",
285
- key: "retentionDays",
286
- label: "Retention (days)",
287
- description: "Number of days to keep rotated log files before deletion",
288
- min: 1,
289
- max: 365,
290
- step: 1,
291
- default: 30,
292
- unit: "days"
293
- })
294
- ]
295
- }
296
- ]
297
- });
298
- }
71
+ //#endregion
72
+ //#region src/builtins/winston-logging/winston-logging.addon.ts
73
+ /**
74
+ * Winston logging addon — rotated log files + console output.
75
+ * Settings appear under Cluster → NodeDetail → Settings.
76
+ */
77
+ var WinstonLoggingAddon = class extends _camstack_types.BaseAddon {
78
+ destination = null;
79
+ constructor() {
80
+ super({
81
+ level: "info",
82
+ retentionDays: 30
83
+ });
84
+ }
85
+ async onInitialize() {
86
+ const logsDir = await this.ctx.api.storage.resolve.query({
87
+ location: "logs",
88
+ relativePath: ""
89
+ }).catch(() => "camstack-data/logs");
90
+ this.destination = new WinstonDestination();
91
+ await this.destination.initialize({
92
+ ...this.config,
93
+ logsDir
94
+ });
95
+ this.ctx.logger.info("Winston logging initialized");
96
+ return [{
97
+ capability: _camstack_types.logDestinationCapability,
98
+ provider: this.destination
99
+ }];
100
+ }
101
+ async onShutdown() {
102
+ await this.destination?.shutdown();
103
+ }
104
+ getDestination() {
105
+ if (!this.destination) throw new Error("Winston not initialized");
106
+ return this.destination;
107
+ }
108
+ globalSettingsSchema() {
109
+ return this.schema({ sections: [{
110
+ id: "winston-logging",
111
+ title: "Logging",
112
+ description: "Global log verbosity + retention for rotated log files on this node.",
113
+ columns: 2,
114
+ fields: [this.field({
115
+ type: "select",
116
+ key: "level",
117
+ label: "Log Level",
118
+ default: "info",
119
+ options: [
120
+ {
121
+ value: "debug",
122
+ label: "Debug"
123
+ },
124
+ {
125
+ value: "info",
126
+ label: "Info"
127
+ },
128
+ {
129
+ value: "warn",
130
+ label: "Warn"
131
+ },
132
+ {
133
+ value: "error",
134
+ label: "Error"
135
+ }
136
+ ]
137
+ }), this.field({
138
+ type: "number",
139
+ key: "retentionDays",
140
+ label: "Retention (days)",
141
+ description: "Number of days to keep rotated log files before deletion",
142
+ min: 1,
143
+ max: 365,
144
+ step: 1,
145
+ default: 30,
146
+ unit: "days"
147
+ })]
148
+ }] });
149
+ }
299
150
  };
300
- // Annotate the CommonJS export names for ESM import in node:
301
- 0 && (module.exports = {
302
- WinstonDestination,
303
- WinstonLoggingAddon
304
- });
151
+ //#endregion
152
+ exports.WinstonDestination = WinstonDestination;
153
+ exports.WinstonDestination$1 = WinstonDestination;
154
+ exports.WinstonLoggingAddon = WinstonLoggingAddon;
155
+ exports.WinstonLoggingAddon$1 = WinstonLoggingAddon;
156
+ exports.default = WinstonLoggingAddon;
157
+
305
158
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/builtins/winston-logging/index.ts","../../../src/builtins/winston-logging/winston-logging.addon.ts","../../../src/builtins/winston-logging/winston-destination.ts","../../../src/logging/formatter.ts"],"sourcesContent":["export { WinstonLoggingAddon } from './winston-logging.addon.js'\nexport { WinstonDestination } from './winston-destination.js'\nexport { WinstonLoggingAddon as default } from './winston-logging.addon.js'\n","import type { ProviderRegistration } from '@camstack/types'\nimport { BaseAddon, logDestinationCapability } from '@camstack/types'\nimport { WinstonDestination } from './winston-destination.js'\n\ninterface WinstonConfig {\n readonly level: string\n readonly retentionDays: number\n}\n\n/**\n * Winston logging addon — rotated log files + console output.\n * Settings appear under Cluster → NodeDetail → Settings.\n */\nexport class WinstonLoggingAddon extends BaseAddon<WinstonConfig> {\n private destination: WinstonDestination | null = null\n\n constructor() {\n super({ level: 'info', retentionDays: 30 })\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const logsDir = await this.ctx.api.storage.resolve.query({ location: 'logs', relativePath: '' })\n .catch(() => 'camstack-data/logs')\n this.destination = new WinstonDestination()\n await this.destination.initialize({ ...this.config, logsDir })\n this.ctx.logger.info('Winston logging initialized')\n return [{ capability: logDestinationCapability, provider: this.destination }]\n }\n\n protected async onShutdown(): Promise<void> {\n await this.destination?.shutdown()\n }\n\n getDestination(): WinstonDestination {\n if (!this.destination) throw new Error('Winston not initialized')\n return this.destination\n }\n\n protected globalSettingsSchema() {\n return this.schema({\n sections: [\n {\n id: 'winston-logging',\n title: 'Logging',\n description: 'Global log verbosity + retention for rotated log files on this node.',\n columns: 2,\n fields: [\n this.field({\n type: 'select',\n key: 'level',\n label: 'Log Level',\n default: 'info',\n options: [\n { value: 'debug', label: 'Debug' },\n { value: 'info', label: 'Info' },\n { value: 'warn', label: 'Warn' },\n { value: 'error', label: 'Error' },\n ],\n }),\n this.field({\n type: 'number',\n key: 'retentionDays',\n label: 'Retention (days)',\n description: 'Number of days to keep rotated log files before deletion',\n min: 1,\n max: 365,\n step: 1,\n default: 30,\n unit: 'days',\n }),\n ],\n },\n ],\n })\n }\n}\n","import * as winston from 'winston'\nimport DailyRotateFile from 'winston-daily-rotate-file'\nimport * as path from 'node:path'\nimport type { ILogDestination, LogEntry, LogFilter } from '@camstack/types'\nimport { formatLogLine } from '../../logging/formatter.js'\n\ninterface WinstonConfig {\n readonly level: string\n readonly retentionDays: number\n /** Resolved absolute path to the logs directory (replaces the old dataPath field). */\n readonly logsDir: string\n}\n\n/**\n * Rotated-file log destination. Console output goes through the shared\n * `formatLogLine` so every console sink (Winston, ConsoleDestination,\n * HubForwarderDestination) emits identical lines. File output keeps a\n * structured JSON shape so log tooling can query tags/meta.\n */\nexport class WinstonDestination implements ILogDestination {\n private logger: winston.Logger | null = null\n\n async initialize(config?: WinstonConfig): Promise<void> {\n const {\n level = 'info',\n retentionDays = 30,\n logsDir = path.join('camstack-data', 'logs'),\n } = config ?? {}\n\n // Console: canonical single-line formatter — `_rendered` already\n // carries level-based ANSI colour codes (see `formatLogLine` in\n // `@camstack/core/logging/formatter.ts`). Using Winston's colorize\n // here would just decorate unused `info.level` and leave the\n // rendered line uncoloured.\n const consoleFormat = winston.format.printf((info) => {\n const rendered = (info as unknown as { _rendered?: string })._rendered\n return typeof rendered === 'string' ? rendered : String(info.message)\n })\n\n // File: structured JSON. Strip `_rendered` first — it carries ANSI\n // escape codes intended for the terminal and has no place in a\n // rotated-file store used for ops queries.\n const stripRendered = winston.format((info) => {\n delete (info as Record<string, unknown>)['_rendered']\n return info\n })\n const fileFormat = winston.format.combine(\n winston.format.timestamp(),\n stripRendered(),\n winston.format.json(),\n )\n\n // File-only winston. Stdout is owned by `ConsoleDestination`\n // (the `console-logging` builtin addon) — adding a Winston console\n // transport here would re-render every log line a second time on\n // the hub terminal, which is the historic cause of the duplicate\n // output operators have been seeing. The `consoleFormat` printf\n // above stays wired in so a future opt-in transport can use it\n // without re-deriving the layout.\n void consoleFormat\n this.logger = winston.createLogger({\n level,\n transports: [\n new DailyRotateFile({\n dirname: logsDir,\n filename: 'camstack-%DATE%.log',\n datePattern: 'YYYY-MM-DD',\n maxFiles: `${retentionDays}d`,\n format: fileFormat,\n }),\n ],\n })\n }\n\n write(entry: LogEntry): void {\n if (!this.logger) return\n\n // Moleculer JSON serialization converts Date → string; normalize back\n const ts = entry.timestamp instanceof Date\n ? entry.timestamp.toISOString()\n : String(entry.timestamp)\n // Render once with colours for the console transport; file transport\n // strips `_rendered` via the format chain above so disk stays plain.\n const rendered = formatLogLine(entry, { colorize: true })\n\n this.logger.log({\n level: entry.level,\n message: entry.message,\n _rendered: rendered,\n timestamp: ts,\n scope: entry.scope,\n ...(entry.tags ? { tags: entry.tags } : {}),\n ...(entry.meta ? { meta: entry.meta } : {}),\n })\n }\n\n async query(_filter: LogFilter): Promise<readonly LogEntry[]> {\n // File-based log querying is not implemented; use structured storage for log queries\n return []\n }\n\n async shutdown(): Promise<void> {\n if (!this.logger) return\n\n await new Promise<void>((resolve) => {\n this.logger!.on('finish', resolve)\n this.logger!.end()\n })\n this.logger = null\n }\n}\n","/**\n * Canonical single-line formatter for every `LogEntry` that reaches a\n * console transport — hub-side `WinstonDestination` +\n * `ConsoleDestination`, agent-side `HubForwarderDestination`. One\n * definition so the three paths can't drift.\n *\n * Layout mirrors NestJS `ConsoleLogger` output:\n *\n * [Nest] 54994 - 04/20/2026, 12:45:53 AM LOG [InstanceLoader] TrpcModule dependencies initialized +0ms\n *\n * Mapping for camstack — cluster-aware:\n * - `[Nest]` (brand bracket) → `[<agent>/<addonId>]` so operators see\n * at a glance which node emitted the line\n * (matches the cluster topology)\n * - `54994` (pid) → `process.pid`\n * - `<timestamp>` → `M/D/YYYY, H:MM:SS AM`\n * - `LOG` / `WARN` / `ERROR` → `entry.level` upper-cased, colour per level\n * - `[InstanceLoader]` (ctx) → `[<device>]` — shown only when a device\n * tag is present; omitted otherwise\n * - `<message>` → `entry.message`\n * - trailing `+Nms` → we don't compute timing yet; omitted\n *\n * Rendered examples:\n * [hub/winston-logging] 71184 - 04/20/2026, 12:45:53 AM INFO Winston logging initialized\n * [hub/provider-rtsp] 71184 - 04/20/2026, 12:46:01 AM WARN [salone] probe failed {err=\"timeout\"}\n * [dev-agent-0/detection] 12345 - 04/20/2026, 12:47:15 AM ERROR [cortile] no detector {codec=av1}\n */\nimport type { LogEntry, LogTags } from '@camstack/types'\n\n// Emit ANSI colour codes when the runtime supports them. Heuristic\n// follows npm ecosystem convention so log-consumers can override:\n// - `NO_COLOR` env present → OFF (https://no-color.org/)\n// - `FORCE_COLOR=0` → OFF\n// - `FORCE_COLOR` truthy (1/2/3/true) → ON (forces even when piped)\n// - stdout.isTTY → ON\n// - else → OFF\n// Rationale: running via `concurrently` / `npm run dev` often pipes\n// stdout and strips `isTTY`, making colours disappear. Dev sets\n// `FORCE_COLOR=1` in the shell to opt back in; CI / file-piping\n// pipelines set `NO_COLOR=1` to strip.\n//\n// Destinations that always render for console (ConsoleDestination,\n// HubForwarderDestination) pass `colorize: true` explicitly — still\n// gated by NO_COLOR. File sinks (Winston JSON) pass `colorize: false`\n// so log files stay plain text regardless of the shell environment.\nconst USE_COLOR = (() => {\n try {\n if (typeof process === 'undefined') return false\n const env = process.env ?? {}\n if (env['NO_COLOR']) return false\n const force = env['FORCE_COLOR']\n if (force !== undefined) return force !== '' && force !== '0' && force !== 'false'\n return Boolean((process.stdout as { isTTY?: boolean })?.isTTY)\n } catch { return false }\n})()\n\n/** True when `NO_COLOR` is set — destinations that force colour on still honour this. */\nconst NO_COLOR = (() => {\n try { return Boolean(process?.env?.['NO_COLOR']) } catch { return false }\n})()\n\nconst RESET = '\\x1b[0m'\nconst ANSI = {\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n red: '\\x1b[31m',\n cyan: '\\x1b[36m',\n gray: '\\x1b[90m',\n} as const\n\nconst COLOR_BY_LEVEL: Readonly<Record<string, string>> = {\n debug: ANSI.gray,\n info: ANSI.green,\n warn: ANSI.yellow,\n error: ANSI.red,\n}\n\nfunction paint(color: string, text: string, enabled: boolean): string {\n return enabled ? `${color}${text}${RESET}` : text\n}\n\nfunction colorizeLevel(level: string, text: string, enabled: boolean): string {\n if (!enabled) return text\n const code = COLOR_BY_LEVEL[level]\n return code ? `${code}${text}${RESET}` : text\n}\n\n/** Right-pad `value` to exactly `width` characters. */\nfunction padRight(value: string, width: number): string {\n if (value.length >= width) return value.slice(0, width)\n return value + ' '.repeat(width - value.length)\n}\n\n/** Derive the agent — the top-level cluster node, never the forked-worker suffix. */\nfunction resolveAgent(tags: LogTags | undefined): string | null {\n const agentId = tags?.agentId\n if (typeof agentId === 'string' && agentId.length > 0) return agentId\n const nodeId = tags?.nodeId\n if (typeof nodeId === 'string' && nodeId.length > 0) {\n return nodeId.includes('/') ? nodeId.split('/')[0]! : nodeId\n }\n return null\n}\n\n/** Derive the addon — `tags.addonId` first; `system` when the tag is missing\n * (scope is no longer a fallback — it's a sub-component label, not identity). */\nfunction resolveAddon(entry: Pick<LogEntry, 'tags'>): string {\n const addonId = entry.tags?.addonId\n if (typeof addonId === 'string' && addonId.length > 0) return addonId\n return 'system'\n}\n\n/** Device name (or `#id` fallback) — used inside the context bracket when present. */\nfunction resolveDevice(tags: LogTags | undefined): string | null {\n const name = tags?.deviceName\n if (typeof name === 'string' && name.length > 0) return name\n const id = tags?.deviceId\n if (typeof id === 'number' && Number.isFinite(id)) return `#${id}`\n return null\n}\n\n/**\n * Build the brand bracket content — `<agent>/<addonId>`. Agent is\n * always shown (even `hub`) so operators never have to guess which\n * node emitted a line. Falls back to `?/<addon>` when tags don't\n * carry an agent id (pre-boot logs, test harnesses).\n */\nfunction buildBrand(entry: Pick<LogEntry, 'tags'>): string {\n const agent = resolveAgent(entry.tags) ?? '?'\n const addon = resolveAddon(entry)\n return `${agent}/${addon}`\n}\n\n/**\n * Build the optional device-context bracket. Returns `null` when the\n * line doesn't carry a device tag — renders as just the brand + message\n * without the second bracket. With a device tag: `salone` / `#42`.\n */\nfunction buildDeviceContext(entry: Pick<LogEntry, 'tags'>): string | null {\n return resolveDevice(entry.tags)\n}\n\n/**\n * NestJS-style locale timestamp: `M/D/YYYY, H:MM:SS AM`. Built with\n * `toLocaleString('en-US')` to match the default NestJS format that\n * operators are used to from Nest boot output.\n */\nfunction formatTimestamp(value: unknown): string {\n const date = value instanceof Date ? value : new Date(typeof value === 'string' ? value : Date.now())\n return date.toLocaleString('en-US', {\n month: 'numeric',\n day: 'numeric',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n })\n}\n\n/** Compact `{key=value key=\"with space\"}` rendering of an arbitrary object. Empty → ''. */\nfunction formatMeta(meta: Record<string, unknown> | undefined): string {\n if (!meta) return ''\n const keys = Object.keys(meta)\n if (keys.length === 0) return ''\n const parts: string[] = []\n for (const key of keys) {\n const value = meta[key]\n parts.push(`${key}=${formatMetaValue(value)}`)\n }\n return `{${parts.join(' ')}}`\n}\n\nfunction formatMetaValue(value: unknown): string {\n if (value === null) return 'null'\n if (value === undefined) return 'undefined'\n if (typeof value === 'string') {\n return /\\s|\"/.test(value) ? JSON.stringify(value) : value\n }\n if (typeof value === 'number' || typeof value === 'boolean') return String(value)\n if (value instanceof Error) return JSON.stringify(value.message)\n try { return JSON.stringify(value) } catch { return String(value) }\n}\n\n/** Cached renderer PID — fallback when the entry doesn't carry its own `tags.pid`. */\nconst PID = typeof process !== 'undefined' && typeof process.pid === 'number' ? String(process.pid) : '?'\n\n/** Options for `formatLogLine`. */\nexport interface FormatLogLineOptions {\n /**\n * Emit ANSI colour codes. When omitted, falls back to the shell-env\n * heuristic (`NO_COLOR`/`FORCE_COLOR`/`isTTY`). Destinations that\n * always target a console (ConsoleDestination, HubForwarderDestination)\n * pass `true`; file sinks (Winston JSON) pass `false` so logs on disk\n * stay plain text regardless of the shell env.\n *\n * `NO_COLOR=1` in the environment still wins — consumer opt-in beats\n * producer opt-in, matching the https://no-color.org/ convention.\n */\n readonly colorize?: boolean\n}\n\n/**\n * Render a `LogEntry` as one complete console line — no trailing newline.\n * Caller appends `\\n` (file sinks) or relies on `console.log` (stdout sink).\n *\n * PID column prefers `entry.tags.pid` when set (so forked-worker entries\n * carry the worker's OS pid even when the hub renders them), falling back\n * to the renderer's own `process.pid`.\n *\n * Colours (when enabled) follow the NestJS convention: the level token\n * AND the message body share the level colour (green/yellow/red/gray for\n * info/warn/error/debug). Brand, device context, scope and meta keep\n * their fixed hues so the structural fields stay visually distinct from\n * the message content.\n */\nexport function formatLogLine(entry: LogEntry, options?: FormatLogLineOptions): string {\n const wantsColor = options?.colorize ?? USE_COLOR\n const colorize = wantsColor && !NO_COLOR\n const levelColor = COLOR_BY_LEVEL[entry.level]\n\n const brand = paint(ANSI.green, `[${buildBrand(entry)}]`, colorize)\n const entryPid = entry.tags?.pid\n const pid = typeof entryPid === 'number' ? String(entryPid) : PID\n const timestamp = formatTimestamp(entry.timestamp)\n // Right-pad level to 5 chars (matches NestJS) so the context/message\n // column aligns across different levels without fixed-width hacks\n // on the surrounding fields.\n const level = colorizeLevel(entry.level, padRight(entry.level.toUpperCase(), 5), colorize)\n const device = buildDeviceContext(entry)\n const ctxPart = device ? ' ' + paint(ANSI.yellow, `[${device}]`, colorize) : ''\n const scope = typeof entry.scope === 'string' && entry.scope.length > 0 ? entry.scope : null\n const scopePart = scope ? ' ' + paint(ANSI.cyan, `(${scope})`, colorize) : ''\n const metaText = formatMeta(entry.meta)\n const metaPart = metaText ? ' ' + paint(ANSI.gray, metaText, colorize) : ''\n // NestJS layout: `[<agent>/<addon>] <pid> - <timestamp> <LEVEL> [<device>] (<scope>) <message>`\n // Message body is tinted by level colour so `error`/`warn` stand out at a glance.\n const message = colorize && levelColor\n ? `${levelColor}${entry.message}${RESET}`\n : entry.message\n return `${brand} ${pid} - ${timestamp} ${level}${ctxPart}${scopePart} ${message}${metaPart}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mBAAoD;;;ACDpD,cAAyB;AACzB,uCAA4B;AAC5B,WAAsB;;;AC2CtB,IAAM,aAAa,MAAM;AACvB,MAAI;AACF,QAAI,OAAO,YAAY,YAAa,QAAO;AAC3C,UAAM,MAAM,QAAQ,OAAO,CAAC;AAC5B,QAAI,IAAI,UAAU,EAAG,QAAO;AAC5B,UAAM,QAAQ,IAAI,aAAa;AAC/B,QAAI,UAAU,OAAW,QAAO,UAAU,MAAM,UAAU,OAAO,UAAU;AAC3E,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A,MACjB,UAAU;AAAA,QACR;AAAA,UACE,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,aAAa;AAAA,UACb,SAAS;AAAA,UACT,QAAQ;AAAA,YACN,KAAK,MAAM;AAAA,cACT,MAAM;AAAA,cACN,KAAK;AAAA,cACL,OAAO;AAAA,cACP,SAAS;AAAA,cACT,SAAS;AAAA,gBACP,EAAE,OAAO,SAAS,OAAO,QAAQ;AAAA,gBACjC,EAAE,OAAO,QAAQ,OAAO,OAAO;AAAA,gBAC/B,EAAE,OAAO,QAAQ,OAAO,OAAO;AAAA,gBAC/B,EAAE,OAAO,SAAS,OAAO,QAAQ;AAAA,cACnC;AAAA,YACF,CAAC;AAAA,YACD,KAAK,MAAM;AAAA,cACT,MAAM;AAAA,cACN,KAAK;AAAA,cACL,OAAO;AAAA,cACP,aAAa;AAAA,cACb,KAAK;AAAA,cACL,KAAK;AAAA,cACL,MAAM;AAAA,cACN,SAAS;AAAA,cACT,MAAM;AAAA,YACR,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["DailyRotateFile"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/builtins/winston-logging/winston-destination.ts","../../../src/builtins/winston-logging/winston-logging.addon.ts"],"sourcesContent":["import * as winston from 'winston'\nimport DailyRotateFile from 'winston-daily-rotate-file'\nimport * as path from 'node:path'\nimport type { ILogDestination, LogEntry, LogFilter } from '@camstack/types'\nimport { formatLogLine } from '../../logging/formatter.js'\n\ninterface WinstonConfig {\n readonly level: string\n readonly retentionDays: number\n /** Resolved absolute path to the logs directory (replaces the old dataPath field). */\n readonly logsDir: string\n}\n\n/**\n * Rotated-file log destination. Console output goes through the shared\n * `formatLogLine` so every console sink (Winston, ConsoleDestination,\n * HubForwarderDestination) emits identical lines. File output keeps a\n * structured JSON shape so log tooling can query tags/meta.\n */\nexport class WinstonDestination implements ILogDestination {\n private logger: winston.Logger | null = null\n\n async initialize(config?: WinstonConfig): Promise<void> {\n const {\n level = 'info',\n retentionDays = 30,\n logsDir = path.join('camstack-data', 'logs'),\n } = config ?? {}\n\n // Console: canonical single-line formatter — `_rendered` already\n // carries level-based ANSI colour codes (see `formatLogLine` in\n // `@camstack/core/logging/formatter.ts`). Using Winston's colorize\n // here would just decorate unused `info.level` and leave the\n // rendered line uncoloured.\n const consoleFormat = winston.format.printf((info) => {\n const rendered = (info as unknown as { _rendered?: string })._rendered\n return typeof rendered === 'string' ? rendered : String(info.message)\n })\n\n // File: structured JSON. Strip `_rendered` first — it carries ANSI\n // escape codes intended for the terminal and has no place in a\n // rotated-file store used for ops queries.\n const stripRendered = winston.format((info) => {\n delete (info as Record<string, unknown>)['_rendered']\n return info\n })\n const fileFormat = winston.format.combine(\n winston.format.timestamp(),\n stripRendered(),\n winston.format.json(),\n )\n\n // File-only winston. Stdout is owned by `ConsoleDestination`\n // (the `console-logging` builtin addon) — adding a Winston console\n // transport here would re-render every log line a second time on\n // the hub terminal, which is the historic cause of the duplicate\n // output operators have been seeing. The `consoleFormat` printf\n // above stays wired in so a future opt-in transport can use it\n // without re-deriving the layout.\n void consoleFormat\n this.logger = winston.createLogger({\n level,\n transports: [\n new DailyRotateFile({\n dirname: logsDir,\n filename: 'camstack-%DATE%.log',\n datePattern: 'YYYY-MM-DD',\n maxFiles: `${retentionDays}d`,\n format: fileFormat,\n }),\n ],\n })\n }\n\n write(entry: LogEntry): void {\n if (!this.logger) return\n\n // Moleculer JSON serialization converts Date → string; normalize back\n const ts = entry.timestamp instanceof Date\n ? entry.timestamp.toISOString()\n : String(entry.timestamp)\n // Render once with colours for the console transport; file transport\n // strips `_rendered` via the format chain above so disk stays plain.\n const rendered = formatLogLine(entry, { colorize: true })\n\n this.logger.log({\n level: entry.level,\n message: entry.message,\n _rendered: rendered,\n timestamp: ts,\n scope: entry.scope,\n ...(entry.tags ? { tags: entry.tags } : {}),\n ...(entry.meta ? { meta: entry.meta } : {}),\n })\n }\n\n async query(_filter: LogFilter): Promise<readonly LogEntry[]> {\n // File-based log querying is not implemented; use structured storage for log queries\n return []\n }\n\n async shutdown(): Promise<void> {\n if (!this.logger) return\n\n await new Promise<void>((resolve) => {\n this.logger!.on('finish', resolve)\n this.logger!.end()\n })\n this.logger = null\n }\n}\n","import type { ProviderRegistration } from '@camstack/types'\nimport { BaseAddon, logDestinationCapability } from '@camstack/types'\nimport { WinstonDestination } from './winston-destination.js'\n\ninterface WinstonConfig {\n readonly level: string\n readonly retentionDays: number\n}\n\n/**\n * Winston logging addon — rotated log files + console output.\n * Settings appear under Cluster → NodeDetail → Settings.\n */\nexport class WinstonLoggingAddon extends BaseAddon<WinstonConfig> {\n private destination: WinstonDestination | null = null\n\n constructor() {\n super({ level: 'info', retentionDays: 30 })\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const logsDir = await this.ctx.api.storage.resolve.query({ location: 'logs', relativePath: '' })\n .catch(() => 'camstack-data/logs')\n this.destination = new WinstonDestination()\n await this.destination.initialize({ ...this.config, logsDir })\n this.ctx.logger.info('Winston logging initialized')\n return [{ capability: logDestinationCapability, provider: this.destination }]\n }\n\n protected async onShutdown(): Promise<void> {\n await this.destination?.shutdown()\n }\n\n getDestination(): WinstonDestination {\n if (!this.destination) throw new Error('Winston not initialized')\n return this.destination\n }\n\n protected globalSettingsSchema() {\n return this.schema({\n sections: [\n {\n id: 'winston-logging',\n title: 'Logging',\n description: 'Global log verbosity + retention for rotated log files on this node.',\n columns: 2,\n fields: [\n this.field({\n type: 'select',\n key: 'level',\n label: 'Log Level',\n default: 'info',\n options: [\n { value: 'debug', label: 'Debug' },\n { value: 'info', label: 'Info' },\n { value: 'warn', label: 'Warn' },\n { value: 'error', label: 'Error' },\n ],\n }),\n this.field({\n type: 'number',\n key: 'retentionDays',\n label: 'Retention (days)',\n description: 'Number of days to keep rotated log files before deletion',\n min: 1,\n max: 365,\n step: 1,\n default: 30,\n unit: 'days',\n }),\n ],\n },\n ],\n })\n }\n}\n"],"mappings":";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