@pithy-sh/email 0.7.0 → 0.8.1

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.
Files changed (46) hide show
  1. package/README.md +8 -0
  2. package/dist/capability.d.ts +2 -2
  3. package/dist/capability.d.ts.map +1 -1
  4. package/dist/capability.js +23 -2
  5. package/dist/consent/consent.d.ts +57 -0
  6. package/dist/consent/consent.d.ts.map +1 -0
  7. package/dist/consent/consent.js +135 -0
  8. package/dist/data/emailEvent.d.ts +1 -1
  9. package/dist/data/emailEvent.d.ts.map +1 -1
  10. package/dist/data/emailEvent.js +2 -1
  11. package/dist/data/emailJob.d.ts +6 -2
  12. package/dist/data/emailJob.d.ts.map +1 -1
  13. package/dist/data/emailJob.js +8 -3
  14. package/dist/data/emailSuppression.d.ts +1 -1
  15. package/dist/data/emailSuppression.d.ts.map +1 -1
  16. package/dist/data/emailSuppression.js +2 -1
  17. package/dist/data/tables.d.ts +4 -4
  18. package/dist/http/guards.d.ts +2 -2
  19. package/dist/http/guards.d.ts.map +1 -1
  20. package/dist/http/guards.js +12 -0
  21. package/dist/processing/activities.d.ts +9 -0
  22. package/dist/processing/activities.d.ts.map +1 -0
  23. package/dist/processing/activities.js +40 -0
  24. package/dist/purge/contribution.d.ts +27 -0
  25. package/dist/purge/contribution.d.ts.map +1 -0
  26. package/dist/purge/contribution.js +67 -0
  27. package/dist/send/enqueue.d.ts +26 -7
  28. package/dist/send/enqueue.d.ts.map +1 -1
  29. package/dist/send/enqueue.js +36 -13
  30. package/dist/templates/messages.d.ts +1 -2
  31. package/dist/templates/messages.d.ts.map +1 -1
  32. package/dist/templates/messages.js +7 -10
  33. package/dist/version.generated.d.ts +1 -1
  34. package/dist/version.generated.js +1 -1
  35. package/package.json +3 -3
  36. package/src/capability.ts +33 -7
  37. package/src/consent/consent.ts +183 -0
  38. package/src/data/emailEvent.ts +2 -1
  39. package/src/data/emailJob.ts +21 -8
  40. package/src/data/emailSuppression.ts +2 -1
  41. package/src/http/guards.ts +14 -2
  42. package/src/processing/activities.ts +41 -0
  43. package/src/purge/contribution.ts +83 -0
  44. package/src/send/enqueue.ts +62 -24
  45. package/src/templates/messages.ts +10 -13
  46. package/src/version.generated.ts +1 -1
@@ -44,14 +44,14 @@ import { EMAIL_ES } from "./messages.es";
44
44
  *
45
45
  * ## Only the kit's own copy
46
46
  *
47
- * Eleven templates are here. The five whose words arrive as payload — `testerNudge`, `supportReply`,
47
+ * Seventeen templates are here. The five whose words arrive as payload — `testerNudge`, `supportReply`,
48
48
  * `operationalNotice`, `newsletter`, `marketingCampaign` — are the adopter's copy, chosen by a human
49
49
  * for one message, and a catalog cannot translate a sentence it has never seen. Their **shell** still
50
50
  * follows the job's locale (the severity word, the footer, the document's `lang` and `dir`), so a
51
51
  * notice at locale `es` reads its severity in Spanish and its summary in whatever the caller wrote.
52
52
  */
53
53
 
54
- /** The kit's English for every string the eleven kit-authored templates and the shared shell render. */
54
+ /** The kit's English for every string the seventeen kit-authored templates and the shared shell render. */
55
55
  const EMAIL_EN: MessageCatalog = {
56
56
  // --- The shared shell ---
57
57
  // The greeting is two keys rather than one with an optional placeholder, because a language that
@@ -123,7 +123,7 @@ const EMAIL_EN: MessageCatalog = {
123
123
  "email/password_changed.text_body":
124
124
  "Your account credentials were changed on {when}. If this wasn't you, contact support:",
125
125
 
126
- // --- The account lifecycle (#620) ---
126
+ // --- The account lifecycle ---
127
127
  // Each says what happened, what it means, and who to answer. The answer is a reply: the mail comes from the
128
128
  // adopter's own address, so a reply reaches the people who can act on it.
129
129
  "email/account_suspended.subject": "Your {app} account is suspended",
@@ -157,7 +157,7 @@ const EMAIL_EN: MessageCatalog = {
157
157
  "Your {app} account and its data were erased on {purgedOn}. This cannot be undone.",
158
158
  "email/deletion_complete.last": "This is the last email this account will receive.",
159
159
 
160
- // --- Membership administration (#624) ---
160
+ // --- Membership administration ---
161
161
  // An operator changed somebody's membership. Each names the organization, because a person in two
162
162
  // accounts has to know which one changed, and closes on who to answer.
163
163
  "email/organization_member_added.subject": "You were added to {organization}",
@@ -178,7 +178,7 @@ const EMAIL_EN: MessageCatalog = {
178
178
  "You are now the owner of {organization} on {app}. You administer it, and you answer for it.",
179
179
  "email/organization_member.contact": "If you did not expect this, reply to this email.",
180
180
 
181
- // --- The organization lifecycle (#623) ---
181
+ // --- The organization lifecycle ---
182
182
  // To an owner, when an operator acts on the organization itself. Each names it, and says the owner's own
183
183
  // account is not what changed.
184
184
  "email/organization_suspended.subject": "{organization} is suspended",
@@ -215,8 +215,7 @@ const EMAIL_EN: MessageCatalog = {
215
215
  * Every language this capability's own copy is written in.
216
216
  *
217
217
  * **Bundled, not stamped.** The send Worker is deployed with this map inside it, so adding a language
218
- * to the kit costs an adopter a package upgrade and no configuration at all — which is the whole of
219
- * #442. What still travels as a variable is the adopter's diff against this: usually nothing, and at
218
+ * to the kit costs an adopter a package upgrade and no configuration at all. What still travels as a variable is the adopter's diff against this: usually nothing, and at
220
219
  * most the sentences they changed.
221
220
  */
222
221
  export const EMAIL_MESSAGES: LocaleCatalogs = { en: EMAIL_EN, es: EMAIL_ES };
@@ -242,12 +241,10 @@ function languageOf(tag: string): string | null {
242
241
  /**
243
242
  * This package's own copy for `locale`, reduced to the language when the region was not written for.
244
243
  *
245
- * **The reduction has to happen here too, and not only over the stamped catalogs.** It did not, and
246
- * that was a regression the moment #442 bundled the kit's translations: the stamped catalog used to
247
- * *be* the kit's Spanish, so reducing `es-AR` to `es` over it found the words. With the kit's copy
248
- * bundled here instead, the stamped catalog is empty for a project that overrode nothing, and an
249
- * exact-tag lookup on `es-AR` answered `undefined` — so a reader whose `pithy_auth_users.locale` is
250
- * `es-AR` or `es-MX` got an English letter from a project that ships Spanish.
244
+ * **The reduction has to happen here too, and not only over the stamped catalogs.** With the kit's copy
245
+ * bundled here, the stamped catalog is empty for a project that overrode nothing, so an exact-tag
246
+ * lookup on `es-AR` alone would send a reader whose `pithy_auth_users.locale` is `es-AR` or `es-MX` an
247
+ * English letter from a project that ships Spanish.
251
248
  */
252
249
  function bundledFor(locale: string): MessageCatalog | undefined {
253
250
  const language = languageOf(locale);
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/email";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.7.0";
16
+ export const PACKAGE_VERSION = "0.8.1";