@fleettools/squawk 0.1.0 → 0.1.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/package.json +1 -1
- package/AGENTS.md +0 -28
- package/dist/src/db/checkpoint-storage.d.ts +0 -19
- package/dist/src/db/checkpoint-storage.d.ts.map +0 -1
- package/dist/src/db/checkpoint-storage.js +0 -355
- package/dist/src/db/checkpoint-storage.js.map +0 -1
- package/dist/src/db/index.d.ts +0 -30
- package/dist/src/db/index.d.ts.map +0 -1
- package/dist/src/db/index.js +0 -329
- package/dist/src/db/index.js.map +0 -1
- package/dist/src/db/sqlite.d.ts +0 -31
- package/dist/src/db/sqlite.d.ts.map +0 -1
- package/dist/src/db/sqlite.js +0 -558
- package/dist/src/db/sqlite.js.map +0 -1
- package/dist/src/db/types.d.ts +0 -611
- package/dist/src/db/types.d.ts.map +0 -1
- package/dist/src/db/types.js +0 -4
- package/dist/src/db/types.js.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -285
- package/dist/src/index.js.map +0 -1
- package/dist/src/recovery/checkpointing.d.ts +0 -244
- package/dist/src/recovery/checkpointing.d.ts.map +0 -1
- package/dist/src/recovery/checkpointing.js +0 -511
- package/dist/src/recovery/checkpointing.js.map +0 -1
- package/dist/src/recovery/detection.d.ts +0 -137
- package/dist/src/recovery/detection.d.ts.map +0 -1
- package/dist/src/recovery/detection.js +0 -240
- package/dist/src/recovery/detection.js.map +0 -1
- package/dist/src/recovery/detector.d.ts +0 -34
- package/dist/src/recovery/detector.d.ts.map +0 -1
- package/dist/src/recovery/detector.js +0 -42
- package/dist/src/recovery/detector.js.map +0 -1
- package/dist/src/recovery/index.d.ts +0 -3
- package/dist/src/recovery/index.d.ts.map +0 -1
- package/dist/src/recovery/index.js +0 -3
- package/dist/src/recovery/index.js.map +0 -1
- package/dist/src/recovery/restorer.d.ts +0 -51
- package/dist/src/recovery/restorer.d.ts.map +0 -1
- package/dist/src/recovery/restorer.js +0 -266
- package/dist/src/recovery/restorer.js.map +0 -1
- package/dist/src/schemas.d.ts +0 -142
- package/dist/src/schemas.d.ts.map +0 -1
- package/dist/src/schemas.js +0 -110
- package/dist/src/schemas.js.map +0 -1
- package/src/db/checkpoint-storage.ts +0 -443
- package/src/db/index.d.ts +0 -30
- package/src/db/index.d.ts.map +0 -1
- package/src/db/index.js.map +0 -1
- package/src/db/index.ts +0 -417
- package/src/db/schema.sql +0 -112
- package/src/db/sqlite.d.ts +0 -31
- package/src/db/sqlite.d.ts.map +0 -1
- package/src/db/sqlite.js +0 -667
- package/src/db/sqlite.js.map +0 -1
- package/src/db/sqlite.ts +0 -677
- package/src/db/types.d.ts +0 -612
- package/src/db/types.d.ts.map +0 -1
- package/src/db/types.js +0 -4
- package/src/db/types.js.map +0 -1
- package/src/db/types.ts +0 -771
- package/src/index.ts +0 -332
- package/src/recovery/detector.ts +0 -82
- package/src/recovery/index.ts +0 -3
- package/src/recovery/restorer.ts +0 -377
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
export class StateRestorer {
|
|
2
|
-
db;
|
|
3
|
-
constructor(db) {
|
|
4
|
-
this.db = db;
|
|
5
|
-
}
|
|
6
|
-
async restoreFromCheckpoint(checkpointId, options = {}) {
|
|
7
|
-
const { dryRun = false, forceLocks = false } = options;
|
|
8
|
-
try {
|
|
9
|
-
const checkpoint = await this.db.checkpoints.getById(checkpointId);
|
|
10
|
-
if (!checkpoint) {
|
|
11
|
-
return {
|
|
12
|
-
success: false,
|
|
13
|
-
checkpoint_id: checkpointId,
|
|
14
|
-
mission_id: '',
|
|
15
|
-
recovery_context: {},
|
|
16
|
-
restored: { sorties: 0, locks: 0, messages: 0 },
|
|
17
|
-
errors: [`Checkpoint not found: ${checkpointId}`],
|
|
18
|
-
warnings: []
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return await this.restore(checkpoint, { dryRun, forceLocks });
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
return {
|
|
25
|
-
success: false,
|
|
26
|
-
checkpoint_id: checkpointId,
|
|
27
|
-
mission_id: '',
|
|
28
|
-
recovery_context: {},
|
|
29
|
-
restored: { sorties: 0, locks: 0, messages: 0 },
|
|
30
|
-
errors: [`Restore failed: ${error instanceof Error ? error.message : String(error)}`],
|
|
31
|
-
warnings: []
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async restoreLatest(missionId, options = {}) {
|
|
36
|
-
const { dryRun = false, forceLocks = false } = options;
|
|
37
|
-
try {
|
|
38
|
-
const checkpoint = await this.db.checkpoints.getLatestByMission(missionId);
|
|
39
|
-
if (!checkpoint) {
|
|
40
|
-
return {
|
|
41
|
-
success: false,
|
|
42
|
-
checkpoint_id: '',
|
|
43
|
-
mission_id: missionId,
|
|
44
|
-
recovery_context: {},
|
|
45
|
-
restored: { sorties: 0, locks: 0, messages: 0 },
|
|
46
|
-
errors: [`No checkpoints found for mission: ${missionId}`],
|
|
47
|
-
warnings: []
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return await this.restore(checkpoint, { dryRun, forceLocks });
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
return {
|
|
54
|
-
success: false,
|
|
55
|
-
checkpoint_id: '',
|
|
56
|
-
mission_id: missionId,
|
|
57
|
-
recovery_context: {},
|
|
58
|
-
restored: { sorties: 0, locks: 0, messages: 0 },
|
|
59
|
-
errors: [`Restore failed: ${error instanceof Error ? error.message : String(error)}`],
|
|
60
|
-
warnings: []
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async restore(checkpoint, options) {
|
|
65
|
-
const { dryRun = false, forceLocks = false } = options;
|
|
66
|
-
const now = new Date().toISOString();
|
|
67
|
-
const result = {
|
|
68
|
-
success: true,
|
|
69
|
-
checkpoint_id: checkpoint.id,
|
|
70
|
-
mission_id: checkpoint.mission_id,
|
|
71
|
-
recovery_context: {
|
|
72
|
-
last_action: 'Restored from checkpoint',
|
|
73
|
-
next_steps: this.extractNextSteps(checkpoint),
|
|
74
|
-
blockers: [],
|
|
75
|
-
files_modified: this.extractModifiedFiles(checkpoint),
|
|
76
|
-
mission_summary: `${checkpoint.mission_id} checkpoint restoration`,
|
|
77
|
-
elapsed_time_ms: Date.now() - new Date(checkpoint.timestamp).getTime(),
|
|
78
|
-
last_activity_at: checkpoint.timestamp
|
|
79
|
-
},
|
|
80
|
-
restored: { sorties: 0, locks: 0, messages: 0 },
|
|
81
|
-
errors: [],
|
|
82
|
-
warnings: []
|
|
83
|
-
};
|
|
84
|
-
try {
|
|
85
|
-
if (!dryRun) {
|
|
86
|
-
await this.db.beginTransaction();
|
|
87
|
-
}
|
|
88
|
-
// 1. Restore sortie states
|
|
89
|
-
for (const sortie of checkpoint.sorties || []) {
|
|
90
|
-
try {
|
|
91
|
-
if (!dryRun) {
|
|
92
|
-
await this.db.sorties.update(sortie.id, {
|
|
93
|
-
status: sortie.status,
|
|
94
|
-
assigned_to: sortie.assigned_to,
|
|
95
|
-
files: sortie.files,
|
|
96
|
-
progress: sortie.progress,
|
|
97
|
-
progress_notes: sortie.progress_notes
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
result.restored.sorties++;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
result.errors.push(`Failed to restore sortie ${sortie.id}: ${error}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
for (const lock of checkpoint.active_locks || []) {
|
|
107
|
-
try {
|
|
108
|
-
const lockAge = Date.now() - new Date(lock.acquired_at).getTime();
|
|
109
|
-
const isExpired = lockAge > (lock.timeout_ms || 30000);
|
|
110
|
-
if (isExpired) {
|
|
111
|
-
result.warnings.push(`Lock ${lock.id} expired, skipping re-acquisition`);
|
|
112
|
-
result.recovery_context.blockers.push(`Expired lock on ${lock.file} (held by ${lock.held_by})`);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (!dryRun) {
|
|
116
|
-
const lockResult = await this.db.locks.acquire({
|
|
117
|
-
file: lock.file,
|
|
118
|
-
specialist_id: lock.held_by,
|
|
119
|
-
timeout_ms: lock.timeout_ms,
|
|
120
|
-
purpose: lock.purpose
|
|
121
|
-
});
|
|
122
|
-
if (lockResult.conflict) {
|
|
123
|
-
if (forceLocks) {
|
|
124
|
-
await this.db.locks.forceRelease(lockResult.existing_lock?.id || '');
|
|
125
|
-
await this.db.locks.acquire({
|
|
126
|
-
file: lock.file,
|
|
127
|
-
specialist_id: lock.held_by,
|
|
128
|
-
timeout_ms: lock.timeout_ms,
|
|
129
|
-
purpose: lock.purpose
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
result.warnings.push(`Lock conflict on ${lock.file}, skipping re-acquisition`);
|
|
134
|
-
result.recovery_context.blockers.push(`Lock conflict on ${lock.file} (held by ${lock.held_by})`);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
result.restored.locks++;
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
result.errors.push(`Failed to restore lock ${lock.id}: ${error}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// 3. Requeue pending messages
|
|
146
|
-
for (const message of checkpoint.pending_messages || []) {
|
|
147
|
-
try {
|
|
148
|
-
if (!message.delivered) {
|
|
149
|
-
if (!dryRun) {
|
|
150
|
-
await this.db.messages.requeue(message.id);
|
|
151
|
-
}
|
|
152
|
-
result.restored.messages++;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
result.errors.push(`Failed to requeue message ${message.id}: ${error}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
// 4. Mark checkpoint as consumed (only if not dry run and successful)
|
|
160
|
-
if (!dryRun && result.errors.length === 0) {
|
|
161
|
-
await this.db.checkpoints.markConsumed(checkpoint.id);
|
|
162
|
-
}
|
|
163
|
-
// 5. Emit fleet_recovered event
|
|
164
|
-
if (!dryRun && result.errors.length === 0) {
|
|
165
|
-
await this.db.events.append({
|
|
166
|
-
event_type: 'fleet_recovered',
|
|
167
|
-
stream_type: 'mission',
|
|
168
|
-
stream_id: checkpoint.mission_id,
|
|
169
|
-
data: {
|
|
170
|
-
checkpoint_id: checkpoint.id,
|
|
171
|
-
restored_at: now,
|
|
172
|
-
sorties_restored: result.restored.sorties,
|
|
173
|
-
locks_restored: result.restored.locks,
|
|
174
|
-
messages_requeued: result.restored.messages,
|
|
175
|
-
warnings: result.warnings.length
|
|
176
|
-
},
|
|
177
|
-
occurred_at: now
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
if (!dryRun) {
|
|
181
|
-
await this.db.commitTransaction();
|
|
182
|
-
}
|
|
183
|
-
return result;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
if (!dryRun) {
|
|
187
|
-
try {
|
|
188
|
-
await this.db.rollbackTransaction();
|
|
189
|
-
}
|
|
190
|
-
catch (rollbackError) {
|
|
191
|
-
result.errors.push(`Failed to rollback transaction: ${rollbackError}`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
result.success = false;
|
|
195
|
-
result.errors.push(`Transaction failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
196
|
-
return result;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
extractNextSteps(checkpoint) {
|
|
200
|
-
const steps = [];
|
|
201
|
-
const inProgressSorties = checkpoint.sorties?.filter((s) => s.status === 'in_progress') || [];
|
|
202
|
-
const blockedSorties = checkpoint.sorties?.filter((s) => s.progress_notes && s.progress_notes.toLowerCase().includes('blocked')) || [];
|
|
203
|
-
if (inProgressSorties && inProgressSorties.length > 0) {
|
|
204
|
-
steps.push('Continue work on in-progress sorties');
|
|
205
|
-
}
|
|
206
|
-
if (blockedSorties && blockedSorties.length > 0) {
|
|
207
|
-
steps.push('Resolve blockers for stuck sorties');
|
|
208
|
-
}
|
|
209
|
-
if (checkpoint.active_locks && checkpoint.active_locks.length > 0) {
|
|
210
|
-
steps.push('Verify file lock integrity');
|
|
211
|
-
}
|
|
212
|
-
if (checkpoint.pending_messages && checkpoint.pending_messages.length > 0) {
|
|
213
|
-
steps.push('Process pending messages');
|
|
214
|
-
}
|
|
215
|
-
if (steps.length === 0) {
|
|
216
|
-
steps.push('Review mission status and continue');
|
|
217
|
-
}
|
|
218
|
-
return steps;
|
|
219
|
-
}
|
|
220
|
-
extractModifiedFiles(checkpoint) {
|
|
221
|
-
const files = new Set();
|
|
222
|
-
checkpoint.sorties?.forEach((sortie) => {
|
|
223
|
-
sortie.files?.forEach((file) => files.add(file));
|
|
224
|
-
});
|
|
225
|
-
checkpoint.active_locks?.forEach((lock) => {
|
|
226
|
-
files.add(lock.file);
|
|
227
|
-
});
|
|
228
|
-
return Array.from(files);
|
|
229
|
-
}
|
|
230
|
-
formatRecoveryPrompt(result) {
|
|
231
|
-
const { recovery_context, restored, errors, warnings } = result;
|
|
232
|
-
const sections = [
|
|
233
|
-
'# Mission Recovery Context',
|
|
234
|
-
'',
|
|
235
|
-
'## Mission Summary',
|
|
236
|
-
recovery_context.mission_summary,
|
|
237
|
-
'',
|
|
238
|
-
'## Last Action',
|
|
239
|
-
recovery_context.last_action,
|
|
240
|
-
'',
|
|
241
|
-
'## Time Context',
|
|
242
|
-
`- Last activity: ${recovery_context.last_activity_at}`,
|
|
243
|
-
`- Elapsed time: ${Math.round(recovery_context.elapsed_time_ms / 60000)} minutes`,
|
|
244
|
-
'',
|
|
245
|
-
'## Next Steps',
|
|
246
|
-
...recovery_context.next_steps.map((step) => `- ${step}`),
|
|
247
|
-
''
|
|
248
|
-
];
|
|
249
|
-
if (recovery_context.files_modified.length > 0) {
|
|
250
|
-
sections.push('## Files Modified', ...recovery_context.files_modified.map((file) => `- ${file}`), '');
|
|
251
|
-
}
|
|
252
|
-
if (recovery_context.blockers.length > 0) {
|
|
253
|
-
sections.push('## Blockers', ...recovery_context.blockers.map((blocker) => `- ${blocker}`), '');
|
|
254
|
-
}
|
|
255
|
-
sections.push('## Restoration Summary', `- Sorties restored: ${restored.sorties}`, `- Locks restored: ${restored.locks}`, `- Messages requeued: ${restored.messages}`, '');
|
|
256
|
-
if (warnings.length > 0) {
|
|
257
|
-
sections.push('## Warnings', ...warnings.map(warning => `- ${warning}`), '');
|
|
258
|
-
}
|
|
259
|
-
if (errors.length > 0) {
|
|
260
|
-
sections.push('## Errors', ...errors.map(error => `- ${error}`), '');
|
|
261
|
-
}
|
|
262
|
-
sections.push('---', '*This context was automatically generated from checkpoint restoration.*');
|
|
263
|
-
return sections.join('\n');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
//# sourceMappingURL=restorer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restorer.js","sourceRoot":"","sources":["../../../src/recovery/restorer.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,aAAa;IAEd;IADV,YACU,EAsBP;QAtBO,OAAE,GAAF,EAAE,CAsBT;IACA,CAAC;IAEJ,KAAK,CAAC,qBAAqB,CAAC,YAAoB,EAAE,UAA0B,EAAE;QAC5E,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;QAEvD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACnE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,aAAa,EAAE,YAAY;oBAC3B,UAAU,EAAE,EAAE;oBACd,gBAAgB,EAAE,EAAqB;oBACvC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;oBAC/C,MAAM,EAAE,CAAC,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BAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAY,EAAE,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,EAClE,EAAE,CACH,CAAC;QACJ,CAAC;QAEF,QAAQ,CAAC,IAAI,CACX,wBAAwB,EACxB,uBAAuB,QAAQ,CAAC,OAAO,EAAE,EACzC,qBAAqB,QAAQ,CAAC,KAAK,EAAE,EACrC,wBAAwB,QAAQ,CAAC,QAAQ,EAAE,EAC3C,EAAE,CACH,CAAC;QAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,QAAQ,CAAC,IAAI,CACX,aAAa,EACb,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,EAC1C,EAAE,CACH,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,QAAQ,CAAC,IAAI,CACX,WAAW,EACX,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,EACpC,EAAE,CACH,CAAC;QACJ,CAAC;QAED,QAAQ,CAAC,IAAI,CACX,KAAK,EACL,yEAAyE,CAC1E,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/src/schemas.d.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FleetTools API Validation Schemas
|
|
3
|
-
*
|
|
4
|
-
* Provides Zod schemas for all API endpoints to ensure type safety
|
|
5
|
-
* and prevent injection attacks through proper validation.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
export declare const StreamIdSchema: z.ZodString;
|
|
9
|
-
export declare const EventIdSchema: z.ZodString;
|
|
10
|
-
export declare const LockIdSchema: z.ZodString;
|
|
11
|
-
export declare const CursorIdSchema: z.ZodString;
|
|
12
|
-
export declare const SpecialistIdSchema: z.ZodString;
|
|
13
|
-
export declare const TimestampSchema: z.ZodOptional<z.ZodString>;
|
|
14
|
-
export declare const JsonDataSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
15
|
-
export declare const MetadataSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
-
export declare const EventSchema: z.ZodObject<{
|
|
17
|
-
id: z.ZodString;
|
|
18
|
-
type: z.ZodString;
|
|
19
|
-
stream_id: z.ZodString;
|
|
20
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
21
|
-
causation_id: z.ZodOptional<z.ZodString>;
|
|
22
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
export declare const EventArraySchema: z.ZodArray<z.ZodObject<{
|
|
25
|
-
id: z.ZodString;
|
|
26
|
-
type: z.ZodString;
|
|
27
|
-
stream_id: z.ZodString;
|
|
28
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
29
|
-
causation_id: z.ZodOptional<z.ZodString>;
|
|
30
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
export declare const AppendEventsRequestSchema: z.ZodObject<{
|
|
33
|
-
stream_id: z.ZodString;
|
|
34
|
-
events: z.ZodArray<z.ZodObject<{
|
|
35
|
-
id: z.ZodString;
|
|
36
|
-
type: z.ZodString;
|
|
37
|
-
stream_id: z.ZodString;
|
|
38
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
|
-
causation_id: z.ZodOptional<z.ZodString>;
|
|
40
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41
|
-
}, z.core.$strip>>;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
export declare const MailboxResponseSchema: z.ZodObject<{
|
|
44
|
-
id: z.ZodString;
|
|
45
|
-
created_at: z.ZodString;
|
|
46
|
-
updated_at: z.ZodString;
|
|
47
|
-
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
-
id: z.ZodString;
|
|
49
|
-
type: z.ZodString;
|
|
50
|
-
stream_id: z.ZodString;
|
|
51
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
52
|
-
causation_id: z.ZodOptional<z.ZodString>;
|
|
53
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
54
|
-
}, z.core.$strip>>>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export declare const CursorAdvanceRequestSchema: z.ZodObject<{
|
|
57
|
-
stream_id: z.ZodString;
|
|
58
|
-
position: z.ZodNumber;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
export declare const CursorSchema: z.ZodObject<{
|
|
61
|
-
id: z.ZodString;
|
|
62
|
-
stream_id: z.ZodString;
|
|
63
|
-
position: z.ZodNumber;
|
|
64
|
-
consumer_id: z.ZodOptional<z.ZodString>;
|
|
65
|
-
created_at: z.ZodString;
|
|
66
|
-
updated_at: z.ZodString;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
export declare const FilePathSchema: z.ZodString;
|
|
69
|
-
export declare const LockPurposeSchema: z.ZodOptional<z.ZodEnum<{
|
|
70
|
-
edit: "edit";
|
|
71
|
-
read: "read";
|
|
72
|
-
delete: "delete";
|
|
73
|
-
}>>;
|
|
74
|
-
export declare const AcquireLockRequestSchema: z.ZodObject<{
|
|
75
|
-
file: z.ZodString;
|
|
76
|
-
specialist_id: z.ZodString;
|
|
77
|
-
timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
78
|
-
purpose: z.ZodOptional<z.ZodEnum<{
|
|
79
|
-
edit: "edit";
|
|
80
|
-
read: "read";
|
|
81
|
-
delete: "delete";
|
|
82
|
-
}>>;
|
|
83
|
-
checksum: z.ZodOptional<z.ZodString>;
|
|
84
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
85
|
-
}, z.core.$strip>;
|
|
86
|
-
export declare const ReleaseLockRequestSchema: z.ZodObject<{
|
|
87
|
-
lock_id: z.ZodString;
|
|
88
|
-
specialist_id: z.ZodOptional<z.ZodString>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
export declare const LockSchema: z.ZodObject<{
|
|
91
|
-
id: z.ZodString;
|
|
92
|
-
file: z.ZodString;
|
|
93
|
-
reserved_by: z.ZodString;
|
|
94
|
-
reserved_at: z.ZodString;
|
|
95
|
-
released_at: z.ZodNullable<z.ZodString>;
|
|
96
|
-
purpose: z.ZodString;
|
|
97
|
-
checksum: z.ZodNullable<z.ZodString>;
|
|
98
|
-
timeout_ms: z.ZodNumber;
|
|
99
|
-
metadata: z.ZodNullable<z.ZodString>;
|
|
100
|
-
}, z.core.$strip>;
|
|
101
|
-
export declare const CoordinatorStatusSchema: z.ZodObject<{
|
|
102
|
-
active_mailboxes: z.ZodNumber;
|
|
103
|
-
active_locks: z.ZodNumber;
|
|
104
|
-
timestamp: z.ZodString;
|
|
105
|
-
}, z.core.$strip>;
|
|
106
|
-
export declare const ErrorResponseSchema: z.ZodObject<{
|
|
107
|
-
error: z.ZodString;
|
|
108
|
-
}, z.core.$strip>;
|
|
109
|
-
export declare const HealthResponseSchema: z.ZodObject<{
|
|
110
|
-
status: z.ZodLiteral<"healthy">;
|
|
111
|
-
service: z.ZodLiteral<"squawk">;
|
|
112
|
-
timestamp: z.ZodString;
|
|
113
|
-
}, z.core.$strip>;
|
|
114
|
-
export declare const MailboxAppendResponseSchema: z.ZodObject<{
|
|
115
|
-
mailbox: z.ZodObject<{
|
|
116
|
-
id: z.ZodString;
|
|
117
|
-
created_at: z.ZodString;
|
|
118
|
-
updated_at: z.ZodString;
|
|
119
|
-
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
120
|
-
id: z.ZodString;
|
|
121
|
-
type: z.ZodString;
|
|
122
|
-
stream_id: z.ZodString;
|
|
123
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
124
|
-
causation_id: z.ZodOptional<z.ZodString>;
|
|
125
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
-
}, z.core.$strip>>>;
|
|
127
|
-
}, z.core.$strip>;
|
|
128
|
-
inserted: z.ZodNumber;
|
|
129
|
-
}, z.core.$strip>;
|
|
130
|
-
export type AppendEventsRequest = z.infer<typeof AppendEventsRequestSchema>;
|
|
131
|
-
export type Event = z.infer<typeof EventSchema>;
|
|
132
|
-
export type MailboxResponse = z.infer<typeof MailboxResponseSchema>;
|
|
133
|
-
export type CursorAdvanceRequest = z.infer<typeof CursorAdvanceRequestSchema>;
|
|
134
|
-
export type Cursor = z.infer<typeof CursorSchema>;
|
|
135
|
-
export type AcquireLockRequest = z.infer<typeof AcquireLockRequestSchema>;
|
|
136
|
-
export type ReleaseLockRequest = z.infer<typeof ReleaseLockRequestSchema>;
|
|
137
|
-
export type Lock = z.infer<typeof LockSchema>;
|
|
138
|
-
export type CoordinatorStatus = z.infer<typeof CoordinatorStatusSchema>;
|
|
139
|
-
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
140
|
-
export type HealthResponse = z.infer<typeof HealthResponseSchema>;
|
|
141
|
-
export type MailboxAppendResponse = z.infer<typeof MailboxAppendResponseSchema>;
|
|
142
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc,aAAmG,CAAC;AAC/H,eAAO,MAAM,aAAa,aAAiG,CAAC;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AK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/src/schemas.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FleetTools API Validation Schemas
|
|
3
|
-
*
|
|
4
|
-
* Provides Zod schemas for all API endpoints to ensure type safety
|
|
5
|
-
* and prevent injection attacks through proper validation.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
// ============================================================================
|
|
9
|
-
// COMMON SCHEMAS
|
|
10
|
-
// ============================================================================
|
|
11
|
-
export const StreamIdSchema = z.string().min(1, { message: "Stream ID required" }).max(255, { message: "Stream ID too long" });
|
|
12
|
-
export const EventIdSchema = z.string().min(1, { message: "Event ID required" }).max(255, { message: "Event ID too long" });
|
|
13
|
-
export const LockIdSchema = z.string().min(1, { message: "Lock ID required" }).max(255, { message: "Lock ID too long" });
|
|
14
|
-
export const CursorIdSchema = z.string().min(1, { message: "Cursor ID required" }).max(255, { message: "Cursor ID too long" });
|
|
15
|
-
export const SpecialistIdSchema = z.string().min(1, { message: "Specialist ID required" }).max(255, { message: "Specialist ID too long" });
|
|
16
|
-
export const TimestampSchema = z.string().datetime().optional();
|
|
17
|
-
export const JsonDataSchema = z.record(z.string(), z.unknown()).optional();
|
|
18
|
-
export const MetadataSchema = z.record(z.string(), z.unknown()).optional();
|
|
19
|
-
// ============================================================================
|
|
20
|
-
// EVENT SCHEMAS
|
|
21
|
-
// ============================================================================
|
|
22
|
-
export const EventSchema = z.object({
|
|
23
|
-
id: z.string().min(1),
|
|
24
|
-
type: z.string().min(1),
|
|
25
|
-
stream_id: z.string().min(1),
|
|
26
|
-
data: z.record(z.string(), z.unknown()),
|
|
27
|
-
causation_id: z.string().optional(),
|
|
28
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
-
});
|
|
30
|
-
export const EventArraySchema = z.array(EventSchema);
|
|
31
|
-
export const AppendEventsRequestSchema = z.object({
|
|
32
|
-
stream_id: StreamIdSchema,
|
|
33
|
-
events: EventArraySchema.min(1),
|
|
34
|
-
});
|
|
35
|
-
// ============================================================================
|
|
36
|
-
// MAILBOX SCHEMAS
|
|
37
|
-
// ============================================================================
|
|
38
|
-
export const MailboxResponseSchema = z.object({
|
|
39
|
-
id: z.string(),
|
|
40
|
-
created_at: z.string(),
|
|
41
|
-
updated_at: z.string(),
|
|
42
|
-
events: z.array(EventSchema).optional(),
|
|
43
|
-
});
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// CURSOR SCHEMAS
|
|
46
|
-
// ============================================================================
|
|
47
|
-
export const CursorAdvanceRequestSchema = z.object({
|
|
48
|
-
stream_id: StreamIdSchema,
|
|
49
|
-
position: z.number().int().min(0),
|
|
50
|
-
});
|
|
51
|
-
export const CursorSchema = z.object({
|
|
52
|
-
id: z.string(),
|
|
53
|
-
stream_id: z.string(),
|
|
54
|
-
position: z.number().int().min(0),
|
|
55
|
-
consumer_id: z.string().optional(),
|
|
56
|
-
created_at: z.string(),
|
|
57
|
-
updated_at: z.string(),
|
|
58
|
-
});
|
|
59
|
-
// ============================================================================
|
|
60
|
-
// LOCK SCHEMAS
|
|
61
|
-
// ============================================================================
|
|
62
|
-
export const FilePathSchema = z.string().min(1).max(1024);
|
|
63
|
-
export const LockPurposeSchema = z.enum(['edit', 'read', 'delete']).optional();
|
|
64
|
-
export const AcquireLockRequestSchema = z.object({
|
|
65
|
-
file: FilePathSchema,
|
|
66
|
-
specialist_id: SpecialistIdSchema,
|
|
67
|
-
timeout_ms: z.number().int().min(1000).max(3600000).optional().default(30000),
|
|
68
|
-
purpose: LockPurposeSchema,
|
|
69
|
-
checksum: z.string().optional(),
|
|
70
|
-
metadata: JsonDataSchema,
|
|
71
|
-
});
|
|
72
|
-
export const ReleaseLockRequestSchema = z.object({
|
|
73
|
-
lock_id: LockIdSchema,
|
|
74
|
-
specialist_id: SpecialistIdSchema.optional(),
|
|
75
|
-
});
|
|
76
|
-
export const LockSchema = z.object({
|
|
77
|
-
id: z.string(),
|
|
78
|
-
file: z.string(),
|
|
79
|
-
reserved_by: z.string(),
|
|
80
|
-
reserved_at: z.string(),
|
|
81
|
-
released_at: z.string().nullable(),
|
|
82
|
-
purpose: z.string(),
|
|
83
|
-
checksum: z.string().nullable(),
|
|
84
|
-
timeout_ms: z.number(),
|
|
85
|
-
metadata: z.string().nullable(),
|
|
86
|
-
});
|
|
87
|
-
// ============================================================================
|
|
88
|
-
// COORDINATOR SCHEMAS
|
|
89
|
-
// ============================================================================
|
|
90
|
-
export const CoordinatorStatusSchema = z.object({
|
|
91
|
-
active_mailboxes: z.number(),
|
|
92
|
-
active_locks: z.number(),
|
|
93
|
-
timestamp: z.string(),
|
|
94
|
-
});
|
|
95
|
-
// ============================================================================
|
|
96
|
-
// RESPONSE SCHEMAS
|
|
97
|
-
// ============================================================================
|
|
98
|
-
export const ErrorResponseSchema = z.object({
|
|
99
|
-
error: z.string(),
|
|
100
|
-
});
|
|
101
|
-
export const HealthResponseSchema = z.object({
|
|
102
|
-
status: z.literal('healthy'),
|
|
103
|
-
service: z.literal('squawk'),
|
|
104
|
-
timestamp: z.string(),
|
|
105
|
-
});
|
|
106
|
-
export const MailboxAppendResponseSchema = z.object({
|
|
107
|
-
mailbox: MailboxResponseSchema,
|
|
108
|
-
inserted: z.number(),
|
|
109
|
-
});
|
|
110
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/src/schemas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAC/H,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAC5H,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;AACzH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,oBAAoB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