@kosdev-code/kos-dispense-sdk 3.0.26 → 3.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dispense-registration-manager-Da9CW_cN.js.map +1 -1
- package/dispense-registration-manager-Dtb31fcI.cjs.map +1 -1
- package/{extension-utils-CwctwFhK.cjs → extension-utils-Cfhe358W.cjs} +39 -166
- package/extension-utils-Cfhe358W.cjs.map +1 -0
- package/{extension-utils-C_pwmFbZ.js → extension-utils-D_dnBLH6.js} +39 -166
- package/extension-utils-D_dnBLH6.js.map +1 -0
- package/index.cjs +2 -2
- package/index.js +2 -2
- package/models/constants/constants.d.ts +14 -178
- package/models/constants/constants.d.ts.map +1 -1
- package/models/models/assembly/assembly-registration.d.ts +9 -69
- package/models/models/assembly/assembly-registration.d.ts.map +1 -1
- package/models/models/availability/availability-model.d.ts +10 -76
- package/models/models/availability/availability-model.d.ts.map +1 -1
- package/models/models/availability/types/index.d.ts +3 -12
- package/models/models/board/board-container-registration.d.ts +9 -74
- package/models/models/board/board-container-registration.d.ts.map +1 -1
- package/models/models/board/board-registration.d.ts +9 -72
- package/models/models/board/board-registration.d.ts.map +1 -1
- package/models/models/device-assembly/device-assembly-registration.d.ts +10 -76
- package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -1
- package/models/models/generic-pour/generic-pour-registration.d.ts +9 -72
- package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -1
- package/models/models/holder/holder-model.d.ts +9 -73
- package/models/models/holder/holder-model.d.ts.map +1 -1
- package/models/models/holder-container/holder-container-model.d.ts +9 -68
- package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
- package/models/models/ingredient/ingredient-model.d.ts +9 -74
- package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
- package/models/models/ingredient/types/index.d.ts +3 -10
- package/models/models/ingredient-container/ingredient-container-model.d.ts +9 -68
- package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
- package/models/models/nozzle/nozzle-model.d.ts +10 -72
- package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
- package/models/models/nozzle/services/nozzle-services.d.ts +11 -65
- package/models/models/nozzle/services/nozzle-services.d.ts.map +1 -1
- package/models/models/pump/pump-model.d.ts +9 -79
- package/models/models/pump/pump-model.d.ts.map +1 -1
- package/models/models/pump-container/pump-container-model.d.ts +9 -68
- package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
- package/models/models/types/intent.d.ts +11 -78
- package/models/models/types/intent.d.ts.map +1 -1
- package/models/utils/extension-utils.d.ts +38 -165
- package/models/utils/extension-utils.d.ts.map +1 -1
- package/models.cjs +1 -1
- package/models.js +1 -1
- package/package.json +2 -2
- package/{pump-provider-CAKW652V.js → pump-provider-BQmCKz7S.js} +3 -5
- package/pump-provider-BQmCKz7S.js.map +1 -0
- package/{pump-provider-SXrqGmxO.cjs → pump-provider-uNNMh9uh.cjs} +3 -5
- package/pump-provider-uNNMh9uh.cjs.map +1 -0
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +16 -43
- package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -1
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts +7 -18
- package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -1
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +6 -17
- package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
- package/ui/hooks/pour/use-pour.d.ts +7 -18
- package/ui/hooks/pour/use-pour.d.ts.map +1 -1
- package/ui.cjs +1 -1
- package/ui.js +1 -1
- package/extension-utils-C_pwmFbZ.js.map +0 -1
- package/extension-utils-CwctwFhK.cjs.map +0 -1
- package/pump-provider-CAKW652V.js.map +0 -1
- package/pump-provider-SXrqGmxO.cjs.map +0 -1
|
@@ -1,79 +1,20 @@
|
|
|
1
1
|
import { SingletonKosModelRegistrationBean } from '@kosdev-code/kos-ui-sdk';
|
|
2
2
|
import { IngredientContainerModel, IngredientContainerOptions } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Registration bean for {@link IngredientContainerModel}.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* - `type`: the model type, used by the model registry and in `@kosDependency` declarations.
|
|
7
|
+
* - `factory`: `IngredientContainer.factory(options)` returns the single instance, creating it on the first call.
|
|
8
|
+
* - `predicate`: type guard that narrows an `IKosDataModel` to `IngredientContainerModel`.
|
|
9
|
+
* - `registration`: registry entry that can be spread into an `IKosRegistry["models"]` map.
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
* The type property is a string that identifies the model type.
|
|
10
|
-
* The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
|
|
11
|
-
* used when declaring dependencies on models.
|
|
11
|
+
* IngredientContainer is a singleton. `KosModelRegistry.dispense.models()` registers it.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* private holderContainerModel: IngredientContainerModel;
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* ## factory
|
|
22
|
-
*
|
|
23
|
-
* The factory function that can be used to create new IngredientContainerModel instances.
|
|
24
|
-
*
|
|
25
|
-
* As this is a singleton model, the factory function accepts the model options as its argument.
|
|
26
|
-
*
|
|
27
|
-
* If a model with the same model type already exists, the factory function will return the existing model. The options will be ignored
|
|
28
|
-
* in this case and the existing model will be returned in its current state.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
*
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const model = IngredientContainer.factory({ });
|
|
15
|
+
* @kosDependency({ modelType: IngredientContainer.type })
|
|
16
|
+
* private ingredientContainer!: IngredientContainerModel;
|
|
35
17
|
* ```
|
|
36
|
-
|
|
37
|
-
* ## predicate
|
|
38
|
-
*
|
|
39
|
-
* [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a IngredientContainerModel.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
*
|
|
44
|
-
* const model: IKosDataModel = ...; // some model
|
|
45
|
-
*
|
|
46
|
-
* if (IngredientContainer.predicate(model)) {
|
|
47
|
-
* // if the function evaluates to true, the model is narrowed down to IngredientContainerModel
|
|
48
|
-
* // and the compiler will know that the model has the IngredientContainerModel interface
|
|
49
|
-
* model.updateAvailability(false);
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* ## registration
|
|
54
|
-
*
|
|
55
|
-
* The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
|
|
56
|
-
* can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
*
|
|
61
|
-
* In an application registration file you can declare the model registration as follows:
|
|
62
|
-
*
|
|
63
|
-
* **registration.ts**
|
|
64
|
-
* ```typescript
|
|
65
|
-
* import { IngredientContainer } from "@kosdev-code/kos-dispense-sdk";
|
|
66
|
-
* ...
|
|
67
|
-
* import { IKosRegistry } from "@kosdev-code/kos-ui-sdk";
|
|
68
|
-
* export const kosModels: IKosRegistry["models"] = {
|
|
69
|
-
* ...IngredientContainer.registration,
|
|
70
|
-
* };
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ## registration.singleton
|
|
74
|
-
* The IngredientContainer model is a singleton. This means that each time the factory function is called , the same instance will be returned.
|
|
75
|
-
* If the model does not yet exist, it will be created passing in the provided options to initialize it.
|
|
76
|
-
*
|
|
77
|
-
* * */
|
|
18
|
+
*/
|
|
78
19
|
export declare const IngredientContainer: SingletonKosModelRegistrationBean<IngredientContainerModel, IngredientContainerOptions>;
|
|
79
20
|
//# sourceMappingURL=ingredient-container-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingredient-container-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/ingredient-container/ingredient-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,iCAAiC,EAClC,MAAM,yBAAyB,CAAC;AAajC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAwFjB
|
|
1
|
+
{"version":3,"file":"ingredient-container-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/ingredient-container/ingredient-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,iCAAiC,EAClC,MAAM,yBAAyB,CAAC;AAajC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAwFjB;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,iCAAiC,CACjE,wBAAwB,EACxB,0BAA0B,CAc3B,CAAC"}
|
|
@@ -192,85 +192,23 @@ declare class NozzleModelImpl implements PourStrategyAware {
|
|
|
192
192
|
*/
|
|
193
193
|
export type NozzleModel = PublicModelInterface<NozzleModelImpl>;
|
|
194
194
|
/**
|
|
195
|
+
* Registration bean for {@link NozzleModel}.
|
|
195
196
|
*
|
|
197
|
+
* - `type`: the model type, used by the model registry and in `@kosDependency` declarations.
|
|
198
|
+
* - `factory`: curried factory, `Nozzle.factory(id)(options)`. Returns the existing model when the id is already in use and ignores the options.
|
|
199
|
+
* - `predicate`: type guard that narrows an `IKosDataModel` to `NozzleModel`.
|
|
200
|
+
* - `registration`: registry entry that can be spread into an `IKosRegistry["models"]` map.
|
|
196
201
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* The registration bean includes convenience methods for creating and working with NozzleModel instances.
|
|
200
|
-
*
|
|
201
|
-
* ## type
|
|
202
|
-
* The type property is a string that identifies the model type.
|
|
203
|
-
* The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
|
|
204
|
-
* used when declaring dependencies on models.
|
|
202
|
+
* Nozzle is not a singleton: each id has its own instance. `KosModelRegistry.dispense.models()` registers it.
|
|
205
203
|
*
|
|
206
204
|
* @example
|
|
207
205
|
* ```typescript
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* private nozzleModel: NozzleModel;
|
|
206
|
+
* @kosDependency({ modelType: Nozzle.type, id: "nozzleId" })
|
|
207
|
+
* private nozzle!: NozzleModel;
|
|
211
208
|
* ```
|
|
212
209
|
*
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
*
|
|
216
|
-
* The factory method creates a factory function that can be used to create new NozzleModel instances.
|
|
217
|
-
*
|
|
218
|
-
* The factory function is a curried function that takes the model id as the first argument and the options as the second argument.
|
|
219
|
-
*
|
|
220
|
-
* If a model with the specified id already exists, the factory function will return the existing model. The options will be ignored
|
|
221
|
-
* in this case and the existing model will be returned in its current state.
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
*
|
|
225
|
-
* ```typescript
|
|
226
|
-
* const model = Nozzle.factory("S1")({
|
|
227
|
-
* path: "core.assemby.nozzle.nozzle1",
|
|
228
|
-
* });
|
|
229
|
-
* ```
|
|
230
|
-
*
|
|
231
|
-
* ## predicate
|
|
232
|
-
*
|
|
233
|
-
* [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a NozzleModel.
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```typescript
|
|
237
|
-
*
|
|
238
|
-
* const model: IKosDataModel = ...; // some model
|
|
239
|
-
*
|
|
240
|
-
* if (Nozzle.predicate(model)) {
|
|
241
|
-
* // if the function evaluates to true, the model is narrowed down to NozzleModel
|
|
242
|
-
* // and the compiler will know that the model has the NozzleModel interface
|
|
243
|
-
* model.pour();
|
|
244
|
-
* }
|
|
245
|
-
* ```
|
|
246
|
-
*
|
|
247
|
-
* ## registration
|
|
248
|
-
*
|
|
249
|
-
* The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
|
|
250
|
-
* can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
*
|
|
255
|
-
* In an application registration file you can declare the model registration as follows:
|
|
256
|
-
*
|
|
257
|
-
* **registration.ts**
|
|
258
|
-
* ```typescript
|
|
259
|
-
* import { Nozzle } from "@kosdev-code/kos-dispense-sdk";
|
|
260
|
-
* ...
|
|
261
|
-
* import { IKosRegistry } from "@kosdev-code/kos-ui-sdk";
|
|
262
|
-
* export const kosModels: IKosRegistry["models"] = {
|
|
263
|
-
* ...Nozzle.registration,
|
|
264
|
-
* };
|
|
265
|
-
* ```
|
|
266
|
-
*
|
|
267
|
-
* ## registration.singleton
|
|
268
|
-
*
|
|
269
|
-
* The nozzle model is not a singleton model. This means that each time the factory function is called with a unique ID, a new model instance will be created.
|
|
270
|
-
* If the factory function is called with an ID that already exists, the existing model will be returned.
|
|
271
|
-
*
|
|
272
|
-
* @category KOS Model Registration
|
|
273
|
-
* */
|
|
210
|
+
* @category KOS Model Registration
|
|
211
|
+
*/
|
|
274
212
|
export declare const Nozzle: Readonly<KosModelRegistrationBean<NozzleModel, NozzleOptions>>;
|
|
275
213
|
export {};
|
|
276
214
|
//# sourceMappingURL=nozzle-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nozzle-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/nozzle/nozzle-model.ts"],"names":[],"mappings":"AACA,OAAO,EAuBL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB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,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CzC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB;CAwGtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"nozzle-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/nozzle/nozzle-model.ts"],"names":[],"mappings":"AACA,OAAO,EAuBL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,aAAa,EAKb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AACpE,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAMlE,KAAK,SAAS,GACV,YAAY,GACZ,aAAa,GACb,aAAa,GACb,eAAe,GACf,gBAAgB,CAAC;AAMrB,UAAU,eACR,SAAQ,eAAe,EACrB,aAAa,EACb,eAAe,EACf,cAAc,EACd,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC;CAAG;AAEjD;;;;;GAKG;AACH,cAqCM,eAAgB,YAAW,iBAAiB;IAChD,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CA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AIzD,iBAAiB,CAAC,CAAC,CAAC,EAAE;IAO7B;;OAEG;IAEH,kBAAkB,IAAI,IAAI;IAW1B;;OAEG;IAEH,gBAAgB,IAAI,IAAI;IAIxB;;OAEG;IAEH,iBAAiB,IAAI,IAAI;IAIzB;;OAEG;IAEH,cAAc,IAAI,IAAI;IAqBtB,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC;IAkCxC;;;;;;;SAOK;IAGQ,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM;IAkClC;;;;;;;;SAQK;IAGQ,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAkCrD;;SAEK;IAIQ,UAAU;IAMvB,OAAO,CAAC,kBAAkB;IAepB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAc7B,gBAAgB;IACV,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CzC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB;CAwGtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,EAAE,QAAQ,CAC3B,wBAAwB,CAAC,WAAW,EAAE,aAAa,CAAC,CAWrD,CAAC"}
|
|
@@ -60,31 +60,21 @@ export interface AvailabilityResponse {
|
|
|
60
60
|
*
|
|
61
61
|
* Initiates a pour for the specified nozzle.
|
|
62
62
|
*
|
|
63
|
-
* Uses the KOS endpoint [POST] `${URL}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/pour`
|
|
63
|
+
* Uses the KOS endpoint [POST] `${URL}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/pour/selected/maxVolume`
|
|
64
64
|
*
|
|
65
65
|
* @param nozzleId - the nozzle id to pour from.
|
|
66
66
|
* @param tracker - the tracker to use for the pour. It will be returned in the future to allow consumers
|
|
67
67
|
* to track the pour.
|
|
68
68
|
* @category Service
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* import { NozzleServices } from "@kosdev-code/kos-dispense-sdk";
|
|
73
|
-
* ...
|
|
74
|
-
*
|
|
75
|
-
* await NozzleServices.pourPourable("nozzle-1", "my-tracker");
|
|
76
|
-
* ```
|
|
77
69
|
* @see {@link FutureManager.initiateFuture}
|
|
78
|
-
* @returns -
|
|
70
|
+
* @returns - the service response. Its data is the future that tracks the pour, which is registered with the {@link FutureManager}.
|
|
79
71
|
**/
|
|
80
72
|
export declare const pourPourable: (nozzleId: string, tracker: string) => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<any> | undefined>;
|
|
81
73
|
/**
|
|
82
74
|
*
|
|
83
75
|
* Initiates a fixed named pour for the specified nozzle.
|
|
84
76
|
*
|
|
85
|
-
* Typically used for
|
|
86
|
-
* dictated by the name.
|
|
87
|
-
*
|
|
77
|
+
* Typically used for a named cup size, where the name determines the volume of the pour.
|
|
88
78
|
*
|
|
89
79
|
* Uses the KOS endpoint [POST] `${URL}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/fixed/${name}`
|
|
90
80
|
*
|
|
@@ -93,37 +83,18 @@ export declare const pourPourable: (nozzleId: string, tracker: string) => Promis
|
|
|
93
83
|
* @param tracker - the tracker to use for the pour. It will be returned in the future to allow consumers
|
|
94
84
|
* to track the pour.
|
|
95
85
|
* @category Service
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* import { NozzleServices } from "@kosdev-code/kos-dispense-sdk";
|
|
100
|
-
* ...
|
|
101
|
-
*
|
|
102
|
-
* await NozzleServices.pourPourable("nozzle-1", "my-tracker");
|
|
103
|
-
* ```
|
|
104
86
|
* @see {@link FutureManager.initiateFuture}
|
|
105
|
-
* @returns -
|
|
87
|
+
* @returns - the service response. Its data is the future that tracks the pour, which is registered with the {@link FutureManager}.
|
|
106
88
|
**/
|
|
107
89
|
export declare const pourNamedPourable: (name: string, nozzleId: string, tracker: string) => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<any> | undefined>;
|
|
108
90
|
/**
|
|
109
91
|
* Retrieves the availability nodes for a specified nozzle.
|
|
110
92
|
*
|
|
111
|
-
* Uses the KOS endpoint [GET] `${URL}
|
|
93
|
+
* Uses the KOS endpoint [GET] `${URL}${urlPrefix}/pipeline/beverage/availability`
|
|
112
94
|
*
|
|
113
|
-
* @param
|
|
95
|
+
* @param urlPrefix - the nozzle's URL prefix (the `urlPrefix` of the {@link NozzleModel}).
|
|
114
96
|
* @returns - the availability nodes for the specified nozzle.
|
|
115
97
|
* @category Service
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* import { NozzleServices } from "@kosdev-code/kos-dispense-sdk";
|
|
120
|
-
* ...
|
|
121
|
-
*
|
|
122
|
-
* const availability = await NozzleServices.getAvailability("nozzle-1");
|
|
123
|
-
* if (availability?.status !== 200) {
|
|
124
|
-
* throw new Error("Failed to load nozzle availability");
|
|
125
|
-
* }
|
|
126
|
-
* ```
|
|
127
98
|
*/
|
|
128
99
|
export declare const getAvailability: (urlPrefix: string) => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<AvailabilityResponse> | undefined>;
|
|
129
100
|
/**
|
|
@@ -131,29 +102,17 @@ export declare const getAvailability: (urlPrefix: string) => Promise<import('@ko
|
|
|
131
102
|
*
|
|
132
103
|
* Uses the KOS endpoint [POST] `${URL}/api/ext/dispense/nozzle/${nozzleId}/pipeline/beverage/select`
|
|
133
104
|
*
|
|
134
|
-
*
|
|
135
105
|
* @param nozzleId - the nozzle id to select a pourable for.
|
|
136
106
|
* @param payload - the payload to send to the endpoint. The shape of the payload is determined by the
|
|
137
107
|
* {@link ExtensionType.SelectedPourableMapper} extension.
|
|
138
108
|
* @category Service
|
|
139
109
|
* @see {@link ExtensionType.SelectedPourableMapper}
|
|
140
|
-
* @returns - an
|
|
110
|
+
* @returns - an empty response.
|
|
141
111
|
*
|
|
142
|
-
*
|
|
112
|
+
* @example
|
|
143
113
|
* ```typescript
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* try {
|
|
147
|
-
* const response = await NozzleServices.selectPourable("nozzle-1", {
|
|
148
|
-
* beverage: "beverage-1",
|
|
149
|
-
* additional: ["flavor-1"],
|
|
150
|
-
* });
|
|
151
|
-
* if (response?.status !== 200) {
|
|
152
|
-
* throw new Error("Failed to select pourable");
|
|
153
|
-
* }
|
|
154
|
-
* } catch (e) {
|
|
155
|
-
* console.error(e);
|
|
156
|
-
* }
|
|
114
|
+
* // the default payload when no SelectedPourableMapper is registered
|
|
115
|
+
* await NozzleServices.selectPourable("nozzle-1", { bevId: "beverage-1" });
|
|
157
116
|
* ```
|
|
158
117
|
* */
|
|
159
118
|
export declare const selectPourable: (nozzleId: string, payload: object) => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<any> | undefined>;
|
|
@@ -163,20 +122,7 @@ export declare const selectPourable: (nozzleId: string, payload: object) => Prom
|
|
|
163
122
|
*
|
|
164
123
|
* @param nozzleId - the nozzle id to clear the selected pourable for.
|
|
165
124
|
* @category Service
|
|
166
|
-
* @returns - an
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* import { NozzleServices } from "@kosdev-code/kos-dispense-sdk";
|
|
170
|
-
* ...
|
|
171
|
-
* try {
|
|
172
|
-
* const response = await NozzleServices.clearPourable("nozzle-1");
|
|
173
|
-
* if (response?.status !== 200) {
|
|
174
|
-
* throw new Error("Failed to clear pourable");
|
|
175
|
-
* }
|
|
176
|
-
* } catch (e) {
|
|
177
|
-
* console.error(e);
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
125
|
+
* @returns - an empty response.
|
|
180
126
|
* */
|
|
181
127
|
export declare const clearPourable: (nozzleId: string) => Promise<import('@kosdev-code/kos-ui-sdk').KosServiceResponse<unknown> | undefined>;
|
|
182
128
|
//# sourceMappingURL=nozzle-services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nozzle-services.d.ts","sourceRoot":"","sources":["../../../../../../../packages/kos-dispense-sdk/src/models/models/nozzle/services/nozzle-services.ts"],"names":[],"mappings":"AAUA;;KAEK;AACL,MAAM,WAAW,gBAAgB,CAC/B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAE5D;;SAEK;IACL,SAAS,EAAE,OAAO,CAAC;IACnB;;;;SAIK;IACL,KAAK,EAAE,MAAM,CAAC;IACd;;SAEK;IACL,OAAO,EAAE,OAAO,CAAC;IAEjB;;SAEK;IACL,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;KAEK;AACL,MAAM,WAAW,oBAAoB;IACnC;;;SAGK;IACL,OAAO,EAAE,OAAO,CAAC;IAEjB;;SAEK;IACL,MAAM,EAAE;QACN;;aAEK;QACL,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAC9B;;aAEK;QACL,OAAO,EAAE,gBAAgB,EAAE,CAAC;QAE5B;;aAEK;QACL,MAAM,EAAE,gBAAgB,EAAE,CAAC;QAE3B;;aAEK;QACL,CAAC,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;KACjC,CAAC;CACH;AAED
|
|
1
|
+
{"version":3,"file":"nozzle-services.d.ts","sourceRoot":"","sources":["../../../../../../../packages/kos-dispense-sdk/src/models/models/nozzle/services/nozzle-services.ts"],"names":[],"mappings":"AAUA;;KAEK;AACL,MAAM,WAAW,gBAAgB,CAC/B,UAAU,SAAS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
|
|
@@ -1,90 +1,20 @@
|
|
|
1
1
|
import { KosModelRegistrationBean } from '@kosdev-code/kos-ui-sdk';
|
|
2
2
|
import { PumpModel, PumpOptions } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Registration bean for {@link PumpModel}.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* - `type`: the model type, used by the model registry and in `@kosDependency` declarations.
|
|
7
|
+
* - `factory`: curried factory, `Pump.factory(id)(options)`. Returns the existing model when the id is already in use and ignores the options.
|
|
8
|
+
* - `predicate`: type guard that narrows an `IKosDataModel` to `PumpModel`.
|
|
9
|
+
* - `registration`: registry entry that can be spread into an `IKosRegistry["models"]` map.
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
* The type property is a string that identifies the model type.
|
|
10
|
-
* The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
|
|
11
|
-
* used when declaring dependencies on models.
|
|
11
|
+
* Pump is not a singleton: each id has its own instance. `KosModelRegistry.dispense.models()` registers it.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* private pumpModel: PumpModel;
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* ## factory
|
|
22
|
-
*
|
|
23
|
-
* The factory method creates a factory function that can be used to create new PumpModel instances.
|
|
24
|
-
*
|
|
25
|
-
* The factory function is a curried function that takes the model id as the first argument and the options as the second argument.
|
|
26
|
-
*
|
|
27
|
-
* If a model with the specified id already exists, the factory function will return the existing model. The options will be ignored
|
|
28
|
-
* in this case and the existing model will be returned in its current state.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
*
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const model = Pump.factory("S1")({
|
|
34
|
-
* name: "S1",
|
|
35
|
-
* path: "core.assembly.pump.S1",
|
|
36
|
-
* beveragePour: true,
|
|
37
|
-
* type: "syrup",
|
|
38
|
-
* ingredientId: "1234532",
|
|
39
|
-
* holderPath: "core.dispenser.holder.s1",
|
|
40
|
-
* boardPath: "core.dispenser.board.s1",
|
|
41
|
-
* nozzlePath: "core.dispenser.nozzle.s1",
|
|
42
|
-
* inserted: true,
|
|
43
|
-
* category: "flavor",
|
|
44
|
-
* prevIngredientId: "1234567",
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* ## predicate
|
|
49
|
-
*
|
|
50
|
-
* [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a PumpModel.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
*
|
|
55
|
-
* const model: IKosDataModel = ...; // some model
|
|
56
|
-
*
|
|
57
|
-
* if (Pump.predicate(model)) {
|
|
58
|
-
* // if the function evaluates to true, the model is narrowed down to PumpModel
|
|
59
|
-
* // and the compiler will know that the model has the PumpModel interface
|
|
60
|
-
* model.updateAvailability(false);
|
|
61
|
-
* }
|
|
15
|
+
* @kosDependency({ modelType: Pump.type, id: "pumpId" })
|
|
16
|
+
* private pump!: PumpModel;
|
|
62
17
|
* ```
|
|
63
|
-
|
|
64
|
-
* ## registration
|
|
65
|
-
*
|
|
66
|
-
* The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
|
|
67
|
-
* can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
*
|
|
72
|
-
* In an application registration file you can declare the model registration as follows:
|
|
73
|
-
*
|
|
74
|
-
* **registration.ts**
|
|
75
|
-
* ```typescript
|
|
76
|
-
* import { Pump } from "@kosdev-code/kos-dispense-sdk";
|
|
77
|
-
* ...
|
|
78
|
-
* import { IKosRegistry } from "@kosdev-code/kos-ui-sdk";
|
|
79
|
-
* export const kosModels: IKosRegistry["models"] = {
|
|
80
|
-
* ...Pump.registration,
|
|
81
|
-
* };
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* ## registration.singleton
|
|
85
|
-
*
|
|
86
|
-
* The pump model is not a singleton model. This means that each time the factory function is called with a unique ID, a new model instance will be created.
|
|
87
|
-
* If the factory function is called with an ID that already exists, the existing model will be returned.
|
|
88
|
-
* */
|
|
18
|
+
*/
|
|
89
19
|
export declare const Pump: Readonly<KosModelRegistrationBean<PumpModel, PumpOptions>>;
|
|
90
20
|
//# sourceMappingURL=pump-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pump-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/pump/pump-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAYjC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA8LtD
|
|
1
|
+
{"version":3,"file":"pump-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/pump/pump-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAYjC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA8LtD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAWzE,CAAC"}
|
|
@@ -6,79 +6,20 @@ export declare enum PumpIndex {
|
|
|
6
6
|
byNozzle = "byNozzle"
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Registration bean for {@link PumpContainerModel}.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* - `type`: the model type, used by the model registry and in `@kosDependency` declarations.
|
|
12
|
+
* - `factory`: `PumpContainer.factory(options)` returns the single instance, creating it on the first call.
|
|
13
|
+
* - `predicate`: type guard that narrows an `IKosDataModel` to `PumpContainerModel`.
|
|
14
|
+
* - `registration`: registry entry that can be spread into an `IKosRegistry["models"]` map.
|
|
12
15
|
*
|
|
13
|
-
*
|
|
14
|
-
* The type property is a string that identifies the model type.
|
|
15
|
-
* The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
|
|
16
|
-
* used when declaring dependencies on models.
|
|
16
|
+
* PumpContainer is a singleton. `KosModelRegistry.dispense.models()` registers it.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* private holderContainerModel: PumpContainerModel;
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* ## factory
|
|
27
|
-
*
|
|
28
|
-
* The factory function that can be used to create new PumpContainerModel instances.
|
|
29
|
-
*
|
|
30
|
-
* As this is a singleton model, the factory function accepts the model options as its argument.
|
|
31
|
-
*
|
|
32
|
-
* If a model with the same model type already exists, the factory function will return the existing model. The options will be ignored
|
|
33
|
-
* in this case and the existing model will be returned in its current state.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
*
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const model = PumpContainer.factory({ });
|
|
20
|
+
* @kosDependency({ modelType: PumpContainer.type })
|
|
21
|
+
* private pumpContainer!: PumpContainerModel;
|
|
40
22
|
* ```
|
|
41
|
-
|
|
42
|
-
* ## predicate
|
|
43
|
-
*
|
|
44
|
-
* [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a PumpContainerModel.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
*
|
|
49
|
-
* const model: IKosDataModel = ...; // some model
|
|
50
|
-
*
|
|
51
|
-
* if (PumpContainer.predicate(model)) {
|
|
52
|
-
* // if the function evaluates to true, the model is narrowed down to PumpContainerModel
|
|
53
|
-
* // and the compiler will know that the model has the PumpContainerModel interface
|
|
54
|
-
* model.updateAvailability(false);
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* ## registration
|
|
59
|
-
*
|
|
60
|
-
* The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
|
|
61
|
-
* can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
*
|
|
66
|
-
* In an application registration file you can declare the model registration as follows:
|
|
67
|
-
*
|
|
68
|
-
* **registration.ts**
|
|
69
|
-
* ```typescript
|
|
70
|
-
* import { PumpContainer } from "@kosdev-code/kos-dispense-sdk";
|
|
71
|
-
* ...
|
|
72
|
-
* import { IKosRegistry } from "@kosdev-code/kos-ui-sdk";
|
|
73
|
-
* export const kosModels: IKosRegistry["models"] = {
|
|
74
|
-
* ...PumpContainer.registration,
|
|
75
|
-
* };
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* ## registration.singleton
|
|
79
|
-
* The PumpContainer model is a singleton. This means that each time the factory function is called , the same instance will be returned.
|
|
80
|
-
* If the model does not yet exist, it will be created passing in the provided options to initialize it.
|
|
81
|
-
*
|
|
82
|
-
* * */
|
|
23
|
+
*/
|
|
83
24
|
export declare const PumpContainer: SingletonKosModelRegistrationBean<PumpContainerModel, PumpContainerOptions>;
|
|
84
25
|
//# sourceMappingURL=pump-container-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pump-container-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/pump-container/pump-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQxE,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAqED
|
|
1
|
+
{"version":3,"file":"pump-container-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-dispense-sdk/src/models/models/pump-container/pump-container-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQxE,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAqED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,iCAAiC,CAC3D,kBAAkB,EAClB,oBAAoB,CAarB,CAAC"}
|
|
@@ -16,36 +16,13 @@ export interface IntentAware extends IKosIdentifiable {
|
|
|
16
16
|
performIntent(props: IntentAwareProps | string): Promise<FutureResponse | undefined>;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* This interface extends intent-aware models with the ability to calculate
|
|
22
|
-
* appropriate volumes for specific intents (e.g., CALIBRATE, PRIME, FLUSH).
|
|
23
|
-
* Typically implemented by holder and pump models that have ingredient assignments
|
|
24
|
-
* and need to determine operation-specific volumes based on ingredient type,
|
|
25
|
-
* pump configuration, or operational requirements.
|
|
26
|
-
*
|
|
27
|
-
* Use this interface in combination with {@link IntentAware} to create models
|
|
28
|
-
* that can both determine appropriate volumes and execute the operations.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* Using IntentContainer for calibration:
|
|
32
|
-
* ```typescript
|
|
33
|
-
* async function calibratePump(holder: HolderModel & IntentContainer) {
|
|
34
|
-
* // Resolve appropriate calibration volume
|
|
35
|
-
* const result = await holder.resolveIntentVolume("CALIBRATE");
|
|
36
|
-
* console.log(`Calibration requires ${result.volume} oz`);
|
|
37
|
-
*
|
|
38
|
-
* // Execute calibration with resolved volume
|
|
39
|
-
* await holder.performIntent("CALIBRATE");
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
19
|
+
* A model that can resolve the volume an intent (such as CALIBRATE, PRIME or FLUSH) will dispense.
|
|
20
|
+
* Holder and pump models implement it alongside {@link IntentAware}, which performs the intent.
|
|
42
21
|
*
|
|
43
22
|
* @example
|
|
44
|
-
* Checking for ingredient assignment:
|
|
45
23
|
* ```typescript
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* }
|
|
24
|
+
* const { volume } = await holder.resolveIntentVolume("CALIBRATE");
|
|
25
|
+
* await holder.performIntent("CALIBRATE");
|
|
49
26
|
* ```
|
|
50
27
|
*
|
|
51
28
|
* @category Model Interfaces
|
|
@@ -53,63 +30,19 @@ export interface IntentAware extends IKosIdentifiable {
|
|
|
53
30
|
*/
|
|
54
31
|
export interface IntentContainer {
|
|
55
32
|
/**
|
|
56
|
-
* Resolves the
|
|
33
|
+
* Resolves the volume the backend reports for an intent on the assigned ingredient.
|
|
57
34
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* - **PURGE**: Volume to completely clear the line
|
|
63
|
-
*
|
|
64
|
-
* The resolved volume is calculated based on:
|
|
65
|
-
* - Ingredient type and properties
|
|
66
|
-
* - Pump hardware configuration (line length, diameter)
|
|
67
|
-
* - Operational parameters (flow rates, pressure)
|
|
68
|
-
* - Device-specific calibration data
|
|
69
|
-
*
|
|
70
|
-
* @param intent - The intent string identifier (e.g., "CALIBRATE", "PRIME", "FLUSH")
|
|
71
|
-
* @returns Promise resolving to object with `volume` property in ounces (oz)
|
|
72
|
-
*
|
|
73
|
-
* @throws May reject if ingredient is not assigned or volume cannot be determined
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* Resolving calibration volume:
|
|
77
|
-
* ```typescript
|
|
78
|
-
* const result = await holder.resolveIntentVolume("CALIBRATE");
|
|
79
|
-
* console.log(`Calibration: ${result.volume} oz`);
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* Handling volume resolution errors:
|
|
84
|
-
* ```typescript
|
|
85
|
-
* try {
|
|
86
|
-
* const result = await holder.resolveIntentVolume("PRIME");
|
|
87
|
-
* displayVolume(result.volume);
|
|
88
|
-
* } catch (error) {
|
|
89
|
-
* console.error("Cannot resolve volume - ingredient may not be assigned");
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
35
|
+
* @param intent - The intent identifier (e.g., "CALIBRATE", "PRIME", "FLUSH")
|
|
36
|
+
* @returns Promise resolving to an object with a `volume` property in ounces, or `-1` when no
|
|
37
|
+
* volume is available
|
|
38
|
+
* @throws Rejects when the volume request to the backend fails
|
|
92
39
|
*/
|
|
93
40
|
resolveIntentVolume(intent: string): Promise<{
|
|
94
41
|
volume: number;
|
|
95
42
|
}>;
|
|
96
43
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* When undefined, no ingredient is assigned to this holder/pump and volume
|
|
100
|
-
* resolution operations may fail or return default values. Check this property
|
|
101
|
-
* before calling {@link resolveIntentVolume} to ensure an ingredient is assigned.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* Checking for assignment before resolving volume:
|
|
105
|
-
* ```typescript
|
|
106
|
-
* if (holder.ingredientId) {
|
|
107
|
-
* const volume = await holder.resolveIntentVolume("CALIBRATE");
|
|
108
|
-
* // Use volume...
|
|
109
|
-
* } else {
|
|
110
|
-
* console.log("No ingredient assigned - cannot calibrate");
|
|
111
|
-
* }
|
|
112
|
-
* ```
|
|
44
|
+
* Id of the assigned ingredient, or undefined when none is assigned. Volume resolution needs an
|
|
45
|
+
* assigned ingredient.
|
|
113
46
|
*/
|
|
114
47
|
ingredientId?: string;
|
|
115
48
|
}
|