@lssm/module.notifications 0.0.0-canary-20251217080011 → 1.41.0

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 (134) hide show
  1. package/dist/channels/index.js +1 -126
  2. package/dist/contracts/index.js +1 -436
  3. package/dist/entities/index.js +1 -254
  4. package/dist/index.js +1 -7
  5. package/dist/notifications.feature.js +1 -68
  6. package/dist/templates/index.js +3 -195
  7. package/package.json +12 -13
  8. package/dist/channels/index.d.ts +0 -106
  9. package/dist/contracts/index.d.ts +0 -637
  10. package/dist/entities/index.d.ts +0 -182
  11. package/dist/index.d.ts +0 -6
  12. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
  13. package/dist/libs/contracts/dist/client/index.js +0 -5
  14. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
  15. package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
  16. package/dist/libs/contracts/dist/client/react/index.js +0 -4
  17. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  18. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
  19. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  20. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  21. package/dist/libs/contracts/dist/docs/index.js +0 -29
  22. package/dist/libs/contracts/dist/docs/presentations.js +0 -71
  23. package/dist/libs/contracts/dist/docs/registry.js +0 -44
  24. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  25. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  26. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  27. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  28. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  29. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  30. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  31. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  32. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  33. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  34. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  35. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  36. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  37. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  38. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  39. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  40. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  41. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  42. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  43. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  44. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  45. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  46. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  47. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  48. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  49. package/dist/libs/contracts/dist/events.js +0 -1
  50. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  51. package/dist/libs/contracts/dist/index.js +0 -71
  52. package/dist/libs/contracts/dist/install.js +0 -2
  53. package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
  54. package/dist/libs/contracts/dist/integrations/index.js +0 -18
  55. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  56. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  57. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  58. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  59. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
  60. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  61. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  62. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  63. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
  64. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
  65. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
  66. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
  67. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
  68. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
  69. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
  70. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
  71. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
  72. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  73. package/dist/libs/contracts/dist/jsonschema.js +0 -1
  74. package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
  75. package/dist/libs/contracts/dist/knowledge/index.js +0 -7
  76. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  77. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  78. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  79. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
  80. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  81. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  82. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  83. package/dist/libs/contracts/dist/llm/exporters.js +0 -19
  84. package/dist/libs/contracts/dist/llm/index.js +0 -2
  85. package/dist/libs/contracts/dist/llm/prompts.js +0 -1
  86. package/dist/libs/contracts/dist/onboarding-base.js +0 -196
  87. package/dist/libs/contracts/dist/openapi.js +0 -1
  88. package/dist/libs/contracts/dist/ownership.js +0 -21
  89. package/dist/libs/contracts/dist/presentations.js +0 -1
  90. package/dist/libs/contracts/dist/presentations.v2.js +0 -11
  91. package/dist/libs/contracts/dist/prompt.js +0 -1
  92. package/dist/libs/contracts/dist/promptRegistry.js +0 -1
  93. package/dist/libs/contracts/dist/regenerator/index.js +0 -1
  94. package/dist/libs/contracts/dist/regenerator/service.js +0 -6
  95. package/dist/libs/contracts/dist/registry.js +0 -2
  96. package/dist/libs/contracts/dist/resources.js +0 -1
  97. package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
  98. package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
  99. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  100. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -39
  101. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  102. package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
  103. package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
  104. package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
  105. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
  106. package/dist/libs/contracts/dist/server/index.js +0 -8
  107. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
  108. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
  109. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  110. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
  111. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  112. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  113. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  114. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  115. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  116. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  117. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  118. package/dist/libs/contracts/dist/spec.js +0 -34
  119. package/dist/libs/contracts/dist/telemetry/index.js +0 -1
  120. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  121. package/dist/libs/contracts/dist/tests/index.js +0 -1
  122. package/dist/libs/contracts/dist/tests/runner.js +0 -2
  123. package/dist/libs/contracts/dist/workflow/index.js +0 -1
  124. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  125. package/dist/libs/schema/dist/EnumType.js +0 -56
  126. package/dist/libs/schema/dist/FieldType.js +0 -49
  127. package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
  128. package/dist/libs/schema/dist/SchemaModel.js +0 -3
  129. package/dist/libs/schema/dist/entity/defineEntity.js +0 -236
  130. package/dist/libs/schema/dist/entity/index.js +0 -2
  131. package/dist/libs/schema/dist/entity/types.js +0 -1
  132. package/dist/libs/schema/dist/index.js +0 -6
  133. package/dist/notifications.feature.d.ts +0 -11
  134. package/dist/templates/index.d.ts +0 -91
@@ -1,126 +1 @@
1
- //#region src/channels/index.ts
2
- /**
3
- * In-app notification channel (stores in database).
4
- */
5
- var InAppChannel = class {
6
- channelId = "IN_APP";
7
- async send(notification) {
8
- return {
9
- success: true,
10
- responseMessage: "Stored in database"
11
- };
12
- }
13
- async isAvailable() {
14
- return true;
15
- }
16
- };
17
- /**
18
- * Console channel for development/testing.
19
- */
20
- var ConsoleChannel = class {
21
- channelId = "CONSOLE";
22
- async send(notification) {
23
- console.log(`📬 [${notification.id}] ${notification.title}`);
24
- console.log(` ${notification.body}`);
25
- if (notification.actionUrl) console.log(` Action: ${notification.actionUrl}`);
26
- return {
27
- success: true,
28
- responseMessage: "Logged to console"
29
- };
30
- }
31
- async isAvailable() {
32
- return true;
33
- }
34
- };
35
- /**
36
- * Email channel interface (to be implemented with provider).
37
- */
38
- var EmailChannel = class {
39
- channelId = "EMAIL";
40
- async isAvailable() {
41
- return true;
42
- }
43
- };
44
- /**
45
- * Push notification channel interface (to be implemented with provider).
46
- */
47
- var PushChannel = class {
48
- channelId = "PUSH";
49
- async isAvailable() {
50
- return true;
51
- }
52
- };
53
- /**
54
- * Webhook channel for external integrations.
55
- */
56
- var WebhookChannel = class {
57
- channelId = "WEBHOOK";
58
- async send(notification) {
59
- if (!notification.webhook?.url) return {
60
- success: false,
61
- responseMessage: "No webhook URL configured"
62
- };
63
- try {
64
- const response = await fetch(notification.webhook.url, {
65
- method: "POST",
66
- headers: {
67
- "Content-Type": "application/json",
68
- ...notification.webhook.headers
69
- },
70
- body: JSON.stringify({
71
- id: notification.id,
72
- title: notification.title,
73
- body: notification.body,
74
- actionUrl: notification.actionUrl,
75
- metadata: notification.metadata
76
- })
77
- });
78
- return {
79
- success: response.ok,
80
- responseCode: String(response.status),
81
- responseMessage: response.statusText
82
- };
83
- } catch (error) {
84
- return {
85
- success: false,
86
- responseMessage: error instanceof Error ? error.message : "Unknown error"
87
- };
88
- }
89
- }
90
- async isAvailable() {
91
- return true;
92
- }
93
- };
94
- /**
95
- * Channel registry for managing available channels.
96
- */
97
- var ChannelRegistry = class {
98
- channels = /* @__PURE__ */ new Map();
99
- register(channel) {
100
- this.channels.set(channel.channelId, channel);
101
- }
102
- get(channelId) {
103
- return this.channels.get(channelId);
104
- }
105
- getAll() {
106
- return Array.from(this.channels.values());
107
- }
108
- async getAvailable() {
109
- const available = [];
110
- for (const channel of this.channels.values()) if (await channel.isAvailable()) available.push(channel);
111
- return available;
112
- }
113
- };
114
- /**
115
- * Create a default channel registry with standard channels.
116
- */
117
- function createChannelRegistry() {
118
- const registry = new ChannelRegistry();
119
- registry.register(new InAppChannel());
120
- registry.register(new ConsoleChannel());
121
- registry.register(new WebhookChannel());
122
- return registry;
123
- }
124
-
125
- //#endregion
126
- export { ChannelRegistry, ConsoleChannel, EmailChannel, InAppChannel, PushChannel, WebhookChannel, createChannelRegistry };
1
+ var e=class{channelId=`IN_APP`;async send(e){return{success:!0,responseMessage:`Stored in database`}}async isAvailable(){return!0}},t=class{channelId=`CONSOLE`;async send(e){return console.log(`📬 [${e.id}] ${e.title}`),console.log(` ${e.body}`),e.actionUrl&&console.log(` Action: ${e.actionUrl}`),{success:!0,responseMessage:`Logged to console`}}async isAvailable(){return!0}},n=class{channelId=`EMAIL`;async isAvailable(){return!0}},r=class{channelId=`PUSH`;async isAvailable(){return!0}},i=class{channelId=`WEBHOOK`;async send(e){if(!e.webhook?.url)return{success:!1,responseMessage:`No webhook URL configured`};try{let t=await fetch(e.webhook.url,{method:`POST`,headers:{"Content-Type":`application/json`,...e.webhook.headers},body:JSON.stringify({id:e.id,title:e.title,body:e.body,actionUrl:e.actionUrl,metadata:e.metadata})});return{success:t.ok,responseCode:String(t.status),responseMessage:t.statusText}}catch(e){return{success:!1,responseMessage:e instanceof Error?e.message:`Unknown error`}}}async isAvailable(){return!0}},a=class{channels=new Map;register(e){this.channels.set(e.channelId,e)}get(e){return this.channels.get(e)}getAll(){return Array.from(this.channels.values())}async getAvailable(){let e=[];for(let t of this.channels.values())await t.isAvailable()&&e.push(t);return e}};function o(){let n=new a;return n.register(new e),n.register(new t),n.register(new i),n}export{a as ChannelRegistry,t as ConsoleChannel,n as EmailChannel,e as InAppChannel,r as PushChannel,i as WebhookChannel,o as createChannelRegistry};
@@ -1,436 +1 @@
1
- import { defineEnum } from "../libs/schema/dist/EnumType.js";
2
- import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
3
- import "../libs/schema/dist/index.js";
4
- import { defineSchemaModel } from "../libs/contracts/dist/schema/dist/SchemaModel.js";
5
- import { defineCommand, defineQuery } from "../libs/contracts/dist/spec.js";
6
- import "../libs/contracts/dist/index.js";
7
-
8
- //#region src/contracts/index.ts
9
- const OWNERS = ["platform.notifications"];
10
- const NotificationStatusSchemaEnum = defineEnum("NotificationStatus", [
11
- "PENDING",
12
- "SENT",
13
- "DELIVERED",
14
- "READ",
15
- "FAILED",
16
- "CANCELLED"
17
- ]);
18
- const NotificationChannelSchemaEnum = defineEnum("NotificationChannel", [
19
- "EMAIL",
20
- "IN_APP",
21
- "PUSH",
22
- "WEBHOOK"
23
- ]);
24
- const NotificationFilterEnum = defineEnum("NotificationFilter", [
25
- "unread",
26
- "read",
27
- "all"
28
- ]);
29
- const NotificationModel = defineSchemaModel({
30
- name: "Notification",
31
- description: "A notification sent to a user",
32
- fields: {
33
- id: {
34
- type: ScalarTypeEnum.String_unsecure(),
35
- isOptional: false
36
- },
37
- userId: {
38
- type: ScalarTypeEnum.String_unsecure(),
39
- isOptional: false
40
- },
41
- title: {
42
- type: ScalarTypeEnum.String_unsecure(),
43
- isOptional: false
44
- },
45
- body: {
46
- type: ScalarTypeEnum.String_unsecure(),
47
- isOptional: false
48
- },
49
- type: {
50
- type: ScalarTypeEnum.String_unsecure(),
51
- isOptional: false
52
- },
53
- status: {
54
- type: NotificationStatusSchemaEnum,
55
- isOptional: false
56
- },
57
- channels: {
58
- type: NotificationChannelSchemaEnum,
59
- isArray: true,
60
- isOptional: false
61
- },
62
- actionUrl: {
63
- type: ScalarTypeEnum.URL(),
64
- isOptional: true
65
- },
66
- readAt: {
67
- type: ScalarTypeEnum.DateTime(),
68
- isOptional: true
69
- },
70
- createdAt: {
71
- type: ScalarTypeEnum.DateTime(),
72
- isOptional: false
73
- }
74
- }
75
- });
76
- const NotificationPreferenceModel = defineSchemaModel({
77
- name: "NotificationPreference",
78
- description: "User notification preferences",
79
- fields: {
80
- userId: {
81
- type: ScalarTypeEnum.String_unsecure(),
82
- isOptional: false
83
- },
84
- globalEnabled: {
85
- type: ScalarTypeEnum.Boolean(),
86
- isOptional: false
87
- },
88
- channelPreferences: {
89
- type: ScalarTypeEnum.JSONObject(),
90
- isOptional: false
91
- },
92
- typePreferences: {
93
- type: ScalarTypeEnum.JSONObject(),
94
- isOptional: false
95
- },
96
- quietHoursStart: {
97
- type: ScalarTypeEnum.String_unsecure(),
98
- isOptional: true
99
- },
100
- quietHoursEnd: {
101
- type: ScalarTypeEnum.String_unsecure(),
102
- isOptional: true
103
- },
104
- timezone: {
105
- type: ScalarTypeEnum.String_unsecure(),
106
- isOptional: false
107
- },
108
- digestEnabled: {
109
- type: ScalarTypeEnum.Boolean(),
110
- isOptional: false
111
- },
112
- digestFrequency: {
113
- type: ScalarTypeEnum.String_unsecure(),
114
- isOptional: true
115
- }
116
- }
117
- });
118
- const SendNotificationInputModel = defineSchemaModel({
119
- name: "SendNotificationInput",
120
- description: "Input for sending a notification",
121
- fields: {
122
- userId: {
123
- type: ScalarTypeEnum.String_unsecure(),
124
- isOptional: false
125
- },
126
- templateId: {
127
- type: ScalarTypeEnum.String_unsecure(),
128
- isOptional: true
129
- },
130
- title: {
131
- type: ScalarTypeEnum.String_unsecure(),
132
- isOptional: true
133
- },
134
- body: {
135
- type: ScalarTypeEnum.String_unsecure(),
136
- isOptional: true
137
- },
138
- type: {
139
- type: ScalarTypeEnum.String_unsecure(),
140
- isOptional: false
141
- },
142
- channels: {
143
- type: NotificationChannelSchemaEnum,
144
- isArray: true,
145
- isOptional: true
146
- },
147
- actionUrl: {
148
- type: ScalarTypeEnum.URL(),
149
- isOptional: true
150
- },
151
- variables: {
152
- type: ScalarTypeEnum.JSONObject(),
153
- isOptional: true
154
- },
155
- metadata: {
156
- type: ScalarTypeEnum.JSONObject(),
157
- isOptional: true
158
- }
159
- }
160
- });
161
- const ListNotificationsInputModel = defineSchemaModel({
162
- name: "ListNotificationsInput",
163
- description: "Input for listing notifications",
164
- fields: {
165
- status: {
166
- type: NotificationFilterEnum,
167
- isOptional: true
168
- },
169
- type: {
170
- type: ScalarTypeEnum.String_unsecure(),
171
- isOptional: true
172
- },
173
- limit: {
174
- type: ScalarTypeEnum.Int_unsecure(),
175
- isOptional: true,
176
- defaultValue: 20
177
- },
178
- offset: {
179
- type: ScalarTypeEnum.Int_unsecure(),
180
- isOptional: true,
181
- defaultValue: 0
182
- }
183
- }
184
- });
185
- const ListNotificationsOutputModel = defineSchemaModel({
186
- name: "ListNotificationsOutput",
187
- description: "Output for listing notifications",
188
- fields: {
189
- notifications: {
190
- type: NotificationModel,
191
- isArray: true,
192
- isOptional: false
193
- },
194
- total: {
195
- type: ScalarTypeEnum.Int_unsecure(),
196
- isOptional: false
197
- },
198
- unreadCount: {
199
- type: ScalarTypeEnum.Int_unsecure(),
200
- isOptional: false
201
- }
202
- }
203
- });
204
- const UpdatePreferencesInputModel = defineSchemaModel({
205
- name: "UpdateNotificationPreferencesInput",
206
- description: "Input for updating notification preferences",
207
- fields: {
208
- globalEnabled: {
209
- type: ScalarTypeEnum.Boolean(),
210
- isOptional: true
211
- },
212
- channelPreferences: {
213
- type: ScalarTypeEnum.JSONObject(),
214
- isOptional: true
215
- },
216
- typePreferences: {
217
- type: ScalarTypeEnum.JSONObject(),
218
- isOptional: true
219
- },
220
- quietHoursStart: {
221
- type: ScalarTypeEnum.String_unsecure(),
222
- isOptional: true
223
- },
224
- quietHoursEnd: {
225
- type: ScalarTypeEnum.String_unsecure(),
226
- isOptional: true
227
- },
228
- timezone: {
229
- type: ScalarTypeEnum.String_unsecure(),
230
- isOptional: true
231
- },
232
- digestEnabled: {
233
- type: ScalarTypeEnum.Boolean(),
234
- isOptional: true
235
- },
236
- digestFrequency: {
237
- type: ScalarTypeEnum.String_unsecure(),
238
- isOptional: true
239
- }
240
- }
241
- });
242
- /**
243
- * Send a notification.
244
- */
245
- const SendNotificationContract = defineCommand({
246
- meta: {
247
- name: "notifications.send",
248
- version: 1,
249
- stability: "stable",
250
- owners: [...OWNERS],
251
- tags: ["notifications", "send"],
252
- description: "Send a notification to a user.",
253
- goal: "Deliver notifications across multiple channels.",
254
- context: "Called by services when events require user notification."
255
- },
256
- io: {
257
- input: SendNotificationInputModel,
258
- output: NotificationModel,
259
- errors: {
260
- USER_NOT_FOUND: {
261
- description: "Target user does not exist",
262
- http: 404,
263
- gqlCode: "USER_NOT_FOUND",
264
- when: "User ID is invalid"
265
- },
266
- TEMPLATE_NOT_FOUND: {
267
- description: "Notification template does not exist",
268
- http: 404,
269
- gqlCode: "TEMPLATE_NOT_FOUND",
270
- when: "Template ID is invalid"
271
- }
272
- }
273
- },
274
- policy: { auth: "user" },
275
- sideEffects: { emits: [{
276
- name: "notification.sent",
277
- version: 1,
278
- when: "Notification is sent",
279
- payload: NotificationModel
280
- }] }
281
- });
282
- /**
283
- * List notifications for current user.
284
- */
285
- const ListNotificationsContract = defineQuery({
286
- meta: {
287
- name: "notifications.list",
288
- version: 1,
289
- stability: "stable",
290
- owners: [...OWNERS],
291
- tags: ["notifications", "list"],
292
- description: "List notifications for the current user.",
293
- goal: "Show user their notifications.",
294
- context: "Notification center UI."
295
- },
296
- io: {
297
- input: ListNotificationsInputModel,
298
- output: ListNotificationsOutputModel
299
- },
300
- policy: { auth: "user" }
301
- });
302
- /**
303
- * Mark notification as read.
304
- */
305
- const MarkNotificationReadContract = defineCommand({
306
- meta: {
307
- name: "notifications.markRead",
308
- version: 1,
309
- stability: "stable",
310
- owners: [...OWNERS],
311
- tags: ["notifications", "read"],
312
- description: "Mark a notification as read.",
313
- goal: "Track which notifications user has seen.",
314
- context: "User clicks on a notification."
315
- },
316
- io: {
317
- input: defineSchemaModel({
318
- name: "MarkNotificationReadInput",
319
- fields: { notificationId: {
320
- type: ScalarTypeEnum.String_unsecure(),
321
- isOptional: false
322
- } }
323
- }),
324
- output: NotificationModel
325
- },
326
- policy: { auth: "user" }
327
- });
328
- /**
329
- * Mark all notifications as read.
330
- */
331
- const MarkAllNotificationsReadContract = defineCommand({
332
- meta: {
333
- name: "notifications.markAllRead",
334
- version: 1,
335
- stability: "stable",
336
- owners: [...OWNERS],
337
- tags: ["notifications", "read"],
338
- description: "Mark all notifications as read.",
339
- goal: "Clear notification badge.",
340
- context: "User clicks \"mark all as read\"."
341
- },
342
- io: {
343
- input: null,
344
- output: defineSchemaModel({
345
- name: "MarkAllNotificationsReadOutput",
346
- fields: { markedCount: {
347
- type: ScalarTypeEnum.Int_unsecure(),
348
- isOptional: false
349
- } }
350
- })
351
- },
352
- policy: { auth: "user" }
353
- });
354
- /**
355
- * Get notification preferences.
356
- */
357
- const GetNotificationPreferencesContract = defineQuery({
358
- meta: {
359
- name: "notifications.preferences.get",
360
- version: 1,
361
- stability: "stable",
362
- owners: [...OWNERS],
363
- tags: [
364
- "notifications",
365
- "preferences",
366
- "get"
367
- ],
368
- description: "Get notification preferences for current user.",
369
- goal: "Show user their notification settings.",
370
- context: "Notification settings page."
371
- },
372
- io: {
373
- input: null,
374
- output: NotificationPreferenceModel
375
- },
376
- policy: { auth: "user" }
377
- });
378
- /**
379
- * Update notification preferences.
380
- */
381
- const UpdateNotificationPreferencesContract = defineCommand({
382
- meta: {
383
- name: "notifications.preferences.update",
384
- version: 1,
385
- stability: "stable",
386
- owners: [...OWNERS],
387
- tags: [
388
- "notifications",
389
- "preferences",
390
- "update"
391
- ],
392
- description: "Update notification preferences.",
393
- goal: "Allow user to control notification delivery.",
394
- context: "Notification settings page."
395
- },
396
- io: {
397
- input: UpdatePreferencesInputModel,
398
- output: NotificationPreferenceModel
399
- },
400
- policy: { auth: "user" }
401
- });
402
- /**
403
- * Delete a notification.
404
- */
405
- const DeleteNotificationContract = defineCommand({
406
- meta: {
407
- name: "notifications.delete",
408
- version: 1,
409
- stability: "stable",
410
- owners: [...OWNERS],
411
- tags: ["notifications", "delete"],
412
- description: "Delete a notification.",
413
- goal: "Allow user to remove unwanted notifications.",
414
- context: "User dismisses a notification."
415
- },
416
- io: {
417
- input: defineSchemaModel({
418
- name: "DeleteNotificationInput",
419
- fields: { notificationId: {
420
- type: ScalarTypeEnum.String_unsecure(),
421
- isOptional: false
422
- } }
423
- }),
424
- output: defineSchemaModel({
425
- name: "DeleteNotificationOutput",
426
- fields: { success: {
427
- type: ScalarTypeEnum.Boolean(),
428
- isOptional: false
429
- } }
430
- })
431
- },
432
- policy: { auth: "user" }
433
- });
434
-
435
- //#endregion
436
- export { DeleteNotificationContract, GetNotificationPreferencesContract, ListNotificationsContract, ListNotificationsInputModel, ListNotificationsOutputModel, MarkAllNotificationsReadContract, MarkNotificationReadContract, NotificationFilterEnum, NotificationModel, NotificationPreferenceModel, SendNotificationContract, SendNotificationInputModel, UpdateNotificationPreferencesContract, UpdatePreferencesInputModel };
1
+ import{ScalarTypeEnum as e,defineEnum as t}from"@lssm/lib.schema";import{defineCommand as n,defineQuery as r,defineSchemaModel as i}from"@lssm/lib.contracts";const a=[`platform.notifications`],o=t(`NotificationStatus`,[`PENDING`,`SENT`,`DELIVERED`,`READ`,`FAILED`,`CANCELLED`]),s=t(`NotificationChannel`,[`EMAIL`,`IN_APP`,`PUSH`,`WEBHOOK`]),c=t(`NotificationFilter`,[`unread`,`read`,`all`]),l=i({name:`Notification`,description:`A notification sent to a user`,fields:{id:{type:e.String_unsecure(),isOptional:!1},userId:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},body:{type:e.String_unsecure(),isOptional:!1},type:{type:e.String_unsecure(),isOptional:!1},status:{type:o,isOptional:!1},channels:{type:s,isArray:!0,isOptional:!1},actionUrl:{type:e.URL(),isOptional:!0},readAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),u=i({name:`NotificationPreference`,description:`User notification preferences`,fields:{userId:{type:e.String_unsecure(),isOptional:!1},globalEnabled:{type:e.Boolean(),isOptional:!1},channelPreferences:{type:e.JSONObject(),isOptional:!1},typePreferences:{type:e.JSONObject(),isOptional:!1},quietHoursStart:{type:e.String_unsecure(),isOptional:!0},quietHoursEnd:{type:e.String_unsecure(),isOptional:!0},timezone:{type:e.String_unsecure(),isOptional:!1},digestEnabled:{type:e.Boolean(),isOptional:!1},digestFrequency:{type:e.String_unsecure(),isOptional:!0}}}),d=i({name:`SendNotificationInput`,description:`Input for sending a notification`,fields:{userId:{type:e.String_unsecure(),isOptional:!1},templateId:{type:e.String_unsecure(),isOptional:!0},title:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!0},type:{type:e.String_unsecure(),isOptional:!1},channels:{type:s,isArray:!0,isOptional:!0},actionUrl:{type:e.URL(),isOptional:!0},variables:{type:e.JSONObject(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0}}}),f=i({name:`ListNotificationsInput`,description:`Input for listing notifications`,fields:{status:{type:c,isOptional:!0},type:{type:e.String_unsecure(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:e.Int_unsecure(),isOptional:!0,defaultValue:0}}}),p=i({name:`ListNotificationsOutput`,description:`Output for listing notifications`,fields:{notifications:{type:l,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1},unreadCount:{type:e.Int_unsecure(),isOptional:!1}}}),m=i({name:`UpdateNotificationPreferencesInput`,description:`Input for updating notification preferences`,fields:{globalEnabled:{type:e.Boolean(),isOptional:!0},channelPreferences:{type:e.JSONObject(),isOptional:!0},typePreferences:{type:e.JSONObject(),isOptional:!0},quietHoursStart:{type:e.String_unsecure(),isOptional:!0},quietHoursEnd:{type:e.String_unsecure(),isOptional:!0},timezone:{type:e.String_unsecure(),isOptional:!0},digestEnabled:{type:e.Boolean(),isOptional:!0},digestFrequency:{type:e.String_unsecure(),isOptional:!0}}}),h=n({meta:{name:`notifications.send`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`send`],description:`Send a notification to a user.`,goal:`Deliver notifications across multiple channels.`,context:`Called by services when events require user notification.`},io:{input:d,output:l,errors:{USER_NOT_FOUND:{description:`Target user does not exist`,http:404,gqlCode:`USER_NOT_FOUND`,when:`User ID is invalid`},TEMPLATE_NOT_FOUND:{description:`Notification template does not exist`,http:404,gqlCode:`TEMPLATE_NOT_FOUND`,when:`Template ID is invalid`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`notification.sent`,version:1,when:`Notification is sent`,payload:l}]}}),g=r({meta:{name:`notifications.list`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`list`],description:`List notifications for the current user.`,goal:`Show user their notifications.`,context:`Notification center UI.`},io:{input:f,output:p},policy:{auth:`user`}}),_=n({meta:{name:`notifications.markRead`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`read`],description:`Mark a notification as read.`,goal:`Track which notifications user has seen.`,context:`User clicks on a notification.`},io:{input:i({name:`MarkNotificationReadInput`,fields:{notificationId:{type:e.String_unsecure(),isOptional:!1}}}),output:l},policy:{auth:`user`}}),v=n({meta:{name:`notifications.markAllRead`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`read`],description:`Mark all notifications as read.`,goal:`Clear notification badge.`,context:`User clicks "mark all as read".`},io:{input:null,output:i({name:`MarkAllNotificationsReadOutput`,fields:{markedCount:{type:e.Int_unsecure(),isOptional:!1}}})},policy:{auth:`user`}}),y=r({meta:{name:`notifications.preferences.get`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`preferences`,`get`],description:`Get notification preferences for current user.`,goal:`Show user their notification settings.`,context:`Notification settings page.`},io:{input:null,output:u},policy:{auth:`user`}}),b=n({meta:{name:`notifications.preferences.update`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`preferences`,`update`],description:`Update notification preferences.`,goal:`Allow user to control notification delivery.`,context:`Notification settings page.`},io:{input:m,output:u},policy:{auth:`user`}}),x=n({meta:{name:`notifications.delete`,version:1,stability:`stable`,owners:[...a],tags:[`notifications`,`delete`],description:`Delete a notification.`,goal:`Allow user to remove unwanted notifications.`,context:`User dismisses a notification.`},io:{input:i({name:`DeleteNotificationInput`,fields:{notificationId:{type:e.String_unsecure(),isOptional:!1}}}),output:i({name:`DeleteNotificationOutput`,fields:{success:{type:e.Boolean(),isOptional:!1}}})},policy:{auth:`user`}});export{x as DeleteNotificationContract,y as GetNotificationPreferencesContract,g as ListNotificationsContract,f as ListNotificationsInputModel,p as ListNotificationsOutputModel,v as MarkAllNotificationsReadContract,_ as MarkNotificationReadContract,c as NotificationFilterEnum,l as NotificationModel,u as NotificationPreferenceModel,h as SendNotificationContract,d as SendNotificationInputModel,b as UpdateNotificationPreferencesContract,m as UpdatePreferencesInputModel};