@uipath/uipath-typescript 1.3.2 → 1.3.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.
@@ -611,7 +611,11 @@ class ApiClient {
611
611
  const text = await response.text();
612
612
  return text;
613
613
  }
614
- return response.json();
614
+ const text = await response.text();
615
+ if (!text) {
616
+ return undefined;
617
+ }
618
+ return JSON.parse(text);
615
619
  }
616
620
  catch (error) {
617
621
  // If it's already one of our errors, re-throw it
@@ -1385,8 +1389,9 @@ class PaginationHelpers {
1385
1389
  });
1386
1390
  }
1387
1391
  // Extract and transform items from response
1388
- const rawItems = response.data?.[itemsField];
1389
- const totalCount = response.data?.[totalCountField];
1392
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1393
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1394
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1390
1395
  // Parse items - automatically handle JSON string responses
1391
1396
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1392
1397
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1637,7 +1642,7 @@ class BaseService {
1637
1642
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1638
1643
  // Prepare request parameters based on pagination type
1639
1644
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1640
- // For POST requests, merge pagination params into body; for GET, use query params
1645
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1641
1646
  if (method.toUpperCase() === 'POST') {
1642
1647
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1643
1648
  options.body = {
@@ -1645,6 +1650,7 @@ class BaseService {
1645
1650
  ...options.params,
1646
1651
  ...requestParams
1647
1652
  };
1653
+ options.params = undefined;
1648
1654
  }
1649
1655
  else {
1650
1656
  // Merge pagination parameters with existing parameters
@@ -1685,7 +1691,6 @@ class BaseService {
1685
1691
  if (params.pageNumber && params.pageNumber > 1) {
1686
1692
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1687
1693
  }
1688
- // Include total count for ODATA APIs
1689
1694
  {
1690
1695
  requestParams[countParam] = true;
1691
1696
  }
@@ -1713,8 +1718,9 @@ class BaseService {
1713
1718
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1714
1719
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1715
1720
  // Extract items and metadata
1716
- const items = response.data[itemsField] || [];
1717
- const totalCount = response.data[totalCountField];
1721
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1722
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1723
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1718
1724
  const continuationToken = response.data[continuationTokenField];
1719
1725
  // Determine if there are more pages
1720
1726
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -1827,7 +1833,7 @@ const MAESTRO_ENDPOINTS = {
1827
1833
  // Connection string placeholder that will be replaced during build
1828
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";
1829
1835
  // SDK Version placeholder
1830
- const SDK_VERSION = "1.3.2";
1836
+ const SDK_VERSION = "1.3.3";
1831
1837
  const VERSION = "Version";
1832
1838
  const SERVICE = "Service";
1833
1839
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2393,6 +2399,21 @@ const CASE_INSTANCE_TASK_FILTER = (caseInstanceId) => `Tags/any(tags:tags/Displa
2393
2399
  */
2394
2400
  const CASE_INSTANCE_TASK_EXPAND = 'AssignedToUser,Activities';
2395
2401
 
2402
+ var TaskUserType;
2403
+ (function (TaskUserType) {
2404
+ /** A user of this type is supposed to be used by a human. */
2405
+ TaskUserType["User"] = "User";
2406
+ /** A user of this type is automatically created when adding a robot, is associated with Robot role and it is used by a robot when communicating with Orchestrator. */
2407
+ TaskUserType["Robot"] = "Robot";
2408
+ /** A user of type Directory User */
2409
+ TaskUserType["DirectoryUser"] = "DirectoryUser";
2410
+ /** A user of type Directory Group */
2411
+ TaskUserType["DirectoryGroup"] = "DirectoryGroup";
2412
+ /** A user of type Directory Robot Account */
2413
+ TaskUserType["DirectoryRobot"] = "DirectoryRobot";
2414
+ /** A user of type Directory External Application */
2415
+ TaskUserType["DirectoryExternalApplication"] = "DirectoryExternalApplication";
2416
+ })(TaskUserType || (TaskUserType = {}));
2396
2417
  /**
2397
2418
  * Types of tasks available in Action Center.
2398
2419
  * Each type determines the task's behavior, UI rendering, and completion requirements.
@@ -2616,15 +2637,15 @@ class TaskService extends BaseService {
2616
2637
  return createTaskWithMethods(transformedData, this);
2617
2638
  }
2618
2639
  /**
2619
- * Gets users in the given folder who have Tasks.View and Tasks.Edit permissions
2640
+ * Gets task users (users, robots, groups etc) in the given folder who have Tasks.View and Tasks.Edit permissions
2620
2641
  *
2621
2642
  * The method returns either:
2622
- * - An array of users (when no pagination parameters are provided)
2643
+ * - An array of task users (when no pagination parameters are provided)
2623
2644
  * - A paginated result with navigation cursors (when any pagination parameter is provided)
2624
2645
  *
2625
- * @param folderId - The folder ID to get users from
2646
+ * @param folderId - The folder ID to get task users from
2626
2647
  * @param options - Optional query and pagination parameters
2627
- * @returns Promise resolving to an array of users or paginated result
2648
+ * @returns Promise resolving to an array of task users or paginated result
2628
2649
  *
2629
2650
  * @example
2630
2651
  * ```typescript
@@ -2635,7 +2656,7 @@ class TaskService extends BaseService {
2635
2656
  * // Standard array return
2636
2657
  * const users = await tasks.getUsers(123);
2637
2658
  *
2638
- * // Get users with filtering
2659
+ * // Get task users with filtering
2639
2660
  * const users = await tasks.getUsers(123, {
2640
2661
  * filter: "name eq 'abc'"
2641
2662
  * });
@@ -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.3.2";
54
+ const SDK_VERSION = "1.3.3";
55
55
  const VERSION = "Version";
56
56
  const SERVICE = "Service";
57
57
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -888,7 +888,11 @@ class ApiClient {
888
888
  const text = await response.text();
889
889
  return text;
890
890
  }
891
- return response.json();
891
+ const text = await response.text();
892
+ if (!text) {
893
+ return undefined;
894
+ }
895
+ return JSON.parse(text);
892
896
  }
893
897
  catch (error) {
894
898
  // If it's already one of our errors, re-throw it
@@ -1544,8 +1548,9 @@ class PaginationHelpers {
1544
1548
  });
1545
1549
  }
1546
1550
  // Extract and transform items from response
1547
- const rawItems = response.data?.[itemsField];
1548
- const totalCount = response.data?.[totalCountField];
1551
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1552
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1553
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1549
1554
  // Parse items - automatically handle JSON string responses
1550
1555
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1551
1556
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1796,7 +1801,7 @@ class BaseService {
1796
1801
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1797
1802
  // Prepare request parameters based on pagination type
1798
1803
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1799
- // For POST requests, merge pagination params into body; for GET, use query params
1804
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1800
1805
  if (method.toUpperCase() === 'POST') {
1801
1806
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1802
1807
  options.body = {
@@ -1804,6 +1809,7 @@ class BaseService {
1804
1809
  ...options.params,
1805
1810
  ...requestParams
1806
1811
  };
1812
+ options.params = undefined;
1807
1813
  }
1808
1814
  else {
1809
1815
  // Merge pagination parameters with existing parameters
@@ -1844,7 +1850,6 @@ class BaseService {
1844
1850
  if (params.pageNumber && params.pageNumber > 1) {
1845
1851
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1846
1852
  }
1847
- // Include total count for ODATA APIs
1848
1853
  {
1849
1854
  requestParams[countParam] = true;
1850
1855
  }
@@ -1872,8 +1877,9 @@ class BaseService {
1872
1877
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1873
1878
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1874
1879
  // Extract items and metadata
1875
- const items = response.data[itemsField] || [];
1876
- const totalCount = response.data[totalCountField];
1880
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1881
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1882
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1877
1883
  const continuationToken = response.data[continuationTokenField];
1878
1884
  // Determine if there are more pages
1879
1885
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -6310,6 +6316,21 @@ class ConversationService extends BaseService {
6310
6316
  onConnectionStatusChanged(handler) {
6311
6317
  return this._sessionManager.onConnectionStatusChanged(handler);
6312
6318
  }
6319
+ /**
6320
+ * Closes the WebSocket connection and releases all session resources.
6321
+ *
6322
+ * In Node.js the WebSocket keeps the event loop alive until disconnected,
6323
+ * so call this to allow the process to exit cleanly. In the browser the
6324
+ * runtime handles socket cleanup on page unload, so this is effectively a no-op.
6325
+ *
6326
+ * @example
6327
+ * ```typescript
6328
+ * conversationalAgent.conversations.disconnect();
6329
+ * ```
6330
+ */
6331
+ disconnect() {
6332
+ this._sessionManager.disconnect();
6333
+ }
6313
6334
  // ==================== Private Methods ====================
6314
6335
  _getEvents() {
6315
6336
  if (this._eventHelper === null) {
@@ -6345,6 +6366,9 @@ __decorate([
6345
6366
  __decorate([
6346
6367
  track('ConversationalAgent.Conversations.CreateAttachment')
6347
6368
  ], ConversationService.prototype, "getAttachmentUploadUri", null);
6369
+ __decorate([
6370
+ track('ConversationalAgent.Conversations.Disconnect')
6371
+ ], ConversationService.prototype, "disconnect", null);
6348
6372
 
6349
6373
  /**
6350
6374
  * MessageService - Message operations for Conversations
@@ -3941,6 +3941,19 @@ interface ConversationServiceModel {
3941
3941
  * @internal
3942
3942
  */
3943
3943
  onConnectionStatusChanged(handler: ConnectionStatusChangedHandler): () => void;
3944
+ /**
3945
+ * Closes the WebSocket connection and releases all session resources.
3946
+ *
3947
+ * In Node.js the WebSocket keeps the event loop alive until disconnected,
3948
+ * so call this to allow the process to exit cleanly. In the browser the
3949
+ * runtime handles socket cleanup on page unload, so this is effectively a no-op.
3950
+ *
3951
+ * @example
3952
+ * ```typescript
3953
+ * conversationalAgent.conversations.disconnect();
3954
+ * ```
3955
+ */
3956
+ disconnect(): void;
3944
3957
  }
3945
3958
  /**
3946
3959
  * Methods interface that will be added to conversation objects
@@ -6309,6 +6322,19 @@ declare class ConversationService extends BaseService implements ConversationSer
6309
6322
  * @returns Cleanup function to remove handler
6310
6323
  */
6311
6324
  onConnectionStatusChanged(handler: ConnectionStatusChangedHandler): () => void;
6325
+ /**
6326
+ * Closes the WebSocket connection and releases all session resources.
6327
+ *
6328
+ * In Node.js the WebSocket keeps the event loop alive until disconnected,
6329
+ * so call this to allow the process to exit cleanly. In the browser the
6330
+ * runtime handles socket cleanup on page unload, so this is effectively a no-op.
6331
+ *
6332
+ * @example
6333
+ * ```typescript
6334
+ * conversationalAgent.conversations.disconnect();
6335
+ * ```
6336
+ */
6337
+ disconnect(): void;
6312
6338
  private _getEvents;
6313
6339
  }
6314
6340
 
@@ -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.3.2";
52
+ const SDK_VERSION = "1.3.3";
53
53
  const VERSION = "Version";
54
54
  const SERVICE = "Service";
55
55
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -886,7 +886,11 @@ class ApiClient {
886
886
  const text = await response.text();
887
887
  return text;
888
888
  }
889
- return response.json();
889
+ const text = await response.text();
890
+ if (!text) {
891
+ return undefined;
892
+ }
893
+ return JSON.parse(text);
890
894
  }
891
895
  catch (error) {
892
896
  // If it's already one of our errors, re-throw it
@@ -1542,8 +1546,9 @@ class PaginationHelpers {
1542
1546
  });
1543
1547
  }
1544
1548
  // Extract and transform items from response
1545
- const rawItems = response.data?.[itemsField];
1546
- const totalCount = response.data?.[totalCountField];
1549
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1550
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1551
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1547
1552
  // Parse items - automatically handle JSON string responses
1548
1553
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1549
1554
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1794,7 +1799,7 @@ class BaseService {
1794
1799
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1795
1800
  // Prepare request parameters based on pagination type
1796
1801
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1797
- // For POST requests, merge pagination params into body; for GET, use query params
1802
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1798
1803
  if (method.toUpperCase() === 'POST') {
1799
1804
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1800
1805
  options.body = {
@@ -1802,6 +1807,7 @@ class BaseService {
1802
1807
  ...options.params,
1803
1808
  ...requestParams
1804
1809
  };
1810
+ options.params = undefined;
1805
1811
  }
1806
1812
  else {
1807
1813
  // Merge pagination parameters with existing parameters
@@ -1842,7 +1848,6 @@ class BaseService {
1842
1848
  if (params.pageNumber && params.pageNumber > 1) {
1843
1849
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1844
1850
  }
1845
- // Include total count for ODATA APIs
1846
1851
  {
1847
1852
  requestParams[countParam] = true;
1848
1853
  }
@@ -1870,8 +1875,9 @@ class BaseService {
1870
1875
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1871
1876
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1872
1877
  // Extract items and metadata
1873
- const items = response.data[itemsField] || [];
1874
- const totalCount = response.data[totalCountField];
1878
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1879
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1880
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1875
1881
  const continuationToken = response.data[continuationTokenField];
1876
1882
  // Determine if there are more pages
1877
1883
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -6308,6 +6314,21 @@ class ConversationService extends BaseService {
6308
6314
  onConnectionStatusChanged(handler) {
6309
6315
  return this._sessionManager.onConnectionStatusChanged(handler);
6310
6316
  }
6317
+ /**
6318
+ * Closes the WebSocket connection and releases all session resources.
6319
+ *
6320
+ * In Node.js the WebSocket keeps the event loop alive until disconnected,
6321
+ * so call this to allow the process to exit cleanly. In the browser the
6322
+ * runtime handles socket cleanup on page unload, so this is effectively a no-op.
6323
+ *
6324
+ * @example
6325
+ * ```typescript
6326
+ * conversationalAgent.conversations.disconnect();
6327
+ * ```
6328
+ */
6329
+ disconnect() {
6330
+ this._sessionManager.disconnect();
6331
+ }
6311
6332
  // ==================== Private Methods ====================
6312
6333
  _getEvents() {
6313
6334
  if (this._eventHelper === null) {
@@ -6343,6 +6364,9 @@ __decorate([
6343
6364
  __decorate([
6344
6365
  track('ConversationalAgent.Conversations.CreateAttachment')
6345
6366
  ], ConversationService.prototype, "getAttachmentUploadUri", null);
6367
+ __decorate([
6368
+ track('ConversationalAgent.Conversations.Disconnect')
6369
+ ], ConversationService.prototype, "disconnect", null);
6346
6370
 
6347
6371
  /**
6348
6372
  * MessageService - Message operations for Conversations
@@ -4366,6 +4366,21 @@ function getErrorDetails(error) {
4366
4366
  };
4367
4367
  }
4368
4368
 
4369
+ var TaskUserType;
4370
+ (function (TaskUserType) {
4371
+ /** A user of this type is supposed to be used by a human. */
4372
+ TaskUserType["User"] = "User";
4373
+ /** A user of this type is automatically created when adding a robot, is associated with Robot role and it is used by a robot when communicating with Orchestrator. */
4374
+ TaskUserType["Robot"] = "Robot";
4375
+ /** A user of type Directory User */
4376
+ TaskUserType["DirectoryUser"] = "DirectoryUser";
4377
+ /** A user of type Directory Group */
4378
+ TaskUserType["DirectoryGroup"] = "DirectoryGroup";
4379
+ /** A user of type Directory Robot Account */
4380
+ TaskUserType["DirectoryRobot"] = "DirectoryRobot";
4381
+ /** A user of type Directory External Application */
4382
+ TaskUserType["DirectoryExternalApplication"] = "DirectoryExternalApplication";
4383
+ })(TaskUserType || (TaskUserType = {}));
4369
4384
  /**
4370
4385
  * Types of tasks available in Action Center.
4371
4386
  * Each type determines the task's behavior, UI rendering, and completion requirements.
@@ -5280,7 +5295,7 @@ function normalizeBaseUrl(url) {
5280
5295
  // Connection string placeholder that will be replaced during build
5281
5296
  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";
5282
5297
  // SDK Version placeholder
5283
- const SDK_VERSION = "1.3.2";
5298
+ const SDK_VERSION = "1.3.3";
5284
5299
  const VERSION = "Version";
5285
5300
  const SERVICE = "Service";
5286
5301
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -519,7 +519,7 @@ declare const telemetryClient: TelemetryClient;
519
519
  * SDK Telemetry constants
520
520
  */
521
521
  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";
522
- declare const SDK_VERSION = "1.3.2";
522
+ declare const SDK_VERSION = "1.3.3";
523
523
  declare const VERSION = "Version";
524
524
  declare const SERVICE = "Service";
525
525
  declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -4364,6 +4364,21 @@ function getErrorDetails(error) {
4364
4364
  };
4365
4365
  }
4366
4366
 
4367
+ var TaskUserType;
4368
+ (function (TaskUserType) {
4369
+ /** A user of this type is supposed to be used by a human. */
4370
+ TaskUserType["User"] = "User";
4371
+ /** A user of this type is automatically created when adding a robot, is associated with Robot role and it is used by a robot when communicating with Orchestrator. */
4372
+ TaskUserType["Robot"] = "Robot";
4373
+ /** A user of type Directory User */
4374
+ TaskUserType["DirectoryUser"] = "DirectoryUser";
4375
+ /** A user of type Directory Group */
4376
+ TaskUserType["DirectoryGroup"] = "DirectoryGroup";
4377
+ /** A user of type Directory Robot Account */
4378
+ TaskUserType["DirectoryRobot"] = "DirectoryRobot";
4379
+ /** A user of type Directory External Application */
4380
+ TaskUserType["DirectoryExternalApplication"] = "DirectoryExternalApplication";
4381
+ })(TaskUserType || (TaskUserType = {}));
4367
4382
  /**
4368
4383
  * Types of tasks available in Action Center.
4369
4384
  * Each type determines the task's behavior, UI rendering, and completion requirements.
@@ -5278,7 +5293,7 @@ function normalizeBaseUrl(url) {
5278
5293
  // Connection string placeholder that will be replaced during build
5279
5294
  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";
5280
5295
  // SDK Version placeholder
5281
- const SDK_VERSION = "1.3.2";
5296
+ const SDK_VERSION = "1.3.3";
5282
5297
  const VERSION = "Version";
5283
5298
  const SERVICE = "Service";
5284
5299
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -600,7 +600,11 @@ class ApiClient {
600
600
  const text = await response.text();
601
601
  return text;
602
602
  }
603
- return response.json();
603
+ const text = await response.text();
604
+ if (!text) {
605
+ return undefined;
606
+ }
607
+ return JSON.parse(text);
604
608
  }
605
609
  catch (error) {
606
610
  // If it's already one of our errors, re-throw it
@@ -1253,8 +1257,9 @@ class PaginationHelpers {
1253
1257
  });
1254
1258
  }
1255
1259
  // Extract and transform items from response
1256
- const rawItems = response.data?.[itemsField];
1257
- const totalCount = response.data?.[totalCountField];
1260
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1261
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1262
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1258
1263
  // Parse items - automatically handle JSON string responses
1259
1264
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1260
1265
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1505,7 +1510,7 @@ class BaseService {
1505
1510
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1506
1511
  // Prepare request parameters based on pagination type
1507
1512
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1508
- // For POST requests, merge pagination params into body; for GET, use query params
1513
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1509
1514
  if (method.toUpperCase() === 'POST') {
1510
1515
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1511
1516
  options.body = {
@@ -1513,6 +1518,7 @@ class BaseService {
1513
1518
  ...options.params,
1514
1519
  ...requestParams
1515
1520
  };
1521
+ options.params = undefined;
1516
1522
  }
1517
1523
  else {
1518
1524
  // Merge pagination parameters with existing parameters
@@ -1553,7 +1559,6 @@ class BaseService {
1553
1559
  if (params.pageNumber && params.pageNumber > 1) {
1554
1560
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1555
1561
  }
1556
- // Include total count for ODATA APIs
1557
1562
  {
1558
1563
  requestParams[countParam] = true;
1559
1564
  }
@@ -1581,8 +1586,9 @@ class BaseService {
1581
1586
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1582
1587
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1583
1588
  // Extract items and metadata
1584
- const items = response.data[itemsField] || [];
1585
- const totalCount = response.data[totalCountField];
1589
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1590
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1591
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1586
1592
  const continuationToken = response.data[continuationTokenField];
1587
1593
  // Determine if there are more pages
1588
1594
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -1994,7 +2000,7 @@ const EntityFieldTypeMap = {
1994
2000
  // Connection string placeholder that will be replaced during build
1995
2001
  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";
1996
2002
  // SDK Version placeholder
1997
- const SDK_VERSION = "1.3.2";
2003
+ const SDK_VERSION = "1.3.3";
1998
2004
  const VERSION = "Version";
1999
2005
  const SERVICE = "Service";
2000
2006
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -598,7 +598,11 @@ class ApiClient {
598
598
  const text = await response.text();
599
599
  return text;
600
600
  }
601
- return response.json();
601
+ const text = await response.text();
602
+ if (!text) {
603
+ return undefined;
604
+ }
605
+ return JSON.parse(text);
602
606
  }
603
607
  catch (error) {
604
608
  // If it's already one of our errors, re-throw it
@@ -1251,8 +1255,9 @@ class PaginationHelpers {
1251
1255
  });
1252
1256
  }
1253
1257
  // Extract and transform items from response
1254
- const rawItems = response.data?.[itemsField];
1255
- const totalCount = response.data?.[totalCountField];
1258
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1259
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1260
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1256
1261
  // Parse items - automatically handle JSON string responses
1257
1262
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1258
1263
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1503,7 +1508,7 @@ class BaseService {
1503
1508
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1504
1509
  // Prepare request parameters based on pagination type
1505
1510
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1506
- // For POST requests, merge pagination params into body; for GET, use query params
1511
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1507
1512
  if (method.toUpperCase() === 'POST') {
1508
1513
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1509
1514
  options.body = {
@@ -1511,6 +1516,7 @@ class BaseService {
1511
1516
  ...options.params,
1512
1517
  ...requestParams
1513
1518
  };
1519
+ options.params = undefined;
1514
1520
  }
1515
1521
  else {
1516
1522
  // Merge pagination parameters with existing parameters
@@ -1551,7 +1557,6 @@ class BaseService {
1551
1557
  if (params.pageNumber && params.pageNumber > 1) {
1552
1558
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1553
1559
  }
1554
- // Include total count for ODATA APIs
1555
1560
  {
1556
1561
  requestParams[countParam] = true;
1557
1562
  }
@@ -1579,8 +1584,9 @@ class BaseService {
1579
1584
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1580
1585
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1581
1586
  // Extract items and metadata
1582
- const items = response.data[itemsField] || [];
1583
- const totalCount = response.data[totalCountField];
1587
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1588
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1589
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1584
1590
  const continuationToken = response.data[continuationTokenField];
1585
1591
  // Determine if there are more pages
1586
1592
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -1992,7 +1998,7 @@ const EntityFieldTypeMap = {
1992
1998
  // Connection string placeholder that will be replaced during build
1993
1999
  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";
1994
2000
  // SDK Version placeholder
1995
- const SDK_VERSION = "1.3.2";
2001
+ const SDK_VERSION = "1.3.3";
1996
2002
  const VERSION = "Version";
1997
2003
  const SERVICE = "Service";
1998
2004
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";