specweave 0.28.68 → 0.29.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/CLAUDE.md +3 -2
- package/README.md +19 -2
- package/dist/src/cli/commands/discrepancies.d.ts +89 -0
- package/dist/src/cli/commands/discrepancies.d.ts.map +1 -0
- package/dist/src/cli/commands/discrepancies.js +385 -0
- package/dist/src/cli/commands/discrepancies.js.map +1 -0
- package/dist/src/cli/commands/notifications.d.ts +70 -0
- package/dist/src/cli/commands/notifications.d.ts.map +1 -0
- package/dist/src/cli/commands/notifications.js +236 -0
- package/dist/src/cli/commands/notifications.js.map +1 -0
- package/dist/src/cli/commands/sync-logs.d.ts +54 -0
- package/dist/src/cli/commands/sync-logs.d.ts.map +1 -0
- package/dist/src/cli/commands/sync-logs.js +240 -0
- package/dist/src/cli/commands/sync-logs.js.map +1 -0
- package/dist/src/cli/commands/sync-monitor.d.ts +42 -0
- package/dist/src/cli/commands/sync-monitor.d.ts.map +1 -0
- package/dist/src/cli/commands/sync-monitor.js +191 -0
- package/dist/src/cli/commands/sync-monitor.js.map +1 -0
- package/dist/src/cli/helpers/init/brownfield-analysis.d.ts +45 -0
- package/dist/src/cli/helpers/init/brownfield-analysis.d.ts.map +1 -0
- package/dist/src/cli/helpers/init/brownfield-analysis.js +431 -0
- package/dist/src/cli/helpers/init/brownfield-analysis.js.map +1 -0
- package/dist/src/cli/helpers/init/index.d.ts +1 -0
- package/dist/src/cli/helpers/init/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/index.js +2 -0
- package/dist/src/cli/helpers/init/index.js.map +1 -1
- package/dist/src/cli/workers/brownfield-worker.d.ts +66 -0
- package/dist/src/cli/workers/brownfield-worker.d.ts.map +1 -0
- package/dist/src/cli/workers/brownfield-worker.js +417 -0
- package/dist/src/cli/workers/brownfield-worker.js.map +1 -0
- package/dist/src/core/background/brownfield-launcher.d.ts +86 -0
- package/dist/src/core/background/brownfield-launcher.d.ts.map +1 -0
- package/dist/src/core/background/brownfield-launcher.js +295 -0
- package/dist/src/core/background/brownfield-launcher.js.map +1 -0
- package/dist/src/core/background/index.d.ts +2 -0
- package/dist/src/core/background/index.d.ts.map +1 -1
- package/dist/src/core/background/index.js +2 -0
- package/dist/src/core/background/index.js.map +1 -1
- package/dist/src/core/background/types.d.ts +23 -2
- package/dist/src/core/background/types.d.ts.map +1 -1
- package/dist/src/core/config/index.d.ts +1 -0
- package/dist/src/core/config/index.d.ts.map +1 -1
- package/dist/src/core/config/index.js +1 -0
- package/dist/src/core/config/index.js.map +1 -1
- package/dist/src/core/config/types.d.ts +6 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/dashboard/dashboard-data.d.ts +156 -0
- package/dist/src/core/dashboard/dashboard-data.d.ts.map +1 -0
- package/dist/src/core/dashboard/dashboard-data.js +191 -0
- package/dist/src/core/dashboard/dashboard-data.js.map +1 -0
- package/dist/src/core/dashboard/index.d.ts +9 -0
- package/dist/src/core/dashboard/index.d.ts.map +1 -0
- package/dist/src/core/dashboard/index.js +9 -0
- package/dist/src/core/dashboard/index.js.map +1 -0
- package/dist/src/core/discrepancy/analyzers/api-route-analyzer.d.ts +77 -0
- package/dist/src/core/discrepancy/analyzers/api-route-analyzer.d.ts.map +1 -0
- package/dist/src/core/discrepancy/analyzers/api-route-analyzer.js +286 -0
- package/dist/src/core/discrepancy/analyzers/api-route-analyzer.js.map +1 -0
- package/dist/src/core/discrepancy/analyzers/index.d.ts +8 -0
- package/dist/src/core/discrepancy/analyzers/index.d.ts.map +1 -0
- package/dist/src/core/discrepancy/analyzers/index.js +8 -0
- package/dist/src/core/discrepancy/analyzers/index.js.map +1 -0
- package/dist/src/core/discrepancy/analyzers/typescript-analyzer.d.ts +96 -0
- package/dist/src/core/discrepancy/analyzers/typescript-analyzer.d.ts.map +1 -0
- package/dist/src/core/discrepancy/analyzers/typescript-analyzer.js +247 -0
- package/dist/src/core/discrepancy/analyzers/typescript-analyzer.js.map +1 -0
- package/dist/src/core/discrepancy/brownfield-manager.d.ts +88 -0
- package/dist/src/core/discrepancy/brownfield-manager.d.ts.map +1 -0
- package/dist/src/core/discrepancy/brownfield-manager.js +520 -0
- package/dist/src/core/discrepancy/brownfield-manager.js.map +1 -0
- package/dist/src/core/discrepancy/brownfield-types.d.ts +174 -0
- package/dist/src/core/discrepancy/brownfield-types.d.ts.map +1 -0
- package/dist/src/core/discrepancy/brownfield-types.js +11 -0
- package/dist/src/core/discrepancy/brownfield-types.js.map +1 -0
- package/dist/src/core/discrepancy/detector.d.ts +92 -0
- package/dist/src/core/discrepancy/detector.d.ts.map +1 -0
- package/dist/src/core/discrepancy/detector.js +346 -0
- package/dist/src/core/discrepancy/detector.js.map +1 -0
- package/dist/src/core/discrepancy/increment-generator.d.ts +51 -0
- package/dist/src/core/discrepancy/increment-generator.d.ts.map +1 -0
- package/dist/src/core/discrepancy/increment-generator.js +234 -0
- package/dist/src/core/discrepancy/increment-generator.js.map +1 -0
- package/dist/src/core/discrepancy/index.d.ts +18 -0
- package/dist/src/core/discrepancy/index.d.ts.map +1 -0
- package/dist/src/core/discrepancy/index.js +24 -0
- package/dist/src/core/discrepancy/index.js.map +1 -0
- package/dist/src/core/discrepancy/severity-classifier.d.ts +81 -0
- package/dist/src/core/discrepancy/severity-classifier.d.ts.map +1 -0
- package/dist/src/core/discrepancy/severity-classifier.js +289 -0
- package/dist/src/core/discrepancy/severity-classifier.js.map +1 -0
- package/dist/src/core/discrepancy/spec-parser.d.ts +74 -0
- package/dist/src/core/discrepancy/spec-parser.d.ts.map +1 -0
- package/dist/src/core/discrepancy/spec-parser.js +213 -0
- package/dist/src/core/discrepancy/spec-parser.js.map +1 -0
- package/dist/src/core/discrepancy/update-recommender.d.ts +77 -0
- package/dist/src/core/discrepancy/update-recommender.d.ts.map +1 -0
- package/dist/src/core/discrepancy/update-recommender.js +323 -0
- package/dist/src/core/discrepancy/update-recommender.js.map +1 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts +13 -16
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +31 -112
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/logs/index.d.ts +10 -0
- package/dist/src/core/logs/index.d.ts.map +1 -0
- package/dist/src/core/logs/index.js +10 -0
- package/dist/src/core/logs/index.js.map +1 -0
- package/dist/src/core/logs/log-aggregator.d.ts +130 -0
- package/dist/src/core/logs/log-aggregator.d.ts.map +1 -0
- package/dist/src/core/logs/log-aggregator.js +206 -0
- package/dist/src/core/logs/log-aggregator.js.map +1 -0
- package/dist/src/core/logs/log-exporter.d.ts +81 -0
- package/dist/src/core/logs/log-exporter.d.ts.map +1 -0
- package/dist/src/core/logs/log-exporter.js +141 -0
- package/dist/src/core/logs/log-exporter.js.map +1 -0
- package/dist/src/core/notifications/command-integration.d.ts +82 -0
- package/dist/src/core/notifications/command-integration.d.ts.map +1 -0
- package/dist/src/core/notifications/command-integration.js +80 -0
- package/dist/src/core/notifications/command-integration.js.map +1 -0
- package/dist/src/core/notifications/index.d.ts +12 -0
- package/dist/src/core/notifications/index.d.ts.map +1 -0
- package/dist/src/core/notifications/index.js +12 -0
- package/dist/src/core/notifications/index.js.map +1 -0
- package/dist/src/core/notifications/notification-display.d.ts +70 -0
- package/dist/src/core/notifications/notification-display.d.ts.map +1 -0
- package/dist/src/core/notifications/notification-display.js +177 -0
- package/dist/src/core/notifications/notification-display.js.map +1 -0
- package/dist/src/core/notifications/notification-manager.d.ts +126 -0
- package/dist/src/core/notifications/notification-manager.d.ts.map +1 -0
- package/dist/src/core/notifications/notification-manager.js +287 -0
- package/dist/src/core/notifications/notification-manager.js.map +1 -0
- package/dist/src/core/notifications/notification-types.d.ts +159 -0
- package/dist/src/core/notifications/notification-types.d.ts.map +1 -0
- package/dist/src/core/notifications/notification-types.js +93 -0
- package/dist/src/core/notifications/notification-types.js.map +1 -0
- package/dist/src/core/scheduler/index.d.ts +11 -0
- package/dist/src/core/scheduler/index.d.ts.map +1 -0
- package/dist/src/core/scheduler/index.js +11 -0
- package/dist/src/core/scheduler/index.js.map +1 -0
- package/dist/src/core/scheduler/job-scheduler.d.ts +179 -0
- package/dist/src/core/scheduler/job-scheduler.d.ts.map +1 -0
- package/dist/src/core/scheduler/job-scheduler.js +282 -0
- package/dist/src/core/scheduler/job-scheduler.js.map +1 -0
- package/dist/src/core/scheduler/schedule-persistence.d.ts +83 -0
- package/dist/src/core/scheduler/schedule-persistence.d.ts.map +1 -0
- package/dist/src/core/scheduler/schedule-persistence.js +180 -0
- package/dist/src/core/scheduler/schedule-persistence.js.map +1 -0
- package/dist/src/core/scheduler/scheduled-job.d.ts +188 -0
- package/dist/src/core/scheduler/scheduled-job.d.ts.map +1 -0
- package/dist/src/core/scheduler/scheduled-job.js +182 -0
- package/dist/src/core/scheduler/scheduled-job.js.map +1 -0
- package/dist/src/core/sync/permission-enforcer.d.ts +206 -0
- package/dist/src/core/sync/permission-enforcer.d.ts.map +1 -0
- package/dist/src/core/sync/permission-enforcer.js +268 -0
- package/dist/src/core/sync/permission-enforcer.js.map +1 -0
- package/dist/src/core/sync/sync-audit-logger.d.ts +217 -0
- package/dist/src/core/sync/sync-audit-logger.d.ts.map +1 -0
- package/dist/src/core/sync/sync-audit-logger.js +327 -0
- package/dist/src/core/sync/sync-audit-logger.js.map +1 -0
- package/dist/src/core/sync/sync-interceptor.d.ts +190 -0
- package/dist/src/core/sync/sync-interceptor.d.ts.map +1 -0
- package/dist/src/core/sync/sync-interceptor.js +224 -0
- package/dist/src/core/sync/sync-interceptor.js.map +1 -0
- package/dist/src/core/types/increment-metadata.d.ts +5 -2
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/sync-config.d.ts +267 -0
- package/dist/src/core/types/sync-config.d.ts.map +1 -0
- package/dist/src/core/types/sync-config.js +304 -0
- package/dist/src/core/types/sync-config.js.map +1 -0
- package/dist/src/hooks/index.d.ts +11 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +11 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/platform.d.ts +125 -0
- package/dist/src/hooks/platform.d.ts.map +1 -0
- package/dist/src/hooks/platform.js +325 -0
- package/dist/src/hooks/platform.js.map +1 -0
- package/dist/src/hooks/processor.d.ts +20 -0
- package/dist/src/hooks/processor.d.ts.map +1 -0
- package/dist/src/hooks/processor.js +317 -0
- package/dist/src/hooks/processor.js.map +1 -0
- package/dist/src/hooks/scheduler-startup.d.ts +19 -0
- package/dist/src/hooks/scheduler-startup.d.ts.map +1 -0
- package/dist/src/hooks/scheduler-startup.js +92 -0
- package/dist/src/hooks/scheduler-startup.js.map +1 -0
- package/dist/src/hooks/session-start.d.ts +16 -0
- package/dist/src/hooks/session-start.d.ts.map +1 -0
- package/dist/src/hooks/session-start.js +92 -0
- package/dist/src/hooks/session-start.js.map +1 -0
- package/dist/src/importers/duplicate-detector.d.ts +13 -2
- package/dist/src/importers/duplicate-detector.d.ts.map +1 -1
- package/dist/src/importers/duplicate-detector.js +21 -2
- package/dist/src/importers/duplicate-detector.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +41 -2
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +225 -38
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.d.ts +7 -0
- package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.js +30 -4
- package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
- package/dist/src/sync/ado-sync-wrapper.d.ts +137 -0
- package/dist/src/sync/ado-sync-wrapper.d.ts.map +1 -0
- package/dist/src/sync/ado-sync-wrapper.js +148 -0
- package/dist/src/sync/ado-sync-wrapper.js.map +1 -0
- package/dist/src/sync/github-sync-wrapper.d.ts +195 -0
- package/dist/src/sync/github-sync-wrapper.d.ts.map +1 -0
- package/dist/src/sync/github-sync-wrapper.js +220 -0
- package/dist/src/sync/github-sync-wrapper.js.map +1 -0
- package/dist/src/sync/jira-sync-wrapper.d.ts +155 -0
- package/dist/src/sync/jira-sync-wrapper.d.ts.map +1 -0
- package/dist/src/sync/jira-sync-wrapper.js +175 -0
- package/dist/src/sync/jira-sync-wrapper.js.map +1 -0
- package/dist/src/utils/feature-id-derivation.d.ts +58 -0
- package/dist/src/utils/feature-id-derivation.d.ts.map +1 -0
- package/dist/src/utils/feature-id-derivation.js +77 -0
- package/dist/src/utils/feature-id-derivation.js.map +1 -0
- package/package.json +3 -1
- package/plugins/specweave/commands/specweave-discrepancies.md +141 -0
- package/plugins/specweave/commands/specweave-discrepancy-to-increment.md +160 -0
- package/plugins/specweave/commands/specweave-jobs.md +45 -2
- package/plugins/specweave/commands/specweave-notifications.md +92 -0
- package/plugins/specweave/commands/specweave-sync-logs.md +131 -0
- package/plugins/specweave/commands/specweave-sync-monitor.md +57 -0
- package/plugins/specweave/hooks/hooks.json +3 -3
- package/plugins/specweave/hooks/lib/scheduler-startup.sh +72 -0
- package/plugins/specweave/hooks/universal/dispatcher.mjs +246 -0
- package/plugins/specweave/hooks/universal/session-start.cmd +16 -0
- package/plugins/specweave/hooks/universal/session-start.ps1 +16 -0
- package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +14 -5
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +5 -2
- package/plugins/specweave/skills/discrepancy-viewer.md +154 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +46 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +69 -0
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +0 -26
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +0 -249
- package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +0 -1
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +0 -28
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +0 -156
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +0 -1
- package/dist/src/core/sync/bidirectional-engine.d.ts +0 -119
- package/dist/src/core/sync/bidirectional-engine.d.ts.map +0 -1
- package/dist/src/core/sync/bidirectional-engine.js +0 -359
- package/dist/src/core/sync/bidirectional-engine.js.map +0 -1
- package/dist/src/core/sync/conflict-resolver.d.ts +0 -66
- package/dist/src/core/sync/conflict-resolver.d.ts.map +0 -1
- package/dist/src/core/sync/conflict-resolver.js +0 -108
- package/dist/src/core/sync/conflict-resolver.js.map +0 -1
- package/dist/src/core/sync/enhanced-content-builder.d.ts +0 -55
- package/dist/src/core/sync/enhanced-content-builder.d.ts.map +0 -1
- package/dist/src/core/sync/enhanced-content-builder.js +0 -203
- package/dist/src/core/sync/enhanced-content-builder.js.map +0 -1
- package/dist/src/core/sync/folder-mapper.d.ts +0 -71
- package/dist/src/core/sync/folder-mapper.d.ts.map +0 -1
- package/dist/src/core/sync/folder-mapper.js +0 -203
- package/dist/src/core/sync/folder-mapper.js.map +0 -1
- package/dist/src/core/sync/label-detector.d.ts +0 -66
- package/dist/src/core/sync/label-detector.d.ts.map +0 -1
- package/dist/src/core/sync/label-detector.js +0 -224
- package/dist/src/core/sync/label-detector.js.map +0 -1
- package/dist/src/core/sync/performance-optimizer.d.ts +0 -153
- package/dist/src/core/sync/performance-optimizer.d.ts.map +0 -1
- package/dist/src/core/sync/performance-optimizer.js +0 -220
- package/dist/src/core/sync/performance-optimizer.js.map +0 -1
- package/dist/src/core/sync/profile-selector.d.ts +0 -52
- package/dist/src/core/sync/profile-selector.d.ts.map +0 -1
- package/dist/src/core/sync/profile-selector.js +0 -179
- package/dist/src/core/sync/profile-selector.js.map +0 -1
- package/dist/src/core/sync/profile-validator.d.ts +0 -52
- package/dist/src/core/sync/profile-validator.d.ts.map +0 -1
- package/dist/src/core/sync/profile-validator.js +0 -170
- package/dist/src/core/sync/profile-validator.js.map +0 -1
- package/dist/src/core/sync/rate-limiter.d.ts +0 -116
- package/dist/src/core/sync/rate-limiter.d.ts.map +0 -1
- package/dist/src/core/sync/rate-limiter.js +0 -308
- package/dist/src/core/sync/rate-limiter.js.map +0 -1
- package/dist/src/core/sync/retry-handler.d.ts +0 -98
- package/dist/src/core/sync/retry-handler.d.ts.map +0 -1
- package/dist/src/core/sync/retry-handler.js +0 -196
- package/dist/src/core/sync/retry-handler.js.map +0 -1
- package/dist/src/core/sync/retry-logic.d.ts +0 -64
- package/dist/src/core/sync/retry-logic.d.ts.map +0 -1
- package/dist/src/core/sync/retry-logic.js +0 -165
- package/dist/src/core/sync/retry-logic.js.map +0 -1
- package/dist/src/core/sync/status-cache.d.ts +0 -91
- package/dist/src/core/sync/status-cache.d.ts.map +0 -1
- package/dist/src/core/sync/status-cache.js +0 -140
- package/dist/src/core/sync/status-cache.js.map +0 -1
- package/dist/src/core/sync/status-mapper.d.ts +0 -69
- package/dist/src/core/sync/status-mapper.d.ts.map +0 -1
- package/dist/src/core/sync/status-mapper.js +0 -90
- package/dist/src/core/sync/status-mapper.js.map +0 -1
- package/dist/src/core/sync/status-sync-engine.d.ts +0 -162
- package/dist/src/core/sync/status-sync-engine.d.ts.map +0 -1
- package/dist/src/core/sync/status-sync-engine.js +0 -347
- package/dist/src/core/sync/status-sync-engine.js.map +0 -1
- package/dist/src/core/sync/sync-event-logger.d.ts +0 -113
- package/dist/src/core/sync/sync-event-logger.d.ts.map +0 -1
- package/dist/src/core/sync/sync-event-logger.js +0 -141
- package/dist/src/core/sync/sync-event-logger.js.map +0 -1
- package/dist/src/core/sync/time-range-selector.d.ts +0 -48
- package/dist/src/core/sync/time-range-selector.d.ts.map +0 -1
- package/dist/src/core/sync/time-range-selector.js +0 -224
- package/dist/src/core/sync/time-range-selector.js.map +0 -1
- package/dist/src/core/sync/types.d.ts +0 -52
- package/dist/src/core/sync/types.d.ts.map +0 -1
- package/dist/src/core/sync/types.js +0 -5
- package/dist/src/core/sync/types.js.map +0 -1
- package/dist/src/core/sync/workflow-detector.d.ts +0 -95
- package/dist/src/core/sync/workflow-detector.d.ts.map +0 -1
- package/dist/src/core/sync/workflow-detector.js +0 -175
- package/dist/src/core/sync/workflow-detector.js.map +0 -1
- package/plugins/specweave-github/lib/enhanced-github-sync.js +0 -220
- package/plugins/specweave-github/lib/enhanced-github-sync.ts +0 -322
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +0 -134
- package/plugins/specweave-jira/lib/enhanced-jira-sync.ts +0 -196
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages notification storage, retrieval, and lifecycle.
|
|
5
|
+
*
|
|
6
|
+
* @module core/notifications/notification-manager
|
|
7
|
+
*/
|
|
8
|
+
import { Notification, CreateNotificationInput, NotificationQueryOptions } from './notification-types.js';
|
|
9
|
+
import { Logger } from '../../utils/logger.js';
|
|
10
|
+
/**
|
|
11
|
+
* Notification manager options
|
|
12
|
+
*/
|
|
13
|
+
export interface NotificationManagerOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Path to .specweave directory
|
|
16
|
+
*/
|
|
17
|
+
specweavePath?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Logger instance
|
|
20
|
+
*/
|
|
21
|
+
logger?: Logger;
|
|
22
|
+
/**
|
|
23
|
+
* Default cleanup age in days
|
|
24
|
+
* @default 30
|
|
25
|
+
*/
|
|
26
|
+
defaultRetentionDays?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* NotificationManager - Central notification storage and retrieval
|
|
30
|
+
*
|
|
31
|
+
* Features:
|
|
32
|
+
* - Add/query/dismiss notifications
|
|
33
|
+
* - Automatic persistence
|
|
34
|
+
* - Cleanup of old notifications
|
|
35
|
+
*/
|
|
36
|
+
export declare class NotificationManager {
|
|
37
|
+
private readonly filePath;
|
|
38
|
+
private readonly logger;
|
|
39
|
+
private readonly defaultRetentionDays;
|
|
40
|
+
private notifications;
|
|
41
|
+
constructor(options?: NotificationManagerOptions);
|
|
42
|
+
/**
|
|
43
|
+
* Add a new notification
|
|
44
|
+
*
|
|
45
|
+
* @param input - Notification input
|
|
46
|
+
* @returns Created notification
|
|
47
|
+
*/
|
|
48
|
+
add(input: CreateNotificationInput): Promise<Notification>;
|
|
49
|
+
/**
|
|
50
|
+
* Get pending notifications (not dismissed)
|
|
51
|
+
*
|
|
52
|
+
* @returns Array of pending notifications
|
|
53
|
+
*/
|
|
54
|
+
getPending(): Promise<Notification[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Get all notifications with optional filtering
|
|
57
|
+
*
|
|
58
|
+
* @param options - Query options
|
|
59
|
+
* @returns Array of notifications
|
|
60
|
+
*/
|
|
61
|
+
getAll(options?: NotificationQueryOptions): Promise<Notification[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Get a single notification by ID
|
|
64
|
+
*
|
|
65
|
+
* @param id - Notification ID
|
|
66
|
+
* @returns Notification or undefined
|
|
67
|
+
*/
|
|
68
|
+
getById(id: string): Promise<Notification | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* Mark notifications as read
|
|
71
|
+
*
|
|
72
|
+
* @param ids - Array of notification IDs to mark as read
|
|
73
|
+
*/
|
|
74
|
+
markRead(ids: string[]): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Dismiss notifications (hide from pending but keep in history)
|
|
77
|
+
*
|
|
78
|
+
* @param ids - Array of notification IDs to dismiss
|
|
79
|
+
*/
|
|
80
|
+
dismiss(ids: string[]): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Dismiss all pending notifications
|
|
83
|
+
*/
|
|
84
|
+
dismissAll(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Cleanup old notifications
|
|
87
|
+
*
|
|
88
|
+
* @param olderThanDays - Remove notifications older than this many days
|
|
89
|
+
* @returns Number of removed notifications
|
|
90
|
+
*/
|
|
91
|
+
cleanup(olderThanDays?: number): Promise<number>;
|
|
92
|
+
/**
|
|
93
|
+
* Get summary for display
|
|
94
|
+
*
|
|
95
|
+
* @returns Summary object
|
|
96
|
+
*/
|
|
97
|
+
getSummary(): Promise<{
|
|
98
|
+
total: number;
|
|
99
|
+
pending: number;
|
|
100
|
+
bySeverity: Record<string, number>;
|
|
101
|
+
byType: Record<string, number>;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Check if there are any pending notifications
|
|
105
|
+
*
|
|
106
|
+
* @returns true if pending notifications exist
|
|
107
|
+
*/
|
|
108
|
+
hasPending(): Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Load notifications from disk
|
|
111
|
+
*/
|
|
112
|
+
private load;
|
|
113
|
+
/**
|
|
114
|
+
* Save notifications to disk
|
|
115
|
+
*/
|
|
116
|
+
private save;
|
|
117
|
+
/**
|
|
118
|
+
* Clear cache (for testing)
|
|
119
|
+
*/
|
|
120
|
+
clearCache(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Get file path (for testing/debugging)
|
|
123
|
+
*/
|
|
124
|
+
getFilePath(): string;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=notification-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../../src/core/notifications/notification-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EAGzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAiB,MAAM,uBAAuB,CAAC;AA2B9D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAE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AC,OAAO,CAAC;IAKpC;;OAEG;YACW,IAAI;IAkClB;;OAEG;YACW,IAAI;IA8BlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,WAAW,IAAI,MAAM;CAGtB"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages notification storage, retrieval, and lifecycle.
|
|
5
|
+
*
|
|
6
|
+
* @module core/notifications/notification-manager
|
|
7
|
+
*/
|
|
8
|
+
import { promises as fs } from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { createNotification, isPendingNotification, } from './notification-types.js';
|
|
11
|
+
import { consoleLogger } from '../../utils/logger.js';
|
|
12
|
+
/**
|
|
13
|
+
* Current schema version
|
|
14
|
+
*/
|
|
15
|
+
const CURRENT_VERSION = 1;
|
|
16
|
+
/**
|
|
17
|
+
* NotificationManager - Central notification storage and retrieval
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - Add/query/dismiss notifications
|
|
21
|
+
* - Automatic persistence
|
|
22
|
+
* - Cleanup of old notifications
|
|
23
|
+
*/
|
|
24
|
+
export class NotificationManager {
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.notifications = null;
|
|
27
|
+
const specweavePath = options.specweavePath ?? path.join(process.cwd(), '.specweave');
|
|
28
|
+
this.filePath = path.join(specweavePath, 'state', 'notifications.json');
|
|
29
|
+
this.logger = options.logger ?? consoleLogger;
|
|
30
|
+
this.defaultRetentionDays = options.defaultRetentionDays ?? 30;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Add a new notification
|
|
34
|
+
*
|
|
35
|
+
* @param input - Notification input
|
|
36
|
+
* @returns Created notification
|
|
37
|
+
*/
|
|
38
|
+
async add(input) {
|
|
39
|
+
const notifications = await this.load();
|
|
40
|
+
const notification = createNotification(input);
|
|
41
|
+
notifications.push(notification);
|
|
42
|
+
await this.save(notifications);
|
|
43
|
+
this.logger.debug(`Added notification: ${notification.id} (${notification.type})`);
|
|
44
|
+
return notification;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get pending notifications (not dismissed)
|
|
48
|
+
*
|
|
49
|
+
* @returns Array of pending notifications
|
|
50
|
+
*/
|
|
51
|
+
async getPending() {
|
|
52
|
+
const notifications = await this.load();
|
|
53
|
+
return notifications
|
|
54
|
+
.filter(isPendingNotification)
|
|
55
|
+
.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get all notifications with optional filtering
|
|
59
|
+
*
|
|
60
|
+
* @param options - Query options
|
|
61
|
+
* @returns Array of notifications
|
|
62
|
+
*/
|
|
63
|
+
async getAll(options = {}) {
|
|
64
|
+
const notifications = await this.load();
|
|
65
|
+
let filtered = notifications;
|
|
66
|
+
// Filter by type
|
|
67
|
+
if (options.type) {
|
|
68
|
+
filtered = filtered.filter((n) => n.type === options.type);
|
|
69
|
+
}
|
|
70
|
+
// Filter by severity
|
|
71
|
+
if (options.severity) {
|
|
72
|
+
filtered = filtered.filter((n) => n.severity === options.severity);
|
|
73
|
+
}
|
|
74
|
+
// Filter dismissed
|
|
75
|
+
if (!options.includeDismissed) {
|
|
76
|
+
filtered = filtered.filter((n) => !n.dismissedAt);
|
|
77
|
+
}
|
|
78
|
+
// Filter read (default: include read)
|
|
79
|
+
if (options.includeRead === false) {
|
|
80
|
+
filtered = filtered.filter((n) => !n.readAt);
|
|
81
|
+
}
|
|
82
|
+
// Sort
|
|
83
|
+
const sortMultiplier = options.sortOrder === 'asc' ? 1 : -1;
|
|
84
|
+
filtered.sort((a, b) => sortMultiplier * (new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()));
|
|
85
|
+
// Pagination
|
|
86
|
+
if (options.offset) {
|
|
87
|
+
filtered = filtered.slice(options.offset);
|
|
88
|
+
}
|
|
89
|
+
if (options.limit) {
|
|
90
|
+
filtered = filtered.slice(0, options.limit);
|
|
91
|
+
}
|
|
92
|
+
return filtered;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get a single notification by ID
|
|
96
|
+
*
|
|
97
|
+
* @param id - Notification ID
|
|
98
|
+
* @returns Notification or undefined
|
|
99
|
+
*/
|
|
100
|
+
async getById(id) {
|
|
101
|
+
const notifications = await this.load();
|
|
102
|
+
return notifications.find((n) => n.id === id);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Mark notifications as read
|
|
106
|
+
*
|
|
107
|
+
* @param ids - Array of notification IDs to mark as read
|
|
108
|
+
*/
|
|
109
|
+
async markRead(ids) {
|
|
110
|
+
const notifications = await this.load();
|
|
111
|
+
const now = new Date().toISOString();
|
|
112
|
+
let changed = false;
|
|
113
|
+
for (const id of ids) {
|
|
114
|
+
const notification = notifications.find((n) => n.id === id);
|
|
115
|
+
if (notification && !notification.readAt) {
|
|
116
|
+
notification.readAt = now;
|
|
117
|
+
changed = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (changed) {
|
|
121
|
+
await this.save(notifications);
|
|
122
|
+
this.logger.debug(`Marked ${ids.length} notifications as read`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Dismiss notifications (hide from pending but keep in history)
|
|
127
|
+
*
|
|
128
|
+
* @param ids - Array of notification IDs to dismiss
|
|
129
|
+
*/
|
|
130
|
+
async dismiss(ids) {
|
|
131
|
+
const notifications = await this.load();
|
|
132
|
+
const now = new Date().toISOString();
|
|
133
|
+
let changed = false;
|
|
134
|
+
for (const id of ids) {
|
|
135
|
+
const notification = notifications.find((n) => n.id === id);
|
|
136
|
+
if (notification && !notification.dismissedAt) {
|
|
137
|
+
notification.dismissedAt = now;
|
|
138
|
+
// Also mark as read if not already
|
|
139
|
+
if (!notification.readAt) {
|
|
140
|
+
notification.readAt = now;
|
|
141
|
+
}
|
|
142
|
+
changed = true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (changed) {
|
|
146
|
+
await this.save(notifications);
|
|
147
|
+
this.logger.debug(`Dismissed ${ids.length} notifications`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Dismiss all pending notifications
|
|
152
|
+
*/
|
|
153
|
+
async dismissAll() {
|
|
154
|
+
const pending = await this.getPending();
|
|
155
|
+
const ids = pending.map((n) => n.id);
|
|
156
|
+
if (ids.length > 0) {
|
|
157
|
+
await this.dismiss(ids);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Cleanup old notifications
|
|
162
|
+
*
|
|
163
|
+
* @param olderThanDays - Remove notifications older than this many days
|
|
164
|
+
* @returns Number of removed notifications
|
|
165
|
+
*/
|
|
166
|
+
async cleanup(olderThanDays) {
|
|
167
|
+
const days = olderThanDays ?? this.defaultRetentionDays;
|
|
168
|
+
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
|
169
|
+
const notifications = await this.load();
|
|
170
|
+
const originalCount = notifications.length;
|
|
171
|
+
const filtered = notifications.filter((n) => {
|
|
172
|
+
const createdAt = new Date(n.createdAt);
|
|
173
|
+
return createdAt > cutoff;
|
|
174
|
+
});
|
|
175
|
+
const removedCount = originalCount - filtered.length;
|
|
176
|
+
if (removedCount > 0) {
|
|
177
|
+
await this.save(filtered);
|
|
178
|
+
this.logger.debug(`Cleaned up ${removedCount} old notifications`);
|
|
179
|
+
}
|
|
180
|
+
return removedCount;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get summary for display
|
|
184
|
+
*
|
|
185
|
+
* @returns Summary object
|
|
186
|
+
*/
|
|
187
|
+
async getSummary() {
|
|
188
|
+
const notifications = await this.load();
|
|
189
|
+
const pending = notifications.filter(isPendingNotification);
|
|
190
|
+
const bySeverity = {};
|
|
191
|
+
const byType = {};
|
|
192
|
+
for (const n of pending) {
|
|
193
|
+
bySeverity[n.severity] = (bySeverity[n.severity] || 0) + 1;
|
|
194
|
+
byType[n.type] = (byType[n.type] || 0) + 1;
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
total: notifications.length,
|
|
198
|
+
pending: pending.length,
|
|
199
|
+
bySeverity,
|
|
200
|
+
byType,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Check if there are any pending notifications
|
|
205
|
+
*
|
|
206
|
+
* @returns true if pending notifications exist
|
|
207
|
+
*/
|
|
208
|
+
async hasPending() {
|
|
209
|
+
const pending = await this.getPending();
|
|
210
|
+
return pending.length > 0;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Load notifications from disk
|
|
214
|
+
*/
|
|
215
|
+
async load() {
|
|
216
|
+
if (this.notifications !== null) {
|
|
217
|
+
return this.notifications;
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
const content = await fs.readFile(this.filePath, 'utf-8');
|
|
221
|
+
const data = JSON.parse(content);
|
|
222
|
+
if (!Array.isArray(data.notifications)) {
|
|
223
|
+
this.notifications = [];
|
|
224
|
+
return this.notifications;
|
|
225
|
+
}
|
|
226
|
+
this.notifications = data.notifications;
|
|
227
|
+
return this.notifications;
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
if (error.code === 'ENOENT') {
|
|
231
|
+
this.notifications = [];
|
|
232
|
+
return this.notifications;
|
|
233
|
+
}
|
|
234
|
+
if (error instanceof SyntaxError) {
|
|
235
|
+
this.logger.warn('Corrupted notifications file, starting fresh');
|
|
236
|
+
this.notifications = [];
|
|
237
|
+
return this.notifications;
|
|
238
|
+
}
|
|
239
|
+
this.logger.error(`Failed to load notifications: ${error}`);
|
|
240
|
+
this.notifications = [];
|
|
241
|
+
return this.notifications;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Save notifications to disk
|
|
246
|
+
*/
|
|
247
|
+
async save(notifications) {
|
|
248
|
+
this.notifications = notifications;
|
|
249
|
+
const data = {
|
|
250
|
+
version: CURRENT_VERSION,
|
|
251
|
+
notifications,
|
|
252
|
+
lastUpdated: new Date().toISOString(),
|
|
253
|
+
};
|
|
254
|
+
// Ensure directory exists
|
|
255
|
+
const dir = path.dirname(this.filePath);
|
|
256
|
+
await fs.mkdir(dir, { recursive: true });
|
|
257
|
+
// Atomic write
|
|
258
|
+
const tempPath = `${this.filePath}.tmp`;
|
|
259
|
+
const content = JSON.stringify(data, null, 2);
|
|
260
|
+
try {
|
|
261
|
+
await fs.writeFile(tempPath, content, 'utf-8');
|
|
262
|
+
await fs.rename(tempPath, this.filePath);
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
try {
|
|
266
|
+
await fs.unlink(tempPath);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
// Ignore cleanup errors
|
|
270
|
+
}
|
|
271
|
+
throw error;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Clear cache (for testing)
|
|
276
|
+
*/
|
|
277
|
+
clearCache() {
|
|
278
|
+
this.notifications = null;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get file path (for testing/debugging)
|
|
282
|
+
*/
|
|
283
|
+
getFilePath() {
|
|
284
|
+
return this.filePath;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=notification-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-manager.js","sourceRoot":"","sources":["../../../../src/core/notifications/notification-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAU,aAAa,EAAE,MAAM,uBAAuB,CAAC;A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AC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the types for the notification system.
|
|
5
|
+
*
|
|
6
|
+
* @module core/notifications/notification-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Types of notifications
|
|
10
|
+
*/
|
|
11
|
+
export type NotificationType = 'import-complete' | 'discrepancy' | 'sync-failure' | 'drift' | 'job-complete';
|
|
12
|
+
/**
|
|
13
|
+
* Notification severity levels
|
|
14
|
+
*/
|
|
15
|
+
export type NotificationSeverity = 'info' | 'warning' | 'critical';
|
|
16
|
+
/**
|
|
17
|
+
* Notification data structure
|
|
18
|
+
*/
|
|
19
|
+
export interface Notification {
|
|
20
|
+
/**
|
|
21
|
+
* Unique notification ID
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* Type of notification
|
|
26
|
+
*/
|
|
27
|
+
type: NotificationType;
|
|
28
|
+
/**
|
|
29
|
+
* Severity level
|
|
30
|
+
*/
|
|
31
|
+
severity: NotificationSeverity;
|
|
32
|
+
/**
|
|
33
|
+
* Short title for display
|
|
34
|
+
*/
|
|
35
|
+
title: string;
|
|
36
|
+
/**
|
|
37
|
+
* Detailed message
|
|
38
|
+
*/
|
|
39
|
+
message: string;
|
|
40
|
+
/**
|
|
41
|
+
* Type-specific data
|
|
42
|
+
*/
|
|
43
|
+
data?: Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* ISO timestamp when created
|
|
46
|
+
*/
|
|
47
|
+
createdAt: string;
|
|
48
|
+
/**
|
|
49
|
+
* ISO timestamp when user saw the notification
|
|
50
|
+
*/
|
|
51
|
+
readAt?: string;
|
|
52
|
+
/**
|
|
53
|
+
* ISO timestamp when user dismissed the notification
|
|
54
|
+
*/
|
|
55
|
+
dismissedAt?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Input for creating a new notification
|
|
59
|
+
*/
|
|
60
|
+
export interface CreateNotificationInput {
|
|
61
|
+
/**
|
|
62
|
+
* Type of notification
|
|
63
|
+
*/
|
|
64
|
+
type: NotificationType;
|
|
65
|
+
/**
|
|
66
|
+
* Severity level
|
|
67
|
+
*/
|
|
68
|
+
severity: NotificationSeverity;
|
|
69
|
+
/**
|
|
70
|
+
* Short title for display
|
|
71
|
+
*/
|
|
72
|
+
title: string;
|
|
73
|
+
/**
|
|
74
|
+
* Detailed message
|
|
75
|
+
*/
|
|
76
|
+
message: string;
|
|
77
|
+
/**
|
|
78
|
+
* Type-specific data
|
|
79
|
+
*/
|
|
80
|
+
data?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Query options for notifications
|
|
84
|
+
*/
|
|
85
|
+
export interface NotificationQueryOptions {
|
|
86
|
+
/**
|
|
87
|
+
* Filter by type
|
|
88
|
+
*/
|
|
89
|
+
type?: NotificationType;
|
|
90
|
+
/**
|
|
91
|
+
* Filter by severity
|
|
92
|
+
*/
|
|
93
|
+
severity?: NotificationSeverity;
|
|
94
|
+
/**
|
|
95
|
+
* Include dismissed notifications
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
includeDismissed?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Include read notifications
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
includeRead?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Maximum number of notifications to return
|
|
106
|
+
*/
|
|
107
|
+
limit?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Skip first N notifications
|
|
110
|
+
*/
|
|
111
|
+
offset?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Sort order
|
|
114
|
+
* @default 'desc' (newest first)
|
|
115
|
+
*/
|
|
116
|
+
sortOrder?: 'asc' | 'desc';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Generate a unique notification ID
|
|
120
|
+
*
|
|
121
|
+
* @returns Unique ID string
|
|
122
|
+
*/
|
|
123
|
+
export declare function generateNotificationId(): string;
|
|
124
|
+
/**
|
|
125
|
+
* Create a notification from input
|
|
126
|
+
*
|
|
127
|
+
* @param input - Notification input
|
|
128
|
+
* @returns Full notification object
|
|
129
|
+
*/
|
|
130
|
+
export declare function createNotification(input: CreateNotificationInput): Notification;
|
|
131
|
+
/**
|
|
132
|
+
* Check if notification should be shown (not dismissed)
|
|
133
|
+
*
|
|
134
|
+
* @param notification - Notification to check
|
|
135
|
+
* @returns true if notification should be shown
|
|
136
|
+
*/
|
|
137
|
+
export declare function isPendingNotification(notification: Notification): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Check if notification has been read
|
|
140
|
+
*
|
|
141
|
+
* @param notification - Notification to check
|
|
142
|
+
* @returns true if notification has been read
|
|
143
|
+
*/
|
|
144
|
+
export declare function isReadNotification(notification: Notification): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Get severity emoji for display
|
|
147
|
+
*
|
|
148
|
+
* @param severity - Severity level
|
|
149
|
+
* @returns Emoji string
|
|
150
|
+
*/
|
|
151
|
+
export declare function getSeverityEmoji(severity: NotificationSeverity): string;
|
|
152
|
+
/**
|
|
153
|
+
* Get notification type label for display
|
|
154
|
+
*
|
|
155
|
+
* @param type - Notification type
|
|
156
|
+
* @returns Human-readable label
|
|
157
|
+
*/
|
|
158
|
+
export declare function getNotificationTypeLabel(type: NotificationType): string;
|
|
159
|
+
//# sourceMappingURL=notification-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-types.d.ts","sourceRoot":"","sources":["../../../../src/core/notifications/notification-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,OAAO,GACP,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,oBAAoB,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,oBAAoB,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAEhC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,YAAY,CAU/E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,CAWvE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAevE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the types for the notification system.
|
|
5
|
+
*
|
|
6
|
+
* @module core/notifications/notification-types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Generate a unique notification ID
|
|
10
|
+
*
|
|
11
|
+
* @returns Unique ID string
|
|
12
|
+
*/
|
|
13
|
+
export function generateNotificationId() {
|
|
14
|
+
const timestamp = Date.now().toString(36);
|
|
15
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
16
|
+
return `notif-${timestamp}-${random}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a notification from input
|
|
20
|
+
*
|
|
21
|
+
* @param input - Notification input
|
|
22
|
+
* @returns Full notification object
|
|
23
|
+
*/
|
|
24
|
+
export function createNotification(input) {
|
|
25
|
+
return {
|
|
26
|
+
id: generateNotificationId(),
|
|
27
|
+
type: input.type,
|
|
28
|
+
severity: input.severity,
|
|
29
|
+
title: input.title,
|
|
30
|
+
message: input.message,
|
|
31
|
+
data: input.data,
|
|
32
|
+
createdAt: new Date().toISOString(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if notification should be shown (not dismissed)
|
|
37
|
+
*
|
|
38
|
+
* @param notification - Notification to check
|
|
39
|
+
* @returns true if notification should be shown
|
|
40
|
+
*/
|
|
41
|
+
export function isPendingNotification(notification) {
|
|
42
|
+
return !notification.dismissedAt;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if notification has been read
|
|
46
|
+
*
|
|
47
|
+
* @param notification - Notification to check
|
|
48
|
+
* @returns true if notification has been read
|
|
49
|
+
*/
|
|
50
|
+
export function isReadNotification(notification) {
|
|
51
|
+
return !!notification.readAt;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get severity emoji for display
|
|
55
|
+
*
|
|
56
|
+
* @param severity - Severity level
|
|
57
|
+
* @returns Emoji string
|
|
58
|
+
*/
|
|
59
|
+
export function getSeverityEmoji(severity) {
|
|
60
|
+
switch (severity) {
|
|
61
|
+
case 'critical':
|
|
62
|
+
return '❗';
|
|
63
|
+
case 'warning':
|
|
64
|
+
return '⚠️';
|
|
65
|
+
case 'info':
|
|
66
|
+
return 'ℹ️';
|
|
67
|
+
default:
|
|
68
|
+
return '📬';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get notification type label for display
|
|
73
|
+
*
|
|
74
|
+
* @param type - Notification type
|
|
75
|
+
* @returns Human-readable label
|
|
76
|
+
*/
|
|
77
|
+
export function getNotificationTypeLabel(type) {
|
|
78
|
+
switch (type) {
|
|
79
|
+
case 'import-complete':
|
|
80
|
+
return 'Import Complete';
|
|
81
|
+
case 'discrepancy':
|
|
82
|
+
return 'Discrepancy';
|
|
83
|
+
case 'sync-failure':
|
|
84
|
+
return 'Sync Failure';
|
|
85
|
+
case 'drift':
|
|
86
|
+
return 'Drift Detected';
|
|
87
|
+
case 'job-complete':
|
|
88
|
+
return 'Job Complete';
|
|
89
|
+
default:
|
|
90
|
+
return 'Notification';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=notification-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-types.js","sourceRoot":"","sources":["../../../../src/core/notifications/notification-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4IH;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,OAAO,SAAS,SAAS,IAAI,MAAM,EAAE,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA8B;IAC/D,OAAO;QACL,EAAE,EAAE,sBAAsB,EAAE;QAC5B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED;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