@kosdev-code/kos-dispense-sdk 2.1.31 → 2.1.33
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.
|
@@ -16,4 +16,102 @@ export interface IntentAware extends IKosIdentifiable {
|
|
|
16
16
|
cancelPour: () => Promise<void>;
|
|
17
17
|
performIntent(props: IntentAwareProps | string): Promise<FutureResponse | undefined>;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface for models that can resolve intent volumes for various operations.
|
|
21
|
+
*
|
|
22
|
+
* This interface extends intent-aware models with the ability to calculate
|
|
23
|
+
* appropriate volumes for specific intents (e.g., CALIBRATE, PRIME, FLUSH).
|
|
24
|
+
* Typically implemented by holder and pump models that have ingredient assignments
|
|
25
|
+
* and need to determine operation-specific volumes based on ingredient type,
|
|
26
|
+
* pump configuration, or operational requirements.
|
|
27
|
+
*
|
|
28
|
+
* Use this interface in combination with {@link IntentAware} to create models
|
|
29
|
+
* that can both determine appropriate volumes and execute the operations.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* Using IntentContainer for calibration:
|
|
33
|
+
* ```typescript
|
|
34
|
+
* async function calibratePump(holder: HolderModel & IntentContainer) {
|
|
35
|
+
* // Resolve appropriate calibration volume
|
|
36
|
+
* const result = await holder.resolveIntentVolume("CALIBRATE");
|
|
37
|
+
* console.log(`Calibration requires ${result.volume} oz`);
|
|
38
|
+
*
|
|
39
|
+
* // Execute calibration with resolved volume
|
|
40
|
+
* await holder.performIntent("CALIBRATE");
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* Checking for ingredient assignment:
|
|
46
|
+
* ```typescript
|
|
47
|
+
* function canResolveVolume(model: IntentContainer): boolean {
|
|
48
|
+
* return model.ingredientId !== undefined;
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @category Model Interfaces
|
|
53
|
+
* @see {@link IntentAware} for intent execution capabilities
|
|
54
|
+
*/
|
|
55
|
+
export interface IntentContainer {
|
|
56
|
+
/**
|
|
57
|
+
* Resolves the appropriate volume for a given intent operation.
|
|
58
|
+
*
|
|
59
|
+
* Different intents require different volumes based on operational requirements:
|
|
60
|
+
* - **CALIBRATE**: Standard calibration volume based on ingredient type and pump configuration
|
|
61
|
+
* - **PRIME**: Volume needed to prime the line from reservoir to dispense point
|
|
62
|
+
* - **FLUSH**: Cleaning volume to flush contaminants from the system
|
|
63
|
+
* - **PURGE**: Volume to completely clear the line
|
|
64
|
+
*
|
|
65
|
+
* The resolved volume is calculated based on:
|
|
66
|
+
* - Ingredient type and properties
|
|
67
|
+
* - Pump hardware configuration (line length, diameter)
|
|
68
|
+
* - Operational parameters (flow rates, pressure)
|
|
69
|
+
* - Device-specific calibration data
|
|
70
|
+
*
|
|
71
|
+
* @param intent - The intent string identifier (e.g., "CALIBRATE", "PRIME", "FLUSH")
|
|
72
|
+
* @returns Promise resolving to object with `volume` property in ounces (oz)
|
|
73
|
+
*
|
|
74
|
+
* @throws May reject if ingredient is not assigned or volume cannot be determined
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* Resolving calibration volume:
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const result = await holder.resolveIntentVolume("CALIBRATE");
|
|
80
|
+
* console.log(`Calibration: ${result.volume} oz`);
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* Handling volume resolution errors:
|
|
85
|
+
* ```typescript
|
|
86
|
+
* try {
|
|
87
|
+
* const result = await holder.resolveIntentVolume("PRIME");
|
|
88
|
+
* displayVolume(result.volume);
|
|
89
|
+
* } catch (error) {
|
|
90
|
+
* console.error("Cannot resolve volume - ingredient may not be assigned");
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
resolveIntentVolume(intent: string): Promise<{
|
|
95
|
+
volume: number;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Optional ingredient identifier for the assigned ingredient.
|
|
99
|
+
*
|
|
100
|
+
* When undefined, no ingredient is assigned to this holder/pump and volume
|
|
101
|
+
* resolution operations may fail or return default values. Check this property
|
|
102
|
+
* before calling {@link resolveIntentVolume} to ensure an ingredient is assigned.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* Checking for assignment before resolving volume:
|
|
106
|
+
* ```typescript
|
|
107
|
+
* if (holder.ingredientId) {
|
|
108
|
+
* const volume = await holder.resolveIntentVolume("CALIBRATE");
|
|
109
|
+
* // Use volume...
|
|
110
|
+
* } else {
|
|
111
|
+
* console.log("No ingredient assigned - cannot calibrate");
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
ingredientId?: string;
|
|
116
|
+
}
|
|
19
117
|
//# sourceMappingURL=intent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/types/intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,CACX,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAC/B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CACxC"}
|
|
1
|
+
{"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-dispense-sdk/src/models/models/types/intent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,CACX,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAC/B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjE;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-dispense-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"kos": {
|
|
35
35
|
"build": {
|
|
36
|
-
"gitHash": "
|
|
36
|
+
"gitHash": "e05cb0b38c81d9ea95d719504f4afe4a6c8737bf"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|