ovr 7.0.0-next.3 → 7.0.0-next.5

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,22 @@
1
1
  # ovr
2
2
 
3
+ ## 7.0.0-next.5
4
+
5
+ ### Minor Changes
6
+
7
+ - 6cdc44e: `Field.taken(message)` is what to say when a user already has a public value no two users share, such as a username. Registration checks a users table's `taken()` fields before the passkey prompt and shows the message on the field. Other conflicts, such as an email's, stay generic.
8
+
9
+ ### Patch Changes
10
+
11
+ - 8f8e748: - A registration field that fails its schema shows its own message, such as a `refine()`'s, in place of "Check this field." The registration options endpoint answers 422 with `{ fields: { name: message } }`.
12
+ - The agents docs give both codes for a missing resource: -32602, and -32002 for clients of the 2025 versions.
13
+
14
+ ## 7.0.0-next.4
15
+
16
+ ### Patch Changes
17
+
18
+ - 554b09d: A field's description joined with more, such as a date's format, always ends as a sentence, whether or not the description has its own period.
19
+
3
20
  ## 7.0.0-next.3
4
21
 
5
22
  ### Patch Changes
@@ -1,3 +1,3 @@
1
- export declare const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(Array.isArray(e.fields))for(let t of e.fields)typeof t==`string`&&y(a.elements.namedItem(t),`Check this field.`);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
2
- export declare const etag = "W/\"c904f3541cdce47df6c6e44e6ae8fddaa56155055b2b65bc580de00ff3741e7b\"";
1
+ export declare const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(e.fields&&typeof e.fields==`object`)for(let[t,n]of Object.entries(e.fields))typeof n==`string`&&y(a.elements.namedItem(t),n);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
2
+ export declare const etag = "W/\"db299e39015256815ea2f2eec92a5cddf0ff95a21a5fcf8bc664bef0fd6ff6dc\"";
3
3
  //# sourceMappingURL=client-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-source.d.ts","sourceRoot":"","sources":["../../src/auth/client-source.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM,y8GAAy8G,CAAC;AAC79G,eAAO,MAAM,IAAI,2EAA2E,CAAC"}
1
+ {"version":3,"file":"client-source.d.ts","sourceRoot":"","sources":["../../src/auth/client-source.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM,q9GAAq9G,CAAC;AACz+G,eAAO,MAAM,IAAI,2EAA2E,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/client.js; edit client.ts instead.
2
- export const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(Array.isArray(e.fields))for(let t of e.fields)typeof t==`string`&&y(a.elements.namedItem(t),`Check this field.`);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
3
- export const etag = "W/\"c904f3541cdce47df6c6e44e6ae8fddaa56155055b2b65bc580de00ff3741e7b\"";
2
+ export const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(e.fields&&typeof e.fields==`object`)for(let[t,n]of Object.entries(e.fields))typeof n==`string`&&y(a.elements.namedItem(t),n);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
3
+ export const etag = "W/\"db299e39015256815ea2f2eec92a5cddf0ff95a21a5fcf8bc664bef0fd6ff6dc\"";
@@ -97,10 +97,10 @@ export function listen(id, bootstrap, endpoint, method) {
97
97
  }
98
98
  if (res.status === 422) {
99
99
  const result = await res.json();
100
- if (Array.isArray(result.fields))
101
- for (const name of result.fields)
102
- if (typeof name === "string")
103
- validity(form.elements.namedItem(name), "Check this field.");
100
+ if (result.fields && typeof result.fields === "object")
101
+ for (const [name, message] of Object.entries(result.fields))
102
+ if (typeof message === "string")
103
+ validity(form.elements.namedItem(name), message);
104
104
  form.reportValidity();
105
105
  throw new Error("Check your registration details and try again.");
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/auth/configure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,EAC7C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,KAAK,KAAK;;;;;;;;;;;;IA6MjC,2FAA2F;aAEvF,IAAI,CAAC,OAAO,UACR;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EAmD9B"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/auth/configure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAsB,MAAM,kBAAkB,CAAC;AAI7D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,EAC7C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,KAAK,KAAK;;;;;;;;;;;;IAuOjC,2FAA2F;aAEvF,IAAI,CAAC,OAAO,UACR;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EAmD9B"}
@@ -1,5 +1,5 @@
1
1
  import { Database } from "../database/index.js";
2
- import { Field, Form, field } from "../form/index.js";
2
+ import { Field, Form, field, taken } from "../form/index.js";
3
3
  import { jsx } from "../jsx/index.js";
4
4
  import { Limiter } from "../limiter/index.js";
5
5
  import { Route } from "../route/index.js";
@@ -50,6 +50,24 @@ export function configure(options, storage, state) {
50
50
  // Both routes validate this application shape before selecting its transformed values.
51
51
  return Object.fromEntries(fields.names.map((name) => [name, Reflect.get(data, name)]));
52
52
  };
53
+ /**
54
+ * @param data Registration values
55
+ * @returns The message of each `taken()` field whose value a user has
56
+ */
57
+ const conflicts = async (data) => {
58
+ const used = {};
59
+ for (const name of fields.names) {
60
+ const message = shape[name][taken];
61
+ const value = Reflect.get(data, name);
62
+ if (message === undefined || value == null || value === "")
63
+ continue;
64
+ const rows = await options.database
65
+ .sql `SELECT 1 FROM ${users} WHERE ${users.columns[name]} = ${value} LIMIT 1`;
66
+ if (rows.length)
67
+ used[name] = message;
68
+ }
69
+ return used;
70
+ };
53
71
  const back = (c, method, retry = 0) => {
54
72
  const target = new URL(page, options.origin);
55
73
  target.searchParams.set("_auth", method);
@@ -145,8 +163,15 @@ export function configure(options, storage, state) {
145
163
  if (!input)
146
164
  throw new Issue("registration request");
147
165
  if (input.issues) {
148
- const invalid = fields.names.filter((name) => input.issues.some((issue) => issue.path[0] === name));
149
- if (!invalid.length)
166
+ // each field's own message: checks of what the person typed,
167
+ // which say nothing about other accounts
168
+ const invalid = {};
169
+ for (const name of fields.names) {
170
+ const issue = input.issues.find((issue) => issue.path[0] === name);
171
+ if (issue)
172
+ invalid[name] = issue.message;
173
+ }
174
+ if (!Object.keys(invalid).length)
150
175
  throw new Issue("registration request");
151
176
  return c.json({ fields: invalid }, 422);
152
177
  }
@@ -155,6 +180,11 @@ export function configure(options, storage, state) {
155
180
  // The reserved bootstrap field is added to the validated application shape above.
156
181
  const data = input.data;
157
182
  const application = values(data);
183
+ // a public value already used, such as a username, is said before
184
+ // the passkey prompt, so no passkey is saved for a failed account
185
+ const used = await conflicts(application);
186
+ if (Object.keys(used).length)
187
+ return c.json({ fields: used }, 422);
158
188
  await Passkey.issue(c, state(c), data.bootstrap, {
159
189
  method: "register",
160
190
  action: paths.register,
@@ -3,6 +3,8 @@ import type { Multipart } from "../multipart/index.js";
3
3
  import { Schema, ShapeUtil, annotate } from "../schema/index.js";
4
4
  /** Internal protocol for a GET route, to make the form its fields render. */
5
5
  export declare const query: unique symbol;
6
+ /** Internal protocol for Auth, the message a `taken()` field shows */
7
+ export declare const taken: unique symbol;
6
8
  /** A field's components and render, which a route's form reads */
7
9
  declare const component: unique symbol;
8
10
  declare const render: unique symbol;
@@ -164,6 +166,24 @@ declare class FieldSchema<Output = unknown, Tag extends Field.Tag = "input", Typ
164
166
  * @returns Field with the label
165
167
  */
166
168
  label(text: string): Field.Instance<Output, Tag, Type, Values, Stream>;
169
+ /**
170
+ * What to say when a user already has the value, for a value no two users
171
+ * share and anyone may see, such as a username. Registration checks it
172
+ * before the passkey prompt and shows `message` on the field. Leave it off
173
+ * a private value, such as an email, so a conflict does not reveal who has
174
+ * an account. The unique constraint itself is the table's, in a migration.
175
+ *
176
+ * ```ts
177
+ * Field.text().taken("Someone already has this username");
178
+ * ```
179
+ *
180
+ * @template U Input type, one people read: not a password or file
181
+ * @param message What to show when a user already has the value
182
+ * @returns Field with the message
183
+ */
184
+ taken<U extends (Tag extends "input" ? Exclude<Type, "password" | "file"> : Type)>(this: Field.Instance<Output, Tag, U, Values, Stream>, message: string): Field.Instance<Output, Tag, U, Values, Stream>;
185
+ /** @internal The message `taken()` set */
186
+ get [taken](): string | undefined;
167
187
  /**
168
188
  * Attributes for the field's control wherever it renders, such as a
169
189
  * placeholder. Those for one form are passed when it renders.
@@ -348,6 +368,8 @@ export declare namespace Field {
348
368
  readonly options?: V;
349
369
  /** What people call the field, set with `label()` */
350
370
  readonly label?: string;
371
+ /** What registration says when a user already has the value, set with `taken()` */
372
+ readonly taken?: string;
351
373
  /** Field props */
352
374
  readonly props?: Props | undefined;
353
375
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,GAAG,EAAO,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACN,MAAM,EACN,SAAS,EACT,QAAQ,EAKR,MAAM,oBAAoB,CAAC;AAG5B,6EAA6E;AAC7E,eAAO,MAAM,KAAK,eAAkB,CAAC;AAErC,kEAAkE;AAClE,QAAA,MAAM,SAAS,eAAsB,CAAC;AACtC,QAAA,MAAM,MAAM,eAAmB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,KAAK,4BAAmC,CAAC;AAStD;;;;;;;GA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Checksum, Codec, Prose, Size } from "../util/index.js";
4
4
  /** Internal protocol for a GET route, to make the form its fields render. */
5
5
  export const query = Symbol("query");
6
+ /** Internal protocol for Auth, the message a `taken()` field shows */
7
+ export const taken = Symbol("taken");
6
8
  /** A field's components and render, which a route's form reads */
7
9
  const component = Symbol("component");
8
10
  const render = Symbol("render");
@@ -510,6 +512,13 @@ class FieldSchema extends Schema {
510
512
  label(text) {
511
513
  return this.#with({ label: text });
512
514
  }
515
+ taken(message) {
516
+ return this.#with({ taken: message });
517
+ }
518
+ /** @internal The message `taken()` set */
519
+ get [taken]() {
520
+ return this.#config.taken;
521
+ }
513
522
  /**
514
523
  * Attributes for the field's control wherever it renders, such as a
515
524
  * placeholder. Those for one form are passed when it renders.
@@ -198,8 +198,8 @@ export declare class Time {
198
198
  export declare class Prose {
199
199
  /**
200
200
  * Joins parts of a description into sentences. A part without its own
201
- * end gets a period before the next, and when any part ends as a
202
- * sentence, so does the whole.
201
+ * end gets a period before the next, and parts joined end as a sentence.
202
+ * A single part is kept as written.
203
203
  *
204
204
  * @param parts Parts, empty ones skipped
205
205
  * @returns The description, or an empty string
@@ -337,8 +337,8 @@ export class Time {
337
337
  export class Prose {
338
338
  /**
339
339
  * Joins parts of a description into sentences. A part without its own
340
- * end gets a period before the next, and when any part ends as a
341
- * sentence, so does the whole.
340
+ * end gets a period before the next, and parts joined end as a sentence.
341
+ * A single part is kept as written.
342
342
  *
343
343
  * @param parts Parts, empty ones skipped
344
344
  * @returns The description, or an empty string
@@ -347,7 +347,7 @@ export class Prose {
347
347
  const given = parts.filter((part) => Boolean(part));
348
348
  const ended = (part) => /[.!?]$/.test(part);
349
349
  let joined = given.reduce((text, part) => text ? `${text}${ended(text) ? "" : "."} ${part}` : part, "");
350
- if (given.some(ended) && !ended(joined))
350
+ if (given.length > 1 && !ended(joined))
351
351
  joined += ".";
352
352
  return joined;
353
353
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ovr",
3
3
  "description": "Web apps anyone can use. Each route serves people a page and agents Markdown and MCP tools, with forms, Postgres, and passkey sign-in built in.",
4
- "version": "7.0.0-next.3",
4
+ "version": "7.0.0-next.5",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/client.js; edit client.ts instead.
2
- export const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(Array.isArray(e.fields))for(let t of e.fields)typeof t==`string`&&y(a.elements.namedItem(t),`Check this field.`);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
3
- export const etag = "W/\"c904f3541cdce47df6c6e44e6ae8fddaa56155055b2b65bc580de00ff3741e7b\"";
2
+ export const source = "export function listen(e,t,n,r){let i=document.getElementById(e),a=i?.closest(`form`),o=i?.previousElementSibling,s=a?.querySelector(`[data-passkey-error]:not([data-passkey-fallback])`)??o;if(!(a instanceof HTMLFormElement)||!(s instanceof HTMLElement))return;s!==o&&o instanceof HTMLElement&&(o.hidden=!0);let c=e=>{let t=a.elements.namedItem(e);if(t instanceof HTMLInputElement)return t;let n=document.createElement(`input`);return n.type=`hidden`,n.name=e,a.append(n),n},l=c(`credential`),u=c(`ceremony`),d=!1,f=!1,p=!1,m,h=0,g,_=()=>`Too many requests. Try again in ${Math.ceil((h-Date.now())/1e3)} seconds.`,v=()=>{clearTimeout(g),g=void 0,d=f=p=!1,m=void 0,l.value=u.value=``,a.removeAttribute(`aria-busy`)},y=(e,t)=>{e instanceof HTMLElement&&`setCustomValidity`in e&&typeof e.setCustomValidity==`function`&&e.setCustomValidity(t)},b=e=>y(e.target,``);return a.addEventListener(`input`,b),a.addEventListener(`change`,b),a.addEventListener(`submit`,async e=>{if(!e.submitter?.hasAttribute(`formaction`)){if(f){p?m=e:e.preventDefault();return}if(e.preventDefault(),!d){if(h>Date.now()){s.textContent=_();return}d=!0,s.textContent=``,a.setAttribute(`aria-busy`,`true`);try{if(!window.PublicKeyCredential?.parseCreationOptionsFromJSON||!PublicKeyCredential.parseRequestOptionsFromJSON||!navigator.credentials)throw Error(`Passkeys are unavailable in this browser.`);let i=new FormData(a);i.delete(`credential`),i.delete(`ceremony`),i.set(`bootstrap`,t);let o=await fetch(n,{method:`POST`,body:i,credentials:`same-origin`,cache:`no-store`});if(o.status===429){let e=Date.now(),t=o.headers.get(`retry-after`)??`60`,n=/^\\d+$/.test(t)?e+Number(t)*1e3:Date.parse(t);throw h=Number.isNaN(n)?e+6e4:Math.min(e+36e5,Math.max(e+1e3,n)),Error(_())}if(o.status===422){let e=await o.json();if(e.fields&&typeof e.fields==`object`)for(let[t,n]of Object.entries(e.fields))typeof n==`string`&&y(a.elements.namedItem(t),n);throw a.reportValidity(),Error(`Check your registration details and try again.`)}if(o.status===410)throw Error(`This page has expired. Reload and try again.`);if(!o.ok)throw Error(`Could not start the passkey request. Try again.`);let c=await o.json();u.value=c.ceremony;let d=await(r===`register`?navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(c.options)}):navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(c.options)}));if(!(d instanceof PublicKeyCredential))throw Error(`No passkey was returned. Try again.`);l.value=JSON.stringify(d),f=!0,p=!0,m=void 0,HTMLFormElement.prototype.requestSubmit.call(a,e.submitter??void 0),p=!1,f=!!(m&&!m.defaultPrevented),f&&(g=setTimeout(()=>{v(),s.textContent=r===`register`?`If registration already completed, sign in; otherwise try again.`:`If sign-in did not finish, try again.`},12e4))}catch(e){v(),s.textContent=e instanceof DOMException&&e.name===`NotAllowedError`?`Passkey request canceled. Try again.`:e instanceof Error?e.message:`Could not complete the passkey request. Try again.`}finally{d=!1,p=!1,f||a.removeAttribute(`aria-busy`)}}}}),v}const t=new WeakMap,n=()=>document.querySelectorAll(`script[data-passkey]`),r=()=>{for(let r of n()){if(t.has(r))continue;let n=r.dataset.passkey;if(n===`register`||n===`login`){let i=listen(r.id,r.dataset.bootstrap??``,r.dataset.endpoint??``,n);i&&t.set(r,i)}}};typeof document<`u`&&(window.addEventListener(`pageshow`,e=>{if(e.persisted)for(let e of n())t.get(e)?.()}),r(),new MutationObserver(r).observe(document.documentElement,{childList:!0,subtree:!0}));";
3
+ export const etag = "W/\"db299e39015256815ea2f2eec92a5cddf0ff95a21a5fcf8bc664bef0fd6ff6dc\"";
@@ -105,10 +105,10 @@ export function listen(
105
105
  }
106
106
  if (res.status === 422) {
107
107
  const result: { fields?: unknown } = await res.json();
108
- if (Array.isArray(result.fields))
109
- for (const name of result.fields)
110
- if (typeof name === "string")
111
- validity(form.elements.namedItem(name), "Check this field.");
108
+ if (result.fields && typeof result.fields === "object")
109
+ for (const [name, message] of Object.entries(result.fields))
110
+ if (typeof message === "string")
111
+ validity(form.elements.namedItem(name), message);
112
112
  form.reportValidity();
113
113
  throw new Error("Check your registration details and try again.");
114
114
  }
@@ -1,6 +1,6 @@
1
1
  import type { Context } from "../context/index.js";
2
2
  import { Database } from "../database/index.js";
3
- import { Field, Form, field } from "../form/index.js";
3
+ import { Field, Form, field, taken } from "../form/index.js";
4
4
  import { jsx } from "../jsx/index.js";
5
5
  import { Limiter } from "../limiter/index.js";
6
6
  import type { Middleware } from "../middleware/index.js";
@@ -74,6 +74,23 @@ export function configure<U extends Auth.Users>(
74
74
  ) as Field.Parse.Data<Shape>;
75
75
  };
76
76
 
77
+ /**
78
+ * @param data Registration values
79
+ * @returns The message of each `taken()` field whose value a user has
80
+ */
81
+ const conflicts = async (data: Field.Parse.Data<Shape>) => {
82
+ const used: Record<string, string> = {};
83
+ for (const name of fields.names) {
84
+ const message = shape[name]![taken];
85
+ const value: unknown = Reflect.get(data, name);
86
+ if (message === undefined || value == null || value === "") continue;
87
+ const rows = await options.database
88
+ .sql`SELECT 1 FROM ${users} WHERE ${users.columns[name]!} = ${value} LIMIT 1`;
89
+ if (rows.length) used[name] = message;
90
+ }
91
+ return used;
92
+ };
93
+
77
94
  const back = (c: Pick<Context, "redirect">, method: string, retry = 0) => {
78
95
  const target = new URL(page, options.origin);
79
96
  target.searchParams.set("_auth", method);
@@ -186,10 +203,15 @@ export function configure<U extends Auth.Users>(
186
203
  const input = await Issue.data(c);
187
204
  if (!input) throw new Issue("registration request");
188
205
  if (input.issues) {
189
- const invalid = fields.names.filter((name) =>
190
- input.issues.some((issue) => issue.path[0] === name),
191
- );
192
- if (!invalid.length) throw new Issue("registration request");
206
+ // each field's own message: checks of what the person typed,
207
+ // which say nothing about other accounts
208
+ const invalid: Record<string, string> = {};
209
+ for (const name of fields.names) {
210
+ const issue = input.issues.find((issue) => issue.path[0] === name);
211
+ if (issue) invalid[name] = issue.message;
212
+ }
213
+ if (!Object.keys(invalid).length)
214
+ throw new Issue("registration request");
193
215
  return c.json({ fields: invalid }, 422);
194
216
  }
195
217
  if (!(await admit(c, "register", true))) return;
@@ -198,6 +220,10 @@ export function configure<U extends Auth.Users>(
198
220
  bootstrap: string;
199
221
  };
200
222
  const application = values(data);
223
+ // a public value already used, such as a username, is said before
224
+ // the passkey prompt, so no passkey is saved for a failed account
225
+ const used = await conflicts(application);
226
+ if (Object.keys(used).length) return c.json({ fields: used }, 422);
201
227
  await Passkey.issue(c, state(c), data.bootstrap, {
202
228
  method: "register",
203
229
  action: paths.register,
package/src/form/index.ts CHANGED
@@ -14,6 +14,9 @@ import { Checksum, Codec, Prose, Size } from "../util/index.js";
14
14
  /** Internal protocol for a GET route, to make the form its fields render. */
15
15
  export const query = Symbol("query");
16
16
 
17
+ /** Internal protocol for Auth, the message a `taken()` field shows */
18
+ export const taken = Symbol("taken");
19
+
17
20
  /** A field's components and render, which a route's form reads */
18
21
  const component = Symbol("component");
19
22
  const render = Symbol("render");
@@ -673,6 +676,36 @@ class FieldSchema<
673
676
  return this.#with({ label: text });
674
677
  }
675
678
 
679
+ /**
680
+ * What to say when a user already has the value, for a value no two users
681
+ * share and anyone may see, such as a username. Registration checks it
682
+ * before the passkey prompt and shows `message` on the field. Leave it off
683
+ * a private value, such as an email, so a conflict does not reveal who has
684
+ * an account. The unique constraint itself is the table's, in a migration.
685
+ *
686
+ * ```ts
687
+ * Field.text().taken("Someone already has this username");
688
+ * ```
689
+ *
690
+ * @template U Input type, one people read: not a password or file
691
+ * @param message What to show when a user already has the value
692
+ * @returns Field with the message
693
+ */
694
+ taken<
695
+ U extends (Tag extends "input" ? Exclude<Type, "password" | "file"> : Type),
696
+ >(
697
+ this: Field.Instance<Output, Tag, U, Values, Stream>,
698
+ message: string,
699
+ ): Field.Instance<Output, Tag, U, Values, Stream>;
700
+ taken(message: string) {
701
+ return this.#with({ taken: message });
702
+ }
703
+
704
+ /** @internal The message `taken()` set */
705
+ get [taken]() {
706
+ return this.#config.taken;
707
+ }
708
+
676
709
  /**
677
710
  * Attributes for the field's control wherever it renders, such as a
678
711
  * placeholder. Those for one form are passed when it renders.
@@ -701,7 +734,7 @@ class FieldSchema<
701
734
  * @param changes What to change
702
735
  * @returns The same field with them
703
736
  */
704
- #with(changes: Pick<Field.Config, "label" | "props">) {
737
+ #with(changes: Pick<Field.Config, "label" | "taken" | "props">) {
705
738
  return this.#copy({ config: { ...this.#config, ...changes } });
706
739
  }
707
740
 
@@ -1172,6 +1205,9 @@ export namespace Field {
1172
1205
  /** What people call the field, set with `label()` */
1173
1206
  readonly label?: string;
1174
1207
 
1208
+ /** What registration says when a user already has the value, set with `taken()` */
1209
+ readonly taken?: string;
1210
+
1175
1211
  /** Field props */
1176
1212
  readonly props?: Props | undefined;
1177
1213
  }
package/src/util/index.ts CHANGED
@@ -400,8 +400,8 @@ export class Time {
400
400
  export class Prose {
401
401
  /**
402
402
  * Joins parts of a description into sentences. A part without its own
403
- * end gets a period before the next, and when any part ends as a
404
- * sentence, so does the whole.
403
+ * end gets a period before the next, and parts joined end as a sentence.
404
+ * A single part is kept as written.
405
405
  *
406
406
  * @param parts Parts, empty ones skipped
407
407
  * @returns The description, or an empty string
@@ -414,7 +414,7 @@ export class Prose {
414
414
  text ? `${text}${ended(text) ? "" : "."} ${part}` : part,
415
415
  "",
416
416
  );
417
- if (given.some(ended) && !ended(joined)) joined += ".";
417
+ if (given.length > 1 && !ended(joined)) joined += ".";
418
418
  return joined;
419
419
  }
420
420
  }