@meith/cli 0.17.2 → 0.18.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/LICENSE.md +21 -165
- package/package.json +14 -14
- package/src/backup.ts +85 -32
- package/src/index.ts +19 -0
- package/src/redaction.ts +4 -0
- package/src/upgrade.ts +1 -1
package/LICENSE.md
CHANGED
|
@@ -1,165 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
An "Application" is any work that makes use of an interface provided
|
|
23
|
-
by the Library, but which is not otherwise based on the Library.
|
|
24
|
-
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
-
of using an interface provided by the Library.
|
|
26
|
-
|
|
27
|
-
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
-
Application with the Library. The particular version of the Library
|
|
29
|
-
with which the Combined Work was made is also called the "Linked
|
|
30
|
-
Version".
|
|
31
|
-
|
|
32
|
-
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
-
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
-
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
-
based on the Application, and not on the Linked Version.
|
|
36
|
-
|
|
37
|
-
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
-
object code and/or source code for the Application, including any data
|
|
39
|
-
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
-
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
-
|
|
42
|
-
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
-
|
|
44
|
-
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
-
without being bound by section 3 of the GNU GPL.
|
|
46
|
-
|
|
47
|
-
2. Conveying Modified Versions.
|
|
48
|
-
|
|
49
|
-
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
-
facility refers to a function or data to be supplied by an Application
|
|
51
|
-
that uses the facility (other than as an argument passed when the
|
|
52
|
-
facility is invoked), then you may convey a copy of the modified
|
|
53
|
-
version:
|
|
54
|
-
|
|
55
|
-
a) under this License, provided that you make a good faith effort to
|
|
56
|
-
ensure that, in the event an Application does not supply the
|
|
57
|
-
function or data, the facility still operates, and performs
|
|
58
|
-
whatever part of its purpose remains meaningful, or
|
|
59
|
-
|
|
60
|
-
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
-
this License applicable to that copy.
|
|
62
|
-
|
|
63
|
-
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
-
|
|
65
|
-
The object code form of an Application may incorporate material from
|
|
66
|
-
a header file that is part of the Library. You may convey such object
|
|
67
|
-
code under terms of your choice, provided that, if the incorporated
|
|
68
|
-
material is not limited to numerical parameters, data structure
|
|
69
|
-
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
-
(ten or fewer lines in length), you do both of the following:
|
|
71
|
-
|
|
72
|
-
a) Give prominent notice with each copy of the object code that the
|
|
73
|
-
Library is used in it and that the Library and its use are
|
|
74
|
-
covered by this License.
|
|
75
|
-
|
|
76
|
-
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
-
document.
|
|
78
|
-
|
|
79
|
-
4. Combined Works.
|
|
80
|
-
|
|
81
|
-
You may convey a Combined Work under terms of your choice that,
|
|
82
|
-
taken together, effectively do not restrict modification of the
|
|
83
|
-
portions of the Library contained in the Combined Work and reverse
|
|
84
|
-
engineering for debugging such modifications, if you also do each of
|
|
85
|
-
the following:
|
|
86
|
-
|
|
87
|
-
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
-
the Library is used in it and that the Library and its use are
|
|
89
|
-
covered by this License.
|
|
90
|
-
|
|
91
|
-
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
-
document.
|
|
93
|
-
|
|
94
|
-
c) For a Combined Work that displays copyright notices during
|
|
95
|
-
execution, include the copyright notice for the Library among
|
|
96
|
-
these notices, as well as a reference directing the user to the
|
|
97
|
-
copies of the GNU GPL and this license document.
|
|
98
|
-
|
|
99
|
-
d) Do one of the following:
|
|
100
|
-
|
|
101
|
-
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
-
License, and the Corresponding Application Code in a form
|
|
103
|
-
suitable for, and under terms that permit, the user to
|
|
104
|
-
recombine or relink the Application with a modified version of
|
|
105
|
-
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
-
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
-
Corresponding Source.
|
|
108
|
-
|
|
109
|
-
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
-
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
-
a copy of the Library already present on the user's computer
|
|
112
|
-
system, and (b) will operate properly with a modified version
|
|
113
|
-
of the Library that is interface-compatible with the Linked
|
|
114
|
-
Version.
|
|
115
|
-
|
|
116
|
-
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
-
be required to provide such information under section 6 of the
|
|
118
|
-
GNU GPL, and only to the extent that such information is
|
|
119
|
-
necessary to install and execute a modified version of the
|
|
120
|
-
Combined Work produced by recombining or relinking the
|
|
121
|
-
Application with a modified version of the Linked Version. (If
|
|
122
|
-
you use option 4d0, the Installation Information must accompany
|
|
123
|
-
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
-
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
-
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
-
for conveying Corresponding Source.)
|
|
127
|
-
|
|
128
|
-
5. Combined Libraries.
|
|
129
|
-
|
|
130
|
-
You may place library facilities that are a work based on the
|
|
131
|
-
Library side by side in a single library together with other library
|
|
132
|
-
facilities that are not Applications and are not covered by this
|
|
133
|
-
License, and convey such a combined library under terms of your
|
|
134
|
-
choice, if you do both of the following:
|
|
135
|
-
|
|
136
|
-
a) Accompany the combined library with a copy of the same work based
|
|
137
|
-
on the Library, uncombined with any other library facilities,
|
|
138
|
-
conveyed under the terms of this License.
|
|
139
|
-
|
|
140
|
-
b) Give prominent notice with the combined library that part of it
|
|
141
|
-
is a work based on the Library, and explaining where to find the
|
|
142
|
-
accompanying uncombined form of the same work.
|
|
143
|
-
|
|
144
|
-
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
-
|
|
146
|
-
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
-
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
-
versions will be similar in spirit to the present version, but may
|
|
149
|
-
differ in detail to address new problems or concerns.
|
|
150
|
-
|
|
151
|
-
Each version is given a distinguishing version number. If the
|
|
152
|
-
Library as you received it specifies that a certain numbered version
|
|
153
|
-
of the GNU Lesser General Public License "or any later version"
|
|
154
|
-
applies to it, you have the option of following the terms and
|
|
155
|
-
conditions either of that published version or of any later version
|
|
156
|
-
published by the Free Software Foundation. If the Library as you
|
|
157
|
-
received it does not specify a version number of the GNU Lesser
|
|
158
|
-
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
-
General Public License ever published by the Free Software Foundation.
|
|
160
|
-
|
|
161
|
-
If the Library as you received it specifies that a proxy can decide
|
|
162
|
-
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
-
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
-
permanent authorization for you to choose that version for the
|
|
165
|
-
Library.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jordan Harrison and the Meith contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "The operator CLI: migrations, backup and restore, imports, users and settings — and the community bin that runs it against an external board workspace.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/meith-dev/meith.git",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"tsx": "^4.23.12",
|
|
26
|
-
"@meith/accounts": "0.
|
|
27
|
-
"@meith/
|
|
28
|
-
"@meith/
|
|
29
|
-
"@meith/demo": "0.
|
|
30
|
-
"@meith/forums": "0.
|
|
31
|
-
"@meith/
|
|
32
|
-
"@meith/plugin-kit": "0.
|
|
33
|
-
"@meith/profile-fields": "0.
|
|
34
|
-
"@meith/
|
|
35
|
-
"@meith/
|
|
36
|
-
"@meith/
|
|
37
|
-
"create-meith": "0.
|
|
26
|
+
"@meith/accounts": "0.18.0",
|
|
27
|
+
"@meith/core": "0.18.0",
|
|
28
|
+
"@meith/db": "0.18.0",
|
|
29
|
+
"@meith/demo": "0.18.0",
|
|
30
|
+
"@meith/forums": "0.18.0",
|
|
31
|
+
"@meith/drivers": "0.18.0",
|
|
32
|
+
"@meith/plugin-kit": "0.18.0",
|
|
33
|
+
"@meith/profile-fields": "0.18.0",
|
|
34
|
+
"@meith/settings": "0.18.0",
|
|
35
|
+
"@meith/tasks": "0.18.0",
|
|
36
|
+
"@meith/runtime": "0.18.0",
|
|
37
|
+
"create-meith": "0.18.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"esbuild": "^0.28.2"
|
package/src/backup.ts
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
import { tmpdir } from 'node:os'
|
|
15
15
|
import path from 'node:path'
|
|
16
16
|
|
|
17
|
-
import { ConfigurationError, env, ValidationError } from '@meith/core'
|
|
17
|
+
import { ConfigurationError, env, type FileStore, ValidationError } from '@meith/core'
|
|
18
18
|
import { migrationUrl, runMigrations } from '@meith/db'
|
|
19
|
-
import { S3FileStore } from '@meith/drivers'
|
|
19
|
+
import { BlobFileStore, S3FileStore } from '@meith/drivers'
|
|
20
20
|
|
|
21
21
|
import { optional, parseFlags } from './args'
|
|
22
22
|
import { requirePostgres } from './context'
|
|
@@ -24,17 +24,19 @@ import { CODE_VERSION } from './upgrade'
|
|
|
24
24
|
|
|
25
25
|
export type UploadsMode = 'include' | 'skip'
|
|
26
26
|
|
|
27
|
+
export type FilestoreDriver = 'local' | 's3' | 'blob'
|
|
28
|
+
|
|
27
29
|
export interface BackupManifest {
|
|
28
30
|
readonly format: 1
|
|
29
31
|
readonly createdAt: string
|
|
30
32
|
readonly version: string
|
|
31
|
-
readonly filestore:
|
|
33
|
+
readonly filestore: FilestoreDriver
|
|
32
34
|
readonly uploads: 'included' | 'skipped'
|
|
33
35
|
readonly bucket?: string
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
export function resolveUploadsMode(driver:
|
|
37
|
-
if (flag === undefined) return driver === '
|
|
38
|
+
export function resolveUploadsMode(driver: FilestoreDriver, flag: string | undefined): UploadsMode {
|
|
39
|
+
if (flag === undefined) return driver === 's3' ? 'skip' : 'include'
|
|
38
40
|
if (flag === 'include' || flag === 'skip') return flag
|
|
39
41
|
throw new ValidationError(`--uploads must be "include" or "skip", got "${flag}".`)
|
|
40
42
|
}
|
|
@@ -67,7 +69,11 @@ export function parseManifest(raw: string): BackupManifest {
|
|
|
67
69
|
if (typeof manifest.createdAt !== 'string' || typeof manifest.version !== 'string') {
|
|
68
70
|
throw new ValidationError('The bundle manifest is missing createdAt or version.')
|
|
69
71
|
}
|
|
70
|
-
if (
|
|
72
|
+
if (
|
|
73
|
+
manifest.filestore !== 'local' &&
|
|
74
|
+
manifest.filestore !== 's3' &&
|
|
75
|
+
manifest.filestore !== 'blob'
|
|
76
|
+
) {
|
|
71
77
|
throw new ValidationError('The bundle manifest does not name a known file driver.')
|
|
72
78
|
}
|
|
73
79
|
|
|
@@ -378,12 +384,14 @@ async function stageLocalUploads(stage: string): Promise<'included' | 'skipped'>
|
|
|
378
384
|
return 'included'
|
|
379
385
|
}
|
|
380
386
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
387
|
+
export interface ListableStore {
|
|
388
|
+
listKeys(): AsyncGenerator<string>
|
|
389
|
+
get(key: string): Promise<Uint8Array | undefined>
|
|
390
|
+
}
|
|
385
391
|
|
|
392
|
+
export async function drainStoreToDirectory(store: ListableStore, dir: string): Promise<number> {
|
|
386
393
|
let pulled = 0
|
|
394
|
+
|
|
387
395
|
for await (const key of store.listKeys()) {
|
|
388
396
|
const target = path.resolve(dir, key)
|
|
389
397
|
if (target !== dir && !target.startsWith(dir + path.sep)) {
|
|
@@ -397,18 +405,66 @@ async function stageS3Uploads(stage: string): Promise<'included' | 'skipped'> {
|
|
|
397
405
|
pulled++
|
|
398
406
|
}
|
|
399
407
|
|
|
408
|
+
return pulled
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export async function uploadDirectoryToStore(
|
|
412
|
+
store: { put: FileStore['put'] },
|
|
413
|
+
dir: string,
|
|
414
|
+
): Promise<number> {
|
|
415
|
+
let pushed = 0
|
|
416
|
+
|
|
417
|
+
for (const file of await walk(dir)) {
|
|
418
|
+
const key = path.relative(dir, file).split(path.sep).join('/')
|
|
419
|
+
await store.put(key, await readFile(file), {
|
|
420
|
+
contentType: contentTypeFor(key),
|
|
421
|
+
visibility: 'public',
|
|
422
|
+
})
|
|
423
|
+
pushed++
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return pushed
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async function stageObjectStoreUploads(
|
|
430
|
+
stage: string,
|
|
431
|
+
store: ListableStore,
|
|
432
|
+
origin: string,
|
|
433
|
+
): Promise<'included' | 'skipped'> {
|
|
434
|
+
const dir = path.join(stage, 'uploads')
|
|
435
|
+
await mkdir(dir, { recursive: true })
|
|
436
|
+
|
|
437
|
+
const pulled = await drainStoreToDirectory(store, dir)
|
|
438
|
+
|
|
400
439
|
if (pulled === 0) {
|
|
401
|
-
console.log(`
|
|
440
|
+
console.log(`Found no objects in ${origin}; the bundle carries no uploads.`)
|
|
402
441
|
await rm(dir, { recursive: true, force: true })
|
|
403
442
|
return 'skipped'
|
|
404
443
|
}
|
|
405
444
|
|
|
406
445
|
await run('tar', ['czf', path.join(stage, 'uploads.tar.gz'), '-C', dir, '.'])
|
|
407
446
|
await rm(dir, { recursive: true, force: true })
|
|
408
|
-
console.log(`Pulled ${pulled} object(s) from ${
|
|
447
|
+
console.log(`Pulled ${pulled} object(s) from ${origin}.`)
|
|
409
448
|
return 'included'
|
|
410
449
|
}
|
|
411
450
|
|
|
451
|
+
async function stageUploads(stage: string, mode: UploadsMode): Promise<'included' | 'skipped'> {
|
|
452
|
+
if (mode === 'skip') return 'skipped'
|
|
453
|
+
|
|
454
|
+
switch (env.FILESTORE_DRIVER) {
|
|
455
|
+
case 's3':
|
|
456
|
+
return await stageObjectStoreUploads(
|
|
457
|
+
stage,
|
|
458
|
+
S3FileStore.fromEnv(env),
|
|
459
|
+
`the ${env.S3_BUCKET} bucket`,
|
|
460
|
+
)
|
|
461
|
+
case 'blob':
|
|
462
|
+
return await stageObjectStoreUploads(stage, BlobFileStore.fromEnv(env), 'the Blob store')
|
|
463
|
+
case 'local':
|
|
464
|
+
return await stageLocalUploads(stage)
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
412
468
|
export async function backupCommand(args: readonly string[]): Promise<number> {
|
|
413
469
|
const { flags } = parseFlags(args)
|
|
414
470
|
requirePostgres()
|
|
@@ -434,12 +490,7 @@ export async function backupCommand(args: readonly string[]): Promise<number> {
|
|
|
434
490
|
databaseEnvironment,
|
|
435
491
|
)
|
|
436
492
|
|
|
437
|
-
const uploads =
|
|
438
|
-
mode === 'skip'
|
|
439
|
-
? 'skipped'
|
|
440
|
-
: env.FILESTORE_DRIVER === 's3'
|
|
441
|
-
? await stageS3Uploads(stage)
|
|
442
|
-
: await stageLocalUploads(stage)
|
|
493
|
+
const uploads = await stageUploads(stage, mode)
|
|
443
494
|
|
|
444
495
|
const manifest: BackupManifest = {
|
|
445
496
|
format: 1,
|
|
@@ -526,23 +577,19 @@ async function extractUploads(stage: string, dir: string, limits: RestoreLimits)
|
|
|
526
577
|
console.log(`Restored the uploads into ${dir}.`)
|
|
527
578
|
}
|
|
528
579
|
|
|
529
|
-
async function
|
|
580
|
+
async function pushUploadsToStore(
|
|
581
|
+
stage: string,
|
|
582
|
+
limits: RestoreLimits,
|
|
583
|
+
store: { put: FileStore['put'] },
|
|
584
|
+
destination: string,
|
|
585
|
+
): Promise<void> {
|
|
530
586
|
await validateUploadsArchive(stage, limits)
|
|
531
587
|
const dir = path.join(stage, 'uploads-extract')
|
|
532
588
|
await mkdir(dir, { recursive: true })
|
|
533
589
|
await run('tar', ['xzf', path.join(stage, 'uploads.tar.gz'), '-C', dir])
|
|
534
590
|
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
for (const file of await walk(dir)) {
|
|
538
|
-
const key = path.relative(dir, file).split(path.sep).join('/')
|
|
539
|
-
await store.put(key, await readFile(file), {
|
|
540
|
-
contentType: contentTypeFor(key),
|
|
541
|
-
visibility: 'public',
|
|
542
|
-
})
|
|
543
|
-
pushed++
|
|
544
|
-
}
|
|
545
|
-
console.log(`Uploaded ${pushed} object(s) to ${env.S3_BUCKET}.`)
|
|
591
|
+
const pushed = await uploadDirectoryToStore(store, dir)
|
|
592
|
+
console.log(`Uploaded ${pushed} object(s) to ${destination}.`)
|
|
546
593
|
}
|
|
547
594
|
|
|
548
595
|
const RESTORE_USAGE =
|
|
@@ -652,7 +699,9 @@ export async function restoreCommand(args: readonly string[]): Promise<number> {
|
|
|
652
699
|
if (manifest.uploads === 'included' && flags.get('skip-uploads') !== 'true') {
|
|
653
700
|
const uploadsDir = optional(flags, 'uploads-dir')
|
|
654
701
|
if (env.FILESTORE_DRIVER === 's3' && uploadsDir === undefined) {
|
|
655
|
-
await
|
|
702
|
+
await pushUploadsToStore(stage, limits, S3FileStore.fromEnv(env), `${env.S3_BUCKET}`)
|
|
703
|
+
} else if (env.FILESTORE_DRIVER === 'blob' && uploadsDir === undefined) {
|
|
704
|
+
await pushUploadsToStore(stage, limits, BlobFileStore.fromEnv(env), 'the Blob store')
|
|
656
705
|
} else {
|
|
657
706
|
await extractUploads(stage, uploadsDir ?? env.UPLOADS_DIR, limits)
|
|
658
707
|
}
|
|
@@ -662,7 +711,11 @@ export async function restoreCommand(args: readonly string[]): Promise<number> {
|
|
|
662
711
|
? `This bundle carries no uploads — they live in the S3 bucket${
|
|
663
712
|
manifest.bucket === undefined ? '' : ` (${manifest.bucket})`
|
|
664
713
|
}.`
|
|
665
|
-
:
|
|
714
|
+
: manifest.filestore === 'blob'
|
|
715
|
+
? 'This bundle carries no uploads, and a Vercel Blob store is not ' +
|
|
716
|
+
'something you can copy out by hand. Take another backup with ' +
|
|
717
|
+
'--uploads include while the old board still exists.'
|
|
718
|
+
: 'This bundle carries no uploads.',
|
|
666
719
|
)
|
|
667
720
|
}
|
|
668
721
|
|
package/src/index.ts
CHANGED
|
@@ -84,6 +84,19 @@ const commands: Command[] = [
|
|
|
84
84
|
{
|
|
85
85
|
name: 'migrate',
|
|
86
86
|
summary: 'Apply pending database migrations.',
|
|
87
|
+
usage: [
|
|
88
|
+
'community migrate',
|
|
89
|
+
'',
|
|
90
|
+
'Applies every migration this release has that the board has not, then exits.',
|
|
91
|
+
'Safe to run concurrently: the runner holds a Postgres advisory lock for the',
|
|
92
|
+
'whole run, so a second deploy waits for the first and then finds nothing to do.',
|
|
93
|
+
'',
|
|
94
|
+
'Migrates over DIRECT_DATABASE_URL when it is set, and over DATABASE_URL when it',
|
|
95
|
+
'is not. On a managed database point DIRECT_DATABASE_URL at the direct',
|
|
96
|
+
'(non-pooler) connection string: a transaction-mode pooler hands the connection',
|
|
97
|
+
'back as soon as the lock statement ends, so the lock is left on a backend that',
|
|
98
|
+
'goes to somebody else and the run is no longer serialised against other runs.',
|
|
99
|
+
].join('\n'),
|
|
87
100
|
async run() {
|
|
88
101
|
const { assertEnv } = await import('@meith/core')
|
|
89
102
|
const env = assertEnv()
|
|
@@ -93,6 +106,12 @@ const commands: Command[] = [
|
|
|
93
106
|
return 1
|
|
94
107
|
}
|
|
95
108
|
|
|
109
|
+
console.log(
|
|
110
|
+
env.DIRECT_DATABASE_URL === undefined
|
|
111
|
+
? 'Migrating over DATABASE_URL…'
|
|
112
|
+
: 'Migrating over DIRECT_DATABASE_URL…',
|
|
113
|
+
)
|
|
114
|
+
|
|
96
115
|
const { runMigrations } = await import('@meith/db')
|
|
97
116
|
const applied = await runMigrations()
|
|
98
117
|
console.log(applied === 0 ? 'Already up to date.' : `Applied ${applied} migration(s).`)
|
package/src/redaction.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
export const SECRET_ENV_KEYS: ReadonlySet<string> = new Set([
|
|
2
2
|
'AUTH_SECRET',
|
|
3
3
|
'TICK_SECRET',
|
|
4
|
+
'CRON_SECRET',
|
|
4
5
|
'METRICS_TOKEN',
|
|
5
6
|
'DATABASE_URL',
|
|
6
7
|
'DIRECT_DATABASE_URL',
|
|
7
8
|
'MAIL_HTTP_TOKEN',
|
|
8
9
|
'MAIL_SMTP_PASSWORD',
|
|
10
|
+
'RESEND_API_KEY',
|
|
9
11
|
'REDIS_URL',
|
|
10
12
|
'S3_SECRET_ACCESS_KEY',
|
|
13
|
+
'BLOB_READ_WRITE_TOKEN',
|
|
11
14
|
])
|
|
12
15
|
|
|
13
16
|
export const NOT_SECRET_DESPITE_THE_NAME: ReadonlySet<string> = new Set([
|
|
14
17
|
'MAIL_HTTP_ENDPOINT',
|
|
15
18
|
'S3_ENDPOINT',
|
|
19
|
+
'S3_PUBLIC_BASE_URL',
|
|
16
20
|
'APP_URL',
|
|
17
21
|
'S3_ACCESS_KEY_ID',
|
|
18
22
|
'MAIL_SMTP_USERNAME',
|
package/src/upgrade.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type PluginDefinition, pluginNavigationPlacements } from '@meith/plugin
|
|
|
11
11
|
import { runPluginLifecycle } from '@meith/runtime'
|
|
12
12
|
import { type PluginUpgrade, planUpgrade, upgradeNotice } from '@meith/upgrade'
|
|
13
13
|
|
|
14
|
-
export const CODE_VERSION = '0.
|
|
14
|
+
export const CODE_VERSION = '0.18.0'
|
|
15
15
|
|
|
16
16
|
export function pluginUpgrades(plugins: readonly PluginDefinition[]): readonly PluginUpgrade[] {
|
|
17
17
|
return plugins.map((plugin) => ({
|