@getxflow/cli 1.7.0 → 1.8.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/bin.js +4 -0
- package/dist/commands/logs.js +20 -1
- package/dist/flags.js +1 -0
- package/dist/help.js +4 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/xflow/SKILL.md +4 -2
package/dist/bin.js
CHANGED
|
@@ -179,6 +179,10 @@ async function run(args) {
|
|
|
179
179
|
await (0, db_1.dbExec)({ ...args, words: args.words.slice(2) });
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
+
if (second === 'logs') {
|
|
183
|
+
await (0, logs_1.dbLogs)(args);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
182
186
|
if (second === undefined || second === 'status') {
|
|
183
187
|
await (0, db_1.dbStatus)({ ...args, words: args.words.slice(2) });
|
|
184
188
|
return;
|
package/dist/commands/logs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logs = logs;
|
|
4
4
|
exports.functionsLogs = functionsLogs;
|
|
5
|
+
exports.dbLogs = dbLogs;
|
|
5
6
|
const api_1 = require("../api");
|
|
6
7
|
const args_1 = require("../args");
|
|
7
8
|
const config_1 = require("../config");
|
|
@@ -17,7 +18,7 @@ function stamp(iso) {
|
|
|
17
18
|
/** Newest at the bottom. */
|
|
18
19
|
function render(rows, appLabel) {
|
|
19
20
|
for (const row of [...rows].reverse()) {
|
|
20
|
-
const label = row.source === 'function' ? (row.function ?? 'function') : appLabel(row.app_id ?? '');
|
|
21
|
+
const label = row.source === 'function' ? (row.function ?? 'function') : row.source === 'database' ? 'database' : appLabel(row.app_id ?? '');
|
|
21
22
|
(0, ui_1.out)(`${(0, ui_1.dim)(stamp(row.timestamp))} ${(0, ui_1.bold)(label)} ${row.message}`);
|
|
22
23
|
if (row.stack) {
|
|
23
24
|
const lines = row.stack.split('\n');
|
|
@@ -67,3 +68,21 @@ async function functionsLogs(args) {
|
|
|
67
68
|
if (next)
|
|
68
69
|
(0, ui_1.note)((0, ui_1.dim)(`Older: xflow functions logs${name ? ` ${name}` : ''}${all ? ' --all' : ''} --cursor ${next}`));
|
|
69
70
|
}
|
|
71
|
+
/** Errors the project database raised, with the SQL that failed. */
|
|
72
|
+
async function dbLogs(args) {
|
|
73
|
+
const { projectId, client } = await (0, session_1.projectTarget)(args);
|
|
74
|
+
const query = new URLSearchParams({ source: 'database', limit: String((0, args_1.flagNumber)(args, 'limit') ?? DEFAULT_LIMIT) });
|
|
75
|
+
const cursor = (0, args_1.flagString)(args, 'cursor');
|
|
76
|
+
if (cursor)
|
|
77
|
+
query.set('cursor', cursor);
|
|
78
|
+
const { logs: rows, cursor: next } = await (0, api_1.apiJson)(client, `/api/v1/projects/${projectId}/logs?${query.toString()}`);
|
|
79
|
+
if (rows.length === 0) {
|
|
80
|
+
(0, ui_1.note)('The database raised no errors in the kept period');
|
|
81
|
+
(0, ui_1.note)((0, ui_1.dim)(' Kept for 7 days, 1 day on the Free plan'));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
render(rows, () => 'database');
|
|
85
|
+
}
|
|
86
|
+
if (next)
|
|
87
|
+
(0, ui_1.note)((0, ui_1.dim)(`Older: xflow db logs --cursor ${next}`));
|
|
88
|
+
}
|
package/dist/flags.js
CHANGED
|
@@ -80,6 +80,7 @@ exports.KNOWN = {
|
|
|
80
80
|
'db schema': ['project'],
|
|
81
81
|
'db query': ['json', 'project'],
|
|
82
82
|
'db exec': ['allow-destructive', 'json', 'project'],
|
|
83
|
+
'db logs': ['limit', 'project', 'cursor'],
|
|
83
84
|
'db migrate': ['dry-run', 'allow-destructive'],
|
|
84
85
|
storage: ['json', 'project'],
|
|
85
86
|
'storage ls': ['json', 'project'],
|
package/dist/help.js
CHANGED
|
@@ -95,6 +95,7 @@ ${(0, ui_1.bold)('Database')}
|
|
|
95
95
|
xflow db schema [table] tables of the project, or the columns of one
|
|
96
96
|
xflow db query 'select ...' read data, in a read-only transaction
|
|
97
97
|
xflow db exec 'update ...' a one-off data change, outside the migration history
|
|
98
|
+
xflow db logs errors the database raised, newest first
|
|
98
99
|
xflow db migrate [--dry-run] [--allow-destructive]
|
|
99
100
|
apply the migrations from migrations/*.sql
|
|
100
101
|
|
|
@@ -286,6 +287,9 @@ will work.`,
|
|
|
286
287
|
xflow db exec 'update ...' a one-off data change: one INSERT, UPDATE, DELETE or MERGE
|
|
287
288
|
(or <file>.sql; --allow-destructive, --json)
|
|
288
289
|
xflow db migrate store the project root, then apply migrations/*.sql
|
|
290
|
+
xflow db logs errors the database raised: failed and timed-out queries
|
|
291
|
+
with their SQL (cut to 2 KB), dropped connections; 7 days,
|
|
292
|
+
1 on the Free plan (--limit, --cursor for older)
|
|
289
293
|
|
|
290
294
|
Every project has exactly one database of its own, shared by all of its apps and functions,
|
|
291
295
|
and every command here works from any folder of the project. ${(0, ui_1.bold)('list')} is about the
|
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 = '1.
|
|
5
|
+
exports.CLI_VERSION = '1.8.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
|
@@ -28,7 +28,7 @@ instead of guessing; give the person https://docs.getxflow.com when they ask how
|
|
|
28
28
|
|
|
29
29
|
## Keeping these instructions current
|
|
30
30
|
|
|
31
|
-
These instructions ship with xflow CLI 1.
|
|
31
|
+
These instructions ship with xflow CLI 1.8.0, so the copy you are reading can be older than
|
|
32
32
|
the CLI answering your commands.
|
|
33
33
|
|
|
34
34
|
When the CLI says this file does not match it, run `xflow skills --refresh` and then **read
|
|
@@ -669,7 +669,9 @@ promises and 5xx responses; in an app folder that app, in the project root every
|
|
|
669
669
|
calls (timeout, out of memory, 5xx; no console for those); `--all` adds every call as its status
|
|
670
670
|
and time, `--cursor` (printed at the end) goes to older ones. A person sees the same in the web
|
|
671
671
|
interface: browser errors in the «Ошибки» (Errors) panel of the app, function crashes on the
|
|
672
|
-
«Ошибки» tab of the function's screen.
|
|
672
|
+
«Ошибки» tab of the function's screen. `xflow db logs` prints what the database refused: failed
|
|
673
|
+
and timed-out queries with their SQL (cut to 2 KB), dropped connections. Kept for 7 days, 1 day on
|
|
674
|
+
the Free plan.
|
|
673
675
|
|
|
674
676
|
Run an app locally with `xflow dev` in its folder, not a bare `npm run dev`: every `/_fn/<name>`
|
|
675
677
|
call then goes to the platform as this app, with the same callers and access as on its address,
|