webpipe-js 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.
@@ -0,0 +1,129 @@
1
+ export interface Program {
2
+ configs: Config[];
3
+ pipelines: NamedPipeline[];
4
+ variables: Variable[];
5
+ routes: Route[];
6
+ describes: Describe[];
7
+ }
8
+ export interface Config {
9
+ name: string;
10
+ properties: ConfigProperty[];
11
+ }
12
+ export interface ConfigProperty {
13
+ key: string;
14
+ value: ConfigValue;
15
+ }
16
+ export type ConfigValue = {
17
+ kind: 'String';
18
+ value: string;
19
+ } | {
20
+ kind: 'EnvVar';
21
+ var: string;
22
+ default?: string;
23
+ } | {
24
+ kind: 'Boolean';
25
+ value: boolean;
26
+ } | {
27
+ kind: 'Number';
28
+ value: number;
29
+ };
30
+ export interface NamedPipeline {
31
+ name: string;
32
+ pipeline: Pipeline;
33
+ }
34
+ export interface Variable {
35
+ varType: string;
36
+ name: string;
37
+ value: string;
38
+ }
39
+ export interface Route {
40
+ method: string;
41
+ path: string;
42
+ pipeline: PipelineRef;
43
+ }
44
+ export type PipelineRef = {
45
+ kind: 'Inline';
46
+ pipeline: Pipeline;
47
+ } | {
48
+ kind: 'Named';
49
+ name: string;
50
+ };
51
+ export interface Pipeline {
52
+ steps: PipelineStep[];
53
+ }
54
+ export type PipelineStep = {
55
+ kind: 'Regular';
56
+ name: string;
57
+ config: string;
58
+ } | {
59
+ kind: 'Result';
60
+ branches: ResultBranch[];
61
+ };
62
+ export interface ResultBranch {
63
+ branchType: ResultBranchType;
64
+ statusCode: number;
65
+ pipeline: Pipeline;
66
+ }
67
+ export type ResultBranchType = {
68
+ kind: 'Ok';
69
+ } | {
70
+ kind: 'Custom';
71
+ name: string;
72
+ } | {
73
+ kind: 'Default';
74
+ };
75
+ export interface Describe {
76
+ name: string;
77
+ mocks: Mock[];
78
+ tests: It[];
79
+ }
80
+ export interface Mock {
81
+ target: string;
82
+ returnValue: string;
83
+ }
84
+ export interface It {
85
+ name: string;
86
+ mocks: Mock[];
87
+ when: When;
88
+ input?: string;
89
+ conditions: Condition[];
90
+ }
91
+ export type When = {
92
+ kind: 'CallingRoute';
93
+ method: string;
94
+ path: string;
95
+ } | {
96
+ kind: 'ExecutingPipeline';
97
+ name: string;
98
+ } | {
99
+ kind: 'ExecutingVariable';
100
+ varType: string;
101
+ name: string;
102
+ };
103
+ export interface Condition {
104
+ conditionType: 'Then' | 'And';
105
+ field: string;
106
+ jqExpr?: string;
107
+ comparison: string;
108
+ value: string;
109
+ }
110
+ export type DiagnosticSeverity = 'error' | 'warning' | 'info';
111
+ export interface ParseDiagnostic {
112
+ message: string;
113
+ start: number;
114
+ end: number;
115
+ severity: DiagnosticSeverity;
116
+ }
117
+ export declare function parseProgram(text: string): Program;
118
+ export declare function parseProgramWithDiagnostics(text: string): {
119
+ program: Program;
120
+ diagnostics: ParseDiagnostic[];
121
+ };
122
+ export declare function getPipelineRanges(text: string): Map<string, {
123
+ start: number;
124
+ end: number;
125
+ }>;
126
+ export declare function getVariableRanges(text: string): Map<string, {
127
+ start: number;
128
+ end: number;
129
+ }>;