Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
83 lines (75 loc) · 1.78 KB
/
Copy pathtypes.ts
File metadata and controls
83 lines (75 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
export type JsonPrimitive = string | number | boolean | null;
export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
export type JsonObject = { [key: string]: JsonValue };
export interface EventEnvelope<TPayload extends JsonValue = JsonValue> {
id: string;
type: string;
payload: TPayload;
}
export interface IdempotentEventResult<TResult> {
result: TResult;
replayed: boolean;
payloadHash: string;
}
export interface ContractEvent {
contractId: string;
eventId: string;
sequence: number;
timestamp: number;
payload: Record<string, any>;
signature?: string;
}
export interface EventIngestionResult {
deduplicationKey: string;
status: 'accepted' | 'rejected' | 'duplicate';
reason?: string;
processedAt: Date;
statusCode?: number;
code?: string;
}
export interface EventProcessingAudit {
id: string;
deduplicationKey: string;
contractId: string;
eventId: string;
sequence: number;
status: 'accepted' | 'rejected' | 'duplicate';
reason?: string;
payloadHash: string;
processedAt: Date;
createdAt: Date;
/** Optional correlation ID for distributed tracing across service boundaries. */
correlationId?: string;
}
/**
* Incoming event for idempotency processing.
*/
export interface IncomingEvent {
providerId: string;
eventType: string;
eventId: string;
timestamp: number;
payload: JsonValue;
}
/**
* Stored idempotency entry.
*/
export interface IdempotencyEntry {
idempotencyKey: string;
providerId: string;
eventType: string;
eventId: string;
responseBody: string;
createdAt: number;
expiresAt: number;
}
/**
* Idempotency configuration.
*/
export interface IdempotencyConfig {
ttlMs: number;
gracePeriodMs: number;
maxRetries: number;
retryDelayMs: number;
timestampWindowMs: number;
}