@uipath/eval-tool 1.206.0-preview.303 → 1.207.0-preview.305
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.
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
installSdkUserAgentHeader,
|
|
5
5
|
resolveSessionIdentity,
|
|
6
6
|
getAuthContext
|
|
7
|
-
} from "./tool-
|
|
7
|
+
} from "./tool-zjtt7mr7.js";
|
|
8
8
|
|
|
9
9
|
// ../orchestrator-sdk/generated/src/runtime.ts
|
|
10
10
|
var BASE_PATH = "https://alpha.uipath.com/Ada/byoa/orchestrator_".replace(/\/+$/, "");
|
|
@@ -204,6 +204,15 @@ class FetchError extends Error {
|
|
|
204
204
|
this.cause = cause;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
class RequiredError extends Error {
|
|
209
|
+
field;
|
|
210
|
+
name = "RequiredError";
|
|
211
|
+
constructor(field, msg) {
|
|
212
|
+
super(msg);
|
|
213
|
+
this.field = field;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
207
216
|
function querystring(params, prefix = "") {
|
|
208
217
|
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
209
218
|
}
|
|
@@ -236,12 +245,22 @@ class JSONApiResponse {
|
|
|
236
245
|
return this.transformer(await this.raw.json());
|
|
237
246
|
}
|
|
238
247
|
}
|
|
248
|
+
|
|
249
|
+
class VoidApiResponse {
|
|
250
|
+
raw;
|
|
251
|
+
constructor(raw) {
|
|
252
|
+
this.raw = raw;
|
|
253
|
+
}
|
|
254
|
+
async value() {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
239
258
|
// ../orchestrator-sdk/package.json
|
|
240
259
|
var package_default = {
|
|
241
260
|
name: "@uipath/orchestrator-sdk",
|
|
242
261
|
author: "UiPath",
|
|
243
262
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
244
|
-
version: "1.
|
|
263
|
+
version: "1.207.0",
|
|
245
264
|
repository: {
|
|
246
265
|
type: "git",
|
|
247
266
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -298,6 +317,37 @@ var package_default = {
|
|
|
298
317
|
// ../orchestrator-sdk/src/user-agent.ts
|
|
299
318
|
var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
|
|
300
319
|
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
320
|
+
// ../orchestrator-sdk/generated/src/models/MachineRuntimeDto.ts
|
|
321
|
+
var MachineRuntimeDtoTypeEnum = {
|
|
322
|
+
NonProduction: "NonProduction",
|
|
323
|
+
Attended: "Attended",
|
|
324
|
+
Unattended: "Unattended",
|
|
325
|
+
Development: "Development",
|
|
326
|
+
Studio: "Studio",
|
|
327
|
+
RpaDeveloper: "RpaDeveloper",
|
|
328
|
+
StudioX: "StudioX",
|
|
329
|
+
CitizenDeveloper: "CitizenDeveloper",
|
|
330
|
+
Headless: "Headless",
|
|
331
|
+
StudioPro: "StudioPro",
|
|
332
|
+
RpaDeveloperPro: "RpaDeveloperPro",
|
|
333
|
+
TestAutomation: "TestAutomation",
|
|
334
|
+
AutomationCloud: "AutomationCloud",
|
|
335
|
+
Serverless: "Serverless",
|
|
336
|
+
AutomationKit: "AutomationKit",
|
|
337
|
+
ServerlessTestAutomation: "ServerlessTestAutomation",
|
|
338
|
+
AutomationCloudTestAutomation: "AutomationCloudTestAutomation",
|
|
339
|
+
AttendedStudioWeb: "AttendedStudioWeb",
|
|
340
|
+
Hosting: "Hosting",
|
|
341
|
+
AssistantWeb: "AssistantWeb",
|
|
342
|
+
ProcessOrchestration: "ProcessOrchestration",
|
|
343
|
+
AgentService: "AgentService",
|
|
344
|
+
AppTest: "AppTest",
|
|
345
|
+
PerformanceTest: "PerformanceTest",
|
|
346
|
+
BusinessRule: "BusinessRule",
|
|
347
|
+
CaseManagement: "CaseManagement",
|
|
348
|
+
Flow: "Flow",
|
|
349
|
+
Local: "Local"
|
|
350
|
+
};
|
|
301
351
|
// ../orchestrator-sdk/generated/src/models/PersonalWorkspaceDto.ts
|
|
302
352
|
function PersonalWorkspaceDtoFromJSON(json) {
|
|
303
353
|
return PersonalWorkspaceDtoFromJSONTyped(json, false);
|
|
@@ -331,6 +381,23 @@ function ODataValueOfIEnumerableOfPersonalWorkspaceDtoFromJSONTyped(json, ignore
|
|
|
331
381
|
value: json["value"] == null ? undefined : json["value"].map(PersonalWorkspaceDtoFromJSON)
|
|
332
382
|
};
|
|
333
383
|
}
|
|
384
|
+
// ../orchestrator-sdk/generated/src/apis/MachinesApi.ts
|
|
385
|
+
var MachinesGetRuntimesForFolderByFolderidProcessTypeEnum = {
|
|
386
|
+
Undefined: "Undefined",
|
|
387
|
+
Process: "Process",
|
|
388
|
+
ProcessOrchestration: "ProcessOrchestration",
|
|
389
|
+
WebApp: "WebApp",
|
|
390
|
+
Agent: "Agent",
|
|
391
|
+
TestAutomationProcess: "TestAutomationProcess",
|
|
392
|
+
Api: "Api",
|
|
393
|
+
McpServer: "MCPServer",
|
|
394
|
+
BusinessRules: "BusinessRules",
|
|
395
|
+
CaseManagement: "CaseManagement",
|
|
396
|
+
Flow: "Flow",
|
|
397
|
+
Function: "Function",
|
|
398
|
+
System: "System",
|
|
399
|
+
FlowAutomate: "FlowAutomate"
|
|
400
|
+
};
|
|
334
401
|
// ../orchestrator-sdk/generated/src/apis/PersonalWorkspacesApi.ts
|
|
335
402
|
class PersonalWorkspacesApi extends BaseAPI {
|
|
336
403
|
async personalWorkspacesGetRaw(requestParameters, initOverrides) {
|
|
@@ -398,6 +465,50 @@ class PersonalWorkspacesApi extends BaseAPI {
|
|
|
398
465
|
const response = await this.personalWorkspacesGetPersonalWorkspaceRaw(requestParameters, initOverrides);
|
|
399
466
|
return await response.value();
|
|
400
467
|
}
|
|
468
|
+
async personalWorkspacesStartExploringByIdRaw(requestParameters, initOverrides) {
|
|
469
|
+
if (requestParameters["key"] == null) {
|
|
470
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling personalWorkspacesStartExploringById().');
|
|
471
|
+
}
|
|
472
|
+
const queryParameters = {};
|
|
473
|
+
const headerParameters = {};
|
|
474
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
475
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
|
|
476
|
+
}
|
|
477
|
+
let urlPath = `/odata/PersonalWorkspaces({key})/UiPath.Server.Configuration.OData.StartExploring`;
|
|
478
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
479
|
+
const response = await this.request({
|
|
480
|
+
path: urlPath,
|
|
481
|
+
method: "POST",
|
|
482
|
+
headers: headerParameters,
|
|
483
|
+
query: queryParameters
|
|
484
|
+
}, initOverrides);
|
|
485
|
+
return new VoidApiResponse(response);
|
|
486
|
+
}
|
|
487
|
+
async personalWorkspacesStartExploringById(requestParameters, initOverrides) {
|
|
488
|
+
await this.personalWorkspacesStartExploringByIdRaw(requestParameters, initOverrides);
|
|
489
|
+
}
|
|
490
|
+
async personalWorkspacesStopExploringByIdRaw(requestParameters, initOverrides) {
|
|
491
|
+
if (requestParameters["key"] == null) {
|
|
492
|
+
throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling personalWorkspacesStopExploringById().');
|
|
493
|
+
}
|
|
494
|
+
const queryParameters = {};
|
|
495
|
+
const headerParameters = {};
|
|
496
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
497
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
|
|
498
|
+
}
|
|
499
|
+
let urlPath = `/odata/PersonalWorkspaces({key})/UiPath.Server.Configuration.OData.StopExploring`;
|
|
500
|
+
urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
|
|
501
|
+
const response = await this.request({
|
|
502
|
+
path: urlPath,
|
|
503
|
+
method: "POST",
|
|
504
|
+
headers: headerParameters,
|
|
505
|
+
query: queryParameters
|
|
506
|
+
}, initOverrides);
|
|
507
|
+
return new VoidApiResponse(response);
|
|
508
|
+
}
|
|
509
|
+
async personalWorkspacesStopExploringById(requestParameters, initOverrides) {
|
|
510
|
+
await this.personalWorkspacesStopExploringByIdRaw(requestParameters, initOverrides);
|
|
511
|
+
}
|
|
401
512
|
}
|
|
402
513
|
// ../common/src/session-kind.ts
|
|
403
514
|
var SESSION_KIND_KEY = Symbol.for("@uipath/common/SessionKind");
|
|
@@ -464,6 +575,29 @@ async function createApiClient(ApiClass, options) {
|
|
|
464
575
|
const config = await createOrchestratorConfig(options);
|
|
465
576
|
return new ApiClass(config);
|
|
466
577
|
}
|
|
578
|
+
// ../orchestrator-sdk/src/folder-runtimes.ts
|
|
579
|
+
var FOLDER_RUNTIMES = {
|
|
580
|
+
[MachinesGetRuntimesForFolderByFolderidProcessTypeEnum.Process]: [
|
|
581
|
+
MachineRuntimeDtoTypeEnum.Serverless,
|
|
582
|
+
MachineRuntimeDtoTypeEnum.AutomationCloud,
|
|
583
|
+
MachineRuntimeDtoTypeEnum.AutomationCloudTestAutomation,
|
|
584
|
+
MachineRuntimeDtoTypeEnum.AppTest,
|
|
585
|
+
MachineRuntimeDtoTypeEnum.PerformanceTest,
|
|
586
|
+
MachineRuntimeDtoTypeEnum.Unattended,
|
|
587
|
+
MachineRuntimeDtoTypeEnum.NonProduction,
|
|
588
|
+
MachineRuntimeDtoTypeEnum.TestAutomation
|
|
589
|
+
],
|
|
590
|
+
[MachinesGetRuntimesForFolderByFolderidProcessTypeEnum.TestAutomationProcess]: [
|
|
591
|
+
MachineRuntimeDtoTypeEnum.Serverless,
|
|
592
|
+
MachineRuntimeDtoTypeEnum.ServerlessTestAutomation,
|
|
593
|
+
MachineRuntimeDtoTypeEnum.AutomationCloudTestAutomation,
|
|
594
|
+
MachineRuntimeDtoTypeEnum.AutomationCloud,
|
|
595
|
+
MachineRuntimeDtoTypeEnum.AppTest,
|
|
596
|
+
MachineRuntimeDtoTypeEnum.TestAutomation,
|
|
597
|
+
MachineRuntimeDtoTypeEnum.Unattended
|
|
598
|
+
],
|
|
599
|
+
[MachinesGetRuntimesForFolderByFolderidProcessTypeEnum.McpServer]: [MachineRuntimeDtoTypeEnum.Serverless]
|
|
600
|
+
};
|
|
467
601
|
// ../orchestrator-sdk/src/knowledge-bundles.ts
|
|
468
602
|
var KB_INLINE_LIMITS = {
|
|
469
603
|
maxObjectBytes: 16 * 1024 * 1024,
|
|
@@ -475,4 +609,4 @@ export {
|
|
|
475
609
|
createApiClient
|
|
476
610
|
};
|
|
477
611
|
|
|
478
|
-
//# debugId=
|
|
612
|
+
//# debugId=54E6DCF4FEA36D2864756E2164756E21
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
Command
|
|
4
|
-
} from "./tool-
|
|
4
|
+
} from "./tool-zjtt7mr7.js";
|
|
5
5
|
import {
|
|
6
6
|
metadata2,
|
|
7
7
|
registerCommands2
|
|
8
|
-
} from "./tool-
|
|
8
|
+
} from "./tool-wav53rww.js";
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var program = new Command;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
catchError,
|
|
3
|
+
RESULTS,
|
|
3
4
|
carriedInstructions,
|
|
5
|
+
isHtmlDocument,
|
|
4
6
|
extractErrorDetails,
|
|
5
7
|
extractErrorMessage,
|
|
6
8
|
instructionsFor,
|
|
7
|
-
|
|
9
|
+
notSupportedFailure,
|
|
8
10
|
Pagination,
|
|
9
11
|
OutputFormatter,
|
|
10
12
|
processContext,
|
|
11
13
|
getAuthContext
|
|
12
|
-
} from "./tool-
|
|
14
|
+
} from "./tool-zjtt7mr7.js";
|
|
13
15
|
// package.json
|
|
14
16
|
var package_default = {
|
|
15
17
|
name: "@uipath/eval-tool",
|
|
16
18
|
author: "UiPath",
|
|
17
19
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
18
|
-
version: "1.
|
|
20
|
+
version: "1.207.0-preview.305",
|
|
19
21
|
description: "Manage runtime evaluations, evaluators, eval sets, evaluations, and schedules.",
|
|
20
22
|
private: false,
|
|
21
23
|
repository: {
|
|
@@ -80,6 +82,10 @@ async function resolveEvalAuth(tenant) {
|
|
|
80
82
|
tenantId: ctx.tenantId ?? ""
|
|
81
83
|
};
|
|
82
84
|
}
|
|
85
|
+
var SIGN_IN_URL_RE = /\/identity_\/|\/(?:account\/)?(?:login|signin)\b/i;
|
|
86
|
+
function isSignInRedirect(response) {
|
|
87
|
+
return response.redirected && SIGN_IN_URL_RE.test(response.url);
|
|
88
|
+
}
|
|
83
89
|
|
|
84
90
|
class EvalApiError extends Error {
|
|
85
91
|
status;
|
|
@@ -105,6 +111,15 @@ class EvalResponseError extends Error {
|
|
|
105
111
|
this.instructions = instructions;
|
|
106
112
|
}
|
|
107
113
|
}
|
|
114
|
+
|
|
115
|
+
class EvalNotSupportedError extends Error {
|
|
116
|
+
failure;
|
|
117
|
+
constructor(failure) {
|
|
118
|
+
super(failure.Message);
|
|
119
|
+
this.name = "EvalNotSupportedError";
|
|
120
|
+
this.failure = failure;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
108
123
|
async function evalApiRequest(url, headers, method, body) {
|
|
109
124
|
const response = await fetch(url, {
|
|
110
125
|
method,
|
|
@@ -115,6 +130,12 @@ async function evalApiRequest(url, headers, method, body) {
|
|
|
115
130
|
if (!response.ok) {
|
|
116
131
|
throw new EvalApiError(method, url.split("?")[0] ?? url, response.status, response.statusText, text, response.headers);
|
|
117
132
|
}
|
|
133
|
+
if (isHtmlDocument(text)) {
|
|
134
|
+
if (isSignInRedirect(response)) {
|
|
135
|
+
throw new EvalApiError(method, url.split("?")[0] ?? url, 401, "Unauthorized", "", response.headers);
|
|
136
|
+
}
|
|
137
|
+
throw new EvalNotSupportedError(notSupportedFailure("Runtime evaluations", "The evaluations API is only available on Automation Cloud. Confirm the target environment with 'uip whoami'.", { httpStatus: response.status }));
|
|
138
|
+
}
|
|
118
139
|
if (!text)
|
|
119
140
|
return {};
|
|
120
141
|
try {
|
|
@@ -160,6 +181,9 @@ async function evalApiRequestOrFail(url, headers, method, instructions, body) {
|
|
|
160
181
|
return data;
|
|
161
182
|
}
|
|
162
183
|
async function evalFailureEnvelope(error, fallbackInstructions) {
|
|
184
|
+
if (error instanceof EvalNotSupportedError) {
|
|
185
|
+
return error.failure;
|
|
186
|
+
}
|
|
163
187
|
const details = await extractErrorDetails(error);
|
|
164
188
|
return {
|
|
165
189
|
Result: details.result,
|
|
@@ -1066,7 +1090,7 @@ async function resolveInline(options) {
|
|
|
1066
1090
|
folderKey = options.folderKey;
|
|
1067
1091
|
folderLabel = folderKey;
|
|
1068
1092
|
} else {
|
|
1069
|
-
const { createApiClient, PersonalWorkspacesApi } = await import("./index-
|
|
1093
|
+
const { createApiClient, PersonalWorkspacesApi } = await import("./index-as56jp49.js");
|
|
1070
1094
|
const [wsApiErr, wsApi] = await catchError(createApiClient(PersonalWorkspacesApi, {
|
|
1071
1095
|
tenant: options.tenant
|
|
1072
1096
|
}));
|
|
@@ -1629,4 +1653,4 @@ var registerCommands2 = async (program) => {
|
|
|
1629
1653
|
|
|
1630
1654
|
export { metadata2, registerCommands2 };
|
|
1631
1655
|
|
|
1632
|
-
//# debugId=
|
|
1656
|
+
//# debugId=473FD6ADB8D1696964756E2164756E21
|
|
@@ -2224,13 +2224,15 @@ var ProjectDimensions = {
|
|
|
2224
2224
|
SolutionKey: "SolutionKey",
|
|
2225
2225
|
SolutionProjectKey: "SolutionProjectKey",
|
|
2226
2226
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2227
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2227
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
2228
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
2228
2229
|
};
|
|
2229
2230
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
2230
2231
|
ProjectDimensions.ProjectKey,
|
|
2231
2232
|
ProjectDimensions.SolutionKey,
|
|
2232
2233
|
ProjectDimensions.SolutionProjectKey,
|
|
2233
|
-
ProjectDimensions.PreviousSolutionKey
|
|
2234
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
2235
|
+
ProjectDimensions.PreviousProjectKey
|
|
2234
2236
|
]);
|
|
2235
2237
|
var ShipDimensions = {
|
|
2236
2238
|
ShipKind: "ShipKind",
|
|
@@ -2473,12 +2475,26 @@ class NodeFileSystem {
|
|
|
2473
2475
|
throw error;
|
|
2474
2476
|
}
|
|
2475
2477
|
}
|
|
2476
|
-
async writeFile(filePath, data) {
|
|
2478
|
+
async writeFile(filePath, data, options) {
|
|
2477
2479
|
const dir = path.dirname(filePath);
|
|
2478
2480
|
if (dir) {
|
|
2479
2481
|
await fs.mkdir(dir, { recursive: true });
|
|
2480
2482
|
}
|
|
2481
|
-
|
|
2483
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
2484
|
+
if (options?.exclusive) {
|
|
2485
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
2486
|
+
} else {
|
|
2487
|
+
await fs.writeFile(filePath, data);
|
|
2488
|
+
}
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2491
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
2492
|
+
try {
|
|
2493
|
+
await handle.chmod(options.mode);
|
|
2494
|
+
await handle.writeFile(data);
|
|
2495
|
+
} finally {
|
|
2496
|
+
await handle.close();
|
|
2497
|
+
}
|
|
2482
2498
|
}
|
|
2483
2499
|
async appendFile(filePath, data) {
|
|
2484
2500
|
const dir = path.dirname(filePath);
|
|
@@ -2513,7 +2529,8 @@ class NodeFileSystem {
|
|
|
2513
2529
|
isDirectory: () => stats.isDirectory(),
|
|
2514
2530
|
size: stats.size,
|
|
2515
2531
|
mtimeMs: stats.mtimeMs,
|
|
2516
|
-
ctimeMs: stats.ctimeMs
|
|
2532
|
+
ctimeMs: stats.ctimeMs,
|
|
2533
|
+
mode: stats.mode
|
|
2517
2534
|
};
|
|
2518
2535
|
} catch (error) {
|
|
2519
2536
|
if (this.isEnoent(error))
|
|
@@ -2524,8 +2541,13 @@ class NodeFileSystem {
|
|
|
2524
2541
|
async exists(filePath) {
|
|
2525
2542
|
return existsSync(filePath);
|
|
2526
2543
|
}
|
|
2527
|
-
async mkdir(dirPath) {
|
|
2528
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
2544
|
+
async mkdir(dirPath, options) {
|
|
2545
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
2546
|
+
}
|
|
2547
|
+
async chmod(targetPath, mode) {
|
|
2548
|
+
if (process.platform === "win32")
|
|
2549
|
+
return;
|
|
2550
|
+
await fs.chmod(targetPath, mode);
|
|
2529
2551
|
}
|
|
2530
2552
|
async acquireLock(lockPath) {
|
|
2531
2553
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -2675,7 +2697,7 @@ class NodeFileSystem {
|
|
|
2675
2697
|
async getTempDir() {
|
|
2676
2698
|
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
2677
2699
|
}
|
|
2678
|
-
async copyDirectory(sourcePath, destPath) {
|
|
2700
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
2679
2701
|
const sourceStats = await this.stat(sourcePath);
|
|
2680
2702
|
if (!sourceStats) {
|
|
2681
2703
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -2692,7 +2714,9 @@ class NodeFileSystem {
|
|
|
2692
2714
|
if (!entryStats)
|
|
2693
2715
|
continue;
|
|
2694
2716
|
if (entryStats.isDirectory()) {
|
|
2695
|
-
|
|
2717
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
2718
|
+
continue;
|
|
2719
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
2696
2720
|
} else if (entryStats.isFile()) {
|
|
2697
2721
|
const content = await this.readFile(srcEntry);
|
|
2698
2722
|
if (content !== null) {
|
|
@@ -2749,9 +2773,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
2749
2773
|
}
|
|
2750
2774
|
}
|
|
2751
2775
|
|
|
2752
|
-
// ../common/src/
|
|
2753
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2754
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2776
|
+
// ../common/src/sha256.ts
|
|
2755
2777
|
var SHA256_K = new Uint32Array([
|
|
2756
2778
|
1116352408,
|
|
2757
2779
|
1899447441,
|
|
@@ -2831,7 +2853,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
2831
2853
|
function rotr(value, bits) {
|
|
2832
2854
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2833
2855
|
}
|
|
2834
|
-
function
|
|
2856
|
+
function sha256Words(input) {
|
|
2835
2857
|
const bytes = new TextEncoder().encode(input);
|
|
2836
2858
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2837
2859
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -2887,12 +2909,19 @@ function sha256Hex(input) {
|
|
|
2887
2909
|
state[6] = state[6] + g >>> 0;
|
|
2888
2910
|
state[7] = state[7] + h >>> 0;
|
|
2889
2911
|
}
|
|
2912
|
+
return state;
|
|
2913
|
+
}
|
|
2914
|
+
function sha256Hex(input) {
|
|
2890
2915
|
let hex = "";
|
|
2891
|
-
for (const word of
|
|
2916
|
+
for (const word of sha256Words(input)) {
|
|
2892
2917
|
hex += word.toString(16).padStart(8, "0");
|
|
2893
2918
|
}
|
|
2894
2919
|
return hex;
|
|
2895
2920
|
}
|
|
2921
|
+
|
|
2922
|
+
// ../common/src/telemetry/pseudonymize.ts
|
|
2923
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2924
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2896
2925
|
function resolveSha256Hex() {
|
|
2897
2926
|
try {
|
|
2898
2927
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -3258,13 +3287,25 @@ function settlePromiseLike(thenable) {
|
|
|
3258
3287
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
3259
3288
|
}
|
|
3260
3289
|
|
|
3290
|
+
// ../common/src/result-types.ts
|
|
3291
|
+
var RESULTS = {
|
|
3292
|
+
Success: "Success",
|
|
3293
|
+
Failure: "Failure",
|
|
3294
|
+
ConfigError: "ConfigError",
|
|
3295
|
+
AuthenticationError: "AuthenticationError",
|
|
3296
|
+
ValidationError: "ValidationError",
|
|
3297
|
+
TimeoutError: "TimeoutError"
|
|
3298
|
+
};
|
|
3299
|
+
|
|
3261
3300
|
// ../common/src/error-codes.ts
|
|
3262
3301
|
var CLI_ERROR_CODES = [
|
|
3263
3302
|
"invalid_argument",
|
|
3303
|
+
"confirmation_required",
|
|
3264
3304
|
"authentication_required",
|
|
3265
3305
|
"permission_denied",
|
|
3266
3306
|
"local_permission_denied",
|
|
3267
3307
|
"not_found",
|
|
3308
|
+
"not_enabled",
|
|
3268
3309
|
"rate_limited",
|
|
3269
3310
|
"network_error",
|
|
3270
3311
|
"timeout",
|
|
@@ -3303,6 +3344,12 @@ function carriedRetry(error) {
|
|
|
3303
3344
|
const retry = error.retry;
|
|
3304
3345
|
return isRetryHint(retry) ? retry : undefined;
|
|
3305
3346
|
}
|
|
3347
|
+
function carriedResult(error) {
|
|
3348
|
+
if (!error || typeof error !== "object")
|
|
3349
|
+
return;
|
|
3350
|
+
const result = error.result;
|
|
3351
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
3352
|
+
}
|
|
3306
3353
|
function defaultRetryForErrorCode(errorCode) {
|
|
3307
3354
|
switch (errorCode) {
|
|
3308
3355
|
case "network_error":
|
|
@@ -3698,6 +3745,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3698
3745
|
}
|
|
3699
3746
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
3700
3747
|
context.errorCode = parsedBody.errorCode;
|
|
3748
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
3749
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
3701
3750
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
3702
3751
|
context.errorCode = parsedBody.code;
|
|
3703
3752
|
}
|
|
@@ -3836,15 +3885,17 @@ function instructionsFor(ctx, err) {
|
|
|
3836
3885
|
}
|
|
3837
3886
|
}
|
|
3838
3887
|
|
|
3839
|
-
// ../common/src/
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
}
|
|
3888
|
+
// ../common/src/classified-failure.ts
|
|
3889
|
+
function notSupportedFailure(operation, instructions, context) {
|
|
3890
|
+
return {
|
|
3891
|
+
Result: RESULTS.Failure,
|
|
3892
|
+
ErrorCode: "not_supported",
|
|
3893
|
+
Message: `${operation} isn't supported on the connected environment.`,
|
|
3894
|
+
Instructions: instructions,
|
|
3895
|
+
Retry: "RetryWillNotFix",
|
|
3896
|
+
...context ? { Context: context } : {}
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3848
3899
|
// ../common/src/command-examples.ts
|
|
3849
3900
|
var examplesByCommand = new WeakMap;
|
|
3850
3901
|
Command.prototype.examples = function(examples) {
|
|
@@ -4218,7 +4269,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
4218
4269
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
4219
4270
|
"local_permission_denied"
|
|
4220
4271
|
]);
|
|
4221
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
4272
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
4273
|
+
"invalid_argument",
|
|
4274
|
+
"confirmation_required"
|
|
4275
|
+
]);
|
|
4222
4276
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
4223
4277
|
"network_error",
|
|
4224
4278
|
"rate_limited",
|
|
@@ -4444,6 +4498,103 @@ var CommonTelemetryEvents = {
|
|
|
4444
4498
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
4445
4499
|
};
|
|
4446
4500
|
|
|
4501
|
+
// ../common/src/telemetry/trace-context.ts
|
|
4502
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4503
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4504
|
+
function getProcessEnv() {
|
|
4505
|
+
return globalThis.process?.env;
|
|
4506
|
+
}
|
|
4507
|
+
function parseInboundTraceparent(value) {
|
|
4508
|
+
if (!value) {
|
|
4509
|
+
return;
|
|
4510
|
+
}
|
|
4511
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4512
|
+
if (!match) {
|
|
4513
|
+
return;
|
|
4514
|
+
}
|
|
4515
|
+
const [, traceId, parentSpanId] = match;
|
|
4516
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4519
|
+
return { traceId, parentSpanId };
|
|
4520
|
+
}
|
|
4521
|
+
function getInboundTraceContext() {
|
|
4522
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
// ../common/src/telemetry/session-id.ts
|
|
4526
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4527
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
4528
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4529
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4530
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4531
|
+
var INHERITED_SESSION_SOURCES = [
|
|
4532
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4533
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4534
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4535
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4536
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4537
|
+
];
|
|
4538
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4539
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4540
|
+
function getProcessEnv2() {
|
|
4541
|
+
return globalThis.process?.env;
|
|
4542
|
+
}
|
|
4543
|
+
function normalizeSessionId(value) {
|
|
4544
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4545
|
+
return;
|
|
4546
|
+
}
|
|
4547
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4548
|
+
return cleaned || undefined;
|
|
4549
|
+
}
|
|
4550
|
+
function getConfiguredTelemetrySessionId() {
|
|
4551
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4552
|
+
}
|
|
4553
|
+
function getInheritedSession(env) {
|
|
4554
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4555
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4556
|
+
if (handle) {
|
|
4557
|
+
return { id: handle, source: candidate.source };
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
return;
|
|
4561
|
+
}
|
|
4562
|
+
function generateRandomSession() {
|
|
4563
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4564
|
+
crypto.getRandomValues(bytes);
|
|
4565
|
+
let hex = "";
|
|
4566
|
+
for (const byte of bytes) {
|
|
4567
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4568
|
+
}
|
|
4569
|
+
return { id: hex, source: "random" };
|
|
4570
|
+
}
|
|
4571
|
+
function resolveTelemetrySession() {
|
|
4572
|
+
const existing = telemetrySessionSlot.get();
|
|
4573
|
+
if (existing) {
|
|
4574
|
+
return existing;
|
|
4575
|
+
}
|
|
4576
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4577
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4578
|
+
telemetrySessionSlot.set(resolved);
|
|
4579
|
+
return resolved;
|
|
4580
|
+
}
|
|
4581
|
+
function getTelemetrySessionId() {
|
|
4582
|
+
return resolveTelemetrySession().id;
|
|
4583
|
+
}
|
|
4584
|
+
function getTelemetrySessionSource() {
|
|
4585
|
+
return resolveTelemetrySession().source;
|
|
4586
|
+
}
|
|
4587
|
+
function getTelemetryOperationId() {
|
|
4588
|
+
const existing = telemetryOperationIdSlot.get();
|
|
4589
|
+
if (existing) {
|
|
4590
|
+
return existing;
|
|
4591
|
+
}
|
|
4592
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4593
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4594
|
+
telemetryOperationIdSlot.set(generated);
|
|
4595
|
+
return generated;
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4447
4598
|
// ../common/src/registry.ts
|
|
4448
4599
|
import { execFileSync } from "node:child_process";
|
|
4449
4600
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -4665,102 +4816,6 @@ class NodeContextStorage {
|
|
|
4665
4816
|
return this.storage.getStore();
|
|
4666
4817
|
}
|
|
4667
4818
|
}
|
|
4668
|
-
// ../common/src/telemetry/trace-context.ts
|
|
4669
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4670
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4671
|
-
function getProcessEnv() {
|
|
4672
|
-
return globalThis.process?.env;
|
|
4673
|
-
}
|
|
4674
|
-
function parseInboundTraceparent(value) {
|
|
4675
|
-
if (!value) {
|
|
4676
|
-
return;
|
|
4677
|
-
}
|
|
4678
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4679
|
-
if (!match) {
|
|
4680
|
-
return;
|
|
4681
|
-
}
|
|
4682
|
-
const [, traceId, parentSpanId] = match;
|
|
4683
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4684
|
-
return;
|
|
4685
|
-
}
|
|
4686
|
-
return { traceId, parentSpanId };
|
|
4687
|
-
}
|
|
4688
|
-
function getInboundTraceContext() {
|
|
4689
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4690
|
-
}
|
|
4691
|
-
|
|
4692
|
-
// ../common/src/telemetry/session-id.ts
|
|
4693
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4694
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
4695
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4696
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4697
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4698
|
-
var INHERITED_SESSION_SOURCES = [
|
|
4699
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4700
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4701
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4702
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4703
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4704
|
-
];
|
|
4705
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4706
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4707
|
-
function getProcessEnv2() {
|
|
4708
|
-
return globalThis.process?.env;
|
|
4709
|
-
}
|
|
4710
|
-
function normalizeSessionId(value) {
|
|
4711
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4712
|
-
return;
|
|
4713
|
-
}
|
|
4714
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4715
|
-
return cleaned || undefined;
|
|
4716
|
-
}
|
|
4717
|
-
function getConfiguredTelemetrySessionId() {
|
|
4718
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4719
|
-
}
|
|
4720
|
-
function getInheritedSession(env) {
|
|
4721
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4722
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4723
|
-
if (handle) {
|
|
4724
|
-
return { id: handle, source: candidate.source };
|
|
4725
|
-
}
|
|
4726
|
-
}
|
|
4727
|
-
return;
|
|
4728
|
-
}
|
|
4729
|
-
function generateRandomSession() {
|
|
4730
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4731
|
-
crypto.getRandomValues(bytes);
|
|
4732
|
-
let hex = "";
|
|
4733
|
-
for (const byte of bytes) {
|
|
4734
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4735
|
-
}
|
|
4736
|
-
return { id: hex, source: "random" };
|
|
4737
|
-
}
|
|
4738
|
-
function resolveTelemetrySession() {
|
|
4739
|
-
const existing = telemetrySessionSlot.get();
|
|
4740
|
-
if (existing) {
|
|
4741
|
-
return existing;
|
|
4742
|
-
}
|
|
4743
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4744
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4745
|
-
telemetrySessionSlot.set(resolved);
|
|
4746
|
-
return resolved;
|
|
4747
|
-
}
|
|
4748
|
-
function getTelemetrySessionId() {
|
|
4749
|
-
return resolveTelemetrySession().id;
|
|
4750
|
-
}
|
|
4751
|
-
function getTelemetrySessionSource() {
|
|
4752
|
-
return resolveTelemetrySession().source;
|
|
4753
|
-
}
|
|
4754
|
-
function getTelemetryOperationId() {
|
|
4755
|
-
const existing = telemetryOperationIdSlot.get();
|
|
4756
|
-
if (existing) {
|
|
4757
|
-
return existing;
|
|
4758
|
-
}
|
|
4759
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4760
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4761
|
-
telemetryOperationIdSlot.set(generated);
|
|
4762
|
-
return generated;
|
|
4763
|
-
}
|
|
4764
4819
|
// ../common/src/telemetry/span-clock.ts
|
|
4765
4820
|
function startSpanClock() {
|
|
4766
4821
|
const started = performance.now();
|
|
@@ -4965,6 +5020,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
4965
5020
|
// ../common/src/telemetry/telemetry-init.ts
|
|
4966
5021
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
4967
5022
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
5023
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
4968
5024
|
function getGlobalTelemetryInstance() {
|
|
4969
5025
|
const existing = telemetryInstanceSlot.get();
|
|
4970
5026
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -5181,7 +5237,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
5181
5237
|
const pagedRows = extractPagedRows(data.Data);
|
|
5182
5238
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
5183
5239
|
items.forEach((item) => {
|
|
5184
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
5240
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
5185
5241
|
logFn(values);
|
|
5186
5242
|
});
|
|
5187
5243
|
} else {
|
|
@@ -5196,7 +5252,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
5196
5252
|
default: {
|
|
5197
5253
|
const hasData = "Data" in data && data.Data != null;
|
|
5198
5254
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
5199
|
-
const
|
|
5255
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
5256
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
5200
5257
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
5201
5258
|
const logValue = data.Log;
|
|
5202
5259
|
if (rows !== null) {
|
|
@@ -5253,6 +5310,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
5253
5310
|
function isPlainObjectArray(value) {
|
|
5254
5311
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
5255
5312
|
}
|
|
5313
|
+
function isPrimitiveArray(value) {
|
|
5314
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
5315
|
+
}
|
|
5256
5316
|
function isNonEmptyPlainObject(value) {
|
|
5257
5317
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
5258
5318
|
}
|
|
@@ -5599,12 +5659,12 @@ class FilterEvaluationError extends Error {
|
|
|
5599
5659
|
instructions;
|
|
5600
5660
|
retry = "RetryWillNotFix";
|
|
5601
5661
|
result = RESULTS.ValidationError;
|
|
5602
|
-
constructor(filter, cause) {
|
|
5662
|
+
constructor(filter, cause, hint) {
|
|
5603
5663
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5604
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
5664
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
5605
5665
|
this.name = "FilterEvaluationError";
|
|
5606
5666
|
this.filter = filter;
|
|
5607
|
-
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
5667
|
+
this.instructions = (hint ? `${hint.instructions} ` : "") + `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
5608
5668
|
}
|
|
5609
5669
|
}
|
|
5610
5670
|
|
|
@@ -5726,6 +5786,93 @@ function nameList(names, cap = 12) {
|
|
|
5726
5786
|
const rest = names.length - shown.length;
|
|
5727
5787
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5728
5788
|
}
|
|
5789
|
+
function notFieldsOn(names, scope) {
|
|
5790
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5791
|
+
}
|
|
5792
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
5793
|
+
const [left, right, condition] = ast.children ?? [];
|
|
5794
|
+
let scopes = [];
|
|
5795
|
+
if (!isList) {
|
|
5796
|
+
scopes = [ast];
|
|
5797
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
5798
|
+
scopes = [condition, right];
|
|
5799
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
5800
|
+
scopes = [right];
|
|
5801
|
+
}
|
|
5802
|
+
const reads = new Set;
|
|
5803
|
+
let tracked = 0;
|
|
5804
|
+
const visit = (node) => {
|
|
5805
|
+
if (!node)
|
|
5806
|
+
return;
|
|
5807
|
+
switch (node.type) {
|
|
5808
|
+
case "Function": {
|
|
5809
|
+
const arg = node.children?.[argIndex - 1];
|
|
5810
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
5811
|
+
reads.add(arg.name);
|
|
5812
|
+
tracked++;
|
|
5813
|
+
}
|
|
5814
|
+
node.children?.forEach(visit);
|
|
5815
|
+
return;
|
|
5816
|
+
}
|
|
5817
|
+
case "AndExpression":
|
|
5818
|
+
case "OrExpression":
|
|
5819
|
+
case "NotExpression":
|
|
5820
|
+
case "Comparator":
|
|
5821
|
+
case "MultiSelectList":
|
|
5822
|
+
case "MultiSelectHash":
|
|
5823
|
+
node.children?.forEach(visit);
|
|
5824
|
+
return;
|
|
5825
|
+
case "KeyValuePair":
|
|
5826
|
+
visit(node.value);
|
|
5827
|
+
return;
|
|
5828
|
+
}
|
|
5829
|
+
};
|
|
5830
|
+
scopes.forEach(visit);
|
|
5831
|
+
const calls = (node) => {
|
|
5832
|
+
if (node === null || typeof node !== "object")
|
|
5833
|
+
return 0;
|
|
5834
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
5835
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
5836
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
5837
|
+
};
|
|
5838
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
5839
|
+
}
|
|
5840
|
+
function fieldExpression(name) {
|
|
5841
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
5842
|
+
}
|
|
5843
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
5844
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5845
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
5846
|
+
if (!failure)
|
|
5847
|
+
return;
|
|
5848
|
+
const [, fn, position, expected] = failure;
|
|
5849
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
5850
|
+
if (name === undefined)
|
|
5851
|
+
return;
|
|
5852
|
+
const present = availableFields(data);
|
|
5853
|
+
if (present.length === 0)
|
|
5854
|
+
return;
|
|
5855
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
5856
|
+
if (!present.includes(name)) {
|
|
5857
|
+
return {
|
|
5858
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
5859
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
5860
|
+
};
|
|
5861
|
+
}
|
|
5862
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5863
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
5864
|
+
const field = fieldExpression(name);
|
|
5865
|
+
let fallback;
|
|
5866
|
+
if (expected.split(",").includes("string")) {
|
|
5867
|
+
fallback = "''";
|
|
5868
|
+
} else if (expected.split(",").includes("array")) {
|
|
5869
|
+
fallback = "`[]`";
|
|
5870
|
+
}
|
|
5871
|
+
return {
|
|
5872
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
5873
|
+
instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
|
|
5874
|
+
};
|
|
5875
|
+
}
|
|
5729
5876
|
function buildFilterWarning(filter, data, outcome) {
|
|
5730
5877
|
const present = availableFields(data);
|
|
5731
5878
|
const refs = referencedFields(filter);
|
|
@@ -5733,7 +5880,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
5733
5880
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5734
5881
|
const count = countRecords(data);
|
|
5735
5882
|
const scope = `${count} record(s)`;
|
|
5736
|
-
const isNotAField = (names) =>
|
|
5883
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
5737
5884
|
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
5738
5885
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5739
5886
|
let detail;
|
|
@@ -5784,7 +5931,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
5784
5931
|
try {
|
|
5785
5932
|
result = codec.search(data, filter);
|
|
5786
5933
|
} catch (err) {
|
|
5787
|
-
|
|
5934
|
+
const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
|
|
5935
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
5788
5936
|
}
|
|
5789
5937
|
const inputCount = countRecords(data);
|
|
5790
5938
|
const warn = (outcome) => {
|
|
@@ -6675,7 +6823,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6675
6823
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
6676
6824
|
const typed = error;
|
|
6677
6825
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6678
|
-
const customResult =
|
|
6826
|
+
const customResult = carriedResult(error);
|
|
6679
6827
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6680
6828
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6681
6829
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -7037,6 +7185,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
7037
7185
|
"canceled",
|
|
7038
7186
|
"stopped"
|
|
7039
7187
|
]);
|
|
7188
|
+
// ../common/src/relayed-output.ts
|
|
7189
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
7040
7190
|
// ../common/src/screen-logger.ts
|
|
7041
7191
|
var ScreenLogger;
|
|
7042
7192
|
((ScreenLogger) => {
|
|
@@ -7240,6 +7390,8 @@ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(acc
|
|
|
7240
7390
|
// ../auth/src/constants.ts
|
|
7241
7391
|
var UIPATH_HOME_DIR = ".uipath";
|
|
7242
7392
|
var AUTH_FILENAME = ".auth";
|
|
7393
|
+
var AUTH_FILE_MODE = 384;
|
|
7394
|
+
var AUTH_DIR_MODE = 448;
|
|
7243
7395
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
7244
7396
|
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
7245
7397
|
|
|
@@ -7904,6 +8056,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
7904
8056
|
}
|
|
7905
8057
|
return parseEnvContent(content);
|
|
7906
8058
|
};
|
|
8059
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
8060
|
+
let current = dir;
|
|
8061
|
+
for (;; ) {
|
|
8062
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
8063
|
+
return current;
|
|
8064
|
+
const parent = fs.path.dirname(current);
|
|
8065
|
+
if (parent === current)
|
|
8066
|
+
return;
|
|
8067
|
+
current = parent;
|
|
8068
|
+
}
|
|
8069
|
+
};
|
|
8070
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
8071
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
8072
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
8073
|
+
for (let attempt = 1;; attempt++) {
|
|
8074
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
8075
|
+
try {
|
|
8076
|
+
await fs.writeFile(tempPath, content, {
|
|
8077
|
+
mode: AUTH_FILE_MODE,
|
|
8078
|
+
exclusive: true
|
|
8079
|
+
});
|
|
8080
|
+
return tempPath;
|
|
8081
|
+
} catch (error) {
|
|
8082
|
+
if (!isFileExists(error)) {
|
|
8083
|
+
await fs.rm(tempPath).catch(() => {});
|
|
8084
|
+
throw error;
|
|
8085
|
+
}
|
|
8086
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
8087
|
+
throw error;
|
|
8088
|
+
}
|
|
8089
|
+
}
|
|
8090
|
+
};
|
|
7907
8091
|
var saveEnvFileAsync = async ({
|
|
7908
8092
|
envPath,
|
|
7909
8093
|
data,
|
|
@@ -7931,10 +8115,18 @@ var saveEnvFileAsync = async ({
|
|
|
7931
8115
|
`)}
|
|
7932
8116
|
`;
|
|
7933
8117
|
const dir = fs.path.dirname(absolutePath);
|
|
7934
|
-
await fs.mkdir(dir);
|
|
7935
|
-
const
|
|
7936
|
-
|
|
7937
|
-
|
|
8118
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
8119
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
8120
|
+
if (authHomeDir !== undefined) {
|
|
8121
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
8122
|
+
}
|
|
8123
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
8124
|
+
try {
|
|
8125
|
+
await fs.rename(tempPath, absolutePath);
|
|
8126
|
+
} catch (error) {
|
|
8127
|
+
await fs.rm(tempPath).catch(() => {});
|
|
8128
|
+
throw error;
|
|
8129
|
+
}
|
|
7938
8130
|
};
|
|
7939
8131
|
|
|
7940
8132
|
// ../auth/src/loginStatus.ts
|
|
@@ -8529,6 +8721,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
8529
8721
|
TENANT_SELECTION_REQUIRED_CODE,
|
|
8530
8722
|
INVALID_TENANT_CODE
|
|
8531
8723
|
]);
|
|
8532
|
-
export { catchError, carriedInstructions, extractErrorDetails, extractErrorMessage, instructionsFor,
|
|
8724
|
+
export { catchError, RESULTS, carriedInstructions, isHtmlDocument, extractErrorDetails, extractErrorMessage, instructionsFor, notSupportedFailure, Command, Pagination, OutputFormatter, processContext, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, resolveSessionIdentity, getAuthContext };
|
|
8533
8725
|
|
|
8534
|
-
//# debugId=
|
|
8726
|
+
//# debugId=EEE2EB0253BFBCC264756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/eval-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.207.0-preview.305",
|
|
6
6
|
"description": "Manage runtime evaluations, evaluators, eval sets, evaluations, and schedules.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
|
|
31
31
|
}
|