@uipath/test-manager-tool 1.204.0 → 1.205.0-preview.258
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/README.md +180 -13
- package/dist/THIRD-PARTY-NOTICES.md +32 -1
- package/dist/attachment.input-jpcea4mp.js +36 -0
- package/dist/index-ah3hzwzh.js +3173 -0
- package/dist/index-sa6fzfmt.js +2808 -0
- package/dist/index.js +10 -3
- package/dist/migration-import-run-g9g9c5x3.js +849 -0
- package/dist/tool-2a68c3s5.js +62 -0
- package/dist/tool-7hy7vvfk.js +22083 -0
- package/dist/tool-8b7p4csj.js +296 -0
- package/dist/tool-cpdm080k.js +18358 -0
- package/dist/tool-dmhckpj3.js +32699 -0
- package/dist/tool-e3prtphw.js +8376 -0
- package/dist/tool-fxj3gn2v.js +1676 -0
- package/dist/tool.js +8 -2
- package/package.json +2 -2
- package/dist/tool-2wbsjmen.js +0 -40698
|
@@ -0,0 +1,849 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHUNK_NOT_SENT_CODES,
|
|
3
|
+
CHUNK_RETRY_BACKOFF_MS,
|
|
4
|
+
CHUNK_SIZE_BYTES,
|
|
5
|
+
CHUNK_UPLOAD_ATTEMPTS,
|
|
6
|
+
DEFAULT_IMPORT_TIMEOUT_MS,
|
|
7
|
+
DEFAULT_MIGRATION_INTERVAL_MS,
|
|
8
|
+
MAX_IMPORT_PACKAGE_BYTES,
|
|
9
|
+
MAX_PACKAGE_NAME_LENGTH,
|
|
10
|
+
PROJECT_CONFIG_IMPORT_FORBIDDEN_MESSAGE,
|
|
11
|
+
TM_FORBIDDEN_MESSAGE,
|
|
12
|
+
checkContentSelection,
|
|
13
|
+
emitInvalidArgument,
|
|
14
|
+
emitTmFailure,
|
|
15
|
+
extractErrorDetails,
|
|
16
|
+
initializeContext,
|
|
17
|
+
recheckJobHint,
|
|
18
|
+
resolveContextWithProject,
|
|
19
|
+
resolveWaitTiming,
|
|
20
|
+
toChunkUploadRequest,
|
|
21
|
+
toImportJobRequest,
|
|
22
|
+
toJobUpdateRequest,
|
|
23
|
+
toMigrationJobOutput,
|
|
24
|
+
waitForMigrationJob,
|
|
25
|
+
withRefreshingToken
|
|
26
|
+
} from "./tool-fxj3gn2v.js";
|
|
27
|
+
import {
|
|
28
|
+
EXIT_CODES,
|
|
29
|
+
OutputFormatter,
|
|
30
|
+
RESULTS,
|
|
31
|
+
SuccessOutput,
|
|
32
|
+
catchError,
|
|
33
|
+
getFileSystem,
|
|
34
|
+
instructionsFor,
|
|
35
|
+
logger,
|
|
36
|
+
processContext
|
|
37
|
+
} from "./tool-e3prtphw.js";
|
|
38
|
+
import {
|
|
39
|
+
ProjectMigrationAttachmentApi,
|
|
40
|
+
ProjectMigrationJobApi,
|
|
41
|
+
ProjectsApi,
|
|
42
|
+
UiPathTestManagementHubProjectMigrationAbstractionsEnumsMigrationJobStatus
|
|
43
|
+
} from "./tool-cpdm080k.js";
|
|
44
|
+
import"./tool-8b7p4csj.js";
|
|
45
|
+
import"./tool-1de529jm.js";
|
|
46
|
+
|
|
47
|
+
// ../../node_modules/fflate/esm/index.mjs
|
|
48
|
+
import { createRequire } from "module";
|
|
49
|
+
var require2 = createRequire("/");
|
|
50
|
+
var _a;
|
|
51
|
+
var Worker;
|
|
52
|
+
var isMarkedAsUntransferable;
|
|
53
|
+
try {
|
|
54
|
+
_a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
|
|
55
|
+
} catch (e) {}
|
|
56
|
+
var u8 = Uint8Array;
|
|
57
|
+
var u16 = Uint16Array;
|
|
58
|
+
var i32 = Int32Array;
|
|
59
|
+
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]);
|
|
60
|
+
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]);
|
|
61
|
+
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
62
|
+
var freb = function(eb, start) {
|
|
63
|
+
var b = new u16(31);
|
|
64
|
+
for (var i = 0;i < 31; ++i) {
|
|
65
|
+
b[i] = start += 1 << eb[i - 1];
|
|
66
|
+
}
|
|
67
|
+
var r = new i32(b[30]);
|
|
68
|
+
for (var i = 1;i < 30; ++i) {
|
|
69
|
+
for (var j = b[i];j < b[i + 1]; ++j) {
|
|
70
|
+
r[j] = j - b[i] << 5 | i;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { b, r };
|
|
74
|
+
};
|
|
75
|
+
var _a = freb(fleb, 2);
|
|
76
|
+
var fl = _a.b;
|
|
77
|
+
var revfl = _a.r;
|
|
78
|
+
fl[28] = 258, revfl[258] = 28;
|
|
79
|
+
var _b = freb(fdeb, 0);
|
|
80
|
+
var fd = _b.b;
|
|
81
|
+
var revfd = _b.r;
|
|
82
|
+
var rev = new u16(32768);
|
|
83
|
+
for (i = 0;i < 32768; ++i) {
|
|
84
|
+
x = (i & 43690) >> 1 | (i & 21845) << 1;
|
|
85
|
+
x = (x & 52428) >> 2 | (x & 13107) << 2;
|
|
86
|
+
x = (x & 61680) >> 4 | (x & 3855) << 4;
|
|
87
|
+
rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
|
|
88
|
+
}
|
|
89
|
+
var x;
|
|
90
|
+
var i;
|
|
91
|
+
var hMap = function(cd, mb, r) {
|
|
92
|
+
var s = cd.length;
|
|
93
|
+
var i2 = 0;
|
|
94
|
+
var l = new u16(mb);
|
|
95
|
+
for (;i2 < s; ++i2) {
|
|
96
|
+
if (cd[i2])
|
|
97
|
+
++l[cd[i2] - 1];
|
|
98
|
+
}
|
|
99
|
+
var le = new u16(mb);
|
|
100
|
+
for (i2 = 1;i2 < mb; ++i2) {
|
|
101
|
+
le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
|
|
102
|
+
}
|
|
103
|
+
var co;
|
|
104
|
+
if (r) {
|
|
105
|
+
co = new u16(1 << mb);
|
|
106
|
+
var rvb = 15 - mb;
|
|
107
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
108
|
+
if (cd[i2]) {
|
|
109
|
+
var sv = i2 << 4 | cd[i2];
|
|
110
|
+
var r_1 = mb - cd[i2];
|
|
111
|
+
var v = le[cd[i2] - 1]++ << r_1;
|
|
112
|
+
for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
|
|
113
|
+
co[rev[v] >> rvb] = sv;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
co = new u16(s);
|
|
119
|
+
for (i2 = 0;i2 < s; ++i2) {
|
|
120
|
+
if (cd[i2]) {
|
|
121
|
+
co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return co;
|
|
126
|
+
};
|
|
127
|
+
var flt = new u8(288);
|
|
128
|
+
for (i = 0;i < 144; ++i)
|
|
129
|
+
flt[i] = 8;
|
|
130
|
+
var i;
|
|
131
|
+
for (i = 144;i < 256; ++i)
|
|
132
|
+
flt[i] = 9;
|
|
133
|
+
var i;
|
|
134
|
+
for (i = 256;i < 280; ++i)
|
|
135
|
+
flt[i] = 7;
|
|
136
|
+
var i;
|
|
137
|
+
for (i = 280;i < 288; ++i)
|
|
138
|
+
flt[i] = 8;
|
|
139
|
+
var i;
|
|
140
|
+
var fdt = new u8(32);
|
|
141
|
+
for (i = 0;i < 32; ++i)
|
|
142
|
+
fdt[i] = 5;
|
|
143
|
+
var i;
|
|
144
|
+
var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
|
|
145
|
+
var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
|
|
146
|
+
var max = function(a) {
|
|
147
|
+
var m = a[0];
|
|
148
|
+
for (var i2 = 1;i2 < a.length; ++i2) {
|
|
149
|
+
if (a[i2] > m)
|
|
150
|
+
m = a[i2];
|
|
151
|
+
}
|
|
152
|
+
return m;
|
|
153
|
+
};
|
|
154
|
+
var bits = function(d, p, m) {
|
|
155
|
+
var o = p / 8 | 0;
|
|
156
|
+
return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
|
|
157
|
+
};
|
|
158
|
+
var bits16 = function(d, p) {
|
|
159
|
+
var o = p / 8 | 0;
|
|
160
|
+
return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
|
|
161
|
+
};
|
|
162
|
+
var shft = function(p) {
|
|
163
|
+
return (p + 7) / 8 | 0;
|
|
164
|
+
};
|
|
165
|
+
var slc = function(v, s, e) {
|
|
166
|
+
if (s == null || s < 0)
|
|
167
|
+
s = 0;
|
|
168
|
+
if (e == null || e > v.length)
|
|
169
|
+
e = v.length;
|
|
170
|
+
return new u8(v.subarray(s, e));
|
|
171
|
+
};
|
|
172
|
+
var ec = [
|
|
173
|
+
"unexpected EOF",
|
|
174
|
+
"invalid block type",
|
|
175
|
+
"invalid length/literal",
|
|
176
|
+
"invalid distance",
|
|
177
|
+
"stream finished",
|
|
178
|
+
"no stream handler",
|
|
179
|
+
,
|
|
180
|
+
"no callback",
|
|
181
|
+
"invalid UTF-8 data",
|
|
182
|
+
"extra field too long",
|
|
183
|
+
"date not in range 1980-2099",
|
|
184
|
+
"filename too long",
|
|
185
|
+
"stream finishing",
|
|
186
|
+
"invalid zip data"
|
|
187
|
+
];
|
|
188
|
+
var err = function(ind, msg, nt) {
|
|
189
|
+
var e = new Error(msg || ec[ind]);
|
|
190
|
+
e.code = ind;
|
|
191
|
+
if (Error.captureStackTrace)
|
|
192
|
+
Error.captureStackTrace(e, err);
|
|
193
|
+
if (!nt)
|
|
194
|
+
throw e;
|
|
195
|
+
return e;
|
|
196
|
+
};
|
|
197
|
+
var inflt = function(dat, st, buf, dict) {
|
|
198
|
+
var sl = dat.length, dl = dict ? dict.length : 0;
|
|
199
|
+
if (!sl || st.f && !st.l)
|
|
200
|
+
return buf || new u8(0);
|
|
201
|
+
var noBuf = !buf;
|
|
202
|
+
var resize = noBuf || st.i != 2;
|
|
203
|
+
var noSt = st.i;
|
|
204
|
+
if (noBuf)
|
|
205
|
+
buf = new u8(sl * 3);
|
|
206
|
+
var cbuf = function(l2) {
|
|
207
|
+
var bl = buf.length;
|
|
208
|
+
if (l2 > bl) {
|
|
209
|
+
var nbuf = new u8(Math.max(bl * 2, l2));
|
|
210
|
+
nbuf.set(buf);
|
|
211
|
+
buf = nbuf;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
|
|
215
|
+
var tbts = sl * 8;
|
|
216
|
+
do {
|
|
217
|
+
if (!lm) {
|
|
218
|
+
final = bits(dat, pos, 1);
|
|
219
|
+
var type = bits(dat, pos + 1, 3);
|
|
220
|
+
pos += 3;
|
|
221
|
+
if (!type) {
|
|
222
|
+
var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
|
|
223
|
+
if (t > sl) {
|
|
224
|
+
if (noSt)
|
|
225
|
+
err(0);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (resize)
|
|
229
|
+
cbuf(bt + l);
|
|
230
|
+
buf.set(dat.subarray(s, t), bt);
|
|
231
|
+
st.b = bt += l, st.p = pos = t * 8, st.f = final;
|
|
232
|
+
continue;
|
|
233
|
+
} else if (type == 1)
|
|
234
|
+
lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
|
|
235
|
+
else if (type == 2) {
|
|
236
|
+
var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
|
|
237
|
+
var tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
238
|
+
pos += 14;
|
|
239
|
+
var ldt = new u8(tl);
|
|
240
|
+
var clt = new u8(19);
|
|
241
|
+
for (var i2 = 0;i2 < hcLen; ++i2) {
|
|
242
|
+
clt[clim[i2]] = bits(dat, pos + i2 * 3, 7);
|
|
243
|
+
}
|
|
244
|
+
pos += hcLen * 3;
|
|
245
|
+
var clb = max(clt), clbmsk = (1 << clb) - 1;
|
|
246
|
+
var clm = hMap(clt, clb, 1);
|
|
247
|
+
for (var i2 = 0;i2 < tl; ) {
|
|
248
|
+
var r = clm[bits(dat, pos, clbmsk)];
|
|
249
|
+
pos += r & 15;
|
|
250
|
+
var s = r >> 4;
|
|
251
|
+
if (s < 16) {
|
|
252
|
+
ldt[i2++] = s;
|
|
253
|
+
} else {
|
|
254
|
+
var c = 0, n = 0;
|
|
255
|
+
if (s == 16)
|
|
256
|
+
n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i2 - 1];
|
|
257
|
+
else if (s == 17)
|
|
258
|
+
n = 3 + bits(dat, pos, 7), pos += 3;
|
|
259
|
+
else if (s == 18)
|
|
260
|
+
n = 11 + bits(dat, pos, 127), pos += 7;
|
|
261
|
+
while (n--)
|
|
262
|
+
ldt[i2++] = c;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
|
|
266
|
+
lbt = max(lt);
|
|
267
|
+
dbt = max(dt);
|
|
268
|
+
lm = hMap(lt, lbt, 1);
|
|
269
|
+
dm = hMap(dt, dbt, 1);
|
|
270
|
+
} else
|
|
271
|
+
err(1);
|
|
272
|
+
if (pos > tbts) {
|
|
273
|
+
if (noSt)
|
|
274
|
+
err(0);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (resize)
|
|
279
|
+
cbuf(bt + 131072);
|
|
280
|
+
var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
|
|
281
|
+
var lpos = pos;
|
|
282
|
+
for (;; lpos = pos) {
|
|
283
|
+
var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
|
|
284
|
+
pos += c & 15;
|
|
285
|
+
if (pos > tbts) {
|
|
286
|
+
if (noSt)
|
|
287
|
+
err(0);
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
if (!c)
|
|
291
|
+
err(2);
|
|
292
|
+
if (sym < 256)
|
|
293
|
+
buf[bt++] = sym;
|
|
294
|
+
else if (sym == 256) {
|
|
295
|
+
lpos = pos, lm = null;
|
|
296
|
+
break;
|
|
297
|
+
} else {
|
|
298
|
+
var add = sym - 254;
|
|
299
|
+
if (sym > 264) {
|
|
300
|
+
var i2 = sym - 257, b = fleb[i2];
|
|
301
|
+
add = bits(dat, pos, (1 << b) - 1) + fl[i2];
|
|
302
|
+
pos += b;
|
|
303
|
+
}
|
|
304
|
+
var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
|
|
305
|
+
if (!d)
|
|
306
|
+
err(3);
|
|
307
|
+
pos += d & 15;
|
|
308
|
+
var dt = fd[dsym];
|
|
309
|
+
if (dsym > 3) {
|
|
310
|
+
var b = fdeb[dsym];
|
|
311
|
+
dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
|
|
312
|
+
}
|
|
313
|
+
if (pos > tbts) {
|
|
314
|
+
if (noSt)
|
|
315
|
+
err(0);
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
if (resize)
|
|
319
|
+
cbuf(bt + 131072);
|
|
320
|
+
var end = bt + add;
|
|
321
|
+
if (bt < dt) {
|
|
322
|
+
var shift = dl - dt, dend = Math.min(dt, end);
|
|
323
|
+
if (shift + bt < 0)
|
|
324
|
+
err(3);
|
|
325
|
+
for (;bt < dend; ++bt)
|
|
326
|
+
buf[bt] = dict[shift + bt];
|
|
327
|
+
}
|
|
328
|
+
for (;bt < end; ++bt)
|
|
329
|
+
buf[bt] = buf[bt - dt];
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
333
|
+
if (lm)
|
|
334
|
+
final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
335
|
+
} while (!final);
|
|
336
|
+
return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
|
|
337
|
+
};
|
|
338
|
+
var et = /* @__PURE__ */ new u8(0);
|
|
339
|
+
var b2 = function(d, b) {
|
|
340
|
+
return d[b] | d[b + 1] << 8;
|
|
341
|
+
};
|
|
342
|
+
var b4 = function(d, b) {
|
|
343
|
+
return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
|
|
344
|
+
};
|
|
345
|
+
var b8 = function(d, b) {
|
|
346
|
+
return b4(d, b) + b4(d, b + 4) * 4294967296;
|
|
347
|
+
};
|
|
348
|
+
function inflateSync(data, opts) {
|
|
349
|
+
return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
|
|
350
|
+
}
|
|
351
|
+
var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
|
|
352
|
+
var tds = 0;
|
|
353
|
+
try {
|
|
354
|
+
td.decode(et, { stream: true });
|
|
355
|
+
tds = 1;
|
|
356
|
+
} catch (e) {}
|
|
357
|
+
var dutf8 = function(d) {
|
|
358
|
+
for (var r = "", i2 = 0;; ) {
|
|
359
|
+
var c = d[i2++];
|
|
360
|
+
var eb = (c > 127) + (c > 223) + (c > 239);
|
|
361
|
+
if (i2 + eb > d.length)
|
|
362
|
+
return { s: r, r: slc(d, i2 - 1) };
|
|
363
|
+
if (!eb)
|
|
364
|
+
r += String.fromCharCode(c);
|
|
365
|
+
else if (eb == 3) {
|
|
366
|
+
c = ((c & 15) << 18 | (d[i2++] & 63) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
|
|
367
|
+
} else if (eb & 1)
|
|
368
|
+
r += String.fromCharCode((c & 31) << 6 | d[i2++] & 63);
|
|
369
|
+
else
|
|
370
|
+
r += String.fromCharCode((c & 15) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
function strFromU8(dat, latin1) {
|
|
374
|
+
if (latin1) {
|
|
375
|
+
var r = "";
|
|
376
|
+
for (var i2 = 0;i2 < dat.length; i2 += 16384)
|
|
377
|
+
r += String.fromCharCode.apply(null, dat.subarray(i2, i2 + 16384));
|
|
378
|
+
return r;
|
|
379
|
+
} else if (td) {
|
|
380
|
+
return td.decode(dat);
|
|
381
|
+
} else {
|
|
382
|
+
var _a2 = dutf8(dat), s = _a2.s, r = _a2.r;
|
|
383
|
+
if (r.length)
|
|
384
|
+
err(8);
|
|
385
|
+
return s;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
var slzh = function(d, b) {
|
|
389
|
+
return b + 30 + b2(d, b + 26) + b2(d, b + 28);
|
|
390
|
+
};
|
|
391
|
+
var zh = function(d, b, z) {
|
|
392
|
+
var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
|
|
393
|
+
var _a2 = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
|
|
394
|
+
return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
|
|
395
|
+
};
|
|
396
|
+
var z64hs = function(d, b, l, z, sc, su, off) {
|
|
397
|
+
var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
|
|
398
|
+
var nf = nsc + nsu + noff;
|
|
399
|
+
if (z && nf) {
|
|
400
|
+
for (;b + 4 < e; b += 4 + b2(d, b + 2)) {
|
|
401
|
+
if (b2(d, b) == 1) {
|
|
402
|
+
return [
|
|
403
|
+
nsc ? b8(d, b + 4 + 8 * nsu) : sc,
|
|
404
|
+
nsu ? b8(d, b + 4) : su,
|
|
405
|
+
noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
|
|
406
|
+
1
|
|
407
|
+
];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (z < 2)
|
|
411
|
+
err(13);
|
|
412
|
+
}
|
|
413
|
+
return [sc, su, off, 0];
|
|
414
|
+
};
|
|
415
|
+
function unzipSync(data, opts) {
|
|
416
|
+
var files = {};
|
|
417
|
+
var e = data.length - 22;
|
|
418
|
+
for (;b4(data, e) != 101010256; --e) {
|
|
419
|
+
if (!e || data.length - e > 65558)
|
|
420
|
+
err(13);
|
|
421
|
+
}
|
|
422
|
+
var c = b2(data, e + 8);
|
|
423
|
+
if (!c)
|
|
424
|
+
return {};
|
|
425
|
+
var o = b4(data, e + 16);
|
|
426
|
+
var z = b4(data, e - 20) == 117853008;
|
|
427
|
+
if (z) {
|
|
428
|
+
var ze = b4(data, e - 12);
|
|
429
|
+
z = b4(data, ze) == 101075792;
|
|
430
|
+
if (z) {
|
|
431
|
+
c = b4(data, ze + 32);
|
|
432
|
+
o = b4(data, ze + 48);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
var fltr = opts && opts.filter;
|
|
436
|
+
for (var i2 = 0;i2 < c; ++i2) {
|
|
437
|
+
var _a2 = zh(data, o, z), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
|
|
438
|
+
o = no;
|
|
439
|
+
if (!fltr || fltr({
|
|
440
|
+
name: fn,
|
|
441
|
+
size: sc,
|
|
442
|
+
originalSize: su,
|
|
443
|
+
compression: c_2
|
|
444
|
+
})) {
|
|
445
|
+
if (!c_2)
|
|
446
|
+
files[fn] = slc(data, b, b + sc);
|
|
447
|
+
else if (c_2 == 8)
|
|
448
|
+
files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });
|
|
449
|
+
else
|
|
450
|
+
err(14, "unknown compression type " + c_2);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return files;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// ../common/src/zip.ts
|
|
457
|
+
function readZipEntry(zipData, entryName) {
|
|
458
|
+
const entries = unzipSync(zipData, {
|
|
459
|
+
filter: (file) => file.name === entryName
|
|
460
|
+
});
|
|
461
|
+
return entries[entryName];
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// src/utils/tmh-package.ts
|
|
465
|
+
function planChunks(packageName, sizeBytes, chunkSize = CHUNK_SIZE_BYTES) {
|
|
466
|
+
if (!Number.isInteger(sizeBytes) || sizeBytes <= 0) {
|
|
467
|
+
throw new Error(`Package size must be a positive whole number of bytes, got ${sizeBytes}.`);
|
|
468
|
+
}
|
|
469
|
+
if (!Number.isInteger(chunkSize) || chunkSize <= 0) {
|
|
470
|
+
throw new Error(`Chunk size must be a positive whole number of bytes, got ${chunkSize}.`);
|
|
471
|
+
}
|
|
472
|
+
const total = Math.ceil(sizeBytes / chunkSize);
|
|
473
|
+
const chunks = [];
|
|
474
|
+
for (let index = 1;index <= total; index++) {
|
|
475
|
+
const start = (index - 1) * chunkSize;
|
|
476
|
+
chunks.push({
|
|
477
|
+
index,
|
|
478
|
+
name: `${packageName}.part_${index}.${total}`,
|
|
479
|
+
start,
|
|
480
|
+
end: Math.min(start + chunkSize, sizeBytes)
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
return { total, chunks };
|
|
484
|
+
}
|
|
485
|
+
function toPackageName(fileName) {
|
|
486
|
+
const cleaned = fileName.trim().replace(/["\r\n]/g, "_");
|
|
487
|
+
const capped = cleaned.slice(0, MAX_PACKAGE_NAME_LENGTH).trim();
|
|
488
|
+
return capped.length > 0 ? capped : "package.tmh";
|
|
489
|
+
}
|
|
490
|
+
function readManifestFromPackage(packageBytes) {
|
|
491
|
+
const manifestBytes = readZipEntry(packageBytes, "manifest.json");
|
|
492
|
+
if (manifestBytes === undefined)
|
|
493
|
+
return null;
|
|
494
|
+
return JSON.parse(new TextDecoder().decode(manifestBytes));
|
|
495
|
+
}
|
|
496
|
+
function missingManifestFields(manifest) {
|
|
497
|
+
const missing = [];
|
|
498
|
+
if (!hasText(manifest.tmPackageId))
|
|
499
|
+
missing.push("tmPackageId");
|
|
500
|
+
if (!hasText(manifest.schemaVersion))
|
|
501
|
+
missing.push("schemaVersion");
|
|
502
|
+
return missing;
|
|
503
|
+
}
|
|
504
|
+
function toImportManifest(manifest, packageName, sizeBytes, target, chunkSize = CHUNK_SIZE_BYTES) {
|
|
505
|
+
return {
|
|
506
|
+
...manifest,
|
|
507
|
+
packageName,
|
|
508
|
+
packageSize: sizeBytes,
|
|
509
|
+
chunkSize,
|
|
510
|
+
project: {
|
|
511
|
+
name: target.name,
|
|
512
|
+
description: target.description ?? "",
|
|
513
|
+
projectPrefix: target.projectPrefix
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function hasText(value) {
|
|
518
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/commands/migration-import-run.ts
|
|
522
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
523
|
+
async function executeImport(options) {
|
|
524
|
+
const selection = {
|
|
525
|
+
include: options.include,
|
|
526
|
+
exclude: options.exclude
|
|
527
|
+
};
|
|
528
|
+
if (!checkContentSelection(selection))
|
|
529
|
+
return;
|
|
530
|
+
if (!checkImportTarget(options))
|
|
531
|
+
return;
|
|
532
|
+
let timing;
|
|
533
|
+
if (options.wait) {
|
|
534
|
+
const resolved = resolveWaitTiming(options);
|
|
535
|
+
if (!resolved)
|
|
536
|
+
return;
|
|
537
|
+
timing = resolved;
|
|
538
|
+
}
|
|
539
|
+
const prepared = await preparePackage(options.file);
|
|
540
|
+
if (!prepared)
|
|
541
|
+
return;
|
|
542
|
+
const target = await resolveImportTarget(options, prepared);
|
|
543
|
+
if (!target)
|
|
544
|
+
return;
|
|
545
|
+
if (!timing)
|
|
546
|
+
warnIgnoredWaitOptions(options);
|
|
547
|
+
await runImport({ target, prepared }, selection, timing);
|
|
548
|
+
}
|
|
549
|
+
async function runImport(facts, selection, timing) {
|
|
550
|
+
const { target, prepared } = facts;
|
|
551
|
+
const config = withRefreshingToken(target.tmConfig);
|
|
552
|
+
const jobApi = new ProjectMigrationJobApi(config);
|
|
553
|
+
const manifest = toImportManifest(prepared.manifest, prepared.packageName, prepared.bytes.byteLength, target.project);
|
|
554
|
+
const [startError, job] = await catchError(jobApi.projectMigrationJobCreateProjectImportJob(toImportJobRequest(target.projectId, manifest, selection)));
|
|
555
|
+
if (startError) {
|
|
556
|
+
await emitImportCreateFailure(startError, selection.include?.includes("project-config") === true, createdProjectHint(target));
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (!job.id) {
|
|
560
|
+
emitMissingImportJobId(target);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
const uploaded = await uploadPackageChunks(new ProjectMigrationAttachmentApi(config), target, job.id, prepared);
|
|
564
|
+
if (!uploaded)
|
|
565
|
+
return;
|
|
566
|
+
const released = await releaseJob(jobApi, target, job.id);
|
|
567
|
+
if (!released)
|
|
568
|
+
return;
|
|
569
|
+
if (!timing) {
|
|
570
|
+
const output = new SuccessOutput("MigrationImport", importOutput(released, facts));
|
|
571
|
+
output.Instructions = `The import runs in the background. ${recheckJobHint(target.projectId, job.id)}`;
|
|
572
|
+
OutputFormatter.success(output);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const finished = await waitForMigrationJob(jobApi, target.projectId, job.id, timing, "Import", ` The import targets project ${target.projectId}.${createdProjectHint(target)}`);
|
|
576
|
+
if (!finished)
|
|
577
|
+
return;
|
|
578
|
+
OutputFormatter.success(new SuccessOutput("MigrationImport", importOutput(finished, facts)));
|
|
579
|
+
}
|
|
580
|
+
function importOutput(job, facts) {
|
|
581
|
+
return {
|
|
582
|
+
...toMigrationJobOutput(job),
|
|
583
|
+
ProjectId: facts.target.projectId,
|
|
584
|
+
ProjectCreated: facts.target.created,
|
|
585
|
+
PackageName: facts.prepared.packageName,
|
|
586
|
+
Bytes: facts.prepared.bytes.byteLength,
|
|
587
|
+
Chunks: facts.prepared.plan.total
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
function checkImportTarget(options) {
|
|
591
|
+
const named = options.projectId !== undefined || options.projectKey !== undefined;
|
|
592
|
+
if (!options.createProject && (options.newProjectName !== undefined || options.newProjectKey !== undefined)) {
|
|
593
|
+
emitInvalidArgument("--new-project-name and --new-project-key only apply with --create-project.", "Add --create-project to create the project, or drop these options to import into the project named by --project-id / --project-key.");
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
if (!options.createProject && !named) {
|
|
597
|
+
emitInvalidArgument("No project was given to import into.", "Pass --project-id (or --project-key) to import into a project that exists, or --create-project to create one from the package.");
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
if (options.createProject && named) {
|
|
601
|
+
emitInvalidArgument("--create-project makes a new project, so it cannot be combined with --project-id or --project-key.", "Drop --create-project to import into the project you named, or drop the project flag to create one from the package.");
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
return true;
|
|
605
|
+
}
|
|
606
|
+
function warnIgnoredWaitOptions(options) {
|
|
607
|
+
if (options.timeout !== String(DEFAULT_IMPORT_TIMEOUT_MS / 1000) || options.pollInterval !== String(DEFAULT_MIGRATION_INTERVAL_MS / 1000)) {
|
|
608
|
+
logger.warn("--timeout and --poll-interval have no effect without --wait; the job id is returned instead.");
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
async function preparePackage(filePath) {
|
|
612
|
+
const fs = getFileSystem();
|
|
613
|
+
const [, info] = await catchError(fs.stat(filePath));
|
|
614
|
+
if (info && info.size > MAX_IMPORT_PACKAGE_BYTES) {
|
|
615
|
+
emitInvalidArgument(`The package at '${filePath}' is ${info.size} bytes, more than the 2 GiB the CLI can read in one go.`, "Import it from the Test Manager web UI, or export a smaller project.");
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
const [readError, bytes] = await catchError(fs.readFile(filePath));
|
|
619
|
+
if (readError || bytes === null) {
|
|
620
|
+
emitInvalidArgument(`Cannot read the package at '${filePath}'${readError ? `: ${readError.message}` : "."}`, "Check the path and that the file is readable, then try again.");
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
if (bytes.byteLength === 0) {
|
|
624
|
+
emitInvalidArgument(`The package at '${filePath}' is empty.`, "Produce a .tmh with `uip tm project export --wait --output-file <path>`, then import that.");
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
const manifest = await readManifest(filePath, bytes);
|
|
628
|
+
if (!manifest)
|
|
629
|
+
return null;
|
|
630
|
+
const packageName = toPackageName(fs.path.basename(filePath));
|
|
631
|
+
return {
|
|
632
|
+
bytes,
|
|
633
|
+
packageName,
|
|
634
|
+
manifest,
|
|
635
|
+
plan: planChunks(packageName, bytes.byteLength, CHUNK_SIZE_BYTES)
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
async function readManifest(filePath, bytes) {
|
|
639
|
+
const [readError, manifest] = await catchError(Promise.resolve().then(() => readManifestFromPackage(bytes)));
|
|
640
|
+
if (readError) {
|
|
641
|
+
emitInvalidArgument(`'${filePath}' could not be read as a .tmh package: ${readError.message}`, "A .tmh is a zip written by `uip tm project export`. Check the file is that, and not renamed or truncated.");
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
if (manifest === null) {
|
|
645
|
+
emitInvalidArgument(`'${filePath}' has no manifest.json, so it is not a Test Manager project package.`, "Import a .tmh produced by `uip tm project export`.");
|
|
646
|
+
return null;
|
|
647
|
+
}
|
|
648
|
+
const missing = missingManifestFields(manifest);
|
|
649
|
+
if (missing.length > 0) {
|
|
650
|
+
emitInvalidArgument(`'${filePath}' has a manifest without ${missing.join(" and ")}, which the service requires, so it would refuse the import.`, "Export the project again with `uip tm project export` and import the new package.");
|
|
651
|
+
return null;
|
|
652
|
+
}
|
|
653
|
+
return manifest;
|
|
654
|
+
}
|
|
655
|
+
async function resolveImportTarget(options, prepared) {
|
|
656
|
+
if (options.createProject) {
|
|
657
|
+
const [authError, base] = await catchError(initializeContext(options));
|
|
658
|
+
if (authError) {
|
|
659
|
+
OutputFormatter.error({
|
|
660
|
+
Result: RESULTS.Failure,
|
|
661
|
+
Message: authError.message,
|
|
662
|
+
Instructions: instructionsFor("auth"),
|
|
663
|
+
ErrorCode: "authentication_required",
|
|
664
|
+
Retry: "RetryWillNotFix"
|
|
665
|
+
});
|
|
666
|
+
processContext.exit(1);
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
return createTargetProject(base.tmConfig, prepared.manifest, {
|
|
670
|
+
name: options.newProjectName,
|
|
671
|
+
key: options.newProjectKey
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
const ctx = await resolveContextWithProject(options);
|
|
675
|
+
if (!ctx)
|
|
676
|
+
return null;
|
|
677
|
+
const [error, project] = await catchError(new ProjectsApi(ctx.tmConfig).projectsGetById({ id: ctx.projectId }));
|
|
678
|
+
if (error) {
|
|
679
|
+
await emitTmFailure(error);
|
|
680
|
+
return null;
|
|
681
|
+
}
|
|
682
|
+
return {
|
|
683
|
+
tmConfig: ctx.tmConfig,
|
|
684
|
+
projectId: ctx.projectId,
|
|
685
|
+
project: {
|
|
686
|
+
name: project.name ?? undefined,
|
|
687
|
+
description: project.description ?? undefined,
|
|
688
|
+
projectPrefix: project.projectPrefix ?? undefined
|
|
689
|
+
},
|
|
690
|
+
created: false
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
async function createTargetProject(tmConfig, manifest, overrides) {
|
|
694
|
+
const fromPackage = manifest.project ?? {};
|
|
695
|
+
const name = overrides.name ?? fromPackage.name;
|
|
696
|
+
const key = overrides.key ?? fromPackage.projectPrefix;
|
|
697
|
+
if (!name || !key) {
|
|
698
|
+
emitInvalidArgument("--create-project needs a project name and key, and the package's manifest does not carry both.", "Pass --new-project-name and --new-project-key, or import into an existing project with --project-id.");
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
const description = fromPackage.description ?? "";
|
|
702
|
+
const [error, created] = await catchError(new ProjectsApi(tmConfig).projectsCreate({
|
|
703
|
+
uiPathTestManagementHubTestManagementAbstractionsDTOsCreateProjectRequest: { name, description, projectPrefix: key, isActive: false }
|
|
704
|
+
}));
|
|
705
|
+
if (error) {
|
|
706
|
+
await emitCreateProjectFailure(error, key);
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
709
|
+
if (!created.id) {
|
|
710
|
+
OutputFormatter.error({
|
|
711
|
+
Result: RESULTS.Failure,
|
|
712
|
+
Message: "The project was created but the service did not return its id, so the import cannot target it.",
|
|
713
|
+
Instructions: `Find it with: uip tm project list, then import with --project-key ${key}.`,
|
|
714
|
+
ErrorCode: "server_error",
|
|
715
|
+
Retry: "RetryLater"
|
|
716
|
+
});
|
|
717
|
+
processContext.exit(1);
|
|
718
|
+
return null;
|
|
719
|
+
}
|
|
720
|
+
logger.info(`created project '${name}' (${key}) -> ${created.id}`);
|
|
721
|
+
return {
|
|
722
|
+
tmConfig,
|
|
723
|
+
projectId: created.id,
|
|
724
|
+
project: { name, description, projectPrefix: key },
|
|
725
|
+
created: true
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
async function emitCreateProjectFailure(error, key) {
|
|
729
|
+
const { result, message, details, errorCode, retry } = await extractErrorDetails(error, {
|
|
730
|
+
forbiddenMessage: TM_FORBIDDEN_MESSAGE
|
|
731
|
+
});
|
|
732
|
+
const isDuplicate = /duplicat|already exists|unique/i.test(`${message} ${details}`);
|
|
733
|
+
OutputFormatter.error({
|
|
734
|
+
Result: result,
|
|
735
|
+
Message: isDuplicate ? `A project with key '${key}' already exists in this tenant, so it cannot be created for this import.` : message,
|
|
736
|
+
Instructions: isDuplicate ? `Pass --new-project-key with a free key, or import into the existing project with --project-key ${key}.` : details,
|
|
737
|
+
ErrorCode: errorCode,
|
|
738
|
+
Retry: retry
|
|
739
|
+
});
|
|
740
|
+
processContext.exit(EXIT_CODES[result] ?? 1);
|
|
741
|
+
}
|
|
742
|
+
async function emitImportCreateFailure(error, askedForProjectConfig, extraHint) {
|
|
743
|
+
const { result, message, details, errorCode, retry } = await extractErrorDetails(error, {
|
|
744
|
+
forbiddenMessage: TM_FORBIDDEN_MESSAGE
|
|
745
|
+
});
|
|
746
|
+
const isProjectConfigGate = askedForProjectConfig && errorCode === "permission_denied" && /project configuration/i.test(details);
|
|
747
|
+
OutputFormatter.error({
|
|
748
|
+
Result: result,
|
|
749
|
+
Message: isProjectConfigGate ? PROJECT_CONFIG_IMPORT_FORBIDDEN_MESSAGE : message,
|
|
750
|
+
Instructions: `${isProjectConfigGate ? "Drop project-config from --include, or run this against a Test Cloud tenant." : details}${extraHint}`,
|
|
751
|
+
ErrorCode: errorCode,
|
|
752
|
+
Retry: retry
|
|
753
|
+
});
|
|
754
|
+
processContext.exit(EXIT_CODES[result] ?? 1);
|
|
755
|
+
}
|
|
756
|
+
function emitMissingImportJobId(target) {
|
|
757
|
+
OutputFormatter.error({
|
|
758
|
+
Result: RESULTS.Failure,
|
|
759
|
+
Message: "The import job was created but the service did not return its id, so its chunks cannot be uploaded.",
|
|
760
|
+
Instructions: `Nothing was imported.${createdProjectHint(target)}`,
|
|
761
|
+
ErrorCode: "server_error",
|
|
762
|
+
Retry: "RetryLater"
|
|
763
|
+
});
|
|
764
|
+
processContext.exit(1);
|
|
765
|
+
}
|
|
766
|
+
async function uploadPackageChunks(attachmentApi, target, jobId, prepared) {
|
|
767
|
+
const { plan } = prepared;
|
|
768
|
+
for (const chunk of plan.chunks) {
|
|
769
|
+
const request = toChunkUploadRequest(target.projectId, jobId, chunk.name, prepared.bytes.subarray(chunk.start, chunk.end));
|
|
770
|
+
const error = await sendChunk(attachmentApi, request, chunk.index, plan.total);
|
|
771
|
+
if (error) {
|
|
772
|
+
await emitTmFailure(error, undefined, {
|
|
773
|
+
instructionsSuffix: `Chunk ${chunk.index} of ${plan.total} was not confirmed, so job '${jobId}' is incomplete: nothing is imported, and the service discards the job after 24 hours. Import again.${createdProjectHint(target)}`
|
|
774
|
+
});
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
logger.info(`uploaded chunk ${chunk.index}/${plan.total}`);
|
|
778
|
+
}
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
async function sendChunk(attachmentApi, request, index, total) {
|
|
782
|
+
for (let attempt = 1;; attempt++) {
|
|
783
|
+
const [error] = await catchError(attachmentApi.projectMigrationAttachmentUploadAttachment(request));
|
|
784
|
+
if (!error)
|
|
785
|
+
return;
|
|
786
|
+
if (attempt >= CHUNK_UPLOAD_ATTEMPTS || !chunkNeverLanded(error)) {
|
|
787
|
+
return error;
|
|
788
|
+
}
|
|
789
|
+
logger.warn(`chunk ${index}/${total} was not accepted (attempt ${attempt} of ${CHUNK_UPLOAD_ATTEMPTS}): ${error.message}`);
|
|
790
|
+
await sleep(CHUNK_RETRY_BACKOFF_MS * attempt);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function chunkNeverLanded(error) {
|
|
794
|
+
const status = error.response?.status;
|
|
795
|
+
if (status !== undefined)
|
|
796
|
+
return status === 429;
|
|
797
|
+
return errorCodes(error).some((code) => CHUNK_NOT_SENT_CODES.has(code));
|
|
798
|
+
}
|
|
799
|
+
function errorCodes(error, depth = 0) {
|
|
800
|
+
if (depth > 4 || typeof error !== "object" || error === null)
|
|
801
|
+
return [];
|
|
802
|
+
const { code, cause, errors } = error;
|
|
803
|
+
return [
|
|
804
|
+
...typeof code === "string" ? [code] : [],
|
|
805
|
+
...errorCodes(cause, depth + 1),
|
|
806
|
+
...Array.isArray(errors) ? errors.flatMap((e) => errorCodes(e, depth + 1)) : []
|
|
807
|
+
];
|
|
808
|
+
}
|
|
809
|
+
async function releaseJob(jobApi, target, jobId) {
|
|
810
|
+
const [error, released] = await catchError(jobApi.projectMigrationJobUpdateMigrationJob(toJobUpdateRequest(target.projectId, jobId, UiPathTestManagementHubProjectMigrationAbstractionsEnumsMigrationJobStatus.Ready)));
|
|
811
|
+
if (error) {
|
|
812
|
+
await emitReleaseFailure(error, target, jobId);
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
return released;
|
|
816
|
+
}
|
|
817
|
+
async function emitReleaseFailure(error, target, jobId) {
|
|
818
|
+
const status = error.response?.status;
|
|
819
|
+
const refused = status !== undefined && status >= 400 && status < 500;
|
|
820
|
+
if (refused) {
|
|
821
|
+
await emitTmFailure(error, undefined, {
|
|
822
|
+
instructionsSuffix: `Every chunk uploaded, but the service refused to release job '${jobId}', so nothing was imported. Import again.${createdProjectHint(target)}`
|
|
823
|
+
});
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
const { result, message, errorCode } = await extractErrorDetails(error, {
|
|
827
|
+
forbiddenMessage: TM_FORBIDDEN_MESSAGE
|
|
828
|
+
});
|
|
829
|
+
OutputFormatter.error({
|
|
830
|
+
Result: result,
|
|
831
|
+
Message: `Every chunk uploaded, but releasing job '${jobId}' was not confirmed: ${message}`,
|
|
832
|
+
Instructions: `The release may have gone through, in which case the import is running. ${recheckJobHint(target.projectId, jobId)}. Import again only if it still reads Uploading.${createdProjectHint(target)}`,
|
|
833
|
+
ErrorCode: errorCode,
|
|
834
|
+
Retry: "RetryWillNotFix"
|
|
835
|
+
});
|
|
836
|
+
processContext.exit(EXIT_CODES[result] ?? 1);
|
|
837
|
+
}
|
|
838
|
+
function createdProjectHint(target) {
|
|
839
|
+
if (!target.created)
|
|
840
|
+
return "";
|
|
841
|
+
const key = target.project.projectPrefix ?? "";
|
|
842
|
+
return ` The project '${key}' was created inactive for this import and is left in place: delete it with \`uip tm project delete --project-key ${key} --yes\`, or import into it with --project-key ${key}.`;
|
|
843
|
+
}
|
|
844
|
+
export {
|
|
845
|
+
chunkNeverLanded,
|
|
846
|
+
executeImport
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
//# debugId=2055C69681D5246564756E2164756E21
|