@uipath/uipath-typescript 1.3.6 → 1.3.8
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 +243 -6
- package/dist/assets/index.d.ts +113 -13
- package/dist/assets/index.mjs +243 -6
- package/dist/attachments/index.cjs +42 -6
- package/dist/attachments/index.d.ts +8 -0
- package/dist/attachments/index.mjs +42 -6
- package/dist/buckets/index.cjs +211 -6
- package/dist/buckets/index.d.ts +57 -12
- package/dist/buckets/index.mjs +211 -6
- package/dist/cases/index.cjs +180 -6
- package/dist/cases/index.d.ts +165 -3
- package/dist/cases/index.mjs +181 -7
- package/dist/conversational-agent/index.cjs +235 -85
- package/dist/conversational-agent/index.d.ts +327 -80
- package/dist/conversational-agent/index.mjs +234 -84
- package/dist/core/index.cjs +18 -6
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +18 -6
- package/dist/entities/index.cjs +74 -10
- package/dist/entities/index.d.ts +102 -11
- package/dist/entities/index.mjs +75 -11
- package/dist/feedback/index.cjs +293 -10
- package/dist/feedback/index.d.ts +425 -12
- package/dist/feedback/index.mjs +293 -10
- package/dist/index.cjs +463 -17
- package/dist/index.d.ts +885 -39
- package/dist/index.mjs +464 -18
- package/dist/index.umd.js +463 -17
- package/dist/jobs/index.cjs +211 -6
- package/dist/jobs/index.d.ts +68 -23
- package/dist/jobs/index.mjs +211 -6
- package/dist/maestro-processes/index.cjs +79 -6
- package/dist/maestro-processes/index.d.ts +8 -0
- package/dist/maestro-processes/index.mjs +79 -6
- package/dist/processes/index.cjs +279 -7
- package/dist/processes/index.d.ts +125 -2
- package/dist/processes/index.mjs +279 -7
- package/dist/queues/index.cjs +211 -6
- package/dist/queues/index.d.ts +57 -12
- package/dist/queues/index.mjs +211 -6
- package/dist/tasks/index.cjs +42 -6
- package/dist/tasks/index.d.ts +8 -0
- package/dist/tasks/index.mjs +42 -6
- package/package.json +1 -1
package/dist/core/index.mjs
CHANGED
|
@@ -5305,7 +5305,7 @@ function normalizeBaseUrl(url) {
|
|
|
5305
5305
|
// Connection string placeholder that will be replaced during build
|
|
5306
5306
|
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";
|
|
5307
5307
|
// SDK Version placeholder
|
|
5308
|
-
const SDK_VERSION = "1.3.
|
|
5308
|
+
const SDK_VERSION = "1.3.8";
|
|
5309
5309
|
const VERSION = "Version";
|
|
5310
5310
|
const SERVICE = "Service";
|
|
5311
5311
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5652,6 +5652,8 @@ var UiPathMetaTags;
|
|
|
5652
5652
|
// Asset resolution and routing
|
|
5653
5653
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
5654
5654
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
5655
|
+
// Folder context (injected during coded-app deployment)
|
|
5656
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
5655
5657
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
5656
5658
|
|
|
5657
5659
|
/**
|
|
@@ -5680,12 +5682,13 @@ function loadFromMetaTags() {
|
|
|
5680
5682
|
tenantName: getMetaTagContent(UiPathMetaTags.TENANT_NAME),
|
|
5681
5683
|
baseUrl: getMetaTagContent(UiPathMetaTags.BASE_URL),
|
|
5682
5684
|
redirectUri: getMetaTagContent(UiPathMetaTags.REDIRECT_URI),
|
|
5685
|
+
folderKey: getMetaTagContent(UiPathMetaTags.FOLDER_KEY),
|
|
5683
5686
|
};
|
|
5684
5687
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
5685
5688
|
return hasAnyValue ? config : null;
|
|
5686
5689
|
}
|
|
5687
5690
|
|
|
5688
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5691
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5689
5692
|
/**
|
|
5690
5693
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
5691
5694
|
*
|
|
@@ -5726,8 +5729,13 @@ class UiPath {
|
|
|
5726
5729
|
_UiPath_initialized.set(this, false);
|
|
5727
5730
|
_UiPath_partialConfig.set(this, void 0);
|
|
5728
5731
|
_UiPath_multiLogin.set(this, false);
|
|
5732
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
5733
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
5734
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
5735
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
5729
5736
|
// Load configuration from meta tags
|
|
5730
5737
|
const configFromMetaTags = loadFromMetaTags();
|
|
5738
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5731
5739
|
// Merge configuration: constructor config overrides meta tags
|
|
5732
5740
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
5733
5741
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -5856,7 +5864,7 @@ class UiPath {
|
|
|
5856
5864
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5857
5865
|
}
|
|
5858
5866
|
}
|
|
5859
|
-
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
5867
|
+
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_metaFolderKey = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
5860
5868
|
// Validate and normalize the configuration
|
|
5861
5869
|
validateConfig(config);
|
|
5862
5870
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -5869,7 +5877,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
5869
5877
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
5870
5878
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
5871
5879
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
5872
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
5880
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
5873
5881
|
});
|
|
5874
5882
|
const executionContext = new ExecutionContext();
|
|
5875
5883
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -5877,11 +5885,14 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
5877
5885
|
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
5878
5886
|
}
|
|
5879
5887
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
5880
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
5888
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
5889
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
5890
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
5881
5891
|
SDKInternalsRegistry.set(this, {
|
|
5882
5892
|
config: internalConfig,
|
|
5883
5893
|
context: executionContext,
|
|
5884
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
5894
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
5895
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
5885
5896
|
});
|
|
5886
5897
|
// Expose read-only config for user convenience
|
|
5887
5898
|
this.config = {
|
|
@@ -5909,6 +5920,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
5909
5920
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
5910
5921
|
// Load from meta tags
|
|
5911
5922
|
const metaConfig = loadFromMetaTags();
|
|
5923
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
5912
5924
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
5913
5925
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
5914
5926
|
if (!isCompleteConfig(merged)) {
|
package/dist/entities/index.cjs
CHANGED
|
@@ -651,6 +651,27 @@ var PaginationType;
|
|
|
651
651
|
/**
|
|
652
652
|
* Collection of utility functions for working with objects
|
|
653
653
|
*/
|
|
654
|
+
/**
|
|
655
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
656
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
657
|
+
* Direct key match takes priority over nested traversal.
|
|
658
|
+
*/
|
|
659
|
+
function resolveNestedField(data, fieldPath) {
|
|
660
|
+
if (!data) {
|
|
661
|
+
return undefined;
|
|
662
|
+
}
|
|
663
|
+
if (fieldPath in data) {
|
|
664
|
+
return data[fieldPath];
|
|
665
|
+
}
|
|
666
|
+
if (!fieldPath.includes('.')) {
|
|
667
|
+
return undefined;
|
|
668
|
+
}
|
|
669
|
+
let value = data;
|
|
670
|
+
for (const part of fieldPath.split('.')) {
|
|
671
|
+
value = value?.[part];
|
|
672
|
+
}
|
|
673
|
+
return value;
|
|
674
|
+
}
|
|
654
675
|
/**
|
|
655
676
|
* Filters out undefined values from an object
|
|
656
677
|
* @param obj The source object
|
|
@@ -912,6 +933,10 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
912
933
|
TOKEN_PARAM: 'continuationToken'
|
|
913
934
|
};
|
|
914
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
938
|
+
* Returns the original value if parsing fails.
|
|
939
|
+
*/
|
|
915
940
|
/**
|
|
916
941
|
* Transforms data by mapping fields according to the provided field mapping
|
|
917
942
|
* @param data The source data to transform
|
|
@@ -1266,7 +1291,8 @@ class PaginationHelpers {
|
|
|
1266
1291
|
// Extract and transform items from response
|
|
1267
1292
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1268
1293
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1269
|
-
const
|
|
1294
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1295
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1270
1296
|
// Parse items - automatically handle JSON string responses
|
|
1271
1297
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1272
1298
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1442,8 +1468,9 @@ class BaseService {
|
|
|
1442
1468
|
constructor(instance, headers) {
|
|
1443
1469
|
// Private field - not visible via Object.keys() or any reflection
|
|
1444
1470
|
_BaseService_apiClient.set(this, void 0);
|
|
1445
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1471
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1446
1472
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1473
|
+
this.config = { folderKey };
|
|
1447
1474
|
}
|
|
1448
1475
|
/**
|
|
1449
1476
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1562,9 +1589,17 @@ class BaseService {
|
|
|
1562
1589
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1563
1590
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1564
1591
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1592
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1593
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1594
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1565
1595
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1566
|
-
if (
|
|
1567
|
-
|
|
1596
|
+
if (convertToSkip) {
|
|
1597
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1598
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
else {
|
|
1602
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1568
1603
|
}
|
|
1569
1604
|
{
|
|
1570
1605
|
requestParams[countParam] = true;
|
|
@@ -1595,7 +1630,8 @@ class BaseService {
|
|
|
1595
1630
|
// Extract items and metadata
|
|
1596
1631
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1597
1632
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1598
|
-
const
|
|
1633
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1634
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1599
1635
|
const continuationToken = response.data[continuationTokenField];
|
|
1600
1636
|
// Determine if there are more pages
|
|
1601
1637
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1805,6 +1841,17 @@ exports.QueryFilterOperator = void 0;
|
|
|
1805
1841
|
QueryFilterOperator["In"] = "in";
|
|
1806
1842
|
QueryFilterOperator["NotIn"] = "not in";
|
|
1807
1843
|
})(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
|
|
1844
|
+
/**
|
|
1845
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
1846
|
+
*/
|
|
1847
|
+
exports.EntityAggregateFunction = void 0;
|
|
1848
|
+
(function (EntityAggregateFunction) {
|
|
1849
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
1850
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
1851
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
1852
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
1853
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
1854
|
+
})(exports.EntityAggregateFunction || (exports.EntityAggregateFunction = {}));
|
|
1808
1855
|
/**
|
|
1809
1856
|
* Entity type enum
|
|
1810
1857
|
*/
|
|
@@ -2093,7 +2140,7 @@ const EntityFieldTypeMap = {
|
|
|
2093
2140
|
// Connection string placeholder that will be replaced during build
|
|
2094
2141
|
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";
|
|
2095
2142
|
// SDK Version placeholder
|
|
2096
|
-
const SDK_VERSION = "1.3.
|
|
2143
|
+
const SDK_VERSION = "1.3.8";
|
|
2097
2144
|
const VERSION = "Version";
|
|
2098
2145
|
const SERVICE = "Service";
|
|
2099
2146
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2712,16 +2759,16 @@ class EntityService extends BaseService {
|
|
|
2712
2759
|
return entities;
|
|
2713
2760
|
}
|
|
2714
2761
|
/**
|
|
2715
|
-
* Queries entity records with filters, sorting, and pagination
|
|
2762
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
2716
2763
|
*
|
|
2717
2764
|
* @param id - UUID of the entity
|
|
2718
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
2765
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
2719
2766
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
2720
2767
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
2721
2768
|
*
|
|
2722
2769
|
* @example
|
|
2723
2770
|
* ```typescript
|
|
2724
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
2771
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
2725
2772
|
*
|
|
2726
2773
|
* const entities = new Entities(sdk);
|
|
2727
2774
|
*
|
|
@@ -2745,6 +2792,23 @@ class EntityService extends BaseService {
|
|
|
2745
2792
|
* if (page1.hasNextPage) {
|
|
2746
2793
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
2747
2794
|
* }
|
|
2795
|
+
*
|
|
2796
|
+
* // Aggregate: count of records per status
|
|
2797
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2798
|
+
* selectedFields: ["status"],
|
|
2799
|
+
* groupBy: ["status"],
|
|
2800
|
+
* aggregates: [
|
|
2801
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
2802
|
+
* ],
|
|
2803
|
+
* });
|
|
2804
|
+
*
|
|
2805
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
2806
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2807
|
+
* aggregates: [
|
|
2808
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
2809
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
2810
|
+
* ],
|
|
2811
|
+
* });
|
|
2748
2812
|
* ```
|
|
2749
2813
|
*/
|
|
2750
2814
|
async queryRecordsById(id, options) {
|
|
@@ -2762,7 +2826,7 @@ class EntityService extends BaseService {
|
|
|
2762
2826
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
2763
2827
|
}
|
|
2764
2828
|
},
|
|
2765
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
2829
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
2766
2830
|
}, options);
|
|
2767
2831
|
}
|
|
2768
2832
|
/**
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
106
106
|
offsetParam?: string;
|
|
107
107
|
tokenParam?: string;
|
|
108
108
|
countParam?: string;
|
|
109
|
+
convertToSkip?: boolean;
|
|
109
110
|
};
|
|
110
111
|
};
|
|
111
112
|
}
|
|
@@ -218,6 +219,13 @@ interface ApiResponse<T> {
|
|
|
218
219
|
*/
|
|
219
220
|
declare class BaseService {
|
|
220
221
|
#private;
|
|
222
|
+
/**
|
|
223
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
224
|
+
* fall back to init-time defaults like `folderKey`.
|
|
225
|
+
*/
|
|
226
|
+
protected readonly config: {
|
|
227
|
+
folderKey?: string;
|
|
228
|
+
};
|
|
221
229
|
/**
|
|
222
230
|
* Creates a base service instance with dependency injection.
|
|
223
231
|
*
|
|
@@ -473,7 +481,31 @@ interface EntityQuerySortOption {
|
|
|
473
481
|
isDescending?: boolean;
|
|
474
482
|
}
|
|
475
483
|
/**
|
|
476
|
-
*
|
|
484
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
485
|
+
*/
|
|
486
|
+
declare enum EntityAggregateFunction {
|
|
487
|
+
Count = "COUNT",
|
|
488
|
+
Sum = "SUM",
|
|
489
|
+
Avg = "AVG",
|
|
490
|
+
Min = "MIN",
|
|
491
|
+
Max = "MAX"
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* A single aggregate expression to apply during a query.
|
|
495
|
+
*
|
|
496
|
+
* Aggregate results are returned as fields on each item in the response,
|
|
497
|
+
* keyed by `alias` when provided.
|
|
498
|
+
*/
|
|
499
|
+
interface EntityAggregate {
|
|
500
|
+
/** Aggregate function to apply */
|
|
501
|
+
function: EntityAggregateFunction;
|
|
502
|
+
/** Field to aggregate on. For `COUNT`, any non-null field works (typically `Id`). */
|
|
503
|
+
field: string;
|
|
504
|
+
/** Optional alias for the aggregate result column. */
|
|
505
|
+
alias?: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Options for querying entity records with filters, sorting, aggregates, and pagination.
|
|
477
509
|
*
|
|
478
510
|
* Use `pageSize`, `cursor`, or `jumpToPage` for SDK-managed pagination.
|
|
479
511
|
* The SDK computes and manages offset parameters automatically.
|
|
@@ -487,6 +519,10 @@ type EntityQueryRecordsOptions = {
|
|
|
487
519
|
sortOptions?: EntityQuerySortOption[];
|
|
488
520
|
/** Level of entity expansion for related fields (default: 0) */
|
|
489
521
|
expansionLevel?: number;
|
|
522
|
+
/** Aggregate expressions (COUNT, SUM, AVG, MIN, MAX) to apply across the result set. */
|
|
523
|
+
aggregates?: EntityAggregate[];
|
|
524
|
+
/** Field names to group aggregate results by. */
|
|
525
|
+
groupBy?: string[];
|
|
490
526
|
} & PaginationOptions;
|
|
491
527
|
/**
|
|
492
528
|
* Response from querying entity records
|
|
@@ -1166,15 +1202,15 @@ interface EntityServiceModel {
|
|
|
1166
1202
|
*/
|
|
1167
1203
|
deleteRecordById(entityId: string, recordId: string): Promise<void>;
|
|
1168
1204
|
/**
|
|
1169
|
-
* Queries entity records with filters, sorting, and SDK-managed pagination
|
|
1205
|
+
* Queries entity records with filters, sorting, aggregates, and SDK-managed pagination
|
|
1170
1206
|
*
|
|
1171
1207
|
* @param id - UUID of the entity
|
|
1172
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
1208
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
1173
1209
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
1174
1210
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
1175
1211
|
* @example
|
|
1176
1212
|
* ```typescript
|
|
1177
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
1213
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
1178
1214
|
*
|
|
1179
1215
|
* const entities = new Entities(sdk);
|
|
1180
1216
|
*
|
|
@@ -1193,6 +1229,23 @@ interface EntityServiceModel {
|
|
|
1193
1229
|
* if (page1.hasNextPage) {
|
|
1194
1230
|
* const page2 = await entities.queryRecordsById(<id>, { cursor: page1.nextCursor });
|
|
1195
1231
|
* }
|
|
1232
|
+
*
|
|
1233
|
+
* // Aggregate: count of records per status
|
|
1234
|
+
* await entities.queryRecordsById(<id>, {
|
|
1235
|
+
* selectedFields: ["status"],
|
|
1236
|
+
* groupBy: ["status"],
|
|
1237
|
+
* aggregates: [
|
|
1238
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
1239
|
+
* ],
|
|
1240
|
+
* });
|
|
1241
|
+
*
|
|
1242
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
1243
|
+
* await entities.queryRecordsById(<id>, {
|
|
1244
|
+
* aggregates: [
|
|
1245
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
1246
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
1247
|
+
* ],
|
|
1248
|
+
* });
|
|
1196
1249
|
* ```
|
|
1197
1250
|
*/
|
|
1198
1251
|
queryRecordsById<T extends EntityQueryRecordsOptions = EntityQueryRecordsOptions>(id: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
@@ -1542,13 +1595,17 @@ interface EntityMethods {
|
|
|
1542
1595
|
*/
|
|
1543
1596
|
batchInsert(data: Record<string, any>[], options?: EntityBatchInsertOptions): Promise<EntityBatchInsertResponse>;
|
|
1544
1597
|
/**
|
|
1545
|
-
* Queries records in this entity with filters, sorting, and SDK-managed pagination
|
|
1598
|
+
* Queries records in this entity with filters, sorting, aggregates, and SDK-managed pagination
|
|
1546
1599
|
*
|
|
1547
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
1600
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
1548
1601
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
1549
1602
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
1550
1603
|
* @example
|
|
1551
1604
|
* ```typescript
|
|
1605
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
1606
|
+
*
|
|
1607
|
+
* const entities = new Entities(sdk);
|
|
1608
|
+
*
|
|
1552
1609
|
* const entity = await entities.getById(<entityId>);
|
|
1553
1610
|
* const result = await entity.queryRecords({
|
|
1554
1611
|
* filterGroup: {
|
|
@@ -1558,6 +1615,23 @@ interface EntityMethods {
|
|
|
1558
1615
|
* sortOptions: [{ fieldName: "createdTime", isDescending: true }],
|
|
1559
1616
|
* });
|
|
1560
1617
|
* console.log(`Found ${result.totalCount} records`);
|
|
1618
|
+
*
|
|
1619
|
+
* // Aggregate: count of records per status
|
|
1620
|
+
* await entity.queryRecords({
|
|
1621
|
+
* selectedFields: ["status"],
|
|
1622
|
+
* groupBy: ["status"],
|
|
1623
|
+
* aggregates: [
|
|
1624
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
1625
|
+
* ],
|
|
1626
|
+
* });
|
|
1627
|
+
*
|
|
1628
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
1629
|
+
* await entity.queryRecords({
|
|
1630
|
+
* aggregates: [
|
|
1631
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
1632
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
1633
|
+
* ],
|
|
1634
|
+
* });
|
|
1561
1635
|
* ```
|
|
1562
1636
|
*/
|
|
1563
1637
|
queryRecords<T extends EntityQueryRecordsOptions = EntityQueryRecordsOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
@@ -1890,16 +1964,16 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1890
1964
|
*/
|
|
1891
1965
|
getAll(): Promise<EntityGetResponse[]>;
|
|
1892
1966
|
/**
|
|
1893
|
-
* Queries entity records with filters, sorting, and pagination
|
|
1967
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
1894
1968
|
*
|
|
1895
1969
|
* @param id - UUID of the entity
|
|
1896
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
1970
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
1897
1971
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
1898
1972
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
1899
1973
|
*
|
|
1900
1974
|
* @example
|
|
1901
1975
|
* ```typescript
|
|
1902
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
1976
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
1903
1977
|
*
|
|
1904
1978
|
* const entities = new Entities(sdk);
|
|
1905
1979
|
*
|
|
@@ -1923,6 +1997,23 @@ declare class EntityService extends BaseService implements EntityServiceModel {
|
|
|
1923
1997
|
* if (page1.hasNextPage) {
|
|
1924
1998
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
1925
1999
|
* }
|
|
2000
|
+
*
|
|
2001
|
+
* // Aggregate: count of records per status
|
|
2002
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2003
|
+
* selectedFields: ["status"],
|
|
2004
|
+
* groupBy: ["status"],
|
|
2005
|
+
* aggregates: [
|
|
2006
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
2007
|
+
* ],
|
|
2008
|
+
* });
|
|
2009
|
+
*
|
|
2010
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
2011
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2012
|
+
* aggregates: [
|
|
2013
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
2014
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
2015
|
+
* ],
|
|
2016
|
+
* });
|
|
1926
2017
|
* ```
|
|
1927
2018
|
*/
|
|
1928
2019
|
queryRecordsById<T extends EntityQueryRecordsOptions = EntityQueryRecordsOptions>(id: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
@@ -2407,5 +2498,5 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
|
|
|
2407
2498
|
getById<T extends ChoiceSetGetByIdOptions = ChoiceSetGetByIdOptions>(choiceSetId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ChoiceSetGetResponse> : NonPaginatedResponse<ChoiceSetGetResponse>>;
|
|
2408
2499
|
}
|
|
2409
2500
|
|
|
2410
|
-
export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
|
|
2411
|
-
export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityCreateFieldOptions, EntityCreateOptions, EntityDeleteAttachmentResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityFieldBase, EntityFieldUpdateOptions, EntityFileType, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityImportRecordsResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityQueryFilter, EntityQueryFilterGroup, EntityQueryRecordsOptions, EntityQueryRecordsResponse, EntityQuerySortOption, EntityRecord, EntityRemoveFieldOptions, EntityServiceModel, EntityUpdateByIdOptions, EntityUpdateOptions, EntityUpdateRecordOptions, EntityUpdateRecordResponse, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria, SqlType };
|
|
2501
|
+
export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityAggregateFunction, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
|
|
2502
|
+
export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityAggregate, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityCreateFieldOptions, EntityCreateOptions, EntityDeleteAttachmentResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityFieldBase, EntityFieldUpdateOptions, EntityFileType, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityImportRecordsResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityQueryFilter, EntityQueryFilterGroup, EntityQueryRecordsOptions, EntityQueryRecordsResponse, EntityQuerySortOption, EntityRecord, EntityRemoveFieldOptions, EntityServiceModel, EntityUpdateByIdOptions, EntityUpdateOptions, EntityUpdateRecordOptions, EntityUpdateRecordResponse, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria, SqlType };
|
package/dist/entities/index.mjs
CHANGED
|
@@ -649,6 +649,27 @@ var PaginationType;
|
|
|
649
649
|
/**
|
|
650
650
|
* Collection of utility functions for working with objects
|
|
651
651
|
*/
|
|
652
|
+
/**
|
|
653
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
654
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
655
|
+
* Direct key match takes priority over nested traversal.
|
|
656
|
+
*/
|
|
657
|
+
function resolveNestedField(data, fieldPath) {
|
|
658
|
+
if (!data) {
|
|
659
|
+
return undefined;
|
|
660
|
+
}
|
|
661
|
+
if (fieldPath in data) {
|
|
662
|
+
return data[fieldPath];
|
|
663
|
+
}
|
|
664
|
+
if (!fieldPath.includes('.')) {
|
|
665
|
+
return undefined;
|
|
666
|
+
}
|
|
667
|
+
let value = data;
|
|
668
|
+
for (const part of fieldPath.split('.')) {
|
|
669
|
+
value = value?.[part];
|
|
670
|
+
}
|
|
671
|
+
return value;
|
|
672
|
+
}
|
|
652
673
|
/**
|
|
653
674
|
* Filters out undefined values from an object
|
|
654
675
|
* @param obj The source object
|
|
@@ -910,6 +931,10 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
910
931
|
TOKEN_PARAM: 'continuationToken'
|
|
911
932
|
};
|
|
912
933
|
|
|
934
|
+
/**
|
|
935
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
936
|
+
* Returns the original value if parsing fails.
|
|
937
|
+
*/
|
|
913
938
|
/**
|
|
914
939
|
* Transforms data by mapping fields according to the provided field mapping
|
|
915
940
|
* @param data The source data to transform
|
|
@@ -1264,7 +1289,8 @@ class PaginationHelpers {
|
|
|
1264
1289
|
// Extract and transform items from response
|
|
1265
1290
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1266
1291
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1267
|
-
const
|
|
1292
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1293
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1268
1294
|
// Parse items - automatically handle JSON string responses
|
|
1269
1295
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1270
1296
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1440,8 +1466,9 @@ class BaseService {
|
|
|
1440
1466
|
constructor(instance, headers) {
|
|
1441
1467
|
// Private field - not visible via Object.keys() or any reflection
|
|
1442
1468
|
_BaseService_apiClient.set(this, void 0);
|
|
1443
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1469
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1444
1470
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1471
|
+
this.config = { folderKey };
|
|
1445
1472
|
}
|
|
1446
1473
|
/**
|
|
1447
1474
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1560,9 +1587,17 @@ class BaseService {
|
|
|
1560
1587
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1561
1588
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1562
1589
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1590
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1591
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1592
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1563
1593
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1564
|
-
if (
|
|
1565
|
-
|
|
1594
|
+
if (convertToSkip) {
|
|
1595
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1596
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
else {
|
|
1600
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1566
1601
|
}
|
|
1567
1602
|
{
|
|
1568
1603
|
requestParams[countParam] = true;
|
|
@@ -1593,7 +1628,8 @@ class BaseService {
|
|
|
1593
1628
|
// Extract items and metadata
|
|
1594
1629
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1595
1630
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1596
|
-
const
|
|
1631
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1632
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1597
1633
|
const continuationToken = response.data[continuationTokenField];
|
|
1598
1634
|
// Determine if there are more pages
|
|
1599
1635
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1803,6 +1839,17 @@ var QueryFilterOperator;
|
|
|
1803
1839
|
QueryFilterOperator["In"] = "in";
|
|
1804
1840
|
QueryFilterOperator["NotIn"] = "not in";
|
|
1805
1841
|
})(QueryFilterOperator || (QueryFilterOperator = {}));
|
|
1842
|
+
/**
|
|
1843
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
1844
|
+
*/
|
|
1845
|
+
var EntityAggregateFunction;
|
|
1846
|
+
(function (EntityAggregateFunction) {
|
|
1847
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
1848
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
1849
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
1850
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
1851
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
1852
|
+
})(EntityAggregateFunction || (EntityAggregateFunction = {}));
|
|
1806
1853
|
/**
|
|
1807
1854
|
* Entity type enum
|
|
1808
1855
|
*/
|
|
@@ -2091,7 +2138,7 @@ const EntityFieldTypeMap = {
|
|
|
2091
2138
|
// Connection string placeholder that will be replaced during build
|
|
2092
2139
|
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";
|
|
2093
2140
|
// SDK Version placeholder
|
|
2094
|
-
const SDK_VERSION = "1.3.
|
|
2141
|
+
const SDK_VERSION = "1.3.8";
|
|
2095
2142
|
const VERSION = "Version";
|
|
2096
2143
|
const SERVICE = "Service";
|
|
2097
2144
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2710,16 +2757,16 @@ class EntityService extends BaseService {
|
|
|
2710
2757
|
return entities;
|
|
2711
2758
|
}
|
|
2712
2759
|
/**
|
|
2713
|
-
* Queries entity records with filters, sorting, and pagination
|
|
2760
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
2714
2761
|
*
|
|
2715
2762
|
* @param id - UUID of the entity
|
|
2716
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
2763
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
2717
2764
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
2718
2765
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
2719
2766
|
*
|
|
2720
2767
|
* @example
|
|
2721
2768
|
* ```typescript
|
|
2722
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
2769
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
2723
2770
|
*
|
|
2724
2771
|
* const entities = new Entities(sdk);
|
|
2725
2772
|
*
|
|
@@ -2743,6 +2790,23 @@ class EntityService extends BaseService {
|
|
|
2743
2790
|
* if (page1.hasNextPage) {
|
|
2744
2791
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
2745
2792
|
* }
|
|
2793
|
+
*
|
|
2794
|
+
* // Aggregate: count of records per status
|
|
2795
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2796
|
+
* selectedFields: ["status"],
|
|
2797
|
+
* groupBy: ["status"],
|
|
2798
|
+
* aggregates: [
|
|
2799
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
2800
|
+
* ],
|
|
2801
|
+
* });
|
|
2802
|
+
*
|
|
2803
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
2804
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
2805
|
+
* aggregates: [
|
|
2806
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
2807
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
2808
|
+
* ],
|
|
2809
|
+
* });
|
|
2746
2810
|
* ```
|
|
2747
2811
|
*/
|
|
2748
2812
|
async queryRecordsById(id, options) {
|
|
@@ -2760,7 +2824,7 @@ class EntityService extends BaseService {
|
|
|
2760
2824
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
2761
2825
|
}
|
|
2762
2826
|
},
|
|
2763
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
2827
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
2764
2828
|
}, options);
|
|
2765
2829
|
}
|
|
2766
2830
|
/**
|
|
@@ -3503,4 +3567,4 @@ __decorate([
|
|
|
3503
3567
|
track('Choicesets.GetById')
|
|
3504
3568
|
], ChoiceSetService.prototype, "getById", null);
|
|
3505
3569
|
|
|
3506
|
-
export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
|
|
3570
|
+
export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityAggregateFunction, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
|