@kosdev-code/kos-dispense-sdk 0.1.0-dev.5873 → 0.1.0-next.1000
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 +129 -0
- package/{dispense-registration-manager-ukk4OBeX.cjs → dispense-registration-manager-CfWgJqfq.cjs} +807 -445
- package/dispense-registration-manager-CfWgJqfq.cjs.map +1 -0
- package/{dispense-registration-manager-C4XZ_c3x.js → dispense-registration-manager-DtN0T_JG.js} +846 -484
- package/dispense-registration-manager-DtN0T_JG.js.map +1 -0
- package/{extension-utils-CMVLCSA8.cjs → extension-utils-BWYG2dYG.cjs} +52 -194
- package/extension-utils-BWYG2dYG.cjs.map +1 -0
- package/{extension-utils-FxS68Xu9.js → extension-utils-BoXtjU5_.js} +58 -200
- package/extension-utils-BoXtjU5_.js.map +1 -0
- package/extensions/control-pour-extension.d.ts +8 -9
- package/extensions/control-pour-extension.d.ts.map +1 -1
- package/extensions/index.d.ts.map +1 -1
- package/index.cjs +31 -11
- package/index.cjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +118 -98
- package/index.js.map +1 -1
- package/models/constants/constants.d.ts +14 -178
- package/models/constants/constants.d.ts.map +1 -1
- package/models/constants/index.d.ts.map +1 -1
- package/models/index.d.ts.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +12 -5
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/assembly-registration.d.ts +12 -71
- package/models/models/assembly/assembly-registration.d.ts.map +1 -1
- package/models/models/assembly/board-utils.d.ts +1 -2
- package/models/models/assembly/board-utils.d.ts.map +1 -1
- package/models/models/assembly/holder-utils.d.ts +1 -2
- package/models/models/assembly/holder-utils.d.ts.map +1 -1
- package/models/models/assembly/index.d.ts.map +1 -1
- package/models/models/assembly/nozzle-utils.d.ts +1 -2
- package/models/models/assembly/nozzle-utils.d.ts.map +1 -1
- package/models/models/assembly/pump-utils.d.ts +2 -3
- package/models/models/assembly/pump-utils.d.ts.map +1 -1
- package/models/models/assembly/services/assembly-services.d.ts +0 -1
- package/models/models/assembly/services/assembly-services.d.ts.map +1 -1
- package/models/models/assembly/services/index.d.ts.map +1 -1
- package/models/models/assembly/types/index.d.ts +8 -3
- package/models/models/availability/availability-model.d.ts +13 -78
- package/models/models/availability/availability-model.d.ts.map +1 -1
- package/models/models/availability/index.d.ts.map +1 -1
- package/models/models/availability/types/index.d.ts +7 -13
- package/models/models/board/board-container-model.d.ts +10 -3
- package/models/models/board/board-container-model.d.ts.map +1 -1
- package/models/models/board/board-container-registration.d.ts +13 -77
- package/models/models/board/board-container-registration.d.ts.map +1 -1
- package/models/models/board/board-model.d.ts +1 -2
- package/models/models/board/board-model.d.ts.map +1 -1
- package/models/models/board/board-registration.d.ts +12 -74
- package/models/models/board/board-registration.d.ts.map +1 -1
- package/models/models/board/index.d.ts.map +1 -1
- package/models/models/board/types/index.d.ts +12 -2
- package/models/models/board/types/services.d.ts.map +1 -1
- package/models/models/board/utils/board-trouble-data-mapper.d.ts +1 -2
- package/models/models/board/utils/board-trouble-data-mapper.d.ts.map +1 -1
- package/models/models/board/utils/board-trouble-resolver.d.ts +0 -1
- package/models/models/board/utils/board-trouble-resolver.d.ts.map +1 -1
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts +133 -0
- package/models/models/cui-kit-state/cui-kit-state-model.d.ts.map +1 -0
- package/models/models/cui-kit-state/index.d.ts +4 -0
- package/models/models/cui-kit-state/index.d.ts.map +1 -0
- package/models/models/cui-kit-state/types/index.d.ts +82 -0
- package/models/models/device-assembly/device-assembly-model.d.ts +6 -3
- package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -1
- package/models/models/device-assembly/device-assembly-registration.d.ts +14 -79
- package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -1
- package/models/models/device-assembly/index.d.ts.map +1 -1
- package/models/models/device-assembly/types/index.d.ts +4 -0
- package/models/models/generic-pour/generic-pour-model.d.ts +19 -4
- package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
- package/models/models/generic-pour/generic-pour-registration.d.ts +13 -75
- package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -1
- package/models/models/generic-pour/index.d.ts.map +1 -1
- package/models/models/generic-pour/services/generic-pour-services.d.ts.map +1 -1
- package/models/models/generic-pour/services/index.d.ts.map +1 -1
- package/models/models/generic-pour/types/index.d.ts +4 -0
- package/models/models/holder/holder-model.d.ts +16 -75
- package/models/models/holder/holder-model.d.ts.map +1 -1
- package/models/models/holder/index.d.ts.map +1 -1
- package/models/models/holder/services/assignment-services.d.ts.map +1 -1
- package/models/models/holder/services/holder-services.d.ts.map +1 -1
- package/models/models/holder/services/index.d.ts.map +1 -1
- package/models/models/holder/types/index.d.ts +11 -7
- package/models/models/holder/utils/holder-utils.d.ts +0 -1
- package/models/models/holder/utils/holder-utils.d.ts.map +1 -1
- package/models/models/holder-container/holder-container-model.d.ts +12 -70
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
- package/models/models/holder-container/index.d.ts.map +1 -1
- package/models/models/holder-container/types/index.d.ts +16 -5
- package/models/models/index.d.ts +1 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/ingredient/index.d.ts.map +1 -1
- package/models/models/ingredient/ingredient-model.d.ts +12 -76
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
- package/models/models/ingredient/services/index.d.ts.map +1 -1
- package/models/models/ingredient/services/ingredient-services.d.ts.map +1 -1
- package/models/models/ingredient/types/index.d.ts +7 -13
- package/models/models/ingredient-container/index.d.ts.map +1 -1
- package/models/models/ingredient-container/ingredient-container-model.d.ts +12 -70
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
- package/models/models/ingredient-container/types/index.d.ts +7 -3
- package/models/models/nozzle/index.d.ts.map +1 -1
- package/models/models/nozzle/nozzle-model.d.ts +20 -81
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/models/nozzle/services/index.d.ts.map +1 -1
- package/models/models/nozzle/services/nozzle-services.d.ts +11 -65
- package/models/models/nozzle/services/nozzle-services.d.ts.map +1 -1
- package/models/models/nozzle/types/index.d.ts +7 -3
- package/models/models/pump/index.d.ts.map +1 -1
- package/models/models/pump/pump-model.d.ts +12 -81
- package/models/models/pump/pump-model.d.ts.map +1 -1
- package/models/models/pump/services/index.d.ts.map +1 -1
- package/models/models/pump/services/pump-services.d.ts +3 -5
- package/models/models/pump/services/pump-services.d.ts.map +1 -1
- package/models/models/pump/types/index.d.ts +7 -3
- package/models/models/pump/utils/pump-trouble-resolver.d.ts +0 -1
- package/models/models/pump/utils/pump-trouble-resolver.d.ts.map +1 -1
- package/models/models/pump-container/index.d.ts.map +1 -1
- package/models/models/pump-container/pump-container-model.d.ts +16 -70
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
- package/models/models/pump-container/types/index.d.ts +7 -3
- package/models/models/types/assembly.d.ts.map +1 -1
- package/models/models/types/index.d.ts.map +1 -1
- package/models/models/types/intent.d.ts +11 -79
- package/models/models/types/intent.d.ts.map +1 -1
- package/models/models/types/pouring.d.ts.map +1 -1
- package/models/utils/dispense-registration-manager.d.ts +34 -10
- package/models/utils/dispense-registration-manager.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +66 -173
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/openapi-index.d.ts +1 -1
- package/models/utils/openapi-index.d.ts.map +1 -1
- package/models/utils/pour-context.d.ts +8 -0
- package/models/utils/pour-context.d.ts.map +1 -0
- package/models/utils/registration.d.ts +0 -1
- package/models/utils/registration.d.ts.map +1 -1
- package/models/utils/service.d.ts +34 -35
- package/models/utils/service.d.ts.map +1 -1
- package/models/utils/services/dispense/1.6.5/service.d.ts +34 -35
- package/models/utils/services/dispense/1.6.5/service.d.ts.map +1 -1
- package/models/utils/services/dispense/1.8.1/service.d.ts +34 -35
- package/models/utils/services/dispense/1.8.1/service.d.ts.map +1 -1
- package/models/utils/services/dispense/daily/openapi.d.ts +1941 -1812
- package/models/utils/services/dispense/daily/service.d.ts +127 -37
- package/models/utils/services/dispense/daily/service.d.ts.map +1 -1
- package/models/utils/services-index.d.ts +1 -1
- package/models/utils/services-index.d.ts.map +1 -1
- package/models.cjs +4 -5
- package/models.cjs.map +1 -1
- package/models.d.ts +1 -0
- package/models.js +29 -30
- package/models.js.map +1 -1
- package/package.json +11 -12
- package/{pump-provider-BAQXIUuP.cjs → pump-provider-B4WR3LiY.cjs} +480 -544
- package/pump-provider-B4WR3LiY.cjs.map +1 -0
- package/{pump-provider-9rUgev7q.js → pump-provider-CPUsLke5.js} +541 -605
- package/pump-provider-CPUsLke5.js.map +1 -0
- package/ui/contexts/assembly/assembly-provider.d.ts +9 -2
- package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -1
- package/ui/contexts/assembly/index.d.ts.map +1 -1
- package/ui/contexts/availability/availability-provider.d.ts +9 -2
- package/ui/contexts/availability/availability-provider.d.ts.map +1 -1
- package/ui/contexts/availability/index.d.ts.map +1 -1
- package/ui/contexts/board/board-provider.d.ts +9 -2
- package/ui/contexts/board/board-provider.d.ts.map +1 -1
- package/ui/contexts/board/index.d.ts.map +1 -1
- package/ui/contexts/board-container/board-container-provider.d.ts +9 -2
- package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -1
- package/ui/contexts/board-container/index.d.ts.map +1 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts +17 -3
- package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
- package/ui/contexts/cui-kit/index.d.ts.map +1 -1
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts +9 -2
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -1
- package/ui/contexts/device-assembly/index.d.ts.map +1 -1
- package/ui/contexts/holder/holder-provider.d.ts +9 -2
- package/ui/contexts/holder/holder-provider.d.ts.map +1 -1
- package/ui/contexts/holder/index.d.ts.map +1 -1
- package/ui/contexts/holder-container/holder-container-provider.d.ts +9 -2
- package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -1
- package/ui/contexts/holder-container/index.d.ts.map +1 -1
- package/ui/contexts/index.d.ts.map +1 -1
- package/ui/contexts/ingredient/index.d.ts.map +1 -1
- package/ui/contexts/ingredient/ingredient-provider.d.ts +9 -2
- package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/index.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +9 -2
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -1
- package/ui/contexts/nozzle/index.d.ts.map +1 -1
- package/ui/contexts/nozzle/nozzle-provider.d.ts +9 -2
- package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -1
- package/ui/contexts/pump/index.d.ts.map +1 -1
- package/ui/contexts/pump/pump-provider.d.ts +9 -2
- package/ui/contexts/pump/pump-provider.d.ts.map +1 -1
- package/ui/hooks/assembly/index.d.ts.map +1 -1
- package/ui/hooks/assembly/use-assembly.d.ts +5 -2
- package/ui/hooks/assembly/use-assembly.d.ts.map +1 -1
- package/ui/hooks/assembly/with-assembly.d.ts +4 -1
- package/ui/hooks/assembly/with-assembly.d.ts.map +1 -1
- package/ui/hooks/availability/index.d.ts.map +1 -1
- package/ui/hooks/availability/use-availability.d.ts +5 -2
- package/ui/hooks/availability/use-availability.d.ts.map +1 -1
- package/ui/hooks/availability/with-availability.d.ts +0 -1
- package/ui/hooks/availability/with-availability.d.ts.map +1 -1
- package/ui/hooks/board/index.d.ts.map +1 -1
- package/ui/hooks/board/use-board.d.ts +5 -2
- package/ui/hooks/board/use-board.d.ts.map +1 -1
- package/ui/hooks/board/with-board.d.ts +4 -1
- package/ui/hooks/board/with-board.d.ts.map +1 -1
- package/ui/hooks/board-container/index.d.ts.map +1 -1
- package/ui/hooks/board-container/use-board-container.d.ts +5 -2
- package/ui/hooks/board-container/use-board-container.d.ts.map +1 -1
- package/ui/hooks/board-container/with-board-container.d.ts +4 -1
- package/ui/hooks/board-container/with-board-container.d.ts.map +1 -1
- package/ui/hooks/cui-kit/dispense-topics.d.ts +0 -1
- package/ui/hooks/cui-kit/dispense-topics.d.ts.map +1 -1
- package/ui/hooks/cui-kit/index.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts +0 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-beverages.d.ts +1 -2
- package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts +1 -2
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +51 -7
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +16 -44
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +0 -1
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts +0 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-flavors.d.ts +1 -2
- package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
- package/ui/hooks/device-assembly/index.d.ts.map +1 -1
- package/ui/hooks/device-assembly/use-device-assembly.d.ts +5 -2
- package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts +4 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -1
- package/ui/hooks/generic-pour/index.d.ts.map +1 -1
- package/ui/hooks/generic-pour/use-generic-pour.d.ts +6 -3
- package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
- package/ui/hooks/generic-pour/with-generic-pour.d.ts +5 -2
- package/ui/hooks/generic-pour/with-generic-pour.d.ts.map +1 -1
- package/ui/hooks/holder/index.d.ts.map +1 -1
- package/ui/hooks/holder/use-holder.d.ts +5 -2
- package/ui/hooks/holder/use-holder.d.ts.map +1 -1
- package/ui/hooks/holder/with-holder.d.ts +4 -1
- package/ui/hooks/holder/with-holder.d.ts.map +1 -1
- package/ui/hooks/holder-container/index.d.ts.map +1 -1
- package/ui/hooks/holder-container/use-holder-container.d.ts +7 -4
- package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts +4 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -1
- package/ui/hooks/index.d.ts.map +1 -1
- package/ui/hooks/ingredient/index.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +16 -22
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient.d.ts +5 -2
- package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts +4 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/index.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +5 -2
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +4 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/nozzle/index.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-dispense-kit.d.ts +0 -1
- package/ui/hooks/nozzle/use-dispense-kit.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-nozzle.d.ts +5 -2
- package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts +4 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/index.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +16 -22
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
- package/ui/hooks/pour/index.d.ts.map +1 -1
- package/ui/hooks/pour/use-pour.d.ts +11 -23
- package/ui/hooks/pour/use-pour.d.ts.map +1 -1
- package/ui/hooks/pump/index.d.ts.map +1 -1
- package/ui/hooks/pump/use-pump.d.ts +1 -2
- package/ui/hooks/pump/use-pump.d.ts.map +1 -1
- package/ui/hooks/pump/with-pump.d.ts +0 -1
- package/ui/hooks/pump/with-pump.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts +4 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/index.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +11 -2
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts +5 -2
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts +4 -1
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
- package/ui/index.d.ts.map +1 -1
- package/ui/utils/pour-context.d.ts +1 -7
- package/ui/utils/pour-context.d.ts.map +1 -1
- package/ui.cjs +3 -7
- package/ui.cjs.map +1 -1
- package/ui.d.ts +1 -0
- package/ui.js +64 -68
- package/ui.js.map +1 -1
- package/dispense-registration-manager-C4XZ_c3x.js.map +0 -1
- package/dispense-registration-manager-ukk4OBeX.cjs.map +0 -1
- package/extension-utils-CMVLCSA8.cjs.map +0 -1
- package/extension-utils-FxS68Xu9.js.map +0 -1
- package/kos-models.json +0 -180
- package/pump-provider-9rUgev7q.js.map +0 -1
- package/pump-provider-BAQXIUuP.cjs.map +0 -1
package/{dispense-registration-manager-C4XZ_c3x.js → dispense-registration-manager-DtN0T_JG.js}
RENAMED
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { createExtensionSchema, extensionPointId, defineExtensionPoint, createViewAwareTransform, validateWithSchema } from "@kosdev-code/kos-ui-plugin/utilities";
|
|
8
|
-
import { kosModel, Kos, isKosModel, resolveServiceUrl, ServiceFactory, KosLog, KosModelContainer, KosExtensionUtils, kosChild, FetchError, ExtensionManager, EXTENSION_TROUBLE_MAPPER, EXTENSION_TROUBLE_DATA_MAPPER, getKosModelSync, kosDependency, kosTroubleAware, kosAction, kosTopicHandler, DependencyLifecycle, getKosModel, FutureManager, kosFuture, FutureHandler, EXTENSION_FEATURE_FLAG_RESOLVER, isKosDataModel, ChildModels, KosFeatureFlags, kosParentAware, createPropKey, kosStateEntry, kosStateExit, kosStateGuard, kosLoggerAware, kosStateMachine, MultipleFutureHandler, arraysEqual, getAllKosCompanionModels, EventBus, KosContextManager, destroyKosModel, SingletonKosModelRegistrationFactory, kosFutureAware, ObservableData, KosModelRegistrationFactory, KosModelRegistry as KosModelRegistry$1, RegistrationManager, registerCoreModels, registerLegacyModel } from "@kosdev-code/kos-ui-sdk";
|
|
1
|
+
import { kosModel, Kos, isKosModel, resolveServiceUrl, ServiceFactory, KosLog, LogGroup, KosModelContainer, KosExtensionUtils, kosChild, FetchError, ExtensionManager, EXTENSION_TROUBLE_MAPPER, EXTENSION_TROUBLE_DATA_MAPPER, getKosModelSync, kosDependency, kosTroubleAware, kosAction, kosTopicHandler, DependencyLifecycle, getKosModel, FutureManager, kosFuture, FutureHandler, EXTENSION_FEATURE_FLAG_RESOLVER, isKosDataModel, ChildModels, KosFeatureFlags, kosParentAware, createPropKey, kosStateEntry, kosStateExit, kosStateGuard, kosLoggerAware, kosStateMachine, MultipleFutureHandler, arraysEqual, getAllKosCompanionModels, EventBus, KosContextManager, destroyKosModel, kosModelEffect, getKosCompanionModel, SingletonKosModelRegistrationFactory, kosFutureAware, ObservableData, KosModelRegistrationFactory, KosModelRegistry as KosModelRegistry$1, RegistrationManager, registerCoreModels, registerLegacyModel } from "@kosdev-code/kos-ui-sdk";
|
|
9
2
|
import "react";
|
|
10
|
-
const ControlPourSchema = createExtensionSchema({}, { rankable: false });
|
|
11
|
-
const EXTENSION_ID = extensionPointId("cui", "control", "pour");
|
|
12
|
-
const ControlPourExtension = defineExtensionPoint({
|
|
13
|
-
id: EXTENSION_ID,
|
|
14
|
-
contributionKey: "controlPour",
|
|
15
|
-
displayName: "Control Pour",
|
|
16
|
-
description: "Extension point for controlled pour plugin configurations with view support",
|
|
17
|
-
hasView: true,
|
|
18
|
-
isRankable: false,
|
|
19
|
-
schema: ControlPourSchema,
|
|
20
|
-
metadata: {
|
|
21
|
-
exportName: "ControlPourExtension",
|
|
22
|
-
category: "Dispense",
|
|
23
|
-
tags: ["pour", "control", "beverage"]
|
|
24
|
-
},
|
|
25
|
-
validate: (data, context) => {
|
|
26
|
-
validateWithSchema(ControlPourSchema, data, context);
|
|
27
|
-
},
|
|
28
|
-
transform: createViewAwareTransform()
|
|
29
|
-
});
|
|
30
|
-
const EXTENSION_POINT_CONTROL_POUR = EXTENSION_ID;
|
|
31
3
|
var ExtensionType = /* @__PURE__ */ ((ExtensionType2) => {
|
|
32
4
|
ExtensionType2["IngredientLoader"] = "kos.ingredient.loader";
|
|
33
5
|
ExtensionType2["IngredientMapper"] = "kos.ingredient.mapper";
|
|
@@ -58,16 +30,21 @@ var DispenseModelType = /* @__PURE__ */ ((DispenseModelType2) => {
|
|
|
58
30
|
DispenseModelType2["PumpContainer"] = "pump-container-model";
|
|
59
31
|
return DispenseModelType2;
|
|
60
32
|
})(DispenseModelType || {});
|
|
61
|
-
var __getOwnPropDesc$
|
|
62
|
-
var __decorateClass$
|
|
63
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
33
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
34
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
35
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
64
36
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
65
37
|
if (decorator = decorators[i])
|
|
66
38
|
result = decorator(result) || result;
|
|
67
39
|
return result;
|
|
68
40
|
};
|
|
69
|
-
const MODEL_TYPE$
|
|
41
|
+
const MODEL_TYPE$d = "ingredient-model";
|
|
70
42
|
let IngredientModelImpl = class {
|
|
43
|
+
id;
|
|
44
|
+
ingredientId;
|
|
45
|
+
name;
|
|
46
|
+
type;
|
|
47
|
+
data;
|
|
71
48
|
constructor(modelId, {
|
|
72
49
|
name,
|
|
73
50
|
type,
|
|
@@ -75,11 +52,6 @@ let IngredientModelImpl = class {
|
|
|
75
52
|
ingredientId,
|
|
76
53
|
...rest
|
|
77
54
|
}) {
|
|
78
|
-
__publicField(this, "id");
|
|
79
|
-
__publicField(this, "ingredientId");
|
|
80
|
-
__publicField(this, "name");
|
|
81
|
-
__publicField(this, "type");
|
|
82
|
-
__publicField(this, "data");
|
|
83
55
|
this.id = modelId;
|
|
84
56
|
this.ingredientId = ingredientId;
|
|
85
57
|
this.name = name;
|
|
@@ -103,19 +75,19 @@ let IngredientModelImpl = class {
|
|
|
103
75
|
// -------------------LIFECYCLE----------------------------
|
|
104
76
|
// -------------------ENTITY----------------------------
|
|
105
77
|
};
|
|
106
|
-
IngredientModelImpl = __decorateClass$
|
|
107
|
-
kosModel(MODEL_TYPE$
|
|
78
|
+
IngredientModelImpl = __decorateClass$d([
|
|
79
|
+
kosModel(MODEL_TYPE$d)
|
|
108
80
|
], IngredientModelImpl);
|
|
109
81
|
const Ingredient = {
|
|
110
82
|
registration: {
|
|
111
|
-
[MODEL_TYPE$
|
|
83
|
+
[MODEL_TYPE$d]: {
|
|
112
84
|
class: IngredientModelImpl,
|
|
113
85
|
singleton: false
|
|
114
86
|
}
|
|
115
87
|
},
|
|
116
|
-
type: MODEL_TYPE$
|
|
117
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
118
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
88
|
+
type: MODEL_TYPE$d,
|
|
89
|
+
predicate: isKosModel(MODEL_TYPE$d),
|
|
90
|
+
factory: Kos.Factory.create(MODEL_TYPE$d)
|
|
119
91
|
};
|
|
120
92
|
const { URL: URL$6 } = resolveServiceUrl("INGREDIENT_SERVICE");
|
|
121
93
|
const { getOne: getOne$3 } = ServiceFactory.build({
|
|
@@ -127,23 +99,25 @@ const getIngredients = async () => {
|
|
|
127
99
|
});
|
|
128
100
|
return response;
|
|
129
101
|
};
|
|
130
|
-
var __defProp$
|
|
131
|
-
var __getOwnPropDesc$
|
|
132
|
-
var __decorateClass$
|
|
133
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
102
|
+
var __defProp$a = Object.defineProperty;
|
|
103
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
104
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
105
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
134
106
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
135
107
|
if (decorator = decorators[i])
|
|
136
108
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
137
|
-
if (kind && result)
|
|
138
|
-
__defProp$9(target, key, result);
|
|
109
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
139
110
|
return result;
|
|
140
111
|
};
|
|
141
|
-
const MODEL_TYPE$
|
|
142
|
-
const log$
|
|
112
|
+
const MODEL_TYPE$c = "ingredient-container-model";
|
|
113
|
+
const log$4 = KosLog.createLogger({
|
|
114
|
+
group: LogGroup.model,
|
|
115
|
+
name: "ingredient-container-model"
|
|
116
|
+
});
|
|
143
117
|
let IngredientContainerModelImpl = class {
|
|
118
|
+
id;
|
|
119
|
+
ingredients;
|
|
144
120
|
constructor(modelId, options) {
|
|
145
|
-
__publicField(this, "id");
|
|
146
|
-
__publicField(this, "ingredients");
|
|
147
121
|
this.id = modelId;
|
|
148
122
|
this.ingredients = new KosModelContainer({
|
|
149
123
|
indexMap: {
|
|
@@ -160,19 +134,18 @@ let IngredientContainerModelImpl = class {
|
|
|
160
134
|
return this.ingredients.getIndexByKey("ingredientType", type);
|
|
161
135
|
}
|
|
162
136
|
async load(context) {
|
|
163
|
-
|
|
164
|
-
log$3.debug(`loading ingredient container ${this.id}`);
|
|
137
|
+
log$4.debug(`loading ingredient container ${this.id}`);
|
|
165
138
|
const allIngredients = await getIngredients();
|
|
166
|
-
if (
|
|
139
|
+
if (allIngredients?.status !== 200) {
|
|
167
140
|
throw new Error("Failed to load ingredients");
|
|
168
141
|
}
|
|
169
142
|
const ingredientContext = await KosExtensionUtils.executeLoaderExtension({
|
|
170
143
|
context,
|
|
171
144
|
extension: ExtensionType.IngredientLoader
|
|
172
145
|
});
|
|
173
|
-
const ingredientData =
|
|
146
|
+
const ingredientData = allIngredients?.data ?? {};
|
|
174
147
|
for (const key of Object.keys(ingredientData)) {
|
|
175
|
-
for (const ingredientData2 of
|
|
148
|
+
for (const ingredientData2 of allIngredients?.data?.[key] || []) {
|
|
176
149
|
const data = await KosExtensionUtils.executeDataMapperExtension({
|
|
177
150
|
extension: ExtensionType.IngredientMapper,
|
|
178
151
|
data: ingredientData2,
|
|
@@ -198,30 +171,30 @@ let IngredientContainerModelImpl = class {
|
|
|
198
171
|
}
|
|
199
172
|
// -------------------ENTITY----------------------------
|
|
200
173
|
};
|
|
201
|
-
__decorateClass$
|
|
174
|
+
__decorateClass$c([
|
|
202
175
|
kosChild
|
|
203
176
|
], IngredientContainerModelImpl.prototype, "ingredients", 2);
|
|
204
|
-
IngredientContainerModelImpl = __decorateClass$
|
|
205
|
-
kosModel(MODEL_TYPE$
|
|
177
|
+
IngredientContainerModelImpl = __decorateClass$c([
|
|
178
|
+
kosModel(MODEL_TYPE$c)
|
|
206
179
|
], IngredientContainerModelImpl);
|
|
207
180
|
const IngredientContainer = {
|
|
208
181
|
registration: {
|
|
209
|
-
[MODEL_TYPE$
|
|
182
|
+
[MODEL_TYPE$c]: {
|
|
210
183
|
class: IngredientContainerModelImpl,
|
|
211
184
|
singleton: true
|
|
212
185
|
}
|
|
213
186
|
},
|
|
214
|
-
type: MODEL_TYPE$
|
|
215
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
216
|
-
factory: Kos.Singleton.create(MODEL_TYPE$
|
|
187
|
+
type: MODEL_TYPE$c,
|
|
188
|
+
predicate: isKosModel(MODEL_TYPE$c),
|
|
189
|
+
factory: Kos.Singleton.create(MODEL_TYPE$c)
|
|
217
190
|
};
|
|
218
191
|
const { URL: URL$5 } = resolveServiceUrl("HOLDER_SERVICE");
|
|
219
192
|
const { getAll: getAll$1, postModel: postModel$4, deleteModel: deleteModel$2 } = ServiceFactory.build({
|
|
220
193
|
basePath: `${URL$5}/api/kos/holders`
|
|
221
194
|
});
|
|
222
|
-
const log$
|
|
223
|
-
|
|
224
|
-
|
|
195
|
+
const log$3 = KosLog.createLogger({
|
|
196
|
+
group: LogGroup.service,
|
|
197
|
+
name: "holder-service"
|
|
225
198
|
});
|
|
226
199
|
const getHolders = async () => {
|
|
227
200
|
const response = await getAll$1({});
|
|
@@ -248,9 +221,8 @@ const unassignHolderIngredient = async (holderPath) => {
|
|
|
248
221
|
return response;
|
|
249
222
|
};
|
|
250
223
|
const replaceLine = async (holderPath) => {
|
|
251
|
-
if (!holderPath)
|
|
252
|
-
|
|
253
|
-
log$2.debug(
|
|
224
|
+
if (!holderPath) throw new Error("Missing holderPath");
|
|
225
|
+
log$3.debug(
|
|
254
226
|
`sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${holderPath}`
|
|
255
227
|
);
|
|
256
228
|
const response = await postModel$4({
|
|
@@ -270,7 +242,6 @@ const getAssignments = async () => {
|
|
|
270
242
|
return response;
|
|
271
243
|
};
|
|
272
244
|
const sendRfidOverride = async (holderPath, overrides) => {
|
|
273
|
-
var _a, _b, _c, _d;
|
|
274
245
|
const factoryJson = JSON.stringify(overrides);
|
|
275
246
|
const url = `${URL$4}/api/ext/dispense/assignments`;
|
|
276
247
|
try {
|
|
@@ -278,15 +249,15 @@ const sendRfidOverride = async (holderPath, overrides) => {
|
|
|
278
249
|
model: { holderPath, factoryJson },
|
|
279
250
|
urlOverride: url
|
|
280
251
|
});
|
|
281
|
-
if (
|
|
252
|
+
if (response?.status === 200 && response?.data?.error) {
|
|
282
253
|
return [response.data.error || "unknownError", response.data];
|
|
283
254
|
}
|
|
284
|
-
return [void 0, response
|
|
255
|
+
return [void 0, response?.data];
|
|
285
256
|
} catch (error) {
|
|
286
257
|
if (error instanceof FetchError) {
|
|
287
258
|
return [
|
|
288
|
-
|
|
289
|
-
|
|
259
|
+
error.payload?.data?.error || "unknownError",
|
|
260
|
+
error.payload?.data
|
|
290
261
|
];
|
|
291
262
|
}
|
|
292
263
|
}
|
|
@@ -305,19 +276,21 @@ const deleteAssignment = async (id) => {
|
|
|
305
276
|
const response = await deleteModel$1({ id, fos: useFos });
|
|
306
277
|
return response;
|
|
307
278
|
};
|
|
308
|
-
var __defProp$
|
|
309
|
-
var __getOwnPropDesc$
|
|
310
|
-
var __decorateClass$
|
|
311
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
279
|
+
var __defProp$9 = Object.defineProperty;
|
|
280
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
281
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
282
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
312
283
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
313
284
|
if (decorator = decorators[i])
|
|
314
285
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
315
|
-
if (kind && result)
|
|
316
|
-
__defProp$8(target, key, result);
|
|
286
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
317
287
|
return result;
|
|
318
288
|
};
|
|
319
|
-
const MODEL_TYPE$
|
|
320
|
-
const log$
|
|
289
|
+
const MODEL_TYPE$b = DispenseModelType.Holder;
|
|
290
|
+
const log$2 = KosLog.createLogger({
|
|
291
|
+
group: LogGroup.model,
|
|
292
|
+
name: "holder-model"
|
|
293
|
+
});
|
|
321
294
|
ExtensionManager[EXTENSION_TROUBLE_MAPPER].register(
|
|
322
295
|
"holder",
|
|
323
296
|
async (trouble) => {
|
|
@@ -337,7 +310,7 @@ ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
|
337
310
|
const ingredientModel = pumpModel.ingredientId ? getKosModelSync(pumpModel.ingredientId).model : void 0;
|
|
338
311
|
return {
|
|
339
312
|
ingredientId: pumpModel.ingredientId,
|
|
340
|
-
ingredientName:
|
|
313
|
+
ingredientName: ingredientModel?.displayName ?? (ingredientModel?.name || ""),
|
|
341
314
|
childPumpName: pumpModel.name
|
|
342
315
|
};
|
|
343
316
|
}
|
|
@@ -364,7 +337,7 @@ ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
|
364
337
|
const ingredientId = trouble.data.ingredients[0];
|
|
365
338
|
const { model } = getKosModelSync(ingredientId);
|
|
366
339
|
return {
|
|
367
|
-
ingredientName:
|
|
340
|
+
ingredientName: model?.displayName ?? (model?.name || ""),
|
|
368
341
|
ingredients: trouble.data.ingredients ? trouble.data.ingredients : [],
|
|
369
342
|
unknonwnIngredientId: trouble.data.unknonwnIngredientId ?? ""
|
|
370
343
|
};
|
|
@@ -373,14 +346,28 @@ ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
|
373
346
|
}
|
|
374
347
|
);
|
|
375
348
|
class AssignmentError extends Error {
|
|
349
|
+
type;
|
|
376
350
|
constructor(type, message) {
|
|
377
351
|
super(message);
|
|
378
|
-
__publicField(this, "type");
|
|
379
352
|
this.name = "AssignmentError";
|
|
380
353
|
this.type = type;
|
|
381
354
|
}
|
|
382
355
|
}
|
|
383
356
|
let HolderModelImpl = class {
|
|
357
|
+
id;
|
|
358
|
+
path;
|
|
359
|
+
name;
|
|
360
|
+
ingredientId;
|
|
361
|
+
ingredientType;
|
|
362
|
+
ingredientSource;
|
|
363
|
+
group;
|
|
364
|
+
slice;
|
|
365
|
+
logger;
|
|
366
|
+
data;
|
|
367
|
+
enjoyByDate;
|
|
368
|
+
attributes;
|
|
369
|
+
pumps;
|
|
370
|
+
ingredientContainer;
|
|
384
371
|
constructor(modelId, {
|
|
385
372
|
path,
|
|
386
373
|
name,
|
|
@@ -393,20 +380,6 @@ let HolderModelImpl = class {
|
|
|
393
380
|
enjoyByDate,
|
|
394
381
|
attributes
|
|
395
382
|
}, context) {
|
|
396
|
-
__publicField(this, "id");
|
|
397
|
-
__publicField(this, "path");
|
|
398
|
-
__publicField(this, "name");
|
|
399
|
-
__publicField(this, "ingredientId");
|
|
400
|
-
__publicField(this, "ingredientType");
|
|
401
|
-
__publicField(this, "ingredientSource");
|
|
402
|
-
__publicField(this, "group");
|
|
403
|
-
__publicField(this, "slice");
|
|
404
|
-
__publicField(this, "logger");
|
|
405
|
-
__publicField(this, "data");
|
|
406
|
-
__publicField(this, "enjoyByDate");
|
|
407
|
-
__publicField(this, "attributes");
|
|
408
|
-
__publicField(this, "pumps");
|
|
409
|
-
__publicField(this, "ingredientContainer");
|
|
410
383
|
this.id = modelId;
|
|
411
384
|
this.path = path;
|
|
412
385
|
this.name = name;
|
|
@@ -449,8 +422,7 @@ let HolderModelImpl = class {
|
|
|
449
422
|
return !!this.enjoyByDate && !this.unassigned;
|
|
450
423
|
}
|
|
451
424
|
get hasEnjoyByWarning() {
|
|
452
|
-
|
|
453
|
-
return ((_a = this.troublesByType["EnjoyByTrouble"]) == null ? void 0 : _a.length) > 0;
|
|
425
|
+
return this.troublesByType["EnjoyByTrouble"]?.length > 0;
|
|
454
426
|
}
|
|
455
427
|
get nozzlePaths() {
|
|
456
428
|
return this.pumps.data.map((pump) => pump.nozzlePath);
|
|
@@ -472,7 +444,7 @@ let HolderModelImpl = class {
|
|
|
472
444
|
const intent = typeof props === "string" ? props : props.intent;
|
|
473
445
|
const pumpPath = typeof props === "string" ? void 0 : props.pumpPath;
|
|
474
446
|
const pump = pumpPath ? this.pumps.getModel(pumpPath) : this.pumps.data[0];
|
|
475
|
-
return pump
|
|
447
|
+
return pump?.performIntent({ intent });
|
|
476
448
|
}
|
|
477
449
|
get pourState() {
|
|
478
450
|
const state = this.pumps.data.reduce((resolvedState, pump) => {
|
|
@@ -484,8 +456,7 @@ let HolderModelImpl = class {
|
|
|
484
456
|
return state;
|
|
485
457
|
}
|
|
486
458
|
get nozzlePath() {
|
|
487
|
-
|
|
488
|
-
return (_a = this.pumps.data[0]) == null ? void 0 : _a.nozzlePath;
|
|
459
|
+
return this.pumps.data[0]?.nozzlePath;
|
|
489
460
|
}
|
|
490
461
|
get pumpPaths() {
|
|
491
462
|
return this.pumps.data.map((pump) => pump.id);
|
|
@@ -502,11 +473,10 @@ let HolderModelImpl = class {
|
|
|
502
473
|
});
|
|
503
474
|
}
|
|
504
475
|
get ingredient() {
|
|
505
|
-
var _a;
|
|
506
476
|
if (!this.ingredientId) {
|
|
507
477
|
return void 0;
|
|
508
478
|
}
|
|
509
|
-
const ingredient =
|
|
479
|
+
const ingredient = this.ingredientContainer?.ingredients.getModel(
|
|
510
480
|
this.ingredientId
|
|
511
481
|
);
|
|
512
482
|
return ingredient;
|
|
@@ -521,11 +491,10 @@ let HolderModelImpl = class {
|
|
|
521
491
|
}
|
|
522
492
|
}
|
|
523
493
|
get previousIngredient() {
|
|
524
|
-
var _a;
|
|
525
494
|
if (!this.prevIngredientId) {
|
|
526
495
|
return void 0;
|
|
527
496
|
}
|
|
528
|
-
const ingredient =
|
|
497
|
+
const ingredient = this.ingredientContainer?.ingredients.getModel(
|
|
529
498
|
this.prevIngredientId
|
|
530
499
|
);
|
|
531
500
|
return ingredient;
|
|
@@ -540,8 +509,7 @@ let HolderModelImpl = class {
|
|
|
540
509
|
}
|
|
541
510
|
}
|
|
542
511
|
get prevIngredientId() {
|
|
543
|
-
|
|
544
|
-
return (_b = (_a = this.pumps.data) == null ? void 0 : _a[0]) == null ? void 0 : _b.prevIngredientId;
|
|
512
|
+
return this.pumps.data?.[0]?.prevIngredientId;
|
|
545
513
|
}
|
|
546
514
|
get unassigned() {
|
|
547
515
|
return (!this.ingredientId || this.ingredientId === "0") && (!this.prevIngredientId || this.prevIngredientId === "0");
|
|
@@ -595,11 +563,11 @@ let HolderModelImpl = class {
|
|
|
595
563
|
);
|
|
596
564
|
}
|
|
597
565
|
kosAction(() => {
|
|
598
|
-
this.ingredientId = result
|
|
566
|
+
this.ingredientId = result?.ingredientId;
|
|
599
567
|
});
|
|
600
568
|
return result;
|
|
601
569
|
} catch (e) {
|
|
602
|
-
log$
|
|
570
|
+
log$2.error(`Failed to perform rfid override on holder ${this.id}`, e);
|
|
603
571
|
throw e;
|
|
604
572
|
}
|
|
605
573
|
}
|
|
@@ -614,7 +582,7 @@ let HolderModelImpl = class {
|
|
|
614
582
|
this.ingredientId = ingredientId;
|
|
615
583
|
});
|
|
616
584
|
} catch (e) {
|
|
617
|
-
log$
|
|
585
|
+
log$2.error(`Failed to perform assign ingredient to holder ${this.id}`, e);
|
|
618
586
|
throw e;
|
|
619
587
|
}
|
|
620
588
|
}
|
|
@@ -648,29 +616,28 @@ let HolderModelImpl = class {
|
|
|
648
616
|
// }
|
|
649
617
|
// -------------------ENTITY----------------------------
|
|
650
618
|
};
|
|
651
|
-
__decorateClass$
|
|
619
|
+
__decorateClass$b([
|
|
652
620
|
kosChild
|
|
653
621
|
], HolderModelImpl.prototype, "pumps", 2);
|
|
654
|
-
__decorateClass$
|
|
622
|
+
__decorateClass$b([
|
|
655
623
|
kosDependency({ modelType: IngredientContainer.type })
|
|
656
624
|
], HolderModelImpl.prototype, "ingredientContainer", 2);
|
|
657
|
-
HolderModelImpl = __decorateClass$
|
|
658
|
-
kosModel(MODEL_TYPE$
|
|
625
|
+
HolderModelImpl = __decorateClass$b([
|
|
626
|
+
kosModel(MODEL_TYPE$b),
|
|
659
627
|
kosTroubleAware()
|
|
660
628
|
], HolderModelImpl);
|
|
661
629
|
const Holder = {
|
|
662
630
|
registration: {
|
|
663
|
-
[MODEL_TYPE$
|
|
631
|
+
[MODEL_TYPE$b]: {
|
|
664
632
|
class: HolderModelImpl,
|
|
665
633
|
singleton: false
|
|
666
634
|
}
|
|
667
635
|
},
|
|
668
|
-
type: MODEL_TYPE$
|
|
669
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
670
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
636
|
+
type: MODEL_TYPE$b,
|
|
637
|
+
predicate: isKosModel(MODEL_TYPE$b),
|
|
638
|
+
factory: Kos.Factory.create(MODEL_TYPE$b)
|
|
671
639
|
};
|
|
672
640
|
const mapAssemblyHolderToModel = async (group, holderData) => {
|
|
673
|
-
var _a;
|
|
674
641
|
const _ingredientId = ExtensionManager.propertyMapper.executeMapper(
|
|
675
642
|
ExtensionType.HolderIngredientMapper,
|
|
676
643
|
holderData
|
|
@@ -702,7 +669,7 @@ const mapAssemblyHolderToModel = async (group, holderData) => {
|
|
|
702
669
|
ingredientId: _ingredientId || ingredientId,
|
|
703
670
|
ingredientType: type || ingType,
|
|
704
671
|
ingredientSource: ingSource,
|
|
705
|
-
enjoyByDate:
|
|
672
|
+
enjoyByDate: holderData.container?.enjoyByDate ? new Date(holderData.container.enjoyByDate) : void 0,
|
|
706
673
|
slice: sliceData,
|
|
707
674
|
group,
|
|
708
675
|
attributes,
|
|
@@ -715,34 +682,33 @@ const { URL: URL$3 } = resolveServiceUrl("ASSEMBLY_SERVICE");
|
|
|
715
682
|
const { getOne: getOne$2 } = ServiceFactory.build({
|
|
716
683
|
basePath: `${URL$3}/api/kos/device/assemblies`
|
|
717
684
|
});
|
|
718
|
-
const log = KosLog.createLogger({
|
|
719
|
-
|
|
720
|
-
|
|
685
|
+
const log$1 = KosLog.createLogger({
|
|
686
|
+
group: LogGroup.service,
|
|
687
|
+
name: "assembly-service"
|
|
721
688
|
});
|
|
722
689
|
const getAssembly = async () => {
|
|
723
|
-
log.debug("sending GET for assembly");
|
|
690
|
+
log$1.debug("sending GET for assembly");
|
|
724
691
|
const response = await getOne$2({});
|
|
725
692
|
return response;
|
|
726
693
|
};
|
|
727
|
-
var __defProp$
|
|
728
|
-
var __getOwnPropDesc$
|
|
729
|
-
var __decorateClass$
|
|
730
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
694
|
+
var __defProp$8 = Object.defineProperty;
|
|
695
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
696
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
697
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
731
698
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
732
699
|
if (decorator = decorators[i])
|
|
733
700
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
734
|
-
if (kind && result)
|
|
735
|
-
__defProp$7(target, key, result);
|
|
701
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
736
702
|
return result;
|
|
737
703
|
};
|
|
738
|
-
const MODEL_TYPE$
|
|
704
|
+
const MODEL_TYPE$a = "board-container-model";
|
|
739
705
|
const TOPIC_BOARD_LINKED = "/kos/hardware/board/linked";
|
|
740
706
|
const TOPIC_BOARD_UNLINKED = "/kos/hardware/board/unlinked";
|
|
741
707
|
let BoardContainerModel = class {
|
|
708
|
+
id;
|
|
709
|
+
logger;
|
|
710
|
+
models;
|
|
742
711
|
constructor(modelId, options, context) {
|
|
743
|
-
__publicField(this, "id");
|
|
744
|
-
__publicField(this, "logger");
|
|
745
|
-
__publicField(this, "models");
|
|
746
712
|
this.id = modelId;
|
|
747
713
|
this.logger = context.logger;
|
|
748
714
|
this.models = new KosModelContainer({
|
|
@@ -789,45 +755,44 @@ let BoardContainerModel = class {
|
|
|
789
755
|
}
|
|
790
756
|
}
|
|
791
757
|
};
|
|
792
|
-
__decorateClass$
|
|
758
|
+
__decorateClass$a([
|
|
793
759
|
kosChild
|
|
794
760
|
], BoardContainerModel.prototype, "models", 2);
|
|
795
|
-
__decorateClass$
|
|
761
|
+
__decorateClass$a([
|
|
796
762
|
kosTopicHandler({
|
|
797
763
|
lifecycle: DependencyLifecycle.INIT,
|
|
798
764
|
topic: TOPIC_BOARD_LINKED,
|
|
799
765
|
websocket: true
|
|
800
766
|
})
|
|
801
767
|
], BoardContainerModel.prototype, "handleBoardLinkEvent", 1);
|
|
802
|
-
__decorateClass$
|
|
768
|
+
__decorateClass$a([
|
|
803
769
|
kosTopicHandler({
|
|
804
770
|
lifecycle: DependencyLifecycle.INIT,
|
|
805
771
|
topic: TOPIC_BOARD_UNLINKED,
|
|
806
772
|
websocket: true
|
|
807
773
|
})
|
|
808
774
|
], BoardContainerModel.prototype, "handleBoardUnlinkEvent", 1);
|
|
809
|
-
BoardContainerModel = __decorateClass$
|
|
810
|
-
kosModel(MODEL_TYPE$
|
|
775
|
+
BoardContainerModel = __decorateClass$a([
|
|
776
|
+
kosModel(MODEL_TYPE$a)
|
|
811
777
|
], BoardContainerModel);
|
|
812
778
|
const boardTroubleDataMapper = async (trouble) => {
|
|
813
779
|
const boardPath = trouble.data.boardPath;
|
|
814
780
|
const { model } = getKosModelSync(boardPath);
|
|
815
781
|
return {
|
|
816
|
-
boardName:
|
|
782
|
+
boardName: model?.name || ""
|
|
817
783
|
};
|
|
818
784
|
};
|
|
819
|
-
var __defProp$
|
|
820
|
-
var __getOwnPropDesc$
|
|
821
|
-
var __decorateClass$
|
|
822
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
785
|
+
var __defProp$7 = Object.defineProperty;
|
|
786
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
787
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
788
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
823
789
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
824
790
|
if (decorator = decorators[i])
|
|
825
791
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
826
|
-
if (kind && result)
|
|
827
|
-
__defProp$6(target, key, result);
|
|
792
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
828
793
|
return result;
|
|
829
794
|
};
|
|
830
|
-
const MODEL_TYPE$
|
|
795
|
+
const MODEL_TYPE$9 = DispenseModelType.PumpContainer;
|
|
831
796
|
var PumpIndex = /* @__PURE__ */ ((PumpIndex2) => {
|
|
832
797
|
PumpIndex2["byBoard"] = "byBoard";
|
|
833
798
|
PumpIndex2["byType"] = "byType";
|
|
@@ -835,9 +800,9 @@ var PumpIndex = /* @__PURE__ */ ((PumpIndex2) => {
|
|
|
835
800
|
return PumpIndex2;
|
|
836
801
|
})(PumpIndex || {});
|
|
837
802
|
let PumpContainerModelImpl = class {
|
|
803
|
+
id;
|
|
804
|
+
pumps;
|
|
838
805
|
constructor(modelId, options) {
|
|
839
|
-
__publicField(this, "id");
|
|
840
|
-
__publicField(this, "pumps");
|
|
841
806
|
this.id = modelId;
|
|
842
807
|
this.pumps = new KosModelContainer({
|
|
843
808
|
indexMap: {
|
|
@@ -883,23 +848,23 @@ let PumpContainerModelImpl = class {
|
|
|
883
848
|
}
|
|
884
849
|
// -------------------ENTITY----------------------------
|
|
885
850
|
};
|
|
886
|
-
__decorateClass$
|
|
851
|
+
__decorateClass$9([
|
|
887
852
|
kosChild
|
|
888
853
|
], PumpContainerModelImpl.prototype, "pumps", 2);
|
|
889
|
-
PumpContainerModelImpl = __decorateClass$
|
|
890
|
-
kosModel(MODEL_TYPE$
|
|
854
|
+
PumpContainerModelImpl = __decorateClass$9([
|
|
855
|
+
kosModel(MODEL_TYPE$9)
|
|
891
856
|
], PumpContainerModelImpl);
|
|
892
857
|
const PumpContainer = {
|
|
893
858
|
registration: {
|
|
894
|
-
[MODEL_TYPE$
|
|
859
|
+
[MODEL_TYPE$9]: {
|
|
895
860
|
class: PumpContainerModelImpl,
|
|
896
861
|
singleton: true
|
|
897
862
|
}
|
|
898
863
|
},
|
|
899
|
-
type: MODEL_TYPE$
|
|
900
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
864
|
+
type: MODEL_TYPE$9,
|
|
865
|
+
predicate: isKosModel(MODEL_TYPE$9),
|
|
901
866
|
factory: Kos.Singleton.create(
|
|
902
|
-
MODEL_TYPE$
|
|
867
|
+
MODEL_TYPE$9
|
|
903
868
|
)
|
|
904
869
|
};
|
|
905
870
|
const getPumpRelatedPaths = async (pumpPath) => {
|
|
@@ -926,7 +891,7 @@ const boardTroubleResolver = async (trouble) => {
|
|
|
926
891
|
const pumpContainer = await getKosModel(
|
|
927
892
|
PumpContainer.type
|
|
928
893
|
);
|
|
929
|
-
if (pumpContainer
|
|
894
|
+
if (pumpContainer?.model) {
|
|
930
895
|
const boardPumps = pumpContainer.model.models.getIndexByKey(
|
|
931
896
|
PumpIndex.byBoard,
|
|
932
897
|
boardPath
|
|
@@ -943,15 +908,15 @@ const boardTroubleResolver = async (trouble) => {
|
|
|
943
908
|
}
|
|
944
909
|
return Array.from(new Set(result));
|
|
945
910
|
};
|
|
946
|
-
var __getOwnPropDesc$
|
|
947
|
-
var __decorateClass$
|
|
948
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
911
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
912
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
913
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
949
914
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
950
915
|
if (decorator = decorators[i])
|
|
951
916
|
result = decorator(result) || result;
|
|
952
917
|
return result;
|
|
953
918
|
};
|
|
954
|
-
const MODEL_TYPE$
|
|
919
|
+
const MODEL_TYPE$8 = "board-model";
|
|
955
920
|
const mapOptionsToModel = (options, model) => {
|
|
956
921
|
const { type, name, path, linked, instanceId, link, ...rest } = options;
|
|
957
922
|
model.type = type;
|
|
@@ -971,14 +936,14 @@ ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
|
971
936
|
boardTroubleDataMapper
|
|
972
937
|
);
|
|
973
938
|
let BoardModelImpl = class {
|
|
939
|
+
id;
|
|
940
|
+
type;
|
|
941
|
+
name;
|
|
942
|
+
path;
|
|
943
|
+
linked;
|
|
944
|
+
instanceId;
|
|
945
|
+
logger;
|
|
974
946
|
constructor(modelId, options, context) {
|
|
975
|
-
__publicField(this, "id");
|
|
976
|
-
__publicField(this, "type");
|
|
977
|
-
__publicField(this, "name");
|
|
978
|
-
__publicField(this, "path");
|
|
979
|
-
__publicField(this, "linked");
|
|
980
|
-
__publicField(this, "instanceId");
|
|
981
|
-
__publicField(this, "logger");
|
|
982
947
|
this.id = modelId;
|
|
983
948
|
this.logger = context.logger;
|
|
984
949
|
mapOptionsToModel(options, this);
|
|
@@ -994,46 +959,45 @@ let BoardModelImpl = class {
|
|
|
994
959
|
this.logger.debug(`loading board ${this.id}`);
|
|
995
960
|
}
|
|
996
961
|
};
|
|
997
|
-
BoardModelImpl = __decorateClass$
|
|
998
|
-
kosModel(MODEL_TYPE$
|
|
962
|
+
BoardModelImpl = __decorateClass$8([
|
|
963
|
+
kosModel(MODEL_TYPE$8)
|
|
999
964
|
], BoardModelImpl);
|
|
1000
965
|
const Board = {
|
|
1001
966
|
registration: {
|
|
1002
|
-
[MODEL_TYPE$
|
|
967
|
+
[MODEL_TYPE$8]: {
|
|
1003
968
|
class: BoardModelImpl,
|
|
1004
969
|
singleton: false
|
|
1005
970
|
}
|
|
1006
971
|
},
|
|
1007
|
-
type: MODEL_TYPE$
|
|
1008
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1009
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
972
|
+
type: MODEL_TYPE$8,
|
|
973
|
+
predicate: isKosModel(MODEL_TYPE$8),
|
|
974
|
+
factory: Kos.Factory.create(MODEL_TYPE$8)
|
|
1010
975
|
};
|
|
1011
976
|
const BoardContainer = {
|
|
1012
977
|
registration: {
|
|
1013
|
-
[MODEL_TYPE$
|
|
978
|
+
[MODEL_TYPE$a]: {
|
|
1014
979
|
class: BoardContainerModel,
|
|
1015
980
|
singleton: true
|
|
1016
981
|
},
|
|
1017
982
|
...Board.registration
|
|
1018
983
|
},
|
|
1019
|
-
type: MODEL_TYPE$
|
|
1020
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
984
|
+
type: MODEL_TYPE$a,
|
|
985
|
+
predicate: isKosModel(MODEL_TYPE$a),
|
|
1021
986
|
factory: Kos.Singleton.create(
|
|
1022
|
-
MODEL_TYPE$
|
|
987
|
+
MODEL_TYPE$a
|
|
1023
988
|
)
|
|
1024
989
|
};
|
|
1025
|
-
var __defProp$
|
|
1026
|
-
var __getOwnPropDesc$
|
|
1027
|
-
var __decorateClass$
|
|
1028
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
990
|
+
var __defProp$6 = Object.defineProperty;
|
|
991
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
992
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
993
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
1029
994
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1030
995
|
if (decorator = decorators[i])
|
|
1031
996
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1032
|
-
if (kind && result)
|
|
1033
|
-
__defProp$5(target, key, result);
|
|
997
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
1034
998
|
return result;
|
|
1035
999
|
};
|
|
1036
|
-
const MODEL_TYPE$
|
|
1000
|
+
const MODEL_TYPE$7 = DispenseModelType.HolderContainer;
|
|
1037
1001
|
const TOPIC_INSERT_START = "/kos/insertion/insert/start";
|
|
1038
1002
|
const TOPIC_INSERT_COMPLETE = "/kos/insertion/insert/complete";
|
|
1039
1003
|
const TOPIC_INSERT_UPDATE = "/kos/insertion/insert/update";
|
|
@@ -1041,10 +1005,10 @@ const TOPIC_REMOVE = "/kos/insertion/remove";
|
|
|
1041
1005
|
const TOPIC_REPLACE_LINE = "/kos/pumpEvent/replaceLine";
|
|
1042
1006
|
const TOPIC_HOLDER_CHANGED = "/kos/handle/*";
|
|
1043
1007
|
let HolderContainerModelImpl = class {
|
|
1008
|
+
id;
|
|
1009
|
+
holders;
|
|
1010
|
+
logger;
|
|
1044
1011
|
constructor(modelId, _options, context) {
|
|
1045
|
-
__publicField(this, "id");
|
|
1046
|
-
__publicField(this, "holders");
|
|
1047
|
-
__publicField(this, "logger");
|
|
1048
1012
|
this.id = modelId;
|
|
1049
1013
|
this.holders = new KosModelContainer({
|
|
1050
1014
|
indexMap: {
|
|
@@ -1059,18 +1023,21 @@ let HolderContainerModelImpl = class {
|
|
|
1059
1023
|
updateModel() {
|
|
1060
1024
|
}
|
|
1061
1025
|
handleHolderEvents(event) {
|
|
1062
|
-
var _a, _b, _c;
|
|
1063
1026
|
KosLog.ifDebug(
|
|
1064
|
-
() => this.logger.debug(
|
|
1027
|
+
() => this.logger.debug(
|
|
1028
|
+
"Received holder change event",
|
|
1029
|
+
JSON.stringify(event)
|
|
1030
|
+
),
|
|
1031
|
+
this.logger
|
|
1065
1032
|
);
|
|
1066
1033
|
const holder = this.holders.getModel(event.path);
|
|
1067
1034
|
if (holder) {
|
|
1068
1035
|
this.logger.info(
|
|
1069
1036
|
`Received change event for holder ${holder.path}. Updating fuel gauge data.`
|
|
1070
1037
|
);
|
|
1071
|
-
holder.slice.currentVolMl =
|
|
1072
|
-
holder.slice.maxVolMl =
|
|
1073
|
-
if (
|
|
1038
|
+
holder.slice.currentVolMl = event.slice?.currentVolMl;
|
|
1039
|
+
holder.slice.maxVolMl = event.slice?.maxVolMl;
|
|
1040
|
+
if (event?.container?.enjoyByDate) {
|
|
1074
1041
|
holder.enjoyByDate = new Date(event.container.enjoyByDate);
|
|
1075
1042
|
} else {
|
|
1076
1043
|
holder.enjoyByDate = void 0;
|
|
@@ -1079,12 +1046,12 @@ let HolderContainerModelImpl = class {
|
|
|
1079
1046
|
}
|
|
1080
1047
|
handleInsertion(data) {
|
|
1081
1048
|
KosLog.ifDebug(
|
|
1082
|
-
() => this.logger.debug("Received insertion event", JSON.stringify(data))
|
|
1049
|
+
() => this.logger.debug("Received insertion event", JSON.stringify(data)),
|
|
1050
|
+
this.logger
|
|
1083
1051
|
);
|
|
1084
1052
|
const wrappedData = Array.isArray(data) ? data : [data];
|
|
1085
1053
|
wrappedData.forEach((event) => {
|
|
1086
1054
|
kosAction(() => {
|
|
1087
|
-
var _a, _b, _c;
|
|
1088
1055
|
const ingredientId = event.ingredientId;
|
|
1089
1056
|
const holder = this.holders.getModel(event.path);
|
|
1090
1057
|
if (holder) {
|
|
@@ -1092,9 +1059,9 @@ let HolderContainerModelImpl = class {
|
|
|
1092
1059
|
`Received insertion event for holder ${holder.path}`
|
|
1093
1060
|
);
|
|
1094
1061
|
holder.updateIngredient(ingredientId);
|
|
1095
|
-
holder.slice.currentVolMl =
|
|
1096
|
-
holder.slice.maxVolMl =
|
|
1097
|
-
if (
|
|
1062
|
+
holder.slice.currentVolMl = event.slice?.currentVolMl;
|
|
1063
|
+
holder.slice.maxVolMl = event.slice?.maxVolMl;
|
|
1064
|
+
if (event?.container?.enjoyByDate) {
|
|
1098
1065
|
holder.enjoyByDate = new Date(event.container.enjoyByDate);
|
|
1099
1066
|
} else {
|
|
1100
1067
|
holder.enjoyByDate = void 0;
|
|
@@ -1115,17 +1082,17 @@ let HolderContainerModelImpl = class {
|
|
|
1115
1082
|
}
|
|
1116
1083
|
// -------------------ENTITY----------------------------
|
|
1117
1084
|
};
|
|
1118
|
-
__decorateClass$
|
|
1085
|
+
__decorateClass$7([
|
|
1119
1086
|
kosChild
|
|
1120
1087
|
], HolderContainerModelImpl.prototype, "holders", 2);
|
|
1121
|
-
__decorateClass$
|
|
1088
|
+
__decorateClass$7([
|
|
1122
1089
|
kosTopicHandler({
|
|
1123
1090
|
topic: TOPIC_HOLDER_CHANGED,
|
|
1124
1091
|
websocket: true,
|
|
1125
1092
|
condition: (event, model) => model.holders.getModel(event.path) !== void 0
|
|
1126
1093
|
})
|
|
1127
1094
|
], HolderContainerModelImpl.prototype, "handleHolderEvents", 1);
|
|
1128
|
-
__decorateClass$
|
|
1095
|
+
__decorateClass$7([
|
|
1129
1096
|
kosTopicHandler({
|
|
1130
1097
|
topic: [
|
|
1131
1098
|
TOPIC_INSERT_START,
|
|
@@ -1137,23 +1104,26 @@ __decorateClass$6([
|
|
|
1137
1104
|
websocket: true
|
|
1138
1105
|
})
|
|
1139
1106
|
], HolderContainerModelImpl.prototype, "handleInsertion", 1);
|
|
1140
|
-
HolderContainerModelImpl = __decorateClass$
|
|
1141
|
-
kosModel(MODEL_TYPE$
|
|
1107
|
+
HolderContainerModelImpl = __decorateClass$7([
|
|
1108
|
+
kosModel(MODEL_TYPE$7)
|
|
1142
1109
|
], HolderContainerModelImpl);
|
|
1143
1110
|
const HolderContainer = {
|
|
1144
1111
|
registration: {
|
|
1145
|
-
[MODEL_TYPE$
|
|
1112
|
+
[MODEL_TYPE$7]: {
|
|
1146
1113
|
class: HolderContainerModelImpl,
|
|
1147
1114
|
singleton: true
|
|
1148
1115
|
}
|
|
1149
1116
|
},
|
|
1150
|
-
type: MODEL_TYPE$
|
|
1151
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1117
|
+
type: MODEL_TYPE$7,
|
|
1118
|
+
predicate: isKosModel(MODEL_TYPE$7),
|
|
1152
1119
|
factory: Kos.Singleton.create(
|
|
1153
|
-
MODEL_TYPE$
|
|
1120
|
+
MODEL_TYPE$7
|
|
1154
1121
|
)
|
|
1155
1122
|
};
|
|
1156
|
-
const Logger$1 = KosLog.createLogger({
|
|
1123
|
+
const Logger$1 = KosLog.createLogger({
|
|
1124
|
+
group: LogGroup.model,
|
|
1125
|
+
name: "board-utils"
|
|
1126
|
+
});
|
|
1157
1127
|
const mapAssemblyBoardToModel = async (board) => {
|
|
1158
1128
|
const boardExtData = await KosExtensionUtils.executeDataMapperExtension({
|
|
1159
1129
|
extension: ExtensionType.BoardMapper,
|
|
@@ -1190,10 +1160,6 @@ const { URL: URL$2 } = resolveServiceUrl("PUMP_SERVICE");
|
|
|
1190
1160
|
const { postModel: postModel$2, getOne: getOne$1 } = ServiceFactory.build({
|
|
1191
1161
|
basePath: `${URL$2}/api/kos/holders`
|
|
1192
1162
|
});
|
|
1193
|
-
KosLog.createLogger({
|
|
1194
|
-
name: "pump-service",
|
|
1195
|
-
group: "Services"
|
|
1196
|
-
});
|
|
1197
1163
|
const sendIntent = async ({
|
|
1198
1164
|
intent,
|
|
1199
1165
|
pumpId,
|
|
@@ -1201,7 +1167,7 @@ const sendIntent = async ({
|
|
|
1201
1167
|
}) => {
|
|
1202
1168
|
const url = `${URL$2}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${pumpId}/${intent}`;
|
|
1203
1169
|
const response = await postModel$2({ model: {}, urlOverride: url, tracker });
|
|
1204
|
-
if (response
|
|
1170
|
+
if (response?.data) {
|
|
1205
1171
|
FutureManager.initiateFuture(response.data);
|
|
1206
1172
|
}
|
|
1207
1173
|
return response;
|
|
@@ -1209,47 +1175,47 @@ const sendIntent = async ({
|
|
|
1209
1175
|
const getIntentVolume = async (pumpId, intent) => {
|
|
1210
1176
|
const url = `${URL$2}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${pumpId}/${intent}/volume`;
|
|
1211
1177
|
const response = await getOne$1({ urlOverride: url });
|
|
1212
|
-
if (!
|
|
1178
|
+
if (!response?.data) {
|
|
1213
1179
|
return { volume: -1 };
|
|
1214
1180
|
}
|
|
1215
1181
|
return response.data;
|
|
1216
1182
|
};
|
|
1217
|
-
var __defProp$
|
|
1218
|
-
var __getOwnPropDesc$
|
|
1219
|
-
var __decorateClass$
|
|
1220
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1183
|
+
var __defProp$5 = Object.defineProperty;
|
|
1184
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1185
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1186
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1221
1187
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1222
1188
|
if (decorator = decorators[i])
|
|
1223
1189
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1224
|
-
if (kind && result)
|
|
1225
|
-
__defProp$4(target, key, result);
|
|
1190
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
1226
1191
|
return result;
|
|
1227
1192
|
};
|
|
1228
|
-
const
|
|
1193
|
+
const log = KosLog.createLogger({ group: LogGroup.model, name: "pump-model" });
|
|
1194
|
+
const MODEL_TYPE$6 = DispenseModelType.Pump;
|
|
1229
1195
|
ExtensionManager[EXTENSION_TROUBLE_MAPPER].register(
|
|
1230
1196
|
"pump",
|
|
1231
1197
|
pumpTroubleResolver
|
|
1232
1198
|
);
|
|
1233
1199
|
let PumpModelImpl = class {
|
|
1200
|
+
id;
|
|
1201
|
+
inserted;
|
|
1202
|
+
type;
|
|
1203
|
+
virtual;
|
|
1204
|
+
ingredientId;
|
|
1205
|
+
holderPath;
|
|
1206
|
+
boardPath;
|
|
1207
|
+
nozzlePath;
|
|
1208
|
+
childPump;
|
|
1209
|
+
name;
|
|
1210
|
+
path;
|
|
1211
|
+
prevIngredientId;
|
|
1212
|
+
/**
|
|
1213
|
+
* @kosApiLevel 12
|
|
1214
|
+
*/
|
|
1215
|
+
state;
|
|
1216
|
+
futureHandler;
|
|
1217
|
+
currentState = PourState.IDLE;
|
|
1234
1218
|
constructor(modelId, options) {
|
|
1235
|
-
__publicField(this, "id");
|
|
1236
|
-
__publicField(this, "inserted");
|
|
1237
|
-
__publicField(this, "type");
|
|
1238
|
-
__publicField(this, "virtual");
|
|
1239
|
-
__publicField(this, "ingredientId");
|
|
1240
|
-
__publicField(this, "holderPath");
|
|
1241
|
-
__publicField(this, "boardPath");
|
|
1242
|
-
__publicField(this, "nozzlePath");
|
|
1243
|
-
__publicField(this, "childPump");
|
|
1244
|
-
__publicField(this, "name");
|
|
1245
|
-
__publicField(this, "path");
|
|
1246
|
-
__publicField(this, "prevIngredientId");
|
|
1247
|
-
/**
|
|
1248
|
-
* @kosApiLevel 12
|
|
1249
|
-
*/
|
|
1250
|
-
__publicField(this, "state");
|
|
1251
|
-
__publicField(this, "futureHandler");
|
|
1252
|
-
__publicField(this, "currentState", PourState.IDLE);
|
|
1253
1219
|
this.id = modelId;
|
|
1254
1220
|
const {
|
|
1255
1221
|
inserted,
|
|
@@ -1304,12 +1270,10 @@ let PumpModelImpl = class {
|
|
|
1304
1270
|
}
|
|
1305
1271
|
// -------------------LIFECYCLE----------------------------
|
|
1306
1272
|
get pouringState() {
|
|
1307
|
-
|
|
1308
|
-
return ((_a = this.future) == null ? void 0 : _a.endState) || "";
|
|
1273
|
+
return this.future?.endState || "";
|
|
1309
1274
|
}
|
|
1310
1275
|
get isPouring() {
|
|
1311
|
-
|
|
1312
|
-
return !!(this.future && !((_a = this.future) == null ? void 0 : _a.endState)) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING;
|
|
1276
|
+
return !!(this.future && !this.future?.endState) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING;
|
|
1313
1277
|
}
|
|
1314
1278
|
get canPour() {
|
|
1315
1279
|
return !!this.ingredientId && !this.isPouring;
|
|
@@ -1322,15 +1286,14 @@ let PumpModelImpl = class {
|
|
|
1322
1286
|
}
|
|
1323
1287
|
}
|
|
1324
1288
|
async cancelPour() {
|
|
1325
|
-
var _a;
|
|
1326
1289
|
if (this.currentState === PourState.POURING || this.currentState === PourState.POUR_STARTING) {
|
|
1327
1290
|
this.currentState = PourState.POUR_CANCELING;
|
|
1328
|
-
await
|
|
1291
|
+
await this.future?.cancelFuture();
|
|
1329
1292
|
kosAction(() => {
|
|
1330
1293
|
this.currentState = PourState.IDLE;
|
|
1331
1294
|
});
|
|
1332
1295
|
} else {
|
|
1333
|
-
|
|
1296
|
+
log.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1334
1297
|
}
|
|
1335
1298
|
}
|
|
1336
1299
|
get future() {
|
|
@@ -1360,36 +1323,39 @@ let PumpModelImpl = class {
|
|
|
1360
1323
|
this.currentState = PourState.POURING;
|
|
1361
1324
|
});
|
|
1362
1325
|
}
|
|
1363
|
-
return result
|
|
1326
|
+
return result?.data;
|
|
1364
1327
|
} else {
|
|
1365
1328
|
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1366
1329
|
}
|
|
1367
1330
|
} catch (e) {
|
|
1368
|
-
|
|
1331
|
+
log.error(e);
|
|
1369
1332
|
this.currentState = PourState.IDLE;
|
|
1370
1333
|
throw e;
|
|
1371
1334
|
}
|
|
1372
1335
|
}
|
|
1373
1336
|
// -------------------ENTITY----------------------------
|
|
1374
1337
|
};
|
|
1375
|
-
__decorateClass$
|
|
1338
|
+
__decorateClass$6([
|
|
1376
1339
|
kosFuture()
|
|
1377
1340
|
], PumpModelImpl.prototype, "performIntent", 1);
|
|
1378
|
-
PumpModelImpl = __decorateClass$
|
|
1379
|
-
kosModel(MODEL_TYPE$
|
|
1341
|
+
PumpModelImpl = __decorateClass$6([
|
|
1342
|
+
kosModel(MODEL_TYPE$6)
|
|
1380
1343
|
], PumpModelImpl);
|
|
1381
1344
|
const Pump = {
|
|
1382
1345
|
registration: {
|
|
1383
|
-
[MODEL_TYPE$
|
|
1346
|
+
[MODEL_TYPE$6]: {
|
|
1384
1347
|
class: PumpModelImpl,
|
|
1385
1348
|
singleton: false
|
|
1386
1349
|
}
|
|
1387
1350
|
},
|
|
1388
|
-
type: MODEL_TYPE$
|
|
1389
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1390
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
1351
|
+
type: MODEL_TYPE$6,
|
|
1352
|
+
predicate: isKosModel(MODEL_TYPE$6),
|
|
1353
|
+
factory: Kos.Factory.create(MODEL_TYPE$6)
|
|
1391
1354
|
};
|
|
1392
|
-
const Logger = KosLog.createLogger({
|
|
1355
|
+
const Logger = KosLog.createLogger({
|
|
1356
|
+
group: LogGroup.model,
|
|
1357
|
+
name: "pump-utils"
|
|
1358
|
+
});
|
|
1393
1359
|
const mapAssemblyPumpToModel = (nozzlePath, pump) => {
|
|
1394
1360
|
const virtual = (pump.pumps ?? []).length > 1;
|
|
1395
1361
|
const options = {
|
|
@@ -1411,18 +1377,17 @@ const mapAssemblyPumpToModel = (nozzlePath, pump) => {
|
|
|
1411
1377
|
return pumpModel;
|
|
1412
1378
|
};
|
|
1413
1379
|
const assemblyPumpMap = (pumpContainer) => (holderContainer) => (nozzle) => (assemblyPump) => {
|
|
1414
|
-
var _a;
|
|
1415
1380
|
try {
|
|
1416
1381
|
Logger.debug(`adding pump ${assemblyPump.name}`);
|
|
1417
1382
|
const pump = mapAssemblyPumpToModel(nozzle.path, assemblyPump);
|
|
1418
1383
|
pumpContainer.addModel(pump);
|
|
1419
1384
|
const holderPath = pump.holderPath;
|
|
1420
1385
|
const holder = holderContainer.holders.getModel(holderPath);
|
|
1421
|
-
holder
|
|
1422
|
-
if (!
|
|
1423
|
-
holder
|
|
1386
|
+
holder?.pumps.addModel(pump);
|
|
1387
|
+
if (!holder?.nozzlePaths.includes(nozzle.path)) {
|
|
1388
|
+
holder?.nozzlePaths.push(nozzle.path);
|
|
1424
1389
|
}
|
|
1425
|
-
|
|
1390
|
+
assemblyPump?.pumps?.forEach((subPump) => {
|
|
1426
1391
|
const subHolderPath = pump.holderPath;
|
|
1427
1392
|
const subPumpData = {
|
|
1428
1393
|
...subPump,
|
|
@@ -1437,29 +1402,28 @@ const assemblyPumpMap = (pumpContainer) => (holderContainer) => (nozzle) => (ass
|
|
|
1437
1402
|
throw error;
|
|
1438
1403
|
}
|
|
1439
1404
|
};
|
|
1440
|
-
var __defProp$
|
|
1441
|
-
var __getOwnPropDesc$
|
|
1442
|
-
var __decorateClass$
|
|
1443
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1405
|
+
var __defProp$4 = Object.defineProperty;
|
|
1406
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1407
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1408
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1444
1409
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1445
1410
|
if (decorator = decorators[i])
|
|
1446
1411
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1447
|
-
if (kind && result)
|
|
1448
|
-
__defProp$3(target, key, result);
|
|
1412
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1449
1413
|
return result;
|
|
1450
1414
|
};
|
|
1451
|
-
const MODEL_TYPE$
|
|
1415
|
+
const MODEL_TYPE$5 = "assembly-model";
|
|
1452
1416
|
const CONTEXT_ASSEMBLY_DATA = "assembly-data";
|
|
1453
1417
|
const CONTEXT_ASSEMBLY_RAW_DATA = "assembly-raw-data";
|
|
1454
1418
|
let AssemblyModelImpl = class {
|
|
1419
|
+
id;
|
|
1420
|
+
_nozzlePaths = /* @__PURE__ */ new Set();
|
|
1421
|
+
troubleContainer;
|
|
1422
|
+
holderContainer;
|
|
1423
|
+
boardContainer;
|
|
1424
|
+
pumpContainer;
|
|
1425
|
+
logger;
|
|
1455
1426
|
constructor(modelId, _options, context) {
|
|
1456
|
-
__publicField(this, "id");
|
|
1457
|
-
__publicField(this, "_nozzlePaths", /* @__PURE__ */ new Set());
|
|
1458
|
-
__publicField(this, "troubleContainer");
|
|
1459
|
-
__publicField(this, "holderContainer");
|
|
1460
|
-
__publicField(this, "boardContainer");
|
|
1461
|
-
__publicField(this, "pumpContainer");
|
|
1462
|
-
__publicField(this, "logger");
|
|
1463
1427
|
this.id = modelId;
|
|
1464
1428
|
this.holderContainer = HolderContainer.factory({});
|
|
1465
1429
|
this.boardContainer = BoardContainer.factory({});
|
|
@@ -1506,8 +1470,7 @@ let AssemblyModelImpl = class {
|
|
|
1506
1470
|
this.logger.debug(`initializing assembly ${this.id}`);
|
|
1507
1471
|
}
|
|
1508
1472
|
async ready() {
|
|
1509
|
-
|
|
1510
|
-
(_a = this.troubleContainer) == null ? void 0 : _a.troubles.increment();
|
|
1473
|
+
this.troubleContainer?.troubles.increment();
|
|
1511
1474
|
ExtensionManager[EXTENSION_FEATURE_FLAG_RESOLVER].execute(
|
|
1512
1475
|
ExtensionType.AssemblyFeatureFlags,
|
|
1513
1476
|
this
|
|
@@ -1516,7 +1479,7 @@ let AssemblyModelImpl = class {
|
|
|
1516
1479
|
async load(context) {
|
|
1517
1480
|
this.logger.debug(`loading assembly ${this.id}`);
|
|
1518
1481
|
const result = await getAssembly();
|
|
1519
|
-
if (
|
|
1482
|
+
if (result?.status === 200) {
|
|
1520
1483
|
const data = await KosExtensionUtils.executeDataMapperExtension({
|
|
1521
1484
|
extension: ExtensionType.AssemblyMapper,
|
|
1522
1485
|
data: result.data,
|
|
@@ -1544,11 +1507,10 @@ let AssemblyModelImpl = class {
|
|
|
1544
1507
|
this.logger.debug(`adding assembly ${name}`);
|
|
1545
1508
|
this.logger.warn(`Assembly rest keys: ${Object.keys(rest).join(", ")}`);
|
|
1546
1509
|
Object.keys(rest).forEach((key) => {
|
|
1547
|
-
var _a;
|
|
1548
1510
|
this.logger.warn(`Enabling feature flag: ${key}`);
|
|
1549
1511
|
KosFeatureFlags.enableFeature(key);
|
|
1550
1512
|
context.set(`assembly-feature-${key}`, rest[key]);
|
|
1551
|
-
if (
|
|
1513
|
+
if (rest[key]["state"]?.["path"] !== void 0) {
|
|
1552
1514
|
const statePath = rest[key]["state"]["path"];
|
|
1553
1515
|
this.logger.warn(`Feature flag ${key} state path: ${statePath}`);
|
|
1554
1516
|
context.set(`assembly-state-path-${key}`, statePath);
|
|
@@ -1580,58 +1542,58 @@ let AssemblyModelImpl = class {
|
|
|
1580
1542
|
}
|
|
1581
1543
|
}
|
|
1582
1544
|
};
|
|
1583
|
-
__decorateClass$
|
|
1545
|
+
__decorateClass$5([
|
|
1584
1546
|
kosDependency({
|
|
1585
1547
|
modelType: "trouble-container-model"
|
|
1586
1548
|
})
|
|
1587
1549
|
], AssemblyModelImpl.prototype, "troubleContainer", 2);
|
|
1588
|
-
__decorateClass$
|
|
1550
|
+
__decorateClass$5([
|
|
1589
1551
|
kosChild
|
|
1590
1552
|
], AssemblyModelImpl.prototype, "holderContainer", 2);
|
|
1591
|
-
__decorateClass$
|
|
1553
|
+
__decorateClass$5([
|
|
1592
1554
|
kosChild
|
|
1593
1555
|
], AssemblyModelImpl.prototype, "boardContainer", 2);
|
|
1594
|
-
__decorateClass$
|
|
1556
|
+
__decorateClass$5([
|
|
1595
1557
|
kosChild
|
|
1596
1558
|
], AssemblyModelImpl.prototype, "pumpContainer", 2);
|
|
1597
|
-
AssemblyModelImpl = __decorateClass$
|
|
1598
|
-
kosModel(MODEL_TYPE$
|
|
1559
|
+
AssemblyModelImpl = __decorateClass$5([
|
|
1560
|
+
kosModel(MODEL_TYPE$5)
|
|
1599
1561
|
], AssemblyModelImpl);
|
|
1600
1562
|
const Assembly = {
|
|
1601
1563
|
registration: {
|
|
1602
|
-
[MODEL_TYPE$
|
|
1564
|
+
[MODEL_TYPE$5]: {
|
|
1603
1565
|
class: AssemblyModelImpl,
|
|
1604
1566
|
singleton: true
|
|
1605
1567
|
}
|
|
1606
1568
|
},
|
|
1607
|
-
type: MODEL_TYPE$
|
|
1608
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1609
|
-
factory: Kos.Singleton.create(MODEL_TYPE$
|
|
1569
|
+
type: MODEL_TYPE$5,
|
|
1570
|
+
predicate: isKosModel(MODEL_TYPE$5),
|
|
1571
|
+
factory: Kos.Singleton.create(MODEL_TYPE$5)
|
|
1610
1572
|
};
|
|
1611
|
-
var __getOwnPropDesc$
|
|
1612
|
-
var __decorateClass$
|
|
1613
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1573
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1574
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1575
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1614
1576
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1615
1577
|
if (decorator = decorators[i])
|
|
1616
1578
|
result = decorator(result) || result;
|
|
1617
1579
|
return result;
|
|
1618
1580
|
};
|
|
1619
|
-
const MODEL_TYPE$
|
|
1581
|
+
const MODEL_TYPE$4 = DispenseModelType.Availability;
|
|
1620
1582
|
let AvailabilityModelImpl = class {
|
|
1583
|
+
id;
|
|
1584
|
+
data;
|
|
1585
|
+
properties;
|
|
1586
|
+
available;
|
|
1587
|
+
visible;
|
|
1588
|
+
groupId;
|
|
1589
|
+
rawId;
|
|
1590
|
+
altId;
|
|
1591
|
+
type;
|
|
1592
|
+
note;
|
|
1593
|
+
taggedIds;
|
|
1594
|
+
parentId;
|
|
1595
|
+
logger;
|
|
1621
1596
|
constructor(modelId, options, context) {
|
|
1622
|
-
__publicField(this, "id");
|
|
1623
|
-
__publicField(this, "data");
|
|
1624
|
-
__publicField(this, "properties");
|
|
1625
|
-
__publicField(this, "available");
|
|
1626
|
-
__publicField(this, "visible");
|
|
1627
|
-
__publicField(this, "groupId");
|
|
1628
|
-
__publicField(this, "rawId");
|
|
1629
|
-
__publicField(this, "altId");
|
|
1630
|
-
__publicField(this, "type");
|
|
1631
|
-
__publicField(this, "note");
|
|
1632
|
-
__publicField(this, "taggedIds");
|
|
1633
|
-
__publicField(this, "parentId");
|
|
1634
|
-
__publicField(this, "logger");
|
|
1635
1597
|
this.id = modelId;
|
|
1636
1598
|
this.taggedIds = options.taggedIds || [];
|
|
1637
1599
|
this.logger = context.logger;
|
|
@@ -1662,23 +1624,38 @@ let AvailabilityModelImpl = class {
|
|
|
1662
1624
|
// -------------------LIFECYCLE----------------------------
|
|
1663
1625
|
// -------------------ENTITY----------------------------
|
|
1664
1626
|
};
|
|
1665
|
-
AvailabilityModelImpl = __decorateClass$
|
|
1627
|
+
AvailabilityModelImpl = __decorateClass$4([
|
|
1666
1628
|
kosParentAware(),
|
|
1667
|
-
kosModel(MODEL_TYPE$
|
|
1629
|
+
kosModel(MODEL_TYPE$4)
|
|
1668
1630
|
], AvailabilityModelImpl);
|
|
1669
1631
|
const Availability = {
|
|
1670
1632
|
registration: {
|
|
1671
|
-
[MODEL_TYPE$
|
|
1633
|
+
[MODEL_TYPE$4]: {
|
|
1672
1634
|
class: AvailabilityModelImpl,
|
|
1673
1635
|
singleton: false
|
|
1674
1636
|
}
|
|
1675
1637
|
},
|
|
1676
|
-
type: MODEL_TYPE$
|
|
1677
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1638
|
+
type: MODEL_TYPE$4,
|
|
1639
|
+
predicate: isKosModel(MODEL_TYPE$4),
|
|
1678
1640
|
factory: Kos.Factory.create(
|
|
1679
|
-
MODEL_TYPE$
|
|
1641
|
+
MODEL_TYPE$4
|
|
1680
1642
|
)
|
|
1681
1643
|
};
|
|
1644
|
+
class PourContext {
|
|
1645
|
+
_data = /* @__PURE__ */ new Map();
|
|
1646
|
+
get(key) {
|
|
1647
|
+
return this._data.get(key);
|
|
1648
|
+
}
|
|
1649
|
+
set(key, value) {
|
|
1650
|
+
this._data.set(key, value);
|
|
1651
|
+
}
|
|
1652
|
+
remove(key) {
|
|
1653
|
+
this._data.delete(key);
|
|
1654
|
+
}
|
|
1655
|
+
has(key) {
|
|
1656
|
+
return this._data.has(key);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1682
1659
|
const { URL: URL$1 } = resolveServiceUrl("NOZZLE_SERVICE");
|
|
1683
1660
|
const { postModel: postModel$1, deleteModel, getOne } = ServiceFactory.build({
|
|
1684
1661
|
basePath: `${URL$1}/api/nozzle`
|
|
@@ -1686,11 +1663,11 @@ const { postModel: postModel$1, deleteModel, getOne } = ServiceFactory.build({
|
|
|
1686
1663
|
const pourPourable = async (nozzleId, tracker) => {
|
|
1687
1664
|
const response = await postModel$1({
|
|
1688
1665
|
model: {},
|
|
1689
|
-
urlOverride: `${URL$1}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/pour`,
|
|
1666
|
+
urlOverride: `${URL$1}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/pour/selected/maxVolume`,
|
|
1690
1667
|
ordered: true,
|
|
1691
1668
|
tracker
|
|
1692
1669
|
});
|
|
1693
|
-
if (response
|
|
1670
|
+
if (response?.data) {
|
|
1694
1671
|
FutureManager.initiateFuture(response.data);
|
|
1695
1672
|
}
|
|
1696
1673
|
return response;
|
|
@@ -1702,7 +1679,7 @@ const pourNamedPourable = async (name, nozzleId, tracker) => {
|
|
|
1702
1679
|
ordered: true,
|
|
1703
1680
|
tracker
|
|
1704
1681
|
});
|
|
1705
|
-
if (response
|
|
1682
|
+
if (response?.data) {
|
|
1706
1683
|
FutureManager.initiateFuture(response.data);
|
|
1707
1684
|
}
|
|
1708
1685
|
return response;
|
|
@@ -1727,18 +1704,17 @@ const clearPourable = async (nozzleId) => {
|
|
|
1727
1704
|
});
|
|
1728
1705
|
return response;
|
|
1729
1706
|
};
|
|
1730
|
-
var __defProp$
|
|
1731
|
-
var __getOwnPropDesc$
|
|
1732
|
-
var __decorateClass$
|
|
1733
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1707
|
+
var __defProp$3 = Object.defineProperty;
|
|
1708
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1709
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1710
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1734
1711
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1735
1712
|
if (decorator = decorators[i])
|
|
1736
1713
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1737
|
-
if (kind && result)
|
|
1738
|
-
__defProp$2(target, key, result);
|
|
1714
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1739
1715
|
return result;
|
|
1740
1716
|
};
|
|
1741
|
-
const MODEL_TYPE$
|
|
1717
|
+
const MODEL_TYPE$3 = DispenseModelType.Nozzle;
|
|
1742
1718
|
const PROP_BEVERAGE_TOPIC_PREFIX = createPropKey(
|
|
1743
1719
|
"beverageTopicPrefix"
|
|
1744
1720
|
);
|
|
@@ -1747,37 +1723,18 @@ const TOPIC_NOZZLE_POUR_STARTED = "/kos/nozzle/pour/started";
|
|
|
1747
1723
|
const TOPIC_NOZZLE_POUR_PROGRESS = "/kos/nozzle/pour/progress";
|
|
1748
1724
|
const TOPIC_NOZZLE_POUR_CANCEL = "/kos/nozzle/pour/cancel";
|
|
1749
1725
|
let NozzleModelImpl = class {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
__publicField(this, "urlPrefix");
|
|
1763
|
-
this.id = modelId;
|
|
1764
|
-
this.path = options.path;
|
|
1765
|
-
this.name = options.name;
|
|
1766
|
-
this.beverageTopicPrefix = options.beverageTopicPrefix;
|
|
1767
|
-
this.topicPrefix = options.topicPrefix;
|
|
1768
|
-
this.urlPrefix = options.urlPrefix;
|
|
1769
|
-
this._selectedBeverage = void 0;
|
|
1770
|
-
this._selectedBrand = void 0;
|
|
1771
|
-
this._additionalItems = [];
|
|
1772
|
-
this.futureHandler = new MultipleFutureHandler(this);
|
|
1773
|
-
this._availabilityItems = new KosModelContainer({
|
|
1774
|
-
indexMap: {
|
|
1775
|
-
byGroup: "groupId",
|
|
1776
|
-
byParent: "parentId"
|
|
1777
|
-
},
|
|
1778
|
-
parentId: modelId
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1726
|
+
/** the unique identifier for this nozzle.*/
|
|
1727
|
+
id;
|
|
1728
|
+
path;
|
|
1729
|
+
name;
|
|
1730
|
+
_selectedBeverage;
|
|
1731
|
+
_selectedBrand;
|
|
1732
|
+
_additionalItems;
|
|
1733
|
+
_availabilityItems;
|
|
1734
|
+
futureHandler;
|
|
1735
|
+
beverageTopicPrefix;
|
|
1736
|
+
topicPrefix;
|
|
1737
|
+
urlPrefix;
|
|
1781
1738
|
/**
|
|
1782
1739
|
* The availability nodes that can be dispensed from this nozzle.
|
|
1783
1740
|
* This is a subset of the availability for the entire dispenser
|
|
@@ -1804,8 +1761,7 @@ let NozzleModelImpl = class {
|
|
|
1804
1761
|
* @readonly
|
|
1805
1762
|
*/
|
|
1806
1763
|
get isPouring() {
|
|
1807
|
-
|
|
1808
|
-
return !!(this.futureHandler.getFuture() && !((_a = this.futureHandler.getFuture()) == null ? void 0 : _a.endState)) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING || this.currentState === PourState.POUR_CANCELING;
|
|
1764
|
+
return !!(this.futureHandler.getFuture() && !this.futureHandler.getFuture()?.endState) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING || this.currentState === PourState.POUR_CANCELING;
|
|
1809
1765
|
}
|
|
1810
1766
|
/**
|
|
1811
1767
|
* A derived value that indicates if the nozzle is currently available to pour a beverage.
|
|
@@ -1836,8 +1792,26 @@ let NozzleModelImpl = class {
|
|
|
1836
1792
|
return this.futureHandler.getFuture();
|
|
1837
1793
|
}
|
|
1838
1794
|
get pourProgress() {
|
|
1839
|
-
|
|
1840
|
-
|
|
1795
|
+
return this.future?.progress ?? 0;
|
|
1796
|
+
}
|
|
1797
|
+
constructor(modelId, options) {
|
|
1798
|
+
this.id = modelId;
|
|
1799
|
+
this.path = options.path;
|
|
1800
|
+
this.name = options.name;
|
|
1801
|
+
this.beverageTopicPrefix = options.beverageTopicPrefix;
|
|
1802
|
+
this.topicPrefix = options.topicPrefix;
|
|
1803
|
+
this.urlPrefix = options.urlPrefix;
|
|
1804
|
+
this._selectedBeverage = void 0;
|
|
1805
|
+
this._selectedBrand = void 0;
|
|
1806
|
+
this._additionalItems = [];
|
|
1807
|
+
this.futureHandler = new MultipleFutureHandler(this);
|
|
1808
|
+
this._availabilityItems = new KosModelContainer({
|
|
1809
|
+
indexMap: {
|
|
1810
|
+
byGroup: "groupId",
|
|
1811
|
+
byParent: "parentId"
|
|
1812
|
+
},
|
|
1813
|
+
parentId: modelId
|
|
1814
|
+
});
|
|
1841
1815
|
}
|
|
1842
1816
|
updateModel() {
|
|
1843
1817
|
}
|
|
@@ -1863,7 +1837,7 @@ let NozzleModelImpl = class {
|
|
|
1863
1837
|
async setSelectedPourable({ beverage, additional, context }, forceUpdate = false) {
|
|
1864
1838
|
if (!beverage) {
|
|
1865
1839
|
const response2 = await clearPourable(this.name);
|
|
1866
|
-
if (
|
|
1840
|
+
if (response2?.status !== 200) {
|
|
1867
1841
|
throw new Error("Failed to clear pourable");
|
|
1868
1842
|
}
|
|
1869
1843
|
this._selectedBeverage = void 0;
|
|
@@ -1902,7 +1876,7 @@ let NozzleModelImpl = class {
|
|
|
1902
1876
|
}
|
|
1903
1877
|
const payload = selectedPayload ?? defaultPayload;
|
|
1904
1878
|
const response = await selectPourable(this.name, payload);
|
|
1905
|
-
if (
|
|
1879
|
+
if (response?.status !== 200) {
|
|
1906
1880
|
throw new Error("Failed to select pourable");
|
|
1907
1881
|
}
|
|
1908
1882
|
}
|
|
@@ -1939,9 +1913,8 @@ let NozzleModelImpl = class {
|
|
|
1939
1913
|
handlePouringStart() {
|
|
1940
1914
|
this.logger.info("Pour started");
|
|
1941
1915
|
getAllKosCompanionModels(this).forEach((model) => {
|
|
1942
|
-
var _a;
|
|
1943
1916
|
if (isPourAware$1(model)) {
|
|
1944
|
-
|
|
1917
|
+
model.onPourStart?.();
|
|
1945
1918
|
}
|
|
1946
1919
|
});
|
|
1947
1920
|
}
|
|
@@ -1954,9 +1927,8 @@ let NozzleModelImpl = class {
|
|
|
1954
1927
|
handleCanceled() {
|
|
1955
1928
|
this.logger.info("Pour canceled");
|
|
1956
1929
|
getAllKosCompanionModels(this).forEach((model) => {
|
|
1957
|
-
var _a;
|
|
1958
1930
|
if (isPourAware$1(model)) {
|
|
1959
|
-
|
|
1931
|
+
model.onPourCancel?.();
|
|
1960
1932
|
}
|
|
1961
1933
|
});
|
|
1962
1934
|
const evt = {
|
|
@@ -1996,7 +1968,6 @@ let NozzleModelImpl = class {
|
|
|
1996
1968
|
}
|
|
1997
1969
|
// Inherits throwOnInvalid: false from class
|
|
1998
1970
|
async pour(tracker) {
|
|
1999
|
-
var _a;
|
|
2000
1971
|
try {
|
|
2001
1972
|
this.transition("START_POUR");
|
|
2002
1973
|
if (!tracker) {
|
|
@@ -2009,7 +1980,7 @@ let NozzleModelImpl = class {
|
|
|
2009
1980
|
type: "free"
|
|
2010
1981
|
};
|
|
2011
1982
|
EventBus.publish(TOPIC_NOZZLE_POUR_STARTED, evt);
|
|
2012
|
-
if (
|
|
1983
|
+
if (result?.data?.endState) {
|
|
2013
1984
|
this.transition("POUR_COMPLETED");
|
|
2014
1985
|
}
|
|
2015
1986
|
return result;
|
|
@@ -2023,7 +1994,6 @@ let NozzleModelImpl = class {
|
|
|
2023
1994
|
}
|
|
2024
1995
|
// Inherits throwOnInvalid: false from class
|
|
2025
1996
|
async fixedPour(name, tracker) {
|
|
2026
|
-
var _a;
|
|
2027
1997
|
try {
|
|
2028
1998
|
this.transition("START_POUR");
|
|
2029
1999
|
if (!tracker) {
|
|
@@ -2036,7 +2006,7 @@ let NozzleModelImpl = class {
|
|
|
2036
2006
|
type: "fixed"
|
|
2037
2007
|
};
|
|
2038
2008
|
EventBus.publish(TOPIC_NOZZLE_POUR_STARTED, evt);
|
|
2039
|
-
if (
|
|
2009
|
+
if (result?.data?.endState) {
|
|
2040
2010
|
this.transition("POUR_COMPLETED");
|
|
2041
2011
|
}
|
|
2042
2012
|
return result;
|
|
@@ -2050,9 +2020,8 @@ let NozzleModelImpl = class {
|
|
|
2050
2020
|
}
|
|
2051
2021
|
// Inherits throwOnInvalid: false - silently ignore if already idle
|
|
2052
2022
|
async cancelPour() {
|
|
2053
|
-
var _a;
|
|
2054
2023
|
this.transition("CANCEL_POUR");
|
|
2055
|
-
await
|
|
2024
|
+
await this.futureHandler.getFuture()?.cancelFuture();
|
|
2056
2025
|
this.transition("POUR_CANCELED");
|
|
2057
2026
|
}
|
|
2058
2027
|
updateGroupMembers() {
|
|
@@ -2071,34 +2040,31 @@ let NozzleModelImpl = class {
|
|
|
2071
2040
|
}
|
|
2072
2041
|
async reload() {
|
|
2073
2042
|
this.logger.info(`reloading nozzle ${this.id}`);
|
|
2074
|
-
const context = KosContextManager.getContext(this.id);
|
|
2075
|
-
(context == null ? void 0 : context.get(ExtensionType.AvailabilityLoader)) || {};
|
|
2076
2043
|
const availability = await getAvailability(this.urlPrefix);
|
|
2077
|
-
if (
|
|
2044
|
+
if (availability?.status !== 200 || !availability?.data) {
|
|
2078
2045
|
this.logger.error("Failed to load nozzle availability");
|
|
2079
2046
|
return;
|
|
2080
2047
|
}
|
|
2081
|
-
const update = availability
|
|
2048
|
+
const update = availability?.data;
|
|
2082
2049
|
if (update) {
|
|
2083
2050
|
await this.updateAvailability(update);
|
|
2084
2051
|
}
|
|
2085
2052
|
}
|
|
2086
2053
|
/** @internal */
|
|
2087
2054
|
async load(context) {
|
|
2088
|
-
var _a, _b;
|
|
2089
2055
|
this.logger.debug(`loading nozzle ${this.id}`);
|
|
2090
2056
|
const availability = await getAvailability(this.urlPrefix);
|
|
2091
|
-
if (
|
|
2057
|
+
if (availability?.status !== 200) {
|
|
2092
2058
|
throw new Error("Failed to load nozzle availability");
|
|
2093
2059
|
}
|
|
2094
2060
|
const beverageContext = await ExtensionManager.loader.executeLoader(
|
|
2095
2061
|
ExtensionType.AvailabilityLoader,
|
|
2096
2062
|
{}
|
|
2097
2063
|
);
|
|
2098
|
-
context
|
|
2099
|
-
context
|
|
2100
|
-
for (const group of Object.keys(
|
|
2101
|
-
for (const beverageData of
|
|
2064
|
+
context?.set(ExtensionType.AvailabilityLoader, beverageContext);
|
|
2065
|
+
context?.set(Nozzle.type, this);
|
|
2066
|
+
for (const group of Object.keys(availability.data?.groups) || []) {
|
|
2067
|
+
for (const beverageData of availability.data?.groups[group] || []) {
|
|
2102
2068
|
const extensionData = await ExtensionManager.dataMapper.executeMapper(
|
|
2103
2069
|
ExtensionType.AvailabilityMapper,
|
|
2104
2070
|
{ ...beverageData, groupId: group },
|
|
@@ -2123,19 +2089,25 @@ let NozzleModelImpl = class {
|
|
|
2123
2089
|
}
|
|
2124
2090
|
async updateAvailability(update) {
|
|
2125
2091
|
const context = KosContextManager.getContext(this.id);
|
|
2126
|
-
const beverageContext =
|
|
2092
|
+
const beverageContext = context?.get(ExtensionType.AvailabilityLoader) || {};
|
|
2127
2093
|
if (update.rebuild) {
|
|
2128
|
-
|
|
2094
|
+
this.logger.info(
|
|
2095
|
+
`Received rebuild update for nozzle ${this.path}, rebuilding entire availability set`
|
|
2096
|
+
);
|
|
2097
|
+
for (const group of Object.keys(update?.groups) || []) {
|
|
2129
2098
|
const deletedBeverages = this._availabilityItems.getIndexByKey("group", group).filter(
|
|
2130
2099
|
(beverage) => !update.groups[group].find(
|
|
2131
2100
|
(b) => `${this.id}-${group}-${b.id}` === beverage.id
|
|
2132
2101
|
)
|
|
2133
2102
|
);
|
|
2134
2103
|
deletedBeverages.forEach((beverage) => {
|
|
2104
|
+
this.logger.info(
|
|
2105
|
+
`Removing beverage ${beverage.id} from nozzle ${this.path} due to rebuild update`
|
|
2106
|
+
);
|
|
2135
2107
|
this._availabilityItems.removeModel(beverage.id);
|
|
2136
2108
|
destroyKosModel(beverage);
|
|
2137
2109
|
});
|
|
2138
|
-
for (const beverageData of
|
|
2110
|
+
for (const beverageData of update?.groups[group] || []) {
|
|
2139
2111
|
const extensionData = await ExtensionManager.dataMapper.executeMapper(
|
|
2140
2112
|
ExtensionType.AvailabilityMapper,
|
|
2141
2113
|
{ ...beverageData, groupId: group },
|
|
@@ -2155,8 +2127,16 @@ let NozzleModelImpl = class {
|
|
|
2155
2127
|
`${this.id}-${group}-${beverageData.id}`
|
|
2156
2128
|
);
|
|
2157
2129
|
if (existing) {
|
|
2130
|
+
if (existing.available !== beverageOptions.available) {
|
|
2131
|
+
this.logger.info(
|
|
2132
|
+
`Updating availability of beverage ${existing.id} in nozzle ${this.path} to ${beverageOptions.available}`
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2158
2135
|
existing.updateModel(beverageOptions);
|
|
2159
2136
|
} else {
|
|
2137
|
+
this.logger.info(
|
|
2138
|
+
`Adding beverage ${beverageData.id} to nozzle ${this.path}`
|
|
2139
|
+
);
|
|
2160
2140
|
const beverage = Availability.factory(
|
|
2161
2141
|
`${this.id}-${group}-${beverageData.id}`
|
|
2162
2142
|
)(beverageOptions);
|
|
@@ -2165,8 +2145,11 @@ let NozzleModelImpl = class {
|
|
|
2165
2145
|
}
|
|
2166
2146
|
}
|
|
2167
2147
|
} else {
|
|
2168
|
-
|
|
2169
|
-
|
|
2148
|
+
this.logger.info(
|
|
2149
|
+
`Received delta update for nozzle ${this.path}, updating availability nodes`
|
|
2150
|
+
);
|
|
2151
|
+
for (const group of Object.keys(update?.groups) || []) {
|
|
2152
|
+
for (const beverageData of update?.groups[group] || []) {
|
|
2170
2153
|
const extensionData = await ExtensionManager.dataMapper.executeMapper(
|
|
2171
2154
|
ExtensionType.AvailabilityMapper,
|
|
2172
2155
|
{ ...beverageData, groupId: group },
|
|
@@ -2187,6 +2170,11 @@ let NozzleModelImpl = class {
|
|
|
2187
2170
|
`${this.id}-${group}-${beverageData.id}`
|
|
2188
2171
|
);
|
|
2189
2172
|
if (existing) {
|
|
2173
|
+
if (existing.available !== beverageOptions.available) {
|
|
2174
|
+
this.logger.info(
|
|
2175
|
+
`Updating availability of beverage ${existing.id} in nozzle ${this.path} to ${beverageOptions.available}`
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2190
2178
|
existing.updateModel(beverageOptions);
|
|
2191
2179
|
}
|
|
2192
2180
|
}
|
|
@@ -2196,42 +2184,42 @@ let NozzleModelImpl = class {
|
|
|
2196
2184
|
}
|
|
2197
2185
|
// -------------------ENTITY----------------------------
|
|
2198
2186
|
};
|
|
2199
|
-
__decorateClass$
|
|
2187
|
+
__decorateClass$3([
|
|
2200
2188
|
kosChild
|
|
2201
2189
|
], NozzleModelImpl.prototype, "_availabilityItems", 2);
|
|
2202
|
-
__decorateClass$
|
|
2190
|
+
__decorateClass$3([
|
|
2203
2191
|
kosStateEntry(PourState.POURING)
|
|
2204
2192
|
], NozzleModelImpl.prototype, "handlePouringStart", 1);
|
|
2205
|
-
__decorateClass$
|
|
2193
|
+
__decorateClass$3([
|
|
2206
2194
|
kosStateExit(PourState.POURING)
|
|
2207
2195
|
], NozzleModelImpl.prototype, "handlePouringEnd", 1);
|
|
2208
|
-
__decorateClass$
|
|
2196
|
+
__decorateClass$3([
|
|
2209
2197
|
kosStateEntry(PourState.POUR_CANCELING)
|
|
2210
2198
|
], NozzleModelImpl.prototype, "handleCancelStart", 1);
|
|
2211
|
-
__decorateClass$
|
|
2199
|
+
__decorateClass$3([
|
|
2212
2200
|
kosStateExit(PourState.POUR_CANCELING)
|
|
2213
2201
|
], NozzleModelImpl.prototype, "handleCanceled", 1);
|
|
2214
|
-
__decorateClass$
|
|
2202
|
+
__decorateClass$3([
|
|
2215
2203
|
kosFuture(),
|
|
2216
2204
|
kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2217
2205
|
], NozzleModelImpl.prototype, "pour", 1);
|
|
2218
|
-
__decorateClass$
|
|
2206
|
+
__decorateClass$3([
|
|
2219
2207
|
kosFuture(),
|
|
2220
2208
|
kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2221
2209
|
], NozzleModelImpl.prototype, "fixedPour", 1);
|
|
2222
|
-
__decorateClass$
|
|
2210
|
+
__decorateClass$3([
|
|
2223
2211
|
kosStateGuard({
|
|
2224
2212
|
allowedStates: [PourState.POUR_STARTING, PourState.POURING]
|
|
2225
2213
|
})
|
|
2226
2214
|
], NozzleModelImpl.prototype, "cancelPour", 1);
|
|
2227
|
-
__decorateClass$
|
|
2215
|
+
__decorateClass$3([
|
|
2228
2216
|
kosTopicHandler({
|
|
2229
2217
|
topic: `${PROP_BEVERAGE_TOPIC_PREFIX}/availability`,
|
|
2230
2218
|
websocket: true
|
|
2231
2219
|
})
|
|
2232
2220
|
], NozzleModelImpl.prototype, "updateAvailability", 1);
|
|
2233
|
-
NozzleModelImpl = __decorateClass$
|
|
2234
|
-
kosModel({ modelTypeId: MODEL_TYPE$
|
|
2221
|
+
NozzleModelImpl = __decorateClass$3([
|
|
2222
|
+
kosModel({ modelTypeId: MODEL_TYPE$3, singleton: false }),
|
|
2235
2223
|
kosLoggerAware(),
|
|
2236
2224
|
kosStateMachine(
|
|
2237
2225
|
{
|
|
@@ -2272,15 +2260,391 @@ NozzleModelImpl = __decorateClass$2([
|
|
|
2272
2260
|
], NozzleModelImpl);
|
|
2273
2261
|
const Nozzle = {
|
|
2274
2262
|
registration: {
|
|
2275
|
-
[MODEL_TYPE$
|
|
2263
|
+
[MODEL_TYPE$3]: {
|
|
2276
2264
|
class: NozzleModelImpl,
|
|
2277
2265
|
singleton: false
|
|
2278
2266
|
}
|
|
2279
2267
|
},
|
|
2280
|
-
type: MODEL_TYPE$
|
|
2281
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
2282
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
2268
|
+
type: MODEL_TYPE$3,
|
|
2269
|
+
predicate: isKosModel(MODEL_TYPE$3),
|
|
2270
|
+
factory: Kos.Factory.create(MODEL_TYPE$3)
|
|
2283
2271
|
};
|
|
2272
|
+
var __defProp$2 = Object.defineProperty;
|
|
2273
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2274
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2275
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2276
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2277
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2278
|
+
if (decorator = decorators[i])
|
|
2279
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2280
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2281
|
+
return result;
|
|
2282
|
+
};
|
|
2283
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
2284
|
+
const MODEL_TYPE$2 = "cui-kit-state-model";
|
|
2285
|
+
const MODEL_CONFIG = {
|
|
2286
|
+
modelTypeId: MODEL_TYPE$2,
|
|
2287
|
+
singleton: false
|
|
2288
|
+
};
|
|
2289
|
+
const cuiKitId = (nozzlePath) => `cui-kit:${nozzlePath}`;
|
|
2290
|
+
let CuiKitStateModelImpl = class {
|
|
2291
|
+
id;
|
|
2292
|
+
nozzlePath;
|
|
2293
|
+
initialGroup;
|
|
2294
|
+
steps;
|
|
2295
|
+
companionTypes;
|
|
2296
|
+
currentGroup;
|
|
2297
|
+
selectedBrand = null;
|
|
2298
|
+
selectedBeverage = null;
|
|
2299
|
+
selectedFlavors = [];
|
|
2300
|
+
pourStrategy;
|
|
2301
|
+
onPourComplete;
|
|
2302
|
+
/** Data passed to the before-pour gate; carries `selectedBeverage`. */
|
|
2303
|
+
pourContext = new PourContext();
|
|
2304
|
+
/** The target of the last pour the kit started. */
|
|
2305
|
+
activeTarget;
|
|
2306
|
+
beforePour;
|
|
2307
|
+
pressCount = 0;
|
|
2308
|
+
released = true;
|
|
2309
|
+
lastPourState;
|
|
2310
|
+
lastPourError;
|
|
2311
|
+
nozzle;
|
|
2312
|
+
constructor(modelId, options) {
|
|
2313
|
+
this.id = modelId;
|
|
2314
|
+
this.nozzlePath = options.nozzlePath;
|
|
2315
|
+
this.initialGroup = options.initialGroup ?? "brands";
|
|
2316
|
+
this.steps = options.steps;
|
|
2317
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2318
|
+
this.pourStrategy = options.pour?.strategy;
|
|
2319
|
+
this.onPourComplete = options.onPourComplete;
|
|
2320
|
+
this.currentGroup = this.firstGroup;
|
|
2321
|
+
if (options.steps && options.initialGroup) {
|
|
2322
|
+
throw new Error(
|
|
2323
|
+
"CUI Kit: pass steps or initialGroup, not both (initialGroup is replaced by steps.brands)"
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
updateModel(options) {
|
|
2328
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2329
|
+
}
|
|
2330
|
+
// -------------------STEPS----------------------------
|
|
2331
|
+
/** The steps shown, in order. */
|
|
2332
|
+
get enabledSteps() {
|
|
2333
|
+
if (!this.steps) {
|
|
2334
|
+
return this.initialGroup === "brands" ? ["brands", "beverages", "flavors"] : ["beverages", "flavors"];
|
|
2335
|
+
}
|
|
2336
|
+
return [
|
|
2337
|
+
...this.steps.brands ? ["brands"] : [],
|
|
2338
|
+
"beverages",
|
|
2339
|
+
...this.steps.flavors ? ["flavors"] : [],
|
|
2340
|
+
...this.steps.pour ? ["pour"] : []
|
|
2341
|
+
];
|
|
2342
|
+
}
|
|
2343
|
+
/** The step navigation starts at and `home()` returns to. */
|
|
2344
|
+
get firstGroup() {
|
|
2345
|
+
if (!this.steps) return this.initialGroup;
|
|
2346
|
+
return this.steps.brands ? "brands" : "beverages";
|
|
2347
|
+
}
|
|
2348
|
+
/** The step `back()` moves to, or undefined when there is none. */
|
|
2349
|
+
get previousGroup() {
|
|
2350
|
+
if (!this.steps) {
|
|
2351
|
+
return this.currentGroup === "brands" ? void 0 : this.initialGroup;
|
|
2352
|
+
}
|
|
2353
|
+
const steps = this.enabledSteps;
|
|
2354
|
+
const index = steps.indexOf(this.currentGroup);
|
|
2355
|
+
return index > 0 ? steps[index - 1] : void 0;
|
|
2356
|
+
}
|
|
2357
|
+
get canBack() {
|
|
2358
|
+
return this.previousGroup !== void 0;
|
|
2359
|
+
}
|
|
2360
|
+
// -------------------LISTS----------------------------
|
|
2361
|
+
get brands() {
|
|
2362
|
+
return this.nozzle?.visibleBrands ?? [];
|
|
2363
|
+
}
|
|
2364
|
+
/** Whether the kit shows a brands step; without `steps` it follows `initialGroup`. */
|
|
2365
|
+
get hasBrands() {
|
|
2366
|
+
return this.enabledSteps.includes("brands");
|
|
2367
|
+
}
|
|
2368
|
+
get beverages() {
|
|
2369
|
+
if (!this.nozzle) return [];
|
|
2370
|
+
const brand = this.steps && !this.hasBrands ? void 0 : this.nozzle.selectedBrand;
|
|
2371
|
+
const items = brand ? this.nozzle.getAvailabilityByParent(brand.id) : this.nozzle.getGroupAvailabilityItems("beverages");
|
|
2372
|
+
return items.filter((item) => item.visible);
|
|
2373
|
+
}
|
|
2374
|
+
get flavors() {
|
|
2375
|
+
return this.nozzle?.getGroupAvailabilityItems("flavors").filter((flavor) => flavor.visible) ?? [];
|
|
2376
|
+
}
|
|
2377
|
+
get brandCompanions() {
|
|
2378
|
+
return this.companionsOf(this.brands, this.companionTypes.brand);
|
|
2379
|
+
}
|
|
2380
|
+
get beverageCompanions() {
|
|
2381
|
+
return this.companionsOf(this.beverages, this.companionTypes.beverage);
|
|
2382
|
+
}
|
|
2383
|
+
get flavorCompanions() {
|
|
2384
|
+
return this.companionsOf(this.flavors, this.companionTypes.flavor);
|
|
2385
|
+
}
|
|
2386
|
+
companionsOf(models, type) {
|
|
2387
|
+
if (!type) return [];
|
|
2388
|
+
return models.map((model) => getKosCompanionModel(model, type));
|
|
2389
|
+
}
|
|
2390
|
+
// -------------------SELECTION----------------------------
|
|
2391
|
+
selectBrand(brand, context) {
|
|
2392
|
+
this.selectedBrand = brand;
|
|
2393
|
+
this.nozzle?.setSelectedBrand(brand, context);
|
|
2394
|
+
this.currentGroup = "beverages";
|
|
2395
|
+
this.publish("brand/selected", brand);
|
|
2396
|
+
}
|
|
2397
|
+
clearBrand() {
|
|
2398
|
+
this.selectedBrand = null;
|
|
2399
|
+
this.nozzle?.setSelectedBrand(void 0);
|
|
2400
|
+
this.publish("brand/cleared", {});
|
|
2401
|
+
}
|
|
2402
|
+
async selectBeverage(beverage, context, forceUpdate) {
|
|
2403
|
+
this.selectedBeverage = beverage;
|
|
2404
|
+
this.pourContext.set("selectedBeverage", beverage);
|
|
2405
|
+
await this.nozzle?.setSelectedPourable({ beverage, context }, forceUpdate);
|
|
2406
|
+
if (!this.steps || this.steps.flavors) {
|
|
2407
|
+
this.currentGroup = "flavors";
|
|
2408
|
+
}
|
|
2409
|
+
this.publish("beverage/selected", beverage);
|
|
2410
|
+
}
|
|
2411
|
+
async clearBeverage() {
|
|
2412
|
+
this.selectedBeverage = null;
|
|
2413
|
+
this.pourContext.remove("selectedBeverage");
|
|
2414
|
+
await this.nozzle?.setSelectedPourable({ beverage: void 0 });
|
|
2415
|
+
this.publish("beverage/cleared", {});
|
|
2416
|
+
}
|
|
2417
|
+
/** Toggles a flavor and sends the beverage with the resulting flavors to the nozzle. */
|
|
2418
|
+
async selectFlavor(flavor, context, forceUpdate) {
|
|
2419
|
+
const flavors = this.selectedFlavors.includes(flavor) ? this.selectedFlavors.filter((selected) => selected !== flavor) : [...this.selectedFlavors, flavor];
|
|
2420
|
+
this.selectedFlavors = flavors;
|
|
2421
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2422
|
+
if (beverage) {
|
|
2423
|
+
await this.nozzle.setSelectedPourable(
|
|
2424
|
+
{ beverage, additional: flavors, context },
|
|
2425
|
+
forceUpdate
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
this.publish("flavor/selected", flavor);
|
|
2429
|
+
}
|
|
2430
|
+
async clearFlavors() {
|
|
2431
|
+
this.selectedFlavors = [];
|
|
2432
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2433
|
+
if (beverage) {
|
|
2434
|
+
await this.nozzle.setSelectedPourable({ beverage });
|
|
2435
|
+
this.publish("flavor/cleared", {});
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
// -------------------NAVIGATION----------------------------
|
|
2439
|
+
/** Moves to the previous step. Without `steps`, returns to the start and clears brand and beverage. */
|
|
2440
|
+
back() {
|
|
2441
|
+
if (!this.steps) {
|
|
2442
|
+
if (this.currentGroup !== "brands") {
|
|
2443
|
+
this.currentGroup = this.initialGroup;
|
|
2444
|
+
}
|
|
2445
|
+
void this.clearBeverage();
|
|
2446
|
+
this.clearBrand();
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
const previous = this.previousGroup;
|
|
2450
|
+
if (previous) {
|
|
2451
|
+
this.currentGroup = previous;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
/** Returns to the first step and clears the selections. */
|
|
2455
|
+
home() {
|
|
2456
|
+
this.publish("home", {});
|
|
2457
|
+
this.currentGroup = this.firstGroup;
|
|
2458
|
+
if (this.steps) {
|
|
2459
|
+
void this.clearFlavors();
|
|
2460
|
+
void this.clearBeverage();
|
|
2461
|
+
if (this.steps.brands) this.clearBrand();
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2464
|
+
void this.clearBeverage();
|
|
2465
|
+
if (this.initialGroup === "brands") {
|
|
2466
|
+
this.clearBrand();
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
/** Number of `useCuiKit` hooks attached to this kit. */
|
|
2470
|
+
attached = 0;
|
|
2471
|
+
/**
|
|
2472
|
+
* Attaches a `useCuiKit` hook. A nozzle has one kit hook; components read it through
|
|
2473
|
+
* the kit's context. Returns false, and logs an error, for a second hook.
|
|
2474
|
+
*/
|
|
2475
|
+
attach() {
|
|
2476
|
+
this.attached += 1;
|
|
2477
|
+
if (this.attached > 1) {
|
|
2478
|
+
this.logger.error(
|
|
2479
|
+
`useCuiKit is mounted ${this.attached} times for nozzle ${this.nozzlePath}; read the kit with the useCuiKitContext hook returned by initializeCuiKit`
|
|
2480
|
+
);
|
|
2481
|
+
return false;
|
|
2482
|
+
}
|
|
2483
|
+
return true;
|
|
2484
|
+
}
|
|
2485
|
+
detach() {
|
|
2486
|
+
this.attached = Math.max(0, this.attached - 1);
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Returns the kit to the first step with nothing selected, as a newly mounted kit
|
|
2490
|
+
* starts. The nozzle's own selection is left as it is.
|
|
2491
|
+
*/
|
|
2492
|
+
reset() {
|
|
2493
|
+
this.currentGroup = this.firstGroup;
|
|
2494
|
+
this.selectedBrand = null;
|
|
2495
|
+
this.selectedBeverage = null;
|
|
2496
|
+
this.selectedFlavors = [];
|
|
2497
|
+
this.pourContext.remove("selectedBeverage");
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Moves to the pour step. Only available when `steps.pour` is on. With `start`, also
|
|
2501
|
+
* starts a pour; ignored, with a warning, when the pour needs a held button.
|
|
2502
|
+
*/
|
|
2503
|
+
toPour(options = {}) {
|
|
2504
|
+
if (!this.steps?.pour) {
|
|
2505
|
+
this.logger.warn("toPour() ignored: the pour step is not enabled");
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
this.currentGroup = "pour";
|
|
2509
|
+
if (!options.start) return;
|
|
2510
|
+
if (!options.fixedPourName && this.strategyFor(options)?.requiresHold) {
|
|
2511
|
+
this.logger.warn(
|
|
2512
|
+
"toPour({ start: true }) ignored: the pour strategy needs a held button"
|
|
2513
|
+
);
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
void this.startPour(options);
|
|
2517
|
+
}
|
|
2518
|
+
// -------------------POUR----------------------------
|
|
2519
|
+
/** Sets the before-pour gate the kit calls before every pour. */
|
|
2520
|
+
setBeforePour(callback) {
|
|
2521
|
+
this.beforePour = callback;
|
|
2522
|
+
}
|
|
2523
|
+
/** Starts a pour without a gesture (a click-to-pour button or an automated pour). */
|
|
2524
|
+
startPour(options = {}) {
|
|
2525
|
+
return this.runPour(options, false);
|
|
2526
|
+
}
|
|
2527
|
+
/** The press half of a pour gesture; `releasePour` is the release. */
|
|
2528
|
+
pressPour(options = {}) {
|
|
2529
|
+
return this.runPour(options, true);
|
|
2530
|
+
}
|
|
2531
|
+
/** The release half of a pour gesture. */
|
|
2532
|
+
releasePour(options = {}) {
|
|
2533
|
+
this.released = true;
|
|
2534
|
+
const target = options.target ?? this.nozzle;
|
|
2535
|
+
const ended = this.strategyFor(options)?.initiateEnded?.(target);
|
|
2536
|
+
void Promise.resolve(ended).then((keepPouring) => {
|
|
2537
|
+
if (keepPouring !== true) {
|
|
2538
|
+
this.publish("pour/cancel", {});
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
/** Cancels the pour the kit started last. */
|
|
2543
|
+
async cancelPour() {
|
|
2544
|
+
await (this.activeTarget ?? this.nozzle)?.cancelPour();
|
|
2545
|
+
this.publish("pour/cancel", {});
|
|
2546
|
+
}
|
|
2547
|
+
/** The pour target whose state the kit reports: the last one poured, else the nozzle. */
|
|
2548
|
+
get pourTarget() {
|
|
2549
|
+
return this.activeTarget ?? this.nozzle;
|
|
2550
|
+
}
|
|
2551
|
+
strategyFor(options) {
|
|
2552
|
+
return options.strategy ?? this.pourStrategy;
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* select → prepare → before-pour gate → pour. While the target is pouring nothing is
|
|
2556
|
+
* selected; for a gesture, a release before the pour starts stops the sequence.
|
|
2557
|
+
*/
|
|
2558
|
+
async runPour(options, gesture) {
|
|
2559
|
+
const press = ++this.pressCount;
|
|
2560
|
+
this.released = false;
|
|
2561
|
+
const target = options.target ?? this.nozzle;
|
|
2562
|
+
const strategy = this.strategyFor(options);
|
|
2563
|
+
if (!target || !strategy && !options.fixedPourName) {
|
|
2564
|
+
this.logger.error("pour ignored: no pour target or strategy");
|
|
2565
|
+
return false;
|
|
2566
|
+
}
|
|
2567
|
+
const releasedEarly = () => gesture && (this.released || press !== this.pressCount);
|
|
2568
|
+
if (options.select && !target.isPouring) {
|
|
2569
|
+
await this.selectForPour(options.select);
|
|
2570
|
+
}
|
|
2571
|
+
if (releasedEarly()) return false;
|
|
2572
|
+
await options.prepare?.(this.pourContext);
|
|
2573
|
+
if (releasedEarly()) return false;
|
|
2574
|
+
this.publish("pre/pour", {});
|
|
2575
|
+
await this.beforePour?.(this.pourContext) || true;
|
|
2576
|
+
if (releasedEarly()) return false;
|
|
2577
|
+
this.activeTarget = target;
|
|
2578
|
+
this.lastPourError = void 0;
|
|
2579
|
+
const started = options.fixedPourName ? this.nozzle.fixedPour(options.fixedPourName) : strategy?.initiate(target);
|
|
2580
|
+
void Promise.resolve(started).catch((error) => {
|
|
2581
|
+
this.lastPourError = error;
|
|
2582
|
+
this.logger.error(`pour failed: ${error}`);
|
|
2583
|
+
});
|
|
2584
|
+
this.publish("pour", {});
|
|
2585
|
+
return true;
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* Selects a beverage, and its brand first when the kit has a brands step, and waits
|
|
2589
|
+
* for the nozzle.
|
|
2590
|
+
*/
|
|
2591
|
+
async selectForPour(beverage) {
|
|
2592
|
+
const brand = this.hasBrands ? this.nozzle?.brands.find((b) => b.id === beverage.parentId) : void 0;
|
|
2593
|
+
if (brand && this.selectedBrand !== brand) {
|
|
2594
|
+
this.selectBrand(brand);
|
|
2595
|
+
}
|
|
2596
|
+
if (this.selectedBeverage !== beverage) {
|
|
2597
|
+
await this.selectBeverage(beverage);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
trackPourCompletion() {
|
|
2601
|
+
const state = this.pourTarget?.currentState;
|
|
2602
|
+
const previous = this.lastPourState;
|
|
2603
|
+
this.lastPourState = state;
|
|
2604
|
+
const completed = state === PourState.IDLE && (previous === PourState.POURING || previous === PourState.POUR_STARTING);
|
|
2605
|
+
if (!completed || !this.onPourComplete) return;
|
|
2606
|
+
const target = this.pourTarget;
|
|
2607
|
+
const endState = target?.future?.endState;
|
|
2608
|
+
setTimeout(() => {
|
|
2609
|
+
this.onPourComplete?.({ endState, error: this.lastPourError });
|
|
2610
|
+
}, 0);
|
|
2611
|
+
}
|
|
2612
|
+
publishBeverageList() {
|
|
2613
|
+
this.publish("beverage/list/updated", this.beverages);
|
|
2614
|
+
}
|
|
2615
|
+
publish(path, body) {
|
|
2616
|
+
EventBus.publish(`/kos/dispense/${this.nozzlePath}/${path}/`, body);
|
|
2617
|
+
}
|
|
2618
|
+
// -------------------LIFECYCLE----------------------------
|
|
2619
|
+
async init() {
|
|
2620
|
+
this.logger.debug(`initializing cui-kit-state ${this.id}`);
|
|
2621
|
+
}
|
|
2622
|
+
};
|
|
2623
|
+
__publicField(CuiKitStateModelImpl, "Registration");
|
|
2624
|
+
__decorateClass$2([
|
|
2625
|
+
kosDependency({
|
|
2626
|
+
modelType: Nozzle.type,
|
|
2627
|
+
id: createPropKey("nozzlePath")
|
|
2628
|
+
})
|
|
2629
|
+
], CuiKitStateModelImpl.prototype, "nozzle", 2);
|
|
2630
|
+
__decorateClass$2([
|
|
2631
|
+
kosModelEffect({
|
|
2632
|
+
dependencies: (model) => [
|
|
2633
|
+
model.pourTarget?.currentState
|
|
2634
|
+
]
|
|
2635
|
+
})
|
|
2636
|
+
], CuiKitStateModelImpl.prototype, "trackPourCompletion", 1);
|
|
2637
|
+
__decorateClass$2([
|
|
2638
|
+
kosModelEffect({
|
|
2639
|
+
dependencies: (model) => [model.beverages],
|
|
2640
|
+
options: { fireImmediately: true }
|
|
2641
|
+
})
|
|
2642
|
+
], CuiKitStateModelImpl.prototype, "publishBeverageList", 1);
|
|
2643
|
+
CuiKitStateModelImpl = __decorateClass$2([
|
|
2644
|
+
kosModel(MODEL_CONFIG),
|
|
2645
|
+
kosLoggerAware()
|
|
2646
|
+
], CuiKitStateModelImpl);
|
|
2647
|
+
const CuiKitState = CuiKitStateModelImpl.Registration;
|
|
2284
2648
|
var __defProp$1 = Object.defineProperty;
|
|
2285
2649
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2286
2650
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
@@ -2288,16 +2652,15 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
|
2288
2652
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2289
2653
|
if (decorator = decorators[i])
|
|
2290
2654
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2291
|
-
if (kind && result)
|
|
2292
|
-
__defProp$1(target, key, result);
|
|
2655
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
2293
2656
|
return result;
|
|
2294
2657
|
};
|
|
2295
2658
|
const MODEL_TYPE$1 = "device-assembly-model";
|
|
2296
2659
|
let DeviceAssemblyModelImpl = class {
|
|
2660
|
+
id;
|
|
2661
|
+
deviceNozzles;
|
|
2662
|
+
logger;
|
|
2297
2663
|
constructor(modelId, _options, context) {
|
|
2298
|
-
__publicField(this, "id");
|
|
2299
|
-
__publicField(this, "deviceNozzles");
|
|
2300
|
-
__publicField(this, "logger");
|
|
2301
2664
|
this.id = modelId;
|
|
2302
2665
|
this.logger = context.logger;
|
|
2303
2666
|
this.deviceNozzles = new KosModelContainer();
|
|
@@ -2315,12 +2678,11 @@ let DeviceAssemblyModelImpl = class {
|
|
|
2315
2678
|
async load() {
|
|
2316
2679
|
this.logger.debug(`loading device-assembly ${this.id}`);
|
|
2317
2680
|
const result = await getAssembly();
|
|
2318
|
-
if (
|
|
2681
|
+
if (result?.status === 200) {
|
|
2319
2682
|
const nozzles = result.data.assemblies.map((assembly) => assembly.nozzles ?? []).flat();
|
|
2320
2683
|
nozzles.forEach((nozzleData) => {
|
|
2321
|
-
var _a;
|
|
2322
2684
|
const nozzleId = nozzleData.path;
|
|
2323
|
-
const beverageTopicPrefix =
|
|
2685
|
+
const beverageTopicPrefix = nozzleData.pipelines.find((pipeline) => pipeline.name === "beverage")?.topicPrefix || "";
|
|
2324
2686
|
const nozzle = Nozzle.factory(nozzleId)({
|
|
2325
2687
|
path: nozzleData.path,
|
|
2326
2688
|
name: nozzleData.name,
|
|
@@ -2354,20 +2716,19 @@ const pourOnTarget = async (path, tracker) => {
|
|
|
2354
2716
|
ordered: true,
|
|
2355
2717
|
tracker
|
|
2356
2718
|
});
|
|
2357
|
-
if (response
|
|
2719
|
+
if (response?.data) {
|
|
2358
2720
|
FutureManager.initiateFuture(response.data);
|
|
2359
2721
|
}
|
|
2360
2722
|
return response;
|
|
2361
2723
|
};
|
|
2362
|
-
var
|
|
2724
|
+
var __defProp = Object.defineProperty;
|
|
2363
2725
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2364
2726
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
2365
2727
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
2366
2728
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2367
2729
|
if (decorator = decorators[i])
|
|
2368
2730
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2369
|
-
if (kind && result)
|
|
2370
|
-
__defProp2(target, key, result);
|
|
2731
|
+
if (kind && result) __defProp(target, key, result);
|
|
2371
2732
|
return result;
|
|
2372
2733
|
};
|
|
2373
2734
|
const MODEL_TYPE = "generic-pour-model";
|
|
@@ -2376,18 +2737,18 @@ const TOPIC_GENERIC_POUR_PROGRESS = "/kos/generic/pour/progress";
|
|
|
2376
2737
|
const TOPIC_GENERIC_POUR_CANCEL = "/kos/generic/pour/cancel";
|
|
2377
2738
|
const isPourAware = (model) => model.onPourStart !== void 0 && model.onPourCancel !== void 0 && model.onPourProgress !== void 0;
|
|
2378
2739
|
let GenericPourModelImpl = class {
|
|
2740
|
+
id;
|
|
2741
|
+
/**
|
|
2742
|
+
* @kosApiLevel 5
|
|
2743
|
+
*/
|
|
2744
|
+
servicePathFactory;
|
|
2745
|
+
pourType;
|
|
2746
|
+
/**
|
|
2747
|
+
* @kosApiLevel 5
|
|
2748
|
+
*/
|
|
2749
|
+
selectedId;
|
|
2750
|
+
state;
|
|
2379
2751
|
constructor(modelId, options) {
|
|
2380
|
-
__publicField(this, "id");
|
|
2381
|
-
/**
|
|
2382
|
-
* @kosApiLevel 5
|
|
2383
|
-
*/
|
|
2384
|
-
__publicField(this, "servicePathFactory");
|
|
2385
|
-
__publicField(this, "pourType");
|
|
2386
|
-
/**
|
|
2387
|
-
* @kosApiLevel 5
|
|
2388
|
-
*/
|
|
2389
|
-
__publicField(this, "selectedId");
|
|
2390
|
-
__publicField(this, "state");
|
|
2391
2752
|
this.id = modelId;
|
|
2392
2753
|
this.futureHandler = new FutureHandler(this);
|
|
2393
2754
|
this.servicePathFactory = options.servicePathFactory;
|
|
@@ -2433,9 +2794,8 @@ let GenericPourModelImpl = class {
|
|
|
2433
2794
|
handlePouringStart() {
|
|
2434
2795
|
this.logger.info("Pour started");
|
|
2435
2796
|
getAllKosCompanionModels(this).forEach((model) => {
|
|
2436
|
-
var _a;
|
|
2437
2797
|
if (isPourAware(model)) {
|
|
2438
|
-
|
|
2798
|
+
model.onPourStart?.();
|
|
2439
2799
|
}
|
|
2440
2800
|
});
|
|
2441
2801
|
const evt = {
|
|
@@ -2453,9 +2813,8 @@ let GenericPourModelImpl = class {
|
|
|
2453
2813
|
handleCanceled() {
|
|
2454
2814
|
this.logger.info("Pour canceled");
|
|
2455
2815
|
getAllKosCompanionModels(this).forEach((model) => {
|
|
2456
|
-
var _a;
|
|
2457
2816
|
if (isPourAware(model)) {
|
|
2458
|
-
|
|
2817
|
+
model.onPourCancel?.();
|
|
2459
2818
|
}
|
|
2460
2819
|
});
|
|
2461
2820
|
const evt = {
|
|
@@ -2465,7 +2824,6 @@ let GenericPourModelImpl = class {
|
|
|
2465
2824
|
}
|
|
2466
2825
|
// Inherits throwOnInvalid: false from class
|
|
2467
2826
|
async pour(tracker) {
|
|
2468
|
-
var _a;
|
|
2469
2827
|
try {
|
|
2470
2828
|
this.transition("START_POUR");
|
|
2471
2829
|
if (!tracker) {
|
|
@@ -2473,7 +2831,7 @@ let GenericPourModelImpl = class {
|
|
|
2473
2831
|
}
|
|
2474
2832
|
const result = await pourOnTarget(this.servicePath, tracker);
|
|
2475
2833
|
this.transition("POUR_ACTIVE");
|
|
2476
|
-
if (
|
|
2834
|
+
if (result?.data?.endState) {
|
|
2477
2835
|
this.transition("POUR_COMPLETED");
|
|
2478
2836
|
}
|
|
2479
2837
|
return result;
|
|
@@ -2487,9 +2845,8 @@ let GenericPourModelImpl = class {
|
|
|
2487
2845
|
}
|
|
2488
2846
|
// Inherits throwOnInvalid: false - silently ignore if already idle
|
|
2489
2847
|
async cancelPour() {
|
|
2490
|
-
var _a;
|
|
2491
2848
|
this.transition("CANCEL_POUR");
|
|
2492
|
-
await
|
|
2849
|
+
await this.futureHandler.getFuture()?.cancelFuture();
|
|
2493
2850
|
this.transition("POUR_CANCELED");
|
|
2494
2851
|
}
|
|
2495
2852
|
// ============================================================================
|
|
@@ -2500,8 +2857,7 @@ let GenericPourModelImpl = class {
|
|
|
2500
2857
|
* @readonly
|
|
2501
2858
|
*/
|
|
2502
2859
|
get isPouring() {
|
|
2503
|
-
|
|
2504
|
-
return !!(this.future && !((_a = this.future) == null ? void 0 : _a.endState)) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING || this.currentState === PourState.POUR_CANCELING;
|
|
2860
|
+
return !!(this.future && !this.future?.endState) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING || this.currentState === PourState.POUR_CANCELING;
|
|
2505
2861
|
}
|
|
2506
2862
|
/**
|
|
2507
2863
|
* A derived value that indicates if the pour target is currently available to pour a beverage.
|
|
@@ -2626,9 +2982,10 @@ const kosModels = {
|
|
|
2626
2982
|
...Assembly.registration,
|
|
2627
2983
|
...BoardContainer.registration
|
|
2628
2984
|
};
|
|
2629
|
-
const registerDispenseModels = (root) => () => {
|
|
2630
|
-
registerCoreModels(root)();
|
|
2985
|
+
const registerDispenseModels = (root) => (options) => {
|
|
2986
|
+
registerCoreModels(root)(options);
|
|
2631
2987
|
DeviceAssembly.register();
|
|
2988
|
+
CuiKitState.register();
|
|
2632
2989
|
Object.keys(kosModels).forEach((key) => {
|
|
2633
2990
|
const model = kosModels[key];
|
|
2634
2991
|
registerLegacyModel(root)(key, model);
|
|
@@ -2636,8 +2993,7 @@ const registerDispenseModels = (root) => () => {
|
|
|
2636
2993
|
ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
2637
2994
|
"FirmwareUpdateInProgressTrouble",
|
|
2638
2995
|
async (trouble) => {
|
|
2639
|
-
|
|
2640
|
-
if ((_a = trouble.data) == null ? void 0 : _a.deviceId) {
|
|
2996
|
+
if (trouble.data?.deviceId) {
|
|
2641
2997
|
const { model: assemblyModel } = getKosModelSync(
|
|
2642
2998
|
Assembly.type
|
|
2643
2999
|
);
|
|
@@ -2660,12 +3016,16 @@ const registerDispenseModels = (root) => () => {
|
|
|
2660
3016
|
legacy: RegistrationManager.model.registerLegacyModel(root)
|
|
2661
3017
|
};
|
|
2662
3018
|
};
|
|
3019
|
+
const registerCuiKitModels = (root) => (options) => registerDispenseModels(root)(options);
|
|
2663
3020
|
const _KosModelRegistry = {
|
|
2664
3021
|
...KosModelRegistry$1
|
|
2665
3022
|
};
|
|
2666
3023
|
_KosModelRegistry.dispense = {
|
|
2667
3024
|
models: registerDispenseModels(_KosModelRegistry)
|
|
2668
3025
|
};
|
|
3026
|
+
_KosModelRegistry.cuiKit = {
|
|
3027
|
+
models: registerCuiKitModels(_KosModelRegistry)
|
|
3028
|
+
};
|
|
2669
3029
|
_KosModelRegistry.preload = RegistrationManager.model.preloadModel(_KosModelRegistry);
|
|
2670
3030
|
_KosModelRegistry.model = RegistrationManager.model.register(_KosModelRegistry);
|
|
2671
3031
|
_KosModelRegistry.companion = RegistrationManager.companion.register(_KosModelRegistry);
|
|
@@ -2673,52 +3033,54 @@ _KosModelRegistry.legacy = RegistrationManager.model.registerLegacyModel(_KosMod
|
|
|
2673
3033
|
const KosModelRegistry = _KosModelRegistry;
|
|
2674
3034
|
export {
|
|
2675
3035
|
Assembly as A,
|
|
2676
|
-
|
|
3036
|
+
Board as B,
|
|
2677
3037
|
CONTEXT_ASSEMBLY_DATA as C,
|
|
2678
|
-
|
|
3038
|
+
DeviceAssembly as D,
|
|
2679
3039
|
ExtensionType as E,
|
|
2680
|
-
|
|
3040
|
+
sendRfidOverride as F,
|
|
2681
3041
|
GenericPour as G,
|
|
2682
3042
|
Holder as H,
|
|
2683
3043
|
Ingredient as I,
|
|
2684
|
-
|
|
3044
|
+
unassignHolderIngredient as J,
|
|
2685
3045
|
KosModelRegistry as K,
|
|
2686
|
-
|
|
2687
|
-
|
|
3046
|
+
getAssembly as L,
|
|
3047
|
+
getIntentVolume as M,
|
|
2688
3048
|
Nozzle as N,
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
3049
|
+
sendIntent as O,
|
|
3050
|
+
PourContext as P,
|
|
3051
|
+
clearPourable as Q,
|
|
3052
|
+
getAvailability as R,
|
|
3053
|
+
pourNamedPourable as S,
|
|
2694
3054
|
TOPIC_BOARD_LINKED as T,
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
BoardContainer as
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
3055
|
+
pourPourable as U,
|
|
3056
|
+
selectPourable as V,
|
|
3057
|
+
pourOnTarget as W,
|
|
3058
|
+
cuiKitId as X,
|
|
3059
|
+
Availability as a,
|
|
3060
|
+
BoardContainer as b,
|
|
3061
|
+
BoardContainerModel as c,
|
|
3062
|
+
CONTEXT_ASSEMBLY_RAW_DATA as d,
|
|
3063
|
+
CuiKitState as e,
|
|
3064
|
+
DispenseModelType as f,
|
|
3065
|
+
HolderContainer as g,
|
|
3066
|
+
IngredientContainer as h,
|
|
3067
|
+
PourState as i,
|
|
3068
|
+
Pump as j,
|
|
3069
|
+
PumpContainer as k,
|
|
3070
|
+
PumpIndex as l,
|
|
3071
|
+
TOPIC_BOARD_UNLINKED as m,
|
|
3072
|
+
TOPIC_GENERIC_POUR_CANCEL as n,
|
|
3073
|
+
TOPIC_GENERIC_POUR_PROGRESS as o,
|
|
3074
|
+
TOPIC_GENERIC_POUR_STARTED as p,
|
|
3075
|
+
kosModels as q,
|
|
3076
|
+
registerCuiKitModels as r,
|
|
3077
|
+
registerDispenseModels as s,
|
|
3078
|
+
getIngredients as t,
|
|
3079
|
+
addAssignment as u,
|
|
3080
|
+
assignHolderIngredient as v,
|
|
3081
|
+
deleteAssignment as w,
|
|
3082
|
+
getAssignments as x,
|
|
3083
|
+
getHolders as y,
|
|
3084
|
+
replaceLine as z
|
|
3085
|
+
};
|
|
3086
|
+
//# sourceMappingURL=dispense-registration-manager-DtN0T_JG.js.map
|