@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.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.
|
|
@@ -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
|
}
|
|
@@ -1282,9 +1293,9 @@ class PaginationHelpers {
|
|
|
1282
1293
|
* @returns Promise resolving to a paginated result
|
|
1283
1294
|
*/
|
|
1284
1295
|
static async getAllPaginated(params) {
|
|
1285
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1296
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1286
1297
|
const endpoint = getEndpoint(folderId);
|
|
1287
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1298
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1288
1299
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1289
1300
|
headers,
|
|
1290
1301
|
params: additionalParams,
|
|
@@ -1312,13 +1323,13 @@ class PaginationHelpers {
|
|
|
1312
1323
|
* @returns Promise resolving to an object with data and totalCount
|
|
1313
1324
|
*/
|
|
1314
1325
|
static async getAllNonPaginated(params) {
|
|
1315
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1326
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1316
1327
|
// Set default field names
|
|
1317
1328
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1318
1329
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1319
1330
|
// Determine endpoint and headers based on folderId
|
|
1320
1331
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1321
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1332
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1322
1333
|
// Make the API call based on method
|
|
1323
1334
|
let response;
|
|
1324
1335
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1377,6 +1388,7 @@ class PaginationHelpers {
|
|
|
1377
1388
|
serviceAccess: config.serviceAccess,
|
|
1378
1389
|
getEndpoint: config.getEndpoint,
|
|
1379
1390
|
folderId,
|
|
1391
|
+
headers: config.headers,
|
|
1380
1392
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1381
1393
|
additionalParams: prefixedOptions,
|
|
1382
1394
|
transformFn: config.transformFn,
|
|
@@ -1394,6 +1406,7 @@ class PaginationHelpers {
|
|
|
1394
1406
|
getAllEndpoint: config.getEndpoint(),
|
|
1395
1407
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1396
1408
|
folderId,
|
|
1409
|
+
headers: config.headers,
|
|
1397
1410
|
additionalParams: prefixedOptions,
|
|
1398
1411
|
transformFn: config.transformFn,
|
|
1399
1412
|
method: config.method,
|
|
@@ -1955,278 +1968,33 @@ const PROCESS_ENDPOINTS = {
|
|
|
1955
1968
|
};
|
|
1956
1969
|
|
|
1957
1970
|
/**
|
|
1958
|
-
* SDK Telemetry constants
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
const
|
|
1969
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
1970
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
1971
|
-
const APP_NAME = "ApplicationName";
|
|
1972
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
1973
|
-
// Service and logger names
|
|
1974
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
1975
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
1976
|
-
// Event names
|
|
1977
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
1978
|
-
// Default value for unknown/empty attributes
|
|
1979
|
-
const UNKNOWN = "";
|
|
1980
|
-
|
|
1981
|
-
/**
|
|
1982
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
1983
|
-
*/
|
|
1984
|
-
class ApplicationInsightsEventExporter {
|
|
1985
|
-
constructor(connectionString) {
|
|
1986
|
-
this.connectionString = connectionString;
|
|
1987
|
-
}
|
|
1988
|
-
export(logs, resultCallback) {
|
|
1989
|
-
try {
|
|
1990
|
-
logs.forEach(logRecord => {
|
|
1991
|
-
this.sendAsCustomEvent(logRecord);
|
|
1992
|
-
});
|
|
1993
|
-
resultCallback({ code: 0 });
|
|
1994
|
-
}
|
|
1995
|
-
catch (error) {
|
|
1996
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
1997
|
-
resultCallback({ code: 2, error });
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
shutdown() {
|
|
2001
|
-
return Promise.resolve();
|
|
2002
|
-
}
|
|
2003
|
-
sendAsCustomEvent(logRecord) {
|
|
2004
|
-
// Get event name from body or attributes
|
|
2005
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
2006
|
-
const payload = {
|
|
2007
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
2008
|
-
time: new Date().toISOString(),
|
|
2009
|
-
iKey: this.extractInstrumentationKey(),
|
|
2010
|
-
data: {
|
|
2011
|
-
baseType: 'EventData',
|
|
2012
|
-
baseData: {
|
|
2013
|
-
ver: 2,
|
|
2014
|
-
name: eventName,
|
|
2015
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
2016
|
-
}
|
|
2017
|
-
},
|
|
2018
|
-
tags: {
|
|
2019
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
2020
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
2021
|
-
}
|
|
2022
|
-
};
|
|
2023
|
-
this.sendToApplicationInsights(payload);
|
|
2024
|
-
}
|
|
2025
|
-
extractInstrumentationKey() {
|
|
2026
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
2027
|
-
return match ? match[1] : '';
|
|
2028
|
-
}
|
|
2029
|
-
convertAttributesToProperties(attributes) {
|
|
2030
|
-
const properties = {};
|
|
2031
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
2032
|
-
properties[key] = String(value);
|
|
2033
|
-
});
|
|
2034
|
-
return properties;
|
|
2035
|
-
}
|
|
2036
|
-
async sendToApplicationInsights(payload) {
|
|
2037
|
-
try {
|
|
2038
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
2039
|
-
if (!ingestionEndpoint) {
|
|
2040
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
2044
|
-
const response = await fetch(url, {
|
|
2045
|
-
method: 'POST',
|
|
2046
|
-
headers: {
|
|
2047
|
-
'Content-Type': 'application/json',
|
|
2048
|
-
},
|
|
2049
|
-
body: JSON.stringify(payload)
|
|
2050
|
-
});
|
|
2051
|
-
if (!response.ok) {
|
|
2052
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
catch (error) {
|
|
2056
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
extractIngestionEndpoint() {
|
|
2060
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2061
|
-
return match ? match[1] : '';
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Singleton telemetry client
|
|
2066
|
-
*/
|
|
2067
|
-
class TelemetryClient {
|
|
2068
|
-
constructor() {
|
|
2069
|
-
this.isInitialized = false;
|
|
2070
|
-
}
|
|
2071
|
-
static getInstance() {
|
|
2072
|
-
if (!TelemetryClient.instance) {
|
|
2073
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2074
|
-
}
|
|
2075
|
-
return TelemetryClient.instance;
|
|
2076
|
-
}
|
|
2077
|
-
/**
|
|
2078
|
-
* Initialize telemetry
|
|
2079
|
-
*/
|
|
2080
|
-
initialize(config) {
|
|
2081
|
-
if (this.isInitialized) {
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
this.isInitialized = true;
|
|
2085
|
-
if (config) {
|
|
2086
|
-
this.telemetryContext = config;
|
|
2087
|
-
}
|
|
2088
|
-
try {
|
|
2089
|
-
const connectionString = this.getConnectionString();
|
|
2090
|
-
if (!connectionString) {
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
this.setupTelemetryProvider(connectionString);
|
|
2094
|
-
}
|
|
2095
|
-
catch (error) {
|
|
2096
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2097
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
getConnectionString() {
|
|
2101
|
-
const connectionString = CONNECTION_STRING;
|
|
2102
|
-
return connectionString;
|
|
2103
|
-
}
|
|
2104
|
-
setupTelemetryProvider(connectionString) {
|
|
2105
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2106
|
-
const processor = new BatchLogRecordProcessor(exporter);
|
|
2107
|
-
this.logProvider = new LoggerProvider({
|
|
2108
|
-
processors: [processor]
|
|
2109
|
-
});
|
|
2110
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2111
|
-
}
|
|
2112
|
-
/**
|
|
2113
|
-
* Track a telemetry event
|
|
2114
|
-
*/
|
|
2115
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2116
|
-
try {
|
|
2117
|
-
// Skip if logger not initialized
|
|
2118
|
-
if (!this.logger) {
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
const finalDisplayName = name || eventName;
|
|
2122
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2123
|
-
// Emit as log
|
|
2124
|
-
this.logger.emit({
|
|
2125
|
-
body: finalDisplayName,
|
|
2126
|
-
attributes: attributes,
|
|
2127
|
-
timestamp: Date.now(),
|
|
2128
|
-
});
|
|
2129
|
-
}
|
|
2130
|
-
catch (error) {
|
|
2131
|
-
// Silent failure
|
|
2132
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* Get enriched attributes for telemetry events
|
|
2137
|
-
*/
|
|
2138
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2139
|
-
const attributes = {
|
|
2140
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2141
|
-
[VERSION]: SDK_VERSION,
|
|
2142
|
-
[SERVICE]: eventName,
|
|
2143
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2144
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2145
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2146
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2147
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2148
|
-
...extraAttributes,
|
|
2149
|
-
};
|
|
2150
|
-
return attributes;
|
|
2151
|
-
}
|
|
2152
|
-
/**
|
|
2153
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2154
|
-
*/
|
|
2155
|
-
createCloudUrl() {
|
|
2156
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2157
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2158
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2159
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2160
|
-
return UNKNOWN;
|
|
2161
|
-
}
|
|
2162
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
// Export singleton instance
|
|
2166
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
1971
|
+
* SDK Telemetry constants.
|
|
1972
|
+
*
|
|
1973
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
1974
|
+
* here. The Application Insights connection string is injected into
|
|
1975
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
1976
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
1977
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
1978
|
+
* SDK's public API.
|
|
1979
|
+
*/
|
|
1980
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
1981
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2167
1982
|
|
|
2168
1983
|
/**
|
|
2169
|
-
*
|
|
2170
|
-
*/
|
|
2171
|
-
/**
|
|
2172
|
-
* Common tracking logic shared between method and function decorators
|
|
2173
|
-
*/
|
|
2174
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2175
|
-
return function (...args) {
|
|
2176
|
-
// Determine if we should track this call
|
|
2177
|
-
let shouldTrack = true;
|
|
2178
|
-
if (opts.condition !== undefined) {
|
|
2179
|
-
if (typeof opts.condition === 'function') {
|
|
2180
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2181
|
-
}
|
|
2182
|
-
else {
|
|
2183
|
-
shouldTrack = opts.condition;
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
// Track the event if enabled
|
|
2187
|
-
if (shouldTrack) {
|
|
2188
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2189
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2190
|
-
? nameOrOptions
|
|
2191
|
-
: fallbackName;
|
|
2192
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2193
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2194
|
-
}
|
|
2195
|
-
// Execute the original function
|
|
2196
|
-
return originalFunction.apply(this, args);
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
/**
|
|
2200
|
-
* Track decorator that can be used to automatically track function calls
|
|
2201
|
-
*
|
|
2202
|
-
* Usage:
|
|
2203
|
-
* @track("Service.Method")
|
|
2204
|
-
* function myFunction() { ... }
|
|
2205
|
-
*
|
|
2206
|
-
* @track("Queue.GetAll")
|
|
2207
|
-
* async getAll() { ... }
|
|
2208
|
-
*
|
|
2209
|
-
* @track("Tasks.Create")
|
|
2210
|
-
* async create() { ... }
|
|
1984
|
+
* UiPath TypeScript SDK Telemetry
|
|
2211
1985
|
*
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
return descriptor;
|
|
2225
|
-
}
|
|
2226
|
-
// Function decorator
|
|
2227
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2228
|
-
};
|
|
2229
|
-
}
|
|
1986
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
1987
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
1988
|
+
* does this independently, so events carry their own consumer's identity
|
|
1989
|
+
* and tenant context.
|
|
1990
|
+
*/
|
|
1991
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
1992
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
1993
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
1994
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
1995
|
+
const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
|
|
1996
|
+
const track = createTrack(sdkClient);
|
|
1997
|
+
createTrackEvent(sdkClient);
|
|
2230
1998
|
|
|
2231
1999
|
/**
|
|
2232
2000
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
@@ -2296,33 +2064,32 @@ class ProcessService extends FolderScopedService {
|
|
|
2296
2064
|
}
|
|
2297
2065
|
}, options);
|
|
2298
2066
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
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
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2067
|
+
async start(request, optionsOrFolderId, legacyOptions) {
|
|
2068
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2069
|
+
let folderId;
|
|
2070
|
+
let folderKey;
|
|
2071
|
+
let folderPath;
|
|
2072
|
+
let queryOptions;
|
|
2073
|
+
if (typeof optionsOrFolderId === 'number') {
|
|
2074
|
+
// Deprecated positional form: start(request, folderId, options?)
|
|
2075
|
+
folderId = optionsOrFolderId;
|
|
2076
|
+
queryOptions = legacyOptions ?? {};
|
|
2077
|
+
}
|
|
2078
|
+
else {
|
|
2079
|
+
// Preferred form: start(request, options?)
|
|
2080
|
+
const { folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = optionsOrFolderId ?? {};
|
|
2081
|
+
folderId = fid;
|
|
2082
|
+
folderKey = fkey;
|
|
2083
|
+
folderPath = fpath;
|
|
2084
|
+
queryOptions = rest;
|
|
2085
|
+
}
|
|
2086
|
+
const headers = resolveFolderHeaders({
|
|
2087
|
+
folderId,
|
|
2088
|
+
folderKey,
|
|
2089
|
+
folderPath,
|
|
2090
|
+
resourceType: 'processes.start',
|
|
2091
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2092
|
+
});
|
|
2326
2093
|
// Transform SDK field names to API field names (e.g., processKey → releaseKey)
|
|
2327
2094
|
const apiRequest = transformRequest(request, ProcessMap);
|
|
2328
2095
|
// Create the request object according to API spec
|
|
@@ -2330,8 +2097,8 @@ class ProcessService extends FolderScopedService {
|
|
|
2330
2097
|
startInfo: apiRequest
|
|
2331
2098
|
};
|
|
2332
2099
|
// Prefix all query parameter keys with '$' for OData
|
|
2333
|
-
const keysToPrefix = Object.keys(
|
|
2334
|
-
const apiOptions = addPrefixToKeys(
|
|
2100
|
+
const keysToPrefix = Object.keys(queryOptions);
|
|
2101
|
+
const apiOptions = addPrefixToKeys(queryOptions, ODATA_PREFIX, keysToPrefix);
|
|
2335
2102
|
const response = await this.post(PROCESS_ENDPOINTS.START_PROCESS, requestBody, {
|
|
2336
2103
|
params: apiOptions,
|
|
2337
2104
|
headers
|