@uipath/case-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/README.md +1 -1
- package/dist/{authoring-k4xzp7fh.js → authoring-aaaqwck3.js} +64 -20
- package/dist/case-pack-service-96tjknaz.js +119 -0
- package/dist/{de-3RMZHIP6-1na18a74.js → de-K6MLR24N-00fjz82b.js} +474 -51
- package/dist/{de-LVBY3VVG-tc58p3x6.js → de-WMKOGI7B-r1821wpe.js} +16 -7
- package/dist/{en-JGJNQYMG-xq29xvhk.js → en-ILA4HPE5-fhwvq92r.js} +264 -4
- package/dist/{en-4UFXRW7N-mqabr9tf.js → en-X4DLPKLJ-dt1wtdm7.js} +17 -5
- package/dist/{es-CI4AE5B5-55sgqk64.js → es-BVPGJUWA-9gk2g9yb.js} +16 -7
- package/dist/{es-EYHYM5C4-3bajghda.js → es-HTQSD352-m9rr3f0g.js} +468 -45
- package/dist/{es-MX-QSQP2KWV-qvgkwvz2.js → es-MX-FOX525CG-87g500gr.js} +474 -51
- package/dist/{es-MX-OLZNAYY5-30cmv1dx.js → es-MX-U6YL5KQX-ynwxdjr8.js} +16 -7
- package/dist/{fr-FXFJQRD3-rfztd3e5.js → fr-54THJ4QH-d6ezjbhw.js} +473 -50
- package/dist/{fr-CCN6ZO5E-x2akzsjt.js → fr-EKTTDR7Z-bmpwp31r.js} +16 -7
- package/dist/{index-mrht9sxd.js → index-8bsngk9y.js} +101787 -90880
- package/dist/index-cncq089f.js +16491 -0
- package/dist/{index-w23k88b5.js → index-p50kx6jv.js} +202 -64
- package/dist/index.js +10 -6
- package/dist/{ja-G7NJYQ42-ve4gadd7.js → ja-MHUPLSWO-3qwy4jc0.js} +470 -47
- package/dist/{ja-O2NEV5D6-nt9rhd8c.js → ja-Y2YBTXNN-96cvy5av.js} +16 -7
- package/dist/{ko-7XWV2SEQ-chk3y7aj.js → ko-S33XAV26-cxf4dn2t.js} +16 -7
- package/dist/{ko-QDHECDTM-zmbqs9pr.js → ko-XPJTXIKK-w1hs4px7.js} +467 -44
- package/dist/{packager-tool-973f0r2g.js → packager-tool-1yy9x4vk.js} +17 -5
- package/dist/{packager-tool-pj8j9a59.js → packager-tool-8f28ypk9.js} +72533 -91227
- package/dist/packager-tool-b098y4a2.js +646 -0
- package/dist/{packager-tool-kvgt1s4z.js → packager-tool-cqrsre00.js} +282 -22
- package/dist/packager-tool-nhnf1ap2.js +13607 -0
- package/dist/packager-tool-w3h8xrnv.js +472 -0
- package/dist/packager-tool-we1phz71.js +41 -0
- package/dist/{packager-tool-8eennarq.js → packager-tool-wvqz81mx.js} +52 -690
- package/dist/packager-tool-zqa5k9f7.js +8774 -0
- package/dist/{packager-tool-pcd0vhvd.js → packager-tool-zx48pq4v.js} +646 -565
- package/dist/packager-tool.js +5 -3
- package/dist/{pt-VXJT4WUJ-nwkc9k2p.js → pt-4JEPEAST-40npwxyw.js} +471 -48
- package/dist/{pt-BR-Z4J3LEEO-cf33d2zv.js → pt-BR-JO45SCNI-4kbfnzc4.js} +16 -7
- package/dist/{pt-BR-SADBLGXA-yd89fdy2.js → pt-BR-TV7NR3ID-vgd26pj1.js} +470 -47
- package/dist/{pt-CRSN3TCU-txxbbcxm.js → pt-W3NA4LIZ-f02gapvs.js} +16 -7
- package/dist/{ro-7JHKFGCH-hbtkeqdr.js → ro-RKJ74FV3-qn0ey39v.js} +473 -50
- package/dist/{ro-WMQEVD7D-6mtq0e6b.js → ro-WLKX6HF5-fcbe2zz8.js} +16 -7
- package/dist/tool.js +10 -6
- package/dist/{tr-UCMB7W3T-xmxp2naq.js → tr-3U2W2XCA-zg3zcmq3.js} +15 -6
- package/dist/{tr-Q6IHBFK7-zs9rsm1b.js → tr-X7R6GQNB-shwv16dz.js} +482 -59
- package/dist/{zh-CN-3BPA3WIX-c5ts2m5v.js → zh-CN-FEZ24J4A-q5b5x20w.js} +470 -47
- package/dist/{zh-CN-2QOHEFC5-ryjb2byk.js → zh-CN-IPZYQR3P-1h76csc4.js} +16 -7
- package/dist/{zh-TW-QCJEQC5S-b1v637hd.js → zh-TW-GKSCT6NW-4n1yfre0.js} +464 -41
- package/dist/{zh-TW-Q5QSSTS6-6y7yjbbn.js → zh-TW-YPVSQVGT-wbybwpwt.js} +16 -7
- package/package.json +2 -2
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError,
|
|
3
|
+
logger,
|
|
4
|
+
unsupportedSolutionProjectType
|
|
5
|
+
} from "./packager-tool-zx48pq4v.js";
|
|
6
|
+
|
|
7
|
+
// ../solution-sdk/src/solution-file.ts
|
|
8
|
+
var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
|
|
9
|
+
ProcessOrchestration: "processOrchestration"
|
|
10
|
+
};
|
|
11
|
+
function normalizeProjectType(projectType) {
|
|
12
|
+
return STUDIO_WEB_PROJECT_TYPE_OVERRIDES[projectType] ?? projectType;
|
|
13
|
+
}
|
|
14
|
+
function toPortableRelativePath(relativePath) {
|
|
15
|
+
return relativePath.replace(/\\/g, "/");
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
async function createSolutionManifest(fs, solutionDir, solutionName, options = {}) {
|
|
21
|
+
const resolvedDir = fs.path.resolve(solutionDir);
|
|
22
|
+
if (!(options.allowExistingDir && await fs.exists(resolvedDir))) {
|
|
23
|
+
await fs.mkdir(resolvedDir);
|
|
24
|
+
}
|
|
25
|
+
const solutionId = crypto.randomUUID();
|
|
26
|
+
const manifest = {
|
|
27
|
+
DocVersion: "1.0.0",
|
|
28
|
+
StudioMinVersion: "2025.10.0",
|
|
29
|
+
SolutionId: solutionId,
|
|
30
|
+
Projects: []
|
|
31
|
+
};
|
|
32
|
+
const solutionFile = fs.path.join(resolvedDir, `${solutionName}.uipx`);
|
|
33
|
+
await fs.writeFile(solutionFile, `${JSON.stringify(manifest, null, 2)}
|
|
34
|
+
`);
|
|
35
|
+
return {
|
|
36
|
+
solutionDir: resolvedDir,
|
|
37
|
+
solutionFile,
|
|
38
|
+
solutionId
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var AUTO_SOLUTION_SUFFIX = "Solution";
|
|
42
|
+
async function autoScaffoldSolution(fs, baseDir, projectName) {
|
|
43
|
+
const solutionName = `${projectName}${AUTO_SOLUTION_SUFFIX}`;
|
|
44
|
+
const solutionDir = fs.path.resolve(baseDir, solutionName);
|
|
45
|
+
const expectedSolutionFile = fs.path.join(solutionDir, `${solutionName}.uipx`);
|
|
46
|
+
if (await fs.exists(expectedSolutionFile)) {
|
|
47
|
+
return {
|
|
48
|
+
Name: solutionName,
|
|
49
|
+
Path: solutionDir,
|
|
50
|
+
SolutionFile: expectedSolutionFile
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const { solutionFile } = await createSolutionManifest(fs, solutionDir, solutionName, { allowExistingDir: true });
|
|
54
|
+
return {
|
|
55
|
+
Name: solutionName,
|
|
56
|
+
Path: solutionDir,
|
|
57
|
+
SolutionFile: solutionFile
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function prepareProjectLocation(fs, candidateProjectDir, projectName, options = {}) {
|
|
61
|
+
const resolved = fs.path.resolve(candidateProjectDir);
|
|
62
|
+
if (options.skipRegistration) {
|
|
63
|
+
return { projectDir: resolved };
|
|
64
|
+
}
|
|
65
|
+
const discovery = await findNearestParentUipxFile(fs, resolved);
|
|
66
|
+
if (discovery.status !== "notFound") {
|
|
67
|
+
return { projectDir: resolved };
|
|
68
|
+
}
|
|
69
|
+
const baseDir = fs.path.dirname(resolved);
|
|
70
|
+
const autoCreatedSolution = await autoScaffoldSolution(fs, baseDir, projectName);
|
|
71
|
+
const projectDir = fs.path.join(autoCreatedSolution.Path, projectName);
|
|
72
|
+
await warnIfCandidateDirShadowed(fs, resolved, projectDir);
|
|
73
|
+
return { projectDir, autoCreatedSolution };
|
|
74
|
+
}
|
|
75
|
+
async function warnIfCandidateDirShadowed(fs, candidateDir, projectDir) {
|
|
76
|
+
const [, exists] = await catchError(fs.exists(candidateDir));
|
|
77
|
+
if (!exists) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const [, entries] = await catchError(fs.readdir(candidateDir));
|
|
81
|
+
if (!entries || entries.length === 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
logger.warn(`An existing directory "${candidateDir}" was left untouched. ` + `The project was created inside the auto-created solution at "${projectDir}". ` + "Run init from inside an existing solution, or pass --skip-solution-registration, if you meant to use the existing directory.");
|
|
85
|
+
}
|
|
86
|
+
async function updateUipxSolutionId(fs, uipxPath, newSolutionId) {
|
|
87
|
+
const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
|
|
88
|
+
if (readError || !content) {
|
|
89
|
+
logger.error(`Could not read .uipx file for update: ${readError?.message ?? "empty file"}`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const [parseError, parsed] = catchError(() => JSON.parse(content));
|
|
93
|
+
if (parseError) {
|
|
94
|
+
logger.error(`Could not parse .uipx file for update: ${parseError.message}`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
parsed.SolutionId = newSolutionId;
|
|
98
|
+
const [writeError] = await catchError(fs.writeFile(uipxPath, JSON.stringify(parsed, null, 4)));
|
|
99
|
+
if (writeError) {
|
|
100
|
+
logger.error(`Could not update .uipx with new SolutionId: ${writeError.message}`);
|
|
101
|
+
} else {
|
|
102
|
+
logger.info(`Updated .uipx with Studio Web SolutionId: ${newSolutionId}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function findSolutionFile(fs, projectPath) {
|
|
106
|
+
const parentDir = fs.path.resolve(projectPath, "..");
|
|
107
|
+
const [dirError, entries] = await catchError(fs.readdir(parentDir));
|
|
108
|
+
if (dirError) {
|
|
109
|
+
logger.error(`Could not read parent directory for .uipx file: ${dirError.message}`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const uipxFile = entries.find((entry) => entry.endsWith(".uipx"));
|
|
113
|
+
if (!uipxFile) {
|
|
114
|
+
logger.info("No .uipx solution file found in parent directory.");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const uipxPath = fs.path.join(parentDir, uipxFile);
|
|
118
|
+
const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
|
|
119
|
+
if (readError || content === null) {
|
|
120
|
+
logger.error(`Could not read .uipx file: ${readError?.message ?? "file returned null"}`);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const [parseError, parsed] = catchError(() => JSON.parse(content));
|
|
124
|
+
if (parseError) {
|
|
125
|
+
logger.error(`Could not parse .uipx file: ${parseError.message}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const solutionId = parsed.SolutionId;
|
|
129
|
+
const projectId = parsed.Projects?.[0]?.Id;
|
|
130
|
+
if (!solutionId) {
|
|
131
|
+
logger.info("No SolutionId found in .uipx file.");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
logger.info(`Found solution file: ${uipxFile} (SolutionId: ${solutionId})`);
|
|
135
|
+
return {
|
|
136
|
+
solutionId,
|
|
137
|
+
projectId: projectId ?? crypto.randomUUID()
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
async function updateSolutionFile(fs, projectPath, newSolutionId) {
|
|
141
|
+
const parentDir = fs.path.resolve(projectPath, "..");
|
|
142
|
+
const [dirError, entries] = await catchError(fs.readdir(parentDir));
|
|
143
|
+
if (dirError)
|
|
144
|
+
return;
|
|
145
|
+
const uipxFile = entries.find((entry) => entry.endsWith(".uipx"));
|
|
146
|
+
if (!uipxFile)
|
|
147
|
+
return;
|
|
148
|
+
const uipxPath = fs.path.join(parentDir, uipxFile);
|
|
149
|
+
await updateUipxSolutionId(fs, uipxPath, newSolutionId);
|
|
150
|
+
}
|
|
151
|
+
async function tryRegisterProjectInParentSolution(fs, projectDir, options) {
|
|
152
|
+
if (options?.skipRegistration) {
|
|
153
|
+
return {
|
|
154
|
+
Status: "OptedOut",
|
|
155
|
+
Message: "Solution auto-registration skipped (--skip-solution-registration).",
|
|
156
|
+
Instructions: buildOptedOutInstructions(fs.path.resolve(projectDir))
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const [registrationError, registration] = await catchError(registerProjectInParentSolution(fs, projectDir));
|
|
160
|
+
if (registrationError) {
|
|
161
|
+
return {
|
|
162
|
+
Status: "Failed",
|
|
163
|
+
Message: "Project registration failed.",
|
|
164
|
+
Instructions: buildRegistrationFailureInstructions(projectDir, registrationError.message)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return registration;
|
|
168
|
+
}
|
|
169
|
+
async function registerProjectInParentSolution(fs, projectDir) {
|
|
170
|
+
const resolvedProjectDir = fs.path.resolve(projectDir);
|
|
171
|
+
const discovery = await findNearestParentUipxFile(fs, resolvedProjectDir);
|
|
172
|
+
if (discovery.status === "notFound") {
|
|
173
|
+
return {
|
|
174
|
+
Status: "NotInSolution",
|
|
175
|
+
Message: "Project created in standalone mode; no parent .uipx solution found.",
|
|
176
|
+
Instructions: buildStandaloneInstructions(resolvedProjectDir)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (discovery.status === "skipped") {
|
|
180
|
+
return discovery.registration;
|
|
181
|
+
}
|
|
182
|
+
const solutionFile = discovery.solutionFile;
|
|
183
|
+
const solutionDir = fs.path.dirname(solutionFile);
|
|
184
|
+
const relativeProjectDir = fs.path.relative(solutionDir, resolvedProjectDir);
|
|
185
|
+
if (relativeProjectDir === "" || relativeProjectDir.startsWith("..") || fs.path.isAbsolute(relativeProjectDir)) {
|
|
186
|
+
return {
|
|
187
|
+
Status: "Skipped",
|
|
188
|
+
Message: "Project registration skipped.",
|
|
189
|
+
Solution: solutionFile,
|
|
190
|
+
Instructions: `Project must reside within the solution folder.
|
|
191
|
+
Solution: ${solutionDir}
|
|
192
|
+
Project: ${resolvedProjectDir}`
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const [projectFileError, projectFile] = await findProjectFile(fs, resolvedProjectDir);
|
|
196
|
+
if (projectFileError) {
|
|
197
|
+
return {
|
|
198
|
+
Status: "Failed",
|
|
199
|
+
Message: "Project registration failed.",
|
|
200
|
+
Solution: solutionFile,
|
|
201
|
+
Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectFileError.message)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const [projectManifestError, projectManifest] = await readProjectManifest(fs, projectFile.filePath, projectFile.useProjectJson);
|
|
205
|
+
if (projectManifestError) {
|
|
206
|
+
return {
|
|
207
|
+
Status: "Failed",
|
|
208
|
+
Message: "Project registration failed.",
|
|
209
|
+
Solution: solutionFile,
|
|
210
|
+
Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectManifestError.message)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const unsupportedReason = unsupportedSolutionProjectType(projectManifest.projectType);
|
|
214
|
+
if (unsupportedReason) {
|
|
215
|
+
return {
|
|
216
|
+
Status: "Skipped",
|
|
217
|
+
Message: "Project registration skipped.",
|
|
218
|
+
Solution: solutionFile,
|
|
219
|
+
Instructions: unsupportedReason
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const projectRelativePath = toPortableRelativePath(fs.path.join(relativeProjectDir, projectFile.fileName));
|
|
223
|
+
const [solutionError, solution] = await readSolutionManifest(fs, solutionFile);
|
|
224
|
+
if (solutionError) {
|
|
225
|
+
return {
|
|
226
|
+
Status: "Failed",
|
|
227
|
+
Message: "Project registration failed.",
|
|
228
|
+
Solution: solutionFile,
|
|
229
|
+
Project: projectRelativePath,
|
|
230
|
+
Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, solutionError.message)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const existingProject = solution.projects.find((project) => toPortableRelativePath(project.ProjectRelativePath) === projectRelativePath);
|
|
234
|
+
if (existingProject) {
|
|
235
|
+
return {
|
|
236
|
+
Status: "AlreadyRegistered",
|
|
237
|
+
Message: "Project already registered in solution.",
|
|
238
|
+
Solution: solutionFile,
|
|
239
|
+
Project: projectRelativePath,
|
|
240
|
+
ProjectId: typeof existingProject.Id === "string" ? existingProject.Id : undefined,
|
|
241
|
+
Instructions: buildRegistrationSuccessInstructions(solutionDir)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const projectId = crypto.randomUUID();
|
|
245
|
+
solution.projects.push({
|
|
246
|
+
Type: normalizeProjectType(projectManifest.projectType),
|
|
247
|
+
ProjectRelativePath: projectRelativePath,
|
|
248
|
+
Id: projectId
|
|
249
|
+
});
|
|
250
|
+
solution.content.Projects = solution.projects;
|
|
251
|
+
const [writeError] = await catchError(fs.writeFile(solutionFile, `${JSON.stringify(solution.content, null, 2)}
|
|
252
|
+
`));
|
|
253
|
+
if (writeError) {
|
|
254
|
+
return {
|
|
255
|
+
Status: "Failed",
|
|
256
|
+
Message: "Project registration failed.",
|
|
257
|
+
Solution: solutionFile,
|
|
258
|
+
Project: projectRelativePath,
|
|
259
|
+
Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, writeError.message)
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
Status: "Registered",
|
|
264
|
+
Message: "Project registered in parent solution.",
|
|
265
|
+
Solution: solutionFile,
|
|
266
|
+
Project: projectRelativePath,
|
|
267
|
+
ProjectId: projectId,
|
|
268
|
+
Instructions: buildRegistrationSuccessInstructions(solutionDir)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
async function findNearestParentUipxFile(fs, projectDir) {
|
|
272
|
+
let currentDir = fs.path.dirname(fs.path.resolve(projectDir));
|
|
273
|
+
while (true) {
|
|
274
|
+
const [readDirError, entries] = await catchError(fs.readdir(currentDir));
|
|
275
|
+
if (readDirError) {
|
|
276
|
+
return {
|
|
277
|
+
status: "skipped",
|
|
278
|
+
registration: {
|
|
279
|
+
Status: "Failed",
|
|
280
|
+
Message: "Project registration failed.",
|
|
281
|
+
Instructions: buildRegistrationFailureInstructions(projectDir, `Could not inspect parent directory for a solution: ${currentDir}
|
|
282
|
+
${readDirError.message}`)
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const solutionFiles = entries.filter((entry) => entry.endsWith(".uipx"));
|
|
287
|
+
if (solutionFiles.length > 1) {
|
|
288
|
+
return {
|
|
289
|
+
status: "skipped",
|
|
290
|
+
registration: {
|
|
291
|
+
Status: "Skipped",
|
|
292
|
+
Message: "Project registration skipped.",
|
|
293
|
+
Instructions: `Found multiple .uipx files in ${currentDir}: ${solutionFiles.join(", ")}. Run 'uip solution projects add "${projectDir}" <solution.uipx>' to choose one.`
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
if (solutionFiles.length === 1) {
|
|
298
|
+
return {
|
|
299
|
+
status: "found",
|
|
300
|
+
solutionFile: fs.path.join(currentDir, solutionFiles[0])
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const parentDir = fs.path.dirname(currentDir);
|
|
304
|
+
if (parentDir === currentDir) {
|
|
305
|
+
return { status: "notFound" };
|
|
306
|
+
}
|
|
307
|
+
currentDir = parentDir;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
async function findProjectFile(fs, projectDir) {
|
|
311
|
+
const uiprojPath = fs.path.join(projectDir, "project.uiproj");
|
|
312
|
+
if (await fs.exists(uiprojPath)) {
|
|
313
|
+
return [
|
|
314
|
+
null,
|
|
315
|
+
{
|
|
316
|
+
filePath: uiprojPath,
|
|
317
|
+
fileName: "project.uiproj",
|
|
318
|
+
useProjectJson: false
|
|
319
|
+
}
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
const jsonProjectPath = fs.path.join(projectDir, "project.json");
|
|
323
|
+
if (await fs.exists(jsonProjectPath)) {
|
|
324
|
+
return [
|
|
325
|
+
null,
|
|
326
|
+
{
|
|
327
|
+
filePath: jsonProjectPath,
|
|
328
|
+
fileName: "project.json",
|
|
329
|
+
useProjectJson: true
|
|
330
|
+
}
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
return [
|
|
334
|
+
new Error(`No project file found in ${projectDir}. Expected project.uiproj or project.json.`),
|
|
335
|
+
null
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
async function readProjectManifest(fs, filePath, useProjectJson) {
|
|
339
|
+
const [readError, rawContent] = await catchError(fs.readFile(filePath, "utf-8"));
|
|
340
|
+
if (readError || !rawContent) {
|
|
341
|
+
return [readError ?? new Error(`Unable to read ${filePath}.`), null];
|
|
342
|
+
}
|
|
343
|
+
const [parseError, parsed] = catchError(() => JSON.parse(rawContent));
|
|
344
|
+
if (parseError) {
|
|
345
|
+
return [
|
|
346
|
+
new Error(`Invalid JSON in project file: ${parseError.message}`),
|
|
347
|
+
null
|
|
348
|
+
];
|
|
349
|
+
}
|
|
350
|
+
if (!isRecord(parsed)) {
|
|
351
|
+
return [new Error(`Invalid project file: ${filePath}`), null];
|
|
352
|
+
}
|
|
353
|
+
const designOptions = parsed.designOptions;
|
|
354
|
+
const outputType = useProjectJson && isRecord(designOptions) ? readString(designOptions.outputType) : undefined;
|
|
355
|
+
const projectType = outputType ?? readString(parsed.ProjectType);
|
|
356
|
+
if (!projectType) {
|
|
357
|
+
return [new Error(`ProjectType not found in ${filePath}`), null];
|
|
358
|
+
}
|
|
359
|
+
return [
|
|
360
|
+
null,
|
|
361
|
+
{
|
|
362
|
+
projectType
|
|
363
|
+
}
|
|
364
|
+
];
|
|
365
|
+
}
|
|
366
|
+
async function readSolutionManifest(fs, solutionFile) {
|
|
367
|
+
const [readError, rawContent] = await catchError(fs.readFile(solutionFile, "utf-8"));
|
|
368
|
+
if (readError || !rawContent) {
|
|
369
|
+
return [
|
|
370
|
+
readError ?? new Error(`Unable to read solution file: ${solutionFile}`),
|
|
371
|
+
null
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
const [parseError, parsed] = catchError(() => JSON.parse(rawContent));
|
|
375
|
+
if (parseError) {
|
|
376
|
+
return [
|
|
377
|
+
new Error(`Invalid JSON in solution file: ${parseError.message}`),
|
|
378
|
+
null
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
if (!isRecord(parsed)) {
|
|
382
|
+
return [
|
|
383
|
+
new Error(`Invalid solution file: ${solutionFile} must contain a JSON object.`),
|
|
384
|
+
null
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
if (!Array.isArray(parsed.Projects)) {
|
|
388
|
+
return [
|
|
389
|
+
new Error(`Invalid solution file: ${solutionFile} must contain a Projects array.`),
|
|
390
|
+
null
|
|
391
|
+
];
|
|
392
|
+
}
|
|
393
|
+
const projects = [];
|
|
394
|
+
for (const [index, project] of parsed.Projects.entries()) {
|
|
395
|
+
if (!isRecord(project)) {
|
|
396
|
+
return [
|
|
397
|
+
new Error(`Invalid solution file: Projects[${index}] must be an object.`),
|
|
398
|
+
null
|
|
399
|
+
];
|
|
400
|
+
}
|
|
401
|
+
const projectRelativePath = readString(project.ProjectRelativePath);
|
|
402
|
+
if (!projectRelativePath) {
|
|
403
|
+
return [
|
|
404
|
+
new Error(`Invalid solution file: Projects[${index}] is missing ProjectRelativePath. Use 'uip solution projects add' to repair the manifest.`),
|
|
405
|
+
null
|
|
406
|
+
];
|
|
407
|
+
}
|
|
408
|
+
projects.push({
|
|
409
|
+
...project,
|
|
410
|
+
Type: readString(project.Type) ?? "",
|
|
411
|
+
ProjectRelativePath: projectRelativePath,
|
|
412
|
+
Id: readString(project.Id) ?? ""
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return [null, { content: parsed, projects }];
|
|
416
|
+
}
|
|
417
|
+
function readString(value) {
|
|
418
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
419
|
+
}
|
|
420
|
+
function buildRegistrationSuccessInstructions(solutionDir) {
|
|
421
|
+
return [
|
|
422
|
+
"The project is listed in the parent solution manifest.",
|
|
423
|
+
"Packing or uploading the solution will sync solution resources automatically.",
|
|
424
|
+
`To sync resources before packaging, run 'uip solution resources refresh --solution-folder "${solutionDir}"'.`
|
|
425
|
+
].join(`
|
|
426
|
+
`);
|
|
427
|
+
}
|
|
428
|
+
function buildRegistrationFailureInstructions(projectDir, details) {
|
|
429
|
+
return [
|
|
430
|
+
"Automatic solution registration could not complete.",
|
|
431
|
+
`Run 'uip solution projects add "${projectDir}" <solution.uipx>' after checking the project and solution files.`,
|
|
432
|
+
`Details: ${details}`
|
|
433
|
+
].join(`
|
|
434
|
+
`);
|
|
435
|
+
}
|
|
436
|
+
function buildStandaloneInstructions(projectDir) {
|
|
437
|
+
return [
|
|
438
|
+
"No parent solution was found by walking ancestor directories.",
|
|
439
|
+
"Studio Web upload, `flow debug`, and packaging require an enclosing solution.",
|
|
440
|
+
`To link this project to a solution, run 'uip solution init "<SolutionName>"' then 'uip solution projects add "${projectDir}" <SolutionName>.uipx'.`
|
|
441
|
+
].join(`
|
|
442
|
+
`);
|
|
443
|
+
}
|
|
444
|
+
function buildOptedOutInstructions(projectDir) {
|
|
445
|
+
return [
|
|
446
|
+
"Automatic solution registration was skipped because --skip-solution-registration was passed.",
|
|
447
|
+
`To register this project later, run 'uip solution projects add "${projectDir}" <SolutionName>.uipx' from within the solution.`
|
|
448
|
+
].join(`
|
|
449
|
+
`);
|
|
450
|
+
}
|
|
451
|
+
async function findSolutionFileUpward(fs, startDir) {
|
|
452
|
+
let dir = startDir;
|
|
453
|
+
while (true) {
|
|
454
|
+
const entries = await fs.readdir(dir);
|
|
455
|
+
const files = entries.filter((f) => f.endsWith(".uipx"));
|
|
456
|
+
if (files.length === 1) {
|
|
457
|
+
return fs.path.join(dir, files[0]);
|
|
458
|
+
}
|
|
459
|
+
if (files.length > 1) {
|
|
460
|
+
throw new Error(`Multiple .uipx files found in ${dir}. Please specify which solution file to use.`);
|
|
461
|
+
}
|
|
462
|
+
const parent = fs.path.dirname(dir);
|
|
463
|
+
if (parent === dir) {
|
|
464
|
+
throw new Error(`No .uipx solution file found (searched from ${startDir} to filesystem root)`);
|
|
465
|
+
}
|
|
466
|
+
dir = parent;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export { normalizeProjectType, prepareProjectLocation, findSolutionFile, updateSolutionFile, tryRegisterProjectInParentSolution, findSolutionFileUpward };
|
|
471
|
+
|
|
472
|
+
//# debugId=9CAB90AF72A692D764756E2164756E21
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError
|
|
3
|
+
} from "./packager-tool-zx48pq4v.js";
|
|
4
|
+
import {
|
|
5
|
+
getFileSystem
|
|
6
|
+
} from "./packager-tool-1cb0d5e0.js";
|
|
7
|
+
|
|
8
|
+
// ../maestro-sdk/src/registry/snapshot.ts
|
|
9
|
+
function maestroRegistryRoot(filesystem) {
|
|
10
|
+
const fs = filesystem ?? getFileSystem();
|
|
11
|
+
return fs.env.getenv("UIP_MAESTRO_REGISTRY_HOME") ?? fs.path.join(fs.env.homedir(), ".uipath", "maestro", "registry");
|
|
12
|
+
}
|
|
13
|
+
function maestroRegistryCurrentPath(filesystem) {
|
|
14
|
+
const fs = filesystem ?? getFileSystem();
|
|
15
|
+
return fs.path.join(maestroRegistryRoot(fs), "current.json");
|
|
16
|
+
}
|
|
17
|
+
async function resolveMaestroRegistry(filesystem) {
|
|
18
|
+
const fs = filesystem ?? getFileSystem();
|
|
19
|
+
const [readError, content] = await catchError(fs.readFile(maestroRegistryCurrentPath(fs), "utf-8"));
|
|
20
|
+
if (readError || content === null)
|
|
21
|
+
return null;
|
|
22
|
+
const [parseError, current] = catchError(() => JSON.parse(content));
|
|
23
|
+
if (parseError || !current)
|
|
24
|
+
return null;
|
|
25
|
+
const snapshotPath = current.snapshotPath;
|
|
26
|
+
if (typeof snapshotPath !== "string" || snapshotPath.length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
libraryHash: typeof current.libraryHash === "string" ? current.libraryHash : "",
|
|
31
|
+
snapshotPath,
|
|
32
|
+
libraryJson: fs.path.join(snapshotPath, "library-json"),
|
|
33
|
+
libraryMarkdown: fs.path.join(snapshotPath, "library-md"),
|
|
34
|
+
connectors: fs.path.join(snapshotPath, "connectors"),
|
|
35
|
+
updatedAt: typeof current.updatedAt === "string" ? current.updatedAt : ""
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { resolveMaestroRegistry };
|
|
40
|
+
|
|
41
|
+
//# debugId=4F930E85411BFAC964756E2164756E21
|