@uipath/solution-tool 1.203.0-preview.212 → 1.204.0-preview.211

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 (76) hide show
  1. package/README.md +2 -2
  2. package/dist/THIRD-PARTY-NOTICES.md +4 -4
  3. package/dist/deploy-delete-service-gg00vadc.js +22 -0
  4. package/dist/deploy-status-service-cqfrvxpz.js +256 -0
  5. package/dist/deploy.d.ts +11 -4
  6. package/dist/deploy.js +19 -7
  7. package/dist/deployment-search-j34w33b2.js +49 -0
  8. package/dist/{embedded-file-reader-xxqe8vs8.js → embedded-file-reader-rf2g1kfj.js} +2 -2
  9. package/dist/feed-resolver-31gcvnnk.js +27 -0
  10. package/dist/feed-scope-failure-fwtdvvrh.js +18 -0
  11. package/dist/feed-session-sxga31vn.js +17 -0
  12. package/dist/index.js +27 -18
  13. package/dist/init.js +10 -7
  14. package/dist/{list-xjdnbyka.js → list-q4dzkv45.js} +9 -6
  15. package/dist/pack.js +14 -11
  16. package/dist/{packager-tool-7qmx64kz.js → packager-tool-00vh1ktg.js} +1022 -1342
  17. package/dist/packager-tool-1phh2rfx.js +37 -0
  18. package/dist/{packager-tool-vas0xg5h.js → packager-tool-2cntqvdv.js} +5 -3
  19. package/dist/{packager-tool-1haahq17.js → packager-tool-3enm2h28.js} +5 -5
  20. package/dist/{packager-tool-2syrt51a.js → packager-tool-3fv6zc86.js} +1062 -825
  21. package/dist/{packager-tool-grtmkd54.js → packager-tool-3m36mxn7.js} +16 -74
  22. package/dist/packager-tool-40vcj4wv.js +172 -0
  23. package/dist/packager-tool-482eg22x.js +322 -0
  24. package/dist/{packager-tool-k4mskzww.js → packager-tool-5dzjsw5q.js} +3 -3
  25. package/dist/{packager-tool-0f0wt9vh.js → packager-tool-5fjp60dk.js} +3071 -2794
  26. package/dist/{packager-tool-bkwnetqn.js → packager-tool-83rzavkx.js} +383 -88
  27. package/dist/{packager-tool-f423v35w.js → packager-tool-9hj0cfd0.js} +756 -359
  28. package/dist/{packager-tool-7znqtw3f.js → packager-tool-9vvdgbay.js} +8 -6
  29. package/dist/packager-tool-bqre28m1.js +43 -0
  30. package/dist/packager-tool-f5gq77m5.js +28 -0
  31. package/dist/{packager-tool-nzghfa48.js → packager-tool-fv7xyzg2.js} +550 -2
  32. package/dist/{packager-tool-3jrq7smt.js → packager-tool-gb35b4qs.js} +206 -289
  33. package/dist/{packager-tool-4kdt8mys.js → packager-tool-j30xck4w.js} +1008 -647
  34. package/dist/packager-tool-ks8spnq8.js +166 -0
  35. package/dist/packager-tool-q3tgpemc.js +113 -0
  36. package/dist/packager-tool-qdtjywsk.js +173 -0
  37. package/dist/{packager-tool-2p5yh1q9.js → packager-tool-qgaqqq41.js} +320 -151
  38. package/dist/packager-tool-qm24rbae.js +5889 -0
  39. package/dist/{packager-tool-resolver-fmjr60x8.js → packager-tool-resolver-2cbxyq6k.js} +6 -5
  40. package/dist/{packager-tool-znakt6yw.js → packager-tool-vh4ng74p.js} +8 -6
  41. package/dist/packager-tool-vmsxq1pc.js +104 -0
  42. package/dist/packager-tool-zf3929se.js +237 -0
  43. package/dist/packager-tool-zns6n8zp.js +837 -0
  44. package/dist/packager-tool.js +2 -2
  45. package/dist/prepare-solution-resources-p3gzdecy.js +25 -0
  46. package/dist/{project-contributions-cvttys34.js → project-contributions-txe8v6sm.js} +12 -9
  47. package/dist/publish.js +12 -7
  48. package/dist/resource.js +9 -6
  49. package/dist/services/activation.d.ts +17 -2
  50. package/dist/services/deploy-activate-service.d.ts +10 -0
  51. package/dist/services/deploy-delete-service.d.ts +82 -0
  52. package/dist/services/deploy-list-service.d.ts +15 -45
  53. package/dist/services/deploy-run-service.d.ts +36 -23
  54. package/dist/services/deploy-upgrade-service.d.ts +198 -39
  55. package/dist/services/deployment-feed-locator.d.ts +50 -12
  56. package/dist/services/deployment-search-client.d.ts +55 -0
  57. package/dist/services/deployment-search.d.ts +87 -34
  58. package/dist/services/deployment-state.d.ts +119 -0
  59. package/dist/services/feed-resolver.d.ts +31 -0
  60. package/dist/services/feed-session.d.ts +70 -0
  61. package/dist/services/folder-helper.d.ts +4 -27
  62. package/dist/services/http-status.d.ts +9 -0
  63. package/dist/services/incomplete-feed-sweep.d.ts +77 -0
  64. package/dist/services/legacy-deployment-search-v3.d.ts +23 -0
  65. package/dist/services/packages-list-service.d.ts +5 -0
  66. package/dist/services/pipeline-deploy-poll.d.ts +69 -0
  67. package/dist/services/publish-service.d.ts +14 -16
  68. package/dist/services/search-failure.d.ts +27 -0
  69. package/dist/templates/AGENTS.md +60 -20
  70. package/dist/tool.js +27 -18
  71. package/dist/utils/deployment-errors.d.ts +57 -0
  72. package/package.json +2 -2
  73. package/dist/packager-tool-jz2wbfjz.js +0 -2275
  74. package/dist/packager-tool-wtpe9285.js +0 -51960
  75. package/dist/prepare-solution-resources-wds3r8bq.js +0 -22
  76. package/dist/services/personal-workspace-deploy.d.ts +0 -49
@@ -3,10 +3,10 @@ import {
3
3
  assertNoContributionErrors,
4
4
  collectProjectContributions,
5
5
  contributionErrorMessages
6
- } from "./packager-tool-znakt6yw.js";
6
+ } from "./packager-tool-vh4ng74p.js";
7
7
  import {
8
8
  ensurePackagerTools
9
- } from "./packager-tool-k4mskzww.js";
9
+ } from "./packager-tool-5dzjsw5q.js";
10
10
  import {
11
11
  Tokens,
12
12
  createResourceBuilderServices,
@@ -17,12 +17,14 @@ import {
17
17
  models_BindingsResourceType,
18
18
  readUipxProjects,
19
19
  syncAndLog
20
- } from "./packager-tool-bkwnetqn.js";
20
+ } from "./packager-tool-83rzavkx.js";
21
21
  import {
22
22
  catchError,
23
- getFileSystem,
24
23
  logger
25
- } from "./packager-tool-0f0wt9vh.js";
24
+ } from "./packager-tool-5fjp60dk.js";
25
+ import {
26
+ getFileSystem
27
+ } from "./packager-tool-zf3929se.js";
26
28
 
27
29
  // src/services/emit-runtime-dependencies.ts
28
30
  import { createHash } from "node:crypto";
@@ -241,4 +243,4 @@ async function prepareSolutionResources(solutionDir, fs, options) {
241
243
 
242
244
  export { projectSubTypesFrom, prepareSolutionResources };
243
245
 
244
- //# debugId=66D4CB702D8B08F964756E2164756E21
246
+ //# debugId=16FA8B6372D1A69964756E2164756E21
@@ -0,0 +1,43 @@
1
+ import {
2
+ resolveSessionIdentity
3
+ } from "./packager-tool-gb35b4qs.js";
4
+
5
+ // src/services/feed-session.ts
6
+ function classifyFeedSession(session) {
7
+ const type = (session.identity ?? resolveSessionIdentity(session.accessToken))?.type;
8
+ if (type === "User") {
9
+ return "user";
10
+ }
11
+ return type === "Application" ? "application" : "unknown";
12
+ }
13
+ function feedSessionRefusal(verdict, action, alternative) {
14
+ if (verdict === "application") {
15
+ return {
16
+ message: `${action} needs a user session; this session is an external app.`,
17
+ instructions: `The server does not apply X-UIPATH-FolderKey to client-credentials requests, so the request would run against the tenant feed instead. Run it with a user session ('uip login'), or ${alternative}.`
18
+ };
19
+ }
20
+ return {
21
+ message: `${action} needs a user session, and this session's kind could not be read from its token.`,
22
+ instructions: `The server applies X-UIPATH-FolderKey to user-token requests only, and a session that cannot be shown to be a user's is not allowed to act on a feed — guessing wrong would run the request against the tenant feed. Refresh the session with 'uip login' (an interactive login is recorded as a user session), or ${alternative}.`
23
+ };
24
+ }
25
+ function feedReadRefusalForApplication(session, action) {
26
+ if (classifyFeedSession(session) !== "application") {
27
+ return;
28
+ }
29
+ return feedSessionRefusal("application", action, "drop the feed flag to read the tenant feed");
30
+ }
31
+
32
+ class FeedReadRefusedError extends Error {
33
+ refusal;
34
+ constructor(refusal) {
35
+ super(refusal.message);
36
+ this.refusal = refusal;
37
+ this.name = "FeedReadRefusedError";
38
+ }
39
+ }
40
+
41
+ export { classifyFeedSession, feedSessionRefusal, feedReadRefusalForApplication, FeedReadRefusedError };
42
+
43
+ //# debugId=46593028C6477B8B64756E2164756E21
@@ -0,0 +1,28 @@
1
+ import {
2
+ getAuthContext
3
+ } from "./packager-tool-gb35b4qs.js";
4
+
5
+ // ../solution-sdk/src/solution-auth.ts
6
+ async function getSolutionAuthContext(options) {
7
+ const ctx = await getAuthContext({
8
+ tenant: options.tenant,
9
+ ensureTokenValidityMinutes: options.loginValidity ?? 10,
10
+ envFilePath: options.envFilePath,
11
+ requireOrganizationId: true,
12
+ requireTenantName: true
13
+ });
14
+ const organizationId = ctx.organizationId;
15
+ const tenantName = ctx.tenantName;
16
+ const basePath = `${ctx.baseUrl}/${organizationId}/${tenantName}/automationsolutions_`;
17
+ return {
18
+ accessToken: ctx.accessToken,
19
+ basePath,
20
+ organizationId,
21
+ tenantName,
22
+ identity: ctx.identity
23
+ };
24
+ }
25
+
26
+ export { getSolutionAuthContext };
27
+
28
+ //# debugId=7C83D4398979D25864756E2164756E21
@@ -1,3 +1,8 @@
1
+ import {
2
+ unzipSync,
3
+ zipSync
4
+ } from "./packager-tool-dfrk01gn.js";
5
+
1
6
  // ../packager/packager-core/src/services/tools-factory-repository.ts
2
7
  class ToolsFactoryRepository {
3
8
  projectFactoryMap = new Map;
@@ -44,6 +49,283 @@ if (!_global[REGISTRY_KEY]) {
44
49
  _global[REGISTRY_KEY] = new ToolsFactoryRepository;
45
50
  }
46
51
  var toolsFactoryRepository = _global[REGISTRY_KEY];
52
+
53
+ // ../packager/packager-core/src/filesystem/path.ts
54
+ class Path {
55
+ static normalize(path) {
56
+ return path.replace(/\\/g, "/").replace(/\/+/g, "/");
57
+ }
58
+ static join(...segments) {
59
+ return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
60
+ }
61
+ static dirname(path) {
62
+ const normalized = Path.normalize(path).replace(/\/$/, "");
63
+ if (normalized === "")
64
+ return ".";
65
+ const lastSlash = normalized.lastIndexOf("/");
66
+ if (lastSlash === -1)
67
+ return ".";
68
+ if (lastSlash === 0)
69
+ return "/";
70
+ return normalized.substring(0, lastSlash);
71
+ }
72
+ static basename(path) {
73
+ const normalized = Path.normalize(path).replace(/\/$/, "");
74
+ if (normalized === "")
75
+ return "";
76
+ const lastSlash = normalized.lastIndexOf("/");
77
+ return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
78
+ }
79
+ static extname(path) {
80
+ const base = Path.basename(path);
81
+ const lastDot = base.lastIndexOf(".");
82
+ if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
83
+ return "";
84
+ }
85
+ return base.substring(lastDot);
86
+ }
87
+ static async walkDirectory(fs, rootPath, currentRelativePath = "") {
88
+ const entries = [];
89
+ const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
90
+ const items = await fs.readdir(absolutePath);
91
+ for (const item of items) {
92
+ const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
93
+ const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
94
+ const stat = await fs.stat(itemAbsolutePath);
95
+ if (stat?.isDirectory()) {
96
+ const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
97
+ entries.push(...subEntries);
98
+ } else if (stat?.isFile()) {
99
+ entries.push({
100
+ relativePath: Path.normalize(itemRelativePath),
101
+ absolutePath: Path.normalize(itemAbsolutePath)
102
+ });
103
+ }
104
+ }
105
+ return entries;
106
+ }
107
+ }
108
+
109
+ // ../packager/packager-core/src/models/nuget-constants.ts
110
+ var NugetConstants = {
111
+ OutputFolderName: "bundle",
112
+ ContentFolderName: "content",
113
+ OperateFileName: "operate.json",
114
+ EntryPointsFileName: "entry-points.json",
115
+ PackageDescriptorFileName: "package-descriptor.json",
116
+ BindingsV2FileName: "bindings_v2.json",
117
+ BindingsFileId: "bindings.json"
118
+ };
119
+
120
+ // ../packager/packager-core/src/services/project-id.ts
121
+ var OPERATE_FILE = "operate.json";
122
+ var PROJECT_FILE = "project.json";
123
+ function isNonEmptyString(value) {
124
+ return typeof value === "string" && value.length > 0;
125
+ }
126
+ async function readJsonObject(fs, filePath) {
127
+ let content;
128
+ try {
129
+ content = await fs.readFile(filePath, "utf-8");
130
+ } catch {
131
+ return;
132
+ }
133
+ if (content === null) {
134
+ return;
135
+ }
136
+ try {
137
+ const parsed = JSON.parse(content);
138
+ if (parsed === null || typeof parsed !== "object") {
139
+ return;
140
+ }
141
+ return parsed;
142
+ } catch {
143
+ return;
144
+ }
145
+ }
146
+ async function writeJsonObject(fs, filePath, data) {
147
+ await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
148
+ `);
149
+ }
150
+ async function ensureProjectId(projectPath, fs) {
151
+ const operatePath = Path.join(projectPath, OPERATE_FILE);
152
+ const operateExists = await fs.exists(operatePath);
153
+ if (operateExists) {
154
+ const operate = await readJsonObject(fs, operatePath);
155
+ if (operate && isNonEmptyString(operate.projectId)) {
156
+ return operate.projectId;
157
+ }
158
+ if (operate) {
159
+ const id = crypto.randomUUID();
160
+ await writeJsonObject(fs, operatePath, {
161
+ ...operate,
162
+ projectId: id
163
+ });
164
+ return id;
165
+ }
166
+ return crypto.randomUUID();
167
+ }
168
+ const projectFilePath = Path.join(projectPath, PROJECT_FILE);
169
+ const projectFileExists = await fs.exists(projectFilePath);
170
+ if (projectFileExists) {
171
+ const projectFile = await readJsonObject(fs, projectFilePath);
172
+ if (projectFile && isNonEmptyString(projectFile.projectId)) {
173
+ return projectFile.projectId;
174
+ }
175
+ if (projectFile) {
176
+ const id = crypto.randomUUID();
177
+ await writeJsonObject(fs, projectFilePath, {
178
+ ...projectFile,
179
+ projectId: id
180
+ });
181
+ return id;
182
+ }
183
+ return crypto.randomUUID();
184
+ }
185
+ return crypto.randomUUID();
186
+ }
187
+ async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
188
+ if (!await fs.exists(operateFilePath)) {
189
+ return;
190
+ }
191
+ const parsed = await readJsonObject(fs, operateFilePath);
192
+ if (!parsed) {
193
+ return;
194
+ }
195
+ if (isNonEmptyString(parsed.projectId)) {
196
+ return;
197
+ }
198
+ await writeJsonObject(fs, operateFilePath, {
199
+ ...parsed,
200
+ projectId: fallbackProjectId
201
+ });
202
+ }
203
+ async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
204
+ if (await fs.exists(operateFilePath)) {
205
+ await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
206
+ return;
207
+ }
208
+ await createIfMissing();
209
+ }
210
+ // ../packager/packager-core/src/services/nuget-packager.ts
211
+ function escapeXml(str) {
212
+ if (str === null || str === undefined) {
213
+ return "";
214
+ }
215
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
216
+ }
217
+ function optionalElement(name, value) {
218
+ if (value === undefined || value === "")
219
+ return "";
220
+ return ` <${name}>${escapeXml(value)}</${name}>
221
+ `;
222
+ }
223
+ function generateDependenciesXml(dependencies) {
224
+ if (!dependencies || dependencies.length === 0)
225
+ return "";
226
+ const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
227
+ `);
228
+ return ` <dependencies>
229
+ ${deps}
230
+ </dependencies>
231
+ `;
232
+ }
233
+ function generateRepositoryXml(packageInfo) {
234
+ if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
235
+ return "";
236
+ let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
237
+ if (packageInfo.repositoryBranch) {
238
+ repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
239
+ }
240
+ if (packageInfo.repositoryCommit) {
241
+ repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
242
+ }
243
+ repoXml += ` />
244
+ `;
245
+ return repoXml;
246
+ }
247
+ function generateNuspecXml(packageInfo) {
248
+ const author = packageInfo.author?.trim() || "UiPath";
249
+ const description = packageInfo.description?.trim() || "Created by UiPath";
250
+ const title = packageInfo.title?.trim() || packageInfo.id;
251
+ const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
252
+ const releaseNotes = packageInfo.releaseNotes ?? "";
253
+ const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
254
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
255
+ <metadata>
256
+ <id>${escapeXml(packageInfo.id)}</id>
257
+ <version>${escapeXml(packageInfo.version)}</version>
258
+ <title>${escapeXml(title)}</title>
259
+ <authors>${escapeXml(author)}</authors>
260
+ <requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
261
+ <description>${escapeXml(description)}</description>
262
+ <releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
263
+ ${optionalElement("tags", packageInfo.tags)}${optionalElement("iconUrl", packageInfo.iconUrl)}${optionalElement("projectUrl", packageInfo.projectUrl)}${optionalElement("licenseUrl", packageInfo.licenseUrl)}${optionalElement("copyright", packageInfo.copyright)}${generateRepositoryXml(packageInfo)}${generateDependenciesXml(packageInfo.dependencies)} </metadata>
264
+ </package>
265
+ `;
266
+ return xml;
267
+ }
268
+ function generatePsmdcpXml(packageInfo) {
269
+ const author = packageInfo.author?.trim() || "UiPath";
270
+ const description = packageInfo.description?.trim() || "Created by UiPath";
271
+ return `<?xml version="1.0" encoding="utf-8"?>
272
+ <coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
273
+ <dc:creator>${escapeXml(author)}</dc:creator>
274
+ <dc:description>${escapeXml(description)}</dc:description>
275
+ <dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
276
+ <version>${escapeXml(packageInfo.version)}</version>
277
+ <keywords></keywords>
278
+ <lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
279
+ </coreProperties>`;
280
+ }
281
+
282
+ class NugetPackager {
283
+ fileSystem;
284
+ constructor(fileSystem) {
285
+ this.fileSystem = fileSystem;
286
+ }
287
+ async packAsync(rootPath, packageInfo, outputPath) {
288
+ const normalizedOutputPath = Path.normalize(outputPath);
289
+ const nuspecXml = generateNuspecXml(packageInfo);
290
+ const nuspecFileName = `${packageInfo.id}.nuspec`;
291
+ const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
292
+ const zipContents = {};
293
+ const encoder = new TextEncoder;
294
+ const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
295
+ const psmdcpFileName = `${psmdcpId}.psmdcp`;
296
+ const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
297
+ const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
298
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
299
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
300
+ <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
301
+ <Default Extension="uiproj" ContentType="application/octet" />
302
+ <Default Extension="json" ContentType="application/octet" />
303
+ <Default Extension="nuspec" ContentType="application/octet" />
304
+ </Types>`;
305
+ zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
306
+ const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
307
+ const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
308
+ const relsXml = `<?xml version="1.0" encoding="utf-8"?>
309
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
310
+ <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
311
+ <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
312
+ </Relationships>`;
313
+ zipContents["_rels/.rels"] = encoder.encode(relsXml);
314
+ zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
315
+ zipContents[nuspecFileName] = encoder.encode(nuspecXml);
316
+ for (const entry of fileEntries) {
317
+ const content = await this.fileSystem.readFile(entry.absolutePath);
318
+ if (content !== null) {
319
+ zipContents[entry.relativePath] = content;
320
+ }
321
+ }
322
+ const zippedData = zipSync(zipContents);
323
+ await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
324
+ return {
325
+ outputPath: normalizedOutputPath
326
+ };
327
+ }
328
+ }
47
329
  // ../packager/packager-core/src/models/tool-result.ts
48
330
  class ToolResult {
49
331
  errorCode;
@@ -67,6 +349,180 @@ class ToolResult {
67
349
  return new ToolResult(errorCode, message, [], instructions);
68
350
  }
69
351
  }
352
+
353
+ // ../packager/packager-core/src/services/project-tool.ts
354
+ class ProjectTool {
355
+ fileSystem;
356
+ logger;
357
+ static ProjectFileName = "project.uiproj";
358
+ constructor(fileSystem, logger) {
359
+ this.fileSystem = fileSystem;
360
+ this.logger = logger;
361
+ }
362
+ async restoreAsync(_options, _cancellationToken) {
363
+ this.logger.info("Restore operation is a noop");
364
+ return ToolResult.success();
365
+ }
366
+ async validateAsync(_options, _cancellationToken) {
367
+ this.logger.info("Validate operation is a noop");
368
+ return ToolResult.success();
369
+ }
370
+ async buildAsync(_options, _cancellationToken) {
371
+ this.logger.info("Build operation is a noop");
372
+ return ToolResult.success();
373
+ }
374
+ async packAsync(_options, _cancellationToken) {
375
+ this.logger.info("Pack operation is a noop");
376
+ return ToolResult.success();
377
+ }
378
+ async cleanupAsync(_options, _cancellationToken) {
379
+ this.logger.info("Cleanup operation is a noop");
380
+ return ToolResult.success();
381
+ }
382
+ async getUiProjectAsync(projectPath) {
383
+ const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
384
+ if (!await this.fileSystem.exists(filePath)) {
385
+ return;
386
+ }
387
+ const raw = await this.fileSystem.readFile(filePath);
388
+ if (!raw) {
389
+ return;
390
+ }
391
+ const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
392
+ return JSON.parse(json);
393
+ }
394
+ async dispose() {}
395
+ }
396
+ // ../packager/packager-core/src/services/solution-tool.ts
397
+ class SolutionTool {
398
+ fileSystem;
399
+ logger;
400
+ constructor(fileSystem, logger) {
401
+ this.fileSystem = fileSystem;
402
+ this.logger = logger;
403
+ }
404
+ async restoreAsync(_options, _cancellationToken) {
405
+ this.logger.info("Restore operation is a noop");
406
+ return ToolResult.success();
407
+ }
408
+ async validateAsync(_options, _cancellationToken) {
409
+ this.logger.info("Validate operation is a noop");
410
+ return ToolResult.success();
411
+ }
412
+ async buildAsync(_options, _cancellationToken) {
413
+ this.logger.info("Build operation is a noop");
414
+ return ToolResult.success();
415
+ }
416
+ async packAsync(_options, _cancellationToken) {
417
+ this.logger.info("Pack operation is a noop");
418
+ return ToolResult.success();
419
+ }
420
+ dispose() {}
421
+ }
422
+ // ../packager/packager-core/src/filesystem/temporary-storage-service.ts
423
+ class TemporaryStorageService {
424
+ fileSystem;
425
+ _tempFolderPath = null;
426
+ constructor(fileSystem) {
427
+ this.fileSystem = fileSystem;
428
+ }
429
+ async getTempFolderPath() {
430
+ if (!this._tempFolderPath) {
431
+ const systemTempDir = await this.fileSystem.getTempDir();
432
+ const uniqueFolderName = this.generateUniqueFolderName();
433
+ this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
434
+ await this.fileSystem.mkdir(this._tempFolderPath);
435
+ }
436
+ return this._tempFolderPath;
437
+ }
438
+ generateUniqueFolderName() {
439
+ const timestamp = Date.now();
440
+ const random = Math.random().toString(36).substring(2, 10);
441
+ return `tool-temp-${timestamp}-${random}`;
442
+ }
443
+ async getTempSubfolderPathAsync(subfolder) {
444
+ const tempFolderPath = await this.getTempFolderPath();
445
+ const inputPath = Path.join(tempFolderPath, subfolder);
446
+ await this.fileSystem.mkdir(inputPath);
447
+ return inputPath;
448
+ }
449
+ async cleanup() {
450
+ try {
451
+ if (!this._tempFolderPath) {
452
+ return;
453
+ }
454
+ try {
455
+ const stats = await this.fileSystem.stat(this._tempFolderPath);
456
+ if (!stats) {
457
+ return;
458
+ }
459
+ } catch {
460
+ return;
461
+ }
462
+ const _pathToCleanup = this._tempFolderPath;
463
+ await this.fileSystem.rm(this._tempFolderPath);
464
+ this._tempFolderPath = null;
465
+ } catch {}
466
+ }
467
+ }
468
+ // ../packager/packager-core/src/filesystem/zip-service.ts
469
+ class ZipService {
470
+ fileSystem;
471
+ constructor(fileSystem) {
472
+ this.fileSystem = fileSystem;
473
+ }
474
+ async extractAsync(zipData, targetPath) {
475
+ const normalizedTarget = targetPath.replace(/\/$/, "");
476
+ const files = unzipSync(zipData);
477
+ const dirsToCreate = new Set([normalizedTarget]);
478
+ const filesToWrite = [];
479
+ const extractedPaths = [];
480
+ for (const [relativePath, data] of Object.entries(files)) {
481
+ if (relativePath.endsWith("/") || data.length === 0) {
482
+ const dirPath = `${normalizedTarget}/${relativePath.replace(/\/$/, "")}`;
483
+ if (!dirPath.startsWith(`${normalizedTarget}/`)) {
484
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
485
+ }
486
+ dirsToCreate.add(dirPath);
487
+ continue;
488
+ }
489
+ const fullPath = `${normalizedTarget}/${relativePath}`;
490
+ if (!fullPath.startsWith(`${normalizedTarget}/`)) {
491
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
492
+ }
493
+ const parentDir = fullPath.split("/").slice(0, -1).join("/");
494
+ if (parentDir) {
495
+ dirsToCreate.add(parentDir);
496
+ }
497
+ filesToWrite.push({ path: fullPath, data });
498
+ extractedPaths.push(fullPath);
499
+ }
500
+ await Promise.all(Array.from(dirsToCreate, (dir) => this.fileSystem.mkdir(dir)));
501
+ await Promise.all(filesToWrite.map(({ path, data }) => this.fileSystem.writeFile(path, data)));
502
+ return extractedPaths;
503
+ }
504
+ async compressAsync(sourcePath) {
505
+ const normalizedSource = sourcePath.replace(/\/$/, "");
506
+ const entries = await Path.walkDirectory(this.fileSystem, normalizedSource);
507
+ const fileContents = await Promise.all(entries.map(async (entry) => ({
508
+ relativePath: entry.relativePath,
509
+ data: await this.fileSystem.readFile(entry.absolutePath)
510
+ })));
511
+ const zippable = {};
512
+ for (const { relativePath, data } of fileContents) {
513
+ if (data) {
514
+ zippable[relativePath] = data;
515
+ }
516
+ }
517
+ const zipData = zipSync(zippable, {
518
+ level: 6
519
+ });
520
+ return zipData;
521
+ }
522
+ compressEntries(entries) {
523
+ return zipSync(entries, { level: 6 });
524
+ }
525
+ }
70
526
  // ../packager/packager-core/src/i18n/types.ts
71
527
  function isPluralForm(value) {
72
528
  return typeof value === "object" && value !== null && "other" in value;
@@ -890,6 +1346,98 @@ I18nManager.registerTranslations("zh-cn", zh_CN);
890
1346
  I18nManager.registerTranslations("zh-tw", zh_TW);
891
1347
  I18nManager.registerTranslations("zu", zu);
892
1348
  I18nManager.setLocale("en");
893
- export { ToolResult, toolsFactoryRepository };
1349
+ // ../packager/packager-core/src/models/ignored-rules.ts
1350
+ function normalizeIgnoredRules(ignoredRules) {
1351
+ const rules = (ignoredRules ?? []).flatMap((rule) => rule.split(",")).map((rule) => rule.trim()).filter((rule) => rule.length > 0);
1352
+ return [...new Set(rules)];
1353
+ }
1354
+ // ../packager/packager-core/src/models/log-message.ts
1355
+ class LogMessage {
1356
+ message;
1357
+ logLevel;
1358
+ source;
1359
+ sourceTarget;
1360
+ progress;
1361
+ code;
1362
+ filePath;
1363
+ line;
1364
+ id;
1365
+ timestamp;
1366
+ constructor(message, logLevel, options, timestamp) {
1367
+ this.message = message;
1368
+ this.logLevel = LogMessage.toLogLevel(logLevel);
1369
+ this.source = options?.source;
1370
+ this.sourceTarget = options?.sourceTarget;
1371
+ this.progress = options?.progress;
1372
+ this.code = options?.code;
1373
+ this.filePath = options?.filePath;
1374
+ this.line = options?.line;
1375
+ this.id = options?.id;
1376
+ this.timestamp = LogMessage.resolveTimestamp(timestamp);
1377
+ }
1378
+ static resolveTimestamp(timestamp) {
1379
+ if (timestamp instanceof Date) {
1380
+ return timestamp;
1381
+ }
1382
+ if (timestamp === undefined || timestamp === null) {
1383
+ return new Date;
1384
+ }
1385
+ const parsed = new Date(timestamp);
1386
+ if (Number.isNaN(parsed.getTime())) {
1387
+ console.error(`[LogMessage] invalid timestamp "${timestamp}", defaulting to now`);
1388
+ return new Date;
1389
+ }
1390
+ return parsed;
1391
+ }
1392
+ static toLogLevel(level) {
1393
+ switch (level) {
1394
+ case "Verbose":
1395
+ case "Trace":
1396
+ case "Debug":
1397
+ return "Debug" /* Debug */;
1398
+ case "Warn":
1399
+ case "Warning":
1400
+ return "Warning" /* Warn */;
1401
+ case "Error":
1402
+ case "Critical":
1403
+ return "Error" /* Error */;
1404
+ default:
1405
+ return "Information" /* Info */;
1406
+ }
1407
+ }
1408
+ toFormattedString() {
1409
+ const parts = [];
1410
+ parts.push(`[${this.timestamp.toISOString()}]`);
1411
+ parts.push(`[${String(this.logLevel).toUpperCase()}]`);
1412
+ if (this.source) {
1413
+ parts.push(`[${this.source}]`);
1414
+ }
1415
+ if (this.sourceTarget) {
1416
+ parts.push(`[${this.sourceTarget}]`);
1417
+ }
1418
+ const locationParts = [];
1419
+ if (this.filePath) {
1420
+ locationParts.push(this.filePath);
1421
+ }
1422
+ if (this.line) {
1423
+ locationParts.push(`Line:${this.line}`);
1424
+ }
1425
+ if (this.id) {
1426
+ locationParts.push(`Id:${this.id}`);
1427
+ }
1428
+ if (locationParts.length > 0) {
1429
+ parts.push(`(${locationParts.join("")})`);
1430
+ }
1431
+ if (this.code) {
1432
+ parts.push(`[${this.code}]`);
1433
+ }
1434
+ if (this.progress || this.progress === 0) {
1435
+ parts.push(`${this.progress}%`);
1436
+ }
1437
+ parts.push(this.message);
1438
+ return parts.join(" ");
1439
+ }
1440
+ }
1441
+ export { Path, TemporaryStorageService, ZipService, I18nManager, translate, normalizeIgnoredRules, LogMessage, NugetConstants, ToolResult, ensureProjectId, writeOrBackfillOperateProjectId, NugetPackager, ProjectTool, SolutionTool, toolsFactoryRepository };
894
1442
 
895
- //# debugId=C6B394D3F76A061364756E2164756E21
1443
+ //# debugId=7E433C7A73ED1B5664756E2164756E21