adfinem 0.0.0 → 0.1.0
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/CHANGELOG.md +10 -0
- package/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +29 -0
- package/LICENSE +21 -0
- package/README.md +86 -2
- package/SECURITY.md +13 -0
- package/catalogs/.gitkeep +0 -0
- package/catalogs/api-operations.yaml +21 -0
- package/catalogs/batches.yaml +74 -0
- package/catalogs/queries.yaml +75 -0
- package/config/environments.yaml +13 -0
- package/dist/actions/assert-db.js +3 -0
- package/dist/actions/run-eod.js +3 -0
- package/dist/adapters/api/api-collections.js +296 -0
- package/dist/adapters/api/body-utils.js +9 -0
- package/dist/adapters/api/rest-client.js +557 -0
- package/dist/adapters/api/soap-client.js +5 -0
- package/dist/adapters/db/assertions.js +87 -0
- package/dist/adapters/db/oracle-client.js +115 -0
- package/dist/adapters/db/query-catalog.js +75 -0
- package/dist/adapters/unix/batch-catalog.js +71 -0
- package/dist/adapters/unix/batch-input-files.js +36 -0
- package/dist/adapters/unix/batch-runner.js +382 -0
- package/dist/adapters/unix/ssh-client.js +228 -0
- package/dist/app/server.js +826 -0
- package/dist/cli.js +465 -0
- package/dist/config/environments.js +138 -0
- package/dist/config/registry.js +18 -0
- package/dist/config/secrets.js +123 -0
- package/dist/dsl/parser.js +20 -0
- package/dist/dsl/schema.js +182 -0
- package/dist/dsl/types.js +1 -0
- package/dist/dsl/validator.js +264 -0
- package/dist/engine/captures.js +68 -0
- package/dist/engine/context.js +69 -0
- package/dist/engine/evidence.js +33 -0
- package/dist/engine/known-errors.js +129 -0
- package/dist/engine/retry.js +13 -0
- package/dist/engine/runner.js +710 -0
- package/dist/engine/step-result.js +58 -0
- package/dist/flows/catalog-normalizer.js +72 -0
- package/dist/flows/compiler.js +237 -0
- package/dist/flows/concat.js +130 -0
- package/dist/flows/parser.js +21 -0
- package/dist/flows/schema.js +142 -0
- package/dist/flows/types.js +1 -0
- package/dist/flows/validator.js +470 -0
- package/dist/reports/html-report.js +112 -0
- package/dist/reports/junit-report.js +48 -0
- package/docs/.gitkeep +0 -0
- package/docs/DB_UNIX_OPERATIONS.md +118 -0
- package/docs/FLOW_BUILDER.md +87 -0
- package/flows/account_processing_cycle.flow.yaml +88 -0
- package/flows/new_flow.flow.yaml +22 -0
- package/package.json +92 -7
- package/scenarios/smoke/account-processing-smoke.yaml +44 -0
- package/scenarios/smoke/api-db-batch-check.yaml +40 -0
- package/src/actions/assert-db.ts +6 -0
- package/src/actions/run-eod.ts +6 -0
- package/src/adapters/api/api-collections.ts +375 -0
- package/src/adapters/api/body-utils.ts +10 -0
- package/src/adapters/api/rest-client.ts +587 -0
- package/src/adapters/api/soap-client.ts +7 -0
- package/src/adapters/db/assertions.ts +83 -0
- package/src/adapters/db/oracle-client.ts +133 -0
- package/src/adapters/db/query-catalog.ts +80 -0
- package/src/adapters/unix/batch-catalog.ts +81 -0
- package/src/adapters/unix/batch-input-files.ts +39 -0
- package/src/adapters/unix/batch-runner.ts +456 -0
- package/src/adapters/unix/ssh-client.ts +248 -0
- package/src/app/server.ts +913 -0
- package/src/cli.ts +466 -0
- package/src/config/environments.ts +193 -0
- package/src/config/registry.ts +23 -0
- package/src/config/secrets.ts +128 -0
- package/src/dsl/parser.ts +24 -0
- package/src/dsl/schema.ts +189 -0
- package/src/dsl/types.ts +371 -0
- package/src/dsl/validator.ts +282 -0
- package/src/engine/captures.ts +66 -0
- package/src/engine/context.ts +76 -0
- package/src/engine/evidence.ts +35 -0
- package/src/engine/known-errors.ts +145 -0
- package/src/engine/retry.ts +11 -0
- package/src/engine/runner.ts +746 -0
- package/src/engine/step-result.ts +64 -0
- package/src/flows/catalog-normalizer.ts +86 -0
- package/src/flows/compiler.ts +247 -0
- package/src/flows/concat.ts +149 -0
- package/src/flows/parser.ts +27 -0
- package/src/flows/schema.ts +154 -0
- package/src/flows/types.ts +130 -0
- package/src/flows/validator.ts +468 -0
- package/src/llm/system-prompt.md +9 -0
- package/src/reports/html-report.ts +113 -0
- package/src/reports/junit-report.ts +55 -0
- package/src/types/oracledb.d.ts +1 -0
- package/templates/.gitkeep +0 -0
- package/templates/api/create-test-case.json +5 -0
- package/templates/api/record-test-activity.json +6 -0
- package/tsconfig.json +15 -0
- package/vite.config.ts +17 -0
- package/web/index.html +12 -0
- package/web/src/App.tsx +6588 -0
- package/web/src/main.tsx +10 -0
- package/web/src/styles.css +3147 -0
- package/index.js +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiAssertionSchema, apiRequestSpecSchema } from "../dsl/schema.js";
|
|
3
|
+
|
|
4
|
+
const scalar = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
5
|
+
const jsonValue: z.ZodType<unknown> = z.lazy(() => z.union([
|
|
6
|
+
scalar,
|
|
7
|
+
z.array(jsonValue),
|
|
8
|
+
z.record(jsonValue)
|
|
9
|
+
]));
|
|
10
|
+
|
|
11
|
+
const id = z.string().min(1).regex(/^[A-Za-z0-9_-]+$/);
|
|
12
|
+
const mappingObject = z.record(jsonValue);
|
|
13
|
+
const captureObject = z.record(z.string().min(1));
|
|
14
|
+
const environmentInputSetSchema = z.object({
|
|
15
|
+
variables: mappingObject.optional(),
|
|
16
|
+
nodes: z.record(mappingObject).optional()
|
|
17
|
+
}).strict();
|
|
18
|
+
|
|
19
|
+
const retrySchema = z.object({
|
|
20
|
+
attempts: z.number().int().positive().optional(),
|
|
21
|
+
delaySeconds: z.number().nonnegative().optional()
|
|
22
|
+
}).strict();
|
|
23
|
+
const expectedOutcomeSchema = z.enum(["positive", "negative", "setup", "teardown"]);
|
|
24
|
+
const loopDateFormatSchema = z.enum(["YYYY-MM-DD", "DD/MM/YYYY", "MM/DD/YYYY"]);
|
|
25
|
+
const loopDateCursorSchema = z.object({
|
|
26
|
+
outputName: z.string().min(1).optional(),
|
|
27
|
+
start: z.string().min(1).optional(),
|
|
28
|
+
inputFormat: loopDateFormatSchema.optional(),
|
|
29
|
+
outputFormat: loopDateFormatSchema.optional(),
|
|
30
|
+
advance: z.object({
|
|
31
|
+
mode: z.enum(["days", "months", "nth_day_of_month", "first_of_month", "end_of_month"]),
|
|
32
|
+
amount: z.number().int().positive().optional(),
|
|
33
|
+
day: z.number().int().min(1).max(31).optional()
|
|
34
|
+
}).strict().optional()
|
|
35
|
+
}).strict();
|
|
36
|
+
const loopSpecSchema = z.object({
|
|
37
|
+
mode: z.enum(["count", "foreach"]),
|
|
38
|
+
count: z.union([z.number().int().nonnegative(), z.string()]).optional(),
|
|
39
|
+
items: jsonValue.optional(),
|
|
40
|
+
itemName: z.string().min(1).optional(),
|
|
41
|
+
maxIterations: z.number().int().positive().optional(),
|
|
42
|
+
dateCursor: loopDateCursorSchema.optional()
|
|
43
|
+
}).strict();
|
|
44
|
+
const parallelJoinModeSchema = z.enum(["all", "any", "fail_fast"]);
|
|
45
|
+
|
|
46
|
+
const actionBase = {
|
|
47
|
+
id,
|
|
48
|
+
label: z.string().min(1).optional(),
|
|
49
|
+
input: mappingObject.optional(),
|
|
50
|
+
params: mappingObject.optional(),
|
|
51
|
+
request: apiRequestSpecSchema.optional(),
|
|
52
|
+
assertions: z.array(apiAssertionSchema).optional(),
|
|
53
|
+
capture: captureObject.optional(),
|
|
54
|
+
continueOnFailure: z.boolean().optional(),
|
|
55
|
+
expectedOutcome: expectedOutcomeSchema.optional(),
|
|
56
|
+
captureOnFailure: z.boolean().optional(),
|
|
57
|
+
disabled: z.boolean().optional(),
|
|
58
|
+
section: z.string().min(1).optional()
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const flowDbQueryNodeSchema = z.object({
|
|
62
|
+
...actionBase,
|
|
63
|
+
type: z.literal("db_query"),
|
|
64
|
+
query: z.string().min(1)
|
|
65
|
+
}).strict();
|
|
66
|
+
|
|
67
|
+
export const flowDbAssertNodeSchema = z.object({
|
|
68
|
+
...actionBase,
|
|
69
|
+
type: z.literal("db_assert"),
|
|
70
|
+
query: z.string().min(1)
|
|
71
|
+
}).strict();
|
|
72
|
+
|
|
73
|
+
export const flowDbExecuteNodeSchema = z.object({
|
|
74
|
+
...actionBase,
|
|
75
|
+
type: z.literal("db_execute"),
|
|
76
|
+
query: z.string().min(1)
|
|
77
|
+
}).strict();
|
|
78
|
+
|
|
79
|
+
export const flowUnixBatchNodeSchema = z.object({
|
|
80
|
+
...actionBase,
|
|
81
|
+
type: z.literal("unix_batch"),
|
|
82
|
+
batch: z.string().min(1),
|
|
83
|
+
retry: retrySchema.optional()
|
|
84
|
+
}).strict();
|
|
85
|
+
|
|
86
|
+
export const flowActionNodeSchema = z.discriminatedUnion("type", [
|
|
87
|
+
flowDbQueryNodeSchema,
|
|
88
|
+
flowDbAssertNodeSchema,
|
|
89
|
+
flowDbExecuteNodeSchema,
|
|
90
|
+
flowUnixBatchNodeSchema
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
export const flowApiOperationNodeSchema = z.object({
|
|
94
|
+
id,
|
|
95
|
+
label: z.string().min(1).optional(),
|
|
96
|
+
type: z.literal("api_operation"),
|
|
97
|
+
operation: z.string().min(1),
|
|
98
|
+
input: mappingObject.optional(),
|
|
99
|
+
params: mappingObject.optional(),
|
|
100
|
+
request: apiRequestSpecSchema.optional(),
|
|
101
|
+
assertions: z.array(apiAssertionSchema).optional(),
|
|
102
|
+
capture: captureObject.optional(),
|
|
103
|
+
continueOnFailure: z.boolean().optional(),
|
|
104
|
+
expectedOutcome: expectedOutcomeSchema.optional(),
|
|
105
|
+
captureOnFailure: z.boolean().optional(),
|
|
106
|
+
disabled: z.boolean().optional(),
|
|
107
|
+
section: z.string().min(1).optional(),
|
|
108
|
+
postActions: z.array(flowActionNodeSchema).optional()
|
|
109
|
+
}).strict();
|
|
110
|
+
|
|
111
|
+
export const flowNodeSchema: z.ZodType<unknown> = z.lazy(() => z.discriminatedUnion("type", [
|
|
112
|
+
flowApiOperationNodeSchema,
|
|
113
|
+
flowDbQueryNodeSchema,
|
|
114
|
+
flowDbAssertNodeSchema,
|
|
115
|
+
flowDbExecuteNodeSchema,
|
|
116
|
+
flowUnixBatchNodeSchema,
|
|
117
|
+
z.object({
|
|
118
|
+
...actionBase,
|
|
119
|
+
type: z.literal("parallel"),
|
|
120
|
+
branches: z.array(z.object({
|
|
121
|
+
id,
|
|
122
|
+
label: z.string().min(1).optional(),
|
|
123
|
+
nodes: z.array(flowNodeSchema)
|
|
124
|
+
}).strict()).min(1),
|
|
125
|
+
join: parallelJoinModeSchema.optional()
|
|
126
|
+
}).strict(),
|
|
127
|
+
z.object({
|
|
128
|
+
...actionBase,
|
|
129
|
+
type: z.literal("loop"),
|
|
130
|
+
loop: loopSpecSchema,
|
|
131
|
+
nodes: z.array(flowNodeSchema).min(1)
|
|
132
|
+
}).strict()
|
|
133
|
+
]));
|
|
134
|
+
|
|
135
|
+
export const flowFileSchema = z.object({
|
|
136
|
+
version: z.literal(1),
|
|
137
|
+
id,
|
|
138
|
+
name: z.string().min(1).optional(),
|
|
139
|
+
environment: z.string().min(1),
|
|
140
|
+
variables: mappingObject.optional(),
|
|
141
|
+
environmentInputs: z.record(environmentInputSetSchema).optional(),
|
|
142
|
+
nodes: z.array(flowNodeSchema),
|
|
143
|
+
edges: z.array(z.object({
|
|
144
|
+
from: id,
|
|
145
|
+
to: id
|
|
146
|
+
}).strict()).optional(),
|
|
147
|
+
ui: z.object({
|
|
148
|
+
positions: z.record(z.object({
|
|
149
|
+
x: z.number(),
|
|
150
|
+
y: z.number()
|
|
151
|
+
}).strict()).optional(),
|
|
152
|
+
manualEdges: z.boolean().optional()
|
|
153
|
+
}).strict().optional()
|
|
154
|
+
}).strict();
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ApiAssertion, ApiRequestSpec, ExpectedOutcome, LoopSpec, ParallelJoinMode, Scenario, ScenarioStep } from "../dsl/types.js";
|
|
2
|
+
|
|
3
|
+
export type FlowNodeType = "api_operation" | "db_query" | "db_assert" | "db_execute" | "unix_batch" | "parallel" | "loop";
|
|
4
|
+
|
|
5
|
+
export interface FlowFile {
|
|
6
|
+
version: 1;
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
variables?: Record<string, unknown>;
|
|
11
|
+
environmentInputs?: Record<string, FlowEnvironmentInputSet>;
|
|
12
|
+
nodes: FlowNode[];
|
|
13
|
+
edges?: FlowEdge[];
|
|
14
|
+
ui?: FlowUi;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FlowUi {
|
|
18
|
+
positions?: Record<string, FlowPosition>;
|
|
19
|
+
manualEdges?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FlowPosition {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FlowEnvironmentInputSet {
|
|
28
|
+
variables?: Record<string, unknown>;
|
|
29
|
+
nodes?: Record<string, Record<string, unknown>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FlowEdge {
|
|
33
|
+
from: string;
|
|
34
|
+
to: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type FlowNode = FlowApiOperationNode | FlowActionNode | FlowParallelNode | FlowLoopNode;
|
|
38
|
+
|
|
39
|
+
export interface FlowBaseNode {
|
|
40
|
+
id: string;
|
|
41
|
+
label?: string;
|
|
42
|
+
type: FlowNodeType;
|
|
43
|
+
input?: Record<string, unknown>;
|
|
44
|
+
params?: Record<string, unknown>;
|
|
45
|
+
request?: ApiRequestSpec;
|
|
46
|
+
assertions?: ApiAssertion[];
|
|
47
|
+
capture?: Record<string, string>;
|
|
48
|
+
continueOnFailure?: boolean;
|
|
49
|
+
expectedOutcome?: ExpectedOutcome;
|
|
50
|
+
captureOnFailure?: boolean;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
section?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface FlowApiOperationNode extends FlowBaseNode {
|
|
56
|
+
type: "api_operation";
|
|
57
|
+
operation: string;
|
|
58
|
+
postActions?: FlowActionNode[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type FlowActionNode = FlowDbQueryNode | FlowDbAssertNode | FlowDbExecuteNode | FlowUnixBatchNode;
|
|
62
|
+
export type FlowExecutableNode = FlowApiOperationNode | FlowActionNode;
|
|
63
|
+
|
|
64
|
+
export interface FlowDbQueryNode extends FlowBaseNode {
|
|
65
|
+
type: "db_query";
|
|
66
|
+
query: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface FlowDbAssertNode extends FlowBaseNode {
|
|
70
|
+
type: "db_assert";
|
|
71
|
+
query: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface FlowDbExecuteNode extends FlowBaseNode {
|
|
75
|
+
type: "db_execute";
|
|
76
|
+
query: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface FlowUnixBatchNode extends FlowBaseNode {
|
|
80
|
+
type: "unix_batch";
|
|
81
|
+
batch: string;
|
|
82
|
+
retry?: {
|
|
83
|
+
attempts?: number;
|
|
84
|
+
delaySeconds?: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface FlowBranch {
|
|
89
|
+
id: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
nodes: FlowNode[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface FlowParallelNode extends FlowBaseNode {
|
|
95
|
+
type: "parallel";
|
|
96
|
+
branches: FlowBranch[];
|
|
97
|
+
join?: ParallelJoinMode;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface FlowLoopNode extends FlowBaseNode {
|
|
101
|
+
type: "loop";
|
|
102
|
+
loop: LoopSpec;
|
|
103
|
+
nodes: FlowNode[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface FlowValidationResult {
|
|
107
|
+
ok: boolean;
|
|
108
|
+
errors: string[];
|
|
109
|
+
warnings: string[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface CompiledFlow {
|
|
113
|
+
flow: FlowFile;
|
|
114
|
+
scenario: Scenario;
|
|
115
|
+
stepMap: Array<{
|
|
116
|
+
flowNodeId: string;
|
|
117
|
+
scenarioStepId: string;
|
|
118
|
+
type: FlowNodeType;
|
|
119
|
+
postActionOf?: string;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface FlowCompileOptions {
|
|
124
|
+
environment?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type FlowScenarioStep = ScenarioStep & {
|
|
128
|
+
flowNodeId?: string;
|
|
129
|
+
postActionOf?: string;
|
|
130
|
+
};
|