@plyaz/api 1.7.4 → 1.8.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/api/endpoints/index.d.ts +9 -0
- package/dist/api/endpoints/index.d.ts.map +1 -1
- package/dist/api/endpoints/notification.d.ts +72 -0
- package/dist/api/endpoints/notification.d.ts.map +1 -0
- package/dist/api/queue/BatchProcessor.d.ts.map +1 -1
- package/dist/api/services/index.d.ts +1 -0
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/notification/DELETE/deleteNotification.d.ts +25 -0
- package/dist/api/services/notification/DELETE/deleteNotification.d.ts.map +1 -0
- package/dist/api/services/notification/DELETE/index.d.ts +12 -0
- package/dist/api/services/notification/DELETE/index.d.ts.map +1 -0
- package/dist/api/services/notification/DELETE/useDeleteNotification.d.ts +34 -0
- package/dist/api/services/notification/DELETE/useDeleteNotification.d.ts.map +1 -0
- package/dist/api/services/notification/GET/fetchNotifications.d.ts +26 -0
- package/dist/api/services/notification/GET/fetchNotifications.d.ts.map +1 -0
- package/dist/api/services/notification/GET/index.d.ts +12 -0
- package/dist/api/services/notification/GET/index.d.ts.map +1 -0
- package/dist/api/services/notification/GET/useNotifications.d.ts +32 -0
- package/dist/api/services/notification/GET/useNotifications.d.ts.map +1 -0
- package/dist/api/services/notification/index.d.ts +14 -0
- package/dist/api/services/notification/index.d.ts.map +1 -0
- package/dist/entry-frontend.cjs +102 -4
- package/dist/entry-frontend.cjs.map +1 -1
- package/dist/entry-frontend.mjs +98 -5
- package/dist/entry-frontend.mjs.map +1 -1
- package/dist/index.cjs +102 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +98 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
* This is passed to createApiClient to generate endpoint methods
|
|
8
8
|
*/
|
|
9
9
|
export declare const endpoints: {
|
|
10
|
+
readonly listNotifications: {
|
|
11
|
+
readonly url: "/notifications";
|
|
12
|
+
readonly method: "GET";
|
|
13
|
+
};
|
|
14
|
+
readonly deleteNotification: {
|
|
15
|
+
readonly url: "/notifications/:id";
|
|
16
|
+
readonly method: "DELETE";
|
|
17
|
+
};
|
|
10
18
|
readonly fastlyPurgeUrl: {
|
|
11
19
|
readonly url: "/service/:serviceId/purge/:url";
|
|
12
20
|
readonly method: "POST";
|
|
@@ -256,4 +264,5 @@ export { cdnEndpoints, cloudflareEndpoints, cloudFrontEndpoints, fastlyEndpoints
|
|
|
256
264
|
*/
|
|
257
265
|
export { getEndpointUrl, getAllEndpointUrls, hasEndpoint, getEndpointConfig, buildEndpointUrl, getEndpointParams, hasPathParams, getEndpointMetadata, buildUrl, extractUrlParams, } from './utils';
|
|
258
266
|
export { endpointCacheKey, endpointCachePattern, findEndpointsByPattern, getEndpointsByMethod, endpointCachePatterns, buildFullUrl, validatePathParams, } from './builders';
|
|
267
|
+
export { notificationEndpoints } from './notification';
|
|
259
268
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC;AAE7C;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEhG;;GAEG;AACH,OAAO,EAEL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* ENDPOINT DEFINITIONS - Notification
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Location: @plyaz/api/src/api/endpoints/notification.ts
|
|
7
|
+
*
|
|
8
|
+
* ============================================================================
|
|
9
|
+
* TODO: INTEGRATION STEPS (REQUIRED)
|
|
10
|
+
* ============================================================================
|
|
11
|
+
*
|
|
12
|
+
* 1. UPDATE @plyaz/api/src/api/endpoints/index.ts:
|
|
13
|
+
*
|
|
14
|
+
* // Add import at top:
|
|
15
|
+
* import { notificationEndpoints } from './notification';
|
|
16
|
+
*
|
|
17
|
+
* // Add to endpoints object:
|
|
18
|
+
* export const endpoints = {
|
|
19
|
+
* ...notificationEndpoints,
|
|
20
|
+
* // ... other endpoints
|
|
21
|
+
* } as const;
|
|
22
|
+
*
|
|
23
|
+
* // Add export for selective imports:
|
|
24
|
+
* export { notificationEndpoints } from './notification';
|
|
25
|
+
*
|
|
26
|
+
* 2. UPDATE @plyaz/types/src/api/endpoints/types.ts:
|
|
27
|
+
*
|
|
28
|
+
* // Add import:
|
|
29
|
+
* import type { NotificationEndpointTypes } from './notification';
|
|
30
|
+
*
|
|
31
|
+
* // Extend EndpointTypes interface:
|
|
32
|
+
* export interface EndpointTypes
|
|
33
|
+
* extends CampaignEndpointTypes,
|
|
34
|
+
* // ... other types
|
|
35
|
+
* NotificationEndpointTypes { // <-- ADD THIS
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* ============================================================================
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Notification API Endpoints
|
|
42
|
+
*
|
|
43
|
+
* Available endpoints:
|
|
44
|
+
* - [x] GET /notifications - listNotifications
|
|
45
|
+
* - [x] DELETE /notifications/:id - deleteNotification
|
|
46
|
+
*
|
|
47
|
+
* Note: Notifications are created via @plyaz/notifications package,
|
|
48
|
+
* not directly via API. No POST/PUT/PATCH/GET-by-ID endpoints.
|
|
49
|
+
*/
|
|
50
|
+
export declare const notificationEndpoints: {
|
|
51
|
+
/**
|
|
52
|
+
* GET /notifications
|
|
53
|
+
* List all notifications with optional filters
|
|
54
|
+
*/
|
|
55
|
+
readonly listNotifications: {
|
|
56
|
+
readonly url: "/notifications";
|
|
57
|
+
readonly method: "GET";
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* DELETE /notifications/:id
|
|
61
|
+
* Delete a notification
|
|
62
|
+
*/
|
|
63
|
+
readonly deleteNotification: {
|
|
64
|
+
readonly url: "/notifications/:id";
|
|
65
|
+
readonly method: "DELETE";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Type for Notification endpoint keys
|
|
70
|
+
*/
|
|
71
|
+
export type NotificationEndpointKey = keyof typeof notificationEndpoints;
|
|
72
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/notification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;IAKhC;;;OAGG;;;;;IAUH;;;OAGG;;;;;CAKK,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchProcessor.d.ts","sourceRoot":"","sources":["../../../src/api/queue/BatchProcessor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;GAEG;AACH,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO;IACrC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"BatchProcessor.d.ts","sourceRoot":"","sources":["../../../src/api/queue/BatchProcessor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;GAEG;AACH,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO;IACrC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,KAAK,CAAC,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAI3C;;OAEG;IACI,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI;IAU9C;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBnC;;OAEG;IACI,IAAI,IAAI,MAAM;IAIrB;;OAEG;IACI,KAAK,IAAI,IAAI;IAQpB;;OAEG;IACI,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrE,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,OAAO,CAAC;AAGtB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrE,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,OAAO,CAAC;AAGtB,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete Notification Service
|
|
3
|
+
* Deletes a notification by ID
|
|
4
|
+
*/
|
|
5
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
/**
|
|
9
|
+
* Delete a notification
|
|
10
|
+
*
|
|
11
|
+
* @param id - Notification ID to delete
|
|
12
|
+
* @param options - Service options (apiClient, apiConfig)
|
|
13
|
+
* @returns Promise resolving to deletion confirmation
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const response = await deleteNotification(
|
|
18
|
+
* '123',
|
|
19
|
+
* { apiClient: myClient }
|
|
20
|
+
* );
|
|
21
|
+
* console.log(response.success);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function deleteNotification<TEndpoints = EndpointsList>(id: string, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
25
|
+
//# sourceMappingURL=deleteNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteNotification.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/DELETE/deleteNotification.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,GAAG,aAAa,EACjE,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* DELETE operations for Notification
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Location: @plyaz/api/src/api/services/notification/DELETE/index.ts
|
|
7
|
+
*
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
export { deleteNotification } from './deleteNotification';
|
|
11
|
+
export { useDeleteNotification } from './useDeleteNotification';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/DELETE/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Mutation Hook for Deleting Notifications
|
|
3
|
+
* Provides mutation state and cache invalidation
|
|
4
|
+
*/
|
|
5
|
+
import { createApiMutation } from '../../../hooks/factories';
|
|
6
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
7
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
8
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
9
|
+
import type { DeleteNotificationResponse } from '@plyaz/types/api';
|
|
10
|
+
/**
|
|
11
|
+
* Hook for deleting notifications
|
|
12
|
+
*
|
|
13
|
+
* @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
|
|
14
|
+
* @param mutationOptions - React Query mutation options
|
|
15
|
+
* @returns React Query mutation result
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const { mutate, isPending } = useDeleteNotification();
|
|
20
|
+
*
|
|
21
|
+
* const handleDelete = (notificationId: string) => {
|
|
22
|
+
* mutate(notificationId, {
|
|
23
|
+
* onSuccess: () => {
|
|
24
|
+
* toast.success('Notification deleted');
|
|
25
|
+
* },
|
|
26
|
+
* onError: (error) => {
|
|
27
|
+
* toast.error(`Failed to delete: ${error.message}`);
|
|
28
|
+
* }
|
|
29
|
+
* });
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useDeleteNotification<TEndpoints = EndpointsList>(serviceOptions?: ServiceOptions<TEndpoints>, mutationOptions?: Parameters<ReturnType<typeof createApiMutation<DeleteNotificationResponse, ErrorResponse, string, unknown, TEndpoints>>>[1]): ReturnType<ReturnType<typeof createApiMutation<DeleteNotificationResponse, ErrorResponse, string, unknown, TEndpoints>>>;
|
|
34
|
+
//# sourceMappingURL=useDeleteNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteNotification.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/DELETE/useDeleteNotification.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,GAAG,aAAa,EAC9D,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,eAAe,CAAC,EAAE,UAAU,CAC1B,UAAU,CACR,OAAO,iBAAiB,CACtB,0BAA0B,EAC1B,aAAa,EACb,MAAM,EACN,OAAO,EACP,UAAU,CACX,CACF,CACF,CAAC,CAAC,CAAC,GACH,UAAU,CACX,UAAU,CACR,OAAO,iBAAiB,CAAC,0BAA0B,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CACjG,CACF,CAoBA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch Notifications Service
|
|
3
|
+
* Lists notifications with optional filters
|
|
4
|
+
*/
|
|
5
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
import type { ListNotificationFilters } from '@plyaz/types/api';
|
|
9
|
+
/**
|
|
10
|
+
* Fetch list of notifications with optional filters
|
|
11
|
+
*
|
|
12
|
+
* @param filters - Optional query filters (page, limit, status, etc.)
|
|
13
|
+
* @param options - Service options (apiClient, apiConfig)
|
|
14
|
+
* @returns Promise resolving to paginated list of notifications
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const response = await fetchNotifications(
|
|
19
|
+
* { page: 1, limit: 20, status: 'sent' },
|
|
20
|
+
* { apiClient: myClient }
|
|
21
|
+
* );
|
|
22
|
+
* console.log(response.data, response.pagination);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchNotifications<TEndpoints = EndpointsList>(filters?: ListNotificationFilters, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
26
|
+
//# sourceMappingURL=fetchNotifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchNotifications.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/GET/fetchNotifications.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,GAAG,aAAa,EACjE,OAAO,CAAC,EAAE,uBAAuB,EACjC,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CAkBxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* GET operations for Notification
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Location: @plyaz/api/src/api/services/notification/GET/index.ts
|
|
7
|
+
*
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
export { fetchNotifications } from './fetchNotifications';
|
|
11
|
+
export { useNotifications } from './useNotifications';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/GET/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Hook for Listing Notifications
|
|
3
|
+
* Provides query state and caching
|
|
4
|
+
*/
|
|
5
|
+
import type { ServiceOptions, QueryKey, UseQueryResult, ApiQueryOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { ListNotificationFilters, ListNotificationResponse } from '@plyaz/types/api';
|
|
7
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
8
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
9
|
+
/**
|
|
10
|
+
* Hook for fetching list of notifications
|
|
11
|
+
*
|
|
12
|
+
* @param queryKey - React Query cache key
|
|
13
|
+
* @param filters - Optional query filters (page, limit, status, etc.)
|
|
14
|
+
* @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
|
|
15
|
+
* @param queryOptions - React Query options
|
|
16
|
+
* @returns React Query result
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const { data, isLoading } = useNotifications(
|
|
21
|
+
* ['notifications', { page: 1 }],
|
|
22
|
+
* { page: 1, limit: 20, status: 'sent' },
|
|
23
|
+
* undefined,
|
|
24
|
+
* { enabled: true }
|
|
25
|
+
* );
|
|
26
|
+
*
|
|
27
|
+
* if (isLoading) return <Spinner />;
|
|
28
|
+
* return <div>{data?.data.length} notifications</div>;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useNotifications<TEndpoints = EndpointsList>(queryKey: QueryKey, filters?: ListNotificationFilters, serviceOptions?: ServiceOptions<TEndpoints>, queryOptions?: Omit<ApiQueryOptions<ListNotificationResponse, ErrorResponse>, 'apiClient' | 'apiConfig'>): UseQueryResult<ListNotificationResponse, ErrorResponse>;
|
|
32
|
+
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/notification/GET/useNotifications.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,aAAa,EACzD,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,uBAAuB,EACjC,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,CAAC,wBAAwB,EAAE,aAAa,CAAC,EACxD,WAAW,GAAG,WAAW,CAC1B,GACA,cAAc,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAczD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* SERVICE INDEX - Notification
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Location: @plyaz/api/src/api/services/notification/index.ts
|
|
7
|
+
*
|
|
8
|
+
* Aggregates all notification operations
|
|
9
|
+
*
|
|
10
|
+
* ============================================================================
|
|
11
|
+
*/
|
|
12
|
+
export * from './GET';
|
|
13
|
+
export * from './DELETE';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/services/notification/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
|
package/dist/entry-frontend.cjs
CHANGED
|
@@ -954,10 +954,10 @@ var BatchProcessor = class {
|
|
|
954
954
|
*/
|
|
955
955
|
scheduleFlush() {
|
|
956
956
|
if (this.timer) return;
|
|
957
|
-
this.timer =
|
|
957
|
+
this.timer = setTimeout(() => {
|
|
958
958
|
this.timer = void 0;
|
|
959
959
|
void this.flush();
|
|
960
|
-
});
|
|
960
|
+
}, 0);
|
|
961
961
|
}
|
|
962
962
|
/**
|
|
963
963
|
* Flush the current batch
|
|
@@ -989,7 +989,7 @@ var BatchProcessor = class {
|
|
|
989
989
|
clear() {
|
|
990
990
|
this.batch.length = 0;
|
|
991
991
|
if (this.timer) {
|
|
992
|
-
|
|
992
|
+
clearTimeout(this.timer);
|
|
993
993
|
this.timer = void 0;
|
|
994
994
|
}
|
|
995
995
|
}
|
|
@@ -14247,6 +14247,32 @@ var cdnEndpoints = {
|
|
|
14247
14247
|
...fastlyEndpoints
|
|
14248
14248
|
};
|
|
14249
14249
|
|
|
14250
|
+
// src/api/endpoints/notification.ts
|
|
14251
|
+
var notificationEndpoints = {
|
|
14252
|
+
// ==========================================================================
|
|
14253
|
+
// GET ENDPOINTS
|
|
14254
|
+
// ==========================================================================
|
|
14255
|
+
/**
|
|
14256
|
+
* GET /notifications
|
|
14257
|
+
* List all notifications with optional filters
|
|
14258
|
+
*/
|
|
14259
|
+
listNotifications: {
|
|
14260
|
+
url: "/notifications",
|
|
14261
|
+
method: "GET"
|
|
14262
|
+
},
|
|
14263
|
+
// ==========================================================================
|
|
14264
|
+
// DELETE ENDPOINTS
|
|
14265
|
+
// ==========================================================================
|
|
14266
|
+
/**
|
|
14267
|
+
* DELETE /notifications/:id
|
|
14268
|
+
* Delete a notification
|
|
14269
|
+
*/
|
|
14270
|
+
deleteNotification: {
|
|
14271
|
+
url: "/notifications/:id",
|
|
14272
|
+
method: "DELETE"
|
|
14273
|
+
}
|
|
14274
|
+
};
|
|
14275
|
+
|
|
14250
14276
|
// src/api/endpoints/utils.ts
|
|
14251
14277
|
function getEndpointUrl(name) {
|
|
14252
14278
|
return endpoints[name].url;
|
|
@@ -14431,7 +14457,8 @@ var endpoints = {
|
|
|
14431
14457
|
// CDN provider endpoints (Cloudflare, CloudFront, Fastly)
|
|
14432
14458
|
...cloudflareEndpoints,
|
|
14433
14459
|
...cloudFrontEndpoints,
|
|
14434
|
-
...fastlyEndpoints
|
|
14460
|
+
...fastlyEndpoints,
|
|
14461
|
+
...notificationEndpoints
|
|
14435
14462
|
};
|
|
14436
14463
|
var isSlowConnection = fetchff.isSlowConnection;
|
|
14437
14464
|
function isNetworkAPISupported() {
|
|
@@ -23986,6 +24013,72 @@ function useDeleteFile(serviceOptions, mutationOptions) {
|
|
|
23986
24013
|
})(serviceOptions, mutationOptions);
|
|
23987
24014
|
}
|
|
23988
24015
|
__name(useDeleteFile, "useDeleteFile");
|
|
24016
|
+
|
|
24017
|
+
// src/api/services/notification/GET/fetchNotifications.ts
|
|
24018
|
+
async function fetchNotifications(filters, options) {
|
|
24019
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
24020
|
+
const serviceDefaults = { unifiedStrategy: "interactive" };
|
|
24021
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
24022
|
+
const updateOptions = {
|
|
24023
|
+
strategy: "temporary",
|
|
24024
|
+
...options?.updateConfigOptions
|
|
24025
|
+
};
|
|
24026
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
24027
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
24028
|
+
}
|
|
24029
|
+
return client.listNotifications({
|
|
24030
|
+
params: filters
|
|
24031
|
+
});
|
|
24032
|
+
}
|
|
24033
|
+
__name(fetchNotifications, "fetchNotifications");
|
|
24034
|
+
function useNotifications(queryKey, filters, serviceOptions, queryOptions) {
|
|
24035
|
+
return createApiQuery(fetchNotifications, {
|
|
24036
|
+
apiConfig: {
|
|
24037
|
+
unifiedStrategy: "interactive"
|
|
24038
|
+
},
|
|
24039
|
+
staleTime: config.TIME_CONSTANTS.TEN_MINUTES
|
|
24040
|
+
})(queryKey, filters, serviceOptions, queryOptions);
|
|
24041
|
+
}
|
|
24042
|
+
__name(useNotifications, "useNotifications");
|
|
24043
|
+
|
|
24044
|
+
// src/api/services/notification/DELETE/deleteNotification.ts
|
|
24045
|
+
async function deleteNotification(id, options) {
|
|
24046
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
24047
|
+
const serviceDefaults = {
|
|
24048
|
+
unifiedStrategy: "mutation"
|
|
24049
|
+
};
|
|
24050
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
24051
|
+
const updateOptions = {
|
|
24052
|
+
strategy: "temporary",
|
|
24053
|
+
...options?.updateConfigOptions
|
|
24054
|
+
};
|
|
24055
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
24056
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
24057
|
+
}
|
|
24058
|
+
const pathParams = { id };
|
|
24059
|
+
return client.deleteNotification({
|
|
24060
|
+
urlPathParams: pathParams
|
|
24061
|
+
});
|
|
24062
|
+
}
|
|
24063
|
+
__name(deleteNotification, "deleteNotification");
|
|
24064
|
+
function useDeleteNotification(serviceOptions, mutationOptions) {
|
|
24065
|
+
const queryClient = reactQuery.useQueryClient();
|
|
24066
|
+
return createApiMutation(
|
|
24067
|
+
deleteNotification,
|
|
24068
|
+
{
|
|
24069
|
+
onSuccess: /* @__PURE__ */ __name((_data, id) => {
|
|
24070
|
+
void queryClient.invalidateQueries({
|
|
24071
|
+
queryKey: ["notifications"]
|
|
24072
|
+
});
|
|
24073
|
+
queryClient.removeQueries({
|
|
24074
|
+
queryKey: ["notification", id]
|
|
24075
|
+
});
|
|
24076
|
+
}, "onSuccess"),
|
|
24077
|
+
...mutationOptions
|
|
24078
|
+
}
|
|
24079
|
+
)(serviceOptions, mutationOptions);
|
|
24080
|
+
}
|
|
24081
|
+
__name(useDeleteNotification, "useDeleteNotification");
|
|
23989
24082
|
function useApiConfigConflicts(client, options = {}) {
|
|
23990
24083
|
const [conflicts, setConflicts] = react.useState([]);
|
|
23991
24084
|
const [isChecking, setIsChecking] = react.useState(false);
|
|
@@ -26606,6 +26699,7 @@ exports.deleteCache = deleteCache;
|
|
|
26606
26699
|
exports.deleteCampaign = deleteCampaign;
|
|
26607
26700
|
exports.deleteFeatureFlag = deleteFeatureFlag;
|
|
26608
26701
|
exports.deleteFile = deleteFile;
|
|
26702
|
+
exports.deleteNotification = deleteNotification;
|
|
26609
26703
|
exports.detectConfigConflicts = detectConfigConflicts;
|
|
26610
26704
|
exports.detectConflicts = detectConflicts;
|
|
26611
26705
|
exports.detectPlatform = detectPlatform;
|
|
@@ -26640,6 +26734,7 @@ exports.fetchInfobipEmailReports = fetchInfobipEmailReports;
|
|
|
26640
26734
|
exports.fetchInfobipScheduledEmailStatuses = fetchInfobipScheduledEmailStatuses;
|
|
26641
26735
|
exports.fetchInfobipScheduledEmails = fetchInfobipScheduledEmails;
|
|
26642
26736
|
exports.fetchInfobipValidations = fetchInfobipValidations;
|
|
26737
|
+
exports.fetchNotifications = fetchNotifications;
|
|
26643
26738
|
exports.filesEndpoints = filesEndpoints;
|
|
26644
26739
|
exports.filterHistory = filterHistory;
|
|
26645
26740
|
exports.filterObject = filterObject;
|
|
@@ -26896,6 +26991,7 @@ exports.networkConfigManager = networkConfigManager;
|
|
|
26896
26991
|
exports.networkPresets = networkPresets;
|
|
26897
26992
|
exports.networkStatus = networkStatus;
|
|
26898
26993
|
exports.normalizeHeaders = normalizeHeaders2;
|
|
26994
|
+
exports.notificationEndpoints = notificationEndpoints;
|
|
26899
26995
|
exports.now = now;
|
|
26900
26996
|
exports.nowInSeconds = nowInSeconds;
|
|
26901
26997
|
exports.omit = omit;
|
|
@@ -27017,6 +27113,7 @@ exports.useDebouncedSubscription = useDebouncedSubscription;
|
|
|
27017
27113
|
exports.useDeleteCampaign = useDeleteCampaign;
|
|
27018
27114
|
exports.useDeleteFeatureFlag = useDeleteFeatureFlag;
|
|
27019
27115
|
exports.useDeleteFile = useDeleteFile;
|
|
27116
|
+
exports.useDeleteNotification = useDeleteNotification;
|
|
27020
27117
|
exports.useDownloadFile = useDownloadFile;
|
|
27021
27118
|
exports.useEvaluateAllFeatureFlags = useEvaluateAllFeatureFlags;
|
|
27022
27119
|
exports.useGenerateDocument = useGenerateDocument;
|
|
@@ -27025,6 +27122,7 @@ exports.useGetSignedUrl = useGetSignedUrl;
|
|
|
27025
27122
|
exports.useJoinCampaign = useJoinCampaign;
|
|
27026
27123
|
exports.useLeaveCampaign = useLeaveCampaign;
|
|
27027
27124
|
exports.useMultipleSubscriptions = useMultipleSubscriptions;
|
|
27125
|
+
exports.useNotifications = useNotifications;
|
|
27028
27126
|
exports.useOptimisticUpdate = useOptimisticUpdate;
|
|
27029
27127
|
exports.useRealTimeData = useRealTimeData;
|
|
27030
27128
|
exports.useRemoveFeatureFlagOverride = useRemoveFeatureFlagOverride;
|