jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
This commit is contained in:
+5
-4
@@ -9,22 +9,23 @@ import { banner } from './chrome.mjs';
|
||||
import { logEvent } from './log.mjs';
|
||||
import { navigate } from './router.mjs';
|
||||
|
||||
/** @param {?string} arg @param {number} seq @returns {Promise<void>} */
|
||||
export async function enter(arg, seq) {
|
||||
$('claim-code').value = '';
|
||||
$('claim-name').value = '';
|
||||
/** @type {HTMLInputElement} */ ($('claim-code')).value = '';
|
||||
/** @type {HTMLInputElement} */ ($('claim-name')).value = '';
|
||||
let fresh = false;
|
||||
try { fresh = (await api('/session')).fresh; } catch { /* public: works signed out; a dead server shows the plain hint */ }
|
||||
if (seq !== state.seq) return;
|
||||
$('claim-hint').textContent = fresh
|
||||
? 'this deployment has no users yet -- the superuser invite is in state/bootstrap-invite.txt on the server'
|
||||
: 'a single-use invite code, from the operator';
|
||||
$('claim-code').focus();
|
||||
/** @type {HTMLInputElement} */ ($('claim-code')).focus();
|
||||
}
|
||||
|
||||
$('claim-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const r = await api('/claim', { method: 'POST', body: { code: $('claim-code').value.trim(), name: $('claim-name').value.trim() } });
|
||||
const r = await api('/claim', { method: 'POST', body: { code: /** @type {HTMLInputElement} */ ($('claim-code')).value.trim(), name: /** @type {HTMLInputElement} */ ($('claim-name')).value.trim() } });
|
||||
setToken(r.token);
|
||||
state.me = r.user;
|
||||
logEvent('nav', `claimed: ${r.user.name}${r.user.superuser ? ' (op)' : ''}`);
|
||||
|
||||
Reference in New Issue
Block a user