@uipath/solution-sdk 1.202.1-preview.220 → 1.202.1-preview.239
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 +225 -8
- package/dist/resources/index.js +224 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8021,7 +8021,7 @@ class TextApiResponse {
|
|
|
8021
8021
|
var package_default = {
|
|
8022
8022
|
name: "@uipath/solution-sdk",
|
|
8023
8023
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
8024
|
-
version: "1.202.1-preview.
|
|
8024
|
+
version: "1.202.1-preview.239",
|
|
8025
8025
|
repository: {
|
|
8026
8026
|
type: "git",
|
|
8027
8027
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -14254,7 +14254,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
14254
14254
|
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).";
|
|
14255
14255
|
}
|
|
14256
14256
|
}
|
|
14257
|
-
function
|
|
14257
|
+
function countRecords(data) {
|
|
14258
|
+
if (Array.isArray(data))
|
|
14259
|
+
return data.length;
|
|
14260
|
+
return data == null ? 0 : 1;
|
|
14261
|
+
}
|
|
14262
|
+
function availableFields(data) {
|
|
14263
|
+
const records = Array.isArray(data) ? data : [data];
|
|
14264
|
+
const keys = new Set;
|
|
14265
|
+
for (const record of records) {
|
|
14266
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
14267
|
+
for (const key of Object.keys(record))
|
|
14268
|
+
keys.add(key);
|
|
14269
|
+
}
|
|
14270
|
+
}
|
|
14271
|
+
return [...keys];
|
|
14272
|
+
}
|
|
14273
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
14274
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
14275
|
+
if (!error && typeof decoded === "string")
|
|
14276
|
+
return decoded;
|
|
14277
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
14278
|
+
}
|
|
14279
|
+
function referencedFields(filter) {
|
|
14280
|
+
const top = new Set;
|
|
14281
|
+
const nested = new Set;
|
|
14282
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
14283
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
14284
|
+
const quoted = [];
|
|
14285
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
14286
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
14287
|
+
if (!isAlias) {
|
|
14288
|
+
quoted.push({
|
|
14289
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
14290
|
+
index,
|
|
14291
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
14292
|
+
});
|
|
14293
|
+
}
|
|
14294
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
14295
|
+
});
|
|
14296
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
14297
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
14298
|
+
const place = (name, index, tail) => {
|
|
14299
|
+
if (tail || index >= rootEnd)
|
|
14300
|
+
nested.add(name);
|
|
14301
|
+
else
|
|
14302
|
+
top.add(name);
|
|
14303
|
+
};
|
|
14304
|
+
for (const entry of quoted)
|
|
14305
|
+
place(entry.name, entry.index, entry.tail);
|
|
14306
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
14307
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
14308
|
+
for (const match of identifiers) {
|
|
14309
|
+
const [, name, trailing] = match;
|
|
14310
|
+
if (trailing || reserved.has(name))
|
|
14311
|
+
continue;
|
|
14312
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
14313
|
+
}
|
|
14314
|
+
return {
|
|
14315
|
+
top: [...top],
|
|
14316
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
14317
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
14318
|
+
};
|
|
14319
|
+
}
|
|
14320
|
+
function appearsBelowTopLevel(data, name) {
|
|
14321
|
+
let budget = 2000;
|
|
14322
|
+
const visit = (value, depth) => {
|
|
14323
|
+
if (budget-- <= 0 || depth > 4)
|
|
14324
|
+
return false;
|
|
14325
|
+
if (value === null || typeof value !== "object")
|
|
14326
|
+
return false;
|
|
14327
|
+
if (Array.isArray(value))
|
|
14328
|
+
return value.some((entry) => visit(entry, depth));
|
|
14329
|
+
const record = value;
|
|
14330
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
14331
|
+
return true;
|
|
14332
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
14333
|
+
};
|
|
14334
|
+
return visit(data, 0);
|
|
14335
|
+
}
|
|
14336
|
+
function alwaysNullKeys(records) {
|
|
14337
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
14338
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
14339
|
+
return [];
|
|
14340
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
14341
|
+
if (keys.length === 0)
|
|
14342
|
+
return [];
|
|
14343
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
14344
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
14345
|
+
}
|
|
14346
|
+
function carriesOnlyNulls(value) {
|
|
14347
|
+
if (value === null)
|
|
14348
|
+
return true;
|
|
14349
|
+
if (Array.isArray(value)) {
|
|
14350
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
14351
|
+
}
|
|
14352
|
+
if (typeof value === "object" && value !== undefined) {
|
|
14353
|
+
const values = Object.values(value);
|
|
14354
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
14355
|
+
}
|
|
14356
|
+
return false;
|
|
14357
|
+
}
|
|
14358
|
+
function nameList(names, cap2 = 12) {
|
|
14359
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
14360
|
+
const rest = names.length - shown.length;
|
|
14361
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
14362
|
+
}
|
|
14363
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
14364
|
+
const present = availableFields(data);
|
|
14365
|
+
const refs = referencedFields(filter);
|
|
14366
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
14367
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
14368
|
+
const count = countRecords(data);
|
|
14369
|
+
const scope = `${count} record(s)`;
|
|
14370
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
14371
|
+
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" : "";
|
|
14372
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
14373
|
+
let detail;
|
|
14374
|
+
let lede;
|
|
14375
|
+
if (outcome.kind === "null-elements") {
|
|
14376
|
+
lede = "returned only null values";
|
|
14377
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
14378
|
+
if (unknown.length > 0) {
|
|
14379
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
14380
|
+
} else if (unchecked.length > 0) {
|
|
14381
|
+
detail = withSoundness(projected);
|
|
14382
|
+
} else {
|
|
14383
|
+
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`;
|
|
14384
|
+
}
|
|
14385
|
+
} else if (outcome.kind === "null-rows") {
|
|
14386
|
+
lede = "returned only null values";
|
|
14387
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
14388
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
14389
|
+
} else if (outcome.kind === "null-values") {
|
|
14390
|
+
lede = "returned only null values";
|
|
14391
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
14392
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
14393
|
+
if (sameSet) {
|
|
14394
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
14395
|
+
} else if (unknown.length > 0) {
|
|
14396
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
14397
|
+
} else {
|
|
14398
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
14399
|
+
}
|
|
14400
|
+
} else {
|
|
14401
|
+
lede = "returned nothing";
|
|
14402
|
+
if (unknown.length > 0) {
|
|
14403
|
+
detail = isNotAField(unknown);
|
|
14404
|
+
} else {
|
|
14405
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
14406
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
14407
|
+
}
|
|
14408
|
+
}
|
|
14409
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
14410
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
14411
|
+
}
|
|
14412
|
+
function appendWarning(existing, note) {
|
|
14413
|
+
return existing ? `${existing} ${note}` : note;
|
|
14414
|
+
}
|
|
14415
|
+
function applyFilter(data, filter, onWarning) {
|
|
14258
14416
|
const codec = requireJmespath();
|
|
14259
14417
|
let result;
|
|
14260
14418
|
try {
|
|
@@ -14262,9 +14420,34 @@ function applyFilter(data, filter) {
|
|
|
14262
14420
|
} catch (err) {
|
|
14263
14421
|
throw new FilterEvaluationError(filter, err);
|
|
14264
14422
|
}
|
|
14265
|
-
|
|
14423
|
+
const inputCount = countRecords(data);
|
|
14424
|
+
const warn = (outcome) => {
|
|
14425
|
+
if (inputCount === 0)
|
|
14426
|
+
return;
|
|
14427
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
14428
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
14429
|
+
`);
|
|
14430
|
+
onWarning?.(note);
|
|
14431
|
+
};
|
|
14432
|
+
const warnIfAllNull = (records) => {
|
|
14433
|
+
const keys = alwaysNullKeys(records);
|
|
14434
|
+
if (keys.length > 0)
|
|
14435
|
+
warn({ kind: "null-values", keys });
|
|
14436
|
+
};
|
|
14437
|
+
if (result == null) {
|
|
14438
|
+
warn({ kind: "empty" });
|
|
14266
14439
|
return [];
|
|
14440
|
+
}
|
|
14267
14441
|
if (Array.isArray(result)) {
|
|
14442
|
+
if (result.length === 0) {
|
|
14443
|
+
warn({ kind: "empty" });
|
|
14444
|
+
} else if (result.every((entry) => entry === null)) {
|
|
14445
|
+
warn({ kind: "null-elements", count: result.length });
|
|
14446
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
14447
|
+
warn({ kind: "null-rows", count: result.length });
|
|
14448
|
+
} else {
|
|
14449
|
+
warnIfAllNull(result);
|
|
14450
|
+
}
|
|
14268
14451
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
14269
14452
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
14270
14453
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -14272,10 +14455,30 @@ function applyFilter(data, filter) {
|
|
|
14272
14455
|
}
|
|
14273
14456
|
return result;
|
|
14274
14457
|
}
|
|
14275
|
-
if (typeof result === "object")
|
|
14458
|
+
if (typeof result === "object") {
|
|
14459
|
+
warnIfAllNull([result]);
|
|
14276
14460
|
return result;
|
|
14461
|
+
}
|
|
14277
14462
|
return { Value: result };
|
|
14278
14463
|
}
|
|
14464
|
+
function filterFailureData(envelope) {
|
|
14465
|
+
const filter = getOutputFilter();
|
|
14466
|
+
const data = envelope.Data;
|
|
14467
|
+
if (!filter || data == null)
|
|
14468
|
+
return;
|
|
14469
|
+
let note;
|
|
14470
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
14471
|
+
note = n;
|
|
14472
|
+
}));
|
|
14473
|
+
if (filterError) {
|
|
14474
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
14475
|
+
return;
|
|
14476
|
+
}
|
|
14477
|
+
envelope.Data = filtered;
|
|
14478
|
+
if (note) {
|
|
14479
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
14480
|
+
}
|
|
14481
|
+
}
|
|
14279
14482
|
function defaultErrorCodeForResult(result) {
|
|
14280
14483
|
switch (result) {
|
|
14281
14484
|
case RESULTS.AuthenticationError:
|
|
@@ -14358,8 +14561,14 @@ var OutputFormatter;
|
|
|
14358
14561
|
}
|
|
14359
14562
|
const filter = getOutputFilter();
|
|
14360
14563
|
if (filter) {
|
|
14361
|
-
|
|
14564
|
+
let note;
|
|
14565
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
14566
|
+
note = n;
|
|
14567
|
+
});
|
|
14362
14568
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
14569
|
+
if (note) {
|
|
14570
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
14571
|
+
}
|
|
14363
14572
|
}
|
|
14364
14573
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
14365
14574
|
}
|
|
@@ -14387,6 +14596,7 @@ var OutputFormatter;
|
|
|
14387
14596
|
delete envelope.TelemetryErrorClass;
|
|
14388
14597
|
delete envelope.TelemetryTerminalOutcome;
|
|
14389
14598
|
delete envelope.TelemetryTerminalSignal;
|
|
14599
|
+
filterFailureData(envelope);
|
|
14390
14600
|
if (!suppressTelemetry) {
|
|
14391
14601
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
14392
14602
|
result: data.Result,
|
|
@@ -14435,13 +14645,20 @@ var OutputFormatter;
|
|
|
14435
14645
|
OutputFormatter.log = log;
|
|
14436
14646
|
function formatToString(data) {
|
|
14437
14647
|
const filter = getOutputFilter();
|
|
14648
|
+
const envelope = data;
|
|
14438
14649
|
if ("Data" in data && data.Data != null) {
|
|
14439
14650
|
data.Data = normalizeDataKeys(data.Data);
|
|
14440
14651
|
if (filter) {
|
|
14441
|
-
|
|
14652
|
+
let note;
|
|
14653
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
14654
|
+
note = n;
|
|
14655
|
+
}));
|
|
14656
|
+
if (note) {
|
|
14657
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
14658
|
+
}
|
|
14442
14659
|
}
|
|
14443
14660
|
}
|
|
14444
|
-
const output = normalizeOutputKeys(
|
|
14661
|
+
const output = normalizeOutputKeys(envelope);
|
|
14445
14662
|
const lines = [];
|
|
14446
14663
|
const sink = getOutputSink();
|
|
14447
14664
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -17444,4 +17661,4 @@ export {
|
|
|
17444
17661
|
uploadOrOverwriteSolution
|
|
17445
17662
|
};
|
|
17446
17663
|
|
|
17447
|
-
//# debugId=
|
|
17664
|
+
//# debugId=9230DF80B0943C9E64756E2164756E21
|
package/dist/resources/index.js
CHANGED
|
@@ -13782,7 +13782,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
13782
13782
|
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).";
|
|
13783
13783
|
}
|
|
13784
13784
|
}
|
|
13785
|
-
function
|
|
13785
|
+
function countRecords(data) {
|
|
13786
|
+
if (Array.isArray(data))
|
|
13787
|
+
return data.length;
|
|
13788
|
+
return data == null ? 0 : 1;
|
|
13789
|
+
}
|
|
13790
|
+
function availableFields(data) {
|
|
13791
|
+
const records = Array.isArray(data) ? data : [data];
|
|
13792
|
+
const keys = new Set;
|
|
13793
|
+
for (const record of records) {
|
|
13794
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
13795
|
+
for (const key of Object.keys(record))
|
|
13796
|
+
keys.add(key);
|
|
13797
|
+
}
|
|
13798
|
+
}
|
|
13799
|
+
return [...keys];
|
|
13800
|
+
}
|
|
13801
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
13802
|
+
const [error, decoded] = catchError2(() => JSON.parse(whole));
|
|
13803
|
+
if (!error && typeof decoded === "string")
|
|
13804
|
+
return decoded;
|
|
13805
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
13806
|
+
}
|
|
13807
|
+
function referencedFields(filter) {
|
|
13808
|
+
const top = new Set;
|
|
13809
|
+
const nested = new Set;
|
|
13810
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
13811
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
13812
|
+
const quoted = [];
|
|
13813
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
13814
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
13815
|
+
if (!isAlias) {
|
|
13816
|
+
quoted.push({
|
|
13817
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
13818
|
+
index,
|
|
13819
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
13820
|
+
});
|
|
13821
|
+
}
|
|
13822
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
13823
|
+
});
|
|
13824
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
13825
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
13826
|
+
const place = (name, index, tail) => {
|
|
13827
|
+
if (tail || index >= rootEnd)
|
|
13828
|
+
nested.add(name);
|
|
13829
|
+
else
|
|
13830
|
+
top.add(name);
|
|
13831
|
+
};
|
|
13832
|
+
for (const entry of quoted)
|
|
13833
|
+
place(entry.name, entry.index, entry.tail);
|
|
13834
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
13835
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
13836
|
+
for (const match of identifiers) {
|
|
13837
|
+
const [, name, trailing] = match;
|
|
13838
|
+
if (trailing || reserved.has(name))
|
|
13839
|
+
continue;
|
|
13840
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
13841
|
+
}
|
|
13842
|
+
return {
|
|
13843
|
+
top: [...top],
|
|
13844
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
13845
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
13846
|
+
};
|
|
13847
|
+
}
|
|
13848
|
+
function appearsBelowTopLevel(data, name) {
|
|
13849
|
+
let budget = 2000;
|
|
13850
|
+
const visit = (value, depth) => {
|
|
13851
|
+
if (budget-- <= 0 || depth > 4)
|
|
13852
|
+
return false;
|
|
13853
|
+
if (value === null || typeof value !== "object")
|
|
13854
|
+
return false;
|
|
13855
|
+
if (Array.isArray(value))
|
|
13856
|
+
return value.some((entry) => visit(entry, depth));
|
|
13857
|
+
const record = value;
|
|
13858
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
13859
|
+
return true;
|
|
13860
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
13861
|
+
};
|
|
13862
|
+
return visit(data, 0);
|
|
13863
|
+
}
|
|
13864
|
+
function alwaysNullKeys(records) {
|
|
13865
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
13866
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
13867
|
+
return [];
|
|
13868
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
13869
|
+
if (keys.length === 0)
|
|
13870
|
+
return [];
|
|
13871
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
13872
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
13873
|
+
}
|
|
13874
|
+
function carriesOnlyNulls(value) {
|
|
13875
|
+
if (value === null)
|
|
13876
|
+
return true;
|
|
13877
|
+
if (Array.isArray(value)) {
|
|
13878
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
13879
|
+
}
|
|
13880
|
+
if (typeof value === "object" && value !== undefined) {
|
|
13881
|
+
const values = Object.values(value);
|
|
13882
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
13883
|
+
}
|
|
13884
|
+
return false;
|
|
13885
|
+
}
|
|
13886
|
+
function nameList(names, cap2 = 12) {
|
|
13887
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
13888
|
+
const rest = names.length - shown.length;
|
|
13889
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
13890
|
+
}
|
|
13891
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
13892
|
+
const present = availableFields(data);
|
|
13893
|
+
const refs = referencedFields(filter);
|
|
13894
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
13895
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
13896
|
+
const count = countRecords(data);
|
|
13897
|
+
const scope = `${count} record(s)`;
|
|
13898
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
13899
|
+
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" : "";
|
|
13900
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
13901
|
+
let detail;
|
|
13902
|
+
let lede;
|
|
13903
|
+
if (outcome.kind === "null-elements") {
|
|
13904
|
+
lede = "returned only null values";
|
|
13905
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
13906
|
+
if (unknown.length > 0) {
|
|
13907
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
13908
|
+
} else if (unchecked.length > 0) {
|
|
13909
|
+
detail = withSoundness(projected);
|
|
13910
|
+
} else {
|
|
13911
|
+
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`;
|
|
13912
|
+
}
|
|
13913
|
+
} else if (outcome.kind === "null-rows") {
|
|
13914
|
+
lede = "returned only null values";
|
|
13915
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
13916
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
13917
|
+
} else if (outcome.kind === "null-values") {
|
|
13918
|
+
lede = "returned only null values";
|
|
13919
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
13920
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
13921
|
+
if (sameSet) {
|
|
13922
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
13923
|
+
} else if (unknown.length > 0) {
|
|
13924
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
13925
|
+
} else {
|
|
13926
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
13927
|
+
}
|
|
13928
|
+
} else {
|
|
13929
|
+
lede = "returned nothing";
|
|
13930
|
+
if (unknown.length > 0) {
|
|
13931
|
+
detail = isNotAField(unknown);
|
|
13932
|
+
} else {
|
|
13933
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
13934
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13937
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
13938
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
13939
|
+
}
|
|
13940
|
+
function appendWarning(existing, note) {
|
|
13941
|
+
return existing ? `${existing} ${note}` : note;
|
|
13942
|
+
}
|
|
13943
|
+
function applyFilter(data, filter, onWarning) {
|
|
13786
13944
|
const codec = requireJmespath();
|
|
13787
13945
|
let result;
|
|
13788
13946
|
try {
|
|
@@ -13790,9 +13948,34 @@ function applyFilter(data, filter) {
|
|
|
13790
13948
|
} catch (err) {
|
|
13791
13949
|
throw new FilterEvaluationError(filter, err);
|
|
13792
13950
|
}
|
|
13793
|
-
|
|
13951
|
+
const inputCount = countRecords(data);
|
|
13952
|
+
const warn = (outcome) => {
|
|
13953
|
+
if (inputCount === 0)
|
|
13954
|
+
return;
|
|
13955
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
13956
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
13957
|
+
`);
|
|
13958
|
+
onWarning?.(note);
|
|
13959
|
+
};
|
|
13960
|
+
const warnIfAllNull = (records) => {
|
|
13961
|
+
const keys = alwaysNullKeys(records);
|
|
13962
|
+
if (keys.length > 0)
|
|
13963
|
+
warn({ kind: "null-values", keys });
|
|
13964
|
+
};
|
|
13965
|
+
if (result == null) {
|
|
13966
|
+
warn({ kind: "empty" });
|
|
13794
13967
|
return [];
|
|
13968
|
+
}
|
|
13795
13969
|
if (Array.isArray(result)) {
|
|
13970
|
+
if (result.length === 0) {
|
|
13971
|
+
warn({ kind: "empty" });
|
|
13972
|
+
} else if (result.every((entry) => entry === null)) {
|
|
13973
|
+
warn({ kind: "null-elements", count: result.length });
|
|
13974
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
13975
|
+
warn({ kind: "null-rows", count: result.length });
|
|
13976
|
+
} else {
|
|
13977
|
+
warnIfAllNull(result);
|
|
13978
|
+
}
|
|
13796
13979
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
13797
13980
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
13798
13981
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -13800,10 +13983,30 @@ function applyFilter(data, filter) {
|
|
|
13800
13983
|
}
|
|
13801
13984
|
return result;
|
|
13802
13985
|
}
|
|
13803
|
-
if (typeof result === "object")
|
|
13986
|
+
if (typeof result === "object") {
|
|
13987
|
+
warnIfAllNull([result]);
|
|
13804
13988
|
return result;
|
|
13989
|
+
}
|
|
13805
13990
|
return { Value: result };
|
|
13806
13991
|
}
|
|
13992
|
+
function filterFailureData(envelope) {
|
|
13993
|
+
const filter = getOutputFilter();
|
|
13994
|
+
const data = envelope.Data;
|
|
13995
|
+
if (!filter || data == null)
|
|
13996
|
+
return;
|
|
13997
|
+
let note;
|
|
13998
|
+
const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
|
|
13999
|
+
note = n;
|
|
14000
|
+
}));
|
|
14001
|
+
if (filterError) {
|
|
14002
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
14003
|
+
return;
|
|
14004
|
+
}
|
|
14005
|
+
envelope.Data = filtered;
|
|
14006
|
+
if (note) {
|
|
14007
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
14008
|
+
}
|
|
14009
|
+
}
|
|
13807
14010
|
function defaultErrorCodeForResult(result) {
|
|
13808
14011
|
switch (result) {
|
|
13809
14012
|
case RESULTS.AuthenticationError:
|
|
@@ -13886,8 +14089,14 @@ var OutputFormatter;
|
|
|
13886
14089
|
}
|
|
13887
14090
|
const filter = getOutputFilter();
|
|
13888
14091
|
if (filter) {
|
|
13889
|
-
|
|
14092
|
+
let note;
|
|
14093
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
14094
|
+
note = n;
|
|
14095
|
+
});
|
|
13890
14096
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
14097
|
+
if (note) {
|
|
14098
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
14099
|
+
}
|
|
13891
14100
|
}
|
|
13892
14101
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
13893
14102
|
}
|
|
@@ -13915,6 +14124,7 @@ var OutputFormatter;
|
|
|
13915
14124
|
delete envelope.TelemetryErrorClass;
|
|
13916
14125
|
delete envelope.TelemetryTerminalOutcome;
|
|
13917
14126
|
delete envelope.TelemetryTerminalSignal;
|
|
14127
|
+
filterFailureData(envelope);
|
|
13918
14128
|
if (!suppressTelemetry) {
|
|
13919
14129
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
13920
14130
|
result: data.Result,
|
|
@@ -13963,13 +14173,20 @@ var OutputFormatter;
|
|
|
13963
14173
|
OutputFormatter.log = log;
|
|
13964
14174
|
function formatToString(data) {
|
|
13965
14175
|
const filter = getOutputFilter();
|
|
14176
|
+
const envelope = data;
|
|
13966
14177
|
if ("Data" in data && data.Data != null) {
|
|
13967
14178
|
data.Data = normalizeDataKeys(data.Data);
|
|
13968
14179
|
if (filter) {
|
|
13969
|
-
|
|
14180
|
+
let note;
|
|
14181
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
14182
|
+
note = n;
|
|
14183
|
+
}));
|
|
14184
|
+
if (note) {
|
|
14185
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
14186
|
+
}
|
|
13970
14187
|
}
|
|
13971
14188
|
}
|
|
13972
|
-
const output = normalizeOutputKeys(
|
|
14189
|
+
const output = normalizeOutputKeys(envelope);
|
|
13973
14190
|
const lines = [];
|
|
13974
14191
|
const sink = getOutputSink();
|
|
13975
14192
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -32869,4 +33086,4 @@ export {
|
|
|
32869
33086
|
writeSolutionFile
|
|
32870
33087
|
};
|
|
32871
33088
|
|
|
32872
|
-
//# debugId=
|
|
33089
|
+
//# debugId=B3539FCC94D98B2364756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/solution-sdk",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "1.202.1-preview.
|
|
4
|
+
"version": "1.202.1-preview.239",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/UiPath/cli.git",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"private": false,
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "97545a7857bdff7e6db62bbe13c6097607cf38f1"
|
|
43
43
|
}
|