arcway 0.4.17 → 0.4.18

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": "arcway",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "A convention-based framework for building modular monoliths with strict domain boundaries.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { normalizePort } from '../port.js';
2
3
 
3
4
  const DEFAULTS = {
4
5
  sqliteFilename: '.build/db/arcway.db',
@@ -15,6 +16,12 @@ function resolve(config, { rootDir } = {}) {
15
16
  const db = { ...DEFAULTS, ...config.database };
16
17
  // Resolve friendly client names to actual knex driver names
17
18
  db.client = CLIENT_MAP[db.client] ?? db.client;
19
+ if (db.connection && typeof db.connection === 'object' && db.connection.port !== undefined) {
20
+ db.connection = {
21
+ ...db.connection,
22
+ port: normalizePort(db.connection.port, 'database.connection.port'),
23
+ };
24
+ }
18
25
  if (db.dir && !path.isAbsolute(db.dir)) {
19
26
  db.dir = path.resolve(rootDir, db.dir);
20
27
  }
@@ -1,4 +1,5 @@
1
1
  import { normalizeDurationDays, normalizeDurationSeconds } from '../duration.js';
2
+ import { normalizePort } from '../port.js';
2
3
 
3
4
  const DEFAULTS = {
4
5
  driver: 'console',
@@ -8,6 +9,12 @@ const DEFAULTS = {
8
9
  function resolve(config) {
9
10
  if (!config.mail) return config;
10
11
  const mail = { ...DEFAULTS, ...config.mail };
12
+ if (mail.smtp?.port !== undefined) {
13
+ mail.smtp = {
14
+ ...mail.smtp,
15
+ port: normalizePort(mail.smtp.port, 'mail.smtp.port'),
16
+ };
17
+ }
11
18
  if (mail.inbound?.imap?.pollIntervalSeconds !== undefined) {
12
19
  mail.inbound.imap.pollIntervalSeconds = normalizeDurationSeconds(
13
20
  mail.inbound.imap.pollIntervalSeconds,
@@ -1,14 +1,15 @@
1
1
  import { resolveSessionConfig } from '../../session/index.js';
2
2
 
3
3
  function resolve(config, { mode } = {}) {
4
- if (!config.session) return config;
4
+ if (config.session === false) return { ...config, session: undefined };
5
5
  const vaultSession = config.vault?.values?.session;
6
+ if (config.session == null && !vaultSession) return config;
6
7
  const sessionKeyring = config.vault?.keyring?.map((entry) => ({
7
8
  id: entry.id,
8
9
  password: entry.secrets.session,
9
10
  }));
10
11
  const sessionInput = {
11
- ...config.session,
12
+ ...(config.session ?? {}),
12
13
  password: vaultSession,
13
14
  keyring: sessionKeyring,
14
15
  };
@@ -0,0 +1,10 @@
1
+ function normalizePort(value, name) {
2
+ if (value === undefined || value === null || value === '') return value;
3
+ const port = typeof value === 'string' && /^\d+$/.test(value) ? Number(value) : value;
4
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
5
+ throw new TypeError(`Invalid config: ${name} must be an integer from 1 to 65535`);
6
+ }
7
+ return port;
8
+ }
9
+
10
+ export { normalizePort };
@@ -224,7 +224,7 @@ function getViteServerOptions(config, hmrServer) {
224
224
  const hmr = config?.pages?.vite?.hmr;
225
225
  return {
226
226
  middlewareMode: true,
227
- ...(hmr ? { hmr: { ...hmr, ...(hmrServer ? { server: hmrServer } : {}) } } : {}),
227
+ hmr: { ...hmr, server: hmrServer },
228
228
  };
229
229
  }
230
230
 
@@ -239,7 +239,7 @@ async function createViteHmrServer(log, { host = '0.0.0.0', port = 24678 } = {})
239
239
 
240
240
  async function createViteDevRouter({ rootDir, log, config }) {
241
241
  const appAliases = resolveAppAliases(rootDir);
242
- const hmrServer = config?.pages?.vite?.hmr ? await createViteHmrServer(log) : null;
242
+ const hmrServer = await createViteHmrServer(log);
243
243
  let vite;
244
244
  try {
245
245
  vite = await createViteServer({