@teamkeel/functions-runtime 0.421.1 → 0.421.3

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
@@ -216,14 +216,18 @@ declare function withSpan(name: any, fn: any): Promise<any>;
216
216
  declare function init(): void;
217
217
  declare function forceFlush(): Promise<void>;
218
218
  declare function spanNameForModelAPI(modelName: any, action: any): string;
219
+ declare const KEEL_INTERNAL_ATTR: "keel_internal";
220
+ declare const KEEL_INTERNAL_CHILDREN: "includeChildrenSpans";
219
221
 
222
+ declare const tracing_KEEL_INTERNAL_ATTR: typeof KEEL_INTERNAL_ATTR;
223
+ declare const tracing_KEEL_INTERNAL_CHILDREN: typeof KEEL_INTERNAL_CHILDREN;
220
224
  declare const tracing_forceFlush: typeof forceFlush;
221
225
  declare const tracing_getTracer: typeof getTracer;
222
226
  declare const tracing_init: typeof init;
223
227
  declare const tracing_spanNameForModelAPI: typeof spanNameForModelAPI;
224
228
  declare const tracing_withSpan: typeof withSpan;
225
229
  declare namespace tracing {
226
- export { tracing_forceFlush as forceFlush, tracing_getTracer as getTracer, tracing_init as init, tracing_spanNameForModelAPI as spanNameForModelAPI, tracing_withSpan as withSpan };
230
+ export { tracing_KEEL_INTERNAL_ATTR as KEEL_INTERNAL_ATTR, tracing_KEEL_INTERNAL_CHILDREN as KEEL_INTERNAL_CHILDREN, tracing_forceFlush as forceFlush, tracing_getTracer as getTracer, tracing_init as init, tracing_spanNameForModelAPI as spanNameForModelAPI, tracing_withSpan as withSpan };
227
231
  }
228
232
 
229
233
  type MimeType = "application/json" | "application/gzip" | "application/pdf" | "application/rtf" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-excel" | "application/vnd.ms-powerpoint" | "application/msword" | "application/zip" | "application/xml" | "application/x-7z-compressed" | "application/x-tar" | "image/gif" | "image/jpeg" | "image/svg+xml" | "image/png" | "text/html" | "text/csv" | "text/javascript" | "text/plain" | "text/calendar" | (string & {});
@@ -593,8 +597,8 @@ interface UiElementIteratorApiResponse extends BaseUiDisplayResponse<"ui.iterato
593
597
  }>;
594
598
  }
595
599
 
596
- type UiElementPrint = DisplayElementWithRequiredConfig<{
597
- jobs: PrintData[] | PrintData;
600
+ type UiElementPrint<H extends NullableHardware> = DisplayElementWithRequiredConfig<{
601
+ jobs: PrintData<H>[] | PrintData<H>;
598
602
  title?: string;
599
603
  description?: string;
600
604
  /** If true, the jobs will be automatically printed. */
@@ -602,8 +606,9 @@ type UiElementPrint = DisplayElementWithRequiredConfig<{
602
606
  /** If true, the flow will continue after the jobs are complete. */
603
607
  autoContinue?: boolean;
604
608
  }>;
605
- type PrintData = {
609
+ type PrintData<H extends NullableHardware> = {
606
610
  type: "zpl";
611
+ printer?: H extends Hardware ? H["printers"][number]["name"] : never;
607
612
  name?: string;
608
613
  data: string | string[];
609
614
  };
@@ -614,6 +619,7 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
614
619
  type: "url" | "text" | "html" | "zpl";
615
620
  data?: string[];
616
621
  url?: string;
622
+ printer?: string;
617
623
  }[];
618
624
  autoPrint: boolean;
619
625
  }
@@ -638,7 +644,7 @@ type PickListItem = {
638
644
  type ListOptions<T> = {
639
645
  data: T[];
640
646
  render: (data: T) => PickListItem;
641
- validate?: ValidateFn<PickListResponseItem>;
647
+ validate?: ValidateFn<PickListResponseItem[]>;
642
648
  };
643
649
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
644
650
  data: PickListItem[];
@@ -705,13 +711,13 @@ interface UiElementFileApiResponse extends BaseUiDisplayResponse<"ui.display.fil
705
711
  };
706
712
  }
707
713
 
708
- interface UI<C extends FlowConfig> {
714
+ interface UI<C extends FlowConfig, H extends NullableHardware> {
709
715
  page: UiPage<C>;
710
716
  display: UiDisplayElements;
711
717
  inputs: UiInputsElements;
712
718
  select: UiSelectElements;
713
719
  iterator: UiElementIterator;
714
- interactive: UiInteractiveElements;
720
+ interactive: UiInteractiveElements<H>;
715
721
  }
716
722
  type UiInputsElements = {
717
723
  text: UiElementInputText;
@@ -737,8 +743,8 @@ type UiDisplayElements = {
737
743
  keyValue: UiElementKeyValue;
738
744
  file: UiElementFile;
739
745
  };
740
- type UiInteractiveElements = {
741
- print: UiElementPrint;
746
+ type UiInteractiveElements<H extends NullableHardware> = {
747
+ print: UiElementPrint<H>;
742
748
  pickList: UiElementPickList;
743
749
  };
744
750
  type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
@@ -859,15 +865,22 @@ declare const RetryConstant: (intervalS: number) => RetryPolicyFn;
859
865
  * @param intervalS the base duration in seconds.
860
866
  */
861
867
  declare const RetryBackoffExponential: (intervalS: number) => RetryPolicyFn;
862
- interface FlowContext<C extends FlowConfig, E, S, Id, I> {
868
+ interface FlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware> {
863
869
  step: Step<C>;
864
- ui: UI<C>;
870
+ ui: UI<C, H>;
865
871
  complete: Complete<C, I>;
866
872
  env: E;
867
873
  now: Date;
868
874
  secrets: S;
869
875
  identity: Id;
870
876
  }
877
+ type NullableHardware = Hardware | undefined;
878
+ type Hardware = {
879
+ printers: Printer[];
880
+ };
881
+ interface Printer {
882
+ name: string;
883
+ }
871
884
  type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
872
885
  [key: string]: JsonSerializable;
873
886
  };
@@ -914,7 +927,7 @@ interface FlowConfigAPI {
914
927
  title: string;
915
928
  description?: string;
916
929
  }
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>;
930
+ 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
931
  type ExtractStageKeys<T extends FlowConfig> = T extends {
919
932
  stages: infer S;
920
933
  } ? S extends ReadonlyArray<infer U> ? U extends string ? U : U extends {
@@ -931,12 +944,12 @@ type StageConfigObject = {
931
944
  initiallyHidden?: boolean;
932
945
  };
933
946
  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: {
947
+ 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
948
  env: E;
936
949
  now: Date;
937
950
  secrets: S;
938
951
  identity: Id;
939
- }): FlowContext<C, E, S, Id, I>;
952
+ }): FlowContext<C, E, S, Id, I, H>;
940
953
 
941
954
  declare function ksuid(): string;
942
955
 
@@ -1106,4 +1119,4 @@ type dateDuration = `${number}Y${number}M${number}D` | `${number}Y${number}M` |
1106
1119
  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
1120
  type DurationString = `P${dateDuration}T${timeDuration}` | `P${dateDuration}` | `PT${timeDuration}`;
1108
1121
 
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 };
1122
+ 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
@@ -216,14 +216,18 @@ declare function withSpan(name: any, fn: any): Promise<any>;
216
216
  declare function init(): void;
217
217
  declare function forceFlush(): Promise<void>;
218
218
  declare function spanNameForModelAPI(modelName: any, action: any): string;
219
+ declare const KEEL_INTERNAL_ATTR: "keel_internal";
220
+ declare const KEEL_INTERNAL_CHILDREN: "includeChildrenSpans";
219
221
 
222
+ declare const tracing_KEEL_INTERNAL_ATTR: typeof KEEL_INTERNAL_ATTR;
223
+ declare const tracing_KEEL_INTERNAL_CHILDREN: typeof KEEL_INTERNAL_CHILDREN;
220
224
  declare const tracing_forceFlush: typeof forceFlush;
221
225
  declare const tracing_getTracer: typeof getTracer;
222
226
  declare const tracing_init: typeof init;
223
227
  declare const tracing_spanNameForModelAPI: typeof spanNameForModelAPI;
224
228
  declare const tracing_withSpan: typeof withSpan;
225
229
  declare namespace tracing {
226
- export { tracing_forceFlush as forceFlush, tracing_getTracer as getTracer, tracing_init as init, tracing_spanNameForModelAPI as spanNameForModelAPI, tracing_withSpan as withSpan };
230
+ export { tracing_KEEL_INTERNAL_ATTR as KEEL_INTERNAL_ATTR, tracing_KEEL_INTERNAL_CHILDREN as KEEL_INTERNAL_CHILDREN, tracing_forceFlush as forceFlush, tracing_getTracer as getTracer, tracing_init as init, tracing_spanNameForModelAPI as spanNameForModelAPI, tracing_withSpan as withSpan };
227
231
  }
228
232
 
229
233
  type MimeType = "application/json" | "application/gzip" | "application/pdf" | "application/rtf" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-excel" | "application/vnd.ms-powerpoint" | "application/msword" | "application/zip" | "application/xml" | "application/x-7z-compressed" | "application/x-tar" | "image/gif" | "image/jpeg" | "image/svg+xml" | "image/png" | "text/html" | "text/csv" | "text/javascript" | "text/plain" | "text/calendar" | (string & {});
@@ -593,8 +597,8 @@ interface UiElementIteratorApiResponse extends BaseUiDisplayResponse<"ui.iterato
593
597
  }>;
594
598
  }
595
599
 
596
- type UiElementPrint = DisplayElementWithRequiredConfig<{
597
- jobs: PrintData[] | PrintData;
600
+ type UiElementPrint<H extends NullableHardware> = DisplayElementWithRequiredConfig<{
601
+ jobs: PrintData<H>[] | PrintData<H>;
598
602
  title?: string;
599
603
  description?: string;
600
604
  /** If true, the jobs will be automatically printed. */
@@ -602,8 +606,9 @@ type UiElementPrint = DisplayElementWithRequiredConfig<{
602
606
  /** If true, the flow will continue after the jobs are complete. */
603
607
  autoContinue?: boolean;
604
608
  }>;
605
- type PrintData = {
609
+ type PrintData<H extends NullableHardware> = {
606
610
  type: "zpl";
611
+ printer?: H extends Hardware ? H["printers"][number]["name"] : never;
607
612
  name?: string;
608
613
  data: string | string[];
609
614
  };
@@ -614,6 +619,7 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
614
619
  type: "url" | "text" | "html" | "zpl";
615
620
  data?: string[];
616
621
  url?: string;
622
+ printer?: string;
617
623
  }[];
618
624
  autoPrint: boolean;
619
625
  }
@@ -638,7 +644,7 @@ type PickListItem = {
638
644
  type ListOptions<T> = {
639
645
  data: T[];
640
646
  render: (data: T) => PickListItem;
641
- validate?: ValidateFn<PickListResponseItem>;
647
+ validate?: ValidateFn<PickListResponseItem[]>;
642
648
  };
643
649
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
644
650
  data: PickListItem[];
@@ -705,13 +711,13 @@ interface UiElementFileApiResponse extends BaseUiDisplayResponse<"ui.display.fil
705
711
  };
706
712
  }
707
713
 
708
- interface UI<C extends FlowConfig> {
714
+ interface UI<C extends FlowConfig, H extends NullableHardware> {
709
715
  page: UiPage<C>;
710
716
  display: UiDisplayElements;
711
717
  inputs: UiInputsElements;
712
718
  select: UiSelectElements;
713
719
  iterator: UiElementIterator;
714
- interactive: UiInteractiveElements;
720
+ interactive: UiInteractiveElements<H>;
715
721
  }
716
722
  type UiInputsElements = {
717
723
  text: UiElementInputText;
@@ -737,8 +743,8 @@ type UiDisplayElements = {
737
743
  keyValue: UiElementKeyValue;
738
744
  file: UiElementFile;
739
745
  };
740
- type UiInteractiveElements = {
741
- print: UiElementPrint;
746
+ type UiInteractiveElements<H extends NullableHardware> = {
747
+ print: UiElementPrint<H>;
742
748
  pickList: UiElementPickList;
743
749
  };
744
750
  type InputElement<TValueType, TConfig extends any = never> = <N extends string>(name: N, options?: BaseInputConfig<TValueType> & TConfig) => InputElementResponse<N, TValueType>;
@@ -859,15 +865,22 @@ declare const RetryConstant: (intervalS: number) => RetryPolicyFn;
859
865
  * @param intervalS the base duration in seconds.
860
866
  */
861
867
  declare const RetryBackoffExponential: (intervalS: number) => RetryPolicyFn;
862
- interface FlowContext<C extends FlowConfig, E, S, Id, I> {
868
+ interface FlowContext<C extends FlowConfig, E, S, Id, I, H extends NullableHardware> {
863
869
  step: Step<C>;
864
- ui: UI<C>;
870
+ ui: UI<C, H>;
865
871
  complete: Complete<C, I>;
866
872
  env: E;
867
873
  now: Date;
868
874
  secrets: S;
869
875
  identity: Id;
870
876
  }
877
+ type NullableHardware = Hardware | undefined;
878
+ type Hardware = {
879
+ printers: Printer[];
880
+ };
881
+ interface Printer {
882
+ name: string;
883
+ }
871
884
  type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
872
885
  [key: string]: JsonSerializable;
873
886
  };
@@ -914,7 +927,7 @@ interface FlowConfigAPI {
914
927
  title: string;
915
928
  description?: string;
916
929
  }
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>;
930
+ 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
931
  type ExtractStageKeys<T extends FlowConfig> = T extends {
919
932
  stages: infer S;
920
933
  } ? S extends ReadonlyArray<infer U> ? U extends string ? U : U extends {
@@ -931,12 +944,12 @@ type StageConfigObject = {
931
944
  initiallyHidden?: boolean;
932
945
  };
933
946
  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: {
947
+ 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
948
  env: E;
936
949
  now: Date;
937
950
  secrets: S;
938
951
  identity: Id;
939
- }): FlowContext<C, E, S, Id, I>;
952
+ }): FlowContext<C, E, S, Id, I, H>;
940
953
 
941
954
  declare function ksuid(): string;
942
955
 
@@ -1106,4 +1119,4 @@ type dateDuration = `${number}Y${number}M${number}D` | `${number}Y${number}M` |
1106
1119
  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
1120
  type DurationString = `P${dateDuration}T${timeDuration}` | `P${dateDuration}` | `PT${timeDuration}`;
1108
1121
 
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 };
1122
+ 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 };