@uipath/codedapp-tool 1.201.0-preview.132 → 1.202.0-preview.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{browser-strategy-16yagjhr.js → browser-strategy-6atc7v8s.js} +3 -3
- package/dist/{index-y19pndcy.js → index-d9c1ecq8.js} +71 -69
- package/dist/{index-4tmzxx6y.js → index-h630x08t.js} +158 -76
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/index.js +11 -9
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87tvr6f6.js} +16 -16
- package/dist/{multipart-parser-kme45c99.js → multipart-parser-ab4q7byb.js} +2 -2
- package/dist/{node-strategy-gfq7k0sx.js → node-strategy-bpshtz02.js} +130 -14
- package/dist/packager-tool-14ha5twz.js +1838 -0
- package/dist/{tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{tool-yadq0xpc.js → packager-tool-8hncwr6a.js} +56 -302
- package/dist/packager-tool-jke4p8q1.js +1515 -0
- package/dist/{tool-4pvh3k50.js → packager-tool-qyctya2j.js} +2 -2
- package/dist/{tool-gy8x81f2.js → packager-tool-s019q130.js} +1443 -3112
- package/dist/{tool-25qmnad0.js → packager-tool-vcw2ht7n.js} +1188 -1873
- package/dist/{tool-y0g9grx6.js → packager-tool-vv9c52ax.js} +5 -5
- package/dist/{tool-q42rrs00.js → packager-tool-yc4kw997.js} +3 -2
- package/dist/packager-tool.js +17 -0
- package/dist/tool.js +13 -11
- package/package.json +4 -3
- /package/dist/{tool-0gctz400.js → packager-tool-0gctz400.js} +0 -0
|
@@ -0,0 +1,1838 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zipSync
|
|
3
|
+
} from "./packager-tool-jke4p8q1.js";
|
|
4
|
+
|
|
5
|
+
// ../packager/packager-core/dist/index.js
|
|
6
|
+
class Path {
|
|
7
|
+
static normalize(path) {
|
|
8
|
+
return path.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
9
|
+
}
|
|
10
|
+
static join(...segments) {
|
|
11
|
+
return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
|
|
12
|
+
}
|
|
13
|
+
static dirname(path) {
|
|
14
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
15
|
+
if (normalized === "")
|
|
16
|
+
return ".";
|
|
17
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
18
|
+
if (lastSlash === -1)
|
|
19
|
+
return ".";
|
|
20
|
+
if (lastSlash === 0)
|
|
21
|
+
return "/";
|
|
22
|
+
return normalized.substring(0, lastSlash);
|
|
23
|
+
}
|
|
24
|
+
static basename(path) {
|
|
25
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
26
|
+
if (normalized === "")
|
|
27
|
+
return "";
|
|
28
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
29
|
+
return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
|
|
30
|
+
}
|
|
31
|
+
static extname(path) {
|
|
32
|
+
const base = Path.basename(path);
|
|
33
|
+
const lastDot = base.lastIndexOf(".");
|
|
34
|
+
if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
return base.substring(lastDot);
|
|
38
|
+
}
|
|
39
|
+
static async walkDirectory(fs, rootPath, currentRelativePath = "") {
|
|
40
|
+
const entries = [];
|
|
41
|
+
const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
|
|
42
|
+
const items = await fs.readdir(absolutePath);
|
|
43
|
+
for (const item of items) {
|
|
44
|
+
const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
|
|
45
|
+
const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
|
|
46
|
+
const stat = await fs.stat(itemAbsolutePath);
|
|
47
|
+
if (stat?.isDirectory()) {
|
|
48
|
+
const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
|
|
49
|
+
entries.push(...subEntries);
|
|
50
|
+
} else if (stat?.isFile()) {
|
|
51
|
+
entries.push({
|
|
52
|
+
relativePath: Path.normalize(itemRelativePath),
|
|
53
|
+
absolutePath: Path.normalize(itemAbsolutePath)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return entries;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class TemporaryStorageService {
|
|
62
|
+
fileSystem;
|
|
63
|
+
_tempFolderPath = null;
|
|
64
|
+
constructor(fileSystem) {
|
|
65
|
+
this.fileSystem = fileSystem;
|
|
66
|
+
}
|
|
67
|
+
async getTempFolderPath() {
|
|
68
|
+
if (!this._tempFolderPath) {
|
|
69
|
+
const systemTempDir = await this.fileSystem.getTempDir();
|
|
70
|
+
const uniqueFolderName = this.generateUniqueFolderName();
|
|
71
|
+
this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
|
|
72
|
+
await this.fileSystem.mkdir(this._tempFolderPath);
|
|
73
|
+
}
|
|
74
|
+
return this._tempFolderPath;
|
|
75
|
+
}
|
|
76
|
+
generateUniqueFolderName() {
|
|
77
|
+
const timestamp = Date.now();
|
|
78
|
+
const random = Math.random().toString(36).substring(2, 10);
|
|
79
|
+
return `tool-temp-${timestamp}-${random}`;
|
|
80
|
+
}
|
|
81
|
+
async getTempSubfolderPathAsync(subfolder) {
|
|
82
|
+
const tempFolderPath = await this.getTempFolderPath();
|
|
83
|
+
const inputPath = Path.join(tempFolderPath, subfolder);
|
|
84
|
+
await this.fileSystem.mkdir(inputPath);
|
|
85
|
+
return inputPath;
|
|
86
|
+
}
|
|
87
|
+
async cleanup() {
|
|
88
|
+
try {
|
|
89
|
+
if (!this._tempFolderPath) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const stats = await this.fileSystem.stat(this._tempFolderPath);
|
|
94
|
+
if (!stats) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
} catch {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const _pathToCleanup = this._tempFolderPath;
|
|
101
|
+
await this.fileSystem.rm(this._tempFolderPath);
|
|
102
|
+
this._tempFolderPath = null;
|
|
103
|
+
} catch {}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function isPluralForm(value) {
|
|
107
|
+
return typeof value === "object" && value !== null && "other" in value;
|
|
108
|
+
}
|
|
109
|
+
function selectPluralForm(forms, count) {
|
|
110
|
+
if (count === 0 && forms.zero !== undefined) {
|
|
111
|
+
return forms.zero;
|
|
112
|
+
}
|
|
113
|
+
if (count === 1 && forms.one !== undefined) {
|
|
114
|
+
return forms.one;
|
|
115
|
+
}
|
|
116
|
+
if (count === 2 && forms.two !== undefined) {
|
|
117
|
+
return forms.two;
|
|
118
|
+
}
|
|
119
|
+
if (forms.few !== undefined) {
|
|
120
|
+
const mod10 = count % 10;
|
|
121
|
+
const mod100 = count % 100;
|
|
122
|
+
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
|
|
123
|
+
return forms.few;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (forms.many !== undefined) {
|
|
127
|
+
const mod10 = count % 10;
|
|
128
|
+
const mod100 = count % 100;
|
|
129
|
+
if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
|
|
130
|
+
return forms.many;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return forms.other;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class I18nManager {
|
|
137
|
+
static translations = {};
|
|
138
|
+
static currentLocale = "en";
|
|
139
|
+
static fallbackLocale = "en";
|
|
140
|
+
static registerTranslations(locale, catalog) {
|
|
141
|
+
if (!I18nManager.translations[locale]) {
|
|
142
|
+
I18nManager.translations[locale] = {};
|
|
143
|
+
}
|
|
144
|
+
I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
|
|
145
|
+
}
|
|
146
|
+
static setLocale(locale) {
|
|
147
|
+
const normalized = I18nManager.normalizeLocale(locale);
|
|
148
|
+
if (I18nManager.translations[normalized]) {
|
|
149
|
+
I18nManager.currentLocale = normalized;
|
|
150
|
+
return normalized;
|
|
151
|
+
}
|
|
152
|
+
const baseLocale = normalized.split("-")[0];
|
|
153
|
+
if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
|
|
154
|
+
I18nManager.currentLocale = baseLocale;
|
|
155
|
+
return baseLocale;
|
|
156
|
+
}
|
|
157
|
+
return I18nManager.currentLocale;
|
|
158
|
+
}
|
|
159
|
+
static getLocale() {
|
|
160
|
+
return I18nManager.currentLocale;
|
|
161
|
+
}
|
|
162
|
+
static setFallbackLocale(locale) {
|
|
163
|
+
I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
|
|
164
|
+
}
|
|
165
|
+
static t(key, params, locale) {
|
|
166
|
+
const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
|
|
167
|
+
let value = I18nManager.getTranslationValue(key, targetLocale);
|
|
168
|
+
if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
|
|
169
|
+
value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
|
|
170
|
+
}
|
|
171
|
+
if (value === undefined) {
|
|
172
|
+
return key;
|
|
173
|
+
}
|
|
174
|
+
if (isPluralForm(value) && params && "count" in params) {
|
|
175
|
+
const count = typeof params.count === "number" ? params.count : Number(params.count);
|
|
176
|
+
value = selectPluralForm(value, count);
|
|
177
|
+
} else if (isPluralForm(value)) {
|
|
178
|
+
value = value.other;
|
|
179
|
+
}
|
|
180
|
+
if (typeof value !== "string") {
|
|
181
|
+
return key;
|
|
182
|
+
}
|
|
183
|
+
return params ? I18nManager.interpolate(value, params) : value;
|
|
184
|
+
}
|
|
185
|
+
static has(key, locale) {
|
|
186
|
+
const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
|
|
187
|
+
const value = I18nManager.getTranslationValue(key, targetLocale);
|
|
188
|
+
if (value !== undefined) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
if (targetLocale !== I18nManager.fallbackLocale) {
|
|
192
|
+
return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
static getAvailableLocales() {
|
|
197
|
+
return Object.keys(I18nManager.translations);
|
|
198
|
+
}
|
|
199
|
+
static clearTranslations() {
|
|
200
|
+
I18nManager.translations = {};
|
|
201
|
+
I18nManager.currentLocale = "en";
|
|
202
|
+
}
|
|
203
|
+
static getTranslationValue(key, locale) {
|
|
204
|
+
const catalog = I18nManager.translations[locale];
|
|
205
|
+
if (!catalog) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const keys = key.split(".");
|
|
209
|
+
let value = catalog;
|
|
210
|
+
for (const k of keys) {
|
|
211
|
+
if (value && typeof value === "object" && k in value) {
|
|
212
|
+
value = value[k];
|
|
213
|
+
} else {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
static interpolate(template, params) {
|
|
220
|
+
return template.replace(/\{(\w+)\}/g, (_, key) => {
|
|
221
|
+
const value = params[key];
|
|
222
|
+
return value !== undefined ? String(value) : `{${key}}`;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
static normalizeLocale(locale) {
|
|
226
|
+
const normalized = locale.toLowerCase().replace(/_/g, "-");
|
|
227
|
+
const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
|
|
228
|
+
if (specialLocales.includes(normalized)) {
|
|
229
|
+
return normalized;
|
|
230
|
+
}
|
|
231
|
+
return normalized.split("-")[0];
|
|
232
|
+
}
|
|
233
|
+
static deepMerge(target, source) {
|
|
234
|
+
const result = { ...target };
|
|
235
|
+
for (const key of Object.keys(source)) {
|
|
236
|
+
const sourceValue = source[key];
|
|
237
|
+
const targetValue = result[key];
|
|
238
|
+
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
|
|
239
|
+
result[key] = I18nManager.deepMerge(targetValue, sourceValue);
|
|
240
|
+
} else {
|
|
241
|
+
result[key] = sourceValue;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
var de = {
|
|
248
|
+
toolCore: {
|
|
249
|
+
errors: {
|
|
250
|
+
internal: "Internal error: {message}",
|
|
251
|
+
fileNotFound: "File not found: {path}",
|
|
252
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
253
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
254
|
+
directoryNotFound: "Directory not found: {path}",
|
|
255
|
+
invalidPath: "{path} is not a valid path",
|
|
256
|
+
operationCanceled: "Operation was canceled",
|
|
257
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
258
|
+
},
|
|
259
|
+
progress: {
|
|
260
|
+
copying: "Copying files...",
|
|
261
|
+
building: "Building project...",
|
|
262
|
+
packaging: "Creating package...",
|
|
263
|
+
validating: "Validating...",
|
|
264
|
+
analyzing: "Analyzing...",
|
|
265
|
+
restoring: "Restoring dependencies..."
|
|
266
|
+
},
|
|
267
|
+
validation: {
|
|
268
|
+
requiredField: "{field} is required",
|
|
269
|
+
invalidValue: "Invalid value for {field}",
|
|
270
|
+
pathNotFound: "Path not found: {path}",
|
|
271
|
+
fileRequired: "File is required: {path}",
|
|
272
|
+
directoryRequired: "Directory is required: {path}"
|
|
273
|
+
},
|
|
274
|
+
warnings: {
|
|
275
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
276
|
+
},
|
|
277
|
+
info: {
|
|
278
|
+
operationComplete: "Operation completed successfully",
|
|
279
|
+
filesProcessed: {
|
|
280
|
+
zero: "No files processed",
|
|
281
|
+
one: "{count} file processed",
|
|
282
|
+
other: "{count} files processed"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
var en = {
|
|
288
|
+
toolCore: {
|
|
289
|
+
errors: {
|
|
290
|
+
internal: "Internal error: {message}",
|
|
291
|
+
fileNotFound: "File not found: {path}",
|
|
292
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
293
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
294
|
+
directoryNotFound: "Directory not found: {path}",
|
|
295
|
+
invalidPath: "{path} is not a valid path",
|
|
296
|
+
operationCanceled: "Operation was canceled",
|
|
297
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
298
|
+
},
|
|
299
|
+
progress: {
|
|
300
|
+
copying: "Copying files...",
|
|
301
|
+
building: "Building project...",
|
|
302
|
+
packaging: "Creating package...",
|
|
303
|
+
validating: "Validating...",
|
|
304
|
+
analyzing: "Analyzing...",
|
|
305
|
+
restoring: "Restoring dependencies..."
|
|
306
|
+
},
|
|
307
|
+
validation: {
|
|
308
|
+
requiredField: "{field} is required",
|
|
309
|
+
invalidValue: "Invalid value for {field}",
|
|
310
|
+
pathNotFound: "Path not found: {path}",
|
|
311
|
+
fileRequired: "File is required: {path}",
|
|
312
|
+
directoryRequired: "Directory is required: {path}"
|
|
313
|
+
},
|
|
314
|
+
warnings: {
|
|
315
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
316
|
+
},
|
|
317
|
+
info: {
|
|
318
|
+
operationComplete: "Operation completed successfully",
|
|
319
|
+
filesProcessed: {
|
|
320
|
+
zero: "No files processed",
|
|
321
|
+
one: "{count} file processed",
|
|
322
|
+
other: "{count} files processed"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
var es = {
|
|
328
|
+
toolCore: {
|
|
329
|
+
errors: {
|
|
330
|
+
internal: "Internal error: {message}",
|
|
331
|
+
fileNotFound: "File not found: {path}",
|
|
332
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
333
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
334
|
+
directoryNotFound: "Directory not found: {path}",
|
|
335
|
+
invalidPath: "{path} is not a valid path",
|
|
336
|
+
operationCanceled: "Operation was canceled",
|
|
337
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
338
|
+
},
|
|
339
|
+
progress: {
|
|
340
|
+
copying: "Copying files...",
|
|
341
|
+
building: "Building project...",
|
|
342
|
+
packaging: "Creating package...",
|
|
343
|
+
validating: "Validating...",
|
|
344
|
+
analyzing: "Analyzing...",
|
|
345
|
+
restoring: "Restoring dependencies..."
|
|
346
|
+
},
|
|
347
|
+
validation: {
|
|
348
|
+
requiredField: "{field} is required",
|
|
349
|
+
invalidValue: "Invalid value for {field}",
|
|
350
|
+
pathNotFound: "Path not found: {path}",
|
|
351
|
+
fileRequired: "File is required: {path}",
|
|
352
|
+
directoryRequired: "Directory is required: {path}"
|
|
353
|
+
},
|
|
354
|
+
warnings: {
|
|
355
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
356
|
+
},
|
|
357
|
+
info: {
|
|
358
|
+
operationComplete: "Operation completed successfully",
|
|
359
|
+
filesProcessed: {
|
|
360
|
+
zero: "No files processed",
|
|
361
|
+
one: "{count} file processed",
|
|
362
|
+
other: "{count} files processed"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
var es_MX = {
|
|
368
|
+
toolCore: {
|
|
369
|
+
errors: {
|
|
370
|
+
internal: "Internal error: {message}",
|
|
371
|
+
fileNotFound: "File not found: {path}",
|
|
372
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
373
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
374
|
+
directoryNotFound: "Directory not found: {path}",
|
|
375
|
+
invalidPath: "{path} is not a valid path",
|
|
376
|
+
operationCanceled: "Operation was canceled",
|
|
377
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
378
|
+
},
|
|
379
|
+
progress: {
|
|
380
|
+
copying: "Copying files...",
|
|
381
|
+
building: "Building project...",
|
|
382
|
+
packaging: "Creating package...",
|
|
383
|
+
validating: "Validating...",
|
|
384
|
+
analyzing: "Analyzing...",
|
|
385
|
+
restoring: "Restoring dependencies..."
|
|
386
|
+
},
|
|
387
|
+
validation: {
|
|
388
|
+
requiredField: "{field} is required",
|
|
389
|
+
invalidValue: "Invalid value for {field}",
|
|
390
|
+
pathNotFound: "Path not found: {path}",
|
|
391
|
+
fileRequired: "File is required: {path}",
|
|
392
|
+
directoryRequired: "Directory is required: {path}"
|
|
393
|
+
},
|
|
394
|
+
warnings: {
|
|
395
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
396
|
+
},
|
|
397
|
+
info: {
|
|
398
|
+
operationComplete: "Operation completed successfully",
|
|
399
|
+
filesProcessed: {
|
|
400
|
+
zero: "No files processed",
|
|
401
|
+
one: "{count} file processed",
|
|
402
|
+
other: "{count} files processed"
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
var fr = {
|
|
408
|
+
toolCore: {
|
|
409
|
+
errors: {
|
|
410
|
+
internal: "Internal error: {message}",
|
|
411
|
+
fileNotFound: "File not found: {path}",
|
|
412
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
413
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
414
|
+
directoryNotFound: "Directory not found: {path}",
|
|
415
|
+
invalidPath: "{path} is not a valid path",
|
|
416
|
+
operationCanceled: "Operation was canceled",
|
|
417
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
418
|
+
},
|
|
419
|
+
progress: {
|
|
420
|
+
copying: "Copying files...",
|
|
421
|
+
building: "Building project...",
|
|
422
|
+
packaging: "Creating package...",
|
|
423
|
+
validating: "Validating...",
|
|
424
|
+
analyzing: "Analyzing...",
|
|
425
|
+
restoring: "Restoring dependencies..."
|
|
426
|
+
},
|
|
427
|
+
validation: {
|
|
428
|
+
requiredField: "{field} is required",
|
|
429
|
+
invalidValue: "Invalid value for {field}",
|
|
430
|
+
pathNotFound: "Path not found: {path}",
|
|
431
|
+
fileRequired: "File is required: {path}",
|
|
432
|
+
directoryRequired: "Directory is required: {path}"
|
|
433
|
+
},
|
|
434
|
+
warnings: {
|
|
435
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
436
|
+
},
|
|
437
|
+
info: {
|
|
438
|
+
operationComplete: "Operation completed successfully",
|
|
439
|
+
filesProcessed: {
|
|
440
|
+
zero: "No files processed",
|
|
441
|
+
one: "{count} file processed",
|
|
442
|
+
other: "{count} files processed"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
var ja = {
|
|
448
|
+
toolCore: {
|
|
449
|
+
errors: {
|
|
450
|
+
internal: "Internal error: {message}",
|
|
451
|
+
fileNotFound: "File not found: {path}",
|
|
452
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
453
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
454
|
+
directoryNotFound: "Directory not found: {path}",
|
|
455
|
+
invalidPath: "{path} is not a valid path",
|
|
456
|
+
operationCanceled: "Operation was canceled",
|
|
457
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
458
|
+
},
|
|
459
|
+
progress: {
|
|
460
|
+
copying: "Copying files...",
|
|
461
|
+
building: "Building project...",
|
|
462
|
+
packaging: "Creating package...",
|
|
463
|
+
validating: "Validating...",
|
|
464
|
+
analyzing: "Analyzing...",
|
|
465
|
+
restoring: "Restoring dependencies..."
|
|
466
|
+
},
|
|
467
|
+
validation: {
|
|
468
|
+
requiredField: "{field} is required",
|
|
469
|
+
invalidValue: "Invalid value for {field}",
|
|
470
|
+
pathNotFound: "Path not found: {path}",
|
|
471
|
+
fileRequired: "File is required: {path}",
|
|
472
|
+
directoryRequired: "Directory is required: {path}"
|
|
473
|
+
},
|
|
474
|
+
warnings: {
|
|
475
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
476
|
+
},
|
|
477
|
+
info: {
|
|
478
|
+
operationComplete: "Operation completed successfully",
|
|
479
|
+
filesProcessed: {
|
|
480
|
+
zero: "No files processed",
|
|
481
|
+
one: "{count} file processed",
|
|
482
|
+
other: "{count} files processed"
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
var ko = {
|
|
488
|
+
toolCore: {
|
|
489
|
+
errors: {
|
|
490
|
+
internal: "Internal error: {message}",
|
|
491
|
+
fileNotFound: "File not found: {path}",
|
|
492
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
493
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
494
|
+
directoryNotFound: "Directory not found: {path}",
|
|
495
|
+
invalidPath: "{path} is not a valid path",
|
|
496
|
+
operationCanceled: "Operation was canceled",
|
|
497
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
498
|
+
},
|
|
499
|
+
progress: {
|
|
500
|
+
copying: "Copying files...",
|
|
501
|
+
building: "Building project...",
|
|
502
|
+
packaging: "Creating package...",
|
|
503
|
+
validating: "Validating...",
|
|
504
|
+
analyzing: "Analyzing...",
|
|
505
|
+
restoring: "Restoring dependencies..."
|
|
506
|
+
},
|
|
507
|
+
validation: {
|
|
508
|
+
requiredField: "{field} is required",
|
|
509
|
+
invalidValue: "Invalid value for {field}",
|
|
510
|
+
pathNotFound: "Path not found: {path}",
|
|
511
|
+
fileRequired: "File is required: {path}",
|
|
512
|
+
directoryRequired: "Directory is required: {path}"
|
|
513
|
+
},
|
|
514
|
+
warnings: {
|
|
515
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
516
|
+
},
|
|
517
|
+
info: {
|
|
518
|
+
operationComplete: "Operation completed successfully",
|
|
519
|
+
filesProcessed: {
|
|
520
|
+
zero: "No files processed",
|
|
521
|
+
one: "{count} file processed",
|
|
522
|
+
other: "{count} files processed"
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
var pt = {
|
|
528
|
+
toolCore: {
|
|
529
|
+
errors: {
|
|
530
|
+
internal: "Internal error: {message}",
|
|
531
|
+
fileNotFound: "File not found: {path}",
|
|
532
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
533
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
534
|
+
directoryNotFound: "Directory not found: {path}",
|
|
535
|
+
invalidPath: "{path} is not a valid path",
|
|
536
|
+
operationCanceled: "Operation was canceled",
|
|
537
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
538
|
+
},
|
|
539
|
+
progress: {
|
|
540
|
+
copying: "Copying files...",
|
|
541
|
+
building: "Building project...",
|
|
542
|
+
packaging: "Creating package...",
|
|
543
|
+
validating: "Validating...",
|
|
544
|
+
analyzing: "Analyzing...",
|
|
545
|
+
restoring: "Restoring dependencies..."
|
|
546
|
+
},
|
|
547
|
+
validation: {
|
|
548
|
+
requiredField: "{field} is required",
|
|
549
|
+
invalidValue: "Invalid value for {field}",
|
|
550
|
+
pathNotFound: "Path not found: {path}",
|
|
551
|
+
fileRequired: "File is required: {path}",
|
|
552
|
+
directoryRequired: "Directory is required: {path}"
|
|
553
|
+
},
|
|
554
|
+
warnings: {
|
|
555
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
556
|
+
},
|
|
557
|
+
info: {
|
|
558
|
+
operationComplete: "Operation completed successfully",
|
|
559
|
+
filesProcessed: {
|
|
560
|
+
zero: "No files processed",
|
|
561
|
+
one: "{count} file processed",
|
|
562
|
+
other: "{count} files processed"
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
var pt_BR = {
|
|
568
|
+
toolCore: {
|
|
569
|
+
errors: {
|
|
570
|
+
internal: "Internal error: {message}",
|
|
571
|
+
fileNotFound: "File not found: {path}",
|
|
572
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
573
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
574
|
+
directoryNotFound: "Directory not found: {path}",
|
|
575
|
+
invalidPath: "{path} is not a valid path",
|
|
576
|
+
operationCanceled: "Operation was canceled",
|
|
577
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
578
|
+
},
|
|
579
|
+
progress: {
|
|
580
|
+
copying: "Copying files...",
|
|
581
|
+
building: "Building project...",
|
|
582
|
+
packaging: "Creating package...",
|
|
583
|
+
validating: "Validating...",
|
|
584
|
+
analyzing: "Analyzing...",
|
|
585
|
+
restoring: "Restoring dependencies..."
|
|
586
|
+
},
|
|
587
|
+
validation: {
|
|
588
|
+
requiredField: "{field} is required",
|
|
589
|
+
invalidValue: "Invalid value for {field}",
|
|
590
|
+
pathNotFound: "Path not found: {path}",
|
|
591
|
+
fileRequired: "File is required: {path}",
|
|
592
|
+
directoryRequired: "Directory is required: {path}"
|
|
593
|
+
},
|
|
594
|
+
warnings: {
|
|
595
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
596
|
+
},
|
|
597
|
+
info: {
|
|
598
|
+
operationComplete: "Operation completed successfully",
|
|
599
|
+
filesProcessed: {
|
|
600
|
+
zero: "No files processed",
|
|
601
|
+
one: "{count} file processed",
|
|
602
|
+
other: "{count} files processed"
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
var ro = {
|
|
608
|
+
toolCore: {
|
|
609
|
+
errors: {
|
|
610
|
+
internal: "Internal error: {message}",
|
|
611
|
+
fileNotFound: "File not found: {path}",
|
|
612
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
613
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
614
|
+
directoryNotFound: "Directory not found: {path}",
|
|
615
|
+
invalidPath: "{path} is not a valid path",
|
|
616
|
+
operationCanceled: "Operation was canceled",
|
|
617
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
618
|
+
},
|
|
619
|
+
progress: {
|
|
620
|
+
copying: "Copying files...",
|
|
621
|
+
building: "Building project...",
|
|
622
|
+
packaging: "Creating package...",
|
|
623
|
+
validating: "Validating...",
|
|
624
|
+
analyzing: "Analyzing...",
|
|
625
|
+
restoring: "Restoring dependencies..."
|
|
626
|
+
},
|
|
627
|
+
validation: {
|
|
628
|
+
requiredField: "{field} is required",
|
|
629
|
+
invalidValue: "Invalid value for {field}",
|
|
630
|
+
pathNotFound: "Path not found: {path}",
|
|
631
|
+
fileRequired: "File is required: {path}",
|
|
632
|
+
directoryRequired: "Directory is required: {path}"
|
|
633
|
+
},
|
|
634
|
+
warnings: {
|
|
635
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
636
|
+
},
|
|
637
|
+
info: {
|
|
638
|
+
operationComplete: "Operation completed successfully",
|
|
639
|
+
filesProcessed: {
|
|
640
|
+
zero: "No files processed",
|
|
641
|
+
one: "{count} file processed",
|
|
642
|
+
other: "{count} files processed"
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
var ru = {
|
|
648
|
+
toolCore: {
|
|
649
|
+
errors: {
|
|
650
|
+
internal: "Internal error: {message}",
|
|
651
|
+
fileNotFound: "File not found: {path}",
|
|
652
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
653
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
654
|
+
directoryNotFound: "Directory not found: {path}",
|
|
655
|
+
invalidPath: "{path} is not a valid path",
|
|
656
|
+
operationCanceled: "Operation was canceled",
|
|
657
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
658
|
+
},
|
|
659
|
+
progress: {
|
|
660
|
+
copying: "Copying files...",
|
|
661
|
+
building: "Building project...",
|
|
662
|
+
packaging: "Creating package...",
|
|
663
|
+
validating: "Validating...",
|
|
664
|
+
analyzing: "Analyzing...",
|
|
665
|
+
restoring: "Restoring dependencies..."
|
|
666
|
+
},
|
|
667
|
+
validation: {
|
|
668
|
+
requiredField: "{field} is required",
|
|
669
|
+
invalidValue: "Invalid value for {field}",
|
|
670
|
+
pathNotFound: "Path not found: {path}",
|
|
671
|
+
fileRequired: "File is required: {path}",
|
|
672
|
+
directoryRequired: "Directory is required: {path}"
|
|
673
|
+
},
|
|
674
|
+
warnings: {
|
|
675
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
676
|
+
},
|
|
677
|
+
info: {
|
|
678
|
+
operationComplete: "Operation completed successfully",
|
|
679
|
+
filesProcessed: {
|
|
680
|
+
zero: "No files processed",
|
|
681
|
+
one: "{count} file processed",
|
|
682
|
+
other: "{count} files processed"
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var tr = {
|
|
688
|
+
toolCore: {
|
|
689
|
+
errors: {
|
|
690
|
+
internal: "Internal error: {message}",
|
|
691
|
+
fileNotFound: "File not found: {path}",
|
|
692
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
693
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
694
|
+
directoryNotFound: "Directory not found: {path}",
|
|
695
|
+
invalidPath: "{path} is not a valid path",
|
|
696
|
+
operationCanceled: "Operation was canceled",
|
|
697
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
698
|
+
},
|
|
699
|
+
progress: {
|
|
700
|
+
copying: "Copying files...",
|
|
701
|
+
building: "Building project...",
|
|
702
|
+
packaging: "Creating package...",
|
|
703
|
+
validating: "Validating...",
|
|
704
|
+
analyzing: "Analyzing...",
|
|
705
|
+
restoring: "Restoring dependencies..."
|
|
706
|
+
},
|
|
707
|
+
validation: {
|
|
708
|
+
requiredField: "{field} is required",
|
|
709
|
+
invalidValue: "Invalid value for {field}",
|
|
710
|
+
pathNotFound: "Path not found: {path}",
|
|
711
|
+
fileRequired: "File is required: {path}",
|
|
712
|
+
directoryRequired: "Directory is required: {path}"
|
|
713
|
+
},
|
|
714
|
+
warnings: {
|
|
715
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
716
|
+
},
|
|
717
|
+
info: {
|
|
718
|
+
operationComplete: "Operation completed successfully",
|
|
719
|
+
filesProcessed: {
|
|
720
|
+
zero: "No files processed",
|
|
721
|
+
one: "{count} file processed",
|
|
722
|
+
other: "{count} files processed"
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
var zh_CN = {
|
|
728
|
+
toolCore: {
|
|
729
|
+
errors: {
|
|
730
|
+
internal: "Internal error: {message}",
|
|
731
|
+
fileNotFound: "File not found: {path}",
|
|
732
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
733
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
734
|
+
directoryNotFound: "Directory not found: {path}",
|
|
735
|
+
invalidPath: "{path} is not a valid path",
|
|
736
|
+
operationCanceled: "Operation was canceled",
|
|
737
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
738
|
+
},
|
|
739
|
+
progress: {
|
|
740
|
+
copying: "Copying files...",
|
|
741
|
+
building: "Building project...",
|
|
742
|
+
packaging: "Creating package...",
|
|
743
|
+
validating: "Validating...",
|
|
744
|
+
analyzing: "Analyzing...",
|
|
745
|
+
restoring: "Restoring dependencies..."
|
|
746
|
+
},
|
|
747
|
+
validation: {
|
|
748
|
+
requiredField: "{field} is required",
|
|
749
|
+
invalidValue: "Invalid value for {field}",
|
|
750
|
+
pathNotFound: "Path not found: {path}",
|
|
751
|
+
fileRequired: "File is required: {path}",
|
|
752
|
+
directoryRequired: "Directory is required: {path}"
|
|
753
|
+
},
|
|
754
|
+
warnings: {
|
|
755
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
756
|
+
},
|
|
757
|
+
info: {
|
|
758
|
+
operationComplete: "Operation completed successfully",
|
|
759
|
+
filesProcessed: {
|
|
760
|
+
zero: "No files processed",
|
|
761
|
+
one: "{count} file processed",
|
|
762
|
+
other: "{count} files processed"
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
var zh_TW = {
|
|
768
|
+
toolCore: {
|
|
769
|
+
errors: {
|
|
770
|
+
internal: "Internal error: {message}",
|
|
771
|
+
fileNotFound: "File not found: {path}",
|
|
772
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
773
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
774
|
+
directoryNotFound: "Directory not found: {path}",
|
|
775
|
+
invalidPath: "{path} is not a valid path",
|
|
776
|
+
operationCanceled: "Operation was canceled",
|
|
777
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
778
|
+
},
|
|
779
|
+
progress: {
|
|
780
|
+
copying: "Copying files...",
|
|
781
|
+
building: "Building project...",
|
|
782
|
+
packaging: "Creating package...",
|
|
783
|
+
validating: "Validating...",
|
|
784
|
+
analyzing: "Analyzing...",
|
|
785
|
+
restoring: "Restoring dependencies..."
|
|
786
|
+
},
|
|
787
|
+
validation: {
|
|
788
|
+
requiredField: "{field} is required",
|
|
789
|
+
invalidValue: "Invalid value for {field}",
|
|
790
|
+
pathNotFound: "Path not found: {path}",
|
|
791
|
+
fileRequired: "File is required: {path}",
|
|
792
|
+
directoryRequired: "Directory is required: {path}"
|
|
793
|
+
},
|
|
794
|
+
warnings: {
|
|
795
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
796
|
+
},
|
|
797
|
+
info: {
|
|
798
|
+
operationComplete: "Operation completed successfully",
|
|
799
|
+
filesProcessed: {
|
|
800
|
+
zero: "No files processed",
|
|
801
|
+
one: "{count} file processed",
|
|
802
|
+
other: "{count} files processed"
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
var zu = {
|
|
808
|
+
toolCore: {
|
|
809
|
+
errors: {
|
|
810
|
+
internal: "Internal error: {message}",
|
|
811
|
+
fileNotFound: "File not found: {path}",
|
|
812
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
813
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
814
|
+
directoryNotFound: "Directory not found: {path}",
|
|
815
|
+
invalidPath: "{path} is not a valid path",
|
|
816
|
+
operationCanceled: "Operation was canceled",
|
|
817
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
818
|
+
},
|
|
819
|
+
progress: {
|
|
820
|
+
copying: "Copying files...",
|
|
821
|
+
building: "Building project...",
|
|
822
|
+
packaging: "Creating package...",
|
|
823
|
+
validating: "Validating...",
|
|
824
|
+
analyzing: "Analyzing...",
|
|
825
|
+
restoring: "Restoring dependencies..."
|
|
826
|
+
},
|
|
827
|
+
validation: {
|
|
828
|
+
requiredField: "{field} is required",
|
|
829
|
+
invalidValue: "Invalid value for {field}",
|
|
830
|
+
pathNotFound: "Path not found: {path}",
|
|
831
|
+
fileRequired: "File is required: {path}",
|
|
832
|
+
directoryRequired: "Directory is required: {path}"
|
|
833
|
+
},
|
|
834
|
+
warnings: {
|
|
835
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
836
|
+
},
|
|
837
|
+
info: {
|
|
838
|
+
operationComplete: "Operation completed successfully",
|
|
839
|
+
filesProcessed: {
|
|
840
|
+
zero: "No files processed",
|
|
841
|
+
one: "{count} file processed",
|
|
842
|
+
other: "{count} files processed"
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
class TranslationService {
|
|
849
|
+
static instance;
|
|
850
|
+
currentLocale = "en";
|
|
851
|
+
constructor() {}
|
|
852
|
+
static getInstance() {
|
|
853
|
+
if (!TranslationService.instance) {
|
|
854
|
+
TranslationService.instance = new TranslationService;
|
|
855
|
+
}
|
|
856
|
+
return TranslationService.instance;
|
|
857
|
+
}
|
|
858
|
+
setLocale(locale) {
|
|
859
|
+
this.currentLocale = I18nManager.setLocale(locale);
|
|
860
|
+
}
|
|
861
|
+
getLocale() {
|
|
862
|
+
return this.currentLocale;
|
|
863
|
+
}
|
|
864
|
+
t(key, params) {
|
|
865
|
+
return I18nManager.t(key, params, this.currentLocale);
|
|
866
|
+
}
|
|
867
|
+
tLocale(key, locale, params) {
|
|
868
|
+
return I18nManager.t(key, params, locale);
|
|
869
|
+
}
|
|
870
|
+
has(key) {
|
|
871
|
+
return I18nManager.has(key, this.currentLocale);
|
|
872
|
+
}
|
|
873
|
+
getAvailableLocales() {
|
|
874
|
+
return I18nManager.getAvailableLocales();
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
var translate = TranslationService.getInstance();
|
|
878
|
+
I18nManager.registerTranslations("en", en);
|
|
879
|
+
I18nManager.registerTranslations("de", de);
|
|
880
|
+
I18nManager.registerTranslations("es", es);
|
|
881
|
+
I18nManager.registerTranslations("es-mx", es_MX);
|
|
882
|
+
I18nManager.registerTranslations("fr", fr);
|
|
883
|
+
I18nManager.registerTranslations("ja", ja);
|
|
884
|
+
I18nManager.registerTranslations("ko", ko);
|
|
885
|
+
I18nManager.registerTranslations("pt", pt);
|
|
886
|
+
I18nManager.registerTranslations("pt-br", pt_BR);
|
|
887
|
+
I18nManager.registerTranslations("ro", ro);
|
|
888
|
+
I18nManager.registerTranslations("ru", ru);
|
|
889
|
+
I18nManager.registerTranslations("tr", tr);
|
|
890
|
+
I18nManager.registerTranslations("zh-cn", zh_CN);
|
|
891
|
+
I18nManager.registerTranslations("zh-tw", zh_TW);
|
|
892
|
+
I18nManager.registerTranslations("zu", zu);
|
|
893
|
+
I18nManager.setLocale("en");
|
|
894
|
+
var BuildConfiguration;
|
|
895
|
+
((BuildConfiguration2) => {
|
|
896
|
+
BuildConfiguration2["Debug"] = "Debug";
|
|
897
|
+
BuildConfiguration2["Release"] = "Release";
|
|
898
|
+
})(BuildConfiguration ||= {});
|
|
899
|
+
var LogLevel;
|
|
900
|
+
((LogLevel2) => {
|
|
901
|
+
LogLevel2["Debug"] = "Debug";
|
|
902
|
+
LogLevel2["Info"] = "Information";
|
|
903
|
+
LogLevel2["Warn"] = "Warning";
|
|
904
|
+
LogLevel2["Error"] = "Error";
|
|
905
|
+
})(LogLevel ||= {});
|
|
906
|
+
var NugetConstants = {
|
|
907
|
+
OutputFolderName: "bundle",
|
|
908
|
+
ContentFolderName: "content",
|
|
909
|
+
OperateFileName: "operate.json",
|
|
910
|
+
EntryPointsFileName: "entry-points.json",
|
|
911
|
+
PackageDescriptorFileName: "package-descriptor.json",
|
|
912
|
+
BindingsV2FileName: "bindings_v2.json",
|
|
913
|
+
BindingsFileId: "bindings.json"
|
|
914
|
+
};
|
|
915
|
+
var PackJobTargetKind;
|
|
916
|
+
((PackJobTargetKind2) => {
|
|
917
|
+
PackJobTargetKind2["Serverless"] = "Serverless";
|
|
918
|
+
PackJobTargetKind2["LocalRobot"] = "LocalRobot";
|
|
919
|
+
})(PackJobTargetKind ||= {});
|
|
920
|
+
var ProjectTypes;
|
|
921
|
+
((ProjectTypes2) => {
|
|
922
|
+
ProjectTypes2["Agent"] = "Agent";
|
|
923
|
+
ProjectTypes2["Api"] = "Api";
|
|
924
|
+
ProjectTypes2["BusinessRules"] = "BusinessRules";
|
|
925
|
+
ProjectTypes2["Connector"] = "Connector";
|
|
926
|
+
ProjectTypes2["CaseManagement"] = "CaseManagement";
|
|
927
|
+
ProjectTypes2["Flow"] = "Flow";
|
|
928
|
+
ProjectTypes2["Function"] = "Function";
|
|
929
|
+
ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
|
|
930
|
+
ProjectTypes2["Process"] = "Process";
|
|
931
|
+
ProjectTypes2["Library"] = "Library";
|
|
932
|
+
ProjectTypes2["WebApp"] = "WebApp";
|
|
933
|
+
ProjectTypes2["Tests"] = "Tests";
|
|
934
|
+
ProjectTypes2["AppV2"] = "AppV2";
|
|
935
|
+
})(ProjectTypes ||= {});
|
|
936
|
+
var TargetFramework;
|
|
937
|
+
((TargetFramework2) => {
|
|
938
|
+
TargetFramework2["Portable"] = "Portable";
|
|
939
|
+
TargetFramework2["Windows"] = "Windows";
|
|
940
|
+
})(TargetFramework ||= {});
|
|
941
|
+
var ToolErrorCodes;
|
|
942
|
+
((ToolErrorCodes2) => {
|
|
943
|
+
ToolErrorCodes2["Success"] = "SUCCESS";
|
|
944
|
+
ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
|
|
945
|
+
ToolErrorCodes2["Canceled"] = "CANCELED";
|
|
946
|
+
})(ToolErrorCodes ||= {});
|
|
947
|
+
|
|
948
|
+
class ToolResult {
|
|
949
|
+
errorCode;
|
|
950
|
+
message;
|
|
951
|
+
packages;
|
|
952
|
+
details;
|
|
953
|
+
instructions;
|
|
954
|
+
constructor(errorCode, message, packages = [], instructions) {
|
|
955
|
+
this.errorCode = errorCode;
|
|
956
|
+
this.message = message;
|
|
957
|
+
this.packages = packages;
|
|
958
|
+
this.instructions = instructions;
|
|
959
|
+
}
|
|
960
|
+
get isSuccess() {
|
|
961
|
+
return this.errorCode === "SUCCESS";
|
|
962
|
+
}
|
|
963
|
+
static success() {
|
|
964
|
+
return new ToolResult("SUCCESS");
|
|
965
|
+
}
|
|
966
|
+
static error(errorCode, message, instructions) {
|
|
967
|
+
return new ToolResult(errorCode, message, [], instructions);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
function escapeXml(str) {
|
|
971
|
+
if (str === null || str === undefined) {
|
|
972
|
+
return "";
|
|
973
|
+
}
|
|
974
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
975
|
+
}
|
|
976
|
+
function optionalElement(name, value) {
|
|
977
|
+
if (value === undefined || value === "")
|
|
978
|
+
return "";
|
|
979
|
+
return ` <${name}>${escapeXml(value)}</${name}>
|
|
980
|
+
`;
|
|
981
|
+
}
|
|
982
|
+
function generateDependenciesXml(dependencies) {
|
|
983
|
+
if (!dependencies || dependencies.length === 0)
|
|
984
|
+
return "";
|
|
985
|
+
const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
|
|
986
|
+
`);
|
|
987
|
+
return ` <dependencies>
|
|
988
|
+
${deps}
|
|
989
|
+
</dependencies>
|
|
990
|
+
`;
|
|
991
|
+
}
|
|
992
|
+
function generateRepositoryXml(packageInfo) {
|
|
993
|
+
if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
|
|
994
|
+
return "";
|
|
995
|
+
let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
|
|
996
|
+
if (packageInfo.repositoryBranch) {
|
|
997
|
+
repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
|
|
998
|
+
}
|
|
999
|
+
if (packageInfo.repositoryCommit) {
|
|
1000
|
+
repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
|
|
1001
|
+
}
|
|
1002
|
+
repoXml += ` />
|
|
1003
|
+
`;
|
|
1004
|
+
return repoXml;
|
|
1005
|
+
}
|
|
1006
|
+
function generateNuspecXml(packageInfo) {
|
|
1007
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1008
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1009
|
+
const title = packageInfo.title?.trim() || packageInfo.id;
|
|
1010
|
+
const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
|
|
1011
|
+
const releaseNotes = packageInfo.releaseNotes ?? "";
|
|
1012
|
+
const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
|
|
1013
|
+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
1014
|
+
<metadata>
|
|
1015
|
+
<id>${escapeXml(packageInfo.id)}</id>
|
|
1016
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1017
|
+
<title>${escapeXml(title)}</title>
|
|
1018
|
+
<authors>${escapeXml(author)}</authors>
|
|
1019
|
+
<requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
|
|
1020
|
+
<description>${escapeXml(description)}</description>
|
|
1021
|
+
<releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
|
|
1022
|
+
${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>
|
|
1023
|
+
</package>
|
|
1024
|
+
`;
|
|
1025
|
+
return xml;
|
|
1026
|
+
}
|
|
1027
|
+
function generatePsmdcpXml(packageInfo) {
|
|
1028
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1029
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1030
|
+
return `<?xml version="1.0" encoding="utf-8"?>
|
|
1031
|
+
<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">
|
|
1032
|
+
<dc:creator>${escapeXml(author)}</dc:creator>
|
|
1033
|
+
<dc:description>${escapeXml(description)}</dc:description>
|
|
1034
|
+
<dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
|
|
1035
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1036
|
+
<keywords></keywords>
|
|
1037
|
+
<lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
|
|
1038
|
+
</coreProperties>`;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
class NugetPackager {
|
|
1042
|
+
fileSystem;
|
|
1043
|
+
constructor(fileSystem) {
|
|
1044
|
+
this.fileSystem = fileSystem;
|
|
1045
|
+
}
|
|
1046
|
+
async packAsync(rootPath, packageInfo, outputPath) {
|
|
1047
|
+
const normalizedOutputPath = Path.normalize(outputPath);
|
|
1048
|
+
const nuspecXml = generateNuspecXml(packageInfo);
|
|
1049
|
+
const nuspecFileName = `${packageInfo.id}.nuspec`;
|
|
1050
|
+
const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
|
|
1051
|
+
const zipContents = {};
|
|
1052
|
+
const encoder = new TextEncoder;
|
|
1053
|
+
const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
|
|
1054
|
+
const psmdcpFileName = `${psmdcpId}.psmdcp`;
|
|
1055
|
+
const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
|
|
1056
|
+
const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1057
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
1058
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
1059
|
+
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
|
|
1060
|
+
<Default Extension="uiproj" ContentType="application/octet" />
|
|
1061
|
+
<Default Extension="json" ContentType="application/octet" />
|
|
1062
|
+
<Default Extension="nuspec" ContentType="application/octet" />
|
|
1063
|
+
</Types>`;
|
|
1064
|
+
zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
|
|
1065
|
+
const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
|
|
1066
|
+
const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
|
|
1067
|
+
const relsXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1068
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
1069
|
+
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
|
|
1070
|
+
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
|
|
1071
|
+
</Relationships>`;
|
|
1072
|
+
zipContents["_rels/.rels"] = encoder.encode(relsXml);
|
|
1073
|
+
zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
|
|
1074
|
+
zipContents[nuspecFileName] = encoder.encode(nuspecXml);
|
|
1075
|
+
for (const entry of fileEntries) {
|
|
1076
|
+
const content = await this.fileSystem.readFile(entry.absolutePath);
|
|
1077
|
+
if (content !== null) {
|
|
1078
|
+
zipContents[entry.relativePath] = content;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
const zippedData = zipSync(zipContents);
|
|
1082
|
+
await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
|
|
1083
|
+
return {
|
|
1084
|
+
outputPath: normalizedOutputPath
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
class ProjectTool {
|
|
1090
|
+
fileSystem;
|
|
1091
|
+
logger;
|
|
1092
|
+
static ProjectFileName = "project.uiproj";
|
|
1093
|
+
constructor(fileSystem, logger) {
|
|
1094
|
+
this.fileSystem = fileSystem;
|
|
1095
|
+
this.logger = logger;
|
|
1096
|
+
}
|
|
1097
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1098
|
+
this.logger.info("Restore operation is a noop");
|
|
1099
|
+
return ToolResult.success();
|
|
1100
|
+
}
|
|
1101
|
+
async validateAsync(_options, _cancellationToken) {
|
|
1102
|
+
this.logger.info("Validate operation is a noop");
|
|
1103
|
+
return ToolResult.success();
|
|
1104
|
+
}
|
|
1105
|
+
async buildAsync(_options, _cancellationToken) {
|
|
1106
|
+
this.logger.info("Build operation is a noop");
|
|
1107
|
+
return ToolResult.success();
|
|
1108
|
+
}
|
|
1109
|
+
async packAsync(_options, _cancellationToken) {
|
|
1110
|
+
this.logger.info("Pack operation is a noop");
|
|
1111
|
+
return ToolResult.success();
|
|
1112
|
+
}
|
|
1113
|
+
async cleanupAsync(_options, _cancellationToken) {
|
|
1114
|
+
this.logger.info("Cleanup operation is a noop");
|
|
1115
|
+
return ToolResult.success();
|
|
1116
|
+
}
|
|
1117
|
+
async getUiProjectAsync(projectPath) {
|
|
1118
|
+
const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
|
|
1119
|
+
if (!await this.fileSystem.exists(filePath)) {
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
const raw = await this.fileSystem.readFile(filePath);
|
|
1123
|
+
if (!raw) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
|
|
1127
|
+
return JSON.parse(json);
|
|
1128
|
+
}
|
|
1129
|
+
async dispose() {}
|
|
1130
|
+
}
|
|
1131
|
+
class ToolsFactoryRepository {
|
|
1132
|
+
projectFactoryMap = new Map;
|
|
1133
|
+
solutionFactory = null;
|
|
1134
|
+
registerProjectToolFactory(factory) {
|
|
1135
|
+
for (const type of factory.supportedTypes) {
|
|
1136
|
+
const existing = this.projectFactoryMap.get(type);
|
|
1137
|
+
if (existing) {
|
|
1138
|
+
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
1139
|
+
console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
1140
|
+
}
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
this.projectFactoryMap.set(type, factory);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
registerSolutionToolFactory(factory) {
|
|
1147
|
+
this.solutionFactory = factory;
|
|
1148
|
+
}
|
|
1149
|
+
getSolutionToolFactory() {
|
|
1150
|
+
if (!this.solutionFactory) {
|
|
1151
|
+
throw new Error("No solution tool factory is registered");
|
|
1152
|
+
}
|
|
1153
|
+
return this.solutionFactory;
|
|
1154
|
+
}
|
|
1155
|
+
canHandleProject(projectType) {
|
|
1156
|
+
return this.projectFactoryMap.has(projectType);
|
|
1157
|
+
}
|
|
1158
|
+
getProjectToolFactory(projectType) {
|
|
1159
|
+
const factory = this.projectFactoryMap.get(projectType);
|
|
1160
|
+
if (!factory) {
|
|
1161
|
+
const known = [...this.projectFactoryMap.keys()].join(", ");
|
|
1162
|
+
throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it. ` + `Project types that can be packed: ${known || "none"}.`);
|
|
1163
|
+
}
|
|
1164
|
+
return factory;
|
|
1165
|
+
}
|
|
1166
|
+
reset() {
|
|
1167
|
+
this.projectFactoryMap.clear();
|
|
1168
|
+
this.solutionFactory = null;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
|
|
1172
|
+
var _global = globalThis;
|
|
1173
|
+
if (!_global[REGISTRY_KEY]) {
|
|
1174
|
+
_global[REGISTRY_KEY] = new ToolsFactoryRepository;
|
|
1175
|
+
}
|
|
1176
|
+
var toolsFactoryRepository = _global[REGISTRY_KEY];
|
|
1177
|
+
|
|
1178
|
+
// ../packager/packager-tool-webapp/src/constants.ts
|
|
1179
|
+
var PROJECT_JSON_FILE = "project.json";
|
|
1180
|
+
var DEFAULT_BUNDLE_PATH = "source/dist";
|
|
1181
|
+
var APP_FOLDER_NAME = ".app";
|
|
1182
|
+
var CONTENT_APP_FOLDER_NAME = "app";
|
|
1183
|
+
var TARGET_RUNTIME = "Coded";
|
|
1184
|
+
var TARGET_JS_RUNTIME = "JS";
|
|
1185
|
+
var DEFAULT_ENTRY_POINT_TYPE = "api";
|
|
1186
|
+
var ERROR_MESSAGES = {
|
|
1187
|
+
MANIFEST_NOT_FOUND: (file) => `WebApp manifest not found: ${file}. This file is required for WebApp projects.`,
|
|
1188
|
+
PROJECT_JSON_FOUND: "project.json found in WebApp project. The WebApp tool only supports Coded web apps without project.json.",
|
|
1189
|
+
MANIFEST_LOAD_FAILED: (file) => `Failed to load or parse ${file}`,
|
|
1190
|
+
BUNDLE_NOT_FOUND: (path) => `Compiled bundle not found at ${path}. Ensure the project is built before packing.`,
|
|
1191
|
+
BUNDLE_NOT_DIRECTORY: (path) => `Bundle path ${path} exists but is not a directory.`,
|
|
1192
|
+
APP_FOLDER_NOT_FOUND: (path) => `.app folder not found at ${path}. Ensure the project contains a .app folder.`,
|
|
1193
|
+
APP_FOLDER_NOT_DIRECTORY: (path) => `.app path ${path} exists but is not a directory.`,
|
|
1194
|
+
BUILD_NOT_SUPPORTED: "Build execution (isCompiled=false) is not yet supported. Please build the project manually and set isCompiled=true.",
|
|
1195
|
+
VALIDATION_FAILED: (context) => `Validation failed: ${context}`,
|
|
1196
|
+
PACKING_FAILED: (context) => `An error occurred while packing WebApp project: ${context}`,
|
|
1197
|
+
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
1198
|
+
PACKAGE_VERSION_REQUIRED: "Package version is required",
|
|
1199
|
+
PROJECT_PATH_REQUIRED: "Project path is required",
|
|
1200
|
+
OUTPUT_PATH_REQUIRED: "Output path is required"
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// ../packager/packager-tool-webapp/src/models/webapp-manifest.ts
|
|
1204
|
+
var WebAppVariantType;
|
|
1205
|
+
((WebAppVariantType2) => {
|
|
1206
|
+
WebAppVariantType2["Coded"] = "Coded";
|
|
1207
|
+
WebAppVariantType2["JS"] = "JS";
|
|
1208
|
+
})(WebAppVariantType ||= {});
|
|
1209
|
+
var WEBAPP_MANIFEST_FILE_NAME = "webAppManifest.json";
|
|
1210
|
+
|
|
1211
|
+
// ../packager/packager-tool-webapp/src/utils/fs-helpers.ts
|
|
1212
|
+
async function copyDirectoryAsync(fileSystem, sourcePath, destinationPath) {
|
|
1213
|
+
await fileSystem.mkdir(destinationPath);
|
|
1214
|
+
const entries = await fileSystem.readdir(sourcePath);
|
|
1215
|
+
for (const entry of entries) {
|
|
1216
|
+
const sourceEntry = Path.join(sourcePath, entry);
|
|
1217
|
+
const destEntry = Path.join(destinationPath, entry);
|
|
1218
|
+
const stat = await fileSystem.stat(sourceEntry);
|
|
1219
|
+
if (stat?.isDirectory()) {
|
|
1220
|
+
await copyDirectoryAsync(fileSystem, sourceEntry, destEntry);
|
|
1221
|
+
} else if (stat?.isFile()) {
|
|
1222
|
+
const content = await fileSystem.readFile(sourceEntry);
|
|
1223
|
+
if (content) {
|
|
1224
|
+
await fileSystem.writeFile(destEntry, content);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// ../packager/packager-tool-webapp/src/utils/manifest-loader.ts
|
|
1231
|
+
async function loadWebAppManifest(fileSystem, projectPath) {
|
|
1232
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
1233
|
+
const exists = await fileSystem.exists(manifestPath);
|
|
1234
|
+
if (!exists) {
|
|
1235
|
+
return null;
|
|
1236
|
+
}
|
|
1237
|
+
const content = await fileSystem.readFile(manifestPath);
|
|
1238
|
+
if (!content) {
|
|
1239
|
+
return null;
|
|
1240
|
+
}
|
|
1241
|
+
try {
|
|
1242
|
+
const text = new TextDecoder().decode(content);
|
|
1243
|
+
const manifest = JSON.parse(text);
|
|
1244
|
+
return manifest;
|
|
1245
|
+
} catch (error) {
|
|
1246
|
+
throw new Error(`Failed to parse ${WEBAPP_MANIFEST_FILE_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
async function ensureWebAppProjectId(fileSystem, projectPath) {
|
|
1250
|
+
const manifest = await loadWebAppManifest(fileSystem, projectPath);
|
|
1251
|
+
if (manifest && typeof manifest.projectId === "string" && manifest.projectId.length > 0) {
|
|
1252
|
+
return manifest.projectId;
|
|
1253
|
+
}
|
|
1254
|
+
const id = crypto.randomUUID();
|
|
1255
|
+
if (manifest) {
|
|
1256
|
+
const updated = { ...manifest, projectId: id };
|
|
1257
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
1258
|
+
await fileSystem.writeFile(manifestPath, `${JSON.stringify(updated, null, 2)}
|
|
1259
|
+
`);
|
|
1260
|
+
}
|
|
1261
|
+
return id;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
// ../packager/packager-tool-webapp/src/strategies/coded-app-strategy.ts
|
|
1265
|
+
class CodedAppStrategy {
|
|
1266
|
+
fileSystem;
|
|
1267
|
+
constructor(fileSystem) {
|
|
1268
|
+
this.fileSystem = fileSystem;
|
|
1269
|
+
}
|
|
1270
|
+
async validateAsync(args) {
|
|
1271
|
+
const { projectPath, manifest, logger } = args;
|
|
1272
|
+
const typed = manifest;
|
|
1273
|
+
let bundlePath = typed.config?.bundlePath;
|
|
1274
|
+
if (typeof bundlePath !== "string" || bundlePath.length === 0) {
|
|
1275
|
+
bundlePath = DEFAULT_BUNDLE_PATH;
|
|
1276
|
+
}
|
|
1277
|
+
const isCompiled = typed.config?.isCompiled ?? true;
|
|
1278
|
+
if (isCompiled) {
|
|
1279
|
+
const fullBundlePath = Path.join(projectPath, bundlePath);
|
|
1280
|
+
const exists = await this.fileSystem.exists(fullBundlePath);
|
|
1281
|
+
if (!exists) {
|
|
1282
|
+
const message = ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath);
|
|
1283
|
+
const warnable = logger;
|
|
1284
|
+
if (warnable?.warn) {
|
|
1285
|
+
warnable.warn(message);
|
|
1286
|
+
} else {
|
|
1287
|
+
logger?.info(`Warning: ${message}`);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
async packageAsync(args) {
|
|
1293
|
+
const { projectPath, manifest, outputPath, packageInfo, logger } = args;
|
|
1294
|
+
logger?.info(`Packaging Coded variant: ${packageInfo.id}@${packageInfo.version}`);
|
|
1295
|
+
let bundlePath = manifest.config?.bundlePath;
|
|
1296
|
+
if (typeof bundlePath !== "string" || bundlePath.length === 0) {
|
|
1297
|
+
bundlePath = DEFAULT_BUNDLE_PATH;
|
|
1298
|
+
}
|
|
1299
|
+
const isCompiled = manifest.config?.isCompiled ?? true;
|
|
1300
|
+
const fullBundlePath = Path.join(projectPath, bundlePath);
|
|
1301
|
+
if (isCompiled) {
|
|
1302
|
+
logger?.progress("Validating compiled bundle...");
|
|
1303
|
+
const bundleExists = await this.fileSystem.exists(fullBundlePath);
|
|
1304
|
+
if (!bundleExists) {
|
|
1305
|
+
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath));
|
|
1306
|
+
}
|
|
1307
|
+
const bundleStat = await this.fileSystem.stat(fullBundlePath);
|
|
1308
|
+
if (!bundleStat?.isDirectory()) {
|
|
1309
|
+
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_DIRECTORY(fullBundlePath));
|
|
1310
|
+
}
|
|
1311
|
+
} else {
|
|
1312
|
+
logger?.info("Build mode (isCompiled=false) is not yet implemented in v1.");
|
|
1313
|
+
throw new Error(ERROR_MESSAGES.BUILD_NOT_SUPPORTED);
|
|
1314
|
+
}
|
|
1315
|
+
const localBuildFolder = Path.join(outputPath, NugetConstants.OutputFolderName);
|
|
1316
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
1317
|
+
await this.fileSystem.mkdir(contentFolder);
|
|
1318
|
+
try {
|
|
1319
|
+
logger?.progress("Copying bundle to content folder...");
|
|
1320
|
+
await copyDirectoryAsync(this.fileSystem, fullBundlePath, contentFolder);
|
|
1321
|
+
logger?.progress("Preparing metadata files...");
|
|
1322
|
+
await this.prepareMetadataFiles(localBuildFolder, contentFolder, packageInfo, manifest, projectPath);
|
|
1323
|
+
logger?.progress("Creating NuGet package...");
|
|
1324
|
+
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
1325
|
+
const nupkgPath = Path.join(outputPath, nupkgFileName);
|
|
1326
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
1327
|
+
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
1328
|
+
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
1329
|
+
return result.outputPath;
|
|
1330
|
+
} finally {
|
|
1331
|
+
try {
|
|
1332
|
+
await this.fileSystem.rm(localBuildFolder);
|
|
1333
|
+
} catch (cleanupError) {
|
|
1334
|
+
logger?.error(`Failed to cleanup build folder: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
async prepareMetadataFiles(_localBuildFolder, contentFolder, _packageInfo, _manifest, projectPath) {
|
|
1339
|
+
let mainFile = "index.html";
|
|
1340
|
+
const indexHtmlPath = Path.join(contentFolder, "index.html");
|
|
1341
|
+
const indexHtmlExists = await this.fileSystem.exists(indexHtmlPath);
|
|
1342
|
+
if (!indexHtmlExists) {
|
|
1343
|
+
const possibleEntries = ["index.html", "main.html", "app.html"];
|
|
1344
|
+
for (const entry of possibleEntries) {
|
|
1345
|
+
const entryPath = Path.join(contentFolder, entry);
|
|
1346
|
+
if (await this.fileSystem.exists(entryPath)) {
|
|
1347
|
+
mainFile = entry;
|
|
1348
|
+
break;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
const operatePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
1353
|
+
const operateModel = {
|
|
1354
|
+
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
1355
|
+
main: mainFile,
|
|
1356
|
+
contentType: ProjectTypes.WebApp,
|
|
1357
|
+
targetFramework: TargetFramework.Portable,
|
|
1358
|
+
targetRuntime: TARGET_RUNTIME,
|
|
1359
|
+
runtimeOptions: {
|
|
1360
|
+
requiresUserInteraction: false,
|
|
1361
|
+
isAttended: false
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
1365
|
+
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
1366
|
+
const manifestSourcePath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
1367
|
+
const manifestDestPath = Path.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME);
|
|
1368
|
+
const manifestExists = await this.fileSystem.exists(manifestSourcePath);
|
|
1369
|
+
if (manifestExists) {
|
|
1370
|
+
const manifestContent = await this.fileSystem.readFile(manifestSourcePath, "utf-8");
|
|
1371
|
+
if (manifestContent) {
|
|
1372
|
+
await this.fileSystem.writeFile(manifestDestPath, manifestContent);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
const uipathJsonSourcePath = Path.join(projectPath, "uipath.json");
|
|
1376
|
+
const uipathJsonDestPath = Path.join(contentFolder, "uipath.json");
|
|
1377
|
+
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
1378
|
+
if (uipathJsonExists) {
|
|
1379
|
+
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath, "utf-8");
|
|
1380
|
+
if (uipathJsonContent) {
|
|
1381
|
+
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
const actionSchemaSourcePath = Path.join(projectPath, "action-schema.json");
|
|
1385
|
+
const actionSchemaDestPath = Path.join(contentFolder, "action-schema.json");
|
|
1386
|
+
const actionSchemaExists = await this.fileSystem.exists(actionSchemaSourcePath);
|
|
1387
|
+
if (actionSchemaExists) {
|
|
1388
|
+
const actionSchemaContent = await this.fileSystem.readFile(actionSchemaSourcePath, "utf-8");
|
|
1389
|
+
if (actionSchemaContent) {
|
|
1390
|
+
await this.fileSystem.writeFile(actionSchemaDestPath, actionSchemaContent);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
const bindingsPath = Path.join(contentFolder, "bindings.json");
|
|
1394
|
+
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
1395
|
+
if (!bindingsExists) {
|
|
1396
|
+
const bindingsJson = JSON.stringify({
|
|
1397
|
+
version: "1.0",
|
|
1398
|
+
resources: []
|
|
1399
|
+
}, null, 2);
|
|
1400
|
+
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
1401
|
+
}
|
|
1402
|
+
const bindingsV2Path = Path.join(contentFolder, "bindings_v2.json");
|
|
1403
|
+
const bindingsCandidatePaths = [
|
|
1404
|
+
Path.join(projectPath, "source", "bindings_v2.json"),
|
|
1405
|
+
Path.join(projectPath, "source", "bindings.json"),
|
|
1406
|
+
Path.join(projectPath, "bindings.json"),
|
|
1407
|
+
Path.join(projectPath, "bindings_v2.json")
|
|
1408
|
+
];
|
|
1409
|
+
let bindingsV2Json = null;
|
|
1410
|
+
for (const candidate of bindingsCandidatePaths) {
|
|
1411
|
+
if (await this.fileSystem.exists(candidate)) {
|
|
1412
|
+
bindingsV2Json = await this.fileSystem.readFile(candidate, "utf-8");
|
|
1413
|
+
if (bindingsV2Json)
|
|
1414
|
+
break;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
if (!bindingsV2Json && await this.fileSystem.exists(bindingsV2Path)) {
|
|
1418
|
+
bindingsV2Json = await this.fileSystem.readFile(bindingsV2Path, "utf-8");
|
|
1419
|
+
}
|
|
1420
|
+
if (!bindingsV2Json) {
|
|
1421
|
+
bindingsV2Json = JSON.stringify({
|
|
1422
|
+
version: "2.0",
|
|
1423
|
+
resources: []
|
|
1424
|
+
}, null, 2);
|
|
1425
|
+
}
|
|
1426
|
+
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
1427
|
+
const entryPointsPath = Path.join(contentFolder, "entry-points.json");
|
|
1428
|
+
const projectEntryPointsPath = Path.join(projectPath, "entry-points.json");
|
|
1429
|
+
let entryPointsContent;
|
|
1430
|
+
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
1431
|
+
if (projectEntryPointsExists) {
|
|
1432
|
+
const entryPointsData = await this.fileSystem.readFile(projectEntryPointsPath, "utf-8");
|
|
1433
|
+
if (entryPointsData) {
|
|
1434
|
+
entryPointsContent = entryPointsData;
|
|
1435
|
+
} else {
|
|
1436
|
+
entryPointsContent = this.createDefaultEntryPoints(mainFile);
|
|
1437
|
+
}
|
|
1438
|
+
} else {
|
|
1439
|
+
entryPointsContent = this.createDefaultEntryPoints(mainFile);
|
|
1440
|
+
}
|
|
1441
|
+
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
1442
|
+
const packageDescriptorPath = Path.join(contentFolder, NugetConstants.PackageDescriptorFileName);
|
|
1443
|
+
const packageDescriptor = {
|
|
1444
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
1445
|
+
files: {
|
|
1446
|
+
[NugetConstants.OperateFileName]: Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName),
|
|
1447
|
+
"entry-points.json": Path.join(NugetConstants.ContentFolderName, "entry-points.json"),
|
|
1448
|
+
"bindings.json": Path.join(NugetConstants.ContentFolderName, "bindings_v2.json")
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
1452
|
+
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
1453
|
+
}
|
|
1454
|
+
createDefaultEntryPoints(mainFile) {
|
|
1455
|
+
const uniqueId = this.generateUniqueId();
|
|
1456
|
+
const entryPoints = {
|
|
1457
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
1458
|
+
$id: "entry-points-doc-001",
|
|
1459
|
+
entryPoints: [
|
|
1460
|
+
{
|
|
1461
|
+
filePath: mainFile,
|
|
1462
|
+
uniqueId,
|
|
1463
|
+
type: DEFAULT_ENTRY_POINT_TYPE,
|
|
1464
|
+
input: {
|
|
1465
|
+
amount: { type: "integer" },
|
|
1466
|
+
id: { type: "string" }
|
|
1467
|
+
},
|
|
1468
|
+
output: {
|
|
1469
|
+
status: { type: "string" }
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
]
|
|
1473
|
+
};
|
|
1474
|
+
return JSON.stringify(entryPoints, null, 2);
|
|
1475
|
+
}
|
|
1476
|
+
generateUniqueId() {
|
|
1477
|
+
const randomBytes = new Uint8Array(16);
|
|
1478
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
1479
|
+
crypto.getRandomValues(randomBytes);
|
|
1480
|
+
} else {
|
|
1481
|
+
throw new Error("crypto.getRandomValues is not available");
|
|
1482
|
+
}
|
|
1483
|
+
randomBytes[6] = randomBytes[6] & 15 | 64;
|
|
1484
|
+
randomBytes[8] = randomBytes[8] & 63 | 128;
|
|
1485
|
+
const hex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1486
|
+
return [
|
|
1487
|
+
hex.substring(0, 8),
|
|
1488
|
+
hex.substring(8, 12),
|
|
1489
|
+
hex.substring(12, 16),
|
|
1490
|
+
hex.substring(16, 20),
|
|
1491
|
+
hex.substring(20, 32)
|
|
1492
|
+
].join("-");
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
// ../packager/packager-tool-webapp/src/strategies/js-apps-strategy.ts
|
|
1497
|
+
class JsAppsStrategy {
|
|
1498
|
+
fileSystem;
|
|
1499
|
+
constructor(fileSystem) {
|
|
1500
|
+
this.fileSystem = fileSystem;
|
|
1501
|
+
}
|
|
1502
|
+
async validateAsync(args) {
|
|
1503
|
+
const { projectPath, logger } = args;
|
|
1504
|
+
const appFolder = Path.join(projectPath, APP_FOLDER_NAME);
|
|
1505
|
+
const exists = await this.fileSystem.exists(appFolder);
|
|
1506
|
+
if (!exists) {
|
|
1507
|
+
const message = ERROR_MESSAGES.APP_FOLDER_NOT_FOUND(appFolder);
|
|
1508
|
+
if (logger?.warn) {
|
|
1509
|
+
logger.warn(message);
|
|
1510
|
+
} else {
|
|
1511
|
+
logger?.info(`Warning: ${message}`);
|
|
1512
|
+
}
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
const stat = await this.fileSystem.stat(appFolder);
|
|
1516
|
+
if (!stat?.isDirectory()) {
|
|
1517
|
+
const message = ERROR_MESSAGES.APP_FOLDER_NOT_DIRECTORY(appFolder);
|
|
1518
|
+
if (logger?.warn) {
|
|
1519
|
+
logger.warn(message);
|
|
1520
|
+
} else {
|
|
1521
|
+
logger?.info(`Warning: ${message}`);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
async packageAsync(args) {
|
|
1526
|
+
const { projectPath, manifest, outputPath, packageInfo, logger } = args;
|
|
1527
|
+
logger?.info(`Packaging JS variant: ${packageInfo.id}@${packageInfo.version}`);
|
|
1528
|
+
const appFolder = Path.join(projectPath, APP_FOLDER_NAME);
|
|
1529
|
+
logger?.progress("Validating .app folder...");
|
|
1530
|
+
const appFolderExists = await this.fileSystem.exists(appFolder);
|
|
1531
|
+
if (!appFolderExists) {
|
|
1532
|
+
throw new Error(ERROR_MESSAGES.APP_FOLDER_NOT_FOUND(appFolder));
|
|
1533
|
+
}
|
|
1534
|
+
const appFolderStat = await this.fileSystem.stat(appFolder);
|
|
1535
|
+
if (!appFolderStat?.isDirectory()) {
|
|
1536
|
+
throw new Error(ERROR_MESSAGES.APP_FOLDER_NOT_DIRECTORY(appFolder));
|
|
1537
|
+
}
|
|
1538
|
+
const localBuildFolder = Path.join(outputPath, NugetConstants.OutputFolderName);
|
|
1539
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
1540
|
+
const contentAppFolder = Path.join(contentFolder, CONTENT_APP_FOLDER_NAME);
|
|
1541
|
+
await this.fileSystem.mkdir(contentFolder);
|
|
1542
|
+
try {
|
|
1543
|
+
logger?.progress("Copying .app folder into content/app...");
|
|
1544
|
+
await copyDirectoryAsync(this.fileSystem, appFolder, contentAppFolder);
|
|
1545
|
+
logger?.progress("Preparing metadata files...");
|
|
1546
|
+
await this.prepareMetadataFiles(contentFolder, contentAppFolder, packageInfo, manifest, projectPath);
|
|
1547
|
+
logger?.progress("Creating NuGet package...");
|
|
1548
|
+
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
1549
|
+
const nupkgPath = Path.join(outputPath, nupkgFileName);
|
|
1550
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
1551
|
+
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
1552
|
+
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
1553
|
+
return result.outputPath;
|
|
1554
|
+
} finally {
|
|
1555
|
+
try {
|
|
1556
|
+
await this.fileSystem.rm(localBuildFolder);
|
|
1557
|
+
} catch (cleanupError) {
|
|
1558
|
+
logger?.error(`Failed to cleanup build folder: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
async prepareMetadataFiles(contentFolder, _contentAppFolder, _packageInfo, _manifest, projectPath) {
|
|
1563
|
+
const mainFile = "index.html";
|
|
1564
|
+
const mainRelativeToContent = `${CONTENT_APP_FOLDER_NAME}/${mainFile}`;
|
|
1565
|
+
const operatePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
1566
|
+
const operateModel = {
|
|
1567
|
+
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
1568
|
+
main: mainRelativeToContent,
|
|
1569
|
+
contentType: ProjectTypes.WebApp,
|
|
1570
|
+
targetFramework: TargetFramework.Portable,
|
|
1571
|
+
targetRuntime: TARGET_JS_RUNTIME,
|
|
1572
|
+
runtimeOptions: {
|
|
1573
|
+
requiresUserInteraction: false,
|
|
1574
|
+
isAttended: false
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
1578
|
+
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
1579
|
+
const manifestSourcePath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
1580
|
+
const manifestDestPath = Path.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME);
|
|
1581
|
+
const manifestExists = await this.fileSystem.exists(manifestSourcePath);
|
|
1582
|
+
if (manifestExists) {
|
|
1583
|
+
const manifestContent = await this.fileSystem.readFile(manifestSourcePath);
|
|
1584
|
+
if (manifestContent) {
|
|
1585
|
+
await this.fileSystem.writeFile(manifestDestPath, manifestContent);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
const uipathJsonSourcePath = Path.join(projectPath, "uipath.json");
|
|
1589
|
+
const uipathJsonDestPath = Path.join(contentFolder, "uipath.json");
|
|
1590
|
+
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
1591
|
+
if (uipathJsonExists) {
|
|
1592
|
+
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath);
|
|
1593
|
+
if (uipathJsonContent) {
|
|
1594
|
+
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
const bindingsPath = Path.join(contentFolder, "bindings.json");
|
|
1598
|
+
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
1599
|
+
if (!bindingsExists) {
|
|
1600
|
+
const bindingsJson = JSON.stringify({ version: "1.0", resources: [] }, null, 2);
|
|
1601
|
+
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
1602
|
+
}
|
|
1603
|
+
const bindingsV2Path = Path.join(contentFolder, "bindings_v2.json");
|
|
1604
|
+
const bindingsV2Exists = await this.fileSystem.exists(bindingsV2Path);
|
|
1605
|
+
if (!bindingsV2Exists) {
|
|
1606
|
+
const bindingsV2Json = JSON.stringify({ version: "2.0", resources: [] }, null, 2);
|
|
1607
|
+
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
1608
|
+
}
|
|
1609
|
+
const entryPointsPath = Path.join(contentFolder, "entry-points.json");
|
|
1610
|
+
const projectEntryPointsPath = Path.join(projectPath, "entry-points.json");
|
|
1611
|
+
let entryPointsContent;
|
|
1612
|
+
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
1613
|
+
if (projectEntryPointsExists) {
|
|
1614
|
+
const entryPointsData = await this.fileSystem.readFile(projectEntryPointsPath);
|
|
1615
|
+
if (entryPointsData) {
|
|
1616
|
+
entryPointsContent = new TextDecoder().decode(entryPointsData);
|
|
1617
|
+
} else {
|
|
1618
|
+
entryPointsContent = this.createDefaultEntryPoints(mainRelativeToContent);
|
|
1619
|
+
}
|
|
1620
|
+
} else {
|
|
1621
|
+
entryPointsContent = this.createDefaultEntryPoints(mainRelativeToContent);
|
|
1622
|
+
}
|
|
1623
|
+
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
1624
|
+
const packageDescriptorPath = Path.join(contentFolder, NugetConstants.PackageDescriptorFileName);
|
|
1625
|
+
const packageDescriptor = {
|
|
1626
|
+
files: {
|
|
1627
|
+
[NugetConstants.OperateFileName]: Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName),
|
|
1628
|
+
"entry-points.json": Path.join(NugetConstants.ContentFolderName, "entry-points.json"),
|
|
1629
|
+
"bindings.json": Path.join(NugetConstants.ContentFolderName, "bindings_v2.json")
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
1633
|
+
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
1634
|
+
}
|
|
1635
|
+
createDefaultEntryPoints(mainFilePath) {
|
|
1636
|
+
const uniqueId = this.generateUniqueId();
|
|
1637
|
+
const entryPoints = {
|
|
1638
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
1639
|
+
$id: "entry-points-doc-001",
|
|
1640
|
+
entryPoints: [
|
|
1641
|
+
{
|
|
1642
|
+
filePath: mainFilePath,
|
|
1643
|
+
uniqueId,
|
|
1644
|
+
type: DEFAULT_ENTRY_POINT_TYPE,
|
|
1645
|
+
input: {
|
|
1646
|
+
amount: { type: "integer" },
|
|
1647
|
+
id: { type: "string" }
|
|
1648
|
+
},
|
|
1649
|
+
output: {
|
|
1650
|
+
status: { type: "string" }
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
]
|
|
1654
|
+
};
|
|
1655
|
+
return JSON.stringify(entryPoints, null, 2);
|
|
1656
|
+
}
|
|
1657
|
+
generateUniqueId() {
|
|
1658
|
+
const randomBytes = new Uint8Array(16);
|
|
1659
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
1660
|
+
crypto.getRandomValues(randomBytes);
|
|
1661
|
+
} else {
|
|
1662
|
+
throw new Error("crypto.getRandomValues is not available");
|
|
1663
|
+
}
|
|
1664
|
+
randomBytes[6] = randomBytes[6] & 15 | 64;
|
|
1665
|
+
randomBytes[8] = randomBytes[8] & 63 | 128;
|
|
1666
|
+
const hex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1667
|
+
return [
|
|
1668
|
+
hex.substring(0, 8),
|
|
1669
|
+
hex.substring(8, 12),
|
|
1670
|
+
hex.substring(12, 16),
|
|
1671
|
+
hex.substring(16, 20),
|
|
1672
|
+
hex.substring(20, 32)
|
|
1673
|
+
].join("-");
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// ../packager/packager-tool-webapp/src/strategies/variant-strategy-factory.ts
|
|
1678
|
+
class VariantStrategyFactory {
|
|
1679
|
+
static createStrategy(manifest, fileSystem) {
|
|
1680
|
+
const variant = manifest.type;
|
|
1681
|
+
switch (variant) {
|
|
1682
|
+
case "Coded" /* Coded */:
|
|
1683
|
+
return new CodedAppStrategy(fileSystem);
|
|
1684
|
+
case "JS" /* JS */:
|
|
1685
|
+
return new JsAppsStrategy(fileSystem);
|
|
1686
|
+
default:
|
|
1687
|
+
throw new Error(`Unknown WebApp variant: ${manifest.type}. Supported variants: ${Object.values(WebAppVariantType).join(", ")}`);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
// ../packager/packager-tool-webapp/src/webapp-tool.ts
|
|
1693
|
+
class WebAppTool extends ProjectTool {
|
|
1694
|
+
_temporaryStorage;
|
|
1695
|
+
_tempBuildFolder = null;
|
|
1696
|
+
constructor(fileSystem, logger) {
|
|
1697
|
+
super(fileSystem, logger);
|
|
1698
|
+
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
1699
|
+
}
|
|
1700
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1701
|
+
this.logger.info("Restore operation is not required for WebApp projects");
|
|
1702
|
+
return ToolResult.success();
|
|
1703
|
+
}
|
|
1704
|
+
async validateAsync(options, _cancellationToken) {
|
|
1705
|
+
if (!options.projectPath) {
|
|
1706
|
+
return this.handleError(new Error(ERROR_MESSAGES.PROJECT_PATH_REQUIRED), "Validation");
|
|
1707
|
+
}
|
|
1708
|
+
try {
|
|
1709
|
+
this.logger.info("Validating WebApp project...");
|
|
1710
|
+
let manifest;
|
|
1711
|
+
let strategy;
|
|
1712
|
+
try {
|
|
1713
|
+
const prepared = await this.getManifestAndStrategy(options.projectPath);
|
|
1714
|
+
manifest = prepared.manifest;
|
|
1715
|
+
strategy = prepared.strategy;
|
|
1716
|
+
} catch (error) {
|
|
1717
|
+
return this.handleError(error, "Validation");
|
|
1718
|
+
}
|
|
1719
|
+
try {
|
|
1720
|
+
if (strategy.validateAsync) {
|
|
1721
|
+
await strategy.validateAsync({
|
|
1722
|
+
fileSystem: this.fileSystem,
|
|
1723
|
+
projectPath: options.projectPath,
|
|
1724
|
+
manifest,
|
|
1725
|
+
logger: this.createStrategyLogger()
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
} catch (error) {
|
|
1729
|
+
return this.handleError(error, "Validation");
|
|
1730
|
+
}
|
|
1731
|
+
this.logger.info("WebApp project validation completed");
|
|
1732
|
+
return ToolResult.success();
|
|
1733
|
+
} catch (error) {
|
|
1734
|
+
return this.handleError(error, "Validation");
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
async buildAsync(_options, _cancellationToken) {
|
|
1738
|
+
this.logger.info("Build operation for WebApp is lightweight (metadata preparation only)");
|
|
1739
|
+
return ToolResult.success();
|
|
1740
|
+
}
|
|
1741
|
+
async packAsync(options, _cancellationToken) {
|
|
1742
|
+
if (!options.projectPath) {
|
|
1743
|
+
return this.handleError(new Error(ERROR_MESSAGES.PROJECT_PATH_REQUIRED), "Packing");
|
|
1744
|
+
}
|
|
1745
|
+
if (!options.outputPath) {
|
|
1746
|
+
return this.handleError(new Error(ERROR_MESSAGES.OUTPUT_PATH_REQUIRED), "Packing");
|
|
1747
|
+
}
|
|
1748
|
+
if (!options.package?.id) {
|
|
1749
|
+
return this.handleError(new Error(ERROR_MESSAGES.PACKAGE_NAME_REQUIRED), "Packing");
|
|
1750
|
+
}
|
|
1751
|
+
if (!options.package?.version) {
|
|
1752
|
+
return this.handleError(new Error(ERROR_MESSAGES.PACKAGE_VERSION_REQUIRED), "Packing");
|
|
1753
|
+
}
|
|
1754
|
+
try {
|
|
1755
|
+
this.logger.info(`Packing WebApp project: ${options.package.id}@${options.package.version}`);
|
|
1756
|
+
let manifest;
|
|
1757
|
+
let strategy;
|
|
1758
|
+
try {
|
|
1759
|
+
const prepared = await this.getManifestAndStrategy(options.projectPath);
|
|
1760
|
+
manifest = prepared.manifest;
|
|
1761
|
+
strategy = prepared.strategy;
|
|
1762
|
+
} catch (error) {
|
|
1763
|
+
return this.handleError(error, `Packing WebApp project '${options.package.id}'`);
|
|
1764
|
+
}
|
|
1765
|
+
const nupkgPath = await strategy.packageAsync({
|
|
1766
|
+
fileSystem: this.fileSystem,
|
|
1767
|
+
projectPath: options.projectPath,
|
|
1768
|
+
manifest,
|
|
1769
|
+
outputPath: options.outputPath,
|
|
1770
|
+
packageInfo: options.package,
|
|
1771
|
+
logger: this.createStrategyLogger()
|
|
1772
|
+
});
|
|
1773
|
+
this.logger.info(`WebApp package created successfully: ${nupkgPath}`);
|
|
1774
|
+
return new ToolResult(ToolErrorCodes.Success, "done", [nupkgPath]);
|
|
1775
|
+
} catch (error) {
|
|
1776
|
+
return this.handleError(error, `Packing WebApp project '${options.package.id}'`);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
async dispose() {
|
|
1780
|
+
this.logger.info("Disposing WebApp Tool");
|
|
1781
|
+
try {
|
|
1782
|
+
if (this._tempBuildFolder) {
|
|
1783
|
+
await this.fileSystem.rm(this._tempBuildFolder);
|
|
1784
|
+
this._tempBuildFolder = null;
|
|
1785
|
+
}
|
|
1786
|
+
await this._temporaryStorage.cleanup();
|
|
1787
|
+
} catch {}
|
|
1788
|
+
}
|
|
1789
|
+
async getManifestAndStrategy(projectPath) {
|
|
1790
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
1791
|
+
const manifestExists = await this.fileSystem.exists(manifestPath);
|
|
1792
|
+
if (!manifestExists) {
|
|
1793
|
+
throw new Error(ERROR_MESSAGES.MANIFEST_NOT_FOUND(WEBAPP_MANIFEST_FILE_NAME));
|
|
1794
|
+
}
|
|
1795
|
+
const projectJsonPath = Path.join(projectPath, PROJECT_JSON_FILE);
|
|
1796
|
+
if (await this.fileSystem.exists(projectJsonPath)) {
|
|
1797
|
+
throw new Error(ERROR_MESSAGES.PROJECT_JSON_FOUND);
|
|
1798
|
+
}
|
|
1799
|
+
const manifest = await loadWebAppManifest(this.fileSystem, projectPath);
|
|
1800
|
+
if (!manifest) {
|
|
1801
|
+
throw new Error(ERROR_MESSAGES.MANIFEST_LOAD_FAILED(WEBAPP_MANIFEST_FILE_NAME));
|
|
1802
|
+
}
|
|
1803
|
+
const strategy = VariantStrategyFactory.createStrategy(manifest, this.fileSystem);
|
|
1804
|
+
return { manifest, strategy };
|
|
1805
|
+
}
|
|
1806
|
+
handleError(error, context) {
|
|
1807
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1808
|
+
this.logger.error(`${context}: ${errorMessage}`);
|
|
1809
|
+
let userMessage;
|
|
1810
|
+
if (context === "Validation") {
|
|
1811
|
+
userMessage = ERROR_MESSAGES.VALIDATION_FAILED(errorMessage);
|
|
1812
|
+
} else if (context.startsWith("Packing")) {
|
|
1813
|
+
userMessage = ERROR_MESSAGES.PACKING_FAILED(errorMessage);
|
|
1814
|
+
} else {
|
|
1815
|
+
userMessage = errorMessage;
|
|
1816
|
+
}
|
|
1817
|
+
return ToolResult.error(ToolErrorCodes.InternalError, userMessage);
|
|
1818
|
+
}
|
|
1819
|
+
createStrategyLogger() {
|
|
1820
|
+
return {
|
|
1821
|
+
info: (msg) => this.logger.info(msg),
|
|
1822
|
+
error: (msg) => this.logger.error(msg),
|
|
1823
|
+
progress: (msg) => this.logger.progress(msg),
|
|
1824
|
+
warn: (msg) => this.logger.warn(msg)
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// ../packager/packager-tool-webapp/src/webapp-tool-factory.ts
|
|
1830
|
+
class WebAppToolFactory {
|
|
1831
|
+
supportedTypes = [ProjectTypes.AppV2];
|
|
1832
|
+
async createAsync(logger, fileSystem) {
|
|
1833
|
+
return new WebAppTool(fileSystem, logger);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
export { WEBAPP_MANIFEST_FILE_NAME, WebAppToolFactory };
|
|
1837
|
+
|
|
1838
|
+
//# debugId=858B2D102CDBECEC64756E2164756E21
|