@uipath/rules-tool 1.204.0-preview.249 → 1.204.0-preview.254

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.
Files changed (154) hide show
  1. package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +42 -0
  2. package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +18 -0
  3. package/dist/KieDmnMarshaller-6TTUU5B4-47q50gk4.js +20 -0
  4. package/dist/THIRD-PARTY-NOTICES.md +1085 -0
  5. package/dist/business-rules-bnr581tz.js +26 -0
  6. package/dist/{constants-za5vbzp8.js → constants-9pa118cj.js} +17 -10
  7. package/dist/{embedded-file-reader-wmsg31a8.js → embedded-file-reader-rf2g1kfj.js} +4 -1
  8. package/dist/first-party-service-sd8yaf73.js +27 -0
  9. package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +33 -0
  10. package/dist/index-2hzp9b97.js +116 -0
  11. package/dist/index-34pj9f36.js +48 -0
  12. package/dist/{index-zdwhfpt1.js → index-4c4exdzw.js} +370 -406
  13. package/dist/index-dqa169gp.js +25 -0
  14. package/dist/{index-we6zjs66.js → index-fs1nd5ap.js} +40 -4
  15. package/dist/{index-nzr4mx5p.js → index-sby22td6.js} +22 -2
  16. package/dist/{index-7wc0g78k.js → index-t4mx1a5e.js} +5 -2
  17. package/dist/index.js +9 -8
  18. package/dist/{jmespath-ab6tdc42.js → jmespath-231m3hyn.js} +1 -1
  19. package/dist/{js-yaml-a2bk27p6.js → js-yaml-88tdqrtd.js} +3 -1
  20. package/dist/rule-catalog-5gzpe93c.js +46 -0
  21. package/dist/rules-command-error-20gp2dv9.js +14 -0
  22. package/dist/{rules-debug-service-h1ahd6p3.js → rules-debug-service-yvh448xp.js} +36 -35
  23. package/dist/{rules-init-service-y678kjje.js → rules-init-service-ewahc0vh.js} +16 -12
  24. package/dist/{rules-refresh-service-btn64j8j.js → rules-refresh-service-jgk2kq9d.js} +14 -13
  25. package/dist/{rules-validate-service-sppr4x13.js → rules-validate-service-mr2fk58k.js} +13 -10
  26. package/dist/{tool-97x3zjcm.js → tool-19b4ect0.js} +158 -113
  27. package/dist/{tool-epsr41wx.js → tool-1de529jm.js} +3 -12
  28. package/dist/{tool-7xmarr97.js → tool-2cky8jwp.js} +2578 -1777
  29. package/dist/{tool-x67kek1m.js → tool-2qj74g14.js} +12 -652
  30. package/dist/{tool-0bthsb3x.js → tool-4dfpdepw.js} +15 -15
  31. package/dist/tool-53w8skv5.js +262 -0
  32. package/dist/tool-7haj67tr.js +19 -0
  33. package/dist/{tool-e1mmqsjr.js → tool-8h4er38s.js} +411 -396
  34. package/dist/{tool-2trg1fpx.js → tool-8qy8pkp4.js} +8 -8
  35. package/dist/tool-av4mmsef.js +73 -0
  36. package/dist/{tool-6sqt4zrx.js → tool-cgmy94zt.js} +32 -29
  37. package/dist/{tool-8j9f6ns5.js → tool-eymjx05p.js} +11 -11
  38. package/dist/{tool-mm1x18d6.js → tool-gdtpsdn7.js} +28 -223
  39. package/dist/tool-m41px07w.js +49 -0
  40. package/dist/{tool-k2s349kn.js → tool-mkn83w88.js} +17 -14
  41. package/dist/tool-pm3ewdxc.js +1115 -0
  42. package/dist/{tool-6rp0gx98.js → tool-tkcx6png.js} +107 -127
  43. package/dist/{tool-1dycs173.js → tool-wmh645tm.js} +202 -194
  44. package/dist/tool.js +8 -7
  45. package/package.json +2 -15
  46. package/dist/DmnFactory-SG3RP3T3-cr8e7mxz.js +0 -8
  47. package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +0 -8
  48. package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +0 -8
  49. package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +0 -8
  50. package/dist/business-rules-d51977r1.js +0 -25
  51. package/dist/business-rules-dekge24t.js +0 -23
  52. package/dist/business-rules-ew76mbwg.js +0 -25
  53. package/dist/business-rules-jmwx05k2.js +0 -25
  54. package/dist/business-rules-zpzqxyce.js +0 -26
  55. package/dist/constants-4r8pfr16.js +0 -22
  56. package/dist/embedded-file-reader-0228j82a.js +0 -111
  57. package/dist/first-party-service-1qa6cp4d.js +0 -8
  58. package/dist/first-party-service-28dkctkz.js +0 -8
  59. package/dist/first-party-service-4fsz3cnj.js +0 -8
  60. package/dist/first-party-service-ahcc6xc6.js +0 -8
  61. package/dist/first-party-service-y1ccmsvp.js +0 -8
  62. package/dist/first-party-service-zpr1q3nd.js +0 -8
  63. package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +0 -12
  64. package/dist/index-2zxy6zgp.js +0 -23
  65. package/dist/index-3nx77wfh.js +0 -23
  66. package/dist/index-43zg1wqe.js +0 -19621
  67. package/dist/index-47jera73.js +0 -23
  68. package/dist/index-70jn7cz1.js +0 -19631
  69. package/dist/index-8kb5kc5y.js +0 -24
  70. package/dist/index-97yad7ms.js +0 -8
  71. package/dist/index-dfn83hxf.js +0 -14
  72. package/dist/index-e301h23h.js +0 -24
  73. package/dist/index-frd259yv.js +0 -24
  74. package/dist/index-gc7cw2jh.js +0 -23
  75. package/dist/index-gya2v502.js +0 -8
  76. package/dist/index-hb3gk1wf.js +0 -24
  77. package/dist/index-nsnfdqd5.js +0 -24
  78. package/dist/index-vffktc0w.js +0 -166
  79. package/dist/index-xymrydfw.js +0 -3095
  80. package/dist/index-z2qk2qn6.js +0 -24
  81. package/dist/index-zecwgvg7.js +0 -23
  82. package/dist/rule-catalog-a5w86qns.js +0 -43
  83. package/dist/rule-catalog-etpf962f.js +0 -69
  84. package/dist/rule-catalog-q5cr17hf.js +0 -58
  85. package/dist/rule-catalog-vc98yg4n.js +0 -43
  86. package/dist/rule-catalog-z3h66kh5.js +0 -56
  87. package/dist/rules-command-error-10qmb5w7.js +0 -13
  88. package/dist/rules-command-error-5bdv4bcx.js +0 -13
  89. package/dist/rules-command-error-cmssf0w4.js +0 -13
  90. package/dist/rules-command-error-fsm3b1mv.js +0 -13
  91. package/dist/rules-debug-service-5rcdh3pj.js +0 -192
  92. package/dist/rules-debug-service-8q7mkd0r.js +0 -199
  93. package/dist/rules-debug-service-b9j29ejz.js +0 -192
  94. package/dist/rules-debug-service-v3jr3r1n.js +0 -192
  95. package/dist/rules-init-service-3c2yfa7p.js +0 -687
  96. package/dist/rules-init-service-3wgd9cqp.js +0 -100
  97. package/dist/rules-init-service-8fqytxq0.js +0 -685
  98. package/dist/rules-init-service-pspt7sje.js +0 -100
  99. package/dist/rules-init-service-sbtzw93j.js +0 -102
  100. package/dist/rules-init-service-x7paqa63.js +0 -687
  101. package/dist/rules-init-service-y7qzmxx0.js +0 -102
  102. package/dist/rules-refresh-service-4xxj6ex6.js +0 -65
  103. package/dist/rules-refresh-service-ba5jk1y9.js +0 -65
  104. package/dist/rules-refresh-service-qkmphj53.js +0 -65
  105. package/dist/rules-validate-service-dmgnfne7.js +0 -60
  106. package/dist/rules-validate-service-hk2d006t.js +0 -60
  107. package/dist/rules-validate-service-xp05n2d9.js +0 -60
  108. package/dist/tool-1pkqxwwd.js +0 -17472
  109. package/dist/tool-24mr6g8c.js +0 -1556
  110. package/dist/tool-39fmkx2d.js +0 -611
  111. package/dist/tool-3e2q1x2y.js +0 -6578
  112. package/dist/tool-3j0747gg.js +0 -17077
  113. package/dist/tool-4z7zcq4z.js +0 -6058
  114. package/dist/tool-56smnjrh.js +0 -73
  115. package/dist/tool-5qygptrc.js +0 -6171
  116. package/dist/tool-5xx6x8pe.js +0 -6596
  117. package/dist/tool-7fkrd618.js +0 -1556
  118. package/dist/tool-89xzeteg.js +0 -361
  119. package/dist/tool-911s9czz.js +0 -570
  120. package/dist/tool-9bz2x04j.js +0 -40
  121. package/dist/tool-akh7nnqs.js +0 -704
  122. package/dist/tool-axfzew45.js +0 -1555
  123. package/dist/tool-b71jq9pt.js +0 -389
  124. package/dist/tool-bfj846v8.js +0 -141
  125. package/dist/tool-bvmc017m.js +0 -96
  126. package/dist/tool-bykz5ryf.js +0 -454
  127. package/dist/tool-c76qb8ap.js +0 -17052
  128. package/dist/tool-ca15515v.js +0 -570
  129. package/dist/tool-f9qs255w.js +0 -70
  130. package/dist/tool-ga79rety.js +0 -389
  131. package/dist/tool-gb547mcn.js +0 -141
  132. package/dist/tool-gta9rr4h.js +0 -68
  133. package/dist/tool-h2dfnxdq.js +0 -6486
  134. package/dist/tool-hg6vr5y9.js +0 -3769
  135. package/dist/tool-hgvnm4vh.js +0 -1843
  136. package/dist/tool-hjbf9aay.js +0 -571
  137. package/dist/tool-k5jm64n3.js +0 -5650
  138. package/dist/tool-ketztpgf.js +0 -73
  139. package/dist/tool-n1d88ryb.js +0 -6396
  140. package/dist/tool-nmqpwh9m.js +0 -6166
  141. package/dist/tool-pb80pswx.js +0 -73
  142. package/dist/tool-pcsgwpfw.js +0 -40
  143. package/dist/tool-q3c1bjyb.js +0 -454
  144. package/dist/tool-rwp1skmf.js +0 -40
  145. package/dist/tool-s3fbt22r.js +0 -454
  146. package/dist/tool-tmbst1r8.js +0 -68
  147. package/dist/tool-v6w109p0.js +0 -455
  148. package/dist/tool-w2js05qv.js +0 -389
  149. package/dist/tool-x89947ah.js +0 -17052
  150. package/dist/tool-xhksjdka.js +0 -4005
  151. package/dist/tool-yv3t4gg5.js +0 -108
  152. package/dist/tool-zbyb1ttx.js +0 -5650
  153. /package/dist/{tool-fbqnqf9k.js → tool-jd313s2x.js} +0 -0
  154. /package/dist/{tool-vyx8fpft.js → tool-qgqscsjc.js} +0 -0
@@ -1,454 +0,0 @@
1
- import {
2
- catchError,
3
- logger,
4
- unsupportedSolutionProjectType
5
- } from "./tool-3e2q1x2y.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
-
452
- export { normalizeProjectType, toPortableRelativePath, prepareProjectLocation, findSolutionFile, updateSolutionFile, tryRegisterProjectInParentSolution };
453
-
454
- //# debugId=B58497A77C74D77C64756E2164756E21