@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.
@@ -562,8 +562,13 @@ class ApiClient {
562
562
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
563
563
  // Construct URL with org and tenant names
564
564
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
565
+ const isFormData = options.body instanceof FormData;
566
+ const defaultHeaders = await this.getDefaultHeaders();
567
+ if (isFormData) {
568
+ delete defaultHeaders['Content-Type'];
569
+ }
565
570
  const headers = {
566
- ...await this.getDefaultHeaders(),
571
+ ...defaultHeaders,
567
572
  ...options.headers
568
573
  };
569
574
  // Convert params to URLSearchParams
@@ -574,11 +579,15 @@ class ApiClient {
574
579
  });
575
580
  }
576
581
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
582
+ let body = undefined;
583
+ if (options.body) {
584
+ body = isFormData ? options.body : JSON.stringify(options.body);
585
+ }
577
586
  try {
578
587
  const response = await fetch(fullUrl, {
579
588
  method,
580
589
  headers,
581
- body: options.body ? JSON.stringify(options.body) : undefined,
590
+ body,
582
591
  signal: options.signal
583
592
  });
584
593
  if (!response.ok) {
@@ -1669,7 +1678,7 @@ const AssetMap = {
1669
1678
  // Connection string placeholder that will be replaced during build
1670
1679
  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";
1671
1680
  // SDK Version placeholder
1672
- const SDK_VERSION = "1.1.2";
1681
+ const SDK_VERSION = "1.1.3";
1673
1682
  const VERSION = "Version";
1674
1683
  const SERVICE = "Service";
1675
1684
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -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
- ...await this.getDefaultHeaders(),
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: options.body ? JSON.stringify(options.body) : undefined,
588
+ body,
580
589
  signal: options.signal
581
590
  });
582
591
  if (!response.ok) {
@@ -1667,7 +1676,7 @@ const AssetMap = {
1667
1676
  // Connection string placeholder that will be replaced during build
1668
1677
  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";
1669
1678
  // SDK Version placeholder
1670
- const SDK_VERSION = "1.1.2";
1679
+ const SDK_VERSION = "1.1.3";
1671
1680
  const VERSION = "Version";
1672
1681
  const SERVICE = "Service";
1673
1682
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -562,8 +562,13 @@ class ApiClient {
562
562
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
563
563
  // Construct URL with org and tenant names
564
564
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
565
+ const isFormData = options.body instanceof FormData;
566
+ const defaultHeaders = await this.getDefaultHeaders();
567
+ if (isFormData) {
568
+ delete defaultHeaders['Content-Type'];
569
+ }
565
570
  const headers = {
566
- ...await this.getDefaultHeaders(),
571
+ ...defaultHeaders,
567
572
  ...options.headers
568
573
  };
569
574
  // Convert params to URLSearchParams
@@ -574,11 +579,15 @@ class ApiClient {
574
579
  });
575
580
  }
576
581
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
582
+ let body = undefined;
583
+ if (options.body) {
584
+ body = isFormData ? options.body : JSON.stringify(options.body);
585
+ }
577
586
  try {
578
587
  const response = await fetch(fullUrl, {
579
588
  method,
580
589
  headers,
581
- body: options.body ? JSON.stringify(options.body) : undefined,
590
+ body,
582
591
  signal: options.signal
583
592
  });
584
593
  if (!response.ok) {
@@ -1716,7 +1725,7 @@ const BucketMap = {
1716
1725
  // Connection string placeholder that will be replaced during build
1717
1726
  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";
1718
1727
  // SDK Version placeholder
1719
- const SDK_VERSION = "1.1.2";
1728
+ const SDK_VERSION = "1.1.3";
1720
1729
  const VERSION = "Version";
1721
1730
  const SERVICE = "Service";
1722
1731
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -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
- ...await this.getDefaultHeaders(),
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: options.body ? JSON.stringify(options.body) : undefined,
588
+ body,
580
589
  signal: options.signal
581
590
  });
582
591
  if (!response.ok) {
@@ -1714,7 +1723,7 @@ const BucketMap = {
1714
1723
  // Connection string placeholder that will be replaced during build
1715
1724
  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";
1716
1725
  // SDK Version placeholder
1717
- const SDK_VERSION = "1.1.2";
1726
+ const SDK_VERSION = "1.1.3";
1718
1727
  const VERSION = "Version";
1719
1728
  const SERVICE = "Service";
1720
1729
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -575,8 +575,13 @@ class ApiClient {
575
575
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
576
576
  // Construct URL with org and tenant names
577
577
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
578
+ const isFormData = options.body instanceof FormData;
579
+ const defaultHeaders = await this.getDefaultHeaders();
580
+ if (isFormData) {
581
+ delete defaultHeaders['Content-Type'];
582
+ }
578
583
  const headers = {
579
- ...await this.getDefaultHeaders(),
584
+ ...defaultHeaders,
580
585
  ...options.headers
581
586
  };
582
587
  // Convert params to URLSearchParams
@@ -587,11 +592,15 @@ class ApiClient {
587
592
  });
588
593
  }
589
594
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
595
+ let body = undefined;
596
+ if (options.body) {
597
+ body = isFormData ? options.body : JSON.stringify(options.body);
598
+ }
590
599
  try {
591
600
  const response = await fetch(fullUrl, {
592
601
  method,
593
602
  headers,
594
- body: options.body ? JSON.stringify(options.body) : undefined,
603
+ body,
595
604
  signal: options.signal
596
605
  });
597
606
  if (!response.ok) {
@@ -1824,7 +1833,7 @@ const MAESTRO_ENDPOINTS = {
1824
1833
  // Connection string placeholder that will be replaced during build
1825
1834
  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";
1826
1835
  // SDK Version placeholder
1827
- const SDK_VERSION = "1.1.2";
1836
+ const SDK_VERSION = "1.1.3";
1828
1837
  const VERSION = "Version";
1829
1838
  const SERVICE = "Service";
1830
1839
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -573,8 +573,13 @@ class ApiClient {
573
573
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
574
574
  // Construct URL with org and tenant names
575
575
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
576
+ const isFormData = options.body instanceof FormData;
577
+ const defaultHeaders = await this.getDefaultHeaders();
578
+ if (isFormData) {
579
+ delete defaultHeaders['Content-Type'];
580
+ }
576
581
  const headers = {
577
- ...await this.getDefaultHeaders(),
582
+ ...defaultHeaders,
578
583
  ...options.headers
579
584
  };
580
585
  // Convert params to URLSearchParams
@@ -585,11 +590,15 @@ class ApiClient {
585
590
  });
586
591
  }
587
592
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
593
+ let body = undefined;
594
+ if (options.body) {
595
+ body = isFormData ? options.body : JSON.stringify(options.body);
596
+ }
588
597
  try {
589
598
  const response = await fetch(fullUrl, {
590
599
  method,
591
600
  headers,
592
- body: options.body ? JSON.stringify(options.body) : undefined,
601
+ body,
593
602
  signal: options.signal
594
603
  });
595
604
  if (!response.ok) {
@@ -1822,7 +1831,7 @@ const MAESTRO_ENDPOINTS = {
1822
1831
  // Connection string placeholder that will be replaced during build
1823
1832
  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";
1824
1833
  // SDK Version placeholder
1825
- const SDK_VERSION = "1.1.2";
1834
+ const SDK_VERSION = "1.1.3";
1826
1835
  const VERSION = "Version";
1827
1836
  const SERVICE = "Service";
1828
1837
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -51,7 +51,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
51
51
  // Connection string placeholder that will be replaced during build
52
52
  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";
53
53
  // SDK Version placeholder
54
- const SDK_VERSION = "1.1.2";
54
+ const SDK_VERSION = "1.1.3";
55
55
  const VERSION = "Version";
56
56
  const SERVICE = "Service";
57
57
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -845,8 +845,13 @@ class ApiClient {
845
845
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
846
846
  // Construct URL with org and tenant names
847
847
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
848
+ const isFormData = options.body instanceof FormData;
849
+ const defaultHeaders = await this.getDefaultHeaders();
850
+ if (isFormData) {
851
+ delete defaultHeaders['Content-Type'];
852
+ }
848
853
  const headers = {
849
- ...await this.getDefaultHeaders(),
854
+ ...defaultHeaders,
850
855
  ...options.headers
851
856
  };
852
857
  // Convert params to URLSearchParams
@@ -857,11 +862,15 @@ class ApiClient {
857
862
  });
858
863
  }
859
864
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
865
+ let body = undefined;
866
+ if (options.body) {
867
+ body = isFormData ? options.body : JSON.stringify(options.body);
868
+ }
860
869
  try {
861
870
  const response = await fetch(fullUrl, {
862
871
  method,
863
872
  headers,
864
- body: options.body ? JSON.stringify(options.body) : undefined,
873
+ body,
865
874
  signal: options.signal
866
875
  });
867
876
  if (!response.ok) {
@@ -49,7 +49,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
49
49
  // Connection string placeholder that will be replaced during build
50
50
  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";
51
51
  // SDK Version placeholder
52
- const SDK_VERSION = "1.1.2";
52
+ const SDK_VERSION = "1.1.3";
53
53
  const VERSION = "Version";
54
54
  const SERVICE = "Service";
55
55
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -843,8 +843,13 @@ class ApiClient {
843
843
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
844
844
  // Construct URL with org and tenant names
845
845
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
846
+ const isFormData = options.body instanceof FormData;
847
+ const defaultHeaders = await this.getDefaultHeaders();
848
+ if (isFormData) {
849
+ delete defaultHeaders['Content-Type'];
850
+ }
846
851
  const headers = {
847
- ...await this.getDefaultHeaders(),
852
+ ...defaultHeaders,
848
853
  ...options.headers
849
854
  };
850
855
  // Convert params to URLSearchParams
@@ -855,11 +860,15 @@ class ApiClient {
855
860
  });
856
861
  }
857
862
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
863
+ let body = undefined;
864
+ if (options.body) {
865
+ body = isFormData ? options.body : JSON.stringify(options.body);
866
+ }
858
867
  try {
859
868
  const response = await fetch(fullUrl, {
860
869
  method,
861
870
  headers,
862
- body: options.body ? JSON.stringify(options.body) : undefined,
871
+ body,
863
872
  signal: options.signal
864
873
  });
865
874
  if (!response.ok) {
@@ -5001,7 +5001,7 @@ function normalizeBaseUrl(url) {
5001
5001
  // Connection string placeholder that will be replaced during build
5002
5002
  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";
5003
5003
  // SDK Version placeholder
5004
- const SDK_VERSION = "1.1.2";
5004
+ const SDK_VERSION = "1.1.3";
5005
5005
  const VERSION = "Version";
5006
5006
  const SERVICE = "Service";
5007
5007
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -495,7 +495,7 @@ declare const telemetryClient: TelemetryClient;
495
495
  * SDK Telemetry constants
496
496
  */
497
497
  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";
498
- declare const SDK_VERSION = "1.1.2";
498
+ declare const SDK_VERSION = "1.1.3";
499
499
  declare const VERSION = "Version";
500
500
  declare const SERVICE = "Service";
501
501
  declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -4999,7 +4999,7 @@ function normalizeBaseUrl(url) {
4999
4999
  // Connection string placeholder that will be replaced during build
5000
5000
  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";
5001
5001
  // SDK Version placeholder
5002
- const SDK_VERSION = "1.1.2";
5002
+ const SDK_VERSION = "1.1.3";
5003
5003
  const VERSION = "Version";
5004
5004
  const SERVICE = "Service";
5005
5005
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -562,8 +562,13 @@ class ApiClient {
562
562
  const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
563
563
  // Construct URL with org and tenant names
564
564
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
565
+ const isFormData = options.body instanceof FormData;
566
+ const defaultHeaders = await this.getDefaultHeaders();
567
+ if (isFormData) {
568
+ delete defaultHeaders['Content-Type'];
569
+ }
565
570
  const headers = {
566
- ...await this.getDefaultHeaders(),
571
+ ...defaultHeaders,
567
572
  ...options.headers
568
573
  };
569
574
  // Convert params to URLSearchParams
@@ -574,11 +579,15 @@ class ApiClient {
574
579
  });
575
580
  }
576
581
  const fullUrl = searchParams.toString() ? `${url}?${searchParams.toString()}` : url;
582
+ let body = undefined;
583
+ if (options.body) {
584
+ body = isFormData ? options.body : JSON.stringify(options.body);
585
+ }
577
586
  try {
578
587
  const response = await fetch(fullUrl, {
579
588
  method,
580
589
  headers,
581
- body: options.body ? JSON.stringify(options.body) : undefined,
590
+ body,
582
591
  signal: options.signal
583
592
  });
584
593
  if (!response.ok) {
@@ -1674,6 +1683,17 @@ function createEntityMethods(entityData, service) {
1674
1683
  fieldName
1675
1684
  });
1676
1685
  },
1686
+ async uploadAttachment(recordId, fieldName, file, expansionLevel) {
1687
+ if (!entityData.name)
1688
+ throw new Error('Entity name is undefined');
1689
+ return service.uploadAttachment({
1690
+ entityName: entityData.name,
1691
+ recordId,
1692
+ fieldName,
1693
+ file,
1694
+ expansionLevel
1695
+ });
1696
+ },
1677
1697
  async insert(data, options) {
1678
1698
  return this.insertRecord(data, options);
1679
1699
  },
@@ -1725,6 +1745,7 @@ const DATA_FABRIC_ENDPOINTS = {
1725
1745
  UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
1726
1746
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
1727
1747
  DOWNLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
1748
+ UPLOAD_ATTACHMENT: (entityName, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/${entityName}/${recordId}/${fieldName}`,
1728
1749
  },
1729
1750
  CHOICESETS: {
1730
1751
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
@@ -1881,7 +1902,7 @@ const EntityFieldTypeMap = {
1881
1902
  // Connection string placeholder that will be replaced during build
1882
1903
  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
1904
  // SDK Version placeholder
1884
- const SDK_VERSION = "1.1.2";
1905
+ const SDK_VERSION = "1.1.3";
1885
1906
  const VERSION = "Version";
1886
1907
  const SERVICE = "Service";
1887
1908
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2480,6 +2501,42 @@ class EntityService extends BaseService {
2480
2501
  });
2481
2502
  return response.data;
2482
2503
  }
2504
+ /**
2505
+ * Uploads an attachment to a File-type field of an entity record
2506
+ *
2507
+ * @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
2508
+ * @returns Promise resolving to the upload response
2509
+ *
2510
+ * @example
2511
+ * ```typescript
2512
+ * import { Entities } from '@uipath/uipath-typescript/entities';
2513
+ *
2514
+ * const entities = new Entities(sdk);
2515
+ *
2516
+ * // Upload a file attachment
2517
+ * const response = await entities.uploadAttachment({
2518
+ * entityName: 'Invoice',
2519
+ * recordId: '<record-uuid>',
2520
+ * fieldName: 'Documents',
2521
+ * file: file
2522
+ * });
2523
+ * ```
2524
+ */
2525
+ async uploadAttachment(options) {
2526
+ const { entityName, recordId, fieldName, file, expansionLevel } = options;
2527
+ const formData = new FormData();
2528
+ if (file instanceof Uint8Array) {
2529
+ formData.append('file', new Blob([file.buffer]));
2530
+ }
2531
+ else {
2532
+ formData.append('file', file);
2533
+ }
2534
+ const params = createParams({ expansionLevel });
2535
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityName, recordId, fieldName), formData, { params });
2536
+ // Convert PascalCase response to camelCase
2537
+ const camelResponse = pascalToCamelCaseKeys(response.data);
2538
+ return camelResponse;
2539
+ }
2483
2540
  /**
2484
2541
  * @hidden
2485
2542
  * @deprecated Use {@link getAllRecords} instead.
@@ -2613,6 +2670,9 @@ __decorate([
2613
2670
  __decorate([
2614
2671
  track('Entities.DownloadAttachment')
2615
2672
  ], EntityService.prototype, "downloadAttachment", null);
2673
+ __decorate([
2674
+ track('Entities.UploadAttachment')
2675
+ ], EntityService.prototype, "uploadAttachment", null);
2616
2676
 
2617
2677
  class ChoiceSetService extends BaseService {
2618
2678
  /**
@@ -400,6 +400,31 @@ interface EntityDownloadAttachmentOptions {
400
400
  /** Field name containing the attachment */
401
401
  fieldName: string;
402
402
  }
403
+ /**
404
+ * Options for uploading an attachment to an entity record
405
+ */
406
+ 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
+ /** Optional expansion level (default: 0) */
422
+ expansionLevel?: number;
423
+ }
424
+ /**
425
+ * Response from uploading an attachment to an entity record
426
+ */
427
+ type EntityUploadAttachmentResponse = Record<string, unknown>;
403
428
  /**
404
429
  * Represents a failure record in an entity operation
405
430
  */
@@ -920,6 +945,42 @@ interface EntityServiceModel {
920
945
  * ```
921
946
  */
922
947
  downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
948
+ /**
949
+ * Uploads an attachment to a File-type field of an entity record.
950
+ *
951
+ * Uses multipart/form-data to upload the file content to the specified field.
952
+ *
953
+ * @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
954
+ * @returns Promise resolving to the upload response
955
+ * {@link EntityUploadAttachmentResponse}
956
+ * @example
957
+ * ```typescript
958
+ * import { Entities } from '@uipath/uipath-typescript/entities';
959
+ *
960
+ * const entities = new Entities(sdk);
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({
966
+ * entityName: 'Invoice',
967
+ * recordId: '<recordId>',
968
+ * fieldName: 'Documents',
969
+ * file: file
970
+ * });
971
+ *
972
+ * // Node.js: Upload a file from disk
973
+ * const fileBuffer = fs.readFileSync('document.pdf');
974
+ * const blob = new Blob([fileBuffer], { type: 'application/pdf' });
975
+ * const response = await entities.uploadAttachment({
976
+ * entityName: 'Invoice',
977
+ * recordId: '<recordId>',
978
+ * fieldName: 'Documents',
979
+ * file: blob
980
+ * });
981
+ * ```
982
+ */
983
+ uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
923
984
  }
924
985
  /**
925
986
  * Entity methods interface - defines operations that can be performed on an entity
@@ -987,6 +1048,16 @@ interface EntityMethods {
987
1048
  * @returns Promise resolving to Blob containing the file content
988
1049
  */
989
1050
  downloadAttachment(recordId: string, fieldName: string): Promise<Blob>;
1051
+ /**
1052
+ * Uploads an attachment to a File-type field of an entity record
1053
+ *
1054
+ * @param recordId - UUID of the record to upload the attachment to
1055
+ * @param fieldName - Name of the File-type field
1056
+ * @param file - File to upload (Blob, File, or Uint8Array)
1057
+ * @param expansionLevel - Optional expansion level (default: 0)
1058
+ * @returns Promise resolving to the upload response
1059
+ */
1060
+ uploadAttachment(recordId: string, fieldName: string, file: Blob | File | Uint8Array, expansionLevel?: number): Promise<EntityUploadAttachmentResponse>;
990
1061
  /**
991
1062
  * @deprecated Use {@link insertRecord} instead.
992
1063
  * @hidden
@@ -1259,6 +1330,28 @@ declare class EntityService extends BaseService implements EntityServiceModel {
1259
1330
  * });
1260
1331
  */
1261
1332
  downloadAttachment(options: EntityDownloadAttachmentOptions): Promise<Blob>;
1333
+ /**
1334
+ * Uploads an attachment to a File-type field of an entity record
1335
+ *
1336
+ * @param options - Options containing entityName, recordId, fieldName, file, and optional expansionLevel
1337
+ * @returns Promise resolving to the upload response
1338
+ *
1339
+ * @example
1340
+ * ```typescript
1341
+ * import { Entities } from '@uipath/uipath-typescript/entities';
1342
+ *
1343
+ * const entities = new Entities(sdk);
1344
+ *
1345
+ * // Upload a file attachment
1346
+ * const response = await entities.uploadAttachment({
1347
+ * entityName: 'Invoice',
1348
+ * recordId: '<record-uuid>',
1349
+ * fieldName: 'Documents',
1350
+ * file: file
1351
+ * });
1352
+ * ```
1353
+ */
1354
+ uploadAttachment(options: EntityUploadAttachmentOptions): Promise<EntityUploadAttachmentResponse>;
1262
1355
  /**
1263
1356
  * @hidden
1264
1357
  * @deprecated Use {@link getAllRecords} instead.
@@ -1510,4 +1603,4 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
1510
1603
  }
1511
1604
 
1512
1605
  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, EntityDownloadAttachmentOptions, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordsOptions, EntityUpdateResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };
1606
+ export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityDownloadAttachmentOptions, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria };