captify 0.1.19 → 1.1.1
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/agents/components/agents-list-header.d.ts.map +1 -1
- package/dist/agents/components/agents-list-header.js +3 -2
- package/dist/agents/components/agents-list-header.js.map +1 -1
- package/dist/chat/components/chat-content-approval.d.ts.map +1 -1
- package/dist/chat/components/chat-content-approval.js.map +1 -1
- package/dist/chat/components/chat-context-toggle.d.ts.map +1 -1
- package/dist/chat/components/chat-context-toggle.js +2 -4
- package/dist/chat/components/chat-context-toggle.js.map +1 -1
- package/dist/comments/comments.constants.d.ts +8 -1
- package/dist/comments/comments.constants.d.ts.map +1 -1
- package/dist/comments/comments.constants.js +18 -0
- package/dist/comments/comments.constants.js.map +1 -1
- package/dist/comments/comments.interfaces.d.ts +5 -0
- package/dist/comments/comments.interfaces.d.ts.map +1 -1
- package/dist/comments/comments.utilities.d.ts +30 -1
- package/dist/comments/comments.utilities.d.ts.map +1 -1
- package/dist/comments/comments.utilities.js +41 -1
- package/dist/comments/comments.utilities.js.map +1 -1
- package/dist/comments/hooks/use-comments.d.ts.map +1 -1
- package/dist/comments/hooks/use-comments.js +1 -0
- package/dist/comments/hooks/use-comments.js.map +1 -1
- package/dist/comments/services/comments.factory.d.ts.map +1 -1
- package/dist/comments/services/comments.factory.js +5 -2
- package/dist/comments/services/comments.factory.js.map +1 -1
- package/dist/comments/services/comments.service.d.ts +9 -2
- package/dist/comments/services/comments.service.d.ts.map +1 -1
- package/dist/comments/services/comments.service.js +96 -4
- package/dist/comments/services/comments.service.js.map +1 -1
- package/dist/db/schemas/index.d.ts +6 -4
- package/dist/db/schemas/index.d.ts.map +1 -1
- package/dist/db/schemas/index.js +2 -1
- package/dist/db/schemas/index.js.map +1 -1
- package/dist/db/schemas/notifications.schema.d.ts +107 -0
- package/dist/db/schemas/notifications.schema.d.ts.map +1 -0
- package/dist/db/schemas/notifications.schema.js +124 -0
- package/dist/db/schemas/notifications.schema.js.map +1 -0
- package/dist/feedback/api/feedback.handlers.d.ts.map +1 -1
- package/dist/feedback/api/feedback.handlers.js +1 -0
- package/dist/feedback/api/feedback.handlers.js.map +1 -1
- package/dist/feedback/components/feedback-editor.d.ts.map +1 -1
- package/dist/feedback/components/feedback-editor.js +6 -4
- package/dist/feedback/components/feedback-editor.js.map +1 -1
- package/dist/feedback/feedback.interfaces.d.ts +24 -1
- package/dist/feedback/feedback.interfaces.d.ts.map +1 -1
- package/dist/feedback/services/feedback.service.d.ts +26 -3
- package/dist/feedback/services/feedback.service.d.ts.map +1 -1
- package/dist/feedback/services/feedback.service.js +270 -11
- package/dist/feedback/services/feedback.service.js.map +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.d.ts.map +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.js +1 -1
- package/dist/files/components/folder-browser/folder-breadcrumb.js.map +1 -1
- package/dist/files/components/folder-browser/folder-list-item.js +1 -1
- package/dist/files/components/folder-browser/folder-list-item.js.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.d.ts.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.js +1 -1
- package/dist/files/components/folder-browser/folder-tree-item.js.map +1 -1
- package/dist/files/components/folder-browser/folder-tree-sidebar.js +1 -1
- package/dist/files/components/folder-browser/folder-tree-sidebar.js.map +1 -1
- package/dist/notifications/api/index.d.ts +7 -0
- package/dist/notifications/api/index.d.ts.map +1 -0
- package/dist/notifications/api/index.js +8 -0
- package/dist/notifications/api/index.js.map +1 -0
- package/dist/notifications/api/notifications.client.d.ts +86 -0
- package/dist/notifications/api/notifications.client.d.ts.map +1 -0
- package/dist/notifications/api/notifications.client.js +102 -0
- package/dist/notifications/api/notifications.client.js.map +1 -0
- package/dist/notifications/api/notifications.handlers.d.ts +166 -0
- package/dist/notifications/api/notifications.handlers.d.ts.map +1 -0
- package/dist/notifications/api/notifications.handlers.js +187 -0
- package/dist/notifications/api/notifications.handlers.js.map +1 -0
- package/dist/notifications/hooks/index.d.ts +5 -0
- package/dist/notifications/hooks/index.d.ts.map +1 -0
- package/dist/notifications/hooks/index.js +5 -0
- package/dist/notifications/hooks/index.js.map +1 -0
- package/dist/notifications/hooks/use-notifications-api.d.ts +111 -0
- package/dist/notifications/hooks/use-notifications-api.d.ts.map +1 -0
- package/dist/notifications/hooks/use-notifications-api.js +253 -0
- package/dist/notifications/hooks/use-notifications-api.js.map +1 -0
- package/dist/notifications/index.d.ts +16 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +18 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notification.utilities.d.ts +12 -0
- package/dist/notifications/notification.utilities.d.ts.map +1 -0
- package/dist/notifications/notification.utilities.js +35 -0
- package/dist/notifications/notification.utilities.js.map +1 -0
- package/dist/notifications/notifications.constants.d.ts +72 -0
- package/dist/notifications/notifications.constants.d.ts.map +1 -0
- package/dist/notifications/notifications.constants.js +104 -0
- package/dist/notifications/notifications.constants.js.map +1 -0
- package/dist/notifications/notifications.errors.d.ts +35 -0
- package/dist/notifications/notifications.errors.d.ts.map +1 -0
- package/dist/notifications/notifications.errors.js +51 -0
- package/dist/notifications/notifications.errors.js.map +1 -0
- package/dist/notifications/notifications.interfaces.d.ts +116 -0
- package/dist/notifications/notifications.interfaces.d.ts.map +1 -0
- package/dist/notifications/notifications.interfaces.js +10 -0
- package/dist/notifications/notifications.interfaces.js.map +1 -0
- package/dist/notifications/notifications.schemas.d.ts +139 -0
- package/dist/notifications/notifications.schemas.d.ts.map +1 -0
- package/dist/notifications/notifications.schemas.js +167 -0
- package/dist/notifications/notifications.schemas.js.map +1 -0
- package/dist/notifications/services/index.d.ts +6 -0
- package/dist/notifications/services/index.d.ts.map +1 -0
- package/dist/notifications/services/index.js +6 -0
- package/dist/notifications/services/index.js.map +1 -0
- package/dist/notifications/services/notifications.factory.d.ts +19 -0
- package/dist/notifications/services/notifications.factory.d.ts.map +1 -0
- package/dist/notifications/services/notifications.factory.js +58 -0
- package/dist/notifications/services/notifications.factory.js.map +1 -0
- package/dist/notifications/services/notifications.service.d.ts +88 -0
- package/dist/notifications/services/notifications.service.d.ts.map +1 -0
- package/dist/notifications/services/notifications.service.js +620 -0
- package/dist/notifications/services/notifications.service.js.map +1 -0
- package/dist/permissions/api/permissions.handlers.d.ts +20 -20
- package/dist/permissions/components/resource-panel.d.ts.map +1 -1
- package/dist/permissions/components/resource-panel.js +2 -1
- package/dist/permissions/components/resource-panel.js.map +1 -1
- package/dist/permissions/hooks/index.d.ts +1 -0
- package/dist/permissions/hooks/index.d.ts.map +1 -1
- package/dist/permissions/hooks/index.js +1 -0
- package/dist/permissions/hooks/index.js.map +1 -1
- package/dist/permissions/hooks/use-notification-permissions.d.ts +19 -0
- package/dist/permissions/hooks/use-notification-permissions.d.ts.map +1 -0
- package/dist/permissions/hooks/use-notification-permissions.js +32 -0
- package/dist/permissions/hooks/use-notification-permissions.js.map +1 -0
- package/dist/permissions/hooks/use-permissions-dashboard.d.ts +6 -6
- package/dist/permissions/hooks/use-policies.d.ts +2 -2
- package/dist/permissions/permissions.constants.d.ts +5 -0
- package/dist/permissions/permissions.constants.d.ts.map +1 -1
- package/dist/permissions/permissions.constants.js +35 -0
- package/dist/permissions/permissions.constants.js.map +1 -1
- package/dist/permissions/permissions.interfaces.d.ts +12 -0
- package/dist/permissions/permissions.interfaces.d.ts.map +1 -1
- package/dist/permissions/permissions.schemas.d.ts +56 -21
- package/dist/permissions/permissions.schemas.d.ts.map +1 -1
- package/dist/permissions/permissions.schemas.js +6 -1
- package/dist/permissions/permissions.schemas.js.map +1 -1
- package/dist/search/components/global-search-bar.d.ts.map +1 -1
- package/dist/search/components/global-search-bar.js +10 -11
- package/dist/search/components/global-search-bar.js.map +1 -1
- package/dist/shared/components/skeleton/console-layout-skeleton.d.ts +9 -21
- package/dist/shared/components/skeleton/console-layout-skeleton.d.ts.map +1 -1
- package/dist/shared/components/skeleton/console-layout-skeleton.js +13 -29
- package/dist/shared/components/skeleton/console-layout-skeleton.js.map +1 -1
- package/dist/shared/components/ui/sidebar.js +9 -9
- package/dist/shared/components/ui/sidebar.js.map +1 -1
- package/dist/shared/shared.constants.d.ts +1 -0
- package/dist/shared/shared.constants.d.ts.map +1 -1
- package/dist/shared/shared.constants.js +1 -0
- package/dist/shared/shared.constants.js.map +1 -1
- package/dist/shared/shared.interfaces.d.ts +0 -1
- package/dist/shared/shared.interfaces.d.ts.map +1 -1
- package/dist/shell/components/ConsoleLayout.d.ts +1 -1
- package/dist/shell/components/ConsoleLayout.d.ts.map +1 -1
- package/dist/shell/components/ConsoleLayout.js +6 -3
- package/dist/shell/components/ConsoleLayout.js.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher-search-bar.js +1 -1
- package/dist/shell/components/app-launcher/app-launcher-search-bar.js.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/app-launcher.js +2 -1
- package/dist/shell/components/app-launcher/app-launcher.js.map +1 -1
- package/dist/shell/components/app-launcher/category-navigation.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/category-navigation.js +9 -2
- package/dist/shell/components/app-launcher/category-navigation.js.map +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.d.ts +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/left-sidebar.js +3 -4
- package/dist/shell/components/app-launcher/left-sidebar.js.map +1 -1
- package/dist/shell/components/app-launcher/service-item.d.ts.map +1 -1
- package/dist/shell/components/app-launcher/service-item.js +2 -2
- package/dist/shell/components/app-launcher/service-item.js.map +1 -1
- package/dist/shell/components/index.d.ts +1 -0
- package/dist/shell/components/index.d.ts.map +1 -1
- package/dist/shell/components/index.js +2 -0
- package/dist/shell/components/index.js.map +1 -1
- package/dist/shell/components/layouts/app-sidebar.d.ts +4 -1
- package/dist/shell/components/layouts/app-sidebar.d.ts.map +1 -1
- package/dist/shell/components/layouts/app-sidebar.js +39 -6
- package/dist/shell/components/layouts/app-sidebar.js.map +1 -1
- package/dist/shell/components/layouts/content-header.d.ts.map +1 -1
- package/dist/shell/components/layouts/content-header.js +5 -24
- package/dist/shell/components/layouts/content-header.js.map +1 -1
- package/dist/shell/components/layouts/index.d.ts +1 -3
- package/dist/shell/components/layouts/index.d.ts.map +1 -1
- package/dist/shell/components/layouts/index.js +1 -3
- package/dist/shell/components/layouts/index.js.map +1 -1
- package/dist/shell/components/layouts/sidebar-nested-item.d.ts.map +1 -1
- package/dist/shell/components/layouts/sidebar-nested-item.js +12 -5
- package/dist/shell/components/layouts/sidebar-nested-item.js.map +1 -1
- package/dist/shell/components/notifications/notification-container.d.ts +16 -2
- package/dist/shell/components/notifications/notification-container.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-container.js +75 -4
- package/dist/shell/components/notifications/notification-container.js.map +1 -1
- package/dist/shell/components/notifications/notification-item.d.ts +1 -1
- package/dist/shell/components/notifications/notification-item.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-item.js +26 -7
- package/dist/shell/components/notifications/notification-item.js.map +1 -1
- package/dist/shell/components/notifications/notification-panel-header.d.ts.map +1 -1
- package/dist/shell/components/notifications/notification-panel-header.js +4 -1
- package/dist/shell/components/notifications/notification-panel-header.js.map +1 -1
- package/dist/shell/components/notifications/notifications.d.ts +1 -1
- package/dist/shell/components/notifications/notifications.d.ts.map +1 -1
- package/dist/shell/components/notifications/notifications.js +2 -2
- package/dist/shell/components/notifications/notifications.js.map +1 -1
- package/dist/shell/components/toolbars/index.d.ts +1 -4
- package/dist/shell/components/toolbars/index.d.ts.map +1 -1
- package/dist/shell/components/toolbars/index.js +2 -5
- package/dist/shell/components/toolbars/index.js.map +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.d.ts +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.d.ts.map +1 -1
- package/dist/shell/components/toolbars/top-right-toolbar.js +2 -2
- package/dist/shell/components/toolbars/top-right-toolbar.js.map +1 -1
- package/dist/shell/components/toolbars/top-toolbar-feedback.js +1 -1
- package/dist/shell/components/toolbars/top-toolbar-feedback.js.map +1 -1
- package/dist/shell/shell.constants.d.ts +1 -1
- package/dist/shell/shell.constants.js +1 -1
- package/dist/shell/shell.interfaces.d.ts +8 -4
- package/dist/shell/shell.interfaces.d.ts.map +1 -1
- package/dist/shell/shell.utilities.d.ts +7 -0
- package/dist/shell/shell.utilities.d.ts.map +1 -1
- package/dist/shell/shell.utilities.js +17 -0
- package/dist/shell/shell.utilities.js.map +1 -1
- package/package.json +130 -12
- package/dist/chat/components/chat-assistant-legacy.d.ts +0 -9
- package/dist/chat/components/chat-assistant-legacy.d.ts.map +0 -1
- package/dist/chat/components/chat-assistant-legacy.js +0 -73
- package/dist/chat/components/chat-assistant-legacy.js.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Service Constants
|
|
3
|
+
*/
|
|
4
|
+
import { AtSign, FilePlus, MessageSquare, Pencil, RefreshCw, UserCheck, } from "lucide-react";
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// API Configuration
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/** Default API endpoint for notifications */
|
|
9
|
+
export const NOTIFICATIONS_API_ENDPOINT = "/api/notifications";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Notification Types
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/** Supported notification types */
|
|
14
|
+
export const NOTIFICATION_TYPES = {
|
|
15
|
+
MENTION: "mention",
|
|
16
|
+
REPLY: "reply",
|
|
17
|
+
FEEDBACK_CREATED: "feedback_created",
|
|
18
|
+
FEEDBACK_STATUS_CHANGED: "feedback_status_changed",
|
|
19
|
+
FEEDBACK_ASSIGNED: "feedback_assigned",
|
|
20
|
+
FEEDBACK_UPDATED: "feedback_updated",
|
|
21
|
+
};
|
|
22
|
+
/** Mapping of notification types to their icons and colors for UI display */
|
|
23
|
+
export const NOTIFICATION_TYPE_CONFIG = {
|
|
24
|
+
[NOTIFICATION_TYPES.MENTION]: { icon: AtSign, className: "bg-blue-500 text-white" },
|
|
25
|
+
[NOTIFICATION_TYPES.REPLY]: { icon: MessageSquare, className: "bg-green-500 text-white" },
|
|
26
|
+
[NOTIFICATION_TYPES.FEEDBACK_CREATED]: { icon: FilePlus, className: "bg-purple-500 text-white" },
|
|
27
|
+
[NOTIFICATION_TYPES.FEEDBACK_STATUS_CHANGED]: {
|
|
28
|
+
icon: RefreshCw,
|
|
29
|
+
className: "bg-orange-500 text-white",
|
|
30
|
+
},
|
|
31
|
+
[NOTIFICATION_TYPES.FEEDBACK_ASSIGNED]: { icon: UserCheck, className: "bg-teal-500 text-white" },
|
|
32
|
+
[NOTIFICATION_TYPES.FEEDBACK_UPDATED]: { icon: Pencil, className: "bg-amber-500 text-white" },
|
|
33
|
+
};
|
|
34
|
+
/** Supported notification source types */
|
|
35
|
+
export const NOTIFICATION_SOURCE_TYPES = {
|
|
36
|
+
COMMENT: "comment",
|
|
37
|
+
FEEDBACK: "feedback",
|
|
38
|
+
};
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Notification Titles
|
|
41
|
+
// ============================================================================
|
|
42
|
+
/** Notification titles for different notification types */
|
|
43
|
+
export const NOTIFICATION_TITLES = {
|
|
44
|
+
MENTION: "New Mention",
|
|
45
|
+
REPLY: "New Reply",
|
|
46
|
+
FEEDBACK_ASSIGNED: "New Feedback Assigned",
|
|
47
|
+
FEEDBACK_REASSIGNED: "Feedback Assigned to You",
|
|
48
|
+
FEEDBACK_STATUS_CHANGED: "Feedback Status Updated",
|
|
49
|
+
FEEDBACK_UPDATED: "Feedback Updated",
|
|
50
|
+
FEEDBACK_CREATED: "New Feedback Created",
|
|
51
|
+
};
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Pagination
|
|
54
|
+
// ============================================================================
|
|
55
|
+
/** Default number of notifications to fetch */
|
|
56
|
+
export const DEFAULT_NOTIFICATIONS_LIMIT = 20;
|
|
57
|
+
/** Maximum number of notifications to fetch in one request */
|
|
58
|
+
export const MAX_NOTIFICATIONS_LIMIT = 100;
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Polling Configuration
|
|
61
|
+
// ============================================================================
|
|
62
|
+
/** Default polling interval for notifications in milliseconds (30 seconds) */
|
|
63
|
+
export const DEFAULT_POLLING_INTERVAL_MS = parseInt(process.env.NOTIFICATIONS_POLLING_INTERVAL_MS || "", 10) || 30000;
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// Content Limits
|
|
66
|
+
// ============================================================================
|
|
67
|
+
/** Maximum length of notification title */
|
|
68
|
+
export const MAX_TITLE_LENGTH = 100;
|
|
69
|
+
/** Maximum length of notification message */
|
|
70
|
+
export const MAX_MESSAGE_LENGTH = 500;
|
|
71
|
+
/** Maximum length of notification URL */
|
|
72
|
+
export const MAX_URL_LENGTH = 2000;
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// TTL (Time To Live) Configuration
|
|
75
|
+
// ============================================================================
|
|
76
|
+
/** Default TTL for notifications in days (90 days). Server-side only - no need to expose to client. */
|
|
77
|
+
export const DEFAULT_NOTIFICATION_TTL_DAYS = parseInt(process.env.NOTIFICATIONS_TTL_DAYS || "", 10) || 90;
|
|
78
|
+
/** Convert days to seconds for DynamoDB TTL */
|
|
79
|
+
export const NOTIFICATION_TTL_SECONDS = DEFAULT_NOTIFICATION_TTL_DAYS * 24 * 60 * 60;
|
|
80
|
+
// ============================================================================
|
|
81
|
+
// Error Messages
|
|
82
|
+
// ============================================================================
|
|
83
|
+
/**
|
|
84
|
+
* Notifications service error message constants
|
|
85
|
+
*/
|
|
86
|
+
export const NOTIFICATIONS_ERROR_MESSAGES = {
|
|
87
|
+
NOTIFICATION_NOT_FOUND: (notificationId) => `Notification with ID '${notificationId}' not found`,
|
|
88
|
+
UNAUTHORIZED: (action) => `You are not authorized to ${action}`,
|
|
89
|
+
INVALID_NOTIFICATION_TYPE: (type) => `Invalid notification type '${type}'. Allowed types: mention, reply, feedback_created, feedback_status_changed, feedback_assigned, feedback_updated`,
|
|
90
|
+
CREATE_FAILED: (reason) => `Failed to create notification: ${reason}`,
|
|
91
|
+
UPDATE_FAILED: (reason) => `Failed to update notification: ${reason}`,
|
|
92
|
+
};
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// React Query Keys
|
|
95
|
+
// ============================================================================
|
|
96
|
+
/** React Query key factory for notifications */
|
|
97
|
+
export const NOTIFICATIONS_QUERY_KEYS = {
|
|
98
|
+
all: ["notifications"],
|
|
99
|
+
lists: () => [...NOTIFICATIONS_QUERY_KEYS.all, "list"],
|
|
100
|
+
list: (filters) => [...NOTIFICATIONS_QUERY_KEYS.lists(), filters],
|
|
101
|
+
unreadCount: () => [...NOTIFICATIONS_QUERY_KEYS.all, "unread-count"],
|
|
102
|
+
detail: (id) => [...NOTIFICATIONS_QUERY_KEYS.all, "detail", id],
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=notifications.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.constants.js","sourceRoot":"","sources":["../../lib/notifications/notifications.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,MAAM,EACN,QAAQ,EAER,aAAa,EACb,MAAM,EACN,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,mCAAmC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,gBAAgB,EAAE,kBAAkB;IACpC,uBAAuB,EAAE,yBAAyB;IAClD,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAIX,6EAA6E;AAC7E,MAAM,CA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EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,gDAAgD;AAChD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,CAAC,eAAe,CAAU;IAC/B,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAU;IAC/D,IAAI,EAAE,CAAC,OAAgC,EAAE,EAAE,CACzC,CAAC,GAAG,wBAAwB,CAAC,KAAK,EAAE,EAAE,OAAO,CAAU;IACzD,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,wBAAwB,CAAC,GAAG,EAAE,cAAc,CAAU;IAC7E,MAAM,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,GAAG,wBAAwB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAU;CACxE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Service Error Classes
|
|
3
|
+
*/
|
|
4
|
+
import { ForbiddenError, InternalServerError, NotFoundError, ValidationError } from "../shared/services/services.errors";
|
|
5
|
+
/**
|
|
6
|
+
* Notification not found error
|
|
7
|
+
*/
|
|
8
|
+
export declare class NotificationNotFoundError extends NotFoundError {
|
|
9
|
+
constructor(notificationId: string);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Unauthorized access to notification
|
|
13
|
+
*/
|
|
14
|
+
export declare class NotificationUnauthorizedError extends ForbiddenError {
|
|
15
|
+
constructor(action: string);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Invalid notification type error
|
|
19
|
+
*/
|
|
20
|
+
export declare class InvalidNotificationTypeError extends ValidationError {
|
|
21
|
+
constructor(type: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Notification creation failed error
|
|
25
|
+
*/
|
|
26
|
+
export declare class NotificationCreateError extends InternalServerError {
|
|
27
|
+
constructor(reason: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Notification update failed error
|
|
31
|
+
*/
|
|
32
|
+
export declare class NotificationUpdateError extends InternalServerError {
|
|
33
|
+
constructor(reason: string);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=notifications.errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.errors.d.ts","sourceRoot":"","sources":["../../lib/notifications/notifications.errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,aAAa;gBAC9C,cAAc,EAAE,MAAM;CAInC;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,cAAc;gBACnD,MAAM,EAAE,MAAM;CAI3B;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,eAAe;gBACnD,IAAI,EAAE,MAAM;CAIzB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,mBAAmB;gBAClD,MAAM,EAAE,MAAM;CAI3B;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,mBAAmB;gBAClD,MAAM,EAAE,MAAM;CAI3B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Service Error Classes
|
|
3
|
+
*/
|
|
4
|
+
import { NOTIFICATIONS_ERROR_MESSAGES } from "./notifications.constants";
|
|
5
|
+
import { ForbiddenError, InternalServerError, NotFoundError, ValidationError, } from "../shared/services/services.errors";
|
|
6
|
+
/**
|
|
7
|
+
* Notification not found error
|
|
8
|
+
*/
|
|
9
|
+
export class NotificationNotFoundError extends NotFoundError {
|
|
10
|
+
constructor(notificationId) {
|
|
11
|
+
super(NOTIFICATIONS_ERROR_MESSAGES.NOTIFICATION_NOT_FOUND(notificationId));
|
|
12
|
+
this.name = "NotificationNotFoundError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Unauthorized access to notification
|
|
17
|
+
*/
|
|
18
|
+
export class NotificationUnauthorizedError extends ForbiddenError {
|
|
19
|
+
constructor(action) {
|
|
20
|
+
super(NOTIFICATIONS_ERROR_MESSAGES.UNAUTHORIZED(action));
|
|
21
|
+
this.name = "NotificationUnauthorizedError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Invalid notification type error
|
|
26
|
+
*/
|
|
27
|
+
export class InvalidNotificationTypeError extends ValidationError {
|
|
28
|
+
constructor(type) {
|
|
29
|
+
super(NOTIFICATIONS_ERROR_MESSAGES.INVALID_NOTIFICATION_TYPE(type));
|
|
30
|
+
this.name = "InvalidNotificationTypeError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Notification creation failed error
|
|
35
|
+
*/
|
|
36
|
+
export class NotificationCreateError extends InternalServerError {
|
|
37
|
+
constructor(reason) {
|
|
38
|
+
super(NOTIFICATIONS_ERROR_MESSAGES.CREATE_FAILED(reason));
|
|
39
|
+
this.name = "NotificationCreateError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Notification update failed error
|
|
44
|
+
*/
|
|
45
|
+
export class NotificationUpdateError extends InternalServerError {
|
|
46
|
+
constructor(reason) {
|
|
47
|
+
super(NOTIFICATIONS_ERROR_MESSAGES.UPDATE_FAILED(reason));
|
|
48
|
+
this.name = "NotificationUpdateError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=notifications.errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.errors.js","sourceRoot":"","sources":["../../lib/notifications/notifications.errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,aAAa;IAC1D,YAAY,cAAsB;QAChC,KAAK,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,cAAc;IAC/D,YAAY,MAAc;QACxB,KAAK,CAAC,4BAA4B,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,eAAe;IAC/D,YAAY,IAAY;QACtB,KAAK,CAAC,4BAA4B,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;IAC9D,YAAY,MAAc;QACxB,KAAK,CAAC,4BAA4B,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;IAC9D,YAAY,MAAc;QACxB,KAAK,CAAC,4BAA4B,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Module Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Contains all interfaces related to the notifications system:
|
|
5
|
+
* - Core notification types (derived from schema)
|
|
6
|
+
* - Service operation parameters
|
|
7
|
+
* - API response types
|
|
8
|
+
*/
|
|
9
|
+
import { NotificationsTableSchema } from "../db/schemas";
|
|
10
|
+
import type { CreateNotificationSchemaInput, DismissNotificationSchemaInput, GetUnreadCountSchemaInput, ListNotificationsSchemaInput, MarkAllAsReadSchemaInput, MarkAsReadSchemaInput, NotificationEntity } from "./notifications.schemas";
|
|
11
|
+
import { DynamoDbService } from "../shared/services/dynamodb";
|
|
12
|
+
import type { Logger } from "../shared/services/logger";
|
|
13
|
+
import type { UserAwsCredentials } from "../shared/services/services.interfaces";
|
|
14
|
+
/**
|
|
15
|
+
* Core notification entity - derived from schema (single source of truth)
|
|
16
|
+
* Includes base entity fields (id, createdAt, updatedAt, createdById, modifiedById)
|
|
17
|
+
*/
|
|
18
|
+
export type Notification = NotificationEntity;
|
|
19
|
+
/**
|
|
20
|
+
* Options for notification service operations
|
|
21
|
+
*/
|
|
22
|
+
export interface NotificationsOperationOptions {
|
|
23
|
+
/** AWS credentials for user-scoped access */
|
|
24
|
+
userCredentials?: UserAwsCredentials;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parameters for creating a single notification - derived from schema (single source of truth)
|
|
28
|
+
*/
|
|
29
|
+
export type CreateNotificationParams = CreateNotificationSchemaInput;
|
|
30
|
+
/**
|
|
31
|
+
* Parameters for listing notifications - derived from schema (single source of truth)
|
|
32
|
+
*/
|
|
33
|
+
export type ListNotificationsParams = ListNotificationsSchemaInput;
|
|
34
|
+
/**
|
|
35
|
+
* Parameters for getting unread count - derived from schema (single source of truth)
|
|
36
|
+
*/
|
|
37
|
+
export type GetUnreadCountParams = GetUnreadCountSchemaInput;
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for marking a notification as read - derived from schema (single source of truth)
|
|
40
|
+
*/
|
|
41
|
+
export type MarkAsReadParams = MarkAsReadSchemaInput;
|
|
42
|
+
/**
|
|
43
|
+
* Parameters for marking all notifications as read - derived from schema (single source of truth)
|
|
44
|
+
*/
|
|
45
|
+
export type MarkAllAsReadParams = MarkAllAsReadSchemaInput;
|
|
46
|
+
/**
|
|
47
|
+
* Parameters for dismissing a notification - derived from schema (single source of truth)
|
|
48
|
+
*/
|
|
49
|
+
export type DismissNotificationParams = DismissNotificationSchemaInput;
|
|
50
|
+
/**
|
|
51
|
+
* Paginated notifications data (used by service)
|
|
52
|
+
*/
|
|
53
|
+
export interface PaginatedNotifications {
|
|
54
|
+
/** Array of notifications */
|
|
55
|
+
notifications: Notification[];
|
|
56
|
+
/** Pagination cursor for next page */
|
|
57
|
+
nextCursor?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Configuration for NotificationsService
|
|
61
|
+
*/
|
|
62
|
+
export interface NotificationsServiceConfig {
|
|
63
|
+
/** Override table name (defaults to TABLES.notifications) */
|
|
64
|
+
tableName?: string;
|
|
65
|
+
/** Default page size for list operations */
|
|
66
|
+
defaultPageSize?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Options for the notifications API hook
|
|
70
|
+
*/
|
|
71
|
+
export interface UseNotificationsApiOptions {
|
|
72
|
+
/** Maximum number of notifications to fetch */
|
|
73
|
+
limit?: number;
|
|
74
|
+
/** Enable polling for notifications */
|
|
75
|
+
enablePolling?: boolean;
|
|
76
|
+
/** Polling interval in milliseconds */
|
|
77
|
+
pollingInterval?: number;
|
|
78
|
+
/** Only fetch unread notifications */
|
|
79
|
+
unreadOnly?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Props for the notification container
|
|
83
|
+
*/
|
|
84
|
+
export interface NotificationContainerProps {
|
|
85
|
+
/** Maximum number of notifications to show initially */
|
|
86
|
+
notificationsLimit?: number;
|
|
87
|
+
/** Polling interval in milliseconds (default: 30000) */
|
|
88
|
+
pollingInterval?: number;
|
|
89
|
+
/** Whether to enable polling (default: true) */
|
|
90
|
+
enablePolling?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parameters for fetching notifications
|
|
94
|
+
*/
|
|
95
|
+
export interface FetchNotificationsParams {
|
|
96
|
+
/** Maximum number of notifications to return */
|
|
97
|
+
limit?: number;
|
|
98
|
+
/** Pagination cursor */
|
|
99
|
+
cursor?: string;
|
|
100
|
+
/** Only return unread notifications */
|
|
101
|
+
unreadOnly?: boolean;
|
|
102
|
+
/** Include dismissed notifications */
|
|
103
|
+
includeDismissed?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Dependencies for NotificationsService
|
|
107
|
+
*/
|
|
108
|
+
export interface NotificationsServiceDependencies {
|
|
109
|
+
/** Logger instance */
|
|
110
|
+
logger?: Logger;
|
|
111
|
+
/** DynamoDB service instance */
|
|
112
|
+
dynamoDb?: DynamoDbService<NotificationsTableSchema>;
|
|
113
|
+
/** Service configuration */
|
|
114
|
+
config?: NotificationsServiceConfig;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=notifications.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.interfaces.d.ts","sourceRoot":"","sources":["../../lib/notifications/notifications.interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EACV,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAMpF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAM9C;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,6CAA6C;IAC7C,eAAe,CAAC,EA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AM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,eAAe,CAAC,wBAAwB,CAAC,CAAC;IACrD,4BAA4B;IAC5B,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Module Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Contains all interfaces related to the notifications system:
|
|
5
|
+
* - Core notification types (derived from schema)
|
|
6
|
+
* - Service operation parameters
|
|
7
|
+
* - API response types
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=notifications.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.interfaces.js","sourceRoot":"","sources":["../../lib/notifications/notifications.interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Zod Schemas
|
|
3
|
+
*
|
|
4
|
+
* Validation schemas for notifications operations.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
/** Notification type enum schema */
|
|
8
|
+
export declare const notificationTypeSchema: z.ZodEnum<{
|
|
9
|
+
mention: "mention";
|
|
10
|
+
reply: "reply";
|
|
11
|
+
feedback_created: "feedback_created";
|
|
12
|
+
feedback_status_changed: "feedback_status_changed";
|
|
13
|
+
feedback_assigned: "feedback_assigned";
|
|
14
|
+
feedback_updated: "feedback_updated";
|
|
15
|
+
}>;
|
|
16
|
+
/** Notification source type enum schema */
|
|
17
|
+
export declare const notificationSourceTypeSchema: z.ZodEnum<{
|
|
18
|
+
feedback: "feedback";
|
|
19
|
+
comment: "comment";
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Schema for creating a notification
|
|
23
|
+
*/
|
|
24
|
+
export declare const createNotificationSchema: z.ZodObject<{
|
|
25
|
+
tenantId: z.ZodString;
|
|
26
|
+
userId: z.ZodString;
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
mention: "mention";
|
|
29
|
+
reply: "reply";
|
|
30
|
+
feedback_created: "feedback_created";
|
|
31
|
+
feedback_status_changed: "feedback_status_changed";
|
|
32
|
+
feedback_assigned: "feedback_assigned";
|
|
33
|
+
feedback_updated: "feedback_updated";
|
|
34
|
+
}>;
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
message: z.ZodString;
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
actorId: z.ZodString;
|
|
39
|
+
actorName: z.ZodString;
|
|
40
|
+
entityId: z.ZodString;
|
|
41
|
+
entityType: z.ZodString;
|
|
42
|
+
sourceId: z.ZodString;
|
|
43
|
+
sourceType: z.ZodEnum<{
|
|
44
|
+
feedback: "feedback";
|
|
45
|
+
comment: "comment";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type CreateNotificationSchemaInput = z.infer<typeof createNotificationSchema>;
|
|
49
|
+
/**
|
|
50
|
+
* Schema for listing notifications (query parameters)
|
|
51
|
+
*/
|
|
52
|
+
export declare const listNotificationsSchema: z.ZodObject<{
|
|
53
|
+
tenantId: z.ZodString;
|
|
54
|
+
userId: z.ZodString;
|
|
55
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
56
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
57
|
+
unreadOnly: z.ZodOptional<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
|
|
58
|
+
true: "true";
|
|
59
|
+
false: "false";
|
|
60
|
+
}>, z.ZodTransform<boolean, "true" | "false">>]>>>;
|
|
61
|
+
includeDismissed: z.ZodOptional<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
|
|
62
|
+
true: "true";
|
|
63
|
+
false: "false";
|
|
64
|
+
}>, z.ZodTransform<boolean, "true" | "false">>]>>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type ListNotificationsSchemaInput = z.infer<typeof listNotificationsSchema>;
|
|
67
|
+
/**
|
|
68
|
+
* Schema for getting unread count
|
|
69
|
+
*/
|
|
70
|
+
export declare const getUnreadCountSchema: z.ZodObject<{
|
|
71
|
+
tenantId: z.ZodString;
|
|
72
|
+
userId: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type GetUnreadCountSchemaInput = z.infer<typeof getUnreadCountSchema>;
|
|
75
|
+
/**
|
|
76
|
+
* Schema for marking a notification as read
|
|
77
|
+
*/
|
|
78
|
+
export declare const markAsReadSchema: z.ZodObject<{
|
|
79
|
+
tenantId: z.ZodString;
|
|
80
|
+
userId: z.ZodString;
|
|
81
|
+
notificationId: z.ZodString;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export type MarkAsReadSchemaInput = z.infer<typeof markAsReadSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Schema for marking all notifications as read
|
|
86
|
+
*/
|
|
87
|
+
export declare const markAllAsReadSchema: z.ZodObject<{
|
|
88
|
+
tenantId: z.ZodString;
|
|
89
|
+
userId: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type MarkAllAsReadSchemaInput = z.infer<typeof markAllAsReadSchema>;
|
|
92
|
+
/**
|
|
93
|
+
* Schema for dismissing a notification
|
|
94
|
+
*/
|
|
95
|
+
export declare const dismissNotificationSchema: z.ZodObject<{
|
|
96
|
+
tenantId: z.ZodString;
|
|
97
|
+
userId: z.ZodString;
|
|
98
|
+
notificationId: z.ZodString;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type DismissNotificationSchemaInput = z.infer<typeof dismissNotificationSchema>;
|
|
101
|
+
/**
|
|
102
|
+
* Full notification entity schema (for validation/transformation)
|
|
103
|
+
* Extends baseEntitySchema for consistent id, timestamps, and audit fields.
|
|
104
|
+
*/
|
|
105
|
+
export declare const notificationEntitySchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
createdAt: z.ZodNumber;
|
|
108
|
+
updatedAt: z.ZodNumber;
|
|
109
|
+
createdById: z.ZodString;
|
|
110
|
+
modifiedById: z.ZodOptional<z.ZodString>;
|
|
111
|
+
tenantId: z.ZodString;
|
|
112
|
+
userId: z.ZodString;
|
|
113
|
+
type: z.ZodEnum<{
|
|
114
|
+
mention: "mention";
|
|
115
|
+
reply: "reply";
|
|
116
|
+
feedback_created: "feedback_created";
|
|
117
|
+
feedback_status_changed: "feedback_status_changed";
|
|
118
|
+
feedback_assigned: "feedback_assigned";
|
|
119
|
+
feedback_updated: "feedback_updated";
|
|
120
|
+
}>;
|
|
121
|
+
title: z.ZodString;
|
|
122
|
+
message: z.ZodString;
|
|
123
|
+
read: z.ZodBoolean;
|
|
124
|
+
isDismissed: z.ZodBoolean;
|
|
125
|
+
url: z.ZodString;
|
|
126
|
+
actorId: z.ZodString;
|
|
127
|
+
actorName: z.ZodString;
|
|
128
|
+
entityId: z.ZodString;
|
|
129
|
+
entityType: z.ZodString;
|
|
130
|
+
sourceId: z.ZodString;
|
|
131
|
+
sourceType: z.ZodEnum<{
|
|
132
|
+
feedback: "feedback";
|
|
133
|
+
comment: "comment";
|
|
134
|
+
}>;
|
|
135
|
+
ttl: z.ZodNumber;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
/** Notification entity type derived from schema */
|
|
138
|
+
export type NotificationEntity = z.infer<typeof notificationEntitySchema>;
|
|
139
|
+
//# sourceMappingURL=notifications.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not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AAmD;AACnD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Zod Schemas
|
|
3
|
+
*
|
|
4
|
+
* Validation schemas for notifications operations.
|
|
5
|
+
*/
|
|
6
|
+
import { DEFAULT_NOTIFICATIONS_LIMIT, MAX_MESSAGE_LENGTH, MAX_NOTIFICATIONS_LIMIT, MAX_TITLE_LENGTH, MAX_URL_LENGTH, NOTIFICATION_SOURCE_TYPES, NOTIFICATION_TYPES, } from "./notifications.constants";
|
|
7
|
+
import { baseEntitySchema } from "../shared/shared.schemas";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Base Schemas
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/** Notification type enum schema */
|
|
13
|
+
export const notificationTypeSchema = z.enum([
|
|
14
|
+
NOTIFICATION_TYPES.MENTION,
|
|
15
|
+
NOTIFICATION_TYPES.REPLY,
|
|
16
|
+
NOTIFICATION_TYPES.FEEDBACK_CREATED,
|
|
17
|
+
NOTIFICATION_TYPES.FEEDBACK_STATUS_CHANGED,
|
|
18
|
+
NOTIFICATION_TYPES.FEEDBACK_ASSIGNED,
|
|
19
|
+
NOTIFICATION_TYPES.FEEDBACK_UPDATED,
|
|
20
|
+
]);
|
|
21
|
+
/** Notification source type enum schema */
|
|
22
|
+
export const notificationSourceTypeSchema = z.enum([
|
|
23
|
+
NOTIFICATION_SOURCE_TYPES.COMMENT,
|
|
24
|
+
NOTIFICATION_SOURCE_TYPES.FEEDBACK,
|
|
25
|
+
]);
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Create Notification Schema
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Schema for creating a notification
|
|
31
|
+
*/
|
|
32
|
+
export const createNotificationSchema = z.object({
|
|
33
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
34
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
35
|
+
type: notificationTypeSchema,
|
|
36
|
+
title: z
|
|
37
|
+
.string()
|
|
38
|
+
.trim()
|
|
39
|
+
.min(1, "Title is required")
|
|
40
|
+
.max(MAX_TITLE_LENGTH, `Title must be at most ${MAX_TITLE_LENGTH} characters`),
|
|
41
|
+
message: z
|
|
42
|
+
.string()
|
|
43
|
+
.trim()
|
|
44
|
+
.min(1, "Message is required")
|
|
45
|
+
.max(MAX_MESSAGE_LENGTH, `Message must be at most ${MAX_MESSAGE_LENGTH} characters`),
|
|
46
|
+
url: z
|
|
47
|
+
.string()
|
|
48
|
+
.trim()
|
|
49
|
+
.min(1, "URL is required")
|
|
50
|
+
.max(MAX_URL_LENGTH, `URL must be at most ${MAX_URL_LENGTH} characters`),
|
|
51
|
+
actorId: z.string().trim().min(1, "Actor ID is required"),
|
|
52
|
+
actorName: z.string().trim().min(1, "Actor name is required"),
|
|
53
|
+
entityId: z.string().trim().min(1, "Entity ID is required"),
|
|
54
|
+
entityType: z.string().trim().min(1, "Entity type is required"),
|
|
55
|
+
sourceId: z.string().trim().min(1, "Source ID is required"),
|
|
56
|
+
sourceType: notificationSourceTypeSchema,
|
|
57
|
+
});
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// List Notifications Schema
|
|
60
|
+
// ============================================================================
|
|
61
|
+
/**
|
|
62
|
+
* Schema for listing notifications (query parameters)
|
|
63
|
+
*/
|
|
64
|
+
export const listNotificationsSchema = z.object({
|
|
65
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
66
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
67
|
+
limit: z.coerce
|
|
68
|
+
.number()
|
|
69
|
+
.int()
|
|
70
|
+
.min(1)
|
|
71
|
+
.max(MAX_NOTIFICATIONS_LIMIT)
|
|
72
|
+
.default(DEFAULT_NOTIFICATIONS_LIMIT)
|
|
73
|
+
.optional(),
|
|
74
|
+
cursor: z.string().optional(),
|
|
75
|
+
unreadOnly: z
|
|
76
|
+
.union([z.boolean(), z.enum(["true", "false"]).transform((val) => val === "true")])
|
|
77
|
+
.default(false)
|
|
78
|
+
.optional(),
|
|
79
|
+
includeDismissed: z
|
|
80
|
+
.union([z.boolean(), z.enum(["true", "false"]).transform((val) => val === "true")])
|
|
81
|
+
.default(false)
|
|
82
|
+
.optional(),
|
|
83
|
+
});
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Get Unread Count Schema
|
|
86
|
+
// ============================================================================
|
|
87
|
+
/**
|
|
88
|
+
* Schema for getting unread count
|
|
89
|
+
*/
|
|
90
|
+
export const getUnreadCountSchema = z.object({
|
|
91
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
92
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
93
|
+
});
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// Mark as Read Schema
|
|
96
|
+
// ============================================================================
|
|
97
|
+
/**
|
|
98
|
+
* Schema for marking a notification as read
|
|
99
|
+
*/
|
|
100
|
+
export const markAsReadSchema = z.object({
|
|
101
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
102
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
103
|
+
notificationId: z.string().trim().min(1, "Notification ID is required"),
|
|
104
|
+
});
|
|
105
|
+
// ============================================================================
|
|
106
|
+
// Mark All as Read Schema
|
|
107
|
+
// ============================================================================
|
|
108
|
+
/**
|
|
109
|
+
* Schema for marking all notifications as read
|
|
110
|
+
*/
|
|
111
|
+
export const markAllAsReadSchema = z.object({
|
|
112
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
113
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
114
|
+
});
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// Dismiss Notification Schema
|
|
117
|
+
// ============================================================================
|
|
118
|
+
/**
|
|
119
|
+
* Schema for dismissing a notification
|
|
120
|
+
*/
|
|
121
|
+
export const dismissNotificationSchema = z.object({
|
|
122
|
+
tenantId: z.string().trim().min(1, "Tenant ID is required"),
|
|
123
|
+
userId: z.string().trim().min(1, "User ID is required"),
|
|
124
|
+
notificationId: z.string().trim().min(1, "Notification ID is required"),
|
|
125
|
+
});
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// Notification Entity Schema
|
|
128
|
+
// ============================================================================
|
|
129
|
+
/**
|
|
130
|
+
* Full notification entity schema (for validation/transformation)
|
|
131
|
+
* Extends baseEntitySchema for consistent id, timestamps, and audit fields.
|
|
132
|
+
*/
|
|
133
|
+
export const notificationEntitySchema = baseEntitySchema
|
|
134
|
+
.extend({
|
|
135
|
+
/** Tenant ID for multi-tenancy */
|
|
136
|
+
tenantId: z.string(),
|
|
137
|
+
/** User ID of the notification recipient */
|
|
138
|
+
userId: z.string(),
|
|
139
|
+
/** Type of notification */
|
|
140
|
+
type: notificationTypeSchema,
|
|
141
|
+
/** Notification title (e.g., "New Mention") */
|
|
142
|
+
title: z.string(),
|
|
143
|
+
/** Notification message (e.g., "John mentioned you in a comment") */
|
|
144
|
+
message: z.string(),
|
|
145
|
+
/** Whether the notification has been read */
|
|
146
|
+
read: z.boolean(),
|
|
147
|
+
/** Whether the notification has been dismissed (soft delete) */
|
|
148
|
+
isDismissed: z.boolean(),
|
|
149
|
+
/** URL to navigate to when notification is clicked */
|
|
150
|
+
url: z.string(),
|
|
151
|
+
/** User ID of the actor who triggered the notification */
|
|
152
|
+
actorId: z.string(),
|
|
153
|
+
/** Display name of the actor (denormalized) */
|
|
154
|
+
actorName: z.string(),
|
|
155
|
+
/** Entity ID where the action occurred (e.g., document ID) */
|
|
156
|
+
entityId: z.string(),
|
|
157
|
+
/** Entity type where the action occurred (e.g., "document", "task") */
|
|
158
|
+
entityType: z.string(),
|
|
159
|
+
/** Source ID that triggered this notification (e.g., comment ID) */
|
|
160
|
+
sourceId: z.string(),
|
|
161
|
+
/** Source type that triggered this notification */
|
|
162
|
+
sourceType: notificationSourceTypeSchema,
|
|
163
|
+
/** TTL timestamp for auto-expiry (Unix seconds) - DynamoDB will auto-delete after this time */
|
|
164
|
+
ttl: z.number().int().nonnegative(),
|
|
165
|
+
})
|
|
166
|
+
.describe("Notification entity stored in DynamoDB");
|
|
167
|
+
//# sourceMappingURL=notifications.schemas.js.map
|