@microsoft/agents-hosting-storage-blob 0.2.9-g361635b71c → 0.2.14

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.
@@ -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
  }
@@ -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;AAS9D;;GAEG;AACH,MAAa,YAAY;IAKvB,YACE,gBAAwB,EACxB,aAAqB,EACrB,OAA6B,EAC7B,GAAG,GAAG,EAAE,EACR,UAA6D;QAR9C,iBAAY,GAAG,QAAQ,CAAA;QAUtC,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,KAAK,CAAC;gBAC1E,gBAAgB;gBAChB,aAAa;aACd,CAAC,CAAA;YAEF,IAAI,CAAC,gBAAgB,GAAG,IAAI,8BA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GAAG,yBAAyB,CAAC,CAAA;gBAC1E,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAA;gBACX,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAE,IAAc;QAC1B,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QAEvD,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QAExB,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAA,sCAAe,EAAC,GAAG,CAAC,CAAC,EAAE,IAAA,+BAAiB,EAAC,GAAG,CAAC,CAAC,CAAC,CAC/G,CAAA;IACH,CAAC;CACF;AAlJD,oCAkJC"}
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.2.9-g361635b71c",
4
+ "version": "0.2.14",
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.2.9-g361635b71c"
20
+ "@microsoft/agents-hosting": "0.2.14"
21
21
  },
22
22
  "license": "MIT",
23
23
  "files": [
@@ -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
 
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