@ripplo/testing 0.0.8 → 0.0.10

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.
@@ -1,10 +1,14 @@
1
1
  import { z } from 'zod';
2
2
  import { S as Step } from './step-DLfkKI3V.js';
3
3
 
4
+ declare const DEFAULT_WATCH_PATHS: ReadonlyArray<string>;
5
+ declare const DEFAULT_IGNORE_PATHS: ReadonlyArray<string>;
4
6
  declare const dslConfigSchema: z.ZodObject<{
5
7
  appUrl: z.ZodString;
8
+ ignorePaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
9
  preconditionsUrl: z.ZodString;
7
10
  projectId: z.ZodString;
11
+ watchPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
12
  webhookSecret: z.ZodString;
9
13
  }, z.core.$strip>;
10
14
  type DslConfig = z.infer<typeof dslConfigSchema>;
@@ -130,4 +134,4 @@ interface RipploBuilder {
130
134
  }
131
135
  declare function createRipplo(rawConfig: DslConfig): RipploBuilder;
132
136
 
133
- export { type CookieEntry as C, type DslConfig as D, type Precondition as P, type RipploBuilder as R, type SetupContext as S, type TeardownContext as T, type CookieOptions as a, type PreconditionDeps as b, type PreconditionImpl as c, type PreconditionRecord as d, type ResolveDeps as e, createRipplo as f };
137
+ export { type CookieEntry as C, DEFAULT_IGNORE_PATHS as D, type Precondition as P, type RipploBuilder as R, type SetupContext as S, type TeardownContext as T, type CookieOptions as a, DEFAULT_WATCH_PATHS as b, type DslConfig as c, type PreconditionDeps as d, type PreconditionImpl as e, type PreconditionRecord as f, type ResolveDeps as g, createRipplo as h };
@@ -1,9 +1,31 @@
1
1
  // src/types.ts
2
2
  import { z } from "zod";
3
+ var DEFAULT_WATCH_PATHS = [
4
+ "src/**",
5
+ "app/**",
6
+ "apps/**",
7
+ "pages/**",
8
+ "routes/**",
9
+ "components/**"
10
+ ];
11
+ var DEFAULT_IGNORE_PATHS = [
12
+ "**/*.gen.*",
13
+ "**/generated/**",
14
+ "**/*.d.ts",
15
+ "**/*.test.*",
16
+ "**/*.spec.*",
17
+ "**/node_modules/**",
18
+ "**/dist/**",
19
+ "**/build/**",
20
+ ".ripplo/**",
21
+ "**/*.md"
22
+ ];
3
23
  var dslConfigSchema = z.object({
4
24
  appUrl: z.string(),
25
+ ignorePaths: z.array(z.string()).optional(),
5
26
  preconditionsUrl: z.string(),
6
27
  projectId: z.string(),
28
+ watchPaths: z.array(z.string()).optional(),
7
29
  webhookSecret: z.string()
8
30
  });
9
31
  function readTestValue(value) {
@@ -216,6 +238,8 @@ function buildSetCookieHeader(cookie) {
216
238
  }
217
239
 
218
240
  export {
241
+ DEFAULT_WATCH_PATHS,
242
+ DEFAULT_IGNORE_PATHS,
219
243
  dslConfigSchema,
220
244
  readPreconditionName,
221
245
  createEngine,
@@ -8,9 +8,16 @@ function compile(ripplo) {
8
8
  const preconditionDefs = ripplo.getPreconditions();
9
9
  const testDefs = ripplo.getTests();
10
10
  validateUniqueIds(testDefs);
11
- const tests = testDefs.map((def) => compileTest(def));
12
- const graph = compileGraph(preconditionDefs, testDefs);
13
- return { config: ripplo.getConfig(), graph, tests };
11
+ const preconditions = {};
12
+ preconditionDefs.forEach((def) => {
13
+ preconditions[def.name] = {
14
+ depends: [...def.dependsOn],
15
+ description: def.description,
16
+ returns: [...def.returns]
17
+ };
18
+ });
19
+ const tests = testDefs.map((def) => compileTest(def, preconditionDefs));
20
+ return { config: ripplo.getConfig(), preconditions, tests };
14
21
  }
15
22
  function validateUniqueIds(defs) {
16
23
  const seen = /* @__PURE__ */ new Map();
@@ -22,7 +29,7 @@ function validateUniqueIds(defs) {
22
29
  seen.set(def.id, def.name);
23
30
  });
24
31
  }
25
- function compileTest(def) {
32
+ function compileTest(def, preconditionDefs) {
26
33
  const slug = def.id;
27
34
  const { accessedKeys, vars } = buildPlaceholderVars(def.requiresKeys);
28
35
  const startsAtUrl = def.startsAtFn == null ? void 0 : def.startsAtFn(vars);
@@ -36,12 +43,15 @@ function compileTest(def) {
36
43
  "Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()"
37
44
  );
38
45
  }
46
+ const resolvedPreconditions = resolveDependencyChain(def.requires, preconditionDefs);
39
47
  return {
40
48
  additionalChecks: [],
41
49
  description: def.description,
42
50
  expectedOutcome: def.expectedOutcome,
43
51
  implemented: def.implemented,
44
52
  name: def.name,
53
+ preconditions: resolvedPreconditions,
54
+ requiresKeys: { ...def.requiresKeys },
45
55
  slug,
46
56
  spec,
47
57
  warnings
@@ -89,35 +99,6 @@ function compileNode(step, id, next) {
89
99
  const { label, node: raw } = readStep(step);
90
100
  return { ...raw, id, label, next };
91
101
  }
92
- function compileGraph(preconditionDefs, testDefs) {
93
- const preconditions = {};
94
- preconditionDefs.forEach((def) => {
95
- preconditions[def.name] = {
96
- depends: [...def.dependsOn],
97
- description: def.description,
98
- returns: [...def.returns]
99
- };
100
- });
101
- const states = {};
102
- const edges = [];
103
- testDefs.forEach((def) => {
104
- if (!def.implemented || def.startsAtFn == null) {
105
- return;
106
- }
107
- const resolved = resolveDependencyChain(def.requires, preconditionDefs);
108
- const { vars } = buildPlaceholderVars(def.requiresKeys);
109
- const route = def.startsAtFn(vars);
110
- const stateId = deriveStateId(resolved, route);
111
- states[stateId] = { preconditions: [...resolved], route };
112
- edges.push({
113
- from: stateId,
114
- requiresKeys: def.requiresKeys,
115
- to: stateId,
116
- workflow: def.id
117
- });
118
- });
119
- return { edges, preconditions, states };
120
- }
121
102
  function resolveDependencyChain(requires, preconditionDefs) {
122
103
  const defsByName = new Map(preconditionDefs.map((d) => [d.name, d]));
123
104
  const resolved = [];
@@ -137,13 +118,6 @@ function resolveDependencyChain(requires, preconditionDefs) {
137
118
  });
138
119
  return resolved;
139
120
  }
140
- function deriveStateId(preconditions, route) {
141
- const sorted = preconditions.toSorted((a, b) => a.localeCompare(b));
142
- return slugify(`${sorted.join("-")}-${route}`);
143
- }
144
- function slugify(input) {
145
- return input.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/^-|-$/g, "");
146
- }
147
121
 
148
122
  export {
149
123
  compile
@@ -1,11 +1,11 @@
1
- import { StateGraph, WorkflowSpec } from '@ripplo/spec';
2
- import { D as DslConfig, R as RipploBuilder } from './builder-DTWMrbuv.js';
1
+ import { Precondition, WorkflowSpec } from '@ripplo/spec';
2
+ import { c as DslConfig, R as RipploBuilder } from './builder-1kySbit_.js';
3
3
  import 'zod';
4
4
  import './step-DLfkKI3V.js';
5
5
 
6
6
  interface CompileResult {
7
7
  readonly config: DslConfig;
8
- readonly graph: StateGraph;
8
+ readonly preconditions: Record<string, Precondition>;
9
9
  readonly tests: ReadonlyArray<CompiledTest>;
10
10
  }
11
11
  interface CompiledTest {
@@ -14,6 +14,8 @@ interface CompiledTest {
14
14
  readonly expectedOutcome: string;
15
15
  readonly implemented: boolean;
16
16
  readonly name: string;
17
+ readonly preconditions: ReadonlyArray<string>;
18
+ readonly requiresKeys: Record<string, string>;
17
19
  readonly slug: string;
18
20
  readonly spec: WorkflowSpec;
19
21
  readonly warnings: ReadonlyArray<string>;
package/dist/compiler.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compile
3
- } from "./chunk-AQ52MYXE.js";
3
+ } from "./chunk-LEIKZ6BE.js";
4
4
  import "./chunk-MGATMMCZ.js";
5
5
  export {
6
6
  compile
package/dist/express.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Router } from 'express';
2
- import { R as RipploBuilder } from './builder-DTWMrbuv.js';
2
+ import { R as RipploBuilder } from './builder-1kySbit_.js';
3
3
  import 'zod';
4
4
  import './step-DLfkKI3V.js';
5
5
  import '@ripplo/spec';
package/dist/express.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  serializeCookie,
5
5
  teardownRequestSchema,
6
6
  verifyWebhookSignature
7
- } from "./chunk-KWUKVAGI.js";
7
+ } from "./chunk-7ETQVVAA.js";
8
8
 
9
9
  // src/adapters/express.ts
10
10
  import { Router, json } from "express";
package/dist/fastify.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FastifyInstance } from 'fastify';
2
- import { R as RipploBuilder } from './builder-DTWMrbuv.js';
2
+ import { R as RipploBuilder } from './builder-1kySbit_.js';
3
3
  import 'zod';
4
4
  import './step-DLfkKI3V.js';
5
5
  import '@ripplo/spec';
package/dist/fastify.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  serializeCookie,
6
6
  teardownRequestSchema,
7
7
  verifyWebhookSignature
8
- } from "./chunk-KWUKVAGI.js";
8
+ } from "./chunk-7ETQVVAA.js";
9
9
 
10
10
  // src/adapters/fastify.ts
11
11
  function registerFastifyHandler({
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CookieEntry, R as RipploBuilder } from './builder-DTWMrbuv.js';
2
- export { a as CookieOptions, D as DslConfig, P as Precondition, b as PreconditionDeps, c as PreconditionImpl, d as PreconditionRecord, e as ResolveDeps, S as SetupContext, T as TeardownContext, f as createRipplo } from './builder-DTWMrbuv.js';
1
+ import { C as CookieEntry, R as RipploBuilder } from './builder-1kySbit_.js';
2
+ export { a as CookieOptions, D as DEFAULT_IGNORE_PATHS, b as DEFAULT_WATCH_PATHS, c as DslConfig, P as Precondition, d as PreconditionDeps, e as PreconditionImpl, f as PreconditionRecord, g as ResolveDeps, S as SetupContext, T as TeardownContext, h as createRipplo } from './builder-1kySbit_.js';
3
3
  import { CompileResult } from './compiler.js';
4
4
  export { CompiledTest, compile } from './compiler.js';
5
5
  export { D as DslNodeInput } from './step-DLfkKI3V.js';
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import {
2
2
  compile
3
- } from "./chunk-AQ52MYXE.js";
3
+ } from "./chunk-LEIKZ6BE.js";
4
4
  import "./chunk-MGATMMCZ.js";
5
5
  import {
6
+ DEFAULT_IGNORE_PATHS,
7
+ DEFAULT_WATCH_PATHS,
6
8
  buildSetCookieHeader,
7
9
  createEngine,
8
10
  dslConfigSchema,
9
11
  readPreconditionName,
10
12
  serializeCookie,
11
13
  verifyWebhookSignature
12
- } from "./chunk-KWUKVAGI.js";
14
+ } from "./chunk-7ETQVVAA.js";
13
15
 
14
16
  // src/builder.ts
15
17
  function createRipplo(rawConfig) {
@@ -637,6 +639,8 @@ var RULES = [
637
639
  expectedOutcomeKeywordCoverage
638
640
  ];
639
641
  export {
642
+ DEFAULT_IGNORE_PATHS,
643
+ DEFAULT_WATCH_PATHS,
640
644
  buildSetCookieHeader,
641
645
  compile,
642
646
  createEngine,
@@ -1,33 +1,21 @@
1
1
  import { Codec } from '@ripplo/spec';
2
2
  import { z } from 'zod';
3
3
  import { CompileResult } from './compiler.js';
4
- import './builder-DTWMrbuv.js';
4
+ import './builder-1kySbit_.js';
5
5
  import './step-DLfkKI3V.js';
6
6
 
7
7
  declare const LOCKFILE_RELATIVE_PATH = ".ripplo/ripplo.lock";
8
8
  declare const lockfileBodySchema: z.ZodObject<{
9
- graph: z.ZodObject<{
10
- edges: z.ZodArray<z.ZodObject<{
11
- from: z.ZodString;
12
- requiresKeys: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
- to: z.ZodString;
14
- workflow: z.ZodString;
15
- }, z.core.$strip>>;
16
- preconditions: z.ZodRecord<z.ZodString, z.ZodObject<{
17
- depends: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
- description: z.ZodString;
19
- returns: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
- }, z.core.$strip>>;
21
- states: z.ZodRecord<z.ZodString, z.ZodObject<{
22
- preconditions: z.ZodArray<z.ZodString>;
23
- route: z.ZodString;
24
- }, z.core.$strip>>;
25
- }, z.core.$strip>;
26
- tests: z.ZodArray<z.ZodObject<{
9
+ preconditions: z.ZodRecord<z.ZodString, z.ZodObject<{
10
+ depends: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
11
  description: z.ZodString;
12
+ returns: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ }, z.core.$strip>>;
14
+ tests: z.ZodArray<z.ZodObject<{
28
15
  expectedOutcome: z.ZodString;
29
- implemented: z.ZodBoolean;
30
16
  name: z.ZodString;
17
+ preconditions: z.ZodArray<z.ZodString>;
18
+ requiresKeys: z.ZodRecord<z.ZodString, z.ZodString>;
31
19
  slug: z.ZodString;
32
20
  spec: z.ZodObject<{
33
21
  entryNode: z.ZodString;
package/dist/lockfile.js CHANGED
@@ -124,84 +124,39 @@ function migrateStep(state, data, version) {
124
124
  }
125
125
 
126
126
  // ../spec/src/codecs.ts
127
- import { z as z11 } from "zod";
128
-
129
- // ../spec/src/graph.ts
130
- import { z as z5 } from "zod";
131
-
132
- // ../spec/src/edge.ts
133
- import { z as z2 } from "zod";
134
- var edgeSchema = z2.object({
135
- from: z2.string().min(1).describe("Key of the source state in the states record"),
136
- requiresKeys: z2.record(z2.string(), z2.string()).optional().describe(
137
- "Maps workflow variable namespace to precondition name. Used by the runtime to namespace batch precondition data into dot-namespaced variables (e.g. { project: 'data:project' } maps projectId \u2192 project.projectId)."
138
- ),
139
- to: z2.string().min(1).describe("Key of the target state in the states record"),
140
- workflow: z2.string().min(1).describe(
141
- "Filename (without .json) of the workflow in .ripplo/workflows/ that executes this edge"
142
- )
143
- }).describe("A directed edge between two states, executed by a workflow");
127
+ import { z as z8 } from "zod";
144
128
 
145
129
  // ../spec/src/precondition.ts
146
- import { z as z3 } from "zod";
147
- var preconditionSchema = z3.object({
148
- depends: z3.array(z3.string().min(1)).optional().describe(
130
+ import { z as z2 } from "zod";
131
+ var preconditionSchema = z2.object({
132
+ depends: z2.array(z2.string().min(1)).optional().describe(
149
133
  "Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."
150
134
  ),
151
- description: z3.string().min(1).describe("Human-readable description of what this precondition ensures"),
152
- returns: z3.array(z3.string().min(1)).optional().describe(
135
+ description: z2.string().min(1).describe("Human-readable description of what this precondition ensures"),
136
+ returns: z2.array(z2.string().min(1)).optional().describe(
153
137
  "Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition."
154
138
  )
155
139
  }).describe("A named precondition declared at the graph level. States reference these by name.");
156
140
 
157
- // ../spec/src/state.ts
158
- import { z as z4 } from "zod";
159
- var stateNodeSchema = z4.object({
160
- preconditions: z4.array(z4.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),
161
- route: z4.string().min(1).describe(
162
- "URL pattern with {{placeholders}} for dynamic segments, e.g. '/projects/{{projectId}}/settings'"
163
- )
164
- }).describe(
165
- "A distinct application state \u2014 a unique combination of location, auth context, and data conditions"
166
- );
167
-
168
- // ../spec/src/graph.ts
169
- var MAX_STATES = 1e3;
170
- var MAX_EDGES = 5e3;
171
- var MAX_PRECONDITIONS = 500;
172
- var stateGraphSchema = z5.object({
173
- edges: z5.array(edgeSchema).max(MAX_EDGES).describe("Directed edges between states, each executed by a workflow"),
174
- preconditions: z5.record(z5.string().max(200), preconditionSchema).refine(
175
- (obj) => Object.keys(obj).length <= MAX_PRECONDITIONS,
176
- `Graph has more than ${String(MAX_PRECONDITIONS)} preconditions`
177
- ).describe(
178
- "Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."
179
- ),
180
- states: z5.record(z5.string().max(200), stateNodeSchema).refine(
181
- (obj) => Object.keys(obj).length <= MAX_STATES,
182
- `Graph has more than ${String(MAX_STATES)} states`
183
- ).describe("States keyed by stable ID (kebab-case)")
184
- }).describe("Ripplo State Graph \u2014 models application states, edges, and executable preconditions");
185
-
186
141
  // ../spec/src/schema.ts
187
- import { z as z10 } from "zod";
142
+ import { z as z7 } from "zod";
188
143
 
189
144
  // ../spec/src/locators.ts
190
- import { z as z6 } from "zod";
191
- var testIdLocator = z6.object({
192
- by: z6.literal("testId"),
193
- value: z6.string().min(1)
145
+ import { z as z3 } from "zod";
146
+ var testIdLocator = z3.object({
147
+ by: z3.literal("testId"),
148
+ value: z3.string().min(1)
194
149
  });
195
- var roleLocator = z6.object({
196
- by: z6.literal("role"),
197
- name: z6.string().optional(),
198
- role: z6.string().min(1)
150
+ var roleLocator = z3.object({
151
+ by: z3.literal("role"),
152
+ name: z3.string().optional(),
153
+ role: z3.string().min(1)
199
154
  });
200
- var locatorSchema = z6.discriminatedUnion("by", [testIdLocator, roleLocator]);
155
+ var locatorSchema = z3.discriminatedUnion("by", [testIdLocator, roleLocator]);
201
156
 
202
157
  // ../spec/src/operators.ts
203
- import { z as z7 } from "zod";
204
- var comparisonOperator = z7.enum([
158
+ import { z as z4 } from "zod";
159
+ var comparisonOperator = z4.enum([
205
160
  "equals",
206
161
  "notEquals",
207
162
  "contains",
@@ -209,7 +164,7 @@ var comparisonOperator = z7.enum([
209
164
  "endsWith",
210
165
  "matches"
211
166
  ]);
212
- var numericOperator = z7.enum([
167
+ var numericOperator = z4.enum([
213
168
  "equals",
214
169
  "notEquals",
215
170
  "greaterThan",
@@ -219,241 +174,241 @@ var numericOperator = z7.enum([
219
174
  ]);
220
175
 
221
176
  // ../spec/src/value-ref.ts
222
- import { z as z8 } from "zod";
223
- var staticValueSchema = z8.object({
224
- type: z8.literal("static"),
225
- value: z8.union([z8.string(), z8.number(), z8.boolean()])
177
+ import { z as z5 } from "zod";
178
+ var staticValueSchema = z5.object({
179
+ type: z5.literal("static"),
180
+ value: z5.union([z5.string(), z5.number(), z5.boolean()])
226
181
  });
227
- var variableRefSchema = z8.object({
228
- name: z8.string().min(1),
229
- type: z8.literal("variable")
182
+ var variableRefSchema = z5.object({
183
+ name: z5.string().min(1),
184
+ type: z5.literal("variable")
230
185
  });
231
- var valueRefSchema = z8.discriminatedUnion("type", [staticValueSchema, variableRefSchema]);
232
- var stringValueRefSchema = z8.discriminatedUnion("type", [
233
- z8.object({ type: z8.literal("static"), value: z8.string() }),
186
+ var valueRefSchema = z5.discriminatedUnion("type", [staticValueSchema, variableRefSchema]);
187
+ var stringValueRefSchema = z5.discriminatedUnion("type", [
188
+ z5.object({ type: z5.literal("static"), value: z5.string() }),
234
189
  variableRefSchema
235
190
  ]);
236
- var numericValueRefSchema = z8.discriminatedUnion("type", [
237
- z8.object({ type: z8.literal("static"), value: z8.number().int().nonnegative() }),
191
+ var numericValueRefSchema = z5.discriminatedUnion("type", [
192
+ z5.object({ type: z5.literal("static"), value: z5.number().int().nonnegative() }),
238
193
  variableRefSchema
239
194
  ]);
240
195
 
241
196
  // ../spec/src/variables.ts
242
- import { z as z9 } from "zod";
243
- var variableDefSchema = z9.discriminatedUnion("type", [
244
- z9.object({
245
- default: z9.string().optional(),
246
- type: z9.literal("string")
197
+ import { z as z6 } from "zod";
198
+ var variableDefSchema = z6.discriminatedUnion("type", [
199
+ z6.object({
200
+ default: z6.string().optional(),
201
+ type: z6.literal("string")
247
202
  }),
248
- z9.object({
249
- default: z9.number().optional(),
250
- type: z9.literal("number")
203
+ z6.object({
204
+ default: z6.number().optional(),
205
+ type: z6.literal("number")
251
206
  }),
252
- z9.object({
253
- default: z9.boolean().optional(),
254
- type: z9.literal("boolean")
207
+ z6.object({
208
+ default: z6.boolean().optional(),
209
+ type: z6.literal("boolean")
255
210
  }),
256
- z9.object({
257
- key: z9.string().min(1),
258
- type: z9.literal("env")
211
+ z6.object({
212
+ key: z6.string().min(1),
213
+ type: z6.literal("env")
259
214
  })
260
215
  ]);
261
216
 
262
217
  // ../spec/src/schema.ts
263
218
  var nodeBase = {
264
- comment: z10.string().max(2e3).optional(),
265
- id: z10.string().min(1).max(200),
266
- label: z10.string().max(500).optional(),
267
- next: z10.string().max(200).optional(),
268
- timeout: z10.number().int().positive().optional()
219
+ comment: z7.string().max(2e3).optional(),
220
+ id: z7.string().min(1).max(200),
221
+ label: z7.string().max(500).optional(),
222
+ next: z7.string().max(200).optional(),
223
+ timeout: z7.number().int().positive().optional()
269
224
  };
270
225
  var MAX_NODES_PER_WORKFLOW = 500;
271
- var gotoNode = z10.object({
226
+ var gotoNode = z7.object({
272
227
  ...nodeBase,
273
- type: z10.literal("goto"),
228
+ type: z7.literal("goto"),
274
229
  url: stringValueRefSchema
275
230
  });
276
- var clickNode = z10.object({ ...nodeBase, locator: locatorSchema, type: z10.literal("click") });
277
- var fillNode = z10.object({
231
+ var clickNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("click") });
232
+ var fillNode = z7.object({
278
233
  ...nodeBase,
279
234
  locator: locatorSchema,
280
- type: z10.literal("fill"),
235
+ type: z7.literal("fill"),
281
236
  value: stringValueRefSchema
282
237
  });
283
- var selectNode = z10.object({
238
+ var selectNode = z7.object({
284
239
  ...nodeBase,
285
240
  locator: locatorSchema,
286
- type: z10.literal("select"),
241
+ type: z7.literal("select"),
287
242
  value: stringValueRefSchema
288
243
  });
289
- var hoverNode = z10.object({ ...nodeBase, locator: locatorSchema, type: z10.literal("hover") });
290
- var pressNode = z10.object({
244
+ var hoverNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("hover") });
245
+ var pressNode = z7.object({
291
246
  ...nodeBase,
292
- key: z10.string().min(1),
247
+ key: z7.string().min(1),
293
248
  locator: locatorSchema.optional(),
294
- type: z10.literal("press")
249
+ type: z7.literal("press")
295
250
  });
296
- var checkNode = z10.object({ ...nodeBase, locator: locatorSchema, type: z10.literal("check") });
297
- var uncheckNode = z10.object({ ...nodeBase, locator: locatorSchema, type: z10.literal("uncheck") });
298
- var setViewportNode = z10.object({
251
+ var checkNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("check") });
252
+ var uncheckNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("uncheck") });
253
+ var setViewportNode = z7.object({
299
254
  ...nodeBase,
300
- height: z10.number().int().positive(),
301
- type: z10.literal("setViewport"),
302
- width: z10.number().int().positive()
255
+ height: z7.number().int().positive(),
256
+ type: z7.literal("setViewport"),
257
+ width: z7.number().int().positive()
303
258
  });
304
- var failNode = z10.object({ ...nodeBase, message: z10.string().min(1), type: z10.literal("fail") });
305
- var setVariableNode = z10.object({
259
+ var failNode = z7.object({ ...nodeBase, message: z7.string().min(1), type: z7.literal("fail") });
260
+ var setVariableNode = z7.object({
306
261
  ...nodeBase,
307
- type: z10.literal("setVariable"),
262
+ type: z7.literal("setVariable"),
308
263
  value: valueRefSchema,
309
- variable: z10.string().min(1)
264
+ variable: z7.string().min(1)
310
265
  });
311
- var extractTextNode = z10.object({
266
+ var extractTextNode = z7.object({
312
267
  ...nodeBase,
313
268
  locator: locatorSchema,
314
- type: z10.literal("extractText"),
315
- variable: z10.string().min(1)
269
+ type: z7.literal("extractText"),
270
+ variable: z7.string().min(1)
316
271
  });
317
- var uploadNode = z10.object({
272
+ var uploadNode = z7.object({
318
273
  ...nodeBase,
319
- files: z10.array(z10.string()).min(1),
274
+ files: z7.array(z7.string()).min(1),
320
275
  locator: locatorSchema,
321
- type: z10.literal("upload")
276
+ type: z7.literal("upload")
322
277
  });
323
- var dblclickNode = z10.object({
278
+ var dblclickNode = z7.object({
324
279
  ...nodeBase,
325
280
  locator: locatorSchema,
326
- type: z10.literal("dblclick")
281
+ type: z7.literal("dblclick")
327
282
  });
328
- var dragNode = z10.object({
283
+ var dragNode = z7.object({
329
284
  ...nodeBase,
330
285
  source: locatorSchema,
331
286
  target: locatorSchema,
332
- type: z10.literal("drag")
287
+ type: z7.literal("drag")
333
288
  });
334
- var scrollIntoViewNode = z10.object({
289
+ var scrollIntoViewNode = z7.object({
335
290
  ...nodeBase,
336
291
  locator: locatorSchema,
337
- type: z10.literal("scrollIntoView")
292
+ type: z7.literal("scrollIntoView")
338
293
  });
339
- var typeNode = z10.object({
294
+ var typeNode = z7.object({
340
295
  ...nodeBase,
341
296
  locator: locatorSchema,
342
- type: z10.literal("type"),
297
+ type: z7.literal("type"),
343
298
  value: stringValueRefSchema
344
299
  });
345
- var focusNode = z10.object({
300
+ var focusNode = z7.object({
346
301
  ...nodeBase,
347
302
  locator: locatorSchema,
348
- type: z10.literal("focus")
303
+ type: z7.literal("focus")
349
304
  });
350
- var clearNode = z10.object({ ...nodeBase, locator: locatorSchema, type: z10.literal("clear") });
351
- var rightClickNode = z10.object({
305
+ var clearNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("clear") });
306
+ var rightClickNode = z7.object({
352
307
  ...nodeBase,
353
308
  locator: locatorSchema,
354
- type: z10.literal("rightClick")
309
+ type: z7.literal("rightClick")
355
310
  });
356
- var handleDialogNode = z10.object({
311
+ var handleDialogNode = z7.object({
357
312
  ...nodeBase,
358
- action: z10.enum(["accept", "dismiss"]),
359
- promptText: z10.string().optional(),
360
- type: z10.literal("handleDialog")
313
+ action: z7.enum(["accept", "dismiss"]),
314
+ promptText: z7.string().optional(),
315
+ type: z7.literal("handleDialog")
361
316
  });
362
- var clipboardNode = z10.object({
317
+ var clipboardNode = z7.object({
363
318
  ...nodeBase,
364
- action: z10.enum(["read", "write"]),
365
- type: z10.literal("clipboard"),
319
+ action: z7.enum(["read", "write"]),
320
+ type: z7.literal("clipboard"),
366
321
  value: stringValueRefSchema.optional(),
367
- variable: z10.string().min(1).optional()
322
+ variable: z7.string().min(1).optional()
368
323
  });
369
- var setPermissionNode = z10.object({
324
+ var setPermissionNode = z7.object({
370
325
  ...nodeBase,
371
- permission: z10.string().min(1),
372
- state: z10.enum(["granted", "prompt"]),
373
- type: z10.literal("setPermission")
326
+ permission: z7.string().min(1),
327
+ state: z7.enum(["granted", "prompt"]),
328
+ type: z7.literal("setPermission")
374
329
  });
375
- var assertVisibleNode = z10.object({
330
+ var assertVisibleNode = z7.object({
376
331
  ...nodeBase,
377
332
  locator: locatorSchema,
378
- type: z10.literal("assertVisible")
333
+ type: z7.literal("assertVisible")
379
334
  });
380
- var assertNotVisibleNode = z10.object({
335
+ var assertNotVisibleNode = z7.object({
381
336
  ...nodeBase,
382
337
  locator: locatorSchema,
383
- type: z10.literal("assertNotVisible")
338
+ type: z7.literal("assertNotVisible")
384
339
  });
385
- var assertTextNode = z10.object({
340
+ var assertTextNode = z7.object({
386
341
  ...nodeBase,
387
342
  expected: stringValueRefSchema,
388
343
  locator: locatorSchema,
389
344
  operator: comparisonOperator,
390
- type: z10.literal("assertText")
345
+ type: z7.literal("assertText")
391
346
  });
392
- var assertUrlNode = z10.object({
347
+ var assertUrlNode = z7.object({
393
348
  ...nodeBase,
394
349
  expected: stringValueRefSchema,
395
350
  operator: comparisonOperator,
396
- type: z10.literal("assertUrl")
351
+ type: z7.literal("assertUrl")
397
352
  });
398
- var assertCountNode = z10.object({
353
+ var assertCountNode = z7.object({
399
354
  ...nodeBase,
400
355
  expected: numericValueRefSchema,
401
356
  locator: locatorSchema,
402
357
  operator: numericOperator,
403
- type: z10.literal("assertCount")
358
+ type: z7.literal("assertCount")
404
359
  });
405
- var assertValueNode = z10.object({
360
+ var assertValueNode = z7.object({
406
361
  ...nodeBase,
407
362
  expected: stringValueRefSchema,
408
363
  locator: locatorSchema,
409
364
  operator: comparisonOperator,
410
- type: z10.literal("assertValue")
365
+ type: z7.literal("assertValue")
411
366
  });
412
- var assertAttributeNode = z10.object({
367
+ var assertAttributeNode = z7.object({
413
368
  ...nodeBase,
414
- attribute: z10.string().min(1),
369
+ attribute: z7.string().min(1),
415
370
  expected: stringValueRefSchema,
416
371
  locator: locatorSchema,
417
372
  operator: comparisonOperator,
418
- type: z10.literal("assertAttribute")
373
+ type: z7.literal("assertAttribute")
419
374
  });
420
- var assertEnabledNode = z10.object({
375
+ var assertEnabledNode = z7.object({
421
376
  ...nodeBase,
422
377
  locator: locatorSchema,
423
- type: z10.literal("assertEnabled")
378
+ type: z7.literal("assertEnabled")
424
379
  });
425
- var assertDisabledNode = z10.object({
380
+ var assertDisabledNode = z7.object({
426
381
  ...nodeBase,
427
382
  locator: locatorSchema,
428
- type: z10.literal("assertDisabled")
383
+ type: z7.literal("assertDisabled")
429
384
  });
430
- var assertTitleNode = z10.object({
385
+ var assertTitleNode = z7.object({
431
386
  ...nodeBase,
432
387
  expected: stringValueRefSchema,
433
388
  operator: comparisonOperator,
434
- type: z10.literal("assertTitle")
389
+ type: z7.literal("assertTitle")
435
390
  });
436
- var assertCheckedNode = z10.object({
391
+ var assertCheckedNode = z7.object({
437
392
  ...nodeBase,
438
393
  locator: locatorSchema,
439
- type: z10.literal("assertChecked")
394
+ type: z7.literal("assertChecked")
440
395
  });
441
- var assertNotCheckedNode = z10.object({
396
+ var assertNotCheckedNode = z7.object({
442
397
  ...nodeBase,
443
398
  locator: locatorSchema,
444
- type: z10.literal("assertNotChecked")
399
+ type: z7.literal("assertNotChecked")
445
400
  });
446
- var assertFocusedNode = z10.object({
401
+ var assertFocusedNode = z7.object({
447
402
  ...nodeBase,
448
403
  locator: locatorSchema,
449
- type: z10.literal("assertFocused")
404
+ type: z7.literal("assertFocused")
450
405
  });
451
- var assertNotFocusedNode = z10.object({
406
+ var assertNotFocusedNode = z7.object({
452
407
  ...nodeBase,
453
408
  locator: locatorSchema,
454
- type: z10.literal("assertNotFocused")
409
+ type: z7.literal("assertNotFocused")
455
410
  });
456
- var specNodeSchema = z10.discriminatedUnion("type", [
411
+ var specNodeSchema = z7.discriminatedUnion("type", [
457
412
  gotoNode,
458
413
  clickNode,
459
414
  fillNode,
@@ -492,59 +447,55 @@ var specNodeSchema = z10.discriminatedUnion("type", [
492
447
  assertFocusedNode,
493
448
  assertNotFocusedNode
494
449
  ]);
495
- var workflowSpecSchema = z10.object({
496
- entryNode: z10.string().min(1).max(200),
497
- nodes: z10.record(z10.string().max(200), specNodeSchema).refine(
450
+ var workflowSpecSchema = z7.object({
451
+ entryNode: z7.string().min(1).max(200),
452
+ nodes: z7.record(z7.string().max(200), specNodeSchema).refine(
498
453
  (nodes) => Object.keys(nodes).length <= MAX_NODES_PER_WORKFLOW,
499
454
  `Workflow has more than ${String(MAX_NODES_PER_WORKFLOW)} nodes`
500
455
  ),
501
- variableNamespaces: z10.record(z10.string().max(200), z10.string().max(500)).optional(),
502
- variables: z10.record(z10.string().max(200), variableDefSchema).optional()
456
+ variableNamespaces: z7.record(z7.string().max(200), z7.string().max(500)).optional(),
457
+ variables: z7.record(z7.string().max(200), variableDefSchema).optional()
503
458
  });
504
459
 
505
460
  // ../spec/src/codecs.ts
506
- var preconditionMapSchema = z11.record(z11.string().max(200), preconditionSchema);
461
+ var preconditionMapSchema = z8.record(z8.string().max(200), preconditionSchema);
507
462
  var looksLikeWorkflowSpec = {
508
463
  assumedVersion: 1,
509
464
  detect: (raw) => typeof raw === "object" && raw !== null && "entryNode" in raw && "nodes" in raw
510
465
  };
511
- var looksLikeStateGraph = {
512
- assumedVersion: 1,
513
- detect: (raw) => typeof raw === "object" && raw !== null && "edges" in raw && "states" in raw && "preconditions" in raw
514
- };
515
466
  var looksLikePreconditionMap = {
516
467
  assumedVersion: 1,
517
468
  detect: (raw) => typeof raw === "object" && raw !== null && !Array.isArray(raw) && !("__codec" in raw)
518
469
  };
519
470
  var workflowSpecCodec = defineCodec("workflow-spec").legacy(looksLikeWorkflowSpec).initial(workflowSpecSchema).build();
520
- var stateGraphCodec = defineCodec("state-graph").legacy(looksLikeStateGraph).initial(stateGraphSchema).build();
521
471
  var preconditionMapCodec = defineCodec("precondition-map").legacy(looksLikePreconditionMap).initial(preconditionMapSchema).build();
522
472
 
523
473
  // src/lockfile.ts
524
- import { z as z12 } from "zod";
474
+ import { z as z9 } from "zod";
525
475
  var LOCKFILE_RELATIVE_PATH = ".ripplo/ripplo.lock";
526
476
  var MAX_TESTS = 5e3;
527
- var compiledTestSchema = z12.object({
528
- description: z12.string().max(2e3),
529
- expectedOutcome: z12.string().max(2e3),
530
- implemented: z12.boolean(),
531
- name: z12.string().max(200),
532
- slug: z12.string().max(200),
477
+ var requiresKeysSchema = z9.record(z9.string().max(200), z9.string().max(200));
478
+ var compiledTestSchema = z9.object({
479
+ expectedOutcome: z9.string().max(2e3),
480
+ name: z9.string().max(200),
481
+ preconditions: z9.array(z9.string().max(200)).max(1e3),
482
+ requiresKeys: requiresKeysSchema,
483
+ slug: z9.string().max(200),
533
484
  spec: workflowSpecSchema
534
485
  });
535
- var lockfileBodySchema = z12.object({
536
- graph: stateGraphSchema,
537
- tests: z12.array(compiledTestSchema).max(MAX_TESTS)
486
+ var lockfileBodySchema = z9.object({
487
+ preconditions: z9.record(z9.string().max(200), preconditionSchema),
488
+ tests: z9.array(compiledTestSchema).max(MAX_TESTS)
538
489
  });
539
490
  var lockfileCodec = defineCodec("ripplo-lockfile").initial(lockfileBodySchema).build();
540
491
  function compileResultToLockfile(result) {
541
492
  return {
542
- graph: result.graph,
543
- tests: result.tests.map((test) => ({
544
- description: test.description,
493
+ preconditions: result.preconditions,
494
+ tests: result.tests.filter((test) => test.implemented).map((test) => ({
545
495
  expectedOutcome: test.expectedOutcome,
546
- implemented: test.implemented,
547
496
  name: test.name,
497
+ preconditions: [...test.preconditions],
498
+ requiresKeys: { ...test.requiresKeys },
548
499
  slug: test.slug,
549
500
  spec: test.spec
550
501
  }))
package/dist/nextjs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RipploBuilder } from './builder-DTWMrbuv.js';
1
+ import { R as RipploBuilder } from './builder-1kySbit_.js';
2
2
  import 'zod';
3
3
  import './step-DLfkKI3V.js';
4
4
  import '@ripplo/spec';
package/dist/nextjs.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  serializeCookie,
6
6
  teardownRequestSchema,
7
7
  verifyWebhookSignature
8
- } from "./chunk-KWUKVAGI.js";
8
+ } from "./chunk-7ETQVVAA.js";
9
9
 
10
10
  // src/adapters/nextjs.ts
11
11
  function createNextHandler({ enabled, ripplo }) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ripplo/testing",
3
3
  "description": "TypeScript DSL for defining and running Ripplo e2e workflow tests",
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"