@hot-updater/supabase 1.0.0-rc.43 → 1.0.0-rc.45

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 CHANGED
@@ -1,8 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugins = require("./plugins-C3qJSy3_.cjs");
2
+ const require_supabaseStorage = require("./supabaseStorage-DAl3pyb7.cjs");
3
3
  //#region src/supabaseEdgeFunctionStorage.ts
4
- const supabaseEdgeFunctionStorage = (config) => require_plugins.supabaseStorage(config);
4
+ const supabaseEdgeFunctionStorage = (config) => require_supabaseStorage.supabaseStorage(config);
5
5
  //#endregion
6
- exports.plugins = require_plugins.plugins;
7
- exports.supabaseDatabase = require_plugins.supabaseDatabase;
6
+ exports.supabaseDatabase = require_supabaseStorage.supabaseDatabase;
8
7
  exports.supabaseStorage = supabaseEdgeFunctionStorage;
package/dist/edge.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DV5XdQWp.cjs";
1
+ import { n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DGm2NBGf.cjs";
2
2
  import { StorageAdapterWith } from "@hot-updater/plugin-core";
3
3
  //#region src/supabaseEdgeFunctionStorage.d.ts
4
4
  interface SupabaseEdgeFunctionStorageConfig {
@@ -10,4 +10,4 @@ interface SupabaseEdgeFunctionStorageConfig {
10
10
  }
11
11
  declare const supabaseEdgeFunctionStorage: (config: SupabaseEdgeFunctionStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
12
12
  //#endregion
13
- export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
13
+ export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
package/dist/edge.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DV5XdQWp.mjs";
1
+ import { n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DGm2NBGf.mjs";
2
2
  import { StorageAdapterWith } from "@hot-updater/plugin-core";
3
3
  //#region src/supabaseEdgeFunctionStorage.d.ts
4
4
  interface SupabaseEdgeFunctionStorageConfig {
@@ -10,4 +10,4 @@ interface SupabaseEdgeFunctionStorageConfig {
10
10
  }
11
11
  declare const supabaseEdgeFunctionStorage: (config: SupabaseEdgeFunctionStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
12
12
  //#endregion
13
- export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
13
+ export { type SupabaseDatabaseConfig, type SupabaseEdgeFunctionStorageConfig as SupabaseStorageConfig, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
package/dist/edge.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as supabaseStorage, r as supabaseDatabase, t as plugins } from "./plugins-Do0arFjS.mjs";
1
+ import { n as supabaseDatabase, t as supabaseStorage } from "./supabaseStorage-C8xQ3nyM.mjs";
2
2
  //#region src/supabaseEdgeFunctionStorage.ts
3
3
  const supabaseEdgeFunctionStorage = (config) => supabaseStorage(config);
4
4
  //#endregion
5
- export { plugins, supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
5
+ export { supabaseDatabase, supabaseEdgeFunctionStorage as supabaseStorage };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugins = require("./plugins-C3qJSy3_.cjs");
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) => require_plugins.SUPABASE_TABLE_PREFIX + 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.${require_plugins.SUPABASE_APPLY_FUNCTION}(p_statements jsonb)
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 '${require_plugins.SUPABASE_APPLY_FUNCTION}: % is not a Hot Updater table', target USING ERRCODE = '42501';
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 '${require_plugins.SUPABASE_APPLY_FUNCTION}: statement not allowed' USING ERRCODE = '42501';
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: require_plugins.SUPABASE_TABLE_PREFIX });
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.${require_plugins.SUPABASE_APPLY_FUNCTION}(jsonb)`;
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], require_plugins.SUPABASE_TABLE_PREFIX),
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
- ...require_plugins.supabaseDatabase(config),
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 = require_plugins.supabaseStorage;
143
+ exports.supabaseStorage = require_supabaseStorage.supabaseStorage;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DV5XdQWp.cjs";
1
+ import { r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DGm2NBGf.cjs";
2
2
  import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
3
3
  //#region src/supabaseMigration.d.ts
4
4
  /**
@@ -19,4 +19,4 @@ type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
19
19
  };
20
20
  declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
21
21
  //#endregion
22
- export { type SupabaseDatabaseConfig, SupabaseStorageConfig, plugins, supabaseDatabase, supabaseStorage };
22
+ export { type SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DV5XdQWp.mjs";
1
+ import { r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DGm2NBGf.mjs";
2
2
  import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
3
3
  //#region src/supabaseMigration.d.ts
4
4
  /**
@@ -19,4 +19,4 @@ type SupabaseStorageConfig = SupabaseServiceRoleConfig & {
19
19
  };
20
20
  declare const supabaseStorage: (config: SupabaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
21
21
  //#endregion
22
- export { type SupabaseDatabaseConfig, SupabaseStorageConfig, plugins, supabaseDatabase, supabaseStorage };
22
+ export { type SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SUPABASE_TABLE_PREFIX, i as SUPABASE_APPLY_FUNCTION, n as supabaseStorage, r as supabaseDatabase$1, t as plugins } from "./plugins-Do0arFjS.mjs";
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 { plugins, supabaseDatabase, supabaseStorage };
141
+ export { supabaseDatabase, supabaseStorage };
@@ -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,9 +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_api_keys = require("@hot-updater/server/plugins/api-keys");
50
- let _hot_updater_server_plugins_insights = require("@hot-updater/server/plugins/insights");
51
- let _hot_updater_server_plugins_remote_config = require("@hot-updater/server/plugins/remote-config");
52
50
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
53
51
  let _supabase_supabase_js = require("@supabase/supabase-js");
54
52
  //#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
@@ -6334,17 +6332,6 @@ createExeca(mapNode);
6334
6332
  createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6335
6333
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6336
6334
  //#endregion
6337
- //#region src/plugins.ts
6338
- /**
6339
- * The plugins the managed Supabase server runs: Insights, API keys on every
6340
- * client route, and Remote Config. Its Edge Function imports this list.
6341
- */
6342
- const plugins = [
6343
- (0, _hot_updater_server_plugins_insights.insights)(),
6344
- (0, _hot_updater_server_plugins_api_keys.apiKeys)(),
6345
- (0, _hot_updater_server_plugins_remote_config.remoteConfig)()
6346
- ];
6347
- //#endregion
6348
6335
  //#region src/supabaseConfig.ts
6349
6336
  const resolveSupabaseServiceRoleKey = (config) => {
6350
6337
  if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
@@ -6442,10 +6429,14 @@ const getConfigScaffold = (build) => {
6442
6429
  })`
6443
6430
  }).setPlugins({
6444
6431
  imports: [{
6445
- pkg: "@hot-updater/supabase",
6446
- named: ["plugins"]
6432
+ pkg: "hot-updater/plugins",
6433
+ named: [
6434
+ "apiKeys",
6435
+ "insights",
6436
+ "remoteConfig"
6437
+ ]
6447
6438
  }],
6448
- configString: "plugins"
6439
+ configString: "[apiKeys(), insights(), remoteConfig()]"
6449
6440
  }));
6450
6441
  };
6451
6442
  //#endregion
@@ -7075,24 +7066,6 @@ const SUPABASE_STORAGE_READINESS_MAX_ATTEMPTS = 300;
7075
7066
  const SUPABASE_STORAGE_READINESS_POLL_INTERVAL_MS = 1e3;
7076
7067
  const SUPABASE_SCHEMA_READINESS_MAX_ATTEMPTS = 60;
7077
7068
  const SUPABASE_SCHEMA_READINESS_POLL_INTERVAL_MS = 1e3;
7078
- const LEGACY_SUPABASE_CATALOG_CDN_URL_ENV_KEY = "HOT_UPDATER_SUPABASE_CATALOG_CDN_URL";
7079
- const getLegacySupabaseConfigReference = (configText) => {
7080
- if (configText.includes("HOT_UPDATER_SUPABASE_ANON_KEY")) return "HOT_UPDATER_SUPABASE_ANON_KEY";
7081
- if (/\bsupabaseAnonKey\s*:/.test(configText)) return "supabaseAnonKey";
7082
- return null;
7083
- };
7084
- const assertSkippedConfigDoesNotUseLegacySupabaseKey = async (configWriteResult) => {
7085
- if (configWriteResult.status !== "skipped") return;
7086
- const configText = await fs_promises.default.readFile(configWriteResult.path, "utf-8").catch((error) => {
7087
- if (error.code === "ENOENT") return null;
7088
- throw error;
7089
- });
7090
- const legacyReference = configText === null ? null : getLegacySupabaseConfigReference(configText);
7091
- if (!legacyReference) return;
7092
- _hot_updater_cli_tools.p.log.error(`Existing '${configWriteResult.path}' still references '${legacyReference}'.`);
7093
- _hot_updater_cli_tools.p.log.message("Update it to use 'supabaseServiceRoleKey' with 'HOT_UPDATER_SUPABASE_SERVICE_ROLE_KEY', then run init again.");
7094
- process.exit(1);
7095
- };
7096
7069
  /** The Edge Function URL an app sets as its baseURL. */
7097
7070
  const getSupabaseFunctionUrl = ({ functionName, projectId }) => `https://${projectId}.supabase.co/functions/v1/${functionName}`;
7098
7071
  const reportSupabaseOriginCatalogReady = () => {
@@ -7239,6 +7212,13 @@ const buildEdgeFunctionImports = async (targetDir) => {
7239
7212
  const edgeFunctionSpecifiers = await collectBareImportSpecifiers(edgeFunctionEntryPath);
7240
7213
  for (const specifier of edgeFunctionSpecifiers) {
7241
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
+ }
7242
7222
  imports[specifier] = await resolveBareSpecifierImportTarget(specifier, supabasePackage.packageRoot);
7243
7223
  }
7244
7224
  }
@@ -7634,7 +7614,7 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7634
7614
  });
7635
7615
  const persistDatabasePassword = persistCredentialInputs && dbPassword !== "";
7636
7616
  if (persistDatabasePassword) providerEnv[SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY] = project.id;
7637
- await (0, _hot_updater_cli_tools.makeEnv)(providerEnv, ".env.hotupdater", { removeKeys: [LEGACY_SUPABASE_CATALOG_CDN_URL_ENV_KEY, ...persistDatabasePassword ? [] : [databasePasswordKey, SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY]] });
7617
+ await (0, _hot_updater_cli_tools.makeEnv)(providerEnv, ".env.hotupdater", { removeKeys: persistDatabasePassword ? [] : [databasePasswordKey, SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY] });
7638
7618
  const bucket = await createSelectedBucket(projectAccess.api, bucketSelection);
7639
7619
  await (0, _hot_updater_cli_tools.makeEnv)({
7640
7620
  [initProvider.inputs.projectId.envKey]: project.id,
@@ -7658,7 +7638,11 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7658
7638
  });
7659
7639
  const managedServer = (0, _hot_updater_cli_tools.assembleServer)({
7660
7640
  database,
7661
- 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
+ ]
7662
7646
  });
7663
7647
  ({clientPlugins} = managedServer);
7664
7648
  try {
@@ -7675,11 +7659,10 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7675
7659
  await removeTmpDir();
7676
7660
  }
7677
7661
  _hot_updater_cli_tools.p.log.success("Generated '.env.hotupdater' file with Supabase settings.");
7678
- const files = await (0, _hot_updater_cli_tools.writeHotUpdaterFiles)(getConfigScaffold(build), {
7662
+ await (0, _hot_updater_cli_tools.writeHotUpdaterFiles)(getConfigScaffold(build), {
7679
7663
  cwd: process.cwd(),
7680
7664
  settings: "Supabase"
7681
7665
  });
7682
- await assertSkippedConfigDoesNotUseLegacySupabaseKey(files.config);
7683
7666
  (0, _hot_updater_cli_tools.printAppSetup)({
7684
7667
  baseURL: getSupabaseFunctionUrl({
7685
7668
  functionName,
@@ -7695,7 +7678,6 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7695
7678
  const runInit = (options) => withSupabaseCliMetadataCleanup(process.cwd(), () => runInitWithoutCliMetadata(options));
7696
7679
  //#endregion
7697
7680
  exports.createSelectedBucket = createSelectedBucket;
7698
- exports.getLegacySupabaseConfigReference = getLegacySupabaseConfigReference;
7699
7681
  exports.getSupabaseFunctionUrl = getSupabaseFunctionUrl;
7700
7682
  exports.getSupabaseProjectAccess = getSupabaseProjectAccess;
7701
7683
  exports.initProvider = initProvider;
@@ -125,7 +125,6 @@ interface SupabaseManagementApi {
125
125
  }
126
126
  //#endregion
127
127
  //#region iac/index.d.ts
128
- declare const getLegacySupabaseConfigReference: (configText: string) => "HOT_UPDATER_SUPABASE_ANON_KEY" | "supabaseAnonKey" | null;
129
128
  /** The Edge Function URL an app sets as its baseURL. */
130
129
  declare const getSupabaseFunctionUrl: ({ functionName, projectId }: {
131
130
  readonly functionName: string;
@@ -179,4 +178,4 @@ declare const getSupabaseProjectAccess: ({ accessToken, managementApi, project,
179
178
  declare const withSupabaseCliMetadataCleanup: <Result>(cwd: string, operation: () => Promise<Result>) => Promise<Result>;
180
179
  declare const runInit: (options: RunInitOptions) => Promise<void>;
181
180
  //#endregion
182
- export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getLegacySupabaseConfigReference, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
181
+ export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
@@ -125,7 +125,6 @@ interface SupabaseManagementApi {
125
125
  }
126
126
  //#endregion
127
127
  //#region iac/index.d.ts
128
- declare const getLegacySupabaseConfigReference: (configText: string) => "HOT_UPDATER_SUPABASE_ANON_KEY" | "supabaseAnonKey" | null;
129
128
  /** The Edge Function URL an app sets as its baseURL. */
130
129
  declare const getSupabaseFunctionUrl: ({ functionName, projectId }: {
131
130
  readonly functionName: string;
@@ -179,4 +178,4 @@ declare const getSupabaseProjectAccess: ({ accessToken, managementApi, project,
179
178
  declare const withSupabaseCliMetadataCleanup: <Result>(cwd: string, operation: () => Promise<Result>) => Promise<Result>;
180
179
  declare const runInit: (options: RunInitOptions) => Promise<void>;
181
180
  //#endregion
182
- export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getLegacySupabaseConfigReference, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
181
+ export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
@@ -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,9 +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 } from "@hot-updater/server/plugins/api-keys";
21
- import { insights } from "@hot-updater/server/plugins/insights";
22
- import { remoteConfig } from "@hot-updater/server/plugins/remote-config";
23
21
  import { SETTINGS_TABLE, createEngineDatabase, createSqlAdapter } from "@hot-updater/plugin-core";
24
22
  import { createClient } from "@supabase/supabase-js";
25
23
  //#region \0rolldown/runtime.js
@@ -6329,17 +6327,6 @@ createExeca(mapNode);
6329
6327
  createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6330
6328
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6331
6329
  //#endregion
6332
- //#region src/plugins.ts
6333
- /**
6334
- * The plugins the managed Supabase server runs: Insights, API keys on every
6335
- * client route, and Remote Config. Its Edge Function imports this list.
6336
- */
6337
- const plugins = [
6338
- insights(),
6339
- apiKeys(),
6340
- remoteConfig()
6341
- ];
6342
- //#endregion
6343
6330
  //#region src/supabaseConfig.ts
6344
6331
  const resolveSupabaseServiceRoleKey = (config) => {
6345
6332
  if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
@@ -6437,10 +6424,14 @@ const getConfigScaffold = (build) => {
6437
6424
  })`
6438
6425
  }).setPlugins({
6439
6426
  imports: [{
6440
- pkg: "@hot-updater/supabase",
6441
- named: ["plugins"]
6427
+ pkg: "hot-updater/plugins",
6428
+ named: [
6429
+ "apiKeys",
6430
+ "insights",
6431
+ "remoteConfig"
6432
+ ]
6442
6433
  }],
6443
- configString: "plugins"
6434
+ configString: "[apiKeys(), insights(), remoteConfig()]"
6444
6435
  }));
6445
6436
  };
6446
6437
  //#endregion
@@ -7070,24 +7061,6 @@ const SUPABASE_STORAGE_READINESS_MAX_ATTEMPTS = 300;
7070
7061
  const SUPABASE_STORAGE_READINESS_POLL_INTERVAL_MS = 1e3;
7071
7062
  const SUPABASE_SCHEMA_READINESS_MAX_ATTEMPTS = 60;
7072
7063
  const SUPABASE_SCHEMA_READINESS_POLL_INTERVAL_MS = 1e3;
7073
- const LEGACY_SUPABASE_CATALOG_CDN_URL_ENV_KEY = "HOT_UPDATER_SUPABASE_CATALOG_CDN_URL";
7074
- const getLegacySupabaseConfigReference = (configText) => {
7075
- if (configText.includes("HOT_UPDATER_SUPABASE_ANON_KEY")) return "HOT_UPDATER_SUPABASE_ANON_KEY";
7076
- if (/\bsupabaseAnonKey\s*:/.test(configText)) return "supabaseAnonKey";
7077
- return null;
7078
- };
7079
- const assertSkippedConfigDoesNotUseLegacySupabaseKey = async (configWriteResult) => {
7080
- if (configWriteResult.status !== "skipped") return;
7081
- const configText = await fs.readFile(configWriteResult.path, "utf-8").catch((error) => {
7082
- if (error.code === "ENOENT") return null;
7083
- throw error;
7084
- });
7085
- const legacyReference = configText === null ? null : getLegacySupabaseConfigReference(configText);
7086
- if (!legacyReference) return;
7087
- p.log.error(`Existing '${configWriteResult.path}' still references '${legacyReference}'.`);
7088
- p.log.message("Update it to use 'supabaseServiceRoleKey' with 'HOT_UPDATER_SUPABASE_SERVICE_ROLE_KEY', then run init again.");
7089
- process.exit(1);
7090
- };
7091
7064
  /** The Edge Function URL an app sets as its baseURL. */
7092
7065
  const getSupabaseFunctionUrl = ({ functionName, projectId }) => `https://${projectId}.supabase.co/functions/v1/${functionName}`;
7093
7066
  const reportSupabaseOriginCatalogReady = () => {
@@ -7234,6 +7207,13 @@ const buildEdgeFunctionImports = async (targetDir) => {
7234
7207
  const edgeFunctionSpecifiers = await collectBareImportSpecifiers(edgeFunctionEntryPath);
7235
7208
  for (const specifier of edgeFunctionSpecifiers) {
7236
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
+ }
7237
7217
  imports[specifier] = await resolveBareSpecifierImportTarget(specifier, supabasePackage.packageRoot);
7238
7218
  }
7239
7219
  }
@@ -7629,7 +7609,7 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7629
7609
  });
7630
7610
  const persistDatabasePassword = persistCredentialInputs && dbPassword !== "";
7631
7611
  if (persistDatabasePassword) providerEnv[SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY] = project.id;
7632
- await makeEnv(providerEnv, ".env.hotupdater", { removeKeys: [LEGACY_SUPABASE_CATALOG_CDN_URL_ENV_KEY, ...persistDatabasePassword ? [] : [databasePasswordKey, SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY]] });
7612
+ await makeEnv(providerEnv, ".env.hotupdater", { removeKeys: persistDatabasePassword ? [] : [databasePasswordKey, SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY] });
7633
7613
  const bucket = await createSelectedBucket(projectAccess.api, bucketSelection);
7634
7614
  await makeEnv({
7635
7615
  [initProvider.inputs.projectId.envKey]: project.id,
@@ -7653,7 +7633,11 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7653
7633
  });
7654
7634
  const managedServer = assembleServer({
7655
7635
  database,
7656
- plugins
7636
+ plugins: [
7637
+ insights(),
7638
+ apiKeys(),
7639
+ remoteConfig()
7640
+ ]
7657
7641
  });
7658
7642
  ({clientPlugins} = managedServer);
7659
7643
  try {
@@ -7670,11 +7654,10 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7670
7654
  await removeTmpDir();
7671
7655
  }
7672
7656
  p.log.success("Generated '.env.hotupdater' file with Supabase settings.");
7673
- const files = await writeHotUpdaterFiles(getConfigScaffold(build), {
7657
+ await writeHotUpdaterFiles(getConfigScaffold(build), {
7674
7658
  cwd: process.cwd(),
7675
7659
  settings: "Supabase"
7676
7660
  });
7677
- await assertSkippedConfigDoesNotUseLegacySupabaseKey(files.config);
7678
7661
  printAppSetup({
7679
7662
  baseURL: getSupabaseFunctionUrl({
7680
7663
  functionName,
@@ -7689,4 +7672,4 @@ const runInitWithoutCliMetadata = async ({ build, envFile }) => {
7689
7672
  };
7690
7673
  const runInit = (options) => withSupabaseCliMetadataCleanup(process.cwd(), () => runInitWithoutCliMetadata(options));
7691
7674
  //#endregion
7692
- export { createSelectedBucket, getLegacySupabaseConfigReference, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
7675
+ export { createSelectedBucket, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
@@ -0,0 +1,18 @@
1
+ import { EngineDatabase } 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
+ export { supabaseDatabase as n, SupabaseServiceRoleConfig as r, SupabaseDatabaseConfig as t };
@@ -0,0 +1,18 @@
1
+ import { EngineDatabase } 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
+ export { supabaseDatabase as n, SupabaseServiceRoleConfig as r, SupabaseDatabaseConfig as t };
@@ -1,8 +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 } from "@hot-updater/server/plugins/api-keys";
4
- import { insights } from "@hot-updater/server/plugins/insights";
5
- import { remoteConfig } from "@hot-updater/server/plugins/remote-config";
6
3
  //#region src/supabaseConfig.ts
7
4
  const resolveSupabaseServiceRoleKey = (config) => {
8
5
  if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
@@ -231,15 +228,4 @@ const supabaseStorage = (config) => {
231
228
  });
232
229
  };
233
230
  //#endregion
234
- //#region src/plugins.ts
235
- /**
236
- * The plugins the managed Supabase server runs: Insights, API keys on every
237
- * client route, and Remote Config. Its Edge Function imports this list.
238
- */
239
- const plugins = [
240
- insights(),
241
- apiKeys(),
242
- remoteConfig()
243
- ];
244
- //#endregion
245
- 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,8 +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_api_keys = require("@hot-updater/server/plugins/api-keys");
4
- let _hot_updater_server_plugins_insights = require("@hot-updater/server/plugins/insights");
5
- let _hot_updater_server_plugins_remote_config = require("@hot-updater/server/plugins/remote-config");
6
3
  //#region src/supabaseConfig.ts
7
4
  const resolveSupabaseServiceRoleKey = (config) => {
8
5
  if (!config.supabaseServiceRoleKey) throw new Error("Supabase service role key is required. Set supabaseServiceRoleKey.");
@@ -231,17 +228,6 @@ const supabaseStorage = (config) => {
231
228
  });
232
229
  };
233
230
  //#endregion
234
- //#region src/plugins.ts
235
- /**
236
- * The plugins the managed Supabase server runs: Insights, API keys on every
237
- * client route, and Remote Config. Its Edge Function imports this list.
238
- */
239
- const plugins = [
240
- (0, _hot_updater_server_plugins_insights.insights)(),
241
- (0, _hot_updater_server_plugins_api_keys.apiKeys)(),
242
- (0, _hot_updater_server_plugins_remote_config.remoteConfig)()
243
- ];
244
- //#endregion
245
231
  Object.defineProperty(exports, "SUPABASE_APPLY_FUNCTION", {
246
232
  enumerable: true,
247
233
  get: function() {
@@ -254,12 +240,6 @@ Object.defineProperty(exports, "SUPABASE_TABLE_PREFIX", {
254
240
  return SUPABASE_TABLE_PREFIX;
255
241
  }
256
242
  });
257
- Object.defineProperty(exports, "plugins", {
258
- enumerable: true,
259
- get: function() {
260
- return plugins;
261
- }
262
- });
263
243
  Object.defineProperty(exports, "supabaseDatabase", {
264
244
  enumerable: true,
265
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.43",
4
+ "version": "1.0.0-rc.45",
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/plugin-core": "1.0.0-rc.43",
55
- "@hot-updater/cli-tools": "1.0.0-rc.43",
56
- "@hot-updater/server": "1.0.0-rc.43",
57
- "@hot-updater/protocol": "1.0.0-rc.43"
54
+ "@hot-updater/cli-tools": "1.0.0-rc.45",
55
+ "@hot-updater/plugin-core": "1.0.0-rc.45",
56
+ "@hot-updater/server": "1.0.0-rc.45",
57
+ "@hot-updater/protocol": "1.0.0-rc.45"
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.43",
68
- "@hot-updater/test-utils": "1.0.0-rc.43",
69
- "@hot-updater/postgres": "1.0.0-rc.43"
67
+ "@hot-updater/mock": "1.0.0-rc.45",
68
+ "@hot-updater/test-utils": "1.0.0-rc.45",
69
+ "@hot-updater/postgres": "1.0.0-rc.45"
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
- plugins,
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,14 +23,12 @@ const hotUpdater = createHotUpdater({
26
23
  supabaseUrl,
27
24
  supabaseServiceRoleKey,
28
25
  }),
29
- plugins,
30
- storage: [
31
- supabaseStorage({
32
- supabaseUrl,
33
- supabaseServiceRoleKey,
34
- bucketName,
35
- }),
36
- ],
26
+ plugins: [insights(), apiKeys(), remoteConfig()],
27
+ storage: supabaseStorage({
28
+ supabaseUrl,
29
+ supabaseServiceRoleKey,
30
+ bucketName,
31
+ }),
37
32
  });
38
33
 
39
34
  const app = new Hono().basePath(functionBasePath);