@uipath/uipath-typescript 1.1.3 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -368,9 +368,13 @@ type EntityBatchInsertOptions = EntityOperationOptions;
368
368
  * Options for inserting multiple records into an entity
369
369
  */
370
370
  type EntityInsertRecordsOptions = EntityOperationOptions;
371
+ /**
372
+ * Options for updating a single record in an entity
373
+ */
374
+ type EntityUpdateRecordOptions = EntityGetRecordByIdOptions;
371
375
  /**
372
376
  * 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.
377
+ * @deprecated Use {@link EntityUpdateRecordsOptions} instead for better clarity on updating records in an entity. This type will be removed in future versions.
374
378
  */
375
379
  type EntityUpdateOptions = EntityOperationOptions;
376
380
  /**
@@ -390,34 +394,13 @@ interface EntityDeleteOptions {
390
394
  */
391
395
  type EntityDeleteRecordsOptions = EntityDeleteOptions;
392
396
  /**
393
- * Options for downloading an attachment from an entity record
397
+ * Supported file types for attachment upload
394
398
  */
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
- }
399
+ type EntityFileType = Blob | File | Uint8Array;
403
400
  /**
404
- * Options for uploading an attachment to an entity record
401
+ * Optional options for uploading an attachment to an entity record
405
402
  */
406
403
  interface EntityUploadAttachmentOptions {
407
- /** Entity name */
408
- entityName: string;
409
- /** Record ID (UUID) */
410
- recordId: string;
411
- /** Field name of the File-type field */
412
- fieldName: string;
413
- /**
414
- * File to upload. Accepts the native types supported by FormData:
415
- * - `Blob` / `File`: standard browser and Node.js ≥ 18 types accepted directly by FormData.
416
- * `File` is a subclass of `Blob` and is typically obtained from a browser file input.
417
- * - `Uint8Array`: raw binary buffer (e.g. from `fs.readFileSync` or a Node.js Buffer).
418
- * Converted to a `Blob` internally before appending to FormData.
419
- */
420
- file: Blob | File | Uint8Array;
421
404
  /** Optional expansion level (default: 0) */
422
405
  expansionLevel?: number;
423
406
  }
@@ -425,6 +408,10 @@ interface EntityUploadAttachmentOptions {
425
408
  * Response from uploading an attachment to an entity record
426
409
  */
427
410
  type EntityUploadAttachmentResponse = Record<string, unknown>;
411
+ /**
412
+ * Response from deleting an attachment from an entity record
413
+ */
414
+ type EntityDeleteAttachmentResponse = Record<string, unknown>;
428
415
  /**
429
416
  * Represents a failure record in an entity operation
430
417
  */
@@ -448,6 +435,11 @@ interface EntityOperationResponse {
448
435
  * Returns the inserted record with its generated record ID and other fields
449
436
  */
450
437
  type EntityInsertResponse = EntityRecord;
438
+ /**
439
+ * Response from updating a single record in an entity
440
+ * Returns the updated record
441
+ */
442
+ type EntityUpdateRecordResponse = EntityRecord;
451
443
  /**
452
444
  * Response from batch inserting data into an entity
453
445
  */
@@ -844,9 +836,35 @@ interface EntityServiceModel {
844
836
  * @hidden
845
837
  */
846
838
  batchInsertById(id: string, data: Record<string, any>[], options?: EntityBatchInsertOptions): Promise<EntityBatchInsertResponse>;
839
+ /**
840
+ * Updates a single record in an entity by entity ID
841
+ *
842
+ * Note: Data Fabric supports trigger events only on individual updates, not on updating multiple records.
843
+ * Use this method if you need trigger events to fire for the updated record.
844
+ *
845
+ * @param entityId - UUID of the entity
846
+ * @param recordId - UUID of the record to update
847
+ * @param data - Key-value pairs of fields to update
848
+ * @param options - Update options
849
+ * @returns Promise resolving to the updated record
850
+ * {@link EntityUpdateRecordResponse}
851
+ * @example
852
+ * ```typescript
853
+ * // Basic usage
854
+ * const result = await entities.updateRecordById(<entityId>, <recordId>, { name: "John Updated", age: 31 });
855
+ *
856
+ * // With options
857
+ * const result = await entities.updateRecordById(<entityId>, <recordId>, { name: "John Updated", age: 31 }, {
858
+ * expansionLevel: 1
859
+ * });
860
+ * ```
861
+ */
862
+ updateRecordById(entityId: string, recordId: string, data: Record<string, any>, options?: EntityUpdateRecordOptions): Promise<EntityUpdateRecordResponse>;
847
863
  /**
848
864
  * Updates data in an entity by entity ID
849
865
  *
866
+ * Note: Records updated using updateRecordsById will not trigger Data Fabric trigger events. Use {@link updateRecordById} if you need trigger events to fire for each updated record.
867
+ *
850
868
  * @param id - UUID of the entity
851
869
  * @param data - Array of records to update. Each record MUST contain the record Id.
852
870
  * @param options - Update options
@@ -901,7 +919,9 @@ interface EntityServiceModel {
901
919
  /**
902
920
  * Downloads an attachment stored in a File-type field of an entity record.
903
921
  *
904
- * @param options - Options containing entityName, recordId, and fieldName
922
+ * @param entityId - UUID of the entity
923
+ * @param recordId - UUID of the record containing the attachment
924
+ * @param fieldName - Name of the File-type field containing the attachment
905
925
  * @returns Promise resolving to Blob containing the file content
906
926
  * @example
907
927
  * ```typescript
@@ -914,15 +934,19 @@ interface EntityServiceModel {
914
934
  * // Get the recordId for the record that contains the attachment
915
935
  * const recordId = records.items[0].id;
916
936
  *
937
+ * // Get the entityId from getAll()
938
+ * const allEntities = await entities.getAll();
939
+ * const entityId = allEntities[0].id;
940
+ *
941
+ * // Get the recordId from getAllRecords()
942
+ * const records = await entities.getAllRecords(entityId);
943
+ * const recordId = records[0].id;
944
+ *
917
945
  * // Download attachment using service method
918
- * const response = await entities.downloadAttachment({
919
- * entityName: 'Invoice',
920
- * recordId: recordId,
921
- * fieldName: 'Documents'
922
- * });
946
+ * const response = await entities.downloadAttachment(entityId, recordId, 'Documents');
923
947
  *
924
- * // Or download using entity method
925
- * const entity = await entities.getById("<entityId>");
948
+ * // Or download using entity method (entityId is already known)
949
+ * const entity = await entities.getById(entityId);
926
950
  * const blob = await entity.downloadAttachment(recordId, 'Documents');
927
951
  *
928
952
  * // Browser: Display Image
@@ -944,43 +968,74 @@ interface EntityServiceModel {
944
968
  * fs.writeFileSync('attachment.pdf', buffer);
945
969
  * ```
946
970
  */
947
- downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
971
+ downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
948
972
  /**
949
973
  * Uploads an attachment to a File-type field of an entity record.
950
974
  *
951
975
  * Uses multipart/form-data to upload the file content to the specified field.
952
976
  *
953
- * @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
954
- * @returns Promise resolving to the upload response
955
- * {@link EntityUploadAttachmentResponse}
977
+ * @param entityId - UUID of the entity
978
+ * @param recordId - UUID of the record to upload the attachment to
979
+ * @param fieldName - Name of the File-type field
980
+ * @param file - File to upload (Blob, File, or Uint8Array)
981
+ * @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
982
+ * @returns Promise resolving to {@link EntityUploadAttachmentResponse}
956
983
  * @example
957
984
  * ```typescript
958
985
  * import { Entities } from '@uipath/uipath-typescript/entities';
959
986
  *
960
987
  * const entities = new Entities(sdk);
961
988
  *
989
+ * // Get the entityId from getAll()
990
+ * const allEntities = await entities.getAll();
991
+ * const entityId = allEntities[0].id;
992
+ *
993
+ * // Get the recordId from getAllRecords()
994
+ * const records = await entities.getAllRecords(entityId);
995
+ * const recordId = records[0].id;
996
+ *
962
997
  * // Browser: Upload a file from an input element
963
998
  * const fileInput = document.getElementById('file-input') as HTMLInputElement;
964
999
  * const file = fileInput.files[0];
965
- * const response = await entities.uploadAttachment({
966
- * entityName: 'Invoice',
967
- * recordId: '<recordId>',
968
- * fieldName: 'Documents',
969
- * file: file
970
- * });
1000
+ * const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
971
1001
  *
972
1002
  * // Node.js: Upload a file from disk
973
1003
  * const fileBuffer = fs.readFileSync('document.pdf');
974
1004
  * const blob = new Blob([fileBuffer], { type: 'application/pdf' });
975
- * const response = await entities.uploadAttachment({
976
- * entityName: 'Invoice',
977
- * recordId: '<recordId>',
978
- * fieldName: 'Documents',
979
- * file: blob
980
- * });
1005
+ * const response = await entities.uploadAttachment(entityId, recordId, 'Documents', blob);
981
1006
  * ```
982
1007
  */
983
- uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1008
+ uploadAttachment(entityId: string, recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1009
+ /**
1010
+ * Removes an attachment from a File-type field of an entity record.
1011
+ *
1012
+ * @param entityId - UUID of the entity
1013
+ * @param recordId - UUID of the record containing the attachment
1014
+ * @param fieldName - Name of the File-type field containing the attachment
1015
+ * @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
1016
+ * @example
1017
+ * ```typescript
1018
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1019
+ *
1020
+ * const entities = new Entities(sdk);
1021
+ *
1022
+ * // Get the entityId from getAll()
1023
+ * const allEntities = await entities.getAll();
1024
+ * const entityId = allEntities[0].id;
1025
+ *
1026
+ * // Get the recordId from getAllRecords()
1027
+ * const records = await entities.getAllRecords(entityId);
1028
+ * const recordId = records[0].id;
1029
+ *
1030
+ * // Delete attachment for a specific record and field
1031
+ * await entities.deleteAttachment(entityId, recordId, 'Documents');
1032
+ *
1033
+ * // Or delete using entity method (entityId is already known)
1034
+ * const entity = await entities.getById(entityId);
1035
+ * await entity.deleteAttachment(recordId, 'Documents');
1036
+ * ```
1037
+ */
1038
+ deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
984
1039
  }
985
1040
  /**
986
1041
  * Entity methods interface - defines operations that can be performed on an entity
@@ -1008,9 +1063,24 @@ interface EntityMethods {
1008
1063
  * @returns Promise resolving to batch insert response
1009
1064
  */
1010
1065
  insertRecords(data: Record<string, any>[], options?: EntityInsertRecordsOptions): Promise<EntityBatchInsertResponse>;
1066
+ /**
1067
+ * Update a single record in this entity
1068
+ *
1069
+ * Note: Data Fabric supports trigger events only on individual updates, not on updating multiple records.
1070
+ * Use this method if you need trigger events to fire for the updated record.
1071
+ *
1072
+ * @param recordId - UUID of the record to update
1073
+ * @param data - Key-value pairs of fields to update
1074
+ * @param options - Update options
1075
+ * @returns Promise resolving to the updated record
1076
+ */
1077
+ updateRecord(recordId: string, data: Record<string, any>, options?: EntityUpdateRecordOptions): Promise<EntityUpdateRecordResponse>;
1011
1078
  /**
1012
1079
  * Update data in this entity
1013
1080
  *
1081
+ * Note: Records updated using updateRecords will not trigger Data Fabric trigger events. Use {@link updateRecord} if you need
1082
+ * trigger events to fire for each updated record.
1083
+ *
1014
1084
  * @param data - Array of records to update. Each record MUST contain the record Id,
1015
1085
  * otherwise the update will fail.
1016
1086
  * @param options - Update options
@@ -1054,10 +1124,18 @@ interface EntityMethods {
1054
1124
  * @param recordId - UUID of the record to upload the attachment to
1055
1125
  * @param fieldName - Name of the File-type field
1056
1126
  * @param file - File to upload (Blob, File, or Uint8Array)
1057
- * @param expansionLevel - Optional expansion level (default: 0)
1058
- * @returns Promise resolving to the upload response
1127
+ * @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
1128
+ * @returns Promise resolving to {@link EntityUploadAttachmentResponse}
1129
+ */
1130
+ uploadAttachment(recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1131
+ /**
1132
+ * Deletes an attachment from a File-type field of an entity record
1133
+ *
1134
+ * @param recordId - UUID of the record containing the attachment
1135
+ * @param fieldName - Name of the File-type field containing the attachment
1136
+ * @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
1059
1137
  */
1060
- uploadAttachment(recordId: string, fieldName: string, file: Blob | File | Uint8Array, expansionLevel?: number): Promise<EntityUploadAttachmentResponse>;
1138
+ deleteAttachment(recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
1061
1139
  /**
1062
1140
  * @deprecated Use {@link insertRecord} instead.
1063
1141
  * @hidden
@@ -1238,6 +1316,31 @@ declare class EntityService extends BaseService implements EntityServiceModel {
1238
1316
  * ```
1239
1317
  */
1240
1318
  insertRecordsById(id: string, data: Record<string, any>[], options?: EntityInsertRecordsOptions): Promise<EntityBatchInsertResponse>;
1319
+ /**
1320
+ * Updates a single record in an entity by entity ID
1321
+ *
1322
+ * @param entityId - UUID of the entity
1323
+ * @param recordId - UUID of the record to update
1324
+ * @param data - Key-value pairs of fields to update
1325
+ * @param options - Update options
1326
+ * @returns Promise resolving to the updated record
1327
+ *
1328
+ * @example
1329
+ * ```typescript
1330
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1331
+ *
1332
+ * const entities = new Entities(sdk);
1333
+ *
1334
+ * // Basic usage
1335
+ * const result = await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated", age: 31 });
1336
+ *
1337
+ * // With options
1338
+ * const result = await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated", age: 31 }, {
1339
+ * expansionLevel: 1
1340
+ * });
1341
+ * ```
1342
+ */
1343
+ updateRecordById(entityId: string, recordId: string, data: Record<string, any>, options?: EntityUpdateRecordOptions): Promise<EntityUpdateRecordResponse>;
1241
1344
  /**
1242
1345
  * Updates data in an entity by entity ID
1243
1346
  *
@@ -1313,7 +1416,9 @@ declare class EntityService extends BaseService implements EntityServiceModel {
1313
1416
  /**
1314
1417
  * Downloads an attachment from an entity record field
1315
1418
  *
1316
- * @param options - Options containing entityName, recordId, and fieldName
1419
+ * @param entityId - UUID of the entity
1420
+ * @param recordId - UUID of the record containing the attachment
1421
+ * @param fieldName - Name of the File-type field containing the attachment
1317
1422
  * @returns Promise resolving to Blob containing the file content
1318
1423
  *
1319
1424
  * @example
@@ -1322,19 +1427,28 @@ declare class EntityService extends BaseService implements EntityServiceModel {
1322
1427
  *
1323
1428
  * const entities = new Entities(sdk);
1324
1429
  *
1430
+ * // Get the entityId from getAll()
1431
+ * const allEntities = await entities.getAll();
1432
+ * const entityId = allEntities[0].id;
1433
+ *
1434
+ * // Get the recordId from getAllRecords()
1435
+ * const records = await entities.getAllRecords(entityId);
1436
+ * const recordId = records[0].id;
1437
+ *
1325
1438
  * // Download attachment for a specific record and field
1326
- * const blob = await entities.downloadAttachment({
1327
- * entityName: 'Invoice',
1328
- * recordId: '<record-uuid>',
1329
- * fieldName: 'Documents'
1330
- * });
1439
+ * const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
1440
+ * ```
1331
1441
  */
1332
- downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
1442
+ downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
1333
1443
  /**
1334
1444
  * Uploads an attachment to a File-type field of an entity record
1335
1445
  *
1336
- * @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
1337
- * @returns Promise resolving to the upload response
1446
+ * @param entityId - UUID of the entity
1447
+ * @param recordId - UUID of the record to upload the attachment to
1448
+ * @param fieldName - Name of the File-type field
1449
+ * @param file - File to upload (Blob, File, or Uint8Array)
1450
+ * @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
1451
+ * @returns Promise resolving to {@link EntityUploadAttachmentResponse}
1338
1452
  *
1339
1453
  * @example
1340
1454
  * ```typescript
@@ -1342,16 +1456,46 @@ declare class EntityService extends BaseService implements EntityServiceModel {
1342
1456
  *
1343
1457
  * const entities = new Entities(sdk);
1344
1458
  *
1459
+ * // Get the entityId from getAll()
1460
+ * const allEntities = await entities.getAll();
1461
+ * const entityId = allEntities[0].id;
1462
+ *
1463
+ * // Get the recordId from getAllRecords()
1464
+ * const records = await entities.getAllRecords(entityId);
1465
+ * const recordId = records[0].id;
1466
+ *
1345
1467
  * // Upload a file attachment
1346
- * const response = await entities.uploadAttachment({
1347
- * entityName: 'Invoice',
1348
- * recordId: '<record-uuid>',
1349
- * fieldName: 'Documents',
1350
- * file: file
1351
- * });
1468
+ * const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
1469
+ * ```
1470
+ */
1471
+ uploadAttachment(entityId: string, recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1472
+ /**
1473
+ * Removes an attachment from a File-type field of an entity record
1474
+ *
1475
+ * @param entityId - UUID of the entity
1476
+ * @param recordId - UUID of the record containing the attachment
1477
+ * @param fieldName - Name of the File-type field containing the attachment
1478
+ * @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
1479
+ *
1480
+ * @example
1481
+ * ```typescript
1482
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1483
+ *
1484
+ * const entities = new Entities(sdk);
1485
+ *
1486
+ * // Get the entityId from getAll()
1487
+ * const allEntities = await entities.getAll();
1488
+ * const entityId = allEntities[0].id;
1489
+ *
1490
+ * // Get the recordId from getAllRecords()
1491
+ * const records = await entities.getAllRecords(entityId);
1492
+ * const recordId = records[0].id;
1493
+ *
1494
+ * // Delete attachment for a specific record and field
1495
+ * await entities.deleteAttachment(entityId, recordId, 'Documents');
1352
1496
  * ```
1353
1497
  */
1354
- uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1498
+ deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
1355
1499
  /**
1356
1500
  * @hidden
1357
1501
  * @deprecated Use {@link getAllRecords} instead.
@@ -1603,4 +1747,4 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
1603
1747
  }
1604
1748
 
1605
1749
  export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, ReferenceType, createEntityWithMethods };
1606
- 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, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };
1750
+ export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityDeleteAttachmentResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityFileType, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordOptions, EntityUpdateRecordResponse, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };