@uipath/solution-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 +3 -3
- package/dist/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/archive-extract-x35t9ktj.js +120 -0
- package/dist/cleanup-command-service-rc5e42hk.js +149 -0
- package/dist/deploy-delete-service-qdbtj3qd.js +25 -0
- package/dist/deploy-run-service-m9mg34n5.js +25 -0
- package/dist/{deploy-status-service-3req7hje.js → deploy-status-service-kz3nk43q.js} +41 -33
- package/dist/deploy.js +23 -17
- package/dist/{deployment-search-3mah6f0a.js → deployment-search-jvwyaqek.js} +16 -10
- package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
- package/dist/{feed-resolver-bxj9xkgr.js → feed-resolver-3xb7ayx4.js} +10 -9
- package/dist/feed-scope-failure-qps17dv3.js +19 -0
- package/dist/{feed-session-sxga31vn.js → feed-session-7xqphdrg.js} +3 -3
- package/dist/governance-options-amc1v319.js +32 -0
- package/dist/index-6wak6hg6.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-s5pkkefj.js → list-7jy11vb4.js} +10 -8
- package/dist/models/pack-command-types.d.ts +15 -0
- package/dist/node-p1scvsw8.js +86 -0
- package/dist/pack-command-service-8etwpgm9.js +35 -0
- package/dist/pack-project-hjvbvhgx.js +97 -0
- package/dist/pack.js +24 -14
- package/dist/package-id-c18sx4mz.js +13 -0
- package/dist/packager-tool-09fwj7e8.js +171 -0
- package/dist/{packager-tool-nfmygm61.js → packager-tool-361zx07h.js} +74 -23
- package/dist/packager-tool-37jmavap.js +42 -0
- 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-47wzvqw0.js +86 -0
- package/dist/{packager-tool-gfhdpkp3.js → packager-tool-4bq36bf5.js} +25 -4
- package/dist/packager-tool-4jekgh4s.js +517 -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-5y09xhx5.js +1333 -0
- package/dist/packager-tool-60af1hw2.js +26 -0
- package/dist/{packager-tool-f5gq77m5.js → packager-tool-61pwb567.js} +2 -2
- package/dist/{packager-tool-kdwsw2x7.js → packager-tool-69jmxeh0.js} +196 -1519
- package/dist/{packager-tool-yrz4mwfn.js → packager-tool-6kz1pv9f.js} +1373 -486
- package/dist/{packager-tool-stsnbewn.js → packager-tool-6x35kvbx.js} +17 -8
- package/dist/packager-tool-6ybywxxn.js +1809 -0
- package/dist/{packager-tool-wfkv9v8b.js → packager-tool-85pen8t9.js} +2196 -3455
- package/dist/packager-tool-8ptbmmmp.js +2132 -0
- package/dist/{packager-tool-9ex75r32.js → packager-tool-8q4tvv8d.js} +6 -4
- package/dist/packager-tool-8rg0s4w9.js +109 -0
- package/dist/{packager-tool-7gr2nphb.js → packager-tool-97rcgwvv.js} +224 -6
- package/dist/packager-tool-act5r386.js +239 -0
- package/dist/packager-tool-amhyxzz6.js +125 -0
- package/dist/{packager-tool-j3520gxw.js → packager-tool-an5bpbwe.js} +3556 -1646
- package/dist/{packager-tool-e2rtr49j.js → packager-tool-b2nhscfk.js} +15 -31
- package/dist/packager-tool-bqw7edje.js +188 -0
- package/dist/{packager-tool-4gs8y6pr.js → packager-tool-dwxswyv4.js} +149 -53
- package/dist/{packager-tool-fehvgd51.js → packager-tool-e7vczxa8.js} +357 -1370
- package/dist/{packager-tool-v8bkkqdb.js → packager-tool-gmwva4yv.js} +5 -5
- package/dist/packager-tool-gs3f3tf7.js +103 -0
- package/dist/packager-tool-kkfb5kgn.js +182 -0
- package/dist/{packager-tool-ds45xby2.js → packager-tool-m74zqwmh.js} +104 -14
- package/dist/{packager-tool-fv7xyzg2.js → packager-tool-pbmqk39a.js} +126 -128
- package/dist/packager-tool-q5j6k3fy.js +1510 -0
- package/dist/packager-tool-qk21gk5m.js +445 -0
- package/dist/{packager-tool-bqre28m1.js → packager-tool-qw47eyw7.js} +1 -1
- package/dist/packager-tool-resolver-994z3jkj.js +23 -0
- 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-g8kjzrg7.js → packager-tool-wknfv4p5.js} +13 -11
- package/dist/{packager-tool-1rzssy0x.js → packager-tool-wy4fx250.js} +19 -18
- package/dist/packager-tool-y2k2f6yg.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-eyx911f2.js +155 -0
- package/dist/run-service-p1vzzqe3.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-1zydyyhj.js +0 -22
- package/dist/feed-scope-failure-2kndwpf6.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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SOLUTION_PATH_INSTRUCTIONS,
|
|
3
|
+
applyAuthConnection,
|
|
4
|
+
checkSolutionPathAsync,
|
|
5
|
+
createSolutionPackager,
|
|
6
|
+
readSolutionFileAsUint8Array,
|
|
7
|
+
resolveSdkLogLevel
|
|
8
|
+
} from "./packager-tool-8rg0s4w9.js";
|
|
9
|
+
import {
|
|
10
|
+
ensurePackagerTools,
|
|
11
|
+
isUnpackableProjectTypeError
|
|
12
|
+
} from "./packager-tool-b2nhscfk.js";
|
|
13
|
+
import"./packager-tool-60af1hw2.js";
|
|
14
|
+
import {
|
|
15
|
+
SolutionPackOptions
|
|
16
|
+
} from "./packager-tool-5y09xhx5.js";
|
|
17
|
+
import"./packager-tool-09fwj7e8.js";
|
|
18
|
+
import"./packager-tool-bqw7edje.js";
|
|
19
|
+
import"./packager-tool-85pen8t9.js";
|
|
20
|
+
import"./packager-tool-5ddtwzva.js";
|
|
21
|
+
import {
|
|
22
|
+
ToolResult
|
|
23
|
+
} from "./packager-tool-pbmqk39a.js";
|
|
24
|
+
import"./packager-tool-43ahv5mn.js";
|
|
25
|
+
import {
|
|
26
|
+
OutputFormatter,
|
|
27
|
+
RESULTS,
|
|
28
|
+
logger
|
|
29
|
+
} from "./packager-tool-tx834spe.js";
|
|
30
|
+
import {
|
|
31
|
+
carriedInstructions,
|
|
32
|
+
catchError
|
|
33
|
+
} from "./packager-tool-6ybywxxn.js";
|
|
34
|
+
import {
|
|
35
|
+
getFileSystem
|
|
36
|
+
} from "./packager-tool-v1f5e8t9.js";
|
|
37
|
+
import"./packager-tool-dfrk01gn.js";
|
|
38
|
+
import"./packager-tool-1de529jm.js";
|
|
39
|
+
|
|
40
|
+
// src/services/restore-command-service.ts
|
|
41
|
+
class RestoreCommandService {
|
|
42
|
+
packager = null;
|
|
43
|
+
fs;
|
|
44
|
+
constructor() {
|
|
45
|
+
this.fs = getFileSystem();
|
|
46
|
+
}
|
|
47
|
+
async execute(solutionPath, options, context) {
|
|
48
|
+
const check = await checkSolutionPathAsync(this.fs, solutionPath);
|
|
49
|
+
if (!check.ok) {
|
|
50
|
+
OutputFormatter.error({
|
|
51
|
+
Result: RESULTS.Failure,
|
|
52
|
+
Message: check.message,
|
|
53
|
+
Instructions: SOLUTION_PATH_INSTRUCTIONS,
|
|
54
|
+
ErrorCode: check.errorCode
|
|
55
|
+
});
|
|
56
|
+
if (check.statError?.stack) {
|
|
57
|
+
logger.error("Stack trace:");
|
|
58
|
+
logger.error(check.statError.stack);
|
|
59
|
+
}
|
|
60
|
+
context.exit(1);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const { absoluteSolutionPath, isUisFile } = check;
|
|
64
|
+
const solutionName = isUisFile ? this.fs.path.basename(solutionPath, ".uis") : this.fs.path.basename(solutionPath);
|
|
65
|
+
logger.info(`
|
|
66
|
+
Restoring solution dependencies...
|
|
67
|
+
`);
|
|
68
|
+
logger.info("Details:");
|
|
69
|
+
logger.info(` Solution: ${absoluteSolutionPath}`);
|
|
70
|
+
logger.info("");
|
|
71
|
+
const [error, result] = await catchError(this.executeAsync(solutionPath, options));
|
|
72
|
+
if (error) {
|
|
73
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
74
|
+
OutputFormatter.error({
|
|
75
|
+
Result: RESULTS.Failure,
|
|
76
|
+
...isUnpackableProjectTypeError(error) ? { ErrorCode: "invalid_argument" } : {},
|
|
77
|
+
Message: msg,
|
|
78
|
+
Instructions: carriedInstructions(error) ?? "Check that you are logged in (`uip auth login`) and that the solution path is accessible, then rerun: uip solution restore <solution-path>"
|
|
79
|
+
});
|
|
80
|
+
if (error instanceof Error && error.stack && !isUnpackableProjectTypeError(error)) {
|
|
81
|
+
logger.error("Stack trace:");
|
|
82
|
+
logger.error(error.stack);
|
|
83
|
+
}
|
|
84
|
+
context.exit(1);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (result.errorCode !== "SUCCESS" /* Success */) {
|
|
88
|
+
OutputFormatter.error({
|
|
89
|
+
Result: RESULTS.Failure,
|
|
90
|
+
Message: `Error code: ${result.errorCode} : ${result.message}`,
|
|
91
|
+
Instructions: "Resolve the reported dependency issue, ensure you are logged in with `uip auth login`, then rerun: uip solution restore <solution-path>"
|
|
92
|
+
});
|
|
93
|
+
context.exit(1);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
OutputFormatter.success({
|
|
97
|
+
Result: RESULTS.Success,
|
|
98
|
+
Code: "SolutionRestore",
|
|
99
|
+
Data: {
|
|
100
|
+
Solution: solutionName,
|
|
101
|
+
Status: "Restored"
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async executeAsync(solutionPath, options) {
|
|
106
|
+
const check = await checkSolutionPathAsync(this.fs, solutionPath);
|
|
107
|
+
if (!check.ok) {
|
|
108
|
+
if (check.statError) {
|
|
109
|
+
throw check.statError;
|
|
110
|
+
}
|
|
111
|
+
return new ToolResult("INTERNAL_ERROR" /* InternalError */, check.message, []);
|
|
112
|
+
}
|
|
113
|
+
const { absoluteSolutionPath, isUisFile } = check;
|
|
114
|
+
const solutionName = isUisFile ? this.fs.path.basename(solutionPath, ".uis") : this.fs.path.basename(solutionPath);
|
|
115
|
+
const packager = await this.ensurePackagerAsync();
|
|
116
|
+
let inputPath;
|
|
117
|
+
if (isUisFile) {
|
|
118
|
+
const uint8Array = await readSolutionFileAsUint8Array(this.fs, absoluteSolutionPath);
|
|
119
|
+
inputPath = await packager.setupAsync(uint8Array);
|
|
120
|
+
} else {
|
|
121
|
+
inputPath = await packager.setupAsync(absoluteSolutionPath);
|
|
122
|
+
}
|
|
123
|
+
await ensurePackagerTools(inputPath, this.fs);
|
|
124
|
+
const restoreOptions = await this.createRestoreOptions(inputPath, solutionName, options);
|
|
125
|
+
return packager.restoreSolutionAsync(restoreOptions);
|
|
126
|
+
}
|
|
127
|
+
async ensurePackagerAsync() {
|
|
128
|
+
if (!this.packager) {
|
|
129
|
+
this.packager = await createSolutionPackager();
|
|
130
|
+
}
|
|
131
|
+
return this.packager;
|
|
132
|
+
}
|
|
133
|
+
async createRestoreOptions(inputPath, solutionName, options) {
|
|
134
|
+
const restoreOptions = new SolutionPackOptions;
|
|
135
|
+
restoreOptions.inputPath = inputPath;
|
|
136
|
+
restoreOptions.configuration = "Release" /* Release */;
|
|
137
|
+
restoreOptions.excludeConfiguredSources = options.excludeConfiguredSources ?? false;
|
|
138
|
+
restoreOptions.package = {
|
|
139
|
+
id: solutionName,
|
|
140
|
+
version: "1.0.0",
|
|
141
|
+
author: "",
|
|
142
|
+
description: ""
|
|
143
|
+
};
|
|
144
|
+
restoreOptions.logLevel = resolveSdkLogLevel();
|
|
145
|
+
restoreOptions.nuGetSourcesConfigPath = options.nugetSourcesConfigPath;
|
|
146
|
+
restoreOptions.feedFolder = options.feedFolder;
|
|
147
|
+
await applyAuthConnection(restoreOptions, options.loginValidity);
|
|
148
|
+
return restoreOptions;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
RestoreCommandService
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//# debugId=B15EA9113DA4F34C64756E2164756E21
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProjectRunner,
|
|
3
|
+
RunResult,
|
|
4
|
+
ensureExecutorFactory,
|
|
5
|
+
executorsFactoryRepository
|
|
6
|
+
} from "./packager-tool-kkfb5kgn.js";
|
|
7
|
+
import {
|
|
8
|
+
packSolutionAsync
|
|
9
|
+
} from "./packager-tool-37jmavap.js";
|
|
10
|
+
import"./packager-tool-4jekgh4s.js";
|
|
11
|
+
import"./packager-tool-t8gh825q.js";
|
|
12
|
+
import"./packager-tool-wy4fx250.js";
|
|
13
|
+
import"./packager-tool-47wzvqw0.js";
|
|
14
|
+
import"./packager-tool-8rg0s4w9.js";
|
|
15
|
+
import"./packager-tool-b2nhscfk.js";
|
|
16
|
+
import"./packager-tool-60af1hw2.js";
|
|
17
|
+
import"./packager-tool-5y09xhx5.js";
|
|
18
|
+
import"./packager-tool-09fwj7e8.js";
|
|
19
|
+
import"./packager-tool-bqw7edje.js";
|
|
20
|
+
import"./packager-tool-85pen8t9.js";
|
|
21
|
+
import"./packager-tool-5ddtwzva.js";
|
|
22
|
+
import"./packager-tool-gs3f3tf7.js";
|
|
23
|
+
import {
|
|
24
|
+
publishSolutionAsync
|
|
25
|
+
} from "./packager-tool-wknfv4p5.js";
|
|
26
|
+
import {
|
|
27
|
+
listSelectablePublishLocations
|
|
28
|
+
} from "./packager-tool-6x35kvbx.js";
|
|
29
|
+
import"./packager-tool-97rcgwvv.js";
|
|
30
|
+
import {
|
|
31
|
+
getProjectDebugStatus,
|
|
32
|
+
isDebugProvisioningSucceeded,
|
|
33
|
+
isDebugProvisioningTerminal
|
|
34
|
+
} from "./packager-tool-an5bpbwe.js";
|
|
35
|
+
import"./packager-tool-qw47eyw7.js";
|
|
36
|
+
import {
|
|
37
|
+
createResourceBuilderServices
|
|
38
|
+
} from "./packager-tool-6kz1pv9f.js";
|
|
39
|
+
import"./packager-tool-gdtpsdn7.js";
|
|
40
|
+
import"./packager-tool-53w8skv5.js";
|
|
41
|
+
import"./packager-tool-pbmqk39a.js";
|
|
42
|
+
import {
|
|
43
|
+
getSolutionAuthContext
|
|
44
|
+
} from "./packager-tool-61pwb567.js";
|
|
45
|
+
import"./packager-tool-8ptbmmmp.js";
|
|
46
|
+
import"./packager-tool-5edvzz80.js";
|
|
47
|
+
import {
|
|
48
|
+
getLoginStatusAsync
|
|
49
|
+
} from "./packager-tool-43ahv5mn.js";
|
|
50
|
+
import {
|
|
51
|
+
PollOutcome,
|
|
52
|
+
logger,
|
|
53
|
+
pollUntil,
|
|
54
|
+
processContext
|
|
55
|
+
} from "./packager-tool-tx834spe.js";
|
|
56
|
+
import {
|
|
57
|
+
carriedInstructions,
|
|
58
|
+
catchError
|
|
59
|
+
} from "./packager-tool-6ybywxxn.js";
|
|
60
|
+
import {
|
|
61
|
+
getFileSystem
|
|
62
|
+
} from "./packager-tool-v1f5e8t9.js";
|
|
63
|
+
import"./packager-tool-dfrk01gn.js";
|
|
64
|
+
import"./packager-tool-1de529jm.js";
|
|
65
|
+
|
|
66
|
+
// src/services/executor-tool-resolver.ts
|
|
67
|
+
var PROJECT_TYPE_TO_TOOL = new Map([
|
|
68
|
+
["Process", "rpa"],
|
|
69
|
+
["Tests", "rpa"],
|
|
70
|
+
["WebApp", "rpa"],
|
|
71
|
+
["Agent", "agent"],
|
|
72
|
+
["Api", "api-workflow"]
|
|
73
|
+
]);
|
|
74
|
+
var TOOL_TO_PACKAGE = new Map([
|
|
75
|
+
["rpa", "@uipath/rpa-tool"],
|
|
76
|
+
["agent", "@uipath/agent-tool"],
|
|
77
|
+
["api-workflow", "@uipath/api-workflow-tool"]
|
|
78
|
+
]);
|
|
79
|
+
function hasExecutorToolFor(projectType) {
|
|
80
|
+
return PROJECT_TYPE_TO_TOOL.has(projectType);
|
|
81
|
+
}
|
|
82
|
+
async function ensureExecutorTools(projectTypes) {
|
|
83
|
+
const neededTools = new Set;
|
|
84
|
+
for (const type of projectTypes) {
|
|
85
|
+
if (executorsFactoryRepository.canHandleProject(type))
|
|
86
|
+
continue;
|
|
87
|
+
const toolVerb = PROJECT_TYPE_TO_TOOL.get(type);
|
|
88
|
+
if (toolVerb) {
|
|
89
|
+
neededTools.add(toolVerb);
|
|
90
|
+
} else {
|
|
91
|
+
logger.warn(`No installable tool runs project type '${type}'. Run may fail.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const toolVerb of neededTools) {
|
|
95
|
+
logger.info(`Loading executor factory for '${toolVerb}' to run project types...`);
|
|
96
|
+
await ensureExecutorFactory(toolVerb, TOOL_TO_PACKAGE.get(toolVerb));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function projectDirOf(fs, declaredPath) {
|
|
100
|
+
const dir = fs.path.dirname(declaredPath);
|
|
101
|
+
return dir && dir !== "." ? dir : "";
|
|
102
|
+
}
|
|
103
|
+
async function readSolutionProjects(solutionDir, fs) {
|
|
104
|
+
const entries = await fs.readdir(solutionDir);
|
|
105
|
+
const uipxFile = entries.find((f) => f.endsWith(".uipx"));
|
|
106
|
+
if (!uipxFile) {
|
|
107
|
+
throw new Error(`No .uipx solution file found in '${solutionDir}'. ` + `Pass a solution directory or run 'uip solution init' first.`);
|
|
108
|
+
}
|
|
109
|
+
const content = await fs.readFile(fs.path.join(solutionDir, uipxFile));
|
|
110
|
+
if (!content) {
|
|
111
|
+
throw new Error(`Solution file '${uipxFile}' is empty.`);
|
|
112
|
+
}
|
|
113
|
+
const json = typeof content === "string" ? content : new TextDecoder().decode(content);
|
|
114
|
+
const [parseError, solution] = catchError(() => JSON.parse(json));
|
|
115
|
+
if (parseError) {
|
|
116
|
+
throw new Error(`Failed to parse ${uipxFile}: ${parseError.message}`);
|
|
117
|
+
}
|
|
118
|
+
return (solution.Projects ?? []).map((p) => {
|
|
119
|
+
const relativePath = projectDirOf(fs, p.ProjectRelativePath ?? "");
|
|
120
|
+
return {
|
|
121
|
+
name: p.Name || fs.path.basename(relativePath || solutionDir) || "",
|
|
122
|
+
projectType: p.Type ?? "",
|
|
123
|
+
relativePath
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/services/provision-debug-service.ts
|
|
129
|
+
function nextDebugVersion() {
|
|
130
|
+
return `1.0.${Math.floor(Date.now() / 1000)}`;
|
|
131
|
+
}
|
|
132
|
+
async function defaultGetSolutionBuilder(solutionDir) {
|
|
133
|
+
const services = await createResourceBuilderServices();
|
|
134
|
+
return services.getSolutionBuilder(solutionDir, true);
|
|
135
|
+
}
|
|
136
|
+
async function provisionSolutionForDebugAsync(options, deps = {}) {
|
|
137
|
+
const listLocations = deps.listLocations ?? listSelectablePublishLocations;
|
|
138
|
+
const pack = deps.pack ?? packSolutionAsync;
|
|
139
|
+
const publish = deps.publish ?? publishSolutionAsync;
|
|
140
|
+
const getBuilder = deps.getSolutionBuilder ?? defaultGetSolutionBuilder;
|
|
141
|
+
const newSessionId = deps.newSessionId ?? (() => crypto.randomUUID());
|
|
142
|
+
const authOptions = {
|
|
143
|
+
tenant: options.tenant,
|
|
144
|
+
loginValidity: options.loginValidity
|
|
145
|
+
};
|
|
146
|
+
const getDebugStatus = deps.getDebugStatus ?? (async (solutionKey2, debugSessionId) => {
|
|
147
|
+
const auth = await getSolutionAuthContext(authOptions);
|
|
148
|
+
return getProjectDebugStatus({ basePath: auth.basePath, accessToken: auth.accessToken }, solutionKey2, debugSessionId);
|
|
149
|
+
});
|
|
150
|
+
logger.info("Resolving the personal workspace to deploy into...");
|
|
151
|
+
const [locationsError, locations] = await catchError(listLocations(authOptions));
|
|
152
|
+
if (locationsError) {
|
|
153
|
+
return fail(`Could not resolve a personal workspace to deploy into: ${locationsError.message}`);
|
|
154
|
+
}
|
|
155
|
+
const personal = locations.find((l) => l.isMyPersonalWorkspace);
|
|
156
|
+
if (!personal) {
|
|
157
|
+
return fail("This account has no personal workspace, so there is nowhere to deploy the solution for a debug run. " + "Ask an administrator to enable a personal workspace, or run with --no-provision-resources — " + "the run then starts without a deployment, and cross-project calls will not resolve.");
|
|
158
|
+
}
|
|
159
|
+
const version = options.version ?? nextDebugVersion();
|
|
160
|
+
const fs = getFileSystem();
|
|
161
|
+
const outputPath = fs.path.join(fs.env.tmpdir(), "uip-solution-run", newSessionId());
|
|
162
|
+
const uploaded = await packAndUploadAsync({
|
|
163
|
+
options,
|
|
164
|
+
authOptions,
|
|
165
|
+
pack,
|
|
166
|
+
publish,
|
|
167
|
+
version,
|
|
168
|
+
outputPath
|
|
169
|
+
});
|
|
170
|
+
if (!uploaded.ok) {
|
|
171
|
+
return fail(uploaded.message);
|
|
172
|
+
}
|
|
173
|
+
const packageVersionKey = uploaded.packageVersionKey;
|
|
174
|
+
logger.info("Provisioning the solution's resources for the run...");
|
|
175
|
+
const [builderError, builder] = await catchError(getBuilder(options.solutionDir));
|
|
176
|
+
if (builderError) {
|
|
177
|
+
return fail(`Could not read the solution: ${builderError.message}`);
|
|
178
|
+
}
|
|
179
|
+
const sessionId = newSessionId();
|
|
180
|
+
const [debugError, debug] = await catchError(builder.debugProjectAsync(personal.key, options.solutionName, sessionId, packageVersionKey, true));
|
|
181
|
+
let solutionKey;
|
|
182
|
+
if (!debugError && debug.complete === false) {
|
|
183
|
+
const [, definition] = await catchError(builder.context.loadAsync());
|
|
184
|
+
solutionKey = definition?.key;
|
|
185
|
+
}
|
|
186
|
+
await builder.disposeAsync().catch(() => {});
|
|
187
|
+
if (debugError) {
|
|
188
|
+
return fail(`Provisioning the solution failed: ${debugError.message}`);
|
|
189
|
+
}
|
|
190
|
+
if (debug.complete === false) {
|
|
191
|
+
if (!solutionKey) {
|
|
192
|
+
return fail("The cloud is still provisioning the solution, but its key could not be read back from the .uipx, so the provisioning cannot be waited on. Retry the run.");
|
|
193
|
+
}
|
|
194
|
+
return waitForProvisioningAsync({
|
|
195
|
+
solutionKey,
|
|
196
|
+
sessionId,
|
|
197
|
+
packageVersionKey,
|
|
198
|
+
options,
|
|
199
|
+
getDebugStatus
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
const folderPath = debug.folderFullyQualifiedName;
|
|
203
|
+
logger.info(folderPath ? `Solution provisioned into ${folderPath}.` : "Solution provisioned.");
|
|
204
|
+
return {
|
|
205
|
+
ok: true,
|
|
206
|
+
folderPath,
|
|
207
|
+
packageVersionKey
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function fail(message) {
|
|
211
|
+
return { ok: false, message };
|
|
212
|
+
}
|
|
213
|
+
async function packAndUploadAsync(args) {
|
|
214
|
+
const { options, authOptions, version } = args;
|
|
215
|
+
logger.info("Packing the solution...");
|
|
216
|
+
const [packError, packed] = await catchError(args.pack(options.solutionDir, {
|
|
217
|
+
output: args.outputPath,
|
|
218
|
+
name: options.solutionName,
|
|
219
|
+
version,
|
|
220
|
+
loginValidity: options.loginValidity
|
|
221
|
+
}));
|
|
222
|
+
if (packError) {
|
|
223
|
+
return {
|
|
224
|
+
ok: false,
|
|
225
|
+
message: `Packing the solution failed: ${packError.message}`
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (!packed.ok) {
|
|
229
|
+
return {
|
|
230
|
+
ok: false,
|
|
231
|
+
message: `Packing the solution failed: ${packed.message}`
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const packagePath = packed.packages?.[0];
|
|
235
|
+
if (!packagePath) {
|
|
236
|
+
return {
|
|
237
|
+
ok: false,
|
|
238
|
+
message: "Packing the solution produced no package."
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
logger.info("Uploading the solution to the personal workspace...");
|
|
242
|
+
const [publishError, published] = await catchError(args.publish(packagePath, {
|
|
243
|
+
...authOptions,
|
|
244
|
+
personalWorkspace: true,
|
|
245
|
+
packageVersion: version
|
|
246
|
+
}));
|
|
247
|
+
if (publishError) {
|
|
248
|
+
return {
|
|
249
|
+
ok: false,
|
|
250
|
+
message: `Uploading the solution failed: ${publishError.message}`
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (!published.ok) {
|
|
254
|
+
return {
|
|
255
|
+
ok: false,
|
|
256
|
+
message: `Uploading the solution failed: ${published.message}`
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
if (!published.packageVersionKey) {
|
|
260
|
+
return {
|
|
261
|
+
ok: false,
|
|
262
|
+
message: "The solution was uploaded but the feed did not report a package version, so it cannot be provisioned. Retry the run."
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return { ok: true, packageVersionKey: published.packageVersionKey };
|
|
266
|
+
}
|
|
267
|
+
async function waitForProvisioningAsync(args) {
|
|
268
|
+
const { solutionKey, sessionId, packageVersionKey, options } = args;
|
|
269
|
+
const timeoutMs = options.provisioningTimeoutMs ?? 360000;
|
|
270
|
+
logger.info("Waiting for the cloud to finish provisioning...");
|
|
271
|
+
const poll = await pollUntil({
|
|
272
|
+
fn: () => args.getDebugStatus(solutionKey, sessionId),
|
|
273
|
+
until: (info2) => isDebugProvisioningTerminal(info2.status),
|
|
274
|
+
getStatus: (info2) => info2.status ?? "pending",
|
|
275
|
+
label: `solution provisioning (session ${sessionId})`,
|
|
276
|
+
logPrefix: "provision",
|
|
277
|
+
timeoutMs,
|
|
278
|
+
intervalMs: options.provisioningPollIntervalMs ?? 5000,
|
|
279
|
+
maxConsecutiveErrors: 5,
|
|
280
|
+
signal: processContext.pollSignal
|
|
281
|
+
});
|
|
282
|
+
if (poll.outcome !== PollOutcome.Completed || !poll.data) {
|
|
283
|
+
return fail(describeIncompleteWait(poll, timeoutMs));
|
|
284
|
+
}
|
|
285
|
+
const info = poll.data;
|
|
286
|
+
if (!isDebugProvisioningSucceeded(info.status)) {
|
|
287
|
+
const details = (info.errors ?? []).map((error) => error.resource ? `${error.resource.kind ?? "resource"} '${error.resource.name ?? error.resource.key ?? ""}': ${error.message}` : error.message).join(`
|
|
288
|
+
`);
|
|
289
|
+
return fail(`Provisioning the solution failed (${info.status}).` + (details ? `
|
|
290
|
+
${details}` : ""));
|
|
291
|
+
}
|
|
292
|
+
logger.info("Solution provisioned.");
|
|
293
|
+
return { ok: true, packageVersionKey };
|
|
294
|
+
}
|
|
295
|
+
function describeIncompleteWait(poll, timeoutMs) {
|
|
296
|
+
const lastStatus = poll.data?.status ?? "unknown";
|
|
297
|
+
if (poll.outcome === PollOutcome.Interrupted) {
|
|
298
|
+
return `The wait for the solution's provisioning was cancelled (last status: ${lastStatus}). ` + "The cloud may still finish it.";
|
|
299
|
+
}
|
|
300
|
+
if (poll.outcome === PollOutcome.Failed || poll.outcome === PollOutcome.Aborted) {
|
|
301
|
+
return `Checking the solution's provisioning status failed: ${poll.error?.message ?? "too many consecutive errors"} ` + `(last status: ${lastStatus}). The provisioning itself may still be running or have finished — ` + "retry the run to check.";
|
|
302
|
+
}
|
|
303
|
+
return `The solution was uploaded, but the cloud did not finish provisioning it within ${Math.round(timeoutMs / 1000)}s ` + `(last status: ${lastStatus}). ` + "Running again will not help: each run uploads a new version and provisions that one too. " + "To run a project that calls another project, deploy the solution once " + "('uip solution pack' → 'publish' → 'deploy run') and then run with " + "--no-provision-resources --folder-path <deployed folder>.";
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// src/services/run-service.ts
|
|
307
|
+
async function runSolutionAsync(options, deps, cancellationToken) {
|
|
308
|
+
const { fileSystem } = deps;
|
|
309
|
+
const solutionDir = fileSystem.path.resolve(options.solutionPath);
|
|
310
|
+
const [readError, projects] = await catchError(readSolutionProjects(solutionDir, fileSystem));
|
|
311
|
+
if (readError) {
|
|
312
|
+
return RunResult.failed("InvalidInput" /* InvalidInput */, readError.message);
|
|
313
|
+
}
|
|
314
|
+
const runnable = projects.filter((p) => hasExecutorToolFor(p.projectType));
|
|
315
|
+
if (runnable.length === 0) {
|
|
316
|
+
const seen = projects.map((p) => `${p.name} (${p.projectType})`).join(", ") || "none";
|
|
317
|
+
return RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `No project in this solution can be run. Projects: ${seen}.`);
|
|
318
|
+
}
|
|
319
|
+
const [selectionError, selected] = selectProject(runnable, options.projectName);
|
|
320
|
+
if (selectionError) {
|
|
321
|
+
return RunResult.failed("InvalidInput" /* InvalidInput */, selectionError);
|
|
322
|
+
}
|
|
323
|
+
const provision = deps.provisionForDebug ?? provisionSolutionForDebugAsync;
|
|
324
|
+
const shouldProvision = options.provisionResources ?? projects.length > 1;
|
|
325
|
+
const [executorOutcome, provisionOutcome] = await Promise.allSettled([
|
|
326
|
+
ensureExecutorTools([selected.projectType]),
|
|
327
|
+
shouldProvision ? provision({
|
|
328
|
+
solutionDir,
|
|
329
|
+
solutionName: fileSystem.path.basename(solutionDir),
|
|
330
|
+
tenant: options.tenant,
|
|
331
|
+
loginValidity: options.loginValidity
|
|
332
|
+
}) : Promise.resolve(undefined)
|
|
333
|
+
]);
|
|
334
|
+
if (executorOutcome.status === "rejected") {
|
|
335
|
+
return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not load the runner for project type '${selected.projectType}': ${describeError(executorOutcome.reason)}`);
|
|
336
|
+
}
|
|
337
|
+
if (provisionOutcome.status === "rejected") {
|
|
338
|
+
return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not deploy the solution before the run: ${describeError(provisionOutcome.reason)}`);
|
|
339
|
+
}
|
|
340
|
+
let folderPath = options.folderPath;
|
|
341
|
+
const provisioned = provisionOutcome.value;
|
|
342
|
+
if (provisioned) {
|
|
343
|
+
if (!provisioned.ok) {
|
|
344
|
+
return RunResult.failed("PrepareFailed" /* PrepareFailed */, provisioned.message ?? "Could not deploy the solution before the run.");
|
|
345
|
+
}
|
|
346
|
+
folderPath = provisioned.folderPath;
|
|
347
|
+
}
|
|
348
|
+
const projectPath = fileSystem.path.resolve(solutionDir, selected.relativePath);
|
|
349
|
+
logger.debug(`Running '${selected.name}' (${selected.projectType}) from ${projectPath}` + `${options.entryPoint ? ` with entry point ${options.entryPoint}` : " with its default entry point"}`);
|
|
350
|
+
const connection = await resolveConnection(folderPath, options, deps);
|
|
351
|
+
const runner = new ProjectRunner({
|
|
352
|
+
fileSystem,
|
|
353
|
+
logger: deps.logger
|
|
354
|
+
});
|
|
355
|
+
return runner.runAsync({
|
|
356
|
+
project: {
|
|
357
|
+
name: selected.name,
|
|
358
|
+
projectType: selected.projectType,
|
|
359
|
+
projectPath
|
|
360
|
+
},
|
|
361
|
+
entryPoint: options.entryPoint,
|
|
362
|
+
inputArguments: options.inputArguments,
|
|
363
|
+
target: "Local" /* Local */,
|
|
364
|
+
connection,
|
|
365
|
+
siblingProjects: projects.filter((p) => p !== selected).map((p) => ({
|
|
366
|
+
name: p.name,
|
|
367
|
+
projectType: p.projectType,
|
|
368
|
+
projectPath: fileSystem.path.resolve(solutionDir, p.relativePath)
|
|
369
|
+
})),
|
|
370
|
+
timeoutMs: options.timeoutMs
|
|
371
|
+
}, cancellationToken);
|
|
372
|
+
}
|
|
373
|
+
async function resolveConnection(folderPath, options, deps) {
|
|
374
|
+
const getLoginStatus = deps.getLoginStatus ?? getLoginStatusAsync;
|
|
375
|
+
const [loginError, status] = await catchError(getLoginStatus({
|
|
376
|
+
ensureTokenValidityMinutes: options.loginValidity
|
|
377
|
+
}));
|
|
378
|
+
if (loginError || status.loginStatus !== "Logged in") {
|
|
379
|
+
logger.debug(`No signed-in session for the run: ${loginError?.message ?? status.loginStatus}. ` + "A project type that needs one will say so.");
|
|
380
|
+
return {
|
|
381
|
+
folderPath,
|
|
382
|
+
baseUrl: "",
|
|
383
|
+
accessToken: "",
|
|
384
|
+
organizationId: "",
|
|
385
|
+
organizationName: ""
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
folderPath,
|
|
390
|
+
baseUrl: status.baseUrl ?? "",
|
|
391
|
+
accessToken: status.accessToken ?? "",
|
|
392
|
+
organizationId: status.organizationId ?? "",
|
|
393
|
+
organizationName: status.organizationName ?? "",
|
|
394
|
+
tenantId: status.tenantId,
|
|
395
|
+
tenantName: status.tenantName
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
function describeError(reason) {
|
|
399
|
+
const message = reason instanceof Error ? reason.message : String(reason);
|
|
400
|
+
const instructions = carriedInstructions(reason);
|
|
401
|
+
return instructions ? `${message} ${instructions}` : message;
|
|
402
|
+
}
|
|
403
|
+
function selectProject(runnable, requested) {
|
|
404
|
+
if (requested) {
|
|
405
|
+
const match = runnable.find((p) => p.name === requested);
|
|
406
|
+
if (!match) {
|
|
407
|
+
const names = runnable.map((p) => p.name).join(", ");
|
|
408
|
+
return [
|
|
409
|
+
`Project '${requested}' is not a runnable project in this solution. Runnable projects: ${names}.`,
|
|
410
|
+
runnable[0]
|
|
411
|
+
];
|
|
412
|
+
}
|
|
413
|
+
return [undefined, match];
|
|
414
|
+
}
|
|
415
|
+
if (runnable.length > 1) {
|
|
416
|
+
const names = runnable.map((p) => p.name).join(", ");
|
|
417
|
+
return [
|
|
418
|
+
`This solution has more than one runnable project, so one has to be named with --project-name. Runnable projects: ${names}.`,
|
|
419
|
+
runnable[0]
|
|
420
|
+
];
|
|
421
|
+
}
|
|
422
|
+
return [undefined, runnable[0]];
|
|
423
|
+
}
|
|
424
|
+
export {
|
|
425
|
+
runSolutionAsync
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
//# debugId=56CE2FF893D2961664756E2164756E21
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { type CliErrorCode, type RetryHint } from "@uipath/common";
|
|
2
|
+
import { type FeedSelectionFlags } from "./feed-selection";
|
|
2
3
|
export type ActivateDeploymentFailureReason = "auth_failed"
|
|
4
|
+
/** `--feed` named no feed this session can reach. */
|
|
5
|
+
| "feed_resolution_failed"
|
|
6
|
+
/** `--feed` / `--personal-workspace` with a session the server would not scope. */
|
|
7
|
+
| "feed_requires_user_session"
|
|
3
8
|
/** Activation HTTP request failed (e.g. unknown deployment name). */
|
|
4
9
|
| "request_failed"
|
|
5
10
|
/** Activation poll didn't reach a terminal state — recommended exit 2 (CI distinguishability). */
|
|
6
11
|
| "poll_timeout" | "poll_failed" | "poll_aborted"
|
|
7
12
|
/** Activation reached a terminal state but was a failure. */
|
|
8
13
|
| "activation_failed";
|
|
9
|
-
export interface ActivateDeploymentOptions {
|
|
14
|
+
export interface ActivateDeploymentOptions extends Pick<FeedSelectionFlags, "personalWorkspace" | "feed"> {
|
|
10
15
|
/**
|
|
11
16
|
* Override the active tenant for auth resolution. The CLI's deprecated
|
|
12
17
|
* `--tenant` flag flows through here; library callers usually omit it.
|
|
@@ -39,10 +44,10 @@ export interface ActivateDeploymentFailure {
|
|
|
39
44
|
exitCode: number;
|
|
40
45
|
/**
|
|
41
46
|
* Set only when the service knows better than the formatter's guess from
|
|
42
|
-
* the message
|
|
43
|
-
* not ask every feed
|
|
44
|
-
* name or feed, the request's own for any other.
|
|
45
|
-
* as before.
|
|
47
|
+
* the message: a refused feed selection, or a refusal that followed a
|
|
48
|
+
* feed sweep which could not ask every feed (the sweep's classification
|
|
49
|
+
* for a refusal about the name or feed, the request's own for any other).
|
|
50
|
+
* Absent everywhere else, as before.
|
|
46
51
|
*/
|
|
47
52
|
errorCode?: CliErrorCode;
|
|
48
53
|
retry?: RetryHint;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type CliErrorCode, type RetryHint } from "@uipath/common";
|
|
2
|
+
import { type FeedSelectionFlags } from "./feed-selection";
|
|
2
3
|
export type DeleteDeploymentFailureReason = "auth_failed"
|
|
4
|
+
/** `--feed` named no feed this session can reach. */
|
|
5
|
+
| "feed_resolution_failed"
|
|
6
|
+
/** `--feed` / `--personal-workspace` with a session the server would not scope. */
|
|
7
|
+
| "feed_requires_user_session"
|
|
3
8
|
/**
|
|
4
9
|
* No deployment with that name in the tenant feed or any feed swept after
|
|
5
10
|
* it — and every one of those feeds answered.
|
|
@@ -20,7 +25,7 @@ export type DeleteDeploymentFailureReason = "auth_failed"
|
|
|
20
25
|
| "delete_unavailable"
|
|
21
26
|
/** The DELETE request itself failed. */
|
|
22
27
|
| "delete_request_failed";
|
|
23
|
-
export interface DeleteDeploymentOptions {
|
|
28
|
+
export interface DeleteDeploymentOptions extends Pick<FeedSelectionFlags, "personalWorkspace" | "feed"> {
|
|
24
29
|
/**
|
|
25
30
|
* Override the active tenant for auth resolution. The CLI's deprecated
|
|
26
31
|
* `--tenant` flag flows through here; library callers usually omit it.
|
|
@@ -49,9 +54,8 @@ export type DeleteDeploymentResult = DeleteDeploymentSuccess | DeleteDeploymentF
|
|
|
49
54
|
/**
|
|
50
55
|
* Programmatic core of `uip solution deploy delete` (UV-16671, UV-16341).
|
|
51
56
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* and both tickets were read as a platform gap.
|
|
57
|
+
* Sends the delete through the Pipelines route, so a CI/CD pipeline logged in
|
|
58
|
+
* as an external application can run it (see {@link sendDeleteAsync}).
|
|
55
59
|
*
|
|
56
60
|
* Delete is not a second name for uninstall. `deploy uninstall` removes the
|
|
57
61
|
* provisioned resources and the solution folder of a live deployment, and
|