@pfm-platform/notifications-data-access 0.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/index.cjs ADDED
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ var reactQuery = require('@tanstack/react-query');
4
+ var shared = require('@pfm-platform/shared');
5
+ var axios = require('axios');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
10
+
11
+ // src/queries/useNotifications.ts
12
+ var api = axios__default.default.create({
13
+ baseURL: "/api",
14
+ headers: {
15
+ "Content-Type": "application/json"
16
+ }
17
+ });
18
+
19
+ // src/keys.ts
20
+ var notificationKeys = {
21
+ all: ["notifications"],
22
+ lists: () => [...notificationKeys.all, "list"],
23
+ list: (userId) => [...notificationKeys.lists(), userId]
24
+ };
25
+
26
+ // src/queries/useNotifications.ts
27
+ function useNotifications({ userId }, options) {
28
+ return reactQuery.useQuery({
29
+ queryKey: notificationKeys.list(userId),
30
+ queryFn: async () => {
31
+ const response = await api.get(`/users/${userId}/alerts/notifications`);
32
+ const validated = shared.NotificationsResponseSchema.parse(response.data);
33
+ return validated.notifications;
34
+ },
35
+ staleTime: 1e3 * 60 * 2,
36
+ // 2 minutes (notifications change frequently)
37
+ ...options
38
+ });
39
+ }
40
+ function useCreateNotification(options) {
41
+ const queryClient = reactQuery.useQueryClient();
42
+ const { mode } = shared.useAppMode();
43
+ return reactQuery.useMutation({
44
+ mutationFn: async ({ userId, data }) => {
45
+ const schema = mode === "admin" ? shared.NotificationCreateSchemaAdmin : shared.NotificationCreateSchemaUser;
46
+ const validated = schema.parse(data);
47
+ const response = await api.post(
48
+ `/users/${userId}/alerts/notifications`,
49
+ validated
50
+ );
51
+ return shared.NotificationSchema.parse(response.data);
52
+ },
53
+ onSuccess: (_, { userId }) => {
54
+ queryClient.invalidateQueries({
55
+ queryKey: notificationKeys.list(userId)
56
+ });
57
+ },
58
+ ...options
59
+ });
60
+ }
61
+ function useUpdateNotification(options) {
62
+ const queryClient = reactQuery.useQueryClient();
63
+ const { mode } = shared.useAppMode();
64
+ return reactQuery.useMutation({
65
+ mutationFn: async ({
66
+ userId,
67
+ notificationId,
68
+ data
69
+ }) => {
70
+ const schema = mode === "admin" ? shared.NotificationUpdateSchemaAdmin : shared.NotificationUpdateSchemaUser;
71
+ const validated = schema.parse(data);
72
+ const response = await api.put(
73
+ `/users/${userId}/alerts/notifications/${notificationId}`,
74
+ validated
75
+ );
76
+ return shared.NotificationSchema.parse(response.data);
77
+ },
78
+ onSuccess: (_, { userId }) => {
79
+ queryClient.invalidateQueries({
80
+ queryKey: notificationKeys.list(userId)
81
+ });
82
+ },
83
+ ...options
84
+ });
85
+ }
86
+ function useDeleteNotification(options) {
87
+ const queryClient = reactQuery.useQueryClient();
88
+ return reactQuery.useMutation({
89
+ mutationFn: async ({ userId, notificationId }) => {
90
+ await api.delete(`/users/${userId}/alerts/notifications/${notificationId}`);
91
+ },
92
+ onSuccess: (_, { userId }) => {
93
+ queryClient.invalidateQueries({ queryKey: notificationKeys.list(userId) });
94
+ },
95
+ ...options
96
+ });
97
+ }
98
+
99
+ exports.api = api;
100
+ exports.notificationKeys = notificationKeys;
101
+ exports.useCreateNotification = useCreateNotification;
102
+ exports.useDeleteNotification = useDeleteNotification;
103
+ exports.useNotifications = useNotifications;
104
+ exports.useUpdateNotification = useUpdateNotification;
105
+ //# sourceMappingURL=index.cjs.map
106
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts","../src/keys.ts","../src/queries/useNotifications.ts","../src/mutations/useCreateNotification.ts","../src/mutations/useUpdateNotification.ts","../src/mutations/useDeleteNotification.ts"],"names":["axios","useQuery","NotificationsResponseSchema","useQueryClient","useAppMode","useMutation","NotificationCreateSchemaAdmin","NotificationCreateSchemaUser","NotificationSchema","NotificationUpdateSchemaAdmin","NotificationUpdateSchem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B,QAAA,EAAU,gBAAA,CAAiB,IAAA,CAAK,MAAM;AAAA,OACvC,CAAA;AAAA,IACH,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH;AChFO,SAAS,sBACd,OAAA,EACA;AACA,EAAA,MAAM,cAAcL,yBAAAA,EAAe;AAEnC,EAAA,OAAOE,sBAAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,EAAE,MAAA,EAAQ,gBAAe,KAAgC;AAC1E,MAAA,MAAM,IAAI,MAAA,CAAO,CAAA,OAAA,EAAU,MAAM,CAAA,sBAAA,EAAyB,cAAc,CAAA,CAAE,CAAA;AAAA,IAC5E,CAAA;AAAA,IACA,SAAA,EAAW,CAAC,CAAA,EAAG,EAAE,QAAO,KAAM;AAE5B,MAAA,WAAA,CAAY,kBAAkB,EAAE,QAAA,EAAU,iBAAiB,IAAA,CAAK,MAAM,GAAG,CAAA;AAAA,IAC3E,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH","file":"index.cjs","sourcesContent":["import axios from 'axios';\n\n/**\n * Axios instance for Notifications API\n * Base URL configured through environment variables or defaults to relative path\n */\nexport const api = axios.create({\n baseURL: '/api',\n headers: {\n 'Content-Type': 'application/json',\n },\n});\n","/**\n * Query key factory for Notifications domain\n */\nexport const notificationKeys = {\n all: ['notifications'] as const,\n lists: () => [...notificationKeys.all, 'list'] as const,\n list: (userId: string) => [...notificationKeys.lists(), userId] as const,\n};\n","import { useQuery, UseQueryOptions } from '@tanstack/react-query';\nimport { Notification, NotificationsResponseSchema } from '@pfm-platform/shared';\nimport { api } from '../client.js';\nimport { notificationKeys } from '../keys.js';\n\nexport interface UseNotificationsParams {\n userId: string;\n}\n\n/**\n * Fetch all notifications for a user\n * GET /users/:userId/alerts/notifications\n *\n * Notifications are system-generated based on alert configurations\n * Read-only domain (no create/update operations)\n */\nexport function useNotifications(\n { userId }: UseNotificationsParams,\n options?: Omit<UseQueryOptions<Notification[]>, 'queryKey' | 'queryFn'>\n) {\n return useQuery({\n queryKey: notificationKeys.list(userId),\n queryFn: async () => {\n const response = await api.get(`/users/${userId}/alerts/notifications`);\n const validated = NotificationsResponseSchema.parse(response.data);\n return validated.notifications;\n },\n staleTime: 1000 * 60 * 2, // 2 minutes (notifications change frequently)\n ...options,\n });\n}\n","import {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport {\n NotificationCreateSchemaAdmin,\n NotificationCreateSchemaUser,\n NotificationSchema,\n useAppMode,\n type AlertType,\n} from '@pfm-platform/shared';\nimport type { Notification } from '@pfm-platform/shared';\nimport { api } from '../client';\nimport { notificationKeys } from '../keys';\n\n/**\n * Notification create data interface\n */\nexport interface NotificationCreate {\n message: string;\n alert_type: AlertType;\n created_at?: string;\n}\n\n/**\n * Parameters for useCreateNotification mutation\n */\nexport interface CreateNotificationParams {\n userId: string;\n data: NotificationCreate;\n}\n\n/**\n * Mutation hook for creating a new notification\n *\n * Creates a notification manually for testing purposes.\n * Uses mode switching for validation:\n * - Admin mode: Allows manual notification creation for test data\n * - User mode: Blocked (notifications are system-generated)\n *\n * @example\n * ```tsx\n * const createNotification = useCreateNotification();\n *\n * createNotification.mutate({\n * userId: 'user123',\n * data: {\n * message: 'Test notification',\n * alert_type: 'AccountThresholdAlert',\n * created_at: new Date().toISOString() // Optional\n * }\n * });\n * ```\n */\nexport function useCreateNotification(\n options?: Omit<\n UseMutationOptions<Notification, Error, CreateNotificationParams>,\n 'mutationFn'\n >\n) {\n const queryClient = useQueryClient();\n const { mode } = useAppMode();\n\n return useMutation({\n mutationFn: async ({ userId, data }: CreateNotificationParams) => {\n // Select schema based on mode\n const schema =\n mode === 'admin'\n ? NotificationCreateSchemaAdmin\n : NotificationCreateSchemaUser;\n\n // Validate notification data\n const validated = schema.parse(data);\n\n // POST to create new notification\n const response = await api.post(\n `/users/${userId}/alerts/notifications`,\n validated\n );\n\n // Return created notification\n return NotificationSchema.parse(response.data);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications query to refetch updated list\n queryClient.invalidateQueries({\n queryKey: notificationKeys.list(userId),\n });\n },\n ...options,\n });\n}\n","import {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport {\n NotificationUpdateSchemaAdmin,\n NotificationUpdateSchemaUser,\n NotificationSchema,\n useAppMode,\n type AlertType,\n} from '@pfm-platform/shared';\nimport type { Notification } from '@pfm-platform/shared';\nimport { api } from '../client';\nimport { notificationKeys } from '../keys';\n\n/**\n * Notification update data interface\n */\nexport interface NotificationUpdate {\n message?: string;\n alert_type?: AlertType;\n}\n\n/**\n * Parameters for useUpdateNotification mutation\n */\nexport interface UpdateNotificationParams {\n userId: string;\n notificationId: number;\n data: NotificationUpdate;\n}\n\n/**\n * Mutation hook for updating a notification\n *\n * Updates notification fields for testing purposes.\n * Uses mode switching for validation:\n * - Admin mode: Allows updating notifications for test scenarios\n * - User mode: Blocked (notifications are system-generated)\n *\n * @example\n * ```tsx\n * const updateNotification = useUpdateNotification();\n *\n * updateNotification.mutate({\n * userId: 'user123',\n * notificationId: 1,\n * data: {\n * message: 'Updated test notification'\n * }\n * });\n * ```\n */\nexport function useUpdateNotification(\n options?: Omit<\n UseMutationOptions<Notification, Error, UpdateNotificationParams>,\n 'mutationFn'\n >\n) {\n const queryClient = useQueryClient();\n const { mode } = useAppMode();\n\n return useMutation({\n mutationFn: async ({\n userId,\n notificationId,\n data,\n }: UpdateNotificationParams) => {\n // Select schema based on mode\n const schema =\n mode === 'admin'\n ? NotificationUpdateSchemaAdmin\n : NotificationUpdateSchemaUser;\n\n // Validate notification update data\n const validated = schema.parse(data);\n\n // PUT to update notification\n const response = await api.put(\n `/users/${userId}/alerts/notifications/${notificationId}`,\n validated\n );\n\n // Return updated notification\n return NotificationSchema.parse(response.data);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications query to refetch updated list\n queryClient.invalidateQueries({\n queryKey: notificationKeys.list(userId),\n });\n },\n ...options,\n });\n}\n","import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query';\nimport { api } from '../client.js';\nimport { notificationKeys } from '../keys.js';\n\nexport interface DeleteNotificationParams {\n userId: string;\n notificationId: number;\n}\n\n/**\n * Delete a notification\n * DELETE /users/:userId/alerts/notifications/:notificationId\n *\n * Notifications are system-generated, deletion only removes from view\n */\nexport function useDeleteNotification(\n options?: Omit<UseMutationOptions<void, Error, DeleteNotificationParams>, 'mutationFn'>\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ userId, notificationId }: DeleteNotificationParams) => {\n await api.delete(`/users/${userId}/alerts/notifications/${notificationId}`);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications list to refetch without deleted item\n queryClient.invalidateQueries({ queryKey: notificationKeys.list(userId) });\n },\n ...options,\n });\n}\n"]}
@@ -0,0 +1,137 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
3
+ import { Notification, AlertType } from '@pfm-platform/shared';
4
+ import * as axios from 'axios';
5
+
6
+ interface UseNotificationsParams {
7
+ userId: string;
8
+ }
9
+ /**
10
+ * Fetch all notifications for a user
11
+ * GET /users/:userId/alerts/notifications
12
+ *
13
+ * Notifications are system-generated based on alert configurations
14
+ * Read-only domain (no create/update operations)
15
+ */
16
+ declare function useNotifications({ userId }: UseNotificationsParams, options?: Omit<UseQueryOptions<Notification[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<{
17
+ id: number;
18
+ message: string;
19
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
20
+ created_at: string;
21
+ }[], Error>;
22
+
23
+ /**
24
+ * Notification create data interface
25
+ */
26
+ interface NotificationCreate {
27
+ message: string;
28
+ alert_type: AlertType;
29
+ created_at?: string;
30
+ }
31
+ /**
32
+ * Parameters for useCreateNotification mutation
33
+ */
34
+ interface CreateNotificationParams {
35
+ userId: string;
36
+ data: NotificationCreate;
37
+ }
38
+ /**
39
+ * Mutation hook for creating a new notification
40
+ *
41
+ * Creates a notification manually for testing purposes.
42
+ * Uses mode switching for validation:
43
+ * - Admin mode: Allows manual notification creation for test data
44
+ * - User mode: Blocked (notifications are system-generated)
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * const createNotification = useCreateNotification();
49
+ *
50
+ * createNotification.mutate({
51
+ * userId: 'user123',
52
+ * data: {
53
+ * message: 'Test notification',
54
+ * alert_type: 'AccountThresholdAlert',
55
+ * created_at: new Date().toISOString() // Optional
56
+ * }
57
+ * });
58
+ * ```
59
+ */
60
+ declare function useCreateNotification(options?: Omit<UseMutationOptions<Notification, Error, CreateNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<{
61
+ id: number;
62
+ message: string;
63
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
64
+ created_at: string;
65
+ }, Error, CreateNotificationParams, unknown>;
66
+
67
+ /**
68
+ * Notification update data interface
69
+ */
70
+ interface NotificationUpdate {
71
+ message?: string;
72
+ alert_type?: AlertType;
73
+ }
74
+ /**
75
+ * Parameters for useUpdateNotification mutation
76
+ */
77
+ interface UpdateNotificationParams {
78
+ userId: string;
79
+ notificationId: number;
80
+ data: NotificationUpdate;
81
+ }
82
+ /**
83
+ * Mutation hook for updating a notification
84
+ *
85
+ * Updates notification fields for testing purposes.
86
+ * Uses mode switching for validation:
87
+ * - Admin mode: Allows updating notifications for test scenarios
88
+ * - User mode: Blocked (notifications are system-generated)
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * const updateNotification = useUpdateNotification();
93
+ *
94
+ * updateNotification.mutate({
95
+ * userId: 'user123',
96
+ * notificationId: 1,
97
+ * data: {
98
+ * message: 'Updated test notification'
99
+ * }
100
+ * });
101
+ * ```
102
+ */
103
+ declare function useUpdateNotification(options?: Omit<UseMutationOptions<Notification, Error, UpdateNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<{
104
+ id: number;
105
+ message: string;
106
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
107
+ created_at: string;
108
+ }, Error, UpdateNotificationParams, unknown>;
109
+
110
+ interface DeleteNotificationParams {
111
+ userId: string;
112
+ notificationId: number;
113
+ }
114
+ /**
115
+ * Delete a notification
116
+ * DELETE /users/:userId/alerts/notifications/:notificationId
117
+ *
118
+ * Notifications are system-generated, deletion only removes from view
119
+ */
120
+ declare function useDeleteNotification(options?: Omit<UseMutationOptions<void, Error, DeleteNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<void, Error, DeleteNotificationParams, unknown>;
121
+
122
+ /**
123
+ * Query key factory for Notifications domain
124
+ */
125
+ declare const notificationKeys: {
126
+ all: readonly ["notifications"];
127
+ lists: () => readonly ["notifications", "list"];
128
+ list: (userId: string) => readonly ["notifications", "list", string];
129
+ };
130
+
131
+ /**
132
+ * Axios instance for Notifications API
133
+ * Base URL configured through environment variables or defaults to relative path
134
+ */
135
+ declare const api: axios.AxiosInstance;
136
+
137
+ export { type CreateNotificationParams, type DeleteNotificationParams, type NotificationCreate, type NotificationUpdate, type UpdateNotificationParams, type UseNotificationsParams, api, notificationKeys, useCreateNotification, useDeleteNotification, useNotifications, useUpdateNotification };
@@ -0,0 +1,137 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
3
+ import { Notification, AlertType } from '@pfm-platform/shared';
4
+ import * as axios from 'axios';
5
+
6
+ interface UseNotificationsParams {
7
+ userId: string;
8
+ }
9
+ /**
10
+ * Fetch all notifications for a user
11
+ * GET /users/:userId/alerts/notifications
12
+ *
13
+ * Notifications are system-generated based on alert configurations
14
+ * Read-only domain (no create/update operations)
15
+ */
16
+ declare function useNotifications({ userId }: UseNotificationsParams, options?: Omit<UseQueryOptions<Notification[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<{
17
+ id: number;
18
+ message: string;
19
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
20
+ created_at: string;
21
+ }[], Error>;
22
+
23
+ /**
24
+ * Notification create data interface
25
+ */
26
+ interface NotificationCreate {
27
+ message: string;
28
+ alert_type: AlertType;
29
+ created_at?: string;
30
+ }
31
+ /**
32
+ * Parameters for useCreateNotification mutation
33
+ */
34
+ interface CreateNotificationParams {
35
+ userId: string;
36
+ data: NotificationCreate;
37
+ }
38
+ /**
39
+ * Mutation hook for creating a new notification
40
+ *
41
+ * Creates a notification manually for testing purposes.
42
+ * Uses mode switching for validation:
43
+ * - Admin mode: Allows manual notification creation for test data
44
+ * - User mode: Blocked (notifications are system-generated)
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * const createNotification = useCreateNotification();
49
+ *
50
+ * createNotification.mutate({
51
+ * userId: 'user123',
52
+ * data: {
53
+ * message: 'Test notification',
54
+ * alert_type: 'AccountThresholdAlert',
55
+ * created_at: new Date().toISOString() // Optional
56
+ * }
57
+ * });
58
+ * ```
59
+ */
60
+ declare function useCreateNotification(options?: Omit<UseMutationOptions<Notification, Error, CreateNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<{
61
+ id: number;
62
+ message: string;
63
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
64
+ created_at: string;
65
+ }, Error, CreateNotificationParams, unknown>;
66
+
67
+ /**
68
+ * Notification update data interface
69
+ */
70
+ interface NotificationUpdate {
71
+ message?: string;
72
+ alert_type?: AlertType;
73
+ }
74
+ /**
75
+ * Parameters for useUpdateNotification mutation
76
+ */
77
+ interface UpdateNotificationParams {
78
+ userId: string;
79
+ notificationId: number;
80
+ data: NotificationUpdate;
81
+ }
82
+ /**
83
+ * Mutation hook for updating a notification
84
+ *
85
+ * Updates notification fields for testing purposes.
86
+ * Uses mode switching for validation:
87
+ * - Admin mode: Allows updating notifications for test scenarios
88
+ * - User mode: Blocked (notifications are system-generated)
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * const updateNotification = useUpdateNotification();
93
+ *
94
+ * updateNotification.mutate({
95
+ * userId: 'user123',
96
+ * notificationId: 1,
97
+ * data: {
98
+ * message: 'Updated test notification'
99
+ * }
100
+ * });
101
+ * ```
102
+ */
103
+ declare function useUpdateNotification(options?: Omit<UseMutationOptions<Notification, Error, UpdateNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<{
104
+ id: number;
105
+ message: string;
106
+ alert_type: "AccountThresholdAlert" | "GoalAlert" | "MerchantNameAlert" | "SpendingTargetAlert" | "TransactionLimitAlert" | "UpcomingBillAlert";
107
+ created_at: string;
108
+ }, Error, UpdateNotificationParams, unknown>;
109
+
110
+ interface DeleteNotificationParams {
111
+ userId: string;
112
+ notificationId: number;
113
+ }
114
+ /**
115
+ * Delete a notification
116
+ * DELETE /users/:userId/alerts/notifications/:notificationId
117
+ *
118
+ * Notifications are system-generated, deletion only removes from view
119
+ */
120
+ declare function useDeleteNotification(options?: Omit<UseMutationOptions<void, Error, DeleteNotificationParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<void, Error, DeleteNotificationParams, unknown>;
121
+
122
+ /**
123
+ * Query key factory for Notifications domain
124
+ */
125
+ declare const notificationKeys: {
126
+ all: readonly ["notifications"];
127
+ lists: () => readonly ["notifications", "list"];
128
+ list: (userId: string) => readonly ["notifications", "list", string];
129
+ };
130
+
131
+ /**
132
+ * Axios instance for Notifications API
133
+ * Base URL configured through environment variables or defaults to relative path
134
+ */
135
+ declare const api: axios.AxiosInstance;
136
+
137
+ export { type CreateNotificationParams, type DeleteNotificationParams, type NotificationCreate, type NotificationUpdate, type UpdateNotificationParams, type UseNotificationsParams, api, notificationKeys, useCreateNotification, useDeleteNotification, useNotifications, useUpdateNotification };
package/dist/index.js ADDED
@@ -0,0 +1,95 @@
1
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
2
+ import { NotificationsResponseSchema, useAppMode, NotificationCreateSchemaAdmin, NotificationCreateSchemaUser, NotificationSchema, NotificationUpdateSchemaAdmin, NotificationUpdateSchemaUser } from '@pfm-platform/shared';
3
+ import axios from 'axios';
4
+
5
+ // src/queries/useNotifications.ts
6
+ var api = axios.create({
7
+ baseURL: "/api",
8
+ headers: {
9
+ "Content-Type": "application/json"
10
+ }
11
+ });
12
+
13
+ // src/keys.ts
14
+ var notificationKeys = {
15
+ all: ["notifications"],
16
+ lists: () => [...notificationKeys.all, "list"],
17
+ list: (userId) => [...notificationKeys.lists(), userId]
18
+ };
19
+
20
+ // src/queries/useNotifications.ts
21
+ function useNotifications({ userId }, options) {
22
+ return useQuery({
23
+ queryKey: notificationKeys.list(userId),
24
+ queryFn: async () => {
25
+ const response = await api.get(`/users/${userId}/alerts/notifications`);
26
+ const validated = NotificationsResponseSchema.parse(response.data);
27
+ return validated.notifications;
28
+ },
29
+ staleTime: 1e3 * 60 * 2,
30
+ // 2 minutes (notifications change frequently)
31
+ ...options
32
+ });
33
+ }
34
+ function useCreateNotification(options) {
35
+ const queryClient = useQueryClient();
36
+ const { mode } = useAppMode();
37
+ return useMutation({
38
+ mutationFn: async ({ userId, data }) => {
39
+ const schema = mode === "admin" ? NotificationCreateSchemaAdmin : NotificationCreateSchemaUser;
40
+ const validated = schema.parse(data);
41
+ const response = await api.post(
42
+ `/users/${userId}/alerts/notifications`,
43
+ validated
44
+ );
45
+ return NotificationSchema.parse(response.data);
46
+ },
47
+ onSuccess: (_, { userId }) => {
48
+ queryClient.invalidateQueries({
49
+ queryKey: notificationKeys.list(userId)
50
+ });
51
+ },
52
+ ...options
53
+ });
54
+ }
55
+ function useUpdateNotification(options) {
56
+ const queryClient = useQueryClient();
57
+ const { mode } = useAppMode();
58
+ return useMutation({
59
+ mutationFn: async ({
60
+ userId,
61
+ notificationId,
62
+ data
63
+ }) => {
64
+ const schema = mode === "admin" ? NotificationUpdateSchemaAdmin : NotificationUpdateSchemaUser;
65
+ const validated = schema.parse(data);
66
+ const response = await api.put(
67
+ `/users/${userId}/alerts/notifications/${notificationId}`,
68
+ validated
69
+ );
70
+ return NotificationSchema.parse(response.data);
71
+ },
72
+ onSuccess: (_, { userId }) => {
73
+ queryClient.invalidateQueries({
74
+ queryKey: notificationKeys.list(userId)
75
+ });
76
+ },
77
+ ...options
78
+ });
79
+ }
80
+ function useDeleteNotification(options) {
81
+ const queryClient = useQueryClient();
82
+ return useMutation({
83
+ mutationFn: async ({ userId, notificationId }) => {
84
+ await api.delete(`/users/${userId}/alerts/notifications/${notificationId}`);
85
+ },
86
+ onSuccess: (_, { userId }) => {
87
+ queryClient.invalidateQueries({ queryKey: notificationKeys.list(userId) });
88
+ },
89
+ ...options
90
+ });
91
+ }
92
+
93
+ export { api, notificationKeys, useCreateNotification, useDeleteNotification, useNotifications, useUpdateNotification };
94
+ //# sourceMappingURL=index.js.map
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts","../src/keys.ts","../src/queries/useNotifications.ts","../src/mutations/useCreateNotification.ts","../src/mutations/useUpdateNotification.ts","../src/mutations/useDeleteNotification.ts"],"names":["useQueryClient","useAppMode","useMutation","NotificationSchema"],"mappings":";;;;;AAMO,IAAM,GAAA,GAAM,MAAM,MAAA,CAAO;AAAA,EAC9B,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,cAAA,EAAgB;AAAA;AAEpB,CAAC;;;ACRM,IAAM,gBAAA,GAAmB;AAAA,EAC9B,GAAA,EAAK,CAAC,eAAe,CAAA;AAAA,EACrB,OAAO,MAAM,CAAC,GAAG,gBAAA,CAAiB,KAAK,MAAM,CAAA;AAAA,EAC7C,IAAA,E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AA,sBAAA,EAAyB,cAAc,CAAA,CAAE,CAAA;AAAA,IAC5E,CAAA;AAAA,IACA,SAAA,EAAW,CAAC,CAAA,EAAG,EAAE,QAAO,KAAM;AAE5B,MAAA,WAAA,CAAY,kBAAkB,EAAE,QAAA,EAAU,iBAAiB,IAAA,CAAK,MAAM,GAAG,CAAA;AAAA,IAC3E,CAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH","file":"index.js","sourcesContent":["import axios from 'axios';\n\n/**\n * Axios instance for Notifications API\n * Base URL configured through environment variables or defaults to relative path\n */\nexport const api = axios.create({\n baseURL: '/api',\n headers: {\n 'Content-Type': 'application/json',\n },\n});\n","/**\n * Query key factory for Notifications domain\n */\nexport const notificationKeys = {\n all: ['notifications'] as const,\n lists: () => [...notificationKeys.all, 'list'] as const,\n list: (userId: string) => [...notificationKeys.lists(), userId] as const,\n};\n","import { useQuery, UseQueryOptions } from '@tanstack/react-query';\nimport { Notification, NotificationsResponseSchema } from '@pfm-platform/shared';\nimport { api } from '../client.js';\nimport { notificationKeys } from '../keys.js';\n\nexport interface UseNotificationsParams {\n userId: string;\n}\n\n/**\n * Fetch all notifications for a user\n * GET /users/:userId/alerts/notifications\n *\n * Notifications are system-generated based on alert configurations\n * Read-only domain (no create/update operations)\n */\nexport function useNotifications(\n { userId }: UseNotificationsParams,\n options?: Omit<UseQueryOptions<Notification[]>, 'queryKey' | 'queryFn'>\n) {\n return useQuery({\n queryKey: notificationKeys.list(userId),\n queryFn: async () => {\n const response = await api.get(`/users/${userId}/alerts/notifications`);\n const validated = NotificationsResponseSchema.parse(response.data);\n return validated.notifications;\n },\n staleTime: 1000 * 60 * 2, // 2 minutes (notifications change frequently)\n ...options,\n });\n}\n","import {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport {\n NotificationCreateSchemaAdmin,\n NotificationCreateSchemaUser,\n NotificationSchema,\n useAppMode,\n type AlertType,\n} from '@pfm-platform/shared';\nimport type { Notification } from '@pfm-platform/shared';\nimport { api } from '../client';\nimport { notificationKeys } from '../keys';\n\n/**\n * Notification create data interface\n */\nexport interface NotificationCreate {\n message: string;\n alert_type: AlertType;\n created_at?: string;\n}\n\n/**\n * Parameters for useCreateNotification mutation\n */\nexport interface CreateNotificationParams {\n userId: string;\n data: NotificationCreate;\n}\n\n/**\n * Mutation hook for creating a new notification\n *\n * Creates a notification manually for testing purposes.\n * Uses mode switching for validation:\n * - Admin mode: Allows manual notification creation for test data\n * - User mode: Blocked (notifications are system-generated)\n *\n * @example\n * ```tsx\n * const createNotification = useCreateNotification();\n *\n * createNotification.mutate({\n * userId: 'user123',\n * data: {\n * message: 'Test notification',\n * alert_type: 'AccountThresholdAlert',\n * created_at: new Date().toISOString() // Optional\n * }\n * });\n * ```\n */\nexport function useCreateNotification(\n options?: Omit<\n UseMutationOptions<Notification, Error, CreateNotificationParams>,\n 'mutationFn'\n >\n) {\n const queryClient = useQueryClient();\n const { mode } = useAppMode();\n\n return useMutation({\n mutationFn: async ({ userId, data }: CreateNotificationParams) => {\n // Select schema based on mode\n const schema =\n mode === 'admin'\n ? NotificationCreateSchemaAdmin\n : NotificationCreateSchemaUser;\n\n // Validate notification data\n const validated = schema.parse(data);\n\n // POST to create new notification\n const response = await api.post(\n `/users/${userId}/alerts/notifications`,\n validated\n );\n\n // Return created notification\n return NotificationSchema.parse(response.data);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications query to refetch updated list\n queryClient.invalidateQueries({\n queryKey: notificationKeys.list(userId),\n });\n },\n ...options,\n });\n}\n","import {\n useMutation,\n useQueryClient,\n type UseMutationOptions,\n} from '@tanstack/react-query';\nimport {\n NotificationUpdateSchemaAdmin,\n NotificationUpdateSchemaUser,\n NotificationSchema,\n useAppMode,\n type AlertType,\n} from '@pfm-platform/shared';\nimport type { Notification } from '@pfm-platform/shared';\nimport { api } from '../client';\nimport { notificationKeys } from '../keys';\n\n/**\n * Notification update data interface\n */\nexport interface NotificationUpdate {\n message?: string;\n alert_type?: AlertType;\n}\n\n/**\n * Parameters for useUpdateNotification mutation\n */\nexport interface UpdateNotificationParams {\n userId: string;\n notificationId: number;\n data: NotificationUpdate;\n}\n\n/**\n * Mutation hook for updating a notification\n *\n * Updates notification fields for testing purposes.\n * Uses mode switching for validation:\n * - Admin mode: Allows updating notifications for test scenarios\n * - User mode: Blocked (notifications are system-generated)\n *\n * @example\n * ```tsx\n * const updateNotification = useUpdateNotification();\n *\n * updateNotification.mutate({\n * userId: 'user123',\n * notificationId: 1,\n * data: {\n * message: 'Updated test notification'\n * }\n * });\n * ```\n */\nexport function useUpdateNotification(\n options?: Omit<\n UseMutationOptions<Notification, Error, UpdateNotificationParams>,\n 'mutationFn'\n >\n) {\n const queryClient = useQueryClient();\n const { mode } = useAppMode();\n\n return useMutation({\n mutationFn: async ({\n userId,\n notificationId,\n data,\n }: UpdateNotificationParams) => {\n // Select schema based on mode\n const schema =\n mode === 'admin'\n ? NotificationUpdateSchemaAdmin\n : NotificationUpdateSchemaUser;\n\n // Validate notification update data\n const validated = schema.parse(data);\n\n // PUT to update notification\n const response = await api.put(\n `/users/${userId}/alerts/notifications/${notificationId}`,\n validated\n );\n\n // Return updated notification\n return NotificationSchema.parse(response.data);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications query to refetch updated list\n queryClient.invalidateQueries({\n queryKey: notificationKeys.list(userId),\n });\n },\n ...options,\n });\n}\n","import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query';\nimport { api } from '../client.js';\nimport { notificationKeys } from '../keys.js';\n\nexport interface DeleteNotificationParams {\n userId: string;\n notificationId: number;\n}\n\n/**\n * Delete a notification\n * DELETE /users/:userId/alerts/notifications/:notificationId\n *\n * Notifications are system-generated, deletion only removes from view\n */\nexport function useDeleteNotification(\n options?: Omit<UseMutationOptions<void, Error, DeleteNotificationParams>, 'mutationFn'>\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ userId, notificationId }: DeleteNotificationParams) => {\n await api.delete(`/users/${userId}/alerts/notifications/${notificationId}`);\n },\n onSuccess: (_, { userId }) => {\n // Invalidate notifications list to refetch without deleted item\n queryClient.invalidateQueries({ queryKey: notificationKeys.list(userId) });\n },\n ...options,\n });\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@pfm-platform/notifications-data-access",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "dependencies": {
7
+ "axios": "^1.13.2",
8
+ "zod": "4.1.12",
9
+ "@pfm-platform/shared": "0.0.1"
10
+ },
11
+ "devDependencies": {
12
+ "@testing-library/react": "^16.3.0",
13
+ "@vitejs/plugin-react": "^5.1.1",
14
+ "@vitest/coverage-v8": "^4.0.9",
15
+ "jsdom": "^27.2.0",
16
+ "react-dom": "19.2.0",
17
+ "typescript": "5.9.3",
18
+ "vitest": "4.0.9"
19
+ },
20
+ "module": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "description": "Personal Finance Management - NOTIFICATIONS data-access layer",
34
+ "keywords": [
35
+ "pfm",
36
+ "finance",
37
+ "notifications",
38
+ "data-access",
39
+ "react",
40
+ "typescript"
41
+ ],
42
+ "author": "Lenny Miller",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/lennylmiller/pfm-research",
47
+ "directory": "packages/notifications/data-access"
48
+ },
49
+ "bugs": "https://github.com/lennylmiller/pfm-research/issues",
50
+ "homepage": "https://github.com/lennylmiller/pfm-research#readme",
51
+ "peerDependencies": {
52
+ "@tanstack/react-query": "5.90.9",
53
+ "react": "19.2.0"
54
+ },
55
+ "scripts": {
56
+ "test": "vitest run",
57
+ "test:watch": "vitest",
58
+ "test:coverage": "vitest run --coverage",
59
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean"
60
+ }
61
+ }