@microsoft/agents-hosting-storage-blob 0.2.10-g3ac88ff25e → 0.3.5
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/src/blobsStorage.d.ts +34 -0
- package/dist/src/blobsStorage.js +31 -0
- package/dist/src/blobsStorage.js.map +1 -1
- package/dist/src/blobsTranscriptStore.d.ts +40 -0
- package/dist/src/blobsTranscriptStore.js +50 -0
- package/dist/src/blobsTranscriptStore.js.map +1 -1
- package/package.json +2 -2
- package/src/blobsStorage.ts +34 -0
- package/src/blobsTranscriptStore.ts +57 -0
- package/dist/index.js +0 -20
|
@@ -4,19 +4,53 @@ import { Storage, StoreItems } from '@microsoft/agents-hosting';
|
|
|
4
4
|
* Options for configuring the BlobsStorage.
|
|
5
5
|
*/
|
|
6
6
|
export interface BlobsStorageOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Optional Azure Storage pipeline options to customize request behavior
|
|
9
|
+
*/
|
|
7
10
|
storagePipelineOptions?: StoragePipelineOptions;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* A class that implements the Storage interface using Azure Blob Storage.
|
|
14
|
+
* Provides persistence for bot state data using Azure's Blob Storage service.
|
|
11
15
|
*/
|
|
12
16
|
export declare class BlobsStorage implements Storage {
|
|
13
17
|
private readonly _containerClient;
|
|
14
18
|
private readonly _concurrency;
|
|
15
19
|
private _initializePromise?;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new instance of the BlobsStorage class.
|
|
22
|
+
*
|
|
23
|
+
* @param connectionString The Azure Storage connection string
|
|
24
|
+
* @param containerName The name of the Blob container to use
|
|
25
|
+
* @param options Optional configuration settings for the storage provider
|
|
26
|
+
* @param url Optional URL to the blob service (used instead of connectionString if provided)
|
|
27
|
+
* @param credential Optional credential for authentication (used with url if provided)
|
|
28
|
+
*/
|
|
16
29
|
constructor(connectionString: string, containerName: string, options?: BlobsStorageOptions, url?: string, credential?: StorageSharedKeyCredential | AnonymousCredential);
|
|
17
30
|
private toJSON;
|
|
18
31
|
private _initialize;
|
|
32
|
+
/**
|
|
33
|
+
* Reads storage items from blob storage.
|
|
34
|
+
*
|
|
35
|
+
* @param keys Array of item keys to read
|
|
36
|
+
* @returns A promise that resolves to a StoreItems object containing the retrieved items
|
|
37
|
+
* @throws Will throw if keys parameter is invalid or if there's an error reading from storage
|
|
38
|
+
*/
|
|
19
39
|
read(keys: string[]): Promise<StoreItems>;
|
|
40
|
+
/**
|
|
41
|
+
* Writes storage items to blob storage.
|
|
42
|
+
*
|
|
43
|
+
* @param changes The items to write to storage
|
|
44
|
+
* @returns A promise that resolves when the write operation is complete
|
|
45
|
+
* @throws Will throw if there's a validation error, eTag conflict, or other storage error
|
|
46
|
+
*/
|
|
20
47
|
write(changes: StoreItems): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Deletes storage items from blob storage.
|
|
50
|
+
*
|
|
51
|
+
* @param keys Array of item keys to delete
|
|
52
|
+
* @returns A promise that resolves when the delete operation is complete
|
|
53
|
+
* @throws Will throw if keys parameter is invalid
|
|
54
|
+
*/
|
|
21
55
|
delete(keys: string[]): Promise<void>;
|
|
22
56
|
}
|
package/dist/src/blobsStorage.js
CHANGED
|
@@ -44,8 +44,18 @@ const blobsTranscriptStore_1 = require("./blobsTranscriptStore");
|
|
|
44
44
|
const ignoreError_1 = require("./ignoreError");
|
|
45
45
|
/**
|
|
46
46
|
* A class that implements the Storage interface using Azure Blob Storage.
|
|
47
|
+
* Provides persistence for bot state data using Azure's Blob Storage service.
|
|
47
48
|
*/
|
|
48
49
|
class BlobsStorage {
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new instance of the BlobsStorage class.
|
|
52
|
+
*
|
|
53
|
+
* @param connectionString The Azure Storage connection string
|
|
54
|
+
* @param containerName The name of the Blob container to use
|
|
55
|
+
* @param options Optional configuration settings for the storage provider
|
|
56
|
+
* @param url Optional URL to the blob service (used instead of connectionString if provided)
|
|
57
|
+
* @param credential Optional credential for authentication (used with url if provided)
|
|
58
|
+
*/
|
|
49
59
|
constructor(connectionString, containerName, options, url = '', credential) {
|
|
50
60
|
this._concurrency = Infinity;
|
|
51
61
|
if (url !== '' && credential != null) {
|
|
@@ -77,6 +87,13 @@ class BlobsStorage {
|
|
|
77
87
|
}
|
|
78
88
|
return this._initializePromise;
|
|
79
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Reads storage items from blob storage.
|
|
92
|
+
*
|
|
93
|
+
* @param keys Array of item keys to read
|
|
94
|
+
* @returns A promise that resolves to a StoreItems object containing the retrieved items
|
|
95
|
+
* @throws Will throw if keys parameter is invalid or if there's an error reading from storage
|
|
96
|
+
*/
|
|
80
97
|
async read(keys) {
|
|
81
98
|
z.object({ keys: z.array(z.string()) }).parse({ keys });
|
|
82
99
|
await this._initialize();
|
|
@@ -96,6 +113,13 @@ class BlobsStorage {
|
|
|
96
113
|
}));
|
|
97
114
|
return results.reduce((acc, { key, value }) => (value ? { ...acc, [key]: value } : acc), {});
|
|
98
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Writes storage items to blob storage.
|
|
118
|
+
*
|
|
119
|
+
* @param changes The items to write to storage
|
|
120
|
+
* @returns A promise that resolves when the write operation is complete
|
|
121
|
+
* @throws Will throw if there's a validation error, eTag conflict, or other storage error
|
|
122
|
+
*/
|
|
99
123
|
async write(changes) {
|
|
100
124
|
z.record(z.unknown()).parse(changes);
|
|
101
125
|
await this._initialize();
|
|
@@ -118,6 +142,13 @@ class BlobsStorage {
|
|
|
118
142
|
}
|
|
119
143
|
}));
|
|
120
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Deletes storage items from blob storage.
|
|
147
|
+
*
|
|
148
|
+
* @param keys Array of item keys to delete
|
|
149
|
+
* @returns A promise that resolves when the delete operation is complete
|
|
150
|
+
* @throws Will throw if keys parameter is invalid
|
|
151
|
+
*/
|
|
121
152
|
async delete(keys) {
|
|
122
153
|
z.object({ keys: z.array(z.string()) }).parse({ keys });
|
|
123
154
|
await this._initialize();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobsStorage.js","sourceRoot":"","sources":["../../src/blobsStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,iEAA8C;AAC9C,sDAK4B;AAE5B,iEAAwD;AACxD,+CAA8D;
|
|
1
|
+
{"version":3,"file":"blobsStorage.js","sourceRoot":"","sources":["../../src/blobsStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,iEAA8C;AAC9C,sDAK4B;AAE5B,iEAAwD;AACxD,+CAA8D;AAY9D;;;GAGG;AACH,MAAa,YAAY;IAKvB;;;;;;;;OAQG;IACH,YACE,gBAAwB,EACxB,aAAqB,EACrB,OAA6B,EAC7B,GAAG,GAAG,EAAE,EACR,UAA6D;QAjB9C,iBAAY,GAAG,QAAQ,CAAA;QAmBtC,IAAI,GAAG,KAAK,EAAE,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACrC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;gBAClC,GAAG;aACJ,CAAC,CAAA;YAEF,IAAI,CAAC,gBAAgB,GAAG,IAAI,8BAAe,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,CAAC,CAAA;YAE7F,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,6BAA6B,EAAE,CAAC;gBACjD,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;YACvB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KA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configuring the BlobsTranscriptStore.
|
|
10
10
|
*/
|
|
11
11
|
export interface BlobsTranscriptStoreOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Optional pipeline options for configuring the Azure Blob Storage client.
|
|
14
|
+
*/
|
|
12
15
|
storagePipelineOptions?: StoragePipelineOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates whether to decode the transcript key when retrieving transcripts.
|
|
18
|
+
*/
|
|
13
19
|
decodeTranscriptKey?: boolean;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
@@ -20,10 +26,44 @@ export declare class BlobsTranscriptStore implements TranscriptStore {
|
|
|
20
26
|
private readonly _concurrency;
|
|
21
27
|
private _initializePromise?;
|
|
22
28
|
private _isDecodeTranscriptKey?;
|
|
29
|
+
/**
|
|
30
|
+
* Constructs a new instance of the BlobsTranscriptStore class.
|
|
31
|
+
* @param connectionString - The connection string for the Azure Blob Storage account.
|
|
32
|
+
* @param containerName - The name of the container to use for storing transcripts.
|
|
33
|
+
* @param options - Optional configuration options for the store.
|
|
34
|
+
* @param blobServiceUri - Optional URI for the blob service.
|
|
35
|
+
* @param tokenCredential - Optional credentials for authenticating with the blob service.
|
|
36
|
+
*/
|
|
23
37
|
constructor(connectionString: string, containerName: string, options?: BlobsTranscriptStoreOptions, blobServiceUri?: string, tokenCredential?: StorageSharedKeyCredential | AnonymousCredential);
|
|
24
38
|
private _initialize;
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves transcript activities for a specific conversation.
|
|
41
|
+
* @param channelId - The ID of the channel.
|
|
42
|
+
* @param conversationId - The ID of the conversation.
|
|
43
|
+
* @param continuationToken - Optional token for paginated results.
|
|
44
|
+
* @param startDate - Optional start date to filter activities.
|
|
45
|
+
* @returns A promise resolving to a paged result of activities.
|
|
46
|
+
*/
|
|
25
47
|
getTranscriptActivities(channelId: string, conversationId: string, continuationToken?: string, startDate?: Date): Promise<PagedResult<Activity>>;
|
|
48
|
+
/**
|
|
49
|
+
* Lists all transcripts for a specific channel.
|
|
50
|
+
* @param channelId - The ID of the channel.
|
|
51
|
+
* @param continuationToken - Optional token for paginated results.
|
|
52
|
+
* @returns A promise resolving to a paged result of transcript information.
|
|
53
|
+
*/
|
|
26
54
|
listTranscripts(channelId: string, continuationToken?: string): Promise<PagedResult<TranscriptInfo>>;
|
|
55
|
+
/**
|
|
56
|
+
* Deletes all transcripts for a specific conversation.
|
|
57
|
+
* @param channelId - The ID of the channel.
|
|
58
|
+
* @param conversationId - The ID of the conversation.
|
|
59
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
60
|
+
*/
|
|
27
61
|
deleteTranscript(channelId: string, conversationId: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Logs an activity to the transcript store.
|
|
64
|
+
* @param activity - The activity to log.
|
|
65
|
+
* @param options - Optional configuration options for the operation.
|
|
66
|
+
* @returns A promise that resolves when the activity is logged.
|
|
67
|
+
*/
|
|
28
68
|
logActivity(activity: Activity, options?: BlobsTranscriptStoreOptions): Promise<void>;
|
|
29
69
|
}
|
|
@@ -42,15 +42,31 @@ exports.maybeCast = maybeCast;
|
|
|
42
42
|
const z = __importStar(require("zod"));
|
|
43
43
|
const consumers_1 = __importDefault(require("stream/consumers"));
|
|
44
44
|
const storage_blob_1 = require("@azure/storage-blob");
|
|
45
|
+
/**
|
|
46
|
+
* Formats a Date object into a hexadecimal string representing ticks.
|
|
47
|
+
* @param timestamp - The Date object to format.
|
|
48
|
+
* @returns A string representing the formatted ticks.
|
|
49
|
+
*/
|
|
45
50
|
function formatTicks(timestamp) {
|
|
46
51
|
const epochTicks = 621355968000000000;
|
|
47
52
|
const ticksPerMillisecond = 10000;
|
|
48
53
|
const ticks = epochTicks + timestamp.getTime() * ticksPerMillisecond;
|
|
49
54
|
return ticks.toString(16);
|
|
50
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Generates a sanitized prefix for a channel.
|
|
58
|
+
* @param channelId - The ID of the channel.
|
|
59
|
+
* @returns A sanitized string prefix for the channel.
|
|
60
|
+
*/
|
|
51
61
|
function getChannelPrefix(channelId) {
|
|
52
62
|
return sanitizeBlobKey(`${channelId}/`);
|
|
53
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Generates a sanitized prefix for a conversation within a channel.
|
|
66
|
+
* @param channelId - The ID of the channel.
|
|
67
|
+
* @param conversationId - The ID of the conversation.
|
|
68
|
+
* @returns A sanitized string prefix for the conversation.
|
|
69
|
+
*/
|
|
54
70
|
function getConversationPrefix(channelId, conversationId) {
|
|
55
71
|
return sanitizeBlobKey(`${channelId}/${conversationId}`);
|
|
56
72
|
}
|
|
@@ -89,6 +105,14 @@ const MAX_PAGE_SIZE = 20;
|
|
|
89
105
|
* A class that implements the TranscriptStore interface using Azure Blob Storage.
|
|
90
106
|
*/
|
|
91
107
|
class BlobsTranscriptStore {
|
|
108
|
+
/**
|
|
109
|
+
* Constructs a new instance of the BlobsTranscriptStore class.
|
|
110
|
+
* @param connectionString - The connection string for the Azure Blob Storage account.
|
|
111
|
+
* @param containerName - The name of the container to use for storing transcripts.
|
|
112
|
+
* @param options - Optional configuration options for the store.
|
|
113
|
+
* @param blobServiceUri - Optional URI for the blob service.
|
|
114
|
+
* @param tokenCredential - Optional credentials for authenticating with the blob service.
|
|
115
|
+
*/
|
|
92
116
|
constructor(connectionString, containerName, options, blobServiceUri = '', tokenCredential) {
|
|
93
117
|
this._concurrency = Infinity;
|
|
94
118
|
this._isDecodeTranscriptKey = false;
|
|
@@ -119,6 +143,14 @@ class BlobsTranscriptStore {
|
|
|
119
143
|
}
|
|
120
144
|
return this._initializePromise;
|
|
121
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Retrieves transcript activities for a specific conversation.
|
|
148
|
+
* @param channelId - The ID of the channel.
|
|
149
|
+
* @param conversationId - The ID of the conversation.
|
|
150
|
+
* @param continuationToken - Optional token for paginated results.
|
|
151
|
+
* @param startDate - Optional start date to filter activities.
|
|
152
|
+
* @returns A promise resolving to a paged result of activities.
|
|
153
|
+
*/
|
|
122
154
|
async getTranscriptActivities(channelId, conversationId, continuationToken, startDate) {
|
|
123
155
|
var _a, _b, _c, _d;
|
|
124
156
|
z.object({ channelId: z.string(), conversationId: z.string() }).parse({ channelId, conversationId });
|
|
@@ -164,6 +196,12 @@ class BlobsTranscriptStore {
|
|
|
164
196
|
items: result.reduce((acc, activity) => (activity ? acc.concat(activity) : acc), []),
|
|
165
197
|
};
|
|
166
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Lists all transcripts for a specific channel.
|
|
201
|
+
* @param channelId - The ID of the channel.
|
|
202
|
+
* @param continuationToken - Optional token for paginated results.
|
|
203
|
+
* @returns A promise resolving to a paged result of transcript information.
|
|
204
|
+
*/
|
|
167
205
|
async listTranscripts(channelId, continuationToken) {
|
|
168
206
|
var _a, _b, _c, _d;
|
|
169
207
|
z.object({ channelId: z.string() }).parse({ channelId });
|
|
@@ -196,6 +234,12 @@ class BlobsTranscriptStore {
|
|
|
196
234
|
items: result !== null && result !== void 0 ? result : [],
|
|
197
235
|
};
|
|
198
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Deletes all transcripts for a specific conversation.
|
|
239
|
+
* @param channelId - The ID of the channel.
|
|
240
|
+
* @param conversationId - The ID of the conversation.
|
|
241
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
242
|
+
*/
|
|
199
243
|
async deleteTranscript(channelId, conversationId) {
|
|
200
244
|
var _a, _b, _c;
|
|
201
245
|
z.object({ channelId: z.string(), conversationId: z.string() }).parse({ channelId, conversationId });
|
|
@@ -216,6 +260,12 @@ class BlobsTranscriptStore {
|
|
|
216
260
|
page = await iter.next();
|
|
217
261
|
}
|
|
218
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Logs an activity to the transcript store.
|
|
265
|
+
* @param activity - The activity to log.
|
|
266
|
+
* @param options - Optional configuration options for the operation.
|
|
267
|
+
* @returns A promise that resolves when the activity is logged.
|
|
268
|
+
*/
|
|
219
269
|
async logActivity(activity, options) {
|
|
220
270
|
var _a, _b, _c, _d;
|
|
221
271
|
z.object({ activity: z.record(z.unknown()) }).parse({ activity });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobsTranscriptStore.js","sourceRoot":"","sources":["../../src/blobsTranscriptStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"blobsTranscriptStore.js","sourceRoot":"","sources":["../../src/blobsTranscriptStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,0CAeC;AAED,8BAMC;AAnFD,uCAAwB;AACxB,iEAA8C;AAG9C,sDAO4B;AAG5B;;;;GAIG;AACH,SAAS,WAAW,CAAE,SAAe;IACnC,MAAM,UAAU,GAAG,kBAAkB,CAAA;IACrC,MAAM,mBAAmB,GAAG,KAAK,CAAA;IACjC,MAAM,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,mBAAmB,CAAA;IACpE,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAE,SAAiB;IAC1C,OAAO,eAAe,CAAC,GAAG,SAAS,GAAG,CAAC,CAAA;AACzC,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAE,SAAiB,EAAE,cAAsB;IACvE,OAAO,eAAe,CAAC,GAAG,SAAS,IAAI,cAAc,EAAE,CAAC,CAAA;AAC1D,CAAC;AAED,SAAS,UAAU,CAAE,QAAkB,EAAE,OAAqC;;IAC5E,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,YAAY,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC;SACpB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,UA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"version": "0.
|
|
4
|
+
"version": "0.3.5",
|
|
5
5
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "dist/src/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@azure/storage-blob": "^12.27.0",
|
|
20
|
-
"@microsoft/agents-hosting": "0.
|
|
20
|
+
"@microsoft/agents-hosting": "0.3.5"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"files": [
|
package/src/blobsStorage.ts
CHANGED
|
@@ -14,17 +14,30 @@ import { ignoreError, isStatusCodeError } from './ignoreError'
|
|
|
14
14
|
* Options for configuring the BlobsStorage.
|
|
15
15
|
*/
|
|
16
16
|
export interface BlobsStorageOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Optional Azure Storage pipeline options to customize request behavior
|
|
19
|
+
*/
|
|
17
20
|
storagePipelineOptions?: StoragePipelineOptions;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* A class that implements the Storage interface using Azure Blob Storage.
|
|
25
|
+
* Provides persistence for bot state data using Azure's Blob Storage service.
|
|
22
26
|
*/
|
|
23
27
|
export class BlobsStorage implements Storage {
|
|
24
28
|
private readonly _containerClient: ContainerClient
|
|
25
29
|
private readonly _concurrency = Infinity
|
|
26
30
|
private _initializePromise?: Promise<unknown>
|
|
27
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new instance of the BlobsStorage class.
|
|
34
|
+
*
|
|
35
|
+
* @param connectionString The Azure Storage connection string
|
|
36
|
+
* @param containerName The name of the Blob container to use
|
|
37
|
+
* @param options Optional configuration settings for the storage provider
|
|
38
|
+
* @param url Optional URL to the blob service (used instead of connectionString if provided)
|
|
39
|
+
* @param credential Optional credential for authentication (used with url if provided)
|
|
40
|
+
*/
|
|
28
41
|
constructor (
|
|
29
42
|
connectionString: string,
|
|
30
43
|
containerName: string,
|
|
@@ -71,6 +84,13 @@ export class BlobsStorage implements Storage {
|
|
|
71
84
|
return this._initializePromise
|
|
72
85
|
}
|
|
73
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Reads storage items from blob storage.
|
|
89
|
+
*
|
|
90
|
+
* @param keys Array of item keys to read
|
|
91
|
+
* @returns A promise that resolves to a StoreItems object containing the retrieved items
|
|
92
|
+
* @throws Will throw if keys parameter is invalid or if there's an error reading from storage
|
|
93
|
+
*/
|
|
74
94
|
async read (keys: string[]): Promise<StoreItems> {
|
|
75
95
|
z.object({ keys: z.array(z.string()) }).parse({ keys })
|
|
76
96
|
|
|
@@ -102,6 +122,13 @@ export class BlobsStorage implements Storage {
|
|
|
102
122
|
return results.reduce((acc, { key, value }) => (value ? { ...acc, [key]: value } : acc), {})
|
|
103
123
|
}
|
|
104
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Writes storage items to blob storage.
|
|
127
|
+
*
|
|
128
|
+
* @param changes The items to write to storage
|
|
129
|
+
* @returns A promise that resolves when the write operation is complete
|
|
130
|
+
* @throws Will throw if there's a validation error, eTag conflict, or other storage error
|
|
131
|
+
*/
|
|
105
132
|
async write (changes: StoreItems): Promise<void> {
|
|
106
133
|
z.record(z.unknown()).parse(changes)
|
|
107
134
|
|
|
@@ -127,6 +154,13 @@ export class BlobsStorage implements Storage {
|
|
|
127
154
|
)
|
|
128
155
|
}
|
|
129
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Deletes storage items from blob storage.
|
|
159
|
+
*
|
|
160
|
+
* @param keys Array of item keys to delete
|
|
161
|
+
* @returns A promise that resolves when the delete operation is complete
|
|
162
|
+
* @throws Will throw if keys parameter is invalid
|
|
163
|
+
*/
|
|
130
164
|
async delete (keys: string[]): Promise<void> {
|
|
131
165
|
z.object({ keys: z.array(z.string()) }).parse({ keys })
|
|
132
166
|
|
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
} from '@azure/storage-blob'
|
|
13
13
|
import { TranscriptStore, PagedResult, TranscriptInfo } from '@microsoft/agents-hosting'
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Formats a Date object into a hexadecimal string representing ticks.
|
|
17
|
+
* @param timestamp - The Date object to format.
|
|
18
|
+
* @returns A string representing the formatted ticks.
|
|
19
|
+
*/
|
|
15
20
|
function formatTicks (timestamp: Date): string {
|
|
16
21
|
const epochTicks = 621355968000000000
|
|
17
22
|
const ticksPerMillisecond = 10000
|
|
@@ -19,10 +24,21 @@ function formatTicks (timestamp: Date): string {
|
|
|
19
24
|
return ticks.toString(16)
|
|
20
25
|
}
|
|
21
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Generates a sanitized prefix for a channel.
|
|
29
|
+
* @param channelId - The ID of the channel.
|
|
30
|
+
* @returns A sanitized string prefix for the channel.
|
|
31
|
+
*/
|
|
22
32
|
function getChannelPrefix (channelId: string): string {
|
|
23
33
|
return sanitizeBlobKey(`${channelId}/`)
|
|
24
34
|
}
|
|
25
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Generates a sanitized prefix for a conversation within a channel.
|
|
38
|
+
* @param channelId - The ID of the channel.
|
|
39
|
+
* @param conversationId - The ID of the conversation.
|
|
40
|
+
* @returns A sanitized string prefix for the conversation.
|
|
41
|
+
*/
|
|
26
42
|
function getConversationPrefix (channelId: string, conversationId: string): string {
|
|
27
43
|
return sanitizeBlobKey(`${channelId}/${conversationId}`)
|
|
28
44
|
}
|
|
@@ -73,7 +89,14 @@ const MAX_PAGE_SIZE = 20
|
|
|
73
89
|
* Options for configuring the BlobsTranscriptStore.
|
|
74
90
|
*/
|
|
75
91
|
export interface BlobsTranscriptStoreOptions {
|
|
92
|
+
/**
|
|
93
|
+
* Optional pipeline options for configuring the Azure Blob Storage client.
|
|
94
|
+
*/
|
|
76
95
|
storagePipelineOptions?: StoragePipelineOptions;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Indicates whether to decode the transcript key when retrieving transcripts.
|
|
99
|
+
*/
|
|
77
100
|
decodeTranscriptKey?: boolean;
|
|
78
101
|
}
|
|
79
102
|
|
|
@@ -86,6 +109,14 @@ export class BlobsTranscriptStore implements TranscriptStore {
|
|
|
86
109
|
private _initializePromise?: Promise<unknown>
|
|
87
110
|
private _isDecodeTranscriptKey?: boolean = false
|
|
88
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Constructs a new instance of the BlobsTranscriptStore class.
|
|
114
|
+
* @param connectionString - The connection string for the Azure Blob Storage account.
|
|
115
|
+
* @param containerName - The name of the container to use for storing transcripts.
|
|
116
|
+
* @param options - Optional configuration options for the store.
|
|
117
|
+
* @param blobServiceUri - Optional URI for the blob service.
|
|
118
|
+
* @param tokenCredential - Optional credentials for authenticating with the blob service.
|
|
119
|
+
*/
|
|
89
120
|
constructor (
|
|
90
121
|
connectionString: string,
|
|
91
122
|
containerName: string,
|
|
@@ -134,6 +165,14 @@ export class BlobsTranscriptStore implements TranscriptStore {
|
|
|
134
165
|
return this._initializePromise
|
|
135
166
|
}
|
|
136
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Retrieves transcript activities for a specific conversation.
|
|
170
|
+
* @param channelId - The ID of the channel.
|
|
171
|
+
* @param conversationId - The ID of the conversation.
|
|
172
|
+
* @param continuationToken - Optional token for paginated results.
|
|
173
|
+
* @param startDate - Optional start date to filter activities.
|
|
174
|
+
* @returns A promise resolving to a paged result of activities.
|
|
175
|
+
*/
|
|
137
176
|
async getTranscriptActivities (
|
|
138
177
|
channelId: string,
|
|
139
178
|
conversationId: string,
|
|
@@ -202,6 +241,12 @@ export class BlobsTranscriptStore implements TranscriptStore {
|
|
|
202
241
|
}
|
|
203
242
|
}
|
|
204
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Lists all transcripts for a specific channel.
|
|
246
|
+
* @param channelId - The ID of the channel.
|
|
247
|
+
* @param continuationToken - Optional token for paginated results.
|
|
248
|
+
* @returns A promise resolving to a paged result of transcript information.
|
|
249
|
+
*/
|
|
205
250
|
async listTranscripts (channelId: string, continuationToken?: string): Promise<PagedResult<TranscriptInfo>> {
|
|
206
251
|
z.object({ channelId: z.string() }).parse({ channelId })
|
|
207
252
|
|
|
@@ -242,6 +287,12 @@ export class BlobsTranscriptStore implements TranscriptStore {
|
|
|
242
287
|
}
|
|
243
288
|
}
|
|
244
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Deletes all transcripts for a specific conversation.
|
|
292
|
+
* @param channelId - The ID of the channel.
|
|
293
|
+
* @param conversationId - The ID of the conversation.
|
|
294
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
295
|
+
*/
|
|
245
296
|
async deleteTranscript (channelId: string, conversationId: string): Promise<void> {
|
|
246
297
|
z.object({ channelId: z.string(), conversationId: z.string() }).parse({ channelId, conversationId })
|
|
247
298
|
|
|
@@ -270,6 +321,12 @@ export class BlobsTranscriptStore implements TranscriptStore {
|
|
|
270
321
|
}
|
|
271
322
|
}
|
|
272
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Logs an activity to the transcript store.
|
|
326
|
+
* @param activity - The activity to log.
|
|
327
|
+
* @param options - Optional configuration options for the operation.
|
|
328
|
+
* @returns A promise that resolves when the activity is logged.
|
|
329
|
+
*/
|
|
273
330
|
async logActivity (activity: Activity, options?: BlobsTranscriptStoreOptions): Promise<void> {
|
|
274
331
|
z.object({ activity: z.record(z.unknown()) }).parse({ activity })
|
|
275
332
|
|
package/dist/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
// Licensed under the MIT License.
|
|
4
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
-
if (k2 === undefined) k2 = k;
|
|
6
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(o, k2, desc);
|
|
11
|
-
}) : (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
}));
|
|
15
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
__exportStar(require("./src"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|