toiljs 0.0.136 → 0.0.138

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.0.138] - 2026-10-28
4
+
5
+ - Erase historical two-factor settings and replay counters during account deletion, with bounded retryable cleanup, raw-byte release of old schemas, and generation fences that preserve session revocation across account recreation.
6
+ - Add `server.authRoutes.deleteAccount`; disabling factor setup still allows proof-backed removal of an existing factor.
7
+ - Build cold artifacts with the minimal collector and collect between resident calls on updated Node/native hosts, preserving daemon state without incremental barriers.
8
+ - Add exact `RateLimit.TrailingWindow` on Node and native hosts. Require ToilScript 0.1.67; deploy toil-backend 0.1.1 before using the new strategy or minimal cold runtime.
9
+ - Sort build-cache library listings and expose per-tier miss reasons with `TOILJS_BUILD_CACHE_DEBUG=1`.
10
+ - Correct auth/config and derive permission documentation; document native gas prices, measurement, routing, byte/write accounting, continuation polling and fresh Scylla keyspace readiness.
11
+
12
+ Validation: 808 framework tests pass with normal and strict database limits, alongside browser auth checks, both example builds/typechecks/lints, and a clean starter installation from a cached older CLI. See [the release audit](docs/release-audit-2026-10-28.md) for all sixteen report items, additional regression fixes, and verification limits.
13
+
14
+ ## [v0.0.137] - 2026-10-27
15
+
16
+ - Compile request, stream, and daemon tiers in bounded parallel processes, dividing Binaryen's CPU budget among active jobs while preserving configured optimization levels and assertions.
17
+ - Reuse unchanged server tiers after checking actual dependency contents, failed import lookups, library listings, compiler implementation, options, and output hashes. Keep dependency manifests in `.toil/compiler` without duplicating compiled artifacts.
18
+ - Stage and validate tier outputs before publishing, isolate WAT, maps, bindings, and editor declarations, drain workers after failures or cancellation, and serialize complete builds of the same project across processes.
19
+ - Skip SSR/SSG module evaluation for routes with no matching exports and skip generic email rendering when every template is an auth override. Preserve re-exported and dynamic rendering opt-ins.
20
+ - Add `TOILJS_BUILD_CACHE=0` for forced recompilation and `TOILJS_BUILD_JOBS` to limit concurrent compiler jobs. Custom transforms and extended compiler configs keep serial, uncached CLI behavior.
21
+ - On `/root/nerva-ui`, full recompilation improved from 28.6 seconds to 13.7 seconds and builds with unchanged server inputs took 2.6 seconds. All three Wasm artifacts were identical across full, cached, and forced-recompile runs. Validation includes 796 passing tests, framework build, typecheck, and lint.
22
+
3
23
  ## [v0.0.136] - 2026-10-27
4
24
 
5
25
  - Enable application server logging by default in development and keep production logs disabled unless `server.logging: true` is configured. Compile the policy into request, stream, and daemon Wasm artifacts, including edge deployments; rebuild after changing it.
@@ -4156,7 +4156,7 @@ function scaffold(name, template, features, aiTools, images) {
4156
4156
  oxlint: "^1.89.0",
4157
4157
  "oxlint-tsgolint": "^7.0.2004",
4158
4158
  prettier: "^3.9.10",
4159
- toilscript: ">=0.1.66",
4159
+ toilscript: ">=0.1.67",
4160
4160
  typescript: "^7.0.2"
4161
4161
  };
4162
4162
  for (const dep of requiredPackages(features).sort()) {
@@ -5136,7 +5136,7 @@ function checkWasmBuilt(exists) {
5136
5136
  fix: "Run your server build (toilscript) before toiljs start."
5137
5137
  };
5138
5138
  }
5139
- var RPC_TOILSCRIPT_MIN = "0.1.66";
5139
+ var RPC_TOILSCRIPT_MIN = "0.1.67";
5140
5140
  function checkRpcWiring(f) {
5141
5141
  const missing = [];
5142
5142
  if (!f.toilscriptOk) missing.push(`toilscript >=${RPC_TOILSCRIPT_MIN}`);
@@ -0,0 +1,9 @@
1
+ export interface CompilerPass {
2
+ readonly name: string;
3
+ readonly args: readonly string[];
4
+ }
5
+ export interface CompilerBuildOptions {
6
+ readonly signal?: AbortSignal;
7
+ readonly validate?: (readOutput: (file: string) => Buffer) => void;
8
+ }
9
+ export declare function runCompilerPasses(root: string, bin: string, passes: readonly CompilerPass[], finalize: () => void, options?: CompilerBuildOptions): Promise<void>;
@@ -0,0 +1,180 @@
1
+ import { spawn } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import { availableParallelism } from 'node:os';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { compilerFingerprint, compilerCacheMiss, digest, fileDigest, inputsCurrent, outputsCurrent, readCompilerManifest, standardCompilerConfig, } from './compiler-cache.js';
7
+ function runProcess(root, args, name, signal, cores) {
8
+ return new Promise((resolve, reject) => {
9
+ let failure;
10
+ const child = spawn(process.execPath, ['--enable-source-maps', ...args], {
11
+ cwd: root,
12
+ stdio: 'inherit',
13
+ signal,
14
+ env: { ...process.env, BINARYEN_CORES: process.env.BINARYEN_CORES ?? String(cores) },
15
+ });
16
+ child.on('error', (error) => {
17
+ failure = error;
18
+ if (child.pid === undefined)
19
+ reject(error);
20
+ });
21
+ child.on('close', (code) => code === 0 && !failure
22
+ ? resolve()
23
+ : reject(failure ??
24
+ new Error(`toilscript ${name} build failed (exit ${String(code)})`)));
25
+ });
26
+ }
27
+ function publish(staged, destination) {
28
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
29
+ try {
30
+ fs.renameSync(staged, destination);
31
+ }
32
+ catch (error) {
33
+ if (error.code !== 'EXDEV')
34
+ throw error;
35
+ const temporary = destination + `.toil-${process.pid}.tmp`;
36
+ try {
37
+ fs.copyFileSync(staged, temporary);
38
+ fs.renameSync(temporary, destination);
39
+ }
40
+ finally {
41
+ fs.rmSync(temporary, { force: true });
42
+ }
43
+ }
44
+ }
45
+ export async function runCompilerPasses(root, bin, passes, finalize, options = {}) {
46
+ const home = path.join(root, '.toil', 'compiler');
47
+ fs.mkdirSync(home, { recursive: true });
48
+ const work = fs.mkdtempSync(path.join(home, `pending-${process.pid}-`));
49
+ const builtWorker = fileURLToPath(new URL('./toilscript-worker.js', import.meta.url));
50
+ const worker = fs.existsSync(builtWorker) ? builtWorker : builtWorker.replace(/\.js$/, '.ts');
51
+ const standard = standardCompilerConfig(root);
52
+ const cacheable = standard && process.env.TOILJS_BUILD_CACHE !== '0';
53
+ const requested = Number(process.env.TOILJS_BUILD_JOBS ?? 3);
54
+ const jobs = Number.isInteger(requested) && requested > 0 ? requested : 3;
55
+ const cpus = availableParallelism();
56
+ const abort = new AbortController();
57
+ const cancel = () => abort.abort();
58
+ options.signal?.addEventListener('abort', cancel, { once: true });
59
+ if (options.signal?.aborted)
60
+ abort.abort();
61
+ const stop = () => {
62
+ process.exitCode = 130;
63
+ abort.abort();
64
+ };
65
+ process.once('SIGINT', stop);
66
+ process.once('SIGTERM', stop);
67
+ const completed = [];
68
+ let firstFailure;
69
+ let index = 0;
70
+ try {
71
+ if (!standard) {
72
+ for (const pass of passes)
73
+ await runProcess(root, [bin, ...pass.args], pass.name, abort.signal, cpus);
74
+ options.validate?.((file) => fs.readFileSync(path.resolve(root, file)));
75
+ finalize();
76
+ return;
77
+ }
78
+ const fingerprint = cacheable ? compilerFingerprint(bin, worker) : '';
79
+ const plans = passes.map((pass) => {
80
+ const cache = path.join(home, `${pass.name}.json`);
81
+ const key = digest(JSON.stringify({ version: 1, root, fingerprint, args: pass.args }));
82
+ const saved = cacheable ? readCompilerManifest(cache) : null;
83
+ const miss = compilerCacheMiss(saved, key);
84
+ const cached = cacheable && miss === null ? saved : null;
85
+ if (process.env.TOILJS_BUILD_CACHE_DEBUG === '1')
86
+ process.stdout.write(` server cache ${pass.name}: ${cached ? 'hit' : !cacheable ? 'disabled' : miss}\n`);
87
+ return { pass, cache, key, cached };
88
+ });
89
+ const concurrency = Math.max(1, Math.min(plans.filter((plan) => !plan.cached).length, 3, cpus, jobs));
90
+ const cores = Math.max(1, Math.floor(cpus / concurrency));
91
+ const run = async () => {
92
+ while (index < plans.length && !abort.signal.aborted) {
93
+ const { pass, cache, key, cached } = plans[index++];
94
+ if (cached) {
95
+ completed.push({ pass, manifest: cached, cache, key, reused: true });
96
+ continue;
97
+ }
98
+ const staging = path.join(work, pass.name);
99
+ try {
100
+ fs.mkdirSync(staging);
101
+ await runProcess(root, [worker, bin, staging, ...pass.args], pass.name, abort.signal, cores);
102
+ const manifest = readCompilerManifest(path.join(staging, 'manifest.json'));
103
+ if (!manifest || !inputsCurrent(manifest))
104
+ throw new Error(`Server inputs changed while compiling ${pass.name}; retry the build.`);
105
+ completed.push({ pass, manifest, cache, key, reused: false });
106
+ }
107
+ catch (error) {
108
+ if (!abort.signal.aborted)
109
+ firstFailure = { reason: error };
110
+ abort.abort();
111
+ throw error;
112
+ }
113
+ }
114
+ };
115
+ const outcomes = await Promise.allSettled(Array.from({ length: concurrency }, run));
116
+ if (firstFailure)
117
+ throw firstFailure.reason;
118
+ const failed = outcomes.find((result) => result.status === 'rejected');
119
+ if (failed?.status === 'rejected')
120
+ throw failed.reason;
121
+ if (abort.signal.aborted)
122
+ throw new Error('Server build cancelled');
123
+ if (completed.some(({ manifest }) => !inputsCurrent(manifest)))
124
+ throw new Error('Server inputs changed during compilation; retry the build.');
125
+ if (completed.some((result) => result.reused && !outputsCurrent(result.manifest)))
126
+ throw new Error('Server outputs changed during compilation; retry the build.');
127
+ const outputs = new Map();
128
+ for (const pass of passes) {
129
+ const result = completed.find((entry) => entry.pass === pass);
130
+ if (!result)
131
+ throw new Error(`Compiler pass did not finish: ${pass.name}`);
132
+ for (const output of result.manifest.outputs) {
133
+ if (standard && outputs.has(output.path))
134
+ throw new Error(`Compiler tiers share an output path: ${output.path}`);
135
+ outputs.set(output.path, output.staged ?? output.path);
136
+ }
137
+ }
138
+ options.validate?.((file) => fs.readFileSync(outputs.get(path.resolve(root, file)) ?? file));
139
+ for (const pass of passes) {
140
+ const result = completed.find((entry) => entry.pass === pass);
141
+ if (!result)
142
+ throw new Error(`Compiler pass did not finish: ${pass.name}`);
143
+ if (result.reused)
144
+ continue;
145
+ for (const output of result.manifest.outputs) {
146
+ if (!output.staged)
147
+ throw new Error(`Missing staged output: ${output.path}`);
148
+ publish(output.staged, output.path);
149
+ }
150
+ }
151
+ finalize();
152
+ if (cacheable)
153
+ for (const result of completed) {
154
+ if (result.reused)
155
+ continue;
156
+ const manifest = {
157
+ ...result.manifest,
158
+ key: result.key,
159
+ outputs: result.manifest.outputs.map((output) => {
160
+ const hash = fileDigest(output.path);
161
+ if (hash === null)
162
+ throw new Error(`Compiler output disappeared: ${output.path}`);
163
+ return { path: output.path, hash };
164
+ }),
165
+ };
166
+ const staged = path.join(work, `${result.pass.name}.json`);
167
+ fs.writeFileSync(staged, JSON.stringify(manifest));
168
+ publish(staged, result.cache);
169
+ }
170
+ const reused = completed.filter((pass) => pass.reused).map((pass) => pass.pass.name);
171
+ if (reused.length > 0)
172
+ process.stdout.write(` ✓ server unchanged: reused ${reused.join(', ')}\n`);
173
+ }
174
+ finally {
175
+ process.off('SIGINT', stop);
176
+ process.off('SIGTERM', stop);
177
+ options.signal?.removeEventListener('abort', cancel);
178
+ fs.rmSync(work, { recursive: true, force: true });
179
+ }
180
+ }
@@ -0,0 +1,29 @@
1
+ export interface CompilerInput {
2
+ readonly path: string;
3
+ readonly hash: string | null;
4
+ }
5
+ export interface CompilerDirectory {
6
+ readonly path: string;
7
+ readonly entries: readonly string[] | null;
8
+ }
9
+ export interface CompilerOutput {
10
+ readonly path: string;
11
+ readonly hash: string;
12
+ readonly staged?: string;
13
+ }
14
+ export interface CompilerManifest {
15
+ readonly key: string;
16
+ readonly inputs: readonly CompilerInput[];
17
+ readonly directories: readonly CompilerDirectory[];
18
+ readonly outputs: readonly CompilerOutput[];
19
+ readonly stable: boolean;
20
+ }
21
+ export declare function digest(value: string | Uint8Array): string;
22
+ export declare function fileDigest(file: string): string | null;
23
+ export declare function libraryEntries(dir: string): string[] | null;
24
+ export declare function inputsCurrent(manifest: CompilerManifest): boolean;
25
+ export declare function compilerCacheMiss(manifest: CompilerManifest | null, key: string): string | null;
26
+ export declare function outputsCurrent(manifest: CompilerManifest): boolean;
27
+ export declare function readCompilerManifest(file: string): CompilerManifest | null;
28
+ export declare function standardCompilerConfig(root: string): boolean;
29
+ export declare function compilerFingerprint(bin: string, worker: string): string;
@@ -0,0 +1,135 @@
1
+ import { createHash } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ export function digest(value) {
5
+ return createHash('sha256').update(value).digest('hex');
6
+ }
7
+ export function fileDigest(file) {
8
+ try {
9
+ return digest(fs.readFileSync(file));
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ }
15
+ export function libraryEntries(dir) {
16
+ try {
17
+ return fs
18
+ .readdirSync(dir)
19
+ .filter((name) => name.endsWith('.ts') && !name.endsWith('.d.ts'))
20
+ .sort();
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ export function inputsCurrent(manifest) {
27
+ return (manifest.stable &&
28
+ manifest.inputs.every((input) => fileDigest(input.path) === input.hash) &&
29
+ manifest.directories.every((dir) => JSON.stringify(libraryEntries(dir.path)) === JSON.stringify(dir.entries)));
30
+ }
31
+ export function compilerCacheMiss(manifest, key) {
32
+ if (!manifest)
33
+ return 'manifest missing or invalid';
34
+ if (manifest.key !== key)
35
+ return 'compiler, options, or build environment changed';
36
+ if (!manifest.stable)
37
+ return 'inputs changed while the previous compiler was reading them';
38
+ for (const input of manifest.inputs)
39
+ if (fileDigest(input.path) !== input.hash)
40
+ return `input changed: ${input.path}`;
41
+ for (const dir of manifest.directories)
42
+ if (JSON.stringify(libraryEntries(dir.path)) !== JSON.stringify(dir.entries))
43
+ return `library entries changed: ${dir.path}`;
44
+ if (manifest.outputs.length === 0)
45
+ return 'no recorded outputs';
46
+ for (const output of manifest.outputs)
47
+ if (fileDigest(output.path) !== output.hash)
48
+ return `output changed or missing: ${output.path}`;
49
+ return null;
50
+ }
51
+ export function outputsCurrent(manifest) {
52
+ return (manifest.outputs.length > 0 &&
53
+ manifest.outputs.every((output) => fileDigest(output.path) === output.hash));
54
+ }
55
+ export function readCompilerManifest(file) {
56
+ try {
57
+ const value = JSON.parse(fs.readFileSync(file, 'utf8'));
58
+ if (typeof value.key !== 'string' ||
59
+ typeof value.stable !== 'boolean' ||
60
+ !Array.isArray(value.inputs) ||
61
+ !Array.isArray(value.directories) ||
62
+ !Array.isArray(value.outputs))
63
+ return null;
64
+ if (!value.inputs.every((entry) => entry &&
65
+ typeof entry.path === 'string' &&
66
+ (entry.hash === null || typeof entry.hash === 'string')))
67
+ return null;
68
+ if (!value.directories.every((entry) => entry &&
69
+ typeof entry.path === 'string' &&
70
+ (entry.entries === null ||
71
+ (Array.isArray(entry.entries) &&
72
+ entry.entries.every((name) => typeof name === 'string')))))
73
+ return null;
74
+ if (!value.outputs.every((entry) => entry &&
75
+ typeof entry.path === 'string' &&
76
+ typeof entry.hash === 'string' &&
77
+ (entry.staged === undefined || typeof entry.staged === 'string')))
78
+ return null;
79
+ return value;
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ }
85
+ export function standardCompilerConfig(root) {
86
+ const inspect = (value) => {
87
+ if (Array.isArray(value))
88
+ return value.every(inspect);
89
+ if (value === null || typeof value !== 'object')
90
+ return true;
91
+ return Object.entries(value).every(([key, entry]) => {
92
+ if ((key === 'transform' || key === 'extends') &&
93
+ entry &&
94
+ (!Array.isArray(entry) || entry.length > 0))
95
+ return false;
96
+ return inspect(entry);
97
+ });
98
+ };
99
+ try {
100
+ return inspect(JSON.parse(fs.readFileSync(path.join(root, 'toilconfig.json'), 'utf8')));
101
+ }
102
+ catch {
103
+ return false;
104
+ }
105
+ }
106
+ export function compilerFingerprint(bin, worker) {
107
+ const hash = createHash('sha256');
108
+ const compiler = path.resolve(path.dirname(bin), '..');
109
+ const visit = (file) => {
110
+ const stat = fs.statSync(file);
111
+ if (stat.isDirectory()) {
112
+ for (const entry of fs.readdirSync(file).sort()) {
113
+ if (entry !== 'node_modules' && !entry.endsWith('.map'))
114
+ visit(path.join(file, entry));
115
+ }
116
+ }
117
+ else {
118
+ hash.update(file).update('\0').update(fs.readFileSync(file)).update('\0');
119
+ }
120
+ };
121
+ visit(worker);
122
+ for (const name of ['compiler-cache', 'compiler-build'])
123
+ visit(path.join(path.dirname(worker), name + path.extname(worker)));
124
+ for (const dir of ['bin', 'dist', 'lib', 'util']) {
125
+ const full = path.join(compiler, dir);
126
+ if (fs.existsSync(full))
127
+ visit(full);
128
+ }
129
+ visit(path.join(compiler, 'package.json'));
130
+ hash.update(process.version).update(JSON.stringify({
131
+ NODE_OPTIONS: process.env.NODE_OPTIONS,
132
+ BINARYEN_CORES: process.env.BINARYEN_CORES,
133
+ }));
134
+ return hash.digest('hex');
135
+ }
@@ -0,0 +1 @@
1
+ export declare function withCompilerLock<T>(root: string, work: () => Promise<T>): Promise<T>;
@@ -0,0 +1,99 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { setTimeout } from 'node:timers/promises';
5
+ const queues = new Map();
6
+ function owner(file) {
7
+ try {
8
+ const value = JSON.parse(fs.readFileSync(file, 'utf8'));
9
+ return Number.isSafeInteger(value.pid) && value.pid > 0 && typeof value.token === 'string'
10
+ ? value
11
+ : null;
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ }
17
+ function alive(pid) {
18
+ try {
19
+ process.kill(pid, 0);
20
+ return true;
21
+ }
22
+ catch (error) {
23
+ return error.code !== 'ESRCH';
24
+ }
25
+ }
26
+ export async function withCompilerLock(root, work) {
27
+ const canonical = fs.realpathSync(root);
28
+ const previous = queues.get(canonical) ?? Promise.resolve();
29
+ const next = Promise.withResolvers();
30
+ queues.set(canonical, next.promise);
31
+ await previous;
32
+ const dir = path.join(canonical, '.toil', 'compiler');
33
+ const lock = path.join(dir, 'lock');
34
+ const token = randomUUID();
35
+ let acquired = false;
36
+ try {
37
+ fs.mkdirSync(dir, { recursive: true });
38
+ const deadline = Date.now() + 300_000;
39
+ while (!acquired) {
40
+ try {
41
+ const fd = fs.openSync(lock, 'wx');
42
+ acquired = true;
43
+ try {
44
+ fs.writeFileSync(fd, JSON.stringify({ pid: process.pid, token }));
45
+ }
46
+ finally {
47
+ fs.closeSync(fd);
48
+ }
49
+ }
50
+ catch (error) {
51
+ if (error.code !== 'EEXIST')
52
+ throw error;
53
+ const stale = owner(lock);
54
+ if (stale && !alive(stale.pid)) {
55
+ const reaper = lock + '.reaping';
56
+ let fd;
57
+ try {
58
+ fd = fs.openSync(reaper, 'wx');
59
+ const current = owner(lock);
60
+ if (current?.token === stale.token && !alive(current.pid))
61
+ fs.unlinkSync(lock);
62
+ }
63
+ catch (failure) {
64
+ if (failure.code !== 'EEXIST' &&
65
+ failure.code !== 'ENOENT')
66
+ throw failure;
67
+ }
68
+ finally {
69
+ if (fd !== undefined) {
70
+ fs.closeSync(fd);
71
+ fs.rmSync(reaper, { force: true });
72
+ }
73
+ }
74
+ }
75
+ if (Date.now() >= deadline)
76
+ throw new Error(`Another server build holds ${lock}. Check its process before removing a stale lock.`, { cause: error });
77
+ await setTimeout(50);
78
+ }
79
+ }
80
+ for (const entry of fs.readdirSync(dir)) {
81
+ const match = /^pending-(\d+)-/.exec(entry);
82
+ if (match && !alive(Number(match[1])))
83
+ fs.rmSync(path.join(dir, entry), { recursive: true, force: true });
84
+ }
85
+ return await work();
86
+ }
87
+ finally {
88
+ try {
89
+ const recorded = acquired ? owner(lock) : null;
90
+ if (acquired && (recorded === null || recorded.token === token))
91
+ fs.rmSync(lock, { force: true });
92
+ }
93
+ finally {
94
+ next.resolve(undefined);
95
+ if (queues.get(canonical) === next.promise)
96
+ queues.delete(canonical);
97
+ }
98
+ }
99
+ }
@@ -46,6 +46,7 @@ export interface DaemonConfig {
46
46
  export interface AuthRoutesConfig {
47
47
  readonly google?: boolean;
48
48
  readonly twoFactorSetup?: boolean;
49
+ readonly deleteAccount?: boolean;
49
50
  }
50
51
  export interface ServerConfig {
51
52
  readonly logging?: boolean;
@@ -41,9 +41,9 @@ export async function loadConfig(opts = {}) {
41
41
  if (typeof authRoutes !== 'object' || Array.isArray(authRoutes))
42
42
  throw new Error('server.authRoutes must be an object');
43
43
  for (const key of Object.keys(authRoutes)) {
44
- if (!['google', 'twoFactorSetup'].includes(key) ||
44
+ if (!['google', 'twoFactorSetup', 'deleteAccount'].includes(key) ||
45
45
  typeof authRoutes[key] !== 'boolean')
46
- throw new Error('server.authRoutes accepts only boolean google and twoFactorSetup settings');
46
+ throw new Error('server.authRoutes accepts only boolean google, twoFactorSetup and deleteAccount settings');
47
47
  }
48
48
  if (client.coop !== undefined &&
49
49
  !['same-origin', 'same-origin-allow-popups'].includes(client.coop))
@@ -201,6 +201,8 @@ export async function renderEmails(cfg, authOn = false) {
201
201
  const files = fs
202
202
  .readdirSync(emailsDir)
203
203
  .filter((f) => /\.(tsx|jsx)$/.test(f))
204
+ .filter((f) => !authOn ||
205
+ !RESERVED_AUTH_EMAIL_NAMES.has(toPascal(path.basename(f).replace(/\.(tsx|jsx)$/, ''))))
204
206
  .sort();
205
207
  if (files.length === 0) {
206
208
  if (fs.existsSync(generatedPath))
@@ -217,9 +219,6 @@ export async function renderEmails(cfg, authOn = false) {
217
219
  const rendered = [];
218
220
  try {
219
221
  for (const file of files) {
220
- if (authOn &&
221
- RESERVED_AUTH_EMAIL_NAMES.has(toPascal(path.basename(file).replace(/\.(tsx|jsx)$/, ''))))
222
- continue;
223
222
  try {
224
223
  const r = await renderEmailFile(server, emailsDir, file, renderToStaticMarkup);
225
224
  if (r)