@uipath/tasks-tool 1.202.0 → 1.202.1-preview.167
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/THIRD-PARTY-NOTICES.md +66 -1
- package/dist/{folder-picker-interactive-m0ntqfw0.js → folder-picker-interactive-gyxze8wq.js} +2 -2
- package/dist/{folder-resolver-xsyrk9rg.js → folder-resolver-66p6b3jy.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/{tool-rxgpwdds.js → tool-ec4nkk5t.js} +1495 -299
- package/dist/{tool-h6cyrz61.js → tool-fqszw775.js} +1 -1
- package/dist/{tool-ym8hmfxt.js → tool-qhy72z2y.js} +1 -1
- package/dist/tool.js +2 -2
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
extractErrorMessageSync,
|
|
10
10
|
getLoginStatusAsync,
|
|
11
11
|
processContext
|
|
12
|
-
} from "./tool-
|
|
12
|
+
} from "./tool-fqszw775.js";
|
|
13
13
|
import {
|
|
14
14
|
require_src
|
|
15
15
|
} from "./tool-bndhpxxj.js";
|
|
@@ -4502,7 +4502,7 @@ var require_src6 = __commonJS(function(exports) {
|
|
|
4502
4502
|
var package_default = {
|
|
4503
4503
|
name: "@uipath/tasks-tool",
|
|
4504
4504
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
4505
|
-
version: "1.202.
|
|
4505
|
+
version: "1.202.1-preview.167",
|
|
4506
4506
|
description: "Manage Action Center tasks.",
|
|
4507
4507
|
publishConfig: {
|
|
4508
4508
|
registry: "https://npm.pkg.github.com/"
|
|
@@ -4531,7 +4531,7 @@ var package_default = {
|
|
|
4531
4531
|
"@uipath/auth": "workspace:*",
|
|
4532
4532
|
"@uipath/common": "workspace:*",
|
|
4533
4533
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
4534
|
-
"@uipath/uipath-typescript": "^1.
|
|
4534
|
+
"@uipath/uipath-typescript": "^1.7.1",
|
|
4535
4535
|
commander: "^14.0.3",
|
|
4536
4536
|
typescript: "^7.0.2"
|
|
4537
4537
|
}
|
|
@@ -4968,7 +4968,7 @@ var allowsEval = cached(() => {
|
|
|
4968
4968
|
return false;
|
|
4969
4969
|
}
|
|
4970
4970
|
});
|
|
4971
|
-
function isPlainObject(o) {
|
|
4971
|
+
function isPlainObject$1(o) {
|
|
4972
4972
|
if (isObject(o) === false)
|
|
4973
4973
|
return false;
|
|
4974
4974
|
const ctor = o.constructor;
|
|
@@ -4985,7 +4985,7 @@ function isPlainObject(o) {
|
|
|
4985
4985
|
return true;
|
|
4986
4986
|
}
|
|
4987
4987
|
function shallowClone(o) {
|
|
4988
|
-
if (isPlainObject(o))
|
|
4988
|
+
if (isPlainObject$1(o))
|
|
4989
4989
|
return { ...o };
|
|
4990
4990
|
if (Array.isArray(o))
|
|
4991
4991
|
return [...o];
|
|
@@ -5073,7 +5073,7 @@ function omit(schema, mask) {
|
|
|
5073
5073
|
return clone(schema, def);
|
|
5074
5074
|
}
|
|
5075
5075
|
function extend(schema, shape) {
|
|
5076
|
-
if (!isPlainObject(shape)) {
|
|
5076
|
+
if (!isPlainObject$1(shape)) {
|
|
5077
5077
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
5078
5078
|
}
|
|
5079
5079
|
const checks = schema._zod.def.checks;
|
|
@@ -5096,7 +5096,7 @@ function extend(schema, shape) {
|
|
|
5096
5096
|
return clone(schema, def);
|
|
5097
5097
|
}
|
|
5098
5098
|
function safeExtend(schema, shape) {
|
|
5099
|
-
if (!isPlainObject(shape)) {
|
|
5099
|
+
if (!isPlainObject$1(shape)) {
|
|
5100
5100
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
5101
5101
|
}
|
|
5102
5102
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -5433,6 +5433,7 @@ var string$1 = (params) => {
|
|
|
5433
5433
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
5434
5434
|
return new RegExp(`^${regex}$`);
|
|
5435
5435
|
};
|
|
5436
|
+
var boolean$1 = /^(?:true|false)$/i;
|
|
5436
5437
|
var lowercase = /^[^A-Z]*$/;
|
|
5437
5438
|
var uppercase = /^[^a-z]*$/;
|
|
5438
5439
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -6101,6 +6102,26 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
6101
6102
|
});
|
|
6102
6103
|
};
|
|
6103
6104
|
});
|
|
6105
|
+
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
6106
|
+
$ZodType.init(inst, def);
|
|
6107
|
+
inst._zod.pattern = boolean$1;
|
|
6108
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
6109
|
+
if (def.coerce)
|
|
6110
|
+
try {
|
|
6111
|
+
payload.value = Boolean(payload.value);
|
|
6112
|
+
} catch (_) {}
|
|
6113
|
+
const input = payload.value;
|
|
6114
|
+
if (typeof input === "boolean")
|
|
6115
|
+
return payload;
|
|
6116
|
+
payload.issues.push({
|
|
6117
|
+
expected: "boolean",
|
|
6118
|
+
code: "invalid_type",
|
|
6119
|
+
input,
|
|
6120
|
+
inst
|
|
6121
|
+
});
|
|
6122
|
+
return payload;
|
|
6123
|
+
};
|
|
6124
|
+
});
|
|
6104
6125
|
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
6105
6126
|
$ZodType.init(inst, def);
|
|
6106
6127
|
inst._zod.parse = (payload) => payload;
|
|
@@ -6471,7 +6492,7 @@ function mergeValues(a, b) {
|
|
|
6471
6492
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
6472
6493
|
return { valid: true, data: a };
|
|
6473
6494
|
}
|
|
6474
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
6495
|
+
if (isPlainObject$1(a) && isPlainObject$1(b)) {
|
|
6475
6496
|
const bKeys = Object.keys(b);
|
|
6476
6497
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
6477
6498
|
const newObj = { ...a, ...b };
|
|
@@ -6826,7 +6847,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
6826
6847
|
payload.issues.push(issue(_iss));
|
|
6827
6848
|
}
|
|
6828
6849
|
}
|
|
6829
|
-
var _a;
|
|
6850
|
+
var _a$1;
|
|
6830
6851
|
|
|
6831
6852
|
class $ZodRegistry {
|
|
6832
6853
|
constructor() {
|
|
@@ -6871,7 +6892,7 @@ class $ZodRegistry {
|
|
|
6871
6892
|
function registry() {
|
|
6872
6893
|
return new $ZodRegistry;
|
|
6873
6894
|
}
|
|
6874
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
6895
|
+
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry());
|
|
6875
6896
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
6876
6897
|
function _string(Class, params) {
|
|
6877
6898
|
return new Class({
|
|
@@ -7116,6 +7137,12 @@ function _isoDuration(Class, params) {
|
|
|
7116
7137
|
...normalizeParams(params)
|
|
7117
7138
|
});
|
|
7118
7139
|
}
|
|
7140
|
+
function _boolean(Class, params) {
|
|
7141
|
+
return new Class({
|
|
7142
|
+
type: "boolean",
|
|
7143
|
+
...normalizeParams(params)
|
|
7144
|
+
});
|
|
7145
|
+
}
|
|
7119
7146
|
function _unknown(Class) {
|
|
7120
7147
|
return new Class({
|
|
7121
7148
|
type: "unknown"
|
|
@@ -7281,7 +7308,7 @@ function initializeContext(params) {
|
|
|
7281
7308
|
};
|
|
7282
7309
|
}
|
|
7283
7310
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
7284
|
-
var
|
|
7311
|
+
var _a;
|
|
7285
7312
|
const def = schema._zod.def;
|
|
7286
7313
|
const seen = ctx.seen.get(schema);
|
|
7287
7314
|
if (seen) {
|
|
@@ -7329,7 +7356,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
7329
7356
|
delete result.schema.default;
|
|
7330
7357
|
}
|
|
7331
7358
|
if (ctx.io === "input" && result.schema._prefault)
|
|
7332
|
-
(
|
|
7359
|
+
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
7333
7360
|
delete result.schema._prefault;
|
|
7334
7361
|
const _result = ctx.seen.get(schema);
|
|
7335
7362
|
return _result.schema;
|
|
@@ -7646,6 +7673,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
7646
7673
|
}
|
|
7647
7674
|
}
|
|
7648
7675
|
};
|
|
7676
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
7677
|
+
json.type = "boolean";
|
|
7678
|
+
};
|
|
7649
7679
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
7650
7680
|
json.not = {};
|
|
7651
7681
|
};
|
|
@@ -8104,6 +8134,14 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
8104
8134
|
$ZodJWT.init(inst, def);
|
|
8105
8135
|
ZodStringFormat.init(inst, def);
|
|
8106
8136
|
});
|
|
8137
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
8138
|
+
$ZodBoolean.init(inst, def);
|
|
8139
|
+
ZodType.init(inst, def);
|
|
8140
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
|
|
8141
|
+
});
|
|
8142
|
+
function boolean(params) {
|
|
8143
|
+
return _boolean(ZodBoolean, params);
|
|
8144
|
+
}
|
|
8107
8145
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
8108
8146
|
$ZodUnknown.init(inst, def);
|
|
8109
8147
|
ZodType.init(inst, def);
|
|
@@ -8414,7 +8452,8 @@ object({
|
|
|
8414
8452
|
secret: string().optional(),
|
|
8415
8453
|
clientId: string().optional(),
|
|
8416
8454
|
redirectUri: string().url().optional(),
|
|
8417
|
-
scope: string().optional()
|
|
8455
|
+
scope: string().optional(),
|
|
8456
|
+
enforceSso: boolean().optional()
|
|
8418
8457
|
});
|
|
8419
8458
|
|
|
8420
8459
|
class UiPathConfig {
|
|
@@ -8426,6 +8465,7 @@ class UiPathConfig {
|
|
|
8426
8465
|
this.clientId = options.clientId;
|
|
8427
8466
|
this.redirectUri = options.redirectUri;
|
|
8428
8467
|
this.scope = options.scope;
|
|
8468
|
+
this.enforceSso = options.enforceSso;
|
|
8429
8469
|
}
|
|
8430
8470
|
}
|
|
8431
8471
|
|
|
@@ -8628,6 +8668,7 @@ var TaskType;
|
|
|
8628
8668
|
TaskType2["DocumentValidation"] = "DocumentValidationTask";
|
|
8629
8669
|
TaskType2["DocumentClassification"] = "DocumentClassificationTask";
|
|
8630
8670
|
TaskType2["DataLabeling"] = "DataLabelingTask";
|
|
8671
|
+
TaskType2["QuickForm"] = "QuickFormTask";
|
|
8631
8672
|
})(TaskType || (TaskType = {}));
|
|
8632
8673
|
var TaskPriority;
|
|
8633
8674
|
(function(TaskPriority2) {
|
|
@@ -8740,7 +8781,11 @@ var PROCESS_ENDPOINTS = {
|
|
|
8740
8781
|
var QUEUE_ENDPOINTS = {
|
|
8741
8782
|
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
8742
8783
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
8743
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})
|
|
8784
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
8785
|
+
GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
|
|
8786
|
+
ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
|
|
8787
|
+
START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
|
|
8788
|
+
SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
|
|
8744
8789
|
};
|
|
8745
8790
|
var JOB_ENDPOINTS = {
|
|
8746
8791
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
@@ -8787,6 +8832,10 @@ var MAESTRO_ENDPOINTS = {
|
|
|
8787
8832
|
TRACES: {
|
|
8788
8833
|
GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
|
|
8789
8834
|
},
|
|
8835
|
+
BUSINESS_APPS: {
|
|
8836
|
+
COLLECTION: `${PIMS_BASE}/api/v1/business-apps`,
|
|
8837
|
+
BY_ID: (businessAppId) => `${PIMS_BASE}/api/v1/business-apps/${businessAppId}`
|
|
8838
|
+
},
|
|
8790
8839
|
CASES: {
|
|
8791
8840
|
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
8792
8841
|
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
@@ -8821,13 +8870,24 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
8821
8870
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
8822
8871
|
UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
|
|
8823
8872
|
DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
|
|
8824
|
-
|
|
8873
|
+
UPDATE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
|
|
8825
8874
|
QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
|
|
8826
8875
|
QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
|
|
8827
8876
|
BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
|
|
8828
8877
|
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
8829
8878
|
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
8830
|
-
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}
|
|
8879
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
8880
|
+
GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/Entity/${entityName}/metadata`,
|
|
8881
|
+
GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/read`,
|
|
8882
|
+
GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v2/EntityService/${entityName}/read/${recordId}`,
|
|
8883
|
+
INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert`,
|
|
8884
|
+
BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert-batch`,
|
|
8885
|
+
UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update/${recordId}`,
|
|
8886
|
+
UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update-batch`,
|
|
8887
|
+
DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete/${recordId}`,
|
|
8888
|
+
DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete-batch`,
|
|
8889
|
+
BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
|
|
8890
|
+
ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
|
|
8831
8891
|
},
|
|
8832
8892
|
CHOICESETS: {
|
|
8833
8893
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -8850,7 +8910,8 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
8850
8910
|
};
|
|
8851
8911
|
var IDENTITY_ENDPOINTS = {
|
|
8852
8912
|
TOKEN: `${IDENTITY_BASE}/connect/token`,
|
|
8853
|
-
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize
|
|
8913
|
+
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
|
|
8914
|
+
END_SESSION: `${IDENTITY_BASE}/connect/endsession`
|
|
8854
8915
|
};
|
|
8855
8916
|
var TASK_TYPE_ENDPOINTS = {
|
|
8856
8917
|
[TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
|
|
@@ -8858,7 +8919,8 @@ var TASK_TYPE_ENDPOINTS = {
|
|
|
8858
8919
|
[TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
8859
8920
|
[TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
8860
8921
|
[TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
8861
|
-
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
8922
|
+
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
8923
|
+
[TaskType.QuickForm]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
8862
8924
|
};
|
|
8863
8925
|
var ActionCenterEventNames;
|
|
8864
8926
|
(function(ActionCenterEventNames2) {
|
|
@@ -8866,29 +8928,12 @@ var ActionCenterEventNames;
|
|
|
8866
8928
|
ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
|
|
8867
8929
|
})(ActionCenterEventNames || (ActionCenterEventNames = {}));
|
|
8868
8930
|
var AUTHENTICATION_TIMEOUT = 8000;
|
|
8869
|
-
var ALLOWED_HOST_ORIGINS = new Set([
|
|
8870
|
-
"https://alpha.uipath.com",
|
|
8871
|
-
"https://staging.uipath.com",
|
|
8872
|
-
"https://cloud.uipath.com"
|
|
8873
|
-
]);
|
|
8874
|
-
function isValidHostOrigin(origin) {
|
|
8875
|
-
if (!origin)
|
|
8876
|
-
return false;
|
|
8877
|
-
if (ALLOWED_HOST_ORIGINS.has(origin))
|
|
8878
|
-
return true;
|
|
8879
|
-
try {
|
|
8880
|
-
return new URL(origin).hostname === "localhost";
|
|
8881
|
-
} catch {
|
|
8882
|
-
console.warn("isValidHostOrigin: received a malformed origin URL", origin);
|
|
8883
|
-
return false;
|
|
8884
|
-
}
|
|
8885
|
-
}
|
|
8886
8931
|
function isTokenExpired(tokenInfo) {
|
|
8887
8932
|
if (!tokenInfo?.expiresAt)
|
|
8888
8933
|
return true;
|
|
8889
8934
|
return new Date >= tokenInfo.expiresAt;
|
|
8890
8935
|
}
|
|
8891
|
-
var
|
|
8936
|
+
var hostEmbeddingOrigin = isHostEmbedded && embeddingOrigin ? embeddingOrigin : null;
|
|
8892
8937
|
function waitForMessage(filter, signal) {
|
|
8893
8938
|
return new Promise((resolve, reject) => {
|
|
8894
8939
|
const handler = (event) => {
|
|
@@ -8957,12 +9002,6 @@ class ActionCenterTokenManager {
|
|
|
8957
9002
|
statusCode: HttpStatus.UNAUTHORIZED
|
|
8958
9003
|
}));
|
|
8959
9004
|
}
|
|
8960
|
-
if (!isValidHostOrigin(parentOrigin)) {
|
|
8961
|
-
return Promise.reject(new AuthenticationError({
|
|
8962
|
-
message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
|
|
8963
|
-
statusCode: HttpStatus.UNAUTHORIZED
|
|
8964
|
-
}));
|
|
8965
|
-
}
|
|
8966
9005
|
const { promise } = requestHostToken({
|
|
8967
9006
|
pinnedOrigin: parentOrigin,
|
|
8968
9007
|
sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
|
|
@@ -8986,7 +9025,7 @@ class ActionCenterTokenManager {
|
|
|
8986
9025
|
}
|
|
8987
9026
|
}
|
|
8988
9027
|
sendMessageToParent(eventType, content) {
|
|
8989
|
-
if (window.parent &&
|
|
9028
|
+
if (window.parent && this.parentOrigin) {
|
|
8990
9029
|
try {
|
|
8991
9030
|
window.parent.postMessage({ eventType, content }, this.parentOrigin);
|
|
8992
9031
|
} catch (error) {
|
|
@@ -9066,7 +9105,7 @@ class EmbeddedTokenManager {
|
|
|
9066
9105
|
this.cancelRefresh?.();
|
|
9067
9106
|
}
|
|
9068
9107
|
}
|
|
9069
|
-
var SDK_VERSION = "1.
|
|
9108
|
+
var SDK_VERSION = "1.7.1";
|
|
9070
9109
|
var CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
9071
9110
|
var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
9072
9111
|
var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
@@ -9132,19 +9171,21 @@ function base64UrlToBase64(value) {
|
|
|
9132
9171
|
const base642 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
|
|
9133
9172
|
return base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "=");
|
|
9134
9173
|
}
|
|
9135
|
-
function
|
|
9174
|
+
function decodeJwtClaims(token) {
|
|
9136
9175
|
try {
|
|
9137
|
-
const payload = token
|
|
9176
|
+
const payload = token?.split(".")[1];
|
|
9138
9177
|
if (!payload) {
|
|
9139
|
-
return
|
|
9178
|
+
return;
|
|
9140
9179
|
}
|
|
9141
|
-
|
|
9142
|
-
const sub = claims["sub"];
|
|
9143
|
-
return typeof sub === "string" && sub ? sub : "";
|
|
9180
|
+
return JSON.parse(decodeBase64(base64UrlToBase64(payload)));
|
|
9144
9181
|
} catch {
|
|
9145
|
-
return
|
|
9182
|
+
return;
|
|
9146
9183
|
}
|
|
9147
9184
|
}
|
|
9185
|
+
function extractUserIdFromToken(token) {
|
|
9186
|
+
const sub = decodeJwtClaims(token)?.["sub"];
|
|
9187
|
+
return typeof sub === "string" && sub ? sub : "";
|
|
9188
|
+
}
|
|
9148
9189
|
|
|
9149
9190
|
class TokenManager {
|
|
9150
9191
|
constructor(executionContext, config2, isOAuth = false) {
|
|
@@ -9157,8 +9198,8 @@ class TokenManager {
|
|
|
9157
9198
|
if (isInActionCenter) {
|
|
9158
9199
|
this.actionCenterTokenManager = new ActionCenterTokenManager(config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
9159
9200
|
this.isOAuth = false;
|
|
9160
|
-
} else if (
|
|
9161
|
-
this.embeddedTokenManager = new EmbeddedTokenManager(
|
|
9201
|
+
} else if (hostEmbeddingOrigin) {
|
|
9202
|
+
this.embeddedTokenManager = new EmbeddedTokenManager(hostEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
9162
9203
|
this.isOAuth = false;
|
|
9163
9204
|
}
|
|
9164
9205
|
}
|
|
@@ -9269,6 +9310,9 @@ class TokenManager {
|
|
|
9269
9310
|
getToken() {
|
|
9270
9311
|
return this.currentToken?.token;
|
|
9271
9312
|
}
|
|
9313
|
+
getIdToken() {
|
|
9314
|
+
return this.currentToken?.idToken;
|
|
9315
|
+
}
|
|
9272
9316
|
hasValidToken() {
|
|
9273
9317
|
if (!this.currentToken) {
|
|
9274
9318
|
return false;
|
|
@@ -9340,11 +9384,13 @@ class TokenManager {
|
|
|
9340
9384
|
token: token.access_token,
|
|
9341
9385
|
type: "oauth",
|
|
9342
9386
|
expiresAt: new Date(Date.now() + token.expires_in * 1000),
|
|
9343
|
-
refreshToken: token.refresh_token
|
|
9387
|
+
refreshToken: token.refresh_token,
|
|
9388
|
+
idToken: token.id_token ?? tokenInfo.idToken
|
|
9344
9389
|
});
|
|
9345
9390
|
return token;
|
|
9346
9391
|
}
|
|
9347
9392
|
}
|
|
9393
|
+
var GUID_REGEX$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9348
9394
|
|
|
9349
9395
|
class AuthService {
|
|
9350
9396
|
constructor(config2, executionContext) {
|
|
@@ -9478,7 +9524,11 @@ class AuthService {
|
|
|
9478
9524
|
hasValidToken() {
|
|
9479
9525
|
return this.tokenManager.hasValidToken();
|
|
9480
9526
|
}
|
|
9481
|
-
logout() {
|
|
9527
|
+
logout(options) {
|
|
9528
|
+
const idTokenHint = options?.endSession ? this.tokenManager.getIdToken() : undefined;
|
|
9529
|
+
if (options?.endSession && isBrowser && !idTokenHint) {
|
|
9530
|
+
console.warn("endSession skipped — no OIDC ID token is available for this " + "session. Sign in again to enable it; only local authentication " + "state was cleared.");
|
|
9531
|
+
}
|
|
9482
9532
|
this.tokenManager.clearToken();
|
|
9483
9533
|
if (isBrowser) {
|
|
9484
9534
|
try {
|
|
@@ -9488,6 +9538,12 @@ class AuthService {
|
|
|
9488
9538
|
console.warn("Failed to clear OAuth context from session storage", error);
|
|
9489
9539
|
}
|
|
9490
9540
|
}
|
|
9541
|
+
if (options?.endSession && isBrowser && idTokenHint) {
|
|
9542
|
+
window.location.href = this._buildEndSessionUrl({
|
|
9543
|
+
idTokenHint,
|
|
9544
|
+
postLogoutRedirectUri: this.config.redirectUri
|
|
9545
|
+
});
|
|
9546
|
+
}
|
|
9491
9547
|
}
|
|
9492
9548
|
getToken() {
|
|
9493
9549
|
if (!this.tokenManager.hasValidToken()) {
|
|
@@ -9531,10 +9587,27 @@ class AuthService {
|
|
|
9531
9587
|
redirect_uri: params.redirectUri,
|
|
9532
9588
|
code_challenge: params.codeChallenge,
|
|
9533
9589
|
code_challenge_method: "S256",
|
|
9534
|
-
scope: params.scope + " offline_access",
|
|
9590
|
+
scope: params.scope + " offline_access openid",
|
|
9535
9591
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
9536
9592
|
});
|
|
9537
|
-
|
|
9593
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
9594
|
+
if (!this.config.enforceSso) {
|
|
9595
|
+
return authorizeUrl;
|
|
9596
|
+
}
|
|
9597
|
+
const orgName = this.config.orgName;
|
|
9598
|
+
if (!GUID_REGEX$1.test(orgName)) {
|
|
9599
|
+
console.warn(`[UiPath SDK] enforceSso was ignored: orgName "${orgName}" is not an organization id. ` + "Pass the organization id (GUID) as orgName to sign in through the org's identity provider.");
|
|
9600
|
+
return authorizeUrl;
|
|
9601
|
+
}
|
|
9602
|
+
return `${authorizeUrl}&acr_values=${encodeURIComponent(`tenant:${orgName}`)}`;
|
|
9603
|
+
}
|
|
9604
|
+
_buildEndSessionUrl(params) {
|
|
9605
|
+
const queryParams = new URLSearchParams;
|
|
9606
|
+
queryParams.set("id_token_hint", params.idTokenHint);
|
|
9607
|
+
if (params.postLogoutRedirectUri) {
|
|
9608
|
+
queryParams.set("post_logout_redirect_uri", params.postLogoutRedirectUri);
|
|
9609
|
+
}
|
|
9610
|
+
return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.END_SESSION}?${queryParams.toString()}`;
|
|
9538
9611
|
}
|
|
9539
9612
|
async _getAccessToken(params) {
|
|
9540
9613
|
const body = new URLSearchParams({
|
|
@@ -9561,7 +9634,8 @@ class AuthService {
|
|
|
9561
9634
|
token: token.access_token,
|
|
9562
9635
|
type: "oauth",
|
|
9563
9636
|
expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
|
|
9564
|
-
refreshToken: token.refresh_token
|
|
9637
|
+
refreshToken: token.refresh_token,
|
|
9638
|
+
idToken: token.id_token
|
|
9565
9639
|
});
|
|
9566
9640
|
return token;
|
|
9567
9641
|
}
|
|
@@ -9634,9 +9708,18 @@ function validateConfig(config2) {
|
|
|
9634
9708
|
function isCompleteConfig(config2) {
|
|
9635
9709
|
return hasRequiredBaseFields(config2) && hasValidAuthConfig(config2);
|
|
9636
9710
|
}
|
|
9711
|
+
function compactConfig(config2) {
|
|
9712
|
+
return Object.fromEntries(Object.entries(config2).filter(([, value]) => value !== undefined));
|
|
9713
|
+
}
|
|
9637
9714
|
function normalizeBaseUrl(url) {
|
|
9638
9715
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
9639
9716
|
}
|
|
9717
|
+
function missingConfigMessage() {
|
|
9718
|
+
if (isBrowser) {
|
|
9719
|
+
return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
|
|
9720
|
+
}
|
|
9721
|
+
return "UiPath SDK configuration not found. " + "In a UiPath coded function, pass the handler context: new UiPath(ctx). " + "Otherwise pass { baseUrl, orgName, tenantName, secret }, " + "or set UIPATH_BASE_URL, UIPATH_ORG_NAME, UIPATH_TENANT_NAME and UIPATH_ACCESS_TOKEN.";
|
|
9722
|
+
}
|
|
9640
9723
|
var REGISTRY_KEY2 = Symbol.for("@uipath/sdk-internals-registry");
|
|
9641
9724
|
var getGlobalStore = () => {
|
|
9642
9725
|
const globalObj = globalThis;
|
|
@@ -9645,6 +9728,7 @@ var getGlobalStore = () => {
|
|
|
9645
9728
|
}
|
|
9646
9729
|
return globalObj[REGISTRY_KEY2];
|
|
9647
9730
|
};
|
|
9731
|
+
var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
|
|
9648
9732
|
|
|
9649
9733
|
class SDKInternalsRegistry {
|
|
9650
9734
|
static get store() {
|
|
@@ -9656,6 +9740,9 @@ class SDKInternalsRegistry {
|
|
|
9656
9740
|
static get(instance) {
|
|
9657
9741
|
const internals = this.store.get(instance);
|
|
9658
9742
|
if (!internals) {
|
|
9743
|
+
if (looksLikeUiPath(instance)) {
|
|
9744
|
+
throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
|
|
9745
|
+
}
|
|
9659
9746
|
throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
|
|
9660
9747
|
}
|
|
9661
9748
|
return internals;
|
|
@@ -9673,6 +9760,10 @@ var UiPathMetaTags;
|
|
|
9673
9760
|
UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
|
|
9674
9761
|
UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
|
|
9675
9762
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
9763
|
+
var UiPathElementIds;
|
|
9764
|
+
(function(UiPathElementIds2) {
|
|
9765
|
+
UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
9766
|
+
})(UiPathElementIds || (UiPathElementIds = {}));
|
|
9676
9767
|
function getMetaTagContent(name) {
|
|
9677
9768
|
if (!isBrowser)
|
|
9678
9769
|
return;
|
|
@@ -9693,7 +9784,54 @@ function loadFromMetaTags() {
|
|
|
9693
9784
|
const hasAnyValue = Object.values(config2).some(Boolean);
|
|
9694
9785
|
return hasAnyValue ? config2 : null;
|
|
9695
9786
|
}
|
|
9787
|
+
function readEnv(name) {
|
|
9788
|
+
const globals = globalThis;
|
|
9789
|
+
try {
|
|
9790
|
+
const fromNode = globals.process?.env?.[name];
|
|
9791
|
+
if (fromNode)
|
|
9792
|
+
return fromNode;
|
|
9793
|
+
} catch {}
|
|
9794
|
+
try {
|
|
9795
|
+
const fromDeno = globals.Deno?.env?.get?.(name);
|
|
9796
|
+
if (fromDeno)
|
|
9797
|
+
return fromDeno;
|
|
9798
|
+
} catch {}
|
|
9799
|
+
return;
|
|
9800
|
+
}
|
|
9801
|
+
var UiPathEnvVars = {
|
|
9802
|
+
BASE_URL: "UIPATH_BASE_URL",
|
|
9803
|
+
ORG_NAME: "UIPATH_ORG_NAME",
|
|
9804
|
+
TENANT_NAME: "UIPATH_TENANT_NAME",
|
|
9805
|
+
ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
|
|
9806
|
+
};
|
|
9807
|
+
function loadFromEnvironment() {
|
|
9808
|
+
if (isBrowser)
|
|
9809
|
+
return null;
|
|
9810
|
+
const config2 = {
|
|
9811
|
+
baseUrl: readEnv(UiPathEnvVars.BASE_URL),
|
|
9812
|
+
orgName: readEnv(UiPathEnvVars.ORG_NAME),
|
|
9813
|
+
tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
|
|
9814
|
+
secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
|
|
9815
|
+
};
|
|
9816
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
9817
|
+
}
|
|
9818
|
+
function isFunctionContext(value) {
|
|
9819
|
+
return "platform" in value || "robot" in value;
|
|
9820
|
+
}
|
|
9821
|
+
function configFromFunctionContext(context) {
|
|
9822
|
+
const { platform, robot } = context;
|
|
9823
|
+
if (!platform)
|
|
9824
|
+
return null;
|
|
9825
|
+
const config2 = {
|
|
9826
|
+
baseUrl: platform.baseUrl,
|
|
9827
|
+
orgName: platform.orgId,
|
|
9828
|
+
tenantName: platform.tenantId,
|
|
9829
|
+
secret: robot?.accessToken ?? undefined
|
|
9830
|
+
};
|
|
9831
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
9832
|
+
}
|
|
9696
9833
|
var _UiPath_instances;
|
|
9834
|
+
var _a;
|
|
9697
9835
|
var _UiPath_config;
|
|
9698
9836
|
var _UiPath_authService;
|
|
9699
9837
|
var _UiPath_initialized;
|
|
@@ -9702,6 +9840,7 @@ var _UiPath_metaFolderKey;
|
|
|
9702
9840
|
var _UiPath_metaOrgId;
|
|
9703
9841
|
var _UiPath_metaTenantId;
|
|
9704
9842
|
var _UiPath_initializeWithConfig;
|
|
9843
|
+
var _UiPath_mergeConfigSources;
|
|
9705
9844
|
var _UiPath_loadConfig;
|
|
9706
9845
|
var UiPath$1 = class UiPath {
|
|
9707
9846
|
constructor(config2) {
|
|
@@ -9713,15 +9852,16 @@ var UiPath$1 = class UiPath {
|
|
|
9713
9852
|
_UiPath_metaFolderKey.set(this, undefined);
|
|
9714
9853
|
_UiPath_metaOrgId.set(this, undefined);
|
|
9715
9854
|
_UiPath_metaTenantId.set(this, undefined);
|
|
9855
|
+
const resolved = config2 && isFunctionContext(config2) ? configFromFunctionContext(config2) ?? undefined : config2;
|
|
9716
9856
|
const configFromMetaTags = loadFromMetaTags();
|
|
9717
9857
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
9718
9858
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
|
|
9719
9859
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
|
|
9720
|
-
const mergedConfig =
|
|
9860
|
+
const mergedConfig = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, configFromMetaTags, resolved);
|
|
9721
9861
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
9722
9862
|
__classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
|
|
9723
|
-
} else if (
|
|
9724
|
-
__classPrivateFieldSet(this, _UiPath_partialConfig,
|
|
9863
|
+
} else if (resolved) {
|
|
9864
|
+
__classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
|
|
9725
9865
|
}
|
|
9726
9866
|
}
|
|
9727
9867
|
async initialize() {
|
|
@@ -9786,18 +9926,18 @@ var UiPath$1 = class UiPath {
|
|
|
9786
9926
|
destroy() {
|
|
9787
9927
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
|
|
9788
9928
|
}
|
|
9789
|
-
logout() {
|
|
9929
|
+
logout(options) {
|
|
9790
9930
|
if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
|
|
9791
9931
|
return;
|
|
9792
9932
|
}
|
|
9793
|
-
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
|
|
9933
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout(options);
|
|
9794
9934
|
__classPrivateFieldSet(this, _UiPath_initialized, false, "f");
|
|
9795
9935
|
}
|
|
9796
9936
|
updateToken(tokenInfo) {
|
|
9797
9937
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
9798
9938
|
}
|
|
9799
9939
|
};
|
|
9800
|
-
_UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
|
|
9940
|
+
_a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
|
|
9801
9941
|
validateConfig(config2);
|
|
9802
9942
|
const hasSecretAuth = hasSecretConfig(config2);
|
|
9803
9943
|
const hasOAuthAuth = hasOAuthConfig(config2);
|
|
@@ -9808,7 +9948,8 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
9808
9948
|
secret: hasSecretAuth ? config2.secret : undefined,
|
|
9809
9949
|
clientId: hasOAuthAuth ? config2.clientId : undefined,
|
|
9810
9950
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined,
|
|
9811
|
-
scope: hasOAuthAuth ? config2.scope : undefined
|
|
9951
|
+
scope: hasOAuthAuth ? config2.scope : undefined,
|
|
9952
|
+
enforceSso: config2.enforceSso
|
|
9812
9953
|
});
|
|
9813
9954
|
const executionContext = new ExecutionContext;
|
|
9814
9955
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -9834,18 +9975,35 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
9834
9975
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined
|
|
9835
9976
|
});
|
|
9836
9977
|
trackEvent("Sdk.Auth");
|
|
9837
|
-
if (hasSecretAuth || isInActionCenter ||
|
|
9978
|
+
if (hasSecretAuth || isInActionCenter || hostEmbeddingOrigin) {
|
|
9838
9979
|
__classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config2.secret ?? "");
|
|
9839
9980
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
9840
9981
|
}
|
|
9982
|
+
}, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config2) {
|
|
9983
|
+
const layers = [loadFromEnvironment(), metaConfig, config2].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
|
|
9984
|
+
if (layers.length === 0)
|
|
9985
|
+
return;
|
|
9986
|
+
const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
|
|
9987
|
+
const namesSecret = config2 ? hasSecretConfig(config2) : false;
|
|
9988
|
+
const namesOAuth = Boolean(config2?.clientId || config2?.redirectUri || config2?.scope);
|
|
9989
|
+
if (namesSecret !== namesOAuth) {
|
|
9990
|
+
if (namesSecret) {
|
|
9991
|
+
delete merged.clientId;
|
|
9992
|
+
delete merged.redirectUri;
|
|
9993
|
+
delete merged.scope;
|
|
9994
|
+
} else {
|
|
9995
|
+
delete merged.secret;
|
|
9996
|
+
}
|
|
9997
|
+
}
|
|
9998
|
+
return merged;
|
|
9841
9999
|
}, _UiPath_loadConfig = function _UiPath_loadConfig2() {
|
|
9842
10000
|
const metaConfig = loadFromMetaTags();
|
|
9843
10001
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
9844
10002
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
|
|
9845
10003
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
|
|
9846
|
-
const merged =
|
|
9847
|
-
if (!isCompleteConfig(merged)) {
|
|
9848
|
-
throw new Error(
|
|
10004
|
+
const merged = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
|
|
10005
|
+
if (!merged || !isCompleteConfig(merged)) {
|
|
10006
|
+
throw new Error(missingConfigMessage());
|
|
9849
10007
|
}
|
|
9850
10008
|
return merged;
|
|
9851
10009
|
};
|
|
@@ -10023,8 +10181,177 @@ var RESPONSE_TYPES = {
|
|
|
10023
10181
|
JSON: "json",
|
|
10024
10182
|
TEXT: "text",
|
|
10025
10183
|
BLOB: "blob",
|
|
10026
|
-
ARRAYBUFFER: "arraybuffer"
|
|
10184
|
+
ARRAYBUFFER: "arraybuffer",
|
|
10185
|
+
STREAM: "stream"
|
|
10186
|
+
};
|
|
10187
|
+
function createParams(paramsObj = {}) {
|
|
10188
|
+
const params = {};
|
|
10189
|
+
for (const [key, value] of Object.entries(paramsObj)) {
|
|
10190
|
+
if (value !== undefined && value !== null) {
|
|
10191
|
+
params[key] = value;
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
return params;
|
|
10195
|
+
}
|
|
10196
|
+
function toSearchParams(params) {
|
|
10197
|
+
const searchParams = new URLSearchParams;
|
|
10198
|
+
if (!params)
|
|
10199
|
+
return searchParams;
|
|
10200
|
+
for (const [key, value] of Object.entries(params)) {
|
|
10201
|
+
if (value === undefined || value === null)
|
|
10202
|
+
continue;
|
|
10203
|
+
if (Array.isArray(value)) {
|
|
10204
|
+
value.forEach((item) => {
|
|
10205
|
+
if (item !== undefined && item !== null)
|
|
10206
|
+
searchParams.append(key, String(item));
|
|
10207
|
+
});
|
|
10208
|
+
} else {
|
|
10209
|
+
searchParams.append(key, String(value));
|
|
10210
|
+
}
|
|
10211
|
+
}
|
|
10212
|
+
return searchParams;
|
|
10213
|
+
}
|
|
10214
|
+
var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
|
|
10215
|
+
var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
|
|
10216
|
+
var DEFAULT_RETRY_OPTIONS = {
|
|
10217
|
+
maxRetries: 2,
|
|
10218
|
+
initialDelayMs: 500,
|
|
10219
|
+
backoffStrategy: "exponential",
|
|
10220
|
+
backoffFactor: 2,
|
|
10221
|
+
backoffMaxDelayMs: 30000,
|
|
10222
|
+
retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
|
|
10223
|
+
retryMethods: DEFAULT_RETRY_METHODS,
|
|
10224
|
+
retryNetworkErrors: true,
|
|
10225
|
+
respectRetryAfter: true,
|
|
10226
|
+
maxRetryAfterMs: Infinity
|
|
10027
10227
|
};
|
|
10228
|
+
var DEFAULT_API_CLIENT_RETRY = {
|
|
10229
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
10230
|
+
maxRetries: 0
|
|
10231
|
+
};
|
|
10232
|
+
function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
|
|
10233
|
+
if (!settings)
|
|
10234
|
+
return defaults;
|
|
10235
|
+
const { retryDelay, useExponentialBackoff, ...live } = settings;
|
|
10236
|
+
const resolved = { ...defaults };
|
|
10237
|
+
for (const [key, value] of Object.entries(live)) {
|
|
10238
|
+
if (value !== undefined) {
|
|
10239
|
+
resolved[key] = value;
|
|
10240
|
+
}
|
|
10241
|
+
}
|
|
10242
|
+
if (retryDelay !== undefined && live.initialDelayMs === undefined) {
|
|
10243
|
+
resolved.initialDelayMs = retryDelay;
|
|
10244
|
+
}
|
|
10245
|
+
if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
|
|
10246
|
+
resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
|
|
10247
|
+
}
|
|
10248
|
+
return resolved;
|
|
10249
|
+
}
|
|
10250
|
+
function computeBackoffDelay(attempt, settings) {
|
|
10251
|
+
const base = Math.max(0, settings.initialDelayMs);
|
|
10252
|
+
let delay;
|
|
10253
|
+
switch (settings.backoffStrategy) {
|
|
10254
|
+
case "constant":
|
|
10255
|
+
delay = base;
|
|
10256
|
+
break;
|
|
10257
|
+
case "linear":
|
|
10258
|
+
delay = base * (attempt + 1);
|
|
10259
|
+
break;
|
|
10260
|
+
default:
|
|
10261
|
+
delay = base * Math.pow(settings.backoffFactor, attempt);
|
|
10262
|
+
}
|
|
10263
|
+
return Math.min(delay, settings.backoffMaxDelayMs);
|
|
10264
|
+
}
|
|
10265
|
+
function parseRetryAfter(value, now = Date.now()) {
|
|
10266
|
+
const trimmed = value?.trim();
|
|
10267
|
+
if (!trimmed)
|
|
10268
|
+
return;
|
|
10269
|
+
const seconds = Number(trimmed);
|
|
10270
|
+
if (Number.isFinite(seconds))
|
|
10271
|
+
return Math.max(0, seconds * 1000);
|
|
10272
|
+
const date2 = Date.parse(trimmed);
|
|
10273
|
+
if (Number.isNaN(date2))
|
|
10274
|
+
return;
|
|
10275
|
+
return Math.max(0, date2 - now);
|
|
10276
|
+
}
|
|
10277
|
+
function wait(durationMs) {
|
|
10278
|
+
return new Promise((resolve) => setTimeout(resolve, Math.max(0, durationMs)));
|
|
10279
|
+
}
|
|
10280
|
+
var RETRY_AFTER = "retry-after";
|
|
10281
|
+
function createAttemptSignal(timeoutMs, external) {
|
|
10282
|
+
if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
|
|
10283
|
+
return { signal: external, dispose: () => {} };
|
|
10284
|
+
const controller = new AbortController;
|
|
10285
|
+
const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
10286
|
+
const onExternalAbort = () => controller.abort(external?.reason);
|
|
10287
|
+
if (external) {
|
|
10288
|
+
if (external.aborted) {
|
|
10289
|
+
controller.abort(external.reason);
|
|
10290
|
+
} else {
|
|
10291
|
+
external.addEventListener("abort", onExternalAbort);
|
|
10292
|
+
}
|
|
10293
|
+
}
|
|
10294
|
+
return {
|
|
10295
|
+
signal: controller.signal,
|
|
10296
|
+
dispose: () => {
|
|
10297
|
+
clearTimeout(timer);
|
|
10298
|
+
external?.removeEventListener("abort", onExternalAbort);
|
|
10299
|
+
}
|
|
10300
|
+
};
|
|
10301
|
+
}
|
|
10302
|
+
function delayBeforeRetry(durationMs, signal) {
|
|
10303
|
+
if (!signal)
|
|
10304
|
+
return wait(durationMs);
|
|
10305
|
+
if (signal.aborted)
|
|
10306
|
+
return Promise.reject(signal.reason);
|
|
10307
|
+
return new Promise((resolve, reject) => {
|
|
10308
|
+
const onAbort = () => {
|
|
10309
|
+
clearTimeout(timer);
|
|
10310
|
+
reject(signal.reason);
|
|
10311
|
+
};
|
|
10312
|
+
const timer = setTimeout(() => {
|
|
10313
|
+
signal.removeEventListener("abort", onAbort);
|
|
10314
|
+
resolve();
|
|
10315
|
+
}, Math.max(0, durationMs));
|
|
10316
|
+
signal.addEventListener("abort", onAbort);
|
|
10317
|
+
});
|
|
10318
|
+
}
|
|
10319
|
+
async function fetchWithRetry(url, init, options) {
|
|
10320
|
+
const settings = options.retry;
|
|
10321
|
+
const method = (init.method ?? "GET").toUpperCase();
|
|
10322
|
+
const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
|
|
10323
|
+
let attempt = 0;
|
|
10324
|
+
for (;; ) {
|
|
10325
|
+
const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
|
|
10326
|
+
let response;
|
|
10327
|
+
let failure;
|
|
10328
|
+
try {
|
|
10329
|
+
response = await fetch(url, { ...init, signal });
|
|
10330
|
+
} catch (error) {
|
|
10331
|
+
failure = error;
|
|
10332
|
+
} finally {
|
|
10333
|
+
dispose();
|
|
10334
|
+
}
|
|
10335
|
+
if (options.signal?.aborted && failure !== undefined)
|
|
10336
|
+
throw failure;
|
|
10337
|
+
if (response && !settings.retryableStatusCodes.includes(response.status))
|
|
10338
|
+
return response;
|
|
10339
|
+
if (failure !== undefined && !settings.retryNetworkErrors)
|
|
10340
|
+
throw failure;
|
|
10341
|
+
if (attempt >= retriesAllowed) {
|
|
10342
|
+
if (response)
|
|
10343
|
+
return response;
|
|
10344
|
+
throw failure;
|
|
10345
|
+
}
|
|
10346
|
+
const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
|
|
10347
|
+
const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
|
|
10348
|
+
response?.body?.cancel().catch((error) => {
|
|
10349
|
+
console.warn("[UiPath SDK] Could not release a discarded response body:", error);
|
|
10350
|
+
});
|
|
10351
|
+
await delayBeforeRetry(delay, options.signal);
|
|
10352
|
+
attempt++;
|
|
10353
|
+
}
|
|
10354
|
+
}
|
|
10028
10355
|
|
|
10029
10356
|
class ApiClient {
|
|
10030
10357
|
constructor(config2, executionContext, tokenManager, clientConfig = {}) {
|
|
@@ -10059,28 +10386,16 @@ class ApiClient {
|
|
|
10059
10386
|
[UIPATH_TRACEPARENT_ID]: traceparentValue,
|
|
10060
10387
|
...options.headers
|
|
10061
10388
|
};
|
|
10062
|
-
const searchParams =
|
|
10063
|
-
if (options.params) {
|
|
10064
|
-
Object.entries(options.params).forEach(([key, value]) => {
|
|
10065
|
-
if (Array.isArray(value)) {
|
|
10066
|
-
value.forEach((item) => searchParams.append(key, String(item)));
|
|
10067
|
-
} else {
|
|
10068
|
-
searchParams.append(key, String(value));
|
|
10069
|
-
}
|
|
10070
|
-
});
|
|
10071
|
-
}
|
|
10389
|
+
const searchParams = toSearchParams(options.params);
|
|
10072
10390
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
10073
10391
|
let body = undefined;
|
|
10074
10392
|
if (options.body) {
|
|
10075
10393
|
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
10076
10394
|
}
|
|
10395
|
+
const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
|
|
10396
|
+
const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
|
|
10077
10397
|
try {
|
|
10078
|
-
const response = await
|
|
10079
|
-
method,
|
|
10080
|
-
headers,
|
|
10081
|
-
body,
|
|
10082
|
-
signal: options.signal
|
|
10083
|
-
});
|
|
10398
|
+
const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
|
|
10084
10399
|
if (!response.ok) {
|
|
10085
10400
|
const errorInfo = await errorResponseParser.parse(response);
|
|
10086
10401
|
throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
|
|
@@ -10796,36 +11111,36 @@ function createEntityMethods(entityData, service) {
|
|
|
10796
11111
|
async insertRecord(data, options) {
|
|
10797
11112
|
if (!entityData.id)
|
|
10798
11113
|
throw new Error("Entity ID is undefined");
|
|
10799
|
-
return service.
|
|
11114
|
+
return service.insertRecord({ id: entityData.id }, data, options);
|
|
10800
11115
|
},
|
|
10801
11116
|
async insertRecords(data, options) {
|
|
10802
11117
|
if (!entityData.id)
|
|
10803
11118
|
throw new Error("Entity ID is undefined");
|
|
10804
|
-
return service.
|
|
11119
|
+
return service.insertRecords({ id: entityData.id }, data, options);
|
|
10805
11120
|
},
|
|
10806
11121
|
async updateRecord(recordId, data, options) {
|
|
10807
11122
|
if (!entityData.id)
|
|
10808
11123
|
throw new Error("Entity ID is undefined");
|
|
10809
11124
|
if (!recordId)
|
|
10810
11125
|
throw new Error("Record ID is undefined");
|
|
10811
|
-
return service.
|
|
11126
|
+
return service.updateRecord({ id: entityData.id }, recordId, data, options);
|
|
10812
11127
|
},
|
|
10813
11128
|
async updateRecords(data, options) {
|
|
10814
11129
|
if (!entityData.id)
|
|
10815
11130
|
throw new Error("Entity ID is undefined");
|
|
10816
|
-
return service.
|
|
11131
|
+
return service.updateRecords({ id: entityData.id }, data, options);
|
|
10817
11132
|
},
|
|
10818
11133
|
async deleteRecords(recordIds, options) {
|
|
10819
11134
|
if (!entityData.id)
|
|
10820
11135
|
throw new Error("Entity ID is undefined");
|
|
10821
|
-
return service.
|
|
11136
|
+
return service.deleteRecords({ id: entityData.id }, recordIds, options);
|
|
10822
11137
|
},
|
|
10823
11138
|
async deleteRecord(recordId, options) {
|
|
10824
11139
|
if (!entityData.id)
|
|
10825
11140
|
throw new Error("Entity ID is undefined");
|
|
10826
11141
|
if (!recordId)
|
|
10827
11142
|
throw new Error("Record ID is undefined");
|
|
10828
|
-
return service.
|
|
11143
|
+
return service.deleteRecord({ id: entityData.id }, recordId, options);
|
|
10829
11144
|
},
|
|
10830
11145
|
async getAllRecords(options) {
|
|
10831
11146
|
if (!entityData.id)
|
|
@@ -10842,27 +11157,27 @@ function createEntityMethods(entityData, service) {
|
|
|
10842
11157
|
async downloadAttachment(recordId, fieldName, options) {
|
|
10843
11158
|
if (!entityData.id)
|
|
10844
11159
|
throw new Error("Entity ID is undefined");
|
|
10845
|
-
return service.downloadAttachment(entityData.id, recordId, fieldName, options);
|
|
11160
|
+
return service.downloadAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
10846
11161
|
},
|
|
10847
11162
|
async uploadAttachment(recordId, fieldName, file, options) {
|
|
10848
11163
|
if (!entityData.id)
|
|
10849
11164
|
throw new Error("Entity ID is undefined");
|
|
10850
|
-
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
11165
|
+
return service.uploadAttachment({ id: entityData.id }, recordId, fieldName, file, options);
|
|
10851
11166
|
},
|
|
10852
11167
|
async deleteAttachment(recordId, fieldName, options) {
|
|
10853
11168
|
if (!entityData.id)
|
|
10854
11169
|
throw new Error("Entity ID is undefined");
|
|
10855
|
-
return service.deleteAttachment(entityData.id, recordId, fieldName, options);
|
|
11170
|
+
return service.deleteAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
10856
11171
|
},
|
|
10857
11172
|
async queryRecords(options) {
|
|
10858
11173
|
if (!entityData.id)
|
|
10859
11174
|
throw new Error("Entity ID is undefined");
|
|
10860
|
-
return service.
|
|
11175
|
+
return service.queryRecords({ id: entityData.id }, options);
|
|
10861
11176
|
},
|
|
10862
11177
|
async importRecords(file, options) {
|
|
10863
11178
|
if (!entityData.id)
|
|
10864
11179
|
throw new Error("Entity ID is undefined");
|
|
10865
|
-
return service.
|
|
11180
|
+
return service.importRecords({ id: entityData.id }, file, options);
|
|
10866
11181
|
},
|
|
10867
11182
|
async insert(data, options) {
|
|
10868
11183
|
return this.insertRecord(data, options);
|
|
@@ -10938,6 +11253,15 @@ var EntityAggregateFunction;
|
|
|
10938
11253
|
EntityAggregateFunction2["Min"] = "MIN";
|
|
10939
11254
|
EntityAggregateFunction2["Max"] = "MAX";
|
|
10940
11255
|
})(EntityAggregateFunction || (EntityAggregateFunction = {}));
|
|
11256
|
+
var EntityHavingOperator;
|
|
11257
|
+
(function(EntityHavingOperator2) {
|
|
11258
|
+
EntityHavingOperator2["Equals"] = "=";
|
|
11259
|
+
EntityHavingOperator2["NotEquals"] = "!=";
|
|
11260
|
+
EntityHavingOperator2["GreaterThan"] = ">";
|
|
11261
|
+
EntityHavingOperator2["GreaterThanOrEqual"] = ">=";
|
|
11262
|
+
EntityHavingOperator2["LessThan"] = "<";
|
|
11263
|
+
EntityHavingOperator2["LessThanOrEqual"] = "<=";
|
|
11264
|
+
})(EntityHavingOperator || (EntityHavingOperator = {}));
|
|
10941
11265
|
var EntityType;
|
|
10942
11266
|
(function(EntityType2) {
|
|
10943
11267
|
EntityType2["Entity"] = "Entity";
|
|
@@ -10968,15 +11292,6 @@ var JoinType;
|
|
|
10968
11292
|
JoinType2["LeftJoin"] = "LeftJoin";
|
|
10969
11293
|
JoinType2["InnerJoin"] = "InnerJoin";
|
|
10970
11294
|
})(JoinType || (JoinType = {}));
|
|
10971
|
-
function createParams(paramsObj = {}) {
|
|
10972
|
-
const params = {};
|
|
10973
|
-
for (const [key, value] of Object.entries(paramsObj)) {
|
|
10974
|
-
if (value !== undefined && value !== null) {
|
|
10975
|
-
params[key] = value;
|
|
10976
|
-
}
|
|
10977
|
-
}
|
|
10978
|
-
return params;
|
|
10979
|
-
}
|
|
10980
11295
|
var EntityFieldConstraint;
|
|
10981
11296
|
(function(EntityFieldConstraint2) {
|
|
10982
11297
|
EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
|
|
@@ -11115,95 +11430,84 @@ function toWireJoin(join, baseEntityName) {
|
|
|
11115
11430
|
}
|
|
11116
11431
|
};
|
|
11117
11432
|
}
|
|
11433
|
+
function unwrapEntityRef(entityRef, callerLabel) {
|
|
11434
|
+
const { id, name } = entityRef ?? {};
|
|
11435
|
+
if (id && name) {
|
|
11436
|
+
throw new ValidationError({
|
|
11437
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name', not both.`
|
|
11438
|
+
});
|
|
11439
|
+
}
|
|
11440
|
+
if (id) {
|
|
11441
|
+
return { byId: true, identifier: id };
|
|
11442
|
+
}
|
|
11443
|
+
if (name) {
|
|
11444
|
+
return { byId: false, identifier: name };
|
|
11445
|
+
}
|
|
11446
|
+
throw new ValidationError({
|
|
11447
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
|
|
11448
|
+
});
|
|
11449
|
+
}
|
|
11118
11450
|
|
|
11119
11451
|
class EntityService extends BaseService {
|
|
11120
11452
|
async getById(id, options) {
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
return
|
|
11453
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
|
|
11454
|
+
}
|
|
11455
|
+
async getByName(entityName, options) {
|
|
11456
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
|
|
11125
11457
|
}
|
|
11126
11458
|
async getAllRecords(entityId, options) {
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
|
|
11132
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
11133
|
-
pagination: {
|
|
11134
|
-
paginationType: PaginationType.OFFSET,
|
|
11135
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
11136
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
11137
|
-
paginationParams: {
|
|
11138
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
11139
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
11140
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
11141
|
-
}
|
|
11142
|
-
},
|
|
11143
|
-
excludeFromPrefix: ["expansionLevel"]
|
|
11144
|
-
}, downstreamOptions);
|
|
11459
|
+
return this.getRecordsImpl(true, entityId, options);
|
|
11460
|
+
}
|
|
11461
|
+
async getRecordsByName(entityName, options) {
|
|
11462
|
+
return this.getRecordsImpl(false, entityName, options);
|
|
11145
11463
|
}
|
|
11146
11464
|
async getRecordById(entityId, recordId, options = {}) {
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11465
|
+
return this.getRecordImpl(true, entityId, recordId, options);
|
|
11466
|
+
}
|
|
11467
|
+
async getRecordByName(entityName, recordId, options = {}) {
|
|
11468
|
+
return this.getRecordImpl(false, entityName, recordId, options);
|
|
11469
|
+
}
|
|
11470
|
+
async insertRecord(entityRef, data, options = {}) {
|
|
11471
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
|
|
11472
|
+
return this.insertRecordImpl(byId, identifier, data, options);
|
|
11152
11473
|
}
|
|
11153
11474
|
async insertRecordById(id, data, options = {}) {
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
const
|
|
11158
|
-
|
|
11159
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
11160
|
-
});
|
|
11161
|
-
return response.data;
|
|
11475
|
+
return this.insertRecordImpl(true, id, data, options);
|
|
11476
|
+
}
|
|
11477
|
+
async insertRecords(entityRef, data, options = {}) {
|
|
11478
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecords");
|
|
11479
|
+
return this.insertRecordsImpl(byId, identifier, data, options);
|
|
11162
11480
|
}
|
|
11163
11481
|
async insertRecordsById(id, data, options = {}) {
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
});
|
|
11168
|
-
|
|
11169
|
-
params,
|
|
11170
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
11171
|
-
});
|
|
11172
|
-
return response.data;
|
|
11482
|
+
return this.insertRecordsImpl(true, id, data, options);
|
|
11483
|
+
}
|
|
11484
|
+
async updateRecord(entityRef, recordId, data, options = {}) {
|
|
11485
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecord");
|
|
11486
|
+
return this.updateRecordImpl(byId, identifier, recordId, data, options);
|
|
11173
11487
|
}
|
|
11174
11488
|
async updateRecordById(entityId, recordId, data, options = {}) {
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
const
|
|
11179
|
-
|
|
11180
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
11181
|
-
});
|
|
11182
|
-
return response.data;
|
|
11489
|
+
return this.updateRecordImpl(true, entityId, recordId, data, options);
|
|
11490
|
+
}
|
|
11491
|
+
async updateRecords(entityRef, data, options = {}) {
|
|
11492
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecords");
|
|
11493
|
+
return this.updateRecordsImpl(byId, identifier, data, options);
|
|
11183
11494
|
}
|
|
11184
11495
|
async updateRecordsById(id, data, options = {}) {
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
});
|
|
11189
|
-
|
|
11190
|
-
params,
|
|
11191
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
11192
|
-
});
|
|
11193
|
-
return response.data;
|
|
11496
|
+
return this.updateRecordsImpl(true, id, data, options);
|
|
11497
|
+
}
|
|
11498
|
+
async deleteRecords(entityRef, recordIds, options = {}) {
|
|
11499
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
|
|
11500
|
+
return this.deleteRecordsImpl(byId, identifier, recordIds, options);
|
|
11194
11501
|
}
|
|
11195
11502
|
async deleteRecordsById(id, recordIds, options = {}) {
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
const
|
|
11200
|
-
|
|
11201
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
11202
|
-
});
|
|
11203
|
-
return response.data;
|
|
11503
|
+
return this.deleteRecordsImpl(true, id, recordIds, options);
|
|
11504
|
+
}
|
|
11505
|
+
async deleteRecord(entityRef, recordId, options) {
|
|
11506
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecord");
|
|
11507
|
+
return this.deleteRecordImpl(byId, identifier, recordId, options);
|
|
11204
11508
|
}
|
|
11205
11509
|
async deleteRecordById(entityId, recordId, options) {
|
|
11206
|
-
|
|
11510
|
+
return this.deleteRecordImpl(true, entityId, recordId, options);
|
|
11207
11511
|
}
|
|
11208
11512
|
async getAll(options) {
|
|
11209
11513
|
const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
|
|
@@ -11215,62 +11519,30 @@ class EntityService extends BaseService {
|
|
|
11215
11519
|
});
|
|
11216
11520
|
return entities;
|
|
11217
11521
|
}
|
|
11522
|
+
async queryRecords(entityRef, options) {
|
|
11523
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.queryRecords");
|
|
11524
|
+
return this.queryRecordsImpl(byId, identifier, options);
|
|
11525
|
+
}
|
|
11218
11526
|
async queryRecordsById(id, options) {
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
11225
|
-
throw new ValidationError({
|
|
11226
|
-
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
11227
|
-
});
|
|
11228
|
-
}
|
|
11229
|
-
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
11230
|
-
let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
|
|
11231
|
-
if (options?.joins && options.joins.length > 0) {
|
|
11232
|
-
const baseEntityName = await this.resolveEntityName(id, folderKey);
|
|
11233
|
-
rest.joins = options.joins.map((join) => toWireJoin(join, baseEntityName));
|
|
11234
|
-
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
11235
|
-
}
|
|
11236
|
-
const downstreamOptions = options === undefined ? undefined : rest;
|
|
11237
|
-
return PaginationHelpers.getAll({
|
|
11238
|
-
serviceAccess: this.createPaginationServiceAccess(),
|
|
11239
|
-
getEndpoint,
|
|
11240
|
-
method: HTTP_METHODS.POST,
|
|
11241
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
11242
|
-
queryParams: createParams({ expansionLevel }),
|
|
11243
|
-
pagination: {
|
|
11244
|
-
paginationType: PaginationType.OFFSET,
|
|
11245
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
11246
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
11247
|
-
paginationParams: {
|
|
11248
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
11249
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
11250
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
11251
|
-
}
|
|
11252
|
-
},
|
|
11253
|
-
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins"]
|
|
11254
|
-
}, downstreamOptions);
|
|
11527
|
+
return this.queryRecordsImpl(true, id, options);
|
|
11528
|
+
}
|
|
11529
|
+
async importRecords(entityRef, file, options) {
|
|
11530
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.importRecords");
|
|
11531
|
+
return this.importRecordsImpl(byId, identifier, file, options);
|
|
11255
11532
|
}
|
|
11256
11533
|
async importRecordsById(id, file, options) {
|
|
11257
|
-
|
|
11258
|
-
if (file instanceof Uint8Array) {
|
|
11259
|
-
formData.append("file", new Blob([file.buffer]));
|
|
11260
|
-
} else {
|
|
11261
|
-
formData.append("file", file);
|
|
11262
|
-
}
|
|
11263
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
11264
|
-
return response.data;
|
|
11534
|
+
return this.importRecordsImpl(true, id, file, options);
|
|
11265
11535
|
}
|
|
11266
|
-
async downloadAttachment(
|
|
11267
|
-
const
|
|
11536
|
+
async downloadAttachment(entityRef, recordId, fieldName, options) {
|
|
11537
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.downloadAttachment");
|
|
11538
|
+
const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), {
|
|
11268
11539
|
responseType: RESPONSE_TYPES.BLOB,
|
|
11269
11540
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
11270
11541
|
});
|
|
11271
11542
|
return response.data;
|
|
11272
11543
|
}
|
|
11273
|
-
async uploadAttachment(
|
|
11544
|
+
async uploadAttachment(entityRef, recordId, fieldName, file, options) {
|
|
11545
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.uploadAttachment");
|
|
11274
11546
|
const formData = new FormData;
|
|
11275
11547
|
if (file instanceof Uint8Array) {
|
|
11276
11548
|
formData.append("file", new Blob([file.buffer]));
|
|
@@ -11278,14 +11550,15 @@ class EntityService extends BaseService {
|
|
|
11278
11550
|
formData.append("file", file);
|
|
11279
11551
|
}
|
|
11280
11552
|
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
11281
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
11553
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), formData, {
|
|
11282
11554
|
params,
|
|
11283
11555
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
11284
11556
|
});
|
|
11285
11557
|
return response.data;
|
|
11286
11558
|
}
|
|
11287
|
-
async deleteAttachment(
|
|
11288
|
-
const
|
|
11559
|
+
async deleteAttachment(entityRef, recordId, fieldName, options) {
|
|
11560
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteAttachment");
|
|
11561
|
+
const response = await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(identifier, recordId, fieldName) : DATA_FABRIC_ENDPOINTS.ENTITY.ATTACHMENT_BY_NAME(identifier, recordId, fieldName), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
11289
11562
|
return response.data;
|
|
11290
11563
|
}
|
|
11291
11564
|
async getRecordsById(entityId, options) {
|
|
@@ -11322,11 +11595,16 @@ class EntityService extends BaseService {
|
|
|
11322
11595
|
const opts = options ?? {};
|
|
11323
11596
|
const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
|
|
11324
11597
|
const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
|
|
11598
|
+
if (!hasSchemaChanges && !hasMetadataChanges) {
|
|
11599
|
+
throw new ValidationError({
|
|
11600
|
+
message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or isRbacEnabled."
|
|
11601
|
+
});
|
|
11602
|
+
}
|
|
11325
11603
|
if (hasSchemaChanges) {
|
|
11326
11604
|
await this.applySchemaUpdate(id, opts);
|
|
11327
11605
|
}
|
|
11328
11606
|
if (hasMetadataChanges) {
|
|
11329
|
-
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.
|
|
11607
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE(id), {
|
|
11330
11608
|
...opts.displayName !== undefined && { displayName: opts.displayName },
|
|
11331
11609
|
...opts.description !== undefined && { description: opts.description },
|
|
11332
11610
|
...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
|
|
@@ -11339,10 +11617,24 @@ class EntityService extends BaseService {
|
|
|
11339
11617
|
const raw = entityResponse.data;
|
|
11340
11618
|
let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
|
|
11341
11619
|
if (options.removeFields?.length) {
|
|
11620
|
+
const existingNames = new Set(fields.map((f) => f.name));
|
|
11621
|
+
const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
|
|
11622
|
+
if (missing.length) {
|
|
11623
|
+
throw new ValidationError({
|
|
11624
|
+
message: `Cannot remove field(s) — no matching non-system field found for name(s): ${missing.join(", ")}.`
|
|
11625
|
+
});
|
|
11626
|
+
}
|
|
11342
11627
|
const removeSet = new Set(options.removeFields.map((r) => r.name));
|
|
11343
11628
|
fields = fields.filter((f) => !removeSet.has(f.name));
|
|
11344
11629
|
}
|
|
11345
11630
|
if (options.updateFields?.length) {
|
|
11631
|
+
const existingIds = new Set(fields.map((f) => f.id));
|
|
11632
|
+
const missing = options.updateFields.filter((u) => !existingIds.has(u.id)).map((u) => u.id);
|
|
11633
|
+
if (missing.length) {
|
|
11634
|
+
throw new ValidationError({
|
|
11635
|
+
message: `Cannot update field(s) — no matching non-system field found for id(s): ${missing.join(", ")}.`
|
|
11636
|
+
});
|
|
11637
|
+
}
|
|
11346
11638
|
const updateMap = new Map(options.updateFields.map((u) => [u.id, u]));
|
|
11347
11639
|
fields = fields.map((f) => {
|
|
11348
11640
|
const update = updateMap.get(f.id ?? "");
|
|
@@ -11592,40 +11884,185 @@ class EntityService extends BaseService {
|
|
|
11592
11884
|
return {};
|
|
11593
11885
|
}
|
|
11594
11886
|
}
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11887
|
+
async fetchEntityMetadata(endpoint, folderKey) {
|
|
11888
|
+
const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
11889
|
+
const metadata = transformData(response.data, EntityMap);
|
|
11890
|
+
this.applyFieldMappings(metadata);
|
|
11891
|
+
return createEntityWithMethods(metadata, this);
|
|
11892
|
+
}
|
|
11893
|
+
getRecordsImpl(byId, identifier, options) {
|
|
11894
|
+
const { folderKey, ...rest } = options ?? {};
|
|
11895
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
11896
|
+
return PaginationHelpers.getAll({
|
|
11897
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
11898
|
+
getEndpoint: () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS_BY_NAME(identifier),
|
|
11899
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
11900
|
+
pagination: {
|
|
11901
|
+
paginationType: PaginationType.OFFSET,
|
|
11902
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
11903
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
11904
|
+
paginationParams: {
|
|
11905
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
11906
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
11907
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
11908
|
+
}
|
|
11909
|
+
},
|
|
11910
|
+
excludeFromPrefix: ["expansionLevel"]
|
|
11911
|
+
}, downstreamOptions);
|
|
11912
|
+
}
|
|
11913
|
+
async getRecordImpl(byId, identifier, recordId, options) {
|
|
11914
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
11915
|
+
const response = await this.get(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_NAME(identifier, recordId), { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11916
|
+
return response.data;
|
|
11917
|
+
}
|
|
11918
|
+
async insertRecordImpl(byId, identifier, data, options) {
|
|
11919
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
11920
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11921
|
+
return response.data;
|
|
11922
|
+
}
|
|
11923
|
+
async insertRecordsImpl(byId, identifier, data, options) {
|
|
11924
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
11925
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BATCH_INSERT_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11926
|
+
return response.data;
|
|
11927
|
+
}
|
|
11928
|
+
async updateRecordImpl(byId, identifier, recordId, data, options) {
|
|
11929
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
11930
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_NAME(identifier, recordId), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11931
|
+
return response.data;
|
|
11932
|
+
}
|
|
11933
|
+
async updateRecordsImpl(byId, identifier, data, options) {
|
|
11934
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
11935
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_BY_NAME(identifier), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11936
|
+
return response.data;
|
|
11937
|
+
}
|
|
11938
|
+
async deleteRecordsImpl(byId, identifier, recordIds, options) {
|
|
11939
|
+
const params = createParams({ failOnFirst: options.failOnFirst });
|
|
11940
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_BY_NAME(identifier), recordIds, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
11941
|
+
return response.data;
|
|
11942
|
+
}
|
|
11943
|
+
async deleteRecordImpl(byId, identifier, recordId, options) {
|
|
11944
|
+
await this.delete(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(identifier, recordId) : DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_NAME(identifier, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
11945
|
+
}
|
|
11946
|
+
async queryRecordsImpl(byId, identifier, options) {
|
|
11947
|
+
if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
|
|
11948
|
+
throw new ValidationError({
|
|
11949
|
+
message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
|
|
11950
|
+
});
|
|
11951
|
+
}
|
|
11952
|
+
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
11953
|
+
throw new ValidationError({
|
|
11954
|
+
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
11955
|
+
});
|
|
11956
|
+
}
|
|
11957
|
+
if (options?.havingFilter && (!options.aggregates?.length || !options.groupBy?.length)) {
|
|
11958
|
+
throw new ValidationError({
|
|
11959
|
+
message: "havingFilter requires aggregates and groupBy — conditions reference declared aggregate aliases; use filterGroup for row-level conditions"
|
|
11960
|
+
});
|
|
11961
|
+
}
|
|
11962
|
+
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
11963
|
+
let getEndpoint = () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(identifier);
|
|
11964
|
+
if (options?.joins && options.joins.length > 0) {
|
|
11965
|
+
const baseEntityName = byId ? await this.resolveEntityName(identifier, folderKey) : identifier;
|
|
11966
|
+
rest.joins = options.joins.map((join) => toWireJoin(join, baseEntityName));
|
|
11967
|
+
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
11968
|
+
}
|
|
11969
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
11970
|
+
return PaginationHelpers.getAll({
|
|
11971
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
11972
|
+
getEndpoint,
|
|
11973
|
+
method: HTTP_METHODS.POST,
|
|
11974
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
11975
|
+
queryParams: createParams({ expansionLevel }),
|
|
11976
|
+
pagination: {
|
|
11977
|
+
paginationType: PaginationType.OFFSET,
|
|
11978
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
11979
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
11980
|
+
paginationParams: {
|
|
11981
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
11982
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
11983
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
11984
|
+
}
|
|
11985
|
+
},
|
|
11986
|
+
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins", "havingFilter"]
|
|
11987
|
+
}, downstreamOptions);
|
|
11988
|
+
}
|
|
11989
|
+
async importRecordsImpl(byId, identifier, file, options) {
|
|
11990
|
+
const formData = new FormData;
|
|
11991
|
+
if (file instanceof Uint8Array) {
|
|
11992
|
+
formData.append("file", new Blob([file.buffer]));
|
|
11993
|
+
} else {
|
|
11994
|
+
formData.append("file", file);
|
|
11995
|
+
}
|
|
11996
|
+
const response = await this.post(byId ? DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_NAME(identifier), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
11997
|
+
return response.data;
|
|
11998
|
+
}
|
|
11999
|
+
}
|
|
12000
|
+
__decorate([
|
|
12001
|
+
track("Entities.GetById")
|
|
11598
12002
|
], EntityService.prototype, "getById", null);
|
|
12003
|
+
__decorate([
|
|
12004
|
+
track("Entities.GetByName")
|
|
12005
|
+
], EntityService.prototype, "getByName", null);
|
|
11599
12006
|
__decorate([
|
|
11600
12007
|
track("Entities.GetAllRecords")
|
|
11601
12008
|
], EntityService.prototype, "getAllRecords", null);
|
|
12009
|
+
__decorate([
|
|
12010
|
+
track("Entities.GetRecordsByName")
|
|
12011
|
+
], EntityService.prototype, "getRecordsByName", null);
|
|
11602
12012
|
__decorate([
|
|
11603
12013
|
track("Entities.GetRecordById")
|
|
11604
12014
|
], EntityService.prototype, "getRecordById", null);
|
|
12015
|
+
__decorate([
|
|
12016
|
+
track("Entities.GetRecordByName")
|
|
12017
|
+
], EntityService.prototype, "getRecordByName", null);
|
|
12018
|
+
__decorate([
|
|
12019
|
+
track("Entities.InsertRecord")
|
|
12020
|
+
], EntityService.prototype, "insertRecord", null);
|
|
11605
12021
|
__decorate([
|
|
11606
12022
|
track("Entities.InsertRecordById")
|
|
11607
12023
|
], EntityService.prototype, "insertRecordById", null);
|
|
12024
|
+
__decorate([
|
|
12025
|
+
track("Entities.InsertRecords")
|
|
12026
|
+
], EntityService.prototype, "insertRecords", null);
|
|
11608
12027
|
__decorate([
|
|
11609
12028
|
track("Entities.InsertRecordsById")
|
|
11610
12029
|
], EntityService.prototype, "insertRecordsById", null);
|
|
12030
|
+
__decorate([
|
|
12031
|
+
track("Entities.UpdateRecord")
|
|
12032
|
+
], EntityService.prototype, "updateRecord", null);
|
|
11611
12033
|
__decorate([
|
|
11612
12034
|
track("Entities.UpdateRecordById")
|
|
11613
12035
|
], EntityService.prototype, "updateRecordById", null);
|
|
12036
|
+
__decorate([
|
|
12037
|
+
track("Entities.UpdateRecords")
|
|
12038
|
+
], EntityService.prototype, "updateRecords", null);
|
|
11614
12039
|
__decorate([
|
|
11615
12040
|
track("Entities.UpdateRecordsById")
|
|
11616
12041
|
], EntityService.prototype, "updateRecordsById", null);
|
|
12042
|
+
__decorate([
|
|
12043
|
+
track("Entities.DeleteRecords")
|
|
12044
|
+
], EntityService.prototype, "deleteRecords", null);
|
|
11617
12045
|
__decorate([
|
|
11618
12046
|
track("Entities.DeleteRecordsById")
|
|
11619
12047
|
], EntityService.prototype, "deleteRecordsById", null);
|
|
12048
|
+
__decorate([
|
|
12049
|
+
track("Entities.DeleteRecord")
|
|
12050
|
+
], EntityService.prototype, "deleteRecord", null);
|
|
11620
12051
|
__decorate([
|
|
11621
12052
|
track("Entities.DeleteRecordById")
|
|
11622
12053
|
], EntityService.prototype, "deleteRecordById", null);
|
|
11623
12054
|
__decorate([
|
|
11624
12055
|
track("Entities.GetAll")
|
|
11625
12056
|
], EntityService.prototype, "getAll", null);
|
|
12057
|
+
__decorate([
|
|
12058
|
+
track("Entities.QueryRecords")
|
|
12059
|
+
], EntityService.prototype, "queryRecords", null);
|
|
11626
12060
|
__decorate([
|
|
11627
12061
|
track("Entities.QueryRecordsById")
|
|
11628
12062
|
], EntityService.prototype, "queryRecordsById", null);
|
|
12063
|
+
__decorate([
|
|
12064
|
+
track("Entities.ImportRecords")
|
|
12065
|
+
], EntityService.prototype, "importRecords", null);
|
|
11629
12066
|
__decorate([
|
|
11630
12067
|
track("Entities.ImportRecordsById")
|
|
11631
12068
|
], EntityService.prototype, "importRecordsById", null);
|
|
@@ -13069,6 +13506,74 @@ function validateName(resourceType, name) {
|
|
|
13069
13506
|
}
|
|
13070
13507
|
return trimmed;
|
|
13071
13508
|
}
|
|
13509
|
+
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
13510
|
+
function isPlainObject(value) {
|
|
13511
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13512
|
+
}
|
|
13513
|
+
function asResourceOverrides(value) {
|
|
13514
|
+
if (!isPlainObject(value))
|
|
13515
|
+
return;
|
|
13516
|
+
const table = {};
|
|
13517
|
+
for (const [key, properties] of Object.entries(value)) {
|
|
13518
|
+
if (!isPlainObject(properties))
|
|
13519
|
+
continue;
|
|
13520
|
+
const bag = {};
|
|
13521
|
+
for (const [property, propertyValue] of Object.entries(properties)) {
|
|
13522
|
+
if (typeof propertyValue === "string")
|
|
13523
|
+
bag[property] = propertyValue;
|
|
13524
|
+
}
|
|
13525
|
+
table[key] = bag;
|
|
13526
|
+
}
|
|
13527
|
+
return Object.keys(table).length > 0 ? table : undefined;
|
|
13528
|
+
}
|
|
13529
|
+
function readFromDocument() {
|
|
13530
|
+
if (!isBrowser)
|
|
13531
|
+
return;
|
|
13532
|
+
const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
|
|
13533
|
+
if (!text)
|
|
13534
|
+
return;
|
|
13535
|
+
try {
|
|
13536
|
+
return asResourceOverrides(JSON.parse(text));
|
|
13537
|
+
} catch (error) {
|
|
13538
|
+
console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
|
|
13539
|
+
return;
|
|
13540
|
+
}
|
|
13541
|
+
}
|
|
13542
|
+
var table;
|
|
13543
|
+
var loaded = false;
|
|
13544
|
+
var pageOverrides = () => {
|
|
13545
|
+
if (!loaded) {
|
|
13546
|
+
loaded = true;
|
|
13547
|
+
table = readFromDocument();
|
|
13548
|
+
}
|
|
13549
|
+
return table;
|
|
13550
|
+
};
|
|
13551
|
+
var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
|
|
13552
|
+
function readOverrides() {
|
|
13553
|
+
const slot = globalThis[RESOURCE_OVERWRITES_KEY];
|
|
13554
|
+
const source = typeof slot === "function" ? slot : pageOverrides;
|
|
13555
|
+
try {
|
|
13556
|
+
return source();
|
|
13557
|
+
} catch (error) {
|
|
13558
|
+
console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
|
|
13559
|
+
return;
|
|
13560
|
+
}
|
|
13561
|
+
}
|
|
13562
|
+
function resolveOverride(resourceType, name, folderPath) {
|
|
13563
|
+
const table2 = readOverrides();
|
|
13564
|
+
if (!table2)
|
|
13565
|
+
return;
|
|
13566
|
+
const bindingType = resourceType.toLowerCase();
|
|
13567
|
+
const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
|
|
13568
|
+
const unscopedKey = `${bindingType}.${name}`;
|
|
13569
|
+
const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
|
|
13570
|
+
if (!entry)
|
|
13571
|
+
return;
|
|
13572
|
+
return {
|
|
13573
|
+
name: entry.name,
|
|
13574
|
+
folderPath: entry.folderPath
|
|
13575
|
+
};
|
|
13576
|
+
}
|
|
13072
13577
|
var SINGLE_QUOTE_RE = /'/g;
|
|
13073
13578
|
|
|
13074
13579
|
class FolderScopedService extends BaseService {
|
|
@@ -13085,20 +13590,23 @@ class FolderScopedService extends BaseService {
|
|
|
13085
13590
|
}
|
|
13086
13591
|
return response.data?.value;
|
|
13087
13592
|
}
|
|
13088
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
|
|
13593
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap, callerLabel) {
|
|
13089
13594
|
const validatedName = validateName(resourceType, name);
|
|
13090
13595
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
13596
|
+
const override = resolveOverride(resourceType, validatedName, folderPath);
|
|
13597
|
+
const resolvedName = override?.name ?? validatedName;
|
|
13598
|
+
const resolvedFolderPath = override?.folderPath ?? folderPath;
|
|
13091
13599
|
const headers = resolveFolderHeaders({
|
|
13092
13600
|
folderId,
|
|
13093
13601
|
folderKey,
|
|
13094
|
-
folderPath,
|
|
13095
|
-
resourceType: `${resourceType}.getByName`,
|
|
13602
|
+
folderPath: resolvedFolderPath,
|
|
13603
|
+
resourceType: callerLabel ?? `${resourceType}.getByName`,
|
|
13096
13604
|
fallbackFolderKey: this.config.folderKey
|
|
13097
13605
|
});
|
|
13098
13606
|
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
13099
13607
|
const apiOptions = {
|
|
13100
13608
|
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
13101
|
-
$filter: `Name eq '${
|
|
13609
|
+
$filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
13102
13610
|
$top: "1"
|
|
13103
13611
|
};
|
|
13104
13612
|
const response = await this.get(endpoint, {
|
|
@@ -13107,12 +13615,48 @@ class FolderScopedService extends BaseService {
|
|
|
13107
13615
|
});
|
|
13108
13616
|
const items = response.data?.value;
|
|
13109
13617
|
if (!items?.length) {
|
|
13110
|
-
const folderHint = describeFolderForError(folderId, folderKey,
|
|
13618
|
+
const folderHint = describeFolderForError(folderId, folderKey, resolvedFolderPath);
|
|
13111
13619
|
throw new NotFoundError({
|
|
13112
|
-
message: `${resourceType} '${
|
|
13620
|
+
message: `${resourceType} '${resolvedName}' not found${folderHint}.`
|
|
13113
13621
|
});
|
|
13114
13622
|
}
|
|
13115
|
-
return
|
|
13623
|
+
return {
|
|
13624
|
+
result: transform2(items[0]),
|
|
13625
|
+
effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
|
|
13626
|
+
};
|
|
13627
|
+
}
|
|
13628
|
+
async getByKeyLookup(resourceType, endpoint, key, options, transform2, responseFieldMap, callerLabel) {
|
|
13629
|
+
const label = callerLabel ?? `${resourceType}.getByKey`;
|
|
13630
|
+
const trimmedKey = key?.trim();
|
|
13631
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
13632
|
+
throw new ValidationError({ message: `${label}: key must be a GUID.` });
|
|
13633
|
+
}
|
|
13634
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
13635
|
+
const headers = resolveFolderHeaders({
|
|
13636
|
+
folderId,
|
|
13637
|
+
folderKey,
|
|
13638
|
+
folderPath,
|
|
13639
|
+
resourceType: label,
|
|
13640
|
+
fallbackFolderKey: this.config.folderKey
|
|
13641
|
+
});
|
|
13642
|
+
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
13643
|
+
const apiOptions = {
|
|
13644
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
13645
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
13646
|
+
$top: "1"
|
|
13647
|
+
};
|
|
13648
|
+
const response = await this.get(endpoint, {
|
|
13649
|
+
headers,
|
|
13650
|
+
params: apiOptions
|
|
13651
|
+
});
|
|
13652
|
+
const items = response.data?.value;
|
|
13653
|
+
if (!items?.length) {
|
|
13654
|
+
throw new NotFoundError({ message: `${resourceType} with key '${trimmedKey}' not found.` });
|
|
13655
|
+
}
|
|
13656
|
+
return {
|
|
13657
|
+
result: transform2(items[0]),
|
|
13658
|
+
effectiveFolder: { folderId, folderKey, folderPath }
|
|
13659
|
+
};
|
|
13116
13660
|
}
|
|
13117
13661
|
}
|
|
13118
13662
|
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
@@ -13143,12 +13687,16 @@ class TaskService extends FolderScopedService {
|
|
|
13143
13687
|
};
|
|
13144
13688
|
}
|
|
13145
13689
|
async create(task, folderId) {
|
|
13690
|
+
if (task.type === TaskType.QuickForm && !task.taskSchemaKey) {
|
|
13691
|
+
throw new ValidationError({ message: "taskSchemaKey is required when creating a QuickForm task." });
|
|
13692
|
+
}
|
|
13146
13693
|
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
13147
|
-
const
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13694
|
+
const { labels, type, ...rest } = task;
|
|
13695
|
+
const payload = { ...rest, type: type ?? TaskType.External };
|
|
13696
|
+
if (labels?.length) {
|
|
13697
|
+
payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
|
|
13698
|
+
}
|
|
13699
|
+
const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, payload, { headers });
|
|
13152
13700
|
const normalizedData = transformData(response.data, TaskMap);
|
|
13153
13701
|
const transformedData = applyDataTransforms(normalizedData, { field: "status", valueMap: TaskStatusMap });
|
|
13154
13702
|
return createTaskWithMethods(transformedData, this);
|
|
@@ -13780,6 +14328,35 @@ var AssetValueType;
|
|
|
13780
14328
|
AssetValueType2["Credential"] = "Credential";
|
|
13781
14329
|
AssetValueType2["Secret"] = "Secret";
|
|
13782
14330
|
})(AssetValueType || (AssetValueType = {}));
|
|
14331
|
+
async function resolveRefToId(ref, resolvers, callerLabel) {
|
|
14332
|
+
if (!ref) {
|
|
14333
|
+
throw new ValidationError({
|
|
14334
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
14335
|
+
});
|
|
14336
|
+
}
|
|
14337
|
+
if ("id" in ref && ref.id != null) {
|
|
14338
|
+
return { id: ref.id, effectiveFolder: {} };
|
|
14339
|
+
}
|
|
14340
|
+
const stringVariants = [
|
|
14341
|
+
{ variant: "name", resolver: resolvers.byName },
|
|
14342
|
+
{ variant: "key", resolver: resolvers.byKey }
|
|
14343
|
+
];
|
|
14344
|
+
for (const { variant, resolver } of stringVariants) {
|
|
14345
|
+
const value = ref[variant];
|
|
14346
|
+
if (!value)
|
|
14347
|
+
continue;
|
|
14348
|
+
if (!resolver) {
|
|
14349
|
+
throw new ValidationError({
|
|
14350
|
+
message: `${callerLabel}: this method does not support lookup by '${variant}'.`
|
|
14351
|
+
});
|
|
14352
|
+
}
|
|
14353
|
+
const { id, folderId, folderKey, folderPath } = await resolver(value);
|
|
14354
|
+
return { id, effectiveFolder: { folderId, folderKey, folderPath } };
|
|
14355
|
+
}
|
|
14356
|
+
throw new ValidationError({
|
|
14357
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
14358
|
+
});
|
|
14359
|
+
}
|
|
13783
14360
|
var AssetMap = {
|
|
13784
14361
|
creationTime: "createdTime",
|
|
13785
14362
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -13818,7 +14395,41 @@ class AssetService extends FolderScopedService {
|
|
|
13818
14395
|
return transformedAsset;
|
|
13819
14396
|
}
|
|
13820
14397
|
async getByName(name, options = {}) {
|
|
13821
|
-
|
|
14398
|
+
const { result } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
14399
|
+
return result;
|
|
14400
|
+
}
|
|
14401
|
+
async getByKey(key, options = {}) {
|
|
14402
|
+
const { result } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
14403
|
+
return result;
|
|
14404
|
+
}
|
|
14405
|
+
async updateValue(assetRef, newValue, options) {
|
|
14406
|
+
if (newValue === null || newValue === undefined) {
|
|
14407
|
+
throw new ValidationError({ message: "newValue is required for updateValue" });
|
|
14408
|
+
}
|
|
14409
|
+
let preFetched;
|
|
14410
|
+
const { id, effectiveFolder } = await resolveRefToId(assetRef, {
|
|
14411
|
+
byName: async (name) => {
|
|
14412
|
+
const { result: asset, effectiveFolder: folder } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
|
|
14413
|
+
preFetched = asset;
|
|
14414
|
+
return { id: asset.id, ...folder };
|
|
14415
|
+
},
|
|
14416
|
+
byKey: async (key) => {
|
|
14417
|
+
const { result: asset, effectiveFolder: folder } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap, "Assets.updateValue");
|
|
14418
|
+
preFetched = asset;
|
|
14419
|
+
return { id: asset.id, ...folder };
|
|
14420
|
+
}
|
|
14421
|
+
}, "Assets.updateValue");
|
|
14422
|
+
if (id <= 0) {
|
|
14423
|
+
throw new ValidationError({ message: "Assets.updateValue: assetRef.id must be a positive number." });
|
|
14424
|
+
}
|
|
14425
|
+
const headers = resolveFolderHeaders({
|
|
14426
|
+
folderId: effectiveFolder.folderId ?? options?.folderId,
|
|
14427
|
+
folderKey: effectiveFolder.folderKey ?? options?.folderKey,
|
|
14428
|
+
folderPath: effectiveFolder.folderPath ?? options?.folderPath,
|
|
14429
|
+
resourceType: "Assets.updateValue",
|
|
14430
|
+
fallbackFolderKey: this.config.folderKey
|
|
14431
|
+
});
|
|
14432
|
+
await this.updateValueByResolvedId(id, newValue, headers, preFetched);
|
|
13822
14433
|
}
|
|
13823
14434
|
async updateValueById(id, newValue, options) {
|
|
13824
14435
|
if (!id) {
|
|
@@ -13834,19 +14445,30 @@ class AssetService extends FolderScopedService {
|
|
|
13834
14445
|
resourceType: "Assets.updateValueById",
|
|
13835
14446
|
fallbackFolderKey: this.config.folderKey
|
|
13836
14447
|
});
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
14448
|
+
await this.updateValueByResolvedId(id, newValue, headers);
|
|
14449
|
+
}
|
|
14450
|
+
async updateValueByResolvedId(id, newValue, headers, preFetched) {
|
|
14451
|
+
const shape = preFetched ?? await this.fetchAssetShape(id, headers);
|
|
14452
|
+
const valueField = resolveValueField(id, shape.valueType, newValue);
|
|
13840
14453
|
const body = {
|
|
13841
14454
|
Id: id,
|
|
13842
|
-
Name:
|
|
13843
|
-
ValueScope:
|
|
13844
|
-
ValueType:
|
|
13845
|
-
Description:
|
|
14455
|
+
Name: shape.name,
|
|
14456
|
+
ValueScope: shape.valueScope,
|
|
14457
|
+
ValueType: shape.valueType,
|
|
14458
|
+
Description: shape.description,
|
|
13846
14459
|
[valueField]: newValue
|
|
13847
14460
|
};
|
|
13848
14461
|
await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
|
|
13849
14462
|
}
|
|
14463
|
+
async fetchAssetShape(id, headers) {
|
|
14464
|
+
const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
|
|
14465
|
+
return {
|
|
14466
|
+
name: response.data.Name,
|
|
14467
|
+
valueScope: response.data.ValueScope,
|
|
14468
|
+
valueType: response.data.ValueType,
|
|
14469
|
+
description: response.data.Description
|
|
14470
|
+
};
|
|
14471
|
+
}
|
|
13850
14472
|
}
|
|
13851
14473
|
__decorate([
|
|
13852
14474
|
track("Assets.GetAll")
|
|
@@ -13857,6 +14479,12 @@ __decorate([
|
|
|
13857
14479
|
__decorate([
|
|
13858
14480
|
track("Assets.GetByName")
|
|
13859
14481
|
], AssetService.prototype, "getByName", null);
|
|
14482
|
+
__decorate([
|
|
14483
|
+
track("Assets.GetByKey")
|
|
14484
|
+
], AssetService.prototype, "getByKey", null);
|
|
14485
|
+
__decorate([
|
|
14486
|
+
track("Assets.UpdateValue")
|
|
14487
|
+
], AssetService.prototype, "updateValue", null);
|
|
13860
14488
|
__decorate([
|
|
13861
14489
|
track("Assets.UpdateValueById")
|
|
13862
14490
|
], AssetService.prototype, "updateValueById", null);
|
|
@@ -13885,7 +14513,7 @@ function resolveValueField(id, valueType, newValue) {
|
|
|
13885
14513
|
return "BoolValue";
|
|
13886
14514
|
default:
|
|
13887
14515
|
throw new ValidationError({
|
|
13888
|
-
message: `
|
|
14516
|
+
message: `Asset ${id} has valueType ${valueType}; only Text, Integer, and Bool are supported`
|
|
13889
14517
|
});
|
|
13890
14518
|
}
|
|
13891
14519
|
}
|
|
@@ -13913,7 +14541,8 @@ class BucketService extends FolderScopedService {
|
|
|
13913
14541
|
return pascalToCamelCaseKeys(response.data);
|
|
13914
14542
|
}
|
|
13915
14543
|
async getByName(name, options = {}) {
|
|
13916
|
-
|
|
14544
|
+
const { result } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
|
|
14545
|
+
return result;
|
|
13917
14546
|
}
|
|
13918
14547
|
async getAll(options) {
|
|
13919
14548
|
const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
|
|
@@ -14780,7 +15409,8 @@ class ProcessService extends FolderScopedService {
|
|
|
14780
15409
|
return transformedProcess;
|
|
14781
15410
|
}
|
|
14782
15411
|
async getByName(name, options = {}) {
|
|
14783
|
-
|
|
15412
|
+
const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
|
|
15413
|
+
return result;
|
|
14784
15414
|
}
|
|
14785
15415
|
}
|
|
14786
15416
|
__decorate([
|
|
@@ -14795,21 +15425,112 @@ __decorate([
|
|
|
14795
15425
|
__decorate([
|
|
14796
15426
|
track("Processes.GetByName")
|
|
14797
15427
|
], ProcessService.prototype, "getByName", null);
|
|
15428
|
+
var QueuePriority;
|
|
15429
|
+
(function(QueuePriority2) {
|
|
15430
|
+
QueuePriority2["High"] = "High";
|
|
15431
|
+
QueuePriority2["Normal"] = "Normal";
|
|
15432
|
+
QueuePriority2["Low"] = "Low";
|
|
15433
|
+
})(QueuePriority || (QueuePriority = {}));
|
|
15434
|
+
var QueueItemStatus;
|
|
15435
|
+
(function(QueueItemStatus2) {
|
|
15436
|
+
QueueItemStatus2["New"] = "New";
|
|
15437
|
+
QueueItemStatus2["InProgress"] = "InProgress";
|
|
15438
|
+
QueueItemStatus2["Failed"] = "Failed";
|
|
15439
|
+
QueueItemStatus2["Successful"] = "Successful";
|
|
15440
|
+
QueueItemStatus2["Abandoned"] = "Abandoned";
|
|
15441
|
+
QueueItemStatus2["Retried"] = "Retried";
|
|
15442
|
+
QueueItemStatus2["Deleted"] = "Deleted";
|
|
15443
|
+
})(QueueItemStatus || (QueueItemStatus = {}));
|
|
15444
|
+
var QueueItemReviewStatus;
|
|
15445
|
+
(function(QueueItemReviewStatus2) {
|
|
15446
|
+
QueueItemReviewStatus2["None"] = "None";
|
|
15447
|
+
QueueItemReviewStatus2["InReview"] = "InReview";
|
|
15448
|
+
QueueItemReviewStatus2["Verified"] = "Verified";
|
|
15449
|
+
QueueItemReviewStatus2["Retried"] = "Retried";
|
|
15450
|
+
})(QueueItemReviewStatus || (QueueItemReviewStatus = {}));
|
|
15451
|
+
var QueueExceptionType;
|
|
15452
|
+
(function(QueueExceptionType2) {
|
|
15453
|
+
QueueExceptionType2["ApplicationException"] = "ApplicationException";
|
|
15454
|
+
QueueExceptionType2["BusinessException"] = "BusinessException";
|
|
15455
|
+
})(QueueExceptionType || (QueueExceptionType = {}));
|
|
15456
|
+
var QueueTransactionOutcome;
|
|
15457
|
+
(function(QueueTransactionOutcome2) {
|
|
15458
|
+
QueueTransactionOutcome2["Successful"] = "Successful";
|
|
15459
|
+
QueueTransactionOutcome2["Failed"] = "Failed";
|
|
15460
|
+
})(QueueTransactionOutcome || (QueueTransactionOutcome = {}));
|
|
15461
|
+
function createQueueMethods(queueData, service) {
|
|
15462
|
+
return {
|
|
15463
|
+
async getAllItems(options) {
|
|
15464
|
+
if (!queueData.id)
|
|
15465
|
+
throw new ValidationError({ message: "Queue ID is undefined" });
|
|
15466
|
+
if (!queueData.folderId)
|
|
15467
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
15468
|
+
return service.getAllItems(queueData.id, { ...options, folderId: queueData.folderId });
|
|
15469
|
+
},
|
|
15470
|
+
async insertItem(specificData, options) {
|
|
15471
|
+
if (!queueData.name)
|
|
15472
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
15473
|
+
if (!queueData.folderId)
|
|
15474
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
15475
|
+
return service.insertItemByName(queueData.name, specificData, { ...options, folderId: queueData.folderId });
|
|
15476
|
+
},
|
|
15477
|
+
async startTransaction() {
|
|
15478
|
+
if (!queueData.name)
|
|
15479
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
15480
|
+
if (!queueData.folderId)
|
|
15481
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
15482
|
+
return service.startTransaction({ name: queueData.name }, { folderId: queueData.folderId });
|
|
15483
|
+
},
|
|
15484
|
+
async completeTransaction(itemId, outcome, options) {
|
|
15485
|
+
if (!queueData.folderId)
|
|
15486
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
15487
|
+
return service.completeTransaction(itemId, outcome, { ...options, folderId: queueData.folderId });
|
|
15488
|
+
}
|
|
15489
|
+
};
|
|
15490
|
+
}
|
|
15491
|
+
function createQueueWithMethods(queueData, service) {
|
|
15492
|
+
return Object.assign({}, queueData, createQueueMethods(queueData, service));
|
|
15493
|
+
}
|
|
14798
15494
|
var QueueMap = {
|
|
14799
15495
|
creationTime: "createdTime",
|
|
14800
15496
|
organizationUnitId: "folderId",
|
|
14801
15497
|
organizationUnitFullyQualifiedName: "folderName"
|
|
14802
15498
|
};
|
|
15499
|
+
var QueueItemMap = {
|
|
15500
|
+
queueDefinitionId: "queueId",
|
|
15501
|
+
creationTime: "createdTime",
|
|
15502
|
+
organizationUnitId: "folderId",
|
|
15503
|
+
organizationUnitFullyQualifiedName: "folderName",
|
|
15504
|
+
startProcessing: "processingStartTime",
|
|
15505
|
+
endProcessing: "processingEndTime",
|
|
15506
|
+
processingException: "processingError"
|
|
15507
|
+
};
|
|
15508
|
+
var QueueItemProcessingErrorMap = {
|
|
15509
|
+
creationTime: "createdTime"
|
|
15510
|
+
};
|
|
15511
|
+
function transformQueueItem(queueItem) {
|
|
15512
|
+
const { SpecificContent, Output, SpecificData: _sd, OutputData: _od, ...rest } = queueItem;
|
|
15513
|
+
const transformed = transformData(pascalToCamelCaseKeys(rest), QueueItemMap);
|
|
15514
|
+
if (transformed.processingError) {
|
|
15515
|
+
transformed.processingError = transformData(transformed.processingError, QueueItemProcessingErrorMap);
|
|
15516
|
+
}
|
|
15517
|
+
transformed.specificData = SpecificContent ?? null;
|
|
15518
|
+
transformed.outputData = Output ?? null;
|
|
15519
|
+
return transformed;
|
|
15520
|
+
}
|
|
14803
15521
|
|
|
14804
15522
|
class QueueService extends FolderScopedService {
|
|
14805
15523
|
async getAll(options) {
|
|
14806
|
-
const
|
|
14807
|
-
const
|
|
15524
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
|
|
15525
|
+
const hasFolderScope = folderId !== undefined || !!folderKey?.trim() || !!folderPath?.trim();
|
|
15526
|
+
const headers = hasFolderScope ? resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Queues.getAll" }) : undefined;
|
|
15527
|
+
const apiOptions = transformOptions(queryOptions, QueueMap);
|
|
14808
15528
|
return PaginationHelpers.getAll({
|
|
14809
15529
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
14810
|
-
getEndpoint: (
|
|
15530
|
+
getEndpoint: () => hasFolderScope ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
|
|
14811
15531
|
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_BY_FOLDER,
|
|
14812
|
-
|
|
15532
|
+
headers,
|
|
15533
|
+
transformFn: (queue) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(queue), QueueMap), this),
|
|
14813
15534
|
pagination: {
|
|
14814
15535
|
paginationType: PaginationType.OFFSET,
|
|
14815
15536
|
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
@@ -14822,15 +15543,176 @@ class QueueService extends FolderScopedService {
|
|
|
14822
15543
|
}
|
|
14823
15544
|
}, apiOptions);
|
|
14824
15545
|
}
|
|
14825
|
-
async getById(id,
|
|
14826
|
-
|
|
14827
|
-
|
|
15546
|
+
async getById(id, folderIdOrOptions, options = {}) {
|
|
15547
|
+
if (typeof folderIdOrOptions === "number") {
|
|
15548
|
+
const headers2 = createHeaders({ [FOLDER_ID]: folderIdOrOptions });
|
|
15549
|
+
const apiFieldOptions2 = transformOptions(options, QueueMap);
|
|
15550
|
+
const apiOptions2 = addPrefixToKeys(apiFieldOptions2, ODATA_PREFIX, Object.keys(apiFieldOptions2));
|
|
15551
|
+
const response2 = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
15552
|
+
headers: headers2,
|
|
15553
|
+
params: apiOptions2
|
|
15554
|
+
});
|
|
15555
|
+
return transformData(pascalToCamelCaseKeys(response2.data), QueueMap);
|
|
15556
|
+
}
|
|
15557
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = folderIdOrOptions ?? {};
|
|
15558
|
+
const headers = resolveFolderHeaders({
|
|
15559
|
+
folderId,
|
|
15560
|
+
folderKey,
|
|
15561
|
+
folderPath,
|
|
15562
|
+
resourceType: "Queues.getById",
|
|
15563
|
+
fallbackFolderKey: this.config.folderKey
|
|
15564
|
+
});
|
|
15565
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
14828
15566
|
const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
|
|
14829
15567
|
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
14830
15568
|
headers,
|
|
14831
15569
|
params: apiOptions
|
|
14832
15570
|
});
|
|
14833
|
-
|
|
15571
|
+
const rawQueue = transformData(pascalToCamelCaseKeys(response.data), QueueMap);
|
|
15572
|
+
return createQueueWithMethods(rawQueue, this);
|
|
15573
|
+
}
|
|
15574
|
+
async getByName(name, options = {}) {
|
|
15575
|
+
const { result } = await this.getByNameLookup("Queue", QUEUE_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(raw), QueueMap), this), QueueMap);
|
|
15576
|
+
return result;
|
|
15577
|
+
}
|
|
15578
|
+
async getByKey(key, options = {}) {
|
|
15579
|
+
const trimmedKey = key?.trim();
|
|
15580
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
15581
|
+
throw new ValidationError({ message: "key must be a GUID for getByKey" });
|
|
15582
|
+
}
|
|
15583
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
15584
|
+
const headers = resolveFolderHeaders({
|
|
15585
|
+
folderId,
|
|
15586
|
+
folderKey,
|
|
15587
|
+
folderPath,
|
|
15588
|
+
resourceType: "Queues.getByKey",
|
|
15589
|
+
fallbackFolderKey: this.config.folderKey
|
|
15590
|
+
});
|
|
15591
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
15592
|
+
const apiOptions = {
|
|
15593
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
15594
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
15595
|
+
$top: "1"
|
|
15596
|
+
};
|
|
15597
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_FOLDER, { headers, params: apiOptions });
|
|
15598
|
+
const items = response.data?.value;
|
|
15599
|
+
if (!items?.length) {
|
|
15600
|
+
throw new NotFoundError({ message: `Queue with key '${trimmedKey}' not found.` });
|
|
15601
|
+
}
|
|
15602
|
+
return createQueueWithMethods(transformData(pascalToCamelCaseKeys(items[0]), QueueMap), this);
|
|
15603
|
+
}
|
|
15604
|
+
async getAllItems(queueId, options) {
|
|
15605
|
+
if (!queueId) {
|
|
15606
|
+
throw new ValidationError({ message: "queueId is required for getAllItems" });
|
|
15607
|
+
}
|
|
15608
|
+
const { folderId, folderKey, folderPath, filter, ...restOptions } = options ?? {};
|
|
15609
|
+
const headers = resolveFolderHeaders({
|
|
15610
|
+
folderId,
|
|
15611
|
+
folderKey,
|
|
15612
|
+
folderPath,
|
|
15613
|
+
resourceType: "Queues.getAllItems",
|
|
15614
|
+
fallbackFolderKey: this.config.folderKey
|
|
15615
|
+
});
|
|
15616
|
+
const mergedFilter = filter ? `(${filter}) and queueId eq ${queueId}` : `queueId eq ${queueId}`;
|
|
15617
|
+
const apiOptions = transformOptions({ ...restOptions, filter: mergedFilter }, QueueItemMap);
|
|
15618
|
+
return PaginationHelpers.getAll({
|
|
15619
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
15620
|
+
getEndpoint: () => QUEUE_ENDPOINTS.GET_ITEMS,
|
|
15621
|
+
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_ITEMS,
|
|
15622
|
+
headers,
|
|
15623
|
+
transformFn: transformQueueItem,
|
|
15624
|
+
pagination: {
|
|
15625
|
+
paginationType: PaginationType.OFFSET,
|
|
15626
|
+
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
15627
|
+
totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
|
|
15628
|
+
paginationParams: {
|
|
15629
|
+
pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
15630
|
+
offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
|
|
15631
|
+
countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
|
|
15632
|
+
}
|
|
15633
|
+
}
|
|
15634
|
+
}, apiOptions);
|
|
15635
|
+
}
|
|
15636
|
+
async insertItemByName(queueName, specificData, options = {}) {
|
|
15637
|
+
if (!queueName) {
|
|
15638
|
+
throw new ValidationError({ message: "queueName is required for insertItemByName" });
|
|
15639
|
+
}
|
|
15640
|
+
const headers = resolveFolderHeaders({
|
|
15641
|
+
folderId: options.folderId,
|
|
15642
|
+
folderKey: options.folderKey,
|
|
15643
|
+
folderPath: options.folderPath,
|
|
15644
|
+
resourceType: "Queues.insertItemByName",
|
|
15645
|
+
fallbackFolderKey: this.config.folderKey
|
|
15646
|
+
});
|
|
15647
|
+
const response = await this.post(QUEUE_ENDPOINTS.ADD_ITEM, {
|
|
15648
|
+
itemData: {
|
|
15649
|
+
Name: queueName,
|
|
15650
|
+
Priority: options.priority ?? QueuePriority.Normal,
|
|
15651
|
+
Reference: options.reference,
|
|
15652
|
+
Progress: options.progress,
|
|
15653
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
15654
|
+
DueDate: options.dueDate?.toISOString(),
|
|
15655
|
+
RiskSlaDate: options.riskSlaDate?.toISOString(),
|
|
15656
|
+
SpecificContent: specificData
|
|
15657
|
+
}
|
|
15658
|
+
}, { headers });
|
|
15659
|
+
return transformQueueItem(response.data);
|
|
15660
|
+
}
|
|
15661
|
+
async startTransaction(queue, options = {}) {
|
|
15662
|
+
const headers = resolveFolderHeaders({
|
|
15663
|
+
folderId: options.folderId,
|
|
15664
|
+
folderKey: options.folderKey,
|
|
15665
|
+
folderPath: options.folderPath,
|
|
15666
|
+
resourceType: "Queues.startTransaction",
|
|
15667
|
+
fallbackFolderKey: this.config.folderKey
|
|
15668
|
+
});
|
|
15669
|
+
let queueName;
|
|
15670
|
+
if (queue?.name) {
|
|
15671
|
+
queueName = queue.name;
|
|
15672
|
+
} else if (queue?.id != null) {
|
|
15673
|
+
queueName = await this.resolveQueueName(queue.id, headers);
|
|
15674
|
+
} else {
|
|
15675
|
+
throw new ValidationError({ message: "queue id or name is required for startTransaction" });
|
|
15676
|
+
}
|
|
15677
|
+
const response = await this.post(QUEUE_ENDPOINTS.START_TRANSACTION, {
|
|
15678
|
+
transactionData: { Name: queueName }
|
|
15679
|
+
}, { headers });
|
|
15680
|
+
if (!response.data || typeof response.data !== "object") {
|
|
15681
|
+
return null;
|
|
15682
|
+
}
|
|
15683
|
+
return transformQueueItem(response.data);
|
|
15684
|
+
}
|
|
15685
|
+
async completeTransaction(itemId, outcome, options = {}) {
|
|
15686
|
+
if (!itemId) {
|
|
15687
|
+
throw new ValidationError({ message: "itemId is required for completeTransaction" });
|
|
15688
|
+
}
|
|
15689
|
+
const headers = resolveFolderHeaders({
|
|
15690
|
+
folderId: options.folderId,
|
|
15691
|
+
folderKey: options.folderKey,
|
|
15692
|
+
folderPath: options.folderPath,
|
|
15693
|
+
resourceType: "Queues.completeTransaction",
|
|
15694
|
+
fallbackFolderKey: this.config.folderKey
|
|
15695
|
+
});
|
|
15696
|
+
const transactionResult = {
|
|
15697
|
+
IsSuccessful: outcome === QueueTransactionOutcome.Successful,
|
|
15698
|
+
ProcessingException: options.processingError && {
|
|
15699
|
+
Reason: options.processingError.reason,
|
|
15700
|
+
Details: options.processingError.details,
|
|
15701
|
+
Type: options.processingError.type,
|
|
15702
|
+
AssociatedImageFilePath: options.processingError.associatedImageFilePath
|
|
15703
|
+
},
|
|
15704
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
15705
|
+
DueDate: options.dueDate?.toISOString(),
|
|
15706
|
+
Progress: options.progress,
|
|
15707
|
+
OperationId: options.operationId,
|
|
15708
|
+
Output: options.outputData,
|
|
15709
|
+
Analytics: options.analytics
|
|
15710
|
+
};
|
|
15711
|
+
await this.post(QUEUE_ENDPOINTS.SET_TRANSACTION_RESULT(itemId), { transactionResult }, { headers });
|
|
15712
|
+
}
|
|
15713
|
+
async resolveQueueName(queueId, headers) {
|
|
15714
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(queueId), { headers, params: { $select: "Name" } });
|
|
15715
|
+
return response.data.Name;
|
|
14834
15716
|
}
|
|
14835
15717
|
}
|
|
14836
15718
|
__decorate([
|
|
@@ -14839,6 +15721,24 @@ __decorate([
|
|
|
14839
15721
|
__decorate([
|
|
14840
15722
|
track("Queues.GetById")
|
|
14841
15723
|
], QueueService.prototype, "getById", null);
|
|
15724
|
+
__decorate([
|
|
15725
|
+
track("Queues.GetByName")
|
|
15726
|
+
], QueueService.prototype, "getByName", null);
|
|
15727
|
+
__decorate([
|
|
15728
|
+
track("Queues.GetByKey")
|
|
15729
|
+
], QueueService.prototype, "getByKey", null);
|
|
15730
|
+
__decorate([
|
|
15731
|
+
track("Queues.GetAllItems")
|
|
15732
|
+
], QueueService.prototype, "getAllItems", null);
|
|
15733
|
+
__decorate([
|
|
15734
|
+
track("Queues.InsertItemByName")
|
|
15735
|
+
], QueueService.prototype, "insertItemByName", null);
|
|
15736
|
+
__decorate([
|
|
15737
|
+
track("Queues.StartTransaction")
|
|
15738
|
+
], QueueService.prototype, "startTransaction", null);
|
|
15739
|
+
__decorate([
|
|
15740
|
+
track("Queues.CompleteTransaction")
|
|
15741
|
+
], QueueService.prototype, "completeTransaction", null);
|
|
14842
15742
|
var TaskCatalogMap = {
|
|
14843
15743
|
creationTime: "createdTime",
|
|
14844
15744
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -14885,7 +15785,8 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
14885
15785
|
return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
|
|
14886
15786
|
}
|
|
14887
15787
|
async getByName(name, options = {}) {
|
|
14888
|
-
|
|
15788
|
+
const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
15789
|
+
return result;
|
|
14889
15790
|
}
|
|
14890
15791
|
async create(name, options = {}) {
|
|
14891
15792
|
if (!name) {
|
|
@@ -14909,7 +15810,7 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
14909
15810
|
throw new ValidationError({ message: "name is required for updateByName" });
|
|
14910
15811
|
}
|
|
14911
15812
|
const { folderId, folderKey, folderPath } = options;
|
|
14912
|
-
const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
15813
|
+
const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
14913
15814
|
return this.update(current, options);
|
|
14914
15815
|
}
|
|
14915
15816
|
async update(current, options) {
|
|
@@ -15054,6 +15955,13 @@ var AgentMap = {
|
|
|
15054
15955
|
var UserSettingsMap = {
|
|
15055
15956
|
...CommonFieldMap
|
|
15056
15957
|
};
|
|
15958
|
+
var ConnectionState;
|
|
15959
|
+
(function(ConnectionState2) {
|
|
15960
|
+
ConnectionState2["Enabled"] = "Enabled";
|
|
15961
|
+
ConnectionState2["Disabled"] = "Disabled";
|
|
15962
|
+
ConnectionState2["Expired"] = "Expired";
|
|
15963
|
+
ConnectionState2["Failed"] = "Failed";
|
|
15964
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
15057
15965
|
var FeedbackStatus;
|
|
15058
15966
|
(function(FeedbackStatus2) {
|
|
15059
15967
|
FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
|
|
@@ -15611,6 +16519,7 @@ var TaskType2;
|
|
|
15611
16519
|
TaskType3["DocumentValidation"] = "DocumentValidationTask";
|
|
15612
16520
|
TaskType3["DocumentClassification"] = "DocumentClassificationTask";
|
|
15613
16521
|
TaskType3["DataLabeling"] = "DataLabelingTask";
|
|
16522
|
+
TaskType3["QuickForm"] = "QuickFormTask";
|
|
15614
16523
|
})(TaskType2 || (TaskType2 = {}));
|
|
15615
16524
|
var TaskPriority2;
|
|
15616
16525
|
(function(TaskPriority3) {
|
|
@@ -15719,7 +16628,8 @@ var TASK_TYPE_ENDPOINTS2 = {
|
|
|
15719
16628
|
[TaskType2.DocumentValidation]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID,
|
|
15720
16629
|
[TaskType2.DocumentClassification]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID,
|
|
15721
16630
|
[TaskType2.External]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID,
|
|
15722
|
-
[TaskType2.DataLabeling]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID
|
|
16631
|
+
[TaskType2.DataLabeling]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID,
|
|
16632
|
+
[TaskType2.QuickForm]: TASK_ENDPOINTS2.GET_GENERIC_TASK_BY_ID
|
|
15723
16633
|
};
|
|
15724
16634
|
var ActionCenterEventNames2;
|
|
15725
16635
|
(function(ActionCenterEventNames3) {
|
|
@@ -15829,7 +16739,8 @@ var RESPONSE_TYPES2 = {
|
|
|
15829
16739
|
JSON: "json",
|
|
15830
16740
|
TEXT: "text",
|
|
15831
16741
|
BLOB: "blob",
|
|
15832
|
-
ARRAYBUFFER: "arraybuffer"
|
|
16742
|
+
ARRAYBUFFER: "arraybuffer",
|
|
16743
|
+
STREAM: "stream"
|
|
15833
16744
|
};
|
|
15834
16745
|
function createHeaders2(headersObj) {
|
|
15835
16746
|
const headers = {};
|
|
@@ -16416,6 +17327,165 @@ class ErrorFactory2 {
|
|
|
16416
17327
|
return new NetworkError2({ message });
|
|
16417
17328
|
}
|
|
16418
17329
|
}
|
|
17330
|
+
function toSearchParams2(params) {
|
|
17331
|
+
const searchParams = new URLSearchParams;
|
|
17332
|
+
if (!params)
|
|
17333
|
+
return searchParams;
|
|
17334
|
+
for (const [key, value] of Object.entries(params)) {
|
|
17335
|
+
if (value === undefined || value === null)
|
|
17336
|
+
continue;
|
|
17337
|
+
if (Array.isArray(value)) {
|
|
17338
|
+
value.forEach((item) => {
|
|
17339
|
+
if (item !== undefined && item !== null)
|
|
17340
|
+
searchParams.append(key, String(item));
|
|
17341
|
+
});
|
|
17342
|
+
} else {
|
|
17343
|
+
searchParams.append(key, String(value));
|
|
17344
|
+
}
|
|
17345
|
+
}
|
|
17346
|
+
return searchParams;
|
|
17347
|
+
}
|
|
17348
|
+
var DEFAULT_RETRYABLE_STATUS_CODES2 = [408, 429, 500, 502, 503, 504];
|
|
17349
|
+
var DEFAULT_RETRY_METHODS2 = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
|
|
17350
|
+
var DEFAULT_RETRY_OPTIONS2 = {
|
|
17351
|
+
maxRetries: 2,
|
|
17352
|
+
initialDelayMs: 500,
|
|
17353
|
+
backoffStrategy: "exponential",
|
|
17354
|
+
backoffFactor: 2,
|
|
17355
|
+
backoffMaxDelayMs: 30000,
|
|
17356
|
+
retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES2,
|
|
17357
|
+
retryMethods: DEFAULT_RETRY_METHODS2,
|
|
17358
|
+
retryNetworkErrors: true,
|
|
17359
|
+
respectRetryAfter: true,
|
|
17360
|
+
maxRetryAfterMs: Infinity
|
|
17361
|
+
};
|
|
17362
|
+
var DEFAULT_API_CLIENT_RETRY2 = {
|
|
17363
|
+
...DEFAULT_RETRY_OPTIONS2,
|
|
17364
|
+
maxRetries: 0
|
|
17365
|
+
};
|
|
17366
|
+
function resolveRetryOptions2(settings, defaults = DEFAULT_RETRY_OPTIONS2) {
|
|
17367
|
+
if (!settings)
|
|
17368
|
+
return defaults;
|
|
17369
|
+
const { retryDelay, useExponentialBackoff, ...live } = settings;
|
|
17370
|
+
const resolved = { ...defaults };
|
|
17371
|
+
for (const [key, value] of Object.entries(live)) {
|
|
17372
|
+
if (value !== undefined) {
|
|
17373
|
+
resolved[key] = value;
|
|
17374
|
+
}
|
|
17375
|
+
}
|
|
17376
|
+
if (retryDelay !== undefined && live.initialDelayMs === undefined) {
|
|
17377
|
+
resolved.initialDelayMs = retryDelay;
|
|
17378
|
+
}
|
|
17379
|
+
if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
|
|
17380
|
+
resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
|
|
17381
|
+
}
|
|
17382
|
+
return resolved;
|
|
17383
|
+
}
|
|
17384
|
+
function computeBackoffDelay2(attempt, settings) {
|
|
17385
|
+
const base = Math.max(0, settings.initialDelayMs);
|
|
17386
|
+
let delay;
|
|
17387
|
+
switch (settings.backoffStrategy) {
|
|
17388
|
+
case "constant":
|
|
17389
|
+
delay = base;
|
|
17390
|
+
break;
|
|
17391
|
+
case "linear":
|
|
17392
|
+
delay = base * (attempt + 1);
|
|
17393
|
+
break;
|
|
17394
|
+
default:
|
|
17395
|
+
delay = base * Math.pow(settings.backoffFactor, attempt);
|
|
17396
|
+
}
|
|
17397
|
+
return Math.min(delay, settings.backoffMaxDelayMs);
|
|
17398
|
+
}
|
|
17399
|
+
function parseRetryAfter2(value, now = Date.now()) {
|
|
17400
|
+
const trimmed = value?.trim();
|
|
17401
|
+
if (!trimmed)
|
|
17402
|
+
return;
|
|
17403
|
+
const seconds = Number(trimmed);
|
|
17404
|
+
if (Number.isFinite(seconds))
|
|
17405
|
+
return Math.max(0, seconds * 1000);
|
|
17406
|
+
const date2 = Date.parse(trimmed);
|
|
17407
|
+
if (Number.isNaN(date2))
|
|
17408
|
+
return;
|
|
17409
|
+
return Math.max(0, date2 - now);
|
|
17410
|
+
}
|
|
17411
|
+
function wait2(durationMs) {
|
|
17412
|
+
return new Promise((resolve) => setTimeout(resolve, Math.max(0, durationMs)));
|
|
17413
|
+
}
|
|
17414
|
+
var RETRY_AFTER2 = "retry-after";
|
|
17415
|
+
function createAttemptSignal2(timeoutMs, external) {
|
|
17416
|
+
if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
|
|
17417
|
+
return { signal: external, dispose: () => {} };
|
|
17418
|
+
const controller = new AbortController;
|
|
17419
|
+
const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
17420
|
+
const onExternalAbort = () => controller.abort(external?.reason);
|
|
17421
|
+
if (external) {
|
|
17422
|
+
if (external.aborted) {
|
|
17423
|
+
controller.abort(external.reason);
|
|
17424
|
+
} else {
|
|
17425
|
+
external.addEventListener("abort", onExternalAbort);
|
|
17426
|
+
}
|
|
17427
|
+
}
|
|
17428
|
+
return {
|
|
17429
|
+
signal: controller.signal,
|
|
17430
|
+
dispose: () => {
|
|
17431
|
+
clearTimeout(timer);
|
|
17432
|
+
external?.removeEventListener("abort", onExternalAbort);
|
|
17433
|
+
}
|
|
17434
|
+
};
|
|
17435
|
+
}
|
|
17436
|
+
function delayBeforeRetry2(durationMs, signal) {
|
|
17437
|
+
if (!signal)
|
|
17438
|
+
return wait2(durationMs);
|
|
17439
|
+
if (signal.aborted)
|
|
17440
|
+
return Promise.reject(signal.reason);
|
|
17441
|
+
return new Promise((resolve, reject) => {
|
|
17442
|
+
const onAbort = () => {
|
|
17443
|
+
clearTimeout(timer);
|
|
17444
|
+
reject(signal.reason);
|
|
17445
|
+
};
|
|
17446
|
+
const timer = setTimeout(() => {
|
|
17447
|
+
signal.removeEventListener("abort", onAbort);
|
|
17448
|
+
resolve();
|
|
17449
|
+
}, Math.max(0, durationMs));
|
|
17450
|
+
signal.addEventListener("abort", onAbort);
|
|
17451
|
+
});
|
|
17452
|
+
}
|
|
17453
|
+
async function fetchWithRetry2(url, init, options) {
|
|
17454
|
+
const settings = options.retry;
|
|
17455
|
+
const method = (init.method ?? "GET").toUpperCase();
|
|
17456
|
+
const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
|
|
17457
|
+
let attempt = 0;
|
|
17458
|
+
for (;; ) {
|
|
17459
|
+
const { signal, dispose } = createAttemptSignal2(options.timeoutMs, options.signal);
|
|
17460
|
+
let response;
|
|
17461
|
+
let failure;
|
|
17462
|
+
try {
|
|
17463
|
+
response = await fetch(url, { ...init, signal });
|
|
17464
|
+
} catch (error) {
|
|
17465
|
+
failure = error;
|
|
17466
|
+
} finally {
|
|
17467
|
+
dispose();
|
|
17468
|
+
}
|
|
17469
|
+
if (options.signal?.aborted && failure !== undefined)
|
|
17470
|
+
throw failure;
|
|
17471
|
+
if (response && !settings.retryableStatusCodes.includes(response.status))
|
|
17472
|
+
return response;
|
|
17473
|
+
if (failure !== undefined && !settings.retryNetworkErrors)
|
|
17474
|
+
throw failure;
|
|
17475
|
+
if (attempt >= retriesAllowed) {
|
|
17476
|
+
if (response)
|
|
17477
|
+
return response;
|
|
17478
|
+
throw failure;
|
|
17479
|
+
}
|
|
17480
|
+
const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter2(response.headers.get(RETRY_AFTER2)) : undefined;
|
|
17481
|
+
const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay2(attempt, settings);
|
|
17482
|
+
response?.body?.cancel().catch((error) => {
|
|
17483
|
+
console.warn("[UiPath SDK] Could not release a discarded response body:", error);
|
|
17484
|
+
});
|
|
17485
|
+
await delayBeforeRetry2(delay, options.signal);
|
|
17486
|
+
attempt++;
|
|
17487
|
+
}
|
|
17488
|
+
}
|
|
16419
17489
|
|
|
16420
17490
|
class ApiClient2 {
|
|
16421
17491
|
constructor(config2, executionContext, tokenManager, clientConfig = {}) {
|
|
@@ -16450,28 +17520,16 @@ class ApiClient2 {
|
|
|
16450
17520
|
[UIPATH_TRACEPARENT_ID2]: traceparentValue,
|
|
16451
17521
|
...options.headers
|
|
16452
17522
|
};
|
|
16453
|
-
const searchParams =
|
|
16454
|
-
if (options.params) {
|
|
16455
|
-
Object.entries(options.params).forEach(([key, value]) => {
|
|
16456
|
-
if (Array.isArray(value)) {
|
|
16457
|
-
value.forEach((item) => searchParams.append(key, String(item)));
|
|
16458
|
-
} else {
|
|
16459
|
-
searchParams.append(key, String(value));
|
|
16460
|
-
}
|
|
16461
|
-
});
|
|
16462
|
-
}
|
|
17523
|
+
const searchParams = toSearchParams2(options.params);
|
|
16463
17524
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
16464
17525
|
let body = undefined;
|
|
16465
17526
|
if (options.body) {
|
|
16466
17527
|
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
16467
17528
|
}
|
|
17529
|
+
const retrySettings = resolveRetryOptions2(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY2);
|
|
17530
|
+
const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
|
|
16468
17531
|
try {
|
|
16469
|
-
const response = await
|
|
16470
|
-
method,
|
|
16471
|
-
headers,
|
|
16472
|
-
body,
|
|
16473
|
-
signal: options.signal
|
|
16474
|
-
});
|
|
17532
|
+
const response = await fetchWithRetry2(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
|
|
16475
17533
|
if (!response.ok) {
|
|
16476
17534
|
const errorInfo = await errorResponseParser2.parse(response);
|
|
16477
17535
|
throw ErrorFactory2.createFromHttpStatus(response.status, errorInfo);
|
|
@@ -16585,6 +17643,12 @@ class PaginationManager2 {
|
|
|
16585
17643
|
return result;
|
|
16586
17644
|
}
|
|
16587
17645
|
}
|
|
17646
|
+
function missingConfigMessage2() {
|
|
17647
|
+
if (isBrowser2) {
|
|
17648
|
+
return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
|
|
17649
|
+
}
|
|
17650
|
+
return "UiPath SDK configuration not found. " + "In a UiPath coded function, pass the handler context: new UiPath(ctx). " + "Otherwise pass { baseUrl, orgName, tenantName, secret }, " + "or set UIPATH_BASE_URL, UIPATH_ORG_NAME, UIPATH_TENANT_NAME and UIPATH_ACCESS_TOKEN.";
|
|
17651
|
+
}
|
|
16588
17652
|
var REGISTRY_KEY3 = Symbol.for("@uipath/sdk-internals-registry");
|
|
16589
17653
|
var getGlobalStore2 = () => {
|
|
16590
17654
|
const globalObj = globalThis;
|
|
@@ -16593,6 +17657,7 @@ var getGlobalStore2 = () => {
|
|
|
16593
17657
|
}
|
|
16594
17658
|
return globalObj[REGISTRY_KEY3];
|
|
16595
17659
|
};
|
|
17660
|
+
var looksLikeUiPath2 = (instance) => typeof instance.initialize === "function";
|
|
16596
17661
|
|
|
16597
17662
|
class SDKInternalsRegistry2 {
|
|
16598
17663
|
static get store() {
|
|
@@ -16604,6 +17669,9 @@ class SDKInternalsRegistry2 {
|
|
|
16604
17669
|
static get(instance) {
|
|
16605
17670
|
const internals = this.store.get(instance);
|
|
16606
17671
|
if (!internals) {
|
|
17672
|
+
if (looksLikeUiPath2(instance)) {
|
|
17673
|
+
throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage2());
|
|
17674
|
+
}
|
|
16607
17675
|
throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
|
|
16608
17676
|
}
|
|
16609
17677
|
return internals;
|
|
@@ -16790,6 +17858,90 @@ function validateName2(resourceType, name) {
|
|
|
16790
17858
|
}
|
|
16791
17859
|
return trimmed;
|
|
16792
17860
|
}
|
|
17861
|
+
var GUID_REGEX2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17862
|
+
var UiPathMetaTags2;
|
|
17863
|
+
(function(UiPathMetaTags3) {
|
|
17864
|
+
UiPathMetaTags3["CLIENT_ID"] = "uipath:client-id";
|
|
17865
|
+
UiPathMetaTags3["SCOPE"] = "uipath:scope";
|
|
17866
|
+
UiPathMetaTags3["ORG_NAME"] = "uipath:org-name";
|
|
17867
|
+
UiPathMetaTags3["TENANT_NAME"] = "uipath:tenant-name";
|
|
17868
|
+
UiPathMetaTags3["BASE_URL"] = "uipath:base-url";
|
|
17869
|
+
UiPathMetaTags3["REDIRECT_URI"] = "uipath:redirect-uri";
|
|
17870
|
+
UiPathMetaTags3["CDN_BASE"] = "uipath:cdn-base";
|
|
17871
|
+
UiPathMetaTags3["APP_BASE"] = "uipath:app-base";
|
|
17872
|
+
UiPathMetaTags3["FOLDER_KEY"] = "uipath:folder-key";
|
|
17873
|
+
})(UiPathMetaTags2 || (UiPathMetaTags2 = {}));
|
|
17874
|
+
var UiPathElementIds2;
|
|
17875
|
+
(function(UiPathElementIds3) {
|
|
17876
|
+
UiPathElementIds3["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
17877
|
+
})(UiPathElementIds2 || (UiPathElementIds2 = {}));
|
|
17878
|
+
function isPlainObject2(value) {
|
|
17879
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17880
|
+
}
|
|
17881
|
+
function asResourceOverrides2(value) {
|
|
17882
|
+
if (!isPlainObject2(value))
|
|
17883
|
+
return;
|
|
17884
|
+
const table2 = {};
|
|
17885
|
+
for (const [key, properties] of Object.entries(value)) {
|
|
17886
|
+
if (!isPlainObject2(properties))
|
|
17887
|
+
continue;
|
|
17888
|
+
const bag = {};
|
|
17889
|
+
for (const [property, propertyValue] of Object.entries(properties)) {
|
|
17890
|
+
if (typeof propertyValue === "string")
|
|
17891
|
+
bag[property] = propertyValue;
|
|
17892
|
+
}
|
|
17893
|
+
table2[key] = bag;
|
|
17894
|
+
}
|
|
17895
|
+
return Object.keys(table2).length > 0 ? table2 : undefined;
|
|
17896
|
+
}
|
|
17897
|
+
function readFromDocument2() {
|
|
17898
|
+
if (!isBrowser2)
|
|
17899
|
+
return;
|
|
17900
|
+
const text = document.getElementById(UiPathElementIds2.RESOURCE_OVERRIDES)?.textContent;
|
|
17901
|
+
if (!text)
|
|
17902
|
+
return;
|
|
17903
|
+
try {
|
|
17904
|
+
return asResourceOverrides2(JSON.parse(text));
|
|
17905
|
+
} catch (error) {
|
|
17906
|
+
console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds2.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
|
|
17907
|
+
return;
|
|
17908
|
+
}
|
|
17909
|
+
}
|
|
17910
|
+
var table2;
|
|
17911
|
+
var loaded2 = false;
|
|
17912
|
+
var pageOverrides2 = () => {
|
|
17913
|
+
if (!loaded2) {
|
|
17914
|
+
loaded2 = true;
|
|
17915
|
+
table2 = readFromDocument2();
|
|
17916
|
+
}
|
|
17917
|
+
return table2;
|
|
17918
|
+
};
|
|
17919
|
+
var RESOURCE_OVERWRITES_KEY2 = Symbol.for("uipath.resourceOverwrites.v1");
|
|
17920
|
+
function readOverrides2() {
|
|
17921
|
+
const slot = globalThis[RESOURCE_OVERWRITES_KEY2];
|
|
17922
|
+
const source = typeof slot === "function" ? slot : pageOverrides2;
|
|
17923
|
+
try {
|
|
17924
|
+
return source();
|
|
17925
|
+
} catch (error) {
|
|
17926
|
+
console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
|
|
17927
|
+
return;
|
|
17928
|
+
}
|
|
17929
|
+
}
|
|
17930
|
+
function resolveOverride2(resourceType, name, folderPath) {
|
|
17931
|
+
const table3 = readOverrides2();
|
|
17932
|
+
if (!table3)
|
|
17933
|
+
return;
|
|
17934
|
+
const bindingType = resourceType.toLowerCase();
|
|
17935
|
+
const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
|
|
17936
|
+
const unscopedKey = `${bindingType}.${name}`;
|
|
17937
|
+
const entry = (scopedKey && table3[scopedKey]) ?? table3[unscopedKey];
|
|
17938
|
+
if (!entry)
|
|
17939
|
+
return;
|
|
17940
|
+
return {
|
|
17941
|
+
name: entry.name,
|
|
17942
|
+
folderPath: entry.folderPath
|
|
17943
|
+
};
|
|
17944
|
+
}
|
|
16793
17945
|
var SINGLE_QUOTE_RE2 = /'/g;
|
|
16794
17946
|
|
|
16795
17947
|
class FolderScopedService2 extends BaseService2 {
|
|
@@ -16806,20 +17958,23 @@ class FolderScopedService2 extends BaseService2 {
|
|
|
16806
17958
|
}
|
|
16807
17959
|
return response.data?.value;
|
|
16808
17960
|
}
|
|
16809
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
|
|
17961
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap, callerLabel) {
|
|
16810
17962
|
const validatedName = validateName2(resourceType, name);
|
|
16811
17963
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
17964
|
+
const override = resolveOverride2(resourceType, validatedName, folderPath);
|
|
17965
|
+
const resolvedName = override?.name ?? validatedName;
|
|
17966
|
+
const resolvedFolderPath = override?.folderPath ?? folderPath;
|
|
16812
17967
|
const headers = resolveFolderHeaders2({
|
|
16813
17968
|
folderId,
|
|
16814
17969
|
folderKey,
|
|
16815
|
-
folderPath,
|
|
16816
|
-
resourceType: `${resourceType}.getByName`,
|
|
17970
|
+
folderPath: resolvedFolderPath,
|
|
17971
|
+
resourceType: callerLabel ?? `${resourceType}.getByName`,
|
|
16817
17972
|
fallbackFolderKey: this.config.folderKey
|
|
16818
17973
|
});
|
|
16819
17974
|
const apiFieldOptions = responseFieldMap ? transformOptions2(queryOptions, responseFieldMap) : queryOptions;
|
|
16820
17975
|
const apiOptions = {
|
|
16821
17976
|
...addPrefixToKeys2(apiFieldOptions, ODATA_PREFIX2, Object.keys(apiFieldOptions)),
|
|
16822
|
-
$filter: `Name eq '${
|
|
17977
|
+
$filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE2, "''")}'`,
|
|
16823
17978
|
$top: "1"
|
|
16824
17979
|
};
|
|
16825
17980
|
const response = await this.get(endpoint, {
|
|
@@ -16828,12 +17983,48 @@ class FolderScopedService2 extends BaseService2 {
|
|
|
16828
17983
|
});
|
|
16829
17984
|
const items = response.data?.value;
|
|
16830
17985
|
if (!items?.length) {
|
|
16831
|
-
const folderHint = describeFolderForError2(folderId, folderKey,
|
|
17986
|
+
const folderHint = describeFolderForError2(folderId, folderKey, resolvedFolderPath);
|
|
16832
17987
|
throw new NotFoundError2({
|
|
16833
|
-
message: `${resourceType} '${
|
|
17988
|
+
message: `${resourceType} '${resolvedName}' not found${folderHint}.`
|
|
16834
17989
|
});
|
|
16835
17990
|
}
|
|
16836
|
-
return
|
|
17991
|
+
return {
|
|
17992
|
+
result: transform2(items[0]),
|
|
17993
|
+
effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
|
|
17994
|
+
};
|
|
17995
|
+
}
|
|
17996
|
+
async getByKeyLookup(resourceType, endpoint, key, options, transform2, responseFieldMap, callerLabel) {
|
|
17997
|
+
const label = callerLabel ?? `${resourceType}.getByKey`;
|
|
17998
|
+
const trimmedKey = key?.trim();
|
|
17999
|
+
if (!trimmedKey || !GUID_REGEX2.test(trimmedKey)) {
|
|
18000
|
+
throw new ValidationError2({ message: `${label}: key must be a GUID.` });
|
|
18001
|
+
}
|
|
18002
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
18003
|
+
const headers = resolveFolderHeaders2({
|
|
18004
|
+
folderId,
|
|
18005
|
+
folderKey,
|
|
18006
|
+
folderPath,
|
|
18007
|
+
resourceType: label,
|
|
18008
|
+
fallbackFolderKey: this.config.folderKey
|
|
18009
|
+
});
|
|
18010
|
+
const apiFieldOptions = responseFieldMap ? transformOptions2(queryOptions, responseFieldMap) : queryOptions;
|
|
18011
|
+
const apiOptions = {
|
|
18012
|
+
...addPrefixToKeys2(apiFieldOptions, ODATA_PREFIX2, Object.keys(apiFieldOptions)),
|
|
18013
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
18014
|
+
$top: "1"
|
|
18015
|
+
};
|
|
18016
|
+
const response = await this.get(endpoint, {
|
|
18017
|
+
headers,
|
|
18018
|
+
params: apiOptions
|
|
18019
|
+
});
|
|
18020
|
+
const items = response.data?.value;
|
|
18021
|
+
if (!items?.length) {
|
|
18022
|
+
throw new NotFoundError2({ message: `${resourceType} with key '${trimmedKey}' not found.` });
|
|
18023
|
+
}
|
|
18024
|
+
return {
|
|
18025
|
+
result: transform2(items[0]),
|
|
18026
|
+
effectiveFolder: { folderId, folderKey, folderPath }
|
|
18027
|
+
};
|
|
16837
18028
|
}
|
|
16838
18029
|
}
|
|
16839
18030
|
function describeFolderForError2(folderId, folderKey, folderPath) {
|
|
@@ -16864,12 +18055,16 @@ class TaskService2 extends FolderScopedService2 {
|
|
|
16864
18055
|
};
|
|
16865
18056
|
}
|
|
16866
18057
|
async create(task, folderId) {
|
|
18058
|
+
if (task.type === TaskType2.QuickForm && !task.taskSchemaKey) {
|
|
18059
|
+
throw new ValidationError2({ message: "taskSchemaKey is required when creating a QuickForm task." });
|
|
18060
|
+
}
|
|
16867
18061
|
const headers = createHeaders2({ [FOLDER_ID2]: folderId });
|
|
16868
|
-
const
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
18062
|
+
const { labels, type, ...rest } = task;
|
|
18063
|
+
const payload = { ...rest, type: type ?? TaskType2.External };
|
|
18064
|
+
if (labels?.length) {
|
|
18065
|
+
payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
|
|
18066
|
+
}
|
|
18067
|
+
const response = await this.post(TASK_ENDPOINTS2.CREATE_GENERIC_TASK, payload, { headers });
|
|
16873
18068
|
const normalizedData = transformData2(response.data, TaskMap2);
|
|
16874
18069
|
const transformedData = applyDataTransforms2(normalizedData, { field: "status", valueMap: TaskStatusMap2 });
|
|
16875
18070
|
return createTaskWithMethods2(transformedData, this);
|
|
@@ -17212,7 +18407,8 @@ class TaskCatalogService2 extends FolderScopedService2 {
|
|
|
17212
18407
|
return transformData2(pascalToCamelCaseKeys2(response.data), TaskCatalogMap2);
|
|
17213
18408
|
}
|
|
17214
18409
|
async getByName(name, options = {}) {
|
|
17215
|
-
|
|
18410
|
+
const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS2.GET_ALL, name, options, (raw) => transformData2(pascalToCamelCaseKeys2(raw), TaskCatalogMap2), TaskCatalogMap2);
|
|
18411
|
+
return result;
|
|
17216
18412
|
}
|
|
17217
18413
|
async create(name, options = {}) {
|
|
17218
18414
|
if (!name) {
|
|
@@ -17236,7 +18432,7 @@ class TaskCatalogService2 extends FolderScopedService2 {
|
|
|
17236
18432
|
throw new ValidationError2({ message: "name is required for updateByName" });
|
|
17237
18433
|
}
|
|
17238
18434
|
const { folderId, folderKey, folderPath } = options;
|
|
17239
|
-
const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS2.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData2(pascalToCamelCaseKeys2(raw), TaskCatalogMap2), TaskCatalogMap2);
|
|
18435
|
+
const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS2.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData2(pascalToCamelCaseKeys2(raw), TaskCatalogMap2), TaskCatalogMap2);
|
|
17240
18436
|
return this.update(current, options);
|
|
17241
18437
|
}
|
|
17242
18438
|
async update(current, options) {
|
|
@@ -17400,11 +18596,11 @@ async function resolveFolderScope(options) {
|
|
|
17400
18596
|
return parseIntArg(options.folderId, "--folder-id");
|
|
17401
18597
|
}
|
|
17402
18598
|
if (options.folderKey !== undefined) {
|
|
17403
|
-
const { resolveFolderIdByKey } = await import("./folder-resolver-
|
|
18599
|
+
const { resolveFolderIdByKey } = await import("./folder-resolver-66p6b3jy.js");
|
|
17404
18600
|
return resolveFolderIdByKey(options.folderKey, options.tenant);
|
|
17405
18601
|
}
|
|
17406
18602
|
if (options.folderPath !== undefined) {
|
|
17407
|
-
const { resolveFolderIdByPath } = await import("./folder-resolver-
|
|
18603
|
+
const { resolveFolderIdByPath } = await import("./folder-resolver-66p6b3jy.js");
|
|
17408
18604
|
return resolveFolderIdByPath(options.folderPath, options.tenant);
|
|
17409
18605
|
}
|
|
17410
18606
|
return;
|
|
@@ -17424,7 +18620,7 @@ async function resolveFolderId(options, missingFolderInstructions = DEFAULT_FOLD
|
|
|
17424
18620
|
processContext.exit(1);
|
|
17425
18621
|
return null;
|
|
17426
18622
|
}
|
|
17427
|
-
const { pickFolderInteractively } = await import("./folder-picker-interactive-
|
|
18623
|
+
const { pickFolderInteractively } = await import("./folder-picker-interactive-gyxze8wq.js");
|
|
17428
18624
|
return pickFolderInteractively(options.tenant);
|
|
17429
18625
|
}
|
|
17430
18626
|
|
|
@@ -18246,4 +19442,4 @@ var registerCommands = async (program) => {
|
|
|
18246
19442
|
|
|
18247
19443
|
export { metadata, registerCommands };
|
|
18248
19444
|
|
|
18249
|
-
//# debugId=
|
|
19445
|
+
//# debugId=59A9405957AD83AD64756E2164756E21
|