@uipath/flow-tool 1.203.0-preview.205 → 1.204.0-preview.206

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 (117) hide show
  1. package/README.md +4 -0
  2. package/dist/THIRD-PARTY-NOTICES.md +237 -2
  3. package/dist/authoring-4kyzh1tf.js +23 -0
  4. package/dist/{binding-service-ft8mabkr.js → binding-service-815skxfx.js} +28 -30
  5. package/dist/{connector-service-qnpnwzpv.js → connector-service-xw4f8a7v.js} +34 -31
  6. package/dist/{conversion-FQTRFHRX-xh98wp2q.js → conversion-FQTRFHRX-1q7rk0te.js} +5 -5
  7. package/dist/{debug-conversation-trigger-fy19ygsm.js → debug-conversation-trigger-qdgvrekh.js} +14 -16
  8. package/dist/{debug-http-client-53qk6pc5.js → debug-http-client-s78gbtbn.js} +3 -3
  9. package/dist/{debug-service-nyk0s6mc.js → debug-service-0ppdzgzv.js} +4 -4
  10. package/dist/{edge-service-an71q4ry.js → edge-service-ttzfnxkf.js} +13 -14
  11. package/dist/{embedded-file-reader-0sjt4nkj.js → embedded-file-reader-v8c2yj2a.js} +2 -2
  12. package/dist/{flow-api-2phdajnk.js → flow-api-b7k5dtpm.js} +8 -8
  13. package/dist/{flow-debug-service-bnzgj53b.js → flow-debug-service-4we602jx.js} +38 -35
  14. package/dist/{flow-eval-node-target-2mjben3g.js → flow-eval-node-target-331vzbkw.js} +14 -15
  15. package/dist/{flow-eval-run-api-1bw5e0k4.js → flow-eval-run-api-yq18x5rb.js} +4 -4
  16. package/dist/{flow-eval-run-service-qv8j8fd1.js → flow-eval-run-service-36h1bnm8.js} +40 -37
  17. package/dist/{flow-eval-service-amd02ctw.js → flow-eval-service-ndtk9f9j.js} +19 -20
  18. package/dist/flow-init-sdk-source-9fy9p8ap.js +58 -0
  19. package/dist/{flow-init-service-rnygj5f8.js → flow-init-service-kwhbdtpc.js} +19 -18
  20. package/dist/{flow-io-hddhkve5.js → flow-io-pt392xct.js} +13 -14
  21. package/dist/{flow-migrate-service-e3hm99gp.js → flow-migrate-service-xvz8pbmp.js} +14 -15
  22. package/dist/{flow-pack-service-g8jebcts.js → flow-pack-service-wg1kt2bt.js} +72 -39
  23. package/dist/flow-validate-service-xbhrj47n.js +64 -0
  24. package/dist/{governance-fetcher-cswx2cw7.js → governance-fetcher-5yy89pfd.js} +6 -5
  25. package/dist/{headless-mmnrkzve.js → headless-1pdmae01.js} +2 -2
  26. package/dist/{hitl-service-a4fmjrzh.js → hitl-service-q2d39v5s.js} +13 -14
  27. package/dist/{index-3ts7y9d3.js → index-2s8rmmw6.js} +5 -3
  28. package/dist/index-3jpjaq1g.js +26 -0
  29. package/dist/{index-t5zedby6.js → index-41vyzws2.js} +59 -27
  30. package/dist/{index-b46bavh7.js → index-5yw15y73.js} +2 -2
  31. package/dist/{index-212q16sv.js → index-7qw3ttge.js} +416 -87
  32. package/dist/{index-t8e0ft8r.js → index-c1q6mnw1.js} +3 -3
  33. package/dist/{index-xa7gm52r.js → index-dqqg54v6.js} +601 -61
  34. package/dist/index.js +10 -10
  35. package/dist/init.d.ts +1 -1
  36. package/dist/init.js +19 -18
  37. package/dist/{input-reader-tw0j373f.js → input-reader-bv7kt19c.js} +2 -2
  38. package/dist/{known-types-b64as10y.js → known-types-jhyhnkt6.js} +4 -4
  39. package/dist/{maestro-automate-entry-pqy9xqm3.js → maestro-automate-entry-qak46eg0.js} +2 -2
  40. package/dist/node-2whm5wkf.js +4823 -0
  41. package/dist/{node-service-qnny15cm.js → node-service-js01ft95.js} +31 -30
  42. package/dist/{node-strategy-gc4sg6a2.js → node-strategy-fdnkvq4a.js} +1 -1
  43. package/dist/{node-sync-service-f1x1ak6q.js → node-sync-service-pb3m4dp2.js} +9 -9
  44. package/dist/{packager-tool-et7wj8kr.js → packager-tool-0w4es6rz.js} +2 -2
  45. package/dist/{packager-tool-dph5p2f5.js → packager-tool-1mnq1c97.js} +1 -1
  46. package/dist/packager-tool-225z77w9.js +52 -0
  47. package/dist/{packager-tool-de2txaxx.js → packager-tool-2hzsf1rc.js} +5 -5
  48. package/dist/{packager-tool-vbser1d9.js → packager-tool-2qr8z5ke.js} +4 -4
  49. package/dist/{packager-tool-0egkaa38.js → packager-tool-32czz9mq.js} +2 -2
  50. package/dist/{packager-tool-0v3s8r01.js → packager-tool-3h2ktz6q.js} +2 -2
  51. package/dist/{packager-tool-h9d8c9rf.js → packager-tool-4zdhy0c3.js} +2 -2
  52. package/dist/{packager-tool-afd1wwf2.js → packager-tool-53c81nnr.js} +440 -29
  53. package/dist/{packager-tool-2c688mdj.js → packager-tool-57fak54h.js} +4 -4
  54. package/dist/{packager-tool-qa2xzxez.js → packager-tool-59s95scr.js} +1 -1
  55. package/dist/{packager-tool-n8p9cay6.js → packager-tool-6azk3rex.js} +1 -1
  56. package/dist/{packager-tool-26ydwf12.js → packager-tool-6h69pd2a.js} +23 -8
  57. package/dist/{packager-tool-mnrbdn6a.js → packager-tool-6scjsgh6.js} +55 -17
  58. package/dist/{packager-tool-xzf4xc65.js → packager-tool-70cta0be.js} +4 -4
  59. package/dist/{packager-tool-tw3j5h3z.js → packager-tool-8hj7w7em.js} +5 -5
  60. package/dist/{packager-tool-795gzq9k.js → packager-tool-8pmgk4f6.js} +1 -1
  61. package/dist/{packager-tool-321a1806.js → packager-tool-8vmx4j2w.js} +1 -1
  62. package/dist/{packager-tool-cnftzx4c.js → packager-tool-a6ph7149.js} +40 -11
  63. package/dist/{packager-tool-s0mzv3sx.js → packager-tool-aw60v0et.js} +1 -1
  64. package/dist/{packager-tool-e89k4pjj.js → packager-tool-c0rtxezv.js} +1 -1
  65. package/dist/{packager-tool-1w4f09cq.js → packager-tool-d0ny3x3b.js} +141 -96
  66. package/dist/{packager-tool-gzpvdcnw.js → packager-tool-da1cmt0q.js} +2 -2
  67. package/dist/{packager-tool-p8j4zvrq.js → packager-tool-dp8vjby4.js} +4829 -1364
  68. package/dist/packager-tool-e5hj89zm.js +6 -0
  69. package/dist/{packager-tool-fwp34rqp.js → packager-tool-ev80vk13.js} +8 -8
  70. package/dist/{packager-tool-gctpkdzs.js → packager-tool-hhy1gr2k.js} +1 -1
  71. package/dist/{packager-tool-sf9f6jft.js → packager-tool-hygq2wy6.js} +1 -1
  72. package/dist/{packager-tool-0v3tzseq.js → packager-tool-jeb6xmgw.js} +2 -2
  73. package/dist/packager-tool-krzxg3ga.js +804 -0
  74. package/dist/{packager-tool-1r5dnt9q.js → packager-tool-mv4jav1h.js} +1 -1
  75. package/dist/{packager-tool-pppzgwfw.js → packager-tool-n4vdjmjx.js} +18079 -18079
  76. package/dist/{packager-tool-t9c77psy.js → packager-tool-p1tb6d4f.js} +955 -150
  77. package/dist/{packager-tool-gs28y1eq.js → packager-tool-qhhrq12s.js} +2 -2
  78. package/dist/{packager-tool-6k8s7pt9.js → packager-tool-r7xy9sew.js} +1090 -545
  79. package/dist/{packager-tool-b1xs6aty.js → packager-tool-stq8800d.js} +902 -897
  80. package/dist/{packager-tool-61r38k4d.js → packager-tool-t57d6pzz.js} +320 -200
  81. package/dist/{packager-tool-a7t9v5ss.js → packager-tool-v9v9ch04.js} +2 -2
  82. package/dist/{packager-tool-cdn59g60.js → packager-tool-ve5t7317.js} +2 -2
  83. package/dist/{packager-tool-yxv9mm8s.js → packager-tool-vtaqtf7f.js} +10 -10
  84. package/dist/{packager-tool-t39edv0g.js → packager-tool-w3dy6vnj.js} +184 -193
  85. package/dist/{packager-tool-9kx94sj5.js → packager-tool-x5qafkb7.js} +2 -2
  86. package/dist/{packager-tool-s841bbkr.js → packager-tool-yednpbbw.js} +2 -2
  87. package/dist/{packager-tool-yxnepq2j.js → packager-tool-ysbskrta.js} +1 -1
  88. package/dist/packager-tool-zgsvggdr.js +50 -0
  89. package/dist/packager-tool.js +12 -13
  90. package/dist/{serialization-BXU6AKAN-rhgmwp06.js → serialization-BXU6AKAN-c2ge8yvb.js} +5 -5
  91. package/dist/services/flow-init-sdk-source.d.ts +28 -0
  92. package/dist/services/flow-init-service.d.ts +25 -0
  93. package/dist/services/inline-activity-service.d.ts +135 -0
  94. package/dist/services/node-service.d.ts +14 -0
  95. package/dist/services/node-validators/index.d.ts +2 -0
  96. package/dist/services/node-validators/inline-activity-validator.d.ts +18 -0
  97. package/dist/services/node-validators/types.d.ts +6 -0
  98. package/dist/services/node-validators/unresolved-binding-placeholder-validator.d.ts +2 -0
  99. package/dist/services/preview-id-rule.d.ts +33 -0
  100. package/dist/services/ui-only-node-types.d.ts +1 -0
  101. package/dist/{shared-utils-wv356cvj.js → shared-utils-9vfmrxtx.js} +2 -2
  102. package/dist/{packager-tool-es0a755k.js → tidy-service-q2wwwans.js} +33 -7
  103. package/dist/tool.js +10 -10
  104. package/dist/utils/flow-io.d.ts +3 -16
  105. package/dist/validation.js +35 -36
  106. package/dist/{variable-service-bc7920kx.js → variable-service-nm9fdwsw.js} +13 -14
  107. package/dist/{wait-for-flow-job-v0njb0dk.js → wait-for-flow-job-yzyamptd.js} +8 -8
  108. package/package.json +2 -2
  109. package/dist/authoring-tv4dh80p.js +0 -360
  110. package/dist/flow-validate-service-x9dtdrc7.js +0 -65
  111. package/dist/node-xdgxafqs.js +0 -15600
  112. package/dist/packager-tool-2513jrxr.js +0 -898
  113. package/dist/packager-tool-5kt8tsq4.js +0 -85
  114. package/dist/packager-tool-w0kr4mbc.js +0 -996
  115. package/dist/services/tidy-service.d.ts +0 -26
  116. package/dist/tidy-service-8y2tjmb5.js +0 -39
  117. /package/dist/{localization-y790z9vm.js → localization-xecwjpe2.js} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  zipSync
4
4
  } from "./packager-tool-nkrmjr3a.js";
5
5
 
6
- // ../packager/packager-core/dist/index.js
6
+ // ../packager/packager-core/src/filesystem/path.ts
7
7
  class Path {
8
8
  static normalize(path) {
9
9
  return path.replace(/\\/g, "/").replace(/\/+/g, "/");
@@ -59,420 +59,636 @@ class Path {
59
59
  }
60
60
  }
61
61
 
62
- class TemporaryStorageService {
63
- fileSystem;
64
- _tempFolderPath = null;
65
- constructor(fileSystem) {
66
- this.fileSystem = fileSystem;
62
+ // ../packager/packager-core/src/services/project-id.ts
63
+ var OPERATE_FILE = "operate.json";
64
+ var PROJECT_FILE = "project.json";
65
+ function isNonEmptyString(value) {
66
+ return typeof value === "string" && value.length > 0;
67
+ }
68
+ async function readJsonObject(fs, filePath) {
69
+ let content;
70
+ try {
71
+ content = await fs.readFile(filePath, "utf-8");
72
+ } catch {
73
+ return;
67
74
  }
68
- async getTempFolderPath() {
69
- if (!this._tempFolderPath) {
70
- const systemTempDir = await this.fileSystem.getTempDir();
71
- const uniqueFolderName = this.generateUniqueFolderName();
72
- this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
73
- await this.fileSystem.mkdir(this._tempFolderPath);
75
+ if (content === null) {
76
+ return;
77
+ }
78
+ try {
79
+ const parsed = JSON.parse(content);
80
+ if (parsed === null || typeof parsed !== "object") {
81
+ return;
74
82
  }
75
- return this._tempFolderPath;
83
+ return parsed;
84
+ } catch {
85
+ return;
76
86
  }
77
- generateUniqueFolderName() {
78
- const timestamp = Date.now();
79
- const random = Math.random().toString(36).substring(2, 10);
80
- return `tool-temp-${timestamp}-${random}`;
87
+ }
88
+ async function writeJsonObject(fs, filePath, data) {
89
+ await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
90
+ `);
91
+ }
92
+ async function ensureProjectId(projectPath, fs) {
93
+ const operatePath = Path.join(projectPath, OPERATE_FILE);
94
+ const operateExists = await fs.exists(operatePath);
95
+ if (operateExists) {
96
+ const operate = await readJsonObject(fs, operatePath);
97
+ if (operate && isNonEmptyString(operate.projectId)) {
98
+ return operate.projectId;
99
+ }
100
+ if (operate) {
101
+ const id = crypto.randomUUID();
102
+ await writeJsonObject(fs, operatePath, {
103
+ ...operate,
104
+ projectId: id
105
+ });
106
+ return id;
107
+ }
108
+ return crypto.randomUUID();
81
109
  }
82
- async getTempSubfolderPathAsync(subfolder) {
83
- const tempFolderPath = await this.getTempFolderPath();
84
- const inputPath = Path.join(tempFolderPath, subfolder);
85
- await this.fileSystem.mkdir(inputPath);
86
- return inputPath;
110
+ const projectFilePath = Path.join(projectPath, PROJECT_FILE);
111
+ const projectFileExists = await fs.exists(projectFilePath);
112
+ if (projectFileExists) {
113
+ const projectFile = await readJsonObject(fs, projectFilePath);
114
+ if (projectFile && isNonEmptyString(projectFile.projectId)) {
115
+ return projectFile.projectId;
116
+ }
117
+ if (projectFile) {
118
+ const id = crypto.randomUUID();
119
+ await writeJsonObject(fs, projectFilePath, {
120
+ ...projectFile,
121
+ projectId: id
122
+ });
123
+ return id;
124
+ }
125
+ return crypto.randomUUID();
87
126
  }
88
- async cleanup() {
89
- try {
90
- if (!this._tempFolderPath) {
91
- return;
92
- }
93
- try {
94
- const stats = await this.fileSystem.stat(this._tempFolderPath);
95
- if (!stats) {
96
- return;
97
- }
98
- } catch {
99
- return;
100
- }
101
- const _pathToCleanup = this._tempFolderPath;
102
- await this.fileSystem.rm(this._tempFolderPath);
103
- this._tempFolderPath = null;
104
- } catch {}
127
+ return crypto.randomUUID();
128
+ }
129
+ async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
130
+ if (!await fs.exists(operateFilePath)) {
131
+ return;
132
+ }
133
+ const parsed = await readJsonObject(fs, operateFilePath);
134
+ if (!parsed) {
135
+ return;
136
+ }
137
+ if (isNonEmptyString(parsed.projectId)) {
138
+ return;
105
139
  }
140
+ await writeJsonObject(fs, operateFilePath, {
141
+ ...parsed,
142
+ projectId: fallbackProjectId
143
+ });
106
144
  }
107
-
108
- class ZipService {
109
- fileSystem;
110
- constructor(fileSystem) {
111
- this.fileSystem = fileSystem;
145
+ async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
146
+ if (await fs.exists(operateFilePath)) {
147
+ await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
148
+ return;
112
149
  }
113
- async extractAsync(zipData, targetPath) {
114
- const normalizedTarget = targetPath.replace(/\/$/, "");
115
- const files = unzipSync(zipData);
116
- const dirsToCreate = new Set([normalizedTarget]);
117
- const filesToWrite = [];
118
- const extractedPaths = [];
119
- for (const [relativePath, data] of Object.entries(files)) {
120
- if (relativePath.endsWith("/") || data.length === 0) {
121
- const dirPath = `${normalizedTarget}/${relativePath.replace(/\/$/, "")}`;
122
- if (!dirPath.startsWith(`${normalizedTarget}/`)) {
123
- throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
150
+ await createIfMissing();
151
+ }
152
+
153
+ // ../packager/packager-core/src/services/tools-factory-repository.ts
154
+ class ToolsFactoryRepository {
155
+ projectFactoryMap = new Map;
156
+ solutionFactory = null;
157
+ registerProjectToolFactory(factory) {
158
+ for (const type of factory.supportedTypes) {
159
+ const existing = this.projectFactoryMap.get(type);
160
+ if (existing) {
161
+ if (existing.constructor?.name !== factory.constructor?.name) {
162
+ console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
124
163
  }
125
- dirsToCreate.add(dirPath);
126
164
  continue;
127
165
  }
128
- const fullPath = `${normalizedTarget}/${relativePath}`;
129
- if (!fullPath.startsWith(`${normalizedTarget}/`)) {
130
- throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
131
- }
132
- const parentDir = fullPath.split("/").slice(0, -1).join("/");
133
- if (parentDir) {
134
- dirsToCreate.add(parentDir);
135
- }
136
- filesToWrite.push({ path: fullPath, data });
137
- extractedPaths.push(fullPath);
138
- }
139
- await Promise.all(Array.from(dirsToCreate, (dir) => this.fileSystem.mkdir(dir)));
140
- await Promise.all(filesToWrite.map(({ path, data }) => this.fileSystem.writeFile(path, data)));
141
- return extractedPaths;
142
- }
143
- async compressAsync(sourcePath) {
144
- const normalizedSource = sourcePath.replace(/\/$/, "");
145
- const entries = await Path.walkDirectory(this.fileSystem, normalizedSource);
146
- const fileContents = await Promise.all(entries.map(async (entry) => ({
147
- relativePath: entry.relativePath,
148
- data: await this.fileSystem.readFile(entry.absolutePath)
149
- })));
150
- const zippable = {};
151
- for (const { relativePath, data } of fileContents) {
152
- if (data) {
153
- zippable[relativePath] = data;
154
- }
166
+ this.projectFactoryMap.set(type, factory);
155
167
  }
156
- const zipData = zipSync(zippable, {
157
- level: 6
158
- });
159
- return zipData;
160
- }
161
- compressEntries(entries) {
162
- return zipSync(entries, { level: 6 });
163
168
  }
164
- }
165
- function isPluralForm(value) {
166
- return typeof value === "object" && value !== null && "other" in value;
167
- }
168
- function selectPluralForm(forms, count) {
169
- if (count === 0 && forms.zero !== undefined) {
170
- return forms.zero;
169
+ registerSolutionToolFactory(factory) {
170
+ this.solutionFactory = factory;
171
171
  }
172
- if (count === 1 && forms.one !== undefined) {
173
- return forms.one;
172
+ getSolutionToolFactory() {
173
+ if (!this.solutionFactory) {
174
+ throw new Error("No solution tool factory is registered");
175
+ }
176
+ return this.solutionFactory;
174
177
  }
175
- if (count === 2 && forms.two !== undefined) {
176
- return forms.two;
178
+ canHandleProject(projectType) {
179
+ return this.projectFactoryMap.has(projectType);
177
180
  }
178
- if (forms.few !== undefined) {
179
- const mod10 = count % 10;
180
- const mod100 = count % 100;
181
- if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
182
- return forms.few;
181
+ getProjectToolFactory(projectType) {
182
+ const factory = this.projectFactoryMap.get(projectType);
183
+ if (!factory) {
184
+ throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
183
185
  }
186
+ return factory;
184
187
  }
185
- if (forms.many !== undefined) {
186
- const mod10 = count % 10;
187
- const mod100 = count % 100;
188
- if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
189
- return forms.many;
190
- }
188
+ reset() {
189
+ this.projectFactoryMap.clear();
190
+ this.solutionFactory = null;
191
191
  }
192
- return forms.other;
193
192
  }
193
+ var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
194
+ var _global = globalThis;
195
+ if (!_global[REGISTRY_KEY]) {
196
+ _global[REGISTRY_KEY] = new ToolsFactoryRepository;
197
+ }
198
+ var toolsFactoryRepository = _global[REGISTRY_KEY];
194
199
 
195
- class I18nManager {
196
- static translations = {};
197
- static currentLocale = "en";
198
- static fallbackLocale = "en";
199
- static registerTranslations(locale, catalog) {
200
- if (!I18nManager.translations[locale]) {
201
- I18nManager.translations[locale] = {};
202
- }
203
- I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
200
+ // ../packager/packager-core/src/models/nuget-constants.ts
201
+ var NugetConstants = {
202
+ OutputFolderName: "bundle",
203
+ ContentFolderName: "content",
204
+ OperateFileName: "operate.json",
205
+ EntryPointsFileName: "entry-points.json",
206
+ PackageDescriptorFileName: "package-descriptor.json",
207
+ BindingsV2FileName: "bindings_v2.json",
208
+ BindingsFileId: "bindings.json"
209
+ };
210
+
211
+ // ../packager/packager-core/src/services/content-operate-file.ts
212
+ var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
213
+ async function resolveEntryPointMain(fs, sourceFolder) {
214
+ const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
215
+ if (!await fs.exists(entryPointsFilePath)) {
216
+ return "";
204
217
  }
205
- static setLocale(locale) {
206
- const normalized = I18nManager.normalizeLocale(locale);
207
- if (I18nManager.translations[normalized]) {
208
- I18nManager.currentLocale = normalized;
209
- return normalized;
210
- }
211
- const baseLocale = normalized.split("-")[0];
212
- if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
213
- I18nManager.currentLocale = baseLocale;
214
- return baseLocale;
215
- }
216
- return I18nManager.currentLocale;
217
- }
218
- static getLocale() {
219
- return I18nManager.currentLocale;
218
+ const content = await fs.readFile(entryPointsFilePath);
219
+ if (!content) {
220
+ return "";
220
221
  }
221
- static setFallbackLocale(locale) {
222
- I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
222
+ try {
223
+ const parsed = JSON.parse(new TextDecoder().decode(content));
224
+ return parsed.entryPoints?.[0]?.filePath ?? "";
225
+ } catch {
226
+ return "";
223
227
  }
224
- static t(key, params, locale) {
225
- const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
226
- let value = I18nManager.getTranslationValue(key, targetLocale);
227
- if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
228
- value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
229
- }
230
- if (value === undefined) {
231
- return key;
232
- }
233
- if (isPluralForm(value) && params && "count" in params) {
234
- const count = typeof params.count === "number" ? params.count : Number(params.count);
235
- value = selectPluralForm(value, count);
236
- } else if (isPluralForm(value)) {
237
- value = value.other;
238
- }
239
- if (typeof value !== "string") {
240
- return key;
241
- }
242
- return params ? I18nManager.interpolate(value, params) : value;
228
+ }
229
+ async function writeContentOperateFile(fs, params) {
230
+ const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
231
+ await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
232
+ const main = await resolveEntryPointMain(fs, params.contentFolder);
233
+ const operateFileModel = {
234
+ $schema: OPERATE_SCHEMA,
235
+ contentType: params.contentType,
236
+ projectId: params.projectId,
237
+ main,
238
+ targetFramework: "Portable",
239
+ runtimeOptions: {
240
+ isAttended: false,
241
+ requiresUserInteraction: false
242
+ }
243
+ };
244
+ await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
245
+ });
246
+ }
247
+ // ../packager/packager-core/src/services/nuget-packager.ts
248
+ function escapeXml(str) {
249
+ if (str === null || str === undefined) {
250
+ return "";
243
251
  }
244
- static has(key, locale) {
245
- const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
246
- const value = I18nManager.getTranslationValue(key, targetLocale);
247
- if (value !== undefined) {
248
- return true;
249
- }
250
- if (targetLocale !== I18nManager.fallbackLocale) {
251
- return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
252
- }
253
- return false;
252
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
253
+ }
254
+ function optionalElement(name, value) {
255
+ if (value === undefined || value === "")
256
+ return "";
257
+ return ` <${name}>${escapeXml(value)}</${name}>
258
+ `;
259
+ }
260
+ function generateDependenciesXml(dependencies) {
261
+ if (!dependencies || dependencies.length === 0)
262
+ return "";
263
+ const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
264
+ `);
265
+ return ` <dependencies>
266
+ ${deps}
267
+ </dependencies>
268
+ `;
269
+ }
270
+ function generateRepositoryXml(packageInfo) {
271
+ if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
272
+ return "";
273
+ let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
274
+ if (packageInfo.repositoryBranch) {
275
+ repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
254
276
  }
255
- static getAvailableLocales() {
256
- return Object.keys(I18nManager.translations);
277
+ if (packageInfo.repositoryCommit) {
278
+ repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
257
279
  }
258
- static clearTranslations() {
259
- I18nManager.translations = {};
260
- I18nManager.currentLocale = "en";
280
+ repoXml += ` />
281
+ `;
282
+ return repoXml;
283
+ }
284
+ function generateNuspecXml(packageInfo) {
285
+ const author = packageInfo.author?.trim() || "UiPath";
286
+ const description = packageInfo.description?.trim() || "Created by UiPath";
287
+ const title = packageInfo.title?.trim() || packageInfo.id;
288
+ const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
289
+ const releaseNotes = packageInfo.releaseNotes ?? "";
290
+ const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
291
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
292
+ <metadata>
293
+ <id>${escapeXml(packageInfo.id)}</id>
294
+ <version>${escapeXml(packageInfo.version)}</version>
295
+ <title>${escapeXml(title)}</title>
296
+ <authors>${escapeXml(author)}</authors>
297
+ <requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
298
+ <description>${escapeXml(description)}</description>
299
+ <releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
300
+ ${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>
301
+ </package>
302
+ `;
303
+ return xml;
304
+ }
305
+ function generatePsmdcpXml(packageInfo) {
306
+ const author = packageInfo.author?.trim() || "UiPath";
307
+ const description = packageInfo.description?.trim() || "Created by UiPath";
308
+ return `<?xml version="1.0" encoding="utf-8"?>
309
+ <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">
310
+ <dc:creator>${escapeXml(author)}</dc:creator>
311
+ <dc:description>${escapeXml(description)}</dc:description>
312
+ <dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
313
+ <version>${escapeXml(packageInfo.version)}</version>
314
+ <keywords></keywords>
315
+ <lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
316
+ </coreProperties>`;
317
+ }
318
+
319
+ class NugetPackager {
320
+ fileSystem;
321
+ constructor(fileSystem) {
322
+ this.fileSystem = fileSystem;
261
323
  }
262
- static getTranslationValue(key, locale) {
263
- const catalog = I18nManager.translations[locale];
264
- if (!catalog) {
265
- return;
266
- }
267
- const keys = key.split(".");
268
- let value = catalog;
269
- for (const k of keys) {
270
- if (value && typeof value === "object" && k in value) {
271
- value = value[k];
272
- } else {
273
- return;
324
+ async packAsync(rootPath, packageInfo, outputPath) {
325
+ const normalizedOutputPath = Path.normalize(outputPath);
326
+ const nuspecXml = generateNuspecXml(packageInfo);
327
+ const nuspecFileName = `${packageInfo.id}.nuspec`;
328
+ const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
329
+ const zipContents = {};
330
+ const encoder = new TextEncoder;
331
+ const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
332
+ const psmdcpFileName = `${psmdcpId}.psmdcp`;
333
+ const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
334
+ const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
335
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
336
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
337
+ <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
338
+ <Default Extension="uiproj" ContentType="application/octet" />
339
+ <Default Extension="json" ContentType="application/octet" />
340
+ <Default Extension="nuspec" ContentType="application/octet" />
341
+ </Types>`;
342
+ zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
343
+ const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
344
+ const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
345
+ const relsXml = `<?xml version="1.0" encoding="utf-8"?>
346
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
347
+ <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
348
+ <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
349
+ </Relationships>`;
350
+ zipContents["_rels/.rels"] = encoder.encode(relsXml);
351
+ zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
352
+ zipContents[nuspecFileName] = encoder.encode(nuspecXml);
353
+ for (const entry of fileEntries) {
354
+ const content = await this.fileSystem.readFile(entry.absolutePath);
355
+ if (content !== null) {
356
+ zipContents[entry.relativePath] = content;
274
357
  }
275
358
  }
276
- return value;
359
+ const zippedData = zipSync(zipContents);
360
+ await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
361
+ return {
362
+ outputPath: normalizedOutputPath
363
+ };
277
364
  }
278
- static interpolate(template, params) {
279
- return template.replace(/\{(\w+)\}/g, (_, key) => {
280
- const value = params[key];
281
- return value !== undefined ? String(value) : `{${key}}`;
282
- });
365
+ }
366
+ // ../packager/packager-core/src/models/tool-result.ts
367
+ class ToolResult {
368
+ errorCode;
369
+ message;
370
+ packages;
371
+ details;
372
+ instructions;
373
+ constructor(errorCode, message, packages = [], instructions) {
374
+ this.errorCode = errorCode;
375
+ this.message = message;
376
+ this.packages = packages;
377
+ this.instructions = instructions;
283
378
  }
284
- static normalizeLocale(locale) {
285
- const normalized = locale.toLowerCase().replace(/_/g, "-");
286
- const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
287
- if (specialLocales.includes(normalized)) {
288
- return normalized;
289
- }
290
- return normalized.split("-")[0];
379
+ get isSuccess() {
380
+ return this.errorCode === "SUCCESS" /* Success */;
291
381
  }
292
- static deepMerge(target, source) {
293
- const result = { ...target };
294
- for (const key of Object.keys(source)) {
295
- const sourceValue = source[key];
296
- const targetValue = result[key];
297
- if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
298
- result[key] = I18nManager.deepMerge(targetValue, sourceValue);
299
- } else {
300
- result[key] = sourceValue;
301
- }
302
- }
303
- return result;
382
+ static success() {
383
+ return new ToolResult("SUCCESS" /* Success */);
384
+ }
385
+ static error(errorCode, message, instructions) {
386
+ return new ToolResult(errorCode, message, [], instructions);
304
387
  }
305
388
  }
306
- var de = {
307
- toolCore: {
308
- errors: {
309
- internal: "Internal error: {message}",
310
- fileNotFound: "File not found: {path}",
311
- fileReadFailed: "Failed to read file: {path}",
312
- fileWriteFailed: "Failed to write file: {path}",
313
- directoryNotFound: "Directory not found: {path}",
314
- invalidPath: "{path} is not a valid path",
315
- operationCanceled: "Operation was canceled",
316
- invalidParameter: "Invalid parameter: {parameter}"
317
- },
318
- progress: {
319
- copying: "Copying files...",
320
- building: "Building project...",
321
- packaging: "Creating package...",
322
- validating: "Validating...",
323
- analyzing: "Analyzing...",
324
- restoring: "Restoring dependencies..."
325
- },
326
- validation: {
327
- requiredField: "{field} is required",
328
- invalidValue: "Invalid value for {field}",
329
- pathNotFound: "Path not found: {path}",
330
- fileRequired: "File is required: {path}",
331
- directoryRequired: "Directory is required: {path}"
332
- },
333
- warnings: {
334
- factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
335
- },
336
- info: {
337
- operationComplete: "Operation completed successfully",
338
- filesProcessed: {
339
- zero: "No files processed",
340
- one: "{count} file processed",
341
- other: "{count} files processed"
342
- }
389
+
390
+ // ../packager/packager-core/src/services/project-tool.ts
391
+ class ProjectTool {
392
+ fileSystem;
393
+ logger;
394
+ static ProjectFileName = "project.uiproj";
395
+ constructor(fileSystem, logger) {
396
+ this.fileSystem = fileSystem;
397
+ this.logger = logger;
398
+ }
399
+ async restoreAsync(_options, _cancellationToken) {
400
+ this.logger.info("Restore operation is a noop");
401
+ return ToolResult.success();
402
+ }
403
+ async validateAsync(_options, _cancellationToken) {
404
+ this.logger.info("Validate operation is a noop");
405
+ return ToolResult.success();
406
+ }
407
+ async buildAsync(_options, _cancellationToken) {
408
+ this.logger.info("Build operation is a noop");
409
+ return ToolResult.success();
410
+ }
411
+ async packAsync(_options, _cancellationToken) {
412
+ this.logger.info("Pack operation is a noop");
413
+ return ToolResult.success();
414
+ }
415
+ async cleanupAsync(_options, _cancellationToken) {
416
+ this.logger.info("Cleanup operation is a noop");
417
+ return ToolResult.success();
418
+ }
419
+ async getUiProjectAsync(projectPath) {
420
+ const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
421
+ if (!await this.fileSystem.exists(filePath)) {
422
+ return;
423
+ }
424
+ const raw = await this.fileSystem.readFile(filePath);
425
+ if (!raw) {
426
+ return;
343
427
  }
428
+ const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
429
+ return JSON.parse(json);
344
430
  }
345
- };
346
- var en = {
347
- toolCore: {
348
- errors: {
349
- internal: "Internal error: {message}",
350
- fileNotFound: "File not found: {path}",
351
- fileReadFailed: "Failed to read file: {path}",
352
- fileWriteFailed: "Failed to write file: {path}",
353
- directoryNotFound: "Directory not found: {path}",
354
- invalidPath: "{path} is not a valid path",
355
- operationCanceled: "Operation was canceled",
356
- invalidParameter: "Invalid parameter: {parameter}"
357
- },
358
- progress: {
359
- copying: "Copying files...",
360
- building: "Building project...",
361
- packaging: "Creating package...",
362
- validating: "Validating...",
363
- analyzing: "Analyzing...",
364
- restoring: "Restoring dependencies..."
365
- },
366
- validation: {
367
- requiredField: "{field} is required",
368
- invalidValue: "Invalid value for {field}",
369
- pathNotFound: "Path not found: {path}",
370
- fileRequired: "File is required: {path}",
371
- directoryRequired: "Directory is required: {path}"
372
- },
373
- warnings: {
374
- factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
375
- },
376
- info: {
377
- operationComplete: "Operation completed successfully",
378
- filesProcessed: {
379
- zero: "No files processed",
380
- one: "{count} file processed",
381
- other: "{count} files processed"
382
- }
431
+ async dispose() {}
432
+ }
433
+ // ../packager/packager-core/src/filesystem/temporary-storage-service.ts
434
+ class TemporaryStorageService {
435
+ fileSystem;
436
+ _tempFolderPath = null;
437
+ constructor(fileSystem) {
438
+ this.fileSystem = fileSystem;
439
+ }
440
+ async getTempFolderPath() {
441
+ if (!this._tempFolderPath) {
442
+ const systemTempDir = await this.fileSystem.getTempDir();
443
+ const uniqueFolderName = this.generateUniqueFolderName();
444
+ this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
445
+ await this.fileSystem.mkdir(this._tempFolderPath);
383
446
  }
447
+ return this._tempFolderPath;
384
448
  }
385
- };
386
- var es = {
387
- toolCore: {
388
- errors: {
389
- internal: "Internal error: {message}",
390
- fileNotFound: "File not found: {path}",
391
- fileReadFailed: "Failed to read file: {path}",
392
- fileWriteFailed: "Failed to write file: {path}",
393
- directoryNotFound: "Directory not found: {path}",
394
- invalidPath: "{path} is not a valid path",
395
- operationCanceled: "Operation was canceled",
396
- invalidParameter: "Invalid parameter: {parameter}"
397
- },
398
- progress: {
399
- copying: "Copying files...",
400
- building: "Building project...",
401
- packaging: "Creating package...",
402
- validating: "Validating...",
403
- analyzing: "Analyzing...",
404
- restoring: "Restoring dependencies..."
405
- },
406
- validation: {
407
- requiredField: "{field} is required",
408
- invalidValue: "Invalid value for {field}",
409
- pathNotFound: "Path not found: {path}",
410
- fileRequired: "File is required: {path}",
411
- directoryRequired: "Directory is required: {path}"
412
- },
413
- warnings: {
414
- factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
415
- },
416
- info: {
417
- operationComplete: "Operation completed successfully",
418
- filesProcessed: {
419
- zero: "No files processed",
420
- one: "{count} file processed",
421
- other: "{count} files processed"
449
+ generateUniqueFolderName() {
450
+ const timestamp = Date.now();
451
+ const random = Math.random().toString(36).substring(2, 10);
452
+ return `tool-temp-${timestamp}-${random}`;
453
+ }
454
+ async getTempSubfolderPathAsync(subfolder) {
455
+ const tempFolderPath = await this.getTempFolderPath();
456
+ const inputPath = Path.join(tempFolderPath, subfolder);
457
+ await this.fileSystem.mkdir(inputPath);
458
+ return inputPath;
459
+ }
460
+ async cleanup() {
461
+ try {
462
+ if (!this._tempFolderPath) {
463
+ return;
422
464
  }
423
- }
465
+ try {
466
+ const stats = await this.fileSystem.stat(this._tempFolderPath);
467
+ if (!stats) {
468
+ return;
469
+ }
470
+ } catch {
471
+ return;
472
+ }
473
+ const _pathToCleanup = this._tempFolderPath;
474
+ await this.fileSystem.rm(this._tempFolderPath);
475
+ this._tempFolderPath = null;
476
+ } catch {}
424
477
  }
425
- };
426
- var es_MX = {
427
- toolCore: {
428
- errors: {
429
- internal: "Internal error: {message}",
430
- fileNotFound: "File not found: {path}",
431
- fileReadFailed: "Failed to read file: {path}",
432
- fileWriteFailed: "Failed to write file: {path}",
433
- directoryNotFound: "Directory not found: {path}",
434
- invalidPath: "{path} is not a valid path",
435
- operationCanceled: "Operation was canceled",
436
- invalidParameter: "Invalid parameter: {parameter}"
437
- },
438
- progress: {
439
- copying: "Copying files...",
440
- building: "Building project...",
441
- packaging: "Creating package...",
442
- validating: "Validating...",
443
- analyzing: "Analyzing...",
444
- restoring: "Restoring dependencies..."
445
- },
446
- validation: {
447
- requiredField: "{field} is required",
448
- invalidValue: "Invalid value for {field}",
449
- pathNotFound: "Path not found: {path}",
450
- fileRequired: "File is required: {path}",
451
- directoryRequired: "Directory is required: {path}"
452
- },
453
- warnings: {
454
- factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
455
- },
456
- info: {
457
- operationComplete: "Operation completed successfully",
458
- filesProcessed: {
459
- zero: "No files processed",
460
- one: "{count} file processed",
461
- other: "{count} files processed"
478
+ }
479
+ // ../packager/packager-core/src/filesystem/zip-service.ts
480
+ class ZipService {
481
+ fileSystem;
482
+ constructor(fileSystem) {
483
+ this.fileSystem = fileSystem;
484
+ }
485
+ async extractAsync(zipData, targetPath) {
486
+ const normalizedTarget = targetPath.replace(/\/$/, "");
487
+ const files = unzipSync(zipData);
488
+ const dirsToCreate = new Set([normalizedTarget]);
489
+ const filesToWrite = [];
490
+ const extractedPaths = [];
491
+ for (const [relativePath, data] of Object.entries(files)) {
492
+ if (relativePath.endsWith("/") || data.length === 0) {
493
+ const dirPath = `${normalizedTarget}/${relativePath.replace(/\/$/, "")}`;
494
+ if (!dirPath.startsWith(`${normalizedTarget}/`)) {
495
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
496
+ }
497
+ dirsToCreate.add(dirPath);
498
+ continue;
499
+ }
500
+ const fullPath = `${normalizedTarget}/${relativePath}`;
501
+ if (!fullPath.startsWith(`${normalizedTarget}/`)) {
502
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
503
+ }
504
+ const parentDir = fullPath.split("/").slice(0, -1).join("/");
505
+ if (parentDir) {
506
+ dirsToCreate.add(parentDir);
462
507
  }
508
+ filesToWrite.push({ path: fullPath, data });
509
+ extractedPaths.push(fullPath);
463
510
  }
511
+ await Promise.all(Array.from(dirsToCreate, (dir) => this.fileSystem.mkdir(dir)));
512
+ await Promise.all(filesToWrite.map(({ path, data }) => this.fileSystem.writeFile(path, data)));
513
+ return extractedPaths;
464
514
  }
465
- };
466
- var fr = {
467
- toolCore: {
468
- errors: {
469
- internal: "Internal error: {message}",
470
- fileNotFound: "File not found: {path}",
471
- fileReadFailed: "Failed to read file: {path}",
472
- fileWriteFailed: "Failed to write file: {path}",
473
- directoryNotFound: "Directory not found: {path}",
474
- invalidPath: "{path} is not a valid path",
475
- operationCanceled: "Operation was canceled",
515
+ async compressAsync(sourcePath) {
516
+ const normalizedSource = sourcePath.replace(/\/$/, "");
517
+ const entries = await Path.walkDirectory(this.fileSystem, normalizedSource);
518
+ const fileContents = await Promise.all(entries.map(async (entry) => ({
519
+ relativePath: entry.relativePath,
520
+ data: await this.fileSystem.readFile(entry.absolutePath)
521
+ })));
522
+ const zippable = {};
523
+ for (const { relativePath, data } of fileContents) {
524
+ if (data) {
525
+ zippable[relativePath] = data;
526
+ }
527
+ }
528
+ const zipData = zipSync(zippable, {
529
+ level: 6
530
+ });
531
+ return zipData;
532
+ }
533
+ compressEntries(entries) {
534
+ return zipSync(entries, { level: 6 });
535
+ }
536
+ }
537
+ // ../packager/packager-core/src/i18n/types.ts
538
+ function isPluralForm(value) {
539
+ return typeof value === "object" && value !== null && "other" in value;
540
+ }
541
+ function selectPluralForm(forms, count) {
542
+ if (count === 0 && forms.zero !== undefined) {
543
+ return forms.zero;
544
+ }
545
+ if (count === 1 && forms.one !== undefined) {
546
+ return forms.one;
547
+ }
548
+ if (count === 2 && forms.two !== undefined) {
549
+ return forms.two;
550
+ }
551
+ if (forms.few !== undefined) {
552
+ const mod10 = count % 10;
553
+ const mod100 = count % 100;
554
+ if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
555
+ return forms.few;
556
+ }
557
+ }
558
+ if (forms.many !== undefined) {
559
+ const mod10 = count % 10;
560
+ const mod100 = count % 100;
561
+ if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
562
+ return forms.many;
563
+ }
564
+ }
565
+ return forms.other;
566
+ }
567
+
568
+ // ../packager/packager-core/src/i18n/i18n-manager.ts
569
+ class I18nManager {
570
+ static translations = {};
571
+ static currentLocale = "en";
572
+ static fallbackLocale = "en";
573
+ static registerTranslations(locale, catalog) {
574
+ if (!I18nManager.translations[locale]) {
575
+ I18nManager.translations[locale] = {};
576
+ }
577
+ I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
578
+ }
579
+ static setLocale(locale) {
580
+ const normalized = I18nManager.normalizeLocale(locale);
581
+ if (I18nManager.translations[normalized]) {
582
+ I18nManager.currentLocale = normalized;
583
+ return normalized;
584
+ }
585
+ const baseLocale = normalized.split("-")[0];
586
+ if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
587
+ I18nManager.currentLocale = baseLocale;
588
+ return baseLocale;
589
+ }
590
+ return I18nManager.currentLocale;
591
+ }
592
+ static getLocale() {
593
+ return I18nManager.currentLocale;
594
+ }
595
+ static setFallbackLocale(locale) {
596
+ I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
597
+ }
598
+ static t(key, params, locale) {
599
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
600
+ let value = I18nManager.getTranslationValue(key, targetLocale);
601
+ if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
602
+ value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
603
+ }
604
+ if (value === undefined) {
605
+ return key;
606
+ }
607
+ if (isPluralForm(value) && params && "count" in params) {
608
+ const count = typeof params.count === "number" ? params.count : Number(params.count);
609
+ value = selectPluralForm(value, count);
610
+ } else if (isPluralForm(value)) {
611
+ value = value.other;
612
+ }
613
+ if (typeof value !== "string") {
614
+ return key;
615
+ }
616
+ return params ? I18nManager.interpolate(value, params) : value;
617
+ }
618
+ static has(key, locale) {
619
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
620
+ const value = I18nManager.getTranslationValue(key, targetLocale);
621
+ if (value !== undefined) {
622
+ return true;
623
+ }
624
+ if (targetLocale !== I18nManager.fallbackLocale) {
625
+ return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
626
+ }
627
+ return false;
628
+ }
629
+ static getAvailableLocales() {
630
+ return Object.keys(I18nManager.translations);
631
+ }
632
+ static clearTranslations() {
633
+ I18nManager.translations = {};
634
+ I18nManager.currentLocale = "en";
635
+ }
636
+ static getTranslationValue(key, locale) {
637
+ const catalog = I18nManager.translations[locale];
638
+ if (!catalog) {
639
+ return;
640
+ }
641
+ const keys = key.split(".");
642
+ let value = catalog;
643
+ for (const k of keys) {
644
+ if (value && typeof value === "object" && k in value) {
645
+ value = value[k];
646
+ } else {
647
+ return;
648
+ }
649
+ }
650
+ return value;
651
+ }
652
+ static interpolate(template, params) {
653
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
654
+ const value = params[key];
655
+ return value !== undefined ? String(value) : `{${key}}`;
656
+ });
657
+ }
658
+ static normalizeLocale(locale) {
659
+ const normalized = locale.toLowerCase().replace(/_/g, "-");
660
+ const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
661
+ if (specialLocales.includes(normalized)) {
662
+ return normalized;
663
+ }
664
+ return normalized.split("-")[0];
665
+ }
666
+ static deepMerge(target, source) {
667
+ const result = { ...target };
668
+ for (const key of Object.keys(source)) {
669
+ const sourceValue = source[key];
670
+ const targetValue = result[key];
671
+ if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
672
+ result[key] = I18nManager.deepMerge(targetValue, sourceValue);
673
+ } else {
674
+ result[key] = sourceValue;
675
+ }
676
+ }
677
+ return result;
678
+ }
679
+ }
680
+
681
+ // ../packager/packager-core/src/i18n/locales/de.ts
682
+ var de = {
683
+ toolCore: {
684
+ errors: {
685
+ internal: "Internal error: {message}",
686
+ fileNotFound: "File not found: {path}",
687
+ fileReadFailed: "Failed to read file: {path}",
688
+ fileWriteFailed: "Failed to write file: {path}",
689
+ directoryNotFound: "Directory not found: {path}",
690
+ invalidPath: "{path} is not a valid path",
691
+ operationCanceled: "Operation was canceled",
476
692
  invalidParameter: "Invalid parameter: {parameter}"
477
693
  },
478
694
  progress: {
@@ -503,7 +719,9 @@ var fr = {
503
719
  }
504
720
  }
505
721
  };
506
- var ja = {
722
+
723
+ // ../packager/packager-core/src/i18n/locales/en.ts
724
+ var en = {
507
725
  toolCore: {
508
726
  errors: {
509
727
  internal: "Internal error: {message}",
@@ -543,7 +761,9 @@ var ja = {
543
761
  }
544
762
  }
545
763
  };
546
- var ko = {
764
+
765
+ // ../packager/packager-core/src/i18n/locales/es.ts
766
+ var es = {
547
767
  toolCore: {
548
768
  errors: {
549
769
  internal: "Internal error: {message}",
@@ -583,7 +803,9 @@ var ko = {
583
803
  }
584
804
  }
585
805
  };
586
- var pt = {
806
+
807
+ // ../packager/packager-core/src/i18n/locales/es-MX.ts
808
+ var es_MX = {
587
809
  toolCore: {
588
810
  errors: {
589
811
  internal: "Internal error: {message}",
@@ -623,7 +845,9 @@ var pt = {
623
845
  }
624
846
  }
625
847
  };
626
- var pt_BR = {
848
+
849
+ // ../packager/packager-core/src/i18n/locales/fr.ts
850
+ var fr = {
627
851
  toolCore: {
628
852
  errors: {
629
853
  internal: "Internal error: {message}",
@@ -663,7 +887,9 @@ var pt_BR = {
663
887
  }
664
888
  }
665
889
  };
666
- var ro = {
890
+
891
+ // ../packager/packager-core/src/i18n/locales/ja.ts
892
+ var ja = {
667
893
  toolCore: {
668
894
  errors: {
669
895
  internal: "Internal error: {message}",
@@ -703,7 +929,9 @@ var ro = {
703
929
  }
704
930
  }
705
931
  };
706
- var ru = {
932
+
933
+ // ../packager/packager-core/src/i18n/locales/ko.ts
934
+ var ko = {
707
935
  toolCore: {
708
936
  errors: {
709
937
  internal: "Internal error: {message}",
@@ -743,7 +971,9 @@ var ru = {
743
971
  }
744
972
  }
745
973
  };
746
- var tr = {
974
+
975
+ // ../packager/packager-core/src/i18n/locales/pt.ts
976
+ var pt = {
747
977
  toolCore: {
748
978
  errors: {
749
979
  internal: "Internal error: {message}",
@@ -783,7 +1013,9 @@ var tr = {
783
1013
  }
784
1014
  }
785
1015
  };
786
- var zh_CN = {
1016
+
1017
+ // ../packager/packager-core/src/i18n/locales/pt-BR.ts
1018
+ var pt_BR = {
787
1019
  toolCore: {
788
1020
  errors: {
789
1021
  internal: "Internal error: {message}",
@@ -823,7 +1055,9 @@ var zh_CN = {
823
1055
  }
824
1056
  }
825
1057
  };
826
- var zh_TW = {
1058
+
1059
+ // ../packager/packager-core/src/i18n/locales/ro.ts
1060
+ var ro = {
827
1061
  toolCore: {
828
1062
  errors: {
829
1063
  internal: "Internal error: {message}",
@@ -863,7 +1097,9 @@ var zh_TW = {
863
1097
  }
864
1098
  }
865
1099
  };
866
- var zu = {
1100
+
1101
+ // ../packager/packager-core/src/i18n/locales/ru.ts
1102
+ var ru = {
867
1103
  toolCore: {
868
1104
  errors: {
869
1105
  internal: "Internal error: {message}",
@@ -904,546 +1140,315 @@ var zu = {
904
1140
  }
905
1141
  };
906
1142
 
907
- class TranslationService {
908
- static instance;
909
- currentLocale = "en";
910
- constructor() {}
911
- static getInstance() {
912
- if (!TranslationService.instance) {
913
- TranslationService.instance = new TranslationService;
1143
+ // ../packager/packager-core/src/i18n/locales/tr.ts
1144
+ var tr = {
1145
+ toolCore: {
1146
+ errors: {
1147
+ internal: "Internal error: {message}",
1148
+ fileNotFound: "File not found: {path}",
1149
+ fileReadFailed: "Failed to read file: {path}",
1150
+ fileWriteFailed: "Failed to write file: {path}",
1151
+ directoryNotFound: "Directory not found: {path}",
1152
+ invalidPath: "{path} is not a valid path",
1153
+ operationCanceled: "Operation was canceled",
1154
+ invalidParameter: "Invalid parameter: {parameter}"
1155
+ },
1156
+ progress: {
1157
+ copying: "Copying files...",
1158
+ building: "Building project...",
1159
+ packaging: "Creating package...",
1160
+ validating: "Validating...",
1161
+ analyzing: "Analyzing...",
1162
+ restoring: "Restoring dependencies..."
1163
+ },
1164
+ validation: {
1165
+ requiredField: "{field} is required",
1166
+ invalidValue: "Invalid value for {field}",
1167
+ pathNotFound: "Path not found: {path}",
1168
+ fileRequired: "File is required: {path}",
1169
+ directoryRequired: "Directory is required: {path}"
1170
+ },
1171
+ warnings: {
1172
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1173
+ },
1174
+ info: {
1175
+ operationComplete: "Operation completed successfully",
1176
+ filesProcessed: {
1177
+ zero: "No files processed",
1178
+ one: "{count} file processed",
1179
+ other: "{count} files processed"
1180
+ }
914
1181
  }
915
- return TranslationService.instance;
916
- }
917
- setLocale(locale) {
918
- this.currentLocale = I18nManager.setLocale(locale);
919
1182
  }
920
- getLocale() {
921
- return this.currentLocale;
922
- }
923
- t(key, params) {
924
- return I18nManager.t(key, params, this.currentLocale);
925
- }
926
- tLocale(key, locale, params) {
927
- return I18nManager.t(key, params, locale);
928
- }
929
- has(key) {
930
- return I18nManager.has(key, this.currentLocale);
931
- }
932
- getAvailableLocales() {
933
- return I18nManager.getAvailableLocales();
934
- }
935
- }
936
- var translate = TranslationService.getInstance();
937
- I18nManager.registerTranslations("en", en);
938
- I18nManager.registerTranslations("de", de);
939
- I18nManager.registerTranslations("es", es);
940
- I18nManager.registerTranslations("es-mx", es_MX);
941
- I18nManager.registerTranslations("fr", fr);
942
- I18nManager.registerTranslations("ja", ja);
943
- I18nManager.registerTranslations("ko", ko);
944
- I18nManager.registerTranslations("pt", pt);
945
- I18nManager.registerTranslations("pt-br", pt_BR);
946
- I18nManager.registerTranslations("ro", ro);
947
- I18nManager.registerTranslations("ru", ru);
948
- I18nManager.registerTranslations("tr", tr);
949
- I18nManager.registerTranslations("zh-cn", zh_CN);
950
- I18nManager.registerTranslations("zh-tw", zh_TW);
951
- I18nManager.registerTranslations("zu", zu);
952
- I18nManager.setLocale("en");
953
- var BuildConfiguration;
954
- ((BuildConfiguration2) => {
955
- BuildConfiguration2["Debug"] = "Debug";
956
- BuildConfiguration2["Release"] = "Release";
957
- })(BuildConfiguration ||= {});
958
- var LogLevel;
959
- ((LogLevel2) => {
960
- LogLevel2["Debug"] = "Debug";
961
- LogLevel2["Info"] = "Information";
962
- LogLevel2["Warn"] = "Warning";
963
- LogLevel2["Error"] = "Error";
964
- })(LogLevel ||= {});
965
-
966
- class LogMessage {
967
- message;
968
- logLevel;
969
- source;
970
- sourceTarget;
971
- progress;
972
- code;
973
- filePath;
974
- line;
975
- id;
976
- timestamp;
977
- constructor(message, logLevel, options, timestamp) {
978
- this.message = message;
979
- this.logLevel = LogMessage.toLogLevel(logLevel);
980
- this.source = options?.source;
981
- this.sourceTarget = options?.sourceTarget;
982
- this.progress = options?.progress;
983
- this.code = options?.code;
984
- this.filePath = options?.filePath;
985
- this.line = options?.line;
986
- this.id = options?.id;
987
- this.timestamp = LogMessage.resolveTimestamp(timestamp);
988
- }
989
- static resolveTimestamp(timestamp) {
990
- if (timestamp instanceof Date) {
991
- return timestamp;
992
- }
993
- if (timestamp === undefined || timestamp === null) {
994
- return new Date;
995
- }
996
- const parsed = new Date(timestamp);
997
- if (Number.isNaN(parsed.getTime())) {
998
- console.error(`[LogMessage] invalid timestamp "${timestamp}", defaulting to now`);
999
- return new Date;
1000
- }
1001
- return parsed;
1002
- }
1003
- static toLogLevel(level) {
1004
- switch (level) {
1005
- case "Verbose":
1006
- case "Trace":
1007
- case "Debug":
1008
- return "Debug";
1009
- case "Warn":
1010
- case "Warning":
1011
- return "Warning";
1012
- case "Error":
1013
- case "Critical":
1014
- return "Error";
1015
- default:
1016
- return "Information";
1017
- }
1018
- }
1019
- toFormattedString() {
1020
- const parts = [];
1021
- parts.push(`[${this.timestamp.toISOString()}]`);
1022
- parts.push(`[${String(this.logLevel).toUpperCase()}]`);
1023
- if (this.source) {
1024
- parts.push(`[${this.source}]`);
1025
- }
1026
- if (this.sourceTarget) {
1027
- parts.push(`[${this.sourceTarget}]`);
1028
- }
1029
- const locationParts = [];
1030
- if (this.filePath) {
1031
- locationParts.push(this.filePath);
1032
- }
1033
- if (this.line) {
1034
- locationParts.push(`Line:${this.line}`);
1035
- }
1036
- if (this.id) {
1037
- locationParts.push(`Id:${this.id}`);
1038
- }
1039
- if (locationParts.length > 0) {
1040
- parts.push(`(${locationParts.join("")})`);
1041
- }
1042
- if (this.code) {
1043
- parts.push(`[${this.code}]`);
1044
- }
1045
- if (this.progress || this.progress === 0) {
1046
- parts.push(`${this.progress}%`);
1047
- }
1048
- parts.push(this.message);
1049
- return parts.join(" ");
1050
- }
1051
- }
1052
- var NugetConstants = {
1053
- OutputFolderName: "bundle",
1054
- ContentFolderName: "content",
1055
- OperateFileName: "operate.json",
1056
- EntryPointsFileName: "entry-points.json",
1057
- PackageDescriptorFileName: "package-descriptor.json",
1058
- BindingsV2FileName: "bindings_v2.json",
1059
- BindingsFileId: "bindings.json"
1060
1183
  };
1061
- var PackJobTargetKind;
1062
- ((PackJobTargetKind2) => {
1063
- PackJobTargetKind2["Serverless"] = "Serverless";
1064
- PackJobTargetKind2["LocalRobot"] = "LocalRobot";
1065
- })(PackJobTargetKind ||= {});
1066
- var ProjectTypes;
1067
- ((ProjectTypes2) => {
1068
- ProjectTypes2["Agent"] = "Agent";
1069
- ProjectTypes2["Api"] = "Api";
1070
- ProjectTypes2["BusinessRules"] = "BusinessRules";
1071
- ProjectTypes2["Connector"] = "Connector";
1072
- ProjectTypes2["CaseManagement"] = "CaseManagement";
1073
- ProjectTypes2["Flow"] = "Flow";
1074
- ProjectTypes2["Function"] = "Function";
1075
- ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
1076
- ProjectTypes2["Process"] = "Process";
1077
- ProjectTypes2["Library"] = "Library";
1078
- ProjectTypes2["WebApp"] = "WebApp";
1079
- ProjectTypes2["Tests"] = "Tests";
1080
- ProjectTypes2["AppV2"] = "AppV2";
1081
- })(ProjectTypes ||= {});
1082
- var TargetFramework;
1083
- ((TargetFramework2) => {
1084
- TargetFramework2["Portable"] = "Portable";
1085
- TargetFramework2["Windows"] = "Windows";
1086
- })(TargetFramework ||= {});
1087
- var ToolErrorCodes;
1088
- ((ToolErrorCodes2) => {
1089
- ToolErrorCodes2["Success"] = "SUCCESS";
1090
- ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
1091
- ToolErrorCodes2["Canceled"] = "CANCELED";
1092
- })(ToolErrorCodes ||= {});
1093
1184
 
1094
- class ToolResult {
1095
- errorCode;
1096
- message;
1097
- packages;
1098
- details;
1099
- instructions;
1100
- constructor(errorCode, message, packages = [], instructions) {
1101
- this.errorCode = errorCode;
1102
- this.message = message;
1103
- this.packages = packages;
1104
- this.instructions = instructions;
1105
- }
1106
- get isSuccess() {
1107
- return this.errorCode === "SUCCESS";
1108
- }
1109
- static success() {
1110
- return new ToolResult("SUCCESS");
1111
- }
1112
- static error(errorCode, message, instructions) {
1113
- return new ToolResult(errorCode, message, [], instructions);
1114
- }
1115
- }
1116
- var OPERATE_FILE = "operate.json";
1117
- var PROJECT_FILE = "project.json";
1118
- function isNonEmptyString(value) {
1119
- return typeof value === "string" && value.length > 0;
1120
- }
1121
- async function readJsonObject(fs, filePath) {
1122
- let content;
1123
- try {
1124
- content = await fs.readFile(filePath, "utf-8");
1125
- } catch {
1126
- return;
1127
- }
1128
- if (content === null) {
1129
- return;
1130
- }
1131
- try {
1132
- const parsed = JSON.parse(content);
1133
- if (parsed === null || typeof parsed !== "object") {
1134
- return;
1135
- }
1136
- return parsed;
1137
- } catch {
1138
- return;
1139
- }
1140
- }
1141
- async function writeJsonObject(fs, filePath, data) {
1142
- await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
1143
- `);
1144
- }
1145
- async function ensureProjectId(projectPath, fs) {
1146
- const operatePath = Path.join(projectPath, OPERATE_FILE);
1147
- const operateExists = await fs.exists(operatePath);
1148
- if (operateExists) {
1149
- const operate = await readJsonObject(fs, operatePath);
1150
- if (operate && isNonEmptyString(operate.projectId)) {
1151
- return operate.projectId;
1152
- }
1153
- if (operate) {
1154
- const id = crypto.randomUUID();
1155
- await writeJsonObject(fs, operatePath, {
1156
- ...operate,
1157
- projectId: id
1158
- });
1159
- return id;
1160
- }
1161
- return crypto.randomUUID();
1162
- }
1163
- const projectFilePath = Path.join(projectPath, PROJECT_FILE);
1164
- const projectFileExists = await fs.exists(projectFilePath);
1165
- if (projectFileExists) {
1166
- const projectFile = await readJsonObject(fs, projectFilePath);
1167
- if (projectFile && isNonEmptyString(projectFile.projectId)) {
1168
- return projectFile.projectId;
1169
- }
1170
- if (projectFile) {
1171
- const id = crypto.randomUUID();
1172
- await writeJsonObject(fs, projectFilePath, {
1173
- ...projectFile,
1174
- projectId: id
1175
- });
1176
- return id;
1177
- }
1178
- return crypto.randomUUID();
1179
- }
1180
- return crypto.randomUUID();
1181
- }
1182
- async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
1183
- if (!await fs.exists(operateFilePath)) {
1184
- return;
1185
- }
1186
- const parsed = await readJsonObject(fs, operateFilePath);
1187
- if (!parsed) {
1188
- return;
1189
- }
1190
- if (isNonEmptyString(parsed.projectId)) {
1191
- return;
1192
- }
1193
- await writeJsonObject(fs, operateFilePath, {
1194
- ...parsed,
1195
- projectId: fallbackProjectId
1196
- });
1197
- }
1198
- async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
1199
- if (await fs.exists(operateFilePath)) {
1200
- await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
1201
- return;
1202
- }
1203
- await createIfMissing();
1204
- }
1205
- var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
1206
- async function resolveEntryPointMain(fs, sourceFolder) {
1207
- const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
1208
- if (!await fs.exists(entryPointsFilePath)) {
1209
- return "";
1210
- }
1211
- const content = await fs.readFile(entryPointsFilePath);
1212
- if (!content) {
1213
- return "";
1214
- }
1215
- try {
1216
- const parsed = JSON.parse(new TextDecoder().decode(content));
1217
- return parsed.entryPoints?.[0]?.filePath ?? "";
1218
- } catch {
1219
- return "";
1220
- }
1221
- }
1222
- async function writeContentOperateFile(fs, params) {
1223
- const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
1224
- await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
1225
- const main = await resolveEntryPointMain(fs, params.contentFolder);
1226
- const operateFileModel = {
1227
- $schema: OPERATE_SCHEMA,
1228
- contentType: params.contentType,
1229
- projectId: params.projectId,
1230
- main,
1231
- targetFramework: "Portable",
1232
- runtimeOptions: {
1233
- isAttended: false,
1234
- requiresUserInteraction: false
1185
+ // ../packager/packager-core/src/i18n/locales/zh-CN.ts
1186
+ var zh_CN = {
1187
+ toolCore: {
1188
+ errors: {
1189
+ internal: "Internal error: {message}",
1190
+ fileNotFound: "File not found: {path}",
1191
+ fileReadFailed: "Failed to read file: {path}",
1192
+ fileWriteFailed: "Failed to write file: {path}",
1193
+ directoryNotFound: "Directory not found: {path}",
1194
+ invalidPath: "{path} is not a valid path",
1195
+ operationCanceled: "Operation was canceled",
1196
+ invalidParameter: "Invalid parameter: {parameter}"
1197
+ },
1198
+ progress: {
1199
+ copying: "Copying files...",
1200
+ building: "Building project...",
1201
+ packaging: "Creating package...",
1202
+ validating: "Validating...",
1203
+ analyzing: "Analyzing...",
1204
+ restoring: "Restoring dependencies..."
1205
+ },
1206
+ validation: {
1207
+ requiredField: "{field} is required",
1208
+ invalidValue: "Invalid value for {field}",
1209
+ pathNotFound: "Path not found: {path}",
1210
+ fileRequired: "File is required: {path}",
1211
+ directoryRequired: "Directory is required: {path}"
1212
+ },
1213
+ warnings: {
1214
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1215
+ },
1216
+ info: {
1217
+ operationComplete: "Operation completed successfully",
1218
+ filesProcessed: {
1219
+ zero: "No files processed",
1220
+ one: "{count} file processed",
1221
+ other: "{count} files processed"
1235
1222
  }
1236
- };
1237
- await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
1238
- });
1239
- }
1240
- function escapeXml(str) {
1241
- if (str === null || str === undefined) {
1242
- return "";
1243
- }
1244
- return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1245
- }
1246
- function optionalElement(name, value) {
1247
- if (value === undefined || value === "")
1248
- return "";
1249
- return ` <${name}>${escapeXml(value)}</${name}>
1250
- `;
1251
- }
1252
- function generateDependenciesXml(dependencies) {
1253
- if (!dependencies || dependencies.length === 0)
1254
- return "";
1255
- const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
1256
- `);
1257
- return ` <dependencies>
1258
- ${deps}
1259
- </dependencies>
1260
- `;
1261
- }
1262
- function generateRepositoryXml(packageInfo) {
1263
- if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
1264
- return "";
1265
- let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
1266
- if (packageInfo.repositoryBranch) {
1267
- repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
1268
- }
1269
- if (packageInfo.repositoryCommit) {
1270
- repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
1223
+ }
1271
1224
  }
1272
- repoXml += ` />
1273
- `;
1274
- return repoXml;
1275
- }
1276
- function generateNuspecXml(packageInfo) {
1277
- const author = packageInfo.author?.trim() || "UiPath";
1278
- const description = packageInfo.description?.trim() || "Created by UiPath";
1279
- const title = packageInfo.title?.trim() || packageInfo.id;
1280
- const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
1281
- const releaseNotes = packageInfo.releaseNotes ?? "";
1282
- const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
1283
- <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
1284
- <metadata>
1285
- <id>${escapeXml(packageInfo.id)}</id>
1286
- <version>${escapeXml(packageInfo.version)}</version>
1287
- <title>${escapeXml(title)}</title>
1288
- <authors>${escapeXml(author)}</authors>
1289
- <requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
1290
- <description>${escapeXml(description)}</description>
1291
- <releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
1292
- ${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>
1293
- </package>
1294
- `;
1295
- return xml;
1296
- }
1297
- function generatePsmdcpXml(packageInfo) {
1298
- const author = packageInfo.author?.trim() || "UiPath";
1299
- const description = packageInfo.description?.trim() || "Created by UiPath";
1300
- return `<?xml version="1.0" encoding="utf-8"?>
1301
- <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">
1302
- <dc:creator>${escapeXml(author)}</dc:creator>
1303
- <dc:description>${escapeXml(description)}</dc:description>
1304
- <dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
1305
- <version>${escapeXml(packageInfo.version)}</version>
1306
- <keywords></keywords>
1307
- <lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
1308
- </coreProperties>`;
1309
- }
1225
+ };
1310
1226
 
1311
- class NugetPackager {
1312
- fileSystem;
1313
- constructor(fileSystem) {
1314
- this.fileSystem = fileSystem;
1315
- }
1316
- async packAsync(rootPath, packageInfo, outputPath) {
1317
- const normalizedOutputPath = Path.normalize(outputPath);
1318
- const nuspecXml = generateNuspecXml(packageInfo);
1319
- const nuspecFileName = `${packageInfo.id}.nuspec`;
1320
- const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
1321
- const zipContents = {};
1322
- const encoder = new TextEncoder;
1323
- const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
1324
- const psmdcpFileName = `${psmdcpId}.psmdcp`;
1325
- const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
1326
- const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
1327
- <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
1328
- <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
1329
- <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
1330
- <Default Extension="uiproj" ContentType="application/octet" />
1331
- <Default Extension="json" ContentType="application/octet" />
1332
- <Default Extension="nuspec" ContentType="application/octet" />
1333
- </Types>`;
1334
- zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
1335
- const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
1336
- const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
1337
- const relsXml = `<?xml version="1.0" encoding="utf-8"?>
1338
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
1339
- <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
1340
- <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
1341
- </Relationships>`;
1342
- zipContents["_rels/.rels"] = encoder.encode(relsXml);
1343
- zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
1344
- zipContents[nuspecFileName] = encoder.encode(nuspecXml);
1345
- for (const entry of fileEntries) {
1346
- const content = await this.fileSystem.readFile(entry.absolutePath);
1347
- if (content !== null) {
1348
- zipContents[entry.relativePath] = content;
1227
+ // ../packager/packager-core/src/i18n/locales/zh-TW.ts
1228
+ var zh_TW = {
1229
+ toolCore: {
1230
+ errors: {
1231
+ internal: "Internal error: {message}",
1232
+ fileNotFound: "File not found: {path}",
1233
+ fileReadFailed: "Failed to read file: {path}",
1234
+ fileWriteFailed: "Failed to write file: {path}",
1235
+ directoryNotFound: "Directory not found: {path}",
1236
+ invalidPath: "{path} is not a valid path",
1237
+ operationCanceled: "Operation was canceled",
1238
+ invalidParameter: "Invalid parameter: {parameter}"
1239
+ },
1240
+ progress: {
1241
+ copying: "Copying files...",
1242
+ building: "Building project...",
1243
+ packaging: "Creating package...",
1244
+ validating: "Validating...",
1245
+ analyzing: "Analyzing...",
1246
+ restoring: "Restoring dependencies..."
1247
+ },
1248
+ validation: {
1249
+ requiredField: "{field} is required",
1250
+ invalidValue: "Invalid value for {field}",
1251
+ pathNotFound: "Path not found: {path}",
1252
+ fileRequired: "File is required: {path}",
1253
+ directoryRequired: "Directory is required: {path}"
1254
+ },
1255
+ warnings: {
1256
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1257
+ },
1258
+ info: {
1259
+ operationComplete: "Operation completed successfully",
1260
+ filesProcessed: {
1261
+ zero: "No files processed",
1262
+ one: "{count} file processed",
1263
+ other: "{count} files processed"
1349
1264
  }
1350
1265
  }
1351
- const zippedData = zipSync(zipContents);
1352
- await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
1353
- return {
1354
- outputPath: normalizedOutputPath
1355
- };
1356
1266
  }
1357
- }
1267
+ };
1358
1268
 
1359
- class ProjectTool {
1360
- fileSystem;
1361
- logger;
1362
- static ProjectFileName = "project.uiproj";
1363
- constructor(fileSystem, logger) {
1364
- this.fileSystem = fileSystem;
1365
- this.logger = logger;
1269
+ // ../packager/packager-core/src/i18n/locales/zu.ts
1270
+ var zu = {
1271
+ toolCore: {
1272
+ errors: {
1273
+ internal: "Internal error: {message}",
1274
+ fileNotFound: "File not found: {path}",
1275
+ fileReadFailed: "Failed to read file: {path}",
1276
+ fileWriteFailed: "Failed to write file: {path}",
1277
+ directoryNotFound: "Directory not found: {path}",
1278
+ invalidPath: "{path} is not a valid path",
1279
+ operationCanceled: "Operation was canceled",
1280
+ invalidParameter: "Invalid parameter: {parameter}"
1281
+ },
1282
+ progress: {
1283
+ copying: "Copying files...",
1284
+ building: "Building project...",
1285
+ packaging: "Creating package...",
1286
+ validating: "Validating...",
1287
+ analyzing: "Analyzing...",
1288
+ restoring: "Restoring dependencies..."
1289
+ },
1290
+ validation: {
1291
+ requiredField: "{field} is required",
1292
+ invalidValue: "Invalid value for {field}",
1293
+ pathNotFound: "Path not found: {path}",
1294
+ fileRequired: "File is required: {path}",
1295
+ directoryRequired: "Directory is required: {path}"
1296
+ },
1297
+ warnings: {
1298
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1299
+ },
1300
+ info: {
1301
+ operationComplete: "Operation completed successfully",
1302
+ filesProcessed: {
1303
+ zero: "No files processed",
1304
+ one: "{count} file processed",
1305
+ other: "{count} files processed"
1306
+ }
1307
+ }
1366
1308
  }
1367
- async restoreAsync(_options, _cancellationToken) {
1368
- this.logger.info("Restore operation is a noop");
1369
- return ToolResult.success();
1309
+ };
1310
+
1311
+ // ../packager/packager-core/src/i18n/translation-service.ts
1312
+ class TranslationService {
1313
+ static instance;
1314
+ currentLocale = "en";
1315
+ constructor() {}
1316
+ static getInstance() {
1317
+ if (!TranslationService.instance) {
1318
+ TranslationService.instance = new TranslationService;
1319
+ }
1320
+ return TranslationService.instance;
1370
1321
  }
1371
- async validateAsync(_options, _cancellationToken) {
1372
- this.logger.info("Validate operation is a noop");
1373
- return ToolResult.success();
1322
+ setLocale(locale) {
1323
+ this.currentLocale = I18nManager.setLocale(locale);
1374
1324
  }
1375
- async buildAsync(_options, _cancellationToken) {
1376
- this.logger.info("Build operation is a noop");
1377
- return ToolResult.success();
1325
+ getLocale() {
1326
+ return this.currentLocale;
1378
1327
  }
1379
- async packAsync(_options, _cancellationToken) {
1380
- this.logger.info("Pack operation is a noop");
1381
- return ToolResult.success();
1328
+ t(key, params) {
1329
+ return I18nManager.t(key, params, this.currentLocale);
1382
1330
  }
1383
- async cleanupAsync(_options, _cancellationToken) {
1384
- this.logger.info("Cleanup operation is a noop");
1385
- return ToolResult.success();
1331
+ tLocale(key, locale, params) {
1332
+ return I18nManager.t(key, params, locale);
1386
1333
  }
1387
- async getUiProjectAsync(projectPath) {
1388
- const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
1389
- if (!await this.fileSystem.exists(filePath)) {
1390
- return;
1391
- }
1392
- const raw = await this.fileSystem.readFile(filePath);
1393
- if (!raw) {
1394
- return;
1395
- }
1396
- const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
1397
- return JSON.parse(json);
1334
+ has(key) {
1335
+ return I18nManager.has(key, this.currentLocale);
1398
1336
  }
1399
- async dispose() {}
1400
- }
1401
- class ToolsFactoryRepository {
1402
- projectFactoryMap = new Map;
1403
- solutionFactory = null;
1404
- registerProjectToolFactory(factory) {
1405
- for (const type of factory.supportedTypes) {
1406
- const existing = this.projectFactoryMap.get(type);
1407
- if (existing) {
1408
- if (existing.constructor?.name !== factory.constructor?.name) {
1409
- console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
1410
- }
1411
- continue;
1412
- }
1413
- this.projectFactoryMap.set(type, factory);
1414
- }
1337
+ getAvailableLocales() {
1338
+ return I18nManager.getAvailableLocales();
1415
1339
  }
1416
- registerSolutionToolFactory(factory) {
1417
- this.solutionFactory = factory;
1340
+ }
1341
+ var translate = TranslationService.getInstance();
1342
+
1343
+ // ../packager/packager-core/src/i18n/index.ts
1344
+ I18nManager.registerTranslations("en", en);
1345
+ I18nManager.registerTranslations("de", de);
1346
+ I18nManager.registerTranslations("es", es);
1347
+ I18nManager.registerTranslations("es-mx", es_MX);
1348
+ I18nManager.registerTranslations("fr", fr);
1349
+ I18nManager.registerTranslations("ja", ja);
1350
+ I18nManager.registerTranslations("ko", ko);
1351
+ I18nManager.registerTranslations("pt", pt);
1352
+ I18nManager.registerTranslations("pt-br", pt_BR);
1353
+ I18nManager.registerTranslations("ro", ro);
1354
+ I18nManager.registerTranslations("ru", ru);
1355
+ I18nManager.registerTranslations("tr", tr);
1356
+ I18nManager.registerTranslations("zh-cn", zh_CN);
1357
+ I18nManager.registerTranslations("zh-tw", zh_TW);
1358
+ I18nManager.registerTranslations("zu", zu);
1359
+ I18nManager.setLocale("en");
1360
+ // ../packager/packager-core/src/models/ignored-rules.ts
1361
+ function normalizeIgnoredRules(ignoredRules) {
1362
+ const rules = (ignoredRules ?? []).flatMap((rule) => rule.split(",")).map((rule) => rule.trim()).filter((rule) => rule.length > 0);
1363
+ return [...new Set(rules)];
1364
+ }
1365
+ // ../packager/packager-core/src/models/log-message.ts
1366
+ class LogMessage {
1367
+ message;
1368
+ logLevel;
1369
+ source;
1370
+ sourceTarget;
1371
+ progress;
1372
+ code;
1373
+ filePath;
1374
+ line;
1375
+ id;
1376
+ timestamp;
1377
+ constructor(message, logLevel, options, timestamp) {
1378
+ this.message = message;
1379
+ this.logLevel = LogMessage.toLogLevel(logLevel);
1380
+ this.source = options?.source;
1381
+ this.sourceTarget = options?.sourceTarget;
1382
+ this.progress = options?.progress;
1383
+ this.code = options?.code;
1384
+ this.filePath = options?.filePath;
1385
+ this.line = options?.line;
1386
+ this.id = options?.id;
1387
+ this.timestamp = LogMessage.resolveTimestamp(timestamp);
1418
1388
  }
1419
- getSolutionToolFactory() {
1420
- if (!this.solutionFactory) {
1421
- throw new Error("No solution tool factory is registered");
1389
+ static resolveTimestamp(timestamp) {
1390
+ if (timestamp instanceof Date) {
1391
+ return timestamp;
1422
1392
  }
1423
- return this.solutionFactory;
1424
- }
1425
- canHandleProject(projectType) {
1426
- return this.projectFactoryMap.has(projectType);
1393
+ if (timestamp === undefined || timestamp === null) {
1394
+ return new Date;
1395
+ }
1396
+ const parsed = new Date(timestamp);
1397
+ if (Number.isNaN(parsed.getTime())) {
1398
+ console.error(`[LogMessage] invalid timestamp "${timestamp}", defaulting to now`);
1399
+ return new Date;
1400
+ }
1401
+ return parsed;
1427
1402
  }
1428
- getProjectToolFactory(projectType) {
1429
- const factory = this.projectFactoryMap.get(projectType);
1430
- if (!factory) {
1431
- throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
1403
+ static toLogLevel(level) {
1404
+ switch (level) {
1405
+ case "Verbose":
1406
+ case "Trace":
1407
+ case "Debug":
1408
+ return "Debug" /* Debug */;
1409
+ case "Warn":
1410
+ case "Warning":
1411
+ return "Warning" /* Warn */;
1412
+ case "Error":
1413
+ case "Critical":
1414
+ return "Error" /* Error */;
1415
+ default:
1416
+ return "Information" /* Info */;
1432
1417
  }
1433
- return factory;
1434
1418
  }
1435
- reset() {
1436
- this.projectFactoryMap.clear();
1437
- this.solutionFactory = null;
1419
+ toFormattedString() {
1420
+ const parts = [];
1421
+ parts.push(`[${this.timestamp.toISOString()}]`);
1422
+ parts.push(`[${String(this.logLevel).toUpperCase()}]`);
1423
+ if (this.source) {
1424
+ parts.push(`[${this.source}]`);
1425
+ }
1426
+ if (this.sourceTarget) {
1427
+ parts.push(`[${this.sourceTarget}]`);
1428
+ }
1429
+ const locationParts = [];
1430
+ if (this.filePath) {
1431
+ locationParts.push(this.filePath);
1432
+ }
1433
+ if (this.line) {
1434
+ locationParts.push(`Line:${this.line}`);
1435
+ }
1436
+ if (this.id) {
1437
+ locationParts.push(`Id:${this.id}`);
1438
+ }
1439
+ if (locationParts.length > 0) {
1440
+ parts.push(`(${locationParts.join("")})`);
1441
+ }
1442
+ if (this.code) {
1443
+ parts.push(`[${this.code}]`);
1444
+ }
1445
+ if (this.progress || this.progress === 0) {
1446
+ parts.push(`${this.progress}%`);
1447
+ }
1448
+ parts.push(this.message);
1449
+ return parts.join(" ");
1438
1450
  }
1439
1451
  }
1440
- var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
1441
- var _global = globalThis;
1442
- if (!_global[REGISTRY_KEY]) {
1443
- _global[REGISTRY_KEY] = new ToolsFactoryRepository;
1444
- }
1445
- var toolsFactoryRepository = _global[REGISTRY_KEY];
1446
-
1447
- export { Path, TemporaryStorageService, ZipService, I18nManager, translate, LogLevel, LogMessage, NugetConstants, ProjectTypes, TargetFramework, ToolErrorCodes, ToolResult, ensureProjectId, writeContentOperateFile, NugetPackager, ProjectTool, toolsFactoryRepository };
1452
+ export { Path, TemporaryStorageService, ZipService, I18nManager, translate, normalizeIgnoredRules, LogMessage, NugetConstants, ToolResult, ensureProjectId, writeContentOperateFile, NugetPackager, ProjectTool, toolsFactoryRepository };
1448
1453
 
1449
- //# debugId=F3B2EBDF290E821564756E2164756E21
1454
+ //# debugId=B75D400F6FCCEA1C64756E2164756E21