@kosdev-code/kos-dispense-sdk 3.0.27 → 3.0.29
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 +7 -0
- package/{dispense-registration-manager-Dtb31fcI.cjs → dispense-registration-manager-CfWgJqfq.cjs} +590 -172
- package/dispense-registration-manager-CfWgJqfq.cjs.map +1 -0
- package/{dispense-registration-manager-Da9CW_cN.js → dispense-registration-manager-DtN0T_JG.js} +623 -205
- package/dispense-registration-manager-DtN0T_JG.js.map +1 -0
- package/{extension-utils-Cfhe358W.cjs → extension-utils-BWYG2dYG.cjs} +2 -2
- package/extension-utils-BWYG2dYG.cjs.map +1 -0
- package/{extension-utils-D_dnBLH6.js → extension-utils-BoXtjU5_.js} +2 -2
- package/extension-utils-BoXtjU5_.js.map +1 -0
- package/index.cjs +7 -5
- package/index.cjs.map +1 -1
- package/index.js +67 -65
- package/index.js.map +1 -1
- package/models/models/assembly/assembly-model.d.ts +8 -0
- package/models/models/assembly/assembly-model.d.ts.map +1 -1
- package/models/models/assembly/assembly-registration.d.ts +2 -0
- package/models/models/assembly/assembly-registration.d.ts.map +1 -1
- package/models/models/assembly/board-utils.d.ts.map +1 -1
- package/models/models/assembly/nozzle-utils.d.ts.map +1 -1
- package/models/models/assembly/pump-utils.d.ts.map +1 -1
- package/models/models/assembly/services/assembly-services.d.ts.map +1 -1
- package/models/models/assembly/types/index.d.ts +6 -0
- package/models/models/availability/availability-model.d.ts +2 -0
- package/models/models/availability/availability-model.d.ts.map +1 -1
- package/models/models/availability/types/index.d.ts +4 -0
- package/models/models/board/board-container-model.d.ts +8 -0
- package/models/models/board/board-container-model.d.ts.map +1 -1
- package/models/models/board/board-container-registration.d.ts +2 -0
- package/models/models/board/board-container-registration.d.ts.map +1 -1
- package/models/models/board/board-registration.d.ts +2 -0
- package/models/models/board/board-registration.d.ts.map +1 -1
- package/models/models/board/types/index.d.ts +12 -0
- 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 +4 -0
- package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -1
- package/models/models/device-assembly/device-assembly-registration.d.ts +2 -0
- package/models/models/device-assembly/device-assembly-registration.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 +16 -0
- package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
- package/models/models/generic-pour/generic-pour-registration.d.ts +2 -0
- package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -1
- package/models/models/generic-pour/types/index.d.ts +4 -0
- package/models/models/holder/holder-model.d.ts +6 -0
- package/models/models/holder/holder-model.d.ts.map +1 -1
- package/models/models/holder/services/holder-services.d.ts.map +1 -1
- package/models/models/holder/types/index.d.ts +6 -0
- package/models/models/holder-container/holder-container-model.d.ts +2 -0
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
- package/models/models/holder-container/types/index.d.ts +14 -0
- package/models/models/index.d.ts +1 -0
- package/models/models/index.d.ts.map +1 -1
- package/models/models/ingredient/ingredient-model.d.ts +2 -0
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
- package/models/models/ingredient/types/index.d.ts +4 -1
- package/models/models/ingredient-container/ingredient-container-model.d.ts +2 -0
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
- package/models/models/ingredient-container/types/index.d.ts +6 -0
- package/models/models/nozzle/nozzle-model.d.ts +4 -2
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/models/nozzle/types/index.d.ts +6 -0
- package/models/models/pump/pump-model.d.ts +2 -0
- package/models/models/pump/pump-model.d.ts.map +1 -1
- package/models/models/pump/types/index.d.ts +6 -0
- package/models/models/pump-container/pump-container-model.d.ts +6 -0
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
- package/models/models/pump-container/types/index.d.ts +6 -0
- package/models/utils/dispense-registration-manager.d.ts +29 -4
- package/models/utils/dispense-registration-manager.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +22 -0
- package/models/utils/extension-utils.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/service.d.ts +1 -1
- package/models/utils/services/dispense/1.6.5/service.d.ts +1 -1
- package/models/utils/services/dispense/1.8.1/service.d.ts +1 -1
- package/models/utils/services/dispense/daily/service.d.ts +1 -1
- package/models.cjs +4 -2
- package/models.cjs.map +1 -1
- package/models.js +17 -15
- package/package.json +2 -2
- package/{pump-provider-uNNMh9uh.cjs → pump-provider-B4WR3LiY.cjs} +402 -443
- package/pump-provider-B4WR3LiY.cjs.map +1 -0
- package/{pump-provider-BQmCKz7S.js → pump-provider-CPUsLke5.js} +448 -489
- package/pump-provider-CPUsLke5.js.map +1 -0
- package/ui/contexts/assembly/assembly-provider.d.ts +8 -0
- package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -1
- package/ui/contexts/availability/availability-provider.d.ts +8 -0
- package/ui/contexts/availability/availability-provider.d.ts.map +1 -1
- package/ui/contexts/board/board-provider.d.ts +8 -0
- package/ui/contexts/board/board-provider.d.ts.map +1 -1
- package/ui/contexts/board-container/board-container-provider.d.ts +8 -0
- package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts +16 -1
- package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts +8 -0
- package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -1
- package/ui/contexts/holder/holder-provider.d.ts +8 -0
- package/ui/contexts/holder/holder-provider.d.ts.map +1 -1
- package/ui/contexts/holder-container/holder-container-provider.d.ts +8 -0
- package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient/ingredient-provider.d.ts +8 -0
- package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -1
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +8 -0
- package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -1
- package/ui/contexts/nozzle/nozzle-provider.d.ts +8 -0
- package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -1
- package/ui/contexts/pump/pump-provider.d.ts +8 -0
- package/ui/contexts/pump/pump-provider.d.ts.map +1 -1
- package/ui/hooks/assembly/use-assembly.d.ts +4 -0
- package/ui/hooks/assembly/use-assembly.d.ts.map +1 -1
- package/ui/hooks/assembly/with-assembly.d.ts +4 -0
- package/ui/hooks/assembly/with-assembly.d.ts.map +1 -1
- package/ui/hooks/availability/use-availability.d.ts +4 -0
- package/ui/hooks/availability/use-availability.d.ts.map +1 -1
- package/ui/hooks/board/use-board.d.ts +4 -0
- package/ui/hooks/board/use-board.d.ts.map +1 -1
- package/ui/hooks/board/with-board.d.ts +4 -0
- package/ui/hooks/board/with-board.d.ts.map +1 -1
- package/ui/hooks/board-container/use-board-container.d.ts +4 -0
- package/ui/hooks/board-container/use-board-container.d.ts.map +1 -1
- package/ui/hooks/board-container/with-board-container.d.ts +4 -0
- package/ui/hooks/board-container/with-board-container.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
- package/ui/hooks/cui-kit/use-cui-kit.d.ts +50 -5
- 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.map +1 -1
- package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -1
- package/ui/hooks/device-assembly/use-device-assembly.d.ts +4 -0
- package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -1
- package/ui/hooks/device-assembly/with-device-assembly.d.ts +4 -0
- package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -1
- package/ui/hooks/generic-pour/use-generic-pour.d.ts +4 -0
- package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
- package/ui/hooks/generic-pour/with-generic-pour.d.ts +4 -0
- package/ui/hooks/generic-pour/with-generic-pour.d.ts.map +1 -1
- package/ui/hooks/holder/use-holder.d.ts +4 -0
- package/ui/hooks/holder/use-holder.d.ts.map +1 -1
- package/ui/hooks/holder/with-holder.d.ts +4 -0
- package/ui/hooks/holder/with-holder.d.ts.map +1 -1
- package/ui/hooks/holder-container/use-holder-container.d.ts +4 -0
- package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -1
- package/ui/hooks/holder-container/with-holder-container.d.ts +4 -0
- package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +7 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient.d.ts +4 -0
- package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient/with-ingredient.d.ts +4 -0
- package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +4 -0
- package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +4 -0
- package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -1
- package/ui/hooks/nozzle/use-nozzle.d.ts +4 -0
- package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle/with-nozzle.d.ts +4 -0
- package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +7 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
- package/ui/hooks/pour/use-pour.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +4 -0
- 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 -0
- package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
- package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +10 -0
- 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 +4 -0
- 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 +4 -0
- 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 -0
- package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.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 -2
- package/ui.cjs.map +1 -1
- package/ui.js +49 -48
- package/ui.js.map +1 -1
- package/dispense-registration-manager-Da9CW_cN.js.map +0 -1
- package/dispense-registration-manager-Dtb31fcI.cjs.map +0 -1
- package/extension-utils-Cfhe358W.cjs.map +0 -1
- package/extension-utils-D_dnBLH6.js.map +0 -1
- package/pump-provider-BQmCKz7S.js.map +0 -1
- package/pump-provider-uNNMh9uh.cjs.map +0 -1
package/{dispense-registration-manager-Da9CW_cN.js → dispense-registration-manager-DtN0T_JG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { kosModel, Kos, isKosModel, resolveServiceUrl, ServiceFactory, KosLog, KosModelContainer, KosExtensionUtils, kosChild, FetchError, ExtensionManager, EXTENSION_TROUBLE_MAPPER, EXTENSION_TROUBLE_DATA_MAPPER, getKosModelSync, kosDependency, kosTroubleAware, kosAction, kosTopicHandler, DependencyLifecycle, getKosModel, FutureManager, kosFuture, FutureHandler, EXTENSION_FEATURE_FLAG_RESOLVER, isKosDataModel, ChildModels, KosFeatureFlags, kosParentAware, createPropKey, kosStateEntry, kosStateExit, kosStateGuard, kosLoggerAware, kosStateMachine, MultipleFutureHandler, arraysEqual, getAllKosCompanionModels, EventBus, KosContextManager, destroyKosModel, SingletonKosModelRegistrationFactory, kosFutureAware, ObservableData, KosModelRegistrationFactory, KosModelRegistry as KosModelRegistry$1, RegistrationManager, registerCoreModels, registerLegacyModel } from "@kosdev-code/kos-ui-sdk";
|
|
1
|
+
import { kosModel, Kos, isKosModel, resolveServiceUrl, ServiceFactory, KosLog, LogGroup, KosModelContainer, KosExtensionUtils, kosChild, FetchError, ExtensionManager, EXTENSION_TROUBLE_MAPPER, EXTENSION_TROUBLE_DATA_MAPPER, getKosModelSync, kosDependency, kosTroubleAware, kosAction, kosTopicHandler, DependencyLifecycle, getKosModel, FutureManager, kosFuture, FutureHandler, EXTENSION_FEATURE_FLAG_RESOLVER, isKosDataModel, ChildModels, KosFeatureFlags, kosParentAware, createPropKey, kosStateEntry, kosStateExit, kosStateGuard, kosLoggerAware, kosStateMachine, MultipleFutureHandler, arraysEqual, getAllKosCompanionModels, EventBus, KosContextManager, destroyKosModel, kosModelEffect, getKosCompanionModel, SingletonKosModelRegistrationFactory, kosFutureAware, ObservableData, KosModelRegistrationFactory, KosModelRegistry as KosModelRegistry$1, RegistrationManager, registerCoreModels, registerLegacyModel } from "@kosdev-code/kos-ui-sdk";
|
|
2
2
|
import "react";
|
|
3
3
|
var ExtensionType = /* @__PURE__ */ ((ExtensionType2) => {
|
|
4
4
|
ExtensionType2["IngredientLoader"] = "kos.ingredient.loader";
|
|
@@ -30,15 +30,15 @@ var DispenseModelType = /* @__PURE__ */ ((DispenseModelType2) => {
|
|
|
30
30
|
DispenseModelType2["PumpContainer"] = "pump-container-model";
|
|
31
31
|
return DispenseModelType2;
|
|
32
32
|
})(DispenseModelType || {});
|
|
33
|
-
var __getOwnPropDesc$
|
|
34
|
-
var __decorateClass$
|
|
35
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
33
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
34
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
35
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
36
36
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
37
37
|
if (decorator = decorators[i])
|
|
38
38
|
result = decorator(result) || result;
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
|
-
const MODEL_TYPE$
|
|
41
|
+
const MODEL_TYPE$d = "ingredient-model";
|
|
42
42
|
let IngredientModelImpl = class {
|
|
43
43
|
id;
|
|
44
44
|
ingredientId;
|
|
@@ -75,19 +75,19 @@ let IngredientModelImpl = class {
|
|
|
75
75
|
// -------------------LIFECYCLE----------------------------
|
|
76
76
|
// -------------------ENTITY----------------------------
|
|
77
77
|
};
|
|
78
|
-
IngredientModelImpl = __decorateClass$
|
|
79
|
-
kosModel(MODEL_TYPE$
|
|
78
|
+
IngredientModelImpl = __decorateClass$d([
|
|
79
|
+
kosModel(MODEL_TYPE$d)
|
|
80
80
|
], IngredientModelImpl);
|
|
81
81
|
const Ingredient = {
|
|
82
82
|
registration: {
|
|
83
|
-
[MODEL_TYPE$
|
|
83
|
+
[MODEL_TYPE$d]: {
|
|
84
84
|
class: IngredientModelImpl,
|
|
85
85
|
singleton: false
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
type: MODEL_TYPE$
|
|
89
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
90
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
88
|
+
type: MODEL_TYPE$d,
|
|
89
|
+
predicate: isKosModel(MODEL_TYPE$d),
|
|
90
|
+
factory: Kos.Factory.create(MODEL_TYPE$d)
|
|
91
91
|
};
|
|
92
92
|
const { URL: URL$6 } = resolveServiceUrl("INGREDIENT_SERVICE");
|
|
93
93
|
const { getOne: getOne$3 } = ServiceFactory.build({
|
|
@@ -99,18 +99,21 @@ const getIngredients = async () => {
|
|
|
99
99
|
});
|
|
100
100
|
return response;
|
|
101
101
|
};
|
|
102
|
-
var __defProp$
|
|
103
|
-
var __getOwnPropDesc$
|
|
104
|
-
var __decorateClass$
|
|
105
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
102
|
+
var __defProp$a = Object.defineProperty;
|
|
103
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
104
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
105
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
106
106
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
107
107
|
if (decorator = decorators[i])
|
|
108
108
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
109
|
-
if (kind && result) __defProp$
|
|
109
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
110
110
|
return result;
|
|
111
111
|
};
|
|
112
|
-
const MODEL_TYPE$
|
|
113
|
-
const log$
|
|
112
|
+
const MODEL_TYPE$c = "ingredient-container-model";
|
|
113
|
+
const log$4 = KosLog.createLogger({
|
|
114
|
+
group: LogGroup.model,
|
|
115
|
+
name: "ingredient-container-model"
|
|
116
|
+
});
|
|
114
117
|
let IngredientContainerModelImpl = class {
|
|
115
118
|
id;
|
|
116
119
|
ingredients;
|
|
@@ -131,7 +134,7 @@ let IngredientContainerModelImpl = class {
|
|
|
131
134
|
return this.ingredients.getIndexByKey("ingredientType", type);
|
|
132
135
|
}
|
|
133
136
|
async load(context) {
|
|
134
|
-
log$
|
|
137
|
+
log$4.debug(`loading ingredient container ${this.id}`);
|
|
135
138
|
const allIngredients = await getIngredients();
|
|
136
139
|
if (allIngredients?.status !== 200) {
|
|
137
140
|
throw new Error("Failed to load ingredients");
|
|
@@ -168,30 +171,30 @@ let IngredientContainerModelImpl = class {
|
|
|
168
171
|
}
|
|
169
172
|
// -------------------ENTITY----------------------------
|
|
170
173
|
};
|
|
171
|
-
__decorateClass$
|
|
174
|
+
__decorateClass$c([
|
|
172
175
|
kosChild
|
|
173
176
|
], IngredientContainerModelImpl.prototype, "ingredients", 2);
|
|
174
|
-
IngredientContainerModelImpl = __decorateClass$
|
|
175
|
-
kosModel(MODEL_TYPE$
|
|
177
|
+
IngredientContainerModelImpl = __decorateClass$c([
|
|
178
|
+
kosModel(MODEL_TYPE$c)
|
|
176
179
|
], IngredientContainerModelImpl);
|
|
177
180
|
const IngredientContainer = {
|
|
178
181
|
registration: {
|
|
179
|
-
[MODEL_TYPE$
|
|
182
|
+
[MODEL_TYPE$c]: {
|
|
180
183
|
class: IngredientContainerModelImpl,
|
|
181
184
|
singleton: true
|
|
182
185
|
}
|
|
183
186
|
},
|
|
184
|
-
type: MODEL_TYPE$
|
|
185
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
186
|
-
factory: Kos.Singleton.create(MODEL_TYPE$
|
|
187
|
+
type: MODEL_TYPE$c,
|
|
188
|
+
predicate: isKosModel(MODEL_TYPE$c),
|
|
189
|
+
factory: Kos.Singleton.create(MODEL_TYPE$c)
|
|
187
190
|
};
|
|
188
191
|
const { URL: URL$5 } = resolveServiceUrl("HOLDER_SERVICE");
|
|
189
192
|
const { getAll: getAll$1, postModel: postModel$4, deleteModel: deleteModel$2 } = ServiceFactory.build({
|
|
190
193
|
basePath: `${URL$5}/api/kos/holders`
|
|
191
194
|
});
|
|
192
|
-
const log$
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
const log$3 = KosLog.createLogger({
|
|
196
|
+
group: LogGroup.service,
|
|
197
|
+
name: "holder-service"
|
|
195
198
|
});
|
|
196
199
|
const getHolders = async () => {
|
|
197
200
|
const response = await getAll$1({});
|
|
@@ -219,7 +222,7 @@ const unassignHolderIngredient = async (holderPath) => {
|
|
|
219
222
|
};
|
|
220
223
|
const replaceLine = async (holderPath) => {
|
|
221
224
|
if (!holderPath) throw new Error("Missing holderPath");
|
|
222
|
-
log$
|
|
225
|
+
log$3.debug(
|
|
223
226
|
`sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${holderPath}`
|
|
224
227
|
);
|
|
225
228
|
const response = await postModel$4({
|
|
@@ -273,18 +276,21 @@ const deleteAssignment = async (id) => {
|
|
|
273
276
|
const response = await deleteModel$1({ id, fos: useFos });
|
|
274
277
|
return response;
|
|
275
278
|
};
|
|
276
|
-
var __defProp$
|
|
277
|
-
var __getOwnPropDesc$
|
|
278
|
-
var __decorateClass$
|
|
279
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
279
|
+
var __defProp$9 = Object.defineProperty;
|
|
280
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
281
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
282
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
280
283
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
281
284
|
if (decorator = decorators[i])
|
|
282
285
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
283
|
-
if (kind && result) __defProp$
|
|
286
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
284
287
|
return result;
|
|
285
288
|
};
|
|
286
|
-
const MODEL_TYPE$
|
|
287
|
-
const log$
|
|
289
|
+
const MODEL_TYPE$b = DispenseModelType.Holder;
|
|
290
|
+
const log$2 = KosLog.createLogger({
|
|
291
|
+
group: LogGroup.model,
|
|
292
|
+
name: "holder-model"
|
|
293
|
+
});
|
|
288
294
|
ExtensionManager[EXTENSION_TROUBLE_MAPPER].register(
|
|
289
295
|
"holder",
|
|
290
296
|
async (trouble) => {
|
|
@@ -561,7 +567,7 @@ let HolderModelImpl = class {
|
|
|
561
567
|
});
|
|
562
568
|
return result;
|
|
563
569
|
} catch (e) {
|
|
564
|
-
log$
|
|
570
|
+
log$2.error(`Failed to perform rfid override on holder ${this.id}`, e);
|
|
565
571
|
throw e;
|
|
566
572
|
}
|
|
567
573
|
}
|
|
@@ -576,7 +582,7 @@ let HolderModelImpl = class {
|
|
|
576
582
|
this.ingredientId = ingredientId;
|
|
577
583
|
});
|
|
578
584
|
} catch (e) {
|
|
579
|
-
log$
|
|
585
|
+
log$2.error(`Failed to perform assign ingredient to holder ${this.id}`, e);
|
|
580
586
|
throw e;
|
|
581
587
|
}
|
|
582
588
|
}
|
|
@@ -610,26 +616,26 @@ let HolderModelImpl = class {
|
|
|
610
616
|
// }
|
|
611
617
|
// -------------------ENTITY----------------------------
|
|
612
618
|
};
|
|
613
|
-
__decorateClass$
|
|
619
|
+
__decorateClass$b([
|
|
614
620
|
kosChild
|
|
615
621
|
], HolderModelImpl.prototype, "pumps", 2);
|
|
616
|
-
__decorateClass$
|
|
622
|
+
__decorateClass$b([
|
|
617
623
|
kosDependency({ modelType: IngredientContainer.type })
|
|
618
624
|
], HolderModelImpl.prototype, "ingredientContainer", 2);
|
|
619
|
-
HolderModelImpl = __decorateClass$
|
|
620
|
-
kosModel(MODEL_TYPE$
|
|
625
|
+
HolderModelImpl = __decorateClass$b([
|
|
626
|
+
kosModel(MODEL_TYPE$b),
|
|
621
627
|
kosTroubleAware()
|
|
622
628
|
], HolderModelImpl);
|
|
623
629
|
const Holder = {
|
|
624
630
|
registration: {
|
|
625
|
-
[MODEL_TYPE$
|
|
631
|
+
[MODEL_TYPE$b]: {
|
|
626
632
|
class: HolderModelImpl,
|
|
627
633
|
singleton: false
|
|
628
634
|
}
|
|
629
635
|
},
|
|
630
|
-
type: MODEL_TYPE$
|
|
631
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
632
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
636
|
+
type: MODEL_TYPE$b,
|
|
637
|
+
predicate: isKosModel(MODEL_TYPE$b),
|
|
638
|
+
factory: Kos.Factory.create(MODEL_TYPE$b)
|
|
633
639
|
};
|
|
634
640
|
const mapAssemblyHolderToModel = async (group, holderData) => {
|
|
635
641
|
const _ingredientId = ExtensionManager.propertyMapper.executeMapper(
|
|
@@ -676,26 +682,26 @@ const { URL: URL$3 } = resolveServiceUrl("ASSEMBLY_SERVICE");
|
|
|
676
682
|
const { getOne: getOne$2 } = ServiceFactory.build({
|
|
677
683
|
basePath: `${URL$3}/api/kos/device/assemblies`
|
|
678
684
|
});
|
|
679
|
-
const log = KosLog.createLogger({
|
|
680
|
-
|
|
681
|
-
|
|
685
|
+
const log$1 = KosLog.createLogger({
|
|
686
|
+
group: LogGroup.service,
|
|
687
|
+
name: "assembly-service"
|
|
682
688
|
});
|
|
683
689
|
const getAssembly = async () => {
|
|
684
|
-
log.debug("sending GET for assembly");
|
|
690
|
+
log$1.debug("sending GET for assembly");
|
|
685
691
|
const response = await getOne$2({});
|
|
686
692
|
return response;
|
|
687
693
|
};
|
|
688
|
-
var __defProp$
|
|
689
|
-
var __getOwnPropDesc$
|
|
690
|
-
var __decorateClass$
|
|
691
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
694
|
+
var __defProp$8 = Object.defineProperty;
|
|
695
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
696
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
697
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
692
698
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
693
699
|
if (decorator = decorators[i])
|
|
694
700
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
695
|
-
if (kind && result) __defProp$
|
|
701
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
696
702
|
return result;
|
|
697
703
|
};
|
|
698
|
-
const MODEL_TYPE$
|
|
704
|
+
const MODEL_TYPE$a = "board-container-model";
|
|
699
705
|
const TOPIC_BOARD_LINKED = "/kos/hardware/board/linked";
|
|
700
706
|
const TOPIC_BOARD_UNLINKED = "/kos/hardware/board/unlinked";
|
|
701
707
|
let BoardContainerModel = class {
|
|
@@ -749,25 +755,25 @@ let BoardContainerModel = class {
|
|
|
749
755
|
}
|
|
750
756
|
}
|
|
751
757
|
};
|
|
752
|
-
__decorateClass$
|
|
758
|
+
__decorateClass$a([
|
|
753
759
|
kosChild
|
|
754
760
|
], BoardContainerModel.prototype, "models", 2);
|
|
755
|
-
__decorateClass$
|
|
761
|
+
__decorateClass$a([
|
|
756
762
|
kosTopicHandler({
|
|
757
763
|
lifecycle: DependencyLifecycle.INIT,
|
|
758
764
|
topic: TOPIC_BOARD_LINKED,
|
|
759
765
|
websocket: true
|
|
760
766
|
})
|
|
761
767
|
], BoardContainerModel.prototype, "handleBoardLinkEvent", 1);
|
|
762
|
-
__decorateClass$
|
|
768
|
+
__decorateClass$a([
|
|
763
769
|
kosTopicHandler({
|
|
764
770
|
lifecycle: DependencyLifecycle.INIT,
|
|
765
771
|
topic: TOPIC_BOARD_UNLINKED,
|
|
766
772
|
websocket: true
|
|
767
773
|
})
|
|
768
774
|
], BoardContainerModel.prototype, "handleBoardUnlinkEvent", 1);
|
|
769
|
-
BoardContainerModel = __decorateClass$
|
|
770
|
-
kosModel(MODEL_TYPE$
|
|
775
|
+
BoardContainerModel = __decorateClass$a([
|
|
776
|
+
kosModel(MODEL_TYPE$a)
|
|
771
777
|
], BoardContainerModel);
|
|
772
778
|
const boardTroubleDataMapper = async (trouble) => {
|
|
773
779
|
const boardPath = trouble.data.boardPath;
|
|
@@ -776,17 +782,17 @@ const boardTroubleDataMapper = async (trouble) => {
|
|
|
776
782
|
boardName: model?.name || ""
|
|
777
783
|
};
|
|
778
784
|
};
|
|
779
|
-
var __defProp$
|
|
780
|
-
var __getOwnPropDesc$
|
|
781
|
-
var __decorateClass$
|
|
782
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
785
|
+
var __defProp$7 = Object.defineProperty;
|
|
786
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
787
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
788
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
783
789
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
784
790
|
if (decorator = decorators[i])
|
|
785
791
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
786
|
-
if (kind && result) __defProp$
|
|
792
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
787
793
|
return result;
|
|
788
794
|
};
|
|
789
|
-
const MODEL_TYPE$
|
|
795
|
+
const MODEL_TYPE$9 = DispenseModelType.PumpContainer;
|
|
790
796
|
var PumpIndex = /* @__PURE__ */ ((PumpIndex2) => {
|
|
791
797
|
PumpIndex2["byBoard"] = "byBoard";
|
|
792
798
|
PumpIndex2["byType"] = "byType";
|
|
@@ -842,23 +848,23 @@ let PumpContainerModelImpl = class {
|
|
|
842
848
|
}
|
|
843
849
|
// -------------------ENTITY----------------------------
|
|
844
850
|
};
|
|
845
|
-
__decorateClass$
|
|
851
|
+
__decorateClass$9([
|
|
846
852
|
kosChild
|
|
847
853
|
], PumpContainerModelImpl.prototype, "pumps", 2);
|
|
848
|
-
PumpContainerModelImpl = __decorateClass$
|
|
849
|
-
kosModel(MODEL_TYPE$
|
|
854
|
+
PumpContainerModelImpl = __decorateClass$9([
|
|
855
|
+
kosModel(MODEL_TYPE$9)
|
|
850
856
|
], PumpContainerModelImpl);
|
|
851
857
|
const PumpContainer = {
|
|
852
858
|
registration: {
|
|
853
|
-
[MODEL_TYPE$
|
|
859
|
+
[MODEL_TYPE$9]: {
|
|
854
860
|
class: PumpContainerModelImpl,
|
|
855
861
|
singleton: true
|
|
856
862
|
}
|
|
857
863
|
},
|
|
858
|
-
type: MODEL_TYPE$
|
|
859
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
864
|
+
type: MODEL_TYPE$9,
|
|
865
|
+
predicate: isKosModel(MODEL_TYPE$9),
|
|
860
866
|
factory: Kos.Singleton.create(
|
|
861
|
-
MODEL_TYPE$
|
|
867
|
+
MODEL_TYPE$9
|
|
862
868
|
)
|
|
863
869
|
};
|
|
864
870
|
const getPumpRelatedPaths = async (pumpPath) => {
|
|
@@ -902,15 +908,15 @@ const boardTroubleResolver = async (trouble) => {
|
|
|
902
908
|
}
|
|
903
909
|
return Array.from(new Set(result));
|
|
904
910
|
};
|
|
905
|
-
var __getOwnPropDesc$
|
|
906
|
-
var __decorateClass$
|
|
907
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
911
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
912
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
913
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
908
914
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
909
915
|
if (decorator = decorators[i])
|
|
910
916
|
result = decorator(result) || result;
|
|
911
917
|
return result;
|
|
912
918
|
};
|
|
913
|
-
const MODEL_TYPE$
|
|
919
|
+
const MODEL_TYPE$8 = "board-model";
|
|
914
920
|
const mapOptionsToModel = (options, model) => {
|
|
915
921
|
const { type, name, path, linked, instanceId, link, ...rest } = options;
|
|
916
922
|
model.type = type;
|
|
@@ -953,45 +959,45 @@ let BoardModelImpl = class {
|
|
|
953
959
|
this.logger.debug(`loading board ${this.id}`);
|
|
954
960
|
}
|
|
955
961
|
};
|
|
956
|
-
BoardModelImpl = __decorateClass$
|
|
957
|
-
kosModel(MODEL_TYPE$
|
|
962
|
+
BoardModelImpl = __decorateClass$8([
|
|
963
|
+
kosModel(MODEL_TYPE$8)
|
|
958
964
|
], BoardModelImpl);
|
|
959
965
|
const Board = {
|
|
960
966
|
registration: {
|
|
961
|
-
[MODEL_TYPE$
|
|
967
|
+
[MODEL_TYPE$8]: {
|
|
962
968
|
class: BoardModelImpl,
|
|
963
969
|
singleton: false
|
|
964
970
|
}
|
|
965
971
|
},
|
|
966
|
-
type: MODEL_TYPE$
|
|
967
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
968
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
972
|
+
type: MODEL_TYPE$8,
|
|
973
|
+
predicate: isKosModel(MODEL_TYPE$8),
|
|
974
|
+
factory: Kos.Factory.create(MODEL_TYPE$8)
|
|
969
975
|
};
|
|
970
976
|
const BoardContainer = {
|
|
971
977
|
registration: {
|
|
972
|
-
[MODEL_TYPE$
|
|
978
|
+
[MODEL_TYPE$a]: {
|
|
973
979
|
class: BoardContainerModel,
|
|
974
980
|
singleton: true
|
|
975
981
|
},
|
|
976
982
|
...Board.registration
|
|
977
983
|
},
|
|
978
|
-
type: MODEL_TYPE$
|
|
979
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
984
|
+
type: MODEL_TYPE$a,
|
|
985
|
+
predicate: isKosModel(MODEL_TYPE$a),
|
|
980
986
|
factory: Kos.Singleton.create(
|
|
981
|
-
MODEL_TYPE$
|
|
987
|
+
MODEL_TYPE$a
|
|
982
988
|
)
|
|
983
989
|
};
|
|
984
|
-
var __defProp$
|
|
985
|
-
var __getOwnPropDesc$
|
|
986
|
-
var __decorateClass$
|
|
987
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
990
|
+
var __defProp$6 = Object.defineProperty;
|
|
991
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
992
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
993
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
988
994
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
989
995
|
if (decorator = decorators[i])
|
|
990
996
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
991
|
-
if (kind && result) __defProp$
|
|
997
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
992
998
|
return result;
|
|
993
999
|
};
|
|
994
|
-
const MODEL_TYPE$
|
|
1000
|
+
const MODEL_TYPE$7 = DispenseModelType.HolderContainer;
|
|
995
1001
|
const TOPIC_INSERT_START = "/kos/insertion/insert/start";
|
|
996
1002
|
const TOPIC_INSERT_COMPLETE = "/kos/insertion/insert/complete";
|
|
997
1003
|
const TOPIC_INSERT_UPDATE = "/kos/insertion/insert/update";
|
|
@@ -1018,7 +1024,11 @@ let HolderContainerModelImpl = class {
|
|
|
1018
1024
|
}
|
|
1019
1025
|
handleHolderEvents(event) {
|
|
1020
1026
|
KosLog.ifDebug(
|
|
1021
|
-
() => this.logger.debug(
|
|
1027
|
+
() => this.logger.debug(
|
|
1028
|
+
"Received holder change event",
|
|
1029
|
+
JSON.stringify(event)
|
|
1030
|
+
),
|
|
1031
|
+
this.logger
|
|
1022
1032
|
);
|
|
1023
1033
|
const holder = this.holders.getModel(event.path);
|
|
1024
1034
|
if (holder) {
|
|
@@ -1036,7 +1046,8 @@ let HolderContainerModelImpl = class {
|
|
|
1036
1046
|
}
|
|
1037
1047
|
handleInsertion(data) {
|
|
1038
1048
|
KosLog.ifDebug(
|
|
1039
|
-
() => this.logger.debug("Received insertion event", JSON.stringify(data))
|
|
1049
|
+
() => this.logger.debug("Received insertion event", JSON.stringify(data)),
|
|
1050
|
+
this.logger
|
|
1040
1051
|
);
|
|
1041
1052
|
const wrappedData = Array.isArray(data) ? data : [data];
|
|
1042
1053
|
wrappedData.forEach((event) => {
|
|
@@ -1071,17 +1082,17 @@ let HolderContainerModelImpl = class {
|
|
|
1071
1082
|
}
|
|
1072
1083
|
// -------------------ENTITY----------------------------
|
|
1073
1084
|
};
|
|
1074
|
-
__decorateClass$
|
|
1085
|
+
__decorateClass$7([
|
|
1075
1086
|
kosChild
|
|
1076
1087
|
], HolderContainerModelImpl.prototype, "holders", 2);
|
|
1077
|
-
__decorateClass$
|
|
1088
|
+
__decorateClass$7([
|
|
1078
1089
|
kosTopicHandler({
|
|
1079
1090
|
topic: TOPIC_HOLDER_CHANGED,
|
|
1080
1091
|
websocket: true,
|
|
1081
1092
|
condition: (event, model) => model.holders.getModel(event.path) !== void 0
|
|
1082
1093
|
})
|
|
1083
1094
|
], HolderContainerModelImpl.prototype, "handleHolderEvents", 1);
|
|
1084
|
-
__decorateClass$
|
|
1095
|
+
__decorateClass$7([
|
|
1085
1096
|
kosTopicHandler({
|
|
1086
1097
|
topic: [
|
|
1087
1098
|
TOPIC_INSERT_START,
|
|
@@ -1093,23 +1104,26 @@ __decorateClass$6([
|
|
|
1093
1104
|
websocket: true
|
|
1094
1105
|
})
|
|
1095
1106
|
], HolderContainerModelImpl.prototype, "handleInsertion", 1);
|
|
1096
|
-
HolderContainerModelImpl = __decorateClass$
|
|
1097
|
-
kosModel(MODEL_TYPE$
|
|
1107
|
+
HolderContainerModelImpl = __decorateClass$7([
|
|
1108
|
+
kosModel(MODEL_TYPE$7)
|
|
1098
1109
|
], HolderContainerModelImpl);
|
|
1099
1110
|
const HolderContainer = {
|
|
1100
1111
|
registration: {
|
|
1101
|
-
[MODEL_TYPE$
|
|
1112
|
+
[MODEL_TYPE$7]: {
|
|
1102
1113
|
class: HolderContainerModelImpl,
|
|
1103
1114
|
singleton: true
|
|
1104
1115
|
}
|
|
1105
1116
|
},
|
|
1106
|
-
type: MODEL_TYPE$
|
|
1107
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1117
|
+
type: MODEL_TYPE$7,
|
|
1118
|
+
predicate: isKosModel(MODEL_TYPE$7),
|
|
1108
1119
|
factory: Kos.Singleton.create(
|
|
1109
|
-
MODEL_TYPE$
|
|
1120
|
+
MODEL_TYPE$7
|
|
1110
1121
|
)
|
|
1111
1122
|
};
|
|
1112
|
-
const Logger$1 = KosLog.createLogger({
|
|
1123
|
+
const Logger$1 = KosLog.createLogger({
|
|
1124
|
+
group: LogGroup.model,
|
|
1125
|
+
name: "board-utils"
|
|
1126
|
+
});
|
|
1113
1127
|
const mapAssemblyBoardToModel = async (board) => {
|
|
1114
1128
|
const boardExtData = await KosExtensionUtils.executeDataMapperExtension({
|
|
1115
1129
|
extension: ExtensionType.BoardMapper,
|
|
@@ -1166,17 +1180,18 @@ const getIntentVolume = async (pumpId, intent) => {
|
|
|
1166
1180
|
}
|
|
1167
1181
|
return response.data;
|
|
1168
1182
|
};
|
|
1169
|
-
var __defProp$
|
|
1170
|
-
var __getOwnPropDesc$
|
|
1171
|
-
var __decorateClass$
|
|
1172
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1183
|
+
var __defProp$5 = Object.defineProperty;
|
|
1184
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1185
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1186
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1173
1187
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1174
1188
|
if (decorator = decorators[i])
|
|
1175
1189
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1176
|
-
if (kind && result) __defProp$
|
|
1190
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
1177
1191
|
return result;
|
|
1178
1192
|
};
|
|
1179
|
-
const
|
|
1193
|
+
const log = KosLog.createLogger({ group: LogGroup.model, name: "pump-model" });
|
|
1194
|
+
const MODEL_TYPE$6 = DispenseModelType.Pump;
|
|
1180
1195
|
ExtensionManager[EXTENSION_TROUBLE_MAPPER].register(
|
|
1181
1196
|
"pump",
|
|
1182
1197
|
pumpTroubleResolver
|
|
@@ -1278,7 +1293,7 @@ let PumpModelImpl = class {
|
|
|
1278
1293
|
this.currentState = PourState.IDLE;
|
|
1279
1294
|
});
|
|
1280
1295
|
} else {
|
|
1281
|
-
|
|
1296
|
+
log.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1282
1297
|
}
|
|
1283
1298
|
}
|
|
1284
1299
|
get future() {
|
|
@@ -1313,31 +1328,34 @@ let PumpModelImpl = class {
|
|
|
1313
1328
|
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1314
1329
|
}
|
|
1315
1330
|
} catch (e) {
|
|
1316
|
-
|
|
1331
|
+
log.error(e);
|
|
1317
1332
|
this.currentState = PourState.IDLE;
|
|
1318
1333
|
throw e;
|
|
1319
1334
|
}
|
|
1320
1335
|
}
|
|
1321
1336
|
// -------------------ENTITY----------------------------
|
|
1322
1337
|
};
|
|
1323
|
-
__decorateClass$
|
|
1338
|
+
__decorateClass$6([
|
|
1324
1339
|
kosFuture()
|
|
1325
1340
|
], PumpModelImpl.prototype, "performIntent", 1);
|
|
1326
|
-
PumpModelImpl = __decorateClass$
|
|
1327
|
-
kosModel(MODEL_TYPE$
|
|
1341
|
+
PumpModelImpl = __decorateClass$6([
|
|
1342
|
+
kosModel(MODEL_TYPE$6)
|
|
1328
1343
|
], PumpModelImpl);
|
|
1329
1344
|
const Pump = {
|
|
1330
1345
|
registration: {
|
|
1331
|
-
[MODEL_TYPE$
|
|
1346
|
+
[MODEL_TYPE$6]: {
|
|
1332
1347
|
class: PumpModelImpl,
|
|
1333
1348
|
singleton: false
|
|
1334
1349
|
}
|
|
1335
1350
|
},
|
|
1336
|
-
type: MODEL_TYPE$
|
|
1337
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1338
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
1351
|
+
type: MODEL_TYPE$6,
|
|
1352
|
+
predicate: isKosModel(MODEL_TYPE$6),
|
|
1353
|
+
factory: Kos.Factory.create(MODEL_TYPE$6)
|
|
1339
1354
|
};
|
|
1340
|
-
const Logger = KosLog.createLogger({
|
|
1355
|
+
const Logger = KosLog.createLogger({
|
|
1356
|
+
group: LogGroup.model,
|
|
1357
|
+
name: "pump-utils"
|
|
1358
|
+
});
|
|
1341
1359
|
const mapAssemblyPumpToModel = (nozzlePath, pump) => {
|
|
1342
1360
|
const virtual = (pump.pumps ?? []).length > 1;
|
|
1343
1361
|
const options = {
|
|
@@ -1384,17 +1402,17 @@ const assemblyPumpMap = (pumpContainer) => (holderContainer) => (nozzle) => (ass
|
|
|
1384
1402
|
throw error;
|
|
1385
1403
|
}
|
|
1386
1404
|
};
|
|
1387
|
-
var __defProp$
|
|
1388
|
-
var __getOwnPropDesc$
|
|
1389
|
-
var __decorateClass$
|
|
1390
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1405
|
+
var __defProp$4 = Object.defineProperty;
|
|
1406
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1407
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1408
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1391
1409
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1392
1410
|
if (decorator = decorators[i])
|
|
1393
1411
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1394
|
-
if (kind && result) __defProp$
|
|
1412
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1395
1413
|
return result;
|
|
1396
1414
|
};
|
|
1397
|
-
const MODEL_TYPE$
|
|
1415
|
+
const MODEL_TYPE$5 = "assembly-model";
|
|
1398
1416
|
const CONTEXT_ASSEMBLY_DATA = "assembly-data";
|
|
1399
1417
|
const CONTEXT_ASSEMBLY_RAW_DATA = "assembly-raw-data";
|
|
1400
1418
|
let AssemblyModelImpl = class {
|
|
@@ -1524,43 +1542,43 @@ let AssemblyModelImpl = class {
|
|
|
1524
1542
|
}
|
|
1525
1543
|
}
|
|
1526
1544
|
};
|
|
1527
|
-
__decorateClass$
|
|
1545
|
+
__decorateClass$5([
|
|
1528
1546
|
kosDependency({
|
|
1529
1547
|
modelType: "trouble-container-model"
|
|
1530
1548
|
})
|
|
1531
1549
|
], AssemblyModelImpl.prototype, "troubleContainer", 2);
|
|
1532
|
-
__decorateClass$
|
|
1550
|
+
__decorateClass$5([
|
|
1533
1551
|
kosChild
|
|
1534
1552
|
], AssemblyModelImpl.prototype, "holderContainer", 2);
|
|
1535
|
-
__decorateClass$
|
|
1553
|
+
__decorateClass$5([
|
|
1536
1554
|
kosChild
|
|
1537
1555
|
], AssemblyModelImpl.prototype, "boardContainer", 2);
|
|
1538
|
-
__decorateClass$
|
|
1556
|
+
__decorateClass$5([
|
|
1539
1557
|
kosChild
|
|
1540
1558
|
], AssemblyModelImpl.prototype, "pumpContainer", 2);
|
|
1541
|
-
AssemblyModelImpl = __decorateClass$
|
|
1542
|
-
kosModel(MODEL_TYPE$
|
|
1559
|
+
AssemblyModelImpl = __decorateClass$5([
|
|
1560
|
+
kosModel(MODEL_TYPE$5)
|
|
1543
1561
|
], AssemblyModelImpl);
|
|
1544
1562
|
const Assembly = {
|
|
1545
1563
|
registration: {
|
|
1546
|
-
[MODEL_TYPE$
|
|
1564
|
+
[MODEL_TYPE$5]: {
|
|
1547
1565
|
class: AssemblyModelImpl,
|
|
1548
1566
|
singleton: true
|
|
1549
1567
|
}
|
|
1550
1568
|
},
|
|
1551
|
-
type: MODEL_TYPE$
|
|
1552
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1553
|
-
factory: Kos.Singleton.create(MODEL_TYPE$
|
|
1569
|
+
type: MODEL_TYPE$5,
|
|
1570
|
+
predicate: isKosModel(MODEL_TYPE$5),
|
|
1571
|
+
factory: Kos.Singleton.create(MODEL_TYPE$5)
|
|
1554
1572
|
};
|
|
1555
|
-
var __getOwnPropDesc$
|
|
1556
|
-
var __decorateClass$
|
|
1557
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1573
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1574
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1575
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1558
1576
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1559
1577
|
if (decorator = decorators[i])
|
|
1560
1578
|
result = decorator(result) || result;
|
|
1561
1579
|
return result;
|
|
1562
1580
|
};
|
|
1563
|
-
const MODEL_TYPE$
|
|
1581
|
+
const MODEL_TYPE$4 = DispenseModelType.Availability;
|
|
1564
1582
|
let AvailabilityModelImpl = class {
|
|
1565
1583
|
id;
|
|
1566
1584
|
data;
|
|
@@ -1606,23 +1624,38 @@ let AvailabilityModelImpl = class {
|
|
|
1606
1624
|
// -------------------LIFECYCLE----------------------------
|
|
1607
1625
|
// -------------------ENTITY----------------------------
|
|
1608
1626
|
};
|
|
1609
|
-
AvailabilityModelImpl = __decorateClass$
|
|
1627
|
+
AvailabilityModelImpl = __decorateClass$4([
|
|
1610
1628
|
kosParentAware(),
|
|
1611
|
-
kosModel(MODEL_TYPE$
|
|
1629
|
+
kosModel(MODEL_TYPE$4)
|
|
1612
1630
|
], AvailabilityModelImpl);
|
|
1613
1631
|
const Availability = {
|
|
1614
1632
|
registration: {
|
|
1615
|
-
[MODEL_TYPE$
|
|
1633
|
+
[MODEL_TYPE$4]: {
|
|
1616
1634
|
class: AvailabilityModelImpl,
|
|
1617
1635
|
singleton: false
|
|
1618
1636
|
}
|
|
1619
1637
|
},
|
|
1620
|
-
type: MODEL_TYPE$
|
|
1621
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
1638
|
+
type: MODEL_TYPE$4,
|
|
1639
|
+
predicate: isKosModel(MODEL_TYPE$4),
|
|
1622
1640
|
factory: Kos.Factory.create(
|
|
1623
|
-
MODEL_TYPE$
|
|
1641
|
+
MODEL_TYPE$4
|
|
1624
1642
|
)
|
|
1625
1643
|
};
|
|
1644
|
+
class PourContext {
|
|
1645
|
+
_data = /* @__PURE__ */ new Map();
|
|
1646
|
+
get(key) {
|
|
1647
|
+
return this._data.get(key);
|
|
1648
|
+
}
|
|
1649
|
+
set(key, value) {
|
|
1650
|
+
this._data.set(key, value);
|
|
1651
|
+
}
|
|
1652
|
+
remove(key) {
|
|
1653
|
+
this._data.delete(key);
|
|
1654
|
+
}
|
|
1655
|
+
has(key) {
|
|
1656
|
+
return this._data.has(key);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1626
1659
|
const { URL: URL$1 } = resolveServiceUrl("NOZZLE_SERVICE");
|
|
1627
1660
|
const { postModel: postModel$1, deleteModel, getOne } = ServiceFactory.build({
|
|
1628
1661
|
basePath: `${URL$1}/api/nozzle`
|
|
@@ -1671,17 +1704,17 @@ const clearPourable = async (nozzleId) => {
|
|
|
1671
1704
|
});
|
|
1672
1705
|
return response;
|
|
1673
1706
|
};
|
|
1674
|
-
var __defProp$
|
|
1675
|
-
var __getOwnPropDesc$
|
|
1676
|
-
var __decorateClass$
|
|
1677
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1707
|
+
var __defProp$3 = Object.defineProperty;
|
|
1708
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1709
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1710
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1678
1711
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1679
1712
|
if (decorator = decorators[i])
|
|
1680
1713
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1681
|
-
if (kind && result) __defProp$
|
|
1714
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1682
1715
|
return result;
|
|
1683
1716
|
};
|
|
1684
|
-
const MODEL_TYPE$
|
|
1717
|
+
const MODEL_TYPE$3 = DispenseModelType.Nozzle;
|
|
1685
1718
|
const PROP_BEVERAGE_TOPIC_PREFIX = createPropKey(
|
|
1686
1719
|
"beverageTopicPrefix"
|
|
1687
1720
|
);
|
|
@@ -2151,42 +2184,42 @@ let NozzleModelImpl = class {
|
|
|
2151
2184
|
}
|
|
2152
2185
|
// -------------------ENTITY----------------------------
|
|
2153
2186
|
};
|
|
2154
|
-
__decorateClass$
|
|
2187
|
+
__decorateClass$3([
|
|
2155
2188
|
kosChild
|
|
2156
2189
|
], NozzleModelImpl.prototype, "_availabilityItems", 2);
|
|
2157
|
-
__decorateClass$
|
|
2190
|
+
__decorateClass$3([
|
|
2158
2191
|
kosStateEntry(PourState.POURING)
|
|
2159
2192
|
], NozzleModelImpl.prototype, "handlePouringStart", 1);
|
|
2160
|
-
__decorateClass$
|
|
2193
|
+
__decorateClass$3([
|
|
2161
2194
|
kosStateExit(PourState.POURING)
|
|
2162
2195
|
], NozzleModelImpl.prototype, "handlePouringEnd", 1);
|
|
2163
|
-
__decorateClass$
|
|
2196
|
+
__decorateClass$3([
|
|
2164
2197
|
kosStateEntry(PourState.POUR_CANCELING)
|
|
2165
2198
|
], NozzleModelImpl.prototype, "handleCancelStart", 1);
|
|
2166
|
-
__decorateClass$
|
|
2199
|
+
__decorateClass$3([
|
|
2167
2200
|
kosStateExit(PourState.POUR_CANCELING)
|
|
2168
2201
|
], NozzleModelImpl.prototype, "handleCanceled", 1);
|
|
2169
|
-
__decorateClass$
|
|
2202
|
+
__decorateClass$3([
|
|
2170
2203
|
kosFuture(),
|
|
2171
2204
|
kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2172
2205
|
], NozzleModelImpl.prototype, "pour", 1);
|
|
2173
|
-
__decorateClass$
|
|
2206
|
+
__decorateClass$3([
|
|
2174
2207
|
kosFuture(),
|
|
2175
2208
|
kosStateGuard({ allowedStates: [PourState.IDLE] })
|
|
2176
2209
|
], NozzleModelImpl.prototype, "fixedPour", 1);
|
|
2177
|
-
__decorateClass$
|
|
2210
|
+
__decorateClass$3([
|
|
2178
2211
|
kosStateGuard({
|
|
2179
2212
|
allowedStates: [PourState.POUR_STARTING, PourState.POURING]
|
|
2180
2213
|
})
|
|
2181
2214
|
], NozzleModelImpl.prototype, "cancelPour", 1);
|
|
2182
|
-
__decorateClass$
|
|
2215
|
+
__decorateClass$3([
|
|
2183
2216
|
kosTopicHandler({
|
|
2184
2217
|
topic: `${PROP_BEVERAGE_TOPIC_PREFIX}/availability`,
|
|
2185
2218
|
websocket: true
|
|
2186
2219
|
})
|
|
2187
2220
|
], NozzleModelImpl.prototype, "updateAvailability", 1);
|
|
2188
|
-
NozzleModelImpl = __decorateClass$
|
|
2189
|
-
kosModel({ modelTypeId: MODEL_TYPE$
|
|
2221
|
+
NozzleModelImpl = __decorateClass$3([
|
|
2222
|
+
kosModel({ modelTypeId: MODEL_TYPE$3, singleton: false }),
|
|
2190
2223
|
kosLoggerAware(),
|
|
2191
2224
|
kosStateMachine(
|
|
2192
2225
|
{
|
|
@@ -2227,15 +2260,391 @@ NozzleModelImpl = __decorateClass$2([
|
|
|
2227
2260
|
], NozzleModelImpl);
|
|
2228
2261
|
const Nozzle = {
|
|
2229
2262
|
registration: {
|
|
2230
|
-
[MODEL_TYPE$
|
|
2263
|
+
[MODEL_TYPE$3]: {
|
|
2231
2264
|
class: NozzleModelImpl,
|
|
2232
2265
|
singleton: false
|
|
2233
2266
|
}
|
|
2234
2267
|
},
|
|
2235
|
-
type: MODEL_TYPE$
|
|
2236
|
-
predicate: isKosModel(MODEL_TYPE$
|
|
2237
|
-
factory: Kos.Factory.create(MODEL_TYPE$
|
|
2268
|
+
type: MODEL_TYPE$3,
|
|
2269
|
+
predicate: isKosModel(MODEL_TYPE$3),
|
|
2270
|
+
factory: Kos.Factory.create(MODEL_TYPE$3)
|
|
2238
2271
|
};
|
|
2272
|
+
var __defProp$2 = Object.defineProperty;
|
|
2273
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2274
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2275
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2276
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2277
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2278
|
+
if (decorator = decorators[i])
|
|
2279
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2280
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2281
|
+
return result;
|
|
2282
|
+
};
|
|
2283
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
2284
|
+
const MODEL_TYPE$2 = "cui-kit-state-model";
|
|
2285
|
+
const MODEL_CONFIG = {
|
|
2286
|
+
modelTypeId: MODEL_TYPE$2,
|
|
2287
|
+
singleton: false
|
|
2288
|
+
};
|
|
2289
|
+
const cuiKitId = (nozzlePath) => `cui-kit:${nozzlePath}`;
|
|
2290
|
+
let CuiKitStateModelImpl = class {
|
|
2291
|
+
id;
|
|
2292
|
+
nozzlePath;
|
|
2293
|
+
initialGroup;
|
|
2294
|
+
steps;
|
|
2295
|
+
companionTypes;
|
|
2296
|
+
currentGroup;
|
|
2297
|
+
selectedBrand = null;
|
|
2298
|
+
selectedBeverage = null;
|
|
2299
|
+
selectedFlavors = [];
|
|
2300
|
+
pourStrategy;
|
|
2301
|
+
onPourComplete;
|
|
2302
|
+
/** Data passed to the before-pour gate; carries `selectedBeverage`. */
|
|
2303
|
+
pourContext = new PourContext();
|
|
2304
|
+
/** The target of the last pour the kit started. */
|
|
2305
|
+
activeTarget;
|
|
2306
|
+
beforePour;
|
|
2307
|
+
pressCount = 0;
|
|
2308
|
+
released = true;
|
|
2309
|
+
lastPourState;
|
|
2310
|
+
lastPourError;
|
|
2311
|
+
nozzle;
|
|
2312
|
+
constructor(modelId, options) {
|
|
2313
|
+
this.id = modelId;
|
|
2314
|
+
this.nozzlePath = options.nozzlePath;
|
|
2315
|
+
this.initialGroup = options.initialGroup ?? "brands";
|
|
2316
|
+
this.steps = options.steps;
|
|
2317
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2318
|
+
this.pourStrategy = options.pour?.strategy;
|
|
2319
|
+
this.onPourComplete = options.onPourComplete;
|
|
2320
|
+
this.currentGroup = this.firstGroup;
|
|
2321
|
+
if (options.steps && options.initialGroup) {
|
|
2322
|
+
throw new Error(
|
|
2323
|
+
"CUI Kit: pass steps or initialGroup, not both (initialGroup is replaced by steps.brands)"
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
updateModel(options) {
|
|
2328
|
+
this.companionTypes = options.companionTypes ?? {};
|
|
2329
|
+
}
|
|
2330
|
+
// -------------------STEPS----------------------------
|
|
2331
|
+
/** The steps shown, in order. */
|
|
2332
|
+
get enabledSteps() {
|
|
2333
|
+
if (!this.steps) {
|
|
2334
|
+
return this.initialGroup === "brands" ? ["brands", "beverages", "flavors"] : ["beverages", "flavors"];
|
|
2335
|
+
}
|
|
2336
|
+
return [
|
|
2337
|
+
...this.steps.brands ? ["brands"] : [],
|
|
2338
|
+
"beverages",
|
|
2339
|
+
...this.steps.flavors ? ["flavors"] : [],
|
|
2340
|
+
...this.steps.pour ? ["pour"] : []
|
|
2341
|
+
];
|
|
2342
|
+
}
|
|
2343
|
+
/** The step navigation starts at and `home()` returns to. */
|
|
2344
|
+
get firstGroup() {
|
|
2345
|
+
if (!this.steps) return this.initialGroup;
|
|
2346
|
+
return this.steps.brands ? "brands" : "beverages";
|
|
2347
|
+
}
|
|
2348
|
+
/** The step `back()` moves to, or undefined when there is none. */
|
|
2349
|
+
get previousGroup() {
|
|
2350
|
+
if (!this.steps) {
|
|
2351
|
+
return this.currentGroup === "brands" ? void 0 : this.initialGroup;
|
|
2352
|
+
}
|
|
2353
|
+
const steps = this.enabledSteps;
|
|
2354
|
+
const index = steps.indexOf(this.currentGroup);
|
|
2355
|
+
return index > 0 ? steps[index - 1] : void 0;
|
|
2356
|
+
}
|
|
2357
|
+
get canBack() {
|
|
2358
|
+
return this.previousGroup !== void 0;
|
|
2359
|
+
}
|
|
2360
|
+
// -------------------LISTS----------------------------
|
|
2361
|
+
get brands() {
|
|
2362
|
+
return this.nozzle?.visibleBrands ?? [];
|
|
2363
|
+
}
|
|
2364
|
+
/** Whether the kit shows a brands step; without `steps` it follows `initialGroup`. */
|
|
2365
|
+
get hasBrands() {
|
|
2366
|
+
return this.enabledSteps.includes("brands");
|
|
2367
|
+
}
|
|
2368
|
+
get beverages() {
|
|
2369
|
+
if (!this.nozzle) return [];
|
|
2370
|
+
const brand = this.steps && !this.hasBrands ? void 0 : this.nozzle.selectedBrand;
|
|
2371
|
+
const items = brand ? this.nozzle.getAvailabilityByParent(brand.id) : this.nozzle.getGroupAvailabilityItems("beverages");
|
|
2372
|
+
return items.filter((item) => item.visible);
|
|
2373
|
+
}
|
|
2374
|
+
get flavors() {
|
|
2375
|
+
return this.nozzle?.getGroupAvailabilityItems("flavors").filter((flavor) => flavor.visible) ?? [];
|
|
2376
|
+
}
|
|
2377
|
+
get brandCompanions() {
|
|
2378
|
+
return this.companionsOf(this.brands, this.companionTypes.brand);
|
|
2379
|
+
}
|
|
2380
|
+
get beverageCompanions() {
|
|
2381
|
+
return this.companionsOf(this.beverages, this.companionTypes.beverage);
|
|
2382
|
+
}
|
|
2383
|
+
get flavorCompanions() {
|
|
2384
|
+
return this.companionsOf(this.flavors, this.companionTypes.flavor);
|
|
2385
|
+
}
|
|
2386
|
+
companionsOf(models, type) {
|
|
2387
|
+
if (!type) return [];
|
|
2388
|
+
return models.map((model) => getKosCompanionModel(model, type));
|
|
2389
|
+
}
|
|
2390
|
+
// -------------------SELECTION----------------------------
|
|
2391
|
+
selectBrand(brand, context) {
|
|
2392
|
+
this.selectedBrand = brand;
|
|
2393
|
+
this.nozzle?.setSelectedBrand(brand, context);
|
|
2394
|
+
this.currentGroup = "beverages";
|
|
2395
|
+
this.publish("brand/selected", brand);
|
|
2396
|
+
}
|
|
2397
|
+
clearBrand() {
|
|
2398
|
+
this.selectedBrand = null;
|
|
2399
|
+
this.nozzle?.setSelectedBrand(void 0);
|
|
2400
|
+
this.publish("brand/cleared", {});
|
|
2401
|
+
}
|
|
2402
|
+
async selectBeverage(beverage, context, forceUpdate) {
|
|
2403
|
+
this.selectedBeverage = beverage;
|
|
2404
|
+
this.pourContext.set("selectedBeverage", beverage);
|
|
2405
|
+
await this.nozzle?.setSelectedPourable({ beverage, context }, forceUpdate);
|
|
2406
|
+
if (!this.steps || this.steps.flavors) {
|
|
2407
|
+
this.currentGroup = "flavors";
|
|
2408
|
+
}
|
|
2409
|
+
this.publish("beverage/selected", beverage);
|
|
2410
|
+
}
|
|
2411
|
+
async clearBeverage() {
|
|
2412
|
+
this.selectedBeverage = null;
|
|
2413
|
+
this.pourContext.remove("selectedBeverage");
|
|
2414
|
+
await this.nozzle?.setSelectedPourable({ beverage: void 0 });
|
|
2415
|
+
this.publish("beverage/cleared", {});
|
|
2416
|
+
}
|
|
2417
|
+
/** Toggles a flavor and sends the beverage with the resulting flavors to the nozzle. */
|
|
2418
|
+
async selectFlavor(flavor, context, forceUpdate) {
|
|
2419
|
+
const flavors = this.selectedFlavors.includes(flavor) ? this.selectedFlavors.filter((selected) => selected !== flavor) : [...this.selectedFlavors, flavor];
|
|
2420
|
+
this.selectedFlavors = flavors;
|
|
2421
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2422
|
+
if (beverage) {
|
|
2423
|
+
await this.nozzle.setSelectedPourable(
|
|
2424
|
+
{ beverage, additional: flavors, context },
|
|
2425
|
+
forceUpdate
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
this.publish("flavor/selected", flavor);
|
|
2429
|
+
}
|
|
2430
|
+
async clearFlavors() {
|
|
2431
|
+
this.selectedFlavors = [];
|
|
2432
|
+
const beverage = this.nozzle?.selectedPourable.beverage;
|
|
2433
|
+
if (beverage) {
|
|
2434
|
+
await this.nozzle.setSelectedPourable({ beverage });
|
|
2435
|
+
this.publish("flavor/cleared", {});
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
// -------------------NAVIGATION----------------------------
|
|
2439
|
+
/** Moves to the previous step. Without `steps`, returns to the start and clears brand and beverage. */
|
|
2440
|
+
back() {
|
|
2441
|
+
if (!this.steps) {
|
|
2442
|
+
if (this.currentGroup !== "brands") {
|
|
2443
|
+
this.currentGroup = this.initialGroup;
|
|
2444
|
+
}
|
|
2445
|
+
void this.clearBeverage();
|
|
2446
|
+
this.clearBrand();
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
const previous = this.previousGroup;
|
|
2450
|
+
if (previous) {
|
|
2451
|
+
this.currentGroup = previous;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
/** Returns to the first step and clears the selections. */
|
|
2455
|
+
home() {
|
|
2456
|
+
this.publish("home", {});
|
|
2457
|
+
this.currentGroup = this.firstGroup;
|
|
2458
|
+
if (this.steps) {
|
|
2459
|
+
void this.clearFlavors();
|
|
2460
|
+
void this.clearBeverage();
|
|
2461
|
+
if (this.steps.brands) this.clearBrand();
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2464
|
+
void this.clearBeverage();
|
|
2465
|
+
if (this.initialGroup === "brands") {
|
|
2466
|
+
this.clearBrand();
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
/** Number of `useCuiKit` hooks attached to this kit. */
|
|
2470
|
+
attached = 0;
|
|
2471
|
+
/**
|
|
2472
|
+
* Attaches a `useCuiKit` hook. A nozzle has one kit hook; components read it through
|
|
2473
|
+
* the kit's context. Returns false, and logs an error, for a second hook.
|
|
2474
|
+
*/
|
|
2475
|
+
attach() {
|
|
2476
|
+
this.attached += 1;
|
|
2477
|
+
if (this.attached > 1) {
|
|
2478
|
+
this.logger.error(
|
|
2479
|
+
`useCuiKit is mounted ${this.attached} times for nozzle ${this.nozzlePath}; read the kit with the useCuiKitContext hook returned by initializeCuiKit`
|
|
2480
|
+
);
|
|
2481
|
+
return false;
|
|
2482
|
+
}
|
|
2483
|
+
return true;
|
|
2484
|
+
}
|
|
2485
|
+
detach() {
|
|
2486
|
+
this.attached = Math.max(0, this.attached - 1);
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Returns the kit to the first step with nothing selected, as a newly mounted kit
|
|
2490
|
+
* starts. The nozzle's own selection is left as it is.
|
|
2491
|
+
*/
|
|
2492
|
+
reset() {
|
|
2493
|
+
this.currentGroup = this.firstGroup;
|
|
2494
|
+
this.selectedBrand = null;
|
|
2495
|
+
this.selectedBeverage = null;
|
|
2496
|
+
this.selectedFlavors = [];
|
|
2497
|
+
this.pourContext.remove("selectedBeverage");
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Moves to the pour step. Only available when `steps.pour` is on. With `start`, also
|
|
2501
|
+
* starts a pour; ignored, with a warning, when the pour needs a held button.
|
|
2502
|
+
*/
|
|
2503
|
+
toPour(options = {}) {
|
|
2504
|
+
if (!this.steps?.pour) {
|
|
2505
|
+
this.logger.warn("toPour() ignored: the pour step is not enabled");
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
this.currentGroup = "pour";
|
|
2509
|
+
if (!options.start) return;
|
|
2510
|
+
if (!options.fixedPourName && this.strategyFor(options)?.requiresHold) {
|
|
2511
|
+
this.logger.warn(
|
|
2512
|
+
"toPour({ start: true }) ignored: the pour strategy needs a held button"
|
|
2513
|
+
);
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
void this.startPour(options);
|
|
2517
|
+
}
|
|
2518
|
+
// -------------------POUR----------------------------
|
|
2519
|
+
/** Sets the before-pour gate the kit calls before every pour. */
|
|
2520
|
+
setBeforePour(callback) {
|
|
2521
|
+
this.beforePour = callback;
|
|
2522
|
+
}
|
|
2523
|
+
/** Starts a pour without a gesture (a click-to-pour button or an automated pour). */
|
|
2524
|
+
startPour(options = {}) {
|
|
2525
|
+
return this.runPour(options, false);
|
|
2526
|
+
}
|
|
2527
|
+
/** The press half of a pour gesture; `releasePour` is the release. */
|
|
2528
|
+
pressPour(options = {}) {
|
|
2529
|
+
return this.runPour(options, true);
|
|
2530
|
+
}
|
|
2531
|
+
/** The release half of a pour gesture. */
|
|
2532
|
+
releasePour(options = {}) {
|
|
2533
|
+
this.released = true;
|
|
2534
|
+
const target = options.target ?? this.nozzle;
|
|
2535
|
+
const ended = this.strategyFor(options)?.initiateEnded?.(target);
|
|
2536
|
+
void Promise.resolve(ended).then((keepPouring) => {
|
|
2537
|
+
if (keepPouring !== true) {
|
|
2538
|
+
this.publish("pour/cancel", {});
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
/** Cancels the pour the kit started last. */
|
|
2543
|
+
async cancelPour() {
|
|
2544
|
+
await (this.activeTarget ?? this.nozzle)?.cancelPour();
|
|
2545
|
+
this.publish("pour/cancel", {});
|
|
2546
|
+
}
|
|
2547
|
+
/** The pour target whose state the kit reports: the last one poured, else the nozzle. */
|
|
2548
|
+
get pourTarget() {
|
|
2549
|
+
return this.activeTarget ?? this.nozzle;
|
|
2550
|
+
}
|
|
2551
|
+
strategyFor(options) {
|
|
2552
|
+
return options.strategy ?? this.pourStrategy;
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* select → prepare → before-pour gate → pour. While the target is pouring nothing is
|
|
2556
|
+
* selected; for a gesture, a release before the pour starts stops the sequence.
|
|
2557
|
+
*/
|
|
2558
|
+
async runPour(options, gesture) {
|
|
2559
|
+
const press = ++this.pressCount;
|
|
2560
|
+
this.released = false;
|
|
2561
|
+
const target = options.target ?? this.nozzle;
|
|
2562
|
+
const strategy = this.strategyFor(options);
|
|
2563
|
+
if (!target || !strategy && !options.fixedPourName) {
|
|
2564
|
+
this.logger.error("pour ignored: no pour target or strategy");
|
|
2565
|
+
return false;
|
|
2566
|
+
}
|
|
2567
|
+
const releasedEarly = () => gesture && (this.released || press !== this.pressCount);
|
|
2568
|
+
if (options.select && !target.isPouring) {
|
|
2569
|
+
await this.selectForPour(options.select);
|
|
2570
|
+
}
|
|
2571
|
+
if (releasedEarly()) return false;
|
|
2572
|
+
await options.prepare?.(this.pourContext);
|
|
2573
|
+
if (releasedEarly()) return false;
|
|
2574
|
+
this.publish("pre/pour", {});
|
|
2575
|
+
await this.beforePour?.(this.pourContext) || true;
|
|
2576
|
+
if (releasedEarly()) return false;
|
|
2577
|
+
this.activeTarget = target;
|
|
2578
|
+
this.lastPourError = void 0;
|
|
2579
|
+
const started = options.fixedPourName ? this.nozzle.fixedPour(options.fixedPourName) : strategy?.initiate(target);
|
|
2580
|
+
void Promise.resolve(started).catch((error) => {
|
|
2581
|
+
this.lastPourError = error;
|
|
2582
|
+
this.logger.error(`pour failed: ${error}`);
|
|
2583
|
+
});
|
|
2584
|
+
this.publish("pour", {});
|
|
2585
|
+
return true;
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* Selects a beverage, and its brand first when the kit has a brands step, and waits
|
|
2589
|
+
* for the nozzle.
|
|
2590
|
+
*/
|
|
2591
|
+
async selectForPour(beverage) {
|
|
2592
|
+
const brand = this.hasBrands ? this.nozzle?.brands.find((b) => b.id === beverage.parentId) : void 0;
|
|
2593
|
+
if (brand && this.selectedBrand !== brand) {
|
|
2594
|
+
this.selectBrand(brand);
|
|
2595
|
+
}
|
|
2596
|
+
if (this.selectedBeverage !== beverage) {
|
|
2597
|
+
await this.selectBeverage(beverage);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
trackPourCompletion() {
|
|
2601
|
+
const state = this.pourTarget?.currentState;
|
|
2602
|
+
const previous = this.lastPourState;
|
|
2603
|
+
this.lastPourState = state;
|
|
2604
|
+
const completed = state === PourState.IDLE && (previous === PourState.POURING || previous === PourState.POUR_STARTING);
|
|
2605
|
+
if (!completed || !this.onPourComplete) return;
|
|
2606
|
+
const target = this.pourTarget;
|
|
2607
|
+
const endState = target?.future?.endState;
|
|
2608
|
+
setTimeout(() => {
|
|
2609
|
+
this.onPourComplete?.({ endState, error: this.lastPourError });
|
|
2610
|
+
}, 0);
|
|
2611
|
+
}
|
|
2612
|
+
publishBeverageList() {
|
|
2613
|
+
this.publish("beverage/list/updated", this.beverages);
|
|
2614
|
+
}
|
|
2615
|
+
publish(path, body) {
|
|
2616
|
+
EventBus.publish(`/kos/dispense/${this.nozzlePath}/${path}/`, body);
|
|
2617
|
+
}
|
|
2618
|
+
// -------------------LIFECYCLE----------------------------
|
|
2619
|
+
async init() {
|
|
2620
|
+
this.logger.debug(`initializing cui-kit-state ${this.id}`);
|
|
2621
|
+
}
|
|
2622
|
+
};
|
|
2623
|
+
__publicField(CuiKitStateModelImpl, "Registration");
|
|
2624
|
+
__decorateClass$2([
|
|
2625
|
+
kosDependency({
|
|
2626
|
+
modelType: Nozzle.type,
|
|
2627
|
+
id: createPropKey("nozzlePath")
|
|
2628
|
+
})
|
|
2629
|
+
], CuiKitStateModelImpl.prototype, "nozzle", 2);
|
|
2630
|
+
__decorateClass$2([
|
|
2631
|
+
kosModelEffect({
|
|
2632
|
+
dependencies: (model) => [
|
|
2633
|
+
model.pourTarget?.currentState
|
|
2634
|
+
]
|
|
2635
|
+
})
|
|
2636
|
+
], CuiKitStateModelImpl.prototype, "trackPourCompletion", 1);
|
|
2637
|
+
__decorateClass$2([
|
|
2638
|
+
kosModelEffect({
|
|
2639
|
+
dependencies: (model) => [model.beverages],
|
|
2640
|
+
options: { fireImmediately: true }
|
|
2641
|
+
})
|
|
2642
|
+
], CuiKitStateModelImpl.prototype, "publishBeverageList", 1);
|
|
2643
|
+
CuiKitStateModelImpl = __decorateClass$2([
|
|
2644
|
+
kosModel(MODEL_CONFIG),
|
|
2645
|
+
kosLoggerAware()
|
|
2646
|
+
], CuiKitStateModelImpl);
|
|
2647
|
+
const CuiKitState = CuiKitStateModelImpl.Registration;
|
|
2239
2648
|
var __defProp$1 = Object.defineProperty;
|
|
2240
2649
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2241
2650
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
@@ -2573,9 +2982,10 @@ const kosModels = {
|
|
|
2573
2982
|
...Assembly.registration,
|
|
2574
2983
|
...BoardContainer.registration
|
|
2575
2984
|
};
|
|
2576
|
-
const registerDispenseModels = (root) => () => {
|
|
2577
|
-
registerCoreModels(root)();
|
|
2985
|
+
const registerDispenseModels = (root) => (options) => {
|
|
2986
|
+
registerCoreModels(root)(options);
|
|
2578
2987
|
DeviceAssembly.register();
|
|
2988
|
+
CuiKitState.register();
|
|
2579
2989
|
Object.keys(kosModels).forEach((key) => {
|
|
2580
2990
|
const model = kosModels[key];
|
|
2581
2991
|
registerLegacyModel(root)(key, model);
|
|
@@ -2606,12 +3016,16 @@ const registerDispenseModels = (root) => () => {
|
|
|
2606
3016
|
legacy: RegistrationManager.model.registerLegacyModel(root)
|
|
2607
3017
|
};
|
|
2608
3018
|
};
|
|
3019
|
+
const registerCuiKitModels = (root) => (options) => registerDispenseModels(root)(options);
|
|
2609
3020
|
const _KosModelRegistry = {
|
|
2610
3021
|
...KosModelRegistry$1
|
|
2611
3022
|
};
|
|
2612
3023
|
_KosModelRegistry.dispense = {
|
|
2613
3024
|
models: registerDispenseModels(_KosModelRegistry)
|
|
2614
3025
|
};
|
|
3026
|
+
_KosModelRegistry.cuiKit = {
|
|
3027
|
+
models: registerCuiKitModels(_KosModelRegistry)
|
|
3028
|
+
};
|
|
2615
3029
|
_KosModelRegistry.preload = RegistrationManager.model.preloadModel(_KosModelRegistry);
|
|
2616
3030
|
_KosModelRegistry.model = RegistrationManager.model.register(_KosModelRegistry);
|
|
2617
3031
|
_KosModelRegistry.companion = RegistrationManager.companion.register(_KosModelRegistry);
|
|
@@ -2623,46 +3037,50 @@ export {
|
|
|
2623
3037
|
CONTEXT_ASSEMBLY_DATA as C,
|
|
2624
3038
|
DeviceAssembly as D,
|
|
2625
3039
|
ExtensionType as E,
|
|
2626
|
-
|
|
3040
|
+
sendRfidOverride as F,
|
|
2627
3041
|
GenericPour as G,
|
|
2628
3042
|
Holder as H,
|
|
2629
3043
|
Ingredient as I,
|
|
2630
|
-
|
|
3044
|
+
unassignHolderIngredient as J,
|
|
2631
3045
|
KosModelRegistry as K,
|
|
2632
|
-
|
|
2633
|
-
|
|
3046
|
+
getAssembly as L,
|
|
3047
|
+
getIntentVolume as M,
|
|
2634
3048
|
Nozzle as N,
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
3049
|
+
sendIntent as O,
|
|
3050
|
+
PourContext as P,
|
|
3051
|
+
clearPourable as Q,
|
|
3052
|
+
getAvailability as R,
|
|
3053
|
+
pourNamedPourable as S,
|
|
2640
3054
|
TOPIC_BOARD_LINKED as T,
|
|
3055
|
+
pourPourable as U,
|
|
3056
|
+
selectPourable as V,
|
|
3057
|
+
pourOnTarget as W,
|
|
3058
|
+
cuiKitId as X,
|
|
2641
3059
|
Availability as a,
|
|
2642
3060
|
BoardContainer as b,
|
|
2643
3061
|
BoardContainerModel as c,
|
|
2644
3062
|
CONTEXT_ASSEMBLY_RAW_DATA as d,
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
};
|
|
2668
|
-
//# sourceMappingURL=dispense-registration-manager-
|
|
3063
|
+
CuiKitState as e,
|
|
3064
|
+
DispenseModelType as f,
|
|
3065
|
+
HolderContainer as g,
|
|
3066
|
+
IngredientContainer as h,
|
|
3067
|
+
PourState as i,
|
|
3068
|
+
Pump as j,
|
|
3069
|
+
PumpContainer as k,
|
|
3070
|
+
PumpIndex as l,
|
|
3071
|
+
TOPIC_BOARD_UNLINKED as m,
|
|
3072
|
+
TOPIC_GENERIC_POUR_CANCEL as n,
|
|
3073
|
+
TOPIC_GENERIC_POUR_PROGRESS as o,
|
|
3074
|
+
TOPIC_GENERIC_POUR_STARTED as p,
|
|
3075
|
+
kosModels as q,
|
|
3076
|
+
registerCuiKitModels as r,
|
|
3077
|
+
registerDispenseModels as s,
|
|
3078
|
+
getIngredients as t,
|
|
3079
|
+
addAssignment as u,
|
|
3080
|
+
assignHolderIngredient as v,
|
|
3081
|
+
deleteAssignment as w,
|
|
3082
|
+
getAssignments as x,
|
|
3083
|
+
getHolders as y,
|
|
3084
|
+
replaceLine as z
|
|
3085
|
+
};
|
|
3086
|
+
//# sourceMappingURL=dispense-registration-manager-DtN0T_JG.js.map
|