@fleettools/events 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 (48) hide show
  1. package/dist/helpers.d.ts +72 -0
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +4816 -0
  4. package/dist/projections/index.d.ts +16 -0
  5. package/dist/projections/pilots.d.ts +19 -0
  6. package/dist/replay.d.ts +19 -0
  7. package/dist/src/helpers.d.ts +73 -0
  8. package/dist/src/helpers.d.ts.map +1 -0
  9. package/dist/src/index.d.ts +11 -0
  10. package/dist/src/index.d.ts.map +1 -0
  11. package/dist/src/projections/index.d.ts +17 -0
  12. package/dist/src/projections/index.d.ts.map +1 -0
  13. package/dist/src/projections/pilots.d.ts +20 -0
  14. package/dist/src/projections/pilots.d.ts.map +1 -0
  15. package/dist/src/replay.d.ts +20 -0
  16. package/dist/src/replay.d.ts.map +1 -0
  17. package/dist/src/store.d.ts +61 -0
  18. package/dist/src/store.d.ts.map +1 -0
  19. package/dist/src/types/base.d.ts +33 -0
  20. package/dist/src/types/base.d.ts.map +1 -0
  21. package/dist/src/types/checkpoints.d.ts +255 -0
  22. package/dist/src/types/checkpoints.d.ts.map +1 -0
  23. package/dist/src/types/coordination.d.ts +364 -0
  24. package/dist/src/types/coordination.d.ts.map +1 -0
  25. package/dist/src/types/index.d.ts +1692 -0
  26. package/dist/src/types/index.d.ts.map +1 -0
  27. package/dist/src/types/messages.d.ts +295 -0
  28. package/dist/src/types/messages.d.ts.map +1 -0
  29. package/dist/src/types/missions.d.ts +258 -0
  30. package/dist/src/types/missions.d.ts.map +1 -0
  31. package/dist/src/types/pilots.d.ts +153 -0
  32. package/dist/src/types/pilots.d.ts.map +1 -0
  33. package/dist/src/types/reservations.d.ts +173 -0
  34. package/dist/src/types/reservations.d.ts.map +1 -0
  35. package/dist/src/types/sorties.d.ts +372 -0
  36. package/dist/src/types/sorties.d.ts.map +1 -0
  37. package/dist/store.d.ts +56 -0
  38. package/dist/tsconfig.tsbuildinfo +1 -0
  39. package/dist/types/base.d.ts +32 -0
  40. package/dist/types/checkpoints.d.ts +254 -0
  41. package/dist/types/coordination.d.ts +363 -0
  42. package/dist/types/index.d.ts +1691 -0
  43. package/dist/types/messages.d.ts +294 -0
  44. package/dist/types/missions.d.ts +257 -0
  45. package/dist/types/pilots.d.ts +152 -0
  46. package/dist/types/reservations.d.ts +172 -0
  47. package/dist/types/sorties.d.ts +371 -0
  48. package/package.json +37 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * FleetTools Event Helpers
3
+ *
4
+ * Utility functions for event creation, validation, and type guards.
5
+ */
6
+ import { FleetEventSchema, type FleetEvent } from './types/index.js';
7
+ export { FleetEventSchema };
8
+ /**
9
+ * Create a typed event with validation
10
+ */
11
+ export declare function createEvent<T extends FleetEvent>(type: T['type'], data: T['data'], options?: {
12
+ id?: string;
13
+ project_key?: string;
14
+ timestamp?: string;
15
+ sequence?: number;
16
+ }): T;
17
+ /**
18
+ * Validate an event using the FleetEvent schema
19
+ */
20
+ export declare function validateEvent(event: unknown): FleetEvent;
21
+ /**
22
+ * Safe event validation that returns a result
23
+ */
24
+ export declare function safeValidateEvent(event: unknown): {
25
+ success: boolean;
26
+ data?: FleetEvent;
27
+ error?: string;
28
+ };
29
+ /**
30
+ * Type guard for specific event types
31
+ */
32
+ export declare function isEventType<T extends FleetEvent>(event: FleetEvent, type: T['type']): event is T;
33
+ /**
34
+ * Type guard for pilot events
35
+ */
36
+ export declare function isPilotEvent(event: FleetEvent): boolean;
37
+ /**
38
+ * Type guard for message events
39
+ */
40
+ export declare function isMessageEvent(event: FleetEvent): boolean;
41
+ /**
42
+ * Type guard for reservation events
43
+ */
44
+ export declare function isReservationEvent(event: FleetEvent): boolean;
45
+ /**
46
+ * Type guard for sortie events
47
+ */
48
+ export declare function isSortieEvent(event: FleetEvent): boolean;
49
+ /**
50
+ * Type guard for mission events
51
+ */
52
+ export declare function isMissionEvent(event: FleetEvent): boolean;
53
+ /**
54
+ * Type guard for checkpoint events
55
+ */
56
+ export declare function isCheckpointEvent(event: FleetEvent): boolean;
57
+ /**
58
+ * Type guard for coordination events
59
+ */
60
+ export declare function isCoordinationEvent(event: FleetEvent): boolean;
61
+ /**
62
+ * Extract event data with proper typing
63
+ */
64
+ export declare function getEventData<T extends FleetEvent>(event: T): T['data'];
65
+ /**
66
+ * Get event type information
67
+ */
68
+ export declare function getEventInfo(event: FleetEvent): {
69
+ category: 'pilot' | 'message' | 'reservation' | 'sortie' | 'mission' | 'checkpoint' | 'coordination';
70
+ isAggregateEvent: boolean;
71
+ isSystemEvent: boolean;
72
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FleetTools Events Package
3
+ *
4
+ * Event types, validation, and storage for FleetTools event sourcing.
5
+ */
6
+ export * from './types/index.js';
7
+ export * from './helpers.js';
8
+ export * from './store.js';
9
+ export * from './projections/index.js';
10
+ export * from './replay.js';