@faable/faable 1.38.0 → 1.38.2
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/api/FaableApi.js +0 -3
- package/dist/commands/deploy/inspect/detail.js +21 -12
- package/dist/log.js +24 -1
- package/package.json +1 -1
package/dist/api/FaableApi.js
CHANGED
|
@@ -108,9 +108,6 @@ class FaableApi {
|
|
|
108
108
|
async getApp(app_id) {
|
|
109
109
|
return data(this.client.get(`/app/${app_id}`));
|
|
110
110
|
}
|
|
111
|
-
async getRegistry(app_id) {
|
|
112
|
-
return data(this.client.get(`/app/${app_id}/registry`));
|
|
113
|
-
}
|
|
114
111
|
// `image`/`type` are optional to support the failure path: a failed build
|
|
115
112
|
// is recorded as a deployment without an image (and without `type`, which
|
|
116
113
|
// would otherwise rewrite the app's runtime_strategy server-side).
|
|
@@ -36,20 +36,30 @@ const label = (name, value) => ` ${`${name}:`.padEnd(12)}${value}`;
|
|
|
36
36
|
// rendered as labeled lines so they stay in the same column as the record.
|
|
37
37
|
// A BUILD_ERROR never ran, so it has no runtime logs to offer; a retired
|
|
38
38
|
// deployment does (for 24h — the runtime window), plus its frozen build output.
|
|
39
|
-
|
|
39
|
+
//
|
|
40
|
+
// Every one carries `-a <app_id>`. These lines exist to be copied, and all of
|
|
41
|
+
// these commands call resolve_app_id first — which, without an explicit app,
|
|
42
|
+
// falls back to matching the git remote of the working directory. A suggestion
|
|
43
|
+
// that only runs inside one checkout is a suggestion that fails the moment it
|
|
44
|
+
// is pasted anywhere else, `faable deploy inspect` having been run from
|
|
45
|
+
// somewhere else being the very case that produces these lines.
|
|
46
|
+
const next_steps = (d, app_id, is_live) => {
|
|
40
47
|
const phase = d.status?.phase ?? '';
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
48
|
+
const a = `-a ${app_id}`;
|
|
49
|
+
const runtime = label('Logs', `faable deploy logs -d ${d.id} ${a}`);
|
|
50
|
+
const build = label('Build', `faable deploy logs --build -d ${d.id} ${a}`);
|
|
51
|
+
const retry = label('Retry', `faable deploy redeploy ${d.id} ${a}`);
|
|
44
52
|
if (phase === 'BUILD_ERROR')
|
|
45
53
|
return [build, retry];
|
|
46
54
|
if (phase === 'ERROR')
|
|
47
55
|
return [runtime, build, retry];
|
|
48
56
|
if (phase === 'BUILDING' || phase === 'QUEUED' || phase === 'UNKNOWN') {
|
|
49
|
-
return [
|
|
57
|
+
return [
|
|
58
|
+
label('Follow', `faable deploy logs --build -d ${d.id} ${a} --follow`)
|
|
59
|
+
];
|
|
50
60
|
}
|
|
51
61
|
if (is_live)
|
|
52
|
-
return [label('Logs',
|
|
62
|
+
return [label('Logs', `faable deploy logs ${a}`)];
|
|
53
63
|
return [runtime, build];
|
|
54
64
|
};
|
|
55
65
|
const deployment_detail = (args) => {
|
|
@@ -99,11 +109,10 @@ const deployment_detail = (args) => {
|
|
|
99
109
|
if (artifact?.purged_at) {
|
|
100
110
|
lines.push(label('Purged', `${when(artifact.purged_at)} — source no longer stored`));
|
|
101
111
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
112
|
+
// Deliberately NOT rendered: `image` and `status.runtime_image`. Both are
|
|
113
|
+
// full registry references to OUR infrastructure (account, region, repo
|
|
114
|
+
// naming) — platform internals with no use to the app's owner. The runtime
|
|
115
|
+
// that matters is already on the Artifact line.
|
|
107
116
|
if (d.redeploy_of)
|
|
108
117
|
lines.push(label('Rebuild of', d.redeploy_of));
|
|
109
118
|
if (d.quota_released_at) {
|
|
@@ -115,7 +124,7 @@ const deployment_detail = (args) => {
|
|
|
115
124
|
lines.push(` ${line}`);
|
|
116
125
|
}
|
|
117
126
|
}
|
|
118
|
-
lines.push(...next_steps(d, is_live));
|
|
127
|
+
lines.push(...next_steps(d, app.id, is_live));
|
|
119
128
|
return lines;
|
|
120
129
|
};
|
|
121
130
|
|
package/dist/log.js
CHANGED
|
@@ -8,11 +8,34 @@ import { buildLog } from './lib/log_buffer.js';
|
|
|
8
8
|
//
|
|
9
9
|
// Tee: terminal stream (colorized) + a plain-text copy into the build-log
|
|
10
10
|
// buffer so CLI messages land in the logs attached to the deployment.
|
|
11
|
+
// What the terminal shows: just the message. pino's envelope
|
|
12
|
+
// (`[12:03:44.101] INFO (54834):`) is noise for a CLI — a timestamp and a pid
|
|
13
|
+
// per line are for a log file, not for someone waiting on a deploy.
|
|
14
|
+
//
|
|
15
|
+
// Dropping the level token would also drop its color (pino-pretty tints the
|
|
16
|
+
// whole line cyan otherwise), so the level is carried by the MESSAGE color
|
|
17
|
+
// instead: warnings yellow, errors red, everything else the usual cyan.
|
|
18
|
+
const LEVEL_COLOR = {
|
|
19
|
+
40: "\u001b[33m", // warn
|
|
20
|
+
50: "\u001b[31m", // error
|
|
21
|
+
60: "\u001b[31m", // fatal
|
|
22
|
+
};
|
|
23
|
+
const TERMINAL_FORMAT = {
|
|
24
|
+
ignore: "pid,hostname,time,level",
|
|
25
|
+
messageFormat: (log, key) => {
|
|
26
|
+
const message = String(log[key] ?? "");
|
|
27
|
+
const color = LEVEL_COLOR[Number(log.level)];
|
|
28
|
+
return color ? `${color}${message}\u001b[39m` : message;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
// The archived copy KEEPS the envelope: these lines are attached to the
|
|
32
|
+
// deployment and read later (support, post-mortems), where the timestamp and
|
|
33
|
+
// level are the whole point.
|
|
11
34
|
const toPlainText = prettyFactory({ colorize: false, sync: true });
|
|
12
35
|
// NB: the two-arg form matters — pino(multistream) alone would treat the
|
|
13
36
|
// multistream object as the options bag and log raw JSON to stdout.
|
|
14
37
|
const log = pino({}, pino.multistream([
|
|
15
|
-
{ stream: pretty({ colorize: true, sync: true }) },
|
|
38
|
+
{ stream: pretty({ colorize: true, sync: true, ...TERMINAL_FORMAT }) },
|
|
16
39
|
{
|
|
17
40
|
stream: {
|
|
18
41
|
write(line) {
|