@midsummer-ai/sdk 0.1.0-staging.3919 → 0.1.0-staging.3925

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/auth/contract.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { r as AuthError } from "../auth-uYveadHe.mjs";
1
+ import { r as AuthError } from "../auth--jtz5BOc.mjs";
2
2
  import { d as SETTINGS_TTL_MS, n as LIMIT_WINDOW_MS, t as LIMITS } from "../guard-Br3K8CVx.mjs";
3
3
  import { IMPERSONATION_TOKEN_MS, startImpersonation } from "./impersonate.mjs";
4
4
  //#region src/auth/contract.ts
package/auth/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SESSION_CACHE_S, c as databaseStore, i as IMPERSONATION_S, n as AUTH_ROUTES, o as auth, r as AuthError, s as createAuth, t as AUTH_PATH } from "../auth-uYveadHe.mjs";
1
+ import { a as SESSION_CACHE_S, c as databaseStore, i as IMPERSONATION_S, n as AUTH_ROUTES, o as auth, r as AuthError, s as createAuth, t as AUTH_PATH } from "../auth--jtz5BOc.mjs";
2
2
  import { checkSignInMail, signInWords } from "./mail.mjs";
3
3
  import { n as authFiles } from "../files-DhPeWwcT.mjs";
4
4
  export { AUTH_PATH, AUTH_ROUTES, AuthError, IMPERSONATION_S, SESSION_CACHE_S, auth, authFiles, checkSignInMail, createAuth, databaseStore, signInWords };
package/auth/mail.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as EmailError } from "../index-Bprm0lxl.mjs";
2
2
  //#region src/auth/mail.d.ts
3
- type SignInMailKind = "code" | "link" | "verify" | "reset" | "invite" | "device";
3
+ type SignInMailKind = "code" | "link" | "verify" | "reset" | "invite" | "device" | "approved";
4
4
  /** One sign-in mail: whom to, which kind, the app's name, and its code or its address. */
5
5
  interface SignInMail {
6
6
  readonly to: string;
package/auth/mail.mjs CHANGED
@@ -2,8 +2,8 @@ import { a as processEnv, n as here } from "../here-C2jhTheQ.mjs";
2
2
  import { l as email, t as EmailError } from "../email-Bp45mjUS.mjs";
3
3
  //#region src/auth/mail.ts
4
4
  /**
5
- * The mail sign-in sends: a code, a sign-in link, an email check, a password reset, an invitation or a sign-in from
6
- * a new device, each in fixed words that name the app, with its logo and colour when its settings give them. A Deployment sends it through Email: from the address `AUTH_EMAIL_FROM`
5
+ * The mail sign-in sends: a code, a sign-in link, an email check, a password reset, an invitation, a sign-in from
6
+ * a new device or word that the waitlist let them in, each in fixed words that name the app, with its logo and colour when its settings give them. A Deployment sends it through Email: from the address `AUTH_EMAIL_FROM`
7
7
  * names, on a domain of the Team's, as any Message; without one, from Midsummer's shared sign-in sender,
8
8
  * which reaches anyone, a few times an hour an address and a few hundred times an hour a Team. Only these
9
9
  * words go from the shared sender, so it carries no one's own mail.
@@ -14,7 +14,8 @@ const KINDS = [
14
14
  "verify",
15
15
  "reset",
16
16
  "invite",
17
- "device"
17
+ "device",
18
+ "approved"
18
19
  ];
19
20
  const ADDRESS = /^[^\s@<>()",;:]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/i;
20
21
  const LOCAL = /^(?:localhost|127\.0\.0\.1|\[::1\]|[a-z0-9-]+\.localhost)$/i;
@@ -92,6 +93,12 @@ function wordsOf(mail) {
92
93
  button: "Accept invitation",
93
94
  after: ""
94
95
  };
96
+ case "approved": return {
97
+ subject: `You can sign up to ${app}`,
98
+ lead: `You're off the waitlist: sign up to ${app} with this link.`,
99
+ button: "Sign up",
100
+ after: ""
101
+ };
95
102
  case "device": return {
96
103
  subject: `A new sign-in to ${app}`,
97
104
  lead: `You signed in to ${app}${mail.device ? ` from ${mail.device}` : ""}, on a device you haven't used before.`,
@@ -841,10 +841,11 @@ function copyScript() {
841
841
  }
842
842
  /**
843
843
  * The few lines a password field's button needs to show and hide what is typed, and a code field its six boxes: with
844
- * no script, the code field is a plain field.
844
+ * no script, the code field is a plain field. A sixth digit sends the form once, through its own button, so the server
845
+ * reads the same `action` a click sends.
845
846
  */
846
847
  function revealScript() {
847
- return "document.querySelectorAll(\"[data-msa-reveal]\").forEach((b)=>b.addEventListener(\"click\",()=>{const i=b.previousElementSibling,on=i.type===\"password\";i.type=on?\"text\":\"password\";b.setAttribute(\"aria-pressed\",String(on));b.setAttribute(\"aria-label\",on?\"Hide password\":\"Show password\")}));document.querySelectorAll(\".msa-otp\").forEach((o)=>{const i=o.querySelector(\"input\"),s=[...o.querySelectorAll(\".msa-otp-box\")];o.setAttribute(\"data-boxes\",\"\");const show=()=>{i.value=i.value.replace(/\\D/g,\"\").slice(0,6);s.forEach((b,n)=>{b.textContent=i.value[n]||\"\";b.toggleAttribute(\"data-active\",n===Math.min(i.value.length,5))});if(i.value.length===6&&i.form)i.form.requestSubmit()};i.addEventListener(\"input\",show);show()})";
848
+ return "document.querySelectorAll(\"[data-msa-reveal]\").forEach((b)=>b.addEventListener(\"click\",()=>{const i=b.previousElementSibling,on=i.type===\"password\";i.type=on?\"text\":\"password\";b.setAttribute(\"aria-pressed\",String(on));b.setAttribute(\"aria-label\",on?\"Hide password\":\"Show password\")}));document.querySelectorAll(\".msa-otp\").forEach((o)=>{const i=o.querySelector(\"input\"),s=[...o.querySelectorAll(\".msa-otp-box\")];o.setAttribute(\"data-boxes\",\"\");const show=()=>{i.value=i.value.replace(/\\D/g,\"\").slice(0,6);s.forEach((b,n)=>{b.textContent=i.value[n]||\"\";b.toggleAttribute(\"data-active\",n===Math.min(i.value.length,5))});if(i.value.length===6&&i.form&&i.dataset.sent!==i.value){i.dataset.sent=i.value;i.form.requestSubmit(i.form.querySelector(\"button[name=action]\"))}};i.addEventListener(\"input\",show);show()})";
848
849
  }
849
850
  function twoFactorSetup(uri, codes) {
850
851
  const id = `msa-field-${++fields}`;
package/here-C2jhTheQ.mjs CHANGED
@@ -12,7 +12,7 @@ function processEnv() {
12
12
  * This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
13
13
  * release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
14
14
  */
15
- const SDK_VERSION = "0.1.0-staging.3919";
15
+ const SDK_VERSION = "0.1.0-staging.3925";
16
16
  /**
17
17
  * The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
18
18
  * <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.3919",
3
+ "version": "0.1.0-staging.3925",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",