@uipath/uipath-typescript 1.0.0-beta.17 → 1.0.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.
@@ -0,0 +1,1513 @@
1
+ import { IUiPath } from '../core/index';
2
+
3
+ /**
4
+ * Simplified universal pagination cursor
5
+ * Used to fetch next/previous pages
6
+ */
7
+ interface PaginationCursor {
8
+ /** Opaque string containing all information needed to fetch next page */
9
+ value: string;
10
+ }
11
+ /**
12
+ * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
13
+ */
14
+ type PaginationMethodUnion = {
15
+ cursor?: PaginationCursor;
16
+ jumpToPage?: never;
17
+ } | {
18
+ cursor?: never;
19
+ jumpToPage?: number;
20
+ } | {
21
+ cursor?: never;
22
+ jumpToPage?: never;
23
+ };
24
+ /**
25
+ * Pagination options. Users cannot specify both cursor and jumpToPage.
26
+ */
27
+ type PaginationOptions = {
28
+ /** Size of the page to fetch (items per page) */
29
+ pageSize?: number;
30
+ } & PaginationMethodUnion;
31
+ /**
32
+ * Paginated response containing items and navigation information
33
+ */
34
+ interface PaginatedResponse<T> {
35
+ /** The items in the current page */
36
+ items: T[];
37
+ /** Total count of items across all pages (if available) */
38
+ totalCount?: number;
39
+ /** Whether more pages are available */
40
+ hasNextPage: boolean;
41
+ /** Cursor to fetch the next page (if available) */
42
+ nextCursor?: PaginationCursor;
43
+ /** Cursor to fetch the previous page (if available) */
44
+ previousCursor?: PaginationCursor;
45
+ /** Current page number (1-based, if available) */
46
+ currentPage?: number;
47
+ /** Total number of pages (if available) */
48
+ totalPages?: number;
49
+ /** Whether this pagination type supports jumping to arbitrary pages */
50
+ supportsPageJump: boolean;
51
+ }
52
+ /**
53
+ * Response for non-paginated calls that includes both data and total count
54
+ */
55
+ interface NonPaginatedResponse<T> {
56
+ items: T[];
57
+ totalCount?: number;
58
+ }
59
+ /**
60
+ * Helper type for defining paginated method overloads
61
+ * Creates a union type of all ways pagination can be triggered
62
+ */
63
+ type HasPaginationOptions<T> = (T & {
64
+ pageSize: number;
65
+ }) | (T & {
66
+ cursor: PaginationCursor;
67
+ }) | (T & {
68
+ jumpToPage: number;
69
+ });
70
+
71
+ /**
72
+ * Pagination types supported by the SDK
73
+ */
74
+ declare enum PaginationType {
75
+ OFFSET = "offset",
76
+ TOKEN = "token"
77
+ }
78
+ /**
79
+ * Interface for service access methods needed by pagination helpers
80
+ */
81
+ interface PaginationServiceAccess {
82
+ get<T>(path: string, options?: any): Promise<{
83
+ data: T;
84
+ }>;
85
+ post<T>(path: string, body?: any, options?: any): Promise<{
86
+ data: T;
87
+ }>;
88
+ requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
89
+ }
90
+ /**
91
+ * Field names for extracting data from paginated responses.
92
+ */
93
+ interface PaginationFieldNames {
94
+ itemsField?: string;
95
+ totalCountField?: string;
96
+ continuationTokenField?: string;
97
+ }
98
+ /**
99
+ * Options for the requestWithPagination method in BaseService.
100
+ */
101
+ interface RequestWithPaginationOptions extends RequestSpec {
102
+ pagination: PaginationFieldNames & {
103
+ paginationType: PaginationType;
104
+ paginationParams?: {
105
+ pageSizeParam?: string;
106
+ offsetParam?: string;
107
+ tokenParam?: string;
108
+ countParam?: string;
109
+ };
110
+ };
111
+ }
112
+
113
+ /**
114
+ * HTTP methods supported by the API client
115
+ */
116
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
117
+ /**
118
+ * Supported response types for API requests
119
+ */
120
+ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
121
+ /**
122
+ * Query parameters type with support for arrays and nested objects
123
+ */
124
+ type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
125
+ /**
126
+ * Standard HTTP headers type
127
+ */
128
+ type Headers = Record<string, string>;
129
+ /**
130
+ * Options for request retries
131
+ */
132
+ interface RetryOptions {
133
+ /** Maximum number of retry attempts */
134
+ maxRetries?: number;
135
+ /** Base delay between retries in milliseconds */
136
+ retryDelay?: number;
137
+ /** Whether to use exponential backoff */
138
+ useExponentialBackoff?: boolean;
139
+ /** Status codes that should trigger a retry */
140
+ retryableStatusCodes?: number[];
141
+ }
142
+ /**
143
+ * Options for request timeouts
144
+ */
145
+ interface TimeoutOptions {
146
+ /** Request timeout in milliseconds */
147
+ timeout?: number;
148
+ /** Whether to abort the request on timeout */
149
+ abortOnTimeout?: boolean;
150
+ }
151
+ /**
152
+ * Options for request body transformation
153
+ */
154
+ interface BodyOptions {
155
+ /** Whether to stringify the body */
156
+ stringify?: boolean;
157
+ /** Content type override */
158
+ contentType?: string;
159
+ }
160
+ /**
161
+ * Pagination metadata for API requests
162
+ */
163
+ interface PaginationMetadata {
164
+ /** Type of pagination used by the API endpoint */
165
+ paginationType: PaginationType;
166
+ /** Response field containing items array (defaults to 'value') */
167
+ itemsField?: string;
168
+ /** Response field containing total count (defaults to '@odata.count') */
169
+ totalCountField?: string;
170
+ /** Response field containing continuation token (defaults to 'continuationToken') */
171
+ continuationTokenField?: string;
172
+ }
173
+ /**
174
+ * Base interface for all API requests
175
+ */
176
+ interface RequestSpec {
177
+ /** HTTP method for the request */
178
+ method?: HttpMethod;
179
+ /** URL endpoint for the request */
180
+ url?: string;
181
+ /** Query parameters to be appended to the URL */
182
+ params?: QueryParams;
183
+ /** HTTP headers to include with the request */
184
+ headers?: Headers;
185
+ /** Raw body content (takes precedence over data) */
186
+ body?: unknown;
187
+ /** Expected response type */
188
+ responseType?: ResponseType;
189
+ /** Request timeout options */
190
+ timeoutOptions?: TimeoutOptions;
191
+ /** Retry behavior options */
192
+ retryOptions?: RetryOptions;
193
+ /** Body transformation options */
194
+ bodyOptions?: BodyOptions;
195
+ /** AbortSignal for cancelling the request */
196
+ signal?: AbortSignal;
197
+ /** Pagination metadata for the request */
198
+ pagination?: PaginationMetadata;
199
+ }
200
+
201
+ interface ApiResponse<T> {
202
+ data: T;
203
+ }
204
+ /**
205
+ * Base class for all UiPath SDK services.
206
+ *
207
+ * Provides common functionality for authentication, configuration, and API communication.
208
+ * All service classes extend this base to inherit dependency injection and HTTP client access.
209
+ *
210
+ * This class implements the dependency injection pattern where services receive a configured
211
+ * UiPath instance. The ApiClient is created internally and handles all HTTP operations
212
+ * including authentication token management.
213
+ *
214
+ * @remarks
215
+ * Service classes should extend this base and call `super(uiPath)` in their constructor.
216
+ * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
217
+ *
218
+ */
219
+ declare class BaseService {
220
+ #private;
221
+ /**
222
+ * Creates a base service instance with dependency injection.
223
+ *
224
+ * Extracts configuration, execution context, and token manager from the UiPath instance
225
+ * to initialize an authenticated API client. The ApiClient handles all HTTP operations
226
+ * and token management internally.
227
+ *
228
+ * @param instance - UiPath SDK instance providing authentication and configuration.
229
+ * Services receive this via dependency injection in the modular pattern.
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // Services automatically call this via super()
234
+ * export class EntityService extends BaseService {
235
+ * constructor(instance: IUiPath) {
236
+ * super(instance); // Initializes the internal ApiClient
237
+ * }
238
+ * }
239
+ *
240
+ * // Usage in modular pattern
241
+ * import { UiPath } from '@uipath/uipath-typescript/core';
242
+ * import { Entities } from '@uipath/uipath-typescript/entities';
243
+ *
244
+ * const sdk = new UiPath(config);
245
+ * await sdk.initialize();
246
+ * const entities = new Entities(sdk);
247
+ * ```
248
+ */
249
+ constructor(instance: IUiPath);
250
+ /**
251
+ * Gets a valid authentication token, refreshing if necessary.
252
+ * Use this when you need to manually add Authorization headers (e.g., direct uploads).
253
+ *
254
+ * @returns Promise resolving to a valid access token string
255
+ * @throws AuthenticationError if no token is available or refresh fails
256
+ */
257
+ protected getValidAuthToken(): Promise<string>;
258
+ /**
259
+ * Creates a service accessor for pagination helpers
260
+ * This allows pagination helpers to access protected methods without making them public
261
+ */
262
+ protected createPaginationServiceAccess(): PaginationServiceAccess;
263
+ protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
264
+ protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
265
+ protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
266
+ protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
267
+ protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
268
+ protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
269
+ protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
270
+ /**
271
+ * Execute a request with cursor-based pagination
272
+ */
273
+ protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
274
+ /**
275
+ * Validates and prepares pagination parameters from options
276
+ */
277
+ private validateAndPreparePaginationParams;
278
+ /**
279
+ * Prepares request parameters for pagination based on pagination type
280
+ */
281
+ private preparePaginationRequestParams;
282
+ /**
283
+ * Creates a paginated response from API response
284
+ */
285
+ private createPaginatedResponseFromResponse;
286
+ /**
287
+ * Determines if there are more pages based on pagination type and metadata
288
+ */
289
+ private determineHasMorePages;
290
+ }
291
+
292
+ /**
293
+ * Entity field type names
294
+ */
295
+ declare enum EntityFieldDataType {
296
+ UUID = "UUID",
297
+ STRING = "STRING",
298
+ INTEGER = "INTEGER",
299
+ DATETIME = "DATETIME",
300
+ DATETIME_WITH_TZ = "DATETIME_WITH_TZ",
301
+ DECIMAL = "DECIMAL",
302
+ FLOAT = "FLOAT",
303
+ DOUBLE = "DOUBLE",
304
+ DATE = "DATE",
305
+ BOOLEAN = "BOOLEAN",
306
+ BIG_INTEGER = "BIG_INTEGER",
307
+ MULTILINE_TEXT = "MULTILINE_TEXT"
308
+ }
309
+ /**
310
+ * Represents a single entity record
311
+ */
312
+ interface EntityRecord {
313
+ /**
314
+ * Unique identifier for the record
315
+ */
316
+ id: string;
317
+ /**
318
+ * Additional dynamic fields for the entity
319
+ */
320
+ [key: string]: any;
321
+ }
322
+ /**
323
+ * Options for getting an entity by Id
324
+ * @deprecated Use {@link EntityGetRecordByIdOptions} instead for better clarity on getting all records of an entity. This type will be removed in future versions.
325
+ */
326
+ type EntityGetRecordsByIdOptions = {
327
+ /** Level of entity expansion (default: 0) */
328
+ expansionLevel?: number;
329
+ } & PaginationOptions;
330
+ /**
331
+ * Options for getting all records of an entity
332
+ */
333
+ type EntityGetAllRecordsOptions = EntityGetRecordsByIdOptions;
334
+ /**
335
+ * Options for getting a single entity record by entity ID and record ID
336
+ */
337
+ interface EntityGetRecordByIdOptions {
338
+ /** Level of entity expansion (default: 0) */
339
+ expansionLevel?: number;
340
+ }
341
+ /**
342
+ * Common options for entity operations that modify multiple records
343
+ */
344
+ interface EntityOperationOptions {
345
+ /** Level of entity expansion (default: 0) */
346
+ expansionLevel?: number;
347
+ /** Whether to fail on first error (default: false) */
348
+ failOnFirst?: boolean;
349
+ }
350
+ /**
351
+ * Options for inserting a single record into an entity
352
+ * @deprecated Use {@link EntityInsertRecordOptions} instead for better clarity on inserting a single record into an entity. This type will be removed in future versions.
353
+ */
354
+ interface EntityInsertOptions {
355
+ /** Level of entity expansion (default: 0) */
356
+ expansionLevel?: number;
357
+ }
358
+ /**
359
+ * Options for inserting a single record into an entity
360
+ */
361
+ type EntityInsertRecordOptions = EntityInsertOptions;
362
+ /**
363
+ * Options for batch inserting data into an entity
364
+ * @deprecated Use {@link EntityInsertRecordsOptions} instead for better clarity on inserting multiple records into an entity. This type will be removed in future versions.
365
+ */
366
+ type EntityBatchInsertOptions = EntityOperationOptions;
367
+ /**
368
+ * Options for inserting multiple records into an entity
369
+ */
370
+ type EntityInsertRecordsOptions = EntityOperationOptions;
371
+ /**
372
+ * Options for updating data in an entity
373
+ * @deprecated Use {@link EntityUpdateRecordOptions} instead for better clarity on updating records in an entity. This type will be removed in future versions.
374
+ */
375
+ type EntityUpdateOptions = EntityOperationOptions;
376
+ /**
377
+ * Options for updating data in an entity
378
+ */
379
+ type EntityUpdateRecordsOptions = EntityOperationOptions;
380
+ /**
381
+ * Options for deleting data from an entity
382
+ * @deprecated Use {@link EntityDeleteRecordsOptions} instead for better clarity on deleting records from an entity. This type will be removed in future versions.
383
+ */
384
+ interface EntityDeleteOptions {
385
+ /** Whether to fail on first error (default: false) */
386
+ failOnFirst?: boolean;
387
+ }
388
+ /**
389
+ * Options for deleting records in an entity
390
+ */
391
+ type EntityDeleteRecordsOptions = EntityDeleteOptions;
392
+ /**
393
+ * Options for downloading an attachment from an entity record
394
+ */
395
+ interface EntityDownloadAttachmentOptions {
396
+ /** Entity name */
397
+ entityName: string;
398
+ /** Record ID */
399
+ recordId: string;
400
+ /** Field name containing the attachment */
401
+ fieldName: string;
402
+ }
403
+ /**
404
+ * Represents a failure record in an entity operation
405
+ */
406
+ interface FailureRecord {
407
+ /** Error message */
408
+ error?: string;
409
+ /** Original record that failed */
410
+ record?: Record<string, any>;
411
+ }
412
+ /**
413
+ * Response from an entity operation that modifies multiple records
414
+ */
415
+ interface EntityOperationResponse {
416
+ /** Records that were successfully processed */
417
+ successRecords: Record<string, any>[];
418
+ /** Records that failed processing */
419
+ failureRecords: FailureRecord[];
420
+ }
421
+ /**
422
+ * Response from inserting a single record into an entity
423
+ * Returns the inserted record with its generated record ID and other fields
424
+ */
425
+ type EntityInsertResponse = EntityRecord;
426
+ /**
427
+ * Response from batch inserting data into an entity
428
+ */
429
+ type EntityBatchInsertResponse = EntityOperationResponse;
430
+ /**
431
+ * Response from updating data in an entity
432
+ */
433
+ type EntityUpdateResponse = EntityOperationResponse;
434
+ /**
435
+ * Response from deleting data from an entity
436
+ */
437
+ type EntityDeleteResponse = EntityOperationResponse;
438
+ /**
439
+ * Entity type enum
440
+ */
441
+ declare enum EntityType {
442
+ Entity = "Entity",
443
+ ChoiceSet = "ChoiceSet",
444
+ InternalEntity = "InternalEntity",
445
+ SystemEntity = "SystemEntity"
446
+ }
447
+ /**
448
+ * Field type metadata
449
+ */
450
+ interface FieldDataType {
451
+ name: EntityFieldDataType;
452
+ lengthLimit?: number;
453
+ maxValue?: number;
454
+ minValue?: number;
455
+ decimalPrecision?: number;
456
+ }
457
+ /**
458
+ * Reference types for fields
459
+ */
460
+ declare enum ReferenceType {
461
+ ManyToOne = "ManyToOne"
462
+ }
463
+ /**
464
+ * Field display types
465
+ */
466
+ declare enum FieldDisplayType {
467
+ Basic = "Basic",
468
+ Relationship = "Relationship",
469
+ File = "File",
470
+ ChoiceSetSingle = "ChoiceSetSingle",
471
+ ChoiceSetMultiple = "ChoiceSetMultiple",
472
+ AutoNumber = "AutoNumber"
473
+ }
474
+ /**
475
+ * Data direction type for external fields
476
+ */
477
+ declare enum DataDirectionType {
478
+ ReadOnly = "ReadOnly",
479
+ ReadAndWrite = "ReadAndWrite"
480
+ }
481
+ /**
482
+ * Join type for source join criteria
483
+ */
484
+ declare enum JoinType {
485
+ LeftJoin = "LeftJoin"
486
+ }
487
+ /**
488
+ * Field reference with ID
489
+ */
490
+ interface Field {
491
+ id: string;
492
+ definition?: FieldMetaData;
493
+ }
494
+ /**
495
+ * Detailed field definition
496
+ */
497
+ interface FieldMetaData {
498
+ id: string;
499
+ name: string;
500
+ isPrimaryKey: boolean;
501
+ isForeignKey: boolean;
502
+ isExternalField: boolean;
503
+ isHiddenField: boolean;
504
+ isUnique: boolean;
505
+ referenceName?: string;
506
+ referenceEntity?: RawEntityGetResponse;
507
+ referenceChoiceSet?: RawEntityGetResponse;
508
+ referenceField?: Field;
509
+ referenceType: ReferenceType;
510
+ fieldDataType: FieldDataType;
511
+ isRequired: boolean;
512
+ displayName: string;
513
+ description: string;
514
+ createdTime: string;
515
+ createdBy: string;
516
+ updatedTime: string;
517
+ updatedBy?: string;
518
+ isSystemField: boolean;
519
+ fieldDisplayType?: FieldDisplayType;
520
+ choiceSetId?: string;
521
+ defaultValue?: string;
522
+ isAttachment: boolean;
523
+ isRbacEnabled: boolean;
524
+ }
525
+ /**
526
+ * External object details
527
+ */
528
+ interface ExternalObject {
529
+ id: string;
530
+ externalObjectName?: string;
531
+ externalObjectDisplayName?: string;
532
+ primaryKey?: string;
533
+ externalConnectionId: string;
534
+ entityId?: string;
535
+ isPrimarySource: boolean;
536
+ }
537
+ /**
538
+ * External connection details
539
+ */
540
+ interface ExternalConnection {
541
+ id: string;
542
+ connectionId: string;
543
+ elementInstanceId: number;
544
+ folderKey: string;
545
+ connectorKey?: string;
546
+ connectorName?: string;
547
+ connectionName?: string;
548
+ }
549
+ /**
550
+ * External field mapping
551
+ */
552
+ interface ExternalFieldMapping {
553
+ id: string;
554
+ externalFieldName?: string;
555
+ externalFieldDisplayName?: string;
556
+ externalObjectId: string;
557
+ externalFieldType?: string;
558
+ internalFieldId: string;
559
+ directionType: DataDirectionType;
560
+ }
561
+ /**
562
+ * External field
563
+ */
564
+ interface ExternalField {
565
+ fieldMetaData: FieldMetaData;
566
+ externalFieldMappingDetail: ExternalFieldMapping;
567
+ }
568
+ /**
569
+ * External source fields
570
+ */
571
+ interface ExternalSourceFields {
572
+ fields?: ExternalField[];
573
+ externalObjectDetail?: ExternalObject;
574
+ externalConnectionDetail?: ExternalConnection;
575
+ }
576
+ /**
577
+ * Source join criteria
578
+ */
579
+ interface SourceJoinCriteria {
580
+ id: string;
581
+ entityId: string;
582
+ joinFieldName?: string;
583
+ joinType: JoinType;
584
+ relatedSourceObjectId?: string;
585
+ relatedSourceFieldName?: string;
586
+ }
587
+ /**
588
+ * Entity metadata returned by getById
589
+ */
590
+ interface RawEntityGetResponse {
591
+ name: string;
592
+ displayName: string;
593
+ entityType: EntityType;
594
+ description: string;
595
+ fields: FieldMetaData[];
596
+ externalFields?: ExternalSourceFields[];
597
+ sourceJoinCriterias?: SourceJoinCriteria[];
598
+ recordCount?: number;
599
+ storageSizeInMB?: number;
600
+ usedStorageSizeInMB?: number;
601
+ attachmentSizeInByte?: number;
602
+ isRbacEnabled: boolean;
603
+ id: string;
604
+ createdBy: string;
605
+ createdTime: string;
606
+ updatedTime?: string;
607
+ updatedBy?: string;
608
+ }
609
+
610
+ /**
611
+ * Service for managing UiPath Data Fabric Entities.
612
+ *
613
+ * Entities are collections of records that can be used to store and manage data in the Data Fabric. [UiPath Data Fabric Guide](https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/introduction)
614
+ *
615
+ * ### Usage
616
+ *
617
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
618
+ *
619
+ * ```typescript
620
+ * import { Entities } from '@uipath/uipath-typescript/entities';
621
+ *
622
+ * const entities = new Entities(sdk);
623
+ * const allEntities = await entities.getAll();
624
+ * ```
625
+ */
626
+ interface EntityServiceModel {
627
+ /**
628
+ * Gets all entities in the system
629
+ *
630
+ * @returns Promise resolving to either an array of entities NonPaginatedResponse<EntityGetResponse> or a PaginatedResponse<EntityGetResponse> when pagination options are used.
631
+ * {@link EntityGetResponse}
632
+ * @example
633
+ * ```typescript
634
+ * // Get all entities
635
+ * const allEntities = await entities.getAll();
636
+ *
637
+ * // Iterate through entities
638
+ * allEntities.forEach(entity => {
639
+ * console.log(`Entity: ${entity.displayName} (${entity.name})`);
640
+ * console.log(`Type: ${entity.entityType}`);
641
+ * });
642
+ *
643
+ * // Find a specific entity by name
644
+ * const customerEntity = allEntities.find(e => e.name === 'Customer');
645
+ *
646
+ * // Use entity methods directly
647
+ * if (customerEntity) {
648
+ * const records = await customerEntity.getAllRecords();
649
+ * console.log(`Customer records: ${records.items.length}`);
650
+ *
651
+ * // Insert a single record
652
+ * const insertResult = await customerEntity.insertRecord({ name: "John", age: 30 });
653
+ *
654
+ * // Or batch insert multiple records
655
+ * const batchResult = await customerEntity.insertRecords([
656
+ * { name: "Jane", age: 25 },
657
+ * { name: "Bob", age: 35 }
658
+ * ]);
659
+ * }
660
+ * ```
661
+ */
662
+ getAll(): Promise<EntityGetResponse[]>;
663
+ /**
664
+ * Gets entity metadata by entity ID with attached operation methods
665
+ *
666
+ * @param id - UUID of the entity
667
+ * @returns Promise resolving to entity metadata with operation methods
668
+ * {@link EntityGetResponse}
669
+ * @example
670
+ * ```typescript
671
+ * import { Entities, ChoiceSets } from '@uipath/uipath-typescript/entities';
672
+ *
673
+ * const entities = new Entities(sdk);
674
+ * const choicesets = new ChoiceSets(sdk);
675
+ *
676
+ * // Get entity metadata with methods
677
+ * const entity = await entities.getById(<entityId>);
678
+ *
679
+ * // Call operations directly on the entity
680
+ * const records = await entity.getAllRecords();
681
+ *
682
+ * // If a field references a ChoiceSet, get the choiceSetId from records.fields
683
+ * const choiceSetId = records.fields[0].referenceChoiceSet?.id;
684
+ * if (choiceSetId) {
685
+ * const choiceSetValues = await choicesets.getById(choiceSetId);
686
+ * }
687
+ *
688
+ * // Insert a single record
689
+ * const insertResult = await entity.insertRecord({ name: "John", age: 30 });
690
+ *
691
+ * // Or batch insert multiple records
692
+ * const batchResult = await entity.insertRecords([
693
+ * { name: "Jane", age: 25 },
694
+ * { name: "Bob", age: 35 }
695
+ * ]);
696
+ * ```
697
+ */
698
+ getById(id: string): Promise<EntityGetResponse>;
699
+ /**
700
+ * Gets entity records by entity ID
701
+ *
702
+ * @param entityId - UUID of the entity
703
+ * @param options - Query options
704
+ * @returns Promise resolving to either an array of entity records NonPaginatedResponse<EntityRecord> or a PaginatedResponse<EntityRecord> when pagination options are used.
705
+ * {@link EntityRecord}
706
+ * @example
707
+ * ```typescript
708
+ * // Basic usage (non-paginated)
709
+ * const records = await entities.getAllRecords(<entityId>);
710
+ *
711
+ * // With expansion level
712
+ * const records = await entities.getAllRecords(<entityId>, {
713
+ * expansionLevel: 1
714
+ * });
715
+ *
716
+ * // With pagination
717
+ * const paginatedResponse = await entities.getAllRecords(<entityId>, {
718
+ * pageSize: 50,
719
+ * expansionLevel: 1
720
+ * });
721
+ *
722
+ * // Navigate to next page
723
+ * const nextPage = await entities.getAllRecords(<entityId>, {
724
+ * cursor: paginatedResponse.nextCursor,
725
+ * expansionLevel: 1
726
+ * });
727
+ * ```
728
+ */
729
+ getAllRecords<T extends EntityGetAllRecordsOptions = EntityGetAllRecordsOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
730
+ /**
731
+ * @deprecated Use {@link getAllRecords} instead.
732
+ * @hidden
733
+ */
734
+ getRecordsById<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
735
+ /**
736
+ * Gets a single entity record by entity ID and record ID
737
+ *
738
+ * @param entityId - UUID of the entity
739
+ * @param recordId - UUID of the record
740
+ * @param options - Query options
741
+ * @returns Promise resolving to a single entity record
742
+ * {@link EntityRecord}
743
+ * @example
744
+ * ```typescript
745
+ * // First, get records to obtain the record ID
746
+ * const records = await entities.getAllRecords(<entityId>);
747
+ * // Get the recordId for the record
748
+ * const recordId = records.items[0].id;
749
+ * // Get the record
750
+ * const record = await entities.getRecordById(<entityId>, recordId);
751
+ *
752
+ * // With expansion level
753
+ * const record = await entities.getRecordById(<entityId>, recordId, {
754
+ * expansionLevel: 1
755
+ * });
756
+ * ```
757
+ */
758
+ getRecordById(entityId: string, recordId: string, options?: EntityGetRecordByIdOptions): Promise<EntityRecord>;
759
+ /**
760
+ * Inserts a single record into an entity by entity ID
761
+ *
762
+ * Note: Data Fabric supports trigger events only on individual inserts, not on inserting multiple records.
763
+ * Use this method if you need trigger events to fire for the inserted record.
764
+ *
765
+ * @param id - UUID of the entity
766
+ * @param data - Record to insert
767
+ * @param options - Insert options
768
+ * @returns Promise resolving to the inserted record with generated record ID
769
+ * {@link EntityInsertResponse}
770
+ * @example
771
+ * ```typescript
772
+ * // Basic usage
773
+ * const result = await entities.insertRecordById(<entityId>, { name: "John", age: 30 });
774
+ *
775
+ * // With options
776
+ * const result = await entities.insertRecordById(<entityId>, { name: "John", age: 30 }, {
777
+ * expansionLevel: 1
778
+ * });
779
+ * ```
780
+ */
781
+ insertRecordById(id: string, data: Record<string, any>, options?: EntityInsertRecordOptions): Promise<EntityInsertResponse>;
782
+ /**
783
+ * @deprecated Use {@link insertRecordById} instead.
784
+ * @hidden
785
+ */
786
+ insertById(id: string, data: Record<string, any>, options?: EntityInsertOptions): Promise<EntityInsertResponse>;
787
+ /**
788
+ * Inserts one or more records into an entity by entity ID
789
+ *
790
+ * Note: Records inserted using insertRecordsById will not trigger Data Fabric trigger events. Use {@link insertRecordById} if you need
791
+ * trigger events to fire for each inserted record.
792
+ *
793
+ * @param id - UUID of the entity
794
+ * @param data - Array of records to insert
795
+ * @param options - Insert options
796
+ * @returns Promise resolving to insert response
797
+ * {@link EntityBatchInsertResponse}
798
+ * @example
799
+ * ```typescript
800
+ * // Basic usage
801
+ * const result = await entities.insertRecordsById(<entityId>, [
802
+ * { name: "John", age: 30 },
803
+ * { name: "Jane", age: 25 }
804
+ * ]);
805
+ *
806
+ * // With options
807
+ * const result = await entities.insertRecordsById(<entityId>, [
808
+ * { name: "John", age: 30 },
809
+ * { name: "Jane", age: 25 }
810
+ * ], {
811
+ * expansionLevel: 1,
812
+ * failOnFirst: true
813
+ * });
814
+ * ```
815
+ */
816
+ insertRecordsById(id: string, data: Record<string, any>[], options?: EntityInsertRecordsOptions): Promise<EntityBatchInsertResponse>;
817
+ /**
818
+ * @deprecated Use {@link insertRecordsById} instead.
819
+ * @hidden
820
+ */
821
+ batchInsertById(id: string, data: Record<string, any>[], options?: EntityBatchInsertOptions): Promise<EntityBatchInsertResponse>;
822
+ /**
823
+ * Updates data in an entity by entity ID
824
+ *
825
+ * @param id - UUID of the entity
826
+ * @param data - Array of records to update. Each record MUST contain the record Id.
827
+ * @param options - Update options
828
+ * @returns Promise resolving to update response
829
+ * {@link EntityUpdateResponse}
830
+ * @example
831
+ * ```typescript
832
+ * // Basic usage
833
+ * const result = await entities.updateRecordsById(<entityId>, [
834
+ * { Id: "123", name: "John Updated", age: 31 },
835
+ * { Id: "456", name: "Jane Updated", age: 26 }
836
+ * ]);
837
+ *
838
+ * // With options
839
+ * const result = await entities.updateRecordsById(<entityId>, [
840
+ * { Id: "123", name: "John Updated", age: 31 },
841
+ * { Id: "456", name: "Jane Updated", age: 26 }
842
+ * ], {
843
+ * expansionLevel: 1,
844
+ * failOnFirst: true
845
+ * });
846
+ * ```
847
+ */
848
+ updateRecordsById(id: string, data: EntityRecord[], options?: EntityUpdateRecordsOptions): Promise<EntityUpdateResponse>;
849
+ /**
850
+ * @deprecated Use {@link updateRecordsById} instead.
851
+ * @hidden
852
+ */
853
+ updateById(id: string, data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
854
+ /**
855
+ * Deletes data from an entity by entity ID
856
+ *
857
+ * @param id - UUID of the entity
858
+ * @param recordIds - Array of record UUIDs to delete
859
+ * @param options - Delete options
860
+ * @returns Promise resolving to delete response
861
+ * {@link EntityDeleteResponse}
862
+ * @example
863
+ * ```typescript
864
+ * // Basic usage
865
+ * const result = await entities.deleteRecordsById(<entityId>, [
866
+ * <recordId-1>, <recordId-2>
867
+ * ]);
868
+ * ```
869
+ */
870
+ deleteRecordsById(id: string, recordIds: string[], options?: EntityDeleteRecordsOptions): Promise<EntityDeleteResponse>;
871
+ /**
872
+ * @deprecated Use {@link deleteRecordsById} instead.
873
+ * @hidden
874
+ */
875
+ deleteById(id: string, recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
876
+ /**
877
+ * Downloads an attachment stored in a File-type field of an entity record.
878
+ *
879
+ * @param options - Options containing entityName, recordId, and fieldName
880
+ * @returns Promise resolving to Blob containing the file content
881
+ * @example
882
+ * ```typescript
883
+ * import { Entities } from '@uipath/uipath-typescript/entities';
884
+ *
885
+ * const entities = new Entities(sdk);
886
+ *
887
+ * // First, get records to obtain the record ID
888
+ * const records = await entities.getAllRecords("<entityId>");
889
+ * // Get the recordId for the record that contains the attachment
890
+ * const recordId = records.items[0].id;
891
+ *
892
+ * // Download attachment using service method
893
+ * const response = await entities.downloadAttachment({
894
+ * entityName: 'Invoice',
895
+ * recordId: recordId,
896
+ * fieldName: 'Documents'
897
+ * });
898
+ *
899
+ * // Or download using entity method
900
+ * const entity = await entities.getById("<entityId>");
901
+ * const blob = await entity.downloadAttachment(recordId, 'Documents');
902
+ *
903
+ * // Browser: Display Image
904
+ * const url = URL.createObjectURL(response);
905
+ * document.getElementById('image').src = url;
906
+ * // Call URL.revokeObjectURL(url) when done
907
+ *
908
+ * // Browser: Display PDF in iframe
909
+ * const url = URL.createObjectURL(response);
910
+ * document.getElementById('pdf-viewer').src = url;
911
+ * // Call URL.revokeObjectURL(url) when done
912
+ *
913
+ * // Browser: Render PDF with PDF.js
914
+ * const arrayBuffer = await response.arrayBuffer();
915
+ * const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;
916
+ *
917
+ * // Node.js: Save to file
918
+ * const buffer = Buffer.from(await response.arrayBuffer());
919
+ * fs.writeFileSync('attachment.pdf', buffer);
920
+ * ```
921
+ */
922
+ downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
923
+ }
924
+ /**
925
+ * Entity methods interface - defines operations that can be performed on an entity
926
+ */
927
+ interface EntityMethods {
928
+ /**
929
+ * Insert a single record into this entity
930
+ *
931
+ * Note: Data Fabric supports trigger events only on individual inserts, not on inserting multiple records.
932
+ * Use this method if you need trigger events to fire for the inserted record.
933
+ *
934
+ * @param data - Record to insert
935
+ * @param options - Insert options
936
+ * @returns Promise resolving to the inserted record with generated record ID
937
+ */
938
+ insertRecord(data: Record<string, any>, options?: EntityInsertRecordOptions): Promise<EntityInsertResponse>;
939
+ /**
940
+ * Insert multiple records into this entity using insertRecords
941
+ *
942
+ * Note: Inserting multiple records do not trigger Data Fabric trigger events. Use {@link insertRecord} if you need
943
+ * trigger events to fire for each inserted record.
944
+ *
945
+ * @param data - Array of records to insert
946
+ * @param options - Insert options
947
+ * @returns Promise resolving to batch insert response
948
+ */
949
+ insertRecords(data: Record<string, any>[], options?: EntityInsertRecordsOptions): Promise<EntityBatchInsertResponse>;
950
+ /**
951
+ * Update data in this entity
952
+ *
953
+ * @param data - Array of records to update. Each record MUST contain the record Id,
954
+ * otherwise the update will fail.
955
+ * @param options - Update options
956
+ * @returns Promise resolving to update response
957
+ */
958
+ updateRecords(data: EntityRecord[], options?: EntityUpdateRecordsOptions): Promise<EntityUpdateResponse>;
959
+ /**
960
+ * Delete data from this entity
961
+ *
962
+ * @param recordIds - Array of record UUIDs to delete
963
+ * @param options - Delete options
964
+ * @returns Promise resolving to delete response
965
+ */
966
+ deleteRecords(recordIds: string[], options?: EntityDeleteRecordsOptions): Promise<EntityDeleteResponse>;
967
+ /**
968
+ * Get all records from this entity
969
+ *
970
+ * @param options - Query options
971
+ * @returns Promise resolving to query response
972
+ */
973
+ getAllRecords<T extends EntityGetAllRecordsOptions = EntityGetAllRecordsOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
974
+ /**
975
+ * Gets a single record from this entity by record ID
976
+ *
977
+ * @param recordId - UUID of the record
978
+ * @param options - Query options including expansionLevel
979
+ * @returns Promise resolving to the entity record
980
+ */
981
+ getRecord(recordId: string, options?: EntityGetRecordByIdOptions): Promise<EntityRecord>;
982
+ /**
983
+ * Downloads an attachment stored in a File-type field of an entity record
984
+ *
985
+ * @param recordId - UUID of the record containing the attachment
986
+ * @param fieldName - Name of the File-type field containing the attachment
987
+ * @returns Promise resolving to Blob containing the file content
988
+ */
989
+ downloadAttachment(recordId: string, fieldName: string): Promise<Blob>;
990
+ /**
991
+ * @deprecated Use {@link insertRecord} instead.
992
+ * @hidden
993
+ */
994
+ insert(data: Record<string, any>, options?: EntityInsertOptions): Promise<EntityInsertResponse>;
995
+ /**
996
+ * @deprecated Use {@link insertRecords} instead.
997
+ * @hidden
998
+ */
999
+ batchInsert(data: Record<string, any>[], options?: EntityBatchInsertOptions): Promise<EntityBatchInsertResponse>;
1000
+ /**
1001
+ * @deprecated Use {@link updateRecords} instead.
1002
+ * @hidden
1003
+ */
1004
+ update(data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
1005
+ /**
1006
+ * @deprecated Use {@link deleteRecords} instead.
1007
+ * @hidden
1008
+ */
1009
+ delete(recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
1010
+ /**
1011
+ * @deprecated Use {@link getAllRecords} instead.
1012
+ * @hidden
1013
+ */
1014
+ getRecords<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
1015
+ }
1016
+ /**
1017
+ * Entity with methods combining metadata with operation methods
1018
+ */
1019
+ type EntityGetResponse = RawEntityGetResponse & EntityMethods;
1020
+ /**
1021
+ * Creates an actionable entity metadata by combining entity with operational methods
1022
+ *
1023
+ * @param entityData - Entity metadata
1024
+ * @param service - The entity service instance
1025
+ * @returns Entity metadata with added methods
1026
+ */
1027
+ declare function createEntityWithMethods(entityData: RawEntityGetResponse, service: EntityServiceModel): EntityGetResponse;
1028
+
1029
+ /**
1030
+ * Service for interacting with the Data Fabric Entity API
1031
+ */
1032
+ declare class EntityService extends BaseService implements EntityServiceModel {
1033
+ /**
1034
+ * Gets entity metadata by entity ID with attached operation methods
1035
+ *
1036
+ * @param id - UUID of the entity
1037
+ * @returns Promise resolving to entity metadata with schema information and operation methods
1038
+ *
1039
+ * @example
1040
+ * ```typescript
1041
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1042
+ *
1043
+ * const entities = new Entities(sdk);
1044
+ * const entity = await entities.getById("<entityId>");
1045
+ *
1046
+ * // Call operations directly on the entity
1047
+ * const records = await entity.getAllRecords();
1048
+ *
1049
+ * // Insert a single record
1050
+ * const insertResult = await entity.insertRecord({ name: "John", age: 30 });
1051
+ *
1052
+ * // Or batch insert multiple records
1053
+ * const batchResult = await entity.insertRecords([
1054
+ * { name: "Jane", age: 25 },
1055
+ * { name: "Bob", age: 35 }
1056
+ * ]);
1057
+ * ```
1058
+ */
1059
+ getById(id: string): Promise<EntityGetResponse>;
1060
+ /**
1061
+ * Gets entity records by entity ID
1062
+ *
1063
+ * @param entityId - UUID of the entity
1064
+ * @param options - Query options including expansionLevel and pagination options
1065
+ * @returns Promise resolving to an array of entity records or paginated response
1066
+ *
1067
+ * @example
1068
+ * ```typescript
1069
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1070
+ *
1071
+ * const entities = new Entities(sdk);
1072
+ *
1073
+ * // Basic usage (non-paginated)
1074
+ * const records = await entities.getAllRecords("<entityId>");
1075
+ *
1076
+ * // With expansion level
1077
+ * const records = await entities.getAllRecords("<entityId>", {
1078
+ * expansionLevel: 1
1079
+ * });
1080
+ *
1081
+ * // With pagination
1082
+ * const paginatedResponse = await entities.getAllRecords("<entityId>", {
1083
+ * pageSize: 50,
1084
+ * expansionLevel: 1
1085
+ * });
1086
+ *
1087
+ * // Navigate to next page
1088
+ * const nextPage = await entities.getAllRecords("<entityId>", {
1089
+ * cursor: paginatedResponse.nextCursor,
1090
+ * expansionLevel: 1
1091
+ * });
1092
+ * ```
1093
+ */
1094
+ getAllRecords<T extends EntityGetAllRecordsOptions = EntityGetAllRecordsOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
1095
+ /**
1096
+ * Gets a single entity record by entity ID and record ID
1097
+ *
1098
+ * @param entityId - UUID of the entity
1099
+ * @param recordId - UUID of the record
1100
+ * @param options - Query options including expansionLevel
1101
+ * @returns Promise resolving to the entity record
1102
+ *
1103
+ * @example
1104
+ * ```typescript
1105
+ * // Basic usage
1106
+ * const record = await sdk.entities.getRecordById(<entityId>, <recordId>);
1107
+ *
1108
+ * // With expansion level
1109
+ * const record = await sdk.entities.getRecordById(<entityId>, <recordId>, {
1110
+ * expansionLevel: 1
1111
+ * });
1112
+ * ```
1113
+ */
1114
+ getRecordById(entityId: string, recordId: string, options?: EntityGetRecordByIdOptions): Promise<EntityRecord>;
1115
+ /**
1116
+ * Inserts a single record into an entity by entity ID
1117
+ *
1118
+ * @param entityId - UUID of the entity
1119
+ * @param data - Record to insert
1120
+ * @param options - Insert options
1121
+ * @returns Promise resolving to the inserted record with generated record ID
1122
+ *
1123
+ * @example
1124
+ * ```typescript
1125
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1126
+ *
1127
+ * const entities = new Entities(sdk);
1128
+ *
1129
+ * // Basic usage
1130
+ * const result = await entities.insertRecordById("<entityId>", { name: "John", age: 30 });
1131
+ *
1132
+ * // With options
1133
+ * const result = await entities.insertRecordById("<entityId>", { name: "John", age: 30 }, {
1134
+ * expansionLevel: 1
1135
+ * });
1136
+ * ```
1137
+ */
1138
+ insertRecordById(id: string, data: Record<string, any>, options?: EntityInsertRecordOptions): Promise<EntityInsertResponse>;
1139
+ /**
1140
+ * Inserts data into an entity by entity ID using batch insert
1141
+ *
1142
+ * @param entityId - UUID of the entity
1143
+ * @param data - Array of records to insert
1144
+ * @param options - Insert options
1145
+ * @returns Promise resolving to insert response
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1150
+ *
1151
+ * const entities = new Entities(sdk);
1152
+ *
1153
+ * // Basic usage
1154
+ * const result = await entities.insertRecordsById("<entityId>", [
1155
+ * { name: "John", age: 30 },
1156
+ * { name: "Jane", age: 25 }
1157
+ * ]);
1158
+ *
1159
+ * // With options
1160
+ * const result = await entities.insertRecordsById("<entityId>", [
1161
+ * { name: "John", age: 30 },
1162
+ * { name: "Jane", age: 25 }
1163
+ * ], {
1164
+ * expansionLevel: 1,
1165
+ * failOnFirst: true
1166
+ * });
1167
+ * ```
1168
+ */
1169
+ insertRecordsById(id: string, data: Record<string, any>[], options?: EntityInsertRecordsOptions): Promise<EntityBatchInsertResponse>;
1170
+ /**
1171
+ * Updates data in an entity by entity ID
1172
+ *
1173
+ * @param entityId - UUID of the entity
1174
+ * @param data - Array of records to update. Each record MUST contain the record Id,
1175
+ * otherwise the update will fail.
1176
+ * @param options - Update options
1177
+ * @returns Promise resolving to update response
1178
+ *
1179
+ * @example
1180
+ * ```typescript
1181
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1182
+ *
1183
+ * const entities = new Entities(sdk);
1184
+ *
1185
+ * // Basic usage
1186
+ * const result = await entities.updateRecordsById("<entityId>", [
1187
+ * { Id: "123", name: "John Updated", age: 31 },
1188
+ * { Id: "456", name: "Jane Updated", age: 26 }
1189
+ * ]);
1190
+ *
1191
+ * // With options
1192
+ * const result = await entities.updateRecordsById("<entityId>", [
1193
+ * { Id: "123", name: "John Updated", age: 31 },
1194
+ * { Id: "456", name: "Jane Updated", age: 26 }
1195
+ * ], {
1196
+ * expansionLevel: 1,
1197
+ * failOnFirst: true
1198
+ * });
1199
+ * ```
1200
+ */
1201
+ updateRecordsById(id: string, data: EntityRecord[], options?: EntityUpdateRecordsOptions): Promise<EntityUpdateResponse>;
1202
+ /**
1203
+ * Deletes data from an entity by entity ID
1204
+ *
1205
+ * @param entityId - UUID of the entity
1206
+ * @param recordIds - Array of record UUIDs to delete
1207
+ * @param options - Delete options
1208
+ * @returns Promise resolving to delete response
1209
+ *
1210
+ * @example
1211
+ * ```typescript
1212
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1213
+ *
1214
+ * const entities = new Entities(sdk);
1215
+ *
1216
+ * // Basic usage
1217
+ * const result = await entities.deleteRecordsById("<entityId>", [
1218
+ * "<recordId-1>", "<recordId-2>"
1219
+ * ]);
1220
+ * ```
1221
+ */
1222
+ deleteRecordsById(id: string, recordIds: string[], options?: EntityDeleteRecordsOptions): Promise<EntityDeleteResponse>;
1223
+ /**
1224
+ * Gets all entities in the system
1225
+ *
1226
+ * @returns Promise resolving to an array of entity metadata
1227
+ *
1228
+ * @example
1229
+ * ```typescript
1230
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1231
+ *
1232
+ * const entities = new Entities(sdk);
1233
+ *
1234
+ * // Get all entities
1235
+ * const allEntities = await entities.getAll();
1236
+ *
1237
+ * // Call operations on an entity
1238
+ * const records = await allEntities[0].getAllRecords();
1239
+ * ```
1240
+ */
1241
+ getAll(): Promise<EntityGetResponse[]>;
1242
+ /**
1243
+ * Downloads an attachment from an entity record field
1244
+ *
1245
+ * @param options - Options containing entityName, recordId, and fieldName
1246
+ * @returns Promise resolving to Blob containing the file content
1247
+ *
1248
+ * @example
1249
+ * ```typescript
1250
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1251
+ *
1252
+ * const entities = new Entities(sdk);
1253
+ *
1254
+ * // Download attachment for a specific record and field
1255
+ * const blob = await entities.downloadAttachment({
1256
+ * entityName: 'Invoice',
1257
+ * recordId: '<record-uuid>',
1258
+ * fieldName: 'Documents'
1259
+ * });
1260
+ */
1261
+ downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
1262
+ /**
1263
+ * @hidden
1264
+ * @deprecated Use {@link getAllRecords} instead.
1265
+ */
1266
+ getRecordsById<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
1267
+ /**
1268
+ * @hidden
1269
+ * @deprecated Use {@link insertRecordById} instead.
1270
+ */
1271
+ insertById(id: string, data: Record<string, any>, options?: EntityInsertOptions): Promise<EntityInsertResponse>;
1272
+ /**
1273
+ * @hidden
1274
+ * @deprecated Use {@link insertRecordsById} instead.
1275
+ */
1276
+ batchInsertById(id: string, data: Record<string, any>[], options?: EntityBatchInsertOptions): Promise<EntityBatchInsertResponse>;
1277
+ /**
1278
+ * @hidden
1279
+ * @deprecated Use {@link updateRecordsById} instead.
1280
+ */
1281
+ updateById(id: string, data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
1282
+ /**
1283
+ * @hidden
1284
+ * @deprecated Use {@link deleteRecordsById} instead.
1285
+ */
1286
+ deleteById(id: string, recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
1287
+ /**
1288
+ * Orchestrates all field mapping transformations
1289
+ *
1290
+ * @param metadata - Entity metadata to transform
1291
+ * @private
1292
+ */
1293
+ private applyFieldMappings;
1294
+ /**
1295
+ * Maps SQL field types to friendly EntityFieldTypes
1296
+ *
1297
+ * @param metadata - Entity metadata with fields
1298
+ * @private
1299
+ */
1300
+ private mapFieldTypes;
1301
+ /**
1302
+ * Transforms nested reference objects in field metadata
1303
+ */
1304
+ private transformNestedReferences;
1305
+ /**
1306
+ * Maps external field names to consistent naming
1307
+ *
1308
+ * @param metadata - Entity metadata with externalFields
1309
+ * @private
1310
+ */
1311
+ private mapExternalFields;
1312
+ }
1313
+
1314
+ /**
1315
+ * ChoiceSet Get All Response
1316
+ * Only exposes essential fields to SDK users
1317
+ */
1318
+ interface ChoiceSetGetAllResponse {
1319
+ /** Name identifier of the choice set */
1320
+ name: string;
1321
+ /** Human-readable display name of the choice set*/
1322
+ displayName: string;
1323
+ /** Description of the choice set */
1324
+ description: string;
1325
+ /** Folder ID where the choice set is located */
1326
+ folderId: string;
1327
+ /** User ID who created the choice set */
1328
+ createdBy: string;
1329
+ /** User ID who last updated the choice set */
1330
+ updatedBy: string;
1331
+ /** Creation timestamp */
1332
+ createdTime: string;
1333
+ /** Last update timestamp */
1334
+ updatedTime: string;
1335
+ }
1336
+ /**
1337
+ * Represents a single choice set value/record
1338
+ */
1339
+ interface ChoiceSetGetResponse {
1340
+ /** Unique identifier for the choice set value */
1341
+ id: string;
1342
+ /** Name of the choice set value */
1343
+ name: string;
1344
+ /** Human-readable display name of the choice set value*/
1345
+ displayName: string;
1346
+ /** Numeric identifier */
1347
+ numberId: number;
1348
+ /** Creation timestamp */
1349
+ createdTime: string;
1350
+ /** Last update timestamp */
1351
+ updatedTime: string;
1352
+ /** User ID who created this value */
1353
+ createdBy?: string;
1354
+ /** User ID who last updated this value */
1355
+ updatedBy?: string;
1356
+ /** User ID of the record owner */
1357
+ recordOwner?: string;
1358
+ }
1359
+ /**
1360
+ * Options for getting choice set values by choice set ID
1361
+ */
1362
+ type ChoiceSetGetByIdOptions = PaginationOptions;
1363
+
1364
+ /**
1365
+ * Service for managing UiPath Data Fabric Choice Sets
1366
+ *
1367
+ * Choice Sets are enumerated lists of values that can be used as field types in entities. They enable single-select or multi-select fields, such as expense types, categories, or status values. [UiPath Choice Sets Guide](https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/choice-sets)
1368
+ *
1369
+ * ### Usage
1370
+ *
1371
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
1372
+ *
1373
+ * ```typescript
1374
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
1375
+ *
1376
+ * const choicesets = new ChoiceSets(sdk);
1377
+ * const allChoiceSets = await choicesets.getAll();
1378
+ * ```
1379
+ */
1380
+ interface ChoiceSetServiceModel {
1381
+ /**
1382
+ * Gets all choice sets in the org
1383
+ *
1384
+ * @returns Promise resolving to an array of choice set metadata
1385
+ * {@link ChoiceSetGetAllResponse}
1386
+ * @example
1387
+ * ```typescript
1388
+ * // Get all choice sets
1389
+ * const allChoiceSets = await choicesets.getAll();
1390
+ *
1391
+ * // Iterate through choice sets
1392
+ * allChoiceSets.forEach(choiceSet => {
1393
+ * console.log(`ChoiceSet: ${choiceSet.displayName} (${choiceSet.name})`);
1394
+ * console.log(`Description: ${choiceSet.description}`);
1395
+ * console.log(`Created by: ${choiceSet.createdBy}`);
1396
+ * });
1397
+ *
1398
+ * // Find a specific choice set by name
1399
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'ExpenseTypes');
1400
+ *
1401
+ * // Check choice set details
1402
+ * if (expenseTypes) {
1403
+ * console.log(`Last updated: ${expenseTypes.updatedTime}`);
1404
+ * console.log(`Updated by: ${expenseTypes.updatedBy}`);
1405
+ * }
1406
+ * ```
1407
+ */
1408
+ getAll(): Promise<ChoiceSetGetAllResponse[]>;
1409
+ /**
1410
+ * Gets choice set values by choice set ID with optional pagination
1411
+ *
1412
+ * The method returns either:
1413
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
1414
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
1415
+ *
1416
+ * @param choiceSetId - UUID of the choice set
1417
+ * @param options - Pagination options
1418
+ * @returns Promise resolving to choice set values or paginated result
1419
+ * {@link ChoiceSetGetResponse}
1420
+ * @example
1421
+ * ```typescript
1422
+ * // First, get the choice set ID using getAll()
1423
+ * const allChoiceSets = await choicesets.getAll();
1424
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'ExpenseTypes');
1425
+ * const choiceSetId = expenseTypes.id;
1426
+ *
1427
+ * // Get all values (non-paginated)
1428
+ * const values = await choicesets.getById(choiceSetId);
1429
+ *
1430
+ * // Iterate through choice set values
1431
+ * for (const value of values.items) {
1432
+ * console.log(`Value: ${value.displayName}`);
1433
+ * }
1434
+ *
1435
+ * // First page with pagination
1436
+ * const page1 = await choicesets.getById(choiceSetId, { pageSize: 10 });
1437
+ *
1438
+ * // Navigate using cursor
1439
+ * if (page1.hasNextPage) {
1440
+ * const page2 = await choicesets.getById(choiceSetId, { cursor: page1.nextCursor });
1441
+ * }
1442
+ * ```
1443
+ */
1444
+ getById<T extends ChoiceSetGetByIdOptions = ChoiceSetGetByIdOptions>(choiceSetId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ChoiceSetGetResponse> : NonPaginatedResponse<ChoiceSetGetResponse>>;
1445
+ }
1446
+
1447
+ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceModel {
1448
+ /**
1449
+ * Gets all choice sets in the system
1450
+ *
1451
+ * @returns Promise resolving to an array of choice set metadata
1452
+ *
1453
+ * @example
1454
+ * ```typescript
1455
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
1456
+ *
1457
+ * const choiceSets = new ChoiceSets(sdk);
1458
+ *
1459
+ * // Get all choice sets
1460
+ * const allChoiceSets = await choiceSets.getAll();
1461
+ *
1462
+ * // Iterate through choice sets
1463
+ * allChoiceSets.forEach(choiceSet => {
1464
+ * console.log(`ChoiceSet: ${choiceSet.displayName} (${choiceSet.name})`);
1465
+ * console.log(`Description: ${choiceSet.description}`);
1466
+ * });
1467
+ * ```
1468
+ */
1469
+ getAll(): Promise<ChoiceSetGetAllResponse[]>;
1470
+ /**
1471
+ * Gets choice set values by choice set ID with optional pagination
1472
+ *
1473
+ * The method returns either:
1474
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
1475
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
1476
+ *
1477
+ * @param choiceSetId - UUID of the choice set
1478
+ * @param options - Pagination options
1479
+ * @returns Promise resolving to choice set values or paginated result
1480
+ *
1481
+ * @example
1482
+ * ```typescript
1483
+ * import { ChoiceSets } from '@uipath/uipath-typescript/choicesets';
1484
+ *
1485
+ * const choiceSets = new ChoiceSets(sdk);
1486
+ *
1487
+ * // First, get the choice set ID using getAll()
1488
+ * const allChoiceSets = await choiceSets.getAll();
1489
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'ExpenseTypes');
1490
+ * const choiceSetId = expenseTypes.id;
1491
+ *
1492
+ * // Get all values (non-paginated)
1493
+ * const values = await choiceSets.getById(choiceSetId);
1494
+ *
1495
+ * // Iterate through choice set values
1496
+ * for (const value of values.items) {
1497
+ * console.log(`Value: ${value.displayName} (${value.name})`);
1498
+ * }
1499
+ *
1500
+ * // First page with pagination
1501
+ * const page1 = await choiceSets.getById(choiceSetId, { pageSize: 10 });
1502
+ *
1503
+ * // Navigate using cursor
1504
+ * if (page1.hasNextPage) {
1505
+ * const page2 = await choiceSets.getById(choiceSetId, { cursor: page1.nextCursor });
1506
+ * }
1507
+ * ```
1508
+ */
1509
+ getById<T extends ChoiceSetGetByIdOptions = ChoiceSetGetByIdOptions>(choiceSetId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ChoiceSetGetResponse> : NonPaginatedResponse<ChoiceSetGetResponse>>;
1510
+ }
1511
+
1512
+ export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, ReferenceType, createEntityWithMethods };
1513
+ export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityDownloadAttachmentOptions, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordsOptions, EntityUpdateResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };