windmill-client 0.3.7 → 0.3.9
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 +159 -156
- package/dist/core/ApiError.js +1 -5
- package/dist/core/ApiRequestOptions.js +1 -2
- package/dist/core/ApiResult.js +1 -2
- package/dist/core/CancelablePromise.js +2 -7
- package/dist/core/OpenAPI.js +1 -4
- package/dist/core/request.js +66 -92
- package/dist/index.js +42 -88
- package/dist/models/AccountId.js +1 -2
- package/dist/models/ActionKind.js +2 -5
- package/dist/models/After.js +1 -2
- package/dist/models/AppWithLastVersion.js +2 -5
- package/dist/models/AppWithLastVersionWDraft.js +1 -2
- package/dist/models/ArgsFilter.js +1 -2
- package/dist/models/AuditLog.js +2 -5
- package/dist/models/Before.js +1 -2
- package/dist/models/BranchAll.js +1 -2
- package/dist/models/BranchOne.js +1 -2
- package/dist/models/ClientName.js +1 -2
- package/dist/models/CompletedJob.js +2 -5
- package/dist/models/ContextualVariable.js +1 -2
- package/dist/models/CreateInput.js +1 -2
- package/dist/models/CreateResource.js +1 -2
- package/dist/models/CreateVariable.js +1 -2
- package/dist/models/CreateWorkspace.js +1 -2
- package/dist/models/CreatedBy.js +1 -2
- package/dist/models/EditResource.js +1 -2
- package/dist/models/EditResourceType.js +1 -2
- package/dist/models/EditSchedule.js +1 -2
- package/dist/models/EditVariable.js +1 -2
- package/dist/models/EditWorkspaceUser.js +1 -2
- package/dist/models/Flow.js +1 -2
- package/dist/models/FlowMetadata.js +1 -2
- package/dist/models/FlowModule.js +1 -2
- package/dist/models/FlowModuleValue.js +1 -2
- package/dist/models/FlowPreview.js +1 -2
- package/dist/models/FlowStatus.js +1 -2
- package/dist/models/FlowStatusModule.js +2 -5
- package/dist/models/FlowValue.js +1 -2
- package/dist/models/Folder.js +1 -2
- package/dist/models/ForloopFlow.js +1 -2
- package/dist/models/GlobalUserInfo.js +2 -5
- package/dist/models/Graphql.js +1 -2
- package/dist/models/Group.js +1 -2
- package/dist/models/Http.js +1 -2
- package/dist/models/Identity.js +1 -2
- package/dist/models/IncludeHeader.js +1 -2
- package/dist/models/Input.js +1 -2
- package/dist/models/InputId.js +1 -2
- package/dist/models/InputTransform.js +1 -2
- package/dist/models/JavascriptTransform.js +1 -2
- package/dist/models/Job.js +2 -5
- package/dist/models/JobId.js +1 -2
- package/dist/models/JobKinds.js +1 -2
- package/dist/models/ListableApp.js +2 -5
- package/dist/models/ListableRawApp.js +1 -2
- package/dist/models/ListableResource.js +1 -2
- package/dist/models/ListableVariable.js +1 -2
- package/dist/models/Login.js +1 -2
- package/dist/models/MainArgSignature.js +2 -5
- package/dist/models/Name.js +1 -2
- package/dist/models/NewJobId.js +1 -2
- package/dist/models/NewSchedule.js +1 -2
- package/dist/models/NewScript.js +2 -5
- package/dist/models/NewScriptWithDraft.js +1 -2
- package/dist/models/NewToken.js +1 -2
- package/dist/models/NewTokenImpersonate.js +1 -2
- package/dist/models/NewUser.js +1 -2
- package/dist/models/OpenFlow.js +1 -2
- package/dist/models/OpenFlowWPath.js +1 -2
- package/dist/models/Operation.js +1 -2
- package/dist/models/OrderDesc.js +1 -2
- package/dist/models/Page.js +1 -2
- package/dist/models/ParentJob.js +1 -2
- package/dist/models/Path.js +1 -2
- package/dist/models/PathFlow.js +1 -2
- package/dist/models/PathId.js +1 -2
- package/dist/models/PathScript.js +1 -2
- package/dist/models/Payload.js +1 -2
- package/dist/models/PerPage.js +1 -2
- package/dist/models/Policy.js +2 -5
- package/dist/models/Preview.js +2 -5
- package/dist/models/QueueLimit.js +1 -2
- package/dist/models/QueuedJob.js +2 -5
- package/dist/models/RawScript.js +2 -5
- package/dist/models/Resource.js +1 -2
- package/dist/models/ResourceName.js +1 -2
- package/dist/models/ResourceType.js +1 -2
- package/dist/models/ResultFilter.js +1 -2
- package/dist/models/Retry.js +1 -2
- package/dist/models/RunnableId.js +1 -2
- package/dist/models/RunnableType.js +2 -5
- package/dist/models/RunnableTypeQuery.js +1 -2
- package/dist/models/Running.js +1 -2
- package/dist/models/Schedule.js +1 -2
- package/dist/models/SchedulePath.js +1 -2
- package/dist/models/ScheduleWJobs.js +1 -2
- package/dist/models/Script.js +2 -5
- package/dist/models/ScriptArgs.js +1 -2
- package/dist/models/ScriptExactHash.js +1 -2
- package/dist/models/ScriptExactPath.js +1 -2
- package/dist/models/ScriptHash.js +1 -2
- package/dist/models/ScriptPath.js +1 -2
- package/dist/models/ScriptStartPath.js +1 -2
- package/dist/models/SlackToken.js +1 -2
- package/dist/models/StartedAfter.js +1 -2
- package/dist/models/StartedBefore.js +1 -2
- package/dist/models/StaticTransform.js +1 -2
- package/dist/models/Success.js +1 -2
- package/dist/models/Suspended.js +1 -2
- package/dist/models/Tag.js +1 -2
- package/dist/models/Token.js +1 -2
- package/dist/models/TokenResponse.js +1 -2
- package/dist/models/TruncatedToken.js +1 -2
- package/dist/models/UpdateInput.js +1 -2
- package/dist/models/Usage.js +1 -2
- package/dist/models/User.js +1 -2
- package/dist/models/UserWorkspaceList.js +1 -2
- package/dist/models/Username.js +1 -2
- package/dist/models/VersionId.js +1 -2
- package/dist/models/WorkerPing.js +1 -2
- package/dist/models/Workspace.js +1 -2
- package/dist/models/WorkspaceId.js +1 -2
- package/dist/models/WorkspaceInvite.js +1 -2
- package/dist/services/AdminService.js +6 -10
- package/dist/services/AppService.js +16 -20
- package/dist/services/AuditService.js +5 -9
- package/dist/services/CaptureService.js +6 -10
- package/dist/services/DraftService.js +5 -9
- package/dist/services/FavoriteService.js +5 -9
- package/dist/services/FlowService.js +15 -19
- package/dist/services/FolderService.js +12 -16
- package/dist/services/GranularAclService.js +6 -10
- package/dist/services/GroupService.js +11 -15
- package/dist/services/InputService.js +8 -12
- package/dist/services/JobService.js +34 -38
- package/dist/services/OauthService.js +11 -15
- package/dist/services/RawAppService.js +9 -13
- package/dist/services/ResourceService.js +18 -22
- package/dist/services/ScheduleService.js +12 -16
- package/dist/services/ScriptService.js +21 -25
- package/dist/services/SettingsService.js +7 -11
- package/dist/services/UserService.js +32 -36
- package/dist/services/VariableService.js +11 -15
- package/dist/services/WorkerService.js +5 -9
- package/dist/services/WorkspaceService.js +24 -28
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(exports, "ScriptService", { enumerable: true, get: function () { return index_3.ScriptService; } });
|
|
16
|
-
Object.defineProperty(exports, "ScheduleService", { enumerable: true, get: function () { return index_3.ScheduleService; } });
|
|
17
|
-
Object.defineProperty(exports, "SettingsService", { enumerable: true, get: function () { return index_3.SettingsService; } });
|
|
18
|
-
Object.defineProperty(exports, "UserService", { enumerable: true, get: function () { return index_3.UserService; } });
|
|
19
|
-
Object.defineProperty(exports, "WorkspaceService", { enumerable: true, get: function () { return index_3.WorkspaceService; } });
|
|
20
|
-
exports.SHARED_FOLDER = "/shared";
|
|
21
|
-
function setClient(token, baseUrl) {
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ResourceService, VariableService } from "./index";
|
|
11
|
+
import { OpenAPI } from "./index";
|
|
12
|
+
export { AdminService, AuditService, FlowService, GranularAclService, GroupService, JobService, ResourceService, VariableService, ScriptService, ScheduleService, SettingsService, UserService, WorkspaceService, } from "./index";
|
|
13
|
+
export const SHARED_FOLDER = "/shared";
|
|
14
|
+
export function setClient(token, baseUrl) {
|
|
22
15
|
var _a, _b, _c;
|
|
23
16
|
if (baseUrl === undefined) {
|
|
24
17
|
baseUrl =
|
|
@@ -27,11 +20,10 @@ function setClient(token, baseUrl) {
|
|
|
27
20
|
if (token === undefined) {
|
|
28
21
|
baseUrl = (_c = getEnv("WM_TOKEN")) !== null && _c !== void 0 ? _c : "no_token";
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
OpenAPI.WITH_CREDENTIALS = true;
|
|
24
|
+
OpenAPI.TOKEN = token;
|
|
25
|
+
OpenAPI.BASE = baseUrl + "/api";
|
|
33
26
|
}
|
|
34
|
-
exports.setClient = setClient;
|
|
35
27
|
const getEnv = (key) => {
|
|
36
28
|
if (typeof window === "undefined") {
|
|
37
29
|
// node
|
|
@@ -44,124 +36,128 @@ const getEnv = (key) => {
|
|
|
44
36
|
* Create a client configuration from env variables
|
|
45
37
|
* @returns client configuration
|
|
46
38
|
*/
|
|
47
|
-
function getWorkspace() {
|
|
39
|
+
export function getWorkspace() {
|
|
48
40
|
var _a;
|
|
49
41
|
return (_a = getEnv("WM_WORKSPACE")) !== null && _a !== void 0 ? _a : "no_workspace";
|
|
50
42
|
}
|
|
51
|
-
exports.getWorkspace = getWorkspace;
|
|
52
43
|
/**
|
|
53
44
|
* Get a resource value by path
|
|
54
45
|
* @param path path of the resource, default to internal state path
|
|
55
46
|
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
56
47
|
* @returns resource value
|
|
57
48
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
catch (e) {
|
|
66
|
-
if (undefinedIfEmpty && e.status === 404) {
|
|
67
|
-
return undefined;
|
|
49
|
+
export function getResource(path, undefinedIfEmpty) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const workspace = getWorkspace();
|
|
52
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
53
|
+
try {
|
|
54
|
+
const resource = yield ResourceService.getResource({ workspace, path });
|
|
55
|
+
return yield _transformLeaf(resource.value);
|
|
68
56
|
}
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
catch (e) {
|
|
58
|
+
if (undefinedIfEmpty && e.status === 404) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw Error(`Resource not found at ${path} or not visible to you`);
|
|
63
|
+
}
|
|
71
64
|
}
|
|
72
|
-
}
|
|
65
|
+
});
|
|
73
66
|
}
|
|
74
|
-
exports.getResource = getResource;
|
|
75
67
|
/**
|
|
76
68
|
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
77
69
|
* @param obj resource value or path of the resource under the format `$res:path`
|
|
78
70
|
* @returns resource value
|
|
79
71
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
export function resolveDefaultResource(obj) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (typeof obj === "string" && obj.startsWith("$res:")) {
|
|
75
|
+
return yield getResource(obj.substring(5), true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
87
81
|
}
|
|
88
|
-
exports.resolveDefaultResource = resolveDefaultResource;
|
|
89
82
|
/**
|
|
90
83
|
* Get the full resource value by path
|
|
91
84
|
* @param path path of the resource, default to internal state path
|
|
92
85
|
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
93
86
|
* @returns full resource
|
|
94
87
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
catch (e) {
|
|
104
|
-
if (undefinedIfEmpty && e.status === 404) {
|
|
105
|
-
return undefined;
|
|
88
|
+
export function getFullResource(path, undefinedIfEmpty) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const workspace = getWorkspace();
|
|
91
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
92
|
+
try {
|
|
93
|
+
const resource = yield ResourceService.getResource({ workspace, path });
|
|
94
|
+
const value = yield _transformLeaf(resource.value);
|
|
95
|
+
return Object.assign(Object.assign({}, resource), { value });
|
|
106
96
|
}
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
catch (e) {
|
|
98
|
+
if (undefinedIfEmpty && e.status === 404) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
throw Error(`Resource not found at ${path} or not visible to you`);
|
|
103
|
+
}
|
|
109
104
|
}
|
|
110
|
-
}
|
|
105
|
+
});
|
|
111
106
|
}
|
|
112
|
-
|
|
113
|
-
function getStatePath() {
|
|
107
|
+
export function getStatePath() {
|
|
114
108
|
const state_path = getEnv("WM_STATE_PATH");
|
|
115
109
|
if (state_path === undefined) {
|
|
116
110
|
throw Error("State path not set");
|
|
117
111
|
}
|
|
118
112
|
return state_path;
|
|
119
113
|
}
|
|
120
|
-
exports.getStatePath = getStatePath;
|
|
121
114
|
/**
|
|
122
115
|
* Set a resource value by path
|
|
123
116
|
* @param path path of the resource to set, default to state path
|
|
124
117
|
* @param value new value of the resource to set
|
|
125
118
|
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
|
|
126
119
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
120
|
+
export function setResource(value, path, initializeToTypeIfNotExist) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
123
|
+
const workspace = getWorkspace();
|
|
124
|
+
if (yield ResourceService.existsResource({ workspace, path })) {
|
|
125
|
+
yield ResourceService.updateResourceValue({
|
|
126
|
+
workspace,
|
|
127
|
+
path,
|
|
128
|
+
requestBody: { value },
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else if (initializeToTypeIfNotExist) {
|
|
132
|
+
yield ResourceService.createResource({
|
|
133
|
+
workspace,
|
|
134
|
+
requestBody: { path, value, resource_type: initializeToTypeIfNotExist },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw Error(`Resource at path ${path} does not exist and no type was provided to initialize it`);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
146
141
|
}
|
|
147
|
-
exports.setResource = setResource;
|
|
148
142
|
/**
|
|
149
143
|
* Set the state
|
|
150
144
|
* @param state state to set
|
|
151
145
|
* @deprecated use setState instead
|
|
152
146
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
export function setInternalState(state) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
yield setResource(state, undefined, "state");
|
|
150
|
+
});
|
|
155
151
|
}
|
|
156
|
-
exports.setInternalState = setInternalState;
|
|
157
152
|
/**
|
|
158
153
|
* Set the state
|
|
159
154
|
* @param state state to set
|
|
160
155
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
export function setState(state) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
yield setResource(state, undefined, "state");
|
|
159
|
+
});
|
|
163
160
|
}
|
|
164
|
-
exports.setState = setState;
|
|
165
161
|
// /**
|
|
166
162
|
// * Set the shared state
|
|
167
163
|
// * @param state state to set
|
|
@@ -183,33 +179,36 @@ exports.setState = setState;
|
|
|
183
179
|
* Get the internal state
|
|
184
180
|
* @deprecated use getState instead
|
|
185
181
|
*/
|
|
186
|
-
|
|
187
|
-
return
|
|
182
|
+
export function getInternalState() {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
return yield getResource(getStatePath(), true);
|
|
185
|
+
});
|
|
188
186
|
}
|
|
189
|
-
exports.getInternalState = getInternalState;
|
|
190
187
|
/**
|
|
191
188
|
* Get the state shared across executions
|
|
192
189
|
*/
|
|
193
|
-
|
|
194
|
-
return
|
|
190
|
+
export function getState() {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
return yield getResource(getStatePath(), true);
|
|
193
|
+
});
|
|
195
194
|
}
|
|
196
|
-
exports.getState = getState;
|
|
197
195
|
/**
|
|
198
196
|
* Get a variable by path
|
|
199
197
|
* @param path path of the variable
|
|
200
198
|
* @returns variable value
|
|
201
199
|
*/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
200
|
+
export function getVariable(path) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const workspace = getWorkspace();
|
|
203
|
+
try {
|
|
204
|
+
const variable = yield VariableService.getVariable({ workspace, path });
|
|
205
|
+
return variable.value;
|
|
206
|
+
}
|
|
207
|
+
catch (e) {
|
|
208
|
+
throw Error(`Variable not found at ${path} or not visible to you`);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
211
|
}
|
|
212
|
-
exports.getVariable = getVariable;
|
|
213
212
|
/**
|
|
214
213
|
* Set a variable by path, create if not exist
|
|
215
214
|
* @param path path of the variable
|
|
@@ -217,57 +216,63 @@ exports.getVariable = getVariable;
|
|
|
217
216
|
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
|
|
218
217
|
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
|
|
219
218
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
requestBody: { value },
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
await index_1.VariableService.createVariable({
|
|
231
|
-
workspace,
|
|
232
|
-
requestBody: {
|
|
219
|
+
export function setVariable(path, value, isSecretIfNotExist, descriptionIfNotExist) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const workspace = getWorkspace();
|
|
222
|
+
if (yield VariableService.existsVariable({ workspace, path })) {
|
|
223
|
+
yield VariableService.updateVariable({
|
|
224
|
+
workspace,
|
|
233
225
|
path,
|
|
234
|
-
value,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
226
|
+
requestBody: { value },
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
yield VariableService.createVariable({
|
|
231
|
+
workspace,
|
|
232
|
+
requestBody: {
|
|
233
|
+
path,
|
|
234
|
+
value,
|
|
235
|
+
is_secret: isSecretIfNotExist !== null && isSecretIfNotExist !== void 0 ? isSecretIfNotExist : false,
|
|
236
|
+
description: descriptionIfNotExist !== null && descriptionIfNotExist !== void 0 ? descriptionIfNotExist : "",
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
});
|
|
240
241
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
function transformLeaves(d) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
for (const k in d) {
|
|
245
|
+
d[k] = yield _transformLeaf(d[k]);
|
|
246
|
+
}
|
|
247
|
+
return d;
|
|
248
|
+
});
|
|
247
249
|
}
|
|
248
250
|
const VAR_RESOURCE_PREFIX = "$var:";
|
|
249
251
|
const RES_RESOURCE_PREFIX = "$res:";
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
252
|
+
function _transformLeaf(v) {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
if (typeof v === "object") {
|
|
255
|
+
return transformLeaves(v);
|
|
256
|
+
}
|
|
257
|
+
else if (typeof v === "string" && v.startsWith(VAR_RESOURCE_PREFIX)) {
|
|
258
|
+
const varName = v.substring(VAR_RESOURCE_PREFIX.length);
|
|
259
|
+
return yield getVariable(varName);
|
|
260
|
+
}
|
|
261
|
+
else if (typeof v === "string" && v.startsWith(RES_RESOURCE_PREFIX)) {
|
|
262
|
+
const resName = v.substring(RES_RESOURCE_PREFIX.length);
|
|
263
|
+
return yield getResource(resName);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return v;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
265
269
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
export function databaseUrlFromResource(path) {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
const resource = yield getResource(path);
|
|
273
|
+
return `postgresql://${resource.user}:${resource.password}@${resource.host}:${resource.port}/${resource.dbname}?sslmode=${resource.sslmode}`;
|
|
274
|
+
});
|
|
269
275
|
}
|
|
270
|
-
exports.databaseUrlFromResource = databaseUrlFromResource;
|
|
271
276
|
// /**
|
|
272
277
|
// * Get URLs needed for resuming a flow after this step
|
|
273
278
|
// * @param approver approver name
|
|
@@ -287,11 +292,10 @@ exports.databaseUrlFromResource = databaseUrlFromResource;
|
|
|
287
292
|
// id: process.env.get("WM_JOB_ID") ?? "NO_JOB_ID",
|
|
288
293
|
// });
|
|
289
294
|
// }
|
|
290
|
-
function base64ToUint8Array(data) {
|
|
295
|
+
export function base64ToUint8Array(data) {
|
|
291
296
|
return Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
|
|
292
297
|
}
|
|
293
|
-
|
|
294
|
-
function uint8ArrayToBase64(arrayBuffer) {
|
|
298
|
+
export function uint8ArrayToBase64(arrayBuffer) {
|
|
295
299
|
let base64 = "";
|
|
296
300
|
const encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
297
301
|
const bytes = new Uint8Array(arrayBuffer);
|
|
@@ -330,4 +334,3 @@ function uint8ArrayToBase64(arrayBuffer) {
|
|
|
330
334
|
}
|
|
331
335
|
return base64;
|
|
332
336
|
}
|
|
333
|
-
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
package/dist/core/ApiError.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiError = void 0;
|
|
4
|
-
class ApiError extends Error {
|
|
1
|
+
export class ApiError extends Error {
|
|
5
2
|
constructor(request, response, message) {
|
|
6
3
|
super(message);
|
|
7
4
|
this.name = 'ApiError';
|
|
@@ -12,4 +9,3 @@ class ApiError extends Error {
|
|
|
12
9
|
this.request = request;
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
exports.ApiError = ApiError;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/core/ApiResult.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
2
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
3
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -11,13 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
11
|
};
|
|
13
12
|
var _CancelablePromise_isResolved, _CancelablePromise_isRejected, _CancelablePromise_isCancelled, _CancelablePromise_cancelHandlers, _CancelablePromise_promise, _CancelablePromise_resolve, _CancelablePromise_reject;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CancelablePromise = exports.CancelError = void 0;
|
|
16
13
|
/* generated using openapi-typescript-codegen -- do no edit */
|
|
17
14
|
/* istanbul ignore file */
|
|
18
15
|
/* tslint:disable */
|
|
19
16
|
/* eslint-disable */
|
|
20
|
-
class CancelError extends Error {
|
|
17
|
+
export class CancelError extends Error {
|
|
21
18
|
constructor(message) {
|
|
22
19
|
super(message);
|
|
23
20
|
this.name = 'CancelError';
|
|
@@ -26,8 +23,7 @@ class CancelError extends Error {
|
|
|
26
23
|
return true;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
class CancelablePromise {
|
|
26
|
+
export class CancelablePromise {
|
|
31
27
|
constructor(executor) {
|
|
32
28
|
_CancelablePromise_isResolved.set(this, void 0);
|
|
33
29
|
_CancelablePromise_isRejected.set(this, void 0);
|
|
@@ -113,4 +109,3 @@ class CancelablePromise {
|
|
|
113
109
|
return __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f");
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
|
-
exports.CancelablePromise = CancelablePromise;
|