@uipath/uipath-typescript 1.1.2 → 1.1.3
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 -3
- package/dist/assets/index.mjs +12 -3
- package/dist/buckets/index.cjs +12 -3
- package/dist/buckets/index.mjs +12 -3
- package/dist/cases/index.cjs +12 -3
- package/dist/cases/index.mjs +12 -3
- package/dist/conversational-agent/index.cjs +12 -3
- package/dist/conversational-agent/index.mjs +12 -3
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/entities/index.cjs +63 -3
- package/dist/entities/index.d.ts +94 -1
- package/dist/entities/index.mjs +63 -3
- package/dist/index.cjs +63 -3
- package/dist/index.d.ts +95 -2
- package/dist/index.mjs +63 -3
- package/dist/index.umd.js +63 -3
- package/dist/maestro-processes/index.cjs +12 -3
- package/dist/maestro-processes/index.mjs +12 -3
- package/dist/processes/index.cjs +12 -3
- package/dist/processes/index.mjs +12 -3
- package/dist/queues/index.cjs +12 -3
- package/dist/queues/index.mjs +12 -3
- package/dist/tasks/index.cjs +12 -3
- package/dist/tasks/index.mjs +12 -3
- package/package.json +1 -1
package/dist/entities/index.mjs
CHANGED
|
@@ -560,8 +560,13 @@ class ApiClient {
|
|
|
560
560
|
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
561
561
|
// Construct URL with org and tenant names
|
|
562
562
|
const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
|
|
563
|
+
const isFormData = options.body instanceof FormData;
|
|
564
|
+
const defaultHeaders = await this.getDefaultHeaders();
|
|
565
|
+
if (isFormData) {
|
|
566
|
+
delete defaultHeaders['Content-Type'];
|
|
567
|
+
}
|
|
563
568
|
const headers = {
|
|
564
|
-
...
|
|
569
|
+
...defaultHeaders,
|
|
565
570
|
...options.headers
|
|
566
571
|
};
|
|
567
572
|
// Convert params to URLSearchParams
|
|
@@ -572,11 +577,15 @@ class ApiClient {
|
|
|
572
577
|
});
|
|
573
578
|
}
|
|
574
579
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
580
|
+
let body = undefined;
|
|
581
|
+
if (options.body) {
|
|
582
|
+
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
583
|
+
}
|
|
575
584
|
try {
|
|
576
585
|
const response = await fetch(fullUrl, {
|
|
577
586
|
method,
|
|
578
587
|
headers,
|
|
579
|
-
body
|
|
588
|
+
body,
|
|
580
589
|
signal: options.signal
|
|
581
590
|
});
|
|
582
591
|
if (!response.ok) {
|
|
@@ -1672,6 +1681,17 @@ function createEntityMethods(entityData, service) {
|
|
|
1672
1681
|
fieldName
|
|
1673
1682
|
});
|
|
1674
1683
|
},
|
|
1684
|
+
async uploadAttachment(recordId, fieldName, file, expansionLevel) {
|
|
1685
|
+
if (!entityData.name)
|
|
1686
|
+
throw new Error('Entity name is undefined');
|
|
1687
|
+
return service.uploadAttachment({
|
|
1688
|
+
entityName: entityData.name,
|
|
1689
|
+
recordId,
|
|
1690
|
+
fieldName,
|
|
1691
|
+
file,
|
|
1692
|
+
expansionLevel
|
|
1693
|
+
});
|
|
1694
|
+
},
|
|
1675
1695
|
async insert(data, options) {
|
|
1676
1696
|
return this.insertRecord(data, options);
|
|
1677
1697
|
},
|
|
@@ -1723,6 +1743,7 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1723
1743
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
1724
1744
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
1725
1745
|
DOWNLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
1746
|
+
UPLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
1726
1747
|
},
|
|
1727
1748
|
CHOICESETS: {
|
|
1728
1749
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -1879,7 +1900,7 @@ const EntityFieldTypeMap = {
|
|
|
1879
1900
|
// Connection string placeholder that will be replaced during build
|
|
1880
1901
|
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";
|
|
1881
1902
|
// SDK Version placeholder
|
|
1882
|
-
const SDK_VERSION = "1.1.
|
|
1903
|
+
const SDK_VERSION = "1.1.3";
|
|
1883
1904
|
const VERSION = "Version";
|
|
1884
1905
|
const SERVICE = "Service";
|
|
1885
1906
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2478,6 +2499,42 @@ class EntityService extends BaseService {
|
|
|
2478
2499
|
});
|
|
2479
2500
|
return response.data;
|
|
2480
2501
|
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
2504
|
+
*
|
|
2505
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
2506
|
+
* @returns Promise resolving to the upload response
|
|
2507
|
+
*
|
|
2508
|
+
* @example
|
|
2509
|
+
* ```typescript
|
|
2510
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
2511
|
+
*
|
|
2512
|
+
* const entities = new Entities(sdk);
|
|
2513
|
+
*
|
|
2514
|
+
* // Upload a file attachment
|
|
2515
|
+
* const response = await entities.uploadAttachment({
|
|
2516
|
+
* entityName: 'Invoice',
|
|
2517
|
+
* recordId: '<record-uuid>',
|
|
2518
|
+
* fieldName: 'Documents',
|
|
2519
|
+
* file: file
|
|
2520
|
+
* });
|
|
2521
|
+
* ```
|
|
2522
|
+
*/
|
|
2523
|
+
async uploadAttachment(options) {
|
|
2524
|
+
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
2525
|
+
const formData = new FormData();
|
|
2526
|
+
if (file instanceof Uint8Array) {
|
|
2527
|
+
formData.append('file', new Blob([file.buffer]));
|
|
2528
|
+
}
|
|
2529
|
+
else {
|
|
2530
|
+
formData.append('file', file);
|
|
2531
|
+
}
|
|
2532
|
+
const params = createParams({ expansionLevel });
|
|
2533
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityName, recordId, fieldName), formData, { params });
|
|
2534
|
+
// Convert PascalCase response to camelCase
|
|
2535
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
2536
|
+
return camelResponse;
|
|
2537
|
+
}
|
|
2481
2538
|
/**
|
|
2482
2539
|
* @hidden
|
|
2483
2540
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -2611,6 +2668,9 @@ __decorate([
|
|
|
2611
2668
|
__decorate([
|
|
2612
2669
|
track('Entities.DownloadAttachment')
|
|
2613
2670
|
], EntityService.prototype, "downloadAttachment", null);
|
|
2671
|
+
__decorate([
|
|
2672
|
+
track('Entities.UploadAttachment')
|
|
2673
|
+
], EntityService.prototype, "uploadAttachment", null);
|
|
2614
2674
|
|
|
2615
2675
|
class ChoiceSetService extends BaseService {
|
|
2616
2676
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -4693,6 +4693,7 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
4693
4693
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4694
4694
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4695
4695
|
DOWNLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4696
|
+
UPLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4696
4697
|
},
|
|
4697
4698
|
CHOICESETS: {
|
|
4698
4699
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -5138,7 +5139,7 @@ function normalizeBaseUrl(url) {
|
|
|
5138
5139
|
// Connection string placeholder that will be replaced during build
|
|
5139
5140
|
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";
|
|
5140
5141
|
// SDK Version placeholder
|
|
5141
|
-
const SDK_VERSION = "1.1.
|
|
5142
|
+
const SDK_VERSION = "1.1.3";
|
|
5142
5143
|
const VERSION = "Version";
|
|
5143
5144
|
const SERVICE = "Service";
|
|
5144
5145
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -6020,8 +6021,13 @@ class ApiClient {
|
|
|
6020
6021
|
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
6021
6022
|
// Construct URL with org and tenant names
|
|
6022
6023
|
const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
|
|
6024
|
+
const isFormData = options.body instanceof FormData;
|
|
6025
|
+
const defaultHeaders = await this.getDefaultHeaders();
|
|
6026
|
+
if (isFormData) {
|
|
6027
|
+
delete defaultHeaders['Content-Type'];
|
|
6028
|
+
}
|
|
6023
6029
|
const headers = {
|
|
6024
|
-
...
|
|
6030
|
+
...defaultHeaders,
|
|
6025
6031
|
...options.headers
|
|
6026
6032
|
};
|
|
6027
6033
|
// Convert params to URLSearchParams
|
|
@@ -6032,11 +6038,15 @@ class ApiClient {
|
|
|
6032
6038
|
});
|
|
6033
6039
|
}
|
|
6034
6040
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
6041
|
+
let body = undefined;
|
|
6042
|
+
if (options.body) {
|
|
6043
|
+
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
6044
|
+
}
|
|
6035
6045
|
try {
|
|
6036
6046
|
const response = await fetch(fullUrl, {
|
|
6037
6047
|
method,
|
|
6038
6048
|
headers,
|
|
6039
|
-
body
|
|
6049
|
+
body,
|
|
6040
6050
|
signal: options.signal
|
|
6041
6051
|
});
|
|
6042
6052
|
if (!response.ok) {
|
|
@@ -7327,6 +7337,17 @@ function createEntityMethods(entityData, service) {
|
|
|
7327
7337
|
fieldName
|
|
7328
7338
|
});
|
|
7329
7339
|
},
|
|
7340
|
+
async uploadAttachment(recordId, fieldName, file, expansionLevel) {
|
|
7341
|
+
if (!entityData.name)
|
|
7342
|
+
throw new Error('Entity name is undefined');
|
|
7343
|
+
return service.uploadAttachment({
|
|
7344
|
+
entityName: entityData.name,
|
|
7345
|
+
recordId,
|
|
7346
|
+
fieldName,
|
|
7347
|
+
file,
|
|
7348
|
+
expansionLevel
|
|
7349
|
+
});
|
|
7350
|
+
},
|
|
7330
7351
|
async insert(data, options) {
|
|
7331
7352
|
return this.insertRecord(data, options);
|
|
7332
7353
|
},
|
|
@@ -7830,6 +7851,42 @@ class EntityService extends BaseService {
|
|
|
7830
7851
|
});
|
|
7831
7852
|
return response.data;
|
|
7832
7853
|
}
|
|
7854
|
+
/**
|
|
7855
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
7856
|
+
*
|
|
7857
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
7858
|
+
* @returns Promise resolving to the upload response
|
|
7859
|
+
*
|
|
7860
|
+
* @example
|
|
7861
|
+
* ```typescript
|
|
7862
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
7863
|
+
*
|
|
7864
|
+
* const entities = new Entities(sdk);
|
|
7865
|
+
*
|
|
7866
|
+
* // Upload a file attachment
|
|
7867
|
+
* const response = await entities.uploadAttachment({
|
|
7868
|
+
* entityName: 'Invoice',
|
|
7869
|
+
* recordId: '<record-uuid>',
|
|
7870
|
+
* fieldName: 'Documents',
|
|
7871
|
+
* file: file
|
|
7872
|
+
* });
|
|
7873
|
+
* ```
|
|
7874
|
+
*/
|
|
7875
|
+
async uploadAttachment(options) {
|
|
7876
|
+
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
7877
|
+
const formData = new FormData();
|
|
7878
|
+
if (file instanceof Uint8Array) {
|
|
7879
|
+
formData.append('file', new Blob([file.buffer]));
|
|
7880
|
+
}
|
|
7881
|
+
else {
|
|
7882
|
+
formData.append('file', file);
|
|
7883
|
+
}
|
|
7884
|
+
const params = createParams({ expansionLevel });
|
|
7885
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityName, recordId, fieldName), formData, { params });
|
|
7886
|
+
// Convert PascalCase response to camelCase
|
|
7887
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
7888
|
+
return camelResponse;
|
|
7889
|
+
}
|
|
7833
7890
|
/**
|
|
7834
7891
|
* @hidden
|
|
7835
7892
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -7963,6 +8020,9 @@ __decorate([
|
|
|
7963
8020
|
__decorate([
|
|
7964
8021
|
track('Entities.DownloadAttachment')
|
|
7965
8022
|
], EntityService.prototype, "downloadAttachment", null);
|
|
8023
|
+
__decorate([
|
|
8024
|
+
track('Entities.UploadAttachment')
|
|
8025
|
+
], EntityService.prototype, "uploadAttachment", null);
|
|
7966
8026
|
|
|
7967
8027
|
class ChoiceSetService extends BaseService {
|
|
7968
8028
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -536,6 +536,31 @@ interface EntityDownloadAttachmentOptions {
|
|
|
536
536
|
/** Field name containing the attachment */
|
|
537
537
|
fieldName: string;
|
|
538
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Options for uploading an attachment to an entity record
|
|
541
|
+
*/
|
|
542
|
+
interface EntityUploadAttachmentOptions {
|
|
543
|
+
/** Entity name */
|
|
544
|
+
entityName: string;
|
|
545
|
+
/** Record ID (UUID) */
|
|
546
|
+
recordId: string;
|
|
547
|
+
/** Field name of the File-type field */
|
|
548
|
+
fieldName: string;
|
|
549
|
+
/**
|
|
550
|
+
* File to upload. Accepts the native types supported by FormData:
|
|
551
|
+
* - `Blob` / `File`: standard browser and Node.js ≥ 18 types accepted directly by FormData.
|
|
552
|
+
* `File` is a subclass of `Blob` and is typically obtained from a browser file input.
|
|
553
|
+
* - `Uint8Array`: raw binary buffer (e.g. from `fs.readFileSync` or a Node.js Buffer).
|
|
554
|
+
* Converted to a `Blob` internally before appending to FormData.
|
|
555
|
+
*/
|
|
556
|
+
file: Blob | File | Uint8Array;
|
|
557
|
+
/** Optional expansion level (default: 0) */
|
|
558
|
+
expansionLevel?: number;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Response from uploading an attachment to an entity record
|
|
562
|
+
*/
|
|
563
|
+
type EntityUploadAttachmentResponse = Record<string, unknown>;
|
|
539
564
|
/**
|
|
540
565
|
* Represents a failure record in an entity operation
|
|
541
566
|
*/
|
|
@@ -1056,6 +1081,42 @@ interface EntityServiceModel {
|
|
|
1056
1081
|
* ```
|
|
1057
1082
|
*/
|
|
1058
1083
|
downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Uploads an attachment to a File-type field of an entity record.
|
|
1086
|
+
*
|
|
1087
|
+
* Uses multipart/form-data to upload the file content to the specified field.
|
|
1088
|
+
*
|
|
1089
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
1090
|
+
* @returns Promise resolving to the upload response
|
|
1091
|
+
* {@link EntityUploadAttachmentResponse}
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
1095
|
+
*
|
|
1096
|
+
* const entities = new Entities(sdk);
|
|
1097
|
+
*
|
|
1098
|
+
* // Browser: Upload a file from an input element
|
|
1099
|
+
* const fileInput = document.getElementById('file-input') as HTMLInputElement;
|
|
1100
|
+
* const file = fileInput.files[0];
|
|
1101
|
+
* const response = await entities.uploadAttachment({
|
|
1102
|
+
* entityName: 'Invoice',
|
|
1103
|
+
* recordId: '<recordId>',
|
|
1104
|
+
* fieldName: 'Documents',
|
|
1105
|
+
* file: file
|
|
1106
|
+
* });
|
|
1107
|
+
*
|
|
1108
|
+
* // Node.js: Upload a file from disk
|
|
1109
|
+
* const fileBuffer = fs.readFileSync('document.pdf');
|
|
1110
|
+
* const blob = new Blob([fileBuffer], { type: 'application/pdf' });
|
|
1111
|
+
* const response = await entities.uploadAttachment({
|
|
1112
|
+
* entityName: 'Invoice',
|
|
1113
|
+
* recordId: '<recordId>',
|
|
1114
|
+
* fieldName: 'Documents',
|
|
1115
|
+
* file: blob
|
|
1116
|
+
* });
|
|
1117
|
+
* ```
|
|
1118
|
+
*/
|
|
1119
|
+
uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
|
|
1059
1120
|
}
|
|
1060
1121
|
/**
|
|
1061
1122
|
* Entity methods interface - defines operations that can be performed on an entity
|
|
@@ -1123,6 +1184,16 @@ interface EntityMethods {
|
|
|
1123
1184
|
* @returns Promise resolving to Blob containing the file content
|
|
1124
1185
|
*/
|
|
1125
1186
|
downloadAttachment(recordId: string, fieldName: string): Promise<Blob>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
1189
|
+
*
|
|
1190
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
1191
|
+
* @param fieldName - Name of the File-type field
|
|
1192
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
1193
|
+
* @param expansionLevel - Optional expansion level (default: 0)
|
|
1194
|
+
* @returns Promise resolving to the upload response
|
|
1195
|
+
*/
|
|
1196
|
+
uploadAttachment(recordId: string, fieldName: string, file: Blob | File | Uint8Array, expansionLevel?: number): Promise<EntityUploadAttachmentResponse>;
|
|
1126
1197
|
/**
|
|
1127
1198
|
* @deprecated Use {@link insertRecord} instead.
|
|
1128
1199
|
* @hidden
|
|
@@ -1395,6 +1466,28 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1395
1466
|
* });
|
|
1396
1467
|
*/
|
|
1397
1468
|
downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
1471
|
+
*
|
|
1472
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
1473
|
+
* @returns Promise resolving to the upload response
|
|
1474
|
+
*
|
|
1475
|
+
* @example
|
|
1476
|
+
* ```typescript
|
|
1477
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
1478
|
+
*
|
|
1479
|
+
* const entities = new Entities(sdk);
|
|
1480
|
+
*
|
|
1481
|
+
* // Upload a file attachment
|
|
1482
|
+
* const response = await entities.uploadAttachment({
|
|
1483
|
+
* entityName: 'Invoice',
|
|
1484
|
+
* recordId: '<record-uuid>',
|
|
1485
|
+
* fieldName: 'Documents',
|
|
1486
|
+
* file: file
|
|
1487
|
+
* });
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
|
|
1398
1491
|
/**
|
|
1399
1492
|
* @hidden
|
|
1400
1493
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -10293,7 +10386,7 @@ declare const telemetryClient: TelemetryClient;
|
|
|
10293
10386
|
* SDK Telemetry constants
|
|
10294
10387
|
*/
|
|
10295
10388
|
declare 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";
|
|
10296
|
-
declare const SDK_VERSION = "1.1.
|
|
10389
|
+
declare const SDK_VERSION = "1.1.3";
|
|
10297
10390
|
declare const VERSION = "Version";
|
|
10298
10391
|
declare const SERVICE = "Service";
|
|
10299
10392
|
declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -10309,4 +10402,4 @@ declare const SDK_RUN_EVENT = "Sdk.Run";
|
|
|
10309
10402
|
declare const UNKNOWN = "";
|
|
10310
10403
|
|
|
10311
10404
|
export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobState, JobType, JoinType, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
|
|
10312
|
-
export type { AgentAppearance, AgentConversationServiceModel, AgentCreateConversationOptions, AgentGetByIdResponse, AgentGetResponse, AgentMethods, AgentStartingPrompt, ArgumentMetadata, AssetGetAllOptions, AssetGetByIdOptions, AssetGetResponse, AssetServiceModel, AsyncInputStream, AsyncInputStreamChunkEvent, AsyncInputStreamEndEvent, AsyncInputStreamEvent, AsyncInputStreamStartEvent, AsyncToolCallStream, BaseConfig, BaseOptions, BaseProcessStartRequest, BlobItem, BodyOptions, BpmnXmlString, BucketGetAllOptions, BucketGetByIdOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetStageResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstancesServiceModel, CasesServiceModel, ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, Citation, CitationEndEvent, CitationError, CitationEvent, CitationOptions, CitationSource, CitationSourceBase, CitationSourceMedia, CitationSourceUrl, CitationStartEvent, CollectionResponse, CompletedContentPart, CompletedMessage, CompletedToolCall, ContentPart, ContentPartChunkEvent, ContentPartData, ContentPartEndEvent, ContentPartEvent, ContentPartGetResponse, ContentPartInterrupted, ContentPartStartEvent, ContentPartStartMetaData, ContentPartStream, ConversationAttachmentCreateResponse, ConversationAttachmentUploadResponse, ConversationCreateOptions, ConversationCreateResponse, ConversationDeleteResponse, ConversationEvent, ConversationExchangeServiceModel, ConversationGetAllOptions, ConversationGetResponse, ConversationJobStartOverrides, ConversationMethods, ConversationServiceModel, ConversationSessionMethods, ConversationSessionOptions, ConversationUpdateOptions, ConversationUpdateResponse, ConversationalAgentOptions, ConversationalAgentServiceModel, CreateFeedbackOptions, CustomKeyValuePair, ElementExecutionMetadata, ElementMetaData, ElementRunMetadata, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityDownloadAttachmentOptions, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordsOptions, EntityUpdateResponse, ErrorEndEvent, ErrorEvent, ErrorStartEvent, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, Exchange, ExchangeEndEvent, ExchangeEvent, ExchangeGetAllOptions, ExchangeGetByIdOptions, ExchangeGetResponse, ExchangeServiceModel, ExchangeStartEvent, ExchangeStream, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, ExternalValue, FailureRecord, FeatureFlags, FeedbackCreateResponse, Field, FieldDataType, FieldMetaData, FileUploadAccess, FolderProperties, GenericInterruptStartEvent, GlobalVariableMetaData, HasPaginationOptions, Headers, HttpMethod, InlineOrExternalValue, InlineValue, Interrupt, InterruptEndEvent, InterruptEvent, InterruptStartEvent, JSONArray, JSONObject, JSONPrimitive, JSONValue, JobAttachment, JobError, LabelUpdatedEvent, Machine, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, MakeOptional, MakeRequired, Message, MessageEndEvent, MessageEvent, MessageGetResponse, MessageServiceModel, MessageStartEvent, MessageStream, MetaData, MetaEvent, NonPaginatedResponse, OAuthFields, OperationResponse, PaginatedResponse, PaginationCursor, PaginationMetadata, PaginationMethodUnion, PaginationOptions, PartialUiPathConfig, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetResponse, ProcessIncidentGetAllResponse, ProcessIncidentGetResponse, ProcessIncidentsServiceModel, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessMethods, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, QueryParams, QueueGetAllOptions, QueueGetByIdOptions, QueueGetResponse, QueueServiceModel, RawAgentGetByIdResponse, RawAgentGetResponse, RawCaseInstanceGetResponse, RawConversationGetResponse, RawEntityGetResponse, RawMaestroProcessGetAllResponse, RawProcessInstanceGetResponse, RawTaskCreateResponse, RawTaskGetResponse, RequestOptions, RequestSpec, ResponseDictionary, ResponseType, RetryOptions, RobotMetadata, SessionCapabilities, SessionEndEvent, SessionEndingEvent, SessionStartEvent, SessionStartedEvent, SessionStream, Simplify, SourceJoinCriteria, StageSLA, StageTask, Tag, TaskActivity, TaskAssignOptions, TaskAssignment, TaskAssignmentOptions, TaskAssignmentResponse, TaskBaseResponse, TaskCompleteOptions, TaskCompletionOptions, TaskCreateOptions, TaskCreateResponse, TaskGetAllOptions, TaskGetByIdOptions, TaskGetResponse, TaskGetUsersOptions, TaskMethods, TaskServiceModel, TaskSlaDetail, TaskSource, TasksUnassignOptions, TimeoutOptions, ToolCall, ToolCallConfirmationEndValue, ToolCallConfirmationInterruptStartEvent, ToolCallConfirmationValue, ToolCallEndEvent, ToolCallEvent, ToolCallInputValue, ToolCallOutputValue, ToolCallResult, ToolCallStartEvent, ToolCallStream, UiPathSDKConfig, UserLoginInfo, UserServiceModel, UserSettingsGetResponse, UserSettingsUpdateOptions, UserSettingsUpdateResponse };
|
|
10405
|
+
export type { AgentAppearance, AgentConversationServiceModel, AgentCreateConversationOptions, AgentGetByIdResponse, AgentGetResponse, AgentMethods, AgentStartingPrompt, ArgumentMetadata, AssetGetAllOptions, AssetGetByIdOptions, AssetGetResponse, AssetServiceModel, AsyncInputStream, AsyncInputStreamChunkEvent, AsyncInputStreamEndEvent, AsyncInputStreamEvent, AsyncInputStreamStartEvent, AsyncToolCallStream, BaseConfig, BaseOptions, BaseProcessStartRequest, BlobItem, BodyOptions, BpmnXmlString, BucketGetAllOptions, BucketGetByIdOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetStageResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstancesServiceModel, CasesServiceModel, ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, Citation, CitationEndEvent, CitationError, CitationEvent, CitationOptions, CitationSource, CitationSourceBase, CitationSourceMedia, CitationSourceUrl, CitationStartEvent, CollectionResponse, CompletedContentPart, CompletedMessage, CompletedToolCall, ContentPart, ContentPartChunkEvent, ContentPartData, ContentPartEndEvent, ContentPartEvent, ContentPartGetResponse, ContentPartInterrupted, ContentPartStartEvent, ContentPartStartMetaData, ContentPartStream, ConversationAttachmentCreateResponse, ConversationAttachmentUploadResponse, ConversationCreateOptions, ConversationCreateResponse, ConversationDeleteResponse, ConversationEvent, ConversationExchangeServiceModel, ConversationGetAllOptions, ConversationGetResponse, ConversationJobStartOverrides, ConversationMethods, ConversationServiceModel, ConversationSessionMethods, ConversationSessionOptions, ConversationUpdateOptions, ConversationUpdateResponse, ConversationalAgentOptions, ConversationalAgentServiceModel, CreateFeedbackOptions, CustomKeyValuePair, ElementExecutionMetadata, ElementMetaData, ElementRunMetadata, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityDownloadAttachmentOptions, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ErrorEndEvent, ErrorEvent, ErrorStartEvent, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, Exchange, ExchangeEndEvent, ExchangeEvent, ExchangeGetAllOptions, ExchangeGetByIdOptions, ExchangeGetResponse, ExchangeServiceModel, ExchangeStartEvent, ExchangeStream, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, ExternalValue, FailureRecord, FeatureFlags, FeedbackCreateResponse, Field, FieldDataType, FieldMetaData, FileUploadAccess, FolderProperties, GenericInterruptStartEvent, GlobalVariableMetaData, HasPaginationOptions, Headers, HttpMethod, InlineOrExternalValue, InlineValue, Interrupt, InterruptEndEvent, InterruptEvent, InterruptStartEvent, JSONArray, JSONObject, JSONPrimitive, JSONValue, JobAttachment, JobError, LabelUpdatedEvent, Machine, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, MakeOptional, MakeRequired, Message, MessageEndEvent, MessageEvent, MessageGetResponse, MessageServiceModel, MessageStartEvent, MessageStream, MetaData, MetaEvent, NonPaginatedResponse, OAuthFields, OperationResponse, PaginatedResponse, PaginationCursor, PaginationMetadata, PaginationMethodUnion, PaginationOptions, PartialUiPathConfig, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetResponse, ProcessIncidentGetAllResponse, ProcessIncidentGetResponse, ProcessIncidentsServiceModel, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessMethods, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, QueryParams, QueueGetAllOptions, QueueGetByIdOptions, QueueGetResponse, QueueServiceModel, RawAgentGetByIdResponse, RawAgentGetResponse, RawCaseInstanceGetResponse, RawConversationGetResponse, RawEntityGetResponse, RawMaestroProcessGetAllResponse, RawProcessInstanceGetResponse, RawTaskCreateResponse, RawTaskGetResponse, RequestOptions, RequestSpec, ResponseDictionary, ResponseType, RetryOptions, RobotMetadata, SessionCapabilities, SessionEndEvent, SessionEndingEvent, SessionStartEvent, SessionStartedEvent, SessionStream, Simplify, SourceJoinCriteria, StageSLA, StageTask, Tag, TaskActivity, TaskAssignOptions, TaskAssignment, TaskAssignmentOptions, TaskAssignmentResponse, TaskBaseResponse, TaskCompleteOptions, TaskCompletionOptions, TaskCreateOptions, TaskCreateResponse, TaskGetAllOptions, TaskGetByIdOptions, TaskGetResponse, TaskGetUsersOptions, TaskMethods, TaskServiceModel, TaskSlaDetail, TaskSource, TasksUnassignOptions, TimeoutOptions, ToolCall, ToolCallConfirmationEndValue, ToolCallConfirmationInterruptStartEvent, ToolCallConfirmationValue, ToolCallEndEvent, ToolCallEvent, ToolCallInputValue, ToolCallOutputValue, ToolCallResult, ToolCallStartEvent, ToolCallStream, UiPathSDKConfig, UserLoginInfo, UserServiceModel, UserSettingsGetResponse, UserSettingsUpdateOptions, UserSettingsUpdateResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -4691,6 +4691,7 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
4691
4691
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4692
4692
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4693
4693
|
DOWNLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4694
|
+
UPLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4694
4695
|
},
|
|
4695
4696
|
CHOICESETS: {
|
|
4696
4697
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -5136,7 +5137,7 @@ function normalizeBaseUrl(url) {
|
|
|
5136
5137
|
// Connection string placeholder that will be replaced during build
|
|
5137
5138
|
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";
|
|
5138
5139
|
// SDK Version placeholder
|
|
5139
|
-
const SDK_VERSION = "1.1.
|
|
5140
|
+
const SDK_VERSION = "1.1.3";
|
|
5140
5141
|
const VERSION = "Version";
|
|
5141
5142
|
const SERVICE = "Service";
|
|
5142
5143
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -6018,8 +6019,13 @@ class ApiClient {
|
|
|
6018
6019
|
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
6019
6020
|
// Construct URL with org and tenant names
|
|
6020
6021
|
const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
|
|
6022
|
+
const isFormData = options.body instanceof FormData;
|
|
6023
|
+
const defaultHeaders = await this.getDefaultHeaders();
|
|
6024
|
+
if (isFormData) {
|
|
6025
|
+
delete defaultHeaders['Content-Type'];
|
|
6026
|
+
}
|
|
6021
6027
|
const headers = {
|
|
6022
|
-
...
|
|
6028
|
+
...defaultHeaders,
|
|
6023
6029
|
...options.headers
|
|
6024
6030
|
};
|
|
6025
6031
|
// Convert params to URLSearchParams
|
|
@@ -6030,11 +6036,15 @@ class ApiClient {
|
|
|
6030
6036
|
});
|
|
6031
6037
|
}
|
|
6032
6038
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
6039
|
+
let body = undefined;
|
|
6040
|
+
if (options.body) {
|
|
6041
|
+
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
6042
|
+
}
|
|
6033
6043
|
try {
|
|
6034
6044
|
const response = await fetch(fullUrl, {
|
|
6035
6045
|
method,
|
|
6036
6046
|
headers,
|
|
6037
|
-
body
|
|
6047
|
+
body,
|
|
6038
6048
|
signal: options.signal
|
|
6039
6049
|
});
|
|
6040
6050
|
if (!response.ok) {
|
|
@@ -7325,6 +7335,17 @@ function createEntityMethods(entityData, service) {
|
|
|
7325
7335
|
fieldName
|
|
7326
7336
|
});
|
|
7327
7337
|
},
|
|
7338
|
+
async uploadAttachment(recordId, fieldName, file, expansionLevel) {
|
|
7339
|
+
if (!entityData.name)
|
|
7340
|
+
throw new Error('Entity name is undefined');
|
|
7341
|
+
return service.uploadAttachment({
|
|
7342
|
+
entityName: entityData.name,
|
|
7343
|
+
recordId,
|
|
7344
|
+
fieldName,
|
|
7345
|
+
file,
|
|
7346
|
+
expansionLevel
|
|
7347
|
+
});
|
|
7348
|
+
},
|
|
7328
7349
|
async insert(data, options) {
|
|
7329
7350
|
return this.insertRecord(data, options);
|
|
7330
7351
|
},
|
|
@@ -7828,6 +7849,42 @@ class EntityService extends BaseService {
|
|
|
7828
7849
|
});
|
|
7829
7850
|
return response.data;
|
|
7830
7851
|
}
|
|
7852
|
+
/**
|
|
7853
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
7854
|
+
*
|
|
7855
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
7856
|
+
* @returns Promise resolving to the upload response
|
|
7857
|
+
*
|
|
7858
|
+
* @example
|
|
7859
|
+
* ```typescript
|
|
7860
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
7861
|
+
*
|
|
7862
|
+
* const entities = new Entities(sdk);
|
|
7863
|
+
*
|
|
7864
|
+
* // Upload a file attachment
|
|
7865
|
+
* const response = await entities.uploadAttachment({
|
|
7866
|
+
* entityName: 'Invoice',
|
|
7867
|
+
* recordId: '<record-uuid>',
|
|
7868
|
+
* fieldName: 'Documents',
|
|
7869
|
+
* file: file
|
|
7870
|
+
* });
|
|
7871
|
+
* ```
|
|
7872
|
+
*/
|
|
7873
|
+
async uploadAttachment(options) {
|
|
7874
|
+
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
7875
|
+
const formData = new FormData();
|
|
7876
|
+
if (file instanceof Uint8Array) {
|
|
7877
|
+
formData.append('file', new Blob([file.buffer]));
|
|
7878
|
+
}
|
|
7879
|
+
else {
|
|
7880
|
+
formData.append('file', file);
|
|
7881
|
+
}
|
|
7882
|
+
const params = createParams({ expansionLevel });
|
|
7883
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityName, recordId, fieldName), formData, { params });
|
|
7884
|
+
// Convert PascalCase response to camelCase
|
|
7885
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
7886
|
+
return camelResponse;
|
|
7887
|
+
}
|
|
7831
7888
|
/**
|
|
7832
7889
|
* @hidden
|
|
7833
7890
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -7961,6 +8018,9 @@ __decorate([
|
|
|
7961
8018
|
__decorate([
|
|
7962
8019
|
track('Entities.DownloadAttachment')
|
|
7963
8020
|
], EntityService.prototype, "downloadAttachment", null);
|
|
8021
|
+
__decorate([
|
|
8022
|
+
track('Entities.UploadAttachment')
|
|
8023
|
+
], EntityService.prototype, "uploadAttachment", null);
|
|
7964
8024
|
|
|
7965
8025
|
class ChoiceSetService extends BaseService {
|
|
7966
8026
|
/**
|
package/dist/index.umd.js
CHANGED
|
@@ -4695,6 +4695,7 @@
|
|
|
4695
4695
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4696
4696
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4697
4697
|
DOWNLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4698
|
+
UPLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
|
|
4698
4699
|
},
|
|
4699
4700
|
CHOICESETS: {
|
|
4700
4701
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -8895,7 +8896,7 @@
|
|
|
8895
8896
|
// Connection string placeholder that will be replaced during build
|
|
8896
8897
|
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";
|
|
8897
8898
|
// SDK Version placeholder
|
|
8898
|
-
const SDK_VERSION = "1.1.
|
|
8899
|
+
const SDK_VERSION = "1.1.3";
|
|
8899
8900
|
const VERSION = "Version";
|
|
8900
8901
|
const SERVICE = "Service";
|
|
8901
8902
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -9777,8 +9778,13 @@
|
|
|
9777
9778
|
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
9778
9779
|
// Construct URL with org and tenant names
|
|
9779
9780
|
const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
|
|
9781
|
+
const isFormData = options.body instanceof FormData;
|
|
9782
|
+
const defaultHeaders = await this.getDefaultHeaders();
|
|
9783
|
+
if (isFormData) {
|
|
9784
|
+
delete defaultHeaders['Content-Type'];
|
|
9785
|
+
}
|
|
9780
9786
|
const headers = {
|
|
9781
|
-
...
|
|
9787
|
+
...defaultHeaders,
|
|
9782
9788
|
...options.headers
|
|
9783
9789
|
};
|
|
9784
9790
|
// Convert params to URLSearchParams
|
|
@@ -9789,11 +9795,15 @@
|
|
|
9789
9795
|
});
|
|
9790
9796
|
}
|
|
9791
9797
|
const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
|
|
9798
|
+
let body = undefined;
|
|
9799
|
+
if (options.body) {
|
|
9800
|
+
body = isFormData ? options.body : JSON.stringify(options.body);
|
|
9801
|
+
}
|
|
9792
9802
|
try {
|
|
9793
9803
|
const response = await fetch(fullUrl, {
|
|
9794
9804
|
method,
|
|
9795
9805
|
headers,
|
|
9796
|
-
body
|
|
9806
|
+
body,
|
|
9797
9807
|
signal: options.signal
|
|
9798
9808
|
});
|
|
9799
9809
|
if (!response.ok) {
|
|
@@ -11084,6 +11094,17 @@
|
|
|
11084
11094
|
fieldName
|
|
11085
11095
|
});
|
|
11086
11096
|
},
|
|
11097
|
+
async uploadAttachment(recordId, fieldName, file, expansionLevel) {
|
|
11098
|
+
if (!entityData.name)
|
|
11099
|
+
throw new Error('Entity name is undefined');
|
|
11100
|
+
return service.uploadAttachment({
|
|
11101
|
+
entityName: entityData.name,
|
|
11102
|
+
recordId,
|
|
11103
|
+
fieldName,
|
|
11104
|
+
file,
|
|
11105
|
+
expansionLevel
|
|
11106
|
+
});
|
|
11107
|
+
},
|
|
11087
11108
|
async insert(data, options) {
|
|
11088
11109
|
return this.insertRecord(data, options);
|
|
11089
11110
|
},
|
|
@@ -11587,6 +11608,42 @@
|
|
|
11587
11608
|
});
|
|
11588
11609
|
return response.data;
|
|
11589
11610
|
}
|
|
11611
|
+
/**
|
|
11612
|
+
* Uploads an attachment to a File-type field of an entity record
|
|
11613
|
+
*
|
|
11614
|
+
* @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
|
|
11615
|
+
* @returns Promise resolving to the upload response
|
|
11616
|
+
*
|
|
11617
|
+
* @example
|
|
11618
|
+
* ```typescript
|
|
11619
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
11620
|
+
*
|
|
11621
|
+
* const entities = new Entities(sdk);
|
|
11622
|
+
*
|
|
11623
|
+
* // Upload a file attachment
|
|
11624
|
+
* const response = await entities.uploadAttachment({
|
|
11625
|
+
* entityName: 'Invoice',
|
|
11626
|
+
* recordId: '<record-uuid>',
|
|
11627
|
+
* fieldName: 'Documents',
|
|
11628
|
+
* file: file
|
|
11629
|
+
* });
|
|
11630
|
+
* ```
|
|
11631
|
+
*/
|
|
11632
|
+
async uploadAttachment(options) {
|
|
11633
|
+
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
11634
|
+
const formData = new FormData();
|
|
11635
|
+
if (file instanceof Uint8Array) {
|
|
11636
|
+
formData.append('file', new Blob([file.buffer]));
|
|
11637
|
+
}
|
|
11638
|
+
else {
|
|
11639
|
+
formData.append('file', file);
|
|
11640
|
+
}
|
|
11641
|
+
const params = createParams({ expansionLevel });
|
|
11642
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityName, recordId, fieldName), formData, { params });
|
|
11643
|
+
// Convert PascalCase response to camelCase
|
|
11644
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
11645
|
+
return camelResponse;
|
|
11646
|
+
}
|
|
11590
11647
|
/**
|
|
11591
11648
|
* @hidden
|
|
11592
11649
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -11720,6 +11777,9 @@
|
|
|
11720
11777
|
__decorate([
|
|
11721
11778
|
track('Entities.DownloadAttachment')
|
|
11722
11779
|
], EntityService.prototype, "downloadAttachment", null);
|
|
11780
|
+
__decorate([
|
|
11781
|
+
track('Entities.UploadAttachment')
|
|
11782
|
+
], EntityService.prototype, "uploadAttachment", null);
|
|
11723
11783
|
|
|
11724
11784
|
class ChoiceSetService extends BaseService {
|
|
11725
11785
|
/**
|