@kosdev-code/kos-ui-sdk 3.0.25 → 3.0.27
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 +3 -2
- 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 +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-mixin.d.ts +67 -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 +22 -131
- package/core/core/decorators/kos-multiple-future-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-reload-aware.d.ts +14 -14
- package/core/core/decorators/kos-reload-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-service-request-helpers.d.ts +3 -1
- package/core/core/decorators/kos-service-request-helpers.d.ts.map +1 -1
- package/core/core/decorators/kos-service-request.d.ts +85 -265
- package/core/core/decorators/kos-service-request.d.ts.map +1 -1
- package/core/core/decorators/kos-state-machine.d.ts +44 -273
- package/core/core/decorators/kos-state-machine.d.ts.map +1 -1
- package/core/core/decorators/kos-topic-handler-flow-control.d.ts +37 -29
- 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/kosDependency.d.ts +4 -2
- package/core/core/decorators/kosDependency.d.ts.map +1 -1
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/decorators/kosTopicHandler.d.ts +28 -98
- 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/extension/extension-manager.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 +22 -4
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/kosModel.d.ts +21 -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-model-component-factory.d.ts +1 -1
- package/core/core/model/kos-model-component-factory.d.ts.map +1 -1
- package/core/core/model/kos-offline-queue.d.ts +1 -1
- package/core/core/model/kos-service-request-manager.d.ts +7 -2
- package/core/core/model/kos-service-request-manager.d.ts.map +1 -1
- package/core/core/model/kos-subscription-manager.d.ts +2 -2
- package/core/core/model/kos-subscription-manager.d.ts.map +1 -1
- package/core/core/model/service-response-store.d.ts +4 -16
- 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/kos-dependency.d.ts +13 -4
- package/core/types/kos-dependency.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 -15
- 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/model-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 +983 -11777
- package/index.cjs.map +1 -1
- package/index.js +1056 -11854
- 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 +5 -5
- package/models/utils/services/kos/daily/service.d.ts.map +1 -1
- package/models/utils/services/vfs/daily/service.d.ts +5 -5
- package/models/utils/services/vfs/daily/service.d.ts.map +1 -1
- package/models/utils/timer-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/{index-CRb8ucfF.cjs → software-info-registration-Le3V0a6v.cjs} +12187 -986
- package/software-info-registration-Le3V0a6v.cjs.map +1 -0
- package/software-info-registration-kSGacOka.js +24809 -0
- 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-CRb8ucfF.cjs.map +0 -1
- package/index-YzHb2lnB.js +0 -13607
- package/index-YzHb2lnB.js.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,22 +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).
|
|
32
21
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* // FSM initializes when model is ready (most common)
|
|
38
|
-
* initializeAt: DependencyLifecycle.READY
|
|
39
|
-
*
|
|
40
|
-
* // FSM initializes only when UI activates the model
|
|
41
|
-
* initializeAt: DependencyLifecycle.ACTIVATE
|
|
22
|
+
* Before this phase the state property already holds `initial`, but
|
|
23
|
+
* isFsmInitialized is false and transitions are refused.
|
|
42
24
|
*
|
|
43
|
-
*
|
|
44
|
-
* initializeAt: DependencyLifecycle.INIT
|
|
45
|
-
* ```
|
|
25
|
+
* @default DependencyLifecycle.READY
|
|
46
26
|
*/
|
|
47
27
|
initializeAt?: DependencyLifecycle;
|
|
48
28
|
/**
|
|
@@ -66,17 +46,8 @@ export interface KosStateMachineConfig<TState extends string, TEvent extends str
|
|
|
66
46
|
*/
|
|
67
47
|
on?: Partial<Record<TEvent, TState>>;
|
|
68
48
|
/**
|
|
69
|
-
* Event to
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* cancelling: {
|
|
75
|
-
* on: { CANCELLED: 'cancelled', FAIL: 'error' },
|
|
76
|
-
* onDone: 'CANCELLED', // auto-transition on success
|
|
77
|
-
* onError: 'FAIL', // auto-transition on failure
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
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.
|
|
80
51
|
*/
|
|
81
52
|
onDone?: TEvent;
|
|
82
53
|
/**
|
|
@@ -114,100 +85,35 @@ export interface KosStateMachineOptions {
|
|
|
114
85
|
*/
|
|
115
86
|
throwOnInvalid?: boolean;
|
|
116
87
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* This is useful for ViewModels that wrap an existing model which may already be in
|
|
122
|
-
* a non-default state (e.g., a connection that is already CONNECTED on app load).
|
|
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).
|
|
123
91
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
92
|
+
* Entry handlers do not run for the computed state, since it represents current state
|
|
93
|
+
* rather than a transition.
|
|
126
94
|
*
|
|
127
|
-
* @param instance The model
|
|
95
|
+
* @param instance The model or view model instance, after its constructor has run
|
|
128
96
|
* @returns The initial FSM state to use
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```typescript
|
|
132
|
-
* @kosStateMachine(fsmConfig, {
|
|
133
|
-
* computeInitialState: (instance) => {
|
|
134
|
-
* const state = instance.connection?.state;
|
|
135
|
-
* return state === 'CONNECTED' ? 'connected' : 'inactive';
|
|
136
|
-
* }
|
|
137
|
-
* })
|
|
138
|
-
* ```
|
|
139
97
|
* @kosApiLevel 21
|
|
140
98
|
*/
|
|
141
99
|
computeInitialState?: (instance: any) => string;
|
|
142
100
|
}
|
|
143
101
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* **IMPORTANT**: Use TypeScript interface merging to add FSM properties to your model class.
|
|
147
|
-
* This provides full type safety and IntelliSense support for all injected FSM functionality.
|
|
148
|
-
*
|
|
149
|
-
* ## Interface Merging Pattern
|
|
150
|
-
*
|
|
151
|
-
* ```typescript
|
|
152
|
-
* // 1. Define state and event types
|
|
153
|
-
* type PourState = 'idle' | 'preparing' | 'ready' | 'pouring' | 'error';
|
|
154
|
-
* type PourEvent = 'PREPARE' | 'READY' | 'POUR' | 'COMPLETE' | 'ERROR';
|
|
155
|
-
*
|
|
156
|
-
* // 2. Declare interface merging BEFORE the class
|
|
157
|
-
* interface DispenserModelImpl extends KosStateMachineAware<PourState, PourEvent> {}
|
|
158
|
-
*
|
|
159
|
-
* // 3. Apply decorators and implement the class
|
|
160
|
-
* @kosModel({ modelTypeId: "dispenser-model" })
|
|
161
|
-
* @kosStateMachine<PourState, PourEvent>({
|
|
162
|
-
* initial: 'idle',
|
|
163
|
-
* initializeAt: DependencyLifecycle.READY,
|
|
164
|
-
* states: {
|
|
165
|
-
* idle: { on: { PREPARE: 'preparing' } },
|
|
166
|
-
* preparing: { on: { READY: 'ready', ERROR: 'error' } },
|
|
167
|
-
* ready: { on: { POUR: 'pouring' } },
|
|
168
|
-
* pouring: { on: { COMPLETE: 'idle', ERROR: 'error' } },
|
|
169
|
-
* error: {}
|
|
170
|
-
* }
|
|
171
|
-
* })
|
|
172
|
-
* export class DispenserModelImpl implements IKosDataModel {
|
|
173
|
-
* // All FSM properties are now available with full type safety
|
|
174
|
-
* }
|
|
175
|
-
* ```
|
|
102
|
+
* Members that @kosStateMachine injects into a model.
|
|
176
103
|
*
|
|
177
|
-
*
|
|
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).
|
|
178
106
|
*
|
|
179
107
|
* The FSM is uninitialized until the configured lifecycle phase:
|
|
180
|
-
* -
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* initializeAt: DependencyLifecycle.READY, // FSM starts when model is ready
|
|
187
|
-
* states: { ... }
|
|
188
|
-
* })
|
|
189
|
-
* class MyModel {
|
|
190
|
-
* async ready(): Promise<void> {
|
|
191
|
-
* // Before this completes: this.currentState === undefined
|
|
192
|
-
* // After this completes: this.currentState === 'idle'
|
|
193
|
-
* }
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
108
|
+
* - From construction: `currentState === initial` and `isFsmInitialized === false`;
|
|
109
|
+
* `transition()` is refused and `canTransition()`, `isInState()` and
|
|
110
|
+
* `allowedTransitions` report nothing
|
|
111
|
+
* - At the phase: `isFsmInitialized === true` and the entry handler for `initial` runs
|
|
112
|
+
* - After `unload()`: `currentState === undefined` and `isFsmInitialized === false`
|
|
113
|
+
* until the phase runs again
|
|
196
114
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* The decorator automatically injects the following members:
|
|
200
|
-
*
|
|
201
|
-
* - **`currentState`**: Current state (undefined until FSM initialized, observable)
|
|
202
|
-
* - **`isFsmInitialized`**: Boolean indicating if FSM has been initialized
|
|
203
|
-
* - **`isTransitioning`**: Boolean indicating if a transition is in progress
|
|
204
|
-
* - **`allowedTransitions`**: Computed array of valid events for current state
|
|
205
|
-
* - **`transition(event)`**: Method to trigger state transitions
|
|
206
|
-
* - **`canTransition(event)`**: Check if a transition is valid from current state
|
|
207
|
-
* - **`isInState(state)`**: Check if currently in a specific state
|
|
208
|
-
* - **`stateHistory`**: Array of historical states (if trackHistory enabled)
|
|
209
|
-
*
|
|
210
|
-
* 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.
|
|
211
117
|
*
|
|
212
118
|
* @template TState Union type of valid state strings
|
|
213
119
|
* @template TEvent Union type of valid event strings
|
|
@@ -221,22 +127,19 @@ export interface KosStateMachineOptions {
|
|
|
221
127
|
*/
|
|
222
128
|
export interface KosStateMachineAware<TState extends string, TEvent extends string> {
|
|
223
129
|
/**
|
|
224
|
-
* Current state of the state machine.
|
|
225
|
-
* Observable property that updates automatically via @kosModel.
|
|
226
|
-
* Always initialized to the initial state immediately.
|
|
130
|
+
* Current state of the state machine. Holds `initial` from construction.
|
|
227
131
|
*/
|
|
228
132
|
currentState: TState;
|
|
229
133
|
/**
|
|
230
134
|
* Indicates whether the state machine has been initialized.
|
|
231
|
-
* FSM initializes at the configured lifecycle phase (READY, ACTIVATE, etc.).
|
|
135
|
+
* FSM initializes at the configured lifecycle phase (READY, ACTIVATE, ONLINE, etc.).
|
|
232
136
|
*
|
|
233
|
-
* - Before initialization: `false`, `currentState ===
|
|
234
|
-
* - After initialization: `true`,
|
|
137
|
+
* - Before initialization: `false`, `currentState === initial`
|
|
138
|
+
* - After initialization: `true`, and the entry handler for `initial` has run
|
|
235
139
|
*/
|
|
236
140
|
readonly isFsmInitialized: boolean;
|
|
237
141
|
/**
|
|
238
142
|
* Indicates whether a state transition is currently in progress.
|
|
239
|
-
* Observable property that updates during transitions.
|
|
240
143
|
*/
|
|
241
144
|
isTransitioning: boolean;
|
|
242
145
|
/**
|
|
@@ -251,12 +154,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
251
154
|
* @param event The event to trigger
|
|
252
155
|
* @throws Error if FSM not initialized (unless `throwOnInvalid` is false)
|
|
253
156
|
* @throws Error if transition is invalid (unless `throwOnInvalid` is false)
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* ```typescript
|
|
257
|
-
* this.transition('START'); // idle -> active
|
|
258
|
-
* this.transition('STOP'); // active -> idle
|
|
259
|
-
* ```
|
|
260
157
|
*/
|
|
261
158
|
transition(event: TEvent): void;
|
|
262
159
|
/**
|
|
@@ -265,13 +162,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
265
162
|
*
|
|
266
163
|
* @param event The event to check
|
|
267
164
|
* @returns true if the transition is valid, false otherwise
|
|
268
|
-
*
|
|
269
|
-
* @example
|
|
270
|
-
* ```typescript
|
|
271
|
-
* if (this.canTransition('START')) {
|
|
272
|
-
* this.transition('START');
|
|
273
|
-
* }
|
|
274
|
-
* ```
|
|
275
165
|
*/
|
|
276
166
|
canTransition(event: TEvent): boolean;
|
|
277
167
|
/**
|
|
@@ -280,13 +170,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
280
170
|
*
|
|
281
171
|
* @param state The state to check
|
|
282
172
|
* @returns true if currently in the specified state, false otherwise
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* ```typescript
|
|
286
|
-
* if (this.isInState('idle')) {
|
|
287
|
-
* console.log('System is idle');
|
|
288
|
-
* }
|
|
289
|
-
* ```
|
|
290
173
|
*/
|
|
291
174
|
isInState(state: TState): boolean;
|
|
292
175
|
/**
|
|
@@ -302,59 +185,16 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
302
185
|
}>;
|
|
303
186
|
}
|
|
304
187
|
/**
|
|
305
|
-
* Class decorator that adds finite state machine
|
|
306
|
-
*
|
|
307
|
-
* This decorator eliminates manual state management boilerplate by:
|
|
308
|
-
* - **Adding lifecycle-aware FSM initialization** at configured phase (READY, ACTIVATE, etc.)
|
|
309
|
-
* - **Managing state transitions** automatically with validation
|
|
310
|
-
* - **Providing observable state** that integrates with @kosModel reactive system
|
|
311
|
-
* - **Supporting entry/exit handlers** via @kosStateEntry and @kosStateExit decorators
|
|
312
|
-
* - **Enabling state guards** via @kosStateGuard decorator
|
|
313
|
-
*
|
|
314
|
-
* ## Two-Level State System
|
|
315
|
-
*
|
|
316
|
-
* **Framework Lifecycle (Universal, Not Customizable):**
|
|
317
|
-
* - CREATED → INIT → LOAD → READY → ACTIVATE → UNLOAD → DESTROY
|
|
318
|
-
* - Managed by KOS framework
|
|
319
|
-
* - Same for all models
|
|
320
|
-
*
|
|
321
|
-
* **Application FSM (This Decorator):**
|
|
322
|
-
* - Runs WITHIN an active model
|
|
323
|
-
* - Application-specific business logic
|
|
324
|
-
* - Different for each model type
|
|
325
|
-
* - Examples: Pour states, connection states, workflow states
|
|
326
|
-
*
|
|
327
|
-
* ## Lifecycle Integration
|
|
328
|
-
*
|
|
329
|
-
* The FSM initializes at the configured lifecycle phase:
|
|
330
|
-
*
|
|
331
|
-
* ```typescript
|
|
332
|
-
* @kosStateMachine({
|
|
333
|
-
* initial: 'idle',
|
|
334
|
-
* initializeAt: DependencyLifecycle.READY, // Default
|
|
335
|
-
* states: { ... }
|
|
336
|
-
* })
|
|
337
|
-
* ```
|
|
188
|
+
* Class decorator that adds a finite state machine to a KOS model.
|
|
338
189
|
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
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.
|
|
342
195
|
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* **IMPORTANT**: Use TypeScript interface merging to get proper type information:
|
|
346
|
-
*
|
|
347
|
-
* ```typescript
|
|
348
|
-
* type MyState = 'idle' | 'active';
|
|
349
|
-
* type MyEvent = 'START' | 'STOP';
|
|
350
|
-
*
|
|
351
|
-
* interface MyModelImpl extends KosStateMachineAware<MyState, MyEvent> {}
|
|
352
|
-
*
|
|
353
|
-
* @kosStateMachine<MyState, MyEvent>({ ... })
|
|
354
|
-
* class MyModelImpl implements IKosDataModel {
|
|
355
|
-
* // All FSM properties are now available with full type safety
|
|
356
|
-
* }
|
|
357
|
-
* ```
|
|
196
|
+
* Pair the decorator with an interface that extends {@link KosStateMachineAware} so the
|
|
197
|
+
* injected members are typed.
|
|
358
198
|
*
|
|
359
199
|
* @param config State machine configuration
|
|
360
200
|
* @param options Optional configuration for FSM behavior
|
|
@@ -366,7 +206,6 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
366
206
|
*
|
|
367
207
|
* @example
|
|
368
208
|
* ```typescript
|
|
369
|
-
* // Basic FSM with default READY initialization
|
|
370
209
|
* type PourState = 'idle' | 'pouring' | 'complete';
|
|
371
210
|
* type PourEvent = 'START' | 'FINISH';
|
|
372
211
|
*
|
|
@@ -382,62 +221,12 @@ export interface KosStateMachineAware<TState extends string, TEvent extends stri
|
|
|
382
221
|
* }
|
|
383
222
|
* })
|
|
384
223
|
* class PourModelImpl implements IKosDataModel {
|
|
385
|
-
* async ready(): Promise<void> {
|
|
386
|
-
* // After this completes, FSM is initialized to 'idle'
|
|
387
|
-
* }
|
|
388
|
-
*
|
|
389
224
|
* startPour(): void {
|
|
390
|
-
* this.transition('START');
|
|
225
|
+
* this.transition('START');
|
|
391
226
|
* }
|
|
392
227
|
* }
|
|
393
228
|
* ```
|
|
394
229
|
*
|
|
395
|
-
* @example
|
|
396
|
-
* ```typescript
|
|
397
|
-
* // UI-bound FSM with ACTIVATE initialization
|
|
398
|
-
* type WorkflowState = 'draft' | 'review' | 'approved';
|
|
399
|
-
* type WorkflowEvent = 'SUBMIT' | 'APPROVE' | 'REJECT';
|
|
400
|
-
*
|
|
401
|
-
* interface DocumentModelImpl extends KosStateMachineAware<WorkflowState, WorkflowEvent> {}
|
|
402
|
-
*
|
|
403
|
-
* @kosModel({ modelTypeId: "document-model" })
|
|
404
|
-
* @kosStateMachine<WorkflowState, WorkflowEvent>({
|
|
405
|
-
* initial: 'draft',
|
|
406
|
-
* initializeAt: DependencyLifecycle.ACTIVATE, // UI-bound
|
|
407
|
-
* states: {
|
|
408
|
-
* draft: { on: { SUBMIT: 'review' } },
|
|
409
|
-
* review: { on: { APPROVE: 'approved', REJECT: 'draft' } },
|
|
410
|
-
* approved: {}
|
|
411
|
-
* }
|
|
412
|
-
* })
|
|
413
|
-
* class DocumentModelImpl implements IKosDataModel {
|
|
414
|
-
* // FSM only initializes when UI activates this model
|
|
415
|
-
* }
|
|
416
|
-
* ```
|
|
417
|
-
*
|
|
418
|
-
* @example
|
|
419
|
-
* ```typescript
|
|
420
|
-
* // FSM with history tracking
|
|
421
|
-
* interface HistoryModelImpl extends KosStateMachineAware<'idle' | 'active', 'TOGGLE'> {}
|
|
422
|
-
*
|
|
423
|
-
* @kosStateMachine<'idle' | 'active', 'TOGGLE'>(
|
|
424
|
-
* {
|
|
425
|
-
* initial: 'idle',
|
|
426
|
-
* states: {
|
|
427
|
-
* idle: { on: { TOGGLE: 'active' } },
|
|
428
|
-
* active: { on: { TOGGLE: 'idle' } }
|
|
429
|
-
* }
|
|
430
|
-
* },
|
|
431
|
-
* {
|
|
432
|
-
* trackHistory: true,
|
|
433
|
-
* stateProperty: 'status'
|
|
434
|
-
* }
|
|
435
|
-
* )
|
|
436
|
-
* class HistoryModelImpl implements IKosDataModel {
|
|
437
|
-
* // Access via this.stateHistory
|
|
438
|
-
* }
|
|
439
|
-
* ```
|
|
440
|
-
*
|
|
441
230
|
* @category KOS Model Decorator
|
|
442
231
|
* @since 2.1.0
|
|
443
232
|
* @kosService core.state-machine
|
|
@@ -447,19 +236,11 @@ export declare function kosStateMachine<TState extends string, TEvent extends st
|
|
|
447
236
|
/**
|
|
448
237
|
* Method decorator that marks a method as a state entry handler.
|
|
449
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.
|
|
450
240
|
*
|
|
451
241
|
* @param state The state to handle entry for
|
|
452
242
|
* @returns A method decorator
|
|
453
243
|
*
|
|
454
|
-
* @example
|
|
455
|
-
* ```typescript
|
|
456
|
-
* @kosStateEntry('pouring')
|
|
457
|
-
* handlePouringStart(): void {
|
|
458
|
-
* this.logger.info('Pour started');
|
|
459
|
-
* EventBus.publish(TOPIC_POUR_STARTED, { id: this.id });
|
|
460
|
-
* }
|
|
461
|
-
* ```
|
|
462
|
-
*
|
|
463
244
|
* @kosService core.state-machine
|
|
464
245
|
* @kosApiLevel 15
|
|
465
246
|
*/
|
|
@@ -471,15 +252,6 @@ export declare function kosStateEntry<TState extends string>(state: TState): Met
|
|
|
471
252
|
* @param state The state to handle exit for
|
|
472
253
|
* @returns A method decorator
|
|
473
254
|
*
|
|
474
|
-
* @example
|
|
475
|
-
* ```typescript
|
|
476
|
-
* @kosStateExit('pouring')
|
|
477
|
-
* handlePouringEnd(): void {
|
|
478
|
-
* this.logger.info('Pour ended');
|
|
479
|
-
* EventBus.publish(TOPIC_POUR_ENDED, { id: this.id });
|
|
480
|
-
* }
|
|
481
|
-
* ```
|
|
482
|
-
*
|
|
483
255
|
* @kosService core.state-machine
|
|
484
256
|
* @kosApiLevel 15
|
|
485
257
|
*/
|
|
@@ -500,17 +272,17 @@ export interface KosStateGuardOptions<TState extends string> {
|
|
|
500
272
|
* Whether to throw an error on invalid state.
|
|
501
273
|
* When false, logs a warning instead.
|
|
502
274
|
*
|
|
503
|
-
* @default
|
|
275
|
+
* @default The state machine's throwOnInvalid setting
|
|
504
276
|
*/
|
|
505
277
|
throwOnInvalid?: boolean;
|
|
506
278
|
}
|
|
507
279
|
/**
|
|
508
280
|
* Method decorator that guards a method with state validation.
|
|
509
281
|
* The decorated method can only be called when the state machine is in one of the allowed states.
|
|
282
|
+
* The guard reads the property named by the state machine's `stateProperty` option.
|
|
510
283
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
* - 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.
|
|
514
286
|
*
|
|
515
287
|
* @param options Guard configuration
|
|
516
288
|
* @returns A method decorator
|
|
@@ -519,9 +291,8 @@ export interface KosStateGuardOptions<TState extends string> {
|
|
|
519
291
|
* ```typescript
|
|
520
292
|
* @kosStateGuard({ allowedStates: ['ready'] })
|
|
521
293
|
* async pourBeverage(bevId: string): Promise<void> {
|
|
522
|
-
* // This method can only be called when currentState === 'ready'
|
|
523
294
|
* this.transition('POUR');
|
|
524
|
-
* await this.
|
|
295
|
+
* await this.dispense(bevId);
|
|
525
296
|
* this.transition('COMPLETE');
|
|
526
297
|
* }
|
|
527
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,eAAe,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAEtC;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,IAAI,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EAC1E,MAAM,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7C,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAqBhB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EACjD,KAAK,EAAE,MAAM,GACZ,eAAe,CAUjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,EAChD,KAAK,EAAE,MAAM,GACZ,eAAe,CAUjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,MAAM,SAAS,MAAM;IACzD;;;OAGG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EACjD,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACpC,eAAe,CAmDjB"}
|
|
@@ -8,12 +8,16 @@ import { IKosTopicHandlerParams } from './kosTopicHandler';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface FlowControlOptions<T = any, R = T> {
|
|
10
10
|
/**
|
|
11
|
-
* Batching configuration
|
|
11
|
+
* Batching configuration. A batch is delivered when it reaches `size` or
|
|
12
|
+
* when `window` ms have passed since its first event, whichever comes first.
|
|
12
13
|
*/
|
|
13
14
|
batch?: {
|
|
14
15
|
/** Maximum number of events in a batch */
|
|
15
16
|
size?: number;
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Time in ms from a batch's first event until the batch is delivered,
|
|
19
|
+
* full or not
|
|
20
|
+
*/
|
|
17
21
|
window?: number;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
@@ -22,19 +26,6 @@ export interface FlowControlOptions<T = any, R = T> {
|
|
|
22
26
|
* @returns Transformed data to pass to handler
|
|
23
27
|
*/
|
|
24
28
|
transform?: (events: T[]) => R;
|
|
25
|
-
/**
|
|
26
|
-
* Backpressure control to prevent overwhelming slow handlers
|
|
27
|
-
*/
|
|
28
|
-
backpressure?: {
|
|
29
|
-
/** Maximum concurrent handler executions */
|
|
30
|
-
maxConcurrent?: number;
|
|
31
|
-
/** Queue size limit before dropping events */
|
|
32
|
-
maxQueue?: number;
|
|
33
|
-
/** Policy for dropping events when queue is full */
|
|
34
|
-
dropPolicy?: "oldest" | "newest" | "none";
|
|
35
|
-
/** Callback when events are dropped due to queue overflow */
|
|
36
|
-
onQueueFull?: (droppedEvents: T[]) => void;
|
|
37
|
-
};
|
|
38
29
|
/**
|
|
39
30
|
* Advanced filtering with state awareness
|
|
40
31
|
*/
|
|
@@ -45,15 +36,21 @@ export interface FlowControlOptions<T = any, R = T> {
|
|
|
45
36
|
historySize?: number;
|
|
46
37
|
};
|
|
47
38
|
/**
|
|
48
|
-
* Rate limiting options
|
|
39
|
+
* Rate limiting options. The limit applies to each event that passes the
|
|
40
|
+
* filter, before it joins a batch.
|
|
49
41
|
*/
|
|
50
42
|
rateLimit?: {
|
|
51
43
|
/** Maximum events to process per time window */
|
|
52
44
|
maxEvents: number;
|
|
53
45
|
/** Time window in milliseconds */
|
|
54
46
|
windowMs: number;
|
|
55
|
-
/**
|
|
56
|
-
|
|
47
|
+
/**
|
|
48
|
+
* What to do when rate limit is exceeded: `"drop"` discards the event;
|
|
49
|
+
* `"delay"` holds it until the next window and counts it there
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue "drop"
|
|
52
|
+
*/
|
|
53
|
+
onExceeded?: "drop" | "delay";
|
|
57
54
|
};
|
|
58
55
|
/**
|
|
59
56
|
* Error handling strategy for the flow
|
|
@@ -103,10 +100,8 @@ export interface FlowControlStats {
|
|
|
103
100
|
eventsReceived: number;
|
|
104
101
|
/** Total batches processed */
|
|
105
102
|
batchesProcessed: number;
|
|
106
|
-
/** Events dropped
|
|
103
|
+
/** Events dropped by rate limiting */
|
|
107
104
|
eventsDropped: number;
|
|
108
|
-
/** Current queue size */
|
|
109
|
-
currentQueueSize: number;
|
|
110
105
|
/** Average batch size */
|
|
111
106
|
averageBatchSize: number;
|
|
112
107
|
/** Processing rate (events/second) */
|
|
@@ -124,22 +119,35 @@ export declare class FlowControlManager<T = any, R = T> {
|
|
|
124
119
|
private config;
|
|
125
120
|
private stats;
|
|
126
121
|
private filterHistory;
|
|
127
|
-
private activePromises;
|
|
128
|
-
private eventQueue;
|
|
129
122
|
private rateLimitWindow;
|
|
130
123
|
constructor(config: FlowControlOptions<T, R>);
|
|
131
|
-
|
|
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;
|
|
132
132
|
private processSingleEvent;
|
|
133
|
+
/**
|
|
134
|
+
* Collects admitted events into batches. A batch is delivered when it
|
|
135
|
+
* reaches `size`, when `window` ms have passed since its first event, or
|
|
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.
|
|
139
|
+
*/
|
|
133
140
|
private processBatchedEvents;
|
|
134
141
|
private shouldProcessEvent;
|
|
142
|
+
/**
|
|
143
|
+
* Counts an event against the rate limit. Resolves false when the event is
|
|
144
|
+
* dropped; with `onExceeded: "delay"` it waits for a window with room and
|
|
145
|
+
* counts the event there.
|
|
146
|
+
*/
|
|
147
|
+
private admitRateLimited;
|
|
135
148
|
private checkRateLimit;
|
|
136
149
|
private waitForRateLimit;
|
|
137
|
-
private waitForCapacity;
|
|
138
|
-
private handleQueueOverflow;
|
|
139
|
-
private enqueueEvent;
|
|
140
|
-
private dequeueEvent;
|
|
141
150
|
private updateProcessingStats;
|
|
142
|
-
trackPromise<U>(promise: Promise<U>): Promise<U>;
|
|
143
151
|
getStats(): FlowControlStats;
|
|
144
152
|
}
|
|
145
153
|
//# sourceMappingURL=kos-topic-handler-flow-control.d.ts.map
|
|
@@ -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
|
|
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":"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"}
|