@slflows/sdk 0.7.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/v1/index.d.ts +88 -10
  2. package/package.json +1 -1
@@ -852,6 +852,8 @@ interface AppConfigField {
852
852
  required: boolean;
853
853
  default?: unknown;
854
854
  sensitive?: boolean;
855
+ /** Auto-populate from an upstream block's output when connected. */
856
+ populateFrom?: PopulateFrom;
855
857
  }
856
858
  interface AppSignal {
857
859
  name: string;
@@ -912,11 +914,67 @@ interface AppBlockConfigField {
912
914
  default?: unknown;
913
915
  fieldKey?: string;
914
916
  sensitive?: boolean;
917
+ /**
918
+ * Function to provide suggested values for this config field.
919
+ * Called when the user is editing this field to provide autocomplete suggestions.
920
+ */
921
+ suggestValues?: (input: SuggestValuesInput) => SuggestValuesOutput | Promise<SuggestValuesOutput>;
922
+ }
923
+ interface AppBlockInputConfigField {
924
+ name: string;
925
+ description?: string;
926
+ type: Type;
927
+ required: boolean;
928
+ default?: unknown;
929
+ sensitive?: boolean;
930
+ /** Auto-populate from an upstream block's output when connected. */
931
+ populateFrom?: PopulateFrom;
932
+ /**
933
+ * Function to provide suggested values for this config field.
934
+ * Called when the user is editing this field to provide autocomplete suggestions.
935
+ */
936
+ suggestValues?: (input: SuggestValuesInput) => SuggestValuesOutput | Promise<SuggestValuesOutput>;
937
+ }
938
+ /**
939
+ * Input provided to the suggestValues function.
940
+ * Contains app and block context along with the user's search phrase.
941
+ */
942
+ interface SuggestValuesInput {
943
+ /** App installation context and configuration */
944
+ app: AppContext;
945
+ /** Block (entity) instance context and configuration */
946
+ block: EntityContext;
947
+ /** Optional search phrase entered by the user to filter suggestions */
948
+ searchPhrase?: string;
949
+ /**
950
+ * Static input config values from other fields on the same input.
951
+ * Only present for input-level config fields. Contains the parsed values
952
+ * of sibling config fields whose expressions are static JSON values.
953
+ */
954
+ staticInputConfig?: Record<string, unknown>;
955
+ }
956
+ /**
957
+ * Output from the suggestValues function.
958
+ */
959
+ interface SuggestValuesOutput {
960
+ /** Array of suggested values to present to the user */
961
+ suggestedValues: SuggestedValue[];
962
+ /** Optional message to display above the suggestions list */
963
+ message?: string;
964
+ }
965
+ /**
966
+ * A single suggested value with a display label and actual value.
967
+ */
968
+ interface SuggestedValue {
969
+ /** Display label shown to the user */
970
+ label: string;
971
+ /** The actual value to use when selected */
972
+ value: unknown;
915
973
  }
916
974
  interface AppBlockComponentInput {
917
975
  name?: string;
918
976
  description?: string;
919
- config?: Record<string, AppBlockConfigField>;
977
+ config?: Record<string, AppBlockInputConfigField>;
920
978
  onEvent: (input: EventInput) => Promise<void>;
921
979
  }
922
980
  interface AppBlockComponentOutput {
@@ -1071,10 +1129,10 @@ interface EntityNonSchedulableLifecycleCallbackOutput extends BaseLifecycleCallb
1071
1129
  interface EntitySchedulableLifecycleCallbackOutput extends BaseLifecycleCallbackOutput {
1072
1130
  newStatus: "in_progress" | "draining";
1073
1131
  /** Specifies the time in seconds after which the callback will
1074
- * be called again in case the entity is not in a complete state.
1075
- * If set to null, the callback won't be called again. It can be
1076
- * invoked using lifecycle.sync() from e.g. an http request handler.
1077
- */
1132
+ * be called again in case the entity is not in a complete state.
1133
+ * If set to null, the callback won't be called again. It can be
1134
+ * invoked using lifecycle.sync() from e.g. an http request handler.
1135
+ */
1078
1136
  nextScheduleDelay?: number | null;
1079
1137
  }
1080
1138
  type EntityLifecycleCallbackOutput = EntityNonSchedulableLifecycleCallbackOutput | EntitySchedulableLifecycleCallbackOutput;
@@ -1084,10 +1142,10 @@ interface AppNonSchedulableLifecycleCallbackOutput extends BaseLifecycleCallback
1084
1142
  interface AppSchedulableLifecycleCallbackOutput extends BaseLifecycleCallbackOutput {
1085
1143
  newStatus: "in_progress" | "draining";
1086
1144
  /** Specifies the time in seconds after which the callback will
1087
- * be called again in case the app is not in a complete state. If
1088
- * set to null, the callback won't be called again. It can be
1089
- * invoked using lifecycle.sync() from e.g. an http request handler.
1090
- */
1145
+ * be called again in case the app is not in a complete state. If
1146
+ * set to null, the callback won't be called again. It can be
1147
+ * invoked using lifecycle.sync() from e.g. an http request handler.
1148
+ */
1091
1149
  nextScheduleDelay?: number | null;
1092
1150
  }
1093
1151
  type AppLifecycleCallbackOutput = AppNonSchedulableLifecycleCallbackOutput | AppSchedulableLifecycleCallbackOutput;
@@ -1166,6 +1224,26 @@ interface UIRequest {
1166
1224
  type: string;
1167
1225
  payload?: any;
1168
1226
  }
1227
+ /**
1228
+ * Auto-populates a config field from an upstream block's output when connected.
1229
+ *
1230
+ * @example
1231
+ * ```typescript
1232
+ * // Simple property
1233
+ * populateFrom: { blockKey: "pull_request", outputProperty: "url" }
1234
+ * // → outputs.<block>.url
1235
+ *
1236
+ * // Nested property (dot notation)
1237
+ * populateFrom: { blockKey: "pull_request", outputProperty: "data.repository.url" }
1238
+ * // → outputs.<block>.data.repository.url
1239
+ * ```
1240
+ */
1241
+ interface PopulateFrom {
1242
+ /** Block key to find upstream. Must be from the same app installation. */
1243
+ blockKey: string;
1244
+ /** Property path in the upstream block's output. Use dot notation for nested access. */
1245
+ outputProperty: string;
1246
+ }
1169
1247
 
1170
1248
  export { blocks, defineApp, events, getInvocationMetadata, http, kv, lifecycle, messaging, timers, ui };
1171
- export type { AppBlock, AppBlockComponentInput, AppBlockComponentOutput, AppBlockConfigField, AppBlockHTTPComponent, AppBlockSchedule, AppBlockSignal, AppBlockUIComponent, AppConfigField, AppContext, AppHTTPComponent, AppHTTPEndpoint, AppInput, AppLifecycleCallbackOutput, AppLifecycleStatus, AppOnCreateOutput, AppOnHTTPRequestInput, AppOnInternalMessageInput, AppOnTimerInput, AppOnTriggerInput, AppOnUIRequestInput, AppSchedule, AppSchema, AppSignal, AppUIComponent, EntityContext, EntityHTTPEndpoint, EntityInput, EntityLifecycleCallbackOutput, EntityLifecycleComponent, EntityLifecycleStatus, EntityOnHTTPRequestInput, EntityOnInternalMessageInput, EntityOnTimerInput, EntityOnTriggerInput, EntityOnUIRequestInput, EntityOutput, EntityView, EntityViewType, EventContext, EventInput, HTTPRequest, JsonSchema, ScheduleDefinition, Type, UIRequest };
1249
+ export type { AppBlock, AppBlockComponentInput, AppBlockComponentOutput, AppBlockConfigField, AppBlockHTTPComponent, AppBlockInputConfigField, AppBlockSchedule, AppBlockSignal, AppBlockUIComponent, AppConfigField, AppContext, AppHTTPComponent, AppHTTPEndpoint, AppInput, AppLifecycleCallbackOutput, AppLifecycleStatus, AppOnCreateOutput, AppOnHTTPRequestInput, AppOnInternalMessageInput, AppOnTimerInput, AppOnTriggerInput, AppOnUIRequestInput, AppSchedule, AppSchema, AppSignal, AppUIComponent, EntityContext, EntityHTTPEndpoint, EntityInput, EntityLifecycleCallbackOutput, EntityLifecycleComponent, EntityLifecycleStatus, EntityOnHTTPRequestInput, EntityOnInternalMessageInput, EntityOnTimerInput, EntityOnTriggerInput, EntityOnUIRequestInput, EntityOutput, EntityView, EntityViewType, EventContext, EventInput, HTTPRequest, JsonSchema, PopulateFrom, ScheduleDefinition, SuggestValuesInput, SuggestValuesOutput, SuggestedValue, Type, UIRequest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slflows/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],