@uipath/pm-tool 1.203.0-preview.205 → 1.204.0-preview.206
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/index.js +1 -1
- package/dist/{tool-9yeew3jv.js → tool-wms8yng0.js} +622 -68
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2101,7 +2101,7 @@ var package_default = {
|
|
|
2101
2101
|
name: "@uipath/pm-tool",
|
|
2102
2102
|
author: "UiPath",
|
|
2103
2103
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2104
|
+
version: "1.204.0-preview.206",
|
|
2105
2105
|
description: "Process Mining — process apps, transformations, and data ingestion.",
|
|
2106
2106
|
private: false,
|
|
2107
2107
|
repository: {
|
|
@@ -2910,6 +2910,57 @@ function settlePromiseLike(thenable) {
|
|
|
2910
2910
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
|
+
// ../common/src/error-graph.ts
|
|
2914
|
+
function* walkErrorGraph(error) {
|
|
2915
|
+
const queue = [error];
|
|
2916
|
+
const seen = new Set;
|
|
2917
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2918
|
+
const current = queue.shift();
|
|
2919
|
+
if (current === null || typeof current !== "object")
|
|
2920
|
+
continue;
|
|
2921
|
+
if (seen.has(current))
|
|
2922
|
+
continue;
|
|
2923
|
+
seen.add(current);
|
|
2924
|
+
const cur = current;
|
|
2925
|
+
yield cur;
|
|
2926
|
+
if (cur.cause !== undefined)
|
|
2927
|
+
queue.push(cur.cause);
|
|
2928
|
+
if (Array.isArray(cur.errors))
|
|
2929
|
+
queue.push(...cur.errors);
|
|
2930
|
+
}
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
2933
|
+
function parseHttpStatusFromMessage(message) {
|
|
2934
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2935
|
+
if (!match)
|
|
2936
|
+
return;
|
|
2937
|
+
const status = Number(match[1]);
|
|
2938
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2939
|
+
}
|
|
2940
|
+
function findHttpStatusInGraph(error) {
|
|
2941
|
+
for (const node of walkErrorGraph(error)) {
|
|
2942
|
+
const response = node.response;
|
|
2943
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2944
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2945
|
+
return explicit;
|
|
2946
|
+
}
|
|
2947
|
+
if (typeof node.message === "string") {
|
|
2948
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2949
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2950
|
+
return parsed;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
// ../common/src/local-permission-codes.ts
|
|
2958
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2959
|
+
"EACCES",
|
|
2960
|
+
"EPERM",
|
|
2961
|
+
"EROFS"
|
|
2962
|
+
]);
|
|
2963
|
+
|
|
2913
2964
|
// ../common/src/error-handler.ts
|
|
2914
2965
|
var NETWORK_ERROR_CODES = new Set([
|
|
2915
2966
|
"ECONNREFUSED",
|
|
@@ -2934,7 +2985,7 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2934
2985
|
]);
|
|
2935
2986
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
2936
2987
|
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
2937
|
-
var
|
|
2988
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2938
2989
|
// ../common/src/exit-code.ts
|
|
2939
2990
|
function setExitCode(code) {
|
|
2940
2991
|
process.exitCode = code;
|
|
@@ -3193,12 +3244,162 @@ function getOutputFilter() {
|
|
|
3193
3244
|
return filterSlot.get();
|
|
3194
3245
|
}
|
|
3195
3246
|
|
|
3247
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
3248
|
+
var BaseDimensions = {
|
|
3249
|
+
ApplicationName: "ApplicationName",
|
|
3250
|
+
ProductVersion: "ProductVersion",
|
|
3251
|
+
InstallationId: "InstallationId",
|
|
3252
|
+
CloudUserId: "CloudUserId",
|
|
3253
|
+
CloudTenantId: "CloudTenantId",
|
|
3254
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
3255
|
+
IsInternalUser: "IsInternalUser",
|
|
3256
|
+
Environment: "Environment",
|
|
3257
|
+
BaseUrl: "BaseUrl",
|
|
3258
|
+
Region: "Region",
|
|
3259
|
+
Agent: "Agent",
|
|
3260
|
+
AgentVersion: "AgentVersion",
|
|
3261
|
+
AgentModel: "AgentModel",
|
|
3262
|
+
ToolName: "ToolName",
|
|
3263
|
+
ToolVersion: "ToolVersion",
|
|
3264
|
+
ExecutionContext: "ExecutionContext",
|
|
3265
|
+
CiProvider: "CiProvider",
|
|
3266
|
+
SessionIdSource: "SessionIdSource",
|
|
3267
|
+
SessionId: "SessionId"
|
|
3268
|
+
};
|
|
3269
|
+
var CommandDimensions = {
|
|
3270
|
+
IsCommand: "IsCommand",
|
|
3271
|
+
IsReexec: "IsReexec",
|
|
3272
|
+
CommandName: "CommandName",
|
|
3273
|
+
ExitCode: "ExitCode",
|
|
3274
|
+
TerminalOutcome: "TerminalOutcome",
|
|
3275
|
+
ErrorClass: "ErrorClass",
|
|
3276
|
+
TerminalSignal: "TerminalSignal",
|
|
3277
|
+
ErrorMessage: "ErrorMessage",
|
|
3278
|
+
SkillName: "SkillName",
|
|
3279
|
+
ProductArea: "ProductArea",
|
|
3280
|
+
Mode: "Mode"
|
|
3281
|
+
};
|
|
3282
|
+
var ShipDimensions = {
|
|
3283
|
+
ShipKind: "ShipKind",
|
|
3284
|
+
Target: "Target",
|
|
3285
|
+
ProjectType: "ProjectType",
|
|
3286
|
+
ProjectTypes: "ProjectTypes",
|
|
3287
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3288
|
+
PackageName: "PackageName",
|
|
3289
|
+
PackageVersion: "PackageVersion",
|
|
3290
|
+
PackageVersionKey: "PackageVersionKey",
|
|
3291
|
+
DeploymentKey: "DeploymentKey",
|
|
3292
|
+
SolutionId: "SolutionId",
|
|
3293
|
+
FolderKey: "FolderKey",
|
|
3294
|
+
FeedId: "FeedId"
|
|
3295
|
+
};
|
|
3296
|
+
var ErrorDimensions = {
|
|
3297
|
+
Result: "Result",
|
|
3298
|
+
ErrorCode: "ErrorCode",
|
|
3299
|
+
Retry: "Retry",
|
|
3300
|
+
ErrorMessage: "ErrorMessage"
|
|
3301
|
+
};
|
|
3302
|
+
var AuthDimensions = {
|
|
3303
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3304
|
+
Success: "Success",
|
|
3305
|
+
Reason: "Reason"
|
|
3306
|
+
};
|
|
3307
|
+
var SkillsDimensions = {
|
|
3308
|
+
SchemaVersion: "SchemaVersion",
|
|
3309
|
+
AgentType: "AgentType",
|
|
3310
|
+
SkillsVersion: "SkillsVersion",
|
|
3311
|
+
UipSubcommand: "UipSubcommand",
|
|
3312
|
+
FileExtension: "FileExtension",
|
|
3313
|
+
SubagentModel: "SubagentModel",
|
|
3314
|
+
SubagentType: "SubagentType",
|
|
3315
|
+
PermissionMode: "PermissionMode",
|
|
3316
|
+
EffortLevel: "EffortLevel",
|
|
3317
|
+
SessionSource: "SessionSource",
|
|
3318
|
+
Outcome: "Outcome",
|
|
3319
|
+
DurationMs: "DurationMs",
|
|
3320
|
+
Source: "Source"
|
|
3321
|
+
};
|
|
3322
|
+
var PackagerDimensions = {
|
|
3323
|
+
ProjectId: "ProjectId",
|
|
3324
|
+
ProjectType: "ProjectType",
|
|
3325
|
+
SolutionId: "SolutionId"
|
|
3326
|
+
};
|
|
3327
|
+
var ScopeDimensions = {
|
|
3328
|
+
FolderId: "FolderId"
|
|
3329
|
+
};
|
|
3330
|
+
var ID_DIMENSIONS = new Set([
|
|
3331
|
+
BaseDimensions.CloudUserId,
|
|
3332
|
+
BaseDimensions.CloudTenantId,
|
|
3333
|
+
BaseDimensions.CloudOrganizationId,
|
|
3334
|
+
BaseDimensions.InstallationId,
|
|
3335
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3336
|
+
ShipDimensions.PackageVersionKey,
|
|
3337
|
+
ShipDimensions.DeploymentKey,
|
|
3338
|
+
ShipDimensions.SolutionId,
|
|
3339
|
+
ShipDimensions.FolderKey,
|
|
3340
|
+
ShipDimensions.FeedId,
|
|
3341
|
+
PackagerDimensions.ProjectId
|
|
3342
|
+
]);
|
|
3343
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3344
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3345
|
+
...Object.values(BaseDimensions),
|
|
3346
|
+
...Object.values(CommandDimensions),
|
|
3347
|
+
...Object.values(ShipDimensions),
|
|
3348
|
+
...Object.values(ErrorDimensions),
|
|
3349
|
+
...Object.values(AuthDimensions),
|
|
3350
|
+
...Object.values(SkillsDimensions),
|
|
3351
|
+
...Object.values(PackagerDimensions),
|
|
3352
|
+
...Object.values(ScopeDimensions)
|
|
3353
|
+
]);
|
|
3354
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3355
|
+
BaseDimensions.ApplicationName,
|
|
3356
|
+
BaseDimensions.ProductVersion,
|
|
3357
|
+
BaseDimensions.InstallationId,
|
|
3358
|
+
BaseDimensions.CloudUserId,
|
|
3359
|
+
BaseDimensions.CloudTenantId,
|
|
3360
|
+
BaseDimensions.CloudOrganizationId,
|
|
3361
|
+
BaseDimensions.IsInternalUser,
|
|
3362
|
+
BaseDimensions.Environment,
|
|
3363
|
+
BaseDimensions.BaseUrl,
|
|
3364
|
+
BaseDimensions.Region,
|
|
3365
|
+
BaseDimensions.Agent,
|
|
3366
|
+
BaseDimensions.AgentVersion,
|
|
3367
|
+
BaseDimensions.ToolVersion,
|
|
3368
|
+
BaseDimensions.ExecutionContext,
|
|
3369
|
+
BaseDimensions.CiProvider,
|
|
3370
|
+
BaseDimensions.SessionIdSource,
|
|
3371
|
+
BaseDimensions.SessionId,
|
|
3372
|
+
...Object.values(CommandDimensions),
|
|
3373
|
+
...Object.values(ShipDimensions)
|
|
3374
|
+
]);
|
|
3375
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3376
|
+
let changed = false;
|
|
3377
|
+
const result = {
|
|
3378
|
+
...properties
|
|
3379
|
+
};
|
|
3380
|
+
for (const key of Object.keys(result)) {
|
|
3381
|
+
const value = result[key];
|
|
3382
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3383
|
+
continue;
|
|
3384
|
+
}
|
|
3385
|
+
const lowered = value.toLowerCase();
|
|
3386
|
+
if (lowered !== value) {
|
|
3387
|
+
result[key] = lowered;
|
|
3388
|
+
changed = true;
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
return changed ? result : properties;
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3196
3394
|
// ../common/src/telemetry/command-terminal.ts
|
|
3197
3395
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3198
3396
|
var AUTH_ERROR_CODES = new Set([
|
|
3199
3397
|
"authentication_required",
|
|
3200
3398
|
"permission_denied"
|
|
3201
3399
|
]);
|
|
3400
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3401
|
+
"local_permission_denied"
|
|
3402
|
+
]);
|
|
3202
3403
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
3203
3404
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
3204
3405
|
"network_error",
|
|
@@ -3339,6 +3540,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3339
3540
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3340
3541
|
return "auth";
|
|
3341
3542
|
}
|
|
3543
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3544
|
+
return "local_permission";
|
|
3545
|
+
}
|
|
3342
3546
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3343
3547
|
return "validation";
|
|
3344
3548
|
}
|
|
@@ -3350,6 +3554,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3350
3554
|
}
|
|
3351
3555
|
return;
|
|
3352
3556
|
}
|
|
3557
|
+
function hasLocalPermissionCode(error) {
|
|
3558
|
+
for (const node of walkErrorGraph(error)) {
|
|
3559
|
+
const code = node.code;
|
|
3560
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3561
|
+
return true;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
return false;
|
|
3565
|
+
}
|
|
3353
3566
|
function classifyFromError(error) {
|
|
3354
3567
|
const code = findCodeInCauseChain(error);
|
|
3355
3568
|
if (code) {
|
|
@@ -3366,6 +3579,9 @@ function classifyFromError(error) {
|
|
|
3366
3579
|
return "missing_dependency";
|
|
3367
3580
|
}
|
|
3368
3581
|
}
|
|
3582
|
+
if (hasLocalPermissionCode(error)) {
|
|
3583
|
+
return "local_permission";
|
|
3584
|
+
}
|
|
3369
3585
|
const message = stringField(error, "message");
|
|
3370
3586
|
if (message?.includes("fetch failed") === true) {
|
|
3371
3587
|
return "network_http";
|
|
@@ -3381,7 +3597,7 @@ function classifyError(input) {
|
|
|
3381
3597
|
if (recorded?.errorClass) {
|
|
3382
3598
|
return recorded.errorClass;
|
|
3383
3599
|
}
|
|
3384
|
-
const status = recorded?.context?.httpStatus;
|
|
3600
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3385
3601
|
if (status !== undefined) {
|
|
3386
3602
|
return classifyHttpStatus(status);
|
|
3387
3603
|
}
|
|
@@ -3404,17 +3620,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3404
3620
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
|
|
3405
3621
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3406
3622
|
return {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
...errorClass ? {
|
|
3410
|
-
...terminalSignal ? {
|
|
3623
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
3624
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
3625
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
3626
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3411
3627
|
};
|
|
3412
3628
|
}
|
|
3413
3629
|
|
|
3414
3630
|
// ../common/src/telemetry/telemetry-events.ts
|
|
3415
3631
|
var CommonTelemetryEvents = {
|
|
3416
|
-
|
|
3417
|
-
|
|
3632
|
+
Start: "Application.Start",
|
|
3633
|
+
Error: "Application.Error",
|
|
3634
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3418
3635
|
};
|
|
3419
3636
|
|
|
3420
3637
|
// ../common/src/registry.ts
|
|
@@ -3622,8 +3839,8 @@ function detectExecutionContext(options = {}) {
|
|
|
3622
3839
|
function getExecutionContextTelemetryProperties() {
|
|
3623
3840
|
const detected = detectExecutionContext();
|
|
3624
3841
|
return {
|
|
3625
|
-
|
|
3626
|
-
...detected.ciProvider ? {
|
|
3842
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
3843
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
3627
3844
|
};
|
|
3628
3845
|
}
|
|
3629
3846
|
// ../common/src/telemetry/node-context-storage.ts
|
|
@@ -3666,7 +3883,7 @@ function getInboundTraceContext() {
|
|
|
3666
3883
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
3667
3884
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
3668
3885
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
3669
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
3886
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
3670
3887
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
3671
3888
|
var INHERITED_SESSION_SOURCES = [
|
|
3672
3889
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -3718,6 +3935,9 @@ function resolveTelemetrySession() {
|
|
|
3718
3935
|
telemetrySessionSlot.set(resolved);
|
|
3719
3936
|
return resolved;
|
|
3720
3937
|
}
|
|
3938
|
+
function getTelemetrySessionId() {
|
|
3939
|
+
return resolveTelemetrySession().id;
|
|
3940
|
+
}
|
|
3721
3941
|
function getTelemetrySessionSource() {
|
|
3722
3942
|
return resolveTelemetrySession().source;
|
|
3723
3943
|
}
|
|
@@ -3798,7 +4018,10 @@ class TelemetryService {
|
|
|
3798
4018
|
} catch (error) {
|
|
3799
4019
|
const durationMs = clock.elapsedMs();
|
|
3800
4020
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3801
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4021
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4022
|
+
...properties,
|
|
4023
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4024
|
+
}, context));
|
|
3802
4025
|
throw error;
|
|
3803
4026
|
}
|
|
3804
4027
|
}
|
|
@@ -3869,7 +4092,10 @@ class TelemetryService {
|
|
|
3869
4092
|
const durationMs = clock.elapsedMs();
|
|
3870
4093
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3871
4094
|
await this.telemetryProvider.trackDependency({
|
|
3872
|
-
...this.spanFor(name, durationMs, false, {
|
|
4095
|
+
...this.spanFor(name, durationMs, false, {
|
|
4096
|
+
...properties,
|
|
4097
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4098
|
+
}, childContext),
|
|
3873
4099
|
type
|
|
3874
4100
|
});
|
|
3875
4101
|
throw error;
|
|
@@ -3904,9 +4130,10 @@ class TelemetryService {
|
|
|
3904
4130
|
...globalProperties,
|
|
3905
4131
|
...this.defaultProperties,
|
|
3906
4132
|
...redactProperties(properties ?? {}),
|
|
3907
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
4133
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4134
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
3908
4135
|
};
|
|
3909
|
-
return enriched;
|
|
4136
|
+
return lowercaseIdDimensionValues(enriched);
|
|
3910
4137
|
}
|
|
3911
4138
|
generateId() {
|
|
3912
4139
|
const bytes = new Uint8Array(8);
|
|
@@ -4667,7 +4894,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4667
4894
|
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
4668
4895
|
}
|
|
4669
4896
|
}
|
|
4670
|
-
function
|
|
4897
|
+
function countRecords(data) {
|
|
4898
|
+
if (Array.isArray(data))
|
|
4899
|
+
return data.length;
|
|
4900
|
+
return data == null ? 0 : 1;
|
|
4901
|
+
}
|
|
4902
|
+
function availableFields(data) {
|
|
4903
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4904
|
+
const keys = new Set;
|
|
4905
|
+
for (const record of records) {
|
|
4906
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4907
|
+
for (const key of Object.keys(record))
|
|
4908
|
+
keys.add(key);
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
return [...keys];
|
|
4912
|
+
}
|
|
4913
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4914
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4915
|
+
if (!error && typeof decoded === "string")
|
|
4916
|
+
return decoded;
|
|
4917
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4918
|
+
}
|
|
4919
|
+
function referencedFields(filter) {
|
|
4920
|
+
const top = new Set;
|
|
4921
|
+
const nested = new Set;
|
|
4922
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4923
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4924
|
+
const quoted = [];
|
|
4925
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4926
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4927
|
+
if (!isAlias) {
|
|
4928
|
+
quoted.push({
|
|
4929
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4930
|
+
index,
|
|
4931
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4932
|
+
});
|
|
4933
|
+
}
|
|
4934
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4935
|
+
});
|
|
4936
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4937
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4938
|
+
const place = (name, index, tail) => {
|
|
4939
|
+
if (tail || index >= rootEnd)
|
|
4940
|
+
nested.add(name);
|
|
4941
|
+
else
|
|
4942
|
+
top.add(name);
|
|
4943
|
+
};
|
|
4944
|
+
for (const entry of quoted)
|
|
4945
|
+
place(entry.name, entry.index, entry.tail);
|
|
4946
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4947
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4948
|
+
for (const match of identifiers) {
|
|
4949
|
+
const [, name, trailing] = match;
|
|
4950
|
+
if (trailing || reserved.has(name))
|
|
4951
|
+
continue;
|
|
4952
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4953
|
+
}
|
|
4954
|
+
return {
|
|
4955
|
+
top: [...top],
|
|
4956
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4957
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4958
|
+
};
|
|
4959
|
+
}
|
|
4960
|
+
function appearsBelowTopLevel(data, name) {
|
|
4961
|
+
let budget = 2000;
|
|
4962
|
+
const visit = (value, depth) => {
|
|
4963
|
+
if (budget-- <= 0 || depth > 4)
|
|
4964
|
+
return false;
|
|
4965
|
+
if (value === null || typeof value !== "object")
|
|
4966
|
+
return false;
|
|
4967
|
+
if (Array.isArray(value))
|
|
4968
|
+
return value.some((entry) => visit(entry, depth));
|
|
4969
|
+
const record = value;
|
|
4970
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4971
|
+
return true;
|
|
4972
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4973
|
+
};
|
|
4974
|
+
return visit(data, 0);
|
|
4975
|
+
}
|
|
4976
|
+
function alwaysNullKeys(records) {
|
|
4977
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4978
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4979
|
+
return [];
|
|
4980
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4981
|
+
if (keys.length === 0)
|
|
4982
|
+
return [];
|
|
4983
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4984
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4985
|
+
}
|
|
4986
|
+
function carriesOnlyNulls(value) {
|
|
4987
|
+
if (value === null)
|
|
4988
|
+
return true;
|
|
4989
|
+
if (Array.isArray(value)) {
|
|
4990
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4991
|
+
}
|
|
4992
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4993
|
+
const values = Object.values(value);
|
|
4994
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4995
|
+
}
|
|
4996
|
+
return false;
|
|
4997
|
+
}
|
|
4998
|
+
function nameList(names, cap2 = 12) {
|
|
4999
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
5000
|
+
const rest = names.length - shown.length;
|
|
5001
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5002
|
+
}
|
|
5003
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
5004
|
+
const present = availableFields(data);
|
|
5005
|
+
const refs = referencedFields(filter);
|
|
5006
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
5007
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5008
|
+
const count = countRecords(data);
|
|
5009
|
+
const scope = `${count} record(s)`;
|
|
5010
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5011
|
+
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" : "";
|
|
5012
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5013
|
+
let detail;
|
|
5014
|
+
let lede;
|
|
5015
|
+
if (outcome.kind === "null-elements") {
|
|
5016
|
+
lede = "returned only null values";
|
|
5017
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
5018
|
+
if (unknown.length > 0) {
|
|
5019
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5020
|
+
} else if (unchecked.length > 0) {
|
|
5021
|
+
detail = withSoundness(projected);
|
|
5022
|
+
} else {
|
|
5023
|
+
detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
|
|
5024
|
+
}
|
|
5025
|
+
} else if (outcome.kind === "null-rows") {
|
|
5026
|
+
lede = "returned only null values";
|
|
5027
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
5028
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
5029
|
+
} else if (outcome.kind === "null-values") {
|
|
5030
|
+
lede = "returned only null values";
|
|
5031
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
5032
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
5033
|
+
if (sameSet) {
|
|
5034
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
5035
|
+
} else if (unknown.length > 0) {
|
|
5036
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5037
|
+
} else {
|
|
5038
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
5039
|
+
}
|
|
5040
|
+
} else {
|
|
5041
|
+
lede = "returned nothing";
|
|
5042
|
+
if (unknown.length > 0) {
|
|
5043
|
+
detail = isNotAField(unknown);
|
|
5044
|
+
} else {
|
|
5045
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5046
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5047
|
+
}
|
|
5048
|
+
}
|
|
5049
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5050
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5051
|
+
}
|
|
5052
|
+
function appendWarning(existing, note) {
|
|
5053
|
+
return existing ? `${existing} ${note}` : note;
|
|
5054
|
+
}
|
|
5055
|
+
function applyFilter(data, filter, onWarning) {
|
|
4671
5056
|
const codec = requireJmespath();
|
|
4672
5057
|
let result;
|
|
4673
5058
|
try {
|
|
@@ -4675,9 +5060,34 @@ function applyFilter(data, filter) {
|
|
|
4675
5060
|
} catch (err) {
|
|
4676
5061
|
throw new FilterEvaluationError(filter, err);
|
|
4677
5062
|
}
|
|
4678
|
-
|
|
5063
|
+
const inputCount = countRecords(data);
|
|
5064
|
+
const warn = (outcome) => {
|
|
5065
|
+
if (inputCount === 0)
|
|
5066
|
+
return;
|
|
5067
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5068
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5069
|
+
`);
|
|
5070
|
+
onWarning?.(note);
|
|
5071
|
+
};
|
|
5072
|
+
const warnIfAllNull = (records) => {
|
|
5073
|
+
const keys = alwaysNullKeys(records);
|
|
5074
|
+
if (keys.length > 0)
|
|
5075
|
+
warn({ kind: "null-values", keys });
|
|
5076
|
+
};
|
|
5077
|
+
if (result == null) {
|
|
5078
|
+
warn({ kind: "empty" });
|
|
4679
5079
|
return [];
|
|
5080
|
+
}
|
|
4680
5081
|
if (Array.isArray(result)) {
|
|
5082
|
+
if (result.length === 0) {
|
|
5083
|
+
warn({ kind: "empty" });
|
|
5084
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5085
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5086
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5087
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5088
|
+
} else {
|
|
5089
|
+
warnIfAllNull(result);
|
|
5090
|
+
}
|
|
4681
5091
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4682
5092
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4683
5093
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4685,10 +5095,30 @@ function applyFilter(data, filter) {
|
|
|
4685
5095
|
}
|
|
4686
5096
|
return result;
|
|
4687
5097
|
}
|
|
4688
|
-
if (typeof result === "object")
|
|
5098
|
+
if (typeof result === "object") {
|
|
5099
|
+
warnIfAllNull([result]);
|
|
4689
5100
|
return result;
|
|
5101
|
+
}
|
|
4690
5102
|
return { Value: result };
|
|
4691
5103
|
}
|
|
5104
|
+
function filterFailureData(envelope) {
|
|
5105
|
+
const filter = getOutputFilter();
|
|
5106
|
+
const data = envelope.Data;
|
|
5107
|
+
if (!filter || data == null)
|
|
5108
|
+
return;
|
|
5109
|
+
let note;
|
|
5110
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5111
|
+
note = n;
|
|
5112
|
+
}));
|
|
5113
|
+
if (filterError) {
|
|
5114
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5115
|
+
return;
|
|
5116
|
+
}
|
|
5117
|
+
envelope.Data = filtered;
|
|
5118
|
+
if (note) {
|
|
5119
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
4692
5122
|
function defaultErrorCodeForResult(result) {
|
|
4693
5123
|
switch (result) {
|
|
4694
5124
|
case RESULTS.AuthenticationError:
|
|
@@ -4703,7 +5133,7 @@ function defaultErrorCodeForResult(result) {
|
|
|
4703
5133
|
return "unknown_error";
|
|
4704
5134
|
}
|
|
4705
5135
|
}
|
|
4706
|
-
function
|
|
5136
|
+
function parseHttpStatusFromMessage2(message) {
|
|
4707
5137
|
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
4708
5138
|
if (!match)
|
|
4709
5139
|
return;
|
|
@@ -4732,10 +5162,10 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
4732
5162
|
return "server_error";
|
|
4733
5163
|
return;
|
|
4734
5164
|
}
|
|
4735
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
5165
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
4736
5166
|
function defaultErrorCodeForFailure(data) {
|
|
4737
5167
|
if (data.Result === RESULTS.Failure) {
|
|
4738
|
-
const status = data.Context?.httpStatus ??
|
|
5168
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
4739
5169
|
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
4740
5170
|
if (errorCode)
|
|
4741
5171
|
return errorCode;
|
|
@@ -4771,8 +5201,14 @@ var OutputFormatter;
|
|
|
4771
5201
|
}
|
|
4772
5202
|
const filter = getOutputFilter();
|
|
4773
5203
|
if (filter) {
|
|
4774
|
-
|
|
5204
|
+
let note;
|
|
5205
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5206
|
+
note = n;
|
|
5207
|
+
});
|
|
4775
5208
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5209
|
+
if (note) {
|
|
5210
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5211
|
+
}
|
|
4776
5212
|
}
|
|
4777
5213
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4778
5214
|
}
|
|
@@ -4800,12 +5236,13 @@ var OutputFormatter;
|
|
|
4800
5236
|
delete envelope.TelemetryErrorClass;
|
|
4801
5237
|
delete envelope.TelemetryTerminalOutcome;
|
|
4802
5238
|
delete envelope.TelemetryTerminalSignal;
|
|
5239
|
+
filterFailureData(envelope);
|
|
4803
5240
|
if (!suppressTelemetry) {
|
|
4804
5241
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
5242
|
+
[ErrorDimensions.Result]: data.Result,
|
|
5243
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5244
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
5245
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
4809
5246
|
});
|
|
4810
5247
|
}
|
|
4811
5248
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -4848,13 +5285,20 @@ var OutputFormatter;
|
|
|
4848
5285
|
OutputFormatter.log = log;
|
|
4849
5286
|
function formatToString(data) {
|
|
4850
5287
|
const filter = getOutputFilter();
|
|
5288
|
+
const envelope = data;
|
|
4851
5289
|
if ("Data" in data && data.Data != null) {
|
|
4852
5290
|
data.Data = normalizeDataKeys(data.Data);
|
|
4853
5291
|
if (filter) {
|
|
4854
|
-
|
|
5292
|
+
let note;
|
|
5293
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5294
|
+
note = n;
|
|
5295
|
+
}));
|
|
5296
|
+
if (note) {
|
|
5297
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5298
|
+
}
|
|
4855
5299
|
}
|
|
4856
5300
|
}
|
|
4857
|
-
const output = normalizeOutputKeys(
|
|
5301
|
+
const output = normalizeOutputKeys(envelope);
|
|
4858
5302
|
const lines = [];
|
|
4859
5303
|
const sink = getOutputSink();
|
|
4860
5304
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -4904,7 +5348,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
4904
5348
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
4905
5349
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
4906
5350
|
function productMode(productArea, mode) {
|
|
4907
|
-
return {
|
|
5351
|
+
return { ProductArea: productArea, Mode: mode };
|
|
4908
5352
|
}
|
|
4909
5353
|
function attributionRecord(groups) {
|
|
4910
5354
|
const record = {};
|
|
@@ -4962,6 +5406,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
4962
5406
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
4963
5407
|
["conversational", "operate", ["uip.conversational"]],
|
|
4964
5408
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5409
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
4965
5410
|
["agenthub", "build", ["uip.agenthub"]],
|
|
4966
5411
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
4967
5412
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -5047,32 +5492,64 @@ function normalizeSkillName(value) {
|
|
|
5047
5492
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
5048
5493
|
const skillName = normalizeSkillName(skillSource);
|
|
5049
5494
|
return {
|
|
5050
|
-
...skillName ? {
|
|
5495
|
+
...skillName ? { SkillName: skillName } : {},
|
|
5051
5496
|
...getCommandProductModeAttribution(commandPath)
|
|
5052
5497
|
};
|
|
5053
5498
|
}
|
|
5499
|
+
var AGENT_SESSION_ENV = {
|
|
5500
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5501
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5502
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5503
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5504
|
+
};
|
|
5505
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5506
|
+
function sanitizeTelemetryToken(value) {
|
|
5507
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5508
|
+
}
|
|
5509
|
+
function buildAgentSessionTelemetry(env) {
|
|
5510
|
+
const dimensions = {};
|
|
5511
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5512
|
+
const value = env[variable]?.trim();
|
|
5513
|
+
if (value) {
|
|
5514
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
return dimensions;
|
|
5518
|
+
}
|
|
5054
5519
|
|
|
5055
5520
|
// ../common/src/telemetry/command-name.ts
|
|
5056
|
-
var
|
|
5521
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5522
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5523
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
5057
5524
|
function commandTelemetryName(parts) {
|
|
5525
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5526
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5527
|
+
}
|
|
5528
|
+
function commandInvocationPath(parts) {
|
|
5529
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5530
|
+
}
|
|
5531
|
+
function vetCommandTokens(parts) {
|
|
5058
5532
|
const tokens = [];
|
|
5059
5533
|
for (const part of parts) {
|
|
5060
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5534
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
5061
5535
|
if (pieces.every(isCommandToken)) {
|
|
5062
5536
|
tokens.push(...pieces);
|
|
5063
5537
|
continue;
|
|
5064
5538
|
}
|
|
5065
5539
|
tokens.push(UNKNOWN_TOKEN);
|
|
5066
5540
|
}
|
|
5067
|
-
return
|
|
5541
|
+
return tokens;
|
|
5542
|
+
}
|
|
5543
|
+
function pascalizeToken(token) {
|
|
5544
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
5068
5545
|
}
|
|
5069
|
-
var COMMAND_TOKEN_PATTERN = /^[a-
|
|
5546
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
5070
5547
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5071
5548
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5072
5549
|
function isCommandToken(token) {
|
|
5073
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5550
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
5074
5551
|
}
|
|
5075
|
-
var UNKNOWN_TOKEN = "
|
|
5552
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
5076
5553
|
|
|
5077
5554
|
// ../common/src/telemetry/invocation-request.ts
|
|
5078
5555
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -5177,7 +5654,7 @@ function withheldArgumentValues(cmd) {
|
|
|
5177
5654
|
});
|
|
5178
5655
|
return values;
|
|
5179
5656
|
}
|
|
5180
|
-
function
|
|
5657
|
+
function deriveCommandParts(cmd) {
|
|
5181
5658
|
const parts = [];
|
|
5182
5659
|
let current = cmd;
|
|
5183
5660
|
while (current) {
|
|
@@ -5190,14 +5667,13 @@ function deriveCommandPath(cmd) {
|
|
|
5190
5667
|
if (parts.length > 1) {
|
|
5191
5668
|
parts.shift();
|
|
5192
5669
|
}
|
|
5193
|
-
return
|
|
5670
|
+
return parts;
|
|
5194
5671
|
}
|
|
5195
5672
|
function isErrorContext(value) {
|
|
5196
5673
|
return value !== null && typeof value === "object";
|
|
5197
5674
|
}
|
|
5198
5675
|
function commandHelpHint(commandPath) {
|
|
5199
|
-
|
|
5200
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5676
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5201
5677
|
}
|
|
5202
5678
|
function isPromptCancellation(error) {
|
|
5203
5679
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -5222,7 +5698,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5222
5698
|
yaml: getOutputFormat() === "yaml",
|
|
5223
5699
|
filter: getOutputFilter() !== undefined
|
|
5224
5700
|
});
|
|
5225
|
-
const
|
|
5701
|
+
const commandParts = deriveCommandParts(command);
|
|
5702
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
5703
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
5226
5704
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
5227
5705
|
markCommandStart();
|
|
5228
5706
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -5257,7 +5735,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5257
5735
|
Result: finalResult,
|
|
5258
5736
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5259
5737
|
Message: errorMessage,
|
|
5260
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
5738
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5261
5739
|
...customRetry ? { Retry: customRetry } : {},
|
|
5262
5740
|
...customContext ? { Context: customContext } : {}
|
|
5263
5741
|
});
|
|
@@ -5274,8 +5752,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5274
5752
|
recordedFailure,
|
|
5275
5753
|
pollSignal: context.pollSignal
|
|
5276
5754
|
});
|
|
5277
|
-
if (terminalTelemetry.
|
|
5278
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
5755
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
5756
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
5279
5757
|
}
|
|
5280
5758
|
const commandParams = extractCommandParams(command);
|
|
5281
5759
|
if (props) {
|
|
@@ -5286,10 +5764,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5286
5764
|
const baseProperties = redactProperties({
|
|
5287
5765
|
...commandParams,
|
|
5288
5766
|
...props,
|
|
5289
|
-
...buildCommandTelemetryAttribution(
|
|
5290
|
-
|
|
5767
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
5768
|
+
...buildAgentSessionTelemetry(process.env),
|
|
5769
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
5770
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5291
5771
|
...terminalTelemetry,
|
|
5292
|
-
...errorMessage ? { errorMessage } : {}
|
|
5772
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5293
5773
|
});
|
|
5294
5774
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5295
5775
|
} finally {
|
|
@@ -5533,6 +6013,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
|
5533
6013
|
// ../common/src/interactivity-context.ts
|
|
5534
6014
|
var modeSlot = singleton("InteractivityMode");
|
|
5535
6015
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
6016
|
+
// ../common/src/mime-types.ts
|
|
6017
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
6018
|
+
pdf: "application/pdf",
|
|
6019
|
+
png: "image/png",
|
|
6020
|
+
jpg: "image/jpeg",
|
|
6021
|
+
jpeg: "image/jpeg",
|
|
6022
|
+
gif: "image/gif",
|
|
6023
|
+
webp: "image/webp",
|
|
6024
|
+
bmp: "image/bmp",
|
|
6025
|
+
tif: "image/tiff",
|
|
6026
|
+
tiff: "image/tiff",
|
|
6027
|
+
svg: "image/svg+xml",
|
|
6028
|
+
txt: "text/plain",
|
|
6029
|
+
log: "text/plain",
|
|
6030
|
+
md: "text/markdown",
|
|
6031
|
+
csv: "text/csv",
|
|
6032
|
+
tsv: "text/tab-separated-values",
|
|
6033
|
+
json: "application/json",
|
|
6034
|
+
xml: "application/xml",
|
|
6035
|
+
html: "text/html",
|
|
6036
|
+
htm: "text/html",
|
|
6037
|
+
yaml: "application/yaml",
|
|
6038
|
+
yml: "application/yaml",
|
|
6039
|
+
doc: "application/msword",
|
|
6040
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
6041
|
+
xls: "application/vnd.ms-excel",
|
|
6042
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
6043
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
6044
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
6045
|
+
zip: "application/zip",
|
|
6046
|
+
mp3: "audio/mpeg",
|
|
6047
|
+
wav: "audio/wav",
|
|
6048
|
+
mp4: "video/mp4"
|
|
6049
|
+
});
|
|
5536
6050
|
// ../common/src/polling/types.ts
|
|
5537
6051
|
var PollOutcome = {
|
|
5538
6052
|
Completed: "completed",
|
|
@@ -5577,6 +6091,7 @@ var ScreenLogger;
|
|
|
5577
6091
|
ScreenLogger.progress = progress;
|
|
5578
6092
|
})(ScreenLogger ||= {});
|
|
5579
6093
|
// ../common/src/sdk-user-agent.ts
|
|
6094
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
5580
6095
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
5581
6096
|
// ../common/src/telemetry/ship-succeeded.ts
|
|
5582
6097
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
@@ -5893,6 +6408,11 @@ var pickName = (claims) => {
|
|
|
5893
6408
|
const username = asString(claims?.preferred_username);
|
|
5894
6409
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
5895
6410
|
};
|
|
6411
|
+
var pickScopes = (claims) => {
|
|
6412
|
+
const raw = claims?.scope;
|
|
6413
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
6414
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
6415
|
+
};
|
|
5896
6416
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
5897
6417
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
5898
6418
|
const email = pickEmail(claims);
|
|
@@ -5918,6 +6438,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
5918
6438
|
identity.clientId = clientId;
|
|
5919
6439
|
return identity;
|
|
5920
6440
|
};
|
|
6441
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
5921
6442
|
|
|
5922
6443
|
// ../auth/src/envAuth.ts
|
|
5923
6444
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
@@ -5990,6 +6511,7 @@ var readAuthFromEnv = () => {
|
|
|
5990
6511
|
const expiration = getTokenExpiration(accessToken);
|
|
5991
6512
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
5992
6513
|
const identity = resolveSessionIdentity(accessToken);
|
|
6514
|
+
const scopes = readTokenScopes(accessToken);
|
|
5993
6515
|
return {
|
|
5994
6516
|
loginStatus,
|
|
5995
6517
|
accessToken,
|
|
@@ -6000,7 +6522,8 @@ var readAuthFromEnv = () => {
|
|
|
6000
6522
|
tenantId,
|
|
6001
6523
|
expiration,
|
|
6002
6524
|
source: "env-vars" /* EnvironmentVariables */,
|
|
6003
|
-
...identity ? { identity } : {}
|
|
6525
|
+
...identity ? { identity } : {},
|
|
6526
|
+
...scopes ? { scopes } : {}
|
|
6004
6527
|
};
|
|
6005
6528
|
};
|
|
6006
6529
|
|
|
@@ -6638,10 +7161,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
6638
7161
|
}
|
|
6639
7162
|
function identityFields(accessToken, credentials) {
|
|
6640
7163
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
6641
|
-
|
|
7164
|
+
const scopes = readTokenScopes(accessToken);
|
|
7165
|
+
return {
|
|
7166
|
+
...identity ? { identity } : {},
|
|
7167
|
+
...scopes ? { scopes } : {}
|
|
7168
|
+
};
|
|
6642
7169
|
}
|
|
6643
7170
|
function buildRobotStatus(robotCreds) {
|
|
6644
7171
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
7172
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
6645
7173
|
return {
|
|
6646
7174
|
loginStatus: "Logged in",
|
|
6647
7175
|
accessToken: robotCreds.accessToken,
|
|
@@ -6653,7 +7181,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
6653
7181
|
issuer: robotCreds.issuer,
|
|
6654
7182
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
6655
7183
|
source: "robot" /* Robot */,
|
|
6656
|
-
...identity ? { identity } : {}
|
|
7184
|
+
...identity ? { identity } : {},
|
|
7185
|
+
...scopes ? { scopes } : {}
|
|
6657
7186
|
};
|
|
6658
7187
|
}
|
|
6659
7188
|
var isFileNotFoundError = (error) => {
|
|
@@ -6920,7 +7449,8 @@ var getAuthContext = async (options = {}) => {
|
|
|
6920
7449
|
organizationId: status.organizationId,
|
|
6921
7450
|
organizationName: status.organizationName,
|
|
6922
7451
|
tenantId: status.tenantId,
|
|
6923
|
-
tenantName
|
|
7452
|
+
tenantName,
|
|
7453
|
+
identity: status.identity
|
|
6924
7454
|
};
|
|
6925
7455
|
};
|
|
6926
7456
|
// ../auth/src/tenantSelection.ts
|
|
@@ -6979,13 +7509,18 @@ async function toApiError(response) {
|
|
|
6979
7509
|
const errorText = await response.text();
|
|
6980
7510
|
return new PmApiError(`API request failed: ${response.status} ${response.statusText} - ${errorText}`, response.status);
|
|
6981
7511
|
}
|
|
6982
|
-
|
|
7512
|
+
var BODY_SNIPPET_LENGTH = 200;
|
|
7513
|
+
function unexpectedBodyError(response, expected, text) {
|
|
7514
|
+
const contentType = response.headers.get("content-type") ?? "no content type";
|
|
7515
|
+
const snippet = text.replace(/\s+/g, " ").trim().slice(0, BODY_SNIPPET_LENGTH);
|
|
7516
|
+
return new Error(`The Process Mining API answered ${response.status} with ${contentType} instead of ${expected}: "${snippet}". ` + "The request may not have reached the Process Mining service — check that Process Mining is enabled on this tenant and that you are logged in to the right organization and tenant.");
|
|
7517
|
+
}
|
|
7518
|
+
function parseJsonBody(response, text) {
|
|
6983
7519
|
if (!text)
|
|
6984
7520
|
return null;
|
|
6985
7521
|
const [parseErr, parsed] = catchError(() => JSON.parse(text));
|
|
6986
|
-
if (parseErr)
|
|
6987
|
-
throw
|
|
6988
|
-
}
|
|
7522
|
+
if (parseErr)
|
|
7523
|
+
throw unexpectedBodyError(response, "JSON", text);
|
|
6989
7524
|
return parsed;
|
|
6990
7525
|
}
|
|
6991
7526
|
async function pmRequest(config, method, path2, body) {
|
|
@@ -6996,7 +7531,7 @@ async function pmRequest(config, method, path2, body) {
|
|
|
6996
7531
|
});
|
|
6997
7532
|
if (!response.ok)
|
|
6998
7533
|
throw await toApiError(response);
|
|
6999
|
-
return parseJsonBody(await response.text());
|
|
7534
|
+
return parseJsonBody(response, await response.text());
|
|
7000
7535
|
}
|
|
7001
7536
|
async function pmGet(config, path2) {
|
|
7002
7537
|
const result = await pmRequest(config, "GET", path2);
|
|
@@ -7010,7 +7545,7 @@ async function pmPost(config, path2, body) {
|
|
|
7010
7545
|
async function pmDelete(config, path2, body) {
|
|
7011
7546
|
return pmRequest(config, "DELETE", path2, body);
|
|
7012
7547
|
}
|
|
7013
|
-
async function
|
|
7548
|
+
async function getWithEtag(config, path2) {
|
|
7014
7549
|
const response = await fetch(buildPmUrl(config, path2), {
|
|
7015
7550
|
method: "GET",
|
|
7016
7551
|
headers: { Authorization: `Bearer ${config.authToken}` }
|
|
@@ -7018,10 +7553,25 @@ async function pmGetRaw(config, path2) {
|
|
|
7018
7553
|
if (!response.ok)
|
|
7019
7554
|
throw await toApiError(response);
|
|
7020
7555
|
return {
|
|
7021
|
-
|
|
7556
|
+
response,
|
|
7557
|
+
text: await response.text(),
|
|
7022
7558
|
etag: response.headers.get("etag")
|
|
7023
7559
|
};
|
|
7024
7560
|
}
|
|
7561
|
+
async function pmGetRaw(config, path2) {
|
|
7562
|
+
const { response, text, etag } = await getWithEtag(config, path2);
|
|
7563
|
+
parseJsonBody(response, text);
|
|
7564
|
+
return { content: text, etag };
|
|
7565
|
+
}
|
|
7566
|
+
var FILE_CONTENT_TYPE = "application/octet-stream";
|
|
7567
|
+
async function pmGetFile(config, path2) {
|
|
7568
|
+
const { response, text, etag } = await getWithEtag(config, path2);
|
|
7569
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
7570
|
+
if (contentType.split(";")[0].trim().toLowerCase() !== FILE_CONTENT_TYPE) {
|
|
7571
|
+
throw unexpectedBodyError(response, `a file (${FILE_CONTENT_TYPE})`, text);
|
|
7572
|
+
}
|
|
7573
|
+
return { content: text, etag };
|
|
7574
|
+
}
|
|
7025
7575
|
async function pmPutJson(config, path2, body, etag) {
|
|
7026
7576
|
const response = await fetch(buildPmUrl(config, path2), {
|
|
7027
7577
|
method: "PUT",
|
|
@@ -7035,7 +7585,7 @@ async function pmPutJson(config, path2, body, etag) {
|
|
|
7035
7585
|
});
|
|
7036
7586
|
if (!response.ok)
|
|
7037
7587
|
throw await toApiError(response);
|
|
7038
|
-
return parseJsonBody(await response.text());
|
|
7588
|
+
return parseJsonBody(response, await response.text());
|
|
7039
7589
|
}
|
|
7040
7590
|
var APP_TOKEN_REFRESH_MARGIN_SECONDS = 60;
|
|
7041
7591
|
var APP_TOKEN_FALLBACK_TTL_SECONDS = 300;
|
|
@@ -7094,7 +7644,7 @@ async function pmtGet(config, appId, path2) {
|
|
|
7094
7644
|
}
|
|
7095
7645
|
if (!response.ok)
|
|
7096
7646
|
throw await toApiError(response);
|
|
7097
|
-
const result = parseJsonBody(await response.text());
|
|
7647
|
+
const result = parseJsonBody(response, await response.text());
|
|
7098
7648
|
if (result === null)
|
|
7099
7649
|
throw new Error("API returned an empty response body");
|
|
7100
7650
|
return result;
|
|
@@ -7117,14 +7667,18 @@ async function putRawResponse(config, path2, content, extraHeaders) {
|
|
|
7117
7667
|
});
|
|
7118
7668
|
if (!response.ok)
|
|
7119
7669
|
throw await toApiError(response);
|
|
7120
|
-
return
|
|
7670
|
+
return {
|
|
7671
|
+
response,
|
|
7672
|
+
body: parseJsonBody(response, await response.text())
|
|
7673
|
+
};
|
|
7121
7674
|
}
|
|
7122
7675
|
async function putRaw(config, path2, content, extraHeaders) {
|
|
7123
|
-
|
|
7676
|
+
const { response } = await putRawResponse(config, path2, content, extraHeaders);
|
|
7677
|
+
return response.headers.get("etag");
|
|
7124
7678
|
}
|
|
7125
7679
|
async function pmPutBinaryJson(config, path2, content) {
|
|
7126
|
-
const
|
|
7127
|
-
return
|
|
7680
|
+
const { body } = await putRawResponse(config, path2, content);
|
|
7681
|
+
return body;
|
|
7128
7682
|
}
|
|
7129
7683
|
|
|
7130
7684
|
// src/commands/_shared.ts
|
|
@@ -8478,7 +9032,7 @@ function registerUploadModel(group) {
|
|
|
8478
9032
|
return;
|
|
8479
9033
|
}
|
|
8480
9034
|
const bpmn = String(content);
|
|
8481
|
-
if (
|
|
9035
|
+
if (new TextEncoder().encode(bpmn).length > MAX_BPMN_BYTES) {
|
|
8482
9036
|
fail(`BPMN file is larger than the 6 MB the API accepts: ${bpmnFile}`, "Trim the model, or split the process so each app carries one.");
|
|
8483
9037
|
return;
|
|
8484
9038
|
}
|
|
@@ -9577,7 +10131,7 @@ function registerTransformationsCommand(program2) {
|
|
|
9577
10131
|
const config = await loadConfigOrExit();
|
|
9578
10132
|
if (!config)
|
|
9579
10133
|
return;
|
|
9580
|
-
const [err, file] = await catchError(
|
|
10134
|
+
const [err, file] = await catchError(pmGetFile(config, `/apps/${appId}/${options.stage}/transformation/tree/${path2}`));
|
|
9581
10135
|
if (err) {
|
|
9582
10136
|
fail(err.message, "Check the file path (uip pm transformations list).");
|
|
9583
10137
|
return;
|
|
@@ -9771,4 +10325,4 @@ var registerCommands = async (program2) => {
|
|
|
9771
10325
|
|
|
9772
10326
|
export { Command, metadata, registerCommands };
|
|
9773
10327
|
|
|
9774
|
-
//# debugId=
|
|
10328
|
+
//# debugId=9A095136090026EF64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/pm-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.204.0-preview.206",
|
|
6
6
|
"description": "Process Mining — process apps, transformations, and data ingestion.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
|
|
31
31
|
}
|