@uipath/conversational-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 +35 -3
- package/dist/{cas-client-vx8tygss.js → cas-client-pgtr3hgy.js} +1 -1
- package/dist/{index-xzshjcwa.js → index-a3nybs0a.js} +226 -19
- package/dist/index.js +2 -2
- package/dist/{tool-sz8zdfbv.js → tool-azng6dhs.js} +3 -3
- package/dist/{tool-9mezv9yv.js → tool-c5fdrxt4.js} +1188 -280
- package/dist/tool.js +2 -2
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
parseBoundedInt,
|
|
21
21
|
processContext,
|
|
22
22
|
requireConfirmation
|
|
23
|
-
} from "./tool-
|
|
23
|
+
} from "./tool-azng6dhs.js";
|
|
24
24
|
import {
|
|
25
25
|
__require
|
|
26
26
|
} from "./tool-1yh8g550.js";
|
|
@@ -210,7 +210,7 @@ var allowsEval = cached(() => {
|
|
|
210
210
|
return false;
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
function isPlainObject(o) {
|
|
213
|
+
function isPlainObject$1(o) {
|
|
214
214
|
if (isObject(o) === false)
|
|
215
215
|
return false;
|
|
216
216
|
const ctor = o.constructor;
|
|
@@ -227,7 +227,7 @@ function isPlainObject(o) {
|
|
|
227
227
|
return true;
|
|
228
228
|
}
|
|
229
229
|
function shallowClone(o) {
|
|
230
|
-
if (isPlainObject(o))
|
|
230
|
+
if (isPlainObject$1(o))
|
|
231
231
|
return { ...o };
|
|
232
232
|
if (Array.isArray(o))
|
|
233
233
|
return [...o];
|
|
@@ -315,7 +315,7 @@ function omit(schema, mask) {
|
|
|
315
315
|
return clone(schema, def);
|
|
316
316
|
}
|
|
317
317
|
function extend(schema, shape) {
|
|
318
|
-
if (!isPlainObject(shape)) {
|
|
318
|
+
if (!isPlainObject$1(shape)) {
|
|
319
319
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
320
320
|
}
|
|
321
321
|
const checks = schema._zod.def.checks;
|
|
@@ -338,7 +338,7 @@ function extend(schema, shape) {
|
|
|
338
338
|
return clone(schema, def);
|
|
339
339
|
}
|
|
340
340
|
function safeExtend(schema, shape) {
|
|
341
|
-
if (!isPlainObject(shape)) {
|
|
341
|
+
if (!isPlainObject$1(shape)) {
|
|
342
342
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
343
343
|
}
|
|
344
344
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -675,6 +675,7 @@ var string$1 = (params) => {
|
|
|
675
675
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
676
676
|
return new RegExp(`^${regex}$`);
|
|
677
677
|
};
|
|
678
|
+
var boolean$1 = /^(?:true|false)$/i;
|
|
678
679
|
var lowercase = /^[^A-Z]*$/;
|
|
679
680
|
var uppercase = /^[^a-z]*$/;
|
|
680
681
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -1343,6 +1344,26 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1343
1344
|
});
|
|
1344
1345
|
};
|
|
1345
1346
|
});
|
|
1347
|
+
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1348
|
+
$ZodType.init(inst, def);
|
|
1349
|
+
inst._zod.pattern = boolean$1;
|
|
1350
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1351
|
+
if (def.coerce)
|
|
1352
|
+
try {
|
|
1353
|
+
payload.value = Boolean(payload.value);
|
|
1354
|
+
} catch (_) {}
|
|
1355
|
+
const input = payload.value;
|
|
1356
|
+
if (typeof input === "boolean")
|
|
1357
|
+
return payload;
|
|
1358
|
+
payload.issues.push({
|
|
1359
|
+
expected: "boolean",
|
|
1360
|
+
code: "invalid_type",
|
|
1361
|
+
input,
|
|
1362
|
+
inst
|
|
1363
|
+
});
|
|
1364
|
+
return payload;
|
|
1365
|
+
};
|
|
1366
|
+
});
|
|
1346
1367
|
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1347
1368
|
$ZodType.init(inst, def);
|
|
1348
1369
|
inst._zod.parse = (payload) => payload;
|
|
@@ -1713,7 +1734,7 @@ function mergeValues(a, b) {
|
|
|
1713
1734
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
1714
1735
|
return { valid: true, data: a };
|
|
1715
1736
|
}
|
|
1716
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1737
|
+
if (isPlainObject$1(a) && isPlainObject$1(b)) {
|
|
1717
1738
|
const bKeys = Object.keys(b);
|
|
1718
1739
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1719
1740
|
const newObj = { ...a, ...b };
|
|
@@ -2068,7 +2089,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2068
2089
|
payload.issues.push(issue(_iss));
|
|
2069
2090
|
}
|
|
2070
2091
|
}
|
|
2071
|
-
var _a;
|
|
2092
|
+
var _a$1;
|
|
2072
2093
|
|
|
2073
2094
|
class $ZodRegistry {
|
|
2074
2095
|
constructor() {
|
|
@@ -2113,7 +2134,7 @@ class $ZodRegistry {
|
|
|
2113
2134
|
function registry() {
|
|
2114
2135
|
return new $ZodRegistry;
|
|
2115
2136
|
}
|
|
2116
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2137
|
+
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry());
|
|
2117
2138
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
2118
2139
|
function _string(Class, params) {
|
|
2119
2140
|
return new Class({
|
|
@@ -2358,6 +2379,12 @@ function _isoDuration(Class, params) {
|
|
|
2358
2379
|
...normalizeParams(params)
|
|
2359
2380
|
});
|
|
2360
2381
|
}
|
|
2382
|
+
function _boolean(Class, params) {
|
|
2383
|
+
return new Class({
|
|
2384
|
+
type: "boolean",
|
|
2385
|
+
...normalizeParams(params)
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2361
2388
|
function _unknown(Class) {
|
|
2362
2389
|
return new Class({
|
|
2363
2390
|
type: "unknown"
|
|
@@ -2523,7 +2550,7 @@ function initializeContext(params) {
|
|
|
2523
2550
|
};
|
|
2524
2551
|
}
|
|
2525
2552
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
2526
|
-
var
|
|
2553
|
+
var _a;
|
|
2527
2554
|
const def = schema._zod.def;
|
|
2528
2555
|
const seen = ctx.seen.get(schema);
|
|
2529
2556
|
if (seen) {
|
|
@@ -2571,7 +2598,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
2571
2598
|
delete result.schema.default;
|
|
2572
2599
|
}
|
|
2573
2600
|
if (ctx.io === "input" && result.schema._prefault)
|
|
2574
|
-
(
|
|
2601
|
+
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
2575
2602
|
delete result.schema._prefault;
|
|
2576
2603
|
const _result = ctx.seen.get(schema);
|
|
2577
2604
|
return _result.schema;
|
|
@@ -2888,6 +2915,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
2888
2915
|
}
|
|
2889
2916
|
}
|
|
2890
2917
|
};
|
|
2918
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
2919
|
+
json.type = "boolean";
|
|
2920
|
+
};
|
|
2891
2921
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
2892
2922
|
json.not = {};
|
|
2893
2923
|
};
|
|
@@ -3346,6 +3376,14 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
3346
3376
|
$ZodJWT.init(inst, def);
|
|
3347
3377
|
ZodStringFormat.init(inst, def);
|
|
3348
3378
|
});
|
|
3379
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
3380
|
+
$ZodBoolean.init(inst, def);
|
|
3381
|
+
ZodType.init(inst, def);
|
|
3382
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
|
|
3383
|
+
});
|
|
3384
|
+
function boolean(params) {
|
|
3385
|
+
return _boolean(ZodBoolean, params);
|
|
3386
|
+
}
|
|
3349
3387
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
3350
3388
|
$ZodUnknown.init(inst, def);
|
|
3351
3389
|
ZodType.init(inst, def);
|
|
@@ -3656,7 +3694,8 @@ object({
|
|
|
3656
3694
|
secret: string().optional(),
|
|
3657
3695
|
clientId: string().optional(),
|
|
3658
3696
|
redirectUri: string().url().optional(),
|
|
3659
|
-
scope: string().optional()
|
|
3697
|
+
scope: string().optional(),
|
|
3698
|
+
enforceSso: boolean().optional()
|
|
3660
3699
|
});
|
|
3661
3700
|
|
|
3662
3701
|
class UiPathConfig {
|
|
@@ -3668,6 +3707,7 @@ class UiPathConfig {
|
|
|
3668
3707
|
this.clientId = options.clientId;
|
|
3669
3708
|
this.redirectUri = options.redirectUri;
|
|
3670
3709
|
this.scope = options.scope;
|
|
3710
|
+
this.enforceSso = options.enforceSso;
|
|
3671
3711
|
}
|
|
3672
3712
|
}
|
|
3673
3713
|
|
|
@@ -3870,6 +3910,7 @@ var TaskType;
|
|
|
3870
3910
|
TaskType2["DocumentValidation"] = "DocumentValidationTask";
|
|
3871
3911
|
TaskType2["DocumentClassification"] = "DocumentClassificationTask";
|
|
3872
3912
|
TaskType2["DataLabeling"] = "DataLabelingTask";
|
|
3913
|
+
TaskType2["QuickForm"] = "QuickFormTask";
|
|
3873
3914
|
})(TaskType || (TaskType = {}));
|
|
3874
3915
|
var TaskPriority;
|
|
3875
3916
|
(function(TaskPriority2) {
|
|
@@ -3982,7 +4023,11 @@ var PROCESS_ENDPOINTS = {
|
|
|
3982
4023
|
var QUEUE_ENDPOINTS = {
|
|
3983
4024
|
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
3984
4025
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
3985
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})
|
|
4026
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
4027
|
+
GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
|
|
4028
|
+
ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
|
|
4029
|
+
START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
|
|
4030
|
+
SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
|
|
3986
4031
|
};
|
|
3987
4032
|
var JOB_ENDPOINTS = {
|
|
3988
4033
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
@@ -4029,6 +4074,10 @@ var MAESTRO_ENDPOINTS = {
|
|
|
4029
4074
|
TRACES: {
|
|
4030
4075
|
GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`
|
|
4031
4076
|
},
|
|
4077
|
+
BUSINESS_APPS: {
|
|
4078
|
+
COLLECTION: `${PIMS_BASE}/api/v1/business-apps`,
|
|
4079
|
+
BY_ID: (businessAppId) => `${PIMS_BASE}/api/v1/business-apps/${businessAppId}`
|
|
4080
|
+
},
|
|
4032
4081
|
CASES: {
|
|
4033
4082
|
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
4034
4083
|
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
@@ -4063,13 +4112,24 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
4063
4112
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4064
4113
|
UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
|
|
4065
4114
|
DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
|
|
4066
|
-
|
|
4115
|
+
UPDATE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
|
|
4067
4116
|
QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
|
|
4068
4117
|
QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
|
|
4069
4118
|
BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
|
|
4070
4119
|
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4071
4120
|
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4072
|
-
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}
|
|
4121
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4122
|
+
GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/Entity/${entityName}/metadata`,
|
|
4123
|
+
GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/read`,
|
|
4124
|
+
GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v2/EntityService/${entityName}/read/${recordId}`,
|
|
4125
|
+
INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert`,
|
|
4126
|
+
BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/insert-batch`,
|
|
4127
|
+
UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update/${recordId}`,
|
|
4128
|
+
UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/update-batch`,
|
|
4129
|
+
DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete/${recordId}`,
|
|
4130
|
+
DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/delete-batch`,
|
|
4131
|
+
BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
|
|
4132
|
+
ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
|
|
4073
4133
|
},
|
|
4074
4134
|
CHOICESETS: {
|
|
4075
4135
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -4092,7 +4152,8 @@ var DATA_FABRIC_ENDPOINTS = {
|
|
|
4092
4152
|
};
|
|
4093
4153
|
var IDENTITY_ENDPOINTS = {
|
|
4094
4154
|
TOKEN: `${IDENTITY_BASE}/connect/token`,
|
|
4095
|
-
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize
|
|
4155
|
+
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
|
|
4156
|
+
END_SESSION: `${IDENTITY_BASE}/connect/endsession`
|
|
4096
4157
|
};
|
|
4097
4158
|
var TASK_TYPE_ENDPOINTS = {
|
|
4098
4159
|
[TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
|
|
@@ -4100,7 +4161,8 @@ var TASK_TYPE_ENDPOINTS = {
|
|
|
4100
4161
|
[TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
4101
4162
|
[TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
4102
4163
|
[TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
4103
|
-
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
4164
|
+
[TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
|
|
4165
|
+
[TaskType.QuickForm]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID
|
|
4104
4166
|
};
|
|
4105
4167
|
var ActionCenterEventNames;
|
|
4106
4168
|
(function(ActionCenterEventNames2) {
|
|
@@ -4108,29 +4170,12 @@ var ActionCenterEventNames;
|
|
|
4108
4170
|
ActionCenterEventNames2["REFRESHTOKEN"] = "AC.refreshToken";
|
|
4109
4171
|
})(ActionCenterEventNames || (ActionCenterEventNames = {}));
|
|
4110
4172
|
var AUTHENTICATION_TIMEOUT = 8000;
|
|
4111
|
-
var ALLOWED_HOST_ORIGINS = new Set([
|
|
4112
|
-
"https://alpha.uipath.com",
|
|
4113
|
-
"https://staging.uipath.com",
|
|
4114
|
-
"https://cloud.uipath.com"
|
|
4115
|
-
]);
|
|
4116
|
-
function isValidHostOrigin(origin) {
|
|
4117
|
-
if (!origin)
|
|
4118
|
-
return false;
|
|
4119
|
-
if (ALLOWED_HOST_ORIGINS.has(origin))
|
|
4120
|
-
return true;
|
|
4121
|
-
try {
|
|
4122
|
-
return new URL(origin).hostname === "localhost";
|
|
4123
|
-
} catch {
|
|
4124
|
-
console.warn("isValidHostOrigin: received a malformed origin URL", origin);
|
|
4125
|
-
return false;
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
4173
|
function isTokenExpired(tokenInfo) {
|
|
4129
4174
|
if (!tokenInfo?.expiresAt)
|
|
4130
4175
|
return true;
|
|
4131
4176
|
return new Date >= tokenInfo.expiresAt;
|
|
4132
4177
|
}
|
|
4133
|
-
var
|
|
4178
|
+
var hostEmbeddingOrigin = isHostEmbedded && embeddingOrigin ? embeddingOrigin : null;
|
|
4134
4179
|
function waitForMessage(filter, signal) {
|
|
4135
4180
|
return new Promise((resolve, reject) => {
|
|
4136
4181
|
const handler = (event) => {
|
|
@@ -4199,12 +4244,6 @@ class ActionCenterTokenManager {
|
|
|
4199
4244
|
statusCode: HttpStatus.UNAUTHORIZED
|
|
4200
4245
|
}));
|
|
4201
4246
|
}
|
|
4202
|
-
if (!isValidHostOrigin(parentOrigin)) {
|
|
4203
|
-
return Promise.reject(new AuthenticationError({
|
|
4204
|
-
message: "Cannot refresh token: basedomain is not a trusted UiPath host origin",
|
|
4205
|
-
statusCode: HttpStatus.UNAUTHORIZED
|
|
4206
|
-
}));
|
|
4207
|
-
}
|
|
4208
4247
|
const { promise } = requestHostToken({
|
|
4209
4248
|
pinnedOrigin: parentOrigin,
|
|
4210
4249
|
sendRequest: () => this.sendMessageToParent(ActionCenterEventNames.REFRESHTOKEN, {
|
|
@@ -4228,7 +4267,7 @@ class ActionCenterTokenManager {
|
|
|
4228
4267
|
}
|
|
4229
4268
|
}
|
|
4230
4269
|
sendMessageToParent(eventType, content) {
|
|
4231
|
-
if (window.parent &&
|
|
4270
|
+
if (window.parent && this.parentOrigin) {
|
|
4232
4271
|
try {
|
|
4233
4272
|
window.parent.postMessage({ eventType, content }, this.parentOrigin);
|
|
4234
4273
|
} catch (error) {
|
|
@@ -4308,7 +4347,7 @@ class EmbeddedTokenManager {
|
|
|
4308
4347
|
this.cancelRefresh?.();
|
|
4309
4348
|
}
|
|
4310
4349
|
}
|
|
4311
|
-
var SDK_VERSION = "1.
|
|
4350
|
+
var SDK_VERSION = "1.7.1";
|
|
4312
4351
|
var CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
4313
4352
|
var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
4314
4353
|
var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
@@ -4374,19 +4413,21 @@ function base64UrlToBase64(value) {
|
|
|
4374
4413
|
const base642 = value.replace(BASE64URL_DASH_RE, "+").replace(BASE64URL_UNDERSCORE_RE, "/");
|
|
4375
4414
|
return base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "=");
|
|
4376
4415
|
}
|
|
4377
|
-
function
|
|
4416
|
+
function decodeJwtClaims(token) {
|
|
4378
4417
|
try {
|
|
4379
|
-
const payload = token
|
|
4418
|
+
const payload = token?.split(".")[1];
|
|
4380
4419
|
if (!payload) {
|
|
4381
|
-
return
|
|
4420
|
+
return;
|
|
4382
4421
|
}
|
|
4383
|
-
|
|
4384
|
-
const sub = claims["sub"];
|
|
4385
|
-
return typeof sub === "string" && sub ? sub : "";
|
|
4422
|
+
return JSON.parse(decodeBase64(base64UrlToBase64(payload)));
|
|
4386
4423
|
} catch {
|
|
4387
|
-
return
|
|
4424
|
+
return;
|
|
4388
4425
|
}
|
|
4389
4426
|
}
|
|
4427
|
+
function extractUserIdFromToken(token) {
|
|
4428
|
+
const sub = decodeJwtClaims(token)?.["sub"];
|
|
4429
|
+
return typeof sub === "string" && sub ? sub : "";
|
|
4430
|
+
}
|
|
4390
4431
|
|
|
4391
4432
|
class TokenManager {
|
|
4392
4433
|
constructor(executionContext, config2, isOAuth = false) {
|
|
@@ -4399,8 +4440,8 @@ class TokenManager {
|
|
|
4399
4440
|
if (isInActionCenter) {
|
|
4400
4441
|
this.actionCenterTokenManager = new ActionCenterTokenManager(config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
4401
4442
|
this.isOAuth = false;
|
|
4402
|
-
} else if (
|
|
4403
|
-
this.embeddedTokenManager = new EmbeddedTokenManager(
|
|
4443
|
+
} else if (hostEmbeddingOrigin) {
|
|
4444
|
+
this.embeddedTokenManager = new EmbeddedTokenManager(hostEmbeddingOrigin, config2, (tokenInfo) => this.setToken(tokenInfo));
|
|
4404
4445
|
this.isOAuth = false;
|
|
4405
4446
|
}
|
|
4406
4447
|
}
|
|
@@ -4511,6 +4552,9 @@ class TokenManager {
|
|
|
4511
4552
|
getToken() {
|
|
4512
4553
|
return this.currentToken?.token;
|
|
4513
4554
|
}
|
|
4555
|
+
getIdToken() {
|
|
4556
|
+
return this.currentToken?.idToken;
|
|
4557
|
+
}
|
|
4514
4558
|
hasValidToken() {
|
|
4515
4559
|
if (!this.currentToken) {
|
|
4516
4560
|
return false;
|
|
@@ -4582,11 +4626,13 @@ class TokenManager {
|
|
|
4582
4626
|
token: token.access_token,
|
|
4583
4627
|
type: "oauth",
|
|
4584
4628
|
expiresAt: new Date(Date.now() + token.expires_in * 1000),
|
|
4585
|
-
refreshToken: token.refresh_token
|
|
4629
|
+
refreshToken: token.refresh_token,
|
|
4630
|
+
idToken: token.id_token ?? tokenInfo.idToken
|
|
4586
4631
|
});
|
|
4587
4632
|
return token;
|
|
4588
4633
|
}
|
|
4589
4634
|
}
|
|
4635
|
+
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;
|
|
4590
4636
|
|
|
4591
4637
|
class AuthService {
|
|
4592
4638
|
constructor(config2, executionContext) {
|
|
@@ -4720,7 +4766,11 @@ class AuthService {
|
|
|
4720
4766
|
hasValidToken() {
|
|
4721
4767
|
return this.tokenManager.hasValidToken();
|
|
4722
4768
|
}
|
|
4723
|
-
logout() {
|
|
4769
|
+
logout(options) {
|
|
4770
|
+
const idTokenHint = options?.endSession ? this.tokenManager.getIdToken() : undefined;
|
|
4771
|
+
if (options?.endSession && isBrowser && !idTokenHint) {
|
|
4772
|
+
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.");
|
|
4773
|
+
}
|
|
4724
4774
|
this.tokenManager.clearToken();
|
|
4725
4775
|
if (isBrowser) {
|
|
4726
4776
|
try {
|
|
@@ -4730,6 +4780,12 @@ class AuthService {
|
|
|
4730
4780
|
console.warn("Failed to clear OAuth context from session storage", error);
|
|
4731
4781
|
}
|
|
4732
4782
|
}
|
|
4783
|
+
if (options?.endSession && isBrowser && idTokenHint) {
|
|
4784
|
+
window.location.href = this._buildEndSessionUrl({
|
|
4785
|
+
idTokenHint,
|
|
4786
|
+
postLogoutRedirectUri: this.config.redirectUri
|
|
4787
|
+
});
|
|
4788
|
+
}
|
|
4733
4789
|
}
|
|
4734
4790
|
getToken() {
|
|
4735
4791
|
if (!this.tokenManager.hasValidToken()) {
|
|
@@ -4773,10 +4829,27 @@ class AuthService {
|
|
|
4773
4829
|
redirect_uri: params.redirectUri,
|
|
4774
4830
|
code_challenge: params.codeChallenge,
|
|
4775
4831
|
code_challenge_method: "S256",
|
|
4776
|
-
scope: params.scope + " offline_access",
|
|
4832
|
+
scope: params.scope + " offline_access openid",
|
|
4777
4833
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
4778
4834
|
});
|
|
4779
|
-
|
|
4835
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
4836
|
+
if (!this.config.enforceSso) {
|
|
4837
|
+
return authorizeUrl;
|
|
4838
|
+
}
|
|
4839
|
+
const orgName = this.config.orgName;
|
|
4840
|
+
if (!GUID_REGEX$1.test(orgName)) {
|
|
4841
|
+
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.");
|
|
4842
|
+
return authorizeUrl;
|
|
4843
|
+
}
|
|
4844
|
+
return `${authorizeUrl}&acr_values=${encodeURIComponent(`tenant:${orgName}`)}`;
|
|
4845
|
+
}
|
|
4846
|
+
_buildEndSessionUrl(params) {
|
|
4847
|
+
const queryParams = new URLSearchParams;
|
|
4848
|
+
queryParams.set("id_token_hint", params.idTokenHint);
|
|
4849
|
+
if (params.postLogoutRedirectUri) {
|
|
4850
|
+
queryParams.set("post_logout_redirect_uri", params.postLogoutRedirectUri);
|
|
4851
|
+
}
|
|
4852
|
+
return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.END_SESSION}?${queryParams.toString()}`;
|
|
4780
4853
|
}
|
|
4781
4854
|
async _getAccessToken(params) {
|
|
4782
4855
|
const body = new URLSearchParams({
|
|
@@ -4803,7 +4876,8 @@ class AuthService {
|
|
|
4803
4876
|
token: token.access_token,
|
|
4804
4877
|
type: "oauth",
|
|
4805
4878
|
expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
|
|
4806
|
-
refreshToken: token.refresh_token
|
|
4879
|
+
refreshToken: token.refresh_token,
|
|
4880
|
+
idToken: token.id_token
|
|
4807
4881
|
});
|
|
4808
4882
|
return token;
|
|
4809
4883
|
}
|
|
@@ -4876,9 +4950,18 @@ function validateConfig(config2) {
|
|
|
4876
4950
|
function isCompleteConfig(config2) {
|
|
4877
4951
|
return hasRequiredBaseFields(config2) && hasValidAuthConfig(config2);
|
|
4878
4952
|
}
|
|
4953
|
+
function compactConfig(config2) {
|
|
4954
|
+
return Object.fromEntries(Object.entries(config2).filter(([, value]) => value !== undefined));
|
|
4955
|
+
}
|
|
4879
4956
|
function normalizeBaseUrl(url) {
|
|
4880
4957
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
4881
4958
|
}
|
|
4959
|
+
function missingConfigMessage() {
|
|
4960
|
+
if (isBrowser) {
|
|
4961
|
+
return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
|
|
4962
|
+
}
|
|
4963
|
+
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.";
|
|
4964
|
+
}
|
|
4882
4965
|
var REGISTRY_KEY = Symbol.for("@uipath/sdk-internals-registry");
|
|
4883
4966
|
var getGlobalStore = () => {
|
|
4884
4967
|
const globalObj = globalThis;
|
|
@@ -4887,6 +4970,7 @@ var getGlobalStore = () => {
|
|
|
4887
4970
|
}
|
|
4888
4971
|
return globalObj[REGISTRY_KEY];
|
|
4889
4972
|
};
|
|
4973
|
+
var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
|
|
4890
4974
|
|
|
4891
4975
|
class SDKInternalsRegistry {
|
|
4892
4976
|
static get store() {
|
|
@@ -4898,6 +4982,9 @@ class SDKInternalsRegistry {
|
|
|
4898
4982
|
static get(instance) {
|
|
4899
4983
|
const internals = this.store.get(instance);
|
|
4900
4984
|
if (!internals) {
|
|
4985
|
+
if (looksLikeUiPath(instance)) {
|
|
4986
|
+
throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
|
|
4987
|
+
}
|
|
4901
4988
|
throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
|
|
4902
4989
|
}
|
|
4903
4990
|
return internals;
|
|
@@ -4915,6 +5002,10 @@ var UiPathMetaTags;
|
|
|
4915
5002
|
UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
|
|
4916
5003
|
UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
|
|
4917
5004
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
5005
|
+
var UiPathElementIds;
|
|
5006
|
+
(function(UiPathElementIds2) {
|
|
5007
|
+
UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
5008
|
+
})(UiPathElementIds || (UiPathElementIds = {}));
|
|
4918
5009
|
function getMetaTagContent(name) {
|
|
4919
5010
|
if (!isBrowser)
|
|
4920
5011
|
return;
|
|
@@ -4935,7 +5026,54 @@ function loadFromMetaTags() {
|
|
|
4935
5026
|
const hasAnyValue = Object.values(config2).some(Boolean);
|
|
4936
5027
|
return hasAnyValue ? config2 : null;
|
|
4937
5028
|
}
|
|
5029
|
+
function readEnv(name) {
|
|
5030
|
+
const globals = globalThis;
|
|
5031
|
+
try {
|
|
5032
|
+
const fromNode = globals.process?.env?.[name];
|
|
5033
|
+
if (fromNode)
|
|
5034
|
+
return fromNode;
|
|
5035
|
+
} catch {}
|
|
5036
|
+
try {
|
|
5037
|
+
const fromDeno = globals.Deno?.env?.get?.(name);
|
|
5038
|
+
if (fromDeno)
|
|
5039
|
+
return fromDeno;
|
|
5040
|
+
} catch {}
|
|
5041
|
+
return;
|
|
5042
|
+
}
|
|
5043
|
+
var UiPathEnvVars = {
|
|
5044
|
+
BASE_URL: "UIPATH_BASE_URL",
|
|
5045
|
+
ORG_NAME: "UIPATH_ORG_NAME",
|
|
5046
|
+
TENANT_NAME: "UIPATH_TENANT_NAME",
|
|
5047
|
+
ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
|
|
5048
|
+
};
|
|
5049
|
+
function loadFromEnvironment() {
|
|
5050
|
+
if (isBrowser)
|
|
5051
|
+
return null;
|
|
5052
|
+
const config2 = {
|
|
5053
|
+
baseUrl: readEnv(UiPathEnvVars.BASE_URL),
|
|
5054
|
+
orgName: readEnv(UiPathEnvVars.ORG_NAME),
|
|
5055
|
+
tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
|
|
5056
|
+
secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
|
|
5057
|
+
};
|
|
5058
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
5059
|
+
}
|
|
5060
|
+
function isFunctionContext(value) {
|
|
5061
|
+
return "platform" in value || "robot" in value;
|
|
5062
|
+
}
|
|
5063
|
+
function configFromFunctionContext(context) {
|
|
5064
|
+
const { platform, robot } = context;
|
|
5065
|
+
if (!platform)
|
|
5066
|
+
return null;
|
|
5067
|
+
const config2 = {
|
|
5068
|
+
baseUrl: platform.baseUrl,
|
|
5069
|
+
orgName: platform.orgId,
|
|
5070
|
+
tenantName: platform.tenantId,
|
|
5071
|
+
secret: robot?.accessToken ?? undefined
|
|
5072
|
+
};
|
|
5073
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
5074
|
+
}
|
|
4938
5075
|
var _UiPath_instances;
|
|
5076
|
+
var _a;
|
|
4939
5077
|
var _UiPath_config;
|
|
4940
5078
|
var _UiPath_authService;
|
|
4941
5079
|
var _UiPath_initialized;
|
|
@@ -4944,6 +5082,7 @@ var _UiPath_metaFolderKey;
|
|
|
4944
5082
|
var _UiPath_metaOrgId;
|
|
4945
5083
|
var _UiPath_metaTenantId;
|
|
4946
5084
|
var _UiPath_initializeWithConfig;
|
|
5085
|
+
var _UiPath_mergeConfigSources;
|
|
4947
5086
|
var _UiPath_loadConfig;
|
|
4948
5087
|
var UiPath$1 = class UiPath {
|
|
4949
5088
|
constructor(config2) {
|
|
@@ -4955,15 +5094,16 @@ var UiPath$1 = class UiPath {
|
|
|
4955
5094
|
_UiPath_metaFolderKey.set(this, undefined);
|
|
4956
5095
|
_UiPath_metaOrgId.set(this, undefined);
|
|
4957
5096
|
_UiPath_metaTenantId.set(this, undefined);
|
|
5097
|
+
const resolved = config2 && isFunctionContext(config2) ? configFromFunctionContext(config2) ?? undefined : config2;
|
|
4958
5098
|
const configFromMetaTags = loadFromMetaTags();
|
|
4959
5099
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
4960
5100
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
|
|
4961
5101
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
|
|
4962
|
-
const mergedConfig =
|
|
5102
|
+
const mergedConfig = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, configFromMetaTags, resolved);
|
|
4963
5103
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
4964
5104
|
__classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
|
|
4965
|
-
} else if (
|
|
4966
|
-
__classPrivateFieldSet(this, _UiPath_partialConfig,
|
|
5105
|
+
} else if (resolved) {
|
|
5106
|
+
__classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
|
|
4967
5107
|
}
|
|
4968
5108
|
}
|
|
4969
5109
|
async initialize() {
|
|
@@ -5028,18 +5168,18 @@ var UiPath$1 = class UiPath {
|
|
|
5028
5168
|
destroy() {
|
|
5029
5169
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.getTokenManager()?.destroy();
|
|
5030
5170
|
}
|
|
5031
|
-
logout() {
|
|
5171
|
+
logout(options) {
|
|
5032
5172
|
if (__classPrivateFieldGet(this, _UiPath_config, "f") && hasSecretConfig(__classPrivateFieldGet(this, _UiPath_config, "f"))) {
|
|
5033
5173
|
return;
|
|
5034
5174
|
}
|
|
5035
|
-
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
|
|
5175
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout(options);
|
|
5036
5176
|
__classPrivateFieldSet(this, _UiPath_initialized, false, "f");
|
|
5037
5177
|
}
|
|
5038
5178
|
updateToken(tokenInfo) {
|
|
5039
5179
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5040
5180
|
}
|
|
5041
5181
|
};
|
|
5042
|
-
_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) {
|
|
5182
|
+
_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) {
|
|
5043
5183
|
validateConfig(config2);
|
|
5044
5184
|
const hasSecretAuth = hasSecretConfig(config2);
|
|
5045
5185
|
const hasOAuthAuth = hasOAuthConfig(config2);
|
|
@@ -5050,7 +5190,8 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
5050
5190
|
secret: hasSecretAuth ? config2.secret : undefined,
|
|
5051
5191
|
clientId: hasOAuthAuth ? config2.clientId : undefined,
|
|
5052
5192
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined,
|
|
5053
|
-
scope: hasOAuthAuth ? config2.scope : undefined
|
|
5193
|
+
scope: hasOAuthAuth ? config2.scope : undefined,
|
|
5194
|
+
enforceSso: config2.enforceSso
|
|
5054
5195
|
});
|
|
5055
5196
|
const executionContext = new ExecutionContext;
|
|
5056
5197
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -5076,18 +5217,35 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
|
|
|
5076
5217
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined
|
|
5077
5218
|
});
|
|
5078
5219
|
trackEvent("Sdk.Auth");
|
|
5079
|
-
if (hasSecretAuth || isInActionCenter ||
|
|
5220
|
+
if (hasSecretAuth || isInActionCenter || hostEmbeddingOrigin) {
|
|
5080
5221
|
__classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config2.secret ?? "");
|
|
5081
5222
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
5082
5223
|
}
|
|
5224
|
+
}, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config2) {
|
|
5225
|
+
const layers = [loadFromEnvironment(), metaConfig, config2].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
|
|
5226
|
+
if (layers.length === 0)
|
|
5227
|
+
return;
|
|
5228
|
+
const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
|
|
5229
|
+
const namesSecret = config2 ? hasSecretConfig(config2) : false;
|
|
5230
|
+
const namesOAuth = Boolean(config2?.clientId || config2?.redirectUri || config2?.scope);
|
|
5231
|
+
if (namesSecret !== namesOAuth) {
|
|
5232
|
+
if (namesSecret) {
|
|
5233
|
+
delete merged.clientId;
|
|
5234
|
+
delete merged.redirectUri;
|
|
5235
|
+
delete merged.scope;
|
|
5236
|
+
} else {
|
|
5237
|
+
delete merged.secret;
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
return merged;
|
|
5083
5241
|
}, _UiPath_loadConfig = function _UiPath_loadConfig2() {
|
|
5084
5242
|
const metaConfig = loadFromMetaTags();
|
|
5085
5243
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
5086
5244
|
__classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
|
|
5087
5245
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
|
|
5088
|
-
const merged =
|
|
5089
|
-
if (!isCompleteConfig(merged)) {
|
|
5090
|
-
throw new Error(
|
|
5246
|
+
const merged = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
|
|
5247
|
+
if (!merged || !isCompleteConfig(merged)) {
|
|
5248
|
+
throw new Error(missingConfigMessage());
|
|
5091
5249
|
}
|
|
5092
5250
|
return merged;
|
|
5093
5251
|
};
|
|
@@ -5265,8 +5423,177 @@ var RESPONSE_TYPES = {
|
|
|
5265
5423
|
JSON: "json",
|
|
5266
5424
|
TEXT: "text",
|
|
5267
5425
|
BLOB: "blob",
|
|
5268
|
-
ARRAYBUFFER: "arraybuffer"
|
|
5426
|
+
ARRAYBUFFER: "arraybuffer",
|
|
5427
|
+
STREAM: "stream"
|
|
5428
|
+
};
|
|
5429
|
+
function createParams(paramsObj = {}) {
|
|
5430
|
+
const params = {};
|
|
5431
|
+
for (const [key, value] of Object.entries(paramsObj)) {
|
|
5432
|
+
if (value !== undefined && value !== null) {
|
|
5433
|
+
params[key] = value;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
return params;
|
|
5437
|
+
}
|
|
5438
|
+
function toSearchParams(params) {
|
|
5439
|
+
const searchParams = new URLSearchParams;
|
|
5440
|
+
if (!params)
|
|
5441
|
+
return searchParams;
|
|
5442
|
+
for (const [key, value] of Object.entries(params)) {
|
|
5443
|
+
if (value === undefined || value === null)
|
|
5444
|
+
continue;
|
|
5445
|
+
if (Array.isArray(value)) {
|
|
5446
|
+
value.forEach((item) => {
|
|
5447
|
+
if (item !== undefined && item !== null)
|
|
5448
|
+
searchParams.append(key, String(item));
|
|
5449
|
+
});
|
|
5450
|
+
} else {
|
|
5451
|
+
searchParams.append(key, String(value));
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
return searchParams;
|
|
5455
|
+
}
|
|
5456
|
+
var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
|
|
5457
|
+
var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
|
|
5458
|
+
var DEFAULT_RETRY_OPTIONS = {
|
|
5459
|
+
maxRetries: 2,
|
|
5460
|
+
initialDelayMs: 500,
|
|
5461
|
+
backoffStrategy: "exponential",
|
|
5462
|
+
backoffFactor: 2,
|
|
5463
|
+
backoffMaxDelayMs: 30000,
|
|
5464
|
+
retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
|
|
5465
|
+
retryMethods: DEFAULT_RETRY_METHODS,
|
|
5466
|
+
retryNetworkErrors: true,
|
|
5467
|
+
respectRetryAfter: true,
|
|
5468
|
+
maxRetryAfterMs: Infinity
|
|
5269
5469
|
};
|
|
5470
|
+
var DEFAULT_API_CLIENT_RETRY = {
|
|
5471
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
5472
|
+
maxRetries: 0
|
|
5473
|
+
};
|
|
5474
|
+
function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
|
|
5475
|
+
if (!settings)
|
|
5476
|
+
return defaults;
|
|
5477
|
+
const { retryDelay, useExponentialBackoff, ...live } = settings;
|
|
5478
|
+
const resolved = { ...defaults };
|
|
5479
|
+
for (const [key, value] of Object.entries(live)) {
|
|
5480
|
+
if (value !== undefined) {
|
|
5481
|
+
resolved[key] = value;
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5484
|
+
if (retryDelay !== undefined && live.initialDelayMs === undefined) {
|
|
5485
|
+
resolved.initialDelayMs = retryDelay;
|
|
5486
|
+
}
|
|
5487
|
+
if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
|
|
5488
|
+
resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
|
|
5489
|
+
}
|
|
5490
|
+
return resolved;
|
|
5491
|
+
}
|
|
5492
|
+
function computeBackoffDelay(attempt, settings) {
|
|
5493
|
+
const base = Math.max(0, settings.initialDelayMs);
|
|
5494
|
+
let delay;
|
|
5495
|
+
switch (settings.backoffStrategy) {
|
|
5496
|
+
case "constant":
|
|
5497
|
+
delay = base;
|
|
5498
|
+
break;
|
|
5499
|
+
case "linear":
|
|
5500
|
+
delay = base * (attempt + 1);
|
|
5501
|
+
break;
|
|
5502
|
+
default:
|
|
5503
|
+
delay = base * Math.pow(settings.backoffFactor, attempt);
|
|
5504
|
+
}
|
|
5505
|
+
return Math.min(delay, settings.backoffMaxDelayMs);
|
|
5506
|
+
}
|
|
5507
|
+
function parseRetryAfter(value, now = Date.now()) {
|
|
5508
|
+
const trimmed = value?.trim();
|
|
5509
|
+
if (!trimmed)
|
|
5510
|
+
return;
|
|
5511
|
+
const seconds = Number(trimmed);
|
|
5512
|
+
if (Number.isFinite(seconds))
|
|
5513
|
+
return Math.max(0, seconds * 1000);
|
|
5514
|
+
const date2 = Date.parse(trimmed);
|
|
5515
|
+
if (Number.isNaN(date2))
|
|
5516
|
+
return;
|
|
5517
|
+
return Math.max(0, date2 - now);
|
|
5518
|
+
}
|
|
5519
|
+
function wait(durationMs) {
|
|
5520
|
+
return new Promise((resolve) => setTimeout(resolve, Math.max(0, durationMs)));
|
|
5521
|
+
}
|
|
5522
|
+
var RETRY_AFTER = "retry-after";
|
|
5523
|
+
function createAttemptSignal(timeoutMs, external) {
|
|
5524
|
+
if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
|
|
5525
|
+
return { signal: external, dispose: () => {} };
|
|
5526
|
+
const controller = new AbortController;
|
|
5527
|
+
const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
5528
|
+
const onExternalAbort = () => controller.abort(external?.reason);
|
|
5529
|
+
if (external) {
|
|
5530
|
+
if (external.aborted) {
|
|
5531
|
+
controller.abort(external.reason);
|
|
5532
|
+
} else {
|
|
5533
|
+
external.addEventListener("abort", onExternalAbort);
|
|
5534
|
+
}
|
|
5535
|
+
}
|
|
5536
|
+
return {
|
|
5537
|
+
signal: controller.signal,
|
|
5538
|
+
dispose: () => {
|
|
5539
|
+
clearTimeout(timer);
|
|
5540
|
+
external?.removeEventListener("abort", onExternalAbort);
|
|
5541
|
+
}
|
|
5542
|
+
};
|
|
5543
|
+
}
|
|
5544
|
+
function delayBeforeRetry(durationMs, signal) {
|
|
5545
|
+
if (!signal)
|
|
5546
|
+
return wait(durationMs);
|
|
5547
|
+
if (signal.aborted)
|
|
5548
|
+
return Promise.reject(signal.reason);
|
|
5549
|
+
return new Promise((resolve, reject) => {
|
|
5550
|
+
const onAbort = () => {
|
|
5551
|
+
clearTimeout(timer);
|
|
5552
|
+
reject(signal.reason);
|
|
5553
|
+
};
|
|
5554
|
+
const timer = setTimeout(() => {
|
|
5555
|
+
signal.removeEventListener("abort", onAbort);
|
|
5556
|
+
resolve();
|
|
5557
|
+
}, Math.max(0, durationMs));
|
|
5558
|
+
signal.addEventListener("abort", onAbort);
|
|
5559
|
+
});
|
|
5560
|
+
}
|
|
5561
|
+
async function fetchWithRetry(url, init, options) {
|
|
5562
|
+
const settings = options.retry;
|
|
5563
|
+
const method = (init.method ?? "GET").toUpperCase();
|
|
5564
|
+
const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
|
|
5565
|
+
let attempt = 0;
|
|
5566
|
+
for (;; ) {
|
|
5567
|
+
const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
|
|
5568
|
+
let response;
|
|
5569
|
+
let failure;
|
|
5570
|
+
try {
|
|
5571
|
+
response = await fetch(url, { ...init, signal });
|
|
5572
|
+
} catch (error) {
|
|
5573
|
+
failure = error;
|
|
5574
|
+
} finally {
|
|
5575
|
+
dispose();
|
|
5576
|
+
}
|
|
5577
|
+
if (options.signal?.aborted && failure !== undefined)
|
|
5578
|
+
throw failure;
|
|
5579
|
+
if (response && !settings.retryableStatusCodes.includes(response.status))
|
|
5580
|
+
return response;
|
|
5581
|
+
if (failure !== undefined && !settings.retryNetworkErrors)
|
|
5582
|
+
throw failure;
|
|
5583
|
+
if (attempt >= retriesAllowed) {
|
|
5584
|
+
if (response)
|
|
5585
|
+
return response;
|
|
5586
|
+
throw failure;
|
|
5587
|
+
}
|
|
5588
|
+
const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
|
|
5589
|
+
const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
|
|
5590
|
+
response?.body?.cancel().catch((error) => {
|
|
5591
|
+
console.warn("[UiPath SDK] Could not release a discarded response body:", error);
|
|
5592
|
+
});
|
|
5593
|
+
await delayBeforeRetry(delay, options.signal);
|
|
5594
|
+
attempt++;
|
|
5595
|
+
}
|
|
5596
|
+
}
|
|
5270
5597
|
|
|
5271
5598
|
class ApiClient {
|
|
5272
5599
|
constructor(config2, executionContext, tokenManager, clientConfig = {}) {
|
|
@@ -5301,28 +5628,16 @@ class ApiClient {
|
|
|
5301
5628
|
[UIPATH_TRACEPARENT_ID]: traceparentValue,
|
|
5302
5629
|
...options.headers
|
|
5303
5630
|
};
|
|
5304
|
-
const searchParams =
|
|
5305
|
-
if (options.params) {
|
|
5306
|
-
Object.entries(options.params).forEach(([key, value]) => {
|
|
5307
|
-
if (Array.isArray(value)) {
|
|
5308
|
-
value.forEach((item) => searchParams.append(key, String(item)));
|
|
5309
|
-
} else {
|
|
5310
|
-
searchParams.append(key, String(value));
|
|
5311
|
-
}
|
|
5312
|
-
});
|
|
5313
|
-
}
|
|
5631
|
+
const searchParams = toSearchParams(options.params);
|
|
5314
5632
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
5315
5633
|
let body = undefined;
|
|
5316
5634
|
if (options.body) {
|
|
5317
5635
|
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
5318
5636
|
}
|
|
5637
|
+
const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
|
|
5638
|
+
const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
|
|
5319
5639
|
try {
|
|
5320
|
-
const response = await
|
|
5321
|
-
method,
|
|
5322
|
-
headers,
|
|
5323
|
-
body,
|
|
5324
|
-
signal: options.signal
|
|
5325
|
-
});
|
|
5640
|
+
const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
|
|
5326
5641
|
if (!response.ok) {
|
|
5327
5642
|
const errorInfo = await errorResponseParser.parse(response);
|
|
5328
5643
|
throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
|
|
@@ -6038,36 +6353,36 @@ function createEntityMethods(entityData, service) {
|
|
|
6038
6353
|
async insertRecord(data, options) {
|
|
6039
6354
|
if (!entityData.id)
|
|
6040
6355
|
throw new Error("Entity ID is undefined");
|
|
6041
|
-
return service.
|
|
6356
|
+
return service.insertRecord({ id: entityData.id }, data, options);
|
|
6042
6357
|
},
|
|
6043
6358
|
async insertRecords(data, options) {
|
|
6044
6359
|
if (!entityData.id)
|
|
6045
6360
|
throw new Error("Entity ID is undefined");
|
|
6046
|
-
return service.
|
|
6361
|
+
return service.insertRecords({ id: entityData.id }, data, options);
|
|
6047
6362
|
},
|
|
6048
6363
|
async updateRecord(recordId, data, options) {
|
|
6049
6364
|
if (!entityData.id)
|
|
6050
6365
|
throw new Error("Entity ID is undefined");
|
|
6051
6366
|
if (!recordId)
|
|
6052
6367
|
throw new Error("Record ID is undefined");
|
|
6053
|
-
return service.
|
|
6368
|
+
return service.updateRecord({ id: entityData.id }, recordId, data, options);
|
|
6054
6369
|
},
|
|
6055
6370
|
async updateRecords(data, options) {
|
|
6056
6371
|
if (!entityData.id)
|
|
6057
6372
|
throw new Error("Entity ID is undefined");
|
|
6058
|
-
return service.
|
|
6373
|
+
return service.updateRecords({ id: entityData.id }, data, options);
|
|
6059
6374
|
},
|
|
6060
6375
|
async deleteRecords(recordIds, options) {
|
|
6061
6376
|
if (!entityData.id)
|
|
6062
6377
|
throw new Error("Entity ID is undefined");
|
|
6063
|
-
return service.
|
|
6378
|
+
return service.deleteRecords({ id: entityData.id }, recordIds, options);
|
|
6064
6379
|
},
|
|
6065
6380
|
async deleteRecord(recordId, options) {
|
|
6066
6381
|
if (!entityData.id)
|
|
6067
6382
|
throw new Error("Entity ID is undefined");
|
|
6068
6383
|
if (!recordId)
|
|
6069
6384
|
throw new Error("Record ID is undefined");
|
|
6070
|
-
return service.
|
|
6385
|
+
return service.deleteRecord({ id: entityData.id }, recordId, options);
|
|
6071
6386
|
},
|
|
6072
6387
|
async getAllRecords(options) {
|
|
6073
6388
|
if (!entityData.id)
|
|
@@ -6084,27 +6399,27 @@ function createEntityMethods(entityData, service) {
|
|
|
6084
6399
|
async downloadAttachment(recordId, fieldName, options) {
|
|
6085
6400
|
if (!entityData.id)
|
|
6086
6401
|
throw new Error("Entity ID is undefined");
|
|
6087
|
-
return service.downloadAttachment(entityData.id, recordId, fieldName, options);
|
|
6402
|
+
return service.downloadAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
6088
6403
|
},
|
|
6089
6404
|
async uploadAttachment(recordId, fieldName, file, options) {
|
|
6090
6405
|
if (!entityData.id)
|
|
6091
6406
|
throw new Error("Entity ID is undefined");
|
|
6092
|
-
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
6407
|
+
return service.uploadAttachment({ id: entityData.id }, recordId, fieldName, file, options);
|
|
6093
6408
|
},
|
|
6094
6409
|
async deleteAttachment(recordId, fieldName, options) {
|
|
6095
6410
|
if (!entityData.id)
|
|
6096
6411
|
throw new Error("Entity ID is undefined");
|
|
6097
|
-
return service.deleteAttachment(entityData.id, recordId, fieldName, options);
|
|
6412
|
+
return service.deleteAttachment({ id: entityData.id }, recordId, fieldName, options);
|
|
6098
6413
|
},
|
|
6099
6414
|
async queryRecords(options) {
|
|
6100
6415
|
if (!entityData.id)
|
|
6101
6416
|
throw new Error("Entity ID is undefined");
|
|
6102
|
-
return service.
|
|
6417
|
+
return service.queryRecords({ id: entityData.id }, options);
|
|
6103
6418
|
},
|
|
6104
6419
|
async importRecords(file, options) {
|
|
6105
6420
|
if (!entityData.id)
|
|
6106
6421
|
throw new Error("Entity ID is undefined");
|
|
6107
|
-
return service.
|
|
6422
|
+
return service.importRecords({ id: entityData.id }, file, options);
|
|
6108
6423
|
},
|
|
6109
6424
|
async insert(data, options) {
|
|
6110
6425
|
return this.insertRecord(data, options);
|
|
@@ -6180,6 +6495,15 @@ var EntityAggregateFunction;
|
|
|
6180
6495
|
EntityAggregateFunction2["Min"] = "MIN";
|
|
6181
6496
|
EntityAggregateFunction2["Max"] = "MAX";
|
|
6182
6497
|
})(EntityAggregateFunction || (EntityAggregateFunction = {}));
|
|
6498
|
+
var EntityHavingOperator;
|
|
6499
|
+
(function(EntityHavingOperator2) {
|
|
6500
|
+
EntityHavingOperator2["Equals"] = "=";
|
|
6501
|
+
EntityHavingOperator2["NotEquals"] = "!=";
|
|
6502
|
+
EntityHavingOperator2["GreaterThan"] = ">";
|
|
6503
|
+
EntityHavingOperator2["GreaterThanOrEqual"] = ">=";
|
|
6504
|
+
EntityHavingOperator2["LessThan"] = "<";
|
|
6505
|
+
EntityHavingOperator2["LessThanOrEqual"] = "<=";
|
|
6506
|
+
})(EntityHavingOperator || (EntityHavingOperator = {}));
|
|
6183
6507
|
var EntityType;
|
|
6184
6508
|
(function(EntityType2) {
|
|
6185
6509
|
EntityType2["Entity"] = "Entity";
|
|
@@ -6210,15 +6534,6 @@ var JoinType;
|
|
|
6210
6534
|
JoinType2["LeftJoin"] = "LeftJoin";
|
|
6211
6535
|
JoinType2["InnerJoin"] = "InnerJoin";
|
|
6212
6536
|
})(JoinType || (JoinType = {}));
|
|
6213
|
-
function createParams(paramsObj = {}) {
|
|
6214
|
-
const params = {};
|
|
6215
|
-
for (const [key, value] of Object.entries(paramsObj)) {
|
|
6216
|
-
if (value !== undefined && value !== null) {
|
|
6217
|
-
params[key] = value;
|
|
6218
|
-
}
|
|
6219
|
-
}
|
|
6220
|
-
return params;
|
|
6221
|
-
}
|
|
6222
6537
|
var EntityFieldConstraint;
|
|
6223
6538
|
(function(EntityFieldConstraint2) {
|
|
6224
6539
|
EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
|
|
@@ -6357,95 +6672,84 @@ function toWireJoin(join, baseEntityName) {
|
|
|
6357
6672
|
}
|
|
6358
6673
|
};
|
|
6359
6674
|
}
|
|
6675
|
+
function unwrapEntityRef(entityRef, callerLabel) {
|
|
6676
|
+
const { id, name } = entityRef ?? {};
|
|
6677
|
+
if (id && name) {
|
|
6678
|
+
throw new ValidationError({
|
|
6679
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name', not both.`
|
|
6680
|
+
});
|
|
6681
|
+
}
|
|
6682
|
+
if (id) {
|
|
6683
|
+
return { byId: true, identifier: id };
|
|
6684
|
+
}
|
|
6685
|
+
if (name) {
|
|
6686
|
+
return { byId: false, identifier: name };
|
|
6687
|
+
}
|
|
6688
|
+
throw new ValidationError({
|
|
6689
|
+
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
|
|
6690
|
+
});
|
|
6691
|
+
}
|
|
6360
6692
|
|
|
6361
6693
|
class EntityService extends BaseService {
|
|
6362
6694
|
async getById(id, options) {
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
return
|
|
6695
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
|
|
6696
|
+
}
|
|
6697
|
+
async getByName(entityName, options) {
|
|
6698
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
|
|
6367
6699
|
}
|
|
6368
6700
|
async getAllRecords(entityId, options) {
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(entityId),
|
|
6374
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
6375
|
-
pagination: {
|
|
6376
|
-
paginationType: PaginationType.OFFSET,
|
|
6377
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
6378
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
6379
|
-
paginationParams: {
|
|
6380
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
6381
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
6382
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
6383
|
-
}
|
|
6384
|
-
},
|
|
6385
|
-
excludeFromPrefix: ["expansionLevel"]
|
|
6386
|
-
}, downstreamOptions);
|
|
6701
|
+
return this.getRecordsImpl(true, entityId, options);
|
|
6702
|
+
}
|
|
6703
|
+
async getRecordsByName(entityName, options) {
|
|
6704
|
+
return this.getRecordsImpl(false, entityName, options);
|
|
6387
6705
|
}
|
|
6388
6706
|
async getRecordById(entityId, recordId, options = {}) {
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6707
|
+
return this.getRecordImpl(true, entityId, recordId, options);
|
|
6708
|
+
}
|
|
6709
|
+
async getRecordByName(entityName, recordId, options = {}) {
|
|
6710
|
+
return this.getRecordImpl(false, entityName, recordId, options);
|
|
6711
|
+
}
|
|
6712
|
+
async insertRecord(entityRef, data, options = {}) {
|
|
6713
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
|
|
6714
|
+
return this.insertRecordImpl(byId, identifier, data, options);
|
|
6394
6715
|
}
|
|
6395
6716
|
async insertRecordById(id, data, options = {}) {
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
const
|
|
6400
|
-
|
|
6401
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
6402
|
-
});
|
|
6403
|
-
return response.data;
|
|
6717
|
+
return this.insertRecordImpl(true, id, data, options);
|
|
6718
|
+
}
|
|
6719
|
+
async insertRecords(entityRef, data, options = {}) {
|
|
6720
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecords");
|
|
6721
|
+
return this.insertRecordsImpl(byId, identifier, data, options);
|
|
6404
6722
|
}
|
|
6405
6723
|
async insertRecordsById(id, data, options = {}) {
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
});
|
|
6410
|
-
|
|
6411
|
-
params,
|
|
6412
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
6413
|
-
});
|
|
6414
|
-
return response.data;
|
|
6724
|
+
return this.insertRecordsImpl(true, id, data, options);
|
|
6725
|
+
}
|
|
6726
|
+
async updateRecord(entityRef, recordId, data, options = {}) {
|
|
6727
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecord");
|
|
6728
|
+
return this.updateRecordImpl(byId, identifier, recordId, data, options);
|
|
6415
6729
|
}
|
|
6416
6730
|
async updateRecordById(entityId, recordId, data, options = {}) {
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
const
|
|
6421
|
-
|
|
6422
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
6423
|
-
});
|
|
6424
|
-
return response.data;
|
|
6731
|
+
return this.updateRecordImpl(true, entityId, recordId, data, options);
|
|
6732
|
+
}
|
|
6733
|
+
async updateRecords(entityRef, data, options = {}) {
|
|
6734
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.updateRecords");
|
|
6735
|
+
return this.updateRecordsImpl(byId, identifier, data, options);
|
|
6425
6736
|
}
|
|
6426
6737
|
async updateRecordsById(id, data, options = {}) {
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
});
|
|
6431
|
-
|
|
6432
|
-
params,
|
|
6433
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
6434
|
-
});
|
|
6435
|
-
return response.data;
|
|
6738
|
+
return this.updateRecordsImpl(true, id, data, options);
|
|
6739
|
+
}
|
|
6740
|
+
async deleteRecords(entityRef, recordIds, options = {}) {
|
|
6741
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
|
|
6742
|
+
return this.deleteRecordsImpl(byId, identifier, recordIds, options);
|
|
6436
6743
|
}
|
|
6437
6744
|
async deleteRecordsById(id, recordIds, options = {}) {
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
const
|
|
6442
|
-
|
|
6443
|
-
headers: createHeaders({ [FOLDER_KEY]: options.folderKey })
|
|
6444
|
-
});
|
|
6445
|
-
return response.data;
|
|
6745
|
+
return this.deleteRecordsImpl(true, id, recordIds, options);
|
|
6746
|
+
}
|
|
6747
|
+
async deleteRecord(entityRef, recordId, options) {
|
|
6748
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecord");
|
|
6749
|
+
return this.deleteRecordImpl(byId, identifier, recordId, options);
|
|
6446
6750
|
}
|
|
6447
6751
|
async deleteRecordById(entityId, recordId, options) {
|
|
6448
|
-
|
|
6752
|
+
return this.deleteRecordImpl(true, entityId, recordId, options);
|
|
6449
6753
|
}
|
|
6450
6754
|
async getAll(options) {
|
|
6451
6755
|
const endpoint = !options?.folderKey && options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
|
|
@@ -6457,62 +6761,30 @@ class EntityService extends BaseService {
|
|
|
6457
6761
|
});
|
|
6458
6762
|
return entities;
|
|
6459
6763
|
}
|
|
6764
|
+
async queryRecords(entityRef, options) {
|
|
6765
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.queryRecords");
|
|
6766
|
+
return this.queryRecordsImpl(byId, identifier, options);
|
|
6767
|
+
}
|
|
6460
6768
|
async queryRecordsById(id, options) {
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
6467
|
-
throw new ValidationError({
|
|
6468
|
-
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
6469
|
-
});
|
|
6470
|
-
}
|
|
6471
|
-
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
6472
|
-
let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
|
|
6473
|
-
if (options?.joins && options.joins.length > 0) {
|
|
6474
|
-
const baseEntityName = await this.resolveEntityName(id, folderKey);
|
|
6475
|
-
rest.joins = options.joins.map((join) => toWireJoin(join, baseEntityName));
|
|
6476
|
-
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
6477
|
-
}
|
|
6478
|
-
const downstreamOptions = options === undefined ? undefined : rest;
|
|
6479
|
-
return PaginationHelpers.getAll({
|
|
6480
|
-
serviceAccess: this.createPaginationServiceAccess(),
|
|
6481
|
-
getEndpoint,
|
|
6482
|
-
method: HTTP_METHODS.POST,
|
|
6483
|
-
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
6484
|
-
queryParams: createParams({ expansionLevel }),
|
|
6485
|
-
pagination: {
|
|
6486
|
-
paginationType: PaginationType.OFFSET,
|
|
6487
|
-
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
6488
|
-
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
6489
|
-
paginationParams: {
|
|
6490
|
-
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
6491
|
-
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
6492
|
-
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
6493
|
-
}
|
|
6494
|
-
},
|
|
6495
|
-
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins"]
|
|
6496
|
-
}, downstreamOptions);
|
|
6769
|
+
return this.queryRecordsImpl(true, id, options);
|
|
6770
|
+
}
|
|
6771
|
+
async importRecords(entityRef, file, options) {
|
|
6772
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.importRecords");
|
|
6773
|
+
return this.importRecordsImpl(byId, identifier, file, options);
|
|
6497
6774
|
}
|
|
6498
6775
|
async importRecordsById(id, file, options) {
|
|
6499
|
-
|
|
6500
|
-
if (file instanceof Uint8Array) {
|
|
6501
|
-
formData.append("file", new Blob([file.buffer]));
|
|
6502
|
-
} else {
|
|
6503
|
-
formData.append("file", file);
|
|
6504
|
-
}
|
|
6505
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
6506
|
-
return response.data;
|
|
6776
|
+
return this.importRecordsImpl(true, id, file, options);
|
|
6507
6777
|
}
|
|
6508
|
-
async downloadAttachment(
|
|
6509
|
-
const
|
|
6778
|
+
async downloadAttachment(entityRef, recordId, fieldName, options) {
|
|
6779
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.downloadAttachment");
|
|
6780
|
+
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), {
|
|
6510
6781
|
responseType: RESPONSE_TYPES.BLOB,
|
|
6511
6782
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
6512
6783
|
});
|
|
6513
6784
|
return response.data;
|
|
6514
6785
|
}
|
|
6515
|
-
async uploadAttachment(
|
|
6786
|
+
async uploadAttachment(entityRef, recordId, fieldName, file, options) {
|
|
6787
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.uploadAttachment");
|
|
6516
6788
|
const formData = new FormData;
|
|
6517
6789
|
if (file instanceof Uint8Array) {
|
|
6518
6790
|
formData.append("file", new Blob([file.buffer]));
|
|
@@ -6520,14 +6792,15 @@ class EntityService extends BaseService {
|
|
|
6520
6792
|
formData.append("file", file);
|
|
6521
6793
|
}
|
|
6522
6794
|
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
6523
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
6795
|
+
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, {
|
|
6524
6796
|
params,
|
|
6525
6797
|
headers: createHeaders({ [FOLDER_KEY]: options?.folderKey })
|
|
6526
6798
|
});
|
|
6527
6799
|
return response.data;
|
|
6528
6800
|
}
|
|
6529
|
-
async deleteAttachment(
|
|
6530
|
-
const
|
|
6801
|
+
async deleteAttachment(entityRef, recordId, fieldName, options) {
|
|
6802
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteAttachment");
|
|
6803
|
+
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 }) });
|
|
6531
6804
|
return response.data;
|
|
6532
6805
|
}
|
|
6533
6806
|
async getRecordsById(entityId, options) {
|
|
@@ -6564,11 +6837,16 @@ class EntityService extends BaseService {
|
|
|
6564
6837
|
const opts = options ?? {};
|
|
6565
6838
|
const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
|
|
6566
6839
|
const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
|
|
6840
|
+
if (!hasSchemaChanges && !hasMetadataChanges) {
|
|
6841
|
+
throw new ValidationError({
|
|
6842
|
+
message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or isRbacEnabled."
|
|
6843
|
+
});
|
|
6844
|
+
}
|
|
6567
6845
|
if (hasSchemaChanges) {
|
|
6568
6846
|
await this.applySchemaUpdate(id, opts);
|
|
6569
6847
|
}
|
|
6570
6848
|
if (hasMetadataChanges) {
|
|
6571
|
-
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.
|
|
6849
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE(id), {
|
|
6572
6850
|
...opts.displayName !== undefined && { displayName: opts.displayName },
|
|
6573
6851
|
...opts.description !== undefined && { description: opts.description },
|
|
6574
6852
|
...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
|
|
@@ -6581,11 +6859,25 @@ class EntityService extends BaseService {
|
|
|
6581
6859
|
const raw = entityResponse.data;
|
|
6582
6860
|
let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
|
|
6583
6861
|
if (options.removeFields?.length) {
|
|
6862
|
+
const existingNames = new Set(fields.map((f) => f.name));
|
|
6863
|
+
const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
|
|
6864
|
+
if (missing.length) {
|
|
6865
|
+
throw new ValidationError({
|
|
6866
|
+
message: `Cannot remove field(s) — no matching non-system field found for name(s): ${missing.join(", ")}.`
|
|
6867
|
+
});
|
|
6868
|
+
}
|
|
6584
6869
|
const removeSet = new Set(options.removeFields.map((r) => r.name));
|
|
6585
6870
|
fields = fields.filter((f) => !removeSet.has(f.name));
|
|
6586
6871
|
}
|
|
6587
6872
|
if (options.updateFields?.length) {
|
|
6588
|
-
const
|
|
6873
|
+
const existingIds = new Set(fields.map((f) => f.id));
|
|
6874
|
+
const missing = options.updateFields.filter((u) => !existingIds.has(u.id)).map((u) => u.id);
|
|
6875
|
+
if (missing.length) {
|
|
6876
|
+
throw new ValidationError({
|
|
6877
|
+
message: `Cannot update field(s) — no matching non-system field found for id(s): ${missing.join(", ")}.`
|
|
6878
|
+
});
|
|
6879
|
+
}
|
|
6880
|
+
const updateMap = new Map(options.updateFields.map((u) => [u.id, u]));
|
|
6589
6881
|
fields = fields.map((f) => {
|
|
6590
6882
|
const update = updateMap.get(f.id ?? "");
|
|
6591
6883
|
if (!update)
|
|
@@ -6834,40 +7126,185 @@ class EntityService extends BaseService {
|
|
|
6834
7126
|
return {};
|
|
6835
7127
|
}
|
|
6836
7128
|
}
|
|
7129
|
+
async fetchEntityMetadata(endpoint, folderKey) {
|
|
7130
|
+
const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
7131
|
+
const metadata = transformData(response.data, EntityMap);
|
|
7132
|
+
this.applyFieldMappings(metadata);
|
|
7133
|
+
return createEntityWithMethods(metadata, this);
|
|
7134
|
+
}
|
|
7135
|
+
getRecordsImpl(byId, identifier, options) {
|
|
7136
|
+
const { folderKey, ...rest } = options ?? {};
|
|
7137
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
7138
|
+
return PaginationHelpers.getAll({
|
|
7139
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
7140
|
+
getEndpoint: () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ENTITY_RECORDS_BY_NAME(identifier),
|
|
7141
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
7142
|
+
pagination: {
|
|
7143
|
+
paginationType: PaginationType.OFFSET,
|
|
7144
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
7145
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
7146
|
+
paginationParams: {
|
|
7147
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
7148
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
7149
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
7150
|
+
}
|
|
7151
|
+
},
|
|
7152
|
+
excludeFromPrefix: ["expansionLevel"]
|
|
7153
|
+
}, downstreamOptions);
|
|
7154
|
+
}
|
|
7155
|
+
async getRecordImpl(byId, identifier, recordId, options) {
|
|
7156
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
7157
|
+
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 }) });
|
|
7158
|
+
return response.data;
|
|
7159
|
+
}
|
|
7160
|
+
async insertRecordImpl(byId, identifier, data, options) {
|
|
7161
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
7162
|
+
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 }) });
|
|
7163
|
+
return response.data;
|
|
7164
|
+
}
|
|
7165
|
+
async insertRecordsImpl(byId, identifier, data, options) {
|
|
7166
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
7167
|
+
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 }) });
|
|
7168
|
+
return response.data;
|
|
7169
|
+
}
|
|
7170
|
+
async updateRecordImpl(byId, identifier, recordId, data, options) {
|
|
7171
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
7172
|
+
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 }) });
|
|
7173
|
+
return response.data;
|
|
7174
|
+
}
|
|
7175
|
+
async updateRecordsImpl(byId, identifier, data, options) {
|
|
7176
|
+
const params = createParams({ expansionLevel: options.expansionLevel, failOnFirst: options.failOnFirst });
|
|
7177
|
+
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 }) });
|
|
7178
|
+
return response.data;
|
|
7179
|
+
}
|
|
7180
|
+
async deleteRecordsImpl(byId, identifier, recordIds, options) {
|
|
7181
|
+
const params = createParams({ failOnFirst: options.failOnFirst });
|
|
7182
|
+
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 }) });
|
|
7183
|
+
return response.data;
|
|
7184
|
+
}
|
|
7185
|
+
async deleteRecordImpl(byId, identifier, recordId, options) {
|
|
7186
|
+
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 }) });
|
|
7187
|
+
}
|
|
7188
|
+
async queryRecordsImpl(byId, identifier, options) {
|
|
7189
|
+
if (options?.joins && options.joins.length > MAX_QUERY_JOINS) {
|
|
7190
|
+
throw new ValidationError({
|
|
7191
|
+
message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
|
|
7192
|
+
});
|
|
7193
|
+
}
|
|
7194
|
+
if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
|
|
7195
|
+
throw new ValidationError({
|
|
7196
|
+
message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
|
|
7197
|
+
});
|
|
7198
|
+
}
|
|
7199
|
+
if (options?.havingFilter && (!options.aggregates?.length || !options.groupBy?.length)) {
|
|
7200
|
+
throw new ValidationError({
|
|
7201
|
+
message: "havingFilter requires aggregates and groupBy — conditions reference declared aggregate aliases; use filterGroup for row-level conditions"
|
|
7202
|
+
});
|
|
7203
|
+
}
|
|
7204
|
+
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
7205
|
+
let getEndpoint = () => byId ? DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(identifier) : DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(identifier);
|
|
7206
|
+
if (options?.joins && options.joins.length > 0) {
|
|
7207
|
+
const baseEntityName = byId ? await this.resolveEntityName(identifier, folderKey) : identifier;
|
|
7208
|
+
rest.joins = options.joins.map((join) => toWireJoin(join, baseEntityName));
|
|
7209
|
+
getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
|
|
7210
|
+
}
|
|
7211
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
7212
|
+
return PaginationHelpers.getAll({
|
|
7213
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
7214
|
+
getEndpoint,
|
|
7215
|
+
method: HTTP_METHODS.POST,
|
|
7216
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
7217
|
+
queryParams: createParams({ expansionLevel }),
|
|
7218
|
+
pagination: {
|
|
7219
|
+
paginationType: PaginationType.OFFSET,
|
|
7220
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
7221
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
7222
|
+
paginationParams: {
|
|
7223
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
7224
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
7225
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
7226
|
+
}
|
|
7227
|
+
},
|
|
7228
|
+
excludeFromPrefix: ["filterGroup", "selectedFields", "sortOptions", "aggregates", "groupBy", "joins", "havingFilter"]
|
|
7229
|
+
}, downstreamOptions);
|
|
7230
|
+
}
|
|
7231
|
+
async importRecordsImpl(byId, identifier, file, options) {
|
|
7232
|
+
const formData = new FormData;
|
|
7233
|
+
if (file instanceof Uint8Array) {
|
|
7234
|
+
formData.append("file", new Blob([file.buffer]));
|
|
7235
|
+
} else {
|
|
7236
|
+
formData.append("file", file);
|
|
7237
|
+
}
|
|
7238
|
+
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 }) });
|
|
7239
|
+
return response.data;
|
|
7240
|
+
}
|
|
6837
7241
|
}
|
|
6838
7242
|
__decorate([
|
|
6839
7243
|
track("Entities.GetById")
|
|
6840
7244
|
], EntityService.prototype, "getById", null);
|
|
7245
|
+
__decorate([
|
|
7246
|
+
track("Entities.GetByName")
|
|
7247
|
+
], EntityService.prototype, "getByName", null);
|
|
6841
7248
|
__decorate([
|
|
6842
7249
|
track("Entities.GetAllRecords")
|
|
6843
7250
|
], EntityService.prototype, "getAllRecords", null);
|
|
7251
|
+
__decorate([
|
|
7252
|
+
track("Entities.GetRecordsByName")
|
|
7253
|
+
], EntityService.prototype, "getRecordsByName", null);
|
|
6844
7254
|
__decorate([
|
|
6845
7255
|
track("Entities.GetRecordById")
|
|
6846
7256
|
], EntityService.prototype, "getRecordById", null);
|
|
7257
|
+
__decorate([
|
|
7258
|
+
track("Entities.GetRecordByName")
|
|
7259
|
+
], EntityService.prototype, "getRecordByName", null);
|
|
7260
|
+
__decorate([
|
|
7261
|
+
track("Entities.InsertRecord")
|
|
7262
|
+
], EntityService.prototype, "insertRecord", null);
|
|
6847
7263
|
__decorate([
|
|
6848
7264
|
track("Entities.InsertRecordById")
|
|
6849
7265
|
], EntityService.prototype, "insertRecordById", null);
|
|
7266
|
+
__decorate([
|
|
7267
|
+
track("Entities.InsertRecords")
|
|
7268
|
+
], EntityService.prototype, "insertRecords", null);
|
|
6850
7269
|
__decorate([
|
|
6851
7270
|
track("Entities.InsertRecordsById")
|
|
6852
7271
|
], EntityService.prototype, "insertRecordsById", null);
|
|
7272
|
+
__decorate([
|
|
7273
|
+
track("Entities.UpdateRecord")
|
|
7274
|
+
], EntityService.prototype, "updateRecord", null);
|
|
6853
7275
|
__decorate([
|
|
6854
7276
|
track("Entities.UpdateRecordById")
|
|
6855
7277
|
], EntityService.prototype, "updateRecordById", null);
|
|
7278
|
+
__decorate([
|
|
7279
|
+
track("Entities.UpdateRecords")
|
|
7280
|
+
], EntityService.prototype, "updateRecords", null);
|
|
6856
7281
|
__decorate([
|
|
6857
7282
|
track("Entities.UpdateRecordsById")
|
|
6858
7283
|
], EntityService.prototype, "updateRecordsById", null);
|
|
7284
|
+
__decorate([
|
|
7285
|
+
track("Entities.DeleteRecords")
|
|
7286
|
+
], EntityService.prototype, "deleteRecords", null);
|
|
6859
7287
|
__decorate([
|
|
6860
7288
|
track("Entities.DeleteRecordsById")
|
|
6861
7289
|
], EntityService.prototype, "deleteRecordsById", null);
|
|
7290
|
+
__decorate([
|
|
7291
|
+
track("Entities.DeleteRecord")
|
|
7292
|
+
], EntityService.prototype, "deleteRecord", null);
|
|
6862
7293
|
__decorate([
|
|
6863
7294
|
track("Entities.DeleteRecordById")
|
|
6864
7295
|
], EntityService.prototype, "deleteRecordById", null);
|
|
6865
7296
|
__decorate([
|
|
6866
7297
|
track("Entities.GetAll")
|
|
6867
7298
|
], EntityService.prototype, "getAll", null);
|
|
7299
|
+
__decorate([
|
|
7300
|
+
track("Entities.QueryRecords")
|
|
7301
|
+
], EntityService.prototype, "queryRecords", null);
|
|
6868
7302
|
__decorate([
|
|
6869
7303
|
track("Entities.QueryRecordsById")
|
|
6870
7304
|
], EntityService.prototype, "queryRecordsById", null);
|
|
7305
|
+
__decorate([
|
|
7306
|
+
track("Entities.ImportRecords")
|
|
7307
|
+
], EntityService.prototype, "importRecords", null);
|
|
6871
7308
|
__decorate([
|
|
6872
7309
|
track("Entities.ImportRecordsById")
|
|
6873
7310
|
], EntityService.prototype, "importRecordsById", null);
|
|
@@ -8311,6 +8748,74 @@ function validateName(resourceType, name) {
|
|
|
8311
8748
|
}
|
|
8312
8749
|
return trimmed;
|
|
8313
8750
|
}
|
|
8751
|
+
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8752
|
+
function isPlainObject(value) {
|
|
8753
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8754
|
+
}
|
|
8755
|
+
function asResourceOverrides(value) {
|
|
8756
|
+
if (!isPlainObject(value))
|
|
8757
|
+
return;
|
|
8758
|
+
const table = {};
|
|
8759
|
+
for (const [key, properties] of Object.entries(value)) {
|
|
8760
|
+
if (!isPlainObject(properties))
|
|
8761
|
+
continue;
|
|
8762
|
+
const bag = {};
|
|
8763
|
+
for (const [property, propertyValue] of Object.entries(properties)) {
|
|
8764
|
+
if (typeof propertyValue === "string")
|
|
8765
|
+
bag[property] = propertyValue;
|
|
8766
|
+
}
|
|
8767
|
+
table[key] = bag;
|
|
8768
|
+
}
|
|
8769
|
+
return Object.keys(table).length > 0 ? table : undefined;
|
|
8770
|
+
}
|
|
8771
|
+
function readFromDocument() {
|
|
8772
|
+
if (!isBrowser)
|
|
8773
|
+
return;
|
|
8774
|
+
const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
|
|
8775
|
+
if (!text)
|
|
8776
|
+
return;
|
|
8777
|
+
try {
|
|
8778
|
+
return asResourceOverrides(JSON.parse(text));
|
|
8779
|
+
} catch (error) {
|
|
8780
|
+
console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
var table;
|
|
8785
|
+
var loaded = false;
|
|
8786
|
+
var pageOverrides = () => {
|
|
8787
|
+
if (!loaded) {
|
|
8788
|
+
loaded = true;
|
|
8789
|
+
table = readFromDocument();
|
|
8790
|
+
}
|
|
8791
|
+
return table;
|
|
8792
|
+
};
|
|
8793
|
+
var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
|
|
8794
|
+
function readOverrides() {
|
|
8795
|
+
const slot = globalThis[RESOURCE_OVERWRITES_KEY];
|
|
8796
|
+
const source = typeof slot === "function" ? slot : pageOverrides;
|
|
8797
|
+
try {
|
|
8798
|
+
return source();
|
|
8799
|
+
} catch (error) {
|
|
8800
|
+
console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
|
|
8801
|
+
return;
|
|
8802
|
+
}
|
|
8803
|
+
}
|
|
8804
|
+
function resolveOverride(resourceType, name, folderPath) {
|
|
8805
|
+
const table2 = readOverrides();
|
|
8806
|
+
if (!table2)
|
|
8807
|
+
return;
|
|
8808
|
+
const bindingType = resourceType.toLowerCase();
|
|
8809
|
+
const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
|
|
8810
|
+
const unscopedKey = `${bindingType}.${name}`;
|
|
8811
|
+
const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
|
|
8812
|
+
if (!entry)
|
|
8813
|
+
return;
|
|
8814
|
+
return {
|
|
8815
|
+
name: entry.name,
|
|
8816
|
+
folderPath: entry.folderPath
|
|
8817
|
+
};
|
|
8818
|
+
}
|
|
8314
8819
|
var SINGLE_QUOTE_RE = /'/g;
|
|
8315
8820
|
|
|
8316
8821
|
class FolderScopedService extends BaseService {
|
|
@@ -8327,20 +8832,23 @@ class FolderScopedService extends BaseService {
|
|
|
8327
8832
|
}
|
|
8328
8833
|
return response.data?.value;
|
|
8329
8834
|
}
|
|
8330
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
|
|
8835
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap, callerLabel) {
|
|
8331
8836
|
const validatedName = validateName(resourceType, name);
|
|
8332
8837
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
8838
|
+
const override = resolveOverride(resourceType, validatedName, folderPath);
|
|
8839
|
+
const resolvedName = override?.name ?? validatedName;
|
|
8840
|
+
const resolvedFolderPath = override?.folderPath ?? folderPath;
|
|
8333
8841
|
const headers = resolveFolderHeaders({
|
|
8334
8842
|
folderId,
|
|
8335
8843
|
folderKey,
|
|
8336
|
-
folderPath,
|
|
8337
|
-
resourceType: `${resourceType}.getByName`,
|
|
8844
|
+
folderPath: resolvedFolderPath,
|
|
8845
|
+
resourceType: callerLabel ?? `${resourceType}.getByName`,
|
|
8338
8846
|
fallbackFolderKey: this.config.folderKey
|
|
8339
8847
|
});
|
|
8340
8848
|
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
8341
8849
|
const apiOptions = {
|
|
8342
8850
|
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
8343
|
-
$filter: `Name eq '${
|
|
8851
|
+
$filter: `Name eq '${resolvedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
8344
8852
|
$top: "1"
|
|
8345
8853
|
};
|
|
8346
8854
|
const response = await this.get(endpoint, {
|
|
@@ -8349,12 +8857,48 @@ class FolderScopedService extends BaseService {
|
|
|
8349
8857
|
});
|
|
8350
8858
|
const items = response.data?.value;
|
|
8351
8859
|
if (!items?.length) {
|
|
8352
|
-
const folderHint = describeFolderForError(folderId, folderKey,
|
|
8860
|
+
const folderHint = describeFolderForError(folderId, folderKey, resolvedFolderPath);
|
|
8353
8861
|
throw new NotFoundError({
|
|
8354
|
-
message: `${resourceType} '${
|
|
8862
|
+
message: `${resourceType} '${resolvedName}' not found${folderHint}.`
|
|
8355
8863
|
});
|
|
8356
8864
|
}
|
|
8357
|
-
return
|
|
8865
|
+
return {
|
|
8866
|
+
result: transform2(items[0]),
|
|
8867
|
+
effectiveFolder: { folderId, folderKey, folderPath: resolvedFolderPath }
|
|
8868
|
+
};
|
|
8869
|
+
}
|
|
8870
|
+
async getByKeyLookup(resourceType, endpoint, key, options, transform2, responseFieldMap, callerLabel) {
|
|
8871
|
+
const label = callerLabel ?? `${resourceType}.getByKey`;
|
|
8872
|
+
const trimmedKey = key?.trim();
|
|
8873
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
8874
|
+
throw new ValidationError({ message: `${label}: key must be a GUID.` });
|
|
8875
|
+
}
|
|
8876
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
8877
|
+
const headers = resolveFolderHeaders({
|
|
8878
|
+
folderId,
|
|
8879
|
+
folderKey,
|
|
8880
|
+
folderPath,
|
|
8881
|
+
resourceType: label,
|
|
8882
|
+
fallbackFolderKey: this.config.folderKey
|
|
8883
|
+
});
|
|
8884
|
+
const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
|
|
8885
|
+
const apiOptions = {
|
|
8886
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
8887
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
8888
|
+
$top: "1"
|
|
8889
|
+
};
|
|
8890
|
+
const response = await this.get(endpoint, {
|
|
8891
|
+
headers,
|
|
8892
|
+
params: apiOptions
|
|
8893
|
+
});
|
|
8894
|
+
const items = response.data?.value;
|
|
8895
|
+
if (!items?.length) {
|
|
8896
|
+
throw new NotFoundError({ message: `${resourceType} with key '${trimmedKey}' not found.` });
|
|
8897
|
+
}
|
|
8898
|
+
return {
|
|
8899
|
+
result: transform2(items[0]),
|
|
8900
|
+
effectiveFolder: { folderId, folderKey, folderPath }
|
|
8901
|
+
};
|
|
8358
8902
|
}
|
|
8359
8903
|
}
|
|
8360
8904
|
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
@@ -8385,12 +8929,16 @@ class TaskService extends FolderScopedService {
|
|
|
8385
8929
|
};
|
|
8386
8930
|
}
|
|
8387
8931
|
async create(task, folderId) {
|
|
8932
|
+
if (task.type === TaskType.QuickForm && !task.taskSchemaKey) {
|
|
8933
|
+
throw new ValidationError({ message: "taskSchemaKey is required when creating a QuickForm task." });
|
|
8934
|
+
}
|
|
8388
8935
|
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
8389
|
-
const
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8936
|
+
const { labels, type, ...rest } = task;
|
|
8937
|
+
const payload = { ...rest, type: type ?? TaskType.External };
|
|
8938
|
+
if (labels?.length) {
|
|
8939
|
+
payload.tags = labels.map((label) => ({ name: label, displayName: label, displayValue: label }));
|
|
8940
|
+
}
|
|
8941
|
+
const response = await this.post(TASK_ENDPOINTS.CREATE_GENERIC_TASK, payload, { headers });
|
|
8394
8942
|
const normalizedData = transformData(response.data, TaskMap);
|
|
8395
8943
|
const transformedData = applyDataTransforms(normalizedData, { field: "status", valueMap: TaskStatusMap });
|
|
8396
8944
|
return createTaskWithMethods(transformedData, this);
|
|
@@ -9022,6 +9570,35 @@ var AssetValueType;
|
|
|
9022
9570
|
AssetValueType2["Credential"] = "Credential";
|
|
9023
9571
|
AssetValueType2["Secret"] = "Secret";
|
|
9024
9572
|
})(AssetValueType || (AssetValueType = {}));
|
|
9573
|
+
async function resolveRefToId(ref, resolvers, callerLabel) {
|
|
9574
|
+
if (!ref) {
|
|
9575
|
+
throw new ValidationError({
|
|
9576
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
9577
|
+
});
|
|
9578
|
+
}
|
|
9579
|
+
if ("id" in ref && ref.id != null) {
|
|
9580
|
+
return { id: ref.id, effectiveFolder: {} };
|
|
9581
|
+
}
|
|
9582
|
+
const stringVariants = [
|
|
9583
|
+
{ variant: "name", resolver: resolvers.byName },
|
|
9584
|
+
{ variant: "key", resolver: resolvers.byKey }
|
|
9585
|
+
];
|
|
9586
|
+
for (const { variant, resolver } of stringVariants) {
|
|
9587
|
+
const value = ref[variant];
|
|
9588
|
+
if (!value)
|
|
9589
|
+
continue;
|
|
9590
|
+
if (!resolver) {
|
|
9591
|
+
throw new ValidationError({
|
|
9592
|
+
message: `${callerLabel}: this method does not support lookup by '${variant}'.`
|
|
9593
|
+
});
|
|
9594
|
+
}
|
|
9595
|
+
const { id, folderId, folderKey, folderPath } = await resolver(value);
|
|
9596
|
+
return { id, effectiveFolder: { folderId, folderKey, folderPath } };
|
|
9597
|
+
}
|
|
9598
|
+
throw new ValidationError({
|
|
9599
|
+
message: `${callerLabel}: ref must supply exactly one of 'id', 'name', or 'key'.`
|
|
9600
|
+
});
|
|
9601
|
+
}
|
|
9025
9602
|
var AssetMap = {
|
|
9026
9603
|
creationTime: "createdTime",
|
|
9027
9604
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -9060,7 +9637,41 @@ class AssetService extends FolderScopedService {
|
|
|
9060
9637
|
return transformedAsset;
|
|
9061
9638
|
}
|
|
9062
9639
|
async getByName(name, options = {}) {
|
|
9063
|
-
|
|
9640
|
+
const { result } = await this.getByNameLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
9641
|
+
return result;
|
|
9642
|
+
}
|
|
9643
|
+
async getByKey(key, options = {}) {
|
|
9644
|
+
const { result } = await this.getByKeyLookup("Asset", ASSET_ENDPOINTS.GET_BY_FOLDER, key, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
|
|
9645
|
+
return result;
|
|
9646
|
+
}
|
|
9647
|
+
async updateValue(assetRef, newValue, options) {
|
|
9648
|
+
if (newValue === null || newValue === undefined) {
|
|
9649
|
+
throw new ValidationError({ message: "newValue is required for updateValue" });
|
|
9650
|
+
}
|
|
9651
|
+
let preFetched;
|
|
9652
|
+
const { id, effectiveFolder } = await resolveRefToId(assetRef, {
|
|
9653
|
+
byName: async (name) => {
|
|
9654
|
+
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");
|
|
9655
|
+
preFetched = asset;
|
|
9656
|
+
return { id: asset.id, ...folder };
|
|
9657
|
+
},
|
|
9658
|
+
byKey: async (key) => {
|
|
9659
|
+
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");
|
|
9660
|
+
preFetched = asset;
|
|
9661
|
+
return { id: asset.id, ...folder };
|
|
9662
|
+
}
|
|
9663
|
+
}, "Assets.updateValue");
|
|
9664
|
+
if (id <= 0) {
|
|
9665
|
+
throw new ValidationError({ message: "Assets.updateValue: assetRef.id must be a positive number." });
|
|
9666
|
+
}
|
|
9667
|
+
const headers = resolveFolderHeaders({
|
|
9668
|
+
folderId: effectiveFolder.folderId ?? options?.folderId,
|
|
9669
|
+
folderKey: effectiveFolder.folderKey ?? options?.folderKey,
|
|
9670
|
+
folderPath: effectiveFolder.folderPath ?? options?.folderPath,
|
|
9671
|
+
resourceType: "Assets.updateValue",
|
|
9672
|
+
fallbackFolderKey: this.config.folderKey
|
|
9673
|
+
});
|
|
9674
|
+
await this.updateValueByResolvedId(id, newValue, headers, preFetched);
|
|
9064
9675
|
}
|
|
9065
9676
|
async updateValueById(id, newValue, options) {
|
|
9066
9677
|
if (!id) {
|
|
@@ -9076,19 +9687,30 @@ class AssetService extends FolderScopedService {
|
|
|
9076
9687
|
resourceType: "Assets.updateValueById",
|
|
9077
9688
|
fallbackFolderKey: this.config.folderKey
|
|
9078
9689
|
});
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9690
|
+
await this.updateValueByResolvedId(id, newValue, headers);
|
|
9691
|
+
}
|
|
9692
|
+
async updateValueByResolvedId(id, newValue, headers, preFetched) {
|
|
9693
|
+
const shape = preFetched ?? await this.fetchAssetShape(id, headers);
|
|
9694
|
+
const valueField = resolveValueField(id, shape.valueType, newValue);
|
|
9082
9695
|
const body = {
|
|
9083
9696
|
Id: id,
|
|
9084
|
-
Name:
|
|
9085
|
-
ValueScope:
|
|
9086
|
-
ValueType:
|
|
9087
|
-
Description:
|
|
9697
|
+
Name: shape.name,
|
|
9698
|
+
ValueScope: shape.valueScope,
|
|
9699
|
+
ValueType: shape.valueType,
|
|
9700
|
+
Description: shape.description,
|
|
9088
9701
|
[valueField]: newValue
|
|
9089
9702
|
};
|
|
9090
9703
|
await this.put(ASSET_ENDPOINTS.GET_BY_ID(id), body, { headers });
|
|
9091
9704
|
}
|
|
9705
|
+
async fetchAssetShape(id, headers) {
|
|
9706
|
+
const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), { headers });
|
|
9707
|
+
return {
|
|
9708
|
+
name: response.data.Name,
|
|
9709
|
+
valueScope: response.data.ValueScope,
|
|
9710
|
+
valueType: response.data.ValueType,
|
|
9711
|
+
description: response.data.Description
|
|
9712
|
+
};
|
|
9713
|
+
}
|
|
9092
9714
|
}
|
|
9093
9715
|
__decorate([
|
|
9094
9716
|
track("Assets.GetAll")
|
|
@@ -9099,6 +9721,12 @@ __decorate([
|
|
|
9099
9721
|
__decorate([
|
|
9100
9722
|
track("Assets.GetByName")
|
|
9101
9723
|
], AssetService.prototype, "getByName", null);
|
|
9724
|
+
__decorate([
|
|
9725
|
+
track("Assets.GetByKey")
|
|
9726
|
+
], AssetService.prototype, "getByKey", null);
|
|
9727
|
+
__decorate([
|
|
9728
|
+
track("Assets.UpdateValue")
|
|
9729
|
+
], AssetService.prototype, "updateValue", null);
|
|
9102
9730
|
__decorate([
|
|
9103
9731
|
track("Assets.UpdateValueById")
|
|
9104
9732
|
], AssetService.prototype, "updateValueById", null);
|
|
@@ -9127,7 +9755,7 @@ function resolveValueField(id, valueType, newValue) {
|
|
|
9127
9755
|
return "BoolValue";
|
|
9128
9756
|
default:
|
|
9129
9757
|
throw new ValidationError({
|
|
9130
|
-
message: `
|
|
9758
|
+
message: `Asset ${id} has valueType ${valueType}; only Text, Integer, and Bool are supported`
|
|
9131
9759
|
});
|
|
9132
9760
|
}
|
|
9133
9761
|
}
|
|
@@ -9155,7 +9783,8 @@ class BucketService extends FolderScopedService {
|
|
|
9155
9783
|
return pascalToCamelCaseKeys(response.data);
|
|
9156
9784
|
}
|
|
9157
9785
|
async getByName(name, options = {}) {
|
|
9158
|
-
|
|
9786
|
+
const { result } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
|
|
9787
|
+
return result;
|
|
9159
9788
|
}
|
|
9160
9789
|
async getAll(options) {
|
|
9161
9790
|
const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
|
|
@@ -10022,7 +10651,8 @@ class ProcessService extends FolderScopedService {
|
|
|
10022
10651
|
return transformedProcess;
|
|
10023
10652
|
}
|
|
10024
10653
|
async getByName(name, options = {}) {
|
|
10025
|
-
|
|
10654
|
+
const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
|
|
10655
|
+
return result;
|
|
10026
10656
|
}
|
|
10027
10657
|
}
|
|
10028
10658
|
__decorate([
|
|
@@ -10037,21 +10667,112 @@ __decorate([
|
|
|
10037
10667
|
__decorate([
|
|
10038
10668
|
track("Processes.GetByName")
|
|
10039
10669
|
], ProcessService.prototype, "getByName", null);
|
|
10670
|
+
var QueuePriority;
|
|
10671
|
+
(function(QueuePriority2) {
|
|
10672
|
+
QueuePriority2["High"] = "High";
|
|
10673
|
+
QueuePriority2["Normal"] = "Normal";
|
|
10674
|
+
QueuePriority2["Low"] = "Low";
|
|
10675
|
+
})(QueuePriority || (QueuePriority = {}));
|
|
10676
|
+
var QueueItemStatus;
|
|
10677
|
+
(function(QueueItemStatus2) {
|
|
10678
|
+
QueueItemStatus2["New"] = "New";
|
|
10679
|
+
QueueItemStatus2["InProgress"] = "InProgress";
|
|
10680
|
+
QueueItemStatus2["Failed"] = "Failed";
|
|
10681
|
+
QueueItemStatus2["Successful"] = "Successful";
|
|
10682
|
+
QueueItemStatus2["Abandoned"] = "Abandoned";
|
|
10683
|
+
QueueItemStatus2["Retried"] = "Retried";
|
|
10684
|
+
QueueItemStatus2["Deleted"] = "Deleted";
|
|
10685
|
+
})(QueueItemStatus || (QueueItemStatus = {}));
|
|
10686
|
+
var QueueItemReviewStatus;
|
|
10687
|
+
(function(QueueItemReviewStatus2) {
|
|
10688
|
+
QueueItemReviewStatus2["None"] = "None";
|
|
10689
|
+
QueueItemReviewStatus2["InReview"] = "InReview";
|
|
10690
|
+
QueueItemReviewStatus2["Verified"] = "Verified";
|
|
10691
|
+
QueueItemReviewStatus2["Retried"] = "Retried";
|
|
10692
|
+
})(QueueItemReviewStatus || (QueueItemReviewStatus = {}));
|
|
10693
|
+
var QueueExceptionType;
|
|
10694
|
+
(function(QueueExceptionType2) {
|
|
10695
|
+
QueueExceptionType2["ApplicationException"] = "ApplicationException";
|
|
10696
|
+
QueueExceptionType2["BusinessException"] = "BusinessException";
|
|
10697
|
+
})(QueueExceptionType || (QueueExceptionType = {}));
|
|
10698
|
+
var QueueTransactionOutcome;
|
|
10699
|
+
(function(QueueTransactionOutcome2) {
|
|
10700
|
+
QueueTransactionOutcome2["Successful"] = "Successful";
|
|
10701
|
+
QueueTransactionOutcome2["Failed"] = "Failed";
|
|
10702
|
+
})(QueueTransactionOutcome || (QueueTransactionOutcome = {}));
|
|
10703
|
+
function createQueueMethods(queueData, service) {
|
|
10704
|
+
return {
|
|
10705
|
+
async getAllItems(options) {
|
|
10706
|
+
if (!queueData.id)
|
|
10707
|
+
throw new ValidationError({ message: "Queue ID is undefined" });
|
|
10708
|
+
if (!queueData.folderId)
|
|
10709
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
10710
|
+
return service.getAllItems(queueData.id, { ...options, folderId: queueData.folderId });
|
|
10711
|
+
},
|
|
10712
|
+
async insertItem(specificData, options) {
|
|
10713
|
+
if (!queueData.name)
|
|
10714
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
10715
|
+
if (!queueData.folderId)
|
|
10716
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
10717
|
+
return service.insertItemByName(queueData.name, specificData, { ...options, folderId: queueData.folderId });
|
|
10718
|
+
},
|
|
10719
|
+
async startTransaction() {
|
|
10720
|
+
if (!queueData.name)
|
|
10721
|
+
throw new ValidationError({ message: "Queue name is undefined" });
|
|
10722
|
+
if (!queueData.folderId)
|
|
10723
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
10724
|
+
return service.startTransaction({ name: queueData.name }, { folderId: queueData.folderId });
|
|
10725
|
+
},
|
|
10726
|
+
async completeTransaction(itemId, outcome, options) {
|
|
10727
|
+
if (!queueData.folderId)
|
|
10728
|
+
throw new ValidationError({ message: "Folder ID is undefined" });
|
|
10729
|
+
return service.completeTransaction(itemId, outcome, { ...options, folderId: queueData.folderId });
|
|
10730
|
+
}
|
|
10731
|
+
};
|
|
10732
|
+
}
|
|
10733
|
+
function createQueueWithMethods(queueData, service) {
|
|
10734
|
+
return Object.assign({}, queueData, createQueueMethods(queueData, service));
|
|
10735
|
+
}
|
|
10040
10736
|
var QueueMap = {
|
|
10041
10737
|
creationTime: "createdTime",
|
|
10042
10738
|
organizationUnitId: "folderId",
|
|
10043
10739
|
organizationUnitFullyQualifiedName: "folderName"
|
|
10044
10740
|
};
|
|
10741
|
+
var QueueItemMap = {
|
|
10742
|
+
queueDefinitionId: "queueId",
|
|
10743
|
+
creationTime: "createdTime",
|
|
10744
|
+
organizationUnitId: "folderId",
|
|
10745
|
+
organizationUnitFullyQualifiedName: "folderName",
|
|
10746
|
+
startProcessing: "processingStartTime",
|
|
10747
|
+
endProcessing: "processingEndTime",
|
|
10748
|
+
processingException: "processingError"
|
|
10749
|
+
};
|
|
10750
|
+
var QueueItemProcessingErrorMap = {
|
|
10751
|
+
creationTime: "createdTime"
|
|
10752
|
+
};
|
|
10753
|
+
function transformQueueItem(queueItem) {
|
|
10754
|
+
const { SpecificContent, Output, SpecificData: _sd, OutputData: _od, ...rest } = queueItem;
|
|
10755
|
+
const transformed = transformData(pascalToCamelCaseKeys(rest), QueueItemMap);
|
|
10756
|
+
if (transformed.processingError) {
|
|
10757
|
+
transformed.processingError = transformData(transformed.processingError, QueueItemProcessingErrorMap);
|
|
10758
|
+
}
|
|
10759
|
+
transformed.specificData = SpecificContent ?? null;
|
|
10760
|
+
transformed.outputData = Output ?? null;
|
|
10761
|
+
return transformed;
|
|
10762
|
+
}
|
|
10045
10763
|
|
|
10046
10764
|
class QueueService extends FolderScopedService {
|
|
10047
10765
|
async getAll(options) {
|
|
10048
|
-
const
|
|
10049
|
-
const
|
|
10766
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
|
|
10767
|
+
const hasFolderScope = folderId !== undefined || !!folderKey?.trim() || !!folderPath?.trim();
|
|
10768
|
+
const headers = hasFolderScope ? resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Queues.getAll" }) : undefined;
|
|
10769
|
+
const apiOptions = transformOptions(queryOptions, QueueMap);
|
|
10050
10770
|
return PaginationHelpers.getAll({
|
|
10051
10771
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
10052
|
-
getEndpoint: (
|
|
10772
|
+
getEndpoint: () => hasFolderScope ? QUEUE_ENDPOINTS.GET_BY_FOLDER : QUEUE_ENDPOINTS.GET_ALL,
|
|
10053
10773
|
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_BY_FOLDER,
|
|
10054
|
-
|
|
10774
|
+
headers,
|
|
10775
|
+
transformFn: (queue) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(queue), QueueMap), this),
|
|
10055
10776
|
pagination: {
|
|
10056
10777
|
paginationType: PaginationType.OFFSET,
|
|
10057
10778
|
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
@@ -10064,15 +10785,176 @@ class QueueService extends FolderScopedService {
|
|
|
10064
10785
|
}
|
|
10065
10786
|
}, apiOptions);
|
|
10066
10787
|
}
|
|
10067
|
-
async getById(id,
|
|
10068
|
-
|
|
10069
|
-
|
|
10788
|
+
async getById(id, folderIdOrOptions, options = {}) {
|
|
10789
|
+
if (typeof folderIdOrOptions === "number") {
|
|
10790
|
+
const headers2 = createHeaders({ [FOLDER_ID]: folderIdOrOptions });
|
|
10791
|
+
const apiFieldOptions2 = transformOptions(options, QueueMap);
|
|
10792
|
+
const apiOptions2 = addPrefixToKeys(apiFieldOptions2, ODATA_PREFIX, Object.keys(apiFieldOptions2));
|
|
10793
|
+
const response2 = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
10794
|
+
headers: headers2,
|
|
10795
|
+
params: apiOptions2
|
|
10796
|
+
});
|
|
10797
|
+
return transformData(pascalToCamelCaseKeys(response2.data), QueueMap);
|
|
10798
|
+
}
|
|
10799
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = folderIdOrOptions ?? {};
|
|
10800
|
+
const headers = resolveFolderHeaders({
|
|
10801
|
+
folderId,
|
|
10802
|
+
folderKey,
|
|
10803
|
+
folderPath,
|
|
10804
|
+
resourceType: "Queues.getById",
|
|
10805
|
+
fallbackFolderKey: this.config.folderKey
|
|
10806
|
+
});
|
|
10807
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
10070
10808
|
const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
|
|
10071
10809
|
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(id), {
|
|
10072
10810
|
headers,
|
|
10073
10811
|
params: apiOptions
|
|
10074
10812
|
});
|
|
10075
|
-
|
|
10813
|
+
const rawQueue = transformData(pascalToCamelCaseKeys(response.data), QueueMap);
|
|
10814
|
+
return createQueueWithMethods(rawQueue, this);
|
|
10815
|
+
}
|
|
10816
|
+
async getByName(name, options = {}) {
|
|
10817
|
+
const { result } = await this.getByNameLookup("Queue", QUEUE_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => createQueueWithMethods(transformData(pascalToCamelCaseKeys(raw), QueueMap), this), QueueMap);
|
|
10818
|
+
return result;
|
|
10819
|
+
}
|
|
10820
|
+
async getByKey(key, options = {}) {
|
|
10821
|
+
const trimmedKey = key?.trim();
|
|
10822
|
+
if (!trimmedKey || !GUID_REGEX.test(trimmedKey)) {
|
|
10823
|
+
throw new ValidationError({ message: "key must be a GUID for getByKey" });
|
|
10824
|
+
}
|
|
10825
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
10826
|
+
const headers = resolveFolderHeaders({
|
|
10827
|
+
folderId,
|
|
10828
|
+
folderKey,
|
|
10829
|
+
folderPath,
|
|
10830
|
+
resourceType: "Queues.getByKey",
|
|
10831
|
+
fallbackFolderKey: this.config.folderKey
|
|
10832
|
+
});
|
|
10833
|
+
const apiFieldOptions = transformOptions(queryOptions, QueueMap);
|
|
10834
|
+
const apiOptions = {
|
|
10835
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
10836
|
+
$filter: `Key eq ${trimmedKey}`,
|
|
10837
|
+
$top: "1"
|
|
10838
|
+
};
|
|
10839
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_FOLDER, { headers, params: apiOptions });
|
|
10840
|
+
const items = response.data?.value;
|
|
10841
|
+
if (!items?.length) {
|
|
10842
|
+
throw new NotFoundError({ message: `Queue with key '${trimmedKey}' not found.` });
|
|
10843
|
+
}
|
|
10844
|
+
return createQueueWithMethods(transformData(pascalToCamelCaseKeys(items[0]), QueueMap), this);
|
|
10845
|
+
}
|
|
10846
|
+
async getAllItems(queueId, options) {
|
|
10847
|
+
if (!queueId) {
|
|
10848
|
+
throw new ValidationError({ message: "queueId is required for getAllItems" });
|
|
10849
|
+
}
|
|
10850
|
+
const { folderId, folderKey, folderPath, filter, ...restOptions } = options ?? {};
|
|
10851
|
+
const headers = resolveFolderHeaders({
|
|
10852
|
+
folderId,
|
|
10853
|
+
folderKey,
|
|
10854
|
+
folderPath,
|
|
10855
|
+
resourceType: "Queues.getAllItems",
|
|
10856
|
+
fallbackFolderKey: this.config.folderKey
|
|
10857
|
+
});
|
|
10858
|
+
const mergedFilter = filter ? `(${filter}) and queueId eq ${queueId}` : `queueId eq ${queueId}`;
|
|
10859
|
+
const apiOptions = transformOptions({ ...restOptions, filter: mergedFilter }, QueueItemMap);
|
|
10860
|
+
return PaginationHelpers.getAll({
|
|
10861
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
10862
|
+
getEndpoint: () => QUEUE_ENDPOINTS.GET_ITEMS,
|
|
10863
|
+
getByFolderEndpoint: QUEUE_ENDPOINTS.GET_ITEMS,
|
|
10864
|
+
headers,
|
|
10865
|
+
transformFn: transformQueueItem,
|
|
10866
|
+
pagination: {
|
|
10867
|
+
paginationType: PaginationType.OFFSET,
|
|
10868
|
+
itemsField: ODATA_PAGINATION.ITEMS_FIELD,
|
|
10869
|
+
totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
|
|
10870
|
+
paginationParams: {
|
|
10871
|
+
pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
10872
|
+
offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
|
|
10873
|
+
countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
|
|
10874
|
+
}
|
|
10875
|
+
}
|
|
10876
|
+
}, apiOptions);
|
|
10877
|
+
}
|
|
10878
|
+
async insertItemByName(queueName, specificData, options = {}) {
|
|
10879
|
+
if (!queueName) {
|
|
10880
|
+
throw new ValidationError({ message: "queueName is required for insertItemByName" });
|
|
10881
|
+
}
|
|
10882
|
+
const headers = resolveFolderHeaders({
|
|
10883
|
+
folderId: options.folderId,
|
|
10884
|
+
folderKey: options.folderKey,
|
|
10885
|
+
folderPath: options.folderPath,
|
|
10886
|
+
resourceType: "Queues.insertItemByName",
|
|
10887
|
+
fallbackFolderKey: this.config.folderKey
|
|
10888
|
+
});
|
|
10889
|
+
const response = await this.post(QUEUE_ENDPOINTS.ADD_ITEM, {
|
|
10890
|
+
itemData: {
|
|
10891
|
+
Name: queueName,
|
|
10892
|
+
Priority: options.priority ?? QueuePriority.Normal,
|
|
10893
|
+
Reference: options.reference,
|
|
10894
|
+
Progress: options.progress,
|
|
10895
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
10896
|
+
DueDate: options.dueDate?.toISOString(),
|
|
10897
|
+
RiskSlaDate: options.riskSlaDate?.toISOString(),
|
|
10898
|
+
SpecificContent: specificData
|
|
10899
|
+
}
|
|
10900
|
+
}, { headers });
|
|
10901
|
+
return transformQueueItem(response.data);
|
|
10902
|
+
}
|
|
10903
|
+
async startTransaction(queue, options = {}) {
|
|
10904
|
+
const headers = resolveFolderHeaders({
|
|
10905
|
+
folderId: options.folderId,
|
|
10906
|
+
folderKey: options.folderKey,
|
|
10907
|
+
folderPath: options.folderPath,
|
|
10908
|
+
resourceType: "Queues.startTransaction",
|
|
10909
|
+
fallbackFolderKey: this.config.folderKey
|
|
10910
|
+
});
|
|
10911
|
+
let queueName;
|
|
10912
|
+
if (queue?.name) {
|
|
10913
|
+
queueName = queue.name;
|
|
10914
|
+
} else if (queue?.id != null) {
|
|
10915
|
+
queueName = await this.resolveQueueName(queue.id, headers);
|
|
10916
|
+
} else {
|
|
10917
|
+
throw new ValidationError({ message: "queue id or name is required for startTransaction" });
|
|
10918
|
+
}
|
|
10919
|
+
const response = await this.post(QUEUE_ENDPOINTS.START_TRANSACTION, {
|
|
10920
|
+
transactionData: { Name: queueName }
|
|
10921
|
+
}, { headers });
|
|
10922
|
+
if (!response.data || typeof response.data !== "object") {
|
|
10923
|
+
return null;
|
|
10924
|
+
}
|
|
10925
|
+
return transformQueueItem(response.data);
|
|
10926
|
+
}
|
|
10927
|
+
async completeTransaction(itemId, outcome, options = {}) {
|
|
10928
|
+
if (!itemId) {
|
|
10929
|
+
throw new ValidationError({ message: "itemId is required for completeTransaction" });
|
|
10930
|
+
}
|
|
10931
|
+
const headers = resolveFolderHeaders({
|
|
10932
|
+
folderId: options.folderId,
|
|
10933
|
+
folderKey: options.folderKey,
|
|
10934
|
+
folderPath: options.folderPath,
|
|
10935
|
+
resourceType: "Queues.completeTransaction",
|
|
10936
|
+
fallbackFolderKey: this.config.folderKey
|
|
10937
|
+
});
|
|
10938
|
+
const transactionResult = {
|
|
10939
|
+
IsSuccessful: outcome === QueueTransactionOutcome.Successful,
|
|
10940
|
+
ProcessingException: options.processingError && {
|
|
10941
|
+
Reason: options.processingError.reason,
|
|
10942
|
+
Details: options.processingError.details,
|
|
10943
|
+
Type: options.processingError.type,
|
|
10944
|
+
AssociatedImageFilePath: options.processingError.associatedImageFilePath
|
|
10945
|
+
},
|
|
10946
|
+
DeferDate: options.deferDate?.toISOString(),
|
|
10947
|
+
DueDate: options.dueDate?.toISOString(),
|
|
10948
|
+
Progress: options.progress,
|
|
10949
|
+
OperationId: options.operationId,
|
|
10950
|
+
Output: options.outputData,
|
|
10951
|
+
Analytics: options.analytics
|
|
10952
|
+
};
|
|
10953
|
+
await this.post(QUEUE_ENDPOINTS.SET_TRANSACTION_RESULT(itemId), { transactionResult }, { headers });
|
|
10954
|
+
}
|
|
10955
|
+
async resolveQueueName(queueId, headers) {
|
|
10956
|
+
const response = await this.get(QUEUE_ENDPOINTS.GET_BY_ID(queueId), { headers, params: { $select: "Name" } });
|
|
10957
|
+
return response.data.Name;
|
|
10076
10958
|
}
|
|
10077
10959
|
}
|
|
10078
10960
|
__decorate([
|
|
@@ -10081,6 +10963,24 @@ __decorate([
|
|
|
10081
10963
|
__decorate([
|
|
10082
10964
|
track("Queues.GetById")
|
|
10083
10965
|
], QueueService.prototype, "getById", null);
|
|
10966
|
+
__decorate([
|
|
10967
|
+
track("Queues.GetByName")
|
|
10968
|
+
], QueueService.prototype, "getByName", null);
|
|
10969
|
+
__decorate([
|
|
10970
|
+
track("Queues.GetByKey")
|
|
10971
|
+
], QueueService.prototype, "getByKey", null);
|
|
10972
|
+
__decorate([
|
|
10973
|
+
track("Queues.GetAllItems")
|
|
10974
|
+
], QueueService.prototype, "getAllItems", null);
|
|
10975
|
+
__decorate([
|
|
10976
|
+
track("Queues.InsertItemByName")
|
|
10977
|
+
], QueueService.prototype, "insertItemByName", null);
|
|
10978
|
+
__decorate([
|
|
10979
|
+
track("Queues.StartTransaction")
|
|
10980
|
+
], QueueService.prototype, "startTransaction", null);
|
|
10981
|
+
__decorate([
|
|
10982
|
+
track("Queues.CompleteTransaction")
|
|
10983
|
+
], QueueService.prototype, "completeTransaction", null);
|
|
10084
10984
|
var TaskCatalogMap = {
|
|
10085
10985
|
creationTime: "createdTime",
|
|
10086
10986
|
lastModificationTime: "lastModifiedTime"
|
|
@@ -10127,7 +11027,8 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
10127
11027
|
return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
|
|
10128
11028
|
}
|
|
10129
11029
|
async getByName(name, options = {}) {
|
|
10130
|
-
|
|
11030
|
+
const { result } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
11031
|
+
return result;
|
|
10131
11032
|
}
|
|
10132
11033
|
async create(name, options = {}) {
|
|
10133
11034
|
if (!name) {
|
|
@@ -10151,7 +11052,7 @@ class TaskCatalogService extends FolderScopedService {
|
|
|
10151
11052
|
throw new ValidationError({ message: "name is required for updateByName" });
|
|
10152
11053
|
}
|
|
10153
11054
|
const { folderId, folderKey, folderPath } = options;
|
|
10154
|
-
const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
11055
|
+
const { result: current } = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
|
|
10155
11056
|
return this.update(current, options);
|
|
10156
11057
|
}
|
|
10157
11058
|
async update(current, options) {
|
|
@@ -10296,6 +11197,13 @@ var AgentMap = {
|
|
|
10296
11197
|
var UserSettingsMap = {
|
|
10297
11198
|
...CommonFieldMap
|
|
10298
11199
|
};
|
|
11200
|
+
var ConnectionState;
|
|
11201
|
+
(function(ConnectionState2) {
|
|
11202
|
+
ConnectionState2["Enabled"] = "Enabled";
|
|
11203
|
+
ConnectionState2["Disabled"] = "Disabled";
|
|
11204
|
+
ConnectionState2["Expired"] = "Expired";
|
|
11205
|
+
ConnectionState2["Failed"] = "Failed";
|
|
11206
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
10299
11207
|
var FeedbackStatus;
|
|
10300
11208
|
(function(FeedbackStatus2) {
|
|
10301
11209
|
FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
|
|
@@ -10718,7 +11626,7 @@ var registerAgentsCommand = (program) => {
|
|
|
10718
11626
|
processContext.exit(1);
|
|
10719
11627
|
return;
|
|
10720
11628
|
}
|
|
10721
|
-
const { ConversationalAgentService } = await import("./index-
|
|
11629
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
10722
11630
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
10723
11631
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
10724
11632
|
});
|
|
@@ -10749,7 +11657,7 @@ var registerAgentsCommand = (program) => {
|
|
|
10749
11657
|
processContext.exit(1);
|
|
10750
11658
|
return;
|
|
10751
11659
|
}
|
|
10752
|
-
const { ConversationalAgentService } = await import("./index-
|
|
11660
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
10753
11661
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
10754
11662
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
10755
11663
|
});
|
|
@@ -10954,7 +11862,7 @@ var registerChatCommand = (program) => {
|
|
|
10954
11862
|
processContext.exit(1);
|
|
10955
11863
|
return;
|
|
10956
11864
|
}
|
|
10957
|
-
const { ConversationalAgentService, MessageRole: MessageRole2 } = await import("./index-
|
|
11865
|
+
const { ConversationalAgentService, MessageRole: MessageRole2 } = await import("./index-a3nybs0a.js");
|
|
10958
11866
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
10959
11867
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
10960
11868
|
});
|
|
@@ -11025,7 +11933,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11025
11933
|
processContext.exit(1);
|
|
11026
11934
|
return;
|
|
11027
11935
|
}
|
|
11028
|
-
const { ConversationalAgentService } = await import("./index-
|
|
11936
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11029
11937
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11030
11938
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11031
11939
|
});
|
|
@@ -11076,7 +11984,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11076
11984
|
processContext.exit(1);
|
|
11077
11985
|
return;
|
|
11078
11986
|
}
|
|
11079
|
-
const { ConversationalAgentService } = await import("./index-
|
|
11987
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11080
11988
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11081
11989
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11082
11990
|
});
|
|
@@ -11110,7 +12018,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11110
12018
|
processContext.exit(1);
|
|
11111
12019
|
return;
|
|
11112
12020
|
}
|
|
11113
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12021
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11114
12022
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11115
12023
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11116
12024
|
});
|
|
@@ -11168,7 +12076,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11168
12076
|
processContext.exit(1);
|
|
11169
12077
|
return;
|
|
11170
12078
|
}
|
|
11171
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12079
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11172
12080
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11173
12081
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11174
12082
|
});
|
|
@@ -11201,7 +12109,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11201
12109
|
processContext.exit(1);
|
|
11202
12110
|
return;
|
|
11203
12111
|
}
|
|
11204
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12112
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11205
12113
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11206
12114
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11207
12115
|
});
|
|
@@ -11234,7 +12142,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11234
12142
|
processContext.exit(1);
|
|
11235
12143
|
return;
|
|
11236
12144
|
}
|
|
11237
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12145
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11238
12146
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11239
12147
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11240
12148
|
});
|
|
@@ -11277,7 +12185,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11277
12185
|
processContext.exit(1);
|
|
11278
12186
|
return;
|
|
11279
12187
|
}
|
|
11280
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12188
|
+
const { ConversationalAgentService } = await import("./index-a3nybs0a.js");
|
|
11281
12189
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11282
12190
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11283
12191
|
});
|
|
@@ -11322,7 +12230,7 @@ var registerExchangesCommand = (program) => {
|
|
|
11322
12230
|
processContext.exit(1);
|
|
11323
12231
|
return;
|
|
11324
12232
|
}
|
|
11325
|
-
const { ExchangeService } = await import("./index-
|
|
12233
|
+
const { ExchangeService } = await import("./index-a3nybs0a.js");
|
|
11326
12234
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
11327
12235
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11328
12236
|
});
|
|
@@ -11356,7 +12264,7 @@ var registerExchangesCommand = (program) => {
|
|
|
11356
12264
|
processContext.exit(1);
|
|
11357
12265
|
return;
|
|
11358
12266
|
}
|
|
11359
|
-
const { ExchangeService } = await import("./index-
|
|
12267
|
+
const { ExchangeService } = await import("./index-a3nybs0a.js");
|
|
11360
12268
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
11361
12269
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11362
12270
|
});
|
|
@@ -11396,7 +12304,7 @@ var registerExchangesCommand = (program) => {
|
|
|
11396
12304
|
processContext.exit(1);
|
|
11397
12305
|
return;
|
|
11398
12306
|
}
|
|
11399
|
-
const { ExchangeService, FeedbackRating: FeedbackRating2 } = await import("./index-
|
|
12307
|
+
const { ExchangeService, FeedbackRating: FeedbackRating2 } = await import("./index-a3nybs0a.js");
|
|
11400
12308
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
11401
12309
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11402
12310
|
});
|
|
@@ -11435,7 +12343,7 @@ var registerMessagesCommand = (program) => {
|
|
|
11435
12343
|
processContext.exit(1);
|
|
11436
12344
|
return;
|
|
11437
12345
|
}
|
|
11438
|
-
const { MessageService } = await import("./index-
|
|
12346
|
+
const { MessageService } = await import("./index-a3nybs0a.js");
|
|
11439
12347
|
const msgSvc = new MessageService(sdk, {
|
|
11440
12348
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11441
12349
|
});
|
|
@@ -11466,7 +12374,7 @@ var registerMessagesCommand = (program) => {
|
|
|
11466
12374
|
processContext.exit(1);
|
|
11467
12375
|
return;
|
|
11468
12376
|
}
|
|
11469
|
-
const { MessageService } = await import("./index-
|
|
12377
|
+
const { MessageService } = await import("./index-a3nybs0a.js");
|
|
11470
12378
|
const msgSvc = new MessageService(sdk, {
|
|
11471
12379
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11472
12380
|
});
|
|
@@ -11573,7 +12481,7 @@ var resolveEntryPoint = (entryPoints, requested) => {
|
|
|
11573
12481
|
var resolveBinding = async (target) => {
|
|
11574
12482
|
const processKey = target.processKey.toLowerCase();
|
|
11575
12483
|
const folderKey = target.folderKey.toLowerCase();
|
|
11576
|
-
const { listVoiceEntryPoints } = await import("./cas-client-
|
|
12484
|
+
const { listVoiceEntryPoints } = await import("./cas-client-pgtr3hgy.js");
|
|
11577
12485
|
const [epError, entryPoints] = await catchError(listVoiceEntryPoints(processKey, folderKey));
|
|
11578
12486
|
if (epError) {
|
|
11579
12487
|
await failFromError(epError);
|
|
@@ -11589,7 +12497,7 @@ var resolveBinding = async (target) => {
|
|
|
11589
12497
|
var registerTrunksCommand = (program) => {
|
|
11590
12498
|
const trunks = program.command("trunks").description("Inspect the SIP trunks (phone numbers) configured for conversational voice.");
|
|
11591
12499
|
trunks.command("list").description("List the tenant's SIP trunks. Voice flows dial out from an outbound-enabled trunk's phone number (`inputs.from` on Create outgoing call); inbound-enabled trunks route incoming calls to a published process. Trunks are connected in Instance Management under Phone numbers.").option("--direction <direction>", "Only trunks enabled for this call direction: inbound or outbound (default: all trunks)", parseDirection).trackedAction(processContext, async (options) => {
|
|
11592
|
-
const { listSipTrunks } = await import("./cas-client-
|
|
12500
|
+
const { listSipTrunks } = await import("./cas-client-pgtr3hgy.js");
|
|
11593
12501
|
const [listError, trunks2] = await catchError(listSipTrunks(options.direction));
|
|
11594
12502
|
if (listError) {
|
|
11595
12503
|
await failFromError(listError);
|
|
@@ -11605,7 +12513,7 @@ var registerTrunksCommand = (program) => {
|
|
|
11605
12513
|
const plan = planAssign(options);
|
|
11606
12514
|
if (plan === null)
|
|
11607
12515
|
return;
|
|
11608
|
-
const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-
|
|
12516
|
+
const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-pgtr3hgy.js");
|
|
11609
12517
|
const [trunkError, trunk] = await catchError(resolveSipTrunk(trunkArg));
|
|
11610
12518
|
if (trunkError) {
|
|
11611
12519
|
await failFromError(trunkError);
|
|
@@ -11647,7 +12555,7 @@ var registerUserSettingsCommand = (program) => {
|
|
|
11647
12555
|
processContext.exit(1);
|
|
11648
12556
|
return;
|
|
11649
12557
|
}
|
|
11650
|
-
const { UserSettingsService } = await import("./index-
|
|
12558
|
+
const { UserSettingsService } = await import("./index-a3nybs0a.js");
|
|
11651
12559
|
const userSvc = new UserSettingsService(sdk, {
|
|
11652
12560
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11653
12561
|
});
|
|
@@ -11702,7 +12610,7 @@ var registerUserSettingsCommand = (program) => {
|
|
|
11702
12610
|
processContext.exit(1);
|
|
11703
12611
|
return;
|
|
11704
12612
|
}
|
|
11705
|
-
const { UserSettingsService } = await import("./index-
|
|
12613
|
+
const { UserSettingsService } = await import("./index-a3nybs0a.js");
|
|
11706
12614
|
const userSvc = new UserSettingsService(sdk, {
|
|
11707
12615
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11708
12616
|
});
|
|
@@ -11743,4 +12651,4 @@ var registerCommands = async (program) => {
|
|
|
11743
12651
|
|
|
11744
12652
|
export { metadata, registerCommands };
|
|
11745
12653
|
|
|
11746
|
-
//# debugId=
|
|
12654
|
+
//# debugId=22EAAE518511FAD964756E2164756E21
|