@twin.org/blob-storage-connector-memory 0.0.2-next.4 → 0.0.2-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ class MemoryBlobStorageConnector {
|
|
|
14
14
|
/**
|
|
15
15
|
* Runtime name for the class.
|
|
16
16
|
*/
|
|
17
|
-
CLASS_NAME = "MemoryBlobStorageConnector";
|
|
17
|
+
static CLASS_NAME = "MemoryBlobStorageConnector";
|
|
18
18
|
/**
|
|
19
19
|
* The storage for the in-memory items.
|
|
20
20
|
* @internal
|
|
@@ -32,7 +32,7 @@ class MemoryBlobStorageConnector {
|
|
|
32
32
|
* @returns The id of the stored blob in urn format.
|
|
33
33
|
*/
|
|
34
34
|
async set(blob) {
|
|
35
|
-
core.Guards.uint8Array(
|
|
35
|
+
core.Guards.uint8Array(MemoryBlobStorageConnector.CLASS_NAME, "blob", blob);
|
|
36
36
|
const id = core.Converter.bytesToHex(crypto.Sha256.sum256(blob));
|
|
37
37
|
this._store[id] = blob;
|
|
38
38
|
return `blob:${new core.Urn(MemoryBlobStorageConnector.NAMESPACE, id).toString()}`;
|
|
@@ -43,10 +43,10 @@ class MemoryBlobStorageConnector {
|
|
|
43
43
|
* @returns The data for the blob if it can be found or undefined.
|
|
44
44
|
*/
|
|
45
45
|
async get(id) {
|
|
46
|
-
core.Urn.guard(
|
|
46
|
+
core.Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
|
|
47
47
|
const urnParsed = core.Urn.fromValidString(id);
|
|
48
48
|
if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
|
|
49
|
-
throw new core.GeneralError(
|
|
49
|
+
throw new core.GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
|
|
50
50
|
namespace: MemoryBlobStorageConnector.NAMESPACE,
|
|
51
51
|
id
|
|
52
52
|
});
|
|
@@ -59,10 +59,10 @@ class MemoryBlobStorageConnector {
|
|
|
59
59
|
* @returns True if the blob was found.
|
|
60
60
|
*/
|
|
61
61
|
async remove(id) {
|
|
62
|
-
core.Urn.guard(
|
|
62
|
+
core.Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
|
|
63
63
|
const urnParsed = core.Urn.fromValidString(id);
|
|
64
64
|
if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
|
|
65
|
-
throw new core.GeneralError(
|
|
65
|
+
throw new core.GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
|
|
66
66
|
namespace: MemoryBlobStorageConnector.NAMESPACE,
|
|
67
67
|
id
|
|
68
68
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ class MemoryBlobStorageConnector {
|
|
|
12
12
|
/**
|
|
13
13
|
* Runtime name for the class.
|
|
14
14
|
*/
|
|
15
|
-
CLASS_NAME = "MemoryBlobStorageConnector";
|
|
15
|
+
static CLASS_NAME = "MemoryBlobStorageConnector";
|
|
16
16
|
/**
|
|
17
17
|
* The storage for the in-memory items.
|
|
18
18
|
* @internal
|
|
@@ -30,7 +30,7 @@ class MemoryBlobStorageConnector {
|
|
|
30
30
|
* @returns The id of the stored blob in urn format.
|
|
31
31
|
*/
|
|
32
32
|
async set(blob) {
|
|
33
|
-
Guards.uint8Array(
|
|
33
|
+
Guards.uint8Array(MemoryBlobStorageConnector.CLASS_NAME, "blob", blob);
|
|
34
34
|
const id = Converter.bytesToHex(Sha256.sum256(blob));
|
|
35
35
|
this._store[id] = blob;
|
|
36
36
|
return `blob:${new Urn(MemoryBlobStorageConnector.NAMESPACE, id).toString()}`;
|
|
@@ -41,10 +41,10 @@ class MemoryBlobStorageConnector {
|
|
|
41
41
|
* @returns The data for the blob if it can be found or undefined.
|
|
42
42
|
*/
|
|
43
43
|
async get(id) {
|
|
44
|
-
Urn.guard(
|
|
44
|
+
Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
|
|
45
45
|
const urnParsed = Urn.fromValidString(id);
|
|
46
46
|
if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
|
|
47
|
-
throw new GeneralError(
|
|
47
|
+
throw new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
|
|
48
48
|
namespace: MemoryBlobStorageConnector.NAMESPACE,
|
|
49
49
|
id
|
|
50
50
|
});
|
|
@@ -57,10 +57,10 @@ class MemoryBlobStorageConnector {
|
|
|
57
57
|
* @returns True if the blob was found.
|
|
58
58
|
*/
|
|
59
59
|
async remove(id) {
|
|
60
|
-
Urn.guard(
|
|
60
|
+
Urn.guard(MemoryBlobStorageConnector.CLASS_NAME, "id", id);
|
|
61
61
|
const urnParsed = Urn.fromValidString(id);
|
|
62
62
|
if (urnParsed.namespaceMethod() !== MemoryBlobStorageConnector.NAMESPACE) {
|
|
63
|
-
throw new GeneralError(
|
|
63
|
+
throw new GeneralError(MemoryBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
|
|
64
64
|
namespace: MemoryBlobStorageConnector.NAMESPACE,
|
|
65
65
|
id
|
|
66
66
|
});
|
|
@@ -10,7 +10,7 @@ export declare class MemoryBlobStorageConnector implements IBlobStorageConnector
|
|
|
10
10
|
/**
|
|
11
11
|
* Runtime name for the class.
|
|
12
12
|
*/
|
|
13
|
-
readonly CLASS_NAME: string;
|
|
13
|
+
static readonly CLASS_NAME: string;
|
|
14
14
|
/**
|
|
15
15
|
* Create a new instance of MemoryBlobStorageConnector.
|
|
16
16
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @twin.org/blob-storage-connector-memory - 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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
16
|
+
|
|
3
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)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -30,14 +30,10 @@ The namespace for the items.
|
|
|
30
30
|
|
|
31
31
|
### CLASS\_NAME
|
|
32
32
|
|
|
33
|
-
> `readonly` **CLASS\_NAME**: `string`
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
34
|
|
|
35
35
|
Runtime name for the class.
|
|
36
36
|
|
|
37
|
-
#### Implementation of
|
|
38
|
-
|
|
39
|
-
`IBlobStorageConnector.CLASS_NAME`
|
|
40
|
-
|
|
41
37
|
## Methods
|
|
42
38
|
|
|
43
39
|
### set()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-connector-memory",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.5",
|
|
4
4
|
"description": "Blob Storage connector implementation using in-memory storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/blob-storage-models": "0.0.2-next.
|
|
17
|
+
"@twin.org/blob-storage-models": "0.0.2-next.5",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/crypto": "next",
|
|
20
20
|
"@twin.org/nameof": "next"
|
|
@@ -54,5 +54,9 @@
|
|
|
54
54
|
"memory",
|
|
55
55
|
"in-memory",
|
|
56
56
|
"testing"
|
|
57
|
-
]
|
|
57
|
+
],
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "git+https://github.com/twinfoundation/blob-storage/issues"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://twindev.org"
|
|
58
62
|
}
|