@happyvertical/smrt-messages 0.60.13 → 0.60.15

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 (57) hide show
  1. package/AGENTS.md +13 -0
  2. package/agents/notification-outbox.md +125 -2
  3. package/agents/profile-recipients.md +32 -0
  4. package/agents/scoped-attachment-test-matrix.md +46 -0
  5. package/dist/chunks/{AccountCollection-B7Nen_TO.js → AccountCollection-DBEG6nR7.js} +6 -7
  6. package/dist/chunks/AccountCollection-DBEG6nR7.js.map +1 -0
  7. package/dist/chunks/{Email-CnlwhWa0.js → Email-p5qIyMC5.js} +3 -3
  8. package/dist/chunks/{Email-CnlwhWa0.js.map → Email-p5qIyMC5.js.map} +1 -1
  9. package/dist/chunks/{EmailFolder-ukdMVI0c.js → EmailFolder-Dk4hxikK.js} +3 -3
  10. package/dist/chunks/EmailFolder-Dk4hxikK.js.map +1 -0
  11. package/dist/chunks/{Message-CinnTgyw.js → Message-hIwx07Kt.js} +72 -11
  12. package/dist/chunks/Message-hIwx07Kt.js.map +1 -0
  13. package/dist/chunks/{MessageCollection-BquAmxgU.js → MessageCollection-BwnE4a_L.js} +3 -3
  14. package/dist/chunks/MessageCollection-BwnE4a_L.js.map +1 -0
  15. package/dist/chunks/__smrt-register__-D3kBjvML.js +6 -0
  16. package/dist/chunks/__smrt-register__-D3kBjvML.js.map +1 -0
  17. package/dist/chunks/protected-notification-handoff-mvaEZVp7.js +358 -0
  18. package/dist/chunks/protected-notification-handoff-mvaEZVp7.js.map +1 -0
  19. package/dist/host.browser.d.ts +18 -0
  20. package/dist/host.browser.d.ts.map +1 -0
  21. package/dist/host.browser.js +27 -0
  22. package/dist/host.browser.js.map +1 -0
  23. package/dist/host.d.ts +19 -0
  24. package/dist/host.d.ts.map +1 -0
  25. package/dist/host.js +35 -0
  26. package/dist/host.js.map +1 -0
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +589 -67
  30. package/dist/index.js.map +1 -1
  31. package/dist/manifest.json +317 -14
  32. package/dist/migrations/profileRecipients.d.ts +17 -0
  33. package/dist/migrations/profileRecipients.d.ts.map +1 -0
  34. package/dist/models/Account.d.ts.map +1 -1
  35. package/dist/models/Message.d.ts +7 -0
  36. package/dist/models/Message.d.ts.map +1 -1
  37. package/dist/models/NotificationDelivery.d.ts +20 -3
  38. package/dist/models/NotificationDelivery.d.ts.map +1 -1
  39. package/dist/notification-recipient-identity.d.ts +17 -0
  40. package/dist/notification-recipient-identity.d.ts.map +1 -0
  41. package/dist/permissions.d.ts +1 -1
  42. package/dist/permissions.d.ts.map +1 -1
  43. package/dist/protected-notification-handoff.d.ts +31 -0
  44. package/dist/protected-notification-handoff.d.ts.map +1 -0
  45. package/dist/recipes.d.ts +1 -1
  46. package/dist/senders/EmailSender.d.ts.map +1 -1
  47. package/dist/services/NotificationOutboxService.d.ts +51 -3
  48. package/dist/services/NotificationOutboxService.d.ts.map +1 -1
  49. package/dist/smrt-knowledge.json +184 -12
  50. package/dist/smrt-knowledge.okf.md +7 -2
  51. package/package.json +13 -9
  52. package/dist/chunks/AccountCollection-B7Nen_TO.js.map +0 -1
  53. package/dist/chunks/EmailFolder-ukdMVI0c.js.map +0 -1
  54. package/dist/chunks/Message-CinnTgyw.js.map +0 -1
  55. package/dist/chunks/MessageCollection-BquAmxgU.js.map +0 -1
  56. package/dist/chunks/__smrt-register__-Dz163WBB.js +0 -6
  57. package/dist/chunks/__smrt-register__-Dz163WBB.js.map +0 -1
@@ -0,0 +1,358 @@
1
+ import { canonicalNotificationMessageId, createHandoffContext, notificationSha256 } from "../host.js";
2
+ import { ObjectRegistry } from "@happyvertical/smrt-core";
3
+ //#region src/notification-recipient-identity.ts
4
+ var PROFILE_NOTIFICATION_POLICY_PREFIX = "profile:";
5
+ function profileNotificationPolicy(hostPolicyId) {
6
+ if (typeof hostPolicyId !== "string" || !hostPolicyId.trim() || hostPolicyId !== hostPolicyId.trim() || /[\s\r\n]/u.test(hostPolicyId) || hostPolicyId.startsWith("profile:")) throw new Error("Choose an exact non-prefixed host notification policy ID.");
7
+ return `${PROFILE_NOTIFICATION_POLICY_PREFIX}${hostPolicyId}`;
8
+ }
9
+ function assertNotificationRecipientIdentity(row) {
10
+ if (typeof row.requiredDispatchPolicy !== "string" || typeof row.kind !== "string" || typeof row.channel !== "string") throw new Error("Malformed typed notification identity.");
11
+ const profilePolicy = row.requiredDispatchPolicy.startsWith("profile:") && row.requiredDispatchPolicy.length > 8;
12
+ const reserved = row.kind.startsWith("protected:profile:") || row.requiredDispatchPolicy.startsWith("profile:");
13
+ const nonempty = (value) => typeof value === "string" && Boolean(value.trim()) && value === value.trim();
14
+ if (!(row.recipientKind === "user" ? nonempty(row.recipientUserId) && row.recipientProfileId === null && !reserved : row.recipientKind === "profile" && row.recipientUserId === null && nonempty(row.recipientProfileId) && row.channel === "email" && profilePolicy && row.kind === `protected:${row.requiredDispatchPolicy}`)) throw new Error("Notification requires exactly one matching typed recipient and reserved protected email policy for profiles.");
15
+ }
16
+ //#endregion
17
+ //#region src/protected-notification-handoff.ts
18
+ var ProtectedNotificationHandoffError = class extends Error {};
19
+ var KEY = "__smrtProtectedOutbox";
20
+ var origins = /* @__PURE__ */ new WeakMap();
21
+ var fields = [
22
+ "tenantId",
23
+ "accountId",
24
+ "correlationId",
25
+ "subject",
26
+ "body",
27
+ "fromAddress",
28
+ "fromName",
29
+ "toAddresses",
30
+ "textBody",
31
+ "htmlBody",
32
+ "ccAddresses",
33
+ "bccAddresses",
34
+ "replyToAddress",
35
+ "replyToName",
36
+ "inReplyTo",
37
+ "headers",
38
+ "rawMessage"
39
+ ];
40
+ function column(key) {
41
+ return key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
42
+ }
43
+ function hash(value) {
44
+ return notificationSha256(JSON.stringify(value));
45
+ }
46
+ function marker(value) {
47
+ try {
48
+ const result = (typeof value === "string" ? JSON.parse(value || "{}") : value)?.[KEY];
49
+ return result && typeof result === "object" ? result : null;
50
+ } catch {
51
+ return null;
52
+ }
53
+ }
54
+ function hint(message) {
55
+ const marked = marker(message.metadata)?.deliveryId;
56
+ const candidate = typeof marked === "string" ? marked : message.correlationId?.startsWith("notification-delivery:") ? message.correlationId.slice(22) : null;
57
+ return candidate && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(candidate) ? candidate : null;
58
+ }
59
+ function rememberNotificationOrigin(message) {
60
+ const previous = origins.get(message);
61
+ origins.set(message, {
62
+ id: previous?.id || message.id || null,
63
+ hint: previous?.hint || hint(message),
64
+ protected: Boolean(previous?.protected || marker(message.metadata))
65
+ });
66
+ }
67
+ function protectedNotificationMetadata(deliveryId, policyId) {
68
+ return JSON.stringify({ [KEY]: {
69
+ deliveryId,
70
+ policyId
71
+ } });
72
+ }
73
+ function snapshot(message, persisted = false) {
74
+ const object = message;
75
+ return Object.fromEntries(fields.map((key) => [key, object[persisted ? column(key) : key] ?? (key === "tenantId" ? null : "")]));
76
+ }
77
+ function attachmentsDigest(attachments) {
78
+ if (!attachments?.length) throw new ProtectedNotificationHandoffError("Protected notification requires approved attachment bytes.");
79
+ return hash(attachments.map((file) => {
80
+ if (!(file.content instanceof Uint8Array)) throw new ProtectedNotificationHandoffError("Protected notification requires actual attachment bytes.");
81
+ return {
82
+ filename: file.filename,
83
+ contentType: file.contentType || "application/octet-stream",
84
+ contentId: file.contentId ?? null,
85
+ contentDisposition: file.contentDisposition ?? "attachment",
86
+ digest: notificationSha256(file.content)
87
+ };
88
+ }));
89
+ }
90
+ async function association(message) {
91
+ const origin = origins.get(message);
92
+ try {
93
+ if (!message.db || typeof message.db.tableExists !== "function") {
94
+ if (origin?.protected || marker(message.metadata) || origin?.hint) throw new ProtectedNotificationHandoffError("Protected notification requires durable storage.");
95
+ return null;
96
+ }
97
+ } catch (error) {
98
+ if (error instanceof ProtectedNotificationHandoffError || origin?.protected || marker(message.metadata) || origin?.hint) throw error;
99
+ return null;
100
+ }
101
+ const ids = [...new Set([message.id, origin?.id].filter((id2) => Boolean(id2)))];
102
+ const hints = [...new Set([hint(message), origin?.hint].filter((id2) => Boolean(id2)))];
103
+ let persistedProtected = false;
104
+ if (message.slug) {
105
+ const qualified = ObjectRegistry.getClassByConstructor(message.constructor)?.qualifiedName;
106
+ const binding = marker((await message.db.get(message.tableName, {
107
+ slug: message.slug,
108
+ context: message.context ?? "",
109
+ tenant_id: message.tenantId ?? null,
110
+ ...qualified ? { _meta_type: qualified } : {}
111
+ }))?.metadata);
112
+ if (binding) {
113
+ persistedProtected = true;
114
+ if (typeof binding.deliveryId === "string" && !hints.includes(binding.deliveryId)) hints.push(binding.deliveryId);
115
+ }
116
+ }
117
+ for (const id2 of ids) {
118
+ const binding = marker((await message.db.get(message.tableName, { id: id2 }))?.metadata);
119
+ if (binding) {
120
+ persistedProtected = true;
121
+ if (typeof binding.deliveryId === "string" && !hints.includes(binding.deliveryId)) hints.push(binding.deliveryId);
122
+ }
123
+ }
124
+ if (!await message.db.tableExists("notification_deliveries")) {
125
+ if (persistedProtected || origin?.protected || marker(message.metadata)) throw new ProtectedNotificationHandoffError("Protected notification delivery storage is unavailable.");
126
+ return null;
127
+ }
128
+ const clauses = [];
129
+ const values = [];
130
+ if (ids.length) {
131
+ clauses.push(`message_id IN (${ids.map(() => "?").join(",")})`);
132
+ values.push(...ids);
133
+ }
134
+ if (hints.length) {
135
+ clauses.push(`id IN (${hints.map(() => "?").join(",")})`);
136
+ values.push(...hints);
137
+ }
138
+ if (!clauses.length) return null;
139
+ const deliveries = (await message.db.query(`SELECT * FROM notification_deliveries WHERE required_dispatch_policy <> '' AND (${clauses.join(" OR ")})`, ...values)).rows;
140
+ if (!deliveries.length) {
141
+ if (persistedProtected || marker(message.metadata) || origin?.protected) throw new ProtectedNotificationHandoffError("Protected notification binding is unavailable.");
142
+ return null;
143
+ }
144
+ if (deliveries.length !== 1) throw new ProtectedNotificationHandoffError("Protected notification identity is ambiguous.");
145
+ const delivery = deliveries[0];
146
+ const id = String(delivery.message_id || message.id || "");
147
+ return {
148
+ delivery,
149
+ stored: id ? await message.db.get("messages", { id }) : null
150
+ };
151
+ }
152
+ function canonical(message, delivery) {
153
+ if (message.id !== canonicalNotificationMessageId(String(delivery.id))) throw new ProtectedNotificationHandoffError("Protected notification canonical identity cannot be cloned.");
154
+ const body = `${delivery.text_body}
155
+
156
+ ${delivery.href}
157
+ `;
158
+ const addresses = JSON.stringify([{
159
+ address: delivery.recipient_address,
160
+ ...delivery.recipient_name ? { name: delivery.recipient_name } : {}
161
+ }]);
162
+ const object = message;
163
+ if (message.tenantId !== delivery.tenant_id || message.accountId !== delivery.account_id || message.subject !== delivery.subject || message.body !== body || object.textBody !== body || message.toAddresses !== addresses || message.correlationId !== `notification-delivery:${delivery.id}` || [
164
+ "fromAddress",
165
+ "fromName",
166
+ "htmlBody",
167
+ "ccAddresses",
168
+ "bccAddresses",
169
+ "replyToAddress",
170
+ "replyToName",
171
+ "inReplyTo",
172
+ "headers",
173
+ "rawMessage"
174
+ ].some((key) => Boolean(object[key]))) throw new ProtectedNotificationHandoffError("Protected notification approved content or destination changed.");
175
+ const binding = marker(message.metadata);
176
+ if (!binding || binding.deliveryId !== delivery.id || binding.policyId !== delivery.required_dispatch_policy) throw new ProtectedNotificationHandoffError("Protected notification durable marker changed.");
177
+ }
178
+ async function assertProtectedNotificationSave(message, _options, lifecycleAuthorized = false) {
179
+ const found = await association(message);
180
+ if (!found) return;
181
+ const { delivery, stored } = found;
182
+ const origin = origins.get(message);
183
+ if (origin?.id && origin.id !== message.id || delivery.message_id && delivery.message_id !== message.id) throw new ProtectedNotificationHandoffError("Protected notification message identity cannot change.");
184
+ canonical(message, delivery);
185
+ if (stored) {
186
+ if (!message.isPersisted) throw new ProtectedNotificationHandoffError("Protected notification cannot adopt an existing message.");
187
+ if (hash(snapshot(message)) !== hash(snapshot(stored, true))) throw new ProtectedNotificationHandoffError("Protected notification content is immutable.");
188
+ const instant = (value) => value == null ? null : new Date(value).getTime();
189
+ const unknown = (value) => {
190
+ try {
191
+ return JSON.parse(String(value || "{}")).sendOutcomeUnknown === true;
192
+ } catch {
193
+ return false;
194
+ }
195
+ };
196
+ if ((stored.send_status !== message.sendStatus || Number(stored.retry_count) !== message.retryCount || Number(stored.max_retries) !== message.maxRetries || String(stored.send_error ?? "") !== message.sendError || instant(stored.sent_at) !== instant(message.sentAt) || instant(stored.scheduled_send_at) !== instant(message.scheduledSendAt) || unknown(stored.metadata) !== unknown(message.metadata)) && !lifecycleAuthorized) throw new ProtectedNotificationHandoffError("Protected notification lifecycle requires its outbox handoff.");
197
+ } else message.requireInsertOnSave();
198
+ }
199
+ var authority = createHandoffContext();
200
+ function deliveryDigest(delivery) {
201
+ assertNotificationRecipientIdentity({
202
+ recipientKind: delivery.recipient_kind ?? "user",
203
+ recipientUserId: delivery.recipient_user_id ?? null,
204
+ recipientProfileId: delivery.recipient_profile_id ?? null,
205
+ channel: delivery.channel,
206
+ kind: delivery.kind,
207
+ requiredDispatchPolicy: delivery.required_dispatch_policy ?? ""
208
+ });
209
+ return hash(Object.fromEntries([
210
+ "tenant_id",
211
+ "message_id",
212
+ "required_dispatch_policy",
213
+ "dispatch_policy_binding",
214
+ "kind",
215
+ "subject",
216
+ "text_body",
217
+ "href",
218
+ "recipient_kind",
219
+ "recipient_user_id",
220
+ "recipient_profile_id",
221
+ "recipient_address",
222
+ "recipient_name",
223
+ "account_id"
224
+ ].map((key) => [key, delivery[key]])));
225
+ }
226
+ async function accountDigest(message) {
227
+ const account = await message.getAccount();
228
+ if (!account || !account.isActive || account.tenantId !== message.tenantId) throw new ProtectedNotificationHandoffError("Protected notification sender is unavailable.");
229
+ const view = account;
230
+ return hash({
231
+ id: account.id,
232
+ tenantId: account.tenantId,
233
+ name: view.name,
234
+ email: view.email,
235
+ providerType: view.providerType
236
+ });
237
+ }
238
+ async function envelopeDigest(message) {
239
+ const sender = await message.getAccount();
240
+ const email = message;
241
+ const addresses = (key) => JSON.parse(String(email[key] || "[]")).map((row) => ({
242
+ name: row.name,
243
+ address: row.address
244
+ }));
245
+ const cc = addresses("ccAddresses");
246
+ const bcc = addresses("bccAddresses");
247
+ return hash({
248
+ from: {
249
+ name: message.fromName || sender.name,
250
+ address: message.fromAddress || sender.email
251
+ },
252
+ to: addresses("toAddresses"),
253
+ cc: cc.length ? cc : void 0,
254
+ bcc: bcc.length ? bcc : void 0,
255
+ subject: message.subject,
256
+ text: email.textBody || message.body,
257
+ html: email.htmlBody || void 0,
258
+ inReplyTo: email.inReplyTo || void 0
259
+ });
260
+ }
261
+ function actualEnvelopeDigest(envelope) {
262
+ return hash(Object.fromEntries([
263
+ "from",
264
+ "to",
265
+ "cc",
266
+ "bcc",
267
+ "subject",
268
+ "text",
269
+ "html",
270
+ "inReplyTo"
271
+ ].map((key) => [key, envelope[key]])));
272
+ }
273
+ async function validate(message, options) {
274
+ const found = await association(message);
275
+ if (!found) return null;
276
+ const scope = authority.getStore();
277
+ if (!scope?.active || scope.message !== message || message.id !== scope.messageId || message.tenantId !== scope.tenantId) throw new ProtectedNotificationHandoffError("Protected notification send requires its current approved outbox handoff.");
278
+ canonical(message, found.delivery);
279
+ const row = found.delivery;
280
+ if (row.id !== scope.deliveryId || row.status !== "sending" || row.lease_token !== scope.lease || Number(row.attempts) !== scope.attempts || Number(row.state_version) !== scope.stateVersion || !row.handed_off_at || new Date(row.lease_expires_at).getTime() <= scope.now().getTime() || deliveryDigest(row) !== scope.deliveryFingerprint || !found.stored || hash(snapshot(found.stored, true)) !== scope.body || hash(snapshot(message)) !== scope.body || attachmentsDigest(options?.attachments) !== scope.files || await accountDigest(message) !== scope.account || !scope.active) throw new ProtectedNotificationHandoffError("Protected notification handoff lease, attempt, destination or bytes changed.");
281
+ const current = await message.db.get("notification_deliveries", {
282
+ id: scope.deliveryId,
283
+ tenant_id: scope.tenantId
284
+ });
285
+ if (!scope.active || !current || current.status !== "sending" || current.lease_token !== scope.lease || Number(current.attempts) !== scope.attempts || Number(current.state_version) !== scope.stateVersion || new Date(current.lease_expires_at).getTime() <= scope.now().getTime() || deliveryDigest(current) !== scope.deliveryFingerprint) throw new ProtectedNotificationHandoffError("Protected notification current handoff lease was lost.");
286
+ return scope;
287
+ }
288
+ async function assertProtectedNotificationRetry(message, options) {
289
+ await validate(message, options);
290
+ }
291
+ async function beginProtectedNotificationSend(message, options) {
292
+ const scope = await validate(message, options);
293
+ if (!scope) return;
294
+ if (scope.started) throw new ProtectedNotificationHandoffError("Protected notification handoff was already used.");
295
+ scope.started = true;
296
+ }
297
+ async function assertProtectedSenderHandoff(message, options) {
298
+ const scope = await validate(message, options);
299
+ if (!scope) return;
300
+ if (!scope.started || scope.genericHandedOff) throw new ProtectedNotificationHandoffError("Protected notification sender authority was already used.");
301
+ scope.genericHandedOff = true;
302
+ }
303
+ async function assertProtectedEmailAdmission(message, options) {
304
+ const scope = await validate(message, options);
305
+ if (!scope) return;
306
+ if (!scope.started || !scope.genericHandedOff || scope.emailHandedOff) throw new ProtectedNotificationHandoffError("Protected notification sender requires the unused canonical handoff.");
307
+ }
308
+ async function assertProtectedEmailHandoff(message, attachments, options, envelope) {
309
+ const scope = await validate(message, options);
310
+ if (!scope) return;
311
+ if (!scope.started || !scope.genericHandedOff || scope.emailHandedOff || attachmentsDigest(attachments) !== scope.files || !envelope || actualEnvelopeDigest(envelope) !== scope.envelope || !scope.active) throw new ProtectedNotificationHandoffError("Protected notification provider authority was already used or its bytes changed.");
312
+ scope.emailHandedOff = true;
313
+ }
314
+ async function withProtectedNotificationHandoff(request, now, callback) {
315
+ const found = await association(request.message);
316
+ if (!found) {
317
+ if (request.delivery.requiredDispatchPolicy || request.delivery.kind.startsWith("protected:")) throw new ProtectedNotificationHandoffError("Protected notification durable association is missing.");
318
+ return callback();
319
+ }
320
+ if (found.delivery.required_dispatch_policy !== request.delivery.requiredDispatchPolicy) throw new ProtectedNotificationHandoffError("Protected notification policy identity changed.");
321
+ if (!found || found.delivery.id !== request.delivery.id || found.delivery.message_id !== request.message.id) throw new ProtectedNotificationHandoffError("Protected notification durable association is missing.");
322
+ canonical(request.message, found.delivery);
323
+ const row = found.delivery;
324
+ const scope = {
325
+ active: true,
326
+ started: false,
327
+ genericHandedOff: false,
328
+ emailHandedOff: false,
329
+ message: request.message,
330
+ messageId: request.message.id,
331
+ tenantId: request.delivery.tenantId,
332
+ deliveryId: request.delivery.id,
333
+ lease: request.delivery.leaseToken,
334
+ attempts: request.delivery.attempts,
335
+ stateVersion: request.delivery.stateVersion,
336
+ body: hash(snapshot(request.message)),
337
+ files: attachmentsDigest(request.attachments),
338
+ account: await accountDigest(request.message),
339
+ deliveryFingerprint: deliveryDigest(row),
340
+ envelope: await envelopeDigest(request.message),
341
+ now
342
+ };
343
+ try {
344
+ return await authority.run(scope, async () => {
345
+ await validate(request.message, { attachments: request.attachments });
346
+ return callback();
347
+ });
348
+ } finally {
349
+ scope.active = false;
350
+ }
351
+ }
352
+ async function assertProtectedNotificationDelete(message) {
353
+ if (await association(message)) throw new ProtectedNotificationHandoffError("Protected notification message provenance cannot be deleted.");
354
+ }
355
+ //#endregion
356
+ export { assertProtectedNotificationRetry as a, beginProtectedNotificationSend as c, withProtectedNotificationHandoff as d, PROFILE_NOTIFICATION_POLICY_PREFIX as f, assertProtectedNotificationDelete as i, protectedNotificationMetadata as l, profileNotificationPolicy as m, assertProtectedEmailAdmission as n, assertProtectedNotificationSave as o, assertNotificationRecipientIdentity as p, assertProtectedEmailHandoff as r, assertProtectedSenderHandoff as s, ProtectedNotificationHandoffError as t, rememberNotificationOrigin as u };
357
+
358
+ //# sourceMappingURL=protected-notification-handoff-mvaEZVp7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protected-notification-handoff-mvaEZVp7.js","names":["id","stored"],"sources":["../../src/notification-recipient-identity.ts","../../src/protected-notification-handoff.ts"],"sourcesContent":["/** Reserved profile policy identity: a clone retaining this kind cannot become a User send. */\nexport const PROFILE_NOTIFICATION_POLICY_PREFIX = 'profile:';\n/** Build the canonical profile-only policy ID used in the trusted dispatchPolicies map. */\nexport function profileNotificationPolicy(hostPolicyId: string): string {\n if (\n typeof hostPolicyId !== 'string' ||\n !hostPolicyId.trim() ||\n hostPolicyId !== hostPolicyId.trim() ||\n /[\\s\\r\\n]/u.test(hostPolicyId) ||\n hostPolicyId.startsWith(PROFILE_NOTIFICATION_POLICY_PREFIX)\n )\n throw new Error(\n 'Choose an exact non-prefixed host notification policy ID.',\n );\n return `${PROFILE_NOTIFICATION_POLICY_PREFIX}${hostPolicyId}`;\n}\nexport interface NotificationRecipientIdentity {\n recipientKind: 'user' | 'profile';\n recipientUserId: string | null;\n recipientProfileId: string | null;\n channel: string;\n kind: string;\n requiredDispatchPolicy: string;\n}\n/** Shared save/enqueue/lease/canonical-send guard, independent of model registration. */\nexport function assertNotificationRecipientIdentity(\n row: { [K in keyof NotificationRecipientIdentity]: unknown },\n): void {\n if (\n typeof row.requiredDispatchPolicy !== 'string' ||\n typeof row.kind !== 'string' ||\n typeof row.channel !== 'string'\n )\n throw new Error('Malformed typed notification identity.');\n const profilePolicy =\n row.requiredDispatchPolicy.startsWith(PROFILE_NOTIFICATION_POLICY_PREFIX) &&\n row.requiredDispatchPolicy.length >\n PROFILE_NOTIFICATION_POLICY_PREFIX.length;\n const reserved =\n row.kind.startsWith('protected:profile:') ||\n row.requiredDispatchPolicy.startsWith(PROFILE_NOTIFICATION_POLICY_PREFIX);\n const nonempty = (value: unknown) =>\n typeof value === 'string' &&\n Boolean(value.trim()) &&\n value === value.trim();\n const valid =\n row.recipientKind === 'user'\n ? nonempty(row.recipientUserId) &&\n row.recipientProfileId === null &&\n !reserved\n : row.recipientKind === 'profile' &&\n row.recipientUserId === null &&\n nonempty(row.recipientProfileId) &&\n row.channel === 'email' &&\n profilePolicy &&\n row.kind === `protected:${row.requiredDispatchPolicy}`;\n if (!valid)\n throw new Error(\n 'Notification requires exactly one matching typed recipient and reserved protected email policy for profiles.',\n );\n}\n","/** Package-private durable protection and one-use provider authority. Never exported from the package root. */\n\nimport { ObjectRegistry, type SmrtSaveOptions } from '@happyvertical/smrt-core';\nimport {\n canonicalNotificationMessageId as canonicalMessageId,\n createHandoffContext,\n notificationSha256,\n} from './host.js';\nimport type { Message } from './models/Message.js';\nimport { assertNotificationRecipientIdentity } from './notification-recipient-identity.js';\nimport type { NotificationTransportRequest } from './services/NotificationOutboxService.js';\nimport type {\n SendEmailAttachment,\n SendEmailOptions,\n SendMessageOptions,\n} from './types.js';\n\n/** Definite local refusal: no provider handoff occurred. */\nexport class ProtectedNotificationHandoffError extends Error {}\nconst KEY = '__smrtProtectedOutbox';\ntype Row = Record<string, unknown>;\nconst origins = new WeakMap<\n Message,\n { id: string | null; hint: string | null; protected: boolean }\n>();\nconst fields = [\n 'tenantId',\n 'accountId',\n 'correlationId',\n 'subject',\n 'body',\n 'fromAddress',\n 'fromName',\n 'toAddresses',\n 'textBody',\n 'htmlBody',\n 'ccAddresses',\n 'bccAddresses',\n 'replyToAddress',\n 'replyToName',\n 'inReplyTo',\n 'headers',\n 'rawMessage',\n] as const;\nfunction column(key: string): string {\n return key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\n}\nfunction hash(value: unknown): string {\n return notificationSha256(JSON.stringify(value));\n}\nfunction marker(value: unknown): Row | null {\n try {\n const bag = typeof value === 'string' ? JSON.parse(value || '{}') : value;\n const result = bag?.[KEY];\n return result && typeof result === 'object' ? result : null;\n } catch {\n return null;\n }\n}\nfunction hint(message: Message): string | null {\n const marked = marker(message.metadata)?.deliveryId;\n const candidate =\n typeof marked === 'string'\n ? marked\n : message.correlationId?.startsWith('notification-delivery:')\n ? message.correlationId.slice('notification-delivery:'.length)\n : null;\n return candidate &&\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(\n candidate,\n )\n ? candidate\n : null;\n}\n/** Remember constructor identity before public fields can be changed. */\nexport function rememberNotificationOrigin(message: Message): void {\n const previous = origins.get(message);\n origins.set(message, {\n id: previous?.id || message.id || null,\n hint: previous?.hint || hint(message),\n protected: Boolean(previous?.protected || marker(message.metadata)),\n });\n}\n/** Non-authorizing durable marker; forging it can only require stricter checks. */\nexport function protectedNotificationMetadata(\n deliveryId: string,\n policyId: string,\n): string {\n return JSON.stringify({ [KEY]: { deliveryId, policyId } });\n}\nfunction snapshot(message: Message | Row, persisted = false): Row {\n const object = message as unknown as Row;\n return Object.fromEntries(\n fields.map((key) => [\n key,\n object[persisted ? column(key) : key] ?? (key === 'tenantId' ? null : ''),\n ]),\n );\n}\nfunction attachmentsDigest(\n attachments: readonly SendEmailAttachment[] | undefined,\n): string {\n if (!attachments?.length)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification requires approved attachment bytes.',\n );\n return hash(\n attachments.map((file) => {\n if (!(file.content instanceof Uint8Array))\n throw new ProtectedNotificationHandoffError(\n 'Protected notification requires actual attachment bytes.',\n );\n return {\n filename: file.filename,\n contentType: file.contentType || 'application/octet-stream',\n contentId: file.contentId ?? null,\n contentDisposition: file.contentDisposition ?? 'attachment',\n digest: notificationSha256(file.content),\n };\n }),\n );\n}\nasync function association(\n message: Message,\n): Promise<{ delivery: Row; stored: Row | null } | null> {\n const origin = origins.get(message);\n try {\n if (!message.db || typeof message.db.tableExists !== 'function') {\n if (origin?.protected || marker(message.metadata) || origin?.hint)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification requires durable storage.',\n );\n return null;\n }\n } catch (error) {\n if (\n error instanceof ProtectedNotificationHandoffError ||\n origin?.protected ||\n marker(message.metadata) ||\n origin?.hint\n )\n throw error;\n // The existing direct EmailSender contract also accepts ordinary unsaved\n // drafts without persistence. Such drafts carry no protected provenance.\n return null;\n }\n const ids = [\n ...new Set(\n [message.id, origin?.id].filter((id): id is string => Boolean(id)),\n ),\n ];\n const hints = [\n ...new Set(\n [hint(message), origin?.hint].filter((id): id is string => Boolean(id)),\n ),\n ];\n let persistedProtected = false;\n if (message.slug) {\n const qualified = ObjectRegistry.getClassByConstructor(\n message.constructor as typeof Message,\n )?.qualifiedName;\n const natural = (await message.db.get(message.tableName, {\n slug: message.slug,\n context: message.context ?? '',\n tenant_id: message.tenantId ?? null,\n ...(qualified ? { _meta_type: qualified } : {}),\n })) as Row | null;\n const binding = marker(natural?.metadata);\n if (binding) {\n persistedProtected = true;\n if (\n typeof binding.deliveryId === 'string' &&\n !hints.includes(binding.deliveryId)\n )\n hints.push(binding.deliveryId);\n }\n }\n for (const id of ids) {\n const stored = (await message.db.get(message.tableName, {\n id,\n })) as Row | null;\n const binding = marker(stored?.metadata);\n if (binding) {\n persistedProtected = true;\n if (\n typeof binding.deliveryId === 'string' &&\n !hints.includes(binding.deliveryId)\n )\n hints.push(binding.deliveryId);\n }\n }\n if (!(await message.db.tableExists('notification_deliveries'))) {\n if (persistedProtected || origin?.protected || marker(message.metadata))\n throw new ProtectedNotificationHandoffError(\n 'Protected notification delivery storage is unavailable.',\n );\n return null;\n }\n const clauses: string[] = [];\n const values: string[] = [];\n if (ids.length) {\n clauses.push(`message_id IN (${ids.map(() => '?').join(',')})`);\n values.push(...ids);\n }\n if (hints.length) {\n clauses.push(`id IN (${hints.map(() => '?').join(',')})`);\n values.push(...hints);\n }\n if (!clauses.length) return null;\n const result = await message.db.query(\n `SELECT * FROM notification_deliveries WHERE required_dispatch_policy <> '' AND (${clauses.join(' OR ')})`,\n ...values,\n );\n const deliveries = result.rows as Row[];\n if (!deliveries.length) {\n if (persistedProtected || marker(message.metadata) || origin?.protected)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification binding is unavailable.',\n );\n return null;\n }\n if (deliveries.length !== 1)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification identity is ambiguous.',\n );\n const delivery = deliveries[0]!;\n const id = String(delivery.message_id || message.id || '');\n const stored = id\n ? ((await message.db.get('messages', { id })) as Row | null)\n : null;\n return { delivery, stored };\n}\nfunction canonical(message: Message, delivery: Row): void {\n if (message.id !== canonicalMessageId(String(delivery.id)))\n throw new ProtectedNotificationHandoffError(\n 'Protected notification canonical identity cannot be cloned.',\n );\n const body = `${delivery.text_body}\\n\\n${delivery.href}\\n`;\n const addresses = JSON.stringify([\n {\n address: delivery.recipient_address,\n ...(delivery.recipient_name ? { name: delivery.recipient_name } : {}),\n },\n ]);\n const object = message as unknown as Row;\n if (\n message.tenantId !== delivery.tenant_id ||\n message.accountId !== delivery.account_id ||\n message.subject !== delivery.subject ||\n message.body !== body ||\n object.textBody !== body ||\n message.toAddresses !== addresses ||\n message.correlationId !== `notification-delivery:${delivery.id}` ||\n [\n 'fromAddress',\n 'fromName',\n 'htmlBody',\n 'ccAddresses',\n 'bccAddresses',\n 'replyToAddress',\n 'replyToName',\n 'inReplyTo',\n 'headers',\n 'rawMessage',\n ].some((key) => Boolean(object[key]))\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification approved content or destination changed.',\n );\n const binding = marker(message.metadata);\n if (\n !binding ||\n binding.deliveryId !== delivery.id ||\n binding.policyId !== delivery.required_dispatch_policy\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification durable marker changed.',\n );\n}\n/** Prevent ordinary saves/identity changes/clones from stripping durable protection. */\nexport async function assertProtectedNotificationSave(\n message: Message,\n _options?: SmrtSaveOptions,\n lifecycleAuthorized = false,\n): Promise<void> {\n const found = await association(message);\n if (!found) return;\n const { delivery, stored } = found;\n const origin = origins.get(message);\n if (\n (origin?.id && origin.id !== message.id) ||\n (delivery.message_id && delivery.message_id !== message.id)\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification message identity cannot change.',\n );\n canonical(message, delivery);\n if (stored) {\n if (!message.isPersisted)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification cannot adopt an existing message.',\n );\n if (hash(snapshot(message)) !== hash(snapshot(stored, true)))\n throw new ProtectedNotificationHandoffError(\n 'Protected notification content is immutable.',\n );\n const instant = (value: unknown) =>\n value == null ? null : new Date(value as Date | string).getTime();\n const unknown = (value: unknown) => {\n try {\n return JSON.parse(String(value || '{}')).sendOutcomeUnknown === true;\n } catch {\n return false;\n }\n };\n const lifecycleChanged =\n stored.send_status !== message.sendStatus ||\n Number(stored.retry_count) !== message.retryCount ||\n Number(stored.max_retries) !== message.maxRetries ||\n String(stored.send_error ?? '') !== message.sendError ||\n instant(stored.sent_at) !== instant(message.sentAt) ||\n instant(stored.scheduled_send_at) !== instant(message.scheduledSendAt) ||\n unknown(stored.metadata) !== unknown(message.metadata);\n if (lifecycleChanged && !lifecycleAuthorized)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification lifecycle requires its outbox handoff.',\n );\n } else message.requireInsertOnSave();\n}\ninterface Scope {\n active: boolean;\n started: boolean;\n genericHandedOff: boolean;\n emailHandedOff: boolean;\n message: Message;\n messageId: string;\n tenantId: string;\n deliveryId: string;\n lease: string;\n attempts: number;\n stateVersion: number;\n body: string;\n files: string;\n account: string;\n deliveryFingerprint: string;\n envelope: string;\n now: () => Date;\n}\nconst authority = createHandoffContext<Scope>();\nfunction deliveryDigest(delivery: Row): string {\n assertNotificationRecipientIdentity({\n recipientKind: delivery.recipient_kind ?? 'user',\n recipientUserId: delivery.recipient_user_id ?? null,\n recipientProfileId: delivery.recipient_profile_id ?? null,\n channel: delivery.channel,\n kind: delivery.kind,\n requiredDispatchPolicy: delivery.required_dispatch_policy ?? '',\n });\n return hash(\n Object.fromEntries(\n [\n 'tenant_id',\n 'message_id',\n 'required_dispatch_policy',\n 'dispatch_policy_binding',\n 'kind',\n 'subject',\n 'text_body',\n 'href',\n 'recipient_kind',\n 'recipient_user_id',\n 'recipient_profile_id',\n 'recipient_address',\n 'recipient_name',\n 'account_id',\n ].map((key) => [key, delivery[key]]),\n ),\n );\n}\nasync function accountDigest(message: Message): Promise<string> {\n const account = await message.getAccount();\n if (!account || !account.isActive || account.tenantId !== message.tenantId)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification sender is unavailable.',\n );\n const view = account as unknown as Row;\n return hash({\n id: account.id,\n tenantId: account.tenantId,\n name: view.name,\n email: view.email,\n providerType: view.providerType,\n });\n}\nasync function envelopeDigest(message: Message): Promise<string> {\n const account = await message.getAccount();\n const sender = account as unknown as Row;\n const email = message as unknown as Row;\n const addresses = (key: string) =>\n JSON.parse(String(email[key] || '[]')).map((row: Row) => ({\n name: row.name,\n address: row.address,\n }));\n const cc = addresses('ccAddresses');\n const bcc = addresses('bccAddresses');\n return hash({\n from: {\n name: message.fromName || sender.name,\n address: message.fromAddress || sender.email,\n },\n to: addresses('toAddresses'),\n cc: cc.length ? cc : undefined,\n bcc: bcc.length ? bcc : undefined,\n subject: message.subject,\n text: email.textBody || message.body,\n html: email.htmlBody || undefined,\n inReplyTo: email.inReplyTo || undefined,\n });\n}\nfunction actualEnvelopeDigest(envelope: Row): string {\n return hash(\n Object.fromEntries(\n ['from', 'to', 'cc', 'bcc', 'subject', 'text', 'html', 'inReplyTo'].map(\n (key) => [key, envelope[key]],\n ),\n ),\n );\n}\nasync function validate(\n message: Message,\n options?: SendMessageOptions,\n): Promise<Scope | null> {\n const found = await association(message);\n if (!found) return null;\n const scope = authority.getStore();\n if (\n !scope?.active ||\n scope.message !== message ||\n message.id !== scope.messageId ||\n message.tenantId !== scope.tenantId\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification send requires its current approved outbox handoff.',\n );\n canonical(message, found.delivery);\n const row = found.delivery;\n if (\n row.id !== scope.deliveryId ||\n row.status !== 'sending' ||\n row.lease_token !== scope.lease ||\n Number(row.attempts) !== scope.attempts ||\n Number(row.state_version) !== scope.stateVersion ||\n !row.handed_off_at ||\n new Date(row.lease_expires_at as string | Date).getTime() <=\n scope.now().getTime() ||\n deliveryDigest(row) !== scope.deliveryFingerprint ||\n !found.stored ||\n hash(snapshot(found.stored, true)) !== scope.body ||\n hash(snapshot(message)) !== scope.body ||\n attachmentsDigest(\n (options as SendEmailOptions | undefined)?.attachments,\n ) !== scope.files ||\n (await accountDigest(message)) !== scope.account ||\n !scope.active\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification handoff lease, attempt, destination or bytes changed.',\n );\n const current = (await message.db.get('notification_deliveries', {\n id: scope.deliveryId,\n tenant_id: scope.tenantId,\n })) as Row | null;\n if (\n !scope.active ||\n !current ||\n current.status !== 'sending' ||\n current.lease_token !== scope.lease ||\n Number(current.attempts) !== scope.attempts ||\n Number(current.state_version) !== scope.stateVersion ||\n new Date(current.lease_expires_at as string | Date).getTime() <=\n scope.now().getTime() ||\n deliveryDigest(current) !== scope.deliveryFingerprint\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification current handoff lease was lost.',\n );\n return scope;\n}\n/** Non-consuming retry admission; send itself claims the one-use token. */\nexport async function assertProtectedNotificationRetry(\n message: Message,\n options?: SendMessageOptions,\n): Promise<void> {\n await validate(message, options);\n}\n/** Claim exactly one canonical send invocation before any provider/account action. */\nexport async function beginProtectedNotificationSend(\n message: Message,\n options?: SendMessageOptions,\n): Promise<void> {\n const scope = await validate(message, options);\n if (!scope) return;\n if (scope.started)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification handoff was already used.',\n );\n scope.started = true;\n}\n/** Consume once immediately before the sender invocation. */\nexport async function assertProtectedSenderHandoff(\n message: Message,\n options?: SendMessageOptions,\n): Promise<void> {\n const scope = await validate(message, options);\n if (!scope) return;\n if (!scope.started || scope.genericHandedOff)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification sender authority was already used.',\n );\n scope.genericHandedOff = true;\n}\n/** Deny unauthorized direct EmailSender calls before it reads stored attachment files. */\nexport async function assertProtectedEmailAdmission(\n message: Message,\n options?: SendEmailOptions,\n): Promise<void> {\n const scope = await validate(message, options);\n if (!scope) return;\n if (!scope.started || !scope.genericHandedOff || scope.emailHandedOff)\n throw new ProtectedNotificationHandoffError(\n 'Protected notification sender requires the unused canonical handoff.',\n );\n}\n/** Recheck after attachment I/O at the actual default EmailClient handoff; copied stored attachments cannot sneak in. */\nexport async function assertProtectedEmailHandoff(\n message: Message,\n attachments: readonly SendEmailAttachment[],\n options?: SendEmailOptions,\n envelope?: Row,\n): Promise<void> {\n const scope = await validate(message, options);\n if (!scope) return;\n if (\n !scope.started ||\n !scope.genericHandedOff ||\n scope.emailHandedOff ||\n attachmentsDigest(attachments) !== scope.files ||\n !envelope ||\n actualEnvelopeDigest(envelope) !== scope.envelope ||\n !scope.active\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification provider authority was already used or its bytes changed.',\n );\n scope.emailHandedOff = true;\n}\n/** Only the outbox calls this after its trusted policy verified/copied bytes and recorded the current lease handoff. */\nexport async function withProtectedNotificationHandoff<T>(\n request: NotificationTransportRequest,\n now: () => Date,\n callback: () => Promise<T>,\n): Promise<T> {\n const found = await association(request.message);\n if (!found) {\n if (\n request.delivery.requiredDispatchPolicy ||\n request.delivery.kind.startsWith('protected:')\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification durable association is missing.',\n );\n return callback();\n }\n if (\n found.delivery.required_dispatch_policy !==\n request.delivery.requiredDispatchPolicy\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification policy identity changed.',\n );\n if (\n !found ||\n found.delivery.id !== request.delivery.id ||\n found.delivery.message_id !== request.message.id\n )\n throw new ProtectedNotificationHandoffError(\n 'Protected notification durable association is missing.',\n );\n canonical(request.message, found.delivery);\n const row = found.delivery;\n const scope: Scope = {\n active: true,\n started: false,\n genericHandedOff: false,\n emailHandedOff: false,\n message: request.message,\n messageId: request.message.id!,\n tenantId: request.delivery.tenantId,\n deliveryId: request.delivery.id!,\n lease: request.delivery.leaseToken!,\n attempts: request.delivery.attempts,\n stateVersion: request.delivery.stateVersion,\n body: hash(snapshot(request.message)),\n files: attachmentsDigest(request.attachments),\n account: await accountDigest(request.message),\n deliveryFingerprint: deliveryDigest(row),\n envelope: await envelopeDigest(request.message),\n now,\n };\n try {\n return await authority.run(scope, async () => {\n // Custom trusted transports are also a handoff seam; check the current\n // durable lease before yielding approved bytes to their callback.\n await validate(request.message, {\n attachments: request.attachments,\n } as SendEmailOptions);\n return callback();\n });\n } finally {\n scope.active = false;\n }\n}\n\n/** Retain the durable protected message association through ordinary model/collection deletion. */\nexport async function assertProtectedNotificationDelete(\n message: Message,\n): Promise<void> {\n if (await association(message))\n throw new ProtectedNotificationHandoffError(\n 'Protected notification message provenance cannot be deleted.',\n );\n}\n"],"mappings":";;;AACO,IAAM,qCAAqC;AAE3C,SAAS,0BAA0B,cAA8B;CACtE,IACE,OAAO,iBAAiB,YACxB,CAAC,aAAa,KAAK,KACnB,iBAAiB,aAAa,KAAK,KACnC,YAAY,KAAK,YAAY,KAC7B,aAAa,WAAA,UAA6C,GAE1D,MAAM,IAAI,MACR,2DACF;CACF,OAAO,GAAG,qCAAqC;AACjD;AAUO,SAAS,oCACd,KACM;CACN,IACE,OAAO,IAAI,2BAA2B,YACtC,OAAO,IAAI,SAAS,YACpB,OAAO,IAAI,YAAY,UAEvB,MAAM,IAAI,MAAM,wCAAwC;CAC1D,MAAM,gBACJ,IAAI,uBAAuB,WAAA,UAA6C,KACxE,IAAI,uBAAuB,SACzB;CACJ,MAAM,WACJ,IAAI,KAAK,WAAW,oBAAoB,KACxC,IAAI,uBAAuB,WAAA,UAA6C;CAC1E,MAAM,YAAY,UAChB,OAAO,UAAU,YACjB,QAAQ,MAAM,KAAK,CAAC,KACpB,UAAU,MAAM,KAAK;CAYvB,IAAI,EAVF,IAAI,kBAAkB,SAClB,SAAS,IAAI,eAAe,KAC5B,IAAI,uBAAuB,QAC3B,CAAC,WACD,IAAI,kBAAkB,aACtB,IAAI,oBAAoB,QACxB,SAAS,IAAI,kBAAkB,KAC/B,IAAI,YAAY,WAChB,iBACA,IAAI,SAAS,aAAa,IAAI,2BAElC,MAAM,IAAI,MACR,8GACF;AACJ;;;AC1CO,IAAM,oCAAN,cAAgD,MAAM,CAAC;AAC9D,IAAM,MAAM;AAEZ,IAAM,0BAAU,IAAI,QAGlB;AACF,IAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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C,MAAM,MAAM,MAAM;CAClB,MAAM,QAAe;EACnB,QAAQ;EACR,SAAS;EACT,kBAAkB;EAClB,gBAAgB;EAChB,SAAS,QAAQ;EACjB,WAAW,QAAQ,QAAQ;EAC3B,UAAU,QAAQ,SAAS;EAC3B,YAAY,QAAQ,SAAS;EAC7B,OAAO,QAAQ,SAAS;EACxB,UAAU,QAAQ,SAAS;EAC3B,cAAc,QAAQ,SAAS;EAC/B,MAAM,KAAK,SAAS,QAAQ,OAAO,CAAC;EACpC,OAAO,kBAAkB,QAAQ,WAAW;EAC5C,SAAS,MAAM,cAAc,QAAQ,OAAO;EAC5C,qBAAqB,eAAe,GAAG;EACvC,UAAU,MAAM,eAAe,QAAQ,OAAO;EAC9C;CACF;CACA,IAAI;EACF,OAAO,MAAM,UAAU,IAAI,OAAO,YAAY;GAG5C,MAAM,SAAS,QAAQ,SAAS,EAC9B,aAAa,QAAQ,YACvB,CAAqB;GACrB,OAAO,SAAS;EAClB,CAAC;CACH,UAAE;EACA,MAAM,SAAS;CACjB;AACF;AAGA,eAAsB,kCACpB,SACe;CACf,IAAI,MAAM,YAAY,OAAO,GAC3B,MAAM,IAAI,kCACR,8DACF;AACJ"}
@@ -0,0 +1,18 @@
1
+ /** Browser boundary: ordinary model reads remain available, but private server authority and maintenance never fall back to browser globals. */
2
+ import type * as NodeHost from './host.js';
3
+ export declare const notificationSha256: typeof NodeHost.notificationSha256;
4
+ export declare const canonicalNotificationMessageId: typeof NodeHost.canonicalNotificationMessageId;
5
+ export declare const isDeepStrictEqual: typeof NodeHost.isDeepStrictEqual;
6
+ export declare const buildSqliteRebuildStatements: typeof NodeHost.buildSqliteRebuildStatements;
7
+ export declare const assertNotificationMaintenanceHost: typeof NodeHost.assertNotificationMaintenanceHost;
8
+ /** No scope can be created or inherited in a browser. Absence is never authorization. */
9
+ export declare function createHandoffContext<T>(): NodeHost.HandoffContext<T>;
10
+ export declare const normalizeIdentityEmail: typeof NodeHost.normalizeIdentityEmail;
11
+ export declare const readNotificationProfile: typeof NodeHost.readNotificationProfile;
12
+ export declare const getCurrentTenant: typeof NodeHost.getCurrentTenant;
13
+ export declare const withTenant: typeof NodeHost.withTenant;
14
+ export declare const withSystemContext: typeof NodeHost.withSystemContext;
15
+ export declare const queryGlobal: typeof NodeHost.queryGlobal;
16
+ export declare const queryWithGlobals: typeof NodeHost.queryWithGlobals;
17
+ export declare const createAccountSecretService: typeof NodeHost.createAccountSecretService;
18
+ //# sourceMappingURL=host.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.browser.d.ts","sourceRoot":"","sources":["../src/host.browser.ts"],"names":[],"mappings":"AAAA,gJAAgJ;AAChJ,OAAO,KAAK,KAAK,QAAQ,MAAM,WAAW,CAAC;AAK3C,eAAO,MAAM,kBAAkB,EAAE,OAAO,QAAQ,CAAC,kBACjC,CAAC;AACjB,eAAO,MAAM,8BAA8B,EAAE,OAAO,QAAQ,CAAC,8BAC7C,CAAC;AACjB,eAAO,MAAM,iBAAiB,EAAE,OAAO,QAAQ,CAAC,iBAChC,CAAC;AACjB,eAAO,MAAM,4BAA4B,EAAE,OAAO,QAAQ,CAAC,4BAC3C,CAAC;AACjB,eAAO,MAAM,iCAAiC,EAAE,OAAO,QAAQ,CAAC,iCAChD,CAAC;AACjB,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,CAAC,KAAK,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAEpE;AAED,eAAO,MAAM,sBAAsB,EAAE,OAAO,QAAQ,CAAC,sBACrC,CAAC;AACjB,eAAO,MAAM,uBAAuB,EAAE,OAAO,QAAQ,CAAC,uBACtC,CAAC;AAEjB,eAAO,MAAM,gBAAgB,EAAE,OAAO,QAAQ,CAAC,gBAC/B,CAAC;AACjB,eAAO,MAAM,UAAU,EAAE,OAAO,QAAQ,CAAC,UAA2B,CAAC;AACrE,eAAO,MAAM,iBAAiB,EAAE,OAAO,QAAQ,CAAC,iBAChC,CAAC;AACjB,eAAO,MAAM,WAAW,EAAE,OAAO,QAAQ,CAAC,WAA4B,CAAC;AACvE,eAAO,MAAM,gBAAgB,EAAE,OAAO,QAAQ,CAAC,gBAC/B,CAAC;AAEjB,eAAO,MAAM,0BAA0B,EAAE,OAAO,QAAQ,CAAC,0BACzC,CAAC"}
@@ -0,0 +1,27 @@
1
+ //#region src/host.browser.ts
2
+ function serverRequired() {
3
+ throw new Error("Messaging server operations require a server host.");
4
+ }
5
+ var notificationSha256 = serverRequired;
6
+ var canonicalNotificationMessageId = serverRequired;
7
+ var isDeepStrictEqual = serverRequired;
8
+ var buildSqliteRebuildStatements = serverRequired;
9
+ var assertNotificationMaintenanceHost = serverRequired;
10
+ function createHandoffContext() {
11
+ return {
12
+ getStore: () => void 0,
13
+ run: serverRequired
14
+ };
15
+ }
16
+ var normalizeIdentityEmail = serverRequired;
17
+ var readNotificationProfile = serverRequired;
18
+ var getCurrentTenant = serverRequired;
19
+ var withTenant = serverRequired;
20
+ var withSystemContext = serverRequired;
21
+ var queryGlobal = serverRequired;
22
+ var queryWithGlobals = serverRequired;
23
+ var createAccountSecretService = serverRequired;
24
+ //#endregion
25
+ export { assertNotificationMaintenanceHost, buildSqliteRebuildStatements, canonicalNotificationMessageId, createAccountSecretService, createHandoffContext, getCurrentTenant, isDeepStrictEqual, normalizeIdentityEmail, notificationSha256, queryGlobal, queryWithGlobals, readNotificationProfile, withSystemContext, withTenant };
26
+
27
+ //# sourceMappingURL=host.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.browser.js","names":[],"sources":["../src/host.browser.ts"],"sourcesContent":["/** Browser boundary: ordinary model reads remain available, but private server authority and maintenance never fall back to browser globals. */\nimport type * as NodeHost from './host.js';\n\nfunction serverRequired(): never {\n throw new Error('Messaging server operations require a server host.');\n}\nexport const notificationSha256: typeof NodeHost.notificationSha256 =\n serverRequired;\nexport const canonicalNotificationMessageId: typeof NodeHost.canonicalNotificationMessageId =\n serverRequired;\nexport const isDeepStrictEqual: typeof NodeHost.isDeepStrictEqual =\n serverRequired;\nexport const buildSqliteRebuildStatements: typeof NodeHost.buildSqliteRebuildStatements =\n serverRequired;\nexport const assertNotificationMaintenanceHost: typeof NodeHost.assertNotificationMaintenanceHost =\n serverRequired;\n/** No scope can be created or inherited in a browser. Absence is never authorization. */\nexport function createHandoffContext<T>(): NodeHost.HandoffContext<T> {\n return { getStore: () => undefined, run: serverRequired };\n}\n\nexport const normalizeIdentityEmail: typeof NodeHost.normalizeIdentityEmail =\n serverRequired;\nexport const readNotificationProfile: typeof NodeHost.readNotificationProfile =\n serverRequired;\n\nexport const getCurrentTenant: typeof NodeHost.getCurrentTenant =\n serverRequired;\nexport const withTenant: typeof NodeHost.withTenant = serverRequired;\nexport const withSystemContext: typeof NodeHost.withSystemContext =\n serverRequired;\nexport const queryGlobal: typeof NodeHost.queryGlobal = serverRequired;\nexport const queryWithGlobals: typeof NodeHost.queryWithGlobals =\n serverRequired;\n\nexport const createAccountSecretService: typeof NodeHost.createAccountSecretService =\n serverRequired;\n"],"mappings":";AAGA,SAAS,iBAAwB;CAC/B,MAAM,IAAI,MAAM,oDAAoD;AACtE;AACO,IAAM,qBACX;AACK,IAAM,iCACX;AACK,IAAM,oBACX;AACK,IAAM,+BACX;AACK,IAAM,oCACX;AAEK,SAAS,uBAAsD;CACpE,OAAO;EAAE,gBAAgB,KAAA;EAAW,KAAK;CAAe;AAC1D;AAEO,IAAM,yBACX;AACK,IAAM,0BACX;AAEK,IAAM,mBACX;AACK,IAAM,aAAyC;AAC/C,IAAM,oBACX;AACK,IAAM,cAA2C;AACjD,IAAM,mBACX;AAEK,IAAM,6BACX"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { DatabaseInterface } from '@happyvertical/sql';
2
+ export { isDeepStrictEqual } from 'node:util';
3
+ export { buildSqliteRebuildStatements } from '@happyvertical/smrt-core/migrations';
4
+ export { normalizeIdentityEmail } from '@happyvertical/smrt-profiles';
5
+ export interface HandoffContext<T> {
6
+ getStore(): T | undefined;
7
+ run<R>(store: T, callback: () => R): R;
8
+ }
9
+ /** The caller owns this store; this module exposes no authority mint or shared store. */
10
+ export declare function createHandoffContext<T>(): HandoffContext<T>;
11
+ export declare function notificationSha256(value: string | Uint8Array): string;
12
+ export declare function canonicalNotificationMessageId(deliveryId: string): string;
13
+ export declare function assertNotificationMaintenanceHost(): void;
14
+ /** The existing public Profile lookup stays server-only; the outbox owns current tenant/resource validation. */
15
+ export declare function readNotificationProfile(db: DatabaseInterface, tenantId: string, profileId: string): Promise<import("@happyvertical/smrt-profiles").Profile | null>;
16
+ export { getCurrentTenant, queryGlobal, queryWithGlobals, withSystemContext, withTenant, } from '@happyvertical/smrt-tenancy';
17
+ /** Preserve the original public lazy SecretService factory; callers keep all credential/tenant checks. */
18
+ export declare function createAccountSecretService(db: DatabaseInterface): Promise<import("@happyvertical/smrt-secrets").SecretService>;
19
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;CACxC;AACD,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,CAE3D;AACD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAErE;AACD,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CASzE;AACD,wBAAgB,iCAAiC,IAAI,IAAI,CAAG;AAE5D,gHAAgH;AAChH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,kEAMlB;AAED,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,6BAA6B,CAAC;AAErC,0GAA0G;AAC1G,wBAAsB,0BAA0B,CAAC,EAAE,EAAE,iBAAiB,gEAGrE"}
package/dist/host.js ADDED
@@ -0,0 +1,35 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { createHash } from "node:crypto";
3
+ import { ProfileCollection, normalizeIdentityEmail } from "@happyvertical/smrt-profiles";
4
+ import { isDeepStrictEqual } from "node:util";
5
+ import { buildSqliteRebuildStatements } from "@happyvertical/smrt-core/migrations";
6
+ import { getCurrentTenant, queryGlobal, queryWithGlobals, withSystemContext, withTenant } from "@happyvertical/smrt-tenancy";
7
+ //#region src/host.ts
8
+ function createHandoffContext() {
9
+ return new AsyncLocalStorage();
10
+ }
11
+ function notificationSha256(value) {
12
+ return createHash("sha256").update(value).digest("hex");
13
+ }
14
+ function canonicalNotificationMessageId(deliveryId) {
15
+ const bytes = createHash("sha256").update(`smrt-messages:notification-delivery:${deliveryId}`).digest().subarray(0, 16);
16
+ bytes[6] = (bytes[6] ?? 0) & 15 | 80;
17
+ bytes[8] = (bytes[8] ?? 0) & 63 | 128;
18
+ const hex = bytes.toString("hex");
19
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
20
+ }
21
+ function assertNotificationMaintenanceHost() {}
22
+ async function readNotificationProfile(db, tenantId, profileId) {
23
+ return (await ProfileCollection.create({ db })).get({
24
+ id: profileId,
25
+ tenantId
26
+ }, { cache: false });
27
+ }
28
+ async function createAccountSecretService(db) {
29
+ const { SecretService } = await import("@happyvertical/smrt-secrets");
30
+ return SecretService.create({ db });
31
+ }
32
+ //#endregion
33
+ export { assertNotificationMaintenanceHost, buildSqliteRebuildStatements, canonicalNotificationMessageId, createAccountSecretService, createHandoffContext, getCurrentTenant, isDeepStrictEqual, normalizeIdentityEmail, notificationSha256, queryGlobal, queryWithGlobals, readNotificationProfile, withSystemContext, withTenant };
34
+
35
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/** Package-private Node host primitives. Browser consumers select host.browser through the package browser map. */\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { createHash } from 'node:crypto';\nimport { ProfileCollection } from '@happyvertical/smrt-profiles';\nimport type { DatabaseInterface } from '@happyvertical/sql';\n\nexport { isDeepStrictEqual } from 'node:util';\nexport { buildSqliteRebuildStatements } from '@happyvertical/smrt-core/migrations';\nexport { normalizeIdentityEmail } from '@happyvertical/smrt-profiles';\n\nexport interface HandoffContext<T> {\n getStore(): T | undefined;\n run<R>(store: T, callback: () => R): R;\n}\n/** The caller owns this store; this module exposes no authority mint or shared store. */\nexport function createHandoffContext<T>(): HandoffContext<T> {\n return new AsyncLocalStorage<T>();\n}\nexport function notificationSha256(value: string | Uint8Array): string {\n return createHash('sha256').update(value).digest('hex');\n}\nexport function canonicalNotificationMessageId(deliveryId: string): string {\n const bytes = createHash('sha256')\n .update(`smrt-messages:notification-delivery:${deliveryId}`)\n .digest()\n .subarray(0, 16);\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x50;\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;\n const hex = bytes.toString('hex');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\nexport function assertNotificationMaintenanceHost(): void {}\n\n/** The existing public Profile lookup stays server-only; the outbox owns current tenant/resource validation. */\nexport async function readNotificationProfile(\n db: DatabaseInterface,\n tenantId: string,\n profileId: string,\n) {\n return (await ProfileCollection.create({ db })).get(\n { id: profileId, tenantId },\n { cache: false },\n );\n}\n\nexport {\n getCurrentTenant,\n queryGlobal,\n queryWithGlobals,\n withSystemContext,\n withTenant,\n} from '@happyvertical/smrt-tenancy';\n\n/** Preserve the original public lazy SecretService factory; callers keep all credential/tenant checks. */\nexport async function createAccountSecretService(db: DatabaseInterface) {\n const { SecretService } = await import('@happyvertical/smrt-secrets');\n return SecretService.create({ db });\n}\n"],"mappings":";;;;;;;AAeO,SAAS,uBAA6C;CAC3D,OAAO,IAAI,kBAAqB;AAClC;AACO,SAAS,mBAAmB,OAAoC;CACrE,OAAO,WAAW,QAAQ,CAAA,CAAE,OAAO,KAAK,CAAA,CAAE,OAAO,KAAK;AACxD;AACO,SAAS,+BAA+B,YAA4B;CACzE,MAAM,QAAQ,WAAW,QAAQ,CAAA,CAC9B,OAAO,uCAAuC,YAAY,CAAA,CAC1D,OAAO,CAAA,CACP,SAAS,GAAG,EAAE;CACjB,MAAM,MAAO,MAAM,MAAM,KAAK,KAAQ;CACtC,MAAM,MAAO,MAAM,MAAM,KAAK,KAAQ;CACtC,MAAM,MAAM,MAAM,SAAS,KAAK;CAChC,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAC,GAAI,IAAI,MAAM,GAAG,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,EAAE;AACzG;AACO,SAAS,oCAA0C,CAAC;AAG3D,eAAsB,wBACpB,IACA,UACA,WACA;CACA,QAAQ,MAAM,kBAAkB,OAAO,EAAE,GAAG,CAAC,EAAA,CAAG,IAC9C;EAAE,IAAI;EAAW;CAAS,GAC1B,EAAE,OAAO,MAAM,CACjB;AACF;AAWA,eAAsB,2BAA2B,IAAuB;CACtE,MAAM,EAAE,kBAAkB,MAAM,OAAO;CACvC,OAAO,cAAc,OAAO,EAAE,GAAG,CAAC;AACpC"}
package/dist/index.d.ts CHANGED
@@ -49,9 +49,11 @@ export { TweetSender } from "./senders/TweetSender.js";
49
49
  export { ZulipSender } from './senders/ZulipSender.js';
50
50
  export { type MessagingAccountInput, type MessagingAccountView, type MessagingEndpointInput, type MessagingEndpointView, MessagingSettingsService, type PersonaMessageRouteInput, } from './services/MessagingSettingsService.js';
51
51
  export { type NotificationOptOutChange, type NotificationOptOutDenialReason, NotificationOptOutDeniedError, type NotificationOptOutKey, type NotificationOptOutListRequest, type NotificationOptOutPrincipal, NotificationOptOutService, optOutSuppression, } from './services/NotificationOptOutService.js';
52
- export { buildNotificationLink, messageSendTransport, type NotificationDispatchOptions, type NotificationDispatchOutcome, type NotificationDispatchReport, type NotificationEmailInput, type NotificationEnqueueResult, type NotificationOutboxDenialReason, NotificationOutboxDeniedError, type NotificationOutboxOptions, NotificationOutboxService, type NotificationRecipient, type NotificationRecipientRequest, type NotificationReconcileOutcome, type NotificationSuppressionRequest, type NotificationTransport, type NotificationTransportOutcome, type NotificationTransportReconciliation, type NotificationTransportRequest, notificationDeliveryCorrelationId, notificationDeliveryMessageId, } from './services/NotificationOutboxService.js';
52
+ export { buildNotificationLink, messageSendTransport, type NotificationDispatchOptions, type NotificationDispatchOutcome, type NotificationDispatchReport, type NotificationEmailInput, type NotificationEnqueueResult, type NotificationOutboxDenialReason, NotificationOutboxDeniedError, type NotificationOutboxOptions, NotificationOutboxService, type NotificationProfileRecipientRequest, type NotificationProfileSuppressionRequest, type NotificationRecipient, type NotificationRecipientRequest, type NotificationReconcileOutcome, type NotificationSuppressionRequest, type NotificationTransport, type NotificationTransportOutcome, type NotificationTransportReconciliation, type NotificationTransportRequest, notificationDeliveryCorrelationId, notificationDeliveryMessageId, } from './services/NotificationOutboxService.js';
53
53
  export { type PersonaMessageSendResult, PersonaMessagingService, } from './services/PersonaMessagingService.js';
54
54
  export { type UserNotificationInput, type UserNotificationListOptions, type UserNotificationNotifyResult, type UserNotificationScope, UserNotificationService, } from './services/UserNotificationService.js';
55
55
  export type { AccountOptions, AccountSearchFilters, AccountType, AttachmentOptions, EmailAccountOptions, EmailAccountSearchFilters, EmailAttachmentOptions, EmailFolderOptions, EmailFolderSearchFilters, EmailOptions, EmailSearchFilters, KnownMessagingChannel, MessageOptions, MessageSearchFilters, MessageSenderInterface, MessageSendResult, MessageType, MessagingChannel, MessagingEndpointOptions, PersonaMessageRouteOptions, ProviderType, SendEmailAttachment, SendEmailOptions, SendMessageOptions, SendPersonaMessageOptions, SendSlackOptions, SendStatus, SendTweetOptions, SlackAccountOptions, SlackMessageOptions, SyncOptions, SyncProgress, SyncResult, TweetOptions, TwitterAccountOptions, } from "./types.js";
56
+ export { assertNotificationProfileRecipientSchema, migrateNotificationProfileRecipients, type NotificationProfileRecipientEngine, type NotificationProfileRecipientPlan, planNotificationProfileRecipients, } from './migrations/profileRecipients.js';
57
+ export { type NotificationRecipientIdentity, PROFILE_NOTIFICATION_POLICY_PREFIX, profileNotificationPolicy, } from './notification-recipient-identity.js';
56
58
  export { MailboxRecipe, NotificationsRecipe, SlackRecipe } from './recipes.js';
57
59
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,wBAAwB,CAAC;AAShC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAiC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAoC,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAiC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,E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