@kosdev-code/kos-dispense-sdk 2.0.2
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/dispense-registration-manager-DxIbOft8.js +1759 -0
- package/dispense-registration-manager-DxIbOft8.js.map +1 -0
- package/dispense-registration-manager-aM9RAFHn.cjs +2 -0
- package/dispense-registration-manager-aM9RAFHn.cjs.map +1 -0
- package/extension-utils-hWIrDMX4.cjs +2 -0
- package/extension-utils-hWIrDMX4.cjs.map +1 -0
- package/extension-utils-qcU_4sXo.js +370 -0
- package/extension-utils-qcU_4sXo.js.map +1 -0
- package/index.cjs +2 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +103 -0
- package/index.js.map +1 -0
- package/models/constants/constants.d.ts +229 -0
- package/models/constants/constants.d.ts.map +1 -0
- package/models/constants/index.d.ts +2 -0
- package/models/constants/index.d.ts.map +1 -0
- package/models/index.d.ts +6 -0
- package/models/index.d.ts.map +1 -0
- package/models/models/assembly/assembly-model.d.ts +40 -0
- package/models/models/assembly/assembly-model.d.ts.map +1 -0
- package/models/models/assembly/assembly-registration.d.ts +81 -0
- package/models/models/assembly/assembly-registration.d.ts.map +1 -0
- package/models/models/assembly/board-utils.d.ts +6 -0
- package/models/models/assembly/board-utils.d.ts.map +1 -0
- package/models/models/assembly/holder-utils.d.ts +5 -0
- package/models/models/assembly/holder-utils.d.ts.map +1 -0
- package/models/models/assembly/index.d.ts +4 -0
- package/models/models/assembly/index.d.ts.map +1 -0
- package/models/models/assembly/nozzle-utils.d.ts +6 -0
- package/models/models/assembly/nozzle-utils.d.ts.map +1 -0
- package/models/models/assembly/pump-utils.d.ts +7 -0
- package/models/models/assembly/pump-utils.d.ts.map +1 -0
- package/models/models/assembly/services/assembly-services.d.ts +8 -0
- package/models/models/assembly/services/assembly-services.d.ts.map +1 -0
- package/models/models/assembly/services/index.d.ts +2 -0
- package/models/models/assembly/services/index.d.ts.map +1 -0
- package/models/models/assembly/types/index.d.ts +64 -0
- package/models/models/availability/availability-model.d.ts +89 -0
- package/models/models/availability/availability-model.d.ts.map +1 -0
- package/models/models/availability/index.d.ts +3 -0
- package/models/models/availability/index.d.ts.map +1 -0
- package/models/models/availability/types/index.d.ts +71 -0
- package/models/models/board/board-container-model.d.ts +23 -0
- package/models/models/board/board-container-model.d.ts.map +1 -0
- package/models/models/board/board-container-registration.d.ts +87 -0
- package/models/models/board/board-container-registration.d.ts.map +1 -0
- package/models/models/board/board-model.d.ts +18 -0
- package/models/models/board/board-model.d.ts.map +1 -0
- package/models/models/board/board-registration.d.ts +84 -0
- package/models/models/board/board-registration.d.ts.map +1 -0
- package/models/models/board/index.d.ts +5 -0
- package/models/models/board/index.d.ts.map +1 -0
- package/models/models/board/types/index.d.ts +36 -0
- package/models/models/board/types/services.d.ts +12 -0
- package/models/models/board/types/services.d.ts.map +1 -0
- package/models/models/board/utils/board-trouble-data-mapper.d.ts +7 -0
- package/models/models/board/utils/board-trouble-data-mapper.d.ts.map +1 -0
- package/models/models/board/utils/board-trouble-resolver.d.ts +7 -0
- package/models/models/board/utils/board-trouble-resolver.d.ts.map +1 -0
- package/models/models/device-assembly/device-assembly-model.d.ts +17 -0
- package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -0
- package/models/models/device-assembly/device-assembly-registration.d.ts +89 -0
- package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -0
- package/models/models/device-assembly/index.d.ts +4 -0
- package/models/models/device-assembly/index.d.ts.map +1 -0
- package/models/models/device-assembly/types/index.d.ts +1 -0
- package/models/models/holder/holder-model.d.ts +93 -0
- package/models/models/holder/holder-model.d.ts.map +1 -0
- package/models/models/holder/index.d.ts +5 -0
- package/models/models/holder/index.d.ts.map +1 -0
- package/models/models/holder/services/assignment-services.d.ts +25 -0
- package/models/models/holder/services/assignment-services.d.ts.map +1 -0
- package/models/models/holder/services/holder-services.d.ts +28 -0
- package/models/models/holder/services/holder-services.d.ts.map +1 -0
- package/models/models/holder/services/index.d.ts +3 -0
- package/models/models/holder/services/index.d.ts.map +1 -0
- package/models/models/holder/types/index.d.ts +163 -0
- package/models/models/holder/utils/holder-utils.d.ts +9 -0
- package/models/models/holder/utils/holder-utils.d.ts.map +1 -0
- package/models/models/holder-container/holder-container-model.d.ts +80 -0
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -0
- package/models/models/holder-container/index.d.ts +3 -0
- package/models/models/holder-container/index.d.ts.map +1 -0
- package/models/models/holder-container/types/index.d.ts +69 -0
- package/models/models/index.d.ts +13 -0
- package/models/models/index.d.ts.map +1 -0
- package/models/models/ingredient/index.d.ts +4 -0
- package/models/models/ingredient/index.d.ts.map +1 -0
- package/models/models/ingredient/ingredient-model.d.ts +86 -0
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -0
- package/models/models/ingredient/services/index.d.ts +2 -0
- package/models/models/ingredient/services/index.d.ts.map +1 -0
- package/models/models/ingredient/services/ingredient-services.d.ts +30 -0
- package/models/models/ingredient/services/ingredient-services.d.ts.map +1 -0
- package/models/models/ingredient/types/index.d.ts +67 -0
- package/models/models/ingredient-container/index.d.ts +3 -0
- package/models/models/ingredient-container/index.d.ts.map +1 -0
- package/models/models/ingredient-container/ingredient-container-model.d.ts +80 -0
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -0
- package/models/models/ingredient-container/types/index.d.ts +67 -0
- package/models/models/nozzle/index.d.ts +5 -0
- package/models/models/nozzle/index.d.ts.map +1 -0
- package/models/models/nozzle/nozzle-model.d.ts +257 -0
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -0
- package/models/models/nozzle/services/index.d.ts +2 -0
- package/models/models/nozzle/services/index.d.ts.map +1 -0
- package/models/models/nozzle/services/nozzle-services.d.ts +181 -0
- package/models/models/nozzle/services/nozzle-services.d.ts.map +1 -0
- package/models/models/nozzle/types/index.d.ts +85 -0
- package/models/models/pump/index.d.ts +4 -0
- package/models/models/pump/index.d.ts.map +1 -0
- package/models/models/pump/pump-model.d.ts +91 -0
- package/models/models/pump/pump-model.d.ts.map +1 -0
- package/models/models/pump/services/index.d.ts +2 -0
- package/models/models/pump/services/index.d.ts.map +1 -0
- package/models/models/pump/services/pump-services.d.ts +27 -0
- package/models/models/pump/services/pump-services.d.ts.map +1 -0
- package/models/models/pump/types/index.d.ts +55 -0
- package/models/models/pump/utils/pump-trouble-resolver.d.ts +8 -0
- package/models/models/pump/utils/pump-trouble-resolver.d.ts.map +1 -0
- package/models/models/pump-container/index.d.ts +3 -0
- package/models/models/pump-container/index.d.ts.map +1 -0
- package/models/models/pump-container/pump-container-model.d.ts +85 -0
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -0
- package/models/models/pump-container/types/index.d.ts +31 -0
- package/models/models/types/assembly.d.ts +83 -0
- package/models/models/types/assembly.d.ts.map +1 -0
- package/models/models/types/index.d.ts +4 -0
- package/models/models/types/index.d.ts.map +1 -0
- package/models/models/types/intent.d.ts +19 -0
- package/models/models/types/intent.d.ts.map +1 -0
- package/models/models/types/pouring.d.ts +9 -0
- package/models/models/types/pouring.d.ts.map +1 -0
- package/models/utils/dispense-registration-manager.d.ts +28 -0
- package/models/utils/dispense-registration-manager.d.ts.map +1 -0
- package/models/utils/extension-utils.d.ts +265 -0
- package/models/utils/extension-utils.d.ts.map +1 -0
- package/models/utils/openapi.d.ts +9276 -0
- package/models/utils/registration.d.ts +4 -0
- package/models/utils/registration.d.ts.map +1 -0
- package/models/utils/service.d.ts +64 -0
- package/models/utils/service.d.ts.map +1 -0
- package/models.cjs +2 -0
- package/models.cjs.map +1 -0
- package/models.d.ts +1 -0
- package/models.js +38 -0
- package/models.js.map +1 -0
- package/package.json +36 -0
- package/pump-provider-COTqsOH-.js +1013 -0
- package/pump-provider-COTqsOH-.js.map +1 -0
- package/pump-provider-D2HzZ2Bj.cjs +2 -0
- package/pump-provider-D2HzZ2Bj.cjs.map +1 -0
- package/ui/contexts/assembly/assembly-provider.d.ts +12 -0
- package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -0
- package/ui/contexts/assembly/index.d.ts +2 -0
- package/ui/contexts/assembly/index.d.ts.map +1 -0
- package/ui/contexts/availability/availability-provider.d.ts +13 -0
- package/ui/contexts/availability/availability-provider.d.ts.map +1 -0
- package/ui/contexts/availability/index.d.ts +2 -0
- package/ui/contexts/availability/index.d.ts.map +1 -0
- package/ui/contexts/board/board-provider.d.ts +13 -0
- package/ui/contexts/board/board-provider.d.ts.map +1 -0
- package/ui/contexts/board/index.d.ts +2 -0
- package/ui/contexts/board/index.d.ts.map +1 -0
- package/ui/contexts/board-container/board-container-provider.d.ts +12 -0
- package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -0
- package/ui/contexts/board-container/index.d.ts +2 -0
- package/ui/contexts/board-container/index.d.ts.map +1 -0
- package/ui/contexts/cui-kit/cui-kit.d.ts +22 -0
- package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -0
- package/ui/contexts/cui-kit/index.d.ts +2 -0
- package/ui/contexts/cui-kit/index.d.ts.map +1 -0
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts +12 -0
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -0
- package/ui/contexts/device-assembly/index.d.ts +2 -0
- package/ui/contexts/device-assembly/index.d.ts.map +1 -0
- package/ui/contexts/holder/holder-provider.d.ts +13 -0
- package/ui/contexts/holder/holder-provider.d.ts.map +1 -0
- package/ui/contexts/holder/index.d.ts +2 -0
- package/ui/contexts/holder/index.d.ts.map +1 -0
- package/ui/contexts/holder-container/holder-container-provider.d.ts +13 -0
- package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -0
- package/ui/contexts/holder-container/index.d.ts +2 -0
- package/ui/contexts/holder-container/index.d.ts.map +1 -0
- package/ui/contexts/index.d.ts +13 -0
- package/ui/contexts/index.d.ts.map +1 -0
- package/ui/contexts/ingredient/index.d.ts +2 -0
- package/ui/contexts/ingredient/index.d.ts.map +1 -0
- package/ui/contexts/ingredient/ingredient-provider.d.ts +13 -0
- package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -0
- package/ui/contexts/ingredient-container/index.d.ts +2 -0
- package/ui/contexts/ingredient-container/index.d.ts.map +1 -0
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +13 -0
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -0
- package/ui/contexts/nozzle/index.d.ts +2 -0
- package/ui/contexts/nozzle/index.d.ts.map +1 -0
- package/ui/contexts/nozzle/nozzle-provider.d.ts +13 -0
- package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -0
- package/ui/contexts/pump/index.d.ts +2 -0
- package/ui/contexts/pump/index.d.ts.map +1 -0
- package/ui/contexts/pump/pump-provider.d.ts +13 -0
- package/ui/contexts/pump/pump-provider.d.ts.map +1 -0
- package/ui/hooks/assembly/index.d.ts +3 -0
- package/ui/hooks/assembly/index.d.ts.map +1 -0
- package/ui/hooks/assembly/use-assembly.d.ts +14 -0
- package/ui/hooks/assembly/use-assembly.d.ts.map +1 -0
- package/ui/hooks/assembly/with-assembly.d.ts +8 -0
- package/ui/hooks/assembly/with-assembly.d.ts.map +1 -0
- package/ui/hooks/availability/index.d.ts +3 -0
- package/ui/hooks/availability/index.d.ts.map +1 -0
- package/ui/hooks/availability/use-availability.d.ts +14 -0
- package/ui/hooks/availability/use-availability.d.ts.map +1 -0
- package/ui/hooks/availability/with-availability.d.ts +8 -0
- package/ui/hooks/availability/with-availability.d.ts.map +1 -0
- package/ui/hooks/board/index.d.ts +3 -0
- package/ui/hooks/board/index.d.ts.map +1 -0
- package/ui/hooks/board/use-board.d.ts +14 -0
- package/ui/hooks/board/use-board.d.ts.map +1 -0
- package/ui/hooks/board/with-board.d.ts +8 -0
- package/ui/hooks/board/with-board.d.ts.map +1 -0
- package/ui/hooks/board-container/index.d.ts +3 -0
- package/ui/hooks/board-container/index.d.ts.map +1 -0
- package/ui/hooks/board-container/use-board-container.d.ts +14 -0
- package/ui/hooks/board-container/use-board-container.d.ts.map +1 -0
- package/ui/hooks/board-container/with-board-container.d.ts +8 -0
- package/ui/hooks/board-container/with-board-container.d.ts.map +1 -0
- package/ui/hooks/cui-kit/index.d.ts +8 -0
- package/ui/hooks/cui-kit/index.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts +18 -0
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-beverages.d.ts +17 -0
- package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-brands.d.ts +17 -0
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +127 -0
- package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +88 -0
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +19 -0
- package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts +17 -0
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -0
- package/ui/hooks/cui-kit/use-flavors.d.ts +17 -0
- package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -0
- package/ui/hooks/device-assembly/index.d.ts +3 -0
- package/ui/hooks/device-assembly/index.d.ts.map +1 -0
- package/ui/hooks/device-assembly/use-device-assembly.d.ts +14 -0
- package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -0
- package/ui/hooks/device-assembly/with-device-assembly.d.ts +9 -0
- package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -0
- package/ui/hooks/holder/index.d.ts +3 -0
- package/ui/hooks/holder/index.d.ts.map +1 -0
- package/ui/hooks/holder/use-holder.d.ts +14 -0
- package/ui/hooks/holder/use-holder.d.ts.map +1 -0
- package/ui/hooks/holder/with-holder.d.ts +8 -0
- package/ui/hooks/holder/with-holder.d.ts.map +1 -0
- package/ui/hooks/holder-container/index.d.ts +3 -0
- package/ui/hooks/holder-container/index.d.ts.map +1 -0
- package/ui/hooks/holder-container/use-holder-container.d.ts +14 -0
- package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -0
- package/ui/hooks/holder-container/with-holder-container.d.ts +8 -0
- package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -0
- package/ui/hooks/index.d.ts +14 -0
- package/ui/hooks/index.d.ts.map +1 -0
- package/ui/hooks/ingredient/index.d.ts +4 -0
- package/ui/hooks/ingredient/index.d.ts.map +1 -0
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +49 -0
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -0
- package/ui/hooks/ingredient/use-ingredient.d.ts +14 -0
- package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -0
- package/ui/hooks/ingredient/with-ingredient.d.ts +8 -0
- package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -0
- package/ui/hooks/ingredient-container/index.d.ts +3 -0
- package/ui/hooks/ingredient-container/index.d.ts.map +1 -0
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +14 -0
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -0
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +8 -0
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -0
- package/ui/hooks/nozzle/index.d.ts +3 -0
- package/ui/hooks/nozzle/index.d.ts.map +1 -0
- package/ui/hooks/nozzle/use-dispense-kit.d.ts +22 -0
- package/ui/hooks/nozzle/use-dispense-kit.d.ts.map +1 -0
- package/ui/hooks/nozzle/use-nozzle.d.ts +14 -0
- package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -0
- package/ui/hooks/nozzle/with-nozzle.d.ts +8 -0
- package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -0
- package/ui/hooks/nozzle-pour/index.d.ts +2 -0
- package/ui/hooks/nozzle-pour/index.d.ts.map +1 -0
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +48 -0
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -0
- package/ui/hooks/pump/index.d.ts +3 -0
- package/ui/hooks/pump/index.d.ts.map +1 -0
- package/ui/hooks/pump/use-pump.d.ts +14 -0
- package/ui/hooks/pump/use-pump.d.ts.map +1 -0
- package/ui/hooks/pump/with-pump.d.ts +8 -0
- package/ui/hooks/pump/with-pump.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +5 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/index.d.ts +7 -0
- package/ui/hooks/utils/pour-strategy/index.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +8 -0
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts +13 -0
- package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts +5 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts.map +1 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts +4 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -0
- package/ui/index.d.ts +3 -0
- package/ui/index.d.ts.map +1 -0
- package/ui.cjs +2 -0
- package/ui.cjs.map +1 -0
- package/ui.d.ts +1 -0
- package/ui.js +70 -0
- package/ui.js.map +1 -0
|
@@ -0,0 +1,1759 @@
|
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var at = (e, t, r) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var o = (e, t, r) => (at(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { kosModel as m, isKosModel as v, Kos as P, resolveServiceUrl as N, ServiceFactory as T, KosLog as f, KosModelContainer as E, KosExtensionUtils as z, kosChild as M, FetchError as nt, ExtensionManager as u, EXTENSION_TROUBLE_MAPPER as fe, EXTENSION_TROUBLE_DATA_MAPPER as X, getKosModelSync as S, kosDependency as le, TroubleContainer as xe, troubleByTypeReducer as De, kosAction as I, kosTopicHandler as q, DependencyLifecycle as Ne, getKosModel as Te, FutureManager as be, kosFuture as ve, FutureHandler as st, isKosDataModel as ot, ChildModels as dt, KosFeatureFlags as lt, kosParentAware as pt, createPropKey as ct, MultipleFutureHandler as gt, getAllKosCompanionModels as te, EventBus as re, KosContextManager as ut, destroyKosModel as ht, SingletonKosModelRegistrationFactory as yt, KosModelRegistry as mt, RegistrationManager as _, registerCoreModels as It, registerLegacyModel as ft } from "@kosdev-code/kos-ui-sdk";
|
|
5
|
+
import "react";
|
|
6
|
+
var g = /* @__PURE__ */ ((e) => (e.IngredientLoader = "kos.ingredient.loader", e.IngredientMapper = "kos.ingredient.mapper", e.IngredientIndex = "kos.ingredient.index", e.IngredientTypeMapper = "kos.ingredient.type.mapper", e.HolderTypeMapper = "kos.holder.type.mapper", e.HolderMapper = "kos.holder.mapper", e.HolderIndex = "kos.holder.index", e.HolderIngredientMapper = "kos.holder.ingredient.mapper", e.AvailabilityMapper = "kos.availability.mapper", e.AvailabilityLoader = "kos.availability.loader", e.SelectedPourableMapper = "kos.selected.pourable.mapper", e.AssemblyMapper = "kos.assembly.mapper", e.BoardMapper = "kos.board.mapper", e.BoardIndex = "kos.board.index", e.PumpIndex = "kos.pump.index", e))(g || {}), $ = /* @__PURE__ */ ((e) => (e.Nozzle = "nozzle-model", e.Availability = "availability-model", e.Holder = "holder-model", e.HolderContainer = "holder-container-model", e.IngredientContainer = "ingredient-container-model", e.Ingredient = "ingredient-model", e.Pump = "pump-model", e.PumpContainer = "pump-container-model", e))($ || {}), bt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Pt = (e, t, r, a) => {
|
|
7
|
+
for (var i = a > 1 ? void 0 : a ? vt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
8
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
9
|
+
return a && i && bt(t, r, i), i;
|
|
10
|
+
};
|
|
11
|
+
const A = "ingredient-model";
|
|
12
|
+
let he = class {
|
|
13
|
+
constructor(e, {
|
|
14
|
+
name: t,
|
|
15
|
+
type: r,
|
|
16
|
+
data: a,
|
|
17
|
+
ingredientId: i,
|
|
18
|
+
...n
|
|
19
|
+
}) {
|
|
20
|
+
o(this, "id");
|
|
21
|
+
o(this, "ingredientId");
|
|
22
|
+
o(this, "name");
|
|
23
|
+
o(this, "type");
|
|
24
|
+
o(this, "data");
|
|
25
|
+
this.id = e, this.ingredientId = i, this.name = t, this.type = r, this.data = a, Object.assign(this, n);
|
|
26
|
+
}
|
|
27
|
+
updateModel({
|
|
28
|
+
name: e,
|
|
29
|
+
type: t,
|
|
30
|
+
data: r,
|
|
31
|
+
ingredientId: a,
|
|
32
|
+
...i
|
|
33
|
+
}) {
|
|
34
|
+
this.name = e, this.type = t, this.ingredientId = a, this.data = r, Object.assign(this, i);
|
|
35
|
+
}
|
|
36
|
+
// -------------------LIFECYCLE----------------------------
|
|
37
|
+
// -------------------ENTITY----------------------------
|
|
38
|
+
};
|
|
39
|
+
he = Pt([
|
|
40
|
+
m(A)
|
|
41
|
+
], he);
|
|
42
|
+
const Le = {
|
|
43
|
+
registration: {
|
|
44
|
+
[A]: {
|
|
45
|
+
class: he,
|
|
46
|
+
singleton: !1
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
type: A,
|
|
50
|
+
predicate: v(A),
|
|
51
|
+
factory: P.Factory.create(A)
|
|
52
|
+
}, { URL: Be } = N("INGREDIENT_SERVICE"), { getOne: Mt } = T.build({
|
|
53
|
+
basePath: `${Be}/api/ext/dispense/ingredients`
|
|
54
|
+
}), _t = async () => await Mt({
|
|
55
|
+
urlOverride: `${Be}/api/ext/dispense/ingredients`
|
|
56
|
+
});
|
|
57
|
+
var Ot = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Ae = (e, t, r, a) => {
|
|
58
|
+
for (var i = a > 1 ? void 0 : a ? wt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
59
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
60
|
+
return a && i && Ot(t, r, i), i;
|
|
61
|
+
};
|
|
62
|
+
const j = "ingredient-container-model", Et = f.createLogger({ name: "ingredient-container-model" });
|
|
63
|
+
let ae = class {
|
|
64
|
+
constructor(e, t) {
|
|
65
|
+
o(this, "id");
|
|
66
|
+
o(this, "ingredients");
|
|
67
|
+
this.id = e, this.ingredients = new E({
|
|
68
|
+
indexMap: {
|
|
69
|
+
ingredientType: "type"
|
|
70
|
+
},
|
|
71
|
+
extensionId: g.IngredientIndex,
|
|
72
|
+
parentId: e
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
updateModel() {
|
|
76
|
+
}
|
|
77
|
+
// -------------------LIFECYCLE----------------------------
|
|
78
|
+
getIngredientsByType(e) {
|
|
79
|
+
return this.ingredients.getIndexByKey("ingredientType", e);
|
|
80
|
+
}
|
|
81
|
+
async load(e) {
|
|
82
|
+
var i;
|
|
83
|
+
Et.debug(`loading ingredient container ${this.id}`);
|
|
84
|
+
const t = await _t();
|
|
85
|
+
if ((t == null ? void 0 : t.status) !== 200)
|
|
86
|
+
throw new Error("Failed to load ingredients");
|
|
87
|
+
const r = await z.executeLoaderExtension({
|
|
88
|
+
context: e,
|
|
89
|
+
extension: g.IngredientLoader
|
|
90
|
+
}), a = (t == null ? void 0 : t.data) ?? {};
|
|
91
|
+
for (const n of Object.keys(a))
|
|
92
|
+
for (const s of ((i = t == null ? void 0 : t.data) == null ? void 0 : i[n]) || []) {
|
|
93
|
+
const l = await z.executeDataMapperExtension({
|
|
94
|
+
extension: g.IngredientMapper,
|
|
95
|
+
data: s,
|
|
96
|
+
contextData: r
|
|
97
|
+
}), d = await z.executePropertyMapperExtension({
|
|
98
|
+
extension: g.IngredientTypeMapper,
|
|
99
|
+
data: s,
|
|
100
|
+
contextData: r
|
|
101
|
+
}), c = {
|
|
102
|
+
...s,
|
|
103
|
+
type: d || s.type,
|
|
104
|
+
...l,
|
|
105
|
+
data: l
|
|
106
|
+
}, h = Le.factory(s.id)(
|
|
107
|
+
c
|
|
108
|
+
);
|
|
109
|
+
this.ingredients.addModel(h);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// -------------------ENTITY----------------------------
|
|
113
|
+
};
|
|
114
|
+
Ae([
|
|
115
|
+
M
|
|
116
|
+
], ae.prototype, "ingredients", 2);
|
|
117
|
+
ae = Ae([
|
|
118
|
+
m(j)
|
|
119
|
+
], ae);
|
|
120
|
+
const je = {
|
|
121
|
+
registration: {
|
|
122
|
+
[j]: {
|
|
123
|
+
class: ae,
|
|
124
|
+
singleton: !0
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
type: j,
|
|
128
|
+
predicate: v(j),
|
|
129
|
+
factory: P.Singleton.create(j)
|
|
130
|
+
}, { URL: pe } = N("HOLDER_SERVICE"), { getAll: $t, postModel: Ue, deleteModel: Ct } = T.build({
|
|
131
|
+
basePath: `${pe}/api/kos/holders`
|
|
132
|
+
}), zt = f.createLogger({
|
|
133
|
+
name: "holder-service",
|
|
134
|
+
group: "Services"
|
|
135
|
+
}), Fr = async () => await $t({}), St = async (e, t) => {
|
|
136
|
+
if (!e || !t)
|
|
137
|
+
throw new Error("Missing holderPath or ingredientId");
|
|
138
|
+
return await Ue({
|
|
139
|
+
model: { holderPath: e, ingredientId: t },
|
|
140
|
+
urlOverride: `${pe}/api/ext/dispense/assignments`
|
|
141
|
+
});
|
|
142
|
+
}, Rt = async (e) => {
|
|
143
|
+
if (!e)
|
|
144
|
+
throw new Error("Missing holderPath");
|
|
145
|
+
return await Ct({
|
|
146
|
+
id: e,
|
|
147
|
+
urlOverride: `${pe}/api/ext/dispense/assignments/${e}`
|
|
148
|
+
});
|
|
149
|
+
}, xt = async (e) => {
|
|
150
|
+
if (!e)
|
|
151
|
+
throw new Error("Missing holderPath");
|
|
152
|
+
return zt.debug(
|
|
153
|
+
`sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${e}`
|
|
154
|
+
), await Ue({
|
|
155
|
+
model: {},
|
|
156
|
+
urlOverride: `${pe}/api/ext/dispense/pumpEvents/replaceLine/${e}`
|
|
157
|
+
});
|
|
158
|
+
}, { URL: ne } = N("ASSIGNMENT_SERVICE"), { getAll: Dt, postModel: Ge, deleteModel: Nt } = T.build({
|
|
159
|
+
destinationAddress: "",
|
|
160
|
+
basePath: `${ne}/api/ext/dispense/assignments`
|
|
161
|
+
}), se = window.kosUseFos, Kr = async () => await Dt({ fos: se }), Tt = async (e, t) => {
|
|
162
|
+
var i, n, s, l;
|
|
163
|
+
const r = JSON.stringify(t), a = `${ne}/api/ext/dispense/assignments`;
|
|
164
|
+
try {
|
|
165
|
+
const d = await Ge({
|
|
166
|
+
model: { holderPath: e, factoryJson: r },
|
|
167
|
+
urlOverride: a
|
|
168
|
+
});
|
|
169
|
+
return (d == null ? void 0 : d.status) === 200 && ((i = d == null ? void 0 : d.data) != null && i.error) ? [d.data.error || "unknownError", d.data] : [void 0, d == null ? void 0 : d.data];
|
|
170
|
+
} catch (d) {
|
|
171
|
+
if (d instanceof nt)
|
|
172
|
+
return [
|
|
173
|
+
((s = (n = d.payload) == null ? void 0 : n.data) == null ? void 0 : s.error) || "unknownError",
|
|
174
|
+
(l = d.payload) == null ? void 0 : l.data
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
return ["unknownError", void 0];
|
|
178
|
+
}, Vr = async (e) => {
|
|
179
|
+
const t = se ? `${ne}/api/ingredients/assignments/${e.holderPath}` : `${ne}/api/ext/dispense/assignments`;
|
|
180
|
+
return await Ge({
|
|
181
|
+
model: { ...e, fuelGauge: 680 },
|
|
182
|
+
fos: se,
|
|
183
|
+
urlOverride: t
|
|
184
|
+
});
|
|
185
|
+
}, Yr = async (e) => await Nt({ id: e, fos: se });
|
|
186
|
+
var Lt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, ce = (e, t, r, a) => {
|
|
187
|
+
for (var i = a > 1 ? void 0 : a ? Bt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
188
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
189
|
+
return a && i && Lt(t, r, i), i;
|
|
190
|
+
};
|
|
191
|
+
const U = $.Holder, Ce = f.createLogger({ name: "holder-model" });
|
|
192
|
+
u[fe].register(
|
|
193
|
+
"holder",
|
|
194
|
+
async (e) => {
|
|
195
|
+
const t = [];
|
|
196
|
+
return t.push(...e.data.holderPaths), t;
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
u[X].register(
|
|
200
|
+
"pump",
|
|
201
|
+
async (e) => {
|
|
202
|
+
if (e.data.pumpPath) {
|
|
203
|
+
const { model: t } = S(
|
|
204
|
+
e.data.pumpPath
|
|
205
|
+
);
|
|
206
|
+
if (t) {
|
|
207
|
+
const r = t.ingredientId ? S(t.ingredientId).model : void 0;
|
|
208
|
+
return {
|
|
209
|
+
ingredientId: t.ingredientId,
|
|
210
|
+
ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
|
|
211
|
+
childPumpName: t.name
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return {};
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
u[X].register(
|
|
219
|
+
"holder",
|
|
220
|
+
async (e) => e.data.holderNames.length > 0 ? {
|
|
221
|
+
holderName: e.data.holderNames[0] || ""
|
|
222
|
+
} : {}
|
|
223
|
+
);
|
|
224
|
+
u[X].register(
|
|
225
|
+
"container",
|
|
226
|
+
async (e) => {
|
|
227
|
+
if (e.data.ingredients.length > 0) {
|
|
228
|
+
const t = e.data.ingredients[0], { model: r } = S(t);
|
|
229
|
+
return {
|
|
230
|
+
ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
|
|
231
|
+
ingredients: e.data.ingredients ? e.data.ingredients : [],
|
|
232
|
+
unknonwnIngredientId: e.data.unknonwnIngredientId ?? ""
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return {};
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
class At extends Error {
|
|
239
|
+
constructor(r, a) {
|
|
240
|
+
super(a);
|
|
241
|
+
o(this, "type");
|
|
242
|
+
this.name = "AssignmentError", this.type = r;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
let R = class {
|
|
246
|
+
constructor(e, {
|
|
247
|
+
path: t,
|
|
248
|
+
name: r,
|
|
249
|
+
ingredientSource: a,
|
|
250
|
+
ingredientId: i,
|
|
251
|
+
ingredientType: n,
|
|
252
|
+
slice: s,
|
|
253
|
+
group: l,
|
|
254
|
+
data: d,
|
|
255
|
+
enjoyByDate: c
|
|
256
|
+
}, h) {
|
|
257
|
+
o(this, "id");
|
|
258
|
+
o(this, "path");
|
|
259
|
+
o(this, "name");
|
|
260
|
+
o(this, "ingredientId");
|
|
261
|
+
o(this, "ingredientType");
|
|
262
|
+
o(this, "ingredientSource");
|
|
263
|
+
o(this, "group");
|
|
264
|
+
o(this, "slice");
|
|
265
|
+
o(this, "logger");
|
|
266
|
+
o(this, "data");
|
|
267
|
+
o(this, "enjoyByDate");
|
|
268
|
+
o(this, "pumps");
|
|
269
|
+
o(this, "ingredientContainer");
|
|
270
|
+
o(this, "troubleContainer");
|
|
271
|
+
this.id = e, this.path = t, this.name = r, this.ingredientType = n, this.ingredientSource = a, this.ingredientId = i, this.group = l, this.slice = s, this.enjoyByDate = c, this.data = d, this.pumps = new E({
|
|
272
|
+
parentId: e,
|
|
273
|
+
sortKey: "path"
|
|
274
|
+
}), this.logger = h.logger;
|
|
275
|
+
}
|
|
276
|
+
updateModel({
|
|
277
|
+
path: e,
|
|
278
|
+
name: t,
|
|
279
|
+
ingredientSource: r,
|
|
280
|
+
ingredientId: a,
|
|
281
|
+
ingredientType: i,
|
|
282
|
+
group: n,
|
|
283
|
+
slice: s,
|
|
284
|
+
enjoyByDate: l,
|
|
285
|
+
data: d
|
|
286
|
+
}) {
|
|
287
|
+
this.path = e, this.name = t, this.ingredientId = a, this.ingredientType = i, this.ingredientSource = r, this.enjoyByDate = l, this.slice = s, this.group = n, this.data = d;
|
|
288
|
+
}
|
|
289
|
+
get hasEnjoyByDate() {
|
|
290
|
+
return !!this.enjoyByDate && !this.unassigned;
|
|
291
|
+
}
|
|
292
|
+
get hasEnjoyByWarning() {
|
|
293
|
+
var e;
|
|
294
|
+
return ((e = this.troublesByType.EnjoyByTrouble) == null ? void 0 : e.length) > 0;
|
|
295
|
+
}
|
|
296
|
+
get nozzlePaths() {
|
|
297
|
+
return this.pumps.data.map((e) => e.nozzlePath);
|
|
298
|
+
}
|
|
299
|
+
async cancelPour() {
|
|
300
|
+
await Promise.all(
|
|
301
|
+
this.pumps.data.filter((e) => e.isPouring).map((e) => e.cancelPour())
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
get canPour() {
|
|
305
|
+
return this.pumps.data.every((e) => e.canPour);
|
|
306
|
+
}
|
|
307
|
+
get isPouring() {
|
|
308
|
+
const e = this.pumps.data.some((t) => t.isPouring);
|
|
309
|
+
return this.logger.debug(`isPouring: ${!!e}`), e;
|
|
310
|
+
}
|
|
311
|
+
async performIntent(e) {
|
|
312
|
+
const t = typeof e == "string" ? e : e.intent, r = typeof e == "string" ? void 0 : e.pumpPath, a = r ? this.pumps.getModel(r) : this.pumps.data[0];
|
|
313
|
+
return a == null ? void 0 : a.performIntent({ intent: t });
|
|
314
|
+
}
|
|
315
|
+
get pourState() {
|
|
316
|
+
return this.pumps.data.reduce((t, r) => r.pouringState ? r.pouringState : t, "");
|
|
317
|
+
}
|
|
318
|
+
get nozzlePath() {
|
|
319
|
+
var e;
|
|
320
|
+
return (e = this.pumps.data[0]) == null ? void 0 : e.nozzlePath;
|
|
321
|
+
}
|
|
322
|
+
get pumpPaths() {
|
|
323
|
+
return this.pumps.data.map((e) => e.id);
|
|
324
|
+
}
|
|
325
|
+
get sortedPumps() {
|
|
326
|
+
return this.pumps.data.sort((e, t) => e.virtual && !t.virtual ? -1 : !e.virtual && t.virtual ? 1 : e.name.localeCompare(t.name));
|
|
327
|
+
}
|
|
328
|
+
get ingredient() {
|
|
329
|
+
var t;
|
|
330
|
+
return this.ingredientId ? (t = this.ingredientContainer) == null ? void 0 : t.ingredients.getModel(
|
|
331
|
+
this.ingredientId
|
|
332
|
+
) : void 0;
|
|
333
|
+
}
|
|
334
|
+
get ingredientName() {
|
|
335
|
+
return this.ingredient ? this.ingredient.displayName ?? this.ingredient.name : this.ingredientId ? "unknown" : "";
|
|
336
|
+
}
|
|
337
|
+
get previousIngredient() {
|
|
338
|
+
var t;
|
|
339
|
+
return this.prevIngredientId ? (t = this.ingredientContainer) == null ? void 0 : t.ingredients.getModel(
|
|
340
|
+
this.prevIngredientId
|
|
341
|
+
) : void 0;
|
|
342
|
+
}
|
|
343
|
+
get previousIngredientName() {
|
|
344
|
+
return this.previousIngredient ? this.previousIngredient.displayName ?? this.previousIngredient.name : this.prevIngredientId ? "unknown" : "";
|
|
345
|
+
}
|
|
346
|
+
get troubles() {
|
|
347
|
+
return this.troubleContainer.troubles.getIndexByKey("byIface", this.path).sort((e, t) => t.rank - e.rank);
|
|
348
|
+
}
|
|
349
|
+
get troubleStatus() {
|
|
350
|
+
return "";
|
|
351
|
+
}
|
|
352
|
+
get troublesByType() {
|
|
353
|
+
return this.troubles.reduce(
|
|
354
|
+
De,
|
|
355
|
+
{}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
get prevIngredientId() {
|
|
359
|
+
var e, t;
|
|
360
|
+
return (t = (e = this.pumps.data) == null ? void 0 : e[0]) == null ? void 0 : t.prevIngredientId;
|
|
361
|
+
}
|
|
362
|
+
get unassigned() {
|
|
363
|
+
return (!this.ingredientId || this.ingredientId === "0") && (!this.prevIngredientId || this.prevIngredientId === "0");
|
|
364
|
+
}
|
|
365
|
+
get removed() {
|
|
366
|
+
return (!this.ingredientId || this.ingredientId === "0") && this.prevIngredientId !== void 0 && this.prevIngredientId !== "0";
|
|
367
|
+
}
|
|
368
|
+
get maxVolume() {
|
|
369
|
+
return this.slice.maxVolMl ?? 0;
|
|
370
|
+
}
|
|
371
|
+
get remainingVolume() {
|
|
372
|
+
return this.slice.currentVolMl ?? 0;
|
|
373
|
+
}
|
|
374
|
+
get hasMaxVolume() {
|
|
375
|
+
return this.slice.maxVolMl !== void 0;
|
|
376
|
+
}
|
|
377
|
+
get hasRemainingVolume() {
|
|
378
|
+
return this.slice.currentVolMl !== void 0;
|
|
379
|
+
}
|
|
380
|
+
get fillPercent() {
|
|
381
|
+
return this.remainingVolume <= 0 ? 0 : Math.floor((this.remainingVolume || 1) / (this.maxVolume || 1) * 100);
|
|
382
|
+
}
|
|
383
|
+
get hasFuelGuage() {
|
|
384
|
+
return this.hasMaxVolume && this.hasRemainingVolume;
|
|
385
|
+
}
|
|
386
|
+
updateIngredient(e) {
|
|
387
|
+
this.ingredientId !== e && I(() => {
|
|
388
|
+
this.ingredientId = e;
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
async resolveIntentVolume(e) {
|
|
392
|
+
const t = this.pumps.data[0];
|
|
393
|
+
return t ? t.resolveIntentVolume(e) : { volume: -1 };
|
|
394
|
+
}
|
|
395
|
+
async overrideRfidCode(e) {
|
|
396
|
+
if (!e)
|
|
397
|
+
throw new Error("Invalid override");
|
|
398
|
+
try {
|
|
399
|
+
const [t, r] = await Tt(this.path, e);
|
|
400
|
+
if (t)
|
|
401
|
+
throw new At(
|
|
402
|
+
t,
|
|
403
|
+
`Failed to perform rfid override on holder ${this.id}`
|
|
404
|
+
);
|
|
405
|
+
return I(() => {
|
|
406
|
+
this.ingredientId = r == null ? void 0 : r.ingredientId;
|
|
407
|
+
}), r;
|
|
408
|
+
} catch (t) {
|
|
409
|
+
throw Ce.error(`Failed to perform rfid override on holder ${this.id}`, t), t;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
async assignIngredient(e) {
|
|
413
|
+
try {
|
|
414
|
+
e ? await St(this.path, e) : await Rt(this.path), I(() => {
|
|
415
|
+
this.ingredientId = e;
|
|
416
|
+
});
|
|
417
|
+
} catch (t) {
|
|
418
|
+
throw Ce.error(`Failed to perform assign ingredient to holder ${this.id}`, t), t;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
async replaceLine() {
|
|
422
|
+
await xt(this.path);
|
|
423
|
+
}
|
|
424
|
+
// -------------------LIFECYCLE----------------------------
|
|
425
|
+
// ----------------------------------
|
|
426
|
+
// UNCOMMENT FOR TESTING FUEL GAUGE
|
|
427
|
+
// ----------------------------------
|
|
428
|
+
// async load() {
|
|
429
|
+
// const random = Math.max(1000, Math.floor(Math.random() * 5000));
|
|
430
|
+
// this.slice.maxVolMl = 1000;
|
|
431
|
+
// setInterval(() => {
|
|
432
|
+
// kosAction(() => {
|
|
433
|
+
// if (this.remainingVolume < -100) {
|
|
434
|
+
// this.slice.maxVolMl = 1000;
|
|
435
|
+
// this.slice.currentVolMl = this.maxVolume;
|
|
436
|
+
// } else {
|
|
437
|
+
// this.slice.currentVolMl = this.remainingVolume - 50;
|
|
438
|
+
// }
|
|
439
|
+
// });
|
|
440
|
+
// }, random);
|
|
441
|
+
// }
|
|
442
|
+
// -------------------ENTITY----------------------------
|
|
443
|
+
};
|
|
444
|
+
ce([
|
|
445
|
+
M
|
|
446
|
+
], R.prototype, "pumps", 2);
|
|
447
|
+
ce([
|
|
448
|
+
le({ modelType: je.type })
|
|
449
|
+
], R.prototype, "ingredientContainer", 2);
|
|
450
|
+
ce([
|
|
451
|
+
le({ modelType: xe.type })
|
|
452
|
+
], R.prototype, "troubleContainer", 2);
|
|
453
|
+
R = ce([
|
|
454
|
+
m(U)
|
|
455
|
+
], R);
|
|
456
|
+
const He = {
|
|
457
|
+
registration: {
|
|
458
|
+
[U]: {
|
|
459
|
+
class: R,
|
|
460
|
+
singleton: !1
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
type: U,
|
|
464
|
+
predicate: v(U),
|
|
465
|
+
factory: P.Factory.create(U)
|
|
466
|
+
}, jt = async (e, t) => {
|
|
467
|
+
var $e;
|
|
468
|
+
const r = u.propertyMapper.executeMapper(
|
|
469
|
+
g.HolderIngredientMapper,
|
|
470
|
+
t
|
|
471
|
+
), a = u.propertyMapper.executeMapper(
|
|
472
|
+
g.HolderTypeMapper,
|
|
473
|
+
t
|
|
474
|
+
) || t.ingType, i = await z.executeDataMapperExtension({
|
|
475
|
+
extension: g.HolderMapper,
|
|
476
|
+
data: t,
|
|
477
|
+
contextData: {}
|
|
478
|
+
}), { name: n, path: s, ingredientId: l, ingType: d, ingSource: c, slice: h, ...B } = t, y = { ...B, ...i }, C = h || { pos: 0 }, ee = {
|
|
479
|
+
name: n,
|
|
480
|
+
path: s,
|
|
481
|
+
ingredientId: r || l,
|
|
482
|
+
ingredientType: a || d,
|
|
483
|
+
ingredientSource: c,
|
|
484
|
+
enjoyByDate: ($e = t.container) != null && $e.enjoyByDate ? new Date(t.container.enjoyByDate) : void 0,
|
|
485
|
+
slice: C,
|
|
486
|
+
group: e,
|
|
487
|
+
data: y
|
|
488
|
+
};
|
|
489
|
+
return He.factory(t.path)(ee);
|
|
490
|
+
}, { URL: Ut } = N("ASSEMBLY_SERVICE"), { getOne: Gt } = T.build({
|
|
491
|
+
basePath: `${Ut}/api/kos/device/assemblies`
|
|
492
|
+
}), Ht = f.createLogger({
|
|
493
|
+
name: "assembly-service",
|
|
494
|
+
group: "Services"
|
|
495
|
+
}), Fe = async () => (Ht.debug("sending GET for assembly"), await Gt({}));
|
|
496
|
+
var Ft = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, ge = (e, t, r, a) => {
|
|
497
|
+
for (var i = a > 1 ? void 0 : a ? Kt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
498
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
499
|
+
return a && i && Ft(t, r, i), i;
|
|
500
|
+
};
|
|
501
|
+
const G = "board-container-model", Ke = "/kos/hardware/board/linked", Ve = "/kos/hardware/board/unlinked";
|
|
502
|
+
let x = class {
|
|
503
|
+
constructor(e, t, r) {
|
|
504
|
+
o(this, "id");
|
|
505
|
+
o(this, "logger");
|
|
506
|
+
o(this, "models");
|
|
507
|
+
this.id = e, this.logger = r.logger, this.models = new E({
|
|
508
|
+
parentId: e,
|
|
509
|
+
extensionId: g.BoardIndex
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
get boardList() {
|
|
513
|
+
return this.models.data;
|
|
514
|
+
}
|
|
515
|
+
updateModel() {
|
|
516
|
+
}
|
|
517
|
+
addModel(e) {
|
|
518
|
+
this.models.addModel(e);
|
|
519
|
+
}
|
|
520
|
+
removeModel(e) {
|
|
521
|
+
this.models.removeModel(e);
|
|
522
|
+
}
|
|
523
|
+
updateBoard(e) {
|
|
524
|
+
const t = e.path, r = this.models.getModel(t);
|
|
525
|
+
if (!r) {
|
|
526
|
+
this.logger.warn(`board ${t} not found`);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
r.updateModel(e);
|
|
530
|
+
}
|
|
531
|
+
handleBoardLinkEvent(e) {
|
|
532
|
+
this.logger.debug(`handling ${Ke} event ${e}`), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
|
|
533
|
+
}
|
|
534
|
+
handleBoardUnlinkEvent(e) {
|
|
535
|
+
this.logger.debug(
|
|
536
|
+
`handling ${Ve} event ${e}`
|
|
537
|
+
), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
ge([
|
|
541
|
+
M
|
|
542
|
+
], x.prototype, "models", 2);
|
|
543
|
+
ge([
|
|
544
|
+
q({
|
|
545
|
+
lifecycle: Ne.INIT,
|
|
546
|
+
topic: Ke,
|
|
547
|
+
websocket: !0
|
|
548
|
+
})
|
|
549
|
+
], x.prototype, "handleBoardLinkEvent", 1);
|
|
550
|
+
ge([
|
|
551
|
+
q({
|
|
552
|
+
lifecycle: Ne.INIT,
|
|
553
|
+
topic: Ve,
|
|
554
|
+
websocket: !0
|
|
555
|
+
})
|
|
556
|
+
], x.prototype, "handleBoardUnlinkEvent", 1);
|
|
557
|
+
x = ge([
|
|
558
|
+
m(G)
|
|
559
|
+
], x);
|
|
560
|
+
const Vt = async (e) => {
|
|
561
|
+
const t = e.data.boardPath, { model: r } = S(t);
|
|
562
|
+
return {
|
|
563
|
+
boardName: (r == null ? void 0 : r.name) || ""
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
var Yt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Ye = (e, t, r, a) => {
|
|
567
|
+
for (var i = a > 1 ? void 0 : a ? kt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
568
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
569
|
+
return a && i && Yt(t, r, i), i;
|
|
570
|
+
};
|
|
571
|
+
const H = $.PumpContainer;
|
|
572
|
+
var ke = /* @__PURE__ */ ((e) => (e.byBoard = "byBoard", e.byType = "byType", e.byNozzle = "byNozzle", e))(ke || {});
|
|
573
|
+
let oe = class {
|
|
574
|
+
constructor(e, t) {
|
|
575
|
+
o(this, "id");
|
|
576
|
+
o(this, "pumps");
|
|
577
|
+
this.id = e, this.pumps = new E({
|
|
578
|
+
indexMap: {
|
|
579
|
+
byNozzle: (r) => r.nozzlePaths,
|
|
580
|
+
byBoard: (r) => r.boardPath,
|
|
581
|
+
byType: "type"
|
|
582
|
+
},
|
|
583
|
+
parentId: e,
|
|
584
|
+
extensionId: g.PumpIndex
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* The collection of pump models.
|
|
589
|
+
*/
|
|
590
|
+
get pumpModels() {
|
|
591
|
+
return this.pumps.data;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* The collection of pump paths.
|
|
595
|
+
*/
|
|
596
|
+
get pumpPaths() {
|
|
597
|
+
return this.pumpModels.map((e) => e.path);
|
|
598
|
+
}
|
|
599
|
+
addModel(e) {
|
|
600
|
+
this.pumps.addModel(e);
|
|
601
|
+
}
|
|
602
|
+
removeModel(e) {
|
|
603
|
+
this.pumps.removeModel(e);
|
|
604
|
+
}
|
|
605
|
+
getModel(e) {
|
|
606
|
+
return this.pumps.getModel(e);
|
|
607
|
+
}
|
|
608
|
+
get models() {
|
|
609
|
+
return this.pumps;
|
|
610
|
+
}
|
|
611
|
+
get data() {
|
|
612
|
+
return this.pumps.data;
|
|
613
|
+
}
|
|
614
|
+
updateModel() {
|
|
615
|
+
}
|
|
616
|
+
// -------------------LIFECYCLE----------------------------
|
|
617
|
+
async load() {
|
|
618
|
+
}
|
|
619
|
+
// -------------------ENTITY----------------------------
|
|
620
|
+
};
|
|
621
|
+
Ye([
|
|
622
|
+
M
|
|
623
|
+
], oe.prototype, "pumps", 2);
|
|
624
|
+
oe = Ye([
|
|
625
|
+
m(H)
|
|
626
|
+
], oe);
|
|
627
|
+
const Pe = {
|
|
628
|
+
registration: {
|
|
629
|
+
[H]: {
|
|
630
|
+
class: oe,
|
|
631
|
+
singleton: !0
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
type: H,
|
|
635
|
+
predicate: v(H),
|
|
636
|
+
factory: P.Singleton.create(
|
|
637
|
+
H
|
|
638
|
+
)
|
|
639
|
+
}, Ze = async (e) => {
|
|
640
|
+
const t = [], { model: r } = await Te(e);
|
|
641
|
+
return r && (t.push(r.boardPath), t.push(r.nozzlePath), t.push(r.holderPath)), t;
|
|
642
|
+
}, Zt = async (e) => {
|
|
643
|
+
const t = [], r = e.data.pumpPath;
|
|
644
|
+
t.push(r);
|
|
645
|
+
const a = await Ze(r);
|
|
646
|
+
return [...t, ...a];
|
|
647
|
+
}, Jt = async (e) => {
|
|
648
|
+
const t = [], r = e.data.boardPath;
|
|
649
|
+
t.push(e.data.boardPath);
|
|
650
|
+
const a = await Te(
|
|
651
|
+
Pe.type
|
|
652
|
+
);
|
|
653
|
+
if (a != null && a.model) {
|
|
654
|
+
const n = a.model.models.getIndexByKey(
|
|
655
|
+
ke.byBoard,
|
|
656
|
+
r
|
|
657
|
+
).map(
|
|
658
|
+
(l) => Ze(l.path)
|
|
659
|
+
);
|
|
660
|
+
(await Promise.allSettled(n)).forEach((l) => {
|
|
661
|
+
l.status === "fulfilled" && l.value.forEach((d) => t.push(d));
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return Array.from(new Set(t));
|
|
665
|
+
};
|
|
666
|
+
var Xt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Wt = (e, t, r, a) => {
|
|
667
|
+
for (var i = a > 1 ? void 0 : a ? qt(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
668
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
669
|
+
return a && i && Xt(t, r, i), i;
|
|
670
|
+
};
|
|
671
|
+
const F = "board-model", ze = (e, t) => {
|
|
672
|
+
const { type: r, name: a, path: i, linked: n, instanceId: s, link: l, ...d } = e;
|
|
673
|
+
t.type = r, t.name = a, t.path = i, t.linked = n, t.link = Object.freeze(l), t.instanceId = s, Object.assign(t, d);
|
|
674
|
+
};
|
|
675
|
+
u[fe].register(
|
|
676
|
+
"board",
|
|
677
|
+
Jt
|
|
678
|
+
);
|
|
679
|
+
u[X].register(
|
|
680
|
+
"board",
|
|
681
|
+
Vt
|
|
682
|
+
);
|
|
683
|
+
let ye = class {
|
|
684
|
+
constructor(e, t, r) {
|
|
685
|
+
o(this, "id");
|
|
686
|
+
o(this, "type");
|
|
687
|
+
o(this, "name");
|
|
688
|
+
o(this, "path");
|
|
689
|
+
o(this, "linked");
|
|
690
|
+
o(this, "instanceId");
|
|
691
|
+
o(this, "logger");
|
|
692
|
+
this.id = e, this.logger = r.logger, ze(t, this);
|
|
693
|
+
}
|
|
694
|
+
updateModel(e) {
|
|
695
|
+
ze(e, this);
|
|
696
|
+
}
|
|
697
|
+
// -------------------LIFECYCLE----------------------------
|
|
698
|
+
async init() {
|
|
699
|
+
this.logger.debug(`initializing board ${this.id}`);
|
|
700
|
+
}
|
|
701
|
+
async load() {
|
|
702
|
+
this.logger.debug(`loading board ${this.id}`);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
ye = Wt([
|
|
706
|
+
m(F)
|
|
707
|
+
], ye);
|
|
708
|
+
const Je = {
|
|
709
|
+
registration: {
|
|
710
|
+
[F]: {
|
|
711
|
+
class: ye,
|
|
712
|
+
singleton: !1
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
type: F,
|
|
716
|
+
predicate: v(F),
|
|
717
|
+
factory: P.Factory.create(F)
|
|
718
|
+
}, Xe = {
|
|
719
|
+
registration: {
|
|
720
|
+
[G]: {
|
|
721
|
+
class: x,
|
|
722
|
+
singleton: !0
|
|
723
|
+
},
|
|
724
|
+
...Je.registration
|
|
725
|
+
},
|
|
726
|
+
type: G,
|
|
727
|
+
predicate: v(G),
|
|
728
|
+
factory: P.Singleton.create(
|
|
729
|
+
G
|
|
730
|
+
)
|
|
731
|
+
};
|
|
732
|
+
var Qt = Object.defineProperty, er = Object.getOwnPropertyDescriptor, ue = (e, t, r, a) => {
|
|
733
|
+
for (var i = a > 1 ? void 0 : a ? er(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
734
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
735
|
+
return a && i && Qt(t, r, i), i;
|
|
736
|
+
};
|
|
737
|
+
const K = $.HolderContainer, tr = "/kos/insertion/insert/start", rr = "/kos/insertion/insert/complete", ir = "/kos/insertion/insert/update", ar = "/kos/insertion/remove", nr = "/kos/pumpEvent/replaceLine", sr = "/kos/handle/*";
|
|
738
|
+
let D = class {
|
|
739
|
+
constructor(e, t, r) {
|
|
740
|
+
o(this, "id");
|
|
741
|
+
o(this, "holders");
|
|
742
|
+
o(this, "logger");
|
|
743
|
+
this.id = e, this.holders = new E({
|
|
744
|
+
indexMap: {
|
|
745
|
+
nozzle: (a) => a.nozzlePaths,
|
|
746
|
+
group: "group"
|
|
747
|
+
},
|
|
748
|
+
parentId: e,
|
|
749
|
+
extensionId: g.HolderIndex
|
|
750
|
+
}), this.logger = r.logger;
|
|
751
|
+
}
|
|
752
|
+
updateModel() {
|
|
753
|
+
}
|
|
754
|
+
handleHolderEvents(e) {
|
|
755
|
+
var r, a, i;
|
|
756
|
+
f.ifDebug(
|
|
757
|
+
() => this.logger.debug("Received holder change event", JSON.stringify(e))
|
|
758
|
+
);
|
|
759
|
+
const t = this.holders.getModel(e.path);
|
|
760
|
+
t && (this.logger.info(
|
|
761
|
+
`Received change event for holder ${t.path}. Updating fuel gauge data.`
|
|
762
|
+
), t.slice.currentVolMl = (r = e.slice) == null ? void 0 : r.currentVolMl, t.slice.maxVolMl = (a = e.slice) == null ? void 0 : a.maxVolMl, (i = e == null ? void 0 : e.container) != null && i.enjoyByDate ? t.enjoyByDate = new Date(e.container.enjoyByDate) : t.enjoyByDate = void 0);
|
|
763
|
+
}
|
|
764
|
+
handleInsertion(e) {
|
|
765
|
+
f.ifDebug(
|
|
766
|
+
() => this.logger.debug("Received insertion event", JSON.stringify(e))
|
|
767
|
+
), (Array.isArray(e) ? e : [e]).forEach((r) => {
|
|
768
|
+
I(() => {
|
|
769
|
+
var n, s, l;
|
|
770
|
+
const a = r.ingredientId, i = this.holders.getModel(r.path);
|
|
771
|
+
i && (this.logger.info(
|
|
772
|
+
`Received insertion event for holder ${i.path}`
|
|
773
|
+
), i.updateIngredient(a), i.slice.currentVolMl = (n = r.slice) == null ? void 0 : n.currentVolMl, i.slice.maxVolMl = (s = r.slice) == null ? void 0 : s.maxVolMl, (l = r == null ? void 0 : r.container) != null && l.enjoyByDate ? i.enjoyByDate = new Date(r.container.enjoyByDate) : i.enjoyByDate = void 0, r.pumps.forEach((d) => {
|
|
774
|
+
I(() => {
|
|
775
|
+
const c = i.pumps.getModel(d.path);
|
|
776
|
+
c && (c.ingredientId = d.ingredientId, c.inserted = d.inserted, c.prevIngredientId = d.prevIngredientId);
|
|
777
|
+
});
|
|
778
|
+
}));
|
|
779
|
+
});
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
// -------------------ENTITY----------------------------
|
|
783
|
+
};
|
|
784
|
+
ue([
|
|
785
|
+
M
|
|
786
|
+
], D.prototype, "holders", 2);
|
|
787
|
+
ue([
|
|
788
|
+
q({
|
|
789
|
+
topic: sr,
|
|
790
|
+
websocket: !0,
|
|
791
|
+
condition: (e, t) => t.holders.getModel(e.path) !== void 0
|
|
792
|
+
})
|
|
793
|
+
], D.prototype, "handleHolderEvents", 1);
|
|
794
|
+
ue([
|
|
795
|
+
q({
|
|
796
|
+
topic: [
|
|
797
|
+
tr,
|
|
798
|
+
rr,
|
|
799
|
+
ir,
|
|
800
|
+
ar,
|
|
801
|
+
nr
|
|
802
|
+
],
|
|
803
|
+
websocket: !0
|
|
804
|
+
})
|
|
805
|
+
], D.prototype, "handleInsertion", 1);
|
|
806
|
+
D = ue([
|
|
807
|
+
m(K)
|
|
808
|
+
], D);
|
|
809
|
+
const qe = {
|
|
810
|
+
registration: {
|
|
811
|
+
[K]: {
|
|
812
|
+
class: D,
|
|
813
|
+
singleton: !0
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
type: K,
|
|
817
|
+
predicate: v(K),
|
|
818
|
+
factory: P.Singleton.create(
|
|
819
|
+
K
|
|
820
|
+
)
|
|
821
|
+
}, or = f.createLogger({ name: "board-utils" }), dr = async (e) => {
|
|
822
|
+
const t = await z.executeDataMapperExtension({
|
|
823
|
+
extension: g.BoardMapper,
|
|
824
|
+
data: e,
|
|
825
|
+
contextData: {}
|
|
826
|
+
}), { type: r, name: a, path: i, linked: n, instanceId: s, ...l } = e, d = { ...l, ...t }, c = {
|
|
827
|
+
type: r,
|
|
828
|
+
name: a,
|
|
829
|
+
path: i,
|
|
830
|
+
linked: n,
|
|
831
|
+
instanceId: s,
|
|
832
|
+
...d
|
|
833
|
+
}, h = Je.factory(e.path)(c);
|
|
834
|
+
return h.updateModel(c), h;
|
|
835
|
+
}, lr = (e) => async (t) => {
|
|
836
|
+
or.debug(`adding board ${t.name}`);
|
|
837
|
+
const r = await dr(t);
|
|
838
|
+
e.addModel(r);
|
|
839
|
+
};
|
|
840
|
+
var p = /* @__PURE__ */ ((e) => (e.IDLE = "IDLE", e.POURING = "POURING", e.POUR_STARTING = "POUR_STARTING", e.POUR_CANCELING = "POUR_CANCELING", e.POUR_CANCELED = "POUR_CANCELED", e.POUR_COMPLETE = "POUR_COMPLETE", e))(p || {});
|
|
841
|
+
const { URL: Me } = N("PUMP_SERVICE"), { postModel: pr, getOne: cr } = T.build({
|
|
842
|
+
basePath: `${Me}/api/kos/holders`
|
|
843
|
+
});
|
|
844
|
+
f.createLogger({
|
|
845
|
+
name: "pump-service",
|
|
846
|
+
group: "Services"
|
|
847
|
+
});
|
|
848
|
+
const gr = async ({
|
|
849
|
+
intent: e,
|
|
850
|
+
pumpId: t,
|
|
851
|
+
tracker: r
|
|
852
|
+
}) => {
|
|
853
|
+
const a = `${Me}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${t}/${e}`, i = await pr({ model: {}, urlOverride: a, tracker: r });
|
|
854
|
+
return i != null && i.data && be.initiateFuture(i.data), i;
|
|
855
|
+
}, ur = async (e, t) => {
|
|
856
|
+
const r = `${Me}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`, a = await cr({ urlOverride: r });
|
|
857
|
+
return a != null && a.data ? a.data : { volume: -1 };
|
|
858
|
+
};
|
|
859
|
+
var hr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, _e = (e, t, r, a) => {
|
|
860
|
+
for (var i = a > 1 ? void 0 : a ? yr(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
861
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
862
|
+
return a && i && hr(t, r, i), i;
|
|
863
|
+
};
|
|
864
|
+
const V = $.Pump;
|
|
865
|
+
u[fe].register(
|
|
866
|
+
"pump",
|
|
867
|
+
Zt
|
|
868
|
+
);
|
|
869
|
+
let J = class {
|
|
870
|
+
constructor(e, t) {
|
|
871
|
+
o(this, "id");
|
|
872
|
+
o(this, "inserted");
|
|
873
|
+
o(this, "type");
|
|
874
|
+
o(this, "virtual");
|
|
875
|
+
o(this, "ingredientId");
|
|
876
|
+
o(this, "holderPath");
|
|
877
|
+
o(this, "boardPath");
|
|
878
|
+
o(this, "nozzlePath");
|
|
879
|
+
o(this, "childPump");
|
|
880
|
+
o(this, "name");
|
|
881
|
+
o(this, "path");
|
|
882
|
+
o(this, "prevIngredientId");
|
|
883
|
+
o(this, "troubleContainer");
|
|
884
|
+
o(this, "futureHandler");
|
|
885
|
+
o(this, "currentState", p.IDLE);
|
|
886
|
+
this.id = e;
|
|
887
|
+
const {
|
|
888
|
+
inserted: r,
|
|
889
|
+
holderPath: a,
|
|
890
|
+
boardPath: i,
|
|
891
|
+
nozzlePath: n,
|
|
892
|
+
name: s,
|
|
893
|
+
path: l,
|
|
894
|
+
childPump: d,
|
|
895
|
+
virtual: c,
|
|
896
|
+
prevIngredientId: h,
|
|
897
|
+
...B
|
|
898
|
+
} = t;
|
|
899
|
+
this.inserted = r, this.type = t.type, this.ingredientId = t.ingredientId, this.holderPath = a, this.boardPath = i, this.nozzlePath = n, this.name = s, this.path = l, this.childPump = !!d, this.virtual = !!c, this.prevIngredientId = h, Object.assign(this, B), this.futureHandler = new st(this);
|
|
900
|
+
}
|
|
901
|
+
updateModel(e) {
|
|
902
|
+
const {
|
|
903
|
+
inserted: t,
|
|
904
|
+
holderPath: r,
|
|
905
|
+
boardPath: a,
|
|
906
|
+
nozzlePath: i,
|
|
907
|
+
childPump: n,
|
|
908
|
+
name: s,
|
|
909
|
+
path: l,
|
|
910
|
+
...d
|
|
911
|
+
} = e;
|
|
912
|
+
this.inserted = t, this.type = e.type, this.ingredientId = e.ingredientId, this.holderPath = r, this.boardPath = a, this.nozzlePath = i, this.childPump = this.childPump ? this.childPump : !!n, this.name = s, this.path = l, this.prevIngredientId = e.prevIngredientId, Object.assign(this, d);
|
|
913
|
+
}
|
|
914
|
+
// -------------------LIFECYCLE----------------------------
|
|
915
|
+
get troubles() {
|
|
916
|
+
return this.troubleContainer.troubles.getIndexByKey("byIface", this.path).sort((e, t) => t.rank - e.rank);
|
|
917
|
+
}
|
|
918
|
+
get troubleStatus() {
|
|
919
|
+
return "";
|
|
920
|
+
}
|
|
921
|
+
get troublesByType() {
|
|
922
|
+
return this.troubles.reduce(
|
|
923
|
+
De,
|
|
924
|
+
{}
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
get pouringState() {
|
|
928
|
+
var e;
|
|
929
|
+
return ((e = this.future) == null ? void 0 : e.endState) || "";
|
|
930
|
+
}
|
|
931
|
+
get isPouring() {
|
|
932
|
+
var e;
|
|
933
|
+
return !!(this.future && !((e = this.future) != null && e.endState)) || this.currentState === p.POUR_STARTING || this.currentState === p.POURING;
|
|
934
|
+
}
|
|
935
|
+
get canPour() {
|
|
936
|
+
return !!this.ingredientId && !this.isPouring;
|
|
937
|
+
}
|
|
938
|
+
onFutureUpdate(e) {
|
|
939
|
+
e.endState && I(() => {
|
|
940
|
+
this.currentState = p.IDLE;
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
async cancelPour() {
|
|
944
|
+
var e;
|
|
945
|
+
this.currentState === p.POURING || this.currentState === p.POUR_STARTING ? (this.currentState = p.POUR_CANCELING, await ((e = this.future) == null ? void 0 : e.cancelFuture()), I(() => {
|
|
946
|
+
this.currentState = p.IDLE;
|
|
947
|
+
})) : f.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
948
|
+
}
|
|
949
|
+
get future() {
|
|
950
|
+
return this.futureHandler.future;
|
|
951
|
+
}
|
|
952
|
+
async resolveIntentVolume(e) {
|
|
953
|
+
return await ur(this.path, e);
|
|
954
|
+
}
|
|
955
|
+
async performIntent(e, t) {
|
|
956
|
+
const r = typeof e == "string" ? e : e.intent;
|
|
957
|
+
if (!r)
|
|
958
|
+
throw new Error("No intent provided");
|
|
959
|
+
try {
|
|
960
|
+
if (this.currentState === p.IDLE) {
|
|
961
|
+
if (this.currentState = p.POUR_STARTING, !t)
|
|
962
|
+
throw new Error("No tracker provided");
|
|
963
|
+
const a = await gr({
|
|
964
|
+
tracker: t,
|
|
965
|
+
intent: r,
|
|
966
|
+
pumpId: this.path
|
|
967
|
+
});
|
|
968
|
+
return this.currentState === p.POUR_STARTING && I(() => {
|
|
969
|
+
this.currentState = p.POURING;
|
|
970
|
+
}), a == null ? void 0 : a.data;
|
|
971
|
+
} else
|
|
972
|
+
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
973
|
+
} catch (a) {
|
|
974
|
+
throw f.error(a), this.currentState = p.IDLE, a;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
// -------------------ENTITY----------------------------
|
|
978
|
+
};
|
|
979
|
+
_e([
|
|
980
|
+
le({ modelType: xe.type })
|
|
981
|
+
], J.prototype, "troubleContainer", 2);
|
|
982
|
+
_e([
|
|
983
|
+
ve()
|
|
984
|
+
], J.prototype, "performIntent", 1);
|
|
985
|
+
J = _e([
|
|
986
|
+
m(V)
|
|
987
|
+
], J);
|
|
988
|
+
const We = {
|
|
989
|
+
registration: {
|
|
990
|
+
[V]: {
|
|
991
|
+
class: J,
|
|
992
|
+
singleton: !1
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
type: V,
|
|
996
|
+
predicate: v(V),
|
|
997
|
+
factory: P.Factory.create(V)
|
|
998
|
+
}, mr = f.createLogger({ name: "pump-utils" }), Ir = (e, t) => {
|
|
999
|
+
const r = (t.pumps ?? []).length > 1, a = {
|
|
1000
|
+
boardPath: t.boardPath,
|
|
1001
|
+
holderPath: t.holderPath,
|
|
1002
|
+
ingredientId: t.ingredientId,
|
|
1003
|
+
childPump: !!t.childPump,
|
|
1004
|
+
virtual: r,
|
|
1005
|
+
inserted: t.inserted,
|
|
1006
|
+
name: t.name,
|
|
1007
|
+
path: t.path,
|
|
1008
|
+
type: t.type,
|
|
1009
|
+
nozzlePath: e,
|
|
1010
|
+
prevIngredientId: t.prevIngredientId
|
|
1011
|
+
}, i = We.factory(t.path)(a);
|
|
1012
|
+
return i.updateModel(a), i;
|
|
1013
|
+
}, Qe = (e) => (t) => (r) => (a) => {
|
|
1014
|
+
var l;
|
|
1015
|
+
mr.debug(`adding pump ${a.name}`);
|
|
1016
|
+
const i = Ir(r.path, a);
|
|
1017
|
+
e.addModel(i);
|
|
1018
|
+
const n = i.holderPath, s = t.holders.getModel(n);
|
|
1019
|
+
s == null || s.pumps.addModel(i), s != null && s.nozzlePaths.includes(r.path) || s == null || s.nozzlePaths.push(r.path), (l = a == null ? void 0 : a.pumps) == null || l.forEach((d) => {
|
|
1020
|
+
const c = i.holderPath, h = {
|
|
1021
|
+
...d,
|
|
1022
|
+
childPump: !0,
|
|
1023
|
+
holderPath: c,
|
|
1024
|
+
ingredientId: i.ingredientId
|
|
1025
|
+
};
|
|
1026
|
+
Qe(e)(t)(r)(h);
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
var fr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, W = (e, t, r, a) => {
|
|
1030
|
+
for (var i = a > 1 ? void 0 : a ? br(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
1031
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
1032
|
+
return a && i && fr(t, r, i), i;
|
|
1033
|
+
};
|
|
1034
|
+
const Y = "assembly-model", vr = "assembly-data";
|
|
1035
|
+
let O = class {
|
|
1036
|
+
constructor(e, t, r) {
|
|
1037
|
+
o(this, "id");
|
|
1038
|
+
o(this, "_nozzlePaths", /* @__PURE__ */ new Set());
|
|
1039
|
+
o(this, "troubleContainer");
|
|
1040
|
+
o(this, "holderContainer");
|
|
1041
|
+
o(this, "boardContainer");
|
|
1042
|
+
o(this, "pumpContainer");
|
|
1043
|
+
o(this, "logger");
|
|
1044
|
+
this.id = e, this.holderContainer = qe.factory({}), this.boardContainer = Xe.factory({}), this.pumpContainer = Pe.factory({}), this.logger = r.logger;
|
|
1045
|
+
}
|
|
1046
|
+
updateModel(e) {
|
|
1047
|
+
}
|
|
1048
|
+
get allHolders() {
|
|
1049
|
+
return this.holderContainer.holders.data;
|
|
1050
|
+
}
|
|
1051
|
+
get holderGroups() {
|
|
1052
|
+
return this.holderContainer.holders.getIndexKeys("group");
|
|
1053
|
+
}
|
|
1054
|
+
get nozzlePaths() {
|
|
1055
|
+
return Array.from(this._nozzlePaths);
|
|
1056
|
+
}
|
|
1057
|
+
getHoldersByGroup(e) {
|
|
1058
|
+
return this.holderContainer.holders.getIndexByKey("group", e);
|
|
1059
|
+
}
|
|
1060
|
+
getHoldersByNozzle(e) {
|
|
1061
|
+
return this.holderContainer.holders.getIndexByKey("nozzle", e);
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Returns a map of the pumps associated with each nozzle
|
|
1065
|
+
*
|
|
1066
|
+
* Can be used in conjunction with the nozzlePaths to get the pumps associated with each nozzle
|
|
1067
|
+
* @returns Record<string, PumpModel[]>
|
|
1068
|
+
*/
|
|
1069
|
+
get pumpsByNozzle() {
|
|
1070
|
+
return this.pumpContainer.models.idx.byNozzle;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Returns a list of all fo the pumps paths across the entire assembly.
|
|
1074
|
+
*/
|
|
1075
|
+
get pumpPaths() {
|
|
1076
|
+
return this.pumpContainer.models.data.map((e) => e.path);
|
|
1077
|
+
}
|
|
1078
|
+
get boards() {
|
|
1079
|
+
return this.boardContainer.boardList;
|
|
1080
|
+
}
|
|
1081
|
+
// -------------------LIFECYCLE----------------------------
|
|
1082
|
+
async init() {
|
|
1083
|
+
this.logger.debug(`initializing assembly ${this.id}`);
|
|
1084
|
+
}
|
|
1085
|
+
async ready() {
|
|
1086
|
+
var e;
|
|
1087
|
+
(e = this.troubleContainer) == null || e.troubles.increment();
|
|
1088
|
+
}
|
|
1089
|
+
async load(e) {
|
|
1090
|
+
this.logger.debug(`loading assembly ${this.id}`);
|
|
1091
|
+
const t = await Fe();
|
|
1092
|
+
if ((t == null ? void 0 : t.status) === 200) {
|
|
1093
|
+
const r = await z.executeDataMapperExtension({
|
|
1094
|
+
extension: g.AssemblyMapper,
|
|
1095
|
+
data: t.data,
|
|
1096
|
+
contextData: {}
|
|
1097
|
+
});
|
|
1098
|
+
e.set(vr, r), Object.assign(this, r), Object.entries(r).forEach(([a, i]) => {
|
|
1099
|
+
ot(i) && (this.logger.debug(`adding child model ${a} from extension data`), this[dt][a] = !0);
|
|
1100
|
+
});
|
|
1101
|
+
for await (const a of t.data.assemblies) {
|
|
1102
|
+
const {
|
|
1103
|
+
boards: i,
|
|
1104
|
+
holders: n,
|
|
1105
|
+
nozzles: s,
|
|
1106
|
+
core: l,
|
|
1107
|
+
name: d,
|
|
1108
|
+
path: c,
|
|
1109
|
+
...h
|
|
1110
|
+
} = a;
|
|
1111
|
+
this.logger.debug(`adding assembly ${d}`), Object.keys(h).forEach((y) => {
|
|
1112
|
+
lt.enableFeature(y);
|
|
1113
|
+
});
|
|
1114
|
+
for await (const y of i)
|
|
1115
|
+
this.logger.debug(`adding board ${y.name}`), await lr(this.boardContainer)(y);
|
|
1116
|
+
for await (const [y, C] of Object.entries(n))
|
|
1117
|
+
for await (const ee of C) {
|
|
1118
|
+
this.logger.debug(`adding holder ${ee.name}`);
|
|
1119
|
+
const Ee = await jt(y, ee);
|
|
1120
|
+
this.holderContainer.holders.addModel(Ee);
|
|
1121
|
+
}
|
|
1122
|
+
const B = Qe(this.pumpContainer)(
|
|
1123
|
+
this.holderContainer
|
|
1124
|
+
);
|
|
1125
|
+
s.forEach((y) => {
|
|
1126
|
+
this._nozzlePaths.add(y.path);
|
|
1127
|
+
const C = B(y);
|
|
1128
|
+
y.pumps.forEach(C);
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
W([
|
|
1135
|
+
le({ modelType: "trouble-container-model" })
|
|
1136
|
+
], O.prototype, "troubleContainer", 2);
|
|
1137
|
+
W([
|
|
1138
|
+
M
|
|
1139
|
+
], O.prototype, "holderContainer", 2);
|
|
1140
|
+
W([
|
|
1141
|
+
M
|
|
1142
|
+
], O.prototype, "boardContainer", 2);
|
|
1143
|
+
W([
|
|
1144
|
+
M
|
|
1145
|
+
], O.prototype, "pumpContainer", 2);
|
|
1146
|
+
O = W([
|
|
1147
|
+
m(Y)
|
|
1148
|
+
], O);
|
|
1149
|
+
const et = {
|
|
1150
|
+
registration: {
|
|
1151
|
+
[Y]: {
|
|
1152
|
+
class: O,
|
|
1153
|
+
singleton: !0
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
type: Y,
|
|
1157
|
+
predicate: v(Y),
|
|
1158
|
+
factory: P.Singleton.create(Y)
|
|
1159
|
+
};
|
|
1160
|
+
var Pr = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, _r = (e, t, r, a) => {
|
|
1161
|
+
for (var i = a > 1 ? void 0 : a ? Mr(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
1162
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
1163
|
+
return a && i && Pr(t, r, i), i;
|
|
1164
|
+
};
|
|
1165
|
+
const k = $.Availability;
|
|
1166
|
+
let me = class {
|
|
1167
|
+
constructor(e, t, r) {
|
|
1168
|
+
o(this, "id");
|
|
1169
|
+
o(this, "data");
|
|
1170
|
+
o(this, "available");
|
|
1171
|
+
o(this, "visible");
|
|
1172
|
+
o(this, "groupId");
|
|
1173
|
+
o(this, "rawId");
|
|
1174
|
+
o(this, "altId");
|
|
1175
|
+
o(this, "type");
|
|
1176
|
+
o(this, "note");
|
|
1177
|
+
o(this, "taggedIds");
|
|
1178
|
+
o(this, "parentId");
|
|
1179
|
+
o(this, "logger");
|
|
1180
|
+
this.id = e, this.taggedIds = t.taggedIds || [], this.logger = r.logger, this.available = t.available, this.visible = t.visible, this.groupId = t.groupId, this.rawId = t.rawId, this.altId = t.altId, this.type = t.type, this.parentId = t.kosParentId, this.data = t.data, this.note = t.note;
|
|
1181
|
+
}
|
|
1182
|
+
updateModel(e) {
|
|
1183
|
+
this.taggedIds = e.taggedIds || [], this.available = e.available, this.visible = e.visible, this.groupId = e.groupId, this.rawId = e.rawId, this.altId = e.altId, this.type = e.type, this.data = e.data;
|
|
1184
|
+
}
|
|
1185
|
+
updateAvailability(e) {
|
|
1186
|
+
this.available = e;
|
|
1187
|
+
}
|
|
1188
|
+
// -------------------LIFECYCLE----------------------------
|
|
1189
|
+
// -------------------ENTITY----------------------------
|
|
1190
|
+
};
|
|
1191
|
+
me = _r([
|
|
1192
|
+
pt(),
|
|
1193
|
+
m(k)
|
|
1194
|
+
], me);
|
|
1195
|
+
const Ie = {
|
|
1196
|
+
registration: {
|
|
1197
|
+
[k]: {
|
|
1198
|
+
class: me,
|
|
1199
|
+
singleton: !1
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
type: k,
|
|
1203
|
+
predicate: v(k),
|
|
1204
|
+
factory: P.Factory.create(
|
|
1205
|
+
k
|
|
1206
|
+
)
|
|
1207
|
+
}, { URL: L } = N("NOZZLE_SERVICE"), { postModel: Oe, deleteModel: Or, getOne: wr } = T.build({
|
|
1208
|
+
basePath: `${L}/api/nozzle`
|
|
1209
|
+
}), Er = async (e, t) => {
|
|
1210
|
+
const r = await Oe({
|
|
1211
|
+
model: {},
|
|
1212
|
+
urlOverride: `${L}/api/ext/dispense/nozzle/${e}/pipeline/beverage/pour`,
|
|
1213
|
+
ordered: !0,
|
|
1214
|
+
tracker: t
|
|
1215
|
+
});
|
|
1216
|
+
return r != null && r.data && be.initiateFuture(r.data), r;
|
|
1217
|
+
}, $r = async (e, t, r) => {
|
|
1218
|
+
const a = await Oe({
|
|
1219
|
+
model: {},
|
|
1220
|
+
urlOverride: `${L}/api/ext/dispense/nozzle/${t}/pipeline/beverage/fixed/${e}`,
|
|
1221
|
+
ordered: !0,
|
|
1222
|
+
tracker: r
|
|
1223
|
+
});
|
|
1224
|
+
return a != null && a.data && be.initiateFuture(a.data), a;
|
|
1225
|
+
}, Cr = async (e) => await wr({
|
|
1226
|
+
urlOverride: `${L}${e}/pipeline/beverage/availability`
|
|
1227
|
+
}), zr = async (e, t) => await Oe({
|
|
1228
|
+
model: t,
|
|
1229
|
+
urlOverride: `${L}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1230
|
+
}), Sr = async (e) => await Or({
|
|
1231
|
+
id: e,
|
|
1232
|
+
urlOverride: `${L}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1233
|
+
});
|
|
1234
|
+
var Rr = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Q = (e, t, r, a) => {
|
|
1235
|
+
for (var i = a > 1 ? void 0 : a ? xr(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
1236
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
1237
|
+
return a && i && Rr(t, r, i), i;
|
|
1238
|
+
};
|
|
1239
|
+
const Z = $.Nozzle, Dr = ct(
|
|
1240
|
+
"beverageTopicPrefix"
|
|
1241
|
+
), ie = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0, Se = "/kos/nozzle/pour/started", Nr = "/kos/nozzle/pour/progress", Tr = "/kos/nozzle/pour/cancel";
|
|
1242
|
+
let w = class {
|
|
1243
|
+
constructor(e, t, r) {
|
|
1244
|
+
/** the unique identifier for this nozzle.*/
|
|
1245
|
+
o(this, "id");
|
|
1246
|
+
o(this, "path");
|
|
1247
|
+
o(this, "logger");
|
|
1248
|
+
o(this, "name");
|
|
1249
|
+
o(this, "_selectedBeverage");
|
|
1250
|
+
o(this, "_selectedBrand");
|
|
1251
|
+
o(this, "_additionalItems");
|
|
1252
|
+
o(this, "_availabilityItems");
|
|
1253
|
+
o(this, "futureHandler");
|
|
1254
|
+
o(this, "currentState", p.IDLE);
|
|
1255
|
+
o(this, "beverageTopicPrefix");
|
|
1256
|
+
o(this, "topicPrefix");
|
|
1257
|
+
o(this, "urlPrefix");
|
|
1258
|
+
this.id = e, this.path = t.path, this.name = t.name, this.beverageTopicPrefix = t.beverageTopicPrefix, this.topicPrefix = t.topicPrefix, this.urlPrefix = t.urlPrefix, this._selectedBeverage = void 0, this._selectedBrand = void 0, this._additionalItems = [], this.futureHandler = new gt(this), this._availabilityItems = new E({
|
|
1259
|
+
indexMap: {
|
|
1260
|
+
byGroup: "groupId",
|
|
1261
|
+
byParent: "parentId"
|
|
1262
|
+
},
|
|
1263
|
+
parentId: e
|
|
1264
|
+
}), this.logger = r.logger;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* The availability nodes that can be dispensed from this nozzle.
|
|
1268
|
+
* This is a subset of the availability for the entire dispenser
|
|
1269
|
+
* and is determined by the nodes associated with a nozzle.
|
|
1270
|
+
*/
|
|
1271
|
+
get beverages() {
|
|
1272
|
+
return this._availabilityItems.getIndexByKey("byGroup", "beverages");
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* The availability nodes that have been grouped into the "brands" group.
|
|
1276
|
+
*
|
|
1277
|
+
*/
|
|
1278
|
+
get brands() {
|
|
1279
|
+
return this._availabilityItems.getIndexByKey("byGroup", "brands");
|
|
1280
|
+
}
|
|
1281
|
+
get visibleBrands() {
|
|
1282
|
+
return this.brands.filter((e) => e.visible);
|
|
1283
|
+
}
|
|
1284
|
+
get visibleBeverages() {
|
|
1285
|
+
return this.beverages.filter((e) => e.visible);
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* A derived value that indicates if the nozzle is currently pouring a beverage.
|
|
1289
|
+
* @readonly
|
|
1290
|
+
*/
|
|
1291
|
+
get isPouring() {
|
|
1292
|
+
var e;
|
|
1293
|
+
return !!(this.futureHandler.getFuture() && !((e = this.futureHandler.getFuture()) != null && e.endState)) || this.currentState === p.POUR_STARTING || this.currentState === p.POURING || this.currentState === p.POUR_CANCELING;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* A derived value that indicates if the nozzle is currently available to pour a beverage.
|
|
1297
|
+
*
|
|
1298
|
+
* This will generally be determined by whether there is a currently selected pourable AND
|
|
1299
|
+
* the nozzle is not currently pouring.
|
|
1300
|
+
*
|
|
1301
|
+
* The value is observable and will change when the selected pourable changes or the nozzle
|
|
1302
|
+
* starts or stops pouring.
|
|
1303
|
+
* @readonly
|
|
1304
|
+
* */
|
|
1305
|
+
get canPour() {
|
|
1306
|
+
return !!this._selectedBeverage && this._selectedBeverage.available && this.currentState === p.IDLE;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* The selected pourable for this nozzle. Its shape is determined by the results of the
|
|
1310
|
+
* {@link ExtensionType.SelectedPourableMapper} extension.
|
|
1311
|
+
* @readonly
|
|
1312
|
+
*
|
|
1313
|
+
* */
|
|
1314
|
+
get selectedPourable() {
|
|
1315
|
+
return {
|
|
1316
|
+
beverage: this._selectedBeverage,
|
|
1317
|
+
additional: this._additionalItems
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
get future() {
|
|
1321
|
+
return this.futureHandler.getFuture();
|
|
1322
|
+
}
|
|
1323
|
+
get pourProgress() {
|
|
1324
|
+
var e;
|
|
1325
|
+
return ((e = this.future) == null ? void 0 : e.progress) ?? 0;
|
|
1326
|
+
}
|
|
1327
|
+
updateModel() {
|
|
1328
|
+
}
|
|
1329
|
+
// -------------------LIFECYCLE----------------------------
|
|
1330
|
+
setSelectedBrand(e) {
|
|
1331
|
+
this._selectedBrand = e, this._selectedBeverage = void 0;
|
|
1332
|
+
}
|
|
1333
|
+
get selectedBrand() {
|
|
1334
|
+
return this._selectedBrand;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Set the values used to determine the selected pourable for this nozzle.
|
|
1338
|
+
*
|
|
1339
|
+
* @param pourable The pourable to set.
|
|
1340
|
+
* @param pourable.beverage The beverage selected.
|
|
1341
|
+
* @param pourable.additional The additional items such as flavors or other items that could be incorporated
|
|
1342
|
+
* into the pourable.
|
|
1343
|
+
* */
|
|
1344
|
+
async setSelectedPourable({
|
|
1345
|
+
beverage: e,
|
|
1346
|
+
additional: t,
|
|
1347
|
+
context: r
|
|
1348
|
+
}) {
|
|
1349
|
+
if (!e) {
|
|
1350
|
+
const l = await Sr(this.name);
|
|
1351
|
+
if ((l == null ? void 0 : l.status) !== 200)
|
|
1352
|
+
throw new Error("Failed to clear pourable");
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
this._selectedBeverage = e, this._additionalItems = t;
|
|
1356
|
+
const a = await u.dataMapper.executeMapper(
|
|
1357
|
+
g.SelectedPourableMapper,
|
|
1358
|
+
{
|
|
1359
|
+
beverage: e,
|
|
1360
|
+
additional: t,
|
|
1361
|
+
context: r
|
|
1362
|
+
}
|
|
1363
|
+
), i = {
|
|
1364
|
+
bevId: e.rawId
|
|
1365
|
+
};
|
|
1366
|
+
a || this.logger.warn(
|
|
1367
|
+
`No selected pourable mapper defined, using the default payload ${i}`
|
|
1368
|
+
);
|
|
1369
|
+
const n = a ?? i, s = await zr(this.name, n);
|
|
1370
|
+
if ((s == null ? void 0 : s.status) !== 200)
|
|
1371
|
+
throw new Error("Failed to select pourable");
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Utility method that will return the availability nodes that belong to the specified
|
|
1375
|
+
* group as defined in the dispenser beverage graph. For example, a dispenser
|
|
1376
|
+
* implementation may group availability nodes by Brand, Beverage, or Flavors
|
|
1377
|
+
*
|
|
1378
|
+
* @param groupId The group to filter by.
|
|
1379
|
+
* @returns The availability nodes that are available to be dispensed from this nozzle
|
|
1380
|
+
* and are in the specified group.
|
|
1381
|
+
* */
|
|
1382
|
+
getGroupAvailabilityItems(e) {
|
|
1383
|
+
return this._availabilityItems.getIndexByKey(
|
|
1384
|
+
"byGroup",
|
|
1385
|
+
e
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Utility method that will return the availability nodes that are tagged with the specified parent id.
|
|
1390
|
+
*
|
|
1391
|
+
* This is useful when brandsets use the taggedIds property to associate nodes with a parent node. For example,
|
|
1392
|
+
* when organizing a brandset into brands and beverages, the brand nodes will be tagged with the beverage nodes.
|
|
1393
|
+
*
|
|
1394
|
+
* @param parentId - The parent id to filter by.
|
|
1395
|
+
* @returns the availability nodes that are tagged with the specified parent id.
|
|
1396
|
+
*/
|
|
1397
|
+
getAvailabilityByParent(e) {
|
|
1398
|
+
return this._availabilityItems.getIndexByKey(
|
|
1399
|
+
"byParent",
|
|
1400
|
+
e
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
updateIfCurrent(e, t) {
|
|
1404
|
+
this.currentState === e && I(() => {
|
|
1405
|
+
this.currentState = t;
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
onFutureUpdate(e) {
|
|
1409
|
+
te(this).forEach((r) => {
|
|
1410
|
+
ie(r) && r.onPourProgress(e);
|
|
1411
|
+
});
|
|
1412
|
+
const t = {
|
|
1413
|
+
nozzleId: this.id,
|
|
1414
|
+
progress: e.progress,
|
|
1415
|
+
status: e.status,
|
|
1416
|
+
clientData: e.clientData,
|
|
1417
|
+
futureId: e.futureId,
|
|
1418
|
+
remainingTimeMs: e.remainingTimeMs,
|
|
1419
|
+
endState: e.endState,
|
|
1420
|
+
reason: e.reason,
|
|
1421
|
+
timeRemaining: e.timeRemaining
|
|
1422
|
+
};
|
|
1423
|
+
re.publish(Nr, t);
|
|
1424
|
+
}
|
|
1425
|
+
async pour(e) {
|
|
1426
|
+
try {
|
|
1427
|
+
if (this.currentState === p.IDLE) {
|
|
1428
|
+
if (this.updateIfCurrent(p.IDLE, p.POUR_STARTING), !e)
|
|
1429
|
+
throw new Error("No tracker provided");
|
|
1430
|
+
const t = await Er(this.name, e);
|
|
1431
|
+
this.updateIfCurrent(p.POUR_STARTING, p.POURING), te(this).forEach((a) => {
|
|
1432
|
+
var i;
|
|
1433
|
+
ie(a) && ((i = a.onPourStart) == null || i.call(a));
|
|
1434
|
+
});
|
|
1435
|
+
const r = {
|
|
1436
|
+
nozzleId: this.id,
|
|
1437
|
+
type: "free"
|
|
1438
|
+
};
|
|
1439
|
+
return re.publish(Se, r), t;
|
|
1440
|
+
} else
|
|
1441
|
+
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1442
|
+
} catch (t) {
|
|
1443
|
+
throw this.logger.error(t), this.currentState = p.IDLE, t;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
async fixedPour(e, t) {
|
|
1447
|
+
try {
|
|
1448
|
+
if (this.currentState === p.IDLE) {
|
|
1449
|
+
if (this.currentState = p.POUR_STARTING, !t)
|
|
1450
|
+
throw new Error("No tracker provided");
|
|
1451
|
+
const r = await $r(e, this.name, t);
|
|
1452
|
+
this.currentState === p.POUR_STARTING && I(() => {
|
|
1453
|
+
this.currentState = p.POURING;
|
|
1454
|
+
}), te(this).forEach((i) => {
|
|
1455
|
+
var n;
|
|
1456
|
+
ie(i) && ((n = i.onPourStart) == null || n.call(i));
|
|
1457
|
+
});
|
|
1458
|
+
const a = {
|
|
1459
|
+
nozzleId: this.id,
|
|
1460
|
+
type: "fixed"
|
|
1461
|
+
};
|
|
1462
|
+
return re.publish(Se, a), r;
|
|
1463
|
+
} else
|
|
1464
|
+
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1465
|
+
} catch (r) {
|
|
1466
|
+
throw this.logger.error(r), this.currentState = p.IDLE, r;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* An action that will cancel a pour for this nozzle.
|
|
1471
|
+
* */
|
|
1472
|
+
async cancelPour() {
|
|
1473
|
+
var e;
|
|
1474
|
+
if (this.currentState === p.POURING || this.currentState === p.POUR_STARTING) {
|
|
1475
|
+
this.currentState = p.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), I(() => {
|
|
1476
|
+
this.currentState = p.IDLE;
|
|
1477
|
+
}), te(this).forEach((r) => {
|
|
1478
|
+
var a;
|
|
1479
|
+
ie(r) && ((a = r.onPourCancel) == null || a.call(r));
|
|
1480
|
+
});
|
|
1481
|
+
const t = {
|
|
1482
|
+
nozzleId: this.id
|
|
1483
|
+
};
|
|
1484
|
+
re.publish(Tr, t);
|
|
1485
|
+
} else
|
|
1486
|
+
this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1487
|
+
}
|
|
1488
|
+
updateGroupMembers() {
|
|
1489
|
+
this._availabilityItems.data.forEach((e) => {
|
|
1490
|
+
(e.taggedIds || []).forEach((r) => {
|
|
1491
|
+
const a = this._availabilityItems.data.find(
|
|
1492
|
+
(i) => i.rawId === r
|
|
1493
|
+
);
|
|
1494
|
+
a && a.parentId !== e.id && (a.parentId = e.id, this._availabilityItems.updateModel(a));
|
|
1495
|
+
});
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
/** @internal */
|
|
1499
|
+
async load(e) {
|
|
1500
|
+
var a, i;
|
|
1501
|
+
this.logger.debug(`loading nozzle ${this.id}`);
|
|
1502
|
+
const t = await Cr(this.urlPrefix);
|
|
1503
|
+
if ((t == null ? void 0 : t.status) !== 200)
|
|
1504
|
+
throw new Error("Failed to load nozzle availability");
|
|
1505
|
+
const r = await u.loader.executeLoader(
|
|
1506
|
+
g.AvailabilityLoader,
|
|
1507
|
+
{}
|
|
1508
|
+
);
|
|
1509
|
+
e == null || e.set(g.AvailabilityLoader, r), e == null || e.set(we.type, this);
|
|
1510
|
+
for (const n of Object.keys((a = t.data) == null ? void 0 : a.groups) || [])
|
|
1511
|
+
for (const s of ((i = t.data) == null ? void 0 : i.groups[n]) || []) {
|
|
1512
|
+
const l = await u.dataMapper.executeMapper(
|
|
1513
|
+
g.AvailabilityMapper,
|
|
1514
|
+
{ ...s, groupId: n },
|
|
1515
|
+
r
|
|
1516
|
+
), d = {
|
|
1517
|
+
...s,
|
|
1518
|
+
note: s.note ?? void 0,
|
|
1519
|
+
kosParentId: this.id,
|
|
1520
|
+
rawId: s.id,
|
|
1521
|
+
groupId: n,
|
|
1522
|
+
data: l
|
|
1523
|
+
}, c = Ie.factory(
|
|
1524
|
+
`${this.id}-${n}-${s.id}`
|
|
1525
|
+
)(d);
|
|
1526
|
+
this._availabilityItems.addModel(c);
|
|
1527
|
+
}
|
|
1528
|
+
this.updateGroupMembers();
|
|
1529
|
+
}
|
|
1530
|
+
async updateAvailability(e) {
|
|
1531
|
+
const t = ut.getContext(this.id), r = (t == null ? void 0 : t.get(g.AvailabilityLoader)) || {};
|
|
1532
|
+
if (e.rebuild)
|
|
1533
|
+
for (const a of Object.keys(e == null ? void 0 : e.groups) || []) {
|
|
1534
|
+
this._availabilityItems.getIndexByKey("group", a).filter(
|
|
1535
|
+
(n) => !e.groups[a].find(
|
|
1536
|
+
(s) => `${this.id}-${a}-${s.id}` === n.id
|
|
1537
|
+
)
|
|
1538
|
+
).forEach((n) => {
|
|
1539
|
+
this._availabilityItems.removeModel(n.id), ht(n);
|
|
1540
|
+
});
|
|
1541
|
+
for (const n of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1542
|
+
const s = await u.dataMapper.executeMapper(
|
|
1543
|
+
g.AvailabilityMapper,
|
|
1544
|
+
{ ...n, groupId: a },
|
|
1545
|
+
r
|
|
1546
|
+
), l = {
|
|
1547
|
+
...n,
|
|
1548
|
+
note: n.note ?? void 0,
|
|
1549
|
+
kosParentId: this.id,
|
|
1550
|
+
groupId: a,
|
|
1551
|
+
rawId: n.id,
|
|
1552
|
+
data: s,
|
|
1553
|
+
taggedIds: n.taggedIds
|
|
1554
|
+
}, d = this._availabilityItems.getModel(
|
|
1555
|
+
`${this.id}-${a}-${n.id}`
|
|
1556
|
+
);
|
|
1557
|
+
if (d)
|
|
1558
|
+
d.updateModel(l);
|
|
1559
|
+
else {
|
|
1560
|
+
const c = Ie.factory(
|
|
1561
|
+
`${this.id}-${a}-${n.id}`
|
|
1562
|
+
)(l);
|
|
1563
|
+
this._availabilityItems.addModel(c);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
else
|
|
1568
|
+
for (const a of Object.keys(e == null ? void 0 : e.groups) || [])
|
|
1569
|
+
for (const i of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1570
|
+
const n = await u.dataMapper.executeMapper(
|
|
1571
|
+
g.AvailabilityMapper,
|
|
1572
|
+
{ ...i, groupId: a },
|
|
1573
|
+
r
|
|
1574
|
+
), s = {
|
|
1575
|
+
...i,
|
|
1576
|
+
note: i.note ?? void 0,
|
|
1577
|
+
kosParentId: this.id,
|
|
1578
|
+
groupId: a,
|
|
1579
|
+
rawId: i.id,
|
|
1580
|
+
data: n,
|
|
1581
|
+
type: i.type,
|
|
1582
|
+
taggedIds: i.taggedIds
|
|
1583
|
+
}, l = this._availabilityItems.getModel(
|
|
1584
|
+
`${this.id}-${a}-${i.id}`
|
|
1585
|
+
);
|
|
1586
|
+
l && l.updateModel(s);
|
|
1587
|
+
}
|
|
1588
|
+
this.updateGroupMembers();
|
|
1589
|
+
}
|
|
1590
|
+
// -------------------ENTITY----------------------------
|
|
1591
|
+
};
|
|
1592
|
+
Q([
|
|
1593
|
+
M
|
|
1594
|
+
], w.prototype, "_availabilityItems", 2);
|
|
1595
|
+
Q([
|
|
1596
|
+
ve()
|
|
1597
|
+
], w.prototype, "pour", 1);
|
|
1598
|
+
Q([
|
|
1599
|
+
ve()
|
|
1600
|
+
], w.prototype, "fixedPour", 1);
|
|
1601
|
+
Q([
|
|
1602
|
+
q({
|
|
1603
|
+
topic: `${Dr}/availability`,
|
|
1604
|
+
websocket: !0
|
|
1605
|
+
})
|
|
1606
|
+
], w.prototype, "updateAvailability", 1);
|
|
1607
|
+
w = Q([
|
|
1608
|
+
m(Z)
|
|
1609
|
+
], w);
|
|
1610
|
+
const we = {
|
|
1611
|
+
registration: {
|
|
1612
|
+
[Z]: {
|
|
1613
|
+
class: w,
|
|
1614
|
+
singleton: !1
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
type: Z,
|
|
1618
|
+
predicate: v(Z),
|
|
1619
|
+
factory: P.Factory.create(Z)
|
|
1620
|
+
};
|
|
1621
|
+
var Lr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, tt = (e, t, r, a) => {
|
|
1622
|
+
for (var i = a > 1 ? void 0 : a ? Br(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
1623
|
+
(s = e[n]) && (i = (a ? s(t, r, i) : s(i)) || i);
|
|
1624
|
+
return a && i && Lr(t, r, i), i;
|
|
1625
|
+
};
|
|
1626
|
+
const rt = "device-assembly-model";
|
|
1627
|
+
let de = class {
|
|
1628
|
+
constructor(e, t, r) {
|
|
1629
|
+
o(this, "id");
|
|
1630
|
+
o(this, "deviceNozzles");
|
|
1631
|
+
o(this, "logger");
|
|
1632
|
+
this.id = e, this.logger = r.logger, this.deviceNozzles = new E();
|
|
1633
|
+
}
|
|
1634
|
+
// -------------------LIFECYCLE----------------------------
|
|
1635
|
+
async init() {
|
|
1636
|
+
this.logger.debug(`initializing device-assembly ${this.id}`);
|
|
1637
|
+
}
|
|
1638
|
+
getNozzle(e) {
|
|
1639
|
+
return this.deviceNozzles.getModel(e);
|
|
1640
|
+
}
|
|
1641
|
+
get nozzlePaths() {
|
|
1642
|
+
return this.deviceNozzles.data.map((e) => e.path);
|
|
1643
|
+
}
|
|
1644
|
+
async load() {
|
|
1645
|
+
this.logger.debug(`loading device-assembly ${this.id}`);
|
|
1646
|
+
const e = await Fe();
|
|
1647
|
+
(e == null ? void 0 : e.status) === 200 && e.data.assemblies.map((r) => r.nozzles).flat().forEach((r) => {
|
|
1648
|
+
var s;
|
|
1649
|
+
const a = r.path, i = ((s = r.pipelines.find((l) => l.name === "beverage")) == null ? void 0 : s.topicPrefix) || "", n = we.factory(a)({
|
|
1650
|
+
path: r.path,
|
|
1651
|
+
name: r.name,
|
|
1652
|
+
urlPrefix: r.urlPrefix,
|
|
1653
|
+
topicPrefix: r.topicPrefix,
|
|
1654
|
+
beverageTopicPrefix: i
|
|
1655
|
+
});
|
|
1656
|
+
this.deviceNozzles.addModel(n);
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
tt([
|
|
1661
|
+
M
|
|
1662
|
+
], de.prototype, "deviceNozzles", 2);
|
|
1663
|
+
de = tt([
|
|
1664
|
+
m(rt)
|
|
1665
|
+
], de);
|
|
1666
|
+
const Ar = new yt({
|
|
1667
|
+
class: de,
|
|
1668
|
+
type: rt
|
|
1669
|
+
}), Re = {
|
|
1670
|
+
...je.registration,
|
|
1671
|
+
...Le.registration,
|
|
1672
|
+
...qe.registration,
|
|
1673
|
+
...He.registration,
|
|
1674
|
+
...we.registration,
|
|
1675
|
+
...We.registration,
|
|
1676
|
+
...Pe.registration,
|
|
1677
|
+
...Ie.registration,
|
|
1678
|
+
...et.registration,
|
|
1679
|
+
...Xe.registration
|
|
1680
|
+
}, jr = (e) => () => (It(e)(), Ar.register(), Object.keys(Re).forEach((t) => {
|
|
1681
|
+
const r = Re[t];
|
|
1682
|
+
ft(e)(t, r);
|
|
1683
|
+
}), u[X].register(
|
|
1684
|
+
"FirmwareUpdateInProgressTrouble",
|
|
1685
|
+
async (t) => {
|
|
1686
|
+
var r;
|
|
1687
|
+
if ((r = t.data) != null && r.deviceId) {
|
|
1688
|
+
const { model: a } = S(
|
|
1689
|
+
et.type
|
|
1690
|
+
);
|
|
1691
|
+
if (a) {
|
|
1692
|
+
const i = a.boards.find(
|
|
1693
|
+
(n) => n.id === t.data.deviceId
|
|
1694
|
+
) ? S(t.data.deviceId).model : void 0;
|
|
1695
|
+
return {
|
|
1696
|
+
devices: i ? i.name : ""
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return {};
|
|
1701
|
+
}
|
|
1702
|
+
), {
|
|
1703
|
+
preload: _.model.preloadModel(e),
|
|
1704
|
+
model: _.model.register(e),
|
|
1705
|
+
companion: _.companion.register(e),
|
|
1706
|
+
legacy: _.model.registerLegacyModel(e)
|
|
1707
|
+
}), b = {
|
|
1708
|
+
...mt
|
|
1709
|
+
};
|
|
1710
|
+
b.dispense = {
|
|
1711
|
+
models: jr(b)
|
|
1712
|
+
};
|
|
1713
|
+
b.preload = _.model.preloadModel(b);
|
|
1714
|
+
b.model = _.model.register(b);
|
|
1715
|
+
b.companion = _.companion.register(b);
|
|
1716
|
+
b.legacy = _.model.registerLegacyModel(b);
|
|
1717
|
+
const kr = b;
|
|
1718
|
+
export {
|
|
1719
|
+
et as A,
|
|
1720
|
+
x as B,
|
|
1721
|
+
$r as C,
|
|
1722
|
+
$ as D,
|
|
1723
|
+
g as E,
|
|
1724
|
+
Er as F,
|
|
1725
|
+
zr as G,
|
|
1726
|
+
He as H,
|
|
1727
|
+
Le as I,
|
|
1728
|
+
kr as K,
|
|
1729
|
+
we as N,
|
|
1730
|
+
We as P,
|
|
1731
|
+
Ke as T,
|
|
1732
|
+
Ie as a,
|
|
1733
|
+
Ve as b,
|
|
1734
|
+
Xe as c,
|
|
1735
|
+
Je as d,
|
|
1736
|
+
Ar as e,
|
|
1737
|
+
qe as f,
|
|
1738
|
+
je as g,
|
|
1739
|
+
Pe as h,
|
|
1740
|
+
ke as i,
|
|
1741
|
+
p as j,
|
|
1742
|
+
Re as k,
|
|
1743
|
+
_t as l,
|
|
1744
|
+
Vr as m,
|
|
1745
|
+
St as n,
|
|
1746
|
+
Yr as o,
|
|
1747
|
+
Kr as p,
|
|
1748
|
+
Fr as q,
|
|
1749
|
+
jr as r,
|
|
1750
|
+
xt as s,
|
|
1751
|
+
Tt as t,
|
|
1752
|
+
Rt as u,
|
|
1753
|
+
Fe as v,
|
|
1754
|
+
ur as w,
|
|
1755
|
+
gr as x,
|
|
1756
|
+
Sr as y,
|
|
1757
|
+
Cr as z
|
|
1758
|
+
};
|
|
1759
|
+
//# sourceMappingURL=dispense-registration-manager-DxIbOft8.js.map
|