@uipath/solution-tool 1.201.0-preview.115 → 1.201.0-preview.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy.js +6 -4
- package/dist/index.js +12 -9
- package/dist/init.d.ts +6 -8
- package/dist/init.js +5 -4
- package/dist/list-kbscmb2k.js +378 -0
- package/dist/pack.js +5 -4
- package/dist/{packager-tool-9x8dbxbn.js → packager-tool-112c30jx.js} +177 -110
- package/dist/{packager-tool-arbagkf2.js → packager-tool-550smwcc.js} +423 -1652
- package/dist/{packager-tool-85x8cje1.js → packager-tool-67ssxgph.js} +1 -1
- package/dist/{packager-tool-c84z58bt.js → packager-tool-95fz7yd0.js} +10 -6
- package/dist/{packager-tool-r9n45rjm.js → packager-tool-bcpknnr8.js} +2526 -6655
- package/dist/packager-tool-fzwxq48d.js +4225 -0
- package/dist/{packager-tool-ngh4qwjv.js → packager-tool-krd5v2r5.js} +6 -4
- package/dist/{packager-tool-y35nbbkm.js → packager-tool-nkgvv7yh.js} +13 -8
- package/dist/{packager-tool-n49qbf8m.js → packager-tool-v33bpncw.js} +80 -16
- package/dist/packager-tool-va301fjh.js +1477 -0
- package/dist/packager-tool-yktm4v4r.js +67 -0
- package/dist/publish.js +6 -4
- package/dist/resource.d.ts +2 -3
- package/dist/resource.js +4 -3
- package/dist/services/deployment-search.d.ts +1 -1
- package/dist/tool.js +12 -9
- package/package.json +2 -2
package/dist/deploy.js
CHANGED
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
listDeploymentsAsync,
|
|
5
5
|
listPackagesAsync,
|
|
6
6
|
uninstallDeploymentAsync
|
|
7
|
-
} from "./packager-tool-
|
|
8
|
-
import"./packager-tool-
|
|
9
|
-
import"./packager-tool-
|
|
7
|
+
} from "./packager-tool-v33bpncw.js";
|
|
8
|
+
import"./packager-tool-va301fjh.js";
|
|
9
|
+
import"./packager-tool-550smwcc.js";
|
|
10
|
+
import"./packager-tool-fzwxq48d.js";
|
|
11
|
+
import"./packager-tool-bcpknnr8.js";
|
|
10
12
|
import"./packager-tool-9qecd4wb.js";
|
|
11
13
|
import"./packager-tool-7eva0peq.js";
|
|
12
14
|
import"./packager-tool-5arsyj36.js";
|
|
@@ -20,4 +22,4 @@ export {
|
|
|
20
22
|
activateDeploymentAsync
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
//# debugId=
|
|
25
|
+
//# debugId=EAA9EAD5F016F5DF64756E2164756E21
|
package/dist/index.js
CHANGED
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
import {
|
|
3
3
|
metadata,
|
|
4
4
|
registerCommands
|
|
5
|
-
} from "./packager-tool-
|
|
6
|
-
import"./packager-tool-
|
|
7
|
-
import"./packager-tool-
|
|
8
|
-
import"./packager-tool-
|
|
5
|
+
} from "./packager-tool-112c30jx.js";
|
|
6
|
+
import"./packager-tool-yktm4v4r.js";
|
|
7
|
+
import"./packager-tool-v33bpncw.js";
|
|
8
|
+
import"./packager-tool-67ssxgph.js";
|
|
9
|
+
import"./packager-tool-nkgvv7yh.js";
|
|
9
10
|
import"./packager-tool-9vehmnke.js";
|
|
10
|
-
import"./packager-tool-
|
|
11
|
-
import"./packager-tool-
|
|
12
|
-
import"./packager-tool-
|
|
11
|
+
import"./packager-tool-95fz7yd0.js";
|
|
12
|
+
import"./packager-tool-va301fjh.js";
|
|
13
|
+
import"./packager-tool-550smwcc.js";
|
|
14
|
+
import"./packager-tool-krd5v2r5.js";
|
|
13
15
|
import"./packager-tool-vpr77gre.js";
|
|
16
|
+
import"./packager-tool-fzwxq48d.js";
|
|
14
17
|
import {
|
|
15
18
|
Command
|
|
16
|
-
} from "./packager-tool-
|
|
19
|
+
} from "./packager-tool-bcpknnr8.js";
|
|
17
20
|
import"./packager-tool-9qecd4wb.js";
|
|
18
21
|
import"./packager-tool-7eva0peq.js";
|
|
19
22
|
import"./packager-tool-5arsyj36.js";
|
|
@@ -26,4 +29,4 @@ program.name(metadata.commandPrefix).description(metadata.description).version(m
|
|
|
26
29
|
await registerCommands(program);
|
|
27
30
|
program.parse(process.argv);
|
|
28
31
|
|
|
29
|
-
//# debugId=
|
|
32
|
+
//# debugId=61F6B7D4CF8C0EE964756E2164756E21
|
package/dist/init.d.ts
CHANGED
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Public `@uipath/solution-tool/init` entry: the programmatic init service for SDK
|
|
3
3
|
* consumers, without the CLI side effects of `tool.ts`. Mirrors `@uipath/flow-tool/validation`.
|
|
4
4
|
*
|
|
5
|
-
* Also re-exports `addProjectArtifactsToSolutionAsync
|
|
6
|
-
* (flow, maestro, agent, case, codedapp) can generate the
|
|
5
|
+
* Also re-exports `addProjectArtifactsToSolutionAsync`, which generates the
|
|
7
6
|
* `resources/solution_folder/process/<kind>/` artifact-resource entries that
|
|
8
|
-
* `uip solution project add` produces. Without
|
|
7
|
+
* `uip solution project add` produces. Without that step, init succeeds but
|
|
9
8
|
* `solution pack` would later miss the artifact resources, forcing a
|
|
10
|
-
* `solution project remove` + `add` recovery cycle.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* exports breaks them with no compile error.
|
|
9
|
+
* `solution project remove` + `add` recovery cycle. In-repo `*-tool init` paths
|
|
10
|
+
* (flow, maestro, agent, case, codedapp) import it straight from
|
|
11
|
+
* `@uipath/solution-sdk/resources`; the re-export is here for consumers that
|
|
12
|
+
* only have solution-tool.
|
|
15
13
|
*/
|
|
16
14
|
export type { AddProjectArtifactsOptions, ProjectArtifactsResult, } from "@uipath/solution-sdk/resources";
|
|
17
15
|
export { addProjectArtifactsToSolutionAsync } from "@uipath/solution-sdk/resources";
|
package/dist/init.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SolutionInitError,
|
|
3
3
|
solutionInitAsync
|
|
4
|
-
} from "./packager-tool-
|
|
4
|
+
} from "./packager-tool-67ssxgph.js";
|
|
5
5
|
import {
|
|
6
6
|
addProjectArtifactsToSolutionAsync
|
|
7
|
-
} from "./packager-tool-
|
|
7
|
+
} from "./packager-tool-krd5v2r5.js";
|
|
8
8
|
import"./packager-tool-vpr77gre.js";
|
|
9
|
-
import"./packager-tool-
|
|
9
|
+
import"./packager-tool-fzwxq48d.js";
|
|
10
|
+
import"./packager-tool-bcpknnr8.js";
|
|
10
11
|
import"./packager-tool-9qecd4wb.js";
|
|
11
12
|
import"./packager-tool-7eva0peq.js";
|
|
12
13
|
import"./packager-tool-5arsyj36.js";
|
|
@@ -18,4 +19,4 @@ export {
|
|
|
18
19
|
SolutionInitError
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
//# debugId=
|
|
22
|
+
//# debugId=6DBB85193F4F221A64756E2164756E21
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getStudioWebAuth,
|
|
3
|
+
useStudioWebAuth
|
|
4
|
+
} from "./packager-tool-yktm4v4r.js";
|
|
5
|
+
import {
|
|
6
|
+
getStudioWebSolutionProjects,
|
|
7
|
+
listStudioWebSolutions
|
|
8
|
+
} from "./packager-tool-550smwcc.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_PAGE_SIZE,
|
|
11
|
+
OutputFormatter,
|
|
12
|
+
Pagination,
|
|
13
|
+
RESULTS,
|
|
14
|
+
catchError,
|
|
15
|
+
parseBoundedInt,
|
|
16
|
+
parseOffset,
|
|
17
|
+
processContext
|
|
18
|
+
} from "./packager-tool-bcpknnr8.js";
|
|
19
|
+
import"./packager-tool-9qecd4wb.js";
|
|
20
|
+
import {
|
|
21
|
+
getFileSystem
|
|
22
|
+
} from "./packager-tool-7eva0peq.js";
|
|
23
|
+
import"./packager-tool-5arsyj36.js";
|
|
24
|
+
import"./packager-tool-129wn232.js";
|
|
25
|
+
import"./packager-tool-0v6na3yp.js";
|
|
26
|
+
|
|
27
|
+
// src/services/solution-list-service.ts
|
|
28
|
+
var fail = (message, instructions) => ({
|
|
29
|
+
ok: false,
|
|
30
|
+
message,
|
|
31
|
+
instructions
|
|
32
|
+
});
|
|
33
|
+
function toStudioWebConfig(auth) {
|
|
34
|
+
return {
|
|
35
|
+
baseUrl: auth.baseUrl,
|
|
36
|
+
authToken: auth.accessToken,
|
|
37
|
+
tenantId: auth.tenantId
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var SERVER_PAGE_LIMIT = 100;
|
|
41
|
+
async function listCloudSolutionsAsync(options) {
|
|
42
|
+
const limit = options.limit ?? DEFAULT_PAGE_SIZE;
|
|
43
|
+
const offset = options.offset ?? 0;
|
|
44
|
+
const organizationName = options.auth.organizationName;
|
|
45
|
+
if (!organizationName) {
|
|
46
|
+
return fail("Organization name is not available. Re-authenticate with 'uip login'.", "Run 'uip login' to refresh the login context and try again.");
|
|
47
|
+
}
|
|
48
|
+
const config = toStudioWebConfig(options.auth);
|
|
49
|
+
const collected = [];
|
|
50
|
+
let skip = 0;
|
|
51
|
+
let exhausted = false;
|
|
52
|
+
while (!exhausted && collected.length < offset + limit) {
|
|
53
|
+
const [listError, page] = await catchError(listStudioWebSolutions(config, organizationName, {
|
|
54
|
+
limit: SERVER_PAGE_LIMIT,
|
|
55
|
+
skip,
|
|
56
|
+
name: options.name,
|
|
57
|
+
sortBy: options.sortBy,
|
|
58
|
+
sortOrder: options.sortOrder === undefined ? undefined : options.sortOrder === "Ascending" ? "asc" : "desc"
|
|
59
|
+
}));
|
|
60
|
+
if (listError) {
|
|
61
|
+
return fail(listError.message, "Verify your login (uip login) and tenant access, then retry.");
|
|
62
|
+
}
|
|
63
|
+
collected.push(...page.solutions);
|
|
64
|
+
skip += page.combinedCount;
|
|
65
|
+
exhausted = page.combinedCount < SERVER_PAGE_LIMIT || page.totalCount !== undefined && skip >= page.totalCount;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
ok: true,
|
|
69
|
+
solutions: collected.slice(offset, offset + limit),
|
|
70
|
+
limit,
|
|
71
|
+
offset,
|
|
72
|
+
total: exhausted ? collected.length : undefined
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var SKIPPED_DIRECTORIES = new Set(["node_modules"]);
|
|
76
|
+
var MAX_SCAN_DEPTH = 16;
|
|
77
|
+
async function scanLocalSolutionsAsync(fs, rootDir) {
|
|
78
|
+
const root = fs.path.resolve(rootDir);
|
|
79
|
+
const [statError, rootStat] = await catchError(fs.stat(root));
|
|
80
|
+
if (statError) {
|
|
81
|
+
return fail(`Cannot access ${root}: ${statError.message}`, "Check the path and its permissions, then try again.");
|
|
82
|
+
}
|
|
83
|
+
if (!rootStat?.isDirectory()) {
|
|
84
|
+
return fail(`Not a directory: ${root}`, "Pass an existing directory to --local (default: current directory).");
|
|
85
|
+
}
|
|
86
|
+
const rows = [];
|
|
87
|
+
const skipped = [];
|
|
88
|
+
await scanDirectory(fs, root, root, 0, rows, skipped);
|
|
89
|
+
rows.sort((a, b) => a.Path === b.Path ? a.UipxFile.localeCompare(b.UipxFile) : a.Path.localeCompare(b.Path));
|
|
90
|
+
return { ok: true, rows, skipped };
|
|
91
|
+
}
|
|
92
|
+
async function scanDirectory(fs, root, dir, depth, rows, skipped) {
|
|
93
|
+
const relativeDir = fs.path.relative(root, dir) || ".";
|
|
94
|
+
if (depth > MAX_SCAN_DEPTH) {
|
|
95
|
+
skipped.push(`Skipped ${relativeDir}: deeper than ${MAX_SCAN_DEPTH} levels.`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const [readError, entries] = await catchError(fs.readdir(dir));
|
|
99
|
+
if (readError) {
|
|
100
|
+
skipped.push(`Skipped ${relativeDir}: ${readError.message}.`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const manifests = entries.filter((entry) => entry.endsWith(".uipx"));
|
|
104
|
+
for (const manifest of manifests) {
|
|
105
|
+
rows.push(await buildLocalRow(fs, root, dir, manifest, manifests.length));
|
|
106
|
+
}
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
if (entry.startsWith(".") || SKIPPED_DIRECTORIES.has(entry)) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const entryPath = fs.path.join(dir, entry);
|
|
112
|
+
const [statError, stat] = await catchError(fs.stat(entryPath));
|
|
113
|
+
if (statError || !stat?.isDirectory()) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
await scanDirectory(fs, root, entryPath, depth + 1, rows, skipped);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function buildLocalRow(fs, root, dir, manifest, manifestCountInDir) {
|
|
120
|
+
const name = manifest.slice(0, -".uipx".length);
|
|
121
|
+
const relativeDir = fs.path.relative(root, dir);
|
|
122
|
+
const warnings = [];
|
|
123
|
+
if (manifestCountInDir > 1) {
|
|
124
|
+
warnings.push(`Directory contains ${manifestCountInDir} .uipx manifests; commands like 'uip solution pack' pick one arbitrarily — remove the stale ones.`);
|
|
125
|
+
}
|
|
126
|
+
const dirName = fs.path.basename(dir);
|
|
127
|
+
if (name !== dirName) {
|
|
128
|
+
warnings.push(`Manifest filename '${manifest}' does not match its directory name '${dirName}'.`);
|
|
129
|
+
}
|
|
130
|
+
const row = {
|
|
131
|
+
Path: relativeDir === "" ? "." : relativeDir,
|
|
132
|
+
Name: name,
|
|
133
|
+
UipxFile: manifest,
|
|
134
|
+
Warnings: warnings
|
|
135
|
+
};
|
|
136
|
+
const manifestPath = fs.path.join(dir, manifest);
|
|
137
|
+
const [readError, content] = await catchError(fs.readFile(manifestPath, "utf-8"));
|
|
138
|
+
if (readError || !content) {
|
|
139
|
+
warnings.push(`Could not read ${manifest}: ${readError?.message ?? "file is empty"}.`);
|
|
140
|
+
return row;
|
|
141
|
+
}
|
|
142
|
+
const [parseError, parsed] = catchError(() => JSON.parse(content));
|
|
143
|
+
if (parseError || typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
144
|
+
warnings.push(`Could not parse ${manifest}: not a valid JSON object.`);
|
|
145
|
+
return row;
|
|
146
|
+
}
|
|
147
|
+
const record = parsed;
|
|
148
|
+
if (typeof record.SolutionId === "string" && record.SolutionId.trim()) {
|
|
149
|
+
row.SolutionId = record.SolutionId;
|
|
150
|
+
} else {
|
|
151
|
+
warnings.push(`${manifest} has no SolutionId.`);
|
|
152
|
+
}
|
|
153
|
+
if (Array.isArray(record.Projects)) {
|
|
154
|
+
row.ProjectCount = record.Projects.length;
|
|
155
|
+
} else {
|
|
156
|
+
warnings.push(`${manifest} has no Projects array.`);
|
|
157
|
+
}
|
|
158
|
+
return row;
|
|
159
|
+
}
|
|
160
|
+
var CLOUD_PROBE_CONCURRENCY = 8;
|
|
161
|
+
async function annotateCloudStatusAsync(rows, auth) {
|
|
162
|
+
const organizationName = auth.organizationName;
|
|
163
|
+
if (!organizationName) {
|
|
164
|
+
return fail("Organization name is not available. Re-authenticate with 'uip login'.", "Run 'uip login' to refresh the login context and try again.");
|
|
165
|
+
}
|
|
166
|
+
const config = toStudioWebConfig(auth);
|
|
167
|
+
const queue = [...rows];
|
|
168
|
+
const workers = Array.from({ length: Math.min(CLOUD_PROBE_CONCURRENCY, queue.length) }, async () => {
|
|
169
|
+
for (let row = queue.shift();row; row = queue.shift()) {
|
|
170
|
+
await probeCloudStatusAsync(row, config, organizationName);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
await Promise.all(workers);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
async function probeCloudStatusAsync(row, config, organizationName) {
|
|
177
|
+
if (!row.SolutionId) {
|
|
178
|
+
row.CloudStatus = "Unknown";
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const [probeError, projects] = await catchError(getStudioWebSolutionProjects(config, organizationName, row.SolutionId));
|
|
182
|
+
if (probeError) {
|
|
183
|
+
row.CloudStatus = "Unknown";
|
|
184
|
+
row.Warnings.push(`Cloud check failed: ${probeError.message}`);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (projects === undefined) {
|
|
188
|
+
row.CloudStatus = "NotFound";
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
row.CloudStatus = "OK";
|
|
192
|
+
row.CloudProjectCount = projects.length;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// src/commands/list.ts
|
|
196
|
+
var SOLUTION_LIST_EXAMPLES = [
|
|
197
|
+
{
|
|
198
|
+
Description: "List the Studio Web solutions you own or that are shared with you (IDs pipe into 'solution download' and 'solution delete')",
|
|
199
|
+
Command: "uip solution list --limit 2",
|
|
200
|
+
Output: {
|
|
201
|
+
Code: "SolutionsList",
|
|
202
|
+
Data: [
|
|
203
|
+
{
|
|
204
|
+
Id: "a1b2c3d4-0000-0000-0000-000000000001",
|
|
205
|
+
Name: "Examples",
|
|
206
|
+
LastModifiedTime: "2025-04-15T10:30:00Z",
|
|
207
|
+
PublishStatus: "draft",
|
|
208
|
+
Projects: []
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
Description: "List the local solutions under a directory tree by scanning for .uipx manifests",
|
|
215
|
+
Command: "uip solution list --local ./workspace",
|
|
216
|
+
Output: {
|
|
217
|
+
Code: "LocalSolutionsList",
|
|
218
|
+
Data: [
|
|
219
|
+
{
|
|
220
|
+
Path: "Examples",
|
|
221
|
+
Name: "Examples",
|
|
222
|
+
UipxFile: "Examples.uipx",
|
|
223
|
+
SolutionId: "a1b2c3d4-0000-0000-0000-000000000001",
|
|
224
|
+
ProjectCount: 2,
|
|
225
|
+
Warnings: []
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
Description: "Scan local solutions and check whether each SolutionId still exists on Studio Web",
|
|
232
|
+
Command: "uip solution list --local ./workspace --check-cloud",
|
|
233
|
+
Output: {
|
|
234
|
+
Code: "LocalSolutionsList",
|
|
235
|
+
Data: [
|
|
236
|
+
{
|
|
237
|
+
Path: "SolutionA",
|
|
238
|
+
Name: "SolutionA",
|
|
239
|
+
UipxFile: "SolutionA.uipx",
|
|
240
|
+
SolutionId: "0dbafff0-0000-0000-0000-000000000368",
|
|
241
|
+
ProjectCount: 1,
|
|
242
|
+
Warnings: [],
|
|
243
|
+
CloudStatus: "NotFound"
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
var CLOUD_ONLY_OPTIONS = [
|
|
250
|
+
"limit",
|
|
251
|
+
"offset",
|
|
252
|
+
"name",
|
|
253
|
+
"sortBy",
|
|
254
|
+
"sortOrder"
|
|
255
|
+
];
|
|
256
|
+
var STUDIO_WEB_SOLUTIONS_PAGE_LIMIT = 100;
|
|
257
|
+
function parseStudioWebSolutionsLimit(raw) {
|
|
258
|
+
return parseBoundedInt(raw, "--limit", {
|
|
259
|
+
min: 1,
|
|
260
|
+
max: STUDIO_WEB_SOLUTIONS_PAGE_LIMIT
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
var registerListCommand = (program) => {
|
|
264
|
+
const command = program.previewCommand("list").description("List solutions. By default lists the Studio Web solutions you own or that are shared with you — the SolutionIds it returns are the ones 'solution download' and 'solution delete' take. With --local, scans a directory tree for local solutions (.uipx manifests) and flags stale or ambiguous manifests. Add --check-cloud to also resolve each local SolutionId against Studio Web and report whether it can still be reached (OK / NotFound).").option("-l, --limit <number>", "Maximum solutions to return, between 1 and 100 (cloud mode)", parseStudioWebSolutionsLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of solutions to skip (cloud mode)", parseOffset, 0).option("--name <pattern>", "Filter solutions by name (cloud mode; server-side keyword match)").option("--sort-by <column>", "Column to sort by (cloud mode; server default order when omitted)").option("--sort-order <direction>", "Sort direction: Ascending or Descending (cloud mode)").option("--local [directory]", "List local solutions by scanning this directory tree (default: current directory) instead of Studio Web").option("--check-cloud", "With --local: check each local SolutionId against Studio Web and report OK / NotFound. Implies --local.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).examples(SOLUTION_LIST_EXAMPLES);
|
|
265
|
+
useStudioWebAuth(command, {
|
|
266
|
+
requireOrganizationName: true,
|
|
267
|
+
shouldResolve: (_thisCommand, actionCommand) => needsStudioWebAuth(actionCommand.opts())
|
|
268
|
+
}).trackedAction(processContext, async (options, actionCommand) => {
|
|
269
|
+
const localMode = options.local !== undefined || options.checkCloud === true;
|
|
270
|
+
if (localMode) {
|
|
271
|
+
const misused = CLOUD_ONLY_OPTIONS.filter((key) => actionCommand.getOptionValueSource(key) === "cli");
|
|
272
|
+
if (misused.length > 0) {
|
|
273
|
+
outputError(`The ${misused.map(optionFlag).join(", ")} option only applies to the cloud listing.`, "Drop the option, or remove --local/--check-cloud to list Studio Web solutions.");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
await runLocalList(options, actionCommand);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
await runCloudList(options, actionCommand);
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
function needsStudioWebAuth(options) {
|
|
283
|
+
return options.local === undefined || options.checkCloud === true;
|
|
284
|
+
}
|
|
285
|
+
async function runCloudList(options, actionCommand) {
|
|
286
|
+
const sortOrder = normalizeSortOrder(options.sortOrder);
|
|
287
|
+
if (options.sortOrder !== undefined && sortOrder === undefined) {
|
|
288
|
+
outputError(`Invalid --sort-order value: ${options.sortOrder}.`, "Use 'Ascending' or 'Descending'.");
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const auth = resolveAuth(actionCommand);
|
|
292
|
+
if (!auth) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const result = await listCloudSolutionsAsync({
|
|
296
|
+
auth,
|
|
297
|
+
limit: options.limit,
|
|
298
|
+
offset: options.offset,
|
|
299
|
+
name: options.name,
|
|
300
|
+
sortBy: options.sortBy,
|
|
301
|
+
sortOrder
|
|
302
|
+
});
|
|
303
|
+
if (!result.ok) {
|
|
304
|
+
outputError(result.message, result.instructions);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
OutputFormatter.success({
|
|
308
|
+
Result: RESULTS.Success,
|
|
309
|
+
Code: "SolutionsList",
|
|
310
|
+
Data: result.solutions,
|
|
311
|
+
Pagination: new Pagination({
|
|
312
|
+
returned: result.solutions.length,
|
|
313
|
+
limit: result.limit,
|
|
314
|
+
offset: result.offset,
|
|
315
|
+
total: result.total
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async function runLocalList(options, actionCommand) {
|
|
320
|
+
const fs = getFileSystem();
|
|
321
|
+
const rootDir = typeof options.local === "string" ? options.local : ".";
|
|
322
|
+
const scan = await scanLocalSolutionsAsync(fs, rootDir);
|
|
323
|
+
if (!scan.ok) {
|
|
324
|
+
outputError(scan.message, scan.instructions);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (options.checkCloud) {
|
|
328
|
+
const auth = resolveAuth(actionCommand);
|
|
329
|
+
if (!auth) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const failure = await annotateCloudStatusAsync(scan.rows, auth);
|
|
333
|
+
if (failure) {
|
|
334
|
+
outputError(failure.message, failure.instructions);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
OutputFormatter.success({
|
|
339
|
+
Result: RESULTS.Success,
|
|
340
|
+
Code: "LocalSolutionsList",
|
|
341
|
+
Data: scan.rows,
|
|
342
|
+
Instructions: scan.skipped.length > 0 ? scan.skipped.join(" ") : undefined
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function resolveAuth(actionCommand) {
|
|
346
|
+
const [authError, auth] = catchError(() => getStudioWebAuth(actionCommand));
|
|
347
|
+
if (authError) {
|
|
348
|
+
outputError(authError.message, "Run 'uip login' to authenticate and try again.");
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
return auth;
|
|
352
|
+
}
|
|
353
|
+
function normalizeSortOrder(direction) {
|
|
354
|
+
switch (direction?.toLowerCase()) {
|
|
355
|
+
case "ascending":
|
|
356
|
+
return "Ascending";
|
|
357
|
+
case "descending":
|
|
358
|
+
return "Descending";
|
|
359
|
+
default:
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function optionFlag(key) {
|
|
364
|
+
return `--${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`;
|
|
365
|
+
}
|
|
366
|
+
function outputError(message, instructions) {
|
|
367
|
+
OutputFormatter.error({
|
|
368
|
+
Result: RESULTS.Failure,
|
|
369
|
+
Message: message,
|
|
370
|
+
Instructions: instructions
|
|
371
|
+
});
|
|
372
|
+
processContext.exit(1);
|
|
373
|
+
}
|
|
374
|
+
export {
|
|
375
|
+
registerListCommand
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
//# debugId=F86E269BD92740C164756E2164756E21
|
package/dist/pack.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
packSolutionAsync
|
|
3
|
-
} from "./packager-tool-
|
|
3
|
+
} from "./packager-tool-nkgvv7yh.js";
|
|
4
4
|
import"./packager-tool-9vehmnke.js";
|
|
5
|
-
import"./packager-tool-
|
|
5
|
+
import"./packager-tool-krd5v2r5.js";
|
|
6
6
|
import"./packager-tool-vpr77gre.js";
|
|
7
|
-
import"./packager-tool-
|
|
7
|
+
import"./packager-tool-fzwxq48d.js";
|
|
8
|
+
import"./packager-tool-bcpknnr8.js";
|
|
8
9
|
import"./packager-tool-9qecd4wb.js";
|
|
9
10
|
import"./packager-tool-7eva0peq.js";
|
|
10
11
|
import"./packager-tool-5arsyj36.js";
|
|
@@ -14,4 +15,4 @@ export {
|
|
|
14
15
|
packSolutionAsync
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
//# debugId=
|
|
18
|
+
//# debugId=99228206AFE9054A64756E2164756E21
|