@hot-updater/supabase 0.36.1 → 0.36.3
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 +4 -11
- package/dist/index.mjs +4 -11
- package/dist/{supabaseEdgeFunctionStorage-DczYIzj_.cjs → supabaseEdgeFunctionStorage-BSLlUeqi.cjs} +1 -32
- package/dist/{supabaseEdgeFunctionStorage-B3yJ5yys.mjs → supabaseEdgeFunctionStorage-pV0s_mTF.mjs} +3 -28
- package/package.json +9 -9
package/dist/edge.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_supabaseEdgeFunctionStorage = require("./supabaseEdgeFunctionStorage-
|
|
2
|
+
const require_supabaseEdgeFunctionStorage = require("./supabaseEdgeFunctionStorage-BSLlUeqi.cjs");
|
|
3
3
|
exports.supabaseEdgeFunctionDatabase = require_supabaseEdgeFunctionStorage.supabaseEdgeFunctionDatabase;
|
|
4
4
|
exports.supabaseEdgeFunctionStorage = require_supabaseEdgeFunctionStorage.supabaseEdgeFunctionStorage;
|
package/dist/edge.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as supabaseEdgeFunctionDatabase, t as supabaseEdgeFunctionStorage } from "./supabaseEdgeFunctionStorage-pV0s_mTF.mjs";
|
|
2
2
|
export { supabaseEdgeFunctionDatabase, supabaseEdgeFunctionStorage };
|
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_supabaseEdgeFunctionStorage = require("./supabaseEdgeFunctionStorage-
|
|
24
|
+
const require_supabaseEdgeFunctionStorage = require("./supabaseEdgeFunctionStorage-BSLlUeqi.cjs");
|
|
25
25
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
26
26
|
let _supabase_supabase_js = require("@supabase/supabase-js");
|
|
27
27
|
let fs_promises = require("fs/promises");
|
|
@@ -55,11 +55,7 @@ async function verifyObjectCanBeSignedForRuntime({ bucket, key }) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const parseSupabaseStorageUri = (storageUri) => {
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
bucket,
|
|
61
|
-
key: require_supabaseEdgeFunctionStorage.decodeStorageObjectKey(key)
|
|
62
|
-
};
|
|
58
|
+
return (0, _hot_updater_plugin_core.parseStorageUri)(storageUri, "supabase-storage");
|
|
63
59
|
};
|
|
64
60
|
const supabaseStorage = (0, _hot_updater_plugin_core.createUniversalStoragePlugin)({
|
|
65
61
|
name: "supabaseStorage",
|
|
@@ -134,11 +130,8 @@ const supabaseStorage = (0, _hot_updater_plugin_core.createUniversalStoragePlugi
|
|
|
134
130
|
return data.text();
|
|
135
131
|
},
|
|
136
132
|
async getDownloadUrl(storageUri) {
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
let key = require_supabaseEdgeFunctionStorage.decodeStorageObjectKey(`${u.host}${u.pathname}`.replace(/^\//, ""));
|
|
140
|
-
if (!key) throw new Error("Invalid Supabase storage URI: missing key");
|
|
141
|
-
if (key.startsWith(`${config.bucketName}/`)) key = key.substring(`${config.bucketName}/`.length);
|
|
133
|
+
const { bucket: bucketName, key } = parseSupabaseStorageUri(storageUri);
|
|
134
|
+
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
142
135
|
return { fileUrl: await resolveSignedUrl(config.bucketName, key) };
|
|
143
136
|
}
|
|
144
137
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as resolveSupabaseServiceRoleKey, i as supabaseDatabase, n as createSupabaseSignedUrlBatcher, r as supabaseEdgeFunctionDatabase, t as supabaseEdgeFunctionStorage } from "./supabaseEdgeFunctionStorage-pV0s_mTF.mjs";
|
|
2
2
|
import { createStorageKeyBuilder, createUniversalStoragePlugin, getContentType, parseStorageUri } from "@hot-updater/plugin-core";
|
|
3
3
|
import { createClient } from "@supabase/supabase-js";
|
|
4
4
|
import fs from "fs/promises";
|
|
@@ -30,11 +30,7 @@ async function verifyObjectCanBeSignedForRuntime({ bucket, key }) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
const parseSupabaseStorageUri = (storageUri) => {
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
bucket,
|
|
36
|
-
key: decodeStorageObjectKey(key)
|
|
37
|
-
};
|
|
33
|
+
return parseStorageUri(storageUri, "supabase-storage");
|
|
38
34
|
};
|
|
39
35
|
const supabaseStorage = createUniversalStoragePlugin({
|
|
40
36
|
name: "supabaseStorage",
|
|
@@ -109,11 +105,8 @@ const supabaseStorage = createUniversalStoragePlugin({
|
|
|
109
105
|
return data.text();
|
|
110
106
|
},
|
|
111
107
|
async getDownloadUrl(storageUri) {
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
let key = decodeStorageObjectKey(`${u.host}${u.pathname}`.replace(/^\//, ""));
|
|
115
|
-
if (!key) throw new Error("Invalid Supabase storage URI: missing key");
|
|
116
|
-
if (key.startsWith(`${config.bucketName}/`)) key = key.substring(`${config.bucketName}/`.length);
|
|
108
|
+
const { bucket: bucketName, key } = parseSupabaseStorageUri(storageUri);
|
|
109
|
+
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
117
110
|
return { fileUrl: await resolveSignedUrl(config.bucketName, key) };
|
|
118
111
|
}
|
|
119
112
|
}
|
package/dist/{supabaseEdgeFunctionStorage-DczYIzj_.cjs → supabaseEdgeFunctionStorage-BSLlUeqi.cjs}
RENAMED
|
@@ -316,34 +316,9 @@ const createSupabaseSignedUrlBatcher = ({ createSignedUrls, expiresIn, formatObj
|
|
|
316
316
|
});
|
|
317
317
|
};
|
|
318
318
|
//#endregion
|
|
319
|
-
//#region src/supabaseStorageKey.ts
|
|
320
|
-
/**
|
|
321
|
-
* Supabase upload responses echo a percent-encoded object key (`data.Key`),
|
|
322
|
-
* so the `supabase-storage://` URIs built from them keep that encoding.
|
|
323
|
-
*
|
|
324
|
-
* Storage API endpoints that carry the key in the request path
|
|
325
|
-
* (`createSignedUrl`, `download`, `exists`) decode it server side, but the
|
|
326
|
-
* ones that carry keys in the JSON body (`createSignedUrls`, `remove`) do
|
|
327
|
-
* not, and look up an object whose name literally contains `%40`.
|
|
328
|
-
*
|
|
329
|
-
* Decoding when the URI is parsed keeps both request shapes pointing at the
|
|
330
|
-
* same object. Keys that are not valid percent-encoded sequences are left
|
|
331
|
-
* untouched.
|
|
332
|
-
*/
|
|
333
|
-
const decodeStorageObjectKey = (key) => {
|
|
334
|
-
try {
|
|
335
|
-
return decodeURIComponent(key);
|
|
336
|
-
} catch {
|
|
337
|
-
return key;
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
//#endregion
|
|
341
319
|
//#region src/supabaseEdgeFunctionStorage.ts
|
|
342
320
|
const parseSupabaseStorageUri = (storageUri) => {
|
|
343
|
-
const
|
|
344
|
-
if (storageUrl.protocol !== "supabase-storage:") throw new Error("Invalid Supabase storage URI protocol");
|
|
345
|
-
const bucketName = storageUrl.host;
|
|
346
|
-
const key = decodeStorageObjectKey(storageUrl.pathname.replace(/^\/+/, ""));
|
|
321
|
+
const { bucket: bucketName, key } = (0, _hot_updater_plugin_core.parseStorageUri)(storageUri, "supabase-storage");
|
|
347
322
|
if (!bucketName || !key) throw new Error("Invalid Supabase storage URI");
|
|
348
323
|
return {
|
|
349
324
|
bucketName,
|
|
@@ -385,12 +360,6 @@ Object.defineProperty(exports, "createSupabaseSignedUrlBatcher", {
|
|
|
385
360
|
return createSupabaseSignedUrlBatcher;
|
|
386
361
|
}
|
|
387
362
|
});
|
|
388
|
-
Object.defineProperty(exports, "decodeStorageObjectKey", {
|
|
389
|
-
enumerable: true,
|
|
390
|
-
get: function() {
|
|
391
|
-
return decodeStorageObjectKey;
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
363
|
Object.defineProperty(exports, "resolveSupabaseServiceRoleKey", {
|
|
395
364
|
enumerable: true,
|
|
396
365
|
get: function() {
|
package/dist/{supabaseEdgeFunctionStorage-B3yJ5yys.mjs → supabaseEdgeFunctionStorage-pV0s_mTF.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
|
|
2
|
-
import { calculatePagination, createDatabasePlugin, createRuntimeStoragePlugin, filterCompatibleAppVersions } from "@hot-updater/plugin-core";
|
|
2
|
+
import { calculatePagination, createDatabasePlugin, createRuntimeStoragePlugin, filterCompatibleAppVersions, parseStorageUri } from "@hot-updater/plugin-core";
|
|
3
3
|
import { createClient } from "@supabase/supabase-js";
|
|
4
4
|
//#region src/supabaseBundleMapper.ts
|
|
5
5
|
const BUNDLE_SELECT_COLUMNS = "id, channel, enabled, platform, should_force_update, file_hash, git_commit_hash, message, fingerprint_hash, target_app_version, storage_uri, metadata, manifest_storage_uri, manifest_file_hash, asset_base_storage_uri, rollout_cohort_count, target_cohorts";
|
|
@@ -315,34 +315,9 @@ const createSupabaseSignedUrlBatcher = ({ createSignedUrls, expiresIn, formatObj
|
|
|
315
315
|
});
|
|
316
316
|
};
|
|
317
317
|
//#endregion
|
|
318
|
-
//#region src/supabaseStorageKey.ts
|
|
319
|
-
/**
|
|
320
|
-
* Supabase upload responses echo a percent-encoded object key (`data.Key`),
|
|
321
|
-
* so the `supabase-storage://` URIs built from them keep that encoding.
|
|
322
|
-
*
|
|
323
|
-
* Storage API endpoints that carry the key in the request path
|
|
324
|
-
* (`createSignedUrl`, `download`, `exists`) decode it server side, but the
|
|
325
|
-
* ones that carry keys in the JSON body (`createSignedUrls`, `remove`) do
|
|
326
|
-
* not, and look up an object whose name literally contains `%40`.
|
|
327
|
-
*
|
|
328
|
-
* Decoding when the URI is parsed keeps both request shapes pointing at the
|
|
329
|
-
* same object. Keys that are not valid percent-encoded sequences are left
|
|
330
|
-
* untouched.
|
|
331
|
-
*/
|
|
332
|
-
const decodeStorageObjectKey = (key) => {
|
|
333
|
-
try {
|
|
334
|
-
return decodeURIComponent(key);
|
|
335
|
-
} catch {
|
|
336
|
-
return key;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
//#endregion
|
|
340
318
|
//#region src/supabaseEdgeFunctionStorage.ts
|
|
341
319
|
const parseSupabaseStorageUri = (storageUri) => {
|
|
342
|
-
const
|
|
343
|
-
if (storageUrl.protocol !== "supabase-storage:") throw new Error("Invalid Supabase storage URI protocol");
|
|
344
|
-
const bucketName = storageUrl.host;
|
|
345
|
-
const key = decodeStorageObjectKey(storageUrl.pathname.replace(/^\/+/, ""));
|
|
320
|
+
const { bucket: bucketName, key } = parseStorageUri(storageUri, "supabase-storage");
|
|
346
321
|
if (!bucketName || !key) throw new Error("Invalid Supabase storage URI");
|
|
347
322
|
return {
|
|
348
323
|
bucketName,
|
|
@@ -378,4 +353,4 @@ const supabaseEdgeFunctionStorage = createRuntimeStoragePlugin({
|
|
|
378
353
|
}
|
|
379
354
|
});
|
|
380
355
|
//#endregion
|
|
381
|
-
export {
|
|
356
|
+
export { resolveSupabaseServiceRoleKey as a, supabaseDatabase as i, createSupabaseSignedUrlBatcher as n, supabaseEdgeFunctionDatabase as r, supabaseEdgeFunctionStorage as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.36.
|
|
4
|
+
"version": "0.36.3",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"@supabase/supabase-js": "2.76.1",
|
|
56
56
|
"hono": "4.12.9",
|
|
57
57
|
"uuidv7": "^1.0.2",
|
|
58
|
-
"@hot-updater/core": "0.36.
|
|
59
|
-
"@hot-updater/plugin-core": "0.36.
|
|
60
|
-
"@hot-updater/cli-tools": "0.36.
|
|
61
|
-
"@hot-updater/server": "0.36.
|
|
58
|
+
"@hot-updater/core": "0.36.3",
|
|
59
|
+
"@hot-updater/plugin-core": "0.36.3",
|
|
60
|
+
"@hot-updater/cli-tools": "0.36.3",
|
|
61
|
+
"@hot-updater/server": "0.36.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@electric-sql/pglite": "0.4.1",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"execa": "9.5.2",
|
|
69
69
|
"@types/node": "^20",
|
|
70
70
|
"mime": "^4.0.4",
|
|
71
|
-
"@hot-updater/js": "0.36.
|
|
72
|
-
"@hot-updater/
|
|
73
|
-
"@hot-updater/
|
|
74
|
-
"@hot-updater/
|
|
71
|
+
"@hot-updater/js": "0.36.3",
|
|
72
|
+
"@hot-updater/mock": "0.36.3",
|
|
73
|
+
"@hot-updater/test-utils": "0.36.3",
|
|
74
|
+
"@hot-updater/postgres": "0.36.3"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsdown",
|