windmill-client 1.618.2 → 1.618.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/client.d.ts +414 -0
- package/dist/core/ApiError.d.ts +10 -0
- package/dist/core/ApiRequestOptions.d.ts +13 -0
- package/dist/core/ApiResult.d.ts +7 -0
- package/dist/core/CancelablePromise.d.ts +26 -0
- package/dist/core/OpenAPI.d.ts +27 -0
- package/dist/core/request.d.ts +29 -0
- package/dist/index.d.ts +9 -29831
- package/dist/index.mjs +9 -1
- package/dist/s3Types.d.ts +38 -0
- package/dist/services.gen.d.ts +6310 -0
- package/dist/sqlUtils.d.ts +75 -0
- package/dist/types.gen.d.ts +22881 -0
- package/package.json +4 -11
- package/dist/chunk-B9dir_RE.mjs +0 -11
- package/dist/index.d.mts +0 -29830
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { DenoS3LightClientSettings, S3ObjectRecord, type S3Object } from "./s3Types";
|
|
2
|
+
export { type S3Object, type S3ObjectRecord, type S3ObjectURI, } from "./s3Types";
|
|
3
|
+
export { datatable, ducklake, type SqlTemplateFunction, type DatatableSqlTemplateFunction, } from "./sqlUtils";
|
|
4
|
+
export { AdminService, AuditService, FlowService, GranularAclService, GroupService, JobService, ResourceService, VariableService, ScriptService, ScheduleService, SettingsService, UserService, WorkspaceService, TeamsService, } from "./index";
|
|
5
|
+
export type Sql = string;
|
|
6
|
+
export type Email = string;
|
|
7
|
+
export type Base64 = string;
|
|
8
|
+
export type Resource<S extends string> = any;
|
|
9
|
+
export declare const SHARED_FOLDER = "/shared";
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the Windmill client with authentication token and base URL
|
|
12
|
+
* @param token - Authentication token (defaults to WM_TOKEN env variable)
|
|
13
|
+
* @param baseUrl - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable)
|
|
14
|
+
*/
|
|
15
|
+
export declare function setClient(token?: string, baseUrl?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Create a client configuration from env variables
|
|
18
|
+
* @returns client configuration
|
|
19
|
+
*/
|
|
20
|
+
export declare function getWorkspace(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get a resource value by path
|
|
23
|
+
* @param path path of the resource, default to internal state path
|
|
24
|
+
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
25
|
+
* @returns resource value
|
|
26
|
+
*/
|
|
27
|
+
export declare function getResource(path?: string, undefinedIfEmpty?: boolean): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Get the true root job id
|
|
30
|
+
* @param jobId job id to get the root job id from (default to current job)
|
|
31
|
+
* @returns root job id
|
|
32
|
+
*/
|
|
33
|
+
export declare function getRootJobId(jobId?: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use runScriptByPath or runScriptByHash instead
|
|
36
|
+
*/
|
|
37
|
+
export declare function runScript(path?: string | null, hash_?: string | null, args?: Record<string, any> | null, verbose?: boolean): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Run a script synchronously by its path and wait for the result
|
|
40
|
+
* @param path - Script path in Windmill
|
|
41
|
+
* @param args - Arguments to pass to the script
|
|
42
|
+
* @param verbose - Enable verbose logging
|
|
43
|
+
* @returns Script execution result
|
|
44
|
+
*/
|
|
45
|
+
export declare function runScriptByPath(path: string, args?: Record<string, any> | null, verbose?: boolean): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* Run a script synchronously by its hash and wait for the result
|
|
48
|
+
* @param hash_ - Script hash in Windmill
|
|
49
|
+
* @param args - Arguments to pass to the script
|
|
50
|
+
* @param verbose - Enable verbose logging
|
|
51
|
+
* @returns Script execution result
|
|
52
|
+
*/
|
|
53
|
+
export declare function runScriptByHash(hash_: string, args?: Record<string, any> | null, verbose?: boolean): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Append a text to the result stream
|
|
56
|
+
* @param text text to append to the result stream
|
|
57
|
+
*/
|
|
58
|
+
export declare function appendToResultStream(text: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Stream to the result stream
|
|
61
|
+
* @param stream stream to stream to the result stream
|
|
62
|
+
*/
|
|
63
|
+
export declare function streamResult(stream: AsyncIterable<string>): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Run a flow synchronously by its path and wait for the result
|
|
66
|
+
* @param path - Flow path in Windmill
|
|
67
|
+
* @param args - Arguments to pass to the flow
|
|
68
|
+
* @param verbose - Enable verbose logging
|
|
69
|
+
* @returns Flow execution result
|
|
70
|
+
*/
|
|
71
|
+
export declare function runFlow(path?: string | null, args?: Record<string, any> | null, verbose?: boolean): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Wait for a job to complete and return its result
|
|
74
|
+
* @param jobId - ID of the job to wait for
|
|
75
|
+
* @param verbose - Enable verbose logging
|
|
76
|
+
* @returns Job result when completed
|
|
77
|
+
*/
|
|
78
|
+
export declare function waitJob(jobId: string, verbose?: boolean): Promise<any>;
|
|
79
|
+
/**
|
|
80
|
+
* Get the result of a completed job
|
|
81
|
+
* @param jobId - ID of the completed job
|
|
82
|
+
* @returns Job result
|
|
83
|
+
*/
|
|
84
|
+
export declare function getResult(jobId: string): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* Get the result of a job if completed, or its current status
|
|
87
|
+
* @param jobId - ID of the job
|
|
88
|
+
* @returns Object with started, completed, success, and result properties
|
|
89
|
+
*/
|
|
90
|
+
export declare function getResultMaybe(jobId: string): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* Wrap a function to execute as a Windmill task within a flow context
|
|
93
|
+
* @param f - Function to wrap as a task
|
|
94
|
+
* @returns Async wrapper function that executes as a Windmill job
|
|
95
|
+
*/
|
|
96
|
+
export declare function task<P, T>(f: (_: P) => T): (_: P) => Promise<T>;
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
|
99
|
+
*/
|
|
100
|
+
export declare function runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds?: number | null): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Run a script asynchronously by its path
|
|
103
|
+
* @param path - Script path in Windmill
|
|
104
|
+
* @param args - Arguments to pass to the script
|
|
105
|
+
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
106
|
+
* @returns Job ID of the created job
|
|
107
|
+
*/
|
|
108
|
+
export declare function runScriptByPathAsync(path: string, args?: Record<string, any> | null, scheduledInSeconds?: number | null): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Run a script asynchronously by its hash
|
|
111
|
+
* @param hash_ - Script hash in Windmill
|
|
112
|
+
* @param args - Arguments to pass to the script
|
|
113
|
+
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
114
|
+
* @returns Job ID of the created job
|
|
115
|
+
*/
|
|
116
|
+
export declare function runScriptByHashAsync(hash_: string, args?: Record<string, any> | null, scheduledInSeconds?: number | null): Promise<string>;
|
|
117
|
+
/**
|
|
118
|
+
* Run a flow asynchronously by its path
|
|
119
|
+
* @param path - Flow path in Windmill
|
|
120
|
+
* @param args - Arguments to pass to the flow
|
|
121
|
+
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
122
|
+
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
|
123
|
+
* @returns Job ID of the created job
|
|
124
|
+
*/
|
|
125
|
+
export declare function runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds?: number | null, doNotTrackInParent?: boolean): Promise<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
128
|
+
* @param obj resource value or path of the resource under the format `$res:path`
|
|
129
|
+
* @returns resource value
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveDefaultResource(obj: any): Promise<any>;
|
|
132
|
+
/**
|
|
133
|
+
* Get the state file path from environment variables
|
|
134
|
+
* @returns State path string
|
|
135
|
+
*/
|
|
136
|
+
export declare function getStatePath(): string;
|
|
137
|
+
/**
|
|
138
|
+
* Set a resource value by path
|
|
139
|
+
* @param path path of the resource to set, default to state path
|
|
140
|
+
* @param value new value of the resource to set
|
|
141
|
+
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
|
|
142
|
+
*/
|
|
143
|
+
export declare function setResource(value: any, path?: string, initializeToTypeIfNotExist?: string): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Set the state
|
|
146
|
+
* @param state state to set
|
|
147
|
+
* @deprecated use setState instead
|
|
148
|
+
*/
|
|
149
|
+
export declare function setInternalState(state: any): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Set the state
|
|
152
|
+
* @param state state to set
|
|
153
|
+
* @param path Optional state resource path override. Defaults to `getStatePath()`.
|
|
154
|
+
*/
|
|
155
|
+
export declare function setState(state: any, path?: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Set the progress
|
|
158
|
+
* Progress cannot go back and limited to 0% to 99% range
|
|
159
|
+
* @param percent Progress to set in %
|
|
160
|
+
* @param jobId? Job to set progress for
|
|
161
|
+
*/
|
|
162
|
+
export declare function setProgress(percent: number, jobId?: any): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Get the progress
|
|
165
|
+
* @param jobId? Job to get progress from
|
|
166
|
+
* @returns Optional clamped between 0 and 100 progress value
|
|
167
|
+
*/
|
|
168
|
+
export declare function getProgress(jobId?: any): Promise<number | null>;
|
|
169
|
+
/**
|
|
170
|
+
* Set a flow user state
|
|
171
|
+
* @param key key of the state
|
|
172
|
+
* @param value value of the state
|
|
173
|
+
|
|
174
|
+
*/
|
|
175
|
+
export declare function setFlowUserState(key: string, value: any, errorIfNotPossible?: boolean): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Get a flow user state
|
|
178
|
+
* @param path path of the variable
|
|
179
|
+
|
|
180
|
+
*/
|
|
181
|
+
export declare function getFlowUserState(key: string, errorIfNotPossible?: boolean): Promise<any>;
|
|
182
|
+
/**
|
|
183
|
+
* Get the internal state
|
|
184
|
+
* @deprecated use getState instead
|
|
185
|
+
*/
|
|
186
|
+
export declare function getInternalState(): Promise<any>;
|
|
187
|
+
/**
|
|
188
|
+
* Get the state shared across executions
|
|
189
|
+
* @param path Optional state resource path override. Defaults to `getStatePath()`.
|
|
190
|
+
*/
|
|
191
|
+
export declare function getState(path?: string): Promise<any>;
|
|
192
|
+
/**
|
|
193
|
+
* Get a variable by path
|
|
194
|
+
* @param path path of the variable
|
|
195
|
+
* @returns variable value
|
|
196
|
+
*/
|
|
197
|
+
export declare function getVariable(path: string): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Set a variable by path, create if not exist
|
|
200
|
+
* @param path path of the variable
|
|
201
|
+
* @param value value of the variable
|
|
202
|
+
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
|
|
203
|
+
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
|
|
204
|
+
*/
|
|
205
|
+
export declare function setVariable(path: string, value: string, isSecretIfNotExist?: boolean, descriptionIfNotExist?: string): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Build a PostgreSQL connection URL from a database resource
|
|
208
|
+
* @param path - Path to the database resource
|
|
209
|
+
* @returns PostgreSQL connection URL string
|
|
210
|
+
*/
|
|
211
|
+
export declare function databaseUrlFromResource(path: string): Promise<string>;
|
|
212
|
+
/**
|
|
213
|
+
* Get S3 client settings from a resource or workspace default
|
|
214
|
+
* @param s3_resource_path - Path to S3 resource (uses workspace default if undefined)
|
|
215
|
+
* @returns S3 client configuration settings
|
|
216
|
+
*/
|
|
217
|
+
export declare function denoS3LightClientSettings(s3_resource_path: string | undefined): Promise<DenoS3LightClientSettings>;
|
|
218
|
+
/**
|
|
219
|
+
* Load the content of a file stored in S3. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
220
|
+
*
|
|
221
|
+
* ```typescript
|
|
222
|
+
* let fileContent = await wmill.loadS3FileContent(inputFile)
|
|
223
|
+
* // if the file is a raw text file, it can be decoded and printed directly:
|
|
224
|
+
* const text = new TextDecoder().decode(fileContentStream)
|
|
225
|
+
* console.log(text);
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export declare function loadS3File(s3object: S3Object, s3ResourcePath?: string | undefined): Promise<Uint8Array | undefined>;
|
|
229
|
+
/**
|
|
230
|
+
* Load the content of a file stored in S3 as a stream. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
231
|
+
*
|
|
232
|
+
* ```typescript
|
|
233
|
+
* let fileContentBlob = await wmill.loadS3FileStream(inputFile)
|
|
234
|
+
* // if the content is plain text, the blob can be read directly:
|
|
235
|
+
* console.log(await fileContentBlob.text());
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare function loadS3FileStream(s3object: S3Object, s3ResourcePath?: string | undefined): Promise<Blob | undefined>;
|
|
239
|
+
/**
|
|
240
|
+
* Persist a file to the S3 bucket. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
241
|
+
*
|
|
242
|
+
* ```typescript
|
|
243
|
+
* const s3object = await writeS3File(s3Object, "Hello Windmill!")
|
|
244
|
+
* const fileContentAsUtf8Str = (await s3object.toArray()).toString('utf-8')
|
|
245
|
+
* console.log(fileContentAsUtf8Str)
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export declare function writeS3File(s3object: S3Object | undefined, fileContent: string | Blob, s3ResourcePath?: string | undefined, contentType?: string | undefined, contentDisposition?: string | undefined): Promise<S3Object>;
|
|
249
|
+
/**
|
|
250
|
+
* Sign S3 objects to be used by anonymous users in public apps
|
|
251
|
+
* @param s3objects s3 objects to sign
|
|
252
|
+
* @returns signed s3 objects
|
|
253
|
+
*/
|
|
254
|
+
export declare function signS3Objects(s3objects: S3Object[]): Promise<S3Object[]>;
|
|
255
|
+
/**
|
|
256
|
+
* Sign S3 object to be used by anonymous users in public apps
|
|
257
|
+
* @param s3object s3 object to sign
|
|
258
|
+
* @returns signed s3 object
|
|
259
|
+
*/
|
|
260
|
+
export declare function signS3Object(s3object: S3Object): Promise<S3Object>;
|
|
261
|
+
/**
|
|
262
|
+
* Generate a presigned public URL for an array of S3 objects.
|
|
263
|
+
* If an S3 object is not signed yet, it will be signed first.
|
|
264
|
+
* @param s3Objects s3 objects to sign
|
|
265
|
+
* @returns list of signed public URLs
|
|
266
|
+
*/
|
|
267
|
+
export declare function getPresignedS3PublicUrls(s3Objects: S3Object[], { baseUrl }?: {
|
|
268
|
+
baseUrl?: string;
|
|
269
|
+
}): Promise<string[]>;
|
|
270
|
+
/**
|
|
271
|
+
* Generate a presigned public URL for an S3 object. If the S3 object is not signed yet, it will be signed first.
|
|
272
|
+
* @param s3Object s3 object to sign
|
|
273
|
+
* @returns signed public URL
|
|
274
|
+
*/
|
|
275
|
+
export declare function getPresignedS3PublicUrl(s3Objects: S3Object, { baseUrl }?: {
|
|
276
|
+
baseUrl?: string;
|
|
277
|
+
}): Promise<string>;
|
|
278
|
+
/**
|
|
279
|
+
* Get URLs needed for resuming a flow after this step
|
|
280
|
+
* @param approver approver name
|
|
281
|
+
* @param flowLevel if true, generate resume URLs for the parent flow instead of the specific step.
|
|
282
|
+
* This allows pre-approvals that can be consumed by any later suspend step in the same flow.
|
|
283
|
+
* @returns approval page UI URL, resume and cancel API URLs for resuming the flow
|
|
284
|
+
*/
|
|
285
|
+
export declare function getResumeUrls(approver?: string, flowLevel?: boolean): Promise<{
|
|
286
|
+
approvalPage: string;
|
|
287
|
+
resume: string;
|
|
288
|
+
cancel: string;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* @deprecated use getResumeUrls instead
|
|
292
|
+
*/
|
|
293
|
+
export declare function getResumeEndpoints(approver?: string): Promise<{
|
|
294
|
+
approvalPage: string;
|
|
295
|
+
resume: string;
|
|
296
|
+
cancel: string;
|
|
297
|
+
}>;
|
|
298
|
+
/**
|
|
299
|
+
* Get an OIDC jwt token for auth to external services (e.g: Vault, AWS) (ee only)
|
|
300
|
+
* @param audience audience of the token
|
|
301
|
+
* @param expiresIn Optional number of seconds until the token expires
|
|
302
|
+
* @returns jwt token
|
|
303
|
+
*/
|
|
304
|
+
export declare function getIdToken(audience: string, expiresIn?: number): Promise<string>;
|
|
305
|
+
/**
|
|
306
|
+
* Convert a base64-encoded string to Uint8Array
|
|
307
|
+
* @param data - Base64-encoded string
|
|
308
|
+
* @returns Decoded Uint8Array
|
|
309
|
+
*/
|
|
310
|
+
export declare function base64ToUint8Array(data: string): Uint8Array;
|
|
311
|
+
/**
|
|
312
|
+
* Convert a Uint8Array to base64-encoded string
|
|
313
|
+
* @param arrayBuffer - Uint8Array to encode
|
|
314
|
+
* @returns Base64-encoded string
|
|
315
|
+
*/
|
|
316
|
+
export declare function uint8ArrayToBase64(arrayBuffer: Uint8Array): string;
|
|
317
|
+
/**
|
|
318
|
+
* Get email from workspace username
|
|
319
|
+
* This method is particularly useful for apps that require the email address of the viewer.
|
|
320
|
+
* Indeed, in the viewer context, WM_USERNAME is set to the username of the viewer but WM_EMAIL is set to the email of the creator of the app.
|
|
321
|
+
* @param username
|
|
322
|
+
* @returns email address
|
|
323
|
+
*/
|
|
324
|
+
export declare function usernameToEmail(username: string): Promise<string>;
|
|
325
|
+
interface SlackApprovalOptions {
|
|
326
|
+
slackResourcePath: string;
|
|
327
|
+
channelId: string;
|
|
328
|
+
message?: string;
|
|
329
|
+
approver?: string;
|
|
330
|
+
defaultArgsJson?: Record<string, any>;
|
|
331
|
+
dynamicEnumsJson?: Record<string, any>;
|
|
332
|
+
}
|
|
333
|
+
interface TeamsApprovalOptions {
|
|
334
|
+
teamName: string;
|
|
335
|
+
channelName: string;
|
|
336
|
+
message?: string;
|
|
337
|
+
approver?: string;
|
|
338
|
+
defaultArgsJson?: Record<string, any>;
|
|
339
|
+
dynamicEnumsJson?: Record<string, any>;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
|
|
343
|
+
*
|
|
344
|
+
* **[Enterprise Edition Only]** To include form fields in the Slack approval request, go to **Advanced -> Suspend -> Form**
|
|
345
|
+
* and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
|
|
346
|
+
*
|
|
347
|
+
* @param {Object} options - The configuration options for the Slack approval request.
|
|
348
|
+
* @param {string} options.slackResourcePath - The path to the Slack resource in Windmill.
|
|
349
|
+
* @param {string} options.channelId - The Slack channel ID where the approval request will be sent.
|
|
350
|
+
* @param {string} [options.message] - Optional custom message to include in the Slack approval request.
|
|
351
|
+
* @param {string} [options.approver] - Optional user ID or name of the approver for the request.
|
|
352
|
+
* @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
|
|
353
|
+
* @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
|
|
354
|
+
*
|
|
355
|
+
* @returns {Promise<void>} Resolves when the Slack approval request is successfully sent.
|
|
356
|
+
*
|
|
357
|
+
* @throws {Error} If the function is not called within a flow or flow preview.
|
|
358
|
+
* @throws {Error} If the `JobService.getSlackApprovalPayload` call fails.
|
|
359
|
+
*
|
|
360
|
+
* **Usage Example:**
|
|
361
|
+
* ```typescript
|
|
362
|
+
* await requestInteractiveSlackApproval({
|
|
363
|
+
* slackResourcePath: "/u/alex/my_slack_resource",
|
|
364
|
+
* channelId: "admins-slack-channel",
|
|
365
|
+
* message: "Please approve this request",
|
|
366
|
+
* approver: "approver123",
|
|
367
|
+
* defaultArgsJson: { key1: "value1", key2: 42 },
|
|
368
|
+
* dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
|
|
369
|
+
* });
|
|
370
|
+
* ```
|
|
371
|
+
*
|
|
372
|
+
* **Note:** This function requires execution within a Windmill flow or flow preview.
|
|
373
|
+
*/
|
|
374
|
+
export declare function requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumsJson, }: SlackApprovalOptions): Promise<void>;
|
|
375
|
+
/**
|
|
376
|
+
* Sends an interactive approval request via Teams, allowing optional customization of the message, approver, and form fields.
|
|
377
|
+
*
|
|
378
|
+
* **[Enterprise Edition Only]** To include form fields in the Teams approval request, go to **Advanced -> Suspend -> Form**
|
|
379
|
+
* and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
|
|
380
|
+
*
|
|
381
|
+
* @param {Object} options - The configuration options for the Teams approval request.
|
|
382
|
+
* @param {string} options.teamName - The Teams team name where the approval request will be sent.
|
|
383
|
+
* @param {string} options.channelName - The Teams channel name where the approval request will be sent.
|
|
384
|
+
* @param {string} [options.message] - Optional custom message to include in the Teams approval request.
|
|
385
|
+
* @param {string} [options.approver] - Optional user ID or name of the approver for the request.
|
|
386
|
+
* @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
|
|
387
|
+
* @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
|
|
388
|
+
*
|
|
389
|
+
* @returns {Promise<void>} Resolves when the Teams approval request is successfully sent.
|
|
390
|
+
*
|
|
391
|
+
* @throws {Error} If the function is not called within a flow or flow preview.
|
|
392
|
+
* @throws {Error} If the `JobService.getTeamsApprovalPayload` call fails.
|
|
393
|
+
*
|
|
394
|
+
* **Usage Example:**
|
|
395
|
+
* ```typescript
|
|
396
|
+
* await requestInteractiveTeamsApproval({
|
|
397
|
+
* teamName: "admins-teams",
|
|
398
|
+
* channelName: "admins-teams-channel",
|
|
399
|
+
* message: "Please approve this request",
|
|
400
|
+
* approver: "approver123",
|
|
401
|
+
* defaultArgsJson: { key1: "value1", key2: 42 },
|
|
402
|
+
* dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
|
|
403
|
+
* });
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* **Note:** This function requires execution within a Windmill flow or flow preview.
|
|
407
|
+
*/
|
|
408
|
+
export declare function requestInteractiveTeamsApproval({ teamName, channelName, message, approver, defaultArgsJson, dynamicEnumsJson, }: TeamsApprovalOptions): Promise<void>;
|
|
409
|
+
/**
|
|
410
|
+
* Parse an S3 object from URI string or record format
|
|
411
|
+
* @param s3Object - S3 object as URI string (s3://storage/key) or record
|
|
412
|
+
* @returns S3 object record with storage and s3 key
|
|
413
|
+
*/
|
|
414
|
+
export declare function parseS3Object(s3Object: S3Object): S3ObjectRecord;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly body: unknown;
|
|
8
|
+
readonly request: ApiRequestOptions;
|
|
9
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiRequestOptions = {
|
|
2
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly path?: Record<string, unknown>;
|
|
5
|
+
readonly cookies?: Record<string, unknown>;
|
|
6
|
+
readonly headers?: Record<string, unknown>;
|
|
7
|
+
readonly query?: Record<string, unknown>;
|
|
8
|
+
readonly formData?: Record<string, unknown>;
|
|
9
|
+
readonly body?: any;
|
|
10
|
+
readonly mediaType?: string;
|
|
11
|
+
readonly responseHeader?: string;
|
|
12
|
+
readonly errors?: Record<number, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class CancelError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
get isCancelled(): boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface OnCancel {
|
|
6
|
+
readonly isResolved: boolean;
|
|
7
|
+
readonly isRejected: boolean;
|
|
8
|
+
readonly isCancelled: boolean;
|
|
9
|
+
(cancelHandler: () => void): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
+
private _isResolved;
|
|
13
|
+
private _isRejected;
|
|
14
|
+
private _isCancelled;
|
|
15
|
+
readonly cancelHandlers: (() => void)[];
|
|
16
|
+
readonly promise: Promise<T>;
|
|
17
|
+
private _resolve?;
|
|
18
|
+
private _reject?;
|
|
19
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void, onCancel: OnCancel) => void);
|
|
20
|
+
get [Symbol.toStringTag](): string;
|
|
21
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
22
|
+
catch<TResult = never>(onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
23
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
24
|
+
cancel(): void;
|
|
25
|
+
get isCancelled(): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
type Headers = Record<string, string>;
|
|
3
|
+
type Middleware<T> = (value: T) => T | Promise<T>;
|
|
4
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
5
|
+
export declare class Interceptors<T> {
|
|
6
|
+
_fns: Middleware<T>[];
|
|
7
|
+
constructor();
|
|
8
|
+
eject(fn: Middleware<T>): void;
|
|
9
|
+
use(fn: Middleware<T>): void;
|
|
10
|
+
}
|
|
11
|
+
export type OpenAPIConfig = {
|
|
12
|
+
BASE: string;
|
|
13
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
14
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
15
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
16
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
17
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
18
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
19
|
+
VERSION: string;
|
|
20
|
+
WITH_CREDENTIALS: boolean;
|
|
21
|
+
interceptors: {
|
|
22
|
+
request: Interceptors<RequestInit>;
|
|
23
|
+
response: Interceptors<Response>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const OpenAPI: OpenAPIConfig;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
4
|
+
import type { OnCancel } from './CancelablePromise';
|
|
5
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
6
|
+
export declare const isString: (value: unknown) => value is string;
|
|
7
|
+
export declare const isStringWithValue: (value: unknown) => value is string;
|
|
8
|
+
export declare const isBlob: (value: any) => value is Blob;
|
|
9
|
+
export declare const isFormData: (value: unknown) => value is FormData;
|
|
10
|
+
export declare const base64: (str: string) => string;
|
|
11
|
+
export declare const getQueryString: (params: Record<string, unknown>) => string;
|
|
12
|
+
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
|
|
13
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
14
|
+
export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
|
|
15
|
+
export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Headers>;
|
|
16
|
+
export declare const getRequestBody: (options: ApiRequestOptions) => unknown;
|
|
17
|
+
export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<Response>;
|
|
18
|
+
export declare const getResponseHeader: (response: Response, responseHeader?: string) => string | undefined;
|
|
19
|
+
export declare const getResponseBody: (response: Response) => Promise<unknown>;
|
|
20
|
+
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Request method
|
|
23
|
+
* @param config The OpenAPI configuration object
|
|
24
|
+
* @param options The request options from the service
|
|
25
|
+
* @returns CancelablePromise<T>
|
|
26
|
+
* @throws ApiError
|
|
27
|
+
*/
|
|
28
|
+
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
|
|
29
|
+
export {};
|