@lssm/module.notifications 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/channels/index.js +126 -1
  2. package/dist/contracts/index.js +436 -1
  3. package/dist/entities/index.js +254 -1
  4. package/dist/index.js +7 -1
  5. package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
  6. package/dist/libs/contracts/dist/client/index.js +5 -1
  7. package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
  8. package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
  9. package/dist/libs/contracts/dist/client/react/index.js +4 -1
  10. package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
  11. package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
  12. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  13. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  14. package/dist/libs/contracts/dist/docs/index.js +29 -1
  15. package/dist/libs/contracts/dist/docs/presentations.js +71 -1
  16. package/dist/libs/contracts/dist/docs/registry.js +44 -1
  17. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  18. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  19. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  20. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  21. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  22. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  23. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  24. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  25. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  26. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  27. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  28. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  29. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  30. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  31. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  32. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  33. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  34. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  35. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  36. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  37. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  38. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  39. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  40. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  41. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  42. package/dist/libs/contracts/dist/events.js +1 -1
  43. package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
  44. package/dist/libs/contracts/dist/index.js +71 -1
  45. package/dist/libs/contracts/dist/install.js +2 -1
  46. package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
  47. package/dist/libs/contracts/dist/integrations/index.js +18 -1
  48. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
  49. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
  50. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
  51. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
  52. package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
  53. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
  54. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
  55. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
  56. package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
  57. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
  58. package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
  59. package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
  60. package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
  61. package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
  62. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
  63. package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
  64. package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
  65. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
  66. package/dist/libs/contracts/dist/jsonschema.js +1 -1
  67. package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
  68. package/dist/libs/contracts/dist/knowledge/index.js +7 -1
  69. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
  70. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
  71. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
  72. package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
  73. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
  74. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
  75. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
  76. package/dist/libs/contracts/dist/llm/exporters.js +19 -1
  77. package/dist/libs/contracts/dist/llm/index.js +2 -1
  78. package/dist/libs/contracts/dist/llm/prompts.js +1 -1
  79. package/dist/libs/contracts/dist/onboarding-base.js +196 -1
  80. package/dist/libs/contracts/dist/openapi.js +1 -1
  81. package/dist/libs/contracts/dist/ownership.js +21 -1
  82. package/dist/libs/contracts/dist/presentations.js +1 -1
  83. package/dist/libs/contracts/dist/presentations.v2.js +11 -1
  84. package/dist/libs/contracts/dist/prompt.js +1 -1
  85. package/dist/libs/contracts/dist/promptRegistry.js +1 -1
  86. package/dist/libs/contracts/dist/regenerator/index.js +1 -1
  87. package/dist/libs/contracts/dist/regenerator/service.js +6 -1
  88. package/dist/libs/contracts/dist/registry.js +2 -1
  89. package/dist/libs/contracts/dist/resources.js +1 -1
  90. package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
  91. package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
  92. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
  93. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +39 -1
  94. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
  95. package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
  96. package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
  97. package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
  98. package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
  99. package/dist/libs/contracts/dist/server/index.js +8 -1
  100. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
  101. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
  102. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
  103. package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
  104. package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
  105. package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
  106. package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
  107. package/dist/libs/contracts/dist/server/rest-express.js +1 -1
  108. package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
  109. package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
  110. package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
  111. package/dist/libs/contracts/dist/spec.js +34 -1
  112. package/dist/libs/contracts/dist/telemetry/index.js +1 -1
  113. package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
  114. package/dist/libs/contracts/dist/tests/index.js +1 -1
  115. package/dist/libs/contracts/dist/tests/runner.js +2 -1
  116. package/dist/libs/contracts/dist/workflow/index.js +1 -1
  117. package/dist/libs/contracts/dist/workflow/runner.js +1 -1
  118. package/dist/libs/schema/dist/EnumType.js +56 -1
  119. package/dist/libs/schema/dist/FieldType.js +49 -1
  120. package/dist/libs/schema/dist/ScalarTypeEnum.js +236 -1
  121. package/dist/libs/schema/dist/SchemaModel.js +3 -1
  122. package/dist/libs/schema/dist/entity/defineEntity.js +236 -1
  123. package/dist/libs/schema/dist/entity/index.js +2 -1
  124. package/dist/libs/schema/dist/entity/types.js +1 -1
  125. package/dist/libs/schema/dist/index.js +6 -1
  126. package/dist/notifications.feature.js +68 -1
  127. package/dist/templates/index.js +195 -3
  128. package/package.json +6 -6
@@ -1 +1,236 @@
1
- import*as e from"zod";function t(e){return e}function n(e){return e}const r={string(e){return{kind:`scalar`,type:`String`,...e}},int(e){return{kind:`scalar`,type:`Int`,...e}},float(e){return{kind:`scalar`,type:`Float`,...e}},boolean(e){return{kind:`scalar`,type:`Boolean`,...e}},dateTime(e){return{kind:`scalar`,type:`DateTime`,...e}},json(e){return{kind:`scalar`,type:`Json`,...e}},bigInt(e){return{kind:`scalar`,type:`BigInt`,...e}},decimal(e){return{kind:`scalar`,type:`Decimal`,...e}},bytes(e){return{kind:`scalar`,type:`Bytes`,...e}},id(e){return{kind:`scalar`,type:`String`,isId:!0,default:`cuid()`,...e}},uuid(e){return{kind:`scalar`,type:`String`,isId:!0,default:`uuid()`,...e}},autoIncrement(e){return{kind:`scalar`,type:`Int`,isId:!0,default:`autoincrement()`,...e}},createdAt(e){return{kind:`scalar`,type:`DateTime`,default:`now()`,...e}},updatedAt(e){return{kind:`scalar`,type:`DateTime`,updatedAt:!0,...e}},email(t){return{kind:`scalar`,type:`String`,zod:e.email(),...t}},url(t){return{kind:`scalar`,type:`String`,zod:e.url(),...t}},enum(e,t){return{kind:`enum`,enumName:e,...t}},inlineEnum(e,t,n){return{kind:`enum`,enumName:e,values:t,...n}},hasOne(e,t){return{kind:`relation`,type:`hasOne`,target:e,...t}},hasMany(e,t){return{kind:`relation`,type:`hasMany`,target:e,...t}},belongsTo(e,t,n,r){return{kind:`relation`,type:`belongsTo`,target:e,fields:t,references:n,...r}},foreignKey(e){return{kind:`scalar`,type:`String`,...e}}},i={on(e,t){return{fields:e,...t}},unique(e,t){return{fields:e,unique:!0,...t}},compound(e,t,n){return{fields:e,sort:t,...n}}};export{i,n,r,t};
1
+ import * as z$1 from "zod";
2
+
3
+ //#region ../../libs/schema/dist/entity/defineEntity.js
4
+ /**
5
+ * Helper to define a database entity with full type safety.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const UserEntity = defineEntity({
10
+ * name: 'User',
11
+ * schema: 'lssm_sigil',
12
+ * description: 'A user of the platform.',
13
+ * fields: {
14
+ * id: field.id(),
15
+ * email: field.string({ isUnique: true, zod: z.string().email() }),
16
+ * name: field.string({ isOptional: true }),
17
+ * createdAt: field.createdAt(),
18
+ * updatedAt: field.updatedAt(),
19
+ * memberships: field.hasMany('Member'),
20
+ * },
21
+ * indexes: [{ fields: ['email'], unique: true }],
22
+ * });
23
+ * ```
24
+ */
25
+ function defineEntity(spec) {
26
+ return spec;
27
+ }
28
+ /**
29
+ * Helper to define an enum that can be shared across entities.
30
+ */
31
+ function defineEntityEnum(def) {
32
+ return def;
33
+ }
34
+ /**
35
+ * Field builder helpers for common field patterns.
36
+ */
37
+ const field = {
38
+ string(opts) {
39
+ return {
40
+ kind: "scalar",
41
+ type: "String",
42
+ ...opts
43
+ };
44
+ },
45
+ int(opts) {
46
+ return {
47
+ kind: "scalar",
48
+ type: "Int",
49
+ ...opts
50
+ };
51
+ },
52
+ float(opts) {
53
+ return {
54
+ kind: "scalar",
55
+ type: "Float",
56
+ ...opts
57
+ };
58
+ },
59
+ boolean(opts) {
60
+ return {
61
+ kind: "scalar",
62
+ type: "Boolean",
63
+ ...opts
64
+ };
65
+ },
66
+ dateTime(opts) {
67
+ return {
68
+ kind: "scalar",
69
+ type: "DateTime",
70
+ ...opts
71
+ };
72
+ },
73
+ json(opts) {
74
+ return {
75
+ kind: "scalar",
76
+ type: "Json",
77
+ ...opts
78
+ };
79
+ },
80
+ bigInt(opts) {
81
+ return {
82
+ kind: "scalar",
83
+ type: "BigInt",
84
+ ...opts
85
+ };
86
+ },
87
+ decimal(opts) {
88
+ return {
89
+ kind: "scalar",
90
+ type: "Decimal",
91
+ ...opts
92
+ };
93
+ },
94
+ bytes(opts) {
95
+ return {
96
+ kind: "scalar",
97
+ type: "Bytes",
98
+ ...opts
99
+ };
100
+ },
101
+ id(opts) {
102
+ return {
103
+ kind: "scalar",
104
+ type: "String",
105
+ isId: true,
106
+ default: "cuid()",
107
+ ...opts
108
+ };
109
+ },
110
+ uuid(opts) {
111
+ return {
112
+ kind: "scalar",
113
+ type: "String",
114
+ isId: true,
115
+ default: "uuid()",
116
+ ...opts
117
+ };
118
+ },
119
+ autoIncrement(opts) {
120
+ return {
121
+ kind: "scalar",
122
+ type: "Int",
123
+ isId: true,
124
+ default: "autoincrement()",
125
+ ...opts
126
+ };
127
+ },
128
+ createdAt(opts) {
129
+ return {
130
+ kind: "scalar",
131
+ type: "DateTime",
132
+ default: "now()",
133
+ ...opts
134
+ };
135
+ },
136
+ updatedAt(opts) {
137
+ return {
138
+ kind: "scalar",
139
+ type: "DateTime",
140
+ updatedAt: true,
141
+ ...opts
142
+ };
143
+ },
144
+ email(opts) {
145
+ return {
146
+ kind: "scalar",
147
+ type: "String",
148
+ zod: z$1.email(),
149
+ ...opts
150
+ };
151
+ },
152
+ url(opts) {
153
+ return {
154
+ kind: "scalar",
155
+ type: "String",
156
+ zod: z$1.url(),
157
+ ...opts
158
+ };
159
+ },
160
+ enum(enumName, opts) {
161
+ return {
162
+ kind: "enum",
163
+ enumName,
164
+ ...opts
165
+ };
166
+ },
167
+ inlineEnum(enumName, values, opts) {
168
+ return {
169
+ kind: "enum",
170
+ enumName,
171
+ values,
172
+ ...opts
173
+ };
174
+ },
175
+ hasOne(target, opts) {
176
+ return {
177
+ kind: "relation",
178
+ type: "hasOne",
179
+ target,
180
+ ...opts
181
+ };
182
+ },
183
+ hasMany(target, opts) {
184
+ return {
185
+ kind: "relation",
186
+ type: "hasMany",
187
+ target,
188
+ ...opts
189
+ };
190
+ },
191
+ belongsTo(target, fields, references, opts) {
192
+ return {
193
+ kind: "relation",
194
+ type: "belongsTo",
195
+ target,
196
+ fields,
197
+ references,
198
+ ...opts
199
+ };
200
+ },
201
+ foreignKey(opts) {
202
+ return {
203
+ kind: "scalar",
204
+ type: "String",
205
+ ...opts
206
+ };
207
+ }
208
+ };
209
+ /**
210
+ * Index builder helpers.
211
+ */
212
+ const index = {
213
+ on(fields, opts) {
214
+ return {
215
+ fields,
216
+ ...opts
217
+ };
218
+ },
219
+ unique(fields, opts) {
220
+ return {
221
+ fields,
222
+ unique: true,
223
+ ...opts
224
+ };
225
+ },
226
+ compound(fields, sort, opts) {
227
+ return {
228
+ fields,
229
+ sort,
230
+ ...opts
231
+ };
232
+ }
233
+ };
234
+
235
+ //#endregion
236
+ export { defineEntity, defineEntityEnum, field, index };
@@ -1 +1,2 @@
1
- import{i as e,n as t,r as n,t as r}from"./defineEntity.js";import"./types.js";
1
+ import { defineEntity, defineEntityEnum, field, index } from "./defineEntity.js";
2
+ import "./types.js";
@@ -1 +1 @@
1
- import"zod";
1
+ import "zod";
@@ -1 +1,6 @@
1
- import{n as e,r as t}from"./EnumType.js";import{t as n}from"./FieldType.js";import{l as r}from"./ScalarTypeEnum.js";import"./SchemaModel.js";import{i,n as a,r as o,t as s}from"./entity/defineEntity.js";import"./entity/index.js";
1
+ import { EnumType, defineEnum } from "./EnumType.js";
2
+ import { FieldType } from "./FieldType.js";
3
+ import { ScalarTypeEnum } from "./ScalarTypeEnum.js";
4
+ import "./SchemaModel.js";
5
+ import { defineEntity, defineEntityEnum, field, index } from "./entity/defineEntity.js";
6
+ import "./entity/index.js";
@@ -1 +1,68 @@
1
- const e={meta:{key:`notifications`,title:`Notifications`,description:`Multi-channel notification delivery with preference management`,domain:`platform`,owners:[`@platform.notifications`],tags:[`notifications`,`email`,`push`,`in-app`],stability:`stable`},operations:[{name:`notifications.send`,version:1},{name:`notifications.markRead`,version:1},{name:`notifications.markAllRead`,version:1},{name:`notifications.delete`,version:1},{name:`notifications.list`,version:1},{name:`notifications.preferences.update`,version:1},{name:`notifications.preferences.get`,version:1}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:`notifications`,version:1}],requires:[{key:`identity`,version:1}]}};export{e as NotificationsFeature};
1
+ //#region src/notifications.feature.ts
2
+ /**
3
+ * Notifications feature module that bundles notification sending,
4
+ * listing, marking as read, and preference management capabilities.
5
+ */
6
+ const NotificationsFeature = {
7
+ meta: {
8
+ key: "notifications",
9
+ title: "Notifications",
10
+ description: "Multi-channel notification delivery with preference management",
11
+ domain: "platform",
12
+ owners: ["@platform.notifications"],
13
+ tags: [
14
+ "notifications",
15
+ "email",
16
+ "push",
17
+ "in-app"
18
+ ],
19
+ stability: "stable"
20
+ },
21
+ operations: [
22
+ {
23
+ name: "notifications.send",
24
+ version: 1
25
+ },
26
+ {
27
+ name: "notifications.markRead",
28
+ version: 1
29
+ },
30
+ {
31
+ name: "notifications.markAllRead",
32
+ version: 1
33
+ },
34
+ {
35
+ name: "notifications.delete",
36
+ version: 1
37
+ },
38
+ {
39
+ name: "notifications.list",
40
+ version: 1
41
+ },
42
+ {
43
+ name: "notifications.preferences.update",
44
+ version: 1
45
+ },
46
+ {
47
+ name: "notifications.preferences.get",
48
+ version: 1
49
+ }
50
+ ],
51
+ events: [],
52
+ presentations: [],
53
+ opToPresentation: [],
54
+ presentationsTargets: [],
55
+ capabilities: {
56
+ provides: [{
57
+ key: "notifications",
58
+ version: 1
59
+ }],
60
+ requires: [{
61
+ key: "identity",
62
+ version: 1
63
+ }]
64
+ }
65
+ };
66
+
67
+ //#endregion
68
+ export { NotificationsFeature };
@@ -1,9 +1,201 @@
1
- function e(e){return e}function t(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>{let r=t[n];return r==null?e:String(r)})}function n(e,n,i){let a=e.channels[n];if(!a)return null;let o=a.title?t(a.title,i):e.name,s=t(a.body,i),c={title:o,body:s,actionUrl:a.actionUrl?t(a.actionUrl,i):void 0};return n===`email`&&a.subject&&(c.email={subject:t(a.subject,i),html:s,text:r(s)}),c}function r(e){return e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()}var i=class{templates=new Map;register(e){this.templates.set(e.id,e)}get(e){return this.templates.get(e)}getAll(){return Array.from(this.templates.values())}getByCategory(e){return this.getAll().filter(t=>t.category===e)}};function a(){return new i}const o=e({id:`welcome`,name:`Welcome`,description:`Sent when a user signs up.`,category:`onboarding`,variables:[{name:`name`,type:`string`,required:!0},{name:`appName`,type:`string`,default:`ContractSpec`},{name:`actionUrl`,type:`url`}],defaultChannels:[`EMAIL`,`IN_APP`],channels:{email:{subject:`Welcome to {{appName}}, {{name}}!`,body:`
1
+ //#region src/templates/index.ts
2
+ /**
3
+ * Define a notification template.
4
+ */
5
+ function defineTemplate(def) {
6
+ return def;
7
+ }
8
+ /**
9
+ * Render a template with variables.
10
+ */
11
+ function renderTemplate(content, variables) {
12
+ return content.replace(/\{\{(\w+)\}\}/g, (match, key) => {
13
+ const value = variables[key];
14
+ if (value === void 0 || value === null) return match;
15
+ return String(value);
16
+ });
17
+ }
18
+ /**
19
+ * Render a notification template for a specific channel.
20
+ */
21
+ function renderNotificationTemplate(template, channel, variables) {
22
+ const channelContent = template.channels[channel];
23
+ if (!channelContent) return null;
24
+ const title = channelContent.title ? renderTemplate(channelContent.title, variables) : template.name;
25
+ const body = renderTemplate(channelContent.body, variables);
26
+ const result = {
27
+ title,
28
+ body,
29
+ actionUrl: channelContent.actionUrl ? renderTemplate(channelContent.actionUrl, variables) : void 0
30
+ };
31
+ if (channel === "email" && channelContent.subject) result.email = {
32
+ subject: renderTemplate(channelContent.subject, variables),
33
+ html: body,
34
+ text: stripHtml(body)
35
+ };
36
+ return result;
37
+ }
38
+ /**
39
+ * Strip HTML tags from content (for plain text).
40
+ */
41
+ function stripHtml(html) {
42
+ return html.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
43
+ }
44
+ /**
45
+ * Template registry for managing templates.
46
+ */
47
+ var TemplateRegistry = class {
48
+ templates = /* @__PURE__ */ new Map();
49
+ register(template) {
50
+ this.templates.set(template.id, template);
51
+ }
52
+ get(templateId) {
53
+ return this.templates.get(templateId);
54
+ }
55
+ getAll() {
56
+ return Array.from(this.templates.values());
57
+ }
58
+ getByCategory(category) {
59
+ return this.getAll().filter((t) => t.category === category);
60
+ }
61
+ };
62
+ /**
63
+ * Create a template registry.
64
+ */
65
+ function createTemplateRegistry() {
66
+ return new TemplateRegistry();
67
+ }
68
+ /**
69
+ * Welcome email template.
70
+ */
71
+ const WelcomeTemplate = defineTemplate({
72
+ id: "welcome",
73
+ name: "Welcome",
74
+ description: "Sent when a user signs up.",
75
+ category: "onboarding",
76
+ variables: [
77
+ {
78
+ name: "name",
79
+ type: "string",
80
+ required: true
81
+ },
82
+ {
83
+ name: "appName",
84
+ type: "string",
85
+ default: "ContractSpec"
86
+ },
87
+ {
88
+ name: "actionUrl",
89
+ type: "url"
90
+ }
91
+ ],
92
+ defaultChannels: ["EMAIL", "IN_APP"],
93
+ channels: {
94
+ email: {
95
+ subject: "Welcome to {{appName}}, {{name}}!",
96
+ body: `
2
97
  <h1>Welcome, {{name}}!</h1>
3
98
  <p>Thanks for joining {{appName}}. We're excited to have you on board.</p>
4
99
  <p><a href="{{actionUrl}}">Get started now</a></p>
5
- `},inApp:{title:`Welcome to {{appName}}!`,body:`Thanks for joining. Click to complete your profile.`,actionUrl:`{{actionUrl}}`}}}),s=e({id:`org-invite`,name:`Organization Invitation`,description:`Sent when a user is invited to an organization.`,category:`organization`,variables:[{name:`inviterName`,type:`string`,required:!0},{name:`orgName`,type:`string`,required:!0},{name:`role`,type:`string`,default:`member`},{name:`actionUrl`,type:`url`,required:!0}],defaultChannels:[`EMAIL`],channels:{email:{subject:`{{inviterName}} invited you to join {{orgName}}`,body:`
100
+ `
101
+ },
102
+ inApp: {
103
+ title: "Welcome to {{appName}}!",
104
+ body: "Thanks for joining. Click to complete your profile.",
105
+ actionUrl: "{{actionUrl}}"
106
+ }
107
+ }
108
+ });
109
+ /**
110
+ * Organization invite template.
111
+ */
112
+ const OrgInviteTemplate = defineTemplate({
113
+ id: "org-invite",
114
+ name: "Organization Invitation",
115
+ description: "Sent when a user is invited to an organization.",
116
+ category: "organization",
117
+ variables: [
118
+ {
119
+ name: "inviterName",
120
+ type: "string",
121
+ required: true
122
+ },
123
+ {
124
+ name: "orgName",
125
+ type: "string",
126
+ required: true
127
+ },
128
+ {
129
+ name: "role",
130
+ type: "string",
131
+ default: "member"
132
+ },
133
+ {
134
+ name: "actionUrl",
135
+ type: "url",
136
+ required: true
137
+ }
138
+ ],
139
+ defaultChannels: ["EMAIL"],
140
+ channels: {
141
+ email: {
142
+ subject: "{{inviterName}} invited you to join {{orgName}}",
143
+ body: `
6
144
  <h1>You've been invited!</h1>
7
145
  <p>{{inviterName}} has invited you to join <strong>{{orgName}}</strong> as a {{role}}.</p>
8
146
  <p><a href="{{actionUrl}}">Accept invitation</a></p>
9
- `},inApp:{title:`Invitation to {{orgName}}`,body:`{{inviterName}} invited you to join as {{role}}.`,actionUrl:`{{actionUrl}}`,actionText:`Accept`}}}),c=e({id:`mention`,name:`Mention`,description:`Sent when a user is mentioned.`,category:`social`,variables:[{name:`mentionerName`,type:`string`,required:!0},{name:`context`,type:`string`,required:!0},{name:`preview`,type:`string`},{name:`actionUrl`,type:`url`,required:!0}],defaultChannels:[`IN_APP`,`PUSH`],channels:{inApp:{title:`{{mentionerName}} mentioned you`,body:`In {{context}}: "{{preview}}"`,actionUrl:`{{actionUrl}}`},push:{title:`{{mentionerName}} mentioned you`,body:`{{preview}}`}}});export{c as MentionTemplate,s as OrgInviteTemplate,i as TemplateRegistry,o as WelcomeTemplate,a as createTemplateRegistry,e as defineTemplate,n as renderNotificationTemplate,t as renderTemplate};
147
+ `
148
+ },
149
+ inApp: {
150
+ title: "Invitation to {{orgName}}",
151
+ body: "{{inviterName}} invited you to join as {{role}}.",
152
+ actionUrl: "{{actionUrl}}",
153
+ actionText: "Accept"
154
+ }
155
+ }
156
+ });
157
+ /**
158
+ * Mention template.
159
+ */
160
+ const MentionTemplate = defineTemplate({
161
+ id: "mention",
162
+ name: "Mention",
163
+ description: "Sent when a user is mentioned.",
164
+ category: "social",
165
+ variables: [
166
+ {
167
+ name: "mentionerName",
168
+ type: "string",
169
+ required: true
170
+ },
171
+ {
172
+ name: "context",
173
+ type: "string",
174
+ required: true
175
+ },
176
+ {
177
+ name: "preview",
178
+ type: "string"
179
+ },
180
+ {
181
+ name: "actionUrl",
182
+ type: "url",
183
+ required: true
184
+ }
185
+ ],
186
+ defaultChannels: ["IN_APP", "PUSH"],
187
+ channels: {
188
+ inApp: {
189
+ title: "{{mentionerName}} mentioned you",
190
+ body: "In {{context}}: \"{{preview}}\"",
191
+ actionUrl: "{{actionUrl}}"
192
+ },
193
+ push: {
194
+ title: "{{mentionerName}} mentioned you",
195
+ body: "{{preview}}"
196
+ }
197
+ }
198
+ });
199
+
200
+ //#endregion
201
+ export { MentionTemplate, OrgInviteTemplate, TemplateRegistry, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/module.notifications",
3
- "version": "0.0.0-canary-20251217063201",
3
+ "version": "0.0.0-canary-20251217072406",
4
4
  "description": "Notification center module for ContractSpec applications",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,14 +18,14 @@
18
18
  "lint:check": "eslint src"
19
19
  },
20
20
  "dependencies": {
21
- "@lssm/lib.schema": "0.0.0-canary-20251217063201",
22
- "@lssm/lib.contracts": "0.0.0-canary-20251217063201",
23
- "@lssm/lib.bus": "0.0.0-canary-20251217063201",
21
+ "@lssm/lib.schema": "0.0.0-canary-20251217072406",
22
+ "@lssm/lib.contracts": "0.0.0-canary-20251217072406",
23
+ "@lssm/lib.bus": "0.0.0-canary-20251217072406",
24
24
  "zod": "^4.1.13"
25
25
  },
26
26
  "devDependencies": {
27
- "@lssm/tool.typescript": "0.0.0-canary-20251217063201",
28
- "@lssm/tool.tsdown": "0.0.0-canary-20251217063201",
27
+ "@lssm/tool.typescript": "0.0.0-canary-20251217072406",
28
+ "@lssm/tool.tsdown": "0.0.0-canary-20251217072406",
29
29
  "typescript": "^5.9.3"
30
30
  },
31
31
  "exports": {