@kosdev-code/kos-freestyle-sdk 2.1.17 → 2.1.19

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.
Files changed (80) hide show
  1. package/extension-utils-BUUtrM-T.cjs +2 -0
  2. package/{extension-utils-BVDLwtKr.cjs.map → extension-utils-BUUtrM-T.cjs.map} +1 -1
  3. package/extension-utils-sj0P_x9E.js +220 -0
  4. package/{extension-utils-BE0Y1Zlv.js.map → extension-utils-sj0P_x9E.js.map} +1 -1
  5. package/freestyle-registration-manager-DSugLmqT.js +1739 -0
  6. package/freestyle-registration-manager-DSugLmqT.js.map +1 -0
  7. package/freestyle-registration-manager-rmrOsUZq.cjs +2 -0
  8. package/freestyle-registration-manager-rmrOsUZq.cjs.map +1 -0
  9. package/index.cjs +1 -1
  10. package/index.js +34 -27
  11. package/models/models/carb-agitator/carb-agitator-model.d.ts +38 -6
  12. package/models/models/carb-agitator/carb-agitator-model.d.ts.map +1 -1
  13. package/models/models/carb-agitator/index.d.ts +1 -1
  14. package/models/models/carb-agitator/index.d.ts.map +1 -1
  15. package/models/models/carb-agitator/services/carb-tank-services.d.ts +4 -0
  16. package/models/models/carb-agitator/services/carb-tank-services.d.ts.map +1 -0
  17. package/models/models/carb-agitator/types/index.d.ts +1 -8
  18. package/models/models/cgp-pump/cgp-pump-model.d.ts +24 -0
  19. package/models/models/cgp-pump/cgp-pump-model.d.ts.map +1 -0
  20. package/models/models/cgp-pump/index.d.ts +4 -0
  21. package/models/models/cgp-pump/index.d.ts.map +1 -0
  22. package/models/models/cgp-pump/types/index.d.ts +5 -0
  23. package/models/models/fcm-pump/fcm-pump-model.d.ts +28 -0
  24. package/models/models/fcm-pump/fcm-pump-model.d.ts.map +1 -0
  25. package/models/models/{carb-agitator/carb-agitator-registration.d.ts → fcm-pump/fcm-pump-registration.d.ts} +23 -20
  26. package/models/models/fcm-pump/fcm-pump-registration.d.ts.map +1 -0
  27. package/models/models/fcm-pump/index.d.ts +5 -0
  28. package/models/models/fcm-pump/index.d.ts.map +1 -0
  29. package/models/models/fcm-pump/services/fcm-pump-services.d.ts +17 -0
  30. package/models/models/fcm-pump/services/fcm-pump-services.d.ts.map +1 -0
  31. package/models/models/fcm-pump/services/index.d.ts +2 -0
  32. package/models/models/fcm-pump/services/index.d.ts.map +1 -0
  33. package/models/models/fcm-pump/types/index.d.ts +5 -0
  34. package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts +4 -2
  35. package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts.map +1 -1
  36. package/models/models/index.d.ts +4 -0
  37. package/models/models/index.d.ts.map +1 -1
  38. package/models/models/lfcv-pump/index.d.ts +5 -0
  39. package/models/models/lfcv-pump/index.d.ts.map +1 -0
  40. package/models/models/lfcv-pump/lfcv-pump-model.d.ts +20 -0
  41. package/models/models/lfcv-pump/lfcv-pump-model.d.ts.map +1 -0
  42. package/models/models/lfcv-pump/lfcv-pump-registration.d.ts +87 -0
  43. package/models/models/lfcv-pump/lfcv-pump-registration.d.ts.map +1 -0
  44. package/models/models/lfcv-pump/services/index.d.ts +2 -0
  45. package/models/models/lfcv-pump/services/index.d.ts.map +1 -0
  46. package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts +10 -0
  47. package/models/models/lfcv-pump/services/lfcv-pump-services.d.ts.map +1 -0
  48. package/models/models/lfcv-pump/types/index.d.ts +5 -0
  49. package/models/models/spm-pump/index.d.ts +5 -0
  50. package/models/models/spm-pump/index.d.ts.map +1 -0
  51. package/models/models/spm-pump/services/index.d.ts +2 -0
  52. package/models/models/spm-pump/services/index.d.ts.map +1 -0
  53. package/models/models/spm-pump/services/spm-pump-services.d.ts +7 -0
  54. package/models/models/spm-pump/services/spm-pump-services.d.ts.map +1 -0
  55. package/models/models/spm-pump/spm-pump-model.d.ts +26 -0
  56. package/models/models/spm-pump/spm-pump-model.d.ts.map +1 -0
  57. package/models/models/spm-pump/spm-pump-registration.d.ts +87 -0
  58. package/models/models/spm-pump/spm-pump-registration.d.ts.map +1 -0
  59. package/models/models/spm-pump/types/index.d.ts +5 -0
  60. package/models/models/types/assembly.d.ts +7 -3
  61. package/models/models/types/assembly.d.ts.map +1 -1
  62. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts +1 -5
  63. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts.map +1 -1
  64. package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
  65. package/models.cjs +1 -1
  66. package/models.js +27 -20
  67. package/package.json +2 -2
  68. package/ui.cjs +1 -1
  69. package/ui.js +2 -2
  70. package/{use-nutrition-info-DjIGT-mE.cjs → use-nutrition-info-DSdA_SRp.cjs} +2 -2
  71. package/{use-nutrition-info-DjIGT-mE.cjs.map → use-nutrition-info-DSdA_SRp.cjs.map} +1 -1
  72. package/{use-nutrition-info-CjXNGbCN.js → use-nutrition-info-DtcZs7dL.js} +5 -5
  73. package/{use-nutrition-info-CjXNGbCN.js.map → use-nutrition-info-DtcZs7dL.js.map} +1 -1
  74. package/extension-utils-BE0Y1Zlv.js +0 -201
  75. package/extension-utils-BVDLwtKr.cjs +0 -2
  76. package/freestyle-registration-manager-CDbljuRk.cjs +0 -2
  77. package/freestyle-registration-manager-CDbljuRk.cjs.map +0 -1
  78. package/freestyle-registration-manager-z0aYdMcC.js +0 -1069
  79. package/freestyle-registration-manager-z0aYdMcC.js.map +0 -1
  80. package/models/models/carb-agitator/carb-agitator-registration.d.ts.map +0 -1
@@ -1,1069 +0,0 @@
1
- var Le = Object.defineProperty;
2
- var Fe = (e, t, r) => t in e ? Le(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var o = (e, t, r) => (Fe(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { kosModel as f, KosModelRegistrationFactory as b, KosModelContainer as Ge, kosChild as de, resolveServiceUrl as F, ServiceFactory as G, createPropKey as j, kosStateProp as J, kosFuture as U, kosModelEffect as k, kosFutureAware as je, kosLoggerAware as ce, EventBus as M, SingletonKosModelRegistrationFactory as ee, kosParentAware as ge, KosFeatureFlags as H, kosConfigProperty as p, getKosModelSync as v, kosContainerAware as Ue, KosContextManager as Be, KosLog as $, FutureManager as xe, kosAction as w, FetchError as He, KOS_MODEL_ID as m, kosMultipleFutureAware as Ke, kosTopicHandler as Ye, DependencyLifecycle as qe, modelTypeEventTopicFactory as Ve, RegistrationManager as h, registerCoreModels as We, Trouble as Ze, ExtensionManager as K, EXTENSION_TROUBLE_DATA_MAPPER as Y } from "@kosdev-code/kos-ui-sdk";
5
- import { PourState as c, Assembly as ue, KosModelRegistry as Qe, registerDispenseModels as Xe, Nozzle as Je, Pump as ke, Holder as et, PumpContainer as tt, PumpIndex as rt } from "@kosdev-code/kos-dispense-sdk";
6
- var at = Object.getOwnPropertyDescriptor, ot = (e, t, r, s) => {
7
- for (var a = s > 1 ? void 0 : s ? at(t, r) : t, i = e.length - 1, n; i >= 0; i--)
8
- (n = e[i]) && (a = n(a) || a);
9
- return a;
10
- };
11
- const he = "carb-agitator-model";
12
- let V = class {
13
- constructor(e, t, r) {
14
- o(this, "id");
15
- o(this, "name");
16
- o(this, "path");
17
- o(this, "logger");
18
- this.id = e, this.name = t.name, this.path = t.path, this.logger = r.logger;
19
- }
20
- // -------------------LIFECYCLE----------------------------
21
- async init() {
22
- this.logger.debug(`initializing carb-agitator ${this.id}`);
23
- }
24
- async load() {
25
- this.logger.debug(`loading carb-agitator ${this.id}`);
26
- }
27
- };
28
- V = ot([
29
- f(he)
30
- ], V);
31
- const pe = new b({
32
- class: V,
33
- type: he
34
- });
35
- var st = Object.defineProperty, it = Object.getOwnPropertyDescriptor, ye = (e, t, r, s) => {
36
- for (var a = s > 1 ? void 0 : s ? it(t, r) : t, i = e.length - 1, n; i >= 0; i--)
37
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
38
- return s && a && st(t, r, a), a;
39
- };
40
- const fe = "cartridge-agitator-container-model";
41
- let S = class {
42
- constructor(e, t, r) {
43
- o(this, "id");
44
- o(this, "logger");
45
- o(this, "_models");
46
- this.id = e, this.logger = r.logger, this._models = new Ge({
47
- parentId: e
48
- });
49
- }
50
- getModel(e) {
51
- return this._models.getModel(e);
52
- }
53
- get models() {
54
- return this._models;
55
- }
56
- get data() {
57
- return this._models.data;
58
- }
59
- addModel(e) {
60
- this._models.addModel(e);
61
- }
62
- removeModel(e) {
63
- this._models.removeModel(e);
64
- }
65
- // -------------------LIFECYCLE----------------------------
66
- async init() {
67
- this.logger.debug(
68
- `initializing cartridge-agitator-container container ${this.id}`
69
- );
70
- }
71
- async load() {
72
- this.logger.debug(
73
- `loading cartridge-agitator-container container ${this.id}`
74
- );
75
- }
76
- };
77
- ye([
78
- de
79
- ], S.prototype, "_models", 2);
80
- S = ye([
81
- f(fe)
82
- ], S);
83
- const { URL: me } = F("CARTRIDGE_AGITATOR_SERVICE"), { postModel: nt } = G.build({
84
- basePath: `${me}/api/ext/freestyle/freestyle/ice`
85
- }), lt = async (e, t) => {
86
- const r = await nt({
87
- model: {},
88
- tracker: t,
89
- urlOverride: `${me}/api/handle/${e}/test`
90
- });
91
- if (!(r != null && r.data))
92
- throw new Error("No response from server");
93
- return r.data;
94
- };
95
- var dt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, B = (e, t, r, s) => {
96
- for (var a = s > 1 ? void 0 : s ? ct(t, r) : t, i = e.length - 1, n; i >= 0; i--)
97
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
98
- return s && a && dt(t, r, a), a;
99
- };
100
- const Pe = "cartridge-agitator-model";
101
- class R {
102
- }
103
- o(R, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/agitation-started"), o(R, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/agitation-ended");
104
- const gt = j("statePath");
105
- let T = class {
106
- constructor(e, t) {
107
- o(this, "id");
108
- o(this, "agitating");
109
- o(this, "path");
110
- o(this, "statePath");
111
- o(this, "name");
112
- this.id = e, this.path = t.path, this.name = t.name, this.statePath = t.statePath;
113
- }
114
- get isAgitating() {
115
- return !!this.agitating.value;
116
- }
117
- async testAgitate(e) {
118
- if (!e)
119
- throw new Error("No tracker provided");
120
- return this.logger.info(`agitating cartridge-agitator ${this.id}`), lt(this.path, e);
121
- }
122
- handleAgitation() {
123
- var e;
124
- this.isAgitating ? (this.logger.info(`agitating cartridge-agitator ${this.id}`), M.publish(R.TOPIC_AGITATION_STARTED, {
125
- path: this.path,
126
- futureId: (e = this.future) == null ? void 0 : e.futureId
127
- })) : M.publish(R.TOPIC_AGITATION_ENDED, {
128
- path: this.path
129
- });
130
- }
131
- };
132
- B([
133
- J({ path: gt, attribute: "agitating" })
134
- ], T.prototype, "agitating", 2);
135
- B([
136
- U()
137
- ], T.prototype, "testAgitate", 1);
138
- B([
139
- k({
140
- dependencies: (e) => [e.isAgitating]
141
- })
142
- ], T.prototype, "handleAgitation", 1);
143
- T = B([
144
- f(Pe),
145
- je(),
146
- ce()
147
- ], T);
148
- const be = new b({
149
- class: T,
150
- type: Pe
151
- }), te = new ee({
152
- class: S,
153
- type: fe
154
- });
155
- te.addRelatedModel(be);
156
- var ut = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, _e = (e, t, r, s) => {
157
- for (var a = s > 1 ? void 0 : s ? ht(t, r) : t, i = e.length - 1, n; i >= 0; i--)
158
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
159
- return s && a && ut(t, r, a), a;
160
- };
161
- const ve = "freestyle-assembly-model", pt = "iceAgitator", yt = "carbAgitator", ft = "remoteTrays";
162
- let D = class {
163
- constructor(e, t, r) {
164
- o(this, "id");
165
- o(this, "logger");
166
- o(this, "assembly");
167
- o(this, "_remoteTrays");
168
- this.id = e, this.logger = r.logger, this.assembly = t.companionParent;
169
- }
170
- get holderGroups() {
171
- return this.assembly.holderGroups;
172
- }
173
- get nozzlePaths() {
174
- return this.assembly.nozzlePaths;
175
- }
176
- get allHolders() {
177
- return this.assembly.allHolders;
178
- }
179
- getHoldersByGroup(e) {
180
- return this.assembly.getHoldersByGroup(e);
181
- }
182
- getHoldersByNozzle(e) {
183
- return this.assembly.getHoldersByNozzle(e);
184
- }
185
- get pumpsByNozzle() {
186
- return this.assembly.pumpsByNozzle;
187
- }
188
- get pumpPaths() {
189
- return this.assembly.pumpPaths;
190
- }
191
- get boards() {
192
- return this.assembly.boards;
193
- }
194
- updateModel(e) {
195
- return this.assembly.updateModel(e);
196
- }
197
- get iceAgitator() {
198
- return this.assembly.iceAgitator;
199
- }
200
- get carbAgitator() {
201
- return this.assembly.carbAgitator;
202
- }
203
- get cartridgeAgitators() {
204
- return this.assembly.cartridgeAgitators;
205
- }
206
- get defaultCartridgeAgitator() {
207
- return this.assembly.cartridgeAgitators.data[0];
208
- }
209
- get cartridgeAgitatorModels() {
210
- return this.assembly.cartridgeAgitators.data;
211
- }
212
- get hasCartridgeAgitators() {
213
- return this.assembly.cartridgeAgitators.data.length > 0;
214
- }
215
- get remoteTrays() {
216
- return this.assembly.remoteTrays;
217
- }
218
- get hasRemoteTrays() {
219
- return this.assembly.remoteTrays ? this.assembly.remoteTrays.data.length > 0 : !1;
220
- }
221
- // -------------------LIFECYCLE----------------------------
222
- get supportsRemoteTrays() {
223
- return H.isFeatureEnabled(ft);
224
- }
225
- get supportsIce() {
226
- return H.isFeatureEnabled(pt);
227
- }
228
- get supportsCarb() {
229
- return H.isFeatureEnabled(yt);
230
- }
231
- async init() {
232
- this.logger.debug(`initializing freestyle-assembly ${this.id}`);
233
- }
234
- };
235
- _e([
236
- de
237
- ], D.prototype, "_remoteTrays", 2);
238
- D = _e([
239
- ge(),
240
- f(ve)
241
- ], D);
242
- const W = new ee({
243
- class: D,
244
- type: ve
245
- });
246
- var mt = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, Ie = (e, t, r, s) => {
247
- for (var a = s > 1 ? void 0 : s ? Pt(t, r) : t, i = e.length - 1, n; i >= 0; i--)
248
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
249
- return s && a && mt(t, r, a), a;
250
- };
251
- const Te = "remote-tray-model";
252
- j("holderPath");
253
- const bt = j("configPath");
254
- let z = class {
255
- constructor(e, t, r) {
256
- /** Unique identifier for the remote tray instance */
257
- o(this, "id");
258
- o(this, "logger");
259
- /** Path reference to the associated holder model */
260
- o(this, "holderPath");
261
- /** Configuration path for tray-specific settings */
262
- o(this, "configPath");
263
- /** Display name of the remote tray */
264
- o(this, "name");
265
- o(this, "remoteTrayEnabled");
266
- this.id = e, this.logger = r.logger, this.holderPath = t.holderPath, this.configPath = t.configPath, this.name = t.name;
267
- }
268
- /**
269
- * Gets the troubles from the associated holder model.
270
- * Propagates trouble states from the holder to this remote tray.
271
- *
272
- * @returns Array of trouble models from the holder, or empty array if no holder
273
- */
274
- get troubles() {
275
- var e;
276
- return ((e = this.holder) == null ? void 0 : e.troubles) ?? [];
277
- }
278
- /**
279
- * Gets the highest priority trouble status.
280
- * Currently returns empty string as troubles are managed by the holder.
281
- *
282
- * @returns Empty string (trouble status handled by holder)
283
- */
284
- get troubleStatus() {
285
- return "";
286
- }
287
- /**
288
- * Gets troubles grouped by type from the associated holder.
289
- *
290
- * @returns Record of troubles grouped by type from the holder, or empty object if no holder
291
- */
292
- get troublesByType() {
293
- var e;
294
- return ((e = this.holder) == null ? void 0 : e.troublesByType) ?? {};
295
- }
296
- /**
297
- * Updates the model with new configuration options.
298
- * Can be used to modify the holder path, config path, or name after initialization.
299
- *
300
- * @param _options - New configuration options for the remote tray
301
- */
302
- updateModel(e) {
303
- }
304
- /**
305
- * Gets the associated holder model for this remote tray.
306
- * Uses synchronous model lookup to retrieve the holder by path.
307
- *
308
- * @returns The HolderModel instance referenced by holderPath, or undefined if not found
309
- */
310
- get holder() {
311
- return v(this.holderPath).model;
312
- }
313
- /**
314
- * Determines if the remote tray is currently active.
315
- * Active state is based on the remoteTrayEnabled configuration property.
316
- *
317
- * @returns true if the tray is enabled, false otherwise
318
- */
319
- get active() {
320
- return !!this.remoteTrayEnabled.value;
321
- }
322
- // -------------------LIFECYCLE----------------------------
323
- /**
324
- * Initializes the remote tray model.
325
- * Called during the model lifecycle initialization phase.
326
- * Sets up initial state and prepares the model for use.
327
- *
328
- * @returns Promise that resolves when initialization is complete
329
- */
330
- async init() {
331
- this.logger.debug(`initializing remote-tray ${this.id}`);
332
- }
333
- /**
334
- * Loads the remote tray configuration and associated data.
335
- * Called during the model lifecycle load phase.
336
- * Typically loads configuration settings and establishes holder references.
337
- *
338
- * @returns Promise that resolves when loading is complete
339
- */
340
- async load() {
341
- this.logger.debug(`loading remote-tray ${this.id}`);
342
- }
343
- };
344
- Ie([
345
- p({
346
- path: bt,
347
- attribute: "enabled"
348
- })
349
- ], z.prototype, "remoteTrayEnabled", 2);
350
- z = Ie([
351
- f(Te)
352
- ], z);
353
- const A = new b({
354
- class: z,
355
- type: Te
356
- });
357
- var _t = Object.getOwnPropertyDescriptor, vt = (e, t, r, s) => {
358
- for (var a = s > 1 ? void 0 : s ? _t(t, r) : t, i = e.length - 1, n; i >= 0; i--)
359
- (n = e[i]) && (a = n(a) || a);
360
- return a;
361
- };
362
- const Oe = "remote-tray-container-model";
363
- let Z = class {
364
- constructor(e) {
365
- o(this, "id");
366
- this.id = e;
367
- }
368
- };
369
- Z = vt([
370
- f(Oe),
371
- ce(),
372
- Ue()
373
- ], Z);
374
- const re = new ee({
375
- class: Z,
376
- type: Oe
377
- });
378
- re.addRelatedModel(A);
379
- var It = Object.getOwnPropertyDescriptor, Tt = (e, t, r, s) => {
380
- for (var a = s > 1 ? void 0 : s ? It(t, r) : t, i = e.length - 1, n; i >= 0; i--)
381
- (n = e[i]) && (a = n(a) || a);
382
- return a;
383
- };
384
- const Ae = "freestyle-holder-model";
385
- function Ot(e) {
386
- const t = Be.getContext(e), r = t == null ? void 0 : t.get(
387
- W.type
388
- );
389
- if (!r) {
390
- $.error("Freestyle assembly not found");
391
- return;
392
- }
393
- return r;
394
- }
395
- async function At(e, t) {
396
- if (!e || !t)
397
- return;
398
- const r = await e[t]();
399
- if (r != null && r.tracker)
400
- return xe.getFuture(r.tracker);
401
- }
402
- let Q = class {
403
- constructor(e, t, r) {
404
- o(this, "id");
405
- o(this, "logger");
406
- o(this, "holder");
407
- o(this, "context");
408
- o(this, "future");
409
- this.id = e, this.logger = r.logger, this.context = r.kosContext, this.holder = t.companionParent;
410
- }
411
- get agitated() {
412
- return this.holder.data.agitated;
413
- }
414
- async agitate() {
415
- if (!this.holder.data.agitated)
416
- return;
417
- this.future = void 0;
418
- const e = Ot(this.id);
419
- if (!e)
420
- return;
421
- if (!e.defaultCartridgeAgitator) {
422
- this.logger.error("Agitator not found");
423
- return;
424
- }
425
- return this.future = await At(
426
- e.defaultCartridgeAgitator,
427
- "testAgitate"
428
- ), this.future;
429
- }
430
- get isRemote() {
431
- const e = `${A.type}-${this.holder.path}`, t = v(e);
432
- return t != null && t.model ? !!t.model.remoteTrayEnabled.value : !1;
433
- }
434
- // -------------------LIFECYCLE----------------------------
435
- async init() {
436
- this.logger.debug(`initializing freestyle-holder ${this.id}`);
437
- }
438
- async load() {
439
- this.logger.debug(`loading freestyle-holder ${this.id}`);
440
- }
441
- };
442
- Q = Tt([
443
- f(Ae)
444
- ], Q);
445
- const se = new b({
446
- class: Q,
447
- type: Ae
448
- }), { URL: Et } = F("FREESTYLE-NOZZLE_SERVICE"), { getOne: $t } = G.build({
449
- basePath: `${Et}/api/freestyle-nozzle`
450
- }), C = $.createLogger({
451
- name: "freestyle-nozzle-service",
452
- group: "Services"
453
- });
454
- class Ct extends Error {
455
- constructor(t) {
456
- super(t), this.name = "NutritionInfoError";
457
- }
458
- }
459
- class ie extends Error {
460
- constructor(t) {
461
- super(t), this.name = "InvalidRequestError";
462
- }
463
- }
464
- const wt = async (e, t, r, s = "http://localhost:8081") => {
465
- if (C.debug("sending GET for freestyle-nozzle"), !t)
466
- throw C.error("Invalid freestyle-nozzle request: beverageId is required"), new ie("No beverageId provided");
467
- if (!r || r.length === 0)
468
- throw C.error("Invalid freestyle-nozzle request: volumes are required"), new ie("No volumes provided");
469
- const a = await $t({
470
- urlOverride: `${s}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(
471
- ","
472
- )}`
473
- });
474
- if (!(a != null && a.data))
475
- throw C.error("Failed to retrieve freestyle-nozzle data"), new Error("Failed to retrieve freestyle-nozzle data");
476
- if (a.data.error)
477
- throw new Ct(a.data.error);
478
- return a.data;
479
- };
480
- var Mt = Object.defineProperty, St = Object.getOwnPropertyDescriptor, Ee = (e, t, r, s) => {
481
- for (var a = s > 1 ? void 0 : s ? St(t, r) : t, i = e.length - 1, n; i >= 0; i--)
482
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
483
- return s && a && Mt(t, r, a), a;
484
- };
485
- const $e = "freestyle-nozzle-model";
486
- let N = class {
487
- constructor(e, t, r) {
488
- o(this, "id");
489
- o(this, "logger");
490
- o(this, "nozzleModel");
491
- o(this, "_cupSizes");
492
- o(this, "_nutritionInfo");
493
- this.id = e, this.logger = r.logger, this.nozzleModel = t.companionParent, this._cupSizes = [100];
494
- }
495
- set cupSizes(e) {
496
- this._cupSizes = e;
497
- }
498
- get nutritionInfo() {
499
- return this._nutritionInfo;
500
- }
501
- get selectedPourable() {
502
- return this.nozzleModel.selectedPourable;
503
- }
504
- async handleBeverageSelection() {
505
- if (this.nozzleModel.selectedPourable.beverage && this._cupSizes.length) {
506
- this.logger.debug(
507
- `selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`
508
- );
509
- const e = this.nozzleModel.selectedPourable.beverage.rawId, t = this.nozzleModel.urlPrefix;
510
- try {
511
- const r = await wt(
512
- t,
513
- e,
514
- this._cupSizes
515
- );
516
- w(() => {
517
- this._nutritionInfo = r;
518
- });
519
- } catch (r) {
520
- this.logger.error(`Error fetching nutrition info: ${r}`);
521
- }
522
- }
523
- }
524
- // -------------------LIFECYCLE----------------------------
525
- async init() {
526
- this.logger.debug(`initializing freestyle-nozzle ${this.id}`);
527
- }
528
- unload() {
529
- this.logger.debug(`unloading freestyle-nozzle ${this.id}`);
530
- }
531
- async load() {
532
- this.logger.debug(`loading freestyle-nozzle ${this.id}`);
533
- }
534
- };
535
- Ee([
536
- k({
537
- dependencies: (e) => [
538
- e.selectedPourable.beverage
539
- ]
540
- })
541
- ], N.prototype, "handleBeverageSelection", 1);
542
- N = Ee([
543
- ge(),
544
- f($e)
545
- ], N);
546
- const ne = new b({
547
- class: N,
548
- type: $e
549
- }), { URL: Ce } = F("PUMP_SERVICE"), { postModel: Rt } = G.build({
550
- basePath: `${Ce}/api/ext/freestyle/microCalibration`
551
- }), q = $.createLogger({
552
- name: "freestyle-pump-service",
553
- group: "Services"
554
- }), Dt = async (e, t) => {
555
- var r, s, a, i, n;
556
- q.debug(
557
- `replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
558
- );
559
- try {
560
- const l = await Rt({
561
- model: {},
562
- urlOverride: `${Ce}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
563
- });
564
- return q.debug("replacePump - response:", l), ((l == null ? void 0 : l.status) === 200 || (l == null ? void 0 : l.status) === 499) && ((r = l.data) != null && r.error) ? [l.data.error || "unknownError", l.data] : [void 0, l == null ? void 0 : l.data];
565
- } catch (l) {
566
- if (q.error(
567
- `replacePump - sending POST request to /api/cal/${e}/code/${t}`,
568
- l
569
- ), l instanceof He) {
570
- const O = ((a = (s = l.payload) == null ? void 0 : s.data) == null ? void 0 : a.error) || ((i = l.payload) == null ? void 0 : i.error) || "unknownError";
571
- return [O, ((n = l.payload) == null ? void 0 : n.data) || { error: O }];
572
- }
573
- }
574
- return ["unknownError", { error: "unknownError" }];
575
- };
576
- var zt = Object.getOwnPropertyDescriptor, Nt = (e, t, r, s) => {
577
- for (var a = s > 1 ? void 0 : s ? zt(t, r) : t, i = e.length - 1, n; i >= 0; i--)
578
- (n = e[i]) && (a = n(a) || a);
579
- return a;
580
- };
581
- const we = "freestyle-pump-model";
582
- let X = class {
583
- constructor(e, t, r) {
584
- o(this, "id");
585
- o(this, "logger");
586
- o(this, "pump");
587
- this.id = e, this.logger = r.logger, this.pump = t.companionParent;
588
- }
589
- // -------------------LIFECYCLE----------------------------
590
- async replacePump(e) {
591
- const [t, r] = await Dt(this.pump.path, e);
592
- return t && this.logger.error(`Failed to replace the pump, ${this.pump.id}`, t), [t, r];
593
- }
594
- };
595
- X = Nt([
596
- f(we)
597
- ], X);
598
- const le = new b({
599
- class: X,
600
- type: we
601
- }), { URL: I } = F("ICE_AGITATOR_SERVICE"), { getAll: Me, postModel: x } = G.build({
602
- basePath: `${I}/api/ext/freestyle/ice`
603
- }), Se = $.createLogger({
604
- name: "ice-agitator-service",
605
- group: "Services"
606
- }), Lt = async (e) => (Se.debug("sending GET for ice types"), await Me({
607
- urlOverride: `${I}/api/handle/${e}/types`
608
- })), Ft = async (e, t) => (Se.debug("sending POST for ice types"), await x({
609
- urlOverride: `${I}/api/handle/${e}/type/${t}`,
610
- model: {}
611
- })), Gt = async (e) => await Me({
612
- urlOverride: `${I}/api/kos/config/details/${e}/4`
613
- }), jt = async (e, t) => {
614
- const r = await x({
615
- model: {},
616
- tracker: t,
617
- urlOverride: `${I}/api/handle/${e}/pour`
618
- });
619
- if (!(r != null && r.data))
620
- throw new Error("No response from server");
621
- return r == null ? void 0 : r.data;
622
- }, Ut = async (e, t) => {
623
- const r = await x({
624
- model: {},
625
- tracker: t,
626
- urlOverride: `${I}/api/handle/${e}/test/agitation`
627
- });
628
- if (!(r != null && r.data))
629
- throw new Error("No response from server");
630
- return r == null ? void 0 : r.data;
631
- }, Bt = async (e, t) => {
632
- const r = await x({
633
- model: {},
634
- tracker: t,
635
- urlOverride: `${I}/api/handle/${e}/test/gate`
636
- });
637
- if (!(r != null && r.data))
638
- throw new Error("No response from server");
639
- return r == null ? void 0 : r.data;
640
- };
641
- var xt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, g = (e, t, r, s) => {
642
- for (var a = s > 1 ? void 0 : s ? Ht(t, r) : t, i = e.length - 1, n; i >= 0; i--)
643
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
644
- return s && a && xt(t, r, a), a;
645
- };
646
- class L {
647
- }
648
- o(L, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/ice-agitation-started"), o(L, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/ice-agitation-ended");
649
- const Re = "ice-agitator-model", De = j("statePath");
650
- let d = class {
651
- constructor(e, t, r) {
652
- o(this, "id");
653
- o(this, "name");
654
- o(this, "path");
655
- o(this, "volWithoutIceMl");
656
- o(this, "durationSec");
657
- o(this, "enableIceChuteClear");
658
- o(this, "iceChuteClearDurationMs");
659
- o(this, "iceChuteClearIntervalSec");
660
- o(this, "iceChuteClearRetryIntervalSec");
661
- o(this, "maxDispenseSec");
662
- o(this, "type");
663
- o(this, "dilutionOffset");
664
- o(this, "inactivitySec");
665
- o(this, "agitating");
666
- o(this, "iceChuteOpen");
667
- o(this, "statePath");
668
- o(this, "_allIceTypes");
669
- o(this, "logger");
670
- o(this, "currentState", c.IDLE);
671
- o(this, "resetDefaultValues", async () => await Gt(this.path));
672
- this.id = e, this.name = t.name, this.path = t.path, this.statePath = t.statePath, this._allIceTypes = [], this.logger = r.logger;
673
- }
674
- get iceTypes() {
675
- return this._allIceTypes;
676
- }
677
- get isAgitating() {
678
- return !!this.agitating.value;
679
- }
680
- get isIceChuteOpen() {
681
- return !!this.iceChuteOpen.value;
682
- }
683
- // future, pourFuture, agitateFuture, gateFuture getters are now provided by @kosMultipleFutureAware decorator
684
- /**
685
- * A derived value that indicates if the nozzle is currently pouring a beverage.
686
- * @readonly
687
- */
688
- get isPouring() {
689
- var e;
690
- return !!(this.pourFuture && !((e = this.pourFuture) != null && e.endState)) || this.currentState === c.POUR_STARTING || this.currentState === c.POURING || this.currentState === c.POUR_CANCELING;
691
- }
692
- /**
693
- * A derived value that indicates if it is possible to dispense ice.
694
- *
695
- * The value is observable and will change as the current dispense state changes
696
- * @readonly
697
- * */
698
- get canPour() {
699
- return this.currentState === c.IDLE;
700
- }
701
- updateIfCurrent(e, t) {
702
- this.currentState === e && w(() => {
703
- this.currentState = t;
704
- });
705
- }
706
- async pourIce(e) {
707
- try {
708
- if (this.currentState === c.IDLE) {
709
- if (this.updateIfCurrent(c.IDLE, c.POUR_STARTING), !e)
710
- throw new Error("No tracker provided");
711
- const t = await jt(this.path, e);
712
- return this.updateIfCurrent(c.POUR_STARTING, c.POURING), t != null && t.endState && this.updateIfCurrent(c.POURING, c.IDLE), t;
713
- } else
714
- throw new Error(`Cannot pour in state ${this.currentState}`);
715
- } catch (t) {
716
- throw this.logger.error(t), this.currentState = c.IDLE, t;
717
- }
718
- }
719
- /**
720
- * An action that will cancel the ice dispense if it is currently in progress.
721
- * */
722
- async cancelIceDispense() {
723
- var e;
724
- this.currentState === c.POURING || this.currentState === c.POUR_STARTING ? (this.currentState = c.POUR_CANCELING, await ((e = this.pourFuture) == null ? void 0 : e.cancelFuture()), w(() => {
725
- this.currentState = c.IDLE;
726
- })) : this.logger.warn(
727
- `Cannot cancel ice dispense in state ${this.currentState}`
728
- );
729
- }
730
- async testAgitate(e) {
731
- if (!e)
732
- throw new Error("No tracker provided");
733
- return this.logger.info(`agitating ice-agitator ${this.id}`), Ut(this.path, e);
734
- }
735
- async testGate(e) {
736
- if (!e)
737
- throw new Error("No tracker provided");
738
- return this.logger.info(`testing ice gate: ${this.id}`), Bt(this.path, e);
739
- }
740
- handleAgitationChange() {
741
- var e;
742
- this.isAgitating ? (this.logger.info(`agitating ice-agitator ${this.id}`), M.publish(L.TOPIC_AGITATION_STARTED, {
743
- path: this.path,
744
- futureId: (e = this.futureHandler.future) == null ? void 0 : e.futureId
745
- })) : M.publish(L.TOPIC_AGITATION_ENDED, {
746
- path: this.path
747
- });
748
- }
749
- async updateIceType(e) {
750
- await Ft(this.path, e);
751
- }
752
- async init() {
753
- this.logger.debug(`initializing ice-agitator ${this.id}`);
754
- }
755
- async load() {
756
- this.logger.debug(`loading ice-agitator ${this.id}`);
757
- const e = await Lt(this.path);
758
- (e == null ? void 0 : e.status) === 200 && w(() => {
759
- this._allIceTypes = e.data || [];
760
- });
761
- }
762
- };
763
- g([
764
- p({
765
- path: m,
766
- attribute: "settings.volWithoutIceMl"
767
- })
768
- ], d.prototype, "volWithoutIceMl", 2);
769
- g([
770
- p({
771
- path: m,
772
- attribute: "settings.durationSec",
773
- converter: {
774
- to: "second"
775
- }
776
- })
777
- ], d.prototype, "durationSec", 2);
778
- g([
779
- p({
780
- path: m,
781
- attribute: "enableIceChuteClear"
782
- })
783
- ], d.prototype, "enableIceChuteClear", 2);
784
- g([
785
- p({
786
- path: m,
787
- attribute: "iceChuteClearDurationMs"
788
- })
789
- ], d.prototype, "iceChuteClearDurationMs", 2);
790
- g([
791
- p({
792
- path: m,
793
- attribute: "iceChuteClearIntervalSec"
794
- })
795
- ], d.prototype, "iceChuteClearIntervalSec", 2);
796
- g([
797
- p({
798
- path: m,
799
- attribute: "iceChuteClearRetryIntervalSec"
800
- })
801
- ], d.prototype, "iceChuteClearRetryIntervalSec", 2);
802
- g([
803
- p({
804
- path: m,
805
- attribute: "maxDispenseSec"
806
- })
807
- ], d.prototype, "maxDispenseSec", 2);
808
- g([
809
- p({
810
- path: m,
811
- attribute: "type"
812
- })
813
- ], d.prototype, "type", 2);
814
- g([
815
- p({
816
- path: m,
817
- attribute: "settings.dilutionOffset"
818
- })
819
- ], d.prototype, "dilutionOffset", 2);
820
- g([
821
- p({
822
- path: m,
823
- attribute: "settings.inactivitySec",
824
- converter: {
825
- to: "minute"
826
- }
827
- })
828
- ], d.prototype, "inactivitySec", 2);
829
- g([
830
- J({ path: De, attribute: "agitating" })
831
- ], d.prototype, "agitating", 2);
832
- g([
833
- J({ path: De, attribute: "iceChuteOpen" })
834
- ], d.prototype, "iceChuteOpen", 2);
835
- g([
836
- U({ alias: "pour" })
837
- ], d.prototype, "pourIce", 1);
838
- g([
839
- U({ alias: "agitate" })
840
- ], d.prototype, "testAgitate", 1);
841
- g([
842
- U({
843
- alias: "gate"
844
- })
845
- ], d.prototype, "testGate", 1);
846
- g([
847
- k({
848
- dependencies: (e) => [e.isAgitating]
849
- })
850
- ], d.prototype, "handleAgitationChange", 1);
851
- d = g([
852
- f(Re),
853
- Ke()
854
- ], d);
855
- const ze = new b({
856
- class: d,
857
- type: Re
858
- });
859
- var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, ae = (e, t, r, s) => {
860
- for (var a = s > 1 ? void 0 : s ? Yt(t, r) : t, i = e.length - 1, n; i >= 0; i--)
861
- (n = e[i]) && (a = (s ? n(t, r, a) : n(a)) || a);
862
- return s && a && Kt(t, r, a), a;
863
- };
864
- const oe = "agitation-required-trouble-model", qt = (e) => {
865
- if (e.data.agitationRequired)
866
- return oe;
867
- }, Vt = "InsufficientAgitationTrouble";
868
- let E = class {
869
- constructor(e, t, r) {
870
- o(this, "id");
871
- o(this, "logger");
872
- o(this, "trouble");
873
- o(this, "_deferred");
874
- o(this, "_holdersLoaded", !1);
875
- o(this, "agitateBeforePour");
876
- this.id = e, this.logger = r.logger, this._deferred = !1, this.trouble = t.companionParent;
877
- }
878
- async resolve() {
879
- return this.trouble.resolve();
880
- }
881
- get holder() {
882
- const e = this.trouble.data.holderPaths[0], t = v(e);
883
- if (!(!this._holdersLoaded && !t.model))
884
- return t == null ? void 0 : t.model;
885
- }
886
- updateHolder() {
887
- if (!this._holdersLoaded) {
888
- const e = this.trouble.data.holderPaths[0];
889
- v(e).model && (this._holdersLoaded = !0);
890
- }
891
- }
892
- get shouldDefer() {
893
- var s, a;
894
- if (!this.holder)
895
- return !0;
896
- const t = (((s = this.holder) == null ? void 0 : s.troublesByType[Vt]) || []).length > 0;
897
- return !!((a = this.agitateBeforePour) != null && a.value) && t;
898
- }
899
- get deferred() {
900
- return this._deferred;
901
- }
902
- defer() {
903
- this._deferred = !0;
904
- }
905
- clearDefer() {
906
- this._deferred = !1;
907
- }
908
- };
909
- ae([
910
- p({
911
- path: "app:kosdev.ddk:app",
912
- attribute: "ncui.agitateBeforePour"
913
- })
914
- ], E.prototype, "agitateBeforePour", 2);
915
- ae([
916
- Ye({
917
- topic: Ve(ue.type),
918
- lifecycle: qe.INIT
919
- })
920
- ], E.prototype, "updateHolder", 1);
921
- E = ae([
922
- f(oe)
923
- ], E);
924
- const Wt = new b({
925
- class: E,
926
- type: oe
927
- }), Zt = ["iceAgitator", "carbAgitator"], Qt = {
928
- iceAgitator: ze.factory,
929
- carbAgitator: pe.factory
930
- }, Xt = $.createLogger({ name: "freestyle-assembly-data-mapper" }), rr = async (e) => {
931
- const t = te.instance().options({}).build(), r = re.instance().options({}).build(), s = e.assemblies.reduce((n, l) => {
932
- var O;
933
- return Zt.forEach((u) => {
934
- var _;
935
- const P = l[u];
936
- if (P) {
937
- const Ne = Qt[u](P.path);
938
- n[u] = Ne({
939
- name: P.name,
940
- path: P.path,
941
- statePath: ((_ = P.state) == null ? void 0 : _.path) || ""
942
- });
943
- }
944
- }), (O = l.cartridgeAgitators) == null || O.forEach((u) => {
945
- var _;
946
- const P = be.instance(
947
- u.path
948
- ).options({
949
- name: u.name,
950
- path: u.path,
951
- statePath: ((_ = u.state) == null ? void 0 : _.path) || ""
952
- }).build();
953
- t.addModel(P);
954
- }), l.remoteTrays && l.remoteTrays.forEach((u) => {
955
- Xt.info(`Found remote tray ${u.name} with path ${u.path}`);
956
- const P = `${A.type}-${u.holderPath}`, _ = A.instance(P).options({
957
- holderPath: u.holderPath,
958
- configPath: u.path,
959
- name: u.name
960
- }).build();
961
- r.addModel(_);
962
- }), n;
963
- }, {}), a = !!s.iceAgitator, i = !!s.carbAgitator;
964
- return {
965
- ...s,
966
- cartridgeAgitators: t,
967
- remoteTrays: r,
968
- supportsCarb: i,
969
- supportsIce: a
970
- };
971
- }, Jt = (e) => () => (We(e)(), Xe(e)(), ne.register(), W.register(), ze.register(), pe.register(), te.register(), le.register(), se.register(), A.register(), re.register(), h.companion.register(e)(
972
- Je.type,
973
- ne.type
974
- ), h.companion.register(e)(
975
- ue.type,
976
- W.type
977
- ), Wt.register(), h.companion.register(e)(
978
- Ze.type,
979
- qt
980
- ), h.companion.register(e)(ke.type, le.type), h.companion.register(e)(
981
- et.type,
982
- se.type
983
- ), K[Y].register(
984
- "EnjoyByTrouble",
985
- async (t) => {
986
- if (t.data.enjoyByDate) {
987
- const r = new Date(t.data.enjoyByDate);
988
- return {
989
- enjoyByDays: Math.floor(
990
- ((/* @__PURE__ */ new Date()).getTime() - r.getTime()) / (1e3 * 60 * 60 * 24)
991
- ) || ""
992
- };
993
- }
994
- return {};
995
- }
996
- ), K[Y].register(
997
- "SuperPumpRequiredTrouble",
998
- // This is the trouble type
999
- async (t) => {
1000
- const { model: r } = v(
1001
- tt.type
1002
- );
1003
- return r ? {
1004
- superPumps: r.models.getIndexByKey(
1005
- rt.byType,
1006
- "microSuper"
1007
- ).map((i) => i.name).join(", ")
1008
- } : {};
1009
- }
1010
- ), K[Y].register(
1011
- "MicroPumpAirDetectTrouble",
1012
- async (t) => {
1013
- if (t.ifaces.includes("container"))
1014
- return {};
1015
- if (t.data.pumpPath) {
1016
- const { model: r } = v(
1017
- t.data.pumpPath
1018
- );
1019
- if (r) {
1020
- const s = r.ingredientId ? v(r.ingredientId).model : void 0;
1021
- return {
1022
- ingredientId: r.ingredientId,
1023
- ingredientName: (s == null ? void 0 : s.name) || ""
1024
- };
1025
- }
1026
- }
1027
- return {};
1028
- }
1029
- ), {
1030
- preload: h.model.preloadModel(e),
1031
- model: h.model.register(e),
1032
- companion: h.companion.register(e),
1033
- legacy: h.model.registerLegacyModel(e)
1034
- }), y = {
1035
- ...Qe
1036
- };
1037
- y.freestyle = {
1038
- models: Jt(y)
1039
- };
1040
- y.preload = h.model.preloadModel(y);
1041
- y.model = h.model.register(y);
1042
- y.companion = h.companion.register(y);
1043
- y.legacy = h.model.registerLegacyModel(y);
1044
- const ar = y;
1045
- export {
1046
- Vt as A,
1047
- pe as C,
1048
- W as F,
1049
- L as I,
1050
- ar as K,
1051
- Ct as N,
1052
- re as R,
1053
- te as a,
1054
- R as b,
1055
- be as c,
1056
- se as d,
1057
- ne as e,
1058
- le as f,
1059
- ze as g,
1060
- Wt as h,
1061
- A as i,
1062
- ie as j,
1063
- wt as k,
1064
- Dt as l,
1065
- rr as m,
1066
- pt as n,
1067
- Jt as r
1068
- };
1069
- //# sourceMappingURL=freestyle-registration-manager-z0aYdMcC.js.map