@hot-updater/supabase 0.20.11 → 0.20.12

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 CHANGED
@@ -25,10 +25,10 @@ let __hot_updater_plugin_core = require("@hot-updater/plugin-core");
25
25
  __hot_updater_plugin_core = __toESM(__hot_updater_plugin_core);
26
26
  let __supabase_supabase_js = require("@supabase/supabase-js");
27
27
  __supabase_supabase_js = __toESM(__supabase_supabase_js);
28
- let path = require("path");
29
- path = __toESM(path);
30
28
  let fs_promises = require("fs/promises");
31
29
  fs_promises = __toESM(fs_promises);
30
+ let path = require("path");
31
+ path = __toESM(path);
32
32
 
33
33
  //#region src/supabaseDatabase.ts
34
34
  const supabaseDatabase = (config, hooks) => (0, __hot_updater_plugin_core.createDatabasePlugin)("supabaseDatabase", {
@@ -66,27 +66,25 @@ const supabaseDatabase = (config, hooks) => (0, __hot_updater_plugin_core.create
66
66
  if (limit) query = query.limit(limit);
67
67
  if (offset) query = query.range(offset, offset + (limit || 20) - 1);
68
68
  const { data } = await query;
69
- const bundles = data ? data.map((bundle) => ({
70
- channel: bundle.channel,
71
- enabled: bundle.enabled,
72
- shouldForceUpdate: bundle.should_force_update,
73
- fileHash: bundle.file_hash,
74
- gitCommitHash: bundle.git_commit_hash,
75
- id: bundle.id,
76
- message: bundle.message,
77
- platform: bundle.platform,
78
- targetAppVersion: bundle.target_app_version,
79
- fingerprintHash: bundle.fingerprint_hash,
80
- storageUri: bundle.storage_uri,
81
- metadata: bundle.metadata ?? {}
82
- })) : [];
83
- const pagination = (0, __hot_updater_plugin_core.calculatePagination)(total ?? 0, {
84
- limit,
85
- offset
86
- });
87
69
  return {
88
- data: bundles,
89
- pagination
70
+ data: data ? data.map((bundle) => ({
71
+ channel: bundle.channel,
72
+ enabled: bundle.enabled,
73
+ shouldForceUpdate: bundle.should_force_update,
74
+ fileHash: bundle.file_hash,
75
+ gitCommitHash: bundle.git_commit_hash,
76
+ id: bundle.id,
77
+ message: bundle.message,
78
+ platform: bundle.platform,
79
+ targetAppVersion: bundle.target_app_version,
80
+ fingerprintHash: bundle.fingerprint_hash,
81
+ storageUri: bundle.storage_uri,
82
+ metadata: bundle.metadata ?? {}
83
+ })) : [],
84
+ pagination: (0, __hot_updater_plugin_core.calculatePagination)(total ?? 0, {
85
+ limit,
86
+ offset
87
+ })
90
88
  };
91
89
  },
92
90
  async getChannels(context) {
@@ -1425,8 +1423,7 @@ var Mime = class {
1425
1423
  const last = path$2.replace(/^.*[/\\]/, "").toLowerCase();
1426
1424
  const ext = last.replace(/^.*\./, "").toLowerCase();
1427
1425
  const hasPath = last.length < path$2.length;
1428
- const hasDot = ext.length < last.length - 1;
1429
- if (!hasDot && hasPath) return null;
1426
+ if (!(ext.length < last.length - 1) && hasPath) return null;
1430
1427
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
1431
1428
  }
1432
1429
  getExtension(type) {
@@ -1463,14 +1460,12 @@ var src_default = new Mime_default(standard_default, other_default)._freeze();
1463
1460
  //#endregion
1464
1461
  //#region src/supabaseStorage.ts
1465
1462
  const supabaseStorage = (config, hooks) => (_) => {
1466
- const supabase = (0, __supabase_supabase_js.createClient)(config.supabaseUrl, config.supabaseAnonKey);
1467
- const bucket = supabase.storage.from(config.bucketName);
1463
+ const bucket = (0, __supabase_supabase_js.createClient)(config.supabaseUrl, config.supabaseAnonKey).storage.from(config.bucketName);
1468
1464
  const getStorageKey = (0, __hot_updater_plugin_core.createStorageKeyBuilder)(config.basePath);
1469
1465
  return {
1470
1466
  name: "supabaseStorage",
1471
1467
  async deleteBundle(bundleId) {
1472
- const filename = "bundle.zip";
1473
- const Key = getStorageKey(bundleId, filename);
1468
+ const Key = getStorageKey(bundleId, "bundle.zip");
1474
1469
  const { error } = await bucket.remove([Key]);
1475
1470
  if (error) {
1476
1471
  if (error.message?.includes("not found")) throw new Error(`Bundle with id ${bundleId} not found`);
@@ -1481,8 +1476,7 @@ const supabaseStorage = (config, hooks) => (_) => {
1481
1476
  async uploadBundle(bundleId, bundlePath) {
1482
1477
  const Body = await fs_promises.default.readFile(bundlePath);
1483
1478
  const ContentType = src_default.getType(bundlePath) ?? void 0;
1484
- const filename = path.default.basename(bundlePath);
1485
- const Key = getStorageKey(bundleId, filename);
1479
+ const Key = getStorageKey(bundleId, path.default.basename(bundlePath));
1486
1480
  const upload = await bucket.upload(Key, Body, { contentType: ContentType });
1487
1481
  if (upload.error) throw upload.error;
1488
1482
  const fullPath = upload.data.fullPath;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { calculatePagination, createDatabasePlugin, createStorageKeyBuilder } from "@hot-updater/plugin-core";
2
2
  import { createClient } from "@supabase/supabase-js";
3
- import path from "path";
4
3
  import fs from "fs/promises";
4
+ import path from "path";
5
5
 
6
6
  //#region src/supabaseDatabase.ts
7
7
  const supabaseDatabase = (config, hooks) => createDatabasePlugin("supabaseDatabase", {
@@ -39,27 +39,25 @@ const supabaseDatabase = (config, hooks) => createDatabasePlugin("supabaseDataba
39
39
  if (limit) query = query.limit(limit);
40
40
  if (offset) query = query.range(offset, offset + (limit || 20) - 1);
41
41
  const { data } = await query;
42
- const bundles = data ? data.map((bundle) => ({
43
- channel: bundle.channel,
44
- enabled: bundle.enabled,
45
- shouldForceUpdate: bundle.should_force_update,
46
- fileHash: bundle.file_hash,
47
- gitCommitHash: bundle.git_commit_hash,
48
- id: bundle.id,
49
- message: bundle.message,
50
- platform: bundle.platform,
51
- targetAppVersion: bundle.target_app_version,
52
- fingerprintHash: bundle.fingerprint_hash,
53
- storageUri: bundle.storage_uri,
54
- metadata: bundle.metadata ?? {}
55
- })) : [];
56
- const pagination = calculatePagination(total ?? 0, {
57
- limit,
58
- offset
59
- });
60
42
  return {
61
- data: bundles,
62
- pagination
43
+ data: data ? data.map((bundle) => ({
44
+ channel: bundle.channel,
45
+ enabled: bundle.enabled,
46
+ shouldForceUpdate: bundle.should_force_update,
47
+ fileHash: bundle.file_hash,
48
+ gitCommitHash: bundle.git_commit_hash,
49
+ id: bundle.id,
50
+ message: bundle.message,
51
+ platform: bundle.platform,
52
+ targetAppVersion: bundle.target_app_version,
53
+ fingerprintHash: bundle.fingerprint_hash,
54
+ storageUri: bundle.storage_uri,
55
+ metadata: bundle.metadata ?? {}
56
+ })) : [],
57
+ pagination: calculatePagination(total ?? 0, {
58
+ limit,
59
+ offset
60
+ })
63
61
  };
64
62
  },
65
63
  async getChannels(context) {
@@ -1398,8 +1396,7 @@ var Mime = class {
1398
1396
  const last = path$1.replace(/^.*[/\\]/, "").toLowerCase();
1399
1397
  const ext = last.replace(/^.*\./, "").toLowerCase();
1400
1398
  const hasPath = last.length < path$1.length;
1401
- const hasDot = ext.length < last.length - 1;
1402
- if (!hasDot && hasPath) return null;
1399
+ if (!(ext.length < last.length - 1) && hasPath) return null;
1403
1400
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
1404
1401
  }
1405
1402
  getExtension(type) {
@@ -1436,14 +1433,12 @@ var src_default = new Mime_default(standard_default, other_default)._freeze();
1436
1433
  //#endregion
1437
1434
  //#region src/supabaseStorage.ts
1438
1435
  const supabaseStorage = (config, hooks) => (_) => {
1439
- const supabase = createClient(config.supabaseUrl, config.supabaseAnonKey);
1440
- const bucket = supabase.storage.from(config.bucketName);
1436
+ const bucket = createClient(config.supabaseUrl, config.supabaseAnonKey).storage.from(config.bucketName);
1441
1437
  const getStorageKey = createStorageKeyBuilder(config.basePath);
1442
1438
  return {
1443
1439
  name: "supabaseStorage",
1444
1440
  async deleteBundle(bundleId) {
1445
- const filename = "bundle.zip";
1446
- const Key = getStorageKey(bundleId, filename);
1441
+ const Key = getStorageKey(bundleId, "bundle.zip");
1447
1442
  const { error } = await bucket.remove([Key]);
1448
1443
  if (error) {
1449
1444
  if (error.message?.includes("not found")) throw new Error(`Bundle with id ${bundleId} not found`);
@@ -1454,8 +1449,7 @@ const supabaseStorage = (config, hooks) => (_) => {
1454
1449
  async uploadBundle(bundleId, bundlePath) {
1455
1450
  const Body = await fs.readFile(bundlePath);
1456
1451
  const ContentType = src_default.getType(bundlePath) ?? void 0;
1457
- const filename = path.basename(bundlePath);
1458
- const Key = getStorageKey(bundleId, filename);
1452
+ const Key = getStorageKey(bundleId, path.basename(bundlePath));
1459
1453
  const upload = await bucket.upload(Key, Body, { contentType: ContentType });
1460
1454
  if (upload.error) throw upload.error;
1461
1455
  const fullPath = upload.data.fullPath;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/supabase",
3
3
  "type": "module",
4
- "version": "0.20.11",
4
+ "version": "0.20.12",
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.20.11",
44
- "@hot-updater/plugin-core": "0.20.11"
43
+ "@hot-updater/core": "0.20.12",
44
+ "@hot-updater/plugin-core": "0.20.12"
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.1.1",
53
- "@hot-updater/postgres": "0.20.11"
53
+ "@hot-updater/postgres": "0.20.12"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsdown",
@@ -1,10 +1,10 @@
1
1
  import "jsr:@supabase/functions-js/edge-runtime.d.ts";
2
- import semver from "npm:semver@7.7.1";
3
2
  import { Hono } from "jsr:@hono/hono";
4
3
  import {
5
- type SupabaseClient,
6
4
  createClient,
5
+ type SupabaseClient,
7
6
  } from "jsr:@supabase/supabase-js@2.49.4";
7
+ import semver from "npm:semver@7.7.1";
8
8
  import type { GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
9
9
 
10
10
  const NIL_UUID = "00000000-0000-0000-0000-000000000000";