@volter/twin-postmark 0.1.0 → 0.1.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.
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// drives — no SMTP, no network. `deliveryPlan()` is pure so the twin + its tests are
|
|
22
22
|
// repeatable.
|
|
23
23
|
import { projectResources } from '@volter/world-core';
|
|
24
|
+
import { appDestination, appFetch } from '@volter/world-core/app-route';
|
|
24
25
|
import { worldEgressRefusal } from '@volter/world-core/network-policy';
|
|
25
26
|
const SERVICE = 'postmark';
|
|
26
27
|
/** Postmark's webhook `RecordType` discriminators (the outbound delivery-lifecycle family). */
|
|
@@ -64,10 +65,10 @@ export function webhookHeaders(webhook) {
|
|
|
64
65
|
}
|
|
65
66
|
/** Fire-and-forget HTTP delivery — the live path, like the real vendor's. */
|
|
66
67
|
const httpDelivery = async (url, body, headers) => {
|
|
67
|
-
if (worldEgressRefusal(url) !== null)
|
|
68
|
-
return; // the World's egress rule: refused like an unreachable endpoint
|
|
68
|
+
if (!appDestination(url) && worldEgressRefusal(url) !== null)
|
|
69
|
+
return; // the World's egress rule, the application's own hostnames reaching it inside the World: refused like an unreachable endpoint
|
|
69
70
|
try {
|
|
70
|
-
await
|
|
71
|
+
await appFetch(url, { method: 'POST', headers, body });
|
|
71
72
|
}
|
|
72
73
|
catch {
|
|
73
74
|
/* fire-and-forget, like the real vendor */
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
// stored message, mints Bounce records + suppressions on a bounce, and POSTs Postmark's real
|
|
38
38
|
// webhook payloads (RecordType: Delivery/Open/Click/Bounce/SpamComplaint) to registered
|
|
39
39
|
// webhooks (postmark-events.ts).
|
|
40
|
-
import { applyTwinWrite, projectResources } from '@volter/world-core';
|
|
40
|
+
import { applyTwinWrite, projectResources, worldNow } from '@volter/world-core';
|
|
41
41
|
import { deliveryPlan, emitPostmarkInboundHook, emitPostmarkWebhook } from "./postmark-events.js";
|
|
42
42
|
const SERVICE = 'postmark';
|
|
43
43
|
/**
|
|
@@ -155,7 +155,7 @@ function asObject(v) {
|
|
|
155
155
|
return v && typeof v === 'object' && !Array.isArray(v) ? v : {};
|
|
156
156
|
}
|
|
157
157
|
function nowIso(occurredAt) {
|
|
158
|
-
return occurredAt ??
|
|
158
|
+
return occurredAt ?? worldNow();
|
|
159
159
|
}
|
|
160
160
|
// ── projection helpers ──────────────────────────────────────────────────────────────
|
|
161
161
|
/** ALL rows of a type, INCLUDING soft-deleted ones (the id ratchet must see tombstones). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/twin-postmark",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Local Postmark twin — a faithful, stateful local Postmark transactional-email API your real `postmark` SDK talks to unmodified. Plain/templated/batch sends, outbound + inbound message activity, bounces and delivery stats, templates, message streams, suppressions, webhooks, servers, domains and sender signatures. Deterministic offline delivery lifecycle and Postmark's real (unsigned, Basic-auth/custom-header) webhooks. Activity mirror UI. Built on @volter/world-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twin",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"react-dom": "^19.2.7"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@volter/world-core": "2.0.
|
|
61
|
+
"@volter/world-core": "2.0.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@volter/world-core": "2.0.
|
|
64
|
+
"@volter/world-core": "2.0.1",
|
|
65
65
|
"@volter/world-tooling": "0.1.0",
|
|
66
66
|
"postmark": "^4.0.5",
|
|
67
67
|
"@types/bun": "^1.2.20",
|
package/src/postmark-events.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// drives — no SMTP, no network. `deliveryPlan()` is pure so the twin + its tests are
|
|
22
22
|
// repeatable.
|
|
23
23
|
import { projectResources } from '@volter/world-core';
|
|
24
|
+
import { appDestination, appFetch } from '@volter/world-core/app-route';
|
|
24
25
|
import { worldEgressRefusal } from '@volter/world-core/network-policy';
|
|
25
26
|
|
|
26
27
|
const SERVICE = 'postmark';
|
|
@@ -77,9 +78,9 @@ export function webhookHeaders(webhook: Record<string, unknown>): Record<string,
|
|
|
77
78
|
|
|
78
79
|
/** Fire-and-forget HTTP delivery — the live path, like the real vendor's. */
|
|
79
80
|
const httpDelivery: PostmarkWebhookDelivery = async (url, body, headers) => {
|
|
80
|
-
if (worldEgressRefusal(url) !== null) return; // the World's egress rule: refused like an unreachable endpoint
|
|
81
|
+
if (!appDestination(url) && worldEgressRefusal(url) !== null) return; // the World's egress rule, the application's own hostnames reaching it inside the World: refused like an unreachable endpoint
|
|
81
82
|
try {
|
|
82
|
-
await
|
|
83
|
+
await appFetch(url, { method: 'POST', headers, body });
|
|
83
84
|
} catch {
|
|
84
85
|
/* fire-and-forget, like the real vendor */
|
|
85
86
|
}
|
package/src/postmark-twin.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
// stored message, mints Bounce records + suppressions on a bounce, and POSTs Postmark's real
|
|
38
38
|
// webhook payloads (RecordType: Delivery/Open/Click/Bounce/SpamComplaint) to registered
|
|
39
39
|
// webhooks (postmark-events.ts).
|
|
40
|
-
import { applyTwinWrite, projectResources } from '@volter/world-core';
|
|
40
|
+
import { applyTwinWrite, projectResources, worldNow } from '@volter/world-core';
|
|
41
41
|
import { deliveryPlan, emitPostmarkInboundHook, emitPostmarkWebhook, type PostmarkWebhookDelivery } from './postmark-events.ts';
|
|
42
42
|
|
|
43
43
|
const SERVICE = 'postmark';
|
|
@@ -182,7 +182,7 @@ function asObject(v: unknown): Record<string, unknown> {
|
|
|
182
182
|
return v && typeof v === 'object' && !Array.isArray(v) ? (v as Record<string, unknown>) : {};
|
|
183
183
|
}
|
|
184
184
|
function nowIso(occurredAt?: string): string {
|
|
185
|
-
return occurredAt ??
|
|
185
|
+
return occurredAt ?? worldNow();
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// ── projection helpers ──────────────────────────────────────────────────────────────
|