@orthacms/media-provider-vercel-blob 0.4.3 → 0.5.2
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,7 @@
|
|
|
1
1
|
# @orthacms/media-provider-vercel-blob
|
|
2
2
|
|
|
3
|
-
Part of [Ortha CMS](https://
|
|
3
|
+
Part of [Ortha CMS](https://orthacms.com) — the source is on
|
|
4
|
+
[GitHub](https://github.com/ortha-source/ortha-cms/tree/main/packages/media/provider-vercel-blob).
|
|
4
5
|
|
|
5
6
|
```sh
|
|
6
7
|
npm install @orthacms/media-provider-vercel-blob
|
|
@@ -5,7 +5,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
5
5
|
const node_stream_1 = require("node:stream");
|
|
6
6
|
const promises_1 = require("node:stream/promises");
|
|
7
7
|
const blob_1 = require("@vercel/blob");
|
|
8
|
-
const
|
|
8
|
+
const media_domain_1 = require("@orthacms/media-domain");
|
|
9
9
|
/** Reduces a file name to one safe key segment. Mirrors the other providers. */
|
|
10
10
|
function sanitize(fileName) {
|
|
11
11
|
const cleaned = fileName.replace(/[^A-Za-z0-9_.-]+/g, '_');
|
|
@@ -52,7 +52,7 @@ function createVercelBlobStorageProvider(config = {}) {
|
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
if (isMissing(error)) {
|
|
55
|
-
throw new
|
|
55
|
+
throw new media_domain_1.ObjectNotFoundError(storageKey, error);
|
|
56
56
|
}
|
|
57
57
|
throw error;
|
|
58
58
|
}
|
|
@@ -126,7 +126,7 @@ function createVercelBlobStorageProvider(config = {}) {
|
|
|
126
126
|
const response = await fetch(url);
|
|
127
127
|
if (!response.ok || !response.body) {
|
|
128
128
|
if (response.status === 404) {
|
|
129
|
-
throw new
|
|
129
|
+
throw new media_domain_1.ObjectNotFoundError(storageKey);
|
|
130
130
|
}
|
|
131
131
|
throw new Error(`Vercel Blob refused to serve ${storageKey}: ${response.status} ${response.statusText}`);
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orthacms/media-provider-vercel-blob",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "@orthacms/media-provider-vercel-blob — part of Ortha CMS.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://orthacms.com",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/ortha-source/ortha-cms.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@orthacms/media-
|
|
28
|
+
"@orthacms/media-domain": "^0.5.2",
|
|
29
29
|
"@vercel/blob": "^0.27.0",
|
|
30
30
|
"tslib": "^2.3.0"
|
|
31
31
|
},
|