@uipath/uipath-typescript 1.3.7 → 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 +40 -5
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.mjs +40 -5
- package/dist/attachments/index.cjs +40 -5
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.mjs +40 -5
- package/dist/buckets/index.cjs +40 -5
- package/dist/buckets/index.d.ts +1 -0
- package/dist/buckets/index.mjs +40 -5
- package/dist/cases/index.cjs +178 -5
- package/dist/cases/index.d.ts +158 -3
- package/dist/cases/index.mjs +179 -6
- package/dist/conversational-agent/index.cjs +40 -5
- package/dist/conversational-agent/index.d.ts +1 -0
- package/dist/conversational-agent/index.mjs +40 -5
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/entities/index.cjs +40 -5
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.mjs +40 -5
- package/dist/feedback/index.cjs +291 -9
- package/dist/feedback/index.d.ts +418 -12
- package/dist/feedback/index.mjs +291 -9
- package/dist/index.cjs +178 -5
- package/dist/index.d.ts +413 -10
- package/dist/index.mjs +179 -6
- package/dist/index.umd.js +178 -5
- package/dist/jobs/index.cjs +40 -5
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.mjs +40 -5
- package/dist/maestro-processes/index.cjs +77 -5
- package/dist/maestro-processes/index.d.ts +1 -0
- package/dist/maestro-processes/index.mjs +77 -5
- package/dist/processes/index.cjs +40 -5
- package/dist/processes/index.d.ts +1 -0
- package/dist/processes/index.mjs +40 -5
- package/dist/queues/index.cjs +40 -5
- package/dist/queues/index.d.ts +1 -0
- package/dist/queues/index.mjs +40 -5
- package/dist/tasks/index.cjs +40 -5
- package/dist/tasks/index.d.ts +1 -0
- package/dist/tasks/index.mjs +40 -5
- package/package.json +1 -1
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;
|
|
@@ -1561,9 +1587,17 @@ class BaseService {
|
|
|
1561
1587
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1562
1588
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1563
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;
|
|
1564
1593
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1565
|
-
if (
|
|
1566
|
-
|
|
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;
|
|
1567
1601
|
}
|
|
1568
1602
|
{
|
|
1569
1603
|
requestParams[countParam] = true;
|
|
@@ -1594,7 +1628,8 @@ class BaseService {
|
|
|
1594
1628
|
// Extract items and metadata
|
|
1595
1629
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1596
1630
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1597
|
-
const
|
|
1631
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1632
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1598
1633
|
const continuationToken = response.data[continuationTokenField];
|
|
1599
1634
|
// Determine if there are more pages
|
|
1600
1635
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -2103,7 +2138,7 @@ const EntityFieldTypeMap = {
|
|
|
2103
2138
|
// Connection string placeholder that will be replaced during build
|
|
2104
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";
|
|
2105
2140
|
// SDK Version placeholder
|
|
2106
|
-
const SDK_VERSION = "1.3.
|
|
2141
|
+
const SDK_VERSION = "1.3.8";
|
|
2107
2142
|
const VERSION = "Version";
|
|
2108
2143
|
const SERVICE = "Service";
|
|
2109
2144
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/feedback/index.cjs
CHANGED
|
@@ -652,6 +652,27 @@ var PaginationType;
|
|
|
652
652
|
/**
|
|
653
653
|
* Collection of utility functions for working with objects
|
|
654
654
|
*/
|
|
655
|
+
/**
|
|
656
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
657
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
658
|
+
* Direct key match takes priority over nested traversal.
|
|
659
|
+
*/
|
|
660
|
+
function resolveNestedField(data, fieldPath) {
|
|
661
|
+
if (!data) {
|
|
662
|
+
return undefined;
|
|
663
|
+
}
|
|
664
|
+
if (fieldPath in data) {
|
|
665
|
+
return data[fieldPath];
|
|
666
|
+
}
|
|
667
|
+
if (!fieldPath.includes('.')) {
|
|
668
|
+
return undefined;
|
|
669
|
+
}
|
|
670
|
+
let value = data;
|
|
671
|
+
for (const part of fieldPath.split('.')) {
|
|
672
|
+
value = value?.[part];
|
|
673
|
+
}
|
|
674
|
+
return value;
|
|
675
|
+
}
|
|
655
676
|
/**
|
|
656
677
|
* Filters out undefined values from an object
|
|
657
678
|
* @param obj The source object
|
|
@@ -873,6 +894,15 @@ const ODATA_OFFSET_PARAMS = {
|
|
|
873
894
|
/** OData count parameter name */
|
|
874
895
|
COUNT_PARAM: '$count'
|
|
875
896
|
};
|
|
897
|
+
/**
|
|
898
|
+
* Feedback category pagination response shape constants
|
|
899
|
+
*/
|
|
900
|
+
const FEEDBACK_CATEGORY_PAGINATION = {
|
|
901
|
+
/** Field name for items in feedback category response */
|
|
902
|
+
ITEMS_FIELD: 'categories',
|
|
903
|
+
/** Field name for total count in feedback category response */
|
|
904
|
+
TOTAL_COUNT_FIELD: 'totalCount'
|
|
905
|
+
};
|
|
876
906
|
/**
|
|
877
907
|
* Feedback OFFSET pagination parameter names (take/skip style)
|
|
878
908
|
*/
|
|
@@ -894,6 +924,10 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
894
924
|
TOKEN_PARAM: 'continuationToken'
|
|
895
925
|
};
|
|
896
926
|
|
|
927
|
+
/**
|
|
928
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
929
|
+
* Returns the original value if parsing fails.
|
|
930
|
+
*/
|
|
897
931
|
/**
|
|
898
932
|
* Transforms data by mapping fields according to the provided field mapping
|
|
899
933
|
* @param data The source data to transform
|
|
@@ -1166,7 +1200,8 @@ class PaginationHelpers {
|
|
|
1166
1200
|
// Extract and transform items from response
|
|
1167
1201
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1168
1202
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1169
|
-
const
|
|
1203
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1204
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1170
1205
|
// Parse items - automatically handle JSON string responses
|
|
1171
1206
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1172
1207
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1463,9 +1498,17 @@ class BaseService {
|
|
|
1463
1498
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1464
1499
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1465
1500
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1501
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1502
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1503
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1466
1504
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1467
|
-
if (
|
|
1468
|
-
|
|
1505
|
+
if (convertToSkip) {
|
|
1506
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1507
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
else {
|
|
1511
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1469
1512
|
}
|
|
1470
1513
|
{
|
|
1471
1514
|
requestParams[countParam] = true;
|
|
@@ -1496,7 +1539,8 @@ class BaseService {
|
|
|
1496
1539
|
// Extract items and metadata
|
|
1497
1540
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1498
1541
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1499
|
-
const
|
|
1542
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1543
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1500
1544
|
const continuationToken = response.data[continuationTokenField];
|
|
1501
1545
|
// Determine if there are more pages
|
|
1502
1546
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1560,6 +1604,14 @@ const LLMOPS_BASE = 'llmopstenant_';
|
|
|
1560
1604
|
const FEEDBACK_ENDPOINTS = {
|
|
1561
1605
|
GET_ALL: `${LLMOPS_BASE}/api/Feedback`,
|
|
1562
1606
|
GET_BY_ID: (id) => `${LLMOPS_BASE}/api/Feedback/${id}`,
|
|
1607
|
+
SUBMIT: `${LLMOPS_BASE}/api/Feedback`,
|
|
1608
|
+
UPDATE: (id) => `${LLMOPS_BASE}/api/Feedback/${id}`,
|
|
1609
|
+
DELETE: (id) => `${LLMOPS_BASE}/api/Feedback/${id}`,
|
|
1610
|
+
CATEGORY: {
|
|
1611
|
+
GET_ALL: `${LLMOPS_BASE}/api/Feedback/category`,
|
|
1612
|
+
CREATE: `${LLMOPS_BASE}/api/Feedback/category`,
|
|
1613
|
+
DELETE: (id) => `${LLMOPS_BASE}/api/Feedback/category/${id}`,
|
|
1614
|
+
},
|
|
1563
1615
|
};
|
|
1564
1616
|
|
|
1565
1617
|
/**
|
|
@@ -1568,7 +1620,7 @@ const FEEDBACK_ENDPOINTS = {
|
|
|
1568
1620
|
// Connection string placeholder that will be replaced during build
|
|
1569
1621
|
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";
|
|
1570
1622
|
// SDK Version placeholder
|
|
1571
|
-
const SDK_VERSION = "1.3.
|
|
1623
|
+
const SDK_VERSION = "1.3.8";
|
|
1572
1624
|
const VERSION = "Version";
|
|
1573
1625
|
const SERVICE = "Service";
|
|
1574
1626
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1844,10 +1896,10 @@ class FeedbackService extends BaseService {
|
|
|
1844
1896
|
* Gets all feedback across all agents in the tenant, with optional filters.
|
|
1845
1897
|
*
|
|
1846
1898
|
* Retrieves a list of feedback entries, optionally filtered by agent, trace, span, status, or agent version.
|
|
1847
|
-
* When no pagination options are provided, the
|
|
1899
|
+
* When no pagination options are provided, the SDK returns up to 100 items. When pagination options are provided without a pageSize, the SDK defaults to 50 items per page.
|
|
1848
1900
|
*
|
|
1849
1901
|
* @param options - Optional query parameters for filtering and pagination
|
|
1850
|
-
* @returns Promise resolving to {@link NonPaginatedResponse} of {@link
|
|
1902
|
+
* @returns Promise resolving to {@link NonPaginatedResponse} of {@link FeedbackResponse} without pagination options, or {@link PaginatedResponse} of {@link FeedbackResponse} when pagination options are used.
|
|
1851
1903
|
* @example
|
|
1852
1904
|
* ```typescript
|
|
1853
1905
|
* import { Feedback, FeedbackStatus } from '@uipath/uipath-typescript/feedback';
|
|
@@ -1899,7 +1951,7 @@ class FeedbackService extends BaseService {
|
|
|
1899
1951
|
*
|
|
1900
1952
|
* @param id - Feedback ID (GUID) of the feedback entry
|
|
1901
1953
|
* @param options - Required options including folderKey for folder-level authorization {@link FeedbackOptions}
|
|
1902
|
-
* @returns Promise resolving to {@link
|
|
1954
|
+
* @returns Promise resolving to {@link FeedbackResponse}
|
|
1903
1955
|
* @example
|
|
1904
1956
|
* ```typescript
|
|
1905
1957
|
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
@@ -1917,11 +1969,223 @@ class FeedbackService extends BaseService {
|
|
|
1917
1969
|
async getById(id, options) {
|
|
1918
1970
|
if (!id)
|
|
1919
1971
|
throw new ValidationError({ message: 'Feedback ID is required for getById' });
|
|
1920
|
-
if (!options
|
|
1972
|
+
if (!options.folderKey)
|
|
1921
1973
|
throw new ValidationError({ message: 'folderKey is required for getById' });
|
|
1922
1974
|
const response = await this.get(FEEDBACK_ENDPOINTS.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
1923
1975
|
return transformData(response.data, FeedbackMap);
|
|
1924
1976
|
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Submits a feedback entry.
|
|
1979
|
+
*
|
|
1980
|
+
* @param traceId - Trace identifier linking feedback to a specific agent execution
|
|
1981
|
+
* @param isPositive - Whether the feedback is positive (thumbs up) or negative (thumbs down)
|
|
1982
|
+
* @param options - Additional feedback data and folderKey for authorization {@link FeedbackSubmitOptions}
|
|
1983
|
+
* @returns Promise resolving to the submitted {@link FeedbackResponse}
|
|
1984
|
+
* @example
|
|
1985
|
+
* ```typescript
|
|
1986
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
1987
|
+
*
|
|
1988
|
+
* const feedback = new Feedback(sdk);
|
|
1989
|
+
*
|
|
1990
|
+
* // Obtain traceId and folderKey from an existing feedback entry
|
|
1991
|
+
* const allFeedback = await feedback.getAll({ pageSize: 1 });
|
|
1992
|
+
* const traceId = allFeedback.items[0].traceId;
|
|
1993
|
+
* const folderKey = allFeedback.items[0].folderKey!;
|
|
1994
|
+
*
|
|
1995
|
+
* const item = await feedback.submit(traceId, true, { folderKey });
|
|
1996
|
+
* console.log(item.id, item.status);
|
|
1997
|
+
* ```
|
|
1998
|
+
*/
|
|
1999
|
+
async submit(traceId, isPositive, options) {
|
|
2000
|
+
if (!traceId)
|
|
2001
|
+
throw new ValidationError({ message: 'traceId is required for submit' });
|
|
2002
|
+
if (!options.folderKey)
|
|
2003
|
+
throw new ValidationError({ message: 'folderKey is required for submit' });
|
|
2004
|
+
const { folderKey, ...rest } = options;
|
|
2005
|
+
const response = await this.post(FEEDBACK_ENDPOINTS.SUBMIT, { traceId, isPositive, ...rest }, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
2006
|
+
return transformData(response.data, FeedbackMap);
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Updates already submitted feedback.
|
|
2010
|
+
*
|
|
2011
|
+
* @param id - Feedback ID (GUID) of the entry to update
|
|
2012
|
+
* @param isPositive - Whether the feedback is positive (thumbs up) or negative (thumbs down)
|
|
2013
|
+
* @param options - Updated feedback data and folderKey for authorization {@link FeedbackUpdateOptions}
|
|
2014
|
+
* @returns Promise resolving to the updated {@link FeedbackResponse}
|
|
2015
|
+
* @example
|
|
2016
|
+
* ```typescript
|
|
2017
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
2018
|
+
*
|
|
2019
|
+
* const feedback = new Feedback(sdk);
|
|
2020
|
+
*
|
|
2021
|
+
* const allFeedback = await feedback.getAll({ pageSize: 1 });
|
|
2022
|
+
* const feedbackId = allFeedback.items[0].id;
|
|
2023
|
+
* const folderKey = allFeedback.items[0].folderKey!;
|
|
2024
|
+
*
|
|
2025
|
+
* const updated = await feedback.updateById(feedbackId, false, {
|
|
2026
|
+
* comment: 'On reflection, not great.',
|
|
2027
|
+
* folderKey,
|
|
2028
|
+
* });
|
|
2029
|
+
* console.log(updated.isPositive, updated.comment);
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
async updateById(id, isPositive, options) {
|
|
2033
|
+
if (!id)
|
|
2034
|
+
throw new ValidationError({ message: 'Feedback ID is required for updateById' });
|
|
2035
|
+
if (!options.folderKey)
|
|
2036
|
+
throw new ValidationError({ message: 'folderKey is required for updateById' });
|
|
2037
|
+
const { folderKey, ...rest } = options;
|
|
2038
|
+
const response = await this.post(FEEDBACK_ENDPOINTS.UPDATE(id), { isPositive, ...rest }, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
2039
|
+
return transformData(response.data, FeedbackMap);
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Deletes a feedback entry by its ID.
|
|
2043
|
+
*
|
|
2044
|
+
* @param id - Feedback ID (GUID) of the entry to delete
|
|
2045
|
+
* @param options - Required options including folderKey for folder-level authorization {@link FeedbackOptions}
|
|
2046
|
+
* @returns Promise resolving to void on success
|
|
2047
|
+
* @example
|
|
2048
|
+
* ```typescript
|
|
2049
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
2050
|
+
*
|
|
2051
|
+
* const feedback = new Feedback(sdk);
|
|
2052
|
+
*
|
|
2053
|
+
* const allFeedback = await feedback.getAll({ pageSize: 1 });
|
|
2054
|
+
* const feedbackId = allFeedback.items[0].id;
|
|
2055
|
+
* const folderKey = allFeedback.items[0].folderKey!;
|
|
2056
|
+
*
|
|
2057
|
+
* await feedback.deleteById(feedbackId, { folderKey });
|
|
2058
|
+
* ```
|
|
2059
|
+
*/
|
|
2060
|
+
async deleteById(id, options) {
|
|
2061
|
+
if (!id)
|
|
2062
|
+
throw new ValidationError({ message: 'Feedback ID is required for deleteById' });
|
|
2063
|
+
if (!options.folderKey)
|
|
2064
|
+
throw new ValidationError({ message: 'folderKey is required for deleteById' });
|
|
2065
|
+
await this.delete(FEEDBACK_ENDPOINTS.DELETE(id), { headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Creates a new feedback category.
|
|
2069
|
+
*
|
|
2070
|
+
* Custom categories can be used to label feedback entries beyond the default system categories.
|
|
2071
|
+
* Once created, reference the category by its `id` when submitting or updating feedback.
|
|
2072
|
+
* If `isPositive` and `isNegative` are omitted, the backend defaults both to `true`.
|
|
2073
|
+
*
|
|
2074
|
+
* @param category - Name of the category to create (max 256 characters, unique per tenant)
|
|
2075
|
+
* @param options - Optional flags controlling whether the category applies to positive and/or negative feedback {@link FeedbackCreateCategoryOptions}
|
|
2076
|
+
* @returns Promise resolving to the created {@link FeedbackCategoryResponse}
|
|
2077
|
+
* @example
|
|
2078
|
+
* ```typescript
|
|
2079
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
2080
|
+
*
|
|
2081
|
+
* const feedback = new Feedback(sdk);
|
|
2082
|
+
*
|
|
2083
|
+
* // Minimum — applies to both positive and negative feedback by default
|
|
2084
|
+
* const category = await feedback.createCategory('Hallucination');
|
|
2085
|
+
* console.log(category.id, category.category);
|
|
2086
|
+
*
|
|
2087
|
+
* // With explicit flags
|
|
2088
|
+
* const negativeOnly = await feedback.createCategory('Off-topic', {
|
|
2089
|
+
* isPositive: false,
|
|
2090
|
+
* isNegative: true,
|
|
2091
|
+
* });
|
|
2092
|
+
* ```
|
|
2093
|
+
*/
|
|
2094
|
+
async createCategory(category, options) {
|
|
2095
|
+
if (!category)
|
|
2096
|
+
throw new ValidationError({ message: 'category name is required for createCategory' });
|
|
2097
|
+
const body = { category };
|
|
2098
|
+
if (options?.isPositive !== undefined)
|
|
2099
|
+
body.isPositive = options.isPositive;
|
|
2100
|
+
if (options?.isNegative !== undefined)
|
|
2101
|
+
body.isNegative = options.isNegative;
|
|
2102
|
+
const response = await this.post(FEEDBACK_ENDPOINTS.CATEGORY.CREATE, body);
|
|
2103
|
+
return transformData(response.data, FeedbackMap);
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Gets all feedback categories for the tenant.
|
|
2107
|
+
*
|
|
2108
|
+
* Returns both system default categories (Output, Agent Error, Agent Plan Execution)
|
|
2109
|
+
* and any custom categories created for this tenant.
|
|
2110
|
+
* When no pagination options are provided, the SDK returns up to 100 items. When pagination options are provided without a pageSize, the SDK defaults to 50 items per page.
|
|
2111
|
+
*
|
|
2112
|
+
* @param options - Optional filters and pagination options {@link FeedbackGetCategoriesOptions}
|
|
2113
|
+
* @returns Promise resolving to {@link NonPaginatedResponse} of {@link FeedbackCategoryResponse} without pagination options, or {@link PaginatedResponse} of {@link FeedbackCategoryResponse} when pagination options are used.
|
|
2114
|
+
* @example
|
|
2115
|
+
* ```typescript
|
|
2116
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
2117
|
+
*
|
|
2118
|
+
* const feedback = new Feedback(sdk);
|
|
2119
|
+
*
|
|
2120
|
+
* // Get all categories
|
|
2121
|
+
* const categories = await feedback.getCategories();
|
|
2122
|
+
* console.log(categories.items.map(c => c.category));
|
|
2123
|
+
*
|
|
2124
|
+
* // Get only categories applicable to negative feedback
|
|
2125
|
+
* const negativeCategories = await feedback.getCategories({ isNegative: true });
|
|
2126
|
+
*
|
|
2127
|
+
* // Paginated
|
|
2128
|
+
* const page1 = await feedback.getCategories({ pageSize: 10 });
|
|
2129
|
+
* ```
|
|
2130
|
+
*/
|
|
2131
|
+
async getCategories(options) {
|
|
2132
|
+
const transformCategory = (item) => transformData(item, FeedbackMap);
|
|
2133
|
+
return PaginationHelpers.getAll({
|
|
2134
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
2135
|
+
getEndpoint: () => FEEDBACK_ENDPOINTS.CATEGORY.GET_ALL,
|
|
2136
|
+
transformFn: transformCategory,
|
|
2137
|
+
pagination: {
|
|
2138
|
+
paginationType: PaginationType.OFFSET,
|
|
2139
|
+
itemsField: FEEDBACK_CATEGORY_PAGINATION.ITEMS_FIELD,
|
|
2140
|
+
totalCountField: FEEDBACK_CATEGORY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
2141
|
+
paginationParams: {
|
|
2142
|
+
pageSizeParam: FEEDBACK_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
2143
|
+
offsetParam: FEEDBACK_OFFSET_PARAMS.OFFSET_PARAM,
|
|
2144
|
+
countParam: FEEDBACK_OFFSET_PARAMS.COUNT_PARAM,
|
|
2145
|
+
},
|
|
2146
|
+
},
|
|
2147
|
+
excludeFromPrefix: Object.keys(options || {}),
|
|
2148
|
+
}, options);
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Deletes a feedback category by its ID.
|
|
2152
|
+
*
|
|
2153
|
+
* System default categories (Output, Agent Error, Agent Plan Execution) cannot be deleted —
|
|
2154
|
+
* attempting to do so throws a `409 Conflict` error.
|
|
2155
|
+
* Use `forceDelete` to delete a custom category that already has feedback entries associated with it.
|
|
2156
|
+
*
|
|
2157
|
+
* @param id - Category ID (GUID) of the category to delete
|
|
2158
|
+
* @param options - Optional deletion options {@link FeedbackDeleteCategoryOptions}
|
|
2159
|
+
* @returns Promise resolving to void on success
|
|
2160
|
+
* @example
|
|
2161
|
+
* ```typescript
|
|
2162
|
+
* import { Feedback } from '@uipath/uipath-typescript/feedback';
|
|
2163
|
+
*
|
|
2164
|
+
* const feedback = new Feedback(sdk);
|
|
2165
|
+
*
|
|
2166
|
+
* // Only custom categories (isDefault: false) can be deleted
|
|
2167
|
+
* const categories = await feedback.getCategories();
|
|
2168
|
+
* const customCategory = categories.items.find(c => !c.isDefault);
|
|
2169
|
+
* if (customCategory) {
|
|
2170
|
+
* await feedback.deleteCategory(customCategory.id);
|
|
2171
|
+
* }
|
|
2172
|
+
* ```
|
|
2173
|
+
* @example
|
|
2174
|
+
* ```typescript
|
|
2175
|
+
* // Force-delete a custom category that has associated feedback entries
|
|
2176
|
+
* const categories = await feedback.getCategories();
|
|
2177
|
+
* const customCategory = categories.items.find(c => !c.isDefault);
|
|
2178
|
+
* if (customCategory) {
|
|
2179
|
+
* await feedback.deleteCategory(customCategory.id, { forceDelete: true });
|
|
2180
|
+
* }
|
|
2181
|
+
* ```
|
|
2182
|
+
*/
|
|
2183
|
+
async deleteCategory(id, options) {
|
|
2184
|
+
if (!id)
|
|
2185
|
+
throw new ValidationError({ message: 'Category ID is required for deleteCategory' });
|
|
2186
|
+
const params = options?.forceDelete !== undefined ? { forceDelete: options.forceDelete } : undefined;
|
|
2187
|
+
await this.delete(FEEDBACK_ENDPOINTS.CATEGORY.DELETE(id), { params });
|
|
2188
|
+
}
|
|
1925
2189
|
}
|
|
1926
2190
|
__decorate([
|
|
1927
2191
|
track('Feedback.GetAll')
|
|
@@ -1929,6 +2193,24 @@ __decorate([
|
|
|
1929
2193
|
__decorate([
|
|
1930
2194
|
track('Feedback.GetById')
|
|
1931
2195
|
], FeedbackService.prototype, "getById", null);
|
|
2196
|
+
__decorate([
|
|
2197
|
+
track('Feedback.Submit')
|
|
2198
|
+
], FeedbackService.prototype, "submit", null);
|
|
2199
|
+
__decorate([
|
|
2200
|
+
track('Feedback.UpdateById')
|
|
2201
|
+
], FeedbackService.prototype, "updateById", null);
|
|
2202
|
+
__decorate([
|
|
2203
|
+
track('Feedback.DeleteById')
|
|
2204
|
+
], FeedbackService.prototype, "deleteById", null);
|
|
2205
|
+
__decorate([
|
|
2206
|
+
track('Feedback.CreateCategory')
|
|
2207
|
+
], FeedbackService.prototype, "createCategory", null);
|
|
2208
|
+
__decorate([
|
|
2209
|
+
track('Feedback.GetCategories')
|
|
2210
|
+
], FeedbackService.prototype, "getCategories", null);
|
|
2211
|
+
__decorate([
|
|
2212
|
+
track('Feedback.DeleteCategory')
|
|
2213
|
+
], FeedbackService.prototype, "deleteCategory", null);
|
|
1932
2214
|
|
|
1933
2215
|
/**
|
|
1934
2216
|
* Status of a feedback entry in the review workflow
|