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