@uipath/uipath-typescript 1.0.0 → 1.1.1
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 +1264 -1111
- package/dist/core/index.d.ts +111 -11
- package/dist/core/index.mjs +1247 -1112
- package/dist/entities/index.cjs +199 -221
- package/dist/entities/index.mjs +199 -221
- package/dist/index.cjs +799 -435
- package/dist/index.d.ts +4403 -64
- package/dist/index.mjs +793 -436
- package/dist/index.umd.js +799 -435
- 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/processes/index.mjs
CHANGED
|
@@ -43,40 +43,31 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* Pure TypeScript class with clean interface
|
|
46
|
+
* Type guards for error response types
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* Returns detailed debug information including stack trace
|
|
73
|
-
*/
|
|
74
|
-
getDebugInfo() {
|
|
75
|
-
return {
|
|
76
|
-
...this.toJSON(),
|
|
77
|
-
stack: this.stack
|
|
78
|
-
};
|
|
79
|
-
}
|
|
48
|
+
function isOrchestratorError(error) {
|
|
49
|
+
return typeof error === 'object' &&
|
|
50
|
+
error !== null &&
|
|
51
|
+
'message' in error &&
|
|
52
|
+
'errorCode' in error &&
|
|
53
|
+
typeof error.message === 'string' &&
|
|
54
|
+
typeof error.errorCode === 'number';
|
|
55
|
+
}
|
|
56
|
+
function isEntityError(error) {
|
|
57
|
+
return typeof error === 'object' &&
|
|
58
|
+
error !== null &&
|
|
59
|
+
'error' in error &&
|
|
60
|
+
typeof error.error === 'string';
|
|
61
|
+
}
|
|
62
|
+
function isPimsError(error) {
|
|
63
|
+
return typeof error === 'object' &&
|
|
64
|
+
error !== null &&
|
|
65
|
+
'type' in error &&
|
|
66
|
+
'title' in error &&
|
|
67
|
+
'status' in error &&
|
|
68
|
+
typeof error.type === 'string' &&
|
|
69
|
+
typeof error.title === 'string' &&
|
|
70
|
+
typeof error.status === 'number';
|
|
80
71
|
}
|
|
81
72
|
|
|
82
73
|
/**
|
|
@@ -140,161 +131,6 @@ const ErrorMessages = {
|
|
|
140
131
|
const ErrorNames = {
|
|
141
132
|
ABORT_ERROR: 'AbortError'};
|
|
142
133
|
|
|
143
|
-
/**
|
|
144
|
-
* Error thrown when authentication fails (401 errors)
|
|
145
|
-
* Common scenarios:
|
|
146
|
-
* - Invalid credentials
|
|
147
|
-
* - Expired token
|
|
148
|
-
* - Missing authentication
|
|
149
|
-
*/
|
|
150
|
-
class AuthenticationError extends UiPathError {
|
|
151
|
-
constructor(params = {}) {
|
|
152
|
-
super(ErrorType.AUTHENTICATION, {
|
|
153
|
-
message: params.message || ErrorMessages.AUTHENTICATION_FAILED,
|
|
154
|
-
statusCode: params.statusCode ?? HttpStatus.UNAUTHORIZED,
|
|
155
|
-
requestId: params.requestId
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Error thrown when authorization fails (403 errors)
|
|
162
|
-
* Common scenarios:
|
|
163
|
-
* - Insufficient permissions
|
|
164
|
-
* - Access denied to resource
|
|
165
|
-
* - Invalid scope
|
|
166
|
-
*/
|
|
167
|
-
class AuthorizationError extends UiPathError {
|
|
168
|
-
constructor(params = {}) {
|
|
169
|
-
super(ErrorType.AUTHORIZATION, {
|
|
170
|
-
message: params.message || ErrorMessages.ACCESS_DENIED,
|
|
171
|
-
statusCode: params.statusCode ?? HttpStatus.FORBIDDEN,
|
|
172
|
-
requestId: params.requestId
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Error thrown when validation fails (400 errors or client-side validation)
|
|
179
|
-
* Common scenarios:
|
|
180
|
-
* - Invalid input parameters
|
|
181
|
-
* - Missing required fields
|
|
182
|
-
* - Invalid data format
|
|
183
|
-
*/
|
|
184
|
-
class ValidationError extends UiPathError {
|
|
185
|
-
constructor(params = {}) {
|
|
186
|
-
super(ErrorType.VALIDATION, {
|
|
187
|
-
message: params.message || ErrorMessages.VALIDATION_FAILED,
|
|
188
|
-
statusCode: params.statusCode ?? HttpStatus.BAD_REQUEST,
|
|
189
|
-
requestId: params.requestId
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Error thrown when a resource is not found (404 errors)
|
|
196
|
-
* Common scenarios:
|
|
197
|
-
* - Resource doesn't exist
|
|
198
|
-
* - Invalid ID provided
|
|
199
|
-
* - Resource deleted
|
|
200
|
-
*/
|
|
201
|
-
class NotFoundError extends UiPathError {
|
|
202
|
-
constructor(params = {}) {
|
|
203
|
-
super(ErrorType.NOT_FOUND, {
|
|
204
|
-
message: params.message || ErrorMessages.RESOURCE_NOT_FOUND,
|
|
205
|
-
statusCode: params.statusCode ?? HttpStatus.NOT_FOUND,
|
|
206
|
-
requestId: params.requestId
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Error thrown when rate limit is exceeded (429 errors)
|
|
213
|
-
* Common scenarios:
|
|
214
|
-
* - Too many requests in a time window
|
|
215
|
-
* - API throttling
|
|
216
|
-
*/
|
|
217
|
-
class RateLimitError extends UiPathError {
|
|
218
|
-
constructor(params = {}) {
|
|
219
|
-
super(ErrorType.RATE_LIMIT, {
|
|
220
|
-
message: params.message || ErrorMessages.RATE_LIMIT_EXCEEDED,
|
|
221
|
-
statusCode: params.statusCode ?? HttpStatus.TOO_MANY_REQUESTS,
|
|
222
|
-
requestId: params.requestId
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Error thrown when server encounters an error (5xx errors)
|
|
229
|
-
* Common scenarios:
|
|
230
|
-
* - Internal server error
|
|
231
|
-
* - Service unavailable
|
|
232
|
-
* - Gateway timeout
|
|
233
|
-
*/
|
|
234
|
-
class ServerError extends UiPathError {
|
|
235
|
-
constructor(params = {}) {
|
|
236
|
-
super(ErrorType.SERVER, {
|
|
237
|
-
message: params.message || ErrorMessages.INTERNAL_SERVER_ERROR,
|
|
238
|
-
statusCode: params.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR,
|
|
239
|
-
requestId: params.requestId
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Checks if this is a temporary error that might succeed on retry
|
|
244
|
-
*/
|
|
245
|
-
get isRetryable() {
|
|
246
|
-
return this.statusCode === HttpStatus.BAD_GATEWAY ||
|
|
247
|
-
this.statusCode === HttpStatus.SERVICE_UNAVAILABLE ||
|
|
248
|
-
this.statusCode === HttpStatus.GATEWAY_TIMEOUT;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Error thrown when network/connection issues occur
|
|
254
|
-
* Common scenarios:
|
|
255
|
-
* - Connection timeout
|
|
256
|
-
* - DNS resolution failure
|
|
257
|
-
* - Network unreachable
|
|
258
|
-
* - Request aborted
|
|
259
|
-
*/
|
|
260
|
-
class NetworkError extends UiPathError {
|
|
261
|
-
constructor(params = {}) {
|
|
262
|
-
super(ErrorType.NETWORK, {
|
|
263
|
-
message: params.message || ErrorMessages.NETWORK_ERROR,
|
|
264
|
-
statusCode: params.statusCode, // Network errors typically don't have HTTP status codes
|
|
265
|
-
requestId: params.requestId
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Type guards for error response types
|
|
272
|
-
*/
|
|
273
|
-
function isOrchestratorError(error) {
|
|
274
|
-
return typeof error === 'object' &&
|
|
275
|
-
error !== null &&
|
|
276
|
-
'message' in error &&
|
|
277
|
-
'errorCode' in error &&
|
|
278
|
-
typeof error.message === 'string' &&
|
|
279
|
-
typeof error.errorCode === 'number';
|
|
280
|
-
}
|
|
281
|
-
function isEntityError(error) {
|
|
282
|
-
return typeof error === 'object' &&
|
|
283
|
-
error !== null &&
|
|
284
|
-
'error' in error &&
|
|
285
|
-
typeof error.error === 'string';
|
|
286
|
-
}
|
|
287
|
-
function isPimsError(error) {
|
|
288
|
-
return typeof error === 'object' &&
|
|
289
|
-
error !== null &&
|
|
290
|
-
'type' in error &&
|
|
291
|
-
'title' in error &&
|
|
292
|
-
'status' in error &&
|
|
293
|
-
typeof error.type === 'string' &&
|
|
294
|
-
typeof error.title === 'string' &&
|
|
295
|
-
typeof error.status === 'number';
|
|
296
|
-
}
|
|
297
|
-
|
|
298
134
|
/**
|
|
299
135
|
* Parser for Orchestrator/Task error format
|
|
300
136
|
*/
|
|
@@ -445,6 +281,173 @@ class ErrorResponseParser {
|
|
|
445
281
|
// Export singleton instance
|
|
446
282
|
const errorResponseParser = new ErrorResponseParser();
|
|
447
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Base error class for all UiPath SDK errors
|
|
286
|
+
* Extends Error for standard error handling compatibility
|
|
287
|
+
*/
|
|
288
|
+
class UiPathError extends Error {
|
|
289
|
+
constructor(type, params) {
|
|
290
|
+
super(params.message);
|
|
291
|
+
this.name = type;
|
|
292
|
+
this.type = type;
|
|
293
|
+
this.statusCode = params.statusCode;
|
|
294
|
+
this.requestId = params.requestId;
|
|
295
|
+
this.timestamp = new Date();
|
|
296
|
+
// Maintains proper stack trace for where our error was thrown
|
|
297
|
+
if (Error.captureStackTrace) {
|
|
298
|
+
Error.captureStackTrace(this, this.constructor);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Returns a clean JSON representation of the error
|
|
303
|
+
*/
|
|
304
|
+
toJSON() {
|
|
305
|
+
return {
|
|
306
|
+
type: this.type,
|
|
307
|
+
message: this.message,
|
|
308
|
+
statusCode: this.statusCode,
|
|
309
|
+
requestId: this.requestId,
|
|
310
|
+
timestamp: this.timestamp
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Returns detailed debug information including stack trace
|
|
315
|
+
*/
|
|
316
|
+
getDebugInfo() {
|
|
317
|
+
return {
|
|
318
|
+
...this.toJSON(),
|
|
319
|
+
stack: this.stack
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Error thrown when authentication fails (401 errors)
|
|
326
|
+
* Common scenarios:
|
|
327
|
+
* - Invalid credentials
|
|
328
|
+
* - Expired token
|
|
329
|
+
* - Missing authentication
|
|
330
|
+
*/
|
|
331
|
+
class AuthenticationError extends UiPathError {
|
|
332
|
+
constructor(params = {}) {
|
|
333
|
+
super(ErrorType.AUTHENTICATION, {
|
|
334
|
+
message: params.message || ErrorMessages.AUTHENTICATION_FAILED,
|
|
335
|
+
statusCode: params.statusCode ?? HttpStatus.UNAUTHORIZED,
|
|
336
|
+
requestId: params.requestId
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Error thrown when authorization fails (403 errors)
|
|
343
|
+
* Common scenarios:
|
|
344
|
+
* - Insufficient permissions
|
|
345
|
+
* - Access denied to resource
|
|
346
|
+
* - Invalid scope
|
|
347
|
+
*/
|
|
348
|
+
class AuthorizationError extends UiPathError {
|
|
349
|
+
constructor(params = {}) {
|
|
350
|
+
super(ErrorType.AUTHORIZATION, {
|
|
351
|
+
message: params.message || ErrorMessages.ACCESS_DENIED,
|
|
352
|
+
statusCode: params.statusCode ?? HttpStatus.FORBIDDEN,
|
|
353
|
+
requestId: params.requestId
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Error thrown when validation fails (400 errors or client-side validation)
|
|
360
|
+
* Common scenarios:
|
|
361
|
+
* - Invalid input parameters
|
|
362
|
+
* - Missing required fields
|
|
363
|
+
* - Invalid data format
|
|
364
|
+
*/
|
|
365
|
+
class ValidationError extends UiPathError {
|
|
366
|
+
constructor(params = {}) {
|
|
367
|
+
super(ErrorType.VALIDATION, {
|
|
368
|
+
message: params.message || ErrorMessages.VALIDATION_FAILED,
|
|
369
|
+
statusCode: params.statusCode ?? HttpStatus.BAD_REQUEST,
|
|
370
|
+
requestId: params.requestId
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Error thrown when a resource is not found (404 errors)
|
|
377
|
+
* Common scenarios:
|
|
378
|
+
* - Resource doesn't exist
|
|
379
|
+
* - Invalid ID provided
|
|
380
|
+
* - Resource deleted
|
|
381
|
+
*/
|
|
382
|
+
class NotFoundError extends UiPathError {
|
|
383
|
+
constructor(params = {}) {
|
|
384
|
+
super(ErrorType.NOT_FOUND, {
|
|
385
|
+
message: params.message || ErrorMessages.RESOURCE_NOT_FOUND,
|
|
386
|
+
statusCode: params.statusCode ?? HttpStatus.NOT_FOUND,
|
|
387
|
+
requestId: params.requestId
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Error thrown when rate limit is exceeded (429 errors)
|
|
394
|
+
* Common scenarios:
|
|
395
|
+
* - Too many requests in a time window
|
|
396
|
+
* - API throttling
|
|
397
|
+
*/
|
|
398
|
+
class RateLimitError extends UiPathError {
|
|
399
|
+
constructor(params = {}) {
|
|
400
|
+
super(ErrorType.RATE_LIMIT, {
|
|
401
|
+
message: params.message || ErrorMessages.RATE_LIMIT_EXCEEDED,
|
|
402
|
+
statusCode: params.statusCode ?? HttpStatus.TOO_MANY_REQUESTS,
|
|
403
|
+
requestId: params.requestId
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Error thrown when server encounters an error (5xx errors)
|
|
410
|
+
* Common scenarios:
|
|
411
|
+
* - Internal server error
|
|
412
|
+
* - Service unavailable
|
|
413
|
+
* - Gateway timeout
|
|
414
|
+
*/
|
|
415
|
+
class ServerError extends UiPathError {
|
|
416
|
+
constructor(params = {}) {
|
|
417
|
+
super(ErrorType.SERVER, {
|
|
418
|
+
message: params.message || ErrorMessages.INTERNAL_SERVER_ERROR,
|
|
419
|
+
statusCode: params.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR,
|
|
420
|
+
requestId: params.requestId
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Checks if this is a temporary error that might succeed on retry
|
|
425
|
+
*/
|
|
426
|
+
get isRetryable() {
|
|
427
|
+
return this.statusCode === HttpStatus.BAD_GATEWAY ||
|
|
428
|
+
this.statusCode === HttpStatus.SERVICE_UNAVAILABLE ||
|
|
429
|
+
this.statusCode === HttpStatus.GATEWAY_TIMEOUT;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Error thrown when network/connection issues occur
|
|
435
|
+
* Common scenarios:
|
|
436
|
+
* - Connection timeout
|
|
437
|
+
* - DNS resolution failure
|
|
438
|
+
* - Network unreachable
|
|
439
|
+
* - Request aborted
|
|
440
|
+
*/
|
|
441
|
+
class NetworkError extends UiPathError {
|
|
442
|
+
constructor(params = {}) {
|
|
443
|
+
super(ErrorType.NETWORK, {
|
|
444
|
+
message: params.message || ErrorMessages.NETWORK_ERROR,
|
|
445
|
+
statusCode: params.statusCode, // Network errors typically don't have HTTP status codes
|
|
446
|
+
requestId: params.requestId
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
448
451
|
/**
|
|
449
452
|
* Factory for creating typed errors based on HTTP status codes
|
|
450
453
|
* Follows the Factory pattern for clean error instantiation
|
|
@@ -538,29 +541,7 @@ class ApiClient {
|
|
|
538
541
|
* @throws AuthenticationError if no token available or refresh fails
|
|
539
542
|
*/
|
|
540
543
|
async getValidToken() {
|
|
541
|
-
|
|
542
|
-
const tokenInfo = this.executionContext.get('tokenInfo');
|
|
543
|
-
if (!tokenInfo) {
|
|
544
|
-
throw new AuthenticationError({ message: 'No authentication token available. Make sure to initialize the SDK first.' });
|
|
545
|
-
}
|
|
546
|
-
// For secret-based tokens, they never expire
|
|
547
|
-
if (tokenInfo.type === 'secret') {
|
|
548
|
-
return tokenInfo.token;
|
|
549
|
-
}
|
|
550
|
-
// If token is not expired, return it
|
|
551
|
-
if (!this.tokenManager.isTokenExpired(tokenInfo)) {
|
|
552
|
-
return tokenInfo.token;
|
|
553
|
-
}
|
|
554
|
-
try {
|
|
555
|
-
const newToken = await this.tokenManager.refreshAccessToken();
|
|
556
|
-
return newToken.access_token;
|
|
557
|
-
}
|
|
558
|
-
catch (error) {
|
|
559
|
-
throw new AuthenticationError({
|
|
560
|
-
message: `Token refresh failed: ${error.message}. Please re-authenticate.`,
|
|
561
|
-
statusCode: HttpStatus.UNAUTHORIZED
|
|
562
|
-
});
|
|
563
|
-
}
|
|
544
|
+
return this.tokenManager.getValidToken();
|
|
564
545
|
}
|
|
565
546
|
async getDefaultHeaders() {
|
|
566
547
|
// Get headers from execution context first
|
|
@@ -1070,6 +1051,51 @@ function reverseMap(map) {
|
|
|
1070
1051
|
return acc;
|
|
1071
1052
|
}, {});
|
|
1072
1053
|
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Transforms request data from SDK field names to API field names.
|
|
1056
|
+
*
|
|
1057
|
+
* This is the inverse of `transformData` - while `transformData` converts
|
|
1058
|
+
* API responses to SDK format (API → SDK), this function converts SDK
|
|
1059
|
+
* requests to API format (SDK → API).
|
|
1060
|
+
*
|
|
1061
|
+
* @param data The request data with SDK field names
|
|
1062
|
+
* @param responseMap The response mapping (API → SDK) - will be automatically reversed
|
|
1063
|
+
* @returns A new object with API field names
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* // Response map: API field → SDK field
|
|
1068
|
+
* const ProcessMap = { releaseKey: 'processKey', releaseName: 'processName' };
|
|
1069
|
+
*
|
|
1070
|
+
* // SDK request with SDK field names
|
|
1071
|
+
* const sdkRequest = { processKey: 'abc-123', processName: 'MyProcess' };
|
|
1072
|
+
*
|
|
1073
|
+
* // Transform to API format
|
|
1074
|
+
* const apiRequest = transformRequest(sdkRequest, ProcessMap);
|
|
1075
|
+
* // Result: { releaseKey: 'abc-123', releaseName: 'MyProcess' }
|
|
1076
|
+
* ```
|
|
1077
|
+
*
|
|
1078
|
+
* @example
|
|
1079
|
+
* ```typescript
|
|
1080
|
+
* // Conversation example
|
|
1081
|
+
* const ConversationMap = { agentReleaseId: 'agentId' };
|
|
1082
|
+
*
|
|
1083
|
+
* const sdkOptions = { agentId: 123, folderId: 456, label: 'My Chat' };
|
|
1084
|
+
* const apiPayload = transformRequest(sdkOptions, ConversationMap);
|
|
1085
|
+
* // Result: { agentReleaseId: 123, folderId: 456, label: 'My Chat' }
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
function transformRequest(data, responseMap) {
|
|
1089
|
+
const result = { ...data };
|
|
1090
|
+
const requestMap = reverseMap(responseMap);
|
|
1091
|
+
for (const [sdkField, apiField] of Object.entries(requestMap)) {
|
|
1092
|
+
if (sdkField in result) {
|
|
1093
|
+
result[apiField] = result[sdkField];
|
|
1094
|
+
delete result[sdkField];
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return result;
|
|
1098
|
+
}
|
|
1073
1099
|
|
|
1074
1100
|
/**
|
|
1075
1101
|
* Constants used throughout the pagination system
|
|
@@ -1293,10 +1319,7 @@ class PaginationHelpers {
|
|
|
1293
1319
|
*/
|
|
1294
1320
|
static async getAll(config, options) {
|
|
1295
1321
|
const optionsWithDefaults = options || {};
|
|
1296
|
-
const { folderId, ...restOptions } = optionsWithDefaults;
|
|
1297
|
-
const cursor = options?.cursor;
|
|
1298
|
-
const pageSize = options?.pageSize;
|
|
1299
|
-
const jumpToPage = options?.jumpToPage;
|
|
1322
|
+
const { folderId, pageSize, cursor, jumpToPage, ...restOptions } = optionsWithDefaults;
|
|
1300
1323
|
// Determine if pagination is requested
|
|
1301
1324
|
const isPaginationRequested = PaginationHelpers.hasPaginationParameters(options || {});
|
|
1302
1325
|
// Process parameters (custom processing if provided, otherwise default)
|
|
@@ -1666,14 +1689,14 @@ const ProcessMap = {
|
|
|
1666
1689
|
isProcessDeleted: 'isPackageDeleted',
|
|
1667
1690
|
};
|
|
1668
1691
|
|
|
1669
|
-
/**
|
|
1670
|
-
* API Endpoint Constants
|
|
1671
|
-
* Centralized location for all API endpoints used throughout the SDK
|
|
1672
|
-
*/
|
|
1673
1692
|
/**
|
|
1674
1693
|
* Base path constants for different services
|
|
1675
1694
|
*/
|
|
1676
1695
|
const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* Orchestrator Service Endpoints
|
|
1699
|
+
*/
|
|
1677
1700
|
/**
|
|
1678
1701
|
* Orchestrator Process Service Endpoints
|
|
1679
1702
|
*/
|
|
@@ -1689,7 +1712,7 @@ const PROCESS_ENDPOINTS = {
|
|
|
1689
1712
|
// Connection string placeholder that will be replaced during build
|
|
1690
1713
|
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";
|
|
1691
1714
|
// SDK Version placeholder
|
|
1692
|
-
const SDK_VERSION = "1.
|
|
1715
|
+
const SDK_VERSION = "1.1.1";
|
|
1693
1716
|
const VERSION = "Version";
|
|
1694
1717
|
const SERVICE = "Service";
|
|
1695
1718
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1866,7 +1889,6 @@ class TelemetryClient {
|
|
|
1866
1889
|
*/
|
|
1867
1890
|
getEnrichedAttributes(extraAttributes, eventName) {
|
|
1868
1891
|
const attributes = {
|
|
1869
|
-
...extraAttributes,
|
|
1870
1892
|
[APP_NAME]: SDK_SERVICE_NAME,
|
|
1871
1893
|
[VERSION]: SDK_VERSION,
|
|
1872
1894
|
[SERVICE]: eventName,
|
|
@@ -1875,6 +1897,7 @@ class TelemetryClient {
|
|
|
1875
1897
|
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
1876
1898
|
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
1877
1899
|
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
1900
|
+
...extraAttributes,
|
|
1878
1901
|
};
|
|
1879
1902
|
return attributes;
|
|
1880
1903
|
}
|
|
@@ -2052,17 +2075,8 @@ class ProcessService extends BaseService {
|
|
|
2052
2075
|
*/
|
|
2053
2076
|
async start(request, folderId, options = {}) {
|
|
2054
2077
|
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2055
|
-
// Transform
|
|
2056
|
-
const apiRequest =
|
|
2057
|
-
// Create a reverse mapping using ProcessMap
|
|
2058
|
-
const reversedPropertiesMap = reverseMap(ProcessMap);
|
|
2059
|
-
// Apply transformations for any client properties found in the request
|
|
2060
|
-
Object.entries(reversedPropertiesMap).forEach(([clientKey, apiKey]) => {
|
|
2061
|
-
if (clientKey in apiRequest) {
|
|
2062
|
-
apiRequest[apiKey] = apiRequest[clientKey];
|
|
2063
|
-
delete apiRequest[clientKey];
|
|
2064
|
-
}
|
|
2065
|
-
});
|
|
2078
|
+
// Transform SDK field names to API field names (e.g., processKey → releaseKey)
|
|
2079
|
+
const apiRequest = transformRequest(request, ProcessMap);
|
|
2066
2080
|
// Create the request object according to API spec
|
|
2067
2081
|
const requestBody = {
|
|
2068
2082
|
startInfo: apiRequest
|