@getxflow/cli 1.5.0 → 1.7.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 +1 -28
- package/dist/commands/deploy.js +1 -2
- package/dist/commands/env.js +4 -9
- package/dist/commands/logs.js +12 -4
- package/dist/commands/storage.js +1 -2
- package/dist/flags.js +2 -11
- package/dist/help.js +643 -708
- package/dist/limits.js +5 -5
- package/dist/version.js +1 -1
- package/package.json +24 -24
- package/skills/xflow/SKILL.md +683 -719
- package/dist/commands/pages.js +0 -257
package/dist/bin.js
CHANGED
|
@@ -25,7 +25,6 @@ const schedules_1 = require("./commands/schedules");
|
|
|
25
25
|
const skills_1 = require("./commands/skills");
|
|
26
26
|
const sources_1 = require("./commands/sources");
|
|
27
27
|
const storage_1 = require("./commands/storage");
|
|
28
|
-
const pages_1 = require("./commands/pages");
|
|
29
28
|
const deploy_1 = require("./commands/deploy");
|
|
30
29
|
const dev_1 = require("./commands/dev");
|
|
31
30
|
const update_1 = require("./commands/update");
|
|
@@ -199,32 +198,6 @@ async function run(args) {
|
|
|
199
198
|
return;
|
|
200
199
|
}
|
|
201
200
|
throw new errors_1.CliError(`Unknown command: storage ${second}`, 'Available: ls, push and rm');
|
|
202
|
-
case 'pages':
|
|
203
|
-
if (second === 'create') {
|
|
204
|
-
await (0, pages_1.pagesCreate)(rest);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (second === 'deploy') {
|
|
208
|
-
await (0, pages_1.pagesDeploy)(rest);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (second === 'status') {
|
|
212
|
-
await (0, pages_1.pagesStatus)(rest);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (second === 'rollback') {
|
|
216
|
-
await (0, pages_1.pagesRollback)(rest);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (second === 'rm' || second === 'remove') {
|
|
220
|
-
await (0, pages_1.pagesRemove)(rest);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (second === undefined || second === 'list') {
|
|
224
|
-
await (0, pages_1.pagesList)(rest);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
throw new errors_1.CliError(`Unknown command: pages ${second}`, 'Available: list, create, deploy, status, rollback and rm');
|
|
228
201
|
case 'status':
|
|
229
202
|
await (0, sources_1.status)();
|
|
230
203
|
return;
|
|
@@ -334,7 +307,7 @@ async function main() {
|
|
|
334
307
|
// XFLOW_TOKEN is taken as given and no organization is looked for, so a
|
|
335
308
|
// project of another one answers "not found" with nothing else to say.
|
|
336
309
|
if (process.env.XFLOW_TOKEN?.trim()) {
|
|
337
|
-
(0, ui_1.fatalNote)((0, ui_1.dim)(' XFLOW_TOKEN is set: it is the key of one organization and is used as it comes, so a project
|
|
310
|
+
(0, ui_1.fatalNote)((0, ui_1.dim)(' XFLOW_TOKEN is set: it is the key of one organization and is used as it comes, so a project of another one is not found'));
|
|
338
311
|
}
|
|
339
312
|
else if (e.apiUrl && (0, credentials_1.listOrgs)(e.apiUrl).length > 1) {
|
|
340
313
|
(0, ui_1.fatalNote)((0, ui_1.dim)(' Several organizations are signed in: the answer may live in another one, see xflow org'));
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.versionComment = versionComment;
|
|
4
3
|
exports.statedRevision = statedRevision;
|
|
5
4
|
exports.deploy = deploy;
|
|
6
5
|
exports.publish = publish;
|
|
@@ -70,7 +69,7 @@ async function startBuild(client, base, revision, allowRemovals, comment) {
|
|
|
70
69
|
const MAX_COMMENT_LENGTH = 200;
|
|
71
70
|
/** Control and bidi-override characters: they spoof terminals, not comments. */
|
|
72
71
|
const COMMENT_CONTROL_CHARS = /[\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
73
|
-
/** The version comment as typed after -m, cleaned; empty when there is none.
|
|
72
|
+
/** The version comment as typed after -m, cleaned; empty when there is none. */
|
|
74
73
|
function versionComment(raw) {
|
|
75
74
|
const comment = (raw ?? '').replace(/\s+/g, ' ').replace(COMMENT_CONTROL_CHARS, '').trim();
|
|
76
75
|
if (comment.length > MAX_COMMENT_LENGTH) {
|
package/dist/commands/env.js
CHANGED
|
@@ -8,14 +8,12 @@ exports.envRemove = envRemove;
|
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const api_1 = require("../api");
|
|
11
|
-
const args_1 = require("../args");
|
|
12
11
|
const config_1 = require("../config");
|
|
13
12
|
const errors_1 = require("../errors");
|
|
14
13
|
const session_1 = require("../session");
|
|
15
14
|
const ui_1 = require("../ui");
|
|
16
15
|
const SCOPE_LABEL = {
|
|
17
|
-
|
|
18
|
-
project: 'this project only',
|
|
16
|
+
project: 'this project',
|
|
19
17
|
connection: 'from a connected service, read-only',
|
|
20
18
|
};
|
|
21
19
|
const FUNCTIONS_DIR = 'functions';
|
|
@@ -101,7 +99,7 @@ async function envList(args) {
|
|
|
101
99
|
(0, ui_1.note)((0, ui_1.dim)(' To store one: xflow env set SMTP_PASSWORD=secret'));
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
|
-
(0, ui_1.table)(rows.map((row) => [row.name, SCOPE_LABEL[row.scope]
|
|
102
|
+
(0, ui_1.table)(rows.map((row) => [row.name, SCOPE_LABEL[row.scope]]));
|
|
105
103
|
(0, ui_1.note)((0, ui_1.dim)(' The platform never returns values: they are visible only inside the function'));
|
|
106
104
|
}
|
|
107
105
|
/** Check that every referenced variable is stored. */
|
|
@@ -172,12 +170,9 @@ async function envSet(args) {
|
|
|
172
170
|
const value = pair.slice(pair.indexOf('=') + 1);
|
|
173
171
|
const result = await (0, api_1.apiJson)(client, `/api/v1/projects/${config.projectId}/env`, {
|
|
174
172
|
method: 'POST',
|
|
175
|
-
|
|
176
|
-
// refuses a third. Guessing here would have made --scope proj mean the
|
|
177
|
-
// whole organization, which is the opposite of what such a typo means.
|
|
178
|
-
body: { name, value, scope: (0, args_1.flagString)(args, 'scope') },
|
|
173
|
+
body: { name, value },
|
|
179
174
|
});
|
|
180
|
-
(0, ui_1.ok)(`${(0, ui_1.bold)(result.name)} stored
|
|
175
|
+
(0, ui_1.ok)(`${(0, ui_1.bold)(result.name)} stored`);
|
|
181
176
|
// Values reach a function on its next deploy.
|
|
182
177
|
const users = referencedByFunctions(root).needed.get(name);
|
|
183
178
|
if (users && users.length > 0) {
|
package/dist/commands/logs.js
CHANGED
|
@@ -48,14 +48,22 @@ async function logs(args) {
|
|
|
48
48
|
async function functionsLogs(args) {
|
|
49
49
|
const name = args.words[1];
|
|
50
50
|
const { projectId, client } = await (0, session_1.projectTarget)(args);
|
|
51
|
-
const
|
|
51
|
+
const all = (0, args_1.flagBool)(args, 'all');
|
|
52
|
+
const query = new URLSearchParams({ source: 'function', limit: String((0, args_1.flagNumber)(args, 'limit') ?? DEFAULT_LIMIT), calls: all ? 'all' : 'failed' });
|
|
52
53
|
if (name)
|
|
53
54
|
query.set('name', name);
|
|
54
|
-
const
|
|
55
|
+
const cursor = (0, args_1.flagString)(args, 'cursor');
|
|
56
|
+
if (cursor)
|
|
57
|
+
query.set('cursor', cursor);
|
|
58
|
+
const { logs: rows, cursor: next } = await (0, api_1.apiJson)(client, `/api/v1/projects/${projectId}/logs?${query.toString()}`);
|
|
55
59
|
if (rows.length === 0) {
|
|
56
|
-
(0, ui_1.note)(name ? `Function ${name}
|
|
57
|
-
(0, ui_1.note)((0, ui_1.dim)('
|
|
60
|
+
(0, ui_1.note)(name ? `Function ${name}: nothing ${all ? 'called' : 'failed'} in the kept period` : `No function ${all ? 'was called' : 'failed'} in the kept period`);
|
|
61
|
+
(0, ui_1.note)((0, ui_1.dim)(' Kept for 7 days, 1 day on the Free plan'));
|
|
62
|
+
if (next)
|
|
63
|
+
(0, ui_1.note)((0, ui_1.dim)(` Older: xflow functions logs${name ? ` ${name}` : ''}${all ? ' --all' : ''} --cursor ${next}`));
|
|
58
64
|
return;
|
|
59
65
|
}
|
|
60
66
|
render(rows, () => 'browser');
|
|
67
|
+
if (next)
|
|
68
|
+
(0, ui_1.note)((0, ui_1.dim)(`Older: xflow functions logs${name ? ` ${name}` : ''}${all ? ' --all' : ''} --cursor ${next}`));
|
|
61
69
|
}
|
package/dist/commands/storage.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.contentTypeFor = contentTypeFor;
|
|
4
|
-
exports.collectMedia = collectMedia;
|
|
5
4
|
exports.planBatches = planBatches;
|
|
6
5
|
exports.caseCollisions = caseCollisions;
|
|
7
6
|
exports.storageList = storageList;
|
|
@@ -75,7 +74,7 @@ function contentTypeFor(name) {
|
|
|
75
74
|
* what one is asked to put there so it stays out of the 10 MB archive.
|
|
76
75
|
*
|
|
77
76
|
* Dot entries and symlinks are skipped: pointing push at a working copy should
|
|
78
|
-
* not upload .git, and a link is not ours to follow.
|
|
77
|
+
* not upload .git, and a link is not ours to follow.
|
|
79
78
|
*/
|
|
80
79
|
function collectMedia(root, prefix = '') {
|
|
81
80
|
const found = [];
|
package/dist/flags.js
CHANGED
|
@@ -56,11 +56,11 @@ exports.KNOWN = {
|
|
|
56
56
|
functions: ['project'],
|
|
57
57
|
'functions list': ['project'],
|
|
58
58
|
'functions invoke': ['data', 'data-file', 'method', 'project'],
|
|
59
|
-
'functions logs': ['limit', 'project'],
|
|
59
|
+
'functions logs': ['limit', 'project', 'all', 'cursor'],
|
|
60
60
|
logs: ['limit', 'project', 'app'],
|
|
61
61
|
env: ['project'],
|
|
62
62
|
'env list': ['project'],
|
|
63
|
-
'env set': [
|
|
63
|
+
'env set': [],
|
|
64
64
|
'env rm': ['project'],
|
|
65
65
|
'env remove': ['project'],
|
|
66
66
|
'env check': [],
|
|
@@ -87,14 +87,6 @@ exports.KNOWN = {
|
|
|
87
87
|
'storage push': ['to', 'replace', 'json', 'project'],
|
|
88
88
|
'storage rm': ['folder', 'yes', 'project'],
|
|
89
89
|
'storage remove': ['folder', 'yes', 'project'],
|
|
90
|
-
pages: ['json'],
|
|
91
|
-
'pages list': ['json'],
|
|
92
|
-
'pages create': ['slug'],
|
|
93
|
-
'pages deploy': ['message'],
|
|
94
|
-
'pages status': ['json'],
|
|
95
|
-
'pages rollback': [],
|
|
96
|
-
'pages rm': ['yes'],
|
|
97
|
-
'pages remove': ['yes'],
|
|
98
90
|
status: [],
|
|
99
91
|
dev: [],
|
|
100
92
|
pull: ['into', 'force', 'revision'],
|
|
@@ -144,7 +136,6 @@ const NAMESPACES = new Set([
|
|
|
144
136
|
'schedules',
|
|
145
137
|
'db',
|
|
146
138
|
'storage',
|
|
147
|
-
'pages',
|
|
148
139
|
]);
|
|
149
140
|
/** The command these words name, as far as the table knows it. */
|
|
150
141
|
function commandOf(words) {
|