@mistriwork/engine 1.0.0-rc.68 → 1.0.0-rc.70

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.
@@ -21,6 +21,50 @@ import { RUNTIME_TABLE_PREFIXES } from '../shared/runtimeTables.js';
21
21
  import { onCancel, StatementStopped } from './statementControl.js';
22
22
  /* How long the child may take to start before the statement's own cap. */
23
23
  const STARTUP_MS = 10_000;
24
+ /* Bound concurrent child Node processes so a burst of slow SQLite reads cannot
25
+ fork-bomb the host; extra requests wait briefly in a bounded queue. */
26
+ const MAX_CONCURRENT_PROCESSES = 4;
27
+ const MAX_QUEUED_PROCESSES = 32;
28
+ let activeProcesses = 0;
29
+ const processQueue = [];
30
+ function acquireProcessSlot(signal, capMs) {
31
+ if (signal.aborted)
32
+ return Promise.reject(new StatementStopped('cancelled'));
33
+ const release = () => {
34
+ activeProcesses -= 1;
35
+ const next = processQueue.shift();
36
+ if (next)
37
+ next();
38
+ };
39
+ if (activeProcesses < MAX_CONCURRENT_PROCESSES) {
40
+ activeProcesses += 1;
41
+ return Promise.resolve(release);
42
+ }
43
+ if (processQueue.length >= MAX_QUEUED_PROCESSES) {
44
+ return Promise.reject(new StatementStopped('timeout', capMs));
45
+ }
46
+ return new Promise((resolve, reject) => {
47
+ let settled = false;
48
+ const wake = () => {
49
+ if (settled)
50
+ return;
51
+ settled = true;
52
+ disarm();
53
+ activeProcesses += 1;
54
+ resolve(release);
55
+ };
56
+ const disarm = onCancel(signal, () => {
57
+ if (settled)
58
+ return;
59
+ settled = true;
60
+ const idx = processQueue.indexOf(wake);
61
+ if (idx !== -1)
62
+ processQueue.splice(idx, 1);
63
+ reject(new StatementStopped('cancelled'));
64
+ });
65
+ processQueue.push(wake);
66
+ });
67
+ }
24
68
  /* The child. SQLITE_OK and SQLITE_READ are the C API's authorizer codes. The
25
69
  rows stop one past the limit, so an unwrapped statement is not read whole
26
70
  to learn that there was more. */
@@ -75,57 +119,63 @@ process.send({ ready: true });
75
119
  * `signal` aborts. The engine's own errors come back as errors with the
76
120
  * engine's words, as they would in-process.
77
121
  */
78
- export function runInStatementProcess(job, capMs, signal) {
79
- return new Promise((resolve, reject) => {
80
- if (signal.aborted) {
81
- reject(new StatementStopped('cancelled'));
82
- return;
83
- }
84
- const child = spawn(process.execPath, ['-e', CHILD], {
85
- stdio: ['ignore', 'ignore', 'pipe', 'ipc'],
86
- serialization: 'advanced',
87
- /* Electron's binary is Node only when told so; plain Node ignores it. */
88
- env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' },
89
- windowsHide: true,
90
- });
91
- let stderr = '';
92
- child.stderr?.on('data', (chunk) => {
93
- stderr = (stderr + chunk.toString()).slice(-2_000);
94
- });
95
- let settled = false;
96
- let timer;
97
- let disarm = () => { };
98
- const settle = (outcome) => {
99
- if (settled)
100
- return;
101
- settled = true;
102
- clearTimeout(timer);
103
- disarm();
104
- outcome();
105
- };
106
- const stop = (reason) => settle(() => {
107
- child.kill('SIGKILL');
108
- reject(new StatementStopped(reason, capMs));
109
- });
110
- timer = setTimeout(() => stop('timeout'), STARTUP_MS + capMs);
111
- disarm = onCancel(signal, () => stop('cancelled'));
112
- child.on('message', (message) => {
113
- if (message.ready) {
114
- /* The cap is the statement's, not the process start's. */
115
- clearTimeout(timer);
116
- timer = setTimeout(() => stop('timeout'), capMs);
117
- child.send({ ...job, prefixes: RUNTIME_TABLE_PREFIXES });
122
+ export async function runInStatementProcess(job, capMs, signal) {
123
+ const releaseSlot = await acquireProcessSlot(signal, capMs);
124
+ try {
125
+ return await new Promise((resolve, reject) => {
126
+ if (signal.aborted) {
127
+ reject(new StatementStopped('cancelled'));
118
128
  return;
119
129
  }
120
- settle(() => {
121
- if (message.error !== undefined)
122
- reject(new Error(message.error));
123
- else
124
- resolve(message);
130
+ const child = spawn(process.execPath, ['-e', CHILD], {
131
+ stdio: ['ignore', 'ignore', 'pipe', 'ipc'],
132
+ serialization: 'advanced',
133
+ /* Electron's binary is Node only when told so; plain Node ignores it. */
134
+ env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' },
135
+ windowsHide: true,
136
+ });
137
+ let stderr = '';
138
+ child.stderr?.on('data', (chunk) => {
139
+ stderr = (stderr + chunk.toString()).slice(-2_000);
140
+ });
141
+ let settled = false;
142
+ let timer;
143
+ let disarm = () => { };
144
+ const settle = (outcome) => {
145
+ if (settled)
146
+ return;
147
+ settled = true;
148
+ clearTimeout(timer);
149
+ disarm();
150
+ outcome();
151
+ };
152
+ const stop = (reason) => settle(() => {
153
+ child.kill('SIGKILL');
154
+ reject(new StatementStopped(reason, capMs));
125
155
  });
156
+ timer = setTimeout(() => stop('timeout'), STARTUP_MS + capMs);
157
+ disarm = onCancel(signal, () => stop('cancelled'));
158
+ child.on('message', (message) => {
159
+ if (message.ready) {
160
+ /* The cap is the statement's, not the process start's. */
161
+ clearTimeout(timer);
162
+ timer = setTimeout(() => stop('timeout'), capMs);
163
+ child.send({ ...job, prefixes: RUNTIME_TABLE_PREFIXES });
164
+ return;
165
+ }
166
+ settle(() => {
167
+ if (message.error !== undefined)
168
+ reject(new Error(message.error));
169
+ else
170
+ resolve(message);
171
+ });
172
+ });
173
+ child.once('error', (error) => settle(() => reject(error)));
174
+ child.once('exit', (code, killedBy) => settle(() => reject(new Error(`The SQLite statement process ended without an answer (${killedBy ?? `exit ${code}`}).` +
175
+ (stderr.trim() ? ` ${stderr.trim()}` : '')))));
126
176
  });
127
- child.once('error', (error) => settle(() => reject(error)));
128
- child.once('exit', (code, killedBy) => settle(() => reject(new Error(`The SQLite statement process ended without an answer (${killedBy ?? `exit ${code}`}).` +
129
- (stderr.trim() ? ` ${stderr.trim()}` : '')))));
130
- });
177
+ }
178
+ finally {
179
+ releaseSlot();
180
+ }
131
181
  }
@@ -62,6 +62,7 @@ export function shellPolicy(html, { fromSource = false, socket } = {}) {
62
62
  origin, typed by the page, never a URL a column names. */
63
63
  "frame-src 'self' blob:",
64
64
  "base-uri 'none'",
65
+ "form-action 'self'",
65
66
  "frame-ancestors 'self'",
66
67
  /* From source only: Vite's client, when its hot-reload socket drops,
67
68
  waits for the server in a shared worker it makes from a blob. The
@@ -488,8 +489,11 @@ export async function serveClient(files, req, res, shell) {
488
489
  const raw = await readFile(join(files.source, 'index.html'), 'utf8');
489
490
  const data = await pageData(shell, head);
490
491
  const pane = head ? undefined : await drawnPane(shell, data);
492
+ /* Hash only the static template's inline scripts before dynamic
493
+ head, pane or data blocks are spliced in. */
494
+ const template = await vite.transformIndexHtml(sourceURL, raw);
491
495
  /* No built files to preload from source; an App theme's own faces are the App's, and are said as in a build. */
492
- const html = withData(withPane(withHead(withLooks(await vite.transformIndexHtml(sourceURL, raw), shell, []), shell), pane), data);
496
+ const html = withData(withPane(withHead(withLooks(template, shell, []), shell), pane), data);
493
497
  if (res.destroyed || res.writableEnded)
494
498
  return;
495
499
  res.writeHead(200, {
@@ -497,7 +501,7 @@ export async function serveClient(files, req, res, shell) {
497
501
  'cache-control': pageCache(data, shell),
498
502
  ...(data || shell?.branding?.private ? { vary: 'Cookie' } : {}),
499
503
  'x-content-type-options': 'nosniff',
500
- 'content-security-policy': pagePolicy(shellPolicy(html, { fromSource: true, socket: vite.socket }), shell),
504
+ 'content-security-policy': pagePolicy(shellPolicy(template, { fromSource: true, socket: vite.socket }), shell),
501
505
  ...pagePermissions(shell),
502
506
  });
503
507
  res.end(head ? undefined : html);
@@ -671,7 +675,7 @@ export function builtClient(dir) {
671
675
  vary: asset.variants.length > 1 ? 'Accept-Encoding, Cookie' : 'Cookie',
672
676
  ...(asset.policy
673
677
  ? {
674
- 'content-security-policy': pagePolicy(shell.mount?.base ? shellPolicy(text) : asset.policy, shell),
678
+ 'content-security-policy': pagePolicy(asset.policy, shell),
675
679
  ...pagePermissions(shell),
676
680
  }
677
681
  : {}),
@@ -700,7 +704,7 @@ export function builtClient(dir) {
700
704
  'x-content-type-options': 'nosniff',
701
705
  ...(asset.policy
702
706
  ? {
703
- 'content-security-policy': pagePolicy(shell?.mount?.base ? shellPolicy(text) : asset.policy, shell),
707
+ 'content-security-policy': pagePolicy(asset.policy, shell),
704
708
  ...pagePermissions(shell),
705
709
  }
706
710
  : {}),
@@ -429,6 +429,8 @@ export function resourceChecks(full, access) {
429
429
  assertFields(request.table, columns, 'read', server);
430
430
  for (const order of request.orderBy ?? [])
431
431
  assertFields(request.table, [order.column], 'read', server);
432
+ if (request.lanes)
433
+ assertFields(request.table, [request.lanes.by], 'read', server);
432
434
  return { ...request, columns, filter: filterFor(request.table, request.filter, server) };
433
435
  };
434
436
  /* An aggregate reads the columns it keys and measures by, and its where's, as a query reads its own. */
@@ -542,6 +544,8 @@ export function resourceChecks(full, access) {
542
544
  assertExpressions(view.base, view.expressions, view.computed);
543
545
  assertTags(view.tagged);
544
546
  assertAnyRows(view.filter);
547
+ if (view.lanes)
548
+ assertFields(view.base, [view.lanes.by]);
545
549
  // Validate against the pruned graph before the underlying full catalog can
546
550
  // resolve a forbidden forward path, filter, sort or reverse aggregate.
547
551
  const compiled = compileView(schema, view, ANSI_STYLE);
@@ -17,7 +17,7 @@ import type { DatabaseSchema } from '../../shared/schema.js';
17
17
  import type { QueryPerson } from '../../shared/query.js';
18
18
  import type { ColumnGrant } from '../columnGrants.js';
19
19
  import type { RequestDiagnostics } from '../operations/diagnostics.js';
20
- import type { Bound } from './trust.js';
20
+ import type { Bound, ProxyRange } from './trust.js';
21
21
  /**
22
22
  * The App framework's types for what a request carries on its behalf: the
23
23
  * Apps it serves, an App's resources and its reader's grants, its commands,
@@ -190,5 +190,7 @@ export interface PostContext {
190
190
  readonly appHost?: HostedApp;
191
191
  /** Who `me` is in an App's conditions, read through this request's reader (server/app/appMe.ts). */
192
192
  readonly me?: () => Promise<QueryPerson>;
193
+ /** `--trust-proxy` ranges, for keying anonymous exports by forwarded client address. */
194
+ readonly trustedProxies?: readonly ProxyRange[];
193
195
  }
194
196
  export {};
@@ -75,6 +75,7 @@ export async function postData(ctx, hooks) {
75
75
  rowPolicy: Boolean(ctx.policyContext),
76
76
  appConfigured,
77
77
  appNow: clockNow,
78
+ ...(ctx.bound.trustedProxies ? { trustedProxies: ctx.bound.trustedProxies } : {}),
78
79
  ...hooks.extras?.(ctx, source, reads),
79
80
  }, hooks);
80
81
  };
@@ -51,6 +51,7 @@ import type { Adapter } from '../../adapters/adapter.js';
51
51
  import { parseQuery } from '../../shared/query.js';
52
52
  import { type DatabaseSchema } from '../../shared/schema.js';
53
53
  import type { PostContext } from './context.js';
54
+ import { type ProxyRange } from './trust.js';
54
55
  /** Rows read per statement, and so the most the server holds of a file at once:
55
56
  * large enough that a million-row file is a thousand reads, small enough that
56
57
  * one batch is never a memory event. */
@@ -90,6 +91,8 @@ interface ExportAsked {
90
91
  answer?: (status: number, body: unknown) => void;
91
92
  /** Who is exporting, counted against `EXPORTS_IN_FLIGHT`; the client's address where no one is named. */
92
93
  who?: string;
94
+ /** `--trust-proxy` ranges, for resolving the client address behind a reverse proxy when `who` is unset. */
95
+ trustedProxies?: readonly ProxyRange[];
93
96
  }
94
97
  export declare function exportRoute(post: PostContext, hooks: ExportHooks): Promise<boolean>;
95
98
  /**
@@ -8,6 +8,7 @@ import { CRLF, csvField, csvRecord, jsonRecord } from '../../shared/csv.js';
8
8
  import { readRecords, readView } from '../resourceReadOperations.js';
9
9
  import { recordsPaging, settlePage, viewPaging } from '../keysetReadHttp.js';
10
10
  import { acceptedEncoding, httpRead, policyResponses, send } from './reply.js';
11
+ import { forwardedClient } from './trust.js';
11
12
  import { rollupReads } from '../../shared/rollups.js';
12
13
  const EXPORT_PATH = '/api/export';
13
14
  /** Rows read per statement, and so the most the server holds of a file at once:
@@ -38,6 +39,7 @@ export async function exportRoute(post, hooks) {
38
39
  now: post.appNow,
39
40
  may: hooks.may(post),
40
41
  ...(post.who ? { who: post.who } : {}),
42
+ ...(post.trustedProxies ? { trustedProxies: post.trustedProxies } : {}),
41
43
  ...(person ? { person: (text) => person(post, text) } : {}),
42
44
  ...(amounts ? { amounts: (tableId) => amounts(post, tableId) } : {}),
43
45
  });
@@ -66,7 +68,7 @@ export async function exportFile(asked) {
66
68
  return undefined;
67
69
  }
68
70
  /* Counted until the response closes, whichever way it ends: a refusal, the file, or a client that left. */
69
- const who = asked.who ?? `address:${res.req?.socket?.remoteAddress ?? ''}`;
71
+ const who = asked.who ?? `address:${res.req ? forwardedClient(res.req, asked.trustedProxies) : ''}`;
70
72
  const running = inFlight.get(who) ?? 0;
71
73
  if (running >= EXPORTS_IN_FLIGHT) {
72
74
  answer(429, { code: 'too_many_exports', error: `At most ${EXPORTS_IN_FLIGHT} exports run at once. Wait for one to finish.` });
@@ -232,10 +232,12 @@ export class SharedWindowLimiter {
232
232
  this.fallback.reset();
233
233
  }
234
234
  async count(windows, key, weight) {
235
+ const replies = await Promise.all(windows.map((window, i) => this.cache.incr(`${key}:${i}`, window.ms, weight)));
235
236
  let wait = 0;
236
237
  let remaining = Infinity;
237
- for (const [i, window] of windows.entries()) {
238
- const { count, ttlMs } = await this.cache.incr(`${key}:${i}`, window.ms, weight);
238
+ for (let i = 0; i < windows.length; i++) {
239
+ const { count, ttlMs } = replies[i];
240
+ const window = windows[i];
239
241
  if (count > window.limit)
240
242
  wait = Math.max(wait, Math.max(1, Math.ceil(ttlMs / 1000)));
241
243
  else
@@ -127,20 +127,6 @@ export declare function forwardedClient(req: {
127
127
  remoteAddress?: string;
128
128
  };
129
129
  }, trusted?: readonly ProxyRange[]): string;
130
- /**
131
- * Who is asking, when the operator has said which header carries it.
132
- *
133
- * `--auth-proxy-header X-Forwarded-User` means a proxy in front signs
134
- * people in and writes the result into that header on the way through.
135
- * A request without it did not come through the proxy — or came through
136
- * one that is misconfigured — and is refused with the header named. So is
137
- * a request that carries it from a peer that is not the proxy: the header
138
- * is only a name anyone can type, so a value from an address neither on
139
- * loopback nor in `--auth-proxy-from` is a forgery, not a sign-in. Loopback is
140
- * exempt: the container's own health check, a curl on the box, the
141
- * operator's terminal. Nothing here is authentication; it is the proxy's
142
- * decision, carried to the journal.
143
- */
144
130
  export declare function identityFor(req: {
145
131
  headers: Record<string, string | string[] | undefined>;
146
132
  socket?: {
@@ -279,11 +279,18 @@ function forwardedHops(raw) {
279
279
  * one that is misconfigured — and is refused with the header named. So is
280
280
  * a request that carries it from a peer that is not the proxy: the header
281
281
  * is only a name anyone can type, so a value from an address neither on
282
- * loopback nor in `--auth-proxy-from` is a forgery, not a sign-in. Loopback is
283
- * exempt: the container's own health check, a curl on the box, the
284
- * operator's terminal. Nothing here is authentication; it is the proxy's
285
- * decision, carried to the journal.
282
+ * loopback nor in `--auth-proxy-from` is a forgery, not a sign-in.
283
+ *
284
+ * A request from a loopback peer with no identity is the local operator
285
+ * (`who: 'local'`: the container's health check, a curl on the box, the
286
+ * operator's terminal) only when nothing says it was proxied. It is
287
+ * refused like any other when the listener has `--trust-proxy` addresses,
288
+ * the request carries a Forwarded or X-Forwarded-* header, or its Host is
289
+ * not a loopback name: a reverse proxy on the same host that dropped the
290
+ * identity header must not be mistaken for the operator. Nothing here is
291
+ * authentication; it is the proxy's decision, carried to the journal.
286
292
  */
293
+ const PROXIED_HEADERS = ['forwarded', 'x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto'];
287
294
  export function identityFor(req, bound) {
288
295
  if (!bound.identityHeader)
289
296
  return {};
@@ -292,7 +299,16 @@ export function identityFor(req, bound) {
292
299
  const peer = req.socket?.remoteAddress;
293
300
  if (who && trustedProxyPeer(peer, bound.identityProxies))
294
301
  return { who };
295
- if (loopbackPeer(peer))
302
+ /* A request arriving over loopback from a reverse proxy (nginx/Caddy on the
303
+ same host) carries forwarded headers or a non-loopback Host, or arrives on
304
+ a listener configured with --trust-proxy. Never silently treat a proxied
305
+ request that dropped the identity header as the local operator. */
306
+ const rawHost = req.headers.host;
307
+ const host = (Array.isArray(rawHost) ? rawHost[0] : rawHost)?.trim();
308
+ const proxied = Boolean(bound.trustedProxies?.length) ||
309
+ PROXIED_HEADERS.some((header) => req.headers[header] !== undefined) ||
310
+ Boolean(host && !LOOPBACK.test(host));
311
+ if (loopbackPeer(peer) && !proxied)
296
312
  return { who: 'local' };
297
313
  return {
298
314
  refusal: who
@@ -334,9 +350,9 @@ export function untrustedTargetRefusal(target) {
334
350
  return ('This server is reachable beyond this machine, so a connection added from the browser cannot ' +
335
351
  'reference environment variables. Put it in the config file on the server, or type the password.');
336
352
  }
337
- if (!/^[a-z][\w+.-]*:\/\//i.test(target) || /^sqlite:/i.test(target)) {
338
- return ('This server is reachable beyond this machine, so the browser cannot open a SQLite file by ' +
339
- 'path. Name the file in the config file or on the command line.');
353
+ if (!/^postgres(ql)?:\/\//i.test(target)) {
354
+ return ('This server is reachable beyond this machine, so the browser can only add a PostgreSQL connection ' +
355
+ '(postgres://…), never a SQLite file or other scheme. Name a SQLite file in the config file or on the command line.');
340
356
  }
341
357
  return untrustedDatabaseRefusal(target);
342
358
  }
@@ -1,11 +1,13 @@
1
1
  /**
2
- * The fixed words the platform says on an App's command and public forms, which the App's own catalog may say instead
2
+ * The fixed words the platform says on an App's command and public forms, its status check and a capability link's
3
+ * page, which the App's own catalog may say instead
3
4
  * (`messages/<locale>.ts`, a `mistri.*` key). Without them an App translated into Spanish still said "Step 2 of 3",
4
5
  * "Back" and "(optional)" in English around its own words. Each key's English is what the platform says when the
5
6
  * App's catalog has no word for it in the reader's language, so a key is opt-in and an App without one changes
6
7
  * nothing. The server checks an App's `mistri.*` keys against this table (server/app/appMessages.ts readCatalogs)
7
8
  * and serves the ones it has, in the reader's words, as plain `{name}` templates (`words`); the client says them in
8
- * place of its own (`appWord`, kit client/messages.ts).
9
+ * place of its own (`appWord`, kit client/messages.ts); the link page is drawn on the server from the same words.
10
+ * The platform says each in Spanish too (frameworkWordsEs.ts).
9
11
  */
10
12
  export declare const FRAMEWORK_WORDS: {
11
13
  readonly 'mistri.form.step': 'Step {step} of {count}';
@@ -53,6 +55,68 @@ export declare const FRAMEWORK_WORDS: {
53
55
  readonly 'mistri.status.sentText': 'We sent a code by text message.';
54
56
  readonly 'mistri.status.codeEmail': 'Code from the email';
55
57
  readonly 'mistri.status.codeText': 'Code from the message';
58
+ readonly 'mistri.status.sendAnother': 'Send another code';
59
+ readonly 'mistri.status.signIn': 'Sign in';
60
+ readonly 'mistri.status.moreDetails': 'More details';
61
+ readonly 'mistri.status.showDetails': 'Show details';
62
+ readonly 'mistri.status.confirmAccountEmail': 'Confirm your account’s email with the link we sent you, and applications submitted with it are found here.';
63
+ readonly 'mistri.status.added': 'Added to your account, submitted with your email: {linked}.';
64
+ readonly 'mistri.status.foundOne': 'We found 1 application submitted with this email — is this yours?';
65
+ readonly 'mistri.status.foundMany': 'We found {openCount} applications submitted with this email — are these yours?';
66
+ readonly 'mistri.status.sayYesToOne': 'Say yes only to one you made: it is added to your account, where its status is shown.';
67
+ readonly 'mistri.status.mine': 'Yes, it’s mine';
68
+ readonly 'mistri.status.reference': 'Reference';
69
+ readonly 'mistri.status.enter': 'Enter your {label}.';
70
+ readonly 'mistri.status.nowInAccount': '{reference} is now in your account.';
71
+ readonly 'mistri.status.title': 'Check your application';
72
+ readonly 'mistri.status.lead': '{label}: enter the reference you were given and the details below. Only its status is shown.';
73
+ readonly 'mistri.status.yours': 'Your applications';
74
+ readonly 'mistri.status.check': 'Check status';
75
+ readonly 'mistri.status.signInToFollow': 'Sign in to add it to your account and follow it there.';
76
+ readonly 'mistri.status.addToAccount': 'Add to my account';
77
+ readonly 'mistri.saved.notShown': 'Saved — not shown for your privacy';
78
+ readonly 'mistri.saved.restarted': 'This application can no longer be continued, so it has been started again from the first step.';
79
+ readonly 'mistri.saved.confirmEmail': 'Confirm your email';
80
+ readonly 'mistri.saved.emailConfirmed': '{email} is confirmed. An account with this email will find your application.';
81
+ readonly 'mistri.saved.confirmEmailOffer': 'Optional. We email a code to your address; confirming it lets an account with this email find the application straight away.';
82
+ readonly 'mistri.saved.confirm': 'Confirm';
83
+ readonly 'mistri.saved.saveStepFirst': 'Save this step before you submit.';
84
+ readonly 'mistri.saved.follow': 'Follow it in an account';
85
+ readonly 'mistri.saved.claimClosed': 'This browser can no longer add the application to an account.';
86
+ readonly 'mistri.saved.claimWindow': 'For the next 30 minutes, this browser can add the application to an account, where its status is shown.';
87
+ readonly 'mistri.saved.createAccount': 'Create an account to track this';
88
+ readonly 'mistri.saved.signInToAdd': 'Sign in to add it';
89
+ readonly 'mistri.saved.sharedDevice': 'This is a shared device';
90
+ readonly 'mistri.saved.checkStatus': 'Check its status';
91
+ readonly 'mistri.saved.anyTime': 'any time with your reference.';
92
+ readonly 'mistri.saved.notSaved': 'Not saved yet';
93
+ readonly 'mistri.saved.resumed': 'Your application is saved. Carry on where you left off; what you saved is not shown again.';
94
+ readonly 'mistri.saved.eachStep': 'Each step is saved as you go. We don’t show your details back to you; keep this tab open to review them before you submit.';
95
+ readonly 'mistri.saved.startOver': 'Start over';
96
+ readonly 'mistri.saved.notSettled': 'Your submission was sent and its result is not known yet. Submit again to find out how it ended.';
97
+ readonly 'mistri.saved.draftShort': 'Your draft is saved.';
98
+ readonly 'mistri.saved.draft': 'Your draft is saved. Carry on where you left off, or start over.';
99
+ readonly 'mistri.saved.earlier': 'Saved earlier';
100
+ readonly 'mistri.saved.changedElsewhere': 'This draft changed somewhere else. Review it again before you submit.';
101
+ readonly 'mistri.saved.reviewNotRead': 'Your answers could not be read back for review. Submit again in a moment.';
102
+ readonly 'mistri.saved.reviewNotReady': 'Your answers are still being read back for review. Submit again in a moment.';
103
+ readonly 'mistri.saved.checking': 'Checking for an application in progress…';
104
+ readonly 'mistri.link.miss': 'This link opens nothing.';
105
+ readonly 'mistri.link.confirmLead': 'To see this, first confirm a detail only you would know.';
106
+ readonly 'mistri.link.continue': 'Continue';
107
+ readonly 'mistri.link.offerEmail': 'To see this, we email a code to the address on file.';
108
+ readonly 'mistri.link.offerText': 'To see this, we send a code to the number on file.';
109
+ readonly 'mistri.link.askEmail': 'Email me a code';
110
+ readonly 'mistri.link.askText': 'Send me a code';
111
+ readonly 'mistri.link.sentEmail': 'If the address on file takes mail, a code is on its way. It works for ten minutes.';
112
+ readonly 'mistri.link.sentText': 'If the number on file takes messages, a code is on its way. It works for ten minutes.';
113
+ readonly 'mistri.link.code': 'Code';
114
+ readonly 'mistri.link.choose': 'Choose…';
115
+ readonly 'mistri.link.failed': 'That did not work. Try again.';
116
+ readonly 'mistri.link.notNow': 'This cannot be done now.';
117
+ readonly 'mistri.link.loading': 'This page is still loading. Try again in a moment.';
118
+ readonly 'mistri.link.done': 'Done.';
119
+ readonly 'mistri.language': 'Language';
56
120
  };
57
121
  export type FrameworkWordKey = keyof typeof FRAMEWORK_WORDS;
58
122
  /** A catalog key the platform reserves: an App's catalog may say it only as one of FRAMEWORK_WORDS. */
@@ -1,11 +1,13 @@
1
1
  /**
2
- * The fixed words the platform says on an App's command and public forms, which the App's own catalog may say instead
2
+ * The fixed words the platform says on an App's command and public forms, its status check and a capability link's
3
+ * page, which the App's own catalog may say instead
3
4
  * (`messages/<locale>.ts`, a `mistri.*` key). Without them an App translated into Spanish still said "Step 2 of 3",
4
5
  * "Back" and "(optional)" in English around its own words. Each key's English is what the platform says when the
5
6
  * App's catalog has no word for it in the reader's language, so a key is opt-in and an App without one changes
6
7
  * nothing. The server checks an App's `mistri.*` keys against this table (server/app/appMessages.ts readCatalogs)
7
8
  * and serves the ones it has, in the reader's words, as plain `{name}` templates (`words`); the client says them in
8
- * place of its own (`appWord`, kit client/messages.ts).
9
+ * place of its own (`appWord`, kit client/messages.ts); the link page is drawn on the server from the same words.
10
+ * The platform says each in Spanish too (frameworkWordsEs.ts).
9
11
  */
10
12
  export const FRAMEWORK_WORDS = {
11
13
  'mistri.form.step': 'Step {step} of {count}',
@@ -53,6 +55,68 @@ export const FRAMEWORK_WORDS = {
53
55
  'mistri.status.sentText': 'We sent a code by text message.',
54
56
  'mistri.status.codeEmail': 'Code from the email',
55
57
  'mistri.status.codeText': 'Code from the message',
58
+ 'mistri.status.sendAnother': 'Send another code',
59
+ 'mistri.status.signIn': 'Sign in',
60
+ 'mistri.status.moreDetails': 'More details',
61
+ 'mistri.status.showDetails': 'Show details',
62
+ 'mistri.status.confirmAccountEmail': 'Confirm your account’s email with the link we sent you, and applications submitted with it are found here.',
63
+ 'mistri.status.added': 'Added to your account, submitted with your email: {linked}.',
64
+ 'mistri.status.foundOne': 'We found 1 application submitted with this email — is this yours?',
65
+ 'mistri.status.foundMany': 'We found {openCount} applications submitted with this email — are these yours?',
66
+ 'mistri.status.sayYesToOne': 'Say yes only to one you made: it is added to your account, where its status is shown.',
67
+ 'mistri.status.mine': 'Yes, it’s mine',
68
+ 'mistri.status.reference': 'Reference',
69
+ 'mistri.status.enter': 'Enter your {label}.',
70
+ 'mistri.status.nowInAccount': '{reference} is now in your account.',
71
+ 'mistri.status.title': 'Check your application',
72
+ 'mistri.status.lead': '{label}: enter the reference you were given and the details below. Only its status is shown.',
73
+ 'mistri.status.yours': 'Your applications',
74
+ 'mistri.status.check': 'Check status',
75
+ 'mistri.status.signInToFollow': 'Sign in to add it to your account and follow it there.',
76
+ 'mistri.status.addToAccount': 'Add to my account',
77
+ 'mistri.saved.notShown': 'Saved — not shown for your privacy',
78
+ 'mistri.saved.restarted': 'This application can no longer be continued, so it has been started again from the first step.',
79
+ 'mistri.saved.confirmEmail': 'Confirm your email',
80
+ 'mistri.saved.emailConfirmed': '{email} is confirmed. An account with this email will find your application.',
81
+ 'mistri.saved.confirmEmailOffer': 'Optional. We email a code to your address; confirming it lets an account with this email find the application straight away.',
82
+ 'mistri.saved.confirm': 'Confirm',
83
+ 'mistri.saved.saveStepFirst': 'Save this step before you submit.',
84
+ 'mistri.saved.follow': 'Follow it in an account',
85
+ 'mistri.saved.claimClosed': 'This browser can no longer add the application to an account.',
86
+ 'mistri.saved.claimWindow': 'For the next 30 minutes, this browser can add the application to an account, where its status is shown.',
87
+ 'mistri.saved.createAccount': 'Create an account to track this',
88
+ 'mistri.saved.signInToAdd': 'Sign in to add it',
89
+ 'mistri.saved.sharedDevice': 'This is a shared device',
90
+ 'mistri.saved.checkStatus': 'Check its status',
91
+ 'mistri.saved.anyTime': 'any time with your reference.',
92
+ 'mistri.saved.notSaved': 'Not saved yet',
93
+ 'mistri.saved.resumed': 'Your application is saved. Carry on where you left off; what you saved is not shown again.',
94
+ 'mistri.saved.eachStep': 'Each step is saved as you go. We don’t show your details back to you; keep this tab open to review them before you submit.',
95
+ 'mistri.saved.startOver': 'Start over',
96
+ 'mistri.saved.notSettled': 'Your submission was sent and its result is not known yet. Submit again to find out how it ended.',
97
+ 'mistri.saved.draftShort': 'Your draft is saved.',
98
+ 'mistri.saved.draft': 'Your draft is saved. Carry on where you left off, or start over.',
99
+ 'mistri.saved.earlier': 'Saved earlier',
100
+ 'mistri.saved.changedElsewhere': 'This draft changed somewhere else. Review it again before you submit.',
101
+ 'mistri.saved.reviewNotRead': 'Your answers could not be read back for review. Submit again in a moment.',
102
+ 'mistri.saved.reviewNotReady': 'Your answers are still being read back for review. Submit again in a moment.',
103
+ 'mistri.saved.checking': 'Checking for an application in progress…',
104
+ 'mistri.link.miss': 'This link opens nothing.',
105
+ 'mistri.link.confirmLead': 'To see this, first confirm a detail only you would know.',
106
+ 'mistri.link.continue': 'Continue',
107
+ 'mistri.link.offerEmail': 'To see this, we email a code to the address on file.',
108
+ 'mistri.link.offerText': 'To see this, we send a code to the number on file.',
109
+ 'mistri.link.askEmail': 'Email me a code',
110
+ 'mistri.link.askText': 'Send me a code',
111
+ 'mistri.link.sentEmail': 'If the address on file takes mail, a code is on its way. It works for ten minutes.',
112
+ 'mistri.link.sentText': 'If the number on file takes messages, a code is on its way. It works for ten minutes.',
113
+ 'mistri.link.code': 'Code',
114
+ 'mistri.link.choose': 'Choose…',
115
+ 'mistri.link.failed': 'That did not work. Try again.',
116
+ 'mistri.link.notNow': 'This cannot be done now.',
117
+ 'mistri.link.loading': 'This page is still loading. Try again in a moment.',
118
+ 'mistri.link.done': 'Done.',
119
+ 'mistri.language': 'Language',
56
120
  };
57
121
  /** A catalog key the platform reserves: an App's catalog may say it only as one of FRAMEWORK_WORDS. */
58
122
  export const isFrameworkWordKey = (key) => key.startsWith('mistri.');
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The platform's own Spanish for its framework words (frameworkWords.ts). An App with a Spanish catalog is said in
3
+ * Spanish around its own words without writing any `mistri.*` key: the server fills each word the catalog leaves out
4
+ * from here (server/app/appMessages.ts frameworkWords), and an App's own word still wins. Server-side only, so no
5
+ * page carries the table; the browser is served the words it draws, as it is the App's. Complete by type, so a word
6
+ * added in English cannot ship without its Spanish.
7
+ */
8
+ import type { FrameworkWordKey } from './frameworkWords.js';
9
+ export declare const FRAMEWORK_WORDS_ES: Readonly<Record<FrameworkWordKey, string>>;