@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.mjs
CHANGED
|
@@ -544,11 +544,8 @@ class ApiClient {
|
|
|
544
544
|
return this.tokenManager.getValidToken();
|
|
545
545
|
}
|
|
546
546
|
async getDefaultHeaders() {
|
|
547
|
-
// Get headers from execution context first
|
|
548
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
549
547
|
const token = await this.getValidToken();
|
|
550
548
|
return {
|
|
551
|
-
...contextHeaders,
|
|
552
549
|
'Authorization': `Bearer ${token}`,
|
|
553
550
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
554
551
|
...this.defaultHeaders,
|
|
@@ -1673,24 +1670,19 @@ function createEntityMethods(entityData, service) {
|
|
|
1673
1670
|
return service.getRecordById(entityData.id, recordId, options);
|
|
1674
1671
|
},
|
|
1675
1672
|
async downloadAttachment(recordId, fieldName) {
|
|
1676
|
-
if (!entityData.
|
|
1677
|
-
throw new Error('Entity
|
|
1678
|
-
return service.downloadAttachment(
|
|
1679
|
-
entityName: entityData.name,
|
|
1680
|
-
recordId,
|
|
1681
|
-
fieldName
|
|
1682
|
-
});
|
|
1673
|
+
if (!entityData.id)
|
|
1674
|
+
throw new Error('Entity ID is undefined');
|
|
1675
|
+
return service.downloadAttachment(entityData.id, recordId, fieldName);
|
|
1683
1676
|
},
|
|
1684
|
-
async uploadAttachment(recordId, fieldName, file,
|
|
1685
|
-
if (!entityData.
|
|
1686
|
-
throw new Error('Entity
|
|
1687
|
-
return service.uploadAttachment(
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
});
|
|
1677
|
+
async uploadAttachment(recordId, fieldName, file, options) {
|
|
1678
|
+
if (!entityData.id)
|
|
1679
|
+
throw new Error('Entity ID is undefined');
|
|
1680
|
+
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
1681
|
+
},
|
|
1682
|
+
async deleteAttachment(recordId, fieldName) {
|
|
1683
|
+
if (!entityData.id)
|
|
1684
|
+
throw new Error('Entity ID is undefined');
|
|
1685
|
+
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
1694
1686
|
},
|
|
1695
1687
|
async insert(data, options) {
|
|
1696
1688
|
return this.insertRecord(data, options);
|
|
@@ -1742,8 +1734,9 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1742
1734
|
BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
|
|
1743
1735
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
1744
1736
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
1745
|
-
DOWNLOAD_ATTACHMENT: (
|
|
1746
|
-
UPLOAD_ATTACHMENT: (
|
|
1737
|
+
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1738
|
+
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1739
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
1747
1740
|
},
|
|
1748
1741
|
CHOICESETS: {
|
|
1749
1742
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -1900,7 +1893,7 @@ const EntityFieldTypeMap = {
|
|
|
1900
1893
|
// Connection string placeholder that will be replaced during build
|
|
1901
1894
|
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";
|
|
1902
1895
|
// SDK Version placeholder
|
|
1903
|
-
const SDK_VERSION = "1.
|
|
1896
|
+
const SDK_VERSION = "1.2.0";
|
|
1904
1897
|
const VERSION = "Version";
|
|
1905
1898
|
const SERVICE = "Service";
|
|
1906
1899
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2476,7 +2469,9 @@ class EntityService extends BaseService {
|
|
|
2476
2469
|
/**
|
|
2477
2470
|
* Downloads an attachment from an entity record field
|
|
2478
2471
|
*
|
|
2479
|
-
* @param
|
|
2472
|
+
* @param entityId - UUID of the entity
|
|
2473
|
+
* @param recordId - UUID of the record containing the attachment
|
|
2474
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
2480
2475
|
* @returns Promise resolving to Blob containing the file content
|
|
2481
2476
|
*
|
|
2482
2477
|
* @example
|
|
@@ -2485,16 +2480,20 @@ class EntityService extends BaseService {
|
|
|
2485
2480
|
*
|
|
2486
2481
|
* const entities = new Entities(sdk);
|
|
2487
2482
|
*
|
|
2483
|
+
* // Get the entityId from getAll()
|
|
2484
|
+
* const allEntities = await entities.getAll();
|
|
2485
|
+
* const entityId = allEntities[0].id;
|
|
2486
|
+
*
|
|
2487
|
+
* // Get the recordId from getAllRecords()
|
|
2488
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2489
|
+
* const recordId = records[0].id;
|
|
2490
|
+
*
|
|
2488
2491
|
* // Download attachment for a specific record and field
|
|
2489
|
-
* const blob = await entities.downloadAttachment(
|
|
2490
|
-
*
|
|
2491
|
-
* recordId: '<record-uuid>',
|
|
2492
|
-
* fieldName: 'Documents'
|
|
2493
|
-
* });
|
|
2492
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
2493
|
+
* ```
|
|
2494
2494
|
*/
|
|
2495
|
-
async downloadAttachment(
|
|
2496
|
-
const
|
|
2497
|
-
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityName, recordId, fieldName), {
|
|
2495
|
+
async downloadAttachment(entityId, recordId, fieldName) {
|
|
2496
|
+
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
|
|
2498
2497
|
responseType: RESPONSE_TYPES.BLOB
|
|
2499
2498
|
});
|
|
2500
2499
|
return response.data;
|
|
@@ -2502,8 +2501,12 @@ class EntityService extends BaseService {
|
|
|
2502
2501
|
/**
|
|
2503
2502
|
* Uploads an attachment to a File-type field of an entity record
|
|
2504
2503
|
*
|
|
2505
|
-
* @param
|
|
2506
|
-
* @
|
|
2504
|
+
* @param entityId - UUID of the entity
|
|
2505
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
2506
|
+
* @param fieldName - Name of the File-type field
|
|
2507
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
2508
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
2509
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
2507
2510
|
*
|
|
2508
2511
|
* @example
|
|
2509
2512
|
* ```typescript
|
|
@@ -2511,17 +2514,19 @@ class EntityService extends BaseService {
|
|
|
2511
2514
|
*
|
|
2512
2515
|
* const entities = new Entities(sdk);
|
|
2513
2516
|
*
|
|
2517
|
+
* // Get the entityId from getAll()
|
|
2518
|
+
* const allEntities = await entities.getAll();
|
|
2519
|
+
* const entityId = allEntities[0].id;
|
|
2520
|
+
*
|
|
2521
|
+
* // Get the recordId from getAllRecords()
|
|
2522
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2523
|
+
* const recordId = records[0].id;
|
|
2524
|
+
*
|
|
2514
2525
|
* // Upload a file attachment
|
|
2515
|
-
* const response = await entities.uploadAttachment(
|
|
2516
|
-
* entityName: 'Invoice',
|
|
2517
|
-
* recordId: '<record-uuid>',
|
|
2518
|
-
* fieldName: 'Documents',
|
|
2519
|
-
* file: file
|
|
2520
|
-
* });
|
|
2526
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
2521
2527
|
* ```
|
|
2522
2528
|
*/
|
|
2523
|
-
async uploadAttachment(options) {
|
|
2524
|
-
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
2529
|
+
async uploadAttachment(entityId, recordId, fieldName, file, options) {
|
|
2525
2530
|
const formData = new FormData();
|
|
2526
2531
|
if (file instanceof Uint8Array) {
|
|
2527
2532
|
formData.append('file', new Blob([file.buffer]));
|
|
@@ -2529,12 +2534,42 @@ class EntityService extends BaseService {
|
|
|
2529
2534
|
else {
|
|
2530
2535
|
formData.append('file', file);
|
|
2531
2536
|
}
|
|
2532
|
-
const params = createParams({ expansionLevel });
|
|
2533
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
2537
|
+
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
2538
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
|
|
2534
2539
|
// Convert PascalCase response to camelCase
|
|
2535
2540
|
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
2536
2541
|
return camelResponse;
|
|
2537
2542
|
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Removes an attachment from a File-type field of an entity record
|
|
2545
|
+
*
|
|
2546
|
+
* @param entityId - UUID of the entity
|
|
2547
|
+
* @param recordId - UUID of the record containing the attachment
|
|
2548
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
2549
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
2550
|
+
*
|
|
2551
|
+
* @example
|
|
2552
|
+
* ```typescript
|
|
2553
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
2554
|
+
*
|
|
2555
|
+
* const entities = new Entities(sdk);
|
|
2556
|
+
*
|
|
2557
|
+
* // Get the entityId from getAll()
|
|
2558
|
+
* const allEntities = await entities.getAll();
|
|
2559
|
+
* const entityId = allEntities[0].id;
|
|
2560
|
+
*
|
|
2561
|
+
* // Get the recordId from getAllRecords()
|
|
2562
|
+
* const records = await entities.getAllRecords(entityId);
|
|
2563
|
+
* const recordId = records[0].id;
|
|
2564
|
+
*
|
|
2565
|
+
* // Delete attachment for a specific record and field
|
|
2566
|
+
* await entities.deleteAttachment(entityId, recordId, 'Documents');
|
|
2567
|
+
* ```
|
|
2568
|
+
*/
|
|
2569
|
+
async deleteAttachment(entityId, recordId, fieldName) {
|
|
2570
|
+
const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName));
|
|
2571
|
+
return response.data;
|
|
2572
|
+
}
|
|
2538
2573
|
/**
|
|
2539
2574
|
* @hidden
|
|
2540
2575
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -2671,6 +2706,9 @@ __decorate([
|
|
|
2671
2706
|
__decorate([
|
|
2672
2707
|
track('Entities.UploadAttachment')
|
|
2673
2708
|
], EntityService.prototype, "uploadAttachment", null);
|
|
2709
|
+
__decorate([
|
|
2710
|
+
track('Entities.DeleteAttachment')
|
|
2711
|
+
], EntityService.prototype, "deleteAttachment", null);
|
|
2674
2712
|
|
|
2675
2713
|
class ChoiceSetService extends BaseService {
|
|
2676
2714
|
/**
|