local-risk-alert-feed 0.1.0

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.
Files changed (283) hide show
  1. package/dist/cjs/adapters/index.js +8 -0
  2. package/dist/cjs/adapters/index.js.map +1 -0
  3. package/dist/cjs/adapters/lambda.js +143 -0
  4. package/dist/cjs/adapters/lambda.js.map +1 -0
  5. package/dist/cjs/adapters/vercel.js +119 -0
  6. package/dist/cjs/adapters/vercel.js.map +1 -0
  7. package/dist/cjs/core/alert-aggregator.js +207 -0
  8. package/dist/cjs/core/alert-aggregator.js.map +1 -0
  9. package/dist/cjs/core/alert-feed.js +236 -0
  10. package/dist/cjs/core/alert-feed.js.map +1 -0
  11. package/dist/cjs/core/index.js +22 -0
  12. package/dist/cjs/core/index.js.map +1 -0
  13. package/dist/cjs/core/plugin-registry.js +193 -0
  14. package/dist/cjs/core/plugin-registry.js.map +1 -0
  15. package/dist/cjs/core/plugin-resolver.js +121 -0
  16. package/dist/cjs/core/plugin-resolver.js.map +1 -0
  17. package/dist/cjs/core/time-range.js +67 -0
  18. package/dist/cjs/core/time-range.js.map +1 -0
  19. package/dist/cjs/errors/fetch-error.js +71 -0
  20. package/dist/cjs/errors/fetch-error.js.map +1 -0
  21. package/dist/cjs/errors/index.js +15 -0
  22. package/dist/cjs/errors/index.js.map +1 -0
  23. package/dist/cjs/errors/plugin-error.js +80 -0
  24. package/dist/cjs/errors/plugin-error.js.map +1 -0
  25. package/dist/cjs/errors/validation-error.js +49 -0
  26. package/dist/cjs/errors/validation-error.js.map +1 -0
  27. package/dist/cjs/geo/distance.js +94 -0
  28. package/dist/cjs/geo/distance.js.map +1 -0
  29. package/dist/cjs/geo/index.js +18 -0
  30. package/dist/cjs/geo/index.js.map +1 -0
  31. package/dist/cjs/geo/point-in-radius.js +86 -0
  32. package/dist/cjs/geo/point-in-radius.js.map +1 -0
  33. package/dist/cjs/index.js +90 -0
  34. package/dist/cjs/index.js.map +1 -0
  35. package/dist/cjs/plugins/air-quality/airnow.plugin.js +343 -0
  36. package/dist/cjs/plugins/air-quality/airnow.plugin.js.map +1 -0
  37. package/dist/cjs/plugins/air-quality/index.js +6 -0
  38. package/dist/cjs/plugins/air-quality/index.js.map +1 -0
  39. package/dist/cjs/plugins/base-plugin.js +213 -0
  40. package/dist/cjs/plugins/base-plugin.js.map +1 -0
  41. package/dist/cjs/plugins/events/index.js +6 -0
  42. package/dist/cjs/plugins/events/index.js.map +1 -0
  43. package/dist/cjs/plugins/events/phoenix-events.plugin.js +382 -0
  44. package/dist/cjs/plugins/events/phoenix-events.plugin.js.map +1 -0
  45. package/dist/cjs/plugins/fire-emt/index.js +6 -0
  46. package/dist/cjs/plugins/fire-emt/index.js.map +1 -0
  47. package/dist/cjs/plugins/fire-emt/phoenix-fire.plugin.js +262 -0
  48. package/dist/cjs/plugins/fire-emt/phoenix-fire.plugin.js.map +1 -0
  49. package/dist/cjs/plugins/index.js +28 -0
  50. package/dist/cjs/plugins/index.js.map +1 -0
  51. package/dist/cjs/plugins/police-blotter/index.js +6 -0
  52. package/dist/cjs/plugins/police-blotter/index.js.map +1 -0
  53. package/dist/cjs/plugins/police-blotter/phoenix-police.plugin.js +198 -0
  54. package/dist/cjs/plugins/police-blotter/phoenix-police.plugin.js.map +1 -0
  55. package/dist/cjs/plugins/pulsepoint/index.js +6 -0
  56. package/dist/cjs/plugins/pulsepoint/index.js.map +1 -0
  57. package/dist/cjs/plugins/pulsepoint/pulsepoint.plugin.js +275 -0
  58. package/dist/cjs/plugins/pulsepoint/pulsepoint.plugin.js.map +1 -0
  59. package/dist/cjs/plugins/traffic/arizona-traffic.plugin.js +391 -0
  60. package/dist/cjs/plugins/traffic/arizona-traffic.plugin.js.map +1 -0
  61. package/dist/cjs/plugins/traffic/index.js +6 -0
  62. package/dist/cjs/plugins/traffic/index.js.map +1 -0
  63. package/dist/cjs/plugins/weather/index.js +6 -0
  64. package/dist/cjs/plugins/weather/index.js.map +1 -0
  65. package/dist/cjs/plugins/weather/nws-weather.plugin.js +180 -0
  66. package/dist/cjs/plugins/weather/nws-weather.plugin.js.map +1 -0
  67. package/dist/cjs/schemas/alert.schema.js +93 -0
  68. package/dist/cjs/schemas/alert.schema.js.map +1 -0
  69. package/dist/cjs/schemas/index.js +24 -0
  70. package/dist/cjs/schemas/index.js.map +1 -0
  71. package/dist/cjs/schemas/query.schema.js +76 -0
  72. package/dist/cjs/schemas/query.schema.js.map +1 -0
  73. package/dist/cjs/types/alert.js +35 -0
  74. package/dist/cjs/types/alert.js.map +1 -0
  75. package/dist/cjs/types/config.js +13 -0
  76. package/dist/cjs/types/config.js.map +1 -0
  77. package/dist/cjs/types/geo.js +3 -0
  78. package/dist/cjs/types/geo.js.map +1 -0
  79. package/dist/cjs/types/index.js +16 -0
  80. package/dist/cjs/types/index.js.map +1 -0
  81. package/dist/cjs/types/plugin.js +3 -0
  82. package/dist/cjs/types/plugin.js.map +1 -0
  83. package/dist/cjs/types/query.js +28 -0
  84. package/dist/cjs/types/query.js.map +1 -0
  85. package/dist/cjs/utils/cache.js +188 -0
  86. package/dist/cjs/utils/cache.js.map +1 -0
  87. package/dist/cjs/utils/csv.js +189 -0
  88. package/dist/cjs/utils/csv.js.map +1 -0
  89. package/dist/cjs/utils/date.js +153 -0
  90. package/dist/cjs/utils/date.js.map +1 -0
  91. package/dist/cjs/utils/index.js +28 -0
  92. package/dist/cjs/utils/index.js.map +1 -0
  93. package/dist/cjs/utils/retry.js +109 -0
  94. package/dist/cjs/utils/retry.js.map +1 -0
  95. package/dist/esm/adapters/index.js +3 -0
  96. package/dist/esm/adapters/index.js.map +1 -0
  97. package/dist/esm/adapters/lambda.js +140 -0
  98. package/dist/esm/adapters/lambda.js.map +1 -0
  99. package/dist/esm/adapters/vercel.js +116 -0
  100. package/dist/esm/adapters/vercel.js.map +1 -0
  101. package/dist/esm/core/alert-aggregator.js +203 -0
  102. package/dist/esm/core/alert-aggregator.js.map +1 -0
  103. package/dist/esm/core/alert-feed.js +232 -0
  104. package/dist/esm/core/alert-feed.js.map +1 -0
  105. package/dist/esm/core/index.js +6 -0
  106. package/dist/esm/core/index.js.map +1 -0
  107. package/dist/esm/core/plugin-registry.js +189 -0
  108. package/dist/esm/core/plugin-registry.js.map +1 -0
  109. package/dist/esm/core/plugin-resolver.js +117 -0
  110. package/dist/esm/core/plugin-resolver.js.map +1 -0
  111. package/dist/esm/core/time-range.js +57 -0
  112. package/dist/esm/core/time-range.js.map +1 -0
  113. package/dist/esm/errors/fetch-error.js +67 -0
  114. package/dist/esm/errors/fetch-error.js.map +1 -0
  115. package/dist/esm/errors/index.js +4 -0
  116. package/dist/esm/errors/index.js.map +1 -0
  117. package/dist/esm/errors/plugin-error.js +71 -0
  118. package/dist/esm/errors/plugin-error.js.map +1 -0
  119. package/dist/esm/errors/validation-error.js +45 -0
  120. package/dist/esm/errors/validation-error.js.map +1 -0
  121. package/dist/esm/geo/distance.js +85 -0
  122. package/dist/esm/geo/distance.js.map +1 -0
  123. package/dist/esm/geo/index.js +3 -0
  124. package/dist/esm/geo/index.js.map +1 -0
  125. package/dist/esm/geo/point-in-radius.js +79 -0
  126. package/dist/esm/geo/point-in-radius.js.map +1 -0
  127. package/dist/esm/index.js +30 -0
  128. package/dist/esm/index.js.map +1 -0
  129. package/dist/esm/plugins/air-quality/airnow.plugin.js +339 -0
  130. package/dist/esm/plugins/air-quality/airnow.plugin.js.map +1 -0
  131. package/dist/esm/plugins/air-quality/index.js +2 -0
  132. package/dist/esm/plugins/air-quality/index.js.map +1 -0
  133. package/dist/esm/plugins/base-plugin.js +209 -0
  134. package/dist/esm/plugins/base-plugin.js.map +1 -0
  135. package/dist/esm/plugins/events/index.js +2 -0
  136. package/dist/esm/plugins/events/index.js.map +1 -0
  137. package/dist/esm/plugins/events/phoenix-events.plugin.js +378 -0
  138. package/dist/esm/plugins/events/phoenix-events.plugin.js.map +1 -0
  139. package/dist/esm/plugins/fire-emt/index.js +2 -0
  140. package/dist/esm/plugins/fire-emt/index.js.map +1 -0
  141. package/dist/esm/plugins/fire-emt/phoenix-fire.plugin.js +258 -0
  142. package/dist/esm/plugins/fire-emt/phoenix-fire.plugin.js.map +1 -0
  143. package/dist/esm/plugins/index.js +17 -0
  144. package/dist/esm/plugins/index.js.map +1 -0
  145. package/dist/esm/plugins/police-blotter/index.js +2 -0
  146. package/dist/esm/plugins/police-blotter/index.js.map +1 -0
  147. package/dist/esm/plugins/police-blotter/phoenix-police.plugin.js +194 -0
  148. package/dist/esm/plugins/police-blotter/phoenix-police.plugin.js.map +1 -0
  149. package/dist/esm/plugins/pulsepoint/index.js +2 -0
  150. package/dist/esm/plugins/pulsepoint/index.js.map +1 -0
  151. package/dist/esm/plugins/pulsepoint/pulsepoint.plugin.js +271 -0
  152. package/dist/esm/plugins/pulsepoint/pulsepoint.plugin.js.map +1 -0
  153. package/dist/esm/plugins/traffic/arizona-traffic.plugin.js +387 -0
  154. package/dist/esm/plugins/traffic/arizona-traffic.plugin.js.map +1 -0
  155. package/dist/esm/plugins/traffic/index.js +2 -0
  156. package/dist/esm/plugins/traffic/index.js.map +1 -0
  157. package/dist/esm/plugins/weather/index.js +2 -0
  158. package/dist/esm/plugins/weather/index.js.map +1 -0
  159. package/dist/esm/plugins/weather/nws-weather.plugin.js +176 -0
  160. package/dist/esm/plugins/weather/nws-weather.plugin.js.map +1 -0
  161. package/dist/esm/schemas/alert.schema.js +90 -0
  162. package/dist/esm/schemas/alert.schema.js.map +1 -0
  163. package/dist/esm/schemas/index.js +5 -0
  164. package/dist/esm/schemas/index.js.map +1 -0
  165. package/dist/esm/schemas/query.schema.js +72 -0
  166. package/dist/esm/schemas/query.schema.js.map +1 -0
  167. package/dist/esm/types/alert.js +32 -0
  168. package/dist/esm/types/alert.js.map +1 -0
  169. package/dist/esm/types/config.js +10 -0
  170. package/dist/esm/types/config.js.map +1 -0
  171. package/dist/esm/types/geo.js +2 -0
  172. package/dist/esm/types/geo.js.map +1 -0
  173. package/dist/esm/types/index.js +4 -0
  174. package/dist/esm/types/index.js.map +1 -0
  175. package/dist/esm/types/plugin.js +2 -0
  176. package/dist/esm/types/plugin.js.map +1 -0
  177. package/dist/esm/types/query.js +25 -0
  178. package/dist/esm/types/query.js.map +1 -0
  179. package/dist/esm/utils/cache.js +181 -0
  180. package/dist/esm/utils/cache.js.map +1 -0
  181. package/dist/esm/utils/csv.js +185 -0
  182. package/dist/esm/utils/csv.js.map +1 -0
  183. package/dist/esm/utils/date.js +142 -0
  184. package/dist/esm/utils/date.js.map +1 -0
  185. package/dist/esm/utils/index.js +5 -0
  186. package/dist/esm/utils/index.js.map +1 -0
  187. package/dist/esm/utils/retry.js +102 -0
  188. package/dist/esm/utils/retry.js.map +1 -0
  189. package/dist/types/adapters/index.d.ts +5 -0
  190. package/dist/types/adapters/index.d.ts.map +1 -0
  191. package/dist/types/adapters/lambda.d.ts +37 -0
  192. package/dist/types/adapters/lambda.d.ts.map +1 -0
  193. package/dist/types/adapters/vercel.d.ts +54 -0
  194. package/dist/types/adapters/vercel.d.ts.map +1 -0
  195. package/dist/types/core/alert-aggregator.d.ts +81 -0
  196. package/dist/types/core/alert-aggregator.d.ts.map +1 -0
  197. package/dist/types/core/alert-feed.d.ts +80 -0
  198. package/dist/types/core/alert-feed.d.ts.map +1 -0
  199. package/dist/types/core/index.d.ts +8 -0
  200. package/dist/types/core/index.d.ts.map +1 -0
  201. package/dist/types/core/plugin-registry.d.ts +91 -0
  202. package/dist/types/core/plugin-registry.d.ts.map +1 -0
  203. package/dist/types/core/plugin-resolver.d.ts +78 -0
  204. package/dist/types/core/plugin-resolver.d.ts.map +1 -0
  205. package/dist/types/core/time-range.d.ts +40 -0
  206. package/dist/types/core/time-range.d.ts.map +1 -0
  207. package/dist/types/errors/fetch-error.d.ts +46 -0
  208. package/dist/types/errors/fetch-error.d.ts.map +1 -0
  209. package/dist/types/errors/index.d.ts +5 -0
  210. package/dist/types/errors/index.d.ts.map +1 -0
  211. package/dist/types/errors/plugin-error.d.ts +42 -0
  212. package/dist/types/errors/plugin-error.d.ts.map +1 -0
  213. package/dist/types/errors/validation-error.d.ts +34 -0
  214. package/dist/types/errors/validation-error.d.ts.map +1 -0
  215. package/dist/types/geo/distance.d.ts +50 -0
  216. package/dist/types/geo/distance.d.ts.map +1 -0
  217. package/dist/types/geo/index.d.ts +3 -0
  218. package/dist/types/geo/index.d.ts.map +1 -0
  219. package/dist/types/geo/point-in-radius.d.ts +44 -0
  220. package/dist/types/geo/point-in-radius.d.ts.map +1 -0
  221. package/dist/types/index.d.ts +32 -0
  222. package/dist/types/index.d.ts.map +1 -0
  223. package/dist/types/plugins/air-quality/airnow.plugin.d.ts +84 -0
  224. package/dist/types/plugins/air-quality/airnow.plugin.d.ts.map +1 -0
  225. package/dist/types/plugins/air-quality/index.d.ts +3 -0
  226. package/dist/types/plugins/air-quality/index.d.ts.map +1 -0
  227. package/dist/types/plugins/base-plugin.d.ts +99 -0
  228. package/dist/types/plugins/base-plugin.d.ts.map +1 -0
  229. package/dist/types/plugins/events/index.d.ts +3 -0
  230. package/dist/types/plugins/events/index.d.ts.map +1 -0
  231. package/dist/types/plugins/events/phoenix-events.plugin.d.ts +71 -0
  232. package/dist/types/plugins/events/phoenix-events.plugin.d.ts.map +1 -0
  233. package/dist/types/plugins/fire-emt/index.d.ts +3 -0
  234. package/dist/types/plugins/fire-emt/index.d.ts.map +1 -0
  235. package/dist/types/plugins/fire-emt/phoenix-fire.plugin.d.ts +47 -0
  236. package/dist/types/plugins/fire-emt/phoenix-fire.plugin.d.ts.map +1 -0
  237. package/dist/types/plugins/index.d.ts +17 -0
  238. package/dist/types/plugins/index.d.ts.map +1 -0
  239. package/dist/types/plugins/police-blotter/index.d.ts +3 -0
  240. package/dist/types/plugins/police-blotter/index.d.ts.map +1 -0
  241. package/dist/types/plugins/police-blotter/phoenix-police.plugin.d.ts +49 -0
  242. package/dist/types/plugins/police-blotter/phoenix-police.plugin.d.ts.map +1 -0
  243. package/dist/types/plugins/pulsepoint/index.d.ts +3 -0
  244. package/dist/types/plugins/pulsepoint/index.d.ts.map +1 -0
  245. package/dist/types/plugins/pulsepoint/pulsepoint.plugin.d.ts +61 -0
  246. package/dist/types/plugins/pulsepoint/pulsepoint.plugin.d.ts.map +1 -0
  247. package/dist/types/plugins/traffic/arizona-traffic.plugin.d.ts +83 -0
  248. package/dist/types/plugins/traffic/arizona-traffic.plugin.d.ts.map +1 -0
  249. package/dist/types/plugins/traffic/index.d.ts +3 -0
  250. package/dist/types/plugins/traffic/index.d.ts.map +1 -0
  251. package/dist/types/plugins/weather/index.d.ts +3 -0
  252. package/dist/types/plugins/weather/index.d.ts.map +1 -0
  253. package/dist/types/plugins/weather/nws-weather.plugin.d.ts +50 -0
  254. package/dist/types/plugins/weather/nws-weather.plugin.d.ts.map +1 -0
  255. package/dist/types/schemas/alert.schema.d.ts +266 -0
  256. package/dist/types/schemas/alert.schema.d.ts.map +1 -0
  257. package/dist/types/schemas/index.d.ts +5 -0
  258. package/dist/types/schemas/index.d.ts.map +1 -0
  259. package/dist/types/schemas/query.schema.d.ts +150 -0
  260. package/dist/types/schemas/query.schema.d.ts.map +1 -0
  261. package/dist/types/types/alert.d.ts +96 -0
  262. package/dist/types/types/alert.d.ts.map +1 -0
  263. package/dist/types/types/config.d.ts +63 -0
  264. package/dist/types/types/config.d.ts.map +1 -0
  265. package/dist/types/types/geo.d.ts +33 -0
  266. package/dist/types/types/geo.d.ts.map +1 -0
  267. package/dist/types/types/index.d.ts +9 -0
  268. package/dist/types/types/index.d.ts.map +1 -0
  269. package/dist/types/types/plugin.d.ts +125 -0
  270. package/dist/types/types/plugin.d.ts.map +1 -0
  271. package/dist/types/types/query.d.ts +86 -0
  272. package/dist/types/types/query.d.ts.map +1 -0
  273. package/dist/types/utils/cache.d.ts +112 -0
  274. package/dist/types/utils/cache.d.ts.map +1 -0
  275. package/dist/types/utils/csv.d.ts +38 -0
  276. package/dist/types/utils/csv.d.ts.map +1 -0
  277. package/dist/types/utils/date.d.ts +47 -0
  278. package/dist/types/utils/date.d.ts.map +1 -0
  279. package/dist/types/utils/index.d.ts +7 -0
  280. package/dist/types/utils/index.d.ts.map +1 -0
  281. package/dist/types/utils/retry.d.ts +51 -0
  282. package/dist/types/utils/retry.d.ts.map +1 -0
  283. package/package.json +115 -0
@@ -0,0 +1,96 @@
1
+ import type { AlertLocation } from './geo';
2
+ /**
3
+ * Risk levels from lowest to highest severity.
4
+ */
5
+ export type RiskLevel = 'low' | 'moderate' | 'high' | 'severe' | 'extreme';
6
+ /**
7
+ * Priority levels where 1 is the highest priority.
8
+ */
9
+ export type AlertPriority = 1 | 2 | 3 | 4 | 5;
10
+ /**
11
+ * Categories of alerts.
12
+ */
13
+ export type AlertCategory = 'crime' | 'fire' | 'medical' | 'weather' | 'traffic' | 'event' | 'civil-unrest' | 'other';
14
+ /**
15
+ * Temporal classification of alerts.
16
+ * - historical: Events that have already occurred
17
+ * - scheduled: Events that are planned for the future
18
+ * - real-time: Events happening now or in progress
19
+ */
20
+ export type AlertTemporalType = 'historical' | 'scheduled' | 'real-time';
21
+ /**
22
+ * Source type classification.
23
+ */
24
+ export type AlertSourceType = 'police' | 'fire' | 'weather' | 'events' | 'traffic' | 'other';
25
+ /**
26
+ * Timestamps associated with an alert.
27
+ */
28
+ export interface AlertTimestamps {
29
+ /** When the alert was created/issued */
30
+ issued: string;
31
+ /** When the event started or is scheduled to start */
32
+ eventStart?: string;
33
+ /** When the event ended or is scheduled to end */
34
+ eventEnd?: string;
35
+ /** When the alert expires and should no longer be displayed */
36
+ expires?: string;
37
+ }
38
+ /**
39
+ * Information about the source of an alert.
40
+ */
41
+ export interface AlertSource {
42
+ /** Unique identifier of the plugin that generated this alert */
43
+ pluginId: string;
44
+ /** Human-readable name of the source */
45
+ name: string;
46
+ /** External identifier from the original data source */
47
+ externalId?: string;
48
+ /** Type classification of the source */
49
+ type: AlertSourceType;
50
+ }
51
+ /**
52
+ * Represents a risk alert from any source.
53
+ */
54
+ export interface Alert {
55
+ /** Unique identifier for this alert */
56
+ id: string;
57
+ /** Short title/headline for the alert */
58
+ title: string;
59
+ /** Detailed description of the alert */
60
+ description: string;
61
+ /** Risk level assessment */
62
+ riskLevel: RiskLevel;
63
+ /** Priority ranking (1 = highest) */
64
+ priority: AlertPriority;
65
+ /** Category classification */
66
+ category: AlertCategory;
67
+ /** Temporal classification */
68
+ temporalType: AlertTemporalType;
69
+ /** Location information */
70
+ location: AlertLocation;
71
+ /** Relevant timestamps */
72
+ timestamps: AlertTimestamps;
73
+ /** Source information */
74
+ source: AlertSource;
75
+ /** URL for more information */
76
+ url?: string;
77
+ /** Additional metadata from the source */
78
+ metadata?: Record<string, unknown>;
79
+ }
80
+ /**
81
+ * Numeric mapping for risk levels (for sorting/comparison).
82
+ */
83
+ export declare const RISK_LEVEL_VALUES: Record<RiskLevel, number>;
84
+ /**
85
+ * Ordered list of risk levels from lowest to highest.
86
+ */
87
+ export declare const RISK_LEVELS: RiskLevel[];
88
+ /**
89
+ * All supported alert categories.
90
+ */
91
+ export declare const ALERT_CATEGORIES: AlertCategory[];
92
+ /**
93
+ * All supported temporal types.
94
+ */
95
+ export declare const ALERT_TEMPORAL_TYPES: AlertTemporalType[];
96
+ //# sourceMappingURL=alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/types/alert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,cAAc,GACd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0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,EAAqD,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAS3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAA6C,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { AlertPlugin } from './plugin';
2
+ /**
3
+ * Cache provider interface for storing and retrieving cached data.
4
+ */
5
+ export interface CacheProvider {
6
+ /**
7
+ * Get a value from the cache.
8
+ * @param key - Cache key
9
+ * @returns The cached value or null if not found
10
+ */
11
+ get<T>(key: string): Promise<T | null>;
12
+ /**
13
+ * Set a value in the cache.
14
+ * @param key - Cache key
15
+ * @param value - Value to cache
16
+ * @param ttlMs - Time to live in milliseconds
17
+ */
18
+ set<T>(key: string, value: T, ttlMs?: number): Promise<void>;
19
+ /**
20
+ * Delete a value from the cache.
21
+ * @param key - Cache key
22
+ */
23
+ delete(key: string): Promise<void>;
24
+ /**
25
+ * Check if a key exists in the cache.
26
+ * @param key - Cache key
27
+ * @returns true if the key exists
28
+ */
29
+ has(key: string): Promise<boolean>;
30
+ }
31
+ /**
32
+ * Plugin registration with optional configuration.
33
+ */
34
+ export interface PluginRegistration {
35
+ /** The plugin instance */
36
+ plugin: AlertPlugin;
37
+ /** Optional plugin-specific configuration */
38
+ config?: Record<string, unknown>;
39
+ /** Whether this plugin is enabled (default: true) */
40
+ enabled?: boolean;
41
+ }
42
+ /**
43
+ * Configuration options for the AlertFeed.
44
+ */
45
+ export interface AlertFeedConfig {
46
+ /** Plugins to register */
47
+ plugins?: PluginRegistration[];
48
+ /** Cache provider for caching responses */
49
+ cache?: CacheProvider;
50
+ /** Default cache TTL in milliseconds (default: 5 minutes) */
51
+ defaultCacheTtlMs?: number;
52
+ /** Timeout for plugin fetch operations in milliseconds (default: 30 seconds) */
53
+ pluginTimeoutMs?: number;
54
+ /** Whether to continue if a plugin fails (default: true) */
55
+ continueOnPluginError?: boolean;
56
+ /** Maximum concurrent plugin fetches (default: 5) */
57
+ maxConcurrentFetches?: number;
58
+ }
59
+ /**
60
+ * Default configuration values.
61
+ */
62
+ export declare const DEFAULT_CONFIG: Required<Pick<AlertFeedConfig, 'defaultCacheTtlMs' | 'pluginTimeoutMs' | 'continueOnPluginError' | 'maxConcurrentFetches'>>;
63
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qDAAqD;IACrD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,IAAI,CACF,eAAe,EACf,mBAAmB,GAAG,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAC3F,CAMF,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Represents a geographic point with latitude and longitude coordinates.
3
+ */
4
+ export interface GeoPoint {
5
+ latitude: number;
6
+ longitude: number;
7
+ }
8
+ /**
9
+ * Represents a geographic bounding box defined by southwest and northeast corners.
10
+ */
11
+ export interface GeoBoundingBox {
12
+ southwest: GeoPoint;
13
+ northeast: GeoPoint;
14
+ }
15
+ /**
16
+ * Represents a geographic circle defined by a center point and radius.
17
+ */
18
+ export interface GeoCircle {
19
+ center: GeoPoint;
20
+ radiusMeters: number;
21
+ }
22
+ /**
23
+ * Location information that can be attached to an alert.
24
+ */
25
+ export interface AlertLocation {
26
+ point: GeoPoint;
27
+ radiusMeters?: number;
28
+ address?: string;
29
+ city?: string;
30
+ state?: string;
31
+ zipCode?: string;
32
+ }
33
+ //# sourceMappingURL=geo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo.d.ts","sourceRoot":"","sources":["../../../src/types/geo.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,QAAQ,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,QAAQ,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,9 @@
1
+ export type { GeoPoint, GeoBoundingBox, GeoCircle, AlertLocation } from './geo';
2
+ export type { RiskLevel, AlertPriority, AlertCategory, AlertTemporalType, AlertSourceType, AlertTimestamps, AlertSource, Alert, } from './alert';
3
+ export { RISK_LEVEL_VALUES, RISK_LEVELS, ALERT_CATEGORIES, ALERT_TEMPORAL_TYPES, } from './alert';
4
+ export type { PluginCoverageType, PluginCoverage, PluginMetadata, PluginFetchOptions, PluginFetchResult, AlertPlugin, PluginResultInfo, } from './plugin';
5
+ export type { TimeRangePreset, TimeRange, TimeRangeInput, AlertQuery, AlertQueryMeta, AlertQueryResponse, } from './query';
6
+ export { DEFAULT_QUERY_RADIUS_METERS, DEFAULT_QUERY_LIMIT, MAX_QUERY_LIMIT, TIME_RANGE_PRESETS, } from './query';
7
+ export type { CacheProvider, PluginRegistration, AlertFeedConfig } from './config';
8
+ export { DEFAULT_CONFIG } from './config';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGhF,YAAY,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,KAAK,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,eAAe,EACf,SAAS,EACT,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,125 @@
1
+ import type { GeoPoint } from './geo';
2
+ import type { Alert, AlertCategory, AlertTemporalType } from './alert';
3
+ import type { TimeRange } from './query';
4
+ /**
5
+ * Coverage type for a plugin.
6
+ * - regional: Covers a specific geographic area (center + radius)
7
+ * - global: Covers all locations worldwide
8
+ */
9
+ export type PluginCoverageType = 'regional' | 'global';
10
+ /**
11
+ * Describes the geographic coverage of a plugin.
12
+ */
13
+ export interface PluginCoverage {
14
+ /** Type of coverage */
15
+ type: PluginCoverageType;
16
+ /** Center point for regional coverage */
17
+ center?: GeoPoint;
18
+ /** Radius in meters for regional coverage */
19
+ radiusMeters?: number;
20
+ /** Human-readable description of the coverage area */
21
+ description: string;
22
+ }
23
+ /**
24
+ * Metadata describing a plugin's capabilities and coverage.
25
+ */
26
+ export interface PluginMetadata {
27
+ /** Unique identifier for the plugin */
28
+ id: string;
29
+ /** Human-readable name */
30
+ name: string;
31
+ /** Semantic version string */
32
+ version: string;
33
+ /** Description of what the plugin provides */
34
+ description: string;
35
+ /** Geographic coverage information */
36
+ coverage: PluginCoverage;
37
+ /** Temporal types this plugin can provide */
38
+ supportedTemporalTypes: AlertTemporalType[];
39
+ /** Alert categories this plugin can provide */
40
+ supportedCategories: AlertCategory[];
41
+ /** Suggested refresh interval in milliseconds */
42
+ refreshIntervalMs?: number;
43
+ }
44
+ /**
45
+ * Options passed to a plugin when fetching alerts.
46
+ */
47
+ export interface PluginFetchOptions {
48
+ /** The location being queried */
49
+ location: GeoPoint;
50
+ /** Radius around the location in meters */
51
+ radiusMeters: number;
52
+ /** Time range for alerts */
53
+ timeRange: TimeRange;
54
+ /** Maximum number of alerts to return */
55
+ limit?: number;
56
+ /** Filter by specific categories */
57
+ categories?: AlertCategory[];
58
+ /** Filter by specific temporal types */
59
+ temporalTypes?: AlertTemporalType[];
60
+ }
61
+ /**
62
+ * Result returned by a plugin's fetchAlerts method.
63
+ */
64
+ export interface PluginFetchResult {
65
+ /** Alerts fetched by the plugin */
66
+ alerts: Alert[];
67
+ /** Whether the results were served from cache */
68
+ fromCache?: boolean;
69
+ /** Cache key used (if applicable) */
70
+ cacheKey?: string;
71
+ /** When the cache entry expires (if applicable) */
72
+ cacheExpiresAt?: string;
73
+ /** Any warnings generated during fetch */
74
+ warnings?: string[];
75
+ }
76
+ /**
77
+ * Interface that all alert plugins must implement.
78
+ */
79
+ export interface AlertPlugin {
80
+ /** Plugin metadata describing capabilities and coverage */
81
+ readonly metadata: PluginMetadata;
82
+ /**
83
+ * Initialize the plugin with optional configuration.
84
+ * Called once when the plugin is registered.
85
+ */
86
+ initialize?(config?: Record<string, unknown>): Promise<void>;
87
+ /**
88
+ * Check if this plugin covers the given geographic point.
89
+ * @param point - The location to check
90
+ * @returns true if the plugin can provide alerts for this location
91
+ */
92
+ coversLocation(point: GeoPoint): boolean;
93
+ /**
94
+ * Fetch alerts based on the provided options.
95
+ * @param options - Query options including location, time range, etc.
96
+ * @returns Promise resolving to the fetch result with alerts
97
+ */
98
+ fetchAlerts(options: PluginFetchOptions): Promise<PluginFetchResult>;
99
+ /**
100
+ * Clean up resources when the plugin is unregistered.
101
+ */
102
+ dispose?(): Promise<void>;
103
+ }
104
+ /**
105
+ * Information about a plugin's execution result.
106
+ */
107
+ export interface PluginResultInfo {
108
+ /** Plugin identifier */
109
+ pluginId: string;
110
+ /** Plugin name */
111
+ pluginName: string;
112
+ /** Whether the plugin executed successfully */
113
+ success: boolean;
114
+ /** Number of alerts returned */
115
+ alertCount: number;
116
+ /** Execution time in milliseconds */
117
+ durationMs: number;
118
+ /** Error message if failed */
119
+ error?: string;
120
+ /** Whether results came from cache */
121
+ fromCache?: boolean;
122
+ /** Any warnings generated */
123
+ warnings?: string[];
124
+ }
125
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,kBAAkB,CAAC;IACzB,yCAAyC;IACzC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,EAAE,EAA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CAAC,CAAC;IAE7D;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEzC;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAErE;;OAEG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
@@ -0,0 +1,86 @@
1
+ import type { GeoPoint } from './geo';
2
+ import type { Alert, AlertCategory, AlertTemporalType, RiskLevel } from './alert';
3
+ import type { PluginResultInfo } from './plugin';
4
+ /**
5
+ * Preset time range identifiers.
6
+ */
7
+ export type TimeRangePreset = 'past-24h' | 'past-7d' | 'past-30d' | 'next-4h' | 'next-12h' | 'next-24h' | 'next-7d';
8
+ /**
9
+ * Explicit time range with start and end dates.
10
+ */
11
+ export interface TimeRange {
12
+ /** Start of the time range (ISO 8601 string) */
13
+ start: string;
14
+ /** End of the time range (ISO 8601 string) */
15
+ end: string;
16
+ }
17
+ /**
18
+ * Input type for time range that accepts either a preset or explicit range.
19
+ */
20
+ export type TimeRangeInput = TimeRange | TimeRangePreset;
21
+ /**
22
+ * Default radius in meters when not specified in a query.
23
+ */
24
+ export declare const DEFAULT_QUERY_RADIUS_METERS = 10000;
25
+ /**
26
+ * Default limit for number of alerts returned.
27
+ */
28
+ export declare const DEFAULT_QUERY_LIMIT = 100;
29
+ /**
30
+ * Maximum allowed limit for alerts.
31
+ */
32
+ export declare const MAX_QUERY_LIMIT = 1000;
33
+ /**
34
+ * Query parameters for fetching alerts.
35
+ */
36
+ export interface AlertQuery {
37
+ /** Center point for the query */
38
+ location: GeoPoint;
39
+ /** Radius around the location in meters */
40
+ radiusMeters?: number;
41
+ /** Time range for alerts (preset or explicit) */
42
+ timeRange?: TimeRangeInput;
43
+ /** Maximum number of alerts to return */
44
+ limit?: number;
45
+ /** Minimum risk level to include */
46
+ minRiskLevel?: RiskLevel;
47
+ /** Filter by specific categories */
48
+ categories?: AlertCategory[];
49
+ /** Filter by specific temporal types */
50
+ temporalTypes?: AlertTemporalType[];
51
+ /** Include detailed plugin execution information */
52
+ includePluginResults?: boolean;
53
+ }
54
+ /**
55
+ * Metadata about the query response.
56
+ */
57
+ export interface AlertQueryMeta {
58
+ /** Total number of alerts (before any client-side truncation) */
59
+ totalCount: number;
60
+ /** When the query was executed (ISO 8601 string) */
61
+ queriedAt: string;
62
+ /** Resolved time range used for the query */
63
+ timeRange: TimeRange;
64
+ /** Location that was queried */
65
+ location: GeoPoint;
66
+ /** Radius used for the query */
67
+ radiusMeters: number;
68
+ /** Whether results were truncated due to limit */
69
+ truncated: boolean;
70
+ }
71
+ /**
72
+ * Response from an alert query.
73
+ */
74
+ export interface AlertQueryResponse {
75
+ /** Array of alerts matching the query */
76
+ alerts: Alert[];
77
+ /** Metadata about the query */
78
+ meta: AlertQueryMeta;
79
+ /** Detailed plugin execution results (if includePluginResults was true) */
80
+ pluginResults?: PluginResultInfo[];
81
+ }
82
+ /**
83
+ * All available time range presets.
84
+ */
85
+ export declare const TIME_RANGE_PRESETS: TimeRangePreset[];
86
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/types/query.ts"],"names":[],"mapp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oD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,SAAS,EAAE,SAAS,CAAC;IACrB,gCAAgC;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,+BAA+B;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAAe,EAQ/C,CAAC"}
@@ -0,0 +1,112 @@
1
+ import type { CacheProvider } from '../types';
2
+ /**
3
+ * In-memory cache provider implementation.
4
+ * Suitable for development, testing, or single-instance deployments.
5
+ */
6
+ export declare class InMemoryCacheProvider implements CacheProvider {
7
+ private cache;
8
+ private cleanupIntervalId?;
9
+ constructor(cleanupIntervalMs?: number);
10
+ get<T>(key: string): Promise<T | null>;
11
+ set<T>(key: string, value: T, ttlMs?: number): Promise<void>;
12
+ delete(key: string): Promise<void>;
13
+ has(key: string): Promise<boolean>;
14
+ /**
15
+ * Clear all entries from the cache.
16
+ */
17
+ clear(): Promise<void>;
18
+ /**
19
+ * Get the number of entries in the cache.
20
+ */
21
+ size(): number;
22
+ /**
23
+ * Dispose of the cache provider and stop cleanup interval.
24
+ */
25
+ dispose(): void;
26
+ /**
27
+ * Remove expired entries from the cache.
28
+ */
29
+ private cleanup;
30
+ }
31
+ /**
32
+ * Vercel KV cache provider implementation.
33
+ * Requires @vercel/kv package to be installed.
34
+ */
35
+ export declare class VercelKVCacheProvider implements CacheProvider {
36
+ private kv;
37
+ private prefix;
38
+ constructor(kv: VercelKVClient, prefix?: string);
39
+ private getKey;
40
+ get<T>(key: string): Promise<T | null>;
41
+ set<T>(key: string, value: T, ttlMs?: number): Promise<void>;
42
+ delete(key: string): Promise<void>;
43
+ has(key: string): Promise<boolean>;
44
+ }
45
+ /**
46
+ * DynamoDB cache provider implementation.
47
+ * Requires @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb packages.
48
+ */
49
+ export declare class DynamoDBCacheProvider implements CacheProvider {
50
+ private client;
51
+ private tableName;
52
+ private keyAttribute;
53
+ private valueAttribute;
54
+ private ttlAttribute;
55
+ constructor(client: DynamoDBDocumentClient, options: {
56
+ tableName: string;
57
+ keyAttribute?: string;
58
+ valueAttribute?: string;
59
+ ttlAttribute?: string;
60
+ });
61
+ get<T>(key: string): Promise<T | null>;
62
+ set<T>(key: string, value: T, ttlMs?: number): Promise<void>;
63
+ delete(key: string): Promise<void>;
64
+ has(key: string): Promise<boolean>;
65
+ }
66
+ /**
67
+ * Interface for Vercel KV client (matches @vercel/kv API).
68
+ */
69
+ interface VercelKVClient {
70
+ get<T>(key: string): Promise<T | null>;
71
+ set<T>(key: string, value: T, options?: {
72
+ ex?: number;
73
+ }): Promise<void>;
74
+ del(key: string): Promise<number>;
75
+ exists(key: string): Promise<number>;
76
+ }
77
+ /**
78
+ * Interface for DynamoDB Document Client (matches @aws-sdk/lib-dynamodb API).
79
+ */
80
+ interface DynamoDBDocumentClient {
81
+ get(params: {
82
+ TableName: string;
83
+ Key: Record<string, unknown>;
84
+ }): Promise<{
85
+ Item?: Record<string, unknown>;
86
+ }>;
87
+ put(params: {
88
+ TableName: string;
89
+ Item: Record<string, unknown>;
90
+ }): Promise<void>;
91
+ delete(params: {
92
+ TableName: string;
93
+ Key: Record<string, unknown>;
94
+ }): Promise<void>;
95
+ }
96
+ /**
97
+ * Generate a cache key for alert feed queries.
98
+ *
99
+ * @param pluginId - Plugin identifier
100
+ * @param location - Location coordinates
101
+ * @param timeRange - Time range for the query
102
+ * @returns A unique cache key string
103
+ */
104
+ export declare function generateCacheKey(pluginId: string, location: {
105
+ latitude: number;
106
+ longitude: number;
107
+ }, timeRange: {
108
+ start: string;
109
+ end: string;
110
+ }): string;
111
+ export {};
112
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/utils/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAU9C;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,iBAAiB,CAAC,CAAiC;gBAE/C,iBAAiB,SAAS;IAKhC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAgBtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,OAAO,IAAI,IAAI;IAQf;;OAEG;IACH,OAAO,CAAC,OAAO;CAQhB;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,EAAE,CAAiB;IAC3B,OAAO,CAAC,MAAM,CAAS;gBAEX,EAAE,EAAE,cAAc,EAAE,MAAM,SAAgB;IAKtD,OAAO,CAAC,MAAM;IAIR,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAKtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE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CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,UAAU,sBAAsB;IAC9B,GAAG,CAAC,MAAM,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC9B,GAAG,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAChD,GAAG,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjF,MAAM,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACjD,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACxC,MAAM,CAYR"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Simple CSV parser for handling Phoenix Open Data CSV responses.
3
+ *
4
+ * This is a lightweight parser that handles:
5
+ * - Quoted fields with commas
6
+ * - Escaped quotes within fields
7
+ * - Header row parsing
8
+ * - Type coercion for common patterns
9
+ */
10
+ /**
11
+ * Parse a CSV string into an array of objects.
12
+ *
13
+ * @param csvText - The raw CSV text
14
+ * @param options - Parser options
15
+ * @returns Array of parsed objects with headers as keys
16
+ */
17
+ export declare function parseCSV<T extends Record<string, unknown> = Record<string, string>>(csvText: string, options?: CSVParseOptions): T[];
18
+ /**
19
+ * Options for CSV parsing.
20
+ */
21
+ export interface CSVParseOptions {
22
+ /** Field delimiter (default: ',') */
23
+ delimiter?: string;
24
+ /** First line is header row (default: true) */
25
+ hasHeader?: boolean;
26
+ /** Trim whitespace from fields (default: true) */
27
+ trimFields?: boolean;
28
+ /** Attempt to coerce types (numbers, booleans) (default: true) */
29
+ coerceTypes?: boolean;
30
+ }
31
+ /**
32
+ * Convert an array of objects to CSV string.
33
+ */
34
+ export declare function toCSV<T extends Record<string, unknown>>(data: T[], options?: {
35
+ headers?: string[];
36
+ delimiter?: string;
37
+ }): string;
38
+ //# sourceMappingURL=csv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../src/utils/csv.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjF,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB,GAC5B,CAAC,EAAE,CAuCL;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAgHD;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrD,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,MAAM,CAsBR"}
@@ -0,0 +1,47 @@
1
+ import type { TimeRange, TimeRangePreset, TimeRangeInput } from '../types';
2
+ /**
3
+ * Duration constants in milliseconds.
4
+ */
5
+ export declare const HOUR_MS: number;
6
+ export declare const DAY_MS: number;
7
+ /**
8
+ * Check if a string is a valid TimeRangePreset.
9
+ */
10
+ export declare function isTimeRangePreset(value: string): value is TimeRangePreset;
11
+ /**
12
+ * Check if an object is a TimeRange.
13
+ */
14
+ export declare function isTimeRange(value: unknown): value is TimeRange;
15
+ /**
16
+ * Resolve a TimeRangeInput to an explicit TimeRange.
17
+ *
18
+ * @param input - Either a preset string or explicit time range
19
+ * @param now - Optional reference time (defaults to current time)
20
+ * @returns Resolved TimeRange with start and end as ISO strings
21
+ */
22
+ export declare function resolveTimeRange(input?: TimeRangeInput, now?: Date): TimeRange;
23
+ /**
24
+ * Resolve a TimeRangePreset to an explicit TimeRange.
25
+ */
26
+ export declare function resolveTimeRangePreset(preset: TimeRangePreset, now: Date): TimeRange;
27
+ /**
28
+ * Check if a date falls within a time range.
29
+ *
30
+ * @param date - The date to check (string or Date)
31
+ * @param range - The time range to check against
32
+ * @returns true if the date falls within the range (inclusive)
33
+ */
34
+ export declare function isDateInRange(date: string | Date, range: TimeRange): boolean;
35
+ /**
36
+ * Check if two time ranges overlap.
37
+ */
38
+ export declare function doRangesOverlap(range1: TimeRange, range2: TimeRange): boolean;
39
+ /**
40
+ * Format a duration in milliseconds to a human-readable string.
41
+ */
42
+ export declare function formatDuration(ms: number): string;
43
+ /**
44
+ * Parse an ISO date string to a Date object, returning null if invalid.
45
+ */
46
+ export declare function parseISODate(dateString: string): Date | null;
47
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,OAAO,QAAiB,CAAC;AACtC,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAUzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAS9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAe9E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,GAAG,SAAS,CAwCpF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAM5E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAO7E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAG5D"}