@uipath/data-fabric-tool 1.202.0 → 1.203.0-preview.160
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.
|
@@ -6582,8 +6582,9 @@ var require_src6 = __commonJS(function(exports) {
|
|
|
6582
6582
|
// package.json
|
|
6583
6583
|
var package_default = {
|
|
6584
6584
|
name: "@uipath/data-fabric-tool",
|
|
6585
|
+
author: "UiPath",
|
|
6585
6586
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6586
|
-
version: "1.
|
|
6587
|
+
version: "1.203.0-preview.160",
|
|
6587
6588
|
description: "Manage Data Fabric entities and records.",
|
|
6588
6589
|
publishConfig: {
|
|
6589
6590
|
registry: "https://npm.pkg.github.com/"
|
|
@@ -6615,7 +6616,7 @@ var package_default = {
|
|
|
6615
6616
|
"@uipath/filesystem": "workspace:*",
|
|
6616
6617
|
"@uipath/packager-tool-datafabric": "workspace:*",
|
|
6617
6618
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
6618
|
-
"@uipath/uipath-typescript": "^1.
|
|
6619
|
+
"@uipath/uipath-typescript": "^1.7.1",
|
|
6619
6620
|
commander: "^14.0.3",
|
|
6620
6621
|
typescript: "^7.0.2"
|
|
6621
6622
|
}
|
|
@@ -7133,7 +7134,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
7133
7134
|
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
7134
7135
|
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
7135
7136
|
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
7136
|
-
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
7137
|
+
var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
7137
7138
|
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
7138
7139
|
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
7139
7140
|
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -7180,7 +7181,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
|
7180
7181
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
7181
7182
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
7182
7183
|
].join("|"), "g");
|
|
7183
|
-
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
7184
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
7184
7185
|
var COLLAPSED_BODY = "{…}";
|
|
7185
7186
|
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
7186
7187
|
var MAX_BODY_NESTING = 8;
|
|
@@ -7195,10 +7196,13 @@ function collapseJsonBodies(text) {
|
|
|
7195
7196
|
}
|
|
7196
7197
|
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
7197
7198
|
}
|
|
7198
|
-
var TRAILING_PROSE_PUNCT =
|
|
7199
|
+
var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
|
|
7199
7200
|
function peelTrailingPunctuation(match) {
|
|
7200
|
-
|
|
7201
|
-
|
|
7201
|
+
let end = match.length;
|
|
7202
|
+
while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
|
|
7203
|
+
end -= 1;
|
|
7204
|
+
}
|
|
7205
|
+
return [match.slice(0, end), match.slice(end)];
|
|
7202
7206
|
}
|
|
7203
7207
|
function redactUrl(raw) {
|
|
7204
7208
|
try {
|
|
@@ -7501,6 +7505,22 @@ function parseHttpStatusFromMessage(message) {
|
|
|
7501
7505
|
const status = Number(match[1]);
|
|
7502
7506
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
7503
7507
|
}
|
|
7508
|
+
function findHttpStatusInGraph(error) {
|
|
7509
|
+
for (const node of walkErrorGraph(error)) {
|
|
7510
|
+
const response = node.response;
|
|
7511
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
7512
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
7513
|
+
return explicit;
|
|
7514
|
+
}
|
|
7515
|
+
if (typeof node.message === "string") {
|
|
7516
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
7517
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
7518
|
+
return parsed;
|
|
7519
|
+
}
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
return;
|
|
7523
|
+
}
|
|
7504
7524
|
function isHtmlDocument(body) {
|
|
7505
7525
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
7506
7526
|
}
|
|
@@ -7614,7 +7634,8 @@ async function extractErrorDetails(error, options) {
|
|
|
7614
7634
|
}
|
|
7615
7635
|
let message;
|
|
7616
7636
|
let result = "Failure";
|
|
7617
|
-
const
|
|
7637
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
7638
|
+
const classification = classifyError(classificationStatus, error);
|
|
7618
7639
|
let retry = classification.retry;
|
|
7619
7640
|
if (status === 401) {
|
|
7620
7641
|
message = DEFAULT_401;
|
|
@@ -7690,8 +7711,8 @@ async function extractErrorDetails(error, options) {
|
|
|
7690
7711
|
details = describeThrownValue(error);
|
|
7691
7712
|
}
|
|
7692
7713
|
const context = {};
|
|
7693
|
-
if (
|
|
7694
|
-
context.httpStatus =
|
|
7714
|
+
if (classificationStatus) {
|
|
7715
|
+
context.httpStatus = classificationStatus;
|
|
7695
7716
|
}
|
|
7696
7717
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
7697
7718
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -8262,7 +8283,8 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
8262
8283
|
}
|
|
8263
8284
|
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
8264
8285
|
encoding: "utf-8",
|
|
8265
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
8286
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
8287
|
+
windowsHide: true
|
|
8266
8288
|
}));
|
|
8267
8289
|
if (error) {
|
|
8268
8290
|
return "";
|
|
@@ -8944,28 +8966,32 @@ function isPlainRecord(value) {
|
|
|
8944
8966
|
const prototype = Object.getPrototypeOf(value);
|
|
8945
8967
|
return prototype === Object.prototype || prototype === null;
|
|
8946
8968
|
}
|
|
8947
|
-
function
|
|
8969
|
+
function splitPagedEnvelope(value) {
|
|
8948
8970
|
if (Array.isArray(value) || !isPlainRecord(value))
|
|
8949
8971
|
return null;
|
|
8950
|
-
const entries = Object.
|
|
8972
|
+
const entries = Object.entries(value);
|
|
8951
8973
|
if (entries.length === 0)
|
|
8952
8974
|
return null;
|
|
8953
|
-
let
|
|
8954
|
-
|
|
8955
|
-
for (const entry of entries) {
|
|
8975
|
+
let found = null;
|
|
8976
|
+
const meta = Object.create(null);
|
|
8977
|
+
for (const [key, entry] of entries) {
|
|
8956
8978
|
if (Array.isArray(entry)) {
|
|
8957
|
-
if (
|
|
8979
|
+
if (found !== null)
|
|
8958
8980
|
return null;
|
|
8959
|
-
|
|
8981
|
+
found = { key, rows: entry };
|
|
8960
8982
|
} else if (entry !== null && typeof entry === "object") {
|
|
8961
8983
|
return null;
|
|
8962
8984
|
} else {
|
|
8963
|
-
|
|
8985
|
+
meta[key] = entry;
|
|
8964
8986
|
}
|
|
8965
8987
|
}
|
|
8966
|
-
if (
|
|
8988
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
8967
8989
|
return null;
|
|
8968
|
-
return
|
|
8990
|
+
return { ...found, meta };
|
|
8991
|
+
}
|
|
8992
|
+
function extractPagedRows(value) {
|
|
8993
|
+
const paged = splitPagedEnvelope(value);
|
|
8994
|
+
return paged === null ? null : paged.rows;
|
|
8969
8995
|
}
|
|
8970
8996
|
function toLowerCamelCaseKey(key) {
|
|
8971
8997
|
if (!key)
|
|
@@ -9069,6 +9095,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
9069
9095
|
}
|
|
9070
9096
|
break;
|
|
9071
9097
|
}
|
|
9098
|
+
case "markdown":
|
|
9099
|
+
logFn(renderMarkdown(data));
|
|
9100
|
+
break;
|
|
9072
9101
|
default: {
|
|
9073
9102
|
const hasData = "Data" in data && data.Data != null;
|
|
9074
9103
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
@@ -9093,6 +9122,10 @@ function logOutput(data, format = "json", tableRowStyle) {
|
|
|
9093
9122
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
9094
9123
|
`), needsAsciiSafeJson(sink), styleFn);
|
|
9095
9124
|
}
|
|
9125
|
+
var PLUMBING_KEYS = new Set(["code", "log"]);
|
|
9126
|
+
function isPlumbingKey(key) {
|
|
9127
|
+
return PLUMBING_KEYS.has(key.toLowerCase());
|
|
9128
|
+
}
|
|
9096
9129
|
function cellToString(val) {
|
|
9097
9130
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
9098
9131
|
}
|
|
@@ -9108,7 +9141,7 @@ function wrapText(text, width) {
|
|
|
9108
9141
|
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
9109
9142
|
if (data.length === 0)
|
|
9110
9143
|
return;
|
|
9111
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
9144
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
9112
9145
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
9113
9146
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
9114
9147
|
logFn(header);
|
|
@@ -9130,7 +9163,7 @@ function isNonEmptyPlainObject(value) {
|
|
|
9130
9163
|
}
|
|
9131
9164
|
var NESTED_INDENT = " ";
|
|
9132
9165
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
9133
|
-
const keys = Object.keys(data).filter((key) => !
|
|
9166
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
|
|
9134
9167
|
if (keys.length === 0)
|
|
9135
9168
|
return;
|
|
9136
9169
|
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
@@ -9161,7 +9194,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
9161
9194
|
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
9162
9195
|
if (data.length === 0)
|
|
9163
9196
|
return;
|
|
9164
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
9197
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
9165
9198
|
if (keys.length === 0)
|
|
9166
9199
|
return;
|
|
9167
9200
|
if (!process.stdout.isTTY) {
|
|
@@ -9235,6 +9268,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
9235
9268
|
logFn(`Log: ${externalLogValue}`);
|
|
9236
9269
|
}
|
|
9237
9270
|
}
|
|
9271
|
+
var MARKDOWN_MAX_CELL = 200;
|
|
9272
|
+
var MARKDOWN_MAX_DEPTH = 3;
|
|
9273
|
+
function markdownHeading(depth) {
|
|
9274
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
9275
|
+
}
|
|
9276
|
+
var BACKTICK_RUN = /`+/g;
|
|
9277
|
+
function fencedBlock(text) {
|
|
9278
|
+
const first = text.trimStart()[0];
|
|
9279
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
9280
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
|
|
9281
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
9282
|
+
return `${fence}${language}
|
|
9283
|
+
${text}
|
|
9284
|
+
${fence}`;
|
|
9285
|
+
}
|
|
9286
|
+
function collapseNewlineRuns(text) {
|
|
9287
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
9288
|
+
`) ? " " : part).join("");
|
|
9289
|
+
}
|
|
9290
|
+
function markdownCell(value) {
|
|
9291
|
+
const text = value instanceof Date ? value.toISOString() : cellToString(value);
|
|
9292
|
+
return collapseNewlineRuns(text).replace(/\|/g, "\\|");
|
|
9293
|
+
}
|
|
9294
|
+
function markdownLabel(key) {
|
|
9295
|
+
return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
|
|
9296
|
+
}
|
|
9297
|
+
function withoutPlumbing(record) {
|
|
9298
|
+
const kept = Object.create(null);
|
|
9299
|
+
for (const [key, value] of Object.entries(record)) {
|
|
9300
|
+
if (!isPlumbingKey(key))
|
|
9301
|
+
kept[key] = value;
|
|
9302
|
+
}
|
|
9303
|
+
return kept;
|
|
9304
|
+
}
|
|
9305
|
+
function rowsWithoutPlumbing(rows) {
|
|
9306
|
+
return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
|
|
9307
|
+
}
|
|
9308
|
+
function markdownTable(rows) {
|
|
9309
|
+
const columns = [];
|
|
9310
|
+
const seen = new Set;
|
|
9311
|
+
for (const row of rows) {
|
|
9312
|
+
for (const key of Object.keys(row)) {
|
|
9313
|
+
if (!seen.has(key)) {
|
|
9314
|
+
seen.add(key);
|
|
9315
|
+
columns.push(key);
|
|
9316
|
+
}
|
|
9317
|
+
}
|
|
9318
|
+
}
|
|
9319
|
+
if (columns.length === 0)
|
|
9320
|
+
return null;
|
|
9321
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
|
|
9322
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
|
|
9323
|
+
return null;
|
|
9324
|
+
}
|
|
9325
|
+
return [
|
|
9326
|
+
`| ${columns.map(markdownLabel).join(" | ")} |`,
|
|
9327
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
9328
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
9329
|
+
].join(`
|
|
9330
|
+
`);
|
|
9331
|
+
}
|
|
9332
|
+
function extractMessageSequence(rows) {
|
|
9333
|
+
const messages = [];
|
|
9334
|
+
for (const row of rows) {
|
|
9335
|
+
const message = extractSingleMessage(row);
|
|
9336
|
+
if (message === null)
|
|
9337
|
+
return null;
|
|
9338
|
+
messages.push(message);
|
|
9339
|
+
}
|
|
9340
|
+
return messages.join(`
|
|
9341
|
+
|
|
9342
|
+
`);
|
|
9343
|
+
}
|
|
9344
|
+
function markdownRows(rows, depth) {
|
|
9345
|
+
if (rows.length === 0)
|
|
9346
|
+
return "(none)";
|
|
9347
|
+
if (!isPlainObjectArray(rows)) {
|
|
9348
|
+
return rows.map((item) => `- ${markdownCell(item)}`).join(`
|
|
9349
|
+
`);
|
|
9350
|
+
}
|
|
9351
|
+
const prose = extractMessageSequence(rows);
|
|
9352
|
+
if (prose !== null)
|
|
9353
|
+
return prose;
|
|
9354
|
+
const table = markdownTable(rows);
|
|
9355
|
+
if (table !== null)
|
|
9356
|
+
return table;
|
|
9357
|
+
if (depth >= MARKDOWN_MAX_DEPTH) {
|
|
9358
|
+
return fencedBlock(JSON.stringify(rows, null, 2));
|
|
9359
|
+
}
|
|
9360
|
+
return rows.map((row, index) => [
|
|
9361
|
+
`${markdownHeading(depth)} ${index + 1}`,
|
|
9362
|
+
markdownObject(row, depth + 1)
|
|
9363
|
+
].join(`
|
|
9364
|
+
|
|
9365
|
+
`)).join(`
|
|
9366
|
+
|
|
9367
|
+
`);
|
|
9368
|
+
}
|
|
9369
|
+
function markdownObject(obj, depth) {
|
|
9370
|
+
const scalars = [];
|
|
9371
|
+
const blocks = [];
|
|
9372
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
9373
|
+
if (value === undefined)
|
|
9374
|
+
continue;
|
|
9375
|
+
const label = markdownLabel(key);
|
|
9376
|
+
if (Array.isArray(value)) {
|
|
9377
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
9378
|
+
|
|
9379
|
+
${markdownRows(value, depth + 1)}`);
|
|
9380
|
+
} else if (isNonEmptyPlainObject(value)) {
|
|
9381
|
+
const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
|
|
9382
|
+
if (nested !== "") {
|
|
9383
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
9384
|
+
|
|
9385
|
+
${nested}`);
|
|
9386
|
+
}
|
|
9387
|
+
} else if (typeof value === "string" && value.includes(`
|
|
9388
|
+
`)) {
|
|
9389
|
+
blocks.push(`**${label}:**
|
|
9390
|
+
|
|
9391
|
+
${fencedBlock(value)}`);
|
|
9392
|
+
} else {
|
|
9393
|
+
scalars.push(`**${label}:** ${markdownCell(value)}`);
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
9397
|
+
`)] : [];
|
|
9398
|
+
sections.push(...blocks);
|
|
9399
|
+
return sections.join(`
|
|
9400
|
+
|
|
9401
|
+
`);
|
|
9402
|
+
}
|
|
9403
|
+
function extractSingleMessage(payload) {
|
|
9404
|
+
if (!isPlainRecord(payload))
|
|
9405
|
+
return null;
|
|
9406
|
+
const keys = Object.keys(payload);
|
|
9407
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
9408
|
+
return null;
|
|
9409
|
+
const value = payload[keys[0]];
|
|
9410
|
+
return typeof value === "string" ? value : null;
|
|
9411
|
+
}
|
|
9412
|
+
function markdownPayload(payload) {
|
|
9413
|
+
const message = extractSingleMessage(payload);
|
|
9414
|
+
if (message !== null)
|
|
9415
|
+
return message;
|
|
9416
|
+
if (Array.isArray(payload)) {
|
|
9417
|
+
return markdownRows(rowsWithoutPlumbing(payload), 0);
|
|
9418
|
+
}
|
|
9419
|
+
const visible = withoutPlumbing(payload);
|
|
9420
|
+
const paged = splitPagedEnvelope(visible);
|
|
9421
|
+
if (paged !== null) {
|
|
9422
|
+
const meta = markdownObject(paged.meta, 0);
|
|
9423
|
+
const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
|
|
9424
|
+
|
|
9425
|
+
${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
|
|
9426
|
+
return meta === "" ? rows : `${meta}
|
|
9427
|
+
|
|
9428
|
+
${rows}`;
|
|
9429
|
+
}
|
|
9430
|
+
return markdownObject(visible, 0);
|
|
9431
|
+
}
|
|
9432
|
+
function isPaginationWorthShowing(value) {
|
|
9433
|
+
if (typeof value !== "object" || value === null)
|
|
9434
|
+
return false;
|
|
9435
|
+
const page = value;
|
|
9436
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
9437
|
+
}
|
|
9438
|
+
function markdownEnvelopeNotes(data) {
|
|
9439
|
+
const envelope = data;
|
|
9440
|
+
const notes = [];
|
|
9441
|
+
const warning = envelope.Warning;
|
|
9442
|
+
if (typeof warning === "string" && warning !== "") {
|
|
9443
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
9444
|
+
}
|
|
9445
|
+
const instructions = envelope.Instructions;
|
|
9446
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
9447
|
+
notes.push(`> ${instructions}`);
|
|
9448
|
+
}
|
|
9449
|
+
const pagination = envelope.Pagination;
|
|
9450
|
+
if (isPaginationWorthShowing(pagination)) {
|
|
9451
|
+
const body = markdownObject(pagination, 1);
|
|
9452
|
+
if (body !== "") {
|
|
9453
|
+
notes.push(`${markdownHeading(0)} Pagination
|
|
9454
|
+
|
|
9455
|
+
${body}`);
|
|
9456
|
+
}
|
|
9457
|
+
}
|
|
9458
|
+
const log = envelope.Log;
|
|
9459
|
+
if (typeof log === "string" && log !== "") {
|
|
9460
|
+
notes.push(`**Log:** ${log}`);
|
|
9461
|
+
}
|
|
9462
|
+
return notes;
|
|
9463
|
+
}
|
|
9464
|
+
function renderMarkdown(data) {
|
|
9465
|
+
if (data.Result !== RESULTS.Success) {
|
|
9466
|
+
const failure = data;
|
|
9467
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
9468
|
+
if (failure.Data != null) {
|
|
9469
|
+
sections.push(markdownPayload(failure.Data));
|
|
9470
|
+
}
|
|
9471
|
+
if (failure.Instructions) {
|
|
9472
|
+
sections.push(`> ${failure.Instructions}`);
|
|
9473
|
+
}
|
|
9474
|
+
return sections.filter((section) => section !== "").join(`
|
|
9475
|
+
|
|
9476
|
+
`);
|
|
9477
|
+
}
|
|
9478
|
+
if (!("Data" in data) || data.Data == null) {
|
|
9479
|
+
return markdownObject(withoutPlumbing(data), 0);
|
|
9480
|
+
}
|
|
9481
|
+
return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
|
|
9482
|
+
|
|
9483
|
+
`);
|
|
9484
|
+
}
|
|
9238
9485
|
function toYaml(data) {
|
|
9239
9486
|
const codec = getYamlCodec();
|
|
9240
9487
|
if (!codec) {
|
|
@@ -11064,16 +11311,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
|
|
|
11064
11311
|
errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
|
|
11065
11312
|
};
|
|
11066
11313
|
};
|
|
11067
|
-
var
|
|
11068
|
-
const fs2 = getFileSystem();
|
|
11069
|
-
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
11070
|
-
if (!await fs2.exists(absolutePath)) {
|
|
11071
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
11072
|
-
}
|
|
11073
|
-
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
11074
|
-
if (content === null) {
|
|
11075
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
11076
|
-
}
|
|
11314
|
+
var parseEnvContent = (content) => {
|
|
11077
11315
|
const env = {};
|
|
11078
11316
|
for (const line of content.split(`
|
|
11079
11317
|
`)) {
|
|
@@ -11094,6 +11332,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
11094
11332
|
}
|
|
11095
11333
|
return env;
|
|
11096
11334
|
};
|
|
11335
|
+
var loadEnvFileAsync = async ({ envPath }) => {
|
|
11336
|
+
const fs2 = getFileSystem();
|
|
11337
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
11338
|
+
if (!await fs2.exists(absolutePath)) {
|
|
11339
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
11340
|
+
}
|
|
11341
|
+
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
11342
|
+
if (content === null) {
|
|
11343
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
11344
|
+
}
|
|
11345
|
+
return parseEnvContent(content);
|
|
11346
|
+
};
|
|
11097
11347
|
var saveEnvFileAsync = async ({
|
|
11098
11348
|
envPath,
|
|
11099
11349
|
data,
|
|
@@ -12043,7 +12293,7 @@ var allowsEval = cached(() => {
|
|
|
12043
12293
|
return false;
|
|
12044
12294
|
}
|
|
12045
12295
|
});
|
|
12046
|
-
function isPlainObject(o) {
|
|
12296
|
+
function isPlainObject$1(o) {
|
|
12047
12297
|
if (isObject(o) === false)
|
|
12048
12298
|
return false;
|
|
12049
12299
|
const ctor = o.constructor;
|
|
@@ -12060,7 +12310,7 @@ function isPlainObject(o) {
|
|
|
12060
12310
|
return true;
|
|
12061
12311
|
}
|
|
12062
12312
|
function shallowClone(o) {
|
|
12063
|
-
if (isPlainObject(o))
|
|
12313
|
+
if (isPlainObject$1(o))
|
|
12064
12314
|
return { ...o };
|
|
12065
12315
|
if (Array.isArray(o))
|
|
12066
12316
|
return [...o];
|
|
@@ -12148,7 +12398,7 @@ function omit(schema, mask) {
|
|
|
12148
12398
|
return clone(schema, def);
|
|
12149
12399
|
}
|
|
12150
12400
|
function extend(schema, shape) {
|
|
12151
|
-
if (!isPlainObject(shape)) {
|
|
12401
|
+
if (!isPlainObject$1(shape)) {
|
|
12152
12402
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
12153
12403
|
}
|
|
12154
12404
|
const checks = schema._zod.def.checks;
|
|
@@ -12171,7 +12421,7 @@ function extend(schema, shape) {
|
|
|
12171
12421
|
return clone(schema, def);
|
|
12172
12422
|
}
|
|
12173
12423
|
function safeExtend(schema, shape) {
|
|
12174
|
-
if (!isPlainObject(shape)) {
|
|
12424
|
+
if (!isPlainObject$1(shape)) {
|
|
12175
12425
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
12176
12426
|
}
|
|
12177
12427
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -12508,6 +12758,7 @@ var string$1 = (params) => {
|
|
|
12508
12758
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
12509
12759
|
return new RegExp(`^${regex}$`);
|
|
12510
12760
|
};
|
|
12761
|
+
var boolean$1 = /^(?:true|false)$/i;
|
|
12511
12762
|
var lowercase = /^[^A-Z]*$/;
|
|
12512
12763
|
var uppercase = /^[^a-z]*$/;
|
|
12513
12764
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -13176,6 +13427,26 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
13176
13427
|
});
|
|
13177
13428
|
};
|
|
13178
13429
|
});
|
|
13430
|
+
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
13431
|
+
$ZodType.init(inst, def);
|
|
13432
|
+
inst._zod.pattern = boolean$1;
|
|
13433
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
13434
|
+
if (def.coerce)
|
|
13435
|
+
try {
|
|
13436
|
+
payload.value = Boolean(payload.value);
|
|
13437
|
+
} catch (_) {}
|
|
13438
|
+
const input = payload.value;
|
|
13439
|
+
if (typeof input === "boolean")
|
|
13440
|
+
return payload;
|
|
13441
|
+
payload.issues.push({
|
|
13442
|
+
expected: "boolean",
|
|
13443
|
+
code: "invalid_type",
|
|
13444
|
+
input,
|
|
13445
|
+
inst
|
|
13446
|
+
});
|
|
13447
|
+
return payload;
|
|
13448
|
+
};
|
|
13449
|
+
});
|
|
13179
13450
|
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
13180
13451
|
$ZodType.init(inst, def);
|
|
13181
13452
|
inst._zod.parse = (payload) => payload;
|
|
@@ -13546,7 +13817,7 @@ function mergeValues(a, b) {
|
|
|
13546
13817
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
13547
13818
|
return { valid: true, data: a };
|
|
13548
13819
|
}
|
|
13549
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
13820
|
+
if (isPlainObject$1(a) && isPlainObject$1(b)) {
|
|
13550
13821
|
const bKeys = Object.keys(b);
|
|
13551
13822
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
13552
13823
|
const newObj = { ...a, ...b };
|
|
@@ -13901,7 +14172,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
13901
14172
|
payload.issues.push(issue(_iss));
|
|
13902
14173
|
}
|
|
13903
14174
|
}
|
|
13904
|
-
var _a;
|
|
14175
|
+
var _a$1;
|
|
13905
14176
|
|
|
13906
14177
|
class $ZodRegistry {
|
|
13907
14178
|
constructor() {
|
|
@@ -13946,7 +14217,7 @@ class $ZodRegistry {
|
|
|
13946
14217
|
function registry2() {
|
|
13947
14218
|
return new $ZodRegistry;
|
|
13948
14219
|
}
|
|
13949
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry2());
|
|
14220
|
+
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry2());
|
|
13950
14221
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
13951
14222
|
function _string(Class, params) {
|
|
13952
14223
|
return new Class({
|
|
@@ -14191,6 +14462,12 @@ function _isoDuration(Class, params) {
|
|
|
14191
14462
|
...normalizeParams(params)
|
|
14192
14463
|
});
|
|
14193
14464
|
}
|
|
14465
|
+
function _boolean(Class, params) {
|
|
14466
|
+
return new Class({
|
|
14467
|
+
type: "boolean",
|
|
14468
|
+
...normalizeParams(params)
|
|
14469
|
+
});
|
|
14470
|
+
}
|
|
14194
14471
|
function _unknown(Class) {
|
|
14195
14472
|
return new Class({
|
|
14196
14473
|
type: "unknown"
|
|
@@ -14356,7 +14633,7 @@ function initializeContext(params) {
|
|
|
14356
14633
|
};
|
|
14357
14634
|
}
|
|
14358
14635
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
14359
|
-
var
|
|
14636
|
+
var _a;
|
|
14360
14637
|
const def = schema._zod.def;
|
|
14361
14638
|
const seen = ctx.seen.get(schema);
|
|
14362
14639
|
if (seen) {
|
|
@@ -14404,7 +14681,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
14404
14681
|
delete result.schema.default;
|
|
14405
14682
|
}
|
|
14406
14683
|
if (ctx.io === "input" && result.schema._prefault)
|
|
14407
|
-
(
|
|
14684
|
+
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
14408
14685
|
delete result.schema._prefault;
|
|
14409
14686
|
const _result = ctx.seen.get(schema);
|
|
14410
14687
|
return _result.schema;
|
|
@@ -14721,6 +14998,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
14721
14998
|
}
|
|
14722
14999
|
}
|
|
14723
15000
|
};
|
|
15001
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
15002
|
+
json.type = "boolean";
|
|
15003
|
+
};
|
|
14724
15004
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
14725
15005
|
json.not = {};
|
|
14726
15006
|
};
|
|
@@ -15179,6 +15459,14 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
15179
15459
|
$ZodJWT.init(inst, def);
|
|
15180
15460
|
ZodStringFormat.init(inst, def);
|
|
15181
15461
|
});
|
|
15462
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
15463
|
+
$ZodBoolean.init(inst, def);
|
|
15464
|
+
ZodType.init(inst, def);
|
|
15465
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
|
|
15466
|
+
});
|
|
15467
|
+
function boolean(params) {
|
|
15468
|
+
return _boolean(ZodBoolean, params);
|
|
15469
|
+
}
|
|
15182
15470
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
15183
15471
|
$ZodUnknown.init(inst, def);
|
|
15184
15472
|
ZodType.init(inst, def);
|
|
@@ -15489,7 +15777,8 @@ object({
|
|
|
15489
15777
|
secret: string().optional(),
|
|
15490
15778
|
clientId: string().optional(),
|
|
15491
15779
|
redirectUri: string().url().optional(),
|
|
15492
|
-
scope: string().optional()
|
|
15780
|
+
scope: string().optional(),
|
|
15781
|
+
enforceSso: boolean().optional()
|
|
15493
15782
|
});
|
|
15494
15783
|
|
|
15495
15784
|
class UiPathConfig {
|
|
@@ -15501,6 +15790,7 @@ class UiPathConfig {
|
|
|
15501
15790
|
this.clientId = options.clientId;
|
|
15502
15791
|
this.redirectUri = options.redirectUri;
|
|
15503
15792
|
this.scope = options.scope;
|
|
15793
|
+
this.enforceSso = options.enforceSso;
|
|
15504
15794
|
}
|
|
15505
15795
|
}
|
|
15506
15796
|
|
|
@@ -15703,6 +15993,7 @@ var TaskType;
|
|
|
15703
15993
|
TaskType2["DocumentValidation"] = "DocumentValidationTask";
|
|
15704
15994
|
TaskType2["DocumentClassification"] = "DocumentClassificationTask";
|
|
15705
15995
|
TaskType2["DataLabeling"] = "DataLabelingTask";
|
|
15996
|
+
TaskType2["QuickForm"] = "QuickFormTask";
|
|
15706
15997
|
})(TaskType || (TaskType = {}));
|
|
15707
15998
|
var TaskPriority;
|
|
15708
15999
|
(function(TaskPriority2) {
|
|
@@ -15815,7 +16106,11 @@ var PROCESS_ENDPOINTS = {
|
|
|
15815
16106
|
var QUEUE_ENDPOINTS = {
|
|
15816
16107
|
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
15817
16108
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
15818
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})
|
|
16109
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
16110
|
+
GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
|
|
16111
|
+
ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
|
|
16112
|
+
START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
|
|
16113
|
+
SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
|
|
15819
16114
|
};
|
|
15820
16115
|
var JOB_ENDPOINTS = {
|
|
15821
16116
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
@@ -15862,6 +16157,10 @@ var MAESTRO_ENDPOINTS = {
|
|
|
15862
16157
|
TRACES: {
|
|
15863
16158
|
GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
|
|
15864
16159
|
},
|
|
16160
|
+
BUSINESS_APPS: {
|
|
16161
|
+
COLLECTION: `${PIMS_BASE}/api/v1/business-apps`,
|
|
16162
|
+
BY_ID: (businessAppId) => `${PIMS_BASE}/api/v1/business-apps/${businessAppId}`
|
|
16163
|
+
},
|
|
15865
16164
|
CASES: {
|
|
15866
16165
|
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
15867
16166
|
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
@@ -15896,13 +16195,24 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
15896
16195
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
15897
16196
|
UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
|
|
15898
16197
|
DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
|
|
15899
|
-
|
|
16198
|
+
UPDATE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
|
|
15900
16199
|
QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
|
|
15901
16200
|
QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
|
|
15902
16201
|
BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
|
|
15903
16202
|
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
15904
16203
|
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
15905
|
-
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}
|
|
16204
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
16205
|
+
GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/Entity/${entityName}/metadata`,
|
|
16206
|
+
GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/read`,
|
|
16207
|
+
GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v2/EntityService/${entityName}/read/${recordId}`,
|
|
16208
|
+
INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert`,
|
|
16209
|
+
BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert-batch`,
|
|
16210
|
+
UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update/${recordId}`,
|
|
16211
|
+
UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update-batch`,
|
|
16212
|
+
DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete/${recordId}`,
|
|
16213
|
+
DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete-batch`,
|
|
16214
|
+
BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
|
|
16215
|
+
ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
|
|
15906
16216
|
},
|
|
15907
16217
|
CHOICESETS: {
|
|
15908
16218
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -15925,7 +16235,8 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
15925
16235
|
};
|
|
15926
16236
|
var IDENTITY_ENDPOINTS = {
|
|
15927
16237
|
TOKEN: `${IDENTITY_BASE}/connect/token`,
|
|
15928
|
-
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize
|
|
16238
|
+
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
|
|
16239
|
+
END_SESSION: `${IDENTITY_BASE}/connect/endsession`
|
|
15929
16240
|
};
|
|
15930
16241
|
var TASK_TYPE_ENDPOINTS = {
|
|
15931
16242
|
[TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
|
|
@@ -15933,7 +16244,8 @@ var TASK_TYPE_ENDPOINTS = {
|
|
|
15933
16244
|
[TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
15934
16245
|
[TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
15935
16246
|
[TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
15936
|
-
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
16247
|
+
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
16248
|
+
[TaskType.QuickForm]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
15937
16249
|
};
|
|
15938
16250
|
var ActionCenterEventNames;
|
|
15939
16251
|
(function(ActionCenterEventNames2) {
|
|
@@ -15941,29 +16253,12 @@ var ActionCenterEventNames;
|
|
|
15941
16253
|
ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
|
|
15942
16254
|
})(ActionCenterEventNames || (ActionCenterEventNames = {}));
|
|
15943
16255
|
var AUTHENTICATION_TIMEOUT = 8000;
|
|
15944
|
-
var ALLOWED_HOST_ORIGINS = new Set([
|
|
15945
|
-
"https://alpha.uipath.com",
|
|
15946
|
-
"https://staging.uipath.com",
|
|
15947
|
-
"https://cloud.uipath.com"
|
|
15948
|
-
]);
|
|
15949
|
-
function isValidHostOrigin(origin) {
|
|
15950
|
-
if (!origin)
|
|
15951
|
-
return false;
|
|
15952
|
-
if (ALLOWED_HOST_ORIGINS.has(origin))
|
|
15953
|
-
return true;
|
|
15954
|
-
try {
|
|
15955
|
-
return new URL(origin).hostname === "localhost";
|
|
15956
|
-
} catch {
|
|
15957
|
-
console.warn("isValidHostOrigin: received a malformed origin URL", origin);
|
|
15958
|
-
return false;
|
|
15959
|
-
}
|
|
15960
|
-
}
|
|
15961
16256
|
function isTokenExpired(tokenInfo) {
|
|
15962
16257
|
if (!tokenInfo?.expiresAt)
|
|
15963
16258
|
return true;
|
|
15964
16259
|
return new Date >= tokenInfo.expiresAt;
|
|
15965
16260
|
}
|
|
15966
|
-
var
|
|
16261
|
+
var hostEmbeddingOrigin = isHostEmbedded && embeddingOrigin ? embeddingOrigin : null;
|
|
15967
16262
|
function waitForMessage(filter, signal) {
|
|
15968
16263
|
return new Promise((resolve2, reject) => {
|
|
15969
16264
|
const handler = (event) => {
|
|
@@ -16032,12 +16327,6 @@ class ActionCenterTokenManager {
|
|
|
16032
16327
|
statusCode: HttpStatus.UNAUTHORIZED
|
|
16033
16328
|
}));
|
|
16034
16329
|
}
|
|
16035
|
-
if (!isValidHostOrigin(parentOrigin)) {
|
|
16036
|
-
return Promise.reject(new AuthenticationError({
|
|
16037
|
-
message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
|
|
16038
|
-
statusCode: HttpStatus.UNAUTHORIZED
|
|
16039
|
-
}));
|
|
16040
|
-
}
|
|
16041
16330
|
const { promise } = requestHostToken({
|
|
16042
16331
|
pinnedOrigin: parentOrigin,
|
|
16043
16332
|
sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
|
|
@@ -16061,7 +16350,7 @@ class ActionCenterTokenManager {
|
|
|
16061
16350
|
}
|
|
16062
16351
|
}
|
|
16063
16352
|
sendMessageToParent(eventType, content) {
|
|
16064
|
-
if (window.parent &&
|
|
16353
|
+
if (window.parent && this.parentOrigin) {
|
|
16065
16354
|
try {
|
|
16066
16355
|
window.parent.postMessage({ eventType, content }, this.parentOrigin);
|
|
16067
16356
|
} catch (error) {
|
|
@@ -16141,7 +16430,7 @@ class EmbeddedTokenManager {
|
|
|
16141
16430
|
this.cancelRefresh?.();
|
|
16142
16431
|
}
|
|
16143
16432
|
}
|
|
16144
|
-
var SDK_VERSION = "1.
|
|
16433
|
+
var SDK_VERSION = "1.7.1";
|
|
16145
16434
|
var CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
16146
16435
|
var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
16147
16436
|
var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
@@ -16207,19 +16496,21 @@ function base64UrlToBase64(value) {
|
|
|
16207
16496
|
const base642 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
|
|
16208
16497
|
return base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "=");
|
|
16209
16498
|
}
|
|
16210
|
-
function
|
|
16499
|
+
function decodeJwtClaims(token) {
|
|
16211
16500
|
try {
|
|
16212
|
-
const payload = token
|
|
16501
|
+
const payload = token?.split(".")[1];
|
|
16213
16502
|
if (!payload) {
|
|
16214
|
-
return
|
|
16503
|
+
return;
|
|
16215
16504
|
}
|
|
16216
|
-
|
|
16217
|
-
const sub = claims["sub"];
|
|
16218
|
-
return typeof sub === "string" && sub ? sub : "";
|
|
16505
|
+
return JSON.parse(decodeBase64(base64UrlToBase64(payload)));
|
|
16219
16506
|
} catch {
|
|
16220
|
-
return
|
|
16507
|
+
return;
|
|
16221
16508
|
}
|
|
16222
16509
|
}
|
|
16510
|
+
function extractUserIdFromToken(token) {
|
|
16511
|
+
const sub = decodeJwtClaims(token)?.["sub"];
|
|
16512
|
+
return typeof sub === "string" && sub ? sub : "";
|
|
16513
|
+
}
|
|
16223
16514
|
|
|
16224
16515
|
class TokenManager {
|
|
16225
16516
|
constructor(executionContext, config2, isOAuth = false) {
|
|
@@ -16232,8 +16523,8 @@ class TokenManager {
|
|
|
16232
16523
|
if (isInActionCenter) {
|
|
16233
16524
|
this.actionCenterTokenManager = new ActionCenterTokenManager(config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
16234
16525
|
this.isOAuth = false;
|
|
16235
|
-
} else if (
|
|
16236
|
-
this.embeddedTokenManager = new EmbeddedTokenManager(
|
|
16526
|
+
} else if (hostEmbeddingOrigin) {
|
|
16527
|
+
this.embeddedTokenManager = new EmbeddedTokenManager(hostEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
16237
16528
|
this.isOAuth = false;
|
|
16238
16529
|
}
|
|
16239
16530
|
}
|
|
@@ -16344,6 +16635,9 @@ class TokenManager {
|
|
|
16344
16635
|
getToken() {
|
|
16345
16636
|
return this.currentToken?.token;
|
|
16346
16637
|
}
|
|
16638
|
+
getIdToken() {
|
|
16639
|
+
return this.currentToken?.idToken;
|
|
16640
|
+
}
|
|
16347
16641
|
hasValidToken() {
|
|
16348
16642
|
if (!this.currentToken) {
|
|
16349
16643
|
return false;
|
|
@@ -16415,11 +16709,13 @@ class TokenManager {
|
|
|
16415
16709
|
token: token.access_token,
|
|
16416
16710
|
type: "oauth",
|
|
16417
16711
|
expiresAt: new Date(Date.now() + token.expires_in * 1000),
|
|
16418
|
-
refreshToken: token.refresh_token
|
|
16712
|
+
refreshToken: token.refresh_token,
|
|
16713
|
+
idToken: token.id_token ?? tokenInfo.idToken
|
|
16419
16714
|
});
|
|
16420
16715
|
return token;
|
|
16421
16716
|
}
|
|
16422
16717
|
}
|
|
16718
|
+
var GUID_REGEX$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
16423
16719
|
|
|
16424
16720
|
class AuthService {
|
|
16425
16721
|
constructor(config2, executionContext) {
|
|
@@ -16553,7 +16849,11 @@ class AuthService {
|
|
|
16553
16849
|
hasValidToken() {
|
|
16554
16850
|
return this.tokenManager.hasValidToken();
|
|
16555
16851
|
}
|
|
16556
|
-
logout() {
|
|
16852
|
+
logout(options) {
|
|
16853
|
+
const idTokenHint = options?.endSession ? this.tokenManager.getIdToken() : undefined;
|
|
16854
|
+
if (options?.endSession && isBrowser2 && !idTokenHint) {
|
|
16855
|
+
console.warn("endSession skipped — no OIDC ID token is available for this " + "session. Sign in again to enable it; only local authentication " + "state was cleared.");
|
|
16856
|
+
}
|
|
16557
16857
|
this.tokenManager.clearToken();
|
|
16558
16858
|
if (isBrowser2) {
|
|
16559
16859
|
try {
|
|
@@ -16563,6 +16863,12 @@ class AuthService {
|
|
|
16563
16863
|
console.warn("Failed to clear OAuth context from session storage", error);
|
|
16564
16864
|
}
|
|
16565
16865
|
}
|
|
16866
|
+
if (options?.endSession && isBrowser2 && idTokenHint) {
|
|
16867
|
+
window.location.href = this._buildEndSessionUrl({
|
|
16868
|
+
idTokenHint,
|
|
16869
|
+
postLogoutRedirectUri: this.config.redirectUri
|
|
16870
|
+
});
|
|
16871
|
+
}
|
|
16566
16872
|
}
|
|
16567
16873
|
getToken() {
|
|
16568
16874
|
if (!this.tokenManager.hasValidToken()) {
|
|
@@ -16606,10 +16912,27 @@ class AuthService {
|
|
|
16606
16912
|
redirect_uri: params.redirectUri,
|
|
16607
16913
|
code_challenge: params.codeChallenge,
|
|
16608
16914
|
code_challenge_method: "S256",
|
|
16609
|
-
scope: params.scope + " offline_access",
|
|
16915
|
+
scope: params.scope + " offline_access openid",
|
|
16610
16916
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
16611
16917
|
});
|
|
16612
|
-
|
|
16918
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
16919
|
+
if (!this.config.enforceSso) {
|
|
16920
|
+
return authorizeUrl;
|
|
16921
|
+
}
|
|
16922
|
+
const orgName = this.config.orgName;
|
|
16923
|
+
if (!GUID_REGEX$1.test(orgName)) {
|
|
16924
|
+
console.warn(`[UiPath SDK] enforceSso was ignored: orgName "${orgName}" is not an organization id. ` + "Pass the organization id (GUID) as orgName to sign in through the org's identity provider.");
|
|
16925
|
+
return authorizeUrl;
|
|
16926
|
+
}
|
|
16927
|
+
return `${authorizeUrl}&acr_values=${encodeURIComponent(`tenant:${orgName}`)}`;
|
|
16928
|
+
}
|
|
16929
|
+
_buildEndSessionUrl(params) {
|
|
16930
|
+
const queryParams = new URLSearchParams;
|
|
16931
|
+
queryParams.set("id_token_hint", params.idTokenHint);
|
|
16932
|
+
if (params.postLogoutRedirectUri) {
|
|
16933
|
+
queryParams.set("post_logout_redirect_uri", params.postLogoutRedirectUri);
|
|
16934
|
+
}
|
|
16935
|
+
return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.END_SESSION}?${queryParams.toString()}`;
|
|
16613
16936
|
}
|
|
16614
16937
|
async _getAccessToken(params) {
|
|
16615
16938
|
const body = new URLSearchParams({
|
|
@@ -16636,7 +16959,8 @@ class AuthService {
|
|
|
16636
16959
|
token: token.access_token,
|
|
16637
16960
|
type: "oauth",
|
|
16638
16961
|
expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
|
|
16639
|
-
refreshToken: token.refresh_token
|
|
16962
|
+
refreshToken: token.refresh_token,
|
|
16963
|
+
idToken: token.id_token
|
|
16640
16964
|
});
|
|
16641
16965
|
return token;
|
|
16642
16966
|
}
|
|
@@ -16709,9 +17033,18 @@ function validateConfig(config2) {
|
|
|
16709
17033
|
function isCompleteConfig(config2) {
|
|
16710
17034
|
return hasRequiredBaseFields(config2) && hasValidAuthConfig(config2);
|
|
16711
17035
|
}
|
|
17036
|
+
function compactConfig(config2) {
|
|
17037
|
+
return Object.fromEntries(Object.entries(config2).filter(([, value]) => value !== undefined));
|
|
17038
|
+
}
|
|
16712
17039
|
function normalizeBaseUrl2(url) {
|
|
16713
17040
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
16714
17041
|
}
|
|
17042
|
+
function missingConfigMessage() {
|
|
17043
|
+
if (isBrowser2) {
|
|
17044
|
+
return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
|
|
17045
|
+
}
|
|
17046
|
+
return "UiPath SDK configuration not found. " + "In a UiPath coded function, pass the handler context: new UiPath(ctx). " + "Otherwise pass { baseUrl, orgName, tenantName, secret }, " + "or set UIPATH_BASE_URL, UIPATH_ORG_NAME, UIPATH_TENANT_NAME and UIPATH_ACCESS_TOKEN.";
|
|
17047
|
+
}
|
|
16715
17048
|
var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
|
|
16716
17049
|
var getGlobalStore = () => {
|
|
16717
17050
|
const globalObj = globalThis;
|
|
@@ -16720,6 +17053,7 @@ var getGlobalStore = () => {
|
|
|
16720
17053
|
}
|
|
16721
17054
|
return globalObj[REGISTRY_KEY2];
|
|
16722
17055
|
};
|
|
17056
|
+
var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
|
|
16723
17057
|
|
|
16724
17058
|
class SDKInternalsRegistry {
|
|
16725
17059
|
static get store() {
|
|
@@ -16731,6 +17065,9 @@ class SDKInternalsRegistry {
|
|
|
16731
17065
|
static get(instance) {
|
|
16732
17066
|
const internals = this.store.get(instance);
|
|
16733
17067
|
if (!internals) {
|
|
17068
|
+
if (looksLikeUiPath(instance)) {
|
|
17069
|
+
throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
|
|
17070
|
+
}
|
|
16734
17071
|
throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
|
|
16735
17072
|
}
|
|
16736
17073
|
return internals;
|
|
@@ -16748,6 +17085,10 @@ var UiPathMetaTags;
|
|
|
16748
17085
|
UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
|
|
16749
17086
|
UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
|
|
16750
17087
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
17088
|
+
var UiPathElementIds;
|
|
17089
|
+
(function(UiPathElementIds2) {
|
|
17090
|
+
UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
17091
|
+
})(UiPathElementIds || (UiPathElementIds = {}));
|
|
16751
17092
|
function getMetaTagContent(name) {
|
|
16752
17093
|
if (!isBrowser2)
|
|
16753
17094
|
return;
|
|
@@ -16768,7 +17109,54 @@ function loadFromMetaTags() {
|
|
|
16768
17109
|
const hasAnyValue = Object.values(config2).some(Boolean);
|
|
16769
17110
|
return hasAnyValue ? config2 : null;
|
|
16770
17111
|
}
|
|
17112
|
+
function readEnv(name) {
|
|
17113
|
+
const globals = globalThis;
|
|
17114
|
+
try {
|
|
17115
|
+
const fromNode = globals.process?.env?.[name];
|
|
17116
|
+
if (fromNode)
|
|
17117
|
+
return fromNode;
|
|
17118
|
+
} catch {}
|
|
17119
|
+
try {
|
|
17120
|
+
const fromDeno = globals.Deno?.env?.get?.(name);
|
|
17121
|
+
if (fromDeno)
|
|
17122
|
+
return fromDeno;
|
|
17123
|
+
} catch {}
|
|
17124
|
+
return;
|
|
17125
|
+
}
|
|
17126
|
+
var UiPathEnvVars = {
|
|
17127
|
+
BASE_URL: "UIPATH_BASE_URL",
|
|
17128
|
+
ORG_NAME: "UIPATH_ORG_NAME",
|
|
17129
|
+
TENANT_NAME: "UIPATH_TENANT_NAME",
|
|
17130
|
+
ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
|
|
17131
|
+
};
|
|
17132
|
+
function loadFromEnvironment() {
|
|
17133
|
+
if (isBrowser2)
|
|
17134
|
+
return null;
|
|
17135
|
+
const config2 = {
|
|
17136
|
+
baseUrl: readEnv(UiPathEnvVars.BASE_URL),
|
|
17137
|
+
orgName: readEnv(UiPathEnvVars.ORG_NAME),
|
|
17138
|
+
tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
|
|
17139
|
+
secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
|
|
17140
|
+
};
|
|
17141
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
17142
|
+
}
|
|
17143
|
+
function isFunctionContext(value) {
|
|
17144
|
+
return "platform" in value || "robot" in value;
|
|
17145
|
+
}
|
|
17146
|
+
function configFromFunctionContext(context) {
|
|
17147
|
+
const { platform, robot } = context;
|
|
17148
|
+
if (!platform)
|
|
17149
|
+
return null;
|
|
17150
|
+
const config2 = {
|
|
17151
|
+
baseUrl: platform.baseUrl,
|
|
17152
|
+
orgName: platform.orgId,
|
|
17153
|
+
tenantName: platform.tenantId,
|
|
17154
|
+
secret: robot?.accessToken ?? undefined
|
|
17155
|
+
};
|
|
17156
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
17157
|
+
}
|
|
16771
17158
|
var _UiPath_instances;
|
|
17159
|
+
var _a;
|
|
16772
17160
|
var _UiPath_config;
|
|
16773
17161
|
var _UiPath_authService;
|
|
16774
17162
|
var _UiPath_initialized;
|
|
@@ -16777,6 +17165,7 @@ var _UiPath_metaFolderKey;
|
|
|
16777
17165
|
var _UiPath_metaOrgId;
|
|
16778
17166
|
var _UiPath_metaTenantId;
|
|
16779
17167
|
var _UiPath_initializeWithConfig;
|
|
17168
|
+
var _UiPath_mergeConfigSources;
|
|
16780
17169
|
var _UiPath_loadConfig;
|
|
16781
17170
|
var UiPath$1 = class UiPath {
|
|
16782
17171
|
constructor(config2) {
|
|
@@ -16788,15 +17177,16 @@ var UiPath$1 = class UiPath {
|
|
|
16788
17177
|
_UiPath_metaFolderKey.set(this, undefined);
|
|
16789
17178
|
_UiPath_metaOrgId.set(this, undefined);
|
|
16790
17179
|
_UiPath_metaTenantId.set(this, undefined);
|
|
17180
|
+
const resolved = config2 && isFunctionContext(config2) ? configFromFunctionContext(config2) ?? undefined : config2;
|
|
16791
17181
|
const configFromMetaTags = loadFromMetaTags();
|
|
16792
17182
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
16793
17183
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
|
|
16794
17184
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
|
|
16795
|
-
const mergedConfig =
|
|
17185
|
+
const mergedConfig = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, configFromMetaTags, resolved);
|
|
16796
17186
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
16797
17187
|
__classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
|
|
16798
|
-
} else if (
|
|
16799
|
-
__classPrivateFieldSet(this, _UiPath_partialConfig,
|
|
17188
|
+
} else if (resolved) {
|
|
17189
|
+
__classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
|
|
16800
17190
|
}
|
|
16801
17191
|
}
|
|
16802
17192
|
async initialize() {
|
|
@@ -16861,18 +17251,18 @@ var UiPath$1 = class UiPath {
|
|
|
16861
17251
|
destroy() {
|
|
16862
17252
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
|
|
16863
17253
|
}
|
|
16864
|
-
logout() {
|
|
17254
|
+
logout(options) {
|
|
16865
17255
|
if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
|
|
16866
17256
|
return;
|
|
16867
17257
|
}
|
|
16868
|
-
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
|
|
17258
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout(options);
|
|
16869
17259
|
__classPrivateFieldSet(this, _UiPath_initialized, false, "f");
|
|
16870
17260
|
}
|
|
16871
17261
|
updateToken(tokenInfo) {
|
|
16872
17262
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
16873
17263
|
}
|
|
16874
17264
|
};
|
|
16875
|
-
_UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
|
|
17265
|
+
_a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
|
|
16876
17266
|
validateConfig(config2);
|
|
16877
17267
|
const hasSecretAuth = hasSecretConfig(config2);
|
|
16878
17268
|
const hasOAuthAuth = hasOAuthConfig(config2);
|
|
@@ -16883,7 +17273,8 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
16883
17273
|
secret: hasSecretAuth ? config2.secret : undefined,
|
|
16884
17274
|
clientId: hasOAuthAuth ? config2.clientId : undefined,
|
|
16885
17275
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined,
|
|
16886
|
-
scope: hasOAuthAuth ? config2.scope : undefined
|
|
17276
|
+
scope: hasOAuthAuth ? config2.scope : undefined,
|
|
17277
|
+
enforceSso: config2.enforceSso
|
|
16887
17278
|
});
|
|
16888
17279
|
const executionContext = new ExecutionContext;
|
|
16889
17280
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -16909,18 +17300,35 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
16909
17300
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined
|
|
16910
17301
|
});
|
|
16911
17302
|
trackEvent("Sdk.Auth");
|
|
16912
|
-
if (hasSecretAuth || isInActionCenter ||
|
|
17303
|
+
if (hasSecretAuth || isInActionCenter || hostEmbeddingOrigin) {
|
|
16913
17304
|
__classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config2.secret ?? "");
|
|
16914
17305
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
16915
17306
|
}
|
|
17307
|
+
}, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config2) {
|
|
17308
|
+
const layers = [loadFromEnvironment(), metaConfig, config2].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
|
|
17309
|
+
if (layers.length === 0)
|
|
17310
|
+
return;
|
|
17311
|
+
const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
|
|
17312
|
+
const namesSecret = config2 ? hasSecretConfig(config2) : false;
|
|
17313
|
+
const namesOAuth = Boolean(config2?.clientId || config2?.redirectUri || config2?.scope);
|
|
17314
|
+
if (namesSecret !== namesOAuth) {
|
|
17315
|
+
if (namesSecret) {
|
|
17316
|
+
delete merged.clientId;
|
|
17317
|
+
delete merged.redirectUri;
|
|
17318
|
+
delete merged.scope;
|
|
17319
|
+
} else {
|
|
17320
|
+
delete merged.secret;
|
|
17321
|
+
}
|
|
17322
|
+
}
|
|
17323
|
+
return merged;
|
|
16916
17324
|
}, _UiPath_loadConfig = function _UiPath_loadConfig2() {
|
|
16917
17325
|
const metaConfig = loadFromMetaTags();
|
|
16918
17326
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
16919
17327
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
|
|
16920
17328
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
|
|
16921
|
-
const merged =
|
|
16922
|
-
if (!isCompleteConfig(merged)) {
|
|
16923
|
-
throw new Error(
|
|
17329
|
+
const merged = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
|
|
17330
|
+
if (!merged || !isCompleteConfig(merged)) {
|
|
17331
|
+
throw new Error(missingConfigMessage());
|
|
16924
17332
|
}
|
|
16925
17333
|
return merged;
|
|
16926
17334
|
};
|
|
@@ -17098,8 +17506,177 @@ var RESPONSE_TYPES = {
|
|
|
17098
17506
|
JSON: "json",
|
|
17099
17507
|
TEXT: "text",
|
|
17100
17508
|
BLOB: "blob",
|
|
17101
|
-
ARRAYBUFFER: "arraybuffer"
|
|
17509
|
+
ARRAYBUFFER: "arraybuffer",
|
|
17510
|
+
STREAM: "stream"
|
|
17511
|
+
};
|
|
17512
|
+
function createParams(paramsObj = {}) {
|
|
17513
|
+
const params = {};
|
|
17514
|
+
for (const [key, value] of Object.entries(paramsObj)) {
|
|
17515
|
+
if (value !== undefined && value !== null) {
|
|
17516
|
+
params[key] = value;
|
|
17517
|
+
}
|
|
17518
|
+
}
|
|
17519
|
+
return params;
|
|
17520
|
+
}
|
|
17521
|
+
function toSearchParams(params) {
|
|
17522
|
+
const searchParams = new URLSearchParams;
|
|
17523
|
+
if (!params)
|
|
17524
|
+
return searchParams;
|
|
17525
|
+
for (const [key, value] of Object.entries(params)) {
|
|
17526
|
+
if (value === undefined || value === null)
|
|
17527
|
+
continue;
|
|
17528
|
+
if (Array.isArray(value)) {
|
|
17529
|
+
value.forEach((item) => {
|
|
17530
|
+
if (item !== undefined && item !== null)
|
|
17531
|
+
searchParams.append(key, String(item));
|
|
17532
|
+
});
|
|
17533
|
+
} else {
|
|
17534
|
+
searchParams.append(key, String(value));
|
|
17535
|
+
}
|
|
17536
|
+
}
|
|
17537
|
+
return searchParams;
|
|
17538
|
+
}
|
|
17539
|
+
var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
|
|
17540
|
+
var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
|
|
17541
|
+
var DEFAULT_RETRY_OPTIONS = {
|
|
17542
|
+
maxRetries: 2,
|
|
17543
|
+
initialDelayMs: 500,
|
|
17544
|
+
backoffStrategy: "exponential",
|
|
17545
|
+
backoffFactor: 2,
|
|
17546
|
+
backoffMaxDelayMs: 30000,
|
|
17547
|
+
retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
|
|
17548
|
+
retryMethods: DEFAULT_RETRY_METHODS,
|
|
17549
|
+
retryNetworkErrors: true,
|
|
17550
|
+
respectRetryAfter: true,
|
|
17551
|
+
maxRetryAfterMs: Infinity
|
|
17552
|
+
};
|
|
17553
|
+
var DEFAULT_API_CLIENT_RETRY = {
|
|
17554
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
17555
|
+
maxRetries: 0
|
|
17102
17556
|
};
|
|
17557
|
+
function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
|
|
17558
|
+
if (!settings)
|
|
17559
|
+
return defaults;
|
|
17560
|
+
const { retryDelay, useExponentialBackoff, ...live } = settings;
|
|
17561
|
+
const resolved = { ...defaults };
|
|
17562
|
+
for (const [key, value] of Object.entries(live)) {
|
|
17563
|
+
if (value !== undefined) {
|
|
17564
|
+
resolved[key] = value;
|
|
17565
|
+
}
|
|
17566
|
+
}
|
|
17567
|
+
if (retryDelay !== undefined && live.initialDelayMs === undefined) {
|
|
17568
|
+
resolved.initialDelayMs = retryDelay;
|
|
17569
|
+
}
|
|
17570
|
+
if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
|
|
17571
|
+
resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
|
|
17572
|
+
}
|
|
17573
|
+
return resolved;
|
|
17574
|
+
}
|
|
17575
|
+
function computeBackoffDelay(attempt, settings) {
|
|
17576
|
+
const base = Math.max(0, settings.initialDelayMs);
|
|
17577
|
+
let delay;
|
|
17578
|
+
switch (settings.backoffStrategy) {
|
|
17579
|
+
case "constant":
|
|
17580
|
+
delay = base;
|
|
17581
|
+
break;
|
|
17582
|
+
case "linear":
|
|
17583
|
+
delay = base * (attempt + 1);
|
|
17584
|
+
break;
|
|
17585
|
+
default:
|
|
17586
|
+
delay = base * Math.pow(settings.backoffFactor, attempt);
|
|
17587
|
+
}
|
|
17588
|
+
return Math.min(delay, settings.backoffMaxDelayMs);
|
|
17589
|
+
}
|
|
17590
|
+
function parseRetryAfter(value, now = Date.now()) {
|
|
17591
|
+
const trimmed = value?.trim();
|
|
17592
|
+
if (!trimmed)
|
|
17593
|
+
return;
|
|
17594
|
+
const seconds = Number(trimmed);
|
|
17595
|
+
if (Number.isFinite(seconds))
|
|
17596
|
+
return Math.max(0, seconds * 1000);
|
|
17597
|
+
const date2 = Date.parse(trimmed);
|
|
17598
|
+
if (Number.isNaN(date2))
|
|
17599
|
+
return;
|
|
17600
|
+
return Math.max(0, date2 - now);
|
|
17601
|
+
}
|
|
17602
|
+
function wait(durationMs) {
|
|
17603
|
+
return new Promise((resolve2) => setTimeout(resolve2, Math.max(0, durationMs)));
|
|
17604
|
+
}
|
|
17605
|
+
var RETRY_AFTER = "retry-after";
|
|
17606
|
+
function createAttemptSignal(timeoutMs, external) {
|
|
17607
|
+
if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
|
|
17608
|
+
return { signal: external, dispose: () => {} };
|
|
17609
|
+
const controller = new AbortController;
|
|
17610
|
+
const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
17611
|
+
const onExternalAbort = () => controller.abort(external?.reason);
|
|
17612
|
+
if (external) {
|
|
17613
|
+
if (external.aborted) {
|
|
17614
|
+
controller.abort(external.reason);
|
|
17615
|
+
} else {
|
|
17616
|
+
external.addEventListener("abort", onExternalAbort);
|
|
17617
|
+
}
|
|
17618
|
+
}
|
|
17619
|
+
return {
|
|
17620
|
+
signal: controller.signal,
|
|
17621
|
+
dispose: () => {
|
|
17622
|
+
clearTimeout(timer);
|
|
17623
|
+
external?.removeEventListener("abort", onExternalAbort);
|
|
17624
|
+
}
|
|
17625
|
+
};
|
|
17626
|
+
}
|
|
17627
|
+
function delayBeforeRetry(durationMs, signal) {
|
|
17628
|
+
if (!signal)
|
|
17629
|
+
return wait(durationMs);
|
|
17630
|
+
if (signal.aborted)
|
|
17631
|
+
return Promise.reject(signal.reason);
|
|
17632
|
+
return new Promise((resolve2, reject) => {
|
|
17633
|
+
const onAbort = () => {
|
|
17634
|
+
clearTimeout(timer);
|
|
17635
|
+
reject(signal.reason);
|
|
17636
|
+
};
|
|
17637
|
+
const timer = setTimeout(() => {
|
|
17638
|
+
signal.removeEventListener("abort", onAbort);
|
|
17639
|
+
resolve2();
|
|
17640
|
+
}, Math.max(0, durationMs));
|
|
17641
|
+
signal.addEventListener("abort", onAbort);
|
|
17642
|
+
});
|
|
17643
|
+
}
|
|
17644
|
+
async function fetchWithRetry(url, init, options) {
|
|
17645
|
+
const settings = options.retry;
|
|
17646
|
+
const method = (init.method ?? "GET").toUpperCase();
|
|
17647
|
+
const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
|
|
17648
|
+
let attempt = 0;
|
|
17649
|
+
for (;; ) {
|
|
17650
|
+
const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
|
|
17651
|
+
let response;
|
|
17652
|
+
let failure;
|
|
17653
|
+
try {
|
|
17654
|
+
response = await fetch(url, { ...init, signal });
|
|
17655
|
+
} catch (error) {
|
|
17656
|
+
failure = error;
|
|
17657
|
+
} finally {
|
|
17658
|
+
dispose();
|
|
17659
|
+
}
|
|
17660
|
+
if (options.signal?.aborted && failure !== undefined)
|
|
17661
|
+
throw failure;
|
|
17662
|
+
if (response && !settings.retryableStatusCodes.includes(response.status))
|
|
17663
|
+
return response;
|
|
17664
|
+
if (failure !== undefined && !settings.retryNetworkErrors)
|
|
17665
|
+
throw failure;
|
|
17666
|
+
if (attempt >= retriesAllowed) {
|
|
17667
|
+
if (response)
|
|
17668
|
+
return response;
|
|
17669
|
+
throw failure;
|
|
17670
|
+
}
|
|
17671
|
+
const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
|
|
17672
|
+
const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
|
|
17673
|
+
response?.body?.cancel().catch((error) => {
|
|
17674
|
+
console.warn("[UiPath SDK] Could not release a discarded response body:", error);
|
|
17675
|
+
});
|
|
17676
|
+
await delayBeforeRetry(delay, options.signal);
|
|
17677
|
+
attempt++;
|
|
17678
|
+
}
|
|
17679
|
+
}
|
|
17103
17680
|
|
|
17104
17681
|
class ApiClient {
|
|
17105
17682
|
constructor(config2, executionContext, tokenManager, clientConfig = {}) {
|
|
@@ -17134,28 +17711,16 @@ class ApiClient {
|
|
|
17134
17711
|
[UIPATH_TRACEPARENT_ID]: traceparentValue,
|
|
17135
17712
|
...options.headers
|
|
17136
17713
|
};
|
|
17137
|
-
const searchParams =
|
|
17138
|
-
if (options.params) {
|
|
17139
|
-
Object.entries(options.params).forEach(([key, value]) => {
|
|
17140
|
-
if (Array.isArray(value)) {
|
|
17141
|
-
value.forEach((item) => searchParams.append(key, String(item)));
|
|
17142
|
-
} else {
|
|
17143
|
-
searchParams.append(key, String(value));
|
|
17144
|
-
}
|
|
17145
|
-
});
|
|
17146
|
-
}
|
|
17714
|
+
const searchParams = toSearchParams(options.params);
|
|
17147
17715
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
17148
17716
|
let body = undefined;
|
|
17149
17717
|
if (options.body) {
|
|
17150
17718
|
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
17151
17719
|
}
|
|
17720
|
+
const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
|
|
17721
|
+
const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
|
|
17152
17722
|
try {
|
|
17153
|
-
const response = await
|
|
17154
|
-
method,
|
|
17155
|
-
headers,
|
|
17156
|
-
body,
|
|
17157
|
-
signal: options.signal
|
|
17158
|
-
});
|
|
17723
|
+
const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
|
|
17159
17724
|
if (!response.ok) {
|
|
17160
17725
|
const errorInfo = await errorResponseParser.parse(response);
|
|
17161
17726
|
throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
|
|
@@ -17871,36 +18436,36 @@ function createEntityMethods(entityData, service) {
|
|
|
17871
18436
|
async insertRecord(data, options) {
|
|
17872
18437
|
if (!entityData.id)
|
|
17873
18438
|
throw new Error("Entity ID is undefined");
|
|
17874
|
-
return service.
|
|
18439
|
+
return service.insertRecord({ id: entityData.id }, data, options);
|
|
17875
18440
|
},
|
|
17876
18441
|
async insertRecords(data, options) {
|
|
17877
18442
|
if (!entityData.id)
|
|
17878
18443
|
throw new Error("Entity ID is undefined");
|
|
17879
|
-
return service.
|
|
18444
|
+
return service.insertRecords({ id: entityData.id }, data, options);
|
|
17880
18445
|
},
|
|
17881
18446
|
async updateRecord(recordId, data, options) {
|
|
17882
18447
|
if (!entityData.id)
|
|
17883
18448
|
throw new Error("Entity ID is undefined");
|
|
17884
18449
|
if (!recordId)
|
|
17885
18450
|
throw new Error("Record ID is undefined");
|
|
17886
|
-
return service.
|
|
18451
|
+
return service.updateRecord({ id: entityData.id }, recordId, data, options);
|
|
17887
18452
|
},
|
|
17888
18453
|
async updateRecords(data, options) {
|
|
17889
18454
|
if (!entityData.id)
|
|
17890
18455
|
throw new Error("Entity ID is undefined");
|
|
17891
|
-
return service.
|
|
18456
|
+
return service.updateRecords({ id: entityData.id }, data, options);
|
|
17892
18457
|
},
|
|
17893
18458
|
async deleteRecords(recordIds, options) {
|
|
17894
18459
|
if (!entityData.id)
|
|
17895
18460
|
throw new Error("Entity ID is undefined");
|
|
17896
|
-
return service.
|
|
18461
|
+
return service.deleteRecords({ id: entityData.id }, recordIds, options);
|
|
17897
18462
|
},
|
|
17898
18463
|
async deleteRecord(recordId, options) {
|
|
17899
18464
|
if (!entityData.id)
|
|
17900
18465
|
throw new Error("Entity ID is undefined");
|
|
17901
18466
|
if (!recordId)
|
|
17902
18467
|
throw new Error("Record ID is undefined");
|
|
17903
|
-
return service.
|
|
18468
|
+
return service.deleteRecord({ id: entityData.id }, recordId, options);
|
|
17904
18469
|
},
|
|
17905
18470
|
async getAllRecords(options) {
|
|
17906
18471
|
if (!entityData.id)
|
|
@@ -17917,27 +18482,27 @@ function createEntityMethods(entityData, service) {
|
|
|
17917
18482
|
async downloadAttachment(recordId, fieldName, options) {
|
|
17918
18483
|
if (!entityData.id)
|
|
17919
18484
|
throw new Error("Entity ID is undefined");
|
|
17920
|
-
return service.downloadAttachment(entityData.id, recordId, fieldName, options);
|
|
18485
|
+
return service.downloadAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
17921
18486
|
},
|
|
17922
18487
|
async uploadAttachment(recordId, fieldName, file, options) {
|
|
17923
18488
|
if (!entityData.id)
|
|
17924
18489
|
throw new Error("Entity ID is undefined");
|
|
17925
|
-
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
18490
|
+
return service.uploadAttachment({ id: entityData.id }, recordId, fieldName, file, options);
|
|
17926
18491
|
},
|
|
17927
18492
|
async deleteAttachment(recordId, fieldName, options) {
|
|
17928
18493
|
if (!entityData.id)
|
|
17929
18494
|
throw new Error("Entity ID is undefined");
|
|
17930
|
-
return service.deleteAttachment(entityData.id, recordId, fieldName, options);
|
|
18495
|
+
return service.deleteAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
17931
18496
|
},
|
|
17932
18497
|
async queryRecords(options) {
|
|
17933
18498
|
if (!entityData.id)
|
|
17934
18499
|
throw new Error("Entity ID is undefined");
|
|
17935
|
-
return service.
|
|
18500
|
+
return service.queryRecords({ id: entityData.id }, options);
|
|
17936
18501
|
},
|
|
17937
18502
|
async importRecords(file, options) {
|
|
17938
18503
|
if (!entityData.id)
|
|
17939
18504
|
throw new Error("Entity ID is undefined");
|
|
17940
|
-
return service.
|
|
18505
|
+
return service.importRecords({ id: entityData.id }, file, options);
|
|
17941
18506
|
},
|
|
17942
18507
|
async insert(data, options) {
|
|
17943
18508
|
return this.insertRecord(data, options);
|
|
@@ -18013,6 +18578,15 @@ var EntityAggregateFunction;
|
|
|
18013
18578
|
EntityAggregateFunction2["Min"] = "MIN";
|
|
18014
18579
|
EntityAggregateFunction2["Max"] = "MAX";
|
|
18015
18580
|
})(EntityAggregateFunction || (EntityAggregateFunction = {}));
|
|
18581
|
+
var EntityHavingOperator;
|
|
18582
|
+
(function(EntityHavingOperator2) {
|
|
18583
|
+
EntityHavingOperator2["Equals"] = "=";
|
|
18584
|
+
EntityHavingOperator2["NotEquals"] = "!=";
|
|
18585
|
+
EntityHavingOperator2["GreaterThan"] = ">";
|
|
18586
|
+
EntityHavingOperator2["GreaterThanOrEqual"] = ">=";
|
|
18587
|
+
EntityHavingOperator2["LessThan"] = "<";
|
|
18588
|
+
EntityHavingOperator2["LessThanOrEqual"] = "<=";
|
|
18589
|
+
})(EntityHavingOperator || (EntityHavingOperator = {}));
|
|
18016
18590
|
var EntityType;
|
|
18017
18591
|
(function(EntityType2) {
|
|
18018
18592
|
EntityType2["Entity"] = "Entity";
|
|
@@ -18043,15 +18617,6 @@ var JoinType;
|
|
|
18043
18617
|
JoinType2["LeftJoin"] = "LeftJoin";
|
|
18044
18618
|
JoinType2["InnerJoin"] = "InnerJoin";
|
|
18045
18619
|
})(JoinType || (JoinType = {}));
|
|
18046
|
-
function createParams(paramsObj = {}) {
|
|
18047
|
-
const params = {};
|
|
18048
|
-
for (const [key, value] of Object.entries(paramsObj)) {
|
|
18049
|
-
if (value !== undefined && value !== null) {
|
|
18050
|
-
params[key] = value;
|
|
18051
|
-
}
|
|
18052
|
-
}
|
|
18053
|
-
return params;
|
|
18054
|
-
}
|
|
18055
18620
|
var EntityFieldConstraint;
|
|
18056
18621
|
(function(EntityFieldConstraint2) {
|
|
18057
18622
|
EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
|
|
@@ -18190,95 +18755,84 @@ function toWireJoin(join2, baseEntityName) {
|
|
|
18190
18755
|
}
|
|
18191
18756
|
};
|
|
18192
18757
|
}
|
|
18758
|
+
function unwrapEntityRef(entityRef, callerLabel) {
|
|
18759
|
+
const { id, name } = entityRef ?? {};
|
|
18760
|
+
if (id && name) {
|
|
18761
|
+
throw new ValidationError({
|
|
18762
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name', not both.`
|
|
18763
|
+
});
|
|
18764
|
+
}
|
|
18765
|
+
if (id) {
|
|
18766
|
+
return { byId: true, identifier: id };
|
|
18767
|
+
}
|
|
18768
|
+
if (name) {
|
|
18769
|
+
return { byId: false, identifier: name };
|
|
18770
|
+
}
|
|
18771
|
+
throw new ValidationError({
|
|
18772
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
|
|
18773
|
+
});
|
|
18774
|
+
}
|
|
18193
18775
|
|
|
18194
18776
|
class EntityService extends BaseService {
|
|
18195
18777
|
async getById(id, options) {
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
return
|
|
18778
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
|
|
18779
|
+
}
|
|
18780
|
+
async getByName(entityName, options) {
|
|
18781
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
|
|
18200
18782
|
}
|
|
18201
18783
|
async getAllRecords(entityId, options) {
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
|
|
18207
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
18208
|
-
pagination: {
|
|
18209
|
-
paginationType: PaginationType.OFFSET,
|
|
18210
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
18211
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
18212
|
-
paginationParams: {
|
|
18213
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
18214
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
18215
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
18216
|
-
}
|
|
18217
|
-
},
|
|
18218
|
-
excludeFromPrefix: ["expansionLevel"]
|
|
18219
|
-
}, downstreamOptions);
|
|
18784
|
+
return this.getRecordsImpl(true, entityId, options);
|
|
18785
|
+
}
|
|
18786
|
+
async getRecordsByName(entityName, options) {
|
|
18787
|
+
return this.getRecordsImpl(false, entityName, options);
|
|
18220
18788
|
}
|
|
18221
18789
|
async getRecordById(entityId, recordId, options = {}) {
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18790
|
+
return this.getRecordImpl(true, entityId, recordId, options);
|
|
18791
|
+
}
|
|
18792
|
+
async getRecordByName(entityName, recordId, options = {}) {
|
|
18793
|
+
return this.getRecordImpl(false, entityName, recordId, options);
|
|
18794
|
+
}
|
|
18795
|
+
async insertRecord(entityRef, data, options = {}) {
|
|
18796
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
|
|
18797
|
+
return this.insertRecordImpl(byId, identifier, data, options);
|
|
18227
18798
|
}
|
|
18228
18799
|
async insertRecordById(id, data, options = {}) {
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
const
|
|
18233
|
-
|
|
18234
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
18235
|
-
});
|
|
18236
|
-
return response.data;
|
|
18800
|
+
return this.insertRecordImpl(true, id, data, options);
|
|
18801
|
+
}
|
|
18802
|
+
async insertRecords(entityRef, data, options = {}) {
|
|
18803
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecords");
|
|
18804
|
+
return this.insertRecordsImpl(byId, identifier, data, options);
|
|
18237
18805
|
}
|
|
18238
18806
|
async insertRecordsById(id, data, options = {}) {
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
});
|
|
18243
|
-
|
|
18244
|
-
params,
|
|
18245
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
18246
|
-
});
|
|
18247
|
-
return response.data;
|
|
18807
|
+
return this.insertRecordsImpl(true, id, data, options);
|
|
18808
|
+
}
|
|
18809
|
+
async updateRecord(entityRef, recordId, data, options = {}) {
|
|
18810
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecord");
|
|
18811
|
+
return this.updateRecordImpl(byId, identifier, recordId, data, options);
|
|
18248
18812
|
}
|
|
18249
18813
|
async updateRecordById(entityId, recordId, data, options = {}) {
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
const
|
|
18254
|
-
|
|
18255
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
18256
|
-
});
|
|
18257
|
-
return response.data;
|
|
18814
|
+
return this.updateRecordImpl(true, entityId, recordId, data, options);
|
|
18815
|
+
}
|
|
18816
|
+
async updateRecords(entityRef, data, options = {}) {
|
|
18817
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecords");
|
|
18818
|
+
return this.updateRecordsImpl(byId, identifier, data, options);
|
|
18258
18819
|
}
|
|
18259
18820
|
async updateRecordsById(id, data, options = {}) {
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
});
|
|
18264
|
-
|
|
18265
|
-
params,
|
|
18266
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
18267
|
-
});
|
|
18268
|
-
return response.data;
|
|
18821
|
+
return this.updateRecordsImpl(true, id, data, options);
|
|
18822
|
+
}
|
|
18823
|
+
async deleteRecords(entityRef, recordIds, options = {}) {
|
|
18824
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
|
|
18825
|
+
return this.deleteRecordsImpl(byId, identifier, recordIds, options);
|
|
18269
18826
|
}
|
|
18270
18827
|
async deleteRecordsById(id, recordIds, options = {}) {
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
const
|
|
18275
|
-
|
|
18276
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
18277
|
-
});
|
|
18278
|
-
return response.data;
|
|
18828
|
+
return this.deleteRecordsImpl(true, id, recordIds, options);
|
|
18829
|
+
}
|
|
18830
|
+
async deleteRecord(entityRef, recordId, options) {
|
|
18831
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecord");
|
|
18832
|
+
return this.deleteRecordImpl(byId, identifier, recordId, options);
|
|
18279
18833
|
}
|
|
18280
18834
|
async deleteRecordById(entityId, recordId, options) {
|
|
18281
|
-
|
|
18835
|
+
return this.deleteRecordImpl(true, entityId, recordId, options);
|
|
18282
18836
|
}
|
|
18283
18837
|
async getAll(options) {
|
|
18284
18838
|
const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
|
|
@@ -18290,62 +18844,30 @@ class EntityService extends BaseService {
|
|
|
18290
18844
|
});
|
|
18291
18845
|
return entities;
|
|
18292
18846
|
}
|
|
18847
|
+
async queryRecords(entityRef, options) {
|
|
18848
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.queryRecords");
|
|
18849
|
+
return this.queryRecordsImpl(byId, identifier, options);
|
|
18850
|
+
}
|
|
18293
18851
|
async queryRecordsById(id, options) {
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
18300
|
-
throw new ValidationError({
|
|
18301
|
-
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
18302
|
-
});
|
|
18303
|
-
}
|
|
18304
|
-
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
18305
|
-
let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
|
|
18306
|
-
if (options?.joins && options.joins.length > 0) {
|
|
18307
|
-
const baseEntityName = await this.resolveEntityName(id, folderKey);
|
|
18308
|
-
rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
|
|
18309
|
-
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
18310
|
-
}
|
|
18311
|
-
const downstreamOptions = options === undefined ? undefined : rest;
|
|
18312
|
-
return PaginationHelpers.getAll({
|
|
18313
|
-
serviceAccess: this.createPaginationServiceAccess(),
|
|
18314
|
-
getEndpoint,
|
|
18315
|
-
method: HTTP_METHODS.POST,
|
|
18316
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
18317
|
-
queryParams: createParams({ expansionLevel }),
|
|
18318
|
-
pagination: {
|
|
18319
|
-
paginationType: PaginationType.OFFSET,
|
|
18320
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
18321
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
18322
|
-
paginationParams: {
|
|
18323
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
18324
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
18325
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
18326
|
-
}
|
|
18327
|
-
},
|
|
18328
|
-
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins"]
|
|
18329
|
-
}, downstreamOptions);
|
|
18852
|
+
return this.queryRecordsImpl(true, id, options);
|
|
18853
|
+
}
|
|
18854
|
+
async importRecords(entityRef, file, options) {
|
|
18855
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.importRecords");
|
|
18856
|
+
return this.importRecordsImpl(byId, identifier, file, options);
|
|
18330
18857
|
}
|
|
18331
18858
|
async importRecordsById(id, file, options) {
|
|
18332
|
-
|
|
18333
|
-
if (file instanceof Uint8Array) {
|
|
18334
|
-
formData.append("file", new Blob([file.buffer]));
|
|
18335
|
-
} else {
|
|
18336
|
-
formData.append("file", file);
|
|
18337
|
-
}
|
|
18338
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
18339
|
-
return response.data;
|
|
18859
|
+
return this.importRecordsImpl(true, id, file, options);
|
|
18340
18860
|
}
|
|
18341
|
-
async downloadAttachment(
|
|
18342
|
-
const
|
|
18861
|
+
async downloadAttachment(entityRef, recordId, fieldName, options) {
|
|
18862
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.downloadAttachment");
|
|
18863
|
+
const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), {
|
|
18343
18864
|
responseType: RESPONSE_TYPES.BLOB,
|
|
18344
18865
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
18345
18866
|
});
|
|
18346
18867
|
return response.data;
|
|
18347
18868
|
}
|
|
18348
|
-
async uploadAttachment(
|
|
18869
|
+
async uploadAttachment(entityRef, recordId, fieldName, file, options) {
|
|
18870
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.uploadAttachment");
|
|
18349
18871
|
const formData = new FormData;
|
|
18350
18872
|
if (file instanceof Uint8Array) {
|
|
18351
18873
|
formData.append("file", new Blob([file.buffer]));
|
|
@@ -18353,14 +18875,15 @@ class EntityService extends BaseService {
|
|
|
18353
18875
|
formData.append("file", file);
|
|
18354
18876
|
}
|
|
18355
18877
|
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
18356
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
18878
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), formData, {
|
|
18357
18879
|
params,
|
|
18358
18880
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
18359
18881
|
});
|
|
18360
18882
|
return response.data;
|
|
18361
18883
|
}
|
|
18362
|
-
async deleteAttachment(
|
|
18363
|
-
const
|
|
18884
|
+
async deleteAttachment(entityRef, recordId, fieldName, options) {
|
|
18885
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteAttachment");
|
|
18886
|
+
const response = await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
18364
18887
|
return response.data;
|
|
18365
18888
|
}
|
|
18366
18889
|
async getRecordsById(entityId, options) {
|
|
@@ -18397,11 +18920,16 @@ class EntityService extends BaseService {
|
|
|
18397
18920
|
const opts = options ?? {};
|
|
18398
18921
|
const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
|
|
18399
18922
|
const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
|
|
18923
|
+
if (!hasSchemaChanges && !hasMetadataChanges) {
|
|
18924
|
+
throw new ValidationError({
|
|
18925
|
+
message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or isRbacEnabled."
|
|
18926
|
+
});
|
|
18927
|
+
}
|
|
18400
18928
|
if (hasSchemaChanges) {
|
|
18401
18929
|
await this.applySchemaUpdate(id, opts);
|
|
18402
18930
|
}
|
|
18403
18931
|
if (hasMetadataChanges) {
|
|
18404
|
-
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.
|
|
18932
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE(id), {
|
|
18405
18933
|
...opts.displayName !== undefined && { displayName: opts.displayName },
|
|
18406
18934
|
...opts.description !== undefined && { description: opts.description },
|
|
18407
18935
|
...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
|
|
@@ -18414,10 +18942,24 @@ class EntityService extends BaseService {
|
|
|
18414
18942
|
const raw = entityResponse.data;
|
|
18415
18943
|
let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
|
|
18416
18944
|
if (options.removeFields?.length) {
|
|
18945
|
+
const existingNames = new Set(fields.map((f) => f.name));
|
|
18946
|
+
const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
|
|
18947
|
+
if (missing.length) {
|
|
18948
|
+
throw new ValidationError({
|
|
18949
|
+
message: `Cannot remove field(s) — no matching non-system field found for name(s): ${missing.join(", ")}.`
|
|
18950
|
+
});
|
|
18951
|
+
}
|
|
18417
18952
|
const removeSet = new Set(options.removeFields.map((r) => r.name));
|
|
18418
18953
|
fields = fields.filter((f) => !removeSet.has(f.name));
|
|
18419
18954
|
}
|
|
18420
18955
|
if (options.updateFields?.length) {
|
|
18956
|
+
const existingIds = new Set(fields.map((f) => f.id));
|
|
18957
|
+
const missing = options.updateFields.filter((u) => !existingIds.has(u.id)).map((u) => u.id);
|
|
18958
|
+
if (missing.length) {
|
|
18959
|
+
throw new ValidationError({
|
|
18960
|
+
message: `Cannot update field(s) — no matching non-system field found for id(s): ${missing.join(", ")}.`
|
|
18961
|
+
});
|
|
18962
|
+
}
|
|
18421
18963
|
const updateMap = new Map(options.updateFields.map((u) => [u.id, u]));
|
|
18422
18964
|
fields = fields.map((f) => {
|
|
18423
18965
|
const update = updateMap.get(f.id ?? "");
|
|
@@ -18667,40 +19209,185 @@ class EntityService extends BaseService {
|
|
|
18667
19209
|
return {};
|
|
18668
19210
|
}
|
|
18669
19211
|
}
|
|
19212
|
+
async fetchEntityMetadata(endpoint, folderKey) {
|
|
19213
|
+
const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
19214
|
+
const metadata = transformData(response.data, EntityMap);
|
|
19215
|
+
this.applyFieldMappings(metadata);
|
|
19216
|
+
return createEntityWithMethods(metadata, this);
|
|
19217
|
+
}
|
|
19218
|
+
getRecordsImpl(byId, identifier, options) {
|
|
19219
|
+
const { folderKey, ...rest } = options ?? {};
|
|
19220
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
19221
|
+
return PaginationHelpers.getAll({
|
|
19222
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
19223
|
+
getEndpoint: () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS_BY_NAME(identifier),
|
|
19224
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
19225
|
+
pagination: {
|
|
19226
|
+
paginationType: PaginationType.OFFSET,
|
|
19227
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
19228
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
19229
|
+
paginationParams: {
|
|
19230
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
19231
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
19232
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
19233
|
+
}
|
|
19234
|
+
},
|
|
19235
|
+
excludeFromPrefix: ["expansionLevel"]
|
|
19236
|
+
}, downstreamOptions);
|
|
19237
|
+
}
|
|
19238
|
+
async getRecordImpl(byId, identifier, recordId, options) {
|
|
19239
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
19240
|
+
const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_NAME(identifier, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19241
|
+
return response.data;
|
|
19242
|
+
}
|
|
19243
|
+
async insertRecordImpl(byId, identifier, data, options) {
|
|
19244
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
19245
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19246
|
+
return response.data;
|
|
19247
|
+
}
|
|
19248
|
+
async insertRecordsImpl(byId, identifier, data, options) {
|
|
19249
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
19250
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19251
|
+
return response.data;
|
|
19252
|
+
}
|
|
19253
|
+
async updateRecordImpl(byId, identifier, recordId, data, options) {
|
|
19254
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
19255
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_NAME(identifier, recordId), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19256
|
+
return response.data;
|
|
19257
|
+
}
|
|
19258
|
+
async updateRecordsImpl(byId, identifier, data, options) {
|
|
19259
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
19260
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19261
|
+
return response.data;
|
|
19262
|
+
}
|
|
19263
|
+
async deleteRecordsImpl(byId, identifier, recordIds, options) {
|
|
19264
|
+
const params = createParams({ failOnFirst: options.failOnFirst });
|
|
19265
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_NAME(identifier), recordIds, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
19266
|
+
return response.data;
|
|
19267
|
+
}
|
|
19268
|
+
async deleteRecordImpl(byId, identifier, recordId, options) {
|
|
19269
|
+
await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_NAME(identifier, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
19270
|
+
}
|
|
19271
|
+
async queryRecordsImpl(byId, identifier, options) {
|
|
19272
|
+
if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
|
|
19273
|
+
throw new ValidationError({
|
|
19274
|
+
message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
|
|
19275
|
+
});
|
|
19276
|
+
}
|
|
19277
|
+
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
19278
|
+
throw new ValidationError({
|
|
19279
|
+
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
19280
|
+
});
|
|
19281
|
+
}
|
|
19282
|
+
if (options?.havingFilter && (!options.aggregates?.length || !options.groupBy?.length)) {
|
|
19283
|
+
throw new ValidationError({
|
|
19284
|
+
message: "havingFilter requires aggregates and groupBy — conditions reference declared aggregate aliases; use filterGroup for row-level conditions"
|
|
19285
|
+
});
|
|
19286
|
+
}
|
|
19287
|
+
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
19288
|
+
let getEndpoint = () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(identifier);
|
|
19289
|
+
if (options?.joins && options.joins.length > 0) {
|
|
19290
|
+
const baseEntityName = byId ? await this.resolveEntityName(identifier, folderKey) : identifier;
|
|
19291
|
+
rest.joins = options.joins.map((join2) => toWireJoin(join2, baseEntityName));
|
|
19292
|
+
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
19293
|
+
}
|
|
19294
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
19295
|
+
return PaginationHelpers.getAll({
|
|
19296
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
19297
|
+
getEndpoint,
|
|
19298
|
+
method: HTTP_METHODS.POST,
|
|
19299
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
19300
|
+
queryParams: createParams({ expansionLevel }),
|
|
19301
|
+
pagination: {
|
|
19302
|
+
paginationType: PaginationType.OFFSET,
|
|
19303
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
19304
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
19305
|
+
paginationParams: {
|
|
19306
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
19307
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
19308
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
19309
|
+
}
|
|
19310
|
+
},
|
|
19311
|
+
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins", "havingFilter"]
|
|
19312
|
+
}, downstreamOptions);
|
|
19313
|
+
}
|
|
19314
|
+
async importRecordsImpl(byId, identifier, file, options) {
|
|
19315
|
+
const formData = new FormData;
|
|
19316
|
+
if (file instanceof Uint8Array) {
|
|
19317
|
+
formData.append("file", new Blob([file.buffer]));
|
|
19318
|
+
} else {
|
|
19319
|
+
formData.append("file", file);
|
|
19320
|
+
}
|
|
19321
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_NAME(identifier), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
19322
|
+
return response.data;
|
|
19323
|
+
}
|
|
18670
19324
|
}
|
|
18671
19325
|
__decorate([
|
|
18672
19326
|
track("Entities.GetById")
|
|
18673
19327
|
], EntityService.prototype, "getById", null);
|
|
19328
|
+
__decorate([
|
|
19329
|
+
track("Entities.GetByName")
|
|
19330
|
+
], EntityService.prototype, "getByName", null);
|
|
18674
19331
|
__decorate([
|
|
18675
19332
|
track("Entities.GetAllRecords")
|
|
18676
19333
|
], EntityService.prototype, "getAllRecords", null);
|
|
19334
|
+
__decorate([
|
|
19335
|
+
track("Entities.GetRecordsByName")
|
|
19336
|
+
], EntityService.prototype, "getRecordsByName", null);
|
|
18677
19337
|
__decorate([
|
|
18678
19338
|
track("Entities.GetRecordById")
|
|
18679
19339
|
], EntityService.prototype, "getRecordById", null);
|
|
19340
|
+
__decorate([
|
|
19341
|
+
track("Entities.GetRecordByName")
|
|
19342
|
+
], EntityService.prototype, "getRecordByName", null);
|
|
19343
|
+
__decorate([
|
|
19344
|
+
track("Entities.InsertRecord")
|
|
19345
|
+
], EntityService.prototype, "insertRecord", null);
|
|
18680
19346
|
__decorate([
|
|
18681
19347
|
track("Entities.InsertRecordById")
|
|
18682
19348
|
], EntityService.prototype, "insertRecordById", null);
|
|
19349
|
+
__decorate([
|
|
19350
|
+
track("Entities.InsertRecords")
|
|
19351
|
+
], EntityService.prototype, "insertRecords", null);
|
|
18683
19352
|
__decorate([
|
|
18684
19353
|
track("Entities.InsertRecordsById")
|
|
18685
19354
|
], EntityService.prototype, "insertRecordsById", null);
|
|
19355
|
+
__decorate([
|
|
19356
|
+
track("Entities.UpdateRecord")
|
|
19357
|
+
], EntityService.prototype, "updateRecord", null);
|
|
18686
19358
|
__decorate([
|
|
18687
19359
|
track("Entities.UpdateRecordById")
|
|
18688
19360
|
], EntityService.prototype, "updateRecordById", null);
|
|
19361
|
+
__decorate([
|
|
19362
|
+
track("Entities.UpdateRecords")
|
|
19363
|
+
], EntityService.prototype, "updateRecords", null);
|
|
18689
19364
|
__decorate([
|
|
18690
19365
|
track("Entities.UpdateRecordsById")
|
|
18691
19366
|
], EntityService.prototype, "updateRecordsById", null);
|
|
19367
|
+
__decorate([
|
|
19368
|
+
track("Entities.DeleteRecords")
|
|
19369
|
+
], EntityService.prototype, "deleteRecords", null);
|
|
18692
19370
|
__decorate([
|
|
18693
19371
|
track("Entities.DeleteRecordsById")
|
|
18694
19372
|
], EntityService.prototype, "deleteRecordsById", null);
|
|
19373
|
+
__decorate([
|
|
19374
|
+
track("Entities.DeleteRecord")
|
|
19375
|
+
], EntityService.prototype, "deleteRecord", null);
|
|
18695
19376
|
__decorate([
|
|
18696
19377
|
track("Entities.DeleteRecordById")
|
|
18697
19378
|
], EntityService.prototype, "deleteRecordById", null);
|
|
18698
19379
|
__decorate([
|
|
18699
19380
|
track("Entities.GetAll")
|
|
18700
19381
|
], EntityService.prototype, "getAll", null);
|
|
19382
|
+
__decorate([
|
|
19383
|
+
track("Entities.QueryRecords")
|
|
19384
|
+
], EntityService.prototype, "queryRecords", null);
|
|
18701
19385
|
__decorate([
|
|
18702
19386
|
track("Entities.QueryRecordsById")
|
|
18703
19387
|
], EntityService.prototype, "queryRecordsById", null);
|
|
19388
|
+
__decorate([
|
|
19389
|
+
track("Entities.ImportRecords")
|
|
19390
|
+
], EntityService.prototype, "importRecords", null);
|
|
18704
19391
|
__decorate([
|
|
18705
19392
|
track("Entities.ImportRecordsById")
|
|
18706
19393
|
], EntityService.prototype, "importRecordsById", null);
|
|
@@ -20144,6 +20831,74 @@ function validateName2(resourceType, name) {
|
|
|
20144
20831
|
}
|
|
20145
20832
|
return trimmed;
|
|
20146
20833
|
}
|
|
20834
|
+
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
20835
|
+
function isPlainObject(value) {
|
|
20836
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20837
|
+
}
|
|
20838
|
+
function asResourceOverrides(value) {
|
|
20839
|
+
if (!isPlainObject(value))
|
|
20840
|
+
return;
|
|
20841
|
+
const table = {};
|
|
20842
|
+
for (const [key, properties] of Object.entries(value)) {
|
|
20843
|
+
if (!isPlainObject(properties))
|
|
20844
|
+
continue;
|
|
20845
|
+
const bag = {};
|
|
20846
|
+
for (const [property, propertyValue] of Object.entries(properties)) {
|
|
20847
|
+
if (typeof propertyValue === "string")
|
|
20848
|
+
bag[property] = propertyValue;
|
|
20849
|
+
}
|
|
20850
|
+
table[key] = bag;
|
|
20851
|
+
}
|
|
20852
|
+
return Object.keys(table).length > 0 ? table : undefined;
|
|
20853
|
+
}
|
|
20854
|
+
function readFromDocument() {
|
|
20855
|
+
if (!isBrowser2)
|
|
20856
|
+
return;
|
|
20857
|
+
const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
|
|
20858
|
+
if (!text)
|
|
20859
|
+
return;
|
|
20860
|
+
try {
|
|
20861
|
+
return asResourceOverrides(JSON.parse(text));
|
|
20862
|
+
} catch (error) {
|
|
20863
|
+
console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
|
|
20864
|
+
return;
|
|
20865
|
+
}
|
|
20866
|
+
}
|
|
20867
|
+
var table;
|
|
20868
|
+
var loaded = false;
|
|
20869
|
+
var pageOverrides = () => {
|
|
20870
|
+
if (!loaded) {
|
|
20871
|
+
loaded = true;
|
|
20872
|
+
table = readFromDocument();
|
|
20873
|
+
}
|
|
20874
|
+
return table;
|
|
20875
|
+
};
|
|
20876
|
+
var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
|
|
20877
|
+
function readOverrides() {
|
|
20878
|
+
const slot2 = globalThis[RESOURCE_OVERWRITES_KEY];
|
|
20879
|
+
const source = typeof slot2 === "function" ? slot2 : pageOverrides;
|
|
20880
|
+
try {
|
|
20881
|
+
return source();
|
|
20882
|
+
} catch (error) {
|
|
20883
|
+
console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
|
|
20884
|
+
return;
|
|
20885
|
+
}
|
|
20886
|
+
}
|
|
20887
|
+
function resolveOverride(resourceType, name, folderPath) {
|
|
20888
|
+
const table2 = readOverrides();
|
|
20889
|
+
if (!table2)
|
|
20890
|
+
return;
|
|
20891
|
+
const bindingType = resourceType.toLowerCase();
|
|
20892
|
+
const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
|
|
20893
|
+
const unscopedKey = `${bindingType}.${name}`;
|
|
20894
|
+
const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
|
|
20895
|
+
if (!entry)
|
|
20896
|
+
return;
|
|
20897
|
+
return {
|
|
20898
|
+
name: entry.name,
|
|
20899
|
+
folderPath: entry.folderPath
|
|
20900
|
+
};
|
|
20901
|
+
}
|
|
20147
20902
|
var SINGLE_QUOTE_RE = /'/g;
|
|
20148
20903
|
|
|
20149
20904
|
class FolderScopedService extends BaseService {
|
|
@@ -20160,20 +20915,23 @@ class FolderScopedService extends BaseService {
|
|
|
20160
20915
|
}
|
|
20161
20916
|
return response.data?.value;
|
|
20162
20917
|
}
|
|
20163
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
|
|
20918
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap, callerLabel) {
|
|
20164
20919
|
const validatedName = validateName2(resourceType, name);
|
|
20165
20920
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
20921
|
+
const override = resolveOverride(resourceType, validatedName, folderPath);
|
|
20922
|
+
const resolvedName = override?.name ?? validatedName;
|
|
20923
|
+
const resolvedFolderPath = override?.folderPath ?? folderPath;
|
|
20166
20924
|
const headers = resolveFolderHeaders({
|
|
20167
20925
|
folderId,
|
|
20168
20926
|
folderKey,
|
|
20169
|
-
folderPath,
|
|
20170
|
-
resourceType: `${resourceType}.getByName`,
|
|
20927
|
+
folderPath: resolvedFolderPath,
|
|
20928
|
+
resourceType: callerLabel ?? `${resourceType}.getByName`,
|
|
20171
20929
|
fallbackFolderKey: this.config.folderKey
|
|
20172
20930
|
});
|
|
20173
20931
|
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
20174
20932
|
const apiOptions = {
|
|
20175
20933
|
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
20176
|
-
$filter: `Name eq '${
|
|
20934
|
+
$filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
20177
20935
|
$top: "1"
|
|
20178
20936
|
};
|
|
20179
20937
|
const response = await this.get(endpoint, {
|
|
@@ -20182,12 +20940,48 @@ class FolderScopedService extends BaseService {
|
|
|
20182
20940
|
});
|
|
20183
20941
|
const items = response.data?.value;
|
|
20184
20942
|
if (!items?.length) {
|
|
20185
|
-
const folderHint = describeFolderForError(folderId, folderKey,
|
|
20943
|
+
const folderHint = describeFolderForError(folderId, folderKey, resolvedFolderPath);
|
|
20186
20944
|
throw new NotFoundError({
|
|
20187
|
-
message: `${resourceType} '${
|
|
20945
|
+
message: `${resourceType} '${resolvedName}' not found${folderHint}.`
|
|
20188
20946
|
});
|
|
20189
20947
|
}
|
|
20190
|
-
return
|
|
20948
|
+
return {
|
|
20949
|
+
result: transform2(items[0]),
|
|
20950
|
+
effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
|
|
20951
|
+
};
|
|
20952
|
+
}
|
|
20953
|
+
async getByKeyLookup(resourceType, endpoint, key, options, transform2, responseFieldMap, callerLabel) {
|
|
20954
|
+
const label = callerLabel ?? `${resourceType}.getByKey`;
|
|
20955
|
+
const trimmedKey = key?.trim();
|
|
20956
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
20957
|
+
throw new ValidationError({ message: `${label}: key must be a GUID.` });
|
|
20958
|
+
}
|
|
20959
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
20960
|
+
const headers = resolveFolderHeaders({
|
|
20961
|
+
folderId,
|
|
20962
|
+
folderKey,
|
|
20963
|
+
folderPath,
|
|
20964
|
+
resourceType: label,
|
|
20965
|
+
fallbackFolderKey: this.config.folderKey
|
|
20966
|
+
});
|
|
20967
|
+
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
20968
|
+
const apiOptions = {
|
|
20969
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
20970
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
20971
|
+
$top: "1"
|
|
20972
|
+
};
|
|
20973
|
+
const response = await this.get(endpoint, {
|
|
20974
|
+
headers,
|
|
20975
|
+
params: apiOptions
|
|
20976
|
+
});
|
|
20977
|
+
const items = response.data?.value;
|
|
20978
|
+
if (!items?.length) {
|
|
20979
|
+
throw new NotFoundError({ message: `${resourceType} with key '${trimmedKey}' not found.` });
|
|
20980
|
+
}
|
|
20981
|
+
return {
|
|
20982
|
+
result: transform2(items[0]),
|
|
20983
|
+
effectiveFolder: { folderId, folderKey, folderPath }
|
|
20984
|
+
};
|
|
20191
20985
|
}
|
|
20192
20986
|
}
|
|
20193
20987
|
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
@@ -20218,12 +21012,16 @@ class TaskService extends FolderScopedService {
|
|
|
20218
21012
|
};
|
|
20219
21013
|
}
|
|
20220
21014
|
async create(task, folderId) {
|
|
21015
|
+
if (task.type === TaskType.QuickForm && !task.taskSchemaKey) {
|
|
21016
|
+
throw new ValidationError({ message: "taskSchemaKey is required when creating a QuickForm task." });
|
|
21017
|
+
}
|
|
20221
21018
|
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
20222
|
-
const
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20226
|
-
|
|
21019
|
+
const { labels, type, ...rest } = task;
|
|
21020
|
+
const payload = { ...rest, type: type ?? TaskType.External };
|
|
21021
|
+
if (labels?.length) {
|
|
21022
|
+
payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
|
|
21023
|
+
}
|
|
21024
|
+
const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, payload, { headers });
|
|
20227
21025
|
const normalizedData = transformData(response.data, TaskMap);
|
|
20228
21026
|
const transformedData = applyDataTransforms(normalizedData, { field: "status", valueMap: TaskStatusMap });
|
|
20229
21027
|
return createTaskWithMethods(transformedData, this);
|
|
@@ -20855,6 +21653,35 @@ var AssetValueType;
|
|
|
20855
21653
|
AssetValueType2["Credential"] = "Credential";
|
|
20856
21654
|
AssetValueType2["Secret"] = "Secret";
|
|
20857
21655
|
})(AssetValueType || (AssetValueType = {}));
|
|
21656
|
+
async function resolveRefToId(ref, resolvers, callerLabel) {
|
|
21657
|
+
if (!ref) {
|
|
21658
|
+
throw new ValidationError({
|
|
21659
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
21660
|
+
});
|
|
21661
|
+
}
|
|
21662
|
+
if ("id" in ref && ref.id != null) {
|
|
21663
|
+
return { id: ref.id, effectiveFolder: {} };
|
|
21664
|
+
}
|
|
21665
|
+
const stringVariants = [
|
|
21666
|
+
{ variant: "name", resolver: resolvers.byName },
|
|
21667
|
+
{ variant: "key", resolver: resolvers.byKey }
|
|
21668
|
+
];
|
|
21669
|
+
for (const { variant, resolver } of stringVariants) {
|
|
21670
|
+
const value = ref[variant];
|
|
21671
|
+
if (!value)
|
|
21672
|
+
continue;
|
|
21673
|
+
if (!resolver) {
|
|
21674
|
+
throw new ValidationError({
|
|
21675
|
+
message: `${callerLabel}: this method does not support lookup by '${variant}'.`
|
|
21676
|
+
});
|
|
21677
|
+
}
|
|
21678
|
+
const { id, folderId, folderKey, folderPath } = await resolver(value);
|
|
21679
|
+
return { id, effectiveFolder: { folderId, folderKey, folderPath } };
|
|
21680
|
+
}
|
|
21681
|
+
throw new ValidationError({
|
|
21682
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
21683
|
+
});
|
|
21684
|
+
}
|
|
20858
21685
|
var AssetMap = {
|
|
20859
21686
|
creationTime: "createdTime",
|
|
20860
21687
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -20893,7 +21720,41 @@ class AssetService extends FolderScopedService {
|
|
|
20893
21720
|
return transformedAsset;
|
|
20894
21721
|
}
|
|
20895
21722
|
async getByName(name, options = {}) {
|
|
20896
|
-
|
|
21723
|
+
const { result } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
21724
|
+
return result;
|
|
21725
|
+
}
|
|
21726
|
+
async getByKey(key, options = {}) {
|
|
21727
|
+
const { result } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
21728
|
+
return result;
|
|
21729
|
+
}
|
|
21730
|
+
async updateValue(assetRef, newValue, options) {
|
|
21731
|
+
if (newValue === null || newValue === undefined) {
|
|
21732
|
+
throw new ValidationError({ message: "newValue is required for updateValue" });
|
|
21733
|
+
}
|
|
21734
|
+
let preFetched;
|
|
21735
|
+
const { id, effectiveFolder } = await resolveRefToId(assetRef, {
|
|
21736
|
+
byName: async (name) => {
|
|
21737
|
+
const { result: asset, effectiveFolder: folder } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
|
|
21738
|
+
preFetched = asset;
|
|
21739
|
+
return { id: asset.id, ...folder };
|
|
21740
|
+
},
|
|
21741
|
+
byKey: async (key) => {
|
|
21742
|
+
const { result: asset, effectiveFolder: folder } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
|
|
21743
|
+
preFetched = asset;
|
|
21744
|
+
return { id: asset.id, ...folder };
|
|
21745
|
+
}
|
|
21746
|
+
}, "Assets.updateValue");
|
|
21747
|
+
if (id <= 0) {
|
|
21748
|
+
throw new ValidationError({ message: "Assets.updateValue: assetRef.id must be a positive number." });
|
|
21749
|
+
}
|
|
21750
|
+
const headers = resolveFolderHeaders({
|
|
21751
|
+
folderId: effectiveFolder.folderId ?? options?.folderId,
|
|
21752
|
+
folderKey: effectiveFolder.folderKey ?? options?.folderKey,
|
|
21753
|
+
folderPath: effectiveFolder.folderPath ?? options?.folderPath,
|
|
21754
|
+
resourceType: "Assets.updateValue",
|
|
21755
|
+
fallbackFolderKey: this.config.folderKey
|
|
21756
|
+
});
|
|
21757
|
+
await this.updateValueByResolvedId(id, newValue, headers, preFetched);
|
|
20897
21758
|
}
|
|
20898
21759
|
async updateValueById(id, newValue, options) {
|
|
20899
21760
|
if (!id) {
|
|
@@ -20909,19 +21770,30 @@ class AssetService extends FolderScopedService {
|
|
|
20909
21770
|
resourceType: "Assets.updateValueById",
|
|
20910
21771
|
fallbackFolderKey: this.config.folderKey
|
|
20911
21772
|
});
|
|
20912
|
-
|
|
20913
|
-
|
|
20914
|
-
|
|
21773
|
+
await this.updateValueByResolvedId(id, newValue, headers);
|
|
21774
|
+
}
|
|
21775
|
+
async updateValueByResolvedId(id, newValue, headers, preFetched) {
|
|
21776
|
+
const shape = preFetched ?? await this.fetchAssetShape(id, headers);
|
|
21777
|
+
const valueField = resolveValueField(id, shape.valueType, newValue);
|
|
20915
21778
|
const body = {
|
|
20916
21779
|
Id: id,
|
|
20917
|
-
Name:
|
|
20918
|
-
ValueScope:
|
|
20919
|
-
ValueType:
|
|
20920
|
-
Description:
|
|
21780
|
+
Name: shape.name,
|
|
21781
|
+
ValueScope: shape.valueScope,
|
|
21782
|
+
ValueType: shape.valueType,
|
|
21783
|
+
Description: shape.description,
|
|
20921
21784
|
[valueField]: newValue
|
|
20922
21785
|
};
|
|
20923
21786
|
await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
|
|
20924
21787
|
}
|
|
21788
|
+
async fetchAssetShape(id, headers) {
|
|
21789
|
+
const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
|
|
21790
|
+
return {
|
|
21791
|
+
name: response.data.Name,
|
|
21792
|
+
valueScope: response.data.ValueScope,
|
|
21793
|
+
valueType: response.data.ValueType,
|
|
21794
|
+
description: response.data.Description
|
|
21795
|
+
};
|
|
21796
|
+
}
|
|
20925
21797
|
}
|
|
20926
21798
|
__decorate([
|
|
20927
21799
|
track("Assets.GetAll")
|
|
@@ -20932,6 +21804,12 @@ __decorate([
|
|
|
20932
21804
|
__decorate([
|
|
20933
21805
|
track("Assets.GetByName")
|
|
20934
21806
|
], AssetService.prototype, "getByName", null);
|
|
21807
|
+
__decorate([
|
|
21808
|
+
track("Assets.GetByKey")
|
|
21809
|
+
], AssetService.prototype, "getByKey", null);
|
|
21810
|
+
__decorate([
|
|
21811
|
+
track("Assets.UpdateValue")
|
|
21812
|
+
], AssetService.prototype, "updateValue", null);
|
|
20935
21813
|
__decorate([
|
|
20936
21814
|
track("Assets.UpdateValueById")
|
|
20937
21815
|
], AssetService.prototype, "updateValueById", null);
|
|
@@ -20960,7 +21838,7 @@ function resolveValueField(id, valueType, newValue) {
|
|
|
20960
21838
|
return "BoolValue";
|
|
20961
21839
|
default:
|
|
20962
21840
|
throw new ValidationError({
|
|
20963
|
-
message: `
|
|
21841
|
+
message: `Asset ${id} has valueType ${valueType}; only Text, Integer, and Bool are supported`
|
|
20964
21842
|
});
|
|
20965
21843
|
}
|
|
20966
21844
|
}
|
|
@@ -20988,7 +21866,8 @@ class BucketService extends FolderScopedService {
|
|
|
20988
21866
|
return pascalToCamelCaseKeys(response.data);
|
|
20989
21867
|
}
|
|
20990
21868
|
async getByName(name, options = {}) {
|
|
20991
|
-
|
|
21869
|
+
const { result } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
|
|
21870
|
+
return result;
|
|
20992
21871
|
}
|
|
20993
21872
|
async getAll(options) {
|
|
20994
21873
|
const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
|
|
@@ -21855,7 +22734,8 @@ class ProcessService extends FolderScopedService {
|
|
|
21855
22734
|
return transformedProcess;
|
|
21856
22735
|
}
|
|
21857
22736
|
async getByName(name, options = {}) {
|
|
21858
|
-
|
|
22737
|
+
const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
|
|
22738
|
+
return result;
|
|
21859
22739
|
}
|
|
21860
22740
|
}
|
|
21861
22741
|
__decorate([
|
|
@@ -21870,21 +22750,112 @@ __decorate([
|
|
|
21870
22750
|
__decorate([
|
|
21871
22751
|
track("Processes.GetByName")
|
|
21872
22752
|
], ProcessService.prototype, "getByName", null);
|
|
22753
|
+
var QueuePriority;
|
|
22754
|
+
(function(QueuePriority2) {
|
|
22755
|
+
QueuePriority2["High"] = "High";
|
|
22756
|
+
QueuePriority2["Normal"] = "Normal";
|
|
22757
|
+
QueuePriority2["Low"] = "Low";
|
|
22758
|
+
})(QueuePriority || (QueuePriority = {}));
|
|
22759
|
+
var QueueItemStatus;
|
|
22760
|
+
(function(QueueItemStatus2) {
|
|
22761
|
+
QueueItemStatus2["New"] = "New";
|
|
22762
|
+
QueueItemStatus2["InProgress"] = "InProgress";
|
|
22763
|
+
QueueItemStatus2["Failed"] = "Failed";
|
|
22764
|
+
QueueItemStatus2["Successful"] = "Successful";
|
|
22765
|
+
QueueItemStatus2["Abandoned"] = "Abandoned";
|
|
22766
|
+
QueueItemStatus2["Retried"] = "Retried";
|
|
22767
|
+
QueueItemStatus2["Deleted"] = "Deleted";
|
|
22768
|
+
})(QueueItemStatus || (QueueItemStatus = {}));
|
|
22769
|
+
var QueueItemReviewStatus;
|
|
22770
|
+
(function(QueueItemReviewStatus2) {
|
|
22771
|
+
QueueItemReviewStatus2["None"] = "None";
|
|
22772
|
+
QueueItemReviewStatus2["InReview"] = "InReview";
|
|
22773
|
+
QueueItemReviewStatus2["Verified"] = "Verified";
|
|
22774
|
+
QueueItemReviewStatus2["Retried"] = "Retried";
|
|
22775
|
+
})(QueueItemReviewStatus || (QueueItemReviewStatus = {}));
|
|
22776
|
+
var QueueExceptionType;
|
|
22777
|
+
(function(QueueExceptionType2) {
|
|
22778
|
+
QueueExceptionType2["ApplicationException"] = "ApplicationException";
|
|
22779
|
+
QueueExceptionType2["BusinessException"] = "BusinessException";
|
|
22780
|
+
})(QueueExceptionType || (QueueExceptionType = {}));
|
|
22781
|
+
var QueueTransactionOutcome;
|
|
22782
|
+
(function(QueueTransactionOutcome2) {
|
|
22783
|
+
QueueTransactionOutcome2["Successful"] = "Successful";
|
|
22784
|
+
QueueTransactionOutcome2["Failed"] = "Failed";
|
|
22785
|
+
})(QueueTransactionOutcome || (QueueTransactionOutcome = {}));
|
|
22786
|
+
function createQueueMethods(queueData, service) {
|
|
22787
|
+
return {
|
|
22788
|
+
async getAllItems(options) {
|
|
22789
|
+
if (!queueData.id)
|
|
22790
|
+
throw new ValidationError({ message: "Queue ID is undefined" });
|
|
22791
|
+
if (!queueData.folderId)
|
|
22792
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
22793
|
+
return service.getAllItems(queueData.id, { ...options, folderId: queueData.folderId });
|
|
22794
|
+
},
|
|
22795
|
+
async insertItem(specificData, options) {
|
|
22796
|
+
if (!queueData.name)
|
|
22797
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
22798
|
+
if (!queueData.folderId)
|
|
22799
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
22800
|
+
return service.insertItemByName(queueData.name, specificData, { ...options, folderId: queueData.folderId });
|
|
22801
|
+
},
|
|
22802
|
+
async startTransaction() {
|
|
22803
|
+
if (!queueData.name)
|
|
22804
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
22805
|
+
if (!queueData.folderId)
|
|
22806
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
22807
|
+
return service.startTransaction({ name: queueData.name }, { folderId: queueData.folderId });
|
|
22808
|
+
},
|
|
22809
|
+
async completeTransaction(itemId, outcome, options) {
|
|
22810
|
+
if (!queueData.folderId)
|
|
22811
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
22812
|
+
return service.completeTransaction(itemId, outcome, { ...options, folderId: queueData.folderId });
|
|
22813
|
+
}
|
|
22814
|
+
};
|
|
22815
|
+
}
|
|
22816
|
+
function createQueueWithMethods(queueData, service) {
|
|
22817
|
+
return Object.assign({}, queueData, createQueueMethods(queueData, service));
|
|
22818
|
+
}
|
|
21873
22819
|
var QueueMap = {
|
|
21874
22820
|
creationTime: "createdTime",
|
|
21875
22821
|
organizationUnitId: "folderId",
|
|
21876
22822
|
organizationUnitFullyQualifiedName: "folderName"
|
|
21877
22823
|
};
|
|
22824
|
+
var QueueItemMap = {
|
|
22825
|
+
queueDefinitionId: "queueId",
|
|
22826
|
+
creationTime: "createdTime",
|
|
22827
|
+
organizationUnitId: "folderId",
|
|
22828
|
+
organizationUnitFullyQualifiedName: "folderName",
|
|
22829
|
+
startProcessing: "processingStartTime",
|
|
22830
|
+
endProcessing: "processingEndTime",
|
|
22831
|
+
processingException: "processingError"
|
|
22832
|
+
};
|
|
22833
|
+
var QueueItemProcessingErrorMap = {
|
|
22834
|
+
creationTime: "createdTime"
|
|
22835
|
+
};
|
|
22836
|
+
function transformQueueItem(queueItem) {
|
|
22837
|
+
const { SpecificContent, Output, SpecificData: _sd, OutputData: _od, ...rest } = queueItem;
|
|
22838
|
+
const transformed = transformData(pascalToCamelCaseKeys(rest), QueueItemMap);
|
|
22839
|
+
if (transformed.processingError) {
|
|
22840
|
+
transformed.processingError = transformData(transformed.processingError, QueueItemProcessingErrorMap);
|
|
22841
|
+
}
|
|
22842
|
+
transformed.specificData = SpecificContent ?? null;
|
|
22843
|
+
transformed.outputData = Output ?? null;
|
|
22844
|
+
return transformed;
|
|
22845
|
+
}
|
|
21878
22846
|
|
|
21879
22847
|
class QueueService extends FolderScopedService {
|
|
21880
22848
|
async getAll(options) {
|
|
21881
|
-
const
|
|
21882
|
-
const
|
|
22849
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
|
|
22850
|
+
const hasFolderScope = folderId !== undefined || !!folderKey?.trim() || !!folderPath?.trim();
|
|
22851
|
+
const headers = hasFolderScope ? resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Queues.getAll" }) : undefined;
|
|
22852
|
+
const apiOptions = transformOptions(queryOptions, QueueMap);
|
|
21883
22853
|
return PaginationHelpers.getAll({
|
|
21884
22854
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
21885
|
-
getEndpoint: (
|
|
22855
|
+
getEndpoint: () => hasFolderScope ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
|
|
21886
22856
|
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_BY_FOLDER,
|
|
21887
|
-
|
|
22857
|
+
headers,
|
|
22858
|
+
transformFn: (queue) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(queue), QueueMap), this),
|
|
21888
22859
|
pagination: {
|
|
21889
22860
|
paginationType: PaginationType.OFFSET,
|
|
21890
22861
|
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
@@ -21897,15 +22868,176 @@ class QueueService extends FolderScopedService {
|
|
|
21897
22868
|
}
|
|
21898
22869
|
}, apiOptions);
|
|
21899
22870
|
}
|
|
21900
|
-
async getById(id,
|
|
21901
|
-
|
|
21902
|
-
|
|
22871
|
+
async getById(id, folderIdOrOptions, options = {}) {
|
|
22872
|
+
if (typeof folderIdOrOptions === "number") {
|
|
22873
|
+
const headers2 = createHeaders({ [FOLDER_ID]: folderIdOrOptions });
|
|
22874
|
+
const apiFieldOptions2 = transformOptions(options, QueueMap);
|
|
22875
|
+
const apiOptions2 = addPrefixToKeys(apiFieldOptions2, ODATA_PREFIX, Object.keys(apiFieldOptions2));
|
|
22876
|
+
const response2 = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
22877
|
+
headers: headers2,
|
|
22878
|
+
params: apiOptions2
|
|
22879
|
+
});
|
|
22880
|
+
return transformData(pascalToCamelCaseKeys(response2.data), QueueMap);
|
|
22881
|
+
}
|
|
22882
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = folderIdOrOptions ?? {};
|
|
22883
|
+
const headers = resolveFolderHeaders({
|
|
22884
|
+
folderId,
|
|
22885
|
+
folderKey,
|
|
22886
|
+
folderPath,
|
|
22887
|
+
resourceType: "Queues.getById",
|
|
22888
|
+
fallbackFolderKey: this.config.folderKey
|
|
22889
|
+
});
|
|
22890
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
21903
22891
|
const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
|
|
21904
22892
|
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
21905
22893
|
headers,
|
|
21906
22894
|
params: apiOptions
|
|
21907
22895
|
});
|
|
21908
|
-
|
|
22896
|
+
const rawQueue = transformData(pascalToCamelCaseKeys(response.data), QueueMap);
|
|
22897
|
+
return createQueueWithMethods(rawQueue, this);
|
|
22898
|
+
}
|
|
22899
|
+
async getByName(name, options = {}) {
|
|
22900
|
+
const { result } = await this.getByNameLookup("Queue", QUEUE_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(raw), QueueMap), this), QueueMap);
|
|
22901
|
+
return result;
|
|
22902
|
+
}
|
|
22903
|
+
async getByKey(key, options = {}) {
|
|
22904
|
+
const trimmedKey = key?.trim();
|
|
22905
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
22906
|
+
throw new ValidationError({ message: "key must be a GUID for getByKey" });
|
|
22907
|
+
}
|
|
22908
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
22909
|
+
const headers = resolveFolderHeaders({
|
|
22910
|
+
folderId,
|
|
22911
|
+
folderKey,
|
|
22912
|
+
folderPath,
|
|
22913
|
+
resourceType: "Queues.getByKey",
|
|
22914
|
+
fallbackFolderKey: this.config.folderKey
|
|
22915
|
+
});
|
|
22916
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
22917
|
+
const apiOptions = {
|
|
22918
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
22919
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
22920
|
+
$top: "1"
|
|
22921
|
+
};
|
|
22922
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_FOLDER, { headers, params: apiOptions });
|
|
22923
|
+
const items = response.data?.value;
|
|
22924
|
+
if (!items?.length) {
|
|
22925
|
+
throw new NotFoundError({ message: `Queue with key '${trimmedKey}' not found.` });
|
|
22926
|
+
}
|
|
22927
|
+
return createQueueWithMethods(transformData(pascalToCamelCaseKeys(items[0]), QueueMap), this);
|
|
22928
|
+
}
|
|
22929
|
+
async getAllItems(queueId, options) {
|
|
22930
|
+
if (!queueId) {
|
|
22931
|
+
throw new ValidationError({ message: "queueId is required for getAllItems" });
|
|
22932
|
+
}
|
|
22933
|
+
const { folderId, folderKey, folderPath, filter, ...restOptions } = options ?? {};
|
|
22934
|
+
const headers = resolveFolderHeaders({
|
|
22935
|
+
folderId,
|
|
22936
|
+
folderKey,
|
|
22937
|
+
folderPath,
|
|
22938
|
+
resourceType: "Queues.getAllItems",
|
|
22939
|
+
fallbackFolderKey: this.config.folderKey
|
|
22940
|
+
});
|
|
22941
|
+
const mergedFilter = filter ? `(${filter}) and queueId eq ${queueId}` : `queueId eq ${queueId}`;
|
|
22942
|
+
const apiOptions = transformOptions({ ...restOptions, filter: mergedFilter }, QueueItemMap);
|
|
22943
|
+
return PaginationHelpers.getAll({
|
|
22944
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
22945
|
+
getEndpoint: () => QUEUE_ENDPOINTS.GET_ITEMS,
|
|
22946
|
+
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_ITEMS,
|
|
22947
|
+
headers,
|
|
22948
|
+
transformFn: transformQueueItem,
|
|
22949
|
+
pagination: {
|
|
22950
|
+
paginationType: PaginationType.OFFSET,
|
|
22951
|
+
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
22952
|
+
totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
|
|
22953
|
+
paginationParams: {
|
|
22954
|
+
pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
22955
|
+
offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
|
|
22956
|
+
countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
|
|
22957
|
+
}
|
|
22958
|
+
}
|
|
22959
|
+
}, apiOptions);
|
|
22960
|
+
}
|
|
22961
|
+
async insertItemByName(queueName, specificData, options = {}) {
|
|
22962
|
+
if (!queueName) {
|
|
22963
|
+
throw new ValidationError({ message: "queueName is required for insertItemByName" });
|
|
22964
|
+
}
|
|
22965
|
+
const headers = resolveFolderHeaders({
|
|
22966
|
+
folderId: options.folderId,
|
|
22967
|
+
folderKey: options.folderKey,
|
|
22968
|
+
folderPath: options.folderPath,
|
|
22969
|
+
resourceType: "Queues.insertItemByName",
|
|
22970
|
+
fallbackFolderKey: this.config.folderKey
|
|
22971
|
+
});
|
|
22972
|
+
const response = await this.post(QUEUE_ENDPOINTS.ADD_ITEM, {
|
|
22973
|
+
itemData: {
|
|
22974
|
+
Name: queueName,
|
|
22975
|
+
Priority: options.priority ?? QueuePriority.Normal,
|
|
22976
|
+
Reference: options.reference,
|
|
22977
|
+
Progress: options.progress,
|
|
22978
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
22979
|
+
DueDate: options.dueDate?.toISOString(),
|
|
22980
|
+
RiskSlaDate: options.riskSlaDate?.toISOString(),
|
|
22981
|
+
SpecificContent: specificData
|
|
22982
|
+
}
|
|
22983
|
+
}, { headers });
|
|
22984
|
+
return transformQueueItem(response.data);
|
|
22985
|
+
}
|
|
22986
|
+
async startTransaction(queue, options = {}) {
|
|
22987
|
+
const headers = resolveFolderHeaders({
|
|
22988
|
+
folderId: options.folderId,
|
|
22989
|
+
folderKey: options.folderKey,
|
|
22990
|
+
folderPath: options.folderPath,
|
|
22991
|
+
resourceType: "Queues.startTransaction",
|
|
22992
|
+
fallbackFolderKey: this.config.folderKey
|
|
22993
|
+
});
|
|
22994
|
+
let queueName;
|
|
22995
|
+
if (queue?.name) {
|
|
22996
|
+
queueName = queue.name;
|
|
22997
|
+
} else if (queue?.id != null) {
|
|
22998
|
+
queueName = await this.resolveQueueName(queue.id, headers);
|
|
22999
|
+
} else {
|
|
23000
|
+
throw new ValidationError({ message: "queue id or name is required for startTransaction" });
|
|
23001
|
+
}
|
|
23002
|
+
const response = await this.post(QUEUE_ENDPOINTS.START_TRANSACTION, {
|
|
23003
|
+
transactionData: { Name: queueName }
|
|
23004
|
+
}, { headers });
|
|
23005
|
+
if (!response.data || typeof response.data !== "object") {
|
|
23006
|
+
return null;
|
|
23007
|
+
}
|
|
23008
|
+
return transformQueueItem(response.data);
|
|
23009
|
+
}
|
|
23010
|
+
async completeTransaction(itemId, outcome, options = {}) {
|
|
23011
|
+
if (!itemId) {
|
|
23012
|
+
throw new ValidationError({ message: "itemId is required for completeTransaction" });
|
|
23013
|
+
}
|
|
23014
|
+
const headers = resolveFolderHeaders({
|
|
23015
|
+
folderId: options.folderId,
|
|
23016
|
+
folderKey: options.folderKey,
|
|
23017
|
+
folderPath: options.folderPath,
|
|
23018
|
+
resourceType: "Queues.completeTransaction",
|
|
23019
|
+
fallbackFolderKey: this.config.folderKey
|
|
23020
|
+
});
|
|
23021
|
+
const transactionResult = {
|
|
23022
|
+
IsSuccessful: outcome === QueueTransactionOutcome.Successful,
|
|
23023
|
+
ProcessingException: options.processingError && {
|
|
23024
|
+
Reason: options.processingError.reason,
|
|
23025
|
+
Details: options.processingError.details,
|
|
23026
|
+
Type: options.processingError.type,
|
|
23027
|
+
AssociatedImageFilePath: options.processingError.associatedImageFilePath
|
|
23028
|
+
},
|
|
23029
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
23030
|
+
DueDate: options.dueDate?.toISOString(),
|
|
23031
|
+
Progress: options.progress,
|
|
23032
|
+
OperationId: options.operationId,
|
|
23033
|
+
Output: options.outputData,
|
|
23034
|
+
Analytics: options.analytics
|
|
23035
|
+
};
|
|
23036
|
+
await this.post(QUEUE_ENDPOINTS.SET_TRANSACTION_RESULT(itemId), { transactionResult }, { headers });
|
|
23037
|
+
}
|
|
23038
|
+
async resolveQueueName(queueId, headers) {
|
|
23039
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(queueId), { headers, params: { $select: "Name" } });
|
|
23040
|
+
return response.data.Name;
|
|
21909
23041
|
}
|
|
21910
23042
|
}
|
|
21911
23043
|
__decorate([
|
|
@@ -21914,6 +23046,24 @@ __decorate([
|
|
|
21914
23046
|
__decorate([
|
|
21915
23047
|
track("Queues.GetById")
|
|
21916
23048
|
], QueueService.prototype, "getById", null);
|
|
23049
|
+
__decorate([
|
|
23050
|
+
track("Queues.GetByName")
|
|
23051
|
+
], QueueService.prototype, "getByName", null);
|
|
23052
|
+
__decorate([
|
|
23053
|
+
track("Queues.GetByKey")
|
|
23054
|
+
], QueueService.prototype, "getByKey", null);
|
|
23055
|
+
__decorate([
|
|
23056
|
+
track("Queues.GetAllItems")
|
|
23057
|
+
], QueueService.prototype, "getAllItems", null);
|
|
23058
|
+
__decorate([
|
|
23059
|
+
track("Queues.InsertItemByName")
|
|
23060
|
+
], QueueService.prototype, "insertItemByName", null);
|
|
23061
|
+
__decorate([
|
|
23062
|
+
track("Queues.StartTransaction")
|
|
23063
|
+
], QueueService.prototype, "startTransaction", null);
|
|
23064
|
+
__decorate([
|
|
23065
|
+
track("Queues.CompleteTransaction")
|
|
23066
|
+
], QueueService.prototype, "completeTransaction", null);
|
|
21917
23067
|
var TaskCatalogMap = {
|
|
21918
23068
|
creationTime: "createdTime",
|
|
21919
23069
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -21960,7 +23110,8 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
21960
23110
|
return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
|
|
21961
23111
|
}
|
|
21962
23112
|
async getByName(name, options = {}) {
|
|
21963
|
-
|
|
23113
|
+
const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
23114
|
+
return result;
|
|
21964
23115
|
}
|
|
21965
23116
|
async create(name, options = {}) {
|
|
21966
23117
|
if (!name) {
|
|
@@ -21984,7 +23135,7 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
21984
23135
|
throw new ValidationError({ message: "name is required for updateByName" });
|
|
21985
23136
|
}
|
|
21986
23137
|
const { folderId, folderKey, folderPath } = options;
|
|
21987
|
-
const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
23138
|
+
const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
21988
23139
|
return this.update(current, options);
|
|
21989
23140
|
}
|
|
21990
23141
|
async update(current, options) {
|
|
@@ -22129,6 +23280,13 @@ var AgentMap = {
|
|
|
22129
23280
|
var UserSettingsMap = {
|
|
22130
23281
|
...CommonFieldMap
|
|
22131
23282
|
};
|
|
23283
|
+
var ConnectionState;
|
|
23284
|
+
(function(ConnectionState2) {
|
|
23285
|
+
ConnectionState2["Enabled"] = "Enabled";
|
|
23286
|
+
ConnectionState2["Disabled"] = "Disabled";
|
|
23287
|
+
ConnectionState2["Expired"] = "Expired";
|
|
23288
|
+
ConnectionState2["Failed"] = "Failed";
|
|
23289
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
22132
23290
|
var FeedbackStatus;
|
|
22133
23291
|
(function(FeedbackStatus2) {
|
|
22134
23292
|
FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
|
|
@@ -23864,7 +25022,7 @@ var ENTITIES_DELETE_EXAMPLES = [
|
|
|
23864
25022
|
];
|
|
23865
25023
|
var ENTITIES_CREATE_EXAMPLES = [
|
|
23866
25024
|
{
|
|
23867
|
-
Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'name' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return a
|
|
25025
|
+
Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'name' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return only a preview (content truncated to 10,000 chars with a '...[Truncated]' suffix, or a 'HasValue=true Length=N' marker, depending on the tenant) — full content via 'records get'. Tenant-gated by the 'MultilineMax' feature flag.",
|
|
23868
25026
|
Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"name":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"name":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"name":"submitter","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","isRequired":true},{"name":"receipt","type":"FILE"},{"name":"notes","type":"MULTILINE_MAX"}]}'`,
|
|
23869
25027
|
Output: {
|
|
23870
25028
|
Code: "EntityCreated",
|
|
@@ -24374,7 +25532,7 @@ var registerFilesCommand = (program2) => {
|
|
|
24374
25532
|
}
|
|
24375
25533
|
const fsInst = getFileSystem();
|
|
24376
25534
|
const fileName = fsInst.path.basename(options.file) || "upload";
|
|
24377
|
-
const [uploadError] = await catchError(sdk.entities.uploadAttachment(entityId, recordId, fieldName, new File([fileContent], fileName), options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
25535
|
+
const [uploadError] = await catchError(sdk.entities.uploadAttachment({ id: entityId }, recordId, fieldName, new File([fileContent], fileName), options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
24378
25536
|
if (uploadError) {
|
|
24379
25537
|
return fail(`Error uploading file to field '${fieldName}'`, await extractErrorMessage(uploadError));
|
|
24380
25538
|
}
|
|
@@ -24393,7 +25551,7 @@ var registerFilesCommand = (program2) => {
|
|
|
24393
25551
|
const sdk = await connectOrFail(options.tenant);
|
|
24394
25552
|
if (!sdk)
|
|
24395
25553
|
return;
|
|
24396
|
-
const [downloadError, blob] = await catchError(sdk.entities.downloadAttachment(entityId, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
25554
|
+
const [downloadError, blob] = await catchError(sdk.entities.downloadAttachment({ id: entityId }, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
24397
25555
|
if (downloadError) {
|
|
24398
25556
|
return fail(`Error downloading file from field '${fieldName}'`, await extractErrorMessage(downloadError));
|
|
24399
25557
|
}
|
|
@@ -24424,7 +25582,7 @@ var registerFilesCommand = (program2) => {
|
|
|
24424
25582
|
const sdk = await connectOrFail(options.tenant);
|
|
24425
25583
|
if (!sdk)
|
|
24426
25584
|
return;
|
|
24427
|
-
const [deleteError] = await catchError(sdk.entities.deleteAttachment(entityId, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
25585
|
+
const [deleteError] = await catchError(sdk.entities.deleteAttachment({ id: entityId }, recordId, fieldName, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
24428
25586
|
if (deleteError) {
|
|
24429
25587
|
return fail(`Error deleting file from field '${fieldName}'`, await extractErrorMessage(deleteError));
|
|
24430
25588
|
}
|
|
@@ -24467,7 +25625,7 @@ async function loadFileFieldNames(sdk, entityId, folderKey) {
|
|
|
24467
25625
|
}
|
|
24468
25626
|
var RECORDS_LIST_EXAMPLES = [
|
|
24469
25627
|
{
|
|
24470
|
-
Description: "List records in an entity. MULTILINE_MAX fields return a
|
|
25628
|
+
Description: "List records in an entity. MULTILINE_MAX fields return only a preview (see 'notes' below): content truncated to 10,000 chars with a '...[Truncated]' suffix, or a 'HasValue=true Length=N' marker, depending on the tenant — full value via 'records get'.",
|
|
24471
25629
|
Command: "uip df records list a1b2c3d4-0000-0000-0000-000000000001 --limit 2",
|
|
24472
25630
|
Output: {
|
|
24473
25631
|
Code: "RecordList",
|
|
@@ -24476,7 +25634,7 @@ var RECORDS_LIST_EXAMPLES = [
|
|
|
24476
25634
|
{
|
|
24477
25635
|
Id: "b2c3d4e5-0000-0000-0000-000000000001",
|
|
24478
25636
|
amount: 1500,
|
|
24479
|
-
notes: "
|
|
25637
|
+
notes: "Expense report for Q3 travel...[Truncated]"
|
|
24480
25638
|
},
|
|
24481
25639
|
{
|
|
24482
25640
|
Id: "b2c3d4e5-0000-0000-0000-000000000002",
|
|
@@ -24665,7 +25823,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24665
25823
|
if (fileErr)
|
|
24666
25824
|
return fail(fileErr.message, fileErr.instructions);
|
|
24667
25825
|
if (recordsList.length === 1) {
|
|
24668
|
-
const [insertError, result] = await catchError(sdk.entities.
|
|
25826
|
+
const [insertError, result] = await catchError(sdk.entities.insertRecord({ id: entityId }, recordsList[0], folderOptions));
|
|
24669
25827
|
if (insertError) {
|
|
24670
25828
|
return fail("Error inserting record", await extractErrorMessage(insertError));
|
|
24671
25829
|
}
|
|
@@ -24675,7 +25833,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24675
25833
|
Data: result
|
|
24676
25834
|
});
|
|
24677
25835
|
} else {
|
|
24678
|
-
const [insertError, result] = await catchError(sdk.entities.
|
|
25836
|
+
const [insertError, result] = await catchError(sdk.entities.insertRecords({ id: entityId }, recordsList, folderOptions));
|
|
24679
25837
|
if (insertError) {
|
|
24680
25838
|
return fail("Error inserting records", await extractErrorMessage(insertError));
|
|
24681
25839
|
}
|
|
@@ -24717,7 +25875,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24717
25875
|
if (recordId === undefined || recordId === null) {
|
|
24718
25876
|
return fail("Record must include an 'Id' field", "Provide the record ID in the JSON data.");
|
|
24719
25877
|
}
|
|
24720
|
-
const [updateError, result] = await catchError(sdk.entities.
|
|
25878
|
+
const [updateError, result] = await catchError(sdk.entities.updateRecord({ id: entityId }, String(recordId), record, folderOptions));
|
|
24721
25879
|
if (updateError) {
|
|
24722
25880
|
return fail("Error updating record", await extractErrorMessage(updateError));
|
|
24723
25881
|
}
|
|
@@ -24731,7 +25889,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24731
25889
|
if (missingId) {
|
|
24732
25890
|
return fail("All records must include an 'Id' field", "Provide the record ID in each JSON object.");
|
|
24733
25891
|
}
|
|
24734
|
-
const [updateError, result] = await catchError(sdk.entities.
|
|
25892
|
+
const [updateError, result] = await catchError(sdk.entities.updateRecords({ id: entityId }, recordsList, folderOptions));
|
|
24735
25893
|
if (updateError) {
|
|
24736
25894
|
return fail("Error updating records", await extractErrorMessage(updateError));
|
|
24737
25895
|
}
|
|
@@ -24789,7 +25947,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24789
25947
|
if (!sdk)
|
|
24790
25948
|
return;
|
|
24791
25949
|
const queryPaginationOptions = options.cursor !== undefined ? { pageSize, cursor: { value: options.cursor } } : jumpToPage !== undefined ? { pageSize, jumpToPage } : { pageSize };
|
|
24792
|
-
const [queryError, result] = await catchError(sdk.entities.
|
|
25950
|
+
const [queryError, result] = await catchError(sdk.entities.queryRecords({ id: entityId }, {
|
|
24793
25951
|
...queryBody !== null && queryBody,
|
|
24794
25952
|
...queryPaginationOptions,
|
|
24795
25953
|
...options.folderKey !== undefined && {
|
|
@@ -24819,7 +25977,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24819
25977
|
const fs2 = getFileSystem();
|
|
24820
25978
|
const fileName = fs2.path.basename(options.file) || "import.csv";
|
|
24821
25979
|
const csvFile = new File([fileContent], fileName, { type: "text/csv" });
|
|
24822
|
-
const [importError, result] = await catchError(sdk.entities.
|
|
25980
|
+
const [importError, result] = await catchError(sdk.entities.importRecords({ id: entityId }, csvFile, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
24823
25981
|
if (importError) {
|
|
24824
25982
|
return fail("Error importing records", await extractErrorMessage(importError));
|
|
24825
25983
|
}
|
|
@@ -24843,7 +26001,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
24843
26001
|
const sdk = await connectOrFail(options.tenant);
|
|
24844
26002
|
if (!sdk)
|
|
24845
26003
|
return;
|
|
24846
|
-
const [deleteError, result] = await catchError(sdk.entities.
|
|
26004
|
+
const [deleteError, result] = await catchError(sdk.entities.deleteRecords({ id: entityId }, recordIds, options.folderKey !== undefined ? { folderKey: options.folderKey } : undefined));
|
|
24847
26005
|
if (deleteError) {
|
|
24848
26006
|
return fail("Error deleting records", await extractErrorMessage(deleteError));
|
|
24849
26007
|
}
|
|
@@ -24935,4 +26093,4 @@ var registerCommands = async (program2) => {
|
|
|
24935
26093
|
|
|
24936
26094
|
export { Command, metadata, registerCommands };
|
|
24937
26095
|
|
|
24938
|
-
//# debugId=
|
|
26096
|
+
//# debugId=7C4D0D556CB51E1764756E2164756E21
|