@kosdev-code/kos-dispense-sdk 2.0.43 → 2.0.44
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-DZWwSdsc.js → dispense-registration-manager-B6nEgoFC.js} +378 -362
- package/{dispense-registration-manager-DZWwSdsc.js.map → dispense-registration-manager-B6nEgoFC.js.map} +1 -1
- package/dispense-registration-manager-CFnZNxso.cjs +2 -0
- package/{dispense-registration-manager-DFEU9oXa.cjs.map → dispense-registration-manager-CFnZNxso.cjs.map} +1 -1
- package/{extension-utils-C-QjbNHU.js → extension-utils-CtCTSFBg.js} +2 -2
- package/{extension-utils-C-QjbNHU.js.map → extension-utils-CtCTSFBg.js.map} +1 -1
- package/{extension-utils-CKGiF5Qr.cjs → extension-utils-DupW7Vca.cjs} +2 -2
- package/{extension-utils-CKGiF5Qr.cjs.map → extension-utils-DupW7Vca.cjs.map} +1 -1
- package/index.cjs +1 -1
- package/index.js +3 -3
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +2 -2
- package/package.json +2 -2
- package/{pump-provider-BO5BamvM.js → pump-provider-BWzCQ8mL.js} +2 -2
- package/{pump-provider-BO5BamvM.js.map → pump-provider-BWzCQ8mL.js.map} +1 -1
- package/{pump-provider-B7qOq1di.cjs → pump-provider-vk4pL4O3.cjs} +2 -2
- package/{pump-provider-B7qOq1di.cjs.map → pump-provider-vk4pL4O3.cjs.map} +1 -1
- package/ui.cjs +1 -1
- package/ui.js +2 -2
- package/dispense-registration-manager-DFEU9oXa.cjs +0 -2
package/{dispense-registration-manager-DZWwSdsc.js → dispense-registration-manager-B6nEgoFC.js}
RENAMED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
var pt = Object.defineProperty;
|
|
2
2
|
var ut = (e, t, r) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var o = (e, t, r) => (ut(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import { kosModel as I, Kos as
|
|
4
|
+
import { kosModel as I, Kos as v, isKosModel as P, resolveServiceUrl as S, ServiceFactory as C, KosLog as m, KosModelContainer as R, KosExtensionUtils as T, kosChild as M, FetchError as gt, ExtensionManager as g, EXTENSION_TROUBLE_MAPPER as Me, EXTENSION_TROUBLE_DATA_MAPPER as W, getKosModelSync as N, kosDependency as ce, TroubleContainer as xe, troubleByTypeReducer as Ae, kosAction as h, kosTopicHandler as Q, DependencyLifecycle as Be, getKosModel as Ue, FutureManager as pe, kosFuture as ue, FutureHandler as Ge, EXTENSION_FEATURE_FLAG_RESOLVER as ht, isKosDataModel as yt, ChildModels as It, KosFeatureFlags as ft, kosParentAware as mt, createPropKey as bt, MultipleFutureHandler as vt, arraysEqual as Pt, getAllKosCompanionModels as E, EventBus as _, KosContextManager as _t, destroyKosModel as Mt, SingletonKosModelRegistrationFactory as Ot, KosModelRegistrationFactory as Et, KosModelRegistry as wt, RegistrationManager as O, registerCoreModels as $t, registerLegacyModel as St } from "@kosdev-code/kos-ui-sdk";
|
|
5
5
|
import "react";
|
|
6
|
-
var u = /* @__PURE__ */ ((e) => (e.IngredientLoader = "kos.ingredient.loader", e.IngredientMapper = "kos.ingredient.mapper", e.IngredientIndex = "kos.ingredient.index", e.IngredientTypeMapper = "kos.ingredient.type.mapper", e.HolderTypeMapper = "kos.holder.type.mapper", e.HolderMapper = "kos.holder.mapper", e.HolderIndex = "kos.holder.index", e.HolderIngredientMapper = "kos.holder.ingredient.mapper", e.AvailabilityMapper = "kos.availability.mapper", e.AvailabilityLoader = "kos.availability.loader", e.SelectedPourableMapper = "kos.selected.pourable.mapper", e.AssemblyMapper = "kos.assembly.mapper", e.BoardMapper = "kos.board.mapper", e.BoardIndex = "kos.board.index", e.PumpIndex = "kos.pump.index", e.AssemblyFeatureFlags = "kos.assembly.feature.flags", e))(u || {}),
|
|
7
|
-
for (var i =
|
|
8
|
-
(n = e[
|
|
6
|
+
var u = /* @__PURE__ */ ((e) => (e.IngredientLoader = "kos.ingredient.loader", e.IngredientMapper = "kos.ingredient.mapper", e.IngredientIndex = "kos.ingredient.index", e.IngredientTypeMapper = "kos.ingredient.type.mapper", e.HolderTypeMapper = "kos.holder.type.mapper", e.HolderMapper = "kos.holder.mapper", e.HolderIndex = "kos.holder.index", e.HolderIngredientMapper = "kos.holder.ingredient.mapper", e.AvailabilityMapper = "kos.availability.mapper", e.AvailabilityLoader = "kos.availability.loader", e.SelectedPourableMapper = "kos.selected.pourable.mapper", e.AssemblyMapper = "kos.assembly.mapper", e.BoardMapper = "kos.board.mapper", e.BoardIndex = "kos.board.index", e.PumpIndex = "kos.pump.index", e.AssemblyFeatureFlags = "kos.assembly.feature.flags", e))(u || {}), z = /* @__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))(z || {}), Ct = Object.getOwnPropertyDescriptor, Rt = (e, t, r, a) => {
|
|
7
|
+
for (var i = a > 1 ? void 0 : a ? Ct(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
8
|
+
(n = e[s]) && (i = n(i) || i);
|
|
9
9
|
return i;
|
|
10
10
|
};
|
|
11
11
|
const G = "ingredient-model";
|
|
12
|
-
let
|
|
12
|
+
let be = class {
|
|
13
13
|
constructor(e, {
|
|
14
14
|
name: t,
|
|
15
15
|
type: r,
|
|
16
|
-
data:
|
|
16
|
+
data: a,
|
|
17
17
|
ingredientId: i,
|
|
18
|
-
...
|
|
18
|
+
...s
|
|
19
19
|
}) {
|
|
20
20
|
o(this, "id");
|
|
21
21
|
o(this, "ingredientId");
|
|
22
22
|
o(this, "name");
|
|
23
23
|
o(this, "type");
|
|
24
24
|
o(this, "data");
|
|
25
|
-
this.id = e, this.ingredientId = i, this.name = t, this.type = r, this.data =
|
|
25
|
+
this.id = e, this.ingredientId = i, this.name = t, this.type = r, this.data = a, Object.assign(this, s);
|
|
26
26
|
}
|
|
27
27
|
updateModel({
|
|
28
28
|
name: e,
|
|
29
29
|
type: t,
|
|
30
30
|
data: r,
|
|
31
|
-
ingredientId:
|
|
31
|
+
ingredientId: a,
|
|
32
32
|
...i
|
|
33
33
|
}) {
|
|
34
|
-
this.name = e, this.type = t, this.ingredientId =
|
|
34
|
+
this.name = e, this.type = t, this.ingredientId = a, this.data = r, Object.assign(this, i);
|
|
35
35
|
}
|
|
36
36
|
// -------------------LIFECYCLE----------------------------
|
|
37
37
|
// -------------------ENTITY----------------------------
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
be = Rt([
|
|
40
40
|
I(G)
|
|
41
|
-
],
|
|
41
|
+
], be);
|
|
42
42
|
const je = {
|
|
43
43
|
registration: {
|
|
44
44
|
[G]: {
|
|
45
|
-
class:
|
|
45
|
+
class: be,
|
|
46
46
|
singleton: !1
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
type: G,
|
|
50
|
-
predicate:
|
|
51
|
-
factory:
|
|
52
|
-
}, { URL: Fe } = S("INGREDIENT_SERVICE"), { getOne:
|
|
50
|
+
predicate: P(G),
|
|
51
|
+
factory: v.Factory.create(G)
|
|
52
|
+
}, { URL: Fe } = S("INGREDIENT_SERVICE"), { getOne: zt } = C.build({
|
|
53
53
|
basePath: `${Fe}/api/ext/dispense/ingredients`
|
|
54
|
-
}),
|
|
54
|
+
}), Dt = async () => await zt({
|
|
55
55
|
urlOverride: `${Fe}/api/ext/dispense/ingredients`
|
|
56
56
|
});
|
|
57
|
-
var
|
|
58
|
-
for (var i =
|
|
59
|
-
(n = e[
|
|
60
|
-
return
|
|
57
|
+
var Tt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, He = (e, t, r, a) => {
|
|
58
|
+
for (var i = a > 1 ? void 0 : a ? Nt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
59
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
60
|
+
return a && i && Tt(t, r, i), i;
|
|
61
61
|
};
|
|
62
|
-
const j = "ingredient-container-model", Lt =
|
|
63
|
-
let
|
|
62
|
+
const j = "ingredient-container-model", Lt = m.createLogger({ name: "ingredient-container-model" });
|
|
63
|
+
let ae = class {
|
|
64
64
|
constructor(e, t) {
|
|
65
65
|
o(this, "id");
|
|
66
66
|
o(this, "ingredients");
|
|
@@ -81,28 +81,28 @@ let se = class {
|
|
|
81
81
|
async load(e) {
|
|
82
82
|
var i;
|
|
83
83
|
Lt.debug(`loading ingredient container ${this.id}`);
|
|
84
|
-
const t = await
|
|
84
|
+
const t = await Dt();
|
|
85
85
|
if ((t == null ? void 0 : t.status) !== 200)
|
|
86
86
|
throw new Error("Failed to load ingredients");
|
|
87
|
-
const r = await
|
|
87
|
+
const r = await T.executeLoaderExtension({
|
|
88
88
|
context: e,
|
|
89
89
|
extension: u.IngredientLoader
|
|
90
|
-
}),
|
|
91
|
-
for (const
|
|
92
|
-
for (const n of ((i = t == null ? void 0 : t.data) == null ? void 0 : i[
|
|
93
|
-
const
|
|
90
|
+
}), a = (t == null ? void 0 : t.data) ?? {};
|
|
91
|
+
for (const s of Object.keys(a))
|
|
92
|
+
for (const n of ((i = t == null ? void 0 : t.data) == null ? void 0 : i[s]) || []) {
|
|
93
|
+
const l = await T.executeDataMapperExtension({
|
|
94
94
|
extension: u.IngredientMapper,
|
|
95
95
|
data: n,
|
|
96
96
|
contextData: r
|
|
97
|
-
}),
|
|
97
|
+
}), c = await T.executePropertyMapperExtension({
|
|
98
98
|
extension: u.IngredientTypeMapper,
|
|
99
99
|
data: n,
|
|
100
100
|
contextData: r
|
|
101
101
|
}), p = {
|
|
102
102
|
...n,
|
|
103
|
-
type:
|
|
104
|
-
...
|
|
105
|
-
data:
|
|
103
|
+
type: c || n.type,
|
|
104
|
+
...l,
|
|
105
|
+
data: l
|
|
106
106
|
}, y = je.factory(n.id)(
|
|
107
107
|
p
|
|
108
108
|
);
|
|
@@ -113,23 +113,23 @@ let se = class {
|
|
|
113
113
|
};
|
|
114
114
|
He([
|
|
115
115
|
M
|
|
116
|
-
],
|
|
117
|
-
|
|
116
|
+
], ae.prototype, "ingredients", 2);
|
|
117
|
+
ae = He([
|
|
118
118
|
I(j)
|
|
119
|
-
],
|
|
119
|
+
], ae);
|
|
120
120
|
const Ke = {
|
|
121
121
|
registration: {
|
|
122
122
|
[j]: {
|
|
123
|
-
class:
|
|
123
|
+
class: ae,
|
|
124
124
|
singleton: !0
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
type: j,
|
|
128
|
-
predicate:
|
|
129
|
-
factory:
|
|
128
|
+
predicate: P(j),
|
|
129
|
+
factory: v.Singleton.create(j)
|
|
130
130
|
}, { URL: ge } = S("HOLDER_SERVICE"), { getAll: xt, postModel: Ve, deleteModel: At } = C.build({
|
|
131
131
|
basePath: `${ge}/api/kos/holders`
|
|
132
|
-
}), Bt =
|
|
132
|
+
}), Bt = m.createLogger({
|
|
133
133
|
name: "holder-service",
|
|
134
134
|
group: "Services"
|
|
135
135
|
}), ri = async () => await xt({}), Ut = async (e, t) => {
|
|
@@ -155,40 +155,40 @@ const Ke = {
|
|
|
155
155
|
model: {},
|
|
156
156
|
urlOverride: `${ge}/api/ext/dispense/pumpEvents/replaceLine/${e}`
|
|
157
157
|
});
|
|
158
|
-
}, { URL:
|
|
158
|
+
}, { URL: se } = S("ASSIGNMENT_SERVICE"), { getAll: Ft, postModel: ke, deleteModel: Ht } = C.build({
|
|
159
159
|
destinationAddress: "",
|
|
160
|
-
basePath: `${
|
|
160
|
+
basePath: `${se}/api/ext/dispense/assignments`
|
|
161
161
|
}), ne = window.kosUseFos, ii = async () => await Ft({ fos: ne }), Kt = async (e, t) => {
|
|
162
|
-
var i,
|
|
163
|
-
const r = JSON.stringify(t),
|
|
162
|
+
var i, s, n, l;
|
|
163
|
+
const r = JSON.stringify(t), a = `${se}/api/ext/dispense/assignments`;
|
|
164
164
|
try {
|
|
165
|
-
const
|
|
165
|
+
const c = await ke({
|
|
166
166
|
model: { holderPath: e, factoryJson: r },
|
|
167
|
-
urlOverride:
|
|
167
|
+
urlOverride: a
|
|
168
168
|
});
|
|
169
|
-
return (
|
|
170
|
-
} catch (
|
|
171
|
-
if (
|
|
169
|
+
return (c == null ? void 0 : c.status) === 200 && ((i = c == null ? void 0 : c.data) != null && i.error) ? [c.data.error || "unknownError", c.data] : [void 0, c == null ? void 0 : c.data];
|
|
170
|
+
} catch (c) {
|
|
171
|
+
if (c instanceof gt)
|
|
172
172
|
return [
|
|
173
|
-
((n = (
|
|
174
|
-
(
|
|
173
|
+
((n = (s = c.payload) == null ? void 0 : s.data) == null ? void 0 : n.error) || "unknownError",
|
|
174
|
+
(l = c.payload) == null ? void 0 : l.data
|
|
175
175
|
];
|
|
176
176
|
}
|
|
177
177
|
return ["unknownError", void 0];
|
|
178
|
-
},
|
|
179
|
-
const t = ne ? `${
|
|
178
|
+
}, ai = async (e) => {
|
|
179
|
+
const t = ne ? `${se}/api/ingredients/assignments/${e.holderPath}` : `${se}/api/ext/dispense/assignments`;
|
|
180
180
|
return await ke({
|
|
181
181
|
model: { ...e, fuelGauge: 680 },
|
|
182
182
|
fos: ne,
|
|
183
183
|
urlOverride: t
|
|
184
184
|
});
|
|
185
|
-
},
|
|
186
|
-
var Vt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, he = (e, t, r,
|
|
187
|
-
for (var i =
|
|
188
|
-
(n = e[
|
|
189
|
-
return
|
|
185
|
+
}, si = async (e) => await Ht({ id: e, fos: ne });
|
|
186
|
+
var Vt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, he = (e, t, r, a) => {
|
|
187
|
+
for (var i = a > 1 ? void 0 : a ? kt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
188
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
189
|
+
return a && i && Vt(t, r, i), i;
|
|
190
190
|
};
|
|
191
|
-
const F =
|
|
191
|
+
const F = z.Holder, ze = m.createLogger({ name: "holder-model" });
|
|
192
192
|
g[Me].register(
|
|
193
193
|
"holder",
|
|
194
194
|
async (e) => {
|
|
@@ -200,11 +200,11 @@ g[W].register(
|
|
|
200
200
|
"pump",
|
|
201
201
|
async (e) => {
|
|
202
202
|
if (e.data.pumpPath) {
|
|
203
|
-
const { model: t } =
|
|
203
|
+
const { model: t } = N(
|
|
204
204
|
e.data.pumpPath
|
|
205
205
|
);
|
|
206
206
|
if (t) {
|
|
207
|
-
const r = t.ingredientId ?
|
|
207
|
+
const r = t.ingredientId ? N(t.ingredientId).model : void 0;
|
|
208
208
|
return {
|
|
209
209
|
ingredientId: t.ingredientId,
|
|
210
210
|
ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
|
|
@@ -225,7 +225,7 @@ g[W].register(
|
|
|
225
225
|
"container",
|
|
226
226
|
async (e) => {
|
|
227
227
|
if (e.data.ingredients.length > 0) {
|
|
228
|
-
const t = e.data.ingredients[0], { model: r } =
|
|
228
|
+
const t = e.data.ingredients[0], { model: r } = N(t);
|
|
229
229
|
return {
|
|
230
230
|
ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
|
|
231
231
|
ingredients: e.data.ingredients ? e.data.ingredients : [],
|
|
@@ -236,8 +236,8 @@ g[W].register(
|
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
238
|
class Yt extends Error {
|
|
239
|
-
constructor(r,
|
|
240
|
-
super(
|
|
239
|
+
constructor(r, a) {
|
|
240
|
+
super(a);
|
|
241
241
|
o(this, "type");
|
|
242
242
|
this.name = "AssignmentError", this.type = r;
|
|
243
243
|
}
|
|
@@ -246,12 +246,12 @@ let L = class {
|
|
|
246
246
|
constructor(e, {
|
|
247
247
|
path: t,
|
|
248
248
|
name: r,
|
|
249
|
-
ingredientSource:
|
|
249
|
+
ingredientSource: a,
|
|
250
250
|
ingredientId: i,
|
|
251
|
-
ingredientType:
|
|
251
|
+
ingredientType: s,
|
|
252
252
|
slice: n,
|
|
253
|
-
group:
|
|
254
|
-
data:
|
|
253
|
+
group: l,
|
|
254
|
+
data: c,
|
|
255
255
|
enjoyByDate: p
|
|
256
256
|
}, y) {
|
|
257
257
|
o(this, "id");
|
|
@@ -268,7 +268,7 @@ let L = class {
|
|
|
268
268
|
o(this, "pumps");
|
|
269
269
|
o(this, "ingredientContainer");
|
|
270
270
|
o(this, "troubleContainer");
|
|
271
|
-
this.id = e, this.path = t, this.name = r, this.ingredientType =
|
|
271
|
+
this.id = e, this.path = t, this.name = r, this.ingredientType = s, this.ingredientSource = a, this.ingredientId = i, this.group = l, this.slice = n, this.enjoyByDate = p, this.data = c, this.pumps = new R({
|
|
272
272
|
parentId: e,
|
|
273
273
|
sortKey: "path"
|
|
274
274
|
}), this.logger = y.logger;
|
|
@@ -277,14 +277,14 @@ let L = class {
|
|
|
277
277
|
path: e,
|
|
278
278
|
name: t,
|
|
279
279
|
ingredientSource: r,
|
|
280
|
-
ingredientId:
|
|
280
|
+
ingredientId: a,
|
|
281
281
|
ingredientType: i,
|
|
282
|
-
group:
|
|
282
|
+
group: s,
|
|
283
283
|
slice: n,
|
|
284
|
-
enjoyByDate:
|
|
285
|
-
data:
|
|
284
|
+
enjoyByDate: l,
|
|
285
|
+
data: c
|
|
286
286
|
}) {
|
|
287
|
-
this.path = e, this.name = t, this.ingredientId =
|
|
287
|
+
this.path = e, this.name = t, this.ingredientId = a, this.ingredientType = i, this.ingredientSource = r, this.enjoyByDate = l, this.slice = n, this.group = s, this.data = c;
|
|
288
288
|
}
|
|
289
289
|
get hasEnjoyByDate() {
|
|
290
290
|
return !!this.enjoyByDate && !this.unassigned;
|
|
@@ -309,8 +309,8 @@ let L = class {
|
|
|
309
309
|
return this.logger.debug(`isPouring: ${!!e}`), e;
|
|
310
310
|
}
|
|
311
311
|
async performIntent(e) {
|
|
312
|
-
const t = typeof e == "string" ? e : e.intent, r = typeof e == "string" ? void 0 : e.pumpPath,
|
|
313
|
-
return
|
|
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
314
|
}
|
|
315
315
|
get pourState() {
|
|
316
316
|
return this.pumps.data.reduce((t, r) => r.pouringState ? r.pouringState : t, "");
|
|
@@ -406,7 +406,7 @@ let L = class {
|
|
|
406
406
|
this.ingredientId = r == null ? void 0 : r.ingredientId;
|
|
407
407
|
}), r;
|
|
408
408
|
} catch (t) {
|
|
409
|
-
throw
|
|
409
|
+
throw ze.error(`Failed to perform rfid override on holder ${this.id}`, t), t;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
async assignIngredient(e) {
|
|
@@ -415,7 +415,7 @@ let L = class {
|
|
|
415
415
|
this.ingredientId = e;
|
|
416
416
|
});
|
|
417
417
|
} catch (t) {
|
|
418
|
-
throw
|
|
418
|
+
throw ze.error(`Failed to perform assign ingredient to holder ${this.id}`, t), t;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
get shouldDefer() {
|
|
@@ -464,42 +464,42 @@ const Ye = {
|
|
|
464
464
|
}
|
|
465
465
|
},
|
|
466
466
|
type: F,
|
|
467
|
-
predicate:
|
|
468
|
-
factory:
|
|
467
|
+
predicate: P(F),
|
|
468
|
+
factory: v.Factory.create(F)
|
|
469
469
|
}, Zt = async (e, t) => {
|
|
470
470
|
var Re;
|
|
471
471
|
const r = g.propertyMapper.executeMapper(
|
|
472
472
|
u.HolderIngredientMapper,
|
|
473
473
|
t
|
|
474
|
-
),
|
|
474
|
+
), a = g.propertyMapper.executeMapper(
|
|
475
475
|
u.HolderTypeMapper,
|
|
476
476
|
t
|
|
477
|
-
) || t.ingType, i = await
|
|
477
|
+
) || t.ingType, i = await T.executeDataMapperExtension({
|
|
478
478
|
extension: u.HolderMapper,
|
|
479
479
|
data: t,
|
|
480
480
|
contextData: {}
|
|
481
|
-
}), { name:
|
|
482
|
-
name:
|
|
481
|
+
}), { name: s, path: n, ingredientId: l, ingType: c, ingSource: p, slice: y, ...U } = t, f = { ...U, ...i }, D = y || { pos: 0 }, re = {
|
|
482
|
+
name: s,
|
|
483
483
|
path: n,
|
|
484
|
-
ingredientId: r ||
|
|
485
|
-
ingredientType:
|
|
484
|
+
ingredientId: r || l,
|
|
485
|
+
ingredientType: a || c,
|
|
486
486
|
ingredientSource: p,
|
|
487
487
|
enjoyByDate: (Re = t.container) != null && Re.enjoyByDate ? new Date(t.container.enjoyByDate) : void 0,
|
|
488
|
-
slice:
|
|
488
|
+
slice: D,
|
|
489
489
|
group: e,
|
|
490
|
-
data:
|
|
490
|
+
data: f
|
|
491
491
|
};
|
|
492
492
|
return Ye.factory(t.path)(re);
|
|
493
493
|
}, { URL: Xt } = S("ASSEMBLY_SERVICE"), { getOne: Jt } = C.build({
|
|
494
494
|
basePath: `${Xt}/api/kos/device/assemblies`
|
|
495
|
-
}), qt =
|
|
495
|
+
}), qt = m.createLogger({
|
|
496
496
|
name: "assembly-service",
|
|
497
497
|
group: "Services"
|
|
498
498
|
}), Ze = async () => (qt.debug("sending GET for assembly"), await Jt({}));
|
|
499
|
-
var Wt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, ye = (e, t, r,
|
|
500
|
-
for (var i =
|
|
501
|
-
(n = e[
|
|
502
|
-
return
|
|
499
|
+
var Wt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, ye = (e, t, r, a) => {
|
|
500
|
+
for (var i = a > 1 ? void 0 : a ? Qt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
501
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
502
|
+
return a && i && Wt(t, r, i), i;
|
|
503
503
|
};
|
|
504
504
|
const H = "board-container-model", Xe = "/kos/hardware/board/linked", Je = "/kos/hardware/board/unlinked";
|
|
505
505
|
let x = class {
|
|
@@ -561,17 +561,17 @@ x = ye([
|
|
|
561
561
|
I(H)
|
|
562
562
|
], x);
|
|
563
563
|
const er = async (e) => {
|
|
564
|
-
const t = e.data.boardPath, { model: r } =
|
|
564
|
+
const t = e.data.boardPath, { model: r } = N(t);
|
|
565
565
|
return {
|
|
566
566
|
boardName: (r == null ? void 0 : r.name) || ""
|
|
567
567
|
};
|
|
568
568
|
};
|
|
569
|
-
var tr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, qe = (e, t, r,
|
|
570
|
-
for (var i =
|
|
571
|
-
(n = e[
|
|
572
|
-
return
|
|
569
|
+
var tr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, qe = (e, t, r, a) => {
|
|
570
|
+
for (var i = a > 1 ? void 0 : a ? rr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
571
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
572
|
+
return a && i && tr(t, r, i), i;
|
|
573
573
|
};
|
|
574
|
-
const K =
|
|
574
|
+
const K = z.PumpContainer;
|
|
575
575
|
var We = /* @__PURE__ */ ((e) => (e.byBoard = "byBoard", e.byType = "byType", e.byNozzle = "byNozzle", e))(We || {});
|
|
576
576
|
let oe = class {
|
|
577
577
|
constructor(e, t) {
|
|
@@ -635,8 +635,8 @@ const Oe = {
|
|
|
635
635
|
}
|
|
636
636
|
},
|
|
637
637
|
type: K,
|
|
638
|
-
predicate:
|
|
639
|
-
factory:
|
|
638
|
+
predicate: P(K),
|
|
639
|
+
factory: v.Singleton.create(
|
|
640
640
|
K
|
|
641
641
|
)
|
|
642
642
|
}, Qe = async (e) => {
|
|
@@ -645,45 +645,45 @@ const Oe = {
|
|
|
645
645
|
}, ir = async (e) => {
|
|
646
646
|
const t = [], r = e.data.pumpPath;
|
|
647
647
|
t.push(r);
|
|
648
|
-
const
|
|
649
|
-
return [...t, ...
|
|
650
|
-
},
|
|
648
|
+
const a = await Qe(r);
|
|
649
|
+
return [...t, ...a];
|
|
650
|
+
}, ar = async (e) => {
|
|
651
651
|
const t = [], r = e.data.boardPath;
|
|
652
652
|
t.push(e.data.boardPath);
|
|
653
|
-
const
|
|
653
|
+
const a = await Ue(
|
|
654
654
|
Oe.type
|
|
655
655
|
);
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
656
|
+
if (a != null && a.model) {
|
|
657
|
+
const s = a.model.models.getIndexByKey(
|
|
658
658
|
We.byBoard,
|
|
659
659
|
r
|
|
660
660
|
).map(
|
|
661
|
-
(
|
|
661
|
+
(l) => Qe(l.path)
|
|
662
662
|
);
|
|
663
|
-
(await Promise.allSettled(
|
|
664
|
-
|
|
663
|
+
(await Promise.allSettled(s)).forEach((l) => {
|
|
664
|
+
l.status === "fulfilled" && l.value.forEach((c) => t.push(c));
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
667
|
return Array.from(new Set(t));
|
|
668
668
|
};
|
|
669
|
-
var
|
|
670
|
-
for (var i =
|
|
671
|
-
(n = e[
|
|
669
|
+
var sr = Object.getOwnPropertyDescriptor, nr = (e, t, r, a) => {
|
|
670
|
+
for (var i = a > 1 ? void 0 : a ? sr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
671
|
+
(n = e[s]) && (i = n(i) || i);
|
|
672
672
|
return i;
|
|
673
673
|
};
|
|
674
|
-
const V = "board-model",
|
|
675
|
-
const { type: r, name:
|
|
676
|
-
t.type = r, t.name =
|
|
674
|
+
const V = "board-model", De = (e, t) => {
|
|
675
|
+
const { type: r, name: a, path: i, linked: s, instanceId: n, link: l, ...c } = e;
|
|
676
|
+
t.type = r, t.name = a, t.path = i, t.linked = s, t.link = Object.freeze(l), t.instanceId = n, Object.assign(t, c);
|
|
677
677
|
};
|
|
678
678
|
g[Me].register(
|
|
679
679
|
"board",
|
|
680
|
-
|
|
680
|
+
ar
|
|
681
681
|
);
|
|
682
682
|
g[W].register(
|
|
683
683
|
"board",
|
|
684
684
|
er
|
|
685
685
|
);
|
|
686
|
-
let
|
|
686
|
+
let ve = class {
|
|
687
687
|
constructor(e, t, r) {
|
|
688
688
|
o(this, "id");
|
|
689
689
|
o(this, "type");
|
|
@@ -692,10 +692,10 @@ let be = class {
|
|
|
692
692
|
o(this, "linked");
|
|
693
693
|
o(this, "instanceId");
|
|
694
694
|
o(this, "logger");
|
|
695
|
-
this.id = e, this.logger = r.logger,
|
|
695
|
+
this.id = e, this.logger = r.logger, De(t, this);
|
|
696
696
|
}
|
|
697
697
|
updateModel(e) {
|
|
698
|
-
|
|
698
|
+
De(e, this);
|
|
699
699
|
}
|
|
700
700
|
// -------------------LIFECYCLE----------------------------
|
|
701
701
|
async init() {
|
|
@@ -705,19 +705,19 @@ let be = class {
|
|
|
705
705
|
this.logger.debug(`loading board ${this.id}`);
|
|
706
706
|
}
|
|
707
707
|
};
|
|
708
|
-
|
|
708
|
+
ve = nr([
|
|
709
709
|
I(V)
|
|
710
|
-
],
|
|
710
|
+
], ve);
|
|
711
711
|
const et = {
|
|
712
712
|
registration: {
|
|
713
713
|
[V]: {
|
|
714
|
-
class:
|
|
714
|
+
class: ve,
|
|
715
715
|
singleton: !1
|
|
716
716
|
}
|
|
717
717
|
},
|
|
718
718
|
type: V,
|
|
719
|
-
predicate:
|
|
720
|
-
factory:
|
|
719
|
+
predicate: P(V),
|
|
720
|
+
factory: v.Factory.create(V)
|
|
721
721
|
}, tt = {
|
|
722
722
|
registration: {
|
|
723
723
|
[H]: {
|
|
@@ -727,17 +727,17 @@ const et = {
|
|
|
727
727
|
...et.registration
|
|
728
728
|
},
|
|
729
729
|
type: H,
|
|
730
|
-
predicate:
|
|
731
|
-
factory:
|
|
730
|
+
predicate: P(H),
|
|
731
|
+
factory: v.Singleton.create(
|
|
732
732
|
H
|
|
733
733
|
)
|
|
734
734
|
};
|
|
735
|
-
var or = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, Ie = (e, t, r,
|
|
736
|
-
for (var i =
|
|
737
|
-
(n = e[
|
|
738
|
-
return
|
|
735
|
+
var or = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, Ie = (e, t, r, a) => {
|
|
736
|
+
for (var i = a > 1 ? void 0 : a ? dr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
737
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
738
|
+
return a && i && or(t, r, i), i;
|
|
739
739
|
};
|
|
740
|
-
const k =
|
|
740
|
+
const k = z.HolderContainer, lr = "/kos/insertion/insert/start", cr = "/kos/insertion/insert/complete", pr = "/kos/insertion/insert/update", ur = "/kos/insertion/remove", gr = "/kos/pumpEvent/replaceLine", hr = "/kos/handle/*";
|
|
741
741
|
let A = class {
|
|
742
742
|
constructor(e, t, r) {
|
|
743
743
|
o(this, "id");
|
|
@@ -745,7 +745,7 @@ let A = class {
|
|
|
745
745
|
o(this, "logger");
|
|
746
746
|
this.id = e, this.holders = new R({
|
|
747
747
|
indexMap: {
|
|
748
|
-
nozzle: (
|
|
748
|
+
nozzle: (a) => a.nozzlePaths,
|
|
749
749
|
group: "group"
|
|
750
750
|
},
|
|
751
751
|
parentId: e,
|
|
@@ -755,28 +755,28 @@ let A = class {
|
|
|
755
755
|
updateModel() {
|
|
756
756
|
}
|
|
757
757
|
handleHolderEvents(e) {
|
|
758
|
-
var r,
|
|
759
|
-
|
|
758
|
+
var r, a, i;
|
|
759
|
+
m.ifDebug(
|
|
760
760
|
() => this.logger.debug("Received holder change event", JSON.stringify(e))
|
|
761
761
|
);
|
|
762
762
|
const t = this.holders.getModel(e.path);
|
|
763
763
|
t && (this.logger.info(
|
|
764
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 = (
|
|
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
766
|
}
|
|
767
767
|
handleInsertion(e) {
|
|
768
|
-
|
|
768
|
+
m.ifDebug(
|
|
769
769
|
() => this.logger.debug("Received insertion event", JSON.stringify(e))
|
|
770
770
|
), (Array.isArray(e) ? e : [e]).forEach((r) => {
|
|
771
771
|
h(() => {
|
|
772
|
-
var
|
|
773
|
-
const
|
|
772
|
+
var s, n, l;
|
|
773
|
+
const a = r.ingredientId, i = this.holders.getModel(r.path);
|
|
774
774
|
i && (this.logger.info(
|
|
775
775
|
`Received insertion event for holder ${i.path}`
|
|
776
|
-
), i.updateIngredient(
|
|
776
|
+
), 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, (l = r == null ? void 0 : r.container) != null && l.enjoyByDate ? i.enjoyByDate = new Date(r.container.enjoyByDate) : i.enjoyByDate = void 0, r.pumps.forEach((c) => {
|
|
777
777
|
h(() => {
|
|
778
|
-
const p = i.pumps.getModel(
|
|
779
|
-
p && (p.ingredientId =
|
|
778
|
+
const p = i.pumps.getModel(c.path);
|
|
779
|
+
p && (p.ingredientId = c.ingredientId, p.inserted = c.inserted, p.prevIngredientId = c.prevIngredientId);
|
|
780
780
|
});
|
|
781
781
|
}));
|
|
782
782
|
});
|
|
@@ -817,54 +817,54 @@ const rt = {
|
|
|
817
817
|
}
|
|
818
818
|
},
|
|
819
819
|
type: k,
|
|
820
|
-
predicate:
|
|
821
|
-
factory:
|
|
820
|
+
predicate: P(k),
|
|
821
|
+
factory: v.Singleton.create(
|
|
822
822
|
k
|
|
823
823
|
)
|
|
824
|
-
}, yr =
|
|
825
|
-
const t = await
|
|
824
|
+
}, yr = m.createLogger({ name: "board-utils" }), Ir = async (e) => {
|
|
825
|
+
const t = await T.executeDataMapperExtension({
|
|
826
826
|
extension: u.BoardMapper,
|
|
827
827
|
data: e,
|
|
828
828
|
contextData: {}
|
|
829
|
-
}), { type: r, name:
|
|
829
|
+
}), { type: r, name: a, path: i, linked: s, instanceId: n, ...l } = e, c = { ...l, ...t }, p = {
|
|
830
830
|
type: r,
|
|
831
|
-
name:
|
|
831
|
+
name: a,
|
|
832
832
|
path: i,
|
|
833
|
-
linked:
|
|
833
|
+
linked: s,
|
|
834
834
|
instanceId: n,
|
|
835
|
-
...
|
|
835
|
+
...c
|
|
836
836
|
}, y = et.factory(e.path)(p);
|
|
837
837
|
return y.updateModel(p), y;
|
|
838
|
-
},
|
|
838
|
+
}, fr = (e) => async (t) => {
|
|
839
839
|
yr.debug(`adding board ${t.name}`);
|
|
840
840
|
const r = await Ir(t);
|
|
841
841
|
e.addModel(r);
|
|
842
842
|
};
|
|
843
843
|
var d = /* @__PURE__ */ ((e) => (e.IDLE = "IDLE", e.POURING = "POURING", e.POUR_STARTING = "POUR_STARTING", e.POUR_CANCELING = "POUR_CANCELING", e.POUR_CANCELED = "POUR_CANCELED", e.POUR_COMPLETE = "POUR_COMPLETE", e))(d || {});
|
|
844
|
-
const { URL: Ee } = S("PUMP_SERVICE"), { postModel:
|
|
844
|
+
const { URL: Ee } = S("PUMP_SERVICE"), { postModel: mr, getOne: br } = C.build({
|
|
845
845
|
basePath: `${Ee}/api/kos/holders`
|
|
846
846
|
});
|
|
847
|
-
|
|
847
|
+
m.createLogger({
|
|
848
848
|
name: "pump-service",
|
|
849
849
|
group: "Services"
|
|
850
850
|
});
|
|
851
|
-
const
|
|
851
|
+
const vr = async ({
|
|
852
852
|
intent: e,
|
|
853
853
|
pumpId: t,
|
|
854
854
|
tracker: r
|
|
855
855
|
}) => {
|
|
856
|
-
const
|
|
856
|
+
const a = `${Ee}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${t}/${e}`, i = await mr({ model: {}, urlOverride: a, tracker: r });
|
|
857
857
|
return i != null && i.data && pe.initiateFuture(i.data), i;
|
|
858
|
-
},
|
|
859
|
-
const r = `${Ee}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`,
|
|
860
|
-
return
|
|
858
|
+
}, Pr = async (e, t) => {
|
|
859
|
+
const r = `${Ee}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`, a = await br({ urlOverride: r });
|
|
860
|
+
return a != null && a.data ? a.data : { volume: -1 };
|
|
861
861
|
};
|
|
862
|
-
var _r = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, we = (e, t, r,
|
|
863
|
-
for (var i =
|
|
864
|
-
(n = e[
|
|
865
|
-
return
|
|
862
|
+
var _r = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, we = (e, t, r, a) => {
|
|
863
|
+
for (var i = a > 1 ? void 0 : a ? Mr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
864
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
865
|
+
return a && i && _r(t, r, i), i;
|
|
866
866
|
};
|
|
867
|
-
const Y =
|
|
867
|
+
const Y = z.Pump;
|
|
868
868
|
g[Me].register(
|
|
869
869
|
"pump",
|
|
870
870
|
ir
|
|
@@ -889,30 +889,30 @@ let q = class {
|
|
|
889
889
|
this.id = e;
|
|
890
890
|
const {
|
|
891
891
|
inserted: r,
|
|
892
|
-
holderPath:
|
|
892
|
+
holderPath: a,
|
|
893
893
|
boardPath: i,
|
|
894
|
-
nozzlePath:
|
|
894
|
+
nozzlePath: s,
|
|
895
895
|
name: n,
|
|
896
|
-
path:
|
|
897
|
-
childPump:
|
|
896
|
+
path: l,
|
|
897
|
+
childPump: c,
|
|
898
898
|
virtual: p,
|
|
899
899
|
prevIngredientId: y,
|
|
900
900
|
...U
|
|
901
901
|
} = t;
|
|
902
|
-
this.inserted = r, this.type = t.type, this.ingredientId = t.ingredientId, this.holderPath =
|
|
902
|
+
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 = l, this.childPump = !!c, this.virtual = !!p, this.prevIngredientId = y, Object.assign(this, U), this.futureHandler = new Ge(this);
|
|
903
903
|
}
|
|
904
904
|
updateModel(e) {
|
|
905
905
|
const {
|
|
906
906
|
inserted: t,
|
|
907
907
|
holderPath: r,
|
|
908
|
-
boardPath:
|
|
908
|
+
boardPath: a,
|
|
909
909
|
nozzlePath: i,
|
|
910
|
-
childPump:
|
|
910
|
+
childPump: s,
|
|
911
911
|
name: n,
|
|
912
|
-
path:
|
|
913
|
-
...
|
|
912
|
+
path: l,
|
|
913
|
+
...c
|
|
914
914
|
} = e;
|
|
915
|
-
this.inserted = t, this.type = e.type, this.ingredientId = e.ingredientId, this.holderPath = r, this.boardPath =
|
|
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 : !!s, this.name = n, this.path = l, this.prevIngredientId = e.prevIngredientId, Object.assign(this, c);
|
|
916
916
|
}
|
|
917
917
|
// -------------------LIFECYCLE----------------------------
|
|
918
918
|
get troubles() {
|
|
@@ -947,13 +947,13 @@ let q = class {
|
|
|
947
947
|
var e;
|
|
948
948
|
this.currentState === d.POURING || this.currentState === d.POUR_STARTING ? (this.currentState = d.POUR_CANCELING, await ((e = this.future) == null ? void 0 : e.cancelFuture()), h(() => {
|
|
949
949
|
this.currentState = d.IDLE;
|
|
950
|
-
})) :
|
|
950
|
+
})) : m.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
951
951
|
}
|
|
952
952
|
get future() {
|
|
953
953
|
return this.futureHandler.future;
|
|
954
954
|
}
|
|
955
955
|
async resolveIntentVolume(e) {
|
|
956
|
-
return await
|
|
956
|
+
return await Pr(this.path, e);
|
|
957
957
|
}
|
|
958
958
|
async performIntent(e, t) {
|
|
959
959
|
const r = typeof e == "string" ? e : e.intent;
|
|
@@ -963,18 +963,18 @@ let q = class {
|
|
|
963
963
|
if (this.currentState === d.IDLE) {
|
|
964
964
|
if (this.currentState = d.POUR_STARTING, !t)
|
|
965
965
|
throw new Error("No tracker provided");
|
|
966
|
-
const
|
|
966
|
+
const a = await vr({
|
|
967
967
|
tracker: t,
|
|
968
968
|
intent: r,
|
|
969
969
|
pumpId: this.path
|
|
970
970
|
});
|
|
971
971
|
return this.currentState === d.POUR_STARTING && h(() => {
|
|
972
972
|
this.currentState = d.POURING;
|
|
973
|
-
}),
|
|
973
|
+
}), a == null ? void 0 : a.data;
|
|
974
974
|
} else
|
|
975
975
|
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
976
|
-
} catch (
|
|
977
|
-
throw
|
|
976
|
+
} catch (a) {
|
|
977
|
+
throw m.error(a), this.currentState = d.IDLE, a;
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
// -------------------ENTITY----------------------------
|
|
@@ -996,10 +996,10 @@ const it = {
|
|
|
996
996
|
}
|
|
997
997
|
},
|
|
998
998
|
type: Y,
|
|
999
|
-
predicate:
|
|
1000
|
-
factory:
|
|
1001
|
-
}, Or =
|
|
1002
|
-
const r = (t.pumps ?? []).length > 1,
|
|
999
|
+
predicate: P(Y),
|
|
1000
|
+
factory: v.Factory.create(Y)
|
|
1001
|
+
}, Or = m.createLogger({ name: "pump-utils" }), Er = (e, t) => {
|
|
1002
|
+
const r = (t.pumps ?? []).length > 1, a = {
|
|
1003
1003
|
boardPath: t.boardPath,
|
|
1004
1004
|
holderPath: t.holderPath,
|
|
1005
1005
|
ingredientId: t.ingredientId,
|
|
@@ -1011,28 +1011,28 @@ const it = {
|
|
|
1011
1011
|
type: t.type,
|
|
1012
1012
|
nozzlePath: e,
|
|
1013
1013
|
prevIngredientId: t.prevIngredientId
|
|
1014
|
-
}, i = it.factory(t.path)(
|
|
1015
|
-
return i.updateModel(
|
|
1016
|
-
},
|
|
1017
|
-
var
|
|
1018
|
-
Or.debug(`adding pump ${
|
|
1019
|
-
const i = Er(r.path,
|
|
1014
|
+
}, i = it.factory(t.path)(a);
|
|
1015
|
+
return i.updateModel(a), i;
|
|
1016
|
+
}, at = (e) => (t) => (r) => (a) => {
|
|
1017
|
+
var l;
|
|
1018
|
+
Or.debug(`adding pump ${a.name}`);
|
|
1019
|
+
const i = Er(r.path, a);
|
|
1020
1020
|
e.addModel(i);
|
|
1021
|
-
const
|
|
1022
|
-
n == null || n.pumps.addModel(i), n != null && n.nozzlePaths.includes(r.path) || n == null || n.nozzlePaths.push(r.path), (
|
|
1021
|
+
const s = i.holderPath, n = t.holders.getModel(s);
|
|
1022
|
+
n == null || n.pumps.addModel(i), n != null && n.nozzlePaths.includes(r.path) || n == null || n.nozzlePaths.push(r.path), (l = a == null ? void 0 : a.pumps) == null || l.forEach((c) => {
|
|
1023
1023
|
const p = i.holderPath, y = {
|
|
1024
|
-
...
|
|
1024
|
+
...c,
|
|
1025
1025
|
childPump: !0,
|
|
1026
1026
|
holderPath: p,
|
|
1027
1027
|
ingredientId: i.ingredientId
|
|
1028
1028
|
};
|
|
1029
|
-
|
|
1029
|
+
at(e)(t)(r)(y);
|
|
1030
1030
|
});
|
|
1031
1031
|
};
|
|
1032
|
-
var wr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, ee = (e, t, r,
|
|
1033
|
-
for (var i =
|
|
1034
|
-
(n = e[
|
|
1035
|
-
return
|
|
1032
|
+
var wr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, ee = (e, t, r, a) => {
|
|
1033
|
+
for (var i = a > 1 ? void 0 : a ? $r(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1034
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1035
|
+
return a && i && wr(t, r, i), i;
|
|
1036
1036
|
};
|
|
1037
1037
|
const Z = "assembly-model", Sr = "assembly-data", Cr = "assembly-raw-data";
|
|
1038
1038
|
let w = class {
|
|
@@ -1096,44 +1096,44 @@ let w = class {
|
|
|
1096
1096
|
this.logger.debug(`loading assembly ${this.id}`);
|
|
1097
1097
|
const t = await Ze();
|
|
1098
1098
|
if ((t == null ? void 0 : t.status) === 200) {
|
|
1099
|
-
const r = await
|
|
1099
|
+
const r = await T.executeDataMapperExtension({
|
|
1100
1100
|
extension: u.AssemblyMapper,
|
|
1101
1101
|
data: t.data,
|
|
1102
1102
|
contextData: {}
|
|
1103
1103
|
});
|
|
1104
|
-
e.set(Sr, r), Object.assign(this, r), Object.entries(r).forEach(([
|
|
1105
|
-
yt(i) && (this.logger.debug(`adding child model ${
|
|
1104
|
+
e.set(Sr, r), Object.assign(this, r), Object.entries(r).forEach(([a, i]) => {
|
|
1105
|
+
yt(i) && (this.logger.debug(`adding child model ${a} from extension data`), this[It][a] = !0);
|
|
1106
1106
|
}), e.set(Cr, t.data);
|
|
1107
|
-
for await (const
|
|
1107
|
+
for await (const a of t.data.assemblies) {
|
|
1108
1108
|
const {
|
|
1109
1109
|
boards: i = [],
|
|
1110
|
-
holders:
|
|
1110
|
+
holders: s = {},
|
|
1111
1111
|
nozzles: n = [],
|
|
1112
|
-
core:
|
|
1113
|
-
name:
|
|
1112
|
+
core: l,
|
|
1113
|
+
name: c,
|
|
1114
1114
|
path: p,
|
|
1115
1115
|
...y
|
|
1116
|
-
} =
|
|
1117
|
-
this.logger.debug(`adding assembly ${
|
|
1118
|
-
|
|
1116
|
+
} = a;
|
|
1117
|
+
this.logger.debug(`adding assembly ${c}`), Object.keys(y).forEach((f) => {
|
|
1118
|
+
ft.enableFeature(f);
|
|
1119
1119
|
});
|
|
1120
|
-
for await (const
|
|
1121
|
-
this.logger.debug(`adding board ${
|
|
1122
|
-
for await (const [
|
|
1123
|
-
|
|
1120
|
+
for await (const f of i)
|
|
1121
|
+
this.logger.debug(`adding board ${f.name}`), await fr(this.boardContainer)(f);
|
|
1122
|
+
for await (const [f, D] of Object.entries(
|
|
1123
|
+
s ?? {}
|
|
1124
1124
|
))
|
|
1125
|
-
for await (const re of
|
|
1125
|
+
for await (const re of D) {
|
|
1126
1126
|
this.logger.debug(`adding holder ${re.name}`);
|
|
1127
|
-
const Ce = await Zt(
|
|
1127
|
+
const Ce = await Zt(f, re);
|
|
1128
1128
|
this.holderContainer.holders.addModel(Ce);
|
|
1129
1129
|
}
|
|
1130
|
-
const U =
|
|
1130
|
+
const U = at(this.pumpContainer)(
|
|
1131
1131
|
this.holderContainer
|
|
1132
1132
|
);
|
|
1133
|
-
n.forEach((
|
|
1134
|
-
this._nozzlePaths.add(
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1133
|
+
n.forEach((f) => {
|
|
1134
|
+
this._nozzlePaths.add(f.path);
|
|
1135
|
+
const D = U(f);
|
|
1136
|
+
f.pumps.forEach(D);
|
|
1137
1137
|
});
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
@@ -1156,7 +1156,7 @@ ee([
|
|
|
1156
1156
|
w = ee([
|
|
1157
1157
|
I(Z)
|
|
1158
1158
|
], w);
|
|
1159
|
-
const
|
|
1159
|
+
const st = {
|
|
1160
1160
|
registration: {
|
|
1161
1161
|
[Z]: {
|
|
1162
1162
|
class: w,
|
|
@@ -1164,16 +1164,16 @@ const at = {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
},
|
|
1166
1166
|
type: Z,
|
|
1167
|
-
predicate:
|
|
1168
|
-
factory:
|
|
1167
|
+
predicate: P(Z),
|
|
1168
|
+
factory: v.Singleton.create(Z)
|
|
1169
1169
|
};
|
|
1170
|
-
var Rr = Object.getOwnPropertyDescriptor,
|
|
1171
|
-
for (var i =
|
|
1172
|
-
(n = e[
|
|
1170
|
+
var Rr = Object.getOwnPropertyDescriptor, zr = (e, t, r, a) => {
|
|
1171
|
+
for (var i = a > 1 ? void 0 : a ? Rr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1172
|
+
(n = e[s]) && (i = n(i) || i);
|
|
1173
1173
|
return i;
|
|
1174
1174
|
};
|
|
1175
|
-
const X =
|
|
1176
|
-
let
|
|
1175
|
+
const X = z.Availability;
|
|
1176
|
+
let Pe = class {
|
|
1177
1177
|
constructor(e, t, r) {
|
|
1178
1178
|
o(this, "id");
|
|
1179
1179
|
o(this, "data");
|
|
@@ -1199,25 +1199,25 @@ let ve = class {
|
|
|
1199
1199
|
// -------------------LIFECYCLE----------------------------
|
|
1200
1200
|
// -------------------ENTITY----------------------------
|
|
1201
1201
|
};
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
Pe = zr([
|
|
1203
|
+
mt(),
|
|
1204
1204
|
I(X)
|
|
1205
|
-
],
|
|
1205
|
+
], Pe);
|
|
1206
1206
|
const _e = {
|
|
1207
1207
|
registration: {
|
|
1208
1208
|
[X]: {
|
|
1209
|
-
class:
|
|
1209
|
+
class: Pe,
|
|
1210
1210
|
singleton: !1
|
|
1211
1211
|
}
|
|
1212
1212
|
},
|
|
1213
1213
|
type: X,
|
|
1214
|
-
predicate:
|
|
1215
|
-
factory:
|
|
1214
|
+
predicate: P(X),
|
|
1215
|
+
factory: v.Factory.create(
|
|
1216
1216
|
X
|
|
1217
1217
|
)
|
|
1218
|
-
}, { URL: B } = S("NOZZLE_SERVICE"), { postModel: $e, deleteModel:
|
|
1218
|
+
}, { URL: B } = S("NOZZLE_SERVICE"), { postModel: $e, deleteModel: Dr, getOne: Tr } = C.build({
|
|
1219
1219
|
basePath: `${B}/api/nozzle`
|
|
1220
|
-
}),
|
|
1220
|
+
}), Nr = async (e, t) => {
|
|
1221
1221
|
const r = await $e({
|
|
1222
1222
|
model: {},
|
|
1223
1223
|
urlOverride: `${B}/api/ext/dispense/nozzle/${e}/pipeline/beverage/pour`,
|
|
@@ -1226,30 +1226,30 @@ const _e = {
|
|
|
1226
1226
|
});
|
|
1227
1227
|
return r != null && r.data && pe.initiateFuture(r.data), r;
|
|
1228
1228
|
}, Lr = async (e, t, r) => {
|
|
1229
|
-
const
|
|
1229
|
+
const a = await $e({
|
|
1230
1230
|
model: {},
|
|
1231
1231
|
urlOverride: `${B}/api/ext/dispense/nozzle/${t}/pipeline/beverage/fixed/${e}`,
|
|
1232
1232
|
ordered: !0,
|
|
1233
1233
|
tracker: r
|
|
1234
1234
|
});
|
|
1235
|
-
return
|
|
1236
|
-
}, xr = async (e) => await
|
|
1235
|
+
return a != null && a.data && pe.initiateFuture(a.data), a;
|
|
1236
|
+
}, xr = async (e) => await Tr({
|
|
1237
1237
|
urlOverride: `${B}${e}/pipeline/beverage/availability`
|
|
1238
1238
|
}), Ar = async (e, t) => await $e({
|
|
1239
1239
|
model: t,
|
|
1240
1240
|
urlOverride: `${B}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1241
|
-
}), Br = async (e) => await
|
|
1241
|
+
}), Br = async (e) => await Dr({
|
|
1242
1242
|
id: e,
|
|
1243
1243
|
urlOverride: `${B}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
|
|
1244
1244
|
});
|
|
1245
|
-
var Ur = Object.defineProperty, Gr = Object.getOwnPropertyDescriptor, te = (e, t, r,
|
|
1246
|
-
for (var i =
|
|
1247
|
-
(n = e[
|
|
1248
|
-
return
|
|
1245
|
+
var Ur = Object.defineProperty, Gr = Object.getOwnPropertyDescriptor, te = (e, t, r, a) => {
|
|
1246
|
+
for (var i = a > 1 ? void 0 : a ? Gr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1247
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1248
|
+
return a && i && Ur(t, r, i), i;
|
|
1249
1249
|
};
|
|
1250
|
-
const J =
|
|
1250
|
+
const J = z.Nozzle, jr = bt(
|
|
1251
1251
|
"beverageTopicPrefix"
|
|
1252
|
-
), ie = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0,
|
|
1252
|
+
), ie = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0, Te = "/kos/nozzle/pour/started", Fr = "/kos/nozzle/pour/progress", fe = "/kos/nozzle/pour/cancel";
|
|
1253
1253
|
let $ = class {
|
|
1254
1254
|
constructor(e, t, r) {
|
|
1255
1255
|
/** the unique identifier for this nozzle.*/
|
|
@@ -1266,7 +1266,7 @@ let $ = class {
|
|
|
1266
1266
|
o(this, "beverageTopicPrefix");
|
|
1267
1267
|
o(this, "topicPrefix");
|
|
1268
1268
|
o(this, "urlPrefix");
|
|
1269
|
-
this.id = e, this.path = t.path, this.name = t.name, this.beverageTopicPrefix = t.beverageTopicPrefix, this.topicPrefix = t.topicPrefix, this.urlPrefix = t.urlPrefix, this._selectedBeverage = void 0, this._selectedBrand = void 0, this._additionalItems = [], this.futureHandler = new
|
|
1269
|
+
this.id = e, this.path = t.path, this.name = t.name, this.beverageTopicPrefix = t.beverageTopicPrefix, this.topicPrefix = t.topicPrefix, this.urlPrefix = t.urlPrefix, this._selectedBeverage = void 0, this._selectedBrand = void 0, this._additionalItems = [], this.futureHandler = new vt(this), this._availabilityItems = new R({
|
|
1270
1270
|
indexMap: {
|
|
1271
1271
|
byGroup: "groupId",
|
|
1272
1272
|
byParent: "parentId"
|
|
@@ -1358,18 +1358,18 @@ let $ = class {
|
|
|
1358
1358
|
context: r
|
|
1359
1359
|
}) {
|
|
1360
1360
|
if (!e) {
|
|
1361
|
-
const
|
|
1362
|
-
if ((
|
|
1361
|
+
const l = await Br(this.name);
|
|
1362
|
+
if ((l == null ? void 0 : l.status) !== 200)
|
|
1363
1363
|
throw new Error("Failed to clear pourable");
|
|
1364
1364
|
this._selectedBeverage = void 0;
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
1367
|
-
if (e === this._selectedBeverage &&
|
|
1367
|
+
if (e === this._selectedBeverage && Pt(this._additionalItems, t)) {
|
|
1368
1368
|
this.logger.info("No change in selected pourable");
|
|
1369
1369
|
return;
|
|
1370
1370
|
}
|
|
1371
1371
|
this._selectedBeverage = e, this._additionalItems = t;
|
|
1372
|
-
let
|
|
1372
|
+
let a = await g.dataMapper.executeMapper(
|
|
1373
1373
|
u.SelectedPourableMapper,
|
|
1374
1374
|
{
|
|
1375
1375
|
beverage: e,
|
|
@@ -1380,10 +1380,10 @@ let $ = class {
|
|
|
1380
1380
|
const i = {
|
|
1381
1381
|
bevId: e.rawId
|
|
1382
1382
|
};
|
|
1383
|
-
(!
|
|
1383
|
+
(!a || Object.keys(a).length === 0) && (this.logger.info(
|
|
1384
1384
|
`No selected pourable mapper defined, using the default payload ${i}`
|
|
1385
|
-
),
|
|
1386
|
-
const
|
|
1385
|
+
), a = i);
|
|
1386
|
+
const s = a ?? i, n = await Ar(this.name, s);
|
|
1387
1387
|
if ((n == null ? void 0 : n.status) !== 200)
|
|
1388
1388
|
throw new Error("Failed to select pourable");
|
|
1389
1389
|
}
|
|
@@ -1423,8 +1423,8 @@ let $ = class {
|
|
|
1423
1423
|
});
|
|
1424
1424
|
}
|
|
1425
1425
|
onFutureUpdate(e) {
|
|
1426
|
-
E(this).forEach((
|
|
1427
|
-
ie(
|
|
1426
|
+
E(this).forEach((a) => {
|
|
1427
|
+
ie(a) && a.onPourProgress(e);
|
|
1428
1428
|
});
|
|
1429
1429
|
const r = {
|
|
1430
1430
|
nozzleId: this.id,
|
|
@@ -1447,21 +1447,21 @@ let $ = class {
|
|
|
1447
1447
|
if (this.currentState === d.IDLE) {
|
|
1448
1448
|
if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
|
|
1449
1449
|
throw new Error("No tracker provided");
|
|
1450
|
-
const r = await
|
|
1450
|
+
const r = await Nr(this.name, e);
|
|
1451
1451
|
this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
|
|
1452
|
-
var
|
|
1453
|
-
ie(i) && ((
|
|
1452
|
+
var s;
|
|
1453
|
+
ie(i) && ((s = i.onPourStart) == null || s.call(i));
|
|
1454
1454
|
});
|
|
1455
|
-
const
|
|
1455
|
+
const a = {
|
|
1456
1456
|
nozzleId: this.id,
|
|
1457
1457
|
type: "free"
|
|
1458
1458
|
};
|
|
1459
|
-
if (_.publish(
|
|
1459
|
+
if (_.publish(Te, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
|
|
1460
1460
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1461
1461
|
const i = {
|
|
1462
1462
|
nozzleId: this.id
|
|
1463
1463
|
};
|
|
1464
|
-
_.publish(
|
|
1464
|
+
_.publish(fe, i);
|
|
1465
1465
|
}
|
|
1466
1466
|
return r;
|
|
1467
1467
|
} else
|
|
@@ -1476,29 +1476,29 @@ let $ = class {
|
|
|
1476
1476
|
if (this.currentState === d.IDLE) {
|
|
1477
1477
|
if (this.currentState = d.POUR_STARTING, !t)
|
|
1478
1478
|
throw new Error("No tracker provided");
|
|
1479
|
-
const
|
|
1479
|
+
const a = await Lr(e, this.name, t);
|
|
1480
1480
|
this.currentState === d.POUR_STARTING && h(() => {
|
|
1481
1481
|
this.currentState = d.POURING;
|
|
1482
|
-
}), E(this).forEach((
|
|
1482
|
+
}), E(this).forEach((s) => {
|
|
1483
1483
|
var n;
|
|
1484
|
-
ie(
|
|
1484
|
+
ie(s) && ((n = s.onPourStart) == null || n.call(s));
|
|
1485
1485
|
});
|
|
1486
1486
|
const i = {
|
|
1487
1487
|
nozzleId: this.id,
|
|
1488
1488
|
type: "fixed"
|
|
1489
1489
|
};
|
|
1490
|
-
if (_.publish(
|
|
1490
|
+
if (_.publish(Te, i), (r = a == null ? void 0 : a.data) != null && r.endState) {
|
|
1491
1491
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1492
|
-
const
|
|
1492
|
+
const s = {
|
|
1493
1493
|
nozzleId: this.id
|
|
1494
1494
|
};
|
|
1495
|
-
_.publish(
|
|
1495
|
+
_.publish(fe, s);
|
|
1496
1496
|
}
|
|
1497
|
-
return
|
|
1497
|
+
return a;
|
|
1498
1498
|
} else
|
|
1499
1499
|
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1500
|
-
} catch (
|
|
1501
|
-
throw this.logger.error(
|
|
1500
|
+
} catch (a) {
|
|
1501
|
+
throw this.logger.error(a), this.currentState = d.IDLE, a;
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
1504
|
/**
|
|
@@ -1510,29 +1510,29 @@ let $ = class {
|
|
|
1510
1510
|
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), h(() => {
|
|
1511
1511
|
this.currentState = d.IDLE;
|
|
1512
1512
|
}), E(this).forEach((r) => {
|
|
1513
|
-
var
|
|
1514
|
-
ie(r) && ((
|
|
1513
|
+
var a;
|
|
1514
|
+
ie(r) && ((a = r.onPourCancel) == null || a.call(r));
|
|
1515
1515
|
});
|
|
1516
1516
|
const t = {
|
|
1517
1517
|
nozzleId: this.id
|
|
1518
1518
|
};
|
|
1519
|
-
_.publish(
|
|
1519
|
+
_.publish(fe, t);
|
|
1520
1520
|
} else
|
|
1521
1521
|
this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1522
1522
|
}
|
|
1523
1523
|
updateGroupMembers() {
|
|
1524
1524
|
this._availabilityItems.data.forEach((e) => {
|
|
1525
1525
|
(e.taggedIds || []).forEach((r) => {
|
|
1526
|
-
const
|
|
1526
|
+
const a = this._availabilityItems.data.find(
|
|
1527
1527
|
(i) => i.rawId === r
|
|
1528
1528
|
);
|
|
1529
|
-
|
|
1529
|
+
a && a.parentId !== e.id && (a.parentId = e.id, this._availabilityItems.updateModel(a));
|
|
1530
1530
|
});
|
|
1531
1531
|
});
|
|
1532
1532
|
}
|
|
1533
1533
|
/** @internal */
|
|
1534
1534
|
async load(e) {
|
|
1535
|
-
var
|
|
1535
|
+
var a, i;
|
|
1536
1536
|
this.logger.debug(`loading nozzle ${this.id}`);
|
|
1537
1537
|
const t = await xr(this.urlPrefix);
|
|
1538
1538
|
if ((t == null ? void 0 : t.status) !== 200)
|
|
@@ -1542,87 +1542,103 @@ let $ = class {
|
|
|
1542
1542
|
{}
|
|
1543
1543
|
);
|
|
1544
1544
|
e == null || e.set(u.AvailabilityLoader, r), e == null || e.set(Se.type, this);
|
|
1545
|
-
for (const
|
|
1546
|
-
for (const n of ((i = t.data) == null ? void 0 : i.groups[
|
|
1547
|
-
const
|
|
1545
|
+
for (const s of Object.keys((a = t.data) == null ? void 0 : a.groups) || [])
|
|
1546
|
+
for (const n of ((i = t.data) == null ? void 0 : i.groups[s]) || []) {
|
|
1547
|
+
const l = await g.dataMapper.executeMapper(
|
|
1548
1548
|
u.AvailabilityMapper,
|
|
1549
|
-
{ ...n, groupId:
|
|
1549
|
+
{ ...n, groupId: s },
|
|
1550
1550
|
r
|
|
1551
|
-
),
|
|
1551
|
+
), c = {
|
|
1552
1552
|
...n,
|
|
1553
1553
|
note: n.note ?? void 0,
|
|
1554
1554
|
kosParentId: this.id,
|
|
1555
1555
|
rawId: n.id,
|
|
1556
|
-
groupId:
|
|
1557
|
-
data:
|
|
1556
|
+
groupId: s,
|
|
1557
|
+
data: l,
|
|
1558
1558
|
properties: n.properties || {}
|
|
1559
1559
|
}, p = _e.factory(
|
|
1560
|
-
`${this.id}-${
|
|
1561
|
-
)(
|
|
1560
|
+
`${this.id}-${s}-${n.id}`
|
|
1561
|
+
)(c);
|
|
1562
1562
|
this._availabilityItems.addModel(p);
|
|
1563
1563
|
}
|
|
1564
1564
|
this.updateGroupMembers();
|
|
1565
1565
|
}
|
|
1566
1566
|
async updateAvailability(e) {
|
|
1567
1567
|
const t = _t.getContext(this.id), r = (t == null ? void 0 : t.get(u.AvailabilityLoader)) || {};
|
|
1568
|
-
if (e.rebuild)
|
|
1569
|
-
|
|
1570
|
-
this.
|
|
1571
|
-
|
|
1572
|
-
|
|
1568
|
+
if (e.rebuild) {
|
|
1569
|
+
this.logger.info(
|
|
1570
|
+
`Received rebuild update for nozzle ${this.path}, rebuilding entire availability set`
|
|
1571
|
+
);
|
|
1572
|
+
for (const a of Object.keys(e == null ? void 0 : e.groups) || []) {
|
|
1573
|
+
this._availabilityItems.getIndexByKey("group", a).filter(
|
|
1574
|
+
(s) => !e.groups[a].find(
|
|
1575
|
+
(n) => `${this.id}-${a}-${n.id}` === s.id
|
|
1573
1576
|
)
|
|
1574
|
-
).forEach((
|
|
1575
|
-
this.
|
|
1577
|
+
).forEach((s) => {
|
|
1578
|
+
this.logger.info(
|
|
1579
|
+
`Removing beverage ${s.id} from nozzle ${this.path} due to rebuild update`
|
|
1580
|
+
), this._availabilityItems.removeModel(s.id), Mt(s);
|
|
1576
1581
|
});
|
|
1577
|
-
for (const
|
|
1582
|
+
for (const s of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1578
1583
|
const n = await g.dataMapper.executeMapper(
|
|
1579
1584
|
u.AvailabilityMapper,
|
|
1580
|
-
{ ...
|
|
1585
|
+
{ ...s, groupId: a },
|
|
1581
1586
|
r
|
|
1582
|
-
),
|
|
1583
|
-
...
|
|
1584
|
-
note:
|
|
1587
|
+
), l = {
|
|
1588
|
+
...s,
|
|
1589
|
+
note: s.note ?? void 0,
|
|
1585
1590
|
kosParentId: this.id,
|
|
1586
|
-
groupId:
|
|
1587
|
-
rawId:
|
|
1591
|
+
groupId: a,
|
|
1592
|
+
rawId: s.id,
|
|
1588
1593
|
data: n,
|
|
1589
|
-
taggedIds:
|
|
1590
|
-
properties:
|
|
1591
|
-
},
|
|
1592
|
-
`${this.id}-${
|
|
1594
|
+
taggedIds: s.taggedIds,
|
|
1595
|
+
properties: s.properties || {}
|
|
1596
|
+
}, c = this._availabilityItems.getModel(
|
|
1597
|
+
`${this.id}-${a}-${s.id}`
|
|
1593
1598
|
);
|
|
1594
|
-
if (
|
|
1595
|
-
l.
|
|
1599
|
+
if (c)
|
|
1600
|
+
c.available !== l.available && this.logger.info(
|
|
1601
|
+
`Updating availability of beverage ${c.id} in nozzle ${this.path} to ${l.available}`
|
|
1602
|
+
), c.updateModel(l);
|
|
1596
1603
|
else {
|
|
1604
|
+
this.logger.info(
|
|
1605
|
+
`Adding beverage ${s.id} to nozzle ${this.path}`
|
|
1606
|
+
);
|
|
1597
1607
|
const p = _e.factory(
|
|
1598
|
-
`${this.id}-${
|
|
1599
|
-
)(
|
|
1608
|
+
`${this.id}-${a}-${s.id}`
|
|
1609
|
+
)(l);
|
|
1600
1610
|
this._availabilityItems.addModel(p);
|
|
1601
1611
|
}
|
|
1602
1612
|
}
|
|
1603
1613
|
}
|
|
1604
|
-
else
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1614
|
+
} else {
|
|
1615
|
+
this.logger.info(
|
|
1616
|
+
`Received delta update for nozzle ${this.path}, updating availability nodes`
|
|
1617
|
+
);
|
|
1618
|
+
for (const a of Object.keys(e == null ? void 0 : e.groups) || [])
|
|
1619
|
+
for (const i of (e == null ? void 0 : e.groups[a]) || []) {
|
|
1620
|
+
const s = await g.dataMapper.executeMapper(
|
|
1608
1621
|
u.AvailabilityMapper,
|
|
1609
|
-
{ ...i, groupId:
|
|
1622
|
+
{ ...i, groupId: a },
|
|
1610
1623
|
r
|
|
1611
1624
|
), n = {
|
|
1612
1625
|
...i,
|
|
1613
1626
|
note: i.note ?? void 0,
|
|
1614
1627
|
kosParentId: this.id,
|
|
1615
|
-
groupId:
|
|
1628
|
+
groupId: a,
|
|
1616
1629
|
rawId: i.id,
|
|
1617
|
-
data:
|
|
1630
|
+
data: s,
|
|
1618
1631
|
type: i.type,
|
|
1619
1632
|
taggedIds: i.taggedIds,
|
|
1620
1633
|
properties: i.properties || {}
|
|
1621
|
-
},
|
|
1622
|
-
`${this.id}-${
|
|
1634
|
+
}, l = this._availabilityItems.getModel(
|
|
1635
|
+
`${this.id}-${a}-${i.id}`
|
|
1623
1636
|
);
|
|
1624
|
-
|
|
1637
|
+
l && (l.available !== n.available && this.logger.info(
|
|
1638
|
+
`Updating availability of beverage ${l.id} in nozzle ${this.path} to ${n.available}`
|
|
1639
|
+
), l.updateModel(n));
|
|
1625
1640
|
}
|
|
1641
|
+
}
|
|
1626
1642
|
this.updateGroupMembers();
|
|
1627
1643
|
}
|
|
1628
1644
|
// -------------------ENTITY----------------------------
|
|
@@ -1653,13 +1669,13 @@ const Se = {
|
|
|
1653
1669
|
}
|
|
1654
1670
|
},
|
|
1655
1671
|
type: J,
|
|
1656
|
-
predicate:
|
|
1657
|
-
factory:
|
|
1672
|
+
predicate: P(J),
|
|
1673
|
+
factory: v.Factory.create(J)
|
|
1658
1674
|
};
|
|
1659
|
-
var Hr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, nt = (e, t, r,
|
|
1660
|
-
for (var i =
|
|
1661
|
-
(n = e[
|
|
1662
|
-
return
|
|
1675
|
+
var Hr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, nt = (e, t, r, a) => {
|
|
1676
|
+
for (var i = a > 1 ? void 0 : a ? Kr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1677
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1678
|
+
return a && i && Hr(t, r, i), i;
|
|
1663
1679
|
};
|
|
1664
1680
|
const ot = "device-assembly-model";
|
|
1665
1681
|
let de = class {
|
|
@@ -1684,14 +1700,14 @@ let de = class {
|
|
|
1684
1700
|
const e = await Ze();
|
|
1685
1701
|
(e == null ? void 0 : e.status) === 200 && e.data.assemblies.map((r) => r.nozzles ?? []).flat().forEach((r) => {
|
|
1686
1702
|
var n;
|
|
1687
|
-
const
|
|
1703
|
+
const a = r.path, i = ((n = r.pipelines.find((l) => l.name === "beverage")) == null ? void 0 : n.topicPrefix) || "", s = Se.factory(a)({
|
|
1688
1704
|
path: r.path,
|
|
1689
1705
|
name: r.name,
|
|
1690
1706
|
urlPrefix: r.urlPrefix,
|
|
1691
1707
|
topicPrefix: r.topicPrefix,
|
|
1692
1708
|
beverageTopicPrefix: i
|
|
1693
1709
|
});
|
|
1694
|
-
this.deviceNozzles.addModel(
|
|
1710
|
+
this.deviceNozzles.addModel(s);
|
|
1695
1711
|
});
|
|
1696
1712
|
}
|
|
1697
1713
|
};
|
|
@@ -1715,12 +1731,12 @@ const Vr = new Ot({
|
|
|
1715
1731
|
});
|
|
1716
1732
|
return r != null && r.data && pe.initiateFuture(r.data), r;
|
|
1717
1733
|
};
|
|
1718
|
-
var Zr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, lt = (e, t, r,
|
|
1719
|
-
for (var i =
|
|
1720
|
-
(n = e[
|
|
1721
|
-
return
|
|
1734
|
+
var Zr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, lt = (e, t, r, a) => {
|
|
1735
|
+
for (var i = a > 1 ? void 0 : a ? Xr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
|
|
1736
|
+
(n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
|
|
1737
|
+
return a && i && Zr(t, r, i), i;
|
|
1722
1738
|
};
|
|
1723
|
-
const ct = "generic-pour-model", Jr = "/kos/generic/pour/started", qr = "/kos/generic/pour/progress",
|
|
1739
|
+
const ct = "generic-pour-model", Jr = "/kos/generic/pour/started", qr = "/kos/generic/pour/progress", Ne = "/kos/generic/pour/cancel", me = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0;
|
|
1724
1740
|
let le = class {
|
|
1725
1741
|
constructor(e, t, r) {
|
|
1726
1742
|
o(this, "id");
|
|
@@ -1743,19 +1759,19 @@ let le = class {
|
|
|
1743
1759
|
throw new Error("No tracker provided");
|
|
1744
1760
|
const r = await Yr(this.servicePath, e);
|
|
1745
1761
|
this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
|
|
1746
|
-
var
|
|
1747
|
-
|
|
1762
|
+
var s;
|
|
1763
|
+
me(i) && ((s = i.onPourStart) == null || s.call(i));
|
|
1748
1764
|
});
|
|
1749
|
-
const
|
|
1765
|
+
const a = {
|
|
1750
1766
|
pourTarget: this.id,
|
|
1751
1767
|
type: this.pourType
|
|
1752
1768
|
};
|
|
1753
|
-
if (_.publish(Jr,
|
|
1769
|
+
if (_.publish(Jr, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
|
|
1754
1770
|
this.updateIfCurrent(d.POURING, d.IDLE);
|
|
1755
1771
|
const i = {
|
|
1756
1772
|
pourTarget: this.id
|
|
1757
1773
|
};
|
|
1758
|
-
_.publish(
|
|
1774
|
+
_.publish(Ne, i);
|
|
1759
1775
|
}
|
|
1760
1776
|
return r;
|
|
1761
1777
|
} else
|
|
@@ -1770,13 +1786,13 @@ let le = class {
|
|
|
1770
1786
|
this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), h(() => {
|
|
1771
1787
|
this.currentState = d.IDLE;
|
|
1772
1788
|
}), E(this).forEach((r) => {
|
|
1773
|
-
var
|
|
1774
|
-
|
|
1789
|
+
var a;
|
|
1790
|
+
me(r) && ((a = r.onPourCancel) == null || a.call(r));
|
|
1775
1791
|
});
|
|
1776
1792
|
const t = {
|
|
1777
1793
|
pourTarget: this.id
|
|
1778
1794
|
};
|
|
1779
|
-
_.publish(
|
|
1795
|
+
_.publish(Ne, t);
|
|
1780
1796
|
}
|
|
1781
1797
|
this.currentState === d.IDLE ? this.logger.info("Pour already idle, nothing to cancel.") : this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
|
|
1782
1798
|
}
|
|
@@ -1813,7 +1829,7 @@ let le = class {
|
|
|
1813
1829
|
}
|
|
1814
1830
|
onFutureUpdate(e) {
|
|
1815
1831
|
E(this).forEach((r) => {
|
|
1816
|
-
|
|
1832
|
+
me(r) && r.onPourProgress(e);
|
|
1817
1833
|
});
|
|
1818
1834
|
const t = {
|
|
1819
1835
|
pourTarget: this.id,
|
|
@@ -1856,7 +1872,7 @@ const ni = new Et({
|
|
|
1856
1872
|
...it.registration,
|
|
1857
1873
|
...Oe.registration,
|
|
1858
1874
|
..._e.registration,
|
|
1859
|
-
...
|
|
1875
|
+
...st.registration,
|
|
1860
1876
|
...tt.registration
|
|
1861
1877
|
}, Wr = (e) => () => ($t(e)(), Vr.register(), Object.keys(Le).forEach((t) => {
|
|
1862
1878
|
const r = Le[t];
|
|
@@ -1866,13 +1882,13 @@ const ni = new Et({
|
|
|
1866
1882
|
async (t) => {
|
|
1867
1883
|
var r;
|
|
1868
1884
|
if ((r = t.data) != null && r.deviceId) {
|
|
1869
|
-
const { model:
|
|
1870
|
-
|
|
1885
|
+
const { model: a } = N(
|
|
1886
|
+
st.type
|
|
1871
1887
|
);
|
|
1872
|
-
if (
|
|
1873
|
-
const i =
|
|
1874
|
-
(
|
|
1875
|
-
) ?
|
|
1888
|
+
if (a) {
|
|
1889
|
+
const i = a.boards.find(
|
|
1890
|
+
(s) => s.id === t.data.deviceId
|
|
1891
|
+
) ? N(t.data.deviceId).model : void 0;
|
|
1876
1892
|
return {
|
|
1877
1893
|
devices: i ? i.name : ""
|
|
1878
1894
|
};
|
|
@@ -1885,22 +1901,22 @@ const ni = new Et({
|
|
|
1885
1901
|
model: O.model.register(e),
|
|
1886
1902
|
companion: O.companion.register(e),
|
|
1887
1903
|
legacy: O.model.registerLegacyModel(e)
|
|
1888
|
-
}),
|
|
1904
|
+
}), b = {
|
|
1889
1905
|
...wt
|
|
1890
1906
|
};
|
|
1891
|
-
|
|
1892
|
-
models: Wr(
|
|
1907
|
+
b.dispense = {
|
|
1908
|
+
models: Wr(b)
|
|
1893
1909
|
};
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
const oi =
|
|
1910
|
+
b.preload = O.model.preloadModel(b);
|
|
1911
|
+
b.model = O.model.register(b);
|
|
1912
|
+
b.companion = O.companion.register(b);
|
|
1913
|
+
b.legacy = O.model.registerLegacyModel(b);
|
|
1914
|
+
const oi = b;
|
|
1899
1915
|
export {
|
|
1900
|
-
|
|
1916
|
+
st as A,
|
|
1901
1917
|
x as B,
|
|
1902
1918
|
Sr as C,
|
|
1903
|
-
D,
|
|
1919
|
+
z as D,
|
|
1904
1920
|
u as E,
|
|
1905
1921
|
xr as F,
|
|
1906
1922
|
ni as G,
|
|
@@ -1908,7 +1924,7 @@ export {
|
|
|
1908
1924
|
je as I,
|
|
1909
1925
|
Lr as J,
|
|
1910
1926
|
oi as K,
|
|
1911
|
-
|
|
1927
|
+
Nr as L,
|
|
1912
1928
|
Ar as M,
|
|
1913
1929
|
Se as N,
|
|
1914
1930
|
Yr as O,
|
|
@@ -1926,10 +1942,10 @@ export {
|
|
|
1926
1942
|
We as j,
|
|
1927
1943
|
Le as k,
|
|
1928
1944
|
d as l,
|
|
1929
|
-
|
|
1930
|
-
|
|
1945
|
+
Dt as m,
|
|
1946
|
+
ai as n,
|
|
1931
1947
|
Ut as o,
|
|
1932
|
-
|
|
1948
|
+
si as p,
|
|
1933
1949
|
ii as q,
|
|
1934
1950
|
Wr as r,
|
|
1935
1951
|
ri as s,
|
|
@@ -1937,8 +1953,8 @@ export {
|
|
|
1937
1953
|
Kt as u,
|
|
1938
1954
|
Gt as v,
|
|
1939
1955
|
Ze as w,
|
|
1940
|
-
|
|
1941
|
-
|
|
1956
|
+
Pr as x,
|
|
1957
|
+
vr as y,
|
|
1942
1958
|
Br as z
|
|
1943
1959
|
};
|
|
1944
|
-
//# sourceMappingURL=dispense-registration-manager-
|
|
1960
|
+
//# sourceMappingURL=dispense-registration-manager-B6nEgoFC.js.map
|