@kosdev-code/kos-ui-sdk 3.0.26 → 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 +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 +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 +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
|
@@ -4,46 +4,21 @@ interface Identifiable {
|
|
|
4
4
|
id: string;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Transforms an entity's id before container synchronization.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Use it to build compound model ids when backend ids are only unique within
|
|
10
|
+
* their parent (for example `"123"` becomes `"release-version-abc-123"`), and
|
|
11
|
+
* to keep the original backend id on a `rawId` field for server calls.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* model IDs even when backend IDs are only unique within their parent scope.
|
|
13
|
+
* @template D - Input entity type (data from the backend)
|
|
14
|
+
* @template M - Mapped entity type (defaults to D when no transformation is needed)
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
* for server communication while using compound IDs for model identity.
|
|
17
|
-
*
|
|
18
|
-
* @template D - Input entity type (data from backend)
|
|
19
|
-
* @template M - Mapped entity type (data after transformation, defaults to D if no transformation)
|
|
20
|
-
*
|
|
21
|
-
* @example Simple ID prefix transformation
|
|
16
|
+
* @example
|
|
22
17
|
* ```typescript
|
|
23
18
|
* const idMapper: IdMapper<User, User & { rawId: string }> = (user) => ({
|
|
24
19
|
* ...user,
|
|
25
20
|
* rawId: user.id,
|
|
26
|
-
* id: `user-${user.id}
|
|
27
|
-
* });
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @example Compound ID with parent context
|
|
31
|
-
* ```typescript
|
|
32
|
-
* type WithRawId<T> = T & { rawId: string };
|
|
33
|
-
*
|
|
34
|
-
* const idMapper: IdMapper<VersionResponse, WithRawId<VersionResponse>> = (version) => ({
|
|
35
|
-
* ...version,
|
|
36
|
-
* rawId: version.id,
|
|
37
|
-
* id: `release-version-${templateId}-${version.id}`
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Multi-level compound ID
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const idMapper: IdMapper<CandidateResponse, WithRawId<CandidateResponse>> = (candidate) => ({
|
|
44
|
-
* ...candidate,
|
|
45
|
-
* rawId: candidate.id,
|
|
46
|
-
* id: `release-candidate-${templateId}-${versionId}-${candidate.id}`
|
|
21
|
+
* id: `user-${user.id}`,
|
|
47
22
|
* });
|
|
48
23
|
* ```
|
|
49
24
|
*
|
|
@@ -72,130 +47,47 @@ interface ResolveParams<T extends Container, D extends Identifiable, M extends I
|
|
|
72
47
|
/**
|
|
73
48
|
* Creates a function that synchronizes a container with a new list of entities.
|
|
74
49
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* to
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* - **ID transformation**: Optional `idMapper` transforms backend IDs to model IDs
|
|
82
|
-
* - **Update-in-place**: `onUpdateItem` can update existing models without recreating
|
|
83
|
-
* - **Type safety**: Generic type parameters ensure type consistency through transformation
|
|
84
|
-
*
|
|
85
|
-
* Workflow:
|
|
86
|
-
* 1. Apply `idMapper` to transform entity IDs (if provided)
|
|
87
|
-
* 2. Calculate deltas: which IDs are missing from new data (removals)
|
|
88
|
-
* 3. Invoke `onRemoveItem` for each ID to remove
|
|
89
|
-
* 4. For each entity in new data:
|
|
90
|
-
* - If model exists: invoke `onUpdateItem` (if provided) or `onAddItem`
|
|
91
|
-
* - If model doesn't exist: invoke `onAddItem`
|
|
92
|
-
* 5. Add all new models to container in batch
|
|
50
|
+
* Entity ids are first passed through `idMapper`. Ids in the container that are
|
|
51
|
+
* missing from the new list are passed to `onRemoveItem` and the results are
|
|
52
|
+
* removed. Each incoming entity then goes to `onUpdateItem` when a model with
|
|
53
|
+
* that id already exists (and the callback is provided), otherwise to
|
|
54
|
+
* `onAddItem`. Every non-null return value is added to the container in one
|
|
55
|
+
* batch, so `onUpdateItem` returns `null` after updating a model in place.
|
|
93
56
|
*
|
|
94
57
|
* @template T - Container type implementing IKosModelContainer
|
|
95
|
-
* @template D - Input entity type (data from backend)
|
|
58
|
+
* @template D - Input entity type (data from the backend)
|
|
96
59
|
* @template M - Mapped entity type (after idMapper transformation, defaults to D)
|
|
97
60
|
*
|
|
98
61
|
* @param params - Configuration for resolving deltas
|
|
99
62
|
* @param params.container - The container to synchronize
|
|
100
63
|
* @param params.onAddItem - Callback to create a new model from entity data
|
|
101
|
-
* @param params.onUpdateItem - Optional callback to update existing model (return null to skip adding)
|
|
102
|
-
* @param params.onRemoveItem - Optional callback invoked with each
|
|
103
|
-
* @param params.idMapper - Optional function to transform entity
|
|
64
|
+
* @param params.onUpdateItem - Optional callback to update an existing model (return null to skip adding)
|
|
65
|
+
* @param params.onRemoveItem - Optional callback invoked with each id to remove (default: identity function)
|
|
66
|
+
* @param params.idMapper - Optional function to transform entity ids before processing
|
|
104
67
|
*
|
|
105
68
|
* @returns A function that accepts entities and synchronizes the container
|
|
106
69
|
*
|
|
107
70
|
* @kosService core.container-utils
|
|
108
71
|
*
|
|
109
|
-
* @example
|
|
72
|
+
* @example
|
|
110
73
|
* ```typescript
|
|
111
74
|
* const syncUsers = resolveContainerDeltas({
|
|
112
75
|
* container: userContainer,
|
|
113
76
|
* onAddItem: (user) => User.instance(user.id).options(user).build(),
|
|
114
77
|
* onUpdateItem: (user, existing) => {
|
|
115
78
|
* existing.updateModel(user);
|
|
116
|
-
* return null;
|
|
79
|
+
* return null;
|
|
117
80
|
* },
|
|
118
|
-
* onRemoveItem: (id) => id
|
|
119
81
|
* });
|
|
120
82
|
* syncUsers(newUserList);
|
|
121
83
|
* ```
|
|
122
|
-
*
|
|
123
|
-
* @example ID transformation with compound IDs and rawId preservation
|
|
124
|
-
* ```typescript
|
|
125
|
-
* type WithRawId<T> = T & { rawId: string };
|
|
126
|
-
*
|
|
127
|
-
* const syncVersions = resolveContainerDeltas<
|
|
128
|
-
* typeof template.versions,
|
|
129
|
-
* VersionResponse,
|
|
130
|
-
* WithRawId<VersionResponse>
|
|
131
|
-
* >({
|
|
132
|
-
* container: template.versions,
|
|
133
|
-
* idMapper: (versionData) => ({
|
|
134
|
-
* ...versionData,
|
|
135
|
-
* rawId: versionData.id, // Preserve backend ID
|
|
136
|
-
* id: ReleaseIdFactory.version(templateId, versionData.id) // Compound model ID
|
|
137
|
-
* }),
|
|
138
|
-
* onAddItem: (data) => {
|
|
139
|
-
* const model = ReleaseVersion.instance(data.id)
|
|
140
|
-
* .options({
|
|
141
|
-
* rawId: data.rawId, // Store backend ID for server communication
|
|
142
|
-
* version: data.version,
|
|
143
|
-
* // ... other options
|
|
144
|
-
* })
|
|
145
|
-
* .build();
|
|
146
|
-
* // Recursively sync nested containers
|
|
147
|
-
* syncCandidates(model, data.candidates || []);
|
|
148
|
-
* return model;
|
|
149
|
-
* },
|
|
150
|
-
* onUpdateItem: (data, existingVersion) => {
|
|
151
|
-
* existingVersion.updateModel({
|
|
152
|
-
* rawId: data.rawId || existingVersion.rawId,
|
|
153
|
-
* version: data.version,
|
|
154
|
-
* // ... other updates
|
|
155
|
-
* });
|
|
156
|
-
* // Recursively sync nested containers
|
|
157
|
-
* syncCandidates(existingVersion, data.candidates || []);
|
|
158
|
-
* return null; // Don't add, just updated in place
|
|
159
|
-
* },
|
|
160
|
-
* onRemoveItem: (id) => id
|
|
161
|
-
* })(versionsData);
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* @example Nested container synchronization
|
|
165
|
-
* ```typescript
|
|
166
|
-
* // Parent level
|
|
167
|
-
* syncTemplates(containerModel, templatesData);
|
|
168
|
-
*
|
|
169
|
-
* // Within onAddItem and onUpdateItem, sync children
|
|
170
|
-
* function syncTemplates(container, templates) {
|
|
171
|
-
* resolveContainerDeltas({
|
|
172
|
-
* container: container.container,
|
|
173
|
-
* idMapper: (template) => ({
|
|
174
|
-
* ...template,
|
|
175
|
-
* rawId: template.id,
|
|
176
|
-
* id: ReleaseIdFactory.template(template.id)
|
|
177
|
-
* }),
|
|
178
|
-
* onAddItem: (template) => {
|
|
179
|
-
* const model = createTemplateModel(template);
|
|
180
|
-
* syncQueues(model, template.queues); // Nested sync
|
|
181
|
-
* syncVersions(model, template.versions); // Nested sync
|
|
182
|
-
* return model;
|
|
183
|
-
* },
|
|
184
|
-
* onUpdateItem: (template, existing) => {
|
|
185
|
-
* existing.updateModel(template);
|
|
186
|
-
* syncQueues(existing, template.queues); // Nested sync
|
|
187
|
-
* syncVersions(existing, template.versions); // Nested sync
|
|
188
|
-
* return null;
|
|
189
|
-
* }
|
|
190
|
-
* })(templates);
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
84
|
* @kosApiLevel 2
|
|
194
85
|
*/
|
|
195
86
|
export declare const resolveContainerDeltas: <T extends IKosModelContainer<any>, D extends Identifiable, M extends Identifiable = D>({ container, onAddItem, onUpdateItem, onRemoveItem, idMapper, }: ResolveParams<T, D, M>) => (entities: D[]) => void;
|
|
196
87
|
/**
|
|
197
88
|
* Creates a function that synchronizes a container model's list with new entities.
|
|
198
|
-
*
|
|
89
|
+
* Unlike {@link resolveContainerDeltas} it does not modify the container: it calls
|
|
90
|
+
* `onRemoveItem` for each id that disappeared and `onAddItem` for every incoming entity.
|
|
199
91
|
*
|
|
200
92
|
* @template T - Container model type implementing IKosContainerModel
|
|
201
93
|
* @template D - Input entity type with an id property
|
|
@@ -204,14 +96,6 @@ export declare const resolveContainerDeltas: <T extends IKosModelContainer<any>,
|
|
|
204
96
|
* @returns A function that accepts entities and synchronizes by invoking callbacks
|
|
205
97
|
*
|
|
206
98
|
* @kosService core.container-utils
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* const syncLayers = resolveListDeltas({
|
|
210
|
-
* container: layerContainer,
|
|
211
|
-
* onAddItem: (layer) => addLayer(layer),
|
|
212
|
-
* onRemoveItem: (id) => removeLayer(id)
|
|
213
|
-
* });
|
|
214
|
-
* syncLayers(newLayerList);
|
|
215
99
|
* @kosApiLevel 2
|
|
216
100
|
*/
|
|
217
101
|
export declare const resolveListDeltas: <T extends IKosContainerModel<any, any>, D extends Identifiable, M extends Identifiable = D>({ container, onAddItem, onRemoveItem, idMapper, }: ResolveParams<T, D, M>) => (entities: D[]) => void;
|
|
@@ -232,8 +116,9 @@ interface ResolveItemsParams<T extends Identifiable, D extends Identifiable, M e
|
|
|
232
116
|
idMapper?: IdMapper<D, M>;
|
|
233
117
|
}
|
|
234
118
|
/**
|
|
235
|
-
* Creates a function that synchronizes a plain array of items with
|
|
236
|
-
*
|
|
119
|
+
* Creates a function that synchronizes a plain array of identifiable items with
|
|
120
|
+
* new entities. It calls `onRemoveItem` for each id that disappeared and
|
|
121
|
+
* `onAddItem` for every incoming entity.
|
|
237
122
|
*
|
|
238
123
|
* @template T - Current item type with an id property
|
|
239
124
|
* @template D - Input entity type with an id property
|
|
@@ -242,34 +127,16 @@ interface ResolveItemsParams<T extends Identifiable, D extends Identifiable, M e
|
|
|
242
127
|
* @returns A function that accepts entities and synchronizes the array
|
|
243
128
|
*
|
|
244
129
|
* @kosService core.container-utils
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* const currentItems = [{ id: '1', name: 'Item 1' }];
|
|
248
|
-
* const syncItems = resolveItemListDeltas({
|
|
249
|
-
* items: currentItems,
|
|
250
|
-
* onAddItem: (item) => currentItems.push(item),
|
|
251
|
-
* onRemoveItem: (id) => {
|
|
252
|
-
* const index = currentItems.findIndex(i => i.id === id);
|
|
253
|
-
* if (index >= 0) currentItems.splice(index, 1);
|
|
254
|
-
* }
|
|
255
|
-
* });
|
|
256
|
-
* syncItems(newItems);
|
|
257
130
|
* @kosApiLevel 2
|
|
258
131
|
*/
|
|
259
132
|
export declare const resolveItemListDeltas: <T extends Identifiable, D extends Identifiable, M extends Identifiable = D>({ items, onAddItem, onRemoveItem, idMapper, }: ResolveItemsParams<T, D, M>) => (entities: D[]) => void;
|
|
260
133
|
/**
|
|
261
|
-
* Removes a prefix from an id
|
|
262
|
-
* Useful for normalizing ids that may have parent or namespace prefixes.
|
|
134
|
+
* Removes a leading prefix from an id when present.
|
|
263
135
|
*
|
|
264
136
|
* @param id - The id string to process
|
|
265
137
|
* @param prefix - The prefix to remove (defaults to "parent-")
|
|
266
138
|
* @returns The id with the prefix removed, or the original id if prefix not found
|
|
267
139
|
*
|
|
268
|
-
* @example
|
|
269
|
-
* processId("parent-123") // returns "123"
|
|
270
|
-
* processId("parent-abc", "parent-") // returns "abc"
|
|
271
|
-
* processId("child-456", "parent-") // returns "child-456"
|
|
272
|
-
*
|
|
273
140
|
* @kosService core.container-utils
|
|
274
141
|
* @kosApiLevel 2
|
|
275
142
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/container-utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"container-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/container-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AC,EAAE,CAAC,CAAC,MACxB,UAAU,CAAC,EAAE,SAkBb,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,GAE1B,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACtC,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,YAAY,GAAG,CAAC,EAC1B,mDAKC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MACxB,UAAU,CAAC,EAAE,SAKb,CAAC;AAEJ;;;;;GAKG;AACH,UAAU,kBAAkB,CAC1B,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,YAAY,GAAG,CAAC;IAE1B,gDAAgD;IAChD,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,8CAA8C;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC/B,6CAA6C;IAC7C,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAC/B,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,YAAY,GAAG,CAAC,EAAE,+CAK1E,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAC7B,UAAU,CAAC,EAAE,SAKb,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,EAAE,eAAkB,WAMvD,CAAC"}
|
|
@@ -34,20 +34,10 @@ interface FormatTimeOptions {
|
|
|
34
34
|
interface FormatDateTimeOptions extends FormatDateOptions, FormatTimeOptions {
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Formats a date according to
|
|
37
|
+
* Formats a date with `Intl.DateTimeFormat` according to `dateStyle` and locale.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* - `"short"` uses a custom format: `dd/mm/yyyy` (e.g., `31/12/2025`)
|
|
42
|
-
* - Other styles use built-in `Intl` formatting
|
|
43
|
-
*
|
|
44
|
-
* ### Example Output
|
|
45
|
-
* ```ts
|
|
46
|
-
* formatDate(new Date("2025-12-31"), { dateStyle: "short" }); // "31/12/2025"
|
|
47
|
-
* formatDate(new Date("2025-12-31"), { dateStyle: "medium" }); // "Dec 31, 2025"
|
|
48
|
-
* formatDate(new Date("2025-12-31"), { dateStyle: "long" }); // "December 31, 2025"
|
|
49
|
-
* formatDate(new Date("2025-12-31"), { dateStyle: "full" }); // "Wednesday, December 31, 2025"
|
|
50
|
-
* ```
|
|
39
|
+
* `"short"` uses a numeric year with two-digit month and day in the locale's
|
|
40
|
+
* order (`12/31/2025` in en-US); the other styles use the built-in `Intl` styles.
|
|
51
41
|
*
|
|
52
42
|
* @param date - The date object or timestamp to format.
|
|
53
43
|
* @param options - Options to customize formatting.
|
|
@@ -60,17 +50,9 @@ interface FormatDateTimeOptions extends FormatDateOptions, FormatTimeOptions {
|
|
|
60
50
|
*/
|
|
61
51
|
export declare const formatDate: (date?: Date | number, { dateStyle, locales }?: FormatDateOptions) => string;
|
|
62
52
|
/**
|
|
63
|
-
* Formats a time according to
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* ### Example Output
|
|
68
|
-
* ```ts
|
|
69
|
-
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "short" }); // "11:59 PM"
|
|
70
|
-
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "medium" }); // "11:59:59 PM"
|
|
71
|
-
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "long" }); // "11:59:59 PM EST"
|
|
72
|
-
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "full" }); // "11:59 PM Eastern Standard Time"
|
|
73
|
-
* ```
|
|
53
|
+
* Formats a time with `Intl.DateTimeFormat` according to `timeStyle` and
|
|
54
|
+
* locale. All styles use a 12-hour clock; `"medium"` and `"long"` add seconds,
|
|
55
|
+
* and `"long"` and `"full"` add the time zone name.
|
|
74
56
|
*
|
|
75
57
|
* @param date - The date object or timestamp to extract the time from.
|
|
76
58
|
* @param options - Options to customize time formatting.
|
|
@@ -83,40 +65,9 @@ export declare const formatDate: (date?: Date | number, { dateStyle, locales }?:
|
|
|
83
65
|
*/
|
|
84
66
|
export declare const formatTime: (date?: Date | number, { locales, timeStyle }?: FormatTimeOptions) => string;
|
|
85
67
|
/**
|
|
86
|
-
* Formats a date and
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* - `"short"` date is always `dd/mm/yyyy`
|
|
91
|
-
* - `"short"` time is always 12-hour format (e.g., `11:59 PM`)
|
|
92
|
-
* - Supports combining both formats into a single string
|
|
93
|
-
*
|
|
94
|
-
* ### Example Output
|
|
95
|
-
* ```ts
|
|
96
|
-
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
97
|
-
* dateStyle: "short",
|
|
98
|
-
* timeStyle: "short"
|
|
99
|
-
* }); // "31/12/2025, 11:59 PM"
|
|
100
|
-
*
|
|
101
|
-
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
102
|
-
* dateStyle: "medium",
|
|
103
|
-
* timeStyle: "medium"
|
|
104
|
-
* }); // "Dec 31, 2025, 11:59:59 PM"
|
|
105
|
-
*
|
|
106
|
-
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
107
|
-
* dateStyle: "long",
|
|
108
|
-
* timeStyle: "long"
|
|
109
|
-
* }); // "December 31, 2025, 11:59:59 PM EST"
|
|
110
|
-
*
|
|
111
|
-
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
112
|
-
* dateStyle: "full",
|
|
113
|
-
* timeStyle: "full"
|
|
114
|
-
* }); // "Wednesday, December 31, 2025, 11:59 PM Eastern Standard Time"
|
|
115
|
-
*
|
|
116
|
-
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
117
|
-
* timeStyle: "short"
|
|
118
|
-
* }); // "11:59 PM"
|
|
119
|
-
* ```
|
|
68
|
+
* Formats a date and time in one string with `Intl.DateTimeFormat`. It takes
|
|
69
|
+
* the same `dateStyle` and `timeStyle` names as {@link formatDate} and
|
|
70
|
+
* {@link formatTime}; both default to `"short"` (`12/31/2025, 11:59 PM` in en-US).
|
|
120
71
|
*
|
|
121
72
|
* @param date - The `Date` object or timestamp to format.
|
|
122
73
|
* @param options - Formatting options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/date-utils.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,UAWzC;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,OACgB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAG1D,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,OAAO,MAAM,SAOxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,EAAE,OAAO,MAAM,SAItD,CAAC;AAIF,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC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GACzB,OAAO,IAAI,GAAG,MAAM,EACpB,qCAIG,qBAIF,WAOF,CAAC"}
|
package/core/util/debounce.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Debounces a function
|
|
3
|
-
* has passed since the last invocation.
|
|
2
|
+
* Debounces a function so it runs once the timeout has passed since the last call.
|
|
4
3
|
*
|
|
5
4
|
* @param context - The context (this value) to be used when calling the debounced function.
|
|
6
5
|
* @param func - The function to debounce.
|
|
@@ -8,12 +7,6 @@
|
|
|
8
7
|
* Defaults to 300 milliseconds.
|
|
9
8
|
* @returns A debounced version of the provided function.
|
|
10
9
|
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const debouncedFn = debounce(this, myFunction, 500);
|
|
14
|
-
* debouncedFn(arg1, arg2);
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
10
|
* @kosService core.utils
|
|
18
11
|
* @kosApiLevel 2
|
|
19
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/debounce.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iBAAS,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,SAAM,IAQnD,GAAG,MAAM,GAAG,UAarB;AAED,eAAe,QAAQ,CAAC"}
|
package/core/util/kos-fetch.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface KosServiceResponse<T> {
|
|
|
19
19
|
*/
|
|
20
20
|
declare let BASE_URL: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Fetch-like function that sends requests over the KOS transport.
|
|
23
23
|
*
|
|
24
24
|
* @kosService core.fetch
|
|
25
25
|
* @kosApiLevel 2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-fetch.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-fetch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAoBrE;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"kos-fetch.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-fetch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAoBrE;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;CAChB;AA0XD;;;;;GAKG;AACH,QAAA,IAAI,QAAQ,QAAS,CAAC;AACtB;;;;;GAKG;AACH,QAAA,IAAI,QAAQ,QA9OL,MAAM,YACD,eAAe,KACxB,OAAO,CAAC,QAAQ,CA4OM,CAAC;AAW1B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -160,34 +160,33 @@ export declare const isKosModelReady: (model: IKosDataModel) => boolean;
|
|
|
160
160
|
/**
|
|
161
161
|
* An observable, read-only view of a model's activation lifecycle.
|
|
162
162
|
*
|
|
163
|
-
* Models that fetch lazily do so in `activate()`, so activation state
|
|
164
|
-
* `loaded`, which tracks
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* {@link IKosModel}.
|
|
163
|
+
* Models that fetch lazily do so in `activate()`, so activation state (rather
|
|
164
|
+
* than `loaded`, which tracks `load()`) tells a consumer whether that fetch has
|
|
165
|
+
* settled and whether it succeeded. A view can react to it without depending
|
|
166
|
+
* on the whole {@link IKosModel}.
|
|
168
167
|
*/
|
|
169
168
|
export interface KosModelActivationState {
|
|
170
169
|
/** The model's current activation state. */
|
|
171
170
|
readonly activeStatus: KosModelState;
|
|
172
|
-
/** Activation is in flight
|
|
171
|
+
/** Activation is in flight, so there is nothing conclusive to render yet. */
|
|
173
172
|
readonly isActivating: boolean;
|
|
174
173
|
/** Activation completed; the model's activate() work is done. */
|
|
175
174
|
readonly isActive: boolean;
|
|
176
|
-
/** Activation threw
|
|
175
|
+
/** Activation threw, so the model's data is absent rather than empty. */
|
|
177
176
|
readonly isFailed: boolean;
|
|
178
177
|
}
|
|
179
178
|
/**
|
|
180
179
|
* Retrieves an observable view of a model's activation state.
|
|
181
180
|
*
|
|
182
|
-
* Every member is a getter
|
|
183
|
-
*
|
|
184
|
-
*
|
|
181
|
+
* Every member is a getter that reads the reactive model at access time. Read
|
|
182
|
+
* its properties inside a `kosComponent` to re-render as the model activates,
|
|
183
|
+
* succeeds or fails.
|
|
185
184
|
*
|
|
186
185
|
* @param model - The KOS data model to observe.
|
|
187
186
|
* @returns The activation view, or `undefined` when the model has no wrapper
|
|
188
187
|
* yet (not created, or already destroyed).
|
|
189
188
|
*
|
|
190
|
-
* @example
|
|
189
|
+
* @example
|
|
191
190
|
* ```tsx
|
|
192
191
|
* const activation = getKosModelActivationState(container);
|
|
193
192
|
* if (!activation || activation.isActivating) return <Blank />;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-model-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-model-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAkB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAU,OAAO,aAAa,kBAGzD,CAAC;AAE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K,OAAO,KAC9B,SAAS,GAAG,SAWd,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACpB,CAAC,SAAS,aAAa,EAAE,MAAM,MAAM,MACrC,OAAO,GAAG,KAAG,KAAK,IAAI,CAC4B,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,aAAa,YAMnD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"kos-model-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-model-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAkB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAU,OAAO,aAAa,kBAGzD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAU,WAAW,aAAa,kBAa5D,CAAC;AACF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAU,OAAO,aAAa,kBAoBvD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,MAAM,gCAQpD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,aAAa,GAAG,aAAa,EACvE,SAAS,MAAM;WAQqB,CAAC;;EACtC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,aAAa,GAAG,aAAa,EACrE,SAAS,MAAM;WAOqB,CAAC;;CACtC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,aAAa,EAChD,WAAW,MAAM,EACjB,WAAW;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,KASZ,CAAC,EACrB,CAAC;AAEF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@ -1,34 +1,17 @@
|
|
|
1
1
|
import { IKosDataModel } from '../core/kosModel';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a property key
|
|
3
|
+
* Creates a property key placeholder (`{PROP_<key>}`) for a data model field.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* a property key should be used to reference the data model key.
|
|
9
|
-
*
|
|
10
|
-
* For kos dependencies, propKeys can be used to resolve any dependency options that are derived from the data model.
|
|
11
|
-
*
|
|
12
|
-
* For topic handlers, the resolved topic can include propKey to allow for dynamic topic resolution based on the data model.
|
|
5
|
+
* Decorator options that depend on model data, such as a `@kosDependency` id
|
|
6
|
+
* or a `@kosTopicHandler` topic, use a property key; the framework replaces it
|
|
7
|
+
* with the model's current value for that field when it resolves the option.
|
|
13
8
|
*
|
|
14
9
|
* @param key - The key from a Kos data model.
|
|
15
10
|
* @returns A property key string enclosed in curly braces with a "PROP_" prefix.
|
|
16
11
|
*
|
|
17
12
|
* @example
|
|
18
|
-
* // Create a property key for a data model key "name"
|
|
19
|
-
* const propertyKey = createPropKey("name");
|
|
20
|
-
* // Result: "{PROP_name}"
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Create a property key for a data model key "id"
|
|
24
|
-
* const propertyKey = createPropKey("id");
|
|
25
|
-
* // Result: "{PROP_id}"
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* The propKey can be used as part of dependency or topic listener to allow for models to
|
|
29
|
-
* dynamically change the dependency or topic listener based on the data model.
|
|
30
13
|
* ```typescript
|
|
31
|
-
* @kosDependency({modelType: Ingredient.type, id:
|
|
14
|
+
* @kosDependency({ modelType: Ingredient.type, id: createPropKey("ingredientId") })
|
|
32
15
|
* ```
|
|
33
16
|
*
|
|
34
17
|
* @kosService core.kos-model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-attribute-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/model-attribute-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"model-attribute-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/model-attribute-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,aAAa,EAAE,KAAK,MAAM,CAAC,WAC1C,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,KAAK,MAAM,CAAC,WACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-type-guards.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/model-type-guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI;IAAE,MAAM,EAAE,MAAM,MAAM,CAAA;CACpC,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,aACd,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,GAAG,KACT,KAAK,IAAI,kBAAkB,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"model-type-guards.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/model-type-guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI;IAAE,MAAM,EAAE,MAAM,MAAM,CAAA;CACpC,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,aACd,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,GAAG,KACT,KAAK,IAAI,kBAAkB,CAAC,GAAG,CAIP,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,WAAW,GAAG,KACb,aAAa,GAAG,aAAa,EAAE,GAAG,SAepC,CAAC"}
|
|
@@ -14,44 +14,19 @@ export declare class ModelError extends Error {
|
|
|
14
14
|
* @param model - The model being operated on
|
|
15
15
|
* @param status - Description of the operation status (e.g., "ACTIVE", "INACTIVE")
|
|
16
16
|
* @returns Object containing the timeout promise and a cancel function
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const { promise: timeoutPromise, cancel } = rejectAfterDelay(
|
|
21
|
-
* MODEL_PROMISE_TIMEOUT_MS,
|
|
22
|
-
* myModel,
|
|
23
|
-
* 'ACTIVE'
|
|
24
|
-
* );
|
|
25
|
-
*
|
|
26
|
-
* Promise.race([
|
|
27
|
-
* myOperation().then(() => cancel()),
|
|
28
|
-
* timeoutPromise
|
|
29
|
-
* ]);
|
|
30
|
-
* ```
|
|
31
17
|
*/
|
|
32
18
|
export declare const rejectAfterDelay: (ms: number, model: IKosModel, status: string) => {
|
|
33
19
|
promise: Promise<void>;
|
|
34
20
|
cancel: () => void;
|
|
35
21
|
};
|
|
36
22
|
/**
|
|
37
|
-
* Races a promise against a timeout
|
|
38
|
-
* Useful for ensuring operations complete within a time limit.
|
|
23
|
+
* Races a promise against a timeout and cancels the timer once either settles.
|
|
39
24
|
*
|
|
40
25
|
* @param promise - The operation promise to race
|
|
41
26
|
* @param timeoutMs - Timeout duration in milliseconds (defaults to MODEL_PROMISE_TIMEOUT_MS)
|
|
42
27
|
* @param model - The model being operated on
|
|
43
28
|
* @param status - Description of the operation
|
|
44
29
|
* @returns Promise that resolves/rejects based on whichever completes first
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* await raceWithTimeout(
|
|
49
|
-
* model.transitionToActive(),
|
|
50
|
-
* MODEL_PROMISE_TIMEOUT_MS,
|
|
51
|
-
* model,
|
|
52
|
-
* 'ACTIVE'
|
|
53
|
-
* );
|
|
54
|
-
* ```
|
|
55
30
|
*/
|
|
56
31
|
export declare const raceWithTimeout: <T>(promise: Promise<T>, timeoutMs: number | undefined, model: IKosModel, status: string) => Promise<T>;
|
|
57
32
|
//# sourceMappingURL=promise-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/promise-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,KAAK,EAAE,SAAS,CAAC;gBACL,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS;CAI1D;AAED
|
|
1
|
+
{"version":3,"file":"promise-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/promise-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,KAAK,EAAE,SAAS,CAAC;gBACL,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS;CAI1D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAC3B,IAAI,MAAM,EACV,OAAO,SAAS,EAChB,QAAQ,MAAM,KACb;IAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAsB9C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EACrC,SAAS,OAAO,CAAC,CAAC,CAAC,EACnB,WAAW,MAAM,YAA2B,EAC5C,OAAO,SAAS,EAChB,QAAQ,MAAM,KACb,OAAO,CAAC,CAAC,CAeX,CAAC"}
|
|
@@ -104,29 +104,11 @@ export declare const ServiceFactory: {
|
|
|
104
104
|
* @returns An object with service methods for interacting with the server.
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
|
-
*
|
|
108
|
-
* const entityService = ServiceFactory.build({
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* deleteModelPath: "/delete",
|
|
113
|
-
* addModelPath: "/add",
|
|
114
|
-
* modifyModelPath: "/modify",
|
|
115
|
-
* });
|
|
116
|
-
*
|
|
117
|
-
* // Fetch a list of entities.
|
|
118
|
-
* const entities = await entityService.getAll({ ordered: true });
|
|
119
|
-
*
|
|
120
|
-
* // Get details of a specific entity by ID.
|
|
121
|
-
* const entityDetails = await entityService.getModelById({ id: "entity123" });
|
|
122
|
-
*
|
|
123
|
-
* // Add a new entity to the server.
|
|
124
|
-
* const newEntity = { name: "New Entity" };
|
|
125
|
-
* await entityService.addModel({ model: newEntity });
|
|
126
|
-
*
|
|
127
|
-
* // Modify an existing entity.
|
|
128
|
-
* const updatedEntity = { id: "entity123", name: "Updated Entity" };
|
|
129
|
-
* await entityService.modifyModel({ model: updatedEntity });
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const entityService = ServiceFactory.build({ basePath: "/api/entities" });
|
|
109
|
+
* const entities = await entityService.getAll({});
|
|
110
|
+
* await entityService.modifyModel({ id: "entity123", model: { name: "Updated" } });
|
|
111
|
+
* ```
|
|
130
112
|
*/
|
|
131
113
|
build: ({ destinationAddress, basePath, getAllPath, getOnePath, deleteModelPath, addModelPath, modifyModelPath, mock, }: ServiceFactoryParams) => {
|
|
132
114
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-factory.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/service-factory.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service-factory.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/service-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM;;;CAIlD,CAAC;AAWF;;GAEG;AACH,UAAU,iBAAkB,SAAQ,YAAY;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAyED;;GAEG;AACH,KAAK,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,GACpC,OAAO,CAAC,aAAa,CAAC,GACtB,OAAO,CAAC,UAAU,CAAC,GACnB,OAAO,CAAC,eAAe,CAAC,GACxB,OAAO,CAAC,YAAY,CAAC,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE5B;;GAEG;AACH,UAAU,YAAa,SAAQ,YAAY;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,UAAU,kBAAmB,SAAQ,YAAY;IAC/C,EAAE,EAAE,MAAM,CAAC;CACZ;AAgQD,UAAU,SAAS;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,YAAY;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAA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