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