@uipath/uipath-typescript 1.1.3 → 1.2.1
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 +1 -4
- package/dist/assets/index.mjs +1 -4
- package/dist/buckets/index.cjs +1 -4
- package/dist/buckets/index.mjs +1 -4
- package/dist/cases/index.cjs +1 -4
- package/dist/cases/index.mjs +1 -4
- package/dist/conversational-agent/index.cjs +38 -10
- package/dist/conversational-agent/index.d.ts +62 -1
- package/dist/conversational-agent/index.mjs +38 -10
- package/dist/core/index.cjs +278 -84
- package/dist/core/index.d.ts +26 -2
- package/dist/core/index.mjs +278 -84
- package/dist/entities/index.cjs +129 -44
- package/dist/entities/index.d.ts +214 -70
- package/dist/entities/index.mjs +129 -44
- package/dist/index.cjs +406 -127
- package/dist/index.d.ts +270 -71
- package/dist/index.mjs +406 -127
- package/dist/index.umd.js +406 -127
- package/dist/maestro-processes/index.cjs +1 -4
- package/dist/maestro-processes/index.mjs +1 -4
- package/dist/processes/index.cjs +1 -4
- package/dist/processes/index.mjs +1 -4
- package/dist/queues/index.cjs +1 -4
- package/dist/queues/index.mjs +1 -4
- package/dist/tasks/index.cjs +1 -4
- package/dist/tasks/index.mjs +1 -4
- package/package.json +5 -4
package/dist/assets/index.cjs
CHANGED
|
@@ -546,11 +546,8 @@ class ApiClient {
|
|
|
546
546
|
return this.tokenManager.getValidToken();
|
|
547
547
|
}
|
|
548
548
|
async getDefaultHeaders() {
|
|
549
|
-
// Get headers from execution context first
|
|
550
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
551
549
|
const token = await this.getValidToken();
|
|
552
550
|
return {
|
|
553
|
-
...contextHeaders,
|
|
554
551
|
'Authorization': `Bearer ${token}`,
|
|
555
552
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
556
553
|
...this.defaultHeaders,
|
|
@@ -1678,7 +1675,7 @@ const AssetMap = {
|
|
|
1678
1675
|
// Connection string placeholder that will be replaced during build
|
|
1679
1676
|
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";
|
|
1680
1677
|
// SDK Version placeholder
|
|
1681
|
-
const SDK_VERSION = "1.1
|
|
1678
|
+
const SDK_VERSION = "1.2.1";
|
|
1682
1679
|
const VERSION = "Version";
|
|
1683
1680
|
const SERVICE = "Service";
|
|
1684
1681
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/assets/index.mjs
CHANGED
|
@@ -544,11 +544,8 @@ class ApiClient {
|
|
|
544
544
|
return this.tokenManager.getValidToken();
|
|
545
545
|
}
|
|
546
546
|
async getDefaultHeaders() {
|
|
547
|
-
// Get headers from execution context first
|
|
548
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
549
547
|
const token = await this.getValidToken();
|
|
550
548
|
return {
|
|
551
|
-
...contextHeaders,
|
|
552
549
|
'Authorization': `Bearer ${token}`,
|
|
553
550
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
554
551
|
...this.defaultHeaders,
|
|
@@ -1676,7 +1673,7 @@ const AssetMap = {
|
|
|
1676
1673
|
// Connection string placeholder that will be replaced during build
|
|
1677
1674
|
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";
|
|
1678
1675
|
// SDK Version placeholder
|
|
1679
|
-
const SDK_VERSION = "1.1
|
|
1676
|
+
const SDK_VERSION = "1.2.1";
|
|
1680
1677
|
const VERSION = "Version";
|
|
1681
1678
|
const SERVICE = "Service";
|
|
1682
1679
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/buckets/index.cjs
CHANGED
|
@@ -546,11 +546,8 @@ class ApiClient {
|
|
|
546
546
|
return this.tokenManager.getValidToken();
|
|
547
547
|
}
|
|
548
548
|
async getDefaultHeaders() {
|
|
549
|
-
// Get headers from execution context first
|
|
550
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
551
549
|
const token = await this.getValidToken();
|
|
552
550
|
return {
|
|
553
|
-
...contextHeaders,
|
|
554
551
|
'Authorization': `Bearer ${token}`,
|
|
555
552
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
556
553
|
...this.defaultHeaders,
|
|
@@ -1725,7 +1722,7 @@ const BucketMap = {
|
|
|
1725
1722
|
// Connection string placeholder that will be replaced during build
|
|
1726
1723
|
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";
|
|
1727
1724
|
// SDK Version placeholder
|
|
1728
|
-
const SDK_VERSION = "1.1
|
|
1725
|
+
const SDK_VERSION = "1.2.1";
|
|
1729
1726
|
const VERSION = "Version";
|
|
1730
1727
|
const SERVICE = "Service";
|
|
1731
1728
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/buckets/index.mjs
CHANGED
|
@@ -544,11 +544,8 @@ class ApiClient {
|
|
|
544
544
|
return this.tokenManager.getValidToken();
|
|
545
545
|
}
|
|
546
546
|
async getDefaultHeaders() {
|
|
547
|
-
// Get headers from execution context first
|
|
548
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
549
547
|
const token = await this.getValidToken();
|
|
550
548
|
return {
|
|
551
|
-
...contextHeaders,
|
|
552
549
|
'Authorization': `Bearer ${token}`,
|
|
553
550
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
554
551
|
...this.defaultHeaders,
|
|
@@ -1723,7 +1720,7 @@ const BucketMap = {
|
|
|
1723
1720
|
// Connection string placeholder that will be replaced during build
|
|
1724
1721
|
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";
|
|
1725
1722
|
// SDK Version placeholder
|
|
1726
|
-
const SDK_VERSION = "1.1
|
|
1723
|
+
const SDK_VERSION = "1.2.1";
|
|
1727
1724
|
const VERSION = "Version";
|
|
1728
1725
|
const SERVICE = "Service";
|
|
1729
1726
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/cases/index.cjs
CHANGED
|
@@ -559,11 +559,8 @@ class ApiClient {
|
|
|
559
559
|
return this.tokenManager.getValidToken();
|
|
560
560
|
}
|
|
561
561
|
async getDefaultHeaders() {
|
|
562
|
-
// Get headers from execution context first
|
|
563
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
564
562
|
const token = await this.getValidToken();
|
|
565
563
|
return {
|
|
566
|
-
...contextHeaders,
|
|
567
564
|
'Authorization': `Bearer ${token}`,
|
|
568
565
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
569
566
|
...this.defaultHeaders,
|
|
@@ -1833,7 +1830,7 @@ const MAESTRO_ENDPOINTS = {
|
|
|
1833
1830
|
// Connection string placeholder that will be replaced during build
|
|
1834
1831
|
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";
|
|
1835
1832
|
// SDK Version placeholder
|
|
1836
|
-
const SDK_VERSION = "1.1
|
|
1833
|
+
const SDK_VERSION = "1.2.1";
|
|
1837
1834
|
const VERSION = "Version";
|
|
1838
1835
|
const SERVICE = "Service";
|
|
1839
1836
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/cases/index.mjs
CHANGED
|
@@ -557,11 +557,8 @@ class ApiClient {
|
|
|
557
557
|
return this.tokenManager.getValidToken();
|
|
558
558
|
}
|
|
559
559
|
async getDefaultHeaders() {
|
|
560
|
-
// Get headers from execution context first
|
|
561
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
562
560
|
const token = await this.getValidToken();
|
|
563
561
|
return {
|
|
564
|
-
...contextHeaders,
|
|
565
562
|
'Authorization': `Bearer ${token}`,
|
|
566
563
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
567
564
|
...this.defaultHeaders,
|
|
@@ -1831,7 +1828,7 @@ const MAESTRO_ENDPOINTS = {
|
|
|
1831
1828
|
// Connection string placeholder that will be replaced during build
|
|
1832
1829
|
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";
|
|
1833
1830
|
// SDK Version placeholder
|
|
1834
|
-
const SDK_VERSION = "1.1
|
|
1831
|
+
const SDK_VERSION = "1.2.1";
|
|
1835
1832
|
const VERSION = "Version";
|
|
1836
1833
|
const SERVICE = "Service";
|
|
1837
1834
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -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.1
|
|
54
|
+
const SDK_VERSION = "1.2.1";
|
|
55
55
|
const VERSION = "Version";
|
|
56
56
|
const SERVICE = "Service";
|
|
57
57
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -829,11 +829,8 @@ class ApiClient {
|
|
|
829
829
|
return this.tokenManager.getValidToken();
|
|
830
830
|
}
|
|
831
831
|
async getDefaultHeaders() {
|
|
832
|
-
// Get headers from execution context first
|
|
833
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
834
832
|
const token = await this.getValidToken();
|
|
835
833
|
return {
|
|
836
|
-
...contextHeaders,
|
|
837
834
|
'Authorization': `Bearer ${token}`,
|
|
838
835
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
839
836
|
...this.defaultHeaders,
|
|
@@ -6129,10 +6126,11 @@ class ConversationService extends BaseService {
|
|
|
6129
6126
|
*/
|
|
6130
6127
|
async uploadAttachment(id, file) {
|
|
6131
6128
|
// Step 1: Create attachment entry and get upload URL
|
|
6132
|
-
const { fileUploadAccess, uri, name } = await this.
|
|
6129
|
+
const { fileUploadAccess, uri, name } = await this.getAttachmentUploadUri(id, file.name);
|
|
6133
6130
|
// Step 2: Upload file to blob storage
|
|
6134
6131
|
const uploadHeaders = {
|
|
6135
6132
|
'Content-Type': file.type,
|
|
6133
|
+
'x-ms-blob-type': 'BlockBlob',
|
|
6136
6134
|
...arrayDictionaryToRecord(fileUploadAccess.headers)
|
|
6137
6135
|
};
|
|
6138
6136
|
// Add auth header if required by the storage endpoint
|
|
@@ -6157,6 +6155,40 @@ class ConversationService extends BaseService {
|
|
|
6157
6155
|
mimeType: file.type
|
|
6158
6156
|
};
|
|
6159
6157
|
}
|
|
6158
|
+
/**
|
|
6159
|
+
* Registers a file attachment for a conversation and returns a URI along with
|
|
6160
|
+
* pre-signed upload access details. Use the returned `fileUploadAccess` to upload
|
|
6161
|
+
* the file content to blob storage, then reference `uri` in subsequent messages.
|
|
6162
|
+
*
|
|
6163
|
+
* @param conversationId - The ID of the conversation to attach the file to
|
|
6164
|
+
* @param fileName - The name of the file to attach
|
|
6165
|
+
* @returns Promise resolving to {@link ConversationAttachmentCreateResponse} containing
|
|
6166
|
+
* the attachment `uri` and `fileUploadAccess` details needed to upload the file content
|
|
6167
|
+
*
|
|
6168
|
+
* @example <caption>Step 1 — Get the attachment URI and upload access</caption>
|
|
6169
|
+
* ```typescript
|
|
6170
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, 'report.pdf');
|
|
6171
|
+
* console.log(`Attachment URI: ${uri}`);
|
|
6172
|
+
* ```
|
|
6173
|
+
*
|
|
6174
|
+
* @example <caption>Step 2 — Upload the file content to the returned URL</caption>
|
|
6175
|
+
* ```typescript
|
|
6176
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, file.name);
|
|
6177
|
+
*
|
|
6178
|
+
* await fetch(fileUploadAccess.url, {
|
|
6179
|
+
* method: fileUploadAccess.verb,
|
|
6180
|
+
* body: file,
|
|
6181
|
+
* headers: { 'Content-Type': file.type },
|
|
6182
|
+
* });
|
|
6183
|
+
*
|
|
6184
|
+
* // Reference the URI in a message after upload
|
|
6185
|
+
* console.log(`File ready at: ${uri}`);
|
|
6186
|
+
* ```
|
|
6187
|
+
*/
|
|
6188
|
+
async getAttachmentUploadUri(conversationId, fileName) {
|
|
6189
|
+
const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
|
|
6190
|
+
return response.data;
|
|
6191
|
+
}
|
|
6160
6192
|
// ==================== Real-time Event Handling ====================
|
|
6161
6193
|
/**
|
|
6162
6194
|
* Starts a real-time chat session for a conversation
|
|
@@ -6279,10 +6311,6 @@ class ConversationService extends BaseService {
|
|
|
6279
6311
|
}
|
|
6280
6312
|
return this._eventHelper;
|
|
6281
6313
|
}
|
|
6282
|
-
async createAttachment(conversationId, fileName) {
|
|
6283
|
-
const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
|
|
6284
|
-
return response.data;
|
|
6285
|
-
}
|
|
6286
6314
|
}
|
|
6287
6315
|
__decorate([
|
|
6288
6316
|
track('ConversationalAgent.Conversations.Create')
|
|
@@ -6304,7 +6332,7 @@ __decorate([
|
|
|
6304
6332
|
], ConversationService.prototype, "uploadAttachment", null);
|
|
6305
6333
|
__decorate([
|
|
6306
6334
|
track('ConversationalAgent.Conversations.CreateAttachment')
|
|
6307
|
-
], ConversationService.prototype, "
|
|
6335
|
+
], ConversationService.prototype, "getAttachmentUploadUri", null);
|
|
6308
6336
|
|
|
6309
6337
|
/**
|
|
6310
6338
|
* MessageService - Message operations for Conversations
|
|
@@ -3811,6 +3811,37 @@ interface ConversationServiceModel {
|
|
|
3811
3811
|
* ```
|
|
3812
3812
|
*/
|
|
3813
3813
|
uploadAttachment(id: string, file: File): Promise<ConversationAttachmentUploadResponse>;
|
|
3814
|
+
/**
|
|
3815
|
+
* Registers a file attachment for a conversation and returns a URI along with
|
|
3816
|
+
* pre-signed upload access details. Use the returned `fileUploadAccess` to upload
|
|
3817
|
+
* the file content to blob storage, then reference `uri` in subsequent messages.
|
|
3818
|
+
*
|
|
3819
|
+
* @param conversationId - The ID of the conversation to attach the file to
|
|
3820
|
+
* @param fileName - The name of the file to attach
|
|
3821
|
+
* @returns Promise resolving to {@link ConversationAttachmentCreateResponse} containing
|
|
3822
|
+
* the attachment `uri` and `fileUploadAccess` details needed to upload the file content
|
|
3823
|
+
*
|
|
3824
|
+
* @example <caption>Step 1 — Get the attachment URI and upload access</caption>
|
|
3825
|
+
* ```typescript
|
|
3826
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, 'report.pdf');
|
|
3827
|
+
* console.log(`Attachment URI: ${uri}`);
|
|
3828
|
+
* ```
|
|
3829
|
+
*
|
|
3830
|
+
* @example <caption>Step 2 — Upload the file content to the returned URL</caption>
|
|
3831
|
+
* ```typescript
|
|
3832
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, file.name);
|
|
3833
|
+
*
|
|
3834
|
+
* await fetch(fileUploadAccess.url, {
|
|
3835
|
+
* method: fileUploadAccess.verb,
|
|
3836
|
+
* body: file,
|
|
3837
|
+
* headers: { 'Content-Type': file.type },
|
|
3838
|
+
* });
|
|
3839
|
+
*
|
|
3840
|
+
* // Reference the URI in a message after upload
|
|
3841
|
+
* console.log(`File ready at: ${uri}`);
|
|
3842
|
+
* ```
|
|
3843
|
+
*/
|
|
3844
|
+
getAttachmentUploadUri(conversationId: string, fileName: string): Promise<ConversationAttachmentCreateResponse>;
|
|
3814
3845
|
/**
|
|
3815
3846
|
* Starts a real-time chat session for a conversation
|
|
3816
3847
|
*
|
|
@@ -6153,6 +6184,37 @@ declare class ConversationService extends BaseService implements ConversationSer
|
|
|
6153
6184
|
* ```
|
|
6154
6185
|
*/
|
|
6155
6186
|
uploadAttachment(id: string, file: File): Promise<ConversationAttachmentUploadResponse>;
|
|
6187
|
+
/**
|
|
6188
|
+
* Registers a file attachment for a conversation and returns a URI along with
|
|
6189
|
+
* pre-signed upload access details. Use the returned `fileUploadAccess` to upload
|
|
6190
|
+
* the file content to blob storage, then reference `uri` in subsequent messages.
|
|
6191
|
+
*
|
|
6192
|
+
* @param conversationId - The ID of the conversation to attach the file to
|
|
6193
|
+
* @param fileName - The name of the file to attach
|
|
6194
|
+
* @returns Promise resolving to {@link ConversationAttachmentCreateResponse} containing
|
|
6195
|
+
* the attachment `uri` and `fileUploadAccess` details needed to upload the file content
|
|
6196
|
+
*
|
|
6197
|
+
* @example <caption>Step 1 — Get the attachment URI and upload access</caption>
|
|
6198
|
+
* ```typescript
|
|
6199
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, 'report.pdf');
|
|
6200
|
+
* console.log(`Attachment URI: ${uri}`);
|
|
6201
|
+
* ```
|
|
6202
|
+
*
|
|
6203
|
+
* @example <caption>Step 2 — Upload the file content to the returned URL</caption>
|
|
6204
|
+
* ```typescript
|
|
6205
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, file.name);
|
|
6206
|
+
*
|
|
6207
|
+
* await fetch(fileUploadAccess.url, {
|
|
6208
|
+
* method: fileUploadAccess.verb,
|
|
6209
|
+
* body: file,
|
|
6210
|
+
* headers: { 'Content-Type': file.type },
|
|
6211
|
+
* });
|
|
6212
|
+
*
|
|
6213
|
+
* // Reference the URI in a message after upload
|
|
6214
|
+
* console.log(`File ready at: ${uri}`);
|
|
6215
|
+
* ```
|
|
6216
|
+
*/
|
|
6217
|
+
getAttachmentUploadUri(conversationId: string, fileName: string): Promise<ConversationAttachmentCreateResponse>;
|
|
6156
6218
|
/**
|
|
6157
6219
|
* Starts a real-time chat session for a conversation
|
|
6158
6220
|
*
|
|
@@ -6236,7 +6298,6 @@ declare class ConversationService extends BaseService implements ConversationSer
|
|
|
6236
6298
|
*/
|
|
6237
6299
|
onConnectionStatusChanged(handler: ConnectionStatusChangedHandler): () => void;
|
|
6238
6300
|
private _getEvents;
|
|
6239
|
-
private createAttachment;
|
|
6240
6301
|
}
|
|
6241
6302
|
|
|
6242
6303
|
/**
|
|
@@ -49,7 +49,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
49
49
|
// Connection string placeholder that will be replaced during build
|
|
50
50
|
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";
|
|
51
51
|
// SDK Version placeholder
|
|
52
|
-
const SDK_VERSION = "1.1
|
|
52
|
+
const SDK_VERSION = "1.2.1";
|
|
53
53
|
const VERSION = "Version";
|
|
54
54
|
const SERVICE = "Service";
|
|
55
55
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -827,11 +827,8 @@ class ApiClient {
|
|
|
827
827
|
return this.tokenManager.getValidToken();
|
|
828
828
|
}
|
|
829
829
|
async getDefaultHeaders() {
|
|
830
|
-
// Get headers from execution context first
|
|
831
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
832
830
|
const token = await this.getValidToken();
|
|
833
831
|
return {
|
|
834
|
-
...contextHeaders,
|
|
835
832
|
'Authorization': `Bearer ${token}`,
|
|
836
833
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
837
834
|
...this.defaultHeaders,
|
|
@@ -6127,10 +6124,11 @@ class ConversationService extends BaseService {
|
|
|
6127
6124
|
*/
|
|
6128
6125
|
async uploadAttachment(id, file) {
|
|
6129
6126
|
// Step 1: Create attachment entry and get upload URL
|
|
6130
|
-
const { fileUploadAccess, uri, name } = await this.
|
|
6127
|
+
const { fileUploadAccess, uri, name } = await this.getAttachmentUploadUri(id, file.name);
|
|
6131
6128
|
// Step 2: Upload file to blob storage
|
|
6132
6129
|
const uploadHeaders = {
|
|
6133
6130
|
'Content-Type': file.type,
|
|
6131
|
+
'x-ms-blob-type': 'BlockBlob',
|
|
6134
6132
|
...arrayDictionaryToRecord(fileUploadAccess.headers)
|
|
6135
6133
|
};
|
|
6136
6134
|
// Add auth header if required by the storage endpoint
|
|
@@ -6155,6 +6153,40 @@ class ConversationService extends BaseService {
|
|
|
6155
6153
|
mimeType: file.type
|
|
6156
6154
|
};
|
|
6157
6155
|
}
|
|
6156
|
+
/**
|
|
6157
|
+
* Registers a file attachment for a conversation and returns a URI along with
|
|
6158
|
+
* pre-signed upload access details. Use the returned `fileUploadAccess` to upload
|
|
6159
|
+
* the file content to blob storage, then reference `uri` in subsequent messages.
|
|
6160
|
+
*
|
|
6161
|
+
* @param conversationId - The ID of the conversation to attach the file to
|
|
6162
|
+
* @param fileName - The name of the file to attach
|
|
6163
|
+
* @returns Promise resolving to {@link ConversationAttachmentCreateResponse} containing
|
|
6164
|
+
* the attachment `uri` and `fileUploadAccess` details needed to upload the file content
|
|
6165
|
+
*
|
|
6166
|
+
* @example <caption>Step 1 — Get the attachment URI and upload access</caption>
|
|
6167
|
+
* ```typescript
|
|
6168
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, 'report.pdf');
|
|
6169
|
+
* console.log(`Attachment URI: ${uri}`);
|
|
6170
|
+
* ```
|
|
6171
|
+
*
|
|
6172
|
+
* @example <caption>Step 2 — Upload the file content to the returned URL</caption>
|
|
6173
|
+
* ```typescript
|
|
6174
|
+
* const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, file.name);
|
|
6175
|
+
*
|
|
6176
|
+
* await fetch(fileUploadAccess.url, {
|
|
6177
|
+
* method: fileUploadAccess.verb,
|
|
6178
|
+
* body: file,
|
|
6179
|
+
* headers: { 'Content-Type': file.type },
|
|
6180
|
+
* });
|
|
6181
|
+
*
|
|
6182
|
+
* // Reference the URI in a message after upload
|
|
6183
|
+
* console.log(`File ready at: ${uri}`);
|
|
6184
|
+
* ```
|
|
6185
|
+
*/
|
|
6186
|
+
async getAttachmentUploadUri(conversationId, fileName) {
|
|
6187
|
+
const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
|
|
6188
|
+
return response.data;
|
|
6189
|
+
}
|
|
6158
6190
|
// ==================== Real-time Event Handling ====================
|
|
6159
6191
|
/**
|
|
6160
6192
|
* Starts a real-time chat session for a conversation
|
|
@@ -6277,10 +6309,6 @@ class ConversationService extends BaseService {
|
|
|
6277
6309
|
}
|
|
6278
6310
|
return this._eventHelper;
|
|
6279
6311
|
}
|
|
6280
|
-
async createAttachment(conversationId, fileName) {
|
|
6281
|
-
const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
|
|
6282
|
-
return response.data;
|
|
6283
|
-
}
|
|
6284
6312
|
}
|
|
6285
6313
|
__decorate([
|
|
6286
6314
|
track('ConversationalAgent.Conversations.Create')
|
|
@@ -6302,7 +6330,7 @@ __decorate([
|
|
|
6302
6330
|
], ConversationService.prototype, "uploadAttachment", null);
|
|
6303
6331
|
__decorate([
|
|
6304
6332
|
track('ConversationalAgent.Conversations.CreateAttachment')
|
|
6305
|
-
], ConversationService.prototype, "
|
|
6333
|
+
], ConversationService.prototype, "getAttachmentUploadUri", null);
|
|
6306
6334
|
|
|
6307
6335
|
/**
|
|
6308
6336
|
* MessageService - Message operations for Conversations
|