@uipath/vertical-solutions-tool 1.204.0 → 1.205.0-preview.258
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/README.md +80 -0
- package/dist/THIRD-PARTY-NOTICES.md +1617 -369
- package/dist/createSdk-2f9x47em.js +12 -0
- package/dist/deploy-jobs-3k87fkwz.js +23 -0
- package/dist/deploy-service-qaykt7er.js +1779 -0
- package/dist/deployment-search-arbm2z06.js +2649 -0
- package/dist/embedded-file-reader-r66242ey.js +114 -0
- package/dist/first-party-service-srxaftkn.js +27 -0
- package/dist/index-7a3eqtxv.js +3174 -0
- package/dist/index-8s9dxpj4.js +18812 -0
- package/dist/index-fyc0k5dd.js +51405 -0
- package/dist/index-h43sj8at.js +23075 -0
- package/dist/index-kmp9fmhb.js +25 -0
- package/dist/index-ngs0a2he.js +15 -0
- package/dist/index.js +14 -3
- package/dist/index.umd.min-fqefd9kn.js +7814 -0
- package/dist/job-commands-azgbrbdb.js +23 -0
- package/dist/job-output-t43hzj1f.js +36 -0
- package/dist/prompts-dtgt183n.js +260 -0
- package/dist/resume-service-mqfnnzb5.js +344 -0
- package/dist/seed-service-2d1f7zaz.js +2014 -0
- package/dist/seed-templates-sqqqratr.js +14 -0
- package/dist/service-errors-jzbq3z7p.js +22 -0
- package/dist/solution-auth-zq6gyxsv.js +11 -0
- package/dist/solution-deployments-m44fyb88.js +33 -0
- package/dist/templates-85yrztpk.js +15 -0
- package/dist/tool-342sz3hm.js +439 -0
- package/dist/tool-38ad77wd.js +1472 -0
- package/dist/tool-4z1dy1rn.js +260 -0
- package/dist/tool-53w8skv5.js +262 -0
- package/dist/tool-67587985.js +554 -0
- package/dist/tool-87e2ps7f.js +13 -0
- package/dist/tool-cag2z2d6.js +30 -0
- package/dist/tool-e4qgwf9h.js +2281 -0
- package/dist/tool-gdtpsdn7.js +342 -0
- package/dist/tool-gvmshnq9.js +555 -0
- package/dist/tool-h4f967yd.js +73 -0
- package/dist/tool-hdxtgckw.js +249 -0
- package/dist/tool-jjxbj28g.js +17067 -0
- package/dist/tool-keqjsxdx.js +28 -0
- package/dist/tool-maw0g02p.js +24 -0
- package/dist/tool-mn1wkbhw.js +113 -0
- package/dist/tool-n35nrs32.js +4949 -0
- package/dist/tool-p589v2r5.js +114 -0
- package/dist/tool-pz9qm3dv.js +6723 -0
- package/dist/tool-r1ewa0tf.js +5645 -0
- package/dist/tool-r2epw08s.js +164 -0
- package/dist/tool-rr9fensp.js +12 -0
- package/dist/tool-s04z9t80.js +19 -0
- package/dist/tool-s9qbxa2g.js +638 -0
- package/dist/tool-tjhwq0ez.js +261 -0
- package/dist/tool-v15vxc4x.js +183 -0
- package/dist/tool-vf2mgth0.js +14286 -0
- package/dist/tool-vp7rjr2q.js +22083 -0
- package/dist/tool-xd2ejt3h.js +103 -0
- package/dist/tool-yx29vb63.js +672 -0
- package/dist/tool.js +12 -2
- package/dist/watch-job-wh6m7xzq.js +31 -0
- package/package.json +3 -3
- package/dist/tool-xymb3dsq.js +0 -45085
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalText
|
|
3
|
+
} from "./tool-87e2ps7f.js";
|
|
4
|
+
import {
|
|
5
|
+
exports_external
|
|
6
|
+
} from "./tool-vf2mgth0.js";
|
|
7
|
+
import {
|
|
8
|
+
catchError
|
|
9
|
+
} from "./tool-pz9qm3dv.js";
|
|
10
|
+
|
|
11
|
+
// src/api/vss-errors.ts
|
|
12
|
+
class VssResponseError extends Error {
|
|
13
|
+
transient;
|
|
14
|
+
name = "VssResponseError";
|
|
15
|
+
constructor(message, transient = false) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.transient = transient;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class VssApiError extends Error {
|
|
22
|
+
status;
|
|
23
|
+
statusText;
|
|
24
|
+
code;
|
|
25
|
+
correlationId;
|
|
26
|
+
details;
|
|
27
|
+
name = "VssApiError";
|
|
28
|
+
response;
|
|
29
|
+
constructor(message, status, statusText, code, correlationId, details, body = "") {
|
|
30
|
+
super(message);
|
|
31
|
+
this.status = status;
|
|
32
|
+
this.statusText = statusText;
|
|
33
|
+
this.code = code;
|
|
34
|
+
this.correlationId = correlationId;
|
|
35
|
+
this.details = details;
|
|
36
|
+
this.response = {
|
|
37
|
+
status,
|
|
38
|
+
statusText,
|
|
39
|
+
text: () => Promise.resolve(body)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function isCapacityError(error) {
|
|
44
|
+
return error instanceof VssApiError && error.status === 429;
|
|
45
|
+
}
|
|
46
|
+
function isTransientError(error) {
|
|
47
|
+
if (error instanceof VssResponseError)
|
|
48
|
+
return error.transient;
|
|
49
|
+
if (error instanceof VssApiError) {
|
|
50
|
+
return error.status === 429 || error.status >= 500;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
function errorCodeOf(error) {
|
|
55
|
+
return error instanceof VssApiError ? error.code : undefined;
|
|
56
|
+
}
|
|
57
|
+
var RequiredVersionDetailsSchema = exports_external.object({ requiredVersion: exports_external.string() });
|
|
58
|
+
function requiredVersionOf(error) {
|
|
59
|
+
if (!(error instanceof VssApiError))
|
|
60
|
+
return;
|
|
61
|
+
return RequiredVersionDetailsSchema.safeParse(error.details).data?.requiredVersion;
|
|
62
|
+
}
|
|
63
|
+
var ProblemSchema = exports_external.looseObject({
|
|
64
|
+
code: optionalText,
|
|
65
|
+
message: optionalText,
|
|
66
|
+
correlationId: optionalText,
|
|
67
|
+
details: exports_external.unknown().optional()
|
|
68
|
+
});
|
|
69
|
+
function toApiError(status, statusText, body, url) {
|
|
70
|
+
const [, json] = catchError(() => JSON.parse(body));
|
|
71
|
+
const problem = ProblemSchema.safeParse(json).data;
|
|
72
|
+
return new VssApiError(problem?.message || `Request to ${url} failed: ${status} ${statusText}`, status, statusText, problem?.code, problem?.correlationId, problem?.details, body);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/api/vss-client.ts
|
|
76
|
+
var DEFAULT_TIMEOUT_MS = 30000;
|
|
77
|
+
var DOWNLOAD_TIMEOUT_MS = 300000;
|
|
78
|
+
var SEGMENT_PATTERNS = {
|
|
79
|
+
packageName: /^[A-Za-z0-9._-]+$/,
|
|
80
|
+
version: /^[0-9A-Za-z.+-]+$/,
|
|
81
|
+
id: /^[A-Za-z0-9._-]+$/
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
class VssInputError extends Error {
|
|
85
|
+
kind;
|
|
86
|
+
value;
|
|
87
|
+
constructor(kind, value) {
|
|
88
|
+
super(`Invalid ${kind} "${value}".`);
|
|
89
|
+
this.kind = kind;
|
|
90
|
+
this.value = value;
|
|
91
|
+
this.name = "VssInputError";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function isSafeSegment(kind, value) {
|
|
95
|
+
return SEGMENT_PATTERNS[kind].test(value) && !/^\.+$/.test(value);
|
|
96
|
+
}
|
|
97
|
+
function encodeSegment(kind, value) {
|
|
98
|
+
if (!isSafeSegment(kind, value)) {
|
|
99
|
+
throw new VssInputError(kind, value);
|
|
100
|
+
}
|
|
101
|
+
return encodeURIComponent(value);
|
|
102
|
+
}
|
|
103
|
+
function buildHeaders(config, extra) {
|
|
104
|
+
const headers = {
|
|
105
|
+
Authorization: `Bearer ${config.accessToken}`,
|
|
106
|
+
Accept: "application/json"
|
|
107
|
+
};
|
|
108
|
+
if (config.sendScopeIds) {
|
|
109
|
+
if (config.organizationId) {
|
|
110
|
+
headers["x-uipath-organizationid"] = config.organizationId;
|
|
111
|
+
}
|
|
112
|
+
if (config.tenantId)
|
|
113
|
+
headers["x-uipath-tenantid"] = config.tenantId;
|
|
114
|
+
}
|
|
115
|
+
return { ...headers, ...extra };
|
|
116
|
+
}
|
|
117
|
+
function scopeQuery(config) {
|
|
118
|
+
if (!config.sendScopeIds)
|
|
119
|
+
return {};
|
|
120
|
+
return {
|
|
121
|
+
organizationId: config.organizationId,
|
|
122
|
+
tenantId: config.tenantId
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function buildUrl(config, path, query) {
|
|
126
|
+
const url = new URL(`${config.basePath}/${path.replace(/^\/+/, "")}`);
|
|
127
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
128
|
+
if (value !== undefined)
|
|
129
|
+
url.searchParams.set(key, String(value));
|
|
130
|
+
}
|
|
131
|
+
return url.toString();
|
|
132
|
+
}
|
|
133
|
+
function wasTimedOut(error) {
|
|
134
|
+
return error.name === "TimeoutError";
|
|
135
|
+
}
|
|
136
|
+
async function vssRequest(config, path, options = {}) {
|
|
137
|
+
const url = buildUrl(config, path, options.query);
|
|
138
|
+
const headers = buildHeaders(config, options.body === undefined ? undefined : { "Content-Type": "application/json" });
|
|
139
|
+
const response = await fetch(url, {
|
|
140
|
+
method: options.method ?? "GET",
|
|
141
|
+
headers,
|
|
142
|
+
body: options.body === undefined ? undefined : JSON.stringify(options.body),
|
|
143
|
+
signal: combineSignals(options.signal, options.timeoutMs ?? DEFAULT_TIMEOUT_MS)
|
|
144
|
+
});
|
|
145
|
+
const [readError, text] = await catchError(response.text());
|
|
146
|
+
if (readError || text === undefined) {
|
|
147
|
+
const reason = readError?.message ?? "the body was empty";
|
|
148
|
+
const stoppedByCaller = options.signal?.aborted === true;
|
|
149
|
+
if (readError && (stoppedByCaller || response.ok && wasTimedOut(readError))) {
|
|
150
|
+
throw readError;
|
|
151
|
+
}
|
|
152
|
+
if (!response.ok) {
|
|
153
|
+
throw new VssApiError(`Request to ${url} failed: ${response.status} ` + `${response.statusText}; the body could not be read: ${reason}`, response.status, response.statusText);
|
|
154
|
+
}
|
|
155
|
+
throw new VssResponseError(`Could not read the response from ${url}: ${reason}`, true);
|
|
156
|
+
}
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
throw toApiError(response.status, response.statusText, text, url);
|
|
159
|
+
}
|
|
160
|
+
if (!text)
|
|
161
|
+
return;
|
|
162
|
+
const [parseError, parsed] = catchError(() => JSON.parse(text));
|
|
163
|
+
if (parseError) {
|
|
164
|
+
throw new VssResponseError(`Failed to parse the response from ${url}: ${parseError.message}`);
|
|
165
|
+
}
|
|
166
|
+
return parsed;
|
|
167
|
+
}
|
|
168
|
+
async function vssRequestJson(config, path, options = {}) {
|
|
169
|
+
const result = await vssRequest(config, path, options);
|
|
170
|
+
if (result === undefined) {
|
|
171
|
+
throw new VssResponseError(`The service returned an empty body for ${path}.`);
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
async function vssRequestParsed(config, path, schema, options = {}) {
|
|
176
|
+
const body = await vssRequestJson(config, path, options);
|
|
177
|
+
const parsed = schema.safeParse(body, { error: describeUnreadableField });
|
|
178
|
+
if (!parsed.success) {
|
|
179
|
+
const issue = parsed.error.issues[0]?.message ?? "with a body the CLI cannot read.";
|
|
180
|
+
throw new VssResponseError(`The service answered ${path} ${issue}`);
|
|
181
|
+
}
|
|
182
|
+
return parsed.data;
|
|
183
|
+
}
|
|
184
|
+
var describeUnreadableField = (issue) => {
|
|
185
|
+
const field = issue.path && issue.path.length > 0 ? `"${issue.path.join(".")}"` : "the body";
|
|
186
|
+
const expected = issue.code === "invalid_type" ? ` (expected ${issue.expected})` : "";
|
|
187
|
+
return `with a body the CLI cannot read: ${field} is not valid${expected}.`;
|
|
188
|
+
};
|
|
189
|
+
async function vssRequestBinary(config, path, options = {}) {
|
|
190
|
+
const url = buildUrl(config, path, options.query);
|
|
191
|
+
const response = await fetch(url, {
|
|
192
|
+
method: options.method ?? "GET",
|
|
193
|
+
headers: buildHeaders(config, { Accept: "application/zip" }),
|
|
194
|
+
signal: combineSignals(options.signal, options.timeoutMs ?? DOWNLOAD_TIMEOUT_MS)
|
|
195
|
+
});
|
|
196
|
+
if (!response.ok) {
|
|
197
|
+
const [bodyError, body] = await catchError(readBodyWithin(response, url, options.maxBytes));
|
|
198
|
+
if (bodyError && options.signal?.aborted === true)
|
|
199
|
+
throw bodyError;
|
|
200
|
+
if (bodyError && !(bodyError instanceof DownloadTooLargeError)) {
|
|
201
|
+
throw new VssApiError(`Request to ${url} failed: ${response.status} ` + `${response.statusText}; the body could not be read: ${bodyError.message}`, response.status, response.statusText);
|
|
202
|
+
}
|
|
203
|
+
throw toApiError(response.status, response.statusText, body ? new TextDecoder().decode(body) : "", url);
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
bytes: await readBodyWithin(response, url, options.maxBytes),
|
|
207
|
+
headers: response.headers
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
class DownloadTooLargeError extends Error {
|
|
212
|
+
}
|
|
213
|
+
async function readBodyWithin(response, url, maxBytes) {
|
|
214
|
+
if (maxBytes === undefined) {
|
|
215
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
216
|
+
}
|
|
217
|
+
const tooLarge = () => new DownloadTooLargeError(`The download from ${url} is larger than ${maxBytes} bytes; refusing it.`);
|
|
218
|
+
if (Number(response.headers.get("content-length") ?? 0) > maxBytes) {
|
|
219
|
+
if (response.body)
|
|
220
|
+
await catchError(response.body.cancel());
|
|
221
|
+
throw tooLarge();
|
|
222
|
+
}
|
|
223
|
+
if (!response.body) {
|
|
224
|
+
const whole = new Uint8Array(await response.arrayBuffer());
|
|
225
|
+
if (whole.length > maxBytes)
|
|
226
|
+
throw tooLarge();
|
|
227
|
+
return whole;
|
|
228
|
+
}
|
|
229
|
+
const reader = response.body.getReader();
|
|
230
|
+
const chunks = [];
|
|
231
|
+
let size = 0;
|
|
232
|
+
for (;; ) {
|
|
233
|
+
const { done, value } = await reader.read();
|
|
234
|
+
if (done)
|
|
235
|
+
break;
|
|
236
|
+
size += value.length;
|
|
237
|
+
if (size > maxBytes) {
|
|
238
|
+
await catchError(reader.cancel());
|
|
239
|
+
throw tooLarge();
|
|
240
|
+
}
|
|
241
|
+
chunks.push(value);
|
|
242
|
+
}
|
|
243
|
+
const bytes = new Uint8Array(size);
|
|
244
|
+
let offset = 0;
|
|
245
|
+
for (const chunk of chunks) {
|
|
246
|
+
bytes.set(chunk, offset);
|
|
247
|
+
offset += chunk.length;
|
|
248
|
+
}
|
|
249
|
+
return bytes;
|
|
250
|
+
}
|
|
251
|
+
function combineSignals(signal, timeoutMs) {
|
|
252
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
253
|
+
if (!signal)
|
|
254
|
+
return timeout;
|
|
255
|
+
return AbortSignal.any([signal, timeout]);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export { VssResponseError, VssApiError, isCapacityError, isTransientError, errorCodeOf, requiredVersionOf, VssInputError, isSafeSegment, encodeSegment, scopeQuery, vssRequestParsed, vssRequestBinary };
|
|
259
|
+
|
|
260
|
+
//# debugId=A01840E2A19A371364756E2164756E21
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// ../../node_modules/@uipath/resource-builder-sdk/dist/clients/generated/first-party-service.js
|
|
2
|
+
var first_party_service_DeploymentAction = /* @__PURE__ */ function(DeploymentAction) {
|
|
3
|
+
DeploymentAction["Install"] = "Install";
|
|
4
|
+
DeploymentAction["Link"] = "Link";
|
|
5
|
+
DeploymentAction["Uninstall"] = "Uninstall";
|
|
6
|
+
DeploymentAction["Unlink"] = "Unlink";
|
|
7
|
+
DeploymentAction["Merge"] = "Merge";
|
|
8
|
+
DeploymentAction["UseExisting"] = "UseExisting";
|
|
9
|
+
DeploymentAction["Activate"] = "Activate";
|
|
10
|
+
return DeploymentAction;
|
|
11
|
+
}({});
|
|
12
|
+
var first_party_service_SolutionDeploymentAction = /* @__PURE__ */ function(SolutionDeploymentAction) {
|
|
13
|
+
SolutionDeploymentAction["Install"] = "Install";
|
|
14
|
+
SolutionDeploymentAction["Uninstall"] = "Uninstall";
|
|
15
|
+
SolutionDeploymentAction["Upgrade"] = "Upgrade";
|
|
16
|
+
SolutionDeploymentAction["Rollback"] = "Rollback";
|
|
17
|
+
SolutionDeploymentAction["Activate"] = "Activate";
|
|
18
|
+
return SolutionDeploymentAction;
|
|
19
|
+
}({});
|
|
20
|
+
var first_party_service_SolutionStatus = /* @__PURE__ */ function(SolutionStatus) {
|
|
21
|
+
SolutionStatus["Installed"] = "Installed";
|
|
22
|
+
SolutionStatus["Uninstalled"] = "Uninstalled";
|
|
23
|
+
SolutionStatus["Installing"] = "Installing";
|
|
24
|
+
SolutionStatus["Uninstalling"] = "Uninstalling";
|
|
25
|
+
SolutionStatus["InstallError"] = "InstallError";
|
|
26
|
+
SolutionStatus["UninstallError"] = "UninstallError";
|
|
27
|
+
SolutionStatus["Unknown"] = "Unknown";
|
|
28
|
+
return SolutionStatus;
|
|
29
|
+
}({});
|
|
30
|
+
var first_party_service_QueryOptions = /* @__PURE__ */ function(QueryOptions) {
|
|
31
|
+
QueryOptions["Contains"] = "Contains";
|
|
32
|
+
QueryOptions["Equals"] = "Equals";
|
|
33
|
+
return QueryOptions;
|
|
34
|
+
}({});
|
|
35
|
+
var first_party_service_DeploymentResourceValidationErrorLevel = /* @__PURE__ */ function(DeploymentResourceValidationErrorLevel) {
|
|
36
|
+
DeploymentResourceValidationErrorLevel["Error"] = "Error";
|
|
37
|
+
DeploymentResourceValidationErrorLevel["Warning"] = "Warning";
|
|
38
|
+
DeploymentResourceValidationErrorLevel["Info"] = "Info";
|
|
39
|
+
return DeploymentResourceValidationErrorLevel;
|
|
40
|
+
}({});
|
|
41
|
+
var first_party_service_DeploymentResourceValidationErrorKind = /* @__PURE__ */ function(DeploymentResourceValidationErrorKind) {
|
|
42
|
+
DeploymentResourceValidationErrorKind["Conflict"] = "Conflict";
|
|
43
|
+
DeploymentResourceValidationErrorKind["ConfigurationError"] = "ConfigurationError";
|
|
44
|
+
return DeploymentResourceValidationErrorKind;
|
|
45
|
+
}({});
|
|
46
|
+
var first_party_service_DeploymentResourceValidationAction = /* @__PURE__ */ function(DeploymentResourceValidationAction) {
|
|
47
|
+
DeploymentResourceValidationAction["RenameExisting"] = "RenameExisting";
|
|
48
|
+
DeploymentResourceValidationAction["RenameInSolution"] = "RenameInSolution";
|
|
49
|
+
DeploymentResourceValidationAction["UseExisting"] = "UseExisting";
|
|
50
|
+
DeploymentResourceValidationAction["FixConfiguration"] = "FixConfiguration";
|
|
51
|
+
DeploymentResourceValidationAction["Delete"] = "Delete";
|
|
52
|
+
DeploymentResourceValidationAction["SkipDelete"] = "SkipDelete";
|
|
53
|
+
DeploymentResourceValidationAction["MergeConfiguration"] = "MergeConfiguration";
|
|
54
|
+
DeploymentResourceValidationAction["Replace"] = "Replace";
|
|
55
|
+
return DeploymentResourceValidationAction;
|
|
56
|
+
}({});
|
|
57
|
+
var first_party_service_ContentType = /* @__PURE__ */ function(ContentType) {
|
|
58
|
+
ContentType["Json"] = "application/json";
|
|
59
|
+
ContentType["JsonApi"] = "application/vnd.api+json";
|
|
60
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
61
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
62
|
+
ContentType["Text"] = "text/plain";
|
|
63
|
+
return ContentType;
|
|
64
|
+
}({});
|
|
65
|
+
|
|
66
|
+
class HttpClient {
|
|
67
|
+
encodeQueryParam(key, value) {
|
|
68
|
+
const encodedKey = encodeURIComponent(key);
|
|
69
|
+
return `${encodedKey}=${encodeURIComponent(typeof value == "number" ? value : `${value}`)}`;
|
|
70
|
+
}
|
|
71
|
+
addQueryParam(query, key) {
|
|
72
|
+
return this.encodeQueryParam(key, query[key]);
|
|
73
|
+
}
|
|
74
|
+
addArrayQueryParam(query, key) {
|
|
75
|
+
const value = query[key];
|
|
76
|
+
return value.map((v) => this.encodeQueryParam(key, v)).join("&");
|
|
77
|
+
}
|
|
78
|
+
toQueryString(rawQuery) {
|
|
79
|
+
const query = rawQuery || {};
|
|
80
|
+
const keys = Object.keys(query).filter((key) => query[key] !== undefined);
|
|
81
|
+
return keys.map((key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)).join("&");
|
|
82
|
+
}
|
|
83
|
+
addQueryParams(rawQuery) {
|
|
84
|
+
const queryString = this.toQueryString(rawQuery);
|
|
85
|
+
return queryString ? `?${queryString}` : "";
|
|
86
|
+
}
|
|
87
|
+
mergeRequestParams(params1, params2) {
|
|
88
|
+
return {
|
|
89
|
+
...this.baseApiParams,
|
|
90
|
+
...params1,
|
|
91
|
+
...params2 || {},
|
|
92
|
+
headers: {
|
|
93
|
+
...this.baseApiParams.headers || {},
|
|
94
|
+
...params1.headers || {},
|
|
95
|
+
...params2 && params2.headers || {}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
constructor(apiConfig = {}) {
|
|
100
|
+
this.baseUrl = "https://localhost:7008";
|
|
101
|
+
this.securityData = null;
|
|
102
|
+
this.abortControllers = new Map;
|
|
103
|
+
this.customFetch = (...fetchParams) => fetch(...fetchParams);
|
|
104
|
+
this.baseApiParams = {
|
|
105
|
+
credentials: "same-origin",
|
|
106
|
+
headers: {},
|
|
107
|
+
redirect: "follow",
|
|
108
|
+
referrerPolicy: "no-referrer"
|
|
109
|
+
};
|
|
110
|
+
this.setSecurityData = (data) => {
|
|
111
|
+
this.securityData = data;
|
|
112
|
+
};
|
|
113
|
+
this.contentFormatters = {
|
|
114
|
+
["application/json"]: (input) => input !== null && (typeof input == "object" || typeof input == "string") ? JSON.stringify(input) : input,
|
|
115
|
+
["application/vnd.api+json"]: (input) => input !== null && (typeof input == "object" || typeof input == "string") ? JSON.stringify(input) : input,
|
|
116
|
+
["text/plain"]: (input) => input !== null && typeof input != "string" ? JSON.stringify(input) : input,
|
|
117
|
+
["multipart/form-data"]: (input) => {
|
|
118
|
+
if (input instanceof FormData)
|
|
119
|
+
return input;
|
|
120
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
121
|
+
const property = input[key];
|
|
122
|
+
formData.append(key, property instanceof Blob ? property : typeof property == "object" && property !== null ? JSON.stringify(property) : `${property}`);
|
|
123
|
+
return formData;
|
|
124
|
+
}, new FormData);
|
|
125
|
+
},
|
|
126
|
+
["application/x-www-form-urlencoded"]: (input) => this.toQueryString(input)
|
|
127
|
+
};
|
|
128
|
+
this.createAbortSignal = (cancelToken) => {
|
|
129
|
+
if (this.abortControllers.has(cancelToken)) {
|
|
130
|
+
const abortController2 = this.abortControllers.get(cancelToken);
|
|
131
|
+
if (abortController2)
|
|
132
|
+
return abortController2.signal;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const abortController = new AbortController;
|
|
136
|
+
this.abortControllers.set(cancelToken, abortController);
|
|
137
|
+
return abortController.signal;
|
|
138
|
+
};
|
|
139
|
+
this.abortRequest = (cancelToken) => {
|
|
140
|
+
const abortController = this.abortControllers.get(cancelToken);
|
|
141
|
+
if (abortController) {
|
|
142
|
+
abortController.abort();
|
|
143
|
+
this.abortControllers.delete(cancelToken);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
this.request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => {
|
|
147
|
+
const secureParams = (typeof secure == "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
|
|
148
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
149
|
+
const queryString = query && this.toQueryString(query);
|
|
150
|
+
const payloadFormatter = this.contentFormatters[type || "application/json"];
|
|
151
|
+
const responseFormat = format || requestParams.format;
|
|
152
|
+
return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
153
|
+
...requestParams,
|
|
154
|
+
headers: {
|
|
155
|
+
...requestParams.headers || {},
|
|
156
|
+
...type && type !== "multipart/form-data" ? {
|
|
157
|
+
"Content-Type": type
|
|
158
|
+
} : {}
|
|
159
|
+
},
|
|
160
|
+
signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
|
|
161
|
+
body: body == null ? null : payloadFormatter(body)
|
|
162
|
+
}).then(async (response) => {
|
|
163
|
+
const r = response;
|
|
164
|
+
r.data = null;
|
|
165
|
+
r.error = null;
|
|
166
|
+
const responseToParse = responseFormat ? response.clone() : response;
|
|
167
|
+
const data = responseFormat ? await responseToParse[responseFormat]().then((data2) => {
|
|
168
|
+
if (r.ok)
|
|
169
|
+
r.data = data2;
|
|
170
|
+
else
|
|
171
|
+
r.error = data2;
|
|
172
|
+
return r;
|
|
173
|
+
}).catch((e) => {
|
|
174
|
+
r.error = e;
|
|
175
|
+
return r;
|
|
176
|
+
}) : r;
|
|
177
|
+
if (cancelToken)
|
|
178
|
+
this.abortControllers.delete(cancelToken);
|
|
179
|
+
if (!response.ok)
|
|
180
|
+
throw data;
|
|
181
|
+
return data.data;
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
Object.assign(this, apiConfig);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
class FirstPartyServiceApi extends HttpClient {
|
|
189
|
+
constructor(...args) {
|
|
190
|
+
super(...args), this.v2 = {
|
|
191
|
+
automationSolutionsGetMetadata: (params = {}) => this.request({
|
|
192
|
+
path: "/v2/automationsolutions/metadata",
|
|
193
|
+
method: "GET",
|
|
194
|
+
...params
|
|
195
|
+
}),
|
|
196
|
+
automationSolutionsHeadMetadata: (params = {}) => this.request({
|
|
197
|
+
path: "/v2/automationsolutions/metadata",
|
|
198
|
+
method: "HEAD",
|
|
199
|
+
...params
|
|
200
|
+
}),
|
|
201
|
+
automationSolutionsSetState: (data, query, params = {}) => this.request({
|
|
202
|
+
path: "/v2/automationsolutions",
|
|
203
|
+
method: "PATCH",
|
|
204
|
+
query,
|
|
205
|
+
body: data,
|
|
206
|
+
type: "application/json",
|
|
207
|
+
...params
|
|
208
|
+
}),
|
|
209
|
+
automationSolutionsInstall: (data, query, params = {}) => this.request({
|
|
210
|
+
path: "/v2/automationsolutions",
|
|
211
|
+
method: "PUT",
|
|
212
|
+
query,
|
|
213
|
+
body: data,
|
|
214
|
+
format: "json",
|
|
215
|
+
...params
|
|
216
|
+
}),
|
|
217
|
+
automationSolutionsUninstall: (data, query, params = {}) => this.request({
|
|
218
|
+
path: "/v2/automationsolutions",
|
|
219
|
+
method: "DELETE",
|
|
220
|
+
query,
|
|
221
|
+
body: data,
|
|
222
|
+
type: "application/json",
|
|
223
|
+
format: "json",
|
|
224
|
+
...params
|
|
225
|
+
}),
|
|
226
|
+
automationSolutionsExport: (data, params = {}) => this.request({
|
|
227
|
+
path: "/v2/automationsolutions/export",
|
|
228
|
+
method: "POST",
|
|
229
|
+
body: data,
|
|
230
|
+
type: "application/json",
|
|
231
|
+
format: "json",
|
|
232
|
+
...params
|
|
233
|
+
}),
|
|
234
|
+
automationSolutionsGetTranslations: (query, params = {}) => this.request({
|
|
235
|
+
path: "/v2/automationsolutions/translations",
|
|
236
|
+
method: "GET",
|
|
237
|
+
query,
|
|
238
|
+
format: "json",
|
|
239
|
+
...params
|
|
240
|
+
}),
|
|
241
|
+
automationSolutionsValidate: (data, query, params = {}) => this.request({
|
|
242
|
+
path: "/v2/automationsolutions/validate",
|
|
243
|
+
method: "POST",
|
|
244
|
+
query,
|
|
245
|
+
body: data,
|
|
246
|
+
type: "application/json",
|
|
247
|
+
format: "json",
|
|
248
|
+
...params
|
|
249
|
+
}),
|
|
250
|
+
automationSolutionsLookup: (query, params = {}) => this.request({
|
|
251
|
+
path: "/v2/automationsolutions/lookup",
|
|
252
|
+
method: "GET",
|
|
253
|
+
query,
|
|
254
|
+
format: "json",
|
|
255
|
+
...params
|
|
256
|
+
})
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
export { first_party_service_DeploymentAction, first_party_service_SolutionDeploymentAction, first_party_service_SolutionStatus, first_party_service_QueryOptions, first_party_service_DeploymentResourceValidationErrorLevel, first_party_service_DeploymentResourceValidationErrorKind, first_party_service_DeploymentResourceValidationAction, first_party_service_ContentType, HttpClient, FirstPartyServiceApi };
|
|
261
|
+
|
|
262
|
+
//# debugId=AC88CC622210E15664756E2164756E21
|