@hot-updater/supabase 1.2.0-rc.51 → 1.2.0-rc.53
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/edge.cjs +1 -1
- package/dist/edge.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{supabaseStorage-B6IM8UX2.mjs → supabaseStorage-BoMZ6ay3.mjs} +33 -2
- package/dist/{supabaseStorage-DUa49vGh.cjs → supabaseStorage-CkMp_r4q.cjs} +33 -2
- package/package.json +8 -8
package/dist/edge.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_supabaseStorage = require("./supabaseStorage-
|
|
2
|
+
const require_supabaseStorage = require("./supabaseStorage-CkMp_r4q.cjs");
|
|
3
3
|
exports.supabaseDatabase = require_supabaseStorage.supabaseDatabase;
|
|
4
4
|
exports.supabaseStorage = require_supabaseStorage.supabaseStorage;
|
package/dist/edge.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as supabaseDatabase, t as supabaseStorage } from "./supabaseStorage-
|
|
1
|
+
import { n as supabaseDatabase, t as supabaseStorage } from "./supabaseStorage-BoMZ6ay3.mjs";
|
|
2
2
|
export { supabaseDatabase, supabaseStorage };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_supabaseStorage = require("./supabaseStorage-
|
|
2
|
+
const require_supabaseStorage = require("./supabaseStorage-CkMp_r4q.cjs");
|
|
3
3
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
4
4
|
//#region src/supabaseSchema.ts
|
|
5
5
|
/** Every table the apply RPC may name: models, index tables, settings, and the write guard. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as SUPABASE_TABLE_PREFIX, n as supabaseDatabase$1, r as SUPABASE_APPLY_FUNCTION, t as supabaseStorage } from "./supabaseStorage-
|
|
1
|
+
import { i as SUPABASE_TABLE_PREFIX, n as supabaseDatabase$1, r as SUPABASE_APPLY_FUNCTION, t as supabaseStorage } from "./supabaseStorage-BoMZ6ay3.mjs";
|
|
2
2
|
import { SETTINGS_TABLE, WRITE_GUARD_TABLE, coreSettings, coreTarget, createTableStatements, generateEngineSql, isMultiIndex } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseSchema.ts
|
|
4
4
|
/** Every table the apply RPC may name: models, index tables, settings, and the write guard. */
|
|
@@ -164,6 +164,32 @@ const isMissingObjectError = async (error) => {
|
|
|
164
164
|
const body = await response.json().catch(() => void 0);
|
|
165
165
|
return typeof body === "object" && body !== null && Reflect.get(body, "error") === "not_found";
|
|
166
166
|
};
|
|
167
|
+
/** The one-line description of a request Storage failed with `status`. */
|
|
168
|
+
const answeredHttp = (status) => `Supabase Storage answered HTTP ${status}`;
|
|
169
|
+
/**
|
|
170
|
+
* fetch for supabase-js, which reads the body of a failed request as JSON. A
|
|
171
|
+
* gateway in front of Storage answers some failures, such as a 502, with an
|
|
172
|
+
* HTML page, which would fail as a JSON parse error without its status. Such
|
|
173
|
+
* a response becomes a JSON error that names the status. A HEAD response
|
|
174
|
+
* has no body, and supabase-js reads it unparsed.
|
|
175
|
+
*/
|
|
176
|
+
const storageFetch = async (input, init) => {
|
|
177
|
+
const response = await fetch(input, init);
|
|
178
|
+
if (response.ok || init?.method === "HEAD") return response;
|
|
179
|
+
try {
|
|
180
|
+
JSON.parse(await response.clone().text());
|
|
181
|
+
return response;
|
|
182
|
+
} catch {
|
|
183
|
+
return Response.json({
|
|
184
|
+
statusCode: String(response.status),
|
|
185
|
+
error: response.statusText,
|
|
186
|
+
message: answeredHttp(response.status)
|
|
187
|
+
}, {
|
|
188
|
+
status: response.status,
|
|
189
|
+
statusText: response.statusText
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
167
193
|
/** A character Storage rejects in an object name, `?`, or `!`. */
|
|
168
194
|
const ESCAPED_CHARACTER = /[^A-Za-z0-9_/.*'() &$=@;:+,-]/gu;
|
|
169
195
|
const ESCAPE_SEQUENCE = /!([0-9A-F]{2})/gu;
|
|
@@ -215,7 +241,7 @@ const fromObjectName = (name) => {
|
|
|
215
241
|
};
|
|
216
242
|
const supabaseStorage = (config) => {
|
|
217
243
|
let client;
|
|
218
|
-
const bucket = async () => (await (client ??= resolveSupabaseServiceRoleKey(config).then((key) => createClient(config.supabaseUrl, key), (error) => {
|
|
244
|
+
const bucket = async () => (await (client ??= resolveSupabaseServiceRoleKey(config).then((key) => createClient(config.supabaseUrl, key, { global: { fetch: storageFetch } }), (error) => {
|
|
219
245
|
client = void 0;
|
|
220
246
|
throw error;
|
|
221
247
|
}))).storage.from(config.bucketName);
|
|
@@ -243,7 +269,12 @@ const supabaseStorage = (config) => {
|
|
|
243
269
|
duplex: "half",
|
|
244
270
|
...contentLength === void 0 ? {} : { headers: { "content-length": String(contentLength) } }
|
|
245
271
|
});
|
|
246
|
-
if (error)
|
|
272
|
+
if (error) {
|
|
273
|
+
const status = Reflect.get(error, "status");
|
|
274
|
+
if (typeof status !== "number") throw error;
|
|
275
|
+
const detail = error.message === answeredHttp(status) ? "" : `: ${error.message}`;
|
|
276
|
+
throw new Error(`${answeredHttp(status)} while uploading ${storageKey}${detail}`, { cause: error });
|
|
277
|
+
}
|
|
247
278
|
return { storageUri: createStorageUri({
|
|
248
279
|
protocol: "supabase-storage",
|
|
249
280
|
bucket: config.bucketName,
|
|
@@ -164,6 +164,32 @@ const isMissingObjectError = async (error) => {
|
|
|
164
164
|
const body = await response.json().catch(() => void 0);
|
|
165
165
|
return typeof body === "object" && body !== null && Reflect.get(body, "error") === "not_found";
|
|
166
166
|
};
|
|
167
|
+
/** The one-line description of a request Storage failed with `status`. */
|
|
168
|
+
const answeredHttp = (status) => `Supabase Storage answered HTTP ${status}`;
|
|
169
|
+
/**
|
|
170
|
+
* fetch for supabase-js, which reads the body of a failed request as JSON. A
|
|
171
|
+
* gateway in front of Storage answers some failures, such as a 502, with an
|
|
172
|
+
* HTML page, which would fail as a JSON parse error without its status. Such
|
|
173
|
+
* a response becomes a JSON error that names the status. A HEAD response
|
|
174
|
+
* has no body, and supabase-js reads it unparsed.
|
|
175
|
+
*/
|
|
176
|
+
const storageFetch = async (input, init) => {
|
|
177
|
+
const response = await fetch(input, init);
|
|
178
|
+
if (response.ok || init?.method === "HEAD") return response;
|
|
179
|
+
try {
|
|
180
|
+
JSON.parse(await response.clone().text());
|
|
181
|
+
return response;
|
|
182
|
+
} catch {
|
|
183
|
+
return Response.json({
|
|
184
|
+
statusCode: String(response.status),
|
|
185
|
+
error: response.statusText,
|
|
186
|
+
message: answeredHttp(response.status)
|
|
187
|
+
}, {
|
|
188
|
+
status: response.status,
|
|
189
|
+
statusText: response.statusText
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
167
193
|
/** A character Storage rejects in an object name, `?`, or `!`. */
|
|
168
194
|
const ESCAPED_CHARACTER = /[^A-Za-z0-9_/.*'() &$=@;:+,-]/gu;
|
|
169
195
|
const ESCAPE_SEQUENCE = /!([0-9A-F]{2})/gu;
|
|
@@ -215,7 +241,7 @@ const fromObjectName = (name) => {
|
|
|
215
241
|
};
|
|
216
242
|
const supabaseStorage = (config) => {
|
|
217
243
|
let client;
|
|
218
|
-
const bucket = async () => (await (client ??= resolveSupabaseServiceRoleKey(config).then((key) => (0, _supabase_supabase_js.createClient)(config.supabaseUrl, key), (error) => {
|
|
244
|
+
const bucket = async () => (await (client ??= resolveSupabaseServiceRoleKey(config).then((key) => (0, _supabase_supabase_js.createClient)(config.supabaseUrl, key, { global: { fetch: storageFetch } }), (error) => {
|
|
219
245
|
client = void 0;
|
|
220
246
|
throw error;
|
|
221
247
|
}))).storage.from(config.bucketName);
|
|
@@ -243,7 +269,12 @@ const supabaseStorage = (config) => {
|
|
|
243
269
|
duplex: "half",
|
|
244
270
|
...contentLength === void 0 ? {} : { headers: { "content-length": String(contentLength) } }
|
|
245
271
|
});
|
|
246
|
-
if (error)
|
|
272
|
+
if (error) {
|
|
273
|
+
const status = Reflect.get(error, "status");
|
|
274
|
+
if (typeof status !== "number") throw error;
|
|
275
|
+
const detail = error.message === answeredHttp(status) ? "" : `: ${error.message}`;
|
|
276
|
+
throw new Error(`${answeredHttp(status)} while uploading ${storageKey}${detail}`, { cause: error });
|
|
277
|
+
}
|
|
247
278
|
return { storageUri: (0, _hot_updater_plugin_core.createStorageUri)({
|
|
248
279
|
protocol: "supabase-storage",
|
|
249
280
|
bucket: config.bucketName,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.53",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"@supabase/supabase-js": "2.76.1",
|
|
52
52
|
"hono": "4.12.34",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
|
-
"@hot-updater/
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/
|
|
57
|
-
"@hot-updater/
|
|
54
|
+
"@hot-updater/protocol": "1.2.0-rc.53",
|
|
55
|
+
"@hot-updater/plugin-core": "1.2.0-rc.53",
|
|
56
|
+
"@hot-updater/server": "1.2.0-rc.53",
|
|
57
|
+
"@hot-updater/cli-tools": "1.2.0-rc.53"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@electric-sql/pglite": "0.4.1",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"execa": "9.5.2",
|
|
65
65
|
"@types/node": "^20",
|
|
66
66
|
"mime": "^4.0.4",
|
|
67
|
-
"@hot-updater/mock": "1.2.0-rc.
|
|
68
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
69
|
-
"@hot-updater/postgres": "1.2.0-rc.
|
|
67
|
+
"@hot-updater/mock": "1.2.0-rc.53",
|
|
68
|
+
"@hot-updater/test-utils": "1.2.0-rc.53",
|
|
69
|
+
"@hot-updater/postgres": "1.2.0-rc.53"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown",
|