@uipath/uipath-typescript 1.0.0-beta.18 → 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.
Files changed (39) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +100 -40
  3. package/dist/assets/index.cjs +2068 -0
  4. package/dist/assets/index.d.ts +513 -0
  5. package/dist/assets/index.mjs +2065 -0
  6. package/dist/buckets/index.cjs +2342 -0
  7. package/dist/buckets/index.d.ts +819 -0
  8. package/dist/buckets/index.mjs +2339 -0
  9. package/dist/cases/index.cjs +3475 -0
  10. package/dist/cases/index.d.ts +1397 -0
  11. package/dist/cases/index.mjs +3469 -0
  12. package/dist/conversational-agent/index.cjs +6622 -0
  13. package/dist/conversational-agent/index.d.ts +6579 -0
  14. package/dist/conversational-agent/index.mjs +6575 -0
  15. package/dist/core/index.cjs +5305 -0
  16. package/dist/core/index.d.ts +398 -0
  17. package/dist/core/index.mjs +5279 -0
  18. package/dist/entities/index.cjs +2727 -0
  19. package/dist/entities/index.d.ts +1513 -0
  20. package/dist/entities/index.mjs +2721 -0
  21. package/dist/index.cjs +3651 -2935
  22. package/dist/index.d.ts +5341 -590
  23. package/dist/index.mjs +3644 -2935
  24. package/dist/index.umd.js +8118 -11244
  25. package/dist/maestro-processes/index.cjs +2587 -0
  26. package/dist/maestro-processes/index.d.ts +1127 -0
  27. package/dist/maestro-processes/index.mjs +2578 -0
  28. package/dist/processes/index.cjs +2247 -0
  29. package/dist/processes/index.d.ts +800 -0
  30. package/dist/processes/index.mjs +2244 -0
  31. package/dist/queues/index.cjs +2053 -0
  32. package/dist/queues/index.d.ts +504 -0
  33. package/dist/queues/index.mjs +2050 -0
  34. package/dist/tasks/index.cjs +2653 -0
  35. package/dist/tasks/index.d.ts +1122 -0
  36. package/dist/tasks/index.mjs +2649 -0
  37. package/package.json +118 -6
  38. package/dist/index.d.cts +0 -5463
  39. package/dist/index.d.mts +0 -5463
@@ -0,0 +1,2339 @@
1
+ import { BatchLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs';
2
+
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
+
19
+
20
+ function __decorate(decorators, target, key, desc) {
21
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
23
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
24
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
25
+ }
26
+
27
+ function __classPrivateFieldGet(receiver, state, kind, f) {
28
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
+ }
32
+
33
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
34
+ if (kind === "m") throw new TypeError("Private method is not writable");
35
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
36
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
37
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
38
+ }
39
+
40
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
41
+ var e = new Error(message);
42
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
43
+ };
44
+
45
+ /**
46
+ * Type guards for error response types
47
+ */
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';
71
+ }
72
+
73
+ /**
74
+ * HTTP status code constants for error handling
75
+ */
76
+ const HttpStatus = {
77
+ // Client errors (4xx)
78
+ BAD_REQUEST: 400,
79
+ UNAUTHORIZED: 401,
80
+ FORBIDDEN: 403,
81
+ NOT_FOUND: 404,
82
+ TOO_MANY_REQUESTS: 429,
83
+ // Server errors (5xx)
84
+ INTERNAL_SERVER_ERROR: 500,
85
+ BAD_GATEWAY: 502,
86
+ SERVICE_UNAVAILABLE: 503,
87
+ GATEWAY_TIMEOUT: 504
88
+ };
89
+ /**
90
+ * Error type constants for consistent error identification
91
+ */
92
+ const ErrorType = {
93
+ AUTHENTICATION: 'AuthenticationError',
94
+ AUTHORIZATION: 'AuthorizationError',
95
+ VALIDATION: 'ValidationError',
96
+ NOT_FOUND: 'NotFoundError',
97
+ RATE_LIMIT: 'RateLimitError',
98
+ SERVER: 'ServerError',
99
+ NETWORK: 'NetworkError'
100
+ };
101
+ /**
102
+ * HTTP header constants for error handling
103
+ */
104
+ const HttpHeaders = {
105
+ X_REQUEST_ID: 'x-request-id'
106
+ };
107
+ /**
108
+ * Standard error message constants
109
+ */
110
+ const ErrorMessages = {
111
+ // Authentication errors
112
+ AUTHENTICATION_FAILED: 'Authentication failed',
113
+ // Authorization errors
114
+ ACCESS_DENIED: 'Access denied',
115
+ // Validation errors
116
+ VALIDATION_FAILED: 'Validation failed',
117
+ // Not found errors
118
+ RESOURCE_NOT_FOUND: 'Resource not found',
119
+ // Rate limit errors
120
+ RATE_LIMIT_EXCEEDED: 'Rate limit exceeded',
121
+ // Server errors
122
+ INTERNAL_SERVER_ERROR: 'Internal Server error occurred',
123
+ // Network errors
124
+ NETWORK_ERROR: 'Network error occurred',
125
+ REQUEST_TIMEOUT: 'Request timed out',
126
+ REQUEST_ABORTED: 'Request was aborted',
127
+ };
128
+ /**
129
+ * Error name constants for network error identification
130
+ */
131
+ const ErrorNames = {
132
+ ABORT_ERROR: 'AbortError'};
133
+
134
+ /**
135
+ * Parser for Orchestrator/Task error format
136
+ */
137
+ class OrchestratorErrorParser {
138
+ canParse(errorBody) {
139
+ return isOrchestratorError(errorBody);
140
+ }
141
+ parse(errorBody, response) {
142
+ const error = errorBody;
143
+ return {
144
+ message: error.message,
145
+ code: response?.status?.toString(),
146
+ details: {
147
+ errorCode: error.errorCode,
148
+ traceId: error.traceId,
149
+ originalResponse: error
150
+ },
151
+ requestId: error.traceId
152
+ };
153
+ }
154
+ }
155
+ /**
156
+ * Parser for Entity (Data Fabric) error format
157
+ */
158
+ class EntityErrorParser {
159
+ canParse(errorBody) {
160
+ return isEntityError(errorBody);
161
+ }
162
+ parse(errorBody, response) {
163
+ const error = errorBody;
164
+ return {
165
+ message: error.error,
166
+ code: response?.status?.toString(),
167
+ details: {
168
+ error: error.error,
169
+ traceId: error.traceId,
170
+ originalResponse: error
171
+ },
172
+ requestId: error.traceId
173
+ };
174
+ }
175
+ }
176
+ /**
177
+ * Parser for PIMS error format
178
+ */
179
+ class PimsErrorParser {
180
+ canParse(errorBody) {
181
+ return isPimsError(errorBody);
182
+ }
183
+ parse(errorBody, response) {
184
+ const error = errorBody;
185
+ let message = error.title;
186
+ // If there are validation errors, append them to the message for better visibility
187
+ if (error.errors && Object.keys(error.errors).length > 0) {
188
+ const errorMessages = Object.entries(error.errors)
189
+ .map(([field, messages]) => `${field}: ${messages.join(', ')}`)
190
+ .join('; ');
191
+ message += `. Validation errors: ${errorMessages}`;
192
+ }
193
+ return {
194
+ message,
195
+ code: response?.status?.toString(),
196
+ details: {
197
+ type: error.type,
198
+ title: error.title,
199
+ status: error.status,
200
+ errors: error.errors,
201
+ traceId: error.traceId,
202
+ originalResponse: error
203
+ },
204
+ requestId: error.traceId
205
+ };
206
+ }
207
+ }
208
+ /**
209
+ * Fallback parser for unrecognized formats
210
+ */
211
+ class GenericErrorParser {
212
+ canParse(_errorBody) {
213
+ return true; // Always can parse as last resort
214
+ }
215
+ parse(errorBody, response) {
216
+ // For unknown error formats, just pass through the raw error with fallback message
217
+ const message = response?.statusText || 'An error occurred';
218
+ return {
219
+ message,
220
+ code: response?.status?.toString(),
221
+ details: {
222
+ originalResponse: errorBody
223
+ },
224
+ };
225
+ }
226
+ }
227
+ /**
228
+ * Main error response parser using Chain of Responsibility pattern
229
+ *
230
+ * This parser standardizes error responses from different UiPath services into a
231
+ * consistent format, regardless of the original error structure.
232
+ *
233
+ * Supported formats:
234
+ * 1. Orchestrator/Task: { message, errorCode, traceId }
235
+ * 2. Entity (Data Fabric): { error, traceId }
236
+ * 3. PIMS/Maestro: { type, title, status, errors?, traceId? }
237
+ * 4. Generic: Fallback for any other format
238
+ *
239
+ * @example
240
+ * const parser = new ErrorResponseParser();
241
+ * const errorInfo = await parser.parse(response);
242
+ * // errorInfo will have consistent structure regardless of service
243
+ */
244
+ class ErrorResponseParser {
245
+ constructor() {
246
+ this.strategies = [
247
+ new OrchestratorErrorParser(),
248
+ new EntityErrorParser(),
249
+ new PimsErrorParser(),
250
+ new GenericErrorParser() // Must be last
251
+ ];
252
+ }
253
+ /**
254
+ * Parses error response body into standardized format
255
+ * @param response - The HTTP response object
256
+ * @returns Standardized error information
257
+ */
258
+ async parse(response) {
259
+ try {
260
+ const errorBody = await response.json();
261
+ // Find the first strategy that can parse this error format
262
+ const strategy = this.strategies.find(s => s.canParse(errorBody));
263
+ // GenericErrorParser always returns true, so this will never be null
264
+ return strategy.parse(errorBody, response);
265
+ }
266
+ catch {
267
+ // Handle non-JSON responses
268
+ const responseText = await response.text().catch(() => '');
269
+ return {
270
+ message: response.statusText,
271
+ code: response.status.toString(),
272
+ details: {
273
+ parseError: 'Failed to parse error response as JSON',
274
+ responseText
275
+ },
276
+ requestId: response.headers.get(HttpHeaders.X_REQUEST_ID) || undefined
277
+ };
278
+ }
279
+ }
280
+ }
281
+ // Export singleton instance
282
+ const errorResponseParser = new ErrorResponseParser();
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
+
451
+ /**
452
+ * Factory for creating typed errors based on HTTP status codes
453
+ * Follows the Factory pattern for clean error instantiation
454
+ */
455
+ class ErrorFactory {
456
+ /**
457
+ * Creates appropriate error instance based on HTTP status code
458
+ */
459
+ static createFromHttpStatus(statusCode, errorInfo) {
460
+ const { message, requestId } = errorInfo;
461
+ // Map status codes to error types
462
+ switch (statusCode) {
463
+ case HttpStatus.BAD_REQUEST:
464
+ return new ValidationError({ message, statusCode, requestId });
465
+ case HttpStatus.UNAUTHORIZED:
466
+ return new AuthenticationError({ message, statusCode, requestId });
467
+ case HttpStatus.FORBIDDEN:
468
+ return new AuthorizationError({ message, statusCode, requestId });
469
+ case HttpStatus.NOT_FOUND:
470
+ return new NotFoundError({ message, statusCode, requestId });
471
+ case HttpStatus.TOO_MANY_REQUESTS:
472
+ return new RateLimitError({ message, statusCode, requestId });
473
+ default:
474
+ // For 5xx errors or any other status code
475
+ if (statusCode >= HttpStatus.INTERNAL_SERVER_ERROR) {
476
+ return new ServerError({ message, statusCode, requestId });
477
+ }
478
+ // For unknown client errors, treat as validation error
479
+ return new ValidationError({
480
+ message: `${message} (HTTP ${statusCode})`,
481
+ statusCode,
482
+ requestId
483
+ });
484
+ }
485
+ }
486
+ /**
487
+ * Creates a NetworkError from a fetch/network error
488
+ */
489
+ static createNetworkError(error) {
490
+ let message = ErrorMessages.NETWORK_ERROR;
491
+ if (error instanceof Error) {
492
+ if (error.name === ErrorNames.ABORT_ERROR) {
493
+ message = ErrorMessages.REQUEST_ABORTED;
494
+ }
495
+ else if (error.message.includes('timeout')) {
496
+ message = ErrorMessages.REQUEST_TIMEOUT;
497
+ }
498
+ else {
499
+ message = error.message;
500
+ }
501
+ }
502
+ return new NetworkError({ message });
503
+ }
504
+ }
505
+
506
+ const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
507
+ /**
508
+ * Content type constants for HTTP requests/responses
509
+ */
510
+ const CONTENT_TYPES = {
511
+ JSON: 'application/json',
512
+ XML: 'application/xml',
513
+ OCTET_STREAM: 'application/octet-stream'
514
+ };
515
+ /**
516
+ * Response type constants for HTTP requests
517
+ */
518
+ const RESPONSE_TYPES = {
519
+ JSON: 'json',
520
+ TEXT: 'text',
521
+ BLOB: 'blob',
522
+ ARRAYBUFFER: 'arraybuffer'
523
+ };
524
+
525
+ class ApiClient {
526
+ constructor(config, executionContext, tokenManager, clientConfig = {}) {
527
+ this.defaultHeaders = {};
528
+ this.config = config;
529
+ this.executionContext = executionContext;
530
+ this.clientConfig = clientConfig;
531
+ this.tokenManager = tokenManager;
532
+ }
533
+ setDefaultHeaders(headers) {
534
+ this.defaultHeaders = { ...this.defaultHeaders, ...headers };
535
+ }
536
+ /**
537
+ * Gets a valid authentication token, refreshing if necessary.
538
+ * Used internally for API requests and exposed for services that need manual auth headers.
539
+ *
540
+ * @returns The valid token
541
+ * @throws AuthenticationError if no token available or refresh fails
542
+ */
543
+ async getValidToken() {
544
+ return this.tokenManager.getValidToken();
545
+ }
546
+ async getDefaultHeaders() {
547
+ // Get headers from execution context first
548
+ const contextHeaders = this.executionContext.getHeaders();
549
+ // If Authorization header is already set in context, use that
550
+ if (contextHeaders['Authorization']) {
551
+ return {
552
+ ...contextHeaders,
553
+ 'Content-Type': CONTENT_TYPES.JSON,
554
+ ...this.defaultHeaders,
555
+ ...this.clientConfig.headers
556
+ };
557
+ }
558
+ const token = await this.getValidToken();
559
+ return {
560
+ ...contextHeaders,
561
+ 'Authorization': `Bearer ${token}`,
562
+ 'Content-Type': CONTENT_TYPES.JSON,
563
+ ...this.defaultHeaders,
564
+ ...this.clientConfig.headers
565
+ };
566
+ }
567
+ async request(method, path, options = {}) {
568
+ // Ensure path starts with a forward slash
569
+ const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
570
+ // Construct URL with org and tenant names
571
+ const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
572
+ const headers = {
573
+ ...await this.getDefaultHeaders(),
574
+ ...options.headers
575
+ };
576
+ // Convert params to URLSearchParams
577
+ const searchParams = new URLSearchParams();
578
+ if (options.params) {
579
+ Object.entries(options.params).forEach(([key, value]) => {
580
+ searchParams.append(key, value.toString());
581
+ });
582
+ }
583
+ const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
584
+ try {
585
+ const response = await fetch(fullUrl, {
586
+ method,
587
+ headers,
588
+ body: options.body ? JSON.stringify(options.body) : undefined,
589
+ signal: options.signal
590
+ });
591
+ if (!response.ok) {
592
+ const errorInfo = await errorResponseParser.parse(response);
593
+ throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
594
+ }
595
+ if (response.status === 204) {
596
+ return undefined;
597
+ }
598
+ // Handle blob response type for binary data (e.g., file downloads)
599
+ if (options.responseType === RESPONSE_TYPES.BLOB) {
600
+ const blob = await response.blob();
601
+ return blob;
602
+ }
603
+ // Check if we're expecting XML
604
+ const acceptHeader = headers['Accept'] || headers['accept'];
605
+ if (acceptHeader === CONTENT_TYPES.XML) {
606
+ const text = await response.text();
607
+ return text;
608
+ }
609
+ return response.json();
610
+ }
611
+ catch (error) {
612
+ // If it's already one of our errors, re-throw it
613
+ if (error.type && error.type.includes('Error')) {
614
+ throw error;
615
+ }
616
+ // Otherwise, it's likely a network error
617
+ throw ErrorFactory.createNetworkError(error);
618
+ }
619
+ }
620
+ async get(path, options = {}) {
621
+ return this.request('GET', path, options);
622
+ }
623
+ async post(path, data, options = {}) {
624
+ return this.request('POST', path, { ...options, body: data });
625
+ }
626
+ async put(path, data, options = {}) {
627
+ return this.request('PUT', path, { ...options, body: data });
628
+ }
629
+ async patch(path, data, options = {}) {
630
+ return this.request('PATCH', path, { ...options, body: data });
631
+ }
632
+ async delete(path, options = {}) {
633
+ return this.request('DELETE', path, options);
634
+ }
635
+ }
636
+
637
+ /**
638
+ * Pagination types supported by the SDK
639
+ */
640
+ var PaginationType;
641
+ (function (PaginationType) {
642
+ PaginationType["OFFSET"] = "offset";
643
+ PaginationType["TOKEN"] = "token";
644
+ })(PaginationType || (PaginationType = {}));
645
+
646
+ /**
647
+ * Collection of utility functions for working with objects
648
+ */
649
+ /**
650
+ * Filters out undefined values from an object
651
+ * @param obj The source object
652
+ * @returns A new object without undefined values
653
+ *
654
+ * @example
655
+ * ```typescript
656
+ * // Object with undefined values
657
+ * const options = {
658
+ * name: 'test',
659
+ * count: 5,
660
+ * prefix: undefined,
661
+ * suffix: null
662
+ * };
663
+ * const result = filterUndefined(options);
664
+ * // result = { name: 'test', count: 5, suffix: null }
665
+ * ```
666
+ */
667
+ function filterUndefined(obj) {
668
+ const result = {};
669
+ for (const [key, value] of Object.entries(obj)) {
670
+ if (value !== undefined) {
671
+ result[key] = value;
672
+ }
673
+ }
674
+ return result;
675
+ }
676
+
677
+ /**
678
+ * Utility functions for platform detection
679
+ */
680
+ /**
681
+ * Checks if code is running in a browser environment
682
+ */
683
+ const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
684
+
685
+ /**
686
+ * Base64 encoding/decoding
687
+ */
688
+ /**
689
+ * Encodes a string to base64
690
+ * @param str - The string to encode
691
+ * @returns Base64 encoded string
692
+ */
693
+ function encodeBase64(str) {
694
+ // TextEncoder for UTF-8 encoding (works in both browser and Node.js)
695
+ const encoder = new TextEncoder();
696
+ const data = encoder.encode(str);
697
+ // Convert Uint8Array to base64
698
+ if (isBrowser) {
699
+ // Browser environment
700
+ // Convert Uint8Array to binary string then to base64
701
+ const binaryString = Array.from(data, byte => String.fromCharCode(byte)).join('');
702
+ return btoa(binaryString);
703
+ }
704
+ else {
705
+ // Node.js environment
706
+ return Buffer.from(data).toString('base64');
707
+ }
708
+ }
709
+ /**
710
+ * Decodes a base64 string
711
+ * @param base64 - The base64 string to decode
712
+ * @returns Decoded string
713
+ */
714
+ function decodeBase64(base64) {
715
+ let bytes;
716
+ if (isBrowser) {
717
+ // Browser environment
718
+ const binaryString = atob(base64);
719
+ bytes = new Uint8Array(binaryString.length);
720
+ for (let i = 0; i < binaryString.length; i++) {
721
+ bytes[i] = binaryString.charCodeAt(i);
722
+ }
723
+ }
724
+ else {
725
+ // Node.js environment
726
+ bytes = new Uint8Array(Buffer.from(base64, 'base64'));
727
+ }
728
+ // TextDecoder for UTF-8 decoding (works in both browser and Node.js)
729
+ const decoder = new TextDecoder();
730
+ return decoder.decode(bytes);
731
+ }
732
+
733
+ /**
734
+ * PaginationManager handles the conversion between uniform cursor-based pagination
735
+ * and the specific pagination type for each service
736
+ */
737
+ class PaginationManager {
738
+ /**
739
+ * Create a pagination cursor for subsequent page requests
740
+ */
741
+ static createCursor({ pageInfo, type }) {
742
+ if (!pageInfo.hasMore) {
743
+ return undefined;
744
+ }
745
+ const cursorData = {
746
+ type,
747
+ pageSize: pageInfo.pageSize,
748
+ };
749
+ switch (type) {
750
+ case PaginationType.OFFSET:
751
+ if (pageInfo.currentPage) {
752
+ cursorData.pageNumber = pageInfo.currentPage + 1;
753
+ }
754
+ break;
755
+ case PaginationType.TOKEN:
756
+ if (pageInfo.continuationToken) {
757
+ cursorData.continuationToken = pageInfo.continuationToken;
758
+ }
759
+ else {
760
+ return undefined; // No continuation token, can't continue
761
+ }
762
+ break;
763
+ }
764
+ return {
765
+ value: encodeBase64(JSON.stringify(cursorData))
766
+ };
767
+ }
768
+ /**
769
+ * Create a paginated response with navigation cursors
770
+ */
771
+ static createPaginatedResponse({ pageInfo, type }, items) {
772
+ const nextCursor = PaginationManager.createCursor({ pageInfo, type });
773
+ // Create previous page cursor if applicable
774
+ let previousCursor = undefined;
775
+ if (pageInfo.currentPage && pageInfo.currentPage > 1) {
776
+ const prevCursorData = {
777
+ type,
778
+ pageNumber: pageInfo.currentPage - 1,
779
+ pageSize: pageInfo.pageSize,
780
+ };
781
+ previousCursor = {
782
+ value: encodeBase64(JSON.stringify(prevCursorData))
783
+ };
784
+ }
785
+ // Calculate total pages if we have totalCount and pageSize
786
+ let totalPages = undefined;
787
+ if (pageInfo.totalCount !== undefined && pageInfo.pageSize) {
788
+ totalPages = Math.ceil(pageInfo.totalCount / pageInfo.pageSize);
789
+ }
790
+ // Determine if this pagination type supports page jumping
791
+ const supportsPageJump = type === PaginationType.OFFSET;
792
+ // Create the result object with all fields, then filter out undefined values
793
+ const result = filterUndefined({
794
+ items,
795
+ totalCount: pageInfo.totalCount,
796
+ hasNextPage: pageInfo.hasMore,
797
+ nextCursor: nextCursor,
798
+ previousCursor: previousCursor,
799
+ currentPage: pageInfo.currentPage,
800
+ totalPages,
801
+ supportsPageJump
802
+ });
803
+ return result;
804
+ }
805
+ }
806
+
807
+ /**
808
+ * Creates headers object from key-value pairs
809
+ * @param headersObj - Object containing header key-value pairs
810
+ * @returns Headers object with all values converted to strings
811
+ *
812
+ * @example
813
+ * ```typescript
814
+ * // Single header
815
+ * const headers = createHeaders({ 'X-UIPATH-FolderKey': '1234567890' });
816
+ *
817
+ * // Multiple headers
818
+ * const headers = createHeaders({
819
+ * 'X-UIPATH-FolderKey': '1234567890',
820
+ * 'X-UIPATH-OrganizationUnitId': 123,
821
+ * 'Accept': 'application/json'
822
+ * });
823
+ *
824
+ * // Using constants
825
+ * import { FOLDER_KEY, FOLDER_ID } from '../constants/headers';
826
+ * const headers = createHeaders({
827
+ * [FOLDER_KEY]: 'abc-123',
828
+ * [FOLDER_ID]: 456
829
+ * });
830
+ *
831
+ * // Empty headers
832
+ * const headers = createHeaders();
833
+ * ```
834
+ */
835
+ function createHeaders(headersObj) {
836
+ const headers = {};
837
+ for (const [key, value] of Object.entries(headersObj)) {
838
+ if (value !== undefined && value !== null) {
839
+ headers[key] = value.toString();
840
+ }
841
+ }
842
+ return headers;
843
+ }
844
+
845
+ /**
846
+ * Common constants used across the SDK
847
+ */
848
+ /**
849
+ * Prefix used for OData query parameters
850
+ */
851
+ const ODATA_PREFIX = '$';
852
+ /**
853
+ * HTTP methods
854
+ */
855
+ const HTTP_METHODS = {
856
+ GET: 'GET',
857
+ POST: 'POST'};
858
+ /**
859
+ * OData pagination constants
860
+ */
861
+ const ODATA_PAGINATION = {
862
+ /** Default field name for items in a paginated OData response */
863
+ ITEMS_FIELD: 'value',
864
+ /** Default field name for total count in a paginated OData response */
865
+ TOTAL_COUNT_FIELD: '@odata.count'
866
+ };
867
+ /**
868
+ * Bucket pagination constants for token-based pagination
869
+ */
870
+ const BUCKET_PAGINATION = {
871
+ /** Field name for items in bucket file metadata response */
872
+ ITEMS_FIELD: 'items',
873
+ /** Field name for continuation token in bucket file metadata response */
874
+ CONTINUATION_TOKEN_FIELD: 'continuationToken'
875
+ };
876
+ /**
877
+ * OData OFFSET pagination parameter names (ODATA-style)
878
+ */
879
+ const ODATA_OFFSET_PARAMS = {
880
+ /** OData page size parameter name */
881
+ PAGE_SIZE_PARAM: '$top',
882
+ /** OData offset parameter name */
883
+ OFFSET_PARAM: '$skip',
884
+ /** OData count parameter name */
885
+ COUNT_PARAM: '$count'
886
+ };
887
+ /**
888
+ * Bucket TOKEN pagination parameter names
889
+ */
890
+ const BUCKET_TOKEN_PARAMS = {
891
+ /** Bucket page size parameter name */
892
+ PAGE_SIZE_PARAM: 'takeHint',
893
+ /** Bucket token parameter name */
894
+ TOKEN_PARAM: 'continuationToken'
895
+ };
896
+
897
+ /**
898
+ * Transforms data by mapping fields according to the provided field mapping
899
+ * @param data The source data to transform
900
+ * @param fieldMapping Object mapping source field names to target field names
901
+ * @returns Transformed data with mapped field names
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * // Single object transformation
906
+ * const data = { id: '123', userName: 'john' };
907
+ * const mapping = { id: 'userId', userName: 'name' };
908
+ * const result = transformData(data, mapping);
909
+ * // result = { userId: '123', name: 'john' }
910
+ *
911
+ * // Array transformation
912
+ * const dataArray = [
913
+ * { id: '123', userName: 'john' },
914
+ * { id: '456', userName: 'jane' }
915
+ * ];
916
+ * const result = transformData(dataArray, mapping);
917
+ * // result = [
918
+ * // { userId: '123', name: 'john' },
919
+ * // { userId: '456', name: 'jane' }
920
+ * // ]
921
+ * ```
922
+ */
923
+ function transformData(data, fieldMapping) {
924
+ // Handle array of objects
925
+ if (Array.isArray(data)) {
926
+ return data.map(item => transformData(item, fieldMapping));
927
+ }
928
+ // Handle single object
929
+ const result = { ...data };
930
+ for (const [sourceField, targetField] of Object.entries(fieldMapping)) {
931
+ if (sourceField in result) {
932
+ const value = result[sourceField];
933
+ delete result[sourceField];
934
+ result[targetField] = value;
935
+ }
936
+ }
937
+ return result;
938
+ }
939
+ /**
940
+ * Converts a string from PascalCase to camelCase
941
+ * @param str The PascalCase string to convert
942
+ * @returns The camelCase version of the string
943
+ *
944
+ * @example
945
+ * ```typescript
946
+ * pascalToCamelCase('HelloWorld'); // 'helloWorld'
947
+ * pascalToCamelCase('TaskAssignmentCriteria'); // 'taskAssignmentCriteria'
948
+ * ```
949
+ */
950
+ function pascalToCamelCase(str) {
951
+ if (!str)
952
+ return str;
953
+ return str.charAt(0).toLowerCase() + str.slice(1);
954
+ }
955
+ /**
956
+ * Generic function to transform object keys using a provided case conversion function
957
+ * @param data The object to transform
958
+ * @param convertCase The function to convert each key
959
+ * @returns A new object with transformed keys
960
+ */
961
+ function transformCaseKeys(data, convertCase) {
962
+ // Handle array of objects
963
+ if (Array.isArray(data)) {
964
+ return data.map(item => {
965
+ // If the array element is a primitive (string, number, etc.), return it as is
966
+ if (item === null || typeof item !== 'object' || typeof item === 'string') {
967
+ return item;
968
+ }
969
+ // Only recursively transform if it's actually an object
970
+ return transformCaseKeys(item, convertCase);
971
+ });
972
+ }
973
+ const result = {};
974
+ for (const [key, value] of Object.entries(data)) {
975
+ const transformedKey = convertCase(key);
976
+ // Recursively transform nested objects and arrays
977
+ if (value !== null && typeof value === 'object') {
978
+ result[transformedKey] = transformCaseKeys(value, convertCase);
979
+ }
980
+ else {
981
+ result[transformedKey] = value;
982
+ }
983
+ }
984
+ return result;
985
+ }
986
+ /**
987
+ * Transforms an object's keys from PascalCase to camelCase
988
+ * @param data The object with PascalCase keys
989
+ * @returns A new object with all keys converted to camelCase
990
+ *
991
+ * @example
992
+ * ```typescript
993
+ * // Simple object
994
+ * pascalToCamelCaseKeys({ Id: "123", TaskName: "Invoice" });
995
+ * // Result: { id: "123", taskName: "Invoice" }
996
+ *
997
+ * // Nested object
998
+ * pascalToCamelCaseKeys({
999
+ * TaskId: "456",
1000
+ * TaskDetails: { AssignedUser: "John", Priority: "High" }
1001
+ * });
1002
+ * // Result: {
1003
+ * // taskId: "456",
1004
+ * // taskDetails: { assignedUser: "John", priority: "High" }
1005
+ * // }
1006
+ *
1007
+ * // Array of objects
1008
+ * pascalToCamelCaseKeys([
1009
+ * { Id: "1", IsComplete: false },
1010
+ * { Id: "2", IsComplete: true }
1011
+ * ]);
1012
+ * // Result: [
1013
+ * // { id: "1", isComplete: false },
1014
+ * // { id: "2", isComplete: true }
1015
+ * // ]
1016
+ * ```
1017
+ */
1018
+ function pascalToCamelCaseKeys(data) {
1019
+ return transformCaseKeys(data, pascalToCamelCase);
1020
+ }
1021
+ /**
1022
+ * Adds a prefix to specified keys in an object, returning a new object.
1023
+ * Only the provided keys are prefixed; all others are left unchanged.
1024
+ *
1025
+ * @param obj The source object
1026
+ * @param prefix The prefix to add (e.g., '$')
1027
+ * @param keys The keys to prefix (e.g., ['expand', 'filter'])
1028
+ * @returns A new object with specified keys prefixed
1029
+ *
1030
+ * @example
1031
+ * addPrefixToKeys({ expand: 'a', foo: 1 }, '$', ['expand']) // { $expand: 'a', foo: 1 }
1032
+ */
1033
+ function addPrefixToKeys(obj, prefix, keys) {
1034
+ const result = {};
1035
+ for (const [key, value] of Object.entries(obj)) {
1036
+ if (keys.includes(key)) {
1037
+ result[`${prefix}${key}`] = value;
1038
+ }
1039
+ else {
1040
+ result[key] = value;
1041
+ }
1042
+ }
1043
+ return result;
1044
+ }
1045
+ /**
1046
+ * Transforms an array-based dictionary with separate keys and values arrays
1047
+ * into a standard JavaScript object/record
1048
+ *
1049
+ * @param dictionary Object containing keys and values arrays
1050
+ * @returns A standard record object with direct key-value mapping
1051
+ *
1052
+ * @example
1053
+ * ```typescript
1054
+ * const arrayDict = {
1055
+ * keys: ['Content-Type', 'x-ms-blob-type'],
1056
+ * values: ['application/json', 'BlockBlob']
1057
+ * };
1058
+ * const record = arrayDictionaryToRecord(arrayDict);
1059
+ * // result = {
1060
+ * // 'Content-Type': 'application/json',
1061
+ * // 'x-ms-blob-type': 'BlockBlob'
1062
+ * // }
1063
+ * ```
1064
+ */
1065
+ function arrayDictionaryToRecord(dictionary) {
1066
+ if (!dictionary || !dictionary.keys || !dictionary.values) {
1067
+ return {};
1068
+ }
1069
+ if (dictionary.keys.length !== dictionary.values.length) {
1070
+ console.warn('Keys and values arrays have different lengths');
1071
+ }
1072
+ const record = {};
1073
+ const length = Math.min(dictionary.keys.length, dictionary.values.length);
1074
+ for (let i = 0; i < length; i++) {
1075
+ record[dictionary.keys[i]] = dictionary.values[i];
1076
+ }
1077
+ return record;
1078
+ }
1079
+
1080
+ /**
1081
+ * Constants used throughout the pagination system
1082
+ */
1083
+ /** Maximum number of items that can be requested in a single page */
1084
+ const MAX_PAGE_SIZE = 1000;
1085
+ /** Default page size when jumpToPage is used without specifying pageSize */
1086
+ const DEFAULT_PAGE_SIZE = 50;
1087
+ /** Default field name for items in a paginated response */
1088
+ const DEFAULT_ITEMS_FIELD = 'value';
1089
+ /** Default field name for total count in a paginated response */
1090
+ const DEFAULT_TOTAL_COUNT_FIELD = '@odata.count';
1091
+ /**
1092
+ * Limits the page size to the maximum allowed value
1093
+ * @param pageSize - Requested page size
1094
+ * @returns Limited page size value
1095
+ */
1096
+ function getLimitedPageSize(pageSize) {
1097
+ if (pageSize === undefined || pageSize === null) {
1098
+ return DEFAULT_PAGE_SIZE;
1099
+ }
1100
+ return Math.max(1, Math.min(pageSize, MAX_PAGE_SIZE));
1101
+ }
1102
+
1103
+ /**
1104
+ * Helper functions for pagination that can be used across services
1105
+ */
1106
+ class PaginationHelpers {
1107
+ /**
1108
+ * Checks if any pagination parameters are provided
1109
+ *
1110
+ * @param options - The options object to check
1111
+ * @returns True if any pagination parameter is defined, false otherwise
1112
+ */
1113
+ static hasPaginationParameters(options = {}) {
1114
+ const { cursor, pageSize, jumpToPage } = options;
1115
+ return cursor !== undefined || pageSize !== undefined || jumpToPage !== undefined;
1116
+ }
1117
+ /**
1118
+ * Parse a pagination cursor string into cursor data
1119
+ */
1120
+ static parseCursor(cursorString) {
1121
+ try {
1122
+ const cursorData = JSON.parse(decodeBase64(cursorString));
1123
+ return cursorData;
1124
+ }
1125
+ catch {
1126
+ throw new Error('Invalid pagination cursor');
1127
+ }
1128
+ }
1129
+ /**
1130
+ * Validates cursor format and structure
1131
+ *
1132
+ * @param paginationOptions - The pagination options containing the cursor
1133
+ * @param paginationType - Optional pagination type to validate against
1134
+ */
1135
+ static validateCursor(paginationOptions, paginationType) {
1136
+ if (paginationOptions.cursor !== undefined) {
1137
+ if (!paginationOptions.cursor || typeof paginationOptions.cursor.value !== 'string' || !paginationOptions.cursor.value) {
1138
+ throw new Error('cursor must contain a valid cursor string');
1139
+ }
1140
+ try {
1141
+ // Try to parse the cursor to validate it
1142
+ const cursorData = PaginationHelpers.parseCursor(paginationOptions.cursor.value);
1143
+ // If type is provided, validate cursor contains expected type information
1144
+ if (paginationType) {
1145
+ if (!cursorData.type) {
1146
+ throw new Error('Invalid cursor: missing pagination type');
1147
+ }
1148
+ // Check pagination type compatibility
1149
+ if (cursorData.type !== paginationType) {
1150
+ throw new Error(`Pagination type mismatch: cursor is for ${cursorData.type} but service uses ${paginationType}`);
1151
+ }
1152
+ }
1153
+ }
1154
+ catch (error) {
1155
+ if (error instanceof Error) {
1156
+ // If it's already our error with specific message, pass it through
1157
+ if (error.message.startsWith('Invalid cursor') ||
1158
+ error.message.startsWith('Pagination type mismatch')) {
1159
+ throw error;
1160
+ }
1161
+ }
1162
+ throw new Error('Invalid pagination cursor format');
1163
+ }
1164
+ }
1165
+ }
1166
+ /**
1167
+ * Comprehensive validation for pagination options
1168
+ *
1169
+ * @param options - The pagination options to validate
1170
+ * @param paginationType - The pagination type these options will be used with
1171
+ * @returns Processed pagination parameters ready for use
1172
+ */
1173
+ static validatePaginationOptions(options, paginationType) {
1174
+ // Validate pageSize
1175
+ if (options.pageSize !== undefined && options.pageSize <= 0) {
1176
+ throw new Error('pageSize must be a positive number');
1177
+ }
1178
+ // Validate jumpToPage
1179
+ if (options.jumpToPage !== undefined && options.jumpToPage <= 0) {
1180
+ throw new Error('jumpToPage must be a positive number');
1181
+ }
1182
+ // Validate cursor
1183
+ PaginationHelpers.validateCursor(options, paginationType);
1184
+ // Validate service compatibility
1185
+ if (options.jumpToPage !== undefined && paginationType === PaginationType.TOKEN) {
1186
+ throw new Error('jumpToPage is not supported for token-based pagination. Use cursor-based navigation instead.');
1187
+ }
1188
+ // Get processed parameters
1189
+ return PaginationHelpers.getRequestParameters(options, paginationType);
1190
+ }
1191
+ /**
1192
+ * Convert a unified pagination options to service-specific parameters
1193
+ */
1194
+ static getRequestParameters(options, paginationType) {
1195
+ // Handle jumpToPage
1196
+ if (options.jumpToPage !== undefined) {
1197
+ const jumpToPageOptions = {
1198
+ pageSize: options.pageSize,
1199
+ pageNumber: options.jumpToPage
1200
+ };
1201
+ return filterUndefined(jumpToPageOptions);
1202
+ }
1203
+ // If no cursor is provided, it's a first page request
1204
+ if (!options.cursor) {
1205
+ const firstPageOptions = {
1206
+ pageSize: options.pageSize,
1207
+ // Only set pageNumber for OFFSET pagination
1208
+ pageNumber: paginationType === PaginationType.OFFSET ? 1 : undefined
1209
+ };
1210
+ return filterUndefined(firstPageOptions);
1211
+ }
1212
+ // Parse the cursor
1213
+ try {
1214
+ const cursorData = PaginationHelpers.parseCursor(options.cursor.value);
1215
+ const cursorBasedOptions = {
1216
+ pageSize: cursorData.pageSize || options.pageSize,
1217
+ pageNumber: cursorData.pageNumber,
1218
+ continuationToken: cursorData.continuationToken,
1219
+ type: cursorData.type,
1220
+ };
1221
+ return filterUndefined(cursorBasedOptions);
1222
+ }
1223
+ catch {
1224
+ throw new Error('Invalid pagination cursor');
1225
+ }
1226
+ }
1227
+ /**
1228
+ * Helper method for paginated resource retrieval
1229
+ *
1230
+ * @param params - Parameters for pagination
1231
+ * @returns Promise resolving to a paginated result
1232
+ */
1233
+ static async getAllPaginated(params) {
1234
+ const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1235
+ const endpoint = getEndpoint(folderId);
1236
+ const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1237
+ const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1238
+ headers,
1239
+ params: additionalParams,
1240
+ pagination: {
1241
+ paginationType: options.paginationType || PaginationType.OFFSET,
1242
+ itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
1243
+ totalCountField: options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD,
1244
+ continuationTokenField: options.continuationTokenField,
1245
+ paginationParams: options.paginationParams
1246
+ }
1247
+ });
1248
+ // Parse items - automatically handle JSON string responses
1249
+ const rawItems = paginatedResponse.items;
1250
+ const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1251
+ const transformedItems = transformFn ? parsedItems.map(transformFn) : parsedItems;
1252
+ return {
1253
+ ...paginatedResponse,
1254
+ items: transformedItems
1255
+ };
1256
+ }
1257
+ /**
1258
+ * Helper method for non-paginated resource retrieval
1259
+ *
1260
+ * @param params - Parameters for non-paginated resource retrieval
1261
+ * @returns Promise resolving to an object with data and totalCount
1262
+ */
1263
+ static async getAllNonPaginated(params) {
1264
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1265
+ // Set default field names
1266
+ const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1267
+ const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1268
+ // Determine endpoint and headers based on folderId
1269
+ const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1270
+ const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1271
+ // Make the API call based on method
1272
+ let response;
1273
+ if (method === HTTP_METHODS.POST) {
1274
+ response = await serviceAccess.post(endpoint, additionalParams, { headers });
1275
+ }
1276
+ else {
1277
+ response = await serviceAccess.get(endpoint, {
1278
+ params: additionalParams,
1279
+ headers
1280
+ });
1281
+ }
1282
+ // Extract and transform items from response
1283
+ const rawItems = response.data?.[itemsField];
1284
+ const totalCount = response.data?.[totalCountField];
1285
+ // Parse items - automatically handle JSON string responses
1286
+ const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1287
+ const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
1288
+ return {
1289
+ items,
1290
+ totalCount
1291
+ };
1292
+ }
1293
+ /**
1294
+ * Centralized getAll implementation that handles both paginated and non-paginated requests
1295
+ *
1296
+ * @param config - Configuration for the getAll operation
1297
+ * @param options - Request options including pagination parameters
1298
+ * @returns Promise resolving to either paginated or non-paginated response based on options
1299
+ */
1300
+ static async getAll(config, options) {
1301
+ const optionsWithDefaults = options || {};
1302
+ const { folderId, pageSize, cursor, jumpToPage, ...restOptions } = optionsWithDefaults;
1303
+ // Determine if pagination is requested
1304
+ const isPaginationRequested = PaginationHelpers.hasPaginationParameters(options || {});
1305
+ // Process parameters (custom processing if provided, otherwise default)
1306
+ let processedOptions = restOptions;
1307
+ if (config.processParametersFn) {
1308
+ processedOptions = config.processParametersFn(restOptions, folderId);
1309
+ }
1310
+ // Apply ODATA prefix to keys (excluding specified keys)
1311
+ const excludeKeys = config.excludeFromPrefix || [];
1312
+ const keysToPrefix = Object.keys(processedOptions).filter(k => !excludeKeys.includes(k));
1313
+ const prefixedOptions = addPrefixToKeys(processedOptions, ODATA_PREFIX, keysToPrefix);
1314
+ // Default pagination options
1315
+ const paginationOptions = {
1316
+ paginationType: PaginationType.OFFSET,
1317
+ itemsField: DEFAULT_ITEMS_FIELD,
1318
+ totalCountField: DEFAULT_TOTAL_COUNT_FIELD,
1319
+ ...config.pagination
1320
+ };
1321
+ // Paginated flow
1322
+ if (isPaginationRequested) {
1323
+ return PaginationHelpers.getAllPaginated({
1324
+ serviceAccess: config.serviceAccess,
1325
+ getEndpoint: config.getEndpoint,
1326
+ folderId,
1327
+ paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1328
+ additionalParams: prefixedOptions,
1329
+ transformFn: config.transformFn,
1330
+ method: config.method,
1331
+ options: {
1332
+ ...paginationOptions,
1333
+ paginationParams: config.pagination?.paginationParams
1334
+ }
1335
+ }); // Type assertion needed due to conditional return
1336
+ }
1337
+ // Non-paginated flow
1338
+ const byFolderEndpoint = config.getByFolderEndpoint || config.getEndpoint(folderId);
1339
+ return PaginationHelpers.getAllNonPaginated({
1340
+ serviceAccess: config.serviceAccess,
1341
+ getAllEndpoint: config.getEndpoint(),
1342
+ getByFolderEndpoint: byFolderEndpoint,
1343
+ folderId,
1344
+ additionalParams: prefixedOptions,
1345
+ transformFn: config.transformFn,
1346
+ method: config.method,
1347
+ options: {
1348
+ itemsField: paginationOptions.itemsField,
1349
+ totalCountField: paginationOptions.totalCountField
1350
+ }
1351
+ });
1352
+ }
1353
+ }
1354
+
1355
+ /**
1356
+ * SDK Internals Registry - Internal registry for SDK instances
1357
+ *
1358
+ * This class is NOT exported in the public API.
1359
+ * It provides a secure way to share SDK internals between
1360
+ * the UiPath class and service classes without exposing them publicly.
1361
+ *
1362
+ * @internal
1363
+ */
1364
+ // Global symbol key to ensure WeakMap is shared across module instances
1365
+ // This prevents issues when core and service modules are bundled separately
1366
+ const REGISTRY_KEY = Symbol.for('@uipath/sdk-internals-registry');
1367
+ // Get or create the global WeakMap store
1368
+ const getGlobalStore = () => {
1369
+ const globalObj = globalThis;
1370
+ if (!globalObj[REGISTRY_KEY]) {
1371
+ globalObj[REGISTRY_KEY] = new WeakMap();
1372
+ }
1373
+ return globalObj[REGISTRY_KEY];
1374
+ };
1375
+ /**
1376
+ * Internal registry for SDK private components.
1377
+ * Uses WeakMap to prevent memory leaks - entries are automatically
1378
+ * garbage collected when the SDK instance is no longer referenced.
1379
+ *
1380
+ * Uses a global singleton pattern to ensure the same WeakMap is shared
1381
+ * across separately bundled modules (core, entities, tasks, etc.).
1382
+ *
1383
+ * @internal - Not exported in public API
1384
+ */
1385
+ class SDKInternalsRegistry {
1386
+ // Use global store to ensure sharing across module bundles
1387
+ static get store() {
1388
+ return getGlobalStore();
1389
+ }
1390
+ /**
1391
+ * Register SDK instance internals
1392
+ * Called by UiPath constructor
1393
+ */
1394
+ static set(instance, internals) {
1395
+ this.store.set(instance, internals);
1396
+ }
1397
+ /**
1398
+ * Retrieve SDK instance internals
1399
+ * Called by BaseService constructor
1400
+ */
1401
+ static get(instance) {
1402
+ const internals = this.store.get(instance);
1403
+ if (!internals) {
1404
+ throw new Error('Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.');
1405
+ }
1406
+ return internals;
1407
+ }
1408
+ }
1409
+
1410
+ var _BaseService_apiClient;
1411
+ /**
1412
+ * Base class for all UiPath SDK services.
1413
+ *
1414
+ * Provides common functionality for authentication, configuration, and API communication.
1415
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
1416
+ *
1417
+ * This class implements the dependency injection pattern where services receive a configured
1418
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
1419
+ * including authentication token management.
1420
+ *
1421
+ * @remarks
1422
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
1423
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
1424
+ *
1425
+ */
1426
+ class BaseService {
1427
+ /**
1428
+ * Creates a base service instance with dependency injection.
1429
+ *
1430
+ * Extracts configuration, execution context, and token manager from the UiPath instance
1431
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
1432
+ * and token management internally.
1433
+ *
1434
+ * @param instance - UiPath SDK instance providing authentication and configuration.
1435
+ * Services receive this via dependency injection in the modular pattern.
1436
+ *
1437
+ * @example
1438
+ * ```typescript
1439
+ * // Services automatically call this via super()
1440
+ * export class EntityService extends BaseService {
1441
+ * constructor(instance: IUiPath) {
1442
+ * super(instance); // Initializes the internal ApiClient
1443
+ * }
1444
+ * }
1445
+ *
1446
+ * // Usage in modular pattern
1447
+ * import { UiPath } from '@uipath/uipath-typescript/core';
1448
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1449
+ *
1450
+ * const sdk = new UiPath(config);
1451
+ * await sdk.initialize();
1452
+ * const entities = new Entities(sdk);
1453
+ * ```
1454
+ */
1455
+ constructor(instance) {
1456
+ // Private field - not visible via Object.keys() or any reflection
1457
+ _BaseService_apiClient.set(this, void 0);
1458
+ const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1459
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1460
+ }
1461
+ /**
1462
+ * Gets a valid authentication token, refreshing if necessary.
1463
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
1464
+ *
1465
+ * @returns Promise resolving to a valid access token string
1466
+ * @throws AuthenticationError if no token is available or refresh fails
1467
+ */
1468
+ async getValidAuthToken() {
1469
+ return __classPrivateFieldGet(this, _BaseService_apiClient, "f").getValidToken();
1470
+ }
1471
+ /**
1472
+ * Creates a service accessor for pagination helpers
1473
+ * This allows pagination helpers to access protected methods without making them public
1474
+ */
1475
+ createPaginationServiceAccess() {
1476
+ return {
1477
+ get: (path, options) => this.get(path, options || {}),
1478
+ post: (path, body, options) => this.post(path, body, options || {}),
1479
+ requestWithPagination: (method, path, paginationOptions, options) => this.requestWithPagination(method, path, paginationOptions, options)
1480
+ };
1481
+ }
1482
+ async request(method, path, options = {}) {
1483
+ switch (method.toUpperCase()) {
1484
+ case 'GET':
1485
+ return this.get(path, options);
1486
+ case 'POST':
1487
+ return this.post(path, options.body, options);
1488
+ case 'PUT':
1489
+ return this.put(path, options.body, options);
1490
+ case 'PATCH':
1491
+ return this.patch(path, options.body, options);
1492
+ case 'DELETE':
1493
+ return this.delete(path, options);
1494
+ default:
1495
+ throw new Error(`Unsupported HTTP method: ${method}`);
1496
+ }
1497
+ }
1498
+ async requestWithSpec(spec) {
1499
+ if (!spec.method || !spec.url) {
1500
+ throw new Error('Request spec must include method and url');
1501
+ }
1502
+ return this.request(spec.method, spec.url, spec);
1503
+ }
1504
+ async get(path, options = {}) {
1505
+ const response = await __classPrivateFieldGet(this, _BaseService_apiClient, "f").get(path, options);
1506
+ return { data: response };
1507
+ }
1508
+ async post(path, data, options = {}) {
1509
+ const response = await __classPrivateFieldGet(this, _BaseService_apiClient, "f").post(path, data, options);
1510
+ return { data: response };
1511
+ }
1512
+ async put(path, data, options = {}) {
1513
+ const response = await __classPrivateFieldGet(this, _BaseService_apiClient, "f").put(path, data, options);
1514
+ return { data: response };
1515
+ }
1516
+ async patch(path, data, options = {}) {
1517
+ const response = await __classPrivateFieldGet(this, _BaseService_apiClient, "f").patch(path, data, options);
1518
+ return { data: response };
1519
+ }
1520
+ async delete(path, options = {}) {
1521
+ const response = await __classPrivateFieldGet(this, _BaseService_apiClient, "f").delete(path, options);
1522
+ return { data: response };
1523
+ }
1524
+ /**
1525
+ * Execute a request with cursor-based pagination
1526
+ */
1527
+ async requestWithPagination(method, path, paginationOptions, options) {
1528
+ const paginationType = options.pagination.paginationType;
1529
+ // Validate and prepare pagination parameters
1530
+ const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1531
+ // Prepare request parameters based on pagination type
1532
+ const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1533
+ // For POST requests, merge pagination params into body; for GET, use query params
1534
+ if (method.toUpperCase() === 'POST') {
1535
+ const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1536
+ options.body = {
1537
+ ...existingBody,
1538
+ ...options.params,
1539
+ ...requestParams
1540
+ };
1541
+ }
1542
+ else {
1543
+ // Merge pagination parameters with existing parameters
1544
+ options.params = {
1545
+ ...options.params,
1546
+ ...requestParams
1547
+ };
1548
+ }
1549
+ // Make the request
1550
+ const response = await this.request(method, path, options);
1551
+ // Extract data from the response and create page result
1552
+ return this.createPaginatedResponseFromResponse(response, params, paginationType, {
1553
+ itemsField: options.pagination.itemsField,
1554
+ totalCountField: options.pagination.totalCountField,
1555
+ continuationTokenField: options.pagination.continuationTokenField
1556
+ });
1557
+ }
1558
+ /**
1559
+ * Validates and prepares pagination parameters from options
1560
+ */
1561
+ validateAndPreparePaginationParams(paginationType, paginationOptions) {
1562
+ return PaginationHelpers.validatePaginationOptions(paginationOptions, paginationType);
1563
+ }
1564
+ /**
1565
+ * Prepares request parameters for pagination based on pagination type
1566
+ */
1567
+ preparePaginationRequestParams(paginationType, params, paginationConfig) {
1568
+ const requestParams = {};
1569
+ let limitedPageSize;
1570
+ const paginationParams = paginationConfig?.paginationParams;
1571
+ switch (paginationType) {
1572
+ case PaginationType.OFFSET:
1573
+ limitedPageSize = getLimitedPageSize(params.pageSize);
1574
+ const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
1575
+ const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
1576
+ const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
1577
+ requestParams[pageSizeParam] = limitedPageSize;
1578
+ if (params.pageNumber && params.pageNumber > 1) {
1579
+ requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1580
+ }
1581
+ // Include total count for ODATA APIs
1582
+ {
1583
+ requestParams[countParam] = true;
1584
+ }
1585
+ break;
1586
+ case PaginationType.TOKEN:
1587
+ const tokenPageSizeParam = paginationParams?.pageSizeParam || BUCKET_TOKEN_PARAMS.PAGE_SIZE_PARAM;
1588
+ const tokenParam = paginationParams?.tokenParam || BUCKET_TOKEN_PARAMS.TOKEN_PARAM;
1589
+ if (params.pageSize) {
1590
+ requestParams[tokenPageSizeParam] = getLimitedPageSize(params.pageSize);
1591
+ }
1592
+ if (params.continuationToken) {
1593
+ requestParams[tokenParam] = params.continuationToken;
1594
+ }
1595
+ break;
1596
+ }
1597
+ return requestParams;
1598
+ }
1599
+ /**
1600
+ * Creates a paginated response from API response
1601
+ */
1602
+ createPaginatedResponseFromResponse(response, params, paginationType, fields) {
1603
+ // Extract fields from response
1604
+ const itemsField = fields.itemsField ||
1605
+ (paginationType === PaginationType.TOKEN ? 'items' : 'value');
1606
+ const totalCountField = fields.totalCountField || 'totalRecordCount';
1607
+ const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1608
+ // Extract items and metadata
1609
+ const items = response.data[itemsField] || [];
1610
+ const totalCount = response.data[totalCountField];
1611
+ const continuationToken = response.data[continuationTokenField];
1612
+ // Determine if there are more pages
1613
+ const hasMore = this.determineHasMorePages(paginationType, {
1614
+ totalCount,
1615
+ pageSize: params.pageSize,
1616
+ currentPage: params.pageNumber || 1,
1617
+ itemsCount: items.length,
1618
+ continuationToken
1619
+ });
1620
+ // Create and return the page result
1621
+ return PaginationManager.createPaginatedResponse({
1622
+ pageInfo: {
1623
+ hasMore,
1624
+ totalCount,
1625
+ currentPage: params.pageNumber,
1626
+ pageSize: params.pageSize,
1627
+ continuationToken
1628
+ },
1629
+ type: paginationType,
1630
+ }, items);
1631
+ }
1632
+ /**
1633
+ * Determines if there are more pages based on pagination type and metadata
1634
+ */
1635
+ determineHasMorePages(paginationType, info) {
1636
+ switch (paginationType) {
1637
+ case PaginationType.OFFSET:
1638
+ const effectivePageSize = info.pageSize ?? DEFAULT_PAGE_SIZE;
1639
+ // If totalCount is available, use it for precise calculation
1640
+ if (info.totalCount !== undefined) {
1641
+ return (info.currentPage * effectivePageSize) < info.totalCount;
1642
+ }
1643
+ // Fallback when totalCount is not available
1644
+ // NOTE: This code path should rarely be executed as the APIs typically return totalCount
1645
+ return info.itemsCount === effectivePageSize;
1646
+ case PaginationType.TOKEN:
1647
+ return !!info.continuationToken;
1648
+ default:
1649
+ return false;
1650
+ }
1651
+ }
1652
+ }
1653
+ _BaseService_apiClient = new WeakMap();
1654
+
1655
+ /**
1656
+ * Base service for services that need folder-specific functionality.
1657
+ *
1658
+ * Extends BaseService with additional methods for working with folder-scoped resources
1659
+ * in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
1660
+ *
1661
+ * @remarks
1662
+ * This class provides helper methods for making folder-scoped API calls, handling folder IDs
1663
+ * in request headers, and managing cross-folder queries.
1664
+ */
1665
+ class FolderScopedService extends BaseService {
1666
+ /**
1667
+ * Gets resources in a folder with optional query parameters
1668
+ *
1669
+ * @param endpoint - API endpoint to call
1670
+ * @param folderId - required folder ID
1671
+ * @param options - Query options
1672
+ * @param transformFn - Optional function to transform the response data
1673
+ * @returns Promise resolving to an array of resources
1674
+ */
1675
+ async _getByFolder(endpoint, folderId, options = {}, transformFn) {
1676
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
1677
+ const keysToPrefix = Object.keys(options);
1678
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
1679
+ const response = await this.get(endpoint, {
1680
+ params: apiOptions,
1681
+ headers
1682
+ });
1683
+ if (transformFn) {
1684
+ return response.data?.value.map(transformFn);
1685
+ }
1686
+ return response.data?.value;
1687
+ }
1688
+ }
1689
+
1690
+ /**
1691
+ * Base path constants for different services
1692
+ */
1693
+ const ORCHESTRATOR_BASE = 'orchestrator_';
1694
+
1695
+ /**
1696
+ * Orchestrator Service Endpoints
1697
+ */
1698
+ /**
1699
+ * Orchestrator Bucket Endpoints
1700
+ */
1701
+ const BUCKET_ENDPOINTS = {
1702
+ GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Buckets`,
1703
+ GET_ALL: `${ORCHESTRATOR_BASE}/odata/Buckets/UiPath.Server.Configuration.OData.GetBucketsAcrossFolders`,
1704
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})`,
1705
+ GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
1706
+ GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
1707
+ GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
1708
+ };
1709
+
1710
+ /**
1711
+ * Maps fields for Bucket entities to ensure consistent naming
1712
+ */
1713
+ const BucketMap = {
1714
+ fullPath: 'path',
1715
+ items: 'blobItems',
1716
+ verb: 'httpMethod'
1717
+ };
1718
+
1719
+ /**
1720
+ * SDK Telemetry constants
1721
+ */
1722
+ // Connection string placeholder that will be replaced during build
1723
+ 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";
1724
+ // SDK Version placeholder
1725
+ const SDK_VERSION = "1.1.0";
1726
+ const VERSION = "Version";
1727
+ const SERVICE = "Service";
1728
+ const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
1729
+ const CLOUD_TENANT_NAME = "CloudTenantName";
1730
+ const CLOUD_URL = "CloudUrl";
1731
+ const CLOUD_CLIENT_ID = "CloudClientId";
1732
+ const CLOUD_REDIRECT_URI = "CloudRedirectUri";
1733
+ const APP_NAME = "ApplicationName";
1734
+ const CLOUD_ROLE_NAME = "uipath-ts-sdk";
1735
+ // Service and logger names
1736
+ const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
1737
+ const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
1738
+ // Event names
1739
+ const SDK_RUN_EVENT = "Sdk.Run";
1740
+ // Default value for unknown/empty attributes
1741
+ const UNKNOWN = "";
1742
+
1743
+ /**
1744
+ * Log exporter that sends ALL logs as Application Insights custom events
1745
+ */
1746
+ class ApplicationInsightsEventExporter {
1747
+ constructor(connectionString) {
1748
+ this.connectionString = connectionString;
1749
+ }
1750
+ export(logs, resultCallback) {
1751
+ try {
1752
+ logs.forEach(logRecord => {
1753
+ this.sendAsCustomEvent(logRecord);
1754
+ });
1755
+ resultCallback({ code: 0 });
1756
+ }
1757
+ catch (error) {
1758
+ console.debug('Failed to export logs to Application Insights:', error);
1759
+ resultCallback({ code: 2, error });
1760
+ }
1761
+ }
1762
+ shutdown() {
1763
+ return Promise.resolve();
1764
+ }
1765
+ sendAsCustomEvent(logRecord) {
1766
+ // Get event name from body or attributes
1767
+ const eventName = logRecord.body || SDK_RUN_EVENT;
1768
+ const payload = {
1769
+ name: 'Microsoft.ApplicationInsights.Event',
1770
+ time: new Date().toISOString(),
1771
+ iKey: this.extractInstrumentationKey(),
1772
+ data: {
1773
+ baseType: 'EventData',
1774
+ baseData: {
1775
+ ver: 2,
1776
+ name: eventName,
1777
+ properties: this.convertAttributesToProperties(logRecord.attributes || {})
1778
+ }
1779
+ },
1780
+ tags: {
1781
+ 'ai.cloud.role': CLOUD_ROLE_NAME,
1782
+ 'ai.cloud.roleInstance': SDK_VERSION
1783
+ }
1784
+ };
1785
+ this.sendToApplicationInsights(payload);
1786
+ }
1787
+ extractInstrumentationKey() {
1788
+ const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
1789
+ return match ? match[1] : '';
1790
+ }
1791
+ convertAttributesToProperties(attributes) {
1792
+ const properties = {};
1793
+ Object.entries(attributes || {}).forEach(([key, value]) => {
1794
+ properties[key] = String(value);
1795
+ });
1796
+ return properties;
1797
+ }
1798
+ async sendToApplicationInsights(payload) {
1799
+ try {
1800
+ const ingestionEndpoint = this.extractIngestionEndpoint();
1801
+ if (!ingestionEndpoint) {
1802
+ console.debug('No ingestion endpoint found in connection string');
1803
+ return;
1804
+ }
1805
+ const url = `${ingestionEndpoint}/v2/track`;
1806
+ const response = await fetch(url, {
1807
+ method: 'POST',
1808
+ headers: {
1809
+ 'Content-Type': 'application/json',
1810
+ },
1811
+ body: JSON.stringify(payload)
1812
+ });
1813
+ if (!response.ok) {
1814
+ console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
1815
+ }
1816
+ }
1817
+ catch (error) {
1818
+ console.debug('Error sending event telemetry to Application Insights:', error);
1819
+ }
1820
+ }
1821
+ extractIngestionEndpoint() {
1822
+ const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
1823
+ return match ? match[1] : '';
1824
+ }
1825
+ }
1826
+ /**
1827
+ * Singleton telemetry client
1828
+ */
1829
+ class TelemetryClient {
1830
+ constructor() {
1831
+ this.isInitialized = false;
1832
+ }
1833
+ static getInstance() {
1834
+ if (!TelemetryClient.instance) {
1835
+ TelemetryClient.instance = new TelemetryClient();
1836
+ }
1837
+ return TelemetryClient.instance;
1838
+ }
1839
+ /**
1840
+ * Initialize telemetry
1841
+ */
1842
+ initialize(config) {
1843
+ if (this.isInitialized) {
1844
+ return;
1845
+ }
1846
+ this.isInitialized = true;
1847
+ if (config) {
1848
+ this.telemetryContext = config;
1849
+ }
1850
+ try {
1851
+ const connectionString = this.getConnectionString();
1852
+ if (!connectionString) {
1853
+ return;
1854
+ }
1855
+ this.setupTelemetryProvider(connectionString);
1856
+ }
1857
+ catch (error) {
1858
+ // Silent failure - telemetry errors shouldn't break functionality
1859
+ console.debug('Failed to initialize OpenTelemetry:', error);
1860
+ }
1861
+ }
1862
+ getConnectionString() {
1863
+ const connectionString = CONNECTION_STRING;
1864
+ return connectionString;
1865
+ }
1866
+ setupTelemetryProvider(connectionString) {
1867
+ const exporter = new ApplicationInsightsEventExporter(connectionString);
1868
+ const processor = new BatchLogRecordProcessor(exporter);
1869
+ this.logProvider = new LoggerProvider({
1870
+ processors: [processor]
1871
+ });
1872
+ this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
1873
+ }
1874
+ /**
1875
+ * Track a telemetry event
1876
+ */
1877
+ track(eventName, name, extraAttributes = {}) {
1878
+ try {
1879
+ // Skip if logger not initialized
1880
+ if (!this.logger) {
1881
+ return;
1882
+ }
1883
+ const finalDisplayName = name || eventName;
1884
+ const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
1885
+ // Emit as log
1886
+ this.logger.emit({
1887
+ body: finalDisplayName,
1888
+ attributes: attributes,
1889
+ timestamp: Date.now(),
1890
+ });
1891
+ }
1892
+ catch (error) {
1893
+ // Silent failure
1894
+ console.debug('Failed to track telemetry event:', error);
1895
+ }
1896
+ }
1897
+ /**
1898
+ * Get enriched attributes for telemetry events
1899
+ */
1900
+ getEnrichedAttributes(extraAttributes, eventName) {
1901
+ const attributes = {
1902
+ [APP_NAME]: SDK_SERVICE_NAME,
1903
+ [VERSION]: SDK_VERSION,
1904
+ [SERVICE]: eventName,
1905
+ [CLOUD_URL]: this.createCloudUrl(),
1906
+ [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
1907
+ [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
1908
+ [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
1909
+ [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
1910
+ ...extraAttributes,
1911
+ };
1912
+ return attributes;
1913
+ }
1914
+ /**
1915
+ * Create cloud URL from base URL, organization ID, and tenant ID
1916
+ */
1917
+ createCloudUrl() {
1918
+ const baseUrl = this.telemetryContext?.baseUrl;
1919
+ const orgId = this.telemetryContext?.orgName;
1920
+ const tenantId = this.telemetryContext?.tenantName;
1921
+ if (!baseUrl || !orgId || !tenantId) {
1922
+ return UNKNOWN;
1923
+ }
1924
+ return `${baseUrl}/${orgId}/${tenantId}`;
1925
+ }
1926
+ }
1927
+ // Export singleton instance
1928
+ const telemetryClient = TelemetryClient.getInstance();
1929
+
1930
+ /**
1931
+ * SDK Track decorator and function for telemetry
1932
+ */
1933
+ /**
1934
+ * Common tracking logic shared between method and function decorators
1935
+ */
1936
+ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
1937
+ return function (...args) {
1938
+ // Determine if we should track this call
1939
+ let shouldTrack = true;
1940
+ if (opts.condition !== undefined) {
1941
+ if (typeof opts.condition === 'function') {
1942
+ shouldTrack = opts.condition.apply(this, args);
1943
+ }
1944
+ else {
1945
+ shouldTrack = opts.condition;
1946
+ }
1947
+ }
1948
+ // Track the event if enabled
1949
+ if (shouldTrack) {
1950
+ // Use the full name provided in the decorator (e.g., "Queue.GetAll")
1951
+ const serviceMethod = typeof nameOrOptions === 'string'
1952
+ ? nameOrOptions
1953
+ : fallbackName;
1954
+ // Use 'Sdk.Run' as the name and serviceMethod as the service
1955
+ telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
1956
+ }
1957
+ // Execute the original function
1958
+ return originalFunction.apply(this, args);
1959
+ };
1960
+ }
1961
+ /**
1962
+ * Track decorator that can be used to automatically track function calls
1963
+ *
1964
+ * Usage:
1965
+ * @track("Service.Method")
1966
+ * function myFunction() { ... }
1967
+ *
1968
+ * @track("Queue.GetAll")
1969
+ * async getAll() { ... }
1970
+ *
1971
+ * @track("Tasks.Create")
1972
+ * async create() { ... }
1973
+ *
1974
+ * @track("Assets.Update", { condition: false })
1975
+ * function myFunction() { ... }
1976
+ *
1977
+ * @track("Processes.Start", { attributes: { customProp: "value" } })
1978
+ * function myFunction() { ... }
1979
+ */
1980
+ function track(nameOrOptions, options) {
1981
+ return function decorator(_target, propertyKey, descriptor) {
1982
+ const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
1983
+ if (descriptor && typeof descriptor.value === 'function') {
1984
+ // Method decorator
1985
+ descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
1986
+ return descriptor;
1987
+ }
1988
+ // Function decorator
1989
+ return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
1990
+ };
1991
+ }
1992
+
1993
+ class BucketService extends FolderScopedService {
1994
+ /**
1995
+ * Gets a bucket by ID
1996
+ * @param bucketId - The ID of the bucket to retrieve
1997
+ * @param folderId - Folder ID for organization unit context
1998
+ * @param options - Optional query parameters (expand, select)
1999
+ * @returns Promise resolving to the bucket
2000
+ *
2001
+ * @example
2002
+ * ```typescript
2003
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2004
+ *
2005
+ * const buckets = new Buckets(sdk);
2006
+ *
2007
+ * // Get bucket by ID
2008
+ * const bucket = await buckets.getById(123, 456);
2009
+ * ```
2010
+ */
2011
+ async getById(id, folderId, options = {}) {
2012
+ if (!id) {
2013
+ throw new ValidationError({ message: 'bucketId is required for getById' });
2014
+ }
2015
+ if (!folderId) {
2016
+ throw new ValidationError({ message: 'folderId is required for getById' });
2017
+ }
2018
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2019
+ // Prefix all keys in options with $ for OData
2020
+ const keysToPrefix = Object.keys(options);
2021
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
2022
+ const response = await this.get(BUCKET_ENDPOINTS.GET_BY_ID(id), {
2023
+ params: apiOptions,
2024
+ headers
2025
+ });
2026
+ // Transform response from PascalCase to camelCase
2027
+ return pascalToCamelCaseKeys(response.data);
2028
+ }
2029
+ /**
2030
+ * Gets all buckets across folders with optional filtering and folder scoping
2031
+ *
2032
+ * The method returns either:
2033
+ * - An array of buckets (when no pagination parameters are provided)
2034
+ * - A paginated result with navigation cursors (when any pagination parameter is provided)
2035
+ *
2036
+ * @param options - Query options including optional folderId
2037
+ * @returns Promise resolving to an array of buckets or paginated result
2038
+ *
2039
+ * @example
2040
+ * ```typescript
2041
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2042
+ *
2043
+ * const buckets = new Buckets(sdk);
2044
+ *
2045
+ * // Get all buckets across folders
2046
+ * const allBuckets = await buckets.getAll();
2047
+ *
2048
+ * // Get buckets within a specific folder
2049
+ * const folderBuckets = await buckets.getAll({
2050
+ * folderId: 123
2051
+ * });
2052
+ *
2053
+ * // Get buckets with filtering
2054
+ * const filteredBuckets = await buckets.getAll({
2055
+ * filter: "name eq 'MyBucket'"
2056
+ * });
2057
+ *
2058
+ * // First page with pagination
2059
+ * const page1 = await buckets.getAll({ pageSize: 10 });
2060
+ *
2061
+ * // Navigate using cursor
2062
+ * if (page1.hasNextPage) {
2063
+ * const page2 = await buckets.getAll({ cursor: page1.nextCursor });
2064
+ * }
2065
+ *
2066
+ * // Jump to specific page
2067
+ * const page5 = await buckets.getAll({
2068
+ * jumpToPage: 5,
2069
+ * pageSize: 10
2070
+ * });
2071
+ * ```
2072
+ */
2073
+ async getAll(options) {
2074
+ // Transformation function for buckets
2075
+ const transformBucketResponse = (bucket) => pascalToCamelCaseKeys(bucket);
2076
+ return PaginationHelpers.getAll({
2077
+ serviceAccess: this.createPaginationServiceAccess(),
2078
+ getEndpoint: (folderId) => folderId ? BUCKET_ENDPOINTS.GET_BY_FOLDER : BUCKET_ENDPOINTS.GET_ALL,
2079
+ getByFolderEndpoint: BUCKET_ENDPOINTS.GET_BY_FOLDER,
2080
+ transformFn: transformBucketResponse,
2081
+ pagination: {
2082
+ paginationType: PaginationType.OFFSET,
2083
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
2084
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
2085
+ paginationParams: {
2086
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
2087
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
2088
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
2089
+ }
2090
+ }
2091
+ }, options);
2092
+ }
2093
+ /**
2094
+ * Gets metadata for files in a bucket with optional filtering and pagination
2095
+ *
2096
+ * The method returns either:
2097
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
2098
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
2099
+ *
2100
+ * @param bucketId - The ID of the bucket to get file metadata from
2101
+ * @param folderId - Required folder ID for organization unit context
2102
+ * @param options - Optional parameters for filtering, pagination and access URL generation
2103
+ * @returns Promise resolving to the list of file metadata in the bucket or paginated result
2104
+ *
2105
+ * @example
2106
+ * ```typescript
2107
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2108
+ *
2109
+ * const buckets = new Buckets(sdk);
2110
+ *
2111
+ * // Get metadata for all files in a bucket
2112
+ * const fileMetadata = await buckets.getFileMetaData(123, 456);
2113
+ *
2114
+ * // Get file metadata with a specific prefix
2115
+ * const fileMetadata = await buckets.getFileMetaData(123, 456, {
2116
+ * prefix: '/folder1'
2117
+ * });
2118
+ *
2119
+ * // First page with pagination
2120
+ * const page1 = await buckets.getFileMetaData(123, 456, { pageSize: 10 });
2121
+ *
2122
+ * // Navigate using cursor
2123
+ * if (page1.hasNextPage) {
2124
+ * const page2 = await buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
2125
+ * }
2126
+ * ```
2127
+ */
2128
+ async getFileMetaData(bucketId, folderId, options) {
2129
+ if (!bucketId) {
2130
+ throw new ValidationError({ message: 'bucketId is required for getFileMetaData' });
2131
+ }
2132
+ if (!folderId) {
2133
+ throw new ValidationError({ message: 'folderId is required for getFileMetaData' });
2134
+ }
2135
+ // Transformation function for blob items
2136
+ const transformBlobItem = (item) => transformData(item, BucketMap);
2137
+ return PaginationHelpers.getAll({
2138
+ serviceAccess: this.createPaginationServiceAccess(),
2139
+ getEndpoint: () => BUCKET_ENDPOINTS.GET_FILE_META_DATA(bucketId),
2140
+ transformFn: transformBlobItem,
2141
+ pagination: {
2142
+ paginationType: PaginationType.TOKEN,
2143
+ itemsField: BUCKET_PAGINATION.ITEMS_FIELD,
2144
+ continuationTokenField: BUCKET_PAGINATION.CONTINUATION_TOKEN_FIELD,
2145
+ paginationParams: {
2146
+ pageSizeParam: BUCKET_TOKEN_PARAMS.PAGE_SIZE_PARAM,
2147
+ tokenParam: BUCKET_TOKEN_PARAMS.TOKEN_PARAM
2148
+ }
2149
+ },
2150
+ excludeFromPrefix: ['prefix'] // Bucket-specific param, not OData
2151
+ }, { ...options, folderId });
2152
+ }
2153
+ /**
2154
+ * Uploads a file to a bucket
2155
+ *
2156
+ * @param options - Options for file upload including bucket ID, folder ID, path, content, and optional parameters
2157
+ * @returns Promise resolving to a response with success status and HTTP status code
2158
+ *
2159
+ * @example
2160
+ * ```typescript
2161
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2162
+ *
2163
+ * const buckets = new Buckets(sdk);
2164
+ *
2165
+ * // Upload a file from browser
2166
+ * const file = new File(['file content'], 'example.txt');
2167
+ * const result = await buckets.uploadFile({
2168
+ * bucketId: 123,
2169
+ * folderId: 456,
2170
+ * path: '/folder/example.txt',
2171
+ * content: file
2172
+ * });
2173
+ *
2174
+ * // In Node env with Buffer
2175
+ * const buffer = Buffer.from('file content');
2176
+ * const result = await buckets.uploadFile({
2177
+ * bucketId: 123,
2178
+ * folderId: 456,
2179
+ * path: '/folder/example.txt',
2180
+ * content: buffer
2181
+ * });
2182
+ * ```
2183
+ */
2184
+ async uploadFile(options) {
2185
+ const { bucketId, folderId, path, content } = options;
2186
+ if (!bucketId) {
2187
+ throw new ValidationError({ message: 'bucketId is required for uploadFile' });
2188
+ }
2189
+ if (!folderId) {
2190
+ throw new ValidationError({ message: 'folderId is required for uploadFile' });
2191
+ }
2192
+ if (!path) {
2193
+ throw new ValidationError({ message: 'path is required for uploadFile' });
2194
+ }
2195
+ if (!content) {
2196
+ throw new ValidationError({ message: 'content is required for uploadFile' });
2197
+ }
2198
+ const uriResponse = await this._getWriteUri({
2199
+ bucketId,
2200
+ folderId,
2201
+ path,
2202
+ });
2203
+ // Upload file to the provided URI
2204
+ const response = await this._uploadToUri(uriResponse, content);
2205
+ return {
2206
+ success: response.status >= 200 && response.status < 300,
2207
+ statusCode: response.status
2208
+ };
2209
+ }
2210
+ /**
2211
+ * Gets a direct download URL for a file in the bucket
2212
+ *
2213
+ * @param options - Contains bucketId, folderId, file path and optional expiry time
2214
+ * @returns Promise resolving to blob file access information
2215
+ *
2216
+ * @example
2217
+ * ```typescript
2218
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2219
+ *
2220
+ * const buckets = new Buckets(sdk);
2221
+ *
2222
+ * // Get download URL for a file
2223
+ * const fileAccess = await buckets.getReadUri({
2224
+ * bucketId: 123,
2225
+ * folderId: 456,
2226
+ * path: '/folder/file.pdf'
2227
+ * });
2228
+ * ```
2229
+ */
2230
+ async getReadUri(options) {
2231
+ const { bucketId, folderId, path, expiryInMinutes, ...restOptions } = options;
2232
+ const queryOptions = {
2233
+ expiryInMinutes,
2234
+ ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
2235
+ };
2236
+ return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, folderId, path, queryOptions);
2237
+ }
2238
+ /**
2239
+ * Uploads content to the provided URI
2240
+ * @param uriResponse - Response from getWriteUri containing URL and headers
2241
+ * @param content - The content to upload
2242
+ * @returns The response from the upload request with status info
2243
+ */
2244
+ async _uploadToUri(uriResponse, content) {
2245
+ const { uri, headers = {}, requiresAuth } = uriResponse;
2246
+ if (!uri) {
2247
+ throw new ValidationError({ message: 'Upload URI not available', statusCode: HttpStatus.BAD_REQUEST });
2248
+ }
2249
+ // Create headers for the request
2250
+ let requestHeaders = { ...headers };
2251
+ // Add auth header if required
2252
+ if (requiresAuth) {
2253
+ const token = await this.getValidAuthToken();
2254
+ requestHeaders['Authorization'] = `Bearer ${token}`;
2255
+ }
2256
+ return fetch(uri, {
2257
+ method: 'PUT',
2258
+ body: content,
2259
+ headers: createHeaders(requestHeaders),
2260
+ });
2261
+ }
2262
+ /**
2263
+ * Private method to handle common URI request logic
2264
+ * @param endpoint - The API endpoint to call
2265
+ * @param bucketId - The bucket ID
2266
+ * @param folderId - The folder ID
2267
+ * @param path - The file path
2268
+ * @param queryOptions - Additional query parameters
2269
+ * @returns Promise resolving to blob file access information
2270
+ */
2271
+ async _getUri(endpoint, bucketId, folderId, path, queryOptions = {}) {
2272
+ if (!bucketId) {
2273
+ throw new ValidationError({ message: 'bucketId is required for getUri' });
2274
+ }
2275
+ if (!folderId) {
2276
+ throw new ValidationError({ message: 'folderId is required for getUri' });
2277
+ }
2278
+ if (!path) {
2279
+ throw new ValidationError({ message: 'path is required for getUri' });
2280
+ }
2281
+ // Create headers with required folder ID
2282
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2283
+ // Filter out undefined values and build query params
2284
+ const queryParams = filterUndefined({
2285
+ path,
2286
+ ...queryOptions
2287
+ });
2288
+ // Make the API call to get URI
2289
+ const response = await this.get(endpoint, {
2290
+ params: queryParams,
2291
+ headers
2292
+ });
2293
+ const transformedData = transformData(pascalToCamelCaseKeys(response.data), BucketMap);
2294
+ // Convert headers from array-based to record if needed
2295
+ if (transformedData.headers && 'keys' in transformedData.headers && 'values' in transformedData.headers) {
2296
+ transformedData.headers = arrayDictionaryToRecord(transformedData.headers);
2297
+ }
2298
+ return transformedData;
2299
+ }
2300
+ /**
2301
+ * Gets a direct upload URL for a file in the bucket
2302
+ *
2303
+ * @param options - Contains bucketId, folderId, file path, optional expiry time
2304
+ * @returns Promise resolving to blob file access information
2305
+ */
2306
+ async _getWriteUri(options) {
2307
+ const { bucketId, folderId, path, expiryInMinutes, ...restOptions } = options;
2308
+ const queryOptions = {
2309
+ expiryInMinutes,
2310
+ ...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
2311
+ };
2312
+ return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, folderId, path, queryOptions);
2313
+ }
2314
+ }
2315
+ __decorate([
2316
+ track('Buckets.GetById')
2317
+ ], BucketService.prototype, "getById", null);
2318
+ __decorate([
2319
+ track('Buckets.GetAll')
2320
+ ], BucketService.prototype, "getAll", null);
2321
+ __decorate([
2322
+ track('Buckets.GetFileMetaData')
2323
+ ], BucketService.prototype, "getFileMetaData", null);
2324
+ __decorate([
2325
+ track('Buckets.UploadFile')
2326
+ ], BucketService.prototype, "uploadFile", null);
2327
+ __decorate([
2328
+ track('Buckets.GetReadUri')
2329
+ ], BucketService.prototype, "getReadUri", null);
2330
+
2331
+ var BucketOptions;
2332
+ (function (BucketOptions) {
2333
+ BucketOptions["None"] = "None";
2334
+ BucketOptions["ReadOnly"] = "ReadOnly";
2335
+ BucketOptions["AuditReadAccess"] = "AuditReadAccess";
2336
+ BucketOptions["AccessDataThroughOrchestrator"] = "AccessDataThroughOrchestrator";
2337
+ })(BucketOptions || (BucketOptions = {}));
2338
+
2339
+ export { BucketOptions, BucketService, BucketService as Buckets };