windmill-client 1.360.0 → 1.361.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.js +33 -33
- package/dist/core/OpenAPI.js +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -9,7 +9,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.SHARED_FOLDER = exports.WorkspaceService = exports.UserService = exports.SettingsService = exports.ScheduleService = exports.ScriptService = exports.VariableService = exports.ResourceService = exports.JobService = exports.GroupService = exports.GranularAclService = exports.FlowService = exports.AuditService = exports.AdminService = void 0;
|
|
13
|
+
exports.setClient = setClient;
|
|
14
|
+
exports.getWorkspace = getWorkspace;
|
|
15
|
+
exports.getResource = getResource;
|
|
16
|
+
exports.getRootJobId = getRootJobId;
|
|
17
|
+
exports.runScript = runScript;
|
|
18
|
+
exports.waitJob = waitJob;
|
|
19
|
+
exports.getResult = getResult;
|
|
20
|
+
exports.getResultMaybe = getResultMaybe;
|
|
21
|
+
exports.task = task;
|
|
22
|
+
exports.runScriptAsync = runScriptAsync;
|
|
23
|
+
exports.resolveDefaultResource = resolveDefaultResource;
|
|
24
|
+
exports.getStatePath = getStatePath;
|
|
25
|
+
exports.setResource = setResource;
|
|
26
|
+
exports.setInternalState = setInternalState;
|
|
27
|
+
exports.setState = setState;
|
|
28
|
+
exports.setFlowUserState = setFlowUserState;
|
|
29
|
+
exports.getFlowUserState = getFlowUserState;
|
|
30
|
+
exports.getInternalState = getInternalState;
|
|
31
|
+
exports.getState = getState;
|
|
32
|
+
exports.getVariable = getVariable;
|
|
33
|
+
exports.setVariable = setVariable;
|
|
34
|
+
exports.databaseUrlFromResource = databaseUrlFromResource;
|
|
35
|
+
exports.denoS3LightClientSettings = denoS3LightClientSettings;
|
|
36
|
+
exports.loadS3File = loadS3File;
|
|
37
|
+
exports.loadS3FileStream = loadS3FileStream;
|
|
38
|
+
exports.writeS3File = writeS3File;
|
|
39
|
+
exports.getResumeUrls = getResumeUrls;
|
|
40
|
+
exports.getResumeEndpoints = getResumeEndpoints;
|
|
41
|
+
exports.getIdToken = getIdToken;
|
|
42
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
43
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
44
|
+
exports.usernameToEmail = usernameToEmail;
|
|
13
45
|
const index_1 = require("./index");
|
|
14
46
|
const index_2 = require("./index");
|
|
15
47
|
var index_3 = require("./index");
|
|
@@ -40,7 +72,6 @@ function setClient(token, baseUrl) {
|
|
|
40
72
|
index_2.OpenAPI.TOKEN = token;
|
|
41
73
|
index_2.OpenAPI.BASE = baseUrl + "/api";
|
|
42
74
|
}
|
|
43
|
-
exports.setClient = setClient;
|
|
44
75
|
const getEnv = (key) => {
|
|
45
76
|
var _a, _b, _c;
|
|
46
77
|
if (typeof window === "undefined") {
|
|
@@ -58,7 +89,6 @@ function getWorkspace() {
|
|
|
58
89
|
var _a;
|
|
59
90
|
return (_a = getEnv("WM_WORKSPACE")) !== null && _a !== void 0 ? _a : "no_workspace";
|
|
60
91
|
}
|
|
61
|
-
exports.getWorkspace = getWorkspace;
|
|
62
92
|
/**
|
|
63
93
|
* Get a resource value by path
|
|
64
94
|
* @param path path of the resource, default to internal state path
|
|
@@ -85,7 +115,6 @@ function getResource(path, undefinedIfEmpty) {
|
|
|
85
115
|
}
|
|
86
116
|
});
|
|
87
117
|
}
|
|
88
|
-
exports.getResource = getResource;
|
|
89
118
|
/**
|
|
90
119
|
* Get the true root job id
|
|
91
120
|
* @param jobId job id to get the root job id from (default to current job)
|
|
@@ -101,7 +130,6 @@ function getRootJobId(jobId) {
|
|
|
101
130
|
return yield index_1.JobService.getRootJobId({ workspace, id: jobId });
|
|
102
131
|
});
|
|
103
132
|
}
|
|
104
|
-
exports.getRootJobId = getRootJobId;
|
|
105
133
|
function runScript() {
|
|
106
134
|
return __awaiter(this, arguments, void 0, function* (path = null, hash_ = null, args = null, verbose = false) {
|
|
107
135
|
args = args || {};
|
|
@@ -112,7 +140,6 @@ function runScript() {
|
|
|
112
140
|
return yield waitJob(jobId, verbose);
|
|
113
141
|
});
|
|
114
142
|
}
|
|
115
|
-
exports.runScript = runScript;
|
|
116
143
|
function waitJob(jobId_1) {
|
|
117
144
|
return __awaiter(this, arguments, void 0, function* (jobId, verbose = false) {
|
|
118
145
|
while (true) {
|
|
@@ -141,21 +168,18 @@ function waitJob(jobId_1) {
|
|
|
141
168
|
}
|
|
142
169
|
});
|
|
143
170
|
}
|
|
144
|
-
exports.waitJob = waitJob;
|
|
145
171
|
function getResult(jobId) {
|
|
146
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
173
|
const workspace = getWorkspace();
|
|
148
174
|
return yield index_1.JobService.getCompletedJobResult({ workspace, id: jobId });
|
|
149
175
|
});
|
|
150
176
|
}
|
|
151
|
-
exports.getResult = getResult;
|
|
152
177
|
function getResultMaybe(jobId) {
|
|
153
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
179
|
const workspace = getWorkspace();
|
|
155
180
|
return yield index_1.JobService.getCompletedJobResultMaybe({ workspace, id: jobId });
|
|
156
181
|
});
|
|
157
182
|
}
|
|
158
|
-
exports.getResultMaybe = getResultMaybe;
|
|
159
183
|
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,\)]*))/gm;
|
|
160
184
|
const ARGUMENT_NAMES = /([^\s,]+)/g;
|
|
161
185
|
function getParamNames(func) {
|
|
@@ -187,7 +211,6 @@ function task(f) {
|
|
|
187
211
|
return r;
|
|
188
212
|
});
|
|
189
213
|
}
|
|
190
|
-
exports.task = task;
|
|
191
214
|
function runScriptAsync(path_1, hash_1, args_1) {
|
|
192
215
|
return __awaiter(this, arguments, void 0, function* (path, hash_, args, scheduledInSeconds = null) {
|
|
193
216
|
// Create a script job and return its job id.
|
|
@@ -229,7 +252,6 @@ function runScriptAsync(path_1, hash_1, args_1) {
|
|
|
229
252
|
}).then((res) => res.text());
|
|
230
253
|
});
|
|
231
254
|
}
|
|
232
|
-
exports.runScriptAsync = runScriptAsync;
|
|
233
255
|
/**
|
|
234
256
|
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
235
257
|
* @param obj resource value or path of the resource under the format `$res:path`
|
|
@@ -245,7 +267,6 @@ function resolveDefaultResource(obj) {
|
|
|
245
267
|
}
|
|
246
268
|
});
|
|
247
269
|
}
|
|
248
|
-
exports.resolveDefaultResource = resolveDefaultResource;
|
|
249
270
|
function getStatePath() {
|
|
250
271
|
var _a;
|
|
251
272
|
const state_path = (_a = getEnv("WM_STATE_PATH_NEW")) !== null && _a !== void 0 ? _a : getEnv("WM_STATE_PATH");
|
|
@@ -254,7 +275,6 @@ function getStatePath() {
|
|
|
254
275
|
}
|
|
255
276
|
return state_path;
|
|
256
277
|
}
|
|
257
|
-
exports.getStatePath = getStatePath;
|
|
258
278
|
/**
|
|
259
279
|
* Set a resource value by path
|
|
260
280
|
* @param path path of the resource to set, default to state path
|
|
@@ -283,7 +303,6 @@ function setResource(value, path, initializeToTypeIfNotExist) {
|
|
|
283
303
|
}
|
|
284
304
|
});
|
|
285
305
|
}
|
|
286
|
-
exports.setResource = setResource;
|
|
287
306
|
/**
|
|
288
307
|
* Set the state
|
|
289
308
|
* @param state state to set
|
|
@@ -294,7 +313,6 @@ function setInternalState(state) {
|
|
|
294
313
|
yield setResource(state, undefined, "state");
|
|
295
314
|
});
|
|
296
315
|
}
|
|
297
|
-
exports.setInternalState = setInternalState;
|
|
298
316
|
/**
|
|
299
317
|
* Set the state
|
|
300
318
|
* @param state state to set
|
|
@@ -304,7 +322,6 @@ function setState(state) {
|
|
|
304
322
|
yield setResource(state, undefined, "state");
|
|
305
323
|
});
|
|
306
324
|
}
|
|
307
|
-
exports.setState = setState;
|
|
308
325
|
/**
|
|
309
326
|
* Set a flow user state
|
|
310
327
|
* @param key key of the state
|
|
@@ -335,7 +352,6 @@ function setFlowUserState(key, value, errorIfNotPossible) {
|
|
|
335
352
|
}
|
|
336
353
|
});
|
|
337
354
|
}
|
|
338
|
-
exports.setFlowUserState = setFlowUserState;
|
|
339
355
|
/**
|
|
340
356
|
* Get a flow user state
|
|
341
357
|
* @param path path of the variable
|
|
@@ -361,7 +377,6 @@ function getFlowUserState(key, errorIfNotPossible) {
|
|
|
361
377
|
}
|
|
362
378
|
});
|
|
363
379
|
}
|
|
364
|
-
exports.getFlowUserState = getFlowUserState;
|
|
365
380
|
// /**
|
|
366
381
|
// * Set the shared state
|
|
367
382
|
// * @param state state to set
|
|
@@ -388,7 +403,6 @@ function getInternalState() {
|
|
|
388
403
|
return yield getResource(getStatePath(), true);
|
|
389
404
|
});
|
|
390
405
|
}
|
|
391
|
-
exports.getInternalState = getInternalState;
|
|
392
406
|
/**
|
|
393
407
|
* Get the state shared across executions
|
|
394
408
|
*/
|
|
@@ -397,7 +411,6 @@ function getState() {
|
|
|
397
411
|
return yield getResource(getStatePath(), true);
|
|
398
412
|
});
|
|
399
413
|
}
|
|
400
|
-
exports.getState = getState;
|
|
401
414
|
/**
|
|
402
415
|
* Get a variable by path
|
|
403
416
|
* @param path path of the variable
|
|
@@ -414,7 +427,6 @@ function getVariable(path) {
|
|
|
414
427
|
}
|
|
415
428
|
});
|
|
416
429
|
}
|
|
417
|
-
exports.getVariable = getVariable;
|
|
418
430
|
/**
|
|
419
431
|
* Set a variable by path, create if not exist
|
|
420
432
|
* @param path path of the variable
|
|
@@ -445,14 +457,12 @@ function setVariable(path, value, isSecretIfNotExist, descriptionIfNotExist) {
|
|
|
445
457
|
}
|
|
446
458
|
});
|
|
447
459
|
}
|
|
448
|
-
exports.setVariable = setVariable;
|
|
449
460
|
function databaseUrlFromResource(path) {
|
|
450
461
|
return __awaiter(this, void 0, void 0, function* () {
|
|
451
462
|
const resource = yield getResource(path);
|
|
452
463
|
return `postgresql://${resource.user}:${resource.password}@${resource.host}:${resource.port}/${resource.dbname}?sslmode=${resource.sslmode}`;
|
|
453
464
|
});
|
|
454
465
|
}
|
|
455
|
-
exports.databaseUrlFromResource = databaseUrlFromResource;
|
|
456
466
|
// TODO(gb): need to investigate more how Polars and DuckDB work in TS
|
|
457
467
|
// export async function polarsConnectionSettings(s3_resource_path: string | undefined): Promise<any> {
|
|
458
468
|
// const workspace = getWorkspace();
|
|
@@ -485,7 +495,6 @@ function denoS3LightClientSettings(s3_resource_path) {
|
|
|
485
495
|
return settings;
|
|
486
496
|
});
|
|
487
497
|
}
|
|
488
|
-
exports.denoS3LightClientSettings = denoS3LightClientSettings;
|
|
489
498
|
/**
|
|
490
499
|
* Load the content of a file stored in S3. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
491
500
|
*
|
|
@@ -525,7 +534,6 @@ function loadS3File(s3object_1) {
|
|
|
525
534
|
return fileContent;
|
|
526
535
|
});
|
|
527
536
|
}
|
|
528
|
-
exports.loadS3File = loadS3File;
|
|
529
537
|
/**
|
|
530
538
|
* 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.
|
|
531
539
|
*
|
|
@@ -556,7 +564,6 @@ function loadS3FileStream(s3object_1) {
|
|
|
556
564
|
return fileContentBlob.blob();
|
|
557
565
|
});
|
|
558
566
|
}
|
|
559
|
-
exports.loadS3FileStream = loadS3FileStream;
|
|
560
567
|
/**
|
|
561
568
|
* Persist a file to the S3 bucket. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
562
569
|
*
|
|
@@ -590,7 +597,6 @@ function writeS3File(s3object_1, fileContent_1) {
|
|
|
590
597
|
};
|
|
591
598
|
});
|
|
592
599
|
}
|
|
593
|
-
exports.writeS3File = writeS3File;
|
|
594
600
|
/**
|
|
595
601
|
* Get URLs needed for resuming a flow after this step
|
|
596
602
|
* @param approver approver name
|
|
@@ -609,14 +615,12 @@ function getResumeUrls(approver) {
|
|
|
609
615
|
});
|
|
610
616
|
});
|
|
611
617
|
}
|
|
612
|
-
exports.getResumeUrls = getResumeUrls;
|
|
613
618
|
/**
|
|
614
619
|
* @deprecated use getResumeUrls instead
|
|
615
620
|
*/
|
|
616
621
|
function getResumeEndpoints(approver) {
|
|
617
622
|
return getResumeUrls(approver);
|
|
618
623
|
}
|
|
619
|
-
exports.getResumeEndpoints = getResumeEndpoints;
|
|
620
624
|
/**
|
|
621
625
|
* Get an OIDC jwt token for auth to external services (e.g: Vault, AWS) (ee only)
|
|
622
626
|
* @param audience audience of the token
|
|
@@ -631,11 +635,9 @@ function getIdToken(audience) {
|
|
|
631
635
|
});
|
|
632
636
|
});
|
|
633
637
|
}
|
|
634
|
-
exports.getIdToken = getIdToken;
|
|
635
638
|
function base64ToUint8Array(data) {
|
|
636
639
|
return Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
|
|
637
640
|
}
|
|
638
|
-
exports.base64ToUint8Array = base64ToUint8Array;
|
|
639
641
|
function uint8ArrayToBase64(arrayBuffer) {
|
|
640
642
|
let base64 = "";
|
|
641
643
|
const encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -675,7 +677,6 @@ function uint8ArrayToBase64(arrayBuffer) {
|
|
|
675
677
|
}
|
|
676
678
|
return base64;
|
|
677
679
|
}
|
|
678
|
-
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
679
680
|
/**
|
|
680
681
|
* Get email from workspace username
|
|
681
682
|
* This method is particularly useful for apps that require the email address of the viewer.
|
|
@@ -689,4 +690,3 @@ function usernameToEmail(username) {
|
|
|
689
690
|
return yield index_1.UserService.usernameToEmail({ username, workspace });
|
|
690
691
|
});
|
|
691
692
|
}
|
|
692
|
-
exports.usernameToEmail = usernameToEmail;
|
package/dist/core/OpenAPI.js
CHANGED