@happyvertical/smrt-messages 0.60.10 → 0.60.11
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 +10 -0
- package/README.md +34 -0
- package/agents/notification-outbox.md +48 -2
- package/dist/chunks/{AccountCollection-By48bdwt.js → AccountCollection-BGzfQG2I.js} +2 -2
- package/dist/chunks/{AccountCollection-By48bdwt.js.map → AccountCollection-BGzfQG2I.js.map} +1 -1
- package/dist/chunks/{Email-CMUK3aWU.js → Email-CBIrfFLm.js} +3 -3
- package/dist/chunks/{Email-CMUK3aWU.js.map → Email-CBIrfFLm.js.map} +1 -1
- package/dist/chunks/{EmailFolder-DLJvqNqI.js → EmailFolder-Cz2JU5Z1.js} +2 -2
- package/dist/chunks/{EmailFolder-DLJvqNqI.js.map → EmailFolder-Cz2JU5Z1.js.map} +1 -1
- package/dist/chunks/{Message-DXpqot5f.js → Message-DiO_FvAR.js} +4 -4
- package/dist/chunks/{Message-DXpqot5f.js.map → Message-DiO_FvAR.js.map} +1 -1
- package/dist/chunks/{MessageCollection-CMGaSGBc.js → MessageCollection-uui10uhg.js} +2 -2
- package/dist/chunks/{MessageCollection-CMGaSGBc.js.map → MessageCollection-uui10uhg.js.map} +1 -1
- package/dist/chunks/__smrt-register__-DyTpUDMS.js +6 -0
- package/dist/chunks/__smrt-register__-DyTpUDMS.js.map +1 -0
- package/dist/collections/NotificationOptOutCollection.d.ts +6 -0
- package/dist/collections/NotificationOptOutCollection.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -55
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +330 -1
- package/dist/models/NotificationOptOut.d.ts +44 -0
- package/dist/models/NotificationOptOut.d.ts.map +1 -0
- package/dist/services/NotificationOptOutService.d.ts +80 -0
- package/dist/services/NotificationOptOutService.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +104 -10
- package/dist/smrt-knowledge.okf.md +4 -2
- package/package.json +9 -9
- package/dist/chunks/__smrt-register__-CaGLtiEU.js +0 -6
- package/dist/chunks/__smrt-register__-CaGLtiEU.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
|
+
import { NotificationOptOut } from '../models/NotificationOptOut.js';
|
|
3
|
+
export declare class NotificationOptOutCollection extends SmrtCollection<NotificationOptOut> {
|
|
4
|
+
static readonly _itemClass: typeof NotificationOptOut;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=NotificationOptOutCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationOptOutCollection.d.ts","sourceRoot":"","sources":["../../src/collections/NotificationOptOutCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IAClF,MAAM,CAAC,QAAQ,CAAC,UAAU,4BAAsB;CACjD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { AttachmentCollection } from "./collections/AttachmentCollection.js";
|
|
|
11
11
|
export { MessageCollection } from "./collections/MessageCollection.js";
|
|
12
12
|
export { MessagingEndpointCollection } from './collections/MessagingEndpointCollection.js';
|
|
13
13
|
export { NotificationDeliveryCollection } from './collections/NotificationDeliveryCollection.js';
|
|
14
|
+
export { NotificationOptOutCollection } from './collections/NotificationOptOutCollection.js';
|
|
14
15
|
export { PersonaMessageRouteCollection } from './collections/PersonaMessageRouteCollection.js';
|
|
15
16
|
export { UserNotificationCollection } from './collections/UserNotificationCollection.js';
|
|
16
17
|
export { Account } from "./models/Account.js";
|
|
@@ -18,6 +19,7 @@ export { Attachment } from "./models/Attachment.js";
|
|
|
18
19
|
export { Message } from "./models/Message.js";
|
|
19
20
|
export { MessagingEndpoint } from './models/MessagingEndpoint.js';
|
|
20
21
|
export { NOTIFICATION_DELIVERY_CHANNELS, NotificationDelivery, type NotificationDeliveryChannel, type NotificationDeliveryOptions, type NotificationDeliveryStatus, type NotificationDeliveryTransition, } from './models/NotificationDelivery.js';
|
|
22
|
+
export { isValidNotificationOptOutScope, NOTIFICATION_OPT_OUT_ALL_SCOPE, NOTIFICATION_OPT_OUT_SCOPE_PATTERN, NotificationOptOut, type NotificationOptOutOptions, } from './models/NotificationOptOut.js';
|
|
21
23
|
export { PersonaMessageRoute } from './models/PersonaMessageRoute.js';
|
|
22
24
|
export { USER_NOTIFICATION_SEVERITIES, UserNotification, type UserNotificationOptions, type UserNotificationSeverity, } from './models/UserNotification.js';
|
|
23
25
|
export { EmailAccountCollection } from "./collections/EmailAccountCollection.js";
|
|
@@ -46,6 +48,7 @@ export { TelegramSender } from './senders/TelegramSender.js';
|
|
|
46
48
|
export { TweetSender } from "./senders/TweetSender.js";
|
|
47
49
|
export { ZulipSender } from './senders/ZulipSender.js';
|
|
48
50
|
export { type MessagingAccountInput, type MessagingAccountView, type MessagingEndpointInput, type MessagingEndpointView, MessagingSettingsService, type PersonaMessageRouteInput, } from './services/MessagingSettingsService.js';
|
|
51
|
+
export { type NotificationOptOutChange, type NotificationOptOutDenialReason, NotificationOptOutDeniedError, type NotificationOptOutKey, type NotificationOptOutListRequest, type NotificationOptOutPrincipal, NotificationOptOutService, optOutSuppression, } from './services/NotificationOptOutService.js';
|
|
49
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';
|
|
50
53
|
export { type PersonaMessageSendResult, PersonaMessagingService, } from './services/PersonaMessagingService.js';
|
|
51
54
|
export { type UserNotificationInput, type UserNotificationListOptions, type UserNotificationNotifyResult, type UserNotificationScope, UserNotificationService, } from './services/UserNotificationService.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAqB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,8BAA8B,EAC9B,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,GACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAA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,6BAA6B,EAC7B,KAAK,yBAAyB,EAC9B,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EACjC,iCAAiC,EACjC,6BAA6B,GAC9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,KAAK,wBAAwB,EAC7B,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAM/C,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EAEjB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EAErB,cAAc,EAEd,oBAAoB,EACpB,sBAAsB,EAEtB,iBAAiB,EAEjB,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EAEnB,WAAW,EACX,YAAY,EACZ,UAAU,EAEV,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAS,CAAC;AAKjB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import "./chunks/__smrt-register__-
|
|
2
|
+
import "./chunks/__smrt-register__-DyTpUDMS.js";
|
|
3
3
|
import { a as registerMessagingProvider, n as getMessagingProvider, o as ZulipSender, r as listMessagingProviders, s as TelegramSender, t as ensureBuiltinMessagingProvidersRegistered } from "./chunks/providers-4iLula-V.js";
|
|
4
|
-
import { r as Account, t as AccountCollection } from "./chunks/AccountCollection-
|
|
5
|
-
import { t as Message } from "./chunks/Message-
|
|
6
|
-
import { t as MessageCollection } from "./chunks/MessageCollection-
|
|
7
|
-
import { t as Email } from "./chunks/Email-
|
|
8
|
-
import { t as EmailFolder } from "./chunks/EmailFolder-
|
|
4
|
+
import { r as Account, t as AccountCollection } from "./chunks/AccountCollection-BGzfQG2I.js";
|
|
5
|
+
import { t as Message } from "./chunks/Message-DiO_FvAR.js";
|
|
6
|
+
import { t as MessageCollection } from "./chunks/MessageCollection-uui10uhg.js";
|
|
7
|
+
import { t as Email } from "./chunks/Email-CBIrfFLm.js";
|
|
8
|
+
import { t as EmailFolder } from "./chunks/EmailFolder-Cz2JU5Z1.js";
|
|
9
9
|
import { t as SlackSender } from "./chunks/SlackSender-CjSvwY1K.js";
|
|
10
10
|
import { t as TweetSender } from "./chunks/TweetSender-CcLPNNi1.js";
|
|
11
11
|
import { SmrtCollection, SmrtObject, SmrtRecipe, crossPackageRef, field, foreignKey, importOptionalDependency, isUniqueViolationError, smrt, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue } from "@happyvertical/smrt-core";
|
|
@@ -54,21 +54,21 @@ function ensureMessagingPermissionsRegistered() {
|
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/models/Attachment.ts
|
|
57
|
-
var __defProp$
|
|
58
|
-
var __getOwnPropDesc$
|
|
59
|
-
var __defNormalProp$
|
|
57
|
+
var __defProp$14 = Object.defineProperty;
|
|
58
|
+
var __getOwnPropDesc$14 = Object.getOwnPropertyDescriptor;
|
|
59
|
+
var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, {
|
|
60
60
|
enumerable: true,
|
|
61
61
|
configurable: true,
|
|
62
62
|
writable: true,
|
|
63
63
|
value
|
|
64
64
|
}) : obj[key] = value;
|
|
65
|
-
var __decorateClass$
|
|
66
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
65
|
+
var __decorateClass$14 = (decorators, target, key, kind) => {
|
|
66
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$14(target, key) : target;
|
|
67
67
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
68
|
-
if (kind && result) __defProp$
|
|
68
|
+
if (kind && result) __defProp$14(target, key, result);
|
|
69
69
|
return result;
|
|
70
70
|
};
|
|
71
|
-
var __publicField$
|
|
71
|
+
var __publicField$14 = (obj, key, value) => __defNormalProp$14(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
72
72
|
function splitAbsolutePath(filePath) {
|
|
73
73
|
const windows = /^[A-Za-z]:[\\/]/.test(filePath);
|
|
74
74
|
if (!windows && !filePath.startsWith("/")) return null;
|
|
@@ -107,7 +107,7 @@ var Attachment = class extends SmrtObject {
|
|
|
107
107
|
*/
|
|
108
108
|
async getMessage() {
|
|
109
109
|
if (!this.messageId) return null;
|
|
110
|
-
const { MessageCollection } = await import("./chunks/MessageCollection-
|
|
110
|
+
const { MessageCollection } = await import("./chunks/MessageCollection-uui10uhg.js").then((n) => n.n);
|
|
111
111
|
return await (await MessageCollection.create(this.options)).get({ id: this.messageId });
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
@@ -187,10 +187,10 @@ var Attachment = class extends SmrtObject {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
__publicField$
|
|
191
|
-
__decorateClass$
|
|
192
|
-
__decorateClass$
|
|
193
|
-
Attachment = __decorateClass$
|
|
190
|
+
__publicField$14(Attachment, "__smrtPackage__", "@happyvertical/smrt-messages");
|
|
191
|
+
__decorateClass$14([tenantId({ nullable: true })], Attachment.prototype, "tenantId", 2);
|
|
192
|
+
__decorateClass$14([foreignKey("Message")], Attachment.prototype, "messageId", 2);
|
|
193
|
+
Attachment = __decorateClass$14([TenantScoped({ mode: "optional" }), smrt({
|
|
194
194
|
api: { include: [
|
|
195
195
|
"list",
|
|
196
196
|
"get",
|
|
@@ -317,21 +317,21 @@ var AttachmentCollection = class extends SmrtCollection {
|
|
|
317
317
|
};
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/models/MessagingEndpoint.ts
|
|
320
|
-
var __defProp$
|
|
321
|
-
var __getOwnPropDesc$
|
|
322
|
-
var __defNormalProp$
|
|
320
|
+
var __defProp$13 = Object.defineProperty;
|
|
321
|
+
var __getOwnPropDesc$13 = Object.getOwnPropertyDescriptor;
|
|
322
|
+
var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
|
|
323
323
|
enumerable: true,
|
|
324
324
|
configurable: true,
|
|
325
325
|
writable: true,
|
|
326
326
|
value
|
|
327
327
|
}) : obj[key] = value;
|
|
328
|
-
var __decorateClass$
|
|
329
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
328
|
+
var __decorateClass$13 = (decorators, target, key, kind) => {
|
|
329
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$13(target, key) : target;
|
|
330
330
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
331
|
-
if (kind && result) __defProp$
|
|
331
|
+
if (kind && result) __defProp$13(target, key, result);
|
|
332
332
|
return result;
|
|
333
333
|
};
|
|
334
|
-
var __publicField$
|
|
334
|
+
var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
335
335
|
var MessagingEndpoint = class extends SmrtObject {
|
|
336
336
|
tenantId = "";
|
|
337
337
|
profileId = null;
|
|
@@ -376,16 +376,16 @@ var MessagingEndpoint = class extends SmrtObject {
|
|
|
376
376
|
return value.length <= 4 ? "••••" : `\u2022\u2022\u2022\u2022${value.slice(-4)}`;
|
|
377
377
|
}
|
|
378
378
|
};
|
|
379
|
-
__publicField$
|
|
380
|
-
__decorateClass$
|
|
381
|
-
__decorateClass$
|
|
382
|
-
__decorateClass$
|
|
383
|
-
__decorateClass$
|
|
384
|
-
__decorateClass$
|
|
379
|
+
__publicField$13(MessagingEndpoint, "__smrtPackage__", "@happyvertical/smrt-messages");
|
|
380
|
+
__decorateClass$13([tenantId()], MessagingEndpoint.prototype, "tenantId", 2);
|
|
381
|
+
__decorateClass$13([crossPackageRef("@happyvertical/smrt-profiles:Profile", { nullable: true })], MessagingEndpoint.prototype, "profileId", 2);
|
|
382
|
+
__decorateClass$13([field({ required: true })], MessagingEndpoint.prototype, "label", 2);
|
|
383
|
+
__decorateClass$13([field({ required: true })], MessagingEndpoint.prototype, "channel", 2);
|
|
384
|
+
__decorateClass$13([field({
|
|
385
385
|
required: true,
|
|
386
386
|
sensitive: true
|
|
387
387
|
})], MessagingEndpoint.prototype, "address", 2);
|
|
388
|
-
MessagingEndpoint = __decorateClass$
|
|
388
|
+
MessagingEndpoint = __decorateClass$13([TenantScoped({ mode: "required" }), smrt({
|
|
389
389
|
tableName: "messaging_endpoints",
|
|
390
390
|
api: { include: ["list", "get"] },
|
|
391
391
|
mcp: { include: ["list", "get"] },
|
|
@@ -404,21 +404,21 @@ var MessagingEndpointCollection = class extends SmrtCollection {
|
|
|
404
404
|
};
|
|
405
405
|
//#endregion
|
|
406
406
|
//#region src/models/NotificationDelivery.ts
|
|
407
|
-
var __defProp$
|
|
408
|
-
var __getOwnPropDesc$
|
|
409
|
-
var __defNormalProp$
|
|
407
|
+
var __defProp$12 = Object.defineProperty;
|
|
408
|
+
var __getOwnPropDesc$12 = Object.getOwnPropertyDescriptor;
|
|
409
|
+
var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
|
|
410
410
|
enumerable: true,
|
|
411
411
|
configurable: true,
|
|
412
412
|
writable: true,
|
|
413
413
|
value
|
|
414
414
|
}) : obj[key] = value;
|
|
415
|
-
var __decorateClass$
|
|
416
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
415
|
+
var __decorateClass$12 = (decorators, target, key, kind) => {
|
|
416
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$12(target, key) : target;
|
|
417
417
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
418
|
-
if (kind && result) __defProp$
|
|
418
|
+
if (kind && result) __defProp$12(target, key, result);
|
|
419
419
|
return result;
|
|
420
420
|
};
|
|
421
|
-
var __publicField$
|
|
421
|
+
var __publicField$12 = (obj, key, value) => __defNormalProp$12(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
422
422
|
var NOTIFICATION_DELIVERY_CHANNELS = ["email"];
|
|
423
423
|
var TRANSITION_COLUMNS = {
|
|
424
424
|
messageId: "message_id",
|
|
@@ -556,19 +556,19 @@ var NotificationDelivery = class extends SmrtObject {
|
|
|
556
556
|
return true;
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
|
-
__publicField$
|
|
560
|
-
__decorateClass$
|
|
561
|
-
__decorateClass$
|
|
562
|
-
__decorateClass$
|
|
563
|
-
__decorateClass$
|
|
564
|
-
__decorateClass$
|
|
565
|
-
__decorateClass$
|
|
566
|
-
__decorateClass$
|
|
567
|
-
__decorateClass$
|
|
568
|
-
__decorateClass$
|
|
569
|
-
__decorateClass$
|
|
570
|
-
__decorateClass$
|
|
571
|
-
NotificationDelivery = __decorateClass$
|
|
559
|
+
__publicField$12(NotificationDelivery, "__smrtPackage__", "@happyvertical/smrt-messages");
|
|
560
|
+
__decorateClass$12([tenantId()], NotificationDelivery.prototype, "tenantId", 2);
|
|
561
|
+
__decorateClass$12([crossPackageRef("@happyvertical/smrt-users:User", { required: true })], NotificationDelivery.prototype, "recipientUserId", 2);
|
|
562
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "channel", 2);
|
|
563
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "sourceRef", 2);
|
|
564
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "kind", 2);
|
|
565
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "subject", 2);
|
|
566
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "textBody", 2);
|
|
567
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "href", 2);
|
|
568
|
+
__decorateClass$12([field({ required: true })], NotificationDelivery.prototype, "recipientAddress", 2);
|
|
569
|
+
__decorateClass$12([foreignKey("Account")], NotificationDelivery.prototype, "accountId", 2);
|
|
570
|
+
__decorateClass$12([foreignKey("Message")], NotificationDelivery.prototype, "messageId", 2);
|
|
571
|
+
NotificationDelivery = __decorateClass$12([TenantScoped({ mode: "required" }), smrt({
|
|
572
572
|
tableName: "notification_deliveries",
|
|
573
573
|
api: false,
|
|
574
574
|
mcp: false,
|
|
@@ -593,6 +593,72 @@ var NotificationDeliveryCollection = class extends SmrtCollection {
|
|
|
593
593
|
static _itemClass = NotificationDelivery;
|
|
594
594
|
};
|
|
595
595
|
//#endregion
|
|
596
|
+
//#region src/models/NotificationOptOut.ts
|
|
597
|
+
var __defProp$11 = Object.defineProperty;
|
|
598
|
+
var __getOwnPropDesc$11 = Object.getOwnPropertyDescriptor;
|
|
599
|
+
var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
|
|
600
|
+
enumerable: true,
|
|
601
|
+
configurable: true,
|
|
602
|
+
writable: true,
|
|
603
|
+
value
|
|
604
|
+
}) : obj[key] = value;
|
|
605
|
+
var __decorateClass$11 = (decorators, target, key, kind) => {
|
|
606
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$11(target, key) : target;
|
|
607
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
608
|
+
if (kind && result) __defProp$11(target, key, result);
|
|
609
|
+
return result;
|
|
610
|
+
};
|
|
611
|
+
var __publicField$11 = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
612
|
+
var NOTIFICATION_OPT_OUT_SCOPE_PATTERN = /^(?:\*|[a-z][a-z0-9-]*:[A-Za-z0-9._:-]{1,200})$/;
|
|
613
|
+
var NOTIFICATION_OPT_OUT_ALL_SCOPE = "*";
|
|
614
|
+
function isValidNotificationOptOutScope(scope) {
|
|
615
|
+
return typeof scope === "string" && NOTIFICATION_OPT_OUT_SCOPE_PATTERN.test(scope);
|
|
616
|
+
}
|
|
617
|
+
var NotificationOptOut = class extends SmrtObject {
|
|
618
|
+
tenantId = "";
|
|
619
|
+
recipientUserId = "";
|
|
620
|
+
channel = "email";
|
|
621
|
+
scope = "";
|
|
622
|
+
/** When the opt-out took effect; null once the person opted back in. */
|
|
623
|
+
optedOutAt = null;
|
|
624
|
+
/** Who last changed the row: the person's user id, or `system` for host code. */
|
|
625
|
+
updatedBy = "";
|
|
626
|
+
constructor(options = {}) {
|
|
627
|
+
super(options);
|
|
628
|
+
if (options.tenantId !== void 0) this.tenantId = options.tenantId;
|
|
629
|
+
if (options.recipientUserId !== void 0) this.recipientUserId = options.recipientUserId;
|
|
630
|
+
if (options.channel !== void 0) this.channel = options.channel;
|
|
631
|
+
if (options.scope !== void 0) this.scope = options.scope;
|
|
632
|
+
if (options.optedOutAt !== void 0) this.optedOutAt = options.optedOutAt;
|
|
633
|
+
if (options.updatedBy !== void 0) this.updatedBy = options.updatedBy;
|
|
634
|
+
}
|
|
635
|
+
get isOptedOut() {
|
|
636
|
+
return this.optedOutAt !== null;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
__publicField$11(NotificationOptOut, "__smrtPackage__", "@happyvertical/smrt-messages");
|
|
640
|
+
__decorateClass$11([tenantId()], NotificationOptOut.prototype, "tenantId", 2);
|
|
641
|
+
__decorateClass$11([crossPackageRef("@happyvertical/smrt-users:User", { required: true })], NotificationOptOut.prototype, "recipientUserId", 2);
|
|
642
|
+
__decorateClass$11([field({ required: true })], NotificationOptOut.prototype, "channel", 2);
|
|
643
|
+
__decorateClass$11([field({ required: true })], NotificationOptOut.prototype, "scope", 2);
|
|
644
|
+
NotificationOptOut = __decorateClass$11([TenantScoped({ mode: "required" }), smrt({
|
|
645
|
+
tableName: "notification_opt_outs",
|
|
646
|
+
api: false,
|
|
647
|
+
mcp: false,
|
|
648
|
+
cli: false,
|
|
649
|
+
conflictColumns: [
|
|
650
|
+
"tenant_id",
|
|
651
|
+
"recipient_user_id",
|
|
652
|
+
"channel",
|
|
653
|
+
"scope"
|
|
654
|
+
]
|
|
655
|
+
})], NotificationOptOut);
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/collections/NotificationOptOutCollection.ts
|
|
658
|
+
var NotificationOptOutCollection = class extends SmrtCollection {
|
|
659
|
+
static _itemClass = NotificationOptOut;
|
|
660
|
+
};
|
|
661
|
+
//#endregion
|
|
596
662
|
//#region src/models/PersonaMessageRoute.ts
|
|
597
663
|
var __defProp$10 = Object.defineProperty;
|
|
598
664
|
var __getOwnPropDesc$10 = Object.getOwnPropertyDescriptor;
|
|
@@ -878,7 +944,7 @@ var EmailAccount = class extends Account {
|
|
|
878
944
|
for (const folderName of foldersToSync) try {
|
|
879
945
|
let folder = await folderCollection.getByPath(accountId, folderName);
|
|
880
946
|
if (!folder) {
|
|
881
|
-
const { EmailFolder } = await import("./chunks/EmailFolder-
|
|
947
|
+
const { EmailFolder } = await import("./chunks/EmailFolder-Cz2JU5Z1.js").then((n) => n.n);
|
|
882
948
|
folder = new EmailFolder({
|
|
883
949
|
...this.childOptions(),
|
|
884
950
|
accountId,
|
|
@@ -903,7 +969,7 @@ var EmailAccount = class extends Account {
|
|
|
903
969
|
result.messagesSkipped++;
|
|
904
970
|
continue;
|
|
905
971
|
}
|
|
906
|
-
const { Email } = await import("./chunks/Email-
|
|
972
|
+
const { Email } = await import("./chunks/Email-CBIrfFLm.js").then((n) => n.n);
|
|
907
973
|
let email = existingEmail;
|
|
908
974
|
if (!email) {
|
|
909
975
|
email = new Email({
|
|
@@ -2450,6 +2516,149 @@ var MessagingSettingsService = class {
|
|
|
2450
2516
|
}
|
|
2451
2517
|
};
|
|
2452
2518
|
//#endregion
|
|
2519
|
+
//#region src/services/NotificationOptOutService.ts
|
|
2520
|
+
var NotificationOptOutDeniedError = class extends Error {
|
|
2521
|
+
constructor(reason, message) {
|
|
2522
|
+
super(message);
|
|
2523
|
+
this.reason = reason;
|
|
2524
|
+
this.name = "NotificationOptOutDeniedError";
|
|
2525
|
+
}
|
|
2526
|
+
reason;
|
|
2527
|
+
};
|
|
2528
|
+
function requireText$2(value, name) {
|
|
2529
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
2530
|
+
if (!text) throw new Error(`A notification opt-out ${name} is required.`);
|
|
2531
|
+
return text;
|
|
2532
|
+
}
|
|
2533
|
+
function validate(key) {
|
|
2534
|
+
const channel = key.channel;
|
|
2535
|
+
if (!NOTIFICATION_DELIVERY_CHANNELS.includes(channel)) throw new Error(`Unknown notification channel '${String(channel)}'.`);
|
|
2536
|
+
if (!isValidNotificationOptOutScope(key.scope)) throw new Error(`Invalid notification opt-out scope '${String(key.scope)}': use '*' or a key like 'project:<id>'.`);
|
|
2537
|
+
return {
|
|
2538
|
+
tenantId: requireText$2(key.tenantId, "tenant"),
|
|
2539
|
+
recipientUserId: requireText$2(key.recipientUserId, "recipient"),
|
|
2540
|
+
channel,
|
|
2541
|
+
scope: key.scope
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
function authorize(principal, tenantId, recipientUserId) {
|
|
2545
|
+
if (!principal) return "system";
|
|
2546
|
+
if (!principal.tenantId || principal.tenantId !== tenantId) throw new NotificationOptOutDeniedError("tenant", "Principal does not belong to this tenant.");
|
|
2547
|
+
if (!principal.userId || principal.userId !== recipientUserId) throw new NotificationOptOutDeniedError("principal", "Only the recipient may change or list their notification opt-outs.");
|
|
2548
|
+
return principal.userId;
|
|
2549
|
+
}
|
|
2550
|
+
var NotificationOptOutService = class {
|
|
2551
|
+
constructor(options) {
|
|
2552
|
+
this.options = options;
|
|
2553
|
+
}
|
|
2554
|
+
options;
|
|
2555
|
+
collection() {
|
|
2556
|
+
return NotificationOptOutCollection.create({ db: this.options.db });
|
|
2557
|
+
}
|
|
2558
|
+
/** Opt the recipient out of `scope`; a repeat leaves the row untouched. */
|
|
2559
|
+
async optOut(change) {
|
|
2560
|
+
return this.change(change, true);
|
|
2561
|
+
}
|
|
2562
|
+
/** Clear an opt-out; a repeat, or no row at all, is a no-op. */
|
|
2563
|
+
async optIn(change) {
|
|
2564
|
+
return this.change(change, false);
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Whether the recipient has opted out of `scope` (a `*` row matches every
|
|
2568
|
+
* scope). Trusted read: no principal, always under the tenant's scope.
|
|
2569
|
+
*/
|
|
2570
|
+
async isOptedOut(key) {
|
|
2571
|
+
const { tenantId, recipientUserId, channel, scope } = validate(key);
|
|
2572
|
+
const scopes = scope === "*" ? [scope] : [scope, "*"];
|
|
2573
|
+
return withTenant({ tenantId }, async () => {
|
|
2574
|
+
return (await (await this.collection()).list({ where: {
|
|
2575
|
+
tenantId,
|
|
2576
|
+
recipientUserId,
|
|
2577
|
+
channel,
|
|
2578
|
+
"scope in": scopes
|
|
2579
|
+
} })).some((row) => row.optedOutAt !== null);
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
/** The recipient's own active opt-outs, in one tenant. */
|
|
2583
|
+
async listForRecipient(request) {
|
|
2584
|
+
const tenantId = requireText$2(request.tenantId, "tenant");
|
|
2585
|
+
const recipientUserId = requireText$2(request.recipientUserId, "recipient");
|
|
2586
|
+
if (!request.principal) throw new NotificationOptOutDeniedError("principal", "A principal is required to list opt-outs.");
|
|
2587
|
+
authorize(request.principal, tenantId, recipientUserId);
|
|
2588
|
+
return withTenant({ tenantId }, async () => {
|
|
2589
|
+
return (await (await this.collection()).list({
|
|
2590
|
+
where: {
|
|
2591
|
+
tenantId,
|
|
2592
|
+
recipientUserId
|
|
2593
|
+
},
|
|
2594
|
+
orderBy: "scope ASC"
|
|
2595
|
+
})).filter((row) => row.optedOutAt !== null);
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
async change(change, optedOut) {
|
|
2599
|
+
const key = validate(change);
|
|
2600
|
+
const updatedBy = authorize(change.principal, key.tenantId, key.recipientUserId);
|
|
2601
|
+
const { tenantId, recipientUserId, channel, scope } = key;
|
|
2602
|
+
return withTenant({ tenantId }, async () => {
|
|
2603
|
+
const rows = await this.collection();
|
|
2604
|
+
const find = async () => (await rows.list({
|
|
2605
|
+
where: {
|
|
2606
|
+
tenantId,
|
|
2607
|
+
recipientUserId,
|
|
2608
|
+
channel,
|
|
2609
|
+
scope
|
|
2610
|
+
},
|
|
2611
|
+
limit: 1
|
|
2612
|
+
}))[0];
|
|
2613
|
+
const apply = async (row) => {
|
|
2614
|
+
if (row.isOptedOut === optedOut) return row;
|
|
2615
|
+
row.optedOutAt = optedOut ? /* @__PURE__ */ new Date() : null;
|
|
2616
|
+
row.updatedBy = updatedBy;
|
|
2617
|
+
await row.save();
|
|
2618
|
+
return row;
|
|
2619
|
+
};
|
|
2620
|
+
const existing = await find();
|
|
2621
|
+
if (existing) return apply(existing);
|
|
2622
|
+
if (!optedOut) return new NotificationOptOut({
|
|
2623
|
+
tenantId,
|
|
2624
|
+
recipientUserId,
|
|
2625
|
+
channel,
|
|
2626
|
+
scope,
|
|
2627
|
+
optedOutAt: null,
|
|
2628
|
+
updatedBy
|
|
2629
|
+
});
|
|
2630
|
+
try {
|
|
2631
|
+
return await rows.create({
|
|
2632
|
+
_insertOnly: true,
|
|
2633
|
+
tenantId,
|
|
2634
|
+
recipientUserId,
|
|
2635
|
+
channel,
|
|
2636
|
+
scope,
|
|
2637
|
+
optedOutAt: /* @__PURE__ */ new Date(),
|
|
2638
|
+
updatedBy
|
|
2639
|
+
});
|
|
2640
|
+
} catch (error) {
|
|
2641
|
+
if (!isUniqueViolationError(error)) throw error;
|
|
2642
|
+
const winner = await find();
|
|
2643
|
+
if (!winner) throw error;
|
|
2644
|
+
return apply(winner);
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
function optOutSuppression(service, scopeOf) {
|
|
2650
|
+
return async (request) => {
|
|
2651
|
+
const scope = await scopeOf(request);
|
|
2652
|
+
if (scope === null || scope === void 0) return false;
|
|
2653
|
+
return service.isOptedOut({
|
|
2654
|
+
tenantId: request.tenantId,
|
|
2655
|
+
recipientUserId: request.recipientUserId,
|
|
2656
|
+
channel: request.channel,
|
|
2657
|
+
scope
|
|
2658
|
+
});
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
//#endregion
|
|
2453
2662
|
//#region src/services/NotificationOutboxService.ts
|
|
2454
2663
|
var messageSendTransport = {
|
|
2455
2664
|
name: "message-send",
|
|
@@ -3501,6 +3710,6 @@ var SlackRecipe = class extends SmrtRecipe {
|
|
|
3501
3710
|
ensureBuiltinMessagingProvidersRegistered();
|
|
3502
3711
|
ensureMessagingPermissionsRegistered();
|
|
3503
3712
|
//#endregion
|
|
3504
|
-
export { Account, AccountCollection, Attachment, AttachmentCollection, Blacklist, BlacklistCollection, Email, EmailAccount, EmailAccountCollection, EmailAttachment, EmailAttachmentCollection, EmailCollection, EmailFolder, EmailFolderCollection, EmailSender, MANAGE_MESSAGE_CREDENTIALS_PERMISSION, MANAGE_MESSAGE_ROUTES_PERMISSION, MESSAGING_PERMISSION_DEFINITIONS, MailboxRecipe, Message, MessageCollection, MessagingEndpoint, MessagingEndpointCollection, MessagingSettingsService, NOTIFICATION_DELIVERY_CHANNELS, NotificationDelivery, NotificationDeliveryCollection, NotificationOutboxDeniedError, NotificationOutboxService, NotificationsRecipe, PersonaMessageRoute, PersonaMessageRouteCollection, PersonaMessagingService, SEND_MESSAGES_PERMISSION, SlackAccount, SlackMessage, SlackRecipe, SlackSender, TelegramAccount, TelegramSender, Tweet, TweetSender, TwitterAccount, USER_NOTIFICATION_SEVERITIES, UserNotification, UserNotificationCollection, UserNotificationService, Whitelist, WhitelistCollection, ZulipAccount, ZulipSender, AttachmentCollection_exports as a, assertMessagingPermission, buildNotificationLink, ensureBuiltinMessagingProvidersRegistered, ensureMessagingPermissionsRegistered, getMessagingProvider, MessagingEndpointCollection_exports as i, listMessagingProviders, messageSendTransport, messagingPrincipalFromPermissions, EmailCollection_exports as n, notificationDeliveryCorrelationId, notificationDeliveryMessageId, EmailAccountCollection_exports as r, registerMessagingProvider, EmailFolderCollection_exports as t };
|
|
3713
|
+
export { Account, AccountCollection, Attachment, AttachmentCollection, Blacklist, BlacklistCollection, Email, EmailAccount, EmailAccountCollection, EmailAttachment, EmailAttachmentCollection, EmailCollection, EmailFolder, EmailFolderCollection, EmailSender, MANAGE_MESSAGE_CREDENTIALS_PERMISSION, MANAGE_MESSAGE_ROUTES_PERMISSION, MESSAGING_PERMISSION_DEFINITIONS, MailboxRecipe, Message, MessageCollection, MessagingEndpoint, MessagingEndpointCollection, MessagingSettingsService, NOTIFICATION_DELIVERY_CHANNELS, NOTIFICATION_OPT_OUT_ALL_SCOPE, NOTIFICATION_OPT_OUT_SCOPE_PATTERN, NotificationDelivery, NotificationDeliveryCollection, NotificationOptOut, NotificationOptOutCollection, NotificationOptOutDeniedError, NotificationOptOutService, NotificationOutboxDeniedError, NotificationOutboxService, NotificationsRecipe, PersonaMessageRoute, PersonaMessageRouteCollection, PersonaMessagingService, SEND_MESSAGES_PERMISSION, SlackAccount, SlackMessage, SlackRecipe, SlackSender, TelegramAccount, TelegramSender, Tweet, TweetSender, TwitterAccount, USER_NOTIFICATION_SEVERITIES, UserNotification, UserNotificationCollection, UserNotificationService, Whitelist, WhitelistCollection, ZulipAccount, ZulipSender, AttachmentCollection_exports as a, assertMessagingPermission, buildNotificationLink, ensureBuiltinMessagingProvidersRegistered, ensureMessagingPermissionsRegistered, getMessagingProvider, MessagingEndpointCollection_exports as i, isValidNotificationOptOutScope, listMessagingProviders, messageSendTransport, messagingPrincipalFromPermissions, EmailCollection_exports as n, notificationDeliveryCorrelationId, notificationDeliveryMessageId, optOutSuppression, EmailAccountCollection_exports as r, registerMessagingProvider, EmailFolderCollection_exports as t };
|
|
3505
3714
|
|
|
3506
3715
|
//# sourceMappingURL=index.js.map
|