@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.
- package/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
- package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.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.kxAPXcBy.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.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.MmrWYW3K.0.0.50-internal.1.js} +1 -1
- 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
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
- 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
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
- 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
- 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
- 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
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
- 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
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
- 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
- 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
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
- 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
- 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
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
- 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
- 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
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +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/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.1.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.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.1.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.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.1.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.1.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.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.1.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
package/src/plugins/schema.ts
DELETED
|
@@ -1,472 +0,0 @@
|
|
|
1
|
-
import { isEqual } from '@camera.ui/common/utils';
|
|
2
|
-
import * as zod from 'zod';
|
|
3
|
-
|
|
4
|
-
import type {
|
|
5
|
-
JsonNumberSchema,
|
|
6
|
-
JsonSchema,
|
|
7
|
-
JsonSchemaArray,
|
|
8
|
-
JsonSchemaBoolean,
|
|
9
|
-
JsonSchemaButton,
|
|
10
|
-
JsonSchemaEnum,
|
|
11
|
-
JsonSchemaNumber,
|
|
12
|
-
JsonSchemaString,
|
|
13
|
-
JsonSchemaSubmit,
|
|
14
|
-
JsonSchemaWithoutCallbacks,
|
|
15
|
-
JsonSchemaWithoutKey,
|
|
16
|
-
JsonStringSchema,
|
|
17
|
-
} from '@camera.ui/types';
|
|
18
|
-
|
|
19
|
-
// Type guards for schema identification
|
|
20
|
-
export const isStringType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaString => {
|
|
21
|
-
return schema.type === 'string' && !('enum' in schema);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const isNumberType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaNumber => {
|
|
25
|
-
return schema.type === 'number';
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const isBooleanType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaBoolean => {
|
|
29
|
-
return schema.type === 'boolean';
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const isEnumType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaEnum => {
|
|
33
|
-
return schema.type === 'string' && 'enum' in schema;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const isArrayType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaArray => {
|
|
37
|
-
return schema.type === 'array';
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const isButtonType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaButton => {
|
|
41
|
-
return schema.type === 'button';
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const isSubmitType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaSubmit => {
|
|
45
|
-
return schema.type === 'submit';
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const isValidableStringType = (schema: JsonSchemaWithoutKey): schema is JsonSchemaString => {
|
|
49
|
-
return isStringType(schema) && (!schema.format || (schema.format !== 'qrCode' && schema.format !== 'image'));
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const isConfigDefault = (config: Record<string, any>, schemas: JsonSchema[]): boolean => {
|
|
53
|
-
// Early exit for empty config
|
|
54
|
-
if (!config || Object.keys(config).length === 0) {
|
|
55
|
-
return true; // Empty config is considered default
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Filter out button and submit types as they don't have values
|
|
59
|
-
const validSchemas = schemas.filter((schema) => !isButtonType(schema) && !isSubmitType(schema));
|
|
60
|
-
|
|
61
|
-
// Check each schema field
|
|
62
|
-
for (const schema of validSchemas) {
|
|
63
|
-
const currentValue = getValueByKey(config, schema.key);
|
|
64
|
-
const defaultValue = generateDefaultValue(schema);
|
|
65
|
-
|
|
66
|
-
// Skip comparison if the field is not in the config
|
|
67
|
-
if (currentValue === undefined) continue;
|
|
68
|
-
|
|
69
|
-
// Compare values based on type
|
|
70
|
-
if (!isEqual(currentValue, defaultValue, true)) {
|
|
71
|
-
return false; // Found a non-default value
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return true; // All values match defaults
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// Generate default value for a schema field
|
|
79
|
-
export const generateDefaultValue = (schema: JsonSchema): any => {
|
|
80
|
-
// Return explicit default if provided
|
|
81
|
-
if ('defaultValue' in schema && schema.defaultValue !== undefined) {
|
|
82
|
-
return schema.defaultValue;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Generate default based on type
|
|
86
|
-
switch (schema.type) {
|
|
87
|
-
case 'string':
|
|
88
|
-
if (isEnumType(schema)) {
|
|
89
|
-
return schema.multiple ? [] : schema.required ? schema.enum[0] : '';
|
|
90
|
-
}
|
|
91
|
-
return '';
|
|
92
|
-
case 'number':
|
|
93
|
-
return 0;
|
|
94
|
-
case 'boolean':
|
|
95
|
-
return false;
|
|
96
|
-
case 'array':
|
|
97
|
-
return [];
|
|
98
|
-
default:
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// Generate a config object from schema definitions
|
|
104
|
-
export const generateConfigFromSchemas = (schemas: JsonSchema[]): Record<string, any> => {
|
|
105
|
-
const config: Record<string, any> = {};
|
|
106
|
-
|
|
107
|
-
for (const schema of schemas) {
|
|
108
|
-
// Skip button and submit types as they don't have values
|
|
109
|
-
if (isButtonType(schema) || isSubmitType(schema)) continue;
|
|
110
|
-
|
|
111
|
-
config[schema.key] = generateDefaultValue(schema);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return config;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// Get value from config by key
|
|
118
|
-
export const getValueByKey = (config: Record<string, any> = {}, key: string): any => {
|
|
119
|
-
// For simple keys without nesting
|
|
120
|
-
if (!key.includes('.') && !key.includes('[')) {
|
|
121
|
-
return config[key];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// For nested keys or array access
|
|
125
|
-
const keys = key.split('.').reduce<string[]>((acc, part) => {
|
|
126
|
-
if (part.includes('[')) {
|
|
127
|
-
const [keyPart, indexPart] = part.split('[');
|
|
128
|
-
acc.push(keyPart, indexPart.slice(0, -1)); // Remove closing bracket
|
|
129
|
-
} else {
|
|
130
|
-
acc.push(part);
|
|
131
|
-
}
|
|
132
|
-
return acc;
|
|
133
|
-
}, []);
|
|
134
|
-
|
|
135
|
-
let current = config;
|
|
136
|
-
for (const k of keys) {
|
|
137
|
-
if (current === undefined || current === null) {
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
current = current[k];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return current;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// Set value in config by key
|
|
147
|
-
export const setValueByKey = (config: Record<string, any>, key: string, value: any): void => {
|
|
148
|
-
// For simple keys without nesting
|
|
149
|
-
if (!key.includes('.') && !key.includes('[')) {
|
|
150
|
-
config[key] = value;
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// For nested keys or array access
|
|
155
|
-
const keys = key.split('.').reduce<string[]>((acc, part) => {
|
|
156
|
-
if (part.includes('[')) {
|
|
157
|
-
const [keyPart, indexPart] = part.split('[');
|
|
158
|
-
acc.push(keyPart, indexPart.slice(0, -1)); // Remove closing bracket
|
|
159
|
-
} else {
|
|
160
|
-
acc.push(part);
|
|
161
|
-
}
|
|
162
|
-
return acc;
|
|
163
|
-
}, []);
|
|
164
|
-
|
|
165
|
-
const lastKey = keys.pop();
|
|
166
|
-
if (!lastKey) return;
|
|
167
|
-
|
|
168
|
-
let current = config;
|
|
169
|
-
for (const k of keys) {
|
|
170
|
-
if (current[k] === undefined || current[k] === null) {
|
|
171
|
-
// Create object or array as needed
|
|
172
|
-
const nextKey = keys[keys.indexOf(k) + 1];
|
|
173
|
-
current[k] = !isNaN(Number(nextKey)) ? [] : {};
|
|
174
|
-
}
|
|
175
|
-
current = current[k];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
current[lastKey] = value;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
// Find schema by key
|
|
182
|
-
export const findSchemaByKey = (schemas: JsonSchema[], key: string): JsonSchema | undefined => {
|
|
183
|
-
return schemas.find((schema) => schema.key === key);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// Remove callback functions from schema - useful for serialization
|
|
187
|
-
export const removeCallbacksFromSchema = (schema: JsonSchemaWithoutKey): JsonSchemaWithoutCallbacks => {
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
189
|
-
const { onSet, onGet, onClick, ...rest } = schema as any;
|
|
190
|
-
|
|
191
|
-
if (isArrayType(rest) && rest.items) {
|
|
192
|
-
rest.items = removeCallbacksFromSchema(rest.items);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return rest as JsonSchemaWithoutCallbacks;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// Remove callbacks from all schemas
|
|
199
|
-
export const removeCallbacksFromSchemas = (schemas: JsonSchema[]): JsonSchemaWithoutCallbacks[] => {
|
|
200
|
-
return schemas.map((schema) => removeCallbacksFromSchema(schema));
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// Generate storable config (only include fields with store: true)
|
|
204
|
-
export const generateStorableConfig = (schemas: JsonSchema[], config: Record<string, any>): Record<string, any> => {
|
|
205
|
-
const storableConfig: Record<string, any> = {};
|
|
206
|
-
|
|
207
|
-
for (const schema of schemas) {
|
|
208
|
-
if ('store' in schema && schema.store && !isButtonType(schema) && !isSubmitType(schema)) {
|
|
209
|
-
const value = getValueByKey(config, schema.key);
|
|
210
|
-
if (value !== undefined) {
|
|
211
|
-
storableConfig[schema.key] = value;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return storableConfig;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// Check if schema fields have a specific group
|
|
220
|
-
export const getSchemasByGroup = (schemas: JsonSchema[], group: string): JsonSchema[] => {
|
|
221
|
-
if (!group) return schemas;
|
|
222
|
-
return schemas.filter((schema) => 'group' in schema && schema.group === group);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
// Check if all schemas in a group are readonly
|
|
226
|
-
export const schemaGroupIsReadonly = (schemas: JsonSchema[], group: string): boolean => {
|
|
227
|
-
const groupSchemas = getSchemasByGroup(schemas, group);
|
|
228
|
-
return groupSchemas.length > 0 && groupSchemas.every((schema) => 'readonly' in schema && schema.readonly);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// Check if any schema in a group is storable
|
|
232
|
-
export const schemaGroupIsStorable = (schemas: JsonSchema[], group: string): boolean => {
|
|
233
|
-
const groupSchemas = getSchemasByGroup(schemas, group);
|
|
234
|
-
return groupSchemas.length > 0 && groupSchemas.some((schema) => 'store' in schema && schema.store);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
// Format validation for string types
|
|
238
|
-
export const isValidFormat = (value: string, format?: string): boolean => {
|
|
239
|
-
if (!format) return true;
|
|
240
|
-
|
|
241
|
-
const validations: Record<string, (val: string) => boolean> = {
|
|
242
|
-
'date-time': (val) => /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})?$/.test(val),
|
|
243
|
-
date: (val) => /^\d{4}-\d{2}-\d{2}$/.test(val),
|
|
244
|
-
time: (val) => /^([01]?[0-9]|2[0-3]):([0-5][0-9])(:([0-5][0-9]))?$/.test(val),
|
|
245
|
-
email: (val) => /^\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b$/.test(val),
|
|
246
|
-
uuid: (val) => /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(val),
|
|
247
|
-
ipv4: (val) => /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(val),
|
|
248
|
-
ipv6: (val) => /^\s*([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})\s*$/.test(val),
|
|
249
|
-
// Add more validations as needed
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
return format in validations ? validations[format](value) : true;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
// Validate a value against a schema
|
|
256
|
-
export const validateValue = (value: any, schema: JsonSchemaWithoutKey): boolean => {
|
|
257
|
-
if (isButtonType(schema) || isSubmitType(schema)) return true;
|
|
258
|
-
|
|
259
|
-
// Check required fields
|
|
260
|
-
if ('required' in schema && schema.required && (value === undefined || value === null || value === '')) {
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
switch (schema.type) {
|
|
265
|
-
case 'string':
|
|
266
|
-
if (isEnumType(schema)) {
|
|
267
|
-
if (schema.multiple) {
|
|
268
|
-
return Array.isArray(value) && value.every((v) => schema.enum.includes(v));
|
|
269
|
-
} else {
|
|
270
|
-
return schema.enum.includes(value);
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
if (typeof value !== 'string') return false;
|
|
274
|
-
if ((schema as JsonStringSchema).minLength !== undefined && value.length < (schema as JsonStringSchema).minLength!) return false;
|
|
275
|
-
if ((schema as JsonStringSchema).maxLength !== undefined && value.length > (schema as JsonStringSchema).maxLength!) return false;
|
|
276
|
-
if ((schema as JsonStringSchema).format) return isValidFormat(value, (schema as JsonStringSchema).format);
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
case 'number':
|
|
281
|
-
if (typeof value !== 'number') return false;
|
|
282
|
-
if ((schema as JsonNumberSchema).minimum !== undefined && value < (schema as JsonNumberSchema).minimum!) return false;
|
|
283
|
-
if ((schema as JsonNumberSchema).maximum !== undefined && value > (schema as JsonNumberSchema).maximum!) return false;
|
|
284
|
-
return true;
|
|
285
|
-
|
|
286
|
-
case 'boolean':
|
|
287
|
-
return typeof value === 'boolean';
|
|
288
|
-
|
|
289
|
-
case 'array':
|
|
290
|
-
if (!Array.isArray(value)) return false;
|
|
291
|
-
return value.every((item) => validateValue(item, (schema as JsonSchemaArray).items));
|
|
292
|
-
|
|
293
|
-
default:
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
// Validate entire config against schema
|
|
299
|
-
export const validateConfig = (config: Record<string, any>, schemas: JsonSchema[]): Record<string, string[]> => {
|
|
300
|
-
const errors: Record<string, string[]> = {};
|
|
301
|
-
|
|
302
|
-
for (const schema of schemas) {
|
|
303
|
-
// Skip button and submit types
|
|
304
|
-
if (isButtonType(schema) || isSubmitType(schema)) continue;
|
|
305
|
-
|
|
306
|
-
const value = getValueByKey(config, schema.key);
|
|
307
|
-
const fieldErrors: string[] = [];
|
|
308
|
-
|
|
309
|
-
// Required field check
|
|
310
|
-
if ('required' in schema && schema.required && (value === undefined || value === null || value === '')) {
|
|
311
|
-
fieldErrors.push('This field is required');
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Type-specific validation
|
|
315
|
-
if (value !== undefined && value !== null) {
|
|
316
|
-
if (isStringType(schema)) {
|
|
317
|
-
if (typeof value !== 'string') {
|
|
318
|
-
fieldErrors.push('Value must be a string');
|
|
319
|
-
} else {
|
|
320
|
-
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
321
|
-
fieldErrors.push(`Minimum length is ${schema.minLength}`);
|
|
322
|
-
}
|
|
323
|
-
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
324
|
-
fieldErrors.push(`Maximum length is ${schema.maxLength}`);
|
|
325
|
-
}
|
|
326
|
-
if (schema.format && !isValidFormat(value, schema.format)) {
|
|
327
|
-
fieldErrors.push(`Invalid ${schema.format} format`);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
} else if (isNumberType(schema)) {
|
|
331
|
-
if (typeof value !== 'number') {
|
|
332
|
-
fieldErrors.push('Value must be a number');
|
|
333
|
-
} else {
|
|
334
|
-
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
335
|
-
fieldErrors.push(`Minimum value is ${schema.minimum}`);
|
|
336
|
-
}
|
|
337
|
-
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
338
|
-
fieldErrors.push(`Maximum value is ${schema.maximum}`);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
} else if (isBooleanType(schema)) {
|
|
342
|
-
if (typeof value !== 'boolean') {
|
|
343
|
-
fieldErrors.push('Value must be a boolean');
|
|
344
|
-
}
|
|
345
|
-
} else if (isEnumType(schema)) {
|
|
346
|
-
if (schema.multiple) {
|
|
347
|
-
if (!Array.isArray(value)) {
|
|
348
|
-
fieldErrors.push('Value must be an array');
|
|
349
|
-
} else if (!value.every((v) => schema.enum.includes(v))) {
|
|
350
|
-
fieldErrors.push('Invalid selection');
|
|
351
|
-
}
|
|
352
|
-
} else if (!schema.enum.includes(value)) {
|
|
353
|
-
fieldErrors.push('Invalid selection');
|
|
354
|
-
}
|
|
355
|
-
} else if (isArrayType(schema)) {
|
|
356
|
-
if (!Array.isArray(value)) {
|
|
357
|
-
fieldErrors.push('Value must be an array');
|
|
358
|
-
} else {
|
|
359
|
-
value.forEach((item, index) => {
|
|
360
|
-
if (!validateValue(item, schema.items)) {
|
|
361
|
-
fieldErrors.push(`Invalid item at index ${index}`);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (fieldErrors.length > 0) {
|
|
369
|
-
errors[schema.key] = fieldErrors;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
return errors;
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
// Generate a Zod schema for a single JSON schema field
|
|
377
|
-
export const generateZodSchemaField = (schema: JsonSchema): zod.ZodTypeAny => {
|
|
378
|
-
// Skip validation for button and submit types
|
|
379
|
-
if (isButtonType(schema) || isSubmitType(schema)) {
|
|
380
|
-
return zod.any();
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Build schema based on type
|
|
384
|
-
switch (schema.type) {
|
|
385
|
-
case 'string':
|
|
386
|
-
// Handle enum type
|
|
387
|
-
if (isEnumType(schema)) {
|
|
388
|
-
if (schema.multiple) {
|
|
389
|
-
// Multiple selection
|
|
390
|
-
let arraySchema = zod.array(zod.string().refine((val) => schema.enum.includes(val), { message: 'Invalid selection' }));
|
|
391
|
-
|
|
392
|
-
if (schema.required) {
|
|
393
|
-
arraySchema = arraySchema.min(1, { message: 'Required' });
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return schema.required ? arraySchema : arraySchema.optional();
|
|
397
|
-
} else {
|
|
398
|
-
// Single selection
|
|
399
|
-
const enumSchema = zod.enum(schema.enum as [string, ...string[]]);
|
|
400
|
-
return schema.required ? enumSchema : enumSchema.optional();
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// Regular string
|
|
405
|
-
let strSchema: zod.ZodString | zod.ZodEffects<any, any, any> = zod.string();
|
|
406
|
-
|
|
407
|
-
// Add validation for required fields
|
|
408
|
-
if (schema.required) {
|
|
409
|
-
strSchema = strSchema.nonempty('Required');
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Add length validations
|
|
413
|
-
if (schema.minLength !== undefined) {
|
|
414
|
-
strSchema = strSchema.min(schema.minLength);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (schema.maxLength !== undefined) {
|
|
418
|
-
strSchema = strSchema.max(schema.maxLength);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// Add validation for format
|
|
422
|
-
if (schema.format) {
|
|
423
|
-
strSchema = strSchema.refine((val) => !val || val.trim() === '' || isValidFormat(val, schema.format), {
|
|
424
|
-
message: `Invalid ${schema.format} format`,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
return schema.required ? strSchema : strSchema.optional();
|
|
429
|
-
|
|
430
|
-
case 'number':
|
|
431
|
-
let numSchema: zod.ZodNumber | zod.ZodEffects<any, any, any> = zod.number();
|
|
432
|
-
|
|
433
|
-
if (schema.minimum !== undefined) {
|
|
434
|
-
numSchema = numSchema.min(schema.minimum);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
if (schema.maximum !== undefined) {
|
|
438
|
-
numSchema = numSchema.max(schema.maximum);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
if (schema.required) {
|
|
442
|
-
numSchema = numSchema.refine((val) => val !== undefined && val !== null, { message: 'Required' });
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
return schema.required ? numSchema : numSchema.optional();
|
|
446
|
-
|
|
447
|
-
case 'boolean':
|
|
448
|
-
return schema.required ? zod.boolean() : zod.boolean().optional();
|
|
449
|
-
|
|
450
|
-
case 'array':
|
|
451
|
-
const schemaItems = generateZodSchemaField(schema.items as any);
|
|
452
|
-
const arraySchema = zod.array(schemaItems);
|
|
453
|
-
return schema.required ? arraySchema : arraySchema.optional();
|
|
454
|
-
|
|
455
|
-
default:
|
|
456
|
-
return (schema as any).required ? zod.any() : zod.any().optional();
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
// // Generate a complete Zod schema from an array of JSON schemas
|
|
461
|
-
export const generateZodSchema = (schemas: JsonSchema[]): zod.ZodObject<any> => {
|
|
462
|
-
const zodSchemaObj: Record<string, zod.ZodTypeAny> = {};
|
|
463
|
-
|
|
464
|
-
schemas.forEach((schema) => {
|
|
465
|
-
// Skip button and submit types as they don't need validation
|
|
466
|
-
if (!isButtonType(schema) && !isSubmitType(schema)) {
|
|
467
|
-
zodSchemaObj[schema.key] = generateZodSchemaField(schema);
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
return zod.object(zodSchemaObj);
|
|
472
|
-
};
|
package/src/plugins/types.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Camera, CameraExtension } from '@camera.ui/types';
|
|
2
|
-
|
|
3
|
-
export interface Context {
|
|
4
|
-
engines?: Record<string, string>;
|
|
5
|
-
dependencies?: Record<string, string>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const PLUGIN_IDENTIFIER_PATTERN = /^((@[\w-.]*)\/)?(camera-ui-[\w-]*)$/;
|
|
9
|
-
|
|
10
|
-
export const CAMERA_EXTENSIONS: CameraExtension[] = ['cameraController', 'hub', 'motionDetection', 'objectDetection', 'audioDetection', 'ptz'];
|
|
11
|
-
|
|
12
|
-
export interface ProcessLoadMessage {
|
|
13
|
-
cameras: Camera[];
|
|
14
|
-
plugin: PluginInfo;
|
|
15
|
-
storage: PluginStorage;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ProcessMessage {
|
|
19
|
-
type: PLUGIN_COMMAND;
|
|
20
|
-
data?: ProcessLoadMessage;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ProcessResponse {
|
|
24
|
-
type: PLUGIN_STATUS;
|
|
25
|
-
error?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export enum PLUGIN_STATUS {
|
|
29
|
-
READY = 'ready',
|
|
30
|
-
STARTING = 'starting',
|
|
31
|
-
STARTED = 'started',
|
|
32
|
-
STOPPING = 'stopping',
|
|
33
|
-
STOPPED = 'stopped',
|
|
34
|
-
ERROR = 'error',
|
|
35
|
-
UNKNOWN = 'unknown',
|
|
36
|
-
DISABLED = 'disabled',
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export enum PLUGIN_COMMAND {
|
|
40
|
-
START = 'start',
|
|
41
|
-
STOP = 'stop',
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface PluginStorage {
|
|
45
|
-
installPath: string;
|
|
46
|
-
storagePath: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface PluginInfo {
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
contract: PluginContract;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface PluginContract {
|
|
56
|
-
extensions: CameraExtension[];
|
|
57
|
-
dependencies?: string[];
|
|
58
|
-
pythonVersion?: string;
|
|
59
|
-
bundled?: boolean;
|
|
60
|
-
}
|