@griffin-app/griffin-ts 0.1.13 → 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.
Files changed (54) hide show
  1. package/README.md +18 -18
  2. package/dist/builder.d.ts +7 -7
  3. package/dist/builder.d.ts.map +1 -1
  4. package/dist/builder.js +5 -5
  5. package/dist/builder.js.map +1 -1
  6. package/dist/builder.test.js +55 -55
  7. package/dist/builder.test.js.map +1 -1
  8. package/dist/example-sequential.js +4 -4
  9. package/dist/example-sequential.js.map +1 -1
  10. package/dist/example.d.ts +1 -1
  11. package/dist/example.js +3 -3
  12. package/dist/example.js.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/migrations.d.ts +16 -16
  18. package/dist/migrations.d.ts.map +1 -1
  19. package/dist/migrations.js +21 -21
  20. package/dist/migrations.js.map +1 -1
  21. package/dist/migrations.test.js +35 -35
  22. package/dist/migrations.test.js.map +1 -1
  23. package/dist/schema-exports.d.ts +3 -3
  24. package/dist/schema-exports.d.ts.map +1 -1
  25. package/dist/schema-exports.js +4 -4
  26. package/dist/schema-exports.js.map +1 -1
  27. package/dist/schema.d.ts +10 -10
  28. package/dist/schema.d.ts.map +1 -1
  29. package/dist/schema.js +11 -11
  30. package/dist/schema.js.map +1 -1
  31. package/dist/sequential-builder.d.ts +5 -5
  32. package/dist/sequential-builder.d.ts.map +1 -1
  33. package/dist/sequential-builder.js +5 -5
  34. package/dist/sequential-builder.js.map +1 -1
  35. package/dist/sequential-builder.test.js +65 -65
  36. package/dist/sequential-builder.test.js.map +1 -1
  37. package/dist/type-exports.d.ts +1 -1
  38. package/dist/type-exports.d.ts.map +1 -1
  39. package/dist/variable.d.ts +2 -2
  40. package/dist/variable.js +1 -1
  41. package/package.json +1 -1
  42. package/src/builder.test.ts +55 -55
  43. package/src/builder.ts +10 -10
  44. package/src/example-sequential.ts +4 -4
  45. package/src/example.ts +3 -3
  46. package/src/index.ts +6 -6
  47. package/src/migrations.test.ts +36 -36
  48. package/src/migrations.ts +24 -24
  49. package/src/schema-exports.ts +11 -11
  50. package/src/schema.ts +16 -16
  51. package/src/sequential-builder.test.ts +65 -65
  52. package/src/sequential-builder.ts +10 -10
  53. package/src/type-exports.ts +1 -1
  54. package/src/variable.ts +2 -2
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # griffin Test System
2
2
 
3
- The griffin Test System provides a TypeScript DSL for defining API tests. Tests are written in TypeScript and output JSON test plans that can be executed by the plan executor.
3
+ The griffin Test System provides a TypeScript DSL for defining API tests. Tests are written in TypeScript and output JSON test monitors that can be executed by the monitor executor.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - TypeScript DSL for defining API checks
8
- - Chainable API for building test plans
8
+ - Chainable API for building test monitors
9
9
  - Support for endpoints, waits, assertions, and edges
10
- - Outputs JSON test plans for execution
10
+ - Outputs JSON test monitors for execution
11
11
 
12
12
  ## Installation
13
13
 
@@ -24,7 +24,7 @@ npm run build
24
24
 
25
25
  ## Usage
26
26
 
27
- Create test files in `__griffin__` directories. When executed, they output JSON test plans.
27
+ Create test files in `__griffin__` directories. When executed, they output JSON test monitors.
28
28
 
29
29
  griffin provides two builder APIs:
30
30
 
@@ -38,7 +38,7 @@ The sequential builder automatically connects steps in order - no need to manage
38
38
  ```typescript
39
39
  import { GET, createTestBuilder, JSON, Frequency, Assert } from "griffin-ts";
40
40
 
41
- const plan = createTestBuilder({
41
+ const monitor = createTestBuilder({
42
42
  name: "health-check",
43
43
  endpoint_host: "https://api.example.com",
44
44
  })
@@ -53,7 +53,7 @@ const plan = createTestBuilder({
53
53
  ])
54
54
  .build({ frequency: Frequency.every(1).minute() });
55
55
 
56
- export default plan;
56
+ export default monitor;
57
57
  ```
58
58
 
59
59
  #### Sequential Example with Waits and Assertions
@@ -69,7 +69,7 @@ import {
69
69
  Assert,
70
70
  } from "griffin-ts";
71
71
 
72
- const plan = createTestBuilder({
72
+ const monitor = createTestBuilder({
73
73
  name: "create-and-verify-user",
74
74
  endpoint_host: "https://api.example.com",
75
75
  })
@@ -96,7 +96,7 @@ const plan = createTestBuilder({
96
96
  ])
97
97
  .build({ frequency: Frequency.every(5).minute() });
98
98
 
99
- export default plan;
99
+ export default monitor;
100
100
  ```
101
101
 
102
102
  ### Graph Builder (For Complex Workflows)
@@ -116,7 +116,7 @@ import {
116
116
  Assert,
117
117
  } from "griffin-ts";
118
118
 
119
- const plan = createGraphBuilder({
119
+ const monitor = createGraphBuilder({
120
120
  name: "foo-bar-check",
121
121
  endpoint_host: "https://api.example.com",
122
122
  })
@@ -144,12 +144,12 @@ const plan = createGraphBuilder({
144
144
  .addEdge("check_response", END)
145
145
  .build({ frequency: Frequency.every(1).minute() });
146
146
 
147
- export default plan;
147
+ export default monitor;
148
148
  ```
149
149
 
150
150
  ### Using Secrets
151
151
 
152
- griffin supports secure secret management for API keys, tokens, and other credentials. Secrets are referenced in your test plans and resolved at runtime by the configured secret providers.
152
+ griffin supports secure secret management for API keys, tokens, and other credentials. Secrets are referenced in your test monitors and resolved at runtime by the configured secret providers.
153
153
 
154
154
  #### With Sequential Builder
155
155
 
@@ -163,7 +163,7 @@ import {
163
163
  Assert,
164
164
  } from "griffin-ts";
165
165
 
166
- const plan = createTestBuilder({
166
+ const monitor = createTestBuilder({
167
167
  name: "authenticated-check",
168
168
  endpoint_host: "https://api.example.com",
169
169
  })
@@ -187,7 +187,7 @@ const plan = createTestBuilder({
187
187
  .assert((state) => [Assert(state["protected"].status).equals(200)])
188
188
  .build({ frequency: Frequency.every(5).minute() });
189
189
 
190
- export default plan;
190
+ export default monitor;
191
191
  ```
192
192
 
193
193
  #### With Graph Builder
@@ -204,7 +204,7 @@ import {
204
204
  Assert,
205
205
  } from "griffin-ts";
206
206
 
207
- const plan = createGraphBuilder({
207
+ const monitor = createGraphBuilder({
208
208
  name: "authenticated-check",
209
209
  endpoint_host: "https://api.example.com",
210
210
  })
@@ -225,7 +225,7 @@ const plan = createGraphBuilder({
225
225
  .addEdge("verify", END)
226
226
  .build({ frequency: Frequency.every(5).minute() });
227
227
 
228
- export default plan;
228
+ export default monitor;
229
229
  ```
230
230
 
231
231
  #### Secret Providers
@@ -261,7 +261,7 @@ See the [griffin-runner CONFIG.md](../griffin-runner/CONFIG.md) for configuratio
261
261
  - **`.endpoint(id, config)`**: Add an HTTP endpoint request with a unique identifier
262
262
  - **`.wait(duration)`**: Add a delay (use `Wait.seconds(n)`, `Wait.minutes(n)`, or `Wait.milliseconds(n)`)
263
263
  - **`.assert(fn)`**: Add assertions using a function that receives the state proxy and returns an array of assertions
264
- - **`.build(options)`**: Generate the final test plan with frequency configuration
264
+ - **`.build(options)`**: Generate the final test monitor with frequency configuration
265
265
 
266
266
  #### Graph Builder Methods
267
267
 
@@ -269,7 +269,7 @@ See the [griffin-runner CONFIG.md](../griffin-runner/CONFIG.md) for configuratio
269
269
  - **`.addWait(id, duration)`**: Add a wait node to the graph
270
270
  - **`.addAssertion(id, fn)`**: Add an assertion node using a function that receives the state proxy
271
271
  - **`.addEdge(from, to)`**: Connect two nodes (use `START` and `END` constants for entry/exit)
272
- - **`.build(options)`**: Generate the final test plan (validates all nodes are connected)
272
+ - **`.build(options)`**: Generate the final test monitor (validates all nodes are connected)
273
273
 
274
274
  #### Assertions
275
275
 
@@ -302,7 +302,7 @@ See [ASSERTIONS_QUICK_REF.md](./ASSERTIONS_QUICK_REF.md) for the complete assert
302
302
 
303
303
  ## Output
304
304
 
305
- The test system outputs a JSON test plan to stdout when `plan.create()` is called. This JSON is consumed by the plan executor. Example output:
305
+ The test system outputs a JSON test monitor to stdout when `monitor.create()` is called. This JSON is consumed by the monitor executor. Example output:
306
306
 
307
307
  ```json
308
308
  {
package/dist/builder.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Assertion, PlanDSL, NodeDSL, Frequency, HttpRequestDSL, Wait, Assertions } from "./schema.js";
1
+ import { Assertion, MonitorDSL, NodeDSL, Frequency, HttpRequestDSL, Wait, Assertions } from "./schema.js";
2
2
  import { type START as StartType, type END as EndType } from "./constants.js";
3
3
  /**
4
4
  * A node definition without the id field.
@@ -6,7 +6,7 @@ import { type START as StartType, type END as EndType } from "./constants.js";
6
6
  */
7
7
  export type NodeWithoutId = Omit<NodeDSL, "id">;
8
8
  /**
9
- * TestBuilder provides a type-safe DSL for constructing test plans with compile-time graph validation.
9
+ * TestBuilder provides a type-safe DSL for constructing test monitors with compile-time graph validation.
10
10
  *
11
11
  * Type parameters track the state of the graph during construction:
12
12
  * @template NodeName - Union of all registered node names
@@ -49,7 +49,7 @@ export interface TestBuilder<NodeName extends string = never, HasOutput extends
49
49
  */
50
50
  addEdge<From extends StartType | Exclude<NodeName, HasOutput>, To extends EndType | Exclude<NodeName, From>>(from: From, to: To): TestBuilder<NodeName, From extends StartType ? HasOutput : HasOutput | From, To extends EndType ? HasInput : HasInput | To>;
51
51
  /**
52
- * Builds the final test plan.
52
+ * Builds the final test monitor.
53
53
  *
54
54
  * This method is only callable when all graph constraints are satisfied:
55
55
  * - All nodes must have at least one outgoing edge
@@ -57,7 +57,7 @@ export interface TestBuilder<NodeName extends string = never, HasOutput extends
57
57
  *
58
58
  * If constraints aren't met, the return type becomes `never`, causing a compile error.
59
59
  */
60
- build: [Exclude<NodeName, HasOutput>] extends [never] ? [Exclude<NodeName, HasInput>] extends [never] ? () => PlanDSL : {
60
+ build: [Exclude<NodeName, HasOutput>] extends [never] ? [Exclude<NodeName, HasInput>] extends [never] ? () => MonitorDSL : {
61
61
  error: "Some nodes have no incoming edges";
62
62
  unconnected: Exclude<NodeName, HasInput>;
63
63
  } : {
@@ -66,9 +66,9 @@ export interface TestBuilder<NodeName extends string = never, HasOutput extends
66
66
  };
67
67
  }
68
68
  /**
69
- * Creates a new test builder for constructing a test plan.
69
+ * Creates a new test builder for constructing a test monitor.
70
70
  *
71
- * @param config - Configuration for the test plan
71
+ * @param config - Configuration for the test monitor
72
72
  * @param config.name - Name of the test
73
73
  * @param config.frequency - frequency for scheduled execution
74
74
  * @param config.locations - Optional array of location identifiers where this test should run
@@ -76,7 +76,7 @@ export interface TestBuilder<NodeName extends string = never, HasOutput extends
76
76
  *
77
77
  * @example
78
78
  * ```typescript
79
- * const plan = createGraphBuilder({
79
+ * const monitor = createGraphBuilder({
80
80
  * name: "health-check",
81
81
  * frequency: Frequency.every(5).minute(),
82
82
  * locations: ["us-east-1", "eu-west-1"]
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,OAAO,EAEP,SAAS,EAGT,cAAc,EAEd,IAAI,EACJ,UAAU,EAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAC1B,QAAQ,SAAS,MAAM,GAAG,KAAK,EAC/B,SAAS,SAAS,MAAM,GAAG,KAAK,EAChC,QAAQ,SAAS,MAAM,GAAG,KAAK;IAE/B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,SAAS,MAAM,EACzB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,QAAQ,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CACL,IAAI,SAAS,SAAS,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,EACrD,EAAE,SAAS,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAE5C,IAAI,EAAE,IAAI,EACV,EAAE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C,MAAM,CAAC,CAAC;IACtC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAY5B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB9E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAK7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAKzE"}
package/dist/builder.js CHANGED
@@ -1,4 +1,4 @@
1
- import { NodeType, CURRENT_PLAN_VERSION, } from "./schema.js";
1
+ import { NodeType, CURRENT_MONITOR_VERSION, } from "./schema.js";
2
2
  /**
3
3
  * Internal implementation class for TestBuilder.
4
4
  * Uses explicit type assertions at method boundaries to maintain phantom type tracking.
@@ -29,7 +29,7 @@ class TestBuilderImpl {
29
29
  const buildFn = () => {
30
30
  return {
31
31
  name,
32
- version: CURRENT_PLAN_VERSION,
32
+ version: CURRENT_MONITOR_VERSION,
33
33
  frequency,
34
34
  locations,
35
35
  nodes,
@@ -42,9 +42,9 @@ class TestBuilderImpl {
42
42
  }
43
43
  }
44
44
  /**
45
- * Creates a new test builder for constructing a test plan.
45
+ * Creates a new test builder for constructing a test monitor.
46
46
  *
47
- * @param config - Configuration for the test plan
47
+ * @param config - Configuration for the test monitor
48
48
  * @param config.name - Name of the test
49
49
  * @param config.frequency - frequency for scheduled execution
50
50
  * @param config.locations - Optional array of location identifiers where this test should run
@@ -52,7 +52,7 @@ class TestBuilderImpl {
52
52
  *
53
53
  * @example
54
54
  * ```typescript
55
- * const plan = createGraphBuilder({
55
+ * const monitor = createGraphBuilder({
56
56
  * name: "health-check",
57
57
  * frequency: Frequency.every(5).minute(),
58
58
  * locations: ["us-east-1", "eu-west-1"]
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAGR,oBAAoB,GACrB,MAAM,aAAa,CAAC;AA6FrB;;;GAGG;AACH,MAAM,eAAe;IAST;IAJF,KAAK,GAAc,EAAE,CAAC;IACtB,KAAK,GAAW,EAAE,CAAC;IAE3B,YACU,MAIP;QAJO,WAAM,GAAN,MAAM,CAIb;IACA,CAAC;IAEJ,OAAO,CACL,IAAU,EACV,IAAmB;QAEnB,yDAAyD;QACzD,4FAA4F;QAC5F,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,EAAwB,CAAC,CAAC;QAC7D,qDAAqD;QACrD,OAAO,IAAoE,CAAC;IAC9E,CAAC;IAED,OAAO,CAIL,IAAU,EACV,EAAM;QAMN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,+EAA+E;QAC/E,OAAO,IAIN,CAAC;IACJ,CAAC;IAED,IAAI,KAAK;QACP,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;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AC;IAClB,CAAC;IACD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IACjC,CAAC;IACD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IACtC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,QAAsB;IACzC,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,UAAuB;IAC/C,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,SAAS;QACxB,UAAU,EAAE,UAAU;KACvB,CAAC;AACJ,CAAC"}
@@ -4,11 +4,11 @@ import { START, END } from "./constants.js";
4
4
  import { Frequency } from "./frequency.js";
5
5
  import { secret } from "./secrets.js";
6
6
  import { variable } from "./variable.js";
7
- import { HttpMethod, ResponseFormat, NodeType, CURRENT_PLAN_VERSION, BinaryPredicateOperator, AssertionSubject, UnaryPredicateOperator, } from "./schema.js";
7
+ import { HttpMethod, ResponseFormat, NodeType, CURRENT_MONITOR_VERSION, BinaryPredicateOperator, AssertionSubject, UnaryPredicateOperator, } from "./schema.js";
8
8
  describe("Graph Builder", () => {
9
- describe("Basic Test Plans", () => {
10
- it("should build a minimal test plan with single endpoint", () => {
11
- const plan = createGraphBuilder({
9
+ describe("Basic Test Monitors", () => {
10
+ it("should build a minimal test monitor with single endpoint", () => {
11
+ const monitor = createGraphBuilder({
12
12
  name: "health-check",
13
13
  frequency: Frequency.every(5).minutes(),
14
14
  })
@@ -21,9 +21,9 @@ describe("Graph Builder", () => {
21
21
  .addEdge(START, "health")
22
22
  .addEdge("health", END)
23
23
  .build();
24
- expect(plan).toEqual({
24
+ expect(monitor).toEqual({
25
25
  name: "health-check",
26
- version: CURRENT_PLAN_VERSION,
26
+ version: CURRENT_MONITOR_VERSION,
27
27
  frequency: { every: 5, unit: "MINUTE" },
28
28
  locations: undefined,
29
29
  nodes: [
@@ -42,8 +42,8 @@ describe("Graph Builder", () => {
42
42
  ],
43
43
  });
44
44
  });
45
- it("should build test plan with multiple HTTP methods", () => {
46
- const plan = createGraphBuilder({
45
+ it("should build test monitor with multiple HTTP methods", () => {
46
+ const monitor = createGraphBuilder({
47
47
  name: "crud-test",
48
48
  frequency: Frequency.every(1).hour(),
49
49
  })
@@ -79,15 +79,15 @@ describe("Graph Builder", () => {
79
79
  .addEdge("update", "delete")
80
80
  .addEdge("delete", END)
81
81
  .build();
82
- expect(plan.nodes).toHaveLength(4);
83
- expect(plan.nodes[0].type).toBe(NodeType.HTTP_REQUEST);
84
- expect(plan.nodes[0].method).toBe(HttpMethod.POST);
85
- expect(plan.nodes[1].method).toBe(HttpMethod.GET);
86
- expect(plan.nodes[2].method).toBe(HttpMethod.PUT);
87
- expect(plan.nodes[3].method).toBe(HttpMethod.DELETE);
82
+ expect(monitor.nodes).toHaveLength(4);
83
+ expect(monitor.nodes[0].type).toBe(NodeType.HTTP_REQUEST);
84
+ expect(monitor.nodes[0].method).toBe(HttpMethod.POST);
85
+ expect(monitor.nodes[1].method).toBe(HttpMethod.GET);
86
+ expect(monitor.nodes[2].method).toBe(HttpMethod.PUT);
87
+ expect(monitor.nodes[3].method).toBe(HttpMethod.DELETE);
88
88
  });
89
89
  it("should include locations when specified", () => {
90
- const plan = createGraphBuilder({
90
+ const monitor = createGraphBuilder({
91
91
  name: "distributed-test",
92
92
  frequency: Frequency.every(10).minutes(),
93
93
  locations: ["us-east-1", "eu-west-1", "ap-south-1"],
@@ -101,12 +101,12 @@ describe("Graph Builder", () => {
101
101
  .addEdge(START, "check")
102
102
  .addEdge("check", END)
103
103
  .build();
104
- expect(plan.locations).toEqual(["us-east-1", "eu-west-1", "ap-south-1"]);
104
+ expect(monitor.locations).toEqual(["us-east-1", "eu-west-1", "ap-south-1"]);
105
105
  });
106
106
  });
107
107
  describe("Endpoints with Headers", () => {
108
108
  it("should build endpoint with literal headers", () => {
109
- const plan = createGraphBuilder({
109
+ const monitor = createGraphBuilder({
110
110
  name: "auth-test",
111
111
  frequency: Frequency.every(5).minutes(),
112
112
  })
@@ -124,14 +124,14 @@ describe("Graph Builder", () => {
124
124
  .addEdge(START, "protected")
125
125
  .addEdge("protected", END)
126
126
  .build();
127
- const endpoint = plan.nodes[0];
127
+ const endpoint = monitor.nodes[0];
128
128
  expect(endpoint.headers).toBeDefined();
129
129
  expect(endpoint.headers["Authorization"]).toBe("Bearer token123");
130
130
  expect(endpoint.headers["Content-Type"]).toBe("application/json");
131
131
  expect(endpoint.headers["X-Custom-Header"]).toBe("custom-value");
132
132
  });
133
133
  it("should build endpoint with secret headers", () => {
134
- const plan = createGraphBuilder({
134
+ const monitor = createGraphBuilder({
135
135
  name: "secret-test",
136
136
  frequency: Frequency.every(5).minutes(),
137
137
  })
@@ -148,7 +148,7 @@ describe("Graph Builder", () => {
148
148
  .addEdge(START, "secured")
149
149
  .addEdge("secured", END)
150
150
  .build();
151
- const endpoint = plan.nodes[0];
151
+ const endpoint = monitor.nodes[0];
152
152
  expect(endpoint.headers["Authorization"]).toEqual({
153
153
  $secret: {
154
154
  provider: "env",
@@ -165,7 +165,7 @@ describe("Graph Builder", () => {
165
165
  });
166
166
  describe("Endpoints with Variables", () => {
167
167
  it("should build endpoint with variable base URL", () => {
168
- const plan = createGraphBuilder({
168
+ const monitor = createGraphBuilder({
169
169
  name: "variable-test",
170
170
  frequency: Frequency.every(5).minutes(),
171
171
  })
@@ -178,7 +178,7 @@ describe("Graph Builder", () => {
178
178
  .addEdge(START, "check")
179
179
  .addEdge("check", END)
180
180
  .build();
181
- const endpoint = plan.nodes[0];
181
+ const endpoint = monitor.nodes[0];
182
182
  expect(endpoint.base).toEqual({
183
183
  $variable: {
184
184
  key: "api-host",
@@ -186,7 +186,7 @@ describe("Graph Builder", () => {
186
186
  });
187
187
  });
188
188
  it("should build endpoint with templated path", () => {
189
- const plan = createGraphBuilder({
189
+ const monitor = createGraphBuilder({
190
190
  name: "template-test",
191
191
  frequency: Frequency.every(5).minutes(),
192
192
  })
@@ -199,7 +199,7 @@ describe("Graph Builder", () => {
199
199
  .addEdge(START, "versioned")
200
200
  .addEdge("versioned", END)
201
201
  .build();
202
- const endpoint = plan.nodes[0];
202
+ const endpoint = monitor.nodes[0];
203
203
  expect(endpoint.path).toEqual({
204
204
  $variable: {
205
205
  key: "api-version",
@@ -210,7 +210,7 @@ describe("Graph Builder", () => {
210
210
  });
211
211
  describe("Wait Nodes", () => {
212
212
  it("should build wait node with milliseconds", () => {
213
- const plan = createGraphBuilder({
213
+ const monitor = createGraphBuilder({
214
214
  name: "wait-test",
215
215
  frequency: Frequency.every(5).minutes(),
216
216
  })
@@ -218,14 +218,14 @@ describe("Graph Builder", () => {
218
218
  .addEdge(START, "pause")
219
219
  .addEdge("pause", END)
220
220
  .build();
221
- expect(plan.nodes[0]).toEqual({
221
+ expect(monitor.nodes[0]).toEqual({
222
222
  id: "pause",
223
223
  type: NodeType.WAIT,
224
224
  duration_ms: 2000,
225
225
  });
226
226
  });
227
227
  it("should build wait node with seconds", () => {
228
- const plan = createGraphBuilder({
228
+ const monitor = createGraphBuilder({
229
229
  name: "wait-seconds",
230
230
  frequency: Frequency.every(5).minutes(),
231
231
  })
@@ -233,14 +233,14 @@ describe("Graph Builder", () => {
233
233
  .addEdge(START, "pause")
234
234
  .addEdge("pause", END)
235
235
  .build();
236
- expect(plan.nodes[0]).toEqual({
236
+ expect(monitor.nodes[0]).toEqual({
237
237
  id: "pause",
238
238
  type: NodeType.WAIT,
239
239
  duration_ms: 5000,
240
240
  });
241
241
  });
242
242
  it("should build wait node with minutes", () => {
243
- const plan = createGraphBuilder({
243
+ const monitor = createGraphBuilder({
244
244
  name: "wait-minutes",
245
245
  frequency: Frequency.every(5).minutes(),
246
246
  })
@@ -248,7 +248,7 @@ describe("Graph Builder", () => {
248
248
  .addEdge(START, "pause")
249
249
  .addEdge("pause", END)
250
250
  .build();
251
- expect(plan.nodes[0]).toEqual({
251
+ expect(monitor.nodes[0]).toEqual({
252
252
  id: "pause",
253
253
  type: NodeType.WAIT,
254
254
  duration_ms: 120000,
@@ -257,7 +257,7 @@ describe("Graph Builder", () => {
257
257
  });
258
258
  describe("Assertion Nodes", () => {
259
259
  it("should build status assertion", () => {
260
- const plan = createGraphBuilder({
260
+ const monitor = createGraphBuilder({
261
261
  name: "status-assertion",
262
262
  frequency: Frequency.every(5).minutes(),
263
263
  })
@@ -282,7 +282,7 @@ describe("Graph Builder", () => {
282
282
  .addEdge("call", "checks")
283
283
  .addEdge("checks", END)
284
284
  .build();
285
- const assertionNode = plan.nodes[1];
285
+ const assertionNode = monitor.nodes[1];
286
286
  expect(assertionNode.type).toBe(NodeType.ASSERTION);
287
287
  expect(assertionNode.assertions).toHaveLength(1);
288
288
  expect(assertionNode.assertions[0]).toEqual({
@@ -296,7 +296,7 @@ describe("Graph Builder", () => {
296
296
  });
297
297
  });
298
298
  it("should build JSON body assertion", () => {
299
- const plan = createGraphBuilder({
299
+ const monitor = createGraphBuilder({
300
300
  name: "body-assertion",
301
301
  frequency: Frequency.every(5).minutes(),
302
302
  })
@@ -323,7 +323,7 @@ describe("Graph Builder", () => {
323
323
  .addEdge("call", "checks")
324
324
  .addEdge("checks", END)
325
325
  .build();
326
- const assertionNode = plan.nodes[1];
326
+ const assertionNode = monitor.nodes[1];
327
327
  expect(assertionNode.assertions[0]).toEqual({
328
328
  nodeId: "call",
329
329
  subject: AssertionSubject.BODY,
@@ -337,7 +337,7 @@ describe("Graph Builder", () => {
337
337
  });
338
338
  });
339
339
  it("should build multiple assertions", () => {
340
- const plan = createGraphBuilder({
340
+ const monitor = createGraphBuilder({
341
341
  name: "multi-assertion",
342
342
  frequency: Frequency.every(5).minutes(),
343
343
  })
@@ -381,13 +381,13 @@ describe("Graph Builder", () => {
381
381
  .addEdge("call", "checks")
382
382
  .addEdge("checks", END)
383
383
  .build();
384
- const assertionNode = plan.nodes[1];
384
+ const assertionNode = monitor.nodes[1];
385
385
  expect(assertionNode.assertions).toHaveLength(3);
386
386
  });
387
387
  });
388
388
  describe("Complex Flows", () => {
389
389
  it("should build sequential flow with waits and assertions", () => {
390
- const plan = createGraphBuilder({
390
+ const monitor = createGraphBuilder({
391
391
  name: "complex-flow",
392
392
  frequency: Frequency.every(15).minutes(),
393
393
  })
@@ -422,9 +422,9 @@ describe("Graph Builder", () => {
422
422
  .addEdge("poll", "check")
423
423
  .addEdge("check", END)
424
424
  .build();
425
- expect(plan.nodes).toHaveLength(4);
426
- expect(plan.edges).toHaveLength(5);
427
- expect(plan.nodes.map((n) => n.id)).toEqual([
425
+ expect(monitor.nodes).toHaveLength(4);
426
+ expect(monitor.edges).toHaveLength(5);
427
+ expect(monitor.nodes.map((n) => n.id)).toEqual([
428
428
  "create",
429
429
  "wait1",
430
430
  "poll",
@@ -432,7 +432,7 @@ describe("Graph Builder", () => {
432
432
  ]);
433
433
  });
434
434
  it("should build test with different response formats", () => {
435
- const plan = createGraphBuilder({
435
+ const monitor = createGraphBuilder({
436
436
  name: "format-test",
437
437
  frequency: Frequency.every(5).minutes(),
438
438
  })
@@ -452,13 +452,13 @@ describe("Graph Builder", () => {
452
452
  .addEdge("json", "xml")
453
453
  .addEdge("xml", END)
454
454
  .build();
455
- expect(plan.nodes[0].response_format).toBe(ResponseFormat.JSON);
456
- expect(plan.nodes[1].response_format).toBe(ResponseFormat.XML);
455
+ expect(monitor.nodes[0].response_format).toBe(ResponseFormat.JSON);
456
+ expect(monitor.nodes[1].response_format).toBe(ResponseFormat.XML);
457
457
  });
458
458
  });
459
459
  describe("Edge Configuration", () => {
460
460
  it("should create correct edges for linear flow", () => {
461
- const plan = createGraphBuilder({
461
+ const monitor = createGraphBuilder({
462
462
  name: "linear",
463
463
  frequency: Frequency.every(5).minutes(),
464
464
  })
@@ -485,7 +485,7 @@ describe("Graph Builder", () => {
485
485
  .addEdge("step2", "step3")
486
486
  .addEdge("step3", END)
487
487
  .build();
488
- expect(plan.edges).toEqual([
488
+ expect(monitor.edges).toEqual([
489
489
  { from: START, to: "step1" },
490
490
  { from: "step1", to: "step2" },
491
491
  { from: "step2", to: "step3" },
@@ -495,7 +495,7 @@ describe("Graph Builder", () => {
495
495
  });
496
496
  describe("Frequency Configurations", () => {
497
497
  it("should support minute frequency", () => {
498
- const plan = createGraphBuilder({
498
+ const monitor = createGraphBuilder({
499
499
  name: "test",
500
500
  frequency: Frequency.every(1).minute(),
501
501
  })
@@ -508,10 +508,10 @@ describe("Graph Builder", () => {
508
508
  .addEdge(START, "check")
509
509
  .addEdge("check", END)
510
510
  .build();
511
- expect(plan.frequency).toEqual({ every: 1, unit: "MINUTE" });
511
+ expect(monitor.frequency).toEqual({ every: 1, unit: "MINUTE" });
512
512
  });
513
513
  it("should support hour frequency", () => {
514
- const plan = createGraphBuilder({
514
+ const monitor = createGraphBuilder({
515
515
  name: "test",
516
516
  frequency: Frequency.every(2).hours(),
517
517
  })
@@ -524,10 +524,10 @@ describe("Graph Builder", () => {
524
524
  .addEdge(START, "check")
525
525
  .addEdge("check", END)
526
526
  .build();
527
- expect(plan.frequency).toEqual({ every: 2, unit: "HOUR" });
527
+ expect(monitor.frequency).toEqual({ every: 2, unit: "HOUR" });
528
528
  });
529
529
  it("should support day frequency", () => {
530
- const plan = createGraphBuilder({
530
+ const monitor = createGraphBuilder({
531
531
  name: "test",
532
532
  frequency: Frequency.every(1).day(),
533
533
  })
@@ -540,12 +540,12 @@ describe("Graph Builder", () => {
540
540
  .addEdge(START, "check")
541
541
  .addEdge("check", END)
542
542
  .build();
543
- expect(plan.frequency).toEqual({ every: 1, unit: "DAY" });
543
+ expect(monitor.frequency).toEqual({ every: 1, unit: "DAY" });
544
544
  });
545
545
  });
546
546
  describe("Request Body", () => {
547
547
  it("should include request body in POST request", () => {
548
- const plan = createGraphBuilder({
548
+ const monitor = createGraphBuilder({
549
549
  name: "post-test",
550
550
  frequency: Frequency.every(5).minutes(),
551
551
  })
@@ -566,7 +566,7 @@ describe("Graph Builder", () => {
566
566
  .addEdge(START, "create")
567
567
  .addEdge("create", END)
568
568
  .build();
569
- const endpoint = plan.nodes[0];
569
+ const endpoint = monitor.nodes[0];
570
570
  expect(endpoint.body).toEqual({
571
571
  name: "John Doe",
572
572
  email: "john@example.com",
@@ -577,7 +577,7 @@ describe("Graph Builder", () => {
577
577
  });
578
578
  });
579
579
  it("should support secrets in request body", () => {
580
- const plan = createGraphBuilder({
580
+ const monitor = createGraphBuilder({
581
581
  name: "secret-body-test",
582
582
  frequency: Frequency.every(5).minutes(),
583
583
  })
@@ -594,7 +594,7 @@ describe("Graph Builder", () => {
594
594
  .addEdge(START, "create")
595
595
  .addEdge("create", END)
596
596
  .build();
597
- const endpoint = plan.nodes[0];
597
+ const endpoint = monitor.nodes[0];
598
598
  expect(endpoint.body.apiKey).toEqual({
599
599
  $secret: {
600
600
  provider: "env",