@uipath/aops-tool 1.203.0-preview.235 → 1.203.0-preview.237
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 +1 -1
- package/dist/{tool-2y067kpj.js → tool-xmf32547.js} +225 -8
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2101,7 +2101,7 @@ var package_default = {
|
|
|
2101
2101
|
name: "@uipath/aops-tool",
|
|
2102
2102
|
author: "UiPath",
|
|
2103
2103
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.203.0-preview.
|
|
2104
|
+
version: "1.203.0-preview.237",
|
|
2105
2105
|
description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
|
|
2106
2106
|
private: false,
|
|
2107
2107
|
repository: {
|
|
@@ -5039,7 +5039,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
5039
5039
|
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).";
|
|
5040
5040
|
}
|
|
5041
5041
|
}
|
|
5042
|
-
function
|
|
5042
|
+
function countRecords(data) {
|
|
5043
|
+
if (Array.isArray(data))
|
|
5044
|
+
return data.length;
|
|
5045
|
+
return data == null ? 0 : 1;
|
|
5046
|
+
}
|
|
5047
|
+
function availableFields(data) {
|
|
5048
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5049
|
+
const keys = new Set;
|
|
5050
|
+
for (const record of records) {
|
|
5051
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
5052
|
+
for (const key of Object.keys(record))
|
|
5053
|
+
keys.add(key);
|
|
5054
|
+
}
|
|
5055
|
+
}
|
|
5056
|
+
return [...keys];
|
|
5057
|
+
}
|
|
5058
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
5059
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
5060
|
+
if (!error && typeof decoded === "string")
|
|
5061
|
+
return decoded;
|
|
5062
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
5063
|
+
}
|
|
5064
|
+
function referencedFields(filter) {
|
|
5065
|
+
const top = new Set;
|
|
5066
|
+
const nested = new Set;
|
|
5067
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
5068
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
5069
|
+
const quoted = [];
|
|
5070
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
5071
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
5072
|
+
if (!isAlias) {
|
|
5073
|
+
quoted.push({
|
|
5074
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
5075
|
+
index,
|
|
5076
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
5077
|
+
});
|
|
5078
|
+
}
|
|
5079
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
5080
|
+
});
|
|
5081
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
5082
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
5083
|
+
const place = (name, index, tail) => {
|
|
5084
|
+
if (tail || index >= rootEnd)
|
|
5085
|
+
nested.add(name);
|
|
5086
|
+
else
|
|
5087
|
+
top.add(name);
|
|
5088
|
+
};
|
|
5089
|
+
for (const entry of quoted)
|
|
5090
|
+
place(entry.name, entry.index, entry.tail);
|
|
5091
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
5092
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
5093
|
+
for (const match of identifiers) {
|
|
5094
|
+
const [, name, trailing] = match;
|
|
5095
|
+
if (trailing || reserved.has(name))
|
|
5096
|
+
continue;
|
|
5097
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
5098
|
+
}
|
|
5099
|
+
return {
|
|
5100
|
+
top: [...top],
|
|
5101
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
5102
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
5103
|
+
};
|
|
5104
|
+
}
|
|
5105
|
+
function appearsBelowTopLevel(data, name) {
|
|
5106
|
+
let budget = 2000;
|
|
5107
|
+
const visit = (value, depth) => {
|
|
5108
|
+
if (budget-- <= 0 || depth > 4)
|
|
5109
|
+
return false;
|
|
5110
|
+
if (value === null || typeof value !== "object")
|
|
5111
|
+
return false;
|
|
5112
|
+
if (Array.isArray(value))
|
|
5113
|
+
return value.some((entry) => visit(entry, depth));
|
|
5114
|
+
const record = value;
|
|
5115
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
5116
|
+
return true;
|
|
5117
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
5118
|
+
};
|
|
5119
|
+
return visit(data, 0);
|
|
5120
|
+
}
|
|
5121
|
+
function alwaysNullKeys(records) {
|
|
5122
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
5123
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
5124
|
+
return [];
|
|
5125
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
5126
|
+
if (keys.length === 0)
|
|
5127
|
+
return [];
|
|
5128
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
5129
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
5130
|
+
}
|
|
5131
|
+
function carriesOnlyNulls(value) {
|
|
5132
|
+
if (value === null)
|
|
5133
|
+
return true;
|
|
5134
|
+
if (Array.isArray(value)) {
|
|
5135
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
5136
|
+
}
|
|
5137
|
+
if (typeof value === "object" && value !== undefined) {
|
|
5138
|
+
const values = Object.values(value);
|
|
5139
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
5140
|
+
}
|
|
5141
|
+
return false;
|
|
5142
|
+
}
|
|
5143
|
+
function nameList(names, cap2 = 12) {
|
|
5144
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
5145
|
+
const rest = names.length - shown.length;
|
|
5146
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5147
|
+
}
|
|
5148
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
5149
|
+
const present = availableFields(data);
|
|
5150
|
+
const refs = referencedFields(filter);
|
|
5151
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
5152
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5153
|
+
const count = countRecords(data);
|
|
5154
|
+
const scope = `${count} record(s)`;
|
|
5155
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5156
|
+
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" : "";
|
|
5157
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5158
|
+
let detail;
|
|
5159
|
+
let lede;
|
|
5160
|
+
if (outcome.kind === "null-elements") {
|
|
5161
|
+
lede = "returned only null values";
|
|
5162
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
5163
|
+
if (unknown.length > 0) {
|
|
5164
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5165
|
+
} else if (unchecked.length > 0) {
|
|
5166
|
+
detail = withSoundness(projected);
|
|
5167
|
+
} else {
|
|
5168
|
+
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`;
|
|
5169
|
+
}
|
|
5170
|
+
} else if (outcome.kind === "null-rows") {
|
|
5171
|
+
lede = "returned only null values";
|
|
5172
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
5173
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
5174
|
+
} else if (outcome.kind === "null-values") {
|
|
5175
|
+
lede = "returned only null values";
|
|
5176
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
5177
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
5178
|
+
if (sameSet) {
|
|
5179
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
5180
|
+
} else if (unknown.length > 0) {
|
|
5181
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5182
|
+
} else {
|
|
5183
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
5184
|
+
}
|
|
5185
|
+
} else {
|
|
5186
|
+
lede = "returned nothing";
|
|
5187
|
+
if (unknown.length > 0) {
|
|
5188
|
+
detail = isNotAField(unknown);
|
|
5189
|
+
} else {
|
|
5190
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5191
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5192
|
+
}
|
|
5193
|
+
}
|
|
5194
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5195
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5196
|
+
}
|
|
5197
|
+
function appendWarning(existing, note) {
|
|
5198
|
+
return existing ? `${existing} ${note}` : note;
|
|
5199
|
+
}
|
|
5200
|
+
function applyFilter(data, filter, onWarning) {
|
|
5043
5201
|
const codec = requireJmespath();
|
|
5044
5202
|
let result;
|
|
5045
5203
|
try {
|
|
@@ -5047,9 +5205,34 @@ function applyFilter(data, filter) {
|
|
|
5047
5205
|
} catch (err) {
|
|
5048
5206
|
throw new FilterEvaluationError(filter, err);
|
|
5049
5207
|
}
|
|
5050
|
-
|
|
5208
|
+
const inputCount = countRecords(data);
|
|
5209
|
+
const warn = (outcome) => {
|
|
5210
|
+
if (inputCount === 0)
|
|
5211
|
+
return;
|
|
5212
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5213
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5214
|
+
`);
|
|
5215
|
+
onWarning?.(note);
|
|
5216
|
+
};
|
|
5217
|
+
const warnIfAllNull = (records) => {
|
|
5218
|
+
const keys = alwaysNullKeys(records);
|
|
5219
|
+
if (keys.length > 0)
|
|
5220
|
+
warn({ kind: "null-values", keys });
|
|
5221
|
+
};
|
|
5222
|
+
if (result == null) {
|
|
5223
|
+
warn({ kind: "empty" });
|
|
5051
5224
|
return [];
|
|
5225
|
+
}
|
|
5052
5226
|
if (Array.isArray(result)) {
|
|
5227
|
+
if (result.length === 0) {
|
|
5228
|
+
warn({ kind: "empty" });
|
|
5229
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5230
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5231
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5232
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5233
|
+
} else {
|
|
5234
|
+
warnIfAllNull(result);
|
|
5235
|
+
}
|
|
5053
5236
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
5054
5237
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
5055
5238
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -5057,10 +5240,30 @@ function applyFilter(data, filter) {
|
|
|
5057
5240
|
}
|
|
5058
5241
|
return result;
|
|
5059
5242
|
}
|
|
5060
|
-
if (typeof result === "object")
|
|
5243
|
+
if (typeof result === "object") {
|
|
5244
|
+
warnIfAllNull([result]);
|
|
5061
5245
|
return result;
|
|
5246
|
+
}
|
|
5062
5247
|
return { Value: result };
|
|
5063
5248
|
}
|
|
5249
|
+
function filterFailureData(envelope) {
|
|
5250
|
+
const filter = getOutputFilter();
|
|
5251
|
+
const data = envelope.Data;
|
|
5252
|
+
if (!filter || data == null)
|
|
5253
|
+
return;
|
|
5254
|
+
let note;
|
|
5255
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5256
|
+
note = n;
|
|
5257
|
+
}));
|
|
5258
|
+
if (filterError) {
|
|
5259
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5260
|
+
return;
|
|
5261
|
+
}
|
|
5262
|
+
envelope.Data = filtered;
|
|
5263
|
+
if (note) {
|
|
5264
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5064
5267
|
function defaultErrorCodeForResult(result) {
|
|
5065
5268
|
switch (result) {
|
|
5066
5269
|
case RESULTS.AuthenticationError:
|
|
@@ -5143,8 +5346,14 @@ var OutputFormatter;
|
|
|
5143
5346
|
}
|
|
5144
5347
|
const filter = getOutputFilter();
|
|
5145
5348
|
if (filter) {
|
|
5146
|
-
|
|
5349
|
+
let note;
|
|
5350
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5351
|
+
note = n;
|
|
5352
|
+
});
|
|
5147
5353
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5354
|
+
if (note) {
|
|
5355
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5356
|
+
}
|
|
5148
5357
|
}
|
|
5149
5358
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
5150
5359
|
}
|
|
@@ -5172,6 +5381,7 @@ var OutputFormatter;
|
|
|
5172
5381
|
delete envelope.TelemetryErrorClass;
|
|
5173
5382
|
delete envelope.TelemetryTerminalOutcome;
|
|
5174
5383
|
delete envelope.TelemetryTerminalSignal;
|
|
5384
|
+
filterFailureData(envelope);
|
|
5175
5385
|
if (!suppressTelemetry) {
|
|
5176
5386
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
5177
5387
|
result: data.Result,
|
|
@@ -5220,13 +5430,20 @@ var OutputFormatter;
|
|
|
5220
5430
|
OutputFormatter.log = log;
|
|
5221
5431
|
function formatToString(data) {
|
|
5222
5432
|
const filter = getOutputFilter();
|
|
5433
|
+
const envelope = data;
|
|
5223
5434
|
if ("Data" in data && data.Data != null) {
|
|
5224
5435
|
data.Data = normalizeDataKeys(data.Data);
|
|
5225
5436
|
if (filter) {
|
|
5226
|
-
|
|
5437
|
+
let note;
|
|
5438
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5439
|
+
note = n;
|
|
5440
|
+
}));
|
|
5441
|
+
if (note) {
|
|
5442
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5443
|
+
}
|
|
5227
5444
|
}
|
|
5228
5445
|
}
|
|
5229
|
-
const output = normalizeOutputKeys(
|
|
5446
|
+
const output = normalizeOutputKeys(envelope);
|
|
5230
5447
|
const lines = [];
|
|
5231
5448
|
const sink = getOutputSink();
|
|
5232
5449
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -13414,4 +13631,4 @@ var registerCommands = async (program2) => {
|
|
|
13414
13631
|
|
|
13415
13632
|
export { Command, metadata, registerCommands };
|
|
13416
13633
|
|
|
13417
|
-
//# debugId=
|
|
13634
|
+
//# debugId=436036BD7618962D64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/aops-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.203.0-preview.
|
|
5
|
+
"version": "1.203.0-preview.237",
|
|
6
6
|
"description": "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
|
|
31
31
|
}
|