@kosdev-code/kos-freestyle-sdk 2.1.38 → 3.0.0
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/extension-utils-BFJb3AYW.cjs +344 -0
- package/extension-utils-BFJb3AYW.cjs.map +1 -0
- package/extension-utils-uGVieAa8.js +345 -0
- package/extension-utils-uGVieAa8.js.map +1 -0
- package/index.cjs +46 -1
- package/index.cjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +44 -48
- package/index.js.map +1 -1
- package/models/constants/index.d.ts.map +1 -1
- package/models/index.d.ts.map +1 -1
- package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts +2 -3
- package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts.map +1 -1
- package/models/models/agitation-required-trouble/index.d.ts.map +1 -1
- package/models/models/agitation-required-trouble/types/index.d.ts +1 -3
- package/models/models/carb-agitator/carb-agitator-model.d.ts +3 -4
- package/models/models/carb-agitator/carb-agitator-model.d.ts.map +1 -1
- package/models/models/carb-agitator/index.d.ts.map +1 -1
- package/models/models/carb-agitator/services/carb-tank-services.d.ts +0 -1
- package/models/models/carb-agitator/services/carb-tank-services.d.ts.map +1 -1
- package/models/models/cartridge-agitator/cartridge-agitator-container-model.d.ts +2 -3
- package/models/models/cartridge-agitator/cartridge-agitator-container-model.d.ts.map +1 -1
- package/models/models/cartridge-agitator/cartridge-agitator-container-registration.d.ts +2 -3
- package/models/models/cartridge-agitator/cartridge-agitator-container-registration.d.ts.map +1 -1
- package/models/models/cartridge-agitator/cartridge-agitator-model.d.ts +1 -2
- package/models/models/cartridge-agitator/cartridge-agitator-model.d.ts.map +1 -1
- package/models/models/cartridge-agitator/cartridge-agitator-registration.d.ts +2 -3
- package/models/models/cartridge-agitator/cartridge-agitator-registration.d.ts.map +1 -1
- package/models/models/cartridge-agitator/index.d.ts.map +1 -1
- package/models/models/cartridge-agitator/services/cartridge-agitator-services.d.ts +0 -1
- package/models/models/cartridge-agitator/services/cartridge-agitator-services.d.ts.map +1 -1
- package/models/models/cgp-pump/cgp-pump-model.d.ts +3 -4
- package/models/models/cgp-pump/cgp-pump-model.d.ts.map +1 -1
- package/models/models/cgp-pump/index.d.ts.map +1 -1
- package/models/models/cgp-pump/types/index.d.ts +1 -3
- package/models/models/fcm-pump/fcm-pump-model.d.ts +2 -3
- package/models/models/fcm-pump/fcm-pump-model.d.ts.map +1 -1
- package/models/models/fcm-pump/fcm-pump-registration.d.ts +2 -3
- package/models/models/fcm-pump/fcm-pump-registration.d.ts.map +1 -1
- package/models/models/fcm-pump/index.d.ts.map +1 -1
- package/models/models/fcm-pump/services/fcm-pump-services.d.ts +0 -1
- package/models/models/fcm-pump/services/fcm-pump-services.d.ts.map +1 -1
- package/models/models/fcm-pump/services/index.d.ts.map +1 -1
- package/models/models/fcm-pump/types/index.d.ts +1 -3
- package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts +7 -8
- package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts.map +1 -1
- package/models/models/freestyle-assembly/freestyle-assembly-registration.d.ts +2 -3
- package/models/models/freestyle-assembly/freestyle-assembly-registration.d.ts.map +1 -1
- package/models/models/freestyle-assembly/index.d.ts.map +1 -1
- package/models/models/freestyle-assembly/types/index.d.ts +1 -3
- package/models/models/freestyle-holder/freestyle-holder-model.d.ts +3 -3
- package/models/models/freestyle-holder/freestyle-holder-model.d.ts.map +1 -1
- package/models/models/freestyle-holder/freestyle-holder-registration.d.ts +2 -3
- package/models/models/freestyle-holder/freestyle-holder-registration.d.ts.map +1 -1
- package/models/models/freestyle-holder/index.d.ts.map +1 -1
- package/models/models/freestyle-holder/types/index.d.ts +1 -3
- package/models/models/freestyle-nozzle/freestyle-nozzle-model.d.ts +2 -3
- package/models/models/freestyle-nozzle/freestyle-nozzle-model.d.ts.map +1 -1
- package/models/models/freestyle-nozzle/freestyle-nozzle-registration.d.ts +2 -3
- package/models/models/freestyle-nozzle/freestyle-nozzle-registration.d.ts.map +1 -1
- package/models/models/freestyle-nozzle/index.d.ts.map +1 -1
- package/models/models/freestyle-nozzle/services/freestyle-nozzle-services.d.ts.map +1 -1
- package/models/models/freestyle-nozzle/services/index.d.ts.map +1 -1
- package/models/models/freestyle-nozzle/types/index.d.ts +1 -3
- package/models/models/freestyle-pump/freestyle-pump-model.d.ts +2 -3
- package/models/models/freestyle-pump/freestyle-pump-model.d.ts.map +1 -1
- package/models/models/freestyle-pump/freestyle-pump-registration.d.ts +2 -3
- package/models/models/freestyle-pump/freestyle-pump-registration.d.ts.map +1 -1
- package/models/models/freestyle-pump/index.d.ts.map +1 -1
- package/models/models/freestyle-pump/services/freestyle-pump-services.d.ts.map +1 -1
- package/models/models/freestyle-pump/services/index.d.ts.map +1 -1
- package/models/models/freestyle-pump/types/index.d.ts +1 -3
- package/models/models/ice-agitator/ice-agitator-model.d.ts +2 -3
- package/models/models/ice-agitator/ice-agitator-model.d.ts.map +1 -1
- package/models/models/ice-agitator/index.d.ts.map +1 -1
- package/models/models/ice-agitator/services/ice-agitator-services.d.ts +0 -1
- package/models/models/ice-agitator/services/ice-agitator-services.d.ts.map +1 -1
- package/models/models/ice-agitator/services/index.d.ts.map +1 -1
- package/models/models/index.d.ts.map +1 -1
- package/models/models/lfcv-pump/index.d.ts.map +1 -1
- package/models/models/lfcv-pump/lfcv-pump-model.d.ts +2 -3
- package/models/models/lfcv-pump/lfcv-pump-model.d.ts.map +1 -1
- package/models/models/lfcv-pump/types/index.d.ts +1 -3
- package/models/models/remote-tray/index.d.ts.map +1 -1
- package/models/models/remote-tray/remote-tray-container-model.d.ts +1 -2
- package/models/models/remote-tray/remote-tray-container-model.d.ts.map +1 -1
- package/models/models/remote-tray/remote-tray-container-registration.d.ts +2 -3
- package/models/models/remote-tray/remote-tray-container-registration.d.ts.map +1 -1
- package/models/models/remote-tray/remote-tray-model.d.ts +3 -4
- package/models/models/remote-tray/remote-tray-model.d.ts.map +1 -1
- package/models/models/remote-tray/remote-tray-registration.d.ts +2 -3
- package/models/models/remote-tray/remote-tray-registration.d.ts.map +1 -1
- package/models/models/spm-pump/index.d.ts.map +1 -1
- package/models/models/spm-pump/services/index.d.ts.map +1 -1
- package/models/models/spm-pump/services/spm-pump-services.d.ts +0 -1
- package/models/models/spm-pump/services/spm-pump-services.d.ts.map +1 -1
- package/models/models/spm-pump/spm-pump-model.d.ts +2 -3
- package/models/models/spm-pump/spm-pump-model.d.ts.map +1 -1
- package/models/models/spm-pump/spm-pump-registration.d.ts +2 -3
- package/models/models/spm-pump/spm-pump-registration.d.ts.map +1 -1
- package/models/models/spm-pump/types/index.d.ts +1 -3
- package/models/models/types/assembly.d.ts +3 -4
- package/models/models/types/assembly.d.ts.map +1 -1
- package/models/models/types/ingredients.d.ts +0 -1
- package/models/models/types/ingredients.d.ts.map +1 -1
- package/models/models/types/pumps.d.ts +0 -1
- package/models/models/types/pumps.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +2 -3
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models/utils/extensions/assembly/assembly-data-mapper.d.ts +2 -3
- package/models/utils/extensions/assembly/assembly-data-mapper.d.ts.map +1 -1
- package/models/utils/extensions/assembly/types.d.ts +2 -3
- package/models/utils/extensions/assembly/types.d.ts.map +1 -1
- package/models/utils/extensions/availability/freestyle-loader.d.ts +1 -2
- package/models/utils/extensions/availability/freestyle-loader.d.ts.map +1 -1
- package/models/utils/extensions/availability/freestyle-mapper.d.ts +2 -3
- package/models/utils/extensions/availability/freestyle-mapper.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/assets.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/assets.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/beverage-screen.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/beverage-screen.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/beverages.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/beverages.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/brand-screen.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/brand-screen.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/brands.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/brands.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/copy-input.d.ts +0 -1
- package/models/utils/extensions/availability/middleware/copy-input.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/flavors.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/flavors.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/nutrition.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/nutrition.d.ts.map +1 -1
- package/models/utils/extensions/availability/middleware/related-brands.d.ts +1 -2
- package/models/utils/extensions/availability/middleware/related-brands.d.ts.map +1 -1
- package/models/utils/extensions/availability/types.d.ts.map +1 -1
- package/models/utils/extensions/availability/util/locate-brand.d.ts.map +1 -1
- package/models/utils/extensions/availability/util/process-related-brand.d.ts +0 -1
- package/models/utils/extensions/availability/util/process-related-brand.d.ts.map +1 -1
- package/models/utils/extensions/ingredient/index.d.ts.map +1 -1
- package/models/utils/extensions/ingredient/model-extension.d.ts +1 -2
- package/models/utils/extensions/ingredient/model-extension.d.ts.map +1 -1
- package/models/utils/extensions/pourable/select-pourable-mapper.d.ts +0 -1
- package/models/utils/extensions/pourable/select-pourable-mapper.d.ts.map +1 -1
- package/models/utils/extensions/trouble/trouble-utils.d.ts +0 -1
- package/models/utils/extensions/trouble/trouble-utils.d.ts.map +1 -1
- package/models/utils/freestyle-registration-manager.d.ts +9 -10
- package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
- package/models/utils/index.d.ts.map +1 -1
- package/models/utils/openapi-index.d.ts.map +1 -1
- package/models/utils/services/freestyle/1.6.5/service.d.ts +34 -35
- package/models/utils/services/freestyle/1.6.5/service.d.ts.map +1 -1
- package/models/utils/services/freestyle/1.8.1/service.d.ts +34 -35
- package/models/utils/services/freestyle/1.8.1/service.d.ts.map +1 -1
- package/models/utils/services/freestyle/daily/service.d.ts +34 -35
- package/models/utils/services/freestyle/daily/service.d.ts.map +1 -1
- package/models/utils/services/handle/1.8.1/service.d.ts +34 -35
- package/models/utils/services/handle/1.8.1/service.d.ts.map +1 -1
- package/models/utils/services/handle/daily/service.d.ts +34 -35
- package/models/utils/services/handle/daily/service.d.ts.map +1 -1
- package/models/utils/services-index.d.ts.map +1 -1
- package/models.cjs +38 -1
- package/models.cjs.map +1 -1
- package/models.d.ts +1 -0
- package/models.js +35 -37
- package/models.js.map +1 -1
- package/package.json +9 -10
- package/service-BRuYqmJg.js +2277 -0
- package/service-BRuYqmJg.js.map +1 -0
- package/service-E5IuBoLR.cjs +2276 -0
- package/service-E5IuBoLR.cjs.map +1 -0
- package/ui/contexts/index.d.ts.map +1 -1
- package/ui/hooks/freestyle-assembly/index.d.ts.map +1 -1
- package/ui/hooks/freestyle-assembly/use-freestyle-assembly.d.ts +0 -1
- package/ui/hooks/freestyle-assembly/use-freestyle-assembly.d.ts.map +1 -1
- package/ui/hooks/freestyle-nozzle/index.d.ts.map +1 -1
- package/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.d.ts +0 -1
- package/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.d.ts.map +1 -1
- package/ui/hooks/ice-agitator/index.d.ts.map +1 -1
- package/ui/hooks/ice-agitator/use-ice-agitator.d.ts +1 -2
- package/ui/hooks/ice-agitator/use-ice-agitator.d.ts.map +1 -1
- package/ui/hooks/ice-agitator/with-ice-agitator.d.ts +0 -1
- package/ui/hooks/ice-agitator/with-ice-agitator.d.ts.map +1 -1
- package/ui/hooks/index.d.ts.map +1 -1
- package/ui/hooks/nutrition/index.d.ts.map +1 -1
- package/ui/hooks/nutrition/use-nutrition-info.d.ts +0 -1
- package/ui/hooks/nutrition/use-nutrition-info.d.ts.map +1 -1
- package/ui/index.d.ts.map +1 -1
- package/ui.cjs +8 -1
- package/ui.cjs.map +1 -1
- package/ui.d.ts +1 -0
- package/ui.js +6 -11
- package/ui.js.map +1 -1
- package/use-nutrition-info-B1EB2iYY.js +68 -0
- package/use-nutrition-info-B1EB2iYY.js.map +1 -0
- package/use-nutrition-info-BDv3r-Gf.cjs +67 -0
- package/use-nutrition-info-BDv3r-Gf.cjs.map +1 -0
- package/extension-utils--qB2FP1I.js +0 -237
- package/extension-utils--qB2FP1I.js.map +0 -1
- package/extension-utils-DQSu9dSv.cjs +0 -2
- package/extension-utils-DQSu9dSv.cjs.map +0 -1
- package/kos-models.json +0 -180
- package/service-BuugCicr.js +0 -1907
- package/service-BuugCicr.js.map +0 -1
- package/service-DSV9Dr2d.cjs +0 -2
- package/service-DSV9Dr2d.cjs.map +0 -1
- package/use-nutrition-info-CPEwk_O-.js +0 -52
- package/use-nutrition-info-CPEwk_O-.js.map +0 -1
- package/use-nutrition-info-C_myxRvf.cjs +0 -2
- package/use-nutrition-info-C_myxRvf.cjs.map +0 -1
|
@@ -0,0 +1,2277 @@
|
|
|
1
|
+
import { resolveServiceUrl, ServiceFactory, KosLog, createPropKey, kosStateProp, kosConfigProperty, kosStateEntry, kosStateExit, kosStateGuard, kosFuture, kosModel, kosLoggerAware, kosCompanion, DependencyLifecycle, kosFutureAware, kosStateMachine, KosModelContainer, kosChild, kosModelEffect, EventBus, KosModelRegistrationFactory, SingletonKosModelRegistrationFactory, FetchError, FutureManager, FutureEndState, FutureHandler, kosParentAware, KosFeatureFlags, getKosCompanionModel, getKosModelSync, kosContainerAware, KosContextManager, kosAction, KOS_MODEL_ID, kosMultipleFutureAware, kosTopicHandler, modelTypeEventTopicFactory, RegistrationManager, registerCoreModels, Trouble, ExtensionManager, EXTENSION_TROUBLE_DATA_MAPPER, createClient, kosServiceRequest as kosServiceRequest$5 } from "@kosdev-code/kos-ui-sdk";
|
|
2
|
+
import { PourState, Assembly, KosModelRegistry as KosModelRegistry$1, registerDispenseModels, Nozzle, Pump, Holder, PumpContainer, PumpIndex } from "@kosdev-code/kos-dispense-sdk";
|
|
3
|
+
const { URL: URL$6 } = resolveServiceUrl("ICE_AGITATOR_SERVICE");
|
|
4
|
+
const { postModel: postModel$5 } = ServiceFactory.build({
|
|
5
|
+
basePath: `${URL$6}/api/ext/freestyle/ice`
|
|
6
|
+
});
|
|
7
|
+
KosLog.createLogger({
|
|
8
|
+
name: "carb-tank-service",
|
|
9
|
+
group: "Services"
|
|
10
|
+
});
|
|
11
|
+
const testCarbTank = async (path, tracker) => {
|
|
12
|
+
const response = await postModel$5({
|
|
13
|
+
model: {},
|
|
14
|
+
tracker,
|
|
15
|
+
urlOverride: `${URL$6}/api/handle/${path}/test`
|
|
16
|
+
});
|
|
17
|
+
if (!response?.data) {
|
|
18
|
+
throw new Error("No response from server");
|
|
19
|
+
}
|
|
20
|
+
return response?.data;
|
|
21
|
+
};
|
|
22
|
+
var __defProp$b = Object.defineProperty;
|
|
23
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
24
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
26
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
27
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28
|
+
if (decorator = decorators[i])
|
|
29
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
30
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "", value);
|
|
34
|
+
const MODEL_TYPE$e = "carb-agitator-model";
|
|
35
|
+
const PROP_STATE_PATH$1 = createPropKey("statePath");
|
|
36
|
+
let CarbAgitatorModelImpl = class {
|
|
37
|
+
/**
|
|
38
|
+
* Unique identifier for this carb agitator instance.
|
|
39
|
+
*/
|
|
40
|
+
id;
|
|
41
|
+
/**
|
|
42
|
+
* Display name for this carb agitator.
|
|
43
|
+
*/
|
|
44
|
+
name;
|
|
45
|
+
/**
|
|
46
|
+
* Device path for carb tank operations.
|
|
47
|
+
*/
|
|
48
|
+
path;
|
|
49
|
+
/**
|
|
50
|
+
* State path for accessing probe and filling status.
|
|
51
|
+
*/
|
|
52
|
+
statePath;
|
|
53
|
+
highProbeWet;
|
|
54
|
+
lowProbeWet;
|
|
55
|
+
filling;
|
|
56
|
+
enabled;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new carb agitator model instance.
|
|
59
|
+
*
|
|
60
|
+
* @param modelId - Unique identifier for this instance
|
|
61
|
+
* @param options - Configuration options including name
|
|
62
|
+
* @param context - KOS creation context providing assembly paths
|
|
63
|
+
*/
|
|
64
|
+
constructor(modelId, options, context) {
|
|
65
|
+
this.id = modelId;
|
|
66
|
+
this.name = options.name;
|
|
67
|
+
this.path = context.kosContext.get(`assembly-feature-carbTank`)?.path || "";
|
|
68
|
+
const statePath = context.kosContext.get(`assembly-state-path-carbTank`);
|
|
69
|
+
this.statePath = statePath;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the carb holder associated with this agitator.
|
|
73
|
+
*
|
|
74
|
+
* Retrieves the first holder from the "carb" group in the parent assembly.
|
|
75
|
+
*
|
|
76
|
+
* @returns The carb holder model, or undefined if not found
|
|
77
|
+
*/
|
|
78
|
+
get holder() {
|
|
79
|
+
const carbHolder = this.getCompanionParent()?.getHoldersByGroup("carb")[0];
|
|
80
|
+
return carbHolder;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets the pump associated with the carb holder.
|
|
84
|
+
*
|
|
85
|
+
* Returns the first pump from the holder's pump collection.
|
|
86
|
+
*
|
|
87
|
+
* @returns The pump model, or undefined if holder or pump not available
|
|
88
|
+
*/
|
|
89
|
+
get pump() {
|
|
90
|
+
return this.holder?.pumps.data[0];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Indicates whether the carb tank is currently being filled.
|
|
94
|
+
*
|
|
95
|
+
* @returns true if the filling state property indicates active filling
|
|
96
|
+
*/
|
|
97
|
+
get isFilling() {
|
|
98
|
+
return !!this.filling.value;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Indicates whether the carb tank has been initialized.
|
|
102
|
+
*
|
|
103
|
+
* @returns true if the carb tank enabled configuration is set to true
|
|
104
|
+
*/
|
|
105
|
+
get isCarbInitialized() {
|
|
106
|
+
return !!this.enabled.value;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Indicates whether carb tank activation is allowed.
|
|
110
|
+
*
|
|
111
|
+
* Activation is only allowed when the carb tank is not already enabled.
|
|
112
|
+
*
|
|
113
|
+
* @returns true if the carb tank can be activated
|
|
114
|
+
*/
|
|
115
|
+
get canActivate() {
|
|
116
|
+
return !this.enabled.value;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Indicates whether the workflow can proceed past carb initialization.
|
|
120
|
+
*
|
|
121
|
+
* The workflow can proceed when the state machine is in either INITIALIZED
|
|
122
|
+
* (carb tank activated) or SKIPPED (user chose to bypass carbonation).
|
|
123
|
+
*
|
|
124
|
+
* @returns true if ready to proceed with beverage operations
|
|
125
|
+
*/
|
|
126
|
+
get canProceed() {
|
|
127
|
+
return this.isInState(
|
|
128
|
+
"INITIALIZED"
|
|
129
|
+
/* INITIALIZED */
|
|
130
|
+
) || this.isInState(
|
|
131
|
+
"SKIPPED"
|
|
132
|
+
/* SKIPPED */
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
handleActivationStart() {
|
|
136
|
+
this.logger.info("Carb tank activation started");
|
|
137
|
+
}
|
|
138
|
+
handleActivationComplete() {
|
|
139
|
+
this.logger.info("Carb tank initialized");
|
|
140
|
+
}
|
|
141
|
+
handleInitialized() {
|
|
142
|
+
this.logger.info("Carb tank ready to proceed");
|
|
143
|
+
}
|
|
144
|
+
handleSkipped() {
|
|
145
|
+
this.logger.info("Proceeding without carbinator");
|
|
146
|
+
}
|
|
147
|
+
async activateCarbTank() {
|
|
148
|
+
this.transition("ACTIVATE");
|
|
149
|
+
this.enabled.updateProperty(true);
|
|
150
|
+
this.transition("ACTIVATION_COMPLETE");
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Deactivates the carb tank and resets to uninitialized state.
|
|
154
|
+
*
|
|
155
|
+
* This method:
|
|
156
|
+
* 1. Updates the enabled configuration property to false
|
|
157
|
+
* 2. Transitions back to UNINITIALIZED state
|
|
158
|
+
*
|
|
159
|
+
* Can be called from any state.
|
|
160
|
+
*/
|
|
161
|
+
async deactivateCarbTank() {
|
|
162
|
+
this.enabled.updateProperty(false);
|
|
163
|
+
this.transition("RESET");
|
|
164
|
+
}
|
|
165
|
+
skip() {
|
|
166
|
+
this.transition("SKIP");
|
|
167
|
+
}
|
|
168
|
+
reset() {
|
|
169
|
+
this.enabled.updateProperty(false);
|
|
170
|
+
this.transition("RESET");
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Toggles the carb tank between enabled and disabled states.
|
|
174
|
+
*
|
|
175
|
+
* If currently enabled, calls {@link deactivateCarbTank}.
|
|
176
|
+
* If currently disabled, calls {@link activateCarbTank}.
|
|
177
|
+
*/
|
|
178
|
+
toggleCarbTank() {
|
|
179
|
+
if (this.enabled.value) {
|
|
180
|
+
this.deactivateCarbTank();
|
|
181
|
+
} else {
|
|
182
|
+
this.activateCarbTank();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
handleTestCarbTank(tracker) {
|
|
186
|
+
if (!tracker) {
|
|
187
|
+
throw new Error("No tracker provided");
|
|
188
|
+
}
|
|
189
|
+
this.logger.info(`testing carb tank: ${this.id}`);
|
|
190
|
+
return testCarbTank(this.path, tracker);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
__publicField$4(CarbAgitatorModelImpl, "Registration");
|
|
194
|
+
__decorateClass$e([
|
|
195
|
+
kosStateProp({
|
|
196
|
+
path: PROP_STATE_PATH$1,
|
|
197
|
+
attribute: "highProbeWet"
|
|
198
|
+
})
|
|
199
|
+
], CarbAgitatorModelImpl.prototype, "highProbeWet", 2);
|
|
200
|
+
__decorateClass$e([
|
|
201
|
+
kosStateProp({
|
|
202
|
+
path: PROP_STATE_PATH$1,
|
|
203
|
+
attribute: "lowProbeWet"
|
|
204
|
+
})
|
|
205
|
+
], CarbAgitatorModelImpl.prototype, "lowProbeWet", 2);
|
|
206
|
+
__decorateClass$e([
|
|
207
|
+
kosStateProp({
|
|
208
|
+
path: PROP_STATE_PATH$1,
|
|
209
|
+
attribute: "filling"
|
|
210
|
+
})
|
|
211
|
+
], CarbAgitatorModelImpl.prototype, "filling", 2);
|
|
212
|
+
__decorateClass$e([
|
|
213
|
+
kosConfigProperty({
|
|
214
|
+
path: "assembly:core:board:macksm:carbTank:carbTank",
|
|
215
|
+
attribute: "enabled"
|
|
216
|
+
})
|
|
217
|
+
], CarbAgitatorModelImpl.prototype, "enabled", 2);
|
|
218
|
+
__decorateClass$e([
|
|
219
|
+
kosStateEntry(
|
|
220
|
+
"ACTIVATING"
|
|
221
|
+
/* ACTIVATING */
|
|
222
|
+
)
|
|
223
|
+
], CarbAgitatorModelImpl.prototype, "handleActivationStart", 1);
|
|
224
|
+
__decorateClass$e([
|
|
225
|
+
kosStateExit(
|
|
226
|
+
"ACTIVATING"
|
|
227
|
+
/* ACTIVATING */
|
|
228
|
+
)
|
|
229
|
+
], CarbAgitatorModelImpl.prototype, "handleActivationComplete", 1);
|
|
230
|
+
__decorateClass$e([
|
|
231
|
+
kosStateEntry(
|
|
232
|
+
"INITIALIZED"
|
|
233
|
+
/* INITIALIZED */
|
|
234
|
+
)
|
|
235
|
+
], CarbAgitatorModelImpl.prototype, "handleInitialized", 1);
|
|
236
|
+
__decorateClass$e([
|
|
237
|
+
kosStateEntry(
|
|
238
|
+
"SKIPPED"
|
|
239
|
+
/* SKIPPED */
|
|
240
|
+
)
|
|
241
|
+
], CarbAgitatorModelImpl.prototype, "handleSkipped", 1);
|
|
242
|
+
__decorateClass$e([
|
|
243
|
+
kosStateGuard({ allowedStates: [
|
|
244
|
+
"UNINITIALIZED"
|
|
245
|
+
/* UNINITIALIZED */
|
|
246
|
+
] })
|
|
247
|
+
], CarbAgitatorModelImpl.prototype, "activateCarbTank", 1);
|
|
248
|
+
__decorateClass$e([
|
|
249
|
+
kosStateGuard({ allowedStates: [
|
|
250
|
+
"UNINITIALIZED"
|
|
251
|
+
/* UNINITIALIZED */
|
|
252
|
+
] })
|
|
253
|
+
], CarbAgitatorModelImpl.prototype, "skip", 1);
|
|
254
|
+
__decorateClass$e([
|
|
255
|
+
kosStateGuard({
|
|
256
|
+
allowedStates: [
|
|
257
|
+
"INITIALIZED",
|
|
258
|
+
"SKIPPED"
|
|
259
|
+
/* SKIPPED */
|
|
260
|
+
]
|
|
261
|
+
})
|
|
262
|
+
], CarbAgitatorModelImpl.prototype, "reset", 1);
|
|
263
|
+
__decorateClass$e([
|
|
264
|
+
kosFuture()
|
|
265
|
+
], CarbAgitatorModelImpl.prototype, "handleTestCarbTank", 1);
|
|
266
|
+
CarbAgitatorModelImpl = __decorateClass$e([
|
|
267
|
+
kosModel({ modelTypeId: MODEL_TYPE$e, singleton: false }),
|
|
268
|
+
kosLoggerAware(),
|
|
269
|
+
kosCompanion({ mode: "composition", lifecycle: DependencyLifecycle.LOAD }),
|
|
270
|
+
kosFutureAware(),
|
|
271
|
+
kosStateMachine(
|
|
272
|
+
{
|
|
273
|
+
initial: "UNINITIALIZED",
|
|
274
|
+
states: {
|
|
275
|
+
[
|
|
276
|
+
"UNINITIALIZED"
|
|
277
|
+
/* UNINITIALIZED */
|
|
278
|
+
]: {
|
|
279
|
+
on: {
|
|
280
|
+
ACTIVATE: "ACTIVATING",
|
|
281
|
+
SKIP: "SKIPPED"
|
|
282
|
+
/* SKIPPED */
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
[
|
|
286
|
+
"ACTIVATING"
|
|
287
|
+
/* ACTIVATING */
|
|
288
|
+
]: {
|
|
289
|
+
on: {
|
|
290
|
+
ACTIVATION_COMPLETE: "INITIALIZED"
|
|
291
|
+
/* INITIALIZED */
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
[
|
|
295
|
+
"INITIALIZED"
|
|
296
|
+
/* INITIALIZED */
|
|
297
|
+
]: {
|
|
298
|
+
on: {
|
|
299
|
+
RESET: "UNINITIALIZED"
|
|
300
|
+
/* UNINITIALIZED */
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
[
|
|
304
|
+
"SKIPPED"
|
|
305
|
+
/* SKIPPED */
|
|
306
|
+
]: {
|
|
307
|
+
on: {
|
|
308
|
+
RESET: "UNINITIALIZED"
|
|
309
|
+
/* UNINITIALIZED */
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
throwOnInvalid: false
|
|
316
|
+
// Graceful handling for button clicks
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
], CarbAgitatorModelImpl);
|
|
320
|
+
const CarbAgitator = CarbAgitatorModelImpl.Registration;
|
|
321
|
+
var __defProp$a = Object.defineProperty;
|
|
322
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
323
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
324
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
325
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
326
|
+
if (decorator = decorators[i])
|
|
327
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
328
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
329
|
+
return result;
|
|
330
|
+
};
|
|
331
|
+
const MODEL_TYPE$d = "cartridge-agitator-container-model";
|
|
332
|
+
let CartridgeAgitatorContainerModelImpl = class {
|
|
333
|
+
id;
|
|
334
|
+
logger;
|
|
335
|
+
_models;
|
|
336
|
+
constructor(modelId, options, context) {
|
|
337
|
+
this.id = modelId;
|
|
338
|
+
this.logger = context.logger;
|
|
339
|
+
this._models = new KosModelContainer({
|
|
340
|
+
parentId: modelId
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
getModel(id) {
|
|
344
|
+
return this._models.getModel(id);
|
|
345
|
+
}
|
|
346
|
+
get models() {
|
|
347
|
+
return this._models;
|
|
348
|
+
}
|
|
349
|
+
get data() {
|
|
350
|
+
return this._models.data;
|
|
351
|
+
}
|
|
352
|
+
addModel(model) {
|
|
353
|
+
this._models.addModel(model);
|
|
354
|
+
}
|
|
355
|
+
removeModel(id) {
|
|
356
|
+
this._models.removeModel(id);
|
|
357
|
+
}
|
|
358
|
+
// -------------------LIFECYCLE----------------------------
|
|
359
|
+
async init() {
|
|
360
|
+
this.logger.debug(
|
|
361
|
+
`initializing cartridge-agitator-container container ${this.id}`
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
async load() {
|
|
365
|
+
this.logger.debug(
|
|
366
|
+
`loading cartridge-agitator-container container ${this.id}`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
__decorateClass$d([
|
|
371
|
+
kosChild
|
|
372
|
+
], CartridgeAgitatorContainerModelImpl.prototype, "_models", 2);
|
|
373
|
+
CartridgeAgitatorContainerModelImpl = __decorateClass$d([
|
|
374
|
+
kosModel(MODEL_TYPE$d)
|
|
375
|
+
], CartridgeAgitatorContainerModelImpl);
|
|
376
|
+
const { URL: URL$5 } = resolveServiceUrl("CARTRIDGE_AGITATOR_SERVICE");
|
|
377
|
+
const { postModel: postModel$4 } = ServiceFactory.build({
|
|
378
|
+
basePath: `${URL$5}/api/ext/freestyle/freestyle/ice`
|
|
379
|
+
});
|
|
380
|
+
const agitate$1 = async (path, tracker) => {
|
|
381
|
+
const response = await postModel$4({
|
|
382
|
+
model: {},
|
|
383
|
+
tracker,
|
|
384
|
+
urlOverride: `${URL$5}/api/handle/${path}/test`
|
|
385
|
+
});
|
|
386
|
+
if (!response?.data) {
|
|
387
|
+
throw new Error("No response from server");
|
|
388
|
+
}
|
|
389
|
+
return response.data;
|
|
390
|
+
};
|
|
391
|
+
var __defProp$9 = Object.defineProperty;
|
|
392
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
393
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
394
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
395
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
396
|
+
if (decorator = decorators[i])
|
|
397
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
398
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
399
|
+
return result;
|
|
400
|
+
};
|
|
401
|
+
const MODEL_TYPE$c = "cartridge-agitator-model";
|
|
402
|
+
class CartridgeAgitatorEvents {
|
|
403
|
+
static TOPIC_AGITATION_STARTED = "/kos/events/ddk/agitation-started";
|
|
404
|
+
static TOPIC_AGITATION_ENDED = "/kos/events/ddk/agitation-ended";
|
|
405
|
+
}
|
|
406
|
+
const PROP_PATH$1 = createPropKey("statePath");
|
|
407
|
+
let CartridgeAgitatorModelImpl = class {
|
|
408
|
+
id;
|
|
409
|
+
agitating;
|
|
410
|
+
path;
|
|
411
|
+
statePath;
|
|
412
|
+
name;
|
|
413
|
+
constructor(modelId, options) {
|
|
414
|
+
this.id = modelId;
|
|
415
|
+
this.path = options.path;
|
|
416
|
+
this.name = options.name;
|
|
417
|
+
this.statePath = options.statePath;
|
|
418
|
+
}
|
|
419
|
+
get isAgitating() {
|
|
420
|
+
return !!this.agitating.value;
|
|
421
|
+
}
|
|
422
|
+
async testAgitate(tracker) {
|
|
423
|
+
if (!tracker) {
|
|
424
|
+
throw new Error("No tracker provided");
|
|
425
|
+
}
|
|
426
|
+
this.logger.info(`agitating cartridge-agitator ${this.id}`);
|
|
427
|
+
return agitate$1(this.path, tracker);
|
|
428
|
+
}
|
|
429
|
+
handleAgitation() {
|
|
430
|
+
if (this.isAgitating) {
|
|
431
|
+
this.logger.info(`agitating cartridge-agitator ${this.id}`);
|
|
432
|
+
EventBus.publish(CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED, {
|
|
433
|
+
path: this.path,
|
|
434
|
+
futureId: this.future?.futureId
|
|
435
|
+
});
|
|
436
|
+
} else {
|
|
437
|
+
EventBus.publish(CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED, {
|
|
438
|
+
path: this.path
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
__decorateClass$c([
|
|
444
|
+
kosStateProp({ path: PROP_PATH$1, attribute: "agitating" })
|
|
445
|
+
], CartridgeAgitatorModelImpl.prototype, "agitating", 2);
|
|
446
|
+
__decorateClass$c([
|
|
447
|
+
kosFuture()
|
|
448
|
+
], CartridgeAgitatorModelImpl.prototype, "testAgitate", 1);
|
|
449
|
+
__decorateClass$c([
|
|
450
|
+
kosModelEffect({
|
|
451
|
+
dependencies: (model) => [model.isAgitating]
|
|
452
|
+
})
|
|
453
|
+
], CartridgeAgitatorModelImpl.prototype, "handleAgitation", 1);
|
|
454
|
+
CartridgeAgitatorModelImpl = __decorateClass$c([
|
|
455
|
+
kosModel(MODEL_TYPE$c),
|
|
456
|
+
kosFutureAware(),
|
|
457
|
+
kosLoggerAware()
|
|
458
|
+
], CartridgeAgitatorModelImpl);
|
|
459
|
+
const CartridgeAgitator = new KosModelRegistrationFactory({
|
|
460
|
+
class: CartridgeAgitatorModelImpl,
|
|
461
|
+
type: MODEL_TYPE$c
|
|
462
|
+
});
|
|
463
|
+
const CartridgeAgitatorContainer = new SingletonKosModelRegistrationFactory({
|
|
464
|
+
class: CartridgeAgitatorContainerModelImpl,
|
|
465
|
+
type: MODEL_TYPE$d
|
|
466
|
+
});
|
|
467
|
+
CartridgeAgitatorContainer.addRelatedModel(CartridgeAgitator);
|
|
468
|
+
var __defProp$8 = Object.defineProperty;
|
|
469
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
470
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
471
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
472
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
473
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
474
|
+
if (decorator = decorators[i])
|
|
475
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
476
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
477
|
+
return result;
|
|
478
|
+
};
|
|
479
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "", value);
|
|
480
|
+
const MODEL_TYPE$b = "cgp-pump-model";
|
|
481
|
+
const PROP_STATE_PATH = createPropKey("statePath");
|
|
482
|
+
let CgpPumpModelImpl = class {
|
|
483
|
+
highProbeWet;
|
|
484
|
+
lowProbeWet;
|
|
485
|
+
filling;
|
|
486
|
+
id;
|
|
487
|
+
state;
|
|
488
|
+
constructor(modelId, options) {
|
|
489
|
+
this.id = modelId;
|
|
490
|
+
this.state = options.data?.state ?? { name: "unknown", path: "" };
|
|
491
|
+
}
|
|
492
|
+
get statePath() {
|
|
493
|
+
return this.state.path;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
__publicField$3(CgpPumpModelImpl, "Registration");
|
|
497
|
+
__decorateClass$b([
|
|
498
|
+
kosStateProp({
|
|
499
|
+
path: PROP_STATE_PATH,
|
|
500
|
+
attribute: "highProbeWet"
|
|
501
|
+
})
|
|
502
|
+
], CgpPumpModelImpl.prototype, "highProbeWet", 2);
|
|
503
|
+
__decorateClass$b([
|
|
504
|
+
kosStateProp({
|
|
505
|
+
path: PROP_STATE_PATH,
|
|
506
|
+
attribute: "lowProbeWet"
|
|
507
|
+
})
|
|
508
|
+
], CgpPumpModelImpl.prototype, "lowProbeWet", 2);
|
|
509
|
+
__decorateClass$b([
|
|
510
|
+
kosStateProp({
|
|
511
|
+
path: PROP_STATE_PATH,
|
|
512
|
+
attribute: "filling"
|
|
513
|
+
})
|
|
514
|
+
], CgpPumpModelImpl.prototype, "filling", 2);
|
|
515
|
+
CgpPumpModelImpl = __decorateClass$b([
|
|
516
|
+
kosModel({ modelTypeId: MODEL_TYPE$b, singleton: false }),
|
|
517
|
+
kosCompanion({
|
|
518
|
+
mode: "composition"
|
|
519
|
+
}),
|
|
520
|
+
kosLoggerAware()
|
|
521
|
+
], CgpPumpModelImpl);
|
|
522
|
+
const CgpPump = CgpPumpModelImpl.Registration;
|
|
523
|
+
const { URL: URL$4 } = resolveServiceUrl("FCM-PUMP_SERVICE");
|
|
524
|
+
const { postModel: postModel$3 } = ServiceFactory.build({
|
|
525
|
+
basePath: `${URL$4}/api/fcm-pump`
|
|
526
|
+
});
|
|
527
|
+
const log$5 = KosLog.createLogger({
|
|
528
|
+
name: "fcm-pump-service",
|
|
529
|
+
group: "Services"
|
|
530
|
+
});
|
|
531
|
+
const performElectricalTest = async (path) => {
|
|
532
|
+
log$5.debug(
|
|
533
|
+
`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${path}/electricalTest`
|
|
534
|
+
);
|
|
535
|
+
try {
|
|
536
|
+
const response = await postModel$3({
|
|
537
|
+
model: {},
|
|
538
|
+
urlOverride: `${URL$4}/api/ext/freestyle/fcm/diagnostics/${path}/electricalTest`
|
|
539
|
+
});
|
|
540
|
+
log$5.debug("performElectricalTest - response:", response);
|
|
541
|
+
if ((response?.status === 200 || response?.status === 499) && response.data?.error) {
|
|
542
|
+
return [response.data.error || "unknownError", response.data];
|
|
543
|
+
}
|
|
544
|
+
return [void 0, response?.data];
|
|
545
|
+
} catch (error) {
|
|
546
|
+
log$5.error(
|
|
547
|
+
`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${path}/electricalTest`,
|
|
548
|
+
error
|
|
549
|
+
);
|
|
550
|
+
if (error instanceof FetchError) {
|
|
551
|
+
const errorCode = error.payload?.data?.error || error.payload?.error || "unknownError";
|
|
552
|
+
return [errorCode, error.payload?.data || { error: errorCode }];
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return ["unknownError", { error: "unknownError" }];
|
|
556
|
+
};
|
|
557
|
+
const performPreCalibrate$1 = async (pump, tracker) => {
|
|
558
|
+
log$5.debug(
|
|
559
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/preCalibrate`
|
|
560
|
+
);
|
|
561
|
+
try {
|
|
562
|
+
const response = await postModel$3({
|
|
563
|
+
model: {},
|
|
564
|
+
urlOverride: `${URL$4}/api/ext/freestyle/fcm/calibration/${pump}/preCalibrate`,
|
|
565
|
+
tracker
|
|
566
|
+
});
|
|
567
|
+
log$5.debug("performPreCalibrate - response:", response);
|
|
568
|
+
if (response?.data) {
|
|
569
|
+
FutureManager.initiateFuture(response.data);
|
|
570
|
+
}
|
|
571
|
+
return response?.data;
|
|
572
|
+
} catch (error) {
|
|
573
|
+
log$5.error(
|
|
574
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/preCalibrate`,
|
|
575
|
+
error
|
|
576
|
+
);
|
|
577
|
+
const futureResponse = {
|
|
578
|
+
id: tracker || "",
|
|
579
|
+
endState: FutureEndState.Fail,
|
|
580
|
+
tracker,
|
|
581
|
+
reason: "Failed to resolve trouble"
|
|
582
|
+
};
|
|
583
|
+
FutureManager.initiateFuture(futureResponse);
|
|
584
|
+
return futureResponse;
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
const performCalibrate$1 = async (pump, tracker) => {
|
|
588
|
+
log$5.debug(
|
|
589
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/calibrate`
|
|
590
|
+
);
|
|
591
|
+
try {
|
|
592
|
+
const response = await postModel$3({
|
|
593
|
+
model: {},
|
|
594
|
+
urlOverride: `${URL$4}/api/ext/freestyle/fcm/calibration/${pump}/calibrate`,
|
|
595
|
+
tracker
|
|
596
|
+
});
|
|
597
|
+
log$5.debug("performPreCalibrate - response:", response);
|
|
598
|
+
if (response?.data) {
|
|
599
|
+
FutureManager.initiateFuture(response.data);
|
|
600
|
+
}
|
|
601
|
+
return response?.data;
|
|
602
|
+
} catch (error) {
|
|
603
|
+
log$5.error(
|
|
604
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/calibrate`,
|
|
605
|
+
error
|
|
606
|
+
);
|
|
607
|
+
const futureResponse = {
|
|
608
|
+
id: tracker || "",
|
|
609
|
+
endState: FutureEndState.Fail,
|
|
610
|
+
tracker,
|
|
611
|
+
reason: "Failed to resolve trouble"
|
|
612
|
+
};
|
|
613
|
+
FutureManager.initiateFuture(futureResponse);
|
|
614
|
+
return futureResponse;
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
const performVerify$1 = async (pump, volume, tracker) => {
|
|
618
|
+
log$5.debug(
|
|
619
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/verify/${volume}`
|
|
620
|
+
);
|
|
621
|
+
try {
|
|
622
|
+
const response = await postModel$3({
|
|
623
|
+
model: {},
|
|
624
|
+
urlOverride: `${URL$4}/api/ext/freestyle/fcm/calibration/${pump}/verify/${volume}`,
|
|
625
|
+
tracker
|
|
626
|
+
});
|
|
627
|
+
log$5.debug("performVerify - response:", response);
|
|
628
|
+
if (response?.data) {
|
|
629
|
+
FutureManager.initiateFuture(response.data);
|
|
630
|
+
}
|
|
631
|
+
return response?.data;
|
|
632
|
+
} catch (error) {
|
|
633
|
+
log$5.error(
|
|
634
|
+
`performVerify - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/verify/${volume}`,
|
|
635
|
+
error
|
|
636
|
+
);
|
|
637
|
+
const futureResponse = {
|
|
638
|
+
id: tracker || "",
|
|
639
|
+
endState: FutureEndState.Fail,
|
|
640
|
+
tracker,
|
|
641
|
+
reason: "Failed to resolve trouble"
|
|
642
|
+
};
|
|
643
|
+
FutureManager.initiateFuture(futureResponse);
|
|
644
|
+
return futureResponse;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const processResponse = (response) => {
|
|
648
|
+
if (response) {
|
|
649
|
+
if (response.data === "success" || !response.data) {
|
|
650
|
+
return "success";
|
|
651
|
+
} else {
|
|
652
|
+
return response.data;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return "error";
|
|
656
|
+
};
|
|
657
|
+
const performComplete$1 = async (pump, volume1, volume2) => {
|
|
658
|
+
log$5.debug(
|
|
659
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/complete/${volume1}/${volume2}`
|
|
660
|
+
);
|
|
661
|
+
try {
|
|
662
|
+
const response = await postModel$3({
|
|
663
|
+
model: {},
|
|
664
|
+
urlOverride: `${URL$4}/api/ext/freestyle/fcm/calibration/${pump}/complete/${volume1}/${volume2}`
|
|
665
|
+
});
|
|
666
|
+
log$5.debug("performPreCalibrate - response:", response);
|
|
667
|
+
return processResponse(response?.data);
|
|
668
|
+
} catch (error) {
|
|
669
|
+
log$5.error(
|
|
670
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${pump}/complete/${volume1}/${volume2}`,
|
|
671
|
+
error
|
|
672
|
+
);
|
|
673
|
+
return void 0;
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
var __defProp$7 = Object.defineProperty;
|
|
677
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
678
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
679
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
680
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
681
|
+
if (decorator = decorators[i])
|
|
682
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
683
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
684
|
+
return result;
|
|
685
|
+
};
|
|
686
|
+
const MODEL_TYPE$a = "fcm-pump-model";
|
|
687
|
+
const log$4 = KosLog.createLogger({ name: "fcm-pump-model" });
|
|
688
|
+
let FcmPumpModelImpl = class {
|
|
689
|
+
id;
|
|
690
|
+
logger;
|
|
691
|
+
pumpModel;
|
|
692
|
+
futureHandler;
|
|
693
|
+
constructor(modelId, options, context) {
|
|
694
|
+
this.id = modelId;
|
|
695
|
+
this.logger = context.logger;
|
|
696
|
+
this.pumpModel = options.companionParent;
|
|
697
|
+
this.futureHandler = new FutureHandler(this);
|
|
698
|
+
}
|
|
699
|
+
get future() {
|
|
700
|
+
return this.futureHandler.future;
|
|
701
|
+
}
|
|
702
|
+
get name() {
|
|
703
|
+
return this.pumpModel.name;
|
|
704
|
+
}
|
|
705
|
+
get canPour() {
|
|
706
|
+
return this.pumpModel.canPour;
|
|
707
|
+
}
|
|
708
|
+
get isPouring() {
|
|
709
|
+
return this.pumpModel.isPouring;
|
|
710
|
+
}
|
|
711
|
+
async cancelPour() {
|
|
712
|
+
return this.pumpModel.cancelPour();
|
|
713
|
+
}
|
|
714
|
+
performIntent(props) {
|
|
715
|
+
return this.pumpModel.performIntent(props);
|
|
716
|
+
}
|
|
717
|
+
async performElectricalTest() {
|
|
718
|
+
const [error, data] = await performElectricalTest(this.pumpModel.path);
|
|
719
|
+
if (error) {
|
|
720
|
+
log$4.error(`Failed to perform electrical test on pump ${this.id}`, error);
|
|
721
|
+
}
|
|
722
|
+
return data;
|
|
723
|
+
}
|
|
724
|
+
getChildren() {
|
|
725
|
+
const allFutures = this.futureHandler.allFutures;
|
|
726
|
+
return [...allFutures];
|
|
727
|
+
}
|
|
728
|
+
async performPreCalibrate(tracker) {
|
|
729
|
+
return performPreCalibrate$1(this.pumpModel.path, tracker);
|
|
730
|
+
}
|
|
731
|
+
async performCalibrate(tracker) {
|
|
732
|
+
return performCalibrate$1(this.pumpModel.path, tracker);
|
|
733
|
+
}
|
|
734
|
+
async performVerify(volume, tracker) {
|
|
735
|
+
return performVerify$1(this.pumpModel.path, volume, tracker);
|
|
736
|
+
}
|
|
737
|
+
async performComplete(volume1, volume2) {
|
|
738
|
+
return performComplete$1(this.pumpModel.path, volume1, volume2);
|
|
739
|
+
}
|
|
740
|
+
// -------------------LIFECYCLE----------------------------
|
|
741
|
+
async init() {
|
|
742
|
+
this.logger.debug(`initializing fcm-pump ${this.id}`);
|
|
743
|
+
}
|
|
744
|
+
async load() {
|
|
745
|
+
this.logger.debug(`loading fcm-pump ${this.id}`);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
__decorateClass$a([
|
|
749
|
+
kosFuture()
|
|
750
|
+
], FcmPumpModelImpl.prototype, "performPreCalibrate", 1);
|
|
751
|
+
__decorateClass$a([
|
|
752
|
+
kosFuture()
|
|
753
|
+
], FcmPumpModelImpl.prototype, "performCalibrate", 1);
|
|
754
|
+
__decorateClass$a([
|
|
755
|
+
kosFuture()
|
|
756
|
+
], FcmPumpModelImpl.prototype, "performVerify", 1);
|
|
757
|
+
FcmPumpModelImpl = __decorateClass$a([
|
|
758
|
+
kosModel(MODEL_TYPE$a)
|
|
759
|
+
], FcmPumpModelImpl);
|
|
760
|
+
const FcmPump = new KosModelRegistrationFactory({
|
|
761
|
+
class: FcmPumpModelImpl,
|
|
762
|
+
type: MODEL_TYPE$a
|
|
763
|
+
});
|
|
764
|
+
var __defProp$6 = Object.defineProperty;
|
|
765
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
766
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
767
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
768
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
769
|
+
if (decorator = decorators[i])
|
|
770
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
771
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
772
|
+
return result;
|
|
773
|
+
};
|
|
774
|
+
const MODEL_TYPE$9 = "freestyle-assembly-model";
|
|
775
|
+
const FEATURE_SUPPORTS_ICE = "iceAgitator";
|
|
776
|
+
const FEATURE_SUPPORTS_CARB = "carbTank";
|
|
777
|
+
const FEATURE_SUPPORTS_REMOTE_TRAYS = "remoteTrays";
|
|
778
|
+
let FreestyleAssemblyModelImpl = class {
|
|
779
|
+
id;
|
|
780
|
+
_carbTankModel;
|
|
781
|
+
logger;
|
|
782
|
+
assembly;
|
|
783
|
+
_remoteTrays;
|
|
784
|
+
constructor(modelId, options, context) {
|
|
785
|
+
this.id = modelId;
|
|
786
|
+
this.logger = context.logger;
|
|
787
|
+
this.assembly = options.companionParent;
|
|
788
|
+
}
|
|
789
|
+
get holderGroups() {
|
|
790
|
+
return this.assembly.holderGroups;
|
|
791
|
+
}
|
|
792
|
+
get nozzlePaths() {
|
|
793
|
+
return this.assembly.nozzlePaths;
|
|
794
|
+
}
|
|
795
|
+
get allHolders() {
|
|
796
|
+
return this.assembly.allHolders;
|
|
797
|
+
}
|
|
798
|
+
getHoldersByGroup(group) {
|
|
799
|
+
return this.assembly.getHoldersByGroup(group);
|
|
800
|
+
}
|
|
801
|
+
getHoldersByNozzle(nozzlePath) {
|
|
802
|
+
return this.assembly.getHoldersByNozzle(nozzlePath);
|
|
803
|
+
}
|
|
804
|
+
get pumpsByNozzle() {
|
|
805
|
+
return this.assembly.pumpsByNozzle;
|
|
806
|
+
}
|
|
807
|
+
get pumpPaths() {
|
|
808
|
+
return this.assembly.pumpPaths;
|
|
809
|
+
}
|
|
810
|
+
get boards() {
|
|
811
|
+
return this.assembly.boards;
|
|
812
|
+
}
|
|
813
|
+
updateModel(options) {
|
|
814
|
+
return this.assembly.updateModel(options);
|
|
815
|
+
}
|
|
816
|
+
get iceAgitator() {
|
|
817
|
+
return this.assembly.iceAgitator;
|
|
818
|
+
}
|
|
819
|
+
get carbTank() {
|
|
820
|
+
return this._carbTankModel;
|
|
821
|
+
}
|
|
822
|
+
get cartridgeAgitators() {
|
|
823
|
+
return this.assembly.cartridgeAgitators;
|
|
824
|
+
}
|
|
825
|
+
get defaultCartridgeAgitator() {
|
|
826
|
+
return this.assembly.cartridgeAgitators.data[0];
|
|
827
|
+
}
|
|
828
|
+
get cartridgeAgitatorModels() {
|
|
829
|
+
return this.assembly.cartridgeAgitators.data;
|
|
830
|
+
}
|
|
831
|
+
get hasCartridgeAgitators() {
|
|
832
|
+
return this.assembly.cartridgeAgitators.data.length > 0;
|
|
833
|
+
}
|
|
834
|
+
get remoteTrays() {
|
|
835
|
+
return this.assembly.remoteTrays;
|
|
836
|
+
}
|
|
837
|
+
get hasRemoteTrays() {
|
|
838
|
+
return this.assembly.remoteTrays ? this.assembly.remoteTrays.data.length > 0 : false;
|
|
839
|
+
}
|
|
840
|
+
// -------------------LIFECYCLE----------------------------
|
|
841
|
+
get supportsRemoteTrays() {
|
|
842
|
+
return KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_REMOTE_TRAYS);
|
|
843
|
+
}
|
|
844
|
+
get supportsIce() {
|
|
845
|
+
return KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_ICE);
|
|
846
|
+
}
|
|
847
|
+
get supportsCarb() {
|
|
848
|
+
return KosFeatureFlags.isFeatureEnabled(FEATURE_SUPPORTS_CARB);
|
|
849
|
+
}
|
|
850
|
+
async init() {
|
|
851
|
+
this.logger.debug(`initializing freestyle-assembly ${this.id}`);
|
|
852
|
+
}
|
|
853
|
+
async ready() {
|
|
854
|
+
const _carbTank = getKosCompanionModel(
|
|
855
|
+
this.assembly,
|
|
856
|
+
CarbAgitator.type
|
|
857
|
+
);
|
|
858
|
+
this._carbTankModel = _carbTank;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
__decorateClass$9([
|
|
862
|
+
kosChild
|
|
863
|
+
], FreestyleAssemblyModelImpl.prototype, "_remoteTrays", 2);
|
|
864
|
+
FreestyleAssemblyModelImpl = __decorateClass$9([
|
|
865
|
+
kosParentAware(),
|
|
866
|
+
kosModel(MODEL_TYPE$9)
|
|
867
|
+
], FreestyleAssemblyModelImpl);
|
|
868
|
+
const FreestyleAssembly = new SingletonKosModelRegistrationFactory({
|
|
869
|
+
class: FreestyleAssemblyModelImpl,
|
|
870
|
+
type: MODEL_TYPE$9
|
|
871
|
+
});
|
|
872
|
+
var __defProp$5 = Object.defineProperty;
|
|
873
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
874
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
875
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
876
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
877
|
+
if (decorator = decorators[i])
|
|
878
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
879
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
880
|
+
return result;
|
|
881
|
+
};
|
|
882
|
+
const MODEL_TYPE$8 = "remote-tray-model";
|
|
883
|
+
createPropKey("holderPath");
|
|
884
|
+
const PROP_CONFIG_PATH = createPropKey("configPath");
|
|
885
|
+
let RemoteTrayModelImpl = class {
|
|
886
|
+
/** Unique identifier for the remote tray instance */
|
|
887
|
+
id;
|
|
888
|
+
logger;
|
|
889
|
+
/** Path reference to the associated holder model */
|
|
890
|
+
holderPath;
|
|
891
|
+
/** Configuration path for tray-specific settings */
|
|
892
|
+
configPath;
|
|
893
|
+
/** Display name of the remote tray */
|
|
894
|
+
name;
|
|
895
|
+
remoteTrayEnabled;
|
|
896
|
+
constructor(modelId, options, context) {
|
|
897
|
+
this.id = modelId;
|
|
898
|
+
this.logger = context.logger;
|
|
899
|
+
this.holderPath = options.holderPath;
|
|
900
|
+
this.configPath = options.configPath;
|
|
901
|
+
this.name = options.name;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Gets the troubles from the associated holder model.
|
|
905
|
+
* Propagates trouble states from the holder to this remote tray.
|
|
906
|
+
*
|
|
907
|
+
* @returns Array of trouble models from the holder, or empty array if no holder
|
|
908
|
+
*/
|
|
909
|
+
get troubles() {
|
|
910
|
+
return this.holder?.troubles ?? [];
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Gets the highest priority trouble status.
|
|
914
|
+
* Currently returns empty string as troubles are managed by the holder.
|
|
915
|
+
*
|
|
916
|
+
* @returns Empty string (trouble status handled by holder)
|
|
917
|
+
*/
|
|
918
|
+
get troubleStatus() {
|
|
919
|
+
return "";
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Gets troubles grouped by type from the associated holder.
|
|
923
|
+
*
|
|
924
|
+
* @returns Record of troubles grouped by type from the holder, or empty object if no holder
|
|
925
|
+
*/
|
|
926
|
+
get troublesByType() {
|
|
927
|
+
return this.holder?.troublesByType ?? {};
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Updates the model with new configuration options.
|
|
931
|
+
* Can be used to modify the holder path, config path, or name after initialization.
|
|
932
|
+
*
|
|
933
|
+
* @param _options - New configuration options for the remote tray
|
|
934
|
+
*/
|
|
935
|
+
updateModel(_options) {
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Gets the associated holder model for this remote tray.
|
|
939
|
+
* Uses synchronous model lookup to retrieve the holder by path.
|
|
940
|
+
*
|
|
941
|
+
* @returns The HolderModel instance referenced by holderPath, or undefined if not found
|
|
942
|
+
*/
|
|
943
|
+
get holder() {
|
|
944
|
+
return getKosModelSync(this.holderPath).model;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Determines if the remote tray is currently active.
|
|
948
|
+
* Active state is based on the remoteTrayEnabled configuration property.
|
|
949
|
+
*
|
|
950
|
+
* @returns true if the tray is enabled, false otherwise
|
|
951
|
+
*/
|
|
952
|
+
get active() {
|
|
953
|
+
return !!this.remoteTrayEnabled.value;
|
|
954
|
+
}
|
|
955
|
+
// -------------------LIFECYCLE----------------------------
|
|
956
|
+
/**
|
|
957
|
+
* Initializes the remote tray model.
|
|
958
|
+
* Called during the model lifecycle initialization phase.
|
|
959
|
+
* Sets up initial state and prepares the model for use.
|
|
960
|
+
*
|
|
961
|
+
* @returns Promise that resolves when initialization is complete
|
|
962
|
+
*/
|
|
963
|
+
async init() {
|
|
964
|
+
this.logger.debug(`initializing remote-tray ${this.id}`);
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Loads the remote tray configuration and associated data.
|
|
968
|
+
* Called during the model lifecycle load phase.
|
|
969
|
+
* Typically loads configuration settings and establishes holder references.
|
|
970
|
+
*
|
|
971
|
+
* @returns Promise that resolves when loading is complete
|
|
972
|
+
*/
|
|
973
|
+
async load() {
|
|
974
|
+
this.logger.debug(`loading remote-tray ${this.id}`);
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
__decorateClass$8([
|
|
978
|
+
kosConfigProperty({
|
|
979
|
+
path: PROP_CONFIG_PATH,
|
|
980
|
+
attribute: "enabled"
|
|
981
|
+
})
|
|
982
|
+
], RemoteTrayModelImpl.prototype, "remoteTrayEnabled", 2);
|
|
983
|
+
RemoteTrayModelImpl = __decorateClass$8([
|
|
984
|
+
kosModel(MODEL_TYPE$8)
|
|
985
|
+
], RemoteTrayModelImpl);
|
|
986
|
+
const RemoteTray = new KosModelRegistrationFactory({
|
|
987
|
+
class: RemoteTrayModelImpl,
|
|
988
|
+
type: MODEL_TYPE$8
|
|
989
|
+
});
|
|
990
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
991
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
992
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
993
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
994
|
+
if (decorator = decorators[i])
|
|
995
|
+
result = decorator(result) || result;
|
|
996
|
+
return result;
|
|
997
|
+
};
|
|
998
|
+
const MODEL_TYPE$7 = "remote-tray-container-model";
|
|
999
|
+
let RemoteTrayContainerModelImpl = class {
|
|
1000
|
+
id;
|
|
1001
|
+
constructor(modelId) {
|
|
1002
|
+
this.id = modelId;
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
RemoteTrayContainerModelImpl = __decorateClass$7([
|
|
1006
|
+
kosModel(MODEL_TYPE$7),
|
|
1007
|
+
kosLoggerAware(),
|
|
1008
|
+
kosContainerAware()
|
|
1009
|
+
], RemoteTrayContainerModelImpl);
|
|
1010
|
+
const RemoteTrayContainer = new SingletonKosModelRegistrationFactory({
|
|
1011
|
+
class: RemoteTrayContainerModelImpl,
|
|
1012
|
+
type: MODEL_TYPE$7
|
|
1013
|
+
});
|
|
1014
|
+
RemoteTrayContainer.addRelatedModel(RemoteTray);
|
|
1015
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1016
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
1017
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
1018
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1019
|
+
if (decorator = decorators[i])
|
|
1020
|
+
result = decorator(result) || result;
|
|
1021
|
+
return result;
|
|
1022
|
+
};
|
|
1023
|
+
const MODEL_TYPE$6 = "freestyle-holder-model";
|
|
1024
|
+
function resolveFreestyleAssembly(id) {
|
|
1025
|
+
const context = KosContextManager.getContext(id);
|
|
1026
|
+
const freestyleAssembly = context?.get(
|
|
1027
|
+
FreestyleAssembly.type
|
|
1028
|
+
);
|
|
1029
|
+
if (!freestyleAssembly) {
|
|
1030
|
+
KosLog.error("Freestyle assembly not found");
|
|
1031
|
+
return void 0;
|
|
1032
|
+
}
|
|
1033
|
+
return freestyleAssembly;
|
|
1034
|
+
}
|
|
1035
|
+
async function futureDelegate(model, method) {
|
|
1036
|
+
if (!model || !method) {
|
|
1037
|
+
return void 0;
|
|
1038
|
+
}
|
|
1039
|
+
const response = await model[method]();
|
|
1040
|
+
if (response?.tracker) {
|
|
1041
|
+
return FutureManager.getFuture(response.tracker);
|
|
1042
|
+
}
|
|
1043
|
+
return void 0;
|
|
1044
|
+
}
|
|
1045
|
+
let FreestyleHolderModelImpl = class {
|
|
1046
|
+
id;
|
|
1047
|
+
logger;
|
|
1048
|
+
holder;
|
|
1049
|
+
context;
|
|
1050
|
+
future;
|
|
1051
|
+
constructor(modelId, options, context) {
|
|
1052
|
+
this.id = modelId;
|
|
1053
|
+
this.logger = context.logger;
|
|
1054
|
+
this.context = context.kosContext;
|
|
1055
|
+
this.holder = options.companionParent;
|
|
1056
|
+
}
|
|
1057
|
+
get altName() {
|
|
1058
|
+
return this.holder.attributes["ncui_altName"];
|
|
1059
|
+
}
|
|
1060
|
+
get agitated() {
|
|
1061
|
+
return this.holder.data.agitated;
|
|
1062
|
+
}
|
|
1063
|
+
async agitate() {
|
|
1064
|
+
if (!this.holder.data.agitated) {
|
|
1065
|
+
return void 0;
|
|
1066
|
+
}
|
|
1067
|
+
this.future = void 0;
|
|
1068
|
+
const freestyleAssembly = resolveFreestyleAssembly(this.id);
|
|
1069
|
+
if (!freestyleAssembly) {
|
|
1070
|
+
return void 0;
|
|
1071
|
+
}
|
|
1072
|
+
const agitator = freestyleAssembly.defaultCartridgeAgitator;
|
|
1073
|
+
if (!agitator) {
|
|
1074
|
+
this.logger.error("Agitator not found");
|
|
1075
|
+
return void 0;
|
|
1076
|
+
}
|
|
1077
|
+
this.future = await futureDelegate(
|
|
1078
|
+
freestyleAssembly.defaultCartridgeAgitator,
|
|
1079
|
+
"testAgitate"
|
|
1080
|
+
);
|
|
1081
|
+
return this.future;
|
|
1082
|
+
}
|
|
1083
|
+
get isRemote() {
|
|
1084
|
+
const remoteTrayId = `${RemoteTray.type}-${this.holder.path}`;
|
|
1085
|
+
const remoteTray = getKosModelSync(remoteTrayId);
|
|
1086
|
+
if (!remoteTray?.model) {
|
|
1087
|
+
return false;
|
|
1088
|
+
}
|
|
1089
|
+
return !!remoteTray.model.remoteTrayEnabled.value;
|
|
1090
|
+
}
|
|
1091
|
+
// -------------------LIFECYCLE----------------------------
|
|
1092
|
+
async init() {
|
|
1093
|
+
this.logger.debug(`initializing freestyle-holder ${this.id}`);
|
|
1094
|
+
}
|
|
1095
|
+
async load() {
|
|
1096
|
+
this.logger.debug(`loading freestyle-holder ${this.id}`);
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
FreestyleHolderModelImpl = __decorateClass$6([
|
|
1100
|
+
kosModel(MODEL_TYPE$6)
|
|
1101
|
+
], FreestyleHolderModelImpl);
|
|
1102
|
+
const FreestyleHolder = new KosModelRegistrationFactory({
|
|
1103
|
+
class: FreestyleHolderModelImpl,
|
|
1104
|
+
type: MODEL_TYPE$6
|
|
1105
|
+
});
|
|
1106
|
+
const { URL: URL$3 } = resolveServiceUrl("FREESTYLE-NOZZLE_SERVICE");
|
|
1107
|
+
const { getOne } = ServiceFactory.build({
|
|
1108
|
+
basePath: `${URL$3}/api/freestyle-nozzle`
|
|
1109
|
+
});
|
|
1110
|
+
const log$3 = KosLog.createLogger({
|
|
1111
|
+
name: "freestyle-nozzle-service",
|
|
1112
|
+
group: "Services"
|
|
1113
|
+
});
|
|
1114
|
+
class NutritionInfoError extends Error {
|
|
1115
|
+
constructor(message) {
|
|
1116
|
+
super(message);
|
|
1117
|
+
this.name = "NutritionInfoError";
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
class InvalidRequestError extends Error {
|
|
1121
|
+
constructor(message) {
|
|
1122
|
+
super(message);
|
|
1123
|
+
this.name = "InvalidRequestError";
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
const getFreestyleNutritionInfo = async (nozzleUrlPrefix, beverageId, volumes, baseUrl = "http://localhost:8081") => {
|
|
1127
|
+
log$3.debug("sending GET for freestyle-nozzle");
|
|
1128
|
+
if (!beverageId) {
|
|
1129
|
+
log$3.error("Invalid freestyle-nozzle request: beverageId is required");
|
|
1130
|
+
throw new InvalidRequestError("No beverageId provided");
|
|
1131
|
+
}
|
|
1132
|
+
if (!volumes || volumes.length === 0) {
|
|
1133
|
+
log$3.error("Invalid freestyle-nozzle request: volumes are required");
|
|
1134
|
+
throw new InvalidRequestError("No volumes provided");
|
|
1135
|
+
}
|
|
1136
|
+
const response = await getOne({
|
|
1137
|
+
urlOverride: `${baseUrl}${nozzleUrlPrefix}/pipeline/beverage/engine/nutrition/${beverageId}?volumes=${volumes.join(
|
|
1138
|
+
","
|
|
1139
|
+
)}`
|
|
1140
|
+
});
|
|
1141
|
+
if (!response?.data) {
|
|
1142
|
+
log$3.error("Failed to retrieve freestyle-nozzle data");
|
|
1143
|
+
throw new Error("Failed to retrieve freestyle-nozzle data");
|
|
1144
|
+
}
|
|
1145
|
+
if (response.data.error) {
|
|
1146
|
+
throw new NutritionInfoError(response.data.error);
|
|
1147
|
+
}
|
|
1148
|
+
return response.data;
|
|
1149
|
+
};
|
|
1150
|
+
var __defProp$4 = Object.defineProperty;
|
|
1151
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
1152
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
1153
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
1154
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1155
|
+
if (decorator = decorators[i])
|
|
1156
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1157
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
1158
|
+
return result;
|
|
1159
|
+
};
|
|
1160
|
+
const MODEL_TYPE$5 = "freestyle-nozzle-model";
|
|
1161
|
+
let FreestyleNozzleModelImpl = class {
|
|
1162
|
+
id;
|
|
1163
|
+
logger;
|
|
1164
|
+
nozzleModel;
|
|
1165
|
+
_cupSizes;
|
|
1166
|
+
_nutritionInfo;
|
|
1167
|
+
constructor(modelId, options, context) {
|
|
1168
|
+
this.id = modelId;
|
|
1169
|
+
this.logger = context.logger;
|
|
1170
|
+
this.nozzleModel = options.companionParent;
|
|
1171
|
+
this._cupSizes = [100];
|
|
1172
|
+
}
|
|
1173
|
+
set cupSizes(cupSizes) {
|
|
1174
|
+
this._cupSizes = cupSizes;
|
|
1175
|
+
}
|
|
1176
|
+
get nutritionInfo() {
|
|
1177
|
+
return this._nutritionInfo;
|
|
1178
|
+
}
|
|
1179
|
+
get selectedPourable() {
|
|
1180
|
+
return this.nozzleModel.selectedPourable;
|
|
1181
|
+
}
|
|
1182
|
+
async handleBeverageSelection() {
|
|
1183
|
+
if (this.nozzleModel.selectedPourable.beverage && this._cupSizes.length) {
|
|
1184
|
+
this.logger.debug(
|
|
1185
|
+
`selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`
|
|
1186
|
+
);
|
|
1187
|
+
const beverageId = this.nozzleModel.selectedPourable.beverage.rawId;
|
|
1188
|
+
const prefix = this.nozzleModel.urlPrefix;
|
|
1189
|
+
try {
|
|
1190
|
+
const response = await getFreestyleNutritionInfo(
|
|
1191
|
+
prefix,
|
|
1192
|
+
beverageId,
|
|
1193
|
+
this._cupSizes
|
|
1194
|
+
);
|
|
1195
|
+
kosAction(() => {
|
|
1196
|
+
this._nutritionInfo = response;
|
|
1197
|
+
});
|
|
1198
|
+
} catch (error) {
|
|
1199
|
+
this.logger.error(`Error fetching nutrition info: ${error}`);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
// -------------------LIFECYCLE----------------------------
|
|
1204
|
+
async init() {
|
|
1205
|
+
this.logger.debug(`initializing freestyle-nozzle ${this.id}`);
|
|
1206
|
+
}
|
|
1207
|
+
unload() {
|
|
1208
|
+
this.logger.debug(`unloading freestyle-nozzle ${this.id}`);
|
|
1209
|
+
}
|
|
1210
|
+
async load() {
|
|
1211
|
+
this.logger.debug(`loading freestyle-nozzle ${this.id}`);
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
__decorateClass$5([
|
|
1215
|
+
kosModelEffect({
|
|
1216
|
+
dependencies: (model) => [
|
|
1217
|
+
model.selectedPourable.beverage
|
|
1218
|
+
]
|
|
1219
|
+
})
|
|
1220
|
+
], FreestyleNozzleModelImpl.prototype, "handleBeverageSelection", 1);
|
|
1221
|
+
FreestyleNozzleModelImpl = __decorateClass$5([
|
|
1222
|
+
kosParentAware(),
|
|
1223
|
+
kosModel(MODEL_TYPE$5)
|
|
1224
|
+
], FreestyleNozzleModelImpl);
|
|
1225
|
+
const FreestyleNozzle = new KosModelRegistrationFactory({
|
|
1226
|
+
class: FreestyleNozzleModelImpl,
|
|
1227
|
+
type: MODEL_TYPE$5
|
|
1228
|
+
});
|
|
1229
|
+
const { URL: URL$2 } = resolveServiceUrl("PUMP_SERVICE");
|
|
1230
|
+
const { postModel: postModel$2 } = ServiceFactory.build({
|
|
1231
|
+
basePath: `${URL$2}/api/ext/freestyle/microCalibration`
|
|
1232
|
+
});
|
|
1233
|
+
const log$2 = KosLog.createLogger({
|
|
1234
|
+
name: "freestyle-pump-service",
|
|
1235
|
+
group: "Services"
|
|
1236
|
+
});
|
|
1237
|
+
const replacePump = async (pumpId, code) => {
|
|
1238
|
+
log$2.debug(
|
|
1239
|
+
`replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${pumpId}/code/${code}`
|
|
1240
|
+
);
|
|
1241
|
+
try {
|
|
1242
|
+
const response = await postModel$2({
|
|
1243
|
+
model: {},
|
|
1244
|
+
urlOverride: `${URL$2}/api/ext/freestyle/microCalibration/cal/${pumpId}/code/${code}`
|
|
1245
|
+
});
|
|
1246
|
+
log$2.debug("replacePump - response:", response);
|
|
1247
|
+
if ((response?.status === 200 || response?.status === 499) && response.data?.error) {
|
|
1248
|
+
return [response.data.error || "unknownError", response.data];
|
|
1249
|
+
}
|
|
1250
|
+
return [void 0, response?.data];
|
|
1251
|
+
} catch (error) {
|
|
1252
|
+
log$2.error(
|
|
1253
|
+
`replacePump - sending POST request to /api/cal/${pumpId}/code/${code}`,
|
|
1254
|
+
error
|
|
1255
|
+
);
|
|
1256
|
+
if (error instanceof FetchError) {
|
|
1257
|
+
const errorCode = error.payload?.data?.error || error.payload?.error || "unknownError";
|
|
1258
|
+
return [errorCode, error.payload?.data || { error: errorCode }];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return ["unknownError", { error: "unknownError" }];
|
|
1262
|
+
};
|
|
1263
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
1264
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
1265
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
1266
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1267
|
+
if (decorator = decorators[i])
|
|
1268
|
+
result = decorator(result) || result;
|
|
1269
|
+
return result;
|
|
1270
|
+
};
|
|
1271
|
+
const MODEL_TYPE$4 = "freestyle-pump-model";
|
|
1272
|
+
let FreestylePumpModelImpl = class {
|
|
1273
|
+
id;
|
|
1274
|
+
logger;
|
|
1275
|
+
pump;
|
|
1276
|
+
constructor(modelId, options, context) {
|
|
1277
|
+
this.id = modelId;
|
|
1278
|
+
this.logger = context.logger;
|
|
1279
|
+
this.pump = options.companionParent;
|
|
1280
|
+
}
|
|
1281
|
+
// -------------------LIFECYCLE----------------------------
|
|
1282
|
+
async replacePump(code) {
|
|
1283
|
+
const [error, data] = await replacePump(this.pump.path, code);
|
|
1284
|
+
if (error) {
|
|
1285
|
+
this.logger.error(`Failed to replace the pump, ${this.pump.id}`, error);
|
|
1286
|
+
}
|
|
1287
|
+
return [error, data];
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
FreestylePumpModelImpl = __decorateClass$4([
|
|
1291
|
+
kosModel(MODEL_TYPE$4)
|
|
1292
|
+
], FreestylePumpModelImpl);
|
|
1293
|
+
const FreestylePump = new KosModelRegistrationFactory({
|
|
1294
|
+
class: FreestylePumpModelImpl,
|
|
1295
|
+
type: MODEL_TYPE$4
|
|
1296
|
+
});
|
|
1297
|
+
const { URL: URL$1 } = resolveServiceUrl("ICE_AGITATOR_SERVICE");
|
|
1298
|
+
const { getAll, postModel: postModel$1 } = ServiceFactory.build({
|
|
1299
|
+
basePath: `${URL$1}/api/ext/freestyle/ice`
|
|
1300
|
+
});
|
|
1301
|
+
const log$1 = KosLog.createLogger({
|
|
1302
|
+
name: "ice-agitator-service",
|
|
1303
|
+
group: "Services"
|
|
1304
|
+
});
|
|
1305
|
+
const getIceTypes = async (path) => {
|
|
1306
|
+
log$1.debug("sending GET for ice types");
|
|
1307
|
+
const response = await getAll({
|
|
1308
|
+
urlOverride: `${URL$1}/api/handle/${path}/types`
|
|
1309
|
+
});
|
|
1310
|
+
return response;
|
|
1311
|
+
};
|
|
1312
|
+
const updateIceType = async (agitator, type) => {
|
|
1313
|
+
log$1.debug("sending POST for ice types");
|
|
1314
|
+
const response = await postModel$1({
|
|
1315
|
+
urlOverride: `${URL$1}/api/handle/${agitator}/type/${type}`,
|
|
1316
|
+
model: {}
|
|
1317
|
+
});
|
|
1318
|
+
return response;
|
|
1319
|
+
};
|
|
1320
|
+
const resetIceSetting = async (path) => {
|
|
1321
|
+
const response = await getAll({
|
|
1322
|
+
urlOverride: `${URL$1}/api/kos/config/details/${path}/4`
|
|
1323
|
+
});
|
|
1324
|
+
return response;
|
|
1325
|
+
};
|
|
1326
|
+
const pour = async (path, tracker) => {
|
|
1327
|
+
const response = await postModel$1({
|
|
1328
|
+
model: {},
|
|
1329
|
+
tracker,
|
|
1330
|
+
urlOverride: `${URL$1}/api/handle/${path}/pour`
|
|
1331
|
+
});
|
|
1332
|
+
if (!response?.data) {
|
|
1333
|
+
throw new Error("No response from server");
|
|
1334
|
+
}
|
|
1335
|
+
return response?.data;
|
|
1336
|
+
};
|
|
1337
|
+
const agitate = async (path, tracker) => {
|
|
1338
|
+
const response = await postModel$1({
|
|
1339
|
+
model: {},
|
|
1340
|
+
tracker,
|
|
1341
|
+
urlOverride: `${URL$1}/api/handle/${path}/test/agitation`
|
|
1342
|
+
});
|
|
1343
|
+
if (!response?.data) {
|
|
1344
|
+
throw new Error("No response from server");
|
|
1345
|
+
}
|
|
1346
|
+
return response?.data;
|
|
1347
|
+
};
|
|
1348
|
+
const testGate = async (path, tracker) => {
|
|
1349
|
+
const response = await postModel$1({
|
|
1350
|
+
model: {},
|
|
1351
|
+
tracker,
|
|
1352
|
+
urlOverride: `${URL$1}/api/handle/${path}/test/gate`
|
|
1353
|
+
});
|
|
1354
|
+
if (!response?.data) {
|
|
1355
|
+
throw new Error("No response from server");
|
|
1356
|
+
}
|
|
1357
|
+
return response?.data;
|
|
1358
|
+
};
|
|
1359
|
+
var __defProp$3 = Object.defineProperty;
|
|
1360
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1361
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1362
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1363
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1364
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1365
|
+
if (decorator = decorators[i])
|
|
1366
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1367
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
1368
|
+
return result;
|
|
1369
|
+
};
|
|
1370
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "", value);
|
|
1371
|
+
class IceAgitatorEvents {
|
|
1372
|
+
static TOPIC_AGITATION_STARTED = "/kos/events/ddk/ice-agitation-started";
|
|
1373
|
+
static TOPIC_AGITATION_ENDED = "/kos/events/ddk/ice-agitation-ended";
|
|
1374
|
+
}
|
|
1375
|
+
const MODEL_TYPE$3 = "ice-agitator-model";
|
|
1376
|
+
const PROP_PATH = createPropKey("statePath");
|
|
1377
|
+
let IceAgitatorModelImpl = class {
|
|
1378
|
+
id;
|
|
1379
|
+
name;
|
|
1380
|
+
path;
|
|
1381
|
+
volWithoutIceMl;
|
|
1382
|
+
durationSec;
|
|
1383
|
+
enableIceChuteClear;
|
|
1384
|
+
iceChuteClearDurationMs;
|
|
1385
|
+
iceChuteClearIntervalSec;
|
|
1386
|
+
iceChuteClearRetryIntervalSec;
|
|
1387
|
+
maxDispenseSec;
|
|
1388
|
+
type;
|
|
1389
|
+
dilutionOffset;
|
|
1390
|
+
inactivitySec;
|
|
1391
|
+
agitating;
|
|
1392
|
+
iceChuteOpen;
|
|
1393
|
+
statePath;
|
|
1394
|
+
_allIceTypes;
|
|
1395
|
+
currentState = PourState.IDLE;
|
|
1396
|
+
constructor(modelId, options) {
|
|
1397
|
+
this.id = modelId;
|
|
1398
|
+
this.name = options.name;
|
|
1399
|
+
this.path = options.path;
|
|
1400
|
+
this.statePath = options.statePath;
|
|
1401
|
+
this._allIceTypes = [];
|
|
1402
|
+
}
|
|
1403
|
+
get iceTypes() {
|
|
1404
|
+
return this._allIceTypes;
|
|
1405
|
+
}
|
|
1406
|
+
get isAgitating() {
|
|
1407
|
+
return !!this.agitating.value;
|
|
1408
|
+
}
|
|
1409
|
+
get isIceChuteOpen() {
|
|
1410
|
+
return !!this.iceChuteOpen.value;
|
|
1411
|
+
}
|
|
1412
|
+
// future, pourFuture, agitateFuture, gateFuture getters are now provided by @kosMultipleFutureAware decorator
|
|
1413
|
+
/**
|
|
1414
|
+
* A derived value that indicates if the nozzle is currently pouring a beverage.
|
|
1415
|
+
* @readonly
|
|
1416
|
+
*/
|
|
1417
|
+
get isPouring() {
|
|
1418
|
+
return !!(this.pourFuture && !this.pourFuture?.endState) || this.currentState === PourState.POUR_STARTING || this.currentState === PourState.POURING || this.currentState === PourState.POUR_CANCELING;
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* A derived value that indicates if it is possible to dispense ice.
|
|
1422
|
+
*
|
|
1423
|
+
* The value is observable and will change as the current dispense state changes
|
|
1424
|
+
* @readonly
|
|
1425
|
+
* */
|
|
1426
|
+
get canPour() {
|
|
1427
|
+
return this.currentState === PourState.IDLE;
|
|
1428
|
+
}
|
|
1429
|
+
updateIfCurrent(currentState, nextState) {
|
|
1430
|
+
if (this.currentState === currentState) {
|
|
1431
|
+
kosAction(() => {
|
|
1432
|
+
this.currentState = nextState;
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
async pourIce(tracker) {
|
|
1437
|
+
try {
|
|
1438
|
+
if (this.currentState === PourState.IDLE) {
|
|
1439
|
+
this.updateIfCurrent(PourState.IDLE, PourState.POUR_STARTING);
|
|
1440
|
+
if (!tracker) {
|
|
1441
|
+
throw new Error("No tracker provided");
|
|
1442
|
+
}
|
|
1443
|
+
const result = await pour(this.path, tracker);
|
|
1444
|
+
this.updateIfCurrent(PourState.POUR_STARTING, PourState.POURING);
|
|
1445
|
+
if (result?.endState) {
|
|
1446
|
+
this.updateIfCurrent(PourState.POURING, PourState.IDLE);
|
|
1447
|
+
}
|
|
1448
|
+
return result;
|
|
1449
|
+
} else {
|
|
1450
|
+
throw new Error(`Cannot pour in state ${this.currentState}`);
|
|
1451
|
+
}
|
|
1452
|
+
} catch (e) {
|
|
1453
|
+
this.logger.error(e);
|
|
1454
|
+
this.currentState = PourState.IDLE;
|
|
1455
|
+
throw e;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* An action that will cancel the ice dispense if it is currently in progress.
|
|
1460
|
+
* */
|
|
1461
|
+
async cancelIceDispense() {
|
|
1462
|
+
if (this.currentState === PourState.POURING || this.currentState === PourState.POUR_STARTING) {
|
|
1463
|
+
this.currentState = PourState.POUR_CANCELING;
|
|
1464
|
+
await this.pourFuture?.cancelFuture();
|
|
1465
|
+
kosAction(() => {
|
|
1466
|
+
this.currentState = PourState.IDLE;
|
|
1467
|
+
});
|
|
1468
|
+
} else {
|
|
1469
|
+
this.logger.warn(
|
|
1470
|
+
`Cannot cancel ice dispense in state ${this.currentState}`
|
|
1471
|
+
);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
async testAgitate(tracker) {
|
|
1475
|
+
if (!tracker) {
|
|
1476
|
+
throw new Error("No tracker provided");
|
|
1477
|
+
}
|
|
1478
|
+
this.logger.info(`agitating ice-agitator ${this.id}`);
|
|
1479
|
+
return agitate(this.path, tracker);
|
|
1480
|
+
}
|
|
1481
|
+
async testGate(tracker) {
|
|
1482
|
+
if (!tracker) {
|
|
1483
|
+
throw new Error("No tracker provided");
|
|
1484
|
+
}
|
|
1485
|
+
this.logger.info(`testing ice gate: ${this.id}`);
|
|
1486
|
+
return testGate(this.path, tracker);
|
|
1487
|
+
}
|
|
1488
|
+
handleAgitationChange() {
|
|
1489
|
+
if (this.isAgitating) {
|
|
1490
|
+
this.logger.info(`agitating ice-agitator ${this.id}`);
|
|
1491
|
+
EventBus.publish(IceAgitatorEvents.TOPIC_AGITATION_STARTED, {
|
|
1492
|
+
path: this.path,
|
|
1493
|
+
futureId: this.futureHandler.future?.futureId
|
|
1494
|
+
});
|
|
1495
|
+
} else {
|
|
1496
|
+
EventBus.publish(IceAgitatorEvents.TOPIC_AGITATION_ENDED, {
|
|
1497
|
+
path: this.path
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
async updateIceType(type) {
|
|
1502
|
+
await updateIceType(this.path, type);
|
|
1503
|
+
}
|
|
1504
|
+
resetDefaultValues = async () => {
|
|
1505
|
+
const defaults = await resetIceSetting(this.path);
|
|
1506
|
+
return defaults;
|
|
1507
|
+
};
|
|
1508
|
+
async init() {
|
|
1509
|
+
this.logger.debug(`initializing ice-agitator ${this.id}`);
|
|
1510
|
+
}
|
|
1511
|
+
async load() {
|
|
1512
|
+
try {
|
|
1513
|
+
this.logger.debug(`loading ice-agitator ${this.id}`);
|
|
1514
|
+
const iceTypes = await getIceTypes(this.path);
|
|
1515
|
+
if (iceTypes?.status === 200) {
|
|
1516
|
+
kosAction(() => {
|
|
1517
|
+
this._allIceTypes = iceTypes.data || [];
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
} catch (e) {
|
|
1521
|
+
this.logger.error(e);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
__publicField$2(IceAgitatorModelImpl, "Registration");
|
|
1526
|
+
__decorateClass$3([
|
|
1527
|
+
kosConfigProperty({
|
|
1528
|
+
path: KOS_MODEL_ID,
|
|
1529
|
+
attribute: "settings.volWithoutIceMl"
|
|
1530
|
+
})
|
|
1531
|
+
], IceAgitatorModelImpl.prototype, "volWithoutIceMl", 2);
|
|
1532
|
+
__decorateClass$3([
|
|
1533
|
+
kosConfigProperty({
|
|
1534
|
+
path: KOS_MODEL_ID,
|
|
1535
|
+
attribute: "settings.durationSec",
|
|
1536
|
+
converter: {
|
|
1537
|
+
to: "second"
|
|
1538
|
+
}
|
|
1539
|
+
})
|
|
1540
|
+
], IceAgitatorModelImpl.prototype, "durationSec", 2);
|
|
1541
|
+
__decorateClass$3([
|
|
1542
|
+
kosConfigProperty({
|
|
1543
|
+
path: KOS_MODEL_ID,
|
|
1544
|
+
attribute: "enableIceChuteClear"
|
|
1545
|
+
})
|
|
1546
|
+
], IceAgitatorModelImpl.prototype, "enableIceChuteClear", 2);
|
|
1547
|
+
__decorateClass$3([
|
|
1548
|
+
kosConfigProperty({
|
|
1549
|
+
path: KOS_MODEL_ID,
|
|
1550
|
+
attribute: "iceChuteClearDurationMs"
|
|
1551
|
+
})
|
|
1552
|
+
], IceAgitatorModelImpl.prototype, "iceChuteClearDurationMs", 2);
|
|
1553
|
+
__decorateClass$3([
|
|
1554
|
+
kosConfigProperty({
|
|
1555
|
+
path: KOS_MODEL_ID,
|
|
1556
|
+
attribute: "iceChuteClearIntervalSec"
|
|
1557
|
+
})
|
|
1558
|
+
], IceAgitatorModelImpl.prototype, "iceChuteClearIntervalSec", 2);
|
|
1559
|
+
__decorateClass$3([
|
|
1560
|
+
kosConfigProperty({
|
|
1561
|
+
path: KOS_MODEL_ID,
|
|
1562
|
+
attribute: "iceChuteClearRetryIntervalSec"
|
|
1563
|
+
})
|
|
1564
|
+
], IceAgitatorModelImpl.prototype, "iceChuteClearRetryIntervalSec", 2);
|
|
1565
|
+
__decorateClass$3([
|
|
1566
|
+
kosConfigProperty({
|
|
1567
|
+
path: KOS_MODEL_ID,
|
|
1568
|
+
attribute: "maxDispenseSec"
|
|
1569
|
+
})
|
|
1570
|
+
], IceAgitatorModelImpl.prototype, "maxDispenseSec", 2);
|
|
1571
|
+
__decorateClass$3([
|
|
1572
|
+
kosConfigProperty({
|
|
1573
|
+
path: KOS_MODEL_ID,
|
|
1574
|
+
attribute: "type"
|
|
1575
|
+
})
|
|
1576
|
+
], IceAgitatorModelImpl.prototype, "type", 2);
|
|
1577
|
+
__decorateClass$3([
|
|
1578
|
+
kosConfigProperty({
|
|
1579
|
+
path: KOS_MODEL_ID,
|
|
1580
|
+
attribute: "settings.dilutionOffset"
|
|
1581
|
+
})
|
|
1582
|
+
], IceAgitatorModelImpl.prototype, "dilutionOffset", 2);
|
|
1583
|
+
__decorateClass$3([
|
|
1584
|
+
kosConfigProperty({
|
|
1585
|
+
path: KOS_MODEL_ID,
|
|
1586
|
+
attribute: "settings.inactivitySec",
|
|
1587
|
+
converter: {
|
|
1588
|
+
to: "minute"
|
|
1589
|
+
}
|
|
1590
|
+
})
|
|
1591
|
+
], IceAgitatorModelImpl.prototype, "inactivitySec", 2);
|
|
1592
|
+
__decorateClass$3([
|
|
1593
|
+
kosStateProp({ path: PROP_PATH, attribute: "agitating" })
|
|
1594
|
+
], IceAgitatorModelImpl.prototype, "agitating", 2);
|
|
1595
|
+
__decorateClass$3([
|
|
1596
|
+
kosStateProp({ path: PROP_PATH, attribute: "iceChuteOpen" })
|
|
1597
|
+
], IceAgitatorModelImpl.prototype, "iceChuteOpen", 2);
|
|
1598
|
+
__decorateClass$3([
|
|
1599
|
+
kosFuture({ alias: "pour" })
|
|
1600
|
+
], IceAgitatorModelImpl.prototype, "pourIce", 1);
|
|
1601
|
+
__decorateClass$3([
|
|
1602
|
+
kosFuture({ alias: "agitate" })
|
|
1603
|
+
], IceAgitatorModelImpl.prototype, "testAgitate", 1);
|
|
1604
|
+
__decorateClass$3([
|
|
1605
|
+
kosFuture({
|
|
1606
|
+
alias: "gate"
|
|
1607
|
+
})
|
|
1608
|
+
], IceAgitatorModelImpl.prototype, "testGate", 1);
|
|
1609
|
+
__decorateClass$3([
|
|
1610
|
+
kosModelEffect({
|
|
1611
|
+
dependencies: (model) => [model.isAgitating]
|
|
1612
|
+
})
|
|
1613
|
+
], IceAgitatorModelImpl.prototype, "handleAgitationChange", 1);
|
|
1614
|
+
IceAgitatorModelImpl = __decorateClass$3([
|
|
1615
|
+
kosModel({ modelTypeId: MODEL_TYPE$3, singleton: false }),
|
|
1616
|
+
kosLoggerAware(),
|
|
1617
|
+
kosMultipleFutureAware()
|
|
1618
|
+
], IceAgitatorModelImpl);
|
|
1619
|
+
const IceAgitator = IceAgitatorModelImpl.Registration;
|
|
1620
|
+
var __defProp$2 = Object.defineProperty;
|
|
1621
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
1622
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1623
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1624
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
1625
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1626
|
+
if (decorator = decorators[i])
|
|
1627
|
+
result = decorator(result) || result;
|
|
1628
|
+
return result;
|
|
1629
|
+
};
|
|
1630
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "", value);
|
|
1631
|
+
const MODEL_TYPE$2 = "lfcv-pump-model";
|
|
1632
|
+
let LfcvPumpModelImpl = class {
|
|
1633
|
+
id;
|
|
1634
|
+
constructor(modelId, _options) {
|
|
1635
|
+
this.id = modelId;
|
|
1636
|
+
}
|
|
1637
|
+
get name() {
|
|
1638
|
+
return this.pumpModel.name;
|
|
1639
|
+
}
|
|
1640
|
+
get canPour() {
|
|
1641
|
+
return this.pumpModel.canPour;
|
|
1642
|
+
}
|
|
1643
|
+
get isPouring() {
|
|
1644
|
+
return this.pumpModel.isPouring;
|
|
1645
|
+
}
|
|
1646
|
+
async cancelPour() {
|
|
1647
|
+
return this.pumpModel.cancelPour();
|
|
1648
|
+
}
|
|
1649
|
+
performIntent(props) {
|
|
1650
|
+
return this.pumpModel.performIntent(props);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
__publicField$1(LfcvPumpModelImpl, "Registration");
|
|
1654
|
+
LfcvPumpModelImpl = __decorateClass$2([
|
|
1655
|
+
kosModel({ modelTypeId: MODEL_TYPE$2, singleton: false }),
|
|
1656
|
+
kosLoggerAware(),
|
|
1657
|
+
kosCompanion({
|
|
1658
|
+
mode: "composition",
|
|
1659
|
+
parentProperty: "pumpModel"
|
|
1660
|
+
})
|
|
1661
|
+
], LfcvPumpModelImpl);
|
|
1662
|
+
const LfcvPump = LfcvPumpModelImpl.Registration;
|
|
1663
|
+
const { URL } = resolveServiceUrl("SPM-PUMP_SERVICE");
|
|
1664
|
+
const { postModel } = ServiceFactory.build({
|
|
1665
|
+
basePath: `${URL}/api/spm-pump`
|
|
1666
|
+
});
|
|
1667
|
+
const log = KosLog.createLogger({
|
|
1668
|
+
name: "spm-pump-service",
|
|
1669
|
+
group: "Services"
|
|
1670
|
+
});
|
|
1671
|
+
const performPreCalibrate = async (pump, tracker) => {
|
|
1672
|
+
log.debug(
|
|
1673
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/preCalibrate`
|
|
1674
|
+
);
|
|
1675
|
+
try {
|
|
1676
|
+
const response = await postModel({
|
|
1677
|
+
model: {},
|
|
1678
|
+
urlOverride: `${URL}/api/ext/freestyle/microCalibration/pour/${pump}/preCalibrate`,
|
|
1679
|
+
tracker
|
|
1680
|
+
});
|
|
1681
|
+
log.debug("performPreCalibrate - response:", response);
|
|
1682
|
+
if (response?.data) {
|
|
1683
|
+
FutureManager.initiateFuture(response.data);
|
|
1684
|
+
}
|
|
1685
|
+
return response?.data;
|
|
1686
|
+
} catch (error) {
|
|
1687
|
+
log.error(
|
|
1688
|
+
`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/preCalibrate`,
|
|
1689
|
+
error
|
|
1690
|
+
);
|
|
1691
|
+
const futureResponse = {
|
|
1692
|
+
id: tracker || "",
|
|
1693
|
+
endState: FutureEndState.Fail,
|
|
1694
|
+
tracker,
|
|
1695
|
+
reason: "Failed to resolve trouble"
|
|
1696
|
+
};
|
|
1697
|
+
FutureManager.initiateFuture(futureResponse);
|
|
1698
|
+
return futureResponse;
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
const performCalibrate = async (pump, tracker) => {
|
|
1702
|
+
log.debug(
|
|
1703
|
+
`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/calibrate`
|
|
1704
|
+
);
|
|
1705
|
+
try {
|
|
1706
|
+
const response = await postModel({
|
|
1707
|
+
model: {},
|
|
1708
|
+
urlOverride: `${URL}/api/ext/freestyle/microCalibration/pour/${pump}/calibrate`,
|
|
1709
|
+
tracker
|
|
1710
|
+
});
|
|
1711
|
+
log.debug("performCalibrate - response:", response);
|
|
1712
|
+
if (response?.data) {
|
|
1713
|
+
FutureManager.initiateFuture(response.data);
|
|
1714
|
+
}
|
|
1715
|
+
return response?.data;
|
|
1716
|
+
} catch (error) {
|
|
1717
|
+
log.error(
|
|
1718
|
+
`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/calibrate`,
|
|
1719
|
+
error
|
|
1720
|
+
);
|
|
1721
|
+
const futureResponse = {
|
|
1722
|
+
id: tracker || "",
|
|
1723
|
+
endState: FutureEndState.Fail,
|
|
1724
|
+
tracker,
|
|
1725
|
+
reason: "Failed to resolve trouble"
|
|
1726
|
+
};
|
|
1727
|
+
FutureManager.initiateFuture(futureResponse);
|
|
1728
|
+
return futureResponse;
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
const performVerify = async (pump, volume, payload, tracker) => {
|
|
1732
|
+
log.debug(
|
|
1733
|
+
`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/verify`
|
|
1734
|
+
);
|
|
1735
|
+
try {
|
|
1736
|
+
const response = await postModel({
|
|
1737
|
+
model: {
|
|
1738
|
+
...payload,
|
|
1739
|
+
// commandedCalibrationVolume: 0,
|
|
1740
|
+
measuredCalibrationVolume: volume
|
|
1741
|
+
// measuredVerificationVolume: 0,
|
|
1742
|
+
// newCalibrationValue: 0,
|
|
1743
|
+
// pouredCalibrationVolume: 0,
|
|
1744
|
+
},
|
|
1745
|
+
urlOverride: `${URL}/api/ext/freestyle/microCalibration/pour/${pump}/verify`,
|
|
1746
|
+
tracker
|
|
1747
|
+
});
|
|
1748
|
+
log.debug("performVerify - response:", response);
|
|
1749
|
+
if (response?.data) {
|
|
1750
|
+
FutureManager.initiateFuture(response.data);
|
|
1751
|
+
}
|
|
1752
|
+
return response?.data;
|
|
1753
|
+
} catch (error) {
|
|
1754
|
+
log.error(
|
|
1755
|
+
`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/verify`,
|
|
1756
|
+
error
|
|
1757
|
+
);
|
|
1758
|
+
const futureResponse = {
|
|
1759
|
+
id: tracker || "",
|
|
1760
|
+
endState: FutureEndState.Fail,
|
|
1761
|
+
tracker,
|
|
1762
|
+
reason: "Failed to resolve trouble"
|
|
1763
|
+
};
|
|
1764
|
+
FutureManager.initiateFuture(futureResponse);
|
|
1765
|
+
return futureResponse;
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
const performComplete = async (pump, volume1, volume2, payload) => {
|
|
1769
|
+
log.debug(
|
|
1770
|
+
`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/complete`
|
|
1771
|
+
);
|
|
1772
|
+
try {
|
|
1773
|
+
const response = await postModel({
|
|
1774
|
+
model: {
|
|
1775
|
+
...payload,
|
|
1776
|
+
// commandedCalibrationVolume: 0,
|
|
1777
|
+
measuredCalibrationVolume: volume1,
|
|
1778
|
+
measuredVerificationVolume: volume2
|
|
1779
|
+
// newCalibrationValue: 0,
|
|
1780
|
+
// pouredCalibrationVolume: 0,
|
|
1781
|
+
},
|
|
1782
|
+
urlOverride: `${URL}/api/ext/freestyle/microCalibration/pour/${pump}/complete`
|
|
1783
|
+
});
|
|
1784
|
+
log.debug("performComplete - response:", response);
|
|
1785
|
+
if ((response?.status === 200 || response?.status === 499) && response.data?.error) {
|
|
1786
|
+
return [response.data.error || "unknownError", response.data];
|
|
1787
|
+
}
|
|
1788
|
+
return [void 0, response?.data];
|
|
1789
|
+
} catch (error) {
|
|
1790
|
+
log.error(
|
|
1791
|
+
`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${pump}/complete`,
|
|
1792
|
+
error
|
|
1793
|
+
);
|
|
1794
|
+
if (error instanceof FetchError) {
|
|
1795
|
+
const errorCode = error.payload?.data?.error || error.payload?.error || "unknownError";
|
|
1796
|
+
return [errorCode, error.payload?.data || { error: errorCode }];
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
return ["unknownError", { error: "unknownError" }];
|
|
1800
|
+
};
|
|
1801
|
+
var __defProp$1 = Object.defineProperty;
|
|
1802
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1803
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1804
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
1805
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1806
|
+
if (decorator = decorators[i])
|
|
1807
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1808
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
1809
|
+
return result;
|
|
1810
|
+
};
|
|
1811
|
+
const MODEL_TYPE$1 = "spm-pump-model";
|
|
1812
|
+
let SpmPumpModelImpl = class {
|
|
1813
|
+
id;
|
|
1814
|
+
logger;
|
|
1815
|
+
pump;
|
|
1816
|
+
futureHandler;
|
|
1817
|
+
constructor(modelId, options, context) {
|
|
1818
|
+
this.id = modelId;
|
|
1819
|
+
this.logger = context.logger;
|
|
1820
|
+
this.pump = options.companionParent;
|
|
1821
|
+
this.futureHandler = new FutureHandler(this);
|
|
1822
|
+
}
|
|
1823
|
+
get name() {
|
|
1824
|
+
return this.pump.name;
|
|
1825
|
+
}
|
|
1826
|
+
get canPour() {
|
|
1827
|
+
return this.pump.canPour;
|
|
1828
|
+
}
|
|
1829
|
+
get isPouring() {
|
|
1830
|
+
return this.pump.isPouring;
|
|
1831
|
+
}
|
|
1832
|
+
async cancelPour() {
|
|
1833
|
+
return this.pump.cancelPour();
|
|
1834
|
+
}
|
|
1835
|
+
performIntent(props) {
|
|
1836
|
+
return this.pump.performIntent(props);
|
|
1837
|
+
}
|
|
1838
|
+
get future() {
|
|
1839
|
+
return this.futureHandler.future;
|
|
1840
|
+
}
|
|
1841
|
+
async performPreCalibrate(tracker) {
|
|
1842
|
+
return performPreCalibrate(this.pump.path, tracker);
|
|
1843
|
+
}
|
|
1844
|
+
async performCalibrate(tracker) {
|
|
1845
|
+
return performCalibrate(this.pump.path, tracker);
|
|
1846
|
+
}
|
|
1847
|
+
async performVerify(volume, payload, tracker) {
|
|
1848
|
+
return performVerify(this.pump.path, volume, payload, tracker);
|
|
1849
|
+
}
|
|
1850
|
+
async performComplete(volume1, volume2, payload) {
|
|
1851
|
+
return performComplete(this.pump.path, volume1, volume2, payload);
|
|
1852
|
+
}
|
|
1853
|
+
// -------------------LIFECYCLE----------------------------
|
|
1854
|
+
async init() {
|
|
1855
|
+
this.logger.debug(`initializing spm-pump ${this.id}`);
|
|
1856
|
+
}
|
|
1857
|
+
async load() {
|
|
1858
|
+
this.logger.debug(`loading spm-pump ${this.id}`);
|
|
1859
|
+
}
|
|
1860
|
+
};
|
|
1861
|
+
__decorateClass$1([
|
|
1862
|
+
kosFuture()
|
|
1863
|
+
], SpmPumpModelImpl.prototype, "performPreCalibrate", 1);
|
|
1864
|
+
__decorateClass$1([
|
|
1865
|
+
kosFuture()
|
|
1866
|
+
], SpmPumpModelImpl.prototype, "performCalibrate", 1);
|
|
1867
|
+
__decorateClass$1([
|
|
1868
|
+
kosFuture()
|
|
1869
|
+
], SpmPumpModelImpl.prototype, "performVerify", 1);
|
|
1870
|
+
SpmPumpModelImpl = __decorateClass$1([
|
|
1871
|
+
kosModel(MODEL_TYPE$1)
|
|
1872
|
+
], SpmPumpModelImpl);
|
|
1873
|
+
const SpmPump = new KosModelRegistrationFactory({
|
|
1874
|
+
class: SpmPumpModelImpl,
|
|
1875
|
+
type: MODEL_TYPE$1
|
|
1876
|
+
});
|
|
1877
|
+
var __defProp = Object.defineProperty;
|
|
1878
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1879
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1880
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
1881
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
1882
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1883
|
+
if (decorator = decorators[i])
|
|
1884
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1885
|
+
if (kind && result) __defProp(target, key, result);
|
|
1886
|
+
return result;
|
|
1887
|
+
};
|
|
1888
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
1889
|
+
const MODEL_TYPE = "agitation-required-trouble-model";
|
|
1890
|
+
const agitationModelFactory = (troubleModel) => {
|
|
1891
|
+
if (troubleModel.data.agitationRequired) {
|
|
1892
|
+
return MODEL_TYPE;
|
|
1893
|
+
}
|
|
1894
|
+
return void 0;
|
|
1895
|
+
};
|
|
1896
|
+
const AGITATION_REQUIRED_TROUBLE = "InsufficientAgitationTrouble";
|
|
1897
|
+
let AgitationRequiredTroubleModelImpl = class {
|
|
1898
|
+
/**
|
|
1899
|
+
* Unique identifier for this model instance.
|
|
1900
|
+
*/
|
|
1901
|
+
id;
|
|
1902
|
+
_deferred;
|
|
1903
|
+
_holdersLoaded = false;
|
|
1904
|
+
agitateBeforePour;
|
|
1905
|
+
/**
|
|
1906
|
+
* Creates a new AgitationRequiredTrouble model instance.
|
|
1907
|
+
*
|
|
1908
|
+
* @param modelId - Unique identifier for this model instance (typically matches parent trouble ID)
|
|
1909
|
+
*/
|
|
1910
|
+
constructor(modelId) {
|
|
1911
|
+
this.id = modelId;
|
|
1912
|
+
this._deferred = false;
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Resolves the agitation trouble by delegating to the parent trouble model.
|
|
1916
|
+
*
|
|
1917
|
+
* Resolution typically involves completing the agitation process and clearing
|
|
1918
|
+
* the trouble state once carbonation or mixing levels are acceptable.
|
|
1919
|
+
*
|
|
1920
|
+
* @returns Promise resolving to the future response from the parent trouble's resolution
|
|
1921
|
+
*/
|
|
1922
|
+
async resolve() {
|
|
1923
|
+
return this.trouble.resolve();
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Gets the holder model associated with this agitation trouble.
|
|
1927
|
+
*
|
|
1928
|
+
* The holder is the physical container (cartridge holder, ingredient holder, etc.)
|
|
1929
|
+
* that requires agitation. Returns undefined if the holder model hasn't been
|
|
1930
|
+
* loaded yet through the Assembly model initialization.
|
|
1931
|
+
*
|
|
1932
|
+
* @returns The holder model or undefined if not yet loaded
|
|
1933
|
+
*/
|
|
1934
|
+
get holder() {
|
|
1935
|
+
if (!this.trouble) {
|
|
1936
|
+
return void 0;
|
|
1937
|
+
}
|
|
1938
|
+
const holderPath = this.trouble.data.holderPaths[0];
|
|
1939
|
+
const holderModel = getKosModelSync(holderPath);
|
|
1940
|
+
if (!this._holdersLoaded && !holderModel.model) {
|
|
1941
|
+
return void 0;
|
|
1942
|
+
}
|
|
1943
|
+
return holderModel?.model;
|
|
1944
|
+
}
|
|
1945
|
+
updateHolder() {
|
|
1946
|
+
if (!this._holdersLoaded && !!this.trouble) {
|
|
1947
|
+
const holderPath = this.trouble.data.holderPaths[0];
|
|
1948
|
+
const holderModel = getKosModelSync(holderPath);
|
|
1949
|
+
if (holderModel.model) {
|
|
1950
|
+
this._holdersLoaded = true;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Determines if trouble resolution should be deferred until agitation completes.
|
|
1956
|
+
*
|
|
1957
|
+
* Trouble resolution is deferred when:
|
|
1958
|
+
* 1. The holder has active insufficient agitation troubles
|
|
1959
|
+
* 2. The `agitateBeforePour` configuration is enabled
|
|
1960
|
+
*
|
|
1961
|
+
* This ensures that operations requiring agitation (prime, purge, or other
|
|
1962
|
+
* holder-related troubles) wait for proper carbonation or mixing before
|
|
1963
|
+
* being marked as resolved.
|
|
1964
|
+
*
|
|
1965
|
+
* @returns true if trouble resolution should wait for agitation to complete
|
|
1966
|
+
*/
|
|
1967
|
+
get shouldDefer() {
|
|
1968
|
+
if (!this.holder) {
|
|
1969
|
+
return true;
|
|
1970
|
+
}
|
|
1971
|
+
const troubleList = this.holder?.troublesByType[AGITATION_REQUIRED_TROUBLE] || [];
|
|
1972
|
+
const hasInsufficientAgitationTrouble = troubleList.length > 0;
|
|
1973
|
+
const waitForAgitation = !!this.agitateBeforePour?.value;
|
|
1974
|
+
return waitForAgitation && hasInsufficientAgitationTrouble;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Gets the current deferral state of this trouble.
|
|
1978
|
+
*
|
|
1979
|
+
* @returns true if this trouble resolution is currently deferred
|
|
1980
|
+
*/
|
|
1981
|
+
get deferred() {
|
|
1982
|
+
return this._deferred;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Marks this trouble as deferred, preventing immediate resolution.
|
|
1986
|
+
*
|
|
1987
|
+
* Called by the trouble system to indicate that trouble resolution
|
|
1988
|
+
* should wait for agitation to complete before being marked as resolved.
|
|
1989
|
+
*/
|
|
1990
|
+
defer() {
|
|
1991
|
+
this._deferred = true;
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Clears the deferral state, allowing trouble resolution to proceed.
|
|
1995
|
+
*
|
|
1996
|
+
* Typically called after agitation has completed and the trouble can
|
|
1997
|
+
* now be safely resolved.
|
|
1998
|
+
*/
|
|
1999
|
+
clearDefer() {
|
|
2000
|
+
this._deferred = false;
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
2003
|
+
__publicField(AgitationRequiredTroubleModelImpl, "Registration");
|
|
2004
|
+
__decorateClass([
|
|
2005
|
+
kosConfigProperty({
|
|
2006
|
+
path: "app:kosdev.ddk:app",
|
|
2007
|
+
attribute: "ncui.agitateBeforePour"
|
|
2008
|
+
})
|
|
2009
|
+
], AgitationRequiredTroubleModelImpl.prototype, "agitateBeforePour", 2);
|
|
2010
|
+
__decorateClass([
|
|
2011
|
+
kosTopicHandler({
|
|
2012
|
+
topic: modelTypeEventTopicFactory(Assembly.type),
|
|
2013
|
+
lifecycle: DependencyLifecycle.INIT
|
|
2014
|
+
})
|
|
2015
|
+
], AgitationRequiredTroubleModelImpl.prototype, "updateHolder", 1);
|
|
2016
|
+
AgitationRequiredTroubleModelImpl = __decorateClass([
|
|
2017
|
+
kosModel({ modelTypeId: MODEL_TYPE, singleton: false }),
|
|
2018
|
+
kosLoggerAware(),
|
|
2019
|
+
kosCompanion({ mode: "composition", parentProperty: "trouble" })
|
|
2020
|
+
], AgitationRequiredTroubleModelImpl);
|
|
2021
|
+
const AgitationRequiredTrouble = AgitationRequiredTroubleModelImpl.Registration;
|
|
2022
|
+
const AGITATOR_KEYS = ["iceAgitator"];
|
|
2023
|
+
const AGITATOR_FACTORY_MAP = {
|
|
2024
|
+
iceAgitator: IceAgitator
|
|
2025
|
+
};
|
|
2026
|
+
const logger = KosLog.createLogger({ name: "freestyle-assembly-data-mapper" });
|
|
2027
|
+
const freestyleAssemblyDataMapper = async (data) => {
|
|
2028
|
+
const cartridgeAgitators = CartridgeAgitatorContainer.instance().options({}).build();
|
|
2029
|
+
const remoteTrays = RemoteTrayContainer.instance().options({}).build();
|
|
2030
|
+
const response = data.assemblies.reduce((acc, assembly) => {
|
|
2031
|
+
AGITATOR_KEYS.forEach((key) => {
|
|
2032
|
+
const agitator = assembly[key];
|
|
2033
|
+
if (agitator) {
|
|
2034
|
+
const factory = AGITATOR_FACTORY_MAP[key];
|
|
2035
|
+
acc[key] = factory.instance(agitator.path).options({
|
|
2036
|
+
name: agitator.name,
|
|
2037
|
+
path: agitator.path,
|
|
2038
|
+
statePath: agitator.state?.path || ""
|
|
2039
|
+
}).build();
|
|
2040
|
+
}
|
|
2041
|
+
});
|
|
2042
|
+
assembly.cartridgeAgitators?.forEach((cartridgeAgitatorData) => {
|
|
2043
|
+
const cartridgeAgitator = CartridgeAgitator.instance(
|
|
2044
|
+
cartridgeAgitatorData.path
|
|
2045
|
+
).options({
|
|
2046
|
+
name: cartridgeAgitatorData.name,
|
|
2047
|
+
path: cartridgeAgitatorData.path,
|
|
2048
|
+
statePath: cartridgeAgitatorData.state?.path || ""
|
|
2049
|
+
}).build();
|
|
2050
|
+
cartridgeAgitators.addModel(cartridgeAgitator);
|
|
2051
|
+
});
|
|
2052
|
+
if (assembly.remoteTrays) {
|
|
2053
|
+
assembly.remoteTrays.forEach((tray) => {
|
|
2054
|
+
logger.info(`Found remote tray ${tray.name} with path ${tray.path}`);
|
|
2055
|
+
const trayId = `${RemoteTray.type}-${tray.holderPath}`;
|
|
2056
|
+
const trayModel = RemoteTray.instance(trayId).options({
|
|
2057
|
+
holderPath: tray.holderPath,
|
|
2058
|
+
configPath: tray.path,
|
|
2059
|
+
name: tray.name
|
|
2060
|
+
}).build();
|
|
2061
|
+
remoteTrays.addModel(trayModel);
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
return acc;
|
|
2065
|
+
}, {});
|
|
2066
|
+
const supportsIce = !!response.iceAgitator;
|
|
2067
|
+
const supportsCarb = !!response["carbTank"];
|
|
2068
|
+
return {
|
|
2069
|
+
...response,
|
|
2070
|
+
cartridgeAgitators,
|
|
2071
|
+
remoteTrays,
|
|
2072
|
+
supportsCarb,
|
|
2073
|
+
supportsIce
|
|
2074
|
+
};
|
|
2075
|
+
};
|
|
2076
|
+
const registerFreestyleModels = (root) => () => {
|
|
2077
|
+
registerCoreModels(root)();
|
|
2078
|
+
registerDispenseModels(root)();
|
|
2079
|
+
FreestyleNozzle.register();
|
|
2080
|
+
FreestyleAssembly.register();
|
|
2081
|
+
IceAgitator.register();
|
|
2082
|
+
CarbAgitator.register();
|
|
2083
|
+
CartridgeAgitatorContainer.register();
|
|
2084
|
+
SpmPump.register();
|
|
2085
|
+
FcmPump.register();
|
|
2086
|
+
LfcvPump.register();
|
|
2087
|
+
CgpPump.register();
|
|
2088
|
+
FreestylePump.register();
|
|
2089
|
+
FreestyleHolder.register();
|
|
2090
|
+
RemoteTray.register();
|
|
2091
|
+
RemoteTrayContainer.register();
|
|
2092
|
+
RegistrationManager.companion.register(root)(
|
|
2093
|
+
Nozzle.type,
|
|
2094
|
+
FreestyleNozzle.type
|
|
2095
|
+
);
|
|
2096
|
+
RegistrationManager.companion.register(root)(
|
|
2097
|
+
Assembly.type,
|
|
2098
|
+
FreestyleAssembly.type
|
|
2099
|
+
);
|
|
2100
|
+
AgitationRequiredTrouble.register();
|
|
2101
|
+
RegistrationManager.companion.register(root)(
|
|
2102
|
+
Trouble.type,
|
|
2103
|
+
agitationModelFactory
|
|
2104
|
+
);
|
|
2105
|
+
RegistrationManager.companion.register(root)(Pump.type, FreestylePump.type);
|
|
2106
|
+
RegistrationManager.companion.register(root)(
|
|
2107
|
+
Holder.type,
|
|
2108
|
+
FreestyleHolder.type
|
|
2109
|
+
);
|
|
2110
|
+
ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
2111
|
+
"EnjoyByTrouble",
|
|
2112
|
+
async (trouble) => {
|
|
2113
|
+
if (trouble.data.enjoyByDate) {
|
|
2114
|
+
const enjoyByDate = new Date(trouble.data.enjoyByDate);
|
|
2115
|
+
const now = /* @__PURE__ */ new Date();
|
|
2116
|
+
const daysSinceEnjoyBy = Math.floor(
|
|
2117
|
+
(now.getTime() - enjoyByDate.getTime()) / (1e3 * 60 * 60 * 24)
|
|
2118
|
+
);
|
|
2119
|
+
return {
|
|
2120
|
+
enjoyByDays: daysSinceEnjoyBy || ""
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2123
|
+
return {};
|
|
2124
|
+
}
|
|
2125
|
+
);
|
|
2126
|
+
ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
2127
|
+
"SuperPumpRequiredTrouble",
|
|
2128
|
+
// This is the trouble type
|
|
2129
|
+
async (_trouble) => {
|
|
2130
|
+
const { model: pumpContainer } = getKosModelSync(
|
|
2131
|
+
PumpContainer.type
|
|
2132
|
+
);
|
|
2133
|
+
if (pumpContainer) {
|
|
2134
|
+
const superPumpModels = pumpContainer.models.getIndexByKey(
|
|
2135
|
+
PumpIndex.byType,
|
|
2136
|
+
"microSuper"
|
|
2137
|
+
);
|
|
2138
|
+
const superPumps = superPumpModels.map((model) => model.name).join(", ");
|
|
2139
|
+
return {
|
|
2140
|
+
superPumps
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
return {};
|
|
2144
|
+
}
|
|
2145
|
+
);
|
|
2146
|
+
ExtensionManager[EXTENSION_TROUBLE_DATA_MAPPER].register(
|
|
2147
|
+
"MicroPumpAirDetectTrouble",
|
|
2148
|
+
async (trouble) => {
|
|
2149
|
+
if (trouble.ifaces.includes("container")) {
|
|
2150
|
+
return {};
|
|
2151
|
+
}
|
|
2152
|
+
if (trouble.data.pumpPath) {
|
|
2153
|
+
const { model: pumpModel } = getKosModelSync(
|
|
2154
|
+
trouble.data.pumpPath
|
|
2155
|
+
);
|
|
2156
|
+
if (pumpModel) {
|
|
2157
|
+
const ingredientModel = pumpModel.ingredientId ? getKosModelSync(pumpModel.ingredientId).model : void 0;
|
|
2158
|
+
return {
|
|
2159
|
+
ingredientId: pumpModel.ingredientId,
|
|
2160
|
+
ingredientName: ingredientModel?.name || ""
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
return {};
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
return {
|
|
2168
|
+
preload: RegistrationManager.model.preloadModel(root),
|
|
2169
|
+
model: RegistrationManager.model.register(root),
|
|
2170
|
+
companion: RegistrationManager.companion.register(root),
|
|
2171
|
+
legacy: RegistrationManager.model.registerLegacyModel(root)
|
|
2172
|
+
};
|
|
2173
|
+
};
|
|
2174
|
+
const _KosModelRegistry = {
|
|
2175
|
+
...KosModelRegistry$1
|
|
2176
|
+
};
|
|
2177
|
+
_KosModelRegistry.freestyle = {
|
|
2178
|
+
models: registerFreestyleModels(_KosModelRegistry)
|
|
2179
|
+
};
|
|
2180
|
+
_KosModelRegistry.preload = RegistrationManager.model.preloadModel(_KosModelRegistry);
|
|
2181
|
+
_KosModelRegistry.model = RegistrationManager.model.register(_KosModelRegistry);
|
|
2182
|
+
_KosModelRegistry.companion = RegistrationManager.companion.register(_KosModelRegistry);
|
|
2183
|
+
_KosModelRegistry.legacy = RegistrationManager.model.registerLegacyModel(_KosModelRegistry);
|
|
2184
|
+
const KosModelRegistry = _KosModelRegistry;
|
|
2185
|
+
function kosServiceRequest$4(params) {
|
|
2186
|
+
return kosServiceRequest$5(params);
|
|
2187
|
+
}
|
|
2188
|
+
const api$4 = createClient();
|
|
2189
|
+
const service$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2190
|
+
__proto__: null,
|
|
2191
|
+
api: api$4,
|
|
2192
|
+
default: api$4,
|
|
2193
|
+
kosServiceRequest: kosServiceRequest$4
|
|
2194
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2195
|
+
function kosServiceRequest$3(params) {
|
|
2196
|
+
return kosServiceRequest$5(params);
|
|
2197
|
+
}
|
|
2198
|
+
const api$3 = createClient();
|
|
2199
|
+
const service$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2200
|
+
__proto__: null,
|
|
2201
|
+
api: api$3,
|
|
2202
|
+
default: api$3,
|
|
2203
|
+
kosServiceRequest: kosServiceRequest$3
|
|
2204
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2205
|
+
function kosServiceRequest$2(params) {
|
|
2206
|
+
return kosServiceRequest$5(params);
|
|
2207
|
+
}
|
|
2208
|
+
const api$2 = createClient();
|
|
2209
|
+
const service$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2210
|
+
__proto__: null,
|
|
2211
|
+
api: api$2,
|
|
2212
|
+
default: api$2,
|
|
2213
|
+
kosServiceRequest: kosServiceRequest$2
|
|
2214
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2215
|
+
function kosServiceRequest$1(params) {
|
|
2216
|
+
return kosServiceRequest$5(params);
|
|
2217
|
+
}
|
|
2218
|
+
const api$1 = createClient();
|
|
2219
|
+
const service$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2220
|
+
__proto__: null,
|
|
2221
|
+
api: api$1,
|
|
2222
|
+
default: api$1,
|
|
2223
|
+
kosServiceRequest: kosServiceRequest$1
|
|
2224
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2225
|
+
function kosServiceRequest(params) {
|
|
2226
|
+
return kosServiceRequest$5(params);
|
|
2227
|
+
}
|
|
2228
|
+
const api = createClient();
|
|
2229
|
+
const service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2230
|
+
__proto__: null,
|
|
2231
|
+
api,
|
|
2232
|
+
default: api,
|
|
2233
|
+
kosServiceRequest
|
|
2234
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2235
|
+
export {
|
|
2236
|
+
AGITATION_REQUIRED_TROUBLE as A,
|
|
2237
|
+
performComplete as B,
|
|
2238
|
+
CarbAgitator as C,
|
|
2239
|
+
performPreCalibrate as D,
|
|
2240
|
+
performVerify as E,
|
|
2241
|
+
FcmPump as F,
|
|
2242
|
+
freestyleAssemblyDataMapper as G,
|
|
2243
|
+
FEATURE_SUPPORTS_ICE as H,
|
|
2244
|
+
IceAgitator as I,
|
|
2245
|
+
KosModelRegistry as K,
|
|
2246
|
+
LfcvPump as L,
|
|
2247
|
+
NutritionInfoError as N,
|
|
2248
|
+
RemoteTray as R,
|
|
2249
|
+
SpmPump as S,
|
|
2250
|
+
AgitationRequiredTrouble as a,
|
|
2251
|
+
CartridgeAgitator as b,
|
|
2252
|
+
CartridgeAgitatorContainer as c,
|
|
2253
|
+
CartridgeAgitatorEvents as d,
|
|
2254
|
+
CgpPump as e,
|
|
2255
|
+
service$3 as f,
|
|
2256
|
+
service$2 as g,
|
|
2257
|
+
FreestyleAssembly as h,
|
|
2258
|
+
FreestyleHolder as i,
|
|
2259
|
+
FreestyleNozzle as j,
|
|
2260
|
+
FreestylePump as k,
|
|
2261
|
+
service$1 as l,
|
|
2262
|
+
service as m,
|
|
2263
|
+
IceAgitatorEvents as n,
|
|
2264
|
+
RemoteTrayContainer as o,
|
|
2265
|
+
performCalibrate$1 as p,
|
|
2266
|
+
performComplete$1 as q,
|
|
2267
|
+
registerFreestyleModels as r,
|
|
2268
|
+
service$4 as s,
|
|
2269
|
+
performElectricalTest as t,
|
|
2270
|
+
performPreCalibrate$1 as u,
|
|
2271
|
+
performVerify$1 as v,
|
|
2272
|
+
InvalidRequestError as w,
|
|
2273
|
+
getFreestyleNutritionInfo as x,
|
|
2274
|
+
replacePump as y,
|
|
2275
|
+
performCalibrate as z
|
|
2276
|
+
};
|
|
2277
|
+
//# sourceMappingURL=service-BRuYqmJg.js.map
|