@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.
- package/dist/{builder-DTWMrbuv.d.ts → builder-1kySbit_.d.ts} +5 -1
- package/dist/{chunk-KWUKVAGI.js → chunk-7ETQVVAA.js} +24 -0
- package/dist/{chunk-AQ52MYXE.js → chunk-LEIKZ6BE.js} +14 -40
- package/dist/compiler.d.ts +5 -3
- package/dist/compiler.js +1 -1
- package/dist/express.d.ts +1 -1
- package/dist/express.js +1 -1
- package/dist/fastify.d.ts +1 -1
- package/dist/fastify.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -2
- package/dist/lockfile.d.ts +8 -20
- package/dist/lockfile.js +153 -202
- package/dist/nextjs.d.ts +1 -1
- package/dist/nextjs.js +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
|
12
|
-
|
|
13
|
-
|
|
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
|
package/dist/compiler.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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
package/dist/express.d.ts
CHANGED
package/dist/express.js
CHANGED
package/dist/fastify.d.ts
CHANGED
package/dist/fastify.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CookieEntry, R as RipploBuilder } from './builder-
|
|
2
|
-
export { a as CookieOptions, D as DslConfig, P as Precondition,
|
|
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-
|
|
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-
|
|
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,
|
package/dist/lockfile.d.ts
CHANGED
|
@@ -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-
|
|
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
|
-
|
|
10
|
-
|
|
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
|
|
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
|
|
147
|
-
var preconditionSchema =
|
|
148
|
-
depends:
|
|
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:
|
|
152
|
-
returns:
|
|
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
|
|
142
|
+
import { z as z7 } from "zod";
|
|
188
143
|
|
|
189
144
|
// ../spec/src/locators.ts
|
|
190
|
-
import { z as
|
|
191
|
-
var testIdLocator =
|
|
192
|
-
by:
|
|
193
|
-
value:
|
|
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 =
|
|
196
|
-
by:
|
|
197
|
-
name:
|
|
198
|
-
role:
|
|
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 =
|
|
155
|
+
var locatorSchema = z3.discriminatedUnion("by", [testIdLocator, roleLocator]);
|
|
201
156
|
|
|
202
157
|
// ../spec/src/operators.ts
|
|
203
|
-
import { z as
|
|
204
|
-
var comparisonOperator =
|
|
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 =
|
|
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
|
|
223
|
-
var staticValueSchema =
|
|
224
|
-
type:
|
|
225
|
-
value:
|
|
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 =
|
|
228
|
-
name:
|
|
229
|
-
type:
|
|
182
|
+
var variableRefSchema = z5.object({
|
|
183
|
+
name: z5.string().min(1),
|
|
184
|
+
type: z5.literal("variable")
|
|
230
185
|
});
|
|
231
|
-
var valueRefSchema =
|
|
232
|
-
var stringValueRefSchema =
|
|
233
|
-
|
|
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 =
|
|
237
|
-
|
|
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
|
|
243
|
-
var variableDefSchema =
|
|
244
|
-
|
|
245
|
-
default:
|
|
246
|
-
type:
|
|
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
|
-
|
|
249
|
-
default:
|
|
250
|
-
type:
|
|
203
|
+
z6.object({
|
|
204
|
+
default: z6.number().optional(),
|
|
205
|
+
type: z6.literal("number")
|
|
251
206
|
}),
|
|
252
|
-
|
|
253
|
-
default:
|
|
254
|
-
type:
|
|
207
|
+
z6.object({
|
|
208
|
+
default: z6.boolean().optional(),
|
|
209
|
+
type: z6.literal("boolean")
|
|
255
210
|
}),
|
|
256
|
-
|
|
257
|
-
key:
|
|
258
|
-
type:
|
|
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:
|
|
265
|
-
id:
|
|
266
|
-
label:
|
|
267
|
-
next:
|
|
268
|
-
timeout:
|
|
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 =
|
|
226
|
+
var gotoNode = z7.object({
|
|
272
227
|
...nodeBase,
|
|
273
|
-
type:
|
|
228
|
+
type: z7.literal("goto"),
|
|
274
229
|
url: stringValueRefSchema
|
|
275
230
|
});
|
|
276
|
-
var clickNode =
|
|
277
|
-
var fillNode =
|
|
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:
|
|
235
|
+
type: z7.literal("fill"),
|
|
281
236
|
value: stringValueRefSchema
|
|
282
237
|
});
|
|
283
|
-
var selectNode =
|
|
238
|
+
var selectNode = z7.object({
|
|
284
239
|
...nodeBase,
|
|
285
240
|
locator: locatorSchema,
|
|
286
|
-
type:
|
|
241
|
+
type: z7.literal("select"),
|
|
287
242
|
value: stringValueRefSchema
|
|
288
243
|
});
|
|
289
|
-
var hoverNode =
|
|
290
|
-
var pressNode =
|
|
244
|
+
var hoverNode = z7.object({ ...nodeBase, locator: locatorSchema, type: z7.literal("hover") });
|
|
245
|
+
var pressNode = z7.object({
|
|
291
246
|
...nodeBase,
|
|
292
|
-
key:
|
|
247
|
+
key: z7.string().min(1),
|
|
293
248
|
locator: locatorSchema.optional(),
|
|
294
|
-
type:
|
|
249
|
+
type: z7.literal("press")
|
|
295
250
|
});
|
|
296
|
-
var checkNode =
|
|
297
|
-
var uncheckNode =
|
|
298
|
-
var setViewportNode =
|
|
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:
|
|
301
|
-
type:
|
|
302
|
-
width:
|
|
255
|
+
height: z7.number().int().positive(),
|
|
256
|
+
type: z7.literal("setViewport"),
|
|
257
|
+
width: z7.number().int().positive()
|
|
303
258
|
});
|
|
304
|
-
var failNode =
|
|
305
|
-
var setVariableNode =
|
|
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:
|
|
262
|
+
type: z7.literal("setVariable"),
|
|
308
263
|
value: valueRefSchema,
|
|
309
|
-
variable:
|
|
264
|
+
variable: z7.string().min(1)
|
|
310
265
|
});
|
|
311
|
-
var extractTextNode =
|
|
266
|
+
var extractTextNode = z7.object({
|
|
312
267
|
...nodeBase,
|
|
313
268
|
locator: locatorSchema,
|
|
314
|
-
type:
|
|
315
|
-
variable:
|
|
269
|
+
type: z7.literal("extractText"),
|
|
270
|
+
variable: z7.string().min(1)
|
|
316
271
|
});
|
|
317
|
-
var uploadNode =
|
|
272
|
+
var uploadNode = z7.object({
|
|
318
273
|
...nodeBase,
|
|
319
|
-
files:
|
|
274
|
+
files: z7.array(z7.string()).min(1),
|
|
320
275
|
locator: locatorSchema,
|
|
321
|
-
type:
|
|
276
|
+
type: z7.literal("upload")
|
|
322
277
|
});
|
|
323
|
-
var dblclickNode =
|
|
278
|
+
var dblclickNode = z7.object({
|
|
324
279
|
...nodeBase,
|
|
325
280
|
locator: locatorSchema,
|
|
326
|
-
type:
|
|
281
|
+
type: z7.literal("dblclick")
|
|
327
282
|
});
|
|
328
|
-
var dragNode =
|
|
283
|
+
var dragNode = z7.object({
|
|
329
284
|
...nodeBase,
|
|
330
285
|
source: locatorSchema,
|
|
331
286
|
target: locatorSchema,
|
|
332
|
-
type:
|
|
287
|
+
type: z7.literal("drag")
|
|
333
288
|
});
|
|
334
|
-
var scrollIntoViewNode =
|
|
289
|
+
var scrollIntoViewNode = z7.object({
|
|
335
290
|
...nodeBase,
|
|
336
291
|
locator: locatorSchema,
|
|
337
|
-
type:
|
|
292
|
+
type: z7.literal("scrollIntoView")
|
|
338
293
|
});
|
|
339
|
-
var typeNode =
|
|
294
|
+
var typeNode = z7.object({
|
|
340
295
|
...nodeBase,
|
|
341
296
|
locator: locatorSchema,
|
|
342
|
-
type:
|
|
297
|
+
type: z7.literal("type"),
|
|
343
298
|
value: stringValueRefSchema
|
|
344
299
|
});
|
|
345
|
-
var focusNode =
|
|
300
|
+
var focusNode = z7.object({
|
|
346
301
|
...nodeBase,
|
|
347
302
|
locator: locatorSchema,
|
|
348
|
-
type:
|
|
303
|
+
type: z7.literal("focus")
|
|
349
304
|
});
|
|
350
|
-
var clearNode =
|
|
351
|
-
var rightClickNode =
|
|
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:
|
|
309
|
+
type: z7.literal("rightClick")
|
|
355
310
|
});
|
|
356
|
-
var handleDialogNode =
|
|
311
|
+
var handleDialogNode = z7.object({
|
|
357
312
|
...nodeBase,
|
|
358
|
-
action:
|
|
359
|
-
promptText:
|
|
360
|
-
type:
|
|
313
|
+
action: z7.enum(["accept", "dismiss"]),
|
|
314
|
+
promptText: z7.string().optional(),
|
|
315
|
+
type: z7.literal("handleDialog")
|
|
361
316
|
});
|
|
362
|
-
var clipboardNode =
|
|
317
|
+
var clipboardNode = z7.object({
|
|
363
318
|
...nodeBase,
|
|
364
|
-
action:
|
|
365
|
-
type:
|
|
319
|
+
action: z7.enum(["read", "write"]),
|
|
320
|
+
type: z7.literal("clipboard"),
|
|
366
321
|
value: stringValueRefSchema.optional(),
|
|
367
|
-
variable:
|
|
322
|
+
variable: z7.string().min(1).optional()
|
|
368
323
|
});
|
|
369
|
-
var setPermissionNode =
|
|
324
|
+
var setPermissionNode = z7.object({
|
|
370
325
|
...nodeBase,
|
|
371
|
-
permission:
|
|
372
|
-
state:
|
|
373
|
-
type:
|
|
326
|
+
permission: z7.string().min(1),
|
|
327
|
+
state: z7.enum(["granted", "prompt"]),
|
|
328
|
+
type: z7.literal("setPermission")
|
|
374
329
|
});
|
|
375
|
-
var assertVisibleNode =
|
|
330
|
+
var assertVisibleNode = z7.object({
|
|
376
331
|
...nodeBase,
|
|
377
332
|
locator: locatorSchema,
|
|
378
|
-
type:
|
|
333
|
+
type: z7.literal("assertVisible")
|
|
379
334
|
});
|
|
380
|
-
var assertNotVisibleNode =
|
|
335
|
+
var assertNotVisibleNode = z7.object({
|
|
381
336
|
...nodeBase,
|
|
382
337
|
locator: locatorSchema,
|
|
383
|
-
type:
|
|
338
|
+
type: z7.literal("assertNotVisible")
|
|
384
339
|
});
|
|
385
|
-
var assertTextNode =
|
|
340
|
+
var assertTextNode = z7.object({
|
|
386
341
|
...nodeBase,
|
|
387
342
|
expected: stringValueRefSchema,
|
|
388
343
|
locator: locatorSchema,
|
|
389
344
|
operator: comparisonOperator,
|
|
390
|
-
type:
|
|
345
|
+
type: z7.literal("assertText")
|
|
391
346
|
});
|
|
392
|
-
var assertUrlNode =
|
|
347
|
+
var assertUrlNode = z7.object({
|
|
393
348
|
...nodeBase,
|
|
394
349
|
expected: stringValueRefSchema,
|
|
395
350
|
operator: comparisonOperator,
|
|
396
|
-
type:
|
|
351
|
+
type: z7.literal("assertUrl")
|
|
397
352
|
});
|
|
398
|
-
var assertCountNode =
|
|
353
|
+
var assertCountNode = z7.object({
|
|
399
354
|
...nodeBase,
|
|
400
355
|
expected: numericValueRefSchema,
|
|
401
356
|
locator: locatorSchema,
|
|
402
357
|
operator: numericOperator,
|
|
403
|
-
type:
|
|
358
|
+
type: z7.literal("assertCount")
|
|
404
359
|
});
|
|
405
|
-
var assertValueNode =
|
|
360
|
+
var assertValueNode = z7.object({
|
|
406
361
|
...nodeBase,
|
|
407
362
|
expected: stringValueRefSchema,
|
|
408
363
|
locator: locatorSchema,
|
|
409
364
|
operator: comparisonOperator,
|
|
410
|
-
type:
|
|
365
|
+
type: z7.literal("assertValue")
|
|
411
366
|
});
|
|
412
|
-
var assertAttributeNode =
|
|
367
|
+
var assertAttributeNode = z7.object({
|
|
413
368
|
...nodeBase,
|
|
414
|
-
attribute:
|
|
369
|
+
attribute: z7.string().min(1),
|
|
415
370
|
expected: stringValueRefSchema,
|
|
416
371
|
locator: locatorSchema,
|
|
417
372
|
operator: comparisonOperator,
|
|
418
|
-
type:
|
|
373
|
+
type: z7.literal("assertAttribute")
|
|
419
374
|
});
|
|
420
|
-
var assertEnabledNode =
|
|
375
|
+
var assertEnabledNode = z7.object({
|
|
421
376
|
...nodeBase,
|
|
422
377
|
locator: locatorSchema,
|
|
423
|
-
type:
|
|
378
|
+
type: z7.literal("assertEnabled")
|
|
424
379
|
});
|
|
425
|
-
var assertDisabledNode =
|
|
380
|
+
var assertDisabledNode = z7.object({
|
|
426
381
|
...nodeBase,
|
|
427
382
|
locator: locatorSchema,
|
|
428
|
-
type:
|
|
383
|
+
type: z7.literal("assertDisabled")
|
|
429
384
|
});
|
|
430
|
-
var assertTitleNode =
|
|
385
|
+
var assertTitleNode = z7.object({
|
|
431
386
|
...nodeBase,
|
|
432
387
|
expected: stringValueRefSchema,
|
|
433
388
|
operator: comparisonOperator,
|
|
434
|
-
type:
|
|
389
|
+
type: z7.literal("assertTitle")
|
|
435
390
|
});
|
|
436
|
-
var assertCheckedNode =
|
|
391
|
+
var assertCheckedNode = z7.object({
|
|
437
392
|
...nodeBase,
|
|
438
393
|
locator: locatorSchema,
|
|
439
|
-
type:
|
|
394
|
+
type: z7.literal("assertChecked")
|
|
440
395
|
});
|
|
441
|
-
var assertNotCheckedNode =
|
|
396
|
+
var assertNotCheckedNode = z7.object({
|
|
442
397
|
...nodeBase,
|
|
443
398
|
locator: locatorSchema,
|
|
444
|
-
type:
|
|
399
|
+
type: z7.literal("assertNotChecked")
|
|
445
400
|
});
|
|
446
|
-
var assertFocusedNode =
|
|
401
|
+
var assertFocusedNode = z7.object({
|
|
447
402
|
...nodeBase,
|
|
448
403
|
locator: locatorSchema,
|
|
449
|
-
type:
|
|
404
|
+
type: z7.literal("assertFocused")
|
|
450
405
|
});
|
|
451
|
-
var assertNotFocusedNode =
|
|
406
|
+
var assertNotFocusedNode = z7.object({
|
|
452
407
|
...nodeBase,
|
|
453
408
|
locator: locatorSchema,
|
|
454
|
-
type:
|
|
409
|
+
type: z7.literal("assertNotFocused")
|
|
455
410
|
});
|
|
456
|
-
var specNodeSchema =
|
|
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 =
|
|
496
|
-
entryNode:
|
|
497
|
-
nodes:
|
|
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:
|
|
502
|
-
variables:
|
|
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 =
|
|
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
|
|
474
|
+
import { z as z9 } from "zod";
|
|
525
475
|
var LOCKFILE_RELATIVE_PATH = ".ripplo/ripplo.lock";
|
|
526
476
|
var MAX_TESTS = 5e3;
|
|
527
|
-
var
|
|
528
|
-
|
|
529
|
-
expectedOutcome:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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 =
|
|
536
|
-
|
|
537
|
-
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
|
-
|
|
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
package/dist/nextjs.js
CHANGED