@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.
- package/AGENTS.md +13 -0
- package/agents/notification-outbox.md +125 -2
- package/agents/profile-recipients.md +32 -0
- package/agents/scoped-attachment-test-matrix.md +46 -0
- package/dist/chunks/{AccountCollection-B7Nen_TO.js → AccountCollection-DBEG6nR7.js} +6 -7
- package/dist/chunks/AccountCollection-DBEG6nR7.js.map +1 -0
- package/dist/chunks/{Email-CnlwhWa0.js → Email-p5qIyMC5.js} +3 -3
- package/dist/chunks/{Email-CnlwhWa0.js.map → Email-p5qIyMC5.js.map} +1 -1
- package/dist/chunks/{EmailFolder-ukdMVI0c.js → EmailFolder-Dk4hxikK.js} +3 -3
- package/dist/chunks/EmailFolder-Dk4hxikK.js.map +1 -0
- package/dist/chunks/{Message-CinnTgyw.js → Message-hIwx07Kt.js} +72 -11
- package/dist/chunks/Message-hIwx07Kt.js.map +1 -0
- package/dist/chunks/{MessageCollection-BquAmxgU.js → MessageCollection-BwnE4a_L.js} +3 -3
- package/dist/chunks/MessageCollection-BwnE4a_L.js.map +1 -0
- package/dist/chunks/__smrt-register__-D3kBjvML.js +6 -0
- package/dist/chunks/__smrt-register__-D3kBjvML.js.map +1 -0
- package/dist/chunks/protected-notification-handoff-mvaEZVp7.js +358 -0
- package/dist/chunks/protected-notification-handoff-mvaEZVp7.js.map +1 -0
- package/dist/host.browser.d.ts +18 -0
- package/dist/host.browser.d.ts.map +1 -0
- package/dist/host.browser.js +27 -0
- package/dist/host.browser.js.map +1 -0
- package/dist/host.d.ts +19 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +35 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +589 -67
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +317 -14
- package/dist/migrations/profileRecipients.d.ts +17 -0
- package/dist/migrations/profileRecipients.d.ts.map +1 -0
- package/dist/models/Account.d.ts.map +1 -1
- package/dist/models/Message.d.ts +7 -0
- package/dist/models/Message.d.ts.map +1 -1
- package/dist/models/NotificationDelivery.d.ts +20 -3
- package/dist/models/NotificationDelivery.d.ts.map +1 -1
- package/dist/notification-recipient-identity.d.ts +17 -0
- package/dist/notification-recipient-identity.d.ts.map +1 -0
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/protected-notification-handoff.d.ts +31 -0
- package/dist/protected-notification-handoff.d.ts.map +1 -0
- package/dist/recipes.d.ts +1 -1
- package/dist/senders/EmailSender.d.ts.map +1 -1
- package/dist/services/NotificationOutboxService.d.ts +51 -3
- package/dist/services/NotificationOutboxService.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +184 -12
- package/dist/smrt-knowledge.okf.md +7 -2
- package/package.json +13 -9
- package/dist/chunks/AccountCollection-B7Nen_TO.js.map +0 -1
- package/dist/chunks/EmailFolder-ukdMVI0c.js.map +0 -1
- package/dist/chunks/Message-CinnTgyw.js.map +0 -1
- package/dist/chunks/MessageCollection-BquAmxgU.js.map +0 -1
- package/dist/chunks/__smrt-register__-Dz163WBB.js +0 -6
- package/dist/chunks/__smrt-register__-Dz163WBB.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Reserved profile policy identity: a clone retaining this kind cannot become a User send. */
|
|
2
|
+
export declare const PROFILE_NOTIFICATION_POLICY_PREFIX = "profile:";
|
|
3
|
+
/** Build the canonical profile-only policy ID used in the trusted dispatchPolicies map. */
|
|
4
|
+
export declare function profileNotificationPolicy(hostPolicyId: string): string;
|
|
5
|
+
export interface NotificationRecipientIdentity {
|
|
6
|
+
recipientKind: 'user' | 'profile';
|
|
7
|
+
recipientUserId: string | null;
|
|
8
|
+
recipientProfileId: string | null;
|
|
9
|
+
channel: string;
|
|
10
|
+
kind: string;
|
|
11
|
+
requiredDispatchPolicy: string;
|
|
12
|
+
}
|
|
13
|
+
/** Shared save/enqueue/lease/canonical-send guard, independent of model registration. */
|
|
14
|
+
export declare function assertNotificationRecipientIdentity(row: {
|
|
15
|
+
[K in keyof NotificationRecipientIdentity]: unknown;
|
|
16
|
+
}): void;
|
|
17
|
+
//# sourceMappingURL=notification-recipient-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-recipient-identity.d.ts","sourceRoot":"","sources":["../src/notification-recipient-identity.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,eAAO,MAAM,kCAAkC,aAAa,CAAC;AAC7D,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAYtE;AACD,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB,EAAE,MAAM,CAAC;CAChC;AACD,yFAAyF;AACzF,wBAAgB,mCAAmC,CACjD,GAAG,EAAE;KAAG,CAAC,IAAI,MAAM,6BAA6B,GAAG,OAAO;CAAE,GAC3D,IAAI,CAiCN"}
|
package/dist/permissions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PermissionDefinition } from '@happyvertical/smrt-users';
|
|
1
|
+
import { type PermissionDefinition } from '@happyvertical/smrt-users/permission-registry';
|
|
2
2
|
export declare const SEND_MESSAGES_PERMISSION = "messages.send";
|
|
3
3
|
export declare const MANAGE_MESSAGE_ROUTES_PERMISSION = "messages.manage-routes";
|
|
4
4
|
export declare const MANAGE_MESSAGE_CREDENTIALS_PERMISSION = "messages.manage-credentials";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+CAA+C,CAAC;AAEvD,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AACzE,eAAO,MAAM,qCAAqC,gCACnB,CAAC;AAEhC,eAAO,MAAM,gCAAgC,EAAE,oBAAoB,EAmBlE,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC7B,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,kBAAkB,CAMpB;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,kBAAkB,EAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,IAAI,CAON;AAID,wBAAgB,oCAAoC,IAAI,IAAI,CAI3D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Package-private durable protection and one-use provider authority. Never exported from the package root. */
|
|
2
|
+
import { type SmrtSaveOptions } from '@happyvertical/smrt-core';
|
|
3
|
+
import type { Message } from './models/Message.js';
|
|
4
|
+
import type { NotificationTransportRequest } from './services/NotificationOutboxService.js';
|
|
5
|
+
import type { SendEmailAttachment, SendEmailOptions, SendMessageOptions } from './types.js';
|
|
6
|
+
/** Definite local refusal: no provider handoff occurred. */
|
|
7
|
+
export declare class ProtectedNotificationHandoffError extends Error {
|
|
8
|
+
}
|
|
9
|
+
type Row = Record<string, unknown>;
|
|
10
|
+
/** Remember constructor identity before public fields can be changed. */
|
|
11
|
+
export declare function rememberNotificationOrigin(message: Message): void;
|
|
12
|
+
/** Non-authorizing durable marker; forging it can only require stricter checks. */
|
|
13
|
+
export declare function protectedNotificationMetadata(deliveryId: string, policyId: string): string;
|
|
14
|
+
/** Prevent ordinary saves/identity changes/clones from stripping durable protection. */
|
|
15
|
+
export declare function assertProtectedNotificationSave(message: Message, _options?: SmrtSaveOptions, lifecycleAuthorized?: boolean): Promise<void>;
|
|
16
|
+
/** Non-consuming retry admission; send itself claims the one-use token. */
|
|
17
|
+
export declare function assertProtectedNotificationRetry(message: Message, options?: SendMessageOptions): Promise<void>;
|
|
18
|
+
/** Claim exactly one canonical send invocation before any provider/account action. */
|
|
19
|
+
export declare function beginProtectedNotificationSend(message: Message, options?: SendMessageOptions): Promise<void>;
|
|
20
|
+
/** Consume once immediately before the sender invocation. */
|
|
21
|
+
export declare function assertProtectedSenderHandoff(message: Message, options?: SendMessageOptions): Promise<void>;
|
|
22
|
+
/** Deny unauthorized direct EmailSender calls before it reads stored attachment files. */
|
|
23
|
+
export declare function assertProtectedEmailAdmission(message: Message, options?: SendEmailOptions): Promise<void>;
|
|
24
|
+
/** Recheck after attachment I/O at the actual default EmailClient handoff; copied stored attachments cannot sneak in. */
|
|
25
|
+
export declare function assertProtectedEmailHandoff(message: Message, attachments: readonly SendEmailAttachment[], options?: SendEmailOptions, envelope?: Row): Promise<void>;
|
|
26
|
+
/** Only the outbox calls this after its trusted policy verified/copied bytes and recorded the current lease handoff. */
|
|
27
|
+
export declare function withProtectedNotificationHandoff<T>(request: NotificationTransportRequest, now: () => Date, callback: () => Promise<T>): Promise<T>;
|
|
28
|
+
/** Retain the durable protected message association through ordinary model/collection deletion. */
|
|
29
|
+
export declare function assertProtectedNotificationDelete(message: Message): Promise<void>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=protected-notification-handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protected-notification-handoff.d.ts","sourceRoot":"","sources":["../src/protected-notification-handoff.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,4DAA4D;AAC5D,qBAAa,iCAAkC,SAAQ,KAAK;CAAG;AAE/D,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAsDnC,yEAAyE;AACzE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAOjE;AACD,mFAAmF;AACnF,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AA8LD,wFAAwF;AACxF,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,eAAe,EAC1B,mBAAmB,UAAQ,GAC1B,OAAO,CAAC,IAAI,CAAC,CA4Cf;AAgKD,2EAA2E;AAC3E,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAEf;AACD,sFAAsF;AACtF,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAQf;AACD,6DAA6D;AAC7D,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAQf;AACD,0FAA0F;AAC1F,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAOf;AACD,yHAAyH;AACzH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,mBAAmB,EAAE,EAC3C,OAAO,CAAC,EAAE,gBAAgB,EAC1B,QAAQ,CAAC,EAAE,GAAG,GACb,OAAO,CAAC,IAAI,CAAC,CAgBf;AACD,wHAAwH;AACxH,wBAAsB,gCAAgC,CAAC,CAAC,EACtD,OAAO,EAAE,4BAA4B,EACrC,GAAG,EAAE,MAAM,IAAI,EACf,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CA4DZ;AAED,mGAAmG;AACnG,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
package/dist/recipes.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class MailboxRecipe extends SmrtRecipe {
|
|
|
21
21
|
icon: string;
|
|
22
22
|
description: string;
|
|
23
23
|
};
|
|
24
|
-
static models: (typeof
|
|
24
|
+
static models: (typeof EmailAccount | typeof Email)[];
|
|
25
25
|
static runtime: "both";
|
|
26
26
|
static surfaces: readonly [{
|
|
27
27
|
readonly kind: "route";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSender.d.ts","sourceRoot":"","sources":["../../src/senders/EmailSender.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmailSender.d.ts","sourceRoot":"","sources":["../../src/senders/EmailSender.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,aAAU,CAAC;AAElB,qBAAa,WAAY,YAAW,sBAAsB;IACxD,QAAQ,CAAC,YAAY,WAAW;IAChC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY;IAKtD,OAAO,IAAI,OAAO;IAIZ,IAAI,CACR,OAAO,EAAE,KAAK,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAyE7B;;;;;;;;OAQG;YACW,kBAAkB;CAqEjC;AAkBD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB/D"}
|
|
@@ -2,6 +2,7 @@ import { type SmrtClassOptions } from '@happyvertical/smrt-core';
|
|
|
2
2
|
import type { Message } from '../models/Message.js';
|
|
3
3
|
import type { NotificationDelivery, NotificationDeliveryChannel } from '../models/NotificationDelivery.js';
|
|
4
4
|
import { type MessagingPrincipal } from '../permissions.js';
|
|
5
|
+
import type { SendEmailAttachment } from '../types.js';
|
|
5
6
|
/** What a transport knows about one provider handoff. */
|
|
6
7
|
export type NotificationTransportOutcome = {
|
|
7
8
|
status: 'accepted';
|
|
@@ -24,6 +25,8 @@ export interface NotificationTransportRequest {
|
|
|
24
25
|
message: Message;
|
|
25
26
|
/** Stable per delivery; pass it to providers that dedupe on a key. */
|
|
26
27
|
idempotencyKey: string;
|
|
28
|
+
/** Host-authorized send-time bytes; never file paths or remote URLs. */
|
|
29
|
+
attachments?: SendEmailAttachment[];
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* Hands one outbound message to a provider. The default
|
|
@@ -66,6 +69,11 @@ export interface NotificationRecipientRequest {
|
|
|
66
69
|
recipientUserId: string;
|
|
67
70
|
channel: NotificationDeliveryChannel;
|
|
68
71
|
}
|
|
72
|
+
export interface NotificationProfileRecipientRequest {
|
|
73
|
+
tenantId: string;
|
|
74
|
+
recipientProfileId: string;
|
|
75
|
+
channel: 'email';
|
|
76
|
+
}
|
|
69
77
|
export interface NotificationRecipient {
|
|
70
78
|
address: string;
|
|
71
79
|
name?: string;
|
|
@@ -74,6 +82,10 @@ export interface NotificationSuppressionRequest extends NotificationRecipientReq
|
|
|
74
82
|
kind: string;
|
|
75
83
|
sourceRef: string;
|
|
76
84
|
}
|
|
85
|
+
export interface NotificationProfileSuppressionRequest extends NotificationProfileRecipientRequest {
|
|
86
|
+
kind: string;
|
|
87
|
+
sourceRef: string;
|
|
88
|
+
}
|
|
77
89
|
export interface NotificationOutboxOptions {
|
|
78
90
|
db: SmrtClassOptions['db'];
|
|
79
91
|
/**
|
|
@@ -83,6 +95,8 @@ export interface NotificationOutboxOptions {
|
|
|
83
95
|
* an address.
|
|
84
96
|
*/
|
|
85
97
|
resolveRecipient(request: NotificationRecipientRequest): Promise<NotificationRecipient | null> | NotificationRecipient | null;
|
|
98
|
+
/** Resource-aware authorization for a current tenant-owned external contact. No address input. */
|
|
99
|
+
resolveProfileRecipient?(request: NotificationProfileRecipientRequest): Promise<NotificationRecipient | null> | NotificationRecipient | null;
|
|
86
100
|
/** The sending `EmailAccount` id for a tenant (deployment setup). */
|
|
87
101
|
resolveSenderAccountId(request: {
|
|
88
102
|
tenantId: string;
|
|
@@ -91,10 +105,22 @@ export interface NotificationOutboxOptions {
|
|
|
91
105
|
linkBaseUrl: string;
|
|
92
106
|
/** Optional opt-out hook, checked at enqueue and again before handoff. */
|
|
93
107
|
isSuppressed?(request: NotificationSuppressionRequest): Promise<boolean> | boolean;
|
|
108
|
+
/** External contacts have their own opt-out policy; never infer a User preference or fabricate a User ID. */
|
|
109
|
+
isProfileSuppressed?(request: NotificationProfileSuppressionRequest): Promise<boolean> | boolean;
|
|
94
110
|
/** Provider seam; defaults to {@link messageSendTransport}. */
|
|
95
111
|
transport?: NotificationTransport;
|
|
96
112
|
/**
|
|
97
|
-
*
|
|
113
|
+
* Resolve and authorize current immutable document bytes before each fresh
|
|
114
|
+
* provider handoff. A failure is a pre-handoff rejection, never a silent
|
|
115
|
+
* attachment omission. Reconciliation does not need document access.
|
|
116
|
+
*/
|
|
117
|
+
resolveAttachments?(request: NotificationTransportRequest): Promise<SendEmailAttachment[]> | SendEmailAttachment[];
|
|
118
|
+
/** Trusted server map. Protected rows cannot be dispatched without their exact policy. */
|
|
119
|
+
dispatchPolicies?: Readonly<Record<string, {
|
|
120
|
+
resolveAttachments(request: NotificationTransportRequest): Promise<SendEmailAttachment[]> | SendEmailAttachment[];
|
|
121
|
+
}>>;
|
|
122
|
+
/**
|
|
123
|
+
* When set, enqueue, dispatch and reconcile require `messages.send` in the tenant.
|
|
98
124
|
* Omit only for trusted system code that performs its own authorization.
|
|
99
125
|
*/
|
|
100
126
|
principal?: MessagingPrincipal;
|
|
@@ -109,7 +135,10 @@ export interface NotificationOutboxOptions {
|
|
|
109
135
|
}
|
|
110
136
|
export interface NotificationEmailInput {
|
|
111
137
|
tenantId: string;
|
|
112
|
-
|
|
138
|
+
/** Exactly one recipient reference is required. Existing User calls remain unchanged. */
|
|
139
|
+
recipientUserId?: string;
|
|
140
|
+
/** External contact; requires email, a trusted protected policy and explicit schema maintenance. */
|
|
141
|
+
recipientProfileId?: string;
|
|
113
142
|
/** Idempotency key for the event, e.g. `project-question:<id>:asked`. */
|
|
114
143
|
sourceRef: string;
|
|
115
144
|
/** Host-defined type, e.g. `project-question.asked`. */
|
|
@@ -122,13 +151,17 @@ export interface NotificationEmailInput {
|
|
|
122
151
|
path: string;
|
|
123
152
|
/** Do not send before this time (default: now). */
|
|
124
153
|
notBefore?: Date;
|
|
154
|
+
/** Required trusted server policy; cannot be downgraded after enqueue. */
|
|
155
|
+
requiredDispatchPolicy?: string;
|
|
156
|
+
/** Host-approved immutable resource/version/digest and destination binding. */
|
|
157
|
+
dispatchPolicyBinding?: Record<string, unknown>;
|
|
125
158
|
}
|
|
126
159
|
export interface NotificationEnqueueResult {
|
|
127
160
|
delivery: NotificationDelivery;
|
|
128
161
|
/** False when `sourceRef` matched an existing delivery (returned untouched). */
|
|
129
162
|
created: boolean;
|
|
130
163
|
}
|
|
131
|
-
export type NotificationDispatchOutcome = 'sent' | 'retry-scheduled' | 'failed' | 'uncertain' | 'cancelled' | 'lease-lost';
|
|
164
|
+
export type NotificationDispatchOutcome = 'sent' | 'retry-scheduled' | 'failed' | 'uncertain' | 'cancelled' | 'blocked' | 'lease-lost';
|
|
132
165
|
export interface NotificationDispatchReport {
|
|
133
166
|
/** Rows this call won a lease on. */
|
|
134
167
|
leased: number;
|
|
@@ -141,6 +174,8 @@ export interface NotificationDispatchReport {
|
|
|
141
174
|
export interface NotificationDispatchOptions {
|
|
142
175
|
/** Tenants to dispatch; omit to discover due rows across all tenants. */
|
|
143
176
|
tenantIds?: readonly string[];
|
|
177
|
+
/** Exact delivery selection, applied before query limits and lease acquisition. Empty selects none. */
|
|
178
|
+
deliveryIds?: readonly string[];
|
|
144
179
|
/** Maximum rows to lease in this call (default 25, max 200). */
|
|
145
180
|
limit?: number;
|
|
146
181
|
}
|
|
@@ -173,6 +208,14 @@ export declare function buildNotificationLink(baseUrl: string, path: string): st
|
|
|
173
208
|
*/
|
|
174
209
|
export declare class NotificationOutboxService {
|
|
175
210
|
private readonly options;
|
|
211
|
+
/** Additive dispatch contracts hosts can require before activating a sender. */
|
|
212
|
+
static readonly capabilities: Readonly<{
|
|
213
|
+
readonly deliverySelection: true;
|
|
214
|
+
readonly attachments: true;
|
|
215
|
+
readonly requiredPolicy: true;
|
|
216
|
+
readonly protectedCanonicalSend: true;
|
|
217
|
+
readonly profileRecipients: true;
|
|
218
|
+
}>;
|
|
176
219
|
private readonly transport;
|
|
177
220
|
private readonly leaseMs;
|
|
178
221
|
private readonly maxAttempts;
|
|
@@ -205,6 +248,9 @@ export declare class NotificationOutboxService {
|
|
|
205
248
|
}): Promise<boolean>;
|
|
206
249
|
private requireSenderAccount;
|
|
207
250
|
private isSuppressed;
|
|
251
|
+
private resolveProfile;
|
|
252
|
+
private validateProfileDelivery;
|
|
253
|
+
private dispatchPolicy;
|
|
208
254
|
private findDue;
|
|
209
255
|
/** Lease one candidate and carry it to an outcome; null when not leased. */
|
|
210
256
|
private dispatchOne;
|
|
@@ -222,5 +268,7 @@ export declare class NotificationOutboxService {
|
|
|
222
268
|
* row (a unique violation) instead of creating a second email.
|
|
223
269
|
*/
|
|
224
270
|
private ensureMessage;
|
|
271
|
+
/** Backfill the non-authorizing durable marker on an existing protected canonical row. */
|
|
272
|
+
private protectCanonicalMessage;
|
|
225
273
|
}
|
|
226
274
|
//# sourceMappingURL=NotificationOutboxService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationOutboxService.d.ts","sourceRoot":"","sources":["../../src/services/NotificationOutboxService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationOutboxService.d.ts","sourceRoot":"","sources":["../../src/services/NotificationOutboxService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAalC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,aAAa,CAAC;AAMzE,yDAAyD;AACzD,MAAM,MAAM,4BAA4B,GACpC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,iBAAiB,CAAC,EAAE,M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