@getxflow/cli 0.6.2 → 0.6.4
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/deploy.js +4 -0
- package/dist/commands/env.js +6 -1
- package/dist/commands/sources.js +16 -0
- package/dist/prompt.js +4 -2
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/skills/xflow/SKILL.md +10 -0
package/dist/commands/deploy.js
CHANGED
|
@@ -120,6 +120,10 @@ async function deploy(args) {
|
|
|
120
120
|
if (started.removed_functions?.length) {
|
|
121
121
|
(0, ui_1.warn)(`Removed from the cloud, gone from the sources: ${started.removed_functions.join(', ')}`);
|
|
122
122
|
}
|
|
123
|
+
if (started.revoked_connections?.length) {
|
|
124
|
+
(0, ui_1.warn)(`Access revoked by the provider: ${started.revoked_connections.join(', ')}`);
|
|
125
|
+
(0, ui_1.note)((0, ui_1.dim)(' Reconnect the account in the platform settings: another build will not fix this'));
|
|
126
|
+
}
|
|
123
127
|
const build = await waitForBuild(client, config.projectId, started);
|
|
124
128
|
if (build.phase === 'failed') {
|
|
125
129
|
if (build.log_tail) {
|
package/dist/commands/env.js
CHANGED
|
@@ -12,6 +12,11 @@ const config_1 = require("../config");
|
|
|
12
12
|
const errors_1 = require("../errors");
|
|
13
13
|
const session_1 = require("../session");
|
|
14
14
|
const ui_1 = require("../ui");
|
|
15
|
+
const SCOPE_LABEL = {
|
|
16
|
+
organization: 'the whole organization',
|
|
17
|
+
project: 'this project only',
|
|
18
|
+
connection: 'from a connected service, read-only',
|
|
19
|
+
};
|
|
15
20
|
const FUNCTIONS_DIR = 'functions';
|
|
16
21
|
/** Matches `process.env.NAME` and `process.env['NAME']`. */
|
|
17
22
|
const ENV_REFERENCE = /process\.env(?:\.([A-Z0-9_]+)|\[['"]([A-Z0-9_]+)['"]\])/g;
|
|
@@ -70,7 +75,7 @@ async function envList() {
|
|
|
70
75
|
(0, ui_1.note)((0, ui_1.dim)(' To store one: xflow env set SMTP_PASSWORD=secret'));
|
|
71
76
|
return;
|
|
72
77
|
}
|
|
73
|
-
(0, ui_1.table)(rows.map((row) => [row.name, row.scope
|
|
78
|
+
(0, ui_1.table)(rows.map((row) => [row.name, SCOPE_LABEL[row.scope] ?? SCOPE_LABEL.organization]));
|
|
74
79
|
(0, ui_1.note)((0, ui_1.dim)(' The platform never returns values: they are visible only inside the function'));
|
|
75
80
|
}
|
|
76
81
|
/** Check that every referenced variable is stored. */
|
package/dist/commands/sources.js
CHANGED
|
@@ -176,6 +176,22 @@ async function status() {
|
|
|
176
176
|
(0, ui_1.out)('');
|
|
177
177
|
(0, ui_1.out)(`Built version: ${card.dev_deploy_id ?? '(no build)'}`);
|
|
178
178
|
(0, ui_1.out)(`Visitors see: ${card.live_deploy_id ?? '(never published)'}`);
|
|
179
|
+
// Two different problems, two different fixes: an expiring token is renewed by
|
|
180
|
+
// any build, a revoked one is not renewed by anything until a human reconnects
|
|
181
|
+
// the account. Telling them apart saves a pointless rebuild.
|
|
182
|
+
const ailing = (card.connections ?? []).filter((c) => c.health !== 'ok');
|
|
183
|
+
if (ailing.length > 0) {
|
|
184
|
+
(0, ui_1.out)('');
|
|
185
|
+
(0, ui_1.out)((0, ui_1.bold)('Connected accounts needing attention:'));
|
|
186
|
+
for (const connection of ailing) {
|
|
187
|
+
const problem = connection.health === 'expiring'
|
|
188
|
+
? `expires in ${connection.days_left} days, any build renews it`
|
|
189
|
+
: connection.health === 'expired'
|
|
190
|
+
? 'access has expired, reconnect the account in the platform settings'
|
|
191
|
+
: 'access was revoked by the provider, reconnect the account in the platform settings';
|
|
192
|
+
(0, ui_1.out)(` ${connection.label} (${connection.alias}): ${problem}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
179
195
|
(0, ui_1.out)('');
|
|
180
196
|
(0, ui_1.out)(card.project_url);
|
|
181
197
|
}
|
package/dist/prompt.js
CHANGED
|
@@ -6,8 +6,8 @@ const node_readline_1 = require("node:readline");
|
|
|
6
6
|
const errors_1 = require("./errors");
|
|
7
7
|
const ui_1 = require("./ui");
|
|
8
8
|
function render(lines, first) {
|
|
9
|
-
const up = first ? '' : `[${lines.length}A`;
|
|
10
|
-
process.stderr.write(up
|
|
9
|
+
const up = first || lines.length === 1 ? '' : `[${lines.length - 1}A`;
|
|
10
|
+
process.stderr.write(`${up}\r${lines.map((line) => `[2K${line}`).join('\n')}`);
|
|
11
11
|
}
|
|
12
12
|
function listen(onKey) {
|
|
13
13
|
if (process.stdin.isTTY !== true) {
|
|
@@ -17,6 +17,7 @@ function listen(onKey) {
|
|
|
17
17
|
const wasRaw = process.stdin.isRaw === true;
|
|
18
18
|
process.stdin.setRawMode(true);
|
|
19
19
|
process.stdin.resume();
|
|
20
|
+
process.stderr.write('[?25l');
|
|
20
21
|
const handler = (_, key) => {
|
|
21
22
|
if (key)
|
|
22
23
|
onKey(key);
|
|
@@ -26,6 +27,7 @@ function listen(onKey) {
|
|
|
26
27
|
process.stdin.off('keypress', handler);
|
|
27
28
|
process.stdin.setRawMode(wasRaw);
|
|
28
29
|
process.stdin.pause();
|
|
30
|
+
process.stderr.write('[?25h\n');
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
const isConfirm = (key) => key.name === 'return' || key.name === 'enter';
|
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.6.
|
|
5
|
+
exports.CLI_VERSION = '0.6.4';
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getxflow/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "CLI for the XFlow platform: source sync, deployment and publishing of applications",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"skills"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.json"
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
18
19
|
},
|
|
19
20
|
"publishConfig": {
|
|
20
21
|
"access": "public"
|
package/skills/xflow/SKILL.md
CHANGED
|
@@ -251,6 +251,16 @@ assemble a variable name from an expression and never destructure the environmen
|
|
|
251
251
|
(`const { API_KEY } = process.env` reads as no mention at all, and the variable arrives
|
|
252
252
|
empty). New values arrive on the next `xflow deploy`, not at the moment they are written.
|
|
253
253
|
|
|
254
|
+
Some variables come from a connected account instead of from you. When someone connects an
|
|
255
|
+
advertising cabinet or another external service in the platform settings and links it to the
|
|
256
|
+
project, its credentials show up in `xflow env` marked read-only, under a prefix chosen at
|
|
257
|
+
link time: `YANDEX_DIRECT_TOKEN`, `YANDEX_DIRECT_CLIENT_LOGIN`. Read them like any other
|
|
258
|
+
variable. Do not try to `xflow env set` those names: the platform keeps the values in sync
|
|
259
|
+
and refuses. If a call to that service starts failing with an authorisation error, run
|
|
260
|
+
`xflow status`: it says whether the token is merely expiring (any build renews it) or the
|
|
261
|
+
account was disconnected on the provider's side, which only a human can fix by reconnecting
|
|
262
|
+
it in the platform settings.
|
|
263
|
+
|
|
254
264
|
To run a function on a timer: `xflow schedules set report "0 3 ? * * *"` (daily at 03:00).
|
|
255
265
|
Six fields, UTC, and exactly one of day-of-month / day-of-week must be `?` — that is
|
|
256
266
|
how Yandex wants it. A scheduled run reaches the handler as a POST with no headers.
|