@wpmoo/toolkit 0.9.13 → 0.9.15

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/doctor.js CHANGED
@@ -195,6 +195,13 @@ function postgresConnectionUtilizationWarning(diagnostics) {
195
195
  }
196
196
  return `PostgreSQL connection utilization is high: ${utilizationPct}% of max_connections used (${connectionCount}/${maxConnections}).`;
197
197
  }
198
+ function postgresSlowQueryLoggingWarning(diagnostics) {
199
+ const slowQueryLogging = diagnostics.slow_query_logging?.trim();
200
+ if (!slowQueryLogging || !/^-1\s*(?:ms)?$/iu.test(slowQueryLogging)) {
201
+ return undefined;
202
+ }
203
+ return `PostgreSQL slow-query logging is disabled (log_min_duration_statement=${slowQueryLogging}). Enable it before performance triage.`;
204
+ }
198
205
  function structuredPostgresDiagnostics(diagnostics) {
199
206
  const structured = {};
200
207
  const databaseCount = integerDiagnostic(diagnostics.database_count);
@@ -637,6 +644,10 @@ export async function getDoctorReport(target = process.cwd(), runnerOrOptions =
637
644
  if (connectionUtilizationWarning) {
638
645
  warnings.push(connectionUtilizationWarning);
639
646
  }
647
+ const slowQueryLoggingWarning = postgresSlowQueryLoggingWarning(postgresDiagnostics);
648
+ if (slowQueryLoggingWarning) {
649
+ warnings.push(slowQueryLoggingWarning);
650
+ }
640
651
  }
641
652
  else {
642
653
  const warning = malformedKeys.length > 0
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import { addModuleToSourceRepoInAddonsYaml, removeModuleFromSourceRepoInAddonsYaml, } from './addons-yaml.js';
4
4
  import { readEnvironmentMetadata, replaceSourceRepos } from './environment.js';
5
5
  import { realGit, stageAll } from './git.js';
6
+ import { supportedOdooVersions } from './odoo-versions.js';
6
7
  import { pathUnderBase, validateModuleName, validateRepoPath } from './path-validation.js';
7
8
  import { listModuleRepos, readAddonsYaml, writeAddonsYaml } from './repo-actions.js';
8
9
  import { listSources } from './source-actions.js';
@@ -29,6 +30,13 @@ function deriveRepoSlug(repoUrl) {
29
30
  function normalizeSourceType(value) {
30
31
  return validSourceTypes.includes(value) ? value : 'private';
31
32
  }
33
+ function validateSupportedOdooVersion(value) {
34
+ const normalized = value.trim();
35
+ if (supportedOdooVersions.includes(normalized)) {
36
+ return normalized;
37
+ }
38
+ throw new Error(`Unsupported Odoo version for generated module scaffolding: ${value}. Supported versions: ${supportedOdooVersions.join(', ')}.`);
39
+ }
32
40
  function sourceRepoPath(target, sourceType, repoPath) {
33
41
  return pathUnderBase(join(target, `odoo/custom/src/${sourceType}`), repoPath, 'repo path');
34
42
  }
@@ -228,6 +236,7 @@ async function updateModuleRegistration(target, sourceType, repoPath, moduleName
228
236
  export async function addModuleToSourceRepo(options, git = realGit) {
229
237
  const repoPath = validateRepoPath(options.repoPath);
230
238
  const moduleName = validateModuleName(options.moduleName);
239
+ const odooVersion = validateSupportedOdooVersion(options.odooVersion);
231
240
  const sourceType = normalizeSourceType(options.sourceType);
232
241
  const destination = modulePath(options.target, sourceType, repoPath, moduleName);
233
242
  await mkdir(join(destination, 'models'), { recursive: true });
@@ -235,14 +244,14 @@ export async function addModuleToSourceRepo(options, git = realGit) {
235
244
  await mkdir(join(destination, 'tests'), { recursive: true });
236
245
  await mkdir(join(destination, 'views'), { recursive: true });
237
246
  await writeIfMissing(join(destination, '__init__.py'), 'from . import models\n');
238
- await writeIfMissing(join(destination, '__manifest__.py'), manifestContent(moduleName, options.odooVersion));
247
+ await writeIfMissing(join(destination, '__manifest__.py'), manifestContent(moduleName, odooVersion));
239
248
  await writeIfMissing(join(destination, 'models/__init__.py'), `from . import ${moduleName}\n`);
240
249
  await writeIfMissing(join(destination, `models/${moduleName}.py`), modelContent(moduleName));
241
250
  await writeIfMissing(join(destination, 'tests/__init__.py'), testInitContent(moduleName));
242
251
  await writeIfMissing(join(destination, `tests/test_${moduleName}.py`), testContent(moduleName));
243
252
  await writeIfMissing(join(destination, 'security/ir.model.access.csv'), accessCsvContent(moduleName));
244
- await writeIfMissing(join(destination, `views/${moduleName}_views.xml`), viewXmlContent(moduleName, options.odooVersion));
245
- await writeIfMissing(join(destination, `views/${moduleName}_menus.xml`), menuXmlContent(moduleName, options.odooVersion));
253
+ await writeIfMissing(join(destination, `views/${moduleName}_views.xml`), viewXmlContent(moduleName, odooVersion));
254
+ await writeIfMissing(join(destination, `views/${moduleName}_menus.xml`), menuXmlContent(moduleName, odooVersion));
246
255
  await writeIfMissing(join(destination, 'views/.gitkeep'), '');
247
256
  if (sourceType === 'private' && (await usesAddonsYaml(options.target))) {
248
257
  const addonsYaml = await readAddonsYaml(options.target);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpmoo/toolkit",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
4
4
  "description": "WPMoo Toolkit for development, staging, and production lifecycle workflows.",
5
5
  "type": "module",
6
6
  "repository": {