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