@microsoft/agents-hosting-storage-blob 0.6.21-g3c2261b2fc → 1.0.0
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.
|
@@ -3,7 +3,7 @@ import { TokenCredential } from '@azure/core-auth';
|
|
|
3
3
|
import { AnonymousCredential, StoragePipelineOptions, StorageSharedKeyCredential } from '@azure/storage-blob';
|
|
4
4
|
import { TranscriptStore, PagedResult, TranscriptInfo } from '@microsoft/agents-hosting';
|
|
5
5
|
/**
|
|
6
|
-
* Sanitizes a blob key for use with Azure Blob Storage.
|
|
6
|
+
* @summary Sanitizes a blob key for use with Azure Blob Storage.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
9
|
* This function performs the following operations:
|
|
@@ -13,13 +13,6 @@ import { TranscriptStore, PagedResult, TranscriptInfo } from '@microsoft/agents-
|
|
|
13
13
|
* 4. URL encodes the key to ensure it's safe for use as a blob name
|
|
14
14
|
* 5. Optionally decodes the key if the decodeTranscriptKey option is set
|
|
15
15
|
*
|
|
16
|
-
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
17
|
-
* @param options - Optional configuration options.
|
|
18
|
-
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
19
|
-
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
20
|
-
*
|
|
21
|
-
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
22
|
-
*
|
|
23
16
|
* @example
|
|
24
17
|
* ```typescript
|
|
25
18
|
* // Basic sanitization with encoding
|
|
@@ -34,14 +27,22 @@ import { TranscriptStore, PagedResult, TranscriptInfo } from '@microsoft/agents-
|
|
|
34
27
|
* const withEmptySegments = sanitizeBlobKey('channel1//conversation2///activity.json');
|
|
35
28
|
* // Returns: 'channel1%2Fconversation2%2Factivity.json'
|
|
36
29
|
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
32
|
+
* @param options - Optional configuration options.
|
|
33
|
+
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
34
|
+
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
35
|
+
*
|
|
36
|
+
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
37
37
|
*/
|
|
38
38
|
export declare function sanitizeBlobKey(key: string, options?: BlobsTranscriptStoreOptions): string;
|
|
39
39
|
/**
|
|
40
|
-
* Performs type casting with optional constructor validation.
|
|
40
|
+
* @summary Performs type casting with optional constructor validation.
|
|
41
|
+
* @remarks
|
|
41
42
|
* If a constructor is provided, validates that the value is an instance of that constructor.
|
|
42
43
|
* Otherwise, performs a direct type assertion.
|
|
43
44
|
*
|
|
44
|
-
* @
|
|
45
|
+
* @typeParam T - The target type to cast to.
|
|
45
46
|
* @param value - The value to cast.
|
|
46
47
|
* @param ctor - Optional constructor function to validate the value against.
|
|
47
48
|
* @returns The value cast to type T.
|
|
@@ -55,7 +55,7 @@ function formatTicks(timestamp) {
|
|
|
55
55
|
return ticks.toString(16);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Generates a sanitized prefix for a channel.
|
|
58
|
+
* @summary Generates a sanitized prefix for a channel.
|
|
59
59
|
* @param channelId - The ID of the channel.
|
|
60
60
|
* @returns A sanitized string prefix for the channel.
|
|
61
61
|
*/
|
|
@@ -83,7 +83,7 @@ function getBlobKey(activity, options) {
|
|
|
83
83
|
return sanitizeBlobKey([activity.channelId, (_a = activity.conversation) === null || _a === void 0 ? void 0 : _a.id, `${formatTicks(timestamp)}-${activity.id}.json`].join('/'), options);
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* Sanitizes a blob key for use with Azure Blob Storage.
|
|
86
|
+
* @summary Sanitizes a blob key for use with Azure Blob Storage.
|
|
87
87
|
*
|
|
88
88
|
* @remarks
|
|
89
89
|
* This function performs the following operations:
|
|
@@ -93,13 +93,6 @@ function getBlobKey(activity, options) {
|
|
|
93
93
|
* 4. URL encodes the key to ensure it's safe for use as a blob name
|
|
94
94
|
* 5. Optionally decodes the key if the decodeTranscriptKey option is set
|
|
95
95
|
*
|
|
96
|
-
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
97
|
-
* @param options - Optional configuration options.
|
|
98
|
-
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
99
|
-
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
100
|
-
*
|
|
101
|
-
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
102
|
-
*
|
|
103
96
|
* @example
|
|
104
97
|
* ```typescript
|
|
105
98
|
* // Basic sanitization with encoding
|
|
@@ -114,6 +107,13 @@ function getBlobKey(activity, options) {
|
|
|
114
107
|
* const withEmptySegments = sanitizeBlobKey('channel1//conversation2///activity.json');
|
|
115
108
|
* // Returns: 'channel1%2Fconversation2%2Factivity.json'
|
|
116
109
|
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
112
|
+
* @param options - Optional configuration options.
|
|
113
|
+
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
114
|
+
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
115
|
+
*
|
|
116
|
+
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
117
117
|
*/
|
|
118
118
|
function sanitizeBlobKey(key, options) {
|
|
119
119
|
if (!key || key.length === 0) {
|
|
@@ -129,11 +129,12 @@ function sanitizeBlobKey(key, options) {
|
|
|
129
129
|
return encodedKey;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
* Performs type casting with optional constructor validation.
|
|
132
|
+
* @summary Performs type casting with optional constructor validation.
|
|
133
|
+
* @remarks
|
|
133
134
|
* If a constructor is provided, validates that the value is an instance of that constructor.
|
|
134
135
|
* Otherwise, performs a direct type assertion.
|
|
135
136
|
*
|
|
136
|
-
* @
|
|
137
|
+
* @typeParam T - The target type to cast to.
|
|
137
138
|
* @param value - The value to cast.
|
|
138
139
|
* @param ctor - Optional constructor function to validate the value against.
|
|
139
140
|
* @returns The value cast to type T.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobsTranscriptStore.js","sourceRoot":"","sources":["../../src/blobsTranscriptStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,0CAeC;
|
|
1
|
+
{"version":3,"file":"blobsTranscriptStore.js","sourceRoot":"","sources":["../../src/blobsTranscriptStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,0CAeC;AAsBD,8BAMC;AAxID,uCAAwB;AACxB,iEAA8C;AAC9C,gEAAqD;AAErD,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,C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AC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAChE,CAAC;CACF;AAzPD,oDAyPC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@microsoft/agents-hosting-storage-blob",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
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": "1.0.0"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"files": [
|
|
@@ -25,7 +25,7 @@ function formatTicks (timestamp: Date): string {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Generates a sanitized prefix for a channel.
|
|
28
|
+
* @summary Generates a sanitized prefix for a channel.
|
|
29
29
|
* @param channelId - The ID of the channel.
|
|
30
30
|
* @returns A sanitized string prefix for the channel.
|
|
31
31
|
*/
|
|
@@ -59,7 +59,7 @@ function getBlobKey (activity: Activity, options?: BlobsTranscriptStoreOptions):
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Sanitizes a blob key for use with Azure Blob Storage.
|
|
62
|
+
* @summary Sanitizes a blob key for use with Azure Blob Storage.
|
|
63
63
|
*
|
|
64
64
|
* @remarks
|
|
65
65
|
* This function performs the following operations:
|
|
@@ -69,13 +69,6 @@ function getBlobKey (activity: Activity, options?: BlobsTranscriptStoreOptions):
|
|
|
69
69
|
* 4. URL encodes the key to ensure it's safe for use as a blob name
|
|
70
70
|
* 5. Optionally decodes the key if the decodeTranscriptKey option is set
|
|
71
71
|
*
|
|
72
|
-
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
73
|
-
* @param options - Optional configuration options.
|
|
74
|
-
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
75
|
-
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
76
|
-
*
|
|
77
|
-
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
78
|
-
*
|
|
79
72
|
* @example
|
|
80
73
|
* ```typescript
|
|
81
74
|
* // Basic sanitization with encoding
|
|
@@ -90,6 +83,13 @@ function getBlobKey (activity: Activity, options?: BlobsTranscriptStoreOptions):
|
|
|
90
83
|
* const withEmptySegments = sanitizeBlobKey('channel1//conversation2///activity.json');
|
|
91
84
|
* // Returns: 'channel1%2Fconversation2%2Factivity.json'
|
|
92
85
|
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param key - The blob key string to sanitize. Must be non-empty.
|
|
88
|
+
* @param options - Optional configuration options.
|
|
89
|
+
* @param options.decodeTranscriptKey - If true, returns the URL-decoded version of the sanitized key.
|
|
90
|
+
* @returns A sanitized blob key that is safe for use with Azure Blob Storage, truncated to 1024 characters.
|
|
91
|
+
*
|
|
92
|
+
* @throws {Error} When the provided key is null, undefined, or an empty string.
|
|
93
93
|
*/
|
|
94
94
|
export function sanitizeBlobKey (key: string, options?: BlobsTranscriptStoreOptions): string {
|
|
95
95
|
if (!key || key.length === 0) {
|
|
@@ -109,11 +109,12 @@ export function sanitizeBlobKey (key: string, options?: BlobsTranscriptStoreOpti
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* Performs type casting with optional constructor validation.
|
|
112
|
+
* @summary Performs type casting with optional constructor validation.
|
|
113
|
+
* @remarks
|
|
113
114
|
* If a constructor is provided, validates that the value is an instance of that constructor.
|
|
114
115
|
* Otherwise, performs a direct type assertion.
|
|
115
116
|
*
|
|
116
|
-
* @
|
|
117
|
+
* @typeParam T - The target type to cast to.
|
|
117
118
|
* @param value - The value to cast.
|
|
118
119
|
* @param ctor - Optional constructor function to validate the value against.
|
|
119
120
|
* @returns The value cast to type T.
|