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