@uipath/solution-tool 1.203.0-preview.203 → 1.204.0-preview.206
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 +2 -2
- package/dist/THIRD-PARTY-NOTICES.md +42 -4
- package/dist/deploy-delete-service-y9dwehmn.js +22 -0
- package/dist/deploy-status-service-nmhnnjmy.js +256 -0
- package/dist/deploy.d.ts +11 -4
- package/dist/deploy.js +19 -7
- package/dist/deployment-search-eb337bjh.js +49 -0
- package/dist/{embedded-file-reader-xxqe8vs8.js → embedded-file-reader-rf2g1kfj.js} +2 -2
- package/dist/feed-resolver-dmtnswcc.js +27 -0
- package/dist/feed-scope-failure-e2yaqfg2.js +18 -0
- package/dist/feed-session-sxga31vn.js +17 -0
- package/dist/index.js +27 -18
- package/dist/init.js +10 -7
- package/dist/{list-n0xd5rgn.js → list-rbjqgz6s.js} +9 -6
- package/dist/pack.js +14 -11
- package/dist/{packager-tool-vas0xg5h.js → packager-tool-2cntqvdv.js} +5 -3
- package/dist/{packager-tool-1haahq17.js → packager-tool-3enm2h28.js} +5 -5
- package/dist/{packager-tool-2syrt51a.js → packager-tool-3fv6zc86.js} +1062 -825
- package/dist/packager-tool-3fyq6wjs.js +5889 -0
- package/dist/{packager-tool-k4mskzww.js → packager-tool-5dzjsw5q.js} +3 -3
- package/dist/{packager-tool-0f0wt9vh.js → packager-tool-5fjp60dk.js} +3071 -2794
- package/dist/{packager-tool-x6gzyxnn.js → packager-tool-752zvh64.js} +756 -359
- package/dist/{packager-tool-bkwnetqn.js → packager-tool-83rzavkx.js} +383 -88
- package/dist/{packager-tool-7znqtw3f.js → packager-tool-9vvdgbay.js} +8 -6
- package/dist/packager-tool-b8pppqbb.js +172 -0
- package/dist/packager-tool-bqre28m1.js +43 -0
- package/dist/packager-tool-dh0m3ebf.js +173 -0
- package/dist/packager-tool-f5gq77m5.js +28 -0
- package/dist/{packager-tool-nzghfa48.js → packager-tool-fv7xyzg2.js} +550 -2
- package/dist/{packager-tool-3jrq7smt.js → packager-tool-gb35b4qs.js} +206 -289
- package/dist/{packager-tool-j2cqgegq.js → packager-tool-he7ak44z.js} +16 -74
- package/dist/packager-tool-myn57mc3.js +322 -0
- package/dist/{packager-tool-4rzjjv2p.js → packager-tool-n1nzj2b9.js} +1008 -647
- package/dist/packager-tool-n6yb6zp9.js +113 -0
- package/dist/{packager-tool-h4wn0y42.js → packager-tool-qgaqqq41.js} +320 -151
- package/dist/{packager-tool-resolver-fmjr60x8.js → packager-tool-resolver-2cbxyq6k.js} +6 -5
- package/dist/{packager-tool-ge4rvy7p.js → packager-tool-t12hj6pd.js} +1022 -1342
- package/dist/{packager-tool-znakt6yw.js → packager-tool-vh4ng74p.js} +8 -6
- package/dist/packager-tool-vmsxq1pc.js +104 -0
- package/dist/packager-tool-w6jr4638.js +166 -0
- package/dist/packager-tool-zf3929se.js +237 -0
- package/dist/packager-tool-zns6n8zp.js +837 -0
- package/dist/packager-tool-zw3036b8.js +37 -0
- package/dist/packager-tool.js +2 -2
- package/dist/prepare-solution-resources-p3gzdecy.js +25 -0
- package/dist/{project-contributions-cvttys34.js → project-contributions-txe8v6sm.js} +12 -9
- package/dist/publish.js +12 -7
- package/dist/resource.js +9 -6
- package/dist/services/activation.d.ts +17 -2
- package/dist/services/deploy-activate-service.d.ts +10 -0
- package/dist/services/deploy-delete-service.d.ts +82 -0
- package/dist/services/deploy-list-service.d.ts +15 -45
- package/dist/services/deploy-run-service.d.ts +36 -23
- package/dist/services/deploy-upgrade-service.d.ts +198 -39
- package/dist/services/deployment-feed-locator.d.ts +50 -12
- package/dist/services/deployment-search-client.d.ts +55 -0
- package/dist/services/deployment-search.d.ts +87 -34
- package/dist/services/deployment-state.d.ts +119 -0
- package/dist/services/feed-resolver.d.ts +31 -0
- package/dist/services/feed-session.d.ts +70 -0
- package/dist/services/folder-helper.d.ts +4 -27
- package/dist/services/http-status.d.ts +9 -0
- package/dist/services/incomplete-feed-sweep.d.ts +77 -0
- package/dist/services/legacy-deployment-search-v3.d.ts +23 -0
- package/dist/services/packages-list-service.d.ts +5 -0
- package/dist/services/pipeline-deploy-poll.d.ts +69 -0
- package/dist/services/publish-service.d.ts +14 -16
- package/dist/services/search-failure.d.ts +27 -0
- package/dist/templates/AGENTS.md +60 -20
- package/dist/tool.js +27 -18
- package/dist/utils/deployment-errors.d.ts +57 -0
- package/package.json +2 -2
- package/dist/packager-tool-07bqr90h.js +0 -51960
- package/dist/packager-tool-jz2wbfjz.js +0 -2275
- package/dist/prepare-solution-resources-wds3r8bq.js +0 -22
- package/dist/services/personal-workspace-deploy.d.ts +0 -49
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Configuration,
|
|
3
|
-
PipelinesApi
|
|
3
|
+
PipelinesApi
|
|
4
|
+
} from "./packager-tool-qgaqqq41.js";
|
|
5
|
+
import {
|
|
4
6
|
feedScopeInitOverride,
|
|
5
7
|
resolveFeedScope
|
|
6
|
-
} from "./packager-tool-
|
|
7
|
-
import {
|
|
8
|
-
Configuration as Configuration2,
|
|
9
|
-
PackagesApi
|
|
10
|
-
} from "./packager-tool-ge4rvy7p.js";
|
|
8
|
+
} from "./packager-tool-dh0m3ebf.js";
|
|
11
9
|
import {
|
|
12
10
|
getSolutionAuthContext
|
|
13
|
-
} from "./packager-tool-
|
|
11
|
+
} from "./packager-tool-f5gq77m5.js";
|
|
14
12
|
import {
|
|
15
13
|
PollOutcome,
|
|
16
14
|
catchError,
|
|
17
15
|
extractErrorDetails,
|
|
18
|
-
getFileSystem,
|
|
19
16
|
logger,
|
|
20
17
|
mapPollFailure,
|
|
21
18
|
pollUntil
|
|
22
|
-
} from "./packager-tool-
|
|
19
|
+
} from "./packager-tool-5fjp60dk.js";
|
|
20
|
+
import {
|
|
21
|
+
getFileSystem
|
|
22
|
+
} from "./packager-tool-zf3929se.js";
|
|
23
23
|
import {
|
|
24
24
|
strFromU8,
|
|
25
25
|
strToU8,
|
|
@@ -248,15 +248,16 @@ async function publishSolutionAsync(packagePath, options = {}) {
|
|
|
248
248
|
message: scopeError.message
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
-
if (scope.kind !== "tenant") {
|
|
252
|
-
return publishToFeed(auth, fileBuffer, scope, options);
|
|
253
|
-
}
|
|
254
251
|
const configuration = new Configuration({
|
|
255
252
|
basePath: auth.basePath,
|
|
256
253
|
accessToken: auth.accessToken
|
|
257
254
|
});
|
|
258
255
|
const api = new PipelinesApi(configuration);
|
|
259
|
-
const
|
|
256
|
+
const feedScope = feedScopeInitOverride(scope);
|
|
257
|
+
const [uploadError, uploadResult] = await catchError(api.pipelinesPackageUpload({
|
|
258
|
+
body: fileBuffer,
|
|
259
|
+
locationKey: scope.folderKey
|
|
260
|
+
}));
|
|
260
261
|
if (uploadError) {
|
|
261
262
|
return mapUploadError(uploadError);
|
|
262
263
|
}
|
|
@@ -266,7 +267,7 @@ async function publishSolutionAsync(packagePath, options = {}) {
|
|
|
266
267
|
fn: () => api.pipelinesGetPackageVersion({
|
|
267
268
|
packageName: uploadResult.packageName,
|
|
268
269
|
packageVersion: uploadResult.packageVersion
|
|
269
|
-
}),
|
|
270
|
+
}, feedScope),
|
|
270
271
|
until: (result) => TERMINAL_STATES.has(result.state),
|
|
271
272
|
getStatus: (result) => result.state,
|
|
272
273
|
label: `publish ${uploadResult.packageName}:${uploadResult.packageVersion}`,
|
|
@@ -301,65 +302,6 @@ async function publishSolutionAsync(packagePath, options = {}) {
|
|
|
301
302
|
packageName: packageVersionInfo.packageName,
|
|
302
303
|
packageVersion: packageVersionInfo.packageVersion,
|
|
303
304
|
state: packageVersionInfo.state,
|
|
304
|
-
feedKind: "tenant"
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
async function publishToFeed(auth, fileBuffer, scope, options) {
|
|
308
|
-
const config = new Configuration2({
|
|
309
|
-
basePath: auth.basePath,
|
|
310
|
-
accessToken: auth.accessToken
|
|
311
|
-
});
|
|
312
|
-
const api = new PackagesApi(config);
|
|
313
|
-
const [uploadError, packageVersionKey] = await catchError(api.packagesUpload({
|
|
314
|
-
body: fileBuffer,
|
|
315
|
-
locationKey: scope.folderKey
|
|
316
|
-
}));
|
|
317
|
-
if (uploadError) {
|
|
318
|
-
return mapUploadError(uploadError);
|
|
319
|
-
}
|
|
320
|
-
const feedScope = feedScopeInitOverride(scope);
|
|
321
|
-
const [getError, initialInfo] = await catchError(api.packagesGetVersion({ packageVersionKey }, feedScope));
|
|
322
|
-
if (getError) {
|
|
323
|
-
logger.warn(`Package uploaded (key ${packageVersionKey}) but its metadata was not yet retrievable; PackageName/PackageVersion/State will be absent from output: ${getError.message}`);
|
|
324
|
-
}
|
|
325
|
-
let packageVersionInfo = getError ? undefined : initialInfo;
|
|
326
|
-
if (options.wait) {
|
|
327
|
-
const pollResult = await pollUntil({
|
|
328
|
-
fn: () => api.packagesGetVersion({ packageVersionKey }, feedScope),
|
|
329
|
-
until: (result) => TERMINAL_STATES.has(result.state),
|
|
330
|
-
getStatus: (result) => result.state,
|
|
331
|
-
label: `publish ${packageVersionInfo ? `${packageVersionInfo.packageName}:${packageVersionInfo.packageVersion}` : packageVersionKey}`,
|
|
332
|
-
logPrefix: "publish",
|
|
333
|
-
timeoutMs: (options.timeout ?? 360) * 1000,
|
|
334
|
-
intervalMs: options.pollInterval ?? 5000,
|
|
335
|
-
signal: options.signal
|
|
336
|
-
});
|
|
337
|
-
if (pollResult.outcome !== PollOutcome.Completed) {
|
|
338
|
-
const { reason, message } = mapPollFailure(pollResult, "Package publish");
|
|
339
|
-
return { ok: false, reason, message };
|
|
340
|
-
}
|
|
341
|
-
if (!pollResult.data) {
|
|
342
|
-
return {
|
|
343
|
-
ok: false,
|
|
344
|
-
reason: "poll_failed",
|
|
345
|
-
message: "Package publish did not return a final state."
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
packageVersionInfo = pollResult.data;
|
|
349
|
-
if (packageVersionInfo.state === "Failed") {
|
|
350
|
-
return {
|
|
351
|
-
ok: false,
|
|
352
|
-
reason: "publish_failed",
|
|
353
|
-
message: `Package publish failed with state: ${packageVersionInfo.state}`
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
ok: true,
|
|
359
|
-
packageVersionKey: packageVersionInfo?.key ?? packageVersionKey,
|
|
360
|
-
packageName: packageVersionInfo?.packageName,
|
|
361
|
-
packageVersion: packageVersionInfo?.packageVersion,
|
|
362
|
-
state: packageVersionInfo?.state,
|
|
363
305
|
feedKind: scope.kind
|
|
364
306
|
};
|
|
365
307
|
}
|
|
@@ -392,4 +334,4 @@ async function mapUploadError(uploadError) {
|
|
|
392
334
|
|
|
393
335
|
export { publishSolutionAsync };
|
|
394
336
|
|
|
395
|
-
//# debugId=
|
|
337
|
+
//# debugId=1A9ADF95167C0E9D64756E2164756E21
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Configuration as Configuration2,
|
|
3
|
+
PipelinesApi
|
|
4
|
+
} from "./packager-tool-qgaqqq41.js";
|
|
5
|
+
import {
|
|
6
|
+
Configuration,
|
|
7
|
+
DeploymentSearchItemDto2FromJSON,
|
|
8
|
+
SearchApi
|
|
9
|
+
} from "./packager-tool-t12hj6pd.js";
|
|
10
|
+
import {
|
|
11
|
+
classifyFeedSession
|
|
12
|
+
} from "./packager-tool-bqre28m1.js";
|
|
13
|
+
import {
|
|
14
|
+
catchError,
|
|
15
|
+
logger
|
|
16
|
+
} from "./packager-tool-5fjp60dk.js";
|
|
17
|
+
|
|
18
|
+
// src/services/http-status.ts
|
|
19
|
+
function httpStatusOf(error) {
|
|
20
|
+
if (!error || typeof error !== "object") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const response = error.response;
|
|
24
|
+
const fromResponse = response && typeof response === "object" ? response.status : undefined;
|
|
25
|
+
const status = typeof fromResponse === "number" ? fromResponse : error.status;
|
|
26
|
+
return typeof status === "number" ? status : undefined;
|
|
27
|
+
}
|
|
28
|
+
function isAuthRefusal(error) {
|
|
29
|
+
const status = httpStatusOf(error);
|
|
30
|
+
return status === 401 || status === 403;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/services/legacy-deployment-search-v3.ts
|
|
34
|
+
async function searchDeploymentsLegacyV3(auth, query, scope) {
|
|
35
|
+
const api = new SearchApi(new Configuration({
|
|
36
|
+
basePath: auth.basePath,
|
|
37
|
+
accessToken: auth.accessToken
|
|
38
|
+
}));
|
|
39
|
+
const result = await api.searchSearchDeployments22({ deploymentsSearchRequest2: toLegacyV3Request(query) }, scope);
|
|
40
|
+
const values = result.values ?? [];
|
|
41
|
+
return { count: result.count, values };
|
|
42
|
+
}
|
|
43
|
+
function toLegacyV3Request(query) {
|
|
44
|
+
return {
|
|
45
|
+
searchTerm: query.searchTerm ?? query.deploymentName ?? query.packageName,
|
|
46
|
+
packageName: query.packageName,
|
|
47
|
+
...query.targetFolderName ? { targetFolderName: query.targetFolderName } : {},
|
|
48
|
+
take: query.take,
|
|
49
|
+
skip: query.skip,
|
|
50
|
+
orderByColumn: query.orderByColumn,
|
|
51
|
+
orderByDirection: query.orderByDirection,
|
|
52
|
+
operationStatuses: query.operationStatuses ?? [],
|
|
53
|
+
activationStatuses: query.activationStatuses ?? []
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/services/deployment-search-client.ts
|
|
58
|
+
var PIPELINES_SEARCH_ROUTE = "POST /v1/pipelines/deployments/search";
|
|
59
|
+
|
|
60
|
+
class DeploymentSearchNeedsUserSessionError extends Error {
|
|
61
|
+
constructor() {
|
|
62
|
+
super("This server's deployment search reads user sessions only; an application (client-credentials) login cannot read it. Sign in with 'uip login' to use it.");
|
|
63
|
+
this.name = "DeploymentSearchNeedsUserSessionError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var serversWithoutPipelinesSearch = new Set;
|
|
67
|
+
async function isMissingPipelinesSearchRoute(error) {
|
|
68
|
+
const status = httpStatusOf(error);
|
|
69
|
+
if (status === 405) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (status !== 404) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const response = error.response;
|
|
76
|
+
const [, body] = await catchError(response ? response.clone().text() : Promise.resolve(""));
|
|
77
|
+
return (body ?? "").trim() === "";
|
|
78
|
+
}
|
|
79
|
+
async function searchDeploymentsPage(auth, query, scope) {
|
|
80
|
+
if (!serversWithoutPipelinesSearch.has(auth.basePath)) {
|
|
81
|
+
const [error, page2] = await catchError(searchViaPipelines(auth, query, scope));
|
|
82
|
+
if (!error) {
|
|
83
|
+
return { ...page2, source: "pipelines" };
|
|
84
|
+
}
|
|
85
|
+
if (!await isMissingPipelinesSearchRoute(error)) {
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
serversWithoutPipelinesSearch.add(auth.basePath);
|
|
89
|
+
logger.debug(`${PIPELINES_SEARCH_ROUTE} is not served at ${auth.basePath}; using the deprecated POST /api/v3/search/deployments.`);
|
|
90
|
+
}
|
|
91
|
+
if (classifyFeedSession(auth) === "application") {
|
|
92
|
+
throw new DeploymentSearchNeedsUserSessionError;
|
|
93
|
+
}
|
|
94
|
+
const page = await searchDeploymentsLegacyV3(auth, query, scope);
|
|
95
|
+
return { ...page, source: "legacy-v3" };
|
|
96
|
+
}
|
|
97
|
+
async function searchViaPipelines(auth, query, scope) {
|
|
98
|
+
const api = new PipelinesApi(new Configuration2({
|
|
99
|
+
basePath: auth.basePath,
|
|
100
|
+
accessToken: auth.accessToken
|
|
101
|
+
}));
|
|
102
|
+
const response = await api.pipelinesSearchDeploymentsRaw({
|
|
103
|
+
pipelineDeploymentsSearchRequest: {
|
|
104
|
+
take: query.take,
|
|
105
|
+
skip: query.skip,
|
|
106
|
+
deploymentName: query.deploymentName,
|
|
107
|
+
packageName: query.packageName,
|
|
108
|
+
targetFolderName: query.targetFolderName,
|
|
109
|
+
searchTerm: query.searchTerm,
|
|
110
|
+
orderByColumn: query.orderByColumn,
|
|
111
|
+
orderByDirection: query.orderByDirection,
|
|
112
|
+
operationStatuses: query.operationStatuses,
|
|
113
|
+
activationStatuses: query.activationStatuses
|
|
114
|
+
}
|
|
115
|
+
}, scope);
|
|
116
|
+
const body = await response.raw.json();
|
|
117
|
+
const values = (body.values ?? []).map((row) => DeploymentSearchItemDto2FromJSON(row));
|
|
118
|
+
return { count: body.count, values };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// src/services/deployment-search.ts
|
|
122
|
+
async function findDeploymentByName(auth, deploymentName, scope) {
|
|
123
|
+
return newestDeploymentRow(await findDeploymentsByName(auth, deploymentName, scope));
|
|
124
|
+
}
|
|
125
|
+
async function findLiveDeploymentByName(auth, deploymentName, scope) {
|
|
126
|
+
const newest = await findDeploymentByName(auth, deploymentName, scope);
|
|
127
|
+
return isCompletedUninstall(newest) ? undefined : newest;
|
|
128
|
+
}
|
|
129
|
+
function isCompletedUninstall(row) {
|
|
130
|
+
return row?.operation === "Uninstall" && row.operationStatus === "Successful";
|
|
131
|
+
}
|
|
132
|
+
async function findDeploymentsByPackageName(auth, packageName, options = {}) {
|
|
133
|
+
const take = 50;
|
|
134
|
+
const maxPages = 20;
|
|
135
|
+
const matches = [];
|
|
136
|
+
for (let page = 0, skip = 0;page < maxPages; page++) {
|
|
137
|
+
const result = await searchDeploymentsPage(auth, { packageName, take, skip }, options.scope);
|
|
138
|
+
const values = result.values ?? [];
|
|
139
|
+
for (const deployment of values) {
|
|
140
|
+
if (deployment.packageName === packageName && (options.folderPath === undefined || deployment.folderPath === options.folderPath)) {
|
|
141
|
+
matches.push(deployment);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (values.length < take) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
skip += values.length;
|
|
148
|
+
}
|
|
149
|
+
return matches;
|
|
150
|
+
}
|
|
151
|
+
async function findCurrentDeploymentAsync(auth, deployment, scope) {
|
|
152
|
+
const installKey = deployment.installDeploymentKey ?? deployment.key;
|
|
153
|
+
const rows = await findDeploymentsByPackageName(auth, deployment.packageName, { scope });
|
|
154
|
+
return rows.find((row) => (row.installDeploymentKey ?? row.key) === installKey);
|
|
155
|
+
}
|
|
156
|
+
function blocksRedeploy(deployment) {
|
|
157
|
+
if (deployment.operationStatus === "InProgress") {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
if (deployment.operationStatus === "Successful") {
|
|
161
|
+
return deployment.operation !== "Uninstall";
|
|
162
|
+
}
|
|
163
|
+
if (deployment.operationStatus === "Draft" || deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
|
|
164
|
+
return deployment.operation !== undefined && deployment.operation !== null && deployment.operation !== "Install";
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
var MAX_LISTED_DEPLOYMENTS = 5;
|
|
169
|
+
function formatExistingDeployments(deployments, folderByKey) {
|
|
170
|
+
const described = deployments.slice(0, MAX_LISTED_DEPLOYMENTS).map((deployment) => {
|
|
171
|
+
const resolved = deployment.installedRootFolderKey ? folderByKey?.get(deployment.installedRootFolderKey) : undefined;
|
|
172
|
+
const folder = resolved ?? deployment.folderPath ?? "an unknown folder";
|
|
173
|
+
const current = deployment.currentPackageVersion ?? deployment.packageVersion ?? "an unknown version";
|
|
174
|
+
const target = deployment.targetPackageVersion ?? deployment.newPackageVersionAvailable;
|
|
175
|
+
const version = target && target !== current ? `${current} → ${target}` : current;
|
|
176
|
+
const state = [
|
|
177
|
+
deployment.operation,
|
|
178
|
+
deployment.operationStatus,
|
|
179
|
+
deployment.activationStatus
|
|
180
|
+
].filter((part) => part !== undefined && part !== null).join("/");
|
|
181
|
+
return `'${deployment.name}' in ${folder} (version ${version}${state ? `, ${state}` : ""})`;
|
|
182
|
+
}).join("; ");
|
|
183
|
+
const remaining = deployments.length - MAX_LISTED_DEPLOYMENTS;
|
|
184
|
+
return remaining > 0 ? `${described}; and ${remaining} more (see: uip solution deploy list)` : described;
|
|
185
|
+
}
|
|
186
|
+
async function findDeploymentsByName(auth, deploymentName, scope) {
|
|
187
|
+
const matches = [];
|
|
188
|
+
const take = 50;
|
|
189
|
+
for (let skip = 0;; ) {
|
|
190
|
+
const result = await searchDeploymentsPage(auth, { deploymentName, take, skip }, scope);
|
|
191
|
+
const values = result.values ?? [];
|
|
192
|
+
matches.push(...values.filter((deployment) => deployment.name === deploymentName));
|
|
193
|
+
skip += values.length;
|
|
194
|
+
const total = result.count;
|
|
195
|
+
if (values.length < take || typeof total === "number" && skip >= total || skip >= MAX_SEARCH_ROWS) {
|
|
196
|
+
return matches;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
var MAX_SEARCH_ROWS = 5000;
|
|
201
|
+
async function findDeploymentBestEffort(auth, deploymentName, scope, prefer = {}) {
|
|
202
|
+
const [lookupError, rows] = await catchError(findDeploymentsByName(auth, deploymentName, scope));
|
|
203
|
+
if (lookupError || !rows) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (prefer.deploymentKey) {
|
|
207
|
+
return rows.find((row) => row.key === prefer.deploymentKey && row.operation !== "Uninstall");
|
|
208
|
+
}
|
|
209
|
+
const candidates = rows.filter((row) => row.operation !== "Uninstall");
|
|
210
|
+
return candidates.sort((a, b) => creationMillis(b) - creationMillis(a))[0];
|
|
211
|
+
}
|
|
212
|
+
function newestDeploymentRow(rows) {
|
|
213
|
+
return [...rows].sort((a, b) => creationMillis(b) - creationMillis(a))[0];
|
|
214
|
+
}
|
|
215
|
+
function creationMillis(row) {
|
|
216
|
+
const millis = row.deploymentCreationTime ? new Date(row.deploymentCreationTime).getTime() : Number.NaN;
|
|
217
|
+
return Number.isFinite(millis) ? millis : 0;
|
|
218
|
+
}
|
|
219
|
+
async function isPipelineDeploymentNotFoundError(error) {
|
|
220
|
+
if (!error || typeof error !== "object") {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const response = error.response;
|
|
224
|
+
if (!response || typeof response !== "object") {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
const status = response.status;
|
|
228
|
+
if (status !== 404) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
const [bodyError, body] = await catchError(response.clone().text());
|
|
232
|
+
if (bodyError || !body) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
return body.includes("PipelineDeploymentNotFound");
|
|
236
|
+
}
|
|
237
|
+
function interpretFailedDeployPoll(deployment) {
|
|
238
|
+
if (!deployment) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
|
|
242
|
+
return {
|
|
243
|
+
kind: "DeployFailed",
|
|
244
|
+
operationStatus: deployment.operationStatus
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (deployment.operationStatus !== "Successful") {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
switch (deployment.activationStatus) {
|
|
251
|
+
case "Active":
|
|
252
|
+
return { kind: "Active", instanceId: deployment.instanceId };
|
|
253
|
+
case "NeedsSetupToActivate":
|
|
254
|
+
return { kind: "NeedsSetupToActivate" };
|
|
255
|
+
case "ReadyToActivate":
|
|
256
|
+
case "Inactive":
|
|
257
|
+
return { kind: "ReadyToActivate" };
|
|
258
|
+
case "ActivationFailed":
|
|
259
|
+
return { kind: "ActivationFailed" };
|
|
260
|
+
default:
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function mapOperationStatusToPipelineStatus(operationStatus) {
|
|
265
|
+
switch (operationStatus) {
|
|
266
|
+
case "Successful":
|
|
267
|
+
return "DeploymentSucceeded";
|
|
268
|
+
case "Failed":
|
|
269
|
+
case "FailedRollback":
|
|
270
|
+
case "Draft":
|
|
271
|
+
return "DeploymentFailed";
|
|
272
|
+
default:
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function deploymentToTerminalPipelineResult(deployment) {
|
|
277
|
+
const status = mapOperationStatusToPipelineStatus(deployment.operationStatus);
|
|
278
|
+
if (!status) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
status,
|
|
283
|
+
validationResult: { validationErrors: [], conflictErrors: [] },
|
|
284
|
+
deploymentKey: deployment.key,
|
|
285
|
+
configurationKey: deployment.configurationKey,
|
|
286
|
+
instanceId: deployment.instanceId,
|
|
287
|
+
conflictFixingErrors: [],
|
|
288
|
+
deploymentScheduleErrors: []
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
async function resolveInstalledFolder(deployment, requested, resolveFolderByKey) {
|
|
292
|
+
const fallback = {
|
|
293
|
+
folderName: requested.folderName,
|
|
294
|
+
folderPath: requested.folderPath,
|
|
295
|
+
requestedMatched: true
|
|
296
|
+
};
|
|
297
|
+
const pathFor = (name, path) => path ?? (requested.parentFolderPath ? `${requested.parentFolderPath}/${name}` : name);
|
|
298
|
+
const folderKey = deployment?.installedRootFolderKey;
|
|
299
|
+
if (folderKey && resolveFolderByKey) {
|
|
300
|
+
const [lookupError, folder] = await catchError(resolveFolderByKey(folderKey));
|
|
301
|
+
if (!lookupError && folder?.name) {
|
|
302
|
+
return {
|
|
303
|
+
folderName: folder.name,
|
|
304
|
+
folderPath: pathFor(folder.name, folder.path ?? deployment?.folderPath ?? undefined),
|
|
305
|
+
requestedMatched: folder.name === requested.folderName
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const resolvedName = deployment?.installedRootFolderName;
|
|
310
|
+
if (resolvedName) {
|
|
311
|
+
return {
|
|
312
|
+
folderName: resolvedName,
|
|
313
|
+
folderPath: pathFor(resolvedName, deployment?.folderPath ?? undefined),
|
|
314
|
+
requestedMatched: resolvedName === requested.folderName
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
return fallback;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export { httpStatusOf, isAuthRefusal, DeploymentSearchNeedsUserSessionError, searchDeploymentsPage, findDeploymentByName, findLiveDeploymentByName, isCompletedUninstall, findDeploymentsByPackageName, findCurrentDeploymentAsync, blocksRedeploy, MAX_LISTED_DEPLOYMENTS, formatExistingDeployments, findDeploymentsByName, findDeploymentBestEffort, newestDeploymentRow, isPipelineDeploymentNotFoundError, interpretFailedDeployPoll, mapOperationStatusToPipelineStatus, deploymentToTerminalPipelineResult, resolveInstalledFolder };
|
|
321
|
+
|
|
322
|
+
//# debugId=982982E1F13E2BA464756E2164756E21
|