doc-detective-common 1.22.0 → 3.0.0-dev.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/package.json +6 -6
- package/src/schemas/dereferenceSchemas.js +29 -4
- package/src/schemas/output_schemas/checkLink_v3.schema.json +141 -0
- package/src/schemas/output_schemas/click_v3.schema.json +90 -0
- package/src/schemas/output_schemas/config_v3.schema.json +8745 -0
- package/src/schemas/output_schemas/context_v3.schema.json +324 -0
- package/src/schemas/output_schemas/endRecord_v3.schema.json +14 -0
- package/src/schemas/output_schemas/find_v3.schema.json +342 -0
- package/src/schemas/output_schemas/goTo_v3.schema.json +87 -0
- package/src/schemas/output_schemas/httpRequest_v3.schema.json +804 -0
- package/src/schemas/output_schemas/loadVariables_v3.schema.json +9 -0
- package/src/schemas/output_schemas/openApi_v3.schema.json +142 -0
- package/src/schemas/output_schemas/record_v3.schema.json +96 -0
- package/src/schemas/output_schemas/report_v3.schema.json +5239 -0
- package/src/schemas/output_schemas/runCode_v3.schema.json +220 -0
- package/src/schemas/output_schemas/runShell_v3.schema.json +230 -0
- package/src/schemas/output_schemas/screenshot_v3.schema.json +357 -0
- package/src/schemas/output_schemas/spec_v3.schema.json +5037 -0
- package/src/schemas/output_schemas/step_v3.schema.json +3645 -0
- package/src/schemas/output_schemas/stopRecord_v3.schema.json +14 -0
- package/src/schemas/output_schemas/test_v3.schema.json +4346 -0
- package/src/schemas/output_schemas/type_v3.schema.json +142 -0
- package/src/schemas/output_schemas/wait_v3.schema.json +38 -0
- package/src/schemas/schemas.json +30048 -0
- package/src/schemas/src_schemas/checkLink_v3.schema.json +73 -0
- package/src/schemas/src_schemas/click_v3.schema.json +55 -0
- package/src/schemas/src_schemas/config_v3.schema.json +401 -0
- package/src/schemas/src_schemas/context_v3.schema.json +163 -0
- package/src/schemas/src_schemas/find_v3.schema.json +104 -0
- package/src/schemas/src_schemas/goTo_v3.schema.json +52 -0
- package/src/schemas/src_schemas/httpRequest_v3.schema.json +305 -0
- package/src/schemas/src_schemas/loadVariables_v3.schema.json +7 -0
- package/src/schemas/src_schemas/openApi_v3.schema.json +129 -0
- package/src/schemas/src_schemas/record_v3.schema.json +57 -0
- package/src/schemas/src_schemas/report_v3.schema.json +46 -0
- package/src/schemas/src_schemas/runCode_v3.schema.json +117 -0
- package/src/schemas/src_schemas/runShell_v3.schema.json +129 -0
- package/src/schemas/src_schemas/screenshot_v3.schema.json +149 -0
- package/src/schemas/src_schemas/spec_v3.schema.json +201 -0
- package/src/schemas/src_schemas/step_v3.schema.json +482 -0
- package/src/schemas/src_schemas/stopRecord_v3.schema.json +13 -0
- package/src/schemas/src_schemas/test_v2.schema.json +1 -1
- package/src/schemas/src_schemas/test_v3.schema.json +223 -0
- package/src/schemas/src_schemas/type_v3.schema.json +68 -0
- package/src/schemas/src_schemas/wait_v3.schema.json +29 -0
- package/src/validate.js +492 -12
- package/test/schema.test.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-dev.0",
|
|
4
4
|
"description": "Shared components for Doc Detective projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/doc-detective/doc-detective-common#readme",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"chai": "^5.
|
|
22
|
+
"chai": "^5.2.0",
|
|
23
23
|
"mocha": "^11.1.0",
|
|
24
24
|
"sinon": "^19.0.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@apidevtools/json-schema-ref-parser": "^11.9.
|
|
28
|
-
"ajv": "8.
|
|
27
|
+
"@apidevtools/json-schema-ref-parser": "^11.9.3",
|
|
28
|
+
"ajv": "^8.17.1",
|
|
29
29
|
"ajv-errors": "^3.0.0",
|
|
30
30
|
"ajv-formats": "^3.0.1",
|
|
31
31
|
"ajv-keywords": "^5.1.0",
|
|
32
|
-
"axios": "^1.
|
|
33
|
-
"uuid": "^11.0
|
|
32
|
+
"axios": "^1.8.2",
|
|
33
|
+
"uuid": "^11.1.0",
|
|
34
34
|
"yaml": "^2.7.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -17,7 +17,29 @@ async function dereferenceSchemas() {
|
|
|
17
17
|
if (err) throw err;
|
|
18
18
|
});
|
|
19
19
|
const outputDir = path.resolve(`${__dirname}/output_schemas`);
|
|
20
|
-
|
|
20
|
+
const files = [
|
|
21
|
+
// v3 schemas
|
|
22
|
+
"checkLink_v3.schema.json",
|
|
23
|
+
"click_v3.schema.json",
|
|
24
|
+
"config_v3.schema.json",
|
|
25
|
+
"context_v3.schema.json",
|
|
26
|
+
"find_v3.schema.json",
|
|
27
|
+
"goTo_v3.schema.json",
|
|
28
|
+
"loadVariables_v3.schema.json",
|
|
29
|
+
"httpRequest_v3.schema.json",
|
|
30
|
+
"openApi_v3.schema.json",
|
|
31
|
+
"record_v3.schema.json",
|
|
32
|
+
"report_v3.schema.json",
|
|
33
|
+
"runCode_v3.schema.json",
|
|
34
|
+
"runShell_v3.schema.json",
|
|
35
|
+
"screenshot_v3.schema.json",
|
|
36
|
+
"spec_v3.schema.json",
|
|
37
|
+
"step_v3.schema.json",
|
|
38
|
+
"stopRecord_v3.schema.json",
|
|
39
|
+
"test_v3.schema.json",
|
|
40
|
+
"type_v3.schema.json",
|
|
41
|
+
"wait_v3.schema.json",
|
|
42
|
+
// v2 schemas
|
|
21
43
|
"checkLink_v2.schema.json",
|
|
22
44
|
"config_v2.schema.json",
|
|
23
45
|
"context_v2.schema.json",
|
|
@@ -75,8 +97,11 @@ async function dereferenceSchemas() {
|
|
|
75
97
|
// Load into `schema` object
|
|
76
98
|
schemas[key] = schema;
|
|
77
99
|
});
|
|
78
|
-
fs.writeFileSync(
|
|
79
|
-
|
|
100
|
+
fs.writeFileSync(
|
|
101
|
+
`${__dirname}/schemas.json`,
|
|
102
|
+
JSON.stringify(schemas, null, 2)
|
|
103
|
+
);
|
|
104
|
+
|
|
80
105
|
// Clean up build dir
|
|
81
106
|
// fs.rm(buildDir, { recursive: true }, (err) => {
|
|
82
107
|
// if (err) throw err;
|
|
@@ -109,7 +134,7 @@ function deleteDollarIds(schema) {
|
|
|
109
134
|
deleteDollarIds(value);
|
|
110
135
|
}
|
|
111
136
|
if (key === "$id") {
|
|
112
|
-
delete schema[key]
|
|
137
|
+
delete schema[key];
|
|
113
138
|
}
|
|
114
139
|
}
|
|
115
140
|
return schema;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "checkLink",
|
|
4
|
+
"anyOf": [
|
|
5
|
+
{
|
|
6
|
+
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "(^(http://|https://|/).*|\\$[A-Za-z0-9_]+)",
|
|
9
|
+
"transform": [
|
|
10
|
+
"trim"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": [
|
|
18
|
+
"url"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"url": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "URL to check. Can be a full URL or a path. If a path is provided, `origin` must be specified.",
|
|
24
|
+
"pattern": "(^(http://|https://|/).*|\\$[A-Za-z0-9_]+)",
|
|
25
|
+
"transform": [
|
|
26
|
+
"trim"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"origin": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Protocol and domain to navigate to. Prepended to `url`.",
|
|
32
|
+
"transform": [
|
|
33
|
+
"trim"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"statusCodes": {
|
|
37
|
+
"description": "Accepted status codes. If the specified URL returns a code other than what is specified here, the action fails.",
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{
|
|
40
|
+
"type": "integer"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"oneOf": [
|
|
46
|
+
{
|
|
47
|
+
"type": "integer"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"default": [
|
|
54
|
+
200,
|
|
55
|
+
301,
|
|
56
|
+
302,
|
|
57
|
+
307,
|
|
58
|
+
308
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"components": {
|
|
65
|
+
"schemas": {
|
|
66
|
+
"string": {
|
|
67
|
+
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
68
|
+
"type": "string",
|
|
69
|
+
"pattern": "(^(http://|https://|/).*|\\$[A-Za-z0-9_]+)",
|
|
70
|
+
"transform": [
|
|
71
|
+
"trim"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"object": {
|
|
75
|
+
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
76
|
+
"type": "object",
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"required": [
|
|
79
|
+
"url"
|
|
80
|
+
],
|
|
81
|
+
"properties": {
|
|
82
|
+
"url": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "URL to check. Can be a full URL or a path. If a path is provided, `origin` must be specified.",
|
|
85
|
+
"pattern": "(^(http://|https://|/).*|\\$[A-Za-z0-9_]+)",
|
|
86
|
+
"transform": [
|
|
87
|
+
"trim"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"origin": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Protocol and domain to navigate to. Prepended to `url`.",
|
|
93
|
+
"transform": [
|
|
94
|
+
"trim"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"statusCodes": {
|
|
98
|
+
"description": "Accepted status codes. If the specified URL returns a code other than what is specified here, the action fails.",
|
|
99
|
+
"anyOf": [
|
|
100
|
+
{
|
|
101
|
+
"type": "integer"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "array",
|
|
105
|
+
"items": {
|
|
106
|
+
"oneOf": [
|
|
107
|
+
{
|
|
108
|
+
"type": "integer"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"default": [
|
|
115
|
+
200,
|
|
116
|
+
301,
|
|
117
|
+
302,
|
|
118
|
+
307,
|
|
119
|
+
308
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"examples": [
|
|
127
|
+
"https://www.google.com",
|
|
128
|
+
"/search",
|
|
129
|
+
{
|
|
130
|
+
"url": "https://www.google.com",
|
|
131
|
+
"statusCodes": 200
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"url": "/search",
|
|
135
|
+
"origin": "www.google.com",
|
|
136
|
+
"statusCodes": [
|
|
137
|
+
200
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "click",
|
|
4
|
+
"description": "Click or tap an element.",
|
|
5
|
+
"anyOf": [
|
|
6
|
+
{
|
|
7
|
+
"description": "Kind of click to perform.",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": [
|
|
10
|
+
"left",
|
|
11
|
+
"right",
|
|
12
|
+
"middle"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"button": {
|
|
19
|
+
"description": "Kind of click to perform.",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": [
|
|
22
|
+
"left",
|
|
23
|
+
"right",
|
|
24
|
+
"middle"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"elementText": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Display text of the element to click. If combined with `selector`, the element must match both the text and the selector."
|
|
30
|
+
},
|
|
31
|
+
"selector": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Selector of the element to click. If combined with `elementText`, the element must match both the text and the selector."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"nullable": true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"components": {
|
|
43
|
+
"schemas": {
|
|
44
|
+
"button": {
|
|
45
|
+
"description": "Kind of click to perform.",
|
|
46
|
+
"type": "string",
|
|
47
|
+
"enum": [
|
|
48
|
+
"left",
|
|
49
|
+
"right",
|
|
50
|
+
"middle"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"object": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"button": {
|
|
57
|
+
"description": "Kind of click to perform.",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"enum": [
|
|
60
|
+
"left",
|
|
61
|
+
"right",
|
|
62
|
+
"middle"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"elementText": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "Display text of the element to click. If combined with `selector`, the element must match both the text and the selector."
|
|
68
|
+
},
|
|
69
|
+
"selector": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "Selector of the element to click. If combined with `elementText`, the element must match both the text and the selector."
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"examples": [
|
|
78
|
+
true,
|
|
79
|
+
"right",
|
|
80
|
+
{
|
|
81
|
+
"button": "left",
|
|
82
|
+
"elementText": "Element text"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"selector": "#elementToScreenshot",
|
|
86
|
+
"elementText": "Element text",
|
|
87
|
+
"button": "middle"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|