@antelopejs/interface-dms 0.14.7-next.1000.g005d1ab → 0.14.7-next.1003.gd845bb6
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/dist/base/data-types/field-types.d.ts +7 -0
- package/dist/base/data-types/field-types.js +1 -0
- package/dist/base/data-types/field-types.js.map +1 -1
- package/dist/base/form-schema.d.ts +3 -1
- package/dist/base/form-schema.js.map +1 -1
- package/dist/component-options/form-field.d.ts +5 -2
- package/dist/notifications/index.d.ts +8 -1
- package/dist/notifications/index.js +12 -0
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/internal.d.ts +5 -1
- package/dist/notifications/internal.js +4 -0
- package/dist/notifications/internal.js.map +1 -1
- package/dist/notifications/sendable.js +10 -4
- package/dist/notifications/sendable.js.map +1 -1
- package/dist/notifications/types.d.ts +32 -6
- package/docs/3.base/2.types.md +1 -1
- package/docs/4.notifications/1.introduction.md +1 -0
- package/docs/4.notifications/2.categories-and-subjects.md +4 -3
- package/docs/4.notifications/3.sending.md +3 -2
- package/docs/4.notifications/4.email.md +79 -0
- package/docs/index.md +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { FormComponents } from "../form-schema";
|
|
3
|
+
import type { DefaultValue } from "../types";
|
|
3
4
|
import { DataType } from "./core";
|
|
4
5
|
/** A field of the rows an `ArrayType` holds, with a column header. */
|
|
5
6
|
export interface ArrayItemField {
|
|
@@ -8,6 +9,12 @@ export interface ArrayItemField {
|
|
|
8
9
|
label?: string;
|
|
9
10
|
/** A row is refused without it. */
|
|
10
11
|
required?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The value of this field in a row the user adds, and in the rows the
|
|
14
|
+
* form opens with to reach `min`. A row is checked once edited or on
|
|
15
|
+
* submit, not the moment it appears.
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: DefaultValue;
|
|
11
18
|
}
|
|
12
19
|
/** A field of an `ArrayType`'s rows: its type alone, or with a header. */
|
|
13
20
|
export type ArrayItemFieldInput = DataType | ArrayItemField;
|
|
@@ -59,6 +59,7 @@ let ArrayType = class ArrayType extends core_1.DataType {
|
|
|
59
59
|
type: (0, core_1.getDataTypeId)(field.type),
|
|
60
60
|
component: field.type.inputComponent(),
|
|
61
61
|
required: field.required,
|
|
62
|
+
defaultValue: field.defaultValue,
|
|
62
63
|
})),
|
|
63
64
|
sortable: this.options.sortable,
|
|
64
65
|
min: this.options.min,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-types.js","sourceRoot":"","sources":["../../../src/base/data-types/field-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAwB;AACxB,gDAA4E;AAC5E,mDAA0D;
|
|
1
|
+
{"version":3,"file":"field-types.js","sourceRoot":"","sources":["../../../src/base/data-types/field-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAwB;AACxB,gDAA4E;AAC5E,mDAA0D;AAE1D,iCAAmE;AAoEnE,yCAAyC;AAC5B,QAAA,cAAc,GAAG;IAC5B,MAAM;IACN,KAAK;IACL,MAAM;IACN,YAAY;IACZ,MAAM;CACE,CAAC;AA0BX,yCAAyC;AAC5B,QAAA,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AAgB3D,MAAM,sBAAsB,GAAG;IAC7B,uCAAuB,CAAC,OAAO;IAC/B,uCAAuB,CAAC,UAAU;CACnC,CAAC;AAEF,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,SAAS,SAAS,CAAC,KAA0B;IAC3C,OAAO,KAAK,YAAY,eAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,eAAQ;IACT,OAAO;IAAnC,YAA4B,OAAyB;QACn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
|
|
|
5
5
|
import "zod-to-json-schema";
|
|
6
6
|
import type { DefaultDataTypes } from "./data-types/default-types";
|
|
7
7
|
import type * as RelationPickers from "./form-relation-options";
|
|
8
|
-
import type { AxeOrientation, EnumOption } from "./types";
|
|
8
|
+
import type { AxeOrientation, DefaultValue, EnumOption } from "./types";
|
|
9
9
|
import "./internal/form-block-schema";
|
|
10
10
|
import { FormBuilder, FormField, FormFieldOrGroup, FormFieldOrGroupSerialized, FormFunctions, FormProps, type SetFieldValueParams } from "./form-types";
|
|
11
11
|
export * from "./form-block-schema";
|
|
@@ -92,6 +92,8 @@ export declare namespace FormComponents {
|
|
|
92
92
|
type?: string;
|
|
93
93
|
component: ComponentInfoSerialized;
|
|
94
94
|
required?: boolean;
|
|
95
|
+
/** The cell's value in a row the user adds or `min` creates. */
|
|
96
|
+
defaultValue?: DefaultValue;
|
|
95
97
|
}
|
|
96
98
|
interface RepeaterOptions {
|
|
97
99
|
columns: RepeaterColumn[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-schema.js","sourceRoot":"","sources":["../../src/base/form-schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,wBAAsB;AACtB,sBAAoB;AACpB,6BAAwB;AACxB,8BAA4B;AAC5B,4CAAkD;AAIlD,wCAAsC;AAUtC,8EAI2C;AAC3C,8EAK2C;AAE3C,sDAAoC;AAapC;;GAEG;AACH,oCACE,UAAwB,EACxB,OAA+B;IAE/B,IAAI,MAAM,GAAG,UAAU,CAAC;IAExB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;QACtC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3B,MAAM,GAAG,IAAA,2CAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED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,SAAgB,UAAU,CACxB,OAAyB;QAEzB,OAAO,IAAA,sCAAa,EAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAJe,eAAA,UAAU,aAIzB,CAAA;IAED,SAAgB,eAAe,CAC7B,OAAgC;QAEhC,OAAO,IAAA,sCAAa,EAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAJe,eAAA,eAAe,kBAI9B,CAAA;IAED,SAAgB,YAAY,CAC1B,OAAW;QAEX,OAAO,IAAA,sCAAa,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAJe,eAAA,YAAY,eAI3B,CAAA;IAED,SAAgB,QAAQ,CACtB,OAAyB;QAEzB,OAAO,IAAA,sCAAa,EAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAJe,eAAA,QAAQ,WAIvB,CAAA;IAED,SAAgB,IAAI,CAClB,OAAqB;QAErB,OAAO,IAAA,sCAAa,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAJe,eAAA,IAAI,OAInB,CAAA;IAED,SAAgB,KAAK,CACnB,OAAsB;QAEtB,OAAO,IAAA,sCAAa,EAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAJe,eAAA,KAAK,QAIpB,CAAA;AACH,CAAC,EAtegB,cAAc,aAAd,cAAc,GAAd,cAAc,QAse9B"}
|
|
@@ -2,9 +2,12 @@ import type { ComponentInfoSerialized } from "../component";
|
|
|
2
2
|
import type { Tone } from "../tones";
|
|
3
3
|
import type { DataType } from "./data-type";
|
|
4
4
|
/**
|
|
5
|
-
* Valid default values for form fields and columns
|
|
5
|
+
* Valid default values for form fields and columns. An object is a row of
|
|
6
|
+
* an `ArrayType` field, a value per key: a list field defaults to its rows.
|
|
6
7
|
*/
|
|
7
|
-
export type DefaultValue = string | number | boolean | Date | null | DefaultValue[]
|
|
8
|
+
export type DefaultValue = string | number | boolean | Date | null | DefaultValue[] | {
|
|
9
|
+
[key: string]: DefaultValue;
|
|
10
|
+
};
|
|
8
11
|
/** A pill shown beside a read-only field's value. */
|
|
9
12
|
export interface FormFieldBadge {
|
|
10
13
|
/** i18n key or literal. */
|
|
@@ -2,10 +2,17 @@ import { NotificationBuilder } from "./builder";
|
|
|
2
2
|
import { internal } from "./internal";
|
|
3
3
|
export { internal };
|
|
4
4
|
export * from "./types";
|
|
5
|
-
import type { NotificationCategoryInfo, NotificationSubjectInfo } from "./types";
|
|
5
|
+
import type { NotificationCategoryInfo, NotificationEmailChannelInfo, NotificationSubjectInfo } from "./types";
|
|
6
6
|
export declare function Notification(): NotificationBuilder;
|
|
7
7
|
export declare function NotificationCategory(id: string, category: Omit<NotificationCategoryInfo, "id">): NotificationCategoryInfo;
|
|
8
8
|
export declare function NotificationSubject(id: string, subject: Omit<NotificationSubjectInfo, "id">): NotificationSubjectInfo;
|
|
9
|
+
/**
|
|
10
|
+
* Registers the e-mail channel: every notification stored in a user's feed is
|
|
11
|
+
* also handed to `deliver` when its subject offers e-mail and the user has it
|
|
12
|
+
* on. One module registers it; a later registration replaces the earlier one.
|
|
13
|
+
* The registration goes away with the module that made it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function NotificationEmailChannel(channel: NotificationEmailChannelInfo): NotificationEmailChannelInfo;
|
|
9
16
|
export declare const SystemCategory: NotificationCategoryInfo;
|
|
10
17
|
export declare const GeneralSubject: NotificationSubjectInfo;
|
|
11
18
|
export declare const SecuritySubject: NotificationSubjectInfo;
|
|
@@ -18,6 +18,7 @@ exports.AutomationSubject = exports.CollaborationSubject = exports.AccountSubjec
|
|
|
18
18
|
exports.Notification = Notification;
|
|
19
19
|
exports.NotificationCategory = NotificationCategory;
|
|
20
20
|
exports.NotificationSubject = NotificationSubject;
|
|
21
|
+
exports.NotificationEmailChannel = NotificationEmailChannel;
|
|
21
22
|
const builder_1 = require("./builder");
|
|
22
23
|
const internal_1 = require("./internal");
|
|
23
24
|
Object.defineProperty(exports, "internal", { enumerable: true, get: function () { return internal_1.internal; } });
|
|
@@ -41,6 +42,17 @@ function NotificationSubject(id, subject) {
|
|
|
41
42
|
internal_1.internal.RegisterNotificationSubject.register(notificationSubject);
|
|
42
43
|
return notificationSubject;
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Registers the e-mail channel: every notification stored in a user's feed is
|
|
47
|
+
* also handed to `deliver` when its subject offers e-mail and the user has it
|
|
48
|
+
* on. One module registers it; a later registration replaces the earlier one.
|
|
49
|
+
* The registration goes away with the module that made it.
|
|
50
|
+
*/
|
|
51
|
+
function NotificationEmailChannel(channel) {
|
|
52
|
+
internal_1.internal.emailChannelIdentity.stamp(channel);
|
|
53
|
+
internal_1.internal.RegisterNotificationEmailChannel.register(channel);
|
|
54
|
+
return channel;
|
|
55
|
+
}
|
|
44
56
|
exports.SystemCategory = NotificationCategory("system", {
|
|
45
57
|
labelKey: "dms.notifications.categories.system",
|
|
46
58
|
descriptionKey: "dms.notifications.categories.system_desc",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAgD;AAChD,yCAAsC;yFAA7B,mBAAQ;AAGjB,0CAAwB;AAOxB;IACE,OAAO,IAAI,6BAAmB,EAAE,CAAC;AACnC,CAAC;AAED,8BACE,EAAU,EACV,QAA8C;IAE9C,MAAM,oBAAoB,GAA6B;QACrD,EAAE;QACF,GAAG,QAAQ;KACZ,CAAC;IACF,mBAAQ,CAAC,4BAA4B,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IACrE,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,6BACE,EAAU,EACV,OAA4C;IAE5C,MAAM,mBAAmB,GAA4B;QACnD,EAAE;QACF,GAAG,OA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AAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,mBAAmB,CAAC,YAAY,EAAE;IACjE,QAAQ,EAAE,QAAA,cAAc;IACxB,QAAQ,EAAE,uCAAuC;IACjD,cAAc,EAAE,4CAA4C;IAC5D,gBAAgB,EAAE,SAAS;CAC5B,CAAC,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { RegisteringProxy } from "@antelopejs/interface-core";
|
|
2
|
-
import type { DeliveryOptions, NotificationCategoryInfo, NotificationData, NotificationSubjectInfo, ReadScope, RoleSendOptions } from "./types";
|
|
2
|
+
import type { DeliveryOptions, NotificationCategoryInfo, NotificationEmailChannelInfo, NotificationData, NotificationSubjectInfo, ReadScope, RoleSendOptions } from "./types";
|
|
3
|
+
import { RegistrationIdentity } from "../page/internal/registry";
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
7
|
export declare namespace internal {
|
|
7
8
|
const RegisterNotificationCategory: RegisteringProxy<(info: NotificationCategoryInfo) => void>;
|
|
8
9
|
const RegisterNotificationSubject: RegisteringProxy<(info: NotificationSubjectInfo) => void>;
|
|
10
|
+
const RegisterNotificationEmailChannel: RegisteringProxy<(info: NotificationEmailChannelInfo) => void>;
|
|
11
|
+
/** Tells the registration a module unloads from the one that replaced it. */
|
|
12
|
+
const emailChannelIdentity: RegistrationIdentity<NotificationEmailChannelInfo>;
|
|
9
13
|
const SendToUser: (userId: string, data: NotificationData, groupId?: string | undefined, idempotencyKey?: string | undefined, delivery?: DeliveryOptions | undefined) => Promise<void>;
|
|
10
14
|
const SendToUsers: (userIds: string[], data: NotificationData, readScope?: ReadScope | undefined, idempotencyKey?: string | undefined, delivery?: DeliveryOptions | undefined) => Promise<void>;
|
|
11
15
|
const SendToRoles: (roleIds: string[], data: NotificationData, options?: RoleSendOptions | undefined) => Promise<void>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.internal = void 0;
|
|
4
4
|
const interface_core_1 = require("@antelopejs/interface-core");
|
|
5
|
+
const registry_1 = require("../page/internal/registry");
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -9,6 +10,9 @@ var internal;
|
|
|
9
10
|
(function (internal) {
|
|
10
11
|
internal.RegisterNotificationCategory = new interface_core_1.RegisteringProxy();
|
|
11
12
|
internal.RegisterNotificationSubject = new interface_core_1.RegisteringProxy();
|
|
13
|
+
internal.RegisterNotificationEmailChannel = new interface_core_1.RegisteringProxy();
|
|
14
|
+
/** Tells the registration a module unloads from the one that replaced it. */
|
|
15
|
+
internal.emailChannelIdentity = new registry_1.RegistrationIdentity("notification-email-channel");
|
|
12
16
|
internal.SendToUser = (0, interface_core_1.InterfaceFunction)();
|
|
13
17
|
internal.SendToUsers = (0, interface_core_1.InterfaceFunction)();
|
|
14
18
|
internal.SendToRoles = (0, interface_core_1.InterfaceFunction)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/notifications/internal.ts"],"names":[],"mappings":";;;AAAA,+DAGoC;AAUpC;;GAEG;AACH,IAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/notifications/internal.ts"],"names":[],"mappings":";;;AAAA,+DAGoC;AAUpC,wDAAiE;AAEjE;;GAEG;AACH,IAAiB,QAAQ,CA0DxB;AA1DD,WAAiB,QAAQ;IACV,qCAA4B,GAAG,IAAI,iCAAgB,EAE7D,CAAC;IACS,oCAA2B,GAAG,IAAI,iCAAgB,EAE5D,CAAC;IAES,yCAAgC,GAAG,IAAI,iCAAgB,EAEjE,CAAC;IAEJ,6EAA6E;IAChE,6BAAoB,GAC/B,IAAI,+BAAoB,CACtB,4BAA4B,CAC7B,CAAC;IAES,mBAAU,GACrB,IAAA,kCAAiB,GAQd,CAAC;IAEO,oBAAW,GACtB,IAAA,kCAAiB,GAQd,CAAC;IAEO,oBAAW,GACtB,IAAA,kCAAiB,GAMd,CAAC;IAEO,kBAAS,GACpB,IAAA,kCAAiB,GAOd,CAAC;AACR,CAAC,EA1DgB,QAAQ,aAAR,QAAQ,GAAR,QAAQ,QA0DxB"}
|
|
@@ -5,6 +5,12 @@ const internal_1 = require("./internal");
|
|
|
5
5
|
function deliveryOf(options) {
|
|
6
6
|
return { dedupe: options.dedupe };
|
|
7
7
|
}
|
|
8
|
+
/** The notification as sent: `options.tenantId`, when set, names its workspace. */
|
|
9
|
+
function sentData(data, options) {
|
|
10
|
+
return options.tenantId === undefined
|
|
11
|
+
? data
|
|
12
|
+
: { ...data, tenantId: options.tenantId };
|
|
13
|
+
}
|
|
8
14
|
class SendableNotification {
|
|
9
15
|
data;
|
|
10
16
|
constructor(data) {
|
|
@@ -16,10 +22,10 @@ class SendableNotification {
|
|
|
16
22
|
* unless `dedupe: false` (see {@link DeliveryOptions}).
|
|
17
23
|
*/
|
|
18
24
|
async toUser(userId, options = {}) {
|
|
19
|
-
await internal_1.internal.SendToUser(userId, this.data, undefined, options.idempotencyKey, deliveryOf(options));
|
|
25
|
+
await internal_1.internal.SendToUser(userId, sentData(this.data, options), undefined, options.idempotencyKey, deliveryOf(options));
|
|
20
26
|
}
|
|
21
27
|
async toUsers(userIds, options = {}) {
|
|
22
|
-
await internal_1.internal.SendToUsers(userIds, this.data, options.readScope, options.idempotencyKey, deliveryOf(options));
|
|
28
|
+
await internal_1.internal.SendToUsers(userIds, sentData(this.data, options), options.readScope, options.idempotencyKey, deliveryOf(options));
|
|
23
29
|
}
|
|
24
30
|
/** Sends a durable event once per recipient under `idempotencyKey`, including after dismissal. */
|
|
25
31
|
async toUsersIdempotently(userIds, idempotencyKey, options = {}) {
|
|
@@ -27,10 +33,10 @@ class SendableNotification {
|
|
|
27
33
|
}
|
|
28
34
|
/** Sends to the holders of any of `roleIds`, in `options.tenantId` only when set. */
|
|
29
35
|
async toRoles(roleIds, options = {}) {
|
|
30
|
-
await internal_1.internal.SendToRoles(roleIds, this.data, options);
|
|
36
|
+
await internal_1.internal.SendToRoles(roleIds, sentData(this.data, options), options);
|
|
31
37
|
}
|
|
32
38
|
async broadcast(options = {}) {
|
|
33
|
-
await internal_1.internal.SendToAll(this.data, options.readScope, options.idempotencyKey, deliveryOf(options));
|
|
39
|
+
await internal_1.internal.SendToAll(sentData(this.data, options), options.readScope, options.idempotencyKey, deliveryOf(options));
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
exports.SendableNotification = SendableNotification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendable.js","sourceRoot":"","sources":["../../src/notifications/sendable.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAQtC,SAAS,UAAU,CAAC,OAAoB;IACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;IACmB,IAAI,CAAmB;IAExC,YAAY,IAAsB;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,OAAO,GAAgB,EAAE;QACpD,MAAM,mBAAQ,CAAC,UAAU,CACvB,MAAM,EACN,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"sendable.js","sourceRoot":"","sources":["../../src/notifications/sendable.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAQtC,SAAS,UAAU,CAAC,OAAoB;IACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,mFAAmF;AACnF,SAAS,QAAQ,CACf,IAAsB,EACtB,OAAoB;IAEpB,OAAO,OAAO,CAAC,QAAQ,KAAK,SAAS;QACnC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ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EAAE,OAAO,CAAC,EAC5B,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,cAAc,EACtB,UAAU,CAAC,OAAO,CAAC,CACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -20,6 +20,29 @@ export interface NotificationSubjectInfo {
|
|
|
20
20
|
togglePermission?: TogglePermission;
|
|
21
21
|
/** Translation key of a badge shown next to the subject label (`Developer mode`). */
|
|
22
22
|
badgeKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the subject also reaches its recipients by e-mail, next to the
|
|
25
|
+
* in-app feed. `true` offers it off until the user turns it on;
|
|
26
|
+
* `{ defaultOn: true }` offers it on until the user turns it off. Unset or
|
|
27
|
+
* `false`: in-app only. E-mail is delivered only once a module registers
|
|
28
|
+
* the e-mail channel (`NotificationEmailChannel`).
|
|
29
|
+
*/
|
|
30
|
+
email?: boolean | {
|
|
31
|
+
defaultOn?: boolean;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The e-mail channel a mail module registers. The DMS calls `deliver` once
|
|
36
|
+
* per stored in-app notification whose recipient has e-mail on for its
|
|
37
|
+
* subject.
|
|
38
|
+
*/
|
|
39
|
+
export interface NotificationEmailChannelInfo {
|
|
40
|
+
/**
|
|
41
|
+
* Hands one notification to the channel, with the id of the in-app
|
|
42
|
+
* notification it follows. A rejection is logged and never fails the
|
|
43
|
+
* in-app delivery. Sends wait for it, so queue slow work.
|
|
44
|
+
*/
|
|
45
|
+
deliver(userId: string, data: NotificationData, notificationId: string): Promise<void> | void;
|
|
23
46
|
}
|
|
24
47
|
/** How a delivery is stored, whoever receives it. */
|
|
25
48
|
export interface DeliveryOptions {
|
|
@@ -35,17 +58,18 @@ export interface DeliveryOptions {
|
|
|
35
58
|
}
|
|
36
59
|
export interface SendOptions extends DeliveryOptions {
|
|
37
60
|
readScope?: ReadScope;
|
|
61
|
+
/**
|
|
62
|
+
* The workspace the notification is about. The e-mail channel receives it
|
|
63
|
+
* in `NotificationData.tenantId`. `toRoles` also limits its recipients to
|
|
64
|
+
* this tenant's members holding the roles; without it, the holders are
|
|
65
|
+
* looked up in every tenant.
|
|
66
|
+
*/
|
|
67
|
+
tenantId?: string;
|
|
38
68
|
/** Stable event key, unique across notification producers. Retries preserve delivery and dismissal state. */
|
|
39
69
|
idempotencyKey?: string;
|
|
40
70
|
}
|
|
41
71
|
/** Options of `toRoles`: a send to the holders of roles. */
|
|
42
72
|
export interface RoleSendOptions extends SendOptions {
|
|
43
|
-
/**
|
|
44
|
-
* Only the members of this tenant holding the roles. Role ids belong to a
|
|
45
|
-
* tenant, so a send about one tenant names it; without it, the holders are
|
|
46
|
-
* looked up in every tenant.
|
|
47
|
-
*/
|
|
48
|
-
tenantId?: string;
|
|
49
73
|
}
|
|
50
74
|
export interface NotificationData {
|
|
51
75
|
icon: string;
|
|
@@ -56,5 +80,7 @@ export interface NotificationData {
|
|
|
56
80
|
params?: Record<string, string | number>;
|
|
57
81
|
/** Icon well colour; unset notifications use `primary` while unread, neutral once read. */
|
|
58
82
|
tone?: NotificationTone;
|
|
83
|
+
/** The workspace the notification is about, from `SendOptions.tenantId`. */
|
|
84
|
+
tenantId?: string;
|
|
59
85
|
}
|
|
60
86
|
export type RequiredFields = "icon" | "title" | "description" | "subject";
|
package/docs/3.base/2.types.md
CHANGED
|
@@ -355,7 +355,7 @@ const createdAtBehavior = {
|
|
|
355
355
|
|
|
356
356
|
### Field values
|
|
357
357
|
|
|
358
|
-
`DefaultValue`
|
|
358
|
+
`DefaultValue` is the recursive union `string | number | boolean | Date | null`, arrays of itself, and objects of itself (a row of an `ArrayType` field). `FormFieldValue` holds the same scalars, `Record<string, string>` and arrays of itself. `DefaultValue` types `FormField.defaultValue` and `ColumnOptions.defaultValue`; `FormFieldValue` types a value held by a form field.
|
|
359
359
|
|
|
360
360
|
### `ComponentOrNoInput`
|
|
361
361
|
|
|
@@ -21,6 +21,7 @@ The [Read notifications](/docs/auth-and-tenancy/authentication#read-notification
|
|
|
21
21
|
- **Four dispatch targets.** You send to one user, to a list of users, to every user holding at least one of a set of roles, or to every user.
|
|
22
22
|
- **Shared or individual read state.** A multi-recipient send can give each recipient their own read state. It can also group the copies, so that one recipient reading the notification marks it read for all of them.
|
|
23
23
|
- **Preference-aware delivery.** The DMS skips a send without an error for a user who turned the subject off. `togglePermission` marks the subjects that users may not turn off.
|
|
24
|
+
- **E-mail.** A subject can offer e-mail next to the app, and a mail module registers the channel that sends it. See [E-mail](/docs/interfaces/notifications/email).
|
|
24
25
|
|
|
25
26
|
## Dependencies
|
|
26
27
|
|
|
@@ -10,7 +10,7 @@ You declare categories and subjects by calling `NotificationCategory()` and `Not
|
|
|
10
10
|
|
|
11
11
|
Declarations are function calls, not decorators. They run when the module that contains them is imported. Declare them at the top level of a module that is imported during startup, so the taxonomy is complete before the first notification is sent.
|
|
12
12
|
|
|
13
|
-
The [Notification preferences](/docs/auth-and-tenancy/authentication#notification-preferences) walkthrough shows the System category expanded to its subjects, and describes the locked General subject in prose.
|
|
13
|
+
The [Notification preferences](/docs/auth-and-tenancy/authentication#notification-preferences) walkthrough shows the System category expanded to its subjects, and describes the locked General subject in prose. The Email column holds a switch for each subject that offers e-mail once a module registers the e-mail channel, and is marked **Soon** otherwise (see [E-mail](/docs/interfaces/notifications/email)). These switches control notifications, not the transactional authentication emails.
|
|
14
14
|
|
|
15
15
|
## Declaring a category
|
|
16
16
|
|
|
@@ -88,6 +88,7 @@ export const stockSubject = NotificationSubject("stock", {
|
|
|
88
88
|
| `descriptionKey` | `string` (optional) | Translation key for a longer description. |
|
|
89
89
|
| `togglePermission` | [`TogglePermission`](#toggle-permissions) (optional) | Whether users may turn this subject off. The DMS reads it together with the category's value. |
|
|
90
90
|
| `badgeKey` | `string` (optional) | Translation key of a badge that the settings screen shows next to the subject label, for example `Developer mode`. |
|
|
91
|
+
| `email` | `boolean \| { defaultOn?: boolean }` (optional) | Whether the subject also reaches its recipients by e-mail: `true` (off until the user turns it on) or `{ defaultOn: true }` (on until the user turns it off). In-app only when unset. See [E-mail](/docs/interfaces/notifications/email). |
|
|
91
92
|
|
|
92
93
|
A subject carries the whole category object, not only its id, so `subject.category.id` is always available from a subject you hold. A send uses it to build the preference key from the subject you passed to the builder.
|
|
93
94
|
|
|
@@ -123,8 +124,8 @@ Every other combination leaves the subject toggleable. The value on a category a
|
|
|
123
124
|
A locked subject behaves the same way everywhere:
|
|
124
125
|
|
|
125
126
|
- The settings screen shows its switch disabled, with a hint.
|
|
126
|
-
- The preferences route refuses a change that turns it off, with HTTP 403.
|
|
127
|
-
- Every dispatch method delivers it whatever preference the user has stored for it.
|
|
127
|
+
- The preferences route refuses a change that turns it off, with HTTP 403, in the app or by e-mail when it offers e-mail.
|
|
128
|
+
- Every dispatch method delivers it whatever preference the user has stored for it, by e-mail too when it offers e-mail.
|
|
128
129
|
|
|
129
130
|
For a notification a user must always receive, declare `togglePermission: "forbidden"` on the subject **and** `togglePermission: "default"` on its category. `SystemCategory` declares `"default"`, which is what makes `GeneralSubject` mandatory.
|
|
130
131
|
|
|
@@ -164,7 +164,7 @@ Every dispatch method accepts an optional `SendOptions` object.
|
|
|
164
164
|
| `readScope` | `ReadScope` (optional) | Read-state grouping for a multi-recipient send. Defaults to `"individual"`. See [Read scope](/docs/interfaces/notifications/categories-and-subjects#read-scope). |
|
|
165
165
|
| `idempotencyKey` | `string` (optional) | Stable event key, unique across producers. Prefix it with your module ID. Reusing it for a recipient preserves the original notification and its dismissal state. |
|
|
166
166
|
| `dedupe` | `boolean` (optional) | With `false`, the DMS stores every unkeyed send, even one identical to a notification the recipient got less than 10 seconds earlier. Defaults to `true`. See [Repeated sends](#repeated-sends). |
|
|
167
|
-
| `tenantId` | `string` (optional
|
|
167
|
+
| `tenantId` | `string` (optional) | The workspace the notification is about. The [e-mail channel](/docs/interfaces/notifications/email) receives it as `data.tenantId`. With `toRoles`, it also limits the recipients to the members of this tenant holding the roles; every tenant when unset. |
|
|
168
168
|
|
|
169
169
|
Pick `"shared"` for an alert that only needs one person to act on it, and `"individual"` for anything each recipient has to see.
|
|
170
170
|
|
|
@@ -212,6 +212,7 @@ Every dispatch method resolves to one delivery per user, so the DMS applies the
|
|
|
212
212
|
- **Skipping is silent.** A skipped delivery is not an error. The promise resolves normally, and there is no per-recipient result to inspect.
|
|
213
213
|
- **Each recipient gets a row.** Each recipient gets their own stored notification. With `readScope: "shared"`, the DMS ties those copies together for read state, and they stay separate rows.
|
|
214
214
|
- **Stored notifications are pushed live.** The DMS also publishes each new delivery on the recipient's realtime stream, so the dashboard's badge and preview update without a reload.
|
|
215
|
+
- **Stored notifications reach the e-mail channel.** When a module registers the e-mail channel and the subject offers e-mail, each new delivery is also handed to the channel for recipients who have e-mail on. A repeat or a retry that stores nothing new is not mailed. See [E-mail](/docs/interfaces/notifications/email).
|
|
215
216
|
|
|
216
217
|
A send can be skipped for reasons outside your control, so treat notifications as best-effort and do not make a workflow depend on one having been stored. To keep a failed send from breaking the operation that triggered it, wrap the call:
|
|
217
218
|
|
|
@@ -250,7 +251,7 @@ The interface root exports `Notification()` and the data types. The `types` subp
|
|
|
250
251
|
| `NotificationBuilder` | `@antelopejs/interface-dms/notifications/builder` |
|
|
251
252
|
| `SendableNotification` | `@antelopejs/interface-dms/notifications/sendable` |
|
|
252
253
|
|
|
253
|
-
`NotificationData` is the shape the builder assembles. It holds `icon`, `title`, `description` and `subject`, plus the optional `linkTo`, `params` and `tone
|
|
254
|
+
`NotificationData` is the shape the builder assembles. It holds `icon`, `title`, `description` and `subject`, plus the optional `linkTo`, `params` and `tone`, and the `tenantId` a send names. Name it when you carry notification content around before you build it:
|
|
254
255
|
|
|
255
256
|
```typescript
|
|
256
257
|
import { Notification } from "@antelopejs/interface-dms/notifications";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "E-mail"
|
|
3
|
+
description: "How a module delivers notifications by e-mail, and how a subject offers it."
|
|
4
|
+
mode: reference
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Every notification lands in the recipient's in-app feed. The **e-mail channel** also mails it. The DMS defines the channel and ships no implementation for it. A mail module registers it, and every subject that offers e-mail then reaches the users who turn it on.
|
|
8
|
+
|
|
9
|
+
Two parties take part:
|
|
10
|
+
|
|
11
|
+
- **A subject offers e-mail** with `email` on its declaration. A subject without it stays in-app only.
|
|
12
|
+
- **A module registers the channel** with `NotificationEmailChannel({ deliver })`. Without a registration, nothing is mailed and the settings screen shows the Email column marked **Soon**, as on an installation without a mail module.
|
|
13
|
+
|
|
14
|
+
## Offering e-mail on a subject
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import {
|
|
18
|
+
NotificationCategory,
|
|
19
|
+
NotificationSubject,
|
|
20
|
+
} from "@antelopejs/interface-dms/notifications";
|
|
21
|
+
|
|
22
|
+
const shopCategory = NotificationCategory("shop", {
|
|
23
|
+
labelKey: "shop.notifications.categories.shop",
|
|
24
|
+
icon: "i-ph-shopping-cart",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const orderShippedSubject = NotificationSubject("order-shipped", {
|
|
28
|
+
category: shopCategory,
|
|
29
|
+
labelKey: "shop.notifications.subjects.order_shipped",
|
|
30
|
+
email: true,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const invoiceSubject = NotificationSubject("invoice", {
|
|
34
|
+
category: shopCategory,
|
|
35
|
+
labelKey: "shop.notifications.subjects.invoice",
|
|
36
|
+
email: { defaultOn: true },
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Value of `email` | Meaning |
|
|
41
|
+
| ---------------- | ------- |
|
|
42
|
+
| omitted or `false` | The subject is not offered by e-mail. Its Email cell shows `—`. |
|
|
43
|
+
| `true` or `{ defaultOn: false }` | Offered, off until the user turns it on. |
|
|
44
|
+
| `{ defaultOn: true }` | Offered, on until the user turns it off. |
|
|
45
|
+
|
|
46
|
+
## Registering the channel
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { NotificationEmailChannel } from "@antelopejs/interface-dms/notifications";
|
|
50
|
+
|
|
51
|
+
NotificationEmailChannel({
|
|
52
|
+
deliver: (userId, data, notificationId) => {
|
|
53
|
+
// Queue a mail for `userId` about `data` (its title, description,
|
|
54
|
+
// params, link and `tenantId`), keyed by `notificationId`.
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`deliver(userId, data, notificationId)` receives:
|
|
60
|
+
|
|
61
|
+
| Argument | Description |
|
|
62
|
+
| -------- | ----------- |
|
|
63
|
+
| `userId` | The recipient. |
|
|
64
|
+
| `data` | The `NotificationData` sent, with `tenantId` when the send named a workspace (`SendOptions.tenantId`). |
|
|
65
|
+
| `notificationId` | Id of the in-app notification stored for this recipient. Key the mail on it to send it at most once. |
|
|
66
|
+
|
|
67
|
+
One module registers the channel. A later registration replaces the earlier one. Unloading the module whose registration is live removes the channel; unloading one that was replaced, as a hot reload does, leaves the live one in place.
|
|
68
|
+
|
|
69
|
+
## When the DMS calls the channel
|
|
70
|
+
|
|
71
|
+
For each recipient, after the in-app notification is handled:
|
|
72
|
+
|
|
73
|
+
- **Only a new in-app notification is mailed.** The DMS calls `deliver` once the in-app row is stored and published. A send the recipient turned off in the app, a repeat inside the [10-second window](/docs/interfaces/notifications/sending#repeated-sends) and a retry of a keyed send (`toUsersIdempotently`) store no new row, so they mail nothing. E-mail is a copy of an in-app notification: a user who turns a subject off in the app receives no e-mail for it either, and the settings screen disables its Email switch.
|
|
74
|
+
- **The user preference decides.** The choice is stored under `categoryId:subjectId@email`, next to the in-app key in the same per-user map. A user who never chose gets the subject's `defaultOn`.
|
|
75
|
+
- **A locked subject is mailed whatever is stored.** A [locked subject](/docs/interfaces/notifications/categories-and-subjects#toggle-permissions) that offers e-mail reaches every recipient by e-mail, and the preferences route refuses turning its e-mail off with HTTP 403.
|
|
76
|
+
- **A failing channel never fails the send.** A `deliver` that throws or rejects is logged with `[DMS] Notification e-mail channel failed to deliver`. The in-app notification stays, and the send resolves.
|
|
77
|
+
- **Sends wait for `deliver`.** Queue slow work, such as talking to a mail server, instead of doing it inside `deliver`.
|
|
78
|
+
|
|
79
|
+
Preferences are per user and global: one choice per subject covers every workspace the user belongs to, for e-mail as for the app. `data.tenantId` tells the channel which workspace the notification is about, for example to pick its sender or branding.
|
package/docs/index.md
CHANGED
|
@@ -82,7 +82,7 @@ Each subpath is its own entry point, and importing one does not load the others.
|
|
|
82
82
|
| `/base/table-view` | `TableView`, `@Column`, `TableViewRoutes`, guards, row actions | [Base](/docs/interfaces/base/tables) |
|
|
83
83
|
| `/base/data-types` | `DataType`, the registration decorators, `DefaultDataTypes`, `DefaultDataCompareTypes`, `StatusType` | [Base](/docs/interfaces/base/data-types) |
|
|
84
84
|
| `/base/…` | The per-component subpaths, such as `chart`, `grid`, `stack`, `tab`, `custom`, `layouts` and `helpers/…` | [Base](/docs/interfaces/base/introduction) |
|
|
85
|
-
| `/notifications`, `/notifications/types` | Categories, subjects, the notification builder
|
|
85
|
+
| `/notifications`, `/notifications/types` | Categories, subjects, the notification builder, its dispatch targets and the e-mail channel | [Notifications](/docs/interfaces/notifications/introduction) |
|
|
86
86
|
| `/html-render` | `RegisterHtmlTemplate`, `GenerateHtml` and the template reference types | [HTML Render](/docs/interfaces/html-render/introduction) |
|
|
87
87
|
|
|
88
88
|
Beyond these entry points, built files are importable through the `./*` export (`@antelopejs/interface-dms/base/form-types`). Moving or renaming a public path is a breaking change, like removing an export.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-dms",
|
|
3
|
-
"version": "0.14.7-next.
|
|
3
|
+
"version": "0.14.7-next.1003.gd845bb6",
|
|
4
4
|
"description": "Public AntelopeJS interfaces of the DMS: pages, components, permissions, tenancy, auth, notifications and HTML rendering.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"provenance": true,
|
|
133
133
|
"registry": "https://registry.npmjs.org/"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "d845bb64b63e572e3f64e1cb22e36dd9c5a510de",
|
|
136
136
|
"scripts": {
|
|
137
137
|
"build": "rimraf dist && antelopejs-tsc",
|
|
138
138
|
"typecheck": "antelopejs-tsc --noEmit",
|