@getxflow/cli 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/db.js +24 -4
- package/dist/help.js +7 -4
- package/dist/limits.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/xflow/SKILL.md +9 -1
package/dist/commands/db.js
CHANGED
|
@@ -17,6 +17,19 @@ const text_file_1 = require("../text-file");
|
|
|
17
17
|
const ui_1 = require("../ui");
|
|
18
18
|
/** Migration files live in the repo; the applied history lives in the database. */
|
|
19
19
|
const MIGRATIONS_DIR = 'migrations';
|
|
20
|
+
function serverLabel(server) {
|
|
21
|
+
if (server === undefined)
|
|
22
|
+
return '-';
|
|
23
|
+
if (server === null)
|
|
24
|
+
return 'platform';
|
|
25
|
+
return server.status === 'active' ? `own "${server.name}"` : `own "${server.name}", ${server.status}`;
|
|
26
|
+
}
|
|
27
|
+
function printPlace(history) {
|
|
28
|
+
(0, ui_1.out)(`Schema: ${(0, ui_1.bold)(history.schema)}`);
|
|
29
|
+
if (history.server !== undefined)
|
|
30
|
+
(0, ui_1.out)(`Server: ${serverLabel(history.server)}`);
|
|
31
|
+
(0, ui_1.out)('');
|
|
32
|
+
}
|
|
20
33
|
function checksum(sql) {
|
|
21
34
|
return (0, node_crypto_1.createHash)('sha256').update(sql).digest('hex').slice(0, 16);
|
|
22
35
|
}
|
|
@@ -46,8 +59,7 @@ async function dbStatus(args) {
|
|
|
46
59
|
if ((0, args_1.flagString)(args, 'project') !== undefined) {
|
|
47
60
|
const { projectId, client } = await (0, session_1.projectTarget)(args);
|
|
48
61
|
const history = await (0, api_1.apiJson)(client, `/api/v1/projects/${projectId}/db/migrate`);
|
|
49
|
-
(
|
|
50
|
-
(0, ui_1.out)('');
|
|
62
|
+
printPlace(history);
|
|
51
63
|
if (history.applied.length === 0) {
|
|
52
64
|
(0, ui_1.note)('No migrations have been applied yet');
|
|
53
65
|
return;
|
|
@@ -61,8 +73,7 @@ async function dbStatus(args) {
|
|
|
61
73
|
const local = readMigrations(root);
|
|
62
74
|
const history = await (0, api_1.apiJson)(client, `/api/v1/projects/${config.projectId}/db/migrate`);
|
|
63
75
|
const applied = new Map(history.applied.map((row) => [row.name, row]));
|
|
64
|
-
(
|
|
65
|
-
(0, ui_1.out)('');
|
|
76
|
+
printPlace(history);
|
|
66
77
|
if (local.length === 0 && applied.size === 0) {
|
|
67
78
|
(0, ui_1.note)(`No migrations. The first one: ${MIGRATIONS_DIR}/0001_init.sql`);
|
|
68
79
|
return;
|
|
@@ -118,6 +129,7 @@ async function dbList() {
|
|
|
118
129
|
database.name,
|
|
119
130
|
database.id,
|
|
120
131
|
database.schema ?? '-',
|
|
132
|
+
serverLabel(database.server),
|
|
121
133
|
attachedProjects(database),
|
|
122
134
|
]));
|
|
123
135
|
if (data.truncated)
|
|
@@ -127,6 +139,14 @@ async function dbList() {
|
|
|
127
139
|
if (attached > 1)
|
|
128
140
|
(0, ui_1.note)((0, ui_1.dim)(` ${database.name} is shared by ${attached} projects: a migration affects all of them`));
|
|
129
141
|
}
|
|
142
|
+
const down = new Map();
|
|
143
|
+
for (const { server } of data.databases)
|
|
144
|
+
if (server && server.status !== 'active')
|
|
145
|
+
down.set(server.id, server);
|
|
146
|
+
for (const server of down.values()) {
|
|
147
|
+
(0, ui_1.note)((0, ui_1.dim)(` Server "${server.name}" is not running (${server.status}): its databases do not answer until it is back. ` +
|
|
148
|
+
'Not fixable from the code: tell the person, the server state is in the "Data" section of the web interface'));
|
|
149
|
+
}
|
|
130
150
|
}
|
|
131
151
|
/** Long values would tear the columns apart; the cut is marked, never silent. */
|
|
132
152
|
const CELL_LIMIT = 60;
|
package/dist/help.js
CHANGED
|
@@ -83,7 +83,7 @@ ${(0, ui_1.bold)('Functions')}
|
|
|
83
83
|
|
|
84
84
|
${(0, ui_1.bold)('Database')}
|
|
85
85
|
xflow db status which migrations are applied and which are waiting
|
|
86
|
-
xflow db list databases of the organization
|
|
86
|
+
xflow db list databases of the organization, servers, projects
|
|
87
87
|
xflow db schema [table] tables of the project, or the columns of one
|
|
88
88
|
xflow db query "select ..." read data, in a read-only transaction
|
|
89
89
|
xflow db migrate [--dry-run] [--allow-destructive]
|
|
@@ -288,8 +288,8 @@ is a hard gate on a changed contract, and until you run this command nothing els
|
|
|
288
288
|
will work.`,
|
|
289
289
|
db: `${(0, ui_1.bold)('xflow db')}: schema, data, migrations
|
|
290
290
|
|
|
291
|
-
xflow db status what is applied
|
|
292
|
-
xflow db list databases of the organization,
|
|
291
|
+
xflow db status what is applied, what is waiting, the server
|
|
292
|
+
xflow db list databases of the organization: servers, projects
|
|
293
293
|
xflow db schema [table] tables of the project, or the columns of one
|
|
294
294
|
xflow db query "select ..." read data (--limit N: 50 by default, 300 at most;
|
|
295
295
|
--json prints the values whole)
|
|
@@ -298,7 +298,10 @@ will work.`,
|
|
|
298
298
|
|
|
299
299
|
${(0, ui_1.bold)('list')} is about the organization, not about this project: it names the logical
|
|
300
300
|
databases, the identifier ${(0, ui_1.bold)('xflow init --database <id>')} asks for, and the projects
|
|
301
|
-
attached to each one. That last column is the one to read before a migration.
|
|
301
|
+
attached to each one. That last column is the one to read before a migration. The server
|
|
302
|
+
column says where a database lives: ${(0, ui_1.bold)('platform')} is the common one, ${(0, ui_1.bold)('own "<name>"')} the
|
|
303
|
+
organization's own server. While an own server is not running, its databases do not
|
|
304
|
+
answer, and that is not fixable from the code: its state is in the web interface.
|
|
302
305
|
|
|
303
306
|
${(0, ui_1.bold)('schema')} answers a different question than the ${(0, ui_1.bold)('migrations/')} directory: one logical
|
|
304
307
|
database is shared by several projects, so the files say what you did, and the schema
|
package/dist/limits.js
CHANGED
|
@@ -7,6 +7,7 @@ const DENIAL_LABELS = {
|
|
|
7
7
|
limit_projects: 'projects',
|
|
8
8
|
limit_databases: 'databases',
|
|
9
9
|
limit_connections: 'active connector connections',
|
|
10
|
+
limit_pages: 'public pages',
|
|
10
11
|
limit_functions: 'cloud functions',
|
|
11
12
|
limit_builds: 'builds this month',
|
|
12
13
|
limit_builds_concurrent: 'builds running at once',
|
|
@@ -34,6 +35,7 @@ const QUOTA_ORDER = [
|
|
|
34
35
|
'projects',
|
|
35
36
|
'databases',
|
|
36
37
|
'connections',
|
|
38
|
+
'pages',
|
|
37
39
|
'functions',
|
|
38
40
|
'developers',
|
|
39
41
|
'members',
|
|
@@ -46,6 +48,7 @@ const QUOTA_LABELS = {
|
|
|
46
48
|
projects: 'Projects',
|
|
47
49
|
databases: 'Databases',
|
|
48
50
|
connections: 'Active connections',
|
|
51
|
+
pages: 'Public pages',
|
|
49
52
|
functions: 'Cloud functions',
|
|
50
53
|
developers: 'Developers',
|
|
51
54
|
members: 'Staff',
|
package/dist/version.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_API_URL = exports.CLI_VERSION = void 0;
|
|
4
4
|
/** Keep in sync with cli/package.json. */
|
|
5
|
-
exports.CLI_VERSION = '0.
|
|
5
|
+
exports.CLI_VERSION = '0.28.0';
|
|
6
6
|
/** Overridden by XFLOW_API_URL or the `api` field in xflow.json. */
|
|
7
7
|
exports.DEFAULT_API_URL = 'https://app.getxflow.com';
|
package/package.json
CHANGED
package/skills/xflow/SKILL.md
CHANGED
|
@@ -22,7 +22,7 @@ contains the fix.
|
|
|
22
22
|
|
|
23
23
|
## Keeping these instructions current
|
|
24
24
|
|
|
25
|
-
These instructions ship with xflow CLI 0.
|
|
25
|
+
These instructions ship with xflow CLI 0.28.0, so the copy you are reading can be older than
|
|
26
26
|
the CLI answering your commands.
|
|
27
27
|
|
|
28
28
|
When the CLI says this file does not match it, run `xflow skills --refresh` and then **read
|
|
@@ -435,6 +435,14 @@ transaction (50 rows by default, `--limit` up to 300; `--json` prints long value
|
|
|
435
435
|
with double quotes goes in a `.sql` file outside the project, `xflow db query ../q.sql`: PowerShell
|
|
436
436
|
strips them from arguments. Look before you write a migration against a shared database.
|
|
437
437
|
|
|
438
|
+
An organization can have its own database server, and its new databases are then created there.
|
|
439
|
+
`xflow db list` names the server of each database (`platform` is the common one), `xflow db
|
|
440
|
+
status` the one under this project. Code stays the same: `DATABASE_URL` arrives as before, pass it
|
|
441
|
+
as is, without an `ssl` option (an own server is reached over a closed network, and `ssl` makes
|
|
442
|
+
the connection fail). While an own server is not running, migrations and queries say so and
|
|
443
|
+
functions that use the database time out. That is not your code and not yours to fix: tell the
|
|
444
|
+
person, who sees the server state in the "Data" section of the web interface, instead of retrying.
|
|
445
|
+
|
|
438
446
|
## File storage
|
|
439
447
|
|
|
440
448
|
Two kinds of files live here, and they arrive through different doors.
|