@hot-updater/supabase 0.36.7 → 1.0.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/edge.cjs +6 -3
- package/dist/edge.d.cts +14 -2
- package/dist/edge.d.mts +14 -2
- package/dist/edge.mjs +5 -2
- package/dist/iac/index.cjs +607 -50
- package/dist/iac/index.d.cts +26 -8
- package/dist/iac/index.d.mts +26 -8
- package/dist/iac/index.mjs +604 -52
- package/dist/index.cjs +3 -145
- package/dist/index.d.cts +7 -24
- package/dist/index.d.mts +7 -24
- package/dist/index.mjs +2 -117
- package/dist/init/index.cjs +5 -2
- package/dist/init/index.d.cts +2 -2
- package/dist/init/index.d.mts +2 -2
- package/dist/init/index.mjs +5 -2
- package/dist/supabaseDatabase-BDIBsXpz.d.cts +13 -0
- package/dist/supabaseDatabase-CP9WalBi.d.mts +13 -0
- package/dist/supabaseStorage-Cw294tR4.mjs +557 -0
- package/dist/supabaseStorage-yP7u4m7E.cjs +568 -0
- package/package.json +9 -9
- package/supabase/edge-functions/index.ts +9 -13
- package/supabase/edge-functions/runtime.docker.integration.spec.ts +417 -202
- package/supabase/migrations/20260818000000_hot-updater_1.0.0.sql +583 -0
- package/supabase/migrations.spec.ts +127 -46
- package/dist/supabaseEdgeFunctionStorage-BRxGvt-r.d.mts +0 -19
- package/dist/supabaseEdgeFunctionStorage-BSLlUeqi.cjs +0 -386
- package/dist/supabaseEdgeFunctionStorage-CU396KO3.d.cts +0 -19
- package/dist/supabaseEdgeFunctionStorage-pV0s_mTF.mjs +0 -356
- package/supabase/migrations/20250103114225_init.sql +0 -228
- package/supabase/migrations/20250314000000_hot-updater_0.13.0.sql +0 -134
- package/supabase/migrations/20250516000000_hot-updater_0.18.0.sql +0 -194
- package/supabase/migrations/20251014000000_hot-updater_0.21.0.sql +0 -184
- package/supabase/migrations/20260401000000_hot-updater_0.29.0.sql +0 -503
- package/supabase/migrations/20260414000000_hot-updater_0.30.0.sql +0 -50
- package/supabase/migrations/20260422000000_hot-updater_0.31.0.sql +0 -20
- package/supabase/migrations/20260520014100_hot-updater_rls.sql +0 -48
package/dist/index.cjs
CHANGED
|
@@ -1,146 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
|
-
const require_supabaseEdgeFunctionStorage = require("./supabaseEdgeFunctionStorage-BSLlUeqi.cjs");
|
|
25
|
-
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
26
|
-
let _supabase_supabase_js = require("@supabase/supabase-js");
|
|
27
|
-
let fs_promises = require("fs/promises");
|
|
28
|
-
fs_promises = __toESM(fs_promises);
|
|
29
|
-
let path = require("path");
|
|
30
|
-
path = __toESM(path);
|
|
31
|
-
//#region src/supabaseStorage.ts
|
|
32
|
-
function getErrorMessage(error) {
|
|
33
|
-
if (error instanceof Error) return error.message;
|
|
34
|
-
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") return error.message;
|
|
35
|
-
return String(error);
|
|
36
|
-
}
|
|
37
|
-
async function createSignedUrlOrThrow({ bucket, key, expiresIn }) {
|
|
38
|
-
let data = null;
|
|
39
|
-
let error = null;
|
|
40
|
-
try {
|
|
41
|
-
const response = await bucket.createSignedUrl(key, expiresIn);
|
|
42
|
-
data = response.data;
|
|
43
|
-
error = response.error;
|
|
44
|
-
} catch (thrownError) {
|
|
45
|
-
error = thrownError;
|
|
46
|
-
}
|
|
47
|
-
if (!error && data?.signedUrl) return data.signedUrl;
|
|
48
|
-
throw new Error(`Failed to generate download URL for "${key}": ${getErrorMessage(error ?? /* @__PURE__ */ new Error("missing signed URL"))}`);
|
|
49
|
-
}
|
|
50
|
-
async function verifyObjectCanBeSignedForRuntime({ bucket, key }) {
|
|
51
|
-
await createSignedUrlOrThrow({
|
|
52
|
-
bucket,
|
|
53
|
-
key,
|
|
54
|
-
expiresIn: 3600
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const parseSupabaseStorageUri = (storageUri) => {
|
|
58
|
-
return (0, _hot_updater_plugin_core.parseStorageUri)(storageUri, "supabase-storage");
|
|
59
|
-
};
|
|
60
|
-
const supabaseStorage = (0, _hot_updater_plugin_core.createUniversalStoragePlugin)({
|
|
61
|
-
name: "supabaseStorage",
|
|
62
|
-
supportedProtocol: "supabase-storage",
|
|
63
|
-
factory: (config) => {
|
|
64
|
-
const bucket = (0, _supabase_supabase_js.createClient)(config.supabaseUrl, require_supabaseEdgeFunctionStorage.resolveSupabaseServiceRoleKey(config)).storage.from(config.bucketName);
|
|
65
|
-
const getStorageKey = (0, _hot_updater_plugin_core.createStorageKeyBuilder)(config.basePath);
|
|
66
|
-
const resolveSignedUrl = require_supabaseEdgeFunctionStorage.createSupabaseSignedUrlBatcher({
|
|
67
|
-
createSignedUrls: (_bucketName, keys, expiresIn) => bucket.createSignedUrls(keys, expiresIn),
|
|
68
|
-
expiresIn: 3600,
|
|
69
|
-
formatObjectPath: (_bucketName, key) => key
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
node: {
|
|
73
|
-
async delete(storageUri) {
|
|
74
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
75
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
76
|
-
const { error } = await bucket.remove([key]);
|
|
77
|
-
if (error) {
|
|
78
|
-
if (error.message?.includes("not found")) throw new Error(`Bundle not found`);
|
|
79
|
-
throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
async upload(key, filePath) {
|
|
83
|
-
const Body = await fs_promises.default.readFile(filePath);
|
|
84
|
-
const ContentType = (0, _hot_updater_plugin_core.getContentType)(filePath);
|
|
85
|
-
const Key = getStorageKey(key, path.default.basename(filePath));
|
|
86
|
-
const upload = await bucket.upload(Key, Body, {
|
|
87
|
-
contentType: ContentType,
|
|
88
|
-
cacheControl: "max-age=31536000",
|
|
89
|
-
headers: {}
|
|
90
|
-
});
|
|
91
|
-
if (upload.error) throw upload.error;
|
|
92
|
-
await verifyObjectCanBeSignedForRuntime({
|
|
93
|
-
bucket,
|
|
94
|
-
key: Key
|
|
95
|
-
});
|
|
96
|
-
return { storageUri: `supabase-storage://${upload.data.fullPath}` };
|
|
97
|
-
},
|
|
98
|
-
async exists(storageUri) {
|
|
99
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
100
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
101
|
-
const { data, error } = await bucket.exists(key);
|
|
102
|
-
if (data === false) return false;
|
|
103
|
-
if (error) throw error;
|
|
104
|
-
await verifyObjectCanBeSignedForRuntime({
|
|
105
|
-
bucket,
|
|
106
|
-
key
|
|
107
|
-
});
|
|
108
|
-
return data;
|
|
109
|
-
},
|
|
110
|
-
async downloadFile(storageUri, filePath) {
|
|
111
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
112
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
113
|
-
const { data, error } = await bucket.download(key);
|
|
114
|
-
if (error) throw new Error(`Failed to download bundle: ${error.message}`);
|
|
115
|
-
if (!data) throw new Error("Failed to download bundle");
|
|
116
|
-
await fs_promises.default.mkdir(path.default.dirname(filePath), { recursive: true });
|
|
117
|
-
await fs_promises.default.writeFile(filePath, new Uint8Array(await data.arrayBuffer()));
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
runtime: {
|
|
121
|
-
async readText(storageUri) {
|
|
122
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
123
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
124
|
-
const { data, error } = await bucket.download(key);
|
|
125
|
-
if (error) {
|
|
126
|
-
if (error.message?.includes("not found")) return null;
|
|
127
|
-
throw new Error(`Failed to read storage text: ${error.message}`);
|
|
128
|
-
}
|
|
129
|
-
if (!data) return null;
|
|
130
|
-
return data.text();
|
|
131
|
-
},
|
|
132
|
-
async getDownloadUrl(storageUri) {
|
|
133
|
-
const { bucket: bucketName, key } = parseSupabaseStorageUri(storageUri);
|
|
134
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
135
|
-
return { fileUrl: await resolveSignedUrl(config.bucketName, key) };
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
//#endregion
|
|
142
|
-
exports.__toESM = __toESM;
|
|
143
|
-
exports.supabaseDatabase = require_supabaseEdgeFunctionStorage.supabaseDatabase;
|
|
144
|
-
exports.supabaseEdgeFunctionDatabase = require_supabaseEdgeFunctionStorage.supabaseEdgeFunctionDatabase;
|
|
145
|
-
exports.supabaseEdgeFunctionStorage = require_supabaseEdgeFunctionStorage.supabaseEdgeFunctionStorage;
|
|
146
|
-
exports.supabaseStorage = supabaseStorage;
|
|
2
|
+
const require_supabaseStorage = require("./supabaseStorage-yP7u4m7E.cjs");
|
|
3
|
+
exports.supabaseDatabase = require_supabaseStorage.supabaseDatabase;
|
|
4
|
+
exports.supabaseStorage = require_supabaseStorage.supabaseStorage;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { n as supabaseDatabase, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-BDIBsXpz.cjs";
|
|
2
|
+
import { StoragePluginWith } from "@hot-updater/plugin-core";
|
|
3
3
|
|
|
4
|
-
//#region src/supabaseConfig.d.ts
|
|
5
|
-
type SupabaseServiceRoleConfig = {
|
|
6
|
-
supabaseUrl: string;
|
|
7
|
-
supabaseServiceRoleKey: string;
|
|
8
|
-
supabaseAnonKey?: string;
|
|
9
|
-
} | {
|
|
10
|
-
supabaseUrl: string;
|
|
11
|
-
supabaseAnonKey: string;
|
|
12
|
-
supabaseServiceRoleKey?: string;
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/supabaseDatabase.d.ts
|
|
16
|
-
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
17
|
-
declare const supabaseDatabase: (config: SupabaseServiceRoleConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
|
|
18
|
-
//#endregion
|
|
19
4
|
//#region src/supabaseStorage.d.ts
|
|
20
5
|
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
21
|
-
bucketName: string;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
basePath?: string;
|
|
6
|
+
bucketName: string; /** Base path where bundles will be stored in the bucket. */
|
|
7
|
+
basePath?: string; /** Signed download URL lifetime in seconds. @default 3600 */
|
|
8
|
+
signedUrlExpiresIn?: number;
|
|
26
9
|
};
|
|
27
|
-
declare const supabaseStorage: (config: SupabaseStorageConfig
|
|
10
|
+
declare const supabaseStorage: (config: SupabaseStorageConfig) => StoragePluginWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
28
11
|
//#endregion
|
|
29
|
-
export { SupabaseDatabaseConfig,
|
|
12
|
+
export { SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { n as supabaseDatabase, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-CP9WalBi.mjs";
|
|
2
|
+
import { StoragePluginWith } from "@hot-updater/plugin-core";
|
|
3
3
|
|
|
4
|
-
//#region src/supabaseConfig.d.ts
|
|
5
|
-
type SupabaseServiceRoleConfig = {
|
|
6
|
-
supabaseUrl: string;
|
|
7
|
-
supabaseServiceRoleKey: string;
|
|
8
|
-
supabaseAnonKey?: string;
|
|
9
|
-
} | {
|
|
10
|
-
supabaseUrl: string;
|
|
11
|
-
supabaseAnonKey: string;
|
|
12
|
-
supabaseServiceRoleKey?: string;
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/supabaseDatabase.d.ts
|
|
16
|
-
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
17
|
-
declare const supabaseDatabase: (config: SupabaseServiceRoleConfig, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
|
|
18
|
-
//#endregion
|
|
19
4
|
//#region src/supabaseStorage.d.ts
|
|
20
5
|
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
21
|
-
bucketName: string;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
basePath?: string;
|
|
6
|
+
bucketName: string; /** Base path where bundles will be stored in the bucket. */
|
|
7
|
+
basePath?: string; /** Signed download URL lifetime in seconds. @default 3600 */
|
|
8
|
+
signedUrlExpiresIn?: number;
|
|
26
9
|
};
|
|
27
|
-
declare const supabaseStorage: (config: SupabaseStorageConfig
|
|
10
|
+
declare const supabaseStorage: (config: SupabaseStorageConfig) => StoragePluginWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
28
11
|
//#endregion
|
|
29
|
-
export { SupabaseDatabaseConfig,
|
|
12
|
+
export { SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/index.mjs
CHANGED
|
@@ -1,117 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { createClient } from "@supabase/supabase-js";
|
|
4
|
-
import fs from "fs/promises";
|
|
5
|
-
import path from "path";
|
|
6
|
-
//#region src/supabaseStorage.ts
|
|
7
|
-
function getErrorMessage(error) {
|
|
8
|
-
if (error instanceof Error) return error.message;
|
|
9
|
-
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") return error.message;
|
|
10
|
-
return String(error);
|
|
11
|
-
}
|
|
12
|
-
async function createSignedUrlOrThrow({ bucket, key, expiresIn }) {
|
|
13
|
-
let data = null;
|
|
14
|
-
let error = null;
|
|
15
|
-
try {
|
|
16
|
-
const response = await bucket.createSignedUrl(key, expiresIn);
|
|
17
|
-
data = response.data;
|
|
18
|
-
error = response.error;
|
|
19
|
-
} catch (thrownError) {
|
|
20
|
-
error = thrownError;
|
|
21
|
-
}
|
|
22
|
-
if (!error && data?.signedUrl) return data.signedUrl;
|
|
23
|
-
throw new Error(`Failed to generate download URL for "${key}": ${getErrorMessage(error ?? /* @__PURE__ */ new Error("missing signed URL"))}`);
|
|
24
|
-
}
|
|
25
|
-
async function verifyObjectCanBeSignedForRuntime({ bucket, key }) {
|
|
26
|
-
await createSignedUrlOrThrow({
|
|
27
|
-
bucket,
|
|
28
|
-
key,
|
|
29
|
-
expiresIn: 3600
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const parseSupabaseStorageUri = (storageUri) => {
|
|
33
|
-
return parseStorageUri(storageUri, "supabase-storage");
|
|
34
|
-
};
|
|
35
|
-
const supabaseStorage = createUniversalStoragePlugin({
|
|
36
|
-
name: "supabaseStorage",
|
|
37
|
-
supportedProtocol: "supabase-storage",
|
|
38
|
-
factory: (config) => {
|
|
39
|
-
const bucket = createClient(config.supabaseUrl, resolveSupabaseServiceRoleKey(config)).storage.from(config.bucketName);
|
|
40
|
-
const getStorageKey = createStorageKeyBuilder(config.basePath);
|
|
41
|
-
const resolveSignedUrl = createSupabaseSignedUrlBatcher({
|
|
42
|
-
createSignedUrls: (_bucketName, keys, expiresIn) => bucket.createSignedUrls(keys, expiresIn),
|
|
43
|
-
expiresIn: 3600,
|
|
44
|
-
formatObjectPath: (_bucketName, key) => key
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
node: {
|
|
48
|
-
async delete(storageUri) {
|
|
49
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
50
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
51
|
-
const { error } = await bucket.remove([key]);
|
|
52
|
-
if (error) {
|
|
53
|
-
if (error.message?.includes("not found")) throw new Error(`Bundle not found`);
|
|
54
|
-
throw new Error(`Failed to delete bundle: ${error.message}`);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
async upload(key, filePath) {
|
|
58
|
-
const Body = await fs.readFile(filePath);
|
|
59
|
-
const ContentType = getContentType(filePath);
|
|
60
|
-
const Key = getStorageKey(key, path.basename(filePath));
|
|
61
|
-
const upload = await bucket.upload(Key, Body, {
|
|
62
|
-
contentType: ContentType,
|
|
63
|
-
cacheControl: "max-age=31536000",
|
|
64
|
-
headers: {}
|
|
65
|
-
});
|
|
66
|
-
if (upload.error) throw upload.error;
|
|
67
|
-
await verifyObjectCanBeSignedForRuntime({
|
|
68
|
-
bucket,
|
|
69
|
-
key: Key
|
|
70
|
-
});
|
|
71
|
-
return { storageUri: `supabase-storage://${upload.data.fullPath}` };
|
|
72
|
-
},
|
|
73
|
-
async exists(storageUri) {
|
|
74
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
75
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
76
|
-
const { data, error } = await bucket.exists(key);
|
|
77
|
-
if (data === false) return false;
|
|
78
|
-
if (error) throw error;
|
|
79
|
-
await verifyObjectCanBeSignedForRuntime({
|
|
80
|
-
bucket,
|
|
81
|
-
key
|
|
82
|
-
});
|
|
83
|
-
return data;
|
|
84
|
-
},
|
|
85
|
-
async downloadFile(storageUri, filePath) {
|
|
86
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
87
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
88
|
-
const { data, error } = await bucket.download(key);
|
|
89
|
-
if (error) throw new Error(`Failed to download bundle: ${error.message}`);
|
|
90
|
-
if (!data) throw new Error("Failed to download bundle");
|
|
91
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
92
|
-
await fs.writeFile(filePath, new Uint8Array(await data.arrayBuffer()));
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
runtime: {
|
|
96
|
-
async readText(storageUri) {
|
|
97
|
-
const { key, bucket: bucketName } = parseSupabaseStorageUri(storageUri);
|
|
98
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
99
|
-
const { data, error } = await bucket.download(key);
|
|
100
|
-
if (error) {
|
|
101
|
-
if (error.message?.includes("not found")) return null;
|
|
102
|
-
throw new Error(`Failed to read storage text: ${error.message}`);
|
|
103
|
-
}
|
|
104
|
-
if (!data) return null;
|
|
105
|
-
return data.text();
|
|
106
|
-
},
|
|
107
|
-
async getDownloadUrl(storageUri) {
|
|
108
|
-
const { bucket: bucketName, key } = parseSupabaseStorageUri(storageUri);
|
|
109
|
-
if (bucketName !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${bucketName}".`);
|
|
110
|
-
return { fileUrl: await resolveSignedUrl(config.bucketName, key) };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
//#endregion
|
|
117
|
-
export { supabaseDatabase, supabaseEdgeFunctionDatabase, supabaseEdgeFunctionStorage, supabaseStorage };
|
|
1
|
+
import { n as supabaseDatabase, t as supabaseStorage } from "./supabaseStorage-Cw294tR4.mjs";
|
|
2
|
+
export { supabaseDatabase, supabaseStorage };
|
package/dist/init/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/supabaseInfrastructureNames.ts
|
|
3
|
+
const SUPABASE_V1_FUNCTION_NAME = "hot-updater-v1";
|
|
4
|
+
//#endregion
|
|
2
5
|
//#region iac/init/index.ts
|
|
3
6
|
const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
|
|
4
7
|
const SUPABASE_REGION_VALUES = [
|
|
@@ -85,9 +88,9 @@ const initProvider = {
|
|
|
85
88
|
envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME",
|
|
86
89
|
help: "Edge Function name",
|
|
87
90
|
prompt: {
|
|
88
|
-
defaultValue:
|
|
91
|
+
defaultValue: SUPABASE_V1_FUNCTION_NAME,
|
|
89
92
|
message: "Enter a name for the edge function",
|
|
90
|
-
placeholder:
|
|
93
|
+
placeholder: SUPABASE_V1_FUNCTION_NAME,
|
|
91
94
|
type: "text"
|
|
92
95
|
},
|
|
93
96
|
validate: isSupabaseFunctionName
|
package/dist/init/index.d.cts
CHANGED
|
@@ -66,9 +66,9 @@ declare const initProvider: {
|
|
|
66
66
|
readonly envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME";
|
|
67
67
|
readonly help: "Edge Function name";
|
|
68
68
|
readonly prompt: {
|
|
69
|
-
readonly defaultValue: "
|
|
69
|
+
readonly defaultValue: "hot-updater-v1";
|
|
70
70
|
readonly message: "Enter a name for the edge function";
|
|
71
|
-
readonly placeholder: "
|
|
71
|
+
readonly placeholder: "hot-updater-v1";
|
|
72
72
|
readonly type: "text";
|
|
73
73
|
};
|
|
74
74
|
readonly validate: (value: string | undefined) => value is string;
|
package/dist/init/index.d.mts
CHANGED
|
@@ -66,9 +66,9 @@ declare const initProvider: {
|
|
|
66
66
|
readonly envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME";
|
|
67
67
|
readonly help: "Edge Function name";
|
|
68
68
|
readonly prompt: {
|
|
69
|
-
readonly defaultValue: "
|
|
69
|
+
readonly defaultValue: "hot-updater-v1";
|
|
70
70
|
readonly message: "Enter a name for the edge function";
|
|
71
|
-
readonly placeholder: "
|
|
71
|
+
readonly placeholder: "hot-updater-v1";
|
|
72
72
|
readonly type: "text";
|
|
73
73
|
};
|
|
74
74
|
readonly validate: (value: string | undefined) => value is string;
|
package/dist/init/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
//#region src/supabaseInfrastructureNames.ts
|
|
2
|
+
const SUPABASE_V1_FUNCTION_NAME = "hot-updater-v1";
|
|
3
|
+
//#endregion
|
|
1
4
|
//#region iac/init/index.ts
|
|
2
5
|
const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
|
|
3
6
|
const SUPABASE_REGION_VALUES = [
|
|
@@ -84,9 +87,9 @@ const initProvider = {
|
|
|
84
87
|
envKey: "HOT_UPDATER_SUPABASE_FUNCTION_NAME",
|
|
85
88
|
help: "Edge Function name",
|
|
86
89
|
prompt: {
|
|
87
|
-
defaultValue:
|
|
90
|
+
defaultValue: SUPABASE_V1_FUNCTION_NAME,
|
|
88
91
|
message: "Enter a name for the edge function",
|
|
89
|
-
placeholder:
|
|
92
|
+
placeholder: SUPABASE_V1_FUNCTION_NAME,
|
|
90
93
|
type: "text"
|
|
91
94
|
},
|
|
92
95
|
validate: isSupabaseFunctionName
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
|
|
2
|
+
|
|
3
|
+
//#region src/supabaseConfig.d.ts
|
|
4
|
+
type SupabaseServiceRoleConfig = {
|
|
5
|
+
supabaseUrl: string;
|
|
6
|
+
supabaseServiceRoleKey: string;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/supabaseDatabase.d.ts
|
|
10
|
+
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
11
|
+
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => _$_hot_updater_plugin_core0.DatabasePlugin;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { supabaseDatabase as n, SupabaseServiceRoleConfig as r, SupabaseDatabaseConfig as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
|
|
2
|
+
|
|
3
|
+
//#region src/supabaseConfig.d.ts
|
|
4
|
+
type SupabaseServiceRoleConfig = {
|
|
5
|
+
supabaseUrl: string;
|
|
6
|
+
supabaseServiceRoleKey: string;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/supabaseDatabase.d.ts
|
|
10
|
+
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
11
|
+
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => _$_hot_updater_plugin_core0.DatabasePlugin;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { supabaseDatabase as n, SupabaseServiceRoleConfig as r, SupabaseDatabaseConfig as t };
|