@nxgt/janus-mail 0.9.7 → 0.10.0
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/README.md +55 -13
- package/dist/expiring-mails.d.ts +2 -2
- package/dist/expiring-mails.d.ts.map +1 -1
- package/dist/generated/mail.d.ts +6 -0
- package/dist/generated/mail.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +7 -7
- package/dist/janus-mail.d.ts +1 -0
- package/dist/janus-mail.d.ts.map +1 -1
- package/dist/link-types.d.ts +10 -0
- package/dist/link-types.d.ts.map +1 -1
- package/dist/links.d.ts.map +1 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/template-types.d.ts +12 -2
- package/dist/template-types.d.ts.map +1 -1
- package/dist/templates.d.ts +1 -1
- package/dist/templates.d.ts.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/guide/building.md +2 -2
- package/docs/guide/locales.md +5 -4
- package/docs/guide/sending.md +32 -1
- package/docs/guide/templates.md +10 -8
- package/docs/roadmap.md +11 -0
- package/docs/troubleshooting.md +49 -8
- package/mails/en/confirm-new-email.html +51 -0
- package/mails/en/confirm-new-email.txt +23 -0
- package/mails/fr/confirm-new-email.html +51 -0
- package/mails/fr/confirm-new-email.txt +23 -0
- package/mails/mail-manifest.json +25 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ const mail = janusMail({
|
|
|
24
24
|
getStarted: () => 'https://acme.example/',
|
|
25
25
|
recoveryCodes: () => 'https://acme.example/account/recovery-codes', // optional
|
|
26
26
|
magicLink: (token) => `https://acme.example/sign-in/link?token=${token}`, // optional
|
|
27
|
+
changeEmail: (token) => `https://acme.example/account/email?token=${token}`, // optional
|
|
27
28
|
},
|
|
28
29
|
});
|
|
29
30
|
|
|
@@ -65,12 +66,12 @@ needs Node `^22.22.3`, `^24.15.0` or `>=26`, for Maizzle — see
|
|
|
65
66
|
|
|
66
67
|
| Export | What it is |
|
|
67
68
|
| --- | --- |
|
|
68
|
-
| `janusMail(options)` | The e-mails, over your mailer: `verifyEmail`, `resetPassword`, `signInCode`, `magicLink`, `stepUp`, `passwordChanged`, `emailChanged`, `twoFactorEnabled`, `twoFactorDisabled`, `recoveryCodeUsed`, `newSignIn`, `welcome`, and `templates` and `locales`. Options: `mailer`, `from`, `replyTo?`, `brand`, `links` (`verifyEmail`, `resetPassword`, `secureAccount`, `getStarted`, and `recoveryCodes?` and `
|
|
69
|
-
| `janusTemplates()` | The
|
|
69
|
+
| `janusMail(options)` | The e-mails, over your mailer: `verifyEmail`, `resetPassword`, `signInCode`, `magicLink`, `changeEmail`, `stepUp`, `passwordChanged`, `emailChanged`, `twoFactorEnabled`, `twoFactorDisabled`, `recoveryCodeUsed`, `newSignIn`, `welcome`, and `templates` and `locales`. Options: `mailer`, `from`, `replyTo?`, `brand`, `links` (`verifyEmail`, `resetPassword`, `secureAccount`, `getStarted`, and `recoveryCodes?`, `magicLink?` and `changeEmail?`), `locales?`, `fallbackLocale?`, `templates?`, `clock?`. A wrong option is a bare `TypeError`, thrown here |
|
|
70
|
+
| `janusTemplates()` | The thirteen default templates alone, each `(variables & { locale }) => Rendered` |
|
|
70
71
|
| `JanusMail<L>`, `JanusMailOptions<L>` | What `janusMail()` answers and takes, for the locales `L` |
|
|
71
|
-
| `JanusMailTemplate<V, L>`, `JanusMailTemplates<L>`, `JanusMailTemplateName` | One template, the
|
|
72
|
+
| `JanusMailTemplate<V, L>`, `JanusMailTemplates<L>`, `JanusMailTemplateName` | One template, the thirteen of them, and their names |
|
|
72
73
|
| `JanusMailVariables` | What each template is given: `brand`, and `name`, `link`, `code`, `expiresIn`, `newEmail`, `when`, `recoveryCodesLeft`, or `device`, `time` and `location`, as its e-mail needs |
|
|
73
|
-
| `JanusMailSendOptions` | The third argument of `verifyEmail`, `resetPassword`, `signInCode`, `magicLink` and `stepUp`: `{ expiresIn? }`, the expiry as text, over the one derived |
|
|
74
|
+
| `JanusMailSendOptions` | The third argument of `verifyEmail`, `resetPassword`, `signInCode`, `magicLink`, `changeEmail` and `stepUp`: `{ expiresIn? }`, the expiry as text, over the one derived |
|
|
74
75
|
| `JanusMailLocale` | `'en' \| 'fr'`: the locales the defaults are built in |
|
|
75
76
|
| `JanusMailLinks`, `Recipient` | The `links` option; who an e-mail is for — `{ name, locale? }` |
|
|
76
77
|
|
|
@@ -88,6 +89,7 @@ class. To retry a `MailFailure` or trace each send, wrap the mailer you pass:
|
|
|
88
89
|
| `resetPassword(issued, to, options?)` | `issued` from `auth.resetPassword.request(email)`, checked for `null`; a link from `links.resetPassword(issued.token)`, and how long it lasts | `issued.email` |
|
|
89
90
|
| `signInCode(issued, to?, options?)` | `issued.code` from `auth.signInCode.request(email)`, and how long it lasts — **never the challenge** | `issued.email` |
|
|
90
91
|
| `magicLink(issued, to?, options?)` | `issued` from `auth.magicLink.request(email)`, checked for `null`; a link from `links.magicLink(issued.token)`, and how long it lasts. A `TypeError` without `links.magicLink` | `issued.email` |
|
|
92
|
+
| `changeEmail(issued, to, options?)` | `issued` from `auth.<type>.changeEmail.send(user, newEmail)`; a link from `links.changeEmail(issued.token)`, how long it lasts, greeting `to.name`. A `TypeError` without `links.changeEmail` | `issued.email`, the **new** address |
|
|
91
93
|
| `stepUp(issued, to, options?)` | `issued.code` from `auth.stepUp.request(user)`, narrowed to `via: 'email'`, and how long it lasts, greeting `to.name`, with `links.secureAccount()` — **never the challenge**. A `TypeError` for `via: 'secondFactor'` | `issued.email` |
|
|
92
94
|
| `passwordChanged(to)` | A notice, with `links.secureAccount()` | `to.email` |
|
|
93
95
|
| `emailChanged(to)` | A notice naming `to.newEmail`, with `links.secureAccount()` | `to.formerEmail` |
|
|
@@ -97,7 +99,7 @@ class. To retry a `MailFailure` or trace each send, wrap the mailer you pass:
|
|
|
97
99
|
| `newSignIn(to, { device, time, location? })` | A notice: the account was signed in from a new device — which device, `time`, and `location`, "Unknown" ("Inconnu") when left out — with `links.secureAccount()` | `to.email` |
|
|
98
100
|
| `welcome(to)` | A welcome to a new user — "Welcome, Ada" — with `links.getStarted()` | `to.email` |
|
|
99
101
|
|
|
100
|
-
The
|
|
102
|
+
The six e-mails of a link or a code say how long it lasts — "This link
|
|
101
103
|
expires in 1 hour.", "Ce lien expire dans 1 heure." — from the flow's
|
|
102
104
|
`issued.expiresAt`: the time left at send time, rounded to the minute, then
|
|
103
105
|
down to the largest whole unit (days, hours or minutes), formatted with
|
|
@@ -158,6 +160,22 @@ scanners open every link in an e-mail, and one that signs in on `GET` signs
|
|
|
158
160
|
in for the scanner. [`@nxgt/janus`'s sign-in link guide](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus/docs/guide/magic-link.md)
|
|
159
161
|
has that page.
|
|
160
162
|
|
|
163
|
+
### Confirming a new address — `changeEmail`
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
const issued = await auth.changeEmail.send(user, newEmail); // gate it: assertFresh or a step-up
|
|
167
|
+
await mail.changeEmail(issued, { name: user.name, locale: user.locale }); // "Confirm your new e-mail address", valid 1 hour
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The e-mail goes to `issued.email`, which is the **new** address: the account
|
|
171
|
+
moves there only when its link is redeemed by `auth.changeEmail.confirm(token)`.
|
|
172
|
+
Once it is, `user.emailChanged` fires and `mail.emailChanged` tells the
|
|
173
|
+
**former** address (`formerEmail`) — the two e-mails go to two inboxes, and
|
|
174
|
+
you send both. `links.changeEmail` is optional and should open **a page of
|
|
175
|
+
yours that spends nothing**, whose button posts the token to the route
|
|
176
|
+
calling `changeEmail.confirm`, as the sign-in link's does. Uses the
|
|
177
|
+
`confirm-new-email` preset of `@nxgt/mail-presets` 1.2.0, in English and French.
|
|
178
|
+
|
|
161
179
|
### Confirming a sensitive action — the step-up
|
|
162
180
|
|
|
163
181
|
```ts
|
|
@@ -355,6 +373,12 @@ A locale beyond `en` and `fr` takes **every** template: see
|
|
|
355
373
|
|
|
356
374
|
## Traps
|
|
357
375
|
|
|
376
|
+
**`mail.verifyEmail` is not `changeEmail`'s mail.** `auth.<type>.changeEmail.send`
|
|
377
|
+
answers an `IssuedToken` like `verifyEmail.send`, but its link redeems a
|
|
378
|
+
change, not a verification, and `mail.verifyEmail(issued)` would say the
|
|
379
|
+
wrong thing (and its link, `TOKEN_UNKNOWN`). Send `mail.changeEmail(issued, …)`
|
|
380
|
+
to the new address; `mail.emailChanged` tells the former one afterwards.
|
|
381
|
+
|
|
358
382
|
**Send to `issued.email`, which the methods do.** Never to what the visitor
|
|
359
383
|
typed: the flow answers the address the user's record holds, as they
|
|
360
384
|
registered it. `emailChanged` goes to `formerEmail` — the address a hijacker
|
|
@@ -420,6 +444,14 @@ it.** An application that sends no sign-in link leaves it out; calling
|
|
|
420
444
|
rendered or sent. Unlike `recoveryCodes`, it has no fallback: no other page
|
|
421
445
|
can carry the token.
|
|
422
446
|
|
|
447
|
+
**`links.changeEmail` is optional, and `changeEmail` refuses to send without
|
|
448
|
+
it.** An application that lets no user change their address leaves it out;
|
|
449
|
+
calling `mail.changeEmail` then throws a `TypeError` —
|
|
450
|
+
`janusMail.changeEmail: links.changeEmail is missing — …` — before anything
|
|
451
|
+
is rendered or sent. Optional rather than required so that links written
|
|
452
|
+
before `changeEmail` keep compiling; there is no fallback, no other page can
|
|
453
|
+
carry the token.
|
|
454
|
+
|
|
423
455
|
**Leave `location` out when you do not know it.** A geo-IP lookup that found
|
|
424
456
|
nothing answers `null`, which is a compile error here and, in JavaScript,
|
|
425
457
|
`janusMail.newSignIn: location must be a string`: spread it in only when it
|
|
@@ -438,9 +470,9 @@ and are refused with a `TypeError`; its fields (`signInCode = (variables) =>
|
|
|
438
470
|
…`) pass.
|
|
439
471
|
|
|
440
472
|
**A locale beyond `en` and `fr` needs every template.** The defaults are
|
|
441
|
-
built in those two only, so `locales: ['en', 'fr', 'de']` without all
|
|
473
|
+
built in those two only, so `locales: ['en', 'fr', 'de']` without all thirteen
|
|
442
474
|
templates — `recoveryCodeUsed` included, since 0.5, `magicLink`, since
|
|
443
|
-
0.7, `stepUp`, since 0.8,
|
|
475
|
+
0.7, `stepUp`, since 0.8, `newSignIn`, since 0.9, and `changeEmail`, since 0.10 — is a compile error, and a `TypeError` in JavaScript.
|
|
444
476
|
|
|
445
477
|
**The brand is text only.** `brand: 'Acme'` is written in the header, the
|
|
446
478
|
body and the footer, escaped: no logo, no link, no markup. For those, replace
|
|
@@ -497,8 +529,8 @@ The symptoms and fixes are in [troubleshooting](docs/troubleshooting.md).
|
|
|
497
529
|
|
|
498
530
|
## Type safety, counted
|
|
499
531
|
|
|
500
|
-
**Fifty plausible mistakes, fifty refused at compile time.**
|
|
501
|
-
|
|
532
|
+
**Fifty-eight plausible mistakes, fifty-eight refused at compile time.**
|
|
533
|
+
Ten files hold one `@ts-expect-error` per mistake, beside the calls that
|
|
502
534
|
must keep compiling:
|
|
503
535
|
[`test/types/send-refusals.ts`](test/types/send-refusals.ts) the eight of a
|
|
504
536
|
send, 1 to 8;
|
|
@@ -517,9 +549,11 @@ the e-mail change notice sent on its event, 35 and 36;
|
|
|
517
549
|
four of the sign-in link, 37 to 40;
|
|
518
550
|
[`test/types/step-up-refusals.ts`](test/types/step-up-refusals.ts) the six
|
|
519
551
|
of the step-up's code, 41 to 46, beside the names of the templates, held to
|
|
520
|
-
the
|
|
552
|
+
the thirteen;
|
|
521
553
|
[`test/types/new-sign-in-refusals.ts`](test/types/new-sign-in-refusals.ts)
|
|
522
|
-
the four of the new sign-in notice, 47 to 50
|
|
554
|
+
the four of the new sign-in notice, 47 to 50; and
|
|
555
|
+
[`test/types/change-email-refusals.ts`](test/types/change-email-refusals.ts)
|
|
556
|
+
the eight of the e-mail change link, 51 to 58:
|
|
523
557
|
|
|
524
558
|
1. A sign-in code given to `verifyEmail`: it has no token.
|
|
525
559
|
2. A one-time token given to `signInCode`: it has no code.
|
|
@@ -571,8 +605,16 @@ the four of the new sign-in notice, 47 to 50:
|
|
|
571
605
|
48. `newSignIn` without the device and the time.
|
|
572
606
|
49. `time` given as the session's `Date` rather than the text in the recipient's locale and time zone.
|
|
573
607
|
50. A location lookup's `null` passed as `location`, rather than leaving it out.
|
|
574
|
-
|
|
575
|
-
|
|
608
|
+
51. A sign-in code given to `changeEmail`: it has no token.
|
|
609
|
+
52. A step-up's code given to `changeEmail`: it has no token either.
|
|
610
|
+
53. The token alone, not what `changeEmail.send` answered.
|
|
611
|
+
54. `changeEmail.send`'s answer, not checked for `null`.
|
|
612
|
+
55. `changeEmail` without the recipient.
|
|
613
|
+
56. A recipient without a name.
|
|
614
|
+
57. `links.changeEmail` computed asynchronously.
|
|
615
|
+
58. `links.changeEmail` answered as a `URL` object rather than its `href`.
|
|
616
|
+
|
|
617
|
+
In JavaScript, 19 to 23, 26 to 28, 30 to 33 and 35 to 58 are a `TypeError` at send
|
|
576
618
|
time instead, naming the call or the field, and 25, 29 and 34 one from
|
|
577
619
|
`janusMail()`.
|
|
578
620
|
|
package/dist/expiring-mails.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedOptions } from './options';
|
|
2
2
|
import type { JanusMail } from './types';
|
|
3
|
-
type ExpiringMails = Pick<JanusMail<string>, 'verifyEmail' | 'resetPassword' | 'signInCode' | 'magicLink'>;
|
|
4
|
-
/** `verifyEmail`, `resetPassword`, `signInCode` and `
|
|
3
|
+
type ExpiringMails = Pick<JanusMail<string>, 'verifyEmail' | 'resetPassword' | 'signInCode' | 'magicLink' | 'changeEmail'>;
|
|
4
|
+
/** `verifyEmail`, `resetPassword`, `signInCode`, `magicLink` and `changeEmail`, over the resolved options. */
|
|
5
5
|
export declare function expiringMails(options: ResolvedOptions): ExpiringMails;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=expiring-mails.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expiring-mails.d.ts","sourceRoot":"","sources":["../src/expiring-mails.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,aAAa,GAAG,IAAI,CACxB,SAAS,CAAC,MAAM,CAAC,EACjB,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"expiring-mails.d.ts","sourceRoot":"","sources":["../src/expiring-mails.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,aAAa,GAAG,IAAI,CACxB,SAAS,CAAC,MAAM,CAAC,EACjB,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,CAC5E,CAAC;AAkFF,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAuBrE"}
|
package/dist/generated/mail.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface MailEmails {
|
|
|
7
7
|
readonly link: string;
|
|
8
8
|
readonly name: string | number;
|
|
9
9
|
};
|
|
10
|
+
"confirm-new-email": {
|
|
11
|
+
readonly brand: string | number;
|
|
12
|
+
readonly expiresIn: string | number;
|
|
13
|
+
readonly link: string;
|
|
14
|
+
readonly name: string | number;
|
|
15
|
+
};
|
|
10
16
|
"email-changed": {
|
|
11
17
|
readonly brand: string | number;
|
|
12
18
|
readonly link: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../../src/generated/mail.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,MAAM,WAAW,UAAU;IAC1B,gBAAgB,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,I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AE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzH,qBAAqB,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClH,oBAAoB,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACjH,cAAc,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChJ,SAAS,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `@nxgt/janus` sends no e-mail: its flows answer what to send — a one-time
|
|
5
5
|
* token, a sign-in code, a sign-in link's token, a step-up's code, the
|
|
6
6
|
* address — and this package turns that answer into an e-mail and hands it
|
|
7
|
-
* to an `@nxgt/mail` transport.
|
|
7
|
+
* to an `@nxgt/mail` transport. Thirteen e-mails, in
|
|
8
8
|
* English and French, prebuilt with Maizzle when this package is built, and
|
|
9
9
|
* filled at send time with your brand, the recipient's name and your links.
|
|
10
10
|
* Any of them can be replaced by a function of your own.
|
package/dist/index.js
CHANGED
|
@@ -100,6 +100,23 @@ function magicLinkMail(options) {
|
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
function changeEmailMail(options) {
|
|
104
|
+
return async (issued, to, sendOptions) => {
|
|
105
|
+
const build = options.links.changeEmail;
|
|
106
|
+
if (build === undefined) {
|
|
107
|
+
throw new TypeError("janusMail.changeEmail: links.changeEmail is missing — pass it to janusMail({ links }) to send e-mail change links");
|
|
108
|
+
}
|
|
109
|
+
const token = field("changeEmail", issued, "token");
|
|
110
|
+
const locale = localeFor(options, to);
|
|
111
|
+
return send(options, "changeEmail", field("changeEmail", issued, "email"), {
|
|
112
|
+
brand: options.brand,
|
|
113
|
+
name: field("changeEmail", to, "name"),
|
|
114
|
+
link: link("changeEmail", build(token), "changeEmail(token)"),
|
|
115
|
+
expiresIn: expiresInFor("changeEmail", issued, locale, sendOptions, options.clock),
|
|
116
|
+
locale
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
}
|
|
103
120
|
function expiringMails(options) {
|
|
104
121
|
return {
|
|
105
122
|
verifyEmail: linkMail(options, "verifyEmail"),
|
|
@@ -113,7 +130,8 @@ function expiringMails(options) {
|
|
|
113
130
|
locale
|
|
114
131
|
});
|
|
115
132
|
},
|
|
116
|
-
magicLink: magicLinkMail(options)
|
|
133
|
+
magicLink: magicLinkMail(options),
|
|
134
|
+
changeEmail: changeEmailMail(options)
|
|
117
135
|
};
|
|
118
136
|
}
|
|
119
137
|
|
|
@@ -199,7 +217,7 @@ var REQUIRED_LINKS = [
|
|
|
199
217
|
"secureAccount",
|
|
200
218
|
"getStarted"
|
|
201
219
|
];
|
|
202
|
-
var OPTIONAL_LINKS = ["recoveryCodes", "magicLink"];
|
|
220
|
+
var OPTIONAL_LINKS = ["recoveryCodes", "magicLink", "changeEmail"];
|
|
203
221
|
function checkLinks(links) {
|
|
204
222
|
if (typeof links !== "object" || links === null || Array.isArray(links)) {
|
|
205
223
|
refuse("links must be an object, as { verifyEmail, resetPassword, secureAccount, getStarted }");
|
|
@@ -263,6 +281,7 @@ function janusTemplates() {
|
|
|
263
281
|
signInCode: ({ brand, code, expiresIn, locale }) => defaultRenderer().render("sign-in-code", { brand, code, expiresIn }, { locale }),
|
|
264
282
|
magicLink: ({ brand, link, expiresIn, locale }) => defaultRenderer().render("magic-link", { brand, link, expiresIn }, { locale }),
|
|
265
283
|
stepUp: ({ brand, name, code, expiresIn, link, locale }) => defaultRenderer().render("confirm-action", { brand, name, code, expiresIn, link }, { locale }),
|
|
284
|
+
changeEmail: ({ brand, name, link, expiresIn, locale }) => defaultRenderer().render("confirm-new-email", { brand, name, link, expiresIn }, { locale }),
|
|
266
285
|
passwordChanged: ({ brand, name, link, locale }) => defaultRenderer().render("password-changed", { brand, name, link }, { locale }),
|
|
267
286
|
emailChanged: ({ brand, name, link, newEmail, locale }) => defaultRenderer().render("email-changed", { brand, name, link, newEmail }, { locale }),
|
|
268
287
|
twoFactorEnabled: ({ brand, name, link, locale }) => defaultRenderer().render("two-factor-enabled", { brand, name, link }, { locale }),
|
|
@@ -280,6 +299,7 @@ var TEMPLATE_NAMES = [
|
|
|
280
299
|
"signInCode",
|
|
281
300
|
"magicLink",
|
|
282
301
|
"stepUp",
|
|
302
|
+
"changeEmail",
|
|
283
303
|
"passwordChanged",
|
|
284
304
|
"emailChanged",
|
|
285
305
|
"twoFactorEnabled",
|
|
@@ -518,5 +538,5 @@ export {
|
|
|
518
538
|
janusTemplates
|
|
519
539
|
};
|
|
520
540
|
|
|
521
|
-
//# debugId=
|
|
541
|
+
//# debugId=2138CE83FAE73E6864756E2164756E21
|
|
522
542
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -4,23 +4,23 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * `expiresIn`: how long the link or the code of an e-mail stays valid, as\n * the text the e-mail shows — \"1 hour\", \"1 heure\". Derived from the\n * `expiresAt` the flow answered and the locale the recipient gets, unless the\n * send passes its own.\n */\nimport type { Clock } from '@nxgt/janus';\n\nconst MINUTE_MS = 60_000;\nconst MINUTES_IN_HOUR = 60;\nconst MINUTES_IN_DAY = 24 * MINUTES_IN_HOUR;\n\n/**\n * A duration in the locale, in the largest unit it holds at least once:\n * rounded to the minute first — the flow set `expiresAt` a moment before the\n * send, so an hour is 59 minutes and 59 seconds by then — and then down to a\n * whole unit: 90 minutes is \"1 hour\", 36 hours \"1 day\". At 30 seconds or\n * more, the e-mail never promises more than half a minute beyond what is\n * left; under that, it says \"1 minute\".\n *\n * ```ts\n * formatExpiry(3_600_000, 'fr'); // '1 heure'\n * ```\n */\nexport function formatExpiry(ms: number, locale: string): string {\n\tconst minutes = Math.max(1, Math.round(ms / MINUTE_MS));\n\tconst [value, unit] =\n\t\tminutes >= MINUTES_IN_DAY\n\t\t\t? [Math.floor(minutes / MINUTES_IN_DAY), 'day']\n\t\t\t: minutes >= MINUTES_IN_HOUR\n\t\t\t\t? [Math.floor(minutes / MINUTES_IN_HOUR), 'hour']\n\t\t\t\t: [minutes, 'minute'];\n\treturn new Intl.NumberFormat(locale, {\n\t\tstyle: 'unit',\n\t\tunit,\n\t\tunitDisplay: 'long',\n\t}).format(value);\n}\n\n/** The per-send `expiresIn`, when one was passed, or `undefined`; a `TypeError` when it is not a string. */\nfunction passedExpiresIn(method: string, options: unknown): string | undefined {\n\tconst read =\n\t\ttypeof options === 'object' && options !== null\n\t\t\t? (options as { expiresIn?: unknown }).expiresIn\n\t\t\t: undefined;\n\tif (read !== undefined && typeof read !== 'string') {\n\t\tthrow new TypeError(`janusMail.${method}: expiresIn must be a string`);\n\t}\n\treturn read;\n}\n\n/**\n * The `expiresIn` of one send: the one passed, as is, or the time left\n * until the flow's `expiresAt` by `clock` — the one given to `janus()`, when\n * it was given to `janusMail()` too — in `locale`. A `TypeError` naming the method\n * when `expiresAt` is not a valid `Date` — a flow's answer that went through\n * JSON holds a string there — or is already past.\n */\nexport function expiresInFor(\n\tmethod: string,\n\tissued: unknown,\n\tlocale: string,\n\toptions: unknown,\n\tclock: Clock,\n): string {\n\tconst passed = passedExpiresIn(method, options);\n\tif (passed !== undefined) return passed;\n\tconst expiresAt =\n\t\ttypeof issued === 'object' && issued !== null\n\t\t\t? (issued as { expiresAt?: unknown }).expiresAt\n\t\t\t: undefined;\n\tif (!(expiresAt instanceof Date) || Number.isNaN(expiresAt.getTime())) {\n\t\tthrow new TypeError(`janusMail.${method}: expiresAt must be a Date`);\n\t}\n\tconst now = clock.now();\n\tif (!(now instanceof Date) || Number.isNaN(now.getTime())) {\n\t\tthrow new TypeError(`janusMail.${method}: clock.now() must answer a Date`);\n\t}\n\tconst left = expiresAt.getTime() - now.getTime();\n\tif (left <= 0) {\n\t\tthrow new TypeError(\n\t\t\t`janusMail.${method}: expiresAt is past — the link or code would not work`,\n\t\t);\n\t}\n\treturn formatExpiry(left, locale);\n}\n",
|
|
6
6
|
"/**\n * What every method shares: reading an argument's fields, a link, the\n * recipient's locale, and the send itself. A wrong argument is a `TypeError`\n * naming the method and the field — never its value.\n */\nimport type { Address, Rendered, SentMail, WantedLocales } from '@nxgt/mail';\nimport { pickLocale } from '@nxgt/mail';\nimport type { ResolvedOptions } from './options';\nimport type { JanusMailTemplateName, JanusMailVariables } from './types';\n\n/** A string field of an argument, or a `TypeError` naming the method and the field. */\nexport function field(method: string, value: unknown, key: string): string {\n\tconst read =\n\t\ttypeof value === 'object' && value !== null\n\t\t\t? (value as Record<string, unknown>)[key]\n\t\t\t: undefined;\n\tif (typeof read !== 'string') {\n\t\tthrow new TypeError(`janusMail.${method}: ${key} must be a string`);\n\t}\n\treturn read;\n}\n\n/**\n * What a `links` function answered, or a `TypeError` naming the method and\n * the call. Its scheme is the renderer's to check: `http(s)` and `mailto:`\n * pass, anything else is its `MailRefused`.\n */\nexport function link(method: string, value: unknown, call: string): string {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`janusMail.${method}: links.${call} must answer a string`,\n\t\t);\n\t}\n\treturn value;\n}\n\n/** The locale the recipient gets: the first they want that is sent in, else the fallback. */\nexport function localeFor(options: ResolvedOptions, to: unknown): string {\n\tconst wanted =\n\t\ttypeof to === 'object' && to !== null\n\t\t\t? (to as { locale?: WantedLocales }).locale\n\t\t\t: undefined;\n\treturn pickLocale(wanted, options.locales, options.fallbackLocale);\n}\n\n/**\n * Renders one e-mail and hands it to the mailer. Only `subject`, `html` and\n * `text` are read from what the template answered: a template cannot add a\n * recipient or a header.\n */\nexport async function send<K extends JanusMailTemplateName>(\n\toptions: ResolvedOptions,\n\tname: K,\n\taddress: string,\n\tvariables: JanusMailVariables[K] & { readonly locale: string },\n): Promise<SentMail> {\n\tconst template = options.templates[name] as (\n\t\tvariables: JanusMailVariables[K] & { readonly locale: string },\n\t) => Rendered | PromiseLike<Rendered>;\n\tconst { subject, html, text }: Rendered = await template(variables);\n\tconst replyTo: { replyTo?: Address } =\n\t\toptions.replyTo === undefined ? {} : { replyTo: options.replyTo };\n\treturn options.mailer.send({\n\t\tto: address,\n\t\tfrom: options.from,\n\t\t...replyTo,\n\t\tsubject,\n\t\thtml,\n\t\ttext,\n\t});\n}\n",
|
|
7
|
-
"/**\n * The
|
|
7
|
+
"/**\n * The five e-mails that carry what a flow issued — a one-time link or a\n * sign-in code — and say how long it lasts: `verifyEmail`, `resetPassword`,\n * `signInCode`, `magicLink` and `changeEmail`.\n */\nimport { expiresInFor } from './expiry';\nimport type { ResolvedOptions } from './options';\nimport { field, link, localeFor, send } from './send';\nimport type { JanusMail } from './types';\n\ntype ExpiringMails = Pick<\n\tJanusMail<string>,\n\t'verifyEmail' | 'resetPassword' | 'signInCode' | 'magicLink' | 'changeEmail'\n>;\n\n/** The two e-mails of a one-time token, which link to your page with it. */\ntype LinkMailName = 'verifyEmail' | 'resetPassword';\n\n/** One e-mail of a one-time token: to `issued.email`, its link built from `issued.token`. */\nfunction linkMail(options: ResolvedOptions, name: LinkMailName) {\n\treturn async (issued: unknown, to: unknown, sendOptions?: unknown) => {\n\t\tconst token = field(name, issued, 'token');\n\t\tconst locale = localeFor(options, to);\n\t\treturn send(options, name, field(name, issued, 'email'), {\n\t\t\tbrand: options.brand,\n\t\t\tname: field(name, to, 'name'),\n\t\t\tlink: link(name, options.links[name](token), `${name}(token)`),\n\t\t\texpiresIn: expiresInFor(name, issued, locale, sendOptions, options.clock),\n\t\t\tlocale,\n\t\t});\n\t};\n}\n\n/**\n * The sign-in link's e-mail: to `issued.email`, greeting nobody, its link\n * built from `issued.token` by the optional `links.magicLink` — checked\n * before anything else is read, so a missing link is refused whatever the\n * arguments.\n */\nfunction magicLinkMail(options: ResolvedOptions) {\n\treturn async (issued: unknown, to: unknown, sendOptions?: unknown) => {\n\t\tconst build = options.links.magicLink;\n\t\tif (build === undefined) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'janusMail.magicLink: links.magicLink is missing — pass it to janusMail({ links }) to send sign-in links',\n\t\t\t);\n\t\t}\n\t\tconst token = field('magicLink', issued, 'token');\n\t\tconst locale = localeFor(options, to);\n\t\treturn send(options, 'magicLink', field('magicLink', issued, 'email'), {\n\t\t\tbrand: options.brand,\n\t\t\tlink: link('magicLink', build(token), 'magicLink(token)'),\n\t\t\texpiresIn: expiresInFor(\n\t\t\t\t'magicLink',\n\t\t\t\tissued,\n\t\t\t\tlocale,\n\t\t\t\tsendOptions,\n\t\t\t\toptions.clock,\n\t\t\t),\n\t\t\tlocale,\n\t\t});\n\t};\n}\n\n/**\n * The new address's confirmation: to `issued.email` — the NEW address —\n * greeting `to.name`, its link built from `issued.token` by the optional\n * `links.changeEmail`, checked before anything else is read.\n */\nfunction changeEmailMail(options: ResolvedOptions) {\n\treturn async (issued: unknown, to: unknown, sendOptions?: unknown) => {\n\t\tconst build = options.links.changeEmail;\n\t\tif (build === undefined) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'janusMail.changeEmail: links.changeEmail is missing — pass it to janusMail({ links }) to send e-mail change links',\n\t\t\t);\n\t\t}\n\t\tconst token = field('changeEmail', issued, 'token');\n\t\tconst locale = localeFor(options, to);\n\t\treturn send(options, 'changeEmail', field('changeEmail', issued, 'email'), {\n\t\t\tbrand: options.brand,\n\t\t\tname: field('changeEmail', to, 'name'),\n\t\t\tlink: link('changeEmail', build(token), 'changeEmail(token)'),\n\t\t\texpiresIn: expiresInFor(\n\t\t\t\t'changeEmail',\n\t\t\t\tissued,\n\t\t\t\tlocale,\n\t\t\t\tsendOptions,\n\t\t\t\toptions.clock,\n\t\t\t),\n\t\t\tlocale,\n\t\t});\n\t};\n}\n\n/** `verifyEmail`, `resetPassword`, `signInCode`, `magicLink` and `changeEmail`, over the resolved options. */\nexport function expiringMails(options: ResolvedOptions): ExpiringMails {\n\treturn {\n\t\tverifyEmail: linkMail(options, 'verifyEmail'),\n\t\tresetPassword: linkMail(options, 'resetPassword'),\n\t\tasync signInCode(issued, to, sendOptions) {\n\t\t\t// `code`, `email` and `expiresAt` only: the challenge is the visitor's secret.\n\t\t\tconst locale = localeFor(options, to);\n\t\t\treturn send(options, 'signInCode', field('signInCode', issued, 'email'), {\n\t\t\t\tbrand: options.brand,\n\t\t\t\tcode: field('signInCode', issued, 'code'),\n\t\t\t\texpiresIn: expiresInFor(\n\t\t\t\t\t'signInCode',\n\t\t\t\t\tissued,\n\t\t\t\t\tlocale,\n\t\t\t\t\tsendOptions,\n\t\t\t\t\toptions.clock,\n\t\t\t\t),\n\t\t\t\tlocale,\n\t\t\t});\n\t\t},\n\t\tmagicLink: magicLinkMail(options),\n\t\tchangeEmail: changeEmailMail(options),\n\t};\n}\n",
|
|
8
8
|
"/**\n * What `newSignIn` shows where the sender knew no location — \"Unknown\",\n * \"Inconnu\" — in the recipient's locale: the value after the row's label,\n * so \"Location Unknown\", \"Lieu Inconnu\".\n *\n * A map written here, not a message in `mail/locales/*.json`: those\n * catalogues are read by the Maizzle build alone, and hold only the\n * presets' own keys, which the build checks against `@nxgt/mail-presets`'\n * `en`. This string is a send's — whether a location was given is known\n * only then — so it is chosen at send time, as the codes left are\n * (`./codes-left`). Keyed by `JanusMailLocale`, so a locale added to the\n * build without its text here is a compile error.\n */\nimport type { JanusMailLocale } from './generated/locales';\n\n/** The text of a missing location, by built locale. */\nexport const NO_LOCATION: Readonly<Record<JanusMailLocale, string>> =\n\tObject.freeze({\n\t\ten: 'Unknown',\n\t\tfr: 'Inconnu',\n\t});\n\nfunction isBuilt(locale: string): locale is JanusMailLocale {\n\treturn Object.hasOwn(NO_LOCATION, locale);\n}\n\n/**\n * The text of a missing location in `locale` — the one `localeFor` picked —\n * else in its language (`fr` for `fr-CA`), else in `en`: a locale beyond\n * the built ones is sent only through templates of the consumer's own.\n */\nexport function noLocationText(locale: string): string {\n\tif (isBuilt(locale)) return NO_LOCATION[locale];\n\t// A language tag: `resolveOptions` refused anything else in `locales`.\n\tconst { language } = new Intl.Locale(locale);\n\treturn isBuilt(language) ? NO_LOCATION[language] : NO_LOCATION.en;\n}\n",
|
|
9
9
|
"/**\n * `newSignIn`: the notice of a sign-in from a device the user had not signed\n * in from — which device, when, and where when the sender knows — linking to\n * where the account is secured.\n *\n * Apart from the other notices because of its optional `location`: Janus\n * sees no IP, so the sender may know none, and the e-mail then says so in\n * the send's locale — \"Location Unknown\", \"Lieu Inconnu\" (`./no-location`).\n */\n\nimport { noLocationText } from './no-location';\nimport type { ResolvedOptions } from './options';\nimport { field, link, localeFor, send } from './send';\nimport type { JanusMail } from './types';\n\nconst METHOD = 'newSignIn';\n\n/**\n * The sender's location, the text of a missing one in `locale` without one,\n * or a `TypeError` for anything else.\n */\nfunction locationOf(signIn: unknown, locale: string): string {\n\tconst given =\n\t\ttypeof signIn === 'object' && signIn !== null\n\t\t\t? (signIn as { location?: unknown }).location\n\t\t\t: undefined;\n\tif (given === undefined) return noLocationText(locale);\n\treturn field(METHOD, signIn, 'location');\n}\n\n/** The new sign-in notice, over the resolved options. */\nexport function newSignInMail(\n\toptions: ResolvedOptions,\n): Pick<JanusMail<string>, 'newSignIn'> {\n\tconst { brand, links } = options;\n\treturn {\n\t\t// Async, so a wrong argument rejects as the other methods' do.\n\t\tasync newSignIn(to, signIn) {\n\t\t\tconst locale = localeFor(options, to);\n\t\t\treturn send(options, METHOD, field(METHOD, to, 'email'), {\n\t\t\t\tbrand,\n\t\t\t\tname: field(METHOD, to, 'name'),\n\t\t\t\tdevice: field(METHOD, signIn, 'device'),\n\t\t\t\tlocation: locationOf(signIn, locale),\n\t\t\t\ttime: field(METHOD, signIn, 'time'),\n\t\t\t\tlink: link(METHOD, links.secureAccount(), 'secureAccount()'),\n\t\t\t\tlocale,\n\t\t\t});\n\t\t},\n\t};\n}\n",
|
|
10
10
|
"/**\n * The e-mails about the account itself, sent on what happened to it rather\n * than on a flow's answer: the notices of a change the user made — or someone\n * else did — `passwordChanged`, `emailChanged`, `twoFactorEnabled` and\n * `twoFactorDisabled`, each linking to where the account is secured; and\n * `welcome`, once it was created, linking to where a new user starts.\n */\nimport type { ResolvedOptions } from './options';\nimport { field, link, localeFor, send } from './send';\nimport type { JanusMail } from './types';\n\ntype NoticeMails = Pick<\n\tJanusMail<string>,\n\t| 'passwordChanged'\n\t| 'emailChanged'\n\t| 'twoFactorEnabled'\n\t| 'twoFactorDisabled'\n\t| 'welcome'\n>;\n\n/** The e-mails that greet `to.name` at `to.email`, and link to one of `links`. */\ntype PlainNotice =\n\t| 'passwordChanged'\n\t| 'twoFactorEnabled'\n\t| 'twoFactorDisabled'\n\t| 'welcome';\n\n/** The links a plain notice may take: those called with nothing. */\ntype PlainLink = 'secureAccount' | 'getStarted';\n\n/** The notices and the welcome, over the resolved options. */\nexport function noticeMails(options: ResolvedOptions): NoticeMails {\n\tconst { brand, links } = options;\n\tconst plain =\n\t\t(method: PlainNotice, target: PlainLink) =>\n\t\t// Async, so a wrong argument rejects as the other methods' do.\n\t\tasync (to: unknown): ReturnType<NoticeMails[PlainNotice]> =>\n\t\t\tsend(options, method, field(method, to, 'email'), {\n\t\t\t\tbrand,\n\t\t\t\tname: field(method, to, 'name'),\n\t\t\t\tlink: link(method, links[target](), `${target}()`),\n\t\t\t\tlocale: localeFor(options, to),\n\t\t\t});\n\treturn {\n\t\tpasswordChanged: plain('passwordChanged', 'secureAccount'),\n\t\ttwoFactorEnabled: plain('twoFactorEnabled', 'secureAccount'),\n\t\ttwoFactorDisabled: plain('twoFactorDisabled', 'secureAccount'),\n\t\twelcome: plain('welcome', 'getStarted'),\n\t\tasync emailChanged(to) {\n\t\t\t// To the former address: the one a hijacker just took the account from.\n\t\t\treturn send(\n\t\t\t\toptions,\n\t\t\t\t'emailChanged',\n\t\t\t\tfield('emailChanged', to, 'formerEmail'),\n\t\t\t\t{\n\t\t\t\t\tbrand,\n\t\t\t\t\tname: field('emailChanged', to, 'name'),\n\t\t\t\t\tlink: link('emailChanged', links.secureAccount(), 'secureAccount()'),\n\t\t\t\t\tnewEmail: field('emailChanged', to, 'newEmail'),\n\t\t\t\t\tlocale: localeFor(options, to),\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t};\n}\n",
|
|
11
11
|
"// Generated by scripts/build-mail.ts from mails/mail-manifest.json, after\n// each build of the default e-mails. Never edited; committed.\n\n/** The locales the default e-mails are built in, the fallback locale first. */\nexport const LOCALES = ['en', 'fr'] as const;\n\n/** A locale the default e-mails are built in. */\nexport type JanusMailLocale = (typeof LOCALES)[number];\n",
|
|
12
12
|
"/** A wiring refusal of `janusMail()`: a `TypeError` naming the option. */\nexport function refuse(message: string): never {\n\tthrow new TypeError(`janusMail: ${message}`);\n}\n",
|
|
13
|
-
"/**\n * `janusMail()`'s `links`, checked once when it is called and copied, so\n * the guarantee made there holds at every send. A mistake is a wiring\n * mistake: a bare `TypeError` naming the link, never its value.\n */\nimport { refuse } from './refuse';\nimport type { JanusMailLinks } from './types';\n\n/** The links every `janusMail()` needs: checked, then copied, by these names. */\nconst REQUIRED_LINKS = [\n\t'verifyEmail',\n\t'resetPassword',\n\t'secureAccount',\n\t'getStarted',\n] as const;\n\n/**\n * The links a `janusMail()` may leave out: `recoveryCodes` falls back to\n * `secureAccount`; `magicLink`
|
|
13
|
+
"/**\n * `janusMail()`'s `links`, checked once when it is called and copied, so\n * the guarantee made there holds at every send. A mistake is a wiring\n * mistake: a bare `TypeError` naming the link, never its value.\n */\nimport { refuse } from './refuse';\nimport type { JanusMailLinks } from './types';\n\n/** The links every `janusMail()` needs: checked, then copied, by these names. */\nconst REQUIRED_LINKS = [\n\t'verifyEmail',\n\t'resetPassword',\n\t'secureAccount',\n\t'getStarted',\n] as const;\n\n/**\n * The links a `janusMail()` may leave out: `recoveryCodes` falls back to\n * `secureAccount`; `magicLink` and `changeEmail` have none, and their sends are refused\n * without it.\n */\nconst OPTIONAL_LINKS = ['recoveryCodes', 'magicLink', 'changeEmail'] as const;\n\n/** `links`: an object of functions, every required one there. */\nexport function checkLinks(\n\tlinks: unknown,\n): asserts links is Record<string, unknown> {\n\tif (typeof links !== 'object' || links === null || Array.isArray(links)) {\n\t\trefuse(\n\t\t\t'links must be an object, as { verifyEmail, resetPassword, secureAccount, getStarted }',\n\t\t);\n\t}\n\tconst given = links as Record<string, unknown>;\n\tfor (const name of REQUIRED_LINKS) {\n\t\tif (typeof given[name] !== 'function') {\n\t\t\trefuse(`links.${name} must be a function`);\n\t\t}\n\t}\n\tfor (const name of OPTIONAL_LINKS) {\n\t\tif (given[name] !== undefined && typeof given[name] !== 'function') {\n\t\t\trefuse(`links.${name} must be a function, or left out`);\n\t\t}\n\t}\n}\n\n/**\n * A frozen copy of the checked links, each bound to the caller's object — a\n * class instance's methods keep their `this` — so replacing a link after\n * `janusMail()` cannot undo the check. An optional link left out stays out.\n */\nexport function frozenLinks(links: JanusMailLinks): JanusMailLinks {\n\tconst given = links as unknown as Record<\n\t\tstring,\n\t\t((...args: never[]) => unknown) | undefined\n\t>;\n\tconst names = [\n\t\t...REQUIRED_LINKS,\n\t\t...OPTIONAL_LINKS.filter((name) => given[name] !== undefined),\n\t];\n\t// Every name kept was checked a function by checkLinks.\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tnames.map((name) => [\n\t\t\t\tname,\n\t\t\t\t(given[name] as (...args: never[]) => unknown).bind(links),\n\t\t\t]),\n\t\t),\n\t) as unknown as JanusMailLinks;\n}\n",
|
|
14
14
|
"/**\n * Where the default e-mails are, and the one renderer that reads them.\n *\n * The package ships the built e-mails in `mails/`, beside `dist/` — not in\n * it, because the root `build.ts` removes from `dist/` every file it did not\n * write itself.\n */\nimport { fileURLToPath } from 'node:url';\nimport { createMailRenderer, type MailRenderer } from '@nxgt/mail/renderer';\nimport type { MailEmails } from './generated/mail';\n\n/**\n * The folder of the built e-mails, resolved from this module rather than from\n * the working directory, which is the consumer's.\n *\n * **This file must stay directly under `src/`.** `../mails/` is right from\n * `src/mails.ts` in the specs, and from `dist/index.js` in the tarball,\n * because the build bundles this module into the single entry\n * `dist/index.js`, one level under the package as `src/` is. Moved into a\n * subfolder, or bundled into `dist/chunks/` by a second entry point, it would\n * resolve a folder that does not exist — which the artifact spec, rendering\n * from `../dist`, would catch.\n */\nexport const MAILS_DIR = fileURLToPath(new URL('../mails/', import.meta.url));\n\nlet renderer: MailRenderer<MailEmails> | undefined;\n\n/**\n * The renderer of the default e-mails, created on first use and shared by\n * every `janusMail()` and `janusTemplates()` after it.\n *\n * Lazy, so importing the package reads nothing: an application that\n * overrides every template never opens `mails/`. The first default template\n * rendered reads the whole build once — a missing `mails/` throws there, with\n * `createMailRenderer`'s own message.\n */\nexport function defaultRenderer(): MailRenderer<MailEmails> {\n\trenderer ??= createMailRenderer<MailEmails>({ dir: MAILS_DIR });\n\treturn renderer;\n}\n",
|
|
15
|
-
"/**\n * The default templates: the prebuilt e-mails, filled by `@nxgt/mail`'s\n * renderer. Each picks from its variables exactly what its e-mail takes — the\n * renderer refuses a variable too many — so the `locale` beside them goes to\n * the renderer's options, and nowhere else.\n */\nimport type { Rendered } from '@nxgt/mail';\nimport { defaultRenderer } from './mails';\nimport type { JanusMailTemplates } from './types';\n\n/** The two whose variables fill a summary, apart to keep the list short. */\nconst recoveryCodeUsed: JanusMailTemplates['recoveryCodeUsed'] = ({\n\tbrand,\n\tname,\n\twhen,\n\trecoveryCodesLeft,\n\tlink,\n\tlocale,\n}): Rendered =>\n\tdefaultRenderer().render(\n\t\t'recovery-code-used',\n\t\t{ brand, name, when, recoveryCodesLeft, link },\n\t\t{ locale },\n\t);\n\nconst newSignIn: JanusMailTemplates['newSignIn'] = ({\n\tbrand,\n\tname,\n\tdevice,\n\tlocation,\n\ttime,\n\tlink,\n\tlocale,\n}): Rendered =>\n\tdefaultRenderer().render(\n\t\t'new-sign-in',\n\t\t{ brand, name, device, location, time, link },\n\t\t{ locale },\n\t);\n\n/**\n * The
|
|
16
|
-
"/**\n * `janusMail()`'s options, checked once when it is called. A mistake is a\n * wiring mistake, so a bare `TypeError` naming the option — never its value —\n * thrown before anything is sent.\n */\nimport type { Clock } from '@nxgt/janus';\nimport type { Address, Mailer } from '@nxgt/mail';\nimport { LOCALES } from './generated/locales';\nimport { checkLinks, frozenLinks } from './links';\nimport { refuse } from './refuse';\nimport { janusTemplates } from './templates';\nimport type {\n\tJanusMailLinks,\n\tJanusMailTemplateName,\n\tJanusMailTemplates,\n} from './types';\n\n/** The templates in the order the documentation lists them. */\nexport const TEMPLATE_NAMES: readonly JanusMailTemplateName[] = [\n\t'verifyEmail',\n\t'resetPassword',\n\t'signInCode',\n\t'magicLink',\n\t'stepUp',\n\t'passwordChanged',\n\t'emailChanged',\n\t'twoFactorEnabled',\n\t'twoFactorDisabled',\n\t'recoveryCodeUsed',\n\t'newSignIn',\n\t'welcome',\n];\n\n/** The options once checked, with `string` for the locales: the degenericised mirror. */\nexport interface ResolvedOptions {\n\treadonly mailer: Mailer;\n\treadonly from: Address;\n\treadonly replyTo: Address | undefined;\n\treadonly brand: string;\n\treadonly links: JanusMailLinks;\n\treadonly locales: readonly string[];\n\treadonly fallbackLocale: string;\n\treadonly templates: JanusMailTemplates<string>;\n\treadonly clock: Clock;\n}\n\n/** The system clock, written here: `@nxgt/janus` is a peer for its types only. */\nconst SYSTEM_CLOCK: Clock = Object.freeze({ now: () => new Date() });\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isAddress(value: unknown): value is Address {\n\tif (typeof value === 'string') return value.trim() !== '';\n\treturn (\n\t\tisObject(value) &&\n\t\ttypeof value['name'] === 'string' &&\n\t\ttypeof value['address'] === 'string' &&\n\t\tvalue['address'].trim() !== ''\n\t);\n}\n\n/** `mailer`, `from`, `replyTo`, `brand` and `links` (`./links`). */\nfunction checkSending(options: Record<string, unknown>): void {\n\tconst { mailer, from, replyTo, brand, links } = options;\n\tif (!isObject(mailer) || typeof mailer['send'] !== 'function') {\n\t\trefuse('mailer must be a Mailer — an object with a send function');\n\t}\n\tif (!isAddress(from)) {\n\t\trefuse(\n\t\t\t\"from must be an address, as 'noreply@example.com' or { name, address }\",\n\t\t);\n\t}\n\tif (replyTo !== undefined && !isAddress(replyTo)) {\n\t\trefuse(\n\t\t\t\"replyTo must be an address, as 'support@example.com' or { name, address }\",\n\t\t);\n\t}\n\tif (typeof brand !== 'string' || brand.trim() === '') {\n\t\trefuse(\"brand must be the name the e-mails show, as 'Acme'\");\n\t}\n\tcheckLinks(links);\n}\n\n/** `clock`, bound to the caller's object, or the system clock. */\nfunction resolveClock(clock: unknown): Clock {\n\tif (clock === undefined) return SYSTEM_CLOCK;\n\tif (!isObject(clock) || typeof clock['now'] !== 'function') {\n\t\trefuse('clock must be a Clock — an object with a now function');\n\t}\n\treturn Object.freeze({ now: (clock['now'] as () => Date).bind(clock) });\n}\n\n/** Whether `Intl` takes the locale — the expiry is formatted in it — as `fr-CA`, not `fr_CA`. */\nfunction isLanguageTag(locale: string): boolean {\n\ttry {\n\t\tIntl.getCanonicalLocales(locale);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** `locales` and `fallbackLocale`, with their defaults. */\nfunction resolveLocales(options: Record<string, unknown>): {\n\tlocales: readonly string[];\n\tfallbackLocale: string;\n} {\n\tconst wanted = options['locales'] ?? LOCALES;\n\tif (\n\t\t!Array.isArray(wanted) ||\n\t\twanted.length === 0 ||\n\t\t!wanted.every((locale) => typeof locale === 'string' && locale !== '')\n\t) {\n\t\trefuse(\"locales must list at least one locale, as ['en', 'fr']\");\n\t}\n\tconst locales: readonly string[] = Object.freeze([...wanted]);\n\tif (!locales.every(isLanguageTag)) {\n\t\trefuse(\"locales must be BCP 47 language tags, as 'fr-CA'\");\n\t}\n\tif (new Set(locales).size !== locales.length) {\n\t\trefuse('locales holds the same locale twice');\n\t}\n\tconst fallbackLocale =\n\t\toptions['fallbackLocale'] ??\n\t\t(locales.includes('en') ? 'en' : (locales[0] as string));\n\tif (typeof fallbackLocale !== 'string' || !locales.includes(fallbackLocale)) {\n\t\trefuse('fallbackLocale must be one of locales');\n\t}\n\treturn { locales, fallbackLocale };\n}\n\n/** `templates` over the defaults — the defaults only while every locale is built. */\nfunction resolveTemplates(\n\toptions: Record<string, unknown>,\n\tlocales: readonly string[],\n): JanusMailTemplates<string> {\n\tconst given = options['templates'] ?? {};\n\tif (!isObject(given)) {\n\t\trefuse(\n\t\t\t'templates must be an object of functions, as { verifyEmail: (variables) => rendered }',\n\t\t);\n\t}\n\tfor (const [name, template] of Object.entries(given)) {\n\t\tif (!(TEMPLATE_NAMES as readonly string[]).includes(name)) {\n\t\t\trefuse(\n\t\t\t\t`templates has no template ${name} — name one of ${TEMPLATE_NAMES.join(', ')}`,\n\t\t\t);\n\t\t}\n\t\tif (typeof template !== 'function') {\n\t\t\trefuse(`templates.${name} must be a function`);\n\t\t}\n\t}\n\t// Own enumerable keys, the ones the spread below copies. A template on a\n\t// prototype — a class instance's method — or an own property that is not\n\t// enumerable would be dropped without a word, the default sent in its\n\t// place: `in` sees it and `passed` does not, so it is refused instead.\n\tconst passed = Object.keys(given);\n\tfor (const name of TEMPLATE_NAMES) {\n\t\tif (name in given && !passed.includes(name)) {\n\t\t\trefuse(\n\t\t\t\t`templates.${name} is not an own enumerable property — pass a plain object, as { ${name}: (variables) => rendered }`,\n\t\t\t);\n\t\t}\n\t}\n\tconst built = locales.every((locale) =>\n\t\t(LOCALES as readonly string[]).includes(locale),\n\t);\n\tconst missing = TEMPLATE_NAMES.filter((name) => !passed.includes(name));\n\tif (!built && missing.length > 0) {\n\t\trefuse(\n\t\t\t`the default templates are built in ${LOCALES.join(' and ')} only — with another ` +\n\t\t\t\t`locale in locales, pass every template in templates; ${missing.join(', ')} missing`,\n\t\t);\n\t}\n\t// The one cast: a default template takes a built locale only, and the check\n\t// above proves every locale is one whenever a default is kept.\n\tconst defaults = janusTemplates() as unknown as JanusMailTemplates<string>;\n\treturn Object.freeze({ ...defaults, ...given }) as JanusMailTemplates<string>;\n}\n\n/** A frozen copy of a checked address: a later change to the caller's object is not seen. */\nfunction frozenAddress(address: Address): Address {\n\treturn typeof address === 'string'\n\t\t? address\n\t\t: Object.freeze({ name: address.name, address: address.address });\n}\n\n/**\n * Checks `janusMail()`'s options and answers them resolved, or throws a\n * `TypeError`. What was checked is copied and frozen, so the guarantee made\n * here holds at every send.\n */\nexport function resolveOptions(options: unknown): ResolvedOptions {\n\tif (!isObject(options)) {\n\t\trefuse('options must be an object, as { mailer, from, brand, links }');\n\t}\n\tcheckSending(options);\n\tconst { locales, fallbackLocale } = resolveLocales(options);\n\treturn Object.freeze({\n\t\tmailer: options['mailer'] as Mailer,\n\t\tfrom: frozenAddress(options['from'] as Address),\n\t\treplyTo:\n\t\t\toptions['replyTo'] === undefined\n\t\t\t\t? undefined\n\t\t\t\t: frozenAddress(options['replyTo'] as Address),\n\t\tbrand: options['brand'] as string,\n\t\tlinks: frozenLinks(options['links'] as unknown as JanusMailLinks),\n\t\tlocales,\n\t\tfallbackLocale,\n\t\ttemplates: resolveTemplates(options, locales),\n\t\tclock: resolveClock(options['clock']),\n\t});\n}\n",
|
|
15
|
+
"/**\n * The default templates: the prebuilt e-mails, filled by `@nxgt/mail`'s\n * renderer. Each picks from its variables exactly what its e-mail takes — the\n * renderer refuses a variable too many — so the `locale` beside them goes to\n * the renderer's options, and nowhere else.\n */\nimport type { Rendered } from '@nxgt/mail';\nimport { defaultRenderer } from './mails';\nimport type { JanusMailTemplates } from './types';\n\n/** The two whose variables fill a summary, apart to keep the list short. */\nconst recoveryCodeUsed: JanusMailTemplates['recoveryCodeUsed'] = ({\n\tbrand,\n\tname,\n\twhen,\n\trecoveryCodesLeft,\n\tlink,\n\tlocale,\n}): Rendered =>\n\tdefaultRenderer().render(\n\t\t'recovery-code-used',\n\t\t{ brand, name, when, recoveryCodesLeft, link },\n\t\t{ locale },\n\t);\n\nconst newSignIn: JanusMailTemplates['newSignIn'] = ({\n\tbrand,\n\tname,\n\tdevice,\n\tlocation,\n\ttime,\n\tlink,\n\tlocale,\n}): Rendered =>\n\tdefaultRenderer().render(\n\t\t'new-sign-in',\n\t\t{ brand, name, device, location, time, link },\n\t\t{ locale },\n\t);\n\n/**\n * The thirteen default templates, in the locales they are built in. The\n * renderer behind them is created on the first render, not here.\n *\n * ```ts\n * const defaults = janusTemplates();\n * const { subject } = await defaults.verifyEmail({ brand: 'Acme', name: 'Ada', link, locale: 'fr' });\n * ```\n *\n * A URL that is not `http:`, `https:` or `mailto:` throws `MailRefused`; a\n * missing `mails/` folder throws when the first one renders.\n */\nexport function janusTemplates(): JanusMailTemplates {\n\treturn Object.freeze({\n\t\tverifyEmail: ({ brand, name, link, expiresIn, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'verify-email',\n\t\t\t\t{ brand, name, link, expiresIn },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tresetPassword: ({ brand, name, link, expiresIn, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'reset-password',\n\t\t\t\t{ brand, name, link, expiresIn },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tsignInCode: ({ brand, code, expiresIn, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'sign-in-code',\n\t\t\t\t{ brand, code, expiresIn },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tmagicLink: ({ brand, link, expiresIn, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'magic-link',\n\t\t\t\t{ brand, link, expiresIn },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tstepUp: ({ brand, name, code, expiresIn, link, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'confirm-action',\n\t\t\t\t{ brand, name, code, expiresIn, link },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tchangeEmail: ({ brand, name, link, expiresIn, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'confirm-new-email',\n\t\t\t\t{ brand, name, link, expiresIn },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\tpasswordChanged: ({ brand, name, link, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'password-changed',\n\t\t\t\t{ brand, name, link },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\temailChanged: ({ brand, name, link, newEmail, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'email-changed',\n\t\t\t\t{ brand, name, link, newEmail },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\ttwoFactorEnabled: ({ brand, name, link, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'two-factor-enabled',\n\t\t\t\t{ brand, name, link },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\ttwoFactorDisabled: ({ brand, name, link, locale }): Rendered =>\n\t\t\tdefaultRenderer().render(\n\t\t\t\t'two-factor-disabled',\n\t\t\t\t{ brand, name, link },\n\t\t\t\t{ locale },\n\t\t\t),\n\t\trecoveryCodeUsed,\n\t\tnewSignIn,\n\t\twelcome: ({ brand, name, link, locale }): Rendered =>\n\t\t\tdefaultRenderer().render('welcome', { brand, name, link }, { locale }),\n\t});\n}\n",
|
|
16
|
+
"/**\n * `janusMail()`'s options, checked once when it is called. A mistake is a\n * wiring mistake, so a bare `TypeError` naming the option — never its value —\n * thrown before anything is sent.\n */\nimport type { Clock } from '@nxgt/janus';\nimport type { Address, Mailer } from '@nxgt/mail';\nimport { LOCALES } from './generated/locales';\nimport { checkLinks, frozenLinks } from './links';\nimport { refuse } from './refuse';\nimport { janusTemplates } from './templates';\nimport type {\n\tJanusMailLinks,\n\tJanusMailTemplateName,\n\tJanusMailTemplates,\n} from './types';\n\n/** The templates in the order the documentation lists them. */\nexport const TEMPLATE_NAMES: readonly JanusMailTemplateName[] = [\n\t'verifyEmail',\n\t'resetPassword',\n\t'signInCode',\n\t'magicLink',\n\t'stepUp',\n\t'changeEmail',\n\t'passwordChanged',\n\t'emailChanged',\n\t'twoFactorEnabled',\n\t'twoFactorDisabled',\n\t'recoveryCodeUsed',\n\t'newSignIn',\n\t'welcome',\n];\n\n/** The options once checked, with `string` for the locales: the degenericised mirror. */\nexport interface ResolvedOptions {\n\treadonly mailer: Mailer;\n\treadonly from: Address;\n\treadonly replyTo: Address | undefined;\n\treadonly brand: string;\n\treadonly links: JanusMailLinks;\n\treadonly locales: readonly string[];\n\treadonly fallbackLocale: string;\n\treadonly templates: JanusMailTemplates<string>;\n\treadonly clock: Clock;\n}\n\n/** The system clock, written here: `@nxgt/janus` is a peer for its types only. */\nconst SYSTEM_CLOCK: Clock = Object.freeze({ now: () => new Date() });\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isAddress(value: unknown): value is Address {\n\tif (typeof value === 'string') return value.trim() !== '';\n\treturn (\n\t\tisObject(value) &&\n\t\ttypeof value['name'] === 'string' &&\n\t\ttypeof value['address'] === 'string' &&\n\t\tvalue['address'].trim() !== ''\n\t);\n}\n\n/** `mailer`, `from`, `replyTo`, `brand` and `links` (`./links`). */\nfunction checkSending(options: Record<string, unknown>): void {\n\tconst { mailer, from, replyTo, brand, links } = options;\n\tif (!isObject(mailer) || typeof mailer['send'] !== 'function') {\n\t\trefuse('mailer must be a Mailer — an object with a send function');\n\t}\n\tif (!isAddress(from)) {\n\t\trefuse(\n\t\t\t\"from must be an address, as 'noreply@example.com' or { name, address }\",\n\t\t);\n\t}\n\tif (replyTo !== undefined && !isAddress(replyTo)) {\n\t\trefuse(\n\t\t\t\"replyTo must be an address, as 'support@example.com' or { name, address }\",\n\t\t);\n\t}\n\tif (typeof brand !== 'string' || brand.trim() === '') {\n\t\trefuse(\"brand must be the name the e-mails show, as 'Acme'\");\n\t}\n\tcheckLinks(links);\n}\n\n/** `clock`, bound to the caller's object, or the system clock. */\nfunction resolveClock(clock: unknown): Clock {\n\tif (clock === undefined) return SYSTEM_CLOCK;\n\tif (!isObject(clock) || typeof clock['now'] !== 'function') {\n\t\trefuse('clock must be a Clock — an object with a now function');\n\t}\n\treturn Object.freeze({ now: (clock['now'] as () => Date).bind(clock) });\n}\n\n/** Whether `Intl` takes the locale — the expiry is formatted in it — as `fr-CA`, not `fr_CA`. */\nfunction isLanguageTag(locale: string): boolean {\n\ttry {\n\t\tIntl.getCanonicalLocales(locale);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** `locales` and `fallbackLocale`, with their defaults. */\nfunction resolveLocales(options: Record<string, unknown>): {\n\tlocales: readonly string[];\n\tfallbackLocale: string;\n} {\n\tconst wanted = options['locales'] ?? LOCALES;\n\tif (\n\t\t!Array.isArray(wanted) ||\n\t\twanted.length === 0 ||\n\t\t!wanted.every((locale) => typeof locale === 'string' && locale !== '')\n\t) {\n\t\trefuse(\"locales must list at least one locale, as ['en', 'fr']\");\n\t}\n\tconst locales: readonly string[] = Object.freeze([...wanted]);\n\tif (!locales.every(isLanguageTag)) {\n\t\trefuse(\"locales must be BCP 47 language tags, as 'fr-CA'\");\n\t}\n\tif (new Set(locales).size !== locales.length) {\n\t\trefuse('locales holds the same locale twice');\n\t}\n\tconst fallbackLocale =\n\t\toptions['fallbackLocale'] ??\n\t\t(locales.includes('en') ? 'en' : (locales[0] as string));\n\tif (typeof fallbackLocale !== 'string' || !locales.includes(fallbackLocale)) {\n\t\trefuse('fallbackLocale must be one of locales');\n\t}\n\treturn { locales, fallbackLocale };\n}\n\n/** `templates` over the defaults — the defaults only while every locale is built. */\nfunction resolveTemplates(\n\toptions: Record<string, unknown>,\n\tlocales: readonly string[],\n): JanusMailTemplates<string> {\n\tconst given = options['templates'] ?? {};\n\tif (!isObject(given)) {\n\t\trefuse(\n\t\t\t'templates must be an object of functions, as { verifyEmail: (variables) => rendered }',\n\t\t);\n\t}\n\tfor (const [name, template] of Object.entries(given)) {\n\t\tif (!(TEMPLATE_NAMES as readonly string[]).includes(name)) {\n\t\t\trefuse(\n\t\t\t\t`templates has no template ${name} — name one of ${TEMPLATE_NAMES.join(', ')}`,\n\t\t\t);\n\t\t}\n\t\tif (typeof template !== 'function') {\n\t\t\trefuse(`templates.${name} must be a function`);\n\t\t}\n\t}\n\t// Own enumerable keys, the ones the spread below copies. A template on a\n\t// prototype — a class instance's method — or an own property that is not\n\t// enumerable would be dropped without a word, the default sent in its\n\t// place: `in` sees it and `passed` does not, so it is refused instead.\n\tconst passed = Object.keys(given);\n\tfor (const name of TEMPLATE_NAMES) {\n\t\tif (name in given && !passed.includes(name)) {\n\t\t\trefuse(\n\t\t\t\t`templates.${name} is not an own enumerable property — pass a plain object, as { ${name}: (variables) => rendered }`,\n\t\t\t);\n\t\t}\n\t}\n\tconst built = locales.every((locale) =>\n\t\t(LOCALES as readonly string[]).includes(locale),\n\t);\n\tconst missing = TEMPLATE_NAMES.filter((name) => !passed.includes(name));\n\tif (!built && missing.length > 0) {\n\t\trefuse(\n\t\t\t`the default templates are built in ${LOCALES.join(' and ')} only — with another ` +\n\t\t\t\t`locale in locales, pass every template in templates; ${missing.join(', ')} missing`,\n\t\t);\n\t}\n\t// The one cast: a default template takes a built locale only, and the check\n\t// above proves every locale is one whenever a default is kept.\n\tconst defaults = janusTemplates() as unknown as JanusMailTemplates<string>;\n\treturn Object.freeze({ ...defaults, ...given }) as JanusMailTemplates<string>;\n}\n\n/** A frozen copy of a checked address: a later change to the caller's object is not seen. */\nfunction frozenAddress(address: Address): Address {\n\treturn typeof address === 'string'\n\t\t? address\n\t\t: Object.freeze({ name: address.name, address: address.address });\n}\n\n/**\n * Checks `janusMail()`'s options and answers them resolved, or throws a\n * `TypeError`. What was checked is copied and frozen, so the guarantee made\n * here holds at every send.\n */\nexport function resolveOptions(options: unknown): ResolvedOptions {\n\tif (!isObject(options)) {\n\t\trefuse('options must be an object, as { mailer, from, brand, links }');\n\t}\n\tcheckSending(options);\n\tconst { locales, fallbackLocale } = resolveLocales(options);\n\treturn Object.freeze({\n\t\tmailer: options['mailer'] as Mailer,\n\t\tfrom: frozenAddress(options['from'] as Address),\n\t\treplyTo:\n\t\t\toptions['replyTo'] === undefined\n\t\t\t\t? undefined\n\t\t\t\t: frozenAddress(options['replyTo'] as Address),\n\t\tbrand: options['brand'] as string,\n\t\tlinks: frozenLinks(options['links'] as unknown as JanusMailLinks),\n\t\tlocales,\n\t\tfallbackLocale,\n\t\ttemplates: resolveTemplates(options, locales),\n\t\tclock: resolveClock(options['clock']),\n\t});\n}\n",
|
|
17
17
|
"// Generated by scripts/build-mail.ts from recovery-code-used.codes-left, after\n// each build of the default e-mails. Never edited; committed.\n\n/** Each locale's plural for the recovery codes left: branches by selector, `null` where the count goes. */\nexport const CODES_LEFT: Readonly<Record<string, Readonly<Record<string, readonly (string | null)[]>>>> = {\n\t\"en\": {\n\t\t\"=0\": [\n\t\t\t\"You have no recovery codes left.\"\n\t\t],\n\t\t\"one\": [\n\t\t\t\"You have \",\n\t\t\tnull,\n\t\t\t\" recovery code left.\"\n\t\t],\n\t\t\"other\": [\n\t\t\t\"You have \",\n\t\t\tnull,\n\t\t\t\" recovery codes left.\"\n\t\t]\n\t},\n\t\"fr\": {\n\t\t\"=0\": [\n\t\t\t\"Il ne vous reste aucun code de récupération.\"\n\t\t],\n\t\t\"one\": [\n\t\t\t\"Il vous reste \",\n\t\t\tnull,\n\t\t\t\" code de récupération.\"\n\t\t],\n\t\t\"other\": [\n\t\t\t\"Il vous reste \",\n\t\t\tnull,\n\t\t\t\" codes de récupération.\"\n\t\t]\n\t}\n};\n",
|
|
18
18
|
"/**\n * The sentence of the recovery codes left, in the recipient's locale:\n * \"You have 1 recovery code left.\" — the `recovery-code-used` e-mail's\n * `recoveryCodesLeft`, which the build could not write since the count is a\n * send's.\n *\n * Formatted from `src/generated/codes-left.ts`, the preset's ICU plural\n * parsed at our build, as `@nxgt/mail-i18n`'s `createTranslator` formats\n * it: an exact branch (`=0`) first, then the locale's plural category, then\n * `other`, with `#` as the count in the locale's digits. No Maizzle and no\n * ICU parser at send time.\n */\nimport { CODES_LEFT } from './generated/codes-left';\n\n/**\n * The sentence for `count` codes left in `locale`, or `undefined` for a\n * locale the default e-mails are not built in.\n */\nexport function codesLeftText(\n\tlocale: string,\n\tcount: number,\n): string | undefined {\n\tif (!Object.hasOwn(CODES_LEFT, locale)) return undefined;\n\tconst branches = CODES_LEFT[locale] as (typeof CODES_LEFT)[string];\n\tconst branch =\n\t\tbranches[`=${count}`] ??\n\t\tbranches[new Intl.PluralRules(locale).select(count)] ??\n\t\tbranches['other'];\n\tconst digits = new Intl.NumberFormat(locale).format(count);\n\treturn (branch ?? []).map((part) => part ?? digits).join('');\n}\n",
|
|
19
19
|
"/**\n * `recoveryCodeUsed`: the notice of a recovery code spent — a sign-in\n * without the user's phone — saying when, and how many codes are left.\n *\n * Apart from the other notices because of its count: the build could not\n * choose the plural, so the send does, in the recipient's locale\n * (`./codes-left`).\n */\nimport { codesLeftText } from './codes-left';\nimport type { ResolvedOptions } from './options';\nimport { field, link, localeFor, send } from './send';\nimport type { JanusMail } from './types';\n\nconst METHOD = 'recoveryCodeUsed';\n\n/** A count of codes: a whole number, 0 or more. */\nconst isCount = (value: unknown): value is number =>\n\ttypeof value === 'number' && Number.isSafeInteger(value) && value >= 0;\n\n/**\n * The sentence of the codes left: the count formatted in `locale`, or the\n * sender's own text. A `TypeError` for anything else, or for a count in a\n * locale the default e-mails hold no sentence for.\n */\nfunction codesLeft(used: unknown, locale: string): string {\n\tconst given =\n\t\ttypeof used === 'object' && used !== null\n\t\t\t? (used as { recoveryCodesLeft?: unknown }).recoveryCodesLeft\n\t\t\t: undefined;\n\tif (typeof given === 'string') return given;\n\tif (!isCount(given)) {\n\t\tthrow new TypeError(\n\t\t\t`janusMail.${METHOD}: recoveryCodesLeft must be a count — a whole number, 0 or more — or the sentence to show`,\n\t\t);\n\t}\n\tconst text = codesLeftText(locale, given);\n\tif (text === undefined) {\n\t\tthrow new TypeError(\n\t\t\t`janusMail.${METHOD}: recoveryCodesLeft must be the sentence to show in a locale the default e-mails are not built in`,\n\t\t);\n\t}\n\treturn text;\n}\n\n/** The recovery code notice, over the resolved options. */\nexport function recoveryMail(\n\toptions: ResolvedOptions,\n): Pick<JanusMail<string>, 'recoveryCodeUsed'> {\n\tconst { brand, links } = options;\n\treturn {\n\t\t// Async, so a wrong argument rejects as the other methods' do.\n\t\tasync recoveryCodeUsed(to, used) {\n\t\t\tconst locale = localeFor(options, to);\n\t\t\treturn send(options, METHOD, field(METHOD, to, 'email'), {\n\t\t\t\tbrand,\n\t\t\t\tname: field(METHOD, to, 'name'),\n\t\t\t\twhen: field(METHOD, used, 'when'),\n\t\t\t\trecoveryCodesLeft: codesLeft(used, locale),\n\t\t\t\tlink:\n\t\t\t\t\tlinks.recoveryCodes === undefined\n\t\t\t\t\t\t? link(METHOD, links.secureAccount(), 'secureAccount()')\n\t\t\t\t\t\t: link(METHOD, links.recoveryCodes(), 'recoveryCodes()'),\n\t\t\t\tlocale,\n\t\t\t});\n\t\t},\n\t};\n}\n",
|
|
20
20
|
"/**\n * `stepUp`: the code of a step-up — a signed-in user proving again who they\n * are before a sensitive action — to the address `auth.stepUp.request(user)`\n * answered, greeting them, saying how long the code lasts, and linking to\n * where the account is secured, for a user who asked for nothing.\n *\n * Apart from the sign-in code's e-mail because of `via`: a step-up confirmed\n * with the user's app sends nothing, and is refused here rather than mailed\n * as an empty code.\n */\nimport { expiresInFor } from './expiry';\nimport type { ResolvedOptions } from './options';\nimport { field, link, localeFor, send } from './send';\nimport type { JanusMail } from './types';\n\nconst METHOD = 'stepUp';\n\n/** `issued.via`, which must be `'email'`: a `TypeError` otherwise, before anything else is read. */\nfunction checkVia(issued: unknown): void {\n\tconst via =\n\t\ttypeof issued === 'object' && issued !== null\n\t\t\t? (issued as { via?: unknown }).via\n\t\t\t: undefined;\n\tif (via !== 'email') {\n\t\tthrow new TypeError(\n\t\t\t`janusMail.${METHOD}: via must be 'email' — a step-up confirmed with the user's app sends no e-mail`,\n\t\t);\n\t}\n}\n\n/** The step-up's e-mail, over the resolved options. */\nexport function stepUpMail(\n\toptions: ResolvedOptions,\n): Pick<JanusMail<string>, 'stepUp'> {\n\tconst { brand, links } = options;\n\treturn {\n\t\t// `via`, `code`, `email` and `expiresAt` only: the challenge is the user's secret.\n\t\tasync stepUp(issued, to, sendOptions) {\n\t\t\tcheckVia(issued);\n\t\t\tconst locale = localeFor(options, to);\n\t\t\treturn send(options, METHOD, field(METHOD, issued, 'email'), {\n\t\t\t\tbrand,\n\t\t\t\tname: field(METHOD, to, 'name'),\n\t\t\t\tcode: field(METHOD, issued, 'code'),\n\t\t\t\texpiresIn: expiresInFor(\n\t\t\t\t\tMETHOD,\n\t\t\t\t\tissued,\n\t\t\t\t\tlocale,\n\t\t\t\t\tsendOptions,\n\t\t\t\t\toptions.clock,\n\t\t\t\t),\n\t\t\t\tlink: link(METHOD, links.secureAccount(), 'secureAccount()'),\n\t\t\t\tlocale,\n\t\t\t});\n\t\t},\n\t};\n}\n",
|
|
21
|
-
"/**\n * `janusMail()`: the e-mails of Janus's flows, rendered by the templates and\n * handed to the mailer. It sends what a flow answered, to the address the\n * flow answered, and nothing else: no retry, no queue, no error of its own —\n * the mailer's `MailFailure` and `MailRefused` reach the caller untouched.\n */\n\nimport { expiringMails } from './expiring-mails';\nimport { newSignInMail } from './new-sign-in-mail';\nimport { noticeMails } from './notice-mails';\nimport { resolveOptions } from './options';\nimport { recoveryMail } from './recovery-mail';\nimport { stepUpMail } from './step-up-mail';\nimport type { JanusMail, JanusMailLocale, JanusMailOptions } from './types';\n\n/**\n * The e-mails of Janus's flows, over your mailer:\n *\n * ```ts\n * const mail = janusMail({\n * \tmailer,\n * \tfrom: 'noreply@acme.example',\n * \tbrand: 'Acme',\n * \tlinks: {\n * \t\tverifyEmail: (token) => `https://acme.example/verify?token=${token}`,\n * \t\tresetPassword: (token) => `https://acme.example/reset?token=${token}`,\n * \t\tsecureAccount: () => 'https://acme.example/account/security',\n * \t\tgetStarted: () => 'https://acme.example/',\n * \t\trecoveryCodes: () => 'https://acme.example/account/recovery-codes', // optional\n * \t},\n * });\n *\n * await mail.verifyEmail(await auth.verifyEmail.send(user), { name: user.name, locale: user.locale });\n * ```\n *\n * Reads nothing when called: the default e-mails are read on the first one\n * sent. A wrong option is a bare `TypeError`, thrown here.\n */\nexport function janusMail<const L extends string = JanusMailLocale>(\n\toptions: JanusMailOptions<L>,\n): JanusMail<L> {\n\tconst resolved = resolveOptions(options);\n\tconst mail: JanusMail<string> = Object.freeze({\n\t\t...expiringMails(resolved),\n\t\t...noticeMails(resolved),\n\t\t...recoveryMail(resolved),\n\t\t...newSignInMail(resolved),\n\t\t...stepUpMail(resolved),\n\t\ttemplates: resolved.templates,\n\t\tlocales: resolved.locales,\n\t});\n\t// The one cast at the boundary: the mirror above works on `string` locales.\n\treturn mail as unknown as JanusMail<L>;\n}\n"
|
|
21
|
+
"/**\n * `janusMail()`: the e-mails of Janus's flows, rendered by the templates and\n * handed to the mailer. It sends what a flow answered, to the address the\n * flow answered, and nothing else: no retry, no queue, no error of its own —\n * the mailer's `MailFailure` and `MailRefused` reach the caller untouched.\n */\n\nimport { expiringMails } from './expiring-mails';\nimport { newSignInMail } from './new-sign-in-mail';\nimport { noticeMails } from './notice-mails';\nimport { resolveOptions } from './options';\nimport { recoveryMail } from './recovery-mail';\nimport { stepUpMail } from './step-up-mail';\nimport type { JanusMail, JanusMailLocale, JanusMailOptions } from './types';\n\n/**\n * The e-mails of Janus's flows, over your mailer:\n *\n * ```ts\n * const mail = janusMail({\n * \tmailer,\n * \tfrom: 'noreply@acme.example',\n * \tbrand: 'Acme',\n * \tlinks: {\n * \t\tverifyEmail: (token) => `https://acme.example/verify?token=${token}`,\n * \t\tresetPassword: (token) => `https://acme.example/reset?token=${token}`,\n * \t\tsecureAccount: () => 'https://acme.example/account/security',\n * \t\tgetStarted: () => 'https://acme.example/',\n * \t\trecoveryCodes: () => 'https://acme.example/account/recovery-codes', // optional\n * \t\tchangeEmail: (token) => `https://acme.example/account/email?token=${token}`, // optional\n * \t},\n * });\n *\n * await mail.verifyEmail(await auth.verifyEmail.send(user), { name: user.name, locale: user.locale });\n * ```\n *\n * Reads nothing when called: the default e-mails are read on the first one\n * sent. A wrong option is a bare `TypeError`, thrown here.\n */\nexport function janusMail<const L extends string = JanusMailLocale>(\n\toptions: JanusMailOptions<L>,\n): JanusMail<L> {\n\tconst resolved = resolveOptions(options);\n\tconst mail: JanusMail<string> = Object.freeze({\n\t\t...expiringMails(resolved),\n\t\t...noticeMails(resolved),\n\t\t...recoveryMail(resolved),\n\t\t...newSignInMail(resolved),\n\t\t...stepUpMail(resolved),\n\t\ttemplates: resolved.templates,\n\t\tlocales: resolved.locales,\n\t});\n\t// The one cast at the boundary: the mirror above works on `string` locales.\n\treturn mail as unknown as JanusMail<L>;\n}\n"
|
|
22
22
|
],
|
|
23
|
-
"mappings": ";AAQA,IAAM,YAAY;AAClB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB,KAAK;AAcrB,SAAS,YAAY,CAAC,IAAY,QAAwB;AAAA,EAChE,MAAM,UA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AY,WAAW,OACrC,OAA6B,MAC9B;AAAA,EACJ,IAAI,QAAQ,SAAS;AAAA,IACpB,MAAM,IAAI,UACT,aAAa,wFACd;AAAA,EACD;AAAA;AAIM,SAAS,UAAU,CACzB,SACoC;AAAA,EACpC,QAAQ,OAAO,UAAU;AAAA,EACzB,OAAO;AAAA,SAEA,OAAM,CAAC,QAAQ,IAAI,aAAa;AAAA,MACrC,SAAS,MAAM;AAAA,MACf,MAAM,SAAS,UAAU,SAAS,EAAE;AAAA,MACpC,OAAO,KAAK,SAAS,SAAQ,MAAM,SAAQ,QAAQ,OAAO,GAAG;AAAA,QAC5D;AAAA,QACA,MAAM,MAAM,SAAQ,IAAI,MAAM;AAAA,QAC9B,MAAM,MAAM,SAAQ,QAAQ,MAAM;AAAA,QAClC,WAAW,aACV,SACA,QACA,QACA,aACA,QAAQ,KACT;AAAA,QACA,MAAM,KAAK,SAAQ,MAAM,cAAc,GAAG,iBAAiB;AAAA,QAC3D;AAAA,MACD,CAAC;AAAA;AAAA,EAEH;AAAA;;;AChBM,SAAS,SAAmD,CAClE,SACe;AAAA,EACf,MAAM,WAAW,eAAe,OAAO;AAAA,EACvC,MAAM,OAA0B,OAAO,OAAO;AAAA,OAC1C,cAAc,QAAQ;AAAA,OACtB,YAAY,QAAQ;AAAA,OACpB,aAAa,QAAQ;AAAA,OACrB,cAAc,QAAQ;AAAA,OACtB,WAAW,QAAQ;AAAA,IACtB,WAAW,SAAS;AAAA,IACpB,SAAS,SAAS;AAAA,EACnB,CAAC;AAAA,EAED,OAAO;AAAA;",
|
|
24
|
+
"debugId": "2138CE83FAE73E6864756E2164756E21",
|
|
25
25
|
"names": []
|
|
26
26
|
}
|
package/dist/janus-mail.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { JanusMail, JanusMailLocale, JanusMailOptions } from './types';
|
|
|
19
19
|
* secureAccount: () => 'https://acme.example/account/security',
|
|
20
20
|
* getStarted: () => 'https://acme.example/',
|
|
21
21
|
* recoveryCodes: () => 'https://acme.example/account/recovery-codes', // optional
|
|
22
|
+
* changeEmail: (token) => `https://acme.example/account/email?token=${token}`, // optional
|
|
22
23
|
* },
|
|
23
24
|
* });
|
|
24
25
|
*
|
package/dist/janus-mail.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"janus-mail.d.ts","sourceRoot":"","sources":["../src/janus-mail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"janus-mail.d.ts","sourceRoot":"","sources":["../src/janus-mail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,eAAe,EACjE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC1B,SAAS,CAAC,CAAC,CAAC,CAad"}
|
package/dist/link-types.d.ts
CHANGED
|
@@ -47,5 +47,15 @@ export interface JanusMailLinks {
|
|
|
47
47
|
* scanner that opens the link does not sign in for the user.
|
|
48
48
|
*/
|
|
49
49
|
readonly magicLink?: (token: string) => string;
|
|
50
|
+
/**
|
|
51
|
+
* The page that confirms a new e-mail address, given the one-time token —
|
|
52
|
+
* `changeEmail` links to it. **Optional**, for an application that lets no
|
|
53
|
+
* user change their address; without it, `changeEmail` throws a
|
|
54
|
+
* `TypeError` before anything is rendered. That page spends nothing until
|
|
55
|
+
* the user confirms: its button posts the token to the route that calls
|
|
56
|
+
* `auth.<type>.changeEmail.confirm`, so a mail scanner that opens the link
|
|
57
|
+
* does not move the account.
|
|
58
|
+
*/
|
|
59
|
+
readonly changeEmail?: (token: string) => string;
|
|
50
60
|
}
|
|
51
61
|
//# sourceMappingURL=link-types.d.ts.map
|
package/dist/link-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-types.d.ts","sourceRoot":"","sources":["../src/link-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC9B,6HAA6H;IAC7H,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,MAAM,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,MAAM,CAAC;IACtC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"link-types.d.ts","sourceRoot":"","sources":["../src/link-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC9B,6HAA6H;IAC7H,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,MAAM,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,MAAM,CAAC;IACtC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACjD"}
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAiB9C,iEAAiE;AACjE,wBAAgB,UAAU,CACzB,KAAK,EAAE,OAAO,GACZ,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB1C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAkBjE"}
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,KAAK,EACX,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,SAAS,CAAC;AAEjB,+DAA+D;AAC/D,eAAO,MAAM,cAAc,EAAE,SAAS,qBAAqB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,KAAK,EACX,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,SAAS,CAAC;AAEjB,+DAA+D;AAC/D,eAAO,MAAM,cAAc,EAAE,SAAS,qBAAqB,EAc1D,CAAC;AAEF,yFAAyF;AACzF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACtB;AAiJD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAoBhE"}
|
package/dist/template-types.d.ts
CHANGED
|
@@ -50,6 +50,16 @@ export interface JanusMailVariables {
|
|
|
50
50
|
readonly expiresIn: string;
|
|
51
51
|
readonly link: string;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* `name` is the user's, `link` the page that confirms the new address —
|
|
55
|
+
* `links.changeEmail(token)` — and the e-mail goes to the new address.
|
|
56
|
+
*/
|
|
57
|
+
readonly changeEmail: {
|
|
58
|
+
readonly brand: string;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly link: string;
|
|
61
|
+
readonly expiresIn: string;
|
|
62
|
+
};
|
|
53
63
|
readonly passwordChanged: {
|
|
54
64
|
readonly brand: string;
|
|
55
65
|
readonly name: string;
|
|
@@ -106,7 +116,7 @@ export interface JanusMailVariables {
|
|
|
106
116
|
readonly link: string;
|
|
107
117
|
};
|
|
108
118
|
}
|
|
109
|
-
/** The name of one of the
|
|
119
|
+
/** The name of one of the thirteen templates: `verifyEmail`, `resetPassword`, … */
|
|
110
120
|
export type JanusMailTemplateName = keyof JanusMailVariables;
|
|
111
121
|
/**
|
|
112
122
|
* One e-mail: its variables and the locale picked for the recipient, in; its
|
|
@@ -117,7 +127,7 @@ export type JanusMailTemplateName = keyof JanusMailVariables;
|
|
|
117
127
|
export type JanusMailTemplate<V, L extends string = JanusMailLocale> = (variables: V & {
|
|
118
128
|
readonly locale: L;
|
|
119
129
|
}) => Rendered | PromiseLike<Rendered>;
|
|
120
|
-
/** The
|
|
130
|
+
/** The thirteen templates, each for the locales `L`. */
|
|
121
131
|
export type JanusMailTemplates<L extends string = JanusMailLocale> = {
|
|
122
132
|
readonly [K in JanusMailTemplateName]: JanusMailTemplate<JanusMailVariables[K], L>;
|
|
123
133
|
};
|