@uipath/uipath-typescript 1.3.8 → 1.3.10
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 +44 -276
- package/dist/assets/index.mjs +44 -276
- package/dist/attachments/index.cjs +42 -273
- package/dist/attachments/index.mjs +42 -273
- package/dist/buckets/index.cjs +195 -276
- package/dist/buckets/index.d.ts +213 -1
- package/dist/buckets/index.mjs +195 -276
- package/dist/cases/index.cjs +427 -343
- package/dist/cases/index.d.ts +534 -2
- package/dist/cases/index.mjs +428 -344
- package/dist/conversational-agent/index.cjs +90 -287
- package/dist/conversational-agent/index.d.ts +62 -12
- package/dist/conversational-agent/index.mjs +90 -288
- package/dist/core/index.cjs +39 -289
- package/dist/core/index.d.ts +9 -98
- package/dist/core/index.mjs +40 -275
- package/dist/document-understanding/index.cjs +18 -1
- package/dist/document-understanding/index.d.ts +636 -610
- package/dist/document-understanding/index.mjs +18 -1
- package/dist/entities/index.cjs +251 -277
- package/dist/entities/index.d.ts +305 -2
- package/dist/entities/index.mjs +251 -277
- package/dist/feedback/index.cjs +42 -274
- package/dist/feedback/index.mjs +42 -274
- package/dist/index.cjs +998 -351
- package/dist/index.d.ts +2159 -762
- package/dist/index.mjs +998 -337
- package/dist/index.umd.js +1208 -237
- package/dist/jobs/index.cjs +44 -276
- package/dist/jobs/index.mjs +44 -276
- package/dist/maestro-processes/index.cjs +1761 -1717
- package/dist/maestro-processes/index.d.ts +430 -2
- package/dist/maestro-processes/index.mjs +1762 -1718
- package/dist/processes/index.cjs +72 -305
- package/dist/processes/index.d.ts +76 -26
- package/dist/processes/index.mjs +72 -305
- package/dist/queues/index.cjs +44 -276
- package/dist/queues/index.mjs +44 -276
- package/dist/tasks/index.cjs +44 -276
- package/dist/tasks/index.mjs +44 -276
- package/package.json +8 -10
|
@@ -112,8 +112,8 @@ var WordGroupType;
|
|
|
112
112
|
// Auto-generated from the OpenAPI spec — do not edit manually.
|
|
113
113
|
var ModelKind;
|
|
114
114
|
(function (ModelKind) {
|
|
115
|
-
ModelKind["Classifier"] = "Classifier";
|
|
116
115
|
ModelKind["Extractor"] = "Extractor";
|
|
116
|
+
ModelKind["Classifier"] = "Classifier";
|
|
117
117
|
})(ModelKind || (ModelKind = {}));
|
|
118
118
|
var ModelType;
|
|
119
119
|
(function (ModelType) {
|
|
@@ -122,6 +122,14 @@ var ModelType;
|
|
|
122
122
|
ModelType["Predefined"] = "Predefined";
|
|
123
123
|
})(ModelType || (ModelType = {}));
|
|
124
124
|
|
|
125
|
+
// Auto-generated from the OpenAPI spec — do not edit manually.
|
|
126
|
+
var ErrorSeverity;
|
|
127
|
+
(function (ErrorSeverity) {
|
|
128
|
+
ErrorSeverity["Info"] = "Info";
|
|
129
|
+
ErrorSeverity["Warning"] = "Warning";
|
|
130
|
+
ErrorSeverity["Error"] = "Error";
|
|
131
|
+
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
132
|
+
|
|
125
133
|
// Auto-generated from the OpenAPI spec — do not edit manually.
|
|
126
134
|
var ClassifierDocumentTypeType;
|
|
127
135
|
(function (ClassifierDocumentTypeType) {
|
|
@@ -146,6 +154,13 @@ var GptFieldType;
|
|
|
146
154
|
GptFieldType["Number"] = "Number";
|
|
147
155
|
GptFieldType["Text"] = "Text";
|
|
148
156
|
})(GptFieldType || (GptFieldType = {}));
|
|
157
|
+
var JobStatus;
|
|
158
|
+
(function (JobStatus) {
|
|
159
|
+
JobStatus["Succeeded"] = "Succeeded";
|
|
160
|
+
JobStatus["Failed"] = "Failed";
|
|
161
|
+
JobStatus["Running"] = "Running";
|
|
162
|
+
JobStatus["NotStarted"] = "NotStarted";
|
|
163
|
+
})(JobStatus || (JobStatus = {}));
|
|
149
164
|
var ValidationDisplayMode;
|
|
150
165
|
(function (ValidationDisplayMode) {
|
|
151
166
|
ValidationDisplayMode["Classic"] = "Classic";
|
|
@@ -232,8 +247,10 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
232
247
|
get DocumentActionPriority () { return DocumentActionPriority; },
|
|
233
248
|
get DocumentActionStatus () { return DocumentActionStatus; },
|
|
234
249
|
get DocumentActionType () { return DocumentActionType; },
|
|
250
|
+
get ErrorSeverity () { return ErrorSeverity; },
|
|
235
251
|
get FieldType () { return FieldType; },
|
|
236
252
|
get GptFieldType () { return GptFieldType; },
|
|
253
|
+
get JobStatus () { return JobStatus; },
|
|
237
254
|
get LogicalOperator () { return LogicalOperator; },
|
|
238
255
|
get MarkupType () { return MarkupType; },
|
|
239
256
|
get ModelKind () { return ModelKind; },
|
package/dist/entities/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var coreTelemetry = require('@uipath/core-telemetry');
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -611,14 +611,25 @@ class ApiClient {
|
|
|
611
611
|
if (!text) {
|
|
612
612
|
return undefined;
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
try {
|
|
615
|
+
return JSON.parse(text);
|
|
616
|
+
}
|
|
617
|
+
catch (error) {
|
|
618
|
+
if (error instanceof SyntaxError) {
|
|
619
|
+
throw new ServerError({
|
|
620
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
621
|
+
statusCode: response.status,
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
615
626
|
}
|
|
616
627
|
catch (error) {
|
|
617
628
|
// If it's already one of our errors, re-throw it
|
|
618
629
|
if (error.type && error.type.includes('Error')) {
|
|
619
630
|
throw error;
|
|
620
631
|
}
|
|
621
|
-
// Otherwise, it's
|
|
632
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
622
633
|
throw ErrorFactory.createNetworkError(error);
|
|
623
634
|
}
|
|
624
635
|
}
|
|
@@ -1240,9 +1251,9 @@ class PaginationHelpers {
|
|
|
1240
1251
|
* @returns Promise resolving to a paginated result
|
|
1241
1252
|
*/
|
|
1242
1253
|
static async getAllPaginated(params) {
|
|
1243
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1254
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1244
1255
|
const endpoint = getEndpoint(folderId);
|
|
1245
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1256
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1246
1257
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1247
1258
|
headers,
|
|
1248
1259
|
params: additionalParams,
|
|
@@ -1270,13 +1281,13 @@ class PaginationHelpers {
|
|
|
1270
1281
|
* @returns Promise resolving to an object with data and totalCount
|
|
1271
1282
|
*/
|
|
1272
1283
|
static async getAllNonPaginated(params) {
|
|
1273
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1284
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1274
1285
|
// Set default field names
|
|
1275
1286
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1276
1287
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1277
1288
|
// Determine endpoint and headers based on folderId
|
|
1278
1289
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1279
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1290
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1280
1291
|
// Make the API call based on method
|
|
1281
1292
|
let response;
|
|
1282
1293
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1335,6 +1346,7 @@ class PaginationHelpers {
|
|
|
1335
1346
|
serviceAccess: config.serviceAccess,
|
|
1336
1347
|
getEndpoint: config.getEndpoint,
|
|
1337
1348
|
folderId,
|
|
1349
|
+
headers: config.headers,
|
|
1338
1350
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1339
1351
|
additionalParams: prefixedOptions,
|
|
1340
1352
|
transformFn: config.transformFn,
|
|
@@ -1352,6 +1364,7 @@ class PaginationHelpers {
|
|
|
1352
1364
|
getAllEndpoint: config.getEndpoint(),
|
|
1353
1365
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1354
1366
|
folderId,
|
|
1367
|
+
headers: config.headers,
|
|
1355
1368
|
additionalParams: prefixedOptions,
|
|
1356
1369
|
transformFn: config.transformFn,
|
|
1357
1370
|
method: config.method,
|
|
@@ -1938,6 +1951,12 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
1938
1951
|
CHOICESETS: {
|
|
1939
1952
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
1940
1953
|
GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
|
|
1954
|
+
CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
1955
|
+
UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
|
|
1956
|
+
DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
|
|
1957
|
+
INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
|
|
1958
|
+
UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
|
|
1959
|
+
DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
|
|
1941
1960
|
},
|
|
1942
1961
|
};
|
|
1943
1962
|
|
|
@@ -2135,278 +2154,33 @@ const EntityFieldTypeMap = {
|
|
|
2135
2154
|
};
|
|
2136
2155
|
|
|
2137
2156
|
/**
|
|
2138
|
-
* SDK Telemetry constants
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
const
|
|
2149
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
2150
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
2151
|
-
const APP_NAME = "ApplicationName";
|
|
2152
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
2153
|
-
// Service and logger names
|
|
2154
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
2155
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
2156
|
-
// Event names
|
|
2157
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
2158
|
-
// Default value for unknown/empty attributes
|
|
2159
|
-
const UNKNOWN = "";
|
|
2160
|
-
|
|
2161
|
-
/**
|
|
2162
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
2163
|
-
*/
|
|
2164
|
-
class ApplicationInsightsEventExporter {
|
|
2165
|
-
constructor(connectionString) {
|
|
2166
|
-
this.connectionString = connectionString;
|
|
2167
|
-
}
|
|
2168
|
-
export(logs, resultCallback) {
|
|
2169
|
-
try {
|
|
2170
|
-
logs.forEach(logRecord => {
|
|
2171
|
-
this.sendAsCustomEvent(logRecord);
|
|
2172
|
-
});
|
|
2173
|
-
resultCallback({ code: 0 });
|
|
2174
|
-
}
|
|
2175
|
-
catch (error) {
|
|
2176
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
2177
|
-
resultCallback({ code: 2, error });
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
shutdown() {
|
|
2181
|
-
return Promise.resolve();
|
|
2182
|
-
}
|
|
2183
|
-
sendAsCustomEvent(logRecord) {
|
|
2184
|
-
// Get event name from body or attributes
|
|
2185
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
2186
|
-
const payload = {
|
|
2187
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
2188
|
-
time: new Date().toISOString(),
|
|
2189
|
-
iKey: this.extractInstrumentationKey(),
|
|
2190
|
-
data: {
|
|
2191
|
-
baseType: 'EventData',
|
|
2192
|
-
baseData: {
|
|
2193
|
-
ver: 2,
|
|
2194
|
-
name: eventName,
|
|
2195
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
2196
|
-
}
|
|
2197
|
-
},
|
|
2198
|
-
tags: {
|
|
2199
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
2200
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
2201
|
-
}
|
|
2202
|
-
};
|
|
2203
|
-
this.sendToApplicationInsights(payload);
|
|
2204
|
-
}
|
|
2205
|
-
extractInstrumentationKey() {
|
|
2206
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
2207
|
-
return match ? match[1] : '';
|
|
2208
|
-
}
|
|
2209
|
-
convertAttributesToProperties(attributes) {
|
|
2210
|
-
const properties = {};
|
|
2211
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
2212
|
-
properties[key] = String(value);
|
|
2213
|
-
});
|
|
2214
|
-
return properties;
|
|
2215
|
-
}
|
|
2216
|
-
async sendToApplicationInsights(payload) {
|
|
2217
|
-
try {
|
|
2218
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
2219
|
-
if (!ingestionEndpoint) {
|
|
2220
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
2221
|
-
return;
|
|
2222
|
-
}
|
|
2223
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
2224
|
-
const response = await fetch(url, {
|
|
2225
|
-
method: 'POST',
|
|
2226
|
-
headers: {
|
|
2227
|
-
'Content-Type': 'application/json',
|
|
2228
|
-
},
|
|
2229
|
-
body: JSON.stringify(payload)
|
|
2230
|
-
});
|
|
2231
|
-
if (!response.ok) {
|
|
2232
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
catch (error) {
|
|
2236
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
extractIngestionEndpoint() {
|
|
2240
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2241
|
-
return match ? match[1] : '';
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
/**
|
|
2245
|
-
* Singleton telemetry client
|
|
2246
|
-
*/
|
|
2247
|
-
class TelemetryClient {
|
|
2248
|
-
constructor() {
|
|
2249
|
-
this.isInitialized = false;
|
|
2250
|
-
}
|
|
2251
|
-
static getInstance() {
|
|
2252
|
-
if (!TelemetryClient.instance) {
|
|
2253
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2254
|
-
}
|
|
2255
|
-
return TelemetryClient.instance;
|
|
2256
|
-
}
|
|
2257
|
-
/**
|
|
2258
|
-
* Initialize telemetry
|
|
2259
|
-
*/
|
|
2260
|
-
initialize(config) {
|
|
2261
|
-
if (this.isInitialized) {
|
|
2262
|
-
return;
|
|
2263
|
-
}
|
|
2264
|
-
this.isInitialized = true;
|
|
2265
|
-
if (config) {
|
|
2266
|
-
this.telemetryContext = config;
|
|
2267
|
-
}
|
|
2268
|
-
try {
|
|
2269
|
-
const connectionString = this.getConnectionString();
|
|
2270
|
-
if (!connectionString) {
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2273
|
-
this.setupTelemetryProvider(connectionString);
|
|
2274
|
-
}
|
|
2275
|
-
catch (error) {
|
|
2276
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2277
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
getConnectionString() {
|
|
2281
|
-
const connectionString = CONNECTION_STRING;
|
|
2282
|
-
return connectionString;
|
|
2283
|
-
}
|
|
2284
|
-
setupTelemetryProvider(connectionString) {
|
|
2285
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2286
|
-
const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
|
|
2287
|
-
this.logProvider = new sdkLogs.LoggerProvider({
|
|
2288
|
-
processors: [processor]
|
|
2289
|
-
});
|
|
2290
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2291
|
-
}
|
|
2292
|
-
/**
|
|
2293
|
-
* Track a telemetry event
|
|
2294
|
-
*/
|
|
2295
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2296
|
-
try {
|
|
2297
|
-
// Skip if logger not initialized
|
|
2298
|
-
if (!this.logger) {
|
|
2299
|
-
return;
|
|
2300
|
-
}
|
|
2301
|
-
const finalDisplayName = name || eventName;
|
|
2302
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2303
|
-
// Emit as log
|
|
2304
|
-
this.logger.emit({
|
|
2305
|
-
body: finalDisplayName,
|
|
2306
|
-
attributes: attributes,
|
|
2307
|
-
timestamp: Date.now(),
|
|
2308
|
-
});
|
|
2309
|
-
}
|
|
2310
|
-
catch (error) {
|
|
2311
|
-
// Silent failure
|
|
2312
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
/**
|
|
2316
|
-
* Get enriched attributes for telemetry events
|
|
2317
|
-
*/
|
|
2318
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2319
|
-
const attributes = {
|
|
2320
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2321
|
-
[VERSION]: SDK_VERSION,
|
|
2322
|
-
[SERVICE]: eventName,
|
|
2323
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2324
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2325
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2326
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2327
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2328
|
-
...extraAttributes,
|
|
2329
|
-
};
|
|
2330
|
-
return attributes;
|
|
2331
|
-
}
|
|
2332
|
-
/**
|
|
2333
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2334
|
-
*/
|
|
2335
|
-
createCloudUrl() {
|
|
2336
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2337
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2338
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2339
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2340
|
-
return UNKNOWN;
|
|
2341
|
-
}
|
|
2342
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
// Export singleton instance
|
|
2346
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
2157
|
+
* SDK Telemetry constants.
|
|
2158
|
+
*
|
|
2159
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
2160
|
+
* here. The Application Insights connection string is injected into
|
|
2161
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
2162
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
2163
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
2164
|
+
* SDK's public API.
|
|
2165
|
+
*/
|
|
2166
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
2167
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2347
2168
|
|
|
2348
2169
|
/**
|
|
2349
|
-
*
|
|
2350
|
-
*/
|
|
2351
|
-
/**
|
|
2352
|
-
* Common tracking logic shared between method and function decorators
|
|
2353
|
-
*/
|
|
2354
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2355
|
-
return function (...args) {
|
|
2356
|
-
// Determine if we should track this call
|
|
2357
|
-
let shouldTrack = true;
|
|
2358
|
-
if (opts.condition !== undefined) {
|
|
2359
|
-
if (typeof opts.condition === 'function') {
|
|
2360
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2361
|
-
}
|
|
2362
|
-
else {
|
|
2363
|
-
shouldTrack = opts.condition;
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
// Track the event if enabled
|
|
2367
|
-
if (shouldTrack) {
|
|
2368
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2369
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2370
|
-
? nameOrOptions
|
|
2371
|
-
: fallbackName;
|
|
2372
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2373
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2374
|
-
}
|
|
2375
|
-
// Execute the original function
|
|
2376
|
-
return originalFunction.apply(this, args);
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
/**
|
|
2380
|
-
* Track decorator that can be used to automatically track function calls
|
|
2381
|
-
*
|
|
2382
|
-
* Usage:
|
|
2383
|
-
* @track("Service.Method")
|
|
2384
|
-
* function myFunction() { ... }
|
|
2385
|
-
*
|
|
2386
|
-
* @track("Queue.GetAll")
|
|
2387
|
-
* async getAll() { ... }
|
|
2170
|
+
* UiPath TypeScript SDK Telemetry
|
|
2388
2171
|
*
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2391
|
-
*
|
|
2392
|
-
*
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
2402
|
-
// Method decorator
|
|
2403
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
2404
|
-
return descriptor;
|
|
2405
|
-
}
|
|
2406
|
-
// Function decorator
|
|
2407
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2408
|
-
};
|
|
2409
|
-
}
|
|
2172
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
2173
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
2174
|
+
* does this independently, so events carry their own consumer's identity
|
|
2175
|
+
* and tenant context.
|
|
2176
|
+
*/
|
|
2177
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
2178
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
2179
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
2180
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
2181
|
+
const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
|
|
2182
|
+
const track = coreTelemetry.createTrack(sdkClient);
|
|
2183
|
+
coreTelemetry.createTrackEvent(sdkClient);
|
|
2410
2184
|
|
|
2411
2185
|
/**
|
|
2412
2186
|
* Service for interacting with the Data Fabric Entity API
|
|
@@ -3512,7 +3286,7 @@ class ChoiceSetService extends BaseService {
|
|
|
3512
3286
|
*
|
|
3513
3287
|
* @example
|
|
3514
3288
|
* ```typescript
|
|
3515
|
-
* import { ChoiceSets } from '@uipath/uipath-typescript/
|
|
3289
|
+
* import { ChoiceSets } from '@uipath/uipath-typescript/entities';
|
|
3516
3290
|
*
|
|
3517
3291
|
* const choiceSets = new ChoiceSets(sdk);
|
|
3518
3292
|
*
|
|
@@ -3561,6 +3335,188 @@ class ChoiceSetService extends BaseService {
|
|
|
3561
3335
|
}
|
|
3562
3336
|
}, options);
|
|
3563
3337
|
}
|
|
3338
|
+
/**
|
|
3339
|
+
* Creates a new Data Fabric choice set
|
|
3340
|
+
*
|
|
3341
|
+
* @param name - Choice set name. Must start with a
|
|
3342
|
+
* letter, may contain only letters, numbers, and underscores, length
|
|
3343
|
+
* 3–100 characters (e.g., `"expenseTypes"`).
|
|
3344
|
+
* @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
|
|
3345
|
+
* @returns Promise resolving to the UUID of the created choice set
|
|
3346
|
+
*
|
|
3347
|
+
* @example
|
|
3348
|
+
* ```typescript
|
|
3349
|
+
* import { ChoiceSets } from '@uipath/uipath-typescript/entities';
|
|
3350
|
+
*
|
|
3351
|
+
* const choicesets = new ChoiceSets(sdk);
|
|
3352
|
+
*
|
|
3353
|
+
* // Minimal create
|
|
3354
|
+
* const expenseTypesId = await choicesets.create("expense_types");
|
|
3355
|
+
*
|
|
3356
|
+
* // With display name and description
|
|
3357
|
+
* const priorityLevelsId = await choicesets.create("priority_levels", {
|
|
3358
|
+
* displayName: "Priority Levels",
|
|
3359
|
+
* description: "Ticket priority categories",
|
|
3360
|
+
* });
|
|
3361
|
+
* ```
|
|
3362
|
+
* @internal
|
|
3363
|
+
*/
|
|
3364
|
+
async create(name, options) {
|
|
3365
|
+
const opts = options ?? {};
|
|
3366
|
+
const payload = {
|
|
3367
|
+
...(opts.description !== undefined && { description: opts.description }),
|
|
3368
|
+
...(opts.displayName !== undefined && { displayName: opts.displayName }),
|
|
3369
|
+
entityDefinition: {
|
|
3370
|
+
name,
|
|
3371
|
+
fields: [],
|
|
3372
|
+
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
3373
|
+
},
|
|
3374
|
+
};
|
|
3375
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
|
|
3376
|
+
return response.data;
|
|
3377
|
+
}
|
|
3378
|
+
/**
|
|
3379
|
+
* Updates an existing choice set's metadata (display name and/or description).
|
|
3380
|
+
*
|
|
3381
|
+
* **At least one of `displayName` or `description` must be provided** —
|
|
3382
|
+
* the call throws `ValidationError` if both are omitted.
|
|
3383
|
+
*
|
|
3384
|
+
* @param choiceSetId - UUID of the choice set to update
|
|
3385
|
+
* @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
|
|
3386
|
+
* @returns Promise resolving when the update is complete
|
|
3387
|
+
*
|
|
3388
|
+
* @example
|
|
3389
|
+
* ```typescript
|
|
3390
|
+
* // First, get the choice set ID using getAll()
|
|
3391
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3392
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3393
|
+
*
|
|
3394
|
+
* await choicesets.updateById(expenseTypes.id, {
|
|
3395
|
+
* displayName: "Expense Categories",
|
|
3396
|
+
* description: "Updated description",
|
|
3397
|
+
* });
|
|
3398
|
+
* ```
|
|
3399
|
+
* @internal
|
|
3400
|
+
*/
|
|
3401
|
+
async updateById(choiceSetId, options) {
|
|
3402
|
+
if (options.displayName === undefined && options.description === undefined) {
|
|
3403
|
+
throw new ValidationError({
|
|
3404
|
+
message: 'updateById requires at least one of displayName or description.',
|
|
3405
|
+
});
|
|
3406
|
+
}
|
|
3407
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
|
|
3408
|
+
...(options.displayName !== undefined && { displayName: options.displayName }),
|
|
3409
|
+
...(options.description !== undefined && { description: options.description }),
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
/**
|
|
3413
|
+
* Deletes a Data Fabric choice set and all its values.
|
|
3414
|
+
*
|
|
3415
|
+
* @param choiceSetId - UUID of the choice set to delete
|
|
3416
|
+
* @returns Promise resolving when the choice set is deleted
|
|
3417
|
+
*
|
|
3418
|
+
* @example
|
|
3419
|
+
* ```typescript
|
|
3420
|
+
* // First, get the choice set ID using getAll()
|
|
3421
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3422
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3423
|
+
*
|
|
3424
|
+
* await choicesets.deleteById(expenseTypes.id);
|
|
3425
|
+
* ```
|
|
3426
|
+
* @internal
|
|
3427
|
+
*/
|
|
3428
|
+
async deleteById(choiceSetId) {
|
|
3429
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
|
|
3430
|
+
}
|
|
3431
|
+
/**
|
|
3432
|
+
* Inserts a single value into a choice set.
|
|
3433
|
+
*
|
|
3434
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3435
|
+
* @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
|
|
3436
|
+
* @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
|
|
3437
|
+
* @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
|
|
3438
|
+
*
|
|
3439
|
+
* @example
|
|
3440
|
+
* ```typescript
|
|
3441
|
+
* // First, get the choice set ID using getAll()
|
|
3442
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3443
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3444
|
+
*
|
|
3445
|
+
* const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
|
|
3446
|
+
* displayName: 'Travel',
|
|
3447
|
+
* });
|
|
3448
|
+
* console.log(inserted.id);
|
|
3449
|
+
* ```
|
|
3450
|
+
* @internal
|
|
3451
|
+
*/
|
|
3452
|
+
async insertValueById(choiceSetId, name, options) {
|
|
3453
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
3454
|
+
const payload = {
|
|
3455
|
+
Name: name,
|
|
3456
|
+
...(options?.displayName !== undefined && { DisplayName: options.displayName }),
|
|
3457
|
+
};
|
|
3458
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
|
|
3459
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
3460
|
+
return transformData(camelCased, EntityMap);
|
|
3461
|
+
}
|
|
3462
|
+
/**
|
|
3463
|
+
* Updates an existing choice-set value's display name.
|
|
3464
|
+
*
|
|
3465
|
+
* Only `displayName` is mutable; the value's `name` (identifier) is fixed at
|
|
3466
|
+
* insert time and cannot be changed.
|
|
3467
|
+
*
|
|
3468
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3469
|
+
* @param valueId - UUID of the value to update
|
|
3470
|
+
* @param displayName - New human-readable display name for the value
|
|
3471
|
+
* @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
|
|
3472
|
+
*
|
|
3473
|
+
* @example
|
|
3474
|
+
* ```typescript
|
|
3475
|
+
* // Get the choice set ID from getAll() and the value ID from getById()
|
|
3476
|
+
* const allChoiceSets = await choicesets.getAll();
|
|
3477
|
+
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
3478
|
+
* const values = await choicesets.getById(expenseTypes.id);
|
|
3479
|
+
* const travel = values.items.find(v => v.name === 'TRAVEL');
|
|
3480
|
+
*
|
|
3481
|
+
* await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
|
|
3482
|
+
* ```
|
|
3483
|
+
* @internal
|
|
3484
|
+
*/
|
|
3485
|
+
async updateValueById(choiceSetId, valueId, displayName) {
|
|
3486
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
3487
|
+
const payload = { DisplayName: displayName };
|
|
3488
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
|
|
3489
|
+
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
3490
|
+
return transformData(camelCased, EntityMap);
|
|
3491
|
+
}
|
|
3492
|
+
/**
|
|
3493
|
+
* Deletes one or more values from a choice set.
|
|
3494
|
+
*
|
|
3495
|
+
* @param choiceSetId - UUID of the parent choice set
|
|
3496
|
+
* @param valueIds - Array of value UUIDs to delete
|
|
3497
|
+
* @returns Promise resolving when the values are deleted
|
|
3498
|
+
*
|
|
3499
|
+
* @example
|
|
3500
|
+
* ```typescript
|
|
3501
|
+
* // Get the value IDs from getById()
|
|
3502
|
+
* const values = await choicesets.getById('<choiceSetId>');
|
|
3503
|
+
* const idsToDelete = values.items.slice(0, 2).map(v => v.id);
|
|
3504
|
+
*
|
|
3505
|
+
* await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
|
|
3506
|
+
* ```
|
|
3507
|
+
* @internal
|
|
3508
|
+
*/
|
|
3509
|
+
async deleteValuesById(choiceSetId, valueIds) {
|
|
3510
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
|
|
3511
|
+
}
|
|
3512
|
+
async resolveChoiceSetName(choiceSetId) {
|
|
3513
|
+
const all = await this.getAll();
|
|
3514
|
+
const match = all.find(cs => cs.id === choiceSetId);
|
|
3515
|
+
if (!match) {
|
|
3516
|
+
throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
|
|
3517
|
+
}
|
|
3518
|
+
return match.name;
|
|
3519
|
+
}
|
|
3564
3520
|
}
|
|
3565
3521
|
__decorate([
|
|
3566
3522
|
track('Choicesets.GetAll')
|
|
@@ -3568,6 +3524,24 @@ __decorate([
|
|
|
3568
3524
|
__decorate([
|
|
3569
3525
|
track('Choicesets.GetById')
|
|
3570
3526
|
], ChoiceSetService.prototype, "getById", null);
|
|
3527
|
+
__decorate([
|
|
3528
|
+
track('Choicesets.Create')
|
|
3529
|
+
], ChoiceSetService.prototype, "create", null);
|
|
3530
|
+
__decorate([
|
|
3531
|
+
track('Choicesets.UpdateById')
|
|
3532
|
+
], ChoiceSetService.prototype, "updateById", null);
|
|
3533
|
+
__decorate([
|
|
3534
|
+
track('Choicesets.DeleteById')
|
|
3535
|
+
], ChoiceSetService.prototype, "deleteById", null);
|
|
3536
|
+
__decorate([
|
|
3537
|
+
track('Choicesets.InsertValueById')
|
|
3538
|
+
], ChoiceSetService.prototype, "insertValueById", null);
|
|
3539
|
+
__decorate([
|
|
3540
|
+
track('Choicesets.UpdateValueById')
|
|
3541
|
+
], ChoiceSetService.prototype, "updateValueById", null);
|
|
3542
|
+
__decorate([
|
|
3543
|
+
track('Choicesets.DeleteValuesById')
|
|
3544
|
+
], ChoiceSetService.prototype, "deleteValuesById", null);
|
|
3571
3545
|
|
|
3572
3546
|
exports.ChoiceSetService = ChoiceSetService;
|
|
3573
3547
|
exports.ChoiceSets = ChoiceSetService;
|