@uipath/solutionpackager-tool-core 0.0.26 → 0.0.31

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 (77) hide show
  1. package/dist/i18n/i18n-manager.d.ts +1 -0
  2. package/dist/i18n/locales/de.d.ts +3 -0
  3. package/dist/i18n/locales/en.d.ts +3 -0
  4. package/dist/i18n/locales/es-MX.d.ts +3 -0
  5. package/dist/i18n/locales/es.d.ts +3 -0
  6. package/dist/i18n/locales/fr.d.ts +3 -0
  7. package/dist/i18n/locales/ja.d.ts +3 -0
  8. package/dist/i18n/locales/ko.d.ts +3 -0
  9. package/dist/i18n/locales/pt-BR.d.ts +3 -0
  10. package/dist/i18n/locales/pt.d.ts +3 -0
  11. package/dist/i18n/locales/ro.d.ts +3 -0
  12. package/dist/i18n/locales/ru.d.ts +3 -0
  13. package/dist/i18n/locales/tr.d.ts +3 -0
  14. package/dist/i18n/locales/zh-CN.d.ts +3 -0
  15. package/dist/i18n/locales/zh-TW.d.ts +3 -0
  16. package/dist/i18n/locales/zu.d.ts +3 -0
  17. package/dist/index.js +1359 -5
  18. package/dist/models/connection-info.d.ts +4 -0
  19. package/dist/models/project-type.d.ts +1 -0
  20. package/dist/models/tool-error-code.d.ts +1 -0
  21. package/dist/services/project-operation-context.d.ts +4 -0
  22. package/dist/services/tools-factory-repository.d.ts +1 -1
  23. package/package.json +13 -7
  24. package/dist/filesystem/file-system.js +0 -0
  25. package/dist/filesystem/index.js +0 -3
  26. package/dist/filesystem/path.js +0 -47
  27. package/dist/filesystem/temporary-storage-service.js +0 -46
  28. package/dist/filesystem/zip-service.js +0 -41
  29. package/dist/i18n/i18n-manager.js +0 -104
  30. package/dist/i18n/index.js +0 -34
  31. package/dist/i18n/locales/de.js +0 -38
  32. package/dist/i18n/locales/en.js +0 -38
  33. package/dist/i18n/locales/es-MX.js +0 -38
  34. package/dist/i18n/locales/es.js +0 -38
  35. package/dist/i18n/locales/fr.js +0 -38
  36. package/dist/i18n/locales/ja.js +0 -38
  37. package/dist/i18n/locales/ko.js +0 -38
  38. package/dist/i18n/locales/pt-BR.js +0 -38
  39. package/dist/i18n/locales/pt.js +0 -38
  40. package/dist/i18n/locales/ro.js +0 -38
  41. package/dist/i18n/locales/ru.js +0 -38
  42. package/dist/i18n/locales/tr.js +0 -38
  43. package/dist/i18n/locales/zh-CN.js +0 -38
  44. package/dist/i18n/locales/zh-TW.js +0 -38
  45. package/dist/i18n/locales/zu.js +0 -38
  46. package/dist/i18n/translation-service.js +0 -29
  47. package/dist/i18n/types.js +0 -20
  48. package/dist/models/build-configuration.js +0 -6
  49. package/dist/models/connection-info.js +0 -9
  50. package/dist/models/index.js +0 -8
  51. package/dist/models/log-message.js +0 -48
  52. package/dist/models/nuget-constants.js +0 -10
  53. package/dist/models/nuget-feed-model.js +0 -0
  54. package/dist/models/nuget-package-info.js +0 -0
  55. package/dist/models/package-info.js +0 -0
  56. package/dist/models/project-options.js +0 -7
  57. package/dist/models/project-type.js +0 -16
  58. package/dist/models/solution-options.js +0 -0
  59. package/dist/models/target-frameworks.js +0 -6
  60. package/dist/models/tool-error-code.js +0 -7
  61. package/dist/models/tool-result.js +0 -21
  62. package/dist/models/uipath-project.js +0 -0
  63. package/dist/models/uipath-solution.js +0 -0
  64. package/dist/package-descriptor/entry-points-file-model.js +0 -0
  65. package/dist/package-descriptor/index.js +0 -1
  66. package/dist/package-descriptor/operate-file-model.js +0 -0
  67. package/dist/package-descriptor/package-descriptor-file-model.js +0 -0
  68. package/dist/package-descriptor/project-bindings-file-model.js +0 -7
  69. package/dist/services/index.js +0 -4
  70. package/dist/services/nuget-packager.js +0 -105
  71. package/dist/services/project-operation-context.js +0 -0
  72. package/dist/services/project-tool-factory.js +0 -0
  73. package/dist/services/project-tool.js +0 -27
  74. package/dist/services/solution-tool-factory.js +0 -0
  75. package/dist/services/solution-tool.js +0 -27
  76. package/dist/services/tool-logger.js +0 -0
  77. package/dist/services/tools-factory-repository.js +0 -34
package/dist/index.js CHANGED
@@ -1,5 +1,1359 @@
1
- export * from "./filesystem/index.js";
2
- export * from "./i18n/index.js";
3
- export * from "./models/index.js";
4
- export * from "./package-descriptor/index.js";
5
- export * from "./services/index.js";
1
+ // src/filesystem/path.ts
2
+ class Path {
3
+ static normalize(path) {
4
+ return path.replace(/\\/g, "/").replace(/\/+/g, "/");
5
+ }
6
+ static join(...segments) {
7
+ return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
8
+ }
9
+ static dirname(path) {
10
+ const normalized = Path.normalize(path).replace(/\/$/, "");
11
+ if (normalized === "")
12
+ return ".";
13
+ const lastSlash = normalized.lastIndexOf("/");
14
+ if (lastSlash === -1)
15
+ return ".";
16
+ if (lastSlash === 0)
17
+ return "/";
18
+ return normalized.substring(0, lastSlash);
19
+ }
20
+ static basename(path) {
21
+ const normalized = Path.normalize(path).replace(/\/$/, "");
22
+ if (normalized === "")
23
+ return "";
24
+ const lastSlash = normalized.lastIndexOf("/");
25
+ return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
26
+ }
27
+ static extname(path) {
28
+ const base = Path.basename(path);
29
+ const lastDot = base.lastIndexOf(".");
30
+ if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
31
+ return "";
32
+ }
33
+ return base.substring(lastDot);
34
+ }
35
+ static async walkDirectory(fs, rootPath, currentRelativePath = "") {
36
+ const entries = [];
37
+ const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
38
+ const items = await fs.readdir(absolutePath);
39
+ for (const item of items) {
40
+ const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
41
+ const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
42
+ const stat = await fs.stat(itemAbsolutePath);
43
+ if (stat?.isDirectory()) {
44
+ const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
45
+ entries.push(...subEntries);
46
+ } else if (stat?.isFile()) {
47
+ entries.push({
48
+ relativePath: Path.normalize(itemRelativePath),
49
+ absolutePath: Path.normalize(itemAbsolutePath)
50
+ });
51
+ }
52
+ }
53
+ return entries;
54
+ }
55
+ }
56
+ // src/filesystem/temporary-storage-service.ts
57
+ class TemporaryStorageService {
58
+ fileSystem;
59
+ _tempFolderPath = null;
60
+ constructor(fileSystem) {
61
+ this.fileSystem = fileSystem;
62
+ }
63
+ async getTempFolderPath() {
64
+ if (!this._tempFolderPath) {
65
+ const systemTempDir = await this.fileSystem.getTempDir();
66
+ const uniqueFolderName = this.generateUniqueFolderName();
67
+ this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
68
+ await this.fileSystem.mkdir(this._tempFolderPath);
69
+ }
70
+ return this._tempFolderPath;
71
+ }
72
+ generateUniqueFolderName() {
73
+ const timestamp = Date.now();
74
+ const random = Math.random().toString(36).substring(2, 10);
75
+ return `tool-temp-${timestamp}-${random}`;
76
+ }
77
+ async getTempSubfolderPathAsync(subfolder) {
78
+ const tempFolderPath = await this.getTempFolderPath();
79
+ const inputPath = Path.join(tempFolderPath, subfolder);
80
+ await this.fileSystem.mkdir(inputPath);
81
+ return inputPath;
82
+ }
83
+ async cleanup() {
84
+ try {
85
+ if (!this._tempFolderPath) {
86
+ return;
87
+ }
88
+ try {
89
+ const stats = await this.fileSystem.stat(this._tempFolderPath);
90
+ if (!stats) {
91
+ return;
92
+ }
93
+ } catch {
94
+ return;
95
+ }
96
+ const pathToCleanup = this._tempFolderPath;
97
+ await this.fileSystem.rm(this._tempFolderPath);
98
+ this._tempFolderPath = null;
99
+ } catch {}
100
+ }
101
+ }
102
+ // src/filesystem/zip-service.ts
103
+ import { unzipSync, zipSync } from "fflate";
104
+ class ZipService {
105
+ fileSystem;
106
+ constructor(fileSystem) {
107
+ this.fileSystem = fileSystem;
108
+ }
109
+ async extractAsync(zipData, targetPath) {
110
+ const normalizedTarget = targetPath.replace(/\/$/, "");
111
+ await this.fileSystem.mkdir(normalizedTarget);
112
+ const files = unzipSync(zipData);
113
+ const extractedPaths = [];
114
+ for (const [relativePath, data] of Object.entries(files)) {
115
+ if (relativePath.endsWith("/") || data.length === 0) {
116
+ const dirPath = `${normalizedTarget}/${relativePath.replace(/\/$/, "")}`;
117
+ if (!dirPath.startsWith(`${normalizedTarget}/`)) {
118
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
119
+ }
120
+ await this.fileSystem.mkdir(dirPath);
121
+ continue;
122
+ }
123
+ const fullPath = `${normalizedTarget}/${relativePath}`;
124
+ if (!fullPath.startsWith(`${normalizedTarget}/`)) {
125
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
126
+ }
127
+ const parentDir = fullPath.split("/").slice(0, -1).join("/");
128
+ if (parentDir) {
129
+ await this.fileSystem.mkdir(parentDir);
130
+ }
131
+ await this.fileSystem.writeFile(fullPath, data);
132
+ extractedPaths.push(fullPath);
133
+ }
134
+ return extractedPaths;
135
+ }
136
+ async compressAsync(sourcePath) {
137
+ const normalizedSource = sourcePath.replace(/\/$/, "");
138
+ const entries = await Path.walkDirectory(this.fileSystem, normalizedSource);
139
+ const zippable = {};
140
+ for (const entry of entries) {
141
+ const fileData = await this.fileSystem.readFile(entry.absolutePath);
142
+ if (fileData) {
143
+ zippable[entry.relativePath] = fileData;
144
+ }
145
+ }
146
+ const zipData = zipSync(zippable, {
147
+ level: 6
148
+ });
149
+ return zipData;
150
+ }
151
+ }
152
+ // src/i18n/types.ts
153
+ function isPluralForm(value) {
154
+ return typeof value === "object" && value !== null && "other" in value;
155
+ }
156
+ function selectPluralForm(forms, count) {
157
+ if (count === 0 && forms.zero !== undefined) {
158
+ return forms.zero;
159
+ }
160
+ if (count === 1 && forms.one !== undefined) {
161
+ return forms.one;
162
+ }
163
+ if (count === 2 && forms.two !== undefined) {
164
+ return forms.two;
165
+ }
166
+ if (forms.few !== undefined) {
167
+ const mod10 = count % 10;
168
+ const mod100 = count % 100;
169
+ if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
170
+ return forms.few;
171
+ }
172
+ }
173
+ if (forms.many !== undefined) {
174
+ const mod10 = count % 10;
175
+ const mod100 = count % 100;
176
+ if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
177
+ return forms.many;
178
+ }
179
+ }
180
+ return forms.other;
181
+ }
182
+
183
+ // src/i18n/i18n-manager.ts
184
+ class I18nManager {
185
+ static translations = {};
186
+ static currentLocale = "en";
187
+ static fallbackLocale = "en";
188
+ static registerTranslations(locale, catalog) {
189
+ if (!I18nManager.translations[locale]) {
190
+ I18nManager.translations[locale] = {};
191
+ }
192
+ I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
193
+ }
194
+ static setLocale(locale) {
195
+ const normalized = I18nManager.normalizeLocale(locale);
196
+ if (I18nManager.translations[normalized]) {
197
+ I18nManager.currentLocale = normalized;
198
+ return normalized;
199
+ }
200
+ const baseLocale = normalized.split("-")[0];
201
+ if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
202
+ I18nManager.currentLocale = baseLocale;
203
+ return baseLocale;
204
+ }
205
+ return I18nManager.currentLocale;
206
+ }
207
+ static getLocale() {
208
+ return I18nManager.currentLocale;
209
+ }
210
+ static setFallbackLocale(locale) {
211
+ I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
212
+ }
213
+ static t(key, params, locale) {
214
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
215
+ let value = I18nManager.getTranslationValue(key, targetLocale);
216
+ if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
217
+ value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
218
+ }
219
+ if (value === undefined) {
220
+ return key;
221
+ }
222
+ if (isPluralForm(value) && params && "count" in params) {
223
+ const count = typeof params.count === "number" ? params.count : Number(params.count);
224
+ value = selectPluralForm(value, count);
225
+ } else if (isPluralForm(value)) {
226
+ value = value.other;
227
+ }
228
+ if (typeof value !== "string") {
229
+ return key;
230
+ }
231
+ return params ? I18nManager.interpolate(value, params) : value;
232
+ }
233
+ static has(key, locale) {
234
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
235
+ const value = I18nManager.getTranslationValue(key, targetLocale);
236
+ if (value !== undefined) {
237
+ return true;
238
+ }
239
+ if (targetLocale !== I18nManager.fallbackLocale) {
240
+ return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
241
+ }
242
+ return false;
243
+ }
244
+ static getAvailableLocales() {
245
+ return Object.keys(I18nManager.translations);
246
+ }
247
+ static clearTranslations() {
248
+ I18nManager.translations = {};
249
+ I18nManager.currentLocale = "en";
250
+ }
251
+ static getTranslationValue(key, locale) {
252
+ const catalog = I18nManager.translations[locale];
253
+ if (!catalog) {
254
+ return;
255
+ }
256
+ const keys = key.split(".");
257
+ let value = catalog;
258
+ for (const k of keys) {
259
+ if (value && typeof value === "object" && k in value) {
260
+ value = value[k];
261
+ } else {
262
+ return;
263
+ }
264
+ }
265
+ return value;
266
+ }
267
+ static interpolate(template, params) {
268
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
269
+ const value = params[key];
270
+ return value !== undefined ? String(value) : `{${key}}`;
271
+ });
272
+ }
273
+ static normalizeLocale(locale) {
274
+ const normalized = locale.toLowerCase().replace(/_/g, "-");
275
+ const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
276
+ if (specialLocales.includes(normalized)) {
277
+ return normalized;
278
+ }
279
+ return normalized.split("-")[0];
280
+ }
281
+ static deepMerge(target, source) {
282
+ const result = { ...target };
283
+ for (const key of Object.keys(source)) {
284
+ const sourceValue = source[key];
285
+ const targetValue = result[key];
286
+ if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
287
+ result[key] = I18nManager.deepMerge(targetValue, sourceValue);
288
+ } else {
289
+ result[key] = sourceValue;
290
+ }
291
+ }
292
+ return result;
293
+ }
294
+ }
295
+
296
+ // src/i18n/locales/de.ts
297
+ var de = {
298
+ toolCore: {
299
+ errors: {
300
+ internal: "Internal error: {message}",
301
+ fileNotFound: "File not found: {path}",
302
+ fileReadFailed: "Failed to read file: {path}",
303
+ fileWriteFailed: "Failed to write file: {path}",
304
+ directoryNotFound: "Directory not found: {path}",
305
+ invalidPath: "{path} is not a valid path",
306
+ operationCanceled: "Operation was canceled",
307
+ invalidParameter: "Invalid parameter: {parameter}"
308
+ },
309
+ progress: {
310
+ copying: "Copying files...",
311
+ building: "Building project...",
312
+ packaging: "Creating package...",
313
+ validating: "Validating...",
314
+ analyzing: "Analyzing...",
315
+ restoring: "Restoring dependencies..."
316
+ },
317
+ validation: {
318
+ requiredField: "{field} is required",
319
+ invalidValue: "Invalid value for {field}",
320
+ pathNotFound: "Path not found: {path}",
321
+ fileRequired: "File is required: {path}",
322
+ directoryRequired: "Directory is required: {path}"
323
+ },
324
+ warnings: {
325
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
326
+ },
327
+ info: {
328
+ operationComplete: "Operation completed successfully",
329
+ filesProcessed: {
330
+ zero: "No files processed",
331
+ one: "{count} file processed",
332
+ other: "{count} files processed"
333
+ }
334
+ }
335
+ }
336
+ };
337
+
338
+ // src/i18n/locales/en.ts
339
+ var en = {
340
+ toolCore: {
341
+ errors: {
342
+ internal: "Internal error: {message}",
343
+ fileNotFound: "File not found: {path}",
344
+ fileReadFailed: "Failed to read file: {path}",
345
+ fileWriteFailed: "Failed to write file: {path}",
346
+ directoryNotFound: "Directory not found: {path}",
347
+ invalidPath: "{path} is not a valid path",
348
+ operationCanceled: "Operation was canceled",
349
+ invalidParameter: "Invalid parameter: {parameter}"
350
+ },
351
+ progress: {
352
+ copying: "Copying files...",
353
+ building: "Building project...",
354
+ packaging: "Creating package...",
355
+ validating: "Validating...",
356
+ analyzing: "Analyzing...",
357
+ restoring: "Restoring dependencies..."
358
+ },
359
+ validation: {
360
+ requiredField: "{field} is required",
361
+ invalidValue: "Invalid value for {field}",
362
+ pathNotFound: "Path not found: {path}",
363
+ fileRequired: "File is required: {path}",
364
+ directoryRequired: "Directory is required: {path}"
365
+ },
366
+ warnings: {
367
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
368
+ },
369
+ info: {
370
+ operationComplete: "Operation completed successfully",
371
+ filesProcessed: {
372
+ zero: "No files processed",
373
+ one: "{count} file processed",
374
+ other: "{count} files processed"
375
+ }
376
+ }
377
+ }
378
+ };
379
+
380
+ // src/i18n/locales/es.ts
381
+ var es = {
382
+ toolCore: {
383
+ errors: {
384
+ internal: "Internal error: {message}",
385
+ fileNotFound: "File not found: {path}",
386
+ fileReadFailed: "Failed to read file: {path}",
387
+ fileWriteFailed: "Failed to write file: {path}",
388
+ directoryNotFound: "Directory not found: {path}",
389
+ invalidPath: "{path} is not a valid path",
390
+ operationCanceled: "Operation was canceled",
391
+ invalidParameter: "Invalid parameter: {parameter}"
392
+ },
393
+ progress: {
394
+ copying: "Copying files...",
395
+ building: "Building project...",
396
+ packaging: "Creating package...",
397
+ validating: "Validating...",
398
+ analyzing: "Analyzing...",
399
+ restoring: "Restoring dependencies..."
400
+ },
401
+ validation: {
402
+ requiredField: "{field} is required",
403
+ invalidValue: "Invalid value for {field}",
404
+ pathNotFound: "Path not found: {path}",
405
+ fileRequired: "File is required: {path}",
406
+ directoryRequired: "Directory is required: {path}"
407
+ },
408
+ warnings: {
409
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
410
+ },
411
+ info: {
412
+ operationComplete: "Operation completed successfully",
413
+ filesProcessed: {
414
+ zero: "No files processed",
415
+ one: "{count} file processed",
416
+ other: "{count} files processed"
417
+ }
418
+ }
419
+ }
420
+ };
421
+
422
+ // src/i18n/locales/es-MX.ts
423
+ var es_MX = {
424
+ toolCore: {
425
+ errors: {
426
+ internal: "Internal error: {message}",
427
+ fileNotFound: "File not found: {path}",
428
+ fileReadFailed: "Failed to read file: {path}",
429
+ fileWriteFailed: "Failed to write file: {path}",
430
+ directoryNotFound: "Directory not found: {path}",
431
+ invalidPath: "{path} is not a valid path",
432
+ operationCanceled: "Operation was canceled",
433
+ invalidParameter: "Invalid parameter: {parameter}"
434
+ },
435
+ progress: {
436
+ copying: "Copying files...",
437
+ building: "Building project...",
438
+ packaging: "Creating package...",
439
+ validating: "Validating...",
440
+ analyzing: "Analyzing...",
441
+ restoring: "Restoring dependencies..."
442
+ },
443
+ validation: {
444
+ requiredField: "{field} is required",
445
+ invalidValue: "Invalid value for {field}",
446
+ pathNotFound: "Path not found: {path}",
447
+ fileRequired: "File is required: {path}",
448
+ directoryRequired: "Directory is required: {path}"
449
+ },
450
+ warnings: {
451
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
452
+ },
453
+ info: {
454
+ operationComplete: "Operation completed successfully",
455
+ filesProcessed: {
456
+ zero: "No files processed",
457
+ one: "{count} file processed",
458
+ other: "{count} files processed"
459
+ }
460
+ }
461
+ }
462
+ };
463
+
464
+ // src/i18n/locales/fr.ts
465
+ var fr = {
466
+ toolCore: {
467
+ errors: {
468
+ internal: "Internal error: {message}",
469
+ fileNotFound: "File not found: {path}",
470
+ fileReadFailed: "Failed to read file: {path}",
471
+ fileWriteFailed: "Failed to write file: {path}",
472
+ directoryNotFound: "Directory not found: {path}",
473
+ invalidPath: "{path} is not a valid path",
474
+ operationCanceled: "Operation was canceled",
475
+ invalidParameter: "Invalid parameter: {parameter}"
476
+ },
477
+ progress: {
478
+ copying: "Copying files...",
479
+ building: "Building project...",
480
+ packaging: "Creating package...",
481
+ validating: "Validating...",
482
+ analyzing: "Analyzing...",
483
+ restoring: "Restoring dependencies..."
484
+ },
485
+ validation: {
486
+ requiredField: "{field} is required",
487
+ invalidValue: "Invalid value for {field}",
488
+ pathNotFound: "Path not found: {path}",
489
+ fileRequired: "File is required: {path}",
490
+ directoryRequired: "Directory is required: {path}"
491
+ },
492
+ warnings: {
493
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
494
+ },
495
+ info: {
496
+ operationComplete: "Operation completed successfully",
497
+ filesProcessed: {
498
+ zero: "No files processed",
499
+ one: "{count} file processed",
500
+ other: "{count} files processed"
501
+ }
502
+ }
503
+ }
504
+ };
505
+
506
+ // src/i18n/locales/ja.ts
507
+ var ja = {
508
+ toolCore: {
509
+ errors: {
510
+ internal: "Internal error: {message}",
511
+ fileNotFound: "File not found: {path}",
512
+ fileReadFailed: "Failed to read file: {path}",
513
+ fileWriteFailed: "Failed to write file: {path}",
514
+ directoryNotFound: "Directory not found: {path}",
515
+ invalidPath: "{path} is not a valid path",
516
+ operationCanceled: "Operation was canceled",
517
+ invalidParameter: "Invalid parameter: {parameter}"
518
+ },
519
+ progress: {
520
+ copying: "Copying files...",
521
+ building: "Building project...",
522
+ packaging: "Creating package...",
523
+ validating: "Validating...",
524
+ analyzing: "Analyzing...",
525
+ restoring: "Restoring dependencies..."
526
+ },
527
+ validation: {
528
+ requiredField: "{field} is required",
529
+ invalidValue: "Invalid value for {field}",
530
+ pathNotFound: "Path not found: {path}",
531
+ fileRequired: "File is required: {path}",
532
+ directoryRequired: "Directory is required: {path}"
533
+ },
534
+ warnings: {
535
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
536
+ },
537
+ info: {
538
+ operationComplete: "Operation completed successfully",
539
+ filesProcessed: {
540
+ zero: "No files processed",
541
+ one: "{count} file processed",
542
+ other: "{count} files processed"
543
+ }
544
+ }
545
+ }
546
+ };
547
+
548
+ // src/i18n/locales/ko.ts
549
+ var ko = {
550
+ toolCore: {
551
+ errors: {
552
+ internal: "Internal error: {message}",
553
+ fileNotFound: "File not found: {path}",
554
+ fileReadFailed: "Failed to read file: {path}",
555
+ fileWriteFailed: "Failed to write file: {path}",
556
+ directoryNotFound: "Directory not found: {path}",
557
+ invalidPath: "{path} is not a valid path",
558
+ operationCanceled: "Operation was canceled",
559
+ invalidParameter: "Invalid parameter: {parameter}"
560
+ },
561
+ progress: {
562
+ copying: "Copying files...",
563
+ building: "Building project...",
564
+ packaging: "Creating package...",
565
+ validating: "Validating...",
566
+ analyzing: "Analyzing...",
567
+ restoring: "Restoring dependencies..."
568
+ },
569
+ validation: {
570
+ requiredField: "{field} is required",
571
+ invalidValue: "Invalid value for {field}",
572
+ pathNotFound: "Path not found: {path}",
573
+ fileRequired: "File is required: {path}",
574
+ directoryRequired: "Directory is required: {path}"
575
+ },
576
+ warnings: {
577
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
578
+ },
579
+ info: {
580
+ operationComplete: "Operation completed successfully",
581
+ filesProcessed: {
582
+ zero: "No files processed",
583
+ one: "{count} file processed",
584
+ other: "{count} files processed"
585
+ }
586
+ }
587
+ }
588
+ };
589
+
590
+ // src/i18n/locales/pt.ts
591
+ var pt = {
592
+ toolCore: {
593
+ errors: {
594
+ internal: "Internal error: {message}",
595
+ fileNotFound: "File not found: {path}",
596
+ fileReadFailed: "Failed to read file: {path}",
597
+ fileWriteFailed: "Failed to write file: {path}",
598
+ directoryNotFound: "Directory not found: {path}",
599
+ invalidPath: "{path} is not a valid path",
600
+ operationCanceled: "Operation was canceled",
601
+ invalidParameter: "Invalid parameter: {parameter}"
602
+ },
603
+ progress: {
604
+ copying: "Copying files...",
605
+ building: "Building project...",
606
+ packaging: "Creating package...",
607
+ validating: "Validating...",
608
+ analyzing: "Analyzing...",
609
+ restoring: "Restoring dependencies..."
610
+ },
611
+ validation: {
612
+ requiredField: "{field} is required",
613
+ invalidValue: "Invalid value for {field}",
614
+ pathNotFound: "Path not found: {path}",
615
+ fileRequired: "File is required: {path}",
616
+ directoryRequired: "Directory is required: {path}"
617
+ },
618
+ warnings: {
619
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
620
+ },
621
+ info: {
622
+ operationComplete: "Operation completed successfully",
623
+ filesProcessed: {
624
+ zero: "No files processed",
625
+ one: "{count} file processed",
626
+ other: "{count} files processed"
627
+ }
628
+ }
629
+ }
630
+ };
631
+
632
+ // src/i18n/locales/pt-BR.ts
633
+ var pt_BR = {
634
+ toolCore: {
635
+ errors: {
636
+ internal: "Internal error: {message}",
637
+ fileNotFound: "File not found: {path}",
638
+ fileReadFailed: "Failed to read file: {path}",
639
+ fileWriteFailed: "Failed to write file: {path}",
640
+ directoryNotFound: "Directory not found: {path}",
641
+ invalidPath: "{path} is not a valid path",
642
+ operationCanceled: "Operation was canceled",
643
+ invalidParameter: "Invalid parameter: {parameter}"
644
+ },
645
+ progress: {
646
+ copying: "Copying files...",
647
+ building: "Building project...",
648
+ packaging: "Creating package...",
649
+ validating: "Validating...",
650
+ analyzing: "Analyzing...",
651
+ restoring: "Restoring dependencies..."
652
+ },
653
+ validation: {
654
+ requiredField: "{field} is required",
655
+ invalidValue: "Invalid value for {field}",
656
+ pathNotFound: "Path not found: {path}",
657
+ fileRequired: "File is required: {path}",
658
+ directoryRequired: "Directory is required: {path}"
659
+ },
660
+ warnings: {
661
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
662
+ },
663
+ info: {
664
+ operationComplete: "Operation completed successfully",
665
+ filesProcessed: {
666
+ zero: "No files processed",
667
+ one: "{count} file processed",
668
+ other: "{count} files processed"
669
+ }
670
+ }
671
+ }
672
+ };
673
+
674
+ // src/i18n/locales/ro.ts
675
+ var ro = {
676
+ toolCore: {
677
+ errors: {
678
+ internal: "Internal error: {message}",
679
+ fileNotFound: "File not found: {path}",
680
+ fileReadFailed: "Failed to read file: {path}",
681
+ fileWriteFailed: "Failed to write file: {path}",
682
+ directoryNotFound: "Directory not found: {path}",
683
+ invalidPath: "{path} is not a valid path",
684
+ operationCanceled: "Operation was canceled",
685
+ invalidParameter: "Invalid parameter: {parameter}"
686
+ },
687
+ progress: {
688
+ copying: "Copying files...",
689
+ building: "Building project...",
690
+ packaging: "Creating package...",
691
+ validating: "Validating...",
692
+ analyzing: "Analyzing...",
693
+ restoring: "Restoring dependencies..."
694
+ },
695
+ validation: {
696
+ requiredField: "{field} is required",
697
+ invalidValue: "Invalid value for {field}",
698
+ pathNotFound: "Path not found: {path}",
699
+ fileRequired: "File is required: {path}",
700
+ directoryRequired: "Directory is required: {path}"
701
+ },
702
+ warnings: {
703
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
704
+ },
705
+ info: {
706
+ operationComplete: "Operation completed successfully",
707
+ filesProcessed: {
708
+ zero: "No files processed",
709
+ one: "{count} file processed",
710
+ other: "{count} files processed"
711
+ }
712
+ }
713
+ }
714
+ };
715
+
716
+ // src/i18n/locales/ru.ts
717
+ var ru = {
718
+ toolCore: {
719
+ errors: {
720
+ internal: "Internal error: {message}",
721
+ fileNotFound: "File not found: {path}",
722
+ fileReadFailed: "Failed to read file: {path}",
723
+ fileWriteFailed: "Failed to write file: {path}",
724
+ directoryNotFound: "Directory not found: {path}",
725
+ invalidPath: "{path} is not a valid path",
726
+ operationCanceled: "Operation was canceled",
727
+ invalidParameter: "Invalid parameter: {parameter}"
728
+ },
729
+ progress: {
730
+ copying: "Copying files...",
731
+ building: "Building project...",
732
+ packaging: "Creating package...",
733
+ validating: "Validating...",
734
+ analyzing: "Analyzing...",
735
+ restoring: "Restoring dependencies..."
736
+ },
737
+ validation: {
738
+ requiredField: "{field} is required",
739
+ invalidValue: "Invalid value for {field}",
740
+ pathNotFound: "Path not found: {path}",
741
+ fileRequired: "File is required: {path}",
742
+ directoryRequired: "Directory is required: {path}"
743
+ },
744
+ warnings: {
745
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
746
+ },
747
+ info: {
748
+ operationComplete: "Operation completed successfully",
749
+ filesProcessed: {
750
+ zero: "No files processed",
751
+ one: "{count} file processed",
752
+ other: "{count} files processed"
753
+ }
754
+ }
755
+ }
756
+ };
757
+
758
+ // src/i18n/locales/tr.ts
759
+ var tr = {
760
+ toolCore: {
761
+ errors: {
762
+ internal: "Internal error: {message}",
763
+ fileNotFound: "File not found: {path}",
764
+ fileReadFailed: "Failed to read file: {path}",
765
+ fileWriteFailed: "Failed to write file: {path}",
766
+ directoryNotFound: "Directory not found: {path}",
767
+ invalidPath: "{path} is not a valid path",
768
+ operationCanceled: "Operation was canceled",
769
+ invalidParameter: "Invalid parameter: {parameter}"
770
+ },
771
+ progress: {
772
+ copying: "Copying files...",
773
+ building: "Building project...",
774
+ packaging: "Creating package...",
775
+ validating: "Validating...",
776
+ analyzing: "Analyzing...",
777
+ restoring: "Restoring dependencies..."
778
+ },
779
+ validation: {
780
+ requiredField: "{field} is required",
781
+ invalidValue: "Invalid value for {field}",
782
+ pathNotFound: "Path not found: {path}",
783
+ fileRequired: "File is required: {path}",
784
+ directoryRequired: "Directory is required: {path}"
785
+ },
786
+ warnings: {
787
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
788
+ },
789
+ info: {
790
+ operationComplete: "Operation completed successfully",
791
+ filesProcessed: {
792
+ zero: "No files processed",
793
+ one: "{count} file processed",
794
+ other: "{count} files processed"
795
+ }
796
+ }
797
+ }
798
+ };
799
+
800
+ // src/i18n/locales/zh-CN.ts
801
+ var zh_CN = {
802
+ toolCore: {
803
+ errors: {
804
+ internal: "Internal error: {message}",
805
+ fileNotFound: "File not found: {path}",
806
+ fileReadFailed: "Failed to read file: {path}",
807
+ fileWriteFailed: "Failed to write file: {path}",
808
+ directoryNotFound: "Directory not found: {path}",
809
+ invalidPath: "{path} is not a valid path",
810
+ operationCanceled: "Operation was canceled",
811
+ invalidParameter: "Invalid parameter: {parameter}"
812
+ },
813
+ progress: {
814
+ copying: "Copying files...",
815
+ building: "Building project...",
816
+ packaging: "Creating package...",
817
+ validating: "Validating...",
818
+ analyzing: "Analyzing...",
819
+ restoring: "Restoring dependencies..."
820
+ },
821
+ validation: {
822
+ requiredField: "{field} is required",
823
+ invalidValue: "Invalid value for {field}",
824
+ pathNotFound: "Path not found: {path}",
825
+ fileRequired: "File is required: {path}",
826
+ directoryRequired: "Directory is required: {path}"
827
+ },
828
+ warnings: {
829
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
830
+ },
831
+ info: {
832
+ operationComplete: "Operation completed successfully",
833
+ filesProcessed: {
834
+ zero: "No files processed",
835
+ one: "{count} file processed",
836
+ other: "{count} files processed"
837
+ }
838
+ }
839
+ }
840
+ };
841
+
842
+ // src/i18n/locales/zh-TW.ts
843
+ var zh_TW = {
844
+ toolCore: {
845
+ errors: {
846
+ internal: "Internal error: {message}",
847
+ fileNotFound: "File not found: {path}",
848
+ fileReadFailed: "Failed to read file: {path}",
849
+ fileWriteFailed: "Failed to write file: {path}",
850
+ directoryNotFound: "Directory not found: {path}",
851
+ invalidPath: "{path} is not a valid path",
852
+ operationCanceled: "Operation was canceled",
853
+ invalidParameter: "Invalid parameter: {parameter}"
854
+ },
855
+ progress: {
856
+ copying: "Copying files...",
857
+ building: "Building project...",
858
+ packaging: "Creating package...",
859
+ validating: "Validating...",
860
+ analyzing: "Analyzing...",
861
+ restoring: "Restoring dependencies..."
862
+ },
863
+ validation: {
864
+ requiredField: "{field} is required",
865
+ invalidValue: "Invalid value for {field}",
866
+ pathNotFound: "Path not found: {path}",
867
+ fileRequired: "File is required: {path}",
868
+ directoryRequired: "Directory is required: {path}"
869
+ },
870
+ warnings: {
871
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
872
+ },
873
+ info: {
874
+ operationComplete: "Operation completed successfully",
875
+ filesProcessed: {
876
+ zero: "No files processed",
877
+ one: "{count} file processed",
878
+ other: "{count} files processed"
879
+ }
880
+ }
881
+ }
882
+ };
883
+
884
+ // src/i18n/locales/zu.ts
885
+ var zu = {
886
+ toolCore: {
887
+ errors: {
888
+ internal: "Internal error: {message}",
889
+ fileNotFound: "File not found: {path}",
890
+ fileReadFailed: "Failed to read file: {path}",
891
+ fileWriteFailed: "Failed to write file: {path}",
892
+ directoryNotFound: "Directory not found: {path}",
893
+ invalidPath: "{path} is not a valid path",
894
+ operationCanceled: "Operation was canceled",
895
+ invalidParameter: "Invalid parameter: {parameter}"
896
+ },
897
+ progress: {
898
+ copying: "Copying files...",
899
+ building: "Building project...",
900
+ packaging: "Creating package...",
901
+ validating: "Validating...",
902
+ analyzing: "Analyzing...",
903
+ restoring: "Restoring dependencies..."
904
+ },
905
+ validation: {
906
+ requiredField: "{field} is required",
907
+ invalidValue: "Invalid value for {field}",
908
+ pathNotFound: "Path not found: {path}",
909
+ fileRequired: "File is required: {path}",
910
+ directoryRequired: "Directory is required: {path}"
911
+ },
912
+ warnings: {
913
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
914
+ },
915
+ info: {
916
+ operationComplete: "Operation completed successfully",
917
+ filesProcessed: {
918
+ zero: "No files processed",
919
+ one: "{count} file processed",
920
+ other: "{count} files processed"
921
+ }
922
+ }
923
+ }
924
+ };
925
+
926
+ // src/i18n/translation-service.ts
927
+ class TranslationService {
928
+ static instance;
929
+ currentLocale = "en";
930
+ constructor() {}
931
+ static getInstance() {
932
+ if (!TranslationService.instance) {
933
+ TranslationService.instance = new TranslationService;
934
+ }
935
+ return TranslationService.instance;
936
+ }
937
+ setLocale(locale) {
938
+ this.currentLocale = I18nManager.setLocale(locale);
939
+ }
940
+ getLocale() {
941
+ return this.currentLocale;
942
+ }
943
+ t(key, params) {
944
+ return I18nManager.t(key, params, this.currentLocale);
945
+ }
946
+ tLocale(key, locale, params) {
947
+ return I18nManager.t(key, params, locale);
948
+ }
949
+ has(key) {
950
+ return I18nManager.has(key, this.currentLocale);
951
+ }
952
+ getAvailableLocales() {
953
+ return I18nManager.getAvailableLocales();
954
+ }
955
+ }
956
+ var translate = TranslationService.getInstance();
957
+
958
+ // src/i18n/index.ts
959
+ I18nManager.registerTranslations("en", en);
960
+ I18nManager.registerTranslations("de", de);
961
+ I18nManager.registerTranslations("es", es);
962
+ I18nManager.registerTranslations("es-mx", es_MX);
963
+ I18nManager.registerTranslations("fr", fr);
964
+ I18nManager.registerTranslations("ja", ja);
965
+ I18nManager.registerTranslations("ko", ko);
966
+ I18nManager.registerTranslations("pt", pt);
967
+ I18nManager.registerTranslations("pt-br", pt_BR);
968
+ I18nManager.registerTranslations("ro", ro);
969
+ I18nManager.registerTranslations("ru", ru);
970
+ I18nManager.registerTranslations("tr", tr);
971
+ I18nManager.registerTranslations("zh-cn", zh_CN);
972
+ I18nManager.registerTranslations("zh-tw", zh_TW);
973
+ I18nManager.registerTranslations("zu", zu);
974
+ I18nManager.setLocale("en");
975
+ // src/models/build-configuration.ts
976
+ var BuildConfiguration;
977
+ ((BuildConfiguration2) => {
978
+ BuildConfiguration2["Debug"] = "Debug";
979
+ BuildConfiguration2["Release"] = "Release";
980
+ })(BuildConfiguration ||= {});
981
+ // src/models/connection-info.ts
982
+ function toRelativeUrl(url) {
983
+ let path;
984
+ try {
985
+ path = new URL(url).pathname;
986
+ } catch {
987
+ path = url;
988
+ }
989
+ while (path.endsWith("/")) {
990
+ path = path.slice(0, -1);
991
+ }
992
+ return path;
993
+ }
994
+ // src/models/log-message.ts
995
+ var LogLevel;
996
+ ((LogLevel2) => {
997
+ LogLevel2["Debug"] = "Debug";
998
+ LogLevel2["Info"] = "Information";
999
+ LogLevel2["Warn"] = "Warning";
1000
+ LogLevel2["Error"] = "Error";
1001
+ })(LogLevel ||= {});
1002
+
1003
+ class LogMessage {
1004
+ message;
1005
+ logLevel;
1006
+ source;
1007
+ sourceTarget;
1008
+ progress;
1009
+ code;
1010
+ filePath;
1011
+ line;
1012
+ id;
1013
+ timestamp;
1014
+ constructor(message, logLevel, options) {
1015
+ this.message = message;
1016
+ this.logLevel = logLevel;
1017
+ this.source = options?.source;
1018
+ this.sourceTarget = options?.sourceTarget;
1019
+ this.progress = options?.progress;
1020
+ this.code = options?.code;
1021
+ this.filePath = options?.filePath;
1022
+ this.line = options?.line;
1023
+ this.id = options?.id;
1024
+ this.timestamp = new Date;
1025
+ }
1026
+ toFormattedString() {
1027
+ const parts = [];
1028
+ parts.push(`[${this.timestamp.toISOString()}]`);
1029
+ parts.push(`[${String(this.logLevel).toUpperCase()}]`);
1030
+ if (this.source) {
1031
+ parts.push(`[${this.source}]`);
1032
+ }
1033
+ if (this.sourceTarget) {
1034
+ parts.push(`[${this.sourceTarget}]`);
1035
+ }
1036
+ const locationParts = [];
1037
+ if (this.filePath) {
1038
+ locationParts.push(this.filePath);
1039
+ }
1040
+ if (this.line) {
1041
+ locationParts.push(`Line:${this.line}`);
1042
+ }
1043
+ if (this.id) {
1044
+ locationParts.push(`Id:${this.id}`);
1045
+ }
1046
+ if (locationParts.length > 0) {
1047
+ parts.push(`(${locationParts.join("")})`);
1048
+ }
1049
+ if (this.code) {
1050
+ parts.push(`[${this.code}]`);
1051
+ }
1052
+ if (this.progress || this.progress === 0) {
1053
+ parts.push(`${this.progress}%`);
1054
+ }
1055
+ parts.push(this.message);
1056
+ return parts.join(" ");
1057
+ }
1058
+ }
1059
+ // src/models/nuget-constants.ts
1060
+ var NugetConstants = {
1061
+ OutputFolderName: "bundle",
1062
+ ContentFolderName: "content",
1063
+ OperateFileName: "operate.json",
1064
+ EntryPointsFileName: "entry-points.json",
1065
+ PackageDescriptorFileName: "package-descriptor.json",
1066
+ BindingsV2FileName: "bindings_v2.json",
1067
+ BindingsFileId: "bindings.json"
1068
+ };
1069
+ // src/models/project-type.ts
1070
+ var ProjectTypes;
1071
+ ((ProjectTypes2) => {
1072
+ ProjectTypes2["Agent"] = "Agent";
1073
+ ProjectTypes2["Api"] = "Api";
1074
+ ProjectTypes2["Connector"] = "Connector";
1075
+ ProjectTypes2["CaseManagement"] = "CaseManagement";
1076
+ ProjectTypes2["Flow"] = "Flow";
1077
+ ProjectTypes2["Function"] = "Function";
1078
+ ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
1079
+ ProjectTypes2["Process"] = "Process";
1080
+ ProjectTypes2["Library"] = "Library";
1081
+ ProjectTypes2["WebApp"] = "WebApp";
1082
+ ProjectTypes2["Tests"] = "Tests";
1083
+ ProjectTypes2["AppV2"] = "AppV2";
1084
+ })(ProjectTypes ||= {});
1085
+ // src/models/target-frameworks.ts
1086
+ var TargetFramework;
1087
+ ((TargetFramework2) => {
1088
+ TargetFramework2["Portable"] = "Portable";
1089
+ TargetFramework2["Windows"] = "Windows";
1090
+ })(TargetFramework ||= {});
1091
+ // src/models/tool-error-code.ts
1092
+ var ToolErrorCodes;
1093
+ ((ToolErrorCodes2) => {
1094
+ ToolErrorCodes2["Success"] = "SUCCESS";
1095
+ ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
1096
+ ToolErrorCodes2["Canceled"] = "CANCELED";
1097
+ })(ToolErrorCodes ||= {});
1098
+ // src/models/tool-result.ts
1099
+ class ToolResult {
1100
+ errorCode;
1101
+ message;
1102
+ packages;
1103
+ constructor(errorCode, message, packages = []) {
1104
+ this.errorCode = errorCode;
1105
+ this.message = message;
1106
+ this.packages = packages;
1107
+ }
1108
+ get isSuccess() {
1109
+ return this.errorCode === "SUCCESS" /* Success */;
1110
+ }
1111
+ static success() {
1112
+ return new ToolResult("SUCCESS" /* Success */);
1113
+ }
1114
+ static error(errorCode, message) {
1115
+ return new ToolResult(errorCode, message);
1116
+ }
1117
+ }
1118
+ // src/package-descriptor/project-bindings-file-model.ts
1119
+ function createDefaultBindingsVersion() {
1120
+ return { major: 2, minor: 0 };
1121
+ }
1122
+ // src/services/nuget-packager.ts
1123
+ import { zipSync as zipSync2 } from "fflate";
1124
+ function escapeXml(str) {
1125
+ if (str === null || str === undefined) {
1126
+ return "";
1127
+ }
1128
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1129
+ }
1130
+ function optionalElement(name, value) {
1131
+ if (value === undefined || value === "")
1132
+ return "";
1133
+ return ` <${name}>${escapeXml(value)}</${name}>
1134
+ `;
1135
+ }
1136
+ function generateDependenciesXml(dependencies) {
1137
+ if (!dependencies || dependencies.length === 0)
1138
+ return "";
1139
+ const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
1140
+ `);
1141
+ return ` <dependencies>
1142
+ ${deps}
1143
+ </dependencies>
1144
+ `;
1145
+ }
1146
+ function generateRepositoryXml(packageInfo) {
1147
+ if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
1148
+ return "";
1149
+ let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
1150
+ if (packageInfo.repositoryBranch) {
1151
+ repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
1152
+ }
1153
+ if (packageInfo.repositoryCommit) {
1154
+ repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
1155
+ }
1156
+ repoXml += ` />
1157
+ `;
1158
+ return repoXml;
1159
+ }
1160
+ function generateNuspecXml(packageInfo) {
1161
+ const author = packageInfo.author?.trim() || "UiPath";
1162
+ const description = packageInfo.description?.trim() || "Created by UiPath";
1163
+ const title = packageInfo.title?.trim() || packageInfo.id;
1164
+ const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
1165
+ const releaseNotes = packageInfo.releaseNotes ?? "";
1166
+ const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
1167
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
1168
+ <metadata>
1169
+ <id>${escapeXml(packageInfo.id)}</id>
1170
+ <version>${escapeXml(packageInfo.version)}</version>
1171
+ <title>${escapeXml(title)}</title>
1172
+ <authors>${escapeXml(author)}</authors>
1173
+ <requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
1174
+ <description>${escapeXml(description)}</description>
1175
+ <releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
1176
+ ${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>
1177
+ </package>
1178
+ `;
1179
+ return xml;
1180
+ }
1181
+ function generatePsmdcpXml(packageInfo) {
1182
+ const author = packageInfo.author?.trim() || "UiPath";
1183
+ const description = packageInfo.description?.trim() || "Created by UiPath";
1184
+ return `<?xml version="1.0" encoding="utf-8"?>
1185
+ <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">
1186
+ <dc:creator>${escapeXml(author)}</dc:creator>
1187
+ <dc:description>${escapeXml(description)}</dc:description>
1188
+ <dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
1189
+ <version>${escapeXml(packageInfo.version)}</version>
1190
+ <keywords></keywords>
1191
+ <lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
1192
+ </coreProperties>`;
1193
+ }
1194
+
1195
+ class NugetPackager {
1196
+ fileSystem;
1197
+ constructor(fileSystem) {
1198
+ this.fileSystem = fileSystem;
1199
+ }
1200
+ async packAsync(rootPath, packageInfo, outputPath) {
1201
+ const normalizedOutputPath = Path.normalize(outputPath);
1202
+ const nuspecXml = generateNuspecXml(packageInfo);
1203
+ const nuspecFileName = `${packageInfo.id}.nuspec`;
1204
+ const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
1205
+ const zipContents = {};
1206
+ const encoder = new TextEncoder;
1207
+ const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
1208
+ const psmdcpFileName = `${psmdcpId}.psmdcp`;
1209
+ const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
1210
+ const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
1211
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
1212
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
1213
+ <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
1214
+ <Default Extension="uiproj" ContentType="application/octet" />
1215
+ <Default Extension="json" ContentType="application/octet" />
1216
+ <Default Extension="nuspec" ContentType="application/octet" />
1217
+ </Types>`;
1218
+ zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
1219
+ const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
1220
+ const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
1221
+ const relsXml = `<?xml version="1.0" encoding="utf-8"?>
1222
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
1223
+ <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
1224
+ <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
1225
+ </Relationships>`;
1226
+ zipContents["_rels/.rels"] = encoder.encode(relsXml);
1227
+ zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
1228
+ zipContents[nuspecFileName] = encoder.encode(nuspecXml);
1229
+ for (const entry of fileEntries) {
1230
+ const content = await this.fileSystem.readFile(entry.absolutePath);
1231
+ if (content !== null) {
1232
+ zipContents[entry.relativePath] = content;
1233
+ }
1234
+ }
1235
+ const zippedData = zipSync2(zipContents);
1236
+ await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
1237
+ return {
1238
+ outputPath: normalizedOutputPath
1239
+ };
1240
+ }
1241
+ }
1242
+ // src/services/project-tool.ts
1243
+ class ProjectTool {
1244
+ fileSystem;
1245
+ logger;
1246
+ constructor(fileSystem, logger) {
1247
+ this.fileSystem = fileSystem;
1248
+ this.logger = logger;
1249
+ }
1250
+ async restoreAsync(_options, _cancellationToken) {
1251
+ this.logger.info("Restore operation is a noop");
1252
+ return ToolResult.success();
1253
+ }
1254
+ async validateAsync(_options, _cancellationToken) {
1255
+ this.logger.info("Validate operation is a noop");
1256
+ return ToolResult.success();
1257
+ }
1258
+ async buildAsync(_options, _cancellationToken) {
1259
+ this.logger.info("Build operation is a noop");
1260
+ return ToolResult.success();
1261
+ }
1262
+ async packAsync(_options, _cancellationToken) {
1263
+ this.logger.info("Pack operation is a noop");
1264
+ return ToolResult.success();
1265
+ }
1266
+ async dispose() {}
1267
+ }
1268
+ // src/services/solution-tool.ts
1269
+ class SolutionTool {
1270
+ fileSystem;
1271
+ logger;
1272
+ constructor(fileSystem, logger) {
1273
+ this.fileSystem = fileSystem;
1274
+ this.logger = logger;
1275
+ }
1276
+ async restoreAsync(_options, _cancellationToken) {
1277
+ this.logger.info("Restore operation is a noop");
1278
+ return ToolResult.success();
1279
+ }
1280
+ async validateAsync(_options, _cancellationToken) {
1281
+ this.logger.info("Validate operation is a noop");
1282
+ return ToolResult.success();
1283
+ }
1284
+ async buildAsync(_options, _cancellationToken) {
1285
+ this.logger.info("Build operation is a noop");
1286
+ return ToolResult.success();
1287
+ }
1288
+ async packAsync(_options, _cancellationToken) {
1289
+ this.logger.info("Pack operation is a noop");
1290
+ return ToolResult.success();
1291
+ }
1292
+ dispose() {}
1293
+ }
1294
+ // src/services/tools-factory-repository.ts
1295
+ class ToolsFactoryRepository {
1296
+ projectFactoryMap = new Map;
1297
+ solutionFactory = null;
1298
+ registerProjectToolFactory(factory) {
1299
+ for (const type of factory.supportedTypes) {
1300
+ if (this.projectFactoryMap.has(type)) {
1301
+ console.warn(`Tool factory already registered for project type '${type}', skipping.`);
1302
+ continue;
1303
+ }
1304
+ this.projectFactoryMap.set(type, factory);
1305
+ }
1306
+ }
1307
+ registerSolutionToolFactory(factory) {
1308
+ this.solutionFactory = factory;
1309
+ }
1310
+ getSolutionToolFactory() {
1311
+ if (!this.solutionFactory) {
1312
+ throw new Error("No solution tool factory is registered");
1313
+ }
1314
+ return this.solutionFactory;
1315
+ }
1316
+ canHandleProject(projectType) {
1317
+ return this.projectFactoryMap.has(projectType);
1318
+ }
1319
+ getProjectToolFactory(projectType) {
1320
+ const factory = this.projectFactoryMap.get(projectType);
1321
+ if (!factory) {
1322
+ throw new Error(`No tool factory found for project type '${projectType}'`);
1323
+ }
1324
+ return factory;
1325
+ }
1326
+ reset() {
1327
+ this.projectFactoryMap.clear();
1328
+ this.solutionFactory = null;
1329
+ }
1330
+ }
1331
+ var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
1332
+ var _global = globalThis;
1333
+ if (!_global[REGISTRY_KEY]) {
1334
+ _global[REGISTRY_KEY] = new ToolsFactoryRepository;
1335
+ }
1336
+ var toolsFactoryRepository = _global[REGISTRY_KEY];
1337
+ export {
1338
+ translate,
1339
+ toolsFactoryRepository,
1340
+ toRelativeUrl,
1341
+ createDefaultBindingsVersion,
1342
+ ZipService,
1343
+ TranslationService,
1344
+ ToolsFactoryRepository,
1345
+ ToolResult,
1346
+ ToolErrorCodes,
1347
+ TemporaryStorageService,
1348
+ TargetFramework,
1349
+ SolutionTool,
1350
+ ProjectTypes,
1351
+ ProjectTool,
1352
+ Path,
1353
+ NugetPackager,
1354
+ NugetConstants,
1355
+ LogMessage,
1356
+ LogLevel,
1357
+ I18nManager,
1358
+ BuildConfiguration
1359
+ };