@uipath/codedapp-tool 1.199.0 → 1.200.0-preview.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-strategy-v4n9zxyf.js +99 -0
- package/dist/index-z6sptz1r.js +137 -0
- package/dist/index.js +15 -2148
- package/dist/multipart-parser-kme45c99.js +353 -0
- package/dist/node-strategy-0s9nhcmn.js +63 -0
- package/dist/tool-0gctz400.js +17 -0
- package/dist/tool-1snc64g4.js +11 -0
- package/dist/tool-7ktmqc73.js +1161 -0
- package/dist/tool-k7c9wf29.js +2485 -0
- package/dist/tool-v6rpdr25.js +72383 -0
- package/dist/tool-wckvcay0.js +50 -0
- package/dist/tool-y0g9grx6.js +4452 -0
- package/dist/tool.js +11 -99032
- package/package.json +2 -2
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormData,
|
|
3
|
+
file_default
|
|
4
|
+
} from "./tool-y0g9grx6.js";
|
|
5
|
+
import"./tool-wckvcay0.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/node-fetch/src/utils/multipart-parser.js
|
|
8
|
+
var s = 0;
|
|
9
|
+
var S = {
|
|
10
|
+
START_BOUNDARY: s++,
|
|
11
|
+
HEADER_FIELD_START: s++,
|
|
12
|
+
HEADER_FIELD: s++,
|
|
13
|
+
HEADER_VALUE_START: s++,
|
|
14
|
+
HEADER_VALUE: s++,
|
|
15
|
+
HEADER_VALUE_ALMOST_DONE: s++,
|
|
16
|
+
HEADERS_ALMOST_DONE: s++,
|
|
17
|
+
PART_DATA_START: s++,
|
|
18
|
+
PART_DATA: s++,
|
|
19
|
+
END: s++
|
|
20
|
+
};
|
|
21
|
+
var f = 1;
|
|
22
|
+
var F = {
|
|
23
|
+
PART_BOUNDARY: f,
|
|
24
|
+
LAST_BOUNDARY: f *= 2
|
|
25
|
+
};
|
|
26
|
+
var LF = 10;
|
|
27
|
+
var CR = 13;
|
|
28
|
+
var SPACE = 32;
|
|
29
|
+
var HYPHEN = 45;
|
|
30
|
+
var COLON = 58;
|
|
31
|
+
var A = 97;
|
|
32
|
+
var Z = 122;
|
|
33
|
+
var lower = (c) => c | 32;
|
|
34
|
+
var noop = () => {};
|
|
35
|
+
|
|
36
|
+
class MultipartParser {
|
|
37
|
+
constructor(boundary) {
|
|
38
|
+
this.index = 0;
|
|
39
|
+
this.flags = 0;
|
|
40
|
+
this.onHeaderEnd = noop;
|
|
41
|
+
this.onHeaderField = noop;
|
|
42
|
+
this.onHeadersEnd = noop;
|
|
43
|
+
this.onHeaderValue = noop;
|
|
44
|
+
this.onPartBegin = noop;
|
|
45
|
+
this.onPartData = noop;
|
|
46
|
+
this.onPartEnd = noop;
|
|
47
|
+
this.boundaryChars = {};
|
|
48
|
+
boundary = `\r
|
|
49
|
+
--` + boundary;
|
|
50
|
+
const ui8a = new Uint8Array(boundary.length);
|
|
51
|
+
for (let i = 0;i < boundary.length; i++) {
|
|
52
|
+
ui8a[i] = boundary.charCodeAt(i);
|
|
53
|
+
this.boundaryChars[ui8a[i]] = true;
|
|
54
|
+
}
|
|
55
|
+
this.boundary = ui8a;
|
|
56
|
+
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
|
57
|
+
this.state = S.START_BOUNDARY;
|
|
58
|
+
}
|
|
59
|
+
write(data) {
|
|
60
|
+
let i = 0;
|
|
61
|
+
const length_ = data.length;
|
|
62
|
+
let previousIndex = this.index;
|
|
63
|
+
let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
|
|
64
|
+
const boundaryLength = this.boundary.length;
|
|
65
|
+
const boundaryEnd = boundaryLength - 1;
|
|
66
|
+
const bufferLength = data.length;
|
|
67
|
+
let c;
|
|
68
|
+
let cl;
|
|
69
|
+
const mark = (name) => {
|
|
70
|
+
this[name + "Mark"] = i;
|
|
71
|
+
};
|
|
72
|
+
const clear = (name) => {
|
|
73
|
+
delete this[name + "Mark"];
|
|
74
|
+
};
|
|
75
|
+
const callback = (callbackSymbol, start, end, ui8a) => {
|
|
76
|
+
if (start === undefined || start !== end) {
|
|
77
|
+
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const dataCallback = (name, clear2) => {
|
|
81
|
+
const markSymbol = name + "Mark";
|
|
82
|
+
if (!(markSymbol in this)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (clear2) {
|
|
86
|
+
callback(name, this[markSymbol], i, data);
|
|
87
|
+
delete this[markSymbol];
|
|
88
|
+
} else {
|
|
89
|
+
callback(name, this[markSymbol], data.length, data);
|
|
90
|
+
this[markSymbol] = 0;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
for (i = 0;i < length_; i++) {
|
|
94
|
+
c = data[i];
|
|
95
|
+
switch (state) {
|
|
96
|
+
case S.START_BOUNDARY:
|
|
97
|
+
if (index === boundary.length - 2) {
|
|
98
|
+
if (c === HYPHEN) {
|
|
99
|
+
flags |= F.LAST_BOUNDARY;
|
|
100
|
+
} else if (c !== CR) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
index++;
|
|
104
|
+
break;
|
|
105
|
+
} else if (index - 1 === boundary.length - 2) {
|
|
106
|
+
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
|
107
|
+
state = S.END;
|
|
108
|
+
flags = 0;
|
|
109
|
+
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
|
110
|
+
index = 0;
|
|
111
|
+
callback("onPartBegin");
|
|
112
|
+
state = S.HEADER_FIELD_START;
|
|
113
|
+
} else {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (c !== boundary[index + 2]) {
|
|
119
|
+
index = -2;
|
|
120
|
+
}
|
|
121
|
+
if (c === boundary[index + 2]) {
|
|
122
|
+
index++;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case S.HEADER_FIELD_START:
|
|
126
|
+
state = S.HEADER_FIELD;
|
|
127
|
+
mark("onHeaderField");
|
|
128
|
+
index = 0;
|
|
129
|
+
case S.HEADER_FIELD:
|
|
130
|
+
if (c === CR) {
|
|
131
|
+
clear("onHeaderField");
|
|
132
|
+
state = S.HEADERS_ALMOST_DONE;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
index++;
|
|
136
|
+
if (c === HYPHEN) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
if (c === COLON) {
|
|
140
|
+
if (index === 1) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
dataCallback("onHeaderField", true);
|
|
144
|
+
state = S.HEADER_VALUE_START;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
cl = lower(c);
|
|
148
|
+
if (cl < A || cl > Z) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case S.HEADER_VALUE_START:
|
|
153
|
+
if (c === SPACE) {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
mark("onHeaderValue");
|
|
157
|
+
state = S.HEADER_VALUE;
|
|
158
|
+
case S.HEADER_VALUE:
|
|
159
|
+
if (c === CR) {
|
|
160
|
+
dataCallback("onHeaderValue", true);
|
|
161
|
+
callback("onHeaderEnd");
|
|
162
|
+
state = S.HEADER_VALUE_ALMOST_DONE;
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
case S.HEADER_VALUE_ALMOST_DONE:
|
|
166
|
+
if (c !== LF) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
state = S.HEADER_FIELD_START;
|
|
170
|
+
break;
|
|
171
|
+
case S.HEADERS_ALMOST_DONE:
|
|
172
|
+
if (c !== LF) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
callback("onHeadersEnd");
|
|
176
|
+
state = S.PART_DATA_START;
|
|
177
|
+
break;
|
|
178
|
+
case S.PART_DATA_START:
|
|
179
|
+
state = S.PART_DATA;
|
|
180
|
+
mark("onPartData");
|
|
181
|
+
case S.PART_DATA:
|
|
182
|
+
previousIndex = index;
|
|
183
|
+
if (index === 0) {
|
|
184
|
+
i += boundaryEnd;
|
|
185
|
+
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
|
186
|
+
i += boundaryLength;
|
|
187
|
+
}
|
|
188
|
+
i -= boundaryEnd;
|
|
189
|
+
c = data[i];
|
|
190
|
+
}
|
|
191
|
+
if (index < boundary.length) {
|
|
192
|
+
if (boundary[index] === c) {
|
|
193
|
+
if (index === 0) {
|
|
194
|
+
dataCallback("onPartData", true);
|
|
195
|
+
}
|
|
196
|
+
index++;
|
|
197
|
+
} else {
|
|
198
|
+
index = 0;
|
|
199
|
+
}
|
|
200
|
+
} else if (index === boundary.length) {
|
|
201
|
+
index++;
|
|
202
|
+
if (c === CR) {
|
|
203
|
+
flags |= F.PART_BOUNDARY;
|
|
204
|
+
} else if (c === HYPHEN) {
|
|
205
|
+
flags |= F.LAST_BOUNDARY;
|
|
206
|
+
} else {
|
|
207
|
+
index = 0;
|
|
208
|
+
}
|
|
209
|
+
} else if (index - 1 === boundary.length) {
|
|
210
|
+
if (flags & F.PART_BOUNDARY) {
|
|
211
|
+
index = 0;
|
|
212
|
+
if (c === LF) {
|
|
213
|
+
flags &= ~F.PART_BOUNDARY;
|
|
214
|
+
callback("onPartEnd");
|
|
215
|
+
callback("onPartBegin");
|
|
216
|
+
state = S.HEADER_FIELD_START;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
} else if (flags & F.LAST_BOUNDARY) {
|
|
220
|
+
if (c === HYPHEN) {
|
|
221
|
+
callback("onPartEnd");
|
|
222
|
+
state = S.END;
|
|
223
|
+
flags = 0;
|
|
224
|
+
} else {
|
|
225
|
+
index = 0;
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
index = 0;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (index > 0) {
|
|
232
|
+
lookbehind[index - 1] = c;
|
|
233
|
+
} else if (previousIndex > 0) {
|
|
234
|
+
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
|
235
|
+
callback("onPartData", 0, previousIndex, _lookbehind);
|
|
236
|
+
previousIndex = 0;
|
|
237
|
+
mark("onPartData");
|
|
238
|
+
i--;
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
case S.END:
|
|
242
|
+
break;
|
|
243
|
+
default:
|
|
244
|
+
throw new Error(`Unexpected state entered: ${state}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
dataCallback("onHeaderField");
|
|
248
|
+
dataCallback("onHeaderValue");
|
|
249
|
+
dataCallback("onPartData");
|
|
250
|
+
this.index = index;
|
|
251
|
+
this.state = state;
|
|
252
|
+
this.flags = flags;
|
|
253
|
+
}
|
|
254
|
+
end() {
|
|
255
|
+
if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) {
|
|
256
|
+
this.onPartEnd();
|
|
257
|
+
} else if (this.state !== S.END) {
|
|
258
|
+
throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function _fileName(headerValue) {
|
|
263
|
+
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
264
|
+
if (!m) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const match = m[2] || m[3] || "";
|
|
268
|
+
let filename = match.slice(match.lastIndexOf("\\") + 1);
|
|
269
|
+
filename = filename.replace(/%22/g, '"');
|
|
270
|
+
filename = filename.replace(/&#(\d{4});/g, (m2, code) => {
|
|
271
|
+
return String.fromCharCode(code);
|
|
272
|
+
});
|
|
273
|
+
return filename;
|
|
274
|
+
}
|
|
275
|
+
async function toFormData(Body, ct) {
|
|
276
|
+
if (!/multipart/i.test(ct)) {
|
|
277
|
+
throw new TypeError("Failed to fetch");
|
|
278
|
+
}
|
|
279
|
+
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
280
|
+
if (!m) {
|
|
281
|
+
throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
282
|
+
}
|
|
283
|
+
const parser = new MultipartParser(m[1] || m[2]);
|
|
284
|
+
let headerField;
|
|
285
|
+
let headerValue;
|
|
286
|
+
let entryValue;
|
|
287
|
+
let entryName;
|
|
288
|
+
let contentType;
|
|
289
|
+
let filename;
|
|
290
|
+
const entryChunks = [];
|
|
291
|
+
const formData = new FormData;
|
|
292
|
+
const onPartData = (ui8a) => {
|
|
293
|
+
entryValue += decoder.decode(ui8a, { stream: true });
|
|
294
|
+
};
|
|
295
|
+
const appendToFile = (ui8a) => {
|
|
296
|
+
entryChunks.push(ui8a);
|
|
297
|
+
};
|
|
298
|
+
const appendFileToFormData = () => {
|
|
299
|
+
const file = new file_default(entryChunks, filename, { type: contentType });
|
|
300
|
+
formData.append(entryName, file);
|
|
301
|
+
};
|
|
302
|
+
const appendEntryToFormData = () => {
|
|
303
|
+
formData.append(entryName, entryValue);
|
|
304
|
+
};
|
|
305
|
+
const decoder = new TextDecoder("utf-8");
|
|
306
|
+
decoder.decode();
|
|
307
|
+
parser.onPartBegin = function() {
|
|
308
|
+
parser.onPartData = onPartData;
|
|
309
|
+
parser.onPartEnd = appendEntryToFormData;
|
|
310
|
+
headerField = "";
|
|
311
|
+
headerValue = "";
|
|
312
|
+
entryValue = "";
|
|
313
|
+
entryName = "";
|
|
314
|
+
contentType = "";
|
|
315
|
+
filename = null;
|
|
316
|
+
entryChunks.length = 0;
|
|
317
|
+
};
|
|
318
|
+
parser.onHeaderField = function(ui8a) {
|
|
319
|
+
headerField += decoder.decode(ui8a, { stream: true });
|
|
320
|
+
};
|
|
321
|
+
parser.onHeaderValue = function(ui8a) {
|
|
322
|
+
headerValue += decoder.decode(ui8a, { stream: true });
|
|
323
|
+
};
|
|
324
|
+
parser.onHeaderEnd = function() {
|
|
325
|
+
headerValue += decoder.decode();
|
|
326
|
+
headerField = headerField.toLowerCase();
|
|
327
|
+
if (headerField === "content-disposition") {
|
|
328
|
+
const m2 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
329
|
+
if (m2) {
|
|
330
|
+
entryName = m2[2] || m2[3] || "";
|
|
331
|
+
}
|
|
332
|
+
filename = _fileName(headerValue);
|
|
333
|
+
if (filename) {
|
|
334
|
+
parser.onPartData = appendToFile;
|
|
335
|
+
parser.onPartEnd = appendFileToFormData;
|
|
336
|
+
}
|
|
337
|
+
} else if (headerField === "content-type") {
|
|
338
|
+
contentType = headerValue;
|
|
339
|
+
}
|
|
340
|
+
headerValue = "";
|
|
341
|
+
headerField = "";
|
|
342
|
+
};
|
|
343
|
+
for await (const chunk of Body) {
|
|
344
|
+
parser.write(chunk);
|
|
345
|
+
}
|
|
346
|
+
parser.end();
|
|
347
|
+
return formData;
|
|
348
|
+
}
|
|
349
|
+
export {
|
|
350
|
+
toFormData
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
//# debugId=EC19E2789120610F64756E2164756E21
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError,
|
|
3
|
+
getFileSystem,
|
|
4
|
+
startServer
|
|
5
|
+
} from "./tool-7ktmqc73.js";
|
|
6
|
+
import"./tool-1snc64g4.js";
|
|
7
|
+
import"./tool-wckvcay0.js";
|
|
8
|
+
|
|
9
|
+
// ../auth/src/strategies/node-strategy.ts
|
|
10
|
+
class NodeAuthStrategy {
|
|
11
|
+
async execute(url, redirectUri, expectedState, opts) {
|
|
12
|
+
const fs = getFileSystem();
|
|
13
|
+
const callbackUrl = await startServer({
|
|
14
|
+
redirectUri,
|
|
15
|
+
timeoutMs: opts?.timeoutMs,
|
|
16
|
+
signal: opts?.signal,
|
|
17
|
+
onListening: async () => {
|
|
18
|
+
let safeUrl = "";
|
|
19
|
+
for (const ch of url) {
|
|
20
|
+
const c = ch.charCodeAt(0);
|
|
21
|
+
if (c > 31 && (c < 128 || c > 159))
|
|
22
|
+
safeUrl += ch;
|
|
23
|
+
}
|
|
24
|
+
if (opts?.noBrowser) {
|
|
25
|
+
if (!opts.onAuthUrl) {
|
|
26
|
+
throw new Error("Headless login (noBrowser) requires an onAuthUrl handler " + "to surface the authorize URL, but none was provided.");
|
|
27
|
+
}
|
|
28
|
+
opts.onAuthUrl(safeUrl);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const [openError] = await catchError(fs.utils.open(url));
|
|
32
|
+
if (!openError)
|
|
33
|
+
return;
|
|
34
|
+
const isSpawnError = "code" in openError && openError.code === "ENOENT";
|
|
35
|
+
if (isSpawnError) {
|
|
36
|
+
throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
|
|
37
|
+
|
|
38
|
+
` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
|
|
39
|
+
|
|
40
|
+
` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
|
|
41
|
+
}
|
|
42
|
+
throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
|
|
43
|
+
|
|
44
|
+
${safeUrl}
|
|
45
|
+
`, { cause: openError });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const returnedState = callbackUrl.searchParams.get("state");
|
|
49
|
+
if (returnedState !== expectedState) {
|
|
50
|
+
throw new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again.");
|
|
51
|
+
}
|
|
52
|
+
const code = callbackUrl.searchParams.get("code");
|
|
53
|
+
if (!code) {
|
|
54
|
+
throw new Error("No authorization code received");
|
|
55
|
+
}
|
|
56
|
+
return code;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
NodeAuthStrategy
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//# debugId=E5B2BD2B3B179D3D64756E2164756E21
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// ../auth/src/utils/platform.ts
|
|
2
|
+
function isBrowser() {
|
|
3
|
+
return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
|
|
4
|
+
}
|
|
5
|
+
function isNode() {
|
|
6
|
+
return typeof process !== "undefined" && process.versions !== undefined && process.versions.node !== undefined;
|
|
7
|
+
}
|
|
8
|
+
function getGlobalThis() {
|
|
9
|
+
if (typeof globalThis !== "undefined") {
|
|
10
|
+
return globalThis;
|
|
11
|
+
}
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { isBrowser, isNode, getGlobalThis };
|
|
16
|
+
|
|
17
|
+
//# debugId=30FE559992242EE964756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ../auth/src/constants.ts
|
|
2
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
3
|
+
var AUTH_FILENAME = ".auth";
|
|
4
|
+
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
5
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
6
|
+
var AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED";
|
|
7
|
+
var DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
8
|
+
|
|
9
|
+
export { UIPATH_HOME_DIR, AUTH_FILENAME, DEFAULT_BASE_URL, DEFAULT_AUTH_TIMEOUT_MS, AUTH_CANCELLED_ERROR_CODE, DEFAULT_REDIRECT_URI };
|
|
10
|
+
|
|
11
|
+
//# debugId=A9146565B192C43A64756E2164756E21
|