@hot-updater/supabase 1.0.0-rc.44 → 1.0.0-rc.46
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 +3 -7
- package/dist/edge.d.cts +2 -13
- package/dist/edge.d.mts +2 -13
- package/dist/edge.mjs +2 -5
- package/dist/index.cjs +10 -11
- package/dist/index.d.cts +3 -13
- package/dist/index.d.mts +3 -13
- package/dist/index.mjs +2 -2
- package/dist/init/index.cjs +13 -13
- package/dist/init/index.mjs +13 -13
- package/dist/supabaseStorage-BryXQ72m.d.cts +28 -0
- package/dist/supabaseStorage-BryXQ72m.d.mts +28 -0
- package/dist/{plugins-CgGacXOe.mjs → supabaseStorage-C8xQ3nyM.mjs} +1 -13
- package/dist/{plugins-DRcrMSAn.cjs → supabaseStorage-DAl3pyb7.cjs} +0 -18
- package/package.json +8 -8
- package/supabase/edge-functions/index.ts +3 -6
- package/dist/supabaseDatabase-DV5XdQWp.d.cts +0 -1032
- package/dist/supabaseDatabase-DV5XdQWp.d.mts +0 -1032
package/dist/edge.cjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#endregion
|
|
6
|
-
exports.plugins = require_plugins.plugins;
|
|
7
|
-
exports.supabaseDatabase = require_plugins.supabaseDatabase;
|
|
8
|
-
exports.supabaseStorage = supabaseEdgeFunctionStorage;
|
|
2
|
+
const require_supabaseStorage = require("./supabaseStorage-DAl3pyb7.cjs");
|
|
3
|
+
exports.supabaseDatabase = require_supabaseStorage.supabaseDatabase;
|
|
4
|
+
exports.supabaseStorage = require_supabaseStorage.supabaseStorage;
|
package/dist/edge.d.cts
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
|
|
3
|
-
//#region src/supabaseEdgeFunctionStorage.d.ts
|
|
4
|
-
interface SupabaseEdgeFunctionStorageConfig {
|
|
5
|
-
supabaseUrl: string;
|
|
6
|
-
supabaseServiceRoleKey: string;
|
|
7
|
-
bucketName: string;
|
|
8
|
-
basePath?: string;
|
|
9
|
-
signedUrlExpiresIn?: number;
|
|
10
|
-
}
|
|
11
|
-
declare const supabaseEdgeFunctionStorage: (config: SupabaseEdgeFunctionStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
|
|
1
|
+
import { i as supabaseDatabase, n as supabaseStorage, r as SupabaseDatabaseConfig, t as SupabaseStorageConfig } from "./supabaseStorage-BryXQ72m.cjs";
|
|
2
|
+
export { type SupabaseDatabaseConfig, type SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/edge.d.mts
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
|
|
3
|
-
//#region src/supabaseEdgeFunctionStorage.d.ts
|
|
4
|
-
interface SupabaseEdgeFunctionStorageConfig {
|
|
5
|
-
supabaseUrl: string;
|
|
6
|
-
supabaseServiceRoleKey: string;
|
|
7
|
-
bucketName: string;
|
|
8
|
-
basePath?: string;
|
|
9
|
-
signedUrlExpiresIn?: number;
|
|
10
|
-
}
|
|
11
|
-
declare const supabaseEdgeFunctionStorage: (config: SupabaseEdgeFunctionStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
|
|
1
|
+
import { i as supabaseDatabase, n as supabaseStorage, r as SupabaseDatabaseConfig, t as SupabaseStorageConfig } from "./supabaseStorage-BryXQ72m.mjs";
|
|
2
|
+
export { type SupabaseDatabaseConfig, type SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/edge.mjs
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
const supabaseEdgeFunctionStorage = (config) => supabaseStorage(config);
|
|
4
|
-
//#endregion
|
|
5
|
-
export { plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
|
|
1
|
+
import { n as supabaseDatabase, t as supabaseStorage } from "./supabaseStorage-C8xQ3nyM.mjs";
|
|
2
|
+
export { supabaseDatabase, supabaseStorage };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_supabaseStorage = require("./supabaseStorage-DAl3pyb7.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. */
|
|
@@ -7,7 +7,7 @@ const supabaseTableNames = (schema = _hot_updater_plugin_core.coreTarget.schema)
|
|
|
7
7
|
...schema.tables.flatMap((table) => [table.name, ...table.indexes.filter((index) => (0, _hot_updater_plugin_core.isMultiIndex)(table, index)).map((index) => `${table.name}__${index.name}`)]),
|
|
8
8
|
_hot_updater_plugin_core.SETTINGS_TABLE.name,
|
|
9
9
|
_hot_updater_plugin_core.WRITE_GUARD_TABLE.name
|
|
10
|
-
].map((name) =>
|
|
10
|
+
].map((name) => require_supabaseStorage.SUPABASE_TABLE_PREFIX + name);
|
|
11
11
|
/** The words the SQL core's statements use besides quoted names, numbers, and operators. */
|
|
12
12
|
const KEYWORDS = [
|
|
13
13
|
"SELECT",
|
|
@@ -51,7 +51,7 @@ const literal = (value) => `'${value.replaceAll("'", "''")}'`;
|
|
|
51
51
|
* statement each, no literal, comment, or function call, and no word the
|
|
52
52
|
* core does not write.
|
|
53
53
|
*/
|
|
54
|
-
const applyFunction = (tables) => `CREATE OR REPLACE FUNCTION public.${
|
|
54
|
+
const applyFunction = (tables) => `CREATE OR REPLACE FUNCTION public.${require_supabaseStorage.SUPABASE_APPLY_FUNCTION}(p_statements jsonb)
|
|
55
55
|
RETURNS jsonb
|
|
56
56
|
LANGUAGE plpgsql
|
|
57
57
|
SECURITY INVOKER
|
|
@@ -71,7 +71,7 @@ BEGIN
|
|
|
71
71
|
statement := item->>'sql';
|
|
72
72
|
FOR target IN SELECT (regexp_matches(statement, '(?:FROM|INTO|UPDATE|JOIN) "([^"]+)"', 'g'))[1] LOOP
|
|
73
73
|
IF NOT target = ANY (ARRAY[${tables.map(literal).join(", ")}]) THEN
|
|
74
|
-
RAISE EXCEPTION '${
|
|
74
|
+
RAISE EXCEPTION '${require_supabaseStorage.SUPABASE_APPLY_FUNCTION}: % is not a Hot Updater table', target USING ERRCODE = '42501';
|
|
75
75
|
END IF;
|
|
76
76
|
END LOOP;
|
|
77
77
|
shape := regexp_replace(regexp_replace(statement, '^INSERT INTO "[^"]+" \\(', 'INSERT INTO ('), '"[^"]*"', '"', 'g');
|
|
@@ -79,7 +79,7 @@ BEGIN
|
|
|
79
79
|
OR shape ~ '"[[:space:]]*\\('
|
|
80
80
|
OR shape ~ '[;''\\\\]|--|/\\*'
|
|
81
81
|
OR regexp_replace(shape, '\\m(${KEYWORDS.join("|")})\\M', '', 'gi') !~ '^[[:space:]"(),.*=<>+0-9$:-]*$' THEN
|
|
82
|
-
RAISE EXCEPTION '${
|
|
82
|
+
RAISE EXCEPTION '${require_supabaseStorage.SUPABASE_APPLY_FUNCTION}: statement not allowed' USING ERRCODE = '42501';
|
|
83
83
|
END IF;
|
|
84
84
|
IF statement ~ '^SELECT ' THEN
|
|
85
85
|
rows := '[]'::jsonb;
|
|
@@ -104,12 +104,12 @@ $apply$`;
|
|
|
104
104
|
* for a server's plugin tables repeats core's.
|
|
105
105
|
*/
|
|
106
106
|
const supabaseSchemaStatements = ({ schema, settings: expected } = _hot_updater_plugin_core.coreTarget) => {
|
|
107
|
-
const engine = (0, _hot_updater_plugin_core.generateEngineSql)("postgresql", schema, expected, { tablePrefix:
|
|
107
|
+
const engine = (0, _hot_updater_plugin_core.generateEngineSql)("postgresql", schema, expected, { tablePrefix: require_supabaseStorage.SUPABASE_TABLE_PREFIX });
|
|
108
108
|
const settings = engine.slice(-Object.keys(expected).length);
|
|
109
109
|
const tables = supabaseTableNames(schema);
|
|
110
|
-
const apply = `public.${
|
|
110
|
+
const apply = `public.${require_supabaseStorage.SUPABASE_APPLY_FUNCTION}(jsonb)`;
|
|
111
111
|
return [
|
|
112
|
-
...(0, _hot_updater_plugin_core.createTableStatements)("postgresql", [_hot_updater_plugin_core.WRITE_GUARD_TABLE],
|
|
112
|
+
...(0, _hot_updater_plugin_core.createTableStatements)("postgresql", [_hot_updater_plugin_core.WRITE_GUARD_TABLE], require_supabaseStorage.SUPABASE_TABLE_PREFIX),
|
|
113
113
|
...engine.slice(0, -settings.length),
|
|
114
114
|
...tables.map((table) => `ALTER TABLE "${table}" ENABLE ROW LEVEL SECURITY`),
|
|
115
115
|
applyFunction(tables),
|
|
@@ -128,7 +128,7 @@ const supabaseSchemaSql = (target) => `-- HotUpdater.schema\n\n${supabaseSchemaS
|
|
|
128
128
|
* `supabase db push` applies it.
|
|
129
129
|
*/
|
|
130
130
|
const supabaseDatabase = (config) => ({
|
|
131
|
-
...
|
|
131
|
+
...require_supabaseStorage.supabaseDatabase(config),
|
|
132
132
|
generateSchema: ((version, _name, target = _hot_updater_plugin_core.coreTarget) => {
|
|
133
133
|
if (version !== "latest" && version !== _hot_updater_plugin_core.coreSettings["schema.core"]) throw new Error(`Invalid version ${version}`);
|
|
134
134
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/\D/g, "").slice(0, 14);
|
|
@@ -139,6 +139,5 @@ const supabaseDatabase = (config) => ({
|
|
|
139
139
|
})
|
|
140
140
|
});
|
|
141
141
|
//#endregion
|
|
142
|
-
exports.plugins = require_plugins.plugins;
|
|
143
142
|
exports.supabaseDatabase = supabaseDatabase;
|
|
144
|
-
exports.supabaseStorage =
|
|
143
|
+
exports.supabaseStorage = require_supabaseStorage.supabaseStorage;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as supabaseStorage, r as SupabaseDatabaseConfig, t as SupabaseStorageConfig } from "./supabaseStorage-BryXQ72m.cjs";
|
|
2
|
+
import { ToolingDatabase } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseMigration.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Hot Updater's database on Supabase, with the migration `hot-updater db
|
|
@@ -9,14 +9,4 @@ import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
|
9
9
|
*/
|
|
10
10
|
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => ToolingDatabase;
|
|
11
11
|
//#endregion
|
|
12
|
-
|
|
13
|
-
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
14
|
-
bucketName: string;
|
|
15
|
-
/** Base path where bundles will be stored in the bucket. */
|
|
16
|
-
basePath?: string;
|
|
17
|
-
/** Signed download URL lifetime in seconds. @default 3600 */
|
|
18
|
-
signedUrlExpiresIn?: number;
|
|
19
|
-
};
|
|
20
|
-
declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { type SupabaseDatabaseConfig, SupabaseStorageConfig, plugins, supabaseDatabase, supabaseStorage };
|
|
12
|
+
export { type SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as supabaseStorage, r as SupabaseDatabaseConfig, t as SupabaseStorageConfig } from "./supabaseStorage-BryXQ72m.mjs";
|
|
2
|
+
import { ToolingDatabase } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseMigration.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Hot Updater's database on Supabase, with the migration `hot-updater db
|
|
@@ -9,14 +9,4 @@ import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
|
9
9
|
*/
|
|
10
10
|
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => ToolingDatabase;
|
|
11
11
|
//#endregion
|
|
12
|
-
|
|
13
|
-
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
14
|
-
bucketName: string;
|
|
15
|
-
/** Base path where bundles will be stored in the bucket. */
|
|
16
|
-
basePath?: string;
|
|
17
|
-
/** Signed download URL lifetime in seconds. @default 3600 */
|
|
18
|
-
signedUrlExpiresIn?: number;
|
|
19
|
-
};
|
|
20
|
-
declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { type SupabaseDatabaseConfig, SupabaseStorageConfig, plugins, supabaseDatabase, supabaseStorage };
|
|
12
|
+
export { type SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as SUPABASE_TABLE_PREFIX, n as supabaseDatabase$1, r as SUPABASE_APPLY_FUNCTION, t as supabaseStorage } from "./supabaseStorage-C8xQ3nyM.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. */
|
|
@@ -138,4 +138,4 @@ const supabaseDatabase = (config) => ({
|
|
|
138
138
|
})
|
|
139
139
|
});
|
|
140
140
|
//#endregion
|
|
141
|
-
export {
|
|
141
|
+
export { supabaseDatabase, supabaseStorage };
|
package/dist/init/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ let node_module = require("node:module");
|
|
|
28
28
|
let path = require("path");
|
|
29
29
|
path = __toESM(path, 1);
|
|
30
30
|
let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
31
|
+
let _hot_updater_server_plugins = require("@hot-updater/server/plugins");
|
|
31
32
|
let node_url = require("node:url");
|
|
32
33
|
let node_child_process = require("node:child_process");
|
|
33
34
|
let node_string_decoder = require("node:string_decoder");
|
|
@@ -46,7 +47,6 @@ let node_fs = require("node:fs");
|
|
|
46
47
|
let node_stream_promises = require("node:stream/promises");
|
|
47
48
|
let node_stream = require("node:stream");
|
|
48
49
|
let node_buffer = require("node:buffer");
|
|
49
|
-
let _hot_updater_server_plugins = require("@hot-updater/server/plugins");
|
|
50
50
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
51
51
|
let _supabase_supabase_js = require("@supabase/supabase-js");
|
|
52
52
|
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
|
|
@@ -6332,17 +6332,6 @@ createExeca(mapNode);
|
|
|
6332
6332
|
createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
6333
6333
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6334
6334
|
//#endregion
|
|
6335
|
-
//#region src/plugins.ts
|
|
6336
|
-
/**
|
|
6337
|
-
* The plugins the managed Supabase server runs: Insights, API keys on every
|
|
6338
|
-
* client route, and Remote Config. Its Edge Function imports this list.
|
|
6339
|
-
*/
|
|
6340
|
-
const plugins = [
|
|
6341
|
-
(0, _hot_updater_server_plugins.insights)(),
|
|
6342
|
-
(0, _hot_updater_server_plugins.apiKeys)(),
|
|
6343
|
-
(0, _hot_updater_server_plugins.remoteConfig)()
|
|
6344
|
-
];
|
|
6345
|
-
//#endregion
|
|
6346
6335
|
//#region src/supabaseConfig.ts
|
|
6347
6336
|
const resolveSupabaseServiceRoleKey = (config) => {
|
|
6348
6337
|
if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
|
|
@@ -7223,6 +7212,13 @@ const buildEdgeFunctionImports = async (targetDir) => {
|
|
|
7223
7212
|
const edgeFunctionSpecifiers = await collectBareImportSpecifiers(edgeFunctionEntryPath);
|
|
7224
7213
|
for (const specifier of edgeFunctionSpecifiers) {
|
|
7225
7214
|
if (imports[specifier]) continue;
|
|
7215
|
+
if (specifier.startsWith(WORKSPACE_PACKAGE_PREFIX)) {
|
|
7216
|
+
await addWorkspacePackage({
|
|
7217
|
+
...workspaceImport(specifier),
|
|
7218
|
+
searchFrom: supabasePackage.packageRoot
|
|
7219
|
+
});
|
|
7220
|
+
continue;
|
|
7221
|
+
}
|
|
7226
7222
|
imports[specifier] = await resolveBareSpecifierImportTarget(specifier, supabasePackage.packageRoot);
|
|
7227
7223
|
}
|
|
7228
7224
|
}
|
|
@@ -7642,7 +7638,11 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
|
|
|
7642
7638
|
});
|
|
7643
7639
|
const managedServer = (0, _hot_updater_cli_tools.assembleServer)({
|
|
7644
7640
|
database,
|
|
7645
|
-
plugins
|
|
7641
|
+
plugins: [
|
|
7642
|
+
(0, _hot_updater_server_plugins.insights)(),
|
|
7643
|
+
(0, _hot_updater_server_plugins.apiKeys)(),
|
|
7644
|
+
(0, _hot_updater_server_plugins.remoteConfig)()
|
|
7645
|
+
]
|
|
7646
7646
|
});
|
|
7647
7647
|
({clientPlugins} = managedServer);
|
|
7648
7648
|
try {
|
package/dist/init/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import fs from "fs/promises";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { ConfigBuilder, InitError, MissingInitInputsError, assembleServer, assertInfrastructureGenerationAtUrl, assertInitInputs, assertInitProviderInputs, confirmInitInputPersistence, copyDirToTmp, createHotUpdaterConfigScaffoldFromBuilder, getHotUpdaterEnvValue, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, link, makeEnv, moduleSpecifiersOf, p, printAppSetup, provisionClientCredential, readHotUpdaterInitEnv, resolveInitProviderInput, resolvePackageVersion, transformEnv, transformTemplate, writeHotUpdaterFiles } from "@hot-updater/cli-tools";
|
|
5
|
+
import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
7
8
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -17,7 +18,6 @@ import { appendFileSync, createReadStream, createWriteStream, readFileSync, stat
|
|
|
17
18
|
import { finished } from "node:stream/promises";
|
|
18
19
|
import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
19
20
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
20
|
-
import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
|
|
21
21
|
import { SETTINGS_TABLE, createEngineDatabase, createSqlAdapter } from "@hot-updater/plugin-core";
|
|
22
22
|
import { createClient } from "@supabase/supabase-js";
|
|
23
23
|
//#region \0rolldown/runtime.js
|
|
@@ -6327,17 +6327,6 @@ createExeca(mapNode);
|
|
|
6327
6327
|
createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
6328
6328
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6329
6329
|
//#endregion
|
|
6330
|
-
//#region src/plugins.ts
|
|
6331
|
-
/**
|
|
6332
|
-
* The plugins the managed Supabase server runs: Insights, API keys on every
|
|
6333
|
-
* client route, and Remote Config. Its Edge Function imports this list.
|
|
6334
|
-
*/
|
|
6335
|
-
const plugins = [
|
|
6336
|
-
insights(),
|
|
6337
|
-
apiKeys(),
|
|
6338
|
-
remoteConfig()
|
|
6339
|
-
];
|
|
6340
|
-
//#endregion
|
|
6341
6330
|
//#region src/supabaseConfig.ts
|
|
6342
6331
|
const resolveSupabaseServiceRoleKey = (config) => {
|
|
6343
6332
|
if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
|
|
@@ -7218,6 +7207,13 @@ const buildEdgeFunctionImports = async (targetDir) => {
|
|
|
7218
7207
|
const edgeFunctionSpecifiers = await collectBareImportSpecifiers(edgeFunctionEntryPath);
|
|
7219
7208
|
for (const specifier of edgeFunctionSpecifiers) {
|
|
7220
7209
|
if (imports[specifier]) continue;
|
|
7210
|
+
if (specifier.startsWith(WORKSPACE_PACKAGE_PREFIX)) {
|
|
7211
|
+
await addWorkspacePackage({
|
|
7212
|
+
...workspaceImport(specifier),
|
|
7213
|
+
searchFrom: supabasePackage.packageRoot
|
|
7214
|
+
});
|
|
7215
|
+
continue;
|
|
7216
|
+
}
|
|
7221
7217
|
imports[specifier] = await resolveBareSpecifierImportTarget(specifier, supabasePackage.packageRoot);
|
|
7222
7218
|
}
|
|
7223
7219
|
}
|
|
@@ -7637,7 +7633,11 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
|
|
|
7637
7633
|
});
|
|
7638
7634
|
const managedServer = assembleServer({
|
|
7639
7635
|
database,
|
|
7640
|
-
plugins
|
|
7636
|
+
plugins: [
|
|
7637
|
+
insights(),
|
|
7638
|
+
apiKeys(),
|
|
7639
|
+
remoteConfig()
|
|
7640
|
+
]
|
|
7641
7641
|
});
|
|
7642
7642
|
({clientPlugins} = managedServer);
|
|
7643
7643
|
try {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EngineDatabase, StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
2
|
+
//#region src/supabaseConfig.d.ts
|
|
3
|
+
type SupabaseServiceRoleConfig = {
|
|
4
|
+
supabaseUrl: string;
|
|
5
|
+
supabaseServiceRoleKey: string;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/supabaseDatabase.d.ts
|
|
9
|
+
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Hot Updater's database on Supabase: the storage engine through the shared
|
|
12
|
+
* SQL core, fenced by the schema settings. Every read and write goes through
|
|
13
|
+
* the service-role-only apply RPC, which runs no DDL, so Supabase migrations
|
|
14
|
+
* create the tables.
|
|
15
|
+
*/
|
|
16
|
+
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => EngineDatabase;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/supabaseStorage.d.ts
|
|
19
|
+
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
20
|
+
bucketName: string;
|
|
21
|
+
/** Base path where bundles will be stored in the bucket. */
|
|
22
|
+
basePath?: string;
|
|
23
|
+
/** Signed download URL lifetime in seconds. @default 3600 */
|
|
24
|
+
signedUrlExpiresIn?: number;
|
|
25
|
+
};
|
|
26
|
+
declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { supabaseDatabase as i, supabaseStorage as n, SupabaseDatabaseConfig as r, SupabaseStorageConfig as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EngineDatabase, StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
2
|
+
//#region src/supabaseConfig.d.ts
|
|
3
|
+
type SupabaseServiceRoleConfig = {
|
|
4
|
+
supabaseUrl: string;
|
|
5
|
+
supabaseServiceRoleKey: string;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/supabaseDatabase.d.ts
|
|
9
|
+
type SupabaseDatabaseConfig = SupabaseServiceRoleConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Hot Updater's database on Supabase: the storage engine through the shared
|
|
12
|
+
* SQL core, fenced by the schema settings. Every read and write goes through
|
|
13
|
+
* the service-role-only apply RPC, which runs no DDL, so Supabase migrations
|
|
14
|
+
* create the tables.
|
|
15
|
+
*/
|
|
16
|
+
declare const supabaseDatabase: (config: SupabaseDatabaseConfig) => EngineDatabase;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/supabaseStorage.d.ts
|
|
19
|
+
type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
|
|
20
|
+
bucketName: string;
|
|
21
|
+
/** Base path where bundles will be stored in the bucket. */
|
|
22
|
+
basePath?: string;
|
|
23
|
+
/** Signed download URL lifetime in seconds. @default 3600 */
|
|
24
|
+
signedUrlExpiresIn?: number;
|
|
25
|
+
};
|
|
26
|
+
declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { supabaseDatabase as i, supabaseStorage as n, SupabaseDatabaseConfig as r, SupabaseStorageConfig as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SETTINGS_TABLE, createEngineDatabase, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageUri, parseStorageUri } from "@hot-updater/plugin-core";
|
|
2
2
|
import { createClient } from "@supabase/supabase-js";
|
|
3
|
-
import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
|
|
4
3
|
//#region src/supabaseConfig.ts
|
|
5
4
|
const resolveSupabaseServiceRoleKey = (config) => {
|
|
6
5
|
if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
|
|
@@ -229,15 +228,4 @@ const supabaseStorage = (config) => {
|
|
|
229
228
|
});
|
|
230
229
|
};
|
|
231
230
|
//#endregion
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* The plugins the managed Supabase server runs: Insights, API keys on every
|
|
235
|
-
* client route, and Remote Config. Its Edge Function imports this list.
|
|
236
|
-
*/
|
|
237
|
-
const plugins = [
|
|
238
|
-
insights(),
|
|
239
|
-
apiKeys(),
|
|
240
|
-
remoteConfig()
|
|
241
|
-
];
|
|
242
|
-
//#endregion
|
|
243
|
-
export { SUPABASE_TABLE_PREFIX as a, SUPABASE_APPLY_FUNCTION as i, supabaseStorage as n, supabaseDatabase as r, plugins as t };
|
|
231
|
+
export { SUPABASE_TABLE_PREFIX as i, supabaseDatabase as n, SUPABASE_APPLY_FUNCTION as r, supabaseStorage as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
2
2
|
let _supabase_supabase_js = require("@supabase/supabase-js");
|
|
3
|
-
let _hot_updater_server_plugins = require("@hot-updater/server/plugins");
|
|
4
3
|
//#region src/supabaseConfig.ts
|
|
5
4
|
const resolveSupabaseServiceRoleKey = (config) => {
|
|
6
5
|
if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
|
|
@@ -229,17 +228,6 @@ const supabaseStorage = (config) => {
|
|
|
229
228
|
});
|
|
230
229
|
};
|
|
231
230
|
//#endregion
|
|
232
|
-
//#region src/plugins.ts
|
|
233
|
-
/**
|
|
234
|
-
* The plugins the managed Supabase server runs: Insights, API keys on every
|
|
235
|
-
* client route, and Remote Config. Its Edge Function imports this list.
|
|
236
|
-
*/
|
|
237
|
-
const plugins = [
|
|
238
|
-
(0, _hot_updater_server_plugins.insights)(),
|
|
239
|
-
(0, _hot_updater_server_plugins.apiKeys)(),
|
|
240
|
-
(0, _hot_updater_server_plugins.remoteConfig)()
|
|
241
|
-
];
|
|
242
|
-
//#endregion
|
|
243
231
|
Object.defineProperty(exports, "SUPABASE_APPLY_FUNCTION", {
|
|
244
232
|
enumerable: true,
|
|
245
233
|
get: function() {
|
|
@@ -252,12 +240,6 @@ Object.defineProperty(exports, "SUPABASE_TABLE_PREFIX", {
|
|
|
252
240
|
return SUPABASE_TABLE_PREFIX;
|
|
253
241
|
}
|
|
254
242
|
});
|
|
255
|
-
Object.defineProperty(exports, "plugins", {
|
|
256
|
-
enumerable: true,
|
|
257
|
-
get: function() {
|
|
258
|
-
return plugins;
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
243
|
Object.defineProperty(exports, "supabaseDatabase", {
|
|
262
244
|
enumerable: true,
|
|
263
245
|
get: function() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.46",
|
|
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/protocol": "1.0.0-rc.
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/
|
|
57
|
-
"@hot-updater/server": "1.0.0-rc.
|
|
54
|
+
"@hot-updater/protocol": "1.0.0-rc.46",
|
|
55
|
+
"@hot-updater/plugin-core": "1.0.0-rc.46",
|
|
56
|
+
"@hot-updater/cli-tools": "1.0.0-rc.46",
|
|
57
|
+
"@hot-updater/server": "1.0.0-rc.46"
|
|
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.0.0-rc.
|
|
68
|
-
"@hot-updater/
|
|
69
|
-
"@hot-updater/
|
|
67
|
+
"@hot-updater/mock": "1.0.0-rc.46",
|
|
68
|
+
"@hot-updater/postgres": "1.0.0-rc.46",
|
|
69
|
+
"@hot-updater/test-utils": "1.0.0-rc.46"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown",
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
|
2
2
|
import { createHotUpdater } from "@hot-updater/server";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
supabaseDatabase,
|
|
6
|
-
supabaseStorage,
|
|
7
|
-
} from "@hot-updater/supabase/edge";
|
|
3
|
+
import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
|
|
4
|
+
import { supabaseDatabase, supabaseStorage } from "@hot-updater/supabase/edge";
|
|
8
5
|
import { Hono } from "hono";
|
|
9
6
|
|
|
10
7
|
declare global {
|
|
@@ -26,7 +23,7 @@ const hotUpdater = createHotUpdater({
|
|
|
26
23
|
supabaseUrl,
|
|
27
24
|
supabaseServiceRoleKey,
|
|
28
25
|
}),
|
|
29
|
-
plugins,
|
|
26
|
+
plugins: [insights(), apiKeys(), remoteConfig()],
|
|
30
27
|
storage: supabaseStorage({
|
|
31
28
|
supabaseUrl,
|
|
32
29
|
supabaseServiceRoleKey,
|