@uipath/solution-tool 1.197.0 → 1.198.0-preview.80
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/deploy.js +70 -20
- package/dist/init.js +6 -1
- package/dist/pack.js +451 -90
- package/dist/packager-tool.js +4676 -0
- package/dist/publish.js +36 -7
- package/dist/resource.js +24 -5
- package/dist/services/deploy-list-service.d.ts +9 -0
- package/dist/services/packages-list-service.d.ts +9 -0
- package/dist/services/publish-service.d.ts +1 -1
- package/dist/tool.js +9499 -11394
- package/package.json +2 -2
|
@@ -0,0 +1,4676 @@
|
|
|
1
|
+
// ../../node_modules/fflate/esm/index.mjs
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
var require2 = createRequire("/");
|
|
4
|
+
var _a;
|
|
5
|
+
var Worker;
|
|
6
|
+
var isMarkedAsUntransferable;
|
|
7
|
+
try {
|
|
8
|
+
_a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
|
|
9
|
+
} catch (e) {}
|
|
10
|
+
var u8 = Uint8Array;
|
|
11
|
+
var u16 = Uint16Array;
|
|
12
|
+
var i32 = Int32Array;
|
|
13
|
+
var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]);
|
|
14
|
+
var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]);
|
|
15
|
+
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
16
|
+
var freb = function(eb, start) {
|
|
17
|
+
var b = new u16(31);
|
|
18
|
+
for (var i = 0;i < 31; ++i) {
|
|
19
|
+
b[i] = start += 1 << eb[i - 1];
|
|
20
|
+
}
|
|
21
|
+
var r = new i32(b[30]);
|
|
22
|
+
for (var i = 1;i < 30; ++i) {
|
|
23
|
+
for (var j = b[i];j < b[i + 1]; ++j) {
|
|
24
|
+
r[j] = j - b[i] << 5 | i;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { b, r };
|
|
28
|
+
};
|
|
29
|
+
var _a = freb(fleb, 2);
|
|
30
|
+
var fl = _a.b;
|
|
31
|
+
var revfl = _a.r;
|
|
32
|
+
fl[28] = 258, revfl[258] = 28;
|
|
33
|
+
var _b = freb(fdeb, 0);
|
|
34
|
+
var fd = _b.b;
|
|
35
|
+
var revfd = _b.r;
|
|
36
|
+
var rev = new u16(32768);
|
|
37
|
+
for (i = 0;i < 32768; ++i) {
|
|
38
|
+
x = (i & 43690) >> 1 | (i & 21845) << 1;
|
|
39
|
+
x = (x & 52428) >> 2 | (x & 13107) << 2;
|
|
40
|
+
x = (x & 61680) >> 4 | (x & 3855) << 4;
|
|
41
|
+
rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
|
|
42
|
+
}
|
|
43
|
+
var x;
|
|
44
|
+
var i;
|
|
45
|
+
var hMap = function(cd, mb, r) {
|
|
46
|
+
var s = cd.length;
|
|
47
|
+
var i2 = 0;
|
|
48
|
+
var l = new u16(mb);
|
|
49
|
+
for (;i2 < s; ++i2) {
|
|
50
|
+
if (cd[i2])
|
|
51
|
+
++l[cd[i2] - 1];
|
|
52
|
+
}
|
|
53
|
+
var le = new u16(mb);
|
|
54
|
+
for (i2 = 1;i2 < mb; ++i2) {
|
|
55
|
+
le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
|
|
56
|
+
}
|
|
57
|
+
var co;
|
|
58
|
+
if (r) {
|
|
59
|
+
co = new u16(1 << mb);
|
|
60
|
+
var rvb = 15 - mb;
|
|
61
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
62
|
+
if (cd[i2]) {
|
|
63
|
+
var sv = i2 << 4 | cd[i2];
|
|
64
|
+
var r_1 = mb - cd[i2];
|
|
65
|
+
var v = le[cd[i2] - 1]++ << r_1;
|
|
66
|
+
for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
|
|
67
|
+
co[rev[v] >> rvb] = sv;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
co = new u16(s);
|
|
73
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
74
|
+
if (cd[i2]) {
|
|
75
|
+
co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return co;
|
|
80
|
+
};
|
|
81
|
+
var flt = new u8(288);
|
|
82
|
+
for (i = 0;i < 144; ++i)
|
|
83
|
+
flt[i] = 8;
|
|
84
|
+
var i;
|
|
85
|
+
for (i = 144;i < 256; ++i)
|
|
86
|
+
flt[i] = 9;
|
|
87
|
+
var i;
|
|
88
|
+
for (i = 256;i < 280; ++i)
|
|
89
|
+
flt[i] = 7;
|
|
90
|
+
var i;
|
|
91
|
+
for (i = 280;i < 288; ++i)
|
|
92
|
+
flt[i] = 8;
|
|
93
|
+
var i;
|
|
94
|
+
var fdt = new u8(32);
|
|
95
|
+
for (i = 0;i < 32; ++i)
|
|
96
|
+
fdt[i] = 5;
|
|
97
|
+
var i;
|
|
98
|
+
var flm = /* @__PURE__ */ hMap(flt, 9, 0);
|
|
99
|
+
var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
|
|
100
|
+
var shft = function(p) {
|
|
101
|
+
return (p + 7) / 8 | 0;
|
|
102
|
+
};
|
|
103
|
+
var slc = function(v, s, e) {
|
|
104
|
+
if (s == null || s < 0)
|
|
105
|
+
s = 0;
|
|
106
|
+
if (e == null || e > v.length)
|
|
107
|
+
e = v.length;
|
|
108
|
+
return new u8(v.subarray(s, e));
|
|
109
|
+
};
|
|
110
|
+
var ec = [
|
|
111
|
+
"unexpected EOF",
|
|
112
|
+
"invalid block type",
|
|
113
|
+
"invalid length/literal",
|
|
114
|
+
"invalid distance",
|
|
115
|
+
"stream finished",
|
|
116
|
+
"no stream handler",
|
|
117
|
+
,
|
|
118
|
+
"no callback",
|
|
119
|
+
"invalid UTF-8 data",
|
|
120
|
+
"extra field too long",
|
|
121
|
+
"date not in range 1980-2099",
|
|
122
|
+
"filename too long",
|
|
123
|
+
"stream finishing",
|
|
124
|
+
"invalid zip data"
|
|
125
|
+
];
|
|
126
|
+
var err = function(ind, msg, nt) {
|
|
127
|
+
var e = new Error(msg || ec[ind]);
|
|
128
|
+
e.code = ind;
|
|
129
|
+
if (Error.captureStackTrace)
|
|
130
|
+
Error.captureStackTrace(e, err);
|
|
131
|
+
if (!nt)
|
|
132
|
+
throw e;
|
|
133
|
+
return e;
|
|
134
|
+
};
|
|
135
|
+
var wbits = function(d, p, v) {
|
|
136
|
+
v <<= p & 7;
|
|
137
|
+
var o = p / 8 | 0;
|
|
138
|
+
d[o] |= v;
|
|
139
|
+
d[o + 1] |= v >> 8;
|
|
140
|
+
};
|
|
141
|
+
var wbits16 = function(d, p, v) {
|
|
142
|
+
v <<= p & 7;
|
|
143
|
+
var o = p / 8 | 0;
|
|
144
|
+
d[o] |= v;
|
|
145
|
+
d[o + 1] |= v >> 8;
|
|
146
|
+
d[o + 2] |= v >> 16;
|
|
147
|
+
};
|
|
148
|
+
var hTree = function(d, mb) {
|
|
149
|
+
var t = [];
|
|
150
|
+
for (var i2 = 0;i2 < d.length; ++i2) {
|
|
151
|
+
if (d[i2])
|
|
152
|
+
t.push({ s: i2, f: d[i2] });
|
|
153
|
+
}
|
|
154
|
+
var s = t.length;
|
|
155
|
+
var t2 = t.slice();
|
|
156
|
+
if (!s)
|
|
157
|
+
return { t: et, l: 0 };
|
|
158
|
+
if (s == 1) {
|
|
159
|
+
var v = new u8(t[0].s + 1);
|
|
160
|
+
v[t[0].s] = 1;
|
|
161
|
+
return { t: v, l: 1 };
|
|
162
|
+
}
|
|
163
|
+
t.sort(function(a, b) {
|
|
164
|
+
return a.f - b.f;
|
|
165
|
+
});
|
|
166
|
+
t.push({ s: -1, f: 25001 });
|
|
167
|
+
var l = t[0], r = t[1], i0 = 0, i1 = 1, i22 = 2;
|
|
168
|
+
t[0] = { s: -1, f: l.f + r.f, l, r };
|
|
169
|
+
while (i1 != s - 1) {
|
|
170
|
+
l = t[t[i0].f < t[i22].f ? i0++ : i22++];
|
|
171
|
+
r = t[i0 != i1 && t[i0].f < t[i22].f ? i0++ : i22++];
|
|
172
|
+
t[i1++] = { s: -1, f: l.f + r.f, l, r };
|
|
173
|
+
}
|
|
174
|
+
var maxSym = t2[0].s;
|
|
175
|
+
for (var i2 = 1;i2 < s; ++i2) {
|
|
176
|
+
if (t2[i2].s > maxSym)
|
|
177
|
+
maxSym = t2[i2].s;
|
|
178
|
+
}
|
|
179
|
+
var tr = new u16(maxSym + 1);
|
|
180
|
+
var mbt = ln(t[i1 - 1], tr, 0);
|
|
181
|
+
if (mbt > mb) {
|
|
182
|
+
var i2 = 0, dt = 0;
|
|
183
|
+
var lft = mbt - mb, cst = 1 << lft;
|
|
184
|
+
t2.sort(function(a, b) {
|
|
185
|
+
return tr[b.s] - tr[a.s] || a.f - b.f;
|
|
186
|
+
});
|
|
187
|
+
for (;i2 < s; ++i2) {
|
|
188
|
+
var i2_1 = t2[i2].s;
|
|
189
|
+
if (tr[i2_1] > mb) {
|
|
190
|
+
dt += cst - (1 << mbt - tr[i2_1]);
|
|
191
|
+
tr[i2_1] = mb;
|
|
192
|
+
} else
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
dt >>= lft;
|
|
196
|
+
while (dt > 0) {
|
|
197
|
+
var i2_2 = t2[i2].s;
|
|
198
|
+
if (tr[i2_2] < mb)
|
|
199
|
+
dt -= 1 << mb - tr[i2_2]++ - 1;
|
|
200
|
+
else
|
|
201
|
+
++i2;
|
|
202
|
+
}
|
|
203
|
+
for (;i2 >= 0 && dt; --i2) {
|
|
204
|
+
var i2_3 = t2[i2].s;
|
|
205
|
+
if (tr[i2_3] == mb) {
|
|
206
|
+
--tr[i2_3];
|
|
207
|
+
++dt;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
mbt = mb;
|
|
211
|
+
}
|
|
212
|
+
return { t: new u8(tr), l: mbt };
|
|
213
|
+
};
|
|
214
|
+
var ln = function(n, l, d) {
|
|
215
|
+
return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
|
|
216
|
+
};
|
|
217
|
+
var lc = function(c) {
|
|
218
|
+
var s = c.length;
|
|
219
|
+
while (s && !c[--s])
|
|
220
|
+
;
|
|
221
|
+
var cl = new u16(++s);
|
|
222
|
+
var cli = 0, cln = c[0], cls = 1;
|
|
223
|
+
var w = function(v) {
|
|
224
|
+
cl[cli++] = v;
|
|
225
|
+
};
|
|
226
|
+
for (var i2 = 1;i2 <= s; ++i2) {
|
|
227
|
+
if (c[i2] == cln && i2 != s)
|
|
228
|
+
++cls;
|
|
229
|
+
else {
|
|
230
|
+
if (!cln && cls > 2) {
|
|
231
|
+
for (;cls > 138; cls -= 138)
|
|
232
|
+
w(32754);
|
|
233
|
+
if (cls > 2) {
|
|
234
|
+
w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
|
|
235
|
+
cls = 0;
|
|
236
|
+
}
|
|
237
|
+
} else if (cls > 3) {
|
|
238
|
+
w(cln), --cls;
|
|
239
|
+
for (;cls > 6; cls -= 6)
|
|
240
|
+
w(8304);
|
|
241
|
+
if (cls > 2)
|
|
242
|
+
w(cls - 3 << 5 | 8208), cls = 0;
|
|
243
|
+
}
|
|
244
|
+
while (cls--)
|
|
245
|
+
w(cln);
|
|
246
|
+
cls = 1;
|
|
247
|
+
cln = c[i2];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return { c: cl.subarray(0, cli), n: s };
|
|
251
|
+
};
|
|
252
|
+
var clen = function(cf, cl) {
|
|
253
|
+
var l = 0;
|
|
254
|
+
for (var i2 = 0;i2 < cl.length; ++i2)
|
|
255
|
+
l += cf[i2] * cl[i2];
|
|
256
|
+
return l;
|
|
257
|
+
};
|
|
258
|
+
var wfblk = function(out, pos, dat) {
|
|
259
|
+
var s = dat.length;
|
|
260
|
+
var o = shft(pos + 2);
|
|
261
|
+
out[o] = s & 255;
|
|
262
|
+
out[o + 1] = s >> 8;
|
|
263
|
+
out[o + 2] = out[o] ^ 255;
|
|
264
|
+
out[o + 3] = out[o + 1] ^ 255;
|
|
265
|
+
for (var i2 = 0;i2 < s; ++i2)
|
|
266
|
+
out[o + i2 + 4] = dat[i2];
|
|
267
|
+
return (o + 4 + s) * 8;
|
|
268
|
+
};
|
|
269
|
+
var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
|
|
270
|
+
wbits(out, p++, final);
|
|
271
|
+
++lf[256];
|
|
272
|
+
var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
|
|
273
|
+
var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
|
|
274
|
+
var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
|
|
275
|
+
var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
|
|
276
|
+
var lcfreq = new u16(19);
|
|
277
|
+
for (var i2 = 0;i2 < lclt.length; ++i2)
|
|
278
|
+
++lcfreq[lclt[i2] & 31];
|
|
279
|
+
for (var i2 = 0;i2 < lcdt.length; ++i2)
|
|
280
|
+
++lcfreq[lcdt[i2] & 31];
|
|
281
|
+
var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
|
|
282
|
+
var nlcc = 19;
|
|
283
|
+
for (;nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
|
|
284
|
+
;
|
|
285
|
+
var flen = bl + 5 << 3;
|
|
286
|
+
var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
|
|
287
|
+
var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
|
|
288
|
+
if (bs >= 0 && flen <= ftlen && flen <= dtlen)
|
|
289
|
+
return wfblk(out, p, dat.subarray(bs, bs + bl));
|
|
290
|
+
var lm, ll, dm, dl;
|
|
291
|
+
wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
|
|
292
|
+
if (dtlen < ftlen) {
|
|
293
|
+
lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
|
|
294
|
+
var llm = hMap(lct, mlcb, 0);
|
|
295
|
+
wbits(out, p, nlc - 257);
|
|
296
|
+
wbits(out, p + 5, ndc - 1);
|
|
297
|
+
wbits(out, p + 10, nlcc - 4);
|
|
298
|
+
p += 14;
|
|
299
|
+
for (var i2 = 0;i2 < nlcc; ++i2)
|
|
300
|
+
wbits(out, p + 3 * i2, lct[clim[i2]]);
|
|
301
|
+
p += 3 * nlcc;
|
|
302
|
+
var lcts = [lclt, lcdt];
|
|
303
|
+
for (var it = 0;it < 2; ++it) {
|
|
304
|
+
var clct = lcts[it];
|
|
305
|
+
for (var i2 = 0;i2 < clct.length; ++i2) {
|
|
306
|
+
var len = clct[i2] & 31;
|
|
307
|
+
wbits(out, p, llm[len]), p += lct[len];
|
|
308
|
+
if (len > 15)
|
|
309
|
+
wbits(out, p, clct[i2] >> 5 & 127), p += clct[i2] >> 12;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
lm = flm, ll = flt, dm = fdm, dl = fdt;
|
|
314
|
+
}
|
|
315
|
+
for (var i2 = 0;i2 < li; ++i2) {
|
|
316
|
+
var sym = syms[i2];
|
|
317
|
+
if (sym > 255) {
|
|
318
|
+
var len = sym >> 18 & 31;
|
|
319
|
+
wbits16(out, p, lm[len + 257]), p += ll[len + 257];
|
|
320
|
+
if (len > 7)
|
|
321
|
+
wbits(out, p, sym >> 23 & 31), p += fleb[len];
|
|
322
|
+
var dst = sym & 31;
|
|
323
|
+
wbits16(out, p, dm[dst]), p += dl[dst];
|
|
324
|
+
if (dst > 3)
|
|
325
|
+
wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
|
|
326
|
+
} else {
|
|
327
|
+
wbits16(out, p, lm[sym]), p += ll[sym];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
wbits16(out, p, lm[256]);
|
|
331
|
+
return p + ll[256];
|
|
332
|
+
};
|
|
333
|
+
var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
334
|
+
var et = /* @__PURE__ */ new u8(0);
|
|
335
|
+
var dflt = function(dat, lvl, plvl, pre, post, st) {
|
|
336
|
+
var s = st.z || dat.length;
|
|
337
|
+
var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);
|
|
338
|
+
var w = o.subarray(pre, o.length - post);
|
|
339
|
+
var lst = st.l;
|
|
340
|
+
var pos = (st.r || 0) & 7;
|
|
341
|
+
if (lvl) {
|
|
342
|
+
if (pos)
|
|
343
|
+
w[0] = st.r >> 3;
|
|
344
|
+
var opt = deo[lvl - 1];
|
|
345
|
+
var n = opt >> 13, c = opt & 8191;
|
|
346
|
+
var msk_1 = (1 << plvl) - 1;
|
|
347
|
+
var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
|
|
348
|
+
var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
|
|
349
|
+
var hsh = function(i3) {
|
|
350
|
+
return (dat[i3] ^ dat[i3 + 1] << bs1_1 ^ dat[i3 + 2] << bs2_1) & msk_1;
|
|
351
|
+
};
|
|
352
|
+
var syms = new i32(25000);
|
|
353
|
+
var lf = new u16(288), df = new u16(32);
|
|
354
|
+
var lc_1 = 0, eb = 0, i2 = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
|
|
355
|
+
for (;i2 + 2 < s; ++i2) {
|
|
356
|
+
var hv = hsh(i2);
|
|
357
|
+
var imod = i2 & 32767, pimod = head[hv];
|
|
358
|
+
prev[imod] = pimod;
|
|
359
|
+
head[hv] = imod;
|
|
360
|
+
if (wi <= i2) {
|
|
361
|
+
var rem = s - i2;
|
|
362
|
+
if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {
|
|
363
|
+
pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i2 - bs, pos);
|
|
364
|
+
li = lc_1 = eb = 0, bs = i2;
|
|
365
|
+
for (var j = 0;j < 286; ++j)
|
|
366
|
+
lf[j] = 0;
|
|
367
|
+
for (var j = 0;j < 30; ++j)
|
|
368
|
+
df[j] = 0;
|
|
369
|
+
}
|
|
370
|
+
var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
|
|
371
|
+
if (rem > 2 && hv == hsh(i2 - dif)) {
|
|
372
|
+
var maxn = Math.min(n, rem) - 1;
|
|
373
|
+
var maxd = Math.min(32767, i2);
|
|
374
|
+
var ml = Math.min(258, rem);
|
|
375
|
+
while (dif <= maxd && --ch_1 && imod != pimod) {
|
|
376
|
+
if (dat[i2 + l] == dat[i2 + l - dif]) {
|
|
377
|
+
var nl = 0;
|
|
378
|
+
for (;nl < ml && dat[i2 + nl] == dat[i2 + nl - dif]; ++nl)
|
|
379
|
+
;
|
|
380
|
+
if (nl > l) {
|
|
381
|
+
l = nl, d = dif;
|
|
382
|
+
if (nl > maxn)
|
|
383
|
+
break;
|
|
384
|
+
var mmd = Math.min(dif, nl - 2);
|
|
385
|
+
var md = 0;
|
|
386
|
+
for (var j = 0;j < mmd; ++j) {
|
|
387
|
+
var ti = i2 - dif + j & 32767;
|
|
388
|
+
var pti = prev[ti];
|
|
389
|
+
var cd = ti - pti & 32767;
|
|
390
|
+
if (cd > md)
|
|
391
|
+
md = cd, pimod = ti;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
imod = pimod, pimod = prev[imod];
|
|
396
|
+
dif += imod - pimod & 32767;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (d) {
|
|
400
|
+
syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
|
|
401
|
+
var lin = revfl[l] & 31, din = revfd[d] & 31;
|
|
402
|
+
eb += fleb[lin] + fdeb[din];
|
|
403
|
+
++lf[257 + lin];
|
|
404
|
+
++df[din];
|
|
405
|
+
wi = i2 + l;
|
|
406
|
+
++lc_1;
|
|
407
|
+
} else {
|
|
408
|
+
syms[li++] = dat[i2];
|
|
409
|
+
++lf[dat[i2]];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
for (i2 = Math.max(i2, wi);i2 < s; ++i2) {
|
|
414
|
+
syms[li++] = dat[i2];
|
|
415
|
+
++lf[dat[i2]];
|
|
416
|
+
}
|
|
417
|
+
pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i2 - bs, pos);
|
|
418
|
+
if (!lst) {
|
|
419
|
+
st.r = pos & 7 | w[pos / 8 | 0] << 3;
|
|
420
|
+
pos -= 7;
|
|
421
|
+
st.h = head, st.p = prev, st.i = i2, st.w = wi;
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
for (var i2 = st.w || 0;i2 < s + lst; i2 += 65535) {
|
|
425
|
+
var e = i2 + 65535;
|
|
426
|
+
if (e >= s) {
|
|
427
|
+
w[pos / 8 | 0] = lst;
|
|
428
|
+
e = s;
|
|
429
|
+
}
|
|
430
|
+
pos = wfblk(w, pos + 1, dat.subarray(i2, e));
|
|
431
|
+
}
|
|
432
|
+
st.i = s;
|
|
433
|
+
}
|
|
434
|
+
return slc(o, 0, pre + shft(pos) + post);
|
|
435
|
+
};
|
|
436
|
+
var crct = /* @__PURE__ */ function() {
|
|
437
|
+
var t = new Int32Array(256);
|
|
438
|
+
for (var i2 = 0;i2 < 256; ++i2) {
|
|
439
|
+
var c = i2, k = 9;
|
|
440
|
+
while (--k)
|
|
441
|
+
c = (c & 1 && -306674912) ^ c >>> 1;
|
|
442
|
+
t[i2] = c;
|
|
443
|
+
}
|
|
444
|
+
return t;
|
|
445
|
+
}();
|
|
446
|
+
var crc = function() {
|
|
447
|
+
var c = -1;
|
|
448
|
+
return {
|
|
449
|
+
p: function(d) {
|
|
450
|
+
var cr = c;
|
|
451
|
+
for (var i2 = 0;i2 < d.length; ++i2)
|
|
452
|
+
cr = crct[cr & 255 ^ d[i2]] ^ cr >>> 8;
|
|
453
|
+
c = cr;
|
|
454
|
+
},
|
|
455
|
+
d: function() {
|
|
456
|
+
return ~c;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
var dopt = function(dat, opt, pre, post, st) {
|
|
461
|
+
if (!st) {
|
|
462
|
+
st = { l: 1 };
|
|
463
|
+
if (opt.dictionary) {
|
|
464
|
+
var dict = opt.dictionary.subarray(-32768);
|
|
465
|
+
var newDat = new u8(dict.length + dat.length);
|
|
466
|
+
newDat.set(dict);
|
|
467
|
+
newDat.set(dat, dict.length);
|
|
468
|
+
dat = newDat;
|
|
469
|
+
st.w = dict.length;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
|
|
473
|
+
};
|
|
474
|
+
var mrg = function(a, b) {
|
|
475
|
+
var o = {};
|
|
476
|
+
for (var k in a)
|
|
477
|
+
o[k] = a[k];
|
|
478
|
+
for (var k in b)
|
|
479
|
+
o[k] = b[k];
|
|
480
|
+
return o;
|
|
481
|
+
};
|
|
482
|
+
var wbytes = function(d, b, v) {
|
|
483
|
+
for (;v; ++b)
|
|
484
|
+
d[b] = v, v >>>= 8;
|
|
485
|
+
};
|
|
486
|
+
function deflateSync(data, opts) {
|
|
487
|
+
return dopt(data, opts || {}, 0, 0);
|
|
488
|
+
}
|
|
489
|
+
var fltn = function(d, p, t, o) {
|
|
490
|
+
for (var k in d) {
|
|
491
|
+
var val = d[k], n = p + k, op = o;
|
|
492
|
+
if (Array.isArray(val))
|
|
493
|
+
op = mrg(o, val[1]), val = val[0];
|
|
494
|
+
if (ArrayBuffer.isView(val))
|
|
495
|
+
t[n] = [val, op];
|
|
496
|
+
else {
|
|
497
|
+
t[n += "/"] = [new u8(0), op];
|
|
498
|
+
fltn(val, n, t, o);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder;
|
|
503
|
+
var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
|
|
504
|
+
var tds = 0;
|
|
505
|
+
try {
|
|
506
|
+
td.decode(et, { stream: true });
|
|
507
|
+
tds = 1;
|
|
508
|
+
} catch (e) {}
|
|
509
|
+
function strToU8(str, latin1) {
|
|
510
|
+
if (latin1) {
|
|
511
|
+
var ar_1 = new u8(str.length);
|
|
512
|
+
for (var i2 = 0;i2 < str.length; ++i2)
|
|
513
|
+
ar_1[i2] = str.charCodeAt(i2);
|
|
514
|
+
return ar_1;
|
|
515
|
+
}
|
|
516
|
+
if (te)
|
|
517
|
+
return te.encode(str);
|
|
518
|
+
var l = str.length;
|
|
519
|
+
var ar = new u8(str.length + (str.length >> 1));
|
|
520
|
+
var ai = 0;
|
|
521
|
+
var w = function(v) {
|
|
522
|
+
ar[ai++] = v;
|
|
523
|
+
};
|
|
524
|
+
for (var i2 = 0;i2 < l; ++i2) {
|
|
525
|
+
if (ai + 5 > ar.length) {
|
|
526
|
+
var n = new u8(ai + 8 + (l - i2 << 1));
|
|
527
|
+
n.set(ar);
|
|
528
|
+
ar = n;
|
|
529
|
+
}
|
|
530
|
+
var c = str.charCodeAt(i2);
|
|
531
|
+
if (c < 128 || latin1)
|
|
532
|
+
w(c);
|
|
533
|
+
else if (c < 2048)
|
|
534
|
+
w(192 | c >> 6), w(128 | c & 63);
|
|
535
|
+
else if (c > 55295 && c < 57344)
|
|
536
|
+
c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i2) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);
|
|
537
|
+
else
|
|
538
|
+
w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);
|
|
539
|
+
}
|
|
540
|
+
return slc(ar, 0, ai);
|
|
541
|
+
}
|
|
542
|
+
var exfl = function(ex) {
|
|
543
|
+
var le = 0;
|
|
544
|
+
if (ex) {
|
|
545
|
+
for (var k in ex) {
|
|
546
|
+
var l = ex[k].length;
|
|
547
|
+
if (l > 65535)
|
|
548
|
+
err(9);
|
|
549
|
+
le += l + 4;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return le;
|
|
553
|
+
};
|
|
554
|
+
var wzh = function(d, b, f, fn, u, c, ce, co) {
|
|
555
|
+
var fl2 = fn.length, ex = f.extra, col = co && co.length;
|
|
556
|
+
var exl = exfl(ex);
|
|
557
|
+
wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4;
|
|
558
|
+
if (ce != null)
|
|
559
|
+
d[b++] = 20, d[b++] = f.os;
|
|
560
|
+
d[b] = 20, b += 2;
|
|
561
|
+
d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;
|
|
562
|
+
d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
|
|
563
|
+
var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
|
|
564
|
+
if (y < 0 || y > 119)
|
|
565
|
+
err(10);
|
|
566
|
+
wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;
|
|
567
|
+
if (c != -1) {
|
|
568
|
+
wbytes(d, b, f.crc);
|
|
569
|
+
wbytes(d, b + 4, c < 0 ? -c - 2 : c);
|
|
570
|
+
wbytes(d, b + 8, f.size);
|
|
571
|
+
}
|
|
572
|
+
wbytes(d, b + 12, fl2);
|
|
573
|
+
wbytes(d, b + 14, exl), b += 16;
|
|
574
|
+
if (ce != null) {
|
|
575
|
+
wbytes(d, b, col);
|
|
576
|
+
wbytes(d, b + 6, f.attrs);
|
|
577
|
+
wbytes(d, b + 10, ce), b += 14;
|
|
578
|
+
}
|
|
579
|
+
d.set(fn, b);
|
|
580
|
+
b += fl2;
|
|
581
|
+
if (exl) {
|
|
582
|
+
for (var k in ex) {
|
|
583
|
+
var exf = ex[k], l = exf.length;
|
|
584
|
+
wbytes(d, b, +k);
|
|
585
|
+
wbytes(d, b + 2, l);
|
|
586
|
+
d.set(exf, b + 4), b += 4 + l;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (col)
|
|
590
|
+
d.set(co, b), b += col;
|
|
591
|
+
return b;
|
|
592
|
+
};
|
|
593
|
+
var wzf = function(o, b, c, d, e) {
|
|
594
|
+
wbytes(o, b, 101010256);
|
|
595
|
+
wbytes(o, b + 8, c);
|
|
596
|
+
wbytes(o, b + 10, c);
|
|
597
|
+
wbytes(o, b + 12, d);
|
|
598
|
+
wbytes(o, b + 16, e);
|
|
599
|
+
};
|
|
600
|
+
function zipSync(data, opts) {
|
|
601
|
+
if (!opts)
|
|
602
|
+
opts = {};
|
|
603
|
+
var r = {};
|
|
604
|
+
var files = [];
|
|
605
|
+
fltn(data, "", r, opts);
|
|
606
|
+
var o = 0;
|
|
607
|
+
var tot = 0;
|
|
608
|
+
for (var fn in r) {
|
|
609
|
+
var _a2 = r[fn], file = _a2[0], p = _a2[1];
|
|
610
|
+
var compression = p.level == 0 ? 0 : 8;
|
|
611
|
+
var f = strToU8(fn), s = f.length;
|
|
612
|
+
var com = p.comment, m = com && strToU8(com), ms = m && m.length;
|
|
613
|
+
var exl = exfl(p.extra);
|
|
614
|
+
if (s > 65535)
|
|
615
|
+
err(11);
|
|
616
|
+
var d = compression ? deflateSync(file, p) : file, l = d.length;
|
|
617
|
+
var c = crc();
|
|
618
|
+
c.p(file);
|
|
619
|
+
files.push(mrg(p, {
|
|
620
|
+
size: file.length,
|
|
621
|
+
crc: c.d(),
|
|
622
|
+
c: d,
|
|
623
|
+
f,
|
|
624
|
+
m,
|
|
625
|
+
u: s != fn.length || m && com.length != ms,
|
|
626
|
+
o,
|
|
627
|
+
compression
|
|
628
|
+
}));
|
|
629
|
+
o += 30 + s + exl + l;
|
|
630
|
+
tot += 76 + 2 * (s + exl) + (ms || 0) + l;
|
|
631
|
+
}
|
|
632
|
+
var out = new u8(tot + 22), oe = o, cdl = tot - o;
|
|
633
|
+
for (var i2 = 0;i2 < files.length; ++i2) {
|
|
634
|
+
var f = files[i2];
|
|
635
|
+
wzh(out, f.o, f, f.f, f.u, f.c.length);
|
|
636
|
+
var badd = 30 + f.f.length + exfl(f.extra);
|
|
637
|
+
out.set(f.c, f.o + badd);
|
|
638
|
+
wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
|
|
639
|
+
}
|
|
640
|
+
wzf(out, o, files.length, cdl, oe);
|
|
641
|
+
return out;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// ../packager/packager-core/dist/index.js
|
|
645
|
+
class Path {
|
|
646
|
+
static normalize(path) {
|
|
647
|
+
return path.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
648
|
+
}
|
|
649
|
+
static join(...segments) {
|
|
650
|
+
return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
|
|
651
|
+
}
|
|
652
|
+
static dirname(path) {
|
|
653
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
654
|
+
if (normalized === "")
|
|
655
|
+
return ".";
|
|
656
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
657
|
+
if (lastSlash === -1)
|
|
658
|
+
return ".";
|
|
659
|
+
if (lastSlash === 0)
|
|
660
|
+
return "/";
|
|
661
|
+
return normalized.substring(0, lastSlash);
|
|
662
|
+
}
|
|
663
|
+
static basename(path) {
|
|
664
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
665
|
+
if (normalized === "")
|
|
666
|
+
return "";
|
|
667
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
668
|
+
return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
|
|
669
|
+
}
|
|
670
|
+
static extname(path) {
|
|
671
|
+
const base = Path.basename(path);
|
|
672
|
+
const lastDot = base.lastIndexOf(".");
|
|
673
|
+
if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
|
|
674
|
+
return "";
|
|
675
|
+
}
|
|
676
|
+
return base.substring(lastDot);
|
|
677
|
+
}
|
|
678
|
+
static async walkDirectory(fs, rootPath, currentRelativePath = "") {
|
|
679
|
+
const entries = [];
|
|
680
|
+
const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
|
|
681
|
+
const items = await fs.readdir(absolutePath);
|
|
682
|
+
for (const item of items) {
|
|
683
|
+
const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
|
|
684
|
+
const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
|
|
685
|
+
const stat = await fs.stat(itemAbsolutePath);
|
|
686
|
+
if (stat?.isDirectory()) {
|
|
687
|
+
const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
|
|
688
|
+
entries.push(...subEntries);
|
|
689
|
+
} else if (stat?.isFile()) {
|
|
690
|
+
entries.push({
|
|
691
|
+
relativePath: Path.normalize(itemRelativePath),
|
|
692
|
+
absolutePath: Path.normalize(itemAbsolutePath)
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return entries;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
class TemporaryStorageService {
|
|
701
|
+
fileSystem;
|
|
702
|
+
_tempFolderPath = null;
|
|
703
|
+
constructor(fileSystem) {
|
|
704
|
+
this.fileSystem = fileSystem;
|
|
705
|
+
}
|
|
706
|
+
async getTempFolderPath() {
|
|
707
|
+
if (!this._tempFolderPath) {
|
|
708
|
+
const systemTempDir = await this.fileSystem.getTempDir();
|
|
709
|
+
const uniqueFolderName = this.generateUniqueFolderName();
|
|
710
|
+
this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
|
|
711
|
+
await this.fileSystem.mkdir(this._tempFolderPath);
|
|
712
|
+
}
|
|
713
|
+
return this._tempFolderPath;
|
|
714
|
+
}
|
|
715
|
+
generateUniqueFolderName() {
|
|
716
|
+
const timestamp = Date.now();
|
|
717
|
+
const random = Math.random().toString(36).substring(2, 10);
|
|
718
|
+
return `tool-temp-${timestamp}-${random}`;
|
|
719
|
+
}
|
|
720
|
+
async getTempSubfolderPathAsync(subfolder) {
|
|
721
|
+
const tempFolderPath = await this.getTempFolderPath();
|
|
722
|
+
const inputPath = Path.join(tempFolderPath, subfolder);
|
|
723
|
+
await this.fileSystem.mkdir(inputPath);
|
|
724
|
+
return inputPath;
|
|
725
|
+
}
|
|
726
|
+
async cleanup() {
|
|
727
|
+
try {
|
|
728
|
+
if (!this._tempFolderPath) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
try {
|
|
732
|
+
const stats = await this.fileSystem.stat(this._tempFolderPath);
|
|
733
|
+
if (!stats) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
} catch {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const _pathToCleanup = this._tempFolderPath;
|
|
740
|
+
await this.fileSystem.rm(this._tempFolderPath);
|
|
741
|
+
this._tempFolderPath = null;
|
|
742
|
+
} catch {}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
function isPluralForm(value) {
|
|
746
|
+
return typeof value === "object" && value !== null && "other" in value;
|
|
747
|
+
}
|
|
748
|
+
function selectPluralForm(forms, count) {
|
|
749
|
+
if (count === 0 && forms.zero !== undefined) {
|
|
750
|
+
return forms.zero;
|
|
751
|
+
}
|
|
752
|
+
if (count === 1 && forms.one !== undefined) {
|
|
753
|
+
return forms.one;
|
|
754
|
+
}
|
|
755
|
+
if (count === 2 && forms.two !== undefined) {
|
|
756
|
+
return forms.two;
|
|
757
|
+
}
|
|
758
|
+
if (forms.few !== undefined) {
|
|
759
|
+
const mod10 = count % 10;
|
|
760
|
+
const mod100 = count % 100;
|
|
761
|
+
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
|
|
762
|
+
return forms.few;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (forms.many !== undefined) {
|
|
766
|
+
const mod10 = count % 10;
|
|
767
|
+
const mod100 = count % 100;
|
|
768
|
+
if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
|
|
769
|
+
return forms.many;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
return forms.other;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
class I18nManager {
|
|
776
|
+
static translations = {};
|
|
777
|
+
static currentLocale = "en";
|
|
778
|
+
static fallbackLocale = "en";
|
|
779
|
+
static registerTranslations(locale, catalog) {
|
|
780
|
+
if (!I18nManager.translations[locale]) {
|
|
781
|
+
I18nManager.translations[locale] = {};
|
|
782
|
+
}
|
|
783
|
+
I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
|
|
784
|
+
}
|
|
785
|
+
static setLocale(locale) {
|
|
786
|
+
const normalized = I18nManager.normalizeLocale(locale);
|
|
787
|
+
if (I18nManager.translations[normalized]) {
|
|
788
|
+
I18nManager.currentLocale = normalized;
|
|
789
|
+
return normalized;
|
|
790
|
+
}
|
|
791
|
+
const baseLocale = normalized.split("-")[0];
|
|
792
|
+
if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
|
|
793
|
+
I18nManager.currentLocale = baseLocale;
|
|
794
|
+
return baseLocale;
|
|
795
|
+
}
|
|
796
|
+
return I18nManager.currentLocale;
|
|
797
|
+
}
|
|
798
|
+
static getLocale() {
|
|
799
|
+
return I18nManager.currentLocale;
|
|
800
|
+
}
|
|
801
|
+
static setFallbackLocale(locale) {
|
|
802
|
+
I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
|
|
803
|
+
}
|
|
804
|
+
static t(key, params, locale) {
|
|
805
|
+
const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
|
|
806
|
+
let value = I18nManager.getTranslationValue(key, targetLocale);
|
|
807
|
+
if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
|
|
808
|
+
value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
|
|
809
|
+
}
|
|
810
|
+
if (value === undefined) {
|
|
811
|
+
return key;
|
|
812
|
+
}
|
|
813
|
+
if (isPluralForm(value) && params && "count" in params) {
|
|
814
|
+
const count = typeof params.count === "number" ? params.count : Number(params.count);
|
|
815
|
+
value = selectPluralForm(value, count);
|
|
816
|
+
} else if (isPluralForm(value)) {
|
|
817
|
+
value = value.other;
|
|
818
|
+
}
|
|
819
|
+
if (typeof value !== "string") {
|
|
820
|
+
return key;
|
|
821
|
+
}
|
|
822
|
+
return params ? I18nManager.interpolate(value, params) : value;
|
|
823
|
+
}
|
|
824
|
+
static has(key, locale) {
|
|
825
|
+
const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
|
|
826
|
+
const value = I18nManager.getTranslationValue(key, targetLocale);
|
|
827
|
+
if (value !== undefined) {
|
|
828
|
+
return true;
|
|
829
|
+
}
|
|
830
|
+
if (targetLocale !== I18nManager.fallbackLocale) {
|
|
831
|
+
return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
|
|
832
|
+
}
|
|
833
|
+
return false;
|
|
834
|
+
}
|
|
835
|
+
static getAvailableLocales() {
|
|
836
|
+
return Object.keys(I18nManager.translations);
|
|
837
|
+
}
|
|
838
|
+
static clearTranslations() {
|
|
839
|
+
I18nManager.translations = {};
|
|
840
|
+
I18nManager.currentLocale = "en";
|
|
841
|
+
}
|
|
842
|
+
static getTranslationValue(key, locale) {
|
|
843
|
+
const catalog = I18nManager.translations[locale];
|
|
844
|
+
if (!catalog) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
const keys = key.split(".");
|
|
848
|
+
let value = catalog;
|
|
849
|
+
for (const k of keys) {
|
|
850
|
+
if (value && typeof value === "object" && k in value) {
|
|
851
|
+
value = value[k];
|
|
852
|
+
} else {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return value;
|
|
857
|
+
}
|
|
858
|
+
static interpolate(template, params) {
|
|
859
|
+
return template.replace(/\{(\w+)\}/g, (_, key) => {
|
|
860
|
+
const value = params[key];
|
|
861
|
+
return value !== undefined ? String(value) : `{${key}}`;
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
static normalizeLocale(locale) {
|
|
865
|
+
const normalized = locale.toLowerCase().replace(/_/g, "-");
|
|
866
|
+
const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
|
|
867
|
+
if (specialLocales.includes(normalized)) {
|
|
868
|
+
return normalized;
|
|
869
|
+
}
|
|
870
|
+
return normalized.split("-")[0];
|
|
871
|
+
}
|
|
872
|
+
static deepMerge(target, source) {
|
|
873
|
+
const result = { ...target };
|
|
874
|
+
for (const key of Object.keys(source)) {
|
|
875
|
+
const sourceValue = source[key];
|
|
876
|
+
const targetValue = result[key];
|
|
877
|
+
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
|
|
878
|
+
result[key] = I18nManager.deepMerge(targetValue, sourceValue);
|
|
879
|
+
} else {
|
|
880
|
+
result[key] = sourceValue;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return result;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
var de = {
|
|
887
|
+
toolCore: {
|
|
888
|
+
errors: {
|
|
889
|
+
internal: "Internal error: {message}",
|
|
890
|
+
fileNotFound: "File not found: {path}",
|
|
891
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
892
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
893
|
+
directoryNotFound: "Directory not found: {path}",
|
|
894
|
+
invalidPath: "{path} is not a valid path",
|
|
895
|
+
operationCanceled: "Operation was canceled",
|
|
896
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
897
|
+
},
|
|
898
|
+
progress: {
|
|
899
|
+
copying: "Copying files...",
|
|
900
|
+
building: "Building project...",
|
|
901
|
+
packaging: "Creating package...",
|
|
902
|
+
validating: "Validating...",
|
|
903
|
+
analyzing: "Analyzing...",
|
|
904
|
+
restoring: "Restoring dependencies..."
|
|
905
|
+
},
|
|
906
|
+
validation: {
|
|
907
|
+
requiredField: "{field} is required",
|
|
908
|
+
invalidValue: "Invalid value for {field}",
|
|
909
|
+
pathNotFound: "Path not found: {path}",
|
|
910
|
+
fileRequired: "File is required: {path}",
|
|
911
|
+
directoryRequired: "Directory is required: {path}"
|
|
912
|
+
},
|
|
913
|
+
warnings: {
|
|
914
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
915
|
+
},
|
|
916
|
+
info: {
|
|
917
|
+
operationComplete: "Operation completed successfully",
|
|
918
|
+
filesProcessed: {
|
|
919
|
+
zero: "No files processed",
|
|
920
|
+
one: "{count} file processed",
|
|
921
|
+
other: "{count} files processed"
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
var en = {
|
|
927
|
+
toolCore: {
|
|
928
|
+
errors: {
|
|
929
|
+
internal: "Internal error: {message}",
|
|
930
|
+
fileNotFound: "File not found: {path}",
|
|
931
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
932
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
933
|
+
directoryNotFound: "Directory not found: {path}",
|
|
934
|
+
invalidPath: "{path} is not a valid path",
|
|
935
|
+
operationCanceled: "Operation was canceled",
|
|
936
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
937
|
+
},
|
|
938
|
+
progress: {
|
|
939
|
+
copying: "Copying files...",
|
|
940
|
+
building: "Building project...",
|
|
941
|
+
packaging: "Creating package...",
|
|
942
|
+
validating: "Validating...",
|
|
943
|
+
analyzing: "Analyzing...",
|
|
944
|
+
restoring: "Restoring dependencies..."
|
|
945
|
+
},
|
|
946
|
+
validation: {
|
|
947
|
+
requiredField: "{field} is required",
|
|
948
|
+
invalidValue: "Invalid value for {field}",
|
|
949
|
+
pathNotFound: "Path not found: {path}",
|
|
950
|
+
fileRequired: "File is required: {path}",
|
|
951
|
+
directoryRequired: "Directory is required: {path}"
|
|
952
|
+
},
|
|
953
|
+
warnings: {
|
|
954
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
955
|
+
},
|
|
956
|
+
info: {
|
|
957
|
+
operationComplete: "Operation completed successfully",
|
|
958
|
+
filesProcessed: {
|
|
959
|
+
zero: "No files processed",
|
|
960
|
+
one: "{count} file processed",
|
|
961
|
+
other: "{count} files processed"
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
var es = {
|
|
967
|
+
toolCore: {
|
|
968
|
+
errors: {
|
|
969
|
+
internal: "Internal error: {message}",
|
|
970
|
+
fileNotFound: "File not found: {path}",
|
|
971
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
972
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
973
|
+
directoryNotFound: "Directory not found: {path}",
|
|
974
|
+
invalidPath: "{path} is not a valid path",
|
|
975
|
+
operationCanceled: "Operation was canceled",
|
|
976
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
977
|
+
},
|
|
978
|
+
progress: {
|
|
979
|
+
copying: "Copying files...",
|
|
980
|
+
building: "Building project...",
|
|
981
|
+
packaging: "Creating package...",
|
|
982
|
+
validating: "Validating...",
|
|
983
|
+
analyzing: "Analyzing...",
|
|
984
|
+
restoring: "Restoring dependencies..."
|
|
985
|
+
},
|
|
986
|
+
validation: {
|
|
987
|
+
requiredField: "{field} is required",
|
|
988
|
+
invalidValue: "Invalid value for {field}",
|
|
989
|
+
pathNotFound: "Path not found: {path}",
|
|
990
|
+
fileRequired: "File is required: {path}",
|
|
991
|
+
directoryRequired: "Directory is required: {path}"
|
|
992
|
+
},
|
|
993
|
+
warnings: {
|
|
994
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
995
|
+
},
|
|
996
|
+
info: {
|
|
997
|
+
operationComplete: "Operation completed successfully",
|
|
998
|
+
filesProcessed: {
|
|
999
|
+
zero: "No files processed",
|
|
1000
|
+
one: "{count} file processed",
|
|
1001
|
+
other: "{count} files processed"
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
var es_MX = {
|
|
1007
|
+
toolCore: {
|
|
1008
|
+
errors: {
|
|
1009
|
+
internal: "Internal error: {message}",
|
|
1010
|
+
fileNotFound: "File not found: {path}",
|
|
1011
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1012
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1013
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1014
|
+
invalidPath: "{path} is not a valid path",
|
|
1015
|
+
operationCanceled: "Operation was canceled",
|
|
1016
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1017
|
+
},
|
|
1018
|
+
progress: {
|
|
1019
|
+
copying: "Copying files...",
|
|
1020
|
+
building: "Building project...",
|
|
1021
|
+
packaging: "Creating package...",
|
|
1022
|
+
validating: "Validating...",
|
|
1023
|
+
analyzing: "Analyzing...",
|
|
1024
|
+
restoring: "Restoring dependencies..."
|
|
1025
|
+
},
|
|
1026
|
+
validation: {
|
|
1027
|
+
requiredField: "{field} is required",
|
|
1028
|
+
invalidValue: "Invalid value for {field}",
|
|
1029
|
+
pathNotFound: "Path not found: {path}",
|
|
1030
|
+
fileRequired: "File is required: {path}",
|
|
1031
|
+
directoryRequired: "Directory is required: {path}"
|
|
1032
|
+
},
|
|
1033
|
+
warnings: {
|
|
1034
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1035
|
+
},
|
|
1036
|
+
info: {
|
|
1037
|
+
operationComplete: "Operation completed successfully",
|
|
1038
|
+
filesProcessed: {
|
|
1039
|
+
zero: "No files processed",
|
|
1040
|
+
one: "{count} file processed",
|
|
1041
|
+
other: "{count} files processed"
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
var fr = {
|
|
1047
|
+
toolCore: {
|
|
1048
|
+
errors: {
|
|
1049
|
+
internal: "Internal error: {message}",
|
|
1050
|
+
fileNotFound: "File not found: {path}",
|
|
1051
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1052
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1053
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1054
|
+
invalidPath: "{path} is not a valid path",
|
|
1055
|
+
operationCanceled: "Operation was canceled",
|
|
1056
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1057
|
+
},
|
|
1058
|
+
progress: {
|
|
1059
|
+
copying: "Copying files...",
|
|
1060
|
+
building: "Building project...",
|
|
1061
|
+
packaging: "Creating package...",
|
|
1062
|
+
validating: "Validating...",
|
|
1063
|
+
analyzing: "Analyzing...",
|
|
1064
|
+
restoring: "Restoring dependencies..."
|
|
1065
|
+
},
|
|
1066
|
+
validation: {
|
|
1067
|
+
requiredField: "{field} is required",
|
|
1068
|
+
invalidValue: "Invalid value for {field}",
|
|
1069
|
+
pathNotFound: "Path not found: {path}",
|
|
1070
|
+
fileRequired: "File is required: {path}",
|
|
1071
|
+
directoryRequired: "Directory is required: {path}"
|
|
1072
|
+
},
|
|
1073
|
+
warnings: {
|
|
1074
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1075
|
+
},
|
|
1076
|
+
info: {
|
|
1077
|
+
operationComplete: "Operation completed successfully",
|
|
1078
|
+
filesProcessed: {
|
|
1079
|
+
zero: "No files processed",
|
|
1080
|
+
one: "{count} file processed",
|
|
1081
|
+
other: "{count} files processed"
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
var ja = {
|
|
1087
|
+
toolCore: {
|
|
1088
|
+
errors: {
|
|
1089
|
+
internal: "Internal error: {message}",
|
|
1090
|
+
fileNotFound: "File not found: {path}",
|
|
1091
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1092
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1093
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1094
|
+
invalidPath: "{path} is not a valid path",
|
|
1095
|
+
operationCanceled: "Operation was canceled",
|
|
1096
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1097
|
+
},
|
|
1098
|
+
progress: {
|
|
1099
|
+
copying: "Copying files...",
|
|
1100
|
+
building: "Building project...",
|
|
1101
|
+
packaging: "Creating package...",
|
|
1102
|
+
validating: "Validating...",
|
|
1103
|
+
analyzing: "Analyzing...",
|
|
1104
|
+
restoring: "Restoring dependencies..."
|
|
1105
|
+
},
|
|
1106
|
+
validation: {
|
|
1107
|
+
requiredField: "{field} is required",
|
|
1108
|
+
invalidValue: "Invalid value for {field}",
|
|
1109
|
+
pathNotFound: "Path not found: {path}",
|
|
1110
|
+
fileRequired: "File is required: {path}",
|
|
1111
|
+
directoryRequired: "Directory is required: {path}"
|
|
1112
|
+
},
|
|
1113
|
+
warnings: {
|
|
1114
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1115
|
+
},
|
|
1116
|
+
info: {
|
|
1117
|
+
operationComplete: "Operation completed successfully",
|
|
1118
|
+
filesProcessed: {
|
|
1119
|
+
zero: "No files processed",
|
|
1120
|
+
one: "{count} file processed",
|
|
1121
|
+
other: "{count} files processed"
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
var ko = {
|
|
1127
|
+
toolCore: {
|
|
1128
|
+
errors: {
|
|
1129
|
+
internal: "Internal error: {message}",
|
|
1130
|
+
fileNotFound: "File not found: {path}",
|
|
1131
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1132
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1133
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1134
|
+
invalidPath: "{path} is not a valid path",
|
|
1135
|
+
operationCanceled: "Operation was canceled",
|
|
1136
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1137
|
+
},
|
|
1138
|
+
progress: {
|
|
1139
|
+
copying: "Copying files...",
|
|
1140
|
+
building: "Building project...",
|
|
1141
|
+
packaging: "Creating package...",
|
|
1142
|
+
validating: "Validating...",
|
|
1143
|
+
analyzing: "Analyzing...",
|
|
1144
|
+
restoring: "Restoring dependencies..."
|
|
1145
|
+
},
|
|
1146
|
+
validation: {
|
|
1147
|
+
requiredField: "{field} is required",
|
|
1148
|
+
invalidValue: "Invalid value for {field}",
|
|
1149
|
+
pathNotFound: "Path not found: {path}",
|
|
1150
|
+
fileRequired: "File is required: {path}",
|
|
1151
|
+
directoryRequired: "Directory is required: {path}"
|
|
1152
|
+
},
|
|
1153
|
+
warnings: {
|
|
1154
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1155
|
+
},
|
|
1156
|
+
info: {
|
|
1157
|
+
operationComplete: "Operation completed successfully",
|
|
1158
|
+
filesProcessed: {
|
|
1159
|
+
zero: "No files processed",
|
|
1160
|
+
one: "{count} file processed",
|
|
1161
|
+
other: "{count} files processed"
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
var pt = {
|
|
1167
|
+
toolCore: {
|
|
1168
|
+
errors: {
|
|
1169
|
+
internal: "Internal error: {message}",
|
|
1170
|
+
fileNotFound: "File not found: {path}",
|
|
1171
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1172
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1173
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1174
|
+
invalidPath: "{path} is not a valid path",
|
|
1175
|
+
operationCanceled: "Operation was canceled",
|
|
1176
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1177
|
+
},
|
|
1178
|
+
progress: {
|
|
1179
|
+
copying: "Copying files...",
|
|
1180
|
+
building: "Building project...",
|
|
1181
|
+
packaging: "Creating package...",
|
|
1182
|
+
validating: "Validating...",
|
|
1183
|
+
analyzing: "Analyzing...",
|
|
1184
|
+
restoring: "Restoring dependencies..."
|
|
1185
|
+
},
|
|
1186
|
+
validation: {
|
|
1187
|
+
requiredField: "{field} is required",
|
|
1188
|
+
invalidValue: "Invalid value for {field}",
|
|
1189
|
+
pathNotFound: "Path not found: {path}",
|
|
1190
|
+
fileRequired: "File is required: {path}",
|
|
1191
|
+
directoryRequired: "Directory is required: {path}"
|
|
1192
|
+
},
|
|
1193
|
+
warnings: {
|
|
1194
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1195
|
+
},
|
|
1196
|
+
info: {
|
|
1197
|
+
operationComplete: "Operation completed successfully",
|
|
1198
|
+
filesProcessed: {
|
|
1199
|
+
zero: "No files processed",
|
|
1200
|
+
one: "{count} file processed",
|
|
1201
|
+
other: "{count} files processed"
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
var pt_BR = {
|
|
1207
|
+
toolCore: {
|
|
1208
|
+
errors: {
|
|
1209
|
+
internal: "Internal error: {message}",
|
|
1210
|
+
fileNotFound: "File not found: {path}",
|
|
1211
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1212
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1213
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1214
|
+
invalidPath: "{path} is not a valid path",
|
|
1215
|
+
operationCanceled: "Operation was canceled",
|
|
1216
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1217
|
+
},
|
|
1218
|
+
progress: {
|
|
1219
|
+
copying: "Copying files...",
|
|
1220
|
+
building: "Building project...",
|
|
1221
|
+
packaging: "Creating package...",
|
|
1222
|
+
validating: "Validating...",
|
|
1223
|
+
analyzing: "Analyzing...",
|
|
1224
|
+
restoring: "Restoring dependencies..."
|
|
1225
|
+
},
|
|
1226
|
+
validation: {
|
|
1227
|
+
requiredField: "{field} is required",
|
|
1228
|
+
invalidValue: "Invalid value for {field}",
|
|
1229
|
+
pathNotFound: "Path not found: {path}",
|
|
1230
|
+
fileRequired: "File is required: {path}",
|
|
1231
|
+
directoryRequired: "Directory is required: {path}"
|
|
1232
|
+
},
|
|
1233
|
+
warnings: {
|
|
1234
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1235
|
+
},
|
|
1236
|
+
info: {
|
|
1237
|
+
operationComplete: "Operation completed successfully",
|
|
1238
|
+
filesProcessed: {
|
|
1239
|
+
zero: "No files processed",
|
|
1240
|
+
one: "{count} file processed",
|
|
1241
|
+
other: "{count} files processed"
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
var ro = {
|
|
1247
|
+
toolCore: {
|
|
1248
|
+
errors: {
|
|
1249
|
+
internal: "Internal error: {message}",
|
|
1250
|
+
fileNotFound: "File not found: {path}",
|
|
1251
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1252
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1253
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1254
|
+
invalidPath: "{path} is not a valid path",
|
|
1255
|
+
operationCanceled: "Operation was canceled",
|
|
1256
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1257
|
+
},
|
|
1258
|
+
progress: {
|
|
1259
|
+
copying: "Copying files...",
|
|
1260
|
+
building: "Building project...",
|
|
1261
|
+
packaging: "Creating package...",
|
|
1262
|
+
validating: "Validating...",
|
|
1263
|
+
analyzing: "Analyzing...",
|
|
1264
|
+
restoring: "Restoring dependencies..."
|
|
1265
|
+
},
|
|
1266
|
+
validation: {
|
|
1267
|
+
requiredField: "{field} is required",
|
|
1268
|
+
invalidValue: "Invalid value for {field}",
|
|
1269
|
+
pathNotFound: "Path not found: {path}",
|
|
1270
|
+
fileRequired: "File is required: {path}",
|
|
1271
|
+
directoryRequired: "Directory is required: {path}"
|
|
1272
|
+
},
|
|
1273
|
+
warnings: {
|
|
1274
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1275
|
+
},
|
|
1276
|
+
info: {
|
|
1277
|
+
operationComplete: "Operation completed successfully",
|
|
1278
|
+
filesProcessed: {
|
|
1279
|
+
zero: "No files processed",
|
|
1280
|
+
one: "{count} file processed",
|
|
1281
|
+
other: "{count} files processed"
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
var ru = {
|
|
1287
|
+
toolCore: {
|
|
1288
|
+
errors: {
|
|
1289
|
+
internal: "Internal error: {message}",
|
|
1290
|
+
fileNotFound: "File not found: {path}",
|
|
1291
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1292
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1293
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1294
|
+
invalidPath: "{path} is not a valid path",
|
|
1295
|
+
operationCanceled: "Operation was canceled",
|
|
1296
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1297
|
+
},
|
|
1298
|
+
progress: {
|
|
1299
|
+
copying: "Copying files...",
|
|
1300
|
+
building: "Building project...",
|
|
1301
|
+
packaging: "Creating package...",
|
|
1302
|
+
validating: "Validating...",
|
|
1303
|
+
analyzing: "Analyzing...",
|
|
1304
|
+
restoring: "Restoring dependencies..."
|
|
1305
|
+
},
|
|
1306
|
+
validation: {
|
|
1307
|
+
requiredField: "{field} is required",
|
|
1308
|
+
invalidValue: "Invalid value for {field}",
|
|
1309
|
+
pathNotFound: "Path not found: {path}",
|
|
1310
|
+
fileRequired: "File is required: {path}",
|
|
1311
|
+
directoryRequired: "Directory is required: {path}"
|
|
1312
|
+
},
|
|
1313
|
+
warnings: {
|
|
1314
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1315
|
+
},
|
|
1316
|
+
info: {
|
|
1317
|
+
operationComplete: "Operation completed successfully",
|
|
1318
|
+
filesProcessed: {
|
|
1319
|
+
zero: "No files processed",
|
|
1320
|
+
one: "{count} file processed",
|
|
1321
|
+
other: "{count} files processed"
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
var tr = {
|
|
1327
|
+
toolCore: {
|
|
1328
|
+
errors: {
|
|
1329
|
+
internal: "Internal error: {message}",
|
|
1330
|
+
fileNotFound: "File not found: {path}",
|
|
1331
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1332
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1333
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1334
|
+
invalidPath: "{path} is not a valid path",
|
|
1335
|
+
operationCanceled: "Operation was canceled",
|
|
1336
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1337
|
+
},
|
|
1338
|
+
progress: {
|
|
1339
|
+
copying: "Copying files...",
|
|
1340
|
+
building: "Building project...",
|
|
1341
|
+
packaging: "Creating package...",
|
|
1342
|
+
validating: "Validating...",
|
|
1343
|
+
analyzing: "Analyzing...",
|
|
1344
|
+
restoring: "Restoring dependencies..."
|
|
1345
|
+
},
|
|
1346
|
+
validation: {
|
|
1347
|
+
requiredField: "{field} is required",
|
|
1348
|
+
invalidValue: "Invalid value for {field}",
|
|
1349
|
+
pathNotFound: "Path not found: {path}",
|
|
1350
|
+
fileRequired: "File is required: {path}",
|
|
1351
|
+
directoryRequired: "Directory is required: {path}"
|
|
1352
|
+
},
|
|
1353
|
+
warnings: {
|
|
1354
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1355
|
+
},
|
|
1356
|
+
info: {
|
|
1357
|
+
operationComplete: "Operation completed successfully",
|
|
1358
|
+
filesProcessed: {
|
|
1359
|
+
zero: "No files processed",
|
|
1360
|
+
one: "{count} file processed",
|
|
1361
|
+
other: "{count} files processed"
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
var zh_CN = {
|
|
1367
|
+
toolCore: {
|
|
1368
|
+
errors: {
|
|
1369
|
+
internal: "Internal error: {message}",
|
|
1370
|
+
fileNotFound: "File not found: {path}",
|
|
1371
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1372
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1373
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1374
|
+
invalidPath: "{path} is not a valid path",
|
|
1375
|
+
operationCanceled: "Operation was canceled",
|
|
1376
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1377
|
+
},
|
|
1378
|
+
progress: {
|
|
1379
|
+
copying: "Copying files...",
|
|
1380
|
+
building: "Building project...",
|
|
1381
|
+
packaging: "Creating package...",
|
|
1382
|
+
validating: "Validating...",
|
|
1383
|
+
analyzing: "Analyzing...",
|
|
1384
|
+
restoring: "Restoring dependencies..."
|
|
1385
|
+
},
|
|
1386
|
+
validation: {
|
|
1387
|
+
requiredField: "{field} is required",
|
|
1388
|
+
invalidValue: "Invalid value for {field}",
|
|
1389
|
+
pathNotFound: "Path not found: {path}",
|
|
1390
|
+
fileRequired: "File is required: {path}",
|
|
1391
|
+
directoryRequired: "Directory is required: {path}"
|
|
1392
|
+
},
|
|
1393
|
+
warnings: {
|
|
1394
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1395
|
+
},
|
|
1396
|
+
info: {
|
|
1397
|
+
operationComplete: "Operation completed successfully",
|
|
1398
|
+
filesProcessed: {
|
|
1399
|
+
zero: "No files processed",
|
|
1400
|
+
one: "{count} file processed",
|
|
1401
|
+
other: "{count} files processed"
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
var zh_TW = {
|
|
1407
|
+
toolCore: {
|
|
1408
|
+
errors: {
|
|
1409
|
+
internal: "Internal error: {message}",
|
|
1410
|
+
fileNotFound: "File not found: {path}",
|
|
1411
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1412
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1413
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1414
|
+
invalidPath: "{path} is not a valid path",
|
|
1415
|
+
operationCanceled: "Operation was canceled",
|
|
1416
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1417
|
+
},
|
|
1418
|
+
progress: {
|
|
1419
|
+
copying: "Copying files...",
|
|
1420
|
+
building: "Building project...",
|
|
1421
|
+
packaging: "Creating package...",
|
|
1422
|
+
validating: "Validating...",
|
|
1423
|
+
analyzing: "Analyzing...",
|
|
1424
|
+
restoring: "Restoring dependencies..."
|
|
1425
|
+
},
|
|
1426
|
+
validation: {
|
|
1427
|
+
requiredField: "{field} is required",
|
|
1428
|
+
invalidValue: "Invalid value for {field}",
|
|
1429
|
+
pathNotFound: "Path not found: {path}",
|
|
1430
|
+
fileRequired: "File is required: {path}",
|
|
1431
|
+
directoryRequired: "Directory is required: {path}"
|
|
1432
|
+
},
|
|
1433
|
+
warnings: {
|
|
1434
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1435
|
+
},
|
|
1436
|
+
info: {
|
|
1437
|
+
operationComplete: "Operation completed successfully",
|
|
1438
|
+
filesProcessed: {
|
|
1439
|
+
zero: "No files processed",
|
|
1440
|
+
one: "{count} file processed",
|
|
1441
|
+
other: "{count} files processed"
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
var zu = {
|
|
1447
|
+
toolCore: {
|
|
1448
|
+
errors: {
|
|
1449
|
+
internal: "Internal error: {message}",
|
|
1450
|
+
fileNotFound: "File not found: {path}",
|
|
1451
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
1452
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
1453
|
+
directoryNotFound: "Directory not found: {path}",
|
|
1454
|
+
invalidPath: "{path} is not a valid path",
|
|
1455
|
+
operationCanceled: "Operation was canceled",
|
|
1456
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
1457
|
+
},
|
|
1458
|
+
progress: {
|
|
1459
|
+
copying: "Copying files...",
|
|
1460
|
+
building: "Building project...",
|
|
1461
|
+
packaging: "Creating package...",
|
|
1462
|
+
validating: "Validating...",
|
|
1463
|
+
analyzing: "Analyzing...",
|
|
1464
|
+
restoring: "Restoring dependencies..."
|
|
1465
|
+
},
|
|
1466
|
+
validation: {
|
|
1467
|
+
requiredField: "{field} is required",
|
|
1468
|
+
invalidValue: "Invalid value for {field}",
|
|
1469
|
+
pathNotFound: "Path not found: {path}",
|
|
1470
|
+
fileRequired: "File is required: {path}",
|
|
1471
|
+
directoryRequired: "Directory is required: {path}"
|
|
1472
|
+
},
|
|
1473
|
+
warnings: {
|
|
1474
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
1475
|
+
},
|
|
1476
|
+
info: {
|
|
1477
|
+
operationComplete: "Operation completed successfully",
|
|
1478
|
+
filesProcessed: {
|
|
1479
|
+
zero: "No files processed",
|
|
1480
|
+
one: "{count} file processed",
|
|
1481
|
+
other: "{count} files processed"
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
class TranslationService {
|
|
1488
|
+
static instance;
|
|
1489
|
+
currentLocale = "en";
|
|
1490
|
+
constructor() {}
|
|
1491
|
+
static getInstance() {
|
|
1492
|
+
if (!TranslationService.instance) {
|
|
1493
|
+
TranslationService.instance = new TranslationService;
|
|
1494
|
+
}
|
|
1495
|
+
return TranslationService.instance;
|
|
1496
|
+
}
|
|
1497
|
+
setLocale(locale) {
|
|
1498
|
+
this.currentLocale = I18nManager.setLocale(locale);
|
|
1499
|
+
}
|
|
1500
|
+
getLocale() {
|
|
1501
|
+
return this.currentLocale;
|
|
1502
|
+
}
|
|
1503
|
+
t(key, params) {
|
|
1504
|
+
return I18nManager.t(key, params, this.currentLocale);
|
|
1505
|
+
}
|
|
1506
|
+
tLocale(key, locale, params) {
|
|
1507
|
+
return I18nManager.t(key, params, locale);
|
|
1508
|
+
}
|
|
1509
|
+
has(key) {
|
|
1510
|
+
return I18nManager.has(key, this.currentLocale);
|
|
1511
|
+
}
|
|
1512
|
+
getAvailableLocales() {
|
|
1513
|
+
return I18nManager.getAvailableLocales();
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
var translate = TranslationService.getInstance();
|
|
1517
|
+
I18nManager.registerTranslations("en", en);
|
|
1518
|
+
I18nManager.registerTranslations("de", de);
|
|
1519
|
+
I18nManager.registerTranslations("es", es);
|
|
1520
|
+
I18nManager.registerTranslations("es-mx", es_MX);
|
|
1521
|
+
I18nManager.registerTranslations("fr", fr);
|
|
1522
|
+
I18nManager.registerTranslations("ja", ja);
|
|
1523
|
+
I18nManager.registerTranslations("ko", ko);
|
|
1524
|
+
I18nManager.registerTranslations("pt", pt);
|
|
1525
|
+
I18nManager.registerTranslations("pt-br", pt_BR);
|
|
1526
|
+
I18nManager.registerTranslations("ro", ro);
|
|
1527
|
+
I18nManager.registerTranslations("ru", ru);
|
|
1528
|
+
I18nManager.registerTranslations("tr", tr);
|
|
1529
|
+
I18nManager.registerTranslations("zh-cn", zh_CN);
|
|
1530
|
+
I18nManager.registerTranslations("zh-tw", zh_TW);
|
|
1531
|
+
I18nManager.registerTranslations("zu", zu);
|
|
1532
|
+
I18nManager.setLocale("en");
|
|
1533
|
+
var BuildConfiguration;
|
|
1534
|
+
((BuildConfiguration2) => {
|
|
1535
|
+
BuildConfiguration2["Debug"] = "Debug";
|
|
1536
|
+
BuildConfiguration2["Release"] = "Release";
|
|
1537
|
+
})(BuildConfiguration ||= {});
|
|
1538
|
+
var LogLevel;
|
|
1539
|
+
((LogLevel2) => {
|
|
1540
|
+
LogLevel2["Debug"] = "Debug";
|
|
1541
|
+
LogLevel2["Info"] = "Information";
|
|
1542
|
+
LogLevel2["Warn"] = "Warning";
|
|
1543
|
+
LogLevel2["Error"] = "Error";
|
|
1544
|
+
})(LogLevel ||= {});
|
|
1545
|
+
var NugetConstants = {
|
|
1546
|
+
OutputFolderName: "bundle",
|
|
1547
|
+
ContentFolderName: "content",
|
|
1548
|
+
OperateFileName: "operate.json",
|
|
1549
|
+
EntryPointsFileName: "entry-points.json",
|
|
1550
|
+
PackageDescriptorFileName: "package-descriptor.json",
|
|
1551
|
+
BindingsV2FileName: "bindings_v2.json",
|
|
1552
|
+
BindingsFileId: "bindings.json"
|
|
1553
|
+
};
|
|
1554
|
+
var ProjectTypes;
|
|
1555
|
+
((ProjectTypes2) => {
|
|
1556
|
+
ProjectTypes2["Agent"] = "Agent";
|
|
1557
|
+
ProjectTypes2["Api"] = "Api";
|
|
1558
|
+
ProjectTypes2["Connector"] = "Connector";
|
|
1559
|
+
ProjectTypes2["CaseManagement"] = "CaseManagement";
|
|
1560
|
+
ProjectTypes2["Flow"] = "Flow";
|
|
1561
|
+
ProjectTypes2["Function"] = "Function";
|
|
1562
|
+
ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
|
|
1563
|
+
ProjectTypes2["Process"] = "Process";
|
|
1564
|
+
ProjectTypes2["Library"] = "Library";
|
|
1565
|
+
ProjectTypes2["WebApp"] = "WebApp";
|
|
1566
|
+
ProjectTypes2["Tests"] = "Tests";
|
|
1567
|
+
ProjectTypes2["AppV2"] = "AppV2";
|
|
1568
|
+
})(ProjectTypes ||= {});
|
|
1569
|
+
var TargetFramework;
|
|
1570
|
+
((TargetFramework2) => {
|
|
1571
|
+
TargetFramework2["Portable"] = "Portable";
|
|
1572
|
+
TargetFramework2["Windows"] = "Windows";
|
|
1573
|
+
})(TargetFramework ||= {});
|
|
1574
|
+
var ToolErrorCodes;
|
|
1575
|
+
((ToolErrorCodes2) => {
|
|
1576
|
+
ToolErrorCodes2["Success"] = "SUCCESS";
|
|
1577
|
+
ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
|
|
1578
|
+
ToolErrorCodes2["Canceled"] = "CANCELED";
|
|
1579
|
+
})(ToolErrorCodes ||= {});
|
|
1580
|
+
|
|
1581
|
+
class ToolResult {
|
|
1582
|
+
errorCode;
|
|
1583
|
+
message;
|
|
1584
|
+
packages;
|
|
1585
|
+
details;
|
|
1586
|
+
constructor(errorCode, message, packages = []) {
|
|
1587
|
+
this.errorCode = errorCode;
|
|
1588
|
+
this.message = message;
|
|
1589
|
+
this.packages = packages;
|
|
1590
|
+
}
|
|
1591
|
+
get isSuccess() {
|
|
1592
|
+
return this.errorCode === "SUCCESS";
|
|
1593
|
+
}
|
|
1594
|
+
static success() {
|
|
1595
|
+
return new ToolResult("SUCCESS");
|
|
1596
|
+
}
|
|
1597
|
+
static error(errorCode, message) {
|
|
1598
|
+
return new ToolResult(errorCode, message);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
var OPERATE_FILE = "operate.json";
|
|
1602
|
+
var PROJECT_FILE = "project.json";
|
|
1603
|
+
function isNonEmptyString(value) {
|
|
1604
|
+
return typeof value === "string" && value.length > 0;
|
|
1605
|
+
}
|
|
1606
|
+
async function readJsonObject(fs, filePath) {
|
|
1607
|
+
let content;
|
|
1608
|
+
try {
|
|
1609
|
+
content = await fs.readFile(filePath, "utf-8");
|
|
1610
|
+
} catch {
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
if (content === null) {
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
try {
|
|
1617
|
+
const parsed = JSON.parse(content);
|
|
1618
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
return parsed;
|
|
1622
|
+
} catch {
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
async function writeJsonObject(fs, filePath, data) {
|
|
1627
|
+
await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
|
|
1628
|
+
`);
|
|
1629
|
+
}
|
|
1630
|
+
async function ensureProjectId(projectPath, fs) {
|
|
1631
|
+
const operatePath = Path.join(projectPath, OPERATE_FILE);
|
|
1632
|
+
const operateExists = await fs.exists(operatePath);
|
|
1633
|
+
if (operateExists) {
|
|
1634
|
+
const operate = await readJsonObject(fs, operatePath);
|
|
1635
|
+
if (operate && isNonEmptyString(operate.projectId)) {
|
|
1636
|
+
return operate.projectId;
|
|
1637
|
+
}
|
|
1638
|
+
if (operate) {
|
|
1639
|
+
const id = crypto.randomUUID();
|
|
1640
|
+
await writeJsonObject(fs, operatePath, {
|
|
1641
|
+
...operate,
|
|
1642
|
+
projectId: id
|
|
1643
|
+
});
|
|
1644
|
+
return id;
|
|
1645
|
+
}
|
|
1646
|
+
return crypto.randomUUID();
|
|
1647
|
+
}
|
|
1648
|
+
const projectFilePath = Path.join(projectPath, PROJECT_FILE);
|
|
1649
|
+
const projectFileExists = await fs.exists(projectFilePath);
|
|
1650
|
+
if (projectFileExists) {
|
|
1651
|
+
const projectFile = await readJsonObject(fs, projectFilePath);
|
|
1652
|
+
if (projectFile && isNonEmptyString(projectFile.projectId)) {
|
|
1653
|
+
return projectFile.projectId;
|
|
1654
|
+
}
|
|
1655
|
+
if (projectFile) {
|
|
1656
|
+
const id = crypto.randomUUID();
|
|
1657
|
+
await writeJsonObject(fs, projectFilePath, {
|
|
1658
|
+
...projectFile,
|
|
1659
|
+
projectId: id
|
|
1660
|
+
});
|
|
1661
|
+
return id;
|
|
1662
|
+
}
|
|
1663
|
+
return crypto.randomUUID();
|
|
1664
|
+
}
|
|
1665
|
+
return crypto.randomUUID();
|
|
1666
|
+
}
|
|
1667
|
+
async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
|
|
1668
|
+
if (!await fs.exists(operateFilePath)) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
const parsed = await readJsonObject(fs, operateFilePath);
|
|
1672
|
+
if (!parsed) {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
if (isNonEmptyString(parsed.projectId)) {
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
await writeJsonObject(fs, operateFilePath, {
|
|
1679
|
+
...parsed,
|
|
1680
|
+
projectId: fallbackProjectId
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
|
|
1684
|
+
if (await fs.exists(operateFilePath)) {
|
|
1685
|
+
await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
await createIfMissing();
|
|
1689
|
+
}
|
|
1690
|
+
function escapeXml(str) {
|
|
1691
|
+
if (str === null || str === undefined) {
|
|
1692
|
+
return "";
|
|
1693
|
+
}
|
|
1694
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1695
|
+
}
|
|
1696
|
+
function optionalElement(name, value) {
|
|
1697
|
+
if (value === undefined || value === "")
|
|
1698
|
+
return "";
|
|
1699
|
+
return ` <${name}>${escapeXml(value)}</${name}>
|
|
1700
|
+
`;
|
|
1701
|
+
}
|
|
1702
|
+
function generateDependenciesXml(dependencies) {
|
|
1703
|
+
if (!dependencies || dependencies.length === 0)
|
|
1704
|
+
return "";
|
|
1705
|
+
const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
|
|
1706
|
+
`);
|
|
1707
|
+
return ` <dependencies>
|
|
1708
|
+
${deps}
|
|
1709
|
+
</dependencies>
|
|
1710
|
+
`;
|
|
1711
|
+
}
|
|
1712
|
+
function generateRepositoryXml(packageInfo) {
|
|
1713
|
+
if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
|
|
1714
|
+
return "";
|
|
1715
|
+
let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
|
|
1716
|
+
if (packageInfo.repositoryBranch) {
|
|
1717
|
+
repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
|
|
1718
|
+
}
|
|
1719
|
+
if (packageInfo.repositoryCommit) {
|
|
1720
|
+
repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
|
|
1721
|
+
}
|
|
1722
|
+
repoXml += ` />
|
|
1723
|
+
`;
|
|
1724
|
+
return repoXml;
|
|
1725
|
+
}
|
|
1726
|
+
function generateNuspecXml(packageInfo) {
|
|
1727
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1728
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1729
|
+
const title = packageInfo.title?.trim() || packageInfo.id;
|
|
1730
|
+
const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
|
|
1731
|
+
const releaseNotes = packageInfo.releaseNotes ?? "";
|
|
1732
|
+
const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
|
|
1733
|
+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
1734
|
+
<metadata>
|
|
1735
|
+
<id>${escapeXml(packageInfo.id)}</id>
|
|
1736
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1737
|
+
<title>${escapeXml(title)}</title>
|
|
1738
|
+
<authors>${escapeXml(author)}</authors>
|
|
1739
|
+
<requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
|
|
1740
|
+
<description>${escapeXml(description)}</description>
|
|
1741
|
+
<releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
|
|
1742
|
+
${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>
|
|
1743
|
+
</package>
|
|
1744
|
+
`;
|
|
1745
|
+
return xml;
|
|
1746
|
+
}
|
|
1747
|
+
function generatePsmdcpXml(packageInfo) {
|
|
1748
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1749
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1750
|
+
return `<?xml version="1.0" encoding="utf-8"?>
|
|
1751
|
+
<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">
|
|
1752
|
+
<dc:creator>${escapeXml(author)}</dc:creator>
|
|
1753
|
+
<dc:description>${escapeXml(description)}</dc:description>
|
|
1754
|
+
<dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
|
|
1755
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1756
|
+
<keywords></keywords>
|
|
1757
|
+
<lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
|
|
1758
|
+
</coreProperties>`;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
class NugetPackager {
|
|
1762
|
+
fileSystem;
|
|
1763
|
+
constructor(fileSystem) {
|
|
1764
|
+
this.fileSystem = fileSystem;
|
|
1765
|
+
}
|
|
1766
|
+
async packAsync(rootPath, packageInfo, outputPath) {
|
|
1767
|
+
const normalizedOutputPath = Path.normalize(outputPath);
|
|
1768
|
+
const nuspecXml = generateNuspecXml(packageInfo);
|
|
1769
|
+
const nuspecFileName = `${packageInfo.id}.nuspec`;
|
|
1770
|
+
const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
|
|
1771
|
+
const zipContents = {};
|
|
1772
|
+
const encoder = new TextEncoder;
|
|
1773
|
+
const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
|
|
1774
|
+
const psmdcpFileName = `${psmdcpId}.psmdcp`;
|
|
1775
|
+
const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
|
|
1776
|
+
const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1777
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
1778
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
1779
|
+
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
|
|
1780
|
+
<Default Extension="uiproj" ContentType="application/octet" />
|
|
1781
|
+
<Default Extension="json" ContentType="application/octet" />
|
|
1782
|
+
<Default Extension="nuspec" ContentType="application/octet" />
|
|
1783
|
+
</Types>`;
|
|
1784
|
+
zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
|
|
1785
|
+
const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
|
|
1786
|
+
const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
|
|
1787
|
+
const relsXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1788
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
1789
|
+
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
|
|
1790
|
+
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
|
|
1791
|
+
</Relationships>`;
|
|
1792
|
+
zipContents["_rels/.rels"] = encoder.encode(relsXml);
|
|
1793
|
+
zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
|
|
1794
|
+
zipContents[nuspecFileName] = encoder.encode(nuspecXml);
|
|
1795
|
+
for (const entry of fileEntries) {
|
|
1796
|
+
const content = await this.fileSystem.readFile(entry.absolutePath);
|
|
1797
|
+
if (content !== null) {
|
|
1798
|
+
zipContents[entry.relativePath] = content;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
const zippedData = zipSync(zipContents);
|
|
1802
|
+
await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
|
|
1803
|
+
return {
|
|
1804
|
+
outputPath: normalizedOutputPath
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
class ProjectTool {
|
|
1810
|
+
fileSystem;
|
|
1811
|
+
logger;
|
|
1812
|
+
static ProjectFileName = "project.uiproj";
|
|
1813
|
+
constructor(fileSystem, logger) {
|
|
1814
|
+
this.fileSystem = fileSystem;
|
|
1815
|
+
this.logger = logger;
|
|
1816
|
+
}
|
|
1817
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1818
|
+
this.logger.info("Restore operation is a noop");
|
|
1819
|
+
return ToolResult.success();
|
|
1820
|
+
}
|
|
1821
|
+
async validateAsync(_options, _cancellationToken) {
|
|
1822
|
+
this.logger.info("Validate operation is a noop");
|
|
1823
|
+
return ToolResult.success();
|
|
1824
|
+
}
|
|
1825
|
+
async buildAsync(_options, _cancellationToken) {
|
|
1826
|
+
this.logger.info("Build operation is a noop");
|
|
1827
|
+
return ToolResult.success();
|
|
1828
|
+
}
|
|
1829
|
+
async packAsync(_options, _cancellationToken) {
|
|
1830
|
+
this.logger.info("Pack operation is a noop");
|
|
1831
|
+
return ToolResult.success();
|
|
1832
|
+
}
|
|
1833
|
+
async cleanupAsync(_options, _cancellationToken) {
|
|
1834
|
+
this.logger.info("Cleanup operation is a noop");
|
|
1835
|
+
return ToolResult.success();
|
|
1836
|
+
}
|
|
1837
|
+
async getUiProjectAsync(projectPath) {
|
|
1838
|
+
const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
|
|
1839
|
+
if (!await this.fileSystem.exists(filePath)) {
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
const raw = await this.fileSystem.readFile(filePath);
|
|
1843
|
+
if (!raw) {
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
|
|
1847
|
+
return JSON.parse(json);
|
|
1848
|
+
}
|
|
1849
|
+
async dispose() {}
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
class SolutionTool {
|
|
1853
|
+
fileSystem;
|
|
1854
|
+
logger;
|
|
1855
|
+
constructor(fileSystem, logger) {
|
|
1856
|
+
this.fileSystem = fileSystem;
|
|
1857
|
+
this.logger = logger;
|
|
1858
|
+
}
|
|
1859
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1860
|
+
this.logger.info("Restore operation is a noop");
|
|
1861
|
+
return ToolResult.success();
|
|
1862
|
+
}
|
|
1863
|
+
async validateAsync(_options, _cancellationToken) {
|
|
1864
|
+
this.logger.info("Validate operation is a noop");
|
|
1865
|
+
return ToolResult.success();
|
|
1866
|
+
}
|
|
1867
|
+
async buildAsync(_options, _cancellationToken) {
|
|
1868
|
+
this.logger.info("Build operation is a noop");
|
|
1869
|
+
return ToolResult.success();
|
|
1870
|
+
}
|
|
1871
|
+
async packAsync(_options, _cancellationToken) {
|
|
1872
|
+
this.logger.info("Pack operation is a noop");
|
|
1873
|
+
return ToolResult.success();
|
|
1874
|
+
}
|
|
1875
|
+
dispose() {}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
class ToolsFactoryRepository {
|
|
1879
|
+
projectFactoryMap = new Map;
|
|
1880
|
+
solutionFactory = null;
|
|
1881
|
+
registerProjectToolFactory(factory) {
|
|
1882
|
+
for (const type of factory.supportedTypes) {
|
|
1883
|
+
const existing = this.projectFactoryMap.get(type);
|
|
1884
|
+
if (existing) {
|
|
1885
|
+
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
1886
|
+
console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
1887
|
+
}
|
|
1888
|
+
continue;
|
|
1889
|
+
}
|
|
1890
|
+
this.projectFactoryMap.set(type, factory);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
registerSolutionToolFactory(factory) {
|
|
1894
|
+
this.solutionFactory = factory;
|
|
1895
|
+
}
|
|
1896
|
+
getSolutionToolFactory() {
|
|
1897
|
+
if (!this.solutionFactory) {
|
|
1898
|
+
throw new Error("No solution tool factory is registered");
|
|
1899
|
+
}
|
|
1900
|
+
return this.solutionFactory;
|
|
1901
|
+
}
|
|
1902
|
+
canHandleProject(projectType) {
|
|
1903
|
+
return this.projectFactoryMap.has(projectType);
|
|
1904
|
+
}
|
|
1905
|
+
getProjectToolFactory(projectType) {
|
|
1906
|
+
const factory = this.projectFactoryMap.get(projectType);
|
|
1907
|
+
if (!factory) {
|
|
1908
|
+
throw new Error(`No tool factory found for project type '${projectType}'`);
|
|
1909
|
+
}
|
|
1910
|
+
return factory;
|
|
1911
|
+
}
|
|
1912
|
+
reset() {
|
|
1913
|
+
this.projectFactoryMap.clear();
|
|
1914
|
+
this.solutionFactory = null;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
|
|
1918
|
+
var _global = globalThis;
|
|
1919
|
+
if (!_global[REGISTRY_KEY]) {
|
|
1920
|
+
_global[REGISTRY_KEY] = new ToolsFactoryRepository;
|
|
1921
|
+
}
|
|
1922
|
+
var toolsFactoryRepository = _global[REGISTRY_KEY];
|
|
1923
|
+
|
|
1924
|
+
// ../packager/packager-tool-connector/src/connector-tool.ts
|
|
1925
|
+
class ConnectorTool extends ProjectTool {
|
|
1926
|
+
static AppFolderName = "app";
|
|
1927
|
+
_temporaryStorage;
|
|
1928
|
+
constructor(fileSystem, logger) {
|
|
1929
|
+
super(fileSystem, logger);
|
|
1930
|
+
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
1931
|
+
}
|
|
1932
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1933
|
+
this.logger.info("Restore operation is not required for Connector projects");
|
|
1934
|
+
return ToolResult.success();
|
|
1935
|
+
}
|
|
1936
|
+
async validateAsync(_options, _cancellationToken) {
|
|
1937
|
+
this.logger.info("Validate operation is not required for Connector projects");
|
|
1938
|
+
return ToolResult.success();
|
|
1939
|
+
}
|
|
1940
|
+
async buildAsync(options, _cancellationToken) {
|
|
1941
|
+
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
1942
|
+
const localBuildFolder = Path.join(tempFolder, NugetConstants.OutputFolderName);
|
|
1943
|
+
const appProjectFolder = Path.join(options.projectPath, ConnectorTool.AppFolderName);
|
|
1944
|
+
const destinationFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName, ConnectorTool.AppFolderName);
|
|
1945
|
+
try {
|
|
1946
|
+
this.logger.progress("Copying app folder...");
|
|
1947
|
+
await this.copyDirectory(appProjectFolder, destinationFolder);
|
|
1948
|
+
this.logger.progress("Creating operate.json file...");
|
|
1949
|
+
await this.createOperateFile(options, localBuildFolder);
|
|
1950
|
+
this.logger.progress("Creating package-descriptor.json file...");
|
|
1951
|
+
await this.createPackageDescriptor(localBuildFolder);
|
|
1952
|
+
return new ToolResult(ToolErrorCodes.Success, "done", [
|
|
1953
|
+
localBuildFolder
|
|
1954
|
+
]);
|
|
1955
|
+
} catch (error) {
|
|
1956
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
1957
|
+
this.logger.error(errorMessage);
|
|
1958
|
+
return ToolResult.error(ToolErrorCodes.InternalError, "An error occurred while building Connector project");
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
async packAsync(options, cancellationToken) {
|
|
1962
|
+
const buildResult = await this.buildAsync(options, cancellationToken);
|
|
1963
|
+
if (!buildResult.isSuccess) {
|
|
1964
|
+
return buildResult;
|
|
1965
|
+
}
|
|
1966
|
+
const localBuildFolder = buildResult.packages[0];
|
|
1967
|
+
try {
|
|
1968
|
+
this.logger.progress("Creating NuGet package...");
|
|
1969
|
+
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
1970
|
+
const nupkgPath = Path.join(options.outputPath, nupkgFileName);
|
|
1971
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
1972
|
+
const result = await packager.packAsync(localBuildFolder, options.package, nupkgPath);
|
|
1973
|
+
this.logger.progress("Package created successfully");
|
|
1974
|
+
return new ToolResult(ToolErrorCodes.Success, "done", [
|
|
1975
|
+
result.outputPath
|
|
1976
|
+
]);
|
|
1977
|
+
} catch (error) {
|
|
1978
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
1979
|
+
this.logger.error(errorMessage);
|
|
1980
|
+
return ToolResult.error(ToolErrorCodes.InternalError, "An error occurred while packing Connector project");
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
async dispose() {
|
|
1984
|
+
this.logger.info("Disposing Connector Tool");
|
|
1985
|
+
try {
|
|
1986
|
+
await this._temporaryStorage.cleanup();
|
|
1987
|
+
} catch {}
|
|
1988
|
+
}
|
|
1989
|
+
async createOperateFile(options, localBuildFolder) {
|
|
1990
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
1991
|
+
const operateJsonFilePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
1992
|
+
const projectId = options.projectStorageId ?? await this.resolveConnectorProjectId(options.projectPath);
|
|
1993
|
+
await writeOrBackfillOperateProjectId(operateJsonFilePath, projectId, this.fileSystem, () => this.fileSystem.writeFile(operateJsonFilePath, JSON.stringify({
|
|
1994
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/operate",
|
|
1995
|
+
contentType: ProjectTypes.Connector,
|
|
1996
|
+
projectId,
|
|
1997
|
+
main: "",
|
|
1998
|
+
targetFramework: "Portable",
|
|
1999
|
+
runtimeOptions: {
|
|
2000
|
+
isAttended: false,
|
|
2001
|
+
requiresUserInteraction: false
|
|
2002
|
+
}
|
|
2003
|
+
}, null, 2)));
|
|
2004
|
+
}
|
|
2005
|
+
async resolveConnectorProjectId(projectPath) {
|
|
2006
|
+
const operatePath = Path.join(projectPath, "operate.json");
|
|
2007
|
+
const projectFilePath = Path.join(projectPath, "project.json");
|
|
2008
|
+
const hasAnchor = await this.fileSystem.exists(operatePath) || await this.fileSystem.exists(projectFilePath);
|
|
2009
|
+
if (hasAnchor) {
|
|
2010
|
+
return ensureProjectId(projectPath, this.fileSystem);
|
|
2011
|
+
}
|
|
2012
|
+
const id = crypto.randomUUID();
|
|
2013
|
+
await this.fileSystem.writeFile(projectFilePath, `${JSON.stringify({ projectId: id }, null, 2)}
|
|
2014
|
+
`);
|
|
2015
|
+
return id;
|
|
2016
|
+
}
|
|
2017
|
+
async createPackageDescriptor(localBuildFolder) {
|
|
2018
|
+
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
2019
|
+
const exists = await this.fileSystem.exists(packageDescriptorPath);
|
|
2020
|
+
if (exists) {
|
|
2021
|
+
return;
|
|
2022
|
+
}
|
|
2023
|
+
const descriptor = {
|
|
2024
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
2025
|
+
files: {
|
|
2026
|
+
[NugetConstants.OperateFileName]: Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName)
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
await this.fileSystem.writeFile(packageDescriptorPath, JSON.stringify(descriptor, null, 2));
|
|
2030
|
+
}
|
|
2031
|
+
async copyDirectory(sourcePath, destinationPath) {
|
|
2032
|
+
await this.fileSystem.mkdir(destinationPath);
|
|
2033
|
+
const entries = await this.fileSystem.readdir(sourcePath);
|
|
2034
|
+
for (const entry of entries) {
|
|
2035
|
+
const sourceEntry = Path.join(sourcePath, entry);
|
|
2036
|
+
const destinationEntry = Path.join(destinationPath, entry);
|
|
2037
|
+
const stat = await this.fileSystem.stat(sourceEntry);
|
|
2038
|
+
if (stat?.isDirectory()) {
|
|
2039
|
+
await this.copyDirectory(sourceEntry, destinationEntry);
|
|
2040
|
+
} else if (stat?.isFile()) {
|
|
2041
|
+
const content = await this.fileSystem.readFile(sourceEntry);
|
|
2042
|
+
if (content) {
|
|
2043
|
+
await this.fileSystem.writeFile(destinationEntry, content);
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
// ../packager/packager-tool-connector/src/connector-tool-factory.ts
|
|
2051
|
+
class ConnectorToolFactory {
|
|
2052
|
+
supportedTypes = [ProjectTypes.Connector];
|
|
2053
|
+
async createAsync(logger, fileSystem) {
|
|
2054
|
+
return new ConnectorTool(fileSystem, logger);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
// ../../node_modules/@uipath/coded-functions-js-packager/dist/index.js
|
|
2058
|
+
var EXCLUDED_NAMES = new Set([
|
|
2059
|
+
"node_modules",
|
|
2060
|
+
".git",
|
|
2061
|
+
".env",
|
|
2062
|
+
".deno",
|
|
2063
|
+
"dist",
|
|
2064
|
+
".uip-dbg",
|
|
2065
|
+
".uipath"
|
|
2066
|
+
]);
|
|
2067
|
+
var EXCLUDED_EXTENSIONS = [".nupkg"];
|
|
2068
|
+
var LOCK_FILES = new Set(["bun.lock", "package-lock.json", "deno.lock", "yarn.lock"]);
|
|
2069
|
+
async function buildFunctionsPackage(fs, options) {
|
|
2070
|
+
const { projectPath, outputPath, projectStorageId } = options;
|
|
2071
|
+
const contentPath = fs.path.join(outputPath, "content");
|
|
2072
|
+
await fs.mkdir(outputPath);
|
|
2073
|
+
await fs.mkdir(contentPath);
|
|
2074
|
+
const uipathJsonRaw = await fs.readFile(fs.path.join(projectPath, "uipath.json"), "utf-8");
|
|
2075
|
+
if (!uipathJsonRaw) {
|
|
2076
|
+
throw new Error("uipath.json not found. Run 'uipath-functions init' first.");
|
|
2077
|
+
}
|
|
2078
|
+
const uipathJson = JSON.parse(uipathJsonRaw);
|
|
2079
|
+
const entryPointsRaw = await fs.readFile(fs.path.join(projectPath, "entry-points.json"), "utf-8");
|
|
2080
|
+
if (!entryPointsRaw) {
|
|
2081
|
+
throw new Error("entry-points.json not found. Run 'uipath-functions pack' to generate it.");
|
|
2082
|
+
}
|
|
2083
|
+
const entryPoints = JSON.parse(entryPointsRaw);
|
|
2084
|
+
const bindingsRaw = await fs.readFile(fs.path.join(projectPath, "bindings.json"), "utf-8");
|
|
2085
|
+
const bindings = bindingsRaw ? JSON.parse(bindingsRaw) : {
|
|
2086
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/bindings",
|
|
2087
|
+
version: "2.0",
|
|
2088
|
+
resources: []
|
|
2089
|
+
};
|
|
2090
|
+
const packageJsonRaw = await fs.readFile(fs.path.join(projectPath, "package.json"), "utf-8");
|
|
2091
|
+
const packageDependencies = packageJsonRaw ? JSON.parse(packageJsonRaw).dependencies ?? {} : {};
|
|
2092
|
+
const targetRuntime = detectRuntime(uipathJson.functions);
|
|
2093
|
+
const includeLockFile = options.excludeLockFile ? false : uipathJson.packOptions?.includeLockFile ?? true;
|
|
2094
|
+
await copyProjectFiles(fs, projectPath, contentPath, includeLockFile, uipathJson.packOptions);
|
|
2095
|
+
const mainPath = entryPoints.entryPoints[0]?.filePath ?? "";
|
|
2096
|
+
const operateJson = {
|
|
2097
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/operate",
|
|
2098
|
+
projectId: projectStorageId,
|
|
2099
|
+
main: mainPath,
|
|
2100
|
+
contentType: "function",
|
|
2101
|
+
targetFramework: "Portable",
|
|
2102
|
+
targetRuntime,
|
|
2103
|
+
runtimeOptions: {
|
|
2104
|
+
requiresUserInteraction: false,
|
|
2105
|
+
isAttended: false
|
|
2106
|
+
},
|
|
2107
|
+
dependencies: packageDependencies
|
|
2108
|
+
};
|
|
2109
|
+
await fs.writeFile(fs.path.join(contentPath, "operate.json"), JSON.stringify(operateJson, null, 2));
|
|
2110
|
+
await fs.writeFile(fs.path.join(contentPath, "entry-points.json"), JSON.stringify(entryPoints, null, 2));
|
|
2111
|
+
await fs.writeFile(fs.path.join(contentPath, "bindings_v2.json"), JSON.stringify(bindings, null, 2));
|
|
2112
|
+
const packageDescriptor = {
|
|
2113
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
2114
|
+
files: {
|
|
2115
|
+
"operate.json": "content/operate.json",
|
|
2116
|
+
"entry-points.json": "content/entry-points.json",
|
|
2117
|
+
"bindings.json": "content/bindings_v2.json"
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
for (const ep of entryPoints.entryPoints) {
|
|
2121
|
+
const fnEntry = uipathJson.functions?.[ep.filePath];
|
|
2122
|
+
const filePath = fnEntry ? fnEntry.split(":")[0] ?? ep.filePath : ep.filePath;
|
|
2123
|
+
packageDescriptor.files[ep.filePath] = `content/${filePath}`;
|
|
2124
|
+
}
|
|
2125
|
+
await fs.writeFile(fs.path.join(contentPath, "package-descriptor.json"), JSON.stringify(packageDescriptor, null, 2));
|
|
2126
|
+
}
|
|
2127
|
+
function detectRuntime(functions) {
|
|
2128
|
+
if (!functions)
|
|
2129
|
+
return "javascript";
|
|
2130
|
+
const first = Object.values(functions)[0];
|
|
2131
|
+
if (!first)
|
|
2132
|
+
return "javascript";
|
|
2133
|
+
const filePath = first.split(":")[0] ?? "";
|
|
2134
|
+
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
2135
|
+
if (ext === ".py")
|
|
2136
|
+
return "python";
|
|
2137
|
+
return "javascript";
|
|
2138
|
+
}
|
|
2139
|
+
async function copyProjectFiles(fs, sourcePath, destPath, includeLockFile, packOptions) {
|
|
2140
|
+
const extraExcludedDirs = new Set(packOptions?.directoriesExcluded ?? []);
|
|
2141
|
+
const extraExcludedFiles = new Set(packOptions?.filesExcluded ?? []);
|
|
2142
|
+
async function walk(src, dest) {
|
|
2143
|
+
await fs.mkdir(dest);
|
|
2144
|
+
const entries = await fs.readdir(src);
|
|
2145
|
+
for (const name of entries) {
|
|
2146
|
+
if (EXCLUDED_NAMES.has(name))
|
|
2147
|
+
continue;
|
|
2148
|
+
if (extraExcludedDirs.has(name))
|
|
2149
|
+
continue;
|
|
2150
|
+
if (extraExcludedFiles.has(name))
|
|
2151
|
+
continue;
|
|
2152
|
+
if (EXCLUDED_EXTENSIONS.some((ext) => name.endsWith(ext)))
|
|
2153
|
+
continue;
|
|
2154
|
+
if (!includeLockFile && LOCK_FILES.has(name))
|
|
2155
|
+
continue;
|
|
2156
|
+
const srcEntry = fs.path.join(src, name);
|
|
2157
|
+
const destEntry = fs.path.join(dest, name);
|
|
2158
|
+
const stat = await fs.stat(srcEntry);
|
|
2159
|
+
if (stat?.isDirectory()) {
|
|
2160
|
+
await walk(srcEntry, destEntry);
|
|
2161
|
+
} else if (stat?.isFile()) {
|
|
2162
|
+
const content = await fs.readFile(srcEntry);
|
|
2163
|
+
if (content)
|
|
2164
|
+
await fs.writeFile(destEntry, content);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
await walk(sourcePath, destPath);
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
// ../packager/packager-tool-functions/src/js/build-js-functions-package.ts
|
|
2172
|
+
async function buildJsFunctionsPackage(fileSystem, options) {
|
|
2173
|
+
await buildFunctionsPackage(fileSystem, {
|
|
2174
|
+
projectPath: options.projectPath,
|
|
2175
|
+
outputPath: options.outputPath,
|
|
2176
|
+
projectStorageId: options.projectStorageId
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
// ../packager/packager-tool-functions/src/py/constants.ts
|
|
2180
|
+
var EXCLUDED_NAMES2 = new Set([
|
|
2181
|
+
"agent.json",
|
|
2182
|
+
"project.uiproj",
|
|
2183
|
+
"bindings.json",
|
|
2184
|
+
"entry-points.json",
|
|
2185
|
+
".DS_Store",
|
|
2186
|
+
"Thumbs.db"
|
|
2187
|
+
]);
|
|
2188
|
+
var EXCLUDED_DIRECTORIES = new Set([
|
|
2189
|
+
"evaluations",
|
|
2190
|
+
"evals",
|
|
2191
|
+
".function-builder",
|
|
2192
|
+
"node_modules",
|
|
2193
|
+
"__pycache__",
|
|
2194
|
+
".pytest_cache",
|
|
2195
|
+
".venv",
|
|
2196
|
+
"venv",
|
|
2197
|
+
"env",
|
|
2198
|
+
".git",
|
|
2199
|
+
".vscode",
|
|
2200
|
+
".idea",
|
|
2201
|
+
".local"
|
|
2202
|
+
]);
|
|
2203
|
+
var CONTENT_TYPE = "function";
|
|
2204
|
+
var TARGET_RUNTIME = "python";
|
|
2205
|
+
var UIPATH_JSON_FILE_NAME = "uipath.json";
|
|
2206
|
+
var BINDINGS_SOURCE_FILE_NAME = "bindings.json";
|
|
2207
|
+
var BINDINGS_VERSION = "2.0";
|
|
2208
|
+
var ENTRY_POINT_TYPE = "function";
|
|
2209
|
+
var SCHEMA_BASE_URL = "https://cloud.uipath.com/draft/2024-12";
|
|
2210
|
+
var SCHEMAS = {
|
|
2211
|
+
Bindings: `${SCHEMA_BASE_URL}/bindings`,
|
|
2212
|
+
EntryPoint: `${SCHEMA_BASE_URL}/entry-point`,
|
|
2213
|
+
Operate: `${SCHEMA_BASE_URL}/operate`,
|
|
2214
|
+
PackageDescriptor: `${SCHEMA_BASE_URL}/package-descriptor`
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
// ../packager/packager-tool-functions/src/py/build-py-functions-package.ts
|
|
2218
|
+
async function buildPyFunctionsPackage(fileSystem, options) {
|
|
2219
|
+
const contentFolder = Path.join(options.outputPath, NugetConstants.ContentFolderName);
|
|
2220
|
+
await validateProjectFiles(fileSystem, options.projectPath);
|
|
2221
|
+
await copyFiles(fileSystem, options.projectPath, contentFolder);
|
|
2222
|
+
await writeEntryPointsFile(fileSystem, options.projectPath, contentFolder);
|
|
2223
|
+
await createOperateFile(fileSystem, contentFolder, options.projectStorageId);
|
|
2224
|
+
await createBindingsFile(fileSystem, options.projectPath, contentFolder);
|
|
2225
|
+
await createPackageDescriptor(fileSystem, options.outputPath);
|
|
2226
|
+
}
|
|
2227
|
+
async function validateProjectFiles(fileSystem, projectPath) {
|
|
2228
|
+
const uipathJsonPath = Path.join(projectPath, UIPATH_JSON_FILE_NAME);
|
|
2229
|
+
const entryPointsPath = Path.join(projectPath, NugetConstants.EntryPointsFileName);
|
|
2230
|
+
if (!await fileSystem.exists(uipathJsonPath)) {
|
|
2231
|
+
throw new Error("uipath.json is missing from the project.");
|
|
2232
|
+
}
|
|
2233
|
+
if (!await fileSystem.exists(entryPointsPath)) {
|
|
2234
|
+
throw new Error("entry-points.json is missing from the project.");
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
async function copyFiles(fileSystem, sourcePath, destinationPath) {
|
|
2238
|
+
await fileSystem.mkdir(destinationPath);
|
|
2239
|
+
const entries = await fileSystem.readdir(sourcePath);
|
|
2240
|
+
for (const entry of entries) {
|
|
2241
|
+
const sourceFile = Path.join(sourcePath, entry);
|
|
2242
|
+
const destinationFile = Path.join(destinationPath, entry);
|
|
2243
|
+
const stat = await fileSystem.stat(sourceFile);
|
|
2244
|
+
if (stat?.isFile()) {
|
|
2245
|
+
if (EXCLUDED_NAMES2.has(entry)) {
|
|
2246
|
+
continue;
|
|
2247
|
+
}
|
|
2248
|
+
const content = await fileSystem.readFile(sourceFile);
|
|
2249
|
+
if (content) {
|
|
2250
|
+
await fileSystem.writeFile(destinationFile, content);
|
|
2251
|
+
}
|
|
2252
|
+
} else if (stat?.isDirectory()) {
|
|
2253
|
+
if (EXCLUDED_DIRECTORIES.has(entry)) {
|
|
2254
|
+
continue;
|
|
2255
|
+
}
|
|
2256
|
+
await copyFiles(fileSystem, sourceFile, destinationFile);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
async function createOperateFile(fileSystem, contentFolder, projectStorageId) {
|
|
2261
|
+
const operateJsonFilePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
2262
|
+
const exists = await fileSystem.exists(operateJsonFilePath);
|
|
2263
|
+
if (exists) {
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2266
|
+
const entryPointsFilePath = Path.join(contentFolder, NugetConstants.EntryPointsFileName);
|
|
2267
|
+
let mainPath = "";
|
|
2268
|
+
const entryPointsExists = await fileSystem.exists(entryPointsFilePath);
|
|
2269
|
+
if (entryPointsExists) {
|
|
2270
|
+
const entryPointsContent = await fileSystem.readFile(entryPointsFilePath);
|
|
2271
|
+
if (entryPointsContent) {
|
|
2272
|
+
try {
|
|
2273
|
+
const entryPointsText = new TextDecoder().decode(entryPointsContent);
|
|
2274
|
+
const entryPoints = JSON.parse(entryPointsText);
|
|
2275
|
+
mainPath = entryPoints.entryPoints?.[0]?.filePath ?? "";
|
|
2276
|
+
} catch {}
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
const operateFileModel = {
|
|
2280
|
+
$schema: SCHEMAS.Operate,
|
|
2281
|
+
contentType: CONTENT_TYPE,
|
|
2282
|
+
projectId: projectStorageId,
|
|
2283
|
+
main: mainPath,
|
|
2284
|
+
targetFramework: "Portable",
|
|
2285
|
+
targetRuntime: TARGET_RUNTIME,
|
|
2286
|
+
runtimeOptions: {
|
|
2287
|
+
isAttended: false,
|
|
2288
|
+
requiresUserInteraction: false,
|
|
2289
|
+
isConversational: false
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
const operateJsonString = JSON.stringify(operateFileModel, null, 2);
|
|
2293
|
+
await fileSystem.writeFile(operateJsonFilePath, operateJsonString);
|
|
2294
|
+
}
|
|
2295
|
+
async function writeEntryPointsFile(fileSystem, projectPath, contentFolder) {
|
|
2296
|
+
const sourcePath = Path.join(projectPath, NugetConstants.EntryPointsFileName);
|
|
2297
|
+
const destinationPath = Path.join(contentFolder, NugetConstants.EntryPointsFileName);
|
|
2298
|
+
const raw = await fileSystem.readFile(sourcePath);
|
|
2299
|
+
if (!raw) {
|
|
2300
|
+
throw new Error("entry-points.json is missing from the project.");
|
|
2301
|
+
}
|
|
2302
|
+
let parsed;
|
|
2303
|
+
try {
|
|
2304
|
+
parsed = JSON.parse(new TextDecoder().decode(raw));
|
|
2305
|
+
} catch {
|
|
2306
|
+
throw new Error("entry-points.json is not valid JSON.");
|
|
2307
|
+
}
|
|
2308
|
+
const sourceEntries = Array.isArray(parsed.entryPoints) ? parsed.entryPoints : [];
|
|
2309
|
+
const normalizedEntries = sourceEntries.map((entry) => ({
|
|
2310
|
+
...entry,
|
|
2311
|
+
uniqueId: typeof entry.uniqueId === "string" && entry.uniqueId.length > 0 ? entry.uniqueId : crypto.randomUUID(),
|
|
2312
|
+
type: typeof entry.type === "string" && entry.type.length > 0 ? entry.type : ENTRY_POINT_TYPE
|
|
2313
|
+
}));
|
|
2314
|
+
const normalized = {
|
|
2315
|
+
$schema: SCHEMAS.EntryPoint,
|
|
2316
|
+
$id: NugetConstants.EntryPointsFileName,
|
|
2317
|
+
entryPoints: normalizedEntries
|
|
2318
|
+
};
|
|
2319
|
+
await fileSystem.writeFile(destinationPath, JSON.stringify(normalized, null, 2));
|
|
2320
|
+
}
|
|
2321
|
+
async function createBindingsFile(fileSystem, projectPath, contentFolder) {
|
|
2322
|
+
const bindingsOutputPath = Path.join(contentFolder, NugetConstants.BindingsV2FileName);
|
|
2323
|
+
const sourcePath = Path.join(projectPath, BINDINGS_SOURCE_FILE_NAME);
|
|
2324
|
+
let bindings = null;
|
|
2325
|
+
if (await fileSystem.exists(sourcePath)) {
|
|
2326
|
+
const raw = await fileSystem.readFile(sourcePath);
|
|
2327
|
+
if (raw) {
|
|
2328
|
+
try {
|
|
2329
|
+
bindings = JSON.parse(new TextDecoder().decode(raw));
|
|
2330
|
+
} catch {
|
|
2331
|
+
bindings = null;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
if (bindings === null) {
|
|
2336
|
+
bindings = {
|
|
2337
|
+
$schema: SCHEMAS.Bindings,
|
|
2338
|
+
version: BINDINGS_VERSION,
|
|
2339
|
+
resources: []
|
|
2340
|
+
};
|
|
2341
|
+
}
|
|
2342
|
+
await fileSystem.writeFile(bindingsOutputPath, JSON.stringify(bindings, null, 2));
|
|
2343
|
+
}
|
|
2344
|
+
async function createPackageDescriptor(fileSystem, localBuildFolder) {
|
|
2345
|
+
const packageDescriptor = {
|
|
2346
|
+
files: {}
|
|
2347
|
+
};
|
|
2348
|
+
addFileToDescriptor(packageDescriptor, NugetConstants.OperateFileName, NugetConstants.OperateFileName);
|
|
2349
|
+
addFileToDescriptor(packageDescriptor, NugetConstants.EntryPointsFileName, NugetConstants.EntryPointsFileName);
|
|
2350
|
+
addFileToDescriptor(packageDescriptor, NugetConstants.BindingsFileId, NugetConstants.BindingsV2FileName);
|
|
2351
|
+
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
2352
|
+
const packageDescriptorJson = JSON.stringify({
|
|
2353
|
+
$schema: SCHEMAS.PackageDescriptor,
|
|
2354
|
+
...packageDescriptor
|
|
2355
|
+
}, null, 2);
|
|
2356
|
+
await fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
2357
|
+
}
|
|
2358
|
+
function addFileToDescriptor(packageDescriptor, key, fileName) {
|
|
2359
|
+
const relativePath = Path.join(NugetConstants.ContentFolderName, fileName);
|
|
2360
|
+
packageDescriptor.files[key] = relativePath;
|
|
2361
|
+
}
|
|
2362
|
+
// ../packager/packager-tool-functions/src/types.ts
|
|
2363
|
+
var Languages = {
|
|
2364
|
+
JavaScript: "javascript",
|
|
2365
|
+
Python: "python"
|
|
2366
|
+
};
|
|
2367
|
+
var LanguageLabels = {
|
|
2368
|
+
[Languages.JavaScript]: "JS/TS",
|
|
2369
|
+
[Languages.Python]: "Python"
|
|
2370
|
+
};
|
|
2371
|
+
|
|
2372
|
+
// ../packager/packager-tool-functions/src/functions-tool.ts
|
|
2373
|
+
class FunctionsTool extends ProjectTool {
|
|
2374
|
+
_temporaryStorage;
|
|
2375
|
+
constructor(fileSystem, logger) {
|
|
2376
|
+
super(fileSystem, logger);
|
|
2377
|
+
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
2378
|
+
}
|
|
2379
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
2380
|
+
this.logger.info("Restore not required for Functions projects.");
|
|
2381
|
+
return ToolResult.success();
|
|
2382
|
+
}
|
|
2383
|
+
async validateAsync(_options, _cancellationToken) {
|
|
2384
|
+
this.logger.info("Validate not required for Functions projects.");
|
|
2385
|
+
return ToolResult.success();
|
|
2386
|
+
}
|
|
2387
|
+
async buildAsync(options, _cancellationToken) {
|
|
2388
|
+
const language = await this.detectLanguage(options.projectPath);
|
|
2389
|
+
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
2390
|
+
const localBuildFolder = Path.join(tempFolder, NugetConstants.OutputFolderName);
|
|
2391
|
+
const build = language === Languages.Python ? buildPyFunctionsPackage : buildJsFunctionsPackage;
|
|
2392
|
+
const languageLabel = LanguageLabels[language];
|
|
2393
|
+
try {
|
|
2394
|
+
this.logger.progress(`Building ${languageLabel} Functions package...`);
|
|
2395
|
+
const projectStorageId = options.projectStorageId ?? await ensureProjectId(options.projectPath, this.fileSystem);
|
|
2396
|
+
await build(this.fileSystem, {
|
|
2397
|
+
projectPath: options.projectPath,
|
|
2398
|
+
outputPath: localBuildFolder,
|
|
2399
|
+
projectStorageId
|
|
2400
|
+
});
|
|
2401
|
+
return new ToolResult(ToolErrorCodes.Success, "Build completed successfully.", [localBuildFolder]);
|
|
2402
|
+
} catch (error) {
|
|
2403
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
2404
|
+
this.logger.error(errorMessage);
|
|
2405
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `Build failed for ${languageLabel} Functions project.`);
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
async packAsync(options, cancellationToken) {
|
|
2409
|
+
const buildResult = await this.buildAsync(options, cancellationToken);
|
|
2410
|
+
if (!buildResult.isSuccess) {
|
|
2411
|
+
return buildResult;
|
|
2412
|
+
}
|
|
2413
|
+
const localBuildFolder = buildResult.packages[0];
|
|
2414
|
+
try {
|
|
2415
|
+
this.logger.progress("Creating NuGet package...");
|
|
2416
|
+
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
2417
|
+
const nupkgPath = Path.join(options.outputPath, nupkgFileName);
|
|
2418
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
2419
|
+
const result = await packager.packAsync(localBuildFolder, options.package, nupkgPath);
|
|
2420
|
+
this.logger.progress("Package created successfully.");
|
|
2421
|
+
return new ToolResult(ToolErrorCodes.Success, "Pack completed successfully.", [result.outputPath]);
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
2424
|
+
this.logger.error(errorMessage);
|
|
2425
|
+
return ToolResult.error(ToolErrorCodes.InternalError, "Pack failed for Functions project.");
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
async dispose() {
|
|
2429
|
+
this.logger.info("Disposing Functions Tool");
|
|
2430
|
+
try {
|
|
2431
|
+
await this._temporaryStorage.cleanup();
|
|
2432
|
+
} catch {}
|
|
2433
|
+
}
|
|
2434
|
+
async detectLanguage(projectPath) {
|
|
2435
|
+
const uipathJsonContent = await this.fileSystem.readFile(Path.join(projectPath, "uipath.json"), "utf-8");
|
|
2436
|
+
if (uipathJsonContent) {
|
|
2437
|
+
try {
|
|
2438
|
+
const uipathJson = JSON.parse(uipathJsonContent);
|
|
2439
|
+
const firstEntry = Object.values(uipathJson.functions ?? {})[0];
|
|
2440
|
+
if (firstEntry) {
|
|
2441
|
+
const filePath = firstEntry.split(":")[0] ?? "";
|
|
2442
|
+
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
2443
|
+
if (ext === ".ts" || ext === ".js" || ext === ".mjs")
|
|
2444
|
+
return Languages.JavaScript;
|
|
2445
|
+
if (ext === ".py")
|
|
2446
|
+
return Languages.Python;
|
|
2447
|
+
}
|
|
2448
|
+
} catch {}
|
|
2449
|
+
}
|
|
2450
|
+
const pyprojectStat = await this.fileSystem.stat(Path.join(projectPath, "pyproject.toml"));
|
|
2451
|
+
if (pyprojectStat?.isFile())
|
|
2452
|
+
return Languages.Python;
|
|
2453
|
+
return Languages.JavaScript;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
// ../packager/packager-tool-functions/src/functions-tool-factory.ts
|
|
2458
|
+
class FunctionsToolFactory {
|
|
2459
|
+
supportedTypes = [ProjectTypes.Function];
|
|
2460
|
+
async createAsync(logger, fileSystem) {
|
|
2461
|
+
return new FunctionsTool(fileSystem, logger);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
// ../packager/packager-tool-webapp/src/models/webapp-manifest.ts
|
|
2465
|
+
var WebAppVariantType;
|
|
2466
|
+
((WebAppVariantType2) => {
|
|
2467
|
+
WebAppVariantType2["Coded"] = "Coded";
|
|
2468
|
+
WebAppVariantType2["JS"] = "JS";
|
|
2469
|
+
})(WebAppVariantType ||= {});
|
|
2470
|
+
var WEBAPP_MANIFEST_FILE_NAME = "webAppManifest.json";
|
|
2471
|
+
// ../packager/packager-tool-webapp/src/constants.ts
|
|
2472
|
+
var PROJECT_JSON_FILE = "project.json";
|
|
2473
|
+
var DEFAULT_BUNDLE_PATH = "source/dist";
|
|
2474
|
+
var APP_FOLDER_NAME = ".app";
|
|
2475
|
+
var CONTENT_APP_FOLDER_NAME = "app";
|
|
2476
|
+
var TARGET_RUNTIME2 = "Coded";
|
|
2477
|
+
var TARGET_JS_RUNTIME = "JS";
|
|
2478
|
+
var DEFAULT_ENTRY_POINT_TYPE = "api";
|
|
2479
|
+
var ERROR_MESSAGES = {
|
|
2480
|
+
MANIFEST_NOT_FOUND: (file) => `WebApp manifest not found: ${file}. This file is required for WebApp projects.`,
|
|
2481
|
+
PROJECT_JSON_FOUND: "project.json found in WebApp project. The WebApp tool only supports Coded web apps without project.json.",
|
|
2482
|
+
MANIFEST_LOAD_FAILED: (file) => `Failed to load or parse ${file}`,
|
|
2483
|
+
BUNDLE_NOT_FOUND: (path) => `Compiled bundle not found at ${path}. Ensure the project is built before packing.`,
|
|
2484
|
+
BUNDLE_NOT_DIRECTORY: (path) => `Bundle path ${path} exists but is not a directory.`,
|
|
2485
|
+
APP_FOLDER_NOT_FOUND: (path) => `.app folder not found at ${path}. Ensure the project contains a .app folder.`,
|
|
2486
|
+
APP_FOLDER_NOT_DIRECTORY: (path) => `.app path ${path} exists but is not a directory.`,
|
|
2487
|
+
BUILD_NOT_SUPPORTED: "Build execution (isCompiled=false) is not yet supported. Please build the project manually and set isCompiled=true.",
|
|
2488
|
+
VALIDATION_FAILED: (context) => `Validation failed: ${context}`,
|
|
2489
|
+
PACKING_FAILED: (context) => `An error occurred while packing WebApp project: ${context}`,
|
|
2490
|
+
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
2491
|
+
PACKAGE_VERSION_REQUIRED: "Package version is required",
|
|
2492
|
+
PROJECT_PATH_REQUIRED: "Project path is required",
|
|
2493
|
+
OUTPUT_PATH_REQUIRED: "Output path is required"
|
|
2494
|
+
};
|
|
2495
|
+
|
|
2496
|
+
// ../packager/packager-tool-webapp/src/utils/fs-helpers.ts
|
|
2497
|
+
async function copyDirectoryAsync(fileSystem, sourcePath, destinationPath) {
|
|
2498
|
+
await fileSystem.mkdir(destinationPath);
|
|
2499
|
+
const entries = await fileSystem.readdir(sourcePath);
|
|
2500
|
+
for (const entry of entries) {
|
|
2501
|
+
const sourceEntry = Path.join(sourcePath, entry);
|
|
2502
|
+
const destEntry = Path.join(destinationPath, entry);
|
|
2503
|
+
const stat = await fileSystem.stat(sourceEntry);
|
|
2504
|
+
if (stat?.isDirectory()) {
|
|
2505
|
+
await copyDirectoryAsync(fileSystem, sourceEntry, destEntry);
|
|
2506
|
+
} else if (stat?.isFile()) {
|
|
2507
|
+
const content = await fileSystem.readFile(sourceEntry);
|
|
2508
|
+
if (content) {
|
|
2509
|
+
await fileSystem.writeFile(destEntry, content);
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
// ../packager/packager-tool-webapp/src/utils/manifest-loader.ts
|
|
2516
|
+
async function loadWebAppManifest(fileSystem, projectPath) {
|
|
2517
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
2518
|
+
const exists = await fileSystem.exists(manifestPath);
|
|
2519
|
+
if (!exists) {
|
|
2520
|
+
return null;
|
|
2521
|
+
}
|
|
2522
|
+
const content = await fileSystem.readFile(manifestPath);
|
|
2523
|
+
if (!content) {
|
|
2524
|
+
return null;
|
|
2525
|
+
}
|
|
2526
|
+
try {
|
|
2527
|
+
const text = new TextDecoder().decode(content);
|
|
2528
|
+
const manifest = JSON.parse(text);
|
|
2529
|
+
return manifest;
|
|
2530
|
+
} catch (error) {
|
|
2531
|
+
throw new Error(`Failed to parse ${WEBAPP_MANIFEST_FILE_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
async function ensureWebAppProjectId(fileSystem, projectPath) {
|
|
2535
|
+
const manifest = await loadWebAppManifest(fileSystem, projectPath);
|
|
2536
|
+
if (manifest && typeof manifest.projectId === "string" && manifest.projectId.length > 0) {
|
|
2537
|
+
return manifest.projectId;
|
|
2538
|
+
}
|
|
2539
|
+
const id = crypto.randomUUID();
|
|
2540
|
+
if (manifest) {
|
|
2541
|
+
const updated = { ...manifest, projectId: id };
|
|
2542
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
2543
|
+
await fileSystem.writeFile(manifestPath, `${JSON.stringify(updated, null, 2)}
|
|
2544
|
+
`);
|
|
2545
|
+
}
|
|
2546
|
+
return id;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
// ../packager/packager-tool-webapp/src/strategies/coded-app-strategy.ts
|
|
2550
|
+
class CodedAppStrategy {
|
|
2551
|
+
fileSystem;
|
|
2552
|
+
constructor(fileSystem) {
|
|
2553
|
+
this.fileSystem = fileSystem;
|
|
2554
|
+
}
|
|
2555
|
+
async validateAsync(args) {
|
|
2556
|
+
const { projectPath, manifest, logger } = args;
|
|
2557
|
+
const typed = manifest;
|
|
2558
|
+
let bundlePath = typed.config?.bundlePath;
|
|
2559
|
+
if (typeof bundlePath !== "string" || bundlePath.length === 0) {
|
|
2560
|
+
bundlePath = DEFAULT_BUNDLE_PATH;
|
|
2561
|
+
}
|
|
2562
|
+
const isCompiled = typed.config?.isCompiled ?? true;
|
|
2563
|
+
if (isCompiled) {
|
|
2564
|
+
const fullBundlePath = Path.join(projectPath, bundlePath);
|
|
2565
|
+
const exists = await this.fileSystem.exists(fullBundlePath);
|
|
2566
|
+
if (!exists) {
|
|
2567
|
+
const message = ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath);
|
|
2568
|
+
const warnable = logger;
|
|
2569
|
+
if (warnable?.warn) {
|
|
2570
|
+
warnable.warn(message);
|
|
2571
|
+
} else {
|
|
2572
|
+
logger?.info(`Warning: ${message}`);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
async packageAsync(args) {
|
|
2578
|
+
const { projectPath, manifest, outputPath, packageInfo, logger } = args;
|
|
2579
|
+
logger?.info(`Packaging Coded variant: ${packageInfo.id}@${packageInfo.version}`);
|
|
2580
|
+
let bundlePath = manifest.config?.bundlePath;
|
|
2581
|
+
if (typeof bundlePath !== "string" || bundlePath.length === 0) {
|
|
2582
|
+
bundlePath = DEFAULT_BUNDLE_PATH;
|
|
2583
|
+
}
|
|
2584
|
+
const isCompiled = manifest.config?.isCompiled ?? true;
|
|
2585
|
+
const fullBundlePath = Path.join(projectPath, bundlePath);
|
|
2586
|
+
if (isCompiled) {
|
|
2587
|
+
logger?.progress("Validating compiled bundle...");
|
|
2588
|
+
const bundleExists = await this.fileSystem.exists(fullBundlePath);
|
|
2589
|
+
if (!bundleExists) {
|
|
2590
|
+
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath));
|
|
2591
|
+
}
|
|
2592
|
+
const bundleStat = await this.fileSystem.stat(fullBundlePath);
|
|
2593
|
+
if (!bundleStat?.isDirectory()) {
|
|
2594
|
+
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_DIRECTORY(fullBundlePath));
|
|
2595
|
+
}
|
|
2596
|
+
} else {
|
|
2597
|
+
logger?.info("Build mode (isCompiled=false) is not yet implemented in v1.");
|
|
2598
|
+
throw new Error(ERROR_MESSAGES.BUILD_NOT_SUPPORTED);
|
|
2599
|
+
}
|
|
2600
|
+
const localBuildFolder = Path.join(outputPath, NugetConstants.OutputFolderName);
|
|
2601
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
2602
|
+
await this.fileSystem.mkdir(contentFolder);
|
|
2603
|
+
try {
|
|
2604
|
+
logger?.progress("Copying bundle to content folder...");
|
|
2605
|
+
await copyDirectoryAsync(this.fileSystem, fullBundlePath, contentFolder);
|
|
2606
|
+
logger?.progress("Preparing metadata files...");
|
|
2607
|
+
await this.prepareMetadataFiles(localBuildFolder, contentFolder, packageInfo, manifest, projectPath);
|
|
2608
|
+
logger?.progress("Creating NuGet package...");
|
|
2609
|
+
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
2610
|
+
const nupkgPath = Path.join(outputPath, nupkgFileName);
|
|
2611
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
2612
|
+
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
2613
|
+
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
2614
|
+
return result.outputPath;
|
|
2615
|
+
} finally {
|
|
2616
|
+
try {
|
|
2617
|
+
await this.fileSystem.rm(localBuildFolder);
|
|
2618
|
+
} catch (cleanupError) {
|
|
2619
|
+
logger?.error(`Failed to cleanup build folder: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
async prepareMetadataFiles(_localBuildFolder, contentFolder, _packageInfo, _manifest, projectPath) {
|
|
2624
|
+
let mainFile = "index.html";
|
|
2625
|
+
const indexHtmlPath = Path.join(contentFolder, "index.html");
|
|
2626
|
+
const indexHtmlExists = await this.fileSystem.exists(indexHtmlPath);
|
|
2627
|
+
if (!indexHtmlExists) {
|
|
2628
|
+
const possibleEntries = ["index.html", "main.html", "app.html"];
|
|
2629
|
+
for (const entry of possibleEntries) {
|
|
2630
|
+
const entryPath = Path.join(contentFolder, entry);
|
|
2631
|
+
if (await this.fileSystem.exists(entryPath)) {
|
|
2632
|
+
mainFile = entry;
|
|
2633
|
+
break;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
const operatePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
2638
|
+
const operateModel = {
|
|
2639
|
+
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
2640
|
+
main: mainFile,
|
|
2641
|
+
contentType: ProjectTypes.WebApp,
|
|
2642
|
+
targetFramework: TargetFramework.Portable,
|
|
2643
|
+
targetRuntime: TARGET_RUNTIME2,
|
|
2644
|
+
runtimeOptions: {
|
|
2645
|
+
requiresUserInteraction: false,
|
|
2646
|
+
isAttended: false
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
2650
|
+
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
2651
|
+
const manifestSourcePath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
2652
|
+
const manifestDestPath = Path.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME);
|
|
2653
|
+
const manifestExists = await this.fileSystem.exists(manifestSourcePath);
|
|
2654
|
+
if (manifestExists) {
|
|
2655
|
+
const manifestContent = await this.fileSystem.readFile(manifestSourcePath, "utf-8");
|
|
2656
|
+
if (manifestContent) {
|
|
2657
|
+
await this.fileSystem.writeFile(manifestDestPath, manifestContent);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
const uipathJsonSourcePath = Path.join(projectPath, "uipath.json");
|
|
2661
|
+
const uipathJsonDestPath = Path.join(contentFolder, "uipath.json");
|
|
2662
|
+
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
2663
|
+
if (uipathJsonExists) {
|
|
2664
|
+
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath, "utf-8");
|
|
2665
|
+
if (uipathJsonContent) {
|
|
2666
|
+
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
const bindingsPath = Path.join(contentFolder, "bindings.json");
|
|
2670
|
+
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
2671
|
+
if (!bindingsExists) {
|
|
2672
|
+
const bindingsJson = JSON.stringify({
|
|
2673
|
+
version: "1.0",
|
|
2674
|
+
resources: []
|
|
2675
|
+
}, null, 2);
|
|
2676
|
+
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
2677
|
+
}
|
|
2678
|
+
const bindingsV2Path = Path.join(contentFolder, "bindings_v2.json");
|
|
2679
|
+
const bindingsCandidatePaths = [
|
|
2680
|
+
Path.join(projectPath, "source", "bindings.json"),
|
|
2681
|
+
Path.join(projectPath, "bindings.json"),
|
|
2682
|
+
Path.join(projectPath, "bindings_v2.json")
|
|
2683
|
+
];
|
|
2684
|
+
let bindingsV2Json = null;
|
|
2685
|
+
for (const candidate of bindingsCandidatePaths) {
|
|
2686
|
+
if (await this.fileSystem.exists(candidate)) {
|
|
2687
|
+
bindingsV2Json = await this.fileSystem.readFile(candidate, "utf-8");
|
|
2688
|
+
if (bindingsV2Json)
|
|
2689
|
+
break;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
if (!bindingsV2Json && await this.fileSystem.exists(bindingsV2Path)) {
|
|
2693
|
+
bindingsV2Json = await this.fileSystem.readFile(bindingsV2Path, "utf-8");
|
|
2694
|
+
}
|
|
2695
|
+
if (!bindingsV2Json) {
|
|
2696
|
+
bindingsV2Json = JSON.stringify({
|
|
2697
|
+
version: "2.0",
|
|
2698
|
+
resources: []
|
|
2699
|
+
}, null, 2);
|
|
2700
|
+
}
|
|
2701
|
+
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
2702
|
+
const entryPointsPath = Path.join(contentFolder, "entry-points.json");
|
|
2703
|
+
const projectEntryPointsPath = Path.join(projectPath, "entry-points.json");
|
|
2704
|
+
let entryPointsContent;
|
|
2705
|
+
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
2706
|
+
if (projectEntryPointsExists) {
|
|
2707
|
+
const entryPointsData = await this.fileSystem.readFile(projectEntryPointsPath, "utf-8");
|
|
2708
|
+
if (entryPointsData) {
|
|
2709
|
+
entryPointsContent = entryPointsData;
|
|
2710
|
+
} else {
|
|
2711
|
+
entryPointsContent = this.createDefaultEntryPoints(mainFile);
|
|
2712
|
+
}
|
|
2713
|
+
} else {
|
|
2714
|
+
entryPointsContent = this.createDefaultEntryPoints(mainFile);
|
|
2715
|
+
}
|
|
2716
|
+
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
2717
|
+
const packageDescriptorPath = Path.join(contentFolder, NugetConstants.PackageDescriptorFileName);
|
|
2718
|
+
const packageDescriptor = {
|
|
2719
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
2720
|
+
files: {
|
|
2721
|
+
[NugetConstants.OperateFileName]: Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName),
|
|
2722
|
+
"entry-points.json": Path.join(NugetConstants.ContentFolderName, "entry-points.json"),
|
|
2723
|
+
"bindings.json": Path.join(NugetConstants.ContentFolderName, "bindings_v2.json")
|
|
2724
|
+
}
|
|
2725
|
+
};
|
|
2726
|
+
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
2727
|
+
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
2728
|
+
}
|
|
2729
|
+
createDefaultEntryPoints(mainFile) {
|
|
2730
|
+
const uniqueId = this.generateUniqueId();
|
|
2731
|
+
const entryPoints = {
|
|
2732
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
2733
|
+
$id: "entry-points-doc-001",
|
|
2734
|
+
entryPoints: [
|
|
2735
|
+
{
|
|
2736
|
+
filePath: mainFile,
|
|
2737
|
+
uniqueId,
|
|
2738
|
+
type: DEFAULT_ENTRY_POINT_TYPE,
|
|
2739
|
+
input: {
|
|
2740
|
+
amount: { type: "integer" },
|
|
2741
|
+
id: { type: "string" }
|
|
2742
|
+
},
|
|
2743
|
+
output: {
|
|
2744
|
+
status: { type: "string" }
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
]
|
|
2748
|
+
};
|
|
2749
|
+
return JSON.stringify(entryPoints, null, 2);
|
|
2750
|
+
}
|
|
2751
|
+
generateUniqueId() {
|
|
2752
|
+
const randomBytes = new Uint8Array(16);
|
|
2753
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
2754
|
+
crypto.getRandomValues(randomBytes);
|
|
2755
|
+
} else {
|
|
2756
|
+
throw new Error("crypto.getRandomValues is not available");
|
|
2757
|
+
}
|
|
2758
|
+
randomBytes[6] = randomBytes[6] & 15 | 64;
|
|
2759
|
+
randomBytes[8] = randomBytes[8] & 63 | 128;
|
|
2760
|
+
const hex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2761
|
+
return [
|
|
2762
|
+
hex.substring(0, 8),
|
|
2763
|
+
hex.substring(8, 12),
|
|
2764
|
+
hex.substring(12, 16),
|
|
2765
|
+
hex.substring(16, 20),
|
|
2766
|
+
hex.substring(20, 32)
|
|
2767
|
+
].join("-");
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
// ../packager/packager-tool-webapp/src/strategies/js-apps-strategy.ts
|
|
2772
|
+
class JsAppsStrategy {
|
|
2773
|
+
fileSystem;
|
|
2774
|
+
constructor(fileSystem) {
|
|
2775
|
+
this.fileSystem = fileSystem;
|
|
2776
|
+
}
|
|
2777
|
+
async validateAsync(args) {
|
|
2778
|
+
const { projectPath, logger } = args;
|
|
2779
|
+
const appFolder = Path.join(projectPath, APP_FOLDER_NAME);
|
|
2780
|
+
const exists = await this.fileSystem.exists(appFolder);
|
|
2781
|
+
if (!exists) {
|
|
2782
|
+
const message = ERROR_MESSAGES.APP_FOLDER_NOT_FOUND(appFolder);
|
|
2783
|
+
if (logger?.warn) {
|
|
2784
|
+
logger.warn(message);
|
|
2785
|
+
} else {
|
|
2786
|
+
logger?.info(`Warning: ${message}`);
|
|
2787
|
+
}
|
|
2788
|
+
return;
|
|
2789
|
+
}
|
|
2790
|
+
const stat = await this.fileSystem.stat(appFolder);
|
|
2791
|
+
if (!stat?.isDirectory()) {
|
|
2792
|
+
const message = ERROR_MESSAGES.APP_FOLDER_NOT_DIRECTORY(appFolder);
|
|
2793
|
+
if (logger?.warn) {
|
|
2794
|
+
logger.warn(message);
|
|
2795
|
+
} else {
|
|
2796
|
+
logger?.info(`Warning: ${message}`);
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
async packageAsync(args) {
|
|
2801
|
+
const { projectPath, manifest, outputPath, packageInfo, logger } = args;
|
|
2802
|
+
logger?.info(`Packaging JS variant: ${packageInfo.id}@${packageInfo.version}`);
|
|
2803
|
+
const appFolder = Path.join(projectPath, APP_FOLDER_NAME);
|
|
2804
|
+
logger?.progress("Validating .app folder...");
|
|
2805
|
+
const appFolderExists = await this.fileSystem.exists(appFolder);
|
|
2806
|
+
if (!appFolderExists) {
|
|
2807
|
+
throw new Error(ERROR_MESSAGES.APP_FOLDER_NOT_FOUND(appFolder));
|
|
2808
|
+
}
|
|
2809
|
+
const appFolderStat = await this.fileSystem.stat(appFolder);
|
|
2810
|
+
if (!appFolderStat?.isDirectory()) {
|
|
2811
|
+
throw new Error(ERROR_MESSAGES.APP_FOLDER_NOT_DIRECTORY(appFolder));
|
|
2812
|
+
}
|
|
2813
|
+
const localBuildFolder = Path.join(outputPath, NugetConstants.OutputFolderName);
|
|
2814
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
2815
|
+
const contentAppFolder = Path.join(contentFolder, CONTENT_APP_FOLDER_NAME);
|
|
2816
|
+
await this.fileSystem.mkdir(contentFolder);
|
|
2817
|
+
try {
|
|
2818
|
+
logger?.progress("Copying .app folder into content/app...");
|
|
2819
|
+
await copyDirectoryAsync(this.fileSystem, appFolder, contentAppFolder);
|
|
2820
|
+
logger?.progress("Preparing metadata files...");
|
|
2821
|
+
await this.prepareMetadataFiles(contentFolder, contentAppFolder, packageInfo, manifest, projectPath);
|
|
2822
|
+
logger?.progress("Creating NuGet package...");
|
|
2823
|
+
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
2824
|
+
const nupkgPath = Path.join(outputPath, nupkgFileName);
|
|
2825
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
2826
|
+
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
2827
|
+
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
2828
|
+
return result.outputPath;
|
|
2829
|
+
} finally {
|
|
2830
|
+
try {
|
|
2831
|
+
await this.fileSystem.rm(localBuildFolder);
|
|
2832
|
+
} catch (cleanupError) {
|
|
2833
|
+
logger?.error(`Failed to cleanup build folder: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
async prepareMetadataFiles(contentFolder, _contentAppFolder, _packageInfo, _manifest, projectPath) {
|
|
2838
|
+
const mainFile = "index.html";
|
|
2839
|
+
const mainRelativeToContent = `${CONTENT_APP_FOLDER_NAME}/${mainFile}`;
|
|
2840
|
+
const operatePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
2841
|
+
const operateModel = {
|
|
2842
|
+
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
2843
|
+
main: mainRelativeToContent,
|
|
2844
|
+
contentType: ProjectTypes.WebApp,
|
|
2845
|
+
targetFramework: TargetFramework.Portable,
|
|
2846
|
+
targetRuntime: TARGET_JS_RUNTIME,
|
|
2847
|
+
runtimeOptions: {
|
|
2848
|
+
requiresUserInteraction: false,
|
|
2849
|
+
isAttended: false
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
2853
|
+
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
2854
|
+
const manifestSourcePath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
2855
|
+
const manifestDestPath = Path.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME);
|
|
2856
|
+
const manifestExists = await this.fileSystem.exists(manifestSourcePath);
|
|
2857
|
+
if (manifestExists) {
|
|
2858
|
+
const manifestContent = await this.fileSystem.readFile(manifestSourcePath);
|
|
2859
|
+
if (manifestContent) {
|
|
2860
|
+
await this.fileSystem.writeFile(manifestDestPath, manifestContent);
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
const uipathJsonSourcePath = Path.join(projectPath, "uipath.json");
|
|
2864
|
+
const uipathJsonDestPath = Path.join(contentFolder, "uipath.json");
|
|
2865
|
+
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
2866
|
+
if (uipathJsonExists) {
|
|
2867
|
+
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath);
|
|
2868
|
+
if (uipathJsonContent) {
|
|
2869
|
+
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
const bindingsPath = Path.join(contentFolder, "bindings.json");
|
|
2873
|
+
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
2874
|
+
if (!bindingsExists) {
|
|
2875
|
+
const bindingsJson = JSON.stringify({ version: "1.0", resources: [] }, null, 2);
|
|
2876
|
+
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
2877
|
+
}
|
|
2878
|
+
const bindingsV2Path = Path.join(contentFolder, "bindings_v2.json");
|
|
2879
|
+
const bindingsV2Exists = await this.fileSystem.exists(bindingsV2Path);
|
|
2880
|
+
if (!bindingsV2Exists) {
|
|
2881
|
+
const bindingsV2Json = JSON.stringify({ version: "2.0", resources: [] }, null, 2);
|
|
2882
|
+
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
2883
|
+
}
|
|
2884
|
+
const entryPointsPath = Path.join(contentFolder, "entry-points.json");
|
|
2885
|
+
const projectEntryPointsPath = Path.join(projectPath, "entry-points.json");
|
|
2886
|
+
let entryPointsContent;
|
|
2887
|
+
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
2888
|
+
if (projectEntryPointsExists) {
|
|
2889
|
+
const entryPointsData = await this.fileSystem.readFile(projectEntryPointsPath);
|
|
2890
|
+
if (entryPointsData) {
|
|
2891
|
+
entryPointsContent = new TextDecoder().decode(entryPointsData);
|
|
2892
|
+
} else {
|
|
2893
|
+
entryPointsContent = this.createDefaultEntryPoints(mainRelativeToContent);
|
|
2894
|
+
}
|
|
2895
|
+
} else {
|
|
2896
|
+
entryPointsContent = this.createDefaultEntryPoints(mainRelativeToContent);
|
|
2897
|
+
}
|
|
2898
|
+
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
2899
|
+
const packageDescriptorPath = Path.join(contentFolder, NugetConstants.PackageDescriptorFileName);
|
|
2900
|
+
const packageDescriptor = {
|
|
2901
|
+
files: {
|
|
2902
|
+
[NugetConstants.OperateFileName]: Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName),
|
|
2903
|
+
"entry-points.json": Path.join(NugetConstants.ContentFolderName, "entry-points.json"),
|
|
2904
|
+
"bindings.json": Path.join(NugetConstants.ContentFolderName, "bindings_v2.json")
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
2908
|
+
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
2909
|
+
}
|
|
2910
|
+
createDefaultEntryPoints(mainFilePath) {
|
|
2911
|
+
const uniqueId = this.generateUniqueId();
|
|
2912
|
+
const entryPoints = {
|
|
2913
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
2914
|
+
$id: "entry-points-doc-001",
|
|
2915
|
+
entryPoints: [
|
|
2916
|
+
{
|
|
2917
|
+
filePath: mainFilePath,
|
|
2918
|
+
uniqueId,
|
|
2919
|
+
type: DEFAULT_ENTRY_POINT_TYPE,
|
|
2920
|
+
input: {
|
|
2921
|
+
amount: { type: "integer" },
|
|
2922
|
+
id: { type: "string" }
|
|
2923
|
+
},
|
|
2924
|
+
output: {
|
|
2925
|
+
status: { type: "string" }
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
]
|
|
2929
|
+
};
|
|
2930
|
+
return JSON.stringify(entryPoints, null, 2);
|
|
2931
|
+
}
|
|
2932
|
+
generateUniqueId() {
|
|
2933
|
+
const randomBytes = new Uint8Array(16);
|
|
2934
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
2935
|
+
crypto.getRandomValues(randomBytes);
|
|
2936
|
+
} else {
|
|
2937
|
+
throw new Error("crypto.getRandomValues is not available");
|
|
2938
|
+
}
|
|
2939
|
+
randomBytes[6] = randomBytes[6] & 15 | 64;
|
|
2940
|
+
randomBytes[8] = randomBytes[8] & 63 | 128;
|
|
2941
|
+
const hex = Array.from(randomBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2942
|
+
return [
|
|
2943
|
+
hex.substring(0, 8),
|
|
2944
|
+
hex.substring(8, 12),
|
|
2945
|
+
hex.substring(12, 16),
|
|
2946
|
+
hex.substring(16, 20),
|
|
2947
|
+
hex.substring(20, 32)
|
|
2948
|
+
].join("-");
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
// ../packager/packager-tool-webapp/src/strategies/variant-strategy-factory.ts
|
|
2953
|
+
class VariantStrategyFactory {
|
|
2954
|
+
static createStrategy(manifest, fileSystem) {
|
|
2955
|
+
const variant = manifest.type;
|
|
2956
|
+
switch (variant) {
|
|
2957
|
+
case "Coded" /* Coded */:
|
|
2958
|
+
return new CodedAppStrategy(fileSystem);
|
|
2959
|
+
case "JS" /* JS */:
|
|
2960
|
+
return new JsAppsStrategy(fileSystem);
|
|
2961
|
+
default:
|
|
2962
|
+
throw new Error(`Unknown WebApp variant: ${manifest.type}. Supported variants: ${Object.values(WebAppVariantType).join(", ")}`);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
// ../packager/packager-tool-webapp/src/webapp-tool.ts
|
|
2968
|
+
class WebAppTool extends ProjectTool {
|
|
2969
|
+
_temporaryStorage;
|
|
2970
|
+
_tempBuildFolder = null;
|
|
2971
|
+
constructor(fileSystem, logger) {
|
|
2972
|
+
super(fileSystem, logger);
|
|
2973
|
+
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
2974
|
+
}
|
|
2975
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
2976
|
+
this.logger.info("Restore operation is not required for WebApp projects");
|
|
2977
|
+
return ToolResult.success();
|
|
2978
|
+
}
|
|
2979
|
+
async validateAsync(options, _cancellationToken) {
|
|
2980
|
+
if (!options.projectPath) {
|
|
2981
|
+
return this.handleError(new Error(ERROR_MESSAGES.PROJECT_PATH_REQUIRED), "Validation");
|
|
2982
|
+
}
|
|
2983
|
+
try {
|
|
2984
|
+
this.logger.info("Validating WebApp project...");
|
|
2985
|
+
let manifest;
|
|
2986
|
+
let strategy;
|
|
2987
|
+
try {
|
|
2988
|
+
const prepared = await this.getManifestAndStrategy(options.projectPath);
|
|
2989
|
+
manifest = prepared.manifest;
|
|
2990
|
+
strategy = prepared.strategy;
|
|
2991
|
+
} catch (error) {
|
|
2992
|
+
return this.handleError(error, "Validation");
|
|
2993
|
+
}
|
|
2994
|
+
try {
|
|
2995
|
+
if (strategy.validateAsync) {
|
|
2996
|
+
await strategy.validateAsync({
|
|
2997
|
+
fileSystem: this.fileSystem,
|
|
2998
|
+
projectPath: options.projectPath,
|
|
2999
|
+
manifest,
|
|
3000
|
+
logger: this.createStrategyLogger()
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
} catch (error) {
|
|
3004
|
+
return this.handleError(error, "Validation");
|
|
3005
|
+
}
|
|
3006
|
+
this.logger.info("WebApp project validation completed");
|
|
3007
|
+
return ToolResult.success();
|
|
3008
|
+
} catch (error) {
|
|
3009
|
+
return this.handleError(error, "Validation");
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
async buildAsync(_options, _cancellationToken) {
|
|
3013
|
+
this.logger.info("Build operation for WebApp is lightweight (metadata preparation only)");
|
|
3014
|
+
return ToolResult.success();
|
|
3015
|
+
}
|
|
3016
|
+
async packAsync(options, _cancellationToken) {
|
|
3017
|
+
if (!options.projectPath) {
|
|
3018
|
+
return this.handleError(new Error(ERROR_MESSAGES.PROJECT_PATH_REQUIRED), "Packing");
|
|
3019
|
+
}
|
|
3020
|
+
if (!options.outputPath) {
|
|
3021
|
+
return this.handleError(new Error(ERROR_MESSAGES.OUTPUT_PATH_REQUIRED), "Packing");
|
|
3022
|
+
}
|
|
3023
|
+
if (!options.package?.id) {
|
|
3024
|
+
return this.handleError(new Error(ERROR_MESSAGES.PACKAGE_NAME_REQUIRED), "Packing");
|
|
3025
|
+
}
|
|
3026
|
+
if (!options.package?.version) {
|
|
3027
|
+
return this.handleError(new Error(ERROR_MESSAGES.PACKAGE_VERSION_REQUIRED), "Packing");
|
|
3028
|
+
}
|
|
3029
|
+
try {
|
|
3030
|
+
this.logger.info(`Packing WebApp project: ${options.package.id}@${options.package.version}`);
|
|
3031
|
+
let manifest;
|
|
3032
|
+
let strategy;
|
|
3033
|
+
try {
|
|
3034
|
+
const prepared = await this.getManifestAndStrategy(options.projectPath);
|
|
3035
|
+
manifest = prepared.manifest;
|
|
3036
|
+
strategy = prepared.strategy;
|
|
3037
|
+
} catch (error) {
|
|
3038
|
+
return this.handleError(error, `Packing WebApp project '${options.package.id}'`);
|
|
3039
|
+
}
|
|
3040
|
+
const nupkgPath = await strategy.packageAsync({
|
|
3041
|
+
fileSystem: this.fileSystem,
|
|
3042
|
+
projectPath: options.projectPath,
|
|
3043
|
+
manifest,
|
|
3044
|
+
outputPath: options.outputPath,
|
|
3045
|
+
packageInfo: options.package,
|
|
3046
|
+
logger: this.createStrategyLogger()
|
|
3047
|
+
});
|
|
3048
|
+
this.logger.info(`WebApp package created successfully: ${nupkgPath}`);
|
|
3049
|
+
return new ToolResult(ToolErrorCodes.Success, "done", [nupkgPath]);
|
|
3050
|
+
} catch (error) {
|
|
3051
|
+
return this.handleError(error, `Packing WebApp project '${options.package.id}'`);
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
async dispose() {
|
|
3055
|
+
this.logger.info("Disposing WebApp Tool");
|
|
3056
|
+
try {
|
|
3057
|
+
if (this._tempBuildFolder) {
|
|
3058
|
+
await this.fileSystem.rm(this._tempBuildFolder);
|
|
3059
|
+
this._tempBuildFolder = null;
|
|
3060
|
+
}
|
|
3061
|
+
await this._temporaryStorage.cleanup();
|
|
3062
|
+
} catch {}
|
|
3063
|
+
}
|
|
3064
|
+
async getManifestAndStrategy(projectPath) {
|
|
3065
|
+
const manifestPath = Path.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
3066
|
+
const manifestExists = await this.fileSystem.exists(manifestPath);
|
|
3067
|
+
if (!manifestExists) {
|
|
3068
|
+
throw new Error(ERROR_MESSAGES.MANIFEST_NOT_FOUND(WEBAPP_MANIFEST_FILE_NAME));
|
|
3069
|
+
}
|
|
3070
|
+
const projectJsonPath = Path.join(projectPath, PROJECT_JSON_FILE);
|
|
3071
|
+
if (await this.fileSystem.exists(projectJsonPath)) {
|
|
3072
|
+
throw new Error(ERROR_MESSAGES.PROJECT_JSON_FOUND);
|
|
3073
|
+
}
|
|
3074
|
+
const manifest = await loadWebAppManifest(this.fileSystem, projectPath);
|
|
3075
|
+
if (!manifest) {
|
|
3076
|
+
throw new Error(ERROR_MESSAGES.MANIFEST_LOAD_FAILED(WEBAPP_MANIFEST_FILE_NAME));
|
|
3077
|
+
}
|
|
3078
|
+
const strategy = VariantStrategyFactory.createStrategy(manifest, this.fileSystem);
|
|
3079
|
+
return { manifest, strategy };
|
|
3080
|
+
}
|
|
3081
|
+
handleError(error, context) {
|
|
3082
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3083
|
+
this.logger.error(`${context}: ${errorMessage}`);
|
|
3084
|
+
let userMessage;
|
|
3085
|
+
if (context === "Validation") {
|
|
3086
|
+
userMessage = ERROR_MESSAGES.VALIDATION_FAILED(errorMessage);
|
|
3087
|
+
} else if (context.startsWith("Packing")) {
|
|
3088
|
+
userMessage = ERROR_MESSAGES.PACKING_FAILED(errorMessage);
|
|
3089
|
+
} else {
|
|
3090
|
+
userMessage = errorMessage;
|
|
3091
|
+
}
|
|
3092
|
+
return ToolResult.error(ToolErrorCodes.InternalError, userMessage);
|
|
3093
|
+
}
|
|
3094
|
+
createStrategyLogger() {
|
|
3095
|
+
return {
|
|
3096
|
+
info: (msg) => this.logger.info(msg),
|
|
3097
|
+
error: (msg) => this.logger.error(msg),
|
|
3098
|
+
progress: (msg) => this.logger.progress(msg),
|
|
3099
|
+
warn: (msg) => this.logger.warn(msg)
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
// ../packager/packager-tool-webapp/src/webapp-tool-factory.ts
|
|
3104
|
+
class WebAppToolFactory {
|
|
3105
|
+
supportedTypes = [ProjectTypes.AppV2];
|
|
3106
|
+
async createAsync(logger, fileSystem) {
|
|
3107
|
+
return new WebAppTool(fileSystem, logger);
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
// ../../node_modules/@uipath/resource-builder-tool/dist/index.js
|
|
3111
|
+
function _define_property(obj, key, value) {
|
|
3112
|
+
if (key in obj)
|
|
3113
|
+
Object.defineProperty(obj, key, {
|
|
3114
|
+
value,
|
|
3115
|
+
enumerable: true,
|
|
3116
|
+
configurable: true,
|
|
3117
|
+
writable: true
|
|
3118
|
+
});
|
|
3119
|
+
else
|
|
3120
|
+
obj[key] = value;
|
|
3121
|
+
return obj;
|
|
3122
|
+
}
|
|
3123
|
+
var KNOWN_ARCHIVE_FILE_NAMES = {
|
|
3124
|
+
packageInfoJsonFileName: "packageInfo.json",
|
|
3125
|
+
metadataJsonFileName: "solutionMetadata.json"
|
|
3126
|
+
};
|
|
3127
|
+
var KNOWN_ARCHIVE_FOLDERS = {
|
|
3128
|
+
files: "files",
|
|
3129
|
+
resources: "resources"
|
|
3130
|
+
};
|
|
3131
|
+
var PACKAGE_DEFAULTS = {
|
|
3132
|
+
currentVersion: "v1",
|
|
3133
|
+
defaultPackageVersion: "1.0.0",
|
|
3134
|
+
defaultAuthorName: "UiPath",
|
|
3135
|
+
unifiedBuildPackageType: "unified",
|
|
3136
|
+
currentDocVersion: "1.0.0",
|
|
3137
|
+
rootFolderName: "solution_folder"
|
|
3138
|
+
};
|
|
3139
|
+
var JWT_CLAIMS = {
|
|
3140
|
+
firstName: "first_name",
|
|
3141
|
+
lastName: "last_name",
|
|
3142
|
+
email: "email",
|
|
3143
|
+
userId: "sub",
|
|
3144
|
+
partition: "prt_id"
|
|
3145
|
+
};
|
|
3146
|
+
var RESILIENCE_DEFAULTS = {
|
|
3147
|
+
maxRetryAttempts: 3,
|
|
3148
|
+
retryIntervalMs: 1000,
|
|
3149
|
+
maxRedirectRetries: 10
|
|
3150
|
+
};
|
|
3151
|
+
var MAX_DOWNLOAD_CONCURRENCY = 8;
|
|
3152
|
+
var RETRIABLE_STATUS_CODES = [
|
|
3153
|
+
500,
|
|
3154
|
+
502,
|
|
3155
|
+
503,
|
|
3156
|
+
504
|
|
3157
|
+
];
|
|
3158
|
+
var INVALID_FILE_NAME_CHARS = /[<>:"/\\|?*\x00-\x1f\s]/g;
|
|
3159
|
+
var MAX_SERVER_MESSAGE_LENGTH = 100;
|
|
3160
|
+
var MAX_BUILD_OUTPUT_SIZE_BYTES = 524288000;
|
|
3161
|
+
|
|
3162
|
+
class OperationCancelledException extends Error {
|
|
3163
|
+
constructor(message) {
|
|
3164
|
+
super(message ?? "The operation was cancelled");
|
|
3165
|
+
this.name = "OperationCancelledException";
|
|
3166
|
+
if (Error.captureStackTrace)
|
|
3167
|
+
Error.captureStackTrace(this, OperationCancelledException);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
function mapHttpStatusCodeToReason(status) {
|
|
3171
|
+
switch (status) {
|
|
3172
|
+
case 404:
|
|
3173
|
+
return "NotFound";
|
|
3174
|
+
case 401:
|
|
3175
|
+
return "Unauthorized";
|
|
3176
|
+
case 403:
|
|
3177
|
+
return "Forbidden";
|
|
3178
|
+
case 400:
|
|
3179
|
+
return "BadRequest";
|
|
3180
|
+
case 408:
|
|
3181
|
+
case 504:
|
|
3182
|
+
return "Timeout";
|
|
3183
|
+
default:
|
|
3184
|
+
if (status >= 500)
|
|
3185
|
+
return "ServerError";
|
|
3186
|
+
return "Unknown";
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
function truncateMessage(message, maxLength) {
|
|
3190
|
+
if (!message)
|
|
3191
|
+
return message;
|
|
3192
|
+
if (message.length <= maxLength)
|
|
3193
|
+
return message;
|
|
3194
|
+
return message.substring(0, maxLength) + "...";
|
|
3195
|
+
}
|
|
3196
|
+
function buildFailureMessage(failures) {
|
|
3197
|
+
const lines = [
|
|
3198
|
+
`Failed to download ${failures.length} file(s):`
|
|
3199
|
+
];
|
|
3200
|
+
for (const failure of failures)
|
|
3201
|
+
lines.push(` - FileKey: ${failure.fileKey}, Service: ${failure.service}, Url: ${failure.externalUrl}, Reason: ${failure.reason}, Message: ${failure.errorMessage ?? ""}`);
|
|
3202
|
+
return lines.join(`
|
|
3203
|
+
`);
|
|
3204
|
+
}
|
|
3205
|
+
function isArtefactResource(resource) {
|
|
3206
|
+
return resource.projectKey != null && resource.projectKey.trim() !== "";
|
|
3207
|
+
}
|
|
3208
|
+
var JSON_INDENT = 2;
|
|
3209
|
+
function shouldExcludeValue(value) {
|
|
3210
|
+
if (value == null)
|
|
3211
|
+
return true;
|
|
3212
|
+
if (value === false)
|
|
3213
|
+
return true;
|
|
3214
|
+
if (value === 0)
|
|
3215
|
+
return true;
|
|
3216
|
+
if (value === "")
|
|
3217
|
+
return true;
|
|
3218
|
+
if (Array.isArray(value) && value.length === 0)
|
|
3219
|
+
return true;
|
|
3220
|
+
return false;
|
|
3221
|
+
}
|
|
3222
|
+
function serializeJson(obj) {
|
|
3223
|
+
return JSON.stringify(obj, (_key, value) => shouldExcludeValue(value) ? undefined : value, JSON_INDENT);
|
|
3224
|
+
}
|
|
3225
|
+
function decodeJwtPayload(token) {
|
|
3226
|
+
try {
|
|
3227
|
+
const parts = token.split(".");
|
|
3228
|
+
if (parts.length !== 3)
|
|
3229
|
+
return null;
|
|
3230
|
+
const payload = parts[1];
|
|
3231
|
+
const base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
|
|
3232
|
+
const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
|
|
3233
|
+
const decoded = atob(padded);
|
|
3234
|
+
return JSON.parse(decoded);
|
|
3235
|
+
} catch {
|
|
3236
|
+
return null;
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
function extractDataFromAccessToken(accessToken) {
|
|
3240
|
+
if (!accessToken)
|
|
3241
|
+
return {};
|
|
3242
|
+
const payload = decodeJwtPayload(accessToken);
|
|
3243
|
+
if (!payload)
|
|
3244
|
+
return {};
|
|
3245
|
+
const getString = (key) => {
|
|
3246
|
+
const value = payload[key];
|
|
3247
|
+
return typeof value == "string" && value.trim() !== "" ? value : undefined;
|
|
3248
|
+
};
|
|
3249
|
+
return {
|
|
3250
|
+
email: getString(JWT_CLAIMS.email),
|
|
3251
|
+
firstName: getString(JWT_CLAIMS.firstName),
|
|
3252
|
+
lastName: getString(JWT_CLAIMS.lastName),
|
|
3253
|
+
userId: getString(JWT_CLAIMS.userId),
|
|
3254
|
+
partitionId: getString(JWT_CLAIMS.partition)
|
|
3255
|
+
};
|
|
3256
|
+
}
|
|
3257
|
+
function isRetriableStatusCode(status) {
|
|
3258
|
+
return RETRIABLE_STATUS_CODES.includes(status);
|
|
3259
|
+
}
|
|
3260
|
+
function isRedirectStatusCode(status) {
|
|
3261
|
+
return status === 302 || status === 303;
|
|
3262
|
+
}
|
|
3263
|
+
function isClientError(status) {
|
|
3264
|
+
return status >= 400 && status < 500;
|
|
3265
|
+
}
|
|
3266
|
+
function delay(ms, cancellationToken) {
|
|
3267
|
+
return new Promise((resolve, reject) => {
|
|
3268
|
+
if (cancellationToken?.aborted)
|
|
3269
|
+
return void reject(new OperationCancelledException);
|
|
3270
|
+
const timeoutId = setTimeout(resolve, ms);
|
|
3271
|
+
cancellationToken?.addEventListener("abort", () => {
|
|
3272
|
+
clearTimeout(timeoutId);
|
|
3273
|
+
reject(new OperationCancelledException);
|
|
3274
|
+
}, {
|
|
3275
|
+
once: true
|
|
3276
|
+
});
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
function throwIfCancelled(cancellationToken) {
|
|
3280
|
+
if (cancellationToken?.aborted)
|
|
3281
|
+
throw new OperationCancelledException;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
class Semaphore {
|
|
3285
|
+
async acquire() {
|
|
3286
|
+
if (this.permits > 0)
|
|
3287
|
+
return void this.permits--;
|
|
3288
|
+
return new Promise((resolve) => {
|
|
3289
|
+
this.waitQueue.push(resolve);
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
release() {
|
|
3293
|
+
const next = this.waitQueue.shift();
|
|
3294
|
+
if (next)
|
|
3295
|
+
next();
|
|
3296
|
+
else
|
|
3297
|
+
this.permits++;
|
|
3298
|
+
}
|
|
3299
|
+
constructor(permits) {
|
|
3300
|
+
_define_property(this, "permits", undefined);
|
|
3301
|
+
_define_property(this, "waitQueue", []);
|
|
3302
|
+
this.permits = permits;
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
class ResourceBuilderTool extends SolutionTool {
|
|
3307
|
+
async buildAsync(options, cancellationToken) {
|
|
3308
|
+
this.logger.info("Build starting.");
|
|
3309
|
+
this.inputPath = Path.dirname(options.solutionFilePath);
|
|
3310
|
+
try {
|
|
3311
|
+
throwIfCancelled(cancellationToken);
|
|
3312
|
+
const accessToken = options.connection?.accessToken;
|
|
3313
|
+
const tokenData = extractDataFromAccessToken(accessToken);
|
|
3314
|
+
const existingResources = await this.readFromDirectory(KNOWN_ARCHIVE_FOLDERS.resources, cancellationToken);
|
|
3315
|
+
this.logger.info(`Read ${existingResources.length} existing resources from ${KNOWN_ARCHIVE_FOLDERS.resources} directory.`);
|
|
3316
|
+
if (existingResources && existingResources.length > 0) {
|
|
3317
|
+
throwIfCancelled(cancellationToken);
|
|
3318
|
+
const filteredResources = this.filterResources(existingResources, options);
|
|
3319
|
+
await this.writeResources(filteredResources, options, cancellationToken);
|
|
3320
|
+
} else
|
|
3321
|
+
throw new Error("No resources found to build.");
|
|
3322
|
+
await this.writePackageFiles(options, tokenData, cancellationToken);
|
|
3323
|
+
const sizeLimitError = await this.enforceOutputSizeLimit(options.outputPath);
|
|
3324
|
+
if (sizeLimitError)
|
|
3325
|
+
return sizeLimitError;
|
|
3326
|
+
this.logger.info("Build finished.");
|
|
3327
|
+
return ToolResult.success();
|
|
3328
|
+
} catch (error) {
|
|
3329
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3330
|
+
this.logger.error(`Build failed: ${message}`);
|
|
3331
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `Build failed: ${message}`);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
async enforceOutputSizeLimit(outputPath) {
|
|
3335
|
+
const filesDirectory = Path.join(outputPath, KNOWN_ARCHIVE_FOLDERS.files);
|
|
3336
|
+
if (!await this.fileSystem.exists(filesDirectory))
|
|
3337
|
+
return null;
|
|
3338
|
+
const totalBytes = await this.getTotalDirectorySize(filesDirectory);
|
|
3339
|
+
if (totalBytes <= MAX_BUILD_OUTPUT_SIZE_BYTES)
|
|
3340
|
+
return null;
|
|
3341
|
+
const maxMb = Math.floor(MAX_BUILD_OUTPUT_SIZE_BYTES / 1024 / 1024);
|
|
3342
|
+
const currentMb = Math.floor(totalBytes / 1024 / 1024);
|
|
3343
|
+
const message = `The built solution exceeds the maximum allowed size of ${maxMb} MB (current size: ${currentMb} MB). Solutions larger than this cannot be uploaded. Reduce the size by removing unused packages, splitting the solution into smaller solutions, or trimming large binary assets.`;
|
|
3344
|
+
this.logger.error(`Built solution size ${currentMb} MB exceeds maximum allowed ${maxMb} MB.`);
|
|
3345
|
+
return ToolResult.error(ToolErrorCodes.InternalError, message);
|
|
3346
|
+
}
|
|
3347
|
+
async getTotalDirectorySize(dirPath) {
|
|
3348
|
+
let total = 0;
|
|
3349
|
+
const stack = [
|
|
3350
|
+
dirPath
|
|
3351
|
+
];
|
|
3352
|
+
let current = stack.pop();
|
|
3353
|
+
while (current !== undefined) {
|
|
3354
|
+
const entries = await this.fileSystem.readdir(current);
|
|
3355
|
+
for (const entry of entries) {
|
|
3356
|
+
const fullPath = Path.join(current, entry);
|
|
3357
|
+
const stats = await this.fileSystem.stat(fullPath);
|
|
3358
|
+
if (stats) {
|
|
3359
|
+
if (stats.isDirectory())
|
|
3360
|
+
stack.push(fullPath);
|
|
3361
|
+
else if (stats.isFile())
|
|
3362
|
+
total += stats.size;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
current = stack.pop();
|
|
3366
|
+
}
|
|
3367
|
+
return total;
|
|
3368
|
+
}
|
|
3369
|
+
async restoreAsync(options, cancellationToken) {
|
|
3370
|
+
this.logger.info("Restore starting.");
|
|
3371
|
+
this.inputPath = Path.dirname(options.solutionFilePath);
|
|
3372
|
+
try {
|
|
3373
|
+
throwIfCancelled(cancellationToken);
|
|
3374
|
+
const existingResources = await this.readFromDirectory(KNOWN_ARCHIVE_FOLDERS.resources, cancellationToken);
|
|
3375
|
+
this.logger.info(`Read ${existingResources.length} existing resources from ${KNOWN_ARCHIVE_FOLDERS.resources} directory.`);
|
|
3376
|
+
if (existingResources.length === 0) {
|
|
3377
|
+
this.logger.error("Solution definition empty or not found.");
|
|
3378
|
+
return ToolResult.error(ToolErrorCodes.InternalError, "Solution definition empty or not found.");
|
|
3379
|
+
}
|
|
3380
|
+
const filteredResources = this.filterResources(existingResources, {
|
|
3381
|
+
configuration: options.configuration,
|
|
3382
|
+
projectsToBuild: options.projectsToBuild
|
|
3383
|
+
});
|
|
3384
|
+
const files = this.extractFilesFromResources(filteredResources);
|
|
3385
|
+
const filesToDownload = files.filter((f) => f.url != null);
|
|
3386
|
+
if (filesToDownload.length === 0) {
|
|
3387
|
+
this.logger.info("No files to download.");
|
|
3388
|
+
this.logger.info("Restore finished.");
|
|
3389
|
+
return ToolResult.success();
|
|
3390
|
+
}
|
|
3391
|
+
const outputPath = options.outputPath ?? "";
|
|
3392
|
+
const downloadTasks = [];
|
|
3393
|
+
const semaphore = new Semaphore(MAX_DOWNLOAD_CONCURRENCY);
|
|
3394
|
+
for (const file of filesToDownload) {
|
|
3395
|
+
throwIfCancelled(cancellationToken);
|
|
3396
|
+
this.logger.info(`Downloading file ${file.name} kind ${file.kind} from service url ${file.url}...`);
|
|
3397
|
+
const resource = this.findResourceForFile(filteredResources, file);
|
|
3398
|
+
if (!resource) {
|
|
3399
|
+
this.logger.warn(`File with name '${file.name}', kind '${file.kind}', key '${file.key}' not referenced by any resource.`);
|
|
3400
|
+
continue;
|
|
3401
|
+
}
|
|
3402
|
+
const filePath = Path.join(outputPath, KNOWN_ARCHIVE_FOLDERS.files, file.key, file.name);
|
|
3403
|
+
if (await this.fileSystem.exists(filePath)) {
|
|
3404
|
+
this.logger.info(`File ${file.name} already exists at ${filePath}, skipping download.`);
|
|
3405
|
+
continue;
|
|
3406
|
+
}
|
|
3407
|
+
const dirPath = Path.dirname(filePath);
|
|
3408
|
+
await this.fileSystem.mkdir(dirPath);
|
|
3409
|
+
const serviceName = resource.apiVersion ?? "unknown";
|
|
3410
|
+
downloadTasks.push(this.downloadFileWithSemaphore(semaphore, file, filePath, serviceName, options, cancellationToken));
|
|
3411
|
+
}
|
|
3412
|
+
if (downloadTasks.length === 0) {
|
|
3413
|
+
this.logger.info("No files to download.");
|
|
3414
|
+
this.logger.info("Restore finished.");
|
|
3415
|
+
return ToolResult.success();
|
|
3416
|
+
}
|
|
3417
|
+
const results = await Promise.all(downloadTasks);
|
|
3418
|
+
const failures = results.filter((r) => !r.isSuccess && r.failure != null).map((r) => r.failure);
|
|
3419
|
+
if (failures.length > 0) {
|
|
3420
|
+
for (const failure of failures)
|
|
3421
|
+
this.logger.error(`Download failed for file ${failure.fileKey} from service ${failure.service} at ${failure.externalUrl}. Reason: ${failure.reason}. ${failure.errorMessage ?? ""}`);
|
|
3422
|
+
const message = buildFailureMessage(failures);
|
|
3423
|
+
this.logger.error(message);
|
|
3424
|
+
return ToolResult.error(ToolErrorCodes.InternalError, message);
|
|
3425
|
+
}
|
|
3426
|
+
this.logger.info("Restore finished.");
|
|
3427
|
+
return ToolResult.success();
|
|
3428
|
+
} catch (error) {
|
|
3429
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3430
|
+
this.logger.error(`Restore failed: ${message}`);
|
|
3431
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `Restore failed: ${message}`);
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
async validateAsync(options, cancellationToken) {
|
|
3435
|
+
this.logger.info("Validate starting.");
|
|
3436
|
+
if (options.solutionFilePath === undefined)
|
|
3437
|
+
throw new Error("Solution file path is undefined.");
|
|
3438
|
+
this.inputPath = Path.dirname(options.solutionFilePath);
|
|
3439
|
+
try {
|
|
3440
|
+
throwIfCancelled(cancellationToken);
|
|
3441
|
+
const packageVersion = options.packageVersion;
|
|
3442
|
+
if (packageVersion !== undefined && !this.isValidSemanticVersion(packageVersion)) {
|
|
3443
|
+
this.logger.error(`Invalid package version ${packageVersion}`);
|
|
3444
|
+
return ToolResult.error("VALIDATION_ERROR", `Invalid package version: ${packageVersion}`);
|
|
3445
|
+
}
|
|
3446
|
+
this.logger.info("Validate finished.");
|
|
3447
|
+
return ToolResult.success();
|
|
3448
|
+
} catch (error) {
|
|
3449
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3450
|
+
this.logger.error(`Validation failed: ${message}`);
|
|
3451
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `Validation failed: ${message}`);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
async readFromDirectory(folderName, cancellationToken) {
|
|
3455
|
+
const basePath = this.inputPath;
|
|
3456
|
+
const folderPath = folderName ? Path.join(basePath, folderName) : basePath;
|
|
3457
|
+
const resources = [];
|
|
3458
|
+
if (!await this.fileSystem.exists(folderPath))
|
|
3459
|
+
return resources;
|
|
3460
|
+
throwIfCancelled(cancellationToken);
|
|
3461
|
+
const allFiles = await this.readFilesRecursively(folderPath, cancellationToken);
|
|
3462
|
+
const jsonFiles = allFiles.filter((f) => f.endsWith(".json"));
|
|
3463
|
+
this.logger.info(`Found ${jsonFiles.length} resource JSON files in ${folderName ?? basePath} directory.`);
|
|
3464
|
+
const failedFiles = [];
|
|
3465
|
+
for (const fileRelativeToFolder of jsonFiles) {
|
|
3466
|
+
throwIfCancelled(cancellationToken);
|
|
3467
|
+
const normalizedFileRelative = fileRelativeToFolder.replace(/\\/g, "/");
|
|
3468
|
+
const relativeToBasePath = folderName ? `${folderName}/${normalizedFileRelative}` : normalizedFileRelative;
|
|
3469
|
+
try {
|
|
3470
|
+
const fullFilePath = Path.join(basePath, relativeToBasePath);
|
|
3471
|
+
const content = await this.fileSystem.readFile(fullFilePath);
|
|
3472
|
+
if (!content) {
|
|
3473
|
+
this.logger.warn(`Failed to read resource file: ${relativeToBasePath}`);
|
|
3474
|
+
continue;
|
|
3475
|
+
}
|
|
3476
|
+
const jsonContent = new TextDecoder().decode(content);
|
|
3477
|
+
const wrapper = JSON.parse(jsonContent);
|
|
3478
|
+
if (wrapper?.resource) {
|
|
3479
|
+
const rd = wrapper.resource;
|
|
3480
|
+
const normalizedPath = fileRelativeToFolder.replace(/\\/g, "/");
|
|
3481
|
+
const segments = normalizedPath.split("/").filter((s) => s.length > 0);
|
|
3482
|
+
if (segments.length >= 2) {
|
|
3483
|
+
const hasType = rd.type != null && rd.type.trim() !== "";
|
|
3484
|
+
const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
|
|
3485
|
+
if (folderSegmentCount < 1)
|
|
3486
|
+
rd.folders = [
|
|
3487
|
+
{
|
|
3488
|
+
fullyQualifiedName: PACKAGE_DEFAULTS.rootFolderName
|
|
3489
|
+
}
|
|
3490
|
+
];
|
|
3491
|
+
else {
|
|
3492
|
+
const segmentsToUse = segments.slice(0, folderSegmentCount);
|
|
3493
|
+
const folderFqn = segmentsToUse.join("/");
|
|
3494
|
+
rd.folders = [
|
|
3495
|
+
{
|
|
3496
|
+
fullyQualifiedName: folderFqn
|
|
3497
|
+
}
|
|
3498
|
+
];
|
|
3499
|
+
}
|
|
3500
|
+
} else
|
|
3501
|
+
rd.folders = [
|
|
3502
|
+
{
|
|
3503
|
+
fullyQualifiedName: PACKAGE_DEFAULTS.rootFolderName
|
|
3504
|
+
}
|
|
3505
|
+
];
|
|
3506
|
+
resources.push(rd);
|
|
3507
|
+
this.logger.info(`Read resource: ${rd.name} kind: ${rd.kind} from ${relativeToBasePath}`);
|
|
3508
|
+
}
|
|
3509
|
+
} catch (ex) {
|
|
3510
|
+
const message = ex instanceof Error ? ex.message : String(ex);
|
|
3511
|
+
this.logger.error(`Failed to read resource file ${relativeToBasePath}: ${message}`);
|
|
3512
|
+
failedFiles.push(relativeToBasePath);
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
if (failedFiles.length > 0)
|
|
3516
|
+
throw new Error(`Failed to read resource files: ${failedFiles.join(", ")}`);
|
|
3517
|
+
return resources;
|
|
3518
|
+
}
|
|
3519
|
+
async readFilesRecursively(basePath, cancellationToken) {
|
|
3520
|
+
const results = [];
|
|
3521
|
+
const processDirectory = async (currentPath, relativePath) => {
|
|
3522
|
+
throwIfCancelled(cancellationToken);
|
|
3523
|
+
const entries = await this.fileSystem.readdir(currentPath);
|
|
3524
|
+
for (const entry of entries) {
|
|
3525
|
+
const fullPath = Path.join(currentPath, entry);
|
|
3526
|
+
const relPath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
3527
|
+
const stats = await this.fileSystem.stat(fullPath);
|
|
3528
|
+
if (stats?.isDirectory())
|
|
3529
|
+
await processDirectory(fullPath, relPath);
|
|
3530
|
+
else if (stats?.isFile())
|
|
3531
|
+
results.push(relPath);
|
|
3532
|
+
}
|
|
3533
|
+
};
|
|
3534
|
+
await processDirectory(basePath, "");
|
|
3535
|
+
return results;
|
|
3536
|
+
}
|
|
3537
|
+
filterResources(resources, options) {
|
|
3538
|
+
const { projectsToBuild, configuration } = options;
|
|
3539
|
+
if (!resources)
|
|
3540
|
+
return [];
|
|
3541
|
+
if (configuration !== BuildConfiguration.Debug)
|
|
3542
|
+
return resources;
|
|
3543
|
+
if (!projectsToBuild || projectsToBuild.length === 0)
|
|
3544
|
+
return resources;
|
|
3545
|
+
const projectsToBuildSet = new Set(projectsToBuild);
|
|
3546
|
+
return resources.filter((resource) => {
|
|
3547
|
+
if (!isArtefactResource(resource))
|
|
3548
|
+
return true;
|
|
3549
|
+
const projectKey = resource.projectKey;
|
|
3550
|
+
if (!projectKey || !projectsToBuildSet.has(projectKey)) {
|
|
3551
|
+
this.logger.info(`Artefact resource skipped: ${resource.key}`);
|
|
3552
|
+
return false;
|
|
3553
|
+
}
|
|
3554
|
+
return true;
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
async writeResources(resources, options, cancellationToken) {
|
|
3558
|
+
for (const resource of resources) {
|
|
3559
|
+
throwIfCancelled(cancellationToken);
|
|
3560
|
+
const resourcePath = this.buildResourceRelativePath(resource);
|
|
3561
|
+
const fullPath = Path.join(options.outputPath, resourcePath);
|
|
3562
|
+
const dirPath = Path.dirname(fullPath);
|
|
3563
|
+
await this.fileSystem.mkdir(dirPath);
|
|
3564
|
+
const wrapper = {
|
|
3565
|
+
docVersion: PACKAGE_DEFAULTS.currentDocVersion,
|
|
3566
|
+
resource
|
|
3567
|
+
};
|
|
3568
|
+
await this.fileSystem.writeFile(fullPath, serializeJson(wrapper));
|
|
3569
|
+
this.logger.info(`Writing resource file for resource ${resource.key}`);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
buildResourceRelativePath(resource) {
|
|
3573
|
+
const safeName = this.sanitizeFileName(resource.name);
|
|
3574
|
+
const folderFqn = resource.folders[0]?.fullyQualifiedName ?? "";
|
|
3575
|
+
const parts = [
|
|
3576
|
+
KNOWN_ARCHIVE_FOLDERS.resources
|
|
3577
|
+
];
|
|
3578
|
+
const folderSegments = folderFqn.split("/").filter((s) => s.length > 0);
|
|
3579
|
+
if (folderSegments.length > 0)
|
|
3580
|
+
parts.push(...folderSegments);
|
|
3581
|
+
else
|
|
3582
|
+
parts.push(PACKAGE_DEFAULTS.rootFolderName);
|
|
3583
|
+
parts.push(resource.kind);
|
|
3584
|
+
if (resource.type && resource.type.trim())
|
|
3585
|
+
parts.push(resource.type);
|
|
3586
|
+
parts.push(`${safeName}.json`);
|
|
3587
|
+
return Path.join(...parts);
|
|
3588
|
+
}
|
|
3589
|
+
sanitizeFileName(name) {
|
|
3590
|
+
return name.replace(INVALID_FILE_NAME_CHARS, "_");
|
|
3591
|
+
}
|
|
3592
|
+
isValidSemanticVersion(version) {
|
|
3593
|
+
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
3594
|
+
return semverRegex.test(version);
|
|
3595
|
+
}
|
|
3596
|
+
async writePackageFiles(options, tokenData, cancellationToken) {
|
|
3597
|
+
throwIfCancelled(cancellationToken);
|
|
3598
|
+
const packageName = options.package.id;
|
|
3599
|
+
if (!packageName)
|
|
3600
|
+
throw new Error("Package name not found");
|
|
3601
|
+
const packageVersion = options.package.version ?? PACKAGE_DEFAULTS.defaultPackageVersion;
|
|
3602
|
+
const uipxContentBuffer = await this.fileSystem.readFile(options.solutionFilePath);
|
|
3603
|
+
if (!uipxContentBuffer)
|
|
3604
|
+
throw new Error(`Failed to read solution file: ${options.solutionFilePath}`);
|
|
3605
|
+
const uipxContent = new TextDecoder().decode(uipxContentBuffer);
|
|
3606
|
+
const uipxData = JSON.parse(uipxContent);
|
|
3607
|
+
if (!uipxData.SolutionId)
|
|
3608
|
+
throw new Error(`SolutionId not found in solution file: ${options.solutionFilePath}`);
|
|
3609
|
+
const solutionId = uipxData.SolutionId;
|
|
3610
|
+
this.logger.info(`Extracted SolutionId from .uipx file: ${solutionId}`);
|
|
3611
|
+
let authorName = options.package.author;
|
|
3612
|
+
if (!authorName) {
|
|
3613
|
+
const nameParts = [
|
|
3614
|
+
tokenData.firstName,
|
|
3615
|
+
tokenData.lastName
|
|
3616
|
+
].filter((s) => s != null && s.trim() !== "");
|
|
3617
|
+
authorName = nameParts.length > 0 ? nameParts.join(" ").trim() : PACKAGE_DEFAULTS.defaultAuthorName;
|
|
3618
|
+
}
|
|
3619
|
+
const packageVersionKey = options.publishId ?? crypto.randomUUID();
|
|
3620
|
+
const metadata = {
|
|
3621
|
+
authorEmail: tokenData.email,
|
|
3622
|
+
authorName,
|
|
3623
|
+
description: options.package.description,
|
|
3624
|
+
releaseNotes: options.package.releaseNotes,
|
|
3625
|
+
packageName,
|
|
3626
|
+
packageVersion,
|
|
3627
|
+
projectKey: solutionId,
|
|
3628
|
+
packageVersionKey,
|
|
3629
|
+
origin: "Studio",
|
|
3630
|
+
configuration: options.configuration
|
|
3631
|
+
};
|
|
3632
|
+
this.logger.info(`Creating solution package with name '${metadata.packageName}' and version '${metadata.packageVersion}'.`);
|
|
3633
|
+
await this.writePackageInfo(options.outputPath);
|
|
3634
|
+
throwIfCancelled(cancellationToken);
|
|
3635
|
+
await this.writeMetadata(options.outputPath, metadata);
|
|
3636
|
+
}
|
|
3637
|
+
async writePackageInfo(outputPath) {
|
|
3638
|
+
const packageInfo = {
|
|
3639
|
+
version: PACKAGE_DEFAULTS.currentVersion,
|
|
3640
|
+
type: PACKAGE_DEFAULTS.unifiedBuildPackageType
|
|
3641
|
+
};
|
|
3642
|
+
const packageInfoPath = Path.join(outputPath, KNOWN_ARCHIVE_FILE_NAMES.packageInfoJsonFileName);
|
|
3643
|
+
await this.fileSystem.writeFile(packageInfoPath, serializeJson(packageInfo));
|
|
3644
|
+
}
|
|
3645
|
+
async writeMetadata(outputPath, metadata) {
|
|
3646
|
+
const metadataResource = {
|
|
3647
|
+
apiVersion: "solutions.uipath.com/v1",
|
|
3648
|
+
kind: "Metadata",
|
|
3649
|
+
spec: metadata
|
|
3650
|
+
};
|
|
3651
|
+
const metadataPath = Path.join(outputPath, KNOWN_ARCHIVE_FILE_NAMES.metadataJsonFileName);
|
|
3652
|
+
await this.fileSystem.writeFile(metadataPath, serializeJson(metadataResource));
|
|
3653
|
+
}
|
|
3654
|
+
async downloadFile(file, filePath, serviceName, options, cancellationToken) {
|
|
3655
|
+
const maxRetryAttempts = RESILIENCE_DEFAULTS.maxRetryAttempts;
|
|
3656
|
+
const retryIntervalMs = RESILIENCE_DEFAULTS.retryIntervalMs;
|
|
3657
|
+
const accessToken = options.connection?.accessToken;
|
|
3658
|
+
const externalUrl = file.url;
|
|
3659
|
+
if (!externalUrl)
|
|
3660
|
+
throw new Error("File URL is required for download");
|
|
3661
|
+
let currentUrl = externalUrl;
|
|
3662
|
+
let redirectCount = 0;
|
|
3663
|
+
const createFailure = (reason, errorMessage) => ({
|
|
3664
|
+
isSuccess: false,
|
|
3665
|
+
failure: {
|
|
3666
|
+
fileKey: file.key,
|
|
3667
|
+
service: serviceName,
|
|
3668
|
+
externalUrl,
|
|
3669
|
+
reason,
|
|
3670
|
+
errorMessage: truncateMessage(errorMessage, MAX_SERVER_MESSAGE_LENGTH)
|
|
3671
|
+
}
|
|
3672
|
+
});
|
|
3673
|
+
try {
|
|
3674
|
+
while (redirectCount < RESILIENCE_DEFAULTS.maxRedirectRetries) {
|
|
3675
|
+
const response = await this.fetchWithRetry(currentUrl, accessToken, maxRetryAttempts, retryIntervalMs, file.name, cancellationToken);
|
|
3676
|
+
if (isRedirectStatusCode(response.status)) {
|
|
3677
|
+
const location = response.headers.get("location");
|
|
3678
|
+
if (!location)
|
|
3679
|
+
return createFailure("TooManyRedirects", "Redirect response without location header");
|
|
3680
|
+
currentUrl = location;
|
|
3681
|
+
redirectCount++;
|
|
3682
|
+
this.logger.info(`Following redirect for file ${file.name} to ${location}`);
|
|
3683
|
+
continue;
|
|
3684
|
+
}
|
|
3685
|
+
if (isClientError(response.status)) {
|
|
3686
|
+
const serverMessage = await this.readResponseTextSafe(response);
|
|
3687
|
+
if (accessToken) {
|
|
3688
|
+
this.logger.info(`Retrying download of file ${file.name} without access token`);
|
|
3689
|
+
const retryResponse = await this.fetchWithRetry(currentUrl, undefined, maxRetryAttempts, retryIntervalMs, file.name, cancellationToken);
|
|
3690
|
+
if (retryResponse.ok) {
|
|
3691
|
+
const buffer2 = await retryResponse.arrayBuffer();
|
|
3692
|
+
await this.fileSystem.writeFile(filePath, Buffer.from(buffer2));
|
|
3693
|
+
this.logger.info(`File ${file.name} written to ${filePath}.`);
|
|
3694
|
+
return {
|
|
3695
|
+
isSuccess: true
|
|
3696
|
+
};
|
|
3697
|
+
}
|
|
3698
|
+
const retryServerMessage = await this.readResponseTextSafe(retryResponse);
|
|
3699
|
+
return createFailure(mapHttpStatusCodeToReason(retryResponse.status), retryServerMessage ?? `HTTP ${retryResponse.status}`);
|
|
3700
|
+
}
|
|
3701
|
+
return createFailure(mapHttpStatusCodeToReason(response.status), serverMessage ?? `HTTP ${response.status}`);
|
|
3702
|
+
}
|
|
3703
|
+
if (!response.ok) {
|
|
3704
|
+
const serverMessage = await this.readResponseTextSafe(response);
|
|
3705
|
+
return createFailure(mapHttpStatusCodeToReason(response.status), serverMessage ?? `HTTP ${response.status}: ${response.statusText}`);
|
|
3706
|
+
}
|
|
3707
|
+
const buffer = await response.arrayBuffer();
|
|
3708
|
+
await this.fileSystem.writeFile(filePath, Buffer.from(buffer));
|
|
3709
|
+
this.logger.info(`File ${file.name} written to ${filePath}.`);
|
|
3710
|
+
return {
|
|
3711
|
+
isSuccess: true
|
|
3712
|
+
};
|
|
3713
|
+
}
|
|
3714
|
+
return createFailure("TooManyRedirects", "Too many redirects");
|
|
3715
|
+
} catch (error) {
|
|
3716
|
+
if (cancellationToken?.aborted)
|
|
3717
|
+
return createFailure("Cancelled", "Operation was cancelled");
|
|
3718
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3719
|
+
if (message.toLowerCase().includes("timeout") || message.toLowerCase().includes("timed out"))
|
|
3720
|
+
return createFailure("Timeout", message);
|
|
3721
|
+
if (message.toLowerCase().includes("network") || message.toLowerCase().includes("econnrefused") || message.toLowerCase().includes("enotfound"))
|
|
3722
|
+
return createFailure("ConnectionError", message);
|
|
3723
|
+
return createFailure("Unknown", message);
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
async readResponseTextSafe(response) {
|
|
3727
|
+
try {
|
|
3728
|
+
const text = await response.text();
|
|
3729
|
+
return truncateMessage(text, MAX_SERVER_MESSAGE_LENGTH);
|
|
3730
|
+
} catch {
|
|
3731
|
+
return;
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
extractFilesFromResources(resources) {
|
|
3735
|
+
const files = [];
|
|
3736
|
+
for (const resource of resources)
|
|
3737
|
+
if (resource.files && resource.files.length !== 0)
|
|
3738
|
+
for (const file of resource.files)
|
|
3739
|
+
files.push({
|
|
3740
|
+
name: file.name,
|
|
3741
|
+
kind: file.kind,
|
|
3742
|
+
key: file.key ?? resource.key ?? "",
|
|
3743
|
+
url: file.url
|
|
3744
|
+
});
|
|
3745
|
+
return files;
|
|
3746
|
+
}
|
|
3747
|
+
findResourceForFile(resources, file) {
|
|
3748
|
+
return resources.find((resource) => {
|
|
3749
|
+
if (!resource.files || resource.files.length === 0)
|
|
3750
|
+
return false;
|
|
3751
|
+
return resource.files.some((rf) => rf.name === file.name && rf.kind === file.kind);
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
async downloadFileWithSemaphore(semaphore, file, filePath, serviceName, options, cancellationToken) {
|
|
3755
|
+
await semaphore.acquire();
|
|
3756
|
+
try {
|
|
3757
|
+
return await this.downloadFile(file, filePath, serviceName, options, cancellationToken);
|
|
3758
|
+
} finally {
|
|
3759
|
+
semaphore.release();
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
async fetchWithRetry(url, accessToken, maxRetryAttempts, retryIntervalMs, fileName, cancellationToken) {
|
|
3763
|
+
let lastError;
|
|
3764
|
+
for (let attempt = 1;attempt <= maxRetryAttempts + 1; attempt++)
|
|
3765
|
+
try {
|
|
3766
|
+
const response = await fetch(url, {
|
|
3767
|
+
signal: cancellationToken,
|
|
3768
|
+
headers: accessToken ? {
|
|
3769
|
+
Authorization: `Bearer ${accessToken}`
|
|
3770
|
+
} : undefined,
|
|
3771
|
+
redirect: "manual"
|
|
3772
|
+
});
|
|
3773
|
+
if (isRetriableStatusCode(response.status) && attempt <= maxRetryAttempts) {
|
|
3774
|
+
const delayMs = retryIntervalMs * attempt;
|
|
3775
|
+
this.logger.warn(`Retriable error (HTTP ${response.status}) downloading file ${fileName}, attempt ${attempt}/${maxRetryAttempts}. Retrying in ${delayMs}ms...`);
|
|
3776
|
+
await delay(delayMs, cancellationToken);
|
|
3777
|
+
continue;
|
|
3778
|
+
}
|
|
3779
|
+
return response;
|
|
3780
|
+
} catch (error) {
|
|
3781
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
3782
|
+
if (attempt <= maxRetryAttempts) {
|
|
3783
|
+
const delayMs = retryIntervalMs * attempt;
|
|
3784
|
+
this.logger.warn(`Network error downloading file ${fileName}, attempt ${attempt}/${maxRetryAttempts}: ${lastError.message}. Retrying in ${delayMs}ms...`);
|
|
3785
|
+
await delay(delayMs, cancellationToken);
|
|
3786
|
+
continue;
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
throw lastError ?? new Error(`Failed to download file ${fileName} after ${maxRetryAttempts} retries`);
|
|
3790
|
+
}
|
|
3791
|
+
constructor(fileSystem, logger) {
|
|
3792
|
+
super(fileSystem, logger), _define_property(this, "inputPath", "");
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
class ResourceBuilderToolFactory {
|
|
3797
|
+
async createAsync(logger, fileSystem) {
|
|
3798
|
+
return new ResourceBuilderTool(fileSystem, logger);
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
// ../packager/packager-core/src/i18n/types.ts
|
|
3802
|
+
function isPluralForm2(value) {
|
|
3803
|
+
return typeof value === "object" && value !== null && "other" in value;
|
|
3804
|
+
}
|
|
3805
|
+
function selectPluralForm2(forms, count) {
|
|
3806
|
+
if (count === 0 && forms.zero !== undefined) {
|
|
3807
|
+
return forms.zero;
|
|
3808
|
+
}
|
|
3809
|
+
if (count === 1 && forms.one !== undefined) {
|
|
3810
|
+
return forms.one;
|
|
3811
|
+
}
|
|
3812
|
+
if (count === 2 && forms.two !== undefined) {
|
|
3813
|
+
return forms.two;
|
|
3814
|
+
}
|
|
3815
|
+
if (forms.few !== undefined) {
|
|
3816
|
+
const mod10 = count % 10;
|
|
3817
|
+
const mod100 = count % 100;
|
|
3818
|
+
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
|
|
3819
|
+
return forms.few;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
if (forms.many !== undefined) {
|
|
3823
|
+
const mod10 = count % 10;
|
|
3824
|
+
const mod100 = count % 100;
|
|
3825
|
+
if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
|
|
3826
|
+
return forms.many;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
return forms.other;
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
// ../packager/packager-core/src/i18n/i18n-manager.ts
|
|
3833
|
+
class I18nManager2 {
|
|
3834
|
+
static translations = {};
|
|
3835
|
+
static currentLocale = "en";
|
|
3836
|
+
static fallbackLocale = "en";
|
|
3837
|
+
static registerTranslations(locale, catalog) {
|
|
3838
|
+
if (!I18nManager2.translations[locale]) {
|
|
3839
|
+
I18nManager2.translations[locale] = {};
|
|
3840
|
+
}
|
|
3841
|
+
I18nManager2.translations[locale] = I18nManager2.deepMerge(I18nManager2.translations[locale], catalog);
|
|
3842
|
+
}
|
|
3843
|
+
static setLocale(locale) {
|
|
3844
|
+
const normalized = I18nManager2.normalizeLocale(locale);
|
|
3845
|
+
if (I18nManager2.translations[normalized]) {
|
|
3846
|
+
I18nManager2.currentLocale = normalized;
|
|
3847
|
+
return normalized;
|
|
3848
|
+
}
|
|
3849
|
+
const baseLocale = normalized.split("-")[0];
|
|
3850
|
+
if (baseLocale !== normalized && I18nManager2.translations[baseLocale]) {
|
|
3851
|
+
I18nManager2.currentLocale = baseLocale;
|
|
3852
|
+
return baseLocale;
|
|
3853
|
+
}
|
|
3854
|
+
return I18nManager2.currentLocale;
|
|
3855
|
+
}
|
|
3856
|
+
static getLocale() {
|
|
3857
|
+
return I18nManager2.currentLocale;
|
|
3858
|
+
}
|
|
3859
|
+
static setFallbackLocale(locale) {
|
|
3860
|
+
I18nManager2.fallbackLocale = I18nManager2.normalizeLocale(locale);
|
|
3861
|
+
}
|
|
3862
|
+
static t(key, params, locale) {
|
|
3863
|
+
const targetLocale = locale ? I18nManager2.normalizeLocale(locale) : I18nManager2.currentLocale;
|
|
3864
|
+
let value = I18nManager2.getTranslationValue(key, targetLocale);
|
|
3865
|
+
if (value === undefined && targetLocale !== I18nManager2.fallbackLocale) {
|
|
3866
|
+
value = I18nManager2.getTranslationValue(key, I18nManager2.fallbackLocale);
|
|
3867
|
+
}
|
|
3868
|
+
if (value === undefined) {
|
|
3869
|
+
return key;
|
|
3870
|
+
}
|
|
3871
|
+
if (isPluralForm2(value) && params && "count" in params) {
|
|
3872
|
+
const count = typeof params.count === "number" ? params.count : Number(params.count);
|
|
3873
|
+
value = selectPluralForm2(value, count);
|
|
3874
|
+
} else if (isPluralForm2(value)) {
|
|
3875
|
+
value = value.other;
|
|
3876
|
+
}
|
|
3877
|
+
if (typeof value !== "string") {
|
|
3878
|
+
return key;
|
|
3879
|
+
}
|
|
3880
|
+
return params ? I18nManager2.interpolate(value, params) : value;
|
|
3881
|
+
}
|
|
3882
|
+
static has(key, locale) {
|
|
3883
|
+
const targetLocale = locale ? I18nManager2.normalizeLocale(locale) : I18nManager2.currentLocale;
|
|
3884
|
+
const value = I18nManager2.getTranslationValue(key, targetLocale);
|
|
3885
|
+
if (value !== undefined) {
|
|
3886
|
+
return true;
|
|
3887
|
+
}
|
|
3888
|
+
if (targetLocale !== I18nManager2.fallbackLocale) {
|
|
3889
|
+
return I18nManager2.getTranslationValue(key, I18nManager2.fallbackLocale) !== undefined;
|
|
3890
|
+
}
|
|
3891
|
+
return false;
|
|
3892
|
+
}
|
|
3893
|
+
static getAvailableLocales() {
|
|
3894
|
+
return Object.keys(I18nManager2.translations);
|
|
3895
|
+
}
|
|
3896
|
+
static clearTranslations() {
|
|
3897
|
+
I18nManager2.translations = {};
|
|
3898
|
+
I18nManager2.currentLocale = "en";
|
|
3899
|
+
}
|
|
3900
|
+
static getTranslationValue(key, locale) {
|
|
3901
|
+
const catalog = I18nManager2.translations[locale];
|
|
3902
|
+
if (!catalog) {
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
const keys = key.split(".");
|
|
3906
|
+
let value = catalog;
|
|
3907
|
+
for (const k of keys) {
|
|
3908
|
+
if (value && typeof value === "object" && k in value) {
|
|
3909
|
+
value = value[k];
|
|
3910
|
+
} else {
|
|
3911
|
+
return;
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
return value;
|
|
3915
|
+
}
|
|
3916
|
+
static interpolate(template, params) {
|
|
3917
|
+
return template.replace(/\{(\w+)\}/g, (_, key) => {
|
|
3918
|
+
const value = params[key];
|
|
3919
|
+
return value !== undefined ? String(value) : `{${key}}`;
|
|
3920
|
+
});
|
|
3921
|
+
}
|
|
3922
|
+
static normalizeLocale(locale) {
|
|
3923
|
+
const normalized = locale.toLowerCase().replace(/_/g, "-");
|
|
3924
|
+
const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
|
|
3925
|
+
if (specialLocales.includes(normalized)) {
|
|
3926
|
+
return normalized;
|
|
3927
|
+
}
|
|
3928
|
+
return normalized.split("-")[0];
|
|
3929
|
+
}
|
|
3930
|
+
static deepMerge(target, source) {
|
|
3931
|
+
const result = { ...target };
|
|
3932
|
+
for (const key of Object.keys(source)) {
|
|
3933
|
+
const sourceValue = source[key];
|
|
3934
|
+
const targetValue = result[key];
|
|
3935
|
+
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
|
|
3936
|
+
result[key] = I18nManager2.deepMerge(targetValue, sourceValue);
|
|
3937
|
+
} else {
|
|
3938
|
+
result[key] = sourceValue;
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
return result;
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
// ../packager/packager-core/src/i18n/locales/de.ts
|
|
3946
|
+
var de2 = {
|
|
3947
|
+
toolCore: {
|
|
3948
|
+
errors: {
|
|
3949
|
+
internal: "Internal error: {message}",
|
|
3950
|
+
fileNotFound: "File not found: {path}",
|
|
3951
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
3952
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
3953
|
+
directoryNotFound: "Directory not found: {path}",
|
|
3954
|
+
invalidPath: "{path} is not a valid path",
|
|
3955
|
+
operationCanceled: "Operation was canceled",
|
|
3956
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
3957
|
+
},
|
|
3958
|
+
progress: {
|
|
3959
|
+
copying: "Copying files...",
|
|
3960
|
+
building: "Building project...",
|
|
3961
|
+
packaging: "Creating package...",
|
|
3962
|
+
validating: "Validating...",
|
|
3963
|
+
analyzing: "Analyzing...",
|
|
3964
|
+
restoring: "Restoring dependencies..."
|
|
3965
|
+
},
|
|
3966
|
+
validation: {
|
|
3967
|
+
requiredField: "{field} is required",
|
|
3968
|
+
invalidValue: "Invalid value for {field}",
|
|
3969
|
+
pathNotFound: "Path not found: {path}",
|
|
3970
|
+
fileRequired: "File is required: {path}",
|
|
3971
|
+
directoryRequired: "Directory is required: {path}"
|
|
3972
|
+
},
|
|
3973
|
+
warnings: {
|
|
3974
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
3975
|
+
},
|
|
3976
|
+
info: {
|
|
3977
|
+
operationComplete: "Operation completed successfully",
|
|
3978
|
+
filesProcessed: {
|
|
3979
|
+
zero: "No files processed",
|
|
3980
|
+
one: "{count} file processed",
|
|
3981
|
+
other: "{count} files processed"
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
};
|
|
3986
|
+
|
|
3987
|
+
// ../packager/packager-core/src/i18n/locales/en.ts
|
|
3988
|
+
var en2 = {
|
|
3989
|
+
toolCore: {
|
|
3990
|
+
errors: {
|
|
3991
|
+
internal: "Internal error: {message}",
|
|
3992
|
+
fileNotFound: "File not found: {path}",
|
|
3993
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
3994
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
3995
|
+
directoryNotFound: "Directory not found: {path}",
|
|
3996
|
+
invalidPath: "{path} is not a valid path",
|
|
3997
|
+
operationCanceled: "Operation was canceled",
|
|
3998
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
3999
|
+
},
|
|
4000
|
+
progress: {
|
|
4001
|
+
copying: "Copying files...",
|
|
4002
|
+
building: "Building project...",
|
|
4003
|
+
packaging: "Creating package...",
|
|
4004
|
+
validating: "Validating...",
|
|
4005
|
+
analyzing: "Analyzing...",
|
|
4006
|
+
restoring: "Restoring dependencies..."
|
|
4007
|
+
},
|
|
4008
|
+
validation: {
|
|
4009
|
+
requiredField: "{field} is required",
|
|
4010
|
+
invalidValue: "Invalid value for {field}",
|
|
4011
|
+
pathNotFound: "Path not found: {path}",
|
|
4012
|
+
fileRequired: "File is required: {path}",
|
|
4013
|
+
directoryRequired: "Directory is required: {path}"
|
|
4014
|
+
},
|
|
4015
|
+
warnings: {
|
|
4016
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4017
|
+
},
|
|
4018
|
+
info: {
|
|
4019
|
+
operationComplete: "Operation completed successfully",
|
|
4020
|
+
filesProcessed: {
|
|
4021
|
+
zero: "No files processed",
|
|
4022
|
+
one: "{count} file processed",
|
|
4023
|
+
other: "{count} files processed"
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
|
|
4029
|
+
// ../packager/packager-core/src/i18n/locales/es.ts
|
|
4030
|
+
var es2 = {
|
|
4031
|
+
toolCore: {
|
|
4032
|
+
errors: {
|
|
4033
|
+
internal: "Internal error: {message}",
|
|
4034
|
+
fileNotFound: "File not found: {path}",
|
|
4035
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4036
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4037
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4038
|
+
invalidPath: "{path} is not a valid path",
|
|
4039
|
+
operationCanceled: "Operation was canceled",
|
|
4040
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4041
|
+
},
|
|
4042
|
+
progress: {
|
|
4043
|
+
copying: "Copying files...",
|
|
4044
|
+
building: "Building project...",
|
|
4045
|
+
packaging: "Creating package...",
|
|
4046
|
+
validating: "Validating...",
|
|
4047
|
+
analyzing: "Analyzing...",
|
|
4048
|
+
restoring: "Restoring dependencies..."
|
|
4049
|
+
},
|
|
4050
|
+
validation: {
|
|
4051
|
+
requiredField: "{field} is required",
|
|
4052
|
+
invalidValue: "Invalid value for {field}",
|
|
4053
|
+
pathNotFound: "Path not found: {path}",
|
|
4054
|
+
fileRequired: "File is required: {path}",
|
|
4055
|
+
directoryRequired: "Directory is required: {path}"
|
|
4056
|
+
},
|
|
4057
|
+
warnings: {
|
|
4058
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4059
|
+
},
|
|
4060
|
+
info: {
|
|
4061
|
+
operationComplete: "Operation completed successfully",
|
|
4062
|
+
filesProcessed: {
|
|
4063
|
+
zero: "No files processed",
|
|
4064
|
+
one: "{count} file processed",
|
|
4065
|
+
other: "{count} files processed"
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
};
|
|
4070
|
+
|
|
4071
|
+
// ../packager/packager-core/src/i18n/locales/es-MX.ts
|
|
4072
|
+
var es_MX2 = {
|
|
4073
|
+
toolCore: {
|
|
4074
|
+
errors: {
|
|
4075
|
+
internal: "Internal error: {message}",
|
|
4076
|
+
fileNotFound: "File not found: {path}",
|
|
4077
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4078
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4079
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4080
|
+
invalidPath: "{path} is not a valid path",
|
|
4081
|
+
operationCanceled: "Operation was canceled",
|
|
4082
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4083
|
+
},
|
|
4084
|
+
progress: {
|
|
4085
|
+
copying: "Copying files...",
|
|
4086
|
+
building: "Building project...",
|
|
4087
|
+
packaging: "Creating package...",
|
|
4088
|
+
validating: "Validating...",
|
|
4089
|
+
analyzing: "Analyzing...",
|
|
4090
|
+
restoring: "Restoring dependencies..."
|
|
4091
|
+
},
|
|
4092
|
+
validation: {
|
|
4093
|
+
requiredField: "{field} is required",
|
|
4094
|
+
invalidValue: "Invalid value for {field}",
|
|
4095
|
+
pathNotFound: "Path not found: {path}",
|
|
4096
|
+
fileRequired: "File is required: {path}",
|
|
4097
|
+
directoryRequired: "Directory is required: {path}"
|
|
4098
|
+
},
|
|
4099
|
+
warnings: {
|
|
4100
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4101
|
+
},
|
|
4102
|
+
info: {
|
|
4103
|
+
operationComplete: "Operation completed successfully",
|
|
4104
|
+
filesProcessed: {
|
|
4105
|
+
zero: "No files processed",
|
|
4106
|
+
one: "{count} file processed",
|
|
4107
|
+
other: "{count} files processed"
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
};
|
|
4112
|
+
|
|
4113
|
+
// ../packager/packager-core/src/i18n/locales/fr.ts
|
|
4114
|
+
var fr2 = {
|
|
4115
|
+
toolCore: {
|
|
4116
|
+
errors: {
|
|
4117
|
+
internal: "Internal error: {message}",
|
|
4118
|
+
fileNotFound: "File not found: {path}",
|
|
4119
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4120
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4121
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4122
|
+
invalidPath: "{path} is not a valid path",
|
|
4123
|
+
operationCanceled: "Operation was canceled",
|
|
4124
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4125
|
+
},
|
|
4126
|
+
progress: {
|
|
4127
|
+
copying: "Copying files...",
|
|
4128
|
+
building: "Building project...",
|
|
4129
|
+
packaging: "Creating package...",
|
|
4130
|
+
validating: "Validating...",
|
|
4131
|
+
analyzing: "Analyzing...",
|
|
4132
|
+
restoring: "Restoring dependencies..."
|
|
4133
|
+
},
|
|
4134
|
+
validation: {
|
|
4135
|
+
requiredField: "{field} is required",
|
|
4136
|
+
invalidValue: "Invalid value for {field}",
|
|
4137
|
+
pathNotFound: "Path not found: {path}",
|
|
4138
|
+
fileRequired: "File is required: {path}",
|
|
4139
|
+
directoryRequired: "Directory is required: {path}"
|
|
4140
|
+
},
|
|
4141
|
+
warnings: {
|
|
4142
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4143
|
+
},
|
|
4144
|
+
info: {
|
|
4145
|
+
operationComplete: "Operation completed successfully",
|
|
4146
|
+
filesProcessed: {
|
|
4147
|
+
zero: "No files processed",
|
|
4148
|
+
one: "{count} file processed",
|
|
4149
|
+
other: "{count} files processed"
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
};
|
|
4154
|
+
|
|
4155
|
+
// ../packager/packager-core/src/i18n/locales/ja.ts
|
|
4156
|
+
var ja2 = {
|
|
4157
|
+
toolCore: {
|
|
4158
|
+
errors: {
|
|
4159
|
+
internal: "Internal error: {message}",
|
|
4160
|
+
fileNotFound: "File not found: {path}",
|
|
4161
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4162
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4163
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4164
|
+
invalidPath: "{path} is not a valid path",
|
|
4165
|
+
operationCanceled: "Operation was canceled",
|
|
4166
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4167
|
+
},
|
|
4168
|
+
progress: {
|
|
4169
|
+
copying: "Copying files...",
|
|
4170
|
+
building: "Building project...",
|
|
4171
|
+
packaging: "Creating package...",
|
|
4172
|
+
validating: "Validating...",
|
|
4173
|
+
analyzing: "Analyzing...",
|
|
4174
|
+
restoring: "Restoring dependencies..."
|
|
4175
|
+
},
|
|
4176
|
+
validation: {
|
|
4177
|
+
requiredField: "{field} is required",
|
|
4178
|
+
invalidValue: "Invalid value for {field}",
|
|
4179
|
+
pathNotFound: "Path not found: {path}",
|
|
4180
|
+
fileRequired: "File is required: {path}",
|
|
4181
|
+
directoryRequired: "Directory is required: {path}"
|
|
4182
|
+
},
|
|
4183
|
+
warnings: {
|
|
4184
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4185
|
+
},
|
|
4186
|
+
info: {
|
|
4187
|
+
operationComplete: "Operation completed successfully",
|
|
4188
|
+
filesProcessed: {
|
|
4189
|
+
zero: "No files processed",
|
|
4190
|
+
one: "{count} file processed",
|
|
4191
|
+
other: "{count} files processed"
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
};
|
|
4196
|
+
|
|
4197
|
+
// ../packager/packager-core/src/i18n/locales/ko.ts
|
|
4198
|
+
var ko2 = {
|
|
4199
|
+
toolCore: {
|
|
4200
|
+
errors: {
|
|
4201
|
+
internal: "Internal error: {message}",
|
|
4202
|
+
fileNotFound: "File not found: {path}",
|
|
4203
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4204
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4205
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4206
|
+
invalidPath: "{path} is not a valid path",
|
|
4207
|
+
operationCanceled: "Operation was canceled",
|
|
4208
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4209
|
+
},
|
|
4210
|
+
progress: {
|
|
4211
|
+
copying: "Copying files...",
|
|
4212
|
+
building: "Building project...",
|
|
4213
|
+
packaging: "Creating package...",
|
|
4214
|
+
validating: "Validating...",
|
|
4215
|
+
analyzing: "Analyzing...",
|
|
4216
|
+
restoring: "Restoring dependencies..."
|
|
4217
|
+
},
|
|
4218
|
+
validation: {
|
|
4219
|
+
requiredField: "{field} is required",
|
|
4220
|
+
invalidValue: "Invalid value for {field}",
|
|
4221
|
+
pathNotFound: "Path not found: {path}",
|
|
4222
|
+
fileRequired: "File is required: {path}",
|
|
4223
|
+
directoryRequired: "Directory is required: {path}"
|
|
4224
|
+
},
|
|
4225
|
+
warnings: {
|
|
4226
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4227
|
+
},
|
|
4228
|
+
info: {
|
|
4229
|
+
operationComplete: "Operation completed successfully",
|
|
4230
|
+
filesProcessed: {
|
|
4231
|
+
zero: "No files processed",
|
|
4232
|
+
one: "{count} file processed",
|
|
4233
|
+
other: "{count} files processed"
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
};
|
|
4238
|
+
|
|
4239
|
+
// ../packager/packager-core/src/i18n/locales/pt.ts
|
|
4240
|
+
var pt2 = {
|
|
4241
|
+
toolCore: {
|
|
4242
|
+
errors: {
|
|
4243
|
+
internal: "Internal error: {message}",
|
|
4244
|
+
fileNotFound: "File not found: {path}",
|
|
4245
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4246
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4247
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4248
|
+
invalidPath: "{path} is not a valid path",
|
|
4249
|
+
operationCanceled: "Operation was canceled",
|
|
4250
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4251
|
+
},
|
|
4252
|
+
progress: {
|
|
4253
|
+
copying: "Copying files...",
|
|
4254
|
+
building: "Building project...",
|
|
4255
|
+
packaging: "Creating package...",
|
|
4256
|
+
validating: "Validating...",
|
|
4257
|
+
analyzing: "Analyzing...",
|
|
4258
|
+
restoring: "Restoring dependencies..."
|
|
4259
|
+
},
|
|
4260
|
+
validation: {
|
|
4261
|
+
requiredField: "{field} is required",
|
|
4262
|
+
invalidValue: "Invalid value for {field}",
|
|
4263
|
+
pathNotFound: "Path not found: {path}",
|
|
4264
|
+
fileRequired: "File is required: {path}",
|
|
4265
|
+
directoryRequired: "Directory is required: {path}"
|
|
4266
|
+
},
|
|
4267
|
+
warnings: {
|
|
4268
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4269
|
+
},
|
|
4270
|
+
info: {
|
|
4271
|
+
operationComplete: "Operation completed successfully",
|
|
4272
|
+
filesProcessed: {
|
|
4273
|
+
zero: "No files processed",
|
|
4274
|
+
one: "{count} file processed",
|
|
4275
|
+
other: "{count} files processed"
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
};
|
|
4280
|
+
|
|
4281
|
+
// ../packager/packager-core/src/i18n/locales/pt-BR.ts
|
|
4282
|
+
var pt_BR2 = {
|
|
4283
|
+
toolCore: {
|
|
4284
|
+
errors: {
|
|
4285
|
+
internal: "Internal error: {message}",
|
|
4286
|
+
fileNotFound: "File not found: {path}",
|
|
4287
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4288
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4289
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4290
|
+
invalidPath: "{path} is not a valid path",
|
|
4291
|
+
operationCanceled: "Operation was canceled",
|
|
4292
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4293
|
+
},
|
|
4294
|
+
progress: {
|
|
4295
|
+
copying: "Copying files...",
|
|
4296
|
+
building: "Building project...",
|
|
4297
|
+
packaging: "Creating package...",
|
|
4298
|
+
validating: "Validating...",
|
|
4299
|
+
analyzing: "Analyzing...",
|
|
4300
|
+
restoring: "Restoring dependencies..."
|
|
4301
|
+
},
|
|
4302
|
+
validation: {
|
|
4303
|
+
requiredField: "{field} is required",
|
|
4304
|
+
invalidValue: "Invalid value for {field}",
|
|
4305
|
+
pathNotFound: "Path not found: {path}",
|
|
4306
|
+
fileRequired: "File is required: {path}",
|
|
4307
|
+
directoryRequired: "Directory is required: {path}"
|
|
4308
|
+
},
|
|
4309
|
+
warnings: {
|
|
4310
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4311
|
+
},
|
|
4312
|
+
info: {
|
|
4313
|
+
operationComplete: "Operation completed successfully",
|
|
4314
|
+
filesProcessed: {
|
|
4315
|
+
zero: "No files processed",
|
|
4316
|
+
one: "{count} file processed",
|
|
4317
|
+
other: "{count} files processed"
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
|
|
4323
|
+
// ../packager/packager-core/src/i18n/locales/ro.ts
|
|
4324
|
+
var ro2 = {
|
|
4325
|
+
toolCore: {
|
|
4326
|
+
errors: {
|
|
4327
|
+
internal: "Internal error: {message}",
|
|
4328
|
+
fileNotFound: "File not found: {path}",
|
|
4329
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4330
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4331
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4332
|
+
invalidPath: "{path} is not a valid path",
|
|
4333
|
+
operationCanceled: "Operation was canceled",
|
|
4334
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4335
|
+
},
|
|
4336
|
+
progress: {
|
|
4337
|
+
copying: "Copying files...",
|
|
4338
|
+
building: "Building project...",
|
|
4339
|
+
packaging: "Creating package...",
|
|
4340
|
+
validating: "Validating...",
|
|
4341
|
+
analyzing: "Analyzing...",
|
|
4342
|
+
restoring: "Restoring dependencies..."
|
|
4343
|
+
},
|
|
4344
|
+
validation: {
|
|
4345
|
+
requiredField: "{field} is required",
|
|
4346
|
+
invalidValue: "Invalid value for {field}",
|
|
4347
|
+
pathNotFound: "Path not found: {path}",
|
|
4348
|
+
fileRequired: "File is required: {path}",
|
|
4349
|
+
directoryRequired: "Directory is required: {path}"
|
|
4350
|
+
},
|
|
4351
|
+
warnings: {
|
|
4352
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4353
|
+
},
|
|
4354
|
+
info: {
|
|
4355
|
+
operationComplete: "Operation completed successfully",
|
|
4356
|
+
filesProcessed: {
|
|
4357
|
+
zero: "No files processed",
|
|
4358
|
+
one: "{count} file processed",
|
|
4359
|
+
other: "{count} files processed"
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
};
|
|
4364
|
+
|
|
4365
|
+
// ../packager/packager-core/src/i18n/locales/ru.ts
|
|
4366
|
+
var ru2 = {
|
|
4367
|
+
toolCore: {
|
|
4368
|
+
errors: {
|
|
4369
|
+
internal: "Internal error: {message}",
|
|
4370
|
+
fileNotFound: "File not found: {path}",
|
|
4371
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4372
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4373
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4374
|
+
invalidPath: "{path} is not a valid path",
|
|
4375
|
+
operationCanceled: "Operation was canceled",
|
|
4376
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4377
|
+
},
|
|
4378
|
+
progress: {
|
|
4379
|
+
copying: "Copying files...",
|
|
4380
|
+
building: "Building project...",
|
|
4381
|
+
packaging: "Creating package...",
|
|
4382
|
+
validating: "Validating...",
|
|
4383
|
+
analyzing: "Analyzing...",
|
|
4384
|
+
restoring: "Restoring dependencies..."
|
|
4385
|
+
},
|
|
4386
|
+
validation: {
|
|
4387
|
+
requiredField: "{field} is required",
|
|
4388
|
+
invalidValue: "Invalid value for {field}",
|
|
4389
|
+
pathNotFound: "Path not found: {path}",
|
|
4390
|
+
fileRequired: "File is required: {path}",
|
|
4391
|
+
directoryRequired: "Directory is required: {path}"
|
|
4392
|
+
},
|
|
4393
|
+
warnings: {
|
|
4394
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4395
|
+
},
|
|
4396
|
+
info: {
|
|
4397
|
+
operationComplete: "Operation completed successfully",
|
|
4398
|
+
filesProcessed: {
|
|
4399
|
+
zero: "No files processed",
|
|
4400
|
+
one: "{count} file processed",
|
|
4401
|
+
other: "{count} files processed"
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
};
|
|
4406
|
+
|
|
4407
|
+
// ../packager/packager-core/src/i18n/locales/tr.ts
|
|
4408
|
+
var tr2 = {
|
|
4409
|
+
toolCore: {
|
|
4410
|
+
errors: {
|
|
4411
|
+
internal: "Internal error: {message}",
|
|
4412
|
+
fileNotFound: "File not found: {path}",
|
|
4413
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4414
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4415
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4416
|
+
invalidPath: "{path} is not a valid path",
|
|
4417
|
+
operationCanceled: "Operation was canceled",
|
|
4418
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4419
|
+
},
|
|
4420
|
+
progress: {
|
|
4421
|
+
copying: "Copying files...",
|
|
4422
|
+
building: "Building project...",
|
|
4423
|
+
packaging: "Creating package...",
|
|
4424
|
+
validating: "Validating...",
|
|
4425
|
+
analyzing: "Analyzing...",
|
|
4426
|
+
restoring: "Restoring dependencies..."
|
|
4427
|
+
},
|
|
4428
|
+
validation: {
|
|
4429
|
+
requiredField: "{field} is required",
|
|
4430
|
+
invalidValue: "Invalid value for {field}",
|
|
4431
|
+
pathNotFound: "Path not found: {path}",
|
|
4432
|
+
fileRequired: "File is required: {path}",
|
|
4433
|
+
directoryRequired: "Directory is required: {path}"
|
|
4434
|
+
},
|
|
4435
|
+
warnings: {
|
|
4436
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4437
|
+
},
|
|
4438
|
+
info: {
|
|
4439
|
+
operationComplete: "Operation completed successfully",
|
|
4440
|
+
filesProcessed: {
|
|
4441
|
+
zero: "No files processed",
|
|
4442
|
+
one: "{count} file processed",
|
|
4443
|
+
other: "{count} files processed"
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
};
|
|
4448
|
+
|
|
4449
|
+
// ../packager/packager-core/src/i18n/locales/zh-CN.ts
|
|
4450
|
+
var zh_CN2 = {
|
|
4451
|
+
toolCore: {
|
|
4452
|
+
errors: {
|
|
4453
|
+
internal: "Internal error: {message}",
|
|
4454
|
+
fileNotFound: "File not found: {path}",
|
|
4455
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4456
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4457
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4458
|
+
invalidPath: "{path} is not a valid path",
|
|
4459
|
+
operationCanceled: "Operation was canceled",
|
|
4460
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4461
|
+
},
|
|
4462
|
+
progress: {
|
|
4463
|
+
copying: "Copying files...",
|
|
4464
|
+
building: "Building project...",
|
|
4465
|
+
packaging: "Creating package...",
|
|
4466
|
+
validating: "Validating...",
|
|
4467
|
+
analyzing: "Analyzing...",
|
|
4468
|
+
restoring: "Restoring dependencies..."
|
|
4469
|
+
},
|
|
4470
|
+
validation: {
|
|
4471
|
+
requiredField: "{field} is required",
|
|
4472
|
+
invalidValue: "Invalid value for {field}",
|
|
4473
|
+
pathNotFound: "Path not found: {path}",
|
|
4474
|
+
fileRequired: "File is required: {path}",
|
|
4475
|
+
directoryRequired: "Directory is required: {path}"
|
|
4476
|
+
},
|
|
4477
|
+
warnings: {
|
|
4478
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4479
|
+
},
|
|
4480
|
+
info: {
|
|
4481
|
+
operationComplete: "Operation completed successfully",
|
|
4482
|
+
filesProcessed: {
|
|
4483
|
+
zero: "No files processed",
|
|
4484
|
+
one: "{count} file processed",
|
|
4485
|
+
other: "{count} files processed"
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
};
|
|
4490
|
+
|
|
4491
|
+
// ../packager/packager-core/src/i18n/locales/zh-TW.ts
|
|
4492
|
+
var zh_TW2 = {
|
|
4493
|
+
toolCore: {
|
|
4494
|
+
errors: {
|
|
4495
|
+
internal: "Internal error: {message}",
|
|
4496
|
+
fileNotFound: "File not found: {path}",
|
|
4497
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4498
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4499
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4500
|
+
invalidPath: "{path} is not a valid path",
|
|
4501
|
+
operationCanceled: "Operation was canceled",
|
|
4502
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4503
|
+
},
|
|
4504
|
+
progress: {
|
|
4505
|
+
copying: "Copying files...",
|
|
4506
|
+
building: "Building project...",
|
|
4507
|
+
packaging: "Creating package...",
|
|
4508
|
+
validating: "Validating...",
|
|
4509
|
+
analyzing: "Analyzing...",
|
|
4510
|
+
restoring: "Restoring dependencies..."
|
|
4511
|
+
},
|
|
4512
|
+
validation: {
|
|
4513
|
+
requiredField: "{field} is required",
|
|
4514
|
+
invalidValue: "Invalid value for {field}",
|
|
4515
|
+
pathNotFound: "Path not found: {path}",
|
|
4516
|
+
fileRequired: "File is required: {path}",
|
|
4517
|
+
directoryRequired: "Directory is required: {path}"
|
|
4518
|
+
},
|
|
4519
|
+
warnings: {
|
|
4520
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4521
|
+
},
|
|
4522
|
+
info: {
|
|
4523
|
+
operationComplete: "Operation completed successfully",
|
|
4524
|
+
filesProcessed: {
|
|
4525
|
+
zero: "No files processed",
|
|
4526
|
+
one: "{count} file processed",
|
|
4527
|
+
other: "{count} files processed"
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
};
|
|
4532
|
+
|
|
4533
|
+
// ../packager/packager-core/src/i18n/locales/zu.ts
|
|
4534
|
+
var zu2 = {
|
|
4535
|
+
toolCore: {
|
|
4536
|
+
errors: {
|
|
4537
|
+
internal: "Internal error: {message}",
|
|
4538
|
+
fileNotFound: "File not found: {path}",
|
|
4539
|
+
fileReadFailed: "Failed to read file: {path}",
|
|
4540
|
+
fileWriteFailed: "Failed to write file: {path}",
|
|
4541
|
+
directoryNotFound: "Directory not found: {path}",
|
|
4542
|
+
invalidPath: "{path} is not a valid path",
|
|
4543
|
+
operationCanceled: "Operation was canceled",
|
|
4544
|
+
invalidParameter: "Invalid parameter: {parameter}"
|
|
4545
|
+
},
|
|
4546
|
+
progress: {
|
|
4547
|
+
copying: "Copying files...",
|
|
4548
|
+
building: "Building project...",
|
|
4549
|
+
packaging: "Creating package...",
|
|
4550
|
+
validating: "Validating...",
|
|
4551
|
+
analyzing: "Analyzing...",
|
|
4552
|
+
restoring: "Restoring dependencies..."
|
|
4553
|
+
},
|
|
4554
|
+
validation: {
|
|
4555
|
+
requiredField: "{field} is required",
|
|
4556
|
+
invalidValue: "Invalid value for {field}",
|
|
4557
|
+
pathNotFound: "Path not found: {path}",
|
|
4558
|
+
fileRequired: "File is required: {path}",
|
|
4559
|
+
directoryRequired: "Directory is required: {path}"
|
|
4560
|
+
},
|
|
4561
|
+
warnings: {
|
|
4562
|
+
factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
|
|
4563
|
+
},
|
|
4564
|
+
info: {
|
|
4565
|
+
operationComplete: "Operation completed successfully",
|
|
4566
|
+
filesProcessed: {
|
|
4567
|
+
zero: "No files processed",
|
|
4568
|
+
one: "{count} file processed",
|
|
4569
|
+
other: "{count} files processed"
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
};
|
|
4574
|
+
|
|
4575
|
+
// ../packager/packager-core/src/i18n/translation-service.ts
|
|
4576
|
+
class TranslationService2 {
|
|
4577
|
+
static instance;
|
|
4578
|
+
currentLocale = "en";
|
|
4579
|
+
constructor() {}
|
|
4580
|
+
static getInstance() {
|
|
4581
|
+
if (!TranslationService2.instance) {
|
|
4582
|
+
TranslationService2.instance = new TranslationService2;
|
|
4583
|
+
}
|
|
4584
|
+
return TranslationService2.instance;
|
|
4585
|
+
}
|
|
4586
|
+
setLocale(locale) {
|
|
4587
|
+
this.currentLocale = I18nManager2.setLocale(locale);
|
|
4588
|
+
}
|
|
4589
|
+
getLocale() {
|
|
4590
|
+
return this.currentLocale;
|
|
4591
|
+
}
|
|
4592
|
+
t(key, params) {
|
|
4593
|
+
return I18nManager2.t(key, params, this.currentLocale);
|
|
4594
|
+
}
|
|
4595
|
+
tLocale(key, locale, params) {
|
|
4596
|
+
return I18nManager2.t(key, params, locale);
|
|
4597
|
+
}
|
|
4598
|
+
has(key) {
|
|
4599
|
+
return I18nManager2.has(key, this.currentLocale);
|
|
4600
|
+
}
|
|
4601
|
+
getAvailableLocales() {
|
|
4602
|
+
return I18nManager2.getAvailableLocales();
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
var translate2 = TranslationService2.getInstance();
|
|
4606
|
+
|
|
4607
|
+
// ../packager/packager-core/src/i18n/index.ts
|
|
4608
|
+
I18nManager2.registerTranslations("en", en2);
|
|
4609
|
+
I18nManager2.registerTranslations("de", de2);
|
|
4610
|
+
I18nManager2.registerTranslations("es", es2);
|
|
4611
|
+
I18nManager2.registerTranslations("es-mx", es_MX2);
|
|
4612
|
+
I18nManager2.registerTranslations("fr", fr2);
|
|
4613
|
+
I18nManager2.registerTranslations("ja", ja2);
|
|
4614
|
+
I18nManager2.registerTranslations("ko", ko2);
|
|
4615
|
+
I18nManager2.registerTranslations("pt", pt2);
|
|
4616
|
+
I18nManager2.registerTranslations("pt-br", pt_BR2);
|
|
4617
|
+
I18nManager2.registerTranslations("ro", ro2);
|
|
4618
|
+
I18nManager2.registerTranslations("ru", ru2);
|
|
4619
|
+
I18nManager2.registerTranslations("tr", tr2);
|
|
4620
|
+
I18nManager2.registerTranslations("zh-cn", zh_CN2);
|
|
4621
|
+
I18nManager2.registerTranslations("zh-tw", zh_TW2);
|
|
4622
|
+
I18nManager2.registerTranslations("zu", zu2);
|
|
4623
|
+
I18nManager2.setLocale("en");
|
|
4624
|
+
// ../packager/packager-core/src/services/tools-factory-repository.ts
|
|
4625
|
+
class ToolsFactoryRepository2 {
|
|
4626
|
+
projectFactoryMap = new Map;
|
|
4627
|
+
solutionFactory = null;
|
|
4628
|
+
registerProjectToolFactory(factory) {
|
|
4629
|
+
for (const type of factory.supportedTypes) {
|
|
4630
|
+
const existing = this.projectFactoryMap.get(type);
|
|
4631
|
+
if (existing) {
|
|
4632
|
+
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
4633
|
+
console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
4634
|
+
}
|
|
4635
|
+
continue;
|
|
4636
|
+
}
|
|
4637
|
+
this.projectFactoryMap.set(type, factory);
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
registerSolutionToolFactory(factory) {
|
|
4641
|
+
this.solutionFactory = factory;
|
|
4642
|
+
}
|
|
4643
|
+
getSolutionToolFactory() {
|
|
4644
|
+
if (!this.solutionFactory) {
|
|
4645
|
+
throw new Error("No solution tool factory is registered");
|
|
4646
|
+
}
|
|
4647
|
+
return this.solutionFactory;
|
|
4648
|
+
}
|
|
4649
|
+
canHandleProject(projectType) {
|
|
4650
|
+
return this.projectFactoryMap.has(projectType);
|
|
4651
|
+
}
|
|
4652
|
+
getProjectToolFactory(projectType) {
|
|
4653
|
+
const factory = this.projectFactoryMap.get(projectType);
|
|
4654
|
+
if (!factory) {
|
|
4655
|
+
throw new Error(`No tool factory found for project type '${projectType}'`);
|
|
4656
|
+
}
|
|
4657
|
+
return factory;
|
|
4658
|
+
}
|
|
4659
|
+
reset() {
|
|
4660
|
+
this.projectFactoryMap.clear();
|
|
4661
|
+
this.solutionFactory = null;
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
var REGISTRY_KEY2 = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
|
|
4665
|
+
var _global2 = globalThis;
|
|
4666
|
+
if (!_global2[REGISTRY_KEY2]) {
|
|
4667
|
+
_global2[REGISTRY_KEY2] = new ToolsFactoryRepository2;
|
|
4668
|
+
}
|
|
4669
|
+
var toolsFactoryRepository2 = _global2[REGISTRY_KEY2];
|
|
4670
|
+
// src/packager-tool.ts
|
|
4671
|
+
toolsFactoryRepository2.registerSolutionToolFactory(new ResourceBuilderToolFactory);
|
|
4672
|
+
toolsFactoryRepository2.registerProjectToolFactory(new ConnectorToolFactory);
|
|
4673
|
+
toolsFactoryRepository2.registerProjectToolFactory(new WebAppToolFactory);
|
|
4674
|
+
toolsFactoryRepository2.registerProjectToolFactory(new FunctionsToolFactory);
|
|
4675
|
+
|
|
4676
|
+
//# debugId=CB6BF408EBE3322D64756E2164756E21
|