@uipath/common 1.204.0 → 1.205.0-preview.256

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 CHANGED
@@ -7562,6 +7562,16 @@ class NodeFileSystem {
7562
7562
  async rename(oldPath, newPath) {
7563
7563
  await fs6.rename(oldPath, newPath);
7564
7564
  }
7565
+ async isSymbolicLink(filePath) {
7566
+ try {
7567
+ return (await fs6.lstat(filePath)).isSymbolicLink();
7568
+ } catch (error) {
7569
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
7570
+ return false;
7571
+ }
7572
+ throw error;
7573
+ }
7574
+ }
7565
7575
  async realpath(filePath) {
7566
7576
  try {
7567
7577
  return await fs6.realpath(filePath);
@@ -8677,7 +8687,7 @@ function getExitCode() {
8677
8687
  return typeof code === "number" ? code : 0;
8678
8688
  }
8679
8689
  function resetExitCode() {
8680
- process.exitCode = undefined;
8690
+ process.exitCode = 0;
8681
8691
  }
8682
8692
 
8683
8693
  // src/output-context.ts
@@ -8732,7 +8742,7 @@ var LogLevel;
8732
8742
  LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
8733
8743
  LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
8734
8744
  })(LogLevel ||= {});
8735
- var DEFAULT_LOG_LEVEL = 3 /* ERROR */;
8745
+ var DEFAULT_LOG_LEVEL = 2 /* WARN */;
8736
8746
 
8737
8747
  class SimpleLogger {
8738
8748
  __brand = "SimpleLogger";
@@ -9051,7 +9061,9 @@ var ErrorDimensions = {
9051
9061
  Result: "Result",
9052
9062
  ErrorCode: "ErrorCode",
9053
9063
  Retry: "Retry",
9054
- ErrorMessage: "ErrorMessage"
9064
+ ErrorMessage: "ErrorMessage",
9065
+ HttpStatus: "HttpStatus",
9066
+ UpstreamErrorCode: "UpstreamErrorCode"
9055
9067
  };
9056
9068
  var AuthDimensions = {
9057
9069
  AuthenticationMethod: "AuthenticationMethod",
@@ -11038,7 +11050,9 @@ var CLI_ERROR_CODES = [
11038
11050
  "timeout",
11039
11051
  "server_error",
11040
11052
  "method_not_allowed",
11053
+ "not_supported",
11041
11054
  "configuration_error",
11055
+ "execution_failed",
11042
11056
  "unknown_error"
11043
11057
  ];
11044
11058
  var RETRY_HINTS = [
@@ -12118,7 +12132,9 @@ var OutputFormatter;
12118
12132
  [ErrorDimensions.Result]: data.Result,
12119
12133
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
12120
12134
  [ErrorDimensions.Retry]: data.Retry,
12121
- [ErrorDimensions.ErrorMessage]: data.Message
12135
+ [ErrorDimensions.ErrorMessage]: data.Message,
12136
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
12137
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
12122
12138
  });
12123
12139
  }
12124
12140
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -12199,6 +12215,16 @@ async function classifiedFailure(message, error) {
12199
12215
  ...details.context ? { Context: details.context } : {}
12200
12216
  };
12201
12217
  }
12218
+ function notSupportedFailure(operation, instructions, context) {
12219
+ return {
12220
+ Result: RESULTS.Failure,
12221
+ ErrorCode: "not_supported",
12222
+ Message: `${operation} isn't supported on the connected environment.`,
12223
+ Instructions: instructions,
12224
+ Retry: "RetryWillNotFix",
12225
+ ...context ? { Context: context } : {}
12226
+ };
12227
+ }
12202
12228
  function summarizePlatformBody(body) {
12203
12229
  const trimmed = body.trim().replace(/\s+/g, " ");
12204
12230
  return trimmed.length > MAX_QUOTED_BODY_CHARS ? `${trimmed.slice(0, MAX_QUOTED_BODY_CHARS)}…` : trimmed;
@@ -12932,6 +12958,106 @@ async function hashContent(content) {
12932
12958
  }
12933
12959
  throw new Error("Unable to compute SHA-256 hash in this environment.");
12934
12960
  }
12961
+ // src/entity-field-rules.ts
12962
+ var MAX_SAFE_NUMERIC_BOUND = 9007199254740991;
12963
+ var LENGTH_LIMIT_RANGES = {
12964
+ STRING: [1, 4000],
12965
+ MULTILINE_TEXT: [1, 1e4],
12966
+ MULTILINE_MAX: [1, 131072]
12967
+ };
12968
+ var MAX_MULTILINE_MAX_FIELDS = 10;
12969
+ function isNumber(v) {
12970
+ return typeof v === "number" && Number.isFinite(v);
12971
+ }
12972
+ function findInvalidFieldConstraints(fields) {
12973
+ for (const f of fields) {
12974
+ if (typeof f !== "object" || f === null)
12975
+ continue;
12976
+ const rec = f;
12977
+ const type2 = rec.type;
12978
+ if (typeof type2 !== "string")
12979
+ continue;
12980
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
12981
+ if (rec.lengthLimit !== undefined) {
12982
+ if (!isNumber(rec.lengthLimit) || !Number.isInteger(rec.lengthLimit)) {
12983
+ return {
12984
+ message: `Field '${fieldName}' 'lengthLimit' must be an integer`,
12985
+ instructions: "Pass a positive integer within the type's range (STRING 1-4000, MULTILINE_TEXT 1-10000, MULTILINE_MAX 1-131072 UTF-16 bytes)."
12986
+ };
12987
+ }
12988
+ const range = LENGTH_LIMIT_RANGES[type2];
12989
+ if (range === undefined) {
12990
+ return {
12991
+ message: `Field '${fieldName}' of type '${type2}' does not accept 'lengthLimit'`,
12992
+ instructions: "'lengthLimit' applies only to STRING, MULTILINE_TEXT, and MULTILINE_MAX. Remove it or change the field type."
12993
+ };
12994
+ }
12995
+ const [min, max] = range;
12996
+ if (rec.lengthLimit < min || rec.lengthLimit > max) {
12997
+ return {
12998
+ message: `Field '${fieldName}' 'lengthLimit' ${rec.lengthLimit} is outside the allowed range for type '${type2}'`,
12999
+ instructions: `'lengthLimit' on '${type2}' must be between ${min} and ${max}. MULTILINE_MAX 'lengthLimit' is a UTF-16 byte budget (≈2 per char).`
13000
+ };
13001
+ }
13002
+ }
13003
+ if (rec.maxValue !== undefined || rec.minValue !== undefined) {
13004
+ if (type2 !== "DECIMAL" && type2 !== "AUTO_NUMBER") {
13005
+ const which = rec.maxValue !== undefined ? "maxValue" : "minValue";
13006
+ return {
13007
+ message: `Field '${fieldName}' of type '${type2}' does not accept '${which}'`,
13008
+ instructions: "'minValue' and 'maxValue' apply only to DECIMAL and AUTO_NUMBER. Remove them or change the field type."
13009
+ };
13010
+ }
13011
+ if (rec.maxValue !== undefined && !isNumber(rec.maxValue)) {
13012
+ return {
13013
+ message: `Field '${fieldName}' 'maxValue' must be a number`,
13014
+ instructions: "Pass a numeric value."
13015
+ };
13016
+ }
13017
+ if (rec.minValue !== undefined && !isNumber(rec.minValue)) {
13018
+ return {
13019
+ message: `Field '${fieldName}' 'minValue' must be a number`,
13020
+ instructions: "Pass a numeric value."
13021
+ };
13022
+ }
13023
+ const maxValue = rec.maxValue;
13024
+ if (maxValue !== undefined && (maxValue > MAX_SAFE_NUMERIC_BOUND || maxValue < -MAX_SAFE_NUMERIC_BOUND)) {
13025
+ return {
13026
+ message: `Field '${fieldName}' 'maxValue' ${rec.maxValue} is outside the supported numeric range`,
13027
+ instructions: `Use a value between ${-MAX_SAFE_NUMERIC_BOUND} and ${MAX_SAFE_NUMERIC_BOUND}.`
13028
+ };
13029
+ }
13030
+ const minValue = rec.minValue;
13031
+ if (minValue !== undefined && (minValue > MAX_SAFE_NUMERIC_BOUND || minValue < -MAX_SAFE_NUMERIC_BOUND)) {
13032
+ return {
13033
+ message: `Field '${fieldName}' 'minValue' ${rec.minValue} is outside the supported numeric range`,
13034
+ instructions: `Use a value between ${-MAX_SAFE_NUMERIC_BOUND} and ${MAX_SAFE_NUMERIC_BOUND}.`
13035
+ };
13036
+ }
13037
+ if (rec.maxValue !== undefined && rec.minValue !== undefined && rec.minValue > rec.maxValue) {
13038
+ return {
13039
+ message: `Field '${fieldName}' 'minValue' (${rec.minValue}) must not exceed 'maxValue' (${rec.maxValue})`,
13040
+ instructions: "Adjust the bounds so 'minValue <= maxValue', or drop one of the two."
13041
+ };
13042
+ }
13043
+ }
13044
+ if (rec.decimalPrecision !== undefined) {
13045
+ if (type2 !== "DECIMAL" && type2 !== "AUTO_NUMBER") {
13046
+ return {
13047
+ message: `Field '${fieldName}' of type '${type2}' does not accept 'decimalPrecision'`,
13048
+ instructions: "'decimalPrecision' applies only to DECIMAL and AUTO_NUMBER. Remove it or change the field type."
13049
+ };
13050
+ }
13051
+ if (!isNumber(rec.decimalPrecision) || !Number.isInteger(rec.decimalPrecision) || rec.decimalPrecision < 0 || rec.decimalPrecision > 10) {
13052
+ return {
13053
+ message: `Field '${fieldName}' 'decimalPrecision' ${rec.decimalPrecision} is invalid`,
13054
+ instructions: "'decimalPrecision' must be an integer between 0 and 10 (0 for whole numbers, 2 for money)."
13055
+ };
13056
+ }
13057
+ }
13058
+ }
13059
+ return null;
13060
+ }
12935
13061
  // src/entity-name-rules.ts
12936
13062
  var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
12937
13063
  var ENTITY_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{2,99}$/;
@@ -13153,19 +13279,22 @@ function findReservedNameError(name, kind) {
13153
13279
  }
13154
13280
  return null;
13155
13281
  }
13282
+ function validateNameFormat(name, kind) {
13283
+ const pattern = kind === "field" ? FIELD_NAME_PATTERN : ENTITY_NAME_PATTERN;
13284
+ if (pattern.test(name)) {
13285
+ return null;
13286
+ }
13287
+ return {
13288
+ message: `Invalid ${kind} name '${name}'`,
13289
+ instructions: kind === "field" ? "Field names must start with a letter, contain only letters and digits (no underscores), and be 3-100 characters long." : "Names must start with a letter, contain only letters, digits, and underscores, and be 3-100 characters long."
13290
+ };
13291
+ }
13156
13292
  function validateName(name, kind) {
13157
13293
  const reserved = findReservedNameError(name, kind);
13158
13294
  if (reserved) {
13159
13295
  return reserved;
13160
13296
  }
13161
- const pattern = kind === "field" ? FIELD_NAME_PATTERN : ENTITY_NAME_PATTERN;
13162
- if (!pattern.test(name)) {
13163
- return {
13164
- message: `Invalid ${kind} name '${name}'`,
13165
- instructions: kind === "field" ? "Field names must start with a letter, contain only letters and digits (no underscores), and be 3-100 characters long." : "Names must start with a letter, contain only letters, digits, and underscores, and be 3-100 characters long."
13166
- };
13167
- }
13168
- return null;
13297
+ return validateNameFormat(name, kind);
13169
13298
  }
13170
13299
  // src/env-reference.ts
13171
13300
  function resolveEnvReference(value) {
@@ -13289,6 +13418,16 @@ function stripHostGlobalOptions(args) {
13289
13418
  }
13290
13419
  return cleaned;
13291
13420
  }
13421
+ // src/http-status.ts
13422
+ function httpStatusOf(error) {
13423
+ if (!error || typeof error !== "object") {
13424
+ return;
13425
+ }
13426
+ if ("response" in error && error.response && typeof error.response === "object" && "status" in error.response && typeof error.response.status === "number") {
13427
+ return error.response.status;
13428
+ }
13429
+ return "status" in error && typeof error.status === "number" ? error.status : undefined;
13430
+ }
13292
13431
  // src/interactivity-context.ts
13293
13432
  var modeSlot = singleton("InteractivityMode");
13294
13433
  var interactiveFlagSlot = singleton("InteractiveFlag");
@@ -13315,6 +13454,52 @@ function canPrompt() {
13315
13454
  const capabilities = getOutputSink().capabilities;
13316
13455
  return capabilities.isInteractive && capabilities.canReadInput;
13317
13456
  }
13457
+ // src/json-option.ts
13458
+ function jsonFileOptionHelp(inlineFlag) {
13459
+ return `Path to a file holding the ${inlineFlag} JSON. Use it on Windows cmd/PowerShell, where quotes inside an inline JSON argument are stripped before the CLI sees them.`;
13460
+ }
13461
+ async function readJsonOption(source) {
13462
+ const read = await readJsonOptionText(source);
13463
+ return read === undefined ? undefined : parseJsonOptionText(read, source);
13464
+ }
13465
+ async function readJsonOptionText(source) {
13466
+ const { inline, file, inlineFlag, fileFlag } = source;
13467
+ if (file !== undefined) {
13468
+ const fs7 = getFileSystem();
13469
+ const bytes = await fs7.readFile(file);
13470
+ if (bytes === null) {
13471
+ throw new Error(`File not found: ${fs7.path.resolve(file)}`);
13472
+ }
13473
+ const text = decodeJsonFile(bytes).trim();
13474
+ if (text === "") {
13475
+ throw new Error(`Expected JSON in ${file} but the file is empty.`);
13476
+ }
13477
+ return { text, origin: "file", label: `${fileFlag} ${file}` };
13478
+ }
13479
+ if (inline === undefined) {
13480
+ return;
13481
+ }
13482
+ return { text: inline, origin: "inline", label: inlineFlag };
13483
+ }
13484
+ function decodeJsonFile(bytes) {
13485
+ const utf16le = bytes[0] === 255 && bytes[1] === 254;
13486
+ return new TextDecoder(utf16le ? "utf-16le" : "utf-8").decode(bytes);
13487
+ }
13488
+ function parseJsonOptionText(read, flags) {
13489
+ try {
13490
+ return JSON.parse(read.text);
13491
+ } catch (err) {
13492
+ const detail = err instanceof Error ? err.message : String(err);
13493
+ const hint = read.origin === "inline" ? windowsJsonHint(flags) : "";
13494
+ throw new Error(`${read.label} is not valid JSON: ${detail}.${hint}`);
13495
+ }
13496
+ }
13497
+ function windowsJsonHint(flags) {
13498
+ if (process.platform !== "win32") {
13499
+ return "";
13500
+ }
13501
+ return ` On Windows cmd/PowerShell, quotes inside an inline JSON argument are stripped and \`& | < > ^\` split the command — pass the file with \`${flags.fileFlag} <path>\` instead.`;
13502
+ }
13318
13503
  // src/mime-types.ts
13319
13504
  var OCTET_STREAM = "application/octet-stream";
13320
13505
  var MIME_TYPES_BY_EXTENSION = Object.freeze({
@@ -13386,6 +13571,35 @@ function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
13386
13571
  getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
13387
13572
  `);
13388
13573
  }
13574
+ function addDeprecatedOptionAlias(command, deprecatedFlags, preferredLong) {
13575
+ const preferred = command.options.find((option) => option.long === preferredLong);
13576
+ if (preferred === undefined) {
13577
+ throw new Error(`${preferredLong} must be registered before its deprecated alias`);
13578
+ }
13579
+ const deprecated = new Option(deprecatedFlags, `Deprecated alias for ${preferredLong}`).hideHelp();
13580
+ const preferredKey = preferred.attributeName();
13581
+ const deprecatedLabel = [deprecated.short, deprecated.long].filter((flag) => flag !== undefined).join("/");
13582
+ let aliasUsed = false;
13583
+ const conflict = () => command.error(`error: option '${deprecated.flags}' cannot be used with option '${preferred.flags}'`, {
13584
+ code: "commander.conflictingOption",
13585
+ exitCode: EXIT_CODES.ValidationError
13586
+ });
13587
+ command.on(`option:${preferred.name()}`, () => {
13588
+ if (aliasUsed)
13589
+ conflict();
13590
+ });
13591
+ command.on(`option:${deprecated.name()}`, (value) => {
13592
+ if (!aliasUsed) {
13593
+ if (command.getOptionValueSource(preferredKey) === "cli") {
13594
+ conflict();
13595
+ }
13596
+ warnDeprecatedOptionAlias(deprecatedLabel, preferredLong);
13597
+ aliasUsed = true;
13598
+ }
13599
+ command.setOptionValueWithSource(preferredKey, value, "cli");
13600
+ });
13601
+ return command.addOption(deprecated);
13602
+ }
13389
13603
  var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
13390
13604
  function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
13391
13605
  return new Option(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
@@ -13401,6 +13615,30 @@ function warnDeprecatedTenantOption(tenant) {
13401
13615
  return;
13402
13616
  warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
13403
13617
  }
13618
+ // src/option-groups.ts
13619
+ function requireOneOfOptions(command, longFlags) {
13620
+ const options = longFlags.map((long) => {
13621
+ const option = command.options.find((o) => o.long === long);
13622
+ if (option === undefined) {
13623
+ throw new Error(`${long} must be registered on '${command.name()}' before requireOneOfOptions`);
13624
+ }
13625
+ return option;
13626
+ });
13627
+ const flags = options.map((option) => `'${option.flags}'`).join(" or ");
13628
+ command.hook("preAction", (thisCommand) => {
13629
+ const given = options.some((option) => {
13630
+ const source = thisCommand.getOptionValueSource(option.attributeName());
13631
+ return source !== undefined && source !== "default";
13632
+ });
13633
+ if (given) {
13634
+ return;
13635
+ }
13636
+ thisCommand.error(`error: required option ${flags} not specified`, {
13637
+ code: "commander.missingMandatoryOptionValue",
13638
+ exitCode: EXIT_CODES.ValidationError
13639
+ });
13640
+ });
13641
+ }
13404
13642
  // src/option-validators.ts
13405
13643
  function parseLimit(raw, _previous) {
13406
13644
  return parseBoundedInt(raw, "--limit", { min: 1, max: 1e4 });
@@ -14136,6 +14374,10 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
14136
14374
  function installSdkCodingAgentHeader(BaseApiClass) {
14137
14375
  installRequestHeaderForwarding(BaseApiClass, codingAgentPatchKey(), (headers) => addSdkCodingAgentHeader(headers));
14138
14376
  }
14377
+ // src/shell-quote.ts
14378
+ function quoteForShell(value) {
14379
+ return `'${value.replace(/'/g, "'\\''")}'`;
14380
+ }
14139
14381
  // src/solution-project-types.ts
14140
14382
  var LIBRARY_NOT_A_PROJECT = "A library cannot be a project inside a solution — it is a reusable .nupkg that other projects consume as a NuGet dependency, not a deployable unit. Build and publish it on its own ('uip rpa pack <project-dir> <output-path>', then 'uip or libraries upload --file <nupkg-path>'), and reference it from a project's dependencies. To make the published library part of this solution, add it as a resource instead: 'uip solution resources add --source remote --kind Library --name <library-name>'.";
14141
14383
  function unsupportedSolutionProjectType(projectType) {
@@ -14336,6 +14578,7 @@ export {
14336
14578
  HOST_GLOBAL_OPTIONS_WITH_VALUE,
14337
14579
  ID_DIMENSIONS,
14338
14580
  LogLevel,
14581
+ MAX_MULTILINE_MAX_FIELDS,
14339
14582
  MAX_SPOOL_AGE_MS,
14340
14583
  MAX_SPOOL_FILES,
14341
14584
  MIME_TYPES_BY_EXTENSION,
@@ -14372,6 +14615,7 @@ export {
14372
14615
  TIMINGS_LINE_PREFIX,
14373
14616
  TelemetryService,
14374
14617
  UIPATH_HOME_DIR,
14618
+ addDeprecatedOptionAlias,
14375
14619
  addHiddenDeprecatedTenantOption,
14376
14620
  addSdkCodingAgentHeader,
14377
14621
  addSdkUserAgentHeader,
@@ -14421,6 +14665,7 @@ export {
14421
14665
  extractErrorMessageSync,
14422
14666
  extractFormatFromArgs,
14423
14667
  extractSingleMessage,
14668
+ findInvalidFieldConstraints,
14424
14669
  findReservedNameError,
14425
14670
  formatErrorChain,
14426
14671
  formatTimingReport,
@@ -14451,6 +14696,7 @@ export {
14451
14696
  getTelemetrySpoolDir,
14452
14697
  getYamlCodec,
14453
14698
  hashContent,
14699
+ httpStatusOf,
14454
14700
  installCommandExtensions,
14455
14701
  installConsoleGuard,
14456
14702
  installSdkCodingAgentHeader,
@@ -14470,6 +14716,7 @@ export {
14470
14716
  isSuccessStatus,
14471
14717
  isTelemetryDisabled,
14472
14718
  isTerminalStatus,
14719
+ jsonFileOptionHelp,
14473
14720
  loadOutputCodecsAsync,
14474
14721
  logger,
14475
14722
  lowercaseIdDimensionValues,
@@ -14483,6 +14730,7 @@ export {
14483
14730
  normalizeBaseUrl,
14484
14731
  normalizeEnvironment,
14485
14732
  normalizeSkillName,
14733
+ notSupportedFailure,
14486
14734
  parseAttachmentSpec,
14487
14735
  parseBoundedInt,
14488
14736
  parseHttpStatusFromMessage,
@@ -14496,7 +14744,9 @@ export {
14496
14744
  previewOnly,
14497
14745
  processContext,
14498
14746
  pseudonymize,
14747
+ quoteForShell,
14499
14748
  readAttachmentSpecs,
14749
+ readJsonOption,
14500
14750
  readRegistryValue,
14501
14751
  readStdin,
14502
14752
  readStdinWithTimeout,
@@ -14513,6 +14763,7 @@ export {
14513
14763
  releaseClaimedSpoolFile,
14514
14764
  releaseSuppliedArgumentValues,
14515
14765
  requireConfirmation,
14766
+ requireOneOfOptions,
14516
14767
  resetExitCode,
14517
14768
  resetInvocationRequest,
14518
14769
  resetLoggerInstance,
@@ -14563,6 +14814,7 @@ export {
14563
14814
  trackShipSucceeded,
14564
14815
  unsupportedSolutionProjectType,
14565
14816
  validateName,
14817
+ validateNameFormat,
14566
14818
  validateOutputFilter,
14567
14819
  warnDeprecatedOptionAlias,
14568
14820
  warnDeprecatedTenantOption,
@@ -14571,4 +14823,4 @@ export {
14571
14823
  writeTelemetrySpoolFile
14572
14824
  };
14573
14825
 
14574
- //# debugId=81872387C795C9BB64756E2164756E21
14826
+ //# debugId=D0B729F2793809D564756E2164756E21
@@ -0,0 +1,21 @@
1
+ /** Help text for the `--x-file <path>` twin of a `--x <json>` option. */
2
+ export declare function jsonFileOptionHelp(inlineFlag: string): string;
3
+ /** The two flags a JSON option can arrive on, as shown in messages. */
4
+ export interface JsonOptionFlags {
5
+ /** Inline flag, e.g. `--updates`. */
6
+ inlineFlag: string;
7
+ /** File flag, e.g. `--updates-file`. */
8
+ fileFlag: string;
9
+ }
10
+ export interface JsonOptionSource extends JsonOptionFlags {
11
+ /** Value of the inline flag. */
12
+ inline?: string;
13
+ /** Value of the file flag. */
14
+ file?: string;
15
+ }
16
+ /**
17
+ * Reads and parses a JSON option given inline or as a file; `undefined` when
18
+ * neither was given. A parse error names the source the user used and, for
19
+ * an inline value on Windows, says why it most likely broke.
20
+ */
21
+ export declare function readJsonOption(source: JsonOptionSource): Promise<unknown>;
package/dist/logger.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare enum LogLevel {
22
22
  WARN = 2,
23
23
  ERROR = 3
24
24
  }
25
- export declare const DEFAULT_LOG_LEVEL = LogLevel.ERROR;
25
+ export declare const DEFAULT_LOG_LEVEL = LogLevel.WARN;
26
26
  export interface LoggerConfig {
27
27
  /** Log level threshold. Messages below this level are suppressed. */
28
28
  level?: LogLevel;
@@ -14,6 +14,7 @@ export declare function resolveDeprecatedOptionAlias<T>({ preferredValue, deprec
14
14
  deprecatedFlag: string;
15
15
  }): OptionAliasResult<T>;
16
16
  export declare function warnDeprecatedOptionAlias(deprecatedFlag: string, preferredFlag: string): void;
17
+ export declare function addDeprecatedOptionAlias<T extends Command>(command: T, deprecatedFlags: string, preferredLong: string): T;
17
18
  export declare function createHiddenDeprecatedTenantOption(flags?: string): Option;
18
19
  export declare function addHiddenDeprecatedTenantOption<T extends Command>(command: T, flags?: string): T;
19
20
  export declare function warnDeprecatedTenantOption(tenant?: string): void;
@@ -0,0 +1,7 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Makes one of several already-registered options required, e.g.
4
+ * `--updates <json>` or `--updates-file <path>`. Fails like Commander's own
5
+ * `requiredOption` (a Commander validation error, exit code 3).
6
+ */
7
+ export declare function requireOneOfOptions(command: Command, longFlags: readonly string[]): void;
@@ -93,7 +93,9 @@ var ErrorDimensions = {
93
93
  Result: "Result",
94
94
  ErrorCode: "ErrorCode",
95
95
  Retry: "Retry",
96
- ErrorMessage: "ErrorMessage"
96
+ ErrorMessage: "ErrorMessage",
97
+ HttpStatus: "HttpStatus",
98
+ UpstreamErrorCode: "UpstreamErrorCode"
97
99
  };
98
100
  var AuthDimensions = {
99
101
  AuthenticationMethod: "AuthenticationMethod",
@@ -285,4 +287,4 @@ export {
285
287
  setSdkUserAgentHostToken
286
288
  };
287
289
 
288
- //# debugId=159182CCF3CDBCFB64756E2164756E21
290
+ //# debugId=3EAF36DA2A24ACC564756E2164756E21
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The kind of identity a call was made as, stamped by whichever SDK built the
3
+ * client that made it.
4
+ *
5
+ * This exists so an error path can say something identity-specific — an
6
+ * external application and a person hit different walls on the same 403 —
7
+ * without re-reading credentials. Reading the session again on a failure path
8
+ * means a file read and possibly a token refresh, which is the last thing a
9
+ * command that is already failing should do.
10
+ *
11
+ * It rides on the response object rather than in a module-level "current
12
+ * session" slot. A client factory takes an `envFilePath`, so one process can
13
+ * hold two clients built from two different credential files with both calls
14
+ * in flight; a single slot would answer with whichever was built last, and the
15
+ * 403 would be told the wrong identity. A response is the one thing the
16
+ * failure and the request that caused it both have — the generated SDK runtime
17
+ * throws `ResponseError`, which keeps the response on `.response`.
18
+ *
19
+ * Deliberately coarse and display-only. It is decoded from *unverified* token
20
+ * claims upstream, so it may never be used for an authorization or trust
21
+ * decision — only to choose what to tell a human.
22
+ *
23
+ * Its own subpath rather than the barrel: the tools that read it mock
24
+ * `@uipath/common` wholesale in their specs, and a barrel import would make
25
+ * every one of those mocks have to know about this.
26
+ */
27
+ export interface SessionKind {
28
+ /** Brand for the duck-type check — each bundle has its own class identity. */
29
+ readonly __brand: "SessionKind";
30
+ /** `Application` covers external apps and S2S; `User` is a person. */
31
+ readonly type: "User" | "Application";
32
+ /** Application identities only. Never set for a user session. */
33
+ readonly clientId?: string;
34
+ /** Application identities only, when the token names its service subtype. */
35
+ readonly applicationSubtype?: "External" | "Internal";
36
+ }
37
+ /**
38
+ * Stamp `carrier` — a `Response`, in practice — with who the call was made as,
39
+ * and return it.
40
+ *
41
+ * Non-enumerable so it stays out of anything that walks or serialises the
42
+ * response, and a no-op for `undefined`: a token the CLI cannot read leaves no
43
+ * stamp, which reads back as "nobody said", not as a stale answer.
44
+ *
45
+ * Clones carry the stamp too. The stamp is a property, so it only survives as
46
+ * far as the object it sits on — and the generated SDK runtime hands every
47
+ * `post` middleware `response.clone()` and keeps whatever that returns
48
+ * (`response = await middleware.post({…, response: response.clone()}) ||
49
+ * response`). A middleware that just passes the response through would
50
+ * therefore replace the stamped response with a bare copy, and the 403 note
51
+ * would stop appearing with nothing to point at why. Wrapping `clone` closes
52
+ * that. A middleware that builds a wholly new `Response` still drops the
53
+ * stamp, which is fine: `nullArrayToEmptyMiddleware`, the only one that does,
54
+ * only does it on a `200`.
55
+ */
56
+ export declare function attachSessionKind<T extends object>(carrier: T, kind: {
57
+ type: "User" | "Application";
58
+ clientId?: string;
59
+ applicationSubtype?: "External" | "Internal";
60
+ } | undefined): T;
61
+ /** The kind stamped on `carrier`, or `undefined` when nothing stamped it. */
62
+ export declare function readSessionKind(carrier: unknown): SessionKind | undefined;
63
+ /**
64
+ * The kind stamped on any response reachable from `error`.
65
+ *
66
+ * The stamp sits on `ResponseError.response`, but resolvers and command
67
+ * helpers wrap an SDK error as `new Error(…, { cause: err })`, which pushes
68
+ * that response one or more levels down — the same reason
69
+ * `extractErrorDetails` walks the graph to find the HTTP status. Bounded and
70
+ * cycle-guarded for the same reason it is there: 32 steps is far more than any
71
+ * real failure nests.
72
+ */
73
+ export declare function findSessionKind(error: unknown): SessionKind | undefined;
@@ -0,0 +1,66 @@
1
+ // src/session-kind.ts
2
+ var SESSION_KIND_KEY = Symbol.for("@uipath/common/SessionKind");
3
+ var isSessionKind = (value) => typeof value === "object" && value !== null && value.__brand === "SessionKind" && (value.type === "User" || value.type === "Application") && (value.applicationSubtype === undefined || value.applicationSubtype === "External" || value.applicationSubtype === "Internal");
4
+ function attachSessionKind(carrier, kind) {
5
+ if (!kind)
6
+ return carrier;
7
+ Object.defineProperty(carrier, SESSION_KIND_KEY, {
8
+ value: {
9
+ __brand: "SessionKind",
10
+ type: kind.type,
11
+ ...kind.clientId ? { clientId: kind.clientId } : {},
12
+ ...kind.applicationSubtype ? { applicationSubtype: kind.applicationSubtype } : {}
13
+ },
14
+ enumerable: false,
15
+ configurable: true
16
+ });
17
+ const clone = carrier.clone;
18
+ if (typeof clone === "function") {
19
+ Object.defineProperty(carrier, "clone", {
20
+ value: function stampedClone(...args) {
21
+ const copy = clone.apply(this, args);
22
+ return typeof copy === "object" && copy !== null ? attachSessionKind(copy, kind) : copy;
23
+ },
24
+ enumerable: false,
25
+ configurable: true,
26
+ writable: true
27
+ });
28
+ }
29
+ return carrier;
30
+ }
31
+ function readSessionKind(carrier) {
32
+ if (typeof carrier !== "object" || carrier === null)
33
+ return;
34
+ const value = carrier[SESSION_KIND_KEY];
35
+ return isSessionKind(value) ? value : undefined;
36
+ }
37
+ function findSessionKind(error) {
38
+ const queue = [error];
39
+ const seen = new Set;
40
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
41
+ const current = queue.shift();
42
+ if (current === null || typeof current !== "object")
43
+ continue;
44
+ if (seen.has(current))
45
+ continue;
46
+ seen.add(current);
47
+ const kind = readSessionKind(current);
48
+ if (kind)
49
+ return kind;
50
+ const node = current;
51
+ if (node.response !== undefined)
52
+ queue.push(node.response);
53
+ if (node.cause !== undefined)
54
+ queue.push(node.cause);
55
+ if (Array.isArray(node.errors))
56
+ queue.push(...node.errors);
57
+ }
58
+ return;
59
+ }
60
+ export {
61
+ attachSessionKind,
62
+ findSessionKind,
63
+ readSessionKind
64
+ };
65
+
66
+ //# debugId=FB9F7D3939F7B98064756E2164756E21
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A value as one argument in a command the CLI *suggests* — a path or a name a user
3
+ * (or a coding agent) pastes into PowerShell or a POSIX shell.
4
+ *
5
+ * Single quotes only: neither shell evaluates anything inside them, so a value
6
+ * carrying `$(…)`, a backtick, `;` or `"` stays a value. Double quotes would not do —
7
+ * both shells expand `$(…)` inside them. An apostrophe uses the POSIX
8
+ * close-and-reopen escape, `'\''`; PowerShell reads that as a parse error rather
9
+ * than running anything, which is the acceptable failure for a value that rare.
10
+ *
11
+ * Shared by every tool that prints a command to run next; tools must not import
12
+ * each other (Hard Rule #19), so it lives here.
13
+ */
14
+ export declare function quoteForShell(value: string): string;
@@ -18218,7 +18218,9 @@ var ErrorDimensions = {
18218
18218
  Result: "Result",
18219
18219
  ErrorCode: "ErrorCode",
18220
18220
  Retry: "Retry",
18221
- ErrorMessage: "ErrorMessage"
18221
+ ErrorMessage: "ErrorMessage",
18222
+ HttpStatus: "HttpStatus",
18223
+ UpstreamErrorCode: "UpstreamErrorCode"
18222
18224
  };
18223
18225
  var AuthDimensions = {
18224
18226
  AuthenticationMethod: "AuthenticationMethod",
@@ -19536,4 +19538,4 @@ export {
19536
19538
  setExecutionContextAuthSignal
19537
19539
  };
19538
19540
 
19539
- //# debugId=BDA42066E582C0DA64756E2164756E21
19541
+ //# debugId=CACDC97A1D5CE15C64756E2164756E21