@twin.org/blob-storage-connector-memory 0.0.3-next.1 → 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 +1 -1
- package/dist/es/memoryBlobStorageConnector.js +17 -1
- package/dist/es/memoryBlobStorageConnector.js.map +1 -1
- package/dist/types/memoryBlobStorageConnector.d.ts +6 -0
- package/docs/changelog.md +162 -30
- package/docs/examples.md +35 -1
- package/docs/reference/classes/MemoryBlobStorageConnector.md +25 -7
- package/docs/reference/interfaces/IMemoryStorageConnectorConstructorOptions.md +2 -2
- package/locales/en.json +5 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN Blob Storage Connector Memory
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextIdHelper, ContextIdStore } from "@twin.org/context";
|
|
2
|
-
import { Converter, GeneralError, Guards, Urn } from "@twin.org/core";
|
|
2
|
+
import { Converter, GeneralError, Guards, HealthStatus, Urn } from "@twin.org/core";
|
|
3
3
|
import { Sha256 } from "@twin.org/crypto";
|
|
4
4
|
/**
|
|
5
5
|
* Class for performing blob storage operations in-memory.
|
|
@@ -38,6 +38,22 @@ export class MemoryBlobStorageConnector {
|
|
|
38
38
|
className() {
|
|
39
39
|
return MemoryBlobStorageConnector.CLASS_NAME;
|
|
40
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
|
+
}
|
|
41
57
|
/**
|
|
42
58
|
* Set the blob.
|
|
43
59
|
* @param blob The data for the blob.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoryBlobStorageConnector.js","sourceRoot":"","sources":["../../src/memoryBlobStorageConnector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"memoryBlobStorageConnector.js","sourceRoot":"","sources":["../../src/memoryBlobStorageConnector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAgB,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACtC;;OAEG;IACI,MAAM,CAAU,SAAS,GAAW,QAAQ,CAAC;IAEpD;;OAEG;IACI,MAAM,CAAU,UAAU,gCAAgD;IAEjF;;;OAGG;IACc,oBAAoB,CAAY;IAEjD;;;OAGG;IACc,MAAM,CAA+B;IAEtD;;;OAGG;IACH,YAAY,OAAmD;QAC9D,IAAI,CAAC,oBAAoB,GAAG,OAAO,EAAE,mBAAmB,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0BAA0B,CAAC,UAAU,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,MAAM;QAClB,OAAO;YACN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,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,QAAQ;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC","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"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IBlobStorageConnector } from "@twin.org/blob-storage-models";
|
|
2
|
+
import { type IHealth } from "@twin.org/core";
|
|
2
3
|
import type { IMemoryStorageConnectorConstructorOptions } from "./models/IMemoryStorageConnectorConstructorOptions.js";
|
|
3
4
|
/**
|
|
4
5
|
* Class for performing blob storage operations in-memory.
|
|
@@ -22,6 +23,11 @@ export declare class MemoryBlobStorageConnector implements IBlobStorageConnector
|
|
|
22
23
|
* @returns The class name of the component.
|
|
23
24
|
*/
|
|
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[]>;
|
|
25
31
|
/**
|
|
26
32
|
* Set the blob.
|
|
27
33
|
* @param blob The data for the blob.
|
package/docs/changelog.md
CHANGED
|
@@ -1,16 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
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
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
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))
|
|
14
146
|
|
|
15
147
|
|
|
16
148
|
### Dependencies
|
|
@@ -19,12 +151,12 @@
|
|
|
19
151
|
* dependencies
|
|
20
152
|
* @twin.org/blob-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
21
153
|
|
|
22
|
-
## [0.0.2-next.5](https://github.com/
|
|
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)
|
|
23
155
|
|
|
24
156
|
|
|
25
157
|
### Features
|
|
26
158
|
|
|
27
|
-
* add validate-locales ([f20fcec](https://github.com/
|
|
159
|
+
* add validate-locales ([f20fcec](https://github.com/iotaledger/twin-blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
28
160
|
|
|
29
161
|
|
|
30
162
|
### Dependencies
|
|
@@ -33,7 +165,7 @@
|
|
|
33
165
|
* dependencies
|
|
34
166
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
35
167
|
|
|
36
|
-
## [0.0.2-next.4](https://github.com/
|
|
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)
|
|
37
169
|
|
|
38
170
|
|
|
39
171
|
### Miscellaneous Chores
|
|
@@ -47,12 +179,12 @@
|
|
|
47
179
|
* dependencies
|
|
48
180
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
49
181
|
|
|
50
|
-
## [0.0.2-next.3](https://github.com/
|
|
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)
|
|
51
183
|
|
|
52
184
|
|
|
53
185
|
### Features
|
|
54
186
|
|
|
55
|
-
* eslint migration to flat config ([e4239dd](https://github.com/
|
|
187
|
+
* eslint migration to flat config ([e4239dd](https://github.com/iotaledger/twin-blob-storage/commit/e4239dd1c721955cff7f0357255d2bba15319972))
|
|
56
188
|
|
|
57
189
|
|
|
58
190
|
### Dependencies
|
|
@@ -61,12 +193,12 @@
|
|
|
61
193
|
* dependencies
|
|
62
194
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
63
195
|
|
|
64
|
-
## [0.0.2-next.2](https://github.com/
|
|
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)
|
|
65
197
|
|
|
66
198
|
|
|
67
199
|
### Features
|
|
68
200
|
|
|
69
|
-
* update framework core ([ff339fe](https://github.com/
|
|
201
|
+
* update framework core ([ff339fe](https://github.com/iotaledger/twin-blob-storage/commit/ff339fe7e3f09ddff429907834bdf43617e9c05e))
|
|
70
202
|
|
|
71
203
|
|
|
72
204
|
### Dependencies
|
|
@@ -75,13 +207,13 @@
|
|
|
75
207
|
* dependencies
|
|
76
208
|
* @twin.org/blob-storage-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
77
209
|
|
|
78
|
-
## [0.0.2-next.1](https://github.com/
|
|
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)
|
|
79
211
|
|
|
80
212
|
|
|
81
213
|
### Features
|
|
82
214
|
|
|
83
|
-
* update dependencies ([56f0094](https://github.com/
|
|
84
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
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))
|
|
85
217
|
|
|
86
218
|
|
|
87
219
|
### Dependencies
|
|
@@ -95,7 +227,7 @@
|
|
|
95
227
|
|
|
96
228
|
### Features
|
|
97
229
|
|
|
98
|
-
* release to production ([eacfe75](https://github.com/
|
|
230
|
+
* release to production ([eacfe75](https://github.com/iotaledger/twin-blob-storage/commit/eacfe754a0dcd9243d9e13d86422327d0a605164))
|
|
99
231
|
|
|
100
232
|
|
|
101
233
|
### Dependencies
|
|
@@ -104,7 +236,7 @@
|
|
|
104
236
|
* dependencies
|
|
105
237
|
* @twin.org/blob-storage-models bumped from ^0.0.0 to ^0.0.1
|
|
106
238
|
|
|
107
|
-
## [0.0.1-next.37](https://github.com/
|
|
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)
|
|
108
240
|
|
|
109
241
|
|
|
110
242
|
### Miscellaneous Chores
|
|
@@ -118,7 +250,7 @@
|
|
|
118
250
|
* dependencies
|
|
119
251
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
120
252
|
|
|
121
|
-
## [0.0.1-next.36](https://github.com/
|
|
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)
|
|
122
254
|
|
|
123
255
|
|
|
124
256
|
### Miscellaneous Chores
|
|
@@ -132,7 +264,7 @@
|
|
|
132
264
|
* dependencies
|
|
133
265
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
134
266
|
|
|
135
|
-
## [0.0.1-next.35](https://github.com/
|
|
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)
|
|
136
268
|
|
|
137
269
|
|
|
138
270
|
### Miscellaneous Chores
|
|
@@ -146,12 +278,12 @@
|
|
|
146
278
|
* dependencies
|
|
147
279
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
148
280
|
|
|
149
|
-
## [0.0.1-next.34](https://github.com/
|
|
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)
|
|
150
282
|
|
|
151
283
|
|
|
152
284
|
### Features
|
|
153
285
|
|
|
154
|
-
* update dependencies ([56f0094](https://github.com/
|
|
286
|
+
* update dependencies ([56f0094](https://github.com/iotaledger/twin-blob-storage/commit/56f0094b68d8bd22864cd899ac1b61d95540f719))
|
|
155
287
|
|
|
156
288
|
|
|
157
289
|
### Dependencies
|
|
@@ -160,7 +292,7 @@
|
|
|
160
292
|
* dependencies
|
|
161
293
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
162
294
|
|
|
163
|
-
## [0.0.1-next.33](https://github.com/
|
|
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)
|
|
164
296
|
|
|
165
297
|
|
|
166
298
|
### Miscellaneous Chores
|
|
@@ -174,7 +306,7 @@
|
|
|
174
306
|
* dependencies
|
|
175
307
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
176
308
|
|
|
177
|
-
## [0.0.1-next.32](https://github.com/
|
|
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)
|
|
178
310
|
|
|
179
311
|
|
|
180
312
|
### Miscellaneous Chores
|
|
@@ -188,7 +320,7 @@
|
|
|
188
320
|
* dependencies
|
|
189
321
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
190
322
|
|
|
191
|
-
## [0.0.1-next.31](https://github.com/
|
|
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)
|
|
192
324
|
|
|
193
325
|
|
|
194
326
|
### Miscellaneous Chores
|
|
@@ -202,12 +334,12 @@
|
|
|
202
334
|
* dependencies
|
|
203
335
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
204
336
|
|
|
205
|
-
## [0.0.1-next.30](https://github.com/
|
|
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)
|
|
206
338
|
|
|
207
339
|
|
|
208
340
|
### Features
|
|
209
341
|
|
|
210
|
-
* use shared store mechanism ([#12](https://github.com/
|
|
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))
|
|
211
343
|
|
|
212
344
|
|
|
213
345
|
### Dependencies
|
|
@@ -216,7 +348,7 @@
|
|
|
216
348
|
* dependencies
|
|
217
349
|
* @twin.org/blob-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
218
350
|
|
|
219
|
-
## [0.0.1-next.29](https://github.com/
|
|
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)
|
|
220
352
|
|
|
221
353
|
|
|
222
354
|
### Miscellaneous Chores
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,35 @@
|
|
|
1
|
-
#
|
|
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
|
+
```
|
|
@@ -28,7 +28,7 @@ The options for the connector.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### NAMESPACE
|
|
31
|
+
### NAMESPACE {#namespace}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **NAMESPACE**: `string` = `"memory"`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ The namespace for the items.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,25 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
###
|
|
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}
|
|
66
84
|
|
|
67
85
|
> **set**(`blob`): `Promise`\<`string`\>
|
|
68
86
|
|
|
@@ -88,7 +106,7 @@ The id of the stored blob in urn format.
|
|
|
88
106
|
|
|
89
107
|
***
|
|
90
108
|
|
|
91
|
-
### get()
|
|
109
|
+
### get() {#get}
|
|
92
110
|
|
|
93
111
|
> **get**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
94
112
|
|
|
@@ -114,7 +132,7 @@ The data for the blob if it can be found or undefined.
|
|
|
114
132
|
|
|
115
133
|
***
|
|
116
134
|
|
|
117
|
-
### remove()
|
|
135
|
+
### remove() {#remove}
|
|
118
136
|
|
|
119
137
|
> **remove**(`id`): `Promise`\<`boolean`\>
|
|
120
138
|
|
|
@@ -140,7 +158,7 @@ True if the blob was found.
|
|
|
140
158
|
|
|
141
159
|
***
|
|
142
160
|
|
|
143
|
-
### getStore()
|
|
161
|
+
### getStore() {#getstore}
|
|
144
162
|
|
|
145
163
|
> **getStore**(): `object`
|
|
146
164
|
|
|
@@ -4,8 +4,8 @@ Options for the Memory Blob Storage Connector constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### partitionContextIds?
|
|
7
|
+
### partitionContextIds? {#partitioncontextids}
|
|
8
8
|
|
|
9
|
-
> `optional` **partitionContextIds
|
|
9
|
+
> `optional` **partitionContextIds?**: `string`[]
|
|
10
10
|
|
|
11
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.3-next.
|
|
4
|
-
"description": "
|
|
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/
|
|
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,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/blob-storage-models": "0.0.3-next.
|
|
17
|
+
"@twin.org/blob-storage-models": "0.0.3-next.10",
|
|
18
18
|
"@twin.org/context": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/crypto": "next",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"testing"
|
|
56
56
|
],
|
|
57
57
|
"bugs": {
|
|
58
|
-
"url": "git+https://github.com/
|
|
58
|
+
"url": "git+https://github.com/iotaledger/blob-storage/issues"
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://twindev.org"
|
|
61
61
|
}
|