@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,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() { ... }
|
|
60
|
+
* UiPath TypeScript SDK Telemetry
|
|
294
61
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
function track(nameOrOptions, options) {
|
|
308
|
-
return function decorator(_target, propertyKey, descriptor) {
|
|
309
|
-
const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
|
|
310
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
311
|
-
// Method decorator
|
|
312
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
313
|
-
return descriptor;
|
|
314
|
-
}
|
|
315
|
-
// Function decorator
|
|
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
|
|
@@ -954,6 +709,27 @@ var PaginationType;
|
|
|
954
709
|
/**
|
|
955
710
|
* Collection of utility functions for working with objects
|
|
956
711
|
*/
|
|
712
|
+
/**
|
|
713
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
714
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
715
|
+
* Direct key match takes priority over nested traversal.
|
|
716
|
+
*/
|
|
717
|
+
function resolveNestedField(data, fieldPath) {
|
|
718
|
+
if (!data) {
|
|
719
|
+
return undefined;
|
|
720
|
+
}
|
|
721
|
+
if (fieldPath in data) {
|
|
722
|
+
return data[fieldPath];
|
|
723
|
+
}
|
|
724
|
+
if (!fieldPath.includes('.')) {
|
|
725
|
+
return undefined;
|
|
726
|
+
}
|
|
727
|
+
let value = data;
|
|
728
|
+
for (const part of fieldPath.split('.')) {
|
|
729
|
+
value = value?.[part];
|
|
730
|
+
}
|
|
731
|
+
return value;
|
|
732
|
+
}
|
|
957
733
|
/**
|
|
958
734
|
* Filters out undefined values from an object
|
|
959
735
|
* @param obj The source object
|
|
@@ -1203,6 +979,10 @@ const CONVERSATIONAL_TOKEN_PARAMS = {
|
|
|
1203
979
|
TOKEN_PARAM: 'cursor'
|
|
1204
980
|
};
|
|
1205
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
984
|
+
* Returns the original value if parsing fails.
|
|
985
|
+
*/
|
|
1206
986
|
/**
|
|
1207
987
|
* Transforms data by mapping fields according to the provided field mapping
|
|
1208
988
|
* @param data The source data to transform
|
|
@@ -1572,7 +1352,8 @@ class PaginationHelpers {
|
|
|
1572
1352
|
// Extract and transform items from response
|
|
1573
1353
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1574
1354
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1575
|
-
const
|
|
1355
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1356
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1576
1357
|
// Parse items - automatically handle JSON string responses
|
|
1577
1358
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1578
1359
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1869,9 +1650,17 @@ class BaseService {
|
|
|
1869
1650
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1870
1651
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1871
1652
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1653
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1654
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1655
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1872
1656
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1873
|
-
if (
|
|
1874
|
-
|
|
1657
|
+
if (convertToSkip) {
|
|
1658
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1659
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
else {
|
|
1663
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1875
1664
|
}
|
|
1876
1665
|
{
|
|
1877
1666
|
requestParams[countParam] = true;
|
|
@@ -1902,7 +1691,8 @@ class BaseService {
|
|
|
1902
1691
|
// Extract items and metadata
|
|
1903
1692
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1904
1693
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1905
|
-
const
|
|
1694
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1695
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1906
1696
|
const continuationToken = response.data[continuationTokenField];
|
|
1907
1697
|
// Determine if there are more pages
|
|
1908
1698
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1973,6 +1763,17 @@ const ConversationMap = {
|
|
|
1973
1763
|
lastActivityAt: 'lastActivityTime',
|
|
1974
1764
|
agentReleaseId: 'agentId'
|
|
1975
1765
|
};
|
|
1766
|
+
/**
|
|
1767
|
+
* Maps API filter param names (left) to SDK-facing names (right) for the conversation list endpoint.
|
|
1768
|
+
* Used by `getAll` to translate SDK filters to the field names the backend expects. Kept separate
|
|
1769
|
+
* from `ConversationMap` because `label`/`search` would otherwise collide with the `label` field
|
|
1770
|
+
* on create/update payloads.
|
|
1771
|
+
*/
|
|
1772
|
+
const ConversationGetAllFilterMap = {
|
|
1773
|
+
agentReleaseKey: 'agentKey',
|
|
1774
|
+
agentReleaseId: 'agentId',
|
|
1775
|
+
search: 'label'
|
|
1776
|
+
};
|
|
1976
1777
|
/**
|
|
1977
1778
|
* Maps fields for Exchange entity to ensure consistent SDK naming
|
|
1978
1779
|
*/
|
|
@@ -6162,24 +5963,43 @@ class ConversationService extends BaseService {
|
|
|
6162
5963
|
* @param options - Options for querying conversations including optional pagination parameters
|
|
6163
5964
|
* @returns Promise resolving to either an array of conversations {@link NonPaginatedResponse}<{@link ConversationGetResponse}> or a {@link PaginatedResponse}<{@link ConversationGetResponse}> when pagination options are used
|
|
6164
5965
|
*
|
|
6165
|
-
* @example
|
|
5966
|
+
* @example Basic usage - get all conversations
|
|
6166
5967
|
* ```typescript
|
|
6167
|
-
* // Get all conversations (non-paginated)
|
|
6168
5968
|
* const allConversations = await conversationalAgent.conversations.getAll();
|
|
6169
5969
|
*
|
|
6170
|
-
*
|
|
6171
|
-
*
|
|
5970
|
+
* for (const conversation of allConversations.items) {
|
|
5971
|
+
* console.log(`${conversation.label} - created: ${conversation.createdTime}`);
|
|
5972
|
+
* }
|
|
5973
|
+
* ```
|
|
6172
5974
|
*
|
|
6173
|
-
*
|
|
6174
|
-
*
|
|
5975
|
+
* @example With pagination
|
|
5976
|
+
* ```typescript
|
|
5977
|
+
* // First page
|
|
5978
|
+
* const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
|
|
6175
5979
|
*
|
|
6176
5980
|
* // Navigate using cursor
|
|
6177
|
-
* if (
|
|
6178
|
-
* const
|
|
6179
|
-
* cursor:
|
|
5981
|
+
* if (firstPage.hasNextPage) {
|
|
5982
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
5983
|
+
* cursor: firstPage.nextCursor
|
|
6180
5984
|
* });
|
|
6181
5985
|
* }
|
|
6182
5986
|
* ```
|
|
5987
|
+
*
|
|
5988
|
+
* @example Sorted with limit
|
|
5989
|
+
* ```typescript
|
|
5990
|
+
* const result = await conversationalAgent.conversations.getAll({
|
|
5991
|
+
* sort: SortOrder.Descending,
|
|
5992
|
+
* pageSize: 20
|
|
5993
|
+
* });
|
|
5994
|
+
* ```
|
|
5995
|
+
*
|
|
5996
|
+
* @example Filter by agent and search by label
|
|
5997
|
+
* ```typescript
|
|
5998
|
+
* const filtered = await conversationalAgent.conversations.getAll({
|
|
5999
|
+
* agentId: <agentId>,
|
|
6000
|
+
* label: 'budget'
|
|
6001
|
+
* });
|
|
6002
|
+
* ```
|
|
6183
6003
|
*/
|
|
6184
6004
|
async getAll(options) {
|
|
6185
6005
|
// Transform function to convert API timestamps to SDK naming convention and add methods
|
|
@@ -6187,6 +6007,10 @@ class ConversationService extends BaseService {
|
|
|
6187
6007
|
const transformedData = transformData(conversation, ConversationMap);
|
|
6188
6008
|
return createConversationWithMethods(transformedData, this, this, this._exchangeService);
|
|
6189
6009
|
};
|
|
6010
|
+
// Translate SDK filter names (agentKey/agentId/label) to backend names before forwarding
|
|
6011
|
+
const apiOptions = options
|
|
6012
|
+
? transformRequest(options, ConversationGetAllFilterMap)
|
|
6013
|
+
: undefined;
|
|
6190
6014
|
return PaginationHelpers.getAll({
|
|
6191
6015
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
6192
6016
|
getEndpoint: () => CONVERSATION_ENDPOINTS.LIST,
|
|
@@ -6200,8 +6024,8 @@ class ConversationService extends BaseService {
|
|
|
6200
6024
|
tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
|
|
6201
6025
|
}
|
|
6202
6026
|
},
|
|
6203
|
-
excludeFromPrefix: Object.keys(
|
|
6204
|
-
},
|
|
6027
|
+
excludeFromPrefix: Object.keys(apiOptions || {}) // Conversational params are not OData
|
|
6028
|
+
}, apiOptions);
|
|
6205
6029
|
}
|
|
6206
6030
|
/**
|
|
6207
6031
|
* Updates a conversation by ID
|
|
@@ -6769,4 +6593,4 @@ __decorate([
|
|
|
6769
6593
|
track('ConversationalAgent.GetById')
|
|
6770
6594
|
], ConversationalAgentService.prototype, "getById", null);
|
|
6771
6595
|
|
|
6772
|
-
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 };
|
|
6596
|
+
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 };
|