@uipath/uipath-typescript 1.1.2 → 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 +12 -6
- package/dist/assets/index.mjs +12 -6
- package/dist/buckets/index.cjs +12 -6
- package/dist/buckets/index.mjs +12 -6
- package/dist/cases/index.cjs +12 -6
- package/dist/cases/index.mjs +12 -6
- package/dist/conversational-agent/index.cjs +12 -6
- package/dist/conversational-agent/index.mjs +12 -6
- 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 +121 -23
- package/dist/entities/index.d.ts +188 -26
- package/dist/entities/index.mjs +121 -23
- package/dist/index.cjs +389 -106
- package/dist/index.d.ts +188 -26
- package/dist/index.mjs +389 -106
- package/dist/index.umd.js +389 -106
- package/dist/maestro-processes/index.cjs +12 -6
- package/dist/maestro-processes/index.mjs +12 -6
- package/dist/processes/index.cjs +12 -6
- package/dist/processes/index.mjs +12 -6
- package/dist/queues/index.cjs +12 -6
- package/dist/queues/index.mjs +12 -6
- package/dist/tasks/index.cjs +12 -6
- package/dist/tasks/index.mjs +12 -6
- 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,
|
|
@@ -562,8 +559,13 @@ class ApiClient {
|
|
|
562
559
|
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
563
560
|
// Construct URL with org and tenant names
|
|
564
561
|
const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
|
|
562
|
+
const isFormData = options.body instanceof FormData;
|
|
563
|
+
const defaultHeaders = await this.getDefaultHeaders();
|
|
564
|
+
if (isFormData) {
|
|
565
|
+
delete defaultHeaders['Content-Type'];
|
|
566
|
+
}
|
|
565
567
|
const headers = {
|
|
566
|
-
...
|
|
568
|
+
...defaultHeaders,
|
|
567
569
|
...options.headers
|
|
568
570
|
};
|
|
569
571
|
// Convert params to URLSearchParams
|
|
@@ -574,11 +576,15 @@ class ApiClient {
|
|
|
574
576
|
});
|
|
575
577
|
}
|
|
576
578
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
579
|
+
let body = undefined;
|
|
580
|
+
if (options.body) {
|
|
581
|
+
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
582
|
+
}
|
|
577
583
|
try {
|
|
578
584
|
const response = await fetch(fullUrl, {
|
|
579
585
|
method,
|
|
580
586
|
headers,
|
|
581
|
-
body
|
|
587
|
+
body,
|
|
582
588
|
signal: options.signal
|
|
583
589
|
});
|
|
584
590
|
if (!response.ok) {
|
|
@@ -1666,13 +1672,19 @@ function createEntityMethods(entityData, service) {
|
|
|
1666
1672
|
return service.getRecordById(entityData.id, recordId, options);
|
|
1667
1673
|
},
|
|
1668
1674
|
async downloadAttachment(recordId, fieldName) {
|
|
1669
|
-
if (!entityData.
|
|
1670
|
-
throw new Error('Entity
|
|
1671
|
-
return service.downloadAttachment(
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1675
|
+
if (!entityData.id)
|
|
1676
|
+
throw new Error('Entity ID is undefined');
|
|
1677
|
+
return service.downloadAttachment(entityData.id, recordId, fieldName);
|
|
1678
|
+
},
|
|
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);
|
|
1676
1688
|
},
|
|
1677
1689
|
async insert(data, options) {
|
|
1678
1690
|
return this.insertRecord(data, options);
|
|
@@ -1724,7 +1736,9 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1724
1736
|
BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
|
|
1725
1737
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
1726
1738
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
1727
|
-
DOWNLOAD_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}`,
|
|
1728
1742
|
},
|
|
1729
1743
|
CHOICESETS: {
|
|
1730
1744
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -1881,7 +1895,7 @@ const EntityFieldTypeMap = {
|
|
|
1881
1895
|
// Connection string placeholder that will be replaced during build
|
|
1882
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";
|
|
1883
1897
|
// SDK Version placeholder
|
|
1884
|
-
const SDK_VERSION = "1.
|
|
1898
|
+
const SDK_VERSION = "1.2.0";
|
|
1885
1899
|
const VERSION = "Version";
|
|
1886
1900
|
const SERVICE = "Service";
|
|
1887
1901
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2457,7 +2471,9 @@ class EntityService extends BaseService {
|
|
|
2457
2471
|
/**
|
|
2458
2472
|
* Downloads an attachment from an entity record field
|
|
2459
2473
|
*
|
|
2460
|
-
* @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
|
|
2461
2477
|
* @returns Promise resolving to Blob containing the file content
|
|
2462
2478
|
*
|
|
2463
2479
|
* @example
|
|
@@ -2466,20 +2482,96 @@ class EntityService extends BaseService {
|
|
|
2466
2482
|
*
|
|
2467
2483
|
* const entities = new Entities(sdk);
|
|
2468
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
|
+
*
|
|
2469
2493
|
* // Download attachment for a specific record and field
|
|
2470
|
-
* const blob = await entities.downloadAttachment(
|
|
2471
|
-
*
|
|
2472
|
-
* recordId: '<record-uuid>',
|
|
2473
|
-
* fieldName: 'Documents'
|
|
2474
|
-
* });
|
|
2494
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
2495
|
+
* ```
|
|
2475
2496
|
*/
|
|
2476
|
-
async downloadAttachment(
|
|
2477
|
-
const
|
|
2478
|
-
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), {
|
|
2479
2499
|
responseType: RESPONSE_TYPES.BLOB
|
|
2480
2500
|
});
|
|
2481
2501
|
return response.data;
|
|
2482
2502
|
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
2505
|
+
*
|
|
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}
|
|
2512
|
+
*
|
|
2513
|
+
* @example
|
|
2514
|
+
* ```typescript
|
|
2515
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
2516
|
+
*
|
|
2517
|
+
* const entities = new Entities(sdk);
|
|
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
|
+
*
|
|
2527
|
+
* // Upload a file attachment
|
|
2528
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
2529
|
+
* ```
|
|
2530
|
+
*/
|
|
2531
|
+
async uploadAttachment(entityId, recordId, fieldName, file, options) {
|
|
2532
|
+
const formData = new FormData();
|
|
2533
|
+
if (file instanceof Uint8Array) {
|
|
2534
|
+
formData.append('file', new Blob([file.buffer]));
|
|
2535
|
+
}
|
|
2536
|
+
else {
|
|
2537
|
+
formData.append('file', file);
|
|
2538
|
+
}
|
|
2539
|
+
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
2540
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
|
|
2541
|
+
// Convert PascalCase response to camelCase
|
|
2542
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
2543
|
+
return camelResponse;
|
|
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
|
+
}
|
|
2483
2575
|
/**
|
|
2484
2576
|
* @hidden
|
|
2485
2577
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -2613,6 +2705,12 @@ __decorate([
|
|
|
2613
2705
|
__decorate([
|
|
2614
2706
|
track('Entities.DownloadAttachment')
|
|
2615
2707
|
], EntityService.prototype, "downloadAttachment", null);
|
|
2708
|
+
__decorate([
|
|
2709
|
+
track('Entities.UploadAttachment')
|
|
2710
|
+
], EntityService.prototype, "uploadAttachment", null);
|
|
2711
|
+
__decorate([
|
|
2712
|
+
track('Entities.DeleteAttachment')
|
|
2713
|
+
], EntityService.prototype, "deleteAttachment", null);
|
|
2616
2714
|
|
|
2617
2715
|
class ChoiceSetService extends BaseService {
|
|
2618
2716
|
/**
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -390,16 +390,24 @@ interface EntityDeleteOptions {
|
|
|
390
390
|
*/
|
|
391
391
|
type EntityDeleteRecordsOptions = EntityDeleteOptions;
|
|
392
392
|
/**
|
|
393
|
-
*
|
|
394
|
-
*/
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
|
|
393
|
+
* Supported file types for attachment upload
|
|
394
|
+
*/
|
|
395
|
+
type EntityFileType = Blob | File | Uint8Array;
|
|
396
|
+
/**
|
|
397
|
+
* Optional options for uploading an attachment to an entity record
|
|
398
|
+
*/
|
|
399
|
+
interface EntityUploadAttachmentOptions {
|
|
400
|
+
/** Optional expansion level (default: 0) */
|
|
401
|
+
expansionLevel?: number;
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Response from uploading an attachment to an entity record
|
|
405
|
+
*/
|
|
406
|
+
type EntityUploadAttachmentResponse = Record<string, unknown>;
|
|
407
|
+
/**
|
|
408
|
+
* Response from deleting an attachment from an entity record
|
|
409
|
+
*/
|
|
410
|
+
type EntityDeleteAttachmentResponse = Record<string, unknown>;
|
|
403
411
|
/**
|
|
404
412
|
* Represents a failure record in an entity operation
|
|
405
413
|
*/
|
|
@@ -876,7 +884,9 @@ interface EntityServiceModel {
|
|
|
876
884
|
/**
|
|
877
885
|
* Downloads an attachment stored in a File-type field of an entity record.
|
|
878
886
|
*
|
|
879
|
-
* @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
|
|
880
890
|
* @returns Promise resolving to Blob containing the file content
|
|
881
891
|
* @example
|
|
882
892
|
* ```typescript
|
|
@@ -889,15 +899,19 @@ interface EntityServiceModel {
|
|
|
889
899
|
* // Get the recordId for the record that contains the attachment
|
|
890
900
|
* const recordId = records.items[0].id;
|
|
891
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
|
+
*
|
|
892
910
|
* // Download attachment using service method
|
|
893
|
-
* const response = await entities.downloadAttachment(
|
|
894
|
-
* entityName: 'Invoice',
|
|
895
|
-
* recordId: recordId,
|
|
896
|
-
* fieldName: 'Documents'
|
|
897
|
-
* });
|
|
911
|
+
* const response = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
898
912
|
*
|
|
899
|
-
* // Or download using entity method
|
|
900
|
-
* const entity = await entities.getById(
|
|
913
|
+
* // Or download using entity method (entityId is already known)
|
|
914
|
+
* const entity = await entities.getById(entityId);
|
|
901
915
|
* const blob = await entity.downloadAttachment(recordId, 'Documents');
|
|
902
916
|
*
|
|
903
917
|
* // Browser: Display Image
|
|
@@ -919,7 +933,74 @@ interface EntityServiceModel {
|
|
|
919
933
|
* fs.writeFileSync('attachment.pdf', buffer);
|
|
920
934
|
* ```
|
|
921
935
|
*/
|
|
922
|
-
downloadAttachment(
|
|
936
|
+
downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
|
|
937
|
+
/**
|
|
938
|
+
* Uploads an attachment to a File-type field of an entity record.
|
|
939
|
+
*
|
|
940
|
+
* Uses multipart/form-data to upload the file content to the specified field.
|
|
941
|
+
*
|
|
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}
|
|
948
|
+
* @example
|
|
949
|
+
* ```typescript
|
|
950
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
951
|
+
*
|
|
952
|
+
* const entities = new Entities(sdk);
|
|
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
|
+
* // Browser: Upload a file from an input element
|
|
963
|
+
* const fileInput = document.getElementById('file-input') as HTMLInputElement;
|
|
964
|
+
* const file = fileInput.files[0];
|
|
965
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
966
|
+
*
|
|
967
|
+
* // Node.js: Upload a file from disk
|
|
968
|
+
* const fileBuffer = fs.readFileSync('document.pdf');
|
|
969
|
+
* const blob = new Blob([fileBuffer], { type: 'application/pdf' });
|
|
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');
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
|
|
923
1004
|
}
|
|
924
1005
|
/**
|
|
925
1006
|
* Entity methods interface - defines operations that can be performed on an entity
|
|
@@ -987,6 +1068,24 @@ interface EntityMethods {
|
|
|
987
1068
|
* @returns Promise resolving to Blob containing the file content
|
|
988
1069
|
*/
|
|
989
1070
|
downloadAttachment(recordId: string, fieldName: string): Promise<Blob>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
1073
|
+
*
|
|
1074
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
1075
|
+
* @param fieldName - Name of the File-type field
|
|
1076
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
1077
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
1078
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
1079
|
+
*/
|
|
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>;
|
|
990
1089
|
/**
|
|
991
1090
|
* @deprecated Use {@link insertRecord} instead.
|
|
992
1091
|
* @hidden
|
|
@@ -1242,7 +1341,9 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1242
1341
|
/**
|
|
1243
1342
|
* Downloads an attachment from an entity record field
|
|
1244
1343
|
*
|
|
1245
|
-
* @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
|
|
1246
1347
|
* @returns Promise resolving to Blob containing the file content
|
|
1247
1348
|
*
|
|
1248
1349
|
* @example
|
|
@@ -1251,14 +1352,75 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1251
1352
|
*
|
|
1252
1353
|
* const entities = new Entities(sdk);
|
|
1253
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
|
+
*
|
|
1254
1363
|
* // Download attachment for a specific record and field
|
|
1255
|
-
* const blob = await entities.downloadAttachment(
|
|
1256
|
-
*
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1364
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
1365
|
+
* ```
|
|
1366
|
+
*/
|
|
1367
|
+
downloadAttachment(entityId: string, recordId: string, fieldName: string): Promise<Blob>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
1370
|
+
*
|
|
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}
|
|
1377
|
+
*
|
|
1378
|
+
* @example
|
|
1379
|
+
* ```typescript
|
|
1380
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
1381
|
+
*
|
|
1382
|
+
* const entities = new Entities(sdk);
|
|
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
|
+
*
|
|
1392
|
+
* // Upload a file attachment
|
|
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');
|
|
1421
|
+
* ```
|
|
1260
1422
|
*/
|
|
1261
|
-
|
|
1423
|
+
deleteAttachment(entityId: string, recordId: string, fieldName: string): Promise<EntityDeleteAttachmentResponse>;
|
|
1262
1424
|
/**
|
|
1263
1425
|
* @hidden
|
|
1264
1426
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -1510,4 +1672,4 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
|
|
|
1510
1672
|
}
|
|
1511
1673
|
|
|
1512
1674
|
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,
|
|
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 };
|