@uipath/data-fabric-tool 1.202.1-preview.220 → 1.202.1-preview.238
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
|
@@ -6583,7 +6583,7 @@ var require_src6 = __commonJS(function(exports) {
|
|
|
6583
6583
|
var package_default = {
|
|
6584
6584
|
name: "@uipath/data-fabric-tool",
|
|
6585
6585
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6586
|
-
version: "1.202.1-preview.
|
|
6586
|
+
version: "1.202.1-preview.238",
|
|
6587
6587
|
description: "Manage Data Fabric entities and records.",
|
|
6588
6588
|
publishConfig: {
|
|
6589
6589
|
registry: "https://npm.pkg.github.com/"
|
|
@@ -9278,7 +9278,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
9278
9278
|
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).";
|
|
9279
9279
|
}
|
|
9280
9280
|
}
|
|
9281
|
-
function
|
|
9281
|
+
function countRecords(data) {
|
|
9282
|
+
if (Array.isArray(data))
|
|
9283
|
+
return data.length;
|
|
9284
|
+
return data == null ? 0 : 1;
|
|
9285
|
+
}
|
|
9286
|
+
function availableFields(data) {
|
|
9287
|
+
const records = Array.isArray(data) ? data : [data];
|
|
9288
|
+
const keys = new Set;
|
|
9289
|
+
for (const record of records) {
|
|
9290
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
9291
|
+
for (const key of Object.keys(record))
|
|
9292
|
+
keys.add(key);
|
|
9293
|
+
}
|
|
9294
|
+
}
|
|
9295
|
+
return [...keys];
|
|
9296
|
+
}
|
|
9297
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
9298
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
9299
|
+
if (!error && typeof decoded === "string")
|
|
9300
|
+
return decoded;
|
|
9301
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
9302
|
+
}
|
|
9303
|
+
function referencedFields(filter) {
|
|
9304
|
+
const top = new Set;
|
|
9305
|
+
const nested = new Set;
|
|
9306
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
9307
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
9308
|
+
const quoted = [];
|
|
9309
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
9310
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
9311
|
+
if (!isAlias) {
|
|
9312
|
+
quoted.push({
|
|
9313
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
9314
|
+
index,
|
|
9315
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
9316
|
+
});
|
|
9317
|
+
}
|
|
9318
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
9319
|
+
});
|
|
9320
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
9321
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
9322
|
+
const place = (name, index, tail) => {
|
|
9323
|
+
if (tail || index >= rootEnd)
|
|
9324
|
+
nested.add(name);
|
|
9325
|
+
else
|
|
9326
|
+
top.add(name);
|
|
9327
|
+
};
|
|
9328
|
+
for (const entry of quoted)
|
|
9329
|
+
place(entry.name, entry.index, entry.tail);
|
|
9330
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
9331
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
9332
|
+
for (const match of identifiers) {
|
|
9333
|
+
const [, name, trailing] = match;
|
|
9334
|
+
if (trailing || reserved.has(name))
|
|
9335
|
+
continue;
|
|
9336
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
9337
|
+
}
|
|
9338
|
+
return {
|
|
9339
|
+
top: [...top],
|
|
9340
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
9341
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
9342
|
+
};
|
|
9343
|
+
}
|
|
9344
|
+
function appearsBelowTopLevel(data, name) {
|
|
9345
|
+
let budget = 2000;
|
|
9346
|
+
const visit = (value, depth) => {
|
|
9347
|
+
if (budget-- <= 0 || depth > 4)
|
|
9348
|
+
return false;
|
|
9349
|
+
if (value === null || typeof value !== "object")
|
|
9350
|
+
return false;
|
|
9351
|
+
if (Array.isArray(value))
|
|
9352
|
+
return value.some((entry) => visit(entry, depth));
|
|
9353
|
+
const record = value;
|
|
9354
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
9355
|
+
return true;
|
|
9356
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
9357
|
+
};
|
|
9358
|
+
return visit(data, 0);
|
|
9359
|
+
}
|
|
9360
|
+
function alwaysNullKeys(records) {
|
|
9361
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
9362
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
9363
|
+
return [];
|
|
9364
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
9365
|
+
if (keys.length === 0)
|
|
9366
|
+
return [];
|
|
9367
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
9368
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
9369
|
+
}
|
|
9370
|
+
function carriesOnlyNulls(value) {
|
|
9371
|
+
if (value === null)
|
|
9372
|
+
return true;
|
|
9373
|
+
if (Array.isArray(value)) {
|
|
9374
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
9375
|
+
}
|
|
9376
|
+
if (typeof value === "object" && value !== undefined) {
|
|
9377
|
+
const values = Object.values(value);
|
|
9378
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
9379
|
+
}
|
|
9380
|
+
return false;
|
|
9381
|
+
}
|
|
9382
|
+
function nameList(names, cap2 = 12) {
|
|
9383
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
9384
|
+
const rest = names.length - shown.length;
|
|
9385
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
9386
|
+
}
|
|
9387
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
9388
|
+
const present = availableFields(data);
|
|
9389
|
+
const refs = referencedFields(filter);
|
|
9390
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
9391
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
9392
|
+
const count = countRecords(data);
|
|
9393
|
+
const scope = `${count} record(s)`;
|
|
9394
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
9395
|
+
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" : "";
|
|
9396
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
9397
|
+
let detail;
|
|
9398
|
+
let lede;
|
|
9399
|
+
if (outcome.kind === "null-elements") {
|
|
9400
|
+
lede = "returned only null values";
|
|
9401
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
9402
|
+
if (unknown.length > 0) {
|
|
9403
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9404
|
+
} else if (unchecked.length > 0) {
|
|
9405
|
+
detail = withSoundness(projected);
|
|
9406
|
+
} else {
|
|
9407
|
+
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`;
|
|
9408
|
+
}
|
|
9409
|
+
} else if (outcome.kind === "null-rows") {
|
|
9410
|
+
lede = "returned only null values";
|
|
9411
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
9412
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
9413
|
+
} else if (outcome.kind === "null-values") {
|
|
9414
|
+
lede = "returned only null values";
|
|
9415
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
9416
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
9417
|
+
if (sameSet) {
|
|
9418
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
9419
|
+
} else if (unknown.length > 0) {
|
|
9420
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9421
|
+
} else {
|
|
9422
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
9423
|
+
}
|
|
9424
|
+
} else {
|
|
9425
|
+
lede = "returned nothing";
|
|
9426
|
+
if (unknown.length > 0) {
|
|
9427
|
+
detail = isNotAField(unknown);
|
|
9428
|
+
} else {
|
|
9429
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
9430
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
9431
|
+
}
|
|
9432
|
+
}
|
|
9433
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
9434
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
9435
|
+
}
|
|
9436
|
+
function appendWarning(existing, note) {
|
|
9437
|
+
return existing ? `${existing} ${note}` : note;
|
|
9438
|
+
}
|
|
9439
|
+
function applyFilter(data, filter, onWarning) {
|
|
9282
9440
|
const codec = requireJmespath();
|
|
9283
9441
|
let result;
|
|
9284
9442
|
try {
|
|
@@ -9286,9 +9444,34 @@ function applyFilter(data, filter) {
|
|
|
9286
9444
|
} catch (err) {
|
|
9287
9445
|
throw new FilterEvaluationError(filter, err);
|
|
9288
9446
|
}
|
|
9289
|
-
|
|
9447
|
+
const inputCount = countRecords(data);
|
|
9448
|
+
const warn = (outcome) => {
|
|
9449
|
+
if (inputCount === 0)
|
|
9450
|
+
return;
|
|
9451
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
9452
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
9453
|
+
`);
|
|
9454
|
+
onWarning?.(note);
|
|
9455
|
+
};
|
|
9456
|
+
const warnIfAllNull = (records) => {
|
|
9457
|
+
const keys = alwaysNullKeys(records);
|
|
9458
|
+
if (keys.length > 0)
|
|
9459
|
+
warn({ kind: "null-values", keys });
|
|
9460
|
+
};
|
|
9461
|
+
if (result == null) {
|
|
9462
|
+
warn({ kind: "empty" });
|
|
9290
9463
|
return [];
|
|
9464
|
+
}
|
|
9291
9465
|
if (Array.isArray(result)) {
|
|
9466
|
+
if (result.length === 0) {
|
|
9467
|
+
warn({ kind: "empty" });
|
|
9468
|
+
} else if (result.every((entry) => entry === null)) {
|
|
9469
|
+
warn({ kind: "null-elements", count: result.length });
|
|
9470
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
9471
|
+
warn({ kind: "null-rows", count: result.length });
|
|
9472
|
+
} else {
|
|
9473
|
+
warnIfAllNull(result);
|
|
9474
|
+
}
|
|
9292
9475
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
9293
9476
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
9294
9477
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -9296,10 +9479,30 @@ function applyFilter(data, filter) {
|
|
|
9296
9479
|
}
|
|
9297
9480
|
return result;
|
|
9298
9481
|
}
|
|
9299
|
-
if (typeof result === "object")
|
|
9482
|
+
if (typeof result === "object") {
|
|
9483
|
+
warnIfAllNull([result]);
|
|
9300
9484
|
return result;
|
|
9485
|
+
}
|
|
9301
9486
|
return { Value: result };
|
|
9302
9487
|
}
|
|
9488
|
+
function filterFailureData(envelope) {
|
|
9489
|
+
const filter = getOutputFilter();
|
|
9490
|
+
const data = envelope.Data;
|
|
9491
|
+
if (!filter || data == null)
|
|
9492
|
+
return;
|
|
9493
|
+
let note;
|
|
9494
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
9495
|
+
note = n;
|
|
9496
|
+
}));
|
|
9497
|
+
if (filterError) {
|
|
9498
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
9499
|
+
return;
|
|
9500
|
+
}
|
|
9501
|
+
envelope.Data = filtered;
|
|
9502
|
+
if (note) {
|
|
9503
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
9504
|
+
}
|
|
9505
|
+
}
|
|
9303
9506
|
function defaultErrorCodeForResult(result) {
|
|
9304
9507
|
switch (result) {
|
|
9305
9508
|
case RESULTS.AuthenticationError:
|
|
@@ -9382,8 +9585,14 @@ var OutputFormatter;
|
|
|
9382
9585
|
}
|
|
9383
9586
|
const filter = getOutputFilter();
|
|
9384
9587
|
if (filter) {
|
|
9385
|
-
|
|
9588
|
+
let note;
|
|
9589
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
9590
|
+
note = n;
|
|
9591
|
+
});
|
|
9386
9592
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
9593
|
+
if (note) {
|
|
9594
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
9595
|
+
}
|
|
9387
9596
|
}
|
|
9388
9597
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
9389
9598
|
}
|
|
@@ -9411,6 +9620,7 @@ var OutputFormatter;
|
|
|
9411
9620
|
delete envelope.TelemetryErrorClass;
|
|
9412
9621
|
delete envelope.TelemetryTerminalOutcome;
|
|
9413
9622
|
delete envelope.TelemetryTerminalSignal;
|
|
9623
|
+
filterFailureData(envelope);
|
|
9414
9624
|
if (!suppressTelemetry) {
|
|
9415
9625
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
9416
9626
|
result: data.Result,
|
|
@@ -9459,13 +9669,20 @@ var OutputFormatter;
|
|
|
9459
9669
|
OutputFormatter.log = log;
|
|
9460
9670
|
function formatToString(data) {
|
|
9461
9671
|
const filter = getOutputFilter();
|
|
9672
|
+
const envelope = data;
|
|
9462
9673
|
if ("Data" in data && data.Data != null) {
|
|
9463
9674
|
data.Data = normalizeDataKeys(data.Data);
|
|
9464
9675
|
if (filter) {
|
|
9465
|
-
|
|
9676
|
+
let note;
|
|
9677
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
9678
|
+
note = n;
|
|
9679
|
+
}));
|
|
9680
|
+
if (note) {
|
|
9681
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
9682
|
+
}
|
|
9466
9683
|
}
|
|
9467
9684
|
}
|
|
9468
|
-
const output = normalizeOutputKeys(
|
|
9685
|
+
const output = normalizeOutputKeys(envelope);
|
|
9469
9686
|
const lines = [];
|
|
9470
9687
|
const sink = getOutputSink();
|
|
9471
9688
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -25843,4 +26060,4 @@ var registerCommands = async (program2) => {
|
|
|
25843
26060
|
|
|
25844
26061
|
export { Command, metadata, registerCommands };
|
|
25845
26062
|
|
|
25846
|
-
//# debugId=
|
|
26063
|
+
//# debugId=F571B7D7114973AF64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/data-fabric-tool",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "1.202.1-preview.
|
|
4
|
+
"version": "1.202.1-preview.238",
|
|
5
5
|
"description": "Manage Data Fabric entities and records.",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
|
|
22
22
|
}
|