@teamkeel/functions-runtime 0.421.1 → 0.421.2

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.d.cts CHANGED
@@ -593,8 +593,8 @@ interface UiElementIteratorApiResponse extends BaseUiDisplayResponse<"ui.iterato
593
593
  }>;
594
594
  }
595
595
 
596
- type UiElementPrint = DisplayElementWithRequiredConfig<{
597
- jobs: PrintData[] | PrintData;
596
+ type UiElementPrint<H extends NullableHardware> = DisplayElementWithRequiredConfig<{
597
+ jobs: PrintData<H>[] | PrintData<H>;
598
598
  title?: string;
599
599
  description?: string;
600
600
  /** If true, the jobs will be automatically printed. */
@@ -602,8 +602,9 @@ type UiElementPrint = DisplayElementWithRequiredConfig<{
602
602
  /** If true, the flow will continue after the jobs are complete. */
603
603
  autoContinue?: boolean;
604
604
  }>;
605
- type PrintData = {
605
+ type PrintData<H extends NullableHardware> = {
606
606
  type: "zpl";
607
+ printer?: H extends Hardware ? H["printers"][number]["name"] : never;
607
608
  name?: string;
608
609
  data: string | string[];
609
610
  };
@@ -614,6 +615,7 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
614
615
  type: "url" | "text" | "html" | "zpl";
615
616
  data?: string[];
616
617
  url?: string;
618
+ printer?: string;
617
619
  }[];
618
620
  autoPrint: boolean;
619
621
  }
@@ -638,7 +640,7 @@ type PickListItem = {
638
640
  type ListOptions<T> = {
639
641
  data: T[];
640
642
  render: (data: T) => PickListItem;
641
- validate?: ValidateFn<PickListResponseItem>;
643
+ validate?: ValidateFn<PickListResponseItem[]>;
642
644
  };
643
645
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
644
646
  data: PickListItem[];
@@ -705,13 +707,13 @@ interface UiElementFileApiResponse extends BaseUiDisplayResponse<"ui.display.fil
705
707
  };
706
708
  }
707
709
 
708
- interface UI<C extends FlowConfig> {
710
+ interface UI<C extends FlowConfig, H extends NullableHardware> {
709
711
  page: UiPage<C>;
710
712
  display: UiDisplayElements;
711
713
  inputs: UiInputsElements;
712
714
  select: UiSelectElements;
713
715
  iterator: UiElementIterator;
714
- interactive: UiInteractiveElements;
716
+ interactive: UiInteractiveElements<H>;
715
717
  }
716
718
  type UiInputsElements = {
717
719
  text: UiElementInputText;
@@ -737,8 +739,8 @@ type UiDisplayElements = {
737
739
  keyValue: UiElementKeyValue;
738
740
  file: UiElementFile;
739
741
  };
740
- type UiInteractiveElements = {
741
- print: UiElementPrint;
742
+ type UiInteractiveElements<H extends NullableHardware> = {
743
+ print: UiElementPrint<H>;
742
744
  pickList: UiElementPickList;
743
745
  };
744
746
  type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
@@ -859,15 +861,22 @@ declare const RetryConstant: (intervalS: number) => RetryPolicyFn;
859
861
  * @param intervalS the base duration in seconds.
860
862
  */
861
863
  declare const RetryBackoffExponential: (intervalS: number) => RetryPolicyFn;
862
- interface FlowContext<C extends FlowConfig, E, S, Id, I> {
864
+ interface FlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware> {
863
865
  step: Step<C>;
864
- ui: UI<C>;
866
+ ui: UI<C, H>;
865
867
  complete: Complete<C, I>;
866
868
  env: E;
867
869
  now: Date;
868
870
  secrets: S;
869
871
  identity: Id;
870
872
  }
873
+ type NullableHardware = Hardware | undefined;
874
+ type Hardware = {
875
+ printers: Printer[];
876
+ };
877
+ interface Printer {
878
+ name: string;
879
+ }
871
880
  type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
872
881
  [key: string]: JsonSerializable;
873
882
  };
@@ -914,7 +923,7 @@ interface FlowConfigAPI {
914
923
  title: string;
915
924
  description?: string;
916
925
  }
917
- type FlowFunction<C extends FlowConfig, E, S, Id, I = undefined> = (ctx: FlowContext<C, E, S, Id, I>, inputs: I) => Promise<CompleteOptions<C, I> | any | void>;
926
+ type FlowFunction<C extends FlowConfig, E, S, Id, I = undefined, H extends NullableHardware = undefined> = (ctx: FlowContext<C, E, S, Id, I, H>, inputs: I) => Promise<CompleteOptions<C, I> | any | void>;
918
927
  type ExtractStageKeys<T extends FlowConfig> = T extends {
919
928
  stages: infer S;
920
929
  } ? S extends ReadonlyArray<infer U> ? U extends string ? U : U extends {
@@ -931,12 +940,12 @@ type StageConfigObject = {
931
940
  initiallyHidden?: boolean;
932
941
  };
933
942
  type StageConfig = string | StageConfigObject;
934
- declare function createFlowContext<C extends FlowConfig, E, S, Id, I>(runId: string, data: any, action: string | null, callback: string | null, element: string | null, spanId: string, ctx: {
943
+ declare function createFlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware>(runId: string, data: any, action: string | null, callback: string | null, element: string | null, spanId: string, ctx: {
935
944
  env: E;
936
945
  now: Date;
937
946
  secrets: S;
938
947
  identity: Id;
939
- }): FlowContext<C, E, S, Id, I>;
948
+ }): FlowContext<C, E, S, Id, I, H>;
940
949
 
941
950
  declare function ksuid(): string;
942
951
 
@@ -1106,4 +1115,4 @@ type dateDuration = `${number}Y${number}M${number}D` | `${number}Y${number}M` |
1106
1115
  type timeDuration = `${number}H${number}M${number}S` | `${number}H${number}M` | `${number}M${number}S` | `${number}H${number}S` | `${number}H` | `${number}M` | `${number}S`;
1107
1116
  type DurationString = `P${dateDuration}T${timeDuration}` | `P${dateDuration}` | `PT${timeDuration}`;
1108
1117
 
1109
- export { type BooleanArrayQueryWhereCondition, type BooleanArrayWhereCondition, type BooleanWhereCondition, type ContextAPI, type DateArrayQueryWhereCondition, type DateArrayWhereCondition, type DateQueryInput, type DateWhereCondition, Duration, type DurationString, type DurationWhereCondition, ErrorPresets, type Errors, type ExtractStageKeys, File, type FlowConfig, type FlowConfigAPI, type FlowContext, type FlowFunction, type FuncWithConfig, type FunctionConfig, type IDWhereCondition, InlineFile, ModelAPI, NonRetriableError, type NumberArrayQueryWhereCondition, type NumberArrayWhereCondition, type NumberWhereCondition, PERMISSION_STATE, type PageInfo, Permissions, type RelativeDateString, RequestHeaders, type Response, RetryBackoffExponential, RetryBackoffLinear, RetryConstant, STEP_STATUS, STEP_TYPE, type SortDirection, type Step, type StringArrayQueryWhereCondition, type StringArrayWhereCondition, type StringWhereCondition, type TimestampQueryInput, type UI, type UIApiResponses, checkBuiltInPermissions, createFlowContext, handleFlow, handleJob, handleRequest, handleRoute, handleSubscriber, ksuid, tracing, useDatabase };
1118
+ export { type BooleanArrayQueryWhereCondition, type BooleanArrayWhereCondition, type BooleanWhereCondition, type ContextAPI, type DateArrayQueryWhereCondition, type DateArrayWhereCondition, type DateQueryInput, type DateWhereCondition, Duration, type DurationString, type DurationWhereCondition, ErrorPresets, type Errors, type ExtractStageKeys, File, type FlowConfig, type FlowConfigAPI, type FlowContext, type FlowFunction, type FuncWithConfig, type FunctionConfig, type Hardware, type IDWhereCondition, InlineFile, ModelAPI, NonRetriableError, type NullableHardware, type NumberArrayQueryWhereCondition, type NumberArrayWhereCondition, type NumberWhereCondition, PERMISSION_STATE, type PageInfo, Permissions, type Printer, type RelativeDateString, RequestHeaders, type Response, RetryBackoffExponential, RetryBackoffLinear, RetryConstant, STEP_STATUS, STEP_TYPE, type SortDirection, type Step, type StringArrayQueryWhereCondition, type StringArrayWhereCondition, type StringWhereCondition, type TimestampQueryInput, type UI, type UIApiResponses, checkBuiltInPermissions, createFlowContext, handleFlow, handleJob, handleRequest, handleRoute, handleSubscriber, ksuid, tracing, useDatabase };
package/dist/index.d.ts CHANGED
@@ -593,8 +593,8 @@ interface UiElementIteratorApiResponse extends BaseUiDisplayResponse<"ui.iterato
593
593
  }>;
594
594
  }
595
595
 
596
- type UiElementPrint = DisplayElementWithRequiredConfig<{
597
- jobs: PrintData[] | PrintData;
596
+ type UiElementPrint<H extends NullableHardware> = DisplayElementWithRequiredConfig<{
597
+ jobs: PrintData<H>[] | PrintData<H>;
598
598
  title?: string;
599
599
  description?: string;
600
600
  /** If true, the jobs will be automatically printed. */
@@ -602,8 +602,9 @@ type UiElementPrint = DisplayElementWithRequiredConfig<{
602
602
  /** If true, the flow will continue after the jobs are complete. */
603
603
  autoContinue?: boolean;
604
604
  }>;
605
- type PrintData = {
605
+ type PrintData<H extends NullableHardware> = {
606
606
  type: "zpl";
607
+ printer?: H extends Hardware ? H["printers"][number]["name"] : never;
607
608
  name?: string;
608
609
  data: string | string[];
609
610
  };
@@ -614,6 +615,7 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
614
615
  type: "url" | "text" | "html" | "zpl";
615
616
  data?: string[];
616
617
  url?: string;
618
+ printer?: string;
617
619
  }[];
618
620
  autoPrint: boolean;
619
621
  }
@@ -638,7 +640,7 @@ type PickListItem = {
638
640
  type ListOptions<T> = {
639
641
  data: T[];
640
642
  render: (data: T) => PickListItem;
641
- validate?: ValidateFn<PickListResponseItem>;
643
+ validate?: ValidateFn<PickListResponseItem[]>;
642
644
  };
643
645
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
644
646
  data: PickListItem[];
@@ -705,13 +707,13 @@ interface UiElementFileApiResponse extends BaseUiDisplayResponse<"ui.display.fil
705
707
  };
706
708
  }
707
709
 
708
- interface UI<C extends FlowConfig> {
710
+ interface UI<C extends FlowConfig, H extends NullableHardware> {
709
711
  page: UiPage<C>;
710
712
  display: UiDisplayElements;
711
713
  inputs: UiInputsElements;
712
714
  select: UiSelectElements;
713
715
  iterator: UiElementIterator;
714
- interactive: UiInteractiveElements;
716
+ interactive: UiInteractiveElements<H>;
715
717
  }
716
718
  type UiInputsElements = {
717
719
  text: UiElementInputText;
@@ -737,8 +739,8 @@ type UiDisplayElements = {
737
739
  keyValue: UiElementKeyValue;
738
740
  file: UiElementFile;
739
741
  };
740
- type UiInteractiveElements = {
741
- print: UiElementPrint;
742
+ type UiInteractiveElements<H extends NullableHardware> = {
743
+ print: UiElementPrint<H>;
742
744
  pickList: UiElementPickList;
743
745
  };
744
746
  type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
@@ -859,15 +861,22 @@ declare const RetryConstant: (intervalS: number) => RetryPolicyFn;
859
861
  * @param intervalS the base duration in seconds.
860
862
  */
861
863
  declare const RetryBackoffExponential: (intervalS: number) => RetryPolicyFn;
862
- interface FlowContext<C extends FlowConfig, E, S, Id, I> {
864
+ interface FlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware> {
863
865
  step: Step<C>;
864
- ui: UI<C>;
866
+ ui: UI<C, H>;
865
867
  complete: Complete<C, I>;
866
868
  env: E;
867
869
  now: Date;
868
870
  secrets: S;
869
871
  identity: Id;
870
872
  }
873
+ type NullableHardware = Hardware | undefined;
874
+ type Hardware = {
875
+ printers: Printer[];
876
+ };
877
+ interface Printer {
878
+ name: string;
879
+ }
871
880
  type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
872
881
  [key: string]: JsonSerializable;
873
882
  };
@@ -914,7 +923,7 @@ interface FlowConfigAPI {
914
923
  title: string;
915
924
  description?: string;
916
925
  }
917
- type FlowFunction<C extends FlowConfig, E, S, Id, I = undefined> = (ctx: FlowContext<C, E, S, Id, I>, inputs: I) => Promise<CompleteOptions<C, I> | any | void>;
926
+ type FlowFunction<C extends FlowConfig, E, S, Id, I = undefined, H extends NullableHardware = undefined> = (ctx: FlowContext<C, E, S, Id, I, H>, inputs: I) => Promise<CompleteOptions<C, I> | any | void>;
918
927
  type ExtractStageKeys<T extends FlowConfig> = T extends {
919
928
  stages: infer S;
920
929
  } ? S extends ReadonlyArray<infer U> ? U extends string ? U : U extends {
@@ -931,12 +940,12 @@ type StageConfigObject = {
931
940
  initiallyHidden?: boolean;
932
941
  };
933
942
  type StageConfig = string | StageConfigObject;
934
- declare function createFlowContext<C extends FlowConfig, E, S, Id, I>(runId: string, data: any, action: string | null, callback: string | null, element: string | null, spanId: string, ctx: {
943
+ declare function createFlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware>(runId: string, data: any, action: string | null, callback: string | null, element: string | null, spanId: string, ctx: {
935
944
  env: E;
936
945
  now: Date;
937
946
  secrets: S;
938
947
  identity: Id;
939
- }): FlowContext<C, E, S, Id, I>;
948
+ }): FlowContext<C, E, S, Id, I, H>;
940
949
 
941
950
  declare function ksuid(): string;
942
951
 
@@ -1106,4 +1115,4 @@ type dateDuration = `${number}Y${number}M${number}D` | `${number}Y${number}M` |
1106
1115
  type timeDuration = `${number}H${number}M${number}S` | `${number}H${number}M` | `${number}M${number}S` | `${number}H${number}S` | `${number}H` | `${number}M` | `${number}S`;
1107
1116
  type DurationString = `P${dateDuration}T${timeDuration}` | `P${dateDuration}` | `PT${timeDuration}`;
1108
1117
 
1109
- export { type BooleanArrayQueryWhereCondition, type BooleanArrayWhereCondition, type BooleanWhereCondition, type ContextAPI, type DateArrayQueryWhereCondition, type DateArrayWhereCondition, type DateQueryInput, type DateWhereCondition, Duration, type DurationString, type DurationWhereCondition, ErrorPresets, type Errors, type ExtractStageKeys, File, type FlowConfig, type FlowConfigAPI, type FlowContext, type FlowFunction, type FuncWithConfig, type FunctionConfig, type IDWhereCondition, InlineFile, ModelAPI, NonRetriableError, type NumberArrayQueryWhereCondition, type NumberArrayWhereCondition, type NumberWhereCondition, PERMISSION_STATE, type PageInfo, Permissions, type RelativeDateString, RequestHeaders, type Response, RetryBackoffExponential, RetryBackoffLinear, RetryConstant, STEP_STATUS, STEP_TYPE, type SortDirection, type Step, type StringArrayQueryWhereCondition, type StringArrayWhereCondition, type StringWhereCondition, type TimestampQueryInput, type UI, type UIApiResponses, checkBuiltInPermissions, createFlowContext, handleFlow, handleJob, handleRequest, handleRoute, handleSubscriber, ksuid, tracing, useDatabase };
1118
+ export { type BooleanArrayQueryWhereCondition, type BooleanArrayWhereCondition, type BooleanWhereCondition, type ContextAPI, type DateArrayQueryWhereCondition, type DateArrayWhereCondition, type DateQueryInput, type DateWhereCondition, Duration, type DurationString, type DurationWhereCondition, ErrorPresets, type Errors, type ExtractStageKeys, File, type FlowConfig, type FlowConfigAPI, type FlowContext, type FlowFunction, type FuncWithConfig, type FunctionConfig, type Hardware, type IDWhereCondition, InlineFile, ModelAPI, NonRetriableError, type NullableHardware, type NumberArrayQueryWhereCondition, type NumberArrayWhereCondition, type NumberWhereCondition, PERMISSION_STATE, type PageInfo, Permissions, type Printer, type RelativeDateString, RequestHeaders, type Response, RetryBackoffExponential, RetryBackoffLinear, RetryConstant, STEP_STATUS, STEP_TYPE, type SortDirection, type Step, type StringArrayQueryWhereCondition, type StringArrayWhereCondition, type StringWhereCondition, type TimestampQueryInput, type UI, type UIApiResponses, checkBuiltInPermissions, createFlowContext, handleFlow, handleJob, handleRequest, handleRoute, handleSubscriber, ksuid, tracing, useDatabase };
package/dist/index.js CHANGED
@@ -2850,7 +2850,8 @@ var print = /* @__PURE__ */ __name(async (options) => {
2850
2850
  return {
2851
2851
  type: d.type,
2852
2852
  name: d.name,
2853
- data: Array.isArray(d.data) ? d.data : [d.data]
2853
+ data: Array.isArray(d.data) ? d.data : [d.data],
2854
+ printer: d.printer
2854
2855
  };
2855
2856
  }
2856
2857
  return null;