@griffin-app/griffin-ts 0.1.12 → 0.1.14
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 +18 -18
- package/dist/builder.d.ts +7 -7
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +5 -5
- package/dist/builder.js.map +1 -1
- package/dist/builder.test.js +55 -55
- package/dist/builder.test.js.map +1 -1
- package/dist/example-sequential.js +4 -4
- package/dist/example-sequential.js.map +1 -1
- package/dist/example.d.ts +1 -1
- package/dist/example.js +3 -3
- package/dist/example.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/migrations.d.ts +16 -16
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +21 -21
- package/dist/migrations.js.map +1 -1
- package/dist/migrations.test.js +35 -35
- package/dist/migrations.test.js.map +1 -1
- package/dist/schema-exports.d.ts +3 -3
- package/dist/schema-exports.d.ts.map +1 -1
- package/dist/schema-exports.js +4 -4
- package/dist/schema-exports.js.map +1 -1
- package/dist/schema.d.ts +10 -10
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +11 -11
- package/dist/schema.js.map +1 -1
- package/dist/sequential-builder.d.ts +5 -5
- package/dist/sequential-builder.d.ts.map +1 -1
- package/dist/sequential-builder.js +5 -5
- package/dist/sequential-builder.js.map +1 -1
- package/dist/sequential-builder.test.js +65 -65
- package/dist/sequential-builder.test.js.map +1 -1
- package/dist/type-exports.d.ts +1 -1
- package/dist/type-exports.d.ts.map +1 -1
- package/dist/variable.d.ts +2 -2
- package/dist/variable.js +1 -1
- package/package.json +1 -1
- package/src/builder.test.ts +55 -55
- package/src/builder.ts +10 -10
- package/src/example-sequential.ts +4 -4
- package/src/example.ts +3 -3
- package/src/index.ts +6 -6
- package/src/migrations.test.ts +36 -36
- package/src/migrations.ts +24 -24
- package/src/schema-exports.ts +11 -11
- package/src/schema.ts +16 -16
- package/src/sequential-builder.test.ts +65 -65
- package/src/sequential-builder.ts +10 -10
- package/src/type-exports.ts +1 -1
- package/src/variable.ts +2 -2
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
HttpMethod,
|
|
10
10
|
ResponseFormat,
|
|
11
11
|
NodeType,
|
|
12
|
-
|
|
12
|
+
CURRENT_MONITOR_VERSION,
|
|
13
13
|
} from "./schema.js";
|
|
14
14
|
|
|
15
15
|
describe("Sequential Test Builder", () => {
|
|
16
16
|
describe("Basic Sequential Tests", () => {
|
|
17
17
|
it("should build a minimal sequential test", () => {
|
|
18
|
-
const
|
|
18
|
+
const monitor = createTestBuilder({
|
|
19
19
|
name: "simple-check",
|
|
20
20
|
frequency: Frequency.every(5).minutes(),
|
|
21
21
|
})
|
|
@@ -27,18 +27,18 @@ describe("Sequential Test Builder", () => {
|
|
|
27
27
|
})
|
|
28
28
|
.build();
|
|
29
29
|
|
|
30
|
-
expect(
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
33
|
-
expect(
|
|
34
|
-
expect(
|
|
30
|
+
expect(monitor.name).toBe("simple-check");
|
|
31
|
+
expect(monitor.version).toBe(CURRENT_MONITOR_VERSION);
|
|
32
|
+
expect(monitor.frequency).toEqual({ every: 5, unit: "MINUTE" });
|
|
33
|
+
expect(monitor.nodes).toHaveLength(1);
|
|
34
|
+
expect(monitor.edges).toEqual([
|
|
35
35
|
{ from: START, to: "health" },
|
|
36
36
|
{ from: "health", to: END },
|
|
37
37
|
]);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it("should auto-generate edges for multiple requests", () => {
|
|
41
|
-
const
|
|
41
|
+
const monitor = createTestBuilder({
|
|
42
42
|
name: "multi-step",
|
|
43
43
|
frequency: Frequency.every(10).minutes(),
|
|
44
44
|
})
|
|
@@ -62,8 +62,8 @@ describe("Sequential Test Builder", () => {
|
|
|
62
62
|
})
|
|
63
63
|
.build();
|
|
64
64
|
|
|
65
|
-
expect(
|
|
66
|
-
expect(
|
|
65
|
+
expect(monitor.nodes).toHaveLength(3);
|
|
66
|
+
expect(monitor.edges).toEqual([
|
|
67
67
|
{ from: START, to: "step1" },
|
|
68
68
|
{ from: "step1", to: "step2" },
|
|
69
69
|
{ from: "step2", to: "step3" },
|
|
@@ -72,17 +72,17 @@ describe("Sequential Test Builder", () => {
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it("should build empty test with no nodes", () => {
|
|
75
|
-
const
|
|
75
|
+
const monitor = createTestBuilder({
|
|
76
76
|
name: "empty-test",
|
|
77
77
|
frequency: Frequency.every(1).hour(),
|
|
78
78
|
}).build();
|
|
79
79
|
|
|
80
|
-
expect(
|
|
81
|
-
expect(
|
|
80
|
+
expect(monitor.nodes).toHaveLength(0);
|
|
81
|
+
expect(monitor.edges).toEqual([{ from: START, to: END }]);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
it("should include locations when specified", () => {
|
|
85
|
-
const
|
|
85
|
+
const monitor = createTestBuilder({
|
|
86
86
|
name: "distributed-test",
|
|
87
87
|
frequency: Frequency.every(5).minutes(),
|
|
88
88
|
locations: ["us-east-1", "eu-west-1"],
|
|
@@ -95,13 +95,13 @@ describe("Sequential Test Builder", () => {
|
|
|
95
95
|
})
|
|
96
96
|
.build();
|
|
97
97
|
|
|
98
|
-
expect(
|
|
98
|
+
expect(monitor.locations).toEqual(["us-east-1", "eu-west-1"]);
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
describe("Request Methods", () => {
|
|
103
103
|
it("should support all HTTP methods", () => {
|
|
104
|
-
const
|
|
104
|
+
const monitor = createTestBuilder({
|
|
105
105
|
name: "http-methods",
|
|
106
106
|
frequency: Frequency.every(5).minutes(),
|
|
107
107
|
})
|
|
@@ -140,16 +140,16 @@ describe("Sequential Test Builder", () => {
|
|
|
140
140
|
})
|
|
141
141
|
.build();
|
|
142
142
|
|
|
143
|
-
expect(
|
|
144
|
-
expect((
|
|
145
|
-
expect((
|
|
146
|
-
expect((
|
|
147
|
-
expect((
|
|
148
|
-
expect((
|
|
143
|
+
expect(monitor.nodes).toHaveLength(5);
|
|
144
|
+
expect((monitor.nodes[0] as any).method).toBe(HttpMethod.GET);
|
|
145
|
+
expect((monitor.nodes[1] as any).method).toBe(HttpMethod.POST);
|
|
146
|
+
expect((monitor.nodes[2] as any).method).toBe(HttpMethod.PUT);
|
|
147
|
+
expect((monitor.nodes[3] as any).method).toBe(HttpMethod.PATCH);
|
|
148
|
+
expect((monitor.nodes[4] as any).method).toBe(HttpMethod.DELETE);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
it("should include headers in requests", () => {
|
|
152
|
-
const
|
|
152
|
+
const monitor = createTestBuilder({
|
|
153
153
|
name: "with-headers",
|
|
154
154
|
frequency: Frequency.every(5).minutes(),
|
|
155
155
|
})
|
|
@@ -165,7 +165,7 @@ describe("Sequential Test Builder", () => {
|
|
|
165
165
|
})
|
|
166
166
|
.build();
|
|
167
167
|
|
|
168
|
-
const endpoint =
|
|
168
|
+
const endpoint = monitor.nodes[0] as any;
|
|
169
169
|
expect(endpoint.headers).toEqual({
|
|
170
170
|
Authorization: "Bearer token123",
|
|
171
171
|
"X-Custom": "value",
|
|
@@ -173,7 +173,7 @@ describe("Sequential Test Builder", () => {
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
it("should include body in requests", () => {
|
|
176
|
-
const
|
|
176
|
+
const monitor = createTestBuilder({
|
|
177
177
|
name: "with-body",
|
|
178
178
|
frequency: Frequency.every(5).minutes(),
|
|
179
179
|
})
|
|
@@ -192,7 +192,7 @@ describe("Sequential Test Builder", () => {
|
|
|
192
192
|
})
|
|
193
193
|
.build();
|
|
194
194
|
|
|
195
|
-
const endpoint =
|
|
195
|
+
const endpoint = monitor.nodes[0] as any;
|
|
196
196
|
expect(endpoint.body).toEqual({
|
|
197
197
|
name: "Test User",
|
|
198
198
|
email: "test@example.com",
|
|
@@ -205,7 +205,7 @@ describe("Sequential Test Builder", () => {
|
|
|
205
205
|
|
|
206
206
|
describe("Wait Nodes", () => {
|
|
207
207
|
it("should add wait with milliseconds", () => {
|
|
208
|
-
const
|
|
208
|
+
const monitor = createTestBuilder({
|
|
209
209
|
name: "with-wait",
|
|
210
210
|
frequency: Frequency.every(5).minutes(),
|
|
211
211
|
})
|
|
@@ -224,13 +224,13 @@ describe("Sequential Test Builder", () => {
|
|
|
224
224
|
})
|
|
225
225
|
.build();
|
|
226
226
|
|
|
227
|
-
expect(
|
|
228
|
-
expect(
|
|
227
|
+
expect(monitor.nodes).toHaveLength(3);
|
|
228
|
+
expect(monitor.nodes[1]).toEqual({
|
|
229
229
|
id: "pause",
|
|
230
230
|
type: NodeType.WAIT,
|
|
231
231
|
duration_ms: 2000,
|
|
232
232
|
});
|
|
233
|
-
expect(
|
|
233
|
+
expect(monitor.edges).toEqual([
|
|
234
234
|
{ from: START, to: "step1" },
|
|
235
235
|
{ from: "step1", to: "pause" },
|
|
236
236
|
{ from: "pause", to: "step2" },
|
|
@@ -239,7 +239,7 @@ describe("Sequential Test Builder", () => {
|
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
it("should add wait with seconds", () => {
|
|
242
|
-
const
|
|
242
|
+
const monitor = createTestBuilder({
|
|
243
243
|
name: "with-wait-seconds",
|
|
244
244
|
frequency: Frequency.every(5).minutes(),
|
|
245
245
|
})
|
|
@@ -258,7 +258,7 @@ describe("Sequential Test Builder", () => {
|
|
|
258
258
|
})
|
|
259
259
|
.build();
|
|
260
260
|
|
|
261
|
-
expect(
|
|
261
|
+
expect(monitor.nodes[1]).toEqual({
|
|
262
262
|
id: "pause",
|
|
263
263
|
type: NodeType.WAIT,
|
|
264
264
|
duration_ms: 5000,
|
|
@@ -266,7 +266,7 @@ describe("Sequential Test Builder", () => {
|
|
|
266
266
|
});
|
|
267
267
|
|
|
268
268
|
it("should add wait with minutes", () => {
|
|
269
|
-
const
|
|
269
|
+
const monitor = createTestBuilder({
|
|
270
270
|
name: "with-wait-minutes",
|
|
271
271
|
frequency: Frequency.every(5).minutes(),
|
|
272
272
|
})
|
|
@@ -285,7 +285,7 @@ describe("Sequential Test Builder", () => {
|
|
|
285
285
|
})
|
|
286
286
|
.build();
|
|
287
287
|
|
|
288
|
-
expect(
|
|
288
|
+
expect(monitor.nodes[1]).toEqual({
|
|
289
289
|
id: "pause",
|
|
290
290
|
type: NodeType.WAIT,
|
|
291
291
|
duration_ms: 120000,
|
|
@@ -295,7 +295,7 @@ describe("Sequential Test Builder", () => {
|
|
|
295
295
|
|
|
296
296
|
describe("Assertions", () => {
|
|
297
297
|
it("should add assertions with auto-generated node name", () => {
|
|
298
|
-
const
|
|
298
|
+
const monitor = createTestBuilder({
|
|
299
299
|
name: "with-assertions",
|
|
300
300
|
frequency: Frequency.every(5).minutes(),
|
|
301
301
|
})
|
|
@@ -308,13 +308,13 @@ describe("Sequential Test Builder", () => {
|
|
|
308
308
|
.assert((state) => [Assert(state.call.status).equals(200)])
|
|
309
309
|
.build();
|
|
310
310
|
|
|
311
|
-
expect(
|
|
312
|
-
expect(
|
|
313
|
-
expect(
|
|
311
|
+
expect(monitor.nodes).toHaveLength(2);
|
|
312
|
+
expect(monitor.nodes[1].type).toBe(NodeType.ASSERTION);
|
|
313
|
+
expect(monitor.nodes[1].id).toMatch(/^step_\d+$/);
|
|
314
314
|
});
|
|
315
315
|
|
|
316
316
|
it("should create assertions with type-safe state access", () => {
|
|
317
|
-
const
|
|
317
|
+
const monitor = createTestBuilder({
|
|
318
318
|
name: "typed-assertions",
|
|
319
319
|
frequency: Frequency.every(5).minutes(),
|
|
320
320
|
})
|
|
@@ -342,15 +342,15 @@ describe("Sequential Test Builder", () => {
|
|
|
342
342
|
])
|
|
343
343
|
.build();
|
|
344
344
|
|
|
345
|
-
expect(
|
|
346
|
-
expect(
|
|
347
|
-
expect(
|
|
348
|
-
expect(
|
|
349
|
-
expect(
|
|
345
|
+
expect(monitor.nodes).toHaveLength(4);
|
|
346
|
+
expect(monitor.nodes[0].id).toBe("create_user");
|
|
347
|
+
expect(monitor.nodes[1].type).toBe(NodeType.ASSERTION);
|
|
348
|
+
expect(monitor.nodes[2].id).toBe("get_user");
|
|
349
|
+
expect(monitor.nodes[3].type).toBe(NodeType.ASSERTION);
|
|
350
350
|
});
|
|
351
351
|
|
|
352
352
|
it("should properly chain assertions with requests and waits", () => {
|
|
353
|
-
const
|
|
353
|
+
const monitor = createTestBuilder({
|
|
354
354
|
name: "complex-chain",
|
|
355
355
|
frequency: Frequency.every(15).minutes(),
|
|
356
356
|
})
|
|
@@ -375,8 +375,8 @@ describe("Sequential Test Builder", () => {
|
|
|
375
375
|
])
|
|
376
376
|
.build();
|
|
377
377
|
|
|
378
|
-
expect(
|
|
379
|
-
expect(
|
|
378
|
+
expect(monitor.nodes).toHaveLength(5);
|
|
379
|
+
expect(monitor.edges).toEqual([
|
|
380
380
|
{ from: START, to: "create" },
|
|
381
381
|
{ from: "create", to: "step_0" },
|
|
382
382
|
{ from: "step_0", to: "pause" },
|
|
@@ -389,7 +389,7 @@ describe("Sequential Test Builder", () => {
|
|
|
389
389
|
|
|
390
390
|
describe("Secrets and Variables", () => {
|
|
391
391
|
it("should support secrets in headers", () => {
|
|
392
|
-
const
|
|
392
|
+
const monitor = createTestBuilder({
|
|
393
393
|
name: "secret-headers",
|
|
394
394
|
frequency: Frequency.every(5).minutes(),
|
|
395
395
|
})
|
|
@@ -404,7 +404,7 @@ describe("Sequential Test Builder", () => {
|
|
|
404
404
|
})
|
|
405
405
|
.build();
|
|
406
406
|
|
|
407
|
-
const endpoint =
|
|
407
|
+
const endpoint = monitor.nodes[0] as any;
|
|
408
408
|
expect(endpoint.headers.Authorization).toEqual({
|
|
409
409
|
$secret: {
|
|
410
410
|
provider: "env",
|
|
@@ -414,7 +414,7 @@ describe("Sequential Test Builder", () => {
|
|
|
414
414
|
});
|
|
415
415
|
|
|
416
416
|
it("should support secrets in body", () => {
|
|
417
|
-
const
|
|
417
|
+
const monitor = createTestBuilder({
|
|
418
418
|
name: "secret-body",
|
|
419
419
|
frequency: Frequency.every(5).minutes(),
|
|
420
420
|
})
|
|
@@ -429,7 +429,7 @@ describe("Sequential Test Builder", () => {
|
|
|
429
429
|
})
|
|
430
430
|
.build();
|
|
431
431
|
|
|
432
|
-
const endpoint =
|
|
432
|
+
const endpoint = monitor.nodes[0] as any;
|
|
433
433
|
expect(endpoint.body.apiKey).toEqual({
|
|
434
434
|
$secret: {
|
|
435
435
|
provider: "aws",
|
|
@@ -439,7 +439,7 @@ describe("Sequential Test Builder", () => {
|
|
|
439
439
|
});
|
|
440
440
|
|
|
441
441
|
it("should support variables for base URL", () => {
|
|
442
|
-
const
|
|
442
|
+
const monitor = createTestBuilder({
|
|
443
443
|
name: "variable-base",
|
|
444
444
|
frequency: Frequency.every(5).minutes(),
|
|
445
445
|
})
|
|
@@ -451,7 +451,7 @@ describe("Sequential Test Builder", () => {
|
|
|
451
451
|
})
|
|
452
452
|
.build();
|
|
453
453
|
|
|
454
|
-
const endpoint =
|
|
454
|
+
const endpoint = monitor.nodes[0] as any;
|
|
455
455
|
expect(endpoint.base).toEqual({
|
|
456
456
|
$variable: {
|
|
457
457
|
key: "api-host",
|
|
@@ -460,7 +460,7 @@ describe("Sequential Test Builder", () => {
|
|
|
460
460
|
});
|
|
461
461
|
|
|
462
462
|
it("should support templated variable paths", () => {
|
|
463
|
-
const
|
|
463
|
+
const monitor = createTestBuilder({
|
|
464
464
|
name: "template-path",
|
|
465
465
|
frequency: Frequency.every(5).minutes(),
|
|
466
466
|
})
|
|
@@ -472,7 +472,7 @@ describe("Sequential Test Builder", () => {
|
|
|
472
472
|
})
|
|
473
473
|
.build();
|
|
474
474
|
|
|
475
|
-
const endpoint =
|
|
475
|
+
const endpoint = monitor.nodes[0] as any;
|
|
476
476
|
expect(endpoint.path).toEqual({
|
|
477
477
|
$variable: {
|
|
478
478
|
key: "api-version",
|
|
@@ -484,7 +484,7 @@ describe("Sequential Test Builder", () => {
|
|
|
484
484
|
|
|
485
485
|
describe("Response Formats", () => {
|
|
486
486
|
it("should support JSON response format", () => {
|
|
487
|
-
const
|
|
487
|
+
const monitor = createTestBuilder({
|
|
488
488
|
name: "json-response",
|
|
489
489
|
frequency: Frequency.every(5).minutes(),
|
|
490
490
|
})
|
|
@@ -496,11 +496,11 @@ describe("Sequential Test Builder", () => {
|
|
|
496
496
|
})
|
|
497
497
|
.build();
|
|
498
498
|
|
|
499
|
-
expect((
|
|
499
|
+
expect((monitor.nodes[0] as any).response_format).toBe(ResponseFormat.JSON);
|
|
500
500
|
});
|
|
501
501
|
|
|
502
502
|
it("should support XML response format", () => {
|
|
503
|
-
const
|
|
503
|
+
const monitor = createTestBuilder({
|
|
504
504
|
name: "xml-response",
|
|
505
505
|
frequency: Frequency.every(5).minutes(),
|
|
506
506
|
})
|
|
@@ -512,13 +512,13 @@ describe("Sequential Test Builder", () => {
|
|
|
512
512
|
})
|
|
513
513
|
.build();
|
|
514
514
|
|
|
515
|
-
expect((
|
|
515
|
+
expect((monitor.nodes[0] as any).response_format).toBe(ResponseFormat.XML);
|
|
516
516
|
});
|
|
517
517
|
});
|
|
518
518
|
|
|
519
519
|
describe("Frequency Configurations", () => {
|
|
520
520
|
it("should support different frequency units", () => {
|
|
521
|
-
const
|
|
521
|
+
const minuteMonitor = createTestBuilder({
|
|
522
522
|
name: "minute-freq",
|
|
523
523
|
frequency: Frequency.every(5).minutes(),
|
|
524
524
|
})
|
|
@@ -530,7 +530,7 @@ describe("Sequential Test Builder", () => {
|
|
|
530
530
|
})
|
|
531
531
|
.build();
|
|
532
532
|
|
|
533
|
-
const
|
|
533
|
+
const hourMonitor = createTestBuilder({
|
|
534
534
|
name: "hour-freq",
|
|
535
535
|
frequency: Frequency.every(2).hours(),
|
|
536
536
|
})
|
|
@@ -542,7 +542,7 @@ describe("Sequential Test Builder", () => {
|
|
|
542
542
|
})
|
|
543
543
|
.build();
|
|
544
544
|
|
|
545
|
-
const
|
|
545
|
+
const dayMonitor = createTestBuilder({
|
|
546
546
|
name: "day-freq",
|
|
547
547
|
frequency: Frequency.every(1).day(),
|
|
548
548
|
})
|
|
@@ -554,9 +554,9 @@ describe("Sequential Test Builder", () => {
|
|
|
554
554
|
})
|
|
555
555
|
.build();
|
|
556
556
|
|
|
557
|
-
expect(
|
|
558
|
-
expect(
|
|
559
|
-
expect(
|
|
557
|
+
expect(minuteMonitor.frequency).toEqual({ every: 5, unit: "MINUTE" });
|
|
558
|
+
expect(hourMonitor.frequency).toEqual({ every: 2, unit: "HOUR" });
|
|
559
|
+
expect(dayMonitor.frequency).toEqual({ every: 1, unit: "DAY" });
|
|
560
560
|
});
|
|
561
561
|
});
|
|
562
562
|
});
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from "./builder.js";
|
|
8
8
|
import { START, END } from "./constants.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
CURRENT_MONITOR_VERSION,
|
|
11
11
|
Edge,
|
|
12
12
|
NodeDSL,
|
|
13
13
|
Frequency,
|
|
14
|
-
|
|
14
|
+
MonitorDSL,
|
|
15
15
|
ResponseFormat,
|
|
16
16
|
type Assertion as AssertionType,
|
|
17
17
|
} from "./schema.js";
|
|
@@ -96,12 +96,12 @@ export interface SequentialTestBuilder<NodeNames extends string = never> {
|
|
|
96
96
|
): SequentialTestBuilder<NodeNames>;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Builds the final test
|
|
99
|
+
* Builds the final test monitor.
|
|
100
100
|
* Automatically connects all nodes in sequence: START → node1 → node2 → ... → END
|
|
101
101
|
*
|
|
102
|
-
* @returns The completed
|
|
102
|
+
* @returns The completed TestMonitor
|
|
103
103
|
*/
|
|
104
|
-
build():
|
|
104
|
+
build(): MonitorDSL;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -167,17 +167,17 @@ class SequentialTestBuilderImpl<
|
|
|
167
167
|
return this as unknown as SequentialTestBuilder<NodeNames>;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
build():
|
|
170
|
+
build(): MonitorDSL {
|
|
171
171
|
const { name, frequency, locations } = this.config;
|
|
172
172
|
const edges: Edge[] = [];
|
|
173
173
|
|
|
174
|
-
// If no nodes, return empty
|
|
174
|
+
// If no nodes, return empty monitor with just START->END
|
|
175
175
|
if (this.nodes.length === 0) {
|
|
176
176
|
return {
|
|
177
177
|
name,
|
|
178
178
|
frequency,
|
|
179
179
|
locations,
|
|
180
|
-
version:
|
|
180
|
+
version: CURRENT_MONITOR_VERSION,
|
|
181
181
|
nodes: [],
|
|
182
182
|
edges: [{ from: START, to: END }],
|
|
183
183
|
};
|
|
@@ -199,7 +199,7 @@ class SequentialTestBuilderImpl<
|
|
|
199
199
|
|
|
200
200
|
return {
|
|
201
201
|
name,
|
|
202
|
-
version:
|
|
202
|
+
version: CURRENT_MONITOR_VERSION,
|
|
203
203
|
frequency,
|
|
204
204
|
locations,
|
|
205
205
|
nodes: this.nodes,
|
|
@@ -225,7 +225,7 @@ class SequentialTestBuilderImpl<
|
|
|
225
225
|
* ```typescript
|
|
226
226
|
* import { createTestBuilder, POST, GET, Json, Frequency, Assert } from "griffin-ts";
|
|
227
227
|
*
|
|
228
|
-
* const
|
|
228
|
+
* const monitor = createTestBuilder({
|
|
229
229
|
* name: "create-and-verify-user",
|
|
230
230
|
* frequency: Frequency.every(5).minute(),
|
|
231
231
|
* locations: ["us-east-1", "eu-west-1"]
|
package/src/type-exports.ts
CHANGED
package/src/variable.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Variable reference utilities for griffin DSL.
|
|
3
3
|
*
|
|
4
4
|
* Variables are resolved at evaluation time (when the CLI imports test files)
|
|
5
|
-
* by reading from variables.yaml. The resolved values are baked into the
|
|
5
|
+
* by reading from variables.yaml. The resolved values are baked into the monitor.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -19,7 +19,7 @@ export interface VariableRef {
|
|
|
19
19
|
* Create a variable reference that will be resolved from variables.yaml.
|
|
20
20
|
*
|
|
21
21
|
* Variables are resolved when the CLI evaluates the test file, so the final
|
|
22
|
-
*
|
|
22
|
+
* monitor contains resolved string values rather than variable references.
|
|
23
23
|
*
|
|
24
24
|
* @param key - The variable key to look up in variables.yaml
|
|
25
25
|
* @returns A variable reference object
|