poad 2.57.0 → 2.58.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poad",
3
- "version": "2.57.0",
3
+ "version": "2.58.0",
4
4
  "engine": "0.28.0",
5
5
  "runner": "0.2.0",
6
6
  "main": "index.js",
package/project/deploy.js CHANGED
@@ -1,13 +1,12 @@
1
- // poad deploy [--env <branche>] [--dry-run] [--allow-destructive] [--yes] [--json]
1
+ // poad deploy [--env <branche>] [--dry-run] [--yes] [--json]
2
2
  //
3
3
  // Envoie le dossier poad/ (liste blanche, sans aucun secret : utils/cloud/bundle.js)
4
4
  // à l'environnement du projet poad.io lié :
5
5
  // POST v1/projects/:id/branches/:branch/deploy (application/gzip)
6
6
  // x-poad-sha commit git courant, si poad/ n'a aucun changement non commité
7
7
  // x-poad-dry-run 1 avec --dry-run : le serveur dit ce qu'il ferait, rien ne change
8
- // x-poad-allow-destructive 1 avec --allow-destructive : migrations qui suppriment
9
- // (drop, truncate, delete, rename) permises ; sinon le déploiement est refusé
10
- // réponse : { deploy_id?, status?, migrations: { applied, pending, errors } }
8
+ // réponse : { deploy_id?, status?, migrations: { applied, pending, errors }, warnings }
9
+ // warnings : migrations qui perdent des données (drop table, truncate…), signalées, jamais refusées
11
10
  // asynchrone (deploy_id et état non terminé) : GET …/deploys/:deploy_id jusqu'à la fin
12
11
  //
13
12
  // Production (main) : résumé puis confirmation, sauf --yes (obligatoire hors
@@ -34,6 +33,8 @@ function summarize(d = {}) {
34
33
  dry_run: Boolean(d.dry_run),
35
34
  migrations: { applied: names(m.applied), pending: names(m.pending), errors },
36
35
  message: typeof d.message === 'string' ? d.message : null,
36
+ // Signalé, jamais bloquant : migrations qui perdent des données (drop table, truncate…)
37
+ warnings: (Array.isArray(d.warnings) ? d.warnings : []).map((w) => ({ message: String((w && w.message) || ''), files: Array.isArray(w && w.files) ? w.files.map(String) : [] })),
37
38
  failed: errors.length > 0 || FAILED.includes(status),
38
39
  };
39
40
  }
@@ -70,7 +71,7 @@ module.exports = (args, raw) =>
70
71
  // Tables de référence trop lourdes pour git : hors de l'archive, envoyées au magasin de références
71
72
  const large = refStore.largeFiles(poadDir);
72
73
  const ignored = refStore.ensureGitignore(poadDir, large);
73
- const allowDestructive = Boolean(opts['allow-destructive']);
74
+ // --allow-destructive : accepté, sans effet (poad.io signale les migrations qui perdent des données, sans refuser)
74
75
 
75
76
  const env = await branches.resolve(id, { wanted: opts.env, root });
76
77
  let b;
@@ -96,7 +97,7 @@ module.exports = (args, raw) =>
96
97
  else if (git.empty) out.log(chalk.grey(' git repository without any commit yet: no commit id'));
97
98
  else out.log(chalk.grey(' not in a git repository: no commit id'));
98
99
  for (const s of b.skipped) if (!large.some((f) => f.rel === s.path)) out.log(chalk.grey(` skipped ${s.path}: ${s.reason}`));
99
- for (const f of large) out.log(chalk.grey(` ${f.rel} (${kb(f.size)}): too large for git, goes to the reference store, then is loaded`));
100
+ for (const f of large) out.log(chalk.grey(` ${f.rel} (${kb(f.size)}): too large for git: reference store, sent and loaded only if it changed (sha256)`));
100
101
  for (const f of ignored.tracked) out.log(chalk.yellowBright(` ⚠ poad/${f.rel} is tracked by git although it is too large: git rm --cached poad/${f.rel}`));
101
102
 
102
103
  if (env.production && !dryRun) {
@@ -107,7 +108,6 @@ module.exports = (args, raw) =>
107
108
  const headers = {};
108
109
  if (sha) headers['x-poad-sha'] = sha;
109
110
  if (dryRun) headers['x-poad-dry-run'] = '1';
110
- if (allowDestructive) headers['x-poad-allow-destructive'] = '1';
111
111
  let result = summarize(await api.call('POST', `${route}/deploy`, { body: b.tgz, contentType: 'application/gzip', headers, what: 'deploy', timeout: 300000 }));
112
112
 
113
113
  // Déploiement asynchrone : suivi jusqu'à son terme
@@ -133,6 +133,10 @@ module.exports = (args, raw) =>
133
133
  // Refus pour migrations destructives : lesquelles, et comment confirmer
134
134
  for (const f of e.files || []) out.log(` ${chalk.yellow(f)}`);
135
135
  }
136
+ for (const w of result.warnings || []) {
137
+ out.log(` ${chalk.yellowBright('⚠')} ${w.message}`);
138
+ for (const f of w.files) out.log(` ${chalk.yellow(f)}`);
139
+ }
136
140
  if (!m.applied.length && !m.pending.length && !m.errors.length) out.log(chalk.grey(' No migration to apply.'));
137
141
  // Grosses références : après les migrations (les tables existent), envoi puis chargement
138
142
  let references = null;
@@ -255,7 +255,7 @@ Object.assign(sheets, {
255
255
  notes: [EXIT_NOTE],
256
256
  },
257
257
  deploy: {
258
- usage: ['poad deploy [--env <name>] [--dry-run] [--allow-destructive] [--yes] [--json]'],
258
+ usage: ['poad deploy [--env <name>] [--dry-run] [--yes] [--json]'],
259
259
  text: [
260
260
  'Send the poad/ folder to an environment of the linked poad.io project, which applies its pending migrations and loads its functions, flows, API, auth and storage settings.',
261
261
  'Sent: migrations, auth, storage, functions, flows, api, reference, variables (defaults, no secret), types, credentials/manifest.json (names and types only, never values), seed.sql, config.toml (without any secret key). Never sent: poad/secrets.toml, .env files, data/, backups/, node_modules, symbolic links. If a value of poad/secrets.toml appears in a file to send, nothing is sent.',
@@ -263,7 +263,6 @@ Object.assign(sheets, {
263
263
  options: [
264
264
  ['--env <name>', 'the environment (default: the current git branch if it exists on poad.io, else main)'],
265
265
  ['--dry-run', 'poad.io says what it would do (migrations to apply), nothing changes'],
266
- ['--allow-destructive', 'allow pending migrations that drop, truncate, delete or rename (refused otherwise, with the files named)'],
267
266
  ['--yes', 'no question for production (required outside a terminal)'],
268
267
  PROJECT_OPT,
269
268
  JSON_OPT,