smoonb 1.0.7 → 1.0.9
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/CHANGELOG.md +43 -0
- package/README.md +27 -7
- package/README.pt-BR.md +27 -7
- package/package.json +4 -3
- package/src/commands/backup/steps/05-auth-settings.js +6 -2
- package/src/commands/backup/steps/06-realtime-settings.js +19 -33
- package/src/commands/backup/steps/07-storage.js +7 -12
- package/src/commands/backup/steps/09-edge-functions.js +76 -202
- package/src/commands/restore/auth-fields.json +237 -0
- package/src/commands/restore/auth.js +65 -0
- package/src/commands/restore/dump.js +284 -0
- package/src/commands/restore/index.js +8 -127
- package/src/commands/restore/management.js +96 -0
- package/src/commands/restore/pg.js +83 -0
- package/src/commands/restore/runner.js +140 -0
- package/src/commands/restore/steps/03-database.js +18 -84
- package/src/commands/restore/steps/04-edge-functions.js +95 -122
- package/src/commands/restore/steps/05-auth-settings.js +15 -54
- package/src/commands/restore/steps/06-storage.js +203 -584
- package/src/commands/restore/steps/07-database-settings.js +87 -69
- package/src/commands/restore/steps/08-realtime-settings.js +61 -53
- package/src/i18n/locales/en.json +803 -797
- package/src/i18n/locales/pt-BR.json +802 -796
- package/src/utils/auth-secrets.js +23 -0
- package/src/utils/supabaseCli.js +32 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Supabase SMTP passwords are write-only. The GET response is not a
|
|
2
|
+
// transferable credential, even when it looks like an ordinary string.
|
|
3
|
+
// https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx
|
|
4
|
+
function authSnapshot(settings) {
|
|
5
|
+
const { smtp_pass: smtpPass, ...readable } = settings;
|
|
6
|
+
return {
|
|
7
|
+
settings: readable,
|
|
8
|
+
secrets: {
|
|
9
|
+
smtp_pass: {
|
|
10
|
+
exportable: false,
|
|
11
|
+
requires_input: Boolean(smtpPass || settings.smtp_host),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isMasked(value) {
|
|
18
|
+
return (
|
|
19
|
+
typeof value === 'string' && /^(\*{3,}|[•●]{3,}|\[redacted\])$/i.test(value)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { authSnapshot, isMasked };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
// npm installs a .cmd shim on Windows; execFile cannot execute that shim safely.
|
|
6
|
+
// Resolve its package entry point instead of interpolating arguments into cmd.exe.
|
|
7
|
+
function runSupabase(_command, args, options = {}) {
|
|
8
|
+
if (process.platform !== 'win32')
|
|
9
|
+
return execFileSync('supabase', args, options);
|
|
10
|
+
for (const directory of (process.env.PATH || '').split(path.delimiter)) {
|
|
11
|
+
const executable = path.join(directory, 'supabase.exe');
|
|
12
|
+
if (fs.existsSync(executable))
|
|
13
|
+
return execFileSync(executable, args, options);
|
|
14
|
+
for (const root of [
|
|
15
|
+
path.join(directory, 'node_modules', 'supabase'),
|
|
16
|
+
path.resolve(directory, '..', 'supabase'),
|
|
17
|
+
]) {
|
|
18
|
+
const file = path.join(root, 'package.json');
|
|
19
|
+
if (!fs.existsSync(file)) continue;
|
|
20
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
21
|
+
const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.supabase;
|
|
22
|
+
if (!bin) continue;
|
|
23
|
+
const entry = path.resolve(root, bin);
|
|
24
|
+
if (!fs.existsSync(entry)) continue;
|
|
25
|
+
if (entry.endsWith('.js'))
|
|
26
|
+
return execFileSync(process.execPath, [entry, ...args], options);
|
|
27
|
+
return execFileSync(entry, args, options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
throw new Error('Supabase CLI executable was not found in PATH');
|
|
31
|
+
}
|
|
32
|
+
module.exports = { runSupabase };
|