@teamkeel/functions-runtime 0.425.1 → 0.426.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/dist/index.cjs +48 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -22
- package/dist/index.d.ts +40 -22
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -265,6 +265,7 @@ declare class File extends InlineFile {
|
|
|
265
265
|
read(): Promise<Buffer>;
|
|
266
266
|
store(expires?: Date | null): Promise<File>;
|
|
267
267
|
getPresignedUrl(): Promise<URL>;
|
|
268
|
+
getPresignedUploadUrl(): Promise<URL>;
|
|
268
269
|
toDbRecord(): FileDbRecord;
|
|
269
270
|
toJSON(): FileDbRecord;
|
|
270
271
|
}
|
|
@@ -279,55 +280,55 @@ declare class Duration {
|
|
|
279
280
|
toPostgres(): string;
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
type ElementDataType$
|
|
283
|
-
type UiElementSelectOne = <const TValue extends ElementDataType$
|
|
283
|
+
type ElementDataType$5 = string | number | boolean | Date;
|
|
284
|
+
type UiElementSelectOne = <const TValue extends ElementDataType$5, N extends string, O extends boolean = false>(name: N, options?: BaseInputConfig<TValue, O> & {
|
|
284
285
|
options: ({
|
|
285
286
|
label: string;
|
|
286
287
|
value: TValue;
|
|
287
288
|
} | TValue)[];
|
|
288
289
|
}) => InputElementResponse<N, O extends true ? TValue | undefined : TValue>;
|
|
289
|
-
interface UiElementSelectOneApiResponse extends BaseUiInputResponse<"ui.select.one", ElementDataType$
|
|
290
|
+
interface UiElementSelectOneApiResponse extends BaseUiInputResponse<"ui.select.one", ElementDataType$5> {
|
|
290
291
|
options: ({
|
|
291
292
|
label: string;
|
|
292
|
-
value: ElementDataType$
|
|
293
|
-
} | ElementDataType$
|
|
293
|
+
value: ElementDataType$5;
|
|
294
|
+
} | ElementDataType$5)[];
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
type ElementDataType$
|
|
297
|
-
type UiElementInputText = InputElement<ElementDataType$
|
|
297
|
+
type ElementDataType$4 = string;
|
|
298
|
+
type UiElementInputText = InputElement<ElementDataType$4, {
|
|
298
299
|
placeholder?: string;
|
|
299
300
|
multiline?: boolean;
|
|
300
301
|
maxLength?: number;
|
|
301
302
|
minLength?: number;
|
|
302
303
|
}>;
|
|
303
|
-
interface UiElementInputTextApiResponse extends BaseUiInputResponse<"ui.input.text", ElementDataType$
|
|
304
|
+
interface UiElementInputTextApiResponse extends BaseUiInputResponse<"ui.input.text", ElementDataType$4> {
|
|
304
305
|
placeholder?: string;
|
|
305
306
|
multiline?: boolean;
|
|
306
307
|
maxLength?: number;
|
|
307
308
|
minLength?: number;
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
type ElementDataType$
|
|
311
|
-
type UiElementInputNumber = InputElement<ElementDataType$
|
|
311
|
+
type ElementDataType$3 = number;
|
|
312
|
+
type UiElementInputNumber = InputElement<ElementDataType$3, {
|
|
312
313
|
placeholder?: string;
|
|
313
314
|
min?: number;
|
|
314
315
|
max?: number;
|
|
315
316
|
}>;
|
|
316
|
-
interface UiElementInputNumberApiResponse extends BaseUiInputResponse<"ui.input.number", ElementDataType$
|
|
317
|
+
interface UiElementInputNumberApiResponse extends BaseUiInputResponse<"ui.input.number", ElementDataType$3> {
|
|
317
318
|
placeholder?: string;
|
|
318
319
|
min?: number;
|
|
319
320
|
max?: number;
|
|
320
321
|
}
|
|
321
322
|
|
|
322
|
-
type ElementDataType$
|
|
323
|
-
type UiElementInputBoolean = InputElement<ElementDataType$
|
|
323
|
+
type ElementDataType$2 = boolean;
|
|
324
|
+
type UiElementInputBoolean = InputElement<ElementDataType$2, {
|
|
324
325
|
mode?: "checkbox" | "switch";
|
|
325
326
|
}>;
|
|
326
|
-
interface UiElementInputBooleanApiResponse extends BaseUiInputResponse<"ui.input.boolean", ElementDataType$
|
|
327
|
+
interface UiElementInputBooleanApiResponse extends BaseUiInputResponse<"ui.input.boolean", ElementDataType$2> {
|
|
327
328
|
mode: "checkbox" | "switch";
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
type ElementDataType = string;
|
|
331
|
+
type ElementDataType$1 = string;
|
|
331
332
|
/**
|
|
332
333
|
* Defines what type of datepicker should we use.
|
|
333
334
|
* @default "dateTime"
|
|
@@ -337,19 +338,24 @@ type DatePickerMode =
|
|
|
337
338
|
"dateTime"
|
|
338
339
|
/** Pick only a date */
|
|
339
340
|
| "date";
|
|
340
|
-
type UiElementInputDatePicker = InputElement<ElementDataType, {
|
|
341
|
+
type UiElementInputDatePicker = InputElement<ElementDataType$1, {
|
|
341
342
|
mode?: DatePickerMode;
|
|
342
343
|
/** Allows selecting only dates/datetimes past this given date. */
|
|
343
344
|
min?: string;
|
|
344
345
|
/** Allows selecting only dates/datetimes before this given date. */
|
|
345
346
|
max?: string;
|
|
346
347
|
}>;
|
|
347
|
-
interface UiElementInputDatePickerApiResponse extends BaseUiInputResponse<"ui.input.datePicker", ElementDataType> {
|
|
348
|
+
interface UiElementInputDatePickerApiResponse extends BaseUiInputResponse<"ui.input.datePicker", ElementDataType$1> {
|
|
348
349
|
mode?: DatePickerMode;
|
|
349
350
|
min?: string;
|
|
350
351
|
max?: string;
|
|
351
352
|
}
|
|
352
353
|
|
|
354
|
+
type ElementDataType = Partial<FileDbRecord>;
|
|
355
|
+
type UiElementInputFile = InputElement<ElementDataType, {}, File>;
|
|
356
|
+
interface UiElementInputFileApiResponse extends BaseUiInputResponse<"ui.input.file", ElementDataType> {
|
|
357
|
+
}
|
|
358
|
+
|
|
353
359
|
type UiElementMarkdown = DisplayElement<{
|
|
354
360
|
content: string;
|
|
355
361
|
}>;
|
|
@@ -399,7 +405,7 @@ type ActionValue<T> = T extends string ? T : T extends {
|
|
|
399
405
|
value: infer V;
|
|
400
406
|
} ? V : never;
|
|
401
407
|
type ExtractFormData<T extends UIElements> = {
|
|
402
|
-
[K in Extract<T[number], InputElementResponse<string, any>>["name"]]: Extract<T[number], InputElementResponse<K, any>>["
|
|
408
|
+
[K in Extract<T[number], InputElementResponse<string, any>>["name"]]: Extract<T[number], InputElementResponse<K, any>>["returnType"];
|
|
403
409
|
};
|
|
404
410
|
|
|
405
411
|
type UiElementImage = DisplayElement<{
|
|
@@ -815,6 +821,7 @@ type UiInputsElements = {
|
|
|
815
821
|
dataGrid: UiElementInputDataGrid;
|
|
816
822
|
datePicker: UiElementInputDatePicker;
|
|
817
823
|
scan: UiElementScan;
|
|
824
|
+
file: UiElementInputFile;
|
|
818
825
|
};
|
|
819
826
|
type UiSelectElements = {
|
|
820
827
|
one: UiElementSelectOne;
|
|
@@ -837,18 +844,28 @@ type UiInteractiveElements<H extends NullableHardware> = {
|
|
|
837
844
|
print: UiElementPrint<H>;
|
|
838
845
|
pickList: UiElementPickList;
|
|
839
846
|
};
|
|
840
|
-
type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
|
|
847
|
+
type InputElement<TValueType, TConfig extends any = never, TReturnType = TValueType> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType, TReturnType>;
|
|
841
848
|
type DisplayElement<TConfig extends any = never> = (options?: TConfig) => DisplayElementResponse;
|
|
842
849
|
type DisplayElementWithRequiredConfig<TConfig extends any = never> = (options: TConfig) => DisplayElementResponse;
|
|
843
|
-
type UIElement = InputElementResponse<string, any> | DisplayElementResponse | IteratorElementResponse<string, any>;
|
|
850
|
+
type UIElement = InputElementResponse<string, any, any> | DisplayElementResponse | IteratorElementResponse<string, any>;
|
|
844
851
|
type UIElements = UIElement[];
|
|
845
852
|
interface UIElementBase {
|
|
846
853
|
_type: string;
|
|
847
854
|
}
|
|
848
|
-
|
|
855
|
+
/**
|
|
856
|
+
* Type for the input element; name, data type, return data type
|
|
857
|
+
* InputElementResponse<"ui.input.text", string>
|
|
858
|
+
* InputElementResponse<"ui.input.file", Partial<FileDBRecord>, File>
|
|
859
|
+
*/
|
|
860
|
+
interface InputElementResponse<N extends string, V, RV = V> extends UIElementBase {
|
|
849
861
|
_type: "input";
|
|
850
862
|
name: N;
|
|
851
863
|
valueType: V;
|
|
864
|
+
/**
|
|
865
|
+
* The type of the value returned from the step (page). Rich field types will operate on a json serialisable object
|
|
866
|
+
* but will return a complex type to be used in subsequent steps
|
|
867
|
+
*/
|
|
868
|
+
returnType: RV;
|
|
852
869
|
}
|
|
853
870
|
interface DisplayElementResponse extends UIElementBase {
|
|
854
871
|
_type: "display";
|
|
@@ -908,6 +925,7 @@ type UIApiResponses = {
|
|
|
908
925
|
dataGrid: UiElementInputDataGridApiResponse;
|
|
909
926
|
datePicker: UiElementInputDatePickerApiResponse;
|
|
910
927
|
scan: UiElementInputScanApiResponse;
|
|
928
|
+
file: UiElementInputFileApiResponse;
|
|
911
929
|
};
|
|
912
930
|
select: {
|
|
913
931
|
one: UiElementSelectOneApiResponse;
|
|
@@ -919,7 +937,7 @@ type UIApiResponses = {
|
|
|
919
937
|
pickList: UiElementPickListApiResponse;
|
|
920
938
|
};
|
|
921
939
|
};
|
|
922
|
-
type UiElementApiResponse = UiElementDividerApiResponse | UiElementMarkdownApiResponse | UiElementHeaderApiResponse | UiElementBannerApiResponse | UiElementImageApiResponse | UiElementCodeApiResponse | UiElementGridApiResponse | UiElementListApiResponse | UiElementTableApiResponse | UiElementKeyValueApiResponse | UiElementFileApiResponse | UiElementInputTextApiResponse | UiElementInputNumberApiResponse | UiElementInputBooleanApiResponse | UiElementInputDataGridApiResponse | UiElementInputScanApiResponse | UiElementInputDatePickerApiResponse | UiElementSelectOneApiResponse | UiElementSelectTableApiResponse | UiElementIteratorApiResponse | UiElementPrintApiResponse | UiElementPickListApiResponse;
|
|
940
|
+
type UiElementApiResponse = UiElementDividerApiResponse | UiElementMarkdownApiResponse | UiElementHeaderApiResponse | UiElementBannerApiResponse | UiElementImageApiResponse | UiElementCodeApiResponse | UiElementGridApiResponse | UiElementListApiResponse | UiElementTableApiResponse | UiElementKeyValueApiResponse | UiElementFileApiResponse | UiElementInputTextApiResponse | UiElementInputNumberApiResponse | UiElementInputBooleanApiResponse | UiElementInputDataGridApiResponse | UiElementInputScanApiResponse | UiElementInputDatePickerApiResponse | UiElementInputFileApiResponse | UiElementSelectOneApiResponse | UiElementSelectTableApiResponse | UiElementIteratorApiResponse | UiElementPrintApiResponse | UiElementPickListApiResponse;
|
|
923
941
|
type UiElementApiResponses = UiElementApiResponse[];
|
|
924
942
|
|
|
925
943
|
declare class NonRetriableError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ declare class File extends InlineFile {
|
|
|
265
265
|
read(): Promise<Buffer>;
|
|
266
266
|
store(expires?: Date | null): Promise<File>;
|
|
267
267
|
getPresignedUrl(): Promise<URL>;
|
|
268
|
+
getPresignedUploadUrl(): Promise<URL>;
|
|
268
269
|
toDbRecord(): FileDbRecord;
|
|
269
270
|
toJSON(): FileDbRecord;
|
|
270
271
|
}
|
|
@@ -279,55 +280,55 @@ declare class Duration {
|
|
|
279
280
|
toPostgres(): string;
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
type ElementDataType$
|
|
283
|
-
type UiElementSelectOne = <const TValue extends ElementDataType$
|
|
283
|
+
type ElementDataType$5 = string | number | boolean | Date;
|
|
284
|
+
type UiElementSelectOne = <const TValue extends ElementDataType$5, N extends string, O extends boolean = false>(name: N, options?: BaseInputConfig<TValue, O> & {
|
|
284
285
|
options: ({
|
|
285
286
|
label: string;
|
|
286
287
|
value: TValue;
|
|
287
288
|
} | TValue)[];
|
|
288
289
|
}) => InputElementResponse<N, O extends true ? TValue | undefined : TValue>;
|
|
289
|
-
interface UiElementSelectOneApiResponse extends BaseUiInputResponse<"ui.select.one", ElementDataType$
|
|
290
|
+
interface UiElementSelectOneApiResponse extends BaseUiInputResponse<"ui.select.one", ElementDataType$5> {
|
|
290
291
|
options: ({
|
|
291
292
|
label: string;
|
|
292
|
-
value: ElementDataType$
|
|
293
|
-
} | ElementDataType$
|
|
293
|
+
value: ElementDataType$5;
|
|
294
|
+
} | ElementDataType$5)[];
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
type ElementDataType$
|
|
297
|
-
type UiElementInputText = InputElement<ElementDataType$
|
|
297
|
+
type ElementDataType$4 = string;
|
|
298
|
+
type UiElementInputText = InputElement<ElementDataType$4, {
|
|
298
299
|
placeholder?: string;
|
|
299
300
|
multiline?: boolean;
|
|
300
301
|
maxLength?: number;
|
|
301
302
|
minLength?: number;
|
|
302
303
|
}>;
|
|
303
|
-
interface UiElementInputTextApiResponse extends BaseUiInputResponse<"ui.input.text", ElementDataType$
|
|
304
|
+
interface UiElementInputTextApiResponse extends BaseUiInputResponse<"ui.input.text", ElementDataType$4> {
|
|
304
305
|
placeholder?: string;
|
|
305
306
|
multiline?: boolean;
|
|
306
307
|
maxLength?: number;
|
|
307
308
|
minLength?: number;
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
type ElementDataType$
|
|
311
|
-
type UiElementInputNumber = InputElement<ElementDataType$
|
|
311
|
+
type ElementDataType$3 = number;
|
|
312
|
+
type UiElementInputNumber = InputElement<ElementDataType$3, {
|
|
312
313
|
placeholder?: string;
|
|
313
314
|
min?: number;
|
|
314
315
|
max?: number;
|
|
315
316
|
}>;
|
|
316
|
-
interface UiElementInputNumberApiResponse extends BaseUiInputResponse<"ui.input.number", ElementDataType$
|
|
317
|
+
interface UiElementInputNumberApiResponse extends BaseUiInputResponse<"ui.input.number", ElementDataType$3> {
|
|
317
318
|
placeholder?: string;
|
|
318
319
|
min?: number;
|
|
319
320
|
max?: number;
|
|
320
321
|
}
|
|
321
322
|
|
|
322
|
-
type ElementDataType$
|
|
323
|
-
type UiElementInputBoolean = InputElement<ElementDataType$
|
|
323
|
+
type ElementDataType$2 = boolean;
|
|
324
|
+
type UiElementInputBoolean = InputElement<ElementDataType$2, {
|
|
324
325
|
mode?: "checkbox" | "switch";
|
|
325
326
|
}>;
|
|
326
|
-
interface UiElementInputBooleanApiResponse extends BaseUiInputResponse<"ui.input.boolean", ElementDataType$
|
|
327
|
+
interface UiElementInputBooleanApiResponse extends BaseUiInputResponse<"ui.input.boolean", ElementDataType$2> {
|
|
327
328
|
mode: "checkbox" | "switch";
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
type ElementDataType = string;
|
|
331
|
+
type ElementDataType$1 = string;
|
|
331
332
|
/**
|
|
332
333
|
* Defines what type of datepicker should we use.
|
|
333
334
|
* @default "dateTime"
|
|
@@ -337,19 +338,24 @@ type DatePickerMode =
|
|
|
337
338
|
"dateTime"
|
|
338
339
|
/** Pick only a date */
|
|
339
340
|
| "date";
|
|
340
|
-
type UiElementInputDatePicker = InputElement<ElementDataType, {
|
|
341
|
+
type UiElementInputDatePicker = InputElement<ElementDataType$1, {
|
|
341
342
|
mode?: DatePickerMode;
|
|
342
343
|
/** Allows selecting only dates/datetimes past this given date. */
|
|
343
344
|
min?: string;
|
|
344
345
|
/** Allows selecting only dates/datetimes before this given date. */
|
|
345
346
|
max?: string;
|
|
346
347
|
}>;
|
|
347
|
-
interface UiElementInputDatePickerApiResponse extends BaseUiInputResponse<"ui.input.datePicker", ElementDataType> {
|
|
348
|
+
interface UiElementInputDatePickerApiResponse extends BaseUiInputResponse<"ui.input.datePicker", ElementDataType$1> {
|
|
348
349
|
mode?: DatePickerMode;
|
|
349
350
|
min?: string;
|
|
350
351
|
max?: string;
|
|
351
352
|
}
|
|
352
353
|
|
|
354
|
+
type ElementDataType = Partial<FileDbRecord>;
|
|
355
|
+
type UiElementInputFile = InputElement<ElementDataType, {}, File>;
|
|
356
|
+
interface UiElementInputFileApiResponse extends BaseUiInputResponse<"ui.input.file", ElementDataType> {
|
|
357
|
+
}
|
|
358
|
+
|
|
353
359
|
type UiElementMarkdown = DisplayElement<{
|
|
354
360
|
content: string;
|
|
355
361
|
}>;
|
|
@@ -399,7 +405,7 @@ type ActionValue<T> = T extends string ? T : T extends {
|
|
|
399
405
|
value: infer V;
|
|
400
406
|
} ? V : never;
|
|
401
407
|
type ExtractFormData<T extends UIElements> = {
|
|
402
|
-
[K in Extract<T[number], InputElementResponse<string, any>>["name"]]: Extract<T[number], InputElementResponse<K, any>>["
|
|
408
|
+
[K in Extract<T[number], InputElementResponse<string, any>>["name"]]: Extract<T[number], InputElementResponse<K, any>>["returnType"];
|
|
403
409
|
};
|
|
404
410
|
|
|
405
411
|
type UiElementImage = DisplayElement<{
|
|
@@ -815,6 +821,7 @@ type UiInputsElements = {
|
|
|
815
821
|
dataGrid: UiElementInputDataGrid;
|
|
816
822
|
datePicker: UiElementInputDatePicker;
|
|
817
823
|
scan: UiElementScan;
|
|
824
|
+
file: UiElementInputFile;
|
|
818
825
|
};
|
|
819
826
|
type UiSelectElements = {
|
|
820
827
|
one: UiElementSelectOne;
|
|
@@ -837,18 +844,28 @@ type UiInteractiveElements<H extends NullableHardware> = {
|
|
|
837
844
|
print: UiElementPrint<H>;
|
|
838
845
|
pickList: UiElementPickList;
|
|
839
846
|
};
|
|
840
|
-
type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
|
|
847
|
+
type InputElement<TValueType, TConfig extends any = never, TReturnType = TValueType> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType, TReturnType>;
|
|
841
848
|
type DisplayElement<TConfig extends any = never> = (options?: TConfig) => DisplayElementResponse;
|
|
842
849
|
type DisplayElementWithRequiredConfig<TConfig extends any = never> = (options: TConfig) => DisplayElementResponse;
|
|
843
|
-
type UIElement = InputElementResponse<string, any> | DisplayElementResponse | IteratorElementResponse<string, any>;
|
|
850
|
+
type UIElement = InputElementResponse<string, any, any> | DisplayElementResponse | IteratorElementResponse<string, any>;
|
|
844
851
|
type UIElements = UIElement[];
|
|
845
852
|
interface UIElementBase {
|
|
846
853
|
_type: string;
|
|
847
854
|
}
|
|
848
|
-
|
|
855
|
+
/**
|
|
856
|
+
* Type for the input element; name, data type, return data type
|
|
857
|
+
* InputElementResponse<"ui.input.text", string>
|
|
858
|
+
* InputElementResponse<"ui.input.file", Partial<FileDBRecord>, File>
|
|
859
|
+
*/
|
|
860
|
+
interface InputElementResponse<N extends string, V, RV = V> extends UIElementBase {
|
|
849
861
|
_type: "input";
|
|
850
862
|
name: N;
|
|
851
863
|
valueType: V;
|
|
864
|
+
/**
|
|
865
|
+
* The type of the value returned from the step (page). Rich field types will operate on a json serialisable object
|
|
866
|
+
* but will return a complex type to be used in subsequent steps
|
|
867
|
+
*/
|
|
868
|
+
returnType: RV;
|
|
852
869
|
}
|
|
853
870
|
interface DisplayElementResponse extends UIElementBase {
|
|
854
871
|
_type: "display";
|
|
@@ -908,6 +925,7 @@ type UIApiResponses = {
|
|
|
908
925
|
dataGrid: UiElementInputDataGridApiResponse;
|
|
909
926
|
datePicker: UiElementInputDatePickerApiResponse;
|
|
910
927
|
scan: UiElementInputScanApiResponse;
|
|
928
|
+
file: UiElementInputFileApiResponse;
|
|
911
929
|
};
|
|
912
930
|
select: {
|
|
913
931
|
one: UiElementSelectOneApiResponse;
|
|
@@ -919,7 +937,7 @@ type UIApiResponses = {
|
|
|
919
937
|
pickList: UiElementPickListApiResponse;
|
|
920
938
|
};
|
|
921
939
|
};
|
|
922
|
-
type UiElementApiResponse = UiElementDividerApiResponse | UiElementMarkdownApiResponse | UiElementHeaderApiResponse | UiElementBannerApiResponse | UiElementImageApiResponse | UiElementCodeApiResponse | UiElementGridApiResponse | UiElementListApiResponse | UiElementTableApiResponse | UiElementKeyValueApiResponse | UiElementFileApiResponse | UiElementInputTextApiResponse | UiElementInputNumberApiResponse | UiElementInputBooleanApiResponse | UiElementInputDataGridApiResponse | UiElementInputScanApiResponse | UiElementInputDatePickerApiResponse | UiElementSelectOneApiResponse | UiElementSelectTableApiResponse | UiElementIteratorApiResponse | UiElementPrintApiResponse | UiElementPickListApiResponse;
|
|
940
|
+
type UiElementApiResponse = UiElementDividerApiResponse | UiElementMarkdownApiResponse | UiElementHeaderApiResponse | UiElementBannerApiResponse | UiElementImageApiResponse | UiElementCodeApiResponse | UiElementGridApiResponse | UiElementListApiResponse | UiElementTableApiResponse | UiElementKeyValueApiResponse | UiElementFileApiResponse | UiElementInputTextApiResponse | UiElementInputNumberApiResponse | UiElementInputBooleanApiResponse | UiElementInputDataGridApiResponse | UiElementInputScanApiResponse | UiElementInputDatePickerApiResponse | UiElementInputFileApiResponse | UiElementSelectOneApiResponse | UiElementSelectTableApiResponse | UiElementIteratorApiResponse | UiElementPrintApiResponse | UiElementPickListApiResponse;
|
|
923
941
|
type UiElementApiResponses = UiElementApiResponse[];
|
|
924
942
|
|
|
925
943
|
declare class NonRetriableError extends Error {
|
package/dist/index.js
CHANGED
|
@@ -735,6 +735,21 @@ var File = class _File extends InlineFile {
|
|
|
735
735
|
const url = await getSignedUrl(s3Client, command, { expiresIn: 60 * 60 });
|
|
736
736
|
return new URL(url);
|
|
737
737
|
}
|
|
738
|
+
// Generates a presigned upload URL. If the file doesn't have a key, a new one will be generated
|
|
739
|
+
async getPresignedUploadUrl() {
|
|
740
|
+
if (!s3Client) {
|
|
741
|
+
throw new Error("S3 client is required");
|
|
742
|
+
}
|
|
743
|
+
if (!this.key) {
|
|
744
|
+
this._key = KSUID.randomSync().string;
|
|
745
|
+
}
|
|
746
|
+
const command = new PutObjectCommand({
|
|
747
|
+
Bucket: process.env.KEEL_FILES_BUCKET_NAME,
|
|
748
|
+
Key: "files/" + this.key
|
|
749
|
+
});
|
|
750
|
+
const url = await getSignedUrl(s3Client, command, { expiresIn: 60 * 60 });
|
|
751
|
+
return new URL(url);
|
|
752
|
+
}
|
|
738
753
|
// Persists the file
|
|
739
754
|
toDbRecord() {
|
|
740
755
|
return {
|
|
@@ -2865,6 +2880,31 @@ var datePickerInput = /* @__PURE__ */ __name((name, options) => {
|
|
|
2865
2880
|
};
|
|
2866
2881
|
}, "datePickerInput");
|
|
2867
2882
|
|
|
2883
|
+
// src/flows/ui/elements/input/file.ts
|
|
2884
|
+
var fileInput = /* @__PURE__ */ __name((name, options) => {
|
|
2885
|
+
return {
|
|
2886
|
+
__type: "input",
|
|
2887
|
+
uiConfig: {
|
|
2888
|
+
__type: "ui.input.file",
|
|
2889
|
+
name,
|
|
2890
|
+
label: options?.label || name,
|
|
2891
|
+
optional: options?.optional || false,
|
|
2892
|
+
disabled: options?.disabled || false,
|
|
2893
|
+
helpText: options?.helpText
|
|
2894
|
+
},
|
|
2895
|
+
validate: options?.validate,
|
|
2896
|
+
getData: /* @__PURE__ */ __name((x) => x, "getData"),
|
|
2897
|
+
getPresignedUploadURL: /* @__PURE__ */ __name((async (input) => {
|
|
2898
|
+
const file2 = new File(input);
|
|
2899
|
+
const url = await file2.getPresignedUploadUrl();
|
|
2900
|
+
return {
|
|
2901
|
+
url: url.toString(),
|
|
2902
|
+
key: file2.key
|
|
2903
|
+
};
|
|
2904
|
+
}), "getPresignedUploadURL")
|
|
2905
|
+
};
|
|
2906
|
+
}, "fileInput");
|
|
2907
|
+
|
|
2868
2908
|
// src/flows/ui/elements/iterator.ts
|
|
2869
2909
|
var iterator = /* @__PURE__ */ __name((name, options) => {
|
|
2870
2910
|
return {
|
|
@@ -3183,10 +3223,11 @@ function createFlowContext(runId, data, action, callback, element, spanId, ctx)
|
|
|
3183
3223
|
let step = await db.selectFrom("keel.flow_step").where("run_id", "=", runId).where("name", "=", name).selectAll().executeTakeFirst();
|
|
3184
3224
|
if (step && step.status === "COMPLETED" /* COMPLETED */) {
|
|
3185
3225
|
span.setAttribute(KEEL_INTERNAL_ATTR, KEEL_INTERNAL_CHILDREN);
|
|
3226
|
+
const parsedData2 = transformRichDataTypes(step.value);
|
|
3186
3227
|
if (step.action) {
|
|
3187
|
-
return { data:
|
|
3228
|
+
return { data: parsedData2, action: step.action };
|
|
3188
3229
|
}
|
|
3189
|
-
return
|
|
3230
|
+
return parsedData2;
|
|
3190
3231
|
}
|
|
3191
3232
|
if (!step) {
|
|
3192
3233
|
step = await db.insertInto("keel.flow_step").values({
|
|
@@ -3253,10 +3294,11 @@ function createFlowContext(runId, data, action, callback, element, spanId, ctx)
|
|
|
3253
3294
|
spanId,
|
|
3254
3295
|
endTime: /* @__PURE__ */ new Date()
|
|
3255
3296
|
}).where("id", "=", step.id).returningAll().executeTakeFirst();
|
|
3297
|
+
const parsedData = transformRichDataTypes(data);
|
|
3256
3298
|
if (action) {
|
|
3257
|
-
return { data, action };
|
|
3299
|
+
return { data: parsedData, action };
|
|
3258
3300
|
}
|
|
3259
|
-
return
|
|
3301
|
+
return parsedData;
|
|
3260
3302
|
});
|
|
3261
3303
|
}), "page"),
|
|
3262
3304
|
inputs: {
|
|
@@ -3265,7 +3307,8 @@ function createFlowContext(runId, data, action, callback, element, spanId, ctx)
|
|
|
3265
3307
|
boolean: booleanInput,
|
|
3266
3308
|
dataGrid: dataGridInput,
|
|
3267
3309
|
datePicker: datePickerInput,
|
|
3268
|
-
scan
|
|
3310
|
+
scan,
|
|
3311
|
+
file: fileInput
|
|
3269
3312
|
},
|
|
3270
3313
|
display: {
|
|
3271
3314
|
divider,
|