instant-cli 1.0.60 → 1.0.61
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/.turbo/turbo-build.log +1 -1
- package/__tests__/backupDownload.test.ts +206 -0
- package/__tests__/backups.test.ts +221 -0
- package/dist/commands/backup/download.d.ts +10 -0
- package/dist/commands/backup/download.d.ts.map +1 -0
- package/dist/commands/backup/download.js +174 -0
- package/dist/commands/backup/download.js.map +1 -0
- package/dist/commands/backup/list.d.ts +11 -0
- package/dist/commands/backup/list.d.ts.map +1 -0
- package/dist/commands/backup/list.js +74 -0
- package/dist/commands/backup/list.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/backupDownload.d.ts +21 -0
- package/dist/lib/backupDownload.d.ts.map +1 -0
- package/dist/lib/backupDownload.js +113 -0
- package/dist/lib/backupDownload.js.map +1 -0
- package/dist/lib/backups.d.ts +12 -0
- package/dist/lib/backups.d.ts.map +1 -0
- package/dist/lib/backups.js +26 -0
- package/dist/lib/backups.js.map +1 -0
- package/dist/lib/platformApi.d.ts +5 -0
- package/dist/lib/platformApi.d.ts.map +1 -0
- package/dist/lib/platformApi.js +11 -0
- package/dist/lib/platformApi.js.map +1 -0
- package/dist/lib/webhooks.d.ts +4 -5
- package/dist/lib/webhooks.d.ts.map +1 -1
- package/dist/lib/webhooks.js +2 -9
- package/dist/lib/webhooks.js.map +1 -1
- package/dist/ui/lib.d.ts +1 -1
- package/dist/ui/lib.d.ts.map +1 -1
- package/dist/ui/lib.js.map +1 -1
- package/package.json +5 -4
- package/src/commands/backup/download.ts +231 -0
- package/src/commands/backup/list.ts +94 -0
- package/src/index.ts +60 -0
- package/src/lib/backupDownload.ts +145 -0
- package/src/lib/backups.ts +33 -0
- package/src/lib/platformApi.ts +11 -0
- package/src/lib/webhooks.ts +1 -10
- package/src/ui/lib.ts +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { formatFileSize } from '@instantdb/platform';
|
|
4
|
+
import { useBackupsManager } from "../../lib/backups.js";
|
|
5
|
+
export const formatBackupDate = (date) => `${date.toISOString().replace('T', ' ').slice(0, 16)} UTC`;
|
|
6
|
+
// Backup descriptions are user-controlled text headed for the terminal;
|
|
7
|
+
// strip control characters so a crafted value can't inject escape sequences.
|
|
8
|
+
export const stripControlChars = (s) => s.replace(/\p{Cc}/gu, '');
|
|
9
|
+
// Relative times in both directions: "3 hours ago", "6 days from now".
|
|
10
|
+
export const relativeTime = (date) => {
|
|
11
|
+
const diffMs = date.getTime() - Date.now();
|
|
12
|
+
const abs = Math.abs(diffMs);
|
|
13
|
+
if (abs < 60_000)
|
|
14
|
+
return diffMs <= 0 ? 'just now' : 'now';
|
|
15
|
+
const minutes = Math.round(abs / 60_000);
|
|
16
|
+
const hours = Math.round(abs / 3_600_000);
|
|
17
|
+
const days = Math.round(abs / 86_400_000);
|
|
18
|
+
const [count, unit] = minutes < 60
|
|
19
|
+
? [minutes, 'minute']
|
|
20
|
+
: hours < 24
|
|
21
|
+
? [hours, 'hour']
|
|
22
|
+
: [days, 'day'];
|
|
23
|
+
const label = `${count} ${unit}${count === 1 ? '' : 's'}`;
|
|
24
|
+
return diffMs < 0 ? `${label} ago` : `${label} from now`;
|
|
25
|
+
};
|
|
26
|
+
// One aligned row per backup, newest first: id first, relative times.
|
|
27
|
+
// `--json` carries the precise values.
|
|
28
|
+
export const renderBackupsTable = (backups) => Effect.gen(function* () {
|
|
29
|
+
const header = [
|
|
30
|
+
'ID',
|
|
31
|
+
'CREATED AT',
|
|
32
|
+
'DB SIZE',
|
|
33
|
+
'STORAGE',
|
|
34
|
+
'EXPIRES AT',
|
|
35
|
+
'DESCRIPTION',
|
|
36
|
+
];
|
|
37
|
+
const rows = backups.map((backup) => [
|
|
38
|
+
backup.id,
|
|
39
|
+
relativeTime(backup.backupAt),
|
|
40
|
+
backup.dbSize != null ? formatFileSize(backup.dbSize) : '-',
|
|
41
|
+
backup.filesSize != null ? formatFileSize(backup.filesSize) : '-',
|
|
42
|
+
backup.expiresAt
|
|
43
|
+
? backup.expiresAt.getTime() <= Date.now()
|
|
44
|
+
? 'expired'
|
|
45
|
+
: relativeTime(backup.expiresAt)
|
|
46
|
+
: '-',
|
|
47
|
+
backup.description ? stripControlChars(backup.description) : '',
|
|
48
|
+
]);
|
|
49
|
+
const widths = header.map((h, i) => Math.max(h.length, ...rows.map((row) => row[i].length)));
|
|
50
|
+
const line = (cells) => cells
|
|
51
|
+
.map((cell, i) => cell.padEnd(widths[i]))
|
|
52
|
+
.join(' ')
|
|
53
|
+
.trimEnd();
|
|
54
|
+
yield* Effect.log(chalk.dim(line(header)));
|
|
55
|
+
yield* Effect.log(chalk.dim(widths.map((w) => '-'.repeat(w)).join(' ')));
|
|
56
|
+
for (const row of rows) {
|
|
57
|
+
yield* Effect.log(line(row));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export const backupListCmd = Effect.fn(function* (opts) {
|
|
61
|
+
const backups = yield* useBackupsManager((m) => m.list(), 'Error listing backups');
|
|
62
|
+
if (opts.json) {
|
|
63
|
+
yield* Effect.log(JSON.stringify(backups, null, 2));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (backups.length === 0) {
|
|
67
|
+
yield* Effect.log('No backups yet.');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// The server returns newest first; sort anyway so the table can't lie.
|
|
71
|
+
const sorted = [...backups].sort((a, b) => b.backupAt.getTime() - a.backupAt.getTime());
|
|
72
|
+
yield* renderBackupsTable(sorted);
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/backup/list.ts"],"names":[],"mappings":"AAAA,O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iBAAiB,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EACf,uBAAuB,CACxB,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,uEAAuE;IACvE,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CACtD,CAAC;IACF,KAAK,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport { formatFileSize, type AppBackup } from '@instantdb/platform';\nimport type { backupListDef, OptsFromCommand } from '../../index.ts';\nimport { useBackupsManager } from '../../lib/backups.ts';\n\nexport const formatBackupDate = (date: Date) =>\n `${date.toISOString().replace('T', ' ').slice(0, 16)} UTC`;\n\n// Backup descriptions are user-controlled text headed for the terminal;\n// strip control characters so a crafted value can't inject escape sequences.\nexport const stripControlChars = (s: string) => s.replace(/\\p{Cc}/gu, '');\n\n// Relative times in both directions: \"3 hours ago\", \"6 days from now\".\nexport const relativeTime = (date: Date): string => {\n const diffMs = date.getTime() - Date.now();\n const abs = Math.abs(diffMs);\n if (abs < 60_000) return diffMs <= 0 ? 'just now' : 'now';\n const minutes = Math.round(abs / 60_000);\n const hours = Math.round(abs / 3_600_000);\n const days = Math.round(abs / 86_400_000);\n const [count, unit] =\n minutes < 60\n ? [minutes, 'minute']\n : hours < 24\n ? [hours, 'hour']\n : [days, 'day'];\n const label = `${count} ${unit}${count === 1 ? '' : 's'}`;\n return diffMs < 0 ? `${label} ago` : `${label} from now`;\n};\n\n// One aligned row per backup, newest first: id first, relative times.\n// `--json` carries the precise values.\nexport const renderBackupsTable = (backups: AppBackup[]) =>\n Effect.gen(function* () {\n const header = [\n 'ID',\n 'CREATED AT',\n 'DB SIZE',\n 'STORAGE',\n 'EXPIRES AT',\n 'DESCRIPTION',\n ];\n const rows = backups.map((backup) => [\n backup.id,\n relativeTime(backup.backupAt),\n backup.dbSize != null ? formatFileSize(backup.dbSize) : '-',\n backup.filesSize != null ? formatFileSize(backup.filesSize) : '-',\n backup.expiresAt\n ? backup.expiresAt.getTime() <= Date.now()\n ? 'expired'\n : relativeTime(backup.expiresAt)\n : '-',\n backup.description ? stripControlChars(backup.description) : '',\n ]);\n const widths = header.map((h, i) =>\n Math.max(h.length, ...rows.map((row) => row[i].length)),\n );\n const line = (cells: string[]) =>\n cells\n .map((cell, i) => cell.padEnd(widths[i]))\n .join(' ')\n .trimEnd();\n yield* Effect.log(chalk.dim(line(header)));\n yield* Effect.log(chalk.dim(widths.map((w) => '-'.repeat(w)).join(' ')));\n for (const row of rows) {\n yield* Effect.log(line(row));\n }\n });\n\nexport const backupListCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof backupListDef>,\n) {\n const backups = yield* useBackupsManager(\n (m) => m.list(),\n 'Error listing backups',\n );\n\n if (opts.json) {\n yield* Effect.log(JSON.stringify(backups, null, 2));\n return;\n }\n\n if (backups.length === 0) {\n yield* Effect.log('No backups yet.');\n return;\n }\n\n // The server returns newest first; sort anyway so the table can't lie.\n const sorted = [...backups].sort(\n (a, b) => b.backupAt.getTime() - a.backupAt.getTime(),\n );\n yield* renderBackupsTable(sorted);\n});\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,15 @@ export declare const webhooksEventsPayloadDef: Command<[], {
|
|
|
92
92
|
isn?: string | undefined;
|
|
93
93
|
app?: string | undefined;
|
|
94
94
|
}, {}>;
|
|
95
|
+
export declare const backupListDef: Command<[], {
|
|
96
|
+
app?: string | undefined;
|
|
97
|
+
json?: true | undefined;
|
|
98
|
+
}, {}>;
|
|
99
|
+
export declare const backupDownloadDef: Command<[string | undefined], {
|
|
100
|
+
app?: string | undefined;
|
|
101
|
+
latest?: true | undefined;
|
|
102
|
+
out?: string | undefined;
|
|
103
|
+
}, {}>;
|
|
95
104
|
export declare const authEmailStatusDef: Command<[], {
|
|
96
105
|
app?: string | undefined;
|
|
97
106
|
json?: true | undefined;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAmD9D,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAiBnD,eAAO,MAAM,OAAO;;;;;MAgChB,CAAC;AASL,eAAO,MAAM,UAAU;;MAenB,CAAC;AAEL,eAAO,MAAM,YAAY;;MAkBrB,CAAC;AAGL,eAAO,MAAM,gBAAgB;;;;MA+DzB,CAAC;AACL,eAAO,MAAM,iBAAiB;;;MAsB1B,CAAC;AAEL,eAAO,MAAM,mBAAmB;;;;MAoB5B,CAAC;AAEL,eAAO,MAAM,mBAAmB;;;;MAyD5B,CAAC;AAGL,eAAO,MAAM,iBAAiB;;;MAoB1B,CAAC;AAEL,eAAO,MAAM,gBAAgB;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
43
|
import { emailStatusCmd } from "./commands/auth/email/status.js";
|
|
44
44
|
import { verifyCmd } from "./commands/auth/email/verify.js";
|
|
45
45
|
import { resendEmailCmd } from "./commands/auth/email/resend.js";
|
|
46
|
+
import { backupListCmd } from "./commands/backup/list.js";
|
|
47
|
+
import { backupDownloadCmd } from "./commands/backup/download.js";
|
|
46
48
|
program
|
|
47
49
|
.name('instant-cli')
|
|
48
50
|
.addOption(globalOption('-t --token <token>', 'Auth token override'))
|
|
@@ -396,6 +398,37 @@ export const webhooksEventsPayloadDef = webhooksEvents
|
|
|
396
398
|
allowAdminToken: false,
|
|
397
399
|
}))));
|
|
398
400
|
});
|
|
401
|
+
const backup = program
|
|
402
|
+
.command('backup')
|
|
403
|
+
.description('View and download backups of your app');
|
|
404
|
+
export const backupListDef = backup
|
|
405
|
+
.command('list')
|
|
406
|
+
.description('List downloadable backups for an app')
|
|
407
|
+
.option('-a --app <app-id>', 'App ID to list backups for. Defaults to *_INSTANT_APP_ID in .env')
|
|
408
|
+
.option('--json', 'Output backups as JSON')
|
|
409
|
+
.action((opts) => {
|
|
410
|
+
return runCommandEffect(backupListCmd(opts).pipe(Effect.provide(WithAppLayer({
|
|
411
|
+
coerce: false,
|
|
412
|
+
coerceAuth: false,
|
|
413
|
+
appId: opts.app,
|
|
414
|
+
allowAdminToken: true,
|
|
415
|
+
}).pipe(Layer.annotateLogs('silent', !!opts.json)))));
|
|
416
|
+
});
|
|
417
|
+
export const backupDownloadDef = backup
|
|
418
|
+
.command('download')
|
|
419
|
+
.description('Download a backup as a zip file')
|
|
420
|
+
.argument('[backup-id]', 'Backup ID to download. Defaults to an interactive picker')
|
|
421
|
+
.option('-a --app <app-id>', 'App ID to download a backup of. Defaults to *_INSTANT_APP_ID in .env')
|
|
422
|
+
.option('--latest', 'Download the most recent backup')
|
|
423
|
+
.option('-o --out <path>', 'Output zip path. Defaults to instant-backup-<timestamp>.zip')
|
|
424
|
+
.action((backupId, opts) => {
|
|
425
|
+
return runCommandEffect(backupDownloadCmd(backupId, opts).pipe(Effect.provide(WithAppLayer({
|
|
426
|
+
coerce: false,
|
|
427
|
+
coerceAuth: false,
|
|
428
|
+
appId: opts.app,
|
|
429
|
+
allowAdminToken: true,
|
|
430
|
+
}))));
|
|
431
|
+
});
|
|
399
432
|
const authEmail = auth
|
|
400
433
|
.command('email')
|
|
401
434
|
.description('Manage custom magic code email templates');
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,CAAC;AAEV,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ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AG,CAAC,CAAC,GAAQ,EAAE,EAAE;QAC/D,OAAO,UAAU,CACf,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAC1B,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAClC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1B,UAAU,CAAC,WAAW,CAAC;YACvB,EAAE;SACH,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE;YAChE,OAAO,UAAU,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,CAAC,gBAAgB,CAAC;gBAC5B,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,aAAa,CAAC;IACpB,iBAAiB,EAAE,IAAI;IACvB,UAAU;CACX,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\n\nloadEnv();\n\nimport minimist from 'minimist';\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\nimport { authClientAddCmd } from './commands/auth/client/add.ts';\nimport { authClientListCmd } from './commands/auth/client/list.ts';\nimport { authClientDeleteCmd } from './commands/auth/client/delete.ts';\nimport { authClientUpdateCmd } from './commands/auth/client/update.ts';\nimport { authOriginListCmd } from './commands/auth/origin/list.ts';\nimport { authOriginDeleteCmd } from './commands/auth/origin/delete.ts';\nimport { authOriginAddCmd } from './commands/auth/origin/add.ts';\nimport { authEmailPushCmd } from './commands/auth/email/push.ts';\nimport { authEmailPullCmd } from './commands/auth/email/pull.ts';\nimport { authEmailResetCmd } from './commands/auth/email/reset.ts';\nimport { link } from './logging.ts';\nimport { appListCommand } from './commands/app/list.ts';\nimport { appDeleteCommand } from './commands/app/delete.ts';\nimport { webhooksListCmd } from './commands/webhooks/list.ts';\nimport { webhooksAddCmd } from './commands/webhooks/add.ts';\nimport { webhooksUpdateCmd } from './commands/webhooks/update.ts';\nimport { webhooksDeleteCmd } from './commands/webhooks/delete.ts';\nimport { webhooksEnableCmd } from './commands/webhooks/enable.ts';\nimport { webhooksDisableCmd } from './commands/webhooks/disable.ts';\nimport { webhooksEventsListCmd } from './commands/webhooks/events/list.ts';\nimport { webhooksEventsPayloadCmd } from './commands/webhooks/events/payload.ts';\nimport { webhooksEventsResendCmd } from './commands/webhooks/events/resend.ts';\nimport { emailStatusCmd } from './commands/auth/email/status.ts';\nimport { verifyCmd } from './commands/auth/email/verify.ts';\nimport { resendEmailCmd } from './commands/auth/email/resend.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n temp: options.temp,\n }),\n ),\n ),\n );\n });\n\nconst auth = program\n .command('auth')\n .description('Manage authentication for your app');\nconst app = program\n .command('app')\n .description('Manage individual InstantDB apps');\n\nexport const appListDef = app\n .command('list')\n .description('List apps on your Instant account')\n .option('--json', 'Output apps as JSON')\n .action(async (opts) => {\n return runCommandEffect(\n appListCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const appDeleteDef = app\n .command('delete')\n .description('Delete an app from your Instant account')\n .option(\n '-a --app <app-id>',\n 'App ID to delete. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n appDeleteCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst authClient = auth.command('client');\nexport const authClientAddDef = authClient\n .command('add')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option(\n '--type <google|github|apple|linkedin>',\n 'Type of oauth client to add',\n )\n .option(\n '--name <client name>',\n 'Custom name to identify the OAuth client (ex: google-web)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to modify. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --app-type web|ios|android|button-for-web\n --dev-credentials (optional, web only)\n --client-id (required unless using dev credentials)\n --client-secret (web only, unless using dev credentials)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id (Services ID from ${link('https://developer.apple.com', 'developer.apple.com')})\n --team-id (optional, required for web redirect flow)\n --key-id (optional, required for web redirect flow)\n --private-key-file (optional, path to .p8 PEM; required for web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key (Publishable Key from ${link('https://dashboard.clerk.com', 'dashboard.clerk.com')})\n Firebase:\n --project-id (Project ID from ${link('https://console.firebase.google.com', 'console.firebase.google.com')})\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n return runCommandEffect(\n authClientAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\nexport const authClientListDef = authClient\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list clients for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .allowUnknownOption(true)\n .action((opts) => {\n return runCommandEffect(\n authClientListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n // Silence \"searching for instant sdk.. logs for json output\"\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authClientDeleteDef = authClient\n .command('delete')\n .option('--id <client-id>', 'Client ID to delete')\n .option('--name <client-name>', 'Client name to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete a client from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authClientDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authClientUpdateDef = authClient\n .command('update')\n .description('Update an OAuth client')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option('--id <client-id>', 'Client ID to update')\n .option('--name <client-name>', 'Client name to update')\n .option(\n '-a --app <app-id>',\n 'App ID to update a client in. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --dev-credentials (web only)\n --client-id\n --client-secret (web only)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id\n --team-id (web redirect flow)\n --key-id (web redirect flow)\n --private-key-file (web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key\n Firebase:\n --project-id\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n\n return runCommandEffect(\n authClientUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst authOrigin = auth.command('origin');\nexport const authOriginListDef = authOrigin\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list origins for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n authOriginListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authOriginAddDef = authOrigin\n .command('add')\n .option(\n '--type <website|vercel|netlify|custom-scheme>',\n 'Type of origin to add.',\n )\n .option('--url <url>', 'Website URL (for website type, e.g. example.com)')\n .option(\n '--project <name>',\n 'Vercel project name (for vercel type, e.g. my-project)',\n )\n .option('--site <name>', 'Netlify site name (for netlify type, e.g. my-site)')\n .option(\n '--scheme <scheme>',\n 'App scheme (for custom-scheme type, e.g. myapp://)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add an origin to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nOrigin Types:\n website A standard website origin (e.g. example.com)\n vercel Vercel preview deployments (project name)\n netlify Netlify preview deployments (site name)\n custom-scheme Native app scheme (e.g. your-app-scheme://)\n`,\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authOriginDeleteDef = authOrigin\n .command('delete')\n .option('--id <origin-id>', 'Origin ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete an origin from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst webhooks = program\n .command('webhook')\n .description('Manage webhooks for an app');\n\nexport const webhooksListDef = webhooks\n .command('list')\n .description('List webhooks for an app')\n .option(\n '-a --app <app-id>',\n 'App ID to list webhooks for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n webhooksListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksAddDef = webhooks\n .command('add')\n .description('Add a webhook to an app')\n .option('--url <url>', 'HTTPS endpoint to deliver events to')\n .option(\n '--namespaces <e1,e2>',\n 'Comma-separated list of namespaces to listen on',\n )\n .option(\n '--actions <a1,a2>',\n 'Comma-separated list of actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add a webhook to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksUpdateDef = webhooks\n .command('update')\n .description('Update a webhook')\n .option('--id <webhook-id>', 'Webhook ID to update')\n .option('--url <url>', 'New HTTPS endpoint')\n .option('--namespaces <e1,e2>', 'New comma-separated namespaces')\n .option(\n '--actions <a1,a2>',\n 'New comma-separated actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDeleteDef = webhooks\n .command('delete')\n .description('Delete a webhook')\n .option('--id <webhook-id>', 'Webhook ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEnableDef = webhooks\n .command('enable')\n .description('Re-enable a disabled webhook')\n .option('--id <webhook-id>', 'Webhook ID to enable')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEnableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDisableDef = webhooks\n .command('disable')\n .description('Disable an active webhook')\n .option('--id <webhook-id>', 'Webhook ID to disable')\n .option('--reason <reason>', 'Human-readable reason stored on the webhook')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDisableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst webhooksEvents = webhooks\n .command('event')\n .description('Inspect and resend webhook events');\n\nexport const webhooksEventsListDef = webhooksEvents\n .command('list')\n .description('List recent events for a webhook (up to 100, newest first)')\n .option('--webhook-id <webhook-id>', 'Webhook ID to inspect')\n .option('--json', 'Enable JSON output')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksEventsResendDef = webhooksEvents\n .command('resend')\n .description('Re-queue a webhook event for delivery')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to resend')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsResendCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEventsPayloadDef = webhooksEvents\n .command('payload')\n .description('Print the JSON payload for a webhook event')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to fetch')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsPayloadCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst authEmail = auth\n .command('email')\n .description('Manage custom magic code email templates');\n\nexport const authEmailStatusDef = authEmail\n .command('status')\n .description('Get status for the custom magic code email template')\n .option(\n '-a --app <app-id>',\n 'App ID to push email settings to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Output email status as JSON')\n .action((opts) => {\n runCommandEffect(\n emailStatusCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n appId: opts.app,\n coerce: false,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authEmailPushDef = authEmail\n .command('push')\n .description('Push the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to push email settings to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-f --file <path>',\n 'Path to instant.email.ts. Defaults to INSTANT_EMAIL_FILE_PATH or auto-discovery.',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailPushCmd({ file: opts.file }).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailPullDef = authEmail\n .command('pull')\n .description('Pull the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to pull email settings from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-f --file <path>',\n 'Path to instant.email.ts. Defaults to INSTANT_EMAIL_FILE_PATH or auto-discovery.',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailPullCmd({ file: opts.file }).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailResetDef = authEmail\n .command('reset')\n .description('Delete the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailResetCmd().pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailResendDef = authEmail\n .command('resend')\n .description('Resend the verification email')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(() => {\n runCommandEffect(\n resendEmailCmd.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authEmailVerifyDef = authEmail\n .command('verify')\n .description('Verify a custom email sender with a magic code')\n .argument('<code>', 'The magic code to verify')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((code, opts) => {\n runCommandEffect(\n verifyCmd(code, opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version, login status, and app info')\n .action(async () => {\n const authLayer = AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n });\n\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n Layer.mergeAll(\n BaseLayerLive,\n authLayer.pipe(Layer.catchAll(() => Layer.empty)),\n WithAppLayer({ coerce: false, allowAdminToken: true }).pipe(\n Layer.annotateLogs('silent', true),\n Layer.catchAll(() => Layer.empty),\n ),\n ),\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.boxWrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,CAAC;AAEV,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAq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H,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\n\nloadEnv();\n\nimport minimist from 'minimist';\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\nimport { authClientAddCmd } from './commands/auth/client/add.ts';\nimport { authClientListCmd } from './commands/auth/client/list.ts';\nimport { authClientDeleteCmd } from './commands/auth/client/delete.ts';\nimport { authClientUpdateCmd } from './commands/auth/client/update.ts';\nimport { authOriginListCmd } from './commands/auth/origin/list.ts';\nimport { authOriginDeleteCmd } from './commands/auth/origin/delete.ts';\nimport { authOriginAddCmd } from './commands/auth/origin/add.ts';\nimport { authEmailPushCmd } from './commands/auth/email/push.ts';\nimport { authEmailPullCmd } from './commands/auth/email/pull.ts';\nimport { authEmailResetCmd } from './commands/auth/email/reset.ts';\nimport { link } from './logging.ts';\nimport { appListCommand } from './commands/app/list.ts';\nimport { appDeleteCommand } from './commands/app/delete.ts';\nimport { webhooksListCmd } from './commands/webhooks/list.ts';\nimport { webhooksAddCmd } from './commands/webhooks/add.ts';\nimport { webhooksUpdateCmd } from './commands/webhooks/update.ts';\nimport { webhooksDeleteCmd } from './commands/webhooks/delete.ts';\nimport { webhooksEnableCmd } from './commands/webhooks/enable.ts';\nimport { webhooksDisableCmd } from './commands/webhooks/disable.ts';\nimport { webhooksEventsListCmd } from './commands/webhooks/events/list.ts';\nimport { webhooksEventsPayloadCmd } from './commands/webhooks/events/payload.ts';\nimport { webhooksEventsResendCmd } from './commands/webhooks/events/resend.ts';\nimport { emailStatusCmd } from './commands/auth/email/status.ts';\nimport { verifyCmd } from './commands/auth/email/verify.ts';\nimport { resendEmailCmd } from './commands/auth/email/resend.ts';\nimport { backupListCmd } from './commands/backup/list.ts';\nimport { backupDownloadCmd } from './commands/backup/download.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n temp: options.temp,\n }),\n ),\n ),\n );\n });\n\nconst auth = program\n .command('auth')\n .description('Manage authentication for your app');\nconst app = program\n .command('app')\n .description('Manage individual InstantDB apps');\n\nexport const appListDef = app\n .command('list')\n .description('List apps on your Instant account')\n .option('--json', 'Output apps as JSON')\n .action(async (opts) => {\n return runCommandEffect(\n appListCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const appDeleteDef = app\n .command('delete')\n .description('Delete an app from your Instant account')\n .option(\n '-a --app <app-id>',\n 'App ID to delete. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n appDeleteCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst authClient = auth.command('client');\nexport const authClientAddDef = authClient\n .command('add')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option(\n '--type <google|github|apple|linkedin>',\n 'Type of oauth client to add',\n )\n .option(\n '--name <client name>',\n 'Custom name to identify the OAuth client (ex: google-web)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to modify. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --app-type web|ios|android|button-for-web\n --dev-credentials (optional, web only)\n --client-id (required unless using dev credentials)\n --client-secret (web only, unless using dev credentials)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id (Services ID from ${link('https://developer.apple.com', 'developer.apple.com')})\n --team-id (optional, required for web redirect flow)\n --key-id (optional, required for web redirect flow)\n --private-key-file (optional, path to .p8 PEM; required for web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key (Publishable Key from ${link('https://dashboard.clerk.com', 'dashboard.clerk.com')})\n Firebase:\n --project-id (Project ID from ${link('https://console.firebase.google.com', 'console.firebase.google.com')})\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n return runCommandEffect(\n authClientAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\nexport const authClientListDef = authClient\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list clients for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .allowUnknownOption(true)\n .action((opts) => {\n return runCommandEffect(\n authClientListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n // Silence \"searching for instant sdk.. logs for json output\"\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authClientDeleteDef = authClient\n .command('delete')\n .option('--id <client-id>', 'Client ID to delete')\n .option('--name <client-name>', 'Client name to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete a client from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authClientDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authClientUpdateDef = authClient\n .command('update')\n .description('Update an OAuth client')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option('--id <client-id>', 'Client ID to update')\n .option('--name <client-name>', 'Client name to update')\n .option(\n '-a --app <app-id>',\n 'App ID to update a client in. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --dev-credentials (web only)\n --client-id\n --client-secret (web only)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id\n --team-id (web redirect flow)\n --key-id (web redirect flow)\n --private-key-file (web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key\n Firebase:\n --project-id\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n\n return runCommandEffect(\n authClientUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst authOrigin = auth.command('origin');\nexport const authOriginListDef = authOrigin\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list origins for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n authOriginListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authOriginAddDef = authOrigin\n .command('add')\n .option(\n '--type <website|vercel|netlify|custom-scheme>',\n 'Type of origin to add.',\n )\n .option('--url <url>', 'Website URL (for website type, e.g. example.com)')\n .option(\n '--project <name>',\n 'Vercel project name (for vercel type, e.g. my-project)',\n )\n .option('--site <name>', 'Netlify site name (for netlify type, e.g. my-site)')\n .option(\n '--scheme <scheme>',\n 'App scheme (for custom-scheme type, e.g. myapp://)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add an origin to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nOrigin Types:\n website A standard website origin (e.g. example.com)\n vercel Vercel preview deployments (project name)\n netlify Netlify preview deployments (site name)\n custom-scheme Native app scheme (e.g. your-app-scheme://)\n`,\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authOriginDeleteDef = authOrigin\n .command('delete')\n .option('--id <origin-id>', 'Origin ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete an origin from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst webhooks = program\n .command('webhook')\n .description('Manage webhooks for an app');\n\nexport const webhooksListDef = webhooks\n .command('list')\n .description('List webhooks for an app')\n .option(\n '-a --app <app-id>',\n 'App ID to list webhooks for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n webhooksListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksAddDef = webhooks\n .command('add')\n .description('Add a webhook to an app')\n .option('--url <url>', 'HTTPS endpoint to deliver events to')\n .option(\n '--namespaces <e1,e2>',\n 'Comma-separated list of namespaces to listen on',\n )\n .option(\n '--actions <a1,a2>',\n 'Comma-separated list of actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add a webhook to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksUpdateDef = webhooks\n .command('update')\n .description('Update a webhook')\n .option('--id <webhook-id>', 'Webhook ID to update')\n .option('--url <url>', 'New HTTPS endpoint')\n .option('--namespaces <e1,e2>', 'New comma-separated namespaces')\n .option(\n '--actions <a1,a2>',\n 'New comma-separated actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDeleteDef = webhooks\n .command('delete')\n .description('Delete a webhook')\n .option('--id <webhook-id>', 'Webhook ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEnableDef = webhooks\n .command('enable')\n .description('Re-enable a disabled webhook')\n .option('--id <webhook-id>', 'Webhook ID to enable')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEnableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDisableDef = webhooks\n .command('disable')\n .description('Disable an active webhook')\n .option('--id <webhook-id>', 'Webhook ID to disable')\n .option('--reason <reason>', 'Human-readable reason stored on the webhook')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDisableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst webhooksEvents = webhooks\n .command('event')\n .description('Inspect and resend webhook events');\n\nexport const webhooksEventsListDef = webhooksEvents\n .command('list')\n .description('List recent events for a webhook (up to 100, newest first)')\n .option('--webhook-id <webhook-id>', 'Webhook ID to inspect')\n .option('--json', 'Enable JSON output')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksEventsResendDef = webhooksEvents\n .command('resend')\n .description('Re-queue a webhook event for delivery')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to resend')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsResendCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEventsPayloadDef = webhooksEvents\n .command('payload')\n .description('Print the JSON payload for a webhook event')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to fetch')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsPayloadCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst backup = program\n .command('backup')\n .description('View and download backups of your app');\n\nexport const backupListDef = backup\n .command('list')\n .description('List downloadable backups for an app')\n .option(\n '-a --app <app-id>',\n 'App ID to list backups for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Output backups as JSON')\n .action((opts) => {\n return runCommandEffect(\n backupListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const backupDownloadDef = backup\n .command('download')\n .description('Download a backup as a zip file')\n .argument(\n '[backup-id]',\n 'Backup ID to download. Defaults to an interactive picker',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to download a backup of. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--latest', 'Download the most recent backup')\n .option(\n '-o --out <path>',\n 'Output zip path. Defaults to instant-backup-<timestamp>.zip',\n )\n .action((backupId, opts) => {\n return runCommandEffect(\n backupDownloadCmd(backupId, opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst authEmail = auth\n .command('email')\n .description('Manage custom magic code email templates');\n\nexport const authEmailStatusDef = authEmail\n .command('status')\n .description('Get status for the custom magic code email template')\n .option(\n '-a --app <app-id>',\n 'App ID to push email settings to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Output email status as JSON')\n .action((opts) => {\n runCommandEffect(\n emailStatusCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n appId: opts.app,\n coerce: false,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authEmailPushDef = authEmail\n .command('push')\n .description('Push the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to push email settings to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-f --file <path>',\n 'Path to instant.email.ts. Defaults to INSTANT_EMAIL_FILE_PATH or auto-discovery.',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailPushCmd({ file: opts.file }).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailPullDef = authEmail\n .command('pull')\n .description('Pull the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to pull email settings from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-f --file <path>',\n 'Path to instant.email.ts. Defaults to INSTANT_EMAIL_FILE_PATH or auto-discovery.',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailPullCmd({ file: opts.file }).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailResetDef = authEmail\n .command('reset')\n .description('Delete the custom magic code email template.')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) =>\n runCommandEffect(\n authEmailResetCmd().pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n ),\n );\n\nexport const authEmailResendDef = authEmail\n .command('resend')\n .description('Resend the verification email')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(() => {\n runCommandEffect(\n resendEmailCmd.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authEmailVerifyDef = authEmail\n .command('verify')\n .description('Verify a custom email sender with a magic code')\n .argument('<code>', 'The magic code to verify')\n .option(\n '-a --app <app-id>',\n 'App ID to reset email settings for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((code, opts) => {\n runCommandEffect(\n verifyCmd(code, opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version, login status, and app info')\n .action(async () => {\n const authLayer = AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n });\n\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n Layer.mergeAll(\n BaseLayerLive,\n authLayer.pipe(Layer.catchAll(() => Layer.empty)),\n WithAppLayer({ coerce: false, allowAdminToken: true }).pipe(\n Layer.annotateLogs('silent', true),\n Layer.catchAll(() => Layer.empty),\n ),\n ),\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.boxWrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppBackup, BackupDownloadProgress, BackupDownloadResult, BackupsManager } from '@instantdb/platform';
|
|
2
|
+
export type { BackupDownloadProgress, BackupDownloadResult, } from '@instantdb/platform';
|
|
3
|
+
/**
|
|
4
|
+
* Downloads a backup into a zip file at `outPath` via the shared
|
|
5
|
+
* `BackupsManager.downloadArchive` pipeline, supplying the Node-specific
|
|
6
|
+
* pieces:
|
|
7
|
+
* presigned URLs are fetched with node:http(s) and decompressed explicitly,
|
|
8
|
+
* and the archive streams to disk with backpressure so memory stays flat
|
|
9
|
+
* regardless of backup size.
|
|
10
|
+
*
|
|
11
|
+
* Writes to `<outPath>.partial` and renames on success; a failed or aborted
|
|
12
|
+
* download removes the partial file.
|
|
13
|
+
*/
|
|
14
|
+
export declare function downloadBackupToFile(opts: {
|
|
15
|
+
manager: BackupsManager;
|
|
16
|
+
backup: AppBackup;
|
|
17
|
+
outPath: string;
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
onProgress: (progress: BackupDownloadProgress) => void;
|
|
20
|
+
}): Promise<BackupDownloadResult>;
|
|
21
|
+
//# sourceMappingURL=backupDownload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backupDownload.d.ts","sourceRoot":"","sources":["../../src/lib/backupDownload.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EAET,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAgE7B;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACxD,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4ChC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createWriteStream } from 'node:fs';
|
|
2
|
+
import { open, rename, unlink } from 'node:fs/promises';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { once } from 'node:events';
|
|
5
|
+
import { get as httpGet } from 'node:http';
|
|
6
|
+
import { get as httpsGet } from 'node:https';
|
|
7
|
+
import { Readable, Writable } from 'node:stream';
|
|
8
|
+
import zlib from 'node:zlib';
|
|
9
|
+
// zstd landed in node:zlib in 22.15 / 23.8; on older Nodes the property is
|
|
10
|
+
// absent, so feature-detect instead of assuming the type declarations match
|
|
11
|
+
// the runtime.
|
|
12
|
+
const createZstdDecompress = zlib.createZstdDecompress;
|
|
13
|
+
function fetchStream(url, signal) {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const get = url.startsWith('https:') ? httpsGet : httpGet;
|
|
16
|
+
const req = get(url, { signal }, resolve);
|
|
17
|
+
req.on('error', reject);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// .pipe doesn't forward errors, so a source failure would otherwise leave the
|
|
21
|
+
// destination (and the zip writer reading from it) hanging forever.
|
|
22
|
+
function pipe(src, dst) {
|
|
23
|
+
src.on('error', (e) => dst.destroy(e));
|
|
24
|
+
return src.pipe(dst);
|
|
25
|
+
}
|
|
26
|
+
// Fetches a presigned URL with node:http(s), decompressing explicitly: the
|
|
27
|
+
// entity shards are served with `Content-Encoding: zstd` and Node doesn't
|
|
28
|
+
// auto-decompress that. downloadBackupToFile refuses to run without zstd
|
|
29
|
+
// support, so the assertion below can't fire.
|
|
30
|
+
async function fetchBody(url, signal) {
|
|
31
|
+
const res = await fetchStream(url, signal);
|
|
32
|
+
if (res.statusCode !== 200) {
|
|
33
|
+
res.resume();
|
|
34
|
+
throw new Error(`HTTP ${res.statusCode}`);
|
|
35
|
+
}
|
|
36
|
+
const encoding = res.headers['content-encoding'];
|
|
37
|
+
let stream = res;
|
|
38
|
+
if (encoding === 'zstd') {
|
|
39
|
+
stream = pipe(stream, createZstdDecompress());
|
|
40
|
+
}
|
|
41
|
+
else if (encoding === 'gzip') {
|
|
42
|
+
stream = pipe(stream, zlib.createGunzip());
|
|
43
|
+
}
|
|
44
|
+
else if (encoding) {
|
|
45
|
+
res.destroy();
|
|
46
|
+
throw new Error(`Unsupported content encoding: ${encoding}`);
|
|
47
|
+
}
|
|
48
|
+
return Readable.toWeb(stream);
|
|
49
|
+
}
|
|
50
|
+
async function createZipWriter(sink, signal) {
|
|
51
|
+
// Loaded on demand so every other CLI command skips parsing it.
|
|
52
|
+
const { ZipWriter } = await import('@zip.js/zip.js');
|
|
53
|
+
// zip64: without it any archive whose central-directory offset passes 4GB
|
|
54
|
+
// writes a wrapped 32-bit offset and the zip is unreadable.
|
|
55
|
+
return new ZipWriter(sink, { zip64: true, signal });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Downloads a backup into a zip file at `outPath` via the shared
|
|
59
|
+
* `BackupsManager.downloadArchive` pipeline, supplying the Node-specific
|
|
60
|
+
* pieces:
|
|
61
|
+
* presigned URLs are fetched with node:http(s) and decompressed explicitly,
|
|
62
|
+
* and the archive streams to disk with backpressure so memory stays flat
|
|
63
|
+
* regardless of backup size.
|
|
64
|
+
*
|
|
65
|
+
* Writes to `<outPath>.partial` and renames on success; a failed or aborted
|
|
66
|
+
* download removes the partial file.
|
|
67
|
+
*/
|
|
68
|
+
export async function downloadBackupToFile(opts) {
|
|
69
|
+
// The entity shards are served with `Content-Encoding: zstd`; fail before
|
|
70
|
+
// writing anything if this Node can't decompress them.
|
|
71
|
+
if (!createZstdDecompress) {
|
|
72
|
+
throw new Error('Downloading backups requires Node 22.15 or newer (for zstd support).');
|
|
73
|
+
}
|
|
74
|
+
// Randomized so a stale partial or a concurrent download of the same
|
|
75
|
+
// backup can't collide; 'wx' turns any remaining collision into an error
|
|
76
|
+
// instead of silently truncating another run's file.
|
|
77
|
+
const partialPath = `${opts.outPath}.partial-${randomBytes(4).toString('hex')}`;
|
|
78
|
+
const fileStream = createWriteStream(partialPath, { flags: 'wx' });
|
|
79
|
+
const awaitFileClosed = async () => {
|
|
80
|
+
if (!fileStream.closed)
|
|
81
|
+
await once(fileStream, 'close');
|
|
82
|
+
};
|
|
83
|
+
try {
|
|
84
|
+
const result = await opts.manager.downloadArchive({
|
|
85
|
+
backup: opts.backup,
|
|
86
|
+
fetchBody,
|
|
87
|
+
sink: Writable.toWeb(fileStream),
|
|
88
|
+
createWriter: createZipWriter,
|
|
89
|
+
signal: opts.signal,
|
|
90
|
+
onProgress: opts.onProgress,
|
|
91
|
+
});
|
|
92
|
+
await awaitFileClosed();
|
|
93
|
+
// Flush to disk before the rename so a crash right after can't leave a
|
|
94
|
+
// complete-looking zip with unwritten tails.
|
|
95
|
+
const fh = await open(partialPath, 'r+');
|
|
96
|
+
try {
|
|
97
|
+
await fh.sync();
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
await fh.close();
|
|
101
|
+
}
|
|
102
|
+
await rename(partialPath, opts.outPath);
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
// The pipeline already aborted the sink; wait for the fd to close, then
|
|
107
|
+
// discard the partial file on disk.
|
|
108
|
+
await awaitFileClosed().catch(() => { });
|
|
109
|
+
await unlink(partialPath).catch(() => { });
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=backupDownload.js.map
|