@twin.org/blob-storage-connector-memory 0.0.2-next.5 → 0.0.3-next.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Blob Storage Connector Memory
2
2
 
3
- Blob Storage connector implementation using in-memory storage.
3
+ This package provides an in-memory connector for blob storage workflows where persistence is not required. It is suited to local development, automated testing, and fast feedback loops that benefit from isolated, ephemeral storage.
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,5 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./memoryBlobStorageConnector.js";
4
+ export * from "./models/IMemoryStorageConnectorConstructorOptions.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uDAAuD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./memoryBlobStorageConnector.js\";\nexport * from \"./models/IMemoryStorageConnectorConstructorOptions.js\";\n"]}
@@ -1,10 +1,10 @@
1
- import { Guards, Converter, Urn, GeneralError } from '@twin.org/core';
2
- import { Sha256 } from '@twin.org/crypto';
3
-
1
+ import { ContextIdHelper, ContextIdStore } from "@twin.org/context";
2
+ import { Converter, GeneralError, Guards, HealthStatus, Urn } from "@twin.org/core";
3
+ import { Sha256 } from "@twin.org/crypto";
4
4
  /**
5
5
  * Class for performing blob storage operations in-memory.
6
6
  */
7
- class MemoryBlobStorageConnector {
7
+ export class MemoryBlobStorageConnector {
8
8
  /**
9
9
  * The namespace for the items.
10
10
  */
@@ -13,6 +13,11 @@ class MemoryBlobStorageConnector {
13
13
  * Runtime name for the class.
14
14
  */
15
15
  static CLASS_NAME = "MemoryBlobStorageConnector";
16
+ /**
17
+ * The keys to use from the context ids to create partitions.
18
+ * @internal
19
+ */
20
+ _partitionContextIds;
16
21
  /**
17
22
  * The storage for the in-memory items.
18
23
  * @internal
@@ -20,10 +25,35 @@ class MemoryBlobStorageConnector {
20
25
  _store;
21
26
  /**
22
27
  * Create a new instance of MemoryBlobStorageConnector.
28
+ * @param options The options for the connector.
23
29
  */
24
- constructor() {
30
+ constructor(options) {
31
+ this._partitionContextIds = options?.partitionContextIds;
25
32
  this._store = {};
26
33
  }
34
+ /**
35
+ * Returns the class name of the component.
36
+ * @returns The class name of the component.
37
+ */
38
+ className() {
39
+ return MemoryBlobStorageConnector.CLASS_NAME;
40
+ }
41
+ /**
42
+ * Returns the health status of the component.
43
+ * @returns The health status of the component.
44
+ */
45
+ async health() {
46
+ return [
47
+ {
48
+ source: MemoryBlobStorageConnector.CLASS_NAME,
49
+ status: HealthStatus.Ok,
50
+ description: "healthDescription",
51
+ data: {
52
+ storedItemCount: Object.keys(this._store).length
53
+ }
54
+ }
55
+ ];
56
+ }
27
57
  /**
28
58
  * Set the blob.
29
59
  * @param blob The data for the blob.
@@ -31,8 +61,11 @@ class MemoryBlobStorageConnector {
31
61
  */
32
62
  async set(blob) {
33
63
  Guards.uint8Array(MemoryBlobStorageConnector.CLASS_NAME, "blob", blob);
64
+ const contextIds = await ContextIdStore.getContextIds();
65
+ const partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);
34
66
  const id = Converter.bytesToHex(Sha256.sum256(blob));
35
- this._store[id] = blob;
67
+ const fullKey = `${partitionKey ?? "root"}/${id}`;
68
+ this._store[fullKey] = blob;
36
69
  return `blob:${new Urn(MemoryBlobStorageConnector.NAMESPACE, id).toString()}`;
37
70
  }
38
71
  /**
@@ -42,6 +75,8 @@ class MemoryBlobStorageConnector {
42
75
  */
43
76
  async get(id) {
44
77
  Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
78
+ const contextIds = await ContextIdStore.getContextIds();
79
+ const partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);
45
80
  const urnParsed = Urn.fromValidString(id);
46
81
  if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
47
82
  throw new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
@@ -49,7 +84,9 @@ class MemoryBlobStorageConnector {
49
84
  id
50
85
  });
51
86
  }
52
- return this._store[urnParsed.namespaceSpecific(1)];
87
+ const namespaceId = urnParsed.namespaceSpecific(1);
88
+ const fullKey = `${partitionKey ?? "root"}/${namespaceId}`;
89
+ return this._store[fullKey];
53
90
  }
54
91
  /**
55
92
  * Remove the blob.
@@ -58,6 +95,8 @@ class MemoryBlobStorageConnector {
58
95
  */
59
96
  async remove(id) {
60
97
  Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
98
+ const contextIds = await ContextIdStore.getContextIds();
99
+ const partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);
61
100
  const urnParsed = Urn.fromValidString(id);
62
101
  if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
63
102
  throw new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
@@ -66,8 +105,9 @@ class MemoryBlobStorageConnector {
66
105
  });
67
106
  }
68
107
  const namespaceId = urnParsed.namespaceSpecific(1);
69
- if (this._store[namespaceId]) {
70
- delete this._store[namespaceId];
108
+ const fullKey = `${partitionKey ?? "root"}/${namespaceId}`;
109
+ if (this._store[fullKey]) {
110
+ delete this._store[fullKey];
71
111
  return true;
72
112
  }
73
113
  return false;
@@ -80,5 +120,4 @@ class MemoryBlobStorageConnector {
80
120
  return this._store;
81
121
  }
82
122
  }
83
-
84
- export { MemoryBlobStorageConnector };
123
+ //# sourceMappingURL=memoryBlobStorageConnector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoryBlobStorageConnector.js","sourceRoot":"","sources":["../../src/memoryBlobStorageConnector.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBlobStorageConnector } from \"@twin.org/blob-storage-models\";\nimport { ContextIdHelper, ContextIdStore } from \"@twin.org/context\";\nimport { Converter, GeneralError, Guards, HealthStatus, Urn, type IHealth } from \"@twin.org/core\";\nimport { Sha256 } from \"@twin.org/crypto\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IMemoryStorageConnectorConstructorOptions } from \"./models/IMemoryStorageConnectorConstructorOptions.js\";\n\n/**\n * Class for performing blob storage operations in-memory.\n */\nexport class MemoryBlobStorageConnector implements IBlobStorageConnector {\n\t/**\n\t * The namespace for the items.\n\t */\n\tpublic static readonly NAMESPACE: string = \"memory\";\n\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<MemoryBlobStorageConnector>();\n\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t * @internal\n\t */\n\tprivate readonly _partitionContextIds?: string[];\n\n\t/**\n\t * The storage for the in-memory items.\n\t * @internal\n\t */\n\tprivate readonly _store: { [id: string]: Uint8Array };\n\n\t/**\n\t * Create a new instance of MemoryBlobStorageConnector.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options?: IMemoryStorageConnectorConstructorOptions) {\n\t\tthis._partitionContextIds = options?.partitionContextIds;\n\t\tthis._store = {};\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn MemoryBlobStorageConnector.CLASS_NAME;\n\t}\n\n\t/**\n\t * Returns the health status of the component.\n\t * @returns The health status of the component.\n\t */\n\tpublic async health(): Promise<IHealth[]> {\n\t\treturn [\n\t\t\t{\n\t\t\t\tsource: MemoryBlobStorageConnector.CLASS_NAME,\n\t\t\t\tstatus: HealthStatus.Ok,\n\t\t\t\tdescription: \"healthDescription\",\n\t\t\t\tdata: {\n\t\t\t\t\tstoredItemCount: Object.keys(this._store).length\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\t}\n\n\t/**\n\t * Set the blob.\n\t * @param blob The data for the blob.\n\t * @returns The id of the stored blob in urn format.\n\t */\n\tpublic async set(blob: Uint8Array): Promise<string> {\n\t\tGuards.uint8Array(MemoryBlobStorageConnector.CLASS_NAME, nameof(blob), blob);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst id = Converter.bytesToHex(Sha256.sum256(blob));\n\n\t\tconst fullKey = `${partitionKey ?? \"root\"}/${id}`;\n\t\tthis._store[fullKey] = blob;\n\n\t\treturn `blob:${new Urn(MemoryBlobStorageConnector.NAMESPACE, id).toString()}`;\n\t}\n\n\t/**\n\t * Get the blob.\n\t * @param id The id of the blob to get in urn format.\n\t * @returns The data for the blob if it can be found or undefined.\n\t */\n\tpublic async get(id: string): Promise<Uint8Array | undefined> {\n\t\tUrn.guard(MemoryBlobStorageConnector.CLASS_NAME, nameof(id), id);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {\n\t\t\tthrow new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: MemoryBlobStorageConnector.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\tconst namespaceId = urnParsed.namespaceSpecific(1);\n\t\tconst fullKey = `${partitionKey ?? \"root\"}/${namespaceId}`;\n\t\treturn this._store[fullKey];\n\t}\n\n\t/**\n\t * Remove the blob.\n\t * @param id The id of the blob to remove in urn format.\n\t * @returns True if the blob was found.\n\t */\n\tpublic async remove(id: string): Promise<boolean> {\n\t\tUrn.guard(MemoryBlobStorageConnector.CLASS_NAME, nameof(id), id);\n\n\t\tconst contextIds = await ContextIdStore.getContextIds();\n\t\tconst partitionKey = ContextIdHelper.combinedContextKey(contextIds, this._partitionContextIds);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\n\t\tif (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {\n\t\t\tthrow new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: MemoryBlobStorageConnector.NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\tconst namespaceId = urnParsed.namespaceSpecific(1);\n\t\tconst fullKey = `${partitionKey ?? \"root\"}/${namespaceId}`;\n\t\tif (this._store[fullKey]) {\n\t\t\tdelete this._store[fullKey];\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Get the memory store.\n\t * @returns The store.\n\t */\n\tpublic getStore(): { [id: string]: Uint8Array } {\n\t\treturn this._store;\n\t}\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IMemoryStorageConnectorConstructorOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMemoryStorageConnectorConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IMemoryStorageConnectorConstructorOptions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Options for the Memory Blob Storage Connector constructor.\n */\nexport interface IMemoryStorageConnectorConstructorOptions {\n\t/**\n\t * The keys to use from the context ids to create partitions.\n\t */\n\tpartitionContextIds?: string[];\n}\n"]}
@@ -1 +1,2 @@
1
- export * from "./memoryBlobStorageConnector";
1
+ export * from "./memoryBlobStorageConnector.js";
2
+ export * from "./models/IMemoryStorageConnectorConstructorOptions.js";
@@ -1,4 +1,6 @@
1
1
  import type { IBlobStorageConnector } from "@twin.org/blob-storage-models";
2
+ import { type IHealth } from "@twin.org/core";
3
+ import type { IMemoryStorageConnectorConstructorOptions } from "./models/IMemoryStorageConnectorConstructorOptions.js";
2
4
  /**
3
5
  * Class for performing blob storage operations in-memory.
4
6
  */
@@ -13,8 +15,19 @@ export declare class MemoryBlobStorageConnector implements IBlobStorageConnector
13
15
  static readonly CLASS_NAME: string;
14
16
  /**
15
17
  * Create a new instance of MemoryBlobStorageConnector.
18
+ * @param options The options for the connector.
16
19
  */
17
- constructor();
20
+ constructor(options?: IMemoryStorageConnectorConstructorOptions);
21
+ /**
22
+ * Returns the class name of the component.
23
+ * @returns The class name of the component.
24
+ */
25
+ className(): string;
26
+ /**
27
+ * Returns the health status of the component.
28
+ * @returns The health status of the component.
29
+ */
30
+ health(): Promise<IHealth[]>;
18
31
  /**
19
32
  * Set the blob.
20
33
  * @param blob The data for the blob.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Options for the Memory Blob Storage Connector constructor.
3
+ */
4
+ export interface IMemoryStorageConnectorConstructorOptions {
5
+ /**
6
+ * The keys to use from the context ids to create partitions.
7
+ */
8
+ partitionContextIds?: string[];
9
+ }
package/docs/changelog.md CHANGED
@@ -1,11 +1,162 @@
1
- # @twin.org/blob-storage-connector-memory - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.2-next.5](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.4...blob-storage-connector-memory-v0.0.2-next.5) (2025-10-09)
3
+ ## [0.0.3-next.10](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.9...blob-storage-connector-memory-v0.0.3-next.10) (2026-05-07)
4
4
 
5
5
 
6
6
  ### Features
7
7
 
8
- * add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
8
+ * additional information in health ([1ef83be](https://github.com/iotaledger/twin-blob-storage/commit/1ef83bef81148489b7950d5131a2af5121910e99))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
16
+
17
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.8...blob-storage-connector-memory-v0.0.3-next.9) (2026-05-07)
18
+
19
+
20
+ ### Features
21
+
22
+ * add context id features ([#30](https://github.com/iotaledger/twin-blob-storage/issues/30)) ([fbf1c92](https://github.com/iotaledger/twin-blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
23
+ * add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
24
+ * eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
25
+ * health checks ([#44](https://github.com/iotaledger/twin-blob-storage/issues/44)) ([4a4041c](https://github.com/iotaledger/twin-blob-storage/commit/4a4041c19b68c40ed1aba6d1cdb4318ac4208b7d))
26
+ * update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
27
+ * update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
28
+ * use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
29
+
30
+
31
+ ### Dependencies
32
+
33
+ * The following workspace dependencies were updated
34
+ * dependencies
35
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
36
+
37
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.7...blob-storage-connector-memory-v0.0.3-next.8) (2026-05-07)
38
+
39
+
40
+ ### Features
41
+
42
+ * health checks ([#44](https://github.com/iotaledger/twin-blob-storage/issues/44)) ([4a4041c](https://github.com/iotaledger/twin-blob-storage/commit/4a4041c19b68c40ed1aba6d1cdb4318ac4208b7d))
43
+
44
+
45
+ ### Dependencies
46
+
47
+ * The following workspace dependencies were updated
48
+ * dependencies
49
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
50
+
51
+ ## [0.0.3-next.7](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.6...blob-storage-connector-memory-v0.0.3-next.7) (2026-02-25)
52
+
53
+
54
+ ### Miscellaneous Chores
55
+
56
+ * **blob-storage-connector-memory:** Synchronize repo versions
57
+
58
+
59
+ ### Dependencies
60
+
61
+ * The following workspace dependencies were updated
62
+ * dependencies
63
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
64
+
65
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.5...blob-storage-connector-memory-v0.0.3-next.6) (2026-02-09)
66
+
67
+
68
+ ### Miscellaneous Chores
69
+
70
+ * **blob-storage-connector-memory:** Synchronize repo versions
71
+
72
+
73
+ ### Dependencies
74
+
75
+ * The following workspace dependencies were updated
76
+ * dependencies
77
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
78
+
79
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.4...blob-storage-connector-memory-v0.0.3-next.5) (2026-01-26)
80
+
81
+
82
+ ### Miscellaneous Chores
83
+
84
+ * **blob-storage-connector-memory:** Synchronize repo versions
85
+
86
+
87
+ ### Dependencies
88
+
89
+ * The following workspace dependencies were updated
90
+ * dependencies
91
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
92
+
93
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.3...blob-storage-connector-memory-v0.0.3-next.4) (2026-01-23)
94
+
95
+
96
+ ### Miscellaneous Chores
97
+
98
+ * **blob-storage-connector-memory:** Synchronize repo versions
99
+
100
+
101
+ ### Dependencies
102
+
103
+ * The following workspace dependencies were updated
104
+ * dependencies
105
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
106
+
107
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.2...blob-storage-connector-memory-v0.0.3-next.3) (2026-01-21)
108
+
109
+
110
+ ### Miscellaneous Chores
111
+
112
+ * **blob-storage-connector-memory:** Synchronize repo versions
113
+
114
+
115
+ ### Dependencies
116
+
117
+ * The following workspace dependencies were updated
118
+ * dependencies
119
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
120
+
121
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.1...blob-storage-connector-memory-v0.0.3-next.2) (2026-01-14)
122
+
123
+
124
+ ### Miscellaneous Chores
125
+
126
+ * **blob-storage-connector-memory:** Synchronize repo versions
127
+
128
+
129
+ ### Dependencies
130
+
131
+ * The following workspace dependencies were updated
132
+ * dependencies
133
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.1 to 0.0.3-next.2
134
+
135
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.3-next.0...blob-storage-connector-memory-v0.0.3-next.1) (2025-11-11)
136
+
137
+
138
+ ### Features
139
+
140
+ * add context id features ([#30](https://github.com/iotaledger/twin-blob-storage/issues/30)) ([fbf1c92](https://github.com/iotaledger/twin-blob-storage/commit/fbf1c9276424c841ef5ef3f4de8469ab3fba7e9c))
141
+ * add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
142
+ * eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
143
+ * update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
144
+ * update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
145
+ * use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
146
+
147
+
148
+ ### Dependencies
149
+
150
+ * The following workspace dependencies were updated
151
+ * dependencies
152
+ * @twin.org/blob-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
153
+
154
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.4...blob-storage-connector-memory-v0.0.2-next.5) (2025-10-09)
155
+
156
+
157
+ ### Features
158
+
159
+ * add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
9
160
 
10
161
 
11
162
  ### Dependencies
@@ -14,7 +165,7 @@
14
165
  * dependencies
15
166
  * @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
16
167
 
17
- ## [0.0.2-next.4](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.3...blob-storage-connector-memory-v0.0.2-next.4) (2025-10-02)
168
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.3...blob-storage-connector-memory-v0.0.2-next.4) (2025-10-02)
18
169
 
19
170
 
20
171
  ### Miscellaneous Chores
@@ -28,12 +179,12 @@
28
179
  * dependencies
29
180
  * @twin.org/blob-storage-models bumped from 0.0.2-next.3 to 0.0.2-next.4
30
181
 
31
- ## [0.0.2-next.3](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.2...blob-storage-connector-memory-v0.0.2-next.3) (2025-08-29)
182
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.2...blob-storage-connector-memory-v0.0.2-next.3) (2025-08-29)
32
183
 
33
184
 
34
185
  ### Features
35
186
 
36
- * eslint migration to flat config ([e4239dd](https://github.com/twinfoundation/blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
187
+ * eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
37
188
 
38
189
 
39
190
  ### Dependencies
@@ -42,12 +193,12 @@
42
193
  * dependencies
43
194
  * @twin.org/blob-storage-models bumped from 0.0.2-next.2 to 0.0.2-next.3
44
195
 
45
- ## [0.0.2-next.2](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.1...blob-storage-connector-memory-v0.0.2-next.2) (2025-08-20)
196
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.1...blob-storage-connector-memory-v0.0.2-next.2) (2025-08-20)
46
197
 
47
198
 
48
199
  ### Features
49
200
 
50
- * update framework core ([ff339fe](https://github.com/twinfoundation/blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
201
+ * update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
51
202
 
52
203
 
53
204
  ### Dependencies
@@ -56,13 +207,13 @@
56
207
  * dependencies
57
208
  * @twin.org/blob-storage-models bumped from 0.0.2-next.1 to 0.0.2-next.2
58
209
 
59
- ## [0.0.2-next.1](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.0...blob-storage-connector-memory-v0.0.2-next.1) (2025-07-24)
210
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.2-next.0...blob-storage-connector-memory-v0.0.2-next.1) (2025-07-24)
60
211
 
61
212
 
62
213
  ### Features
63
214
 
64
- * update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
65
- * use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
215
+ * update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
216
+ * use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
66
217
 
67
218
 
68
219
  ### Dependencies
@@ -76,7 +227,7 @@
76
227
 
77
228
  ### Features
78
229
 
79
- * release to production ([eacfe75](https://github.com/twinfoundation/blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
230
+ * release to production ([eacfe75](https://github.com/iotaledger/twin-blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
80
231
 
81
232
 
82
233
  ### Dependencies
@@ -85,7 +236,7 @@
85
236
  * dependencies
86
237
  * @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
87
238
 
88
- ## [0.0.1-next.37](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.36...blob-storage-connector-memory-v0.0.1-next.37) (2025-06-20)
239
+ ## [0.0.1-next.37](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.36...blob-storage-connector-memory-v0.0.1-next.37) (2025-06-20)
89
240
 
90
241
 
91
242
  ### Miscellaneous Chores
@@ -99,7 +250,7 @@
99
250
  * dependencies
100
251
  * @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
101
252
 
102
- ## [0.0.1-next.36](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.35...blob-storage-connector-memory-v0.0.1-next.36) (2025-06-19)
253
+ ## [0.0.1-next.36](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.35...blob-storage-connector-memory-v0.0.1-next.36) (2025-06-19)
103
254
 
104
255
 
105
256
  ### Miscellaneous Chores
@@ -113,7 +264,7 @@
113
264
  * dependencies
114
265
  * @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
115
266
 
116
- ## [0.0.1-next.35](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.34...blob-storage-connector-memory-v0.0.1-next.35) (2025-06-17)
267
+ ## [0.0.1-next.35](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.34...blob-storage-connector-memory-v0.0.1-next.35) (2025-06-17)
117
268
 
118
269
 
119
270
  ### Miscellaneous Chores
@@ -127,12 +278,12 @@
127
278
  * dependencies
128
279
  * @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
129
280
 
130
- ## [0.0.1-next.34](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.33...blob-storage-connector-memory-v0.0.1-next.34) (2025-06-12)
281
+ ## [0.0.1-next.34](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.33...blob-storage-connector-memory-v0.0.1-next.34) (2025-06-12)
131
282
 
132
283
 
133
284
  ### Features
134
285
 
135
- * update dependencies ([56f0094](https://github.com/twinfoundation/blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
286
+ * update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
136
287
 
137
288
 
138
289
  ### Dependencies
@@ -141,7 +292,7 @@
141
292
  * dependencies
142
293
  * @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
143
294
 
144
- ## [0.0.1-next.33](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.32...blob-storage-connector-memory-v0.0.1-next.33) (2025-06-03)
295
+ ## [0.0.1-next.33](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.32...blob-storage-connector-memory-v0.0.1-next.33) (2025-06-03)
145
296
 
146
297
 
147
298
  ### Miscellaneous Chores
@@ -155,7 +306,7 @@
155
306
  * dependencies
156
307
  * @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
157
308
 
158
- ## [0.0.1-next.32](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.31...blob-storage-connector-memory-v0.0.1-next.32) (2025-05-28)
309
+ ## [0.0.1-next.32](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.31...blob-storage-connector-memory-v0.0.1-next.32) (2025-05-28)
159
310
 
160
311
 
161
312
  ### Miscellaneous Chores
@@ -169,7 +320,7 @@
169
320
  * dependencies
170
321
  * @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
171
322
 
172
- ## [0.0.1-next.31](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.30...blob-storage-connector-memory-v0.0.1-next.31) (2025-05-08)
323
+ ## [0.0.1-next.31](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.30...blob-storage-connector-memory-v0.0.1-next.31) (2025-05-08)
173
324
 
174
325
 
175
326
  ### Miscellaneous Chores
@@ -183,12 +334,12 @@
183
334
  * dependencies
184
335
  * @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
185
336
 
186
- ## [0.0.1-next.30](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.29...blob-storage-connector-memory-v0.0.1-next.30) (2025-04-17)
337
+ ## [0.0.1-next.30](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.29...blob-storage-connector-memory-v0.0.1-next.30) (2025-04-17)
187
338
 
188
339
 
189
340
  ### Features
190
341
 
191
- * use shared store mechanism ([#12](https://github.com/twinfoundation/blob-storage/issues/12)) ([cae8110](https://github.com/twinfoundation/blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
342
+ * use shared store mechanism ([#12](https://github.com/iotaledger/twin-blob-storage/issues/12)) ([cae8110](https://github.com/iotaledger/twin-blob-storage/commit/cae8110681847a1ac4fcac968b8196694e49c320))
192
343
 
193
344
 
194
345
  ### Dependencies
@@ -197,7 +348,7 @@
197
348
  * dependencies
198
349
  * @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
199
350
 
200
- ## [0.0.1-next.29](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.28...blob-storage-connector-memory-v0.0.1-next.29) (2025-03-28)
351
+ ## [0.0.1-next.29](https://github.com/iotaledger/twin-blob-storage/compare/blob-storage-connector-memory-v0.0.1-next.28...blob-storage-connector-memory-v0.0.1-next.29) (2025-03-28)
201
352
 
202
353
 
203
354
  ### Miscellaneous Chores
package/docs/examples.md CHANGED
@@ -1 +1,35 @@
1
- # @twin.org/blob-storage-connector-memory - Examples
1
+ # Memory Connector Examples
2
+
3
+ Use these snippets to test fast in-memory blob workflows where you want deterministic behaviour without external dependencies.
4
+
5
+ ## MemoryBlobStorageConnector
6
+
7
+ ```typescript
8
+ import { MemoryBlobStorageConnector } from '@twin.org/blob-storage-connector-memory';
9
+
10
+ const connector = new MemoryBlobStorageConnector({
11
+ partitionContextIds: ['tenant', 'environment']
12
+ });
13
+
14
+ console.log(connector.className()); // MemoryBlobStorageConnector
15
+ ```
16
+
17
+ ```typescript
18
+ import { Converter } from '@twin.org/core';
19
+ import { MemoryBlobStorageConnector } from '@twin.org/blob-storage-connector-memory';
20
+
21
+ const connector = new MemoryBlobStorageConnector();
22
+
23
+ const blobData = Converter.utf8ToBytes('Memory payload');
24
+ const blobId = await connector.set(blobData);
25
+ console.log(blobId); // blob:urn:blob:memory:...
26
+
27
+ const storedBlob = await connector.get(blobId);
28
+ console.log(storedBlob?.length); // 14
29
+
30
+ const currentStore = connector.getStore();
31
+ console.log(Object.keys(currentStore).length); // 1
32
+
33
+ const removed = await connector.remove(blobId);
34
+ console.log(removed); // true
35
+ ```
@@ -10,17 +10,25 @@ Class for performing blob storage operations in-memory.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new MemoryBlobStorageConnector**(): `MemoryBlobStorageConnector`
13
+ > **new MemoryBlobStorageConnector**(`options?`): `MemoryBlobStorageConnector`
14
14
 
15
15
  Create a new instance of MemoryBlobStorageConnector.
16
16
 
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`IMemoryStorageConnectorConstructorOptions`](../interfaces/IMemoryStorageConnectorConstructorOptions.md)
22
+
23
+ The options for the connector.
24
+
17
25
  #### Returns
18
26
 
19
27
  `MemoryBlobStorageConnector`
20
28
 
21
29
  ## Properties
22
30
 
23
- ### NAMESPACE
31
+ ### NAMESPACE {#namespace}
24
32
 
25
33
  > `readonly` `static` **NAMESPACE**: `string` = `"memory"`
26
34
 
@@ -28,7 +36,7 @@ The namespace for the items.
28
36
 
29
37
  ***
30
38
 
31
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
32
40
 
33
41
  > `readonly` `static` **CLASS\_NAME**: `string`
34
42
 
@@ -36,7 +44,43 @@ Runtime name for the class.
36
44
 
37
45
  ## Methods
38
46
 
39
- ### set()
47
+ ### className() {#classname}
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IBlobStorageConnector.className`
62
+
63
+ ***
64
+
65
+ ### health() {#health}
66
+
67
+ > **health**(): `Promise`\<`IHealth`[]\>
68
+
69
+ Returns the health status of the component.
70
+
71
+ #### Returns
72
+
73
+ `Promise`\<`IHealth`[]\>
74
+
75
+ The health status of the component.
76
+
77
+ #### Implementation of
78
+
79
+ `IBlobStorageConnector.health`
80
+
81
+ ***
82
+
83
+ ### set() {#set}
40
84
 
41
85
  > **set**(`blob`): `Promise`\<`string`\>
42
86
 
@@ -62,9 +106,9 @@ The id of the stored blob in urn format.
62
106
 
63
107
  ***
64
108
 
65
- ### get()
109
+ ### get() {#get}
66
110
 
67
- > **get**(`id`): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
111
+ > **get**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
68
112
 
69
113
  Get the blob.
70
114
 
@@ -78,7 +122,7 @@ The id of the blob to get in urn format.
78
122
 
79
123
  #### Returns
80
124
 
81
- `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
125
+ `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
82
126
 
83
127
  The data for the blob if it can be found or undefined.
84
128
 
@@ -88,7 +132,7 @@ The data for the blob if it can be found or undefined.
88
132
 
89
133
  ***
90
134
 
91
- ### remove()
135
+ ### remove() {#remove}
92
136
 
93
137
  > **remove**(`id`): `Promise`\<`boolean`\>
94
138
 
@@ -114,7 +158,7 @@ True if the blob was found.
114
158
 
115
159
  ***
116
160
 
117
- ### getStore()
161
+ ### getStore() {#getstore}
118
162
 
119
163
  > **getStore**(): `object`
120
164
 
@@ -3,3 +3,7 @@
3
3
  ## Classes
4
4
 
5
5
  - [MemoryBlobStorageConnector](classes/MemoryBlobStorageConnector.md)
6
+
7
+ ## Interfaces
8
+
9
+ - [IMemoryStorageConnectorConstructorOptions](interfaces/IMemoryStorageConnectorConstructorOptions.md)
@@ -0,0 +1,11 @@
1
+ # Interface: IMemoryStorageConnectorConstructorOptions
2
+
3
+ Options for the Memory Blob Storage Connector constructor.
4
+
5
+ ## Properties
6
+
7
+ ### partitionContextIds? {#partitioncontextids}
8
+
9
+ > `optional` **partitionContextIds?**: `string`[]
10
+
11
+ The keys to use from the context ids to create partitions.
package/locales/en.json CHANGED
@@ -1,4 +1,9 @@
1
1
  {
2
+ "health": {
3
+ "memoryBlobStorageConnector": {
4
+ "healthDescription": "Memory blob storage connector is healthy, storing \"{storedItemCount}\" items"
5
+ }
6
+ },
2
7
  "error": {
3
8
  "memoryBlobStorageConnector": {
4
9
  "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the blob storage \"{namespace}\""
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-connector-memory",
3
- "version": "0.0.2-next.5",
4
- "description": "Blob Storage connector implementation using in-memory storage",
3
+ "version": "0.0.3-next.10",
4
+ "description": "Provides an in-memory connector for fast local testing and ephemeral blob workflows.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/blob-storage.git",
7
+ "url": "git+https://github.com/iotaledger/blob-storage.git",
8
8
  "directory": "packages/blob-storage-connector-memory"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -14,25 +14,24 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/blob-storage-models": "0.0.2-next.5",
17
+ "@twin.org/blob-storage-models": "0.0.3-next.10",
18
+ "@twin.org/context": "next",
18
19
  "@twin.org/core": "next",
19
20
  "@twin.org/crypto": "next",
20
21
  "@twin.org/nameof": "next"
21
22
  },
22
- "main": "./dist/cjs/index.cjs",
23
- "module": "./dist/esm/index.mjs",
23
+ "main": "./dist/es/index.js",
24
24
  "types": "./dist/types/index.d.ts",
25
25
  "exports": {
26
26
  ".": {
27
27
  "types": "./dist/types/index.d.ts",
28
- "require": "./dist/cjs/index.cjs",
29
- "import": "./dist/esm/index.mjs"
28
+ "import": "./dist/es/index.js",
29
+ "default": "./dist/es/index.js"
30
30
  },
31
31
  "./locales/*.json": "./locales/*.json"
32
32
  },
33
33
  "files": [
34
- "dist/cjs",
35
- "dist/esm",
34
+ "dist/es",
36
35
  "dist/types",
37
36
  "locales",
38
37
  "docs"
@@ -56,7 +55,7 @@
56
55
  "testing"
57
56
  ],
58
57
  "bugs": {
59
- "url": "git+https://github.com/twinfoundation/blob-storage/issues"
58
+ "url": "git+https://github.com/iotaledger/blob-storage/issues"
60
59
  },
61
60
  "homepage": "https://twindev.org"
62
61
  }
@@ -1,86 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@twin.org/core');
4
- var crypto = require('@twin.org/crypto');
5
-
6
- /**
7
- * Class for performing blob storage operations in-memory.
8
- */
9
- class MemoryBlobStorageConnector {
10
- /**
11
- * The namespace for the items.
12
- */
13
- static NAMESPACE = "memory";
14
- /**
15
- * Runtime name for the class.
16
- */
17
- static CLASS_NAME = "MemoryBlobStorageConnector";
18
- /**
19
- * The storage for the in-memory items.
20
- * @internal
21
- */
22
- _store;
23
- /**
24
- * Create a new instance of MemoryBlobStorageConnector.
25
- */
26
- constructor() {
27
- this._store = {};
28
- }
29
- /**
30
- * Set the blob.
31
- * @param blob The data for the blob.
32
- * @returns The id of the stored blob in urn format.
33
- */
34
- async set(blob) {
35
- core.Guards.uint8Array(MemoryBlobStorageConnector.CLASS_NAME, "blob", blob);
36
- const id = core.Converter.bytesToHex(crypto.Sha256.sum256(blob));
37
- this._store[id] = blob;
38
- return `blob:${new core.Urn(MemoryBlobStorageConnector.NAMESPACE, id).toString()}`;
39
- }
40
- /**
41
- * Get the blob.
42
- * @param id The id of the blob to get in urn format.
43
- * @returns The data for the blob if it can be found or undefined.
44
- */
45
- async get(id) {
46
- core.Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
47
- const urnParsed = core.Urn.fromValidString(id);
48
- if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
49
- throw new core.GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
50
- namespace: MemoryBlobStorageConnector.NAMESPACE,
51
- id
52
- });
53
- }
54
- return this._store[urnParsed.namespaceSpecific(1)];
55
- }
56
- /**
57
- * Remove the blob.
58
- * @param id The id of the blob to remove in urn format.
59
- * @returns True if the blob was found.
60
- */
61
- async remove(id) {
62
- core.Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
63
- const urnParsed = core.Urn.fromValidString(id);
64
- if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
65
- throw new core.GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
66
- namespace: MemoryBlobStorageConnector.NAMESPACE,
67
- id
68
- });
69
- }
70
- const namespaceId = urnParsed.namespaceSpecific(1);
71
- if (this._store[namespaceId]) {
72
- delete this._store[namespaceId];
73
- return true;
74
- }
75
- return false;
76
- }
77
- /**
78
- * Get the memory store.
79
- * @returns The store.
80
- */
81
- getStore() {
82
- return this._store;
83
- }
84
- }
85
-
86
- exports.MemoryBlobStorageConnector = MemoryBlobStorageConnector;