@uipath/conversational-tool 1.204.0-preview.255 → 1.205.0-preview.256
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 +2 -2
- package/dist/{cas-client-5rycqhyk.js → cas-client-x6tjfhak.js} +1 -1
- package/dist/{index-a3nybs0a.js → index-nr509xjn.js} +266 -50
- package/dist/index.js +2 -2
- package/dist/{tool-p20pey5b.js → tool-bhzct5mh.js} +1289 -529
- package/dist/{tool-dck23h61.js → tool-p67st6tv.js} +142 -30
- 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-p67st6tv.js";
|
|
24
24
|
import {
|
|
25
25
|
__require
|
|
26
26
|
} from "./tool-1yh8g550.js";
|
|
@@ -3691,6 +3691,7 @@ object({
|
|
|
3691
3691
|
baseUrl: string().url().default("https://cloud.uipath.com"),
|
|
3692
3692
|
orgName: string().min(1),
|
|
3693
3693
|
tenantName: string().min(1),
|
|
3694
|
+
organizationId: string().optional(),
|
|
3694
3695
|
secret: string().optional(),
|
|
3695
3696
|
clientId: string().optional(),
|
|
3696
3697
|
redirectUri: string().url().optional(),
|
|
@@ -3703,6 +3704,7 @@ class UiPathConfig {
|
|
|
3703
3704
|
this.baseUrl = options.baseUrl;
|
|
3704
3705
|
this.orgName = options.orgName;
|
|
3705
3706
|
this.tenantName = options.tenantName;
|
|
3707
|
+
this.organizationId = options.organizationId;
|
|
3706
3708
|
this.secret = options.secret;
|
|
3707
3709
|
this.clientId = options.clientId;
|
|
3708
3710
|
this.redirectUri = options.redirectUri;
|
|
@@ -3747,6 +3749,11 @@ var AUTH_STORAGE_KEYS = {
|
|
|
3747
3749
|
OAUTH_CONTEXT: "uipath_sdk_oauth_context",
|
|
3748
3750
|
CODE_VERIFIER: "uipath_sdk_code_verifier"
|
|
3749
3751
|
};
|
|
3752
|
+
var TOKEN_EXPIRY_BUFFER_MS = 60 * 1000;
|
|
3753
|
+
function getExpiryMs(expiresAt) {
|
|
3754
|
+
const ms = expiresAt instanceof Date ? expiresAt.getTime() : new Date(expiresAt).getTime();
|
|
3755
|
+
return Number.isNaN(ms) ? 0 : ms;
|
|
3756
|
+
}
|
|
3750
3757
|
function hasOAuthConfig(config2) {
|
|
3751
3758
|
return Boolean(config2.clientId && config2.redirectUri && config2.scope);
|
|
3752
3759
|
}
|
|
@@ -4005,50 +4012,61 @@ var TASK_NOTE_ENDPOINTS = {
|
|
|
4005
4012
|
GET_BY_TASK_ID: (taskId) => `${ORCHESTRATOR_BASE}/odata/TaskNotes/UiPath.Server.Configuration.OData.GetByTaskId(taskId=${taskId})`,
|
|
4006
4013
|
CREATE: `${ORCHESTRATOR_BASE}/odata/TaskNotes/UiPath.Server.Configuration.OData.CreateTaskNote`
|
|
4007
4014
|
};
|
|
4008
|
-
var
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
}
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
}
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
}
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4015
|
+
var DATA_FABRIC_TENANT_FOLDER_ID = "00000000-0000-0000-0000-000000000000";
|
|
4016
|
+
var DATA_FABRIC_ENDPOINTS = {
|
|
4017
|
+
ENTITY: {
|
|
4018
|
+
GET_ALL: `${DATAFABRIC_BASE}/api/Entity`,
|
|
4019
|
+
GET_ALL_V3: `${DATAFABRIC_BASE}/api/v3/entities`,
|
|
4020
|
+
GET_ENTITY_RECORDS: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/read`,
|
|
4021
|
+
GET_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityId}`,
|
|
4022
|
+
GET_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/read/${recordId}`,
|
|
4023
|
+
INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/insert`,
|
|
4024
|
+
BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/insert-batch`,
|
|
4025
|
+
UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/update/${recordId}`,
|
|
4026
|
+
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/update-batch`,
|
|
4027
|
+
DELETE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/delete/${recordId}`,
|
|
4028
|
+
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/delete-batch`,
|
|
4029
|
+
UPSERT: `${DATAFABRIC_BASE}/api/v3/entities`,
|
|
4030
|
+
DELETE: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityId}`,
|
|
4031
|
+
UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityId}/metadata`,
|
|
4032
|
+
QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${entityId}/query`,
|
|
4033
|
+
QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/query`,
|
|
4034
|
+
BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
|
|
4035
|
+
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4036
|
+
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4037
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4038
|
+
GET_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/metadata`,
|
|
4039
|
+
GET_ENTITY_RECORDS_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/read`,
|
|
4040
|
+
GET_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/read/${recordId}`,
|
|
4041
|
+
INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/insert`,
|
|
4042
|
+
BATCH_INSERT_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/insert-batch`,
|
|
4043
|
+
UPDATE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/update/${recordId}`,
|
|
4044
|
+
UPDATE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/update-batch`,
|
|
4045
|
+
DELETE_RECORD_BY_NAME: (entityName, recordId) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/delete/${recordId}`,
|
|
4046
|
+
DELETE_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/delete-batch`,
|
|
4047
|
+
BULK_UPLOAD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/bulk-upload`,
|
|
4048
|
+
UPSERT_RECORD_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/v3/entities/${entityName}/upsert`,
|
|
4049
|
+
ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
|
|
4050
|
+
},
|
|
4051
|
+
CHOICESETS: {
|
|
4052
|
+
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
4053
|
+
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/v3/entities/entity/${choiceSetId}/query_expansion`,
|
|
4054
|
+
CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
4055
|
+
UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/v3/entities/${choiceSetId}/metadata`,
|
|
4056
|
+
DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/v3/entities/${choiceSetId}`,
|
|
4057
|
+
INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
|
|
4058
|
+
UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
|
|
4059
|
+
DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`
|
|
4060
|
+
},
|
|
4061
|
+
ROLES: {
|
|
4062
|
+
GET_ALL: `${DATAFABRIC_BASE}/api/v2/Role`
|
|
4063
|
+
},
|
|
4064
|
+
DIRECTORY: {
|
|
4065
|
+
GET_ALL: `${DATAFABRIC_BASE}/api/Directory`,
|
|
4066
|
+
ASSIGN_ROLES: `${DATAFABRIC_BASE}/api/Directory/Role`,
|
|
4067
|
+
REVOKE_ROLES: `${DATAFABRIC_BASE}/api/Directory/RevokeRole`
|
|
4041
4068
|
}
|
|
4042
4069
|
};
|
|
4043
|
-
var ASSET_ENDPOINTS = {
|
|
4044
|
-
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetFiltered`,
|
|
4045
|
-
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetAssetsAcrossFolders`,
|
|
4046
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Assets(${id})`
|
|
4047
|
-
};
|
|
4048
|
-
var ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
|
|
4049
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
|
|
4050
|
-
CREATE: `${ORCHESTRATOR_BASE}/odata/Attachments`
|
|
4051
|
-
};
|
|
4052
4070
|
var MAESTRO_ENDPOINTS = {
|
|
4053
4071
|
PROCESSES: {
|
|
4054
4072
|
GET_ALL: `${PIMS_BASE}/api/v1/processes/summary`,
|
|
@@ -4096,60 +4114,50 @@ var MAESTRO_ENDPOINTS = {
|
|
|
4096
4114
|
INCIDENTS_BY_TIME_WINDOW: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/IncidentsByTimeWindow`
|
|
4097
4115
|
}
|
|
4098
4116
|
};
|
|
4099
|
-
var
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
ATTACHMENT_BY_NAME: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`
|
|
4133
|
-
},
|
|
4134
|
-
CHOICESETS: {
|
|
4135
|
-
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
4136
|
-
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
4137
|
-
CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
4138
|
-
UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
|
|
4139
|
-
DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
|
|
4140
|
-
INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
|
|
4141
|
-
UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
|
|
4142
|
-
DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`
|
|
4143
|
-
},
|
|
4144
|
-
ROLES: {
|
|
4145
|
-
GET_ALL: `${DATAFABRIC_BASE}/api/v2/Role`
|
|
4146
|
-
},
|
|
4147
|
-
DIRECTORY: {
|
|
4148
|
-
GET_ALL: `${DATAFABRIC_BASE}/api/Directory`,
|
|
4149
|
-
ASSIGN_ROLES: `${DATAFABRIC_BASE}/api/Directory/Role`,
|
|
4150
|
-
REVOKE_ROLES: `${DATAFABRIC_BASE}/api/Directory/RevokeRole`
|
|
4117
|
+
var BUCKET_ENDPOINTS = {
|
|
4118
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Buckets`,
|
|
4119
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Buckets/UiPath.Server.Configuration.OData.GetBucketsAcrossFolders`,
|
|
4120
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
|
|
4121
|
+
GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
|
|
4122
|
+
GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
|
|
4123
|
+
GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
|
|
4124
|
+
DELETE_FILE: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.DeleteFile`,
|
|
4125
|
+
GET_FILES: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetFiles`
|
|
4126
|
+
};
|
|
4127
|
+
var PROCESS_ENDPOINTS = {
|
|
4128
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Releases`,
|
|
4129
|
+
START_PROCESS: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs`,
|
|
4130
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Releases(${id})`
|
|
4131
|
+
};
|
|
4132
|
+
var QUEUE_ENDPOINTS = {
|
|
4133
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
4134
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
4135
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
4136
|
+
GET_ITEMS: `${ORCHESTRATOR_BASE}/odata/QueueItems`,
|
|
4137
|
+
ADD_ITEM: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.AddQueueItem`,
|
|
4138
|
+
START_TRANSACTION: `${ORCHESTRATOR_BASE}/odata/Queues/UiPathODataSvc.StartTransaction`,
|
|
4139
|
+
SET_TRANSACTION_RESULT: (itemId) => `${ORCHESTRATOR_BASE}/odata/Queues(${itemId})/UiPathODataSvc.SetTransactionResult`
|
|
4140
|
+
};
|
|
4141
|
+
var JOB_ENDPOINTS = {
|
|
4142
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
4143
|
+
GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
|
|
4144
|
+
STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
|
|
4145
|
+
RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
|
|
4146
|
+
RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
|
|
4147
|
+
ATTACHMENTS: {
|
|
4148
|
+
GET_BY_JOB_KEY: `${ORCHESTRATOR_BASE}/api/JobAttachments/GetByJobKey`,
|
|
4149
|
+
LINK: `${ORCHESTRATOR_BASE}/api/JobAttachments/Post`
|
|
4151
4150
|
}
|
|
4152
4151
|
};
|
|
4152
|
+
var ASSET_ENDPOINTS = {
|
|
4153
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetFiltered`,
|
|
4154
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetAssetsAcrossFolders`,
|
|
4155
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Assets(${id})`
|
|
4156
|
+
};
|
|
4157
|
+
var ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
|
|
4158
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
|
|
4159
|
+
CREATE: `${ORCHESTRATOR_BASE}/odata/Attachments`
|
|
4160
|
+
};
|
|
4153
4161
|
var IDENTITY_ENDPOINTS = {
|
|
4154
4162
|
TOKEN: `${IDENTITY_BASE}/connect/token`,
|
|
4155
4163
|
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
|
|
@@ -4347,7 +4355,7 @@ class EmbeddedTokenManager {
|
|
|
4347
4355
|
this.cancelRefresh?.();
|
|
4348
4356
|
}
|
|
4349
4357
|
}
|
|
4350
|
-
var SDK_VERSION = "1.
|
|
4358
|
+
var SDK_VERSION = "1.8.0";
|
|
4351
4359
|
var CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
4352
4360
|
var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
4353
4361
|
var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
@@ -4445,11 +4453,11 @@ class TokenManager {
|
|
|
4445
4453
|
this.isOAuth = false;
|
|
4446
4454
|
}
|
|
4447
4455
|
}
|
|
4448
|
-
isTokenExpired(tokenInfo) {
|
|
4456
|
+
isTokenExpired(tokenInfo, bufferMs = 0) {
|
|
4449
4457
|
if (!tokenInfo?.expiresAt) {
|
|
4450
4458
|
return false;
|
|
4451
4459
|
}
|
|
4452
|
-
return
|
|
4460
|
+
return Date.now() >= getExpiryMs(tokenInfo.expiresAt) - bufferMs;
|
|
4453
4461
|
}
|
|
4454
4462
|
async getValidToken() {
|
|
4455
4463
|
const tokenInfo = this.executionContext.get("tokenInfo");
|
|
@@ -4467,7 +4475,8 @@ class TokenManager {
|
|
|
4467
4475
|
if (tokenInfo.type === "secret") {
|
|
4468
4476
|
return tokenInfo.token;
|
|
4469
4477
|
}
|
|
4470
|
-
|
|
4478
|
+
const expiryBuffer = hasOAuthConfig(this.config) && tokenInfo.refreshToken ? TOKEN_EXPIRY_BUFFER_MS : 0;
|
|
4479
|
+
if (!this.isTokenExpired(tokenInfo, expiryBuffer)) {
|
|
4471
4480
|
return tokenInfo.token;
|
|
4472
4481
|
}
|
|
4473
4482
|
try {
|
|
@@ -4632,7 +4641,7 @@ class TokenManager {
|
|
|
4632
4641
|
return token;
|
|
4633
4642
|
}
|
|
4634
4643
|
}
|
|
4635
|
-
var GUID_REGEX$
|
|
4644
|
+
var GUID_REGEX$2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4636
4645
|
|
|
4637
4646
|
class AuthService {
|
|
4638
4647
|
constructor(config2, executionContext) {
|
|
@@ -4837,7 +4846,7 @@ class AuthService {
|
|
|
4837
4846
|
return authorizeUrl;
|
|
4838
4847
|
}
|
|
4839
4848
|
const orgName = this.config.orgName;
|
|
4840
|
-
if (!GUID_REGEX$
|
|
4849
|
+
if (!GUID_REGEX$2.test(orgName)) {
|
|
4841
4850
|
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
4851
|
return authorizeUrl;
|
|
4843
4852
|
}
|
|
@@ -4926,6 +4935,58 @@ class AuthService {
|
|
|
4926
4935
|
window.history.replaceState({}, "", url.toString());
|
|
4927
4936
|
}
|
|
4928
4937
|
}
|
|
4938
|
+
var UiPathMetaTags;
|
|
4939
|
+
(function(UiPathMetaTags2) {
|
|
4940
|
+
UiPathMetaTags2["CLIENT_ID"] = "uipath:client-id";
|
|
4941
|
+
UiPathMetaTags2["SCOPE"] = "uipath:scope";
|
|
4942
|
+
UiPathMetaTags2["ORG_NAME"] = "uipath:org-name";
|
|
4943
|
+
UiPathMetaTags2["ORG_ID"] = "uipath:org-id";
|
|
4944
|
+
UiPathMetaTags2["TENANT_NAME"] = "uipath:tenant-name";
|
|
4945
|
+
UiPathMetaTags2["BASE_URL"] = "uipath:base-url";
|
|
4946
|
+
UiPathMetaTags2["REDIRECT_URI"] = "uipath:redirect-uri";
|
|
4947
|
+
UiPathMetaTags2["CDN_BASE"] = "uipath:cdn-base";
|
|
4948
|
+
UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
|
|
4949
|
+
UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
|
|
4950
|
+
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
4951
|
+
var UiPathElementIds;
|
|
4952
|
+
(function(UiPathElementIds2) {
|
|
4953
|
+
UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
4954
|
+
})(UiPathElementIds || (UiPathElementIds = {}));
|
|
4955
|
+
function readEnv(name) {
|
|
4956
|
+
const globals = globalThis;
|
|
4957
|
+
try {
|
|
4958
|
+
const fromNode = globals.process?.env?.[name];
|
|
4959
|
+
if (fromNode)
|
|
4960
|
+
return fromNode;
|
|
4961
|
+
} catch {}
|
|
4962
|
+
try {
|
|
4963
|
+
const fromDeno = globals.Deno?.env?.get?.(name);
|
|
4964
|
+
if (fromDeno)
|
|
4965
|
+
return fromDeno;
|
|
4966
|
+
} catch {}
|
|
4967
|
+
return;
|
|
4968
|
+
}
|
|
4969
|
+
var UiPathEnvVars = {
|
|
4970
|
+
BASE_URL: "UIPATH_BASE_URL",
|
|
4971
|
+
ORG_NAME: "UIPATH_ORG_NAME",
|
|
4972
|
+
TENANT_NAME: "UIPATH_TENANT_NAME",
|
|
4973
|
+
ACCESS_TOKEN: "UIPATH_ACCESS_TOKEN"
|
|
4974
|
+
};
|
|
4975
|
+
function loadFromEnvironment() {
|
|
4976
|
+
if (isBrowser)
|
|
4977
|
+
return null;
|
|
4978
|
+
const config2 = {
|
|
4979
|
+
baseUrl: readEnv(UiPathEnvVars.BASE_URL),
|
|
4980
|
+
orgName: readEnv(UiPathEnvVars.ORG_NAME),
|
|
4981
|
+
tenantName: readEnv(UiPathEnvVars.TENANT_NAME),
|
|
4982
|
+
secret: readEnv(UiPathEnvVars.ACCESS_TOKEN)
|
|
4983
|
+
};
|
|
4984
|
+
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
4985
|
+
}
|
|
4986
|
+
var BASE_FIELDS = ["baseUrl", "orgName", "tenantName"];
|
|
4987
|
+
var OAUTH_FIELDS = ["clientId", "redirectUri", "scope"];
|
|
4988
|
+
var AUTH_FIELDS = ["secret", ...OAUTH_FIELDS];
|
|
4989
|
+
var HTTP_PROTOCOLS = new Set(["http:", "https:"]);
|
|
4929
4990
|
function hasRequiredBaseFields(config2) {
|
|
4930
4991
|
return Boolean(config2.baseUrl && config2.orgName && config2.tenantName);
|
|
4931
4992
|
}
|
|
@@ -4934,18 +4995,28 @@ function hasValidAuthConfig(config2) {
|
|
|
4934
4995
|
const hasOAuth = hasOAuthConfig(config2);
|
|
4935
4996
|
return hasSecret !== hasOAuth;
|
|
4936
4997
|
}
|
|
4937
|
-
function
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4998
|
+
function nonBlank(value) {
|
|
4999
|
+
const trimmed = value?.trim();
|
|
5000
|
+
return trimmed ? trimmed : undefined;
|
|
5001
|
+
}
|
|
5002
|
+
function toHttpOrigin(value) {
|
|
5003
|
+
let url;
|
|
5004
|
+
try {
|
|
5005
|
+
url = new URL(value);
|
|
5006
|
+
} catch (error) {
|
|
5007
|
+
console.warn(`[UiPath SDK] baseUrl "${value}" is not a URL:`, error);
|
|
5008
|
+
return null;
|
|
4945
5009
|
}
|
|
4946
|
-
if (!
|
|
4947
|
-
|
|
5010
|
+
if (!HTTP_PROTOCOLS.has(url.protocol)) {
|
|
5011
|
+
console.warn(`[UiPath SDK] baseUrl "${value}" is not an http(s) URL; ignored.`);
|
|
5012
|
+
return null;
|
|
4948
5013
|
}
|
|
5014
|
+
return url.origin;
|
|
5015
|
+
}
|
|
5016
|
+
function joinNames(names) {
|
|
5017
|
+
if (names.length <= 1)
|
|
5018
|
+
return names.join("");
|
|
5019
|
+
return `${names.slice(0, -1).join(", ")} and ${names.slice(-1).join("")}`;
|
|
4949
5020
|
}
|
|
4950
5021
|
function isCompleteConfig(config2) {
|
|
4951
5022
|
return hasRequiredBaseFields(config2) && hasValidAuthConfig(config2);
|
|
@@ -4956,56 +5027,449 @@ function compactConfig(config2) {
|
|
|
4956
5027
|
function normalizeBaseUrl(url) {
|
|
4957
5028
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
4958
5029
|
}
|
|
4959
|
-
function
|
|
5030
|
+
function describeGaps(found) {
|
|
5031
|
+
const gaps = [];
|
|
5032
|
+
const missingBase = BASE_FIELDS.filter((field) => !found[field]);
|
|
5033
|
+
if (missingBase.length > 0)
|
|
5034
|
+
gaps.push(`missing ${missingBase.join(", ")}`);
|
|
5035
|
+
const foundSecret = hasSecretConfig(found);
|
|
5036
|
+
const foundOAuth = hasOAuthConfig(found);
|
|
5037
|
+
if (!foundSecret && !foundOAuth) {
|
|
5038
|
+
const named = OAUTH_FIELDS.filter((field) => found[field]);
|
|
5039
|
+
gaps.push(named.length > 0 ? `the OAuth configuration is incomplete — ${named.join(", ")} set, ` + `${OAUTH_FIELDS.filter((field) => !found[field]).join(", ")} missing` : "no authentication method set (needs `secret`, or clientId, redirectUri and scope)");
|
|
5040
|
+
}
|
|
5041
|
+
return gaps.join("; ");
|
|
5042
|
+
}
|
|
5043
|
+
function missingConfigMessage(found, context) {
|
|
5044
|
+
if (context) {
|
|
5045
|
+
return missingContextMessage(found ?? {}, context);
|
|
5046
|
+
}
|
|
4960
5047
|
if (isBrowser) {
|
|
5048
|
+
if (found && hasRequiredBaseFields(found) && !hasSecretConfig(found)) {
|
|
5049
|
+
const missing = [];
|
|
5050
|
+
if (!found.clientId)
|
|
5051
|
+
missing.push("clientId");
|
|
5052
|
+
if (!found.redirectUri)
|
|
5053
|
+
missing.push("redirectUri");
|
|
5054
|
+
if (missing.length > 0 && (found.clientId || found.redirectUri || found.scope)) {
|
|
5055
|
+
const fields = missing.join(" and ");
|
|
5056
|
+
const verb = missing.length > 1 ? "are" : "is";
|
|
5057
|
+
const clientHint = missing.includes("clientId") ? " clientId must be a non-confidential OAuth client, or pass one with --client-id at deploy." : "";
|
|
5058
|
+
return `UiPath SDK configuration is incomplete: ${fields} ${verb} empty. Set ${missing.length > 1 ? "them" : "it"} in uipath.json and redeploy.${clientHint}`;
|
|
5059
|
+
}
|
|
5060
|
+
}
|
|
4961
5061
|
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
5062
|
}
|
|
4963
|
-
|
|
5063
|
+
const guidance = "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.";
|
|
5064
|
+
if (!found)
|
|
5065
|
+
return `UiPath SDK configuration not found. ${guidance}`;
|
|
5066
|
+
return `UiPath SDK configuration is incomplete: ${describeGaps(found)}. ${guidance}`;
|
|
4964
5067
|
}
|
|
5068
|
+
function missingContextMessage(config2, context) {
|
|
5069
|
+
const missing = [];
|
|
5070
|
+
if (!hasRequiredBaseFields(config2)) {
|
|
5071
|
+
if (!context.platform) {
|
|
5072
|
+
const variables = [];
|
|
5073
|
+
if (!config2.baseUrl)
|
|
5074
|
+
variables.push(UiPathEnvVars.BASE_URL);
|
|
5075
|
+
if (!config2.orgName)
|
|
5076
|
+
variables.push(UiPathEnvVars.ORG_NAME);
|
|
5077
|
+
if (!config2.tenantName)
|
|
5078
|
+
variables.push(UiPathEnvVars.TENANT_NAME);
|
|
5079
|
+
missing.push(`ctx.platform is null (or set ${joinNames(variables)})`);
|
|
5080
|
+
} else {
|
|
5081
|
+
if (!config2.baseUrl) {
|
|
5082
|
+
const baseUrl = nonBlank(context.platform.baseUrl);
|
|
5083
|
+
const problem = baseUrl === undefined ? "is empty" : `"${baseUrl}" is not an http(s) URL`;
|
|
5084
|
+
missing.push(`ctx.platform.baseUrl ${problem} (or set ${UiPathEnvVars.BASE_URL})`);
|
|
5085
|
+
}
|
|
5086
|
+
if (!config2.orgName)
|
|
5087
|
+
missing.push(`ctx.platform.orgId is empty (or set ${UiPathEnvVars.ORG_NAME})`);
|
|
5088
|
+
if (!config2.tenantName)
|
|
5089
|
+
missing.push(`ctx.platform.tenantId is empty (or set ${UiPathEnvVars.TENANT_NAME})`);
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
if (!hasSecretConfig(config2) && !hasOAuthConfig(config2)) {
|
|
5093
|
+
missing.push(`ctx.robot.accessToken is null (or set ${UiPathEnvVars.ACCESS_TOKEN})`);
|
|
5094
|
+
}
|
|
5095
|
+
if (missing.length === 0) {
|
|
5096
|
+
return "UiPath SDK configuration is incomplete: " + "the handler context passed to new UiPath(ctx) does not form a complete configuration.";
|
|
5097
|
+
}
|
|
5098
|
+
return `UiPath SDK configuration is incomplete: ${missing.join("; ")}. ` + "A deployed Function receives these coordinates on the handler context; a local run sets the variables named.";
|
|
5099
|
+
}
|
|
5100
|
+
var AUTH_FIELD_SOURCES = {
|
|
5101
|
+
secret: { envVar: UiPathEnvVars.ACCESS_TOKEN },
|
|
5102
|
+
clientId: { metaTag: UiPathMetaTags.CLIENT_ID },
|
|
5103
|
+
redirectUri: { metaTag: UiPathMetaTags.REDIRECT_URI },
|
|
5104
|
+
scope: { metaTag: UiPathMetaTags.SCOPE }
|
|
5105
|
+
};
|
|
5106
|
+
function sourceOf(field, sources) {
|
|
5107
|
+
if (sources.config?.[field])
|
|
5108
|
+
return "the constructor argument";
|
|
5109
|
+
const { metaTag, envVar } = AUTH_FIELD_SOURCES[field];
|
|
5110
|
+
if (metaTag && sources.metaConfig?.[field])
|
|
5111
|
+
return `<meta name="${metaTag}">`;
|
|
5112
|
+
if (envVar && sources.environment?.[field])
|
|
5113
|
+
return `the ${envVar} environment variable`;
|
|
5114
|
+
return;
|
|
5115
|
+
}
|
|
5116
|
+
function conflictingAuthMessage(sources) {
|
|
5117
|
+
const inventory = AUTH_FIELDS.map((field) => ({ field, source: sourceOf(field, sources) })).filter((entry) => Boolean(entry.source)).map(({ field, source }) => ` ${field}: ${source}`).join(`
|
|
5118
|
+
`);
|
|
5119
|
+
const namedOAuth = AUTH_FIELDS.filter((field) => field !== "secret" && Boolean(sources.config?.[field]));
|
|
5120
|
+
const remedy = namedOAuth.length > 0 ? `Remove ${namedOAuth.join(", ")} from the constructor argument to authenticate with secret, ` + "or remove secret to authenticate with OAuth." : "Pass exactly one authentication method.";
|
|
5121
|
+
return "Invalid UiPath SDK configuration: it carries both authentication methods. " + `The SDK authenticates with secret, or with OAuth (clientId, redirectUri and scope), never both.
|
|
5122
|
+
` + `${inventory}
|
|
5123
|
+
` + "Every field the constructor argument leaves unset is inherited from the meta tags and the " + "environment, so naming one field of each method ends up carrying both. " + remedy;
|
|
5124
|
+
}
|
|
5125
|
+
var FOLDER_KEY = "X-UIPATH-FolderKey";
|
|
5126
|
+
var FOLDER_PATH_ENCODED = "X-UIPATH-FolderPath-Encoded";
|
|
5127
|
+
var FOLDER_ID = "X-UIPATH-OrganizationUnitId";
|
|
5128
|
+
var TRACEPARENT = "traceparent";
|
|
5129
|
+
var UIPATH_TRACEPARENT_ID = "x-uipath-traceparent-id";
|
|
5130
|
+
var CONTENT_TYPES = {
|
|
5131
|
+
JSON: "application/json",
|
|
5132
|
+
XML: "application/xml",
|
|
5133
|
+
OCTET_STREAM: "application/octet-stream"
|
|
5134
|
+
};
|
|
5135
|
+
var RESPONSE_TYPES = {
|
|
5136
|
+
JSON: "json",
|
|
5137
|
+
TEXT: "text",
|
|
5138
|
+
BLOB: "blob",
|
|
5139
|
+
ARRAYBUFFER: "arraybuffer",
|
|
5140
|
+
STREAM: "stream"
|
|
5141
|
+
};
|
|
5142
|
+
var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
|
|
5143
|
+
var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
|
|
5144
|
+
var DEFAULT_RETRY_OPTIONS = {
|
|
5145
|
+
maxRetries: 2,
|
|
5146
|
+
initialDelayMs: 500,
|
|
5147
|
+
backoffStrategy: "exponential",
|
|
5148
|
+
backoffFactor: 2,
|
|
5149
|
+
backoffMaxDelayMs: 30000,
|
|
5150
|
+
retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
|
|
5151
|
+
retryMethods: DEFAULT_RETRY_METHODS,
|
|
5152
|
+
retryNetworkErrors: true,
|
|
5153
|
+
respectRetryAfter: true,
|
|
5154
|
+
maxRetryAfterMs: Infinity
|
|
5155
|
+
};
|
|
5156
|
+
var DEFAULT_API_CLIENT_RETRY = {
|
|
5157
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
5158
|
+
maxRetries: 0
|
|
5159
|
+
};
|
|
5160
|
+
function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
|
|
5161
|
+
if (!settings)
|
|
5162
|
+
return defaults;
|
|
5163
|
+
const { retryDelay, useExponentialBackoff, ...live } = settings;
|
|
5164
|
+
const resolved = { ...defaults };
|
|
5165
|
+
for (const [key, value] of Object.entries(live)) {
|
|
5166
|
+
if (value !== undefined) {
|
|
5167
|
+
resolved[key] = value;
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
if (retryDelay !== undefined && live.initialDelayMs === undefined) {
|
|
5171
|
+
resolved.initialDelayMs = retryDelay;
|
|
5172
|
+
}
|
|
5173
|
+
if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
|
|
5174
|
+
resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
|
|
5175
|
+
}
|
|
5176
|
+
return resolved;
|
|
5177
|
+
}
|
|
5178
|
+
function computeBackoffDelay(attempt, settings) {
|
|
5179
|
+
const base = Math.max(0, settings.initialDelayMs);
|
|
5180
|
+
let delay;
|
|
5181
|
+
switch (settings.backoffStrategy) {
|
|
5182
|
+
case "constant":
|
|
5183
|
+
delay = base;
|
|
5184
|
+
break;
|
|
5185
|
+
case "linear":
|
|
5186
|
+
delay = base * (attempt + 1);
|
|
5187
|
+
break;
|
|
5188
|
+
default:
|
|
5189
|
+
delay = base * Math.pow(settings.backoffFactor, attempt);
|
|
5190
|
+
}
|
|
5191
|
+
return Math.min(delay, settings.backoffMaxDelayMs);
|
|
5192
|
+
}
|
|
5193
|
+
function parseRetryAfter(value, now = Date.now()) {
|
|
5194
|
+
const trimmed = value?.trim();
|
|
5195
|
+
if (!trimmed)
|
|
5196
|
+
return;
|
|
5197
|
+
const seconds = Number(trimmed);
|
|
5198
|
+
if (Number.isFinite(seconds))
|
|
5199
|
+
return Math.max(0, seconds * 1000);
|
|
5200
|
+
const date2 = Date.parse(trimmed);
|
|
5201
|
+
if (Number.isNaN(date2))
|
|
5202
|
+
return;
|
|
5203
|
+
return Math.max(0, date2 - now);
|
|
5204
|
+
}
|
|
5205
|
+
function wait(durationMs) {
|
|
5206
|
+
return new Promise((resolve) => setTimeout(resolve, Math.max(0, durationMs)));
|
|
5207
|
+
}
|
|
5208
|
+
var RETRY_AFTER = "retry-after";
|
|
5209
|
+
function createAttemptSignal(timeoutMs, external) {
|
|
5210
|
+
if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
|
|
5211
|
+
return { signal: external, dispose: () => {} };
|
|
5212
|
+
const controller = new AbortController;
|
|
5213
|
+
const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
5214
|
+
const onExternalAbort = () => controller.abort(external?.reason);
|
|
5215
|
+
if (external) {
|
|
5216
|
+
if (external.aborted) {
|
|
5217
|
+
controller.abort(external.reason);
|
|
5218
|
+
} else {
|
|
5219
|
+
external.addEventListener("abort", onExternalAbort);
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
return {
|
|
5223
|
+
signal: controller.signal,
|
|
5224
|
+
dispose: () => {
|
|
5225
|
+
clearTimeout(timer);
|
|
5226
|
+
external?.removeEventListener("abort", onExternalAbort);
|
|
5227
|
+
}
|
|
5228
|
+
};
|
|
5229
|
+
}
|
|
5230
|
+
function delayBeforeRetry(durationMs, signal) {
|
|
5231
|
+
if (!signal)
|
|
5232
|
+
return wait(durationMs);
|
|
5233
|
+
if (signal.aborted)
|
|
5234
|
+
return Promise.reject(signal.reason);
|
|
5235
|
+
return new Promise((resolve, reject) => {
|
|
5236
|
+
const onAbort = () => {
|
|
5237
|
+
clearTimeout(timer);
|
|
5238
|
+
reject(signal.reason);
|
|
5239
|
+
};
|
|
5240
|
+
const timer = setTimeout(() => {
|
|
5241
|
+
signal.removeEventListener("abort", onAbort);
|
|
5242
|
+
resolve();
|
|
5243
|
+
}, Math.max(0, durationMs));
|
|
5244
|
+
signal.addEventListener("abort", onAbort);
|
|
5245
|
+
});
|
|
5246
|
+
}
|
|
5247
|
+
async function fetchWithRetry(url, init, options) {
|
|
5248
|
+
const settings = options.retry;
|
|
5249
|
+
const method = (init.method ?? "GET").toUpperCase();
|
|
5250
|
+
const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
|
|
5251
|
+
let attempt = 0;
|
|
5252
|
+
for (;; ) {
|
|
5253
|
+
const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
|
|
5254
|
+
let response;
|
|
5255
|
+
let failure;
|
|
5256
|
+
try {
|
|
5257
|
+
response = await fetch(url, { ...init, signal });
|
|
5258
|
+
} catch (error) {
|
|
5259
|
+
failure = error;
|
|
5260
|
+
} finally {
|
|
5261
|
+
dispose();
|
|
5262
|
+
}
|
|
5263
|
+
if (options.signal?.aborted && failure !== undefined)
|
|
5264
|
+
throw failure;
|
|
5265
|
+
if (response && !settings.retryableStatusCodes.includes(response.status))
|
|
5266
|
+
return response;
|
|
5267
|
+
if (failure !== undefined && !settings.retryNetworkErrors)
|
|
5268
|
+
throw failure;
|
|
5269
|
+
if (attempt >= retriesAllowed) {
|
|
5270
|
+
if (response)
|
|
5271
|
+
return response;
|
|
5272
|
+
throw failure;
|
|
5273
|
+
}
|
|
5274
|
+
const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
|
|
5275
|
+
const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
|
|
5276
|
+
response?.body?.cancel().catch((error) => {
|
|
5277
|
+
console.warn("[UiPath SDK] Could not release a discarded response body:", error);
|
|
5278
|
+
});
|
|
5279
|
+
await delayBeforeRetry(delay, options.signal);
|
|
5280
|
+
attempt++;
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
var _OrganizationIdResolver_instances;
|
|
5284
|
+
var _OrganizationIdResolver_organizationId;
|
|
5285
|
+
var _OrganizationIdResolver_resolve;
|
|
5286
|
+
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;
|
|
5287
|
+
var DASH_REGEX = /-/g;
|
|
5288
|
+
var UNDERSCORE_REGEX = /_/g;
|
|
5289
|
+
var WHITESPACE_REGEX = /\s+/g;
|
|
5290
|
+
var ORGANIZATION_LOOKUP_CLIENT_ID = "1119a927-10ab-4543-bd1a-ad6bfbbc27f4";
|
|
5291
|
+
var ORGANIZATION_LOOKUP_REDIRECT_PATH = "portal_/api/tokenFactory/callback";
|
|
5292
|
+
var UNREGISTERED_ORGANIZATION_PATH = "/portal_/unregistered";
|
|
5293
|
+
var TENANT_ACR_PREFIX = "tenant:";
|
|
5294
|
+
var MAX_REDIRECT_HOPS = 3;
|
|
5295
|
+
var IDENTITY_ERROR_ID_PARAM = "errorId";
|
|
5296
|
+
var IDENTITY_ERROR_CODE_PARAM = "errorCode";
|
|
5297
|
+
var BODY_SNIPPET_LENGTH = 160;
|
|
5298
|
+
var CONFIG_HINT = "Set `organizationId` in the SDK configuration.";
|
|
5299
|
+
function isAuthorizeRequest(url) {
|
|
5300
|
+
return url.pathname.endsWith(`/${IDENTITY_ENDPOINTS.AUTHORIZE}`);
|
|
5301
|
+
}
|
|
5302
|
+
function withoutQuery(url) {
|
|
5303
|
+
const parsed = new URL(url);
|
|
5304
|
+
return `${parsed.origin}${parsed.pathname}`;
|
|
5305
|
+
}
|
|
5306
|
+
function readIdentityError(url) {
|
|
5307
|
+
const errorId = url.searchParams.get(IDENTITY_ERROR_ID_PARAM);
|
|
5308
|
+
if (errorId) {
|
|
5309
|
+
try {
|
|
5310
|
+
const base642 = errorId.replace(DASH_REGEX, "+").replace(UNDERSCORE_REGEX, "/");
|
|
5311
|
+
const json = decodeBase64(base642.padEnd(base642.length + (4 - base642.length % 4) % 4, "="));
|
|
5312
|
+
const data = JSON.parse(json).Data;
|
|
5313
|
+
const error = typeof data?.Error === "string" ? data.Error : undefined;
|
|
5314
|
+
const description = typeof data?.ErrorDescription === "string" ? data.ErrorDescription : undefined;
|
|
5315
|
+
if (error) {
|
|
5316
|
+
return description ? `${error} (${description})` : error;
|
|
5317
|
+
}
|
|
5318
|
+
} catch {
|
|
5319
|
+
return url.searchParams.get(IDENTITY_ERROR_CODE_PARAM) ?? undefined;
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
return url.searchParams.get(IDENTITY_ERROR_CODE_PARAM) ?? undefined;
|
|
5323
|
+
}
|
|
5324
|
+
async function describeResponse(response) {
|
|
5325
|
+
const body = (await response.text().catch(() => "")).replace(WHITESPACE_REGEX, " ").trim();
|
|
5326
|
+
return body ? `HTTP ${response.status}: ${body.slice(0, BODY_SNIPPET_LENGTH)}` : `HTTP ${response.status}`;
|
|
5327
|
+
}
|
|
5328
|
+
function randomUrlSafeToken() {
|
|
5329
|
+
return `${crypto.randomUUID()}${crypto.randomUUID()}`.replace(DASH_REGEX, "");
|
|
5330
|
+
}
|
|
5331
|
+
function tracingHeaders() {
|
|
5332
|
+
const traceId = crypto.randomUUID().replace(DASH_REGEX, "");
|
|
5333
|
+
const spanId = crypto.randomUUID().replace(DASH_REGEX, "").slice(0, 16);
|
|
5334
|
+
const traceparent = `00-${traceId}-${spanId}-01`;
|
|
5335
|
+
return { [TRACEPARENT]: traceparent, [UIPATH_TRACEPARENT_ID]: traceparent };
|
|
5336
|
+
}
|
|
5337
|
+
function buildAuthorizeUrl(baseUrl, orgName) {
|
|
5338
|
+
const params = new URLSearchParams({
|
|
5339
|
+
response_type: "code",
|
|
5340
|
+
client_id: ORGANIZATION_LOOKUP_CLIENT_ID,
|
|
5341
|
+
redirect_uri: `${baseUrl}/${ORGANIZATION_LOOKUP_REDIRECT_PATH}`,
|
|
5342
|
+
scope: "openid",
|
|
5343
|
+
code_challenge: randomUrlSafeToken(),
|
|
5344
|
+
code_challenge_method: "S256",
|
|
5345
|
+
state: randomUrlSafeToken(),
|
|
5346
|
+
acr_values: `tenantName:${orgName}`
|
|
5347
|
+
});
|
|
5348
|
+
return `${baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${params.toString()}`;
|
|
5349
|
+
}
|
|
5350
|
+
function extractOrganizationId(location) {
|
|
5351
|
+
const acrValues = [location.searchParams.get("acr_values")];
|
|
5352
|
+
const returnUrl = location.searchParams.get("returnUrl");
|
|
5353
|
+
if (returnUrl) {
|
|
5354
|
+
acrValues.push(new URL(returnUrl, location.origin).searchParams.get("acr_values"));
|
|
5355
|
+
}
|
|
5356
|
+
for (const acr of acrValues) {
|
|
5357
|
+
for (const token of acr?.split(" ") ?? []) {
|
|
5358
|
+
if (token.startsWith(TENANT_ACR_PREFIX)) {
|
|
5359
|
+
const candidate = token.slice(TENANT_ACR_PREFIX.length);
|
|
5360
|
+
if (GUID_REGEX$1.test(candidate)) {
|
|
5361
|
+
return candidate;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5365
|
+
}
|
|
5366
|
+
return;
|
|
5367
|
+
}
|
|
5368
|
+
async function lookupOrganizationIdForPat(baseUrl, orgName) {
|
|
5369
|
+
let url = buildAuthorizeUrl(baseUrl, orgName);
|
|
5370
|
+
for (let hop = 0;hop < MAX_REDIRECT_HOPS; hop++) {
|
|
5371
|
+
const response = await fetchWithRetry(url, { redirect: "manual", headers: tracingHeaders() }, { retry: DEFAULT_RETRY_OPTIONS });
|
|
5372
|
+
const location = response.headers.get("location");
|
|
5373
|
+
if (!location) {
|
|
5374
|
+
throw new ValidationError({
|
|
5375
|
+
message: `Could not resolve the organization id for '${orgName}': Identity answered ` + `${await describeResponse(response)} instead of redirecting. ${CONFIG_HINT}`
|
|
5376
|
+
});
|
|
5377
|
+
}
|
|
5378
|
+
const target = new URL(location, url);
|
|
5379
|
+
const organizationId = extractOrganizationId(target);
|
|
5380
|
+
if (organizationId) {
|
|
5381
|
+
return organizationId;
|
|
5382
|
+
}
|
|
5383
|
+
if (target.pathname.startsWith(UNREGISTERED_ORGANIZATION_PATH)) {
|
|
5384
|
+
throw new ValidationError({ message: `Organization '${orgName}' was not found at ${baseUrl}.` });
|
|
5385
|
+
}
|
|
5386
|
+
const identityError = readIdentityError(target);
|
|
5387
|
+
if (identityError) {
|
|
5388
|
+
throw new ValidationError({
|
|
5389
|
+
message: `Could not resolve the organization id for '${orgName}': Identity rejected the lookup ` + `with ${identityError}. ${CONFIG_HINT}`
|
|
5390
|
+
});
|
|
5391
|
+
}
|
|
5392
|
+
url = isAuthorizeRequest(target) ? buildAuthorizeUrl(target.origin, orgName) : target.toString();
|
|
5393
|
+
}
|
|
5394
|
+
throw new ValidationError({
|
|
5395
|
+
message: `Could not resolve the organization id for '${orgName}': gave up after ${MAX_REDIRECT_HOPS} ` + `redirects (last: ${withoutQuery(url)}). ${CONFIG_HINT}`
|
|
5396
|
+
});
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
class OrganizationIdResolver {
|
|
5400
|
+
constructor(config2, tokenManager) {
|
|
5401
|
+
_OrganizationIdResolver_instances.add(this);
|
|
5402
|
+
this.config = config2;
|
|
5403
|
+
this.tokenManager = tokenManager;
|
|
5404
|
+
_OrganizationIdResolver_organizationId.set(this, undefined);
|
|
5405
|
+
}
|
|
5406
|
+
resolve() {
|
|
5407
|
+
if (!__classPrivateFieldGet(this, _OrganizationIdResolver_organizationId, "f")) {
|
|
5408
|
+
__classPrivateFieldSet(this, _OrganizationIdResolver_organizationId, __classPrivateFieldGet(this, _OrganizationIdResolver_instances, "m", _OrganizationIdResolver_resolve).call(this).catch((error) => {
|
|
5409
|
+
__classPrivateFieldSet(this, _OrganizationIdResolver_organizationId, undefined, "f");
|
|
5410
|
+
throw error;
|
|
5411
|
+
}), "f");
|
|
5412
|
+
}
|
|
5413
|
+
return __classPrivateFieldGet(this, _OrganizationIdResolver_organizationId, "f");
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5416
|
+
_OrganizationIdResolver_organizationId = new WeakMap, _OrganizationIdResolver_instances = new WeakSet, _OrganizationIdResolver_resolve = async function _OrganizationIdResolver_resolve2() {
|
|
5417
|
+
const { organizationId, orgName, baseUrl } = this.config;
|
|
5418
|
+
if (organizationId) {
|
|
5419
|
+
return organizationId;
|
|
5420
|
+
}
|
|
5421
|
+
if (GUID_REGEX$1.test(orgName)) {
|
|
5422
|
+
return orgName;
|
|
5423
|
+
}
|
|
5424
|
+
const claimed = decodeJwtClaims(this.tokenManager.getToken())?.prt_id;
|
|
5425
|
+
if (typeof claimed === "string" && GUID_REGEX$1.test(claimed)) {
|
|
5426
|
+
return claimed;
|
|
5427
|
+
}
|
|
5428
|
+
return lookupOrganizationIdForPat(baseUrl, orgName);
|
|
5429
|
+
};
|
|
4965
5430
|
var REGISTRY_KEY = Symbol.for("@uipath/sdk-internals-registry");
|
|
5431
|
+
var UNCONFIGURED_KEY = Symbol.for("@uipath/sdk-unconfigured-reason");
|
|
5432
|
+
var globalStores = () => globalThis;
|
|
4966
5433
|
var getGlobalStore = () => {
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
5434
|
+
var _a;
|
|
5435
|
+
return (_a = globalStores())[REGISTRY_KEY] ?? (_a[REGISTRY_KEY] = new WeakMap);
|
|
5436
|
+
};
|
|
5437
|
+
var getUnconfiguredStore = () => {
|
|
5438
|
+
var _a;
|
|
5439
|
+
return (_a = globalStores())[UNCONFIGURED_KEY] ?? (_a[UNCONFIGURED_KEY] = new WeakMap);
|
|
4972
5440
|
};
|
|
4973
5441
|
var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
|
|
4974
5442
|
|
|
4975
5443
|
class SDKInternalsRegistry {
|
|
4976
|
-
static get store() {
|
|
4977
|
-
return getGlobalStore();
|
|
4978
|
-
}
|
|
4979
5444
|
static set(instance, internals) {
|
|
4980
5445
|
this.store.set(instance, internals);
|
|
4981
5446
|
}
|
|
5447
|
+
static setUnconfigured(instance, reason) {
|
|
5448
|
+
this.unconfigured.set(instance, reason);
|
|
5449
|
+
}
|
|
4982
5450
|
static get(instance) {
|
|
4983
5451
|
const internals = this.store.get(instance);
|
|
4984
5452
|
if (!internals) {
|
|
4985
|
-
|
|
4986
|
-
|
|
5453
|
+
const reason = this.unconfigured.get(instance);
|
|
5454
|
+
if (reason !== undefined || looksLikeUiPath(instance)) {
|
|
5455
|
+
throw new Error("Cannot create a service: the UiPath instance was never configured. " + (reason ?? missingConfigMessage()));
|
|
4987
5456
|
}
|
|
4988
5457
|
throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
|
|
4989
5458
|
}
|
|
4990
5459
|
return internals;
|
|
4991
5460
|
}
|
|
5461
|
+
static getOrganizationIdResolver(instance) {
|
|
5462
|
+
const internals = this.get(instance);
|
|
5463
|
+
internals.organizationIdResolver ?? (internals.organizationIdResolver = new OrganizationIdResolver(internals.config, internals.tokenManager));
|
|
5464
|
+
return internals.organizationIdResolver;
|
|
5465
|
+
}
|
|
5466
|
+
static get store() {
|
|
5467
|
+
return getGlobalStore();
|
|
5468
|
+
}
|
|
5469
|
+
static get unconfigured() {
|
|
5470
|
+
return getUnconfiguredStore();
|
|
5471
|
+
}
|
|
4992
5472
|
}
|
|
4993
|
-
var UiPathMetaTags;
|
|
4994
|
-
(function(UiPathMetaTags2) {
|
|
4995
|
-
UiPathMetaTags2["CLIENT_ID"] = "uipath:client-id";
|
|
4996
|
-
UiPathMetaTags2["SCOPE"] = "uipath:scope";
|
|
4997
|
-
UiPathMetaTags2["ORG_NAME"] = "uipath:org-name";
|
|
4998
|
-
UiPathMetaTags2["TENANT_NAME"] = "uipath:tenant-name";
|
|
4999
|
-
UiPathMetaTags2["BASE_URL"] = "uipath:base-url";
|
|
5000
|
-
UiPathMetaTags2["REDIRECT_URI"] = "uipath:redirect-uri";
|
|
5001
|
-
UiPathMetaTags2["CDN_BASE"] = "uipath:cdn-base";
|
|
5002
|
-
UiPathMetaTags2["APP_BASE"] = "uipath:app-base";
|
|
5003
|
-
UiPathMetaTags2["FOLDER_KEY"] = "uipath:folder-key";
|
|
5004
|
-
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
5005
|
-
var UiPathElementIds;
|
|
5006
|
-
(function(UiPathElementIds2) {
|
|
5007
|
-
UiPathElementIds2["RESOURCE_OVERRIDES"] = "uipath-overrides";
|
|
5008
|
-
})(UiPathElementIds || (UiPathElementIds = {}));
|
|
5009
5473
|
function getMetaTagContent(name) {
|
|
5010
5474
|
if (!isBrowser)
|
|
5011
5475
|
return;
|
|
@@ -5018,6 +5482,7 @@ function loadFromMetaTags() {
|
|
|
5018
5482
|
clientId: getMetaTagContent(UiPathMetaTags.CLIENT_ID),
|
|
5019
5483
|
scope: getMetaTagContent(UiPathMetaTags.SCOPE),
|
|
5020
5484
|
orgName: getMetaTagContent(UiPathMetaTags.ORG_NAME),
|
|
5485
|
+
organizationId: getMetaTagContent(UiPathMetaTags.ORG_ID),
|
|
5021
5486
|
tenantName: getMetaTagContent(UiPathMetaTags.TENANT_NAME),
|
|
5022
5487
|
baseUrl: getMetaTagContent(UiPathMetaTags.BASE_URL),
|
|
5023
5488
|
redirectUri: getMetaTagContent(UiPathMetaTags.REDIRECT_URI),
|
|
@@ -5026,52 +5491,23 @@ function loadFromMetaTags() {
|
|
|
5026
5491
|
const hasAnyValue = Object.values(config2).some(Boolean);
|
|
5027
5492
|
return hasAnyValue ? config2 : null;
|
|
5028
5493
|
}
|
|
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
5494
|
function isFunctionContext(value) {
|
|
5061
5495
|
return "platform" in value || "robot" in value;
|
|
5062
5496
|
}
|
|
5063
5497
|
function configFromFunctionContext(context) {
|
|
5064
5498
|
const { platform, robot } = context;
|
|
5065
|
-
|
|
5066
|
-
return null;
|
|
5499
|
+
const baseUrl = nonBlank(platform?.baseUrl);
|
|
5067
5500
|
const config2 = {
|
|
5068
|
-
baseUrl:
|
|
5069
|
-
orgName: platform
|
|
5070
|
-
tenantName: platform
|
|
5071
|
-
secret: robot?.accessToken
|
|
5501
|
+
baseUrl: baseUrl === undefined ? undefined : toHttpOrigin(baseUrl) ?? undefined,
|
|
5502
|
+
orgName: nonBlank(platform?.orgId),
|
|
5503
|
+
tenantName: nonBlank(platform?.tenantId),
|
|
5504
|
+
secret: nonBlank(robot?.accessToken)
|
|
5072
5505
|
};
|
|
5073
5506
|
return Object.values(config2).some(Boolean) ? config2 : null;
|
|
5074
5507
|
}
|
|
5508
|
+
function folderKeyFromFunctionContext(context) {
|
|
5509
|
+
return nonBlank(context.platform?.folderKey);
|
|
5510
|
+
}
|
|
5075
5511
|
var _UiPath_instances;
|
|
5076
5512
|
var _a;
|
|
5077
5513
|
var _UiPath_config;
|
|
@@ -5079,6 +5515,8 @@ var _UiPath_authService;
|
|
|
5079
5515
|
var _UiPath_initialized;
|
|
5080
5516
|
var _UiPath_partialConfig;
|
|
5081
5517
|
var _UiPath_metaFolderKey;
|
|
5518
|
+
var _UiPath_contextFolderKey;
|
|
5519
|
+
var _UiPath_functionContext;
|
|
5082
5520
|
var _UiPath_metaOrgId;
|
|
5083
5521
|
var _UiPath_metaTenantId;
|
|
5084
5522
|
var _UiPath_initializeWithConfig;
|
|
@@ -5092,18 +5530,30 @@ var UiPath$1 = class UiPath {
|
|
|
5092
5530
|
_UiPath_initialized.set(this, false);
|
|
5093
5531
|
_UiPath_partialConfig.set(this, undefined);
|
|
5094
5532
|
_UiPath_metaFolderKey.set(this, undefined);
|
|
5533
|
+
_UiPath_contextFolderKey.set(this, undefined);
|
|
5534
|
+
_UiPath_functionContext.set(this, undefined);
|
|
5095
5535
|
_UiPath_metaOrgId.set(this, undefined);
|
|
5096
5536
|
_UiPath_metaTenantId.set(this, undefined);
|
|
5097
|
-
|
|
5537
|
+
let resolved;
|
|
5538
|
+
if (config2 && isFunctionContext(config2)) {
|
|
5539
|
+
__classPrivateFieldSet(this, _UiPath_functionContext, config2, "f");
|
|
5540
|
+
__classPrivateFieldSet(this, _UiPath_contextFolderKey, folderKeyFromFunctionContext(config2), "f");
|
|
5541
|
+
resolved = configFromFunctionContext(config2) ?? undefined;
|
|
5542
|
+
} else {
|
|
5543
|
+
resolved = config2;
|
|
5544
|
+
}
|
|
5098
5545
|
const configFromMetaTags = loadFromMetaTags();
|
|
5099
5546
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5100
|
-
__classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.orgName, "f");
|
|
5547
|
+
__classPrivateFieldSet(this, _UiPath_metaOrgId, configFromMetaTags?.organizationId ?? configFromMetaTags?.orgName, "f");
|
|
5101
5548
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, configFromMetaTags?.tenantName, "f");
|
|
5102
5549
|
const mergedConfig = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, configFromMetaTags, resolved);
|
|
5103
5550
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
5104
5551
|
__classPrivateFieldGet(this, _UiPath_instances, "m", _UiPath_initializeWithConfig).call(this, mergedConfig);
|
|
5105
|
-
} else
|
|
5106
|
-
|
|
5552
|
+
} else {
|
|
5553
|
+
if (resolved) {
|
|
5554
|
+
__classPrivateFieldSet(this, _UiPath_partialConfig, resolved, "f");
|
|
5555
|
+
}
|
|
5556
|
+
SDKInternalsRegistry.setUnconfigured(this, missingConfigMessage(mergedConfig, __classPrivateFieldGet(this, _UiPath_functionContext, "f")));
|
|
5107
5557
|
}
|
|
5108
5558
|
}
|
|
5109
5559
|
async initialize() {
|
|
@@ -5179,14 +5629,14 @@ var UiPath$1 = class UiPath {
|
|
|
5179
5629
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5180
5630
|
}
|
|
5181
5631
|
};
|
|
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) {
|
|
5183
|
-
validateConfig(config2);
|
|
5632
|
+
_a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_contextFolderKey = new WeakMap, _UiPath_functionContext = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
|
|
5184
5633
|
const hasSecretAuth = hasSecretConfig(config2);
|
|
5185
5634
|
const hasOAuthAuth = hasOAuthConfig(config2);
|
|
5186
5635
|
const internalConfig = new UiPathConfig({
|
|
5187
5636
|
baseUrl: normalizeBaseUrl(config2.baseUrl),
|
|
5188
5637
|
orgName: config2.orgName,
|
|
5189
5638
|
tenantName: config2.tenantName,
|
|
5639
|
+
organizationId: config2.organizationId,
|
|
5190
5640
|
secret: hasSecretAuth ? config2.secret : undefined,
|
|
5191
5641
|
clientId: hasOAuthAuth ? config2.clientId : undefined,
|
|
5192
5642
|
redirectUri: hasOAuthAuth ? config2.redirectUri : undefined,
|
|
@@ -5200,7 +5650,8 @@ _a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap,
|
|
|
5200
5650
|
config: internalConfig,
|
|
5201
5651
|
context: executionContext,
|
|
5202
5652
|
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
5203
|
-
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f")
|
|
5653
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_contextFolderKey, "f") ?? __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
5654
|
+
metaFolderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f")
|
|
5204
5655
|
});
|
|
5205
5656
|
this.config = {
|
|
5206
5657
|
baseUrl: internalConfig.baseUrl,
|
|
@@ -5222,7 +5673,8 @@ _a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap,
|
|
|
5222
5673
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
5223
5674
|
}
|
|
5224
5675
|
}, _UiPath_mergeConfigSources = function _UiPath_mergeConfigSources2(metaConfig, config2) {
|
|
5225
|
-
const
|
|
5676
|
+
const environment = loadFromEnvironment();
|
|
5677
|
+
const layers = [environment, metaConfig, config2].filter((layer) => Boolean(layer)).map((layer) => compactConfig(layer));
|
|
5226
5678
|
if (layers.length === 0)
|
|
5227
5679
|
return;
|
|
5228
5680
|
const merged = layers.reduce((acc, layer) => ({ ...acc, ...layer }), {});
|
|
@@ -5237,15 +5689,20 @@ _a = UiPath$1, _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap,
|
|
|
5237
5689
|
delete merged.secret;
|
|
5238
5690
|
}
|
|
5239
5691
|
}
|
|
5692
|
+
const mergedHasSecret = hasSecretConfig(merged);
|
|
5693
|
+
const mergedHasOAuth = hasOAuthConfig(merged);
|
|
5694
|
+
if (mergedHasSecret && mergedHasOAuth) {
|
|
5695
|
+
throw new Error(conflictingAuthMessage({ config: config2, metaConfig, environment }));
|
|
5696
|
+
}
|
|
5240
5697
|
return merged;
|
|
5241
5698
|
}, _UiPath_loadConfig = function _UiPath_loadConfig2() {
|
|
5242
5699
|
const metaConfig = loadFromMetaTags();
|
|
5243
5700
|
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
5244
|
-
__classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.orgName, "f");
|
|
5701
|
+
__classPrivateFieldSet(this, _UiPath_metaOrgId, metaConfig?.organizationId ?? metaConfig?.orgName, "f");
|
|
5245
5702
|
__classPrivateFieldSet(this, _UiPath_metaTenantId, metaConfig?.tenantName, "f");
|
|
5246
5703
|
const merged = __classPrivateFieldGet(_a, _a, "m", _UiPath_mergeConfigSources).call(_a, metaConfig, __classPrivateFieldGet(this, _UiPath_partialConfig, "f"));
|
|
5247
5704
|
if (!merged || !isCompleteConfig(merged)) {
|
|
5248
|
-
throw new Error(missingConfigMessage());
|
|
5705
|
+
throw new Error(missingConfigMessage(merged, __classPrivateFieldGet(this, _UiPath_functionContext, "f")));
|
|
5249
5706
|
}
|
|
5250
5707
|
return merged;
|
|
5251
5708
|
};
|
|
@@ -5409,23 +5866,6 @@ class ErrorFactory {
|
|
|
5409
5866
|
return new NetworkError({ message });
|
|
5410
5867
|
}
|
|
5411
5868
|
}
|
|
5412
|
-
var FOLDER_KEY = "X-UIPATH-FolderKey";
|
|
5413
|
-
var FOLDER_PATH_ENCODED = "X-UIPATH-FolderPath-Encoded";
|
|
5414
|
-
var FOLDER_ID = "X-UIPATH-OrganizationUnitId";
|
|
5415
|
-
var TRACEPARENT = "traceparent";
|
|
5416
|
-
var UIPATH_TRACEPARENT_ID = "x-uipath-traceparent-id";
|
|
5417
|
-
var CONTENT_TYPES = {
|
|
5418
|
-
JSON: "application/json",
|
|
5419
|
-
XML: "application/xml",
|
|
5420
|
-
OCTET_STREAM: "application/octet-stream"
|
|
5421
|
-
};
|
|
5422
|
-
var RESPONSE_TYPES = {
|
|
5423
|
-
JSON: "json",
|
|
5424
|
-
TEXT: "text",
|
|
5425
|
-
BLOB: "blob",
|
|
5426
|
-
ARRAYBUFFER: "arraybuffer",
|
|
5427
|
-
STREAM: "stream"
|
|
5428
|
-
};
|
|
5429
5869
|
function createParams(paramsObj = {}) {
|
|
5430
5870
|
const params = {};
|
|
5431
5871
|
for (const [key, value] of Object.entries(paramsObj)) {
|
|
@@ -5453,148 +5893,6 @@ function toSearchParams(params) {
|
|
|
5453
5893
|
}
|
|
5454
5894
|
return searchParams;
|
|
5455
5895
|
}
|
|
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
|
|
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
|
-
}
|
|
5597
|
-
|
|
5598
5896
|
class ApiClient {
|
|
5599
5897
|
constructor(config2, executionContext, tokenManager, clientConfig = {}) {
|
|
5600
5898
|
this.config = config2;
|
|
@@ -6186,9 +6484,9 @@ var _BaseService_apiClient;
|
|
|
6186
6484
|
class BaseService {
|
|
6187
6485
|
constructor(instance, headers) {
|
|
6188
6486
|
_BaseService_apiClient.set(this, undefined);
|
|
6189
|
-
const { config: config2, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
6487
|
+
const { config: config2, context, tokenManager, folderKey, metaFolderKey } = SDKInternalsRegistry.get(instance);
|
|
6190
6488
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config2, context, tokenManager, headers ? { headers } : {}), "f");
|
|
6191
|
-
this.config = { folderKey };
|
|
6489
|
+
this.config = { folderKey, metaFolderKey };
|
|
6192
6490
|
}
|
|
6193
6491
|
async getValidAuthToken() {
|
|
6194
6492
|
return __classPrivateFieldGet(this, _BaseService_apiClient, "f").getValidToken();
|
|
@@ -6277,7 +6575,7 @@ class BaseService {
|
|
|
6277
6575
|
limitedPageSize = getLimitedPageSize(params.pageSize);
|
|
6278
6576
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
6279
6577
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
6280
|
-
const countParam = paginationParams
|
|
6578
|
+
const countParam = paginationParams && "countParam" in paginationParams ? paginationParams.countParam : ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
6281
6579
|
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
6282
6580
|
const zeroBased = paginationParams?.zeroBased ?? false;
|
|
6283
6581
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
@@ -6289,7 +6587,7 @@ class BaseService {
|
|
|
6289
6587
|
const sdkPageNumber = params.pageNumber || 1;
|
|
6290
6588
|
requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
|
|
6291
6589
|
}
|
|
6292
|
-
{
|
|
6590
|
+
if (countParam) {
|
|
6293
6591
|
requestParams[countParam] = true;
|
|
6294
6592
|
}
|
|
6295
6593
|
break;
|
|
@@ -6372,6 +6670,11 @@ function createEntityMethods(entityData, service) {
|
|
|
6372
6670
|
throw new Error("Entity ID is undefined");
|
|
6373
6671
|
return service.updateRecords({ id: entityData.id }, data, options);
|
|
6374
6672
|
},
|
|
6673
|
+
async upsert(data, options) {
|
|
6674
|
+
if (!entityData.name)
|
|
6675
|
+
throw new Error("Entity name is undefined");
|
|
6676
|
+
return service.upsert({ name: entityData.name }, data, options);
|
|
6677
|
+
},
|
|
6375
6678
|
async deleteRecords(recordIds, options) {
|
|
6376
6679
|
if (!entityData.id)
|
|
6377
6680
|
throw new Error("Entity ID is undefined");
|
|
@@ -6504,6 +6807,11 @@ var EntityHavingOperator;
|
|
|
6504
6807
|
EntityHavingOperator2["LessThan"] = "<";
|
|
6505
6808
|
EntityHavingOperator2["LessThanOrEqual"] = "<=";
|
|
6506
6809
|
})(EntityHavingOperator || (EntityHavingOperator = {}));
|
|
6810
|
+
var EntityMultiEntityWriteOperation;
|
|
6811
|
+
(function(EntityMultiEntityWriteOperation2) {
|
|
6812
|
+
EntityMultiEntityWriteOperation2["Insert"] = "Insert";
|
|
6813
|
+
EntityMultiEntityWriteOperation2["Update"] = "Update";
|
|
6814
|
+
})(EntityMultiEntityWriteOperation || (EntityMultiEntityWriteOperation = {}));
|
|
6507
6815
|
var EntityType;
|
|
6508
6816
|
(function(EntityType2) {
|
|
6509
6817
|
EntityType2["Entity"] = "Entity";
|
|
@@ -6511,6 +6819,12 @@ var EntityType;
|
|
|
6511
6819
|
EntityType2["InternalEntity"] = "InternalEntity";
|
|
6512
6820
|
EntityType2["SystemEntity"] = "SystemEntity";
|
|
6513
6821
|
})(EntityType || (EntityType = {}));
|
|
6822
|
+
var EntityClass;
|
|
6823
|
+
(function(EntityClass2) {
|
|
6824
|
+
EntityClass2["Native"] = "Native";
|
|
6825
|
+
EntityClass2["Federated"] = "Federated";
|
|
6826
|
+
EntityClass2["Case"] = "Case";
|
|
6827
|
+
})(EntityClass || (EntityClass = {}));
|
|
6514
6828
|
var ReferenceType;
|
|
6515
6829
|
(function(ReferenceType2) {
|
|
6516
6830
|
ReferenceType2["ManyToOne"] = "ManyToOne";
|
|
@@ -6534,6 +6848,11 @@ var JoinType;
|
|
|
6534
6848
|
JoinType2["LeftJoin"] = "LeftJoin";
|
|
6535
6849
|
JoinType2["InnerJoin"] = "InnerJoin";
|
|
6536
6850
|
})(JoinType || (JoinType = {}));
|
|
6851
|
+
var EntityClassId;
|
|
6852
|
+
(function(EntityClassId2) {
|
|
6853
|
+
EntityClassId2[EntityClassId2["Native"] = 9] = "Native";
|
|
6854
|
+
EntityClassId2[EntityClassId2["Federated"] = 10] = "Federated";
|
|
6855
|
+
})(EntityClassId || (EntityClassId = {}));
|
|
6537
6856
|
var EntityFieldConstraint;
|
|
6538
6857
|
(function(EntityFieldConstraint2) {
|
|
6539
6858
|
EntityFieldConstraint2["LengthLimit"] = "lengthLimit";
|
|
@@ -6642,21 +6961,92 @@ var ENTITY_FIELD_CONSTRAINT_SPEC = {
|
|
|
6642
6961
|
[EntityFieldConstraint.DecimalPrecision]: { min: 0, max: 10 }
|
|
6643
6962
|
}
|
|
6644
6963
|
};
|
|
6645
|
-
var EntityFieldTypeMap = {
|
|
6646
|
-
[SqlFieldType.UNIQUEIDENTIFIER]: EntityFieldDataType.UUID,
|
|
6647
|
-
[SqlFieldType.NVARCHAR]: EntityFieldDataType.STRING,
|
|
6648
|
-
[SqlFieldType.INT]: EntityFieldDataType.INTEGER,
|
|
6649
|
-
[SqlFieldType.DATETIME2]: EntityFieldDataType.DATETIME,
|
|
6650
|
-
[SqlFieldType.DATETIMEOFFSET]: EntityFieldDataType.DATETIME_WITH_TZ,
|
|
6651
|
-
[SqlFieldType.FLOAT]: EntityFieldDataType.FLOAT,
|
|
6652
|
-
[SqlFieldType.REAL]: EntityFieldDataType.DOUBLE,
|
|
6653
|
-
[SqlFieldType.BIGINT]: EntityFieldDataType.BIG_INTEGER,
|
|
6654
|
-
[SqlFieldType.DATE]: EntityFieldDataType.DATE,
|
|
6655
|
-
[SqlFieldType.BIT]: EntityFieldDataType.BOOLEAN,
|
|
6656
|
-
[SqlFieldType.DECIMAL]: EntityFieldDataType.DECIMAL,
|
|
6657
|
-
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
|
|
6658
|
-
[SqlFieldType.MULTILINE_MAX]: EntityFieldDataType.MULTILINE_MAX
|
|
6659
|
-
};
|
|
6964
|
+
var EntityFieldTypeMap = {
|
|
6965
|
+
[SqlFieldType.UNIQUEIDENTIFIER]: EntityFieldDataType.UUID,
|
|
6966
|
+
[SqlFieldType.NVARCHAR]: EntityFieldDataType.STRING,
|
|
6967
|
+
[SqlFieldType.INT]: EntityFieldDataType.INTEGER,
|
|
6968
|
+
[SqlFieldType.DATETIME2]: EntityFieldDataType.DATETIME,
|
|
6969
|
+
[SqlFieldType.DATETIMEOFFSET]: EntityFieldDataType.DATETIME_WITH_TZ,
|
|
6970
|
+
[SqlFieldType.FLOAT]: EntityFieldDataType.FLOAT,
|
|
6971
|
+
[SqlFieldType.REAL]: EntityFieldDataType.DOUBLE,
|
|
6972
|
+
[SqlFieldType.BIGINT]: EntityFieldDataType.BIG_INTEGER,
|
|
6973
|
+
[SqlFieldType.DATE]: EntityFieldDataType.DATE,
|
|
6974
|
+
[SqlFieldType.BIT]: EntityFieldDataType.BOOLEAN,
|
|
6975
|
+
[SqlFieldType.DECIMAL]: EntityFieldDataType.DECIMAL,
|
|
6976
|
+
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
|
|
6977
|
+
[SqlFieldType.MULTILINE_MAX]: EntityFieldDataType.MULTILINE_MAX
|
|
6978
|
+
};
|
|
6979
|
+
var EntityClassToIdMap = {
|
|
6980
|
+
[EntityClass.Native]: EntityClassId.Native,
|
|
6981
|
+
[EntityClass.Federated]: EntityClassId.Federated
|
|
6982
|
+
};
|
|
6983
|
+
function isPlainObject(value) {
|
|
6984
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6985
|
+
}
|
|
6986
|
+
function asResourceOverrides(value) {
|
|
6987
|
+
if (!isPlainObject(value))
|
|
6988
|
+
return;
|
|
6989
|
+
const table = {};
|
|
6990
|
+
for (const [key, properties] of Object.entries(value)) {
|
|
6991
|
+
if (!isPlainObject(properties))
|
|
6992
|
+
continue;
|
|
6993
|
+
const bag = {};
|
|
6994
|
+
for (const [property, propertyValue] of Object.entries(properties)) {
|
|
6995
|
+
if (typeof propertyValue === "string")
|
|
6996
|
+
bag[property] = propertyValue;
|
|
6997
|
+
}
|
|
6998
|
+
table[key] = bag;
|
|
6999
|
+
}
|
|
7000
|
+
return Object.keys(table).length > 0 ? table : undefined;
|
|
7001
|
+
}
|
|
7002
|
+
function readFromDocument() {
|
|
7003
|
+
if (!isBrowser)
|
|
7004
|
+
return;
|
|
7005
|
+
const text = document.getElementById(UiPathElementIds.RESOURCE_OVERRIDES)?.textContent;
|
|
7006
|
+
if (!text)
|
|
7007
|
+
return;
|
|
7008
|
+
try {
|
|
7009
|
+
return asResourceOverrides(JSON.parse(text));
|
|
7010
|
+
} catch (error) {
|
|
7011
|
+
console.warn(`[UiPath SDK] Failed to parse <script id="${UiPathElementIds.RESOURCE_OVERRIDES}"> as JSON — proceeding without overrides:`, error);
|
|
7012
|
+
return;
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
var table;
|
|
7016
|
+
var loaded = false;
|
|
7017
|
+
var pageOverrides = () => {
|
|
7018
|
+
if (!loaded) {
|
|
7019
|
+
loaded = true;
|
|
7020
|
+
table = readFromDocument();
|
|
7021
|
+
}
|
|
7022
|
+
return table;
|
|
7023
|
+
};
|
|
7024
|
+
var RESOURCE_OVERWRITES_KEY = Symbol.for("uipath.resourceOverwrites.v1");
|
|
7025
|
+
function readOverrides() {
|
|
7026
|
+
const slot = globalThis[RESOURCE_OVERWRITES_KEY];
|
|
7027
|
+
const source = typeof slot === "function" ? slot : pageOverrides;
|
|
7028
|
+
try {
|
|
7029
|
+
return source();
|
|
7030
|
+
} catch (error) {
|
|
7031
|
+
console.warn("[UiPath SDK] Override source threw — proceeding without overrides:", error);
|
|
7032
|
+
return;
|
|
7033
|
+
}
|
|
7034
|
+
}
|
|
7035
|
+
function resolveOverride(resourceType, name, folderPath) {
|
|
7036
|
+
const table2 = readOverrides();
|
|
7037
|
+
if (!table2)
|
|
7038
|
+
return;
|
|
7039
|
+
const bindingType = resourceType.toLowerCase();
|
|
7040
|
+
const scopedKey = folderPath ? `${bindingType}.${name}.${folderPath}` : undefined;
|
|
7041
|
+
const unscopedKey = `${bindingType}.${name}`;
|
|
7042
|
+
const entry = (scopedKey && table2[scopedKey]) ?? table2[unscopedKey];
|
|
7043
|
+
if (!entry)
|
|
7044
|
+
return;
|
|
7045
|
+
return {
|
|
7046
|
+
name: entry.name,
|
|
7047
|
+
folderPath: entry.folderPath
|
|
7048
|
+
};
|
|
7049
|
+
}
|
|
6660
7050
|
var JOIN_TYPE_WIRE = {
|
|
6661
7051
|
[JoinType.LeftJoin]: "LEFT",
|
|
6662
7052
|
[JoinType.InnerJoin]: "INNER"
|
|
@@ -6672,6 +7062,39 @@ function toWireJoin(join, baseEntityName) {
|
|
|
6672
7062
|
}
|
|
6673
7063
|
};
|
|
6674
7064
|
}
|
|
7065
|
+
function externalSourceObjectName(source) {
|
|
7066
|
+
return source.externalObjectDetail?.externalObjectName;
|
|
7067
|
+
}
|
|
7068
|
+
function externalSourceFieldName(field) {
|
|
7069
|
+
const def = field.fieldDefinition;
|
|
7070
|
+
return def?.name ?? def?.Name;
|
|
7071
|
+
}
|
|
7072
|
+
function externalSourceMappedName(field) {
|
|
7073
|
+
const m = field.externalFieldMappingDetail ?? field.ExternalFieldMappingDetail;
|
|
7074
|
+
return m?.externalFieldName ?? m?.ExternalFieldName;
|
|
7075
|
+
}
|
|
7076
|
+
function sourceConnId(s) {
|
|
7077
|
+
const ext = s.externalConnectionDetail;
|
|
7078
|
+
const nat = s.nativeConnectionDetail;
|
|
7079
|
+
return ext?.connectionId ?? nat?.entityId;
|
|
7080
|
+
}
|
|
7081
|
+
function carryForwardSource(source) {
|
|
7082
|
+
const fields = (source.fields ?? []).map((f) => {
|
|
7083
|
+
const fieldDefinition = { ...f.fieldDefinition };
|
|
7084
|
+
if (fieldDefinition.fieldDisplayType === undefined && fieldDefinition.FieldDisplayType === undefined) {
|
|
7085
|
+
fieldDefinition.fieldDisplayType = FieldDisplayType.Basic;
|
|
7086
|
+
}
|
|
7087
|
+
if (fieldDefinition.description === undefined && fieldDefinition.Description === undefined) {
|
|
7088
|
+
fieldDefinition.description = "";
|
|
7089
|
+
}
|
|
7090
|
+
return { ...f, fieldDefinition };
|
|
7091
|
+
});
|
|
7092
|
+
return { ...source, fields };
|
|
7093
|
+
}
|
|
7094
|
+
function applyEntityNameOverride(entityName) {
|
|
7095
|
+
const override = resolveOverride("Entity", entityName);
|
|
7096
|
+
return override?.name ?? entityName;
|
|
7097
|
+
}
|
|
6675
7098
|
function unwrapEntityRef(entityRef, callerLabel) {
|
|
6676
7099
|
const { id, name } = entityRef ?? {};
|
|
6677
7100
|
if (id && name) {
|
|
@@ -6683,7 +7106,7 @@ function unwrapEntityRef(entityRef, callerLabel) {
|
|
|
6683
7106
|
return { byId: true, identifier: id };
|
|
6684
7107
|
}
|
|
6685
7108
|
if (name) {
|
|
6686
|
-
return { byId: false, identifier: name };
|
|
7109
|
+
return { byId: false, identifier: applyEntityNameOverride(name) };
|
|
6687
7110
|
}
|
|
6688
7111
|
throw new ValidationError({
|
|
6689
7112
|
message: `${callerLabel}: entityRef must supply exactly one of 'id' or 'name'.`
|
|
@@ -6695,19 +7118,19 @@ class EntityService extends BaseService {
|
|
|
6695
7118
|
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), options?.folderKey);
|
|
6696
7119
|
}
|
|
6697
7120
|
async getByName(entityName, options) {
|
|
6698
|
-
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(entityName), options?.folderKey);
|
|
7121
|
+
return this.fetchEntityMetadata(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_NAME(applyEntityNameOverride(entityName)), options?.folderKey);
|
|
6699
7122
|
}
|
|
6700
7123
|
async getAllRecords(entityId, options) {
|
|
6701
7124
|
return this.getRecordsImpl(true, entityId, options);
|
|
6702
7125
|
}
|
|
6703
7126
|
async getRecordsByName(entityName, options) {
|
|
6704
|
-
return this.getRecordsImpl(false, entityName, options);
|
|
7127
|
+
return this.getRecordsImpl(false, applyEntityNameOverride(entityName), options);
|
|
6705
7128
|
}
|
|
6706
7129
|
async getRecordById(entityId, recordId, options = {}) {
|
|
6707
7130
|
return this.getRecordImpl(true, entityId, recordId, options);
|
|
6708
7131
|
}
|
|
6709
7132
|
async getRecordByName(entityName, recordId, options = {}) {
|
|
6710
|
-
return this.getRecordImpl(false, entityName, recordId, options);
|
|
7133
|
+
return this.getRecordImpl(false, applyEntityNameOverride(entityName), recordId, options);
|
|
6711
7134
|
}
|
|
6712
7135
|
async insertRecord(entityRef, data, options = {}) {
|
|
6713
7136
|
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.insertRecord");
|
|
@@ -6737,6 +7160,11 @@ class EntityService extends BaseService {
|
|
|
6737
7160
|
async updateRecordsById(id, data, options = {}) {
|
|
6738
7161
|
return this.updateRecordsImpl(true, id, data, options);
|
|
6739
7162
|
}
|
|
7163
|
+
async upsert(entityRef, data, options = {}) {
|
|
7164
|
+
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.upsert");
|
|
7165
|
+
const entityName = byId ? await this.resolveEntityName(identifier, options.folderKey) : identifier;
|
|
7166
|
+
return this.upsertImpl(entityName, data, options);
|
|
7167
|
+
}
|
|
6740
7168
|
async deleteRecords(entityRef, recordIds, options = {}) {
|
|
6741
7169
|
const { byId, identifier } = unwrapEntityRef(entityRef, "Entities.deleteRecords");
|
|
6742
7170
|
return this.deleteRecordsImpl(byId, identifier, recordIds, options);
|
|
@@ -6752,7 +7180,7 @@ class EntityService extends BaseService {
|
|
|
6752
7180
|
return this.deleteRecordImpl(true, entityId, recordId, options);
|
|
6753
7181
|
}
|
|
6754
7182
|
async getAll(options) {
|
|
6755
|
-
const endpoint =
|
|
7183
|
+
const endpoint = options?.folderKey || options?.includeFolderEntities ? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V3 : DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
|
|
6756
7184
|
const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
6757
7185
|
const entities = response.data.map((entity) => {
|
|
6758
7186
|
const metadata = transformData(entity, EntityMap);
|
|
@@ -6814,7 +7242,22 @@ class EntityService extends BaseService {
|
|
|
6814
7242
|
}
|
|
6815
7243
|
async create(name, fields, options) {
|
|
6816
7244
|
const opts = options ?? {};
|
|
7245
|
+
let entityClassId;
|
|
7246
|
+
if (opts.entityClass !== undefined) {
|
|
7247
|
+
entityClassId = EntityClassToIdMap[opts.entityClass];
|
|
7248
|
+
if (entityClassId === undefined) {
|
|
7249
|
+
throw new ValidationError({
|
|
7250
|
+
message: `entityClass '${opts.entityClass}' is not creatable. Use EntityClass.Native or EntityClass.Federated.`
|
|
7251
|
+
});
|
|
7252
|
+
}
|
|
7253
|
+
}
|
|
7254
|
+
if (opts.entityClass === EntityClass.Federated && !opts.externalFields?.length) {
|
|
7255
|
+
throw new ValidationError({
|
|
7256
|
+
message: "Federated entities require at least one external source in `externalFields`."
|
|
7257
|
+
});
|
|
7258
|
+
}
|
|
6817
7259
|
const fieldPayloads = await this.buildFieldsWithReferenceMeta(fields);
|
|
7260
|
+
const externalFields = await this.buildExternalSourcesPayload(opts.externalFields);
|
|
6818
7261
|
const payload = {
|
|
6819
7262
|
...opts.description !== undefined && { description: opts.description },
|
|
6820
7263
|
displayName: opts.displayName ?? name,
|
|
@@ -6824,7 +7267,9 @@ class EntityService extends BaseService {
|
|
|
6824
7267
|
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
6825
7268
|
isRbacEnabled: opts.isRbacEnabled ?? false,
|
|
6826
7269
|
isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
|
|
6827
|
-
externalFields
|
|
7270
|
+
externalFields,
|
|
7271
|
+
...entityClassId !== undefined && { entityClassId },
|
|
7272
|
+
...opts.sourceJoinConditionDetails !== undefined && { sourceJoinConditionDetails: opts.sourceJoinConditionDetails }
|
|
6828
7273
|
}
|
|
6829
7274
|
};
|
|
6830
7275
|
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload, { headers: createHeaders({ [FOLDER_KEY]: opts.folderKey }) });
|
|
@@ -6835,18 +7280,19 @@ class EntityService extends BaseService {
|
|
|
6835
7280
|
}
|
|
6836
7281
|
async updateById(id, options) {
|
|
6837
7282
|
const opts = options ?? {};
|
|
6838
|
-
const
|
|
7283
|
+
const hasFederatedChanges = !!(opts.addExternalSources?.length || opts.removeExternalSources?.length || opts.addExternalFields?.length || opts.removeExternalFields?.length || opts.addSourceJoins?.length || opts.updateSourceJoin?.length || opts.replaceSourceJoins !== undefined || opts.updateExternalConnection?.length);
|
|
7284
|
+
const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length) || hasFederatedChanges;
|
|
6839
7285
|
const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
|
|
6840
7286
|
if (!hasSchemaChanges && !hasMetadataChanges) {
|
|
6841
7287
|
throw new ValidationError({
|
|
6842
|
-
message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, or
|
|
7288
|
+
message: "updateById requires at least one change — pass addFields, removeFields, updateFields, displayName, description, isRbacEnabled, or a federated source/join delta (addExternalSources, removeExternalSources, addExternalFields, removeExternalFields, addSourceJoins, updateSourceJoin, replaceSourceJoins, updateExternalConnection)."
|
|
6843
7289
|
});
|
|
6844
7290
|
}
|
|
6845
7291
|
if (hasSchemaChanges) {
|
|
6846
7292
|
await this.applySchemaUpdate(id, opts);
|
|
6847
7293
|
}
|
|
6848
7294
|
if (hasMetadataChanges) {
|
|
6849
|
-
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.
|
|
7295
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
|
|
6850
7296
|
...opts.displayName !== undefined && { displayName: opts.displayName },
|
|
6851
7297
|
...opts.description !== undefined && { description: opts.description },
|
|
6852
7298
|
...opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }
|
|
@@ -6857,7 +7303,7 @@ class EntityService extends BaseService {
|
|
|
6857
7303
|
const folderHeaders = createHeaders({ [FOLDER_KEY]: options.folderKey });
|
|
6858
7304
|
const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId), { headers: folderHeaders });
|
|
6859
7305
|
const raw = entityResponse.data;
|
|
6860
|
-
let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
|
|
7306
|
+
let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey && !f.isExternalField);
|
|
6861
7307
|
if (options.removeFields?.length) {
|
|
6862
7308
|
const existingNames = new Set(fields.map((f) => f.name));
|
|
6863
7309
|
const missing = options.removeFields.filter((r) => !existingNames.has(r.name)).map((r) => r.name);
|
|
@@ -6915,6 +7361,7 @@ class EntityService extends BaseService {
|
|
|
6915
7361
|
if (options.addFields?.length) {
|
|
6916
7362
|
newFields.push(...await this.buildFieldsWithReferenceMeta(options.addFields));
|
|
6917
7363
|
}
|
|
7364
|
+
const federated = await this.buildFederatedUpsertParts(raw, options);
|
|
6918
7365
|
await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
|
|
6919
7366
|
displayName: raw.displayName,
|
|
6920
7367
|
description: raw.description,
|
|
@@ -6925,7 +7372,9 @@ class EntityService extends BaseService {
|
|
|
6925
7372
|
folderId: raw.folderId ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
6926
7373
|
isRbacEnabled: raw.isRbacEnabled ?? false,
|
|
6927
7374
|
isInsightsEnabled: raw.isInsightsEnabled ?? false,
|
|
6928
|
-
externalFields:
|
|
7375
|
+
externalFields: federated.externalFields,
|
|
7376
|
+
...federated.entityClassId !== undefined && { entityClassId: federated.entityClassId },
|
|
7377
|
+
...federated.sourceJoinConditionDetails !== undefined && { sourceJoinConditionDetails: federated.sourceJoinConditionDetails }
|
|
6929
7378
|
}
|
|
6930
7379
|
}, { headers: folderHeaders });
|
|
6931
7380
|
}
|
|
@@ -6933,6 +7382,123 @@ class EntityService extends BaseService {
|
|
|
6933
7382
|
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
6934
7383
|
return transformData(response.data, EntityMap).name;
|
|
6935
7384
|
}
|
|
7385
|
+
async buildFederatedUpsertParts(raw, options) {
|
|
7386
|
+
let externalFields = (raw.externalFields ?? []).map((s) => carryForwardSource({ ...s }));
|
|
7387
|
+
let joins = this.translateSourceJoins(raw);
|
|
7388
|
+
const entityClassId = raw.entityClass ? EntityClassToIdMap[raw.entityClass] : undefined;
|
|
7389
|
+
const findSource = (ref) => externalFields.find((s) => externalSourceObjectName(s) === ref.sourceObjectName && sourceConnId(s) === ref.sourceConnectionId);
|
|
7390
|
+
const notFound = (action, ref) => new ValidationError({ message: `Cannot ${action}: no source '${ref.sourceObjectName}' with connection '${ref.sourceConnectionId}' on the entity.` });
|
|
7391
|
+
if (options.replaceSourceJoins !== undefined && (options.addSourceJoins?.length || options.updateSourceJoin?.length)) {
|
|
7392
|
+
throw new ValidationError({ message: "replaceSourceJoins sets the entity's complete join set, so it cannot be combined with addSourceJoins or updateSourceJoin." });
|
|
7393
|
+
}
|
|
7394
|
+
if (options.addExternalSources?.length) {
|
|
7395
|
+
externalFields.push(...await this.buildExternalSourcesPayload(options.addExternalSources));
|
|
7396
|
+
}
|
|
7397
|
+
if (options.removeExternalSources?.length) {
|
|
7398
|
+
const removeKeys = new Set(options.removeExternalSources.map((r) => `${r.sourceObjectName} ${r.sourceConnectionId}`));
|
|
7399
|
+
externalFields = externalFields.filter((s) => !removeKeys.has(`${externalSourceObjectName(s) ?? ""} ${sourceConnId(s) ?? ""}`));
|
|
7400
|
+
joins = joins.filter((j) => !removeKeys.has(`${j.sourceObjectName} ${j.sourceObjectConnectionId}`) && !removeKeys.has(`${j.relatedSourceObjectName} ${j.relatedSourceObjectConnectionId}`));
|
|
7401
|
+
}
|
|
7402
|
+
if (options.addExternalFields?.length) {
|
|
7403
|
+
for (const add of options.addExternalFields) {
|
|
7404
|
+
const src = findSource(add);
|
|
7405
|
+
if (!src)
|
|
7406
|
+
throw notFound("add fields", add);
|
|
7407
|
+
const builtFields = await this.buildExternalFieldsPayload(add.fields);
|
|
7408
|
+
const existing = src.fields ?? [];
|
|
7409
|
+
src.fields = [...existing, ...builtFields];
|
|
7410
|
+
}
|
|
7411
|
+
}
|
|
7412
|
+
if (options.removeExternalFields?.length) {
|
|
7413
|
+
for (const rem of options.removeExternalFields) {
|
|
7414
|
+
const src = findSource(rem);
|
|
7415
|
+
if (!src)
|
|
7416
|
+
throw notFound("remove fields", rem);
|
|
7417
|
+
const drop = new Set(rem.fieldNames);
|
|
7418
|
+
const all = src.fields ?? [];
|
|
7419
|
+
const dropExternal = new Set(all.filter((f) => drop.has(externalSourceFieldName(f) ?? "")).map((f) => externalSourceMappedName(f) ?? ""));
|
|
7420
|
+
src.fields = all.filter((f) => !drop.has(externalSourceFieldName(f) ?? ""));
|
|
7421
|
+
joins = joins.filter((j) => !(j.sourceObjectName === rem.sourceObjectName && j.sourceObjectConnectionId === rem.sourceConnectionId && dropExternal.has(j.sourceJoinField)) && !(j.relatedSourceObjectName === rem.sourceObjectName && j.relatedSourceObjectConnectionId === rem.sourceConnectionId && dropExternal.has(j.relatedSourceJoinField)));
|
|
7422
|
+
}
|
|
7423
|
+
}
|
|
7424
|
+
if (options.addSourceJoins?.length) {
|
|
7425
|
+
joins.push(...options.addSourceJoins.map((j) => ({ ...j })));
|
|
7426
|
+
}
|
|
7427
|
+
if (options.replaceSourceJoins !== undefined) {
|
|
7428
|
+
joins = options.replaceSourceJoins.map((j) => ({ ...j }));
|
|
7429
|
+
}
|
|
7430
|
+
if (options.updateSourceJoin?.length) {
|
|
7431
|
+
for (const up of options.updateSourceJoin) {
|
|
7432
|
+
const join = joins.find((j) => j.sourceObjectName === up.sourceObjectName && j.sourceObjectConnectionId === up.sourceConnectionId && j.relatedSourceObjectName === up.relatedSourceObjectName && j.relatedSourceObjectConnectionId === up.relatedSourceConnectionId);
|
|
7433
|
+
if (!join)
|
|
7434
|
+
throw new ValidationError({ message: `Cannot update join: no join between '${up.sourceObjectName}' (${up.sourceConnectionId}) and '${up.relatedSourceObjectName}' (${up.relatedSourceConnectionId}).` });
|
|
7435
|
+
if (up.sourceJoinField !== undefined)
|
|
7436
|
+
join.sourceJoinField = up.sourceJoinField;
|
|
7437
|
+
if (up.relatedSourceJoinField !== undefined)
|
|
7438
|
+
join.relatedSourceJoinField = up.relatedSourceJoinField;
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
if (options.updateExternalConnection?.length) {
|
|
7442
|
+
for (const swap of options.updateExternalConnection) {
|
|
7443
|
+
const src = findSource(swap);
|
|
7444
|
+
if (!src)
|
|
7445
|
+
throw notFound("replace connection", swap);
|
|
7446
|
+
if (src.nativeConnectionDetail !== undefined) {
|
|
7447
|
+
throw new ValidationError({ message: `Cannot replace connection: source '${swap.sourceObjectName}' is a native (entity-backed) source, not a connector source.` });
|
|
7448
|
+
}
|
|
7449
|
+
const existingConn = src.externalConnectionDetail;
|
|
7450
|
+
src.externalConnectionDetail = {
|
|
7451
|
+
...existingConn,
|
|
7452
|
+
connectionId: swap.newConnectionId,
|
|
7453
|
+
...swap.newElementInstanceId !== undefined && { elementInstanceId: swap.newElementInstanceId },
|
|
7454
|
+
...swap.newFolderKey !== undefined && { folderKey: swap.newFolderKey },
|
|
7455
|
+
...swap.newConnectionName !== undefined && { connectionName: swap.newConnectionName }
|
|
7456
|
+
};
|
|
7457
|
+
const oldConnId = swap.sourceConnectionId;
|
|
7458
|
+
const newConnId = swap.newConnectionId;
|
|
7459
|
+
for (const j of joins) {
|
|
7460
|
+
if (j.sourceObjectName === swap.sourceObjectName && j.sourceObjectConnectionId === oldConnId)
|
|
7461
|
+
j.sourceObjectConnectionId = newConnId;
|
|
7462
|
+
if (j.relatedSourceObjectName === swap.sourceObjectName && j.relatedSourceObjectConnectionId === oldConnId)
|
|
7463
|
+
j.relatedSourceObjectConnectionId = newConnId;
|
|
7464
|
+
}
|
|
7465
|
+
}
|
|
7466
|
+
}
|
|
7467
|
+
externalFields = externalFields.map((s) => ({
|
|
7468
|
+
...s,
|
|
7469
|
+
externalObjectDetail: { ...s.externalObjectDetail, isPrimarySource: false }
|
|
7470
|
+
}));
|
|
7471
|
+
return {
|
|
7472
|
+
externalFields,
|
|
7473
|
+
...entityClassId !== undefined && { entityClassId },
|
|
7474
|
+
...joins.length > 0 && { sourceJoinConditionDetails: joins }
|
|
7475
|
+
};
|
|
7476
|
+
}
|
|
7477
|
+
translateSourceJoins(raw) {
|
|
7478
|
+
const byObjectId = new Map;
|
|
7479
|
+
for (const source of raw.externalFields ?? []) {
|
|
7480
|
+
const objectId = source.externalObjectDetail?.id;
|
|
7481
|
+
if (!objectId)
|
|
7482
|
+
continue;
|
|
7483
|
+
byObjectId.set(objectId, {
|
|
7484
|
+
name: source.externalObjectDetail?.externalObjectName,
|
|
7485
|
+
connectionId: source.externalConnectionDetail?.connectionId ?? source.nativeConnectionDetail?.entityId
|
|
7486
|
+
});
|
|
7487
|
+
}
|
|
7488
|
+
return (raw.sourceJoinCriterias ?? []).map((join) => {
|
|
7489
|
+
const src = byObjectId.get(join.sourceObjectId ?? "");
|
|
7490
|
+
const related = byObjectId.get(join.relatedSourceObjectId ?? "");
|
|
7491
|
+
return {
|
|
7492
|
+
sourceObjectName: src?.name,
|
|
7493
|
+
sourceJoinField: join.joinFieldName,
|
|
7494
|
+
sourceObjectConnectionId: src?.connectionId,
|
|
7495
|
+
joinType: join.joinType,
|
|
7496
|
+
relatedSourceObjectName: related?.name,
|
|
7497
|
+
relatedSourceJoinField: join.relatedSourceFieldName,
|
|
7498
|
+
relatedSourceObjectConnectionId: related?.connectionId
|
|
7499
|
+
};
|
|
7500
|
+
});
|
|
7501
|
+
}
|
|
6936
7502
|
applyFieldMappings(metadata) {
|
|
6937
7503
|
this.mapFieldTypes(metadata);
|
|
6938
7504
|
this.mapExternalFields(metadata);
|
|
@@ -6990,6 +7556,24 @@ class EntityService extends BaseService {
|
|
|
6990
7556
|
const metas = await Promise.all(fields.map((f) => this.buildReferenceMeta(f)));
|
|
6991
7557
|
return fields.map((f, i) => this.buildSchemaFieldPayload(f, metas[i]));
|
|
6992
7558
|
}
|
|
7559
|
+
async buildExternalFieldsPayload(fields) {
|
|
7560
|
+
const list = fields ?? [];
|
|
7561
|
+
const fieldDefs = await this.buildFieldsWithReferenceMeta(list.map((f) => f.field));
|
|
7562
|
+
return list.map((f, i) => ({
|
|
7563
|
+
fieldDefinition: fieldDefs[i],
|
|
7564
|
+
externalFieldMappingDetail: f.externalFieldMappingDetail
|
|
7565
|
+
}));
|
|
7566
|
+
}
|
|
7567
|
+
async buildExternalSourcesPayload(sources) {
|
|
7568
|
+
if (!sources?.length)
|
|
7569
|
+
return [];
|
|
7570
|
+
return Promise.all(sources.map(async (source) => ({
|
|
7571
|
+
fields: await this.buildExternalFieldsPayload(source.fields),
|
|
7572
|
+
externalObjectDetail: source.externalObjectDetail,
|
|
7573
|
+
...source.externalConnectionDetail !== undefined && { externalConnectionDetail: source.externalConnectionDetail },
|
|
7574
|
+
...source.nativeConnectionDetail !== undefined && { nativeConnectionDetail: source.nativeConnectionDetail }
|
|
7575
|
+
})));
|
|
7576
|
+
}
|
|
6993
7577
|
async buildReferenceMeta(field) {
|
|
6994
7578
|
if (field.referenceFolderKey === undefined)
|
|
6995
7579
|
return;
|
|
@@ -7177,6 +7761,11 @@ class EntityService extends BaseService {
|
|
|
7177
7761
|
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
7762
|
return response.data;
|
|
7179
7763
|
}
|
|
7764
|
+
async upsertImpl(entityName, data, options) {
|
|
7765
|
+
const params = createParams({ expansionLevel: options.expansionLevel });
|
|
7766
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT_RECORD_BY_NAME(entityName), data, { params, headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
7767
|
+
return response.data;
|
|
7768
|
+
}
|
|
7180
7769
|
async deleteRecordsImpl(byId, identifier, recordIds, options) {
|
|
7181
7770
|
const params = createParams({ failOnFirst: options.failOnFirst });
|
|
7182
7771
|
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 }) });
|
|
@@ -7281,6 +7870,9 @@ __decorate([
|
|
|
7281
7870
|
__decorate([
|
|
7282
7871
|
track("Entities.UpdateRecordsById")
|
|
7283
7872
|
], EntityService.prototype, "updateRecordsById", null);
|
|
7873
|
+
__decorate([
|
|
7874
|
+
track("Entities.Upsert")
|
|
7875
|
+
], EntityService.prototype, "upsert", null);
|
|
7284
7876
|
__decorate([
|
|
7285
7877
|
track("Entities.DeleteRecords")
|
|
7286
7878
|
], EntityService.prototype, "deleteRecords", null);
|
|
@@ -7388,7 +7980,7 @@ class ChoiceSetService extends BaseService {
|
|
|
7388
7980
|
}, { headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
7389
7981
|
}
|
|
7390
7982
|
async deleteById(choiceSetId, options) {
|
|
7391
|
-
await this.
|
|
7983
|
+
await this.delete(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
7392
7984
|
}
|
|
7393
7985
|
async insertValueById(choiceSetId, name, options) {
|
|
7394
7986
|
const choiceSetName = await this.resolveChoiceSetName(choiceSetId, options?.folderKey);
|
|
@@ -8749,73 +9341,6 @@ function validateName(resourceType, name) {
|
|
|
8749
9341
|
return trimmed;
|
|
8750
9342
|
}
|
|
8751
9343
|
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
|
-
}
|
|
8819
9344
|
var SINGLE_QUOTE_RE = /'/g;
|
|
8820
9345
|
|
|
8821
9346
|
class FolderScopedService extends BaseService {
|
|
@@ -8857,7 +9382,7 @@ class FolderScopedService extends BaseService {
|
|
|
8857
9382
|
});
|
|
8858
9383
|
const items = response.data?.value;
|
|
8859
9384
|
if (!items?.length) {
|
|
8860
|
-
const folderHint = describeFolderForError(folderId,
|
|
9385
|
+
const folderHint = describeFolderForError(folderId, headers[FOLDER_KEY], resolvedFolderPath);
|
|
8861
9386
|
throw new NotFoundError({
|
|
8862
9387
|
message: `${resourceType} '${resolvedName}' not found${folderHint}.`
|
|
8863
9388
|
});
|
|
@@ -9805,10 +10330,7 @@ class BucketService extends FolderScopedService {
|
|
|
9805
10330
|
}
|
|
9806
10331
|
}, options);
|
|
9807
10332
|
}
|
|
9808
|
-
async getFileMetaData(
|
|
9809
|
-
if (!bucketId) {
|
|
9810
|
-
throw new ValidationError({ message: "bucketId is required for getFileMetaData" });
|
|
9811
|
-
}
|
|
10333
|
+
async getFileMetaData(bucketIdOrRef, optionsOrFolderId, legacyOptions) {
|
|
9812
10334
|
let folderId;
|
|
9813
10335
|
let folderKey;
|
|
9814
10336
|
let folderPath;
|
|
@@ -9820,10 +10342,14 @@ class BucketService extends FolderScopedService {
|
|
|
9820
10342
|
const opts = optionsOrFolderId ?? {};
|
|
9821
10343
|
({ folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
9822
10344
|
}
|
|
10345
|
+
const { id: bucketId, effectiveFolder } = await this.resolveBucketRef(bucketIdOrRef, { folderId, folderKey, folderPath }, "Buckets.getFileMetaData");
|
|
10346
|
+
if (bucketId <= 0) {
|
|
10347
|
+
throw new ValidationError({ message: "Buckets.getFileMetaData: bucketId must be a positive number." });
|
|
10348
|
+
}
|
|
9823
10349
|
const headers = resolveFolderHeaders({
|
|
9824
|
-
folderId,
|
|
9825
|
-
folderKey,
|
|
9826
|
-
folderPath,
|
|
10350
|
+
folderId: effectiveFolder.folderId ?? folderId,
|
|
10351
|
+
folderKey: effectiveFolder.folderKey ?? folderKey,
|
|
10352
|
+
folderPath: effectiveFolder.folderPath ?? folderPath,
|
|
9827
10353
|
resourceType: "Buckets.getFileMetaData",
|
|
9828
10354
|
fallbackFolderKey: this.config.folderKey
|
|
9829
10355
|
});
|
|
@@ -9846,35 +10372,43 @@ class BucketService extends FolderScopedService {
|
|
|
9846
10372
|
headers
|
|
9847
10373
|
}, apiRestOptions);
|
|
9848
10374
|
}
|
|
9849
|
-
async uploadFile(
|
|
9850
|
-
let
|
|
10375
|
+
async uploadFile(firstArg, path, content, options) {
|
|
10376
|
+
let bucketIdOrRef;
|
|
9851
10377
|
let resolvedPath;
|
|
9852
10378
|
let resolvedContent;
|
|
9853
10379
|
let folderId;
|
|
9854
10380
|
let folderKey;
|
|
9855
10381
|
let folderPath;
|
|
9856
|
-
|
|
9857
|
-
|
|
10382
|
+
const isDeprecatedOptionsForm = firstArg !== null && typeof firstArg === "object" && "bucketId" in firstArg;
|
|
10383
|
+
if (isDeprecatedOptionsForm) {
|
|
10384
|
+
const opts = firstArg;
|
|
10385
|
+
bucketIdOrRef = opts.bucketId;
|
|
10386
|
+
resolvedPath = opts.path;
|
|
10387
|
+
resolvedContent = opts.content;
|
|
10388
|
+
folderId = opts.folderId;
|
|
10389
|
+
folderKey = opts.folderKey;
|
|
10390
|
+
folderPath = opts.folderPath;
|
|
9858
10391
|
} else {
|
|
9859
|
-
|
|
10392
|
+
bucketIdOrRef = firstArg;
|
|
9860
10393
|
resolvedPath = path;
|
|
9861
10394
|
resolvedContent = content;
|
|
9862
10395
|
const opts = options ?? {};
|
|
9863
10396
|
({ folderId, folderKey, folderPath } = opts);
|
|
9864
10397
|
}
|
|
9865
|
-
if (!bucketId) {
|
|
9866
|
-
throw new ValidationError({ message: "bucketId is required for uploadFile" });
|
|
9867
|
-
}
|
|
9868
10398
|
if (!resolvedPath) {
|
|
9869
10399
|
throw new ValidationError({ message: "path is required for uploadFile" });
|
|
9870
10400
|
}
|
|
9871
10401
|
if (!resolvedContent) {
|
|
9872
10402
|
throw new ValidationError({ message: "content is required for uploadFile" });
|
|
9873
10403
|
}
|
|
10404
|
+
const { id: bucketId, effectiveFolder } = await this.resolveBucketRef(bucketIdOrRef, { folderId, folderKey, folderPath }, "Buckets.uploadFile");
|
|
10405
|
+
if (bucketId <= 0) {
|
|
10406
|
+
throw new ValidationError({ message: "Buckets.uploadFile: bucketId must be a positive number." });
|
|
10407
|
+
}
|
|
9874
10408
|
const headers = resolveFolderHeaders({
|
|
9875
|
-
folderId,
|
|
9876
|
-
folderKey,
|
|
9877
|
-
folderPath,
|
|
10409
|
+
folderId: effectiveFolder.folderId ?? folderId,
|
|
10410
|
+
folderKey: effectiveFolder.folderKey ?? folderKey,
|
|
10411
|
+
folderPath: effectiveFolder.folderPath ?? folderPath,
|
|
9878
10412
|
resourceType: "Buckets.uploadFile",
|
|
9879
10413
|
fallbackFolderKey: this.config.folderKey
|
|
9880
10414
|
});
|
|
@@ -9889,17 +10423,19 @@ class BucketService extends FolderScopedService {
|
|
|
9889
10423
|
statusCode: response.status
|
|
9890
10424
|
};
|
|
9891
10425
|
}
|
|
9892
|
-
async getReadUri(
|
|
9893
|
-
let
|
|
10426
|
+
async getReadUri(firstArg, path, options) {
|
|
10427
|
+
let bucketIdOrRef;
|
|
9894
10428
|
let resolvedPath;
|
|
9895
10429
|
let folderId;
|
|
9896
10430
|
let folderKey;
|
|
9897
10431
|
let folderPath;
|
|
9898
10432
|
let expiryInMinutes;
|
|
9899
10433
|
let restOptions;
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
10434
|
+
const isDeprecatedOptionsForm = firstArg !== null && typeof firstArg === "object" && "bucketId" in firstArg;
|
|
10435
|
+
if (isDeprecatedOptionsForm) {
|
|
10436
|
+
const opts = firstArg;
|
|
10437
|
+
const { bucketId: bid, path: p, expiryInMinutes: e, folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = opts;
|
|
10438
|
+
bucketIdOrRef = bid;
|
|
9903
10439
|
resolvedPath = p;
|
|
9904
10440
|
expiryInMinutes = e;
|
|
9905
10441
|
folderId = fid;
|
|
@@ -9907,15 +10443,22 @@ class BucketService extends FolderScopedService {
|
|
|
9907
10443
|
folderPath = fpath;
|
|
9908
10444
|
restOptions = rest;
|
|
9909
10445
|
} else {
|
|
9910
|
-
|
|
10446
|
+
bucketIdOrRef = firstArg;
|
|
9911
10447
|
resolvedPath = path;
|
|
9912
10448
|
const opts = options ?? {};
|
|
9913
10449
|
({ expiryInMinutes, folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
9914
10450
|
}
|
|
10451
|
+
const { id: bucketId, effectiveFolder } = await this.resolveBucketRef(bucketIdOrRef, { folderId, folderKey, folderPath }, "Buckets.getReadUri");
|
|
10452
|
+
if (bucketId <= 0) {
|
|
10453
|
+
throw new ValidationError({ message: "Buckets.getReadUri: bucketId must be a positive number." });
|
|
10454
|
+
}
|
|
10455
|
+
if (!resolvedPath) {
|
|
10456
|
+
throw new ValidationError({ message: "path is required for getReadUri" });
|
|
10457
|
+
}
|
|
9915
10458
|
const headers = resolveFolderHeaders({
|
|
9916
|
-
folderId,
|
|
9917
|
-
folderKey,
|
|
9918
|
-
folderPath,
|
|
10459
|
+
folderId: effectiveFolder.folderId ?? folderId,
|
|
10460
|
+
folderKey: effectiveFolder.folderKey ?? folderKey,
|
|
10461
|
+
folderPath: effectiveFolder.folderPath ?? folderPath,
|
|
9919
10462
|
resourceType: "Buckets.getReadUri",
|
|
9920
10463
|
fallbackFolderKey: this.config.folderKey
|
|
9921
10464
|
});
|
|
@@ -9943,12 +10486,6 @@ class BucketService extends FolderScopedService {
|
|
|
9943
10486
|
});
|
|
9944
10487
|
}
|
|
9945
10488
|
async _getUri(endpoint, bucketId, path, headers, queryOptions = {}) {
|
|
9946
|
-
if (!bucketId) {
|
|
9947
|
-
throw new ValidationError({ message: "bucketId is required for getUri" });
|
|
9948
|
-
}
|
|
9949
|
-
if (!path) {
|
|
9950
|
-
throw new ValidationError({ message: "path is required for getUri" });
|
|
9951
|
-
}
|
|
9952
10489
|
const queryParams = filterUndefined({
|
|
9953
10490
|
path,
|
|
9954
10491
|
...queryOptions
|
|
@@ -9963,15 +10500,16 @@ class BucketService extends FolderScopedService {
|
|
|
9963
10500
|
}
|
|
9964
10501
|
return transformedData;
|
|
9965
10502
|
}
|
|
9966
|
-
async getFiles(
|
|
9967
|
-
if (!bucketId) {
|
|
9968
|
-
throw new ValidationError({ message: "bucketId is required for getFiles" });
|
|
9969
|
-
}
|
|
10503
|
+
async getFiles(bucketIdOrRef, options) {
|
|
9970
10504
|
const { folderId, folderKey, folderPath, ...restOptions } = options ?? {};
|
|
10505
|
+
const { id: bucketId, effectiveFolder } = await this.resolveBucketRef(bucketIdOrRef, { folderId, folderKey, folderPath }, "Buckets.getFiles");
|
|
10506
|
+
if (bucketId <= 0) {
|
|
10507
|
+
throw new ValidationError({ message: "Buckets.getFiles: bucketId must be a positive number." });
|
|
10508
|
+
}
|
|
9971
10509
|
const headers = resolveFolderHeaders({
|
|
9972
|
-
folderId,
|
|
9973
|
-
folderKey,
|
|
9974
|
-
folderPath,
|
|
10510
|
+
folderId: effectiveFolder.folderId ?? folderId,
|
|
10511
|
+
folderKey: effectiveFolder.folderKey ?? folderKey,
|
|
10512
|
+
folderPath: effectiveFolder.folderPath ?? folderPath,
|
|
9975
10513
|
resourceType: "Buckets.getFiles",
|
|
9976
10514
|
fallbackFolderKey: this.config.folderKey
|
|
9977
10515
|
});
|
|
@@ -9995,17 +10533,18 @@ class BucketService extends FolderScopedService {
|
|
|
9995
10533
|
headers
|
|
9996
10534
|
}, { ...apiRestOptions, directory: "/", recursive: true });
|
|
9997
10535
|
}
|
|
9998
|
-
async deleteFile(
|
|
9999
|
-
if (!bucketId) {
|
|
10000
|
-
throw new ValidationError({ message: "bucketId is required for deleteFile" });
|
|
10001
|
-
}
|
|
10536
|
+
async deleteFile(bucketIdOrRef, path, options) {
|
|
10002
10537
|
if (!path) {
|
|
10003
10538
|
throw new ValidationError({ message: "path is required for deleteFile" });
|
|
10004
10539
|
}
|
|
10540
|
+
const { id: bucketId, effectiveFolder } = await this.resolveBucketRef(bucketIdOrRef, { folderId: options?.folderId, folderKey: options?.folderKey, folderPath: options?.folderPath }, "Buckets.deleteFile");
|
|
10541
|
+
if (bucketId <= 0) {
|
|
10542
|
+
throw new ValidationError({ message: "Buckets.deleteFile: bucketId must be a positive number." });
|
|
10543
|
+
}
|
|
10005
10544
|
const headers = resolveFolderHeaders({
|
|
10006
|
-
folderId: options?.folderId,
|
|
10007
|
-
folderKey: options?.folderKey,
|
|
10008
|
-
folderPath: options?.folderPath,
|
|
10545
|
+
folderId: effectiveFolder.folderId ?? options?.folderId,
|
|
10546
|
+
folderKey: effectiveFolder.folderKey ?? options?.folderKey,
|
|
10547
|
+
folderPath: effectiveFolder.folderPath ?? options?.folderPath,
|
|
10009
10548
|
resourceType: "Buckets.deleteFile",
|
|
10010
10549
|
fallbackFolderKey: this.config.folderKey
|
|
10011
10550
|
});
|
|
@@ -10023,6 +10562,17 @@ class BucketService extends FolderScopedService {
|
|
|
10023
10562
|
};
|
|
10024
10563
|
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
10025
10564
|
}
|
|
10565
|
+
async resolveBucketRef(bucketIdOrRef, folderScope, callerLabel) {
|
|
10566
|
+
if (bucketIdOrRef == null || typeof bucketIdOrRef === "number") {
|
|
10567
|
+
return { id: bucketIdOrRef ?? 0, effectiveFolder: {} };
|
|
10568
|
+
}
|
|
10569
|
+
return resolveRefToId(bucketIdOrRef, {
|
|
10570
|
+
byName: async (name) => {
|
|
10571
|
+
const { result, effectiveFolder } = await this.getByNameLookup("Bucket", BUCKET_ENDPOINTS.GET_BY_FOLDER, name, folderScope, (raw) => pascalToCamelCaseKeys(raw), undefined, callerLabel);
|
|
10572
|
+
return { id: result.id, ...effectiveFolder };
|
|
10573
|
+
}
|
|
10574
|
+
}, callerLabel);
|
|
10575
|
+
}
|
|
10026
10576
|
}
|
|
10027
10577
|
__decorate([
|
|
10028
10578
|
track("Buckets.GetById")
|
|
@@ -10569,6 +11119,13 @@ var JobState;
|
|
|
10569
11119
|
JobState2["Cancelled"] = "Cancelled";
|
|
10570
11120
|
JobState2["Unknown"] = "Unknown";
|
|
10571
11121
|
})(JobState || (JobState = {}));
|
|
11122
|
+
var ConnectionState;
|
|
11123
|
+
(function(ConnectionState2) {
|
|
11124
|
+
ConnectionState2["Enabled"] = "Enabled";
|
|
11125
|
+
ConnectionState2["Disabled"] = "Disabled";
|
|
11126
|
+
ConnectionState2["Expired"] = "Expired";
|
|
11127
|
+
ConnectionState2["Failed"] = "Failed";
|
|
11128
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
10572
11129
|
var ProcessMap = {
|
|
10573
11130
|
lastModificationTime: "lastModifiedTime",
|
|
10574
11131
|
creationTime: "createdTime",
|
|
@@ -10604,14 +11161,34 @@ class ProcessService extends FolderScopedService {
|
|
|
10604
11161
|
}
|
|
10605
11162
|
}, apiOptions);
|
|
10606
11163
|
}
|
|
10607
|
-
async start(
|
|
11164
|
+
async start(firstArg, optionsOrFolderId, legacyOptions) {
|
|
11165
|
+
const looksLikeRef = isProcessRef(firstArg);
|
|
11166
|
+
const looksLikeLegacy = isLegacyStartRequest(firstArg);
|
|
11167
|
+
if (!looksLikeRef && !looksLikeLegacy) {
|
|
11168
|
+
throw new ValidationError({
|
|
11169
|
+
message: "Processes.start: first argument must be a ProcessRef (`{ name }` or `{ key }`) or a ProcessStartRequest (`{ processKey }` or `{ processName }`)."
|
|
11170
|
+
});
|
|
11171
|
+
}
|
|
10608
11172
|
let folderId;
|
|
10609
11173
|
let folderKey;
|
|
10610
11174
|
let folderPath;
|
|
10611
|
-
let queryOptions;
|
|
11175
|
+
let queryOptions = {};
|
|
11176
|
+
let startInfoExtras = {};
|
|
10612
11177
|
if (typeof optionsOrFolderId === "number") {
|
|
10613
11178
|
folderId = optionsOrFolderId;
|
|
10614
11179
|
queryOptions = legacyOptions ?? {};
|
|
11180
|
+
} else if (looksLikeRef) {
|
|
11181
|
+
const { folderId: fid, folderKey: fkey, folderPath: fpath, expand, select, filter, orderby, ...restStartInfo } = optionsOrFolderId ?? {};
|
|
11182
|
+
folderId = fid;
|
|
11183
|
+
folderKey = fkey;
|
|
11184
|
+
folderPath = fpath;
|
|
11185
|
+
queryOptions = {
|
|
11186
|
+
...expand !== undefined && { expand },
|
|
11187
|
+
...select !== undefined && { select },
|
|
11188
|
+
...filter !== undefined && { filter },
|
|
11189
|
+
...orderby !== undefined && { orderby }
|
|
11190
|
+
};
|
|
11191
|
+
startInfoExtras = restStartInfo;
|
|
10615
11192
|
} else {
|
|
10616
11193
|
const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
|
|
10617
11194
|
folderId = fid;
|
|
@@ -10619,17 +11196,20 @@ class ProcessService extends FolderScopedService {
|
|
|
10619
11196
|
folderPath = fpath;
|
|
10620
11197
|
queryOptions = rest;
|
|
10621
11198
|
}
|
|
11199
|
+
const identity = looksLikeRef ? resolveProcessRefIdentity(firstArg, folderPath) : resolveLegacyIdentity(firstArg, folderPath);
|
|
10622
11200
|
const headers = resolveFolderHeaders({
|
|
10623
11201
|
folderId,
|
|
10624
11202
|
folderKey,
|
|
10625
|
-
folderPath,
|
|
10626
|
-
resourceType: "
|
|
11203
|
+
folderPath: identity.folderPath ?? folderPath,
|
|
11204
|
+
resourceType: "Processes.start",
|
|
10627
11205
|
fallbackFolderKey: this.config.folderKey
|
|
10628
11206
|
});
|
|
10629
|
-
const
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
}
|
|
11207
|
+
const startInfoSdk = looksLikeRef ? { ...startInfoExtras, ...identity.identity } : { ...firstArg, ...identity.identity };
|
|
11208
|
+
if (!looksLikeRef && identity.dropProcessKey) {
|
|
11209
|
+
delete startInfoSdk.processKey;
|
|
11210
|
+
}
|
|
11211
|
+
const apiRequest = transformRequest(startInfoSdk, ProcessMap);
|
|
11212
|
+
const requestBody = { startInfo: apiRequest };
|
|
10633
11213
|
const apiFieldOptions = transformOptions(queryOptions, ProcessMap);
|
|
10634
11214
|
const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
|
|
10635
11215
|
const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
|
|
@@ -10647,8 +11227,7 @@ class ProcessService extends FolderScopedService {
|
|
|
10647
11227
|
headers,
|
|
10648
11228
|
params: apiOptions
|
|
10649
11229
|
});
|
|
10650
|
-
|
|
10651
|
-
return transformedProcess;
|
|
11230
|
+
return transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
10652
11231
|
}
|
|
10653
11232
|
async getByName(name, options = {}) {
|
|
10654
11233
|
const { result } = await this.getByNameLookup("Process", PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap), ProcessMap);
|
|
@@ -10667,6 +11246,64 @@ __decorate([
|
|
|
10667
11246
|
__decorate([
|
|
10668
11247
|
track("Processes.GetByName")
|
|
10669
11248
|
], ProcessService.prototype, "getByName", null);
|
|
11249
|
+
function isProcessRef(arg) {
|
|
11250
|
+
if (arg == null || typeof arg !== "object")
|
|
11251
|
+
return false;
|
|
11252
|
+
const obj = arg;
|
|
11253
|
+
if ("processKey" in obj || "processName" in obj)
|
|
11254
|
+
return false;
|
|
11255
|
+
return "name" in obj || "key" in obj;
|
|
11256
|
+
}
|
|
11257
|
+
function resolveProcessRefIdentity(processRef, folderPath) {
|
|
11258
|
+
const name = "name" in processRef ? processRef.name : undefined;
|
|
11259
|
+
const key = "key" in processRef ? processRef.key : undefined;
|
|
11260
|
+
if (name) {
|
|
11261
|
+
const override = resolveOverride("Process", name, folderPath);
|
|
11262
|
+
return {
|
|
11263
|
+
identity: { processName: override?.name ?? name },
|
|
11264
|
+
folderPath: override?.folderPath
|
|
11265
|
+
};
|
|
11266
|
+
}
|
|
11267
|
+
if (key) {
|
|
11268
|
+
return { identity: { processKey: key } };
|
|
11269
|
+
}
|
|
11270
|
+
throw new ValidationError({
|
|
11271
|
+
message: "Processes.start: processRef must supply a non-empty `name` or `key`."
|
|
11272
|
+
});
|
|
11273
|
+
}
|
|
11274
|
+
function isLegacyStartRequest(arg) {
|
|
11275
|
+
if (arg == null || typeof arg !== "object")
|
|
11276
|
+
return false;
|
|
11277
|
+
const obj = arg;
|
|
11278
|
+
return "processKey" in obj || "processName" in obj;
|
|
11279
|
+
}
|
|
11280
|
+
function resolveLegacyIdentity(request, folderPath) {
|
|
11281
|
+
if (request.processName) {
|
|
11282
|
+
const name = request.processName;
|
|
11283
|
+
const override = resolveOverride("Process", name, folderPath);
|
|
11284
|
+
if (override?.name) {
|
|
11285
|
+
return {
|
|
11286
|
+
identity: { processName: override.name },
|
|
11287
|
+
folderPath: override?.folderPath,
|
|
11288
|
+
dropProcessKey: true
|
|
11289
|
+
};
|
|
11290
|
+
}
|
|
11291
|
+
return { identity: {}, folderPath: override?.folderPath };
|
|
11292
|
+
}
|
|
11293
|
+
if (request.processKey) {
|
|
11294
|
+
const key = request.processKey;
|
|
11295
|
+
const override = resolveOverride("Process", key, folderPath);
|
|
11296
|
+
if (override?.name) {
|
|
11297
|
+
return {
|
|
11298
|
+
identity: { processName: override.name },
|
|
11299
|
+
folderPath: override?.folderPath,
|
|
11300
|
+
dropProcessKey: true
|
|
11301
|
+
};
|
|
11302
|
+
}
|
|
11303
|
+
return { identity: {}, folderPath: override?.folderPath };
|
|
11304
|
+
}
|
|
11305
|
+
return { identity: {} };
|
|
11306
|
+
}
|
|
10670
11307
|
var QueuePriority;
|
|
10671
11308
|
(function(QueuePriority2) {
|
|
10672
11309
|
QueuePriority2["High"] = "High";
|
|
@@ -11144,6 +11781,32 @@ var FunctionHttpMethod;
|
|
|
11144
11781
|
FunctionHttpMethod2["Patch"] = "Patch";
|
|
11145
11782
|
FunctionHttpMethod2["Delete"] = "Delete";
|
|
11146
11783
|
})(FunctionHttpMethod || (FunctionHttpMethod = {}));
|
|
11784
|
+
var FolderType;
|
|
11785
|
+
(function(FolderType2) {
|
|
11786
|
+
FolderType2["Standard"] = "Standard";
|
|
11787
|
+
FolderType2["Personal"] = "Personal";
|
|
11788
|
+
FolderType2["Virtual"] = "Virtual";
|
|
11789
|
+
FolderType2["Solution"] = "Solution";
|
|
11790
|
+
FolderType2["DebugSolution"] = "DebugSolution";
|
|
11791
|
+
})(FolderType || (FolderType = {}));
|
|
11792
|
+
var FolderProvisionType;
|
|
11793
|
+
(function(FolderProvisionType2) {
|
|
11794
|
+
FolderProvisionType2["Manual"] = "Manual";
|
|
11795
|
+
FolderProvisionType2["Automatic"] = "Automatic";
|
|
11796
|
+
})(FolderProvisionType || (FolderProvisionType = {}));
|
|
11797
|
+
var FolderPermissionModel;
|
|
11798
|
+
(function(FolderPermissionModel2) {
|
|
11799
|
+
FolderPermissionModel2["InheritFromTenant"] = "InheritFromTenant";
|
|
11800
|
+
FolderPermissionModel2["FineGrained"] = "FineGrained";
|
|
11801
|
+
})(FolderPermissionModel || (FolderPermissionModel = {}));
|
|
11802
|
+
var FolderFeedType;
|
|
11803
|
+
(function(FolderFeedType2) {
|
|
11804
|
+
FolderFeedType2["Undefined"] = "Undefined";
|
|
11805
|
+
FolderFeedType2["Processes"] = "Processes";
|
|
11806
|
+
FolderFeedType2["Libraries"] = "Libraries";
|
|
11807
|
+
FolderFeedType2["PersonalWorkspace"] = "PersonalWorkspace";
|
|
11808
|
+
FolderFeedType2["FolderHierarchy"] = "FolderHierarchy";
|
|
11809
|
+
})(FolderFeedType || (FolderFeedType = {}));
|
|
11147
11810
|
var CommonFieldMap = {
|
|
11148
11811
|
createdAt: "createdTime",
|
|
11149
11812
|
updatedAt: "updatedTime"
|
|
@@ -11197,13 +11860,6 @@ var AgentMap = {
|
|
|
11197
11860
|
var UserSettingsMap = {
|
|
11198
11861
|
...CommonFieldMap
|
|
11199
11862
|
};
|
|
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 = {}));
|
|
11207
11863
|
var FeedbackStatus;
|
|
11208
11864
|
(function(FeedbackStatus2) {
|
|
11209
11865
|
FeedbackStatus2[FeedbackStatus2["Pending"] = 0] = "Pending";
|
|
@@ -11492,6 +12148,109 @@ var PlatformSettingKey;
|
|
|
11492
12148
|
PlatformSettingKey2["UserCasePinnedInstancesByTenant"] = "UserCase.PinnedInstancesByTenant";
|
|
11493
12149
|
PlatformSettingKey2["UserCaseInstancesTableFiltersByTenant"] = "UserCase.InstancesTableFiltersByTenant";
|
|
11494
12150
|
})(PlatformSettingKey || (PlatformSettingKey = {}));
|
|
12151
|
+
var PlatformUserType;
|
|
12152
|
+
(function(PlatformUserType2) {
|
|
12153
|
+
PlatformUserType2["User"] = "user";
|
|
12154
|
+
PlatformUserType2["Robot"] = "robot";
|
|
12155
|
+
PlatformUserType2["DirectoryUser"] = "directoryUser";
|
|
12156
|
+
PlatformUserType2["DirectoryGroup"] = "directoryGroup";
|
|
12157
|
+
PlatformUserType2["RobotAccount"] = "robotAccount";
|
|
12158
|
+
PlatformUserType2["Application"] = "application";
|
|
12159
|
+
})(PlatformUserType || (PlatformUserType = {}));
|
|
12160
|
+
var PlatformUserCategory;
|
|
12161
|
+
(function(PlatformUserCategory2) {
|
|
12162
|
+
PlatformUserCategory2["Local"] = "local";
|
|
12163
|
+
PlatformUserCategory2["LinkedLocal"] = "linkedLocal";
|
|
12164
|
+
PlatformUserCategory2["Directory"] = "directory";
|
|
12165
|
+
})(PlatformUserCategory || (PlatformUserCategory = {}));
|
|
12166
|
+
var PlatformUserSortField;
|
|
12167
|
+
(function(PlatformUserSortField2) {
|
|
12168
|
+
PlatformUserSortField2["Id"] = "Id";
|
|
12169
|
+
PlatformUserSortField2["UserName"] = "UserName";
|
|
12170
|
+
PlatformUserSortField2["Email"] = "Email";
|
|
12171
|
+
PlatformUserSortField2["EmailConfirmed"] = "EmailConfirmed";
|
|
12172
|
+
PlatformUserSortField2["Name"] = "Name";
|
|
12173
|
+
PlatformUserSortField2["Surname"] = "Surname";
|
|
12174
|
+
PlatformUserSortField2["DisplayName"] = "DisplayName";
|
|
12175
|
+
PlatformUserSortField2["CreatedTime"] = "CreationTime";
|
|
12176
|
+
PlatformUserSortField2["LastModifiedTime"] = "LastModificationTime";
|
|
12177
|
+
PlatformUserSortField2["LastLoginTime"] = "LastLoginTime";
|
|
12178
|
+
PlatformUserSortField2["IsActive"] = "IsActive";
|
|
12179
|
+
PlatformUserSortField2["Type"] = "Type";
|
|
12180
|
+
PlatformUserSortField2["Category"] = "Category";
|
|
12181
|
+
PlatformUserSortField2["InvitationAccepted"] = "InvitationAccepted";
|
|
12182
|
+
})(PlatformUserSortField || (PlatformUserSortField = {}));
|
|
12183
|
+
var PlatformUserSortOrder;
|
|
12184
|
+
(function(PlatformUserSortOrder2) {
|
|
12185
|
+
PlatformUserSortOrder2["Ascending"] = "asc";
|
|
12186
|
+
PlatformUserSortOrder2["Descending"] = "desc";
|
|
12187
|
+
})(PlatformUserSortOrder || (PlatformUserSortOrder = {}));
|
|
12188
|
+
var PlatformRoleType;
|
|
12189
|
+
(function(PlatformRoleType2) {
|
|
12190
|
+
PlatformRoleType2["BuiltIn"] = "BUILTIN";
|
|
12191
|
+
PlatformRoleType2["Platform"] = "PLATFORM";
|
|
12192
|
+
PlatformRoleType2["Custom"] = "CUSTOM";
|
|
12193
|
+
})(PlatformRoleType || (PlatformRoleType = {}));
|
|
12194
|
+
var PlatformRoleScopeType;
|
|
12195
|
+
(function(PlatformRoleScopeType2) {
|
|
12196
|
+
PlatformRoleScopeType2["Organization"] = "ORGANIZATION";
|
|
12197
|
+
PlatformRoleScopeType2["Tenant"] = "TENANT";
|
|
12198
|
+
PlatformRoleScopeType2["Project"] = "PROJECT";
|
|
12199
|
+
PlatformRoleScopeType2["Process"] = "PROCESS";
|
|
12200
|
+
PlatformRoleScopeType2["App"] = "APP";
|
|
12201
|
+
PlatformRoleScopeType2["Mixed"] = "MIXED";
|
|
12202
|
+
})(PlatformRoleScopeType || (PlatformRoleScopeType = {}));
|
|
12203
|
+
var PlatformActionScopeType;
|
|
12204
|
+
(function(PlatformActionScopeType2) {
|
|
12205
|
+
PlatformActionScopeType2["Any"] = "ANY";
|
|
12206
|
+
PlatformActionScopeType2["None"] = "NONE";
|
|
12207
|
+
PlatformActionScopeType2["Organization"] = "ORGANIZATION";
|
|
12208
|
+
PlatformActionScopeType2["Tenant"] = "TENANT";
|
|
12209
|
+
PlatformActionScopeType2["Folder"] = "FOLDER";
|
|
12210
|
+
PlatformActionScopeType2["Project"] = "PROJECT";
|
|
12211
|
+
PlatformActionScopeType2["Process"] = "PROCESS";
|
|
12212
|
+
})(PlatformActionScopeType || (PlatformActionScopeType = {}));
|
|
12213
|
+
var PlatformPrincipalType;
|
|
12214
|
+
(function(PlatformPrincipalType2) {
|
|
12215
|
+
PlatformPrincipalType2["User"] = "User";
|
|
12216
|
+
PlatformPrincipalType2["Group"] = "Group";
|
|
12217
|
+
PlatformPrincipalType2["ExternalApplication"] = "ExternalApplication";
|
|
12218
|
+
PlatformPrincipalType2["Robot"] = "Robot";
|
|
12219
|
+
})(PlatformPrincipalType || (PlatformPrincipalType = {}));
|
|
12220
|
+
var PlatformRoleSortField;
|
|
12221
|
+
(function(PlatformRoleSortField2) {
|
|
12222
|
+
PlatformRoleSortField2["Id"] = "Id";
|
|
12223
|
+
PlatformRoleSortField2["Name"] = "OriginalRoleName";
|
|
12224
|
+
PlatformRoleSortField2["UniqueName"] = "UniqueName";
|
|
12225
|
+
PlatformRoleSortField2["Description"] = "Description";
|
|
12226
|
+
PlatformRoleSortField2["Type"] = "Type";
|
|
12227
|
+
PlatformRoleSortField2["ScopeType"] = "ScopeType";
|
|
12228
|
+
PlatformRoleSortField2["OrganizationId"] = "OrganizationId";
|
|
12229
|
+
PlatformRoleSortField2["TenantId"] = "TenantId";
|
|
12230
|
+
PlatformRoleSortField2["OwnerService"] = "OwnerService";
|
|
12231
|
+
PlatformRoleSortField2["OwnerServiceId"] = "OwnerServiceId";
|
|
12232
|
+
PlatformRoleSortField2["CreatedBy"] = "CreatedBy";
|
|
12233
|
+
PlatformRoleSortField2["CreatedTime"] = "CreatedOn";
|
|
12234
|
+
PlatformRoleSortField2["UpdatedBy"] = "UpdatedBy";
|
|
12235
|
+
PlatformRoleSortField2["UpdatedTime"] = "UpdatedOn";
|
|
12236
|
+
})(PlatformRoleSortField || (PlatformRoleSortField = {}));
|
|
12237
|
+
var PlatformRoleSortOrder;
|
|
12238
|
+
(function(PlatformRoleSortOrder2) {
|
|
12239
|
+
PlatformRoleSortOrder2["Ascending"] = "Asc";
|
|
12240
|
+
PlatformRoleSortOrder2["Descending"] = "Desc";
|
|
12241
|
+
})(PlatformRoleSortOrder || (PlatformRoleSortOrder = {}));
|
|
12242
|
+
var PlatformGroupType;
|
|
12243
|
+
(function(PlatformGroupType2) {
|
|
12244
|
+
PlatformGroupType2["BuiltIn"] = "builtIn";
|
|
12245
|
+
PlatformGroupType2["Custom"] = "custom";
|
|
12246
|
+
})(PlatformGroupType || (PlatformGroupType = {}));
|
|
12247
|
+
var LifeCycleStage;
|
|
12248
|
+
(function(LifeCycleStage2) {
|
|
12249
|
+
LifeCycleStage2["PREVIEW"] = "PREVIEW";
|
|
12250
|
+
LifeCycleStage2["GA"] = "GA";
|
|
12251
|
+
LifeCycleStage2["DEPRECATED"] = "DEPRECATED";
|
|
12252
|
+
LifeCycleStage2["CUSTOM"] = "CUSTOM";
|
|
12253
|
+
})(LifeCycleStage || (LifeCycleStage = {}));
|
|
11495
12254
|
var SpanStatus;
|
|
11496
12255
|
(function(SpanStatus2) {
|
|
11497
12256
|
SpanStatus2["Unset"] = "Unset";
|
|
@@ -11574,6 +12333,7 @@ var AgentGovernanceSection;
|
|
|
11574
12333
|
AgentGovernanceSection2["Action"] = "action";
|
|
11575
12334
|
AgentGovernanceSection2["Mode"] = "mode";
|
|
11576
12335
|
})(AgentGovernanceSection || (AgentGovernanceSection = {}));
|
|
12336
|
+
var HOST_KEY = Symbol.for("uipath.host.v1");
|
|
11577
12337
|
|
|
11578
12338
|
// src/api/create-sdk.ts
|
|
11579
12339
|
var createSdk = async () => {
|
|
@@ -11626,7 +12386,7 @@ var registerAgentsCommand = (program) => {
|
|
|
11626
12386
|
processContext.exit(1);
|
|
11627
12387
|
return;
|
|
11628
12388
|
}
|
|
11629
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12389
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
11630
12390
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11631
12391
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11632
12392
|
});
|
|
@@ -11657,7 +12417,7 @@ var registerAgentsCommand = (program) => {
|
|
|
11657
12417
|
processContext.exit(1);
|
|
11658
12418
|
return;
|
|
11659
12419
|
}
|
|
11660
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12420
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
11661
12421
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11662
12422
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11663
12423
|
});
|
|
@@ -11862,7 +12622,7 @@ var registerChatCommand = (program) => {
|
|
|
11862
12622
|
processContext.exit(1);
|
|
11863
12623
|
return;
|
|
11864
12624
|
}
|
|
11865
|
-
const { ConversationalAgentService, MessageRole: MessageRole2 } = await import("./index-
|
|
12625
|
+
const { ConversationalAgentService, MessageRole: MessageRole2 } = await import("./index-nr509xjn.js");
|
|
11866
12626
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11867
12627
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11868
12628
|
});
|
|
@@ -11933,7 +12693,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11933
12693
|
processContext.exit(1);
|
|
11934
12694
|
return;
|
|
11935
12695
|
}
|
|
11936
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12696
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
11937
12697
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11938
12698
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11939
12699
|
});
|
|
@@ -11984,7 +12744,7 @@ var registerConversationsCommand = (program) => {
|
|
|
11984
12744
|
processContext.exit(1);
|
|
11985
12745
|
return;
|
|
11986
12746
|
}
|
|
11987
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12747
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
11988
12748
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
11989
12749
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
11990
12750
|
});
|
|
@@ -12018,7 +12778,7 @@ var registerConversationsCommand = (program) => {
|
|
|
12018
12778
|
processContext.exit(1);
|
|
12019
12779
|
return;
|
|
12020
12780
|
}
|
|
12021
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12781
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
12022
12782
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
12023
12783
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12024
12784
|
});
|
|
@@ -12076,7 +12836,7 @@ var registerConversationsCommand = (program) => {
|
|
|
12076
12836
|
processContext.exit(1);
|
|
12077
12837
|
return;
|
|
12078
12838
|
}
|
|
12079
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12839
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
12080
12840
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
12081
12841
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12082
12842
|
});
|
|
@@ -12109,7 +12869,7 @@ var registerConversationsCommand = (program) => {
|
|
|
12109
12869
|
processContext.exit(1);
|
|
12110
12870
|
return;
|
|
12111
12871
|
}
|
|
12112
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12872
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
12113
12873
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
12114
12874
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12115
12875
|
});
|
|
@@ -12142,7 +12902,7 @@ var registerConversationsCommand = (program) => {
|
|
|
12142
12902
|
processContext.exit(1);
|
|
12143
12903
|
return;
|
|
12144
12904
|
}
|
|
12145
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12905
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
12146
12906
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
12147
12907
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12148
12908
|
});
|
|
@@ -12185,7 +12945,7 @@ var registerConversationsCommand = (program) => {
|
|
|
12185
12945
|
processContext.exit(1);
|
|
12186
12946
|
return;
|
|
12187
12947
|
}
|
|
12188
|
-
const { ConversationalAgentService } = await import("./index-
|
|
12948
|
+
const { ConversationalAgentService } = await import("./index-nr509xjn.js");
|
|
12189
12949
|
const conversationalService = new ConversationalAgentService(sdk, {
|
|
12190
12950
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12191
12951
|
});
|
|
@@ -12230,7 +12990,7 @@ var registerExchangesCommand = (program) => {
|
|
|
12230
12990
|
processContext.exit(1);
|
|
12231
12991
|
return;
|
|
12232
12992
|
}
|
|
12233
|
-
const { ExchangeService } = await import("./index-
|
|
12993
|
+
const { ExchangeService } = await import("./index-nr509xjn.js");
|
|
12234
12994
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
12235
12995
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12236
12996
|
});
|
|
@@ -12264,7 +13024,7 @@ var registerExchangesCommand = (program) => {
|
|
|
12264
13024
|
processContext.exit(1);
|
|
12265
13025
|
return;
|
|
12266
13026
|
}
|
|
12267
|
-
const { ExchangeService } = await import("./index-
|
|
13027
|
+
const { ExchangeService } = await import("./index-nr509xjn.js");
|
|
12268
13028
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
12269
13029
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12270
13030
|
});
|
|
@@ -12304,7 +13064,7 @@ var registerExchangesCommand = (program) => {
|
|
|
12304
13064
|
processContext.exit(1);
|
|
12305
13065
|
return;
|
|
12306
13066
|
}
|
|
12307
|
-
const { ExchangeService, FeedbackRating: FeedbackRating2 } = await import("./index-
|
|
13067
|
+
const { ExchangeService, FeedbackRating: FeedbackRating2 } = await import("./index-nr509xjn.js");
|
|
12308
13068
|
const exchangeSvc = new ExchangeService(sdk, {
|
|
12309
13069
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12310
13070
|
});
|
|
@@ -12343,7 +13103,7 @@ var registerMessagesCommand = (program) => {
|
|
|
12343
13103
|
processContext.exit(1);
|
|
12344
13104
|
return;
|
|
12345
13105
|
}
|
|
12346
|
-
const { MessageService } = await import("./index-
|
|
13106
|
+
const { MessageService } = await import("./index-nr509xjn.js");
|
|
12347
13107
|
const msgSvc = new MessageService(sdk, {
|
|
12348
13108
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12349
13109
|
});
|
|
@@ -12374,7 +13134,7 @@ var registerMessagesCommand = (program) => {
|
|
|
12374
13134
|
processContext.exit(1);
|
|
12375
13135
|
return;
|
|
12376
13136
|
}
|
|
12377
|
-
const { MessageService } = await import("./index-
|
|
13137
|
+
const { MessageService } = await import("./index-nr509xjn.js");
|
|
12378
13138
|
const msgSvc = new MessageService(sdk, {
|
|
12379
13139
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12380
13140
|
});
|
|
@@ -12481,7 +13241,7 @@ var resolveEntryPoint = (entryPoints, requested) => {
|
|
|
12481
13241
|
var resolveBinding = async (target) => {
|
|
12482
13242
|
const processKey = target.processKey.toLowerCase();
|
|
12483
13243
|
const folderKey = target.folderKey.toLowerCase();
|
|
12484
|
-
const { listVoiceEntryPoints } = await import("./cas-client-
|
|
13244
|
+
const { listVoiceEntryPoints } = await import("./cas-client-x6tjfhak.js");
|
|
12485
13245
|
const [epError, entryPoints] = await catchError(listVoiceEntryPoints(processKey, folderKey));
|
|
12486
13246
|
if (epError) {
|
|
12487
13247
|
await failFromError(epError);
|
|
@@ -12497,7 +13257,7 @@ var resolveBinding = async (target) => {
|
|
|
12497
13257
|
var registerTrunksCommand = (program) => {
|
|
12498
13258
|
const trunks = program.command("trunks").description("Inspect the SIP trunks (phone numbers) configured for conversational voice.");
|
|
12499
13259
|
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) => {
|
|
12500
|
-
const { listSipTrunks } = await import("./cas-client-
|
|
13260
|
+
const { listSipTrunks } = await import("./cas-client-x6tjfhak.js");
|
|
12501
13261
|
const [listError, trunks2] = await catchError(listSipTrunks(options.direction));
|
|
12502
13262
|
if (listError) {
|
|
12503
13263
|
await failFromError(listError);
|
|
@@ -12513,7 +13273,7 @@ var registerTrunksCommand = (program) => {
|
|
|
12513
13273
|
const plan = planAssign(options);
|
|
12514
13274
|
if (plan === null)
|
|
12515
13275
|
return;
|
|
12516
|
-
const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-
|
|
13276
|
+
const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-x6tjfhak.js");
|
|
12517
13277
|
const [trunkError, trunk] = await catchError(resolveSipTrunk(trunkArg));
|
|
12518
13278
|
if (trunkError) {
|
|
12519
13279
|
await failFromError(trunkError);
|
|
@@ -12555,7 +13315,7 @@ var registerUserSettingsCommand = (program) => {
|
|
|
12555
13315
|
processContext.exit(1);
|
|
12556
13316
|
return;
|
|
12557
13317
|
}
|
|
12558
|
-
const { UserSettingsService } = await import("./index-
|
|
13318
|
+
const { UserSettingsService } = await import("./index-nr509xjn.js");
|
|
12559
13319
|
const userSvc = new UserSettingsService(sdk, {
|
|
12560
13320
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12561
13321
|
});
|
|
@@ -12610,7 +13370,7 @@ var registerUserSettingsCommand = (program) => {
|
|
|
12610
13370
|
processContext.exit(1);
|
|
12611
13371
|
return;
|
|
12612
13372
|
}
|
|
12613
|
-
const { UserSettingsService } = await import("./index-
|
|
13373
|
+
const { UserSettingsService } = await import("./index-nr509xjn.js");
|
|
12614
13374
|
const userSvc = new UserSettingsService(sdk, {
|
|
12615
13375
|
externalUserId: CLI_EXTERNAL_USER_ID
|
|
12616
13376
|
});
|
|
@@ -12651,4 +13411,4 @@ var registerCommands = async (program) => {
|
|
|
12651
13411
|
|
|
12652
13412
|
export { metadata, registerCommands };
|
|
12653
13413
|
|
|
12654
|
-
//# debugId=
|
|
13414
|
+
//# debugId=78E25FEAD0F5359364756E2164756E21
|