@hot-updater/supabase 0.18.3 → 0.18.5
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/index.cjs +30 -19
- package/dist/index.js +30 -19
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -92,22 +92,28 @@ const supabaseDatabase = (config, hooks) => (0, __hot_updater_plugin_core.create
|
|
|
92
92
|
},
|
|
93
93
|
async commitBundle(context, { changedSets }) {
|
|
94
94
|
if (changedSets.length === 0) return;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
for (const op of changedSets) if (op.operation === "delete") {
|
|
96
|
+
const { error } = await context.supabase.from("bundles").delete().eq("id", op.data.id);
|
|
97
|
+
if (error) throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
98
|
+
} else if (op.operation === "insert" || op.operation === "update") {
|
|
99
|
+
const bundle = op.data;
|
|
100
|
+
const { error } = await context.supabase.from("bundles").upsert({
|
|
101
|
+
id: bundle.id,
|
|
102
|
+
channel: bundle.channel,
|
|
103
|
+
enabled: bundle.enabled,
|
|
104
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
105
|
+
file_hash: bundle.fileHash,
|
|
106
|
+
git_commit_hash: bundle.gitCommitHash,
|
|
107
|
+
message: bundle.message,
|
|
108
|
+
platform: bundle.platform,
|
|
109
|
+
target_app_version: bundle.targetAppVersion,
|
|
110
|
+
fingerprint_hash: bundle.fingerprintHash,
|
|
111
|
+
storage_uri: bundle.storageUri,
|
|
112
|
+
metadata: bundle.metadata
|
|
113
|
+
}, { onConflict: "id" });
|
|
114
|
+
if (error) throw error;
|
|
115
|
+
}
|
|
116
|
+
hooks?.onDatabaseUpdated?.();
|
|
111
117
|
}
|
|
112
118
|
}, hooks);
|
|
113
119
|
|
|
@@ -1458,9 +1464,14 @@ const supabaseStorage = (config, hooks) => (_) => {
|
|
|
1458
1464
|
return {
|
|
1459
1465
|
name: "supabaseStorage",
|
|
1460
1466
|
async deleteBundle(bundleId) {
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
|
|
1467
|
+
const filename = "bundle.zip";
|
|
1468
|
+
const Key = `${bundleId}/${filename}`;
|
|
1469
|
+
const { error } = await bucket.remove([Key]);
|
|
1470
|
+
if (error) {
|
|
1471
|
+
if (error.message?.includes("not found")) throw new Error(`Bundle with id ${bundleId} not found`);
|
|
1472
|
+
throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
1473
|
+
}
|
|
1474
|
+
return { storageUri: `supabase-storage://${config.bucketName}/${Key}` };
|
|
1464
1475
|
},
|
|
1465
1476
|
async uploadBundle(bundleId, bundlePath) {
|
|
1466
1477
|
const Body = await fs_promises.default.readFile(bundlePath);
|
package/dist/index.js
CHANGED
|
@@ -69,22 +69,28 @@ const supabaseDatabase = (config, hooks) => createDatabasePlugin("supabaseDataba
|
|
|
69
69
|
},
|
|
70
70
|
async commitBundle(context, { changedSets }) {
|
|
71
71
|
if (changedSets.length === 0) return;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
for (const op of changedSets) if (op.operation === "delete") {
|
|
73
|
+
const { error } = await context.supabase.from("bundles").delete().eq("id", op.data.id);
|
|
74
|
+
if (error) throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
75
|
+
} else if (op.operation === "insert" || op.operation === "update") {
|
|
76
|
+
const bundle = op.data;
|
|
77
|
+
const { error } = await context.supabase.from("bundles").upsert({
|
|
78
|
+
id: bundle.id,
|
|
79
|
+
channel: bundle.channel,
|
|
80
|
+
enabled: bundle.enabled,
|
|
81
|
+
should_force_update: bundle.shouldForceUpdate,
|
|
82
|
+
file_hash: bundle.fileHash,
|
|
83
|
+
git_commit_hash: bundle.gitCommitHash,
|
|
84
|
+
message: bundle.message,
|
|
85
|
+
platform: bundle.platform,
|
|
86
|
+
target_app_version: bundle.targetAppVersion,
|
|
87
|
+
fingerprint_hash: bundle.fingerprintHash,
|
|
88
|
+
storage_uri: bundle.storageUri,
|
|
89
|
+
metadata: bundle.metadata
|
|
90
|
+
}, { onConflict: "id" });
|
|
91
|
+
if (error) throw error;
|
|
92
|
+
}
|
|
93
|
+
hooks?.onDatabaseUpdated?.();
|
|
88
94
|
}
|
|
89
95
|
}, hooks);
|
|
90
96
|
|
|
@@ -1435,9 +1441,14 @@ const supabaseStorage = (config, hooks) => (_) => {
|
|
|
1435
1441
|
return {
|
|
1436
1442
|
name: "supabaseStorage",
|
|
1437
1443
|
async deleteBundle(bundleId) {
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
|
|
1444
|
+
const filename = "bundle.zip";
|
|
1445
|
+
const Key = `${bundleId}/${filename}`;
|
|
1446
|
+
const { error } = await bucket.remove([Key]);
|
|
1447
|
+
if (error) {
|
|
1448
|
+
if (error.message?.includes("not found")) throw new Error(`Bundle with id ${bundleId} not found`);
|
|
1449
|
+
throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
1450
|
+
}
|
|
1451
|
+
return { storageUri: `supabase-storage://${config.bucketName}/${Key}` };
|
|
1441
1452
|
},
|
|
1442
1453
|
async uploadBundle(bundleId, bundlePath) {
|
|
1443
1454
|
const Body = await fs.readFile(bundlePath);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.5",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@supabase/supabase-js": "^2.47.10",
|
|
43
|
-
"@hot-updater/core": "0.18.
|
|
44
|
-
"@hot-updater/plugin-core": "0.18.
|
|
43
|
+
"@hot-updater/core": "0.18.5",
|
|
44
|
+
"@hot-updater/plugin-core": "0.18.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@clack/prompts": "0.10.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"execa": "^9.5.2",
|
|
51
51
|
"mime": "^4.0.4",
|
|
52
52
|
"picocolors": "^1.0.0",
|
|
53
|
-
"@hot-updater/postgres": "0.18.
|
|
53
|
+
"@hot-updater/postgres": "0.18.5"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown",
|