@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.1

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 (387) hide show
  1. package/dist/interface/index.html +44 -44
  2. package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
  3. package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
  4. package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
  5. package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
  6. package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
  7. package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
  8. package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
  9. package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
  10. package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
  11. package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
  12. package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
  13. package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
  14. package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
  15. package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
  16. package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
  17. package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
  18. package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
  19. package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
  20. package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
  21. package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
  22. package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.js +1 -0
  23. package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.kxAPXcBy.0.0.50-internal.1.js} +1 -1
  24. package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
  25. package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
  26. package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
  27. package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
  28. package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.js} +1 -1
  29. package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.MmrWYW3K.0.0.50-internal.1.js} +1 -1
  30. package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0aqA_3x.0.0.50-internal.1.js} +2 -2
  31. package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
  32. package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
  33. package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.BQHSWV_g.0.0.50-internal.1.js} +1 -1
  34. package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
  35. package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
  36. package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
  37. package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.BwxOddB_.0.0.50-internal.1.js} +1 -1
  38. package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.Dz96RC_N.0.0.50-internal.1.js} +1 -1
  39. package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.CmcM8OM6.0.0.50-internal.1.js} +1 -1
  40. package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
  41. package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
  42. package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.CTgfs-3p.0.0.50-internal.1.js} +1 -1
  43. package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
  44. package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
  45. package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
  46. package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
  47. package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.CEGHlD-T.0.0.50-internal.1.js} +1 -1
  48. package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.D0keXzBc.0.0.50-internal.1.js} +1 -1
  49. package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
  50. package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.BPcXPAHG.0.0.50-internal.1.js} +1 -1
  51. package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.DSGzrW_l.0.0.50-internal.1.js} +1 -1
  52. package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
  53. package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
  54. package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
  55. package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
  56. package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
  57. package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.DXDZITpf.0.0.50-internal.1.js} +1 -1
  58. package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.BDYaTfbi.0.0.50-internal.1.js} +1 -1
  59. package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
  60. package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
  61. package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
  62. package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
  63. package/dist/interface/sw.js +1 -1
  64. package/dist/server/package.json +1 -1
  65. package/package.json +1 -1
  66. package/.prettierignore +0 -12
  67. package/.prettierrc.json +0 -12
  68. package/artillery.yaml +0 -29
  69. package/bin/cameraui-server.ts +0 -11
  70. package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
  71. package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
  72. package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
  73. package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
  74. package/eslint.config.js +0 -103
  75. package/localdeps.txt +0 -10
  76. package/mypy.ini +0 -30
  77. package/requirements.txt +0 -15
  78. package/ruff.toml +0 -90
  79. package/src/__init__.py +0 -0
  80. package/src/_camera_ui_tools/__init__.py +0 -0
  81. package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
  82. package/src/api/controllers/api.controller.ts +0 -19
  83. package/src/api/controllers/auth.controller.ts +0 -294
  84. package/src/api/controllers/backup.controller.ts +0 -72
  85. package/src/api/controllers/cameras.controller.ts +0 -1029
  86. package/src/api/controllers/config.controller.ts +0 -102
  87. package/src/api/controllers/files.controller.ts +0 -35
  88. package/src/api/controllers/frameWorkers.controller.ts +0 -109
  89. package/src/api/controllers/plugins.controller.ts +0 -1206
  90. package/src/api/controllers/system.controller.ts +0 -273
  91. package/src/api/controllers/users.controller.ts +0 -648
  92. package/src/api/database/checks.ts +0 -268
  93. package/src/api/database/constants.ts +0 -8
  94. package/src/api/database/index.ts +0 -262
  95. package/src/api/database/migration.ts +0 -62
  96. package/src/api/database/selfcheck.ts +0 -492
  97. package/src/api/database/types.ts +0 -104
  98. package/src/api/go2rtc/api/application.ts +0 -48
  99. package/src/api/go2rtc/api/config.ts +0 -61
  100. package/src/api/go2rtc/api/discover.ts +0 -197
  101. package/src/api/go2rtc/api/index.ts +0 -49
  102. package/src/api/go2rtc/api/snapshot.ts +0 -44
  103. package/src/api/go2rtc/api/streams.ts +0 -168
  104. package/src/api/go2rtc/index.ts +0 -43
  105. package/src/api/go2rtc/queue.ts +0 -50
  106. package/src/api/go2rtc/types.ts +0 -174
  107. package/src/api/index.ts +0 -286
  108. package/src/api/middlewares/authPermission.middleware.ts +0 -46
  109. package/src/api/middlewares/authValidation.middleware.ts +0 -160
  110. package/src/api/middlewares/pagination.middleware.ts +0 -67
  111. package/src/api/middlewares/socketAuth.middleware.ts +0 -136
  112. package/src/api/plugins/header.plugin.ts +0 -15
  113. package/src/api/plugins/logger.plugin.ts +0 -44
  114. package/src/api/plugins/proxy.plugin.ts +0 -255
  115. package/src/api/plugins/socket.plugin.ts +0 -28
  116. package/src/api/plugins/system.plugin.ts +0 -48
  117. package/src/api/plugins/useragent.plugin.ts +0 -19
  118. package/src/api/routes/api.routes.ts +0 -10
  119. package/src/api/routes/auth.routes.ts +0 -56
  120. package/src/api/routes/backup.routes.ts +0 -28
  121. package/src/api/routes/cameras.routes.ts +0 -281
  122. package/src/api/routes/config.routes.ts +0 -66
  123. package/src/api/routes/files.routes.ts +0 -15
  124. package/src/api/routes/frameWorkers.routes.ts +0 -39
  125. package/src/api/routes/index.ts +0 -37
  126. package/src/api/routes/plugins.routes.ts +0 -420
  127. package/src/api/routes/system.routes.ts +0 -101
  128. package/src/api/routes/users.routes.ts +0 -167
  129. package/src/api/schemas/backup.schema.ts +0 -112
  130. package/src/api/schemas/cameras.schema.ts +0 -479
  131. package/src/api/schemas/config.schema.ts +0 -38
  132. package/src/api/schemas/go2rtc.schema.ts +0 -189
  133. package/src/api/schemas/plugins.schema.ts +0 -126
  134. package/src/api/schemas/storage.schema.ts +0 -11
  135. package/src/api/schemas/system.schema.ts +0 -45
  136. package/src/api/schemas/users.schema.ts +0 -185
  137. package/src/api/services/auth.service.ts +0 -210
  138. package/src/api/services/backup.service.ts +0 -144
  139. package/src/api/services/cameras.service.ts +0 -671
  140. package/src/api/services/plugins.service.ts +0 -470
  141. package/src/api/services/system.service.ts +0 -85
  142. package/src/api/services/users.service.ts +0 -276
  143. package/src/api/types/index.ts +0 -675
  144. package/src/api/utils/cert.ts +0 -254
  145. package/src/api/utils/constants.ts +0 -17
  146. package/src/api/utils/fetch.ts +0 -21
  147. package/src/api/utils/moveFiles.ts +0 -45
  148. package/src/api/utils/parse.ts +0 -17
  149. package/src/api/websocket/index.ts +0 -110
  150. package/src/api/websocket/nsp/logs.ts +0 -240
  151. package/src/api/websocket/nsp/main.ts +0 -27
  152. package/src/api/websocket/nsp/metrics.ts +0 -301
  153. package/src/api/websocket/nsp/notifications.ts +0 -43
  154. package/src/api/websocket/nsp/plugins.ts +0 -37
  155. package/src/api/websocket/nsp/server.ts +0 -220
  156. package/src/api/websocket/nsp/status.ts +0 -77
  157. package/src/api/websocket/types.ts +0 -55
  158. package/src/api.ts +0 -163
  159. package/src/camera/classes.ts +0 -32
  160. package/src/camera/controller.ts +0 -579
  161. package/src/camera/device.ts +0 -422
  162. package/src/camera/frameWorker.ts +0 -403
  163. package/src/camera/index.ts +0 -679
  164. package/src/camera/interfaces.ts +0 -95
  165. package/src/camera/iou.ts +0 -153
  166. package/src/camera/polygon.ts +0 -226
  167. package/src/camera/python/__init__.py +0 -0
  168. package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
  169. package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
  170. package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
  171. package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
  172. package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
  173. package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
  174. package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
  175. package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
  176. package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
  177. package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
  178. package/src/camera/python/classes.py +0 -41
  179. package/src/camera/python/interfaces.py +0 -130
  180. package/src/camera/python/iou.py +0 -158
  181. package/src/camera/python/polygon.py +0 -230
  182. package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
  183. package/src/camera/python/test/iou_test.py +0 -799
  184. package/src/camera/python/test/polygon.py +0 -238
  185. package/src/camera/python/test/polygon_test.py +0 -256
  186. package/src/camera/python/test/polygon_test2.py +0 -484
  187. package/src/camera/python/typings.py +0 -50
  188. package/src/camera/python/video_frame.py +0 -143
  189. package/src/camera/session.ts +0 -192
  190. package/src/camera/streaming/fmp4-session.ts +0 -390
  191. package/src/camera/streaming/peer-connection.ts +0 -273
  192. package/src/camera/streaming/rtsp-session.ts +0 -331
  193. package/src/camera/streaming/webrtc-connection.ts +0 -260
  194. package/src/camera/streaming/werift-session.ts +0 -317
  195. package/src/camera/test/iou_test.ts +0 -761
  196. package/src/camera/test/polygon.test.ts +0 -611
  197. package/src/camera/test/polygon_test.ts +0 -210
  198. package/src/camera/types.ts +0 -48
  199. package/src/camera/utils.ts +0 -489
  200. package/src/camera/videoFrame.ts +0 -123
  201. package/src/cloud/index.ts +0 -61
  202. package/src/cloud/remote/cloudflare.ts +0 -18
  203. package/src/cloud/remote/upnp.ts +0 -18
  204. package/src/cloud/remote/utils.ts +0 -24
  205. package/src/cloud/types.ts +0 -16
  206. package/src/decoder/child.ts +0 -883
  207. package/src/decoder/imageUtils.ts +0 -275
  208. package/src/decoder/manager.ts +0 -251
  209. package/src/decoder/python/__init__.py +0 -0
  210. package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
  211. package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
  212. package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
  213. package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
  214. package/src/decoder/python/child.py +0 -903
  215. package/src/decoder/python/image_utils.py +0 -196
  216. package/src/decoder/python/pool.py +0 -45
  217. package/src/decoder/python/test/group.py +0 -62
  218. package/src/decoder/python/test/motion.mp4 +0 -0
  219. package/src/decoder/python/test/motion2.mp4 +0 -0
  220. package/src/decoder/python/test/opencl.cl +0 -70
  221. package/src/decoder/python/test/opencl2.cl +0 -130
  222. package/src/decoder/python/test/test.py +0 -427
  223. package/src/decoder/python/test/test1.jpg +0 -0
  224. package/src/decoder/python/test/test1_resized.jpg +0 -0
  225. package/src/decoder/python/test/test2.jpg +0 -0
  226. package/src/decoder/python/test/test2.py +0 -451
  227. package/src/decoder/python/test/test2_resized.jpg +0 -0
  228. package/src/decoder/python/test/test3.jpg +0 -0
  229. package/src/decoder/python/test/utils.py +0 -50
  230. package/src/decoder/python/typings.py +0 -57
  231. package/src/decoder/python/utils.py +0 -70
  232. package/src/decoder/test/child.ts +0 -117
  233. package/src/decoder/test/ffmpeg.ts +0 -371
  234. package/src/decoder/test/test.ts +0 -182
  235. package/src/decoder/types.ts +0 -27
  236. package/src/decoder/utils.ts +0 -64
  237. package/src/decoder/wasm/asconfig.json +0 -28
  238. package/src/decoder/wasm/assembly/console.ts +0 -1
  239. package/src/decoder/wasm/assembly/index.ts +0 -890
  240. package/src/decoder/wasm/build/decoder.d.ts +0 -43
  241. package/src/decoder/wasm/build/decoder.js +0 -108
  242. package/src/decoder/wasm/build/decoder.wasm +0 -0
  243. package/src/decoder/wasm/tsconfig.json +0 -5
  244. package/src/decoder/worker.ts +0 -113
  245. package/src/go2rtc/index.ts +0 -324
  246. package/src/go2rtc/types.ts +0 -88
  247. package/src/main.ts +0 -267
  248. package/src/manager/coreManager.ts +0 -78
  249. package/src/manager/deviceManager.ts +0 -132
  250. package/src/manager/types.ts +0 -17
  251. package/src/plugins/index.ts +0 -443
  252. package/src/plugins/plugin.ts +0 -177
  253. package/src/plugins/runtime/base.ts +0 -282
  254. package/src/plugins/runtime/index.ts +0 -15
  255. package/src/plugins/runtime/node/child.ts +0 -193
  256. package/src/plugins/runtime/node/index.ts +0 -67
  257. package/src/plugins/runtime/node/plugin.ts +0 -122
  258. package/src/plugins/runtime/node/pluginApi.ts +0 -27
  259. package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
  260. package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
  261. package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
  262. package/src/plugins/runtime/node/storage.ts +0 -312
  263. package/src/plugins/runtime/node/storageController.ts +0 -91
  264. package/src/plugins/runtime/python/__init__.py +0 -0
  265. package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
  266. package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
  267. package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
  268. package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
  269. package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
  270. package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
  271. package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
  272. package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
  273. package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
  274. package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
  275. package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
  276. package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
  277. package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
  278. package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
  279. package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
  280. package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
  281. package/src/plugins/runtime/python/child.py +0 -248
  282. package/src/plugins/runtime/python/index.ts +0 -73
  283. package/src/plugins/runtime/python/namespaces.py +0 -101
  284. package/src/plugins/runtime/python/plugin.py +0 -155
  285. package/src/plugins/runtime/python/plugin_api.py +0 -29
  286. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
  287. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
  288. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
  289. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
  290. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
  291. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
  292. package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
  293. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
  294. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
  295. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
  296. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
  297. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
  298. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
  299. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
  300. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
  301. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
  302. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
  303. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
  304. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
  305. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
  306. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
  307. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
  308. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
  309. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
  310. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
  311. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
  312. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
  313. package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
  314. package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
  315. package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
  316. package/src/plugins/runtime/python/schema.py +0 -99
  317. package/src/plugins/runtime/python/storage.py +0 -353
  318. package/src/plugins/runtime/python/storage_controller.py +0 -102
  319. package/src/plugins/runtime/python/typings.py +0 -195
  320. package/src/plugins/schema.ts +0 -472
  321. package/src/plugins/types.ts +0 -60
  322. package/src/plugins/worker.ts +0 -250
  323. package/src/rpc/index.ts +0 -149
  324. package/src/rpc/namespaces.ts +0 -79
  325. package/src/rpc/server.ts +0 -422
  326. package/src/rpc/types.ts +0 -119
  327. package/src/rpc/utils.ts +0 -16
  328. package/src/services/config/constants.ts +0 -47
  329. package/src/services/config/defaults.ts +0 -57
  330. package/src/services/config/index.ts +0 -744
  331. package/src/services/config/types.ts +0 -211
  332. package/src/services/logger/index.ts +0 -96
  333. package/src/types.ts +0 -47
  334. package/src/utils/path.ts +0 -16
  335. package/src/utils/pythonInstaller.ts +0 -597
  336. package/tsconfig.json +0 -37
  337. package/updates.config.js +0 -3
  338. /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.1.css} +0 -0
  339. /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
  340. /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
  341. /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
  342. /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
  343. /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
  344. /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
  345. /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
  346. /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
  347. /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
  348. /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
  349. /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
  350. /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
  351. /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
  352. /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
  353. /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
  354. /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
  355. /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
  356. /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
  357. /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
  358. /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
  359. /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
  360. /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  361. /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
  362. /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
  363. /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
  364. /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
  365. /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
  366. /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
  367. /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
  368. /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
  369. /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  370. /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
  371. /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.js} +0 -0
  372. /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.1.js} +0 -0
  373. /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.js} +0 -0
  374. /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.1.js} +0 -0
  375. /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.1.js} +0 -0
  376. /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  377. /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
  378. /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  379. /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
  380. /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.js} +0 -0
  381. /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.1.js} +0 -0
  382. /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
  383. /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
  384. /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
  385. /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
  386. /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  387. /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
@@ -1,312 +0,0 @@
1
- import { isEqual, mergeWith, structuredClone } from '@camera.ui/common/utils';
2
- import { rpc } from '@camera.ui/rpc-common';
3
- import objectPath from 'object-path';
4
-
5
- import { API_EVENT } from '../../../api.js';
6
- import { NamespaceManager } from '../../../rpc/namespaces.js';
7
- import { generateConfigFromSchemas, getValueByKey, isButtonType, isSubmitType, removeCallbacksFromSchemas } from '../../schema.js';
8
-
9
- import type { ClientInstance } from '@camera.ui/rpc-client';
10
- import type { DeviceStorage as DeviceStorageInterface, FormSubmitResponse, JsonSchema, SchemaConfig } from '@camera.ui/types';
11
- import type { RootDatabase } from 'lmdb';
12
- import type { PluginInfo } from '../../types.js';
13
- import type { PluginAPI } from './pluginApi.js';
14
-
15
- export class DeviceStorage<T extends Record<string, any> = Record<string, any>> implements DeviceStorageInterface<T> {
16
- public schemas: JsonSchema[];
17
- public values: T = {} as T;
18
-
19
- #deviceId: string;
20
- #instance: any;
21
- #api: PluginAPI;
22
- #proxy: ClientInstance;
23
- #plugin: PluginInfo;
24
- #pluginDb: RootDatabase<Record<string, any>, 'config'>;
25
-
26
- #storageNamespace: string;
27
- #isPluginStorage: boolean;
28
-
29
- constructor(
30
- api: PluginAPI,
31
- proxy: ClientInstance,
32
- plugin: PluginInfo,
33
- pluginDb: RootDatabase<Record<string, any>, 'config'>,
34
- instance: any,
35
- deviceId: string,
36
- schemas: JsonSchema[] = [],
37
- isPluginStorage: boolean,
38
- ) {
39
- this.schemas = schemas;
40
-
41
- this.#api = api;
42
- this.#proxy = proxy;
43
- this.#plugin = plugin;
44
- this.#pluginDb = pluginDb;
45
- this.#instance = instance;
46
- this.#deviceId = deviceId;
47
- this.#isPluginStorage = isPluginStorage;
48
-
49
- const namespaces = {
50
- ...NamespaceManager.pluginCameraNamespaces(this.#plugin.id, this.#deviceId),
51
- ...NamespaceManager.pluginNamespaces(this.#plugin.id),
52
- };
53
-
54
- this.#storageNamespace = !this.#isPluginStorage ? namespaces.cameraStorageRpc : namespaces.pluginStorageRpc;
55
- this.#api.once(API_EVENT.SHUTDOWN, this.#close.bind(this));
56
- }
57
-
58
- public getValue<T = string>(key: string): Promise<T> | undefined;
59
- public getValue<T = string>(key: string, defaultValue: T): Promise<T>;
60
- @rpc({ public: true })
61
- public getValue<T = string>(key: string, defaultValue?: T): Promise<T> | undefined {
62
- const schema = this.schemas.find((schema) => schema.key === key);
63
- const configValue = objectPath.get(this.values, key);
64
- return (schema as any)?.onGet?.call(this.#instance) ?? configValue ?? (schema as any)?.defaultValue ?? defaultValue;
65
- }
66
-
67
- @rpc({ public: true })
68
- public async setValue<T = string>(key: string, newValue: T): Promise<void> {
69
- const schema = this.schemas.find((schema) => schema.key === key);
70
-
71
- if (schema) {
72
- const oldValue = objectPath.get(this.values, key);
73
- objectPath.set(this.values, key, newValue);
74
- await (schema as any).onSet?.call(this.#instance, newValue, oldValue);
75
-
76
- if (this.#containsStorableSchema(schema)) {
77
- await this.save();
78
- }
79
- }
80
- }
81
-
82
- @rpc({ public: true })
83
- public async submitValue(key: string, newValue: any): Promise<FormSubmitResponse | void> {
84
- const schema = this.schemas.find((schema) => schema.key === key);
85
-
86
- if (schema?.type === 'submit') {
87
- // objectPath.set(this.values, bracketsToDot(configPath), newValue);
88
- return schema.onClick.call(this.#instance, newValue);
89
-
90
- // if (this.#containsStorableSchema(schema)) {
91
- // await this.save();
92
- // }
93
- }
94
- }
95
-
96
- @rpc({ public: true })
97
- public hasValue(key: string): boolean {
98
- const configValue = objectPath.get(this.values, key);
99
- return configValue !== undefined;
100
- }
101
-
102
- @rpc({ public: true })
103
- public async getConfig(): Promise<SchemaConfig> {
104
- await this.#resolveOnGetFunctions(this.schemas);
105
- const filteredSchema = removeCallbacksFromSchemas(this.schemas);
106
- const schemaConfig: SchemaConfig = { schema: filteredSchema, config: this.values };
107
- return schemaConfig;
108
- }
109
-
110
- @rpc({ public: true })
111
- public async setConfig(newConfig: T): Promise<void> {
112
- const oldConfig = structuredClone(this.values);
113
-
114
- this.values = mergeWith(this.values, newConfig, (source: any, target: any) => {
115
- if (Array.isArray(source)) {
116
- return target;
117
- }
118
- });
119
-
120
- await this.#triggerOnSetForChanges(oldConfig, this.values);
121
- await this.save();
122
- }
123
-
124
- @rpc({ public: true })
125
- public async addSchema(schema: JsonSchema): Promise<void> {
126
- let shouldSave = false;
127
-
128
- const schemaExist = this.hasSchema(schema.key);
129
- if (schemaExist) {
130
- // this.schemas = this.schemas.map((s) => (s.key === schema.key ? schema : s));
131
- throw new Error(`Schema with key ${schema.key} already exists`);
132
- } else {
133
- this.schemas.push(schema);
134
- }
135
-
136
- await this.#resolveOnGetFunctions(schema);
137
-
138
- if (this.#containsStorableSchema(schema)) {
139
- shouldSave = true;
140
- }
141
-
142
- if (shouldSave) {
143
- await this.save();
144
- }
145
- }
146
-
147
- @rpc({ public: true })
148
- public async removeSchema(key: string): Promise<void> {
149
- const schema = this.schemas.find((schema) => schema.key === key);
150
- this.schemas = this.schemas.filter((schema) => schema.key !== key);
151
- objectPath.del(this.values, key);
152
-
153
- if (schema && this.#containsStorableSchema(schema)) {
154
- await this.save();
155
- }
156
- }
157
-
158
- @rpc({ public: true })
159
- public async changeSchema(key: string, newSchema: Partial<JsonSchema>): Promise<void> {
160
- newSchema.key = key;
161
- const schema = this.schemas.find((schema) => schema.key === newSchema.key);
162
-
163
- if (schema) {
164
- mergeWith(schema, newSchema, (source: any, target: any) => {
165
- if (Array.isArray(source)) {
166
- return target;
167
- }
168
- });
169
-
170
- await this.#resolveOnGetFunctions(schema);
171
-
172
- if (this.#containsStorableSchema(schema)) {
173
- await this.save();
174
- }
175
- }
176
- }
177
-
178
- @rpc({ public: true })
179
- public getSchema<T>(key: string): T | undefined {
180
- return this.schemas.find((schema) => schema.key === key) as T | undefined;
181
- }
182
-
183
- /**
184
- * Check if a schema exists by its config path/key.
185
- *
186
- * @param path - The path to the schema to check.
187
- * @returns True if the schema exists, false otherwise.
188
- */
189
- @rpc({ public: true })
190
- public hasSchema(key: string): boolean {
191
- const schema = this.schemas.find((schema) => schema.key === key);
192
- return !!schema;
193
- }
194
-
195
- @rpc({ public: true })
196
- public async destroy(): Promise<void> {
197
- this.#api.removeListener(API_EVENT.SHUTDOWN, this.#close.bind(this));
198
- const config = this.#pluginDb.get('config') ?? {};
199
- delete config[this.#deviceId];
200
- this.values = {} as T;
201
- await this.#pluginDb.put('config', config);
202
- }
203
-
204
- public async save(): Promise<void> {
205
- const config = this.#pluginDb.get('config') ?? {};
206
- const storableConfig = this.schemas.length ? this.#filterStorableValues(this.schemas) : this.values;
207
- config[this.#deviceId] = storableConfig;
208
- await this.#pluginDb.put('config', config);
209
- }
210
-
211
- // Internal method
212
- public updateSchema(instance: any, schemas: JsonSchema[] = []): void {
213
- this.#instance = instance;
214
- this.schemas = schemas;
215
- this.#initializeStorage();
216
- }
217
-
218
- // Internal method
219
- public async registerStorage(): Promise<void> {
220
- await this.#proxy.registerRPCHandler(this.#storageNamespace, this);
221
- }
222
-
223
- // Internal method
224
- public async unregisterStorage(): Promise<void> {
225
- await this.#proxy.unregisterRPCHandler(this.#storageNamespace);
226
- }
227
-
228
- async #resolveOnGetFunctions(schemas: JsonSchema | JsonSchema[]): Promise<void> {
229
- if (!Array.isArray(schemas)) {
230
- schemas = [schemas];
231
- }
232
-
233
- for (const schema of schemas) {
234
- if (!isButtonType(schema) && !isSubmitType(schema) && typeof schema.onGet === 'function') {
235
- const schemaValue = await this.getValue(schema.key);
236
- if (schemaValue !== undefined && schemaValue !== null) {
237
- objectPath.set(this.values, schema.key, schemaValue);
238
- }
239
- }
240
- }
241
- }
242
-
243
- async #triggerOnSetForChanges(oldConfig: Record<string, any>, newConfig: Record<string, any>): Promise<void> {
244
- const promises: Promise<void>[] = [];
245
-
246
- for (const configKey in newConfig) {
247
- const oldValue = getValueByKey(oldConfig, configKey);
248
- const newValue = newConfig[configKey];
249
-
250
- if (!isEqual(oldValue, newValue, true)) {
251
- const schema = this.schemas.find((schema) => schema.key === configKey);
252
- if (schema && !isSubmitType(schema) && typeof schema.onSet === 'function') {
253
- promises.push(schema.onSet.call(this.#instance, newValue, oldValue));
254
- }
255
- }
256
- }
257
-
258
- await Promise.all(promises);
259
- }
260
-
261
- #filterStorableValues(schemas: JsonSchema[], result: Record<string, any> = {}): Record<string, any> {
262
- for (const schema of schemas) {
263
- if (isButtonType(schema) || isSubmitType(schema)) {
264
- continue;
265
- }
266
-
267
- if (schema.store) {
268
- const configValue = getValueByKey(this.values, schema.key);
269
- objectPath.set(result, schema.key, configValue);
270
- }
271
- }
272
-
273
- return result;
274
- }
275
-
276
- #containsStorableSchema(schema: JsonSchema): boolean {
277
- if (schema.type === 'button' || schema.type === 'submit') {
278
- return false;
279
- }
280
-
281
- if ('store' in schema && schema.store) {
282
- return true;
283
- }
284
-
285
- return false;
286
- }
287
-
288
- async #initializeStorage(): Promise<void> {
289
- const config = this.#pluginDb.get('config') ?? {};
290
- const deviceConfig = config[this.#deviceId] ?? {};
291
- const schemaConfig = generateConfigFromSchemas(this.schemas);
292
-
293
- this.values = mergeWith(schemaConfig, deviceConfig, (source: any, target: any) => {
294
- if (Array.isArray(source)) {
295
- return target;
296
- }
297
-
298
- if (target === undefined) {
299
- return source;
300
- }
301
- });
302
- }
303
-
304
- async #close(): Promise<void> {
305
- try {
306
- await this.save();
307
- await this.unregisterStorage();
308
- } catch {
309
- //
310
- }
311
- }
312
- }
@@ -1,91 +0,0 @@
1
- import { DeviceStorage } from './storage.js';
2
-
3
- import type { ClientInstance } from '@camera.ui/rpc-client';
4
- import type { JsonSchema, StorageController as StorageControllerInterface } from '@camera.ui/types';
5
- import type { RootDatabase } from 'lmdb';
6
- import type { PluginInfo } from '../../types.js';
7
- import type { PluginAPI } from './pluginApi.js';
8
-
9
- export class StorageController implements StorageControllerInterface {
10
- #api: PluginAPI;
11
- #proxy: ClientInstance;
12
- #plugin: PluginInfo;
13
- #pluginDb: RootDatabase<Record<string, any>, 'config'>;
14
- #storages = new Map<string, DeviceStorage<any>>();
15
-
16
- constructor(api: PluginAPI, proxy: ClientInstance, plugin: PluginInfo, pluginDb: RootDatabase<Record<string, any>, 'config'>) {
17
- this.#api = api;
18
- this.#proxy = proxy;
19
- this.#plugin = plugin;
20
- this.#pluginDb = pluginDb;
21
- }
22
-
23
- public createCameraStorage<T extends Record<string, any> = Record<string, any>>(instance: any, cameraId: string, schemas: JsonSchema[] = []): DeviceStorage<T> {
24
- let cameraStorage = this.#storages.get(cameraId);
25
-
26
- if (!cameraStorage) {
27
- cameraStorage = new DeviceStorage<T>(this.#api, this.#proxy, this.#plugin, this.#pluginDb, instance, cameraId, schemas, false);
28
- this.#storages.set(cameraId, cameraStorage);
29
- } else {
30
- cameraStorage.updateSchema(instance, schemas);
31
- }
32
-
33
- return cameraStorage as DeviceStorage<T>;
34
- }
35
-
36
- public createPluginStorage<T extends Record<string, any> = Record<string, any>>(instance: any, schemas: JsonSchema[] = []): DeviceStorage<T> {
37
- let pluginStorage = this.#storages.get('storage');
38
-
39
- if (!pluginStorage) {
40
- pluginStorage = new DeviceStorage<T>(this.#api, this.#proxy, this.#plugin, this.#pluginDb, instance, 'storage', schemas, true);
41
- this.#storages.set('storage', pluginStorage);
42
- } else {
43
- pluginStorage.updateSchema(instance, schemas);
44
- }
45
-
46
- return pluginStorage as DeviceStorage<T>;
47
- }
48
-
49
- public getCameraStorage<T extends Record<string, any> = Record<string, any>>(deviceId: string): DeviceStorage<T> | undefined {
50
- return this.#storages.get(deviceId) as DeviceStorage<T> | undefined;
51
- }
52
-
53
- public getPluginStorage<T extends Record<string, any> = Record<string, any>>(): DeviceStorage<T> | undefined {
54
- return this.#storages.get('storage') as DeviceStorage<T> | undefined;
55
- }
56
-
57
- // Internal method
58
- public async createStorage(type: 'camera', deviceId: string): Promise<DeviceStorage<any>>;
59
- public async createStorage(type: 'plugin'): Promise<DeviceStorage<any>>;
60
- public async createStorage(type: 'camera' | 'plugin', deviceId?: string): Promise<DeviceStorage<any>> {
61
- let storage: DeviceStorage<any> | undefined;
62
-
63
- if (type === 'camera') {
64
- if (!deviceId) {
65
- throw new Error('ID is required for storage creation');
66
- }
67
-
68
- storage = this.createCameraStorage(undefined, deviceId);
69
- } else {
70
- storage = this.createPluginStorage(deviceId);
71
- }
72
-
73
- await storage.registerStorage();
74
- return storage;
75
- }
76
-
77
- // Internal method
78
- public async removeStorage(type: 'camera', deviceId: string): Promise<void>;
79
- public async removeStorage(type: 'plugin'): Promise<void>;
80
- public async removeStorage(type: 'camera' | 'plugin', deviceId?: string): Promise<void> {
81
- const id = type === 'camera' ? deviceId : 'storage';
82
- if (!id) {
83
- throw new Error('ID is required for storage removal');
84
- }
85
-
86
- const deviceStorage = this.#storages.get(id);
87
- await deviceStorage?.destroy();
88
- await deviceStorage?.unregisterStorage();
89
- this.#storages.delete(id);
90
- }
91
- }
File without changes
@@ -1,248 +0,0 @@
1
- import asyncio
2
- import json
3
- import os
4
- import sys
5
- from contextlib import suppress
6
- from pathlib import Path
7
- from typing import Any, Literal, Optional, Union, cast
8
-
9
- import setproctitle
10
- from lmdbm import Lmdb
11
-
12
- from _camera_ui_tools.camera_ui_common import (
13
- LoggerOptions,
14
- LoggerService,
15
- SignalHandler,
16
- TaskSet,
17
- )
18
- from _camera_ui_tools.camera_ui_rpc_client import ClientInstance
19
- from _camera_ui_tools.camera_ui_rpc_client.utils.subscriptions import SubscriptionWrapper
20
- from _camera_ui_tools.camera_ui_types import Camera
21
- from _camera_ui_tools.camera_ui_types import CameraDevice as CameraDeviceInterface
22
- from plugins.runtime.python.namespaces import NamespaceManager
23
- from plugins.runtime.python.plugin import Plugin
24
- from plugins.runtime.python.plugin_api import PluginAPI
25
- from plugins.runtime.python.proxy.camera_device import CameraDeviceProxy
26
- from plugins.runtime.python.proxy.core_manager import CoreManagerProxy
27
- from plugins.runtime.python.proxy.device_manager import DeviceManagerProxy
28
- from plugins.runtime.python.typings import (
29
- API_EVENT,
30
- PLUGIN_COMMAND,
31
- PLUGIN_STATUS,
32
- PluginInfo,
33
- ProcessLoadMessage,
34
- ProcessMessage,
35
- ProcessResponse,
36
- )
37
-
38
- process_name = sys.argv[2] if len(sys.argv) > 2 else sys.argv[1] if len(sys.argv) > 1 else "Plugin"
39
- setproctitle.setproctitle(f"camera.ui - {process_name}")
40
-
41
-
42
- class JsonLmdb(Lmdb[Literal["config"], dict[str, Any]]):
43
- def _pre_key(self, key: Literal["config"]) -> bytes:
44
- return key.encode("utf-8")
45
-
46
- def _post_key(self, key: bytes) -> Literal["config"]:
47
- _key: Any = key.decode("utf-8")
48
- return _key
49
-
50
- def _pre_value(self, value: dict[str, Any]) -> bytes:
51
- return json.dumps(value).encode("utf-8")
52
-
53
- def _post_value(self, value: bytes) -> dict[str, Any]:
54
- return json.loads(value.decode("utf-8"))
55
-
56
-
57
- class PluginChild(ClientInstance):
58
- def __init__(self) -> None:
59
- super().__init__(
60
- "plugin",
61
- {
62
- "endpoints": [endpoint for endpoint in os.environ["PROXY_ENDPOINTS"].split(",")],
63
- "auth": {
64
- "user": os.environ["PROXY_USER"],
65
- "password": os.environ["PROXY_PASSWORD"],
66
- },
67
- "tls": {
68
- "cert": os.environ["PROXY_CERT"],
69
- "key": os.environ["PROXY_KEY"],
70
- "ca": os.environ["PROXY_CA"],
71
- },
72
- "metadata": {
73
- "id": NamespaceManager.plugin_namespaces(os.environ["PLUGIN_ID"])["pluginChild"],
74
- "name": os.environ["PLUGIN_NAME"],
75
- },
76
- "connect": {
77
- "wait_for_server": True,
78
- },
79
- "reconnect": {
80
- "enabled": True,
81
- },
82
- "bundled_connection": False,
83
- },
84
- )
85
-
86
- for key in ["PROXY_USER", "PROXY_PASSWORD", "PROXY_ENDPOINTS", "PROXY_CERT", "PROXY_KEY", "PROXY_CA"]:
87
- if key in os.environ:
88
- del os.environ[key]
89
-
90
- self.display_name = process_name
91
-
92
- logger_options: LoggerOptions = {
93
- "prefix": self.display_name,
94
- "disable_timestamps": os.environ.get("LOGGER_DISABLE_TIMESTAMPS") == "1",
95
- "debug_enabled": os.environ.get("LOGGER_LEVEL") in ["debug", "trace"],
96
- "trace_enabled": os.environ.get("LOGGER_LEVEL") == "trace",
97
- }
98
-
99
- self.logger = LoggerService(logger_options)
100
-
101
- self.api: Optional[PluginAPI] = None
102
- self.plugin: Optional[Plugin] = None
103
- self.plugin_db: Optional[Lmdb[Literal["config"], dict[str, Any]]] = None
104
-
105
- self.subscription: Optional[SubscriptionWrapper] = None
106
- self.tasks: TaskSet = TaskSet(f"{self.display_name} PluginChild")
107
-
108
- self.stopped = False
109
-
110
- self.signal_handler = SignalHandler(
111
- {
112
- "display_name": "[Signal]",
113
- "timeout_duration": 3,
114
- "logger": self.logger,
115
- "close_function": self.stop_plugin,
116
- }
117
- )
118
-
119
- async def run(self) -> None:
120
- try:
121
- self.signal_handler.setup_handlers()
122
- await self.start()
123
- await self.signal_handler.shutdown_event.wait()
124
- except asyncio.CancelledError:
125
- pass
126
- finally:
127
- await self.stop_plugin()
128
-
129
- async def on_start(self) -> None:
130
- self.subscription = await self.on_server_message(self.on_message)
131
- await self.send_message({"type": PLUGIN_STATUS.READY.value})
132
-
133
- async def on_before_stop(self) -> None:
134
- await self.stop_plugin()
135
-
136
- async def on_stop(self) -> None:
137
- pass
138
-
139
- async def start_plugin(self, data: ProcessLoadMessage) -> None:
140
- try:
141
- storage_path = data["storage"]["storagePath"]
142
- plugin_info = data["plugin"]
143
- cameras = data["cameras"]
144
-
145
- self.plugin_db = await self.configure_plugin_db(storage_path)
146
-
147
- self.api = PluginAPI(
148
- self,
149
- plugin_info,
150
- storage_path,
151
- self.logger,
152
- self.plugin_db,
153
- )
154
-
155
- self.plugin = Plugin(self, self.api, plugin_info, self.logger)
156
-
157
- core_manager = cast(CoreManagerProxy, self.api.core_manager)
158
- device_manager = cast(DeviceManagerProxy, self.api.device_manager)
159
-
160
- await device_manager.init()
161
- await core_manager.init()
162
- await self.plugin.load()
163
- await self.configure_cameras(self.api, plugin_info, cameras)
164
-
165
- await self.send_message({"type": PLUGIN_STATUS.STARTED.value})
166
-
167
- await asyncio.sleep(0.1)
168
-
169
- self.api.emit("finishLaunching")
170
- except Exception as e:
171
- await self.send_message({"type": PLUGIN_STATUS.ERROR.value, "error": str(e)})
172
-
173
- async def stop_plugin(self) -> None:
174
- if self.stopped:
175
- return
176
-
177
- self.stopped = True
178
-
179
- if self.api:
180
- self.api.emit(API_EVENT.SHUTDOWN.value)
181
- await asyncio.sleep(0.5)
182
- self.api.cancel()
183
-
184
- if self.plugin_db:
185
- with suppress(Exception):
186
- self.plugin_db.close()
187
-
188
- if self.subscription:
189
- await self.subscription.unsubscribe()
190
- self.subscription = None
191
-
192
- await self.stop()
193
-
194
- async def send_message(self, message: ProcessResponse) -> None:
195
- await self.send_to_server(message)
196
-
197
- async def on_message(self, message: ProcessMessage) -> None:
198
- if self.stopped:
199
- return
200
-
201
- if "type" in message:
202
- if message["type"] == PLUGIN_COMMAND.START.value:
203
- if not message["data"]:
204
- await self.send_message({"type": PLUGIN_STATUS.ERROR.value, "error": "No data provided"})
205
- return
206
-
207
- await self.start_plugin(message["data"])
208
- elif message["type"] == PLUGIN_COMMAND.STOP.value:
209
- await self.stop_plugin()
210
-
211
- async def configure_plugin_db(self, storage_path: str) -> Lmdb[Literal["config"], dict[str, Any]]:
212
- db_path = Path(storage_path) / "volume"
213
- Path(db_path).mkdir(parents=True, exist_ok=True)
214
-
215
- plugin_db: Lmdb[Literal["config"], dict[str, Any]] = JsonLmdb.open(file=str(db_path), flag="c")
216
- config = cast(Union[dict[str, Any], None], plugin_db.get("config"))
217
-
218
- if config is None:
219
- plugin_db.update({"config": {}})
220
-
221
- return plugin_db
222
-
223
- async def configure_cameras(self, api: PluginAPI, plugin_info: PluginInfo, cameras: list[Camera]) -> None:
224
- cameras_devices: list[CameraDeviceProxy] = []
225
-
226
- for camera in cameras:
227
- camera_logger = self.logger.create_logger({"suffix": camera["name"], "logger_id": camera["_id"]})
228
- cameras_devices.append(
229
- CameraDeviceProxy(
230
- self,
231
- api,
232
- camera,
233
- plugin_info,
234
- camera_logger,
235
- )
236
- )
237
-
238
- if self.api:
239
- device_manager = cast(DeviceManagerProxy, self.api.device_manager)
240
- await device_manager.configure_cameras(cameras_devices)
241
-
242
- if self.plugin:
243
- await self.plugin.configureCameras(cast(list[CameraDeviceInterface], cameras_devices))
244
-
245
-
246
- if __name__ == "__main__":
247
- plugin_child = PluginChild()
248
- asyncio.run(plugin_child.run())