@kosdev-code/kos-dispense-sdk 2.1.8 → 2.1.10
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-BZ5L3AWX.cjs +2 -0
- package/{dispense-registration-manager-DauhdXxX.cjs.map → dispense-registration-manager-BZ5L3AWX.cjs.map} +1 -1
- package/{dispense-registration-manager-Mh8b5sDW.js → dispense-registration-manager-CB_nSTZw.js} +344 -345
- package/{dispense-registration-manager-Mh8b5sDW.js.map → dispense-registration-manager-CB_nSTZw.js.map} +1 -1
- package/{extension-utils-BwiFbuRe.js → extension-utils-CkYqorcG.js} +2 -2
- package/{extension-utils-BwiFbuRe.js.map → extension-utils-CkYqorcG.js.map} +1 -1
- package/{extension-utils-BcdtSKJM.cjs → extension-utils-DUel3wIz.cjs} +2 -2
- package/{extension-utils-BcdtSKJM.cjs.map → extension-utils-DUel3wIz.cjs.map} +1 -1
- package/index.cjs +1 -1
- package/index.js +3 -3
- package/models/models/generic-pour/generic-pour-model.d.ts +10 -9
- package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +2 -2
- package/{pump-provider-DwmITxr8.cjs → pump-provider-B0n-z7GU.cjs} +2 -2
- package/{pump-provider-DwmITxr8.cjs.map → pump-provider-B0n-z7GU.cjs.map} +1 -1
- package/{pump-provider-BK8kyTyX.js → pump-provider-DodZo0It.js} +2 -2
- package/{pump-provider-BK8kyTyX.js.map → pump-provider-DodZo0It.js.map} +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-DauhdXxX.cjs +0 -2
package/{dispense-registration-manager-Mh8b5sDW.js → dispense-registration-manager-CB_nSTZw.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (e, t, r) => (
|
|
4
|
-
import { kosModel as I, Kos as v, isKosModel as b, resolveServiceUrl as S, ServiceFactory as
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var pt = (e, t, r) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var o = (e, t, r) => (pt(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { kosModel as I, Kos as v, isKosModel as b, resolveServiceUrl as S, ServiceFactory as C, KosLog as f, KosModelContainer as R, KosExtensionUtils as T, kosChild as M, FetchError as ht, ExtensionManager as u, EXTENSION_TROUBLE_MAPPER as be, EXTENSION_TROUBLE_DATA_MAPPER as q, getKosModelSync as z, kosDependency as Le, kosTroubleAware as ut, kosAction as g, kosTopicHandler as W, DependencyLifecycle as xe, getKosModel as Ae, FutureManager as ce, kosFuture as pe, FutureHandler as Be, EXTENSION_FEATURE_FLAG_RESOLVER as gt, isKosDataModel as yt, ChildModels as It, KosFeatureFlags as mt, kosParentAware as ft, createPropKey as Pt, MultipleFutureHandler as vt, arraysEqual as bt, getAllKosCompanionModels as E, EventBus as _, KosContextManager as _t, destroyKosModel as Mt, SingletonKosModelRegistrationFactory as Ot, kosLoggerAware as Et, kosFutureAware as wt, ObservableData as Ce, KosModelRegistrationFactory as $t, KosModelRegistry as St, RegistrationManager as O, registerCoreModels as Ct, registerLegacyModel as Rt } from "@kosdev-code/kos-ui-sdk";
|
|
5
5
|
import "react";
|
|
6
|
-
var
|
|
7
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
6
|
+
var h = /* @__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))(h || {}), 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 || {}), Dt = Object.getOwnPropertyDescriptor, Nt = (e, t, r, a) => {
|
|
7
|
+
for (var i = a > 1 ? void 0 : a ? Dt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
8
8
|
(n = e[s]) && (i = n(i) || i);
|
|
9
9
|
return i;
|
|
10
10
|
};
|
|
@@ -36,10 +36,10 @@ let me = class {
|
|
|
36
36
|
// -------------------LIFECYCLE----------------------------
|
|
37
37
|
// -------------------ENTITY----------------------------
|
|
38
38
|
};
|
|
39
|
-
me =
|
|
39
|
+
me = Nt([
|
|
40
40
|
I(U)
|
|
41
41
|
], me);
|
|
42
|
-
const
|
|
42
|
+
const Ue = {
|
|
43
43
|
registration: {
|
|
44
44
|
[U]: {
|
|
45
45
|
class: me,
|
|
@@ -49,26 +49,26 @@ const Be = {
|
|
|
49
49
|
type: U,
|
|
50
50
|
predicate: b(U),
|
|
51
51
|
factory: v.Factory.create(U)
|
|
52
|
-
}, { URL:
|
|
53
|
-
basePath: `${
|
|
54
|
-
}),
|
|
55
|
-
urlOverride: `${
|
|
52
|
+
}, { URL: Ge } = S("INGREDIENT_SERVICE"), { getOne: Tt } = C.build({
|
|
53
|
+
basePath: `${Ge}/api/ext/dispense/ingredients`
|
|
54
|
+
}), zt = async () => await Tt({
|
|
55
|
+
urlOverride: `${Ge}/api/ext/dispense/ingredients`
|
|
56
56
|
});
|
|
57
|
-
var
|
|
58
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
57
|
+
var Lt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, je = (e, t, r, a) => {
|
|
58
|
+
for (var i = a > 1 ? void 0 : a ? xt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
59
59
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
60
|
-
return a && i &&
|
|
60
|
+
return a && i && Lt(t, r, i), i;
|
|
61
61
|
};
|
|
62
|
-
const G = "ingredient-container-model",
|
|
62
|
+
const G = "ingredient-container-model", At = f.createLogger({ name: "ingredient-container-model" });
|
|
63
63
|
let ie = class {
|
|
64
64
|
constructor(e, t) {
|
|
65
65
|
o(this, "id");
|
|
66
66
|
o(this, "ingredients");
|
|
67
|
-
this.id = e, this.ingredients = new
|
|
67
|
+
this.id = e, this.ingredients = new R({
|
|
68
68
|
indexMap: {
|
|
69
69
|
ingredientType: "type"
|
|
70
70
|
},
|
|
71
|
-
extensionId:
|
|
71
|
+
extensionId: h.IngredientIndex,
|
|
72
72
|
parentId: e
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -80,22 +80,22 @@ let ie = class {
|
|
|
80
80
|
}
|
|
81
81
|
async load(e) {
|
|
82
82
|
var i;
|
|
83
|
-
|
|
84
|
-
const t = await
|
|
83
|
+
At.debug(`loading ingredient container ${this.id}`);
|
|
84
|
+
const t = await zt();
|
|
85
85
|
if ((t == null ? void 0 : t.status) !== 200)
|
|
86
86
|
throw new Error("Failed to load ingredients");
|
|
87
87
|
const r = await T.executeLoaderExtension({
|
|
88
88
|
context: e,
|
|
89
|
-
extension:
|
|
89
|
+
extension: h.IngredientLoader
|
|
90
90
|
}), a = (t == null ? void 0 : t.data) ?? {};
|
|
91
91
|
for (const s of Object.keys(a))
|
|
92
92
|
for (const n of ((i = t == null ? void 0 : t.data) == null ? void 0 : i[s]) || []) {
|
|
93
93
|
const c = await T.executeDataMapperExtension({
|
|
94
|
-
extension:
|
|
94
|
+
extension: h.IngredientMapper,
|
|
95
95
|
data: n,
|
|
96
96
|
contextData: r
|
|
97
97
|
}), l = await T.executePropertyMapperExtension({
|
|
98
|
-
extension:
|
|
98
|
+
extension: h.IngredientTypeMapper,
|
|
99
99
|
data: n,
|
|
100
100
|
contextData: r
|
|
101
101
|
}), p = {
|
|
@@ -103,7 +103,7 @@ let ie = class {
|
|
|
103
103
|
type: l || n.type,
|
|
104
104
|
...c,
|
|
105
105
|
data: c
|
|
106
|
-
}, y =
|
|
106
|
+
}, y = Ue.factory(n.id)(
|
|
107
107
|
p
|
|
108
108
|
);
|
|
109
109
|
this.ingredients.addModel(y);
|
|
@@ -111,13 +111,13 @@ let ie = class {
|
|
|
111
111
|
}
|
|
112
112
|
// -------------------ENTITY----------------------------
|
|
113
113
|
};
|
|
114
|
-
|
|
114
|
+
je([
|
|
115
115
|
M
|
|
116
116
|
], ie.prototype, "ingredients", 2);
|
|
117
|
-
ie =
|
|
117
|
+
ie = je([
|
|
118
118
|
I(G)
|
|
119
119
|
], ie);
|
|
120
|
-
const
|
|
120
|
+
const Fe = {
|
|
121
121
|
registration: {
|
|
122
122
|
[G]: {
|
|
123
123
|
class: ie,
|
|
@@ -127,76 +127,76 @@ const je = {
|
|
|
127
127
|
type: G,
|
|
128
128
|
predicate: b(G),
|
|
129
129
|
factory: v.Singleton.create(G)
|
|
130
|
-
}, { URL:
|
|
131
|
-
basePath: `${
|
|
132
|
-
}),
|
|
130
|
+
}, { URL: he } = S("HOLDER_SERVICE"), { getAll: Bt, postModel: He, deleteModel: Ut } = C.build({
|
|
131
|
+
basePath: `${he}/api/kos/holders`
|
|
132
|
+
}), Gt = f.createLogger({
|
|
133
133
|
name: "holder-service",
|
|
134
134
|
group: "Services"
|
|
135
|
-
}),
|
|
135
|
+
}), ai = async () => await Bt({}), jt = async (e, t) => {
|
|
136
136
|
if (!e || !t)
|
|
137
137
|
throw new Error("Missing holderPath or ingredientId");
|
|
138
|
-
return await
|
|
138
|
+
return await He({
|
|
139
139
|
model: { holderPath: e, ingredientId: t },
|
|
140
|
-
urlOverride: `${
|
|
140
|
+
urlOverride: `${he}/api/ext/dispense/assignments`
|
|
141
141
|
});
|
|
142
|
-
},
|
|
142
|
+
}, Ft = async (e) => {
|
|
143
143
|
if (!e)
|
|
144
144
|
throw new Error("Missing holderPath");
|
|
145
|
-
return await
|
|
145
|
+
return await Ut({
|
|
146
146
|
id: e,
|
|
147
|
-
urlOverride: `${
|
|
147
|
+
urlOverride: `${he}/api/ext/dispense/assignments/${e}`
|
|
148
148
|
});
|
|
149
|
-
},
|
|
149
|
+
}, Ht = async (e) => {
|
|
150
150
|
if (!e)
|
|
151
151
|
throw new Error("Missing holderPath");
|
|
152
|
-
return
|
|
152
|
+
return Gt.debug(
|
|
153
153
|
`sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${e}`
|
|
154
|
-
), await
|
|
154
|
+
), await He({
|
|
155
155
|
model: {},
|
|
156
|
-
urlOverride: `${
|
|
156
|
+
urlOverride: `${he}/api/ext/dispense/pumpEvents/replaceLine/${e}`
|
|
157
157
|
});
|
|
158
|
-
}, { URL: ae } = S("ASSIGNMENT_SERVICE"), { getAll:
|
|
158
|
+
}, { URL: ae } = S("ASSIGNMENT_SERVICE"), { getAll: Vt, postModel: Ve, deleteModel: Kt } = C.build({
|
|
159
159
|
destinationAddress: "",
|
|
160
160
|
basePath: `${ae}/api/ext/dispense/assignments`
|
|
161
|
-
}), se = window.kosUseFos,
|
|
161
|
+
}), se = window.kosUseFos, si = async () => await Vt({ fos: se }), kt = async (e, t) => {
|
|
162
162
|
var i, s, n, c;
|
|
163
163
|
const r = JSON.stringify(t), a = `${ae}/api/ext/dispense/assignments`;
|
|
164
164
|
try {
|
|
165
|
-
const l = await
|
|
165
|
+
const l = await Ve({
|
|
166
166
|
model: { holderPath: e, factoryJson: r },
|
|
167
167
|
urlOverride: a
|
|
168
168
|
});
|
|
169
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
170
|
} catch (l) {
|
|
171
|
-
if (l instanceof
|
|
171
|
+
if (l instanceof ht)
|
|
172
172
|
return [
|
|
173
173
|
((n = (s = l.payload) == null ? void 0 : s.data) == null ? void 0 : n.error) || "unknownError",
|
|
174
174
|
(c = l.payload) == null ? void 0 : c.data
|
|
175
175
|
];
|
|
176
176
|
}
|
|
177
177
|
return ["unknownError", void 0];
|
|
178
|
-
},
|
|
178
|
+
}, ni = async (e) => {
|
|
179
179
|
const t = se ? `${ae}/api/ingredients/assignments/${e.holderPath}` : `${ae}/api/ext/dispense/assignments`;
|
|
180
|
-
return await
|
|
180
|
+
return await Ve({
|
|
181
181
|
model: { ...e, fuelGauge: 680 },
|
|
182
182
|
fos: se,
|
|
183
183
|
urlOverride: t
|
|
184
184
|
});
|
|
185
|
-
},
|
|
186
|
-
var
|
|
187
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
185
|
+
}, oi = async (e) => await Kt({ id: e, fos: se });
|
|
186
|
+
var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, _e = (e, t, r, a) => {
|
|
187
|
+
for (var i = a > 1 ? void 0 : a ? Zt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
188
188
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
189
|
-
return a && i &&
|
|
189
|
+
return a && i && Yt(t, r, i), i;
|
|
190
190
|
};
|
|
191
191
|
const j = D.Holder, Re = f.createLogger({ name: "holder-model" });
|
|
192
|
-
|
|
192
|
+
u[be].register(
|
|
193
193
|
"holder",
|
|
194
194
|
async (e) => {
|
|
195
195
|
const t = [];
|
|
196
196
|
return t.push(...e.data.holderPaths), t;
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
|
-
|
|
199
|
+
u[q].register(
|
|
200
200
|
"pump",
|
|
201
201
|
async (e) => {
|
|
202
202
|
if (e.data.pumpPath) {
|
|
@@ -215,13 +215,13 @@ g[q].register(
|
|
|
215
215
|
return {};
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
|
-
|
|
218
|
+
u[q].register(
|
|
219
219
|
"holder",
|
|
220
220
|
async (e) => e.data.holderNames.length > 0 ? {
|
|
221
221
|
holderName: e.data.holderNames[0] || ""
|
|
222
222
|
} : {}
|
|
223
223
|
);
|
|
224
|
-
|
|
224
|
+
u[q].register(
|
|
225
225
|
"container",
|
|
226
226
|
async (e) => {
|
|
227
227
|
if (e.data.ingredients.length > 0) {
|
|
@@ -235,7 +235,7 @@ g[q].register(
|
|
|
235
235
|
return {};
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
|
-
class
|
|
238
|
+
class Xt extends Error {
|
|
239
239
|
constructor(r, a) {
|
|
240
240
|
super(a);
|
|
241
241
|
o(this, "type");
|
|
@@ -267,7 +267,7 @@ let J = class {
|
|
|
267
267
|
o(this, "enjoyByDate");
|
|
268
268
|
o(this, "pumps");
|
|
269
269
|
o(this, "ingredientContainer");
|
|
270
|
-
this.id = e, this.path = t, this.name = r, this.ingredientType = s, this.ingredientSource = a, this.ingredientId = i, this.group = c, this.slice = n, this.enjoyByDate = p, this.data = l, this.pumps = new
|
|
270
|
+
this.id = e, this.path = t, this.name = r, this.ingredientType = s, this.ingredientSource = a, this.ingredientId = i, this.group = c, this.slice = n, this.enjoyByDate = p, this.data = l, this.pumps = new R({
|
|
271
271
|
parentId: e,
|
|
272
272
|
sortKey: "path"
|
|
273
273
|
}), this.logger = y.logger;
|
|
@@ -371,7 +371,7 @@ let J = class {
|
|
|
371
371
|
return this.hasMaxVolume && this.hasRemainingVolume;
|
|
372
372
|
}
|
|
373
373
|
updateIngredient(e) {
|
|
374
|
-
this.ingredientId !== e &&
|
|
374
|
+
this.ingredientId !== e && g(() => {
|
|
375
375
|
this.ingredientId = e;
|
|
376
376
|
});
|
|
377
377
|
}
|
|
@@ -383,13 +383,13 @@ let J = class {
|
|
|
383
383
|
if (!e)
|
|
384
384
|
throw new Error("Invalid override");
|
|
385
385
|
try {
|
|
386
|
-
const [t, r] = await
|
|
386
|
+
const [t, r] = await kt(this.path, e);
|
|
387
387
|
if (t)
|
|
388
|
-
throw new
|
|
388
|
+
throw new Xt(
|
|
389
389
|
t,
|
|
390
390
|
`Failed to perform rfid override on holder ${this.id}`
|
|
391
391
|
);
|
|
392
|
-
return
|
|
392
|
+
return g(() => {
|
|
393
393
|
this.ingredientId = r == null ? void 0 : r.ingredientId;
|
|
394
394
|
}), r;
|
|
395
395
|
} catch (t) {
|
|
@@ -398,7 +398,7 @@ let J = class {
|
|
|
398
398
|
}
|
|
399
399
|
async assignIngredient(e) {
|
|
400
400
|
try {
|
|
401
|
-
e ? await
|
|
401
|
+
e ? await jt(this.path, e) : await Ft(this.path), g(() => {
|
|
402
402
|
this.ingredientId = e;
|
|
403
403
|
});
|
|
404
404
|
} catch (t) {
|
|
@@ -409,7 +409,7 @@ let J = class {
|
|
|
409
409
|
return this.troubles.some((e) => e.shouldDefer);
|
|
410
410
|
}
|
|
411
411
|
async replaceLine() {
|
|
412
|
-
await
|
|
412
|
+
await Ht(this.path);
|
|
413
413
|
}
|
|
414
414
|
// -------------------LIFECYCLE----------------------------
|
|
415
415
|
// ----------------------------------
|
|
@@ -435,13 +435,13 @@ _e([
|
|
|
435
435
|
M
|
|
436
436
|
], J.prototype, "pumps", 2);
|
|
437
437
|
_e([
|
|
438
|
-
|
|
438
|
+
Le({ modelType: Fe.type })
|
|
439
439
|
], J.prototype, "ingredientContainer", 2);
|
|
440
440
|
J = _e([
|
|
441
441
|
I(j),
|
|
442
442
|
ut()
|
|
443
443
|
], J);
|
|
444
|
-
const
|
|
444
|
+
const Ke = {
|
|
445
445
|
registration: {
|
|
446
446
|
[j]: {
|
|
447
447
|
class: J,
|
|
@@ -451,16 +451,16 @@ const Ve = {
|
|
|
451
451
|
type: j,
|
|
452
452
|
predicate: b(j),
|
|
453
453
|
factory: v.Factory.create(j)
|
|
454
|
-
},
|
|
454
|
+
}, Jt = async (e, t) => {
|
|
455
455
|
var Se;
|
|
456
|
-
const r =
|
|
457
|
-
|
|
456
|
+
const r = u.propertyMapper.executeMapper(
|
|
457
|
+
h.HolderIngredientMapper,
|
|
458
458
|
t
|
|
459
|
-
), a =
|
|
460
|
-
|
|
459
|
+
), a = u.propertyMapper.executeMapper(
|
|
460
|
+
h.HolderTypeMapper,
|
|
461
461
|
t
|
|
462
462
|
) || t.ingType, i = await T.executeDataMapperExtension({
|
|
463
|
-
extension:
|
|
463
|
+
extension: h.HolderMapper,
|
|
464
464
|
data: t,
|
|
465
465
|
contextData: {}
|
|
466
466
|
}), { name: s, path: n, ingredientId: c, ingType: l, ingSource: p, slice: y, ...B } = t, m = { ...B, ...i }, N = y || { pos: 0 }, te = {
|
|
@@ -474,27 +474,27 @@ const Ve = {
|
|
|
474
474
|
group: e,
|
|
475
475
|
data: m
|
|
476
476
|
};
|
|
477
|
-
return
|
|
478
|
-
}, { URL:
|
|
479
|
-
basePath: `${
|
|
480
|
-
}),
|
|
477
|
+
return Ke.factory(t.path)(te);
|
|
478
|
+
}, { URL: qt } = S("ASSEMBLY_SERVICE"), { getOne: Wt } = C.build({
|
|
479
|
+
basePath: `${qt}/api/kos/device/assemblies`
|
|
480
|
+
}), Qt = f.createLogger({
|
|
481
481
|
name: "assembly-service",
|
|
482
482
|
group: "Services"
|
|
483
|
-
}),
|
|
484
|
-
var
|
|
485
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
483
|
+
}), ke = async () => (Qt.debug("sending GET for assembly"), await Wt({}));
|
|
484
|
+
var er = Object.defineProperty, tr = Object.getOwnPropertyDescriptor, ue = (e, t, r, a) => {
|
|
485
|
+
for (var i = a > 1 ? void 0 : a ? tr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
486
486
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
487
|
-
return a && i &&
|
|
487
|
+
return a && i && er(t, r, i), i;
|
|
488
488
|
};
|
|
489
|
-
const F = "board-container-model",
|
|
489
|
+
const F = "board-container-model", Ye = "/kos/hardware/board/linked", Ze = "/kos/hardware/board/unlinked";
|
|
490
490
|
let L = class {
|
|
491
491
|
constructor(e, t, r) {
|
|
492
492
|
o(this, "id");
|
|
493
493
|
o(this, "logger");
|
|
494
494
|
o(this, "models");
|
|
495
|
-
this.id = e, this.logger = r.logger, this.models = new
|
|
495
|
+
this.id = e, this.logger = r.logger, this.models = new R({
|
|
496
496
|
parentId: e,
|
|
497
|
-
extensionId:
|
|
497
|
+
extensionId: h.BoardIndex
|
|
498
498
|
});
|
|
499
499
|
}
|
|
500
500
|
get boardList() {
|
|
@@ -517,59 +517,59 @@ let L = class {
|
|
|
517
517
|
r.updateModel(e);
|
|
518
518
|
}
|
|
519
519
|
handleBoardLinkEvent(e) {
|
|
520
|
-
this.logger.debug(`handling ${
|
|
520
|
+
this.logger.debug(`handling ${Ye} event ${e}`), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
|
|
521
521
|
}
|
|
522
522
|
handleBoardUnlinkEvent(e) {
|
|
523
523
|
this.logger.debug(
|
|
524
|
-
`handling ${
|
|
524
|
+
`handling ${Ze} event ${e}`
|
|
525
525
|
), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
|
|
526
526
|
}
|
|
527
527
|
};
|
|
528
|
-
|
|
528
|
+
ue([
|
|
529
529
|
M
|
|
530
530
|
], L.prototype, "models", 2);
|
|
531
|
-
|
|
531
|
+
ue([
|
|
532
532
|
W({
|
|
533
|
-
lifecycle:
|
|
534
|
-
topic:
|
|
533
|
+
lifecycle: xe.INIT,
|
|
534
|
+
topic: Ye,
|
|
535
535
|
websocket: !0
|
|
536
536
|
})
|
|
537
537
|
], L.prototype, "handleBoardLinkEvent", 1);
|
|
538
|
-
|
|
538
|
+
ue([
|
|
539
539
|
W({
|
|
540
|
-
lifecycle:
|
|
541
|
-
topic:
|
|
540
|
+
lifecycle: xe.INIT,
|
|
541
|
+
topic: Ze,
|
|
542
542
|
websocket: !0
|
|
543
543
|
})
|
|
544
544
|
], L.prototype, "handleBoardUnlinkEvent", 1);
|
|
545
|
-
L =
|
|
545
|
+
L = ue([
|
|
546
546
|
I(F)
|
|
547
547
|
], L);
|
|
548
|
-
const
|
|
548
|
+
const rr = async (e) => {
|
|
549
549
|
const t = e.data.boardPath, { model: r } = z(t);
|
|
550
550
|
return {
|
|
551
551
|
boardName: (r == null ? void 0 : r.name) || ""
|
|
552
552
|
};
|
|
553
553
|
};
|
|
554
|
-
var
|
|
555
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
554
|
+
var ir = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, Xe = (e, t, r, a) => {
|
|
555
|
+
for (var i = a > 1 ? void 0 : a ? ar(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
556
556
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
557
|
-
return a && i &&
|
|
557
|
+
return a && i && ir(t, r, i), i;
|
|
558
558
|
};
|
|
559
559
|
const H = D.PumpContainer;
|
|
560
|
-
var
|
|
560
|
+
var Je = /* @__PURE__ */ ((e) => (e.byBoard = "byBoard", e.byType = "byType", e.byNozzle = "byNozzle", e))(Je || {});
|
|
561
561
|
let ne = class {
|
|
562
562
|
constructor(e, t) {
|
|
563
563
|
o(this, "id");
|
|
564
564
|
o(this, "pumps");
|
|
565
|
-
this.id = e, this.pumps = new
|
|
565
|
+
this.id = e, this.pumps = new R({
|
|
566
566
|
indexMap: {
|
|
567
567
|
byNozzle: (r) => r.nozzlePaths,
|
|
568
568
|
byBoard: (r) => r.boardPath,
|
|
569
569
|
byType: "type"
|
|
570
570
|
},
|
|
571
571
|
parentId: e,
|
|
572
|
-
extensionId:
|
|
572
|
+
extensionId: h.PumpIndex
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
575
|
/**
|
|
@@ -606,10 +606,10 @@ let ne = class {
|
|
|
606
606
|
}
|
|
607
607
|
// -------------------ENTITY----------------------------
|
|
608
608
|
};
|
|
609
|
-
|
|
609
|
+
Xe([
|
|
610
610
|
M
|
|
611
611
|
], ne.prototype, "pumps", 2);
|
|
612
|
-
ne =
|
|
612
|
+
ne = Xe([
|
|
613
613
|
I(H)
|
|
614
614
|
], ne);
|
|
615
615
|
const Me = {
|
|
@@ -624,15 +624,15 @@ const Me = {
|
|
|
624
624
|
factory: v.Singleton.create(
|
|
625
625
|
H
|
|
626
626
|
)
|
|
627
|
-
},
|
|
627
|
+
}, qe = async (e) => {
|
|
628
628
|
const t = [], { model: r } = await Ae(e);
|
|
629
629
|
return r && (t.push(r.boardPath), t.push(r.nozzlePath), t.push(r.holderPath)), t;
|
|
630
|
-
},
|
|
630
|
+
}, sr = async (e) => {
|
|
631
631
|
const t = [], r = e.data.pumpPath;
|
|
632
632
|
t.push(r);
|
|
633
|
-
const a = await
|
|
633
|
+
const a = await qe(r);
|
|
634
634
|
return [...t, ...a];
|
|
635
|
-
},
|
|
635
|
+
}, nr = async (e) => {
|
|
636
636
|
const t = [], r = e.data.boardPath;
|
|
637
637
|
t.push(e.data.boardPath);
|
|
638
638
|
const a = await Ae(
|
|
@@ -640,10 +640,10 @@ const Me = {
|
|
|
640
640
|
);
|
|
641
641
|
if (a != null && a.model) {
|
|
642
642
|
const s = a.model.models.getIndexByKey(
|
|
643
|
-
|
|
643
|
+
Je.byBoard,
|
|
644
644
|
r
|
|
645
645
|
).map(
|
|
646
|
-
(c) =>
|
|
646
|
+
(c) => qe(c.path)
|
|
647
647
|
);
|
|
648
648
|
(await Promise.allSettled(s)).forEach((c) => {
|
|
649
649
|
c.status === "fulfilled" && c.value.forEach((l) => t.push(l));
|
|
@@ -651,22 +651,22 @@ const Me = {
|
|
|
651
651
|
}
|
|
652
652
|
return Array.from(new Set(t));
|
|
653
653
|
};
|
|
654
|
-
var
|
|
655
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
654
|
+
var or = Object.getOwnPropertyDescriptor, dr = (e, t, r, a) => {
|
|
655
|
+
for (var i = a > 1 ? void 0 : a ? or(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
656
656
|
(n = e[s]) && (i = n(i) || i);
|
|
657
657
|
return i;
|
|
658
658
|
};
|
|
659
|
-
const V = "board-model",
|
|
659
|
+
const V = "board-model", De = (e, t) => {
|
|
660
660
|
const { type: r, name: a, path: i, linked: s, instanceId: n, link: c, ...l } = e;
|
|
661
661
|
t.type = r, t.name = a, t.path = i, t.linked = s, t.link = Object.freeze(c), t.instanceId = n, Object.assign(t, l);
|
|
662
662
|
};
|
|
663
|
-
|
|
663
|
+
u[be].register(
|
|
664
664
|
"board",
|
|
665
|
-
|
|
665
|
+
nr
|
|
666
666
|
);
|
|
667
|
-
|
|
667
|
+
u[q].register(
|
|
668
668
|
"board",
|
|
669
|
-
|
|
669
|
+
rr
|
|
670
670
|
);
|
|
671
671
|
let fe = class {
|
|
672
672
|
constructor(e, t, r) {
|
|
@@ -677,10 +677,10 @@ let fe = class {
|
|
|
677
677
|
o(this, "linked");
|
|
678
678
|
o(this, "instanceId");
|
|
679
679
|
o(this, "logger");
|
|
680
|
-
this.id = e, this.logger = r.logger,
|
|
680
|
+
this.id = e, this.logger = r.logger, De(t, this);
|
|
681
681
|
}
|
|
682
682
|
updateModel(e) {
|
|
683
|
-
|
|
683
|
+
De(e, this);
|
|
684
684
|
}
|
|
685
685
|
// -------------------LIFECYCLE----------------------------
|
|
686
686
|
async init() {
|
|
@@ -690,10 +690,10 @@ let fe = class {
|
|
|
690
690
|
this.logger.debug(`loading board ${this.id}`);
|
|
691
691
|
}
|
|
692
692
|
};
|
|
693
|
-
fe =
|
|
693
|
+
fe = dr([
|
|
694
694
|
I(V)
|
|
695
695
|
], fe);
|
|
696
|
-
const
|
|
696
|
+
const We = {
|
|
697
697
|
registration: {
|
|
698
698
|
[V]: {
|
|
699
699
|
class: fe,
|
|
@@ -703,13 +703,13 @@ const qe = {
|
|
|
703
703
|
type: V,
|
|
704
704
|
predicate: b(V),
|
|
705
705
|
factory: v.Factory.create(V)
|
|
706
|
-
},
|
|
706
|
+
}, Qe = {
|
|
707
707
|
registration: {
|
|
708
708
|
[F]: {
|
|
709
709
|
class: L,
|
|
710
710
|
singleton: !0
|
|
711
711
|
},
|
|
712
|
-
...
|
|
712
|
+
...We.registration
|
|
713
713
|
},
|
|
714
714
|
type: F,
|
|
715
715
|
predicate: b(F),
|
|
@@ -717,24 +717,24 @@ const qe = {
|
|
|
717
717
|
F
|
|
718
718
|
)
|
|
719
719
|
};
|
|
720
|
-
var
|
|
721
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
720
|
+
var lr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, ge = (e, t, r, a) => {
|
|
721
|
+
for (var i = a > 1 ? void 0 : a ? cr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
722
722
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
723
|
-
return a && i &&
|
|
723
|
+
return a && i && lr(t, r, i), i;
|
|
724
724
|
};
|
|
725
|
-
const K = D.HolderContainer,
|
|
726
|
-
let
|
|
725
|
+
const K = D.HolderContainer, pr = "/kos/insertion/insert/start", hr = "/kos/insertion/insert/complete", ur = "/kos/insertion/insert/update", gr = "/kos/insertion/remove", yr = "/kos/pumpEvent/replaceLine", Ir = "/kos/handle/*";
|
|
726
|
+
let x = class {
|
|
727
727
|
constructor(e, t, r) {
|
|
728
728
|
o(this, "id");
|
|
729
729
|
o(this, "holders");
|
|
730
730
|
o(this, "logger");
|
|
731
|
-
this.id = e, this.holders = new
|
|
731
|
+
this.id = e, this.holders = new R({
|
|
732
732
|
indexMap: {
|
|
733
733
|
nozzle: (a) => a.nozzlePaths,
|
|
734
734
|
group: "group"
|
|
735
735
|
},
|
|
736
736
|
parentId: e,
|
|
737
|
-
extensionId:
|
|
737
|
+
extensionId: h.HolderIndex
|
|
738
738
|
}), this.logger = r.logger;
|
|
739
739
|
}
|
|
740
740
|
updateModel() {
|
|
@@ -753,13 +753,13 @@ let A = class {
|
|
|
753
753
|
f.ifDebug(
|
|
754
754
|
() => this.logger.debug("Received insertion event", JSON.stringify(e))
|
|
755
755
|
), (Array.isArray(e) ? e : [e]).forEach((r) => {
|
|
756
|
-
|
|
756
|
+
g(() => {
|
|
757
757
|
var s, n, c;
|
|
758
758
|
const a = r.ingredientId, i = this.holders.getModel(r.path);
|
|
759
759
|
i && (this.logger.info(
|
|
760
760
|
`Received insertion event for holder ${i.path}`
|
|
761
761
|
), i.updateIngredient(a), i.slice.currentVolMl = (s = r.slice) == null ? void 0 : s.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) => {
|
|
762
|
-
|
|
762
|
+
g(() => {
|
|
763
763
|
const p = i.pumps.getModel(l.path);
|
|
764
764
|
p && (p.ingredientId = l.ingredientId, p.inserted = l.inserted, p.prevIngredientId = l.prevIngredientId);
|
|
765
765
|
});
|
|
@@ -769,35 +769,35 @@ let A = class {
|
|
|
769
769
|
}
|
|
770
770
|
// -------------------ENTITY----------------------------
|
|
771
771
|
};
|
|
772
|
-
|
|
772
|
+
ge([
|
|
773
773
|
M
|
|
774
|
-
],
|
|
775
|
-
|
|
774
|
+
], x.prototype, "holders", 2);
|
|
775
|
+
ge([
|
|
776
776
|
W({
|
|
777
|
-
topic:
|
|
777
|
+
topic: Ir,
|
|
778
778
|
websocket: !0,
|
|
779
779
|
condition: (e, t) => t.holders.getModel(e.path) !== void 0
|
|
780
780
|
})
|
|
781
|
-
],
|
|
782
|
-
|
|
781
|
+
], x.prototype, "handleHolderEvents", 1);
|
|
782
|
+
ge([
|
|
783
783
|
W({
|
|
784
784
|
topic: [
|
|
785
|
-
dr,
|
|
786
|
-
lr,
|
|
787
|
-
cr,
|
|
788
785
|
pr,
|
|
789
|
-
|
|
786
|
+
hr,
|
|
787
|
+
ur,
|
|
788
|
+
gr,
|
|
789
|
+
yr
|
|
790
790
|
],
|
|
791
791
|
websocket: !0
|
|
792
792
|
})
|
|
793
|
-
],
|
|
794
|
-
|
|
793
|
+
], x.prototype, "handleInsertion", 1);
|
|
794
|
+
x = ge([
|
|
795
795
|
I(K)
|
|
796
|
-
],
|
|
797
|
-
const
|
|
796
|
+
], x);
|
|
797
|
+
const et = {
|
|
798
798
|
registration: {
|
|
799
799
|
[K]: {
|
|
800
|
-
class:
|
|
800
|
+
class: x,
|
|
801
801
|
singleton: !0
|
|
802
802
|
}
|
|
803
803
|
},
|
|
@@ -806,9 +806,9 @@ const Qe = {
|
|
|
806
806
|
factory: v.Singleton.create(
|
|
807
807
|
K
|
|
808
808
|
)
|
|
809
|
-
},
|
|
809
|
+
}, mr = f.createLogger({ name: "board-utils" }), fr = async (e) => {
|
|
810
810
|
const t = await T.executeDataMapperExtension({
|
|
811
|
-
extension:
|
|
811
|
+
extension: h.BoardMapper,
|
|
812
812
|
data: e,
|
|
813
813
|
contextData: {}
|
|
814
814
|
}), { type: r, name: a, path: i, linked: s, instanceId: n, ...c } = e, l = { ...c, ...t }, p = {
|
|
@@ -818,41 +818,41 @@ const Qe = {
|
|
|
818
818
|
linked: s,
|
|
819
819
|
instanceId: n,
|
|
820
820
|
...l
|
|
821
|
-
}, y =
|
|
821
|
+
}, y = We.factory(e.path)(p);
|
|
822
822
|
return y.updateModel(p), y;
|
|
823
|
-
},
|
|
824
|
-
|
|
825
|
-
const r = await
|
|
823
|
+
}, Pr = (e) => async (t) => {
|
|
824
|
+
mr.debug(`adding board ${t.name}`);
|
|
825
|
+
const r = await fr(t);
|
|
826
826
|
e.addModel(r);
|
|
827
827
|
};
|
|
828
828
|
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 || {});
|
|
829
|
-
const { URL: Oe } = S("PUMP_SERVICE"), { postModel:
|
|
829
|
+
const { URL: Oe } = S("PUMP_SERVICE"), { postModel: vr, getOne: br } = C.build({
|
|
830
830
|
basePath: `${Oe}/api/kos/holders`
|
|
831
831
|
});
|
|
832
832
|
f.createLogger({
|
|
833
833
|
name: "pump-service",
|
|
834
834
|
group: "Services"
|
|
835
835
|
});
|
|
836
|
-
const
|
|
836
|
+
const _r = async ({
|
|
837
837
|
intent: e,
|
|
838
838
|
pumpId: t,
|
|
839
839
|
tracker: r
|
|
840
840
|
}) => {
|
|
841
|
-
const a = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${t}/${e}`, i = await
|
|
841
|
+
const a = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${t}/${e}`, i = await vr({ model: {}, urlOverride: a, tracker: r });
|
|
842
842
|
return i != null && i.data && ce.initiateFuture(i.data), i;
|
|
843
|
-
},
|
|
844
|
-
const r = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`, a = await
|
|
843
|
+
}, Mr = async (e, t) => {
|
|
844
|
+
const r = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`, a = await br({ urlOverride: r });
|
|
845
845
|
return a != null && a.data ? a.data : { volume: -1 };
|
|
846
846
|
};
|
|
847
|
-
var
|
|
848
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
847
|
+
var Or = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, tt = (e, t, r, a) => {
|
|
848
|
+
for (var i = a > 1 ? void 0 : a ? Er(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
849
849
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
850
|
-
return a && i &&
|
|
850
|
+
return a && i && Or(t, r, i), i;
|
|
851
851
|
};
|
|
852
852
|
const k = D.Pump;
|
|
853
|
-
|
|
853
|
+
u[be].register(
|
|
854
854
|
"pump",
|
|
855
|
-
|
|
855
|
+
sr
|
|
856
856
|
);
|
|
857
857
|
let oe = class {
|
|
858
858
|
constructor(e, t) {
|
|
@@ -883,7 +883,7 @@ let oe = class {
|
|
|
883
883
|
prevIngredientId: y,
|
|
884
884
|
...B
|
|
885
885
|
} = t;
|
|
886
|
-
this.inserted = r, this.type = t.type, this.ingredientId = t.ingredientId, this.holderPath = a, this.boardPath = i, this.nozzlePath = s, this.name = n, this.path = c, this.childPump = !!l, this.virtual = !!p, this.prevIngredientId = y, Object.assign(this, B), this.futureHandler = new
|
|
886
|
+
this.inserted = r, this.type = t.type, this.ingredientId = t.ingredientId, this.holderPath = a, this.boardPath = i, this.nozzlePath = s, this.name = n, this.path = c, this.childPump = !!l, this.virtual = !!p, this.prevIngredientId = y, Object.assign(this, B), this.futureHandler = new Be(this);
|
|
887
887
|
}
|
|
888
888
|
updateModel(e) {
|
|
889
889
|
const {
|
|
@@ -911,13 +911,13 @@ let oe = class {
|
|
|
911
911
|
return !!this.ingredientId && !this.isPouring;
|
|
912
912
|
}
|
|
913
913
|
onFutureUpdate(e) {
|
|
914
|
-
e.endState &&
|
|
914
|
+
e.endState && g(() => {
|
|
915
915
|
this.currentState = d.IDLE;
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
918
|
async cancelPour() {
|
|
919
919
|
var e;
|
|
920
|
-
this.currentState === d.POURING || this.currentState === d.POUR_STARTING ? (this.currentState = d.POUR_CANCELING, await ((e = this.future) == null ? void 0 : e.cancelFuture()),
|
|
920
|
+
this.currentState === d.POURING || this.currentState === d.POUR_STARTING ? (this.currentState = d.POUR_CANCELING, await ((e = this.future) == null ? void 0 : e.cancelFuture()), g(() => {
|
|
921
921
|
this.currentState = d.IDLE;
|
|
922
922
|
})) : f.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
923
923
|
}
|
|
@@ -925,7 +925,7 @@ let oe = class {
|
|
|
925
925
|
return this.futureHandler.future;
|
|
926
926
|
}
|
|
927
927
|
async resolveIntentVolume(e) {
|
|
928
|
-
return await
|
|
928
|
+
return await Mr(this.path, e);
|
|
929
929
|
}
|
|
930
930
|
async performIntent(e, t) {
|
|
931
931
|
const r = typeof e == "string" ? e : e.intent;
|
|
@@ -935,12 +935,12 @@ let oe = class {
|
|
|
935
935
|
if (this.currentState === d.IDLE) {
|
|
936
936
|
if (this.currentState = d.POUR_STARTING, !t)
|
|
937
937
|
throw new Error("No tracker provided");
|
|
938
|
-
const a = await
|
|
938
|
+
const a = await _r({
|
|
939
939
|
tracker: t,
|
|
940
940
|
intent: r,
|
|
941
941
|
pumpId: this.path
|
|
942
942
|
});
|
|
943
|
-
return this.currentState === d.POUR_STARTING &&
|
|
943
|
+
return this.currentState === d.POUR_STARTING && g(() => {
|
|
944
944
|
this.currentState = d.POURING;
|
|
945
945
|
}), a == null ? void 0 : a.data;
|
|
946
946
|
} else
|
|
@@ -951,13 +951,13 @@ let oe = class {
|
|
|
951
951
|
}
|
|
952
952
|
// -------------------ENTITY----------------------------
|
|
953
953
|
};
|
|
954
|
-
|
|
954
|
+
tt([
|
|
955
955
|
pe()
|
|
956
956
|
], oe.prototype, "performIntent", 1);
|
|
957
|
-
oe =
|
|
957
|
+
oe = tt([
|
|
958
958
|
I(k)
|
|
959
959
|
], oe);
|
|
960
|
-
const
|
|
960
|
+
const rt = {
|
|
961
961
|
registration: {
|
|
962
962
|
[k]: {
|
|
963
963
|
class: oe,
|
|
@@ -967,7 +967,7 @@ const tt = {
|
|
|
967
967
|
type: k,
|
|
968
968
|
predicate: b(k),
|
|
969
969
|
factory: v.Factory.create(k)
|
|
970
|
-
},
|
|
970
|
+
}, wr = f.createLogger({ name: "pump-utils" }), $r = (e, t) => {
|
|
971
971
|
const r = (t.pumps ?? []).length > 1, a = {
|
|
972
972
|
boardPath: t.boardPath,
|
|
973
973
|
holderPath: t.holderPath,
|
|
@@ -980,12 +980,12 @@ const tt = {
|
|
|
980
980
|
type: t.type,
|
|
981
981
|
nozzlePath: e,
|
|
982
982
|
prevIngredientId: t.prevIngredientId
|
|
983
|
-
}, i =
|
|
983
|
+
}, i = rt.factory(t.path)(a);
|
|
984
984
|
return i.updateModel(a), i;
|
|
985
|
-
},
|
|
985
|
+
}, it = (e) => (t) => (r) => (a) => {
|
|
986
986
|
var c;
|
|
987
|
-
|
|
988
|
-
const i =
|
|
987
|
+
wr.debug(`adding pump ${a.name}`);
|
|
988
|
+
const i = $r(r.path, a);
|
|
989
989
|
e.addModel(i);
|
|
990
990
|
const s = i.holderPath, n = t.holders.getModel(s);
|
|
991
991
|
n == null || n.pumps.addModel(i), n != null && n.nozzlePaths.includes(r.path) || n == null || n.nozzlePaths.push(r.path), (c = a == null ? void 0 : a.pumps) == null || c.forEach((l) => {
|
|
@@ -995,15 +995,15 @@ const tt = {
|
|
|
995
995
|
holderPath: p,
|
|
996
996
|
ingredientId: i.ingredientId
|
|
997
997
|
};
|
|
998
|
-
|
|
998
|
+
it(e)(t)(r)(y);
|
|
999
999
|
});
|
|
1000
1000
|
};
|
|
1001
|
-
var
|
|
1002
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
1001
|
+
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Q = (e, t, r, a) => {
|
|
1002
|
+
for (var i = a > 1 ? void 0 : a ? Cr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1003
1003
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1004
|
-
return a && i &&
|
|
1004
|
+
return a && i && Sr(t, r, i), i;
|
|
1005
1005
|
};
|
|
1006
|
-
const Y = "assembly-model",
|
|
1006
|
+
const Y = "assembly-model", Rr = "assembly-data", Dr = "assembly-raw-data";
|
|
1007
1007
|
let w = class {
|
|
1008
1008
|
constructor(e, t, r) {
|
|
1009
1009
|
o(this, "id");
|
|
@@ -1013,7 +1013,7 @@ let w = class {
|
|
|
1013
1013
|
o(this, "boardContainer");
|
|
1014
1014
|
o(this, "pumpContainer");
|
|
1015
1015
|
o(this, "logger");
|
|
1016
|
-
this.id = e, this.holderContainer =
|
|
1016
|
+
this.id = e, this.holderContainer = et.factory({}), this.boardContainer = Qe.factory({}), this.pumpContainer = Me.factory({}), this.logger = r.logger;
|
|
1017
1017
|
}
|
|
1018
1018
|
updateModel(e) {
|
|
1019
1019
|
}
|
|
@@ -1056,23 +1056,23 @@ let w = class {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
async ready() {
|
|
1058
1058
|
var e;
|
|
1059
|
-
(e = this.troubleContainer) == null || e.troubles.increment(),
|
|
1060
|
-
|
|
1059
|
+
(e = this.troubleContainer) == null || e.troubles.increment(), u[gt].execute(
|
|
1060
|
+
h.AssemblyFeatureFlags,
|
|
1061
1061
|
this
|
|
1062
1062
|
);
|
|
1063
1063
|
}
|
|
1064
1064
|
async load(e) {
|
|
1065
1065
|
this.logger.debug(`loading assembly ${this.id}`);
|
|
1066
|
-
const t = await
|
|
1066
|
+
const t = await ke();
|
|
1067
1067
|
if ((t == null ? void 0 : t.status) === 200) {
|
|
1068
1068
|
const r = await T.executeDataMapperExtension({
|
|
1069
|
-
extension:
|
|
1069
|
+
extension: h.AssemblyMapper,
|
|
1070
1070
|
data: t.data,
|
|
1071
1071
|
contextData: {}
|
|
1072
1072
|
});
|
|
1073
|
-
e.set(
|
|
1074
|
-
|
|
1075
|
-
}), e.set(
|
|
1073
|
+
e.set(Rr, r), Object.assign(this, r), Object.entries(r).forEach(([a, i]) => {
|
|
1074
|
+
yt(i) && (this.logger.debug(`adding child model ${a} from extension data`), this[It][a] = !0);
|
|
1075
|
+
}), e.set(Dr, t.data);
|
|
1076
1076
|
for await (const a of t.data.assemblies) {
|
|
1077
1077
|
const {
|
|
1078
1078
|
boards: i = [],
|
|
@@ -1084,19 +1084,19 @@ let w = class {
|
|
|
1084
1084
|
...y
|
|
1085
1085
|
} = a;
|
|
1086
1086
|
this.logger.debug(`adding assembly ${l}`), Object.keys(y).forEach((m) => {
|
|
1087
|
-
|
|
1087
|
+
mt.enableFeature(m);
|
|
1088
1088
|
});
|
|
1089
1089
|
for await (const m of i)
|
|
1090
|
-
this.logger.debug(`adding board ${m.name}`), await
|
|
1090
|
+
this.logger.debug(`adding board ${m.name}`), await Pr(this.boardContainer)(m);
|
|
1091
1091
|
for await (const [m, N] of Object.entries(
|
|
1092
1092
|
s ?? {}
|
|
1093
1093
|
))
|
|
1094
1094
|
for await (const te of N) {
|
|
1095
1095
|
this.logger.debug(`adding holder ${te.name}`);
|
|
1096
|
-
const $e = await
|
|
1096
|
+
const $e = await Jt(m, te);
|
|
1097
1097
|
this.holderContainer.holders.addModel($e);
|
|
1098
1098
|
}
|
|
1099
|
-
const B =
|
|
1099
|
+
const B = it(this.pumpContainer)(
|
|
1100
1100
|
this.holderContainer
|
|
1101
1101
|
);
|
|
1102
1102
|
n.forEach((m) => {
|
|
@@ -1109,7 +1109,7 @@ let w = class {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
};
|
|
1111
1111
|
Q([
|
|
1112
|
-
|
|
1112
|
+
Le({
|
|
1113
1113
|
modelType: "trouble-container-model"
|
|
1114
1114
|
})
|
|
1115
1115
|
], w.prototype, "troubleContainer", 2);
|
|
@@ -1125,7 +1125,7 @@ Q([
|
|
|
1125
1125
|
w = Q([
|
|
1126
1126
|
I(Y)
|
|
1127
1127
|
], w);
|
|
1128
|
-
const
|
|
1128
|
+
const at = {
|
|
1129
1129
|
registration: {
|
|
1130
1130
|
[Y]: {
|
|
1131
1131
|
class: w,
|
|
@@ -1136,8 +1136,8 @@ const it = {
|
|
|
1136
1136
|
predicate: b(Y),
|
|
1137
1137
|
factory: v.Singleton.create(Y)
|
|
1138
1138
|
};
|
|
1139
|
-
var
|
|
1140
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
1139
|
+
var Nr = Object.getOwnPropertyDescriptor, Tr = (e, t, r, a) => {
|
|
1140
|
+
for (var i = a > 1 ? void 0 : a ? Nr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1141
1141
|
(n = e[s]) && (i = n(i) || i);
|
|
1142
1142
|
return i;
|
|
1143
1143
|
};
|
|
@@ -1168,8 +1168,8 @@ let Pe = class {
|
|
|
1168
1168
|
// -------------------LIFECYCLE----------------------------
|
|
1169
1169
|
// -------------------ENTITY----------------------------
|
|
1170
1170
|
};
|
|
1171
|
-
Pe =
|
|
1172
|
-
|
|
1171
|
+
Pe = Tr([
|
|
1172
|
+
ft(),
|
|
1173
1173
|
I(Z)
|
|
1174
1174
|
], Pe);
|
|
1175
1175
|
const ve = {
|
|
@@ -1184,41 +1184,41 @@ const ve = {
|
|
|
1184
1184
|
factory: v.Factory.create(
|
|
1185
1185
|
Z
|
|
1186
1186
|
)
|
|
1187
|
-
}, { URL:
|
|
1188
|
-
basePath: `${
|
|
1189
|
-
}),
|
|
1187
|
+
}, { URL: A } = S("NOZZLE_SERVICE"), { postModel: Ee, deleteModel: zr, getOne: Lr } = C.build({
|
|
1188
|
+
basePath: `${A}/api/nozzle`
|
|
1189
|
+
}), xr = async (e, t) => {
|
|
1190
1190
|
const r = await Ee({
|
|
1191
1191
|
model: {},
|
|
1192
|
-
urlOverride: `${
|
|
1192
|
+
urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/pour`,
|
|
1193
1193
|
ordered: !0,
|
|
1194
1194
|
tracker: t
|
|
1195
1195
|
});
|
|
1196
1196
|
return r != null && r.data && ce.initiateFuture(r.data), r;
|
|
1197
|
-
},
|
|
1197
|
+
}, Ar = async (e, t, r) => {
|
|
1198
1198
|
const a = await Ee({
|
|
1199
1199
|
model: {},
|
|
1200
|
-
urlOverride: `${
|
|
1200
|
+
urlOverride: `${A}/api/ext/dispense/nozzle/${t}/pipeline/beverage/fixed/${e}`,
|
|
1201
1201
|
ordered: !0,
|
|
1202
1202
|
tracker: r
|
|
1203
1203
|
});
|
|
1204
1204
|
return a != null && a.data && ce.initiateFuture(a.data), a;
|
|
1205
|
-
},
|
|
1206
|
-
urlOverride: `${
|
|
1207
|
-
}),
|
|
1205
|
+
}, Br = async (e) => await Lr({
|
|
1206
|
+
urlOverride: `${A}${e}/pipeline/beverage/availability`
|
|
1207
|
+
}), Ur = async (e, t) => await Ee({
|
|
1208
1208
|
model: t,
|
|
1209
|
-
urlOverride: `${
|
|
1210
|
-
}),
|
|
1209
|
+
urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1210
|
+
}), Gr = async (e) => await zr({
|
|
1211
1211
|
id: e,
|
|
1212
|
-
urlOverride: `${
|
|
1212
|
+
urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1213
1213
|
});
|
|
1214
|
-
var
|
|
1215
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
1214
|
+
var jr = Object.defineProperty, Fr = Object.getOwnPropertyDescriptor, ee = (e, t, r, a) => {
|
|
1215
|
+
for (var i = a > 1 ? void 0 : a ? Fr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1216
1216
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1217
|
-
return a && i &&
|
|
1217
|
+
return a && i && jr(t, r, i), i;
|
|
1218
1218
|
};
|
|
1219
|
-
const X = D.Nozzle,
|
|
1219
|
+
const X = D.Nozzle, Hr = Pt(
|
|
1220
1220
|
"beverageTopicPrefix"
|
|
1221
|
-
), re = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0,
|
|
1221
|
+
), re = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0, Ne = "/kos/nozzle/pour/started", Vr = "/kos/nozzle/pour/progress", ye = "/kos/nozzle/pour/cancel";
|
|
1222
1222
|
let $ = class {
|
|
1223
1223
|
constructor(e, t, r) {
|
|
1224
1224
|
/** the unique identifier for this nozzle.*/
|
|
@@ -1235,7 +1235,7 @@ let $ = class {
|
|
|
1235
1235
|
o(this, "beverageTopicPrefix");
|
|
1236
1236
|
o(this, "topicPrefix");
|
|
1237
1237
|
o(this, "urlPrefix");
|
|
1238
|
-
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
|
|
1238
|
+
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 vt(this), this._availabilityItems = new R({
|
|
1239
1239
|
indexMap: {
|
|
1240
1240
|
byGroup: "groupId",
|
|
1241
1241
|
byParent: "parentId"
|
|
@@ -1327,19 +1327,19 @@ let $ = class {
|
|
|
1327
1327
|
context: r
|
|
1328
1328
|
}) {
|
|
1329
1329
|
if (!e) {
|
|
1330
|
-
const c = await
|
|
1330
|
+
const c = await Gr(this.name);
|
|
1331
1331
|
if ((c == null ? void 0 : c.status) !== 200)
|
|
1332
1332
|
throw new Error("Failed to clear pourable");
|
|
1333
1333
|
this._selectedBeverage = void 0;
|
|
1334
1334
|
return;
|
|
1335
1335
|
}
|
|
1336
|
-
if (e === this._selectedBeverage &&
|
|
1336
|
+
if (e === this._selectedBeverage && bt(this._additionalItems, t)) {
|
|
1337
1337
|
this.logger.info("No change in selected pourable");
|
|
1338
1338
|
return;
|
|
1339
1339
|
}
|
|
1340
1340
|
this._selectedBeverage = e, this._additionalItems = t;
|
|
1341
|
-
let a = await
|
|
1342
|
-
|
|
1341
|
+
let a = await u.dataMapper.executeMapper(
|
|
1342
|
+
h.SelectedPourableMapper,
|
|
1343
1343
|
{
|
|
1344
1344
|
beverage: e,
|
|
1345
1345
|
additional: t,
|
|
@@ -1352,7 +1352,7 @@ let $ = class {
|
|
|
1352
1352
|
(!a || Object.keys(a).length === 0) && (this.logger.info(
|
|
1353
1353
|
`No selected pourable mapper defined, using the default payload ${i}`
|
|
1354
1354
|
), a = i);
|
|
1355
|
-
const s = a ?? i, n = await
|
|
1355
|
+
const s = a ?? i, n = await Ur(this.name, s);
|
|
1356
1356
|
if ((n == null ? void 0 : n.status) !== 200)
|
|
1357
1357
|
throw new Error("Failed to select pourable");
|
|
1358
1358
|
}
|
|
@@ -1387,7 +1387,7 @@ let $ = class {
|
|
|
1387
1387
|
);
|
|
1388
1388
|
}
|
|
1389
1389
|
updateIfCurrent(e, t) {
|
|
1390
|
-
this.currentState === e &&
|
|
1390
|
+
this.currentState === e && g(() => {
|
|
1391
1391
|
this.currentState = t;
|
|
1392
1392
|
});
|
|
1393
1393
|
}
|
|
@@ -1406,7 +1406,7 @@ let $ = class {
|
|
|
1406
1406
|
reason: e.reason,
|
|
1407
1407
|
timeRemaining: e.timeRemaining
|
|
1408
1408
|
};
|
|
1409
|
-
_.publish(
|
|
1409
|
+
_.publish(Vr, r), e.endState && g(() => {
|
|
1410
1410
|
this.currentState = d.IDLE;
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
@@ -1416,7 +1416,7 @@ let $ = class {
|
|
|
1416
1416
|
if (this.currentState === d.IDLE) {
|
|
1417
1417
|
if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
|
|
1418
1418
|
throw new Error("No tracker provided");
|
|
1419
|
-
const r = await
|
|
1419
|
+
const r = await xr(this.name, e);
|
|
1420
1420
|
this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
|
|
1421
1421
|
var s;
|
|
1422
1422
|
re(i) && ((s = i.onPourStart) == null || s.call(i));
|
|
@@ -1425,7 +1425,7 @@ let $ = class {
|
|
|
1425
1425
|
nozzleId: this.id,
|
|
1426
1426
|
type: "free"
|
|
1427
1427
|
};
|
|
1428
|
-
if (_.publish(
|
|
1428
|
+
if (_.publish(Ne, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
|
|
1429
1429
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1430
1430
|
const i = {
|
|
1431
1431
|
nozzleId: this.id
|
|
@@ -1445,8 +1445,8 @@ let $ = class {
|
|
|
1445
1445
|
if (this.currentState === d.IDLE) {
|
|
1446
1446
|
if (this.currentState = d.POUR_STARTING, !t)
|
|
1447
1447
|
throw new Error("No tracker provided");
|
|
1448
|
-
const a = await
|
|
1449
|
-
this.currentState === d.POUR_STARTING &&
|
|
1448
|
+
const a = await Ar(e, this.name, t);
|
|
1449
|
+
this.currentState === d.POUR_STARTING && g(() => {
|
|
1450
1450
|
this.currentState = d.POURING;
|
|
1451
1451
|
}), E(this).forEach((s) => {
|
|
1452
1452
|
var n;
|
|
@@ -1456,7 +1456,7 @@ let $ = class {
|
|
|
1456
1456
|
nozzleId: this.id,
|
|
1457
1457
|
type: "fixed"
|
|
1458
1458
|
};
|
|
1459
|
-
if (_.publish(
|
|
1459
|
+
if (_.publish(Ne, i), (r = a == null ? void 0 : a.data) != null && r.endState) {
|
|
1460
1460
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1461
1461
|
const s = {
|
|
1462
1462
|
nozzleId: this.id
|
|
@@ -1476,7 +1476,7 @@ let $ = class {
|
|
|
1476
1476
|
async cancelPour() {
|
|
1477
1477
|
var e;
|
|
1478
1478
|
if (this.currentState === d.POURING || this.currentState === d.POUR_STARTING) {
|
|
1479
|
-
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()),
|
|
1479
|
+
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), g(() => {
|
|
1480
1480
|
this.currentState = d.IDLE;
|
|
1481
1481
|
}), E(this).forEach((r) => {
|
|
1482
1482
|
var a;
|
|
@@ -1503,18 +1503,18 @@ let $ = class {
|
|
|
1503
1503
|
async load(e) {
|
|
1504
1504
|
var a, i;
|
|
1505
1505
|
this.logger.debug(`loading nozzle ${this.id}`);
|
|
1506
|
-
const t = await
|
|
1506
|
+
const t = await Br(this.urlPrefix);
|
|
1507
1507
|
if ((t == null ? void 0 : t.status) !== 200)
|
|
1508
1508
|
throw new Error("Failed to load nozzle availability");
|
|
1509
|
-
const r = await
|
|
1510
|
-
|
|
1509
|
+
const r = await u.loader.executeLoader(
|
|
1510
|
+
h.AvailabilityLoader,
|
|
1511
1511
|
{}
|
|
1512
1512
|
);
|
|
1513
|
-
e == null || e.set(
|
|
1513
|
+
e == null || e.set(h.AvailabilityLoader, r), e == null || e.set(we.type, this);
|
|
1514
1514
|
for (const s of Object.keys((a = t.data) == null ? void 0 : a.groups) || [])
|
|
1515
1515
|
for (const n of ((i = t.data) == null ? void 0 : i.groups[s]) || []) {
|
|
1516
|
-
const c = await
|
|
1517
|
-
|
|
1516
|
+
const c = await u.dataMapper.executeMapper(
|
|
1517
|
+
h.AvailabilityMapper,
|
|
1518
1518
|
{ ...n, groupId: s },
|
|
1519
1519
|
r
|
|
1520
1520
|
), l = {
|
|
@@ -1533,7 +1533,7 @@ let $ = class {
|
|
|
1533
1533
|
this.updateGroupMembers();
|
|
1534
1534
|
}
|
|
1535
1535
|
async updateAvailability(e) {
|
|
1536
|
-
const t =
|
|
1536
|
+
const t = _t.getContext(this.id), r = (t == null ? void 0 : t.get(h.AvailabilityLoader)) || {};
|
|
1537
1537
|
if (e.rebuild)
|
|
1538
1538
|
for (const a of Object.keys(e == null ? void 0 : e.groups) || []) {
|
|
1539
1539
|
this._availabilityItems.getIndexByKey("group", a).filter(
|
|
@@ -1541,11 +1541,11 @@ let $ = class {
|
|
|
1541
1541
|
(n) => `${this.id}-${a}-${n.id}` === s.id
|
|
1542
1542
|
)
|
|
1543
1543
|
).forEach((s) => {
|
|
1544
|
-
this._availabilityItems.removeModel(s.id),
|
|
1544
|
+
this._availabilityItems.removeModel(s.id), Mt(s);
|
|
1545
1545
|
});
|
|
1546
1546
|
for (const s of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1547
|
-
const n = await
|
|
1548
|
-
|
|
1547
|
+
const n = await u.dataMapper.executeMapper(
|
|
1548
|
+
h.AvailabilityMapper,
|
|
1549
1549
|
{ ...s, groupId: a },
|
|
1550
1550
|
r
|
|
1551
1551
|
), c = {
|
|
@@ -1573,8 +1573,8 @@ let $ = class {
|
|
|
1573
1573
|
else
|
|
1574
1574
|
for (const a of Object.keys(e == null ? void 0 : e.groups) || [])
|
|
1575
1575
|
for (const i of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1576
|
-
const s = await
|
|
1577
|
-
|
|
1576
|
+
const s = await u.dataMapper.executeMapper(
|
|
1577
|
+
h.AvailabilityMapper,
|
|
1578
1578
|
{ ...i, groupId: a },
|
|
1579
1579
|
r
|
|
1580
1580
|
), n = {
|
|
@@ -1607,7 +1607,7 @@ ee([
|
|
|
1607
1607
|
], $.prototype, "fixedPour", 1);
|
|
1608
1608
|
ee([
|
|
1609
1609
|
W({
|
|
1610
|
-
topic: `${
|
|
1610
|
+
topic: `${Hr}/availability`,
|
|
1611
1611
|
websocket: !0
|
|
1612
1612
|
})
|
|
1613
1613
|
], $.prototype, "updateAvailability", 1);
|
|
@@ -1625,18 +1625,18 @@ const we = {
|
|
|
1625
1625
|
predicate: b(X),
|
|
1626
1626
|
factory: v.Factory.create(X)
|
|
1627
1627
|
};
|
|
1628
|
-
var
|
|
1629
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
1628
|
+
var Kr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, st = (e, t, r, a) => {
|
|
1629
|
+
for (var i = a > 1 ? void 0 : a ? kr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1630
1630
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1631
|
-
return a && i &&
|
|
1631
|
+
return a && i && Kr(t, r, i), i;
|
|
1632
1632
|
};
|
|
1633
|
-
const
|
|
1633
|
+
const nt = "device-assembly-model";
|
|
1634
1634
|
let de = class {
|
|
1635
1635
|
constructor(e, t, r) {
|
|
1636
1636
|
o(this, "id");
|
|
1637
1637
|
o(this, "deviceNozzles");
|
|
1638
1638
|
o(this, "logger");
|
|
1639
|
-
this.id = e, this.logger = r.logger, this.deviceNozzles = new
|
|
1639
|
+
this.id = e, this.logger = r.logger, this.deviceNozzles = new R();
|
|
1640
1640
|
}
|
|
1641
1641
|
// -------------------LIFECYCLE----------------------------
|
|
1642
1642
|
async init() {
|
|
@@ -1650,7 +1650,7 @@ let de = class {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
async load() {
|
|
1652
1652
|
this.logger.debug(`loading device-assembly ${this.id}`);
|
|
1653
|
-
const e = await
|
|
1653
|
+
const e = await ke();
|
|
1654
1654
|
(e == null ? void 0 : e.status) === 200 && e.data.assemblies.map((r) => r.nozzles ?? []).flat().forEach((r) => {
|
|
1655
1655
|
var n;
|
|
1656
1656
|
const a = r.path, i = ((n = r.pipelines.find((c) => c.name === "beverage")) == null ? void 0 : n.topicPrefix) || "", s = we.factory(a)({
|
|
@@ -1664,45 +1664,53 @@ let de = class {
|
|
|
1664
1664
|
});
|
|
1665
1665
|
}
|
|
1666
1666
|
};
|
|
1667
|
-
|
|
1667
|
+
st([
|
|
1668
1668
|
M
|
|
1669
1669
|
], de.prototype, "deviceNozzles", 2);
|
|
1670
|
-
de =
|
|
1671
|
-
I(
|
|
1670
|
+
de = st([
|
|
1671
|
+
I(nt)
|
|
1672
1672
|
], de);
|
|
1673
|
-
const
|
|
1673
|
+
const Yr = new Ot({
|
|
1674
1674
|
class: de,
|
|
1675
|
-
type:
|
|
1676
|
-
}), { URL:
|
|
1677
|
-
basePath: `${
|
|
1678
|
-
}),
|
|
1679
|
-
const r = await
|
|
1675
|
+
type: nt
|
|
1676
|
+
}), { URL: ot } = S("GENERIC_POUR_SERVICE"), { postModel: Zr } = C.build({
|
|
1677
|
+
basePath: `${ot}/api/nozzle`
|
|
1678
|
+
}), Xr = async (e, t) => {
|
|
1679
|
+
const r = await Zr({
|
|
1680
1680
|
model: {},
|
|
1681
|
-
urlOverride: `${
|
|
1681
|
+
urlOverride: `${ot}${e}`,
|
|
1682
1682
|
ordered: !0,
|
|
1683
1683
|
tracker: t
|
|
1684
1684
|
});
|
|
1685
1685
|
return r != null && r.data && ce.initiateFuture(r.data), r;
|
|
1686
1686
|
};
|
|
1687
|
-
var
|
|
1688
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
1687
|
+
var Jr = Object.defineProperty, qr = Object.getOwnPropertyDescriptor, dt = (e, t, r, a) => {
|
|
1688
|
+
for (var i = a > 1 ? void 0 : a ? qr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1689
1689
|
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1690
|
-
return a && i &&
|
|
1690
|
+
return a && i && Jr(t, r, i), i;
|
|
1691
1691
|
};
|
|
1692
|
-
const
|
|
1692
|
+
const lt = "generic-pour-model", Wr = "/kos/generic/pour/started", Qr = "/kos/generic/pour/progress", Te = "/kos/generic/pour/cancel", Ie = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0;
|
|
1693
1693
|
let le = class {
|
|
1694
|
-
constructor(e, t
|
|
1694
|
+
constructor(e, t) {
|
|
1695
1695
|
o(this, "id");
|
|
1696
1696
|
o(this, "currentState", d.IDLE);
|
|
1697
1697
|
o(this, "servicePathFactory");
|
|
1698
1698
|
o(this, "pourType");
|
|
1699
|
-
o(this, "logger");
|
|
1700
|
-
o(this, "futureHandler");
|
|
1701
1699
|
o(this, "selectedId");
|
|
1702
|
-
|
|
1700
|
+
o(this, "state");
|
|
1701
|
+
this.id = e, this.futureHandler = new Be(this), this.servicePathFactory = t.servicePathFactory, this.pourType = t.pourType || "free", this.selectedId = t.selectedId, this.state = Ce();
|
|
1703
1702
|
}
|
|
1704
1703
|
get servicePath() {
|
|
1705
|
-
return this.selectedId ? this.servicePathFactory(this.selectedId) : "";
|
|
1704
|
+
return this.selectedId ? this.servicePathFactory(this.selectedId, this.state) : "";
|
|
1705
|
+
}
|
|
1706
|
+
updateContextData(e, t) {
|
|
1707
|
+
this.state[e] = t;
|
|
1708
|
+
}
|
|
1709
|
+
removeContextData(e) {
|
|
1710
|
+
delete this.state[e];
|
|
1711
|
+
}
|
|
1712
|
+
clearContextData() {
|
|
1713
|
+
this.state = Ce();
|
|
1706
1714
|
}
|
|
1707
1715
|
async pour(e) {
|
|
1708
1716
|
var t;
|
|
@@ -1710,7 +1718,7 @@ let le = class {
|
|
|
1710
1718
|
if (this.currentState === d.IDLE) {
|
|
1711
1719
|
if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
|
|
1712
1720
|
throw new Error("No tracker provided");
|
|
1713
|
-
const r = await
|
|
1721
|
+
const r = await Xr(this.servicePath, e);
|
|
1714
1722
|
this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
|
|
1715
1723
|
var s;
|
|
1716
1724
|
Ie(i) && ((s = i.onPourStart) == null || s.call(i));
|
|
@@ -1719,12 +1727,12 @@ let le = class {
|
|
|
1719
1727
|
pourTarget: this.id,
|
|
1720
1728
|
type: this.pourType
|
|
1721
1729
|
};
|
|
1722
|
-
if (_.publish(
|
|
1730
|
+
if (_.publish(Wr, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
|
|
1723
1731
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1724
1732
|
const i = {
|
|
1725
1733
|
pourTarget: this.id
|
|
1726
1734
|
};
|
|
1727
|
-
_.publish(
|
|
1735
|
+
_.publish(Te, i);
|
|
1728
1736
|
}
|
|
1729
1737
|
return r;
|
|
1730
1738
|
} else
|
|
@@ -1736,7 +1744,7 @@ let le = class {
|
|
|
1736
1744
|
async cancelPour() {
|
|
1737
1745
|
var e;
|
|
1738
1746
|
if (this.currentState === d.POURING || this.currentState === d.POUR_STARTING) {
|
|
1739
|
-
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()),
|
|
1747
|
+
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), g(() => {
|
|
1740
1748
|
this.currentState = d.IDLE;
|
|
1741
1749
|
}), E(this).forEach((r) => {
|
|
1742
1750
|
var a;
|
|
@@ -1745,12 +1753,12 @@ let le = class {
|
|
|
1745
1753
|
const t = {
|
|
1746
1754
|
pourTarget: this.id
|
|
1747
1755
|
};
|
|
1748
|
-
_.publish(
|
|
1756
|
+
_.publish(Te, t);
|
|
1749
1757
|
}
|
|
1750
1758
|
this.currentState === d.IDLE ? this.logger.info("Pour already idle, nothing to cancel.") : this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1751
1759
|
}
|
|
1752
1760
|
updateIfCurrent(e, t) {
|
|
1753
|
-
this.currentState === e &&
|
|
1761
|
+
this.currentState === e && g(() => {
|
|
1754
1762
|
this.currentState = t;
|
|
1755
1763
|
});
|
|
1756
1764
|
}
|
|
@@ -1760,7 +1768,7 @@ let le = class {
|
|
|
1760
1768
|
*/
|
|
1761
1769
|
get isPouring() {
|
|
1762
1770
|
var e;
|
|
1763
|
-
return !!(this.
|
|
1771
|
+
return !!(this.future && !((e = this.future) != null && e.endState)) || this.currentState === d.POUR_STARTING || this.currentState === d.POURING || this.currentState === d.POUR_CANCELING;
|
|
1764
1772
|
}
|
|
1765
1773
|
/**
|
|
1766
1774
|
* A derived value that indicates if the pour target is currently available to pour a beverage.
|
|
@@ -1769,16 +1777,12 @@ let le = class {
|
|
|
1769
1777
|
* The value is observable and will change when the selected pourable changes or the pour target
|
|
1770
1778
|
* starts or stops pouring.
|
|
1771
1779
|
* @readonly
|
|
1772
|
-
|
|
1780
|
+
*/
|
|
1773
1781
|
get canPour() {
|
|
1774
1782
|
return this.currentState === d.IDLE;
|
|
1775
1783
|
}
|
|
1776
|
-
get future() {
|
|
1777
|
-
return this.futureHandler.getFuture();
|
|
1778
|
-
}
|
|
1779
1784
|
get pourProgress() {
|
|
1780
|
-
|
|
1781
|
-
return ((e = this.future) == null ? void 0 : e.progress) ?? 0;
|
|
1785
|
+
return this.progress ?? 0;
|
|
1782
1786
|
}
|
|
1783
1787
|
onFutureUpdate(e) {
|
|
1784
1788
|
E(this).forEach((r) => {
|
|
@@ -1795,48 +1799,43 @@ let le = class {
|
|
|
1795
1799
|
reason: e.reason,
|
|
1796
1800
|
timeRemaining: e.timeRemaining
|
|
1797
1801
|
};
|
|
1798
|
-
_.publish(
|
|
1802
|
+
_.publish(Qr, t), e.endState && g(() => {
|
|
1799
1803
|
this.currentState = d.IDLE;
|
|
1800
1804
|
});
|
|
1801
1805
|
}
|
|
1802
|
-
// -------------------LIFECYCLE----------------------------
|
|
1803
|
-
async init() {
|
|
1804
|
-
this.logger.debug(`initializing generic-pour ${this.id}`);
|
|
1805
|
-
}
|
|
1806
|
-
async load() {
|
|
1807
|
-
this.logger.debug(`loading generic-pour ${this.id}`);
|
|
1808
|
-
}
|
|
1809
1806
|
};
|
|
1810
|
-
|
|
1807
|
+
dt([
|
|
1811
1808
|
pe()
|
|
1812
1809
|
], le.prototype, "pour", 1);
|
|
1813
|
-
le =
|
|
1814
|
-
I(
|
|
1810
|
+
le = dt([
|
|
1811
|
+
I(lt),
|
|
1812
|
+
Et(),
|
|
1813
|
+
wt()
|
|
1815
1814
|
], le);
|
|
1816
|
-
const
|
|
1815
|
+
const di = new $t({
|
|
1817
1816
|
class: le,
|
|
1818
|
-
type:
|
|
1819
|
-
}),
|
|
1820
|
-
...
|
|
1821
|
-
...
|
|
1822
|
-
...
|
|
1823
|
-
...
|
|
1817
|
+
type: lt
|
|
1818
|
+
}), ze = {
|
|
1819
|
+
...Fe.registration,
|
|
1820
|
+
...Ue.registration,
|
|
1821
|
+
...et.registration,
|
|
1822
|
+
...Ke.registration,
|
|
1824
1823
|
...we.registration,
|
|
1825
|
-
...
|
|
1824
|
+
...rt.registration,
|
|
1826
1825
|
...Me.registration,
|
|
1827
1826
|
...ve.registration,
|
|
1828
|
-
...
|
|
1829
|
-
...
|
|
1830
|
-
},
|
|
1831
|
-
const r =
|
|
1832
|
-
|
|
1833
|
-
}),
|
|
1827
|
+
...at.registration,
|
|
1828
|
+
...Qe.registration
|
|
1829
|
+
}, ei = (e) => () => (Ct(e)(), Yr.register(), Object.keys(ze).forEach((t) => {
|
|
1830
|
+
const r = ze[t];
|
|
1831
|
+
Rt(e)(t, r);
|
|
1832
|
+
}), u[q].register(
|
|
1834
1833
|
"FirmwareUpdateInProgressTrouble",
|
|
1835
1834
|
async (t) => {
|
|
1836
1835
|
var r;
|
|
1837
1836
|
if ((r = t.data) != null && r.deviceId) {
|
|
1838
1837
|
const { model: a } = z(
|
|
1839
|
-
|
|
1838
|
+
at.type
|
|
1840
1839
|
);
|
|
1841
1840
|
if (a) {
|
|
1842
1841
|
const i = a.boards.find(
|
|
@@ -1855,59 +1854,59 @@ const si = new Ot({
|
|
|
1855
1854
|
companion: O.companion.register(e),
|
|
1856
1855
|
legacy: O.model.registerLegacyModel(e)
|
|
1857
1856
|
}), P = {
|
|
1858
|
-
...
|
|
1857
|
+
...St
|
|
1859
1858
|
};
|
|
1860
1859
|
P.dispense = {
|
|
1861
|
-
models:
|
|
1860
|
+
models: ei(P)
|
|
1862
1861
|
};
|
|
1863
1862
|
P.preload = O.model.preloadModel(P);
|
|
1864
1863
|
P.model = O.model.register(P);
|
|
1865
1864
|
P.companion = O.companion.register(P);
|
|
1866
1865
|
P.legacy = O.model.registerLegacyModel(P);
|
|
1867
|
-
const
|
|
1866
|
+
const li = P;
|
|
1868
1867
|
export {
|
|
1869
|
-
|
|
1868
|
+
at as A,
|
|
1870
1869
|
L as B,
|
|
1871
|
-
|
|
1870
|
+
Rr as C,
|
|
1872
1871
|
D,
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1872
|
+
h as E,
|
|
1873
|
+
Br as F,
|
|
1874
|
+
di as G,
|
|
1875
|
+
Ke as H,
|
|
1876
|
+
Ue as I,
|
|
1877
|
+
Ar as J,
|
|
1878
|
+
li as K,
|
|
1879
|
+
xr as L,
|
|
1880
|
+
Ur as M,
|
|
1882
1881
|
we as N,
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1882
|
+
Xr as O,
|
|
1883
|
+
rt as P,
|
|
1884
|
+
Ye as T,
|
|
1885
|
+
Dr as a,
|
|
1887
1886
|
ve as b,
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1887
|
+
Ze as c,
|
|
1888
|
+
Qe as d,
|
|
1889
|
+
We as e,
|
|
1890
|
+
Yr as f,
|
|
1891
|
+
et as g,
|
|
1892
|
+
Fe as h,
|
|
1894
1893
|
Me as i,
|
|
1895
|
-
|
|
1894
|
+
Je as j,
|
|
1896
1895
|
d as k,
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1896
|
+
ze as l,
|
|
1897
|
+
zt as m,
|
|
1898
|
+
ni as n,
|
|
1899
|
+
jt as o,
|
|
1900
|
+
oi as p,
|
|
1901
|
+
si as q,
|
|
1902
|
+
ei as r,
|
|
1903
|
+
ai as s,
|
|
1904
|
+
Ht as t,
|
|
1905
|
+
kt as u,
|
|
1906
|
+
Ft as v,
|
|
1907
|
+
ke as w,
|
|
1908
|
+
Mr as x,
|
|
1909
|
+
_r as y,
|
|
1910
|
+
Gr as z
|
|
1912
1911
|
};
|
|
1913
|
-
//# sourceMappingURL=dispense-registration-manager-
|
|
1912
|
+
//# sourceMappingURL=dispense-registration-manager-CB_nSTZw.js.map
|