@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var coreTelemetry = require('@uipath/core-telemetry');
|
|
4
4
|
var socket_ioClient = require('socket.io-client');
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
@@ -46,278 +46,33 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* SDK Telemetry constants
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
61
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
62
|
-
const APP_NAME = "ApplicationName";
|
|
63
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
64
|
-
// Service and logger names
|
|
65
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
66
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
67
|
-
// Event names
|
|
68
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
69
|
-
// Default value for unknown/empty attributes
|
|
70
|
-
const UNKNOWN = "";
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
74
|
-
*/
|
|
75
|
-
class ApplicationInsightsEventExporter {
|
|
76
|
-
constructor(connectionString) {
|
|
77
|
-
this.connectionString = connectionString;
|
|
78
|
-
}
|
|
79
|
-
export(logs, resultCallback) {
|
|
80
|
-
try {
|
|
81
|
-
logs.forEach(logRecord => {
|
|
82
|
-
this.sendAsCustomEvent(logRecord);
|
|
83
|
-
});
|
|
84
|
-
resultCallback({ code: 0 });
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
88
|
-
resultCallback({ code: 2, error });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
shutdown() {
|
|
92
|
-
return Promise.resolve();
|
|
93
|
-
}
|
|
94
|
-
sendAsCustomEvent(logRecord) {
|
|
95
|
-
// Get event name from body or attributes
|
|
96
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
97
|
-
const payload = {
|
|
98
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
99
|
-
time: new Date().toISOString(),
|
|
100
|
-
iKey: this.extractInstrumentationKey(),
|
|
101
|
-
data: {
|
|
102
|
-
baseType: 'EventData',
|
|
103
|
-
baseData: {
|
|
104
|
-
ver: 2,
|
|
105
|
-
name: eventName,
|
|
106
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
tags: {
|
|
110
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
111
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
this.sendToApplicationInsights(payload);
|
|
115
|
-
}
|
|
116
|
-
extractInstrumentationKey() {
|
|
117
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
118
|
-
return match ? match[1] : '';
|
|
119
|
-
}
|
|
120
|
-
convertAttributesToProperties(attributes) {
|
|
121
|
-
const properties = {};
|
|
122
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
123
|
-
properties[key] = String(value);
|
|
124
|
-
});
|
|
125
|
-
return properties;
|
|
126
|
-
}
|
|
127
|
-
async sendToApplicationInsights(payload) {
|
|
128
|
-
try {
|
|
129
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
130
|
-
if (!ingestionEndpoint) {
|
|
131
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
135
|
-
const response = await fetch(url, {
|
|
136
|
-
method: 'POST',
|
|
137
|
-
headers: {
|
|
138
|
-
'Content-Type': 'application/json',
|
|
139
|
-
},
|
|
140
|
-
body: JSON.stringify(payload)
|
|
141
|
-
});
|
|
142
|
-
if (!response.ok) {
|
|
143
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
extractIngestionEndpoint() {
|
|
151
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
152
|
-
return match ? match[1] : '';
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Singleton telemetry client
|
|
157
|
-
*/
|
|
158
|
-
class TelemetryClient {
|
|
159
|
-
constructor() {
|
|
160
|
-
this.isInitialized = false;
|
|
161
|
-
}
|
|
162
|
-
static getInstance() {
|
|
163
|
-
if (!TelemetryClient.instance) {
|
|
164
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
165
|
-
}
|
|
166
|
-
return TelemetryClient.instance;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Initialize telemetry
|
|
170
|
-
*/
|
|
171
|
-
initialize(config) {
|
|
172
|
-
if (this.isInitialized) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
this.isInitialized = true;
|
|
176
|
-
if (config) {
|
|
177
|
-
this.telemetryContext = config;
|
|
178
|
-
}
|
|
179
|
-
try {
|
|
180
|
-
const connectionString = this.getConnectionString();
|
|
181
|
-
if (!connectionString) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
this.setupTelemetryProvider(connectionString);
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
188
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
getConnectionString() {
|
|
192
|
-
const connectionString = CONNECTION_STRING;
|
|
193
|
-
return connectionString;
|
|
194
|
-
}
|
|
195
|
-
setupTelemetryProvider(connectionString) {
|
|
196
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
197
|
-
const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
|
|
198
|
-
this.logProvider = new sdkLogs.LoggerProvider({
|
|
199
|
-
processors: [processor]
|
|
200
|
-
});
|
|
201
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Track a telemetry event
|
|
205
|
-
*/
|
|
206
|
-
track(eventName, name, extraAttributes = {}) {
|
|
207
|
-
try {
|
|
208
|
-
// Skip if logger not initialized
|
|
209
|
-
if (!this.logger) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const finalDisplayName = name || eventName;
|
|
213
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
214
|
-
// Emit as log
|
|
215
|
-
this.logger.emit({
|
|
216
|
-
body: finalDisplayName,
|
|
217
|
-
attributes: attributes,
|
|
218
|
-
timestamp: Date.now(),
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
// Silent failure
|
|
223
|
-
console.debug('Failed to track telemetry event:', error);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Get enriched attributes for telemetry events
|
|
228
|
-
*/
|
|
229
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
230
|
-
const attributes = {
|
|
231
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
232
|
-
[VERSION]: SDK_VERSION,
|
|
233
|
-
[SERVICE]: eventName,
|
|
234
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
235
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
236
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
237
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
238
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
239
|
-
...extraAttributes,
|
|
240
|
-
};
|
|
241
|
-
return attributes;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
245
|
-
*/
|
|
246
|
-
createCloudUrl() {
|
|
247
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
248
|
-
const orgId = this.telemetryContext?.orgName;
|
|
249
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
250
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
251
|
-
return UNKNOWN;
|
|
252
|
-
}
|
|
253
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// Export singleton instance
|
|
257
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
49
|
+
* SDK Telemetry constants.
|
|
50
|
+
*
|
|
51
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
52
|
+
* here. The Application Insights connection string is injected into
|
|
53
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
54
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
55
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
56
|
+
* SDK's public API.
|
|
57
|
+
*/
|
|
58
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
59
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
258
60
|
|
|
259
61
|
/**
|
|
260
|
-
*
|
|
261
|
-
*/
|
|
262
|
-
/**
|
|
263
|
-
* Common tracking logic shared between method and function decorators
|
|
264
|
-
*/
|
|
265
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
266
|
-
return function (...args) {
|
|
267
|
-
// Determine if we should track this call
|
|
268
|
-
let shouldTrack = true;
|
|
269
|
-
if (opts.condition !== undefined) {
|
|
270
|
-
if (typeof opts.condition === 'function') {
|
|
271
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
shouldTrack = opts.condition;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
// Track the event if enabled
|
|
278
|
-
if (shouldTrack) {
|
|
279
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
280
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
281
|
-
? nameOrOptions
|
|
282
|
-
: fallbackName;
|
|
283
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
284
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
285
|
-
}
|
|
286
|
-
// Execute the original function
|
|
287
|
-
return originalFunction.apply(this, args);
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Track decorator that can be used to automatically track function calls
|
|
292
|
-
*
|
|
293
|
-
* Usage:
|
|
294
|
-
* @track("Service.Method")
|
|
295
|
-
* function myFunction() { ... }
|
|
62
|
+
* UiPath TypeScript SDK Telemetry
|
|
296
63
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
function track(nameOrOptions, options) {
|
|
310
|
-
return function decorator(_target, propertyKey, descriptor) {
|
|
311
|
-
const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
|
|
312
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
313
|
-
// Method decorator
|
|
314
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
315
|
-
return descriptor;
|
|
316
|
-
}
|
|
317
|
-
// Function decorator
|
|
318
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
319
|
-
};
|
|
320
|
-
}
|
|
64
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
65
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
66
|
+
* does this independently, so events carry their own consumer's identity
|
|
67
|
+
* and tenant context.
|
|
68
|
+
*/
|
|
69
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
70
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
71
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
72
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
73
|
+
const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
|
|
74
|
+
const track = coreTelemetry.createTrack(sdkClient);
|
|
75
|
+
coreTelemetry.createTrackEvent(sdkClient);
|
|
321
76
|
|
|
322
77
|
/**
|
|
323
78
|
* Type guards for error response types
|
|
@@ -956,6 +711,27 @@ var PaginationType;
|
|
|
956
711
|
/**
|
|
957
712
|
* Collection of utility functions for working with objects
|
|
958
713
|
*/
|
|
714
|
+
/**
|
|
715
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
716
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
717
|
+
* Direct key match takes priority over nested traversal.
|
|
718
|
+
*/
|
|
719
|
+
function resolveNestedField(data, fieldPath) {
|
|
720
|
+
if (!data) {
|
|
721
|
+
return undefined;
|
|
722
|
+
}
|
|
723
|
+
if (fieldPath in data) {
|
|
724
|
+
return data[fieldPath];
|
|
725
|
+
}
|
|
726
|
+
if (!fieldPath.includes('.')) {
|
|
727
|
+
return undefined;
|
|
728
|
+
}
|
|
729
|
+
let value = data;
|
|
730
|
+
for (const part of fieldPath.split('.')) {
|
|
731
|
+
value = value?.[part];
|
|
732
|
+
}
|
|
733
|
+
return value;
|
|
734
|
+
}
|
|
959
735
|
/**
|
|
960
736
|
* Filters out undefined values from an object
|
|
961
737
|
* @param obj The source object
|
|
@@ -1205,6 +981,10 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1205
981
|
TOKEN_PARAM: 'cursor'
|
|
1206
982
|
};
|
|
1207
983
|
|
|
984
|
+
/**
|
|
985
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
986
|
+
* Returns the original value if parsing fails.
|
|
987
|
+
*/
|
|
1208
988
|
/**
|
|
1209
989
|
* Transforms data by mapping fields according to the provided field mapping
|
|
1210
990
|
* @param data The source data to transform
|
|
@@ -1574,7 +1354,8 @@ class PaginationHelpers {
|
|
|
1574
1354
|
// Extract and transform items from response
|
|
1575
1355
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1576
1356
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1577
|
-
const
|
|
1357
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1358
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1578
1359
|
// Parse items - automatically handle JSON string responses
|
|
1579
1360
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1580
1361
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1871,9 +1652,17 @@ class BaseService {
|
|
|
1871
1652
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1872
1653
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1873
1654
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1655
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1656
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1657
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1874
1658
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1875
|
-
if (
|
|
1876
|
-
|
|
1659
|
+
if (convertToSkip) {
|
|
1660
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1661
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1877
1666
|
}
|
|
1878
1667
|
{
|
|
1879
1668
|
requestParams[countParam] = true;
|
|
@@ -1904,7 +1693,8 @@ class BaseService {
|
|
|
1904
1693
|
// Extract items and metadata
|
|
1905
1694
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1906
1695
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1907
|
-
const
|
|
1696
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1697
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1908
1698
|
const continuationToken = response.data[continuationTokenField];
|
|
1909
1699
|
// Determine if there are more pages
|
|
1910
1700
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1975,6 +1765,17 @@ const ConversationMap = {
|
|
|
1975
1765
|
lastActivityAt: 'lastActivityTime',
|
|
1976
1766
|
agentReleaseId: 'agentId'
|
|
1977
1767
|
};
|
|
1768
|
+
/**
|
|
1769
|
+
* Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
|
|
1770
|
+
* Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
|
|
1771
|
+
* from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
|
|
1772
|
+
* on create/update payloads.
|
|
1773
|
+
*/
|
|
1774
|
+
const ConversationGetAllFilterMap = {
|
|
1775
|
+
agentReleaseKey: 'agentKey',
|
|
1776
|
+
agentReleaseId: 'agentId',
|
|
1777
|
+
search: 'label'
|
|
1778
|
+
};
|
|
1978
1779
|
/**
|
|
1979
1780
|
* Maps fields for Exchange entity to ensure consistent SDK naming
|
|
1980
1781
|
*/
|
|
@@ -6164,24 +5965,43 @@ class ConversationService extends BaseService {
|
|
|
6164
5965
|
* @param options - Options for querying conversations including optional pagination parameters
|
|
6165
5966
|
* @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
|
|
6166
5967
|
*
|
|
6167
|
-
* @example
|
|
5968
|
+
* @example Basic usage - get all conversations
|
|
6168
5969
|
* ```typescript
|
|
6169
|
-
* // Get all conversations (non-paginated)
|
|
6170
5970
|
* const allConversations = await conversationalAgent.conversations.getAll();
|
|
6171
5971
|
*
|
|
6172
|
-
*
|
|
6173
|
-
*
|
|
5972
|
+
* for (const conversation of allConversations.items) {
|
|
5973
|
+
* console.log(`${conversation.label} - created: ${conversation.createdTime}`);
|
|
5974
|
+
* }
|
|
5975
|
+
* ```
|
|
6174
5976
|
*
|
|
6175
|
-
*
|
|
6176
|
-
*
|
|
5977
|
+
* @example With pagination
|
|
5978
|
+
* ```typescript
|
|
5979
|
+
* // First page
|
|
5980
|
+
* const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
|
|
6177
5981
|
*
|
|
6178
5982
|
* // Navigate using cursor
|
|
6179
|
-
* if (
|
|
6180
|
-
* const
|
|
6181
|
-
* cursor:
|
|
5983
|
+
* if (firstPage.hasNextPage) {
|
|
5984
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
5985
|
+
* cursor: firstPage.nextCursor
|
|
6182
5986
|
* });
|
|
6183
5987
|
* }
|
|
6184
5988
|
* ```
|
|
5989
|
+
*
|
|
5990
|
+
* @example Sorted with limit
|
|
5991
|
+
* ```typescript
|
|
5992
|
+
* const result = await conversationalAgent.conversations.getAll({
|
|
5993
|
+
* sort: SortOrder.Descending,
|
|
5994
|
+
* pageSize: 20
|
|
5995
|
+
* });
|
|
5996
|
+
* ```
|
|
5997
|
+
*
|
|
5998
|
+
* @example Filter by agent and search by label
|
|
5999
|
+
* ```typescript
|
|
6000
|
+
* const filtered = await conversationalAgent.conversations.getAll({
|
|
6001
|
+
* agentId: <agentId>,
|
|
6002
|
+
* label: 'budget'
|
|
6003
|
+
* });
|
|
6004
|
+
* ```
|
|
6185
6005
|
*/
|
|
6186
6006
|
async getAll(options) {
|
|
6187
6007
|
// Transform function to convert API timestamps to SDK naming convention and add methods
|
|
@@ -6189,6 +6009,10 @@ class ConversationService extends BaseService {
|
|
|
6189
6009
|
const transformedData = transformData(conversation, ConversationMap);
|
|
6190
6010
|
return createConversationWithMethods(transformedData, this, this, this._exchangeService);
|
|
6191
6011
|
};
|
|
6012
|
+
// Translate SDK filter names (agentKey/agentId/label) to backend names before forwarding
|
|
6013
|
+
const apiOptions = options
|
|
6014
|
+
? transformRequest(options, ConversationGetAllFilterMap)
|
|
6015
|
+
: undefined;
|
|
6192
6016
|
return PaginationHelpers.getAll({
|
|
6193
6017
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
6194
6018
|
getEndpoint: () => CONVERSATION_ENDPOINTS.LIST,
|
|
@@ -6202,8 +6026,8 @@ class ConversationService extends BaseService {
|
|
|
6202
6026
|
tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
|
|
6203
6027
|
}
|
|
6204
6028
|
},
|
|
6205
|
-
excludeFromPrefix: Object.keys(
|
|
6206
|
-
},
|
|
6029
|
+
excludeFromPrefix: Object.keys(apiOptions || {}) // Conversational params are not OData
|
|
6030
|
+
}, apiOptions);
|
|
6207
6031
|
}
|
|
6208
6032
|
/**
|
|
6209
6033
|
* Updates a conversation by ID
|
|
@@ -6784,6 +6608,7 @@ exports.ConversationEventHelperManager = ConversationEventHelperManager;
|
|
|
6784
6608
|
exports.ConversationEventHelperManagerImpl = ConversationEventHelperManagerImpl;
|
|
6785
6609
|
exports.ConversationEventInvalidOperationError = ConversationEventInvalidOperationError;
|
|
6786
6610
|
exports.ConversationEventValidationError = ConversationEventValidationError;
|
|
6611
|
+
exports.ConversationGetAllFilterMap = ConversationGetAllFilterMap;
|
|
6787
6612
|
exports.ConversationMap = ConversationMap;
|
|
6788
6613
|
exports.ConversationalAgent = ConversationalAgentService;
|
|
6789
6614
|
exports.ConversationalAgentService = ConversationalAgentService;
|
|
@@ -109,6 +109,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
109
109
|
offsetParam?: string;
|
|
110
110
|
tokenParam?: string;
|
|
111
111
|
countParam?: string;
|
|
112
|
+
convertToSkip?: boolean;
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
}
|
|
@@ -312,6 +313,15 @@ declare class BaseService {
|
|
|
312
313
|
declare const ConversationMap: {
|
|
313
314
|
[key: string]: string;
|
|
314
315
|
};
|
|
316
|
+
/**
|
|
317
|
+
* Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
|
|
318
|
+
* Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
|
|
319
|
+
* from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
|
|
320
|
+
* on create/update payloads.
|
|
321
|
+
*/
|
|
322
|
+
declare const ConversationGetAllFilterMap: {
|
|
323
|
+
[key: string]: string;
|
|
324
|
+
};
|
|
315
325
|
/**
|
|
316
326
|
* Maps fields for Exchange entity to ensure consistent SDK naming
|
|
317
327
|
*/
|
|
@@ -3875,8 +3885,12 @@ interface ConversationServiceModel {
|
|
|
3875
3885
|
/**
|
|
3876
3886
|
* Gets all conversations with optional filtering and pagination
|
|
3877
3887
|
*
|
|
3888
|
+
* The method returns either:
|
|
3889
|
+
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
3890
|
+
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
3891
|
+
*
|
|
3878
3892
|
* @param options - Options for querying conversations including optional pagination parameters
|
|
3879
|
-
* @returns Promise resolving to either an array of conversations NonPaginatedResponse<ConversationGetResponse> or a PaginatedResponse<ConversationGetResponse> when pagination options are used
|
|
3893
|
+
* @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
|
|
3880
3894
|
*
|
|
3881
3895
|
* @example Basic usage - get all conversations
|
|
3882
3896
|
* ```typescript
|
|
@@ -3907,6 +3921,14 @@ interface ConversationServiceModel {
|
|
|
3907
3921
|
* pageSize: 20
|
|
3908
3922
|
* });
|
|
3909
3923
|
* ```
|
|
3924
|
+
*
|
|
3925
|
+
* @example Filter by agent and search by label
|
|
3926
|
+
* ```typescript
|
|
3927
|
+
* const filtered = await conversationalAgent.conversations.getAll({
|
|
3928
|
+
* agentId: <agentId>,
|
|
3929
|
+
* label: 'budget'
|
|
3930
|
+
* });
|
|
3931
|
+
* ```
|
|
3910
3932
|
*/
|
|
3911
3933
|
getAll<T extends ConversationGetAllOptions = ConversationGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ConversationGetResponse> : NonPaginatedResponse<ConversationGetResponse>>;
|
|
3912
3934
|
/**
|
|
@@ -4299,6 +4321,14 @@ interface ConversationUpdateOptions {
|
|
|
4299
4321
|
type ConversationGetAllOptions = PaginationOptions & {
|
|
4300
4322
|
/** Sort order for conversations */
|
|
4301
4323
|
sort?: SortOrder;
|
|
4324
|
+
/** GUID key of the agent to filter conversations by. */
|
|
4325
|
+
agentKey?: string;
|
|
4326
|
+
/** Numeric ID of the agent to filter conversations by. */
|
|
4327
|
+
agentId?: number;
|
|
4328
|
+
/**
|
|
4329
|
+
* Case-insensitive substring filter applied to conversation labels (1–100 chars).
|
|
4330
|
+
*/
|
|
4331
|
+
label?: string;
|
|
4302
4332
|
};
|
|
4303
4333
|
/**
|
|
4304
4334
|
* File upload access details for uploading file content to blob storage
|
|
@@ -4444,8 +4474,10 @@ interface RawAgentGetResponse {
|
|
|
4444
4474
|
description: string;
|
|
4445
4475
|
/** Process version */
|
|
4446
4476
|
processVersion: string;
|
|
4447
|
-
/** Process key identifier */
|
|
4477
|
+
/** Process key identifier (a dotted-path string like `Solution.Package.Agent`) */
|
|
4448
4478
|
processKey: string;
|
|
4479
|
+
/** GUID key of the agent release */
|
|
4480
|
+
releaseKey?: string;
|
|
4449
4481
|
/** Folder ID */
|
|
4450
4482
|
folderId: number;
|
|
4451
4483
|
/** Feed ID */
|
|
@@ -6411,24 +6443,43 @@ declare class ConversationService extends BaseService implements ConversationSer
|
|
|
6411
6443
|
* @param options - Options for querying conversations including optional pagination parameters
|
|
6412
6444
|
* @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
|
|
6413
6445
|
*
|
|
6414
|
-
* @example
|
|
6446
|
+
* @example Basic usage - get all conversations
|
|
6415
6447
|
* ```typescript
|
|
6416
|
-
* // Get all conversations (non-paginated)
|
|
6417
6448
|
* const allConversations = await conversationalAgent.conversations.getAll();
|
|
6418
6449
|
*
|
|
6419
|
-
*
|
|
6420
|
-
*
|
|
6450
|
+
* for (const conversation of allConversations.items) {
|
|
6451
|
+
* console.log(`${conversation.label} - created: ${conversation.createdTime}`);
|
|
6452
|
+
* }
|
|
6453
|
+
* ```
|
|
6421
6454
|
*
|
|
6422
|
-
*
|
|
6423
|
-
*
|
|
6455
|
+
* @example With pagination
|
|
6456
|
+
* ```typescript
|
|
6457
|
+
* // First page
|
|
6458
|
+
* const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
|
|
6424
6459
|
*
|
|
6425
6460
|
* // Navigate using cursor
|
|
6426
|
-
* if (
|
|
6427
|
-
* const
|
|
6428
|
-
* cursor:
|
|
6461
|
+
* if (firstPage.hasNextPage) {
|
|
6462
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
6463
|
+
* cursor: firstPage.nextCursor
|
|
6429
6464
|
* });
|
|
6430
6465
|
* }
|
|
6431
6466
|
* ```
|
|
6467
|
+
*
|
|
6468
|
+
* @example Sorted with limit
|
|
6469
|
+
* ```typescript
|
|
6470
|
+
* const result = await conversationalAgent.conversations.getAll({
|
|
6471
|
+
* sort: SortOrder.Descending,
|
|
6472
|
+
* pageSize: 20
|
|
6473
|
+
* });
|
|
6474
|
+
* ```
|
|
6475
|
+
*
|
|
6476
|
+
* @example Filter by agent and search by label
|
|
6477
|
+
* ```typescript
|
|
6478
|
+
* const filtered = await conversationalAgent.conversations.getAll({
|
|
6479
|
+
* agentId: <agentId>,
|
|
6480
|
+
* label: 'budget'
|
|
6481
|
+
* });
|
|
6482
|
+
* ```
|
|
6432
6483
|
*/
|
|
6433
6484
|
getAll<T extends ConversationGetAllOptions = ConversationGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ConversationGetResponse> : NonPaginatedResponse<ConversationGetResponse>>;
|
|
6434
6485
|
/**
|
|
@@ -6962,5 +7013,5 @@ declare class ConversationalAgentService extends BaseService implements Conversa
|
|
|
6962
7013
|
getFeatureFlags(): Promise<FeatureFlags>;
|
|
6963
7014
|
}
|
|
6964
7015
|
|
|
6965
|
-
export { AgentMap, AsyncInputStreamEventHelper, AsyncInputStreamEventHelperImpl, AsyncToolCallEventHelper, AsyncToolCallEventHelperImpl, CitationErrorType, ContentPartEventHelper, ContentPartEventHelperImpl, ContentPartHelper, ConversationEventHelperBase, ConversationEventHelperManager, ConversationEventHelperManagerImpl, ConversationEventInvalidOperationError, ConversationEventValidationError, ConversationMap, ConversationalAgentService as ConversationalAgent, ConversationalAgentService, EventErrorId, ExchangeEventHelper, ExchangeEventHelperImpl, ExchangeMap, ExchangeService, ExchangeService as Exchanges, FeedbackRating, InputStreamSpeechSensitivity, InterruptType, MessageEventHelper, MessageEventHelperImpl, MessageMap, MessageRole, MessageService, MessageService as Messages, SessionEventHelper, SessionEventHelperImpl, SortOrder, ToolCallEventHelper, ToolCallEventHelperImpl, UserSettingsService as UserSettings, UserSettingsMap, UserSettingsService, assertCitationSourceMedia, assertCitationSourceUrl, assertExternalValue, assertInlineValue, createAgentWithMethods, createConversationWithMethods, isCitationSourceMedia, isCitationSourceUrl, isExternalValue, isInlineValue, transformExchange, transformExchanges, transformMessage };
|
|
7016
|
+
export { AgentMap, AsyncInputStreamEventHelper, AsyncInputStreamEventHelperImpl, AsyncToolCallEventHelper, AsyncToolCallEventHelperImpl, CitationErrorType, ContentPartEventHelper, ContentPartEventHelperImpl, ContentPartHelper, ConversationEventHelperBase, ConversationEventHelperManager, ConversationEventHelperManagerImpl, ConversationEventInvalidOperationError, ConversationEventValidationError, ConversationGetAllFilterMap, ConversationMap, ConversationalAgentService as ConversationalAgent, ConversationalAgentService, EventErrorId, ExchangeEventHelper, ExchangeEventHelperImpl, ExchangeMap, ExchangeService, ExchangeService as Exchanges, FeedbackRating, InputStreamSpeechSensitivity, InterruptType, MessageEventHelper, MessageEventHelperImpl, MessageMap, MessageRole, MessageService, MessageService as Messages, SessionEventHelper, SessionEventHelperImpl, SortOrder, ToolCallEventHelper, ToolCallEventHelperImpl, UserSettingsService as UserSettings, UserSettingsMap, UserSettingsService, assertCitationSourceMedia, assertCitationSourceUrl, assertExternalValue, assertInlineValue, createAgentWithMethods, createConversationWithMethods, isCitationSourceMedia, isCitationSourceUrl, isExternalValue, isInlineValue, transformExchange, transformExchanges, transformMessage };
|
|
6966
7017
|
export type { AgentAppearance, AgentConversationServiceModel, AgentCreateConversationOptions, AgentGetByIdResponse, AgentGetResponse, AgentInput, AgentMethods, AgentStartingPrompt, AnyErrorEndHandler, AnyErrorEndHandlerArgs, AnyErrorStartHandler, AnyErrorStartHandlerArgs, AsyncInputStream, AsyncInputStreamChunkEvent, AsyncInputStreamChunkHandler, AsyncInputStreamEndEvent, AsyncInputStreamEndHandler, AsyncInputStreamEvent, AsyncInputStreamStartEvent, AsyncToolCallStartHandler, AsyncToolCallStartHandlerAsync, AsyncToolCallStream, ChunkHandler, Citation, CitationEndEvent, CitationError, CitationEvent, CitationOptions, CitationSource, CitationSourceBase, CitationSourceMedia, CitationSourceUrl, CitationStartEvent, CompletedContentPart, CompletedMessage, CompletedToolCall, ContentPart, ContentPartChunkEvent, ContentPartCompletedHandler, ContentPartData, ContentPartEndEvent, ContentPartEndHandler, ContentPartEvent, ContentPartGetResponse, ContentPartInterrupted, ContentPartStartEvent, ContentPartStartEventOptions, ContentPartStartEventWithData, ContentPartStartHandler, ContentPartStartHandlerAsync, ContentPartStartMetaData, ContentPartStream, ConversationAttachmentCreateResponse, ConversationAttachmentUploadResponse, ConversationCreateOptions, ConversationCreateResponse, ConversationDeleteResponse, ConversationEvent, ConversationEventEmitter, ConversationEventErrorSource, ConversationEventHandler, ConversationEventHelperManagerConfig, ConversationEventHelperProperties, ConversationExchangeServiceModel, ConversationGetAllOptions, ConversationGetResponse, ConversationJobStartOverrides, ConversationMethods, ConversationServiceModel, ConversationSessionMethods, ConversationSessionOptions, ConversationUpdateOptions, ConversationUpdateResponse, ConversationalAgentOptions, ConversationalAgentServiceModel, CreateFeedbackOptions, DeletedHandler, ErrorEndEvent, ErrorEndEventOptions, ErrorEndHandler, ErrorEndHandlerArgs, ErrorEvent, ErrorStartEvent, ErrorStartEventOptions, ErrorStartHandler, ErrorStartHandlerArgs, Exchange, ExchangeEndEvent, ExchangeEndHandler, ExchangeEvent, ExchangeGetAllOptions, ExchangeGetByIdOptions, ExchangeGetResponse, ExchangeServiceModel, ExchangeStartEvent, ExchangeStartEventOptions, ExchangeStartHandler, ExchangeStartHandlerAsync, ExchangeStream, ExternalValue, FeatureFlags, FeedbackCreateResponse, FileUploadAccess, GenericInterruptStartEvent, InlineOrExternalValue, InlineValue, InputStreamStartEventOptions, InputStreamStartHandler, Interrupt, InterruptCompletedHandler, InterruptCompletedHandlerArgs, InterruptEndEvent, InterruptEndHandler, InterruptEndHandlerArgs, InterruptEvent, InterruptStartEvent, InterruptStartHandler, InterruptStartHandlerArgs, JSONArray, JSONObject, JSONPrimitive, JSONValue, LabelUpdatedEvent, LabelUpdatedHandler, MakeOptional, MakeRequired, Message, MessageCompletedHandler, MessageEndEvent, MessageEndHandler, MessageEvent, MessageGetResponse, MessageServiceModel, MessageStartEvent, MessageStartEventOptions, MessageStartHandler, MessageStartHandlerAsync, MessageStream, MetaData, MetaEvent, MetaEventHandler, RawAgentGetByIdResponse, RawAgentGetResponse, RawConversationGetResponse, SendMessageWithContentPartOptions, SessionCapabilities, SessionEndEvent, SessionEndHandler, SessionEndingEvent, SessionEndingHandler, SessionStartEvent, SessionStartEventOptions, SessionStartHandler, SessionStartHandlerAsync, SessionStartedEvent, SessionStartedHandler, SessionStream, Simplify, ToolCall, ToolCallCompletedHandler, ToolCallConfirmHandler, ToolCallConfirmationEndValue, ToolCallConfirmationEvent, ToolCallConfirmationHandler, ToolCallConfirmationHandlerArgs, ToolCallConfirmationInterruptStartEvent, ToolCallConfirmationValue, ToolCallEndEvent, ToolCallEndHandler, ToolCallEvent, ToolCallInputValue, ToolCallOutputValue, ToolCallResult, ToolCallStartEvent, ToolCallStartEventWithId, ToolCallStartHandler, ToolCallStartHandlerAsync, ToolCallStream, UnhandledErrorEndHandler, UnhandledErrorEndHandlerArgs, UnhandledErrorStartHandler, UnhandledErrorStartHandlerArgs, UserSettingsGetResponse, UserSettingsServiceModel, UserSettingsUpdateOptions, UserSettingsUpdateResponse };
|