@griffin-app/griffin-plan-executor 0.1.13 → 0.1.15
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/README.md +14 -14
- package/dist/events/adapters/in-memory.test.js +25 -23
- package/dist/events/adapters/in-memory.test.js.map +1 -1
- package/dist/events/adapters/kinesis.d.ts.map +1 -1
- package/dist/events/adapters/kinesis.js.map +1 -1
- package/dist/events/adapters/kinesis.test.js +22 -20
- package/dist/events/adapters/kinesis.test.js.map +1 -1
- package/dist/events/emitter.test.js +15 -15
- package/dist/events/emitter.test.js.map +1 -1
- package/dist/events/types.d.ts +12 -12
- package/dist/events/types.d.ts.map +1 -1
- package/dist/events/types.js +1 -1
- package/dist/executor.d.ts +2 -2
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +33 -43
- package/dist/executor.js.map +1 -1
- package/dist/executor.test.js +102 -102
- package/dist/executor.test.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/secrets/index.d.ts +4 -4
- package/dist/secrets/index.d.ts.map +1 -1
- package/dist/secrets/index.js +4 -4
- package/dist/secrets/index.js.map +1 -1
- package/dist/secrets/providers/aws.d.ts.map +1 -1
- package/dist/secrets/providers/aws.js +4 -5
- package/dist/secrets/providers/aws.js.map +1 -1
- package/dist/secrets/providers/env.js +1 -1
- package/dist/secrets/providers/env.js.map +1 -1
- package/dist/secrets/providers/vault.js +7 -7
- package/dist/secrets/providers/vault.js.map +1 -1
- package/dist/secrets/registry.d.ts +11 -33
- package/dist/secrets/registry.d.ts.map +1 -1
- package/dist/secrets/registry.js +65 -113
- package/dist/secrets/registry.js.map +1 -1
- package/dist/secrets/resolver.d.ts +12 -12
- package/dist/secrets/resolver.d.ts.map +1 -1
- package/dist/secrets/resolver.js +21 -21
- package/dist/secrets/resolver.js.map +1 -1
- package/dist/secrets/secrets.test.js +96 -120
- package/dist/secrets/secrets.test.js.map +1 -1
- package/dist/secrets/types.d.ts +2 -5
- package/dist/secrets/types.d.ts.map +1 -1
- package/dist/secrets/types.js +1 -4
- package/dist/secrets/types.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +4 -4
- package/src/events/adapters/README.md +7 -7
- package/src/events/adapters/in-memory.test.ts +27 -23
- package/src/events/adapters/kinesis.test.ts +23 -21
- package/src/events/adapters/kinesis.ts +6 -3
- package/src/events/emitter.test.ts +15 -15
- package/src/events/types.ts +13 -13
- package/src/executor.test.ts +103 -103
- package/src/executor.ts +40 -48
- package/src/index.ts +7 -7
- package/src/secrets/index.ts +5 -5
- package/src/secrets/providers/aws.ts +4 -5
- package/src/secrets/providers/env.ts +1 -1
- package/src/secrets/providers/vault.ts +7 -7
- package/src/secrets/registry.ts +75 -142
- package/src/secrets/resolver.ts +28 -26
- package/src/secrets/secrets.test.ts +124 -155
- package/src/secrets/types.ts +4 -13
- package/src/{test-plan-types.ts → test-monitor-types.ts} +1 -1
- package/src/types.ts +2 -2
|
@@ -19,11 +19,11 @@ describe("InMemoryAdapter", () => {
|
|
|
19
19
|
eventId: `event-${seq}`,
|
|
20
20
|
seq,
|
|
21
21
|
timestamp: Date.now(),
|
|
22
|
-
|
|
22
|
+
monitorId: "monitor-1",
|
|
23
23
|
executionId,
|
|
24
24
|
organizationId: "org-1",
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
monitorName: "Test Monitor",
|
|
26
|
+
monitorVersion: "1.0.0",
|
|
27
27
|
nodeCount: 1,
|
|
28
28
|
edgeCount: 1,
|
|
29
29
|
}) as ExecutionEvent;
|
|
@@ -31,28 +31,28 @@ describe("InMemoryAdapter", () => {
|
|
|
31
31
|
describe("publish", () => {
|
|
32
32
|
it("should store events", async () => {
|
|
33
33
|
const events = [
|
|
34
|
-
createMockEvent("
|
|
35
|
-
createMockEvent("
|
|
34
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
35
|
+
createMockEvent("MONITOR_END", "exec-1", 1),
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
await adapter.publish(events);
|
|
39
39
|
|
|
40
40
|
const stored = adapter.getEvents();
|
|
41
41
|
expect(stored).toHaveLength(2);
|
|
42
|
-
expect(stored[0].type).toBe("
|
|
43
|
-
expect(stored[1].type).toBe("
|
|
42
|
+
expect(stored[0].type).toBe("MONITOR_START");
|
|
43
|
+
expect(stored[1].type).toBe("MONITOR_END");
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it("should track publish count", async () => {
|
|
47
|
-
await adapter.publish([createMockEvent("
|
|
48
|
-
await adapter.publish([createMockEvent("
|
|
47
|
+
await adapter.publish([createMockEvent("MONITOR_START", "exec-1", 0)]);
|
|
48
|
+
await adapter.publish([createMockEvent("MONITOR_END", "exec-1", 1)]);
|
|
49
49
|
|
|
50
50
|
expect(adapter.getPublishCount()).toBe(2);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
it("should append events across multiple publishes", async () => {
|
|
54
|
-
await adapter.publish([createMockEvent("
|
|
55
|
-
await adapter.publish([createMockEvent("
|
|
54
|
+
await adapter.publish([createMockEvent("MONITOR_START", "exec-1", 0)]);
|
|
55
|
+
await adapter.publish([createMockEvent("MONITOR_END", "exec-1", 1)]);
|
|
56
56
|
|
|
57
57
|
const events = adapter.getEvents();
|
|
58
58
|
expect(events).toHaveLength(2);
|
|
@@ -62,25 +62,27 @@ describe("InMemoryAdapter", () => {
|
|
|
62
62
|
describe("getEventsByType", () => {
|
|
63
63
|
it("should filter events by type", async () => {
|
|
64
64
|
const events = [
|
|
65
|
-
createMockEvent("
|
|
66
|
-
createMockEvent("
|
|
67
|
-
createMockEvent("
|
|
65
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
66
|
+
createMockEvent("MONITOR_END", "exec-1", 1),
|
|
67
|
+
createMockEvent("MONITOR_START", "exec-2", 2),
|
|
68
68
|
];
|
|
69
69
|
|
|
70
70
|
await adapter.publish(events);
|
|
71
71
|
|
|
72
|
-
const planStartEvents = adapter.getEventsByType("
|
|
72
|
+
const planStartEvents = adapter.getEventsByType("MONITOR_START");
|
|
73
73
|
expect(planStartEvents).toHaveLength(2);
|
|
74
|
-
expect(planStartEvents.every((e) => e.type === "
|
|
74
|
+
expect(planStartEvents.every((e) => e.type === "MONITOR_START")).toBe(
|
|
75
|
+
true,
|
|
76
|
+
);
|
|
75
77
|
});
|
|
76
78
|
});
|
|
77
79
|
|
|
78
80
|
describe("getEventsForExecution", () => {
|
|
79
81
|
it("should filter events by executionId", async () => {
|
|
80
82
|
const events = [
|
|
81
|
-
createMockEvent("
|
|
82
|
-
createMockEvent("
|
|
83
|
-
createMockEvent("
|
|
83
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
84
|
+
createMockEvent("MONITOR_END", "exec-1", 1),
|
|
85
|
+
createMockEvent("MONITOR_START", "exec-2", 2),
|
|
84
86
|
];
|
|
85
87
|
|
|
86
88
|
await adapter.publish(events);
|
|
@@ -93,7 +95,7 @@ describe("InMemoryAdapter", () => {
|
|
|
93
95
|
|
|
94
96
|
describe("clear", () => {
|
|
95
97
|
it("should clear all events and reset counters", async () => {
|
|
96
|
-
await adapter.publish([createMockEvent("
|
|
98
|
+
await adapter.publish([createMockEvent("MONITOR_START", "exec-1", 0)]);
|
|
97
99
|
|
|
98
100
|
adapter.clear();
|
|
99
101
|
|
|
@@ -108,7 +110,7 @@ describe("InMemoryAdapter", () => {
|
|
|
108
110
|
const start = Date.now();
|
|
109
111
|
|
|
110
112
|
await adapterWithLatency.publish([
|
|
111
|
-
createMockEvent("
|
|
113
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
112
114
|
]);
|
|
113
115
|
|
|
114
116
|
const duration = Date.now() - start;
|
|
@@ -124,7 +126,7 @@ describe("InMemoryAdapter", () => {
|
|
|
124
126
|
|
|
125
127
|
await expect(
|
|
126
128
|
adapterWithFailures.publish([
|
|
127
|
-
createMockEvent("
|
|
129
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
128
130
|
]),
|
|
129
131
|
).rejects.toThrow("Simulated publish failure");
|
|
130
132
|
});
|
|
@@ -135,7 +137,9 @@ describe("InMemoryAdapter", () => {
|
|
|
135
137
|
});
|
|
136
138
|
|
|
137
139
|
await expect(
|
|
138
|
-
adapterNoFailures.publish([
|
|
140
|
+
adapterNoFailures.publish([
|
|
141
|
+
createMockEvent("MONITOR_START", "exec-1", 0),
|
|
142
|
+
]),
|
|
139
143
|
).resolves.not.toThrow();
|
|
140
144
|
});
|
|
141
145
|
});
|
|
@@ -15,11 +15,11 @@ describe("KinesisAdapter", () => {
|
|
|
15
15
|
eventId: `event-${seq}`,
|
|
16
16
|
seq,
|
|
17
17
|
timestamp: Date.now(),
|
|
18
|
-
|
|
18
|
+
monitorId: "monitor-1",
|
|
19
19
|
executionId,
|
|
20
20
|
organizationId,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
monitorName: "Test Monitor",
|
|
22
|
+
monitorVersion: "1.0.0",
|
|
23
23
|
nodeCount: 1,
|
|
24
24
|
edgeCount: 1,
|
|
25
25
|
}) as ExecutionEvent;
|
|
@@ -40,7 +40,7 @@ describe("KinesisAdapter", () => {
|
|
|
40
40
|
streamName: "test-stream",
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const events = [createMockEvent("
|
|
43
|
+
const events = [createMockEvent("MONITOR_START", "exec-1", "org-1", 0)];
|
|
44
44
|
|
|
45
45
|
await adapter.publish(events);
|
|
46
46
|
|
|
@@ -83,7 +83,7 @@ describe("KinesisAdapter", () => {
|
|
|
83
83
|
|
|
84
84
|
// Create 1250 events (should result in 3 batches: 500, 500, 250)
|
|
85
85
|
const events = Array.from({ length: 1250 }, (_, i) =>
|
|
86
|
-
createMockEvent("
|
|
86
|
+
createMockEvent("MONITOR_START", "exec-1", "org-1", i),
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
await adapter.publish(events);
|
|
@@ -111,7 +111,9 @@ describe("KinesisAdapter", () => {
|
|
|
111
111
|
streamName: "test-stream",
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
const events = [
|
|
114
|
+
const events = [
|
|
115
|
+
createMockEvent("MONITOR_START", "exec-123", "org-456", 0),
|
|
116
|
+
];
|
|
115
117
|
|
|
116
118
|
await adapter.publish(events);
|
|
117
119
|
|
|
@@ -135,7 +137,9 @@ describe("KinesisAdapter", () => {
|
|
|
135
137
|
partitionKeyStrategy: "organizationId",
|
|
136
138
|
});
|
|
137
139
|
|
|
138
|
-
const events = [
|
|
140
|
+
const events = [
|
|
141
|
+
createMockEvent("MONITOR_START", "exec-123", "org-456", 0),
|
|
142
|
+
];
|
|
139
143
|
|
|
140
144
|
await adapter.publish(events);
|
|
141
145
|
|
|
@@ -159,7 +163,9 @@ describe("KinesisAdapter", () => {
|
|
|
159
163
|
partitionKeyStrategy: "composite",
|
|
160
164
|
});
|
|
161
165
|
|
|
162
|
-
const events = [
|
|
166
|
+
const events = [
|
|
167
|
+
createMockEvent("MONITOR_START", "exec-123", "org-456", 0),
|
|
168
|
+
];
|
|
163
169
|
|
|
164
170
|
await adapter.publish(events);
|
|
165
171
|
|
|
@@ -177,9 +183,7 @@ describe("KinesisAdapter", () => {
|
|
|
177
183
|
// First call: one record fails
|
|
178
184
|
return Promise.resolve({
|
|
179
185
|
FailedRecordCount: 1,
|
|
180
|
-
Records: [
|
|
181
|
-
{ ErrorCode: "ProvisionedThroughputExceededException" },
|
|
182
|
-
],
|
|
186
|
+
Records: [{ ErrorCode: "ProvisionedThroughputExceededException" }],
|
|
183
187
|
});
|
|
184
188
|
}
|
|
185
189
|
// Second call: success
|
|
@@ -200,7 +204,7 @@ describe("KinesisAdapter", () => {
|
|
|
200
204
|
retryDelayMs: 10, // Short delay for testing
|
|
201
205
|
});
|
|
202
206
|
|
|
203
|
-
const events = [createMockEvent("
|
|
207
|
+
const events = [createMockEvent("MONITOR_START", "exec-1", "org-1", 0)];
|
|
204
208
|
|
|
205
209
|
await adapter.publish(events);
|
|
206
210
|
|
|
@@ -210,9 +214,7 @@ describe("KinesisAdapter", () => {
|
|
|
210
214
|
it("should stop retrying after max attempts", async () => {
|
|
211
215
|
const mockSend = vi.fn().mockResolvedValue({
|
|
212
216
|
FailedRecordCount: 1,
|
|
213
|
-
Records: [
|
|
214
|
-
{ ErrorCode: "ProvisionedThroughputExceededException" },
|
|
215
|
-
],
|
|
217
|
+
Records: [{ ErrorCode: "ProvisionedThroughputExceededException" }],
|
|
216
218
|
});
|
|
217
219
|
|
|
218
220
|
const mockClient = {
|
|
@@ -226,7 +228,7 @@ describe("KinesisAdapter", () => {
|
|
|
226
228
|
retryDelayMs: 10,
|
|
227
229
|
});
|
|
228
230
|
|
|
229
|
-
const events = [createMockEvent("
|
|
231
|
+
const events = [createMockEvent("MONITOR_START", "exec-1", "org-1", 0)];
|
|
230
232
|
|
|
231
233
|
// Should not throw, but log errors
|
|
232
234
|
await adapter.publish(events);
|
|
@@ -258,7 +260,7 @@ describe("KinesisAdapter", () => {
|
|
|
258
260
|
retryDelayMs: 10,
|
|
259
261
|
});
|
|
260
262
|
|
|
261
|
-
const events = [createMockEvent("
|
|
263
|
+
const events = [createMockEvent("MONITOR_START", "exec-1", "org-1", 0)];
|
|
262
264
|
|
|
263
265
|
await adapter.publish(events);
|
|
264
266
|
|
|
@@ -279,7 +281,7 @@ describe("KinesisAdapter", () => {
|
|
|
279
281
|
retryDelayMs: 10,
|
|
280
282
|
});
|
|
281
283
|
|
|
282
|
-
const events = [createMockEvent("
|
|
284
|
+
const events = [createMockEvent("MONITOR_START", "exec-1", "org-1", 0)];
|
|
283
285
|
|
|
284
286
|
await expect(adapter.publish(events)).rejects.toThrow("Network error");
|
|
285
287
|
expect(mockSend).toHaveBeenCalledTimes(3); // Initial + 2 retries
|
|
@@ -302,18 +304,18 @@ describe("KinesisAdapter", () => {
|
|
|
302
304
|
streamName: "test-stream",
|
|
303
305
|
});
|
|
304
306
|
|
|
305
|
-
const event = createMockEvent("
|
|
307
|
+
const event = createMockEvent("MONITOR_START", "exec-1", "org-1", 0);
|
|
306
308
|
await adapter.publish([event]);
|
|
307
309
|
|
|
308
310
|
const records = mockSend.mock.calls[0][0].input.Records;
|
|
309
311
|
const data = records[0].Data;
|
|
310
|
-
|
|
312
|
+
|
|
311
313
|
// Decode the Uint8Array back to JSON
|
|
312
314
|
const decoder = new TextDecoder();
|
|
313
315
|
const json = decoder.decode(data);
|
|
314
316
|
const parsed = JSON.parse(json);
|
|
315
317
|
|
|
316
|
-
expect(parsed.type).toBe("
|
|
318
|
+
expect(parsed.type).toBe("MONITOR_START");
|
|
317
319
|
expect(parsed.executionId).toBe("exec-1");
|
|
318
320
|
expect(parsed.organizationId).toBe("org-1");
|
|
319
321
|
});
|
|
@@ -69,7 +69,10 @@ export class KinesisAdapter implements DurableEventBusAdapter {
|
|
|
69
69
|
private readonly streamName: string;
|
|
70
70
|
private readonly maxRetries: number;
|
|
71
71
|
private readonly retryDelayMs: number;
|
|
72
|
-
private readonly partitionKeyStrategy:
|
|
72
|
+
private readonly partitionKeyStrategy:
|
|
73
|
+
| "executionId"
|
|
74
|
+
| "organizationId"
|
|
75
|
+
| "composite";
|
|
73
76
|
private static readonly KINESIS_MAX_BATCH = 500;
|
|
74
77
|
|
|
75
78
|
constructor(options: KinesisAdapterOptions) {
|
|
@@ -124,7 +127,7 @@ export class KinesisAdapter implements DurableEventBusAdapter {
|
|
|
124
127
|
console.warn(
|
|
125
128
|
`Retrying ${failedRecords.length} failed records (attempt ${attempt + 1}/${this.maxRetries}) after ${delay}ms`,
|
|
126
129
|
);
|
|
127
|
-
|
|
130
|
+
|
|
128
131
|
await this.sleep(delay);
|
|
129
132
|
await this.publishBatchWithRetry(failedRecords, attempt + 1);
|
|
130
133
|
} else {
|
|
@@ -141,7 +144,7 @@ export class KinesisAdapter implements DurableEventBusAdapter {
|
|
|
141
144
|
`Kinesis publish error, retrying (attempt ${attempt + 1}/${this.maxRetries}) after ${delay}ms:`,
|
|
142
145
|
error,
|
|
143
146
|
);
|
|
144
|
-
|
|
147
|
+
|
|
145
148
|
await this.sleep(delay);
|
|
146
149
|
await this.publishBatchWithRetry(records, attempt + 1);
|
|
147
150
|
} else {
|
|
@@ -18,15 +18,15 @@ describe("LocalEventEmitter", () => {
|
|
|
18
18
|
emitter.subscribe((event) => events.push(event));
|
|
19
19
|
|
|
20
20
|
const testEvent: ExecutionEvent = {
|
|
21
|
-
type: "
|
|
21
|
+
type: "MONITOR_START",
|
|
22
22
|
eventId: "123",
|
|
23
23
|
seq: 0,
|
|
24
24
|
timestamp: Date.now(),
|
|
25
25
|
organizationId: "test-org",
|
|
26
|
-
|
|
26
|
+
monitorId: "monitor-1",
|
|
27
27
|
executionId: "exec-1",
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
monitorName: "Test Monitor",
|
|
29
|
+
monitorVersion: "1.0",
|
|
30
30
|
nodeCount: 2,
|
|
31
31
|
edgeCount: 1,
|
|
32
32
|
};
|
|
@@ -49,7 +49,7 @@ describe("LocalEventEmitter", () => {
|
|
|
49
49
|
eventId: "456",
|
|
50
50
|
seq: 1,
|
|
51
51
|
timestamp: Date.now(),
|
|
52
|
-
|
|
52
|
+
monitorId: "monitor-1",
|
|
53
53
|
executionId: "exec-1",
|
|
54
54
|
organizationId: "test-org",
|
|
55
55
|
nodeId: "node-1",
|
|
@@ -73,7 +73,7 @@ describe("LocalEventEmitter", () => {
|
|
|
73
73
|
eventId: "789",
|
|
74
74
|
seq: 2,
|
|
75
75
|
timestamp: Date.now(),
|
|
76
|
-
|
|
76
|
+
monitorId: "monitor-1",
|
|
77
77
|
executionId: "exec-1",
|
|
78
78
|
organizationId: "test-org",
|
|
79
79
|
nodeId: "node-1",
|
|
@@ -103,11 +103,11 @@ describe("LocalEventEmitter", () => {
|
|
|
103
103
|
emitter.subscribe((event) => events.push(event));
|
|
104
104
|
|
|
105
105
|
const testEvent: ExecutionEvent = {
|
|
106
|
-
type: "
|
|
106
|
+
type: "MONITOR_END",
|
|
107
107
|
eventId: "abc",
|
|
108
108
|
seq: 3,
|
|
109
109
|
timestamp: Date.now(),
|
|
110
|
-
|
|
110
|
+
monitorId: "monitor-1",
|
|
111
111
|
executionId: "exec-1",
|
|
112
112
|
organizationId: "test-org",
|
|
113
113
|
success: true,
|
|
@@ -155,7 +155,7 @@ describe("DurableEventEmitter", () => {
|
|
|
155
155
|
eventId: "1",
|
|
156
156
|
seq: 0,
|
|
157
157
|
timestamp: Date.now(),
|
|
158
|
-
|
|
158
|
+
monitorId: "monitor-1",
|
|
159
159
|
executionId: "exec-1",
|
|
160
160
|
organizationId: "test-org",
|
|
161
161
|
nodeId: "node-1",
|
|
@@ -167,7 +167,7 @@ describe("DurableEventEmitter", () => {
|
|
|
167
167
|
eventId: "2",
|
|
168
168
|
seq: 1,
|
|
169
169
|
timestamp: Date.now(),
|
|
170
|
-
|
|
170
|
+
monitorId: "monitor-1",
|
|
171
171
|
executionId: "exec-1",
|
|
172
172
|
organizationId: "test-org",
|
|
173
173
|
nodeId: "node-2",
|
|
@@ -179,7 +179,7 @@ describe("DurableEventEmitter", () => {
|
|
|
179
179
|
eventId: "3",
|
|
180
180
|
seq: 2,
|
|
181
181
|
timestamp: Date.now(),
|
|
182
|
-
|
|
182
|
+
monitorId: "monitor-1",
|
|
183
183
|
executionId: "exec-1",
|
|
184
184
|
organizationId: "test-org",
|
|
185
185
|
nodeId: "node-3",
|
|
@@ -210,7 +210,7 @@ describe("DurableEventEmitter", () => {
|
|
|
210
210
|
eventId: "1",
|
|
211
211
|
seq: 0,
|
|
212
212
|
timestamp: Date.now(),
|
|
213
|
-
|
|
213
|
+
monitorId: "monitor-1",
|
|
214
214
|
executionId: "exec-1",
|
|
215
215
|
organizationId: "test-org",
|
|
216
216
|
nodeId: "node-1",
|
|
@@ -239,7 +239,7 @@ describe("DurableEventEmitter", () => {
|
|
|
239
239
|
eventId: "1",
|
|
240
240
|
seq: 0,
|
|
241
241
|
timestamp: Date.now(),
|
|
242
|
-
|
|
242
|
+
monitorId: "monitor-1",
|
|
243
243
|
executionId: "exec-1",
|
|
244
244
|
organizationId: "test-org",
|
|
245
245
|
nodeId: "node-1",
|
|
@@ -273,7 +273,7 @@ describe("DurableEventEmitter", () => {
|
|
|
273
273
|
eventId: "1",
|
|
274
274
|
seq: 0,
|
|
275
275
|
timestamp: Date.now(),
|
|
276
|
-
|
|
276
|
+
monitorId: "monitor-1",
|
|
277
277
|
executionId: "exec-1",
|
|
278
278
|
organizationId: "test-org",
|
|
279
279
|
errorName: "TestError",
|
|
@@ -308,7 +308,7 @@ describe("DurableEventEmitter", () => {
|
|
|
308
308
|
eventId: "1",
|
|
309
309
|
seq: 0,
|
|
310
310
|
timestamp: Date.now(),
|
|
311
|
-
|
|
311
|
+
monitorId: "monitor-1",
|
|
312
312
|
executionId: "exec-1",
|
|
313
313
|
organizationId: "test-org",
|
|
314
314
|
nodeId: "wait-1",
|
package/src/events/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Event types for test
|
|
2
|
+
* Event types for test monitor execution.
|
|
3
3
|
*
|
|
4
4
|
* All events are JSON-serializable for compatibility with various event buses.
|
|
5
5
|
* Events include stable identifiers (executionId, eventId) and monotonic sequence
|
|
@@ -15,26 +15,26 @@ export interface BaseEvent {
|
|
|
15
15
|
seq: number;
|
|
16
16
|
/** Unix timestamp in milliseconds */
|
|
17
17
|
timestamp: number;
|
|
18
|
-
/** ID of the test
|
|
19
|
-
|
|
18
|
+
/** ID of the test monitor being executed */
|
|
19
|
+
monitorId: string;
|
|
20
20
|
/** Unique identifier for this execution run */
|
|
21
21
|
executionId: string;
|
|
22
22
|
|
|
23
|
-
/** ID of the organization that the
|
|
23
|
+
/** ID of the organization that the monitor belongs to */
|
|
24
24
|
organizationId: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
export interface
|
|
29
|
-
type: "
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** Monitor-level events */
|
|
28
|
+
export interface MonitorStartEvent extends BaseEvent {
|
|
29
|
+
type: "MONITOR_START";
|
|
30
|
+
monitorName: string;
|
|
31
|
+
monitorVersion: string;
|
|
32
32
|
nodeCount: number;
|
|
33
33
|
edgeCount: number;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export interface
|
|
37
|
-
type: "
|
|
36
|
+
export interface MonitorEndEvent extends BaseEvent {
|
|
37
|
+
type: "MONITOR_END";
|
|
38
38
|
success: boolean;
|
|
39
39
|
totalDuration_ms: number;
|
|
40
40
|
nodeResultCount: number;
|
|
@@ -123,8 +123,8 @@ export interface ErrorEvent extends BaseEvent {
|
|
|
123
123
|
|
|
124
124
|
/** Union type of all execution events */
|
|
125
125
|
export type ExecutionEvent =
|
|
126
|
-
|
|
|
127
|
-
|
|
|
126
|
+
| MonitorStartEvent
|
|
127
|
+
| MonitorEndEvent
|
|
128
128
|
| NodeStartEvent
|
|
129
129
|
| NodeEndEvent
|
|
130
130
|
| HttpRequestEvent
|