@hot-updater/vercel 1.1.4 → 1.2.0-rc.0
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/function/index.mjs +846 -396
- package/dist/index.cjs +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -70,7 +70,8 @@ const access = "private";
|
|
|
70
70
|
*/
|
|
71
71
|
const vercelBlobStorage = (config) => {
|
|
72
72
|
const { token } = config;
|
|
73
|
-
|
|
73
|
+
let store;
|
|
74
|
+
const storeId = () => store ??= storeIdOf(token);
|
|
74
75
|
const normalizedBasePath = config.basePath?.replace(/^\/+|\/+$/g, "") ?? "";
|
|
75
76
|
const getStorageKey = (0, _hot_updater_plugin_core.createStorageKeyBuilder)(normalizedBasePath);
|
|
76
77
|
const expiresIn = config.signedUrlExpiresIn ?? 3600;
|
|
@@ -91,7 +92,7 @@ const vercelBlobStorage = (config) => {
|
|
|
91
92
|
};
|
|
92
93
|
const parseAndValidate = (storageUri) => {
|
|
93
94
|
const parsed = (0, _hot_updater_plugin_core.parseStorageUri)(storageUri, PROTOCOL);
|
|
94
|
-
if (parsed.bucket !== storeId) throw new Error(`Blob store mismatch: expected "${storeId}", but found "${parsed.bucket}".`);
|
|
95
|
+
if (parsed.bucket !== storeId()) throw new Error(`Blob store mismatch: expected "${storeId()}", but found "${parsed.bucket}".`);
|
|
95
96
|
return parsed;
|
|
96
97
|
};
|
|
97
98
|
const getListPrefix = (prefix = "") => {
|
|
@@ -110,7 +111,7 @@ const vercelBlobStorage = (config) => {
|
|
|
110
111
|
const storageKey = getStorageKey(key);
|
|
111
112
|
const storageUri = (0, _hot_updater_plugin_core.createStorageUri)({
|
|
112
113
|
protocol: PROTOCOL,
|
|
113
|
-
bucket: storeId,
|
|
114
|
+
bucket: storeId(),
|
|
114
115
|
key: storageKey
|
|
115
116
|
});
|
|
116
117
|
await (0, _vercel_blob.put)(toPathname(storageKey), body, {
|
|
@@ -182,7 +183,7 @@ const vercelBlobStorage = (config) => {
|
|
|
182
183
|
try {
|
|
183
184
|
storageUri = (0, _hot_updater_plugin_core.createStorageUri)({
|
|
184
185
|
protocol: PROTOCOL,
|
|
185
|
-
bucket: storeId,
|
|
186
|
+
bucket: storeId(),
|
|
186
187
|
key
|
|
187
188
|
});
|
|
188
189
|
} catch {
|
package/dist/index.mjs
CHANGED
|
@@ -69,7 +69,8 @@ const access = "private";
|
|
|
69
69
|
*/
|
|
70
70
|
const vercelBlobStorage = (config) => {
|
|
71
71
|
const { token } = config;
|
|
72
|
-
|
|
72
|
+
let store;
|
|
73
|
+
const storeId = () => store ??= storeIdOf(token);
|
|
73
74
|
const normalizedBasePath = config.basePath?.replace(/^\/+|\/+$/g, "") ?? "";
|
|
74
75
|
const getStorageKey = createStorageKeyBuilder(normalizedBasePath);
|
|
75
76
|
const expiresIn = config.signedUrlExpiresIn ?? 3600;
|
|
@@ -90,7 +91,7 @@ const vercelBlobStorage = (config) => {
|
|
|
90
91
|
};
|
|
91
92
|
const parseAndValidate = (storageUri) => {
|
|
92
93
|
const parsed = parseStorageUri(storageUri, PROTOCOL);
|
|
93
|
-
if (parsed.bucket !== storeId) throw new Error(`Blob store mismatch: expected "${storeId}", but found "${parsed.bucket}".`);
|
|
94
|
+
if (parsed.bucket !== storeId()) throw new Error(`Blob store mismatch: expected "${storeId()}", but found "${parsed.bucket}".`);
|
|
94
95
|
return parsed;
|
|
95
96
|
};
|
|
96
97
|
const getListPrefix = (prefix = "") => {
|
|
@@ -109,7 +110,7 @@ const vercelBlobStorage = (config) => {
|
|
|
109
110
|
const storageKey = getStorageKey(key);
|
|
110
111
|
const storageUri = createStorageUri({
|
|
111
112
|
protocol: PROTOCOL,
|
|
112
|
-
bucket: storeId,
|
|
113
|
+
bucket: storeId(),
|
|
113
114
|
key: storageKey
|
|
114
115
|
});
|
|
115
116
|
await put(toPathname(storageKey), body, {
|
|
@@ -181,7 +182,7 @@ const vercelBlobStorage = (config) => {
|
|
|
181
182
|
try {
|
|
182
183
|
storageUri = createStorageUri({
|
|
183
184
|
protocol: PROTOCOL,
|
|
184
|
-
bucket: storeId,
|
|
185
|
+
bucket: storeId(),
|
|
185
186
|
key
|
|
186
187
|
});
|
|
187
188
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/vercel",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0-rc.0",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@vercel/cli-auth": "0.3.10",
|
|
42
42
|
"@vercel/cli-config": "0.3.1",
|
|
43
43
|
"pg": "8.13.1",
|
|
44
|
-
"@hot-updater/cli-tools": "1.
|
|
45
|
-
"@hot-updater/plugin-core": "1.
|
|
46
|
-
"@hot-updater/postgres": "1.
|
|
47
|
-
"@hot-updater/protocol": "1.
|
|
48
|
-
"@hot-updater/server": "1.
|
|
44
|
+
"@hot-updater/cli-tools": "1.2.0-rc.0",
|
|
45
|
+
"@hot-updater/plugin-core": "1.2.0-rc.0",
|
|
46
|
+
"@hot-updater/postgres": "1.2.0-rc.0",
|
|
47
|
+
"@hot-updater/protocol": "1.2.0-rc.0",
|
|
48
|
+
"@hot-updater/server": "1.2.0-rc.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^20",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"execa": "9.5.2",
|
|
55
55
|
"kysely": "0.28.17",
|
|
56
56
|
"vitest": "4.1.4",
|
|
57
|
-
"@hot-updater/test-utils": "1.
|
|
57
|
+
"@hot-updater/test-utils": "1.2.0-rc.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown",
|