@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getOrCreateClient, createTrack, createTrackEvent } from '@uipath/core-telemetry';
|
|
2
2
|
import { io } from 'socket.io-client';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -44,278 +44,33 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* SDK Telemetry constants
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
59
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
60
|
-
const APP_NAME = "ApplicationName";
|
|
61
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
62
|
-
// Service and logger names
|
|
63
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
64
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
65
|
-
// Event names
|
|
66
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
67
|
-
// Default value for unknown/empty attributes
|
|
68
|
-
const UNKNOWN = "";
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
72
|
-
*/
|
|
73
|
-
class ApplicationInsightsEventExporter {
|
|
74
|
-
constructor(connectionString) {
|
|
75
|
-
this.connectionString = connectionString;
|
|
76
|
-
}
|
|
77
|
-
export(logs, resultCallback) {
|
|
78
|
-
try {
|
|
79
|
-
logs.forEach(logRecord => {
|
|
80
|
-
this.sendAsCustomEvent(logRecord);
|
|
81
|
-
});
|
|
82
|
-
resultCallback({ code: 0 });
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
86
|
-
resultCallback({ code: 2, error });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
shutdown() {
|
|
90
|
-
return Promise.resolve();
|
|
91
|
-
}
|
|
92
|
-
sendAsCustomEvent(logRecord) {
|
|
93
|
-
// Get event name from body or attributes
|
|
94
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
95
|
-
const payload = {
|
|
96
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
97
|
-
time: new Date().toISOString(),
|
|
98
|
-
iKey: this.extractInstrumentationKey(),
|
|
99
|
-
data: {
|
|
100
|
-
baseType: 'EventData',
|
|
101
|
-
baseData: {
|
|
102
|
-
ver: 2,
|
|
103
|
-
name: eventName,
|
|
104
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
tags: {
|
|
108
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
109
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
this.sendToApplicationInsights(payload);
|
|
113
|
-
}
|
|
114
|
-
extractInstrumentationKey() {
|
|
115
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
116
|
-
return match ? match[1] : '';
|
|
117
|
-
}
|
|
118
|
-
convertAttributesToProperties(attributes) {
|
|
119
|
-
const properties = {};
|
|
120
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
121
|
-
properties[key] = String(value);
|
|
122
|
-
});
|
|
123
|
-
return properties;
|
|
124
|
-
}
|
|
125
|
-
async sendToApplicationInsights(payload) {
|
|
126
|
-
try {
|
|
127
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
128
|
-
if (!ingestionEndpoint) {
|
|
129
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
133
|
-
const response = await fetch(url, {
|
|
134
|
-
method: 'POST',
|
|
135
|
-
headers: {
|
|
136
|
-
'Content-Type': 'application/json',
|
|
137
|
-
},
|
|
138
|
-
body: JSON.stringify(payload)
|
|
139
|
-
});
|
|
140
|
-
if (!response.ok) {
|
|
141
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
extractIngestionEndpoint() {
|
|
149
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
150
|
-
return match ? match[1] : '';
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Singleton telemetry client
|
|
155
|
-
*/
|
|
156
|
-
class TelemetryClient {
|
|
157
|
-
constructor() {
|
|
158
|
-
this.isInitialized = false;
|
|
159
|
-
}
|
|
160
|
-
static getInstance() {
|
|
161
|
-
if (!TelemetryClient.instance) {
|
|
162
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
163
|
-
}
|
|
164
|
-
return TelemetryClient.instance;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Initialize telemetry
|
|
168
|
-
*/
|
|
169
|
-
initialize(config) {
|
|
170
|
-
if (this.isInitialized) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
this.isInitialized = true;
|
|
174
|
-
if (config) {
|
|
175
|
-
this.telemetryContext = config;
|
|
176
|
-
}
|
|
177
|
-
try {
|
|
178
|
-
const connectionString = this.getConnectionString();
|
|
179
|
-
if (!connectionString) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
this.setupTelemetryProvider(connectionString);
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
186
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
getConnectionString() {
|
|
190
|
-
const connectionString = CONNECTION_STRING;
|
|
191
|
-
return connectionString;
|
|
192
|
-
}
|
|
193
|
-
setupTelemetryProvider(connectionString) {
|
|
194
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
195
|
-
const processor = new BatchLogRecordProcessor(exporter);
|
|
196
|
-
this.logProvider = new LoggerProvider({
|
|
197
|
-
processors: [processor]
|
|
198
|
-
});
|
|
199
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Track a telemetry event
|
|
203
|
-
*/
|
|
204
|
-
track(eventName, name, extraAttributes = {}) {
|
|
205
|
-
try {
|
|
206
|
-
// Skip if logger not initialized
|
|
207
|
-
if (!this.logger) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const finalDisplayName = name || eventName;
|
|
211
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
212
|
-
// Emit as log
|
|
213
|
-
this.logger.emit({
|
|
214
|
-
body: finalDisplayName,
|
|
215
|
-
attributes: attributes,
|
|
216
|
-
timestamp: Date.now(),
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
// Silent failure
|
|
221
|
-
console.debug('Failed to track telemetry event:', error);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Get enriched attributes for telemetry events
|
|
226
|
-
*/
|
|
227
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
228
|
-
const attributes = {
|
|
229
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
230
|
-
[VERSION]: SDK_VERSION,
|
|
231
|
-
[SERVICE]: eventName,
|
|
232
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
233
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
234
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
235
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
236
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
237
|
-
...extraAttributes,
|
|
238
|
-
};
|
|
239
|
-
return attributes;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
243
|
-
*/
|
|
244
|
-
createCloudUrl() {
|
|
245
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
246
|
-
const orgId = this.telemetryContext?.orgName;
|
|
247
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
248
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
249
|
-
return UNKNOWN;
|
|
250
|
-
}
|
|
251
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// Export singleton instance
|
|
255
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
47
|
+
* SDK Telemetry constants.
|
|
48
|
+
*
|
|
49
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
50
|
+
* here. The Application Insights connection string is injected into
|
|
51
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
52
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
53
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
54
|
+
* SDK's public API.
|
|
55
|
+
*/
|
|
56
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
57
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
256
58
|
|
|
257
59
|
/**
|
|
258
|
-
*
|
|
259
|
-
*/
|
|
260
|
-
/**
|
|
261
|
-
* Common tracking logic shared between method and function decorators
|
|
262
|
-
*/
|
|
263
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
264
|
-
return function (...args) {
|
|
265
|
-
// Determine if we should track this call
|
|
266
|
-
let shouldTrack = true;
|
|
267
|
-
if (opts.condition !== undefined) {
|
|
268
|
-
if (typeof opts.condition === 'function') {
|
|
269
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
shouldTrack = opts.condition;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// Track the event if enabled
|
|
276
|
-
if (shouldTrack) {
|
|
277
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
278
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
279
|
-
? nameOrOptions
|
|
280
|
-
: fallbackName;
|
|
281
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
282
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
283
|
-
}
|
|
284
|
-
// Execute the original function
|
|
285
|
-
return originalFunction.apply(this, args);
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Track decorator that can be used to automatically track function calls
|
|
290
|
-
*
|
|
291
|
-
* Usage:
|
|
292
|
-
* @track("Service.Method")
|
|
293
|
-
* function myFunction() { ... }
|
|
294
|
-
*
|
|
295
|
-
* @track("Queue.GetAll")
|
|
296
|
-
* async getAll() { ... }
|
|
297
|
-
*
|
|
298
|
-
* @track("Tasks.Create")
|
|
299
|
-
* async create() { ... }
|
|
300
|
-
*
|
|
301
|
-
* @track("Assets.Update", { condition: false })
|
|
302
|
-
* function myFunction() { ... }
|
|
60
|
+
* UiPath TypeScript SDK Telemetry
|
|
303
61
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
317
|
-
};
|
|
318
|
-
}
|
|
62
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
63
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
64
|
+
* does this independently, so events carry their own consumer's identity
|
|
65
|
+
* and tenant context.
|
|
66
|
+
*/
|
|
67
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
68
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
69
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
70
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
71
|
+
const sdkClient = getOrCreateClient(CLOUD_ROLE_NAME);
|
|
72
|
+
const track = createTrack(sdkClient);
|
|
73
|
+
createTrackEvent(sdkClient);
|
|
319
74
|
|
|
320
75
|
/**
|
|
321
76
|
* Type guards for error response types
|
|
@@ -914,14 +669,25 @@ class ApiClient {
|
|
|
914
669
|
if (!text) {
|
|
915
670
|
return undefined;
|
|
916
671
|
}
|
|
917
|
-
|
|
672
|
+
try {
|
|
673
|
+
return JSON.parse(text);
|
|
674
|
+
}
|
|
675
|
+
catch (error) {
|
|
676
|
+
if (error instanceof SyntaxError) {
|
|
677
|
+
throw new ServerError({
|
|
678
|
+
message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
|
|
679
|
+
statusCode: response.status,
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
throw error;
|
|
683
|
+
}
|
|
918
684
|
}
|
|
919
685
|
catch (error) {
|
|
920
686
|
// If it's already one of our errors, re-throw it
|
|
921
687
|
if (error.type && error.type.includes('Error')) {
|
|
922
688
|
throw error;
|
|
923
689
|
}
|
|
924
|
-
// Otherwise, it's
|
|
690
|
+
// Otherwise, it's a genuine network/fetch failure
|
|
925
691
|
throw ErrorFactory.createNetworkError(error);
|
|
926
692
|
}
|
|
927
693
|
}
|
|
@@ -1546,9 +1312,9 @@ class PaginationHelpers {
|
|
|
1546
1312
|
* @returns Promise resolving to a paginated result
|
|
1547
1313
|
*/
|
|
1548
1314
|
static async getAllPaginated(params) {
|
|
1549
|
-
const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1315
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1550
1316
|
const endpoint = getEndpoint(folderId);
|
|
1551
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1317
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1552
1318
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1553
1319
|
headers,
|
|
1554
1320
|
params: additionalParams,
|
|
@@ -1576,13 +1342,13 @@ class PaginationHelpers {
|
|
|
1576
1342
|
* @returns Promise resolving to an object with data and totalCount
|
|
1577
1343
|
*/
|
|
1578
1344
|
static async getAllNonPaginated(params) {
|
|
1579
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1345
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1580
1346
|
// Set default field names
|
|
1581
1347
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1582
1348
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
1583
1349
|
// Determine endpoint and headers based on folderId
|
|
1584
1350
|
const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
|
|
1585
|
-
const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
|
|
1351
|
+
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1586
1352
|
// Make the API call based on method
|
|
1587
1353
|
let response;
|
|
1588
1354
|
if (method === HTTP_METHODS.POST) {
|
|
@@ -1641,6 +1407,7 @@ class PaginationHelpers {
|
|
|
1641
1407
|
serviceAccess: config.serviceAccess,
|
|
1642
1408
|
getEndpoint: config.getEndpoint,
|
|
1643
1409
|
folderId,
|
|
1410
|
+
headers: config.headers,
|
|
1644
1411
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1645
1412
|
additionalParams: prefixedOptions,
|
|
1646
1413
|
transformFn: config.transformFn,
|
|
@@ -1658,6 +1425,7 @@ class PaginationHelpers {
|
|
|
1658
1425
|
getAllEndpoint: config.getEndpoint(),
|
|
1659
1426
|
getByFolderEndpoint: byFolderEndpoint,
|
|
1660
1427
|
folderId,
|
|
1428
|
+
headers: config.headers,
|
|
1661
1429
|
additionalParams: prefixedOptions,
|
|
1662
1430
|
transformFn: config.transformFn,
|
|
1663
1431
|
method: config.method,
|
|
@@ -2008,6 +1776,17 @@ const ConversationMap = {
|
|
|
2008
1776
|
lastActivityAt: 'lastActivityTime',
|
|
2009
1777
|
agentReleaseId: 'agentId'
|
|
2010
1778
|
};
|
|
1779
|
+
/**
|
|
1780
|
+
* Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
|
|
1781
|
+
* Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
|
|
1782
|
+
* from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
|
|
1783
|
+
* on create/update payloads.
|
|
1784
|
+
*/
|
|
1785
|
+
const ConversationGetAllFilterMap = {
|
|
1786
|
+
agentReleaseKey: 'agentKey',
|
|
1787
|
+
agentReleaseId: 'agentId',
|
|
1788
|
+
search: 'label'
|
|
1789
|
+
};
|
|
2011
1790
|
/**
|
|
2012
1791
|
* Maps fields for Exchange entity to ensure consistent SDK naming
|
|
2013
1792
|
*/
|
|
@@ -6197,24 +5976,43 @@ class ConversationService extends BaseService {
|
|
|
6197
5976
|
* @param options - Options for querying conversations including optional pagination parameters
|
|
6198
5977
|
* @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
|
|
6199
5978
|
*
|
|
6200
|
-
* @example
|
|
5979
|
+
* @example Basic usage - get all conversations
|
|
6201
5980
|
* ```typescript
|
|
6202
|
-
* // Get all conversations (non-paginated)
|
|
6203
5981
|
* const allConversations = await conversationalAgent.conversations.getAll();
|
|
6204
5982
|
*
|
|
6205
|
-
*
|
|
6206
|
-
*
|
|
5983
|
+
* for (const conversation of allConversations.items) {
|
|
5984
|
+
* console.log(`${conversation.label} - created: ${conversation.createdTime}`);
|
|
5985
|
+
* }
|
|
5986
|
+
* ```
|
|
6207
5987
|
*
|
|
6208
|
-
*
|
|
6209
|
-
*
|
|
5988
|
+
* @example With pagination
|
|
5989
|
+
* ```typescript
|
|
5990
|
+
* // First page
|
|
5991
|
+
* const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
|
|
6210
5992
|
*
|
|
6211
5993
|
* // Navigate using cursor
|
|
6212
|
-
* if (
|
|
6213
|
-
* const
|
|
6214
|
-
* cursor:
|
|
5994
|
+
* if (firstPage.hasNextPage) {
|
|
5995
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
5996
|
+
* cursor: firstPage.nextCursor
|
|
6215
5997
|
* });
|
|
6216
5998
|
* }
|
|
6217
5999
|
* ```
|
|
6000
|
+
*
|
|
6001
|
+
* @example Sorted with limit
|
|
6002
|
+
* ```typescript
|
|
6003
|
+
* const result = await conversationalAgent.conversations.getAll({
|
|
6004
|
+
* sort: SortOrder.Descending,
|
|
6005
|
+
* pageSize: 20
|
|
6006
|
+
* });
|
|
6007
|
+
* ```
|
|
6008
|
+
*
|
|
6009
|
+
* @example Filter by agent and search by label
|
|
6010
|
+
* ```typescript
|
|
6011
|
+
* const filtered = await conversationalAgent.conversations.getAll({
|
|
6012
|
+
* agentId: <agentId>,
|
|
6013
|
+
* label: 'budget'
|
|
6014
|
+
* });
|
|
6015
|
+
* ```
|
|
6218
6016
|
*/
|
|
6219
6017
|
async getAll(options) {
|
|
6220
6018
|
// Transform function to convert API timestamps to SDK naming convention and add methods
|
|
@@ -6222,6 +6020,10 @@ class ConversationService extends BaseService {
|
|
|
6222
6020
|
const transformedData = transformData(conversation, ConversationMap);
|
|
6223
6021
|
return createConversationWithMethods(transformedData, this, this, this._exchangeService);
|
|
6224
6022
|
};
|
|
6023
|
+
// Translate SDK filter names (agentKey/agentId/label) to backend names before forwarding
|
|
6024
|
+
const apiOptions = options
|
|
6025
|
+
? transformRequest(options, ConversationGetAllFilterMap)
|
|
6026
|
+
: undefined;
|
|
6225
6027
|
return PaginationHelpers.getAll({
|
|
6226
6028
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
6227
6029
|
getEndpoint: () => CONVERSATION_ENDPOINTS.LIST,
|
|
@@ -6235,8 +6037,8 @@ class ConversationService extends BaseService {
|
|
|
6235
6037
|
tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
|
|
6236
6038
|
}
|
|
6237
6039
|
},
|
|
6238
|
-
excludeFromPrefix: Object.keys(
|
|
6239
|
-
},
|
|
6040
|
+
excludeFromPrefix: Object.keys(apiOptions || {}) // Conversational params are not OData
|
|
6041
|
+
}, apiOptions);
|
|
6240
6042
|
}
|
|
6241
6043
|
/**
|
|
6242
6044
|
* Updates a conversation by ID
|
|
@@ -6804,4 +6606,4 @@ __decorate([
|
|
|
6804
6606
|
track('ConversationalAgent.GetById')
|
|
6805
6607
|
], ConversationalAgentService.prototype, "getById", null);
|
|
6806
6608
|
|
|
6807
|
-
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, LogLevel, 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 };
|
|
6609
|
+
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, LogLevel, 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 };
|