@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,172 @@
1
+ /**
2
+ * FleetTools Reservation Event Schemas
3
+ *
4
+ * Zod schemas for file reservation events.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * File reserved event
9
+ */
10
+ export declare const FileReservedSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ project_key: z.ZodString;
13
+ timestamp: z.ZodString;
14
+ sequence: z.ZodNumber;
15
+ } & {
16
+ type: z.ZodLiteral<"file_reserved">;
17
+ data: z.ZodObject<{
18
+ callsign: z.ZodString;
19
+ path_pattern: z.ZodString;
20
+ exclusive: z.ZodDefault<z.ZodBoolean>;
21
+ reason: z.ZodOptional<z.ZodString>;
22
+ ttl_seconds: z.ZodOptional<z.ZodNumber>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ callsign?: string;
25
+ reason?: string;
26
+ path_pattern?: string;
27
+ exclusive?: boolean;
28
+ ttl_seconds?: number;
29
+ }, {
30
+ callsign?: string;
31
+ reason?: string;
32
+ path_pattern?: string;
33
+ exclusive?: boolean;
34
+ ttl_seconds?: number;
35
+ }>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ type?: "file_reserved";
38
+ id?: string;
39
+ project_key?: string;
40
+ timestamp?: string;
41
+ sequence?: number;
42
+ data?: {
43
+ callsign?: string;
44
+ reason?: string;
45
+ path_pattern?: string;
46
+ exclusive?: boolean;
47
+ ttl_seconds?: number;
48
+ };
49
+ }, {
50
+ type?: "file_reserved";
51
+ id?: string;
52
+ project_key?: string;
53
+ timestamp?: string;
54
+ sequence?: number;
55
+ data?: {
56
+ callsign?: string;
57
+ reason?: string;
58
+ path_pattern?: string;
59
+ exclusive?: boolean;
60
+ ttl_seconds?: number;
61
+ };
62
+ }>;
63
+ /**
64
+ * File released event
65
+ */
66
+ export declare const FileReleasedSchema: z.ZodObject<{
67
+ id: z.ZodString;
68
+ project_key: z.ZodString;
69
+ timestamp: z.ZodString;
70
+ sequence: z.ZodNumber;
71
+ } & {
72
+ type: z.ZodLiteral<"file_released">;
73
+ data: z.ZodObject<{
74
+ callsign: z.ZodString;
75
+ path_pattern: z.ZodString;
76
+ reason: z.ZodOptional<z.ZodString>;
77
+ released_by: z.ZodOptional<z.ZodString>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ callsign?: string;
80
+ reason?: string;
81
+ path_pattern?: string;
82
+ released_by?: string;
83
+ }, {
84
+ callsign?: string;
85
+ reason?: string;
86
+ path_pattern?: string;
87
+ released_by?: string;
88
+ }>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type?: "file_released";
91
+ id?: string;
92
+ project_key?: string;
93
+ timestamp?: string;
94
+ sequence?: number;
95
+ data?: {
96
+ callsign?: string;
97
+ reason?: string;
98
+ path_pattern?: string;
99
+ released_by?: string;
100
+ };
101
+ }, {
102
+ type?: "file_released";
103
+ id?: string;
104
+ project_key?: string;
105
+ timestamp?: string;
106
+ sequence?: number;
107
+ data?: {
108
+ callsign?: string;
109
+ reason?: string;
110
+ path_pattern?: string;
111
+ released_by?: string;
112
+ };
113
+ }>;
114
+ /**
115
+ * File conflict event
116
+ */
117
+ export declare const FileConflictSchema: z.ZodObject<{
118
+ id: z.ZodString;
119
+ project_key: z.ZodString;
120
+ timestamp: z.ZodString;
121
+ sequence: z.ZodNumber;
122
+ } & {
123
+ type: z.ZodLiteral<"file_conflict">;
124
+ data: z.ZodObject<{
125
+ callsign: z.ZodString;
126
+ path_pattern: z.ZodString;
127
+ conflicting_callsign: z.ZodString;
128
+ conflict_type: z.ZodEnum<["exclusive_violation", "pattern_overlap", "timeout"]>;
129
+ resolved: z.ZodDefault<z.ZodBoolean>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ callsign?: string;
132
+ path_pattern?: string;
133
+ conflicting_callsign?: string;
134
+ conflict_type?: "timeout" | "exclusive_violation" | "pattern_overlap";
135
+ resolved?: boolean;
136
+ }, {
137
+ callsign?: string;
138
+ path_pattern?: string;
139
+ conflicting_callsign?: string;
140
+ conflict_type?: "timeout" | "exclusive_violation" | "pattern_overlap";
141
+ resolved?: boolean;
142
+ }>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type?: "file_conflict";
145
+ id?: string;
146
+ project_key?: string;
147
+ timestamp?: string;
148
+ sequence?: number;
149
+ data?: {
150
+ callsign?: string;
151
+ path_pattern?: string;
152
+ conflicting_callsign?: string;
153
+ conflict_type?: "timeout" | "exclusive_violation" | "pattern_overlap";
154
+ resolved?: boolean;
155
+ };
156
+ }, {
157
+ type?: "file_conflict";
158
+ id?: string;
159
+ project_key?: string;
160
+ timestamp?: string;
161
+ sequence?: number;
162
+ data?: {
163
+ callsign?: string;
164
+ path_pattern?: string;
165
+ conflicting_callsign?: string;
166
+ conflict_type?: "timeout" | "exclusive_violation" | "pattern_overlap";
167
+ resolved?: boolean;
168
+ };
169
+ }>;
170
+ export type FileReservedEvent = z.infer<typeof FileReservedSchema>;
171
+ export type FileReleasedEvent = z.infer<typeof FileReleasedSchema>;
172
+ export type FileConflictEvent = z.infer<typeof FileConflictSchema>;
@@ -0,0 +1,371 @@
1
+ /**
2
+ * FleetTools Sortie Event Schemas
3
+ *
4
+ * Zod schemas for sortie-related events.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Sortie created event
9
+ */
10
+ export declare const SortieCreatedSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ project_key: z.ZodString;
13
+ timestamp: z.ZodString;
14
+ sequence: z.ZodNumber;
15
+ } & {
16
+ type: z.ZodLiteral<"sortie_created">;
17
+ data: z.ZodObject<{
18
+ sortie_id: z.ZodString;
19
+ mission_id: z.ZodOptional<z.ZodString>;
20
+ title: z.ZodString;
21
+ description: z.ZodOptional<z.ZodString>;
22
+ priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
23
+ assigned_to: z.ZodOptional<z.ZodString>;
24
+ files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
25
+ estimated_hours: z.ZodOptional<z.ZodNumber>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ description?: string;
28
+ sortie_id?: string;
29
+ mission_id?: string;
30
+ title?: string;
31
+ priority?: "low" | "high" | "critical" | "medium";
32
+ assigned_to?: string;
33
+ files?: string[];
34
+ estimated_hours?: number;
35
+ }, {
36
+ description?: string;
37
+ sortie_id?: string;
38
+ mission_id?: string;
39
+ title?: string;
40
+ priority?: "low" | "high" | "critical" | "medium";
41
+ assigned_to?: string;
42
+ files?: string[];
43
+ estimated_hours?: number;
44
+ }>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ type?: "sortie_created";
47
+ id?: string;
48
+ project_key?: string;
49
+ timestamp?: string;
50
+ sequence?: number;
51
+ data?: {
52
+ description?: string;
53
+ sortie_id?: string;
54
+ mission_id?: string;
55
+ title?: string;
56
+ priority?: "low" | "high" | "critical" | "medium";
57
+ assigned_to?: string;
58
+ files?: string[];
59
+ estimated_hours?: number;
60
+ };
61
+ }, {
62
+ type?: "sortie_created";
63
+ id?: string;
64
+ project_key?: string;
65
+ timestamp?: string;
66
+ sequence?: number;
67
+ data?: {
68
+ description?: string;
69
+ sortie_id?: string;
70
+ mission_id?: string;
71
+ title?: string;
72
+ priority?: "low" | "high" | "critical" | "medium";
73
+ assigned_to?: string;
74
+ files?: string[];
75
+ estimated_hours?: number;
76
+ };
77
+ }>;
78
+ /**
79
+ * Sortie started event
80
+ */
81
+ export declare const SortieStartedSchema: z.ZodObject<{
82
+ id: z.ZodString;
83
+ project_key: z.ZodString;
84
+ timestamp: z.ZodString;
85
+ sequence: z.ZodNumber;
86
+ } & {
87
+ type: z.ZodLiteral<"sortie_started">;
88
+ data: z.ZodObject<{
89
+ sortie_id: z.ZodString;
90
+ started_by: z.ZodString;
91
+ started_at: z.ZodString;
92
+ }, "strip", z.ZodTypeAny, {
93
+ sortie_id?: string;
94
+ started_by?: string;
95
+ started_at?: string;
96
+ }, {
97
+ sortie_id?: string;
98
+ started_by?: string;
99
+ started_at?: string;
100
+ }>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ type?: "sortie_started";
103
+ id?: string;
104
+ project_key?: string;
105
+ timestamp?: string;
106
+ sequence?: number;
107
+ data?: {
108
+ sortie_id?: string;
109
+ started_by?: string;
110
+ started_at?: string;
111
+ };
112
+ }, {
113
+ type?: "sortie_started";
114
+ id?: string;
115
+ project_key?: string;
116
+ timestamp?: string;
117
+ sequence?: number;
118
+ data?: {
119
+ sortie_id?: string;
120
+ started_by?: string;
121
+ started_at?: string;
122
+ };
123
+ }>;
124
+ /**
125
+ * Sortie completed event
126
+ */
127
+ export declare const SortieCompletedSchema: z.ZodObject<{
128
+ id: z.ZodString;
129
+ project_key: z.ZodString;
130
+ timestamp: z.ZodString;
131
+ sequence: z.ZodNumber;
132
+ } & {
133
+ type: z.ZodLiteral<"sortie_completed">;
134
+ data: z.ZodObject<{
135
+ sortie_id: z.ZodString;
136
+ completed_by: z.ZodString;
137
+ completed_at: z.ZodString;
138
+ result: z.ZodEnum<["success", "partial", "failed"]>;
139
+ notes: z.ZodOptional<z.ZodString>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ notes?: string;
142
+ sortie_id?: string;
143
+ completed_by?: string;
144
+ completed_at?: string;
145
+ result?: "partial" | "success" | "failed";
146
+ }, {
147
+ notes?: string;
148
+ sortie_id?: string;
149
+ completed_by?: string;
150
+ completed_at?: string;
151
+ result?: "partial" | "success" | "failed";
152
+ }>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ type?: "sortie_completed";
155
+ id?: string;
156
+ project_key?: string;
157
+ timestamp?: string;
158
+ sequence?: number;
159
+ data?: {
160
+ notes?: string;
161
+ sortie_id?: string;
162
+ completed_by?: string;
163
+ completed_at?: string;
164
+ result?: "partial" | "success" | "failed";
165
+ };
166
+ }, {
167
+ type?: "sortie_completed";
168
+ id?: string;
169
+ project_key?: string;
170
+ timestamp?: string;
171
+ sequence?: number;
172
+ data?: {
173
+ notes?: string;
174
+ sortie_id?: string;
175
+ completed_by?: string;
176
+ completed_at?: string;
177
+ result?: "partial" | "success" | "failed";
178
+ };
179
+ }>;
180
+ /**
181
+ * Sortie blocked event
182
+ */
183
+ export declare const SortieBlockedSchema: z.ZodObject<{
184
+ id: z.ZodString;
185
+ project_key: z.ZodString;
186
+ timestamp: z.ZodString;
187
+ sequence: z.ZodNumber;
188
+ } & {
189
+ type: z.ZodLiteral<"sortie_blocked">;
190
+ data: z.ZodObject<{
191
+ sortie_id: z.ZodString;
192
+ blocked_by: z.ZodString;
193
+ blocked_reason: z.ZodString;
194
+ blocked_at: z.ZodString;
195
+ blocked_by_callsign: z.ZodOptional<z.ZodString>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ sortie_id?: string;
198
+ blocked_by?: string;
199
+ blocked_reason?: string;
200
+ blocked_at?: string;
201
+ blocked_by_callsign?: string;
202
+ }, {
203
+ sortie_id?: string;
204
+ blocked_by?: string;
205
+ blocked_reason?: string;
206
+ blocked_at?: string;
207
+ blocked_by_callsign?: string;
208
+ }>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ type?: "sortie_blocked";
211
+ id?: string;
212
+ project_key?: string;
213
+ timestamp?: string;
214
+ sequence?: number;
215
+ data?: {
216
+ sortie_id?: string;
217
+ blocked_by?: string;
218
+ blocked_reason?: string;
219
+ blocked_at?: string;
220
+ blocked_by_callsign?: string;
221
+ };
222
+ }, {
223
+ type?: "sortie_blocked";
224
+ id?: string;
225
+ project_key?: string;
226
+ timestamp?: string;
227
+ sequence?: number;
228
+ data?: {
229
+ sortie_id?: string;
230
+ blocked_by?: string;
231
+ blocked_reason?: string;
232
+ blocked_at?: string;
233
+ blocked_by_callsign?: string;
234
+ };
235
+ }>;
236
+ /**
237
+ * Sortie resumed event
238
+ */
239
+ export declare const SortieResumedSchema: z.ZodObject<{
240
+ id: z.ZodString;
241
+ project_key: z.ZodString;
242
+ timestamp: z.ZodString;
243
+ sequence: z.ZodNumber;
244
+ } & {
245
+ type: z.ZodLiteral<"sortie_resumed">;
246
+ data: z.ZodObject<{
247
+ sortie_id: z.ZodString;
248
+ resumed_by: z.ZodString;
249
+ resumed_at: z.ZodString;
250
+ previous_state: z.ZodString;
251
+ }, "strip", z.ZodTypeAny, {
252
+ sortie_id?: string;
253
+ resumed_by?: string;
254
+ resumed_at?: string;
255
+ previous_state?: string;
256
+ }, {
257
+ sortie_id?: string;
258
+ resumed_by?: string;
259
+ resumed_at?: string;
260
+ previous_state?: string;
261
+ }>;
262
+ }, "strip", z.ZodTypeAny, {
263
+ type?: "sortie_resumed";
264
+ id?: string;
265
+ project_key?: string;
266
+ timestamp?: string;
267
+ sequence?: number;
268
+ data?: {
269
+ sortie_id?: string;
270
+ resumed_by?: string;
271
+ resumed_at?: string;
272
+ previous_state?: string;
273
+ };
274
+ }, {
275
+ type?: "sortie_resumed";
276
+ id?: string;
277
+ project_key?: string;
278
+ timestamp?: string;
279
+ sequence?: number;
280
+ data?: {
281
+ sortie_id?: string;
282
+ resumed_by?: string;
283
+ resumed_at?: string;
284
+ previous_state?: string;
285
+ };
286
+ }>;
287
+ /**
288
+ * Sortie updated event
289
+ */
290
+ export declare const SortieUpdatedSchema: z.ZodObject<{
291
+ id: z.ZodString;
292
+ project_key: z.ZodString;
293
+ timestamp: z.ZodString;
294
+ sequence: z.ZodNumber;
295
+ } & {
296
+ type: z.ZodLiteral<"sortie_updated">;
297
+ data: z.ZodObject<{
298
+ sortie_id: z.ZodString;
299
+ updated_by: z.ZodString;
300
+ updated_at: z.ZodString;
301
+ changes: z.ZodArray<z.ZodObject<{
302
+ field: z.ZodString;
303
+ old_value: z.ZodUnknown;
304
+ new_value: z.ZodUnknown;
305
+ }, "strip", z.ZodTypeAny, {
306
+ field?: string;
307
+ old_value?: unknown;
308
+ new_value?: unknown;
309
+ }, {
310
+ field?: string;
311
+ old_value?: unknown;
312
+ new_value?: unknown;
313
+ }>, "many">;
314
+ }, "strip", z.ZodTypeAny, {
315
+ updated_by?: string;
316
+ changes?: {
317
+ field?: string;
318
+ old_value?: unknown;
319
+ new_value?: unknown;
320
+ }[];
321
+ sortie_id?: string;
322
+ updated_at?: string;
323
+ }, {
324
+ updated_by?: string;
325
+ changes?: {
326
+ field?: string;
327
+ old_value?: unknown;
328
+ new_value?: unknown;
329
+ }[];
330
+ sortie_id?: string;
331
+ updated_at?: string;
332
+ }>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ type?: "sortie_updated";
335
+ id?: string;
336
+ project_key?: string;
337
+ timestamp?: string;
338
+ sequence?: number;
339
+ data?: {
340
+ updated_by?: string;
341
+ changes?: {
342
+ field?: string;
343
+ old_value?: unknown;
344
+ new_value?: unknown;
345
+ }[];
346
+ sortie_id?: string;
347
+ updated_at?: string;
348
+ };
349
+ }, {
350
+ type?: "sortie_updated";
351
+ id?: string;
352
+ project_key?: string;
353
+ timestamp?: string;
354
+ sequence?: number;
355
+ data?: {
356
+ updated_by?: string;
357
+ changes?: {
358
+ field?: string;
359
+ old_value?: unknown;
360
+ new_value?: unknown;
361
+ }[];
362
+ sortie_id?: string;
363
+ updated_at?: string;
364
+ };
365
+ }>;
366
+ export type SortieCreatedEvent = z.infer<typeof SortieCreatedSchema>;
367
+ export type SortieStartedEvent = z.infer<typeof SortieStartedSchema>;
368
+ export type SortieCompletedEvent = z.infer<typeof SortieCompletedSchema>;
369
+ export type SortieBlockedEvent = z.infer<typeof SortieBlockedSchema>;
370
+ export type SortieResumedEvent = z.infer<typeof SortieResumedSchema>;
371
+ export type SortieUpdatedEvent = z.infer<typeof SortieUpdatedSchema>;
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@fleettools/events",
3
+ "version": "0.1.0",
4
+ "description": "Event types and validation for FleetTools",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "build": "bun build src/index.ts --outdir dist --target bun --format esm && bun run build:types",
15
+ "build:types": "tsc --emitDeclarationOnly",
16
+ "dev": "bun --watch src/index.ts",
17
+ "test": "bun test",
18
+ "test:watch": "bun test --watch",
19
+ "test:coverage": "bun test --coverage"
20
+ },
21
+ "dependencies": {
22
+ "zod": "^3.22.0",
23
+ "@fleettools/core": "^0.1.0",
24
+ "@fleettools/db": "^0.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.9.3",
28
+ "@types/bun": "^1.3.5"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ }
37
+ }