@codingfactory/notify-kit-client 0.1.0 → 0.2.2

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/nuxt/module.ts","../../src/nuxt/composables.ts","../../src/nuxt/index.ts"],"names":[],"mappings":";;;;AA8CA,IAAO,iBAAQ,gBAAA,CAAyC;AAAA,EACtD,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,SAAA,EAAW,WAAA;AAAA,IACX,aAAA,EAAe;AAAA,MACb,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAA,EAAS,iBAAA;AAAA,IACT,WAAA,EAAa;AAAA,GACf;AAAA,EACA,KAAA,CAAM,SAAS,IAAA,EAAM;AACnB,IAAA,MAAM,QAAA,GAAW,cAAA,CAAe,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAG/C,IAAA,MAAM,YAAA,GAAe,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA;AAChD,IAAA,MAAM,iBAAA,GAAoB,aAAa,WAAW,CAAA;AAElD,IAAA,YAAA,CAAa,WAAW,CAAA,GAAI;AAAA,MAC1B,SAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,GAAG;AAAA,KACL;AAGA,IAAA,SAAA,CAAU;AAAA,MACR,GAAA,EAAK,QAAA,CAAS,OAAA,CAAQ,UAAU,CAAA;AAAA,MAChC,IAAA,EAAM;AAAA;AAAA,KACP,CAAA;AAGD,IAAA,UAAA,CAAW;AAAA,MACT;AAAA,QACE,IAAA,EAAM,kBAAA;AAAA,QACN,IAAA,EAAM,QAAA,CAAS,OAAA,CAAQ,eAAe;AAAA;AACxC,KACD,CAAA;AAAA,EACH;AACF,CAAC;ACjCM,SAAS,gBAAA,GAA2C;AACzD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,UAAA,EAAW;AAClC,EAAA,MAAM,QAAQ,iBAAA,EAAkB;AAChC,EAAA,MAAM,MAAA,GAAS,kBAAA,CAAmB,EAAE,MAAA,EAAQ,YAAY,CAAA;AAExD,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,UAAA;AAAA,IACR,MAAA;AAAA,IACA,GAAG;AAAA,GACL;AACF;;;AC3CO,IAAM,mBAAA,GAAsB","file":"index.js","sourcesContent":["/**\n * Nuxt Module for @coding-factory/notify-kit-client\n *\n * This module sets up the NotifyKit client for use in Nuxt 3 applications.\n * It registers the runtime plugin and provides type declarations.\n *\n * @example\n * ```typescript\n * // nuxt.config.ts\n * export default defineNuxtConfig({\n * modules: ['@coding-factory/notify-kit-client/nuxt'],\n * runtimeConfig: {\n * public: {\n * notifyKit: {\n * baseUrl: '/api/notify-kit',\n * }\n * }\n * }\n * })\n * ```\n */\n\nimport { defineNuxtModule, addPlugin, createResolver, addImports } from '@nuxt/kit';\n\n/**\n * Module options schema.\n */\nexport interface NotifyKitModuleOptions {\n /**\n * Base URL for the NotifyKit API.\n * Can be relative (e.g., '/api/notify-kit') or absolute.\n * @default '/api/notify-kit'\n */\n baseUrl?: string;\n\n /**\n * Whether to automatically connect to real-time notifications.\n * Only applies on client-side.\n * @default true\n */\n autoConnect?: boolean;\n}\n\n/**\n * The NotifyKit Nuxt module.\n */\nexport default defineNuxtModule<NotifyKitModuleOptions>({\n meta: {\n name: '@coding-factory/notify-kit-client',\n configKey: 'notifyKit',\n compatibility: {\n nuxt: '>=3.0.0',\n },\n },\n defaults: {\n baseUrl: '/api/notify-kit',\n autoConnect: true,\n },\n setup(options, nuxt) {\n const resolver = createResolver(import.meta.url);\n\n // Add public runtime config\n const publicConfig = nuxt.options.runtimeConfig.public as Record<string, unknown>;\n const existingNotifyKit = publicConfig['notifyKit'] as NotifyKitModuleOptions | undefined;\n\n publicConfig['notifyKit'] = {\n baseUrl: options.baseUrl,\n autoConnect: options.autoConnect,\n ...existingNotifyKit,\n };\n\n // Add the plugin\n addPlugin({\n src: resolver.resolve('./plugin'),\n mode: 'all', // Plugin handles SSR safety internally\n });\n\n // Add auto-imports for composables\n addImports([\n {\n name: 'useNotifyKitNuxt',\n from: resolver.resolve('./composables'),\n },\n ]);\n },\n});\n","/**\n * Nuxt Composables for @coding-factory/notify-kit-client\n *\n * Provides a unified composable that combines the client with store\n * and modal management for Nuxt applications.\n */\n\nimport { useNuxtApp } from '#app';\nimport { useNotifyKitStore, type UseNotifyKitStoreReturn } from '../composables/useNotifyKitStore';\nimport { useNotifyKitModals, type UseNotifyKitModalsReturn } from '../composables/useNotifyKitModals';\nimport type { NotifyKitClient } from '../client';\n\n/**\n * Return type of useNotifyKitNuxt composable.\n */\nexport interface UseNotifyKitNuxtReturn extends UseNotifyKitStoreReturn {\n /** The NotifyKit client instance */\n readonly client: NotifyKitClient;\n\n /** Modal management functions */\n readonly modals: UseNotifyKitModalsReturn;\n}\n\n/**\n * Unified composable for NotifyKit in Nuxt applications.\n *\n * Combines access to the client, store, and modal management\n * in a single composable.\n *\n * @example\n * ```typescript\n * const {\n * client,\n * state,\n * hasUnread,\n * modals,\n * } = useNotifyKitNuxt()\n *\n * // Access notifications\n * await client.listNotifications()\n *\n * // Check unread status\n * if (hasUnread.value) {\n * // Show badge\n * }\n *\n * // Handle modals\n * if (modals.hasModals.value) {\n * await modals.dismissCurrent()\n * }\n * ```\n */\nexport function useNotifyKitNuxt(): UseNotifyKitNuxtReturn {\n const { $notifyKit } = useNuxtApp();\n const store = useNotifyKitStore();\n const modals = useNotifyKitModals({ client: $notifyKit });\n\n return {\n client: $notifyKit,\n modals,\n ...store,\n };\n}\n","/**\n * Nuxt module exports for @coding-factory/notify-kit-client\n *\n * Usage in nuxt.config.ts:\n * ```typescript\n * export default defineNuxtConfig({\n * modules: ['@coding-factory/notify-kit-client/nuxt'],\n * runtimeConfig: {\n * public: {\n * notifyKit: {\n * baseUrl: '/api/notify-kit',\n * }\n * }\n * }\n * })\n * ```\n */\n\n// Module version\nexport const NUXT_MODULE_VERSION = '0.1.0';\n\n// Module\nexport { default } from './module';\nexport type { NotifyKitModuleOptions } from './module';\n\n// Composables\nexport { useNotifyKitNuxt } from './composables';\nexport type { UseNotifyKitNuxtReturn } from './composables';\n"]}
1
+ {"version":3,"sources":["../../src/nuxt/module.ts","../../src/nuxt/composables.ts","../../src/nuxt/index.ts"],"names":[],"mappings":";;;;AA8CA,IAAO,iBAAQ,gBAAA,CAAyC;AAAA,EACtD,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,mCAAA;AAAA,IACN,SAAA,EAAW,WAAA;AAAA,IACX,aAAA,EAAe;AAAA,MACb,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAA,EAAS,iBAAA;AAAA,IACT,WAAA,EAAa;AAAA,GACf;AAAA,EACA,KAAA,CAAM,SAAS,IAAA,EAAM;AACnB,IAAA,MAAM,QAAA,GAAW,cAAA,CAAe,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAG/C,IAAA,MAAM,YAAA,GAAe,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA;AAChD,IAAA,MAAM,iBAAA,GAAoB,aAAa,WAAW,CAAA;AAElD,IAAA,YAAA,CAAa,WAAW,CAAA,GAAI;AAAA,MAC1B,SAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,GAAG;AAAA,KACL;AAGA,IAAA,SAAA,CAAU;AAAA,MACR,GAAA,EAAK,QAAA,CAAS,OAAA,CAAQ,UAAU,CAAA;AAAA,MAChC,IAAA,EAAM;AAAA;AAAA,KACP,CAAA;AAGD,IAAA,UAAA,CAAW;AAAA,MACT;AAAA,QACE,IAAA,EAAM,kBAAA;AAAA,QACN,IAAA,EAAM,QAAA,CAAS,OAAA,CAAQ,eAAe;AAAA;AACxC,KACD,CAAA;AAAA,EACH;AACF,CAAC;ACjCM,SAAS,gBAAA,GAA2C;AACzD,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,UAAA,EAAW;AAClC,EAAA,MAAM,QAAQ,iBAAA,EAAkB;AAChC,EAAA,MAAM,MAAA,GAAS,kBAAA,CAAmB,EAAE,MAAA,EAAQ,YAAY,CAAA;AAExD,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,UAAA;AAAA,IACR,MAAA;AAAA,IACA,GAAG;AAAA,GACL;AACF;;;AC3CO,IAAM,mBAAA,GAAsB","file":"index.js","sourcesContent":["/**\n * Nuxt Module for @coding-factory/notify-kit-client\n *\n * This module sets up the NotifyKit client for use in Nuxt 3 applications.\n * It registers the runtime plugin and provides type declarations.\n *\n * @example\n * ```typescript\n * // nuxt.config.ts\n * export default defineNuxtConfig({\n * modules: ['@coding-factory/notify-kit-client/nuxt'],\n * runtimeConfig: {\n * public: {\n * notifyKit: {\n * baseUrl: '/api/notify-kit',\n * }\n * }\n * }\n * })\n * ```\n */\n\nimport { defineNuxtModule, addPlugin, createResolver, addImports } from '@nuxt/kit';\n\n/**\n * Module options schema.\n */\nexport interface NotifyKitModuleOptions {\n /**\n * Base URL for the NotifyKit API.\n * Can be relative (e.g., '/api/notify-kit') or absolute.\n * @default '/api/notify-kit'\n */\n baseUrl?: string;\n\n /**\n * Whether to automatically connect to real-time notifications.\n * Only applies on client-side.\n * @default true\n */\n autoConnect?: boolean;\n}\n\n/**\n * The NotifyKit Nuxt module.\n */\nexport default defineNuxtModule<NotifyKitModuleOptions>({\n meta: {\n name: '@coding-factory/notify-kit-client',\n configKey: 'notifyKit',\n compatibility: {\n nuxt: '>=3.0.0',\n },\n },\n defaults: {\n baseUrl: '/api/notify-kit',\n autoConnect: true,\n },\n setup(options, nuxt) {\n const resolver = createResolver(import.meta.url);\n\n // Add public runtime config\n const publicConfig = nuxt.options.runtimeConfig.public as Record<string, unknown>;\n const existingNotifyKit = publicConfig['notifyKit'] as NotifyKitModuleOptions | undefined;\n\n publicConfig['notifyKit'] = {\n baseUrl: options.baseUrl,\n autoConnect: options.autoConnect,\n ...existingNotifyKit,\n };\n\n // Add the plugin\n addPlugin({\n src: resolver.resolve('./plugin'),\n mode: 'all', // Plugin handles SSR safety internally\n });\n\n // Add auto-imports for composables\n addImports([\n {\n name: 'useNotifyKitNuxt',\n from: resolver.resolve('./composables'),\n },\n ]);\n },\n});\n","/**\n * Nuxt Composables for @coding-factory/notify-kit-client\n *\n * Provides a unified composable that combines the client with store\n * and modal management for Nuxt applications.\n */\n\nimport { useNuxtApp } from '#app';\nimport { useNotifyKitStore, type UseNotifyKitStoreReturn } from '../composables/useNotifyKitStore';\nimport { useNotifyKitModals, type UseNotifyKitModalsReturn } from '../composables/useNotifyKitModals';\nimport type { NotifyKitClient } from '../client';\n\n/**\n * Return type of useNotifyKitNuxt composable.\n */\nexport interface UseNotifyKitNuxtReturn extends UseNotifyKitStoreReturn {\n /** The NotifyKit client instance */\n readonly client: NotifyKitClient;\n\n /** Modal management functions */\n readonly modals: UseNotifyKitModalsReturn;\n}\n\n/**\n * Unified composable for NotifyKit in Nuxt applications.\n *\n * Combines access to the client, store, and modal management\n * in a single composable.\n *\n * @example\n * ```typescript\n * const {\n * client,\n * state,\n * hasUnread,\n * modals,\n * } = useNotifyKitNuxt()\n *\n * // Access notifications\n * await client.listNotifications()\n *\n * // Check unread status\n * if (hasUnread.value) {\n * // Show badge\n * }\n *\n * // Handle modals\n * if (modals.hasModals.value) {\n * await modals.dismissCurrent()\n * }\n * ```\n */\nexport function useNotifyKitNuxt(): UseNotifyKitNuxtReturn {\n const { $notifyKit } = useNuxtApp();\n const store = useNotifyKitStore();\n const modals = useNotifyKitModals({ client: $notifyKit });\n\n return {\n client: $notifyKit,\n modals,\n ...store,\n };\n}\n","/**\n * Nuxt module exports for @coding-factory/notify-kit-client\n *\n * Usage in nuxt.config.ts:\n * ```typescript\n * export default defineNuxtConfig({\n * modules: ['@coding-factory/notify-kit-client/nuxt'],\n * runtimeConfig: {\n * public: {\n * notifyKit: {\n * baseUrl: '/api/notify-kit',\n * }\n * }\n * }\n * })\n * ```\n */\n\n// Module version\nexport const NUXT_MODULE_VERSION = '0.2.2';\n\n// Module\nexport { default } from './module';\nexport type { NotifyKitModuleOptions } from './module';\n\n// Composables\nexport { useNotifyKitNuxt } from './composables';\nexport type { UseNotifyKitNuxtReturn } from './composables';\n"]}
@@ -3,28 +3,6 @@ import { InjectionKey, ComputedRef, Ref } from 'vue';
3
3
  /**
4
4
  * Modal-related type definitions for critical notification modals.
5
5
  */
6
- /**
7
- * Escape key behavior modes for modals.
8
- */
9
- type EscapeKeyBehavior = 'close' | 'snooze' | 'disabled';
10
- /**
11
- * Accessibility settings for modal notifications.
12
- * Ensures WCAG 2.1 AA compliance.
13
- */
14
- interface NotifyKitModalAccessibility {
15
- /** Escape key behavior: close, snooze, or disabled */
16
- readonly escape_key_behavior: EscapeKeyBehavior;
17
- /** Whether focus is trapped inside the modal */
18
- readonly focus_trap: boolean;
19
- /** Whether to auto-focus the first action button */
20
- readonly auto_focus_first_action: boolean;
21
- /** ARIA role for the modal element */
22
- readonly aria_role: string;
23
- /** ID of the element that labels the modal (aria-labelledby) */
24
- readonly aria_labelled_by: string | null;
25
- /** ID of the element that describes the modal (aria-describedby) */
26
- readonly aria_described_by: string | null;
27
- }
28
6
  /**
29
7
  * Modal specification included in notifications that require modal display.
30
8
  */
@@ -35,8 +13,6 @@ interface NotifyKitModalSpec {
35
13
  readonly requires_ack: boolean;
36
14
  /** Available snooze duration options in minutes */
37
15
  readonly snooze_options_minutes: readonly number[];
38
- /** Accessibility settings for the modal */
39
- readonly accessibility: NotifyKitModalAccessibility;
40
16
  }
41
17
  /**
42
18
  * Modal state tracking for a notification.
@@ -125,39 +101,58 @@ declare function isNotifyKitNotification(value: unknown): value is NotifyKitNoti
125
101
  declare function isModalEnabled(notification: NotifyKitNotification): boolean;
126
102
 
127
103
  /**
128
- * User notification preferences type definitions.
104
+ * User notification preference settings type definitions.
129
105
  */
130
106
 
131
- /**
132
- * Channel preference settings for a single category.
133
- */
134
- interface ChannelPreferences {
135
- /** Whether to store in database (notification center) */
136
- readonly database: boolean;
137
- /** Whether to broadcast in real-time */
138
- readonly broadcast: boolean;
139
- /** Whether to send via email */
140
- readonly mail: boolean;
107
+ type NotifyKitPreferenceBooleanMap = Readonly<Record<string, boolean>>;
108
+ type NotifyKitPreferenceModeMap = Readonly<Record<string, string>>;
109
+ interface NotifyKitQuietHours {
110
+ readonly start: string;
111
+ readonly end: string;
141
112
  }
142
- /**
143
- * User's notification preferences organized by category.
144
- */
145
- interface NotifyKitPreferences {
146
- /** Preferences per category */
147
- readonly categories: Readonly<Record<NotificationCategory, ChannelPreferences>>;
113
+ interface NotifyKitDigestPreferences {
114
+ readonly enabled: boolean;
115
+ readonly frequency: 'daily' | 'weekly';
116
+ readonly categories: readonly NotificationCategory[] | null;
117
+ readonly workspace_id: string | null;
118
+ readonly timezone: string | null;
119
+ readonly hour: number;
120
+ readonly quiet_hours: NotifyKitQuietHours | null;
148
121
  }
149
- /**
150
- * Partial preferences update request.
151
- * Only categories/channels that need updating should be included.
152
- */
153
- interface NotifyKitPreferencesUpdate {
154
- /** Partial category preferences to update */
155
- readonly categories?: Partial<Record<NotificationCategory, Partial<ChannelPreferences>>>;
122
+ interface NotifyKitPreferenceSettings {
123
+ readonly channels: NotifyKitPreferenceBooleanMap;
124
+ readonly channel_modes: NotifyKitPreferenceModeMap;
125
+ readonly topics: NotifyKitPreferenceBooleanMap;
126
+ readonly email_preferences: NotifyKitPreferenceBooleanMap;
127
+ readonly keyword_rules: readonly string[];
128
+ readonly digest: NotifyKitDigestPreferences;
129
+ readonly available_channels: readonly string[];
130
+ readonly available_topics: readonly string[];
131
+ readonly available_email_preferences: readonly string[];
156
132
  }
157
- /**
158
- * Type guard to validate if a value is valid ChannelPreferences.
159
- */
160
- declare function isChannelPreferences(value: unknown): value is ChannelPreferences;
133
+ interface NotifyKitPreferenceSettingsQuery {
134
+ readonly workspace_id?: string | null;
135
+ }
136
+ interface NotifyKitPreferenceSettingsUpdate {
137
+ readonly workspace_id?: string | null;
138
+ readonly channels?: Record<string, boolean>;
139
+ readonly channel_modes?: Record<string, string>;
140
+ readonly topics?: Record<string, boolean>;
141
+ readonly email_preferences?: Record<string, boolean>;
142
+ readonly keyword_rules?: readonly string[];
143
+ readonly digest?: {
144
+ readonly enabled?: boolean;
145
+ readonly frequency?: 'daily' | 'weekly';
146
+ readonly categories?: readonly NotificationCategory[] | null;
147
+ readonly timezone?: string | null;
148
+ readonly hour?: number;
149
+ readonly quiet_hours?: NotifyKitQuietHours | null;
150
+ };
151
+ }
152
+ type NotifyKitPreferences = NotifyKitPreferenceSettings;
153
+ type NotifyKitPreferencesUpdate = NotifyKitPreferenceSettingsUpdate;
154
+ declare function isNotifyKitQuietHours(value: unknown): value is NotifyKitQuietHours;
155
+ declare function isNotifyKitPreferenceSettings(value: unknown): value is NotifyKitPreferenceSettings;
161
156
 
162
157
  /**
163
158
  * API response type definitions for Notify Kit endpoints.
@@ -230,6 +225,27 @@ interface NotifyKitModalsResponse {
230
225
  /** Array of outstanding modal notifications */
231
226
  readonly data: readonly NotifyKitNotification[];
232
227
  }
228
+ /**
229
+ * Response from GET /notifications/:id endpoint.
230
+ */
231
+ interface NotifyKitSingleNotificationResponse {
232
+ /** The requested notification */
233
+ readonly data: NotifyKitNotification;
234
+ }
235
+ /**
236
+ * Generic message response from mutation endpoints.
237
+ */
238
+ interface NotifyKitMutationResponse {
239
+ /** Human-readable result message */
240
+ readonly message: string;
241
+ }
242
+ /**
243
+ * Response from read actions that also return the updated unread count.
244
+ */
245
+ interface NotifyKitReadMutationResponse extends NotifyKitMutationResponse {
246
+ /** Updated unread count when supplied by the backend */
247
+ readonly unread_count?: number;
248
+ }
233
249
  /**
234
250
  * Parameters for listing notifications.
235
251
  */
@@ -277,6 +293,75 @@ declare function isMeResponse(value: unknown): value is NotifyKitMeResponse;
277
293
  * Type guard to validate NotifyKitUnreadCountResponse.
278
294
  */
279
295
  declare function isUnreadCountResponse(value: unknown): value is NotifyKitUnreadCountResponse;
296
+ /**
297
+ * Filters for bulk operations.
298
+ */
299
+ interface BulkFilters {
300
+ /** Filter by category */
301
+ readonly category?: NotificationCategory;
302
+ /** Filter to unread only */
303
+ readonly unread_only?: boolean;
304
+ }
305
+ /**
306
+ * Request body for bulk actions.
307
+ */
308
+ interface BulkActionRequest {
309
+ /** Specific notification IDs to act on */
310
+ readonly notification_ids?: readonly string[];
311
+ /** Act on all matching notifications */
312
+ readonly all?: boolean;
313
+ /** Filters to apply when all=true */
314
+ readonly filters?: BulkFilters;
315
+ }
316
+ /**
317
+ * Response from bulk action endpoints.
318
+ */
319
+ interface BulkActionResult {
320
+ /** Number of notifications affected */
321
+ readonly affected: number;
322
+ /** Number of failures */
323
+ readonly failed: number;
324
+ }
325
+ /**
326
+ * Search filters for notification search.
327
+ */
328
+ interface SearchFilters {
329
+ /** Filter by category */
330
+ readonly category?: NotificationCategory;
331
+ /** Filter to unread only */
332
+ readonly unread?: boolean;
333
+ /** Filter by level */
334
+ readonly level?: string;
335
+ }
336
+ /**
337
+ * Response from search endpoint.
338
+ */
339
+ interface SearchResult {
340
+ /** Array of matching notifications */
341
+ readonly data: readonly NotifyKitNotification[];
342
+ /** Total number of matches */
343
+ readonly total: number;
344
+ }
345
+ /**
346
+ * A saved filter preset.
347
+ */
348
+ interface SavedFilter {
349
+ /** Unique filter ID */
350
+ readonly id: string;
351
+ /** Display name */
352
+ readonly name: string;
353
+ /** Filter configuration */
354
+ readonly filters: Readonly<Record<string, unknown>>;
355
+ /** Whether this is a system-provided preset */
356
+ readonly system: boolean;
357
+ }
358
+ /**
359
+ * Response from saved filters endpoint.
360
+ */
361
+ interface SavedFiltersResponse {
362
+ /** Array of saved filters */
363
+ readonly data: readonly SavedFilter[];
364
+ }
280
365
 
281
366
  /**
282
367
  * Notify Kit HTTP Client
@@ -301,8 +386,9 @@ interface NotifyKitClientConfig {
301
386
  declare class NotifyKitApiError extends Error {
302
387
  readonly status: number;
303
388
  readonly errors?: Readonly<Record<string, readonly string[]>> | undefined;
389
+ readonly headers?: Readonly<Record<string, string>> | undefined;
304
390
  readonly name = "NotifyKitApiError";
305
- constructor(message: string, status: number, errors?: Readonly<Record<string, readonly string[]>> | undefined);
391
+ constructor(message: string, status: number, errors?: Readonly<Record<string, readonly string[]>> | undefined, headers?: Readonly<Record<string, string>> | undefined);
306
392
  }
307
393
  /**
308
394
  * HTTP Client for the Notify Kit API.
@@ -324,10 +410,14 @@ declare class NotifyKitClient {
324
410
  * Get the count of unread notifications.
325
411
  */
326
412
  getUnreadCount(): Promise<NotifyKitUnreadCountResponse>;
413
+ /**
414
+ * Get a single notification for the current user.
415
+ */
416
+ getNotification(id: string): Promise<NotifyKitNotification>;
327
417
  /**
328
418
  * Mark a notification as read.
329
419
  */
330
- markRead(id: string): Promise<void>;
420
+ markRead(id: string): Promise<NotifyKitReadMutationResponse>;
331
421
  /**
332
422
  * Mark all notifications as read.
333
423
  */
@@ -357,13 +447,69 @@ declare class NotifyKitClient {
357
447
  */
358
448
  snoozeModal(id: string, minutes: number): Promise<void>;
359
449
  /**
360
- * Get the current user's notification preferences.
450
+ * Get the current user's notification preference settings.
451
+ */
452
+ getPreferenceSettings(query?: NotifyKitPreferenceSettingsQuery): Promise<NotifyKitPreferences>;
453
+ /**
454
+ * Alias for getPreferenceSettings.
455
+ */
456
+ getPreferences(query?: NotifyKitPreferenceSettingsQuery): Promise<NotifyKitPreferences>;
457
+ /**
458
+ * Update the current user's notification preference settings.
459
+ */
460
+ updatePreferenceSettings(preferences: NotifyKitPreferencesUpdate): Promise<NotifyKitPreferences>;
461
+ /**
462
+ * Alias for updatePreferenceSettings.
463
+ */
464
+ updatePreferences(preferences: NotifyKitPreferencesUpdate): Promise<NotifyKitPreferences>;
465
+ /**
466
+ * Bulk mark notifications as read.
467
+ */
468
+ bulkMarkRead(ids: readonly string[]): Promise<BulkActionResult>;
469
+ /**
470
+ * Bulk mark all matching notifications as read.
471
+ */
472
+ bulkMarkAllRead(filters?: BulkFilters): Promise<BulkActionResult>;
473
+ /**
474
+ * Bulk archive notifications.
475
+ */
476
+ bulkArchive(ids: readonly string[]): Promise<BulkActionResult>;
477
+ /**
478
+ * Bulk archive all matching notifications.
479
+ */
480
+ bulkArchiveAll(filters?: BulkFilters): Promise<BulkActionResult>;
481
+ /**
482
+ * Bulk delete notifications.
483
+ */
484
+ bulkDelete(ids: readonly string[]): Promise<BulkActionResult>;
485
+ /**
486
+ * Bulk delete all matching notifications.
487
+ */
488
+ bulkDeleteAll(filters?: BulkFilters): Promise<BulkActionResult>;
489
+ /**
490
+ * Search notifications by query.
491
+ */
492
+ search(query: string, filters?: SearchFilters, limit?: number): Promise<SearchResult>;
493
+ /**
494
+ * Get saved filters (system + custom).
495
+ */
496
+ getSavedFilters(): Promise<readonly SavedFilter[]>;
497
+ /**
498
+ * Save a custom filter.
499
+ */
500
+ saveFilter(name: string, filters: Record<string, unknown>): Promise<SavedFilter>;
501
+ /**
502
+ * Delete a custom filter.
503
+ */
504
+ deleteFilter(filterId: string): Promise<void>;
505
+ /**
506
+ * Archive a notification.
361
507
  */
362
- getPreferences(): Promise<NotifyKitPreferences>;
508
+ archiveNotification(id: string): Promise<void>;
363
509
  /**
364
- * Update the current user's notification preferences.
510
+ * Unarchive a notification.
365
511
  */
366
- updatePreferences(preferences: NotifyKitPreferencesUpdate): Promise<void>;
512
+ unarchiveNotification(id: string): Promise<void>;
367
513
  private buildNotificationParams;
368
514
  private request;
369
515
  }
@@ -583,4 +729,4 @@ declare function provideNotifyKitModals(options: UseNotifyKitModalsOptions): Use
583
729
  */
584
730
  declare function useNotifyKitModals(options: UseNotifyKitModalsOptions): UseNotifyKitModalsReturn;
585
731
 
586
- export { createNotifyKitClient as A, isChannelPreferences as B, type ConnectionState as C, isMeResponse as D, isModalEnabled as E, isModalSpec as F, isNotifyKitNotification as G, isPaginationMeta as H, InvalidSnoozeDurationError as I, isUnreadCountResponse as J, isValidCategory as K, type ListNotificationsParams as L, isValidLevel as M, NotifyKitClient as N, provideNotifyKitModals as O, type PaginationParams as P, provideNotifyKitStore as Q, resetNotifyKitStore as R, useNotifyKitModals as S, useNotifyKitStore as T, type UseNotifyKitModalsOptions as U, type NotifyKitMeResponse as a, type NotifyKitListResponse as b, type NotifyKitUnreadCountResponse as c, type NotifyKitNotification as d, type NotifyKitPreferences as e, type NotifyKitPreferencesUpdate as f, type NotifyKitClientConfig as g, type NotificationCategory as h, type NotificationLevel as i, type ChannelPreferences as j, NOTIFICATION_CATEGORIES as k, NOTIFICATION_LEVELS as l, NOTIFY_KIT_MODALS_KEY as m, NOTIFY_KIT_STORE_KEY as n, NotifyKitApiError as o, type NotifyKitErrorResponse as p, type NotifyKitGroupedEntry as q, type NotifyKitGroupedListResponse as r, type NotifyKitModalSpec as s, type NotifyKitModalState as t, type NotifyKitModalsClientLike as u, type NotifyKitModalsResponse as v, type NotifyKitStoreState as w, type PaginationMeta as x, type UseNotifyKitModalsReturn as y, type UseNotifyKitStoreReturn as z };
732
+ export { isNotifyKitQuietHours as $, type NotifyKitModalsResponse as A, type BulkActionResult as B, type ConnectionState as C, type NotifyKitMutationResponse as D, type NotifyKitPreferenceBooleanMap as E, type NotifyKitPreferenceModeMap as F, type NotifyKitPreferenceSettings as G, type NotifyKitPreferenceSettingsUpdate as H, InvalidSnoozeDurationError as I, type NotifyKitSingleNotificationResponse as J, type NotifyKitStoreState as K, type ListNotificationsParams as L, type PaginationMeta as M, type NotifyKitNotification as N, type SavedFiltersResponse as O, type PaginationParams as P, type SearchResult as Q, type UseNotifyKitModalsReturn as R, type SearchFilters as S, type UseNotifyKitStoreReturn as T, type UseNotifyKitModalsOptions as U, createNotifyKitClient as V, isMeResponse as W, isModalEnabled as X, isModalSpec as Y, isNotifyKitNotification as Z, isNotifyKitPreferenceSettings as _, NotifyKitClient as a, isPaginationMeta as a0, isUnreadCountResponse as a1, isValidCategory as a2, isValidLevel as a3, provideNotifyKitModals as a4, provideNotifyKitStore as a5, resetNotifyKitStore as a6, useNotifyKitModals as a7, useNotifyKitStore as a8, type NotifyKitMeResponse as b, type NotifyKitListResponse as c, type NotifyKitUnreadCountResponse as d, type NotifyKitReadMutationResponse as e, type NotifyKitPreferenceSettingsQuery as f, type NotifyKitPreferences as g, type NotifyKitPreferencesUpdate as h, type NotifyKitClientConfig as i, type BulkFilters as j, type SavedFilter as k, type NotificationCategory as l, type NotificationLevel as m, type BulkActionRequest as n, NOTIFICATION_CATEGORIES as o, NOTIFICATION_LEVELS as p, NOTIFY_KIT_MODALS_KEY as q, NOTIFY_KIT_STORE_KEY as r, NotifyKitApiError as s, type NotifyKitDigestPreferences as t, type NotifyKitErrorResponse as u, type NotifyKitGroupedEntry as v, type NotifyKitGroupedListResponse as w, type NotifyKitModalSpec as x, type NotifyKitModalState as y, type NotifyKitModalsClientLike as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingfactory/notify-kit-client",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "Headless Vue 3/Nuxt client for Notify Kit notifications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,9 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "scripts": {
23
- "generate:types": "npx tsx ../../scripts/generate-types.ts",
24
23
  "dev": "tsup --watch",
25
- "prebuild": "npm run generate:types",
26
24
  "build": "tsup",
27
25
  "typecheck": "tsc --noEmit",
28
26
  "lint": "eslint src tests",
@@ -70,8 +68,5 @@
70
68
  "type": "git",
71
69
  "url": "https://github.com/coding-factory/notify-kit.git",
72
70
  "directory": "packages/notify-kit-client"
73
- },
74
- "publishConfig": {
75
- "access": "restricted"
76
71
  }
77
72
  }