poad 2.69.0 → 2.71.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/global/start.js +5 -1
- package/package.json +1 -1
- package/project/cli.js +2 -0
- package/project/connection.js +163 -0
- package/project/connections.js +2 -0
- package/project/db/diff.js +18 -6
- package/project/logs.js +1 -1
- package/project/source.js +201 -18
- package/test/connection.test.js +25 -0
- package/test/source.test.js +34 -6
- package/utils/capture.js +283 -0
- package/utils/cloud/bundle.js +1 -1
- package/utils/egress.js +30 -0
- package/utils/help-details.js +12 -4
- package/utils/logline.js +2 -2
- package/utils/migrations.js +34 -6
package/global/start.js
CHANGED
|
@@ -71,6 +71,8 @@ module.exports = async (args = {}) => {
|
|
|
71
71
|
// Réglages [ai] (engine 0.30.0+) : une valeur refusée est dite, et pas transmise
|
|
72
72
|
const aiSettings = require('../utils/ai').engineEnv(config);
|
|
73
73
|
aiSettings.warnings.forEach((w) => console.log(chalk.yellowBright(w)));
|
|
74
|
+
const egressSettings = require('../utils/egress').settings(config);
|
|
75
|
+
if (egressSettings.error) console.log(chalk.yellowBright(`${egressSettings.error}: outbound calls limited to the hosts of poad/connections.`));
|
|
74
76
|
const image = 'poadio/engine:' + config.engine;
|
|
75
77
|
// L'image de la version du projet n'est pas forcément là (poad install tire
|
|
76
78
|
// celle du CLI, et config.toml peut en demander une autre) : on la tire.
|
|
@@ -170,6 +172,8 @@ module.exports = async (args = {}) => {
|
|
|
170
172
|
// Identité du projet (project_uuid, projet poad.io lié) : poad storage sync entre
|
|
171
173
|
// environnements d'un même projet seulement (storage 0.4.0+)
|
|
172
174
|
...require('../utils/storage').engineEnv(config),
|
|
175
|
+
// Sortie : [egress] mode et allow (engine 0.69.0+, poad-egress)
|
|
176
|
+
...require('../utils/egress').engineEnv(config),
|
|
173
177
|
],
|
|
174
178
|
ExposedPorts: { '5432/tcp': {}, '8000/tcp': {}, ...gelf.exposed, ...frontPorts.exposed },
|
|
175
179
|
HostConfig: {
|
|
@@ -185,7 +189,7 @@ module.exports = async (args = {}) => {
|
|
|
185
189
|
// poad/reference : contenu des tables de référence, un fichier par table
|
|
186
190
|
// poad/api : définitions de l'API publiée du projet, un fichier par version
|
|
187
191
|
// poad/sources : déclarations des sources (<nom>.yaml), lues par meta (engine 0.64.0+)
|
|
188
|
-
Binds: [path.dirname(root) + '/data:/data', `${ensureDir(path.join(path.dirname(root), 'migrations'))}:/project/migrations`, `${ensureDir(path.join(path.dirname(root), 'credentials'))}:/project/credentials`, `${ensureDir(path.join(path.dirname(root), 'functions'))}:/project/functions`, `${ensureDir(path.join(path.dirname(root), 'variables'))}:/project/variables`, `${ensureDir(path.join(path.dirname(root), 'types'))}:/project/types`, `${ensureDir(path.join(path.dirname(root), 'flows'))}:/project/flows`, `${ensureDir(path.join(path.dirname(root), 'auth'))}:/project/auth`, `${ensureDir(path.join(path.dirname(root), 'storage'))}:/project/storage`, `${ensureDir(path.join(path.dirname(root), 'reference'))}:/project/reference`, `${ensureDir(path.join(path.dirname(root), 'sources'))}:/project/sources`, `${ensureDir(path.join(path.dirname(root), 'api'))}:/project/api`],
|
|
192
|
+
Binds: [path.dirname(root) + '/data:/data', `${ensureDir(path.join(path.dirname(root), 'migrations'))}:/project/migrations`, `${ensureDir(path.join(path.dirname(root), 'credentials'))}:/project/credentials`, `${ensureDir(path.join(path.dirname(root), 'functions'))}:/project/functions`, `${ensureDir(path.join(path.dirname(root), 'variables'))}:/project/variables`, `${ensureDir(path.join(path.dirname(root), 'types'))}:/project/types`, `${ensureDir(path.join(path.dirname(root), 'flows'))}:/project/flows`, `${ensureDir(path.join(path.dirname(root), 'auth'))}:/project/auth`, `${ensureDir(path.join(path.dirname(root), 'storage'))}:/project/storage`, `${ensureDir(path.join(path.dirname(root), 'reference'))}:/project/reference`, `${ensureDir(path.join(path.dirname(root), 'sources'))}:/project/sources`, `${ensureDir(path.join(path.dirname(root), 'connections'))}:/project/connections`, `${ensureDir(path.join(path.dirname(root), 'api'))}:/project/api`],
|
|
189
193
|
// Services lancés sur la machine : joignables depuis l'engine, y
|
|
190
194
|
// compris sous Linux
|
|
191
195
|
ExtraHosts: ['host.docker.internal:host-gateway'],
|
package/package.json
CHANGED
package/project/cli.js
CHANGED
|
@@ -78,6 +78,8 @@ module.exports = {
|
|
|
78
78
|
flow: 'Alias of poad flows',
|
|
79
79
|
source: 'Sources of the project (tables kept up to date from a URL or an uploaded file, poad/sources/<name>.yaml, engine 0.64.0+): ls, refresh <name> [--force], import <file> [--table <t>], link <table> (linked table of another PostgreSQL database, or remote table over a CSV, JSON, JSON-L, GeoJSON or Parquet file: --url or --storage, engine 0.67.0+), test <name>, pull <name>; --env <name> for poad.io',
|
|
80
80
|
sources: 'Alias of poad source',
|
|
81
|
+
connection: 'Named connections of the project (external services called through the egress service, poad/connections/<name>.yaml, engine 0.69.0+): ls, add <name> --url <https://…> [--credential <c>], test <name>, rm <name>; --env <name> for poad.io',
|
|
82
|
+
connections: 'Alias of poad connection',
|
|
81
83
|
/* status: `[AI] Vérification du statut de l'environnement`,
|
|
82
84
|
gen: {
|
|
83
85
|
description: 'Génération automatique des éléments clés pour votre projet',
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// poad connection ls connexions nommées du projet (poad/connections/<nom>.yaml) et leur état
|
|
2
|
+
// poad connection add <nom> --url <https://api…> [--credential c] [--auth bearer|header|basic] [--header <Nom>]
|
|
3
|
+
// [--methods GET,POST] [--paths /v1/**] [--rate 10/s] [--timeout 30s] [--test-path /]
|
|
4
|
+
// déclare une connexion (meta l'écrit dans poad/connections/<nom>.yaml)
|
|
5
|
+
// poad connection test <nom> [--path /x] appelle la connexion par la sortie (poad-egress) : statut, durée
|
|
6
|
+
// poad connection rm <nom> retire la déclaration (le credential reste au coffre)
|
|
7
|
+
//
|
|
8
|
+
// Une connexion nommée est un service externe appelé par la sortie de l'engine (engine 0.69.0+, docs/egress.md) :
|
|
9
|
+
// adresse de base, credential du coffre (jamais vu du code ni écrit ici), méthodes et chemins permis, débit. Le code
|
|
10
|
+
// l'appelle par env.<NOM>.fetch('/chemin') (fonctions), connection: <nom> (étape http-request), origin.connection
|
|
11
|
+
// (sources). --env <environnement> / --project <id> : le projet hébergé sur poad.io au lieu de l'engine local.
|
|
12
|
+
const flows = require('./flows');
|
|
13
|
+
|
|
14
|
+
const NAME_RE = /^[a-z][a-z0-9-]{0,62}$/;
|
|
15
|
+
const TIMEOUT_MS = 40000;
|
|
16
|
+
const USAGE = 'Usage: poad connection ls | add <name> --url <https://…> [--credential <c>] [--auth bearer|header|basic] [--header <Name>] [--methods GET,POST] [--paths /v1/**] [--rate 10/s] [--timeout 30s] [--test-path /] | test <name> [--path /x] | rm <name>, and --env <name> | --project <id> for poad.io';
|
|
17
|
+
|
|
18
|
+
/** Options --clé valeur d'une liste de mots ; rend { opts, rest } ou { error }. Pure. */
|
|
19
|
+
const options = (words, known) => {
|
|
20
|
+
const opts = {};
|
|
21
|
+
const rest = [];
|
|
22
|
+
for (let i = 0; i < words.length; i++) {
|
|
23
|
+
const w = words[i];
|
|
24
|
+
if (!w.startsWith('--')) {
|
|
25
|
+
rest.push(w);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const [k, inline] = w.slice(2).split(/=(.*)/s);
|
|
29
|
+
if (!known.includes(k)) return { error: `unknown option --${k}` };
|
|
30
|
+
const v = inline !== undefined ? inline : words[++i];
|
|
31
|
+
if (v === undefined || v.startsWith('--')) return { error: `--${k} takes a value` };
|
|
32
|
+
opts[k] = v;
|
|
33
|
+
}
|
|
34
|
+
return { opts, rest };
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Corps de POST /meta/v1/connections depuis les options. Pure. */
|
|
38
|
+
const addBody = (name, o) => {
|
|
39
|
+
if (!o.url) return { error: '--url <https://…> is required (the base address of the service)' };
|
|
40
|
+
if (!/^https?:\/\//i.test(o.url)) return { error: '--url must start with https:// (or http://)' };
|
|
41
|
+
if (o.auth && !['bearer', 'header', 'basic'].includes(o.auth)) return { error: '--auth: bearer, header or basic' };
|
|
42
|
+
if ((o.auth || o.header) && !o.credential) return { error: '--auth and --header need --credential <name> (a credential of the vault: Project > Credentials)' };
|
|
43
|
+
const list = (v) => String(v).split(',').map((x) => x.trim()).filter(Boolean);
|
|
44
|
+
return {
|
|
45
|
+
name,
|
|
46
|
+
base_url: o.url,
|
|
47
|
+
...(o.credential ? { auth: { type: o.auth || (o.header ? 'header' : 'bearer'), credential: o.credential, ...(o.header ? { header: o.header } : {}) } } : {}),
|
|
48
|
+
...(o.methods ? { methods: list(o.methods).map((m) => m.toUpperCase()) } : {}),
|
|
49
|
+
...(o.paths ? { paths: list(o.paths) } : {}),
|
|
50
|
+
...(o.rate ? { rate: o.rate } : {}),
|
|
51
|
+
...(o.timeout ? { timeout: o.timeout } : {}),
|
|
52
|
+
...(o['test-path'] ? { test_path: o['test-path'] } : {}),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Ligne d'une connexion pour ls. Pure. */
|
|
57
|
+
const describe = (c) => {
|
|
58
|
+
const auth = c.auth && c.auth.type !== 'none' ? `${c.auth.type}${c.auth.credential ? ` ${c.auth.credential.name}${c.auth.credential.exists ? '' : ' (missing)'}` : ''}` : 'no auth';
|
|
59
|
+
const rate = c.rate ? `, ${c.rate.requests}/${c.rate.per_ms >= 3600000 ? 'h' : c.rate.per_ms >= 60000 ? 'min' : 's'}` : '';
|
|
60
|
+
return `${c.name} ${c.base_url || '?'} ${auth}${rate} env.${c.binding}`;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const main = async (args = {}, raw, deps = {}) => {
|
|
64
|
+
const chalk = require('chalk-v2');
|
|
65
|
+
const { findPoadDir } = require('../utils/findpoad');
|
|
66
|
+
const { readConfig } = require('../utils/config');
|
|
67
|
+
const doFetch = deps.fetch || fetch;
|
|
68
|
+
const started = deps.started || ((config) => require('../utils/docker').isDockerExist(config.project_uuid));
|
|
69
|
+
const cloudTarget = deps.cloudTarget || ((opts) => require('../utils/storage').cloudTarget(opts));
|
|
70
|
+
const fail = (message, code = 1) => {
|
|
71
|
+
process.exitCode = code;
|
|
72
|
+
console.log(chalk.redBright(message));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const typed = flows.cloudOptions(Array.isArray(raw) ? raw.map(String) : Object.keys(args));
|
|
76
|
+
if (typed.error) return fail(`poad connection: ${typed.error}.`, 2);
|
|
77
|
+
const json = typed.words.includes('--json');
|
|
78
|
+
const words = typed.words.filter((w) => w !== '--json');
|
|
79
|
+
const command = words[0] || 'ls';
|
|
80
|
+
const cloud = Boolean(typed.env || typed.project);
|
|
81
|
+
const root = findPoadDir(deps.cwd || process.cwd());
|
|
82
|
+
if (!root && !(cloud && typed.project)) return fail('You are not in a poad project directory.');
|
|
83
|
+
|
|
84
|
+
let t;
|
|
85
|
+
if (cloud) {
|
|
86
|
+
try {
|
|
87
|
+
const c = await cloudTarget({ env: typed.env, project: typed.project });
|
|
88
|
+
t = { base: c.base, key: c.key, apikey: c.apikey || c.key, label: c.label };
|
|
89
|
+
} catch (err) {
|
|
90
|
+
return fail((err && err.message) || String(err), (err && err.exit) || 1);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
const config = readConfig(root);
|
|
94
|
+
const [major, minor] = String(config.engine || '').split('.').map(Number);
|
|
95
|
+
if (!(major > 0 || minor >= 69)) return fail(`Named connections need engine 0.69.0 or later (this project uses ${config.engine}): "poad upgrade".`);
|
|
96
|
+
if (!(await started(config))) return fail('The project is not started: run "poad start".');
|
|
97
|
+
t = { base: `http://localhost:${config.web.port}`, key: config.auth.service, apikey: config.auth.service, label: 'The engine' };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const call = async (method, route, body) => {
|
|
101
|
+
let res;
|
|
102
|
+
try {
|
|
103
|
+
res = await doFetch(`${t.base}/meta/v1${route}`, {
|
|
104
|
+
method,
|
|
105
|
+
headers: { apikey: t.apikey, authorization: `Bearer ${t.key}`, ...(body === undefined ? {} : { 'content-type': 'application/json' }) },
|
|
106
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
107
|
+
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
108
|
+
});
|
|
109
|
+
} catch (err) {
|
|
110
|
+
throw new Error(`${t.label} does not answer on ${t.base}: ${(err && err.cause && err.cause.message) || (err && err.message) || err}`);
|
|
111
|
+
}
|
|
112
|
+
const data = await res.json().catch(() => null);
|
|
113
|
+
if (res.ok) return data || {};
|
|
114
|
+
if (data && data.error && data.error.message) throw new Error(data.error.message);
|
|
115
|
+
if (res.status === 404) throw new Error(`${t.label} has no connections API (HTTP 404): engine 0.69.0 or later is needed.`);
|
|
116
|
+
throw new Error(`HTTP ${res.status}`);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
if (command === 'ls' || command === 'list') {
|
|
121
|
+
const list = await call('GET', '/connections');
|
|
122
|
+
if (json) return console.log(JSON.stringify(list, null, 2));
|
|
123
|
+
if (!list.connections.length) return console.log(`No connection yet (environment ${list.environment}): poad connection add <name> --url <https://…>`);
|
|
124
|
+
console.log(chalk.gray(`Environment ${list.environment}, poad/connections:`));
|
|
125
|
+
for (const c of list.connections) console.log(`${c.problems && c.problems.length ? chalk.yellow('!') : chalk.green('✓')} ${describe(c)}`);
|
|
126
|
+
for (const c of list.connections) for (const p of c.problems || []) console.log(chalk.yellow(` ${c.name}: ${p.path}: ${p.message}`));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const name = words[1];
|
|
130
|
+
if (!['add', 'test', 'rm'].includes(command) || !name) return fail(USAGE, 2);
|
|
131
|
+
if (!NAME_RE.test(name)) return fail(`Invalid connection name "${name}": lowercase letters, digits and "-", starting with a letter.`, 2);
|
|
132
|
+
if (command === 'add') {
|
|
133
|
+
const parsed = options(words.slice(2), ['url', 'credential', 'auth', 'header', 'methods', 'paths', 'rate', 'timeout', 'test-path']);
|
|
134
|
+
if (parsed.error) return fail(`poad connection add: ${parsed.error}.\n${USAGE}`, 2);
|
|
135
|
+
const body = addBody(name, parsed.opts);
|
|
136
|
+
if (body.error) return fail(`poad connection add: ${body.error}.`, 2);
|
|
137
|
+
const c = await call('POST', '/connections', body);
|
|
138
|
+
if (json) return console.log(JSON.stringify(c, null, 2));
|
|
139
|
+
console.log(chalk.green(`Connection ${name} written to poad/${c.file || `connections/${name}.yaml`}.`));
|
|
140
|
+
console.log(`Call it from a function with env.${c.binding}.fetch('/path'), from a flow step with connection: ${name}.`);
|
|
141
|
+
for (const p of c.problems || []) console.log(chalk.yellow(`${p.path}: ${p.message}`));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (command === 'rm') {
|
|
145
|
+
await call('DELETE', `/connections/${name}`);
|
|
146
|
+
return console.log(chalk.green(`Connection ${name} removed (its credential stays in the vault).`));
|
|
147
|
+
}
|
|
148
|
+
const parsed = options(words.slice(2), ['path']);
|
|
149
|
+
if (parsed.error) return fail(`poad connection test: ${parsed.error}.`, 2);
|
|
150
|
+
const r = await call('POST', `/connections/${name}/test`, parsed.opts.path ? { path: parsed.opts.path } : {});
|
|
151
|
+
if (json) return console.log(JSON.stringify(r, null, 2));
|
|
152
|
+
if (r.ok) return console.log(chalk.green(`✓ ${name}: HTTP ${r.status} in ${r.duration_ms} ms`));
|
|
153
|
+
fail(`✗ ${name}: ${r.message || (r.status ? `HTTP ${r.status}` : 'failed')}`);
|
|
154
|
+
} catch (err) {
|
|
155
|
+
return fail(`poad connection ${command}: ${err.message}`);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
module.exports = (args, raw) => main(args, raw);
|
|
160
|
+
module.exports.main = main;
|
|
161
|
+
module.exports.addBody = addBody;
|
|
162
|
+
module.exports.describe = describe;
|
|
163
|
+
module.exports.options = options;
|
package/project/db/diff.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// (console SQL, psql, un outil), notés par le journal
|
|
3
3
|
// poad db diff <nom> les écrit dans poad/migrations/<horodatage>_<nom>.sql
|
|
4
4
|
// (déjà appliqués : ils ne sont pas rejoués)
|
|
5
|
+
// poad db diff --save idem, avec le nom proposé (tiré de ce qui a changé :
|
|
6
|
+
// modifie_observation_enregistrer, cree_table_releves…)
|
|
7
|
+
// Fonctions et procédures : seules celles qui ont vraiment changé, comparées au
|
|
8
|
+
// catalogue (engine 0.69.0) ; un script rejoué à l'identique n'écrit rien.
|
|
5
9
|
// poad db diff --discard les oublie (ils restent dans la base)
|
|
6
10
|
//
|
|
7
11
|
// La liste commence par un résumé, un objet par ligne : + ajouté, ~ modifié,
|
|
@@ -23,8 +27,8 @@ module.exports = async (args = {}) => {
|
|
|
23
27
|
}
|
|
24
28
|
// Options : --discard, --json (aussi sans tirets) ; le reste forme le nom
|
|
25
29
|
const flag = (f) => Boolean(args[f] || args[`--${f}`]);
|
|
26
|
-
const isFlag = (k) => k.startsWith('-') || ['discard', 'json', 'yes'].includes(k);
|
|
27
|
-
const
|
|
30
|
+
const isFlag = (k) => k.startsWith('-') || ['discard', 'json', 'yes', 'save'].includes(k);
|
|
31
|
+
const typed = Object.keys(args).filter((k) => !isFlag(k) && args[k] === true).join('_') || (typeof args.name === 'string' ? args.name : '');
|
|
28
32
|
|
|
29
33
|
const client = await migrations.connect(config);
|
|
30
34
|
try {
|
|
@@ -42,6 +46,7 @@ module.exports = async (args = {}) => {
|
|
|
42
46
|
}
|
|
43
47
|
return console.log(`${chalk.greenBright('✔')} No structure change outside the migrations.`);
|
|
44
48
|
}
|
|
49
|
+
const name = typed || (flag('save') ? c.suggested_name || 'changement_de_structure' : '');
|
|
45
50
|
if (flag('discard')) {
|
|
46
51
|
await migrations.discardChanges(client, c.upTo);
|
|
47
52
|
return console.log(`${chalk.greenBright('✔')} ${c.entries.length} change(s) forgotten ${chalk.grey('(still in the database)')}.`);
|
|
@@ -60,17 +65,19 @@ module.exports = async (args = {}) => {
|
|
|
60
65
|
const group = u.effect === 'merged' ? chalk.cyanBright(` · ${u.ids.length} changes → ${u.result}`) : u.effect === 'none' ? chalk.yellowBright(` · ${u.ids.length} changes, no effect`) : '';
|
|
61
66
|
console.log(chalk.grey(`-- ${when} · ${e.role_name}${e.application ? ' · ' + e.application : ''} · ${(e.commands || []).join(', ')}`) + group);
|
|
62
67
|
if (u.effect === 'none') console.log(chalk.grey(`-- ${u.target}: nothing to write`));
|
|
63
|
-
|
|
68
|
+
if (u.kind === 'routine' && !u.keep.length) console.log(chalk.grey(`-- ${u.target}: identical to the last migration, nothing to write`));
|
|
69
|
+
for (const id of u.keep) console.log(byId.get(id).sql !== undefined ? byId.get(id).sql : String(byId.get(id).statement).trim().replace(/;?\s*$/, ';'));
|
|
64
70
|
console.log(' ');
|
|
65
71
|
}
|
|
66
|
-
|
|
72
|
+
if (c.suggested_name) console.log(`${chalk.bold('Suggested name')} ${c.suggested_name} ${chalk.grey(`(${c.sql ? c.sql.split('\n').length : 0} line(s) of SQL)`)}`);
|
|
73
|
+
return console.log(chalk.grey(' "poad db diff --save" writes them to poad/migrations with this name, "poad db diff <name>" with yours (not replayed); "poad db diff --discard" forgets them.'));
|
|
67
74
|
}
|
|
68
75
|
if (!c.sql.trim()) {
|
|
69
76
|
// Que des changements qui s'annulent : rien à écrire
|
|
70
77
|
await migrations.discardChanges(client, c.upTo);
|
|
71
|
-
return console.log(`${chalk.greenBright('✔')} ${c.entries.length} change(s) with no
|
|
78
|
+
return console.log(`${chalk.greenBright('✔')} ${c.entries.length} change(s) with no real effect (objects identical to the last migration): nothing to write, journal cleared.`);
|
|
72
79
|
}
|
|
73
|
-
const file = await migrations.saveChanges(root, client, name, c.sql, c.upTo);
|
|
80
|
+
const file = await migrations.saveChanges(root, client, name, c.sql, c.upTo, c.items || []);
|
|
74
81
|
console.log(`${chalk.greenBright('✔')} ${chalk.bold(path.relative(process.cwd(), file))} ${chalk.grey(`(${c.entries.length} change(s), already applied here)`)}`);
|
|
75
82
|
for (const line of summaryLines(summarize(c).filter((i) => i.change !== 'none'), chalk)) console.log(line);
|
|
76
83
|
console.log(chalk.grey(' Review it, then commit it with your branch.'));
|
|
@@ -153,6 +160,11 @@ const summarize = (c) => {
|
|
|
153
160
|
out.push({ change: 'none', kind: u.kind, object: u.target, others: [], detail: `${u.ids.length} changes, no net effect` });
|
|
154
161
|
continue;
|
|
155
162
|
}
|
|
163
|
+
if (u.kind === 'routine' && u.items) {
|
|
164
|
+
if (!u.keep.length) out.push({ change: 'none', kind: u.kind, object: u.target, others: [], detail: 'identical to the last migration' });
|
|
165
|
+
for (const i of u.items) out.push({ change: { created: 'added', modified: 'changed', dropped: 'removed' }[i.change], kind: i.type, object: `${i.schema && i.schema !== 'public' ? `${i.schema}.` : ''}${i.name}${i.identity ? i.identity.slice(i.identity.indexOf('(')).replace(/pg_catalog\./g, '') : ''}`, others: [], detail: (i.aspects || []).join(', ') || null });
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
156
168
|
for (const id of u.keep) if (byId.has(id)) out.push(describe(byId.get(id)));
|
|
157
169
|
}
|
|
158
170
|
return out;
|
package/project/logs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// poad logs les 100 dernières lignes, tous services
|
|
3
3
|
// poad logs data auth seulement ces services (gateway, data, auth,
|
|
4
4
|
// storage, meta, functions, flows, postgres,
|
|
5
|
-
// logs, engine, mailpit, keycloak, valkey)
|
|
5
|
+
// files, logs, engine, mailpit, keycloak, valkey)
|
|
6
6
|
// poad logs level=warn warn, error et fatal
|
|
7
7
|
// poad logs since=15m depuis 15 minutes (s, m, h, d)
|
|
8
8
|
// poad logs request=6f1c… tout le chemin d'une requête (début de l'id suffit)
|