@uipath/data-fabric-tool 1.1.0 → 1.195.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tool.js +1638 -1164
- package/package.json +16 -24
- package/src/commands/choice-sets.spec.ts +538 -83
- package/src/commands/choice-sets.ts +550 -146
- package/src/commands/entities.spec.ts +58 -145
- package/src/commands/entities.ts +160 -367
- package/src/commands/files.spec.ts +18 -32
- package/src/commands/files.ts +33 -89
- package/src/commands/records.spec.ts +102 -207
- package/src/commands/records.ts +112 -328
- package/src/tool.ts +5 -1
- package/src/utils/output.spec.ts +78 -0
- package/src/utils/output.ts +51 -0
- package/src/utils/sdk-client.spec.ts +59 -0
- package/src/utils/sdk-client.ts +23 -0
- package/src/utils/pagination.ts +0 -10
package/dist/tool.js
CHANGED
|
@@ -667,6 +667,7 @@ var init_open = __esm(() => {
|
|
|
667
667
|
});
|
|
668
668
|
|
|
669
669
|
// ../filesystem/src/node.ts
|
|
670
|
+
import { randomUUID } from "node:crypto";
|
|
670
671
|
import { existsSync } from "node:fs";
|
|
671
672
|
import * as fs6 from "node:fs/promises";
|
|
672
673
|
import * as os2 from "node:os";
|
|
@@ -748,6 +749,90 @@ class NodeFileSystem {
|
|
|
748
749
|
async mkdir(dirPath) {
|
|
749
750
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
750
751
|
}
|
|
752
|
+
async acquireLock(lockPath) {
|
|
753
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
754
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
755
|
+
const ownerId = randomUUID();
|
|
756
|
+
const start = Date.now();
|
|
757
|
+
while (true) {
|
|
758
|
+
try {
|
|
759
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
760
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
761
|
+
} catch (error) {
|
|
762
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
763
|
+
throw error;
|
|
764
|
+
}
|
|
765
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
766
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
767
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
768
|
+
if (reclaimed)
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
772
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
773
|
+
}
|
|
774
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
async canonicalizeLockTarget(lockPath) {
|
|
779
|
+
const absolute = path2.resolve(lockPath);
|
|
780
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
781
|
+
if (fullReal)
|
|
782
|
+
return fullReal;
|
|
783
|
+
const parent = path2.dirname(absolute);
|
|
784
|
+
const base = path2.basename(absolute);
|
|
785
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
786
|
+
return path2.join(canonicalParent, base);
|
|
787
|
+
}
|
|
788
|
+
createLockRelease(lockFile, ownerId) {
|
|
789
|
+
const heartbeatStart = Date.now();
|
|
790
|
+
let heartbeatTimer;
|
|
791
|
+
let stopped = false;
|
|
792
|
+
const stopHeartbeat = () => {
|
|
793
|
+
stopped = true;
|
|
794
|
+
if (heartbeatTimer)
|
|
795
|
+
clearTimeout(heartbeatTimer);
|
|
796
|
+
};
|
|
797
|
+
const scheduleNextHeartbeat = () => {
|
|
798
|
+
if (stopped)
|
|
799
|
+
return;
|
|
800
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
801
|
+
stopped = true;
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
heartbeatTimer = setTimeout(() => {
|
|
805
|
+
runHeartbeat();
|
|
806
|
+
}, LOCK_HEARTBEAT_MS);
|
|
807
|
+
heartbeatTimer.unref?.();
|
|
808
|
+
};
|
|
809
|
+
const runHeartbeat = async () => {
|
|
810
|
+
if (stopped)
|
|
811
|
+
return;
|
|
812
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
813
|
+
if (stopped)
|
|
814
|
+
return;
|
|
815
|
+
if (current !== ownerId) {
|
|
816
|
+
stopped = true;
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const now = Date.now() / 1000;
|
|
820
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
821
|
+
scheduleNextHeartbeat();
|
|
822
|
+
};
|
|
823
|
+
scheduleNextHeartbeat();
|
|
824
|
+
let released = false;
|
|
825
|
+
return async () => {
|
|
826
|
+
if (released)
|
|
827
|
+
return;
|
|
828
|
+
released = true;
|
|
829
|
+
stopHeartbeat();
|
|
830
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
831
|
+
if (current === ownerId) {
|
|
832
|
+
await fs6.rm(lockFile, { force: true });
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
751
836
|
async rm(filePath) {
|
|
752
837
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
753
838
|
}
|
|
@@ -793,9 +878,13 @@ class NodeFileSystem {
|
|
|
793
878
|
}
|
|
794
879
|
}
|
|
795
880
|
isEnoent(error) {
|
|
796
|
-
return
|
|
881
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
882
|
+
}
|
|
883
|
+
hasErrnoCode(error, code) {
|
|
884
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
797
885
|
}
|
|
798
886
|
}
|
|
887
|
+
var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
|
|
799
888
|
var init_node = __esm(() => {
|
|
800
889
|
init_open();
|
|
801
890
|
});
|
|
@@ -2941,7 +3030,7 @@ function isBrowser() {
|
|
|
2941
3030
|
|
|
2942
3031
|
// ../../node_modules/@uipath/coreipc/index.js
|
|
2943
3032
|
var require_coreipc = __commonJS((exports, module) => {
|
|
2944
|
-
var __dirname = "/
|
|
3033
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
2945
3034
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2946
3035
|
(function(e, t) {
|
|
2947
3036
|
typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.ipc = t() : e.ipc = t();
|
|
@@ -21133,6 +21222,10 @@ var require_dist = __commonJS((exports) => {
|
|
|
21133
21222
|
exports.RobotProxyConstructor = RobotProxyConstructor;
|
|
21134
21223
|
__exportStar(require_agent(), exports);
|
|
21135
21224
|
});
|
|
21225
|
+
// ../auth/src/server.ts
|
|
21226
|
+
var init_server = __esm(() => {
|
|
21227
|
+
init_constants();
|
|
21228
|
+
});
|
|
21136
21229
|
|
|
21137
21230
|
// ../../node_modules/@opentelemetry/api/build/src/version.js
|
|
21138
21231
|
var require_version = __commonJS((exports) => {
|
|
@@ -22614,7 +22707,7 @@ var require_src = __commonJS((exports) => {
|
|
|
22614
22707
|
};
|
|
22615
22708
|
});
|
|
22616
22709
|
|
|
22617
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.js
|
|
22710
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.js
|
|
22618
22711
|
var require_LogRecord = __commonJS((exports) => {
|
|
22619
22712
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22620
22713
|
exports.SeverityNumber = undefined;
|
|
@@ -22648,7 +22741,7 @@ var require_LogRecord = __commonJS((exports) => {
|
|
|
22648
22741
|
})(SeverityNumber = exports.SeverityNumber || (exports.SeverityNumber = {}));
|
|
22649
22742
|
});
|
|
22650
22743
|
|
|
22651
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js
|
|
22744
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js
|
|
22652
22745
|
var require_NoopLogger = __commonJS((exports) => {
|
|
22653
22746
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22654
22747
|
exports.NOOP_LOGGER = exports.NoopLogger = undefined;
|
|
@@ -22660,7 +22753,7 @@ var require_NoopLogger = __commonJS((exports) => {
|
|
|
22660
22753
|
exports.NOOP_LOGGER = new NoopLogger;
|
|
22661
22754
|
});
|
|
22662
22755
|
|
|
22663
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/NoopLoggerProvider.js
|
|
22756
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/NoopLoggerProvider.js
|
|
22664
22757
|
var require_NoopLoggerProvider = __commonJS((exports) => {
|
|
22665
22758
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22666
22759
|
exports.NOOP_LOGGER_PROVIDER = exports.NoopLoggerProvider = undefined;
|
|
@@ -22675,7 +22768,7 @@ var require_NoopLoggerProvider = __commonJS((exports) => {
|
|
|
22675
22768
|
exports.NOOP_LOGGER_PROVIDER = new NoopLoggerProvider;
|
|
22676
22769
|
});
|
|
22677
22770
|
|
|
22678
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLogger.js
|
|
22771
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/ProxyLogger.js
|
|
22679
22772
|
var require_ProxyLogger = __commonJS((exports) => {
|
|
22680
22773
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22681
22774
|
exports.ProxyLogger = undefined;
|
|
@@ -22706,7 +22799,7 @@ var require_ProxyLogger = __commonJS((exports) => {
|
|
|
22706
22799
|
exports.ProxyLogger = ProxyLogger;
|
|
22707
22800
|
});
|
|
22708
22801
|
|
|
22709
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLoggerProvider.js
|
|
22802
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/ProxyLoggerProvider.js
|
|
22710
22803
|
var require_ProxyLoggerProvider = __commonJS((exports) => {
|
|
22711
22804
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22712
22805
|
exports.ProxyLoggerProvider = undefined;
|
|
@@ -22733,14 +22826,14 @@ var require_ProxyLoggerProvider = __commonJS((exports) => {
|
|
|
22733
22826
|
exports.ProxyLoggerProvider = ProxyLoggerProvider;
|
|
22734
22827
|
});
|
|
22735
22828
|
|
|
22736
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/platform/node/globalThis.js
|
|
22829
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/node/globalThis.js
|
|
22737
22830
|
var require_globalThis = __commonJS((exports) => {
|
|
22738
22831
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22739
22832
|
exports._globalThis = undefined;
|
|
22740
22833
|
exports._globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
22741
22834
|
});
|
|
22742
22835
|
|
|
22743
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/platform/node/index.js
|
|
22836
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/node/index.js
|
|
22744
22837
|
var require_node = __commonJS((exports) => {
|
|
22745
22838
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22746
22839
|
exports._globalThis = undefined;
|
|
@@ -22750,7 +22843,7 @@ var require_node = __commonJS((exports) => {
|
|
|
22750
22843
|
} });
|
|
22751
22844
|
});
|
|
22752
22845
|
|
|
22753
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/platform/index.js
|
|
22846
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/platform/index.js
|
|
22754
22847
|
var require_platform = __commonJS((exports) => {
|
|
22755
22848
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22756
22849
|
exports._globalThis = undefined;
|
|
@@ -22760,7 +22853,7 @@ var require_platform = __commonJS((exports) => {
|
|
|
22760
22853
|
} });
|
|
22761
22854
|
});
|
|
22762
22855
|
|
|
22763
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/internal/global-utils.js
|
|
22856
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/internal/global-utils.js
|
|
22764
22857
|
var require_global_utils2 = __commonJS((exports) => {
|
|
22765
22858
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22766
22859
|
exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_LOGS_API_KEY = undefined;
|
|
@@ -22774,7 +22867,7 @@ var require_global_utils2 = __commonJS((exports) => {
|
|
|
22774
22867
|
exports.API_BACKWARDS_COMPATIBILITY_VERSION = 1;
|
|
22775
22868
|
});
|
|
22776
22869
|
|
|
22777
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/api/logs.js
|
|
22870
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/api/logs.js
|
|
22778
22871
|
var require_logs = __commonJS((exports) => {
|
|
22779
22872
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22780
22873
|
exports.LogsAPI = undefined;
|
|
@@ -22815,7 +22908,7 @@ var require_logs = __commonJS((exports) => {
|
|
|
22815
22908
|
exports.LogsAPI = LogsAPI;
|
|
22816
22909
|
});
|
|
22817
22910
|
|
|
22818
|
-
// ../../node_modules/@opentelemetry/api-logs/build/src/index.js
|
|
22911
|
+
// ../../node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/api-logs/build/src/index.js
|
|
22819
22912
|
var require_src2 = __commonJS((exports) => {
|
|
22820
22913
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22821
22914
|
exports.logs = exports.ProxyLoggerProvider = exports.ProxyLogger = exports.NoopLoggerProvider = exports.NOOP_LOGGER_PROVIDER = exports.NoopLogger = exports.NOOP_LOGGER = exports.SeverityNumber = undefined;
|
|
@@ -27069,7 +27162,8 @@ var require_src6 = __commonJS((exports) => {
|
|
|
27069
27162
|
// package.json
|
|
27070
27163
|
var package_default = {
|
|
27071
27164
|
name: "@uipath/data-fabric-tool",
|
|
27072
|
-
|
|
27165
|
+
license: "MIT",
|
|
27166
|
+
version: "1.195.0",
|
|
27073
27167
|
description: "Manage Data Fabric entities and records.",
|
|
27074
27168
|
type: "module",
|
|
27075
27169
|
main: "./dist/tool.js",
|
|
@@ -27092,7 +27186,7 @@ var package_default = {
|
|
|
27092
27186
|
"@uipath/common": "workspace:*",
|
|
27093
27187
|
"@uipath/auth": "workspace:*",
|
|
27094
27188
|
"@uipath/filesystem": "workspace:*",
|
|
27095
|
-
"@uipath/uipath-typescript": "^1.3.
|
|
27189
|
+
"@uipath/uipath-typescript": "^1.3.11",
|
|
27096
27190
|
"@types/node": "^25.5.2",
|
|
27097
27191
|
typescript: "^6.0.2"
|
|
27098
27192
|
}
|
|
@@ -27235,10 +27329,15 @@ async function extractErrorDetails(error, options) {
|
|
|
27235
27329
|
}
|
|
27236
27330
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
27237
27331
|
context.errorCode = parsedBody.errorCode;
|
|
27332
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
27333
|
+
context.errorCode = parsedBody.code;
|
|
27238
27334
|
}
|
|
27239
27335
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
27240
27336
|
context.requestId = parsedBody.requestId;
|
|
27241
27337
|
}
|
|
27338
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
27339
|
+
context.traceId = parsedBody.traceId;
|
|
27340
|
+
}
|
|
27242
27341
|
if (status === 429) {
|
|
27243
27342
|
const resp = response;
|
|
27244
27343
|
const headersObj = resp?.headers;
|
|
@@ -27258,7 +27357,35 @@ async function extractErrorDetails(error, options) {
|
|
|
27258
27357
|
}
|
|
27259
27358
|
}
|
|
27260
27359
|
const hasContext = Object.keys(context).length > 0;
|
|
27261
|
-
|
|
27360
|
+
let parsedErrors;
|
|
27361
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
27362
|
+
const errors = {};
|
|
27363
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
27364
|
+
if (Array.isArray(raw)) {
|
|
27365
|
+
const messages = raw.map((entry) => {
|
|
27366
|
+
if (typeof entry === "string")
|
|
27367
|
+
return entry;
|
|
27368
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
27369
|
+
return entry.message;
|
|
27370
|
+
}
|
|
27371
|
+
return String(entry);
|
|
27372
|
+
}).filter(Boolean);
|
|
27373
|
+
if (messages.length > 0)
|
|
27374
|
+
errors[field] = messages;
|
|
27375
|
+
} else if (typeof raw === "string") {
|
|
27376
|
+
errors[field] = [raw];
|
|
27377
|
+
}
|
|
27378
|
+
}
|
|
27379
|
+
if (Object.keys(errors).length > 0)
|
|
27380
|
+
parsedErrors = errors;
|
|
27381
|
+
}
|
|
27382
|
+
return {
|
|
27383
|
+
result,
|
|
27384
|
+
message,
|
|
27385
|
+
details,
|
|
27386
|
+
...hasContext ? { context } : {},
|
|
27387
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
27388
|
+
};
|
|
27262
27389
|
}
|
|
27263
27390
|
async function extractErrorMessage(error, options) {
|
|
27264
27391
|
const { message } = await extractErrorDetails(error, options);
|
|
@@ -32405,6 +32532,60 @@ function escapeNonAscii(jsonText) {
|
|
|
32405
32532
|
function needsAsciiSafeJson(sink) {
|
|
32406
32533
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
32407
32534
|
}
|
|
32535
|
+
function isPlainRecord(value) {
|
|
32536
|
+
if (value === null || typeof value !== "object")
|
|
32537
|
+
return false;
|
|
32538
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32539
|
+
return prototype === Object.prototype || prototype === null;
|
|
32540
|
+
}
|
|
32541
|
+
function toLowerCamelCaseKey(key) {
|
|
32542
|
+
if (!key)
|
|
32543
|
+
return key;
|
|
32544
|
+
if (/[_\-\s]/.test(key)) {
|
|
32545
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
32546
|
+
if (!firstPart)
|
|
32547
|
+
return key;
|
|
32548
|
+
return [
|
|
32549
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
32550
|
+
...restParts.map((part) => {
|
|
32551
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
32552
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
32553
|
+
})
|
|
32554
|
+
].join("");
|
|
32555
|
+
}
|
|
32556
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
32557
|
+
}
|
|
32558
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
32559
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
32560
|
+
return key.toLowerCase();
|
|
32561
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
32562
|
+
}
|
|
32563
|
+
function toPascalCaseKey(key) {
|
|
32564
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
32565
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
32566
|
+
}
|
|
32567
|
+
function toPascalCaseData(value) {
|
|
32568
|
+
if (Array.isArray(value))
|
|
32569
|
+
return value.map(toPascalCaseData);
|
|
32570
|
+
if (!isPlainRecord(value))
|
|
32571
|
+
return value;
|
|
32572
|
+
const result = {};
|
|
32573
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
32574
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
32575
|
+
}
|
|
32576
|
+
return result;
|
|
32577
|
+
}
|
|
32578
|
+
function normalizeDataKeys(data) {
|
|
32579
|
+
return toPascalCaseData(data);
|
|
32580
|
+
}
|
|
32581
|
+
function normalizeOutputKeys(data) {
|
|
32582
|
+
const result = {};
|
|
32583
|
+
for (const [key, value] of Object.entries(data)) {
|
|
32584
|
+
const pascalKey = toPascalCaseKey(key);
|
|
32585
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
32586
|
+
}
|
|
32587
|
+
return result;
|
|
32588
|
+
}
|
|
32408
32589
|
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
32409
32590
|
if (!data) {
|
|
32410
32591
|
logFn("Empty response object. No data to display.");
|
|
@@ -32467,7 +32648,7 @@ function wrapText(text, width) {
|
|
|
32467
32648
|
function printTable(data, logFn, externalLogValue) {
|
|
32468
32649
|
if (data.length === 0)
|
|
32469
32650
|
return;
|
|
32470
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
32651
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
32471
32652
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
32472
32653
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
32473
32654
|
logFn(header);
|
|
@@ -32482,7 +32663,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
32482
32663
|
}
|
|
32483
32664
|
}
|
|
32484
32665
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
32485
|
-
const keys = Object.keys(data).filter((key) =>
|
|
32666
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
32486
32667
|
if (keys.length === 0)
|
|
32487
32668
|
return;
|
|
32488
32669
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -32498,7 +32679,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
32498
32679
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
32499
32680
|
if (data.length === 0)
|
|
32500
32681
|
return;
|
|
32501
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
32682
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
32502
32683
|
if (keys.length === 0)
|
|
32503
32684
|
return;
|
|
32504
32685
|
if (!process.stdout.isTTY) {
|
|
@@ -32574,8 +32755,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
32574
32755
|
function toYaml(data) {
|
|
32575
32756
|
return dump(data);
|
|
32576
32757
|
}
|
|
32758
|
+
class FilterEvaluationError extends Error {
|
|
32759
|
+
__brand = "FilterEvaluationError";
|
|
32760
|
+
filter;
|
|
32761
|
+
instructions;
|
|
32762
|
+
result = RESULTS.ValidationError;
|
|
32763
|
+
constructor(filter, cause) {
|
|
32764
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
32765
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
32766
|
+
this.name = "FilterEvaluationError";
|
|
32767
|
+
this.filter = filter;
|
|
32768
|
+
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
32769
|
+
}
|
|
32770
|
+
}
|
|
32577
32771
|
function applyFilter(data, filter) {
|
|
32578
|
-
|
|
32772
|
+
let result;
|
|
32773
|
+
try {
|
|
32774
|
+
result = search(data, filter);
|
|
32775
|
+
} catch (err) {
|
|
32776
|
+
throw new FilterEvaluationError(filter, err);
|
|
32777
|
+
}
|
|
32579
32778
|
if (result == null)
|
|
32580
32779
|
return [];
|
|
32581
32780
|
if (Array.isArray(result)) {
|
|
@@ -32592,13 +32791,18 @@ function applyFilter(data, filter) {
|
|
|
32592
32791
|
}
|
|
32593
32792
|
var OutputFormatter;
|
|
32594
32793
|
((OutputFormatter) => {
|
|
32595
|
-
function success(data) {
|
|
32794
|
+
function success(data, options) {
|
|
32596
32795
|
data.Log ??= getLogFilePath() || undefined;
|
|
32796
|
+
const normalize = !options?.preserveDataKeys;
|
|
32797
|
+
if (normalize) {
|
|
32798
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
32799
|
+
}
|
|
32597
32800
|
const filter = getOutputFilter();
|
|
32598
32801
|
if (filter) {
|
|
32599
|
-
|
|
32802
|
+
const filtered = applyFilter(data.Data, filter);
|
|
32803
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
32600
32804
|
}
|
|
32601
|
-
logOutput(data, getOutputFormat());
|
|
32805
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
32602
32806
|
}
|
|
32603
32807
|
OutputFormatter.success = success;
|
|
32604
32808
|
function error(data) {
|
|
@@ -32608,7 +32812,7 @@ var OutputFormatter;
|
|
|
32608
32812
|
result: data.Result,
|
|
32609
32813
|
message: data.Message
|
|
32610
32814
|
});
|
|
32611
|
-
logOutput(data, getOutputFormat());
|
|
32815
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
32612
32816
|
}
|
|
32613
32817
|
OutputFormatter.error = error;
|
|
32614
32818
|
function emitList(code, items, opts) {
|
|
@@ -32629,13 +32833,14 @@ var OutputFormatter;
|
|
|
32629
32833
|
function log(data) {
|
|
32630
32834
|
const format = getOutputFormat();
|
|
32631
32835
|
const sink = getOutputSink();
|
|
32836
|
+
const normalized = toPascalCaseData(data);
|
|
32632
32837
|
if (format === "json") {
|
|
32633
|
-
const json2 = JSON.stringify(
|
|
32838
|
+
const json2 = JSON.stringify(normalized);
|
|
32634
32839
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
32635
32840
|
sink.writeErr(`${safe}
|
|
32636
32841
|
`);
|
|
32637
32842
|
} else {
|
|
32638
|
-
for (const [key, value] of Object.entries(
|
|
32843
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
32639
32844
|
sink.writeErr(`${key}: ${value}
|
|
32640
32845
|
`);
|
|
32641
32846
|
}
|
|
@@ -32644,12 +32849,16 @@ var OutputFormatter;
|
|
|
32644
32849
|
OutputFormatter.log = log;
|
|
32645
32850
|
function formatToString(data) {
|
|
32646
32851
|
const filter = getOutputFilter();
|
|
32647
|
-
if (
|
|
32648
|
-
data.Data =
|
|
32852
|
+
if ("Data" in data && data.Data != null) {
|
|
32853
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
32854
|
+
if (filter) {
|
|
32855
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
32856
|
+
}
|
|
32649
32857
|
}
|
|
32858
|
+
const output = normalizeOutputKeys(data);
|
|
32650
32859
|
const lines = [];
|
|
32651
32860
|
const sink = getOutputSink();
|
|
32652
|
-
printOutput(
|
|
32861
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
32653
32862
|
lines.push(msg);
|
|
32654
32863
|
}, needsAsciiSafeJson(sink));
|
|
32655
32864
|
return lines.join(`
|
|
@@ -34077,6 +34286,22 @@ function warnDeprecatedTenantOption(tenant) {
|
|
|
34077
34286
|
return;
|
|
34078
34287
|
warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
|
|
34079
34288
|
}
|
|
34289
|
+
// ../common/src/polling/types.ts
|
|
34290
|
+
var PollOutcome = {
|
|
34291
|
+
Completed: "completed",
|
|
34292
|
+
Timeout: "timeout",
|
|
34293
|
+
Interrupted: "interrupted",
|
|
34294
|
+
Aborted: "aborted",
|
|
34295
|
+
Failed: "failed"
|
|
34296
|
+
};
|
|
34297
|
+
|
|
34298
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
34299
|
+
var REASON_BY_OUTCOME = {
|
|
34300
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
34301
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
34302
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
34303
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
34304
|
+
};
|
|
34080
34305
|
// ../common/src/polling/terminal-statuses.ts
|
|
34081
34306
|
var TERMINAL_STATUSES = new Set([
|
|
34082
34307
|
"completed",
|
|
@@ -34104,6 +34329,8 @@ var ScreenLogger;
|
|
|
34104
34329
|
}
|
|
34105
34330
|
ScreenLogger.progress = progress;
|
|
34106
34331
|
})(ScreenLogger ||= {});
|
|
34332
|
+
// ../common/src/sdk-user-agent.ts
|
|
34333
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
34107
34334
|
// ../common/src/tool-provider.ts
|
|
34108
34335
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
34109
34336
|
// ../common/src/telemetry/pii-redactor.ts
|
|
@@ -34286,13 +34513,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
34286
34513
|
const [error] = await catchError(fn(...args));
|
|
34287
34514
|
if (error) {
|
|
34288
34515
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
34289
|
-
logger.
|
|
34516
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
34517
|
+
const typed = error;
|
|
34518
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
34519
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
34520
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
34290
34521
|
OutputFormatter.error({
|
|
34291
|
-
Result:
|
|
34522
|
+
Result: finalResult,
|
|
34292
34523
|
Message: errorMessage,
|
|
34293
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
34524
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
34294
34525
|
});
|
|
34295
|
-
context.exit(
|
|
34526
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
34296
34527
|
}
|
|
34297
34528
|
const durationMs = performance.now() - startTime;
|
|
34298
34529
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
@@ -34305,16 +34536,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
34305
34536
|
}));
|
|
34306
34537
|
});
|
|
34307
34538
|
};
|
|
34308
|
-
// src/utils/
|
|
34309
|
-
function
|
|
34310
|
-
|
|
34311
|
-
|
|
34312
|
-
|
|
34313
|
-
|
|
34314
|
-
|
|
34315
|
-
|
|
34316
|
-
|
|
34317
|
-
|
|
34539
|
+
// src/utils/output.ts
|
|
34540
|
+
function fail(message, instructions) {
|
|
34541
|
+
OutputFormatter.error({
|
|
34542
|
+
Result: RESULTS.Failure,
|
|
34543
|
+
Message: message,
|
|
34544
|
+
Instructions: instructions
|
|
34545
|
+
});
|
|
34546
|
+
processContext.exit(1);
|
|
34547
|
+
}
|
|
34548
|
+
function requireDestructiveConfirmation(options, reasonInstruction) {
|
|
34549
|
+
if (options.confirm !== true) {
|
|
34550
|
+
fail("Confirmation required for destructive operation", "Pass --confirm to acknowledge this is irreversible.");
|
|
34551
|
+
return null;
|
|
34552
|
+
}
|
|
34553
|
+
const reason = options.reason?.trim();
|
|
34554
|
+
if (reason === undefined || reason === "") {
|
|
34555
|
+
fail("Reason required for destructive operation", reasonInstruction);
|
|
34556
|
+
return null;
|
|
34557
|
+
}
|
|
34558
|
+
return reason;
|
|
34318
34559
|
}
|
|
34319
34560
|
|
|
34320
34561
|
// ../auth/src/config.ts
|
|
@@ -34341,32 +34582,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
34341
34582
|
this.name = "InvalidBaseUrlError";
|
|
34342
34583
|
}
|
|
34343
34584
|
}
|
|
34344
|
-
var DEFAULT_SCOPES = [
|
|
34345
|
-
"offline_access",
|
|
34346
|
-
"ProcessMining",
|
|
34347
|
-
"OrchestratorApiUserAccess",
|
|
34348
|
-
"StudioWebBackend",
|
|
34349
|
-
"IdentityServerApi",
|
|
34350
|
-
"ConnectionService",
|
|
34351
|
-
"DataService",
|
|
34352
|
-
"DataServiceApiUserAccess",
|
|
34353
|
-
"DocumentUnderstanding",
|
|
34354
|
-
"EnterpriseContextService",
|
|
34355
|
-
"Directory",
|
|
34356
|
-
"JamJamApi",
|
|
34357
|
-
"LLMGateway",
|
|
34358
|
-
"LLMOps",
|
|
34359
|
-
"OMS",
|
|
34360
|
-
"RCS.FolderAuthorization",
|
|
34361
|
-
"RCS.TagsManagement",
|
|
34362
|
-
"TestmanagerApiUserAccess",
|
|
34363
|
-
"AutomationSolutions",
|
|
34364
|
-
"StudioWebTypeCacheService",
|
|
34365
|
-
"Docs.GPT.Search",
|
|
34366
|
-
"Insights",
|
|
34367
|
-
"ReferenceToken",
|
|
34368
|
-
"Audit.Read"
|
|
34369
|
-
];
|
|
34585
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
34370
34586
|
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
34371
34587
|
let baseUrl = rawUrl;
|
|
34372
34588
|
if (baseUrl.endsWith("/identity_/")) {
|
|
@@ -34416,7 +34632,8 @@ var resolveConfigAsync = async ({
|
|
|
34416
34632
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
34417
34633
|
clientSecret = fileAuth.clientSecret;
|
|
34418
34634
|
}
|
|
34419
|
-
const
|
|
34635
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
34636
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
34420
34637
|
return {
|
|
34421
34638
|
clientId,
|
|
34422
34639
|
clientSecret,
|
|
@@ -34916,6 +35133,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
34916
35133
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
34917
35134
|
return "token refresh failed before authentication completed";
|
|
34918
35135
|
}
|
|
35136
|
+
function errorMessage(error) {
|
|
35137
|
+
return error instanceof Error ? error.message : String(error);
|
|
35138
|
+
}
|
|
35139
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
35140
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
35141
|
+
}
|
|
35142
|
+
async function runRefreshLocked(inputs) {
|
|
35143
|
+
const {
|
|
35144
|
+
absolutePath,
|
|
35145
|
+
refreshToken: callerRefreshToken,
|
|
35146
|
+
customAuthority,
|
|
35147
|
+
ensureTokenValidityMinutes,
|
|
35148
|
+
loadEnvFile,
|
|
35149
|
+
saveEnvFile,
|
|
35150
|
+
refreshFn,
|
|
35151
|
+
resolveConfig
|
|
35152
|
+
} = inputs;
|
|
35153
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
35154
|
+
let fresh;
|
|
35155
|
+
try {
|
|
35156
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
35157
|
+
} catch (error) {
|
|
35158
|
+
return {
|
|
35159
|
+
kind: "fail",
|
|
35160
|
+
status: {
|
|
35161
|
+
loginStatus: "Refresh Failed",
|
|
35162
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
35163
|
+
tokenRefresh: {
|
|
35164
|
+
attempted: false,
|
|
35165
|
+
success: false,
|
|
35166
|
+
errorMessage: `auth file read failed: ${errorMessage(error)}`
|
|
35167
|
+
}
|
|
35168
|
+
}
|
|
35169
|
+
};
|
|
35170
|
+
}
|
|
35171
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
35172
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
35173
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
35174
|
+
return {
|
|
35175
|
+
kind: "ok",
|
|
35176
|
+
accessToken: freshAccess,
|
|
35177
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
35178
|
+
expiration: freshExp,
|
|
35179
|
+
tokenRefresh: { attempted: false, success: true }
|
|
35180
|
+
};
|
|
35181
|
+
}
|
|
35182
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
35183
|
+
let refreshedAccess;
|
|
35184
|
+
let refreshedRefresh;
|
|
35185
|
+
try {
|
|
35186
|
+
const config = await resolveConfig({ customAuthority });
|
|
35187
|
+
const refreshed = await refreshFn({
|
|
35188
|
+
refreshToken: tokenForIdP,
|
|
35189
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
35190
|
+
clientId: config.clientId,
|
|
35191
|
+
expectedAuthority: customAuthority
|
|
35192
|
+
});
|
|
35193
|
+
refreshedAccess = refreshed.accessToken;
|
|
35194
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
35195
|
+
} catch (error) {
|
|
35196
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
35197
|
+
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
35198
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
35199
|
+
return {
|
|
35200
|
+
kind: "fail",
|
|
35201
|
+
status: {
|
|
35202
|
+
loginStatus: "Refresh Failed",
|
|
35203
|
+
hint,
|
|
35204
|
+
tokenRefresh: {
|
|
35205
|
+
attempted: true,
|
|
35206
|
+
success: false,
|
|
35207
|
+
errorMessage: message
|
|
35208
|
+
}
|
|
35209
|
+
}
|
|
35210
|
+
};
|
|
35211
|
+
}
|
|
35212
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
35213
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
35214
|
+
return {
|
|
35215
|
+
kind: "fail",
|
|
35216
|
+
status: {
|
|
35217
|
+
loginStatus: "Refresh Failed",
|
|
35218
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
35219
|
+
tokenRefresh: {
|
|
35220
|
+
attempted: true,
|
|
35221
|
+
success: false,
|
|
35222
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
35223
|
+
}
|
|
35224
|
+
}
|
|
35225
|
+
};
|
|
35226
|
+
}
|
|
35227
|
+
try {
|
|
35228
|
+
await saveEnvFile({
|
|
35229
|
+
envPath: absolutePath,
|
|
35230
|
+
data: {
|
|
35231
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
35232
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
35233
|
+
},
|
|
35234
|
+
merge: true
|
|
35235
|
+
});
|
|
35236
|
+
return {
|
|
35237
|
+
kind: "ok",
|
|
35238
|
+
accessToken: refreshedAccess,
|
|
35239
|
+
refreshToken: refreshedRefresh,
|
|
35240
|
+
expiration: refreshedExp,
|
|
35241
|
+
tokenRefresh: { attempted: true, success: true }
|
|
35242
|
+
};
|
|
35243
|
+
} catch (error) {
|
|
35244
|
+
const msg = errorMessage(error);
|
|
35245
|
+
return {
|
|
35246
|
+
kind: "ok",
|
|
35247
|
+
accessToken: refreshedAccess,
|
|
35248
|
+
refreshToken: refreshedRefresh,
|
|
35249
|
+
expiration: refreshedExp,
|
|
35250
|
+
persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
|
|
35251
|
+
tokenRefresh: {
|
|
35252
|
+
attempted: true,
|
|
35253
|
+
success: true,
|
|
35254
|
+
errorMessage: `persistence failed: ${msg}`
|
|
35255
|
+
}
|
|
35256
|
+
};
|
|
35257
|
+
}
|
|
35258
|
+
}
|
|
34919
35259
|
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
34920
35260
|
const {
|
|
34921
35261
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -34990,73 +35330,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
34990
35330
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
34991
35331
|
let expiration = getTokenExpiration(accessToken);
|
|
34992
35332
|
let persistenceWarning;
|
|
35333
|
+
let lockReleaseFailed = false;
|
|
34993
35334
|
let tokenRefresh;
|
|
34994
|
-
const
|
|
34995
|
-
|
|
34996
|
-
|
|
34997
|
-
|
|
35335
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
35336
|
+
const tryGlobalCredsHint = async () => {
|
|
35337
|
+
const fs7 = getFs();
|
|
35338
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
35339
|
+
if (absolutePath === globalPath)
|
|
35340
|
+
return;
|
|
35341
|
+
if (!await fs7.exists(globalPath))
|
|
35342
|
+
return;
|
|
34998
35343
|
try {
|
|
34999
|
-
const
|
|
35000
|
-
|
|
35001
|
-
|
|
35002
|
-
const
|
|
35003
|
-
|
|
35004
|
-
|
|
35005
|
-
|
|
35006
|
-
|
|
35007
|
-
|
|
35008
|
-
refreshedAccess = refreshed.accessToken;
|
|
35009
|
-
refreshedRefresh = refreshed.refreshToken;
|
|
35010
|
-
} catch (error) {
|
|
35011
|
-
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
35012
|
-
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
35013
|
-
const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
35014
|
-
return {
|
|
35015
|
-
loginStatus: "Refresh Failed",
|
|
35016
|
-
hint,
|
|
35017
|
-
tokenRefresh: {
|
|
35018
|
-
attempted: true,
|
|
35019
|
-
success: false,
|
|
35020
|
-
errorMessage
|
|
35021
|
-
}
|
|
35022
|
-
};
|
|
35344
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
35345
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
35346
|
+
return;
|
|
35347
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
35348
|
+
if (globalExp && globalExp <= new Date)
|
|
35349
|
+
return;
|
|
35350
|
+
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
35351
|
+
} catch {
|
|
35352
|
+
return;
|
|
35023
35353
|
}
|
|
35024
|
-
|
|
35025
|
-
|
|
35354
|
+
};
|
|
35355
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
35356
|
+
let release;
|
|
35357
|
+
try {
|
|
35358
|
+
release = await getFs().acquireLock(absolutePath);
|
|
35359
|
+
} catch (error) {
|
|
35360
|
+
const msg = errorMessage(error);
|
|
35361
|
+
const globalHint = await tryGlobalCredsHint();
|
|
35362
|
+
if (globalHint) {
|
|
35363
|
+
return {
|
|
35364
|
+
loginStatus: "Expired",
|
|
35365
|
+
accessToken,
|
|
35366
|
+
refreshToken,
|
|
35367
|
+
baseUrl: credentials.UIPATH_URL,
|
|
35368
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
35369
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
35370
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
35371
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
35372
|
+
expiration,
|
|
35373
|
+
source: "file" /* File */,
|
|
35374
|
+
hint: globalHint,
|
|
35375
|
+
tokenRefresh: {
|
|
35376
|
+
attempted: false,
|
|
35377
|
+
success: false,
|
|
35378
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
35379
|
+
}
|
|
35380
|
+
};
|
|
35381
|
+
}
|
|
35026
35382
|
return {
|
|
35027
35383
|
loginStatus: "Refresh Failed",
|
|
35028
|
-
hint: "
|
|
35384
|
+
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
35029
35385
|
tokenRefresh: {
|
|
35030
|
-
attempted:
|
|
35386
|
+
attempted: false,
|
|
35031
35387
|
success: false,
|
|
35032
|
-
errorMessage:
|
|
35388
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
35033
35389
|
}
|
|
35034
35390
|
};
|
|
35035
35391
|
}
|
|
35036
|
-
|
|
35037
|
-
refreshToken = refreshedRefresh;
|
|
35038
|
-
expiration = refreshedExp;
|
|
35392
|
+
let lockedFailure;
|
|
35039
35393
|
try {
|
|
35040
|
-
await
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35044
|
-
|
|
35045
|
-
|
|
35046
|
-
|
|
35394
|
+
const outcome = await runRefreshLocked({
|
|
35395
|
+
absolutePath,
|
|
35396
|
+
refreshToken,
|
|
35397
|
+
customAuthority: credentials.UIPATH_URL,
|
|
35398
|
+
ensureTokenValidityMinutes,
|
|
35399
|
+
loadEnvFile,
|
|
35400
|
+
saveEnvFile,
|
|
35401
|
+
refreshFn: refreshTokenFn,
|
|
35402
|
+
resolveConfig
|
|
35047
35403
|
});
|
|
35048
|
-
|
|
35049
|
-
|
|
35050
|
-
|
|
35051
|
-
|
|
35052
|
-
|
|
35053
|
-
|
|
35054
|
-
|
|
35055
|
-
|
|
35056
|
-
|
|
35057
|
-
|
|
35058
|
-
|
|
35059
|
-
|
|
35404
|
+
if (outcome.kind === "fail") {
|
|
35405
|
+
lockedFailure = outcome.status;
|
|
35406
|
+
} else {
|
|
35407
|
+
accessToken = outcome.accessToken;
|
|
35408
|
+
refreshToken = outcome.refreshToken;
|
|
35409
|
+
expiration = outcome.expiration;
|
|
35410
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
35411
|
+
if (outcome.persistenceWarning) {
|
|
35412
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
35413
|
+
}
|
|
35414
|
+
}
|
|
35415
|
+
} finally {
|
|
35416
|
+
try {
|
|
35417
|
+
await release();
|
|
35418
|
+
} catch {
|
|
35419
|
+
lockReleaseFailed = true;
|
|
35420
|
+
}
|
|
35421
|
+
}
|
|
35422
|
+
if (lockedFailure) {
|
|
35423
|
+
const globalHint = await tryGlobalCredsHint();
|
|
35424
|
+
const base = globalHint ? {
|
|
35425
|
+
...lockedFailure,
|
|
35426
|
+
loginStatus: "Expired",
|
|
35427
|
+
hint: globalHint
|
|
35428
|
+
} : lockedFailure;
|
|
35429
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
35060
35430
|
}
|
|
35061
35431
|
}
|
|
35062
35432
|
const result = {
|
|
@@ -35071,23 +35441,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
35071
35441
|
expiration,
|
|
35072
35442
|
source: "file" /* File */,
|
|
35073
35443
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
35444
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
35074
35445
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
35075
35446
|
};
|
|
35076
35447
|
if (result.loginStatus === "Expired") {
|
|
35077
|
-
const
|
|
35078
|
-
|
|
35079
|
-
|
|
35080
|
-
try {
|
|
35081
|
-
const globalCreds = await loadEnvFile({
|
|
35082
|
-
envPath: globalPath
|
|
35083
|
-
});
|
|
35084
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
35085
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
35086
|
-
if (!globalExp || globalExp > new Date) {
|
|
35087
|
-
result.hint = `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
35088
|
-
}
|
|
35089
|
-
}
|
|
35090
|
-
} catch {}
|
|
35448
|
+
const globalHint = await tryGlobalCredsHint();
|
|
35449
|
+
if (globalHint) {
|
|
35450
|
+
result.hint = globalHint;
|
|
35091
35451
|
}
|
|
35092
35452
|
}
|
|
35093
35453
|
return result;
|
|
@@ -35104,8 +35464,246 @@ var getLoginStatusAsync = async (options = {}) => {
|
|
|
35104
35464
|
init_src();
|
|
35105
35465
|
// ../auth/src/logout.ts
|
|
35106
35466
|
init_src();
|
|
35107
|
-
|
|
35467
|
+
|
|
35468
|
+
// ../auth/src/index.ts
|
|
35469
|
+
init_server();
|
|
35470
|
+
|
|
35471
|
+
// ../../node_modules/@uipath/core-telemetry/dist/index.mjs
|
|
35108
35472
|
var import_sdk_logs = __toESM(require_src6(), 1);
|
|
35473
|
+
var CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
35474
|
+
var VERSION = "Version";
|
|
35475
|
+
var SERVICE = "Service";
|
|
35476
|
+
var CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
35477
|
+
var CLOUD_TENANT_NAME = "CloudTenantName";
|
|
35478
|
+
var CLOUD_URL = "CloudUrl";
|
|
35479
|
+
var CLOUD_CLIENT_ID = "CloudClientId";
|
|
35480
|
+
var CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
35481
|
+
var APP_NAME = "ApplicationName";
|
|
35482
|
+
var UNKNOWN = "";
|
|
35483
|
+
var INSTRUMENTATION_KEY_RE = /InstrumentationKey=([^;]+)/;
|
|
35484
|
+
var INGESTION_ENDPOINT_RE = /IngestionEndpoint=([^;]+)/;
|
|
35485
|
+
|
|
35486
|
+
class ApplicationInsightsEventExporter {
|
|
35487
|
+
constructor(connectionString, tags) {
|
|
35488
|
+
this.connectionString = connectionString;
|
|
35489
|
+
this.tags = tags;
|
|
35490
|
+
}
|
|
35491
|
+
export(logs, resultCallback) {
|
|
35492
|
+
try {
|
|
35493
|
+
for (const log of logs) {
|
|
35494
|
+
this.sendAsCustomEvent(log);
|
|
35495
|
+
}
|
|
35496
|
+
resultCallback({ code: 0 });
|
|
35497
|
+
} catch (error) {
|
|
35498
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
35499
|
+
console.debug("Failed to export logs to Application Insights:", err);
|
|
35500
|
+
resultCallback({ code: 1, error: err });
|
|
35501
|
+
}
|
|
35502
|
+
}
|
|
35503
|
+
shutdown() {
|
|
35504
|
+
return Promise.resolve();
|
|
35505
|
+
}
|
|
35506
|
+
sendAsCustomEvent(logRecord) {
|
|
35507
|
+
const eventName = String(logRecord.body);
|
|
35508
|
+
const payload = {
|
|
35509
|
+
name: "Microsoft.ApplicationInsights.Event",
|
|
35510
|
+
time: new Date().toISOString(),
|
|
35511
|
+
iKey: this.extractInstrumentationKey(),
|
|
35512
|
+
data: {
|
|
35513
|
+
baseType: "EventData",
|
|
35514
|
+
baseData: {
|
|
35515
|
+
ver: 2,
|
|
35516
|
+
name: eventName,
|
|
35517
|
+
properties: this.convertAttributesToProperties(logRecord.attributes)
|
|
35518
|
+
}
|
|
35519
|
+
},
|
|
35520
|
+
tags: {
|
|
35521
|
+
"ai.cloud.role": this.tags.cloudRoleName,
|
|
35522
|
+
"ai.cloud.roleInstance": this.tags.cloudRoleInstance
|
|
35523
|
+
}
|
|
35524
|
+
};
|
|
35525
|
+
this.sendToApplicationInsights(payload);
|
|
35526
|
+
}
|
|
35527
|
+
extractInstrumentationKey() {
|
|
35528
|
+
const match = INSTRUMENTATION_KEY_RE.exec(this.connectionString);
|
|
35529
|
+
return match ? match[1] : "";
|
|
35530
|
+
}
|
|
35531
|
+
convertAttributesToProperties(attributes) {
|
|
35532
|
+
const properties = {};
|
|
35533
|
+
for (const [key, value] of Object.entries(attributes ?? {})) {
|
|
35534
|
+
properties[key] = String(value);
|
|
35535
|
+
}
|
|
35536
|
+
return properties;
|
|
35537
|
+
}
|
|
35538
|
+
async sendToApplicationInsights(payload) {
|
|
35539
|
+
try {
|
|
35540
|
+
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
35541
|
+
if (!ingestionEndpoint) {
|
|
35542
|
+
console.debug("No ingestion endpoint found in connection string");
|
|
35543
|
+
return;
|
|
35544
|
+
}
|
|
35545
|
+
const url = `${ingestionEndpoint}/v2/track`;
|
|
35546
|
+
const response = await fetch(url, {
|
|
35547
|
+
method: "POST",
|
|
35548
|
+
headers: { "Content-Type": "application/json" },
|
|
35549
|
+
body: JSON.stringify(payload)
|
|
35550
|
+
});
|
|
35551
|
+
if (!response.ok) {
|
|
35552
|
+
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
35553
|
+
}
|
|
35554
|
+
} catch (error) {
|
|
35555
|
+
console.debug("Error sending event telemetry to Application Insights:", error);
|
|
35556
|
+
}
|
|
35557
|
+
}
|
|
35558
|
+
extractIngestionEndpoint() {
|
|
35559
|
+
const match = INGESTION_ENDPOINT_RE.exec(this.connectionString);
|
|
35560
|
+
return match ? match[1] : "";
|
|
35561
|
+
}
|
|
35562
|
+
}
|
|
35563
|
+
|
|
35564
|
+
class TelemetryClient {
|
|
35565
|
+
constructor() {
|
|
35566
|
+
this.isInitialized = false;
|
|
35567
|
+
}
|
|
35568
|
+
initialize(options) {
|
|
35569
|
+
if (this.isInitialized) {
|
|
35570
|
+
console.debug("Telemetry client has already been initialized");
|
|
35571
|
+
return;
|
|
35572
|
+
}
|
|
35573
|
+
this.isInitialized = true;
|
|
35574
|
+
this.options = options;
|
|
35575
|
+
this.telemetryContext = options.context;
|
|
35576
|
+
try {
|
|
35577
|
+
if (!this.isValidConnectionString(CONNECTION_STRING)) {
|
|
35578
|
+
return;
|
|
35579
|
+
}
|
|
35580
|
+
this.setupTelemetryProvider(CONNECTION_STRING);
|
|
35581
|
+
} catch (error) {
|
|
35582
|
+
console.debug("Failed to initialize telemetry:", error);
|
|
35583
|
+
}
|
|
35584
|
+
}
|
|
35585
|
+
track(eventName, name, extraAttributes = {}) {
|
|
35586
|
+
try {
|
|
35587
|
+
if (!this.logger) {
|
|
35588
|
+
return;
|
|
35589
|
+
}
|
|
35590
|
+
const finalDisplayName = name ?? eventName;
|
|
35591
|
+
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
35592
|
+
this.logger.emit({
|
|
35593
|
+
body: finalDisplayName,
|
|
35594
|
+
attributes,
|
|
35595
|
+
timestamp: Date.now()
|
|
35596
|
+
});
|
|
35597
|
+
} catch (error) {
|
|
35598
|
+
console.debug("Failed to track telemetry event:", error);
|
|
35599
|
+
}
|
|
35600
|
+
}
|
|
35601
|
+
getDefaultEventName() {
|
|
35602
|
+
return this.options?.defaultEventName;
|
|
35603
|
+
}
|
|
35604
|
+
setupTelemetryProvider(connectionString) {
|
|
35605
|
+
const opts = this.options;
|
|
35606
|
+
const exporter = new ApplicationInsightsEventExporter(connectionString, {
|
|
35607
|
+
cloudRoleName: opts.cloudRoleName,
|
|
35608
|
+
cloudRoleInstance: opts.sdkVersion
|
|
35609
|
+
});
|
|
35610
|
+
const processor = new import_sdk_logs.BatchLogRecordProcessor(exporter);
|
|
35611
|
+
this.logProvider = new import_sdk_logs.LoggerProvider({
|
|
35612
|
+
processors: [processor]
|
|
35613
|
+
});
|
|
35614
|
+
this.logger = this.logProvider.getLogger(opts.loggerName);
|
|
35615
|
+
}
|
|
35616
|
+
isValidConnectionString(connectionString) {
|
|
35617
|
+
return Boolean(connectionString) && !connectionString.startsWith("$");
|
|
35618
|
+
}
|
|
35619
|
+
getEnrichedAttributes(extraAttributes, eventName) {
|
|
35620
|
+
const opts = this.options;
|
|
35621
|
+
return {
|
|
35622
|
+
[APP_NAME]: opts?.serviceName ?? UNKNOWN,
|
|
35623
|
+
[VERSION]: opts?.sdkVersion ?? UNKNOWN,
|
|
35624
|
+
[SERVICE]: eventName,
|
|
35625
|
+
[CLOUD_URL]: this.createCloudUrl(),
|
|
35626
|
+
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName ?? UNKNOWN,
|
|
35627
|
+
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName ?? UNKNOWN,
|
|
35628
|
+
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri ?? UNKNOWN,
|
|
35629
|
+
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId ?? UNKNOWN,
|
|
35630
|
+
...extraAttributes
|
|
35631
|
+
};
|
|
35632
|
+
}
|
|
35633
|
+
createCloudUrl() {
|
|
35634
|
+
const baseUrl = this.telemetryContext?.baseUrl;
|
|
35635
|
+
const orgId = this.telemetryContext?.orgName;
|
|
35636
|
+
const tenantId = this.telemetryContext?.tenantName;
|
|
35637
|
+
if (!baseUrl || !orgId || !tenantId) {
|
|
35638
|
+
return UNKNOWN;
|
|
35639
|
+
}
|
|
35640
|
+
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
35641
|
+
}
|
|
35642
|
+
}
|
|
35643
|
+
var REGISTRY_KEY = Symbol.for("@uipath/core-telemetry/clients");
|
|
35644
|
+
function getGlobalRegistry() {
|
|
35645
|
+
const holder = globalThis;
|
|
35646
|
+
let registry2 = holder[REGISTRY_KEY];
|
|
35647
|
+
if (!registry2) {
|
|
35648
|
+
registry2 = {};
|
|
35649
|
+
holder[REGISTRY_KEY] = registry2;
|
|
35650
|
+
}
|
|
35651
|
+
return registry2;
|
|
35652
|
+
}
|
|
35653
|
+
function getOrCreateClient(name) {
|
|
35654
|
+
const registry2 = getGlobalRegistry();
|
|
35655
|
+
if (!registry2[name]) {
|
|
35656
|
+
registry2[name] = new TelemetryClient;
|
|
35657
|
+
}
|
|
35658
|
+
return registry2[name];
|
|
35659
|
+
}
|
|
35660
|
+
function createTrackedFunction(originalFunction, { client, nameOrOptions, fallbackName, opts }) {
|
|
35661
|
+
const wrapped = function(...args) {
|
|
35662
|
+
let shouldTrack = true;
|
|
35663
|
+
if (opts.condition !== undefined) {
|
|
35664
|
+
shouldTrack = typeof opts.condition === "function" ? opts.condition.apply(this, args) : opts.condition;
|
|
35665
|
+
}
|
|
35666
|
+
if (shouldTrack) {
|
|
35667
|
+
const serviceMethod = typeof nameOrOptions === "string" ? nameOrOptions : fallbackName;
|
|
35668
|
+
client.track(serviceMethod, client.getDefaultEventName(), opts.attributes);
|
|
35669
|
+
}
|
|
35670
|
+
return originalFunction.apply(this, args);
|
|
35671
|
+
};
|
|
35672
|
+
return wrapped;
|
|
35673
|
+
}
|
|
35674
|
+
function createTrack(client) {
|
|
35675
|
+
function trackFactory(nameOrOptions, options) {
|
|
35676
|
+
const opts = typeof nameOrOptions === "object" ? nameOrOptions : options ?? {};
|
|
35677
|
+
function decoratorImpl(target, propertyKey, descriptor) {
|
|
35678
|
+
if (descriptor && typeof descriptor.value === "function") {
|
|
35679
|
+
const original = descriptor.value;
|
|
35680
|
+
descriptor.value = createTrackedFunction(original, {
|
|
35681
|
+
client,
|
|
35682
|
+
nameOrOptions,
|
|
35683
|
+
fallbackName: typeof propertyKey === "string" ? propertyKey : "unknown_method",
|
|
35684
|
+
opts
|
|
35685
|
+
});
|
|
35686
|
+
return descriptor;
|
|
35687
|
+
}
|
|
35688
|
+
const fn = target;
|
|
35689
|
+
return createTrackedFunction(fn, {
|
|
35690
|
+
client,
|
|
35691
|
+
nameOrOptions,
|
|
35692
|
+
fallbackName: fn.name || "unknown_function",
|
|
35693
|
+
opts
|
|
35694
|
+
});
|
|
35695
|
+
}
|
|
35696
|
+
return decoratorImpl;
|
|
35697
|
+
}
|
|
35698
|
+
return trackFactory;
|
|
35699
|
+
}
|
|
35700
|
+
function createTrackEvent(client) {
|
|
35701
|
+
return function trackEvent(eventName, name, attributes) {
|
|
35702
|
+
client.track(eventName, name, attributes);
|
|
35703
|
+
};
|
|
35704
|
+
}
|
|
35705
|
+
|
|
35706
|
+
// ../../node_modules/@uipath/uipath-typescript/dist/index.mjs
|
|
35109
35707
|
function __decorate(decorators, target, key, desc) {
|
|
35110
35708
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35111
35709
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -38988,6 +39586,7 @@ var ORCHESTRATOR_BASE = "orchestrator_";
|
|
|
38988
39586
|
var PIMS_BASE = "pims_";
|
|
38989
39587
|
var DATAFABRIC_BASE = "datafabric_";
|
|
38990
39588
|
var IDENTITY_BASE = "identity_";
|
|
39589
|
+
var INSIGHTS_RTM_BASE = "insightsrtm_";
|
|
38991
39590
|
var TASK_ENDPOINTS = {
|
|
38992
39591
|
CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
|
|
38993
39592
|
GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
|
|
@@ -39010,7 +39609,9 @@ var BUCKET_ENDPOINTS = {
|
|
|
39010
39609
|
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
|
|
39011
39610
|
GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
|
|
39012
39611
|
GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
|
|
39013
|
-
GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri
|
|
39612
|
+
GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
|
|
39613
|
+
DELETE_FILE: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.DeleteFile`,
|
|
39614
|
+
GET_FILES: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetFiles`
|
|
39014
39615
|
};
|
|
39015
39616
|
var PROCESS_ENDPOINTS = {
|
|
39016
39617
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Releases`,
|
|
@@ -39061,6 +39662,15 @@ var MAESTRO_ENDPOINTS = {
|
|
|
39061
39662
|
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
39062
39663
|
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
39063
39664
|
REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`
|
|
39665
|
+
},
|
|
39666
|
+
INSIGHTS: {
|
|
39667
|
+
SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
|
|
39668
|
+
STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
|
|
39669
|
+
TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
|
|
39670
|
+
TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
|
|
39671
|
+
TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
|
|
39672
|
+
INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
|
|
39673
|
+
TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`
|
|
39064
39674
|
}
|
|
39065
39675
|
};
|
|
39066
39676
|
var DATA_FABRIC_TENANT_FOLDER_ID = "00000000-0000-0000-0000-000000000000";
|
|
@@ -39087,7 +39697,13 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
39087
39697
|
},
|
|
39088
39698
|
CHOICESETS: {
|
|
39089
39699
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
39090
|
-
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion
|
|
39700
|
+
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
39701
|
+
CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
39702
|
+
UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
|
|
39703
|
+
DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
|
|
39704
|
+
INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
|
|
39705
|
+
UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
|
|
39706
|
+
DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`
|
|
39091
39707
|
}
|
|
39092
39708
|
};
|
|
39093
39709
|
var IDENTITY_ENDPOINTS = {
|
|
@@ -39684,218 +40300,33 @@ function isCompleteConfig(config2) {
|
|
|
39684
40300
|
function normalizeBaseUrl(url) {
|
|
39685
40301
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
39686
40302
|
}
|
|
39687
|
-
var
|
|
39688
|
-
var SDK_VERSION = "1.3.7";
|
|
39689
|
-
var VERSION = "Version";
|
|
39690
|
-
var SERVICE = "Service";
|
|
39691
|
-
var CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
39692
|
-
var CLOUD_TENANT_NAME = "CloudTenantName";
|
|
39693
|
-
var CLOUD_URL = "CloudUrl";
|
|
39694
|
-
var CLOUD_CLIENT_ID = "CloudClientId";
|
|
39695
|
-
var CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
39696
|
-
var APP_NAME = "ApplicationName";
|
|
40303
|
+
var SDK_VERSION = "1.3.11";
|
|
39697
40304
|
var CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
39698
40305
|
var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
39699
40306
|
var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
39700
40307
|
var SDK_RUN_EVENT = "Sdk.Run";
|
|
39701
|
-
var
|
|
39702
|
-
|
|
39703
|
-
|
|
39704
|
-
|
|
39705
|
-
|
|
39706
|
-
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
|
|
39710
|
-
|
|
39711
|
-
|
|
39712
|
-
|
|
39713
|
-
} catch (error) {
|
|
39714
|
-
console.debug("Failed to export logs to Application Insights:", error);
|
|
39715
|
-
resultCallback({ code: 2, error });
|
|
39716
|
-
}
|
|
39717
|
-
}
|
|
39718
|
-
shutdown() {
|
|
39719
|
-
return Promise.resolve();
|
|
39720
|
-
}
|
|
39721
|
-
sendAsCustomEvent(logRecord) {
|
|
39722
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
39723
|
-
const payload = {
|
|
39724
|
-
name: "Microsoft.ApplicationInsights.Event",
|
|
39725
|
-
time: new Date().toISOString(),
|
|
39726
|
-
iKey: this.extractInstrumentationKey(),
|
|
39727
|
-
data: {
|
|
39728
|
-
baseType: "EventData",
|
|
39729
|
-
baseData: {
|
|
39730
|
-
ver: 2,
|
|
39731
|
-
name: eventName,
|
|
39732
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
39733
|
-
}
|
|
39734
|
-
},
|
|
39735
|
-
tags: {
|
|
39736
|
-
"ai.cloud.role": CLOUD_ROLE_NAME,
|
|
39737
|
-
"ai.cloud.roleInstance": SDK_VERSION
|
|
39738
|
-
}
|
|
39739
|
-
};
|
|
39740
|
-
this.sendToApplicationInsights(payload);
|
|
39741
|
-
}
|
|
39742
|
-
extractInstrumentationKey() {
|
|
39743
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
39744
|
-
return match ? match[1] : "";
|
|
39745
|
-
}
|
|
39746
|
-
convertAttributesToProperties(attributes) {
|
|
39747
|
-
const properties = {};
|
|
39748
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
39749
|
-
properties[key] = String(value);
|
|
40308
|
+
var sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
|
|
40309
|
+
var track = createTrack(sdkClient);
|
|
40310
|
+
var trackEvent = createTrackEvent(sdkClient);
|
|
40311
|
+
var telemetryClient = {
|
|
40312
|
+
initialize(context) {
|
|
40313
|
+
sdkClient.initialize({
|
|
40314
|
+
sdkVersion: SDK_VERSION,
|
|
40315
|
+
serviceName: SDK_SERVICE_NAME,
|
|
40316
|
+
cloudRoleName: CLOUD_ROLE_NAME,
|
|
40317
|
+
loggerName: SDK_LOGGER_NAME,
|
|
40318
|
+
defaultEventName: SDK_RUN_EVENT,
|
|
40319
|
+
context
|
|
39750
40320
|
});
|
|
39751
|
-
return properties;
|
|
39752
40321
|
}
|
|
39753
|
-
|
|
39754
|
-
|
|
39755
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
39756
|
-
if (!ingestionEndpoint) {
|
|
39757
|
-
console.debug("No ingestion endpoint found in connection string");
|
|
39758
|
-
return;
|
|
39759
|
-
}
|
|
39760
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
39761
|
-
const response = await fetch(url, {
|
|
39762
|
-
method: "POST",
|
|
39763
|
-
headers: {
|
|
39764
|
-
"Content-Type": "application/json"
|
|
39765
|
-
},
|
|
39766
|
-
body: JSON.stringify(payload)
|
|
39767
|
-
});
|
|
39768
|
-
if (!response.ok) {
|
|
39769
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
39770
|
-
}
|
|
39771
|
-
} catch (error) {
|
|
39772
|
-
console.debug("Error sending event telemetry to Application Insights:", error);
|
|
39773
|
-
}
|
|
39774
|
-
}
|
|
39775
|
-
extractIngestionEndpoint() {
|
|
39776
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
39777
|
-
return match ? match[1] : "";
|
|
39778
|
-
}
|
|
39779
|
-
}
|
|
39780
|
-
|
|
39781
|
-
class TelemetryClient {
|
|
39782
|
-
constructor() {
|
|
39783
|
-
this.isInitialized = false;
|
|
39784
|
-
}
|
|
39785
|
-
static getInstance() {
|
|
39786
|
-
if (!TelemetryClient.instance) {
|
|
39787
|
-
TelemetryClient.instance = new TelemetryClient;
|
|
39788
|
-
}
|
|
39789
|
-
return TelemetryClient.instance;
|
|
39790
|
-
}
|
|
39791
|
-
initialize(config2) {
|
|
39792
|
-
if (this.isInitialized) {
|
|
39793
|
-
return;
|
|
39794
|
-
}
|
|
39795
|
-
this.isInitialized = true;
|
|
39796
|
-
if (config2) {
|
|
39797
|
-
this.telemetryContext = config2;
|
|
39798
|
-
}
|
|
39799
|
-
try {
|
|
39800
|
-
const connectionString = this.getConnectionString();
|
|
39801
|
-
if (!connectionString) {
|
|
39802
|
-
return;
|
|
39803
|
-
}
|
|
39804
|
-
this.setupTelemetryProvider(connectionString);
|
|
39805
|
-
} catch (error) {
|
|
39806
|
-
console.debug("Failed to initialize OpenTelemetry:", error);
|
|
39807
|
-
}
|
|
39808
|
-
}
|
|
39809
|
-
getConnectionString() {
|
|
39810
|
-
const connectionString = CONNECTION_STRING;
|
|
39811
|
-
return connectionString;
|
|
39812
|
-
}
|
|
39813
|
-
setupTelemetryProvider(connectionString) {
|
|
39814
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
39815
|
-
const processor = new import_sdk_logs.BatchLogRecordProcessor(exporter);
|
|
39816
|
-
this.logProvider = new import_sdk_logs.LoggerProvider({
|
|
39817
|
-
processors: [processor]
|
|
39818
|
-
});
|
|
39819
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
39820
|
-
}
|
|
39821
|
-
track(eventName, name, extraAttributes = {}) {
|
|
39822
|
-
try {
|
|
39823
|
-
if (!this.logger) {
|
|
39824
|
-
return;
|
|
39825
|
-
}
|
|
39826
|
-
const finalDisplayName = name || eventName;
|
|
39827
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
39828
|
-
this.logger.emit({
|
|
39829
|
-
body: finalDisplayName,
|
|
39830
|
-
attributes,
|
|
39831
|
-
timestamp: Date.now()
|
|
39832
|
-
});
|
|
39833
|
-
} catch (error) {
|
|
39834
|
-
console.debug("Failed to track telemetry event:", error);
|
|
39835
|
-
}
|
|
39836
|
-
}
|
|
39837
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
39838
|
-
const attributes = {
|
|
39839
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
39840
|
-
[VERSION]: SDK_VERSION,
|
|
39841
|
-
[SERVICE]: eventName,
|
|
39842
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
39843
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN$1,
|
|
39844
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN$1,
|
|
39845
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN$1,
|
|
39846
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN$1,
|
|
39847
|
-
...extraAttributes
|
|
39848
|
-
};
|
|
39849
|
-
return attributes;
|
|
39850
|
-
}
|
|
39851
|
-
createCloudUrl() {
|
|
39852
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
39853
|
-
const orgId = this.telemetryContext?.orgName;
|
|
39854
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
39855
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
39856
|
-
return UNKNOWN$1;
|
|
39857
|
-
}
|
|
39858
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
39859
|
-
}
|
|
39860
|
-
}
|
|
39861
|
-
var telemetryClient = TelemetryClient.getInstance();
|
|
39862
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
39863
|
-
return function(...args) {
|
|
39864
|
-
let shouldTrack = true;
|
|
39865
|
-
if (opts.condition !== undefined) {
|
|
39866
|
-
if (typeof opts.condition === "function") {
|
|
39867
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
39868
|
-
} else {
|
|
39869
|
-
shouldTrack = opts.condition;
|
|
39870
|
-
}
|
|
39871
|
-
}
|
|
39872
|
-
if (shouldTrack) {
|
|
39873
|
-
const serviceMethod = typeof nameOrOptions === "string" ? nameOrOptions : fallbackName;
|
|
39874
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
39875
|
-
}
|
|
39876
|
-
return originalFunction.apply(this, args);
|
|
39877
|
-
};
|
|
39878
|
-
}
|
|
39879
|
-
function track(nameOrOptions, options) {
|
|
39880
|
-
return function decorator(_target, propertyKey, descriptor) {
|
|
39881
|
-
const opts = typeof nameOrOptions === "object" ? nameOrOptions : options || {};
|
|
39882
|
-
if (descriptor && typeof descriptor.value === "function") {
|
|
39883
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || "unknown_method", opts);
|
|
39884
|
-
return descriptor;
|
|
39885
|
-
}
|
|
39886
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || "unknown_function", opts);
|
|
39887
|
-
};
|
|
39888
|
-
}
|
|
39889
|
-
function trackEvent(eventName, name, attributes) {
|
|
39890
|
-
telemetryClient.track(eventName, name, attributes);
|
|
39891
|
-
}
|
|
39892
|
-
var REGISTRY_KEY = Symbol.for("@uipath/sdk-internals-registry");
|
|
40322
|
+
};
|
|
40323
|
+
var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
|
|
39893
40324
|
var getGlobalStore = () => {
|
|
39894
40325
|
const globalObj = globalThis;
|
|
39895
|
-
if (!globalObj[
|
|
39896
|
-
globalObj[
|
|
40326
|
+
if (!globalObj[REGISTRY_KEY2]) {
|
|
40327
|
+
globalObj[REGISTRY_KEY2] = new WeakMap;
|
|
39897
40328
|
}
|
|
39898
|
-
return globalObj[
|
|
40329
|
+
return globalObj[REGISTRY_KEY2];
|
|
39899
40330
|
};
|
|
39900
40331
|
|
|
39901
40332
|
class SDKInternalsRegistry {
|
|
@@ -39995,8 +40426,8 @@ var UiPath$1 = class UiPath {
|
|
|
39995
40426
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
39996
40427
|
}
|
|
39997
40428
|
} catch (error) {
|
|
39998
|
-
const
|
|
39999
|
-
throw new Error(`Failed to initialize UiPath SDK: ${
|
|
40429
|
+
const errorMessage2 = error instanceof Error ? error.message : "An unknown error occurred";
|
|
40430
|
+
throw new Error(`Failed to initialize UiPath SDK: ${errorMessage2}`);
|
|
40000
40431
|
}
|
|
40001
40432
|
}
|
|
40002
40433
|
setMultiLogin() {
|
|
@@ -40025,8 +40456,8 @@ var UiPath$1 = class UiPath {
|
|
|
40025
40456
|
}
|
|
40026
40457
|
return false;
|
|
40027
40458
|
} catch (error) {
|
|
40028
|
-
const
|
|
40029
|
-
throw new Error(`Failed to complete OAuth: ${
|
|
40459
|
+
const errorMessage2 = error instanceof Error ? error.message : "An unknown error occurred";
|
|
40460
|
+
throw new Error(`Failed to complete OAuth: ${errorMessage2}`);
|
|
40030
40461
|
}
|
|
40031
40462
|
}
|
|
40032
40463
|
isAuthenticated() {
|
|
@@ -40347,7 +40778,17 @@ class ApiClient {
|
|
|
40347
40778
|
if (!text) {
|
|
40348
40779
|
return;
|
|
40349
40780
|
}
|
|
40350
|
-
|
|
40781
|
+
try {
|
|
40782
|
+
return JSON.parse(text);
|
|
40783
|
+
} catch (error) {
|
|
40784
|
+
if (error instanceof SyntaxError) {
|
|
40785
|
+
throw new ServerError({
|
|
40786
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
40787
|
+
statusCode: response.status
|
|
40788
|
+
});
|
|
40789
|
+
}
|
|
40790
|
+
throw error;
|
|
40791
|
+
}
|
|
40351
40792
|
} catch (error) {
|
|
40352
40793
|
if (error.type && error.type.includes("Error")) {
|
|
40353
40794
|
throw error;
|
|
@@ -40376,6 +40817,22 @@ var PaginationType;
|
|
|
40376
40817
|
PaginationType2["OFFSET"] = "offset";
|
|
40377
40818
|
PaginationType2["TOKEN"] = "token";
|
|
40378
40819
|
})(PaginationType || (PaginationType = {}));
|
|
40820
|
+
function resolveNestedField(data, fieldPath) {
|
|
40821
|
+
if (!data) {
|
|
40822
|
+
return;
|
|
40823
|
+
}
|
|
40824
|
+
if (fieldPath in data) {
|
|
40825
|
+
return data[fieldPath];
|
|
40826
|
+
}
|
|
40827
|
+
if (!fieldPath.includes(".")) {
|
|
40828
|
+
return;
|
|
40829
|
+
}
|
|
40830
|
+
let value = data;
|
|
40831
|
+
for (const part of fieldPath.split(".")) {
|
|
40832
|
+
value = value?.[part];
|
|
40833
|
+
}
|
|
40834
|
+
return value;
|
|
40835
|
+
}
|
|
40379
40836
|
function filterUndefined(obj) {
|
|
40380
40837
|
const result = {};
|
|
40381
40838
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -40490,7 +40947,7 @@ function createHeaders(headersObj) {
|
|
|
40490
40947
|
return headers;
|
|
40491
40948
|
}
|
|
40492
40949
|
var ODATA_PREFIX = "$";
|
|
40493
|
-
var
|
|
40950
|
+
var UNKNOWN2 = "Unknown";
|
|
40494
40951
|
var NO_INSTANCE = "no-instance";
|
|
40495
40952
|
var HTTP_METHODS = {
|
|
40496
40953
|
GET: "GET",
|
|
@@ -40512,6 +40969,15 @@ var BUCKET_PAGINATION = {
|
|
|
40512
40969
|
ITEMS_FIELD: "items",
|
|
40513
40970
|
CONTINUATION_TOKEN_FIELD: "continuationToken"
|
|
40514
40971
|
};
|
|
40972
|
+
var SLA_SUMMARY_PAGINATION = {
|
|
40973
|
+
ITEMS_FIELD: "data",
|
|
40974
|
+
TOTAL_COUNT_FIELD: "pagination.totalCount"
|
|
40975
|
+
};
|
|
40976
|
+
var SLA_SUMMARY_OFFSET_PARAMS = {
|
|
40977
|
+
PAGE_SIZE_PARAM: "PageSize",
|
|
40978
|
+
OFFSET_PARAM: "PageNumber",
|
|
40979
|
+
COUNT_PARAM: undefined
|
|
40980
|
+
};
|
|
40515
40981
|
var PROCESS_INSTANCE_PAGINATION = {
|
|
40516
40982
|
ITEMS_FIELD: "instances",
|
|
40517
40983
|
CONTINUATION_TOKEN_FIELD: "nextPage"
|
|
@@ -40534,6 +41000,10 @@ var PROCESS_INSTANCE_TOKEN_PARAMS = {
|
|
|
40534
41000
|
PAGE_SIZE_PARAM: "pageSize",
|
|
40535
41001
|
TOKEN_PARAM: "nextPage"
|
|
40536
41002
|
};
|
|
41003
|
+
function toISOUtc(value) {
|
|
41004
|
+
const date2 = new Date(value + " UTC");
|
|
41005
|
+
return isNaN(date2.getTime()) ? value : date2.toISOString();
|
|
41006
|
+
}
|
|
40537
41007
|
function transformData(data, fieldMapping) {
|
|
40538
41008
|
if (Array.isArray(data)) {
|
|
40539
41009
|
return data.map((item) => transformData(item, fieldMapping));
|
|
@@ -40734,9 +41204,9 @@ class PaginationHelpers {
|
|
|
40734
41204
|
}
|
|
40735
41205
|
}
|
|
40736
41206
|
static async getAllPaginated(params) {
|
|
40737
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
41207
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
40738
41208
|
const endpoint = getEndpoint(folderId);
|
|
40739
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
41209
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
40740
41210
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
40741
41211
|
headers,
|
|
40742
41212
|
params: additionalParams,
|
|
@@ -40757,11 +41227,11 @@ class PaginationHelpers {
|
|
|
40757
41227
|
};
|
|
40758
41228
|
}
|
|
40759
41229
|
static async getAllNonPaginated(params) {
|
|
40760
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
41230
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
40761
41231
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
40762
41232
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
40763
41233
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
40764
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
41234
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
40765
41235
|
let response;
|
|
40766
41236
|
if (method === HTTP_METHODS.POST) {
|
|
40767
41237
|
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
@@ -40772,7 +41242,8 @@ class PaginationHelpers {
|
|
|
40772
41242
|
});
|
|
40773
41243
|
}
|
|
40774
41244
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
40775
|
-
const
|
|
41245
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
41246
|
+
const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
|
|
40776
41247
|
const parsedItems = typeof rawItems === "string" ? JSON.parse(rawItems) : rawItems || [];
|
|
40777
41248
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
40778
41249
|
return {
|
|
@@ -40802,6 +41273,7 @@ class PaginationHelpers {
|
|
|
40802
41273
|
serviceAccess: config2.serviceAccess,
|
|
40803
41274
|
getEndpoint: config2.getEndpoint,
|
|
40804
41275
|
folderId,
|
|
41276
|
+
headers: config2.headers,
|
|
40805
41277
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
40806
41278
|
additionalParams: prefixedOptions,
|
|
40807
41279
|
transformFn: config2.transformFn,
|
|
@@ -40818,6 +41290,7 @@ class PaginationHelpers {
|
|
|
40818
41290
|
getAllEndpoint: config2.getEndpoint(),
|
|
40819
41291
|
getByFolderEndpoint: byFolderEndpoint,
|
|
40820
41292
|
folderId,
|
|
41293
|
+
headers: config2.headers,
|
|
40821
41294
|
additionalParams: prefixedOptions,
|
|
40822
41295
|
transformFn: config2.transformFn,
|
|
40823
41296
|
method: config2.method,
|
|
@@ -40927,9 +41400,14 @@ class BaseService {
|
|
|
40927
41400
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
40928
41401
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
40929
41402
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
41403
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
40930
41404
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
40931
|
-
if (
|
|
40932
|
-
|
|
41405
|
+
if (convertToSkip) {
|
|
41406
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
41407
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
41408
|
+
}
|
|
41409
|
+
} else {
|
|
41410
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
40933
41411
|
}
|
|
40934
41412
|
{
|
|
40935
41413
|
requestParams[countParam] = true;
|
|
@@ -40953,7 +41431,8 @@ class BaseService {
|
|
|
40953
41431
|
const totalCountField = fields.totalCountField || "totalRecordCount";
|
|
40954
41432
|
const continuationTokenField = fields.continuationTokenField || "continuationToken";
|
|
40955
41433
|
const items = Array.isArray(response.data) ? response.data : response.data[itemsField] || [];
|
|
40956
|
-
const
|
|
41434
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
41435
|
+
const totalCount = typeof rawTotalCount === "number" ? rawTotalCount : undefined;
|
|
40957
41436
|
const continuationToken = response.data[continuationTokenField];
|
|
40958
41437
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
40959
41438
|
totalCount,
|
|
@@ -41439,10 +41918,6 @@ class EntityService extends BaseService {
|
|
|
41439
41918
|
return this.insertRecordsById(id, data, options);
|
|
41440
41919
|
}
|
|
41441
41920
|
async create(name, fields, options) {
|
|
41442
|
-
this.validateName(name, "entity");
|
|
41443
|
-
for (const field of fields) {
|
|
41444
|
-
this.validateName(field.fieldName, "field");
|
|
41445
|
-
}
|
|
41446
41921
|
const opts = options ?? {};
|
|
41447
41922
|
const payload = {
|
|
41448
41923
|
...opts.description !== undefined && { description: opts.description },
|
|
@@ -41514,6 +41989,7 @@ class EntityService extends BaseService {
|
|
|
41514
41989
|
...update.isUnique !== undefined && { isUnique: update.isUnique },
|
|
41515
41990
|
...update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled },
|
|
41516
41991
|
...update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted },
|
|
41992
|
+
...update.isHiddenField !== undefined && { isHiddenField: update.isHiddenField },
|
|
41517
41993
|
...update.defaultValue !== undefined && { defaultValue: update.defaultValue },
|
|
41518
41994
|
...hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }
|
|
41519
41995
|
};
|
|
@@ -41521,9 +41997,6 @@ class EntityService extends BaseService {
|
|
|
41521
41997
|
}
|
|
41522
41998
|
const newFields = [];
|
|
41523
41999
|
if (options.addFields?.length) {
|
|
41524
|
-
for (const field of options.addFields) {
|
|
41525
|
-
this.validateName(field.fieldName, "field");
|
|
41526
|
-
}
|
|
41527
42000
|
newFields.push(...options.addFields.map((f) => this.buildSchemaFieldPayload(f)));
|
|
41528
42001
|
}
|
|
41529
42002
|
await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
|
|
@@ -41594,9 +42067,15 @@ class EntityService extends BaseService {
|
|
|
41594
42067
|
});
|
|
41595
42068
|
}
|
|
41596
42069
|
buildSchemaFieldPayload(field) {
|
|
41597
|
-
this.validateName(field.fieldName, "field");
|
|
41598
42070
|
const fieldType = field.type ?? EntityFieldDataType.STRING;
|
|
41599
42071
|
this.validateFieldConstraints(fieldType, field, field.fieldName);
|
|
42072
|
+
const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
|
|
42073
|
+
const isFile = fieldType === EntityFieldDataType.FILE;
|
|
42074
|
+
if ((isRelationship || isFile) && (!field.referenceEntityId || !field.referenceFieldId)) {
|
|
42075
|
+
throw new ValidationError({
|
|
42076
|
+
message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`
|
|
42077
|
+
});
|
|
42078
|
+
}
|
|
41600
42079
|
const mapping = EntitySchemaFieldTypeMap[fieldType];
|
|
41601
42080
|
return {
|
|
41602
42081
|
name: field.fieldName,
|
|
@@ -41611,10 +42090,13 @@ class EntityService extends BaseService {
|
|
|
41611
42090
|
isUnique: field.isUnique ?? false,
|
|
41612
42091
|
isRbacEnabled: field.isRbacEnabled ?? false,
|
|
41613
42092
|
isEncrypted: field.isEncrypted ?? false,
|
|
42093
|
+
isHiddenField: field.isHiddenField ?? false,
|
|
41614
42094
|
...field.defaultValue !== undefined && { defaultValue: field.defaultValue },
|
|
41615
42095
|
...field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId },
|
|
41616
|
-
...
|
|
41617
|
-
...
|
|
42096
|
+
...(isRelationship || isFile) && { isForeignKey: true },
|
|
42097
|
+
...isRelationship && { referenceType: ReferenceType.ManyToOne },
|
|
42098
|
+
...field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } },
|
|
42099
|
+
...field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }
|
|
41618
42100
|
};
|
|
41619
42101
|
}
|
|
41620
42102
|
resolveFieldDataType(f) {
|
|
@@ -41693,28 +42175,7 @@ class EntityService extends BaseService {
|
|
|
41693
42175
|
return {};
|
|
41694
42176
|
}
|
|
41695
42177
|
}
|
|
41696
|
-
validateName(name, context) {
|
|
41697
|
-
if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
|
|
41698
|
-
const suggestion = name.replace(/\W/g, "").replace(/^[0-9_]+/, "");
|
|
41699
|
-
const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
|
|
41700
|
-
throw new ValidationError({
|
|
41701
|
-
message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
|
|
41702
|
-
});
|
|
41703
|
-
}
|
|
41704
|
-
if (context === "field" && EntityService.RESERVED_FIELD_NAMES.has(name)) {
|
|
41705
|
-
throw new ValidationError({
|
|
41706
|
-
message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(", ")}.`
|
|
41707
|
-
});
|
|
41708
|
-
}
|
|
41709
|
-
}
|
|
41710
42178
|
}
|
|
41711
|
-
EntityService.RESERVED_FIELD_NAMES = new Set([
|
|
41712
|
-
"Id",
|
|
41713
|
-
"CreatedBy",
|
|
41714
|
-
"CreateTime",
|
|
41715
|
-
"UpdatedBy",
|
|
41716
|
-
"UpdateTime"
|
|
41717
|
-
]);
|
|
41718
42179
|
__decorate([
|
|
41719
42180
|
track("Entities.GetById")
|
|
41720
42181
|
], EntityService.prototype, "getById", null);
|
|
@@ -41798,6 +42259,62 @@ class ChoiceSetService extends BaseService {
|
|
|
41798
42259
|
}
|
|
41799
42260
|
}, options);
|
|
41800
42261
|
}
|
|
42262
|
+
async create(name, options) {
|
|
42263
|
+
const opts = options ?? {};
|
|
42264
|
+
const payload = {
|
|
42265
|
+
...opts.description !== undefined && { description: opts.description },
|
|
42266
|
+
...opts.displayName !== undefined && { displayName: opts.displayName },
|
|
42267
|
+
entityDefinition: {
|
|
42268
|
+
name,
|
|
42269
|
+
fields: [],
|
|
42270
|
+
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID
|
|
42271
|
+
}
|
|
42272
|
+
};
|
|
42273
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
|
|
42274
|
+
return response.data;
|
|
42275
|
+
}
|
|
42276
|
+
async updateById(choiceSetId, options) {
|
|
42277
|
+
if (options.displayName === undefined && options.description === undefined) {
|
|
42278
|
+
throw new ValidationError({
|
|
42279
|
+
message: "updateById requires at least one of displayName or description."
|
|
42280
|
+
});
|
|
42281
|
+
}
|
|
42282
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
|
|
42283
|
+
...options.displayName !== undefined && { displayName: options.displayName },
|
|
42284
|
+
...options.description !== undefined && { description: options.description }
|
|
42285
|
+
});
|
|
42286
|
+
}
|
|
42287
|
+
async deleteById(choiceSetId) {
|
|
42288
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
|
|
42289
|
+
}
|
|
42290
|
+
async insertValueById(choiceSetId, name, options) {
|
|
42291
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
42292
|
+
const payload = {
|
|
42293
|
+
Name: name,
|
|
42294
|
+
...options?.displayName !== undefined && { DisplayName: options.displayName }
|
|
42295
|
+
};
|
|
42296
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
|
|
42297
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
42298
|
+
return transformData(camelCased, EntityMap);
|
|
42299
|
+
}
|
|
42300
|
+
async updateValueById(choiceSetId, valueId, displayName) {
|
|
42301
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
42302
|
+
const payload = { DisplayName: displayName };
|
|
42303
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
|
|
42304
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
42305
|
+
return transformData(camelCased, EntityMap);
|
|
42306
|
+
}
|
|
42307
|
+
async deleteValuesById(choiceSetId, valueIds) {
|
|
42308
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
|
|
42309
|
+
}
|
|
42310
|
+
async resolveChoiceSetName(choiceSetId) {
|
|
42311
|
+
const all = await this.getAll();
|
|
42312
|
+
const match = all.find((cs) => cs.id === choiceSetId);
|
|
42313
|
+
if (!match) {
|
|
42314
|
+
throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
|
|
42315
|
+
}
|
|
42316
|
+
return match.name;
|
|
42317
|
+
}
|
|
41801
42318
|
}
|
|
41802
42319
|
__decorate([
|
|
41803
42320
|
track("Choicesets.GetAll")
|
|
@@ -41805,6 +42322,24 @@ __decorate([
|
|
|
41805
42322
|
__decorate([
|
|
41806
42323
|
track("Choicesets.GetById")
|
|
41807
42324
|
], ChoiceSetService.prototype, "getById", null);
|
|
42325
|
+
__decorate([
|
|
42326
|
+
track("Choicesets.Create")
|
|
42327
|
+
], ChoiceSetService.prototype, "create", null);
|
|
42328
|
+
__decorate([
|
|
42329
|
+
track("Choicesets.UpdateById")
|
|
42330
|
+
], ChoiceSetService.prototype, "updateById", null);
|
|
42331
|
+
__decorate([
|
|
42332
|
+
track("Choicesets.DeleteById")
|
|
42333
|
+
], ChoiceSetService.prototype, "deleteById", null);
|
|
42334
|
+
__decorate([
|
|
42335
|
+
track("Choicesets.InsertValueById")
|
|
42336
|
+
], ChoiceSetService.prototype, "insertValueById", null);
|
|
42337
|
+
__decorate([
|
|
42338
|
+
track("Choicesets.UpdateValueById")
|
|
42339
|
+
], ChoiceSetService.prototype, "updateValueById", null);
|
|
42340
|
+
__decorate([
|
|
42341
|
+
track("Choicesets.DeleteValuesById")
|
|
42342
|
+
], ChoiceSetService.prototype, "deleteValuesById", null);
|
|
41808
42343
|
function createProcessMethods(processData, service) {
|
|
41809
42344
|
return {
|
|
41810
42345
|
async getIncidents() {
|
|
@@ -41820,6 +42355,30 @@ function createProcessWithMethods(processData, service) {
|
|
|
41820
42355
|
const methods = createProcessMethods(processData, service);
|
|
41821
42356
|
return Object.assign({}, processData, methods);
|
|
41822
42357
|
}
|
|
42358
|
+
function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
|
|
42359
|
+
return {
|
|
42360
|
+
commonParams: {
|
|
42361
|
+
startTime: startTime.getTime(),
|
|
42362
|
+
endTime: endTime.getTime(),
|
|
42363
|
+
isCaseManagement,
|
|
42364
|
+
...options?.packageId ? { packageId: options.packageId } : {},
|
|
42365
|
+
...options?.processKey ? { processKey: options.processKey } : {},
|
|
42366
|
+
...options?.version ? { version: options.version } : {}
|
|
42367
|
+
}
|
|
42368
|
+
};
|
|
42369
|
+
}
|
|
42370
|
+
async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
|
|
42371
|
+
const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
|
|
42372
|
+
commonParams: {
|
|
42373
|
+
startTime: startTime.getTime(),
|
|
42374
|
+
endTime: endTime.getTime(),
|
|
42375
|
+
isCaseManagement
|
|
42376
|
+
},
|
|
42377
|
+
timeSliceUnit: options?.groupBy,
|
|
42378
|
+
timezoneOffset: new Date().getTimezoneOffset() * -1
|
|
42379
|
+
});
|
|
42380
|
+
return response.data ?? [];
|
|
42381
|
+
}
|
|
41823
42382
|
var ProcessIncidentMap = {
|
|
41824
42383
|
errorTimeUtc: "errorTime"
|
|
41825
42384
|
};
|
|
@@ -41895,8 +42454,8 @@ class BpmnHelpers {
|
|
|
41895
42454
|
const transformed = transformData(incident, ProcessIncidentMap);
|
|
41896
42455
|
return {
|
|
41897
42456
|
...transformed,
|
|
41898
|
-
incidentElementActivityType: element?.type ||
|
|
41899
|
-
incidentElementActivityName: element?.name ||
|
|
42457
|
+
incidentElementActivityType: element?.type || UNKNOWN2,
|
|
42458
|
+
incidentElementActivityName: element?.name || UNKNOWN2
|
|
41900
42459
|
};
|
|
41901
42460
|
}
|
|
41902
42461
|
}
|
|
@@ -41978,6 +42537,29 @@ var DebugMode;
|
|
|
41978
42537
|
DebugMode2["StepByStep"] = "StepByStep";
|
|
41979
42538
|
DebugMode2["SingleStep"] = "SingleStep";
|
|
41980
42539
|
})(DebugMode || (DebugMode = {}));
|
|
42540
|
+
var SlaSummaryStatus;
|
|
42541
|
+
(function(SlaSummaryStatus2) {
|
|
42542
|
+
SlaSummaryStatus2["ON_TRACK"] = "On Track";
|
|
42543
|
+
SlaSummaryStatus2["AT_RISK"] = "At Risk";
|
|
42544
|
+
SlaSummaryStatus2["OVERDUE"] = "Overdue";
|
|
42545
|
+
SlaSummaryStatus2["COMPLETED"] = "Completed";
|
|
42546
|
+
SlaSummaryStatus2["UNKNOWN"] = "Unknown";
|
|
42547
|
+
})(SlaSummaryStatus || (SlaSummaryStatus = {}));
|
|
42548
|
+
var InstanceStatus;
|
|
42549
|
+
(function(InstanceStatus2) {
|
|
42550
|
+
InstanceStatus2["UNKNOWN"] = "";
|
|
42551
|
+
InstanceStatus2["CANCELLED"] = "Cancelled";
|
|
42552
|
+
InstanceStatus2["CANCELING"] = "Canceling";
|
|
42553
|
+
InstanceStatus2["COMPLETED"] = "Completed";
|
|
42554
|
+
InstanceStatus2["FAULTED"] = "Faulted";
|
|
42555
|
+
InstanceStatus2["PAUSED"] = "Paused";
|
|
42556
|
+
InstanceStatus2["PAUSING"] = "Pausing";
|
|
42557
|
+
InstanceStatus2["PENDING"] = "Pending";
|
|
42558
|
+
InstanceStatus2["RESUMING"] = "Resuming";
|
|
42559
|
+
InstanceStatus2["RETRYING"] = "Retrying";
|
|
42560
|
+
InstanceStatus2["RUNNING"] = "Running";
|
|
42561
|
+
InstanceStatus2["UPGRADING"] = "Upgrading";
|
|
42562
|
+
})(InstanceStatus || (InstanceStatus = {}));
|
|
41981
42563
|
var StageTaskType;
|
|
41982
42564
|
(function(StageTaskType2) {
|
|
41983
42565
|
StageTaskType2["EXTERNAL_AGENT"] = "external-agent";
|
|
@@ -42000,6 +42582,7 @@ var EscalationTriggerType;
|
|
|
42000
42582
|
(function(EscalationTriggerType2) {
|
|
42001
42583
|
EscalationTriggerType2["SLA_BREACHED"] = "sla-breached";
|
|
42002
42584
|
EscalationTriggerType2["AT_RISK"] = "at-risk";
|
|
42585
|
+
EscalationTriggerType2["NONE"] = "None";
|
|
42003
42586
|
})(EscalationTriggerType || (EscalationTriggerType = {}));
|
|
42004
42587
|
var SLADurationUnit;
|
|
42005
42588
|
(function(SLADurationUnit2) {
|
|
@@ -42056,6 +42639,16 @@ function createCaseInstanceMethods(instanceData, service) {
|
|
|
42056
42639
|
if (!instanceData.instanceId)
|
|
42057
42640
|
throw new Error("Case instance ID is undefined");
|
|
42058
42641
|
return service.getActionTasks(instanceData.instanceId, options);
|
|
42642
|
+
},
|
|
42643
|
+
async getSlaSummary(options) {
|
|
42644
|
+
if (!instanceData.instanceId)
|
|
42645
|
+
throw new Error("Case instance ID is undefined");
|
|
42646
|
+
return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
|
|
42647
|
+
},
|
|
42648
|
+
async getStagesSlaSummary() {
|
|
42649
|
+
if (!instanceData.instanceId)
|
|
42650
|
+
throw new Error("Case instance ID is undefined");
|
|
42651
|
+
return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
|
|
42059
42652
|
}
|
|
42060
42653
|
};
|
|
42061
42654
|
}
|
|
@@ -42063,6 +42656,18 @@ function createCaseInstanceWithMethods(instanceData, service) {
|
|
|
42063
42656
|
const methods = createCaseInstanceMethods(instanceData, service);
|
|
42064
42657
|
return Object.assign({}, instanceData, methods);
|
|
42065
42658
|
}
|
|
42659
|
+
var TimeInterval;
|
|
42660
|
+
(function(TimeInterval2) {
|
|
42661
|
+
TimeInterval2["Hour"] = "HOUR";
|
|
42662
|
+
TimeInterval2["Day"] = "DAY";
|
|
42663
|
+
TimeInterval2["Week"] = "WEEK";
|
|
42664
|
+
})(TimeInterval || (TimeInterval = {}));
|
|
42665
|
+
var InstanceFinalStatus;
|
|
42666
|
+
(function(InstanceFinalStatus2) {
|
|
42667
|
+
InstanceFinalStatus2["Completed"] = "Completed";
|
|
42668
|
+
InstanceFinalStatus2["Faulted"] = "Faulted";
|
|
42669
|
+
InstanceFinalStatus2["Cancelled"] = "Cancelled";
|
|
42670
|
+
})(InstanceFinalStatus || (InstanceFinalStatus = {}));
|
|
42066
42671
|
var ProcessInstanceMap = {
|
|
42067
42672
|
startedTimeUtc: "startedTime",
|
|
42068
42673
|
completedTimeUtc: "completedTime",
|
|
@@ -42278,6 +42883,35 @@ class MaestroProcessesService extends BaseService {
|
|
|
42278
42883
|
});
|
|
42279
42884
|
return BpmnHelpers.enrichIncidentsWithBpmnData(rawResponse.data || [], folderKey, this.processInstancesService);
|
|
42280
42885
|
}
|
|
42886
|
+
async getTopRunCount(startTime, endTime, options) {
|
|
42887
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, false, options));
|
|
42888
|
+
return (data ?? []).map((process10) => ({ ...process10, name: process10.packageId }));
|
|
42889
|
+
}
|
|
42890
|
+
async getTopElementFailedCount(startTime, endTime, options) {
|
|
42891
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
|
|
42892
|
+
return (data ?? []).map((item) => ({
|
|
42893
|
+
elementName: item.elementName,
|
|
42894
|
+
elementType: item.elementType,
|
|
42895
|
+
processKey: item.processKey,
|
|
42896
|
+
failedCount: item.count
|
|
42897
|
+
}));
|
|
42898
|
+
}
|
|
42899
|
+
async getInstanceStatusTimeline(startTime, endTime, options) {
|
|
42900
|
+
return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, false, options);
|
|
42901
|
+
}
|
|
42902
|
+
async getTopFaultedCount(startTime, endTime, options) {
|
|
42903
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, false, options));
|
|
42904
|
+
return (data ?? []).map((item) => ({
|
|
42905
|
+
packageId: item.packageId,
|
|
42906
|
+
processKey: item.processKey,
|
|
42907
|
+
faultedCount: item.runCount,
|
|
42908
|
+
name: item.packageId
|
|
42909
|
+
}));
|
|
42910
|
+
}
|
|
42911
|
+
async getTopExecutionDuration(startTime, endTime, options) {
|
|
42912
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
|
|
42913
|
+
return (data ?? []).map((process10) => ({ ...process10, name: process10.packageId }));
|
|
42914
|
+
}
|
|
42281
42915
|
}
|
|
42282
42916
|
__decorate([
|
|
42283
42917
|
track("MaestroProcesses.GetAll")
|
|
@@ -42285,6 +42919,21 @@ __decorate([
|
|
|
42285
42919
|
__decorate([
|
|
42286
42920
|
track("MaestroProcesses.GetIncidents")
|
|
42287
42921
|
], MaestroProcessesService.prototype, "getIncidents", null);
|
|
42922
|
+
__decorate([
|
|
42923
|
+
track("MaestroProcesses.GetTopRunCount")
|
|
42924
|
+
], MaestroProcessesService.prototype, "getTopRunCount", null);
|
|
42925
|
+
__decorate([
|
|
42926
|
+
track("MaestroProcesses.GetTopElementFailedCount")
|
|
42927
|
+
], MaestroProcessesService.prototype, "getTopElementFailedCount", null);
|
|
42928
|
+
__decorate([
|
|
42929
|
+
track("MaestroProcesses.GetInstanceStatusTimeline")
|
|
42930
|
+
], MaestroProcessesService.prototype, "getInstanceStatusTimeline", null);
|
|
42931
|
+
__decorate([
|
|
42932
|
+
track("MaestroProcesses.GetTopFaultedCount")
|
|
42933
|
+
], MaestroProcessesService.prototype, "getTopFaultedCount", null);
|
|
42934
|
+
__decorate([
|
|
42935
|
+
track("MaestroProcesses.GetTopExecutionDuration")
|
|
42936
|
+
], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
|
|
42288
42937
|
|
|
42289
42938
|
class ProcessIncidentsService extends BaseService {
|
|
42290
42939
|
async getAll() {
|
|
@@ -42313,6 +42962,35 @@ class CasesService extends BaseService {
|
|
|
42313
42962
|
name: this.extractCaseName(caseItem.packageId)
|
|
42314
42963
|
}));
|
|
42315
42964
|
}
|
|
42965
|
+
async getTopRunCount(startTime, endTime, options) {
|
|
42966
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
|
|
42967
|
+
return (data ?? []).map((process10) => ({ ...process10, name: this.extractCaseName(process10.packageId) }));
|
|
42968
|
+
}
|
|
42969
|
+
async getTopElementFailedCount(startTime, endTime, options) {
|
|
42970
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
|
|
42971
|
+
return (data ?? []).map((item) => ({
|
|
42972
|
+
elementName: item.elementName,
|
|
42973
|
+
elementType: item.elementType,
|
|
42974
|
+
processKey: item.processKey,
|
|
42975
|
+
failedCount: item.count
|
|
42976
|
+
}));
|
|
42977
|
+
}
|
|
42978
|
+
async getInstanceStatusTimeline(startTime, endTime, options) {
|
|
42979
|
+
return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
|
|
42980
|
+
}
|
|
42981
|
+
async getTopFaultedCount(startTime, endTime, options) {
|
|
42982
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
|
|
42983
|
+
return (data ?? []).map((item) => ({
|
|
42984
|
+
packageId: item.packageId,
|
|
42985
|
+
processKey: item.processKey,
|
|
42986
|
+
faultedCount: item.runCount,
|
|
42987
|
+
name: this.extractCaseName(item.packageId)
|
|
42988
|
+
}));
|
|
42989
|
+
}
|
|
42990
|
+
async getTopExecutionDuration(startTime, endTime, options) {
|
|
42991
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
|
|
42992
|
+
return (data ?? []).map((process10) => ({ ...process10, name: this.extractCaseName(process10.packageId) }));
|
|
42993
|
+
}
|
|
42316
42994
|
extractCaseName(packageId) {
|
|
42317
42995
|
const caseManagementIndex = packageId.indexOf("CaseManagement.");
|
|
42318
42996
|
if (caseManagementIndex !== -1) {
|
|
@@ -42325,6 +43003,21 @@ class CasesService extends BaseService {
|
|
|
42325
43003
|
__decorate([
|
|
42326
43004
|
track("Cases.GetAll")
|
|
42327
43005
|
], CasesService.prototype, "getAll", null);
|
|
43006
|
+
__decorate([
|
|
43007
|
+
track("Cases.GetTopRunCount")
|
|
43008
|
+
], CasesService.prototype, "getTopRunCount", null);
|
|
43009
|
+
__decorate([
|
|
43010
|
+
track("Cases.GetTopElementFailedCount")
|
|
43011
|
+
], CasesService.prototype, "getTopElementFailedCount", null);
|
|
43012
|
+
__decorate([
|
|
43013
|
+
track("Cases.GetInstanceStatusTimeline")
|
|
43014
|
+
], CasesService.prototype, "getInstanceStatusTimeline", null);
|
|
43015
|
+
__decorate([
|
|
43016
|
+
track("Cases.GetTopFaultedCount")
|
|
43017
|
+
], CasesService.prototype, "getTopFaultedCount", null);
|
|
43018
|
+
__decorate([
|
|
43019
|
+
track("Cases.GetTopExecutionDuration")
|
|
43020
|
+
], CasesService.prototype, "getTopExecutionDuration", null);
|
|
42328
43021
|
var CaseInstanceMap = {
|
|
42329
43022
|
startedTimeUtc: "startedTime",
|
|
42330
43023
|
completedTimeUtc: "completedTime",
|
|
@@ -42826,6 +43519,41 @@ class CaseInstancesService extends BaseService {
|
|
|
42826
43519
|
};
|
|
42827
43520
|
return await this.taskService.getAll(enhancedOptions);
|
|
42828
43521
|
}
|
|
43522
|
+
async getSlaSummary(options) {
|
|
43523
|
+
const apiOptions = options ? {
|
|
43524
|
+
...options,
|
|
43525
|
+
startTimeUtc: options.startTimeUtc?.toISOString(),
|
|
43526
|
+
endTimeUtc: options.endTimeUtc?.toISOString()
|
|
43527
|
+
} : undefined;
|
|
43528
|
+
return PaginationHelpers.getAll({
|
|
43529
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
43530
|
+
getEndpoint: () => MAESTRO_ENDPOINTS.INSIGHTS.SLA_SUMMARY,
|
|
43531
|
+
method: HTTP_METHODS.POST,
|
|
43532
|
+
excludeFromPrefix: ["caseInstanceId", "startTimeUtc", "endTimeUtc"],
|
|
43533
|
+
transformFn: (item) => ({
|
|
43534
|
+
...item,
|
|
43535
|
+
slaDueTime: toISOUtc(item.slaDueTime),
|
|
43536
|
+
lastModifiedTime: toISOUtc(item.lastModifiedTime)
|
|
43537
|
+
}),
|
|
43538
|
+
pagination: {
|
|
43539
|
+
paginationType: PaginationType.OFFSET,
|
|
43540
|
+
itemsField: SLA_SUMMARY_PAGINATION.ITEMS_FIELD,
|
|
43541
|
+
totalCountField: SLA_SUMMARY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
43542
|
+
paginationParams: {
|
|
43543
|
+
pageSizeParam: SLA_SUMMARY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
43544
|
+
offsetParam: SLA_SUMMARY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
43545
|
+
countParam: SLA_SUMMARY_OFFSET_PARAMS.COUNT_PARAM,
|
|
43546
|
+
convertToSkip: false
|
|
43547
|
+
}
|
|
43548
|
+
}
|
|
43549
|
+
}, apiOptions);
|
|
43550
|
+
}
|
|
43551
|
+
async getStagesSlaSummary(options) {
|
|
43552
|
+
const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
|
|
43553
|
+
caseInstanceId: options?.caseInstanceId
|
|
43554
|
+
});
|
|
43555
|
+
return response.data ?? [];
|
|
43556
|
+
}
|
|
42829
43557
|
}
|
|
42830
43558
|
__decorate([
|
|
42831
43559
|
track("CaseInstances.GetAll")
|
|
@@ -42854,6 +43582,12 @@ __decorate([
|
|
|
42854
43582
|
__decorate([
|
|
42855
43583
|
track("CaseInstances.GetActionTasks")
|
|
42856
43584
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
43585
|
+
__decorate([
|
|
43586
|
+
track("CaseInstances.GetSlaSummary")
|
|
43587
|
+
], CaseInstancesService.prototype, "getSlaSummary", null);
|
|
43588
|
+
__decorate([
|
|
43589
|
+
track("CaseInstances.GetStagesSlaSummary")
|
|
43590
|
+
], CaseInstancesService.prototype, "getStagesSlaSummary", null);
|
|
42857
43591
|
function validateName(resourceType, name) {
|
|
42858
43592
|
if (!name) {
|
|
42859
43593
|
throw new ValidationError({
|
|
@@ -43050,6 +43784,9 @@ class BucketService extends FolderScopedService {
|
|
|
43050
43784
|
});
|
|
43051
43785
|
return pascalToCamelCaseKeys(response.data);
|
|
43052
43786
|
}
|
|
43787
|
+
async getByName(name, options = {}) {
|
|
43788
|
+
return this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
|
|
43789
|
+
}
|
|
43053
43790
|
async getAll(options) {
|
|
43054
43791
|
const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
|
|
43055
43792
|
return PaginationHelpers.getAll({
|
|
@@ -43167,6 +43904,56 @@ class BucketService extends FolderScopedService {
|
|
|
43167
43904
|
}
|
|
43168
43905
|
return transformedData;
|
|
43169
43906
|
}
|
|
43907
|
+
async getFiles(bucketId, options) {
|
|
43908
|
+
if (!bucketId) {
|
|
43909
|
+
throw new ValidationError({ message: "bucketId is required for getFiles" });
|
|
43910
|
+
}
|
|
43911
|
+
const { folderId, folderKey, folderPath, ...restOptions } = options ?? {};
|
|
43912
|
+
const headers = resolveFolderHeaders({
|
|
43913
|
+
folderId,
|
|
43914
|
+
folderKey,
|
|
43915
|
+
folderPath,
|
|
43916
|
+
resourceType: "Buckets.getFiles",
|
|
43917
|
+
fallbackFolderKey: this.config.folderKey
|
|
43918
|
+
});
|
|
43919
|
+
const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
|
|
43920
|
+
return PaginationHelpers.getAll({
|
|
43921
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
43922
|
+
getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
|
|
43923
|
+
transformFn: transformBucketFile,
|
|
43924
|
+
pagination: {
|
|
43925
|
+
paginationType: PaginationType.OFFSET,
|
|
43926
|
+
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
43927
|
+
totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
|
|
43928
|
+
paginationParams: {
|
|
43929
|
+
pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
43930
|
+
offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
|
|
43931
|
+
countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
|
|
43932
|
+
}
|
|
43933
|
+
},
|
|
43934
|
+
excludeFromPrefix: ["directory", "recursive", "fileNameRegex"],
|
|
43935
|
+
headers
|
|
43936
|
+
}, { ...restOptions, directory: "/", recursive: true });
|
|
43937
|
+
}
|
|
43938
|
+
async deleteFile(bucketId, path3, options) {
|
|
43939
|
+
if (!bucketId) {
|
|
43940
|
+
throw new ValidationError({ message: "bucketId is required for deleteFile" });
|
|
43941
|
+
}
|
|
43942
|
+
if (!path3) {
|
|
43943
|
+
throw new ValidationError({ message: "path is required for deleteFile" });
|
|
43944
|
+
}
|
|
43945
|
+
const headers = resolveFolderHeaders({
|
|
43946
|
+
folderId: options?.folderId,
|
|
43947
|
+
folderKey: options?.folderKey,
|
|
43948
|
+
folderPath: options?.folderPath,
|
|
43949
|
+
resourceType: "Buckets.deleteFile",
|
|
43950
|
+
fallbackFolderKey: this.config.folderKey
|
|
43951
|
+
});
|
|
43952
|
+
await this.delete(BUCKET_ENDPOINTS.DELETE_FILE(bucketId), {
|
|
43953
|
+
params: { path: path3 },
|
|
43954
|
+
headers
|
|
43955
|
+
});
|
|
43956
|
+
}
|
|
43170
43957
|
async _getWriteUri(options) {
|
|
43171
43958
|
const { bucketId, folderId, path: path3, expiryInMinutes, ...restOptions } = options;
|
|
43172
43959
|
const queryOptions = {
|
|
@@ -43179,6 +43966,9 @@ class BucketService extends FolderScopedService {
|
|
|
43179
43966
|
__decorate([
|
|
43180
43967
|
track("Buckets.GetById")
|
|
43181
43968
|
], BucketService.prototype, "getById", null);
|
|
43969
|
+
__decorate([
|
|
43970
|
+
track("Buckets.GetByName")
|
|
43971
|
+
], BucketService.prototype, "getByName", null);
|
|
43182
43972
|
__decorate([
|
|
43183
43973
|
track("Buckets.GetAll")
|
|
43184
43974
|
], BucketService.prototype, "getAll", null);
|
|
@@ -43191,6 +43981,12 @@ __decorate([
|
|
|
43191
43981
|
__decorate([
|
|
43192
43982
|
track("Buckets.GetReadUri")
|
|
43193
43983
|
], BucketService.prototype, "getReadUri", null);
|
|
43984
|
+
__decorate([
|
|
43985
|
+
track("Buckets.GetFiles")
|
|
43986
|
+
], BucketService.prototype, "getFiles", null);
|
|
43987
|
+
__decorate([
|
|
43988
|
+
track("Buckets.DeleteFile")
|
|
43989
|
+
], BucketService.prototype, "deleteFile", null);
|
|
43194
43990
|
var BucketOptions;
|
|
43195
43991
|
(function(BucketOptions2) {
|
|
43196
43992
|
BucketOptions2["None"] = "None";
|
|
@@ -43650,14 +44446,34 @@ class ProcessService extends FolderScopedService {
|
|
|
43650
44446
|
}
|
|
43651
44447
|
}, options);
|
|
43652
44448
|
}
|
|
43653
|
-
async start(request,
|
|
43654
|
-
|
|
44449
|
+
async start(request, optionsOrFolderId, legacyOptions) {
|
|
44450
|
+
let folderId;
|
|
44451
|
+
let folderKey;
|
|
44452
|
+
let folderPath;
|
|
44453
|
+
let queryOptions;
|
|
44454
|
+
if (typeof optionsOrFolderId === "number") {
|
|
44455
|
+
folderId = optionsOrFolderId;
|
|
44456
|
+
queryOptions = legacyOptions ?? {};
|
|
44457
|
+
} else {
|
|
44458
|
+
const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
|
|
44459
|
+
folderId = fid;
|
|
44460
|
+
folderKey = fkey;
|
|
44461
|
+
folderPath = fpath;
|
|
44462
|
+
queryOptions = rest;
|
|
44463
|
+
}
|
|
44464
|
+
const headers = resolveFolderHeaders({
|
|
44465
|
+
folderId,
|
|
44466
|
+
folderKey,
|
|
44467
|
+
folderPath,
|
|
44468
|
+
resourceType: "processes.start",
|
|
44469
|
+
fallbackFolderKey: this.config.folderKey
|
|
44470
|
+
});
|
|
43655
44471
|
const apiRequest = transformRequest(request, ProcessMap);
|
|
43656
44472
|
const requestBody = {
|
|
43657
44473
|
startInfo: apiRequest
|
|
43658
44474
|
};
|
|
43659
|
-
const keysToPrefix = Object.keys(
|
|
43660
|
-
const apiOptions = addPrefixToKeys(
|
|
44475
|
+
const keysToPrefix = Object.keys(queryOptions);
|
|
44476
|
+
const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
|
|
43661
44477
|
const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
|
|
43662
44478
|
params: apiOptions,
|
|
43663
44479
|
headers
|
|
@@ -43947,8 +44763,8 @@ var WordGroupType;
|
|
|
43947
44763
|
})(WordGroupType || (WordGroupType = {}));
|
|
43948
44764
|
var ModelKind;
|
|
43949
44765
|
(function(ModelKind2) {
|
|
43950
|
-
ModelKind2["Classifier"] = "Classifier";
|
|
43951
44766
|
ModelKind2["Extractor"] = "Extractor";
|
|
44767
|
+
ModelKind2["Classifier"] = "Classifier";
|
|
43952
44768
|
})(ModelKind || (ModelKind = {}));
|
|
43953
44769
|
var ModelType;
|
|
43954
44770
|
(function(ModelType2) {
|
|
@@ -43956,6 +44772,12 @@ var ModelType;
|
|
|
43956
44772
|
ModelType2["Modern"] = "Modern";
|
|
43957
44773
|
ModelType2["Predefined"] = "Predefined";
|
|
43958
44774
|
})(ModelType || (ModelType = {}));
|
|
44775
|
+
var ErrorSeverity;
|
|
44776
|
+
(function(ErrorSeverity2) {
|
|
44777
|
+
ErrorSeverity2["Info"] = "Info";
|
|
44778
|
+
ErrorSeverity2["Warning"] = "Warning";
|
|
44779
|
+
ErrorSeverity2["Error"] = "Error";
|
|
44780
|
+
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
43959
44781
|
var ClassifierDocumentTypeType;
|
|
43960
44782
|
(function(ClassifierDocumentTypeType2) {
|
|
43961
44783
|
ClassifierDocumentTypeType2["FormsAi"] = "FormsAi";
|
|
@@ -43979,6 +44801,13 @@ var GptFieldType;
|
|
|
43979
44801
|
GptFieldType2["Number"] = "Number";
|
|
43980
44802
|
GptFieldType2["Text"] = "Text";
|
|
43981
44803
|
})(GptFieldType || (GptFieldType = {}));
|
|
44804
|
+
var JobStatus;
|
|
44805
|
+
(function(JobStatus2) {
|
|
44806
|
+
JobStatus2["Succeeded"] = "Succeeded";
|
|
44807
|
+
JobStatus2["Failed"] = "Failed";
|
|
44808
|
+
JobStatus2["Running"] = "Running";
|
|
44809
|
+
JobStatus2["NotStarted"] = "NotStarted";
|
|
44810
|
+
})(JobStatus || (JobStatus = {}));
|
|
43982
44811
|
var ValidationDisplayMode;
|
|
43983
44812
|
(function(ValidationDisplayMode2) {
|
|
43984
44813
|
ValidationDisplayMode2["Classic"] = "Classic";
|
|
@@ -44062,25 +44891,43 @@ var createDataFabricClient = async (tenantOverride) => {
|
|
|
44062
44891
|
tenantName: tenantOverride ?? status.tenantName
|
|
44063
44892
|
});
|
|
44064
44893
|
};
|
|
44894
|
+
var connectOrFail = async (tenantOverride) => {
|
|
44895
|
+
const [clientError, sdk] = await catchError(createDataFabricClient(tenantOverride));
|
|
44896
|
+
if (clientError) {
|
|
44897
|
+
fail("Error connecting to Data Fabric", await extractErrorMessage(clientError));
|
|
44898
|
+
return;
|
|
44899
|
+
}
|
|
44900
|
+
return sdk;
|
|
44901
|
+
};
|
|
44065
44902
|
|
|
44066
44903
|
// src/commands/choice-sets.ts
|
|
44904
|
+
var OUTPUT_CODES = {
|
|
44905
|
+
ChoiceSetList: "ChoiceSetList",
|
|
44906
|
+
ChoiceSetValues: "ChoiceSetValues",
|
|
44907
|
+
ChoiceSetCreated: "ChoiceSetCreated",
|
|
44908
|
+
ChoiceSetUpdated: "ChoiceSetUpdated",
|
|
44909
|
+
ChoiceSetDeleted: "ChoiceSetDeleted",
|
|
44910
|
+
ChoiceSetValueCreated: "ChoiceSetValueCreated",
|
|
44911
|
+
ChoiceSetValueUpdated: "ChoiceSetValueUpdated",
|
|
44912
|
+
ChoiceSetValuesDeleted: "ChoiceSetValuesDeleted"
|
|
44913
|
+
};
|
|
44067
44914
|
var CHOICE_SETS_LIST_EXAMPLES = [
|
|
44068
44915
|
{
|
|
44069
|
-
Description: "List all Data Fabric choice sets. The returned '
|
|
44916
|
+
Description: "List all Data Fabric choice sets. The returned 'id' is the value to pass as 'choiceSetId' on a CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE entity field, or to 'df choice-sets list-values <id>'.",
|
|
44070
44917
|
Command: "uip df choice-sets list",
|
|
44071
44918
|
Output: {
|
|
44072
|
-
Code:
|
|
44919
|
+
Code: OUTPUT_CODES.ChoiceSetList,
|
|
44073
44920
|
Data: [
|
|
44074
44921
|
{
|
|
44075
|
-
|
|
44076
|
-
|
|
44077
|
-
|
|
44078
|
-
|
|
44079
|
-
|
|
44080
|
-
|
|
44081
|
-
|
|
44082
|
-
|
|
44083
|
-
|
|
44922
|
+
id: "c1d2e3f4-0000-0000-0000-000000000001",
|
|
44923
|
+
name: "ExpenseTypes",
|
|
44924
|
+
displayName: "Expense Types",
|
|
44925
|
+
description: "Categories of expenses",
|
|
44926
|
+
folderId: "f1000000-0000-0000-0000-000000000001",
|
|
44927
|
+
createdBy: "u1000000-0000-0000-0000-000000000001",
|
|
44928
|
+
updatedBy: "u1000000-0000-0000-0000-000000000001",
|
|
44929
|
+
createdTime: "2026-01-01T00:00:00Z",
|
|
44930
|
+
updatedTime: "2026-01-02T00:00:00Z"
|
|
44084
44931
|
}
|
|
44085
44932
|
]
|
|
44086
44933
|
}
|
|
@@ -44088,152 +44935,288 @@ var CHOICE_SETS_LIST_EXAMPLES = [
|
|
|
44088
44935
|
];
|
|
44089
44936
|
var CHOICE_SETS_GET_EXAMPLES = [
|
|
44090
44937
|
{
|
|
44091
|
-
Description: "
|
|
44092
|
-
Command: "uip df choice-sets
|
|
44938
|
+
Description: "List the values of a choice set. The 'numberId' on each value is the integer to pass when inserting or updating a record into a CHOICE_SET_SINGLE field (or in an array for CHOICE_SET_MULTIPLE).",
|
|
44939
|
+
Command: "uip df choice-sets list-values c1d2e3f4-0000-0000-0000-000000000001 --limit 2",
|
|
44093
44940
|
Output: {
|
|
44094
|
-
Code:
|
|
44941
|
+
Code: OUTPUT_CODES.ChoiceSetValues,
|
|
44095
44942
|
Data: {
|
|
44096
|
-
|
|
44097
|
-
Values: [
|
|
44943
|
+
items: [
|
|
44098
44944
|
{
|
|
44099
|
-
|
|
44100
|
-
|
|
44101
|
-
|
|
44102
|
-
|
|
44945
|
+
id: "v1000000-0000-0000-0000-000000000001",
|
|
44946
|
+
name: "travel",
|
|
44947
|
+
displayName: "Travel",
|
|
44948
|
+
numberId: 0
|
|
44103
44949
|
},
|
|
44104
44950
|
{
|
|
44105
|
-
|
|
44106
|
-
|
|
44107
|
-
|
|
44108
|
-
|
|
44951
|
+
id: "v1000000-0000-0000-0000-000000000002",
|
|
44952
|
+
name: "meals",
|
|
44953
|
+
displayName: "Meals",
|
|
44954
|
+
numberId: 1
|
|
44109
44955
|
}
|
|
44110
44956
|
],
|
|
44111
|
-
|
|
44957
|
+
totalCount: 2,
|
|
44958
|
+
hasNextPage: false
|
|
44959
|
+
}
|
|
44960
|
+
}
|
|
44961
|
+
}
|
|
44962
|
+
];
|
|
44963
|
+
var CHOICE_SETS_CREATE_EXAMPLES = [
|
|
44964
|
+
{
|
|
44965
|
+
Description: "Create a choice set. The returned 'ID' is used as 'choiceSetId' on CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE entity fields. Add values with 'df choice-set-values create'.",
|
|
44966
|
+
Command: 'uip df choice-sets create ExpenseTypes --display-name "Expense Types" --description "Categories of expenses"',
|
|
44967
|
+
Output: {
|
|
44968
|
+
Code: OUTPUT_CODES.ChoiceSetCreated,
|
|
44969
|
+
Data: { ID: "c1d2e3f4-0000-0000-0000-000000000001" }
|
|
44970
|
+
}
|
|
44971
|
+
}
|
|
44972
|
+
];
|
|
44973
|
+
var CHOICE_SETS_UPDATE_EXAMPLES = [
|
|
44974
|
+
{
|
|
44975
|
+
Description: "Update a choice set's display name and/or description. At least one of --display-name or --description is required.",
|
|
44976
|
+
Command: 'uip df choice-sets update c1d2e3f4-0000-0000-0000-000000000001 --display-name "Expense Categories"',
|
|
44977
|
+
Output: {
|
|
44978
|
+
Code: OUTPUT_CODES.ChoiceSetUpdated,
|
|
44979
|
+
Data: { ID: "c1d2e3f4-0000-0000-0000-000000000001" }
|
|
44980
|
+
}
|
|
44981
|
+
}
|
|
44982
|
+
];
|
|
44983
|
+
var CHOICE_SETS_DELETE_EXAMPLES = [
|
|
44984
|
+
{
|
|
44985
|
+
Description: "Delete a choice set (irreversible — requires --confirm and --reason).",
|
|
44986
|
+
Command: 'uip df choice-sets delete c1d2e3f4-0000-0000-0000-000000000001 --confirm --reason "no longer used"',
|
|
44987
|
+
Output: {
|
|
44988
|
+
Code: OUTPUT_CODES.ChoiceSetDeleted,
|
|
44989
|
+
Data: {
|
|
44990
|
+
ID: "c1d2e3f4-0000-0000-0000-000000000001",
|
|
44991
|
+
Reason: "no longer used"
|
|
44112
44992
|
}
|
|
44113
44993
|
}
|
|
44114
44994
|
}
|
|
44115
44995
|
];
|
|
44116
44996
|
var registerChoiceSetsCommand = (program2) => {
|
|
44117
|
-
const choiceSets = program2.command("choice-sets").description("
|
|
44118
|
-
choiceSets.command("list").description("List all Data Fabric choice sets").
|
|
44119
|
-
const
|
|
44120
|
-
if (
|
|
44121
|
-
OutputFormatter.error({
|
|
44122
|
-
Result: RESULTS.Failure,
|
|
44123
|
-
Message: "Error connecting to Data Fabric",
|
|
44124
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44125
|
-
});
|
|
44126
|
-
processContext.exit(1);
|
|
44997
|
+
const choiceSets = program2.command("choice-sets").description("Manage Data Fabric choice sets — the enumerated value lists referenced by CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE entity fields. " + "Use 'list'/'list-values' to inspect, and 'create'/'update'/'delete' to manage them. Manage individual values with 'df choice-set-values'.");
|
|
44998
|
+
choiceSets.command("list").description("List all Data Fabric choice sets").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CHOICE_SETS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
44999
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45000
|
+
if (!sdk)
|
|
44127
45001
|
return;
|
|
44128
|
-
}
|
|
44129
45002
|
const [listError, result] = await catchError(sdk.entities.choicesets.getAll());
|
|
44130
45003
|
if (listError) {
|
|
44131
|
-
|
|
44132
|
-
Result: RESULTS.Failure,
|
|
44133
|
-
Message: "Error listing choice sets",
|
|
44134
|
-
Instructions: await extractErrorMessage(listError)
|
|
44135
|
-
});
|
|
44136
|
-
processContext.exit(1);
|
|
44137
|
-
return;
|
|
45004
|
+
return fail("Error listing choice sets", await extractErrorMessage(listError));
|
|
44138
45005
|
}
|
|
44139
|
-
const items = (result ?? []).map((cs) => ({
|
|
44140
|
-
ID: cs.id,
|
|
44141
|
-
Name: cs.name,
|
|
44142
|
-
DisplayName: cs.displayName || cs.name,
|
|
44143
|
-
Description: cs.description || "",
|
|
44144
|
-
FolderId: cs.folderId,
|
|
44145
|
-
CreatedBy: cs.createdBy,
|
|
44146
|
-
UpdatedBy: cs.updatedBy,
|
|
44147
|
-
CreatedTime: cs.createdTime,
|
|
44148
|
-
UpdatedTime: cs.updatedTime
|
|
44149
|
-
}));
|
|
44150
45006
|
OutputFormatter.success({
|
|
44151
45007
|
Result: RESULTS.Success,
|
|
44152
|
-
Code:
|
|
44153
|
-
Data:
|
|
45008
|
+
Code: OUTPUT_CODES.ChoiceSetList,
|
|
45009
|
+
Data: result ?? []
|
|
44154
45010
|
});
|
|
44155
45011
|
});
|
|
44156
|
-
choiceSets.command("
|
|
45012
|
+
choiceSets.command("list-values").description("List the values of a Data Fabric choice set").argument("<choice-set-id>", "Choice set ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-l, --limit <number>", "Number of values to return per page", "50").option("-o, --offset <number>", "Start from the page containing this record index (rounded down to the nearest page boundary; mutually exclusive with --cursor)").option("--cursor <cursor>", "Pagination cursor from a previous response to fetch the next page").examples(CHOICE_SETS_GET_EXAMPLES).trackedAction(processContext, async (choiceSetId, options) => {
|
|
44157
45013
|
const pageSize = Number(options.limit ?? "50");
|
|
44158
45014
|
if (Number.isNaN(pageSize) || pageSize < 1) {
|
|
44159
|
-
|
|
44160
|
-
Result: RESULTS.Failure,
|
|
44161
|
-
Message: "Invalid --limit value",
|
|
44162
|
-
Instructions: "Provide a positive integer for --limit."
|
|
44163
|
-
});
|
|
44164
|
-
processContext.exit(1);
|
|
44165
|
-
return;
|
|
45015
|
+
return fail("Invalid --limit value", "Provide a positive integer for --limit.");
|
|
44166
45016
|
}
|
|
44167
45017
|
if (options.cursor !== undefined && options.offset !== undefined) {
|
|
44168
|
-
|
|
44169
|
-
Result: RESULTS.Failure,
|
|
44170
|
-
Message: "--offset and --cursor are mutually exclusive",
|
|
44171
|
-
Instructions: "Use --offset to jump to a position by record count, or --cursor to continue from a previous response."
|
|
44172
|
-
});
|
|
44173
|
-
processContext.exit(1);
|
|
44174
|
-
return;
|
|
45018
|
+
return fail("--offset and --cursor are mutually exclusive", "Use --offset to jump to a position by record count, or --cursor to continue from a previous response.");
|
|
44175
45019
|
}
|
|
44176
45020
|
let jumpToPage;
|
|
44177
45021
|
if (options.offset !== undefined) {
|
|
44178
45022
|
const offsetValue = Number(options.offset);
|
|
44179
45023
|
if (Number.isNaN(offsetValue) || offsetValue < 0) {
|
|
44180
|
-
|
|
44181
|
-
Result: RESULTS.Failure,
|
|
44182
|
-
Message: "Invalid --offset value",
|
|
44183
|
-
Instructions: "Provide a non-negative integer for --offset."
|
|
44184
|
-
});
|
|
44185
|
-
processContext.exit(1);
|
|
44186
|
-
return;
|
|
45024
|
+
return fail("Invalid --offset value", "Provide a non-negative integer for --offset.");
|
|
44187
45025
|
}
|
|
44188
45026
|
jumpToPage = Math.floor(offsetValue / pageSize) + 1;
|
|
44189
45027
|
}
|
|
44190
|
-
const
|
|
44191
|
-
if (
|
|
44192
|
-
OutputFormatter.error({
|
|
44193
|
-
Result: RESULTS.Failure,
|
|
44194
|
-
Message: "Error connecting to Data Fabric",
|
|
44195
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44196
|
-
});
|
|
44197
|
-
processContext.exit(1);
|
|
45028
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45029
|
+
if (!sdk)
|
|
44198
45030
|
return;
|
|
44199
|
-
}
|
|
44200
45031
|
const paginationOptions = options.cursor !== undefined ? { pageSize, cursor: { value: options.cursor } } : jumpToPage !== undefined ? { pageSize, jumpToPage } : { pageSize };
|
|
44201
45032
|
const [getError, result] = await catchError(sdk.entities.choicesets.getById(choiceSetId, paginationOptions));
|
|
44202
45033
|
if (getError) {
|
|
44203
|
-
|
|
44204
|
-
|
|
44205
|
-
|
|
44206
|
-
|
|
44207
|
-
|
|
44208
|
-
|
|
45034
|
+
return fail(`Error getting choice set '${choiceSetId}'`, await extractErrorMessage(getError));
|
|
45035
|
+
}
|
|
45036
|
+
OutputFormatter.success({
|
|
45037
|
+
Result: RESULTS.Success,
|
|
45038
|
+
Code: OUTPUT_CODES.ChoiceSetValues,
|
|
45039
|
+
Data: result
|
|
45040
|
+
});
|
|
45041
|
+
});
|
|
45042
|
+
choiceSets.command("create").description("Create a new Data Fabric choice set").argument("<name>", "Choice set name (must start with a letter; letters, numbers, and underscores only)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--display-name <name>", "Human-readable display name").option("--description <text>", "Choice set description").option("--folder-key <uuid>", "UUID of the folder to place the choice set in (defaults to the tenant-level folder)").examples(CHOICE_SETS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
|
|
45043
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45044
|
+
if (!sdk)
|
|
45045
|
+
return;
|
|
45046
|
+
const createOpts = {
|
|
45047
|
+
...options.displayName !== undefined && {
|
|
45048
|
+
displayName: options.displayName
|
|
45049
|
+
},
|
|
45050
|
+
...options.description !== undefined && {
|
|
45051
|
+
description: options.description
|
|
45052
|
+
},
|
|
45053
|
+
...options.folderKey !== undefined && {
|
|
45054
|
+
folderKey: options.folderKey
|
|
45055
|
+
}
|
|
45056
|
+
};
|
|
45057
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45058
|
+
const [createError, choiceSetId] = await catchError(choiceSetService.create(name, Object.keys(createOpts).length > 0 ? createOpts : undefined));
|
|
45059
|
+
if (createError) {
|
|
45060
|
+
return fail("Error creating choice set", await extractErrorMessage(createError));
|
|
45061
|
+
}
|
|
45062
|
+
OutputFormatter.success({
|
|
45063
|
+
Result: RESULTS.Success,
|
|
45064
|
+
Code: OUTPUT_CODES.ChoiceSetCreated,
|
|
45065
|
+
Data: { ID: choiceSetId }
|
|
45066
|
+
});
|
|
45067
|
+
});
|
|
45068
|
+
choiceSets.command("update").description("Update the metadata of a Data Fabric choice set").argument("<choice-set-id>", "Choice set ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--display-name <name>", "New display name").option("--description <text>", "New description").examples(CHOICE_SETS_UPDATE_EXAMPLES).trackedAction(processContext, async (choiceSetId, options) => {
|
|
45069
|
+
if (options.displayName === undefined && options.description === undefined) {
|
|
45070
|
+
return fail("No update fields provided", "Provide at least one of --display-name or --description.");
|
|
45071
|
+
}
|
|
45072
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45073
|
+
if (!sdk)
|
|
44209
45074
|
return;
|
|
45075
|
+
const updateOpts = {
|
|
45076
|
+
...options.displayName !== undefined && {
|
|
45077
|
+
displayName: options.displayName
|
|
45078
|
+
},
|
|
45079
|
+
...options.description !== undefined && {
|
|
45080
|
+
description: options.description
|
|
45081
|
+
}
|
|
45082
|
+
};
|
|
45083
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45084
|
+
const [updateError] = await catchError(choiceSetService.updateById(choiceSetId, updateOpts));
|
|
45085
|
+
if (updateError) {
|
|
45086
|
+
return fail(`Error updating choice set '${choiceSetId}'`, await extractErrorMessage(updateError));
|
|
44210
45087
|
}
|
|
44211
|
-
const response = result;
|
|
44212
|
-
const values = (response.items ?? []).map((v) => ({
|
|
44213
|
-
Id: v.id,
|
|
44214
|
-
Name: v.name,
|
|
44215
|
-
DisplayName: v.displayName || v.name,
|
|
44216
|
-
NumberId: v.numberId,
|
|
44217
|
-
CreatedTime: v.createdTime,
|
|
44218
|
-
UpdatedTime: v.updatedTime
|
|
44219
|
-
}));
|
|
44220
|
-
const nextCursor = extractCursorValue(response.nextCursor);
|
|
44221
45088
|
OutputFormatter.success({
|
|
44222
45089
|
Result: RESULTS.Success,
|
|
44223
|
-
Code:
|
|
45090
|
+
Code: OUTPUT_CODES.ChoiceSetUpdated,
|
|
45091
|
+
Data: { ID: choiceSetId }
|
|
45092
|
+
});
|
|
45093
|
+
});
|
|
45094
|
+
choiceSets.command("delete").description("Delete a Data Fabric choice set (irreversible)").argument("<choice-set-id>", "Choice set ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--confirm", "Acknowledge this is an irreversible operation").option("--reason <reason>", "Reason for the deletion — echoed back in the response so the caller can log it").examples(CHOICE_SETS_DELETE_EXAMPLES).trackedAction(processContext, async (choiceSetId, options) => {
|
|
45095
|
+
const reason = requireDestructiveConfirmation(options, 'Pass --reason "<text>" to record why the choice set is being deleted.');
|
|
45096
|
+
if (reason === null)
|
|
45097
|
+
return;
|
|
45098
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45099
|
+
if (!sdk)
|
|
45100
|
+
return;
|
|
45101
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45102
|
+
const [deleteError] = await catchError(choiceSetService.deleteById(choiceSetId));
|
|
45103
|
+
if (deleteError) {
|
|
45104
|
+
return fail(`Error deleting choice set '${choiceSetId}'`, await extractErrorMessage(deleteError));
|
|
45105
|
+
}
|
|
45106
|
+
OutputFormatter.success({
|
|
45107
|
+
Result: RESULTS.Success,
|
|
45108
|
+
Code: OUTPUT_CODES.ChoiceSetDeleted,
|
|
45109
|
+
Data: { ID: choiceSetId, Reason: reason }
|
|
45110
|
+
});
|
|
45111
|
+
});
|
|
45112
|
+
};
|
|
45113
|
+
var CHOICE_SET_VALUES_CREATE_EXAMPLES = [
|
|
45114
|
+
{
|
|
45115
|
+
Description: "Add a value to a choice set. The returned 'numberId' is the integer to pass when inserting or updating records into a CHOICE_SET_SINGLE field (or in an array for CHOICE_SET_MULTIPLE).",
|
|
45116
|
+
Command: 'uip df choice-set-values create c1d2e3f4-0000-0000-0000-000000000001 travel --display-name "Travel"',
|
|
45117
|
+
Output: {
|
|
45118
|
+
Code: OUTPUT_CODES.ChoiceSetValueCreated,
|
|
44224
45119
|
Data: {
|
|
44225
|
-
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
44230
|
-
|
|
44231
|
-
|
|
44232
|
-
|
|
44233
|
-
|
|
44234
|
-
|
|
44235
|
-
|
|
44236
|
-
|
|
45120
|
+
id: "v1000000-0000-0000-0000-000000000001",
|
|
45121
|
+
name: "travel",
|
|
45122
|
+
displayName: "Travel",
|
|
45123
|
+
numberId: 0
|
|
45124
|
+
}
|
|
45125
|
+
}
|
|
45126
|
+
}
|
|
45127
|
+
];
|
|
45128
|
+
var CHOICE_SET_VALUES_UPDATE_EXAMPLES = [
|
|
45129
|
+
{
|
|
45130
|
+
Description: "Update the display name of an existing choice set value. Find value IDs with 'df choice-sets list-values <choice-set-id>'.",
|
|
45131
|
+
Command: 'uip df choice-set-values update c1d2e3f4-0000-0000-0000-000000000001 v1000000-0000-0000-0000-000000000001 "Business Travel"',
|
|
45132
|
+
Output: {
|
|
45133
|
+
Code: OUTPUT_CODES.ChoiceSetValueUpdated,
|
|
45134
|
+
Data: {
|
|
45135
|
+
id: "v1000000-0000-0000-0000-000000000001",
|
|
45136
|
+
name: "travel",
|
|
45137
|
+
displayName: "Business Travel",
|
|
45138
|
+
numberId: 0
|
|
45139
|
+
}
|
|
45140
|
+
}
|
|
45141
|
+
}
|
|
45142
|
+
];
|
|
45143
|
+
var CHOICE_SET_VALUES_DELETE_EXAMPLES = [
|
|
45144
|
+
{
|
|
45145
|
+
Description: "Delete one or more values from a choice set (irreversible — requires --confirm and --reason). Pass value IDs as a comma-separated list.",
|
|
45146
|
+
Command: 'uip df choice-set-values delete c1d2e3f4-0000-0000-0000-000000000001 --ids v1000000-0000-0000-0000-000000000001,v1000000-0000-0000-0000-000000000002 --confirm --reason "deprecated categories"',
|
|
45147
|
+
Output: {
|
|
45148
|
+
Code: OUTPUT_CODES.ChoiceSetValuesDeleted,
|
|
45149
|
+
Data: {
|
|
45150
|
+
ChoiceSetId: "c1d2e3f4-0000-0000-0000-000000000001",
|
|
45151
|
+
DeletedIds: [
|
|
45152
|
+
"v1000000-0000-0000-0000-000000000001",
|
|
45153
|
+
"v1000000-0000-0000-0000-000000000002"
|
|
45154
|
+
],
|
|
45155
|
+
Reason: "deprecated categories"
|
|
45156
|
+
}
|
|
45157
|
+
}
|
|
45158
|
+
}
|
|
45159
|
+
];
|
|
45160
|
+
var registerChoiceSetValuesCommand = (program2) => {
|
|
45161
|
+
const values = program2.command("choice-set-values").description("Manage the individual values of a Data Fabric choice set. " + "Use 'df choice-sets list-values <choice-set-id>' to list existing values and their IDs.");
|
|
45162
|
+
values.command("create").description("Add a value to a Data Fabric choice set").argument("<choice-set-id>", "Choice set ID").argument("<name>", "Value name (must start with a letter; letters, numbers, and underscores only)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--display-name <name>", "Human-readable display name").examples(CHOICE_SET_VALUES_CREATE_EXAMPLES).trackedAction(processContext, async (choiceSetId, name, options) => {
|
|
45163
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45164
|
+
if (!sdk)
|
|
45165
|
+
return;
|
|
45166
|
+
const insertOpts = {
|
|
45167
|
+
...options.displayName !== undefined && {
|
|
45168
|
+
displayName: options.displayName
|
|
45169
|
+
}
|
|
45170
|
+
};
|
|
45171
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45172
|
+
const [createError, result] = await catchError(choiceSetService.insertValueById(choiceSetId, name, Object.keys(insertOpts).length > 0 ? insertOpts : undefined));
|
|
45173
|
+
if (createError) {
|
|
45174
|
+
return fail(`Error creating value in choice set '${choiceSetId}'`, await extractErrorMessage(createError));
|
|
45175
|
+
}
|
|
45176
|
+
OutputFormatter.success({
|
|
45177
|
+
Result: RESULTS.Success,
|
|
45178
|
+
Code: OUTPUT_CODES.ChoiceSetValueCreated,
|
|
45179
|
+
Data: result
|
|
45180
|
+
});
|
|
45181
|
+
});
|
|
45182
|
+
values.command("update").description("Update the display name of a choice set value").argument("<choice-set-id>", "Choice set ID").argument("<value-id>", "Choice set value ID").argument("<display-name>", "New display name for the value").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CHOICE_SET_VALUES_UPDATE_EXAMPLES).trackedAction(processContext, async (choiceSetId, valueId, displayName, options) => {
|
|
45183
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45184
|
+
if (!sdk)
|
|
45185
|
+
return;
|
|
45186
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45187
|
+
const [updateError, result] = await catchError(choiceSetService.updateValueById(choiceSetId, valueId, displayName));
|
|
45188
|
+
if (updateError) {
|
|
45189
|
+
return fail(`Error updating value '${valueId}' in choice set '${choiceSetId}'`, await extractErrorMessage(updateError));
|
|
45190
|
+
}
|
|
45191
|
+
OutputFormatter.success({
|
|
45192
|
+
Result: RESULTS.Success,
|
|
45193
|
+
Code: OUTPUT_CODES.ChoiceSetValueUpdated,
|
|
45194
|
+
Data: result
|
|
45195
|
+
});
|
|
45196
|
+
});
|
|
45197
|
+
values.command("delete").description("Delete values from a Data Fabric choice set (irreversible)").argument("<choice-set-id>", "Choice set ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--ids <ids>", "Comma-separated list of value IDs to delete").option("--confirm", "Acknowledge this is an irreversible operation").option("--reason <reason>", "Reason for the deletion — echoed back in the response so the caller can log it").examples(CHOICE_SET_VALUES_DELETE_EXAMPLES).trackedAction(processContext, async (choiceSetId, options) => {
|
|
45198
|
+
const valueIds = (options.ids ?? "").split(",").map((id) => id.trim()).filter((id) => id.length > 0);
|
|
45199
|
+
if (valueIds.length === 0) {
|
|
45200
|
+
return fail("No value IDs provided", "Pass --ids <id,id,...> with at least one value ID to delete.");
|
|
45201
|
+
}
|
|
45202
|
+
const reason = requireDestructiveConfirmation(options, 'Pass --reason "<text>" to record why the values are being deleted.');
|
|
45203
|
+
if (reason === null)
|
|
45204
|
+
return;
|
|
45205
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45206
|
+
if (!sdk)
|
|
45207
|
+
return;
|
|
45208
|
+
const choiceSetService = sdk.entities.choicesets;
|
|
45209
|
+
const [deleteError] = await catchError(choiceSetService.deleteValuesById(choiceSetId, valueIds));
|
|
45210
|
+
if (deleteError) {
|
|
45211
|
+
return fail(`Error deleting values from choice set '${choiceSetId}'`, await extractErrorMessage(deleteError));
|
|
45212
|
+
}
|
|
45213
|
+
OutputFormatter.success({
|
|
45214
|
+
Result: RESULTS.Success,
|
|
45215
|
+
Code: OUTPUT_CODES.ChoiceSetValuesDeleted,
|
|
45216
|
+
Data: {
|
|
45217
|
+
ChoiceSetId: choiceSetId,
|
|
45218
|
+
DeletedIds: valueIds,
|
|
45219
|
+
Reason: reason
|
|
44237
45220
|
}
|
|
44238
45221
|
});
|
|
44239
45222
|
});
|
|
@@ -44270,28 +45253,25 @@ async function readJsonInput(filePath, inline, missingMsg = "Provide either --fi
|
|
|
44270
45253
|
// src/commands/entities.ts
|
|
44271
45254
|
var ENTITIES_LIST_EXAMPLES = [
|
|
44272
45255
|
{
|
|
44273
|
-
Description: "List Data Fabric entities",
|
|
45256
|
+
Description: "List Data Fabric entities.",
|
|
44274
45257
|
Command: "uip df entities list --native-only",
|
|
44275
45258
|
Output: {
|
|
44276
45259
|
Code: "EntityList",
|
|
44277
45260
|
Data: [
|
|
44278
45261
|
{
|
|
44279
|
-
|
|
44280
|
-
|
|
44281
|
-
|
|
44282
|
-
|
|
44283
|
-
|
|
44284
|
-
|
|
44285
|
-
|
|
44286
|
-
|
|
44287
|
-
|
|
44288
|
-
|
|
44289
|
-
|
|
44290
|
-
|
|
44291
|
-
|
|
44292
|
-
Source: "Native",
|
|
44293
|
-
Description: "Customer records",
|
|
44294
|
-
FieldCount: 6
|
|
45262
|
+
id: "a1b2c3d4-0000-0000-0000-000000000001",
|
|
45263
|
+
name: "Invoice",
|
|
45264
|
+
displayName: "Invoice",
|
|
45265
|
+
entityType: "Standard",
|
|
45266
|
+
description: "Invoice records",
|
|
45267
|
+
isRbacEnabled: false,
|
|
45268
|
+
fields: [
|
|
45269
|
+
{
|
|
45270
|
+
id: "f1000000-0000-0000-0000-000000000001",
|
|
45271
|
+
name: "amount"
|
|
45272
|
+
}
|
|
45273
|
+
],
|
|
45274
|
+
externalFields: []
|
|
44295
45275
|
}
|
|
44296
45276
|
]
|
|
44297
45277
|
}
|
|
@@ -44299,34 +45279,35 @@ var ENTITIES_LIST_EXAMPLES = [
|
|
|
44299
45279
|
];
|
|
44300
45280
|
var ENTITIES_GET_EXAMPLES = [
|
|
44301
45281
|
{
|
|
44302
|
-
Description: "Get entity schema by ID",
|
|
45282
|
+
Description: "Get entity schema by ID.",
|
|
44303
45283
|
Command: "uip df entities get a1b2c3d4-0000-0000-0000-000000000001",
|
|
44304
45284
|
Output: {
|
|
44305
45285
|
Code: "EntitySchema",
|
|
44306
45286
|
Data: {
|
|
44307
|
-
|
|
44308
|
-
|
|
44309
|
-
|
|
44310
|
-
|
|
44311
|
-
|
|
44312
|
-
|
|
44313
|
-
|
|
44314
|
-
ID: "f1000000-0000-0000-0000-000000000001",
|
|
44315
|
-
Name: "id",
|
|
44316
|
-
DisplayName: "ID",
|
|
44317
|
-
Type: "Guid",
|
|
44318
|
-
Required: true,
|
|
44319
|
-
PrimaryKey: true,
|
|
44320
|
-
System: true
|
|
44321
|
-
},
|
|
45287
|
+
id: "a1b2c3d4-0000-0000-0000-000000000001",
|
|
45288
|
+
name: "Invoice",
|
|
45289
|
+
displayName: "Invoice",
|
|
45290
|
+
entityType: "Standard",
|
|
45291
|
+
description: "Invoice records",
|
|
45292
|
+
isRbacEnabled: false,
|
|
45293
|
+
fields: [
|
|
44322
45294
|
{
|
|
44323
|
-
|
|
44324
|
-
|
|
44325
|
-
|
|
44326
|
-
|
|
44327
|
-
|
|
44328
|
-
|
|
44329
|
-
|
|
45295
|
+
id: "f1000000-0000-0000-0000-000000000002",
|
|
45296
|
+
name: "amount",
|
|
45297
|
+
displayName: "Amount",
|
|
45298
|
+
fieldDataType: { name: "DECIMAL" },
|
|
45299
|
+
sqlType: {
|
|
45300
|
+
name: "DECIMAL",
|
|
45301
|
+
decimalPrecision: 2,
|
|
45302
|
+
minValue: 0,
|
|
45303
|
+
maxValue: 999999
|
|
45304
|
+
},
|
|
45305
|
+
isRequired: true,
|
|
45306
|
+
isUnique: false,
|
|
45307
|
+
isEncrypted: false,
|
|
45308
|
+
isRbacEnabled: false,
|
|
45309
|
+
isPrimaryKey: false,
|
|
45310
|
+
isSystemField: false
|
|
44330
45311
|
}
|
|
44331
45312
|
]
|
|
44332
45313
|
}
|
|
@@ -44348,8 +45329,8 @@ var ENTITIES_DELETE_EXAMPLES = [
|
|
|
44348
45329
|
];
|
|
44349
45330
|
var ENTITIES_CREATE_EXAMPLES = [
|
|
44350
45331
|
{
|
|
44351
|
-
Description: "Create an entity with
|
|
44352
|
-
Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"fieldName":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"fieldName":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"fieldName":"submitter","type":"RELATIONSHIP","
|
|
45332
|
+
Description: "Create an entity with choice-set, relationship, and file fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP and FILE both require '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.",
|
|
45333
|
+
Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"fieldName":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"fieldName":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"fieldName":"submitter","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","isRequired":true},{"fieldName":"receipt","type":"FILE","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000099","referenceFieldId":"f1000000-0000-0000-0000-000000000199"}]}'`,
|
|
44353
45334
|
Output: {
|
|
44354
45335
|
Code: "EntityCreated",
|
|
44355
45336
|
Data: { ID: "a1b2c3d4-0000-0000-0000-000000000004" }
|
|
@@ -44383,41 +45364,20 @@ function pickKnownUpdateKeys(input) {
|
|
|
44383
45364
|
var registerEntitiesCommand = (program2) => {
|
|
44384
45365
|
const entities = program2.command("entities").description("Browse Data Fabric entity schemas");
|
|
44385
45366
|
entities.command("list").description("List all Data Fabric entities").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--native-only", "Show only native entities (exclude federated entities with external connections)").examples(ENTITIES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
44386
|
-
const
|
|
44387
|
-
if (
|
|
44388
|
-
OutputFormatter.error({
|
|
44389
|
-
Result: RESULTS.Failure,
|
|
44390
|
-
Message: "Error connecting to Data Fabric",
|
|
44391
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44392
|
-
});
|
|
44393
|
-
processContext.exit(1);
|
|
45367
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45368
|
+
if (!sdk)
|
|
44394
45369
|
return;
|
|
44395
|
-
}
|
|
44396
45370
|
const [listError, result] = await catchError(sdk.entities.getAll());
|
|
44397
45371
|
if (listError) {
|
|
44398
|
-
|
|
44399
|
-
Result: RESULTS.Failure,
|
|
44400
|
-
Message: "Error listing entities",
|
|
44401
|
-
Instructions: await extractErrorMessage(listError)
|
|
44402
|
-
});
|
|
44403
|
-
processContext.exit(1);
|
|
44404
|
-
return;
|
|
45372
|
+
return fail("Error listing entities", await extractErrorMessage(listError));
|
|
44405
45373
|
}
|
|
44406
|
-
const entityList = (result ?? []).
|
|
45374
|
+
const entityList = (result ?? []).filter((e) => {
|
|
45375
|
+
if (!options.nativeOnly)
|
|
45376
|
+
return true;
|
|
44407
45377
|
const entity = e;
|
|
44408
45378
|
const externalFields = entity.externalFields ?? [];
|
|
44409
|
-
|
|
44410
|
-
|
|
44411
|
-
return {
|
|
44412
|
-
Name: entity.name,
|
|
44413
|
-
DisplayName: entity.displayName || entity.name,
|
|
44414
|
-
ID: entity.id,
|
|
44415
|
-
Type: entity.entityType,
|
|
44416
|
-
Source: isNative ? "Native" : `Federated${connectorName ? ` (${connectorName})` : ""}`,
|
|
44417
|
-
Description: entity.description || "",
|
|
44418
|
-
FieldCount: entity.fields.length
|
|
44419
|
-
};
|
|
44420
|
-
}).filter((e) => !options.nativeOnly || e.Source === "Native");
|
|
45379
|
+
return externalFields.length === 0;
|
|
45380
|
+
});
|
|
44421
45381
|
OutputFormatter.success({
|
|
44422
45382
|
Result: RESULTS.Success,
|
|
44423
45383
|
Code: "EntityList",
|
|
@@ -44425,117 +45385,45 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44425
45385
|
});
|
|
44426
45386
|
});
|
|
44427
45387
|
entities.command("get").description("Get schema details of a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ENTITIES_GET_EXAMPLES).trackedAction(processContext, async (id, options) => {
|
|
44428
|
-
const
|
|
44429
|
-
if (
|
|
44430
|
-
OutputFormatter.error({
|
|
44431
|
-
Result: RESULTS.Failure,
|
|
44432
|
-
Message: "Error connecting to Data Fabric",
|
|
44433
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44434
|
-
});
|
|
44435
|
-
processContext.exit(1);
|
|
45388
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45389
|
+
if (!sdk)
|
|
44436
45390
|
return;
|
|
44437
|
-
}
|
|
44438
45391
|
const [getError, entity] = await catchError(sdk.entities.getById(id));
|
|
44439
45392
|
if (getError) {
|
|
44440
|
-
|
|
44441
|
-
Result: RESULTS.Failure,
|
|
44442
|
-
Message: `Error getting entity schema '${id}'`,
|
|
44443
|
-
Instructions: await extractErrorMessage(getError)
|
|
44444
|
-
});
|
|
44445
|
-
processContext.exit(1);
|
|
44446
|
-
return;
|
|
45393
|
+
return fail(`Error getting entity schema '${id}'`, await extractErrorMessage(getError));
|
|
44447
45394
|
}
|
|
44448
45395
|
const e = entity;
|
|
44449
45396
|
if (!e?.fields) {
|
|
44450
|
-
|
|
44451
|
-
Result: RESULTS.Failure,
|
|
44452
|
-
Message: `Entity '${id}' not found`,
|
|
44453
|
-
Instructions: "Verify the entity ID exists. Use 'df entities list' to see available entities."
|
|
44454
|
-
});
|
|
44455
|
-
processContext.exit(1);
|
|
44456
|
-
return;
|
|
45397
|
+
return fail(`Entity '${id}' not found`, "Verify the entity ID exists. Use 'df entities list' to see available entities.");
|
|
44457
45398
|
}
|
|
44458
|
-
const fields = e.fields.map((field) => ({
|
|
44459
|
-
ID: field.id,
|
|
44460
|
-
Name: field.name,
|
|
44461
|
-
DisplayName: field.displayName,
|
|
44462
|
-
Type: field.fieldDataType?.name,
|
|
44463
|
-
Required: field.isRequired,
|
|
44464
|
-
PrimaryKey: field.isPrimaryKey,
|
|
44465
|
-
System: field.isSystemField
|
|
44466
|
-
}));
|
|
44467
45399
|
OutputFormatter.success({
|
|
44468
45400
|
Result: RESULTS.Success,
|
|
44469
45401
|
Code: "EntitySchema",
|
|
44470
|
-
Data:
|
|
44471
|
-
Name: e.name,
|
|
44472
|
-
DisplayName: e.displayName || e.name,
|
|
44473
|
-
ID: e.id,
|
|
44474
|
-
Type: e.entityType,
|
|
44475
|
-
Description: e.description || "",
|
|
44476
|
-
Fields: fields
|
|
44477
|
-
}
|
|
45402
|
+
Data: e
|
|
44478
45403
|
});
|
|
44479
45404
|
});
|
|
44480
45405
|
entities.command("create").description("Create a new Data Fabric entity").argument("<name>", "Entity name (must start with a letter; letters, numbers, and underscores only)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with entity definition (fields array required; displayName, description, isRbacEnabled optional)").option("--body <json>", "Inline JSON entity definition").examples(ENTITIES_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
|
|
44481
45406
|
const [parseError, parsed] = await catchError(readJsonInput(options.file, options.body, "Provide entity definition via --file or --body."));
|
|
44482
45407
|
if (parseError) {
|
|
44483
|
-
|
|
44484
|
-
Result: RESULTS.Failure,
|
|
44485
|
-
Message: "Error parsing entity definition",
|
|
44486
|
-
Instructions: parseError.message
|
|
44487
|
-
});
|
|
44488
|
-
processContext.exit(1);
|
|
44489
|
-
return;
|
|
45408
|
+
return fail("Error parsing entity definition", parseError.message);
|
|
44490
45409
|
}
|
|
44491
45410
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
44492
|
-
|
|
44493
|
-
Result: RESULTS.Failure,
|
|
44494
|
-
Message: "Entity definition must be a JSON object",
|
|
44495
|
-
Instructions: "Provide a JSON object with a 'fields' array and optional displayName, description, isRbacEnabled."
|
|
44496
|
-
});
|
|
44497
|
-
processContext.exit(1);
|
|
44498
|
-
return;
|
|
45411
|
+
return fail("Entity definition must be a JSON object", "Provide a JSON object with a 'fields' array and optional displayName, description, isRbacEnabled.");
|
|
44499
45412
|
}
|
|
44500
45413
|
const definition = parsed;
|
|
44501
45414
|
if (!Array.isArray(definition.fields)) {
|
|
44502
|
-
|
|
44503
|
-
Result: RESULTS.Failure,
|
|
44504
|
-
Message: "Entity definition must include a 'fields' array",
|
|
44505
|
-
Instructions: "Provide a JSON object with a 'fields' array containing field definitions."
|
|
44506
|
-
});
|
|
44507
|
-
processContext.exit(1);
|
|
44508
|
-
return;
|
|
45415
|
+
return fail("Entity definition must include a 'fields' array", "Provide a JSON object with a 'fields' array containing field definitions.");
|
|
44509
45416
|
}
|
|
44510
45417
|
const hasInvalidField = definition.fields.some((f) => typeof f !== "object" || f === null || typeof f.fieldName !== "string");
|
|
44511
45418
|
if (hasInvalidField) {
|
|
44512
|
-
|
|
44513
|
-
Result: RESULTS.Failure,
|
|
44514
|
-
Message: "Each field must include a 'fieldName' string",
|
|
44515
|
-
Instructions: 'Example: {"fieldName":"title","type":"STRING"}'
|
|
44516
|
-
});
|
|
44517
|
-
processContext.exit(1);
|
|
44518
|
-
return;
|
|
45419
|
+
return fail("Each field must include a 'fieldName' string", 'Example: {"fieldName":"title","type":"STRING"}');
|
|
44519
45420
|
}
|
|
44520
45421
|
if (hasInvalidFieldType(definition.fields)) {
|
|
44521
|
-
|
|
44522
|
-
Result: RESULTS.Failure,
|
|
44523
|
-
Message: "Invalid field type in fields",
|
|
44524
|
-
Instructions: `Valid types: ${VALID_FIELD_TYPES_LIST}`
|
|
44525
|
-
});
|
|
44526
|
-
processContext.exit(1);
|
|
44527
|
-
return;
|
|
45422
|
+
return fail("Invalid field type in fields", `Valid types: ${VALID_FIELD_TYPES_LIST}`);
|
|
44528
45423
|
}
|
|
44529
|
-
const
|
|
44530
|
-
if (
|
|
44531
|
-
OutputFormatter.error({
|
|
44532
|
-
Result: RESULTS.Failure,
|
|
44533
|
-
Message: "Error connecting to Data Fabric",
|
|
44534
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44535
|
-
});
|
|
44536
|
-
processContext.exit(1);
|
|
45424
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45425
|
+
if (!sdk)
|
|
44537
45426
|
return;
|
|
44538
|
-
}
|
|
44539
45427
|
const createOpts = {
|
|
44540
45428
|
...definition.displayName !== undefined && {
|
|
44541
45429
|
displayName: definition.displayName
|
|
@@ -44550,13 +45438,7 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44550
45438
|
const entityService = sdk.entities;
|
|
44551
45439
|
const [createError, entityId] = await catchError(entityService.create(name, definition.fields, Object.keys(createOpts).length > 0 ? createOpts : undefined));
|
|
44552
45440
|
if (createError) {
|
|
44553
|
-
|
|
44554
|
-
Result: RESULTS.Failure,
|
|
44555
|
-
Message: "Error creating entity",
|
|
44556
|
-
Instructions: await extractErrorMessage(createError)
|
|
44557
|
-
});
|
|
44558
|
-
processContext.exit(1);
|
|
44559
|
-
return;
|
|
45441
|
+
return fail("Error creating entity", await extractErrorMessage(createError));
|
|
44560
45442
|
}
|
|
44561
45443
|
OutputFormatter.success({
|
|
44562
45444
|
Result: RESULTS.Success,
|
|
@@ -44567,50 +45449,20 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44567
45449
|
entities.command("update").description("Update schema or metadata of a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with update options (addFields, updateFields, removeFields, displayName, description, isRbacEnabled)").option("--body <json>", "Inline JSON update options").option("--confirm", "Required when 'removeFields' is non-empty — acknowledges the field deletion is irreversible").option("--reason <reason>", "Required when 'removeFields' is non-empty — echoed back in the response so the caller can log it").trackedAction(processContext, async (id, options) => {
|
|
44568
45450
|
const [parseError, parsed] = await catchError(readJsonInput(options.file, options.body, "Provide update options via --file or --body."));
|
|
44569
45451
|
if (parseError) {
|
|
44570
|
-
|
|
44571
|
-
Result: RESULTS.Failure,
|
|
44572
|
-
Message: "Error parsing update options",
|
|
44573
|
-
Instructions: parseError.message
|
|
44574
|
-
});
|
|
44575
|
-
processContext.exit(1);
|
|
44576
|
-
return;
|
|
45452
|
+
return fail("Error parsing update options", parseError.message);
|
|
44577
45453
|
}
|
|
44578
45454
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
44579
|
-
|
|
44580
|
-
Result: RESULTS.Failure,
|
|
44581
|
-
Message: "Update options must be a JSON object",
|
|
44582
|
-
Instructions: "Provide a JSON object with addFields, updateFields, removeFields, displayName, description, or isRbacEnabled."
|
|
44583
|
-
});
|
|
44584
|
-
processContext.exit(1);
|
|
44585
|
-
return;
|
|
45455
|
+
return fail("Update options must be a JSON object", "Provide a JSON object with addFields, updateFields, removeFields, displayName, description, or isRbacEnabled.");
|
|
44586
45456
|
}
|
|
44587
45457
|
const input = parsed;
|
|
44588
45458
|
if (input.addFields !== undefined && !Array.isArray(input.addFields)) {
|
|
44589
|
-
|
|
44590
|
-
Result: RESULTS.Failure,
|
|
44591
|
-
Message: "'addFields' must be an array",
|
|
44592
|
-
Instructions: 'Example: {"addFields":[{"fieldName":"title","type":"STRING"}]}'
|
|
44593
|
-
});
|
|
44594
|
-
processContext.exit(1);
|
|
44595
|
-
return;
|
|
45459
|
+
return fail("'addFields' must be an array", 'Example: {"addFields":[{"fieldName":"title","type":"STRING"}]}');
|
|
44596
45460
|
}
|
|
44597
45461
|
if (input.updateFields !== undefined && !Array.isArray(input.updateFields)) {
|
|
44598
|
-
|
|
44599
|
-
Result: RESULTS.Failure,
|
|
44600
|
-
Message: "'updateFields' must be an array",
|
|
44601
|
-
Instructions: 'Example: {"updateFields":[{"id":"<fieldId>","displayName":"New Name"}]}'
|
|
44602
|
-
});
|
|
44603
|
-
processContext.exit(1);
|
|
44604
|
-
return;
|
|
45462
|
+
return fail("'updateFields' must be an array", 'Example: {"updateFields":[{"id":"<fieldId>","displayName":"New Name"}]}');
|
|
44605
45463
|
}
|
|
44606
45464
|
if (input.removeFields !== undefined && !Array.isArray(input.removeFields)) {
|
|
44607
|
-
|
|
44608
|
-
Result: RESULTS.Failure,
|
|
44609
|
-
Message: "'removeFields' must be an array",
|
|
44610
|
-
Instructions: 'Example: {"removeFields":[{"fieldName":"old_field"}]}'
|
|
44611
|
-
});
|
|
44612
|
-
processContext.exit(1);
|
|
44613
|
-
return;
|
|
45465
|
+
return fail("'removeFields' must be an array", 'Example: {"removeFields":[{"fieldName":"old_field"}]}');
|
|
44614
45466
|
}
|
|
44615
45467
|
let trimmedReason;
|
|
44616
45468
|
let removedFieldNames = [];
|
|
@@ -44624,33 +45476,12 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44624
45476
|
return typeof fn !== "string" || fn.trim() === "";
|
|
44625
45477
|
});
|
|
44626
45478
|
if (hasInvalidRemove) {
|
|
44627
|
-
|
|
44628
|
-
Result: RESULTS.Failure,
|
|
44629
|
-
Message: "Each field in removeFields must include a non-empty 'fieldName' string",
|
|
44630
|
-
Instructions: 'Example: {"removeFields":[{"fieldName":"old_field"}]}'
|
|
44631
|
-
});
|
|
44632
|
-
processContext.exit(1);
|
|
44633
|
-
return;
|
|
45479
|
+
return fail("Each field in removeFields must include a non-empty 'fieldName' string", 'Example: {"removeFields":[{"fieldName":"old_field"}]}');
|
|
44634
45480
|
}
|
|
44635
|
-
|
|
44636
|
-
|
|
44637
|
-
Result: RESULTS.Failure,
|
|
44638
|
-
Message: "Confirmation required for destructive operation",
|
|
44639
|
-
Instructions: "Pass --confirm to acknowledge field deletion is irreversible."
|
|
44640
|
-
});
|
|
44641
|
-
processContext.exit(1);
|
|
44642
|
-
return;
|
|
44643
|
-
}
|
|
44644
|
-
trimmedReason = options.reason?.trim();
|
|
44645
|
-
if (trimmedReason === undefined || trimmedReason === "") {
|
|
44646
|
-
OutputFormatter.error({
|
|
44647
|
-
Result: RESULTS.Failure,
|
|
44648
|
-
Message: "Reason required for destructive operation",
|
|
44649
|
-
Instructions: 'Pass --reason "<text>" to record why fields are being removed.'
|
|
44650
|
-
});
|
|
44651
|
-
processContext.exit(1);
|
|
45481
|
+
const reason = requireDestructiveConfirmation(options, 'Pass --reason "<text>" to record why fields are being removed.');
|
|
45482
|
+
if (reason === null)
|
|
44652
45483
|
return;
|
|
44653
|
-
|
|
45484
|
+
trimmedReason = reason;
|
|
44654
45485
|
removedFieldNames = removeFields.map((f) => f.fieldName);
|
|
44655
45486
|
}
|
|
44656
45487
|
if (Array.isArray(input.addFields)) {
|
|
@@ -44661,44 +45492,20 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44661
45492
|
return typeof fn !== "string" || fn.trim() === "";
|
|
44662
45493
|
});
|
|
44663
45494
|
if (hasInvalidField) {
|
|
44664
|
-
|
|
44665
|
-
Result: RESULTS.Failure,
|
|
44666
|
-
Message: "Each field in addFields must include a non-empty 'fieldName' string",
|
|
44667
|
-
Instructions: 'Example: {"fieldName":"title","type":"STRING"}'
|
|
44668
|
-
});
|
|
44669
|
-
processContext.exit(1);
|
|
44670
|
-
return;
|
|
45495
|
+
return fail("Each field in addFields must include a non-empty 'fieldName' string", 'Example: {"fieldName":"title","type":"STRING"}');
|
|
44671
45496
|
}
|
|
44672
45497
|
if (hasInvalidFieldType(input.addFields)) {
|
|
44673
|
-
|
|
44674
|
-
Result: RESULTS.Failure,
|
|
44675
|
-
Message: "Invalid field type in addFields",
|
|
44676
|
-
Instructions: `Valid types: ${VALID_FIELD_TYPES_LIST}`
|
|
44677
|
-
});
|
|
44678
|
-
processContext.exit(1);
|
|
44679
|
-
return;
|
|
45498
|
+
return fail("Invalid field type in addFields", `Valid types: ${VALID_FIELD_TYPES_LIST}`);
|
|
44680
45499
|
}
|
|
44681
45500
|
const addNames = input.addFields.map((f) => f.fieldName);
|
|
44682
45501
|
const duplicateAdd = addNames.find((name, i2) => addNames.indexOf(name) !== i2);
|
|
44683
45502
|
if (duplicateAdd !== undefined) {
|
|
44684
|
-
|
|
44685
|
-
Result: RESULTS.Failure,
|
|
44686
|
-
Message: `Duplicate fieldName '${duplicateAdd}' in addFields`,
|
|
44687
|
-
Instructions: "Each entry in addFields must have a unique fieldName."
|
|
44688
|
-
});
|
|
44689
|
-
processContext.exit(1);
|
|
44690
|
-
return;
|
|
45503
|
+
return fail(`Duplicate fieldName '${duplicateAdd}' in addFields`, "Each entry in addFields must have a unique fieldName.");
|
|
44691
45504
|
}
|
|
44692
45505
|
if (removedFieldNames.length > 0) {
|
|
44693
45506
|
const conflict = addNames.find((name) => removedFieldNames.includes(name));
|
|
44694
45507
|
if (conflict !== undefined) {
|
|
44695
|
-
|
|
44696
|
-
Result: RESULTS.Failure,
|
|
44697
|
-
Message: `Field '${conflict}' appears in both addFields and removeFields`,
|
|
44698
|
-
Instructions: "A single update cannot add and remove the same field. Split into two calls if you need to recreate it."
|
|
44699
|
-
});
|
|
44700
|
-
processContext.exit(1);
|
|
44701
|
-
return;
|
|
45508
|
+
return fail(`Field '${conflict}' appears in both addFields and removeFields`, "A single update cannot add and remove the same field. Split into two calls if you need to recreate it.");
|
|
44702
45509
|
}
|
|
44703
45510
|
}
|
|
44704
45511
|
}
|
|
@@ -44710,35 +45517,16 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44710
45517
|
return typeof fid !== "string" || fid.trim() === "";
|
|
44711
45518
|
});
|
|
44712
45519
|
if (hasInvalidField) {
|
|
44713
|
-
|
|
44714
|
-
Result: RESULTS.Failure,
|
|
44715
|
-
Message: "Each field in updateFields must include a non-empty 'id' string",
|
|
44716
|
-
Instructions: `Use 'df entities get <entityId>' to find field IDs. Example: {"id":"<fieldId>","displayName":"Total Amount","isRequired":true}`
|
|
44717
|
-
});
|
|
44718
|
-
processContext.exit(1);
|
|
44719
|
-
return;
|
|
45520
|
+
return fail("Each field in updateFields must include a non-empty 'id' string", `Use 'df entities get <entityId>' to find field IDs. Example: {"id":"<fieldId>","displayName":"Total Amount","isRequired":true}`);
|
|
44720
45521
|
}
|
|
44721
45522
|
}
|
|
44722
|
-
const
|
|
44723
|
-
if (
|
|
44724
|
-
OutputFormatter.error({
|
|
44725
|
-
Result: RESULTS.Failure,
|
|
44726
|
-
Message: "Error connecting to Data Fabric",
|
|
44727
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44728
|
-
});
|
|
44729
|
-
processContext.exit(1);
|
|
45523
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45524
|
+
if (!sdk)
|
|
44730
45525
|
return;
|
|
44731
|
-
}
|
|
44732
45526
|
const entityService = sdk.entities;
|
|
44733
45527
|
const [updateError] = await catchError(entityService.updateById(id, pickKnownUpdateKeys(input)));
|
|
44734
45528
|
if (updateError) {
|
|
44735
|
-
|
|
44736
|
-
Result: RESULTS.Failure,
|
|
44737
|
-
Message: "Error updating entity",
|
|
44738
|
-
Instructions: await extractErrorMessage(updateError)
|
|
44739
|
-
});
|
|
44740
|
-
processContext.exit(1);
|
|
44741
|
-
return;
|
|
45529
|
+
return fail("Error updating entity", await extractErrorMessage(updateError));
|
|
44742
45530
|
}
|
|
44743
45531
|
OutputFormatter.success({
|
|
44744
45532
|
Result: RESULTS.Success,
|
|
@@ -44753,45 +45541,16 @@ var registerEntitiesCommand = (program2) => {
|
|
|
44753
45541
|
});
|
|
44754
45542
|
});
|
|
44755
45543
|
entities.command("delete").description("Delete a Data Fabric entity (irreversible)").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--confirm", "Acknowledge this is an irreversible operation").option("--reason <reason>", "Reason for the deletion — echoed back in the response so the caller can log it").examples(ENTITIES_DELETE_EXAMPLES).trackedAction(processContext, async (id, options) => {
|
|
44756
|
-
|
|
44757
|
-
|
|
44758
|
-
Result: RESULTS.Failure,
|
|
44759
|
-
Message: "Confirmation required for destructive operation",
|
|
44760
|
-
Instructions: "Pass --confirm to acknowledge this is irreversible."
|
|
44761
|
-
});
|
|
44762
|
-
processContext.exit(1);
|
|
45544
|
+
const reason = requireDestructiveConfirmation(options, 'Pass --reason "<text>" to record why the entity is being deleted.');
|
|
45545
|
+
if (reason === null)
|
|
44763
45546
|
return;
|
|
44764
|
-
|
|
44765
|
-
|
|
44766
|
-
if (reason === undefined || reason === "") {
|
|
44767
|
-
OutputFormatter.error({
|
|
44768
|
-
Result: RESULTS.Failure,
|
|
44769
|
-
Message: "Reason required for destructive operation",
|
|
44770
|
-
Instructions: 'Pass --reason "<text>" to record why the entity is being deleted.'
|
|
44771
|
-
});
|
|
44772
|
-
processContext.exit(1);
|
|
44773
|
-
return;
|
|
44774
|
-
}
|
|
44775
|
-
const [clientError, sdk] = await catchError(createDataFabricClient(options.tenant));
|
|
44776
|
-
if (clientError) {
|
|
44777
|
-
OutputFormatter.error({
|
|
44778
|
-
Result: RESULTS.Failure,
|
|
44779
|
-
Message: "Error connecting to Data Fabric",
|
|
44780
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44781
|
-
});
|
|
44782
|
-
processContext.exit(1);
|
|
45547
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45548
|
+
if (!sdk)
|
|
44783
45549
|
return;
|
|
44784
|
-
}
|
|
44785
45550
|
const entityService = sdk.entities;
|
|
44786
45551
|
const [deleteError] = await catchError(entityService.deleteById(id));
|
|
44787
45552
|
if (deleteError) {
|
|
44788
|
-
|
|
44789
|
-
Result: RESULTS.Failure,
|
|
44790
|
-
Message: `Error deleting entity '${id}'`,
|
|
44791
|
-
Instructions: await extractErrorMessage(deleteError)
|
|
44792
|
-
});
|
|
44793
|
-
processContext.exit(1);
|
|
44794
|
-
return;
|
|
45553
|
+
return fail(`Error deleting entity '${id}'`, await extractErrorMessage(deleteError));
|
|
44795
45554
|
}
|
|
44796
45555
|
OutputFormatter.success({
|
|
44797
45556
|
Result: RESULTS.Success,
|
|
@@ -44851,45 +45610,20 @@ var registerFilesCommand = (program2) => {
|
|
|
44851
45610
|
const files = program2.command("files").description("Manage file attachments on Data Fabric entity records");
|
|
44852
45611
|
files.command("upload").description("Upload a file to a field on an entity record").argument("<entity-id>", "Entity ID").argument("<record-id>", "Record ID").argument("<field-name>", "Name of the file field (case-sensitive)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to the file to upload").examples(FILES_UPLOAD_EXAMPLES).trackedAction(processContext, async (entityId, recordId, fieldName, options) => {
|
|
44853
45612
|
if (!options.file) {
|
|
44854
|
-
|
|
44855
|
-
Result: RESULTS.Failure,
|
|
44856
|
-
Message: "A file path is required",
|
|
44857
|
-
Instructions: "Provide a file path via --file."
|
|
44858
|
-
});
|
|
44859
|
-
processContext.exit(1);
|
|
44860
|
-
return;
|
|
45613
|
+
return fail("A file path is required", "Provide a file path via --file.");
|
|
44861
45614
|
}
|
|
44862
|
-
const
|
|
44863
|
-
if (
|
|
44864
|
-
OutputFormatter.error({
|
|
44865
|
-
Result: RESULTS.Failure,
|
|
44866
|
-
Message: "Error connecting to Data Fabric",
|
|
44867
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44868
|
-
});
|
|
44869
|
-
processContext.exit(1);
|
|
45615
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45616
|
+
if (!sdk)
|
|
44870
45617
|
return;
|
|
44871
|
-
}
|
|
44872
45618
|
const [readError, fileContent] = await catchError(readFileBinary(options.file));
|
|
44873
45619
|
if (readError) {
|
|
44874
|
-
|
|
44875
|
-
Result: RESULTS.Failure,
|
|
44876
|
-
Message: "Error reading file",
|
|
44877
|
-
Instructions: readError.message
|
|
44878
|
-
});
|
|
44879
|
-
processContext.exit(1);
|
|
44880
|
-
return;
|
|
45620
|
+
return fail("Error reading file", readError.message);
|
|
44881
45621
|
}
|
|
44882
45622
|
const fsInst = getFileSystem();
|
|
44883
45623
|
const fileName = fsInst.path.basename(options.file) || "upload";
|
|
44884
45624
|
const [uploadError] = await catchError(sdk.entities.uploadAttachment(entityId, recordId, fieldName, new File([fileContent], fileName)));
|
|
44885
45625
|
if (uploadError) {
|
|
44886
|
-
|
|
44887
|
-
Result: RESULTS.Failure,
|
|
44888
|
-
Message: `Error uploading file to field '${fieldName}'`,
|
|
44889
|
-
Instructions: await extractErrorMessage(uploadError)
|
|
44890
|
-
});
|
|
44891
|
-
processContext.exit(1);
|
|
44892
|
-
return;
|
|
45626
|
+
return fail(`Error uploading file to field '${fieldName}'`, await extractErrorMessage(uploadError));
|
|
44893
45627
|
}
|
|
44894
45628
|
OutputFormatter.success({
|
|
44895
45629
|
Result: RESULTS.Success,
|
|
@@ -44903,46 +45637,21 @@ var registerFilesCommand = (program2) => {
|
|
|
44903
45637
|
});
|
|
44904
45638
|
});
|
|
44905
45639
|
files.command("download").description("Download a file from a field on an entity record").argument("<entity-id>", "Entity ID").argument("<record-id>", "Record ID").argument("<field-name>", "Name of the file field (case-sensitive)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--destination <path>", "Output file path (defaults to <record-id>_<field-name>.bin)").examples(FILES_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (entityId, recordId, fieldName, options) => {
|
|
44906
|
-
const
|
|
44907
|
-
if (
|
|
44908
|
-
OutputFormatter.error({
|
|
44909
|
-
Result: RESULTS.Failure,
|
|
44910
|
-
Message: "Error connecting to Data Fabric",
|
|
44911
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44912
|
-
});
|
|
44913
|
-
processContext.exit(1);
|
|
45640
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45641
|
+
if (!sdk)
|
|
44914
45642
|
return;
|
|
44915
|
-
}
|
|
44916
45643
|
const [downloadError, blob] = await catchError(sdk.entities.downloadAttachment(entityId, recordId, fieldName));
|
|
44917
45644
|
if (downloadError) {
|
|
44918
|
-
|
|
44919
|
-
Result: RESULTS.Failure,
|
|
44920
|
-
Message: `Error downloading file from field '${fieldName}'`,
|
|
44921
|
-
Instructions: await extractErrorMessage(downloadError)
|
|
44922
|
-
});
|
|
44923
|
-
processContext.exit(1);
|
|
44924
|
-
return;
|
|
45645
|
+
return fail(`Error downloading file from field '${fieldName}'`, await extractErrorMessage(downloadError));
|
|
44925
45646
|
}
|
|
44926
45647
|
const outputPath = options.destination ?? `${recordId}_${fieldName}.bin`;
|
|
44927
45648
|
const [bufferError, arrayBuffer] = await catchError(blob.arrayBuffer());
|
|
44928
45649
|
if (bufferError) {
|
|
44929
|
-
|
|
44930
|
-
Result: RESULTS.Failure,
|
|
44931
|
-
Message: "Error reading downloaded file content",
|
|
44932
|
-
Instructions: bufferError.message
|
|
44933
|
-
});
|
|
44934
|
-
processContext.exit(1);
|
|
44935
|
-
return;
|
|
45650
|
+
return fail("Error reading downloaded file content", bufferError.message);
|
|
44936
45651
|
}
|
|
44937
45652
|
const [writeError] = await catchError(writeFileBinary(outputPath, new Uint8Array(arrayBuffer)));
|
|
44938
45653
|
if (writeError) {
|
|
44939
|
-
|
|
44940
|
-
Result: RESULTS.Failure,
|
|
44941
|
-
Message: "Error writing downloaded file",
|
|
44942
|
-
Instructions: writeError.message
|
|
44943
|
-
});
|
|
44944
|
-
processContext.exit(1);
|
|
44945
|
-
return;
|
|
45654
|
+
return fail("Error writing downloaded file", writeError.message);
|
|
44946
45655
|
}
|
|
44947
45656
|
OutputFormatter.success({
|
|
44948
45657
|
Result: RESULTS.Success,
|
|
@@ -44956,25 +45665,12 @@ var registerFilesCommand = (program2) => {
|
|
|
44956
45665
|
});
|
|
44957
45666
|
});
|
|
44958
45667
|
files.command("delete").description("Delete a file from a field on an entity record").argument("<entity-id>", "Entity ID").argument("<record-id>", "Record ID").argument("<field-name>", "Name of the file field (case-sensitive)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FILES_DELETE_EXAMPLES).trackedAction(processContext, async (entityId, recordId, fieldName, options) => {
|
|
44959
|
-
const
|
|
44960
|
-
if (
|
|
44961
|
-
OutputFormatter.error({
|
|
44962
|
-
Result: RESULTS.Failure,
|
|
44963
|
-
Message: "Error connecting to Data Fabric",
|
|
44964
|
-
Instructions: await extractErrorMessage(clientError)
|
|
44965
|
-
});
|
|
44966
|
-
processContext.exit(1);
|
|
45668
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45669
|
+
if (!sdk)
|
|
44967
45670
|
return;
|
|
44968
|
-
}
|
|
44969
45671
|
const [deleteError] = await catchError(sdk.entities.deleteAttachment(entityId, recordId, fieldName));
|
|
44970
45672
|
if (deleteError) {
|
|
44971
|
-
|
|
44972
|
-
Result: RESULTS.Failure,
|
|
44973
|
-
Message: `Error deleting file from field '${fieldName}'`,
|
|
44974
|
-
Instructions: await extractErrorMessage(deleteError)
|
|
44975
|
-
});
|
|
44976
|
-
processContext.exit(1);
|
|
44977
|
-
return;
|
|
45673
|
+
return fail(`Error deleting file from field '${fieldName}'`, await extractErrorMessage(deleteError));
|
|
44978
45674
|
}
|
|
44979
45675
|
OutputFormatter.success({
|
|
44980
45676
|
Result: RESULTS.Success,
|
|
@@ -44996,13 +45692,12 @@ async function writeFileBinary(filePath, data) {
|
|
|
44996
45692
|
init_src();
|
|
44997
45693
|
var RECORDS_LIST_EXAMPLES = [
|
|
44998
45694
|
{
|
|
44999
|
-
Description: "List records in an entity",
|
|
45695
|
+
Description: "List records in an entity.",
|
|
45000
45696
|
Command: "uip df records list a1b2c3d4-0000-0000-0000-000000000001 --limit 2",
|
|
45001
45697
|
Output: {
|
|
45002
45698
|
Code: "RecordList",
|
|
45003
45699
|
Data: {
|
|
45004
|
-
|
|
45005
|
-
Records: [
|
|
45700
|
+
items: [
|
|
45006
45701
|
{
|
|
45007
45702
|
Id: "b2c3d4e5-0000-0000-0000-000000000001",
|
|
45008
45703
|
amount: 1500
|
|
@@ -45012,7 +45707,8 @@ var RECORDS_LIST_EXAMPLES = [
|
|
|
45012
45707
|
amount: 2750
|
|
45013
45708
|
}
|
|
45014
45709
|
],
|
|
45015
|
-
|
|
45710
|
+
totalCount: 2,
|
|
45711
|
+
hasNextPage: false
|
|
45016
45712
|
}
|
|
45017
45713
|
}
|
|
45018
45714
|
}
|
|
@@ -45045,7 +45741,7 @@ var RECORDS_INSERT_EXAMPLES = [
|
|
|
45045
45741
|
}
|
|
45046
45742
|
},
|
|
45047
45743
|
{
|
|
45048
|
-
Description: "Insert a record into an entity that has choice-set and relationship fields. " + "CHOICE_SET_SINGLE → pass the choice value's '
|
|
45744
|
+
Description: "Insert a record into an entity that has choice-set and relationship fields. " + "CHOICE_SET_SINGLE → pass the choice value's 'numberId' (integer, NOT the name string — look it up via 'df choice-sets list-values <id>'). " + "CHOICE_SET_MULTIPLE → pass an array of numberId integers. " + "RELATIONSHIP → always pass the target record's Id (UUID), regardless of which 'referenceFieldId' the schema uses for the join (the referenceFieldId configures the join, not the stored value).",
|
|
45049
45745
|
Command: `uip df records insert a1b2c3d4-0000-0000-0000-000000000004 --body '{"category":0,"tags":[1,3],"submitter":"e1f2a3b4-0000-0000-0000-000000000001","amount":250}'`,
|
|
45050
45746
|
Output: {
|
|
45051
45747
|
Code: "RecordInserted",
|
|
@@ -45094,47 +45790,22 @@ var registerRecordsCommand = (program2) => {
|
|
|
45094
45790
|
records.command("list").description("List records in a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-l, --limit <number>", "Number of records to return per page", "50").option("-o, --offset <number>", "Start from the page containing this record index (rounded down to nearest page boundary; (mutually exclusive with --cursor)").option("--cursor <cursor>", "Pagination cursor from a previous response to fetch the next page").examples(RECORDS_LIST_EXAMPLES).trackedAction(processContext, async (entityId, options) => {
|
|
45095
45791
|
const pageSize = Number(options.limit);
|
|
45096
45792
|
if (Number.isNaN(pageSize) || pageSize < 1) {
|
|
45097
|
-
|
|
45098
|
-
Result: RESULTS.Failure,
|
|
45099
|
-
Message: "Invalid --limit value",
|
|
45100
|
-
Instructions: "Provide a positive integer for --limit."
|
|
45101
|
-
});
|
|
45102
|
-
processContext.exit(1);
|
|
45103
|
-
return;
|
|
45793
|
+
return fail("Invalid --limit value", "Provide a positive integer for --limit.");
|
|
45104
45794
|
}
|
|
45105
45795
|
if (options.cursor !== undefined && options.offset !== undefined) {
|
|
45106
|
-
|
|
45107
|
-
Result: RESULTS.Failure,
|
|
45108
|
-
Message: "--offset and --cursor are mutually exclusive",
|
|
45109
|
-
Instructions: "Use --offset to jump to a position by record count, or --cursor to continue from a previous response."
|
|
45110
|
-
});
|
|
45111
|
-
processContext.exit(1);
|
|
45112
|
-
return;
|
|
45796
|
+
return fail("--offset and --cursor are mutually exclusive", "Use --offset to jump to a position by record count, or --cursor to continue from a previous response.");
|
|
45113
45797
|
}
|
|
45114
45798
|
let jumpToPage;
|
|
45115
45799
|
if (options.offset !== undefined) {
|
|
45116
45800
|
const offsetValue = Number(options.offset);
|
|
45117
45801
|
if (Number.isNaN(offsetValue) || offsetValue < 0) {
|
|
45118
|
-
|
|
45119
|
-
Result: RESULTS.Failure,
|
|
45120
|
-
Message: "Invalid --offset value",
|
|
45121
|
-
Instructions: "Provide a non-negative integer for --offset."
|
|
45122
|
-
});
|
|
45123
|
-
processContext.exit(1);
|
|
45124
|
-
return;
|
|
45802
|
+
return fail("Invalid --offset value", "Provide a non-negative integer for --offset.");
|
|
45125
45803
|
}
|
|
45126
45804
|
jumpToPage = Math.floor(offsetValue / pageSize) + 1;
|
|
45127
45805
|
}
|
|
45128
|
-
const
|
|
45129
|
-
if (
|
|
45130
|
-
OutputFormatter.error({
|
|
45131
|
-
Result: RESULTS.Failure,
|
|
45132
|
-
Message: "Error connecting to Data Fabric",
|
|
45133
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45134
|
-
});
|
|
45135
|
-
processContext.exit(1);
|
|
45806
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45807
|
+
if (!sdk)
|
|
45136
45808
|
return;
|
|
45137
|
-
}
|
|
45138
45809
|
const [listError, result] = await catchError(sdk.entities.getAllRecords(entityId, {
|
|
45139
45810
|
pageSize,
|
|
45140
45811
|
...options.cursor !== undefined && {
|
|
@@ -45143,64 +45814,24 @@ var registerRecordsCommand = (program2) => {
|
|
|
45143
45814
|
...jumpToPage !== undefined && { jumpToPage }
|
|
45144
45815
|
}));
|
|
45145
45816
|
if (listError) {
|
|
45146
|
-
|
|
45147
|
-
Result: RESULTS.Failure,
|
|
45148
|
-
Message: "Error listing records",
|
|
45149
|
-
Instructions: await extractErrorMessage(listError)
|
|
45150
|
-
});
|
|
45151
|
-
processContext.exit(1);
|
|
45152
|
-
return;
|
|
45817
|
+
return fail("Error listing records", await extractErrorMessage(listError));
|
|
45153
45818
|
}
|
|
45154
|
-
const r = result;
|
|
45155
|
-
const nextCursor = extractCursorValue(r.nextCursor);
|
|
45156
45819
|
OutputFormatter.success({
|
|
45157
45820
|
Result: RESULTS.Success,
|
|
45158
45821
|
Code: "RecordList",
|
|
45159
|
-
Data:
|
|
45160
|
-
TotalCount: r.totalCount ?? r.items.length,
|
|
45161
|
-
Records: r.items,
|
|
45162
|
-
HasNextPage: r.hasNextPage ?? false,
|
|
45163
|
-
...nextCursor !== undefined && {
|
|
45164
|
-
NextCursor: nextCursor
|
|
45165
|
-
},
|
|
45166
|
-
...r.currentPage !== undefined && {
|
|
45167
|
-
CurrentPage: r.currentPage
|
|
45168
|
-
},
|
|
45169
|
-
...r.totalPages !== undefined && {
|
|
45170
|
-
TotalPages: r.totalPages
|
|
45171
|
-
}
|
|
45172
|
-
}
|
|
45822
|
+
Data: result
|
|
45173
45823
|
});
|
|
45174
45824
|
});
|
|
45175
45825
|
records.command("get").description("Get a single record by ID").argument("<id>", "Entity ID").argument("<key>", "Record ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(RECORDS_GET_EXAMPLES).trackedAction(processContext, async (entityId, recordId, options) => {
|
|
45176
|
-
const
|
|
45177
|
-
if (
|
|
45178
|
-
OutputFormatter.error({
|
|
45179
|
-
Result: RESULTS.Failure,
|
|
45180
|
-
Message: "Error connecting to Data Fabric",
|
|
45181
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45182
|
-
});
|
|
45183
|
-
processContext.exit(1);
|
|
45826
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45827
|
+
if (!sdk)
|
|
45184
45828
|
return;
|
|
45185
|
-
}
|
|
45186
45829
|
const [getError, record] = await catchError(sdk.entities.getRecordById(entityId, recordId));
|
|
45187
45830
|
if (getError) {
|
|
45188
|
-
|
|
45189
|
-
Result: RESULTS.Failure,
|
|
45190
|
-
Message: `Error getting record '${recordId}'`,
|
|
45191
|
-
Instructions: await extractErrorMessage(getError)
|
|
45192
|
-
});
|
|
45193
|
-
processContext.exit(1);
|
|
45194
|
-
return;
|
|
45831
|
+
return fail(`Error getting record '${recordId}'`, await extractErrorMessage(getError));
|
|
45195
45832
|
}
|
|
45196
45833
|
if (!record) {
|
|
45197
|
-
|
|
45198
|
-
Result: RESULTS.Failure,
|
|
45199
|
-
Message: `Record '${recordId}' not found in entity '${entityId}'`,
|
|
45200
|
-
Instructions: "Verify the record ID exists. Use 'df records list' to see available records."
|
|
45201
|
-
});
|
|
45202
|
-
processContext.exit(1);
|
|
45203
|
-
return;
|
|
45834
|
+
return fail(`Record '${recordId}' not found in entity '${entityId}'`, "Verify the record ID exists. Use 'df records list' to see available records.");
|
|
45204
45835
|
}
|
|
45205
45836
|
OutputFormatter.success({
|
|
45206
45837
|
Result: RESULTS.Success,
|
|
@@ -45211,36 +45842,17 @@ var registerRecordsCommand = (program2) => {
|
|
|
45211
45842
|
records.command("insert").description("Insert records into a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with record data (object or array of objects)").option("--body <json>", "Inline JSON record data (object or array of objects)").examples(RECORDS_INSERT_EXAMPLES).trackedAction(processContext, async (entityId, options) => {
|
|
45212
45843
|
const [parseError, rawData] = await catchError(resolveJsonInput(options.file, options.body));
|
|
45213
45844
|
if (parseError) {
|
|
45214
|
-
|
|
45215
|
-
Result: RESULTS.Failure,
|
|
45216
|
-
Message: "Error parsing input data",
|
|
45217
|
-
Instructions: parseError.message
|
|
45218
|
-
});
|
|
45219
|
-
processContext.exit(1);
|
|
45220
|
-
return;
|
|
45845
|
+
return fail("Error parsing input data", parseError.message);
|
|
45221
45846
|
}
|
|
45222
|
-
const
|
|
45223
|
-
if (
|
|
45224
|
-
OutputFormatter.error({
|
|
45225
|
-
Result: RESULTS.Failure,
|
|
45226
|
-
Message: "Error connecting to Data Fabric",
|
|
45227
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45228
|
-
});
|
|
45229
|
-
processContext.exit(1);
|
|
45847
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45848
|
+
if (!sdk)
|
|
45230
45849
|
return;
|
|
45231
|
-
}
|
|
45232
45850
|
const data = rawData;
|
|
45233
45851
|
const recordsList = Array.isArray(data) ? data : [data];
|
|
45234
45852
|
if (recordsList.length === 1) {
|
|
45235
45853
|
const [insertError, result] = await catchError(sdk.entities.insertRecordById(entityId, recordsList[0]));
|
|
45236
45854
|
if (insertError) {
|
|
45237
|
-
|
|
45238
|
-
Result: RESULTS.Failure,
|
|
45239
|
-
Message: "Error inserting record",
|
|
45240
|
-
Instructions: await extractErrorMessage(insertError)
|
|
45241
|
-
});
|
|
45242
|
-
processContext.exit(1);
|
|
45243
|
-
return;
|
|
45855
|
+
return fail("Error inserting record", await extractErrorMessage(insertError));
|
|
45244
45856
|
}
|
|
45245
45857
|
OutputFormatter.success({
|
|
45246
45858
|
Result: RESULTS.Success,
|
|
@@ -45250,13 +45862,7 @@ var registerRecordsCommand = (program2) => {
|
|
|
45250
45862
|
} else {
|
|
45251
45863
|
const [insertError, result] = await catchError(sdk.entities.insertRecordsById(entityId, recordsList));
|
|
45252
45864
|
if (insertError) {
|
|
45253
|
-
|
|
45254
|
-
Result: RESULTS.Failure,
|
|
45255
|
-
Message: "Error inserting records",
|
|
45256
|
-
Instructions: await extractErrorMessage(insertError)
|
|
45257
|
-
});
|
|
45258
|
-
processContext.exit(1);
|
|
45259
|
-
return;
|
|
45865
|
+
return fail("Error inserting records", await extractErrorMessage(insertError));
|
|
45260
45866
|
}
|
|
45261
45867
|
const r = result;
|
|
45262
45868
|
const failureCount = r.failureRecords?.length ?? 0;
|
|
@@ -45278,47 +45884,22 @@ var registerRecordsCommand = (program2) => {
|
|
|
45278
45884
|
records.command("update").description("Update records in a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with record data (must include Id field)").option("--body <json>", "Inline JSON record data (must include Id field)").examples(RECORDS_UPDATE_EXAMPLES).trackedAction(processContext, async (entityId, options) => {
|
|
45279
45885
|
const [parseError, rawData] = await catchError(resolveJsonInput(options.file, options.body));
|
|
45280
45886
|
if (parseError) {
|
|
45281
|
-
|
|
45282
|
-
Result: RESULTS.Failure,
|
|
45283
|
-
Message: "Error parsing input data",
|
|
45284
|
-
Instructions: parseError.message
|
|
45285
|
-
});
|
|
45286
|
-
processContext.exit(1);
|
|
45287
|
-
return;
|
|
45887
|
+
return fail("Error parsing input data", parseError.message);
|
|
45288
45888
|
}
|
|
45289
|
-
const
|
|
45290
|
-
if (
|
|
45291
|
-
OutputFormatter.error({
|
|
45292
|
-
Result: RESULTS.Failure,
|
|
45293
|
-
Message: "Error connecting to Data Fabric",
|
|
45294
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45295
|
-
});
|
|
45296
|
-
processContext.exit(1);
|
|
45889
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45890
|
+
if (!sdk)
|
|
45297
45891
|
return;
|
|
45298
|
-
}
|
|
45299
45892
|
const data = rawData;
|
|
45300
45893
|
const recordsList = Array.isArray(data) ? data : [data];
|
|
45301
45894
|
if (recordsList.length === 1) {
|
|
45302
45895
|
const record = recordsList[0];
|
|
45303
45896
|
const recordId = record.Id !== undefined ? record.Id : record.id;
|
|
45304
45897
|
if (recordId === undefined || recordId === null) {
|
|
45305
|
-
|
|
45306
|
-
Result: RESULTS.Failure,
|
|
45307
|
-
Message: "Record must include an 'Id' field",
|
|
45308
|
-
Instructions: "Provide the record ID in the JSON data."
|
|
45309
|
-
});
|
|
45310
|
-
processContext.exit(1);
|
|
45311
|
-
return;
|
|
45898
|
+
return fail("Record must include an 'Id' field", "Provide the record ID in the JSON data.");
|
|
45312
45899
|
}
|
|
45313
45900
|
const [updateError, result] = await catchError(sdk.entities.updateRecordById(entityId, String(recordId), record));
|
|
45314
45901
|
if (updateError) {
|
|
45315
|
-
|
|
45316
|
-
Result: RESULTS.Failure,
|
|
45317
|
-
Message: "Error updating record",
|
|
45318
|
-
Instructions: await extractErrorMessage(updateError)
|
|
45319
|
-
});
|
|
45320
|
-
processContext.exit(1);
|
|
45321
|
-
return;
|
|
45902
|
+
return fail("Error updating record", await extractErrorMessage(updateError));
|
|
45322
45903
|
}
|
|
45323
45904
|
OutputFormatter.success({
|
|
45324
45905
|
Result: RESULTS.Success,
|
|
@@ -45328,23 +45909,11 @@ var registerRecordsCommand = (program2) => {
|
|
|
45328
45909
|
} else {
|
|
45329
45910
|
const missingId = recordsList.find((r2) => r2.Id == null && r2.id == null);
|
|
45330
45911
|
if (missingId) {
|
|
45331
|
-
|
|
45332
|
-
Result: RESULTS.Failure,
|
|
45333
|
-
Message: "All records must include an 'Id' field",
|
|
45334
|
-
Instructions: "Provide the record ID in each JSON object."
|
|
45335
|
-
});
|
|
45336
|
-
processContext.exit(1);
|
|
45337
|
-
return;
|
|
45912
|
+
return fail("All records must include an 'Id' field", "Provide the record ID in each JSON object.");
|
|
45338
45913
|
}
|
|
45339
45914
|
const [updateError, result] = await catchError(sdk.entities.updateRecordsById(entityId, recordsList));
|
|
45340
45915
|
if (updateError) {
|
|
45341
|
-
|
|
45342
|
-
Result: RESULTS.Failure,
|
|
45343
|
-
Message: "Error updating records",
|
|
45344
|
-
Instructions: await extractErrorMessage(updateError)
|
|
45345
|
-
});
|
|
45346
|
-
processContext.exit(1);
|
|
45347
|
-
return;
|
|
45916
|
+
return fail("Error updating records", await extractErrorMessage(updateError));
|
|
45348
45917
|
}
|
|
45349
45918
|
const r = result;
|
|
45350
45919
|
const failureCount = r.failureRecords?.length ?? 0;
|
|
@@ -45366,34 +45935,16 @@ var registerRecordsCommand = (program2) => {
|
|
|
45366
45935
|
records.command("query").description("Query records in a Data Fabric entity with filters, sorting, and aggregates. " + "Provide a JSON object via --body or --file with optional keys: " + "filterGroup, sortOptions (use isDescending: true/false), selectedFields, " + "aggregates (function: COUNT/SUM/AVG/MIN/MAX, field, alias?), groupBy.").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with query options (filterGroup, selectedFields, sortOptions, aggregates, groupBy)").option("--body <json>", "Inline JSON query options (filterGroup, selectedFields, sortOptions, aggregates, groupBy)").option("-l, --limit <number>", "Number of records to return per page", "50").option("-o, --offset <number>", "Start from the page containing this record index (rounded down to nearest page boundary;(mutually exclusive with --cursor)").option("--cursor <cursor>", "Pagination cursor from a previous response to fetch the next page").trackedAction(processContext, async (entityId, options) => {
|
|
45367
45936
|
const pageSize = Number(options.limit);
|
|
45368
45937
|
if (Number.isNaN(pageSize) || pageSize < 1) {
|
|
45369
|
-
|
|
45370
|
-
Result: RESULTS.Failure,
|
|
45371
|
-
Message: "Invalid --limit value",
|
|
45372
|
-
Instructions: "Provide a positive integer for --limit."
|
|
45373
|
-
});
|
|
45374
|
-
processContext.exit(1);
|
|
45375
|
-
return;
|
|
45938
|
+
return fail("Invalid --limit value", "Provide a positive integer for --limit.");
|
|
45376
45939
|
}
|
|
45377
45940
|
if (options.cursor !== undefined && options.offset !== undefined) {
|
|
45378
|
-
|
|
45379
|
-
Result: RESULTS.Failure,
|
|
45380
|
-
Message: "--offset and --cursor are mutually exclusive",
|
|
45381
|
-
Instructions: "Use --offset to jump to a position by record count, or --cursor to continue from a previous response."
|
|
45382
|
-
});
|
|
45383
|
-
processContext.exit(1);
|
|
45384
|
-
return;
|
|
45941
|
+
return fail("--offset and --cursor are mutually exclusive", "Use --offset to jump to a position by record count, or --cursor to continue from a previous response.");
|
|
45385
45942
|
}
|
|
45386
45943
|
let jumpToPage;
|
|
45387
45944
|
if (options.offset !== undefined) {
|
|
45388
45945
|
const offsetValue = Number(options.offset);
|
|
45389
45946
|
if (Number.isNaN(offsetValue) || offsetValue < 0) {
|
|
45390
|
-
|
|
45391
|
-
Result: RESULTS.Failure,
|
|
45392
|
-
Message: "Invalid --offset value",
|
|
45393
|
-
Instructions: "Provide a non-negative integer for --offset."
|
|
45394
|
-
});
|
|
45395
|
-
processContext.exit(1);
|
|
45396
|
-
return;
|
|
45947
|
+
return fail("Invalid --offset value", "Provide a non-negative integer for --offset.");
|
|
45397
45948
|
}
|
|
45398
45949
|
jumpToPage = Math.floor(offsetValue / pageSize) + 1;
|
|
45399
45950
|
}
|
|
@@ -45401,35 +45952,16 @@ var registerRecordsCommand = (program2) => {
|
|
|
45401
45952
|
if (options.file !== undefined || options.body !== undefined) {
|
|
45402
45953
|
const [parseError, parsed] = await catchError(readJsonInput(options.file, options.body, "Provide a JSON object with query options via --file or --body."));
|
|
45403
45954
|
if (parseError) {
|
|
45404
|
-
|
|
45405
|
-
Result: RESULTS.Failure,
|
|
45406
|
-
Message: "Error parsing query options",
|
|
45407
|
-
Instructions: parseError.message
|
|
45408
|
-
});
|
|
45409
|
-
processContext.exit(1);
|
|
45410
|
-
return;
|
|
45955
|
+
return fail("Error parsing query options", parseError.message);
|
|
45411
45956
|
}
|
|
45412
45957
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
45413
|
-
|
|
45414
|
-
Result: RESULTS.Failure,
|
|
45415
|
-
Message: "Query options must be a JSON object",
|
|
45416
|
-
Instructions: "Provide a JSON object (not an array) with filterGroup, selectedFields, sortOptions, aggregates, or groupBy."
|
|
45417
|
-
});
|
|
45418
|
-
processContext.exit(1);
|
|
45419
|
-
return;
|
|
45958
|
+
return fail("Query options must be a JSON object", "Provide a JSON object (not an array) with filterGroup, selectedFields, sortOptions, aggregates, or groupBy.");
|
|
45420
45959
|
}
|
|
45421
45960
|
queryBody = parsed;
|
|
45422
45961
|
}
|
|
45423
|
-
const
|
|
45424
|
-
if (
|
|
45425
|
-
OutputFormatter.error({
|
|
45426
|
-
Result: RESULTS.Failure,
|
|
45427
|
-
Message: "Error connecting to Data Fabric",
|
|
45428
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45429
|
-
});
|
|
45430
|
-
processContext.exit(1);
|
|
45962
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45963
|
+
if (!sdk)
|
|
45431
45964
|
return;
|
|
45432
|
-
}
|
|
45433
45965
|
const [queryError, result] = await catchError(sdk.entities.queryRecordsById(entityId, {
|
|
45434
45966
|
...queryBody !== null && queryBody,
|
|
45435
45967
|
pageSize,
|
|
@@ -45439,77 +45971,31 @@ var registerRecordsCommand = (program2) => {
|
|
|
45439
45971
|
...jumpToPage !== undefined && { jumpToPage }
|
|
45440
45972
|
}));
|
|
45441
45973
|
if (queryError) {
|
|
45442
|
-
|
|
45443
|
-
Result: RESULTS.Failure,
|
|
45444
|
-
Message: "Error querying records",
|
|
45445
|
-
Instructions: await extractErrorMessage(queryError)
|
|
45446
|
-
});
|
|
45447
|
-
processContext.exit(1);
|
|
45448
|
-
return;
|
|
45974
|
+
return fail("Error querying records", await extractErrorMessage(queryError));
|
|
45449
45975
|
}
|
|
45450
|
-
const r = result;
|
|
45451
|
-
const nextCursor = extractCursorValue(r.nextCursor);
|
|
45452
45976
|
OutputFormatter.success({
|
|
45453
45977
|
Result: RESULTS.Success,
|
|
45454
45978
|
Code: "RecordQuery",
|
|
45455
|
-
Data:
|
|
45456
|
-
TotalCount: r.totalCount ?? r.items.length,
|
|
45457
|
-
Records: r.items,
|
|
45458
|
-
HasNextPage: r.hasNextPage ?? false,
|
|
45459
|
-
...nextCursor !== undefined && {
|
|
45460
|
-
NextCursor: nextCursor
|
|
45461
|
-
},
|
|
45462
|
-
...r.currentPage !== undefined && {
|
|
45463
|
-
CurrentPage: r.currentPage
|
|
45464
|
-
},
|
|
45465
|
-
...r.totalPages !== undefined && {
|
|
45466
|
-
TotalPages: r.totalPages
|
|
45467
|
-
}
|
|
45468
|
-
}
|
|
45979
|
+
Data: result
|
|
45469
45980
|
});
|
|
45470
45981
|
});
|
|
45471
45982
|
records.command("import").description("Import records from a CSV file into a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to the CSV file to import").trackedAction(processContext, async (entityId, options) => {
|
|
45472
45983
|
if (options.file === undefined) {
|
|
45473
|
-
|
|
45474
|
-
Result: RESULTS.Failure,
|
|
45475
|
-
Message: "A CSV file path is required",
|
|
45476
|
-
Instructions: "Provide a CSV file path via --file."
|
|
45477
|
-
});
|
|
45478
|
-
processContext.exit(1);
|
|
45479
|
-
return;
|
|
45984
|
+
return fail("A CSV file path is required", "Provide a CSV file path via --file.");
|
|
45480
45985
|
}
|
|
45481
45986
|
const [readError, fileContent] = await catchError(readFileBinary(options.file));
|
|
45482
45987
|
if (readError) {
|
|
45483
|
-
|
|
45484
|
-
Result: RESULTS.Failure,
|
|
45485
|
-
Message: "Error reading CSV file",
|
|
45486
|
-
Instructions: readError.message
|
|
45487
|
-
});
|
|
45488
|
-
processContext.exit(1);
|
|
45489
|
-
return;
|
|
45988
|
+
return fail("Error reading CSV file", readError.message);
|
|
45490
45989
|
}
|
|
45491
|
-
const
|
|
45492
|
-
if (
|
|
45493
|
-
OutputFormatter.error({
|
|
45494
|
-
Result: RESULTS.Failure,
|
|
45495
|
-
Message: "Error connecting to Data Fabric",
|
|
45496
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45497
|
-
});
|
|
45498
|
-
processContext.exit(1);
|
|
45990
|
+
const sdk = await connectOrFail(options.tenant);
|
|
45991
|
+
if (!sdk)
|
|
45499
45992
|
return;
|
|
45500
|
-
}
|
|
45501
45993
|
const fs7 = getFileSystem();
|
|
45502
45994
|
const fileName = fs7.path.basename(options.file) || "import.csv";
|
|
45503
45995
|
const csvFile = new File([fileContent], fileName, { type: "text/csv" });
|
|
45504
45996
|
const [importError, result] = await catchError(sdk.entities.importRecordsById(entityId, csvFile));
|
|
45505
45997
|
if (importError) {
|
|
45506
|
-
|
|
45507
|
-
Result: RESULTS.Failure,
|
|
45508
|
-
Message: "Error importing records",
|
|
45509
|
-
Instructions: await extractErrorMessage(importError)
|
|
45510
|
-
});
|
|
45511
|
-
processContext.exit(1);
|
|
45512
|
-
return;
|
|
45998
|
+
return fail("Error importing records", await extractErrorMessage(importError));
|
|
45513
45999
|
}
|
|
45514
46000
|
const r = result;
|
|
45515
46001
|
OutputFormatter.success({
|
|
@@ -45525,25 +46011,12 @@ var registerRecordsCommand = (program2) => {
|
|
|
45525
46011
|
});
|
|
45526
46012
|
});
|
|
45527
46013
|
records.command("delete").description("Delete records from a Data Fabric entity").argument("<id>", "Entity ID").argument("<key...>", "Record IDs to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(RECORDS_DELETE_EXAMPLES).trackedAction(processContext, async (entityId, recordIds, options) => {
|
|
45528
|
-
const
|
|
45529
|
-
if (
|
|
45530
|
-
OutputFormatter.error({
|
|
45531
|
-
Result: RESULTS.Failure,
|
|
45532
|
-
Message: "Error connecting to Data Fabric",
|
|
45533
|
-
Instructions: await extractErrorMessage(clientError)
|
|
45534
|
-
});
|
|
45535
|
-
processContext.exit(1);
|
|
46014
|
+
const sdk = await connectOrFail(options.tenant);
|
|
46015
|
+
if (!sdk)
|
|
45536
46016
|
return;
|
|
45537
|
-
}
|
|
45538
46017
|
const [deleteError, result] = await catchError(sdk.entities.deleteRecordsById(entityId, recordIds));
|
|
45539
46018
|
if (deleteError) {
|
|
45540
|
-
|
|
45541
|
-
Result: RESULTS.Failure,
|
|
45542
|
-
Message: "Error deleting records",
|
|
45543
|
-
Instructions: await extractErrorMessage(deleteError)
|
|
45544
|
-
});
|
|
45545
|
-
processContext.exit(1);
|
|
45546
|
-
return;
|
|
46019
|
+
return fail("Error deleting records", await extractErrorMessage(deleteError));
|
|
45547
46020
|
}
|
|
45548
46021
|
const r = result;
|
|
45549
46022
|
const failureCount = r.failureRecords?.length ?? 0;
|
|
@@ -45583,6 +46056,7 @@ var registerCommands = async (program2) => {
|
|
|
45583
46056
|
registerRecordsCommand(program2);
|
|
45584
46057
|
registerFilesCommand(program2);
|
|
45585
46058
|
registerChoiceSetsCommand(program2);
|
|
46059
|
+
registerChoiceSetValuesCommand(program2);
|
|
45586
46060
|
};
|
|
45587
46061
|
export {
|
|
45588
46062
|
registerCommands,
|