windmill-client 1.441.2 → 1.443.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/client.d.ts CHANGED
@@ -178,5 +178,40 @@ interface SlackApprovalOptions {
178
178
  channelId: string;
179
179
  message?: string;
180
180
  approver?: string;
181
+ defaultArgsJson?: Record<string, any>;
182
+ dynamicEnumsJson?: Record<string, any>;
181
183
  }
182
- export declare function requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, }: SlackApprovalOptions): Promise<void>;
184
+ /**
185
+ * Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
186
+ *
187
+ * **[Enterprise Edition Only]** To include form fields in the Slack approval request, go to **Advanced -> Suspend -> Form**
188
+ * and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
189
+ *
190
+ * @param {Object} options - The configuration options for the Slack approval request.
191
+ * @param {string} options.slackResourcePath - The path to the Slack resource in Windmill.
192
+ * @param {string} options.channelId - The Slack channel ID where the approval request will be sent.
193
+ * @param {string} [options.message] - Optional custom message to include in the Slack approval request.
194
+ * @param {string} [options.approver] - Optional user ID or name of the approver for the request.
195
+ * @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
196
+ * @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
197
+ *
198
+ * @returns {Promise<void>} Resolves when the Slack approval request is successfully sent.
199
+ *
200
+ * @throws {Error} If the function is not called within a flow or flow preview.
201
+ * @throws {Error} If the `JobService.getSlackApprovalPayload` call fails.
202
+ *
203
+ * **Usage Example:**
204
+ * ```typescript
205
+ * await requestInteractiveSlackApproval({
206
+ * slackResourcePath: "/u/alex/my_slack_resource",
207
+ * channelId: "admins-slack-channel",
208
+ * message: "Please approve this request",
209
+ * approver: "approver123",
210
+ * defaultArgsJson: { key1: "value1", key2: 42 },
211
+ * dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
212
+ * });
213
+ * ```
214
+ *
215
+ * **Note:** This function requires execution within a Windmill flow or flow preview.
216
+ */
217
+ export declare function requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumsJson, }: SlackApprovalOptions): Promise<void>;
package/dist/client.js CHANGED
@@ -795,8 +795,41 @@ function usernameToEmail(username) {
795
795
  return yield index_1.UserService.usernameToEmail({ username, workspace });
796
796
  });
797
797
  }
798
+ /**
799
+ * Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
800
+ *
801
+ * **[Enterprise Edition Only]** To include form fields in the Slack approval request, go to **Advanced -> Suspend -> Form**
802
+ * and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
803
+ *
804
+ * @param {Object} options - The configuration options for the Slack approval request.
805
+ * @param {string} options.slackResourcePath - The path to the Slack resource in Windmill.
806
+ * @param {string} options.channelId - The Slack channel ID where the approval request will be sent.
807
+ * @param {string} [options.message] - Optional custom message to include in the Slack approval request.
808
+ * @param {string} [options.approver] - Optional user ID or name of the approver for the request.
809
+ * @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
810
+ * @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
811
+ *
812
+ * @returns {Promise<void>} Resolves when the Slack approval request is successfully sent.
813
+ *
814
+ * @throws {Error} If the function is not called within a flow or flow preview.
815
+ * @throws {Error} If the `JobService.getSlackApprovalPayload` call fails.
816
+ *
817
+ * **Usage Example:**
818
+ * ```typescript
819
+ * await requestInteractiveSlackApproval({
820
+ * slackResourcePath: "/u/alex/my_slack_resource",
821
+ * channelId: "admins-slack-channel",
822
+ * message: "Please approve this request",
823
+ * approver: "approver123",
824
+ * defaultArgsJson: { key1: "value1", key2: 42 },
825
+ * dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
826
+ * });
827
+ * ```
828
+ *
829
+ * **Note:** This function requires execution within a Windmill flow or flow preview.
830
+ */
798
831
  function requestInteractiveSlackApproval(_a) {
799
- return __awaiter(this, arguments, void 0, function* ({ slackResourcePath, channelId, message, approver, }) {
832
+ return __awaiter(this, arguments, void 0, function* ({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumsJson, }) {
800
833
  var _b;
801
834
  const workspace = getWorkspace();
802
835
  const flowJobId = getEnv("WM_FLOW_JOB_ID");
@@ -819,6 +852,12 @@ function requestInteractiveSlackApproval(_a) {
819
852
  if (approver) {
820
853
  params.approver = approver;
821
854
  }
855
+ if (defaultArgsJson) {
856
+ params.defaultArgsJson = JSON.stringify(defaultArgsJson);
857
+ }
858
+ if (dynamicEnumsJson) {
859
+ params.dynamicEnumsJson = JSON.stringify(dynamicEnumsJson);
860
+ }
822
861
  yield index_1.JobService.getSlackApprovalPayload(Object.assign(Object.assign({ workspace }, params), { id: (_b = getEnv("WM_JOB_ID")) !== null && _b !== void 0 ? _b : "NO_JOB_ID" }));
823
862
  });
824
863
  }
@@ -39,7 +39,7 @@ exports.OpenAPI = {
39
39
  PASSWORD: undefined,
40
40
  TOKEN: getEnv("WM_TOKEN"),
41
41
  USERNAME: undefined,
42
- VERSION: '1.441.2',
42
+ VERSION: '1.443.0',
43
43
  WITH_CREDENTIALS: true,
44
44
  interceptors: {
45
45
  request: new Interceptors(),
@@ -2648,6 +2648,8 @@ export declare class JobService {
2648
2648
  * @param data.flowStepId
2649
2649
  * @param data.approver
2650
2650
  * @param data.message
2651
+ * @param data.defaultArgsJson
2652
+ * @param data.dynamicEnumsJson
2651
2653
  * @returns unknown Interactive slack approval message sent successfully
2652
2654
  * @throws ApiError
2653
2655
  */
@@ -5299,6 +5299,8 @@ class JobService {
5299
5299
  * @param data.flowStepId
5300
5300
  * @param data.approver
5301
5301
  * @param data.message
5302
+ * @param data.defaultArgsJson
5303
+ * @param data.dynamicEnumsJson
5302
5304
  * @returns unknown Interactive slack approval message sent successfully
5303
5305
  * @throws ApiError
5304
5306
  */
@@ -5315,7 +5317,9 @@ class JobService {
5315
5317
  message: data.message,
5316
5318
  slack_resource_path: data.slackResourcePath,
5317
5319
  channel_id: data.channelId,
5318
- flow_step_id: data.flowStepId
5320
+ flow_step_id: data.flowStepId,
5321
+ default_args_json: data.defaultArgsJson,
5322
+ dynamic_enums_json: data.dynamicEnumsJson
5319
5323
  }
5320
5324
  });
5321
5325
  }
@@ -4229,6 +4229,8 @@ export type GetResumeUrlsResponse = {
4229
4229
  export type GetSlackApprovalPayloadData = {
4230
4230
  approver?: string;
4231
4231
  channelId: string;
4232
+ defaultArgsJson?: string;
4233
+ dynamicEnumsJson?: string;
4232
4234
  flowStepId: string;
4233
4235
  id: string;
4234
4236
  message?: string;
@@ -10708,6 +10710,8 @@ export type $OpenApiTs = {
10708
10710
  req: {
10709
10711
  approver?: string;
10710
10712
  channelId: string;
10713
+ defaultArgsJson?: string;
10714
+ dynamicEnumsJson?: string;
10711
10715
  flowStepId: string;
10712
10716
  id: string;
10713
10717
  message?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "windmill-client",
3
3
  "description": "Windmill SDK client for browsers and Node.js",
4
- "version": "1.441.2",
4
+ "version": "1.443.0",
5
5
  "author": "Ruben Fiszel",
6
6
  "license": "Apache 2.0",
7
7
  "devDependencies": {