@slflows/sdk 0.6.2 → 0.8.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 +84 -4
  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,59 @@ 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
+ /**
951
+ * Output from the suggestValues function.
952
+ */
953
+ interface SuggestValuesOutput {
954
+ /** Array of suggested values to present to the user */
955
+ suggestedValues: SuggestedValue[];
956
+ }
957
+ /**
958
+ * A single suggested value with a display label and actual value.
959
+ */
960
+ interface SuggestedValue {
961
+ /** Display label shown to the user */
962
+ label: string;
963
+ /** The actual value to use when selected */
964
+ value: unknown;
915
965
  }
916
966
  interface AppBlockComponentInput {
917
967
  name?: string;
918
968
  description?: string;
919
- config?: Record<string, AppBlockConfigField>;
969
+ config?: Record<string, AppBlockInputConfigField>;
920
970
  onEvent: (input: EventInput) => Promise<void>;
921
971
  }
922
972
  interface AppBlockComponentOutput {
@@ -1070,7 +1120,12 @@ interface EntityNonSchedulableLifecycleCallbackOutput extends BaseLifecycleCallb
1070
1120
  }
1071
1121
  interface EntitySchedulableLifecycleCallbackOutput extends BaseLifecycleCallbackOutput {
1072
1122
  newStatus: "in_progress" | "draining";
1073
- nextScheduleDelay?: number;
1123
+ /** Specifies the time in seconds after which the callback will
1124
+ * be called again in case the entity is not in a complete state.
1125
+ * If set to null, the callback won't be called again. It can be
1126
+ * invoked using lifecycle.sync() from e.g. an http request handler.
1127
+ */
1128
+ nextScheduleDelay?: number | null;
1074
1129
  }
1075
1130
  type EntityLifecycleCallbackOutput = EntityNonSchedulableLifecycleCallbackOutput | EntitySchedulableLifecycleCallbackOutput;
1076
1131
  interface AppNonSchedulableLifecycleCallbackOutput extends BaseLifecycleCallbackOutput {
@@ -1078,7 +1133,12 @@ interface AppNonSchedulableLifecycleCallbackOutput extends BaseLifecycleCallback
1078
1133
  }
1079
1134
  interface AppSchedulableLifecycleCallbackOutput extends BaseLifecycleCallbackOutput {
1080
1135
  newStatus: "in_progress" | "draining";
1081
- nextScheduleDelay?: number;
1136
+ /** Specifies the time in seconds after which the callback will
1137
+ * be called again in case the app is not in a complete state. If
1138
+ * set to null, the callback won't be called again. It can be
1139
+ * invoked using lifecycle.sync() from e.g. an http request handler.
1140
+ */
1141
+ nextScheduleDelay?: number | null;
1082
1142
  }
1083
1143
  type AppLifecycleCallbackOutput = AppNonSchedulableLifecycleCallbackOutput | AppSchedulableLifecycleCallbackOutput;
1084
1144
  type AppLifecycleStatus = "draft" | "in_progress" | "ready" | "failed" | "draining" | "draining_failed" | "drained";
@@ -1156,6 +1216,26 @@ interface UIRequest {
1156
1216
  type: string;
1157
1217
  payload?: any;
1158
1218
  }
1219
+ /**
1220
+ * Auto-populates a config field from an upstream block's output when connected.
1221
+ *
1222
+ * @example
1223
+ * ```typescript
1224
+ * // Simple property
1225
+ * populateFrom: { blockKey: "pull_request", outputProperty: "url" }
1226
+ * // → outputs.<block>.url
1227
+ *
1228
+ * // Nested property (dot notation)
1229
+ * populateFrom: { blockKey: "pull_request", outputProperty: "data.repository.url" }
1230
+ * // → outputs.<block>.data.repository.url
1231
+ * ```
1232
+ */
1233
+ interface PopulateFrom {
1234
+ /** Block key to find upstream. Must be from the same app installation. */
1235
+ blockKey: string;
1236
+ /** Property path in the upstream block's output. Use dot notation for nested access. */
1237
+ outputProperty: string;
1238
+ }
1159
1239
 
1160
1240
  export { blocks, defineApp, events, getInvocationMetadata, http, kv, lifecycle, messaging, timers, ui };
1161
- 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 };
1241
+ 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.6.2",
3
+ "version": "0.8.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],