@kosdev-code/kos-ui-sdk 3.0.26 → 3.0.28
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 +8 -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/companion-instantiator.d.ts +5 -0
- package/core/core/companion-instantiator.d.ts.map +1 -1
- package/core/core/decorators/index.d.ts +1 -0
- package/core/core/decorators/index.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 +26 -88
- 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-mixin.d.ts +69 -0
- package/core/core/decorators/kos-mixin.d.ts.map +1 -0
- 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-topic-handler-flow-control.d.ts +11 -3
- package/core/core/decorators/kos-topic-handler-flow-control.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/decorators/propKeys.d.ts +1 -0
- package/core/core/decorators/propKeys.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-index.d.ts +11 -0
- package/core/core/kos-container-index.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/kos-subscription-manager.d.ts.map +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/registration/model-registration.d.ts.map +1 -1
- 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/model-type-guards.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 +692 -11760
- package/index.cjs.map +1 -1
- package/index.js +774 -11846
- 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/expression-parse-cache.d.ts +29 -0
- package/models/models/kos-expression-evaluator/expression-parse-cache.d.ts.map +1 -0
- package/models/models/kos-expression-evaluator/index.d.ts +1 -0
- package/models/models/kos-expression-evaluator/index.d.ts.map +1 -1
- package/models/models/kos-expression-evaluator/kos-expression-evaluator-model.d.ts +73 -105
- 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 +2 -2
- package/{index-D52vEGXT.cjs → software-info-registration-Le3V0a6v.cjs} +11906 -416
- package/software-info-registration-Le3V0a6v.cjs.map +1 -0
- package/{index-Csq0zQtb.js → software-info-registration-kSGacOka.js} +12116 -625
- package/software-info-registration-kSGacOka.js.map +1 -0
- package/testing/index.d.ts +32 -34
- package/testing/index.d.ts.map +1 -1
- package/testing.cjs +2 -1
- package/testing.cjs.map +1 -1
- package/testing.js +2 -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/index-Csq0zQtb.js.map +0 -1
- package/index-D52vEGXT.cjs.map +0 -1
|
@@ -5,18 +5,6 @@ import { DependencyLifecycle } from '../../types';
|
|
|
5
5
|
* @template TState Union type of valid state strings
|
|
6
6
|
* @template TEvent Union type of valid event strings
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const config: KosStateMachineConfig<'idle' | 'active', 'START' | 'STOP'> = {
|
|
11
|
-
* initial: 'idle',
|
|
12
|
-
* initializeAt: DependencyLifecycle.READY,
|
|
13
|
-
* states: {
|
|
14
|
-
* idle: { on: { START: 'active' } },
|
|
15
|
-
* active: { on: { STOP: 'idle' } }
|
|
16
|
-
* }
|
|
17
|
-
* };
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
8
|
* @kosService core.state-machine
|
|
21
9
|
* @kosApiLevel 15
|
|
22
10
|
*/
|
|
@@ -27,26 +15,14 @@ export interface KosStateMachineConfig<TState extends string, TEvent extends str
|
|
|
27
15
|
*/
|
|
28
16
|
initial: TState;
|
|
29
17
|
/**
|
|
30
|
-
* The lifecycle phase at which the state machine
|
|
31
|
-
*
|
|
18
|
+
* The lifecycle phase at which the state machine is initialized: INIT, READY (the
|
|
19
|
+
* default), ACTIVATE (when the UI activates the model) or ONLINE (the first time the
|
|
20
|
+
* model goes online; a reconnect does not restart it).
|
|
21
|
+
*
|
|
22
|
+
* Before this phase the state property already holds `initial`, but
|
|
32
23
|
* isFsmInitialized is false and transitions are refused.
|
|
33
24
|
*
|
|
34
25
|
* @default DependencyLifecycle.READY
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* // FSM initializes when model is ready (most common)
|
|
39
|
-
* initializeAt: DependencyLifecycle.READY
|
|
40
|
-
*
|
|
41
|
-
* // FSM initializes only when UI activates the model
|
|
42
|
-
* initializeAt: DependencyLifecycle.ACTIVATE
|
|
43
|
-
*
|
|
44
|
-
* // FSM initializes during model initialization (rare)
|
|
45
|
-
* initializeAt: DependencyLifecycle.INIT
|
|
46
|
-
*
|
|
47
|
-
* // FSM initializes the first time the model goes online
|
|
48
|
-
* initializeAt: DependencyLifecycle.ONLINE
|
|
49
|
-
* ```
|
|
50
26
|
*/
|
|
51
27
|
initializeAt?: DependencyLifecycle;
|
|
52
28
|
/**
|
|
@@ -70,17 +46,8 @@ export interface KosStateMachineConfig<TState extends string, TEvent extends str
|
|
|
70
46
|
*/
|
|
71
47
|
on?: Partial<Record<TEvent, TState>>;
|
|
72
48
|
/**
|
|
73
|
-
* Event to
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* cancelling: {
|
|
79
|
-
* on: { CANCELLED: 'cancelled', FAIL: 'error' },
|
|
80
|
-
* onDone: 'CANCELLED', // auto-transition on success
|
|
81
|
-
* onError: 'FAIL', // auto-transition on failure
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
49
|
+
* Event to send when an async @kosStateEntry handler for this state resolves.
|
|
50
|
+
* Sent only if the FSM is still in this state when the handler completes.
|
|
84
51
|
*/
|
|
85
52
|
onDone?: TEvent;
|
|
86
53
|
/**
|
|
@@ -118,105 +85,35 @@ export interface KosStateMachineOptions {
|
|
|
118
85
|
*/
|
|
119
86
|
throwOnInvalid?: boolean;
|
|
120
87
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
88
|
+
* Computes the initial state when the instance is created, replacing the static
|
|
89
|
+
* `initial` from the config. Useful for view models that wrap a model already in a
|
|
90
|
+
* non-default state (for example, a connection that is already connected on app load).
|
|
124
91
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
92
|
+
* Entry handlers do not run for the computed state, since it represents current state
|
|
93
|
+
* rather than a transition.
|
|
127
94
|
*
|
|
128
|
-
*
|
|
129
|
-
* represents current state, not a transition.
|
|
130
|
-
*
|
|
131
|
-
* @param instance The model/ViewModel instance (after constructor, before makeAutoObservable)
|
|
95
|
+
* @param instance The model or view model instance, after its constructor has run
|
|
132
96
|
* @returns The initial FSM state to use
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* @kosStateMachine(fsmConfig, {
|
|
137
|
-
* computeInitialState: (instance) => {
|
|
138
|
-
* const state = instance.connection?.state;
|
|
139
|
-
* return state === 'CONNECTED' ? 'connected' : 'inactive';
|
|
140
|
-
* }
|
|
141
|
-
* })
|
|
142
|
-
* ```
|
|
143
97
|
* @kosApiLevel 21
|
|
144
98
|
*/
|
|
145
99
|
computeInitialState?: (instance: any) => string;
|
|
146
100
|
}
|
|
147
101
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* **IMPORTANT**: Use TypeScript interface merging to add FSM properties to your model class.
|
|
151
|
-
* This provides full type safety and IntelliSense support for all injected FSM functionality.
|
|
152
|
-
*
|
|
153
|
-
* ## Interface Merging Pattern
|
|
154
|
-
*
|
|
155
|
-
* ```typescript
|
|
156
|
-
* // 1. Define state and event types
|
|
157
|
-
* type PourState = 'idle' | 'preparing' | 'ready' | 'pouring' | 'error';
|
|
158
|
-
* type PourEvent = 'PREPARE' | 'READY' | 'POUR' | 'COMPLETE' | 'ERROR';
|
|
159
|
-
*
|
|
160
|
-
* // 2. Declare interface merging BEFORE the class
|
|
161
|
-
* interface DispenserModelImpl extends KosStateMachineAware<PourState, PourEvent> {}
|
|
162
|
-
*
|
|
163
|
-
* // 3. Apply decorators and implement the class
|
|
164
|
-
* @kosModel({ modelTypeId: "dispenser-model" })
|
|
165
|
-
* @kosStateMachine<PourState, PourEvent>({
|
|
166
|
-
* initial: 'idle',
|
|
167
|
-
* initializeAt: DependencyLifecycle.READY,
|
|
168
|
-
* states: {
|
|
169
|
-
* idle: { on: { PREPARE: 'preparing' } },
|
|
170
|
-
* preparing: { on: { READY: 'ready', ERROR: 'error' } },
|
|
171
|
-
* ready: { on: { POUR: 'pouring' } },
|
|
172
|
-
* pouring: { on: { COMPLETE: 'idle', ERROR: 'error' } },
|
|
173
|
-
* error: {}
|
|
174
|
-
* }
|
|
175
|
-
* })
|
|
176
|
-
* export class DispenserModelImpl implements IKosDataModel {
|
|
177
|
-
* // All FSM properties are now available with full type safety
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
102
|
+
* Members that @kosStateMachine injects into a model.
|
|
180
103
|
*
|
|
181
|
-
*
|
|
104
|
+
* Declare an interface with the same name as the class that extends this type so the
|
|
105
|
+
* injected members are typed (TypeScript interface merging).
|
|
182
106
|
*
|
|
183
107
|
* The FSM is uninitialized until the configured lifecycle phase:
|
|
184
|
-
* - From construction: `currentState === initial
|
|
108
|
+
* - From construction: `currentState === initial` and `isFsmInitialized === false`;
|
|
185
109
|
* `transition()` is refused and `canTransition()`, `isInState()` and
|
|
186
110
|
* `allowedTransitions` report nothing
|
|
187
|
-
* - At the phase: `isFsmInitialized === true` and the entry handler for
|
|
188
|
-
* `initial` runs
|
|
111
|
+
* - At the phase: `isFsmInitialized === true` and the entry handler for `initial` runs
|
|
189
112
|
* - After `unload()`: `currentState === undefined` and `isFsmInitialized === false`
|
|
190
113
|
* until the phase runs again
|
|
191
114
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* initial: 'idle',
|
|
195
|
-
* initializeAt: DependencyLifecycle.READY, // FSM starts when model is ready
|
|
196
|
-
* states: { ... }
|
|
197
|
-
* })
|
|
198
|
-
* class MyModel {
|
|
199
|
-
* async ready(): Promise<void> {
|
|
200
|
-
* // Before this completes: this.currentState === 'idle', this.isFsmInitialized === false
|
|
201
|
-
* // After this completes: this.isFsmInitialized === true
|
|
202
|
-
* }
|
|
203
|
-
* }
|
|
204
|
-
* ```
|
|
205
|
-
*
|
|
206
|
-
* ## Injected Properties and Methods
|
|
207
|
-
*
|
|
208
|
-
* The decorator automatically injects the following members:
|
|
209
|
-
*
|
|
210
|
-
* - **`currentState`**: Current state (holds `initial` from construction, observable)
|
|
211
|
-
* - **`isFsmInitialized`**: Boolean indicating if FSM has been initialized
|
|
212
|
-
* - **`isTransitioning`**: Boolean indicating if a transition is in progress
|
|
213
|
-
* - **`allowedTransitions`**: Computed array of valid events for current state
|
|
214
|
-
* - **`transition(event)`**: Method to trigger state transitions
|
|
215
|
-
* - **`canTransition(event)`**: Check if a transition is valid from current state
|
|
216
|
-
* - **`isInState(state)`**: Check if currently in a specific state
|
|
217
|
-
* - **`stateHistory`**: Array of historical states (if trackHistory enabled)
|
|
218
|
-
*
|
|
219
|
-
* All properties are reactive and will automatically update UI components when state changes.
|
|
115
|
+
* The injected state is reactive, so a `kosComponent` reading it re-renders on
|
|
116
|
+
* transitions.
|
|
220
117
|
*
|
|
221
118
|
* @template TState Union type of valid state strings
|
|
222
119
|
* @template TEvent Union type of valid event strings
|
|
@@ -230,9 +127,7 @@ export interface KosStateMachineOptions {
|
|
|
230
127
|
*/
|
|
231
128
|
export interface KosStateMachineAware<TState extends string, TEvent extends string> {
|
|
232
129
|
/**
|
|
233
|
-
* Current state of the state machine.
|
|
234
|
-
* Observable property that updates automatically via @kosModel.
|
|
235
|
-
* Always initialized to the initial state immediately.
|
|
130
|
+
* Current state of the state machine. Holds `initial` from construction.
|
|
236
131
|
*/
|
|
237
132
|
currentState: TState;
|
|
238
133
|
/**
|
|
@@ -245,7 +140,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
245
140
|
readonly isFsmInitialized: boolean;
|
|
246
141
|
/**
|
|
247
142
|
* Indicates whether a state transition is currently in progress.
|
|
248
|
-
* Observable property that updates during transitions.
|
|
249
143
|
*/
|
|
250
144
|
isTransitioning: boolean;
|
|
251
145
|
/**
|
|
@@ -260,12 +154,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
260
154
|
* @param event The event to trigger
|
|
261
155
|
* @throws Error if FSM not initialized (unless `throwOnInvalid` is false)
|
|
262
156
|
* @throws Error if transition is invalid (unless `throwOnInvalid` is false)
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```typescript
|
|
266
|
-
* this.transition('START'); // idle -> active
|
|
267
|
-
* this.transition('STOP'); // active -> idle
|
|
268
|
-
* ```
|
|
269
157
|
*/
|
|
270
158
|
transition(event: TEvent): void;
|
|
271
159
|
/**
|
|
@@ -274,13 +162,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
274
162
|
*
|
|
275
163
|
* @param event The event to check
|
|
276
164
|
* @returns true if the transition is valid, false otherwise
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```typescript
|
|
280
|
-
* if (this.canTransition('START')) {
|
|
281
|
-
* this.transition('START');
|
|
282
|
-
* }
|
|
283
|
-
* ```
|
|
284
165
|
*/
|
|
285
166
|
canTransition(event: TEvent): boolean;
|
|
286
167
|
/**
|
|
@@ -289,13 +170,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
289
170
|
*
|
|
290
171
|
* @param state The state to check
|
|
291
172
|
* @returns true if currently in the specified state, false otherwise
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```typescript
|
|
295
|
-
* if (this.isInState('idle')) {
|
|
296
|
-
* console.log('System is idle');
|
|
297
|
-
* }
|
|
298
|
-
* ```
|
|
299
173
|
*/
|
|
300
174
|
isInState(state: TState): boolean;
|
|
301
175
|
/**
|
|
@@ -311,60 +185,16 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
311
185
|
}>;
|
|
312
186
|
}
|
|
313
187
|
/**
|
|
314
|
-
* Class decorator that adds finite state machine
|
|
315
|
-
*
|
|
316
|
-
* This decorator eliminates manual state management boilerplate by:
|
|
317
|
-
* - **Adding lifecycle-aware FSM initialization** at configured phase (READY, ACTIVATE, ONLINE, etc.)
|
|
318
|
-
* - **Managing state transitions** automatically with validation
|
|
319
|
-
* - **Providing observable state** that integrates with @kosModel reactive system
|
|
320
|
-
* - **Supporting entry/exit handlers** via @kosStateEntry and @kosStateExit decorators
|
|
321
|
-
* - **Enabling state guards** via @kosStateGuard decorator
|
|
322
|
-
*
|
|
323
|
-
* ## Two-Level State System
|
|
324
|
-
*
|
|
325
|
-
* **Framework Lifecycle (Universal, Not Customizable):**
|
|
326
|
-
* - CREATED → INIT → LOAD → READY → ACTIVATE → UNLOAD → DESTROY
|
|
327
|
-
* - Managed by KOS framework
|
|
328
|
-
* - Same for all models
|
|
329
|
-
*
|
|
330
|
-
* **Application FSM (This Decorator):**
|
|
331
|
-
* - Runs WITHIN an active model
|
|
332
|
-
* - Application-specific business logic
|
|
333
|
-
* - Different for each model type
|
|
334
|
-
* - Examples: Pour states, connection states, workflow states
|
|
335
|
-
*
|
|
336
|
-
* ## Lifecycle Integration
|
|
337
|
-
*
|
|
338
|
-
* The FSM initializes at the configured lifecycle phase:
|
|
339
|
-
*
|
|
340
|
-
* ```typescript
|
|
341
|
-
* @kosStateMachine({
|
|
342
|
-
* initial: 'idle',
|
|
343
|
-
* initializeAt: DependencyLifecycle.READY, // Default
|
|
344
|
-
* states: { ... }
|
|
345
|
-
* })
|
|
346
|
-
* ```
|
|
347
|
-
*
|
|
348
|
-
* - **INIT**: FSM needs to be active during model initialization (rare)
|
|
349
|
-
* - **READY**: FSM operational as soon as data loaded (most common)
|
|
350
|
-
* - **ACTIVATE**: FSM only relevant when UI is active (UI-bound models)
|
|
351
|
-
* - **ONLINE**: FSM starts the first time the model goes online; a reconnect does not restart it
|
|
188
|
+
* Class decorator that adds a finite state machine to a KOS model.
|
|
352
189
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
* type MyState = 'idle' | 'active';
|
|
359
|
-
* type MyEvent = 'START' | 'STOP';
|
|
190
|
+
* The FSM models application states (pour states, connection states, workflow steps)
|
|
191
|
+
* and runs inside the framework's model lifecycle, initializing at the phase set by
|
|
192
|
+
* `initializeAt`. Transitions are validated against the config. Entry and exit
|
|
193
|
+
* handlers are declared with @kosStateEntry and @kosStateExit, and @kosStateGuard
|
|
194
|
+
* restricts a method to given states.
|
|
360
195
|
*
|
|
361
|
-
* interface
|
|
362
|
-
*
|
|
363
|
-
* @kosStateMachine<MyState, MyEvent>({ ... })
|
|
364
|
-
* class MyModelImpl implements IKosDataModel {
|
|
365
|
-
* // All FSM properties are now available with full type safety
|
|
366
|
-
* }
|
|
367
|
-
* ```
|
|
196
|
+
* Pair the decorator with an interface that extends {@link KosStateMachineAware} so the
|
|
197
|
+
* injected members are typed.
|
|
368
198
|
*
|
|
369
199
|
* @param config State machine configuration
|
|
370
200
|
* @param options Optional configuration for FSM behavior
|
|
@@ -376,7 +206,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
376
206
|
*
|
|
377
207
|
* @example
|
|
378
208
|
* ```typescript
|
|
379
|
-
* // Basic FSM with default READY initialization
|
|
380
209
|
* type PourState = 'idle' | 'pouring' | 'complete';
|
|
381
210
|
* type PourEvent = 'START' | 'FINISH';
|
|
382
211
|
*
|
|
@@ -392,59 +221,9 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
392
221
|
* }
|
|
393
222
|
* })
|
|
394
223
|
* class PourModelImpl implements IKosDataModel {
|
|
395
|
-
* async ready(): Promise<void> {
|
|
396
|
-
* // After this completes, FSM is initialized to 'idle'
|
|
397
|
-
* }
|
|
398
|
-
*
|
|
399
224
|
* startPour(): void {
|
|
400
|
-
* this.transition('START');
|
|
401
|
-
* }
|
|
402
|
-
* }
|
|
403
|
-
* ```
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
* ```typescript
|
|
407
|
-
* // UI-bound FSM with ACTIVATE initialization
|
|
408
|
-
* type WorkflowState = 'draft' | 'review' | 'approved';
|
|
409
|
-
* type WorkflowEvent = 'SUBMIT' | 'APPROVE' | 'REJECT';
|
|
410
|
-
*
|
|
411
|
-
* interface DocumentModelImpl extends KosStateMachineAware<WorkflowState, WorkflowEvent> {}
|
|
412
|
-
*
|
|
413
|
-
* @kosModel({ modelTypeId: "document-model" })
|
|
414
|
-
* @kosStateMachine<WorkflowState, WorkflowEvent>({
|
|
415
|
-
* initial: 'draft',
|
|
416
|
-
* initializeAt: DependencyLifecycle.ACTIVATE, // UI-bound
|
|
417
|
-
* states: {
|
|
418
|
-
* draft: { on: { SUBMIT: 'review' } },
|
|
419
|
-
* review: { on: { APPROVE: 'approved', REJECT: 'draft' } },
|
|
420
|
-
* approved: {}
|
|
421
|
-
* }
|
|
422
|
-
* })
|
|
423
|
-
* class DocumentModelImpl implements IKosDataModel {
|
|
424
|
-
* // FSM only initializes when UI activates this model
|
|
425
|
-
* }
|
|
426
|
-
* ```
|
|
427
|
-
*
|
|
428
|
-
* @example
|
|
429
|
-
* ```typescript
|
|
430
|
-
* // FSM with history tracking
|
|
431
|
-
* interface HistoryModelImpl extends KosStateMachineAware<'idle' | 'active', 'TOGGLE'> {}
|
|
432
|
-
*
|
|
433
|
-
* @kosStateMachine<'idle' | 'active', 'TOGGLE'>(
|
|
434
|
-
* {
|
|
435
|
-
* initial: 'idle',
|
|
436
|
-
* states: {
|
|
437
|
-
* idle: { on: { TOGGLE: 'active' } },
|
|
438
|
-
* active: { on: { TOGGLE: 'idle' } }
|
|
439
|
-
* }
|
|
440
|
-
* },
|
|
441
|
-
* {
|
|
442
|
-
* trackHistory: true,
|
|
443
|
-
* stateProperty: 'status'
|
|
225
|
+
* this.transition('START');
|
|
444
226
|
* }
|
|
445
|
-
* )
|
|
446
|
-
* class HistoryModelImpl implements IKosDataModel {
|
|
447
|
-
* // Access via this.stateHistory
|
|
448
227
|
* }
|
|
449
228
|
* ```
|
|
450
229
|
*
|
|
@@ -457,19 +236,11 @@ export declare function kosStateMachine<TState extends string, TEvent extends st
|
|
|
457
236
|
/**
|
|
458
237
|
* Method decorator that marks a method as a state entry handler.
|
|
459
238
|
* The decorated method will be called when the state machine enters the specified state.
|
|
239
|
+
* If it returns a promise, the state's `onDone`/`onError` events fire when it settles.
|
|
460
240
|
*
|
|
461
241
|
* @param state The state to handle entry for
|
|
462
242
|
* @returns A method decorator
|
|
463
243
|
*
|
|
464
|
-
* @example
|
|
465
|
-
* ```typescript
|
|
466
|
-
* @kosStateEntry('pouring')
|
|
467
|
-
* handlePouringStart(): void {
|
|
468
|
-
* this.logger.info('Pour started');
|
|
469
|
-
* EventBus.publish(TOPIC_POUR_STARTED, { id: this.id });
|
|
470
|
-
* }
|
|
471
|
-
* ```
|
|
472
|
-
*
|
|
473
244
|
* @kosService core.state-machine
|
|
474
245
|
* @kosApiLevel 15
|
|
475
246
|
*/
|
|
@@ -481,15 +252,6 @@ export declare function kosStateEntry<TState extends string>(state: TState): Met
|
|
|
481
252
|
* @param state The state to handle exit for
|
|
482
253
|
* @returns A method decorator
|
|
483
254
|
*
|
|
484
|
-
* @example
|
|
485
|
-
* ```typescript
|
|
486
|
-
* @kosStateExit('pouring')
|
|
487
|
-
* handlePouringEnd(): void {
|
|
488
|
-
* this.logger.info('Pour ended');
|
|
489
|
-
* EventBus.publish(TOPIC_POUR_ENDED, { id: this.id });
|
|
490
|
-
* }
|
|
491
|
-
* ```
|
|
492
|
-
*
|
|
493
255
|
* @kosService core.state-machine
|
|
494
256
|
* @kosApiLevel 15
|
|
495
257
|
*/
|
|
@@ -510,7 +272,7 @@ export interface KosStateGuardOptions<TState extends string> {
|
|
|
510
272
|
* Whether to throw an error on invalid state.
|
|
511
273
|
* When false, logs a warning instead.
|
|
512
274
|
*
|
|
513
|
-
* @default
|
|
275
|
+
* @default The state machine's throwOnInvalid setting
|
|
514
276
|
*/
|
|
515
277
|
throwOnInvalid?: boolean;
|
|
516
278
|
}
|
|
@@ -519,9 +281,8 @@ export interface KosStateGuardOptions<TState extends string> {
|
|
|
519
281
|
* The decorated method can only be called when the state machine is in one of the allowed states.
|
|
520
282
|
* The guard reads the property named by the state machine's `stateProperty` option.
|
|
521
283
|
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* - Once FSM is initialized, the guard enforces state validation
|
|
284
|
+
* Before the FSM is initialized the guard lets every call through, so the method can
|
|
285
|
+
* be used during model initialization.
|
|
525
286
|
*
|
|
526
287
|
* @param options Guard configuration
|
|
527
288
|
* @returns A method decorator
|
|
@@ -530,9 +291,8 @@ export interface KosStateGuardOptions<TState extends string> {
|
|
|
530
291
|
* ```typescript
|
|
531
292
|
* @kosStateGuard({ allowedStates: ['ready'] })
|
|
532
293
|
* async pourBeverage(bevId: string): Promise<void> {
|
|
533
|
-
* // This method can only be called when currentState === 'ready'
|
|
534
294
|
* this.transition('POUR');
|
|
535
|
-
* await this.
|
|
295
|
+
* await this.dispense(bevId);
|
|
536
296
|
* this.transition('COMPLETE');
|
|
537
297
|
* }
|
|
538
298
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-state-machine.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-state-machine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AASlD
|
|
1
|
+
{"version":3,"file":"kos-state-machine.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-state-machine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AASlD;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB,CACpC,MAAM,SAAS,MAAM,EACrB,MAAM,SAAS,MAAM;IAErB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;;;;;;;;;OAaG;IACH,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;QACE;;;WAGG;QACH,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAErC;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CACF,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,oBAAoB,CACnC,MAAM,SAAS,MAAM,EACrB,MAAM,SAAS,MAAM;IAErB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,eAA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AAC,GACpC,eAAe,CAmDjB"}
|
|
@@ -121,13 +121,21 @@ export declare class FlowControlManager<T = any, R = T> {
|
|
|
121
121
|
private filterHistory;
|
|
122
122
|
private rateLimitWindow;
|
|
123
123
|
constructor(config: FlowControlOptions<T, R>);
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Runs `eventStream` through the configured filter, rate limit, batching
|
|
126
|
+
* and transform. Aborting `signal` ends the flow without an error: an event
|
|
127
|
+
* still awaited from the source is abandoned, a partial batch is discarded,
|
|
128
|
+
* and the source is returned.
|
|
129
|
+
*/
|
|
130
|
+
processEvents(eventStream: AsyncIterable<T>, signal?: AbortSignal): AsyncGenerator<R, void, unknown>;
|
|
131
|
+
private processSingleEvents;
|
|
125
132
|
private processSingleEvent;
|
|
126
133
|
/**
|
|
127
134
|
* Collects admitted events into batches. A batch is delivered when it
|
|
128
135
|
* reaches `size`, when `window` ms have passed since its first event, or
|
|
129
|
-
* when the stream ends.
|
|
130
|
-
* the generator finishes
|
|
136
|
+
* when the stream ends. Aborting `signal` discards the open batch. The
|
|
137
|
+
* window timer is cleared on every flush and when the generator finishes,
|
|
138
|
+
* is returned or is aborted.
|
|
131
139
|
*/
|
|
132
140
|
private processBatchedEvents;
|
|
133
141
|
private shouldProcessEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-topic-handler-flow-control.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-topic-handler-flow-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,0CAA0C;QAC1C,IAAI,CAAC,EAAE,MAAM,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AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,eAAe,EAAE,MAAM,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"kos-topic-handler-flow-control.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-topic-handler-flow-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,0CAA0C;QAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IAE/B;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,8CAA8C;QAC9C,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QACzD,oDAAoD;QACpD,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV,gDAAgD;QAChD,SAAS,EAAE,MAAM,CAAC;QAClB,kCAAkC;QAClC,QAAQ,EAAE,MAAM,CAAC;QACjB;;;;;W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,aAAa,CAAW;IAChC,OAAO,CAAC,eAAe,CAA6B;gBAExC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;IAY5C;;;;;OAKG;IACI,aAAa,CAClB,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC;YAUpB,mBAAmB;YAwBnB,kBAAkB;IAuBjC;;;;;;OAMG;YACY,oBAAoB;IAoGnC,OAAO,CAAC,kBAAkB;IAsB1B;;;;OAIG;YACW,gBAAgB;IAc9B,OAAO,CAAC,cAAc;YAuBR,gBAAgB;IAa9B,OAAO,CAAC,qBAAqB;IAiB7B,QAAQ,IAAI,gBAAgB;CAG7B"}
|
|
@@ -7,65 +7,31 @@ export interface KosTroubleAwareOptions {
|
|
|
7
7
|
pathProperty?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Class decorator that
|
|
10
|
+
* Class decorator that makes a KOS model TroubleAware: it gets reactive `troubles`
|
|
11
|
+
* (the troubles whose path matches the model's path), `troublesByType` and
|
|
12
|
+
* `troubleStatus` (an empty string by default). The trouble container is added as a
|
|
13
|
+
* dependency automatically.
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* - Adding troubleStatus getter (returns empty string by default)
|
|
16
|
-
* - Adding troublesByType getter that groups troubles by type
|
|
17
|
-
*
|
|
18
|
-
* **Important**: Use TypeScript interface merging to get proper type information:
|
|
19
|
-
*
|
|
20
|
-
* ```typescript
|
|
21
|
-
* // Add ESLint disable comment at top of file, then:
|
|
22
|
-
* interface MyModelImpl extends TroubleAware {}
|
|
23
|
-
*
|
|
24
|
-
* @kosTroubleAware()
|
|
25
|
-
* class MyModelImpl implements IKosDataModel {
|
|
26
|
-
* path: string; // Required for trouble resolution
|
|
27
|
-
*
|
|
28
|
-
* constructor(modelId: string, options: MyOptions) {
|
|
29
|
-
* this.path = options.path;
|
|
30
|
-
* // All TroubleAware properties are now available with full type safety
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* The decorator requires the model to have a path property (default) or specify
|
|
36
|
-
* a custom path property via options.
|
|
15
|
+
* The model must expose its device path on `path`, or on the property named by
|
|
16
|
+
* `pathProperty`. Declare an interface with the same name as the class that extends
|
|
17
|
+
* `TroubleAware` (TypeScript interface merging) so the members are typed.
|
|
37
18
|
*
|
|
38
19
|
* @param options Configuration options for the decorator
|
|
39
20
|
* @returns A class decorator
|
|
40
21
|
*
|
|
41
22
|
* @example
|
|
42
23
|
* ```typescript
|
|
43
|
-
* // Default usage - uses this.path
|
|
44
24
|
* interface HolderModelImpl extends TroubleAware {}
|
|
45
25
|
*
|
|
26
|
+
* @kosModel("holder-model")
|
|
46
27
|
* @kosTroubleAware()
|
|
47
28
|
* class HolderModelImpl implements IKosDataModel {
|
|
48
|
-
* path: string;
|
|
29
|
+
* path: string;
|
|
49
30
|
*
|
|
50
31
|
* constructor(modelId: string, options: HolderOptions) {
|
|
51
32
|
* this.path = options.path;
|
|
52
33
|
* }
|
|
53
34
|
* }
|
|
54
|
-
*
|
|
55
|
-
* // Custom path property
|
|
56
|
-
* interface CustomModelImpl extends TroubleAware {}
|
|
57
|
-
*
|
|
58
|
-
* @kosTroubleAware({ pathProperty: 'devicePath' })
|
|
59
|
-
* class CustomModelImpl implements IKosDataModel {
|
|
60
|
-
* devicePath: string; // Custom path property
|
|
61
|
-
*
|
|
62
|
-
* constructor(modelId: string, options: CustomOptions) {
|
|
63
|
-
* this.devicePath = options.devicePath;
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* // Type-safe external interface
|
|
68
|
-
* export type HolderModel = PublicModelInterface<HolderModelImpl> & TroubleAware;
|
|
69
35
|
* ```
|
|
70
36
|
*
|
|
71
37
|
* @category KOS Model Decorator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-trouble-aware.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-trouble-aware.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED
|
|
1
|
+
{"version":3,"file":"kos-trouble-aware.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/decorators/kos-trouble-aware.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAsBhB"}
|