@uipath/uipath-typescript 1.3.5 → 1.3.7
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/README.md +1 -1
- package/dist/assets/index.cjs +204 -2
- package/dist/assets/index.d.ts +112 -13
- package/dist/assets/index.mjs +204 -2
- package/dist/attachments/index.cjs +3 -2
- package/dist/attachments/index.d.ts +7 -0
- package/dist/attachments/index.mjs +3 -2
- package/dist/buckets/index.cjs +172 -2
- package/dist/buckets/index.d.ts +56 -12
- package/dist/buckets/index.mjs +172 -2
- package/dist/cases/index.cjs +3 -2
- package/dist/cases/index.d.ts +7 -0
- package/dist/cases/index.mjs +3 -2
- package/dist/conversational-agent/index.cjs +196 -81
- package/dist/conversational-agent/index.d.ts +326 -80
- package/dist/conversational-agent/index.mjs +195 -80
- package/dist/core/index.cjs +44 -7
- package/dist/core/index.d.ts +11 -1
- package/dist/core/index.mjs +44 -7
- package/dist/entities/index.cjs +35 -6
- package/dist/entities/index.d.ts +101 -11
- package/dist/entities/index.mjs +36 -7
- package/dist/feedback/index.cjs +40 -5
- package/dist/feedback/index.d.ts +59 -1
- package/dist/feedback/index.mjs +40 -5
- package/dist/index.cjs +312 -14
- package/dist/index.d.ts +515 -32
- package/dist/index.mjs +313 -15
- package/dist/index.umd.js +312 -14
- package/dist/jobs/index.cjs +172 -2
- package/dist/jobs/index.d.ts +67 -23
- package/dist/jobs/index.mjs +172 -2
- package/dist/maestro-processes/index.cjs +3 -2
- package/dist/maestro-processes/index.d.ts +7 -0
- package/dist/maestro-processes/index.mjs +3 -2
- package/dist/processes/index.cjs +240 -3
- package/dist/processes/index.d.ts +124 -2
- package/dist/processes/index.mjs +240 -3
- package/dist/queues/index.cjs +172 -2
- package/dist/queues/index.d.ts +56 -12
- package/dist/queues/index.mjs +172 -2
- package/dist/tasks/index.cjs +3 -2
- package/dist/tasks/index.d.ts +7 -0
- package/dist/tasks/index.mjs +3 -2
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
51
51
|
// Connection string placeholder that will be replaced during build
|
|
52
52
|
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
53
53
|
// SDK Version placeholder
|
|
54
|
-
const SDK_VERSION = "1.3.
|
|
54
|
+
const SDK_VERSION = "1.3.7";
|
|
55
55
|
const VERSION = "Version";
|
|
56
56
|
const SERVICE = "Service";
|
|
57
57
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -805,6 +805,21 @@ const RESPONSE_TYPES = {
|
|
|
805
805
|
* in Conversational Agents Service)
|
|
806
806
|
*/
|
|
807
807
|
const EXTERNAL_USER_ID = 'x-uipath-external-user-id';
|
|
808
|
+
/**
|
|
809
|
+
* Optional identifier used in UiPath logs to identify the implementing service
|
|
810
|
+
* of requests. External consumers do not need to set it; the server logs
|
|
811
|
+
* missing values as "unknown".
|
|
812
|
+
*
|
|
813
|
+
* @internal
|
|
814
|
+
*/
|
|
815
|
+
const CONVERSATIONAL_SURFACE_NAME = 'x-uipath-conversational-surfacename';
|
|
816
|
+
/**
|
|
817
|
+
* Optional version of the implementing service of requests. Paired with
|
|
818
|
+
* `surfaceName` for internal telemetry.
|
|
819
|
+
*
|
|
820
|
+
* @internal
|
|
821
|
+
*/
|
|
822
|
+
const CONVERSATIONAL_SURFACE_VERSION = 'x-uipath-conversational-surfaceversion';
|
|
808
823
|
/**
|
|
809
824
|
* Query parameter keys sent during WebSocket connection
|
|
810
825
|
*/
|
|
@@ -812,6 +827,8 @@ const WEBSOCKET_QUERY_PARAMS = {
|
|
|
812
827
|
ORGANIZATION_ID: 'x-uipath-internal-accountid',
|
|
813
828
|
TENANT_ID: 'x-uipath-internal-tenantid',
|
|
814
829
|
EXTERNAL_USER_ID,
|
|
830
|
+
CONVERSATIONAL_SURFACE_NAME,
|
|
831
|
+
CONVERSATIONAL_SURFACE_VERSION,
|
|
815
832
|
};
|
|
816
833
|
|
|
817
834
|
class ApiClient {
|
|
@@ -1733,8 +1750,9 @@ class BaseService {
|
|
|
1733
1750
|
constructor(instance, headers) {
|
|
1734
1751
|
// Private field - not visible via Object.keys() or any reflection
|
|
1735
1752
|
_BaseService_apiClient.set(this, void 0);
|
|
1736
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1753
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1737
1754
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1755
|
+
this.config = { folderKey };
|
|
1738
1756
|
}
|
|
1739
1757
|
/**
|
|
1740
1758
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -2180,7 +2198,7 @@ const AgentMap = {
|
|
|
2180
2198
|
};
|
|
2181
2199
|
|
|
2182
2200
|
/**
|
|
2183
|
-
* Constants for User Service
|
|
2201
|
+
* Constants for User Settings Service
|
|
2184
2202
|
*/
|
|
2185
2203
|
/**
|
|
2186
2204
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|
|
@@ -2950,6 +2968,7 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2950
2968
|
this.toolCallId = toolCallId;
|
|
2951
2969
|
this.startEventMaybe = startEventMaybe;
|
|
2952
2970
|
this._endHandlers = new Array();
|
|
2971
|
+
this._confirmHandlers = new Array();
|
|
2953
2972
|
this.addStartEventTimestamp(startEventMaybe);
|
|
2954
2973
|
}
|
|
2955
2974
|
/**
|
|
@@ -3011,6 +3030,29 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
3011
3030
|
onEndToolCall(cb) {
|
|
3012
3031
|
this.onToolCallEnd(cb);
|
|
3013
3032
|
}
|
|
3033
|
+
/**
|
|
3034
|
+
* Registers a handler for tool call confirmation events. Fired when the
|
|
3035
|
+
* peer responds to a tool call that was emitted with `requireConfirmation`.
|
|
3036
|
+
* @returns Cleanup function to remove the handler.
|
|
3037
|
+
*/
|
|
3038
|
+
onToolCallConfirm(callback) {
|
|
3039
|
+
this._confirmHandlers.push(callback);
|
|
3040
|
+
return () => {
|
|
3041
|
+
const index = this._confirmHandlers.indexOf(callback);
|
|
3042
|
+
if (index >= 0)
|
|
3043
|
+
this._confirmHandlers.splice(index, 1);
|
|
3044
|
+
};
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Sends a tool call confirmation (approve/reject) for a tool call that was
|
|
3048
|
+
* emitted with `requireConfirmation: true`. Replaces the legacy
|
|
3049
|
+
* `sendInterruptEnd` flow for tool call confirmation.
|
|
3050
|
+
* @throws Error if tool call has already ended.
|
|
3051
|
+
*/
|
|
3052
|
+
sendToolCallConfirm(confirmToolCall) {
|
|
3053
|
+
this.assertNotEnded();
|
|
3054
|
+
this.emit({ confirmToolCall });
|
|
3055
|
+
}
|
|
3014
3056
|
/**
|
|
3015
3057
|
* Sends an error start event for this tool call.
|
|
3016
3058
|
*/
|
|
@@ -3086,6 +3128,10 @@ class ToolCallEventHelperImpl extends ToolCallEventHelper {
|
|
|
3086
3128
|
if (toolCallEvent.toolCallError?.endError) {
|
|
3087
3129
|
this.dispatchErrorEnd(toolCallEvent.toolCallError.errorId, toolCallEvent.toolCallError.endError);
|
|
3088
3130
|
}
|
|
3131
|
+
if (toolCallEvent.confirmToolCall) {
|
|
3132
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3133
|
+
this._confirmHandlers.forEach(cb => cb(toolCallEvent.confirmToolCall));
|
|
3134
|
+
}
|
|
3089
3135
|
if (toolCallEvent.endToolCall) {
|
|
3090
3136
|
this.setEnded();
|
|
3091
3137
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -3129,6 +3175,7 @@ class MessageEventHelper extends ConversationEventHelperBase {
|
|
|
3129
3175
|
this._toolCallMap = new Map();
|
|
3130
3176
|
this._interruptStartHandlers = new Array();
|
|
3131
3177
|
this._interruptEndHandlers = new Array();
|
|
3178
|
+
this._toolCallConfirmHandlers = new Array();
|
|
3132
3179
|
this.addStartEventTimestamp(startEventMaybe);
|
|
3133
3180
|
}
|
|
3134
3181
|
/**
|
|
@@ -3367,6 +3414,25 @@ class MessageEventHelper extends ConversationEventHelperBase {
|
|
|
3367
3414
|
this._interruptEndHandlers.splice(index, 1);
|
|
3368
3415
|
};
|
|
3369
3416
|
}
|
|
3417
|
+
/**
|
|
3418
|
+
* Registers a handler for tool-call confirmation events. Fired when a peer
|
|
3419
|
+
* responds to a tool call that was emitted with `requireConfirmation: true`.
|
|
3420
|
+
*
|
|
3421
|
+
* Fires at the message level before the event is delegated to the per-tool-call
|
|
3422
|
+
* helper, so this handler runs even when no `ToolCallEventHelper` exists for the
|
|
3423
|
+
* confirmed tool call (e.g. on the agent side after the originating helper has
|
|
3424
|
+
* been cleaned up, or on the client side if no `onToolCallStart` is registered).
|
|
3425
|
+
*
|
|
3426
|
+
* @returns Cleanup function to remove the handler.
|
|
3427
|
+
*/
|
|
3428
|
+
onToolCallConfirm(callback) {
|
|
3429
|
+
this._toolCallConfirmHandlers.push(callback);
|
|
3430
|
+
return () => {
|
|
3431
|
+
const index = this._toolCallConfirmHandlers.indexOf(callback);
|
|
3432
|
+
if (index >= 0)
|
|
3433
|
+
this._toolCallConfirmHandlers.splice(index, 1);
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3370
3436
|
/**
|
|
3371
3437
|
* Sends an interrupt start event.
|
|
3372
3438
|
*/
|
|
@@ -3494,6 +3560,16 @@ class MessageEventHelperImpl extends MessageEventHelper {
|
|
|
3494
3560
|
contentPartHelper.dispatch(messageEvent.contentPart);
|
|
3495
3561
|
}
|
|
3496
3562
|
if (messageEvent.toolCall) {
|
|
3563
|
+
// Dispatch confirmToolCall at the message level (flat dispatch) before delegating
|
|
3564
|
+
// to the per-tool-call helper. Needed because the tool-call helper may not exist
|
|
3565
|
+
// for this id on the receiving side.
|
|
3566
|
+
if (messageEvent.toolCall.confirmToolCall) {
|
|
3567
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3568
|
+
this._toolCallConfirmHandlers.forEach(cb => cb({
|
|
3569
|
+
toolCallId: messageEvent.toolCall.toolCallId,
|
|
3570
|
+
confirmEvent: messageEvent.toolCall.confirmToolCall
|
|
3571
|
+
}));
|
|
3572
|
+
}
|
|
3497
3573
|
let toolCallHelper = this._toolCallMap.get(messageEvent.toolCall.toolCallId);
|
|
3498
3574
|
if (!toolCallHelper && this._toolCallStartHandlers.length > 0) {
|
|
3499
3575
|
toolCallHelper = new ToolCallEventHelperImpl(this, messageEvent.toolCall.toolCallId, messageEvent.toolCall.startToolCall);
|
|
@@ -4994,6 +5070,27 @@ function transformMessage(message) {
|
|
|
4994
5070
|
};
|
|
4995
5071
|
}
|
|
4996
5072
|
|
|
5073
|
+
/**
|
|
5074
|
+
* Header builder for Conversational Agent Services
|
|
5075
|
+
*
|
|
5076
|
+
* Builds the default request headers shared across the Conversational Agent
|
|
5077
|
+
* service constructors (`ConversationalAgentService`, `ConversationService`,
|
|
5078
|
+
* `ExchangeService`, `MessageService`) from a single set of options.
|
|
5079
|
+
*/
|
|
5080
|
+
/**
|
|
5081
|
+
* Builds the default request headers for Conversational Agent service calls
|
|
5082
|
+
* from the provided options. Returns `undefined` when no headers apply, so
|
|
5083
|
+
* the SDK does not pass an empty `headers` bag down to the HTTP layer.
|
|
5084
|
+
*/
|
|
5085
|
+
function buildConversationalAgentHeaders(options) {
|
|
5086
|
+
const headers = createHeaders({
|
|
5087
|
+
[EXTERNAL_USER_ID]: options?.externalUserId,
|
|
5088
|
+
[CONVERSATIONAL_SURFACE_NAME]: options?.surfaceName,
|
|
5089
|
+
[CONVERSATIONAL_SURFACE_VERSION]: options?.surfaceVersion,
|
|
5090
|
+
});
|
|
5091
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
5092
|
+
}
|
|
5093
|
+
|
|
4997
5094
|
/**
|
|
4998
5095
|
* ExchangeService - Exchange operations for Conversations
|
|
4999
5096
|
*
|
|
@@ -5033,7 +5130,7 @@ class ExchangeService extends BaseService {
|
|
|
5033
5130
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
5034
5131
|
*/
|
|
5035
5132
|
constructor(instance, options) {
|
|
5036
|
-
super(instance, options
|
|
5133
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
5037
5134
|
}
|
|
5038
5135
|
/**
|
|
5039
5136
|
* Gets all exchanges for a conversation with optional filtering and pagination
|
|
@@ -5696,6 +5793,8 @@ class WebSocketSession extends BaseWebSocket {
|
|
|
5696
5793
|
logLevel: options?.logLevel
|
|
5697
5794
|
}, context, tokenManager, WEBSOCKET_LOGGER_PREFIX);
|
|
5698
5795
|
this._externalUserId = options?.externalUserId;
|
|
5796
|
+
this._surfaceName = options?.surfaceName;
|
|
5797
|
+
this._surfaceVersion = options?.surfaceVersion;
|
|
5699
5798
|
}
|
|
5700
5799
|
/**
|
|
5701
5800
|
* Connects to WebSocket with organization and tenant headers
|
|
@@ -5714,6 +5813,12 @@ class WebSocketSession extends BaseWebSocket {
|
|
|
5714
5813
|
if (this._externalUserId) {
|
|
5715
5814
|
query[WEBSOCKET_QUERY_PARAMS.EXTERNAL_USER_ID] = this._externalUserId;
|
|
5716
5815
|
}
|
|
5816
|
+
if (this._surfaceName) {
|
|
5817
|
+
query[WEBSOCKET_QUERY_PARAMS.CONVERSATIONAL_SURFACE_NAME] = this._surfaceName;
|
|
5818
|
+
}
|
|
5819
|
+
if (this._surfaceVersion) {
|
|
5820
|
+
query[WEBSOCKET_QUERY_PARAMS.CONVERSATIONAL_SURFACE_VERSION] = this._surfaceVersion;
|
|
5821
|
+
}
|
|
5717
5822
|
this.connectWithOptions({ query });
|
|
5718
5823
|
}
|
|
5719
5824
|
/**
|
|
@@ -6010,7 +6115,7 @@ class ConversationService extends BaseService {
|
|
|
6010
6115
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6011
6116
|
*/
|
|
6012
6117
|
constructor(instance, options) {
|
|
6013
|
-
super(instance, options
|
|
6118
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6014
6119
|
/** Event helper for conversation events */
|
|
6015
6120
|
this._eventHelper = null;
|
|
6016
6121
|
this._sessionManager = new SessionManager(instance, options);
|
|
@@ -6421,7 +6526,7 @@ class MessageService extends BaseService {
|
|
|
6421
6526
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6422
6527
|
*/
|
|
6423
6528
|
constructor(instance, options) {
|
|
6424
|
-
super(instance, options
|
|
6529
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6425
6530
|
}
|
|
6426
6531
|
/**
|
|
6427
6532
|
* Gets a message by ID
|
|
@@ -6482,6 +6587,87 @@ __decorate([
|
|
|
6482
6587
|
track('ConversationalAgent.Messages.GetContentPartById')
|
|
6483
6588
|
], MessageService.prototype, "getContentPartById", null);
|
|
6484
6589
|
|
|
6590
|
+
/**
|
|
6591
|
+
* UserSettingsService - Service for managing user profile and context settings
|
|
6592
|
+
*/
|
|
6593
|
+
/**
|
|
6594
|
+
* Service for reading and updating the current user's profile and context settings.
|
|
6595
|
+
*
|
|
6596
|
+
* User settings are user-supplied profile fields (name, email, role, department, company,
|
|
6597
|
+
* country, timezone) that the SDK passes to a UiPath Conversational Agent on every conversation
|
|
6598
|
+
* so the agent can personalize its responses.
|
|
6599
|
+
*/
|
|
6600
|
+
class UserSettingsService extends BaseService {
|
|
6601
|
+
/**
|
|
6602
|
+
* Creates an instance of the UserSettingsService.
|
|
6603
|
+
*
|
|
6604
|
+
* @param instance - UiPath SDK instance providing authentication and configuration
|
|
6605
|
+
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6606
|
+
*/
|
|
6607
|
+
constructor(instance, options) {
|
|
6608
|
+
super(instance, options?.externalUserId ? { [EXTERNAL_USER_ID]: options.externalUserId } : undefined);
|
|
6609
|
+
}
|
|
6610
|
+
/**
|
|
6611
|
+
* Gets the current user's profile and context settings.
|
|
6612
|
+
*
|
|
6613
|
+
* Returns the full user settings record — profile fields the agent uses for personalization
|
|
6614
|
+
* (name, email, role, department, company, country, timezone) plus identifiers and timestamps.
|
|
6615
|
+
* Fields the user has not set are returned as `null`.
|
|
6616
|
+
*
|
|
6617
|
+
* @returns Promise resolving to the current user's settings
|
|
6618
|
+
* {@link UserSettingsGetResponse}
|
|
6619
|
+
*
|
|
6620
|
+
* @example
|
|
6621
|
+
* ```typescript
|
|
6622
|
+
* const settings = await conversationalAgent.user.getSettings();
|
|
6623
|
+
* console.log(settings.name); // e.g. 'John Doe' or null
|
|
6624
|
+
* console.log(settings.email); // e.g. 'john@example.com' or null
|
|
6625
|
+
* console.log(settings.timezone); // e.g. 'America/New_York' or null
|
|
6626
|
+
* ```
|
|
6627
|
+
*/
|
|
6628
|
+
async getSettings() {
|
|
6629
|
+
const response = await this.get(USER_ENDPOINTS.SETTINGS);
|
|
6630
|
+
return transformData(response.data, UserSettingsMap);
|
|
6631
|
+
}
|
|
6632
|
+
/**
|
|
6633
|
+
* Updates the current user's profile and context settings.
|
|
6634
|
+
*
|
|
6635
|
+
* Accepts a partial payload — only fields included in `options` are changed. Pass `null` to
|
|
6636
|
+
* explicitly clear a field. Omitting a field leaves it unchanged. Returns the full updated
|
|
6637
|
+
* settings record.
|
|
6638
|
+
*
|
|
6639
|
+
* @param options - Fields to update; omit fields to leave them unchanged, set to `null` to clear
|
|
6640
|
+
* @returns Promise resolving to the updated user settings
|
|
6641
|
+
* {@link UserSettingsUpdateResponse}
|
|
6642
|
+
*
|
|
6643
|
+
* @example Partial update
|
|
6644
|
+
* ```typescript
|
|
6645
|
+
* const updated = await conversationalAgent.user.updateSettings({
|
|
6646
|
+
* name: 'John Doe',
|
|
6647
|
+
* timezone: 'America/New_York'
|
|
6648
|
+
* });
|
|
6649
|
+
* ```
|
|
6650
|
+
*
|
|
6651
|
+
* @example Clear fields by setting to null
|
|
6652
|
+
* ```typescript
|
|
6653
|
+
* await conversationalAgent.user.updateSettings({
|
|
6654
|
+
* role: null,
|
|
6655
|
+
* department: null
|
|
6656
|
+
* });
|
|
6657
|
+
* ```
|
|
6658
|
+
*/
|
|
6659
|
+
async updateSettings(options) {
|
|
6660
|
+
const response = await this.patch(USER_ENDPOINTS.SETTINGS, options);
|
|
6661
|
+
return transformData(response.data, UserSettingsMap);
|
|
6662
|
+
}
|
|
6663
|
+
}
|
|
6664
|
+
__decorate([
|
|
6665
|
+
track('ConversationalAgent.UserSettings.GetSettings')
|
|
6666
|
+
], UserSettingsService.prototype, "getSettings", null);
|
|
6667
|
+
__decorate([
|
|
6668
|
+
track('ConversationalAgent.UserSettings.UpdateSettings')
|
|
6669
|
+
], UserSettingsService.prototype, "updateSettings", null);
|
|
6670
|
+
|
|
6485
6671
|
/**
|
|
6486
6672
|
* ConversationalAgentService - Main entry point for Conversational Agent functionality
|
|
6487
6673
|
*/
|
|
@@ -6496,9 +6682,10 @@ class ConversationalAgentService extends BaseService {
|
|
|
6496
6682
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6497
6683
|
*/
|
|
6498
6684
|
constructor(instance, options) {
|
|
6499
|
-
super(instance, options
|
|
6685
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6500
6686
|
// Create conversation service with WebSocket support
|
|
6501
6687
|
this.conversations = new ConversationService(instance, options);
|
|
6688
|
+
this.user = new UserSettingsService(instance, options);
|
|
6502
6689
|
}
|
|
6503
6690
|
/**
|
|
6504
6691
|
* Registers a handler that is called whenever the WebSocket connection status changes.
|
|
@@ -6584,78 +6771,6 @@ __decorate([
|
|
|
6584
6771
|
track('ConversationalAgent.GetById')
|
|
6585
6772
|
], ConversationalAgentService.prototype, "getById", null);
|
|
6586
6773
|
|
|
6587
|
-
/**
|
|
6588
|
-
* UserService - Service for managing user profile and context settings
|
|
6589
|
-
*/
|
|
6590
|
-
/**
|
|
6591
|
-
* Service for managing user profile and context settings
|
|
6592
|
-
*
|
|
6593
|
-
* User settings are passed to the agent for all conversations
|
|
6594
|
-
* to provide user context (name, email, role, timezone, etc.).
|
|
6595
|
-
*
|
|
6596
|
-
* @internal
|
|
6597
|
-
*/
|
|
6598
|
-
class UserService extends BaseService {
|
|
6599
|
-
/**
|
|
6600
|
-
* Gets the current user's profile and context settings
|
|
6601
|
-
*
|
|
6602
|
-
* @returns Promise resolving to user settings object containing profile information
|
|
6603
|
-
*
|
|
6604
|
-
* @example
|
|
6605
|
-
* ```typescript
|
|
6606
|
-
* const userSettings = await userService.getSettings();
|
|
6607
|
-
* console.log(userSettings.name); // User's name
|
|
6608
|
-
* console.log(userSettings.email); // User's email
|
|
6609
|
-
* console.log(userSettings.timezone); // User's timezone
|
|
6610
|
-
* ```
|
|
6611
|
-
*/
|
|
6612
|
-
async getSettings() {
|
|
6613
|
-
const response = await this.get(USER_ENDPOINTS.SETTINGS);
|
|
6614
|
-
return transformData(response.data, UserSettingsMap);
|
|
6615
|
-
}
|
|
6616
|
-
/**
|
|
6617
|
-
* Updates the current user's profile and context settings
|
|
6618
|
-
*
|
|
6619
|
-
* All fields are optional - only send the fields you want to change.
|
|
6620
|
-
* Set fields to `null` to explicitly clear them.
|
|
6621
|
-
* Omitting fields means no change.
|
|
6622
|
-
*
|
|
6623
|
-
* @param options - Fields to update
|
|
6624
|
-
* @returns Promise resolving to updated user settings object
|
|
6625
|
-
*
|
|
6626
|
-
* @example
|
|
6627
|
-
* ```typescript
|
|
6628
|
-
* // Update specific fields
|
|
6629
|
-
* const updatedUserSettings = await userService.updateSettings({
|
|
6630
|
-
* name: 'John Doe',
|
|
6631
|
-
* email: 'john@example.com',
|
|
6632
|
-
* timezone: 'America/New_York'
|
|
6633
|
-
* });
|
|
6634
|
-
*
|
|
6635
|
-
* // Partial update - only change timezone
|
|
6636
|
-
* await userService.updateSettings({
|
|
6637
|
-
* timezone: 'Europe/London'
|
|
6638
|
-
* });
|
|
6639
|
-
*
|
|
6640
|
-
* // Clear fields by setting to null
|
|
6641
|
-
* await userService.updateSettings({
|
|
6642
|
-
* role: null,
|
|
6643
|
-
* department: null
|
|
6644
|
-
* });
|
|
6645
|
-
* ```
|
|
6646
|
-
*/
|
|
6647
|
-
async updateSettings(options) {
|
|
6648
|
-
const response = await this.patch(USER_ENDPOINTS.SETTINGS, options);
|
|
6649
|
-
return transformData(response.data, UserSettingsMap);
|
|
6650
|
-
}
|
|
6651
|
-
}
|
|
6652
|
-
__decorate([
|
|
6653
|
-
track('ConversationalAgent.User.GetSettings')
|
|
6654
|
-
], UserService.prototype, "getSettings", null);
|
|
6655
|
-
__decorate([
|
|
6656
|
-
track('ConversationalAgent.User.UpdateSettings')
|
|
6657
|
-
], UserService.prototype, "updateSettings", null);
|
|
6658
|
-
|
|
6659
6774
|
exports.AgentMap = AgentMap;
|
|
6660
6775
|
exports.AsyncInputStreamEventHelper = AsyncInputStreamEventHelper;
|
|
6661
6776
|
exports.AsyncInputStreamEventHelperImpl = AsyncInputStreamEventHelperImpl;
|
|
@@ -6686,9 +6801,9 @@ exports.SessionEventHelper = SessionEventHelper;
|
|
|
6686
6801
|
exports.SessionEventHelperImpl = SessionEventHelperImpl;
|
|
6687
6802
|
exports.ToolCallEventHelper = ToolCallEventHelper;
|
|
6688
6803
|
exports.ToolCallEventHelperImpl = ToolCallEventHelperImpl;
|
|
6689
|
-
exports.
|
|
6690
|
-
exports.UserService = UserService;
|
|
6804
|
+
exports.UserSettings = UserSettingsService;
|
|
6691
6805
|
exports.UserSettingsMap = UserSettingsMap;
|
|
6806
|
+
exports.UserSettingsService = UserSettingsService;
|
|
6692
6807
|
exports.assertCitationSourceMedia = assertCitationSourceMedia;
|
|
6693
6808
|
exports.assertCitationSourceUrl = assertCitationSourceUrl;
|
|
6694
6809
|
exports.assertExternalValue = assertExternalValue;
|