@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.
Files changed (39) hide show
  1. package/dist/assets/index.cjs +25 -270
  2. package/dist/assets/index.mjs +25 -270
  3. package/dist/attachments/index.cjs +23 -267
  4. package/dist/attachments/index.mjs +23 -267
  5. package/dist/buckets/index.cjs +54 -270
  6. package/dist/buckets/index.d.ts +50 -1
  7. package/dist/buckets/index.mjs +54 -270
  8. package/dist/cases/index.cjs +408 -337
  9. package/dist/cases/index.d.ts +534 -2
  10. package/dist/cases/index.mjs +409 -338
  11. package/dist/conversational-agent/index.cjs +71 -281
  12. package/dist/conversational-agent/index.d.ts +62 -12
  13. package/dist/conversational-agent/index.mjs +71 -282
  14. package/dist/core/index.cjs +39 -289
  15. package/dist/core/index.d.ts +9 -98
  16. package/dist/core/index.mjs +40 -275
  17. package/dist/document-understanding/index.cjs +18 -1
  18. package/dist/document-understanding/index.d.ts +636 -610
  19. package/dist/document-understanding/index.mjs +18 -1
  20. package/dist/entities/index.cjs +25 -270
  21. package/dist/entities/index.mjs +25 -270
  22. package/dist/feedback/index.cjs +23 -268
  23. package/dist/feedback/index.mjs +23 -268
  24. package/dist/index.cjs +600 -293
  25. package/dist/index.d.ts +1603 -722
  26. package/dist/index.mjs +600 -279
  27. package/dist/index.umd.js +789 -158
  28. package/dist/jobs/index.cjs +25 -270
  29. package/dist/jobs/index.mjs +25 -270
  30. package/dist/maestro-processes/index.cjs +1751 -1720
  31. package/dist/maestro-processes/index.d.ts +430 -2
  32. package/dist/maestro-processes/index.mjs +1752 -1721
  33. package/dist/processes/index.cjs +25 -270
  34. package/dist/processes/index.mjs +25 -270
  35. package/dist/queues/index.cjs +25 -270
  36. package/dist/queues/index.mjs +25 -270
  37. package/dist/tasks/index.cjs +25 -270
  38. package/dist/tasks/index.mjs +25 -270
  39. package/package.json +8 -10
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var sdkLogs = require('@opentelemetry/sdk-logs');
3
+ var coreTelemetry = require('@uipath/core-telemetry');
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -1932,278 +1932,33 @@ const BucketMap = {
1932
1932
  };
1933
1933
 
1934
1934
  /**
1935
- * SDK Telemetry constants
1936
- */
1937
- // Connection string placeholder that will be replaced during build
1938
- const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1939
- // SDK Version placeholder
1940
- const SDK_VERSION = "1.3.8";
1941
- const VERSION = "Version";
1942
- const SERVICE = "Service";
1943
- const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
1944
- const CLOUD_TENANT_NAME = "CloudTenantName";
1945
- const CLOUD_URL = "CloudUrl";
1946
- const CLOUD_CLIENT_ID = "CloudClientId";
1947
- const CLOUD_REDIRECT_URI = "CloudRedirectUri";
1948
- const APP_NAME = "ApplicationName";
1949
- const CLOUD_ROLE_NAME = "uipath-ts-sdk";
1950
- // Service and logger names
1951
- const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
1952
- const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
1953
- // Event names
1954
- const SDK_RUN_EVENT = "Sdk.Run";
1955
- // Default value for unknown/empty attributes
1956
- const UNKNOWN = "";
1957
-
1958
- /**
1959
- * Log exporter that sends ALL logs as Application Insights custom events
1960
- */
1961
- class ApplicationInsightsEventExporter {
1962
- constructor(connectionString) {
1963
- this.connectionString = connectionString;
1964
- }
1965
- export(logs, resultCallback) {
1966
- try {
1967
- logs.forEach(logRecord => {
1968
- this.sendAsCustomEvent(logRecord);
1969
- });
1970
- resultCallback({ code: 0 });
1971
- }
1972
- catch (error) {
1973
- console.debug('Failed to export logs to Application Insights:', error);
1974
- resultCallback({ code: 2, error });
1975
- }
1976
- }
1977
- shutdown() {
1978
- return Promise.resolve();
1979
- }
1980
- sendAsCustomEvent(logRecord) {
1981
- // Get event name from body or attributes
1982
- const eventName = logRecord.body || SDK_RUN_EVENT;
1983
- const payload = {
1984
- name: 'Microsoft.ApplicationInsights.Event',
1985
- time: new Date().toISOString(),
1986
- iKey: this.extractInstrumentationKey(),
1987
- data: {
1988
- baseType: 'EventData',
1989
- baseData: {
1990
- ver: 2,
1991
- name: eventName,
1992
- properties: this.convertAttributesToProperties(logRecord.attributes || {})
1993
- }
1994
- },
1995
- tags: {
1996
- 'ai.cloud.role': CLOUD_ROLE_NAME,
1997
- 'ai.cloud.roleInstance': SDK_VERSION
1998
- }
1999
- };
2000
- this.sendToApplicationInsights(payload);
2001
- }
2002
- extractInstrumentationKey() {
2003
- const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
2004
- return match ? match[1] : '';
2005
- }
2006
- convertAttributesToProperties(attributes) {
2007
- const properties = {};
2008
- Object.entries(attributes || {}).forEach(([key, value]) => {
2009
- properties[key] = String(value);
2010
- });
2011
- return properties;
2012
- }
2013
- async sendToApplicationInsights(payload) {
2014
- try {
2015
- const ingestionEndpoint = this.extractIngestionEndpoint();
2016
- if (!ingestionEndpoint) {
2017
- console.debug('No ingestion endpoint found in connection string');
2018
- return;
2019
- }
2020
- const url = `${ingestionEndpoint}/v2/track`;
2021
- const response = await fetch(url, {
2022
- method: 'POST',
2023
- headers: {
2024
- 'Content-Type': 'application/json',
2025
- },
2026
- body: JSON.stringify(payload)
2027
- });
2028
- if (!response.ok) {
2029
- console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
2030
- }
2031
- }
2032
- catch (error) {
2033
- console.debug('Error sending event telemetry to Application Insights:', error);
2034
- }
2035
- }
2036
- extractIngestionEndpoint() {
2037
- const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
2038
- return match ? match[1] : '';
2039
- }
2040
- }
2041
- /**
2042
- * Singleton telemetry client
2043
- */
2044
- class TelemetryClient {
2045
- constructor() {
2046
- this.isInitialized = false;
2047
- }
2048
- static getInstance() {
2049
- if (!TelemetryClient.instance) {
2050
- TelemetryClient.instance = new TelemetryClient();
2051
- }
2052
- return TelemetryClient.instance;
2053
- }
2054
- /**
2055
- * Initialize telemetry
2056
- */
2057
- initialize(config) {
2058
- if (this.isInitialized) {
2059
- return;
2060
- }
2061
- this.isInitialized = true;
2062
- if (config) {
2063
- this.telemetryContext = config;
2064
- }
2065
- try {
2066
- const connectionString = this.getConnectionString();
2067
- if (!connectionString) {
2068
- return;
2069
- }
2070
- this.setupTelemetryProvider(connectionString);
2071
- }
2072
- catch (error) {
2073
- // Silent failure - telemetry errors shouldn't break functionality
2074
- console.debug('Failed to initialize OpenTelemetry:', error);
2075
- }
2076
- }
2077
- getConnectionString() {
2078
- const connectionString = CONNECTION_STRING;
2079
- return connectionString;
2080
- }
2081
- setupTelemetryProvider(connectionString) {
2082
- const exporter = new ApplicationInsightsEventExporter(connectionString);
2083
- const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
2084
- this.logProvider = new sdkLogs.LoggerProvider({
2085
- processors: [processor]
2086
- });
2087
- this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
2088
- }
2089
- /**
2090
- * Track a telemetry event
2091
- */
2092
- track(eventName, name, extraAttributes = {}) {
2093
- try {
2094
- // Skip if logger not initialized
2095
- if (!this.logger) {
2096
- return;
2097
- }
2098
- const finalDisplayName = name || eventName;
2099
- const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
2100
- // Emit as log
2101
- this.logger.emit({
2102
- body: finalDisplayName,
2103
- attributes: attributes,
2104
- timestamp: Date.now(),
2105
- });
2106
- }
2107
- catch (error) {
2108
- // Silent failure
2109
- console.debug('Failed to track telemetry event:', error);
2110
- }
2111
- }
2112
- /**
2113
- * Get enriched attributes for telemetry events
2114
- */
2115
- getEnrichedAttributes(extraAttributes, eventName) {
2116
- const attributes = {
2117
- [APP_NAME]: SDK_SERVICE_NAME,
2118
- [VERSION]: SDK_VERSION,
2119
- [SERVICE]: eventName,
2120
- [CLOUD_URL]: this.createCloudUrl(),
2121
- [CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
2122
- [CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
2123
- [CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
2124
- [CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
2125
- ...extraAttributes,
2126
- };
2127
- return attributes;
2128
- }
2129
- /**
2130
- * Create cloud URL from base URL, organization ID, and tenant ID
2131
- */
2132
- createCloudUrl() {
2133
- const baseUrl = this.telemetryContext?.baseUrl;
2134
- const orgId = this.telemetryContext?.orgName;
2135
- const tenantId = this.telemetryContext?.tenantName;
2136
- if (!baseUrl || !orgId || !tenantId) {
2137
- return UNKNOWN;
2138
- }
2139
- return `${baseUrl}/${orgId}/${tenantId}`;
2140
- }
2141
- }
2142
- // Export singleton instance
2143
- const telemetryClient = TelemetryClient.getInstance();
1935
+ * SDK Telemetry constants.
1936
+ *
1937
+ * Only the SDK's identity (version, service name, role name, …) lives
1938
+ * here. The Application Insights connection string is injected into
1939
+ * `@uipath/core-telemetry` itself at publish time, and the generic attribute
1940
+ * keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
1941
+ * `@uipath/core-telemetry` and consumed there — they are not part of the
1942
+ * SDK's public API.
1943
+ */
1944
+ /** SDK version placeholder — patched by the SDK publish workflow. */
1945
+ const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
2144
1946
 
2145
1947
  /**
2146
- * SDK Track decorator and function for telemetry
2147
- */
2148
- /**
2149
- * Common tracking logic shared between method and function decorators
2150
- */
2151
- function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
2152
- return function (...args) {
2153
- // Determine if we should track this call
2154
- let shouldTrack = true;
2155
- if (opts.condition !== undefined) {
2156
- if (typeof opts.condition === 'function') {
2157
- shouldTrack = opts.condition.apply(this, args);
2158
- }
2159
- else {
2160
- shouldTrack = opts.condition;
2161
- }
2162
- }
2163
- // Track the event if enabled
2164
- if (shouldTrack) {
2165
- // Use the full name provided in the decorator (e.g., "Queue.GetAll")
2166
- const serviceMethod = typeof nameOrOptions === 'string'
2167
- ? nameOrOptions
2168
- : fallbackName;
2169
- // Use 'Sdk.Run' as the name and serviceMethod as the service
2170
- telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
2171
- }
2172
- // Execute the original function
2173
- return originalFunction.apply(this, args);
2174
- };
2175
- }
2176
- /**
2177
- * Track decorator that can be used to automatically track function calls
2178
- *
2179
- * Usage:
2180
- * @track("Service.Method")
2181
- * function myFunction() { ... }
2182
- *
2183
- * @track("Queue.GetAll")
2184
- * async getAll() { ... }
1948
+ * UiPath TypeScript SDK Telemetry
2185
1949
  *
2186
- * @track("Tasks.Create")
2187
- * async create() { ... }
2188
- *
2189
- * @track("Assets.Update", { condition: false })
2190
- * function myFunction() { ... }
2191
- *
2192
- * @track("Processes.Start", { attributes: { customProp: "value" } })
2193
- * function myFunction() { ... }
2194
- */
2195
- function track(nameOrOptions, options) {
2196
- return function decorator(_target, propertyKey, descriptor) {
2197
- const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
2198
- if (descriptor && typeof descriptor.value === 'function') {
2199
- // Method decorator
2200
- descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
2201
- return descriptor;
2202
- }
2203
- // Function decorator
2204
- return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
2205
- };
2206
- }
1950
+ * Constructs the SDK's own `TelemetryClient` and binds the SDK-local
1951
+ * `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
1952
+ * does this independently, so events carry their own consumer's identity
1953
+ * and tenant context.
1954
+ */
1955
+ // Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
1956
+ // same `TelemetryClient` instance at runtime. A single `initialize(...)`
1957
+ // from the `UiPath` constructor therefore wires up `@track` decorators
1958
+ // across every subpath bundle (`assets`, `feedback`, `tasks`, …).
1959
+ const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
1960
+ const track = coreTelemetry.createTrack(sdkClient);
1961
+ coreTelemetry.createTrackEvent(sdkClient);
2207
1962
 
2208
1963
  class BucketService extends FolderScopedService {
2209
1964
  /**
@@ -2241,6 +1996,32 @@ class BucketService extends FolderScopedService {
2241
1996
  // Transform response from PascalCase to camelCase
2242
1997
  return pascalToCamelCaseKeys(response.data);
2243
1998
  }
1999
+ /**
2000
+ * Retrieves a single orchestrator storage bucket by name.
2001
+ *
2002
+ * @param name - Bucket name to search for
2003
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
2004
+ * @returns Promise resolving to a single bucket
2005
+ * {@link BucketGetResponse}
2006
+ * @example
2007
+ * ```typescript
2008
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2009
+ *
2010
+ * const buckets = new Buckets(sdk);
2011
+ *
2012
+ * // By folder ID
2013
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
2014
+ *
2015
+ * // By folder key (GUID)
2016
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
2017
+ *
2018
+ * // By folder path
2019
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
2020
+ * ```
2021
+ */
2022
+ async getByName(name, options = {}) {
2023
+ return this.getByNameLookup('Bucket', BUCKET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => pascalToCamelCaseKeys(raw));
2024
+ }
2244
2025
  /**
2245
2026
  * Gets all buckets across folders with optional filtering and folder scoping
2246
2027
  *
@@ -2530,6 +2311,9 @@ class BucketService extends FolderScopedService {
2530
2311
  __decorate([
2531
2312
  track('Buckets.GetById')
2532
2313
  ], BucketService.prototype, "getById", null);
2314
+ __decorate([
2315
+ track('Buckets.GetByName')
2316
+ ], BucketService.prototype, "getByName", null);
2533
2317
  __decorate([
2534
2318
  track('Buckets.GetAll')
2535
2319
  ], BucketService.prototype, "getAll", null);
@@ -396,6 +396,11 @@ type BucketGetAllOptions = RequestOptions & PaginationOptions & {
396
396
  };
397
397
  interface BucketGetByIdOptions extends BaseOptions {
398
398
  }
399
+ /**
400
+ * Options for getting a single bucket by name
401
+ */
402
+ interface BucketGetByNameOptions extends FolderScopedOptions {
403
+ }
399
404
  /**
400
405
  * Maps header names to their values
401
406
  *
@@ -606,6 +611,26 @@ interface BucketServiceModel {
606
611
  * ```
607
612
  */
608
613
  getById(bucketId: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
614
+ /**
615
+ * Retrieves a single orchestrator storage bucket by name.
616
+ *
617
+ * @param name - Bucket name to search for
618
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
619
+ * @returns Promise resolving to a single bucket
620
+ * {@link BucketGetResponse}
621
+ * @example
622
+ * ```typescript
623
+ * // By folder ID
624
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
625
+ *
626
+ * // By folder key (GUID)
627
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
628
+ *
629
+ * // By folder path
630
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
631
+ * ```
632
+ */
633
+ getByName(name: string, options?: BucketGetByNameOptions): Promise<BucketGetResponse>;
609
634
  /**
610
635
  * Gets metadata for files in a bucket with optional filtering and pagination
611
636
  *
@@ -704,6 +729,30 @@ declare class BucketService extends FolderScopedService implements BucketService
704
729
  * ```
705
730
  */
706
731
  getById(id: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
732
+ /**
733
+ * Retrieves a single orchestrator storage bucket by name.
734
+ *
735
+ * @param name - Bucket name to search for
736
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
737
+ * @returns Promise resolving to a single bucket
738
+ * {@link BucketGetResponse}
739
+ * @example
740
+ * ```typescript
741
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
742
+ *
743
+ * const buckets = new Buckets(sdk);
744
+ *
745
+ * // By folder ID
746
+ * await buckets.getByName('MyBucket', { folderId: <folderId> });
747
+ *
748
+ * // By folder key (GUID)
749
+ * await buckets.getByName('MyBucket', { folderKey: '<folderKey>' });
750
+ *
751
+ * // By folder path
752
+ * await buckets.getByName('MyBucket', { folderPath: '<folderPath>' });
753
+ * ```
754
+ */
755
+ getByName(name: string, options?: BucketGetByNameOptions): Promise<BucketGetResponse>;
707
756
  /**
708
757
  * Gets all buckets across folders with optional filtering and folder scoping
709
758
  *
@@ -865,4 +914,4 @@ declare class BucketService extends FolderScopedService implements BucketService
865
914
  }
866
915
 
867
916
  export { BucketOptions, BucketService, BucketService as Buckets };
868
- export type { BlobItem, BucketGetAllOptions, BucketGetByIdOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, ResponseDictionary };
917
+ export type { BlobItem, BucketGetAllOptions, BucketGetByIdOptions, BucketGetByNameOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, ResponseDictionary };