@uipath/solution-tool 1.204.0-preview.254 → 1.205.0-preview.256
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 +3 -3
- package/dist/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/archive-extract-x35t9ktj.js +120 -0
- package/dist/cleanup-command-service-n4e7vxnw.js +149 -0
- package/dist/deploy-delete-service-cag0q8yx.js +25 -0
- package/dist/deploy-run-service-f0h8wb9w.js +25 -0
- package/dist/{deploy-status-service-sa302ab9.js → deploy-status-service-yh6xn6e0.js} +41 -33
- package/dist/deploy.js +23 -17
- package/dist/{deployment-search-692d15j3.js → deployment-search-mnywd9nc.js} +16 -10
- package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
- package/dist/{feed-resolver-yybwzmh6.js → feed-resolver-fve33dxq.js} +10 -9
- package/dist/feed-scope-failure-jmg4t1r1.js +19 -0
- package/dist/{feed-session-sxga31vn.js → feed-session-7xqphdrg.js} +3 -3
- package/dist/governance-options-4vxz7ekn.js +32 -0
- package/dist/index-g8c8nf1c.js +667 -0
- package/dist/index-prm27bvm.js +138 -0
- package/dist/index.js +27 -29
- package/dist/init.js +11 -10
- package/dist/{list-0qrxqrfn.js → list-50mepbed.js} +10 -8
- package/dist/models/pack-command-types.d.ts +15 -0
- package/dist/node-7jm7ksqa.js +86 -0
- package/dist/pack-command-service-dewf5vsq.js +35 -0
- package/dist/pack-project-xwd1rbaa.js +97 -0
- package/dist/pack.js +24 -14
- package/dist/package-id-1wr3cy9c.js +13 -0
- package/dist/packager-tool-09swr9cp.js +171 -0
- package/dist/{packager-tool-dapys0dd.js → packager-tool-2vmsh5pt.js} +196 -1519
- package/dist/{packager-tool-px1j9kre.js → packager-tool-3bwnkjdq.js} +2 -2
- package/dist/{packager-tool-gb35b4qs.js → packager-tool-43ahv5mn.js} +192 -96
- package/dist/{packager-tool-5v92rtp2.js → packager-tool-47by487p.js} +6 -4
- package/dist/packager-tool-47wzvqw0.js +86 -0
- package/dist/{packager-tool-zns6n8zp.js → packager-tool-5ddtwzva.js} +1 -1
- package/dist/packager-tool-5edvzz80.js +543 -0
- package/dist/{packager-tool-13dsb9e6.js → packager-tool-5n6jsn41.js} +104 -14
- package/dist/packager-tool-60af1hw2.js +26 -0
- package/dist/{packager-tool-f5gq77m5.js → packager-tool-61pwb567.js} +2 -2
- package/dist/{packager-tool-yrz4mwfn.js → packager-tool-6kz1pv9f.js} +1373 -486
- package/dist/packager-tool-6ybywxxn.js +1809 -0
- package/dist/packager-tool-8ptbmmmp.js +2132 -0
- package/dist/{packager-tool-7gr2nphb.js → packager-tool-97rcgwvv.js} +224 -6
- package/dist/{packager-tool-9z1yxjme.js → packager-tool-9t26kde1.js} +3556 -1646
- package/dist/packager-tool-act5r386.js +239 -0
- package/dist/packager-tool-amhyxzz6.js +125 -0
- package/dist/packager-tool-b03rva43.js +188 -0
- package/dist/{packager-tool-e2rtr49j.js → packager-tool-b2nhscfk.js} +15 -31
- package/dist/{packager-tool-v8rseyfk.js → packager-tool-d6rrfd46.js} +149 -53
- package/dist/packager-tool-frr2xmkr.js +445 -0
- package/dist/{packager-tool-v8bkkqdb.js → packager-tool-gmwva4yv.js} +5 -5
- package/dist/packager-tool-gs3f3tf7.js +103 -0
- package/dist/packager-tool-jg692f13.js +517 -0
- package/dist/packager-tool-jmpb786m.js +109 -0
- package/dist/{packager-tool-4ytxbjez.js → packager-tool-kds8ytzw.js} +74 -23
- package/dist/packager-tool-kkfb5kgn.js +182 -0
- package/dist/packager-tool-kvcxg0zv.js +1510 -0
- package/dist/packager-tool-n3jfjn5r.js +42 -0
- package/dist/{packager-tool-8sx1w3h1.js → packager-tool-n5d5dx5j.js} +2196 -3455
- package/dist/{packager-tool-97w8aw8y.js → packager-tool-nsya65z1.js} +357 -1370
- package/dist/{packager-tool-fv7xyzg2.js → packager-tool-pbmqk39a.js} +126 -128
- package/dist/{packager-tool-bqre28m1.js → packager-tool-qw47eyw7.js} +1 -1
- package/dist/{packager-tool-erp9bv22.js → packager-tool-rc3hwn4b.js} +25 -4
- package/dist/packager-tool-resolver-994z3jkj.js +23 -0
- package/dist/{packager-tool-d9ethrmn.js → packager-tool-rvt68c1t.js} +17 -8
- package/dist/{packager-tool-gab9y5ct.js → packager-tool-t8gh825q.js} +37 -13
- package/dist/{packager-tool-kswwd3hp.js → packager-tool-tx834spe.js} +2376 -4077
- package/dist/{packager-tool-zf3929se.js → packager-tool-v1f5e8t9.js} +11 -1
- package/dist/{packager-tool-wjk91v0q.js → packager-tool-w77d72a7.js} +13 -11
- package/dist/{packager-tool-1rzssy0x.js → packager-tool-wy4fx250.js} +19 -18
- package/dist/packager-tool-wz34ma3s.js +1333 -0
- package/dist/packager-tool-zq16e1xv.js +68 -0
- package/dist/packager-tool.js +2 -2
- package/dist/prepare-solution-resources-m1djfj62.js +29 -0
- package/dist/project-command-utils-t6pmpvq3.js +90 -0
- package/dist/project-contributions-79ndycrx.js +32 -0
- package/dist/publish.js +13 -12
- package/dist/resource-mutations-c3krjqze.js +36 -0
- package/dist/resource-version-lookup-0e3e2j58.js +99 -0
- package/dist/resource.js +10 -9
- package/dist/restore-command-service-5v0b9363.js +155 -0
- package/dist/run-service-tg6b67wp.js +428 -0
- package/dist/services/deploy-activate-service.d.ts +10 -5
- package/dist/services/deploy-delete-service.d.ts +8 -4
- package/dist/services/deploy-run-service.d.ts +34 -1
- package/dist/services/deploy-uninstall-service.d.ts +21 -3
- package/dist/services/deploy-upgrade-service.d.ts +35 -1
- package/dist/services/deployment-feed-locator.d.ts +15 -4
- package/dist/services/deployment-search-client.d.ts +5 -53
- package/dist/services/deployment-search.d.ts +58 -3
- package/dist/services/deployment-state.d.ts +84 -24
- package/dist/services/deployment-validation.d.ts +5 -0
- package/dist/services/emit-runtime-dependencies.d.ts +2 -1
- package/dist/services/feed-resolver.d.ts +6 -4
- package/dist/services/feed-selection.d.ts +47 -0
- package/dist/services/http-status.d.ts +2 -7
- package/dist/services/pack-command-service.d.ts +9 -0
- package/dist/services/pack-project-selection.d.ts +51 -0
- package/dist/services/pack-project.d.ts +26 -0
- package/dist/services/pack-service.d.ts +7 -3
- package/dist/services/package-search-client.d.ts +7 -0
- package/dist/services/packager-tool-resolver.d.ts +7 -1
- package/dist/services/packages-list-service.d.ts +1 -1
- package/dist/services/permanent-deletion-consent.d.ts +110 -0
- package/dist/services/pipeline-deploy-poll.d.ts +7 -0
- package/dist/services/prepare-solution-resources.d.ts +12 -2
- package/dist/services/project-contributions.d.ts +5 -4
- package/dist/services/search-failure.d.ts +9 -13
- package/dist/services/solution-packager-helpers.d.ts +5 -2
- package/dist/services/solution-path.d.ts +1 -1
- package/dist/services/uninstall-consent.d.ts +82 -0
- package/dist/ship-telemetry-myes7ak5.js +21 -0
- package/dist/solution-auth-aead70sw.js +11 -0
- package/dist/templates/AGENTS.md +125 -12
- package/dist/tool.js +27 -29
- package/dist/utils/deployment-errors.d.ts +9 -1
- package/package.json +2 -2
- package/dist/deploy-delete-service-7fms6rrp.js +0 -22
- package/dist/feed-scope-failure-kf94beem.js +0 -18
- package/dist/packager-tool-f2e9rzxk.js +0 -104
- package/dist/packager-tool-resolver-6zwhec62.js +0 -20
- package/dist/packager-tool-zdfn32bc.js +0 -4465
- package/dist/prepare-solution-resources-jpb5as2s.js +0 -25
- package/dist/project-contributions-6wpff2hm.js +0 -30
- package/dist/services/legacy-deployment-search-v3.d.ts +0 -23
|
@@ -1,20 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveFeedSelectionAsync
|
|
3
|
+
} from "./packager-tool-zq16e1xv.js";
|
|
1
4
|
import {
|
|
2
5
|
INCOMPLETE_SWEEP_ADVICE,
|
|
3
6
|
findDeploymentAcrossFeeds,
|
|
4
7
|
reportIncompleteSweepAsync
|
|
5
|
-
} from "./packager-tool-
|
|
8
|
+
} from "./packager-tool-rc3hwn4b.js";
|
|
9
|
+
import {
|
|
10
|
+
hasServerErrorCode,
|
|
11
|
+
isBareResponse
|
|
12
|
+
} from "./packager-tool-act5r386.js";
|
|
13
|
+
import {
|
|
14
|
+
feedSelectorFlag
|
|
15
|
+
} from "./packager-tool-rvt68c1t.js";
|
|
6
16
|
import {
|
|
7
17
|
Configuration,
|
|
18
|
+
PipelinesApi
|
|
19
|
+
} from "./packager-tool-97rcgwvv.js";
|
|
20
|
+
import {
|
|
21
|
+
Configuration as Configuration2,
|
|
8
22
|
DeploymentsApi,
|
|
9
23
|
WorkflowAction
|
|
10
|
-
} from "./packager-tool-
|
|
24
|
+
} from "./packager-tool-9t26kde1.js";
|
|
25
|
+
import {
|
|
26
|
+
classifyFeedSession
|
|
27
|
+
} from "./packager-tool-qw47eyw7.js";
|
|
11
28
|
import {
|
|
12
29
|
getSolutionAuthContext
|
|
13
|
-
} from "./packager-tool-
|
|
30
|
+
} from "./packager-tool-61pwb567.js";
|
|
14
31
|
import {
|
|
15
32
|
catchError,
|
|
16
33
|
extractErrorDetails
|
|
17
|
-
} from "./packager-tool-
|
|
34
|
+
} from "./packager-tool-6ybywxxn.js";
|
|
18
35
|
|
|
19
36
|
// src/services/deploy-delete-service.ts
|
|
20
37
|
var fail = (reason, message, instructions, extras = {}) => ({
|
|
@@ -27,18 +44,18 @@ var fail = (reason, message, instructions, extras = {}) => ({
|
|
|
27
44
|
retry: extras.retry
|
|
28
45
|
});
|
|
29
46
|
var AUTH_INSTRUCTIONS = "Run 'uip login' to refresh credentials, then retry. If the deployment is in a different tenant, switch with 'uip login tenant set <tenant>'.";
|
|
30
|
-
function buildUnavailableInstructions(deployment) {
|
|
47
|
+
function buildUnavailableInstructions(deployment, feedSelector) {
|
|
31
48
|
const availableActions = deployment.actions?.length ? deployment.actions.join(", ") : "none";
|
|
32
49
|
const status = `(ActivationStatus: ${deployment.activationStatus}, OperationStatus: ${deployment.operationStatus})`;
|
|
33
50
|
if (deployment.operationStatus === "InProgress") {
|
|
34
|
-
return `Deployment '${deployment.name}' has an operation in progress ${status}. Wait for it to finish — run 'uip solution deploy list' to recheck — then retry. Available actions: ${availableActions}.`;
|
|
51
|
+
return `Deployment '${deployment.name}' has an operation in progress ${status}. Wait for it to finish — run 'uip solution deploy list${feedSelector}' to recheck — then retry. Available actions: ${availableActions}.`;
|
|
35
52
|
}
|
|
36
53
|
if (deployment.actions?.includes(WorkflowAction.Uninstall)) {
|
|
37
|
-
return `Deployment '${deployment.name}' offers Uninstall but not Delete ${status}. Run: uip solution deploy uninstall '${deployment.name}' --yes, then retry the delete. Available actions: ${availableActions}.`;
|
|
54
|
+
return `Deployment '${deployment.name}' offers Uninstall but not Delete ${status}. Run: uip solution deploy uninstall '${deployment.name}'${feedSelector} --yes, then retry the delete. Available actions: ${availableActions}.`;
|
|
38
55
|
}
|
|
39
|
-
return `Deployment '${deployment.name}' cannot be deleted in its current state ${status}. Available actions: ${availableActions}. Run 'uip solution deploy list' to recheck its state.`;
|
|
56
|
+
return `Deployment '${deployment.name}' cannot be deleted in its current state ${status}. Available actions: ${availableActions}. Run 'uip solution deploy list${feedSelector}' to recheck its state.`;
|
|
40
57
|
}
|
|
41
|
-
function requestErrorInstructions(deploymentName, errorCode, details) {
|
|
58
|
+
function requestErrorInstructions(deploymentName, errorCode, details, feedSelector) {
|
|
42
59
|
switch (errorCode) {
|
|
43
60
|
case "authentication_required":
|
|
44
61
|
return `Your session may have expired. Run 'uip login' and retry. Details: ${details}`;
|
|
@@ -51,11 +68,36 @@ function requestErrorInstructions(deploymentName, errorCode, details) {
|
|
|
51
68
|
case "server_error":
|
|
52
69
|
return `Orchestrator returned a server error. Wait and retry; if it persists, check Orchestrator status. Details: ${details}`;
|
|
53
70
|
case "not_found":
|
|
54
|
-
return `Deployment '${deploymentName}' was found by name but the delete reported it missing — it may have been removed already. Run 'uip solution deploy list' to confirm. Details: ${details}`;
|
|
71
|
+
return `Deployment '${deploymentName}' was found by name but the delete reported it missing — it may have been removed already. Run 'uip solution deploy list${feedSelector}' to confirm. Details: ${details}`;
|
|
55
72
|
default:
|
|
56
|
-
return `Delete request failed. Run 'uip solution deploy list' to check the deployment's state, then retry. Details: ${details}`;
|
|
73
|
+
return `Delete request failed. Run 'uip solution deploy list${feedSelector}' to check the deployment's state, then retry. Details: ${details}`;
|
|
57
74
|
}
|
|
58
75
|
}
|
|
76
|
+
async function sendDeleteAsync(auth, deploymentKey, scope) {
|
|
77
|
+
const pipelinesApi = new PipelinesApi(new Configuration({
|
|
78
|
+
basePath: auth.basePath,
|
|
79
|
+
accessToken: auth.accessToken
|
|
80
|
+
}));
|
|
81
|
+
const [pipelinesError] = await catchError(pipelinesApi.pipelinesDeleteDeploymentByKey({ deploymentKey }, scope));
|
|
82
|
+
if (!pipelinesError) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const detail = await extractErrorDetails(pipelinesError);
|
|
86
|
+
const status = detail.context?.httpStatus;
|
|
87
|
+
const missingRoute = status === 405 || status === 404 && isBareResponse(detail.details);
|
|
88
|
+
if (!missingRoute) {
|
|
89
|
+
return detail;
|
|
90
|
+
}
|
|
91
|
+
if (classifyFeedSession(auth) === "application") {
|
|
92
|
+
return "missing_route_for_application";
|
|
93
|
+
}
|
|
94
|
+
const deploymentsApi = new DeploymentsApi(new Configuration2({
|
|
95
|
+
basePath: auth.basePath,
|
|
96
|
+
accessToken: auth.accessToken
|
|
97
|
+
}));
|
|
98
|
+
const [solutionsError] = await catchError(deploymentsApi.deploymentsDelete({ deploymentKey }, scope));
|
|
99
|
+
return solutionsError ? extractErrorDetails(solutionsError) : undefined;
|
|
100
|
+
}
|
|
59
101
|
async function deleteDeploymentAsync(deploymentName, options = {}) {
|
|
60
102
|
const [authError, auth] = await catchError(getSolutionAuthContext({
|
|
61
103
|
tenant: options.tenant,
|
|
@@ -68,10 +110,19 @@ async function deleteDeploymentAsync(deploymentName, options = {}) {
|
|
|
68
110
|
retry: "RetryWillNotFix"
|
|
69
111
|
});
|
|
70
112
|
}
|
|
113
|
+
const selection = await resolveFeedSelectionAsync(auth, options, "Deleting a deployment");
|
|
114
|
+
if (!selection.ok) {
|
|
115
|
+
return fail(selection.reason, selection.message, selection.instructions, {
|
|
116
|
+
errorCode: selection.errorCode,
|
|
117
|
+
retry: selection.retry
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const { selectedFeed } = selection;
|
|
71
121
|
const sweep = await findDeploymentAcrossFeeds(auth, deploymentName, {
|
|
72
122
|
tenant: options.tenant,
|
|
73
123
|
loginValidity: options.loginValidity,
|
|
74
124
|
envFilePath: options.envFilePath,
|
|
125
|
+
selectedFeed,
|
|
75
126
|
includeUninstalled: true
|
|
76
127
|
});
|
|
77
128
|
const { location } = sweep;
|
|
@@ -81,25 +132,25 @@ async function deleteDeploymentAsync(deploymentName, options = {}) {
|
|
|
81
132
|
return fail("lookup_failed", report.message, `${INCOMPLETE_SWEEP_ADVICE} ${report.nextStep}${oneFeed ? ` To check one feed yourself, run ${oneFeed}.` : ""} Details: ${report.details}`, { errorCode: report.errorCode, retry: report.retry });
|
|
82
133
|
}
|
|
83
134
|
if (!location) {
|
|
84
|
-
return fail("deployment_not_found", `No deployment named '${deploymentName}' was found.`, "Run 'uip solution deploy list' to see valid deployment names.", { errorCode: "not_found", retry: "RetryWillNotFix" });
|
|
135
|
+
return fail("deployment_not_found", `No deployment named '${deploymentName}' was found.`, selectedFeed ? `Run 'uip solution deploy list${feedSelectorFlag(selectedFeed)}' to see the deployment names in the selected feed, or drop the feed flag to search every feed you can reach.` : "Run 'uip solution deploy list' to see valid deployment names.", { errorCode: "not_found", retry: "RetryWillNotFix" });
|
|
85
136
|
}
|
|
86
137
|
const { deployment, scope } = location;
|
|
87
138
|
if (deployment.actions?.length && !deployment.actions.includes(WorkflowAction.Delete)) {
|
|
88
139
|
const inProgress = deployment.operationStatus === "InProgress";
|
|
89
|
-
return fail("delete_unavailable", `Deployment '${deploymentName}' cannot be deleted in its current state.`, buildUnavailableInstructions(deployment), {
|
|
140
|
+
return fail("delete_unavailable", `Deployment '${deploymentName}' cannot be deleted in its current state.`, buildUnavailableInstructions(deployment, feedSelectorFlag(location.feed)), {
|
|
90
141
|
errorCode: "invalid_argument",
|
|
91
142
|
retry: inProgress ? "RetryLater" : "RetryWillNotFix"
|
|
92
143
|
});
|
|
93
144
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return fail("delete_request_failed", detail.message, requestErrorInstructions(deploymentName, detail.errorCode, detail.details), { errorCode: detail.errorCode, retry: detail.retry });
|
|
145
|
+
const detail = await sendDeleteAsync(auth, deployment.key, scope);
|
|
146
|
+
if (detail === "missing_route_for_application") {
|
|
147
|
+
return fail("delete_request_failed", `This server cannot delete deployment '${deploymentName}' for an external application.`, "The server has no Pipelines delete route yet, and the deprecated route it replaces accepts user sessions only. Nothing was deleted. Run the delete with a user session ('uip login'), or remove the record in the Orchestrator Solutions UI.", { errorCode: "permission_denied", retry: "RetryWillNotFix" });
|
|
148
|
+
}
|
|
149
|
+
if (detail) {
|
|
150
|
+
if (hasServerErrorCode(detail.details, "DeploymentAlreadyInProgress")) {
|
|
151
|
+
return fail("delete_request_failed", detail.message, `Deployment '${deploymentName}' is still being validated. Wait for its run to finish (run 'uip solution deploy list${feedSelectorFlag(location.feed)}' to recheck), then retry. Details: ${detail.details}`, { errorCode: "invalid_argument", retry: "RetryLater" });
|
|
152
|
+
}
|
|
153
|
+
return fail("delete_request_failed", detail.message, requestErrorInstructions(deploymentName, detail.errorCode, detail.details, feedSelectorFlag(location.feed)), { errorCode: detail.errorCode, retry: detail.retry });
|
|
103
154
|
}
|
|
104
155
|
return {
|
|
105
156
|
ok: true,
|
|
@@ -110,4 +161,4 @@ async function deleteDeploymentAsync(deploymentName, options = {}) {
|
|
|
110
161
|
|
|
111
162
|
export { deleteDeploymentAsync };
|
|
112
163
|
|
|
113
|
-
//# debugId=
|
|
164
|
+
//# debugId=6645C240B208006964756E2164756E21
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// ../executor/project-executor/src/models/run-status.ts
|
|
2
|
+
var TERMINAL_RUN_STATUSES = [
|
|
3
|
+
"Succeeded" /* Succeeded */,
|
|
4
|
+
"Faulted" /* Faulted */,
|
|
5
|
+
"Cancelled" /* Cancelled */
|
|
6
|
+
];
|
|
7
|
+
function isTerminalRunStatus(status) {
|
|
8
|
+
return TERMINAL_RUN_STATUSES.includes(status);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ../executor/project-executor/src/models/run-result.ts
|
|
12
|
+
class RunResult {
|
|
13
|
+
status;
|
|
14
|
+
errorCode;
|
|
15
|
+
rawStatus;
|
|
16
|
+
message;
|
|
17
|
+
jobKey;
|
|
18
|
+
instanceId;
|
|
19
|
+
runId;
|
|
20
|
+
traceId;
|
|
21
|
+
steps;
|
|
22
|
+
output;
|
|
23
|
+
url;
|
|
24
|
+
details;
|
|
25
|
+
constructor(status, errorCode = "None" /* None */, message) {
|
|
26
|
+
this.status = status;
|
|
27
|
+
this.errorCode = errorCode;
|
|
28
|
+
this.message = message;
|
|
29
|
+
}
|
|
30
|
+
get isSuccess() {
|
|
31
|
+
return this.status === "Succeeded" /* Succeeded */ && this.errorCode === "None" /* None */;
|
|
32
|
+
}
|
|
33
|
+
get isTerminal() {
|
|
34
|
+
return isTerminalRunStatus(this.status);
|
|
35
|
+
}
|
|
36
|
+
static succeeded(init = {}) {
|
|
37
|
+
return Object.assign(new RunResult("Succeeded" /* Succeeded */, "None" /* None */), init);
|
|
38
|
+
}
|
|
39
|
+
static failed(errorCode, message, init = {}) {
|
|
40
|
+
return Object.assign(new RunResult("Faulted" /* Faulted */, errorCode, message), init);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ../executor/project-executor/src/services/executor-logger.ts
|
|
45
|
+
var noopExecutorLogger = {
|
|
46
|
+
info: () => {},
|
|
47
|
+
warn: () => {},
|
|
48
|
+
error: () => {}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// ../executor/project-executor/src/services/executors-factory-repository.ts
|
|
52
|
+
class ExecutorsFactoryRepository {
|
|
53
|
+
factoryMap = new Map;
|
|
54
|
+
onConflict;
|
|
55
|
+
constructor(onConflict) {
|
|
56
|
+
this.onConflict = onConflict ?? ((message) => console.warn(message));
|
|
57
|
+
}
|
|
58
|
+
registerProjectExecutorFactory(factory) {
|
|
59
|
+
for (const projectType of factory.supportedTypes) {
|
|
60
|
+
const existing = this.factoryMap.get(projectType);
|
|
61
|
+
if (existing) {
|
|
62
|
+
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
63
|
+
this.onConflict(`Executor factory conflict for project type '${projectType}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
this.factoryMap.set(projectType, factory);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
canHandleProject(projectType) {
|
|
71
|
+
return this.factoryMap.has(projectType);
|
|
72
|
+
}
|
|
73
|
+
getProjectExecutorFactory(projectType) {
|
|
74
|
+
const factory = this.factoryMap.get(projectType);
|
|
75
|
+
if (!factory) {
|
|
76
|
+
throw new Error(`Cannot run project type '${projectType}': no runner is installed for it. ` + `Project types that can be run: ${this.registeredTypes.join(", ") || "none"}.`);
|
|
77
|
+
}
|
|
78
|
+
return factory;
|
|
79
|
+
}
|
|
80
|
+
get registeredTypes() {
|
|
81
|
+
return [...this.factoryMap.keys()];
|
|
82
|
+
}
|
|
83
|
+
reset() {
|
|
84
|
+
this.factoryMap.clear();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
var REGISTRY_KEY = Symbol.for("@uipath/project-executor/executorsFactoryRepository");
|
|
88
|
+
var _global = globalThis;
|
|
89
|
+
if (!_global[REGISTRY_KEY]) {
|
|
90
|
+
_global[REGISTRY_KEY] = new ExecutorsFactoryRepository;
|
|
91
|
+
}
|
|
92
|
+
var executorsFactoryRepository = _global[REGISTRY_KEY];
|
|
93
|
+
|
|
94
|
+
// ../executor/project-executor/src/services/project-runner.ts
|
|
95
|
+
class ProjectRunner {
|
|
96
|
+
fileSystem;
|
|
97
|
+
logger;
|
|
98
|
+
registry;
|
|
99
|
+
constructor(deps) {
|
|
100
|
+
this.fileSystem = deps.fileSystem;
|
|
101
|
+
this.logger = deps.logger ?? noopExecutorLogger;
|
|
102
|
+
this.registry = deps.registry ?? executorsFactoryRepository;
|
|
103
|
+
}
|
|
104
|
+
canRun(projectType) {
|
|
105
|
+
return this.registry.canHandleProject(projectType);
|
|
106
|
+
}
|
|
107
|
+
get runnableTypes() {
|
|
108
|
+
return this.registry.registeredTypes;
|
|
109
|
+
}
|
|
110
|
+
async runAsync(options, cancellationToken) {
|
|
111
|
+
const { projectType, name } = options.project;
|
|
112
|
+
if (!this.canRun(projectType)) {
|
|
113
|
+
const known = this.runnableTypes.join(", ") || "none";
|
|
114
|
+
return RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `Cannot run project '${name}' (project type '${projectType}'): ` + `no runner is installed for it. Project types that can be run: ${known}.`);
|
|
115
|
+
}
|
|
116
|
+
let executor;
|
|
117
|
+
try {
|
|
118
|
+
const factory = this.registry.getProjectExecutorFactory(projectType);
|
|
119
|
+
executor = await factory.createAsync(this.logger, this.fileSystem);
|
|
120
|
+
this.logger.info(`Running ${name} (${projectType}) on ${options.target}.`);
|
|
121
|
+
return await executor.runAsync(options, cancellationToken);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
return RunResult.failed("Unknown" /* Unknown */, messageOf(error));
|
|
124
|
+
} finally {
|
|
125
|
+
try {
|
|
126
|
+
await executor?.dispose();
|
|
127
|
+
} catch (error) {
|
|
128
|
+
this.logger.warn(`Failed to dispose the ${projectType} executor: ${messageOf(error)}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function messageOf(error) {
|
|
134
|
+
return error instanceof Error ? error.message : String(error);
|
|
135
|
+
}
|
|
136
|
+
// ../executor/project-executor/src/services/executor-tool-import.ts
|
|
137
|
+
async function importExecutorToolModule(specifier) {
|
|
138
|
+
try {
|
|
139
|
+
return { module: await import(specifier) };
|
|
140
|
+
} catch (error) {
|
|
141
|
+
return {
|
|
142
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ../executor/project-executor/src/services/executor-tool-module.ts
|
|
148
|
+
var EXECUTOR_FACTORY_EXPORT = "createExecutorFactory";
|
|
149
|
+
function isExecutorFactoryModule(module) {
|
|
150
|
+
return typeof module === "object" && module !== null && typeof module[EXECUTOR_FACTORY_EXPORT] === "function";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ../executor/project-executor/src/services/executor-factory-provider.ts
|
|
154
|
+
var PROVIDER_KEY = Symbol.for("@uipath/project-executor/executorFactoryProvider");
|
|
155
|
+
var _global2 = globalThis;
|
|
156
|
+
function registerExecutorFactoryFromModule(module, source) {
|
|
157
|
+
if (!isExecutorFactoryModule(module)) {
|
|
158
|
+
throw new Error(`${source} does not export ${EXECUTOR_FACTORY_EXPORT}().`);
|
|
159
|
+
}
|
|
160
|
+
const factory = module.createExecutorFactory();
|
|
161
|
+
executorsFactoryRepository.registerProjectExecutorFactory(factory);
|
|
162
|
+
return factory;
|
|
163
|
+
}
|
|
164
|
+
async function ensureExecutorFactory(verb, packageName) {
|
|
165
|
+
const provider = _global2[PROVIDER_KEY];
|
|
166
|
+
if (provider) {
|
|
167
|
+
await provider(verb);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (!packageName) {
|
|
171
|
+
throw new Error(`Running this project type needs the executor factory for '${verb}', and no package provides it.`);
|
|
172
|
+
}
|
|
173
|
+
const specifier = `${packageName}/executor-tool`;
|
|
174
|
+
const { module, error } = await importExecutorToolModule(specifier);
|
|
175
|
+
if (error) {
|
|
176
|
+
throw new Error(`Running this project type needs '${packageName}'. Install it.`, { cause: error });
|
|
177
|
+
}
|
|
178
|
+
registerExecutorFactoryFromModule(module, specifier);
|
|
179
|
+
}
|
|
180
|
+
export { RunResult, executorsFactoryRepository, ensureExecutorFactory, ProjectRunner };
|
|
181
|
+
|
|
182
|
+
//# debugId=C724855DC65EEE6264756E2164756E21
|