@uipath/uipath-typescript 1.3.8 → 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 +25 -270
- package/dist/assets/index.mjs +25 -270
- package/dist/attachments/index.cjs +23 -267
- package/dist/attachments/index.mjs +23 -267
- package/dist/buckets/index.cjs +54 -270
- package/dist/buckets/index.d.ts +50 -1
- package/dist/buckets/index.mjs +54 -270
- package/dist/cases/index.cjs +408 -337
- package/dist/cases/index.d.ts +534 -2
- package/dist/cases/index.mjs +409 -338
- package/dist/conversational-agent/index.cjs +71 -281
- package/dist/conversational-agent/index.d.ts +62 -12
- package/dist/conversational-agent/index.mjs +71 -282
- 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 +25 -270
- package/dist/entities/index.mjs +25 -270
- package/dist/feedback/index.cjs +23 -268
- package/dist/feedback/index.mjs +23 -268
- package/dist/index.cjs +600 -293
- package/dist/index.d.ts +1603 -722
- package/dist/index.mjs +600 -279
- package/dist/index.umd.js +789 -158
- package/dist/jobs/index.cjs +25 -270
- package/dist/jobs/index.mjs +25 -270
- package/dist/maestro-processes/index.cjs +1751 -1720
- package/dist/maestro-processes/index.d.ts +430 -2
- package/dist/maestro-processes/index.mjs +1752 -1721
- package/dist/processes/index.cjs +25 -270
- package/dist/processes/index.mjs +25 -270
- package/dist/queues/index.cjs +25 -270
- package/dist/queues/index.mjs +25 -270
- package/dist/tasks/index.cjs +25 -270
- package/dist/tasks/index.mjs +25 -270
- package/package.json +8 -10
package/dist/buckets/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getOrCreateClient, createTrack, createTrackEvent } from '@uipath/core-telemetry';
|
|
2
2
|
|
|
3
3
|
/******************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1930,278 +1930,33 @@ const BucketMap = {
|
|
|
1930
1930
|
};
|
|
1931
1931
|
|
|
1932
1932
|
/**
|
|
1933
|
-
* SDK Telemetry constants
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
1945
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
1946
|
-
const APP_NAME = "ApplicationName";
|
|
1947
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
1948
|
-
// Service and logger names
|
|
1949
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
1950
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
1951
|
-
// Event names
|
|
1952
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
1953
|
-
// Default value for unknown/empty attributes
|
|
1954
|
-
const UNKNOWN = "";
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
1958
|
-
*/
|
|
1959
|
-
class ApplicationInsightsEventExporter {
|
|
1960
|
-
constructor(connectionString) {
|
|
1961
|
-
this.connectionString = connectionString;
|
|
1962
|
-
}
|
|
1963
|
-
export(logs, resultCallback) {
|
|
1964
|
-
try {
|
|
1965
|
-
logs.forEach(logRecord => {
|
|
1966
|
-
this.sendAsCustomEvent(logRecord);
|
|
1967
|
-
});
|
|
1968
|
-
resultCallback({ code: 0 });
|
|
1969
|
-
}
|
|
1970
|
-
catch (error) {
|
|
1971
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
1972
|
-
resultCallback({ code: 2, error });
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
shutdown() {
|
|
1976
|
-
return Promise.resolve();
|
|
1977
|
-
}
|
|
1978
|
-
sendAsCustomEvent(logRecord) {
|
|
1979
|
-
// Get event name from body or attributes
|
|
1980
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
1981
|
-
const payload = {
|
|
1982
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
1983
|
-
time: new Date().toISOString(),
|
|
1984
|
-
iKey: this.extractInstrumentationKey(),
|
|
1985
|
-
data: {
|
|
1986
|
-
baseType: 'EventData',
|
|
1987
|
-
baseData: {
|
|
1988
|
-
ver: 2,
|
|
1989
|
-
name: eventName,
|
|
1990
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
1991
|
-
}
|
|
1992
|
-
},
|
|
1993
|
-
tags: {
|
|
1994
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
1995
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
1996
|
-
}
|
|
1997
|
-
};
|
|
1998
|
-
this.sendToApplicationInsights(payload);
|
|
1999
|
-
}
|
|
2000
|
-
extractInstrumentationKey() {
|
|
2001
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
2002
|
-
return match ? match[1] : '';
|
|
2003
|
-
}
|
|
2004
|
-
convertAttributesToProperties(attributes) {
|
|
2005
|
-
const properties = {};
|
|
2006
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
2007
|
-
properties[key] = String(value);
|
|
2008
|
-
});
|
|
2009
|
-
return properties;
|
|
2010
|
-
}
|
|
2011
|
-
async sendToApplicationInsights(payload) {
|
|
2012
|
-
try {
|
|
2013
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
2014
|
-
if (!ingestionEndpoint) {
|
|
2015
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
2016
|
-
return;
|
|
2017
|
-
}
|
|
2018
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
2019
|
-
const response = await fetch(url, {
|
|
2020
|
-
method: 'POST',
|
|
2021
|
-
headers: {
|
|
2022
|
-
'Content-Type': 'application/json',
|
|
2023
|
-
},
|
|
2024
|
-
body: JSON.stringify(payload)
|
|
2025
|
-
});
|
|
2026
|
-
if (!response.ok) {
|
|
2027
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
catch (error) {
|
|
2031
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
extractIngestionEndpoint() {
|
|
2035
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2036
|
-
return match ? match[1] : '';
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
/**
|
|
2040
|
-
* Singleton telemetry client
|
|
2041
|
-
*/
|
|
2042
|
-
class TelemetryClient {
|
|
2043
|
-
constructor() {
|
|
2044
|
-
this.isInitialized = false;
|
|
2045
|
-
}
|
|
2046
|
-
static getInstance() {
|
|
2047
|
-
if (!TelemetryClient.instance) {
|
|
2048
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2049
|
-
}
|
|
2050
|
-
return TelemetryClient.instance;
|
|
2051
|
-
}
|
|
2052
|
-
/**
|
|
2053
|
-
* Initialize telemetry
|
|
2054
|
-
*/
|
|
2055
|
-
initialize(config) {
|
|
2056
|
-
if (this.isInitialized) {
|
|
2057
|
-
return;
|
|
2058
|
-
}
|
|
2059
|
-
this.isInitialized = true;
|
|
2060
|
-
if (config) {
|
|
2061
|
-
this.telemetryContext = config;
|
|
2062
|
-
}
|
|
2063
|
-
try {
|
|
2064
|
-
const connectionString = this.getConnectionString();
|
|
2065
|
-
if (!connectionString) {
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
this.setupTelemetryProvider(connectionString);
|
|
2069
|
-
}
|
|
2070
|
-
catch (error) {
|
|
2071
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2072
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
getConnectionString() {
|
|
2076
|
-
const connectionString = CONNECTION_STRING;
|
|
2077
|
-
return connectionString;
|
|
2078
|
-
}
|
|
2079
|
-
setupTelemetryProvider(connectionString) {
|
|
2080
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2081
|
-
const processor = new BatchLogRecordProcessor(exporter);
|
|
2082
|
-
this.logProvider = new LoggerProvider({
|
|
2083
|
-
processors: [processor]
|
|
2084
|
-
});
|
|
2085
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2086
|
-
}
|
|
2087
|
-
/**
|
|
2088
|
-
* Track a telemetry event
|
|
2089
|
-
*/
|
|
2090
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2091
|
-
try {
|
|
2092
|
-
// Skip if logger not initialized
|
|
2093
|
-
if (!this.logger) {
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
2096
|
-
const finalDisplayName = name || eventName;
|
|
2097
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2098
|
-
// Emit as log
|
|
2099
|
-
this.logger.emit({
|
|
2100
|
-
body: finalDisplayName,
|
|
2101
|
-
attributes: attributes,
|
|
2102
|
-
timestamp: Date.now(),
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
|
-
catch (error) {
|
|
2106
|
-
// Silent failure
|
|
2107
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
/**
|
|
2111
|
-
* Get enriched attributes for telemetry events
|
|
2112
|
-
*/
|
|
2113
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2114
|
-
const attributes = {
|
|
2115
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2116
|
-
[VERSION]: SDK_VERSION,
|
|
2117
|
-
[SERVICE]: eventName,
|
|
2118
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2119
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2120
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2121
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2122
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2123
|
-
...extraAttributes,
|
|
2124
|
-
};
|
|
2125
|
-
return attributes;
|
|
2126
|
-
}
|
|
2127
|
-
/**
|
|
2128
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2129
|
-
*/
|
|
2130
|
-
createCloudUrl() {
|
|
2131
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2132
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2133
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2134
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2135
|
-
return UNKNOWN;
|
|
2136
|
-
}
|
|
2137
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
// Export singleton instance
|
|
2141
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
1933
|
+
* SDK Telemetry constants.
|
|
1934
|
+
*
|
|
1935
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
1936
|
+
* here. The Application Insights connection string is injected into
|
|
1937
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
1938
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
1939
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
1940
|
+
* SDK's public API.
|
|
1941
|
+
*/
|
|
1942
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
1943
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2142
1944
|
|
|
2143
1945
|
/**
|
|
2144
|
-
*
|
|
2145
|
-
*/
|
|
2146
|
-
/**
|
|
2147
|
-
* Common tracking logic shared between method and function decorators
|
|
2148
|
-
*/
|
|
2149
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2150
|
-
return function (...args) {
|
|
2151
|
-
// Determine if we should track this call
|
|
2152
|
-
let shouldTrack = true;
|
|
2153
|
-
if (opts.condition !== undefined) {
|
|
2154
|
-
if (typeof opts.condition === 'function') {
|
|
2155
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2156
|
-
}
|
|
2157
|
-
else {
|
|
2158
|
-
shouldTrack = opts.condition;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
// Track the event if enabled
|
|
2162
|
-
if (shouldTrack) {
|
|
2163
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2164
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2165
|
-
? nameOrOptions
|
|
2166
|
-
: fallbackName;
|
|
2167
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2168
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2169
|
-
}
|
|
2170
|
-
// Execute the original function
|
|
2171
|
-
return originalFunction.apply(this, args);
|
|
2172
|
-
};
|
|
2173
|
-
}
|
|
2174
|
-
/**
|
|
2175
|
-
* Track decorator that can be used to automatically track function calls
|
|
2176
|
-
*
|
|
2177
|
-
* Usage:
|
|
2178
|
-
* @track("Service.Method")
|
|
2179
|
-
* function myFunction() { ... }
|
|
2180
|
-
*
|
|
2181
|
-
* @track("Queue.GetAll")
|
|
2182
|
-
* async getAll() { ... }
|
|
1946
|
+
* UiPath TypeScript SDK Telemetry
|
|
2183
1947
|
*
|
|
2184
|
-
*
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
2197
|
-
// Method decorator
|
|
2198
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
2199
|
-
return descriptor;
|
|
2200
|
-
}
|
|
2201
|
-
// Function decorator
|
|
2202
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2203
|
-
};
|
|
2204
|
-
}
|
|
1948
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
1949
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
1950
|
+
* does this independently, so events carry their own consumer's identity
|
|
1951
|
+
* and tenant context.
|
|
1952
|
+
*/
|
|
1953
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
1954
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
1955
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
1956
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
1957
|
+
const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
|
|
1958
|
+
const track = createTrack(sdkClient);
|
|
1959
|
+
createTrackEvent(sdkClient);
|
|
2205
1960
|
|
|
2206
1961
|
class BucketService extends FolderScopedService {
|
|
2207
1962
|
/**
|
|
@@ -2239,6 +1994,32 @@ class BucketService extends FolderScopedService {
|
|
|
2239
1994
|
// Transform response from PascalCase to camelCase
|
|
2240
1995
|
return pascalToCamelCaseKeys(response.data);
|
|
2241
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Retrieves a single orchestrator storage bucket by name.
|
|
1999
|
+
*
|
|
2000
|
+
* @param name - Bucket name to search for
|
|
2001
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
2002
|
+
* @returns Promise resolving to a single bucket
|
|
2003
|
+
* {@link BucketGetResponse}
|
|
2004
|
+
* @example
|
|
2005
|
+
* ```typescript
|
|
2006
|
+
* import { Buckets } from '@uipath/uipath-typescript/buckets';
|
|
2007
|
+
*
|
|
2008
|
+
* const buckets = new Buckets(sdk);
|
|
2009
|
+
*
|
|
2010
|
+
* // By folder ID
|
|
2011
|
+
* await buckets.getByName('MyBucket', { folderId: <folderId> });
|
|
2012
|
+
*
|
|
2013
|
+
* // By folder key (GUID)
|
|
2014
|
+
* await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
|
|
2015
|
+
*
|
|
2016
|
+
* // By folder path
|
|
2017
|
+
* await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
|
|
2018
|
+
* ```
|
|
2019
|
+
*/
|
|
2020
|
+
async getByName(name, options = {}) {
|
|
2021
|
+
return this.getByNameLookup('Bucket', BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
|
|
2022
|
+
}
|
|
2242
2023
|
/**
|
|
2243
2024
|
* Gets all buckets across folders with optional filtering and folder scoping
|
|
2244
2025
|
*
|
|
@@ -2528,6 +2309,9 @@ class BucketService extends FolderScopedService {
|
|
|
2528
2309
|
__decorate([
|
|
2529
2310
|
track('Buckets.GetById')
|
|
2530
2311
|
], BucketService.prototype, "getById", null);
|
|
2312
|
+
__decorate([
|
|
2313
|
+
track('Buckets.GetByName')
|
|
2314
|
+
], BucketService.prototype, "getByName", null);
|
|
2531
2315
|
__decorate([
|
|
2532
2316
|
track('Buckets.GetAll')
|
|
2533
2317
|
], BucketService.prototype, "getAll", null);
|