@nodii/notify
v0.5.0
Published
One request function for every Nodii notification. Takes the kind, sender, recipient, scope tenant and channels, has no payer argument, and writes through @nodii/outbox-dispatcher (S08-38). Generated from notification-kinds.json. Polyglot ship: TS + Pytho
Readme
@nodii/notify
Every Nodii service requests a notification through one function (S08-38).
const notifier = defineNotifier({ sourceService, topicPrefix, outboxTable, platformTenantId });
await notifier.requestNotification(tx, {
kind: "invoice_due",
sender: tenantSender(tenantId),
recipient: { record: "customer", customerId },
scopeTenantId: tenantId,
channels: ["email", "sms"],
requestId: invoiceId,
});kindis a registered kind, so an unregistered kind does not compile. A missingkind,senderorrecipientdoes not compile either.- There is no payer argument. The payer follows from the sender and the kind's class (S08-2).
scopeTenantIdmeans only "whose data is involved" (S08-3).- A partner-triggered send names the brand tenant as sender (S08-6).
recipientis a reference to a record. Its recipient kind comes fromrecord. An outside contact is tokenized (PII-47).- It writes one row per channel in the caller's transaction, through
@nodii/outbox-dispatcher.
Types come from notification's notification-kinds.json, pinned in registries/notification-kinds.pin.json. Regenerate with bun run registries:gen; never edit src/generated.
On the wire tenant_id remains the sending scope, because notification's intake routes on it today. scope_tenant_id carries the S08-3 meaning.
