camera.ui3 0.0.30-alpha.0 → 0.0.30-alpha.3

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 (390) hide show
  1. package/dist/interface/@camera.ui.DuwfK59t.0.0.30-alpha.3.js +3 -0
  2. package/dist/interface/@tanstack.DBBaUHTS.0.0.30-alpha.3.js +1 -0
  3. package/dist/interface/{@vee-validate.0Cv0x9aN.0.0.30-alpha.0.js → @vee-validate.BRR3_tWq.0.0.30-alpha.3.js} +1 -1
  4. package/dist/interface/@vue.BeJw0wEm.0.0.30-alpha.3.js +17 -0
  5. package/dist/interface/{@vueform.Du_niMHk.0.0.30-alpha.0.js → @vueform.Dcx-RQUw.0.0.30-alpha.3.js} +1 -1
  6. package/dist/interface/{@vueuse.Dv9U068T.0.0.30-alpha.0.js → @vueuse.Sz46sDez.0.0.30-alpha.3.js} +1 -1
  7. package/dist/interface/Account.hmetZWTc.0.0.30-alpha.3.js +1 -0
  8. package/dist/interface/Adminpanel.DxC80W0K.0.0.30-alpha.3.js +2 -0
  9. package/dist/interface/Appearance.BHZdWQlZ.0.0.30-alpha.3.js +1 -0
  10. package/dist/interface/Backup.petPSq60.0.0.30-alpha.3.js +1 -0
  11. package/dist/interface/Camera.DS7gbgwV.0.0.30-alpha.3.js +1 -0
  12. package/dist/interface/Cameras.eqceAkdR.0.0.30-alpha.3.js +1 -0
  13. package/dist/interface/Camview.DumV6nmv.0.0.30-alpha.3.js +1 -0
  14. package/dist/interface/Config.DQ5vyHcx.0.0.30-alpha.3.js +1 -0
  15. package/dist/interface/Console.CWp-LL5w.0.0.30-alpha.3.js +4 -0
  16. package/dist/interface/FirstSteps.DR2B1Gmx.0.0.30-alpha.3.js +1 -0
  17. package/dist/interface/{NewCamera.Kn9biZIb.0.0.30-alpha.0.js → NewCamera.CpENkWIP.0.0.30-alpha.3.js} +2 -2
  18. package/dist/interface/Plugin.KK2gWYUL.0.0.30-alpha.3.js +1 -0
  19. package/dist/interface/Plugins.Dy1rL-Pc.0.0.30-alpha.3.js +1 -0
  20. package/dist/interface/Recordings.Bny11D38.0.0.30-alpha.3.js +1 -0
  21. package/dist/interface/Recordings.IdGxswmI.0.0.30-alpha.3.js +1 -0
  22. package/dist/interface/Settings.D6l7BlOF.0.0.30-alpha.3.js +1 -0
  23. package/dist/interface/System.FIkCpF0A.0.0.30-alpha.3.js +4 -0
  24. package/dist/interface/User.By9sAd8k.0.0.30-alpha.3.js +1 -0
  25. package/dist/interface/VConfigEditor.vue_vue_type_script_setup_true_lang.C7ZcC7dX.0.0.30-alpha.3.js +2 -0
  26. package/dist/interface/{VConsole.BT0UxZb1.0.0.30-alpha.0.js → VConsole.BG4nEIk8.0.0.30-alpha.3.js} +1 -1
  27. package/dist/interface/VPlayer.CZqXCM-i.0.0.30-alpha.3.js +1 -0
  28. package/dist/interface/{VPluginCard.Bz3GmzAE.0.0.30-alpha.0.js → VPluginCard.B_M3puzM.0.0.30-alpha.3.js} +2 -2
  29. package/dist/interface/{ace-builds.SRW0xGs1.0.0.30-alpha.0.js → ace-builds.D4S-MJ6b.0.0.30-alpha.3.js} +1 -1
  30. package/dist/interface/{apexcharts.BV8prH5x.0.0.30-alpha.0.js → apexcharts.u0duws01.0.0.30-alpha.3.js} +1 -1
  31. package/dist/interface/{dnd-core.BdsXoke-.0.0.30-alpha.0.js → dnd-core.C4232Xyz.0.0.30-alpha.3.js} +1 -1
  32. package/dist/interface/{draggabilly.D9j4BYFu.0.0.30-alpha.0.js → draggabilly.Xgwn1bT3.0.0.30-alpha.3.js} +1 -1
  33. package/dist/interface/{engine.io-client.di4Pt8W8.0.0.30-alpha.0.js → engine.io-client.CUastNh3.0.0.30-alpha.3.js} +1 -1
  34. package/dist/interface/{ev-emitter.Dxl4QoSg.0.0.30-alpha.0.js → ev-emitter.BYRnnQXb.0.0.30-alpha.3.js} +1 -1
  35. package/dist/interface/{fast-deep-equal.BUna8KlC.0.0.30-alpha.0.js → fast-deep-equal.CqwdqDxW.0.0.30-alpha.3.js} +1 -1
  36. package/dist/interface/{highlight.js.CMosnU3p.0.0.30-alpha.0.js → highlight.js.sNLmnsuC.0.0.30-alpha.3.js} +1 -1
  37. package/dist/interface/index.html +34 -33
  38. package/dist/interface/{linkify-it.B9RFwlcp.0.0.30-alpha.0.js → linkify-it.8PrPWg7W.0.0.30-alpha.3.js} +1 -1
  39. package/dist/interface/main.gxLiydtV.0.0.30-alpha.3.js +2 -0
  40. package/dist/interface/{markdown-it.DAiultxC.0.0.30-alpha.0.js → markdown-it.Q4_2MGLy.0.0.30-alpha.3.js} +1 -1
  41. package/dist/interface/{nprogress.C2KbBHcZ.0.0.30-alpha.0.js → nprogress.DQYtKLt9.0.0.30-alpha.3.js} +1 -1
  42. package/dist/interface/{pinia.DRjp4GU7.0.0.30-alpha.0.js → pinia.DcgsdRJU.0.0.30-alpha.3.js} +2 -2
  43. package/dist/interface/{plugins.Ur_7V4x8.0.0.30-alpha.0.js → plugins.DZjXmoDp.0.0.30-alpha.3.js} +1 -1
  44. package/dist/interface/{qrcode.DrYVb5am.0.0.30-alpha.0.js → qrcode.XqSuoGPb.0.0.30-alpha.3.js} +1 -1
  45. package/dist/interface/{react-dnd-touch-backend.ByHGbrKq.0.0.30-alpha.0.js → react-dnd-touch-backend.VzlzWkdX.0.0.30-alpha.3.js} +1 -1
  46. package/dist/interface/{rxjs.Dl5P76vZ.0.0.30-alpha.0.js → rxjs.CXnJywSk.0.0.30-alpha.3.js} +1 -1
  47. package/dist/interface/{socket.io-client.Cf7ABgrO.0.0.30-alpha.0.js → socket.io-client.DiiooL5k.0.0.30-alpha.3.js} +1 -1
  48. package/dist/interface/{socket.io-parser.DHnwqfTj.0.0.30-alpha.0.js → socket.io-parser.Dsh2ZviN.0.0.30-alpha.3.js} +1 -1
  49. package/dist/interface/sw.js +1 -1
  50. package/dist/interface/{system.CRn9Cy3C.0.0.30-alpha.0.js → system.Bh4wNIkr.0.0.30-alpha.3.js} +1 -1
  51. package/dist/interface/{ui.C-XbEPHk.0.0.30-alpha.0.js → ui.B0YwbqBU.0.0.30-alpha.3.js} +1 -1
  52. package/dist/interface/{unidragger.zHlf1Df_.0.0.30-alpha.0.js → unidragger.DDL70rPA.0.0.30-alpha.3.js} +1 -1
  53. package/dist/interface/utils.mAKpSMLY.0.0.30-alpha.3.js +1 -0
  54. package/dist/interface/{v-calendar.CapJoEkJ.0.0.30-alpha.0.js → v-calendar.C8Yj7x1Q.0.0.30-alpha.3.js} +1 -1
  55. package/dist/interface/{vee-validate.DcgOEpak.0.0.30-alpha.0.js → vee-validate.BbcoErf-.0.0.30-alpha.3.js} +2 -2
  56. package/dist/interface/{vue-i18n.D2pqkMP3.0.0.30-alpha.0.js → vue-i18n.B7m8y9GA.0.0.30-alpha.3.js} +2 -2
  57. package/dist/interface/{vue-inline-svg.DorOTPIf.0.0.30-alpha.0.js → vue-inline-svg.DC2U7Qim.0.0.30-alpha.3.js} +1 -1
  58. package/dist/interface/{vue-router.BVs4qaVs.0.0.30-alpha.0.js → vue-router.B3QeItm5.0.0.30-alpha.3.js} +2 -2
  59. package/dist/interface/{vue3-apexcharts.CBV9x5vk.0.0.30-alpha.0.js → vue3-apexcharts.DVzl7xGy.0.0.30-alpha.3.js} +1 -1
  60. package/dist/interface/{vue3-dnd.CXMddGIZ.0.0.30-alpha.0.js → vue3-dnd.76cFMD9V.0.0.30-alpha.3.js} +1 -1
  61. package/dist/interface/{vue3-toastify.DE7YmDSX.0.0.30-alpha.0.js → vue3-toastify.B-AJ7WuP.0.0.30-alpha.3.js} +1 -1
  62. package/dist/interface/{vuetify.CYxxHEVN.0.0.30-alpha.0.js → vuetify.CYln2r6g.0.0.30-alpha.3.js} +1 -1
  63. package/dist/interface/zod.DnW1_kUe.0.0.30-alpha.3.js +1 -0
  64. package/dist/server/bin/cameraui.js +10 -7
  65. package/dist/server/bin/cameraui.js.map +1 -1
  66. package/dist/server/bin/fork.js +2 -2
  67. package/dist/server/bin/fork.js.map +1 -1
  68. package/dist/server/bin/installer/darwin.js +1 -1
  69. package/dist/server/bin/installer/darwin.js.map +1 -1
  70. package/dist/server/bin/installer/linux.js +1 -1
  71. package/dist/server/bin/installer/linux.js.map +1 -1
  72. package/dist/server/package.json +11 -15
  73. package/dist/server/src/api/controllers/backup.controller.js.map +1 -1
  74. package/dist/server/src/api/controllers/cameras.controller.js +1 -1
  75. package/dist/server/src/api/controllers/cameras.controller.js.map +1 -1
  76. package/dist/server/src/api/controllers/frameWorkers.controller.js +1 -1
  77. package/dist/server/src/api/controllers/frameWorkers.controller.js.map +1 -1
  78. package/dist/server/src/api/controllers/plugins.controller.js +1 -2
  79. package/dist/server/src/api/controllers/plugins.controller.js.map +1 -1
  80. package/dist/server/src/api/controllers/system.controller.js +1 -3
  81. package/dist/server/src/api/controllers/system.controller.js.map +1 -1
  82. package/dist/server/src/api/controllers/users.controller.js +2 -2
  83. package/dist/server/src/api/controllers/users.controller.js.map +1 -1
  84. package/dist/server/src/api/database/constants.d.ts +8 -0
  85. package/dist/server/src/api/database/constants.js +9 -0
  86. package/dist/server/src/api/database/constants.js.map +1 -0
  87. package/dist/server/src/api/database/index.d.ts +0 -8
  88. package/dist/server/src/api/database/index.js +14 -21
  89. package/dist/server/src/api/database/index.js.map +1 -1
  90. package/dist/server/src/api/database/migration.js +5 -4
  91. package/dist/server/src/api/database/migration.js.map +1 -1
  92. package/dist/server/src/api/database/types.d.ts +6 -6
  93. package/dist/server/src/api/go2rtc/api/application.js +1 -1
  94. package/dist/server/src/api/go2rtc/api/application.js.map +1 -1
  95. package/dist/server/src/api/index.js.map +1 -1
  96. package/dist/server/src/api/plugins/logger.plugin.js.map +1 -1
  97. package/dist/server/src/api/schemas/cameras.schema.d.ts +71 -71
  98. package/dist/server/src/api/schemas/config.schema.d.ts +6 -6
  99. package/dist/server/src/api/schemas/go2rtc.schema.d.ts +98 -98
  100. package/dist/server/src/api/schemas/users.schema.d.ts +116 -116
  101. package/dist/server/src/api/services/auth.service.js +1 -1
  102. package/dist/server/src/api/services/auth.service.js.map +1 -1
  103. package/dist/server/src/api/services/backup.service.js.map +1 -1
  104. package/dist/server/src/api/services/cameras.service.js +1 -1
  105. package/dist/server/src/api/services/cameras.service.js.map +1 -1
  106. package/dist/server/src/api/services/system.service.js +1 -1
  107. package/dist/server/src/api/services/system.service.js.map +1 -1
  108. package/dist/server/src/api/services/users.service.js +1 -1
  109. package/dist/server/src/api/services/users.service.js.map +1 -1
  110. package/dist/server/src/api/types/index.d.ts +2 -2
  111. package/dist/server/src/api/types/index.js.map +1 -1
  112. package/dist/server/src/api/utils/cert.js.map +1 -1
  113. package/dist/server/src/api/websocket/index.js.map +1 -1
  114. package/dist/server/src/api/websocket/nsp/notifications.js.map +1 -1
  115. package/dist/server/src/api/websocket/nsp/server.js +1 -1
  116. package/dist/server/src/api/websocket/nsp/server.js.map +1 -1
  117. package/dist/server/src/api.d.ts +1 -7
  118. package/dist/server/src/api.js.map +1 -1
  119. package/dist/server/src/camera/controller.d.ts +4 -6
  120. package/dist/server/src/camera/controller.js +5 -8
  121. package/dist/server/src/camera/controller.js.map +1 -1
  122. package/dist/server/src/camera/types.d.ts +140 -13
  123. package/dist/server/src/camera/types.js.map +1 -1
  124. package/dist/server/src/decoder/index.js.map +1 -1
  125. package/dist/server/src/decoder/types.d.ts +1 -18
  126. package/dist/server/src/decoder/worker.d.ts +3 -2
  127. package/dist/server/src/decoder/worker.js +10 -22
  128. package/dist/server/src/decoder/worker.js.map +1 -1
  129. package/dist/server/src/go2rtc/index.js +2 -3
  130. package/dist/server/src/go2rtc/index.js.map +1 -1
  131. package/dist/server/src/main.js +3 -3
  132. package/dist/server/src/main.js.map +1 -1
  133. package/dist/server/src/nats/index.d.ts +3 -4
  134. package/dist/server/src/nats/index.js +1 -3
  135. package/dist/server/src/nats/index.js.map +1 -1
  136. package/dist/server/src/nats/proxy/cameraDevice.d.ts +2 -2
  137. package/dist/server/src/nats/proxy/coreManager.d.ts +4 -2
  138. package/dist/server/src/nats/proxy/coreManager.js +7 -0
  139. package/dist/server/src/nats/proxy/coreManager.js.map +1 -1
  140. package/dist/server/src/nats/proxy/deviceManager.d.ts +5 -5
  141. package/dist/server/src/nats/proxy/deviceManager.js +4 -2
  142. package/dist/server/src/nats/proxy/deviceManager.js.map +1 -1
  143. package/dist/server/src/nats/server.js +2 -3
  144. package/dist/server/src/nats/server.js.map +1 -1
  145. package/dist/server/src/nats/types.d.ts +19 -32
  146. package/dist/server/src/nats/utils.d.ts +1 -1
  147. package/dist/server/src/nats/websocket.js.map +1 -1
  148. package/dist/server/src/plugins/index.js +11 -9
  149. package/dist/server/src/plugins/index.js.map +1 -1
  150. package/dist/server/src/plugins/interfaces/base.d.ts +1 -1
  151. package/dist/server/src/plugins/plugin.d.ts +1 -1
  152. package/dist/server/src/plugins/plugin.js +4 -4
  153. package/dist/server/src/plugins/plugin.js.map +1 -1
  154. package/dist/server/src/plugins/types.d.ts +36 -3
  155. package/dist/server/src/plugins/types.js.map +1 -1
  156. package/dist/server/src/plugins/worker.js +7 -16
  157. package/dist/server/src/plugins/worker.js.map +1 -1
  158. package/dist/server/src/services/config/constants.js +2 -2
  159. package/dist/server/src/services/config/constants.js.map +1 -1
  160. package/dist/server/src/services/config/index.d.ts +2 -0
  161. package/dist/server/src/services/config/index.js +10 -2
  162. package/dist/server/src/services/config/index.js.map +1 -1
  163. package/dist/server/src/services/logger/index.d.ts +4 -16
  164. package/dist/server/src/services/logger/index.js +4 -83
  165. package/dist/server/src/services/logger/index.js.map +1 -1
  166. package/dist/server/src/services/logger/types.d.ts +8 -0
  167. package/dist/server/src/services/logger/types.js +2 -0
  168. package/dist/server/src/services/logger/types.js.map +1 -0
  169. package/localdeps.txt +4 -0
  170. package/package.json +11 -15
  171. package/dist/interface/@tanstack.DYQ7Jj8U.0.0.30-alpha.0.js +0 -1
  172. package/dist/interface/@vue.CvjRlaU6.0.0.30-alpha.0.js +0 -17
  173. package/dist/interface/Account.Dm2FouAU.0.0.30-alpha.0.js +0 -1
  174. package/dist/interface/Adminpanel.B2Aiobnt.0.0.30-alpha.0.js +0 -2
  175. package/dist/interface/Appearance.EfH0tMdM.0.0.30-alpha.0.js +0 -1
  176. package/dist/interface/Backup.D8SRclhB.0.0.30-alpha.0.js +0 -1
  177. package/dist/interface/Camera.D-cOf4sS.0.0.30-alpha.0.js +0 -1
  178. package/dist/interface/Cameras.oolxbmXU.0.0.30-alpha.0.js +0 -1
  179. package/dist/interface/Camview.BHw8Pe3v.0.0.30-alpha.0.js +0 -1
  180. package/dist/interface/Config.DmPTI5iz.0.0.30-alpha.0.js +0 -1
  181. package/dist/interface/Console.Dq4khHFF.0.0.30-alpha.0.js +0 -4
  182. package/dist/interface/FirstSteps.Bo467abx.0.0.30-alpha.0.js +0 -1
  183. package/dist/interface/Plugin.BLTVcTt1.0.0.30-alpha.0.js +0 -1
  184. package/dist/interface/Plugins.Cp8mK__o.0.0.30-alpha.0.js +0 -1
  185. package/dist/interface/Recordings.B_JIFk_G.0.0.30-alpha.0.js +0 -1
  186. package/dist/interface/Recordings.gMbvwmk_.0.0.30-alpha.0.js +0 -1
  187. package/dist/interface/Settings.EhHJjGrl.0.0.30-alpha.0.js +0 -1
  188. package/dist/interface/System.VodoK0U6.0.0.30-alpha.0.js +0 -4
  189. package/dist/interface/User.DpcN7DEC.0.0.30-alpha.0.js +0 -1
  190. package/dist/interface/VConfigEditor.vue_vue_type_script_setup_true_lang.Br68bfQJ.0.0.30-alpha.0.js +0 -2
  191. package/dist/interface/VPlayer.DYua3Eh_.0.0.30-alpha.0.js +0 -1
  192. package/dist/interface/main.19pRAqPU.0.0.30-alpha.0.js +0 -4
  193. package/dist/interface/utils.BvINh1mj.0.0.30-alpha.0.js +0 -1
  194. package/dist/interface/zod.BaF2dDCd.0.0.30-alpha.0.js +0 -1
  195. package/dist/server/src/camera/device.d.ts +0 -29
  196. package/dist/server/src/camera/device.js +0 -20
  197. package/dist/server/src/camera/device.js.map +0 -1
  198. package/dist/server/src/camera/index.d.ts +0 -90
  199. package/dist/server/src/camera/index.js +0 -581
  200. package/dist/server/src/camera/index.js.map +0 -1
  201. package/dist/server/src/camera/interfaces/camera.d.ts +0 -10
  202. package/dist/server/src/camera/interfaces/camera.js +0 -23
  203. package/dist/server/src/camera/interfaces/camera.js.map +0 -1
  204. package/dist/server/src/camera/interfaces/prebuffer.d.ts +0 -11
  205. package/dist/server/src/camera/interfaces/prebuffer.js +0 -31
  206. package/dist/server/src/camera/interfaces/prebuffer.js.map +0 -1
  207. package/dist/server/src/camera/interfaces/ptz.d.ts +0 -13
  208. package/dist/server/src/camera/interfaces/ptz.js +0 -47
  209. package/dist/server/src/camera/interfaces/ptz.js.map +0 -1
  210. package/dist/server/src/camera/iou.d.ts +0 -2
  211. package/dist/server/src/camera/iou.js +0 -53
  212. package/dist/server/src/camera/iou.js.map +0 -1
  213. package/dist/server/src/camera/polygon.d.ts +0 -6
  214. package/dist/server/src/camera/polygon.js +0 -151
  215. package/dist/server/src/camera/polygon.js.map +0 -1
  216. package/dist/server/src/camera/streaming/peer-connection.d.ts +0 -55
  217. package/dist/server/src/camera/streaming/peer-connection.js +0 -203
  218. package/dist/server/src/camera/streaming/peer-connection.js.map +0 -1
  219. package/dist/server/src/camera/streaming/webrtc-connection.d.ts +0 -35
  220. package/dist/server/src/camera/streaming/webrtc-connection.js +0 -170
  221. package/dist/server/src/camera/streaming/webrtc-connection.js.map +0 -1
  222. package/dist/server/src/camera/streaming/werift-session.d.ts +0 -41
  223. package/dist/server/src/camera/streaming/werift-session.js +0 -179
  224. package/dist/server/src/camera/streaming/werift-session.js.map +0 -1
  225. package/dist/server/src/camera/videoFrame.d.ts +0 -24
  226. package/dist/server/src/camera/videoFrame.js +0 -104
  227. package/dist/server/src/camera/videoFrame.js.map +0 -1
  228. package/dist/server/src/index.d.ts +0 -18
  229. package/dist/server/src/index.js +0 -5
  230. package/dist/server/src/index.js.map +0 -1
  231. package/dist/server/src/nats/connection.d.ts +0 -17
  232. package/dist/server/src/nats/connection.js +0 -66
  233. package/dist/server/src/nats/connection.js.map +0 -1
  234. package/dist/server/src/nats/constants.d.ts +0 -1
  235. package/dist/server/src/nats/constants.js +0 -2
  236. package/dist/server/src/nats/constants.js.map +0 -1
  237. package/dist/server/src/nats/error.d.ts +0 -9
  238. package/dist/server/src/nats/error.js +0 -11
  239. package/dist/server/src/nats/error.js.map +0 -1
  240. package/dist/server/src/nats/messageQueue.d.ts +0 -20
  241. package/dist/server/src/nats/messageQueue.js +0 -132
  242. package/dist/server/src/nats/messageQueue.js.map +0 -1
  243. package/dist/server/src/nats/subscription.d.ts +0 -12
  244. package/dist/server/src/nats/subscription.js +0 -21
  245. package/dist/server/src/nats/subscription.js.map +0 -1
  246. package/dist/server/src/polyglot/node/decoder/child.d.ts +0 -1
  247. package/dist/server/src/polyglot/node/decoder/child.js +0 -644
  248. package/dist/server/src/polyglot/node/decoder/child.js.map +0 -1
  249. package/dist/server/src/polyglot/node/decoder/imageUtils.d.ts +0 -24
  250. package/dist/server/src/polyglot/node/decoder/imageUtils.js +0 -205
  251. package/dist/server/src/polyglot/node/decoder/imageUtils.js.map +0 -1
  252. package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.d.ts +0 -144
  253. package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.js +0 -65
  254. package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.wasm +0 -0
  255. package/dist/server/src/polyglot/node/decoder/wasm/test/imageUtils.py +0 -106
  256. package/dist/server/src/polyglot/node/plugins/cameraStorage.d.ts +0 -107
  257. package/dist/server/src/polyglot/node/plugins/cameraStorage.js +0 -292
  258. package/dist/server/src/polyglot/node/plugins/cameraStorage.js.map +0 -1
  259. package/dist/server/src/polyglot/node/plugins/child.d.ts +0 -28
  260. package/dist/server/src/polyglot/node/plugins/child.js +0 -222
  261. package/dist/server/src/polyglot/node/plugins/child.js.map +0 -1
  262. package/dist/server/src/polyglot/node/plugins/configService.d.ts +0 -104
  263. package/dist/server/src/polyglot/node/plugins/configService.js +0 -213
  264. package/dist/server/src/polyglot/node/plugins/configService.js.map +0 -1
  265. package/dist/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -35
  266. package/dist/server/src/polyglot/node/plugins/pluginApi.js +0 -23
  267. package/dist/server/src/polyglot/node/plugins/pluginApi.js.map +0 -1
  268. package/dist/server/src/polyglot/node/plugins/pluginLogger.d.ts +0 -18
  269. package/dist/server/src/polyglot/node/plugins/pluginLogger.js +0 -89
  270. package/dist/server/src/polyglot/node/plugins/pluginLogger.js.map +0 -1
  271. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +0 -69
  272. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js +0 -423
  273. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js.map +0 -1
  274. package/dist/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +0 -40
  275. package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js +0 -105
  276. package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js.map +0 -1
  277. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +0 -47
  278. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js +0 -164
  279. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js.map +0 -1
  280. package/dist/server/src/polyglot/node/plugins/schema.d.ts +0 -293
  281. package/dist/server/src/polyglot/node/plugins/schema.js +0 -740
  282. package/dist/server/src/polyglot/node/plugins/schema.js.map +0 -1
  283. package/dist/server/src/polyglot/node/plugins/storageController.d.ts +0 -30
  284. package/dist/server/src/polyglot/node/plugins/storageController.js +0 -40
  285. package/dist/server/src/polyglot/node/plugins/storageController.js.map +0 -1
  286. package/dist/server/src/polyglot/python/camera/interfaces/camera.py +0 -20
  287. package/dist/server/src/polyglot/python/camera/interfaces/prebuffer.py +0 -28
  288. package/dist/server/src/polyglot/python/camera/interfaces/ptz.py +0 -38
  289. package/dist/server/src/polyglot/python/camera/iou.py +0 -80
  290. package/dist/server/src/polyglot/python/camera/polygon.py +0 -173
  291. package/dist/server/src/polyglot/python/camera/video_frame.py +0 -188
  292. package/dist/server/src/polyglot/python/camera_ui_types/__init__.py +0 -1200
  293. package/dist/server/src/polyglot/python/decoder/child.py +0 -882
  294. package/dist/server/src/polyglot/python/decoder/image_utils.py +0 -149
  295. package/dist/server/src/polyglot/python/decoder/typings.py +0 -99
  296. package/dist/server/src/polyglot/python/plugins/camera_storage.py +0 -391
  297. package/dist/server/src/polyglot/python/plugins/child.py +0 -394
  298. package/dist/server/src/polyglot/python/plugins/config_service.py +0 -187
  299. package/dist/server/src/polyglot/python/plugins/constants.py +0 -1
  300. package/dist/server/src/polyglot/python/plugins/message_queue.py +0 -182
  301. package/dist/server/src/polyglot/python/plugins/plugin_api.py +0 -34
  302. package/dist/server/src/polyglot/python/plugins/plugin_logger.py +0 -111
  303. package/dist/server/src/polyglot/python/plugins/proxy/camera_device.py +0 -1599
  304. package/dist/server/src/polyglot/python/plugins/proxy/core_manager.py +0 -145
  305. package/dist/server/src/polyglot/python/plugins/proxy/device_manager.py +0 -226
  306. package/dist/server/src/polyglot/python/plugins/schema.py +0 -181
  307. package/dist/server/src/polyglot/python/plugins/storage_controller.py +0 -58
  308. package/dist/server/src/polyglot/python/plugins/typings.py +0 -253
  309. package/dist/server/src/polyglot/python/utilities/connection.py +0 -86
  310. package/dist/server/src/polyglot/python/utilities/json_lmdb.py +0 -19
  311. package/dist/server/src/polyglot/python/utilities/object_path.py +0 -195
  312. package/dist/server/src/polyglot/python/utilities/packer.py +0 -11
  313. package/dist/server/src/polyglot/python/utilities/subscriptions.py +0 -22
  314. package/dist/server/src/polyglot/python/utilities/task.py +0 -35
  315. package/dist/server/src/polyglot/python/utilities/thread.py +0 -10
  316. package/dist/server/src/polyglot/python/utilities/utils.py +0 -73
  317. package/dist/server/src/utils/ffmpeg.d.ts +0 -2
  318. package/dist/server/src/utils/ffmpeg.js +0 -61
  319. package/dist/server/src/utils/ffmpeg.js.map +0 -1
  320. package/dist/server/src/utils/network.d.ts +0 -12
  321. package/dist/server/src/utils/network.js +0 -92
  322. package/dist/server/src/utils/network.js.map +0 -1
  323. package/dist/server/src/utils/npm.d.ts +0 -4
  324. package/dist/server/src/utils/npm.js +0 -128
  325. package/dist/server/src/utils/npm.js.map +0 -1
  326. package/dist/server/src/utils/packer.d.ts +0 -2
  327. package/dist/server/src/utils/packer.js +0 -17
  328. package/dist/server/src/utils/packer.js.map +0 -1
  329. package/dist/server/src/utils/pythonInstaller.d.ts +0 -48
  330. package/dist/server/src/utils/pythonInstaller.js +0 -494
  331. package/dist/server/src/utils/pythonInstaller.js.map +0 -1
  332. package/dist/server/src/utils/reader.d.ts +0 -5
  333. package/dist/server/src/utils/reader.js +0 -41
  334. package/dist/server/src/utils/reader.js.map +0 -1
  335. package/dist/server/src/utils/subscribed.d.ts +0 -9
  336. package/dist/server/src/utils/subscribed.js +0 -17
  337. package/dist/server/src/utils/subscribed.js.map +0 -1
  338. package/dist/server/src/utils/utils.d.ts +0 -10
  339. package/dist/server/src/utils/utils.js +0 -165
  340. package/dist/server/src/utils/utils.js.map +0 -1
  341. /package/dist/interface/{@babel.l0sNRNKZ.0.0.30-alpha.0.js → @babel.l0sNRNKZ.0.0.30-alpha.3.js} +0 -0
  342. /package/dist/interface/{@intlify.YW_pt133.0.0.30-alpha.0.js → @intlify.YW_pt133.0.0.30-alpha.3.js} +0 -0
  343. /package/dist/interface/{@mdi.DnMbZhUH.0.0.30-alpha.0.js → @mdi.DnMbZhUH.0.0.30-alpha.3.js} +0 -0
  344. /package/dist/interface/{@popperjs.BQBsAJpH.0.0.30-alpha.0.js → @popperjs.BQBsAJpH.0.0.30-alpha.3.js} +0 -0
  345. /package/dist/interface/{@react-dnd.CcwRs9xb.0.0.30-alpha.0.js → @react-dnd.CcwRs9xb.0.0.30-alpha.3.js} +0 -0
  346. /package/dist/interface/{@socket.io.Dkula2eQ.0.0.30-alpha.0.js → @socket.io.Dkula2eQ.0.0.30-alpha.3.js} +0 -0
  347. /package/dist/interface/{@xterm.CnserxUX.0.0.30-alpha.0.js → @xterm.-WsTvn6n.0.0.30-alpha.3.js} +0 -0
  348. /package/dist/interface/assets/{@vueform.0.0.30-alpha.0.h7tNX9p6.css → @vueform.0.0.30-alpha.3.h7tNX9p6.css} +0 -0
  349. /package/dist/interface/assets/{@xterm.0.0.30-alpha.0.CGrrDQr5.css → @xterm.0.0.30-alpha.3.CGrrDQr5.css} +0 -0
  350. /package/dist/interface/assets/{Account.0.0.30-alpha.0.Ce3OmKrC.css → Account.0.0.30-alpha.3.Ce3OmKrC.css} +0 -0
  351. /package/dist/interface/assets/{Adminpanel.0.0.30-alpha.0.CXsTAXPL.css → Adminpanel.0.0.30-alpha.3.CXsTAXPL.css} +0 -0
  352. /package/dist/interface/assets/{Backup.0.0.30-alpha.0.BIwaSlv3.css → Backup.0.0.30-alpha.3.BIwaSlv3.css} +0 -0
  353. /package/dist/interface/assets/{Camera.0.0.30-alpha.0.BDtUJ-lA.css → Camera.0.0.30-alpha.3.BDtUJ-lA.css} +0 -0
  354. /package/dist/interface/assets/{Cameras.0.0.30-alpha.0.Djx0F2MM.css → Cameras.0.0.30-alpha.3.Djx0F2MM.css} +0 -0
  355. /package/dist/interface/assets/{Camview.0.0.30-alpha.0.Ce_V-Nxj.css → Camview.0.0.30-alpha.3.Ce_V-Nxj.css} +0 -0
  356. /package/dist/interface/assets/{Config.0.0.30-alpha.0.k4QpWumg.css → Config.0.0.30-alpha.3.k4QpWumg.css} +0 -0
  357. /package/dist/interface/assets/{Console.0.0.30-alpha.0.DWrfRWs9.css → Console.0.0.30-alpha.3.DWrfRWs9.css} +0 -0
  358. /package/dist/interface/assets/{FirstSteps.0.0.30-alpha.0.B3-pv8-a.css → FirstSteps.0.0.30-alpha.3.B3-pv8-a.css} +0 -0
  359. /package/dist/interface/assets/{NewCamera.0.0.30-alpha.0.DJ3tUBT_.css → NewCamera.0.0.30-alpha.3.DJ3tUBT_.css} +0 -0
  360. /package/dist/interface/assets/{Plugin.0.0.30-alpha.0.BtRA6zDt.css → Plugin.0.0.30-alpha.3.BtRA6zDt.css} +0 -0
  361. /package/dist/interface/assets/{Plugins.0.0.30-alpha.0.Cwu0aGUO.css → Plugins.0.0.30-alpha.3.Cwu0aGUO.css} +0 -0
  362. /package/dist/interface/assets/{Settings.0.0.30-alpha.0.DC_-E3CR.css → Settings.0.0.30-alpha.3.DC_-E3CR.css} +0 -0
  363. /package/dist/interface/assets/{User.0.0.30-alpha.0.DPDcJbx8.css → User.0.0.30-alpha.3.DPDcJbx8.css} +0 -0
  364. /package/dist/interface/assets/{VConsole.0.0.30-alpha.0.BZT1WyS-.css → VConsole.0.0.30-alpha.3.BZT1WyS-.css} +0 -0
  365. /package/dist/interface/assets/{VPlayer.0.0.30-alpha.0.CZXlTn4I.css → VPlayer.0.0.30-alpha.3.CZXlTn4I.css} +0 -0
  366. /package/dist/interface/assets/{VPluginCard.0.0.30-alpha.0.CIL48ca_.css → VPluginCard.0.0.30-alpha.3.CIL48ca_.css} +0 -0
  367. /package/dist/interface/assets/{highlight.0.0.30-alpha.0.DgoK_Xib.css → highlight.0.0.30-alpha.3.DgoK_Xib.css} +0 -0
  368. /package/dist/interface/assets/{logo-256.0.0.30-alpha.0.BCQk9H1-.png → logo-256.0.0.30-alpha.3.BCQk9H1-.png} +0 -0
  369. /package/dist/interface/assets/{logo-512.0.0.30-alpha.0.DLKVOU2S.png → logo-512.0.0.30-alpha.3.DLKVOU2S.png} +0 -0
  370. /package/dist/interface/assets/{logo.0.0.30-alpha.0.DmEiRk0z.png → logo.0.0.30-alpha.3.DmEiRk0z.png} +0 -0
  371. /package/dist/interface/assets/{main.0.0.30-alpha.0.BOf8IWhK.css → main.0.0.30-alpha.3.BOf8IWhK.css} +0 -0
  372. /package/dist/interface/assets/{mode-json.0.0.30-alpha.0.Br7xisR1.js → mode-json.0.0.30-alpha.3.Br7xisR1.js} +0 -0
  373. /package/dist/interface/assets/{mode-yaml.0.0.30-alpha.0.CIYL8U3d.js → mode-yaml.0.0.30-alpha.3.CIYL8U3d.js} +0 -0
  374. /package/dist/interface/assets/{v-calendar.0.0.30-alpha.0.CtSuDYZU.css → v-calendar.0.0.30-alpha.3.CtSuDYZU.css} +0 -0
  375. /package/dist/interface/assets/{vue3-toastify.0.0.30-alpha.0.DTY1DMRs.css → vue3-toastify.0.0.30-alpha.3.DTY1DMRs.css} +0 -0
  376. /package/dist/interface/assets/{vuetify.0.0.30-alpha.0.Cd1awv3t.css → vuetify.0.0.30-alpha.3.Cd1awv3t.css} +0 -0
  377. /package/dist/interface/{axios.C-n2IhIP.0.0.30-alpha.0.js → axios.C-n2IhIP.0.0.30-alpha.3.js} +0 -0
  378. /package/dist/interface/{compare-versions.DqEOhma6.0.0.30-alpha.0.js → compare-versions.DqEOhma6.0.0.30-alpha.3.js} +0 -0
  379. /package/dist/interface/{dijkstrajs.D_NXgYpA.0.0.30-alpha.0.js → dijkstrajs.D_NXgYpA.0.0.30-alpha.3.js} +0 -0
  380. /package/dist/interface/{engine.io-parser.BiEtp6m2.0.0.30-alpha.0.js → engine.io-parser.BiEtp6m2.0.0.30-alpha.3.js} +0 -0
  381. /package/dist/interface/{entities.C20TfXL6.0.0.30-alpha.0.js → entities.C20TfXL6.0.0.30-alpha.3.js} +0 -0
  382. /package/dist/interface/{get-size.D1dS-IaP.0.0.30-alpha.0.js → get-size.D1dS-IaP.0.0.30-alpha.3.js} +0 -0
  383. /package/dist/interface/{mdurl.k9Sl0PQj.0.0.30-alpha.0.js → mdurl.k9Sl0PQj.0.0.30-alpha.3.js} +0 -0
  384. /package/dist/interface/{punycode.js.Dj65hjkv.0.0.30-alpha.0.js → punycode.js.Dj65hjkv.0.0.30-alpha.3.js} +0 -0
  385. /package/dist/interface/{react-dnd-html5-backend.1HQjlkwI.0.0.30-alpha.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.30-alpha.3.js} +0 -0
  386. /package/dist/interface/{redux.CuxFRhX_.0.0.30-alpha.0.js → redux.CuxFRhX_.0.0.30-alpha.3.js} +0 -0
  387. /package/dist/interface/{tslib.9k7AwCpt.0.0.30-alpha.0.js → tslib.9k7AwCpt.0.0.30-alpha.3.js} +0 -0
  388. /package/dist/interface/{uc.micro.kMc2yuuw.0.0.30-alpha.0.js → uc.micro.kMc2yuuw.0.0.30-alpha.3.js} +0 -0
  389. /package/dist/interface/{uuid.DvF23Exx.0.0.30-alpha.0.js → uuid.DvF23Exx.0.0.30-alpha.3.js} +0 -0
  390. /package/dist/interface/{vue.l0sNRNKZ.0.0.30-alpha.0.js → vue.l0sNRNKZ.0.0.30-alpha.3.js} +0 -0
@@ -1,107 +0,0 @@
1
- import type { RootDatabase } from 'lmdb';
2
- import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
3
- import type { API } from './pluginApi.js';
4
- export declare class CameraStorage<T extends Record<string, any> = Record<string, any>> {
5
- private cameraId;
6
- private instance;
7
- private api;
8
- private pluginDb;
9
- schema: JsonSchemaForm;
10
- values: T;
11
- constructor(api: API, pluginDb: RootDatabase<Record<string, any>, 'config'>, instance: any, cameraId: string, schema?: JsonSchemaForm);
12
- /**
13
- * Initialize the storage.
14
- * This will load the configuration from the database.
15
- */
16
- initializeStorage(): void;
17
- /**
18
- * Get a value from the configuration by its key/path.
19
- * If the schema has an onGet function, the onGet function will be called.
20
- * If the onGet functions is undefined, the value from the configuration will be returned.
21
- * If the schema has a default value, and the configuration value is undefined, the default value will be returned.
22
- *
23
- * @param path - The path to the configuration value.
24
- * @returns The value from the configuration.
25
- */
26
- getValue<T = string>(path: string): Promise<T> | undefined;
27
- getValue<T = string>(path: string, defaultValue: T): Promise<T>;
28
- /**
29
- * Set a new value for a given key/path in the configuration.
30
- * If the schema of the value has an onSet function, and the value has changed, the onSet function will be called.
31
- * If the schema of the value is declared as storable, the value will be saved to the database.
32
- *
33
- * @param path - The path to the configuration value.
34
- * @param newValue - The new value to set.
35
- */
36
- setValue<T = string>(path: string, newValue: T): Promise<void>;
37
- /**
38
- * Check if a value exists by its config path/key.
39
- *
40
- * @param path - The path to the value to check.
41
- * @returns True if the value exists, false otherwise.
42
- */
43
- hasValue(path: string): boolean;
44
- /**
45
- * Get the root schema and configuration.
46
- * This will also call the onGet functions for the schema.
47
- *
48
- * @returns The root schema and configuration.
49
- */
50
- getConfig(): Promise<SchemaConfig>;
51
- /**
52
- * Set a new configuration.
53
- * If the schema of a value which has been changed has an onSet function, the onSet function will be called.
54
- *
55
- * @param newConfig - The new configuration to set.
56
- */
57
- setConfig(newConfig: T): Promise<void>;
58
- /**
59
- * Add a new schema to the existing schema.
60
- * It will also add the value to the configuration.
61
- * If the schema is declared as storable, the value will be saved to the database.
62
- *
63
- * @param schema - The new schema to add.
64
- * @param path - The path to the schema to add.
65
- */
66
- addSchema(schema: JsonSchemaForm): Promise<void>;
67
- addSchema(path: string, schema: JsonSchema): Promise<void>;
68
- /**
69
- * Remove a schema by its config path/key from the existing schema.
70
- * It will also remove the value from the configuration.
71
- * If the schema is declared as storable, the value will be removed from the database.
72
- *
73
- * @param path - The path to the schema to remove.
74
- */
75
- removeSchema(path: string): void;
76
- /**
77
- * Change a schema by its config path/key from the existing schema.
78
- * It will also change the value from the configuration.
79
- * If the schema is declared as storable, the value will be saved to the database.
80
- *
81
- * @param path - The path to the schema to change.
82
- * @param schema - The new schema to set.
83
- */
84
- changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
85
- /**
86
- * Get a schema by its config path/key.
87
- *
88
- * @param path - The path to the schema to get.
89
- * @returns The schema.
90
- */
91
- getSchema<T>(path: string): T | undefined;
92
- /**
93
- * Check if a schema exists by its config path/key.
94
- *
95
- * @param path - The path to the schema to check.
96
- * @returns True if the schema exists, false otherwise.
97
- */
98
- hasSchema(path: string): boolean;
99
- private resolveOnGetFunctions;
100
- private resolveOnGetFunctionsForObject;
101
- private resolveOnGetFunctionsForSchema;
102
- private triggerOnSetForChanges;
103
- private filterStorableValues;
104
- private containsStorableSchema;
105
- private saveDb;
106
- private close;
107
- }
@@ -1,292 +0,0 @@
1
- import objectPath from 'object-path';
2
- import { API_EVENT } from '../../../api.js';
3
- import { isEqual, mergeWith, structuredClone } from '../../../utils/utils.js';
4
- import { configPathToSchemaPath, generateJsonFromRootSchema, getValueByPath, isArrayType, isObjectType, isPrimitiveType, removeFunctionsFromSchemaForm, schemaPathToConfigPath, } from './schema.js';
5
- export class CameraStorage {
6
- cameraId;
7
- instance;
8
- api;
9
- pluginDb;
10
- schema;
11
- values = {};
12
- constructor(api, pluginDb, instance, cameraId, schema = {}) {
13
- this.api = api;
14
- this.pluginDb = pluginDb;
15
- this.instance = instance;
16
- this.cameraId = cameraId;
17
- this.schema = schema;
18
- this.api.once(API_EVENT.SHUTDOWN, this.close.bind(this));
19
- }
20
- /**
21
- * Initialize the storage.
22
- * This will load the configuration from the database.
23
- */
24
- initializeStorage() {
25
- const config = this.pluginDb.get('config') || {};
26
- const cameraConfig = config[this.cameraId] || {};
27
- const schemaConfig = generateJsonFromRootSchema({ schema: this.schema });
28
- this.values = mergeWith(schemaConfig, cameraConfig, (objValue, srcValue) => {
29
- if (Array.isArray(objValue)) {
30
- return srcValue;
31
- }
32
- });
33
- this.saveDb();
34
- // await this.resolveOnGetFunctions(this.schema);
35
- }
36
- getValue(path, defaultValue) {
37
- const schemaPath = configPathToSchemaPath(path);
38
- const schema = objectPath.get(this.schema, schemaPath);
39
- const configValue = objectPath.get(this.values, path);
40
- return schema?.onGet?.call(this.instance) ?? configValue ?? schema?.defaultValue ?? defaultValue;
41
- }
42
- /**
43
- * Set a new value for a given key/path in the configuration.
44
- * If the schema of the value has an onSet function, and the value has changed, the onSet function will be called.
45
- * If the schema of the value is declared as storable, the value will be saved to the database.
46
- *
47
- * @param path - The path to the configuration value.
48
- * @param newValue - The new value to set.
49
- */
50
- async setValue(path, newValue) {
51
- const schemaPath = configPathToSchemaPath(path);
52
- const schema = objectPath.get(this.schema, schemaPath);
53
- if (schema) {
54
- const oldValue = objectPath.get(this.values, path);
55
- objectPath.set(this.values, path, newValue);
56
- await schema.onSet?.call(this.instance, newValue, oldValue);
57
- if (this.containsStorableSchema(schema)) {
58
- this.saveDb();
59
- }
60
- }
61
- }
62
- /**
63
- * Check if a value exists by its config path/key.
64
- *
65
- * @param path - The path to the value to check.
66
- * @returns True if the value exists, false otherwise.
67
- */
68
- hasValue(path) {
69
- const configValue = objectPath.get(this.values, path);
70
- return configValue !== undefined;
71
- }
72
- /**
73
- * Get the root schema and configuration.
74
- * This will also call the onGet functions for the schema.
75
- *
76
- * @returns The root schema and configuration.
77
- */
78
- async getConfig() {
79
- const filteredSchema = removeFunctionsFromSchemaForm(this.schema);
80
- const rootSchema = { schema: filteredSchema };
81
- await this.resolveOnGetFunctions(this.schema);
82
- return { rootSchema, config: this.values };
83
- }
84
- /**
85
- * Set a new configuration.
86
- * If the schema of a value which has been changed has an onSet function, the onSet function will be called.
87
- *
88
- * @param newConfig - The new configuration to set.
89
- */
90
- async setConfig(newConfig) {
91
- const oldConfig = structuredClone(this.values);
92
- this.values = newConfig;
93
- await this.triggerOnSetForChanges(oldConfig, this.values);
94
- this.saveDb();
95
- }
96
- async addSchema(schemaOrPath, schema) {
97
- let shouldSave = false;
98
- if (typeof schemaOrPath === 'string' && schema) {
99
- const path = schemaOrPath;
100
- const schemaPath = configPathToSchemaPath(path);
101
- objectPath.set(this.schema, schemaPath, schema);
102
- await this.resolveOnGetFunctions(schema, schemaPath);
103
- if (this.containsStorableSchema(schema)) {
104
- shouldSave = true;
105
- }
106
- }
107
- else if (typeof schemaOrPath === 'object' && !schema) {
108
- const newSchema = schemaOrPath;
109
- mergeWith(this.schema, newSchema, (objValue, srcValue) => {
110
- if (Array.isArray(objValue)) {
111
- return srcValue;
112
- }
113
- });
114
- await this.resolveOnGetFunctions(newSchema);
115
- if (this.containsStorableSchema(newSchema)) {
116
- shouldSave = true;
117
- }
118
- }
119
- else {
120
- throw new Error('Invalid arguments for addSchema');
121
- }
122
- if (shouldSave) {
123
- this.saveDb();
124
- }
125
- }
126
- /**
127
- * Remove a schema by its config path/key from the existing schema.
128
- * It will also remove the value from the configuration.
129
- * If the schema is declared as storable, the value will be removed from the database.
130
- *
131
- * @param path - The path to the schema to remove.
132
- */
133
- removeSchema(path) {
134
- const schemaPath = configPathToSchemaPath(path);
135
- const schema = objectPath.get(this.schema, schemaPath);
136
- if (schema) {
137
- objectPath.del(this.schema, schemaPath);
138
- objectPath.del(this.values, path);
139
- if (this.containsStorableSchema(schema)) {
140
- this.saveDb();
141
- }
142
- }
143
- }
144
- /**
145
- * Change a schema by its config path/key from the existing schema.
146
- * It will also change the value from the configuration.
147
- * If the schema is declared as storable, the value will be saved to the database.
148
- *
149
- * @param path - The path to the schema to change.
150
- * @param schema - The new schema to set.
151
- */
152
- async changeSchema(path, newSchema) {
153
- const schemaPath = configPathToSchemaPath(path);
154
- const schema = objectPath.get(this.schema, schemaPath);
155
- if (schema) {
156
- mergeWith(schema, newSchema, (objValue, srcValue) => {
157
- if (Array.isArray(objValue)) {
158
- return srcValue;
159
- }
160
- });
161
- objectPath.set(this.schema, schemaPath, schema);
162
- await this.resolveOnGetFunctions(schema, schemaPath);
163
- if (this.containsStorableSchema(schema)) {
164
- this.saveDb();
165
- }
166
- }
167
- }
168
- /**
169
- * Get a schema by its config path/key.
170
- *
171
- * @param path - The path to the schema to get.
172
- * @returns The schema.
173
- */
174
- getSchema(path) {
175
- const schemaPath = configPathToSchemaPath(path);
176
- const schema = objectPath.get(this.schema, schemaPath);
177
- return schema;
178
- }
179
- /**
180
- * Check if a schema exists by its config path/key.
181
- *
182
- * @param path - The path to the schema to check.
183
- * @returns True if the schema exists, false otherwise.
184
- */
185
- hasSchema(path) {
186
- const schemaPath = configPathToSchemaPath(path);
187
- const schema = objectPath.get(this.schema, schemaPath);
188
- return !!schema;
189
- }
190
- async resolveOnGetFunctions(schema, baseSchemaPath = '') {
191
- if (isPrimitiveType(schema)) {
192
- await this.resolveOnGetFunctionsForSchema(baseSchemaPath);
193
- }
194
- else if (isObjectType(schema)) {
195
- if (schema.properties) {
196
- await this.resolveOnGetFunctionsForObject(schema.properties, baseSchemaPath);
197
- }
198
- }
199
- else {
200
- for (const [key, value] of Object.entries(schema)) {
201
- const schemaPath = baseSchemaPath ? `${baseSchemaPath}.${key}` : key;
202
- if (isObjectType(value)) {
203
- if (value.properties) {
204
- await this.resolveOnGetFunctionsForObject(value.properties, schemaPath);
205
- }
206
- }
207
- else {
208
- await this.resolveOnGetFunctionsForSchema(schemaPath);
209
- }
210
- }
211
- }
212
- }
213
- async resolveOnGetFunctionsForObject(schema, baseSchemaPath) {
214
- for (const key of Object.keys(schema)) {
215
- const schemaPath = baseSchemaPath ? `${baseSchemaPath}.${key}` : key;
216
- await this.resolveOnGetFunctionsForSchema(schemaPath);
217
- }
218
- }
219
- async resolveOnGetFunctionsForSchema(schemaPath) {
220
- const configPath = schemaPathToConfigPath(schemaPath);
221
- const schemaValue = await this.getValue(configPath);
222
- if (schemaValue !== undefined && schemaValue !== null) {
223
- objectPath.set(this.values, configPath, schemaValue);
224
- }
225
- }
226
- async triggerOnSetForChanges(oldConfig, newConfig, path = '') {
227
- for (const key in newConfig) {
228
- const newPath = path ? `${path}.${key}` : key;
229
- const oldValue = getValueByPath(oldConfig, key);
230
- const newValue = newConfig[key];
231
- if (!isEqual(oldValue, newValue, true)) {
232
- const schemaPath = configPathToSchemaPath(newPath);
233
- const schemaItem = getValueByPath(this.schema, schemaPath);
234
- if (schemaItem && schemaItem.type !== 'button' && typeof schemaItem.onSet === 'function') {
235
- await schemaItem.onSet.call(this.instance, newValue, oldValue);
236
- }
237
- }
238
- if (newValue && typeof newValue === 'object' && !Array.isArray(newValue)) {
239
- await this.triggerOnSetForChanges(oldValue || {}, newValue, newPath);
240
- }
241
- }
242
- }
243
- filterStorableValues(schema, baseSchemaPath = '', result = {}) {
244
- for (const [key, value] of Object.entries(schema)) {
245
- if (value.type === 'button') {
246
- continue;
247
- }
248
- if (isObjectType(value)) {
249
- if (value.properties) {
250
- this.filterStorableValues(value.properties, baseSchemaPath ? `${baseSchemaPath}.${key}` : key, result);
251
- }
252
- }
253
- else if (value.store) {
254
- const schemaPath = baseSchemaPath ? `${baseSchemaPath}.${key}` : key;
255
- const configPath = schemaPathToConfigPath(schemaPath);
256
- const configValue = getValueByPath(this.values, configPath);
257
- objectPath.set(result, configPath, configValue);
258
- }
259
- }
260
- return result;
261
- }
262
- containsStorableSchema(schema) {
263
- if (schema.type === 'button') {
264
- return false;
265
- }
266
- if (schema.store) {
267
- return true;
268
- }
269
- if (isObjectType(schema) && schema.properties) {
270
- return Object.values(schema.properties).some((subSchema) => this.containsStorableSchema(subSchema));
271
- }
272
- else if (isArrayType(schema) && schema.items) {
273
- return this.containsStorableSchema(schema.items);
274
- }
275
- return false;
276
- }
277
- saveDb() {
278
- const config = this.pluginDb.get('config') || {};
279
- const storableConfig = this.filterStorableValues(this.schema);
280
- config[this.cameraId] = storableConfig;
281
- this.pluginDb.putSync('config', config);
282
- }
283
- async close() {
284
- try {
285
- this.saveDb();
286
- }
287
- catch {
288
- //
289
- }
290
- }
291
- }
292
- //# sourceMappingURL=cameraStorage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cameraStorage.js","sourceRoot":"","sources":["../../../../../../src/polyglot/node/plugins/cameraStorage.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,EACd,WAAW,EACX,YAAY,EACZ,eAAe,EACf,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAMrB,MAAM,OAAO,aAAa;IAChB,QAAQ,CAAS;IACjB,QAAQ,CAAM;IACd,GAAG,CAAM;IACT,QAAQ,CAA8C;IAEvD,MAAM,CAAiB;I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,CAAC,KAAK,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IACO,MAAM;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACjD,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEO,KAAK,CAAC,KAAK;QACjB,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,EAAE;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1,28 +0,0 @@
1
- export declare class PluginChild {
2
- private displayName;
3
- private api?;
4
- private plugin?;
5
- private logger;
6
- private pluginDb?;
7
- private publisher?;
8
- private subscriber?;
9
- private pluginSubscriber?;
10
- private subject;
11
- private pluginSubject;
12
- private targetSubject;
13
- private auth;
14
- private proxyEndpoints;
15
- private messageQueue?;
16
- private stopped;
17
- constructor();
18
- private init;
19
- private start;
20
- private stop;
21
- private loadPlugin;
22
- private sendMessage;
23
- private requestHandler;
24
- private onWorkerMessage;
25
- private isPluginMessage;
26
- private isStorageMessage;
27
- private signalHander;
28
- }
@@ -1,222 +0,0 @@
1
- process.title = `camera.ui - ${process.argv[2]}`;
2
- import { open } from 'lmdb';
3
- import { fileURLToPath, pathToFileURL } from 'node:url';
4
- import { API_EVENT } from '../../../api.js';
5
- import { Database } from '../../../api/database/index.js';
6
- import { ProxyConnection } from '../../../nats/connection.js';
7
- import { MessageQueue } from '../../../nats/messageQueue.js';
8
- import { PLUGIN_COMMAND, PLUGIN_STATUS } from '../../../plugins/types.js';
9
- import { unpack } from '../../../utils/packer.js';
10
- import { sleep } from '../../../utils/utils.js';
11
- import { API } from './pluginApi.js';
12
- import { PluginLogger } from './pluginLogger.js';
13
- import { CameraDeviceProxy } from './proxy/cameraDevice.js';
14
- export class PluginChild {
15
- displayName = process.argv[2];
16
- api;
17
- plugin;
18
- logger;
19
- pluginDb;
20
- publisher;
21
- subscriber;
22
- pluginSubscriber;
23
- subject;
24
- pluginSubject;
25
- targetSubject;
26
- auth;
27
- proxyEndpoints;
28
- messageQueue;
29
- stopped = false;
30
- constructor() {
31
- this.proxyEndpoints = process.env.PROXY_ENDPOINTS.split(',');
32
- this.auth = { user: process.env.PROXY_USER, password: process.env.PROXY_PASSWORD };
33
- delete process.env.PROXY_USER;
34
- delete process.env.PROXY_PASSWORD;
35
- delete process.env.PROXY_ENDPOINTS;
36
- this.logger = new PluginLogger(this.displayName, process.env.LOGGER_DISABLE_TIMESTAMPS === '1');
37
- this.subject = `${process.env.WORKER_ID}.ipc.subscriber`;
38
- this.pluginSubject = `${process.env.PLUGIN_ID}.child`;
39
- this.targetSubject = `${process.env.WORKER_ID}.ipc.publisher`;
40
- this.signalHander();
41
- this.init();
42
- }
43
- async init() {
44
- const servers = this.proxyEndpoints.filter((endpoint) => endpoint.startsWith('nats://'));
45
- this.publisher = new ProxyConnection(this.subject, servers, this.auth);
46
- await this.publisher.connect();
47
- this.subscriber = this.publisher.subscribe(this.subject);
48
- this.subscriber.on('message', this.onWorkerMessage.bind(this));
49
- this.pluginSubscriber = this.publisher.subscribe(this.pluginSubject);
50
- this.messageQueue = new MessageQueue('client', this.publisher, this.pluginSubscriber, this.logger, this.requestHandler.bind(this));
51
- this.sendMessage({ type: PLUGIN_STATUS.READY });
52
- }
53
- async start(data) {
54
- try {
55
- const storagePath = data.storage.storagePath;
56
- const configFile = data.storage.configFile;
57
- const pluginInfo = data.plugin;
58
- const cameras = data.cameras;
59
- this.pluginDb = open(`${storagePath}/volume`, {
60
- name: Database.PLUGINS_ID,
61
- });
62
- const pluginConfig = this.pluginDb.get('config');
63
- if (!pluginConfig) {
64
- await this.pluginDb.put('config', {});
65
- }
66
- this.api = new API(pluginInfo, storagePath, configFile, this.logger, this.proxyEndpoints, this.auth, this.pluginDb);
67
- const pluginConstructor = await this.loadPlugin();
68
- this.plugin = new pluginConstructor(this.logger, this.api);
69
- const coreManager = this.api.coreManager;
70
- const deviceManager = this.api.deviceManager;
71
- await Promise.all([deviceManager.init(), coreManager.init()]);
72
- const camerasDevices = cameras.map((camera) => new CameraDeviceProxy(this.api, this.logger, camera, data.plugin, this.proxyEndpoints, this.auth));
73
- await Promise.all(camerasDevices.map((cameraDevice) => cameraDevice.init()));
74
- deviceManager.configureCameras(camerasDevices);
75
- this.plugin.configureCameras(camerasDevices);
76
- this.sendMessage({ type: PLUGIN_STATUS.STARTED });
77
- this.api.emit(API_EVENT.FINISH_LAUNCHING);
78
- }
79
- catch (error) {
80
- this.logger.error('Starting plugin failed:', error);
81
- this.sendMessage({ type: PLUGIN_STATUS.ERROR, data: error.message });
82
- }
83
- }
84
- async stop() {
85
- if (this.stopped) {
86
- return;
87
- }
88
- this.stopped = true;
89
- this.api?.emit(API_EVENT.SHUTDOWN);
90
- this.messageQueue?.abortQueue();
91
- await this.publisher?.close();
92
- await sleep(500);
93
- await this.pluginDb?.close();
94
- }
95
- async loadPlugin() {
96
- const moduleUrl = pathToFileURL(process.env.MODULE_PATH).href;
97
- const { default: pluginConstructor } = await import(moduleUrl);
98
- if (typeof pluginConstructor === 'function') {
99
- return pluginConstructor;
100
- }
101
- else if (pluginConstructor && typeof pluginConstructor.default === 'function') {
102
- return pluginConstructor.default;
103
- }
104
- else {
105
- throw new Error(`Plugin ${process.env.MODULE_PATH} does not export a initializer function from main.`);
106
- }
107
- }
108
- sendMessage(message) {
109
- if (!this.publisher) {
110
- throw new Error('Publisher is not initialized');
111
- }
112
- this.publisher.publish(this.targetSubject, message);
113
- }
114
- async requestHandler(message) {
115
- if (!this.messageQueue) {
116
- throw new Error('Message queue not initialized');
117
- }
118
- const reply = {
119
- ...message,
120
- type: 'reply',
121
- };
122
- try {
123
- if (!this.plugin || !this.api) {
124
- throw new Error('Plugin not initialized');
125
- }
126
- if (this.isPluginMessage(message.fn)) {
127
- const fn = message.fn;
128
- reply.response = await this.plugin[fn].apply(this.plugin, message.args);
129
- }
130
- else if (message.cameraId && this.isStorageMessage(message.fn, this.api?.storageController.getCameraStorage(message.cameraId))) {
131
- const fn = message.fn;
132
- const cameraStorage = this.api.storageController.getCameraStorage(message.cameraId);
133
- reply.response = await cameraStorage[fn].apply(cameraStorage, message.args);
134
- }
135
- else {
136
- throw new Error(`Unknown function: ${message.fn}`);
137
- }
138
- }
139
- catch (error) {
140
- reply.error = {
141
- name: error.name,
142
- message: error.message,
143
- stack: error.stack,
144
- };
145
- }
146
- if (message.timeout === 0) {
147
- return;
148
- }
149
- else {
150
- this.messageQueue.enqueue(reply);
151
- }
152
- }
153
- async onWorkerMessage(msg) {
154
- if (this.stopped) {
155
- return;
156
- }
157
- const message = unpack(msg.data);
158
- switch (message.type) {
159
- case PLUGIN_COMMAND.START:
160
- this.start(message.data);
161
- break;
162
- case PLUGIN_COMMAND.STOP:
163
- this.stop();
164
- break;
165
- }
166
- }
167
- isPluginMessage(fn) {
168
- return Boolean(this.plugin && typeof this.plugin[fn] === 'function');
169
- }
170
- isStorageMessage(fn, storage) {
171
- return Boolean(storage && fn in storage && typeof storage[fn] === 'function');
172
- }
173
- signalHander() {
174
- let closePromise;
175
- const gracefullyClose = async (signal, reason, error, promise) => {
176
- if (closePromise) {
177
- return closePromise;
178
- }
179
- if (error || (promise && reason)) {
180
- this.logger.log(`${this.displayName} is ungracefully closing from signal="${signal}" reason="${reason || 'unknown'}"...`);
181
- if (error) {
182
- if (typeof error === 'string') {
183
- this.logger.error(error);
184
- }
185
- else {
186
- this.logger.error(`${signal}`, error);
187
- }
188
- }
189
- else {
190
- this.logger.error(`${signal}: Unhandled promise rejection:`, reason || promise);
191
- }
192
- }
193
- else {
194
- this.logger.log(`${this.displayName} is gracefully closing from signal="${signal}" reason="${reason || 'unknown'}"...`);
195
- }
196
- const shutdown = setTimeout(() => {
197
- this.logger.warn('Failed to gracefully close before timeout, force quit!');
198
- process.kill(process.pid, 'SIGKILL');
199
- }, 2000);
200
- closePromise = this.stop();
201
- await closePromise;
202
- clearTimeout(shutdown);
203
- process.exit(0);
204
- };
205
- process.on('uncaughtException', (error) => gracefullyClose('uncaughtException', undefined, error));
206
- process.on('unhandledRejection', (reason, promise) => gracefullyClose('unhandledRejection', reason, undefined, promise));
207
- process.on('SIGTERM', gracefullyClose);
208
- process.on('SIGINT', gracefullyClose);
209
- setInterval(() => {
210
- if (!process.connected) {
211
- process.exit(1);
212
- }
213
- }, 10000);
214
- process.on('disconnect', () => {
215
- process.exit();
216
- });
217
- }
218
- }
219
- if (process.argv[1] === fileURLToPath(import.meta.url)) {
220
- new PluginChild();
221
- }
222
- //# sourceMappingURL=child.js.map