@hot-updater/supabase 0.33.2 → 0.35.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/iac/index.cjs
CHANGED
|
@@ -887,7 +887,7 @@ const handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
|
887
887
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
888
888
|
module.exports = isexe;
|
|
889
889
|
isexe.sync = sync;
|
|
890
|
-
var fs$
|
|
890
|
+
var fs$4 = require("fs");
|
|
891
891
|
function checkPathExt(path, options) {
|
|
892
892
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
893
893
|
if (!pathext) return true;
|
|
@@ -904,12 +904,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
904
904
|
return checkPathExt(path, options);
|
|
905
905
|
}
|
|
906
906
|
function isexe(path, options, cb) {
|
|
907
|
-
fs$
|
|
907
|
+
fs$4.stat(path, function(er, stat) {
|
|
908
908
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
911
|
function sync(path, options) {
|
|
912
|
-
return checkStat(fs$
|
|
912
|
+
return checkStat(fs$4.statSync(path), path, options);
|
|
913
913
|
}
|
|
914
914
|
}));
|
|
915
915
|
//#endregion
|
|
@@ -917,14 +917,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
917
917
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
918
918
|
module.exports = isexe;
|
|
919
919
|
isexe.sync = sync;
|
|
920
|
-
var fs$
|
|
920
|
+
var fs$3 = require("fs");
|
|
921
921
|
function isexe(path, options, cb) {
|
|
922
|
-
fs$
|
|
922
|
+
fs$3.stat(path, function(er, stat) {
|
|
923
923
|
cb(er, er ? false : checkStat(stat, options));
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
926
|
function sync(path, options) {
|
|
927
|
-
return checkStat(fs$
|
|
927
|
+
return checkStat(fs$3.statSync(path), options);
|
|
928
928
|
}
|
|
929
929
|
function checkStat(stat, options) {
|
|
930
930
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -988,7 +988,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
988
988
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
989
989
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
990
990
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
991
|
-
const path$
|
|
991
|
+
const path$10 = require("path");
|
|
992
992
|
const COLON = isWindows ? ";" : ":";
|
|
993
993
|
const isexe = require_isexe();
|
|
994
994
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -1018,7 +1018,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1018
1018
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
1019
1019
|
const ppRaw = pathEnv[i];
|
|
1020
1020
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
1021
|
-
const pCmd = path$
|
|
1021
|
+
const pCmd = path$10.join(pathPart, cmd);
|
|
1022
1022
|
resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i, 0));
|
|
1023
1023
|
});
|
|
1024
1024
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
@@ -1039,7 +1039,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1039
1039
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
1040
1040
|
const ppRaw = pathEnv[i];
|
|
1041
1041
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
1042
|
-
const pCmd = path$
|
|
1042
|
+
const pCmd = path$10.join(pathPart, cmd);
|
|
1043
1043
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
1044
1044
|
for (let j = 0; j < pathExt.length; j++) {
|
|
1045
1045
|
const cur = p + pathExt[j];
|
|
@@ -1070,7 +1070,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1070
1070
|
//#endregion
|
|
1071
1071
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
1072
1072
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1073
|
-
const path$
|
|
1073
|
+
const path$9 = require("path");
|
|
1074
1074
|
const which = require_which();
|
|
1075
1075
|
const getPathKey = require_path_key();
|
|
1076
1076
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -1085,12 +1085,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1085
1085
|
try {
|
|
1086
1086
|
resolved = which.sync(parsed.command, {
|
|
1087
1087
|
path: env[getPathKey({ env })],
|
|
1088
|
-
pathExt: withoutPathExt ? path$
|
|
1088
|
+
pathExt: withoutPathExt ? path$9.delimiter : void 0
|
|
1089
1089
|
});
|
|
1090
1090
|
} catch (e) {} finally {
|
|
1091
1091
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
1092
1092
|
}
|
|
1093
|
-
if (resolved) resolved = path$
|
|
1093
|
+
if (resolved) resolved = path$9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
1094
1094
|
return resolved;
|
|
1095
1095
|
}
|
|
1096
1096
|
function resolveCommand(parsed) {
|
|
@@ -1139,16 +1139,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
1139
1139
|
//#endregion
|
|
1140
1140
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
1141
1141
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1142
|
-
const fs$
|
|
1142
|
+
const fs$2 = require("fs");
|
|
1143
1143
|
const shebangCommand = require_shebang_command();
|
|
1144
1144
|
function readShebang(command) {
|
|
1145
1145
|
const size = 150;
|
|
1146
1146
|
const buffer = Buffer.alloc(size);
|
|
1147
1147
|
let fd;
|
|
1148
1148
|
try {
|
|
1149
|
-
fd = fs$
|
|
1150
|
-
fs$
|
|
1151
|
-
fs$
|
|
1149
|
+
fd = fs$2.openSync(command, "r");
|
|
1150
|
+
fs$2.readSync(fd, buffer, 0, size, 0);
|
|
1151
|
+
fs$2.closeSync(fd);
|
|
1152
1152
|
} catch (e) {}
|
|
1153
1153
|
return shebangCommand(buffer.toString());
|
|
1154
1154
|
}
|
|
@@ -1157,7 +1157,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1157
1157
|
//#endregion
|
|
1158
1158
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
1159
1159
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1160
|
-
const path$
|
|
1160
|
+
const path$8 = require("path");
|
|
1161
1161
|
const resolveCommand = require_resolveCommand();
|
|
1162
1162
|
const escape = require_escape();
|
|
1163
1163
|
const readShebang = require_readShebang();
|
|
@@ -1180,7 +1180,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1180
1180
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
1181
1181
|
if (parsed.options.forceShell || needsShell) {
|
|
1182
1182
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
1183
|
-
parsed.command = path$
|
|
1183
|
+
parsed.command = path$8.normalize(parsed.command);
|
|
1184
1184
|
parsed.command = escape.command(parsed.command);
|
|
1185
1185
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
1186
1186
|
parsed.args = [
|
|
@@ -6298,6 +6298,83 @@ const supabaseApi = (supabaseUrl, supabaseServiceRoleKey) => {
|
|
|
6298
6298
|
};
|
|
6299
6299
|
};
|
|
6300
6300
|
//#endregion
|
|
6301
|
+
//#region iac/supabaseCli.ts
|
|
6302
|
+
const SUPABASE_CONFIG_TEMPLATE = `
|
|
6303
|
+
project_id = "%%projectId%%"
|
|
6304
|
+
|
|
6305
|
+
[db.seed]
|
|
6306
|
+
enabled = false
|
|
6307
|
+
`;
|
|
6308
|
+
const SUPABASE_DATABASE_CONNECTION_ERROR = "Supabase database connection failed. Check your database password and project access.";
|
|
6309
|
+
const SUPABASE_DATABASE_AUTH_ERROR_PATTERNS = [
|
|
6310
|
+
/failed SASL auth/i,
|
|
6311
|
+
/password authentication failed/i,
|
|
6312
|
+
/SQLSTATE 28P01/i,
|
|
6313
|
+
/invalid SCRAM server-final-message/i
|
|
6314
|
+
];
|
|
6315
|
+
const isSupabaseDatabaseAuthError = (err) => {
|
|
6316
|
+
const stderr = err.stderr;
|
|
6317
|
+
return typeof stderr === "string" && SUPABASE_DATABASE_AUTH_ERROR_PATTERNS.some((pattern) => pattern.test(stderr));
|
|
6318
|
+
};
|
|
6319
|
+
const handleSupabaseDatabaseCommandError = (err, { dbPassword, stderrInherited = false }) => {
|
|
6320
|
+
if (err instanceof ExecaError) if (dbPassword && isSupabaseDatabaseAuthError(err)) _hot_updater_cli_tools.p.log.error(SUPABASE_DATABASE_CONNECTION_ERROR);
|
|
6321
|
+
else if (!stderrInherited && err.stderr) _hot_updater_cli_tools.p.log.error(err.stderr);
|
|
6322
|
+
else console.error(err);
|
|
6323
|
+
else console.error(err);
|
|
6324
|
+
process.exit(1);
|
|
6325
|
+
};
|
|
6326
|
+
const linkSupabase = async (workdir, { projectId, dbPassword }) => {
|
|
6327
|
+
const spinner = _hot_updater_cli_tools.p.spinner();
|
|
6328
|
+
try {
|
|
6329
|
+
await fs_promises.default.writeFile(path.default.join(workdir, "supabase", "config.toml"), (0, _hot_updater_cli_tools.transformTemplate)(SUPABASE_CONFIG_TEMPLATE, { projectId }));
|
|
6330
|
+
spinner.start("Linking Supabase...");
|
|
6331
|
+
await execa("npx", [
|
|
6332
|
+
"supabase",
|
|
6333
|
+
"link",
|
|
6334
|
+
"--project-ref",
|
|
6335
|
+
projectId,
|
|
6336
|
+
"--workdir",
|
|
6337
|
+
workdir
|
|
6338
|
+
], {
|
|
6339
|
+
cwd: workdir,
|
|
6340
|
+
env: dbPassword ? { SUPABASE_DB_PASSWORD: dbPassword } : void 0,
|
|
6341
|
+
input: "",
|
|
6342
|
+
stdio: [
|
|
6343
|
+
"pipe",
|
|
6344
|
+
"pipe",
|
|
6345
|
+
"pipe"
|
|
6346
|
+
]
|
|
6347
|
+
});
|
|
6348
|
+
spinner.stop("Supabase linked ✔");
|
|
6349
|
+
} catch (err) {
|
|
6350
|
+
spinner.stop();
|
|
6351
|
+
handleSupabaseDatabaseCommandError(err, { dbPassword });
|
|
6352
|
+
}
|
|
6353
|
+
};
|
|
6354
|
+
const pushDB = async (workdir, { dbPassword }) => {
|
|
6355
|
+
try {
|
|
6356
|
+
const dbPush = await execa("npx", [
|
|
6357
|
+
"supabase",
|
|
6358
|
+
"db",
|
|
6359
|
+
"push",
|
|
6360
|
+
"--include-all"
|
|
6361
|
+
], {
|
|
6362
|
+
cwd: workdir,
|
|
6363
|
+
env: dbPassword ? { SUPABASE_DB_PASSWORD: dbPassword } : void 0,
|
|
6364
|
+
stderr: ["pipe", "inherit"],
|
|
6365
|
+
stdin: "inherit",
|
|
6366
|
+
stdout: "inherit"
|
|
6367
|
+
});
|
|
6368
|
+
_hot_updater_cli_tools.p.log.success("DB pushed ✔");
|
|
6369
|
+
return dbPush.stdout;
|
|
6370
|
+
} catch (err) {
|
|
6371
|
+
handleSupabaseDatabaseCommandError(err, {
|
|
6372
|
+
dbPassword,
|
|
6373
|
+
stderrInherited: true
|
|
6374
|
+
});
|
|
6375
|
+
}
|
|
6376
|
+
};
|
|
6377
|
+
//#endregion
|
|
6301
6378
|
//#region iac/index.ts
|
|
6302
6379
|
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
6303
6380
|
const EDGE_VENDOR_DIR = "_hot-updater";
|
|
@@ -6354,12 +6431,6 @@ export default HotUpdater.wrap({
|
|
|
6354
6431
|
baseURL: "%%source%%",
|
|
6355
6432
|
updateStrategy: "appVersion", // or "fingerprint"
|
|
6356
6433
|
})(App);`;
|
|
6357
|
-
const SUPABASE_CONFIG_TEMPLATE = `
|
|
6358
|
-
project_id = "%%projectId%%"
|
|
6359
|
-
|
|
6360
|
-
[db.seed]
|
|
6361
|
-
enabled = false
|
|
6362
|
-
`;
|
|
6363
6434
|
const resolvePackageExportPath = async (packageName, exportName) => {
|
|
6364
6435
|
const packageJsonPath = require$1.resolve(`${packageName}/package.json`);
|
|
6365
6436
|
const exportTarget = JSON.parse(await fs_promises.default.readFile(packageJsonPath, "utf-8")).exports?.[exportName];
|
|
@@ -6471,9 +6542,9 @@ const buildEdgeFunctionImports = async (targetDir) => {
|
|
|
6471
6542
|
}
|
|
6472
6543
|
};
|
|
6473
6544
|
await addWorkspacePackage({
|
|
6474
|
-
importSpecifier: "@hot-updater/server
|
|
6545
|
+
importSpecifier: "@hot-updater/server",
|
|
6475
6546
|
packageName: "@hot-updater/server",
|
|
6476
|
-
exportName: "
|
|
6547
|
+
exportName: "."
|
|
6477
6548
|
});
|
|
6478
6549
|
await addWorkspacePackage({
|
|
6479
6550
|
importSpecifier: "@hot-updater/supabase",
|
|
@@ -6591,57 +6662,6 @@ const selectBucket = async (api) => {
|
|
|
6591
6662
|
}
|
|
6592
6663
|
return JSON.parse(selectedBucketId);
|
|
6593
6664
|
};
|
|
6594
|
-
const linkSupabase = async (workdir, { projectId, dbPassword }) => {
|
|
6595
|
-
const spinner = _hot_updater_cli_tools.p.spinner();
|
|
6596
|
-
try {
|
|
6597
|
-
await fs_promises.default.writeFile(path.default.join(workdir, "supabase", "config.toml"), (0, _hot_updater_cli_tools.transformTemplate)(SUPABASE_CONFIG_TEMPLATE, { projectId }));
|
|
6598
|
-
spinner.start("Linking Supabase...");
|
|
6599
|
-
await execa("npx", [
|
|
6600
|
-
"supabase",
|
|
6601
|
-
"link",
|
|
6602
|
-
"--project-ref",
|
|
6603
|
-
projectId,
|
|
6604
|
-
"--workdir",
|
|
6605
|
-
workdir,
|
|
6606
|
-
dbPassword ? ["--password", dbPassword] : []
|
|
6607
|
-
].flat(), {
|
|
6608
|
-
cwd: workdir,
|
|
6609
|
-
input: "",
|
|
6610
|
-
stdio: [
|
|
6611
|
-
"pipe",
|
|
6612
|
-
"pipe",
|
|
6613
|
-
"pipe"
|
|
6614
|
-
]
|
|
6615
|
-
});
|
|
6616
|
-
spinner.stop("Supabase linked ✔");
|
|
6617
|
-
} catch (err) {
|
|
6618
|
-
spinner.stop();
|
|
6619
|
-
if (err instanceof ExecaError && err.stderr) _hot_updater_cli_tools.p.log.error(err.stderr);
|
|
6620
|
-
else console.error(err);
|
|
6621
|
-
process.exit(1);
|
|
6622
|
-
}
|
|
6623
|
-
};
|
|
6624
|
-
const pushDB = async (workdir, { dbPassword }) => {
|
|
6625
|
-
try {
|
|
6626
|
-
const dbPush = await execa("npx", [
|
|
6627
|
-
"supabase",
|
|
6628
|
-
"db",
|
|
6629
|
-
"push",
|
|
6630
|
-
"--include-all",
|
|
6631
|
-
dbPassword ? ["--password", dbPassword] : []
|
|
6632
|
-
].flat(), {
|
|
6633
|
-
cwd: workdir,
|
|
6634
|
-
stdio: "inherit",
|
|
6635
|
-
shell: true
|
|
6636
|
-
});
|
|
6637
|
-
_hot_updater_cli_tools.p.log.success("DB pushed ✔");
|
|
6638
|
-
return dbPush.stdout;
|
|
6639
|
-
} catch (err) {
|
|
6640
|
-
if (err instanceof ExecaError && err.stderr) _hot_updater_cli_tools.p.log.error(err.stderr);
|
|
6641
|
-
else console.error(err);
|
|
6642
|
-
process.exit(1);
|
|
6643
|
-
}
|
|
6644
|
-
};
|
|
6645
6665
|
const deployEdgeFunction = async (workdir, projectId) => {
|
|
6646
6666
|
const functionName = await _hot_updater_cli_tools.p.text({
|
|
6647
6667
|
message: "Enter a name for the edge function",
|
package/dist/iac/index.mjs
CHANGED
|
@@ -6293,6 +6293,83 @@ const supabaseApi = (supabaseUrl, supabaseServiceRoleKey) => {
|
|
|
6293
6293
|
};
|
|
6294
6294
|
};
|
|
6295
6295
|
//#endregion
|
|
6296
|
+
//#region iac/supabaseCli.ts
|
|
6297
|
+
const SUPABASE_CONFIG_TEMPLATE = `
|
|
6298
|
+
project_id = "%%projectId%%"
|
|
6299
|
+
|
|
6300
|
+
[db.seed]
|
|
6301
|
+
enabled = false
|
|
6302
|
+
`;
|
|
6303
|
+
const SUPABASE_DATABASE_CONNECTION_ERROR = "Supabase database connection failed. Check your database password and project access.";
|
|
6304
|
+
const SUPABASE_DATABASE_AUTH_ERROR_PATTERNS = [
|
|
6305
|
+
/failed SASL auth/i,
|
|
6306
|
+
/password authentication failed/i,
|
|
6307
|
+
/SQLSTATE 28P01/i,
|
|
6308
|
+
/invalid SCRAM server-final-message/i
|
|
6309
|
+
];
|
|
6310
|
+
const isSupabaseDatabaseAuthError = (err) => {
|
|
6311
|
+
const stderr = err.stderr;
|
|
6312
|
+
return typeof stderr === "string" && SUPABASE_DATABASE_AUTH_ERROR_PATTERNS.some((pattern) => pattern.test(stderr));
|
|
6313
|
+
};
|
|
6314
|
+
const handleSupabaseDatabaseCommandError = (err, { dbPassword, stderrInherited = false }) => {
|
|
6315
|
+
if (err instanceof ExecaError) if (dbPassword && isSupabaseDatabaseAuthError(err)) p.log.error(SUPABASE_DATABASE_CONNECTION_ERROR);
|
|
6316
|
+
else if (!stderrInherited && err.stderr) p.log.error(err.stderr);
|
|
6317
|
+
else console.error(err);
|
|
6318
|
+
else console.error(err);
|
|
6319
|
+
process.exit(1);
|
|
6320
|
+
};
|
|
6321
|
+
const linkSupabase = async (workdir, { projectId, dbPassword }) => {
|
|
6322
|
+
const spinner = p.spinner();
|
|
6323
|
+
try {
|
|
6324
|
+
await fs.writeFile(path.join(workdir, "supabase", "config.toml"), transformTemplate(SUPABASE_CONFIG_TEMPLATE, { projectId }));
|
|
6325
|
+
spinner.start("Linking Supabase...");
|
|
6326
|
+
await execa("npx", [
|
|
6327
|
+
"supabase",
|
|
6328
|
+
"link",
|
|
6329
|
+
"--project-ref",
|
|
6330
|
+
projectId,
|
|
6331
|
+
"--workdir",
|
|
6332
|
+
workdir
|
|
6333
|
+
], {
|
|
6334
|
+
cwd: workdir,
|
|
6335
|
+
env: dbPassword ? { SUPABASE_DB_PASSWORD: dbPassword } : void 0,
|
|
6336
|
+
input: "",
|
|
6337
|
+
stdio: [
|
|
6338
|
+
"pipe",
|
|
6339
|
+
"pipe",
|
|
6340
|
+
"pipe"
|
|
6341
|
+
]
|
|
6342
|
+
});
|
|
6343
|
+
spinner.stop("Supabase linked ✔");
|
|
6344
|
+
} catch (err) {
|
|
6345
|
+
spinner.stop();
|
|
6346
|
+
handleSupabaseDatabaseCommandError(err, { dbPassword });
|
|
6347
|
+
}
|
|
6348
|
+
};
|
|
6349
|
+
const pushDB = async (workdir, { dbPassword }) => {
|
|
6350
|
+
try {
|
|
6351
|
+
const dbPush = await execa("npx", [
|
|
6352
|
+
"supabase",
|
|
6353
|
+
"db",
|
|
6354
|
+
"push",
|
|
6355
|
+
"--include-all"
|
|
6356
|
+
], {
|
|
6357
|
+
cwd: workdir,
|
|
6358
|
+
env: dbPassword ? { SUPABASE_DB_PASSWORD: dbPassword } : void 0,
|
|
6359
|
+
stderr: ["pipe", "inherit"],
|
|
6360
|
+
stdin: "inherit",
|
|
6361
|
+
stdout: "inherit"
|
|
6362
|
+
});
|
|
6363
|
+
p.log.success("DB pushed ✔");
|
|
6364
|
+
return dbPush.stdout;
|
|
6365
|
+
} catch (err) {
|
|
6366
|
+
handleSupabaseDatabaseCommandError(err, {
|
|
6367
|
+
dbPassword,
|
|
6368
|
+
stderrInherited: true
|
|
6369
|
+
});
|
|
6370
|
+
}
|
|
6371
|
+
};
|
|
6372
|
+
//#endregion
|
|
6296
6373
|
//#region iac/index.ts
|
|
6297
6374
|
const require$1 = createRequire(import.meta.url);
|
|
6298
6375
|
const EDGE_VENDOR_DIR = "_hot-updater";
|
|
@@ -6349,12 +6426,6 @@ export default HotUpdater.wrap({
|
|
|
6349
6426
|
baseURL: "%%source%%",
|
|
6350
6427
|
updateStrategy: "appVersion", // or "fingerprint"
|
|
6351
6428
|
})(App);`;
|
|
6352
|
-
const SUPABASE_CONFIG_TEMPLATE = `
|
|
6353
|
-
project_id = "%%projectId%%"
|
|
6354
|
-
|
|
6355
|
-
[db.seed]
|
|
6356
|
-
enabled = false
|
|
6357
|
-
`;
|
|
6358
6429
|
const resolvePackageExportPath = async (packageName, exportName) => {
|
|
6359
6430
|
const packageJsonPath = require$1.resolve(`${packageName}/package.json`);
|
|
6360
6431
|
const exportTarget = JSON.parse(await fs.readFile(packageJsonPath, "utf-8")).exports?.[exportName];
|
|
@@ -6466,9 +6537,9 @@ const buildEdgeFunctionImports = async (targetDir) => {
|
|
|
6466
6537
|
}
|
|
6467
6538
|
};
|
|
6468
6539
|
await addWorkspacePackage({
|
|
6469
|
-
importSpecifier: "@hot-updater/server
|
|
6540
|
+
importSpecifier: "@hot-updater/server",
|
|
6470
6541
|
packageName: "@hot-updater/server",
|
|
6471
|
-
exportName: "
|
|
6542
|
+
exportName: "."
|
|
6472
6543
|
});
|
|
6473
6544
|
await addWorkspacePackage({
|
|
6474
6545
|
importSpecifier: "@hot-updater/supabase",
|
|
@@ -6586,57 +6657,6 @@ const selectBucket = async (api) => {
|
|
|
6586
6657
|
}
|
|
6587
6658
|
return JSON.parse(selectedBucketId);
|
|
6588
6659
|
};
|
|
6589
|
-
const linkSupabase = async (workdir, { projectId, dbPassword }) => {
|
|
6590
|
-
const spinner = p.spinner();
|
|
6591
|
-
try {
|
|
6592
|
-
await fs.writeFile(path.join(workdir, "supabase", "config.toml"), transformTemplate(SUPABASE_CONFIG_TEMPLATE, { projectId }));
|
|
6593
|
-
spinner.start("Linking Supabase...");
|
|
6594
|
-
await execa("npx", [
|
|
6595
|
-
"supabase",
|
|
6596
|
-
"link",
|
|
6597
|
-
"--project-ref",
|
|
6598
|
-
projectId,
|
|
6599
|
-
"--workdir",
|
|
6600
|
-
workdir,
|
|
6601
|
-
dbPassword ? ["--password", dbPassword] : []
|
|
6602
|
-
].flat(), {
|
|
6603
|
-
cwd: workdir,
|
|
6604
|
-
input: "",
|
|
6605
|
-
stdio: [
|
|
6606
|
-
"pipe",
|
|
6607
|
-
"pipe",
|
|
6608
|
-
"pipe"
|
|
6609
|
-
]
|
|
6610
|
-
});
|
|
6611
|
-
spinner.stop("Supabase linked ✔");
|
|
6612
|
-
} catch (err) {
|
|
6613
|
-
spinner.stop();
|
|
6614
|
-
if (err instanceof ExecaError && err.stderr) p.log.error(err.stderr);
|
|
6615
|
-
else console.error(err);
|
|
6616
|
-
process.exit(1);
|
|
6617
|
-
}
|
|
6618
|
-
};
|
|
6619
|
-
const pushDB = async (workdir, { dbPassword }) => {
|
|
6620
|
-
try {
|
|
6621
|
-
const dbPush = await execa("npx", [
|
|
6622
|
-
"supabase",
|
|
6623
|
-
"db",
|
|
6624
|
-
"push",
|
|
6625
|
-
"--include-all",
|
|
6626
|
-
dbPassword ? ["--password", dbPassword] : []
|
|
6627
|
-
].flat(), {
|
|
6628
|
-
cwd: workdir,
|
|
6629
|
-
stdio: "inherit",
|
|
6630
|
-
shell: true
|
|
6631
|
-
});
|
|
6632
|
-
p.log.success("DB pushed ✔");
|
|
6633
|
-
return dbPush.stdout;
|
|
6634
|
-
} catch (err) {
|
|
6635
|
-
if (err instanceof ExecaError && err.stderr) p.log.error(err.stderr);
|
|
6636
|
-
else console.error(err);
|
|
6637
|
-
process.exit(1);
|
|
6638
|
-
}
|
|
6639
|
-
};
|
|
6640
6660
|
const deployEdgeFunction = async (workdir, projectId) => {
|
|
6641
6661
|
const functionName = await p.text({
|
|
6642
6662
|
message: "Enter a name for the edge function",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@supabase/supabase-js": "2.76.1",
|
|
51
51
|
"hono": "4.12.9",
|
|
52
52
|
"uuidv7": "^1.0.2",
|
|
53
|
-
"@hot-updater/
|
|
54
|
-
"@hot-updater/
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/
|
|
53
|
+
"@hot-updater/core": "0.35.0",
|
|
54
|
+
"@hot-updater/plugin-core": "0.35.0",
|
|
55
|
+
"@hot-updater/server": "0.35.0",
|
|
56
|
+
"@hot-updater/cli-tools": "0.35.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@electric-sql/pglite": "0.4.1",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"execa": "9.5.2",
|
|
64
64
|
"@types/node": "^20",
|
|
65
65
|
"mime": "^4.0.4",
|
|
66
|
-
"@hot-updater/js": "0.
|
|
67
|
-
"@hot-updater/mock": "0.
|
|
68
|
-
"@hot-updater/
|
|
69
|
-
"@hot-updater/
|
|
66
|
+
"@hot-updater/js": "0.35.0",
|
|
67
|
+
"@hot-updater/mock": "0.35.0",
|
|
68
|
+
"@hot-updater/test-utils": "0.35.0",
|
|
69
|
+
"@hot-updater/postgres": "0.35.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown",
|
|
@@ -15,7 +15,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
15
15
|
|
|
16
16
|
import { transformEnv } from "@hot-updater/cli-tools";
|
|
17
17
|
import { type Bundle, type GetBundlesArgs, NIL_UUID } from "@hot-updater/core";
|
|
18
|
-
import { createHotUpdater } from "@hot-updater/server
|
|
18
|
+
import { createHotUpdater } from "@hot-updater/server";
|
|
19
19
|
import {
|
|
20
20
|
setupBsdiffManifestUpdateInfoTestSuite,
|
|
21
21
|
setupGetUpdateInfoTestSuite,
|
|
@@ -63,7 +63,7 @@ const REQUIRED_BUILD_ARTIFACTS = [
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
command: "pnpm --filter @hot-updater/server build",
|
|
66
|
-
path: path.join(WORKSPACE_ROOT, "packages/server/dist/
|
|
66
|
+
path: path.join(WORKSPACE_ROOT, "packages/server/dist/index.mjs"),
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
command: "pnpm --filter @hot-updater/plugin-core build",
|
|
@@ -925,8 +925,8 @@ const writeSupabaseRuntimeFiles = async ({
|
|
|
925
925
|
);
|
|
926
926
|
const importMap = {
|
|
927
927
|
imports: {
|
|
928
|
-
"@hot-updater/server
|
|
929
|
-
path.join(WORKSPACE_ROOT, "packages/server/dist/
|
|
928
|
+
"@hot-updater/server": pathToFileURL(
|
|
929
|
+
path.join(WORKSPACE_ROOT, "packages/server/dist/index.mjs"),
|
|
930
930
|
).href,
|
|
931
931
|
"@hot-updater/supabase": pathToFileURL(
|
|
932
932
|
path.join(runtimeRoot, "hot-updater-supabase-edge.ts"),
|