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