@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
package/dist/processes/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.
|
|
@@ -613,14 +613,25 @@ class ApiClient {
|
|
|
613
613
|
if (!text) {
|
|
614
614
|
return undefined;
|
|
615
615
|
}
|
|
616
|
-
|
|
616
|
+
try {
|
|
617
|
+
return JSON.parse(text);
|
|
618
|
+
}
|
|
619
|
+
catch (error) {
|
|
620
|
+
if (error instanceof SyntaxError) {
|
|
621
|
+
throw new ServerError({
|
|
622
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
623
|
+
statusCode: response.status,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
throw error;
|
|
627
|
+
}
|
|
617
628
|
}
|
|
618
629
|
catch (error) {
|
|
619
630
|
// If it's already one of our errors, re-throw it
|
|
620
631
|
if (error.type && error.type.includes('Error')) {
|
|
621
632
|
throw error;
|
|
622
633
|
}
|
|
623
|
-
// Otherwise, it's
|
|
634
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
624
635
|
throw ErrorFactory.createNetworkError(error);
|
|
625
636
|
}
|
|
626
637
|
}
|
|
@@ -1284,9 +1295,9 @@ class PaginationHelpers {
|
|
|
1284
1295
|
* @returns Promise resolving to a paginated result
|
|
1285
1296
|
*/
|
|
1286
1297
|
static async getAllPaginated(params) {
|
|
1287
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1298
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1288
1299
|
const endpoint = getEndpoint(folderId);
|
|
1289
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1300
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1290
1301
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1291
1302
|
headers,
|
|
1292
1303
|
params: additionalParams,
|
|
@@ -1314,13 +1325,13 @@ class PaginationHelpers {
|
|
|
1314
1325
|
* @returns Promise resolving to an object with data and totalCount
|
|
1315
1326
|
*/
|
|
1316
1327
|
static async getAllNonPaginated(params) {
|
|
1317
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1328
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1318
1329
|
// Set default field names
|
|
1319
1330
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1320
1331
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1321
1332
|
// Determine endpoint and headers based on folderId
|
|
1322
1333
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1323
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1334
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1324
1335
|
// Make the API call based on method
|
|
1325
1336
|
let response;
|
|
1326
1337
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1379,6 +1390,7 @@ class PaginationHelpers {
|
|
|
1379
1390
|
serviceAccess: config.serviceAccess,
|
|
1380
1391
|
getEndpoint: config.getEndpoint,
|
|
1381
1392
|
folderId,
|
|
1393
|
+
headers: config.headers,
|
|
1382
1394
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1383
1395
|
additionalParams: prefixedOptions,
|
|
1384
1396
|
transformFn: config.transformFn,
|
|
@@ -1396,6 +1408,7 @@ class PaginationHelpers {
|
|
|
1396
1408
|
getAllEndpoint: config.getEndpoint(),
|
|
1397
1409
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1398
1410
|
folderId,
|
|
1411
|
+
headers: config.headers,
|
|
1399
1412
|
additionalParams: prefixedOptions,
|
|
1400
1413
|
transformFn: config.transformFn,
|
|
1401
1414
|
method: config.method,
|
|
@@ -1957,278 +1970,33 @@ const PROCESS_ENDPOINTS = {
|
|
|
1957
1970
|
};
|
|
1958
1971
|
|
|
1959
1972
|
/**
|
|
1960
|
-
* SDK Telemetry constants
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
const
|
|
1971
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
1972
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
1973
|
-
const APP_NAME = "ApplicationName";
|
|
1974
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
1975
|
-
// Service and logger names
|
|
1976
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
1977
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
1978
|
-
// Event names
|
|
1979
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
1980
|
-
// Default value for unknown/empty attributes
|
|
1981
|
-
const UNKNOWN = "";
|
|
1982
|
-
|
|
1983
|
-
/**
|
|
1984
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
1985
|
-
*/
|
|
1986
|
-
class ApplicationInsightsEventExporter {
|
|
1987
|
-
constructor(connectionString) {
|
|
1988
|
-
this.connectionString = connectionString;
|
|
1989
|
-
}
|
|
1990
|
-
export(logs, resultCallback) {
|
|
1991
|
-
try {
|
|
1992
|
-
logs.forEach(logRecord => {
|
|
1993
|
-
this.sendAsCustomEvent(logRecord);
|
|
1994
|
-
});
|
|
1995
|
-
resultCallback({ code: 0 });
|
|
1996
|
-
}
|
|
1997
|
-
catch (error) {
|
|
1998
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
1999
|
-
resultCallback({ code: 2, error });
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
shutdown() {
|
|
2003
|
-
return Promise.resolve();
|
|
2004
|
-
}
|
|
2005
|
-
sendAsCustomEvent(logRecord) {
|
|
2006
|
-
// Get event name from body or attributes
|
|
2007
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
2008
|
-
const payload = {
|
|
2009
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
2010
|
-
time: new Date().toISOString(),
|
|
2011
|
-
iKey: this.extractInstrumentationKey(),
|
|
2012
|
-
data: {
|
|
2013
|
-
baseType: 'EventData',
|
|
2014
|
-
baseData: {
|
|
2015
|
-
ver: 2,
|
|
2016
|
-
name: eventName,
|
|
2017
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
2018
|
-
}
|
|
2019
|
-
},
|
|
2020
|
-
tags: {
|
|
2021
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
2022
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
2023
|
-
}
|
|
2024
|
-
};
|
|
2025
|
-
this.sendToApplicationInsights(payload);
|
|
2026
|
-
}
|
|
2027
|
-
extractInstrumentationKey() {
|
|
2028
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
2029
|
-
return match ? match[1] : '';
|
|
2030
|
-
}
|
|
2031
|
-
convertAttributesToProperties(attributes) {
|
|
2032
|
-
const properties = {};
|
|
2033
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
2034
|
-
properties[key] = String(value);
|
|
2035
|
-
});
|
|
2036
|
-
return properties;
|
|
2037
|
-
}
|
|
2038
|
-
async sendToApplicationInsights(payload) {
|
|
2039
|
-
try {
|
|
2040
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
2041
|
-
if (!ingestionEndpoint) {
|
|
2042
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
2043
|
-
return;
|
|
2044
|
-
}
|
|
2045
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
2046
|
-
const response = await fetch(url, {
|
|
2047
|
-
method: 'POST',
|
|
2048
|
-
headers: {
|
|
2049
|
-
'Content-Type': 'application/json',
|
|
2050
|
-
},
|
|
2051
|
-
body: JSON.stringify(payload)
|
|
2052
|
-
});
|
|
2053
|
-
if (!response.ok) {
|
|
2054
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
catch (error) {
|
|
2058
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
extractIngestionEndpoint() {
|
|
2062
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2063
|
-
return match ? match[1] : '';
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* Singleton telemetry client
|
|
2068
|
-
*/
|
|
2069
|
-
class TelemetryClient {
|
|
2070
|
-
constructor() {
|
|
2071
|
-
this.isInitialized = false;
|
|
2072
|
-
}
|
|
2073
|
-
static getInstance() {
|
|
2074
|
-
if (!TelemetryClient.instance) {
|
|
2075
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2076
|
-
}
|
|
2077
|
-
return TelemetryClient.instance;
|
|
2078
|
-
}
|
|
2079
|
-
/**
|
|
2080
|
-
* Initialize telemetry
|
|
2081
|
-
*/
|
|
2082
|
-
initialize(config) {
|
|
2083
|
-
if (this.isInitialized) {
|
|
2084
|
-
return;
|
|
2085
|
-
}
|
|
2086
|
-
this.isInitialized = true;
|
|
2087
|
-
if (config) {
|
|
2088
|
-
this.telemetryContext = config;
|
|
2089
|
-
}
|
|
2090
|
-
try {
|
|
2091
|
-
const connectionString = this.getConnectionString();
|
|
2092
|
-
if (!connectionString) {
|
|
2093
|
-
return;
|
|
2094
|
-
}
|
|
2095
|
-
this.setupTelemetryProvider(connectionString);
|
|
2096
|
-
}
|
|
2097
|
-
catch (error) {
|
|
2098
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2099
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
getConnectionString() {
|
|
2103
|
-
const connectionString = CONNECTION_STRING;
|
|
2104
|
-
return connectionString;
|
|
2105
|
-
}
|
|
2106
|
-
setupTelemetryProvider(connectionString) {
|
|
2107
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2108
|
-
const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
|
|
2109
|
-
this.logProvider = new sdkLogs.LoggerProvider({
|
|
2110
|
-
processors: [processor]
|
|
2111
|
-
});
|
|
2112
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Track a telemetry event
|
|
2116
|
-
*/
|
|
2117
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2118
|
-
try {
|
|
2119
|
-
// Skip if logger not initialized
|
|
2120
|
-
if (!this.logger) {
|
|
2121
|
-
return;
|
|
2122
|
-
}
|
|
2123
|
-
const finalDisplayName = name || eventName;
|
|
2124
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2125
|
-
// Emit as log
|
|
2126
|
-
this.logger.emit({
|
|
2127
|
-
body: finalDisplayName,
|
|
2128
|
-
attributes: attributes,
|
|
2129
|
-
timestamp: Date.now(),
|
|
2130
|
-
});
|
|
2131
|
-
}
|
|
2132
|
-
catch (error) {
|
|
2133
|
-
// Silent failure
|
|
2134
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
/**
|
|
2138
|
-
* Get enriched attributes for telemetry events
|
|
2139
|
-
*/
|
|
2140
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2141
|
-
const attributes = {
|
|
2142
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2143
|
-
[VERSION]: SDK_VERSION,
|
|
2144
|
-
[SERVICE]: eventName,
|
|
2145
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2146
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2147
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2148
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2149
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2150
|
-
...extraAttributes,
|
|
2151
|
-
};
|
|
2152
|
-
return attributes;
|
|
2153
|
-
}
|
|
2154
|
-
/**
|
|
2155
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2156
|
-
*/
|
|
2157
|
-
createCloudUrl() {
|
|
2158
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2159
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2160
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2161
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2162
|
-
return UNKNOWN;
|
|
2163
|
-
}
|
|
2164
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
// Export singleton instance
|
|
2168
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
1973
|
+
* SDK Telemetry constants.
|
|
1974
|
+
*
|
|
1975
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
1976
|
+
* here. The Application Insights connection string is injected into
|
|
1977
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
1978
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
1979
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
1980
|
+
* SDK's public API.
|
|
1981
|
+
*/
|
|
1982
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
1983
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2169
1984
|
|
|
2170
1985
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
*/
|
|
2173
|
-
/**
|
|
2174
|
-
* Common tracking logic shared between method and function decorators
|
|
2175
|
-
*/
|
|
2176
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2177
|
-
return function (...args) {
|
|
2178
|
-
// Determine if we should track this call
|
|
2179
|
-
let shouldTrack = true;
|
|
2180
|
-
if (opts.condition !== undefined) {
|
|
2181
|
-
if (typeof opts.condition === 'function') {
|
|
2182
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2183
|
-
}
|
|
2184
|
-
else {
|
|
2185
|
-
shouldTrack = opts.condition;
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
// Track the event if enabled
|
|
2189
|
-
if (shouldTrack) {
|
|
2190
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2191
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2192
|
-
? nameOrOptions
|
|
2193
|
-
: fallbackName;
|
|
2194
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2195
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2196
|
-
}
|
|
2197
|
-
// Execute the original function
|
|
2198
|
-
return originalFunction.apply(this, args);
|
|
2199
|
-
};
|
|
2200
|
-
}
|
|
2201
|
-
/**
|
|
2202
|
-
* Track decorator that can be used to automatically track function calls
|
|
2203
|
-
*
|
|
2204
|
-
* Usage:
|
|
2205
|
-
* @track("Service.Method")
|
|
2206
|
-
* function myFunction() { ... }
|
|
2207
|
-
*
|
|
2208
|
-
* @track("Queue.GetAll")
|
|
2209
|
-
* async getAll() { ... }
|
|
2210
|
-
*
|
|
2211
|
-
* @track("Tasks.Create")
|
|
2212
|
-
* async create() { ... }
|
|
1986
|
+
* UiPath TypeScript SDK Telemetry
|
|
2213
1987
|
*
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2217
|
-
*
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
return descriptor;
|
|
2227
|
-
}
|
|
2228
|
-
// Function decorator
|
|
2229
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2230
|
-
};
|
|
2231
|
-
}
|
|
1988
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
1989
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
1990
|
+
* does this independently, so events carry their own consumer's identity
|
|
1991
|
+
* and tenant context.
|
|
1992
|
+
*/
|
|
1993
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
1994
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
1995
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
1996
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
1997
|
+
const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
|
|
1998
|
+
const track = coreTelemetry.createTrack(sdkClient);
|
|
1999
|
+
coreTelemetry.createTrackEvent(sdkClient);
|
|
2232
2000
|
|
|
2233
2001
|
/**
|
|
2234
2002
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
@@ -2298,33 +2066,32 @@ class ProcessService extends FolderScopedService {
|
|
|
2298
2066
|
}
|
|
2299
2067
|
}, options);
|
|
2300
2068
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2069
|
+
async start(request, optionsOrFolderId, legacyOptions) {
|
|
2070
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2071
|
+
let folderId;
|
|
2072
|
+
let folderKey;
|
|
2073
|
+
let folderPath;
|
|
2074
|
+
let queryOptions;
|
|
2075
|
+
if (typeof optionsOrFolderId === 'number') {
|
|
2076
|
+
// Deprecated positional form: start(request, folderId, options?)
|
|
2077
|
+
folderId = optionsOrFolderId;
|
|
2078
|
+
queryOptions = legacyOptions ?? {};
|
|
2079
|
+
}
|
|
2080
|
+
else {
|
|
2081
|
+
// Preferred form: start(request, options?)
|
|
2082
|
+
const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
|
|
2083
|
+
folderId = fid;
|
|
2084
|
+
folderKey = fkey;
|
|
2085
|
+
folderPath = fpath;
|
|
2086
|
+
queryOptions = rest;
|
|
2087
|
+
}
|
|
2088
|
+
const headers = resolveFolderHeaders({
|
|
2089
|
+
folderId,
|
|
2090
|
+
folderKey,
|
|
2091
|
+
folderPath,
|
|
2092
|
+
resourceType: 'processes.start',
|
|
2093
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2094
|
+
});
|
|
2328
2095
|
// Transform SDK field names to API field names (e.g., processKey → releaseKey)
|
|
2329
2096
|
const apiRequest = transformRequest(request, ProcessMap);
|
|
2330
2097
|
// Create the request object according to API spec
|
|
@@ -2332,8 +2099,8 @@ class ProcessService extends FolderScopedService {
|
|
|
2332
2099
|
startInfo: apiRequest
|
|
2333
2100
|
};
|
|
2334
2101
|
// Prefix all query parameter keys with '$' for OData
|
|
2335
|
-
const keysToPrefix = Object.keys(
|
|
2336
|
-
const apiOptions = addPrefixToKeys(
|
|
2102
|
+
const keysToPrefix = Object.keys(queryOptions);
|
|
2103
|
+
const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
|
|
2337
2104
|
const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
|
|
2338
2105
|
params: apiOptions,
|
|
2339
2106
|
headers
|
|
@@ -744,6 +744,17 @@ interface ProcessGetByIdOptions extends BaseOptions {
|
|
|
744
744
|
*/
|
|
745
745
|
interface ProcessGetByNameOptions extends FolderScopedOptions {
|
|
746
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* Options for starting a process. Combines folder scoping
|
|
749
|
+
* (`folderId` / `folderKey` / `folderPath`) with the OData query options
|
|
750
|
+
* (`expand`, `select`, `filter`, `orderby`) accepted by the start endpoint.
|
|
751
|
+
*
|
|
752
|
+
* Folder scoping is optional in the type — the SDK falls back to the
|
|
753
|
+
* init-time folderKey (e.g. `<meta name="uipath:folder-key">` in coded-app
|
|
754
|
+
* deployments). A `ValidationError` is raised when neither is provided.
|
|
755
|
+
*/
|
|
756
|
+
interface ProcessStartOptions extends FolderScopedOptions, RequestOptions {
|
|
757
|
+
}
|
|
747
758
|
|
|
748
759
|
/**
|
|
749
760
|
* Service for managing and executing UiPath Automation Processes.
|
|
@@ -840,26 +851,45 @@ interface ProcessServiceModel {
|
|
|
840
851
|
*/
|
|
841
852
|
getByName(name: string, options?: ProcessGetByNameOptions): Promise<ProcessGetResponse>;
|
|
842
853
|
/**
|
|
843
|
-
* Starts a process with the specified configuration
|
|
854
|
+
* Starts a process with the specified configuration.
|
|
855
|
+
*
|
|
856
|
+
* Folder context can be supplied as `folderId`, `folderKey`, or `folderPath`
|
|
857
|
+
* inside the options.
|
|
844
858
|
*
|
|
845
859
|
* @param request - Process start configuration
|
|
846
|
-
* @param
|
|
847
|
-
* @param options - Optional request options
|
|
860
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`, `filter`, `orderby`)
|
|
848
861
|
* @returns Promise resolving to array of started process instances
|
|
849
862
|
* {@link ProcessStartResponse}
|
|
850
863
|
* @example
|
|
851
864
|
* ```typescript
|
|
852
|
-
* //
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
865
|
+
* // By folder ID
|
|
866
|
+
* await processes.start({ processKey: '<processKey>' }, { folderId: <folderId> });
|
|
867
|
+
*
|
|
868
|
+
* // By folder key (GUID)
|
|
869
|
+
* await processes.start({ processKey: '<processKey>' }, { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
870
|
+
*
|
|
871
|
+
* // By folder path
|
|
872
|
+
* await processes.start({ processKey: '<processKey>' }, { folderPath: 'Shared/Finance' });
|
|
873
|
+
*
|
|
874
|
+
* // Start by process name (instead of processKey)
|
|
875
|
+
* await processes.start({ processName: 'MyProcess' }, { folderId: <folderId> });
|
|
876
|
+
*
|
|
877
|
+
* // With additional options
|
|
878
|
+
* await processes.start({ processKey: '<processKey>' }, { folderId: <folderId>, expand: 'Robot' });
|
|
861
879
|
* ```
|
|
862
880
|
*/
|
|
881
|
+
start(request: ProcessStartRequest, options?: ProcessStartOptions): Promise<ProcessStartResponse[]>;
|
|
882
|
+
/**
|
|
883
|
+
* Starts a process — positional `folderId` form.
|
|
884
|
+
*
|
|
885
|
+
* @deprecated Use the options-object form: `start(request, { folderId })`. See {@link ProcessStartOptions} for the supported options.
|
|
886
|
+
*
|
|
887
|
+
* @param request - Process start configuration
|
|
888
|
+
* @param folderId - Required folder ID (numeric)
|
|
889
|
+
* @param options - Optional request options
|
|
890
|
+
* @returns Promise resolving to array of started process instances
|
|
891
|
+
* {@link ProcessStartResponse}
|
|
892
|
+
*/
|
|
863
893
|
start(request: ProcessStartRequest, folderId: number, options?: RequestOptions): Promise<ProcessStartResponse[]>;
|
|
864
894
|
}
|
|
865
895
|
|
|
@@ -913,12 +943,15 @@ declare class ProcessService extends FolderScopedService implements ProcessServi
|
|
|
913
943
|
*/
|
|
914
944
|
getAll<T extends ProcessGetAllOptions = ProcessGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessGetResponse> : NonPaginatedResponse<ProcessGetResponse>>;
|
|
915
945
|
/**
|
|
916
|
-
* Starts a process
|
|
946
|
+
* Starts a process with the specified configuration.
|
|
917
947
|
*
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
921
|
-
* @
|
|
948
|
+
* Folder context can be supplied as `folderId`, `folderKey`, or `folderPath`
|
|
949
|
+
* inside the options.
|
|
950
|
+
*
|
|
951
|
+
* @param request - Process start configuration
|
|
952
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`, `filter`, `orderby`)
|
|
953
|
+
* @returns Promise resolving to array of started process instances
|
|
954
|
+
* {@link ProcessStartResponse}
|
|
922
955
|
*
|
|
923
956
|
* @example
|
|
924
957
|
* ```typescript
|
|
@@ -926,17 +959,34 @@ declare class ProcessService extends FolderScopedService implements ProcessServi
|
|
|
926
959
|
*
|
|
927
960
|
* const processes = new Processes(sdk);
|
|
928
961
|
*
|
|
929
|
-
* //
|
|
930
|
-
*
|
|
931
|
-
* processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
932
|
-
* }, 123); // folderId is required
|
|
962
|
+
* // By folder ID
|
|
963
|
+
* await processes.start({ processKey: '<processKey>' }, { folderId: <folderId> });
|
|
933
964
|
*
|
|
934
|
-
* //
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
965
|
+
* // By folder key (GUID)
|
|
966
|
+
* await processes.start({ processKey: '<processKey>' }, { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
967
|
+
*
|
|
968
|
+
* // By folder path
|
|
969
|
+
* await processes.start({ processKey: '<processKey>' }, { folderPath: 'Shared/Finance' });
|
|
970
|
+
*
|
|
971
|
+
* // Start by process name (instead of processKey)
|
|
972
|
+
* await processes.start({ processName: 'MyProcess' }, { folderId: <folderId> });
|
|
973
|
+
*
|
|
974
|
+
* // With additional options
|
|
975
|
+
* await processes.start({ processKey: '<processKey>' }, { folderId: <folderId>, expand: 'Robot' });
|
|
938
976
|
* ```
|
|
939
977
|
*/
|
|
978
|
+
start(request: ProcessStartRequest, options?: ProcessStartOptions): Promise<ProcessStartResponse[]>;
|
|
979
|
+
/**
|
|
980
|
+
* Starts a process — positional `folderId` form.
|
|
981
|
+
*
|
|
982
|
+
* @deprecated Use the options-object form: `start(request, { folderId })`. See {@link ProcessStartOptions} for the supported options.
|
|
983
|
+
*
|
|
984
|
+
* @param request - Process start configuration
|
|
985
|
+
* @param folderId - Required folder ID (numeric)
|
|
986
|
+
* @param options - Optional request options
|
|
987
|
+
* @returns Promise resolving to array of started process instances
|
|
988
|
+
* {@link ProcessStartResponse}
|
|
989
|
+
*/
|
|
940
990
|
start(request: ProcessStartRequest, folderId: number, options?: RequestOptions): Promise<ProcessStartResponse[]>;
|
|
941
991
|
/**
|
|
942
992
|
* Gets a single process by ID
|
|
@@ -987,4 +1037,4 @@ declare class ProcessService extends FolderScopedService implements ProcessServi
|
|
|
987
1037
|
}
|
|
988
1038
|
|
|
989
1039
|
export { JobPriority, JobSourceType, JobType, PackageSourceType, PackageType, ProcessService, ProcessService as Processes, RemoteControlAccess, RobotSize, RuntimeType, StartStrategy, StopStrategy, TargetFramework };
|
|
990
|
-
export type { ArgumentMetadata, BaseProcessStartRequest, FolderProperties, JobAttachment, JobError, Machine, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetByNameOptions, ProcessGetResponse, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, RobotMetadata };
|
|
1040
|
+
export type { ArgumentMetadata, BaseProcessStartRequest, FolderProperties, JobAttachment, JobError, Machine, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetByNameOptions, ProcessGetResponse, ProcessProperties, ProcessServiceModel, ProcessStartOptions, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, RobotMetadata };
|