@uipath/uipath-typescript 1.3.9 → 1.3.11
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 +19 -6
- package/dist/assets/index.mjs +19 -6
- package/dist/attachments/index.cjs +19 -6
- package/dist/attachments/index.mjs +19 -6
- package/dist/buckets/index.cjs +141 -6
- package/dist/buckets/index.d.ts +164 -1
- package/dist/buckets/index.mjs +141 -6
- package/dist/cases/index.cjs +70 -6
- package/dist/cases/index.d.ts +91 -1
- package/dist/cases/index.mjs +70 -6
- package/dist/conversational-agent/index.cjs +19 -6
- package/dist/conversational-agent/index.mjs +19 -6
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/entities/index.cjs +239 -34
- package/dist/entities/index.d.ts +311 -12
- package/dist/entities/index.mjs +239 -34
- package/dist/feedback/index.cjs +19 -6
- package/dist/feedback/index.mjs +19 -6
- package/dist/index.cjs +490 -64
- package/dist/index.d.ts +714 -36
- package/dist/index.mjs +490 -64
- package/dist/index.umd.js +491 -65
- package/dist/jobs/index.cjs +19 -6
- package/dist/jobs/index.mjs +19 -6
- package/dist/maestro-processes/index.cjs +70 -6
- package/dist/maestro-processes/index.d.ts +91 -1
- package/dist/maestro-processes/index.mjs +70 -6
- package/dist/processes/index.cjs +47 -35
- package/dist/processes/index.d.ts +76 -26
- package/dist/processes/index.mjs +47 -35
- package/dist/queues/index.cjs +19 -6
- package/dist/queues/index.mjs +19 -6
- package/dist/tasks/index.cjs +19 -6
- package/dist/tasks/index.mjs +19 -6
- package/dist/traces/index.cjs +1902 -0
- package/dist/traces/index.d.ts +565 -0
- package/dist/traces/index.mjs +1900 -0
- package/package.json +12 -2
package/dist/entities/index.mjs
CHANGED
|
@@ -609,14 +609,25 @@ class ApiClient {
|
|
|
609
609
|
if (!text) {
|
|
610
610
|
return undefined;
|
|
611
611
|
}
|
|
612
|
-
|
|
612
|
+
try {
|
|
613
|
+
return JSON.parse(text);
|
|
614
|
+
}
|
|
615
|
+
catch (error) {
|
|
616
|
+
if (error instanceof SyntaxError) {
|
|
617
|
+
throw new ServerError({
|
|
618
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
619
|
+
statusCode: response.status,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
throw error;
|
|
623
|
+
}
|
|
613
624
|
}
|
|
614
625
|
catch (error) {
|
|
615
626
|
// If it's already one of our errors, re-throw it
|
|
616
627
|
if (error.type && error.type.includes('Error')) {
|
|
617
628
|
throw error;
|
|
618
629
|
}
|
|
619
|
-
// Otherwise, it's
|
|
630
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
620
631
|
throw ErrorFactory.createNetworkError(error);
|
|
621
632
|
}
|
|
622
633
|
}
|
|
@@ -1238,9 +1249,9 @@ class PaginationHelpers {
|
|
|
1238
1249
|
* @returns Promise resolving to a paginated result
|
|
1239
1250
|
*/
|
|
1240
1251
|
static async getAllPaginated(params) {
|
|
1241
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1252
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1242
1253
|
const endpoint = getEndpoint(folderId);
|
|
1243
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1254
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1244
1255
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1245
1256
|
headers,
|
|
1246
1257
|
params: additionalParams,
|
|
@@ -1268,13 +1279,13 @@ class PaginationHelpers {
|
|
|
1268
1279
|
* @returns Promise resolving to an object with data and totalCount
|
|
1269
1280
|
*/
|
|
1270
1281
|
static async getAllNonPaginated(params) {
|
|
1271
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1282
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1272
1283
|
// Set default field names
|
|
1273
1284
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1274
1285
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1275
1286
|
// Determine endpoint and headers based on folderId
|
|
1276
1287
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1277
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1288
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1278
1289
|
// Make the API call based on method
|
|
1279
1290
|
let response;
|
|
1280
1291
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1333,6 +1344,7 @@ class PaginationHelpers {
|
|
|
1333
1344
|
serviceAccess: config.serviceAccess,
|
|
1334
1345
|
getEndpoint: config.getEndpoint,
|
|
1335
1346
|
folderId,
|
|
1347
|
+
headers: config.headers,
|
|
1336
1348
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1337
1349
|
additionalParams: prefixedOptions,
|
|
1338
1350
|
transformFn: config.transformFn,
|
|
@@ -1350,6 +1362,7 @@ class PaginationHelpers {
|
|
|
1350
1362
|
getAllEndpoint: config.getEndpoint(),
|
|
1351
1363
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1352
1364
|
folderId,
|
|
1365
|
+
headers: config.headers,
|
|
1353
1366
|
additionalParams: prefixedOptions,
|
|
1354
1367
|
transformFn: config.transformFn,
|
|
1355
1368
|
method: config.method,
|
|
@@ -1936,6 +1949,12 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1936
1949
|
CHOICESETS: {
|
|
1937
1950
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
1938
1951
|
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
1952
|
+
CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
1953
|
+
UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
|
|
1954
|
+
DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
|
|
1955
|
+
INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
|
|
1956
|
+
UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
|
|
1957
|
+
DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
|
|
1939
1958
|
},
|
|
1940
1959
|
};
|
|
1941
1960
|
|
|
@@ -2770,10 +2789,6 @@ class EntityService extends BaseService {
|
|
|
2770
2789
|
* @internal
|
|
2771
2790
|
*/
|
|
2772
2791
|
async create(name, fields, options) {
|
|
2773
|
-
this.validateName(name, 'entity');
|
|
2774
|
-
for (const field of fields) {
|
|
2775
|
-
this.validateName(field.fieldName, 'field');
|
|
2776
|
-
}
|
|
2777
2792
|
const opts = options ?? {};
|
|
2778
2793
|
const payload = {
|
|
2779
2794
|
...(opts.description !== undefined && { description: opts.description }),
|
|
@@ -2916,6 +2931,7 @@ class EntityService extends BaseService {
|
|
|
2916
2931
|
...(update.isUnique !== undefined && { isUnique: update.isUnique }),
|
|
2917
2932
|
...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
|
|
2918
2933
|
...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
|
|
2934
|
+
...(update.isHiddenField !== undefined && { isHiddenField: update.isHiddenField }),
|
|
2919
2935
|
...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
|
|
2920
2936
|
...(hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }),
|
|
2921
2937
|
};
|
|
@@ -2924,9 +2940,6 @@ class EntityService extends BaseService {
|
|
|
2924
2940
|
// Build and append new fields
|
|
2925
2941
|
const newFields = [];
|
|
2926
2942
|
if (options.addFields?.length) {
|
|
2927
|
-
for (const field of options.addFields) {
|
|
2928
|
-
this.validateName(field.fieldName, 'field');
|
|
2929
|
-
}
|
|
2930
2943
|
newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
|
|
2931
2944
|
}
|
|
2932
2945
|
await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
|
|
@@ -3027,9 +3040,15 @@ class EntityService extends BaseService {
|
|
|
3027
3040
|
}
|
|
3028
3041
|
/** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
|
|
3029
3042
|
buildSchemaFieldPayload(field) {
|
|
3030
|
-
this.validateName(field.fieldName, 'field');
|
|
3031
3043
|
const fieldType = field.type ?? EntityFieldDataType.STRING;
|
|
3032
3044
|
this.validateFieldConstraints(fieldType, field, field.fieldName);
|
|
3045
|
+
const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
|
|
3046
|
+
const isFile = fieldType === EntityFieldDataType.FILE;
|
|
3047
|
+
if ((isRelationship || isFile) && (!field.referenceEntityId || !field.referenceFieldId)) {
|
|
3048
|
+
throw new ValidationError({
|
|
3049
|
+
message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`,
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3033
3052
|
const mapping = EntitySchemaFieldTypeMap[fieldType];
|
|
3034
3053
|
return {
|
|
3035
3054
|
name: field.fieldName,
|
|
@@ -3044,10 +3063,13 @@ class EntityService extends BaseService {
|
|
|
3044
3063
|
isUnique: field.isUnique ?? false,
|
|
3045
3064
|
isRbacEnabled: field.isRbacEnabled ?? false,
|
|
3046
3065
|
isEncrypted: field.isEncrypted ?? false,
|
|
3066
|
+
isHiddenField: field.isHiddenField ?? false,
|
|
3047
3067
|
...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
|
|
3048
3068
|
...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
|
|
3049
|
-
...(
|
|
3050
|
-
...(
|
|
3069
|
+
...((isRelationship || isFile) && { isForeignKey: true }),
|
|
3070
|
+
...(isRelationship && { referenceType: ReferenceType.ManyToOne }),
|
|
3071
|
+
...(field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } }),
|
|
3072
|
+
...(field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }),
|
|
3051
3073
|
};
|
|
3052
3074
|
}
|
|
3053
3075
|
/**
|
|
@@ -3151,24 +3173,7 @@ class EntityService extends BaseService {
|
|
|
3151
3173
|
return {};
|
|
3152
3174
|
}
|
|
3153
3175
|
}
|
|
3154
|
-
validateName(name, context) {
|
|
3155
|
-
if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
|
|
3156
|
-
const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
|
|
3157
|
-
const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
|
|
3158
|
-
throw new ValidationError({
|
|
3159
|
-
message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
|
|
3160
|
-
});
|
|
3161
|
-
}
|
|
3162
|
-
if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
|
|
3163
|
-
throw new ValidationError({
|
|
3164
|
-
message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
3176
|
}
|
|
3169
|
-
EntityService.RESERVED_FIELD_NAMES = new Set([
|
|
3170
|
-
'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
|
|
3171
|
-
]);
|
|
3172
3177
|
__decorate([
|
|
3173
3178
|
track('Entities.GetById')
|
|
3174
3179
|
], EntityService.prototype, "getById", null);
|
|
@@ -3265,7 +3270,7 @@ class ChoiceSetService extends BaseService {
|
|
|
3265
3270
|
*
|
|
3266
3271
|
* @example
|
|
3267
3272
|
* ```typescript
|
|
3268
|
-
* import { ChoiceSets } from '@uipath/uipath-typescript/
|
|
3273
|
+
* import { ChoiceSets } from '@uipath/uipath-typescript/entities';
|
|
3269
3274
|
*
|
|
3270
3275
|
* const choiceSets = new ChoiceSets(sdk);
|
|
3271
3276
|
*
|
|
@@ -3314,6 +3319,188 @@ class ChoiceSetService extends BaseService {
|
|
|
3314
3319
|
}
|
|
3315
3320
|
}, options);
|
|
3316
3321
|
}
|
|
3322
|
+
/**
|
|
3323
|
+
* Creates a new Data Fabric choice set
|
|
3324
|
+
*
|
|
3325
|
+
* @param name - Choice set name. Must start with a
|
|
3326
|
+
* letter, may contain only letters, numbers, and underscores, length
|
|
3327
|
+
* 3–100 characters (e.g., `"expenseTypes"`).
|
|
3328
|
+
* @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
|
|
3329
|
+
* @returns Promise resolving to the UUID of the created choice set
|
|
3330
|
+
*
|
|
3331
|
+
* @example
|
|
3332
|
+
* ```typescript
|
|
3333
|
+
* import { ChoiceSets } from '@uipath/uipath-typescript/entities';
|
|
3334
|
+
*
|
|
3335
|
+
* const choicesets = new ChoiceSets(sdk);
|
|
3336
|
+
*
|
|
3337
|
+
* // Minimal create
|
|
3338
|
+
* const expenseTypesId = await choicesets.create("expense_types");
|
|
3339
|
+
*
|
|
3340
|
+
* // With display name and description
|
|
3341
|
+
* const priorityLevelsId = await choicesets.create("priority_levels", {
|
|
3342
|
+
* displayName: "Priority Levels",
|
|
3343
|
+
* description: "Ticket priority categories",
|
|
3344
|
+
* });
|
|
3345
|
+
* ```
|
|
3346
|
+
* @internal
|
|
3347
|
+
*/
|
|
3348
|
+
async create(name, options) {
|
|
3349
|
+
const opts = options ?? {};
|
|
3350
|
+
const payload = {
|
|
3351
|
+
...(opts.description !== undefined && { description: opts.description }),
|
|
3352
|
+
...(opts.displayName !== undefined && { displayName: opts.displayName }),
|
|
3353
|
+
entityDefinition: {
|
|
3354
|
+
name,
|
|
3355
|
+
fields: [],
|
|
3356
|
+
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
3357
|
+
},
|
|
3358
|
+
};
|
|
3359
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
|
|
3360
|
+
return response.data;
|
|
3361
|
+
}
|
|
3362
|
+
/**
|
|
3363
|
+
* Updates an existing choice set's metadata (display name and/or description).
|
|
3364
|
+
*
|
|
3365
|
+
* **At least one of `displayName` or `description` must be provided** —
|
|
3366
|
+
* the call throws `ValidationError` if both are omitted.
|
|
3367
|
+
*
|
|
3368
|
+
* @param choiceSetId - UUID of the choice set to update
|
|
3369
|
+
* @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
|
|
3370
|
+
* @returns Promise resolving when the update is complete
|
|
3371
|
+
*
|
|
3372
|
+
* @example
|
|
3373
|
+
* ```typescript
|
|
3374
|
+
* // First, get the choice set ID using getAll()
|
|
3375
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3376
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3377
|
+
*
|
|
3378
|
+
* await choicesets.updateById(expenseTypes.id, {
|
|
3379
|
+
* displayName: "Expense Categories",
|
|
3380
|
+
* description: "Updated description",
|
|
3381
|
+
* });
|
|
3382
|
+
* ```
|
|
3383
|
+
* @internal
|
|
3384
|
+
*/
|
|
3385
|
+
async updateById(choiceSetId, options) {
|
|
3386
|
+
if (options.displayName === undefined && options.description === undefined) {
|
|
3387
|
+
throw new ValidationError({
|
|
3388
|
+
message: 'updateById requires at least one of displayName or description.',
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
|
|
3392
|
+
...(options.displayName !== undefined && { displayName: options.displayName }),
|
|
3393
|
+
...(options.description !== undefined && { description: options.description }),
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* Deletes a Data Fabric choice set and all its values.
|
|
3398
|
+
*
|
|
3399
|
+
* @param choiceSetId - UUID of the choice set to delete
|
|
3400
|
+
* @returns Promise resolving when the choice set is deleted
|
|
3401
|
+
*
|
|
3402
|
+
* @example
|
|
3403
|
+
* ```typescript
|
|
3404
|
+
* // First, get the choice set ID using getAll()
|
|
3405
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3406
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3407
|
+
*
|
|
3408
|
+
* await choicesets.deleteById(expenseTypes.id);
|
|
3409
|
+
* ```
|
|
3410
|
+
* @internal
|
|
3411
|
+
*/
|
|
3412
|
+
async deleteById(choiceSetId) {
|
|
3413
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Inserts a single value into a choice set.
|
|
3417
|
+
*
|
|
3418
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3419
|
+
* @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
|
|
3420
|
+
* @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
|
|
3421
|
+
* @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
|
|
3422
|
+
*
|
|
3423
|
+
* @example
|
|
3424
|
+
* ```typescript
|
|
3425
|
+
* // First, get the choice set ID using getAll()
|
|
3426
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3427
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3428
|
+
*
|
|
3429
|
+
* const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
|
|
3430
|
+
* displayName: 'Travel',
|
|
3431
|
+
* });
|
|
3432
|
+
* console.log(inserted.id);
|
|
3433
|
+
* ```
|
|
3434
|
+
* @internal
|
|
3435
|
+
*/
|
|
3436
|
+
async insertValueById(choiceSetId, name, options) {
|
|
3437
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
3438
|
+
const payload = {
|
|
3439
|
+
Name: name,
|
|
3440
|
+
...(options?.displayName !== undefined && { DisplayName: options.displayName }),
|
|
3441
|
+
};
|
|
3442
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
|
|
3443
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
3444
|
+
return transformData(camelCased, EntityMap);
|
|
3445
|
+
}
|
|
3446
|
+
/**
|
|
3447
|
+
* Updates an existing choice-set value's display name.
|
|
3448
|
+
*
|
|
3449
|
+
* Only `displayName` is mutable; the value's `name` (identifier) is fixed at
|
|
3450
|
+
* insert time and cannot be changed.
|
|
3451
|
+
*
|
|
3452
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3453
|
+
* @param valueId - UUID of the value to update
|
|
3454
|
+
* @param displayName - New human-readable display name for the value
|
|
3455
|
+
* @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
|
|
3456
|
+
*
|
|
3457
|
+
* @example
|
|
3458
|
+
* ```typescript
|
|
3459
|
+
* // Get the choice set ID from getAll() and the value ID from getById()
|
|
3460
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3461
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3462
|
+
* const values = await choicesets.getById(expenseTypes.id);
|
|
3463
|
+
* const travel = values.items.find(v => v.name === 'TRAVEL');
|
|
3464
|
+
*
|
|
3465
|
+
* await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
|
|
3466
|
+
* ```
|
|
3467
|
+
* @internal
|
|
3468
|
+
*/
|
|
3469
|
+
async updateValueById(choiceSetId, valueId, displayName) {
|
|
3470
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
3471
|
+
const payload = { DisplayName: displayName };
|
|
3472
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
|
|
3473
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
3474
|
+
return transformData(camelCased, EntityMap);
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
3477
|
+
* Deletes one or more values from a choice set.
|
|
3478
|
+
*
|
|
3479
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3480
|
+
* @param valueIds - Array of value UUIDs to delete
|
|
3481
|
+
* @returns Promise resolving when the values are deleted
|
|
3482
|
+
*
|
|
3483
|
+
* @example
|
|
3484
|
+
* ```typescript
|
|
3485
|
+
* // Get the value IDs from getById()
|
|
3486
|
+
* const values = await choicesets.getById('<choiceSetId>');
|
|
3487
|
+
* const idsToDelete = values.items.slice(0, 2).map(v => v.id);
|
|
3488
|
+
*
|
|
3489
|
+
* await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
|
|
3490
|
+
* ```
|
|
3491
|
+
* @internal
|
|
3492
|
+
*/
|
|
3493
|
+
async deleteValuesById(choiceSetId, valueIds) {
|
|
3494
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
|
|
3495
|
+
}
|
|
3496
|
+
async resolveChoiceSetName(choiceSetId) {
|
|
3497
|
+
const all = await this.getAll();
|
|
3498
|
+
const match = all.find(cs => cs.id === choiceSetId);
|
|
3499
|
+
if (!match) {
|
|
3500
|
+
throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
|
|
3501
|
+
}
|
|
3502
|
+
return match.name;
|
|
3503
|
+
}
|
|
3317
3504
|
}
|
|
3318
3505
|
__decorate([
|
|
3319
3506
|
track('Choicesets.GetAll')
|
|
@@ -3321,5 +3508,23 @@ __decorate([
|
|
|
3321
3508
|
__decorate([
|
|
3322
3509
|
track('Choicesets.GetById')
|
|
3323
3510
|
], ChoiceSetService.prototype, "getById", null);
|
|
3511
|
+
__decorate([
|
|
3512
|
+
track('Choicesets.Create')
|
|
3513
|
+
], ChoiceSetService.prototype, "create", null);
|
|
3514
|
+
__decorate([
|
|
3515
|
+
track('Choicesets.UpdateById')
|
|
3516
|
+
], ChoiceSetService.prototype, "updateById", null);
|
|
3517
|
+
__decorate([
|
|
3518
|
+
track('Choicesets.DeleteById')
|
|
3519
|
+
], ChoiceSetService.prototype, "deleteById", null);
|
|
3520
|
+
__decorate([
|
|
3521
|
+
track('Choicesets.InsertValueById')
|
|
3522
|
+
], ChoiceSetService.prototype, "insertValueById", null);
|
|
3523
|
+
__decorate([
|
|
3524
|
+
track('Choicesets.UpdateValueById')
|
|
3525
|
+
], ChoiceSetService.prototype, "updateValueById", null);
|
|
3526
|
+
__decorate([
|
|
3527
|
+
track('Choicesets.DeleteValuesById')
|
|
3528
|
+
], ChoiceSetService.prototype, "deleteValuesById", null);
|
|
3324
3529
|
|
|
3325
3530
|
export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityAggregateFunction, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
|
package/dist/feedback/index.cjs
CHANGED
|
@@ -612,14 +612,25 @@ class ApiClient {
|
|
|
612
612
|
if (!text) {
|
|
613
613
|
return undefined;
|
|
614
614
|
}
|
|
615
|
-
|
|
615
|
+
try {
|
|
616
|
+
return JSON.parse(text);
|
|
617
|
+
}
|
|
618
|
+
catch (error) {
|
|
619
|
+
if (error instanceof SyntaxError) {
|
|
620
|
+
throw new ServerError({
|
|
621
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
622
|
+
statusCode: response.status,
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
throw error;
|
|
626
|
+
}
|
|
616
627
|
}
|
|
617
628
|
catch (error) {
|
|
618
629
|
// If it's already one of our errors, re-throw it
|
|
619
630
|
if (error.type && error.type.includes('Error')) {
|
|
620
631
|
throw error;
|
|
621
632
|
}
|
|
622
|
-
// Otherwise, it's
|
|
633
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
623
634
|
throw ErrorFactory.createNetworkError(error);
|
|
624
635
|
}
|
|
625
636
|
}
|
|
@@ -1149,9 +1160,9 @@ class PaginationHelpers {
|
|
|
1149
1160
|
* @returns Promise resolving to a paginated result
|
|
1150
1161
|
*/
|
|
1151
1162
|
static async getAllPaginated(params) {
|
|
1152
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1163
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1153
1164
|
const endpoint = getEndpoint(folderId);
|
|
1154
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1165
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1155
1166
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1156
1167
|
headers,
|
|
1157
1168
|
params: additionalParams,
|
|
@@ -1179,13 +1190,13 @@ class PaginationHelpers {
|
|
|
1179
1190
|
* @returns Promise resolving to an object with data and totalCount
|
|
1180
1191
|
*/
|
|
1181
1192
|
static async getAllNonPaginated(params) {
|
|
1182
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1193
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1183
1194
|
// Set default field names
|
|
1184
1195
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1185
1196
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1186
1197
|
// Determine endpoint and headers based on folderId
|
|
1187
1198
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1188
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1199
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1189
1200
|
// Make the API call based on method
|
|
1190
1201
|
let response;
|
|
1191
1202
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1244,6 +1255,7 @@ class PaginationHelpers {
|
|
|
1244
1255
|
serviceAccess: config.serviceAccess,
|
|
1245
1256
|
getEndpoint: config.getEndpoint,
|
|
1246
1257
|
folderId,
|
|
1258
|
+
headers: config.headers,
|
|
1247
1259
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1248
1260
|
additionalParams: prefixedOptions,
|
|
1249
1261
|
transformFn: config.transformFn,
|
|
@@ -1261,6 +1273,7 @@ class PaginationHelpers {
|
|
|
1261
1273
|
getAllEndpoint: config.getEndpoint(),
|
|
1262
1274
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1263
1275
|
folderId,
|
|
1276
|
+
headers: config.headers,
|
|
1264
1277
|
additionalParams: prefixedOptions,
|
|
1265
1278
|
transformFn: config.transformFn,
|
|
1266
1279
|
method: config.method,
|
package/dist/feedback/index.mjs
CHANGED
|
@@ -610,14 +610,25 @@ class ApiClient {
|
|
|
610
610
|
if (!text) {
|
|
611
611
|
return undefined;
|
|
612
612
|
}
|
|
613
|
-
|
|
613
|
+
try {
|
|
614
|
+
return JSON.parse(text);
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
if (error instanceof SyntaxError) {
|
|
618
|
+
throw new ServerError({
|
|
619
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
620
|
+
statusCode: response.status,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
throw error;
|
|
624
|
+
}
|
|
614
625
|
}
|
|
615
626
|
catch (error) {
|
|
616
627
|
// If it's already one of our errors, re-throw it
|
|
617
628
|
if (error.type && error.type.includes('Error')) {
|
|
618
629
|
throw error;
|
|
619
630
|
}
|
|
620
|
-
// Otherwise, it's
|
|
631
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
621
632
|
throw ErrorFactory.createNetworkError(error);
|
|
622
633
|
}
|
|
623
634
|
}
|
|
@@ -1147,9 +1158,9 @@ class PaginationHelpers {
|
|
|
1147
1158
|
* @returns Promise resolving to a paginated result
|
|
1148
1159
|
*/
|
|
1149
1160
|
static async getAllPaginated(params) {
|
|
1150
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1161
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1151
1162
|
const endpoint = getEndpoint(folderId);
|
|
1152
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1163
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1153
1164
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1154
1165
|
headers,
|
|
1155
1166
|
params: additionalParams,
|
|
@@ -1177,13 +1188,13 @@ class PaginationHelpers {
|
|
|
1177
1188
|
* @returns Promise resolving to an object with data and totalCount
|
|
1178
1189
|
*/
|
|
1179
1190
|
static async getAllNonPaginated(params) {
|
|
1180
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1191
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1181
1192
|
// Set default field names
|
|
1182
1193
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1183
1194
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1184
1195
|
// Determine endpoint and headers based on folderId
|
|
1185
1196
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1186
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1197
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1187
1198
|
// Make the API call based on method
|
|
1188
1199
|
let response;
|
|
1189
1200
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1242,6 +1253,7 @@ class PaginationHelpers {
|
|
|
1242
1253
|
serviceAccess: config.serviceAccess,
|
|
1243
1254
|
getEndpoint: config.getEndpoint,
|
|
1244
1255
|
folderId,
|
|
1256
|
+
headers: config.headers,
|
|
1245
1257
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1246
1258
|
additionalParams: prefixedOptions,
|
|
1247
1259
|
transformFn: config.transformFn,
|
|
@@ -1259,6 +1271,7 @@ class PaginationHelpers {
|
|
|
1259
1271
|
getAllEndpoint: config.getEndpoint(),
|
|
1260
1272
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1261
1273
|
folderId,
|
|
1274
|
+
headers: config.headers,
|
|
1262
1275
|
additionalParams: prefixedOptions,
|
|
1263
1276
|
transformFn: config.transformFn,
|
|
1264
1277
|
method: config.method,
|