windmill-client 1.442.0 → 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
@@ -179,6 +179,39 @@ interface SlackApprovalOptions {
179
179
  message?: string;
180
180
  approver?: string;
181
181
  defaultArgsJson?: Record<string, any>;
182
- dynamicEnumJson?: Record<string, any>;
182
+ dynamicEnumsJson?: Record<string, any>;
183
183
  }
184
- export declare function requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumJson, }: 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, defaultArgsJson, dynamicEnumJson, }) {
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");
@@ -822,8 +855,8 @@ function requestInteractiveSlackApproval(_a) {
822
855
  if (defaultArgsJson) {
823
856
  params.defaultArgsJson = JSON.stringify(defaultArgsJson);
824
857
  }
825
- if (dynamicEnumJson) {
826
- params.dynamicEnumJson = JSON.stringify(dynamicEnumJson);
858
+ if (dynamicEnumsJson) {
859
+ params.dynamicEnumsJson = JSON.stringify(dynamicEnumsJson);
827
860
  }
828
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" }));
829
862
  });
@@ -39,7 +39,7 @@ exports.OpenAPI = {
39
39
  PASSWORD: undefined,
40
40
  TOKEN: getEnv("WM_TOKEN"),
41
41
  USERNAME: undefined,
42
- VERSION: '1.442.0',
42
+ VERSION: '1.443.0',
43
43
  WITH_CREDENTIALS: true,
44
44
  interceptors: {
45
45
  request: new Interceptors(),
@@ -2649,7 +2649,7 @@ export declare class JobService {
2649
2649
  * @param data.approver
2650
2650
  * @param data.message
2651
2651
  * @param data.defaultArgsJson
2652
- * @param data.dynamicEnumJson
2652
+ * @param data.dynamicEnumsJson
2653
2653
  * @returns unknown Interactive slack approval message sent successfully
2654
2654
  * @throws ApiError
2655
2655
  */
@@ -5300,7 +5300,7 @@ class JobService {
5300
5300
  * @param data.approver
5301
5301
  * @param data.message
5302
5302
  * @param data.defaultArgsJson
5303
- * @param data.dynamicEnumJson
5303
+ * @param data.dynamicEnumsJson
5304
5304
  * @returns unknown Interactive slack approval message sent successfully
5305
5305
  * @throws ApiError
5306
5306
  */
@@ -5319,7 +5319,7 @@ class JobService {
5319
5319
  channel_id: data.channelId,
5320
5320
  flow_step_id: data.flowStepId,
5321
5321
  default_args_json: data.defaultArgsJson,
5322
- dynamic_enum_json: data.dynamicEnumJson
5322
+ dynamic_enums_json: data.dynamicEnumsJson
5323
5323
  }
5324
5324
  });
5325
5325
  }
@@ -4230,7 +4230,7 @@ export type GetSlackApprovalPayloadData = {
4230
4230
  approver?: string;
4231
4231
  channelId: string;
4232
4232
  defaultArgsJson?: string;
4233
- dynamicEnumJson?: string;
4233
+ dynamicEnumsJson?: string;
4234
4234
  flowStepId: string;
4235
4235
  id: string;
4236
4236
  message?: string;
@@ -10711,7 +10711,7 @@ export type $OpenApiTs = {
10711
10711
  approver?: string;
10712
10712
  channelId: string;
10713
10713
  defaultArgsJson?: string;
10714
- dynamicEnumJson?: string;
10714
+ dynamicEnumsJson?: string;
10715
10715
  flowStepId: string;
10716
10716
  id: string;
10717
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.442.0",
4
+ "version": "1.443.0",
5
5
  "author": "Ruben Fiszel",
6
6
  "license": "Apache 2.0",
7
7
  "devDependencies": {