@twin.org/blob-storage-connector-ipfs 0.0.1-next.4 → 0.0.1-next.6
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 +12 -6
- package/dist/esm/index.mjs +12 -6
- package/docs/changelog.md +1 -1
- package/locales/en.json +3 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -58,9 +58,8 @@ class IpfsBlobStorageConnector {
|
|
|
58
58
|
const result = (await response.json());
|
|
59
59
|
return `blob:${new core.Urn(IpfsBlobStorageConnector.NAMESPACE, result.Hash).toString()}`;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
61
|
+
const error = await response.json();
|
|
62
|
+
throw new core.GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
64
63
|
}
|
|
65
64
|
catch (err) {
|
|
66
65
|
throw new core.GeneralError(this.CLASS_NAME, "setBlobFailed", undefined, err);
|
|
@@ -93,8 +92,12 @@ class IpfsBlobStorageConnector {
|
|
|
93
92
|
const result = await response.arrayBuffer();
|
|
94
93
|
return new Uint8Array(result);
|
|
95
94
|
}
|
|
95
|
+
const error = await response.json();
|
|
96
|
+
throw new core.GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
throw new core.GeneralError(this.CLASS_NAME, "getBlobFailed", undefined, err);
|
|
96
100
|
}
|
|
97
|
-
catch { }
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
100
103
|
* Remove the blob.
|
|
@@ -122,9 +125,12 @@ class IpfsBlobStorageConnector {
|
|
|
122
125
|
if (response.ok) {
|
|
123
126
|
return true;
|
|
124
127
|
}
|
|
128
|
+
const error = await response.json();
|
|
129
|
+
throw new core.GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
throw new core.GeneralError(this.CLASS_NAME, "removeBlobFailed", undefined, err);
|
|
125
133
|
}
|
|
126
|
-
catch { }
|
|
127
|
-
return false;
|
|
128
134
|
}
|
|
129
135
|
/**
|
|
130
136
|
* Add the security to the request.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -56,9 +56,8 @@ class IpfsBlobStorageConnector {
|
|
|
56
56
|
const result = (await response.json());
|
|
57
57
|
return `blob:${new Urn(IpfsBlobStorageConnector.NAMESPACE, result.Hash).toString()}`;
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
59
|
+
const error = await response.json();
|
|
60
|
+
throw new GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
62
61
|
}
|
|
63
62
|
catch (err) {
|
|
64
63
|
throw new GeneralError(this.CLASS_NAME, "setBlobFailed", undefined, err);
|
|
@@ -91,8 +90,12 @@ class IpfsBlobStorageConnector {
|
|
|
91
90
|
const result = await response.arrayBuffer();
|
|
92
91
|
return new Uint8Array(result);
|
|
93
92
|
}
|
|
93
|
+
const error = await response.json();
|
|
94
|
+
throw new GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
throw new GeneralError(this.CLASS_NAME, "getBlobFailed", undefined, err);
|
|
94
98
|
}
|
|
95
|
-
catch { }
|
|
96
99
|
}
|
|
97
100
|
/**
|
|
98
101
|
* Remove the blob.
|
|
@@ -120,9 +123,12 @@ class IpfsBlobStorageConnector {
|
|
|
120
123
|
if (response.ok) {
|
|
121
124
|
return true;
|
|
122
125
|
}
|
|
126
|
+
const error = await response.json();
|
|
127
|
+
throw new GeneralError(this.CLASS_NAME, "fetchFail", error);
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
throw new GeneralError(this.CLASS_NAME, "removeBlobFailed", undefined, err);
|
|
123
131
|
}
|
|
124
|
-
catch { }
|
|
125
|
-
return false;
|
|
126
132
|
}
|
|
127
133
|
/**
|
|
128
134
|
* Add the security to the request.
|
package/docs/changelog.md
CHANGED
package/locales/en.json
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
"ipfsBlobStorageConnector": {
|
|
4
4
|
"namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the blob storage \"{namespace}\"",
|
|
5
5
|
"fetchFail": "Failure during IPFS fetch \"{message}\"",
|
|
6
|
-
"setBlobFailed": "Failed to store blob in IPFS"
|
|
6
|
+
"setBlobFailed": "Failed to store blob in IPFS",
|
|
7
|
+
"getBlobFailed": "Failed to get blob from IPFS",
|
|
8
|
+
"removeBlobFailed": "Failed to remove blob from IPFS"
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/blob-storage-connector-ipfs",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.6",
|
|
4
4
|
"description": "Blob Storage connector implementation using IPFS",
|
|
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.1-next.
|
|
17
|
+
"@twin.org/blob-storage-models": "0.0.1-next.6",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/crypto": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|