@uipath/uipath-typescript 1.3.7 → 1.3.9
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 +64 -274
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.mjs +64 -274
- package/dist/attachments/index.cjs +62 -271
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.mjs +62 -271
- package/dist/buckets/index.cjs +93 -274
- package/dist/buckets/index.d.ts +51 -1
- package/dist/buckets/index.mjs +93 -274
- package/dist/cases/index.cjs +580 -336
- package/dist/cases/index.d.ts +690 -3
- package/dist/cases/index.mjs +581 -337
- package/dist/conversational-agent/index.cjs +110 -285
- package/dist/conversational-agent/index.d.ts +63 -12
- package/dist/conversational-agent/index.mjs +110 -286
- 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 +64 -274
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.mjs +64 -274
- package/dist/feedback/index.cjs +313 -276
- package/dist/feedback/index.d.ts +418 -12
- package/dist/feedback/index.mjs +313 -276
- package/dist/index.cjs +777 -297
- package/dist/index.d.ts +2005 -721
- package/dist/index.mjs +777 -283
- package/dist/index.umd.js +966 -162
- package/dist/jobs/index.cjs +64 -274
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.mjs +64 -274
- package/dist/maestro-processes/index.cjs +1789 -1686
- package/dist/maestro-processes/index.d.ts +431 -2
- package/dist/maestro-processes/index.mjs +1790 -1687
- package/dist/processes/index.cjs +64 -274
- package/dist/processes/index.d.ts +1 -0
- package/dist/processes/index.mjs +64 -274
- package/dist/queues/index.cjs +64 -274
- package/dist/queues/index.d.ts +1 -0
- package/dist/queues/index.mjs +64 -274
- package/dist/tasks/index.cjs +64 -274
- package/dist/tasks/index.d.ts +1 -0
- package/dist/tasks/index.mjs +64 -274
- 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.
|
|
@@ -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;
|
|
@@ -1563,9 +1589,17 @@ class BaseService {
|
|
|
1563
1589
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1564
1590
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1565
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;
|
|
1566
1595
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
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;
|
|
1569
1603
|
}
|
|
1570
1604
|
{
|
|
1571
1605
|
requestParams[countParam] = true;
|
|
@@ -1596,7 +1630,8 @@ class BaseService {
|
|
|
1596
1630
|
// Extract items and metadata
|
|
1597
1631
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1598
1632
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1599
|
-
const
|
|
1633
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1634
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1600
1635
|
const continuationToken = response.data[continuationTokenField];
|
|
1601
1636
|
// Determine if there are more pages
|
|
1602
1637
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -2100,278 +2135,33 @@ const EntityFieldTypeMap = {
|
|
|
2100
2135
|
};
|
|
2101
2136
|
|
|
2102
2137
|
/**
|
|
2103
|
-
* SDK Telemetry constants
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
const
|
|
2114
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
2115
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
2116
|
-
const APP_NAME = "ApplicationName";
|
|
2117
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
2118
|
-
// Service and logger names
|
|
2119
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
2120
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
2121
|
-
// Event names
|
|
2122
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
2123
|
-
// Default value for unknown/empty attributes
|
|
2124
|
-
const UNKNOWN = "";
|
|
2125
|
-
|
|
2126
|
-
/**
|
|
2127
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
2128
|
-
*/
|
|
2129
|
-
class ApplicationInsightsEventExporter {
|
|
2130
|
-
constructor(connectionString) {
|
|
2131
|
-
this.connectionString = connectionString;
|
|
2132
|
-
}
|
|
2133
|
-
export(logs, resultCallback) {
|
|
2134
|
-
try {
|
|
2135
|
-
logs.forEach(logRecord => {
|
|
2136
|
-
this.sendAsCustomEvent(logRecord);
|
|
2137
|
-
});
|
|
2138
|
-
resultCallback({ code: 0 });
|
|
2139
|
-
}
|
|
2140
|
-
catch (error) {
|
|
2141
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
2142
|
-
resultCallback({ code: 2, error });
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
shutdown() {
|
|
2146
|
-
return Promise.resolve();
|
|
2147
|
-
}
|
|
2148
|
-
sendAsCustomEvent(logRecord) {
|
|
2149
|
-
// Get event name from body or attributes
|
|
2150
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
2151
|
-
const payload = {
|
|
2152
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
2153
|
-
time: new Date().toISOString(),
|
|
2154
|
-
iKey: this.extractInstrumentationKey(),
|
|
2155
|
-
data: {
|
|
2156
|
-
baseType: 'EventData',
|
|
2157
|
-
baseData: {
|
|
2158
|
-
ver: 2,
|
|
2159
|
-
name: eventName,
|
|
2160
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
2161
|
-
}
|
|
2162
|
-
},
|
|
2163
|
-
tags: {
|
|
2164
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
2165
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
2166
|
-
}
|
|
2167
|
-
};
|
|
2168
|
-
this.sendToApplicationInsights(payload);
|
|
2169
|
-
}
|
|
2170
|
-
extractInstrumentationKey() {
|
|
2171
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
2172
|
-
return match ? match[1] : '';
|
|
2173
|
-
}
|
|
2174
|
-
convertAttributesToProperties(attributes) {
|
|
2175
|
-
const properties = {};
|
|
2176
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
2177
|
-
properties[key] = String(value);
|
|
2178
|
-
});
|
|
2179
|
-
return properties;
|
|
2180
|
-
}
|
|
2181
|
-
async sendToApplicationInsights(payload) {
|
|
2182
|
-
try {
|
|
2183
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
2184
|
-
if (!ingestionEndpoint) {
|
|
2185
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
2186
|
-
return;
|
|
2187
|
-
}
|
|
2188
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
2189
|
-
const response = await fetch(url, {
|
|
2190
|
-
method: 'POST',
|
|
2191
|
-
headers: {
|
|
2192
|
-
'Content-Type': 'application/json',
|
|
2193
|
-
},
|
|
2194
|
-
body: JSON.stringify(payload)
|
|
2195
|
-
});
|
|
2196
|
-
if (!response.ok) {
|
|
2197
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
catch (error) {
|
|
2201
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
extractIngestionEndpoint() {
|
|
2205
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2206
|
-
return match ? match[1] : '';
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
/**
|
|
2210
|
-
* Singleton telemetry client
|
|
2211
|
-
*/
|
|
2212
|
-
class TelemetryClient {
|
|
2213
|
-
constructor() {
|
|
2214
|
-
this.isInitialized = false;
|
|
2215
|
-
}
|
|
2216
|
-
static getInstance() {
|
|
2217
|
-
if (!TelemetryClient.instance) {
|
|
2218
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2219
|
-
}
|
|
2220
|
-
return TelemetryClient.instance;
|
|
2221
|
-
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Initialize telemetry
|
|
2224
|
-
*/
|
|
2225
|
-
initialize(config) {
|
|
2226
|
-
if (this.isInitialized) {
|
|
2227
|
-
return;
|
|
2228
|
-
}
|
|
2229
|
-
this.isInitialized = true;
|
|
2230
|
-
if (config) {
|
|
2231
|
-
this.telemetryContext = config;
|
|
2232
|
-
}
|
|
2233
|
-
try {
|
|
2234
|
-
const connectionString = this.getConnectionString();
|
|
2235
|
-
if (!connectionString) {
|
|
2236
|
-
return;
|
|
2237
|
-
}
|
|
2238
|
-
this.setupTelemetryProvider(connectionString);
|
|
2239
|
-
}
|
|
2240
|
-
catch (error) {
|
|
2241
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2242
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
getConnectionString() {
|
|
2246
|
-
const connectionString = CONNECTION_STRING;
|
|
2247
|
-
return connectionString;
|
|
2248
|
-
}
|
|
2249
|
-
setupTelemetryProvider(connectionString) {
|
|
2250
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2251
|
-
const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
|
|
2252
|
-
this.logProvider = new sdkLogs.LoggerProvider({
|
|
2253
|
-
processors: [processor]
|
|
2254
|
-
});
|
|
2255
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2256
|
-
}
|
|
2257
|
-
/**
|
|
2258
|
-
* Track a telemetry event
|
|
2259
|
-
*/
|
|
2260
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2261
|
-
try {
|
|
2262
|
-
// Skip if logger not initialized
|
|
2263
|
-
if (!this.logger) {
|
|
2264
|
-
return;
|
|
2265
|
-
}
|
|
2266
|
-
const finalDisplayName = name || eventName;
|
|
2267
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2268
|
-
// Emit as log
|
|
2269
|
-
this.logger.emit({
|
|
2270
|
-
body: finalDisplayName,
|
|
2271
|
-
attributes: attributes,
|
|
2272
|
-
timestamp: Date.now(),
|
|
2273
|
-
});
|
|
2274
|
-
}
|
|
2275
|
-
catch (error) {
|
|
2276
|
-
// Silent failure
|
|
2277
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Get enriched attributes for telemetry events
|
|
2282
|
-
*/
|
|
2283
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2284
|
-
const attributes = {
|
|
2285
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2286
|
-
[VERSION]: SDK_VERSION,
|
|
2287
|
-
[SERVICE]: eventName,
|
|
2288
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2289
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2290
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2291
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2292
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2293
|
-
...extraAttributes,
|
|
2294
|
-
};
|
|
2295
|
-
return attributes;
|
|
2296
|
-
}
|
|
2297
|
-
/**
|
|
2298
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2299
|
-
*/
|
|
2300
|
-
createCloudUrl() {
|
|
2301
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2302
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2303
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2304
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2305
|
-
return UNKNOWN;
|
|
2306
|
-
}
|
|
2307
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
// Export singleton instance
|
|
2311
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
2138
|
+
* SDK Telemetry constants.
|
|
2139
|
+
*
|
|
2140
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
2141
|
+
* here. The Application Insights connection string is injected into
|
|
2142
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
2143
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
2144
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
2145
|
+
* SDK's public API.
|
|
2146
|
+
*/
|
|
2147
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
2148
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2312
2149
|
|
|
2313
2150
|
/**
|
|
2314
|
-
*
|
|
2315
|
-
*/
|
|
2316
|
-
/**
|
|
2317
|
-
* Common tracking logic shared between method and function decorators
|
|
2318
|
-
*/
|
|
2319
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2320
|
-
return function (...args) {
|
|
2321
|
-
// Determine if we should track this call
|
|
2322
|
-
let shouldTrack = true;
|
|
2323
|
-
if (opts.condition !== undefined) {
|
|
2324
|
-
if (typeof opts.condition === 'function') {
|
|
2325
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2326
|
-
}
|
|
2327
|
-
else {
|
|
2328
|
-
shouldTrack = opts.condition;
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
// Track the event if enabled
|
|
2332
|
-
if (shouldTrack) {
|
|
2333
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2334
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2335
|
-
? nameOrOptions
|
|
2336
|
-
: fallbackName;
|
|
2337
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2338
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2339
|
-
}
|
|
2340
|
-
// Execute the original function
|
|
2341
|
-
return originalFunction.apply(this, args);
|
|
2342
|
-
};
|
|
2343
|
-
}
|
|
2344
|
-
/**
|
|
2345
|
-
* Track decorator that can be used to automatically track function calls
|
|
2151
|
+
* UiPath TypeScript SDK Telemetry
|
|
2346
2152
|
*
|
|
2347
|
-
*
|
|
2348
|
-
*
|
|
2349
|
-
*
|
|
2350
|
-
*
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
*
|
|
2360
|
-
* @track("Processes.Start", { attributes: { customProp: "value" } })
|
|
2361
|
-
* function myFunction() { ... }
|
|
2362
|
-
*/
|
|
2363
|
-
function track(nameOrOptions, options) {
|
|
2364
|
-
return function decorator(_target, propertyKey, descriptor) {
|
|
2365
|
-
const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
|
|
2366
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
2367
|
-
// Method decorator
|
|
2368
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
2369
|
-
return descriptor;
|
|
2370
|
-
}
|
|
2371
|
-
// Function decorator
|
|
2372
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2373
|
-
};
|
|
2374
|
-
}
|
|
2153
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
2154
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
2155
|
+
* does this independently, so events carry their own consumer's identity
|
|
2156
|
+
* and tenant context.
|
|
2157
|
+
*/
|
|
2158
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
2159
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
2160
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
2161
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
2162
|
+
const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
|
|
2163
|
+
const track = coreTelemetry.createTrack(sdkClient);
|
|
2164
|
+
coreTelemetry.createTrackEvent(sdkClient);
|
|
2375
2165
|
|
|
2376
2166
|
/**
|
|
2377
2167
|
* Service for interacting with the Data Fabric Entity API
|