@kosdev-code/kos-ui-sdk 0.1.0-next.944 → 0.1.0-next.958
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/.kos.json +2 -1
- package/common/events/async-event-bus.d.ts +2 -11
- package/common/events/async-event-bus.d.ts.map +1 -1
- package/common/events/eventBus.d.ts +1 -18
- package/common/events/eventBus.d.ts.map +1 -1
- package/core/core/decorators/kos-child.d.ts +2 -3
- package/core/core/decorators/kos-child.d.ts.map +1 -1
- package/core/core/decorators/kos-companion.d.ts +25 -87
- package/core/core/decorators/kos-companion.d.ts.map +1 -1
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts +2 -0
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts.map +1 -0
- package/core/core/decorators/kos-container-aware.d.ts +191 -420
- package/core/core/decorators/kos-container-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-execute-service-request.d.ts +7 -11
- package/core/core/decorators/kos-execute-service-request.d.ts.map +1 -1
- package/core/core/decorators/kos-execution-context.d.ts +14 -31
- package/core/core/decorators/kos-execution-context.d.ts.map +1 -1
- package/core/core/decorators/kos-future-aware.d.ts +21 -74
- package/core/core/decorators/kos-future-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-http-decorators.d.ts +18 -62
- package/core/core/decorators/kos-http-decorators.d.ts.map +1 -1
- package/core/core/decorators/kos-logger-aware.d.ts +10 -60
- package/core/core/decorators/kos-logger-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-model-effect.d.ts +10 -9
- package/core/core/decorators/kos-model-effect.d.ts.map +1 -1
- package/core/core/decorators/kos-multiple-future-aware.d.ts +21 -94
- package/core/core/decorators/kos-multiple-future-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-reload-aware.d.ts +14 -16
- package/core/core/decorators/kos-reload-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-service-request.d.ts +80 -238
- package/core/core/decorators/kos-service-request.d.ts.map +1 -1
- package/core/core/decorators/kos-state-machine.d.ts +35 -275
- package/core/core/decorators/kos-state-machine.d.ts.map +1 -1
- package/core/core/decorators/kos-trouble-aware.d.ts +9 -43
- package/core/core/decorators/kos-trouble-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-view-model.d.ts +20 -100
- package/core/core/decorators/kos-view-model.d.ts.map +1 -1
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/decorators/kosTopicHandler.d.ts +28 -89
- package/core/core/decorators/kosTopicHandler.d.ts.map +1 -1
- package/core/core/indexing/index.d.ts +2 -4
- package/core/core/indexing/index.d.ts.map +1 -1
- package/core/core/indexing/kos-container-index-aware.d.ts +17 -48
- package/core/core/indexing/kos-container-index-aware.d.ts.map +1 -1
- package/core/core/indexing/kos-index-aware.d.ts +11 -37
- package/core/core/indexing/kos-index-aware.d.ts.map +1 -1
- package/core/core/kos-container-model.d.ts +11 -32
- package/core/core/kos-container-model.d.ts.map +1 -1
- package/core/core/kos-data-container.d.ts +6 -6
- package/core/core/kos-data-container.d.ts.map +1 -1
- package/core/core/kosCore.d.ts +7 -4
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/kosModel.d.ts +16 -8
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/kosModelManager.d.ts +2 -3
- package/core/core/kosModelManager.d.ts.map +1 -1
- package/core/core/lifecycle/constants.d.ts +6 -2
- package/core/core/lifecycle/constants.d.ts.map +1 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts +11 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/kosModelLifecycle.d.ts +6 -0
- package/core/core/lifecycle/kosModelLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/model-machine.d.ts +6 -0
- package/core/core/lifecycle/model-machine.d.ts.map +1 -1
- package/core/core/model/kos-fsm-manager.d.ts +6 -0
- package/core/core/model/kos-fsm-manager.d.ts.map +1 -1
- package/core/core/model/kos-offline-queue.d.ts +1 -1
- package/core/core/model/service-response-store.d.ts +2 -15
- package/core/core/model/service-response-store.d.ts.map +1 -1
- package/core/core/reconnect/reconnect-fixture.d.ts +17 -0
- package/core/core/reconnect/reconnect-fixture.d.ts.map +1 -0
- package/core/core/services/app-startup-service.d.ts +5 -13
- package/core/core/services/app-startup-service.d.ts.map +1 -1
- package/core/core/services/intent-service.d.ts +3 -12
- package/core/core/services/intent-service.d.ts.map +1 -1
- package/core/core/transport/mock/mock-frames.d.ts +3 -3
- package/core/core/transport/transport.d.ts +1 -1
- package/core/core/transport/transport.d.ts.map +1 -1
- package/core/core/transport/webSocketTransport.d.ts +10 -0
- package/core/core/transport/webSocketTransport.d.ts.map +1 -1
- package/core/types/model.d.ts +4 -8
- package/core/types/model.d.ts.map +1 -1
- package/core/types/service-response-store.d.ts +3 -11
- package/core/types/service-response-store.d.ts.map +1 -1
- package/core/types/utils/kos-fetch.d.ts +25 -37
- package/core/types/utils/kos-fetch.d.ts.map +1 -1
- package/core/util/abortable-when.d.ts +5 -6
- package/core/util/abortable-when.d.ts.map +1 -1
- package/core/util/ancestor-path-visitor.d.ts +14 -20
- package/core/util/ancestor-path-visitor.d.ts.map +1 -1
- package/core/util/container-utils.d.ts +26 -159
- package/core/util/container-utils.d.ts.map +1 -1
- package/core/util/date-utils.d.ts +9 -58
- package/core/util/date-utils.d.ts.map +1 -1
- package/core/util/debounce.d.ts +1 -8
- package/core/util/debounce.d.ts.map +1 -1
- package/core/util/kos-fetch.d.ts +1 -1
- package/core/util/kos-fetch.d.ts.map +1 -1
- package/core/util/kos-model-utils.d.ts +10 -11
- package/core/util/kos-model-utils.d.ts.map +1 -1
- package/core/util/model-attribute-utils.d.ts +5 -22
- package/core/util/model-attribute-utils.d.ts.map +1 -1
- package/core/util/promise-utils.d.ts +1 -26
- package/core/util/promise-utils.d.ts.map +1 -1
- package/core/util/service-factory.d.ts +5 -23
- package/core/util/service-factory.d.ts.map +1 -1
- package/core/util/service-request-error.d.ts +3 -5
- package/core/util/service-request-error.d.ts.map +1 -1
- package/core/util/service-response.d.ts +12 -67
- package/core/util/service-response.d.ts.map +1 -1
- package/core/util/transport-not-ready-error.d.ts +11 -13
- package/core/util/transport-not-ready-error.d.ts.map +1 -1
- package/core/util/when-ready.d.ts +1 -8
- package/core/util/when-ready.d.ts.map +1 -1
- package/index.cjs +144 -109
- package/index.cjs.map +1 -1
- package/index.js +173 -138
- package/index.js.map +1 -1
- package/models/decorators/future-service.d.ts +7 -7
- package/models/models/browser-router/browser-router-model.d.ts +10 -39
- package/models/models/browser-router/browser-router-model.d.ts.map +1 -1
- package/models/models/browser-router/browser-router-registration.d.ts +5 -77
- package/models/models/browser-router/browser-router-registration.d.ts.map +1 -1
- package/models/models/browser-router/types/index.d.ts +2 -16
- package/models/models/canvas-dispatcher/canvas-dispatcher-registration.d.ts +5 -77
- package/models/models/canvas-dispatcher/canvas-dispatcher-registration.d.ts.map +1 -1
- package/models/models/canvas-renderer/canvas-renderer-registration.d.ts +5 -75
- package/models/models/canvas-renderer/canvas-renderer-registration.d.ts.map +1 -1
- package/models/models/config-bean/config-bean-model-builder.d.ts +4 -11
- package/models/models/config-bean/config-bean-model-builder.d.ts.map +1 -1
- package/models/models/config-bean/config-bean-model.d.ts +23 -66
- package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
- package/models/models/config-bean-prop/config-bean-prop-model.d.ts +15 -62
- package/models/models/config-bean-prop/config-bean-prop-model.d.ts.map +1 -1
- package/models/models/config-bean-prop/types/index.d.ts +34 -215
- package/models/models/device/device-model.d.ts +20 -199
- package/models/models/device/device-model.d.ts.map +1 -1
- package/models/models/device/device-registration.d.ts +7 -87
- package/models/models/device/device-registration.d.ts.map +1 -1
- package/models/models/device/types/index.d.ts +5 -34
- package/models/models/future/future-aware.d.ts +7 -71
- package/models/models/future/future-aware.d.ts.map +1 -1
- package/models/models/future/future-model-builder.d.ts +2 -2
- package/models/models/future/future-model.d.ts +3 -23
- package/models/models/future/future-model.d.ts.map +1 -1
- package/models/models/future/future-types.d.ts +28 -145
- package/models/models/future/future-types.d.ts.map +1 -1
- package/models/models/gpio-chip/gpio-chip-builders.d.ts +14 -0
- package/models/models/gpio-chip/gpio-chip-builders.d.ts.map +1 -0
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts +2 -1
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts.map +1 -1
- package/models/models/key-value/key-value-model.d.ts +12 -72
- package/models/models/key-value/key-value-model.d.ts.map +1 -1
- package/models/models/key-value/key-value-registration.d.ts +5 -77
- package/models/models/key-value/key-value-registration.d.ts.map +1 -1
- package/models/models/key-value/services/key-value-services.d.ts +13 -72
- package/models/models/key-value/services/key-value-services.d.ts.map +1 -1
- package/models/models/key-value/types/index.d.ts +3 -46
- package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts +32 -99
- package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts.map +1 -1
- package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts +2 -12
- package/models/models/kos-expression-evaluator/services/kos-expression-evaluator-services.d.ts.map +1 -1
- package/models/models/kos-log-manager/kos-log-manager-model.d.ts +7 -46
- package/models/models/kos-log-manager/kos-log-manager-model.d.ts.map +1 -1
- package/models/models/kos-log-manager/kos-log-manager-registration.d.ts +5 -80
- package/models/models/kos-log-manager/kos-log-manager-registration.d.ts.map +1 -1
- package/models/models/kos-log-manager/types/index.d.ts +13 -156
- package/models/models/kos-time/kos-time-model.d.ts +8 -39
- package/models/models/kos-time/kos-time-model.d.ts.map +1 -1
- package/models/models/kos-time/kos-time-registration.d.ts +6 -73
- package/models/models/kos-time/kos-time-registration.d.ts.map +1 -1
- package/models/models/kos-time/types/index.d.ts +3 -58
- package/models/models/log-block/log-block-container-model.d.ts +2 -118
- package/models/models/log-block/log-block-container-model.d.ts.map +1 -1
- package/models/models/log-block/log-block-container-registration.d.ts +5 -75
- package/models/models/log-block/log-block-container-registration.d.ts.map +1 -1
- package/models/models/log-block/log-block-model.d.ts +5 -168
- package/models/models/log-block/log-block-model.d.ts.map +1 -1
- package/models/models/log-block/log-block-registration.d.ts +5 -75
- package/models/models/log-block/log-block-registration.d.ts.map +1 -1
- package/models/models/log-block/types/index.d.ts +14 -81
- package/models/models/log-stream/log-stream-container-model.d.ts +8 -35
- package/models/models/log-stream/log-stream-container-model.d.ts.map +1 -1
- package/models/models/log-stream/log-stream-container-registration.d.ts +5 -75
- package/models/models/log-stream/log-stream-container-registration.d.ts.map +1 -1
- package/models/models/log-stream/log-stream-model.d.ts +8 -29
- package/models/models/log-stream/log-stream-model.d.ts.map +1 -1
- package/models/models/log-stream/log-stream-registration.d.ts +5 -75
- package/models/models/log-stream/log-stream-registration.d.ts.map +1 -1
- package/models/models/log-stream/types/index.d.ts +5 -60
- package/models/models/network-interface/network-interface-container-model.d.ts +6 -35
- package/models/models/network-interface/network-interface-container-model.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-container-registration.d.ts +5 -73
- package/models/models/network-interface/network-interface-container-registration.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-model.d.ts +5 -43
- package/models/models/network-interface/network-interface-model.d.ts.map +1 -1
- package/models/models/network-interface/network-interface-registration.d.ts +5 -73
- package/models/models/network-interface/network-interface-registration.d.ts.map +1 -1
- package/models/models/network-interface/types/index.d.ts +2 -16
- package/models/models/ota/ota-model.d.ts +11 -39
- package/models/models/ota/ota-model.d.ts.map +1 -1
- package/models/models/ota/ota-registration.d.ts +5 -77
- package/models/models/ota/ota-registration.d.ts.map +1 -1
- package/models/models/ota/types/index.d.ts +2 -141
- package/models/models/region-info/types/index.d.ts +19 -99
- package/models/models/region-info/types/index.d.ts.map +1 -1
- package/models/models/software-info/services/software-info-services.d.ts +2 -14
- package/models/models/software-info/services/software-info-services.d.ts.map +1 -1
- package/models/models/software-info/software-info-model.d.ts +3 -39
- package/models/models/software-info/software-info-model.d.ts.map +1 -1
- package/models/models/software-info/software-info-registration.d.ts +6 -73
- package/models/models/software-info/software-info-registration.d.ts.map +1 -1
- package/models/models/software-info/types/index.d.ts +6 -20
- package/models/models/state-bean/state-bean-model.d.ts +10 -41
- package/models/models/state-bean/state-bean-model.d.ts.map +1 -1
- package/models/models/state-bean/state-bean-registration.d.ts +6 -73
- package/models/models/state-bean/state-bean-registration.d.ts.map +1 -1
- package/models/models/state-bean/types/index.d.ts +4 -84
- package/models/models/state-prop/state-prop-model.d.ts +6 -40
- package/models/models/state-prop/state-prop-model.d.ts.map +1 -1
- package/models/models/state-prop/state-prop-registration.d.ts +6 -73
- package/models/models/state-prop/state-prop-registration.d.ts.map +1 -1
- package/models/models/state-prop/types/index.d.ts +5 -37
- package/models/models/storage-device/storage-device-container-model.d.ts +7 -273
- package/models/models/storage-device/storage-device-container-model.d.ts.map +1 -1
- package/models/models/storage-device/storage-device-container-registration.d.ts +5 -75
- package/models/models/storage-device/storage-device-container-registration.d.ts.map +1 -1
- package/models/models/storage-device/storage-device-model.d.ts +3 -49
- package/models/models/storage-device/storage-device-model.d.ts.map +1 -1
- package/models/models/storage-device/storage-device-registration.d.ts +5 -75
- package/models/models/storage-device/storage-device-registration.d.ts.map +1 -1
- package/models/models/storage-device/types/index.d.ts +13 -82
- package/models/models/studio-properties/studio-properties-model.d.ts +13 -36
- package/models/models/studio-properties/studio-properties-model.d.ts.map +1 -1
- package/models/models/studio-properties/studio-properties-registration.d.ts +5 -75
- package/models/models/studio-properties/studio-properties-registration.d.ts.map +1 -1
- package/models/models/studio-properties/types/index.d.ts +2 -24
- package/models/models/translation/descriptor-merge.d.ts +13 -17
- package/models/models/translation/descriptor-merge.d.ts.map +1 -1
- package/models/models/translation/services/translation-services.d.ts +19 -77
- package/models/models/translation/services/translation-services.d.ts.map +1 -1
- package/models/models/translation/test-harness.d.ts +6 -8
- package/models/models/translation/test-harness.d.ts.map +1 -1
- package/models/models/translation/translation-container-model.d.ts +7 -59
- package/models/models/translation/translation-container-model.d.ts.map +1 -1
- package/models/models/translation/translation-container-registration.d.ts +6 -73
- package/models/models/translation/translation-container-registration.d.ts.map +1 -1
- package/models/models/translation/translation-model.d.ts +17 -50
- package/models/models/translation/translation-model.d.ts.map +1 -1
- package/models/models/translation/translation-registration.d.ts +6 -73
- package/models/models/translation/translation-registration.d.ts.map +1 -1
- package/models/models/translation/types/index.d.ts +51 -276
- package/models/models/trouble/trouble-registration.d.ts +6 -73
- package/models/models/trouble/trouble-registration.d.ts.map +1 -1
- package/models/models/trouble/types/index.d.ts +17 -188
- package/models/models/trouble/utils/is-trouble-aware.d.ts +4 -85
- package/models/models/trouble/utils/is-trouble-aware.d.ts.map +1 -1
- package/models/models/trouble-container/trouble-builders.d.ts +11 -0
- package/models/models/trouble-container/trouble-builders.d.ts.map +1 -0
- package/models/models/trouble-container/trouble-container-model.d.ts +2 -1
- package/models/models/trouble-container/trouble-container-model.d.ts.map +1 -1
- package/models/models/usb-update/usb-update-container-registration.d.ts +5 -75
- package/models/models/usb-update/usb-update-container-registration.d.ts.map +1 -1
- package/models/models/usb-update/usb-update-registration.d.ts +5 -75
- package/models/models/usb-update/usb-update-registration.d.ts.map +1 -1
- package/models/types/cancellable-promise.d.ts +6 -9
- package/models/types/cancellable-promise.d.ts.map +1 -1
- package/models/utils/await-future-call.d.ts +9 -21
- package/models/utils/await-future-call.d.ts.map +1 -1
- package/models/utils/cancellable-future-call.d.ts +8 -19
- package/models/utils/cancellable-future-call.d.ts.map +1 -1
- package/models/utils/cancellable-service.d.ts +14 -23
- package/models/utils/cancellable-service.d.ts.map +1 -1
- package/models/utils/conversion-utils.d.ts +8 -48
- package/models/utils/conversion-utils.d.ts.map +1 -1
- package/models/utils/persistence-store.d.ts +1 -1
- package/models/utils/service.d.ts +14 -48
- package/models/utils/service.d.ts.map +1 -1
- package/models/utils/services/kos/daily/service.d.ts +4 -4
- package/models/utils/services/vfs/daily/service.d.ts +4 -4
- package/models/utils/timer-manager.d.ts.map +1 -1
- package/package.json +3 -3
- package/{software-info-registration-CKlTQPet.js → software-info-registration-C8kf-pBB.js} +551 -530
- package/software-info-registration-C8kf-pBB.js.map +1 -0
- package/{software-info-registration-GUbTY4KD.cjs → software-info-registration-Y1iADHWT.cjs} +522 -501
- package/software-info-registration-Y1iADHWT.cjs.map +1 -0
- package/testing/index.d.ts +28 -33
- package/testing/index.d.ts.map +1 -1
- package/testing.cjs +1 -1
- package/testing.cjs.map +1 -1
- package/testing.js +1 -1
- package/testing.js.map +1 -1
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts +9 -0
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts.map +1 -0
- package/ui/components/connection-dev-button/index.d.ts +36 -0
- package/ui/components/connection-dev-button/index.d.ts.map +1 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts +29 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts.map +1 -0
- package/ui/components/index.d.ts +1 -0
- package/ui/components/index.d.ts.map +1 -1
- package/ui/features/canvas/hooks/use-image-renderer.d.ts +5 -4
- package/ui/features/canvas/hooks/use-image-renderer.d.ts.map +1 -1
- package/ui/hooks/use-function-warmup.d.ts +4 -14
- package/ui/hooks/use-function-warmup.d.ts.map +1 -1
- package/ui/hooks/use-kos-date-formats.d.ts +15 -29
- package/ui/hooks/use-kos-date-formats.d.ts.map +1 -1
- package/ui/hooks/use-kos-region-timezones.d.ts +4 -55
- package/ui/hooks/use-kos-region-timezones.d.ts.map +1 -1
- package/ui/hooks/use-kos-regions.d.ts +11 -23
- package/ui/hooks/use-kos-regions.d.ts.map +1 -1
- package/ui/hooks/use-kos-time-formats.d.ts +16 -31
- package/ui/hooks/use-kos-time-formats.d.ts.map +1 -1
- package/ui/hooks/use-kos-unit-systems.d.ts +13 -27
- package/ui/hooks/use-kos-unit-systems.d.ts.map +1 -1
- package/ui/hooks/view-model/use-view-model.d.ts +6 -31
- package/ui/hooks/view-model/use-view-model.d.ts.map +1 -1
- package/ui/policies/reload-on-disconnect-policy.d.ts +5 -6
- package/ui/policies/reload-on-disconnect-policy.d.ts.map +1 -1
- package/software-info-registration-CKlTQPet.js.map +0 -1
- package/software-info-registration-GUbTY4KD.cjs.map +0 -1
|
@@ -850,7 +850,8 @@ function kosContainerAware(options) {
|
|
|
850
850
|
includeGetters,
|
|
851
851
|
modelsProperty,
|
|
852
852
|
containerOptions,
|
|
853
|
-
legacy: options?.legacy || false
|
|
853
|
+
legacy: options?.legacy || false,
|
|
854
|
+
reconcile: options?.reconcile
|
|
854
855
|
};
|
|
855
856
|
return target;
|
|
856
857
|
};
|
|
@@ -2031,7 +2032,7 @@ class KosModelContainer {
|
|
|
2031
2032
|
}
|
|
2032
2033
|
}
|
|
2033
2034
|
/**
|
|
2034
|
-
*
|
|
2035
|
+
* Watch indexed model properties and refresh the matching indexes when they change (Zone 3)
|
|
2035
2036
|
* @private
|
|
2036
2037
|
*/
|
|
2037
2038
|
_configureModelMonitoring(model) {
|
|
@@ -2163,8 +2164,8 @@ class KosModelContainer {
|
|
|
2163
2164
|
}
|
|
2164
2165
|
}
|
|
2165
2166
|
/**
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2167
|
+
* Evict models when capacity is exceeded (Zone 2: Workflow orchestration).
|
|
2168
|
+
* Evictions are logged at INFO level.
|
|
2168
2169
|
* @private
|
|
2169
2170
|
*/
|
|
2170
2171
|
async _evictModels() {
|
|
@@ -2317,6 +2318,66 @@ class KosModelContainer {
|
|
|
2317
2318
|
};
|
|
2318
2319
|
}
|
|
2319
2320
|
}
|
|
2321
|
+
const deltas = (projectedModels, currentModels) => {
|
|
2322
|
+
const newIds = projectedModels.map((entity) => entity.id);
|
|
2323
|
+
const currentIds = currentModels.map((entity) => entity.id);
|
|
2324
|
+
const toRemove = currentIds.filter((modelId) => !newIds.includes(modelId));
|
|
2325
|
+
return toRemove;
|
|
2326
|
+
};
|
|
2327
|
+
const DEFAULT_REMOVE_MAPPER = (id) => id;
|
|
2328
|
+
const DEFAULT_ID_MAPPER = (entity) => entity;
|
|
2329
|
+
const resolveContainerDeltas = ({
|
|
2330
|
+
container,
|
|
2331
|
+
onAddItem,
|
|
2332
|
+
onUpdateItem,
|
|
2333
|
+
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
2334
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2335
|
+
}) => (entities) => {
|
|
2336
|
+
const mappedEntities = entities.map(idMapper);
|
|
2337
|
+
const toRemove = deltas(mappedEntities, container.data);
|
|
2338
|
+
const removedIds = toRemove.map(onRemoveItem).filter(Boolean);
|
|
2339
|
+
container.removeAll(removedIds);
|
|
2340
|
+
const toAdd = mappedEntities.map((entity) => {
|
|
2341
|
+
const existing = container.getModel(entity.id);
|
|
2342
|
+
if (!existing) {
|
|
2343
|
+
return onAddItem(entity);
|
|
2344
|
+
} else if (onUpdateItem) {
|
|
2345
|
+
return onUpdateItem(entity, existing);
|
|
2346
|
+
} else {
|
|
2347
|
+
return onAddItem(entity);
|
|
2348
|
+
}
|
|
2349
|
+
}).filter(Boolean);
|
|
2350
|
+
container.addAll(toAdd);
|
|
2351
|
+
};
|
|
2352
|
+
const resolveListDeltas = ({
|
|
2353
|
+
container,
|
|
2354
|
+
onAddItem,
|
|
2355
|
+
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
2356
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2357
|
+
}) => (entities) => {
|
|
2358
|
+
const mappedLayers = entities.map(idMapper);
|
|
2359
|
+
const toRemove = deltas(mappedLayers, container.models);
|
|
2360
|
+
toRemove.forEach(onRemoveItem);
|
|
2361
|
+
mappedLayers.forEach(onAddItem);
|
|
2362
|
+
};
|
|
2363
|
+
const resolveItemListDeltas = ({
|
|
2364
|
+
items,
|
|
2365
|
+
onAddItem,
|
|
2366
|
+
onRemoveItem,
|
|
2367
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2368
|
+
}) => (entities) => {
|
|
2369
|
+
const mappedLayers = entities.map(idMapper);
|
|
2370
|
+
const toRemove = deltas(mappedLayers, items);
|
|
2371
|
+
toRemove.forEach(onRemoveItem);
|
|
2372
|
+
mappedLayers.forEach(onAddItem);
|
|
2373
|
+
};
|
|
2374
|
+
const processId = (id, prefix = "parent-") => {
|
|
2375
|
+
let _id = id;
|
|
2376
|
+
if (_id.startsWith(prefix)) {
|
|
2377
|
+
_id = _id.replace(prefix, "");
|
|
2378
|
+
}
|
|
2379
|
+
return _id;
|
|
2380
|
+
};
|
|
2320
2381
|
var KosModelState = /* @__PURE__ */ ((KosModelState2) => {
|
|
2321
2382
|
KosModelState2["CREATING"] = `creating`;
|
|
2322
2383
|
KosModelState2["CREATED"] = `created`;
|
|
@@ -2338,6 +2399,9 @@ var KosModelState = /* @__PURE__ */ ((KosModelState2) => {
|
|
|
2338
2399
|
KosModelState2["ACTIVE"] = "active";
|
|
2339
2400
|
KosModelState2["ACTIVATING"] = "activating";
|
|
2340
2401
|
KosModelState2["DEACTIVATING"] = "deactivating";
|
|
2402
|
+
KosModelState2["RELOADING"] = `reloading`;
|
|
2403
|
+
KosModelState2["REATTACHING"] = `reattaching`;
|
|
2404
|
+
KosModelState2["RELOAD_READYING"] = `reload_readying`;
|
|
2341
2405
|
return KosModelState2;
|
|
2342
2406
|
})(KosModelState || {});
|
|
2343
2407
|
var KosModelEvents = /* @__PURE__ */ ((KosModelEvents2) => {
|
|
@@ -2353,6 +2417,7 @@ var KosModelEvents = /* @__PURE__ */ ((KosModelEvents2) => {
|
|
|
2353
2417
|
KosModelEvents2["GO_ACTIVE"] = "go_active";
|
|
2354
2418
|
KosModelEvents2["GO_INACTIVE"] = "go_inactive";
|
|
2355
2419
|
KosModelEvents2["TIMEOUT"] = "timeout";
|
|
2420
|
+
KosModelEvents2["RELOAD"] = `reload`;
|
|
2356
2421
|
return KosModelEvents2;
|
|
2357
2422
|
})(KosModelEvents || {});
|
|
2358
2423
|
const whenReady = async (dataModel) => {
|
|
@@ -2906,7 +2971,7 @@ function injectFutureContainerSupport(modelInstance) {
|
|
|
2906
2971
|
},
|
|
2907
2972
|
enumerable: true,
|
|
2908
2973
|
configurable: true
|
|
2909
|
-
//
|
|
2974
|
+
// so makeAutoObservable can redefine it
|
|
2910
2975
|
});
|
|
2911
2976
|
Object.defineProperty(modelInstance, "progress", {
|
|
2912
2977
|
get() {
|
|
@@ -3040,6 +3105,23 @@ function injectTroubleAwareSupport(modelInstance) {
|
|
|
3040
3105
|
configurable: true
|
|
3041
3106
|
});
|
|
3042
3107
|
}
|
|
3108
|
+
function createContainerReconcile(container, reconcile) {
|
|
3109
|
+
const { create, update, idMapper, filter, afterCreate } = reconcile;
|
|
3110
|
+
const apply = resolveContainerDeltas({
|
|
3111
|
+
container,
|
|
3112
|
+
onAddItem: (dto) => {
|
|
3113
|
+
const model = create(dto);
|
|
3114
|
+
afterCreate?.(model, dto);
|
|
3115
|
+
return model;
|
|
3116
|
+
},
|
|
3117
|
+
onUpdateItem: update ? (dto, existing) => {
|
|
3118
|
+
update(dto, existing);
|
|
3119
|
+
return null;
|
|
3120
|
+
} : void 0,
|
|
3121
|
+
idMapper
|
|
3122
|
+
});
|
|
3123
|
+
return (list) => apply(filter ? list.filter(filter) : list);
|
|
3124
|
+
}
|
|
3043
3125
|
function injectContainerAwareSupport(modelInstance, modelId) {
|
|
3044
3126
|
const containerSetup = modelInstance[ContainerAwareSetup];
|
|
3045
3127
|
if (!containerSetup) return;
|
|
@@ -3049,7 +3131,8 @@ function injectContainerAwareSupport(modelInstance, modelId) {
|
|
|
3049
3131
|
includeGetters,
|
|
3050
3132
|
modelsProperty,
|
|
3051
3133
|
containerOptions,
|
|
3052
|
-
legacy
|
|
3134
|
+
legacy,
|
|
3135
|
+
reconcile
|
|
3053
3136
|
} = containerSetup;
|
|
3054
3137
|
const finalContainerOptions = {
|
|
3055
3138
|
...containerOptions,
|
|
@@ -3079,6 +3162,9 @@ function injectContainerAwareSupport(modelInstance, modelId) {
|
|
|
3079
3162
|
modelInstance.removeAndDestroy = async (id) => container.removeAndDestroy(id);
|
|
3080
3163
|
modelInstance.removeAndDestroyAll = async (ids) => container.removeAndDestroyAll(ids);
|
|
3081
3164
|
}
|
|
3165
|
+
if (reconcile) {
|
|
3166
|
+
modelInstance.reconcile = createContainerReconcile(container, reconcile);
|
|
3167
|
+
}
|
|
3082
3168
|
if (includeGetters) {
|
|
3083
3169
|
Object.defineProperty(modelInstance, modelsProperty, {
|
|
3084
3170
|
get() {
|
|
@@ -3112,7 +3198,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3112
3198
|
get: () => parentModel,
|
|
3113
3199
|
enumerable: true,
|
|
3114
3200
|
configurable: true
|
|
3115
|
-
//
|
|
3201
|
+
// so makeAutoObservable can redefine it
|
|
3116
3202
|
});
|
|
3117
3203
|
if (mode === "composition") {
|
|
3118
3204
|
return;
|
|
@@ -3172,7 +3258,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3172
3258
|
},
|
|
3173
3259
|
enumerable: true,
|
|
3174
3260
|
configurable: true
|
|
3175
|
-
//
|
|
3261
|
+
// so makeAutoObservable can redefine it
|
|
3176
3262
|
});
|
|
3177
3263
|
}
|
|
3178
3264
|
} catch (error) {
|
|
@@ -4693,6 +4779,14 @@ const onlineMachine = (model) => {
|
|
|
4693
4779
|
const machine = (model) => {
|
|
4694
4780
|
const active = activeMachine(model).service;
|
|
4695
4781
|
const online = onlineMachine(model).service;
|
|
4782
|
+
const setStatus = (status) => kosAction(() => {
|
|
4783
|
+
model.status = status;
|
|
4784
|
+
});
|
|
4785
|
+
const failed = robot3.transition(
|
|
4786
|
+
`error`,
|
|
4787
|
+
KosModelState.FAILED,
|
|
4788
|
+
robot3.action(() => setStatus(KosModelState.FAILED))
|
|
4789
|
+
);
|
|
4696
4790
|
return robot3.createMachine(KosModelState.CREATING, {
|
|
4697
4791
|
[KosModelState.CREATING]: robot3.state(
|
|
4698
4792
|
robot3.transition(KosModelEvents.CREATE, KosModelState.CREATED)
|
|
@@ -4798,6 +4892,7 @@ const machine = (model) => {
|
|
|
4798
4892
|
robot3.action(model.unload?.bind(model))
|
|
4799
4893
|
),
|
|
4800
4894
|
robot3.transition(KosModelEvents.RESET, KosModelState.RESETTING),
|
|
4895
|
+
robot3.transition(KosModelEvents.RELOAD, KosModelState.RELOADING),
|
|
4801
4896
|
robot3.transition(
|
|
4802
4897
|
KosModelEvents.GO_ONLINE,
|
|
4803
4898
|
KosModelState.READY,
|
|
@@ -4827,6 +4922,49 @@ const machine = (model) => {
|
|
|
4827
4922
|
})
|
|
4828
4923
|
)
|
|
4829
4924
|
),
|
|
4925
|
+
[KosModelState.RELOADING]: robot3.invoke(
|
|
4926
|
+
() => {
|
|
4927
|
+
setStatus(KosModelState.RELOADING);
|
|
4928
|
+
return model.reloadData();
|
|
4929
|
+
},
|
|
4930
|
+
robot3.transition(`done`, KosModelState.REATTACHING),
|
|
4931
|
+
robot3.transition(
|
|
4932
|
+
`error`,
|
|
4933
|
+
KosModelState.REATTACHING,
|
|
4934
|
+
robot3.action((_ctx, event) => {
|
|
4935
|
+
KosLog.error(
|
|
4936
|
+
`Model ${model.modelId} - ${model.modelTypeName} failed to reload; its data stays as it was. ${String(
|
|
4937
|
+
event?.error
|
|
4938
|
+
)}`
|
|
4939
|
+
);
|
|
4940
|
+
})
|
|
4941
|
+
)
|
|
4942
|
+
),
|
|
4943
|
+
[KosModelState.REATTACHING]: robot3.invoke(
|
|
4944
|
+
() => {
|
|
4945
|
+
setStatus(KosModelState.REATTACHING);
|
|
4946
|
+
return model.reattach();
|
|
4947
|
+
},
|
|
4948
|
+
robot3.transition(`done`, KosModelState.RELOAD_READYING),
|
|
4949
|
+
failed
|
|
4950
|
+
),
|
|
4951
|
+
[KosModelState.RELOAD_READYING]: robot3.invoke(
|
|
4952
|
+
() => {
|
|
4953
|
+
setStatus(KosModelState.READYING);
|
|
4954
|
+
return model.ready();
|
|
4955
|
+
},
|
|
4956
|
+
robot3.transition(
|
|
4957
|
+
`done`,
|
|
4958
|
+
KosModelState.READY,
|
|
4959
|
+
robot3.action(() => {
|
|
4960
|
+
setStatus(KosModelState.READY);
|
|
4961
|
+
if (!KosCore.getInstance().isOnline) {
|
|
4962
|
+
online.send(KosModelEvents.GO_OFFLINE);
|
|
4963
|
+
}
|
|
4964
|
+
})
|
|
4965
|
+
),
|
|
4966
|
+
failed
|
|
4967
|
+
),
|
|
4830
4968
|
[KosModelState.UNLOADED]: robot3.state(),
|
|
4831
4969
|
[KosModelState.FAILED]: robot3.state()
|
|
4832
4970
|
});
|
|
@@ -4905,6 +5043,26 @@ class KosFSMManager {
|
|
|
4905
5043
|
this.disposer = void 0;
|
|
4906
5044
|
});
|
|
4907
5045
|
}
|
|
5046
|
+
/**
|
|
5047
|
+
* Re-enters a READY model through RELOADING, REATTACHING and READYING and
|
|
5048
|
+
* resolves once it is READY again; rejects if it fails. A model that is not
|
|
5049
|
+
* READY is left alone.
|
|
5050
|
+
*/
|
|
5051
|
+
async reload() {
|
|
5052
|
+
if (this.current !== KosModelState.READY) {
|
|
5053
|
+
this.log.debug(
|
|
5054
|
+
`Model ${this.model.modelId} is ${this.current}, not READY; skipping reload`
|
|
5055
|
+
);
|
|
5056
|
+
return;
|
|
5057
|
+
}
|
|
5058
|
+
this.service.send(KosModelEvents.RELOAD);
|
|
5059
|
+
await mobx.when(
|
|
5060
|
+
() => this.model.status === KosModelState.READY || this.model.status === KosModelState.FAILED
|
|
5061
|
+
);
|
|
5062
|
+
if (this.model.status === KosModelState.FAILED) {
|
|
5063
|
+
throw new Error(`reload failed for model ${this.model.modelId}`);
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
4908
5066
|
/**
|
|
4909
5067
|
* Checks if a given target maps to status, activeStatus, or onlineStatus.
|
|
4910
5068
|
* Online/offline transitions are tracked on model.onlineStatus because the
|
|
@@ -5157,7 +5315,7 @@ class KosOfflineQueue {
|
|
|
5157
5315
|
});
|
|
5158
5316
|
}
|
|
5159
5317
|
/**
|
|
5160
|
-
* Flush all queued events
|
|
5318
|
+
* Flush all queued events without temporal filtering
|
|
5161
5319
|
*/
|
|
5162
5320
|
flush() {
|
|
5163
5321
|
if (this.queue.length === 0) return;
|
|
@@ -8856,9 +9014,9 @@ class MockInterceptorTransport {
|
|
|
8856
9014
|
this.inner.send(data);
|
|
8857
9015
|
}
|
|
8858
9016
|
}
|
|
8859
|
-
close() {
|
|
9017
|
+
close(code, reason) {
|
|
8860
9018
|
this.unregisterInjector();
|
|
8861
|
-
return this.inner.close();
|
|
9019
|
+
return this.inner.close(code, reason);
|
|
8862
9020
|
}
|
|
8863
9021
|
addEventListener(type, listener, options) {
|
|
8864
9022
|
this.inner.addEventListener(type, listener, options);
|
|
@@ -9393,13 +9551,9 @@ class WebSocketTransport {
|
|
|
9393
9551
|
if (connectionEstablished) {
|
|
9394
9552
|
log$v.warn("Connection Established");
|
|
9395
9553
|
this.reconnectAttempts = 0;
|
|
9396
|
-
publish(
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
);
|
|
9400
|
-
if (initialized) {
|
|
9401
|
-
publish(WebSocketEvents.RELOAD, WebSocketEvents.RELOAD);
|
|
9402
|
-
}
|
|
9554
|
+
publish(WebSocketEvents.CONNECTED, {
|
|
9555
|
+
reconnect: initialized
|
|
9556
|
+
});
|
|
9403
9557
|
initialized = true;
|
|
9404
9558
|
}
|
|
9405
9559
|
}
|
|
@@ -9574,6 +9728,13 @@ ${dstAddr}topics:${topic}
|
|
|
9574
9728
|
status: `success`
|
|
9575
9729
|
};
|
|
9576
9730
|
}
|
|
9731
|
+
dropConnection() {
|
|
9732
|
+
if (!this.connectionEstablished) {
|
|
9733
|
+
log$v.debug("dropConnection ignored: the connection is already closed");
|
|
9734
|
+
return;
|
|
9735
|
+
}
|
|
9736
|
+
this.socket?.socket.close(1e3);
|
|
9737
|
+
}
|
|
9577
9738
|
get token() {
|
|
9578
9739
|
return this._token;
|
|
9579
9740
|
}
|
|
@@ -10761,18 +10922,63 @@ class KosModel {
|
|
|
10761
10922
|
);
|
|
10762
10923
|
this.subscriptionManager?.registerAll(lifecycle);
|
|
10763
10924
|
}
|
|
10764
|
-
/**
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10925
|
+
/** Narrow, framework-owned teardown for a reload; never the author's unload(). */
|
|
10926
|
+
suspendForReload() {
|
|
10927
|
+
this.subscriptionManager?.disposeAll();
|
|
10928
|
+
this.effectManager?.disposeAll();
|
|
10929
|
+
this.httpRouteManager?.dispose();
|
|
10930
|
+
this.onlineLifecycleManager?.dispose();
|
|
10931
|
+
kosAction(() => {
|
|
10932
|
+
this.loaded = false;
|
|
10933
|
+
});
|
|
10934
|
+
}
|
|
10935
|
+
/** @internal */
|
|
10936
|
+
async reloadData() {
|
|
10937
|
+
log$u.info(`reloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10938
|
+
this.suspendForReload();
|
|
10939
|
+
const data = this.modelData;
|
|
10940
|
+
if (typeof data?.reload === "function" && !data[SelfManagedReload]) {
|
|
10941
|
+
await data.reload();
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
/** @internal */
|
|
10945
|
+
async reattach() {
|
|
10946
|
+
log$u.info(`reattaching model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10947
|
+
kosAction(() => {
|
|
10948
|
+
this.loaded = true;
|
|
10949
|
+
});
|
|
10771
10950
|
this.subscriptionManager?.registerAll();
|
|
10772
10951
|
this.httpRouteManager?.registerAll();
|
|
10773
10952
|
this.effectManager?.setup();
|
|
10774
|
-
|
|
10775
|
-
|
|
10953
|
+
this.onlineLifecycleManager?.register();
|
|
10954
|
+
await this.reenterChildren();
|
|
10955
|
+
}
|
|
10956
|
+
// A READY child runs its own reload sequence; one created by reload() and
|
|
10957
|
+
// still booting is awaited through its normal lifecycle.
|
|
10958
|
+
async reenterChildren() {
|
|
10959
|
+
const children = this.getChildren();
|
|
10960
|
+
const ready = children.filter(
|
|
10961
|
+
(child) => child.fsm.current === KosModelState.READY
|
|
10962
|
+
);
|
|
10963
|
+
const booting = children.filter(
|
|
10964
|
+
(child) => child.fsm.current !== KosModelState.READY && child.fsm.current !== KosModelState.UNLOADED
|
|
10965
|
+
);
|
|
10966
|
+
const [reloaded] = await Promise.all([
|
|
10967
|
+
Promise.allSettled(ready.map((child) => child.fsm.reload())),
|
|
10968
|
+
executeListLifecycle(
|
|
10969
|
+
this,
|
|
10970
|
+
booting,
|
|
10971
|
+
Transitions.READY,
|
|
10972
|
+
DependencyLifecycle.READY
|
|
10973
|
+
)
|
|
10974
|
+
]);
|
|
10975
|
+
reloaded.forEach((result, index) => {
|
|
10976
|
+
if (result.status === "rejected") {
|
|
10977
|
+
log$u.error(
|
|
10978
|
+
`reload of child ${ready[index].modelId} of ${this.modelId} failed`,
|
|
10979
|
+
result.reason
|
|
10980
|
+
);
|
|
10981
|
+
}
|
|
10776
10982
|
});
|
|
10777
10983
|
}
|
|
10778
10984
|
/**
|
|
@@ -11037,9 +11243,8 @@ class KosModelManager {
|
|
|
11037
11243
|
* @returns An array of preloaded model instances.
|
|
11038
11244
|
*
|
|
11039
11245
|
* @remarks
|
|
11040
|
-
*
|
|
11041
|
-
*
|
|
11042
|
-
* - Supports both string-based model keys and object-based model configurations.
|
|
11246
|
+
* Entries in `preloadModels` may be a model type string or an object with
|
|
11247
|
+
* `modelType`, `modelId` and `options`.
|
|
11043
11248
|
*/
|
|
11044
11249
|
get preloadedModels() {
|
|
11045
11250
|
return this.cache.preload((modelKey) => {
|
|
@@ -11353,6 +11558,9 @@ var KosCoreState = /* @__PURE__ */ ((KosCoreState2) => {
|
|
|
11353
11558
|
KosCoreState2["UNLOADING"] = `unloading`;
|
|
11354
11559
|
KosCoreState2["UNLOADED"] = `unloaded`;
|
|
11355
11560
|
KosCoreState2["RELOADING"] = `reloading`;
|
|
11561
|
+
KosCoreState2["RECONNECTING"] = `reconnecting`;
|
|
11562
|
+
KosCoreState2["RECONNECT_INTERRUPTED"] = `reconnect_interrupted`;
|
|
11563
|
+
KosCoreState2["RECONNECT_PENDING"] = `reconnect_pending`;
|
|
11356
11564
|
KosCoreState2["FAILED"] = `failed`;
|
|
11357
11565
|
return KosCoreState2;
|
|
11358
11566
|
})(KosCoreState || {});
|
|
@@ -11364,6 +11572,7 @@ var KosCoreEvents = /* @__PURE__ */ ((KosCoreEvents2) => {
|
|
|
11364
11572
|
KosCoreEvents2["GO_OFFLINE"] = `go_offline`;
|
|
11365
11573
|
KosCoreEvents2["UNLOAD"] = `unload`;
|
|
11366
11574
|
KosCoreEvents2["RELOAD"] = `reload`;
|
|
11575
|
+
KosCoreEvents2["RECONNECT"] = `reconnect`;
|
|
11367
11576
|
return KosCoreEvents2;
|
|
11368
11577
|
})(KosCoreEvents || {});
|
|
11369
11578
|
const reportFailure = async (step, run) => {
|
|
@@ -11410,8 +11619,23 @@ const coreFsm = (core) => {
|
|
|
11410
11619
|
});
|
|
11411
11620
|
const online = robot3.interpret(
|
|
11412
11621
|
onlineMachine2,
|
|
11413
|
-
(_service) => log$M.debug(_service.machine.current)
|
|
11622
|
+
(_service) => log$M.debug(`KOS Core connection: ${_service.machine.current}`)
|
|
11623
|
+
);
|
|
11624
|
+
const syncOnline = () => online.send(
|
|
11625
|
+
core.transport.connectionEstablished ? "go_online" : "go_offline"
|
|
11626
|
+
/* GO_OFFLINE */
|
|
11414
11627
|
);
|
|
11628
|
+
const setReconnecting = (reconnecting) => mobx.runInAction(() => {
|
|
11629
|
+
core.reconnecting = reconnecting;
|
|
11630
|
+
});
|
|
11631
|
+
const reconnectDone = robot3.action(() => setReconnecting(false));
|
|
11632
|
+
const reconnectedOnline = robot3.action(() => {
|
|
11633
|
+
setReconnecting(false);
|
|
11634
|
+
online.send(
|
|
11635
|
+
"go_online"
|
|
11636
|
+
/* GO_ONLINE */
|
|
11637
|
+
);
|
|
11638
|
+
});
|
|
11415
11639
|
const failed = robot3.transition(
|
|
11416
11640
|
`error`,
|
|
11417
11641
|
"failed",
|
|
@@ -11496,10 +11720,56 @@ const coreFsm = (core) => {
|
|
|
11496
11720
|
mobx.runInAction(() => {
|
|
11497
11721
|
core.status = "ready";
|
|
11498
11722
|
});
|
|
11723
|
+
syncOnline();
|
|
11499
11724
|
})
|
|
11500
11725
|
),
|
|
11501
11726
|
failed
|
|
11502
11727
|
),
|
|
11728
|
+
[
|
|
11729
|
+
"reconnecting"
|
|
11730
|
+
/* RECONNECTING */
|
|
11731
|
+
]: robot3.invoke(
|
|
11732
|
+
() => reportFailure("reconnecting", () => core.reload()),
|
|
11733
|
+
robot3.transition(`done`, "ready", reconnectedOnline),
|
|
11734
|
+
robot3.transition(`error`, "ready", reconnectedOnline),
|
|
11735
|
+
robot3.transition(
|
|
11736
|
+
"go_offline",
|
|
11737
|
+
"reconnect_interrupted"
|
|
11738
|
+
/* RECONNECT_INTERRUPTED */
|
|
11739
|
+
)
|
|
11740
|
+
),
|
|
11741
|
+
[
|
|
11742
|
+
"reconnect_interrupted"
|
|
11743
|
+
/* RECONNECT_INTERRUPTED */
|
|
11744
|
+
]: robot3.state(
|
|
11745
|
+
robot3.transition(`done`, "ready", reconnectDone),
|
|
11746
|
+
robot3.transition(`error`, "ready", reconnectDone),
|
|
11747
|
+
robot3.transition(
|
|
11748
|
+
"reconnect",
|
|
11749
|
+
"reconnect_pending"
|
|
11750
|
+
/* RECONNECT_PENDING */
|
|
11751
|
+
)
|
|
11752
|
+
),
|
|
11753
|
+
[
|
|
11754
|
+
"reconnect_pending"
|
|
11755
|
+
/* RECONNECT_PENDING */
|
|
11756
|
+
]: robot3.state(
|
|
11757
|
+
robot3.transition(
|
|
11758
|
+
`done`,
|
|
11759
|
+
"reconnecting"
|
|
11760
|
+
/* RECONNECTING */
|
|
11761
|
+
),
|
|
11762
|
+
robot3.transition(
|
|
11763
|
+
`error`,
|
|
11764
|
+
"reconnecting"
|
|
11765
|
+
/* RECONNECTING */
|
|
11766
|
+
),
|
|
11767
|
+
robot3.transition(
|
|
11768
|
+
"go_offline",
|
|
11769
|
+
"reconnect_interrupted"
|
|
11770
|
+
/* RECONNECT_INTERRUPTED */
|
|
11771
|
+
)
|
|
11772
|
+
),
|
|
11503
11773
|
[
|
|
11504
11774
|
"reloading"
|
|
11505
11775
|
/* RELOADING */
|
|
@@ -11525,6 +11795,11 @@ const coreFsm = (core) => {
|
|
|
11525
11795
|
"reloading"
|
|
11526
11796
|
/* RELOADING */
|
|
11527
11797
|
),
|
|
11798
|
+
robot3.transition(
|
|
11799
|
+
"reconnect",
|
|
11800
|
+
"reconnecting",
|
|
11801
|
+
robot3.action(() => setReconnecting(true))
|
|
11802
|
+
),
|
|
11528
11803
|
robot3.transition(
|
|
11529
11804
|
"unload",
|
|
11530
11805
|
"unloaded",
|
|
@@ -11558,7 +11833,7 @@ const coreFsm = (core) => {
|
|
|
11558
11833
|
});
|
|
11559
11834
|
const service2 = robot3.interpret(
|
|
11560
11835
|
machine2,
|
|
11561
|
-
(_service) => log$M.debug(_service.machine.current)
|
|
11836
|
+
(_service) => log$M.debug(`KOS Core state: ${_service.machine.current}`)
|
|
11562
11837
|
);
|
|
11563
11838
|
return { service: service2, online };
|
|
11564
11839
|
};
|
|
@@ -11636,6 +11911,15 @@ const rejectAfterDelay = (ms, model) => {
|
|
|
11636
11911
|
};
|
|
11637
11912
|
const isReloadable = (model) => typeof model.reload === "function";
|
|
11638
11913
|
const isSelfManagedReload = (model) => !!model[SelfManagedReload];
|
|
11914
|
+
const isCoreReloaded = (model) => isReloadable(model.modelData) && !isSelfManagedReload(model.modelData);
|
|
11915
|
+
const addDescendants = (model, into) => {
|
|
11916
|
+
model.getChildren().forEach((child) => {
|
|
11917
|
+
if (!into.has(child)) {
|
|
11918
|
+
into.add(child);
|
|
11919
|
+
addDescendants(child, into);
|
|
11920
|
+
}
|
|
11921
|
+
});
|
|
11922
|
+
};
|
|
11639
11923
|
const isUnloadable = (model) => typeof model.unload === "function";
|
|
11640
11924
|
var AuthState = /* @__PURE__ */ ((AuthState2) => {
|
|
11641
11925
|
AuthState2["LOGGED_IN"] = "logged_in";
|
|
@@ -11653,6 +11937,7 @@ class KosCore {
|
|
|
11653
11937
|
authState;
|
|
11654
11938
|
isOnline;
|
|
11655
11939
|
_reloading;
|
|
11940
|
+
reconnecting;
|
|
11656
11941
|
_unloading;
|
|
11657
11942
|
lifecycleStarted = false;
|
|
11658
11943
|
connectionAlias;
|
|
@@ -11664,6 +11949,7 @@ class KosCore {
|
|
|
11664
11949
|
this.status = KosCoreState.CREATED;
|
|
11665
11950
|
this.authState = "logged_out";
|
|
11666
11951
|
this._reloading = false;
|
|
11952
|
+
this.reconnecting = false;
|
|
11667
11953
|
this._unloading = false;
|
|
11668
11954
|
mobx.makeAutoObservable(this);
|
|
11669
11955
|
subscribe("token", (data) => {
|
|
@@ -11674,12 +11960,11 @@ class KosCore {
|
|
|
11674
11960
|
subscribe(WebSocketEvents.DISCONNECTED, () => {
|
|
11675
11961
|
this.fsmService.service.send(KosCoreEvents.GO_OFFLINE);
|
|
11676
11962
|
});
|
|
11677
|
-
subscribe(WebSocketEvents.CONNECTED,
|
|
11678
|
-
|
|
11679
|
-
this.
|
|
11680
|
-
|
|
11963
|
+
subscribe(WebSocketEvents.CONNECTED, (msg) => {
|
|
11964
|
+
const reconnect = msg?.body?.reconnect;
|
|
11965
|
+
this.fsmService.service.send(
|
|
11966
|
+
reconnect ? KosCoreEvents.RECONNECT : KosCoreEvents.GO_ONLINE
|
|
11681
11967
|
);
|
|
11682
|
-
this.fsmService.service.send(KosCoreEvents.GO_ONLINE);
|
|
11683
11968
|
});
|
|
11684
11969
|
subscribe("/studioServer/auth/LOGGED_IN", () => {
|
|
11685
11970
|
mobx.runInAction(() => {
|
|
@@ -11756,64 +12041,74 @@ alias:${alias}
|
|
|
11756
12041
|
this.fsmService.service.send(KosCoreEvents.CREATE);
|
|
11757
12042
|
}
|
|
11758
12043
|
get onlineStatus() {
|
|
11759
|
-
return this.isOnline && !this.
|
|
12044
|
+
return this.isOnline && !this.reloading && !this._unloading;
|
|
11760
12045
|
}
|
|
11761
12046
|
get reloading() {
|
|
11762
|
-
return this._reloading;
|
|
12047
|
+
return this._reloading || this.reconnecting;
|
|
11763
12048
|
}
|
|
11764
12049
|
get unloading() {
|
|
11765
12050
|
return this._unloading;
|
|
11766
12051
|
}
|
|
11767
12052
|
async reload() {
|
|
11768
|
-
const currentTime = Date.now();
|
|
11769
12053
|
if (this._reloading) {
|
|
11770
12054
|
log$r.info("reload already in progress");
|
|
11771
12055
|
return;
|
|
11772
12056
|
}
|
|
11773
12057
|
this._reloading = true;
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
12058
|
+
try {
|
|
12059
|
+
log$r.warn("reloading KOS Core");
|
|
12060
|
+
log$r.warn("reloading preloaded models");
|
|
12061
|
+
const modelManager = this.modelManager;
|
|
12062
|
+
const preloaded = [...modelManager.preloadedModels];
|
|
12063
|
+
const covered = /* @__PURE__ */ new Set();
|
|
12064
|
+
modelManager.models.filter((model) => isCoreReloaded(model)).forEach((model) => addDescendants(model, covered));
|
|
12065
|
+
const reloadRoot = async (model) => {
|
|
12066
|
+
await this.reloadOne(model);
|
|
12067
|
+
addDescendants(model, covered);
|
|
12068
|
+
};
|
|
12069
|
+
for (const model of preloaded) {
|
|
12070
|
+
if (isReloadable(model.modelData) && !covered.has(model)) {
|
|
12071
|
+
if (isSelfManagedReload(model.modelData)) {
|
|
12072
|
+
log$r.info(`skipping self-managed model ${model.modelId}`);
|
|
12073
|
+
continue;
|
|
12074
|
+
}
|
|
12075
|
+
log$r.info(`reloading model ${model.modelId}`);
|
|
12076
|
+
await reloadRoot(model);
|
|
12077
|
+
log$r.info(`reloading model ${model.modelId} complete`);
|
|
11782
12078
|
}
|
|
11783
|
-
log$r.info(`reloading model ${model.modelId}`);
|
|
11784
|
-
await this.reloadModel(model, model.modelData);
|
|
11785
|
-
log$r.info(`reloading model ${model.modelId} complete`);
|
|
11786
12079
|
}
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
12080
|
+
for (const model of [...modelManager.models]) {
|
|
12081
|
+
if (!preloaded.includes(model) && isReloadable(model.modelData) && !covered.has(model)) {
|
|
12082
|
+
if (isSelfManagedReload(model.modelData)) {
|
|
12083
|
+
log$r.info(`skipping self-managed model ${model.modelId}`);
|
|
12084
|
+
continue;
|
|
12085
|
+
}
|
|
12086
|
+
log$r.warn(`reloading model ${model.modelId}`);
|
|
12087
|
+
await reloadRoot(model);
|
|
11793
12088
|
}
|
|
11794
|
-
log$r.warn(`reloading model ${model.modelId}`);
|
|
11795
|
-
await this.reloadModel(model, model.modelData);
|
|
11796
12089
|
}
|
|
11797
|
-
}
|
|
11798
|
-
const elapsed = Date.now() - currentTime;
|
|
11799
|
-
setTimeout(() => {
|
|
12090
|
+
} finally {
|
|
11800
12091
|
mobx.runInAction(() => {
|
|
11801
12092
|
log$r.warn("reloading KOS Core complete");
|
|
11802
12093
|
this._reloading = false;
|
|
11803
12094
|
});
|
|
11804
|
-
}
|
|
12095
|
+
}
|
|
11805
12096
|
}
|
|
11806
|
-
//
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
12097
|
+
// reload never calls unload(); the model machine owns the narrow teardown
|
|
12098
|
+
async reloadOne(model) {
|
|
12099
|
+
try {
|
|
12100
|
+
await model.fsm.reload();
|
|
12101
|
+
} catch (e) {
|
|
12102
|
+
log$r.error(`reload of ${model.modelId} failed`, e);
|
|
12103
|
+
}
|
|
11812
12104
|
}
|
|
11813
12105
|
async online() {
|
|
11814
12106
|
log$r.debug("KOS Core going online");
|
|
11815
12107
|
await this._transport.whenReady();
|
|
11816
12108
|
log$r.debug("KOS Transport Ready. Calling online() for models");
|
|
12109
|
+
this.modelManager.models.forEach(
|
|
12110
|
+
(model) => model.onlineLifecycleManager?.register()
|
|
12111
|
+
);
|
|
11817
12112
|
publish("/kosCore/online", "/kosCore/online");
|
|
11818
12113
|
console.timeEnd("kosCore:startup");
|
|
11819
12114
|
}
|
|
@@ -12539,29 +12834,11 @@ const ServiceFactory = {
|
|
|
12539
12834
|
* @returns An object with service methods for interacting with the server.
|
|
12540
12835
|
*
|
|
12541
12836
|
* @example
|
|
12542
|
-
*
|
|
12543
|
-
* const entityService = ServiceFactory.build({
|
|
12544
|
-
*
|
|
12545
|
-
*
|
|
12546
|
-
*
|
|
12547
|
-
* deleteModelPath: "/delete",
|
|
12548
|
-
* addModelPath: "/add",
|
|
12549
|
-
* modifyModelPath: "/modify",
|
|
12550
|
-
* });
|
|
12551
|
-
*
|
|
12552
|
-
* // Fetch a list of entities.
|
|
12553
|
-
* const entities = await entityService.getAll({ ordered: true });
|
|
12554
|
-
*
|
|
12555
|
-
* // Get details of a specific entity by ID.
|
|
12556
|
-
* const entityDetails = await entityService.getModelById({ id: "entity123" });
|
|
12557
|
-
*
|
|
12558
|
-
* // Add a new entity to the server.
|
|
12559
|
-
* const newEntity = { name: "New Entity" };
|
|
12560
|
-
* await entityService.addModel({ model: newEntity });
|
|
12561
|
-
*
|
|
12562
|
-
* // Modify an existing entity.
|
|
12563
|
-
* const updatedEntity = { id: "entity123", name: "Updated Entity" };
|
|
12564
|
-
* await entityService.modifyModel({ model: updatedEntity });
|
|
12837
|
+
* ```typescript
|
|
12838
|
+
* const entityService = ServiceFactory.build({ basePath: "/api/entities" });
|
|
12839
|
+
* const entities = await entityService.getAll({});
|
|
12840
|
+
* await entityService.modifyModel({ id: "entity123", model: { name: "Updated" } });
|
|
12841
|
+
* ```
|
|
12565
12842
|
*/
|
|
12566
12843
|
build: ({
|
|
12567
12844
|
destinationAddress = "",
|
|
@@ -12912,7 +13189,7 @@ class KosDataContainer {
|
|
|
12912
13189
|
}
|
|
12913
13190
|
}
|
|
12914
13191
|
/**
|
|
12915
|
-
*
|
|
13192
|
+
* Watch indexed data properties and bump the container revision when they change (Zone 3)
|
|
12916
13193
|
* @private
|
|
12917
13194
|
*/
|
|
12918
13195
|
_configureDataMonitoring(data) {
|
|
@@ -12983,9 +13260,9 @@ class KosDataContainer {
|
|
|
12983
13260
|
}
|
|
12984
13261
|
}
|
|
12985
13262
|
/**
|
|
12986
|
-
*
|
|
12987
|
-
*
|
|
12988
|
-
*
|
|
13263
|
+
* Evict data models when capacity is exceeded (Zone 2: Workflow orchestration).
|
|
13264
|
+
* Evictions are logged at INFO level. Data models have no lifecycle, so they
|
|
13265
|
+
* are removed from the container rather than destroyed.
|
|
12989
13266
|
* @private
|
|
12990
13267
|
*/
|
|
12991
13268
|
_evictModels() {
|
|
@@ -12999,7 +13276,7 @@ class KosDataContainer {
|
|
|
12999
13276
|
this._logDataEvictionComplete(idsToEvict.length);
|
|
13000
13277
|
}
|
|
13001
13278
|
/**
|
|
13002
|
-
* Log
|
|
13279
|
+
* Log that the data container exceeded its capacity (Zone 3)
|
|
13003
13280
|
* @private
|
|
13004
13281
|
*/
|
|
13005
13282
|
_logDataCapacityWarning(toEvict) {
|
|
@@ -13621,16 +13898,9 @@ let ConfigBeanModelImpl = class {
|
|
|
13621
13898
|
this.prevProps = ObservableData();
|
|
13622
13899
|
}
|
|
13623
13900
|
/**
|
|
13624
|
-
*
|
|
13901
|
+
* Current values of all the bean's attributes.
|
|
13625
13902
|
*
|
|
13626
13903
|
* @returns Object containing all configuration properties with their current values
|
|
13627
|
-
*
|
|
13628
|
-
* @example Access Configuration Values
|
|
13629
|
-
* ```typescript
|
|
13630
|
-
* const currentValues = systemConfig.values;
|
|
13631
|
-
* console.log('Machine ID:', currentValues.machineId);
|
|
13632
|
-
* console.log('Debug Mode:', currentValues.debugMode);
|
|
13633
|
-
* ```
|
|
13634
13904
|
*/
|
|
13635
13905
|
get values() {
|
|
13636
13906
|
return this.props.values;
|
|
@@ -13646,12 +13916,24 @@ let ConfigBeanModelImpl = class {
|
|
|
13646
13916
|
* @internal
|
|
13647
13917
|
*
|
|
13648
13918
|
* @remarks
|
|
13649
|
-
*
|
|
13650
|
-
*
|
|
13651
|
-
* In future additional information about the workspace could be loaded
|
|
13919
|
+
* Fetches the bean's values and schema.
|
|
13652
13920
|
*/
|
|
13653
13921
|
async load() {
|
|
13654
13922
|
log$k.debug(`loading config bean ${this.path}`);
|
|
13923
|
+
await this.fetchBean();
|
|
13924
|
+
}
|
|
13925
|
+
/**
|
|
13926
|
+
* @internal
|
|
13927
|
+
*
|
|
13928
|
+
* @remarks
|
|
13929
|
+
* Fetches the bean again and updates its values and schema in place, so a
|
|
13930
|
+
* KOS Core reload after a reconnect leaves the same instance current.
|
|
13931
|
+
*/
|
|
13932
|
+
async reload() {
|
|
13933
|
+
log$k.debug(`reloading config bean ${this.path}`);
|
|
13934
|
+
await this.fetchBean();
|
|
13935
|
+
}
|
|
13936
|
+
async fetchBean() {
|
|
13655
13937
|
const response = await this._getConfigBean(
|
|
13656
13938
|
this.path,
|
|
13657
13939
|
this.serviceBasePath,
|
|
@@ -13678,19 +13960,11 @@ let ConfigBeanModelImpl = class {
|
|
|
13678
13960
|
return Object.keys(this._schema?.schema || {});
|
|
13679
13961
|
}
|
|
13680
13962
|
/**
|
|
13681
|
-
*
|
|
13963
|
+
* Schema definition of an attribute. Schema keys may be regular expressions,
|
|
13964
|
+
* so a key with no exact entry is matched against them.
|
|
13682
13965
|
*
|
|
13683
13966
|
* @param key - Property key to get schema for
|
|
13684
13967
|
* @returns Schema definition if found, undefined otherwise
|
|
13685
|
-
*
|
|
13686
|
-
* @example Get Property Schema
|
|
13687
|
-
* ```typescript
|
|
13688
|
-
* const schema = systemConfig.getSchemaForProperty('debugMode');
|
|
13689
|
-
* if (schema) {
|
|
13690
|
-
* console.log('Type:', schema.type);
|
|
13691
|
-
* console.log('Description:', schema.description);
|
|
13692
|
-
* }
|
|
13693
|
-
* ```
|
|
13694
13968
|
*/
|
|
13695
13969
|
getSchemaForProperty(key) {
|
|
13696
13970
|
if (this.schemaKeys.includes(key)) {
|
|
@@ -13704,18 +13978,12 @@ let ConfigBeanModelImpl = class {
|
|
|
13704
13978
|
}
|
|
13705
13979
|
// -------------------ACTIONS----------------------------
|
|
13706
13980
|
/**
|
|
13707
|
-
*
|
|
13981
|
+
* Sets one attribute and writes the bean to the backend.
|
|
13708
13982
|
*
|
|
13709
13983
|
* @category Action
|
|
13710
13984
|
*
|
|
13711
13985
|
* @param key - The configuration property key to update
|
|
13712
13986
|
* @param value - The new value to set for the property
|
|
13713
|
-
*
|
|
13714
|
-
* @example Update Configuration Property
|
|
13715
|
-
* ```typescript
|
|
13716
|
-
* await systemConfig.updateProperty('debugMode', true);
|
|
13717
|
-
* await systemConfig.updateProperty('machineId', 'MACHINE-001');
|
|
13718
|
-
* ```
|
|
13719
13987
|
*/
|
|
13720
13988
|
async updateProperty(key, value) {
|
|
13721
13989
|
this.props[key] = value;
|
|
@@ -14700,18 +14968,8 @@ let KosConfigPropertyImpl = class {
|
|
|
14700
14968
|
return "";
|
|
14701
14969
|
}
|
|
14702
14970
|
/**
|
|
14703
|
-
*
|
|
14704
|
-
*
|
|
14705
|
-
* @returns Array of options with label/value pairs for dropdowns and selection controls
|
|
14706
|
-
*
|
|
14707
|
-
* @example Get Property Options
|
|
14708
|
-
* ```typescript
|
|
14709
|
-
* const options = statusProperty.options;
|
|
14710
|
-
* // Returns: [
|
|
14711
|
-
* // { label: "Active", value: "active" },
|
|
14712
|
-
* // { label: "Inactive", value: "inactive" }
|
|
14713
|
-
* // ]
|
|
14714
|
-
* ```
|
|
14971
|
+
* Options for an enumerated property: the `optionsExpander` when set, otherwise
|
|
14972
|
+
* the schema's enum values or the values derived from its schema.
|
|
14715
14973
|
*/
|
|
14716
14974
|
get options() {
|
|
14717
14975
|
const defaultUnitSystem = this.regionInfo.defaultUnitSystem;
|
|
@@ -14753,27 +15011,17 @@ let KosConfigPropertyImpl = class {
|
|
|
14753
15011
|
return { backend, display };
|
|
14754
15012
|
}
|
|
14755
15013
|
/**
|
|
14756
|
-
*
|
|
15014
|
+
* Writes the value, given in display units, through {@link updateProperty}.
|
|
14757
15015
|
*
|
|
14758
|
-
* @param value - The new value
|
|
14759
|
-
*
|
|
14760
|
-
* @example Update Property Value
|
|
14761
|
-
* ```typescript
|
|
14762
|
-
* pumpRateProperty.value = 1.2; // Sets rate to 1.2 mL/s (converted to backend units)
|
|
14763
|
-
* ```
|
|
15016
|
+
* @param value - The new value in display units
|
|
14764
15017
|
*/
|
|
14765
15018
|
set value(value) {
|
|
14766
15019
|
this.updateProperty(value);
|
|
14767
15020
|
}
|
|
14768
15021
|
/**
|
|
14769
|
-
*
|
|
15022
|
+
* The value converted to display units.
|
|
14770
15023
|
*
|
|
14771
|
-
* @returns Property value in
|
|
14772
|
-
*
|
|
14773
|
-
* @example Get Property Value
|
|
14774
|
-
* ```typescript
|
|
14775
|
-
* const currentRate = pumpRateProperty.value; // Gets rate in mL/s (regional units)
|
|
14776
|
-
* ```
|
|
15024
|
+
* @returns Property value in display units
|
|
14777
15025
|
*/
|
|
14778
15026
|
get value() {
|
|
14779
15027
|
return this.getValue(true);
|
|
@@ -14818,16 +15066,9 @@ let KosConfigPropertyImpl = class {
|
|
|
14818
15066
|
return _val;
|
|
14819
15067
|
}
|
|
14820
15068
|
/**
|
|
14821
|
-
*
|
|
15069
|
+
* The value before the last update, in display units.
|
|
14822
15070
|
*
|
|
14823
|
-
* @returns Previous property value in
|
|
14824
|
-
*
|
|
14825
|
-
* @example Track Value Changes
|
|
14826
|
-
* ```typescript
|
|
14827
|
-
* const oldValue = pumpRateProperty.previousValue; // Previous rate value
|
|
14828
|
-
* const newValue = pumpRateProperty.value; // Current rate value
|
|
14829
|
-
* console.log(`Rate changed from ${oldValue} to ${newValue}`);
|
|
14830
|
-
* ```
|
|
15071
|
+
* @returns Previous property value in display units
|
|
14831
15072
|
*/
|
|
14832
15073
|
get previousValue() {
|
|
14833
15074
|
return this.getValue(false);
|
|
@@ -14852,15 +15093,9 @@ let KosConfigPropertyImpl = class {
|
|
|
14852
15093
|
log$i.debug(`activating config bean ${this.id}`);
|
|
14853
15094
|
}
|
|
14854
15095
|
/**
|
|
14855
|
-
*
|
|
15096
|
+
* The value formatted with its unit for the active locale, such as `"72.5 °F"`.
|
|
14856
15097
|
*
|
|
14857
|
-
* @returns Localized string representation with
|
|
14858
|
-
*
|
|
14859
|
-
* @example Display Formatted Value
|
|
14860
|
-
* ```typescript
|
|
14861
|
-
* const display = temperatureProperty.displayValue; // "72.5 °F"
|
|
14862
|
-
* const rate = pumpRateProperty.displayValue; // "1.2 mL/s"
|
|
14863
|
-
* ```
|
|
15098
|
+
* @returns Localized string representation with units
|
|
14864
15099
|
*/
|
|
14865
15100
|
get displayValue() {
|
|
14866
15101
|
const _val = this.value;
|
|
@@ -14888,15 +15123,9 @@ let KosConfigPropertyImpl = class {
|
|
|
14888
15123
|
return String(_val);
|
|
14889
15124
|
}
|
|
14890
15125
|
/**
|
|
14891
|
-
*
|
|
15126
|
+
* Display unit of the value, such as `"°F"` or `"mL"`.
|
|
14892
15127
|
*
|
|
14893
|
-
* @returns Unit string
|
|
14894
|
-
*
|
|
14895
|
-
* @example Get Property Unit
|
|
14896
|
-
* ```typescript
|
|
14897
|
-
* const unit = temperatureProperty.unit; // "°F" or "°C" based on regional settings
|
|
14898
|
-
* const rateUnit = pumpRateProperty.unit; // "mL/s"
|
|
14899
|
-
* ```
|
|
15128
|
+
* @returns Unit string, or an empty string for unitless properties
|
|
14900
15129
|
*/
|
|
14901
15130
|
get unit() {
|
|
14902
15131
|
const converter = this.getConverter();
|
|
@@ -15041,18 +15270,10 @@ let KosConfigPropertyImpl = class {
|
|
|
15041
15270
|
return void 0;
|
|
15042
15271
|
}
|
|
15043
15272
|
/**
|
|
15044
|
-
*
|
|
15045
|
-
*
|
|
15046
|
-
* @param value - The new value to set (in regional display units)
|
|
15047
|
-
*
|
|
15048
|
-
* @example Update Property
|
|
15049
|
-
* ```typescript
|
|
15050
|
-
* // Set temperature in Fahrenheit (regional unit)
|
|
15051
|
-
* await temperatureProperty.updateProperty(75.5);
|
|
15273
|
+
* Converts the value from display units to backend units and writes it to the
|
|
15274
|
+
* bean.
|
|
15052
15275
|
*
|
|
15053
|
-
*
|
|
15054
|
-
* await pumpRateProperty.updateProperty(1.2);
|
|
15055
|
-
* ```
|
|
15276
|
+
* @param value - The new value in display units
|
|
15056
15277
|
*/
|
|
15057
15278
|
async updateProperty(value) {
|
|
15058
15279
|
log$i.debug(`updating property ${this.attribute} with value ${value}`);
|
|
@@ -15443,7 +15664,7 @@ let StateBeanModelImpl = class {
|
|
|
15443
15664
|
this.logger.debug(`initializing state-bean ${this.id}`);
|
|
15444
15665
|
}
|
|
15445
15666
|
/**
|
|
15446
|
-
*
|
|
15667
|
+
* Sets several properties at once.
|
|
15447
15668
|
* @param props Properties to update
|
|
15448
15669
|
* @private
|
|
15449
15670
|
*/
|
|
@@ -15641,7 +15862,7 @@ let BrowserRouterModelImpl = class {
|
|
|
15641
15862
|
}
|
|
15642
15863
|
/**
|
|
15643
15864
|
* Registers a route with optional middleware chain.
|
|
15644
|
-
* @param method HTTP method (GET, POST, PUT, DELETE
|
|
15865
|
+
* @param method HTTP method (GET, POST, PUT, DELETE)
|
|
15645
15866
|
* @param path Route path pattern with parameter support
|
|
15646
15867
|
* @param middlewares Middleware functions and final handler
|
|
15647
15868
|
*/
|
|
@@ -15779,34 +16000,14 @@ let FutureModel$1 = class FutureModel {
|
|
|
15779
16000
|
}
|
|
15780
16001
|
}
|
|
15781
16002
|
/**
|
|
15782
|
-
*
|
|
15783
|
-
*
|
|
15784
|
-
* @returns Status string: "NOT_ACTIVE", "IN_PROGRESS", "Success", or "Fail"
|
|
15785
|
-
*
|
|
15786
|
-
* @example Monitor Status
|
|
15787
|
-
* ```typescript
|
|
15788
|
-
* if (future.status === "IN_PROGRESS") {
|
|
15789
|
-
* console.log(`Operation running: ${future.progress}% complete`);
|
|
15790
|
-
* } else if (future.status === "Success") {
|
|
15791
|
-
* console.log("Operation completed successfully!");
|
|
15792
|
-
* }
|
|
15793
|
-
* ```
|
|
16003
|
+
* Status of the operation: the `endState` once it has ended, otherwise
|
|
16004
|
+
* `IN_PROGRESS` while progress is reported, or `NOT_ACTIVE`.
|
|
15794
16005
|
*/
|
|
15795
16006
|
get status() {
|
|
15796
16007
|
return this.endState ? this.endState : this.progress > -1 ? "IN_PROGRESS" : "NOT_ACTIVE";
|
|
15797
16008
|
}
|
|
15798
16009
|
/**
|
|
15799
|
-
*
|
|
15800
|
-
*
|
|
15801
|
-
* @returns Formatted time string (e.g., "5 minutes", "30 seconds") or empty string if unknown
|
|
15802
|
-
*
|
|
15803
|
-
* @example Display Time Remaining
|
|
15804
|
-
* ```typescript
|
|
15805
|
-
* const timeLeft = future.timeRemaining;
|
|
15806
|
-
* if (timeLeft) {
|
|
15807
|
-
* console.log(`${timeLeft} remaining`);
|
|
15808
|
-
* }
|
|
15809
|
-
* ```
|
|
16010
|
+
* Remaining time as text, such as `"5 minutes"`, or an empty string when unknown.
|
|
15810
16011
|
*/
|
|
15811
16012
|
get timeRemaining() {
|
|
15812
16013
|
const remaining = this.remainingTimeMs || -1;
|
|
@@ -16104,23 +16305,11 @@ let KeyValueModelImpl = class {
|
|
|
16104
16305
|
this.logger.debug(`initializing studio-state ${this.id}`);
|
|
16105
16306
|
}
|
|
16106
16307
|
/**
|
|
16107
|
-
*
|
|
16108
|
-
*
|
|
16109
|
-
* Changes are automatically persisted and synchronized across all instances
|
|
16110
|
-
* with the same namespace via KOS topics.
|
|
16308
|
+
* Stores a value under `key`, or deletes the key when `value` is undefined.
|
|
16111
16309
|
*
|
|
16112
16310
|
* @param key - The key to update or delete
|
|
16113
|
-
* @param value - The value to set
|
|
16311
|
+
* @param value - The value to set, or undefined to delete the key
|
|
16114
16312
|
* @returns Promise that resolves when the operation completes
|
|
16115
|
-
*
|
|
16116
|
-
* @example
|
|
16117
|
-
* ```typescript
|
|
16118
|
-
* // Set a value
|
|
16119
|
-
* await keyValue.updateState('theme', 'dark');
|
|
16120
|
-
*
|
|
16121
|
-
* // Delete a key
|
|
16122
|
-
* await keyValue.updateState('theme', undefined);
|
|
16123
|
-
* ```
|
|
16124
16313
|
*/
|
|
16125
16314
|
async updateState(key, value) {
|
|
16126
16315
|
this.logger.debug(`updating studio-state ${key} with value ${value}`);
|
|
@@ -17798,9 +17987,7 @@ class ReactiveExpression {
|
|
|
17798
17987
|
this.getContextData = getContextData;
|
|
17799
17988
|
this._lastResult = { value: void 0, error: void 0 };
|
|
17800
17989
|
}
|
|
17801
|
-
/**
|
|
17802
|
-
* Pure getter that returns the cached result without side effects.
|
|
17803
|
-
*/
|
|
17990
|
+
/** The cached result, returned without evaluating. */
|
|
17804
17991
|
get result() {
|
|
17805
17992
|
return this._lastResult;
|
|
17806
17993
|
}
|
|
@@ -17811,8 +17998,7 @@ class ReactiveExpression {
|
|
|
17811
17998
|
this._lastResult = result;
|
|
17812
17999
|
}
|
|
17813
18000
|
/**
|
|
17814
|
-
* Evaluate the expression
|
|
17815
|
-
* This method allows the parent model to trigger evaluation without side effects in getters.
|
|
18001
|
+
* Evaluate the expression against the given context data. The cached result is unchanged.
|
|
17816
18002
|
*/
|
|
17817
18003
|
evaluate(contextData) {
|
|
17818
18004
|
try {
|
|
@@ -17871,15 +18057,9 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
17871
18057
|
return this._contextRevision;
|
|
17872
18058
|
}
|
|
17873
18059
|
/**
|
|
17874
|
-
* Replace the
|
|
17875
|
-
* automatically re-evaluate against the new context.
|
|
18060
|
+
* Replace the context data. Every expression re-evaluates against it.
|
|
17876
18061
|
*
|
|
17877
18062
|
* @param newData - Complete new context data to replace existing data
|
|
17878
|
-
*
|
|
17879
|
-
* @example
|
|
17880
|
-
* ```typescript
|
|
17881
|
-
* evaluator.setContextData({ temperature: 75, humidity: 40 });
|
|
17882
|
-
* ```
|
|
17883
18063
|
*/
|
|
17884
18064
|
setContextData(newData) {
|
|
17885
18065
|
this._data.setValues(newData);
|
|
@@ -17892,31 +18072,20 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
17892
18072
|
});
|
|
17893
18073
|
}
|
|
17894
18074
|
/**
|
|
17895
|
-
*
|
|
17896
|
-
* value will automatically re-evaluate.
|
|
18075
|
+
* Set one top-level context value.
|
|
17897
18076
|
*
|
|
17898
18077
|
* @param key - The context data key to update
|
|
17899
18078
|
* @param value - The new value to set
|
|
17900
|
-
*
|
|
17901
|
-
* @example
|
|
17902
|
-
* ```typescript
|
|
17903
|
-
* evaluator.updateContextValue('temperature', 85);
|
|
17904
|
-
* ```
|
|
17905
18079
|
*/
|
|
17906
18080
|
updateContextValue(key, value) {
|
|
17907
18081
|
this._data[key] = value;
|
|
17908
18082
|
}
|
|
17909
18083
|
/**
|
|
17910
|
-
*
|
|
17911
|
-
*
|
|
18084
|
+
* Set a nested context value by dot-separated path, such as
|
|
18085
|
+
* `sensors.humidity`, creating intermediate objects as needed.
|
|
17912
18086
|
*
|
|
17913
|
-
* @param path - Dot-separated path to the nested property
|
|
18087
|
+
* @param path - Dot-separated path to the nested property
|
|
17914
18088
|
* @param value - The new value to set at the nested path
|
|
17915
|
-
*
|
|
17916
|
-
* @example
|
|
17917
|
-
* ```typescript
|
|
17918
|
-
* evaluator.updateNestedValue('sensors.humidity', 60);
|
|
17919
|
-
* ```
|
|
17920
18089
|
*/
|
|
17921
18090
|
updateNestedValue(path, value) {
|
|
17922
18091
|
const pathSegments = path.split(".");
|
|
@@ -17936,35 +18105,21 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
17936
18105
|
this.logger.debug(`Updated nested context value "${path}" to:`, value);
|
|
17937
18106
|
}
|
|
17938
18107
|
/**
|
|
17939
|
-
* Add a KOS model to the
|
|
17940
|
-
*
|
|
17941
|
-
* re-evaluate when the model's data changes.
|
|
18108
|
+
* Add a KOS model to the context under `key`. Expressions read its properties
|
|
18109
|
+
* with dotted notation (`sensor.temperature`) and re-evaluate when they change.
|
|
17942
18110
|
*
|
|
17943
18111
|
* @param key - The context key to store the model under
|
|
17944
|
-
* @param model -
|
|
17945
|
-
*
|
|
17946
|
-
* @example
|
|
17947
|
-
* ```typescript
|
|
17948
|
-
* const sensorModel = SensorModel.instance('main-sensor').build();
|
|
17949
|
-
* evaluator.addModelToContext('sensor', sensorModel);
|
|
17950
|
-
* evaluator.addExpression('isCritical', 'sensor.temperature > 80');
|
|
17951
|
-
* ```
|
|
18112
|
+
* @param model - KOS model instance
|
|
17952
18113
|
*/
|
|
17953
18114
|
addModelToContext(key, model) {
|
|
17954
18115
|
this._data[key] = model;
|
|
17955
18116
|
}
|
|
17956
18117
|
/**
|
|
17957
|
-
* Add a named expression
|
|
17958
|
-
* The expression will re-evaluate whenever its dependencies in the context change.
|
|
18118
|
+
* Add a named expression and evaluate it once.
|
|
17959
18119
|
*
|
|
17960
|
-
* @param name - Unique identifier for this expression
|
|
17961
|
-
* @param expressionString -
|
|
18120
|
+
* @param name - Unique identifier for this expression
|
|
18121
|
+
* @param expressionString - Expression in `expr-eval` syntax
|
|
17962
18122
|
* @throws {Error} If the expression has invalid syntax
|
|
17963
|
-
*
|
|
17964
|
-
* @example
|
|
17965
|
-
* ```typescript
|
|
17966
|
-
* evaluator.addExpression('isHot', 'temperature > 80');
|
|
17967
|
-
* ```
|
|
17968
18123
|
*/
|
|
17969
18124
|
addExpression(name, expressionString) {
|
|
17970
18125
|
try {
|
|
@@ -18021,17 +18176,11 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
18021
18176
|
return expression.result;
|
|
18022
18177
|
}
|
|
18023
18178
|
/**
|
|
18024
|
-
*
|
|
18025
|
-
*
|
|
18026
|
-
* creating reactive chains through the expression evaluation.
|
|
18179
|
+
* The last cached result of an expression, read without re-evaluating. Use it
|
|
18180
|
+
* in effects that should not depend on the expression's inputs.
|
|
18027
18181
|
*
|
|
18028
18182
|
* @param name - The expression name to get the cached result for
|
|
18029
18183
|
* @returns The last cached result, or undefined if expression doesn't exist
|
|
18030
|
-
*
|
|
18031
|
-
* @example
|
|
18032
|
-
* ```typescript
|
|
18033
|
-
* const cached = evaluator.getCachedExpressionValue('myExpression');
|
|
18034
|
-
* ```
|
|
18035
18184
|
*/
|
|
18036
18185
|
getCachedExpressionValue(name) {
|
|
18037
18186
|
const expression = this._expressions.get(name);
|
|
@@ -18046,15 +18195,12 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
18046
18195
|
get expressionNames() {
|
|
18047
18196
|
return Array.from(this._expressions.keys());
|
|
18048
18197
|
}
|
|
18049
|
-
//
|
|
18198
|
+
// Evaluates on access so readers track the context data each expression uses
|
|
18050
18199
|
get results() {
|
|
18051
18200
|
this.evaluateAllExpressions();
|
|
18052
18201
|
return this._results;
|
|
18053
18202
|
}
|
|
18054
|
-
/**
|
|
18055
|
-
* Force re-evaluation of all expressions and update cached results.
|
|
18056
|
-
* This is called by the effect when context data changes.
|
|
18057
|
-
*/
|
|
18203
|
+
/** Re-evaluate every expression and update the cached results. */
|
|
18058
18204
|
evaluateAllExpressions() {
|
|
18059
18205
|
const keys = Array.from(this._expressions.keys());
|
|
18060
18206
|
keys.forEach((key) => {
|
|
@@ -18088,11 +18234,7 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
18088
18234
|
this.updateResult(name, newResult);
|
|
18089
18235
|
}
|
|
18090
18236
|
}
|
|
18091
|
-
/**
|
|
18092
|
-
* Internal method to update the results object when expression values change.
|
|
18093
|
-
* This is called by ReactiveExpression when its value changes.
|
|
18094
|
-
* ObservableData handles dynamic properties automatically with MobX atoms.
|
|
18095
|
-
*/
|
|
18237
|
+
/** Store a changed result in the reactive results object. */
|
|
18096
18238
|
updateResult(name, result) {
|
|
18097
18239
|
this.logger.debug(
|
|
18098
18240
|
`ExpressionEvaluator.updateResult called for "${name}":`,
|
|
@@ -18103,17 +18245,11 @@ let KosExpressionEvaluatorModelImpl = class {
|
|
|
18103
18245
|
});
|
|
18104
18246
|
}
|
|
18105
18247
|
/**
|
|
18106
|
-
*
|
|
18107
|
-
*
|
|
18108
|
-
*
|
|
18109
|
-
* @param expressionString - JavaScript-like expression string
|
|
18110
|
-
* @returns Generated UUID that can be used to access the expression via `getExpressionValue(id)` or `results[id]`
|
|
18248
|
+
* Add an expression under a generated id and return the id, for use with
|
|
18249
|
+
* `getExpressionValue(id)` or `results[id]`.
|
|
18111
18250
|
*
|
|
18112
|
-
* @
|
|
18113
|
-
*
|
|
18114
|
-
* const tempCheckId = evaluator.createExpression('temperature > 75');
|
|
18115
|
-
* const result = evaluator.getExpressionValue(tempCheckId);
|
|
18116
|
-
* ```
|
|
18251
|
+
* @param expressionString - Expression in `expr-eval` syntax
|
|
18252
|
+
* @returns Generated expression id
|
|
18117
18253
|
*/
|
|
18118
18254
|
createExpression(expressionString) {
|
|
18119
18255
|
const anonymousId = uuid();
|
|
@@ -19118,30 +19254,6 @@ const LogStreamContainer = new SingletonKosModelRegistrationFactory({
|
|
|
19118
19254
|
LogStreamContainer.addRelatedModel(LogStream);
|
|
19119
19255
|
LogStreamContainer.addRelatedModel(LogBlockContainer);
|
|
19120
19256
|
LogStreamContainer.addRelatedModel(LogBlock);
|
|
19121
|
-
const isRankedInfo = (i) => i?.rank !== void 0;
|
|
19122
|
-
const isRoleAwareInfo = (i) => i?.visibleRole !== void 0;
|
|
19123
|
-
const isColorAwareInfo = (i) => i?.color !== void 0;
|
|
19124
|
-
const defaultTroubleRankMapper = (trouble) => {
|
|
19125
|
-
const info = trouble.info ?? {};
|
|
19126
|
-
if (isRankedInfo(info)) {
|
|
19127
|
-
return info.rank;
|
|
19128
|
-
}
|
|
19129
|
-
return 0;
|
|
19130
|
-
};
|
|
19131
|
-
const defaultTroubleColorMapper = (trouble) => {
|
|
19132
|
-
const info = trouble.info ?? {};
|
|
19133
|
-
if (isColorAwareInfo(info)) {
|
|
19134
|
-
return info.color;
|
|
19135
|
-
}
|
|
19136
|
-
return "orange";
|
|
19137
|
-
};
|
|
19138
|
-
const defaultTroubleRoleMapper = (trouble) => {
|
|
19139
|
-
const info = trouble.info ?? {};
|
|
19140
|
-
if (isRoleAwareInfo(info)) {
|
|
19141
|
-
return info.visibleRole;
|
|
19142
|
-
}
|
|
19143
|
-
return "TECHNICIAN";
|
|
19144
|
-
};
|
|
19145
19257
|
const { URL: URL$7 } = resolveServiceUrl();
|
|
19146
19258
|
const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
|
|
19147
19259
|
basePath: `${URL$7}/api/kos/troubles`
|
|
@@ -19208,6 +19320,30 @@ const bulkResolveTroubles = async (troubleIds, servicePath = "/api/kos/troubles"
|
|
|
19208
19320
|
return futureResponse;
|
|
19209
19321
|
}
|
|
19210
19322
|
};
|
|
19323
|
+
const isRankedInfo = (i) => i?.rank !== void 0;
|
|
19324
|
+
const isRoleAwareInfo = (i) => i?.visibleRole !== void 0;
|
|
19325
|
+
const isColorAwareInfo = (i) => i?.color !== void 0;
|
|
19326
|
+
const defaultTroubleRankMapper = (trouble) => {
|
|
19327
|
+
const info = trouble.info ?? {};
|
|
19328
|
+
if (isRankedInfo(info)) {
|
|
19329
|
+
return info.rank;
|
|
19330
|
+
}
|
|
19331
|
+
return 0;
|
|
19332
|
+
};
|
|
19333
|
+
const defaultTroubleColorMapper = (trouble) => {
|
|
19334
|
+
const info = trouble.info ?? {};
|
|
19335
|
+
if (isColorAwareInfo(info)) {
|
|
19336
|
+
return info.color;
|
|
19337
|
+
}
|
|
19338
|
+
return "orange";
|
|
19339
|
+
};
|
|
19340
|
+
const defaultTroubleRoleMapper = (trouble) => {
|
|
19341
|
+
const info = trouble.info ?? {};
|
|
19342
|
+
if (isRoleAwareInfo(info)) {
|
|
19343
|
+
return info.visibleRole;
|
|
19344
|
+
}
|
|
19345
|
+
return "TECHNICIAN";
|
|
19346
|
+
};
|
|
19211
19347
|
const EXTENSION_TROUBLE_DATA_MAPPER = "troubleDataMapper";
|
|
19212
19348
|
const troubleMappers$1 = /* @__PURE__ */ new Map();
|
|
19213
19349
|
registerExtensionPoint(EXTENSION_TROUBLE_DATA_MAPPER, {
|
|
@@ -19495,29 +19631,24 @@ const Trouble = {
|
|
|
19495
19631
|
predicate: isKosModel(MODEL_TYPE$e),
|
|
19496
19632
|
factory: Kos.Factory.create(MODEL_TYPE$e)
|
|
19497
19633
|
};
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
19502
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
19503
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19504
|
-
if (decorator = decorators[i])
|
|
19505
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19506
|
-
if (kind && result) __defProp$b(target, key, result);
|
|
19507
|
-
return result;
|
|
19508
|
-
};
|
|
19509
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
19510
|
-
const addTrouble = (trouble) => {
|
|
19511
|
-
const options = {
|
|
19634
|
+
function mapTroubleToOptions(dto) {
|
|
19635
|
+
const { trouble } = dto;
|
|
19636
|
+
return {
|
|
19512
19637
|
...trouble,
|
|
19638
|
+
servicePath: dto.servicePath,
|
|
19513
19639
|
rank: troubleRankMapper(trouble),
|
|
19514
19640
|
color: troubleColorMapper(trouble),
|
|
19515
19641
|
role: troubleRoleMapper(trouble),
|
|
19516
|
-
id: String(trouble.id)
|
|
19642
|
+
id: String(trouble.id),
|
|
19643
|
+
rawJson: trouble
|
|
19517
19644
|
};
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19645
|
+
}
|
|
19646
|
+
function createTroubleModel(dto) {
|
|
19647
|
+
return Trouble.factory(dto.id)(mapTroubleToOptions(dto));
|
|
19648
|
+
}
|
|
19649
|
+
function mapTroubleToDto(trouble, servicePath) {
|
|
19650
|
+
return { id: `trouble-${trouble.id}`, servicePath, trouble };
|
|
19651
|
+
}
|
|
19521
19652
|
function troubleRankMapper(trouble) {
|
|
19522
19653
|
const _rank = ExtensionManager.propertyMapper.hasMapper(
|
|
19523
19654
|
KosCoreModelPropertyMapper.TroubleRank
|
|
@@ -19545,6 +19676,18 @@ function troubleRoleMapper(trouble) {
|
|
|
19545
19676
|
) : defaultTroubleRoleMapper(trouble);
|
|
19546
19677
|
return role.toLowerCase();
|
|
19547
19678
|
}
|
|
19679
|
+
var __defProp$b = Object.defineProperty;
|
|
19680
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
19681
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19682
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
19683
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
19684
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19685
|
+
if (decorator = decorators[i])
|
|
19686
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19687
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
19688
|
+
return result;
|
|
19689
|
+
};
|
|
19690
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
19548
19691
|
const MODEL_TYPE$d = "trouble-container-model";
|
|
19549
19692
|
class Troubles {
|
|
19550
19693
|
static INDEX_TROUBLES_BY_IFACE = "byIface";
|
|
@@ -19565,30 +19708,21 @@ let TroubleContainerModelImpl = class {
|
|
|
19565
19708
|
async reload() {
|
|
19566
19709
|
this.logger.info("reloading trouble container");
|
|
19567
19710
|
const _troubles = await getTroubles(this.servicePath);
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
this.troubles.addAll(toAdd);
|
|
19711
|
+
this.reconcile(
|
|
19712
|
+
(_troubles?.data ?? []).map(
|
|
19713
|
+
(trouble) => mapTroubleToDto(trouble, this.servicePath)
|
|
19714
|
+
)
|
|
19715
|
+
);
|
|
19574
19716
|
}
|
|
19575
19717
|
async load() {
|
|
19576
19718
|
this.logger.debug("loading trouble container");
|
|
19577
19719
|
try {
|
|
19578
19720
|
const _troubles = await getTroubles(this.servicePath);
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
color: troubleColorMapper(trouble),
|
|
19585
|
-
role: troubleRoleMapper(trouble),
|
|
19586
|
-
id: String(trouble.id),
|
|
19587
|
-
rawJson: trouble
|
|
19588
|
-
};
|
|
19589
|
-
const newTrouble = Trouble.factory(`trouble-${trouble.id}`)(options);
|
|
19590
|
-
this.troubles.addModel(newTrouble);
|
|
19591
|
-
});
|
|
19721
|
+
this.reconcile(
|
|
19722
|
+
(_troubles?.data ?? []).map(
|
|
19723
|
+
(trouble) => mapTroubleToDto(trouble, this.servicePath)
|
|
19724
|
+
)
|
|
19725
|
+
);
|
|
19592
19726
|
} catch (e) {
|
|
19593
19727
|
this.logger.error(e);
|
|
19594
19728
|
throw e;
|
|
@@ -19607,20 +19741,11 @@ let TroubleContainerModelImpl = class {
|
|
|
19607
19741
|
}
|
|
19608
19742
|
}
|
|
19609
19743
|
handleTroubleAdded(trouble) {
|
|
19610
|
-
const
|
|
19611
|
-
|
|
19612
|
-
servicePath: this.servicePath,
|
|
19613
|
-
rank: troubleRankMapper(trouble),
|
|
19614
|
-
color: troubleColorMapper(trouble),
|
|
19615
|
-
role: troubleRoleMapper(trouble),
|
|
19616
|
-
id: String(trouble.id),
|
|
19617
|
-
rawJson: trouble
|
|
19618
|
-
};
|
|
19619
|
-
if (options.role === "NONE") {
|
|
19744
|
+
const dto = mapTroubleToDto(trouble, this.servicePath);
|
|
19745
|
+
if (mapTroubleToOptions(dto).role === "NONE") {
|
|
19620
19746
|
return;
|
|
19621
19747
|
}
|
|
19622
|
-
|
|
19623
|
-
this.troubles.addModel(newTrouble);
|
|
19748
|
+
this.troubles.addModel(createTroubleModel(dto));
|
|
19624
19749
|
}
|
|
19625
19750
|
};
|
|
19626
19751
|
__publicField(TroubleContainerModelImpl, "Registration");
|
|
@@ -19651,7 +19776,8 @@ TroubleContainerModelImpl = __decorateClass$e([
|
|
|
19651
19776
|
[Troubles.INDEX_TROUBLES_BY_DEFERRED]: "deferred"
|
|
19652
19777
|
},
|
|
19653
19778
|
sortKey: Troubles.SORT_KEY_RANK
|
|
19654
|
-
}
|
|
19779
|
+
},
|
|
19780
|
+
reconcile: { create: createTroubleModel }
|
|
19655
19781
|
})
|
|
19656
19782
|
], TroubleContainerModelImpl);
|
|
19657
19783
|
const TroubleContainer = TroubleContainerModelImpl.Registration;
|
|
@@ -22403,118 +22529,35 @@ let DeviceModelImpl = class {
|
|
|
22403
22529
|
id;
|
|
22404
22530
|
logger;
|
|
22405
22531
|
_serialNumber;
|
|
22406
|
-
/**
|
|
22407
|
-
* Hardware-based device serial number for unique identification.
|
|
22408
|
-
*
|
|
22409
|
-
* Returns the device's hardware serial number or "unassigned" if not yet loaded.
|
|
22410
|
-
* Serial numbers are typically retrieved from the device's hardware identification
|
|
22411
|
-
* system during critical data events.
|
|
22412
|
-
*
|
|
22413
|
-
* @example
|
|
22414
|
-
* ```typescript
|
|
22415
|
-
* const device = Device.factory({});
|
|
22416
|
-
*
|
|
22417
|
-
* // Check if serial number is available
|
|
22418
|
-
* if (device.serialNumber !== "unassigned") {
|
|
22419
|
-
* console.log(`Device Serial: ${device.serialNumber}`);
|
|
22420
|
-
* }
|
|
22421
|
-
* ```
|
|
22422
|
-
*/
|
|
22532
|
+
/** Hardware serial number, or `"unassigned"` until it has been loaded. */
|
|
22423
22533
|
get serialNumber() {
|
|
22424
22534
|
return this._serialNumber;
|
|
22425
22535
|
}
|
|
22426
22536
|
_name;
|
|
22427
|
-
/**
|
|
22428
|
-
* Human-readable device name for administrative identification.
|
|
22429
|
-
*
|
|
22430
|
-
* Returns the configured device name or "unassigned" if not yet set.
|
|
22431
|
-
* Device names are typically configured during device setup and used
|
|
22432
|
-
* in administrative interfaces for device identification and management.
|
|
22433
|
-
*
|
|
22434
|
-
* @example
|
|
22435
|
-
* ```typescript
|
|
22436
|
-
* const device = Device.factory({
|
|
22437
|
-
* name: 'Main Production Dispenser'
|
|
22438
|
-
* });
|
|
22439
|
-
*
|
|
22440
|
-
* console.log(`Device Name: ${device.name}`);
|
|
22441
|
-
* // Output: "Device Name: Main Production Dispenser"
|
|
22442
|
-
* ```
|
|
22443
|
-
*/
|
|
22537
|
+
/** Human-readable device name, or `"unassigned"` until it has been loaded. */
|
|
22444
22538
|
get name() {
|
|
22445
22539
|
return this._name;
|
|
22446
22540
|
}
|
|
22447
22541
|
_nodeId;
|
|
22448
22542
|
/**
|
|
22449
|
-
*
|
|
22450
|
-
*
|
|
22451
|
-
* Returns the complete node ID or "unassigned" if not yet configured.
|
|
22452
|
-
* Node IDs follow the pattern "type-instance" (e.g., "primary-main", "secondary-backup")
|
|
22453
|
-
* and identify the specific node role and instance within multi-node deployments.
|
|
22543
|
+
* Node identifier within the deployment, in `type-name` form (for example
|
|
22544
|
+
* `primary-main`), or `"unassigned"` until it has been loaded.
|
|
22454
22545
|
*
|
|
22455
|
-
* @
|
|
22456
|
-
*
|
|
22457
|
-
* const device = Device.factory({
|
|
22458
|
-
* nodeId: 'primary-controller'
|
|
22459
|
-
* });
|
|
22460
|
-
*
|
|
22461
|
-
* console.log(`Node ID: ${device.nodeId}`);
|
|
22462
|
-
* // Output: "Node ID: primary-controller"
|
|
22463
|
-
* ```
|
|
22464
|
-
*
|
|
22465
|
-
* @see {@link nodeType} for extracting the node type portion
|
|
22466
|
-
* @see {@link nodeName} for extracting the node name portion
|
|
22546
|
+
* @see {@link nodeType} for the type portion
|
|
22547
|
+
* @see {@link nodeName} for the name portion
|
|
22467
22548
|
*/
|
|
22468
22549
|
get nodeId() {
|
|
22469
22550
|
return this._nodeId;
|
|
22470
22551
|
}
|
|
22471
22552
|
/**
|
|
22472
|
-
*
|
|
22473
|
-
*
|
|
22474
|
-
* Returns the first part of the node ID (before the hyphen).
|
|
22475
|
-
* For node ID "primary-controller", this returns "primary".
|
|
22476
|
-
* Used for role-based logic and node coordination.
|
|
22477
|
-
*
|
|
22478
|
-
* @example
|
|
22479
|
-
* ```typescript
|
|
22480
|
-
* const device = Device.factory({
|
|
22481
|
-
* nodeId: 'primary-controller'
|
|
22482
|
-
* });
|
|
22483
|
-
*
|
|
22484
|
-
* console.log(`Node Type: ${device.nodeType}`);
|
|
22485
|
-
* // Output: "Node Type: primary"
|
|
22486
|
-
*
|
|
22487
|
-
* // Role-based coordination
|
|
22488
|
-
* if (device.nodeType === 'primary') {
|
|
22489
|
-
* // Handle primary node responsibilities
|
|
22490
|
-
* }
|
|
22491
|
-
* ```
|
|
22553
|
+
* The part of {@link nodeId} before the hyphen (`"primary"` for `primary-main`).
|
|
22492
22554
|
*/
|
|
22493
22555
|
get nodeType() {
|
|
22494
22556
|
const [nodeType] = this.nodeId.split("-");
|
|
22495
22557
|
return nodeType;
|
|
22496
22558
|
}
|
|
22497
22559
|
/**
|
|
22498
|
-
*
|
|
22499
|
-
*
|
|
22500
|
-
* Returns the second part of the node ID (after the hyphen).
|
|
22501
|
-
* For node ID "primary-controller", this returns "controller".
|
|
22502
|
-
* Used for instance-specific identification within node types.
|
|
22503
|
-
*
|
|
22504
|
-
* @example
|
|
22505
|
-
* ```typescript
|
|
22506
|
-
* const device = Device.factory({
|
|
22507
|
-
* nodeId: 'secondary-backup'
|
|
22508
|
-
* });
|
|
22509
|
-
*
|
|
22510
|
-
* console.log(`Node Name: ${device.nodeName}`);
|
|
22511
|
-
* // Output: "Node Name: backup"
|
|
22512
|
-
*
|
|
22513
|
-
* // Instance-specific logic
|
|
22514
|
-
* if (device.nodeName === 'backup') {
|
|
22515
|
-
* // Handle backup node configuration
|
|
22516
|
-
* }
|
|
22517
|
-
* ```
|
|
22560
|
+
* The part of {@link nodeId} after the hyphen (`"main"` for `primary-main`).
|
|
22518
22561
|
*/
|
|
22519
22562
|
get nodeName() {
|
|
22520
22563
|
const [, nodeName] = this.nodeId.split("-");
|
|
@@ -22528,38 +22571,10 @@ let DeviceModelImpl = class {
|
|
|
22528
22571
|
this._nodeId = "unassigned";
|
|
22529
22572
|
}
|
|
22530
22573
|
/**
|
|
22531
|
-
*
|
|
22532
|
-
*
|
|
22533
|
-
* Allows dynamic updating of device identity and node configuration.
|
|
22534
|
-
* Any undefined values will be set to "unassigned". This method is typically
|
|
22535
|
-
* called internally during device data loading or external configuration changes.
|
|
22536
|
-
*
|
|
22537
|
-
* @param options - Device configuration options to apply
|
|
22538
|
-
*
|
|
22539
|
-
* @example
|
|
22540
|
-
* ```typescript
|
|
22541
|
-
* const device = Device.factory({});
|
|
22574
|
+
* Replace the device identity. Fields left undefined become `"unassigned"`, so
|
|
22575
|
+
* pass every field you want to keep.
|
|
22542
22576
|
*
|
|
22543
|
-
*
|
|
22544
|
-
* device.updateModel({
|
|
22545
|
-
* serialNumber: 'KOS-DEVICE-12345',
|
|
22546
|
-
* name: 'Updated Dispenser Name',
|
|
22547
|
-
* nodeId: 'primary-main'
|
|
22548
|
-
* });
|
|
22549
|
-
*
|
|
22550
|
-
* console.log(device.serialNumber); // "KOS-DEVICE-12345"
|
|
22551
|
-
* console.log(device.name); // "Updated Dispenser Name"
|
|
22552
|
-
* console.log(device.nodeId); // "primary-main"
|
|
22553
|
-
* ```
|
|
22554
|
-
*
|
|
22555
|
-
* @example Partial Updates
|
|
22556
|
-
* ```typescript
|
|
22557
|
-
* // Only update specific fields
|
|
22558
|
-
* device.updateModel({
|
|
22559
|
-
* name: 'New Device Name'
|
|
22560
|
-
* // serialNumber and nodeId remain unchanged
|
|
22561
|
-
* });
|
|
22562
|
-
* ```
|
|
22577
|
+
* @param options - Device identity to apply
|
|
22563
22578
|
*/
|
|
22564
22579
|
updateModel(options) {
|
|
22565
22580
|
this._serialNumber = options.serialNumber ?? "unassigned";
|
|
@@ -23539,9 +23554,11 @@ let TranslationModelImpl = class {
|
|
|
23539
23554
|
return !!this.data[key];
|
|
23540
23555
|
}
|
|
23541
23556
|
/**
|
|
23542
|
-
* Resolves a translation key
|
|
23557
|
+
* Resolves a translation key, substituting `{{name}}` placeholders from
|
|
23558
|
+
* `options` (or from `options.data` when it is an object). With
|
|
23559
|
+
* `options.context`, the variant key `<key>_<context>` is tried first.
|
|
23543
23560
|
* @param _key Translation key, optionally with namespace prefix
|
|
23544
|
-
* @param options
|
|
23561
|
+
* @param options Interpolation values, or a default value string
|
|
23545
23562
|
* @returns Resolved translation string or array
|
|
23546
23563
|
*/
|
|
23547
23564
|
resolveKey(_key, options) {
|
|
@@ -23687,7 +23704,7 @@ let TranslationContainerModelImpl = class {
|
|
|
23687
23704
|
});
|
|
23688
23705
|
}
|
|
23689
23706
|
get defaultNamespace() {
|
|
23690
|
-
return this._defaultNamespace ? this.getModel(
|
|
23707
|
+
return this._defaultNamespace ? this.getModel(this._defaultNamespace) : void 0;
|
|
23691
23708
|
}
|
|
23692
23709
|
getModel(id) {
|
|
23693
23710
|
this.logger.debug("getting model " + id);
|
|
@@ -24605,6 +24622,7 @@ exports.parseWildcardSegment = parseWildcardSegment;
|
|
|
24605
24622
|
exports.pipe = pipe;
|
|
24606
24623
|
exports.post = post;
|
|
24607
24624
|
exports.preloadKosModel = preloadKosModel;
|
|
24625
|
+
exports.processId = processId;
|
|
24608
24626
|
exports.publish = publish;
|
|
24609
24627
|
exports.put = put;
|
|
24610
24628
|
exports.registerCompanionModel = registerCompanionModel;
|
|
@@ -24616,9 +24634,12 @@ exports.registerLegacyModel = registerLegacyModel;
|
|
|
24616
24634
|
exports.resetKosModel = resetKosModel;
|
|
24617
24635
|
exports.resolveBaseUrl = resolveBaseUrl;
|
|
24618
24636
|
exports.resolveChild = resolveChild;
|
|
24637
|
+
exports.resolveContainerDeltas = resolveContainerDeltas;
|
|
24638
|
+
exports.resolveItemListDeltas = resolveItemListDeltas;
|
|
24619
24639
|
exports.resolveKosCompanion = resolveKosCompanion;
|
|
24620
24640
|
exports.resolveKosContext = resolveKosContext;
|
|
24621
24641
|
exports.resolveKosProfiles = resolveKosProfiles;
|
|
24642
|
+
exports.resolveListDeltas = resolveListDeltas;
|
|
24622
24643
|
exports.resolveServiceRequestParameters = resolveServiceRequestParameters;
|
|
24623
24644
|
exports.resolveServiceUrl = resolveServiceUrl;
|
|
24624
24645
|
exports.resolveTrouble = resolveTrouble;
|
|
@@ -24647,4 +24668,4 @@ exports.waitForAppToStart = waitForAppToStart;
|
|
|
24647
24668
|
exports.waitForAppsToStart = waitForAppsToStart;
|
|
24648
24669
|
exports.whenReady = whenReady;
|
|
24649
24670
|
exports.wrapWithFutureLifecycle = wrapWithFutureLifecycle;
|
|
24650
|
-
//# sourceMappingURL=software-info-registration-
|
|
24671
|
+
//# sourceMappingURL=software-info-registration-Y1iADHWT.cjs.map
|