@pithy-sh/email 0.10.7 → 0.11.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.
- package/dist/capability.js +1 -1
- package/dist/provision/hostCatalogs.d.ts.map +1 -1
- package/dist/provision/hostCatalogs.js +6 -7
- package/dist/purge/contribution.d.ts +3 -1
- package/dist/purge/contribution.d.ts.map +1 -1
- package/dist/purge/contribution.js +8 -3
- package/dist/templates/messages.d.ts.map +1 -1
- package/dist/templates/messages.es.d.ts +5 -6
- package/dist/templates/messages.es.d.ts.map +1 -1
- package/dist/templates/messages.es.js +7 -7
- package/dist/templates/messages.js +3 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +3 -3
- package/src/provision/hostCatalogs.ts +7 -8
- package/src/purge/contribution.ts +5 -2
- package/src/templates/messages.es.ts +9 -6
- package/src/templates/messages.ts +4 -0
- package/src/version.generated.ts +1 -1
package/dist/capability.js
CHANGED
|
@@ -4,6 +4,7 @@ import { emailDatabase, emailSuppressionDatabase, emailSuppressionTables, emailS
|
|
|
4
4
|
import { createBounceHandler } from "./bounce/handler.js";
|
|
5
5
|
import { EMAIL_CONSENT_PURPOSES, emailConsentGranted, emailConsentWithdrawn } from "./consent/consent.js";
|
|
6
6
|
import { emailSigningRegistry } from "./crypto/signingKey.js";
|
|
7
|
+
import { emailUserPurge } from "./purge/contribution.js";
|
|
7
8
|
import { EMAIL_MESSAGES, kitEmailLayers } from "./templates/messages.js";
|
|
8
9
|
import { CustomTheme, resolveTheme } from "./templates/theme.js";
|
|
9
10
|
import { registerCallbacks } from "./http/callbacks.js";
|
|
@@ -17,7 +18,6 @@ import { EMAIL_PROCESSING } from "./processing/activities.js";
|
|
|
17
18
|
import { DevMailDelivery } from "./provision/devDelivery.js";
|
|
18
19
|
import { emailHostCatalogs } from "./provision/hostCatalogs.js";
|
|
19
20
|
import { emailSettings } from "./provision/settingsCheck.js";
|
|
20
|
-
import { emailUserPurge } from "./purge/contribution.js";
|
|
21
21
|
import { enqueueEmail } from "./send/enqueue.js";
|
|
22
22
|
import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated.js";
|
|
23
23
|
import { EmailScheduleParams, EmailSendParams } from "./workflows/params.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostCatalogs.d.ts","sourceRoot":"","sources":["../../src/provision/hostCatalogs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"hostCatalogs.d.ts","sourceRoot":"","sources":["../../src/provision/hostCatalogs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA2DhF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,kBAAkB,GAAG,cAAc,CAkC3G"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import "../purge/contribution.js";
|
|
3
4
|
import { EMAIL_MESSAGES } from "../templates/messages.js";
|
|
4
5
|
import { KitErrorPayload } from "@pithy-sh/core/src/error/payload";
|
|
5
6
|
//#region src/provision/hostCatalogs.ts
|
|
@@ -15,11 +16,9 @@ import { KitErrorPayload } from "@pithy-sh/core/src/error/payload";
|
|
|
15
16
|
* template, and no `pithy.config.ts` of the adopter's is ever evaluated inside it. So the layers
|
|
16
17
|
* cannot travel as a function; they travel as one JSON var, and this is what flattens them.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
21
|
-
* the translated subject the app worker had computed at enqueue as well. Two Workers, one message, and
|
|
22
|
-
* they disagreed about its language.
|
|
19
|
+
* Without that var the send Workflow renders the kit's English whatever tag is on the row, and —
|
|
20
|
+
* because `runSend` overwrites the stored subject with its own fresh render — discards the translated
|
|
21
|
+
* subject the app worker computed at enqueue as well: two Workers, one message, two languages.
|
|
23
22
|
*
|
|
24
23
|
* ## What is dropped, and why dropping it changes nothing
|
|
25
24
|
*
|
|
@@ -52,9 +51,9 @@ const EMAIL_KEY_PREFIX = "email/";
|
|
|
52
51
|
* `KitErrorPayload` so a seventh `email/*` code drops out on its own.
|
|
53
52
|
*/
|
|
54
53
|
const EMAIL_ERROR_CODES = new Set(KitErrorPayload.options.map((member) => member.shape.code.value).filter((code) => code.startsWith(EMAIL_KEY_PREFIX)));
|
|
55
|
-
/** Whether a key is copy this host will actually render. */
|
|
54
|
+
/** Whether a key is copy this host will actually render. The purge's retained basis is read by the export alone. */
|
|
56
55
|
function rendersOnTheHost(key) {
|
|
57
|
-
return key.startsWith(EMAIL_KEY_PREFIX) && !EMAIL_ERROR_CODES.has(key);
|
|
56
|
+
return key.startsWith(EMAIL_KEY_PREFIX) && !EMAIL_ERROR_CODES.has(key) && key !== "email/purge.retained";
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
60
59
|
* Flatten a composed project's layers into the `EMAIL_MESSAGES` var's value, one catalog per locale.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { type RetainingPurgeContribution } from "@pithy-sh/core/src/capability/purge";
|
|
4
4
|
/**
|
|
5
|
-
* What a person's purge means for `@pithy-sh/email
|
|
5
|
+
* What a person's purge means for `@pithy-sh/email`: **nothing is erased, and the export says so and why.**
|
|
6
6
|
*
|
|
7
7
|
* A suppression has to outlive the person. It is the record that an address bounced, complained or asked not to be
|
|
8
8
|
* mailed, and the list is checked before every send: erase the row and the next send — a newsletter to an address
|
|
@@ -22,6 +22,8 @@ import { type RetainingPurgeContribution } from "@pithy-sh/core/src/capability/p
|
|
|
22
22
|
export declare const EMAIL_PURGE_SUMMARY = "Keeps the user's address on the suppression list, and the log of mail sent to it.";
|
|
23
23
|
/** Why, in the sentence the person is told. */
|
|
24
24
|
export declare const EMAIL_RETENTION_BASIS = "Kept so your unsubscribe holds: the address stays on the list of addresses not to mail, with the record of what was sent to it.";
|
|
25
|
+
/** The catalog key that translates {@link EMAIL_RETENTION_BASIS}. */
|
|
26
|
+
export declare const EMAIL_RETENTION_BASIS_KEY = "email/purge.retained";
|
|
25
27
|
/** The user contribution `email()` declares, over its two D1 bindings. */
|
|
26
28
|
export declare function emailUserPurge(database?: string, suppressions?: string): RetainingPurgeContribution;
|
|
27
29
|
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/purge/contribution.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,KAAK,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAMhH;;;;;;;;;;;;;;;;GAgBG;AAEH,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,sFAAsF,CAAC;AAEvH,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,oIACiG,CAAC;AAEpI,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,QAAQ,SAAO,EAAE,YAAY,SAAuB,GAAG,0BAA0B,CA6C/G"}
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/purge/contribution.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,KAAK,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAMhH;;;;;;;;;;;;;;;;GAgBG;AAEH,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,sFAAsF,CAAC;AAEvH,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,oIACiG,CAAC;AAEpI,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,QAAQ,SAAO,EAAE,YAAY,SAAuB,GAAG,0BAA0B,CA6C/G"}
|
|
@@ -8,7 +8,7 @@ import { normalizeAddress } from "@pithy-sh/core/src/address/address";
|
|
|
8
8
|
import { exportRows, purgeBinding } from "@pithy-sh/core/src/capability/purge";
|
|
9
9
|
//#region src/purge/contribution.ts
|
|
10
10
|
/**
|
|
11
|
-
* What a person's purge means for `@pithy-sh/email
|
|
11
|
+
* What a person's purge means for `@pithy-sh/email`: **nothing is erased, and the export says so and why.**
|
|
12
12
|
*
|
|
13
13
|
* A suppression has to outlive the person. It is the record that an address bounced, complained or asked not to be
|
|
14
14
|
* mailed, and the list is checked before every send: erase the row and the next send — a newsletter to an address
|
|
@@ -28,12 +28,17 @@ import { exportRows, purgeBinding } from "@pithy-sh/core/src/capability/purge";
|
|
|
28
28
|
const EMAIL_PURGE_SUMMARY = "Keeps the user's address on the suppression list, and the log of mail sent to it.";
|
|
29
29
|
/** Why, in the sentence the person is told. */
|
|
30
30
|
const EMAIL_RETENTION_BASIS = "Kept so your unsubscribe holds: the address stays on the list of addresses not to mail, with the record of what was sent to it.";
|
|
31
|
+
/** The catalog key that translates {@link EMAIL_RETENTION_BASIS}. */
|
|
32
|
+
const EMAIL_RETENTION_BASIS_KEY = "email/purge.retained";
|
|
31
33
|
/** The user contribution `email()` declares, over its two D1 bindings. */
|
|
32
34
|
function emailUserPurge(database = "DB", suppressions = "EMAIL_SUPPRESSIONS") {
|
|
33
35
|
return {
|
|
34
36
|
subject: "user",
|
|
35
37
|
summary: EMAIL_PURGE_SUMMARY,
|
|
36
|
-
retain: {
|
|
38
|
+
retain: {
|
|
39
|
+
basis: EMAIL_RETENTION_BASIS,
|
|
40
|
+
basisKey: EMAIL_RETENTION_BASIS_KEY
|
|
41
|
+
},
|
|
37
42
|
export: async (context) => {
|
|
38
43
|
const read = await context.address?.();
|
|
39
44
|
if (!read) return {
|
|
@@ -64,4 +69,4 @@ function emailUserPurge(database = "DB", suppressions = "EMAIL_SUPPRESSIONS") {
|
|
|
64
69
|
};
|
|
65
70
|
}
|
|
66
71
|
//#endregion
|
|
67
|
-
export { EMAIL_PURGE_SUMMARY, EMAIL_RETENTION_BASIS, emailUserPurge };
|
|
72
|
+
export { EMAIL_PURGE_SUMMARY, EMAIL_RETENTION_BASIS, EMAIL_RETENTION_BASIS_KEY, emailUserPurge };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/templates/messages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAoC,KAAK,UAAU,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/templates/messages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAoC,KAAK,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAoNvG;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,cAA+C,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,EAAE,CAAC;AAE7F,iHAAiH;AACjH,eAAO,MAAM,cAAc,EAAE,kBAA+D,CAAC;AAoB7F;;;;;;;GAOG;AACH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAa5E;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,kBAAkB,CAa1E;AA2BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,kBAAkB,GAAG,UAAU,CAG5G"}
|
|
@@ -4,12 +4,11 @@ import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
|
|
|
4
4
|
/**
|
|
5
5
|
* The kit-authored email copy, in Spanish.
|
|
6
6
|
*
|
|
7
|
-
* **Beside the English rather than in `@pithy-sh/i18n
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Held
|
|
11
|
-
*
|
|
12
|
-
* is built with it and the variable carries only what an adopter changed, which is usually nothing.
|
|
7
|
+
* **Beside the English rather than in `@pithy-sh/i18n`.** The send Workflow runs in its own Worker,
|
|
8
|
+
* deployed by `pithy email provision` with no request and no access to the adopter's config — so
|
|
9
|
+
* anything it does not *bundle* has to be stamped into it as a variable, against a 5 KB per-variable
|
|
10
|
+
* ceiling. Held here, the host is built with it and the variable carries only what an adopter changed,
|
|
11
|
+
* which is usually nothing.
|
|
13
12
|
*
|
|
14
13
|
* It also puts this file where the domain rule already says it belongs: a capability may only declare
|
|
15
14
|
* keys under its own name, and `@pithy-sh/email` contributes `email/` in every language it has rather
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.es.d.ts","sourceRoot":"","sources":["../../src/templates/messages.es.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"messages.es.d.ts","sourceRoot":"","sources":["../../src/templates/messages.es.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,QAAQ,EAAE,cA4JtB,CAAC"}
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* The kit-authored email copy, in Spanish.
|
|
6
6
|
*
|
|
7
|
-
* **Beside the English rather than in `@pithy-sh/i18n
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Held
|
|
11
|
-
*
|
|
12
|
-
* is built with it and the variable carries only what an adopter changed, which is usually nothing.
|
|
7
|
+
* **Beside the English rather than in `@pithy-sh/i18n`.** The send Workflow runs in its own Worker,
|
|
8
|
+
* deployed by `pithy email provision` with no request and no access to the adopter's config — so
|
|
9
|
+
* anything it does not *bundle* has to be stamped into it as a variable, against a 5 KB per-variable
|
|
10
|
+
* ceiling. Held here, the host is built with it and the variable carries only what an adopter changed,
|
|
11
|
+
* which is usually nothing.
|
|
13
12
|
*
|
|
14
13
|
* It also puts this file where the domain rule already says it belongs: a capability may only declare
|
|
15
14
|
* keys under its own name, and `@pithy-sh/email` contributes `email/` in every language it has rather
|
|
@@ -132,7 +131,8 @@ const EMAIL_ES = {
|
|
|
132
131
|
"email/lead_capture.heading": "Tu descarga está lista",
|
|
133
132
|
"email/lead_capture.ready": "Tu copia de {asset} ya está lista.",
|
|
134
133
|
"email/lead_capture.cta": "Descargar ahora",
|
|
135
|
-
"email/lead_capture.text_ready": "Tu copia de {asset} ya está lista:"
|
|
134
|
+
"email/lead_capture.text_ready": "Tu copia de {asset} ya está lista:",
|
|
135
|
+
"email/purge.retained": "Se conserva para que tu baja siga vigente: la dirección sigue en la lista de direcciones a las que no se escribe, con el registro de lo que se le envió."
|
|
136
136
|
};
|
|
137
137
|
//#endregion
|
|
138
138
|
export { EMAIL_ES };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { EMAIL_RETENTION_BASIS, EMAIL_RETENTION_BASIS_KEY } from "../purge/contribution.js";
|
|
3
4
|
import { EMAIL_ES } from "./messages.es.js";
|
|
4
5
|
import { parseLocale } from "@pithy-sh/core/src/i18n/locale";
|
|
5
6
|
import { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
|
|
@@ -155,7 +156,8 @@ const EMAIL_EN = {
|
|
|
155
156
|
"email/lead_capture.heading": "Your download is ready",
|
|
156
157
|
"email/lead_capture.ready": "Your copy of {asset} is ready.",
|
|
157
158
|
"email/lead_capture.cta": "Download now",
|
|
158
|
-
"email/lead_capture.text_ready": "Your copy of {asset} is ready:"
|
|
159
|
+
"email/lead_capture.text_ready": "Your copy of {asset} is ready:",
|
|
160
|
+
[EMAIL_RETENTION_BASIS_KEY]: EMAIL_RETENTION_BASIS
|
|
159
161
|
};
|
|
160
162
|
/**
|
|
161
163
|
* Every language this capability's own copy is written in.
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
/** This package's npm name — the join key against a release feed. */
|
|
4
4
|
export declare const PACKAGE_NAME = "@pithy-sh/email";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.11.1";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/email";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.
|
|
7
|
+
const PACKAGE_VERSION = "0.11.1";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/email",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"postal-mime": "^4.0.8"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@pithy-sh/core": "^0.
|
|
46
|
-
"@pithy-sh/secrets": "^0.6.
|
|
45
|
+
"@pithy-sh/core": "^0.26.0",
|
|
46
|
+
"@pithy-sh/secrets": "^0.6.14",
|
|
47
47
|
"hono": "^4.13.2",
|
|
48
48
|
"kysely": "^0.29.0",
|
|
49
49
|
"zod": "^4.4.0"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { KitErrorPayload } from "@pithy-sh/core/src/error/payload";
|
|
5
5
|
import type { LocaleCatalogs, MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
|
|
6
|
+
import { EMAIL_RETENTION_BASIS_KEY } from "../purge/contribution";
|
|
6
7
|
import { EMAIL_MESSAGES, type EmailMessageLayers } from "../templates/messages";
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -17,11 +18,9 @@ import { EMAIL_MESSAGES, type EmailMessageLayers } from "../templates/messages";
|
|
|
17
18
|
* template, and no `pithy.config.ts` of the adopter's is ever evaluated inside it. So the layers
|
|
18
19
|
* cannot travel as a function; they travel as one JSON var, and this is what flattens them.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* the
|
|
23
|
-
* the translated subject the app worker had computed at enqueue as well. Two Workers, one message, and
|
|
24
|
-
* they disagreed about its language.
|
|
21
|
+
* Without that var the send Workflow renders the kit's English whatever tag is on the row, and —
|
|
22
|
+
* because `runSend` overwrites the stored subject with its own fresh render — discards the translated
|
|
23
|
+
* subject the app worker computed at enqueue as well: two Workers, one message, two languages.
|
|
25
24
|
*
|
|
26
25
|
* ## What is dropped, and why dropping it changes nothing
|
|
27
26
|
*
|
|
@@ -59,9 +58,9 @@ const EMAIL_ERROR_CODES: ReadonlySet<string> = new Set(
|
|
|
59
58
|
KitErrorPayload.options.map((member) => member.shape.code.value).filter((code) => code.startsWith(EMAIL_KEY_PREFIX)),
|
|
60
59
|
);
|
|
61
60
|
|
|
62
|
-
/** Whether a key is copy this host will actually render. */
|
|
61
|
+
/** Whether a key is copy this host will actually render. The purge's retained basis is read by the export alone. */
|
|
63
62
|
function rendersOnTheHost(key: string): boolean {
|
|
64
|
-
return key.startsWith(EMAIL_KEY_PREFIX) && !EMAIL_ERROR_CODES.has(key);
|
|
63
|
+
return key.startsWith(EMAIL_KEY_PREFIX) && !EMAIL_ERROR_CODES.has(key) && key !== EMAIL_RETENTION_BASIS_KEY;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
/**
|
|
@@ -82,7 +81,7 @@ export function emailHostCatalogs(locales: readonly string[], layersFor: EmailMe
|
|
|
82
81
|
if (rendersOnTheHost(key)) merged[key] = value;
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
// **What travels is the adopter's diff, and nothing else
|
|
84
|
+
// **What travels is the adopter's diff, and nothing else.**
|
|
86
85
|
//
|
|
87
86
|
// The host is deployed carrying `EMAIL_MESSAGES` — the kit's own copy in every language it is
|
|
88
87
|
// written in — so a key whose merged value is already what the host holds for this locale is a
|
|
@@ -10,7 +10,7 @@ import { EmailSuppression } from "../data/emailSuppression";
|
|
|
10
10
|
import { emailDatabase, emailSuppressionDatabase } from "../data/tables";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* What a person's purge means for `@pithy-sh/email
|
|
13
|
+
* What a person's purge means for `@pithy-sh/email`: **nothing is erased, and the export says so and why.**
|
|
14
14
|
*
|
|
15
15
|
* A suppression has to outlive the person. It is the record that an address bounced, complained or asked not to be
|
|
16
16
|
* mailed, and the list is checked before every send: erase the row and the next send — a newsletter to an address
|
|
@@ -34,12 +34,15 @@ export const EMAIL_PURGE_SUMMARY = "Keeps the user's address on the suppression
|
|
|
34
34
|
export const EMAIL_RETENTION_BASIS =
|
|
35
35
|
"Kept so your unsubscribe holds: the address stays on the list of addresses not to mail, with the record of what was sent to it.";
|
|
36
36
|
|
|
37
|
+
/** The catalog key that translates {@link EMAIL_RETENTION_BASIS}. */
|
|
38
|
+
export const EMAIL_RETENTION_BASIS_KEY = "email/purge.retained";
|
|
39
|
+
|
|
37
40
|
/** The user contribution `email()` declares, over its two D1 bindings. */
|
|
38
41
|
export function emailUserPurge(database = "DB", suppressions = "EMAIL_SUPPRESSIONS"): RetainingPurgeContribution {
|
|
39
42
|
return {
|
|
40
43
|
subject: "user",
|
|
41
44
|
summary: EMAIL_PURGE_SUMMARY,
|
|
42
|
-
retain: { basis: EMAIL_RETENTION_BASIS },
|
|
45
|
+
retain: { basis: EMAIL_RETENTION_BASIS, basisKey: EMAIL_RETENTION_BASIS_KEY },
|
|
43
46
|
export: async (context) => {
|
|
44
47
|
const read = await context.address?.();
|
|
45
48
|
if (!read) return { suppressions: [], jobs: [], events: [] };
|
|
@@ -8,12 +8,11 @@ import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
|
|
|
8
8
|
/**
|
|
9
9
|
* The kit-authored email copy, in Spanish.
|
|
10
10
|
*
|
|
11
|
-
* **Beside the English rather than in `@pithy-sh/i18n
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Held
|
|
15
|
-
*
|
|
16
|
-
* is built with it and the variable carries only what an adopter changed, which is usually nothing.
|
|
11
|
+
* **Beside the English rather than in `@pithy-sh/i18n`.** The send Workflow runs in its own Worker,
|
|
12
|
+
* deployed by `pithy email provision` with no request and no access to the adopter's config — so
|
|
13
|
+
* anything it does not *bundle* has to be stamped into it as a variable, against a 5 KB per-variable
|
|
14
|
+
* ceiling. Held here, the host is built with it and the variable carries only what an adopter changed,
|
|
15
|
+
* which is usually nothing.
|
|
17
16
|
*
|
|
18
17
|
* It also puts this file where the domain rule already says it belongs: a capability may only declare
|
|
19
18
|
* keys under its own name, and `@pithy-sh/email` contributes `email/` in every language it has rather
|
|
@@ -183,4 +182,8 @@ export const EMAIL_ES: MessageCatalog = {
|
|
|
183
182
|
"email/lead_capture.ready": "Tu copia de {asset} ya está lista.",
|
|
184
183
|
"email/lead_capture.cta": "Descargar ahora",
|
|
185
184
|
"email/lead_capture.text_ready": "Tu copia de {asset} ya está lista:",
|
|
185
|
+
|
|
186
|
+
// --- The purge: why a deleted account's rows are kept, read back in its export ---
|
|
187
|
+
"email/purge.retained":
|
|
188
|
+
"Se conserva para que tu baja siga vigente: la dirección sigue en la lista de direcciones a las que no se escribe, con el registro de lo que se le envió.",
|
|
186
189
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { type LocaleCatalogs, MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
|
|
5
5
|
import { parseLocale } from "@pithy-sh/core/src/i18n/locale";
|
|
6
6
|
import { createTranslator, DEFAULT_LOCALE, type Translator } from "@pithy-sh/core/src/i18n/translator";
|
|
7
|
+
import { EMAIL_RETENTION_BASIS, EMAIL_RETENTION_BASIS_KEY } from "../purge/contribution";
|
|
7
8
|
import { EMAIL_ES } from "./messages.es";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -209,6 +210,9 @@ const EMAIL_EN: MessageCatalog = {
|
|
|
209
210
|
"email/lead_capture.ready": "Your copy of {asset} is ready.",
|
|
210
211
|
"email/lead_capture.cta": "Download now",
|
|
211
212
|
"email/lead_capture.text_ready": "Your copy of {asset} is ready:",
|
|
213
|
+
|
|
214
|
+
// --- The purge: why a deleted account's rows are kept, read back in its export ---
|
|
215
|
+
[EMAIL_RETENTION_BASIS_KEY]: EMAIL_RETENTION_BASIS,
|
|
212
216
|
};
|
|
213
217
|
|
|
214
218
|
/**
|
package/src/version.generated.ts
CHANGED