@uipath/uipath-typescript 1.1.3 → 1.2.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.
- package/dist/assets/index.cjs +1 -4
- package/dist/assets/index.mjs +1 -4
- package/dist/buckets/index.cjs +1 -4
- package/dist/buckets/index.mjs +1 -4
- package/dist/cases/index.cjs +1 -4
- package/dist/cases/index.mjs +1 -4
- package/dist/conversational-agent/index.cjs +1 -4
- package/dist/conversational-agent/index.mjs +1 -4
- package/dist/core/index.cjs +269 -84
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +269 -84
- package/dist/entities/index.cjs +82 -44
- package/dist/entities/index.d.ts +139 -70
- package/dist/entities/index.mjs +82 -44
- package/dist/index.cjs +350 -127
- package/dist/index.d.ts +139 -70
- package/dist/index.mjs +350 -127
- package/dist/index.umd.js +350 -127
- package/dist/maestro-processes/index.cjs +1 -4
- package/dist/maestro-processes/index.mjs +1 -4
- package/dist/processes/index.cjs +1 -4
- package/dist/processes/index.mjs +1 -4
- package/dist/queues/index.cjs +1 -4
- package/dist/queues/index.mjs +1 -4
- package/dist/tasks/index.cjs +1 -4
- package/dist/tasks/index.mjs +1 -4
- package/package.json +2 -2
package/dist/entities/index.cjs
CHANGED
|
@@ -546,11 +546,8 @@ class ApiClient {
|
|
|
546
546
|
return this.tokenManager.getValidToken();
|
|
547
547
|
}
|
|
548
548
|
async getDefaultHeaders() {
|
|
549
|
-
// Get headers from execution context first
|
|
550
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
551
549
|
const token = await this.getValidToken();
|
|
552
550
|
return {
|
|
553
|
-
...contextHeaders,
|
|
554
551
|
'Authorization': `Bearer ${token}`,
|
|
555
552
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
556
553
|
...this.defaultHeaders,
|
|
@@ -1675,24 +1672,19 @@ function createEntityMethods(entityData, service) {
|
|
|
1675
1672
|
return service.getRecordById(entityData.id, recordId, options);
|
|
1676
1673
|
},
|
|
1677
1674
|
async downloadAttachment(recordId, fieldName) {
|
|
1678
|
-
if (!entityData.
|
|
1679
|
-
throw new Error('Entity
|
|
1680
|
-
return service.downloadAttachment(
|
|
1681
|
-
entityName: entityData.name,
|
|
1682
|
-
recordId,
|
|
1683
|
-
fieldName
|
|
1684
|
-
});
|
|
1675
|
+
if (!entityData.id)
|
|
1676
|
+
throw new Error('Entity ID is undefined');
|
|
1677
|
+
return service.downloadAttachment(entityData.id, recordId, fieldName);
|
|
1685
1678
|
},
|
|
1686
|
-
async uploadAttachment(recordId, fieldName, file,
|
|
1687
|
-
if (!entityData.
|
|
1688
|
-
throw new Error('Entity
|
|
1689
|
-
return service.uploadAttachment(
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
});
|
|
1679
|
+
async uploadAttachment(recordId, fieldName, file, options) {
|
|
1680
|
+
if (!entityData.id)
|
|
1681
|
+
throw new Error('Entity ID is undefined');
|
|
1682
|
+
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
1683
|
+
},
|
|
1684
|
+
async deleteAttachment(recordId, fieldName) {
|
|
1685
|
+
if (!entityData.id)
|
|
1686
|
+
throw new Error('Entity ID is undefined');
|
|
1687
|
+
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
1696
1688
|
},
|
|
1697
1689
|
async insert(data, options) {
|
|
1698
1690
|
return this.insertRecord(data, options);
|
|
@@ -1744,8 +1736,9 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1744
1736
|
BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
|
|
1745
1737
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
1746
1738
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
1747
|
-
DOWNLOAD_ATTACHMENT: (
|
|
1748
|
-
UPLOAD_ATTACHMENT: (
|
|
1739
|
+
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1740
|
+
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1741
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1749
1742
|
},
|
|
1750
1743
|
CHOICESETS: {
|
|
1751
1744
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -1902,7 +1895,7 @@ const EntityFieldTypeMap = {
|
|
|
1902
1895
|
// Connection string placeholder that will be replaced during build
|
|
1903
1896
|
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";
|
|
1904
1897
|
// SDK Version placeholder
|
|
1905
|
-
const SDK_VERSION = "1.
|
|
1898
|
+
const SDK_VERSION = "1.2.0";
|
|
1906
1899
|
const VERSION = "Version";
|
|
1907
1900
|
const SERVICE = "Service";
|
|
1908
1901
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2478,7 +2471,9 @@ class EntityService extends BaseService {
|
|
|
2478
2471
|
/**
|
|
2479
2472
|
* Downloads an attachment from an entity record field
|
|
2480
2473
|
*
|
|
2481
|
-
* @param
|
|
2474
|
+
* @param entityId - UUID of the entity
|
|
2475
|
+
* @param recordId - UUID of the record containing the attachment
|
|
2476
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
2482
2477
|
* @returns Promise resolving to Blob containing the file content
|
|
2483
2478
|
*
|
|
2484
2479
|
* @example
|
|
@@ -2487,16 +2482,20 @@ class EntityService extends BaseService {
|
|
|
2487
2482
|
*
|
|
2488
2483
|
* const entities = new Entities(sdk);
|
|
2489
2484
|
*
|
|
2485
|
+
* // Get the entityId from getAll()
|
|
2486
|
+
* const allEntities = await entities.getAll();
|
|
2487
|
+
* const entityId = allEntities[0].id;
|
|
2488
|
+
*
|
|
2489
|
+
* // Get the recordId from getAllRecords()
|
|
2490
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2491
|
+
* const recordId = records[0].id;
|
|
2492
|
+
*
|
|
2490
2493
|
* // Download attachment for a specific record and field
|
|
2491
|
-
* const blob = await entities.downloadAttachment(
|
|
2492
|
-
*
|
|
2493
|
-
* recordId: '<record-uuid>',
|
|
2494
|
-
* fieldName: 'Documents'
|
|
2495
|
-
* });
|
|
2494
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
2495
|
+
* ```
|
|
2496
2496
|
*/
|
|
2497
|
-
async downloadAttachment(
|
|
2498
|
-
const
|
|
2499
|
-
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityName, recordId, fieldName), {
|
|
2497
|
+
async downloadAttachment(entityId, recordId, fieldName) {
|
|
2498
|
+
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
|
|
2500
2499
|
responseType: RESPONSE_TYPES.BLOB
|
|
2501
2500
|
});
|
|
2502
2501
|
return response.data;
|
|
@@ -2504,8 +2503,12 @@ class EntityService extends BaseService {
|
|
|
2504
2503
|
/**
|
|
2505
2504
|
* Uploads an attachment to a File-type field of an entity record
|
|
2506
2505
|
*
|
|
2507
|
-
* @param
|
|
2508
|
-
* @
|
|
2506
|
+
* @param entityId - UUID of the entity
|
|
2507
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
2508
|
+
* @param fieldName - Name of the File-type field
|
|
2509
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
2510
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
2511
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
2509
2512
|
*
|
|
2510
2513
|
* @example
|
|
2511
2514
|
* ```typescript
|
|
@@ -2513,17 +2516,19 @@ class EntityService extends BaseService {
|
|
|
2513
2516
|
*
|
|
2514
2517
|
* const entities = new Entities(sdk);
|
|
2515
2518
|
*
|
|
2519
|
+
* // Get the entityId from getAll()
|
|
2520
|
+
* const allEntities = await entities.getAll();
|
|
2521
|
+
* const entityId = allEntities[0].id;
|
|
2522
|
+
*
|
|
2523
|
+
* // Get the recordId from getAllRecords()
|
|
2524
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2525
|
+
* const recordId = records[0].id;
|
|
2526
|
+
*
|
|
2516
2527
|
* // Upload a file attachment
|
|
2517
|
-
* const response = await entities.uploadAttachment(
|
|
2518
|
-
* entityName: 'Invoice',
|
|
2519
|
-
* recordId: '<record-uuid>',
|
|
2520
|
-
* fieldName: 'Documents',
|
|
2521
|
-
* file: file
|
|
2522
|
-
* });
|
|
2528
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
2523
2529
|
* ```
|
|
2524
2530
|
*/
|
|
2525
|
-
async uploadAttachment(options) {
|
|
2526
|
-
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
2531
|
+
async uploadAttachment(entityId, recordId, fieldName, file, options) {
|
|
2527
2532
|
const formData = new FormData();
|
|
2528
2533
|
if (file instanceof Uint8Array) {
|
|
2529
2534
|
formData.append('file', new Blob([file.buffer]));
|
|
@@ -2531,12 +2536,42 @@ class EntityService extends BaseService {
|
|
|
2531
2536
|
else {
|
|
2532
2537
|
formData.append('file', file);
|
|
2533
2538
|
}
|
|
2534
|
-
const params = createParams({ expansionLevel });
|
|
2535
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
2539
|
+
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
2540
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
|
|
2536
2541
|
// Convert PascalCase response to camelCase
|
|
2537
2542
|
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
2538
2543
|
return camelResponse;
|
|
2539
2544
|
}
|
|
2545
|
+
/**
|
|
2546
|
+
* Removes an attachment from a File-type field of an entity record
|
|
2547
|
+
*
|
|
2548
|
+
* @param entityId - UUID of the entity
|
|
2549
|
+
* @param recordId - UUID of the record containing the attachment
|
|
2550
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
2551
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
2552
|
+
*
|
|
2553
|
+
* @example
|
|
2554
|
+
* ```typescript
|
|
2555
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
2556
|
+
*
|
|
2557
|
+
* const entities = new Entities(sdk);
|
|
2558
|
+
*
|
|
2559
|
+
* // Get the entityId from getAll()
|
|
2560
|
+
* const allEntities = await entities.getAll();
|
|
2561
|
+
* const entityId = allEntities[0].id;
|
|
2562
|
+
*
|
|
2563
|
+
* // Get the recordId from getAllRecords()
|
|
2564
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2565
|
+
* const recordId = records[0].id;
|
|
2566
|
+
*
|
|
2567
|
+
* // Delete attachment for a specific record and field
|
|
2568
|
+
* await entities.deleteAttachment(entityId, recordId, 'Documents');
|
|
2569
|
+
* ```
|
|
2570
|
+
*/
|
|
2571
|
+
async deleteAttachment(entityId, recordId, fieldName) {
|
|
2572
|
+
const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName));
|
|
2573
|
+
return response.data;
|
|
2574
|
+
}
|
|
2540
2575
|
/**
|
|
2541
2576
|
* @hidden
|
|
2542
2577
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -2673,6 +2708,9 @@ __decorate([
|
|
|
2673
2708
|
__decorate([
|
|
2674
2709
|
track('Entities.UploadAttachment')
|
|
2675
2710
|
], EntityService.prototype, "uploadAttachment", null);
|
|
2711
|
+
__decorate([
|
|
2712
|
+
track('Entities.DeleteAttachment')
|
|
2713
|
+
], EntityService.prototype, "deleteAttachment", null);
|
|
2676
2714
|
|
|
2677
2715
|
class ChoiceSetService extends BaseService {
|
|
2678
2716
|
/**
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -390,34 +390,13 @@ interface EntityDeleteOptions {
|
|
|
390
390
|
*/
|
|
391
391
|
type EntityDeleteRecordsOptions = EntityDeleteOptions;
|
|
392
392
|
/**
|
|
393
|
-
*
|
|
394
|
-
*/
|
|
395
|
-
|
|
396
|
-
/** Entity name */
|
|
397
|
-
entityName: string;
|
|
398
|
-
/** Record ID */
|
|
399
|
-
recordId: string;
|
|
400
|
-
/** Field name containing the attachment */
|
|
401
|
-
fieldName: string;
|
|
402
|
-
}
|
|
393
|
+
* Supported file types for attachment upload
|
|
394
|
+
*/
|
|
395
|
+
type EntityFileType = Blob | File | Uint8Array;
|
|
403
396
|
/**
|
|
404
|
-
*
|
|
397
|
+
* Optional options for uploading an attachment to an entity record
|
|
405
398
|
*/
|
|
406
399
|
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
400
|
/** Optional expansion level (default: 0) */
|
|
422
401
|
expansionLevel?: number;
|
|
423
402
|
}
|
|
@@ -425,6 +404,10 @@ interface EntityUploadAttachmentOptions {
|
|
|
425
404
|
* Response from uploading an attachment to an entity record
|
|
426
405
|
*/
|
|
427
406
|
type EntityUploadAttachmentResponse = Record<string, unknown>;
|
|
407
|
+
/**
|
|
408
|
+
* Response from deleting an attachment from an entity record
|
|
409
|
+
*/
|
|
410
|
+
type EntityDeleteAttachmentResponse = Record<string, unknown>;
|
|
428
411
|
/**
|
|
429
412
|
* Represents a failure record in an entity operation
|
|
430
413
|
*/
|
|
@@ -901,7 +884,9 @@ interface EntityServiceModel {
|
|
|
901
884
|
/**
|
|
902
885
|
* Downloads an attachment stored in a File-type field of an entity record.
|
|
903
886
|
*
|
|
904
|
-
* @param
|
|
887
|
+
* @param entityId - UUID of the entity
|
|
888
|
+
* @param recordId - UUID of the record containing the attachment
|
|
889
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
905
890
|
* @returns Promise resolving to Blob containing the file content
|
|
906
891
|
* @example
|
|
907
892
|
* ```typescript
|
|
@@ -914,15 +899,19 @@ interface EntityServiceModel {
|
|
|
914
899
|
* // Get the recordId for the record that contains the attachment
|
|
915
900
|
* const recordId = records.items[0].id;
|
|
916
901
|
*
|
|
902
|
+
* // Get the entityId from getAll()
|
|
903
|
+
* const allEntities = await entities.getAll();
|
|
904
|
+
* const entityId = allEntities[0].id;
|
|
905
|
+
*
|
|
906
|
+
* // Get the recordId from getAllRecords()
|
|
907
|
+
* const records = await entities.getAllRecords(entityId);
|
|
908
|
+
* const recordId = records[0].id;
|
|
909
|
+
*
|
|
917
910
|
* // Download attachment using service method
|
|
918
|
-
* const response = await entities.downloadAttachment(
|
|
919
|
-
* entityName: 'Invoice',
|
|
920
|
-
* recordId: recordId,
|
|
921
|
-
* fieldName: 'Documents'
|
|
922
|
-
* });
|
|
911
|
+
* const response = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
923
912
|
*
|
|
924
|
-
* // Or download using entity method
|
|
925
|
-
* const entity = await entities.getById(
|
|
913
|
+
* // Or download using entity method (entityId is already known)
|
|
914
|
+
* const entity = await entities.getById(entityId);
|
|
926
915
|
* const blob = await entity.downloadAttachment(recordId, 'Documents');
|
|
927
916
|
*
|
|
928
917
|
* // Browser: Display Image
|
|
@@ -944,43 +933,74 @@ interface EntityServiceModel {
|
|
|
944
933
|
* fs.writeFileSync('attachment.pdf', buffer);
|
|
945
934
|
* ```
|
|
946
935
|
*/
|
|
947
|
-
downloadAttachment(
|
|
936
|
+
downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
|
|
948
937
|
/**
|
|
949
938
|
* Uploads an attachment to a File-type field of an entity record.
|
|
950
939
|
*
|
|
951
940
|
* Uses multipart/form-data to upload the file content to the specified field.
|
|
952
941
|
*
|
|
953
|
-
* @param
|
|
954
|
-
* @
|
|
955
|
-
*
|
|
942
|
+
* @param entityId - UUID of the entity
|
|
943
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
944
|
+
* @param fieldName - Name of the File-type field
|
|
945
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
946
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
947
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
956
948
|
* @example
|
|
957
949
|
* ```typescript
|
|
958
950
|
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
959
951
|
*
|
|
960
952
|
* const entities = new Entities(sdk);
|
|
961
953
|
*
|
|
954
|
+
* // Get the entityId from getAll()
|
|
955
|
+
* const allEntities = await entities.getAll();
|
|
956
|
+
* const entityId = allEntities[0].id;
|
|
957
|
+
*
|
|
958
|
+
* // Get the recordId from getAllRecords()
|
|
959
|
+
* const records = await entities.getAllRecords(entityId);
|
|
960
|
+
* const recordId = records[0].id;
|
|
961
|
+
*
|
|
962
962
|
* // Browser: Upload a file from an input element
|
|
963
963
|
* const fileInput = document.getElementById('file-input') as HTMLInputElement;
|
|
964
964
|
* const file = fileInput.files[0];
|
|
965
|
-
* const response = await entities.uploadAttachment(
|
|
966
|
-
* entityName: 'Invoice',
|
|
967
|
-
* recordId: '<recordId>',
|
|
968
|
-
* fieldName: 'Documents',
|
|
969
|
-
* file: file
|
|
970
|
-
* });
|
|
965
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
971
966
|
*
|
|
972
967
|
* // Node.js: Upload a file from disk
|
|
973
968
|
* const fileBuffer = fs.readFileSync('document.pdf');
|
|
974
969
|
* const blob = new Blob([fileBuffer], { type: 'application/pdf' });
|
|
975
|
-
* const response = await entities.uploadAttachment(
|
|
976
|
-
*
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
*
|
|
970
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', blob);
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
uploadAttachment(entityId: string, recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
|
|
974
|
+
/**
|
|
975
|
+
* Removes an attachment from a File-type field of an entity record.
|
|
976
|
+
*
|
|
977
|
+
* @param entityId - UUID of the entity
|
|
978
|
+
* @param recordId - UUID of the record containing the attachment
|
|
979
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
980
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
984
|
+
*
|
|
985
|
+
* const entities = new Entities(sdk);
|
|
986
|
+
*
|
|
987
|
+
* // Get the entityId from getAll()
|
|
988
|
+
* const allEntities = await entities.getAll();
|
|
989
|
+
* const entityId = allEntities[0].id;
|
|
990
|
+
*
|
|
991
|
+
* // Get the recordId from getAllRecords()
|
|
992
|
+
* const records = await entities.getAllRecords(entityId);
|
|
993
|
+
* const recordId = records[0].id;
|
|
994
|
+
*
|
|
995
|
+
* // Delete attachment for a specific record and field
|
|
996
|
+
* await entities.deleteAttachment(entityId, recordId, 'Documents');
|
|
997
|
+
*
|
|
998
|
+
* // Or delete using entity method (entityId is already known)
|
|
999
|
+
* const entity = await entities.getById(entityId);
|
|
1000
|
+
* await entity.deleteAttachment(recordId, 'Documents');
|
|
981
1001
|
* ```
|
|
982
1002
|
*/
|
|
983
|
-
|
|
1003
|
+
deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
|
|
984
1004
|
}
|
|
985
1005
|
/**
|
|
986
1006
|
* Entity methods interface - defines operations that can be performed on an entity
|
|
@@ -1054,10 +1074,18 @@ interface EntityMethods {
|
|
|
1054
1074
|
* @param recordId - UUID of the record to upload the attachment to
|
|
1055
1075
|
* @param fieldName - Name of the File-type field
|
|
1056
1076
|
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
1057
|
-
* @param
|
|
1058
|
-
* @returns Promise resolving to
|
|
1077
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
1078
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
1059
1079
|
*/
|
|
1060
|
-
uploadAttachment(recordId: string, fieldName: string, file:
|
|
1080
|
+
uploadAttachment(recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Deletes an attachment from a File-type field of an entity record
|
|
1083
|
+
*
|
|
1084
|
+
* @param recordId - UUID of the record containing the attachment
|
|
1085
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
1086
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
1087
|
+
*/
|
|
1088
|
+
deleteAttachment(recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
|
|
1061
1089
|
/**
|
|
1062
1090
|
* @deprecated Use {@link insertRecord} instead.
|
|
1063
1091
|
* @hidden
|
|
@@ -1313,7 +1341,9 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1313
1341
|
/**
|
|
1314
1342
|
* Downloads an attachment from an entity record field
|
|
1315
1343
|
*
|
|
1316
|
-
* @param
|
|
1344
|
+
* @param entityId - UUID of the entity
|
|
1345
|
+
* @param recordId - UUID of the record containing the attachment
|
|
1346
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
1317
1347
|
* @returns Promise resolving to Blob containing the file content
|
|
1318
1348
|
*
|
|
1319
1349
|
* @example
|
|
@@ -1322,19 +1352,28 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1322
1352
|
*
|
|
1323
1353
|
* const entities = new Entities(sdk);
|
|
1324
1354
|
*
|
|
1355
|
+
* // Get the entityId from getAll()
|
|
1356
|
+
* const allEntities = await entities.getAll();
|
|
1357
|
+
* const entityId = allEntities[0].id;
|
|
1358
|
+
*
|
|
1359
|
+
* // Get the recordId from getAllRecords()
|
|
1360
|
+
* const records = await entities.getAllRecords(entityId);
|
|
1361
|
+
* const recordId = records[0].id;
|
|
1362
|
+
*
|
|
1325
1363
|
* // Download attachment for a specific record and field
|
|
1326
|
-
* const blob = await entities.downloadAttachment(
|
|
1327
|
-
*
|
|
1328
|
-
* recordId: '<record-uuid>',
|
|
1329
|
-
* fieldName: 'Documents'
|
|
1330
|
-
* });
|
|
1364
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
1365
|
+
* ```
|
|
1331
1366
|
*/
|
|
1332
|
-
downloadAttachment(
|
|
1367
|
+
downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
|
|
1333
1368
|
/**
|
|
1334
1369
|
* Uploads an attachment to a File-type field of an entity record
|
|
1335
1370
|
*
|
|
1336
|
-
* @param
|
|
1337
|
-
* @
|
|
1371
|
+
* @param entityId - UUID of the entity
|
|
1372
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
1373
|
+
* @param fieldName - Name of the File-type field
|
|
1374
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
1375
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
1376
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
1338
1377
|
*
|
|
1339
1378
|
* @example
|
|
1340
1379
|
* ```typescript
|
|
@@ -1342,16 +1381,46 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1342
1381
|
*
|
|
1343
1382
|
* const entities = new Entities(sdk);
|
|
1344
1383
|
*
|
|
1384
|
+
* // Get the entityId from getAll()
|
|
1385
|
+
* const allEntities = await entities.getAll();
|
|
1386
|
+
* const entityId = allEntities[0].id;
|
|
1387
|
+
*
|
|
1388
|
+
* // Get the recordId from getAllRecords()
|
|
1389
|
+
* const records = await entities.getAllRecords(entityId);
|
|
1390
|
+
* const recordId = records[0].id;
|
|
1391
|
+
*
|
|
1345
1392
|
* // Upload a file attachment
|
|
1346
|
-
* const response = await entities.uploadAttachment(
|
|
1347
|
-
*
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
*
|
|
1393
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
1394
|
+
* ```
|
|
1395
|
+
*/
|
|
1396
|
+
uploadAttachment(entityId: string, recordId: string, fieldName: string, file: EntityFileType, options?: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Removes an attachment from a File-type field of an entity record
|
|
1399
|
+
*
|
|
1400
|
+
* @param entityId - UUID of the entity
|
|
1401
|
+
* @param recordId - UUID of the record containing the attachment
|
|
1402
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
1403
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```typescript
|
|
1407
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
1408
|
+
*
|
|
1409
|
+
* const entities = new Entities(sdk);
|
|
1410
|
+
*
|
|
1411
|
+
* // Get the entityId from getAll()
|
|
1412
|
+
* const allEntities = await entities.getAll();
|
|
1413
|
+
* const entityId = allEntities[0].id;
|
|
1414
|
+
*
|
|
1415
|
+
* // Get the recordId from getAllRecords()
|
|
1416
|
+
* const records = await entities.getAllRecords(entityId);
|
|
1417
|
+
* const recordId = records[0].id;
|
|
1418
|
+
*
|
|
1419
|
+
* // Delete attachment for a specific record and field
|
|
1420
|
+
* await entities.deleteAttachment(entityId, recordId, 'Documents');
|
|
1352
1421
|
* ```
|
|
1353
1422
|
*/
|
|
1354
|
-
|
|
1423
|
+
deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
|
|
1355
1424
|
/**
|
|
1356
1425
|
* @hidden
|
|
1357
1426
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -1603,4 +1672,4 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
|
|
|
1603
1672
|
}
|
|
1604
1673
|
|
|
1605
1674
|
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,
|
|
1675
|
+
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, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };
|