@uipath/uipath-typescript 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +2 -0
- package/dist/assets/index.cjs +199 -221
- package/dist/assets/index.mjs +199 -221
- package/dist/buckets/index.cjs +199 -221
- package/dist/buckets/index.mjs +199 -221
- package/dist/cases/index.cjs +220 -238
- package/dist/cases/index.mjs +220 -238
- package/dist/conversational-agent/index.cjs +6622 -0
- package/dist/conversational-agent/index.d.ts +6579 -0
- package/dist/conversational-agent/index.mjs +6575 -0
- package/dist/core/index.cjs +1196 -1158
- package/dist/core/index.d.ts +2 -10
- package/dist/core/index.mjs +1196 -1158
- package/dist/entities/index.cjs +199 -221
- package/dist/entities/index.mjs +199 -221
- package/dist/index.cjs +744 -418
- package/dist/index.d.ts +4342 -13
- package/dist/index.mjs +738 -419
- package/dist/index.umd.js +744 -418
- package/dist/maestro-processes/index.cjs +199 -221
- package/dist/maestro-processes/index.mjs +199 -221
- package/dist/processes/index.cjs +246 -232
- package/dist/processes/index.d.ts +1 -1
- package/dist/processes/index.mjs +246 -232
- package/dist/queues/index.cjs +199 -221
- package/dist/queues/index.mjs +199 -221
- package/dist/tasks/index.cjs +199 -221
- package/dist/tasks/index.mjs +199 -221
- package/package.json +22 -4
package/dist/index.umd.js
CHANGED
|
@@ -3897,6 +3897,303 @@
|
|
|
3897
3897
|
return Boolean(config.secret);
|
|
3898
3898
|
}
|
|
3899
3899
|
|
|
3900
|
+
/**
|
|
3901
|
+
* Base error class for all UiPath SDK errors
|
|
3902
|
+
* Extends Error for standard error handling compatibility
|
|
3903
|
+
*/
|
|
3904
|
+
class UiPathError extends Error {
|
|
3905
|
+
constructor(type, params) {
|
|
3906
|
+
super(params.message);
|
|
3907
|
+
this.name = type;
|
|
3908
|
+
this.type = type;
|
|
3909
|
+
this.statusCode = params.statusCode;
|
|
3910
|
+
this.requestId = params.requestId;
|
|
3911
|
+
this.timestamp = new Date();
|
|
3912
|
+
// Maintains proper stack trace for where our error was thrown
|
|
3913
|
+
if (Error.captureStackTrace) {
|
|
3914
|
+
Error.captureStackTrace(this, this.constructor);
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Returns a clean JSON representation of the error
|
|
3919
|
+
*/
|
|
3920
|
+
toJSON() {
|
|
3921
|
+
return {
|
|
3922
|
+
type: this.type,
|
|
3923
|
+
message: this.message,
|
|
3924
|
+
statusCode: this.statusCode,
|
|
3925
|
+
requestId: this.requestId,
|
|
3926
|
+
timestamp: this.timestamp
|
|
3927
|
+
};
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* Returns detailed debug information including stack trace
|
|
3931
|
+
*/
|
|
3932
|
+
getDebugInfo() {
|
|
3933
|
+
return {
|
|
3934
|
+
...this.toJSON(),
|
|
3935
|
+
stack: this.stack
|
|
3936
|
+
};
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
/**
|
|
3941
|
+
* HTTP status code constants for error handling
|
|
3942
|
+
*/
|
|
3943
|
+
const HttpStatus = {
|
|
3944
|
+
// Client errors (4xx)
|
|
3945
|
+
BAD_REQUEST: 400,
|
|
3946
|
+
UNAUTHORIZED: 401,
|
|
3947
|
+
FORBIDDEN: 403,
|
|
3948
|
+
NOT_FOUND: 404,
|
|
3949
|
+
TOO_MANY_REQUESTS: 429,
|
|
3950
|
+
// Server errors (5xx)
|
|
3951
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
3952
|
+
NOT_IMPLEMENTED: 501,
|
|
3953
|
+
BAD_GATEWAY: 502,
|
|
3954
|
+
SERVICE_UNAVAILABLE: 503,
|
|
3955
|
+
GATEWAY_TIMEOUT: 504
|
|
3956
|
+
};
|
|
3957
|
+
/**
|
|
3958
|
+
* Error type constants for consistent error identification
|
|
3959
|
+
*/
|
|
3960
|
+
const ErrorType = {
|
|
3961
|
+
AUTHENTICATION: 'AuthenticationError',
|
|
3962
|
+
AUTHORIZATION: 'AuthorizationError',
|
|
3963
|
+
VALIDATION: 'ValidationError',
|
|
3964
|
+
NOT_FOUND: 'NotFoundError',
|
|
3965
|
+
RATE_LIMIT: 'RateLimitError',
|
|
3966
|
+
SERVER: 'ServerError',
|
|
3967
|
+
NETWORK: 'NetworkError'
|
|
3968
|
+
};
|
|
3969
|
+
/**
|
|
3970
|
+
* HTTP header constants for error handling
|
|
3971
|
+
*/
|
|
3972
|
+
const HttpHeaders = {
|
|
3973
|
+
X_REQUEST_ID: 'x-request-id'
|
|
3974
|
+
};
|
|
3975
|
+
/**
|
|
3976
|
+
* Standard error message constants
|
|
3977
|
+
*/
|
|
3978
|
+
const ErrorMessages = {
|
|
3979
|
+
// Authentication errors
|
|
3980
|
+
AUTHENTICATION_FAILED: 'Authentication failed',
|
|
3981
|
+
// Authorization errors
|
|
3982
|
+
ACCESS_DENIED: 'Access denied',
|
|
3983
|
+
// Validation errors
|
|
3984
|
+
VALIDATION_FAILED: 'Validation failed',
|
|
3985
|
+
// Not found errors
|
|
3986
|
+
RESOURCE_NOT_FOUND: 'Resource not found',
|
|
3987
|
+
// Rate limit errors
|
|
3988
|
+
RATE_LIMIT_EXCEEDED: 'Rate limit exceeded',
|
|
3989
|
+
// Server errors
|
|
3990
|
+
INTERNAL_SERVER_ERROR: 'Internal Server error occurred',
|
|
3991
|
+
// Network errors
|
|
3992
|
+
NETWORK_ERROR: 'Network error occurred',
|
|
3993
|
+
REQUEST_TIMEOUT: 'Request timed out',
|
|
3994
|
+
REQUEST_ABORTED: 'Request was aborted',
|
|
3995
|
+
};
|
|
3996
|
+
/**
|
|
3997
|
+
* Error name constants for network error identification
|
|
3998
|
+
*/
|
|
3999
|
+
const ErrorNames = {
|
|
4000
|
+
ABORT_ERROR: 'AbortError'};
|
|
4001
|
+
|
|
4002
|
+
/**
|
|
4003
|
+
* Error thrown when authentication fails (401 errors)
|
|
4004
|
+
* Common scenarios:
|
|
4005
|
+
* - Invalid credentials
|
|
4006
|
+
* - Expired token
|
|
4007
|
+
* - Missing authentication
|
|
4008
|
+
*/
|
|
4009
|
+
class AuthenticationError extends UiPathError {
|
|
4010
|
+
constructor(params = {}) {
|
|
4011
|
+
super(ErrorType.AUTHENTICATION, {
|
|
4012
|
+
message: params.message || ErrorMessages.AUTHENTICATION_FAILED,
|
|
4013
|
+
statusCode: params.statusCode ?? HttpStatus.UNAUTHORIZED,
|
|
4014
|
+
requestId: params.requestId
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
|
|
4019
|
+
/**
|
|
4020
|
+
* Error thrown when authorization fails (403 errors)
|
|
4021
|
+
* Common scenarios:
|
|
4022
|
+
* - Insufficient permissions
|
|
4023
|
+
* - Access denied to resource
|
|
4024
|
+
* - Invalid scope
|
|
4025
|
+
*/
|
|
4026
|
+
class AuthorizationError extends UiPathError {
|
|
4027
|
+
constructor(params = {}) {
|
|
4028
|
+
super(ErrorType.AUTHORIZATION, {
|
|
4029
|
+
message: params.message || ErrorMessages.ACCESS_DENIED,
|
|
4030
|
+
statusCode: params.statusCode ?? HttpStatus.FORBIDDEN,
|
|
4031
|
+
requestId: params.requestId
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
/**
|
|
4037
|
+
* Error thrown when validation fails (400 errors or client-side validation)
|
|
4038
|
+
* Common scenarios:
|
|
4039
|
+
* - Invalid input parameters
|
|
4040
|
+
* - Missing required fields
|
|
4041
|
+
* - Invalid data format
|
|
4042
|
+
*/
|
|
4043
|
+
class ValidationError extends UiPathError {
|
|
4044
|
+
constructor(params = {}) {
|
|
4045
|
+
super(ErrorType.VALIDATION, {
|
|
4046
|
+
message: params.message || ErrorMessages.VALIDATION_FAILED,
|
|
4047
|
+
statusCode: params.statusCode ?? HttpStatus.BAD_REQUEST,
|
|
4048
|
+
requestId: params.requestId
|
|
4049
|
+
});
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
/**
|
|
4054
|
+
* Error thrown when a resource is not found (404 errors)
|
|
4055
|
+
* Common scenarios:
|
|
4056
|
+
* - Resource doesn't exist
|
|
4057
|
+
* - Invalid ID provided
|
|
4058
|
+
* - Resource deleted
|
|
4059
|
+
*/
|
|
4060
|
+
class NotFoundError extends UiPathError {
|
|
4061
|
+
constructor(params = {}) {
|
|
4062
|
+
super(ErrorType.NOT_FOUND, {
|
|
4063
|
+
message: params.message || ErrorMessages.RESOURCE_NOT_FOUND,
|
|
4064
|
+
statusCode: params.statusCode ?? HttpStatus.NOT_FOUND,
|
|
4065
|
+
requestId: params.requestId
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
/**
|
|
4071
|
+
* Error thrown when rate limit is exceeded (429 errors)
|
|
4072
|
+
* Common scenarios:
|
|
4073
|
+
* - Too many requests in a time window
|
|
4074
|
+
* - API throttling
|
|
4075
|
+
*/
|
|
4076
|
+
class RateLimitError extends UiPathError {
|
|
4077
|
+
constructor(params = {}) {
|
|
4078
|
+
super(ErrorType.RATE_LIMIT, {
|
|
4079
|
+
message: params.message || ErrorMessages.RATE_LIMIT_EXCEEDED,
|
|
4080
|
+
statusCode: params.statusCode ?? HttpStatus.TOO_MANY_REQUESTS,
|
|
4081
|
+
requestId: params.requestId
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
/**
|
|
4087
|
+
* Error thrown when server encounters an error (5xx errors)
|
|
4088
|
+
* Common scenarios:
|
|
4089
|
+
* - Internal server error
|
|
4090
|
+
* - Service unavailable
|
|
4091
|
+
* - Gateway timeout
|
|
4092
|
+
*/
|
|
4093
|
+
class ServerError extends UiPathError {
|
|
4094
|
+
constructor(params = {}) {
|
|
4095
|
+
super(ErrorType.SERVER, {
|
|
4096
|
+
message: params.message || ErrorMessages.INTERNAL_SERVER_ERROR,
|
|
4097
|
+
statusCode: params.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR,
|
|
4098
|
+
requestId: params.requestId
|
|
4099
|
+
});
|
|
4100
|
+
}
|
|
4101
|
+
/**
|
|
4102
|
+
* Checks if this is a temporary error that might succeed on retry
|
|
4103
|
+
*/
|
|
4104
|
+
get isRetryable() {
|
|
4105
|
+
return this.statusCode === HttpStatus.BAD_GATEWAY ||
|
|
4106
|
+
this.statusCode === HttpStatus.SERVICE_UNAVAILABLE ||
|
|
4107
|
+
this.statusCode === HttpStatus.GATEWAY_TIMEOUT;
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
/**
|
|
4112
|
+
* Error thrown when network/connection issues occur
|
|
4113
|
+
* Common scenarios:
|
|
4114
|
+
* - Connection timeout
|
|
4115
|
+
* - DNS resolution failure
|
|
4116
|
+
* - Network unreachable
|
|
4117
|
+
* - Request aborted
|
|
4118
|
+
*/
|
|
4119
|
+
class NetworkError extends UiPathError {
|
|
4120
|
+
constructor(params = {}) {
|
|
4121
|
+
super(ErrorType.NETWORK, {
|
|
4122
|
+
message: params.message || ErrorMessages.NETWORK_ERROR,
|
|
4123
|
+
statusCode: params.statusCode, // Network errors typically don't have HTTP status codes
|
|
4124
|
+
requestId: params.requestId
|
|
4125
|
+
});
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
/**
|
|
4130
|
+
* Type guard to check if an error is a UiPathError
|
|
4131
|
+
*/
|
|
4132
|
+
function isUiPathError(error) {
|
|
4133
|
+
return error instanceof UiPathError;
|
|
4134
|
+
}
|
|
4135
|
+
/**
|
|
4136
|
+
* Type guard to check if an error is an AuthenticationError
|
|
4137
|
+
*/
|
|
4138
|
+
function isAuthenticationError(error) {
|
|
4139
|
+
return error instanceof AuthenticationError;
|
|
4140
|
+
}
|
|
4141
|
+
/**
|
|
4142
|
+
* Type guard to check if an error is an AuthorizationError
|
|
4143
|
+
*/
|
|
4144
|
+
function isAuthorizationError(error) {
|
|
4145
|
+
return error instanceof AuthorizationError;
|
|
4146
|
+
}
|
|
4147
|
+
/**
|
|
4148
|
+
* Type guard to check if an error is a ValidationError
|
|
4149
|
+
*/
|
|
4150
|
+
function isValidationError(error) {
|
|
4151
|
+
return error instanceof ValidationError;
|
|
4152
|
+
}
|
|
4153
|
+
/**
|
|
4154
|
+
* Type guard to check if an error is a NotFoundError
|
|
4155
|
+
*/
|
|
4156
|
+
function isNotFoundError(error) {
|
|
4157
|
+
return error instanceof NotFoundError;
|
|
4158
|
+
}
|
|
4159
|
+
/**
|
|
4160
|
+
* Type guard to check if an error is a RateLimitError
|
|
4161
|
+
*/
|
|
4162
|
+
function isRateLimitError(error) {
|
|
4163
|
+
return error instanceof RateLimitError;
|
|
4164
|
+
}
|
|
4165
|
+
/**
|
|
4166
|
+
* Type guard to check if an error is a ServerError
|
|
4167
|
+
*/
|
|
4168
|
+
function isServerError(error) {
|
|
4169
|
+
return error instanceof ServerError;
|
|
4170
|
+
}
|
|
4171
|
+
/**
|
|
4172
|
+
* Type guard to check if an error is a NetworkError
|
|
4173
|
+
*/
|
|
4174
|
+
function isNetworkError(error) {
|
|
4175
|
+
return error instanceof NetworkError;
|
|
4176
|
+
}
|
|
4177
|
+
/**
|
|
4178
|
+
* Helper to get error details in a safe way
|
|
4179
|
+
*/
|
|
4180
|
+
function getErrorDetails(error) {
|
|
4181
|
+
if (isUiPathError(error)) {
|
|
4182
|
+
return {
|
|
4183
|
+
message: error.message,
|
|
4184
|
+
statusCode: error.statusCode
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
if (error instanceof Error) {
|
|
4188
|
+
return {
|
|
4189
|
+
message: error.message
|
|
4190
|
+
};
|
|
4191
|
+
}
|
|
4192
|
+
return {
|
|
4193
|
+
message: String(error)
|
|
4194
|
+
};
|
|
4195
|
+
}
|
|
4196
|
+
|
|
3900
4197
|
/**
|
|
3901
4198
|
* TokenManager is responsible for managing authentication tokens.
|
|
3902
4199
|
* It provides token operations for a specific client ID.
|
|
@@ -3929,6 +4226,41 @@
|
|
|
3929
4226
|
}
|
|
3930
4227
|
return new Date() >= tokenInfo.expiresAt;
|
|
3931
4228
|
}
|
|
4229
|
+
/**
|
|
4230
|
+
* Gets a valid authentication token, refreshing if necessary.
|
|
4231
|
+
* This is the single source of truth for token validation and refresh logic.
|
|
4232
|
+
*
|
|
4233
|
+
* @returns The valid token string
|
|
4234
|
+
* @throws AuthenticationError if no token available or refresh fails
|
|
4235
|
+
*/
|
|
4236
|
+
async getValidToken() {
|
|
4237
|
+
const tokenInfo = this.executionContext.get('tokenInfo');
|
|
4238
|
+
if (!tokenInfo) {
|
|
4239
|
+
throw new AuthenticationError({
|
|
4240
|
+
message: 'No authentication token available. Make sure to initialize the SDK first.'
|
|
4241
|
+
});
|
|
4242
|
+
}
|
|
4243
|
+
// For secret-based tokens, they never expire
|
|
4244
|
+
if (tokenInfo.type === 'secret') {
|
|
4245
|
+
return tokenInfo.token;
|
|
4246
|
+
}
|
|
4247
|
+
// If token is not expired, return it
|
|
4248
|
+
if (!this.isTokenExpired(tokenInfo)) {
|
|
4249
|
+
return tokenInfo.token;
|
|
4250
|
+
}
|
|
4251
|
+
// Token is expired, refresh it
|
|
4252
|
+
try {
|
|
4253
|
+
const newToken = await this.refreshAccessToken();
|
|
4254
|
+
return newToken.access_token;
|
|
4255
|
+
}
|
|
4256
|
+
catch (error) {
|
|
4257
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
4258
|
+
throw new AuthenticationError({
|
|
4259
|
+
message: `Token refresh failed: ${message}. Please re-authenticate.`,
|
|
4260
|
+
statusCode: HttpStatus.UNAUTHORIZED
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
3932
4264
|
/**
|
|
3933
4265
|
* Gets the storage key for this TokenManager instance
|
|
3934
4266
|
*/
|
|
@@ -4143,10 +4475,6 @@
|
|
|
4143
4475
|
}
|
|
4144
4476
|
}
|
|
4145
4477
|
|
|
4146
|
-
/**
|
|
4147
|
-
* API Endpoint Constants
|
|
4148
|
-
* Centralized location for all API endpoints used throughout the SDK
|
|
4149
|
-
*/
|
|
4150
4478
|
/**
|
|
4151
4479
|
* Base path constants for different services
|
|
4152
4480
|
*/
|
|
@@ -4154,6 +4482,66 @@
|
|
|
4154
4482
|
const PIMS_BASE = 'pims_';
|
|
4155
4483
|
const DATAFABRIC_BASE = 'datafabric_';
|
|
4156
4484
|
const IDENTITY_BASE = 'identity_';
|
|
4485
|
+
|
|
4486
|
+
/**
|
|
4487
|
+
* Orchestrator Service Endpoints
|
|
4488
|
+
*/
|
|
4489
|
+
/**
|
|
4490
|
+
* Task Service (Action Center) Endpoints
|
|
4491
|
+
*/
|
|
4492
|
+
const TASK_ENDPOINTS = {
|
|
4493
|
+
CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
|
|
4494
|
+
GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
|
|
4495
|
+
GET_TASKS_ACROSS_FOLDERS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFolders`,
|
|
4496
|
+
GET_TASKS_ACROSS_FOLDERS_ADMIN: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFoldersForAdmin`,
|
|
4497
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Tasks(${id})`,
|
|
4498
|
+
ASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.AssignTasks`,
|
|
4499
|
+
REASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.ReassignTasks`,
|
|
4500
|
+
UNASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.UnassignTasks`,
|
|
4501
|
+
COMPLETE_FORM_TASK: `${ORCHESTRATOR_BASE}/forms/TaskForms/CompleteTask`,
|
|
4502
|
+
COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
|
|
4503
|
+
COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
|
|
4504
|
+
GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
|
|
4505
|
+
};
|
|
4506
|
+
/**
|
|
4507
|
+
* Orchestrator Bucket Endpoints
|
|
4508
|
+
*/
|
|
4509
|
+
const BUCKET_ENDPOINTS = {
|
|
4510
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Buckets`,
|
|
4511
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Buckets/UiPath.Server.Configuration.OData.GetBucketsAcrossFolders`,
|
|
4512
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
|
|
4513
|
+
GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
|
|
4514
|
+
GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
|
|
4515
|
+
GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
|
|
4516
|
+
};
|
|
4517
|
+
/**
|
|
4518
|
+
* Orchestrator Process Service Endpoints
|
|
4519
|
+
*/
|
|
4520
|
+
const PROCESS_ENDPOINTS = {
|
|
4521
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Releases`,
|
|
4522
|
+
START_PROCESS: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs`,
|
|
4523
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Releases(${id})`,
|
|
4524
|
+
};
|
|
4525
|
+
/**
|
|
4526
|
+
* Orchestrator Queue Service Endpoints
|
|
4527
|
+
*/
|
|
4528
|
+
const QUEUE_ENDPOINTS = {
|
|
4529
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
4530
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
4531
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
4532
|
+
};
|
|
4533
|
+
/**
|
|
4534
|
+
* Orchestrator Asset Service Endpoints
|
|
4535
|
+
*/
|
|
4536
|
+
const ASSET_ENDPOINTS = {
|
|
4537
|
+
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetFiltered`,
|
|
4538
|
+
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetAssetsAcrossFolders`,
|
|
4539
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Assets(${id})`,
|
|
4540
|
+
};
|
|
4541
|
+
|
|
4542
|
+
/**
|
|
4543
|
+
* Maestro Service Endpoints
|
|
4544
|
+
*/
|
|
4157
4545
|
/**
|
|
4158
4546
|
* Maestro Process Service Endpoints
|
|
4159
4547
|
*/
|
|
@@ -4183,25 +4571,12 @@
|
|
|
4183
4571
|
REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`,
|
|
4184
4572
|
},
|
|
4185
4573
|
};
|
|
4574
|
+
|
|
4186
4575
|
/**
|
|
4187
|
-
*
|
|
4576
|
+
* Data Fabric Service Endpoints
|
|
4188
4577
|
*/
|
|
4189
|
-
const TASK_ENDPOINTS = {
|
|
4190
|
-
CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
|
|
4191
|
-
GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
|
|
4192
|
-
GET_TASKS_ACROSS_FOLDERS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFolders`,
|
|
4193
|
-
GET_TASKS_ACROSS_FOLDERS_ADMIN: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFoldersForAdmin`,
|
|
4194
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Tasks(${id})`,
|
|
4195
|
-
ASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.AssignTasks`,
|
|
4196
|
-
REASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.ReassignTasks`,
|
|
4197
|
-
UNASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.UnassignTasks`,
|
|
4198
|
-
COMPLETE_FORM_TASK: `${ORCHESTRATOR_BASE}/forms/TaskForms/CompleteTask`,
|
|
4199
|
-
COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
|
|
4200
|
-
COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
|
|
4201
|
-
GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
|
|
4202
|
-
};
|
|
4203
4578
|
/**
|
|
4204
|
-
* Data Fabric Service Endpoints
|
|
4579
|
+
* Data Fabric Entity Service Endpoints
|
|
4205
4580
|
*/
|
|
4206
4581
|
const DATA_FABRIC_ENDPOINTS = {
|
|
4207
4582
|
ENTITY: {
|
|
@@ -4217,51 +4592,20 @@
|
|
|
4217
4592
|
},
|
|
4218
4593
|
CHOICESETS: {
|
|
4219
4594
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
4220
|
-
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
4221
|
-
},
|
|
4222
|
-
};
|
|
4223
|
-
/**
|
|
4224
|
-
* Orchestrator Bucket Endpoints
|
|
4225
|
-
*/
|
|
4226
|
-
const BUCKET_ENDPOINTS = {
|
|
4227
|
-
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Buckets`,
|
|
4228
|
-
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Buckets/UiPath.Server.Configuration.OData.GetBucketsAcrossFolders`,
|
|
4229
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
|
|
4230
|
-
GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
|
|
4231
|
-
GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
|
|
4232
|
-
GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
|
|
4595
|
+
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
4596
|
+
},
|
|
4233
4597
|
};
|
|
4598
|
+
|
|
4234
4599
|
/**
|
|
4235
4600
|
* Identity/Authentication Endpoints
|
|
4236
4601
|
*/
|
|
4602
|
+
/**
|
|
4603
|
+
* Identity Service Endpoints
|
|
4604
|
+
*/
|
|
4237
4605
|
const IDENTITY_ENDPOINTS = {
|
|
4238
4606
|
TOKEN: `${IDENTITY_BASE}/connect/token`,
|
|
4239
4607
|
AUTHORIZE: `${IDENTITY_BASE}/connect/authorize`,
|
|
4240
4608
|
};
|
|
4241
|
-
/**
|
|
4242
|
-
* Orchestrator Process Service Endpoints
|
|
4243
|
-
*/
|
|
4244
|
-
const PROCESS_ENDPOINTS = {
|
|
4245
|
-
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Releases`,
|
|
4246
|
-
START_PROCESS: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs`,
|
|
4247
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Releases(${id})`,
|
|
4248
|
-
};
|
|
4249
|
-
/**
|
|
4250
|
-
* Orchestrator Queue Service Endpoints
|
|
4251
|
-
*/
|
|
4252
|
-
const QUEUE_ENDPOINTS = {
|
|
4253
|
-
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions`,
|
|
4254
|
-
GET_ALL: `${ORCHESTRATOR_BASE}/odata/QueueDefinitions/UiPath.Server.Configuration.OData.GetQueuesAcrossFolders`,
|
|
4255
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/QueueDefinitions(${id})`,
|
|
4256
|
-
};
|
|
4257
|
-
/**
|
|
4258
|
-
* Orchestrator Asset Service Endpoints
|
|
4259
|
-
*/
|
|
4260
|
-
const ASSET_ENDPOINTS = {
|
|
4261
|
-
GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetFiltered`,
|
|
4262
|
-
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetAssetsAcrossFolders`,
|
|
4263
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Assets(${id})`,
|
|
4264
|
-
};
|
|
4265
4609
|
|
|
4266
4610
|
class AuthService {
|
|
4267
4611
|
constructor(config, executionContext) {
|
|
@@ -8376,7 +8720,7 @@
|
|
|
8376
8720
|
// Connection string placeholder that will be replaced during build
|
|
8377
8721
|
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
8378
8722
|
// SDK Version placeholder
|
|
8379
|
-
const SDK_VERSION = "1.
|
|
8723
|
+
const SDK_VERSION = "1.1.0";
|
|
8380
8724
|
const VERSION = "Version";
|
|
8381
8725
|
const SERVICE = "Service";
|
|
8382
8726
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -8553,7 +8897,6 @@
|
|
|
8553
8897
|
*/
|
|
8554
8898
|
getEnrichedAttributes(extraAttributes, eventName) {
|
|
8555
8899
|
const attributes = {
|
|
8556
|
-
...extraAttributes,
|
|
8557
8900
|
[APP_NAME]: SDK_SERVICE_NAME,
|
|
8558
8901
|
[VERSION]: SDK_VERSION,
|
|
8559
8902
|
[SERVICE]: eventName,
|
|
@@ -8562,6 +8905,7 @@
|
|
|
8562
8905
|
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN$1,
|
|
8563
8906
|
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN$1,
|
|
8564
8907
|
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN$1,
|
|
8908
|
+
...extraAttributes,
|
|
8565
8909
|
};
|
|
8566
8910
|
return attributes;
|
|
8567
8911
|
}
|
|
@@ -8831,332 +9175,38 @@
|
|
|
8831
9175
|
}
|
|
8832
9176
|
/**
|
|
8833
9177
|
* Complete OAuth authentication flow (only call if isInOAuthCallback() is true)
|
|
8834
|
-
*/
|
|
8835
|
-
async completeOAuth() {
|
|
8836
|
-
if (!AuthService.isInOAuthCallback()) {
|
|
8837
|
-
throw new Error('Not in OAuth callback state. Call initialize() first to start OAuth flow.');
|
|
8838
|
-
}
|
|
8839
|
-
try {
|
|
8840
|
-
const success = await __classPrivateFieldGet(this, _UiPath_authService, "f").authenticate(__classPrivateFieldGet(this, _UiPath_config, "f"));
|
|
8841
|
-
if (success && this.isAuthenticated()) {
|
|
8842
|
-
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
8843
|
-
return true;
|
|
8844
|
-
}
|
|
8845
|
-
return false;
|
|
8846
|
-
}
|
|
8847
|
-
catch (error) {
|
|
8848
|
-
const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
|
|
8849
|
-
throw new Error(`Failed to complete OAuth: ${errorMessage}`);
|
|
8850
|
-
}
|
|
8851
|
-
}
|
|
8852
|
-
/**
|
|
8853
|
-
* Check if the user is authenticated (has valid token)
|
|
8854
|
-
*/
|
|
8855
|
-
isAuthenticated() {
|
|
8856
|
-
return __classPrivateFieldGet(this, _UiPath_authService, "f").hasValidToken();
|
|
8857
|
-
}
|
|
8858
|
-
/**
|
|
8859
|
-
* Get the current authentication token
|
|
8860
|
-
*/
|
|
8861
|
-
getToken() {
|
|
8862
|
-
return __classPrivateFieldGet(this, _UiPath_authService, "f").getToken();
|
|
8863
|
-
}
|
|
8864
|
-
};
|
|
8865
|
-
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap();
|
|
8866
|
-
|
|
8867
|
-
/**
|
|
8868
|
-
* Base error class for all UiPath SDK errors
|
|
8869
|
-
* Pure TypeScript class with clean interface
|
|
8870
|
-
*/
|
|
8871
|
-
class UiPathError {
|
|
8872
|
-
constructor(type, params) {
|
|
8873
|
-
this.type = type;
|
|
8874
|
-
this.message = params.message;
|
|
8875
|
-
this.statusCode = params.statusCode;
|
|
8876
|
-
this.requestId = params.requestId;
|
|
8877
|
-
this.timestamp = new Date();
|
|
8878
|
-
// Capture stack trace for debugging
|
|
8879
|
-
this.stack = (new Error()).stack;
|
|
8880
|
-
}
|
|
8881
|
-
/**
|
|
8882
|
-
* Returns a clean JSON representation of the error
|
|
8883
|
-
*/
|
|
8884
|
-
toJSON() {
|
|
8885
|
-
return {
|
|
8886
|
-
type: this.type,
|
|
8887
|
-
message: this.message,
|
|
8888
|
-
statusCode: this.statusCode,
|
|
8889
|
-
requestId: this.requestId,
|
|
8890
|
-
timestamp: this.timestamp
|
|
8891
|
-
};
|
|
8892
|
-
}
|
|
8893
|
-
/**
|
|
8894
|
-
* Returns detailed debug information including stack trace
|
|
8895
|
-
*/
|
|
8896
|
-
getDebugInfo() {
|
|
8897
|
-
return {
|
|
8898
|
-
...this.toJSON(),
|
|
8899
|
-
stack: this.stack
|
|
8900
|
-
};
|
|
8901
|
-
}
|
|
8902
|
-
}
|
|
8903
|
-
|
|
8904
|
-
/**
|
|
8905
|
-
* HTTP status code constants for error handling
|
|
8906
|
-
*/
|
|
8907
|
-
const HttpStatus = {
|
|
8908
|
-
// Client errors (4xx)
|
|
8909
|
-
BAD_REQUEST: 400,
|
|
8910
|
-
UNAUTHORIZED: 401,
|
|
8911
|
-
FORBIDDEN: 403,
|
|
8912
|
-
NOT_FOUND: 404,
|
|
8913
|
-
TOO_MANY_REQUESTS: 429,
|
|
8914
|
-
// Server errors (5xx)
|
|
8915
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
8916
|
-
NOT_IMPLEMENTED: 501,
|
|
8917
|
-
BAD_GATEWAY: 502,
|
|
8918
|
-
SERVICE_UNAVAILABLE: 503,
|
|
8919
|
-
GATEWAY_TIMEOUT: 504
|
|
8920
|
-
};
|
|
8921
|
-
/**
|
|
8922
|
-
* Error type constants for consistent error identification
|
|
8923
|
-
*/
|
|
8924
|
-
const ErrorType = {
|
|
8925
|
-
AUTHENTICATION: 'AuthenticationError',
|
|
8926
|
-
AUTHORIZATION: 'AuthorizationError',
|
|
8927
|
-
VALIDATION: 'ValidationError',
|
|
8928
|
-
NOT_FOUND: 'NotFoundError',
|
|
8929
|
-
RATE_LIMIT: 'RateLimitError',
|
|
8930
|
-
SERVER: 'ServerError',
|
|
8931
|
-
NETWORK: 'NetworkError'
|
|
8932
|
-
};
|
|
8933
|
-
/**
|
|
8934
|
-
* HTTP header constants for error handling
|
|
8935
|
-
*/
|
|
8936
|
-
const HttpHeaders = {
|
|
8937
|
-
X_REQUEST_ID: 'x-request-id'
|
|
8938
|
-
};
|
|
8939
|
-
/**
|
|
8940
|
-
* Standard error message constants
|
|
8941
|
-
*/
|
|
8942
|
-
const ErrorMessages = {
|
|
8943
|
-
// Authentication errors
|
|
8944
|
-
AUTHENTICATION_FAILED: 'Authentication failed',
|
|
8945
|
-
// Authorization errors
|
|
8946
|
-
ACCESS_DENIED: 'Access denied',
|
|
8947
|
-
// Validation errors
|
|
8948
|
-
VALIDATION_FAILED: 'Validation failed',
|
|
8949
|
-
// Not found errors
|
|
8950
|
-
RESOURCE_NOT_FOUND: 'Resource not found',
|
|
8951
|
-
// Rate limit errors
|
|
8952
|
-
RATE_LIMIT_EXCEEDED: 'Rate limit exceeded',
|
|
8953
|
-
// Server errors
|
|
8954
|
-
INTERNAL_SERVER_ERROR: 'Internal Server error occurred',
|
|
8955
|
-
// Network errors
|
|
8956
|
-
NETWORK_ERROR: 'Network error occurred',
|
|
8957
|
-
REQUEST_TIMEOUT: 'Request timed out',
|
|
8958
|
-
REQUEST_ABORTED: 'Request was aborted',
|
|
8959
|
-
};
|
|
8960
|
-
/**
|
|
8961
|
-
* Error name constants for network error identification
|
|
8962
|
-
*/
|
|
8963
|
-
const ErrorNames = {
|
|
8964
|
-
ABORT_ERROR: 'AbortError'};
|
|
8965
|
-
|
|
8966
|
-
/**
|
|
8967
|
-
* Error thrown when authentication fails (401 errors)
|
|
8968
|
-
* Common scenarios:
|
|
8969
|
-
* - Invalid credentials
|
|
8970
|
-
* - Expired token
|
|
8971
|
-
* - Missing authentication
|
|
8972
|
-
*/
|
|
8973
|
-
class AuthenticationError extends UiPathError {
|
|
8974
|
-
constructor(params = {}) {
|
|
8975
|
-
super(ErrorType.AUTHENTICATION, {
|
|
8976
|
-
message: params.message || ErrorMessages.AUTHENTICATION_FAILED,
|
|
8977
|
-
statusCode: params.statusCode ?? HttpStatus.UNAUTHORIZED,
|
|
8978
|
-
requestId: params.requestId
|
|
8979
|
-
});
|
|
8980
|
-
}
|
|
8981
|
-
}
|
|
8982
|
-
|
|
8983
|
-
/**
|
|
8984
|
-
* Error thrown when authorization fails (403 errors)
|
|
8985
|
-
* Common scenarios:
|
|
8986
|
-
* - Insufficient permissions
|
|
8987
|
-
* - Access denied to resource
|
|
8988
|
-
* - Invalid scope
|
|
8989
|
-
*/
|
|
8990
|
-
class AuthorizationError extends UiPathError {
|
|
8991
|
-
constructor(params = {}) {
|
|
8992
|
-
super(ErrorType.AUTHORIZATION, {
|
|
8993
|
-
message: params.message || ErrorMessages.ACCESS_DENIED,
|
|
8994
|
-
statusCode: params.statusCode ?? HttpStatus.FORBIDDEN,
|
|
8995
|
-
requestId: params.requestId
|
|
8996
|
-
});
|
|
8997
|
-
}
|
|
8998
|
-
}
|
|
8999
|
-
|
|
9000
|
-
/**
|
|
9001
|
-
* Error thrown when validation fails (400 errors or client-side validation)
|
|
9002
|
-
* Common scenarios:
|
|
9003
|
-
* - Invalid input parameters
|
|
9004
|
-
* - Missing required fields
|
|
9005
|
-
* - Invalid data format
|
|
9006
|
-
*/
|
|
9007
|
-
class ValidationError extends UiPathError {
|
|
9008
|
-
constructor(params = {}) {
|
|
9009
|
-
super(ErrorType.VALIDATION, {
|
|
9010
|
-
message: params.message || ErrorMessages.VALIDATION_FAILED,
|
|
9011
|
-
statusCode: params.statusCode ?? HttpStatus.BAD_REQUEST,
|
|
9012
|
-
requestId: params.requestId
|
|
9013
|
-
});
|
|
9014
|
-
}
|
|
9015
|
-
}
|
|
9016
|
-
|
|
9017
|
-
/**
|
|
9018
|
-
* Error thrown when a resource is not found (404 errors)
|
|
9019
|
-
* Common scenarios:
|
|
9020
|
-
* - Resource doesn't exist
|
|
9021
|
-
* - Invalid ID provided
|
|
9022
|
-
* - Resource deleted
|
|
9023
|
-
*/
|
|
9024
|
-
class NotFoundError extends UiPathError {
|
|
9025
|
-
constructor(params = {}) {
|
|
9026
|
-
super(ErrorType.NOT_FOUND, {
|
|
9027
|
-
message: params.message || ErrorMessages.RESOURCE_NOT_FOUND,
|
|
9028
|
-
statusCode: params.statusCode ?? HttpStatus.NOT_FOUND,
|
|
9029
|
-
requestId: params.requestId
|
|
9030
|
-
});
|
|
9031
|
-
}
|
|
9032
|
-
}
|
|
9033
|
-
|
|
9034
|
-
/**
|
|
9035
|
-
* Error thrown when rate limit is exceeded (429 errors)
|
|
9036
|
-
* Common scenarios:
|
|
9037
|
-
* - Too many requests in a time window
|
|
9038
|
-
* - API throttling
|
|
9039
|
-
*/
|
|
9040
|
-
class RateLimitError extends UiPathError {
|
|
9041
|
-
constructor(params = {}) {
|
|
9042
|
-
super(ErrorType.RATE_LIMIT, {
|
|
9043
|
-
message: params.message || ErrorMessages.RATE_LIMIT_EXCEEDED,
|
|
9044
|
-
statusCode: params.statusCode ?? HttpStatus.TOO_MANY_REQUESTS,
|
|
9045
|
-
requestId: params.requestId
|
|
9046
|
-
});
|
|
9047
|
-
}
|
|
9048
|
-
}
|
|
9049
|
-
|
|
9050
|
-
/**
|
|
9051
|
-
* Error thrown when server encounters an error (5xx errors)
|
|
9052
|
-
* Common scenarios:
|
|
9053
|
-
* - Internal server error
|
|
9054
|
-
* - Service unavailable
|
|
9055
|
-
* - Gateway timeout
|
|
9056
|
-
*/
|
|
9057
|
-
class ServerError extends UiPathError {
|
|
9058
|
-
constructor(params = {}) {
|
|
9059
|
-
super(ErrorType.SERVER, {
|
|
9060
|
-
message: params.message || ErrorMessages.INTERNAL_SERVER_ERROR,
|
|
9061
|
-
statusCode: params.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR,
|
|
9062
|
-
requestId: params.requestId
|
|
9063
|
-
});
|
|
9178
|
+
*/
|
|
9179
|
+
async completeOAuth() {
|
|
9180
|
+
if (!AuthService.isInOAuthCallback()) {
|
|
9181
|
+
throw new Error('Not in OAuth callback state. Call initialize() first to start OAuth flow.');
|
|
9182
|
+
}
|
|
9183
|
+
try {
|
|
9184
|
+
const success = await __classPrivateFieldGet(this, _UiPath_authService, "f").authenticate(__classPrivateFieldGet(this, _UiPath_config, "f"));
|
|
9185
|
+
if (success && this.isAuthenticated()) {
|
|
9186
|
+
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
9187
|
+
return true;
|
|
9188
|
+
}
|
|
9189
|
+
return false;
|
|
9190
|
+
}
|
|
9191
|
+
catch (error) {
|
|
9192
|
+
const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
|
|
9193
|
+
throw new Error(`Failed to complete OAuth: ${errorMessage}`);
|
|
9194
|
+
}
|
|
9064
9195
|
}
|
|
9065
9196
|
/**
|
|
9066
|
-
*
|
|
9197
|
+
* Check if the user is authenticated (has valid token)
|
|
9067
9198
|
*/
|
|
9068
|
-
|
|
9069
|
-
return this
|
|
9070
|
-
this.statusCode === HttpStatus.SERVICE_UNAVAILABLE ||
|
|
9071
|
-
this.statusCode === HttpStatus.GATEWAY_TIMEOUT;
|
|
9072
|
-
}
|
|
9073
|
-
}
|
|
9074
|
-
|
|
9075
|
-
/**
|
|
9076
|
-
* Error thrown when network/connection issues occur
|
|
9077
|
-
* Common scenarios:
|
|
9078
|
-
* - Connection timeout
|
|
9079
|
-
* - DNS resolution failure
|
|
9080
|
-
* - Network unreachable
|
|
9081
|
-
* - Request aborted
|
|
9082
|
-
*/
|
|
9083
|
-
class NetworkError extends UiPathError {
|
|
9084
|
-
constructor(params = {}) {
|
|
9085
|
-
super(ErrorType.NETWORK, {
|
|
9086
|
-
message: params.message || ErrorMessages.NETWORK_ERROR,
|
|
9087
|
-
statusCode: params.statusCode, // Network errors typically don't have HTTP status codes
|
|
9088
|
-
requestId: params.requestId
|
|
9089
|
-
});
|
|
9090
|
-
}
|
|
9091
|
-
}
|
|
9092
|
-
|
|
9093
|
-
/**
|
|
9094
|
-
* Type guard to check if an error is a UiPathError
|
|
9095
|
-
*/
|
|
9096
|
-
function isUiPathError(error) {
|
|
9097
|
-
return error instanceof UiPathError;
|
|
9098
|
-
}
|
|
9099
|
-
/**
|
|
9100
|
-
* Type guard to check if an error is an AuthenticationError
|
|
9101
|
-
*/
|
|
9102
|
-
function isAuthenticationError(error) {
|
|
9103
|
-
return error instanceof AuthenticationError;
|
|
9104
|
-
}
|
|
9105
|
-
/**
|
|
9106
|
-
* Type guard to check if an error is an AuthorizationError
|
|
9107
|
-
*/
|
|
9108
|
-
function isAuthorizationError(error) {
|
|
9109
|
-
return error instanceof AuthorizationError;
|
|
9110
|
-
}
|
|
9111
|
-
/**
|
|
9112
|
-
* Type guard to check if an error is a ValidationError
|
|
9113
|
-
*/
|
|
9114
|
-
function isValidationError(error) {
|
|
9115
|
-
return error instanceof ValidationError;
|
|
9116
|
-
}
|
|
9117
|
-
/**
|
|
9118
|
-
* Type guard to check if an error is a NotFoundError
|
|
9119
|
-
*/
|
|
9120
|
-
function isNotFoundError(error) {
|
|
9121
|
-
return error instanceof NotFoundError;
|
|
9122
|
-
}
|
|
9123
|
-
/**
|
|
9124
|
-
* Type guard to check if an error is a RateLimitError
|
|
9125
|
-
*/
|
|
9126
|
-
function isRateLimitError(error) {
|
|
9127
|
-
return error instanceof RateLimitError;
|
|
9128
|
-
}
|
|
9129
|
-
/**
|
|
9130
|
-
* Type guard to check if an error is a ServerError
|
|
9131
|
-
*/
|
|
9132
|
-
function isServerError(error) {
|
|
9133
|
-
return error instanceof ServerError;
|
|
9134
|
-
}
|
|
9135
|
-
/**
|
|
9136
|
-
* Type guard to check if an error is a NetworkError
|
|
9137
|
-
*/
|
|
9138
|
-
function isNetworkError(error) {
|
|
9139
|
-
return error instanceof NetworkError;
|
|
9140
|
-
}
|
|
9141
|
-
/**
|
|
9142
|
-
* Helper to get error details in a safe way
|
|
9143
|
-
*/
|
|
9144
|
-
function getErrorDetails(error) {
|
|
9145
|
-
if (isUiPathError(error)) {
|
|
9146
|
-
return {
|
|
9147
|
-
message: error.message,
|
|
9148
|
-
statusCode: error.statusCode
|
|
9149
|
-
};
|
|
9199
|
+
isAuthenticated() {
|
|
9200
|
+
return __classPrivateFieldGet(this, _UiPath_authService, "f").hasValidToken();
|
|
9150
9201
|
}
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9202
|
+
/**
|
|
9203
|
+
* Get the current authentication token
|
|
9204
|
+
*/
|
|
9205
|
+
getToken() {
|
|
9206
|
+
return __classPrivateFieldGet(this, _UiPath_authService, "f").getToken();
|
|
9155
9207
|
}
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
};
|
|
9159
|
-
}
|
|
9208
|
+
};
|
|
9209
|
+
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap();
|
|
9160
9210
|
|
|
9161
9211
|
/**
|
|
9162
9212
|
* Type guards for error response types
|
|
@@ -9430,29 +9480,7 @@
|
|
|
9430
9480
|
* @throws AuthenticationError if no token available or refresh fails
|
|
9431
9481
|
*/
|
|
9432
9482
|
async getValidToken() {
|
|
9433
|
-
|
|
9434
|
-
const tokenInfo = this.executionContext.get('tokenInfo');
|
|
9435
|
-
if (!tokenInfo) {
|
|
9436
|
-
throw new AuthenticationError({ message: 'No authentication token available. Make sure to initialize the SDK first.' });
|
|
9437
|
-
}
|
|
9438
|
-
// For secret-based tokens, they never expire
|
|
9439
|
-
if (tokenInfo.type === 'secret') {
|
|
9440
|
-
return tokenInfo.token;
|
|
9441
|
-
}
|
|
9442
|
-
// If token is not expired, return it
|
|
9443
|
-
if (!this.tokenManager.isTokenExpired(tokenInfo)) {
|
|
9444
|
-
return tokenInfo.token;
|
|
9445
|
-
}
|
|
9446
|
-
try {
|
|
9447
|
-
const newToken = await this.tokenManager.refreshAccessToken();
|
|
9448
|
-
return newToken.access_token;
|
|
9449
|
-
}
|
|
9450
|
-
catch (error) {
|
|
9451
|
-
throw new AuthenticationError({
|
|
9452
|
-
message: `Token refresh failed: ${error.message}. Please re-authenticate.`,
|
|
9453
|
-
statusCode: HttpStatus.UNAUTHORIZED
|
|
9454
|
-
});
|
|
9455
|
-
}
|
|
9483
|
+
return this.tokenManager.getValidToken();
|
|
9456
9484
|
}
|
|
9457
9485
|
async getDefaultHeaders() {
|
|
9458
9486
|
// Get headers from execution context first
|
|
@@ -10137,6 +10165,51 @@
|
|
|
10137
10165
|
return acc;
|
|
10138
10166
|
}, {});
|
|
10139
10167
|
}
|
|
10168
|
+
/**
|
|
10169
|
+
* Transforms request data from SDK field names to API field names.
|
|
10170
|
+
*
|
|
10171
|
+
* This is the inverse of `transformData` - while `transformData` converts
|
|
10172
|
+
* API responses to SDK format (API → SDK), this function converts SDK
|
|
10173
|
+
* requests to API format (SDK → API).
|
|
10174
|
+
*
|
|
10175
|
+
* @param data The request data with SDK field names
|
|
10176
|
+
* @param responseMap The response mapping (API → SDK) - will be automatically reversed
|
|
10177
|
+
* @returns A new object with API field names
|
|
10178
|
+
*
|
|
10179
|
+
* @example
|
|
10180
|
+
* ```typescript
|
|
10181
|
+
* // Response map: API field → SDK field
|
|
10182
|
+
* const ProcessMap = { releaseKey: 'processKey', releaseName: 'processName' };
|
|
10183
|
+
*
|
|
10184
|
+
* // SDK request with SDK field names
|
|
10185
|
+
* const sdkRequest = { processKey: 'abc-123', processName: 'MyProcess' };
|
|
10186
|
+
*
|
|
10187
|
+
* // Transform to API format
|
|
10188
|
+
* const apiRequest = transformRequest(sdkRequest, ProcessMap);
|
|
10189
|
+
* // Result: { releaseKey: 'abc-123', releaseName: 'MyProcess' }
|
|
10190
|
+
* ```
|
|
10191
|
+
*
|
|
10192
|
+
* @example
|
|
10193
|
+
* ```typescript
|
|
10194
|
+
* // Conversation example
|
|
10195
|
+
* const ConversationMap = { agentReleaseId: 'agentId' };
|
|
10196
|
+
*
|
|
10197
|
+
* const sdkOptions = { agentId: 123, folderId: 456, label: 'My Chat' };
|
|
10198
|
+
* const apiPayload = transformRequest(sdkOptions, ConversationMap);
|
|
10199
|
+
* // Result: { agentReleaseId: 123, folderId: 456, label: 'My Chat' }
|
|
10200
|
+
* ```
|
|
10201
|
+
*/
|
|
10202
|
+
function transformRequest(data, responseMap) {
|
|
10203
|
+
const result = { ...data };
|
|
10204
|
+
const requestMap = reverseMap(responseMap);
|
|
10205
|
+
for (const [sdkField, apiField] of Object.entries(requestMap)) {
|
|
10206
|
+
if (sdkField in result) {
|
|
10207
|
+
result[apiField] = result[sdkField];
|
|
10208
|
+
delete result[sdkField];
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
return result;
|
|
10212
|
+
}
|
|
10140
10213
|
/**
|
|
10141
10214
|
* Transforms an array-based dictionary with separate keys and values arrays
|
|
10142
10215
|
* into a standard JavaScript object/record
|
|
@@ -10394,10 +10467,7 @@
|
|
|
10394
10467
|
*/
|
|
10395
10468
|
static async getAll(config, options) {
|
|
10396
10469
|
const optionsWithDefaults = options || {};
|
|
10397
|
-
const { folderId, ...restOptions } = optionsWithDefaults;
|
|
10398
|
-
const cursor = options?.cursor;
|
|
10399
|
-
const pageSize = options?.pageSize;
|
|
10400
|
-
const jumpToPage = options?.jumpToPage;
|
|
10470
|
+
const { folderId, pageSize, cursor, jumpToPage, ...restOptions } = optionsWithDefaults;
|
|
10401
10471
|
// Determine if pagination is requested
|
|
10402
10472
|
const isPaginationRequested = PaginationHelpers.hasPaginationParameters(options || {});
|
|
10403
10473
|
// Process parameters (custom processing if provided, otherwise default)
|
|
@@ -14100,17 +14170,8 @@
|
|
|
14100
14170
|
*/
|
|
14101
14171
|
async start(request, folderId, options = {}) {
|
|
14102
14172
|
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
14103
|
-
// Transform
|
|
14104
|
-
const apiRequest =
|
|
14105
|
-
// Create a reverse mapping using ProcessMap
|
|
14106
|
-
const reversedPropertiesMap = reverseMap(ProcessMap);
|
|
14107
|
-
// Apply transformations for any client properties found in the request
|
|
14108
|
-
Object.entries(reversedPropertiesMap).forEach(([clientKey, apiKey]) => {
|
|
14109
|
-
if (clientKey in apiRequest) {
|
|
14110
|
-
apiRequest[apiKey] = apiRequest[clientKey];
|
|
14111
|
-
delete apiRequest[clientKey];
|
|
14112
|
-
}
|
|
14113
|
-
});
|
|
14173
|
+
// Transform SDK field names to API field names (e.g., processKey → releaseKey)
|
|
14174
|
+
const apiRequest = transformRequest(request, ProcessMap);
|
|
14114
14175
|
// Create the request object according to API spec
|
|
14115
14176
|
const requestBody = {
|
|
14116
14177
|
startInfo: apiRequest
|
|
@@ -14518,7 +14579,266 @@
|
|
|
14518
14579
|
JobState["Resumed"] = "Resumed";
|
|
14519
14580
|
})(exports.JobState || (exports.JobState = {}));
|
|
14520
14581
|
|
|
14582
|
+
/**
|
|
14583
|
+
* Common Constants for Conversational Agent
|
|
14584
|
+
*/
|
|
14585
|
+
/**
|
|
14586
|
+
* Common field mappings shared across all conversational agent entities.
|
|
14587
|
+
* Maps API response fields to SDK-consistent naming conventions.
|
|
14588
|
+
*/
|
|
14589
|
+
const CommonFieldMap = {
|
|
14590
|
+
createdAt: 'createdTime',
|
|
14591
|
+
updatedAt: 'updatedTime'
|
|
14592
|
+
};
|
|
14593
|
+
|
|
14594
|
+
/**
|
|
14595
|
+
* Constants for Conversational Agent
|
|
14596
|
+
*/
|
|
14597
|
+
/**
|
|
14598
|
+
* Maps API response fields to SDK field names (API → SDK)
|
|
14599
|
+
* Used when transforming API responses for SDK consumers.
|
|
14600
|
+
* For request transformation (SDK → API), use `transformRequest(data, ConversationMap)`.
|
|
14601
|
+
*/
|
|
14602
|
+
const ConversationMap = {
|
|
14603
|
+
...CommonFieldMap,
|
|
14604
|
+
conversationId: 'id',
|
|
14605
|
+
lastActivityAt: 'lastActivityTime',
|
|
14606
|
+
agentReleaseId: 'agentId'
|
|
14607
|
+
};
|
|
14608
|
+
/**
|
|
14609
|
+
* Maps fields for Exchange entity to ensure consistent SDK naming
|
|
14610
|
+
*/
|
|
14611
|
+
const ExchangeMap = {
|
|
14612
|
+
...CommonFieldMap
|
|
14613
|
+
};
|
|
14614
|
+
/**
|
|
14615
|
+
* Maps fields for Message entity to ensure consistent SDK naming
|
|
14616
|
+
*/
|
|
14617
|
+
const MessageMap = {
|
|
14618
|
+
...CommonFieldMap
|
|
14619
|
+
};
|
|
14620
|
+
|
|
14621
|
+
/**
|
|
14622
|
+
* Common types for Conversational Agent
|
|
14623
|
+
* Contains IDs, primitives, and utility types used across conversation types.
|
|
14624
|
+
*/
|
|
14625
|
+
/**
|
|
14626
|
+
* Identifies the origin of a message in the conversation.
|
|
14627
|
+
*/
|
|
14628
|
+
exports.MessageRole = void 0;
|
|
14629
|
+
(function (MessageRole) {
|
|
14630
|
+
MessageRole["System"] = "system";
|
|
14631
|
+
MessageRole["User"] = "user";
|
|
14632
|
+
MessageRole["Assistant"] = "assistant";
|
|
14633
|
+
})(exports.MessageRole || (exports.MessageRole = {}));
|
|
14634
|
+
/**
|
|
14635
|
+
* Identifies the type of an interrupt.
|
|
14636
|
+
*/
|
|
14637
|
+
exports.InterruptType = void 0;
|
|
14638
|
+
(function (InterruptType) {
|
|
14639
|
+
InterruptType["ToolCallConfirmation"] = "uipath_cas_tool_call_confirmation";
|
|
14640
|
+
})(exports.InterruptType || (exports.InterruptType = {}));
|
|
14641
|
+
|
|
14642
|
+
/**
|
|
14643
|
+
* Core data model types for Conversational Agent REST endpoints
|
|
14644
|
+
* Contains: Conversation, Exchange, Message, ContentPart, ToolCall, etc.
|
|
14645
|
+
*/
|
|
14646
|
+
/**
|
|
14647
|
+
* Represents the order in which items should be sorted.
|
|
14648
|
+
*/
|
|
14649
|
+
exports.SortOrder = void 0;
|
|
14650
|
+
(function (SortOrder) {
|
|
14651
|
+
SortOrder["Ascending"] = "ascending";
|
|
14652
|
+
SortOrder["Descending"] = "descending";
|
|
14653
|
+
})(exports.SortOrder || (exports.SortOrder = {}));
|
|
14654
|
+
/**
|
|
14655
|
+
* Feedback rating type.
|
|
14656
|
+
*/
|
|
14657
|
+
exports.FeedbackRating = void 0;
|
|
14658
|
+
(function (FeedbackRating) {
|
|
14659
|
+
FeedbackRating["Positive"] = "positive";
|
|
14660
|
+
FeedbackRating["Negative"] = "negative";
|
|
14661
|
+
})(exports.FeedbackRating || (exports.FeedbackRating = {}));
|
|
14662
|
+
|
|
14663
|
+
/**
|
|
14664
|
+
* Event types for Conversational Agent WebSocket protocol
|
|
14665
|
+
*/
|
|
14666
|
+
/**
|
|
14667
|
+
* Identifies how sensitive the LLM should be when detecting the start or end of speech.
|
|
14668
|
+
*
|
|
14669
|
+
* * UNSPECIFIED - the default is HIGH
|
|
14670
|
+
* * HIGH - Will detect the start/end of speech more often.
|
|
14671
|
+
* * LOW - Will detect the start/end of speech less often.
|
|
14672
|
+
*/
|
|
14673
|
+
exports.InputStreamSpeechSensitivity = void 0;
|
|
14674
|
+
(function (InputStreamSpeechSensitivity) {
|
|
14675
|
+
InputStreamSpeechSensitivity["Unspecified"] = "UNSPECIFIED";
|
|
14676
|
+
InputStreamSpeechSensitivity["High"] = "HIGH";
|
|
14677
|
+
InputStreamSpeechSensitivity["Low"] = "LOW";
|
|
14678
|
+
})(exports.InputStreamSpeechSensitivity || (exports.InputStreamSpeechSensitivity = {}));
|
|
14679
|
+
|
|
14680
|
+
/**
|
|
14681
|
+
* Content Part Stream Types
|
|
14682
|
+
*
|
|
14683
|
+
* Defines the public API for interacting with streaming content parts
|
|
14684
|
+
* within a message. Content parts represent text, audio, images, etc.
|
|
14685
|
+
*/
|
|
14686
|
+
/**
|
|
14687
|
+
* Types of citation processing errors
|
|
14688
|
+
*/
|
|
14689
|
+
exports.CitationErrorType = void 0;
|
|
14690
|
+
(function (CitationErrorType) {
|
|
14691
|
+
CitationErrorType["CitationNotEnded"] = "CitationNotEnded";
|
|
14692
|
+
CitationErrorType["CitationNotStarted"] = "CitationNotStarted";
|
|
14693
|
+
})(exports.CitationErrorType || (exports.CitationErrorType = {}));
|
|
14694
|
+
|
|
14695
|
+
/**
|
|
14696
|
+
* Conversation Service Model
|
|
14697
|
+
*
|
|
14698
|
+
* This interface defines the HTTP CRUD operations for conversations
|
|
14699
|
+
* and real-time WebSocket session management.
|
|
14700
|
+
*/
|
|
14701
|
+
/**
|
|
14702
|
+
* Creates methods for a conversation
|
|
14703
|
+
*
|
|
14704
|
+
* @param conversationData - The conversation data (response from API)
|
|
14705
|
+
* @param service - The conversation service instance
|
|
14706
|
+
* @param sessionMethods - Optional session methods for WebSocket session operations
|
|
14707
|
+
* @param exchangeService - Optional exchange service for scoped exchange methods
|
|
14708
|
+
* @returns Object containing conversation methods
|
|
14709
|
+
*/
|
|
14710
|
+
function createConversationMethods(conversationData, service, sessionMethods, exchangeService) {
|
|
14711
|
+
return {
|
|
14712
|
+
exchanges: {
|
|
14713
|
+
getAll(options) {
|
|
14714
|
+
if (!conversationData.id)
|
|
14715
|
+
throw new Error('Conversation ID is undefined');
|
|
14716
|
+
if (!exchangeService)
|
|
14717
|
+
throw new Error('Exchange methods are not available.');
|
|
14718
|
+
return exchangeService.getAll(conversationData.id, options);
|
|
14719
|
+
},
|
|
14720
|
+
getById(exchangeId, options) {
|
|
14721
|
+
if (!conversationData.id)
|
|
14722
|
+
throw new Error('Conversation ID is undefined');
|
|
14723
|
+
if (!exchangeService)
|
|
14724
|
+
throw new Error('Exchange methods are not available.');
|
|
14725
|
+
return exchangeService.getById(conversationData.id, exchangeId, options);
|
|
14726
|
+
},
|
|
14727
|
+
createFeedback(exchangeId, options) {
|
|
14728
|
+
if (!conversationData.id)
|
|
14729
|
+
throw new Error('Conversation ID is undefined');
|
|
14730
|
+
if (!exchangeService)
|
|
14731
|
+
throw new Error('Exchange methods are not available.');
|
|
14732
|
+
return exchangeService.createFeedback(conversationData.id, exchangeId, options);
|
|
14733
|
+
}
|
|
14734
|
+
},
|
|
14735
|
+
async update(options) {
|
|
14736
|
+
if (!conversationData.id)
|
|
14737
|
+
throw new Error('Conversation ID is undefined');
|
|
14738
|
+
return service.updateById(conversationData.id, options);
|
|
14739
|
+
},
|
|
14740
|
+
async delete() {
|
|
14741
|
+
if (!conversationData.id)
|
|
14742
|
+
throw new Error('Conversation ID is undefined');
|
|
14743
|
+
return service.deleteById(conversationData.id);
|
|
14744
|
+
},
|
|
14745
|
+
startSession(options) {
|
|
14746
|
+
if (!conversationData.id)
|
|
14747
|
+
throw new Error('Conversation ID is undefined');
|
|
14748
|
+
if (!sessionMethods) {
|
|
14749
|
+
throw new Error('Session methods are not available. Use ConversationService to create conversations with session support.');
|
|
14750
|
+
}
|
|
14751
|
+
return sessionMethods.startSession(conversationData.id, options);
|
|
14752
|
+
},
|
|
14753
|
+
getSession() {
|
|
14754
|
+
if (!conversationData.id)
|
|
14755
|
+
throw new Error('Conversation ID is undefined');
|
|
14756
|
+
if (!sessionMethods) {
|
|
14757
|
+
throw new Error('Session methods are not available. Use ConversationService to create conversations with session support.');
|
|
14758
|
+
}
|
|
14759
|
+
return sessionMethods.getSession(conversationData.id);
|
|
14760
|
+
},
|
|
14761
|
+
endSession() {
|
|
14762
|
+
if (!conversationData.id)
|
|
14763
|
+
throw new Error('Conversation ID is undefined');
|
|
14764
|
+
if (!sessionMethods) {
|
|
14765
|
+
throw new Error('Session methods are not available. Use ConversationService to create conversations with session support.');
|
|
14766
|
+
}
|
|
14767
|
+
sessionMethods.endSession(conversationData.id);
|
|
14768
|
+
},
|
|
14769
|
+
async uploadAttachment(file) {
|
|
14770
|
+
if (!conversationData.id)
|
|
14771
|
+
throw new Error('Conversation ID is undefined');
|
|
14772
|
+
return service.uploadAttachment(conversationData.id, file);
|
|
14773
|
+
}
|
|
14774
|
+
};
|
|
14775
|
+
}
|
|
14776
|
+
/**
|
|
14777
|
+
* Creates an actionable conversation by combining API conversation data with operational methods.
|
|
14778
|
+
*
|
|
14779
|
+
* @param conversationData - The conversation data from API
|
|
14780
|
+
* @param service - The conversation service instance
|
|
14781
|
+
* @param sessionMethods - Optional session methods for WebSocket session operations
|
|
14782
|
+
* @param exchangeService - Optional exchange service for scoped exchange methods
|
|
14783
|
+
* @returns A conversation object with added methods
|
|
14784
|
+
*/
|
|
14785
|
+
function createConversationWithMethods(conversationData, service, sessionMethods, exchangeService) {
|
|
14786
|
+
const methods = createConversationMethods(conversationData, service, sessionMethods, exchangeService);
|
|
14787
|
+
return Object.assign({}, conversationData, methods);
|
|
14788
|
+
}
|
|
14789
|
+
|
|
14790
|
+
/**
|
|
14791
|
+
* Agent Service Models
|
|
14792
|
+
*
|
|
14793
|
+
* Provides fluent API for agent objects returned from getAll() and getById().
|
|
14794
|
+
*/
|
|
14795
|
+
/**
|
|
14796
|
+
* Creates methods for an agent
|
|
14797
|
+
*
|
|
14798
|
+
* @param agentData - The agent data from API
|
|
14799
|
+
* @param conversationService - The conversation service instance for delegation
|
|
14800
|
+
* @returns Object containing agent methods
|
|
14801
|
+
*/
|
|
14802
|
+
function createAgentMethods(agentData, conversationService) {
|
|
14803
|
+
const agentConversations = {
|
|
14804
|
+
async create(options = {}) {
|
|
14805
|
+
return conversationService.create(agentData.id, agentData.folderId, options);
|
|
14806
|
+
}
|
|
14807
|
+
};
|
|
14808
|
+
return {
|
|
14809
|
+
conversations: agentConversations,
|
|
14810
|
+
get connectionStatus() { return conversationService.connectionStatus; },
|
|
14811
|
+
get isConnected() { return conversationService.isConnected; },
|
|
14812
|
+
get connectionError() { return conversationService.connectionError; }
|
|
14813
|
+
};
|
|
14814
|
+
}
|
|
14815
|
+
function createAgentWithMethods(agentData, conversationService) {
|
|
14816
|
+
const methods = createAgentMethods(agentData, conversationService);
|
|
14817
|
+
return Object.defineProperties(Object.assign({}, agentData), Object.getOwnPropertyDescriptors(methods));
|
|
14818
|
+
}
|
|
14819
|
+
|
|
14820
|
+
/**
|
|
14821
|
+
* Constants for Agent Service
|
|
14822
|
+
*/
|
|
14823
|
+
/**
|
|
14824
|
+
* Maps fields for Agent entities to ensure consistent SDK naming
|
|
14825
|
+
*/
|
|
14826
|
+
const AgentMap = {
|
|
14827
|
+
...CommonFieldMap
|
|
14828
|
+
};
|
|
14829
|
+
|
|
14830
|
+
/**
|
|
14831
|
+
* Constants for User Service
|
|
14832
|
+
*/
|
|
14833
|
+
/**
|
|
14834
|
+
* Maps fields for User Settings entities to ensure consistent SDK naming
|
|
14835
|
+
*/
|
|
14836
|
+
const UserSettingsMap = {
|
|
14837
|
+
...CommonFieldMap
|
|
14838
|
+
};
|
|
14839
|
+
|
|
14521
14840
|
exports.APP_NAME = APP_NAME;
|
|
14841
|
+
exports.AgentMap = AgentMap;
|
|
14522
14842
|
exports.AuthenticationError = AuthenticationError;
|
|
14523
14843
|
exports.AuthorizationError = AuthorizationError;
|
|
14524
14844
|
exports.CLOUD_CLIENT_ID = CLOUD_CLIENT_ID;
|
|
@@ -14528,12 +14848,15 @@
|
|
|
14528
14848
|
exports.CLOUD_TENANT_NAME = CLOUD_TENANT_NAME;
|
|
14529
14849
|
exports.CLOUD_URL = CLOUD_URL;
|
|
14530
14850
|
exports.CONNECTION_STRING = CONNECTION_STRING;
|
|
14851
|
+
exports.ConversationMap = ConversationMap;
|
|
14531
14852
|
exports.DEFAULT_ITEMS_FIELD = DEFAULT_ITEMS_FIELD;
|
|
14532
14853
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
14533
14854
|
exports.DEFAULT_TOTAL_COUNT_FIELD = DEFAULT_TOTAL_COUNT_FIELD;
|
|
14534
14855
|
exports.ErrorType = ErrorType;
|
|
14856
|
+
exports.ExchangeMap = ExchangeMap;
|
|
14535
14857
|
exports.HttpStatus = HttpStatus;
|
|
14536
14858
|
exports.MAX_PAGE_SIZE = MAX_PAGE_SIZE;
|
|
14859
|
+
exports.MessageMap = MessageMap;
|
|
14537
14860
|
exports.NetworkError = NetworkError;
|
|
14538
14861
|
exports.NotFoundError = NotFoundError;
|
|
14539
14862
|
exports.RateLimitError = RateLimitError;
|
|
@@ -14546,9 +14869,12 @@
|
|
|
14546
14869
|
exports.UNKNOWN = UNKNOWN$1;
|
|
14547
14870
|
exports.UiPath = UiPath;
|
|
14548
14871
|
exports.UiPathError = UiPathError;
|
|
14872
|
+
exports.UserSettingsMap = UserSettingsMap;
|
|
14549
14873
|
exports.VERSION = VERSION;
|
|
14550
14874
|
exports.ValidationError = ValidationError;
|
|
14875
|
+
exports.createAgentWithMethods = createAgentWithMethods;
|
|
14551
14876
|
exports.createCaseInstanceWithMethods = createCaseInstanceWithMethods;
|
|
14877
|
+
exports.createConversationWithMethods = createConversationWithMethods;
|
|
14552
14878
|
exports.createEntityWithMethods = createEntityWithMethods;
|
|
14553
14879
|
exports.createProcessInstanceWithMethods = createProcessInstanceWithMethods;
|
|
14554
14880
|
exports.createProcessWithMethods = createProcessWithMethods;
|