@uipath/function-tool 1.203.0-preview.212 → 1.204.0-preview.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -3
- package/dist/{index-v5xsxz9f.js → index-bpz85ayg.js} +345 -209
- package/dist/index-hkrczw69.js +157 -0
- package/dist/index-pv66qwr4.js +961 -0
- package/dist/{index-t0pqjb4h.js → packager-tool-4r3qztwy.js} +23 -84
- package/dist/{packager-tool-9331shqx.js → packager-tool-5s8z8be9.js} +589 -69
- package/dist/packager-tool.js +186 -1083
- package/dist/tool.js +176 -72
- package/package.json +2 -2
|
@@ -2854,11 +2854,33 @@ function getLogFilePath() {
|
|
|
2854
2854
|
return logger.getLogFilePath();
|
|
2855
2855
|
}
|
|
2856
2856
|
|
|
2857
|
+
// ../common/src/output-format-context.ts
|
|
2858
|
+
var formatSlot = singleton("OutputFormat");
|
|
2859
|
+
var formatExplicitSlot = singleton("OutputFormatExplicit");
|
|
2860
|
+
var helpRequestedSlot = singleton("HelpRequested");
|
|
2861
|
+
var filterSlot = singleton("OutputFilter");
|
|
2862
|
+
function getOutputFormat() {
|
|
2863
|
+
return formatSlot.get("json");
|
|
2864
|
+
}
|
|
2865
|
+
function getOutputFormatExplicit() {
|
|
2866
|
+
return formatExplicitSlot.get(false) ?? false;
|
|
2867
|
+
}
|
|
2868
|
+
function getOutputFilter() {
|
|
2869
|
+
return filterSlot.get();
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2857
2872
|
// ../common/src/exit-code.ts
|
|
2858
2873
|
function setExitCode(code) {
|
|
2859
2874
|
process.exitCode = code;
|
|
2860
2875
|
}
|
|
2861
2876
|
|
|
2877
|
+
// ../common/src/local-permission-codes.ts
|
|
2878
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2879
|
+
"EACCES",
|
|
2880
|
+
"EPERM",
|
|
2881
|
+
"EROFS"
|
|
2882
|
+
]);
|
|
2883
|
+
|
|
2862
2884
|
// ../common/src/output-codecs.ts
|
|
2863
2885
|
var yamlSlot = singleton("YamlCodec");
|
|
2864
2886
|
var jmespathSlot = singleton("JmespathCodec");
|
|
@@ -2883,16 +2905,195 @@ function getJmespathCodec() {
|
|
|
2883
2905
|
return jmespathSlot.get();
|
|
2884
2906
|
}
|
|
2885
2907
|
|
|
2886
|
-
// ../common/src/
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2908
|
+
// ../common/src/error-graph.ts
|
|
2909
|
+
function* walkErrorGraph(error) {
|
|
2910
|
+
const queue = [error];
|
|
2911
|
+
const seen = new Set;
|
|
2912
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2913
|
+
const current = queue.shift();
|
|
2914
|
+
if (current === null || typeof current !== "object")
|
|
2915
|
+
continue;
|
|
2916
|
+
if (seen.has(current))
|
|
2917
|
+
continue;
|
|
2918
|
+
seen.add(current);
|
|
2919
|
+
const cur = current;
|
|
2920
|
+
yield cur;
|
|
2921
|
+
if (cur.cause !== undefined)
|
|
2922
|
+
queue.push(cur.cause);
|
|
2923
|
+
if (Array.isArray(cur.errors))
|
|
2924
|
+
queue.push(...cur.errors);
|
|
2925
|
+
}
|
|
2926
|
+
return;
|
|
2893
2927
|
}
|
|
2894
|
-
function
|
|
2895
|
-
|
|
2928
|
+
function parseHttpStatusFromMessage(message) {
|
|
2929
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2930
|
+
if (!match)
|
|
2931
|
+
return;
|
|
2932
|
+
const status = Number(match[1]);
|
|
2933
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2934
|
+
}
|
|
2935
|
+
function findHttpStatusInGraph(error) {
|
|
2936
|
+
for (const node of walkErrorGraph(error)) {
|
|
2937
|
+
const response = node.response;
|
|
2938
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2939
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2940
|
+
return explicit;
|
|
2941
|
+
}
|
|
2942
|
+
if (typeof node.message === "string") {
|
|
2943
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2944
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2945
|
+
return parsed;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
return;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
2953
|
+
var BaseDimensions = {
|
|
2954
|
+
ApplicationName: "ApplicationName",
|
|
2955
|
+
ProductVersion: "ProductVersion",
|
|
2956
|
+
InstallationId: "InstallationId",
|
|
2957
|
+
CloudUserId: "CloudUserId",
|
|
2958
|
+
CloudTenantId: "CloudTenantId",
|
|
2959
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2960
|
+
IsInternalUser: "IsInternalUser",
|
|
2961
|
+
Environment: "Environment",
|
|
2962
|
+
BaseUrl: "BaseUrl",
|
|
2963
|
+
Region: "Region",
|
|
2964
|
+
Agent: "Agent",
|
|
2965
|
+
AgentVersion: "AgentVersion",
|
|
2966
|
+
AgentModel: "AgentModel",
|
|
2967
|
+
ToolName: "ToolName",
|
|
2968
|
+
ToolVersion: "ToolVersion",
|
|
2969
|
+
ExecutionContext: "ExecutionContext",
|
|
2970
|
+
CiProvider: "CiProvider",
|
|
2971
|
+
SessionIdSource: "SessionIdSource",
|
|
2972
|
+
SessionId: "SessionId"
|
|
2973
|
+
};
|
|
2974
|
+
var CommandDimensions = {
|
|
2975
|
+
IsCommand: "IsCommand",
|
|
2976
|
+
IsReexec: "IsReexec",
|
|
2977
|
+
CommandName: "CommandName",
|
|
2978
|
+
ExitCode: "ExitCode",
|
|
2979
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2980
|
+
ErrorClass: "ErrorClass",
|
|
2981
|
+
TerminalSignal: "TerminalSignal",
|
|
2982
|
+
ErrorMessage: "ErrorMessage",
|
|
2983
|
+
SkillName: "SkillName",
|
|
2984
|
+
ProductArea: "ProductArea",
|
|
2985
|
+
Mode: "Mode"
|
|
2986
|
+
};
|
|
2987
|
+
var ShipDimensions = {
|
|
2988
|
+
ShipKind: "ShipKind",
|
|
2989
|
+
Target: "Target",
|
|
2990
|
+
ProjectType: "ProjectType",
|
|
2991
|
+
ProjectTypes: "ProjectTypes",
|
|
2992
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2993
|
+
PackageName: "PackageName",
|
|
2994
|
+
PackageVersion: "PackageVersion",
|
|
2995
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2996
|
+
DeploymentKey: "DeploymentKey",
|
|
2997
|
+
SolutionId: "SolutionId",
|
|
2998
|
+
FolderKey: "FolderKey",
|
|
2999
|
+
FeedId: "FeedId"
|
|
3000
|
+
};
|
|
3001
|
+
var ErrorDimensions = {
|
|
3002
|
+
Result: "Result",
|
|
3003
|
+
ErrorCode: "ErrorCode",
|
|
3004
|
+
Retry: "Retry",
|
|
3005
|
+
ErrorMessage: "ErrorMessage"
|
|
3006
|
+
};
|
|
3007
|
+
var AuthDimensions = {
|
|
3008
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3009
|
+
Success: "Success",
|
|
3010
|
+
Reason: "Reason"
|
|
3011
|
+
};
|
|
3012
|
+
var SkillsDimensions = {
|
|
3013
|
+
SchemaVersion: "SchemaVersion",
|
|
3014
|
+
AgentType: "AgentType",
|
|
3015
|
+
SkillsVersion: "SkillsVersion",
|
|
3016
|
+
UipSubcommand: "UipSubcommand",
|
|
3017
|
+
FileExtension: "FileExtension",
|
|
3018
|
+
SubagentModel: "SubagentModel",
|
|
3019
|
+
SubagentType: "SubagentType",
|
|
3020
|
+
PermissionMode: "PermissionMode",
|
|
3021
|
+
EffortLevel: "EffortLevel",
|
|
3022
|
+
SessionSource: "SessionSource",
|
|
3023
|
+
Outcome: "Outcome",
|
|
3024
|
+
DurationMs: "DurationMs",
|
|
3025
|
+
Source: "Source"
|
|
3026
|
+
};
|
|
3027
|
+
var PackagerDimensions = {
|
|
3028
|
+
ProjectId: "ProjectId",
|
|
3029
|
+
ProjectType: "ProjectType",
|
|
3030
|
+
SolutionId: "SolutionId"
|
|
3031
|
+
};
|
|
3032
|
+
var ScopeDimensions = {
|
|
3033
|
+
FolderId: "FolderId"
|
|
3034
|
+
};
|
|
3035
|
+
var ID_DIMENSIONS = new Set([
|
|
3036
|
+
BaseDimensions.CloudUserId,
|
|
3037
|
+
BaseDimensions.CloudTenantId,
|
|
3038
|
+
BaseDimensions.CloudOrganizationId,
|
|
3039
|
+
BaseDimensions.InstallationId,
|
|
3040
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3041
|
+
ShipDimensions.PackageVersionKey,
|
|
3042
|
+
ShipDimensions.DeploymentKey,
|
|
3043
|
+
ShipDimensions.SolutionId,
|
|
3044
|
+
ShipDimensions.FolderKey,
|
|
3045
|
+
ShipDimensions.FeedId,
|
|
3046
|
+
PackagerDimensions.ProjectId
|
|
3047
|
+
]);
|
|
3048
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3049
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3050
|
+
...Object.values(BaseDimensions),
|
|
3051
|
+
...Object.values(CommandDimensions),
|
|
3052
|
+
...Object.values(ShipDimensions),
|
|
3053
|
+
...Object.values(ErrorDimensions),
|
|
3054
|
+
...Object.values(AuthDimensions),
|
|
3055
|
+
...Object.values(SkillsDimensions),
|
|
3056
|
+
...Object.values(PackagerDimensions),
|
|
3057
|
+
...Object.values(ScopeDimensions)
|
|
3058
|
+
]);
|
|
3059
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3060
|
+
BaseDimensions.ApplicationName,
|
|
3061
|
+
BaseDimensions.ProductVersion,
|
|
3062
|
+
BaseDimensions.InstallationId,
|
|
3063
|
+
BaseDimensions.CloudUserId,
|
|
3064
|
+
BaseDimensions.CloudTenantId,
|
|
3065
|
+
BaseDimensions.CloudOrganizationId,
|
|
3066
|
+
BaseDimensions.IsInternalUser,
|
|
3067
|
+
BaseDimensions.Environment,
|
|
3068
|
+
BaseDimensions.BaseUrl,
|
|
3069
|
+
BaseDimensions.Region,
|
|
3070
|
+
BaseDimensions.Agent,
|
|
3071
|
+
BaseDimensions.AgentVersion,
|
|
3072
|
+
BaseDimensions.ToolVersion,
|
|
3073
|
+
BaseDimensions.ExecutionContext,
|
|
3074
|
+
BaseDimensions.CiProvider,
|
|
3075
|
+
BaseDimensions.SessionIdSource,
|
|
3076
|
+
BaseDimensions.SessionId,
|
|
3077
|
+
...Object.values(CommandDimensions),
|
|
3078
|
+
...Object.values(ShipDimensions)
|
|
3079
|
+
]);
|
|
3080
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3081
|
+
let changed = false;
|
|
3082
|
+
const result = {
|
|
3083
|
+
...properties
|
|
3084
|
+
};
|
|
3085
|
+
for (const key of Object.keys(result)) {
|
|
3086
|
+
const value = result[key];
|
|
3087
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3088
|
+
continue;
|
|
3089
|
+
}
|
|
3090
|
+
const lowered = value.toLowerCase();
|
|
3091
|
+
if (lowered !== value) {
|
|
3092
|
+
result[key] = lowered;
|
|
3093
|
+
changed = true;
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
return changed ? result : properties;
|
|
2896
3097
|
}
|
|
2897
3098
|
|
|
2898
3099
|
// ../common/src/telemetry/command-terminal.ts
|
|
@@ -2901,6 +3102,9 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
2901
3102
|
"authentication_required",
|
|
2902
3103
|
"permission_denied"
|
|
2903
3104
|
]);
|
|
3105
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3106
|
+
"local_permission_denied"
|
|
3107
|
+
]);
|
|
2904
3108
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
2905
3109
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
2906
3110
|
"network_error",
|
|
@@ -3041,6 +3245,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3041
3245
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3042
3246
|
return "auth";
|
|
3043
3247
|
}
|
|
3248
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3249
|
+
return "local_permission";
|
|
3250
|
+
}
|
|
3044
3251
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3045
3252
|
return "validation";
|
|
3046
3253
|
}
|
|
@@ -3052,6 +3259,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3052
3259
|
}
|
|
3053
3260
|
return;
|
|
3054
3261
|
}
|
|
3262
|
+
function hasLocalPermissionCode(error) {
|
|
3263
|
+
for (const node of walkErrorGraph(error)) {
|
|
3264
|
+
const code = node.code;
|
|
3265
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3266
|
+
return true;
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
return false;
|
|
3270
|
+
}
|
|
3055
3271
|
function classifyFromError(error) {
|
|
3056
3272
|
const code = findCodeInCauseChain(error);
|
|
3057
3273
|
if (code) {
|
|
@@ -3068,6 +3284,9 @@ function classifyFromError(error) {
|
|
|
3068
3284
|
return "missing_dependency";
|
|
3069
3285
|
}
|
|
3070
3286
|
}
|
|
3287
|
+
if (hasLocalPermissionCode(error)) {
|
|
3288
|
+
return "local_permission";
|
|
3289
|
+
}
|
|
3071
3290
|
const message = stringField(error, "message");
|
|
3072
3291
|
if (message?.includes("fetch failed") === true) {
|
|
3073
3292
|
return "network_http";
|
|
@@ -3083,7 +3302,7 @@ function classifyError(input) {
|
|
|
3083
3302
|
if (recorded?.errorClass) {
|
|
3084
3303
|
return recorded.errorClass;
|
|
3085
3304
|
}
|
|
3086
|
-
const status = recorded?.context?.httpStatus;
|
|
3305
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3087
3306
|
if (status !== undefined) {
|
|
3088
3307
|
return classifyHttpStatus(status);
|
|
3089
3308
|
}
|
|
@@ -3106,17 +3325,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3106
3325
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
|
|
3107
3326
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3108
3327
|
return {
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
...errorClass ? {
|
|
3112
|
-
...terminalSignal ? {
|
|
3328
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
3329
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
3330
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
3331
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3113
3332
|
};
|
|
3114
3333
|
}
|
|
3115
3334
|
|
|
3116
3335
|
// ../common/src/telemetry/telemetry-events.ts
|
|
3117
3336
|
var CommonTelemetryEvents = {
|
|
3118
|
-
|
|
3119
|
-
|
|
3337
|
+
Start: "Application.Start",
|
|
3338
|
+
Error: "Application.Error",
|
|
3339
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3120
3340
|
};
|
|
3121
3341
|
|
|
3122
3342
|
// ../common/src/registry.ts
|
|
@@ -3324,8 +3544,8 @@ function detectExecutionContext(options = {}) {
|
|
|
3324
3544
|
function getExecutionContextTelemetryProperties() {
|
|
3325
3545
|
const detected = detectExecutionContext();
|
|
3326
3546
|
return {
|
|
3327
|
-
|
|
3328
|
-
...detected.ciProvider ? {
|
|
3547
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
3548
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
3329
3549
|
};
|
|
3330
3550
|
}
|
|
3331
3551
|
// ../common/src/telemetry/node-context-storage.ts
|
|
@@ -3368,7 +3588,7 @@ function getInboundTraceContext() {
|
|
|
3368
3588
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
3369
3589
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
3370
3590
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
3371
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
3591
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
3372
3592
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
3373
3593
|
var INHERITED_SESSION_SOURCES = [
|
|
3374
3594
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -3420,6 +3640,9 @@ function resolveTelemetrySession() {
|
|
|
3420
3640
|
telemetrySessionSlot.set(resolved);
|
|
3421
3641
|
return resolved;
|
|
3422
3642
|
}
|
|
3643
|
+
function getTelemetrySessionId() {
|
|
3644
|
+
return resolveTelemetrySession().id;
|
|
3645
|
+
}
|
|
3423
3646
|
function getTelemetrySessionSource() {
|
|
3424
3647
|
return resolveTelemetrySession().source;
|
|
3425
3648
|
}
|
|
@@ -3500,7 +3723,10 @@ class TelemetryService {
|
|
|
3500
3723
|
} catch (error) {
|
|
3501
3724
|
const durationMs = clock.elapsedMs();
|
|
3502
3725
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3503
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
3726
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
3727
|
+
...properties,
|
|
3728
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
3729
|
+
}, context));
|
|
3504
3730
|
throw error;
|
|
3505
3731
|
}
|
|
3506
3732
|
}
|
|
@@ -3571,7 +3797,10 @@ class TelemetryService {
|
|
|
3571
3797
|
const durationMs = clock.elapsedMs();
|
|
3572
3798
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3573
3799
|
await this.telemetryProvider.trackDependency({
|
|
3574
|
-
...this.spanFor(name, durationMs, false, {
|
|
3800
|
+
...this.spanFor(name, durationMs, false, {
|
|
3801
|
+
...properties,
|
|
3802
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
3803
|
+
}, childContext),
|
|
3575
3804
|
type
|
|
3576
3805
|
});
|
|
3577
3806
|
throw error;
|
|
@@ -3606,9 +3835,10 @@ class TelemetryService {
|
|
|
3606
3835
|
...globalProperties,
|
|
3607
3836
|
...this.defaultProperties,
|
|
3608
3837
|
...redactProperties(properties ?? {}),
|
|
3609
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
3838
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
3839
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
3610
3840
|
};
|
|
3611
|
-
return enriched;
|
|
3841
|
+
return lowercaseIdDimensionValues(enriched);
|
|
3612
3842
|
}
|
|
3613
3843
|
generateId() {
|
|
3614
3844
|
const bytes = new Uint8Array(8);
|
|
@@ -4369,7 +4599,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4369
4599
|
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).";
|
|
4370
4600
|
}
|
|
4371
4601
|
}
|
|
4372
|
-
function
|
|
4602
|
+
function countRecords(data) {
|
|
4603
|
+
if (Array.isArray(data))
|
|
4604
|
+
return data.length;
|
|
4605
|
+
return data == null ? 0 : 1;
|
|
4606
|
+
}
|
|
4607
|
+
function availableFields(data) {
|
|
4608
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4609
|
+
const keys = new Set;
|
|
4610
|
+
for (const record of records) {
|
|
4611
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4612
|
+
for (const key of Object.keys(record))
|
|
4613
|
+
keys.add(key);
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
return [...keys];
|
|
4617
|
+
}
|
|
4618
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4619
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4620
|
+
if (!error && typeof decoded === "string")
|
|
4621
|
+
return decoded;
|
|
4622
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4623
|
+
}
|
|
4624
|
+
function referencedFields(filter) {
|
|
4625
|
+
const top = new Set;
|
|
4626
|
+
const nested = new Set;
|
|
4627
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4628
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4629
|
+
const quoted = [];
|
|
4630
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4631
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4632
|
+
if (!isAlias) {
|
|
4633
|
+
quoted.push({
|
|
4634
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4635
|
+
index,
|
|
4636
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4637
|
+
});
|
|
4638
|
+
}
|
|
4639
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4640
|
+
});
|
|
4641
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4642
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4643
|
+
const place = (name, index, tail) => {
|
|
4644
|
+
if (tail || index >= rootEnd)
|
|
4645
|
+
nested.add(name);
|
|
4646
|
+
else
|
|
4647
|
+
top.add(name);
|
|
4648
|
+
};
|
|
4649
|
+
for (const entry of quoted)
|
|
4650
|
+
place(entry.name, entry.index, entry.tail);
|
|
4651
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4652
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4653
|
+
for (const match of identifiers) {
|
|
4654
|
+
const [, name, trailing] = match;
|
|
4655
|
+
if (trailing || reserved.has(name))
|
|
4656
|
+
continue;
|
|
4657
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4658
|
+
}
|
|
4659
|
+
return {
|
|
4660
|
+
top: [...top],
|
|
4661
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4662
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4663
|
+
};
|
|
4664
|
+
}
|
|
4665
|
+
function appearsBelowTopLevel(data, name) {
|
|
4666
|
+
let budget = 2000;
|
|
4667
|
+
const visit = (value, depth) => {
|
|
4668
|
+
if (budget-- <= 0 || depth > 4)
|
|
4669
|
+
return false;
|
|
4670
|
+
if (value === null || typeof value !== "object")
|
|
4671
|
+
return false;
|
|
4672
|
+
if (Array.isArray(value))
|
|
4673
|
+
return value.some((entry) => visit(entry, depth));
|
|
4674
|
+
const record = value;
|
|
4675
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4676
|
+
return true;
|
|
4677
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4678
|
+
};
|
|
4679
|
+
return visit(data, 0);
|
|
4680
|
+
}
|
|
4681
|
+
function alwaysNullKeys(records) {
|
|
4682
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4683
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4684
|
+
return [];
|
|
4685
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4686
|
+
if (keys.length === 0)
|
|
4687
|
+
return [];
|
|
4688
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4689
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4690
|
+
}
|
|
4691
|
+
function carriesOnlyNulls(value) {
|
|
4692
|
+
if (value === null)
|
|
4693
|
+
return true;
|
|
4694
|
+
if (Array.isArray(value)) {
|
|
4695
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4696
|
+
}
|
|
4697
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4698
|
+
const values = Object.values(value);
|
|
4699
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4700
|
+
}
|
|
4701
|
+
return false;
|
|
4702
|
+
}
|
|
4703
|
+
function nameList(names, cap2 = 12) {
|
|
4704
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4705
|
+
const rest = names.length - shown.length;
|
|
4706
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4707
|
+
}
|
|
4708
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4709
|
+
const present = availableFields(data);
|
|
4710
|
+
const refs = referencedFields(filter);
|
|
4711
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4712
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4713
|
+
const count = countRecords(data);
|
|
4714
|
+
const scope = `${count} record(s)`;
|
|
4715
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4716
|
+
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" : "";
|
|
4717
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4718
|
+
let detail;
|
|
4719
|
+
let lede;
|
|
4720
|
+
if (outcome.kind === "null-elements") {
|
|
4721
|
+
lede = "returned only null values";
|
|
4722
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4723
|
+
if (unknown.length > 0) {
|
|
4724
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4725
|
+
} else if (unchecked.length > 0) {
|
|
4726
|
+
detail = withSoundness(projected);
|
|
4727
|
+
} else {
|
|
4728
|
+
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`;
|
|
4729
|
+
}
|
|
4730
|
+
} else if (outcome.kind === "null-rows") {
|
|
4731
|
+
lede = "returned only null values";
|
|
4732
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4733
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4734
|
+
} else if (outcome.kind === "null-values") {
|
|
4735
|
+
lede = "returned only null values";
|
|
4736
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4737
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4738
|
+
if (sameSet) {
|
|
4739
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4740
|
+
} else if (unknown.length > 0) {
|
|
4741
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4742
|
+
} else {
|
|
4743
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4744
|
+
}
|
|
4745
|
+
} else {
|
|
4746
|
+
lede = "returned nothing";
|
|
4747
|
+
if (unknown.length > 0) {
|
|
4748
|
+
detail = isNotAField(unknown);
|
|
4749
|
+
} else {
|
|
4750
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
4751
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
4755
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
4756
|
+
}
|
|
4757
|
+
function appendWarning(existing, note) {
|
|
4758
|
+
return existing ? `${existing} ${note}` : note;
|
|
4759
|
+
}
|
|
4760
|
+
function applyFilter(data, filter, onWarning) {
|
|
4373
4761
|
const codec = requireJmespath();
|
|
4374
4762
|
let result;
|
|
4375
4763
|
try {
|
|
@@ -4377,9 +4765,34 @@ function applyFilter(data, filter) {
|
|
|
4377
4765
|
} catch (err) {
|
|
4378
4766
|
throw new FilterEvaluationError(filter, err);
|
|
4379
4767
|
}
|
|
4380
|
-
|
|
4768
|
+
const inputCount = countRecords(data);
|
|
4769
|
+
const warn = (outcome) => {
|
|
4770
|
+
if (inputCount === 0)
|
|
4771
|
+
return;
|
|
4772
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
4773
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
4774
|
+
`);
|
|
4775
|
+
onWarning?.(note);
|
|
4776
|
+
};
|
|
4777
|
+
const warnIfAllNull = (records) => {
|
|
4778
|
+
const keys = alwaysNullKeys(records);
|
|
4779
|
+
if (keys.length > 0)
|
|
4780
|
+
warn({ kind: "null-values", keys });
|
|
4781
|
+
};
|
|
4782
|
+
if (result == null) {
|
|
4783
|
+
warn({ kind: "empty" });
|
|
4381
4784
|
return [];
|
|
4785
|
+
}
|
|
4382
4786
|
if (Array.isArray(result)) {
|
|
4787
|
+
if (result.length === 0) {
|
|
4788
|
+
warn({ kind: "empty" });
|
|
4789
|
+
} else if (result.every((entry) => entry === null)) {
|
|
4790
|
+
warn({ kind: "null-elements", count: result.length });
|
|
4791
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
4792
|
+
warn({ kind: "null-rows", count: result.length });
|
|
4793
|
+
} else {
|
|
4794
|
+
warnIfAllNull(result);
|
|
4795
|
+
}
|
|
4383
4796
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4384
4797
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4385
4798
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4387,10 +4800,30 @@ function applyFilter(data, filter) {
|
|
|
4387
4800
|
}
|
|
4388
4801
|
return result;
|
|
4389
4802
|
}
|
|
4390
|
-
if (typeof result === "object")
|
|
4803
|
+
if (typeof result === "object") {
|
|
4804
|
+
warnIfAllNull([result]);
|
|
4391
4805
|
return result;
|
|
4806
|
+
}
|
|
4392
4807
|
return { Value: result };
|
|
4393
4808
|
}
|
|
4809
|
+
function filterFailureData(envelope) {
|
|
4810
|
+
const filter = getOutputFilter();
|
|
4811
|
+
const data = envelope.Data;
|
|
4812
|
+
if (!filter || data == null)
|
|
4813
|
+
return;
|
|
4814
|
+
let note;
|
|
4815
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
4816
|
+
note = n;
|
|
4817
|
+
}));
|
|
4818
|
+
if (filterError) {
|
|
4819
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
4820
|
+
return;
|
|
4821
|
+
}
|
|
4822
|
+
envelope.Data = filtered;
|
|
4823
|
+
if (note) {
|
|
4824
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4394
4827
|
function defaultErrorCodeForResult(result) {
|
|
4395
4828
|
switch (result) {
|
|
4396
4829
|
case RESULTS.AuthenticationError:
|
|
@@ -4405,7 +4838,7 @@ function defaultErrorCodeForResult(result) {
|
|
|
4405
4838
|
return "unknown_error";
|
|
4406
4839
|
}
|
|
4407
4840
|
}
|
|
4408
|
-
function
|
|
4841
|
+
function parseHttpStatusFromMessage2(message) {
|
|
4409
4842
|
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
4410
4843
|
if (!match)
|
|
4411
4844
|
return;
|
|
@@ -4434,10 +4867,10 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
4434
4867
|
return "server_error";
|
|
4435
4868
|
return;
|
|
4436
4869
|
}
|
|
4437
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
4870
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
4438
4871
|
function defaultErrorCodeForFailure(data) {
|
|
4439
4872
|
if (data.Result === RESULTS.Failure) {
|
|
4440
|
-
const status = data.Context?.httpStatus ??
|
|
4873
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
4441
4874
|
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
4442
4875
|
if (errorCode)
|
|
4443
4876
|
return errorCode;
|
|
@@ -4473,8 +4906,14 @@ var OutputFormatter;
|
|
|
4473
4906
|
}
|
|
4474
4907
|
const filter = getOutputFilter();
|
|
4475
4908
|
if (filter) {
|
|
4476
|
-
|
|
4909
|
+
let note;
|
|
4910
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
4911
|
+
note = n;
|
|
4912
|
+
});
|
|
4477
4913
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4914
|
+
if (note) {
|
|
4915
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
4916
|
+
}
|
|
4478
4917
|
}
|
|
4479
4918
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4480
4919
|
}
|
|
@@ -4502,12 +4941,13 @@ var OutputFormatter;
|
|
|
4502
4941
|
delete envelope.TelemetryErrorClass;
|
|
4503
4942
|
delete envelope.TelemetryTerminalOutcome;
|
|
4504
4943
|
delete envelope.TelemetryTerminalSignal;
|
|
4944
|
+
filterFailureData(envelope);
|
|
4505
4945
|
if (!suppressTelemetry) {
|
|
4506
4946
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4947
|
+
[ErrorDimensions.Result]: data.Result,
|
|
4948
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
4949
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
4950
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
4511
4951
|
});
|
|
4512
4952
|
}
|
|
4513
4953
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -4550,13 +4990,20 @@ var OutputFormatter;
|
|
|
4550
4990
|
OutputFormatter.log = log;
|
|
4551
4991
|
function formatToString(data) {
|
|
4552
4992
|
const filter = getOutputFilter();
|
|
4993
|
+
const envelope = data;
|
|
4553
4994
|
if ("Data" in data && data.Data != null) {
|
|
4554
4995
|
data.Data = normalizeDataKeys(data.Data);
|
|
4555
4996
|
if (filter) {
|
|
4556
|
-
|
|
4997
|
+
let note;
|
|
4998
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
4999
|
+
note = n;
|
|
5000
|
+
}));
|
|
5001
|
+
if (note) {
|
|
5002
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5003
|
+
}
|
|
4557
5004
|
}
|
|
4558
5005
|
}
|
|
4559
|
-
const output = normalizeOutputKeys(
|
|
5006
|
+
const output = normalizeOutputKeys(envelope);
|
|
4560
5007
|
const lines = [];
|
|
4561
5008
|
const sink = getOutputSink();
|
|
4562
5009
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -4592,7 +5039,7 @@ var TLS_ERROR_CODES2 = new Set([
|
|
|
4592
5039
|
]);
|
|
4593
5040
|
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.";
|
|
4594
5041
|
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.";
|
|
4595
|
-
var
|
|
5042
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
4596
5043
|
|
|
4597
5044
|
// ../common/src/classified-failure.ts
|
|
4598
5045
|
var MAX_QUOTED_BODY_CHARS = 200;
|
|
@@ -4622,7 +5069,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
4622
5069
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
4623
5070
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
4624
5071
|
function productMode(productArea, mode) {
|
|
4625
|
-
return {
|
|
5072
|
+
return { ProductArea: productArea, Mode: mode };
|
|
4626
5073
|
}
|
|
4627
5074
|
function attributionRecord(groups) {
|
|
4628
5075
|
const record = {};
|
|
@@ -4680,6 +5127,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
4680
5127
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
4681
5128
|
["conversational", "operate", ["uip.conversational"]],
|
|
4682
5129
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5130
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
4683
5131
|
["agenthub", "build", ["uip.agenthub"]],
|
|
4684
5132
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
4685
5133
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -4765,32 +5213,64 @@ function normalizeSkillName(value) {
|
|
|
4765
5213
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
4766
5214
|
const skillName = normalizeSkillName(skillSource);
|
|
4767
5215
|
return {
|
|
4768
|
-
...skillName ? {
|
|
5216
|
+
...skillName ? { SkillName: skillName } : {},
|
|
4769
5217
|
...getCommandProductModeAttribution(commandPath)
|
|
4770
5218
|
};
|
|
4771
5219
|
}
|
|
5220
|
+
var AGENT_SESSION_ENV = {
|
|
5221
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5222
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5223
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5224
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5225
|
+
};
|
|
5226
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5227
|
+
function sanitizeTelemetryToken(value) {
|
|
5228
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5229
|
+
}
|
|
5230
|
+
function buildAgentSessionTelemetry(env) {
|
|
5231
|
+
const dimensions = {};
|
|
5232
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5233
|
+
const value = env[variable]?.trim();
|
|
5234
|
+
if (value) {
|
|
5235
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5236
|
+
}
|
|
5237
|
+
}
|
|
5238
|
+
return dimensions;
|
|
5239
|
+
}
|
|
4772
5240
|
|
|
4773
5241
|
// ../common/src/telemetry/command-name.ts
|
|
4774
|
-
var
|
|
5242
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5243
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5244
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
4775
5245
|
function commandTelemetryName(parts) {
|
|
5246
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5247
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5248
|
+
}
|
|
5249
|
+
function commandInvocationPath(parts) {
|
|
5250
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5251
|
+
}
|
|
5252
|
+
function vetCommandTokens(parts) {
|
|
4776
5253
|
const tokens = [];
|
|
4777
5254
|
for (const part of parts) {
|
|
4778
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5255
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
4779
5256
|
if (pieces.every(isCommandToken)) {
|
|
4780
5257
|
tokens.push(...pieces);
|
|
4781
5258
|
continue;
|
|
4782
5259
|
}
|
|
4783
5260
|
tokens.push(UNKNOWN_TOKEN);
|
|
4784
5261
|
}
|
|
4785
|
-
return
|
|
5262
|
+
return tokens;
|
|
5263
|
+
}
|
|
5264
|
+
function pascalizeToken(token) {
|
|
5265
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
4786
5266
|
}
|
|
4787
|
-
var COMMAND_TOKEN_PATTERN = /^[a-
|
|
5267
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
4788
5268
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
4789
5269
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
4790
5270
|
function isCommandToken(token) {
|
|
4791
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5271
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
4792
5272
|
}
|
|
4793
|
-
var UNKNOWN_TOKEN = "
|
|
5273
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
4794
5274
|
|
|
4795
5275
|
// ../common/src/telemetry/invocation-request.ts
|
|
4796
5276
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -4895,7 +5375,7 @@ function withheldArgumentValues(cmd) {
|
|
|
4895
5375
|
});
|
|
4896
5376
|
return values;
|
|
4897
5377
|
}
|
|
4898
|
-
function
|
|
5378
|
+
function deriveCommandParts(cmd) {
|
|
4899
5379
|
const parts = [];
|
|
4900
5380
|
let current = cmd;
|
|
4901
5381
|
while (current) {
|
|
@@ -4908,14 +5388,13 @@ function deriveCommandPath(cmd) {
|
|
|
4908
5388
|
if (parts.length > 1) {
|
|
4909
5389
|
parts.shift();
|
|
4910
5390
|
}
|
|
4911
|
-
return
|
|
5391
|
+
return parts;
|
|
4912
5392
|
}
|
|
4913
5393
|
function isErrorContext(value) {
|
|
4914
5394
|
return value !== null && typeof value === "object";
|
|
4915
5395
|
}
|
|
4916
5396
|
function commandHelpHint(commandPath) {
|
|
4917
|
-
|
|
4918
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5397
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
4919
5398
|
}
|
|
4920
5399
|
function isPromptCancellation(error) {
|
|
4921
5400
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -4940,7 +5419,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4940
5419
|
yaml: getOutputFormat() === "yaml",
|
|
4941
5420
|
filter: getOutputFilter() !== undefined
|
|
4942
5421
|
});
|
|
4943
|
-
const
|
|
5422
|
+
const commandParts = deriveCommandParts(command);
|
|
5423
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
5424
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
4944
5425
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
4945
5426
|
markCommandStart();
|
|
4946
5427
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -4975,7 +5456,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4975
5456
|
Result: finalResult,
|
|
4976
5457
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
4977
5458
|
Message: errorMessage,
|
|
4978
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
5459
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
4979
5460
|
...customRetry ? { Retry: customRetry } : {},
|
|
4980
5461
|
...customContext ? { Context: customContext } : {}
|
|
4981
5462
|
});
|
|
@@ -4992,8 +5473,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
4992
5473
|
recordedFailure,
|
|
4993
5474
|
pollSignal: context.pollSignal
|
|
4994
5475
|
});
|
|
4995
|
-
if (terminalTelemetry.
|
|
4996
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
5476
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
5477
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
4997
5478
|
}
|
|
4998
5479
|
const commandParams = extractCommandParams(command);
|
|
4999
5480
|
if (props) {
|
|
@@ -5004,10 +5485,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5004
5485
|
const baseProperties = redactProperties({
|
|
5005
5486
|
...commandParams,
|
|
5006
5487
|
...props,
|
|
5007
|
-
...buildCommandTelemetryAttribution(
|
|
5008
|
-
|
|
5488
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
5489
|
+
...buildAgentSessionTelemetry(process.env),
|
|
5490
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
5491
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5009
5492
|
...terminalTelemetry,
|
|
5010
|
-
...errorMessage ? { errorMessage } : {}
|
|
5493
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5011
5494
|
});
|
|
5012
5495
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5013
5496
|
} finally {
|
|
@@ -5016,6 +5499,10 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5016
5499
|
});
|
|
5017
5500
|
};
|
|
5018
5501
|
|
|
5502
|
+
// ../common/src/constants.ts
|
|
5503
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
5504
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
5505
|
+
|
|
5019
5506
|
// ../common/src/option-aliases.ts
|
|
5020
5507
|
function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
|
|
5021
5508
|
getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
|
|
@@ -5036,6 +5523,7 @@ function warnDeprecatedTenantOption(tenant) {
|
|
|
5036
5523
|
|
|
5037
5524
|
// ../common/src/sdk-user-agent.ts
|
|
5038
5525
|
var USER_AGENT_HEADER = "User-Agent";
|
|
5526
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
5039
5527
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
5040
5528
|
function userAgentPatchKey(userAgent) {
|
|
5041
5529
|
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
@@ -5139,8 +5627,6 @@ var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
|
5139
5627
|
// ../common/src/console-guard.ts
|
|
5140
5628
|
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
5141
5629
|
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
5142
|
-
// ../common/src/constants.ts
|
|
5143
|
-
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
5144
5630
|
// ../common/src/entity-name-rules.ts
|
|
5145
5631
|
var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
|
|
5146
5632
|
var RESERVED_FIELD_NAMES_LOWER = new Set([
|
|
@@ -5376,6 +5862,40 @@ function stripHostGlobalOptions(args) {
|
|
|
5376
5862
|
// ../common/src/interactivity-context.ts
|
|
5377
5863
|
var modeSlot = singleton("InteractivityMode");
|
|
5378
5864
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
5865
|
+
// ../common/src/mime-types.ts
|
|
5866
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
5867
|
+
pdf: "application/pdf",
|
|
5868
|
+
png: "image/png",
|
|
5869
|
+
jpg: "image/jpeg",
|
|
5870
|
+
jpeg: "image/jpeg",
|
|
5871
|
+
gif: "image/gif",
|
|
5872
|
+
webp: "image/webp",
|
|
5873
|
+
bmp: "image/bmp",
|
|
5874
|
+
tif: "image/tiff",
|
|
5875
|
+
tiff: "image/tiff",
|
|
5876
|
+
svg: "image/svg+xml",
|
|
5877
|
+
txt: "text/plain",
|
|
5878
|
+
log: "text/plain",
|
|
5879
|
+
md: "text/markdown",
|
|
5880
|
+
csv: "text/csv",
|
|
5881
|
+
tsv: "text/tab-separated-values",
|
|
5882
|
+
json: "application/json",
|
|
5883
|
+
xml: "application/xml",
|
|
5884
|
+
html: "text/html",
|
|
5885
|
+
htm: "text/html",
|
|
5886
|
+
yaml: "application/yaml",
|
|
5887
|
+
yml: "application/yaml",
|
|
5888
|
+
doc: "application/msword",
|
|
5889
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
5890
|
+
xls: "application/vnd.ms-excel",
|
|
5891
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5892
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
5893
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
5894
|
+
zip: "application/zip",
|
|
5895
|
+
mp3: "audio/mpeg",
|
|
5896
|
+
wav: "audio/wav",
|
|
5897
|
+
mp4: "video/mp4"
|
|
5898
|
+
});
|
|
5379
5899
|
// ../common/src/polling/types.ts
|
|
5380
5900
|
var PollOutcome = {
|
|
5381
5901
|
Completed: "completed",
|
|
@@ -5432,21 +5952,21 @@ function getShippedKeys() {
|
|
|
5432
5952
|
}
|
|
5433
5953
|
function dedupeKey(payload) {
|
|
5434
5954
|
return [
|
|
5435
|
-
payload.
|
|
5436
|
-
payload.
|
|
5437
|
-
payload.
|
|
5438
|
-
payload.
|
|
5439
|
-
payload.
|
|
5955
|
+
payload.CommandName,
|
|
5956
|
+
payload.ShipKind,
|
|
5957
|
+
payload.Target,
|
|
5958
|
+
payload.ProjectType,
|
|
5959
|
+
payload.ArtifactCorrelationKey ?? payload.PackageVersionKey ?? payload.DeploymentKey ?? payload.SolutionId ?? payload.PackageName ?? ""
|
|
5440
5960
|
].join("|");
|
|
5441
5961
|
}
|
|
5442
5962
|
function withPseudonymizedIdentifiers(payload) {
|
|
5443
5963
|
return {
|
|
5444
5964
|
...payload,
|
|
5445
|
-
...payload.
|
|
5446
|
-
|
|
5965
|
+
...payload.PackageName === undefined ? {} : {
|
|
5966
|
+
PackageName: `package#${pseudonymize(payload.PackageName)}`
|
|
5447
5967
|
},
|
|
5448
|
-
...payload.
|
|
5449
|
-
|
|
5968
|
+
...payload.ArtifactCorrelationKey === undefined ? {} : {
|
|
5969
|
+
ArtifactCorrelationKey: `artifact#${pseudonymize(payload.ArtifactCorrelationKey)}`
|
|
5450
5970
|
}
|
|
5451
5971
|
};
|
|
5452
5972
|
}
|
|
@@ -5462,6 +5982,6 @@ function trackShipSucceeded(payload) {
|
|
|
5462
5982
|
}
|
|
5463
5983
|
// ../common/src/tool-provider.ts
|
|
5464
5984
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
5465
|
-
export { catchError, logger, RESULTS, OutputFormatter, summarizePlatformBody, Option, processContext, stripHostGlobalOptions, createHiddenDeprecatedTenantOption, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, trackShipSucceeded };
|
|
5985
|
+
export { catchError, getOutputSink, logger, getOutputFormat, getOutputFormatExplicit, CommandDimensions, ShipDimensions, RESULTS, OutputFormatter, summarizePlatformBody, Option, processContext, UIPATH_HOME_DIR, stripHostGlobalOptions, createHiddenDeprecatedTenantOption, ScreenLogger, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, trackShipSucceeded };
|
|
5466
5986
|
|
|
5467
|
-
//# debugId=
|
|
5987
|
+
//# debugId=C5A151CD244FD67564756E2164756E21
|