@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.BAIU_p3r.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.mdCorqzE.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.D0vsSsly.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.we5ZpWr2.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.9AEBJ3H1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.CZcnEH0C.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.DE0LkcGu.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/Cammesh.CVvmkelB.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.CUr4pGoU.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.CaJhu4fF.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.5VUmgryj.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.iYmUxAR5.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.DXPyE5mF.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.BqtlOFnV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.C_RI-SDQ.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.Ch_v02eN.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.BpXAYgSG.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/Recordings.CIKHJytH.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.BcLoGNEy.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.DMROW8kx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CUaHpihp.0.0.50-internal.2.js +1 -0
- 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.BuKZ-Uco.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.0QdwFSpv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsRecordings.B-aj0U8_.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.Bi1YAJ76.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.CAx66Iir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.CQcDtGy1.0.0.50-internal.2.js} +1 -1
- 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.BhXMzIhV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0sCXSu5.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.DNqPWa0Q.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.DAXgG3bP.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.Bq3YocRX.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.9rxyNw0z.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.BuEvHAsS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.DUdE08x8.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.DWU6YI8o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.BpPyC6E4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.BoR2Rhdd.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BXzPONHs.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.DwcBYfWc.0.0.50-internal.2.js} +3 -3
- package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.BUDVOjPt.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CsG-OBoI.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CqEQao5R.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.D91sslRx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.SdSTPzZO.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.BwroebQ4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.DxM48YSv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.Cmpbnzo4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.DF2YgZo1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.BUs2ineY.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.DmkT2LKx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.dPzyZDVa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.y2ZlFveS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.Y-alCADW.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.sRVFTqDf.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.D5WrXOZa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.R0uz_abA.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.65mnGy-o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.B1Qop6Uu.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.CwmyAcir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.CMPALvRh.0.0.50-internal.2.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +1 -1
- package/dist/server/src/rpc/server.js +4 -1
- package/dist/server/src/rpc/server.js.map +1 -1
- package/package.json +1 -1
- package/.prettierignore +0 -12
- package/.prettierrc.json +0 -12
- package/artillery.yaml +0 -29
- package/bin/cameraui-server.ts +0 -11
- package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
- package/eslint.config.js +0 -103
- package/localdeps.txt +0 -10
- package/mypy.ini +0 -30
- package/requirements.txt +0 -15
- package/ruff.toml +0 -90
- package/src/__init__.py +0 -0
- package/src/_camera_ui_tools/__init__.py +0 -0
- package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/api/controllers/api.controller.ts +0 -19
- package/src/api/controllers/auth.controller.ts +0 -294
- package/src/api/controllers/backup.controller.ts +0 -72
- package/src/api/controllers/cameras.controller.ts +0 -1029
- package/src/api/controllers/config.controller.ts +0 -102
- package/src/api/controllers/files.controller.ts +0 -35
- package/src/api/controllers/frameWorkers.controller.ts +0 -109
- package/src/api/controllers/plugins.controller.ts +0 -1206
- package/src/api/controllers/system.controller.ts +0 -273
- package/src/api/controllers/users.controller.ts +0 -648
- package/src/api/database/checks.ts +0 -268
- package/src/api/database/constants.ts +0 -8
- package/src/api/database/index.ts +0 -262
- package/src/api/database/migration.ts +0 -62
- package/src/api/database/selfcheck.ts +0 -492
- package/src/api/database/types.ts +0 -104
- package/src/api/go2rtc/api/application.ts +0 -48
- package/src/api/go2rtc/api/config.ts +0 -61
- package/src/api/go2rtc/api/discover.ts +0 -197
- package/src/api/go2rtc/api/index.ts +0 -49
- package/src/api/go2rtc/api/snapshot.ts +0 -44
- package/src/api/go2rtc/api/streams.ts +0 -168
- package/src/api/go2rtc/index.ts +0 -43
- package/src/api/go2rtc/queue.ts +0 -50
- package/src/api/go2rtc/types.ts +0 -174
- package/src/api/index.ts +0 -286
- package/src/api/middlewares/authPermission.middleware.ts +0 -46
- package/src/api/middlewares/authValidation.middleware.ts +0 -160
- package/src/api/middlewares/pagination.middleware.ts +0 -67
- package/src/api/middlewares/socketAuth.middleware.ts +0 -136
- package/src/api/plugins/header.plugin.ts +0 -15
- package/src/api/plugins/logger.plugin.ts +0 -44
- package/src/api/plugins/proxy.plugin.ts +0 -255
- package/src/api/plugins/socket.plugin.ts +0 -28
- package/src/api/plugins/system.plugin.ts +0 -48
- package/src/api/plugins/useragent.plugin.ts +0 -19
- package/src/api/routes/api.routes.ts +0 -10
- package/src/api/routes/auth.routes.ts +0 -56
- package/src/api/routes/backup.routes.ts +0 -28
- package/src/api/routes/cameras.routes.ts +0 -281
- package/src/api/routes/config.routes.ts +0 -66
- package/src/api/routes/files.routes.ts +0 -15
- package/src/api/routes/frameWorkers.routes.ts +0 -39
- package/src/api/routes/index.ts +0 -37
- package/src/api/routes/plugins.routes.ts +0 -420
- package/src/api/routes/system.routes.ts +0 -101
- package/src/api/routes/users.routes.ts +0 -167
- package/src/api/schemas/backup.schema.ts +0 -112
- package/src/api/schemas/cameras.schema.ts +0 -479
- package/src/api/schemas/config.schema.ts +0 -38
- package/src/api/schemas/go2rtc.schema.ts +0 -189
- package/src/api/schemas/plugins.schema.ts +0 -126
- package/src/api/schemas/storage.schema.ts +0 -11
- package/src/api/schemas/system.schema.ts +0 -45
- package/src/api/schemas/users.schema.ts +0 -185
- package/src/api/services/auth.service.ts +0 -210
- package/src/api/services/backup.service.ts +0 -144
- package/src/api/services/cameras.service.ts +0 -671
- package/src/api/services/plugins.service.ts +0 -470
- package/src/api/services/system.service.ts +0 -85
- package/src/api/services/users.service.ts +0 -276
- package/src/api/types/index.ts +0 -675
- package/src/api/utils/cert.ts +0 -254
- package/src/api/utils/constants.ts +0 -17
- package/src/api/utils/fetch.ts +0 -21
- package/src/api/utils/moveFiles.ts +0 -45
- package/src/api/utils/parse.ts +0 -17
- package/src/api/websocket/index.ts +0 -110
- package/src/api/websocket/nsp/logs.ts +0 -240
- package/src/api/websocket/nsp/main.ts +0 -27
- package/src/api/websocket/nsp/metrics.ts +0 -301
- package/src/api/websocket/nsp/notifications.ts +0 -43
- package/src/api/websocket/nsp/plugins.ts +0 -37
- package/src/api/websocket/nsp/server.ts +0 -220
- package/src/api/websocket/nsp/status.ts +0 -77
- package/src/api/websocket/types.ts +0 -55
- package/src/api.ts +0 -163
- package/src/camera/classes.ts +0 -32
- package/src/camera/controller.ts +0 -579
- package/src/camera/device.ts +0 -422
- package/src/camera/frameWorker.ts +0 -403
- package/src/camera/index.ts +0 -679
- package/src/camera/interfaces.ts +0 -95
- package/src/camera/iou.ts +0 -153
- package/src/camera/polygon.ts +0 -226
- package/src/camera/python/__init__.py +0 -0
- package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
- package/src/camera/python/classes.py +0 -41
- package/src/camera/python/interfaces.py +0 -130
- package/src/camera/python/iou.py +0 -158
- package/src/camera/python/polygon.py +0 -230
- package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
- package/src/camera/python/test/iou_test.py +0 -799
- package/src/camera/python/test/polygon.py +0 -238
- package/src/camera/python/test/polygon_test.py +0 -256
- package/src/camera/python/test/polygon_test2.py +0 -484
- package/src/camera/python/typings.py +0 -50
- package/src/camera/python/video_frame.py +0 -143
- package/src/camera/session.ts +0 -192
- package/src/camera/streaming/fmp4-session.ts +0 -390
- package/src/camera/streaming/peer-connection.ts +0 -273
- package/src/camera/streaming/rtsp-session.ts +0 -331
- package/src/camera/streaming/webrtc-connection.ts +0 -260
- package/src/camera/streaming/werift-session.ts +0 -317
- package/src/camera/test/iou_test.ts +0 -761
- package/src/camera/test/polygon.test.ts +0 -611
- package/src/camera/test/polygon_test.ts +0 -210
- package/src/camera/types.ts +0 -48
- package/src/camera/utils.ts +0 -489
- package/src/camera/videoFrame.ts +0 -123
- package/src/cloud/index.ts +0 -61
- package/src/cloud/remote/cloudflare.ts +0 -18
- package/src/cloud/remote/upnp.ts +0 -18
- package/src/cloud/remote/utils.ts +0 -24
- package/src/cloud/types.ts +0 -16
- package/src/decoder/child.ts +0 -883
- package/src/decoder/imageUtils.ts +0 -275
- package/src/decoder/manager.ts +0 -251
- package/src/decoder/python/__init__.py +0 -0
- package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
- package/src/decoder/python/child.py +0 -903
- package/src/decoder/python/image_utils.py +0 -196
- package/src/decoder/python/pool.py +0 -45
- package/src/decoder/python/test/group.py +0 -62
- package/src/decoder/python/test/motion.mp4 +0 -0
- package/src/decoder/python/test/motion2.mp4 +0 -0
- package/src/decoder/python/test/opencl.cl +0 -70
- package/src/decoder/python/test/opencl2.cl +0 -130
- package/src/decoder/python/test/test.py +0 -427
- package/src/decoder/python/test/test1.jpg +0 -0
- package/src/decoder/python/test/test1_resized.jpg +0 -0
- package/src/decoder/python/test/test2.jpg +0 -0
- package/src/decoder/python/test/test2.py +0 -451
- package/src/decoder/python/test/test2_resized.jpg +0 -0
- package/src/decoder/python/test/test3.jpg +0 -0
- package/src/decoder/python/test/utils.py +0 -50
- package/src/decoder/python/typings.py +0 -57
- package/src/decoder/python/utils.py +0 -70
- package/src/decoder/test/child.ts +0 -117
- package/src/decoder/test/ffmpeg.ts +0 -371
- package/src/decoder/test/test.ts +0 -182
- package/src/decoder/types.ts +0 -27
- package/src/decoder/utils.ts +0 -64
- package/src/decoder/wasm/asconfig.json +0 -28
- package/src/decoder/wasm/assembly/console.ts +0 -1
- package/src/decoder/wasm/assembly/index.ts +0 -890
- package/src/decoder/wasm/build/decoder.d.ts +0 -43
- package/src/decoder/wasm/build/decoder.js +0 -108
- package/src/decoder/wasm/build/decoder.wasm +0 -0
- package/src/decoder/wasm/tsconfig.json +0 -5
- package/src/decoder/worker.ts +0 -113
- package/src/go2rtc/index.ts +0 -324
- package/src/go2rtc/types.ts +0 -88
- package/src/main.ts +0 -267
- package/src/manager/coreManager.ts +0 -78
- package/src/manager/deviceManager.ts +0 -132
- package/src/manager/types.ts +0 -17
- package/src/plugins/index.ts +0 -443
- package/src/plugins/plugin.ts +0 -177
- package/src/plugins/runtime/base.ts +0 -282
- package/src/plugins/runtime/index.ts +0 -15
- package/src/plugins/runtime/node/child.ts +0 -193
- package/src/plugins/runtime/node/index.ts +0 -67
- package/src/plugins/runtime/node/plugin.ts +0 -122
- package/src/plugins/runtime/node/pluginApi.ts +0 -27
- package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
- package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
- package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
- package/src/plugins/runtime/node/storage.ts +0 -312
- package/src/plugins/runtime/node/storageController.ts +0 -91
- package/src/plugins/runtime/python/__init__.py +0 -0
- package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/child.py +0 -248
- package/src/plugins/runtime/python/index.ts +0 -73
- package/src/plugins/runtime/python/namespaces.py +0 -101
- package/src/plugins/runtime/python/plugin.py +0 -155
- package/src/plugins/runtime/python/plugin_api.py +0 -29
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
- package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
- package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
- package/src/plugins/runtime/python/schema.py +0 -99
- package/src/plugins/runtime/python/storage.py +0 -353
- package/src/plugins/runtime/python/storage_controller.py +0 -102
- package/src/plugins/runtime/python/typings.py +0 -195
- package/src/plugins/schema.ts +0 -472
- package/src/plugins/types.ts +0 -60
- package/src/plugins/worker.ts +0 -250
- package/src/rpc/index.ts +0 -149
- package/src/rpc/namespaces.ts +0 -79
- package/src/rpc/server.ts +0 -422
- package/src/rpc/types.ts +0 -119
- package/src/rpc/utils.ts +0 -16
- package/src/services/config/constants.ts +0 -47
- package/src/services/config/defaults.ts +0 -57
- package/src/services/config/index.ts +0 -744
- package/src/services/config/types.ts +0 -211
- package/src/services/logger/index.ts +0 -96
- package/src/types.ts +0 -47
- package/src/utils/path.ts +0 -16
- package/src/utils/pythonInstaller.ts +0 -597
- package/tsconfig.json +0 -37
- package/types/fastify.d.ts +0 -14
- package/updates.config.js +0 -3
- /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.C-5Lxnx_.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.2.js} +0 -0
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import inspect
|
|
3
|
-
from collections.abc import Awaitable
|
|
4
|
-
from contextlib import suppress
|
|
5
|
-
from copy import deepcopy
|
|
6
|
-
from typing import Any, Callable, Optional, TypeVar, Union, cast
|
|
7
|
-
|
|
8
|
-
from deepdiff.diff import DeepDiff
|
|
9
|
-
from lmdbm import Lmdb
|
|
10
|
-
from typing_extensions import Literal, overload
|
|
11
|
-
|
|
12
|
-
from _camera_ui_tools.camera_ui_common import ObjectPath, merge, merge_with
|
|
13
|
-
from _camera_ui_tools.camera_ui_rpc_client import ClientInstance
|
|
14
|
-
from _camera_ui_tools.camera_ui_rpc_client.utils.rpc import rpc
|
|
15
|
-
from _camera_ui_tools.camera_ui_types import (
|
|
16
|
-
V1,
|
|
17
|
-
FormSubmitResponse,
|
|
18
|
-
JsonSchema,
|
|
19
|
-
PluginAPI,
|
|
20
|
-
SchemaConfig,
|
|
21
|
-
)
|
|
22
|
-
from _camera_ui_tools.camera_ui_types import DeviceStorage as DeviceStorageInterface
|
|
23
|
-
from plugins.runtime.python.namespaces import (
|
|
24
|
-
NamespaceManager,
|
|
25
|
-
PluginAndPluginCameraNamespaces,
|
|
26
|
-
)
|
|
27
|
-
from plugins.runtime.python.schema import (
|
|
28
|
-
generate_config_from_schemas,
|
|
29
|
-
get_value_by_key,
|
|
30
|
-
remove_callbacks_from_schemas,
|
|
31
|
-
)
|
|
32
|
-
from plugins.runtime.python.typings import API_EVENT, PluginInfo
|
|
33
|
-
|
|
34
|
-
P = TypeVar("P", str, int, float, bool, dict[Any, Any], list[Any], None)
|
|
35
|
-
|
|
36
|
-
TKey = Union[str, int, None]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def merge2(
|
|
40
|
-
source: Any,
|
|
41
|
-
target: Any,
|
|
42
|
-
key: TKey,
|
|
43
|
-
source_object: Union[dict[Any, Any], list[Any], Any], # TSource
|
|
44
|
-
target_object: Union[dict[Any, Any], list[Any], Any], # TTarget
|
|
45
|
-
stack: list[Any],
|
|
46
|
-
) -> Any:
|
|
47
|
-
if isinstance(source, list):
|
|
48
|
-
return target
|
|
49
|
-
if target is None:
|
|
50
|
-
return source
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class DeviceStorage(DeviceStorageInterface):
|
|
55
|
-
def __init__(
|
|
56
|
-
self,
|
|
57
|
-
api: PluginAPI,
|
|
58
|
-
proxy: ClientInstance,
|
|
59
|
-
plugin: PluginInfo,
|
|
60
|
-
plugin_db: Lmdb[Literal["config"], dict[str, Any]],
|
|
61
|
-
instance: Any,
|
|
62
|
-
device_id: str,
|
|
63
|
-
schemas: Optional[list[JsonSchema]] = [],
|
|
64
|
-
is_plugin_storage: bool = False,
|
|
65
|
-
) -> None:
|
|
66
|
-
if schemas is None:
|
|
67
|
-
schemas = []
|
|
68
|
-
|
|
69
|
-
self.schemas: list[JsonSchema] = schemas
|
|
70
|
-
self.values: dict[str, Any] = {}
|
|
71
|
-
|
|
72
|
-
self.__api = api
|
|
73
|
-
self.__proxy = proxy
|
|
74
|
-
self.__plugin = plugin
|
|
75
|
-
self.__plugin_db = plugin_db
|
|
76
|
-
self.__instance = instance
|
|
77
|
-
self.__device_id = device_id
|
|
78
|
-
self.__is_plugin_storage = is_plugin_storage
|
|
79
|
-
|
|
80
|
-
namespaces: PluginAndPluginCameraNamespaces = {
|
|
81
|
-
**NamespaceManager.plugin_camera_namespaces(plugin["id"], device_id),
|
|
82
|
-
**NamespaceManager.plugin_namespaces(plugin["id"]),
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
self.__storage_namespace = (
|
|
86
|
-
namespaces["cameraStorageRpc"] if not is_plugin_storage else namespaces["pluginStorageRpc"]
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
self.__api.once(API_EVENT.SHUTDOWN.value, self.__close)
|
|
90
|
-
|
|
91
|
-
@overload
|
|
92
|
-
async def getValue(self, key: str) -> Union[V1, None]: ...
|
|
93
|
-
@overload
|
|
94
|
-
async def getValue(self, key: str, default_value: V1) -> V1: ...
|
|
95
|
-
@rpc(public=True)
|
|
96
|
-
async def getValue(self, key: str, default_value: Optional[V1] = None) -> Union[V1, None]:
|
|
97
|
-
schema: Any = next((schema for schema in self.schemas if schema["key"] == key), None)
|
|
98
|
-
config_value = ObjectPath.get(self.values, key)
|
|
99
|
-
schema_default_value = (
|
|
100
|
-
schema["defaultValue"] if "defaultValue" in schema and schema["defaultValue"] else None
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
if schema:
|
|
104
|
-
on_get_function = schema.get("onGet", None)
|
|
105
|
-
if on_get_function is not None:
|
|
106
|
-
if inspect.iscoroutinefunction(on_get_function):
|
|
107
|
-
return await on_get_function()
|
|
108
|
-
else:
|
|
109
|
-
res = on_get_function()
|
|
110
|
-
|
|
111
|
-
if inspect.iscoroutine(res):
|
|
112
|
-
return await res
|
|
113
|
-
else:
|
|
114
|
-
return on_get_function() # type: ignore
|
|
115
|
-
|
|
116
|
-
if config_value is not None:
|
|
117
|
-
return config_value
|
|
118
|
-
|
|
119
|
-
if schema_default_value is not None:
|
|
120
|
-
return schema_default_value
|
|
121
|
-
|
|
122
|
-
if default_value is not None:
|
|
123
|
-
return default_value
|
|
124
|
-
|
|
125
|
-
return None
|
|
126
|
-
|
|
127
|
-
@rpc(public=True)
|
|
128
|
-
async def setValue(self, key: str, new_value: Any) -> None:
|
|
129
|
-
schema: Any = next((schema for schema in self.schemas if schema["key"] == key), None)
|
|
130
|
-
|
|
131
|
-
if schema:
|
|
132
|
-
old_value = ObjectPath.get(self.values, key)
|
|
133
|
-
ObjectPath.set(self.values, key, new_value)
|
|
134
|
-
|
|
135
|
-
on_set_function = schema.get("onSet", None)
|
|
136
|
-
if on_set_function:
|
|
137
|
-
if inspect.iscoroutinefunction(on_set_function):
|
|
138
|
-
await on_set_function(new_value, old_value)
|
|
139
|
-
else:
|
|
140
|
-
res = on_set_function(new_value, old_value)
|
|
141
|
-
|
|
142
|
-
if inspect.iscoroutine(res):
|
|
143
|
-
await res
|
|
144
|
-
else:
|
|
145
|
-
on_set_function(new_value, old_value)
|
|
146
|
-
|
|
147
|
-
if self.__contains_storable_schema(schema):
|
|
148
|
-
self.save()
|
|
149
|
-
|
|
150
|
-
@rpc(public=True)
|
|
151
|
-
async def submitValue(self, key: str, new_value: Any) -> Union[FormSubmitResponse, None]:
|
|
152
|
-
schema: Any = next((schema for schema in self.schemas if schema["key"] == key), None)
|
|
153
|
-
|
|
154
|
-
if schema and schema["type"] == "submit":
|
|
155
|
-
on_click_function = schema.get("onClick", None)
|
|
156
|
-
if on_click_function:
|
|
157
|
-
if inspect.iscoroutinefunction(on_click_function):
|
|
158
|
-
return await on_click_function(new_value)
|
|
159
|
-
else:
|
|
160
|
-
res = on_click_function(new_value)
|
|
161
|
-
|
|
162
|
-
if inspect.iscoroutine(res):
|
|
163
|
-
return await res
|
|
164
|
-
else:
|
|
165
|
-
return on_click_function(new_value)
|
|
166
|
-
|
|
167
|
-
return None
|
|
168
|
-
|
|
169
|
-
@rpc(public=True)
|
|
170
|
-
def hasValue(self, key: str) -> bool:
|
|
171
|
-
config_value = ObjectPath.get(self.values, key)
|
|
172
|
-
return config_value is not None
|
|
173
|
-
|
|
174
|
-
@rpc(public=True)
|
|
175
|
-
async def getConfig(self) -> SchemaConfig:
|
|
176
|
-
await self.__resolve_on_get_functions(self.schemas)
|
|
177
|
-
filtered_schema: Any = remove_callbacks_from_schemas(self.schemas)
|
|
178
|
-
schema_config: SchemaConfig = {"schema": filtered_schema, "config": self.values}
|
|
179
|
-
return schema_config
|
|
180
|
-
|
|
181
|
-
@rpc(public=True)
|
|
182
|
-
async def setConfig(self, new_config: dict[str, Any]) -> None:
|
|
183
|
-
old_config = deepcopy(self.values)
|
|
184
|
-
self.values = merge_with(self.values, new_config, merge)
|
|
185
|
-
|
|
186
|
-
await self.__trigger_on_set_for_changes(old_config, self.values)
|
|
187
|
-
self.save()
|
|
188
|
-
|
|
189
|
-
@rpc(public=True)
|
|
190
|
-
async def addSchema(self, schema: JsonSchema) -> None:
|
|
191
|
-
should_save = False
|
|
192
|
-
|
|
193
|
-
schema_exist = next((schema for schema in self.schemas if schema["key"] == schema["key"]), None)
|
|
194
|
-
|
|
195
|
-
if schema_exist:
|
|
196
|
-
raise Exception(f"Schema with key {schema['key']} already exists")
|
|
197
|
-
else:
|
|
198
|
-
self.schemas.append(schema)
|
|
199
|
-
|
|
200
|
-
await self.__resolve_on_get_functions(schema)
|
|
201
|
-
|
|
202
|
-
if self.__contains_storable_schema(schema):
|
|
203
|
-
should_save = True
|
|
204
|
-
|
|
205
|
-
if should_save:
|
|
206
|
-
self.save()
|
|
207
|
-
|
|
208
|
-
@rpc(public=True)
|
|
209
|
-
def removeSchema(self, key: str) -> None:
|
|
210
|
-
schema = next((schema for schema in self.schemas if schema["key"] == key), None)
|
|
211
|
-
self.schemas = [s for s in self.schemas if s["key"] != key]
|
|
212
|
-
ObjectPath.delete(self.values, key)
|
|
213
|
-
|
|
214
|
-
if schema and self.__contains_storable_schema(schema):
|
|
215
|
-
self.save()
|
|
216
|
-
|
|
217
|
-
@rpc(public=True)
|
|
218
|
-
async def changeSchema(self, key: str, new_schema: dict[str, Any]) -> None:
|
|
219
|
-
new_schema["key"] = key
|
|
220
|
-
schema = next((schema for schema in self.schemas if schema["key"] == new_schema["key"]), None)
|
|
221
|
-
|
|
222
|
-
if schema:
|
|
223
|
-
merge_with(schema, new_schema, merge)
|
|
224
|
-
|
|
225
|
-
await self.__resolve_on_get_functions(schema)
|
|
226
|
-
|
|
227
|
-
if self.__contains_storable_schema(schema):
|
|
228
|
-
self.save()
|
|
229
|
-
|
|
230
|
-
@rpc(public=True)
|
|
231
|
-
def getSchema(self, key: str) -> Optional[JsonSchema]:
|
|
232
|
-
return next((schema for schema in self.schemas if schema["key"] == key), None)
|
|
233
|
-
|
|
234
|
-
@rpc(public=True)
|
|
235
|
-
def hasSchema(self, key: str) -> bool:
|
|
236
|
-
return any(schema["key"] == key for schema in self.schemas)
|
|
237
|
-
|
|
238
|
-
@rpc(public=True)
|
|
239
|
-
async def destroy(self) -> None:
|
|
240
|
-
self.__api.remove_listener(API_EVENT.SHUTDOWN.value, self.__close)
|
|
241
|
-
config: Any = cast(dict[str, Any], self.__plugin_db.get("config") or {})
|
|
242
|
-
if self.__device_id in config:
|
|
243
|
-
del config[self.__device_id]
|
|
244
|
-
self.values = {}
|
|
245
|
-
self.__plugin_db.update({"config": config})
|
|
246
|
-
|
|
247
|
-
def save(self) -> None:
|
|
248
|
-
config: Any = cast(dict[str, Any], self.__plugin_db.get("config") or {})
|
|
249
|
-
|
|
250
|
-
if len(self.schemas) > 0:
|
|
251
|
-
storable_config = self.__filter_storable_values(self.schemas)
|
|
252
|
-
else:
|
|
253
|
-
storable_config = self.values
|
|
254
|
-
|
|
255
|
-
config[self.__device_id] = storable_config
|
|
256
|
-
self.__plugin_db.update({"config": config})
|
|
257
|
-
|
|
258
|
-
# Internal method
|
|
259
|
-
def update_schema(self, instance: Any, schemas: list[JsonSchema] = []) -> None:
|
|
260
|
-
self.__instance = instance
|
|
261
|
-
self.schemas = schemas
|
|
262
|
-
self.__initializeStorage()
|
|
263
|
-
|
|
264
|
-
# Internal method
|
|
265
|
-
async def register_storage(self) -> None:
|
|
266
|
-
await self.__proxy.register_rpc_handler(self.__storage_namespace, self)
|
|
267
|
-
|
|
268
|
-
# Internal method
|
|
269
|
-
async def unregister_storage(self) -> None:
|
|
270
|
-
await self.__proxy.unregister_rpc_handler(self.__storage_namespace)
|
|
271
|
-
|
|
272
|
-
async def __resolve_on_get_functions(
|
|
273
|
-
self,
|
|
274
|
-
schemas: Union[JsonSchema, list[JsonSchema]],
|
|
275
|
-
) -> None:
|
|
276
|
-
if not isinstance(schemas, list):
|
|
277
|
-
schemas = [schemas]
|
|
278
|
-
|
|
279
|
-
for schema in schemas:
|
|
280
|
-
if schema["type"] != "button" and schema["type"] != "submit" and "onGet" in schema:
|
|
281
|
-
schema_value = await self.getValue(schema["key"])
|
|
282
|
-
if schema_value is not None:
|
|
283
|
-
ObjectPath.set(self.values, schema["key"], schema_value)
|
|
284
|
-
|
|
285
|
-
async def __trigger_on_set_for_changes(
|
|
286
|
-
self, old_config: dict[str, Any], new_config: dict[str, Any]
|
|
287
|
-
) -> None:
|
|
288
|
-
tasks: list[Awaitable[Union[None, Any]]] = []
|
|
289
|
-
|
|
290
|
-
for config_key, _ in new_config.items():
|
|
291
|
-
old_value: Any = get_value_by_key(old_config, config_key) or {}
|
|
292
|
-
new_value: Any = new_config[config_key]
|
|
293
|
-
|
|
294
|
-
if DeepDiff(old_value, new_value, ignore_order=True) != {}:
|
|
295
|
-
schema = next((schema for schema in self.schemas if schema["key"] == config_key), None)
|
|
296
|
-
if schema and schema["type"] != "submit" and "onSet" in schema:
|
|
297
|
-
on_set_function: Any = schema.get("onSet", None)
|
|
298
|
-
if on_set_function:
|
|
299
|
-
|
|
300
|
-
async def process_on_set(
|
|
301
|
-
func: Union[
|
|
302
|
-
Callable[[Any, Any], Awaitable[Union[None, Any]]],
|
|
303
|
-
Callable[[Any, Any], Union[None, Any]],
|
|
304
|
-
],
|
|
305
|
-
new_val: Any,
|
|
306
|
-
old_val: Any,
|
|
307
|
-
) -> None:
|
|
308
|
-
if inspect.iscoroutinefunction(func):
|
|
309
|
-
await func(new_val, old_val)
|
|
310
|
-
else:
|
|
311
|
-
res = func(new_val, old_val)
|
|
312
|
-
if inspect.iscoroutine(res):
|
|
313
|
-
await res
|
|
314
|
-
|
|
315
|
-
tasks.append(process_on_set(on_set_function, new_value, old_value))
|
|
316
|
-
|
|
317
|
-
if tasks:
|
|
318
|
-
await asyncio.gather(*tasks)
|
|
319
|
-
|
|
320
|
-
def __filter_storable_values(
|
|
321
|
-
self,
|
|
322
|
-
schemas: list[JsonSchema],
|
|
323
|
-
result: dict[str, Any] = {},
|
|
324
|
-
) -> dict[str, Any]:
|
|
325
|
-
for schema in schemas:
|
|
326
|
-
if schema["type"] == "button" or schema["type"] == "submit":
|
|
327
|
-
continue
|
|
328
|
-
|
|
329
|
-
if "store" in schema and schema["store"]:
|
|
330
|
-
config_value = get_value_by_key(self.values, schema["key"])
|
|
331
|
-
ObjectPath.set(result, schema["key"], config_value)
|
|
332
|
-
|
|
333
|
-
return result
|
|
334
|
-
|
|
335
|
-
def __contains_storable_schema(
|
|
336
|
-
self,
|
|
337
|
-
schema: JsonSchema,
|
|
338
|
-
) -> bool:
|
|
339
|
-
if schema["type"] == "button" or schema["type"] == "submit":
|
|
340
|
-
return False
|
|
341
|
-
|
|
342
|
-
return bool("store" in schema and schema["store"])
|
|
343
|
-
|
|
344
|
-
def __initializeStorage(self) -> None:
|
|
345
|
-
config: Any = cast(dict[str, Any], self.__plugin_db.get("config") or {})
|
|
346
|
-
device_config = config.get(self.__device_id, {})
|
|
347
|
-
schema_config = generate_config_from_schemas(self.schemas)
|
|
348
|
-
self.values = merge_with(schema_config, device_config, merge2)
|
|
349
|
-
|
|
350
|
-
async def __close(self) -> None:
|
|
351
|
-
with suppress(Exception):
|
|
352
|
-
self.save()
|
|
353
|
-
await self.unregister_storage()
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
from typing import Any, Literal, Optional, overload
|
|
2
|
-
|
|
3
|
-
from lmdbm import Lmdb
|
|
4
|
-
|
|
5
|
-
from _camera_ui_tools.camera_ui_rpc_client import ClientInstance
|
|
6
|
-
from _camera_ui_tools.camera_ui_types import JsonSchema, PluginAPI
|
|
7
|
-
from _camera_ui_tools.camera_ui_types import StorageController as StorageControllerInterface
|
|
8
|
-
from plugins.runtime.python.storage import DeviceStorage
|
|
9
|
-
from plugins.runtime.python.typings import PluginInfo
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class StorageController(StorageControllerInterface):
|
|
13
|
-
def __init__(
|
|
14
|
-
self,
|
|
15
|
-
api: PluginAPI,
|
|
16
|
-
proxy: ClientInstance,
|
|
17
|
-
plugin: PluginInfo,
|
|
18
|
-
plugin_db: Lmdb[Literal["config"], dict[str, Any]],
|
|
19
|
-
) -> None:
|
|
20
|
-
self.__api = api
|
|
21
|
-
self.__proxy = proxy
|
|
22
|
-
self.__plugin = plugin
|
|
23
|
-
self.__storages: dict[str, DeviceStorage] = {}
|
|
24
|
-
self.__plugin_db = plugin_db
|
|
25
|
-
|
|
26
|
-
def create_camera_storage(
|
|
27
|
-
self, instance: Any, camera_id: str, schemas: Optional[list[JsonSchema]] = []
|
|
28
|
-
) -> DeviceStorage:
|
|
29
|
-
if schemas is None:
|
|
30
|
-
schemas = []
|
|
31
|
-
|
|
32
|
-
camera_storage = self.__storages.get(camera_id)
|
|
33
|
-
|
|
34
|
-
if not camera_storage:
|
|
35
|
-
camera_storage = DeviceStorage(
|
|
36
|
-
self.__api, self.__proxy, self.__plugin, self.__plugin_db, instance, camera_id, schemas, False
|
|
37
|
-
)
|
|
38
|
-
self.__storages[camera_id] = camera_storage
|
|
39
|
-
else:
|
|
40
|
-
camera_storage.update_schema(instance, schemas)
|
|
41
|
-
|
|
42
|
-
return camera_storage
|
|
43
|
-
|
|
44
|
-
def create_plugin_storage(self, instance: Any, schemas: Optional[list[JsonSchema]] = []) -> DeviceStorage:
|
|
45
|
-
if schemas is None:
|
|
46
|
-
schemas = []
|
|
47
|
-
|
|
48
|
-
plugin_storage = self.__storages.get("storage")
|
|
49
|
-
|
|
50
|
-
if not plugin_storage:
|
|
51
|
-
plugin_storage = DeviceStorage(
|
|
52
|
-
self.__api, self.__proxy, self.__plugin, self.__plugin_db, instance, "storage", schemas, True
|
|
53
|
-
)
|
|
54
|
-
self.__storages["storage"] = plugin_storage
|
|
55
|
-
else:
|
|
56
|
-
plugin_storage.update_schema(instance, schemas)
|
|
57
|
-
|
|
58
|
-
return plugin_storage
|
|
59
|
-
|
|
60
|
-
def get_camera_storage(self, camera_id: str) -> Optional[DeviceStorage]:
|
|
61
|
-
return self.__storages.get(camera_id)
|
|
62
|
-
|
|
63
|
-
def get_plugin_storage(self) -> Optional[DeviceStorage]:
|
|
64
|
-
return self.__storages.get("storage")
|
|
65
|
-
|
|
66
|
-
# Internal method
|
|
67
|
-
@overload
|
|
68
|
-
async def create_storage(self, type_: Literal["camera"], device_id: str) -> DeviceStorage: ...
|
|
69
|
-
@overload
|
|
70
|
-
async def create_storage(
|
|
71
|
-
self, type_: Literal["plugin"], device_id: Optional[str] = None
|
|
72
|
-
) -> DeviceStorage: ...
|
|
73
|
-
async def create_storage(
|
|
74
|
-
self, type_: Literal["camera", "plugin"], device_id: Optional[str] = None
|
|
75
|
-
) -> DeviceStorage:
|
|
76
|
-
storage: Optional[DeviceStorage] = None
|
|
77
|
-
|
|
78
|
-
if type_ == "camera":
|
|
79
|
-
if not device_id:
|
|
80
|
-
raise ValueError("ID is required for storage creation")
|
|
81
|
-
|
|
82
|
-
storage = self.create_camera_storage(None, device_id)
|
|
83
|
-
else:
|
|
84
|
-
storage = self.create_plugin_storage(None)
|
|
85
|
-
|
|
86
|
-
await storage.register_storage()
|
|
87
|
-
return storage
|
|
88
|
-
|
|
89
|
-
# Internal method
|
|
90
|
-
@overload
|
|
91
|
-
async def remove_storage(self, type_: Literal["camera"], device_id: str) -> None: ...
|
|
92
|
-
@overload
|
|
93
|
-
async def remove_storage(self, type_: Literal["plugin"], device_id: None) -> None: ...
|
|
94
|
-
async def remove_storage(self, type_: Literal["camera", "plugin"], device_id: Optional[str]) -> None:
|
|
95
|
-
id = device_id if type_ == "camera" else "storage"
|
|
96
|
-
if not id:
|
|
97
|
-
raise ValueError("ID is required for storage removal")
|
|
98
|
-
|
|
99
|
-
if id in self.__storages:
|
|
100
|
-
await self.__storages[id].destroy()
|
|
101
|
-
await self.__storages[id].unregister_storage()
|
|
102
|
-
del self.__storages[id]
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
from collections.abc import AsyncGenerator
|
|
2
|
-
from enum import Enum
|
|
3
|
-
from typing import (
|
|
4
|
-
Optional,
|
|
5
|
-
Protocol,
|
|
6
|
-
overload,
|
|
7
|
-
runtime_checkable,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
from typing_extensions import Literal, NotRequired, TypedDict
|
|
11
|
-
|
|
12
|
-
from _camera_ui_tools.camera_ui_types import (
|
|
13
|
-
AudioSetEvent,
|
|
14
|
-
BatterySetEvent,
|
|
15
|
-
Camera,
|
|
16
|
-
CameraConfig,
|
|
17
|
-
CameraDeviceCapability,
|
|
18
|
-
CameraExtension,
|
|
19
|
-
DoorbellSetEvent,
|
|
20
|
-
FfmpegArgs,
|
|
21
|
-
HWAccelOptions,
|
|
22
|
-
IceServer,
|
|
23
|
-
ImageOptions,
|
|
24
|
-
LightSetEvent,
|
|
25
|
-
MotionSetEvent,
|
|
26
|
-
ObjectSetEvent,
|
|
27
|
-
PartialCameraConfig,
|
|
28
|
-
ProbeConfig,
|
|
29
|
-
ProbeStream,
|
|
30
|
-
PTZInterface,
|
|
31
|
-
SirenSetEvent,
|
|
32
|
-
SnapshotInterface,
|
|
33
|
-
StateValues,
|
|
34
|
-
StreamingInterface,
|
|
35
|
-
VideoFrame,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class ProcessLoadMessage(TypedDict):
|
|
40
|
-
cameras: list[Camera]
|
|
41
|
-
plugin: "PluginInfo"
|
|
42
|
-
storage: "PluginStorage"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class ProcessMessage(TypedDict):
|
|
46
|
-
type: str
|
|
47
|
-
data: Optional[ProcessLoadMessage]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class ProcessResponse(TypedDict):
|
|
51
|
-
type: str
|
|
52
|
-
error: NotRequired[Optional[str]]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class API_EVENT(Enum):
|
|
56
|
-
SHUTDOWN = "shutdown"
|
|
57
|
-
FINISH_LAUNCHING = "finishLaunching"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class PLUGIN_STATUS(Enum):
|
|
61
|
-
READY = "ready"
|
|
62
|
-
STARTING = "starting"
|
|
63
|
-
STARTED = "started"
|
|
64
|
-
STOPPING = "stopping"
|
|
65
|
-
STOPPED = "stopped"
|
|
66
|
-
ERROR = "error"
|
|
67
|
-
UNKNOWN = "unknown"
|
|
68
|
-
DISABLED = "disabled"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class PLUGIN_COMMAND(Enum):
|
|
72
|
-
START = "start"
|
|
73
|
-
STOP = "stop"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class PluginStorage(TypedDict):
|
|
77
|
-
installPath: str
|
|
78
|
-
storagePath: str
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
class PluginInfo(TypedDict):
|
|
82
|
-
id: str
|
|
83
|
-
name: str
|
|
84
|
-
contract: "PluginContract"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class PluginContract(TypedDict):
|
|
88
|
-
extensions: list[CameraExtension]
|
|
89
|
-
dependencies: NotRequired[list[str]]
|
|
90
|
-
pythonVersion: NotRequired[str]
|
|
91
|
-
bundled: NotRequired[bool]
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
class RefreshedStates(TypedDict):
|
|
95
|
-
camera: Camera
|
|
96
|
-
states: StateValues
|
|
97
|
-
cameraState: bool
|
|
98
|
-
frameWorkerState: bool
|
|
99
|
-
capabilities: list["PluginCapabilities"]
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@runtime_checkable
|
|
103
|
-
class CoreManagerInterface(Protocol):
|
|
104
|
-
async def getFFmpegPath(self) -> str: ...
|
|
105
|
-
async def getHwaccelInfo(self, options: HWAccelOptions) -> list[FfmpegArgs]: ...
|
|
106
|
-
async def getServerAddresses(self) -> list[str]: ...
|
|
107
|
-
async def getIceServers(self) -> list[IceServer]: ...
|
|
108
|
-
async def getPlugin(self, plugin_name: str) -> Optional[PluginInfo]: ...
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@runtime_checkable
|
|
112
|
-
class DeviceManagerInterface(Protocol):
|
|
113
|
-
async def createCamera(self, camera_config: CameraConfig, plugin_id: str) -> Camera: ...
|
|
114
|
-
async def updateCamera(
|
|
115
|
-
self, camera_id_or_name: str, camera_config: PartialCameraConfig, plugin_id: str
|
|
116
|
-
) -> Camera: ...
|
|
117
|
-
async def getCamera(self, camera_id_or_name: str, plugin_id: str) -> Optional[Camera]: ...
|
|
118
|
-
async def removeCamera(self, camera_id_or_name: str, plugin_id: str) -> None: ...
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
@runtime_checkable
|
|
122
|
-
class CameraDeviceInterface(Protocol):
|
|
123
|
-
async def connect(self) -> None: ...
|
|
124
|
-
async def disconnect(self) -> None: ...
|
|
125
|
-
async def addPluginCapabilities(
|
|
126
|
-
self, plugin_id: str, capabilities: list[CameraDeviceCapability]
|
|
127
|
-
) -> None: ...
|
|
128
|
-
async def removePluginCapabilities(
|
|
129
|
-
self, plugin_id: str, capabilities: Optional[list[CameraDeviceCapability]] = []
|
|
130
|
-
) -> None: ...
|
|
131
|
-
@overload
|
|
132
|
-
def getFrames(
|
|
133
|
-
self, frame_type: Literal["stream"], options: Optional[ImageOptions] = None
|
|
134
|
-
) -> AsyncGenerator[VideoFrame, None]: ...
|
|
135
|
-
@overload
|
|
136
|
-
def getFrames(
|
|
137
|
-
self, frame_type: Literal["motion"], options: Optional[ImageOptions] = None
|
|
138
|
-
) -> AsyncGenerator[VideoFrame, None]: ...
|
|
139
|
-
@overload
|
|
140
|
-
async def updateState(
|
|
141
|
-
self,
|
|
142
|
-
state_name: Literal["light"],
|
|
143
|
-
event_data: LightSetEvent,
|
|
144
|
-
) -> None: ...
|
|
145
|
-
@overload
|
|
146
|
-
async def updateState(
|
|
147
|
-
self,
|
|
148
|
-
state_name: Literal["motion"],
|
|
149
|
-
event_data: MotionSetEvent,
|
|
150
|
-
frame: Optional[VideoFrame] = None,
|
|
151
|
-
) -> None: ...
|
|
152
|
-
@overload
|
|
153
|
-
async def updateState(
|
|
154
|
-
self,
|
|
155
|
-
state_name: Literal["audio"],
|
|
156
|
-
event_data: AudioSetEvent,
|
|
157
|
-
) -> None: ...
|
|
158
|
-
@overload
|
|
159
|
-
async def updateState(
|
|
160
|
-
self,
|
|
161
|
-
state_name: Literal["object"],
|
|
162
|
-
event_data: ObjectSetEvent,
|
|
163
|
-
) -> None: ...
|
|
164
|
-
@overload
|
|
165
|
-
async def updateState(
|
|
166
|
-
self,
|
|
167
|
-
state_name: Literal["doorbell"],
|
|
168
|
-
event_data: DoorbellSetEvent,
|
|
169
|
-
) -> None: ...
|
|
170
|
-
@overload
|
|
171
|
-
async def updateState(
|
|
172
|
-
self,
|
|
173
|
-
state_name: Literal["siren"],
|
|
174
|
-
event_data: SirenSetEvent,
|
|
175
|
-
) -> None: ...
|
|
176
|
-
@overload
|
|
177
|
-
async def updateState(
|
|
178
|
-
self,
|
|
179
|
-
state_name: Literal["battery"],
|
|
180
|
-
event_data: BatterySetEvent,
|
|
181
|
-
) -> None: ...
|
|
182
|
-
async def refreshStates(self) -> RefreshedStates: ...
|
|
183
|
-
async def snapshot(self, source_id: str, force_new: Optional[bool]) -> Optional[bytes]: ...
|
|
184
|
-
async def probeStream(
|
|
185
|
-
self, source_id: str, probe_config: Optional[ProbeConfig], refresh: Optional[bool]
|
|
186
|
-
) -> Optional[ProbeStream]: ...
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
class CameraInterfaces(PTZInterface, SnapshotInterface, StreamingInterface):
|
|
190
|
-
pass
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
class PluginCapabilities(TypedDict):
|
|
194
|
-
pluginId: str
|
|
195
|
-
capabilities: list[CameraDeviceCapability]
|