@teamkeel/functions-runtime 0.454.3 → 0.455.1
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/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1124,7 +1124,7 @@ interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.in
|
|
|
1124
1124
|
autoContinue: boolean;
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
|
-
type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none">(name: N, options?: ScanOptions<M, D>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
|
|
1127
|
+
type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none", R = string | null>(name: N, options?: ScanOptions<M, D, R>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
|
|
1128
1128
|
type ScanResponseItem<D> = D extends "trackQuantity" ? {
|
|
1129
1129
|
value: string;
|
|
1130
1130
|
quantity: number;
|
|
@@ -1141,7 +1141,7 @@ type ScanDuplicateMode =
|
|
|
1141
1141
|
/** Reject duplicate scans with an error message */
|
|
1142
1142
|
| "rejectDuplicates";
|
|
1143
1143
|
type scanMode = "single" | "multi";
|
|
1144
|
-
type ScanOptions<M, D> = {
|
|
1144
|
+
type ScanOptions<M, D, R = string | null> = {
|
|
1145
1145
|
/** The title of the input block
|
|
1146
1146
|
* @default "Scan {unit plural | 'items'}"
|
|
1147
1147
|
*/
|
|
@@ -1154,6 +1154,13 @@ type ScanOptions<M, D> = {
|
|
|
1154
1154
|
*/
|
|
1155
1155
|
mode: M | scanMode;
|
|
1156
1156
|
validate?: ValidateFn<ScanResponseItem<D>>;
|
|
1157
|
+
/** Converts a scanned value into the value this element should return.
|
|
1158
|
+
* Use it to turn a raw barcode into the data your flow actually wants —
|
|
1159
|
+
* e.g. a product name, an internal ID, or a full record. Defaults to
|
|
1160
|
+
* `string | null`; return a richer JSON-serializable shape to let
|
|
1161
|
+
* TypeScript infer it.
|
|
1162
|
+
*/
|
|
1163
|
+
lookup?: (value: string) => R | Promise<R>;
|
|
1157
1164
|
} & (M extends "multi" ? {
|
|
1158
1165
|
max?: number;
|
|
1159
1166
|
min?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1124,7 +1124,7 @@ interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.in
|
|
|
1124
1124
|
autoContinue: boolean;
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
|
-
type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none">(name: N, options?: ScanOptions<M, D>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
|
|
1127
|
+
type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none", R = string | null>(name: N, options?: ScanOptions<M, D, R>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
|
|
1128
1128
|
type ScanResponseItem<D> = D extends "trackQuantity" ? {
|
|
1129
1129
|
value: string;
|
|
1130
1130
|
quantity: number;
|
|
@@ -1141,7 +1141,7 @@ type ScanDuplicateMode =
|
|
|
1141
1141
|
/** Reject duplicate scans with an error message */
|
|
1142
1142
|
| "rejectDuplicates";
|
|
1143
1143
|
type scanMode = "single" | "multi";
|
|
1144
|
-
type ScanOptions<M, D> = {
|
|
1144
|
+
type ScanOptions<M, D, R = string | null> = {
|
|
1145
1145
|
/** The title of the input block
|
|
1146
1146
|
* @default "Scan {unit plural | 'items'}"
|
|
1147
1147
|
*/
|
|
@@ -1154,6 +1154,13 @@ type ScanOptions<M, D> = {
|
|
|
1154
1154
|
*/
|
|
1155
1155
|
mode: M | scanMode;
|
|
1156
1156
|
validate?: ValidateFn<ScanResponseItem<D>>;
|
|
1157
|
+
/** Converts a scanned value into the value this element should return.
|
|
1158
|
+
* Use it to turn a raw barcode into the data your flow actually wants —
|
|
1159
|
+
* e.g. a product name, an internal ID, or a full record. Defaults to
|
|
1160
|
+
* `string | null`; return a richer JSON-serializable shape to let
|
|
1161
|
+
* TypeScript infer it.
|
|
1162
|
+
*/
|
|
1163
|
+
lookup?: (value: string) => R | Promise<R>;
|
|
1157
1164
|
} & (M extends "multi" ? {
|
|
1158
1165
|
max?: number;
|
|
1159
1166
|
min?: number;
|
package/dist/index.js
CHANGED
|
@@ -4145,7 +4145,8 @@ var scan = /* @__PURE__ */ __name((name, options) => {
|
|
|
4145
4145
|
validate: /* @__PURE__ */ __name(async (data, action) => {
|
|
4146
4146
|
return options?.validate?.(data, action) ?? true;
|
|
4147
4147
|
}, "validate"),
|
|
4148
|
-
getData: /* @__PURE__ */ __name((x) => x, "getData")
|
|
4148
|
+
getData: /* @__PURE__ */ __name((x) => x, "getData"),
|
|
4149
|
+
lookup: options?.lookup
|
|
4149
4150
|
};
|
|
4150
4151
|
}, "scan");
|
|
4151
4152
|
|