@uipath/common 1.198.0 → 1.199.0-preview.104
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/body-validators.d.ts +41 -0
- package/dist/formatter.d.ts +20 -0
- package/dist/index.browser.js +8 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -1
- package/dist/telemetry/index.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared contract for body-level (post-parse, pre-SDK) validators.
|
|
3
|
+
*
|
|
4
|
+
* Commander option validators live in `option-validators.ts` — those coerce a
|
|
5
|
+
* single raw string at parse time. These body validators run once the command
|
|
6
|
+
* has parsed and merged its inputs into a JS object, and check higher-level
|
|
7
|
+
* rules: name formats, enum blocklists, cross-field invariants, immutable
|
|
8
|
+
* fields, and anything else the SDK / server rejects with a message a user
|
|
9
|
+
* would struggle to act on.
|
|
10
|
+
*
|
|
11
|
+
* Every validator returns `null` on success, or a `ValidationError` the
|
|
12
|
+
* command handler can pass straight to its `fail(msg, instr)` helper. This
|
|
13
|
+
* keeps the contract identical across tools — each tool provides its own set
|
|
14
|
+
* of validator functions and calls `runValidators()` (or the ergonomic
|
|
15
|
+
* `runChecks()`) to run them in order.
|
|
16
|
+
*/
|
|
17
|
+
export interface ValidationError {
|
|
18
|
+
message: string;
|
|
19
|
+
instructions: string;
|
|
20
|
+
}
|
|
21
|
+
export type Validator<T> = (input: T) => ValidationError | null;
|
|
22
|
+
/**
|
|
23
|
+
* Run each validator on the input in order. Returns the first error or `null`
|
|
24
|
+
* if every validator passes. Bind the input by closure or use
|
|
25
|
+
* `runChecks()` when you want a runnable list of independent checks.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runValidators<T>(input: T, validators: Validator<T>[]): ValidationError | null;
|
|
28
|
+
/**
|
|
29
|
+
* Run a list of prebound checks and return the first failing one. Each check
|
|
30
|
+
* is a nullary function so callers can queue heterogeneous validators without
|
|
31
|
+
* threading a shared input type. Use when several validators each read
|
|
32
|
+
* different slices of the command's parsed body:
|
|
33
|
+
*
|
|
34
|
+
* const err = runChecks([
|
|
35
|
+
* () => validateName(name, "entity"),
|
|
36
|
+
* () => findUiBrokenFieldType(fields),
|
|
37
|
+
* () => findInvalidFieldName(fields),
|
|
38
|
+
* ]);
|
|
39
|
+
* if (err) return fail(err.message, err.instructions);
|
|
40
|
+
*/
|
|
41
|
+
export declare function runChecks(checks: Array<() => ValidationError | null>): ValidationError | null;
|
package/dist/formatter.d.ts
CHANGED
|
@@ -110,6 +110,26 @@ export declare class FailureOutput {
|
|
|
110
110
|
constructor(result: FailureResultType, message: string, instructions: string, context?: ErrorContext, errorCode?: CliErrorCode, retry?: RetryHint);
|
|
111
111
|
}
|
|
112
112
|
export type StructuredOutput = SuccessOutput | FailureOutput;
|
|
113
|
+
/**
|
|
114
|
+
* Escape every non-ASCII codepoint in a JSON-encoded string as `\uXXXX`.
|
|
115
|
+
*
|
|
116
|
+
* Why: on Windows, when stdout is piped (not a TTY), Node writes raw UTF-8
|
|
117
|
+
* bytes which PowerShell decodes using `[Console]::OutputEncoding` (cp 437 /
|
|
118
|
+
* Shift_JIS / Windows-1252). Non-ASCII bytes get re-decoded incorrectly,
|
|
119
|
+
* producing mojibake AND structurally invalid JSON (a stray byte from a
|
|
120
|
+
* multi-byte UTF-8 sequence collides with the closing quote). Emitting pure
|
|
121
|
+
* ASCII via `\uXXXX` escapes — valid JSON per the spec — survives every
|
|
122
|
+
* code page intact; `JSON.parse` / `ConvertFrom-Json` etc. all un-escape
|
|
123
|
+
* correctly. Surrogate pairs (non-BMP codepoints) emit two escapes, which
|
|
124
|
+
* JSON parsers reconstruct.
|
|
125
|
+
*
|
|
126
|
+
* Linux and macOS consumers read pipe bytes as UTF-8 by default, so this
|
|
127
|
+
* escape is only applied on Windows (see `needsAsciiSafeJson`).
|
|
128
|
+
*
|
|
129
|
+
* Exported so the host e2e clean-output test can build its expected bytes
|
|
130
|
+
* with the exact same escaping the CLI applies on the wire.
|
|
131
|
+
*/
|
|
132
|
+
export declare function escapeNonAscii(jsonText: string): string;
|
|
113
133
|
/**
|
|
114
134
|
* Check whether `filter` is a syntactically valid JMESPath expression.
|
|
115
135
|
* Returns `null` when valid, otherwise the parser error.
|
package/dist/index.browser.js
CHANGED
|
@@ -21027,6 +21027,7 @@ function resolveEnvReference(value) {
|
|
|
21027
21027
|
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
21028
21028
|
var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
|
|
21029
21029
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
21030
|
+
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
21030
21031
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
21031
21032
|
var NETWORK_ERROR_CODES = new Set([
|
|
21032
21033
|
"ECONNREFUSED",
|
|
@@ -21159,6 +21160,9 @@ function classifyError(status, error) {
|
|
|
21159
21160
|
if (status === 405) {
|
|
21160
21161
|
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
21161
21162
|
}
|
|
21163
|
+
if (status === 413) {
|
|
21164
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
21165
|
+
}
|
|
21162
21166
|
if (status === 408) {
|
|
21163
21167
|
return { errorCode: "timeout", retry: "RetryLater" };
|
|
21164
21168
|
}
|
|
@@ -21236,6 +21240,8 @@ async function extractErrorDetails(error, options) {
|
|
|
21236
21240
|
result = "AuthenticationError";
|
|
21237
21241
|
} else if (status === 405) {
|
|
21238
21242
|
message = DEFAULT_405;
|
|
21243
|
+
} else if (status === 413) {
|
|
21244
|
+
message = DEFAULT_413;
|
|
21239
21245
|
} else if (status === 400 || status === 422) {
|
|
21240
21246
|
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
21241
21247
|
result = "ValidationError";
|
|
@@ -22464,6 +22470,7 @@ var SKILL_ATTRIBUTION = attributionRecord([
|
|
|
22464
22470
|
var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
|
|
22465
22471
|
var COMMAND_ATTRIBUTION = commandAttribution([
|
|
22466
22472
|
["cli", "troubleshoot", ["uip.feedback"]],
|
|
22473
|
+
["llm-gateway", "operate", ["uip.llm-gateway"]],
|
|
22467
22474
|
["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
|
|
22468
22475
|
["context-grounding", "build", ["uip.context-grounding"]],
|
|
22469
22476
|
["api-workflow", "build", ["uip.api-workflow"]],
|
|
@@ -23414,4 +23421,4 @@ export {
|
|
|
23414
23421
|
AUTH_FILENAME
|
|
23415
23422
|
};
|
|
23416
23423
|
|
|
23417
|
-
//# debugId=
|
|
23424
|
+
//# debugId=5714488353CEE82464756E2164756E21
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2998,6 +2998,7 @@ function settlePromiseLike(thenable) {
|
|
|
2998
2998
|
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
2999
2999
|
var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
|
|
3000
3000
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
3001
|
+
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
3001
3002
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
3002
3003
|
var NETWORK_ERROR_CODES = new Set([
|
|
3003
3004
|
"ECONNREFUSED",
|
|
@@ -3130,6 +3131,9 @@ function classifyError(status, error) {
|
|
|
3130
3131
|
if (status === 405) {
|
|
3131
3132
|
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3132
3133
|
}
|
|
3134
|
+
if (status === 413) {
|
|
3135
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3136
|
+
}
|
|
3133
3137
|
if (status === 408) {
|
|
3134
3138
|
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3135
3139
|
}
|
|
@@ -3207,6 +3211,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3207
3211
|
result = "AuthenticationError";
|
|
3208
3212
|
} else if (status === 405) {
|
|
3209
3213
|
message = DEFAULT_405;
|
|
3214
|
+
} else if (status === 413) {
|
|
3215
|
+
message = DEFAULT_413;
|
|
3210
3216
|
} else if (status === 400 || status === 422) {
|
|
3211
3217
|
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
3212
3218
|
result = "ValidationError";
|
|
@@ -3384,6 +3390,23 @@ async function resolveAttachmentInputs(specs, upload) {
|
|
|
3384
3390
|
return { name: p.name, path: p.path, reference };
|
|
3385
3391
|
}));
|
|
3386
3392
|
}
|
|
3393
|
+
// src/body-validators.ts
|
|
3394
|
+
function runValidators(input, validators) {
|
|
3395
|
+
for (const v of validators) {
|
|
3396
|
+
const err = v(input);
|
|
3397
|
+
if (err !== null)
|
|
3398
|
+
return err;
|
|
3399
|
+
}
|
|
3400
|
+
return null;
|
|
3401
|
+
}
|
|
3402
|
+
function runChecks(checks) {
|
|
3403
|
+
for (const check of checks) {
|
|
3404
|
+
const err = check();
|
|
3405
|
+
if (err !== null)
|
|
3406
|
+
return err;
|
|
3407
|
+
}
|
|
3408
|
+
return null;
|
|
3409
|
+
}
|
|
3387
3410
|
// ../../node_modules/commander/esm.mjs
|
|
3388
3411
|
var import__ = __toESM(require_commander(), 1);
|
|
3389
3412
|
var {
|
|
@@ -10950,6 +10973,7 @@ var SKILL_ATTRIBUTION = attributionRecord([
|
|
|
10950
10973
|
var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
|
|
10951
10974
|
var COMMAND_ATTRIBUTION = commandAttribution([
|
|
10952
10975
|
["cli", "troubleshoot", ["uip.feedback"]],
|
|
10976
|
+
["llm-gateway", "operate", ["uip.llm-gateway"]],
|
|
10953
10977
|
["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
|
|
10954
10978
|
["context-grounding", "build", ["uip.context-grounding"]],
|
|
10955
10979
|
["api-workflow", "build", ["uip.api-workflow"]],
|
|
@@ -12319,6 +12343,8 @@ export {
|
|
|
12319
12343
|
setGlobalLogFilePath,
|
|
12320
12344
|
setExecutionContextAuthSignal,
|
|
12321
12345
|
runWithSink,
|
|
12346
|
+
runValidators,
|
|
12347
|
+
runChecks,
|
|
12322
12348
|
restoreConsole,
|
|
12323
12349
|
resolveTelemetrySessionId,
|
|
12324
12350
|
resolveEnvReference,
|
|
@@ -12387,6 +12413,7 @@ export {
|
|
|
12387
12413
|
extractErrorMessage,
|
|
12388
12414
|
extractErrorDetails,
|
|
12389
12415
|
extractCommandHelp,
|
|
12416
|
+
escapeNonAscii,
|
|
12390
12417
|
ensurePackagerFactory,
|
|
12391
12418
|
detectExecutionContext,
|
|
12392
12419
|
detectAgentVersion,
|
|
@@ -12456,4 +12483,4 @@ export {
|
|
|
12456
12483
|
ATTACHMENT_INSTRUCTIONS
|
|
12457
12484
|
};
|
|
12458
12485
|
|
|
12459
|
-
//# debugId=
|
|
12486
|
+
//# debugId=0104AD30EA6F6A7264756E2164756E21
|
package/dist/telemetry/index.js
CHANGED
|
@@ -77,6 +77,7 @@ var SKILL_ATTRIBUTION = attributionRecord([
|
|
|
77
77
|
var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
|
|
78
78
|
var COMMAND_ATTRIBUTION = commandAttribution([
|
|
79
79
|
["cli", "troubleshoot", ["uip.feedback"]],
|
|
80
|
+
["llm-gateway", "operate", ["uip.llm-gateway"]],
|
|
80
81
|
["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
|
|
81
82
|
["context-grounding", "build", ["uip.context-grounding"]],
|
|
82
83
|
["api-workflow", "build", ["uip.api-workflow"]],
|
|
@@ -822,4 +823,4 @@ export {
|
|
|
822
823
|
BrowserContextStorage
|
|
823
824
|
};
|
|
824
825
|
|
|
825
|
-
//# debugId=
|
|
826
|
+
//# debugId=0CFD50D10461DCC664756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/common",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.199.0-preview.104",
|
|
5
5
|
"description": "Common infrastructure needed by uip tools.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"mihaigirleanu",
|
|
68
68
|
"vlad-uipath"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "829a8ab8a25bce5b62c284bd1ddc674d2947f647"
|
|
71
71
|
}
|