doc-detective-common 1.2.6 → 1.2.8
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/.devcontainer/devcontainer.json +28 -16
- package/dev/dev.js +3 -0
- package/package.json +4 -4
- package/src/index.js +5 -0
- package/src/schemas/dereferenceSchemas.js +46 -0
- package/src/schemas/index.js +22 -0
- package/src/schemas/output_schemas/analytics_v1.schema.json +586 -0
- package/src/schemas/output_schemas/checkLink_v1.schema.json +43 -0
- package/src/schemas/output_schemas/checkLink_v2.schema.json +65 -0
- package/src/schemas/output_schemas/click_v1.schema.json +61 -0
- package/src/schemas/output_schemas/config_v2.schema.json +780 -0
- package/src/schemas/output_schemas/context_v2.schema.json +76 -0
- package/src/schemas/output_schemas/find_v1.schema.json +172 -0
- package/src/schemas/output_schemas/find_v2.schema.json +97 -0
- package/src/schemas/output_schemas/goTo_v1.schema.json +31 -0
- package/src/schemas/output_schemas/goTo_v2.schema.json +49 -0
- package/src/schemas/output_schemas/httpRequest_v1.schema.json +116 -0
- package/src/schemas/output_schemas/httpRequest_v2.schema.json +192 -0
- package/src/schemas/output_schemas/matchText_v1.schema.json +33 -0
- package/src/schemas/output_schemas/moveMouse_v1.schema.json +61 -0
- package/src/schemas/output_schemas/runShell_v1.schema.json +36 -0
- package/src/schemas/output_schemas/runShell_v2.schema.json +63 -0
- package/src/schemas/output_schemas/saveScreenshot_v2.schema.json +42 -0
- package/src/schemas/output_schemas/screenshot_v1.schema.json +49 -0
- package/src/schemas/output_schemas/scroll_v1.schema.json +51 -0
- package/src/schemas/output_schemas/setVariables_v2.schema.json +39 -0
- package/src/schemas/output_schemas/spec_v2.schema.json +1078 -0
- package/src/schemas/output_schemas/startRecording_v1.schema.json +56 -0
- package/src/schemas/output_schemas/startRecording_v2.schema.json +48 -0
- package/src/schemas/output_schemas/stopRecording_v1.schema.json +21 -0
- package/src/schemas/output_schemas/test_v2.schema.json +859 -0
- package/src/schemas/output_schemas/typeKeys_v2.schema.json +56 -0
- package/src/schemas/output_schemas/type_v1.schema.json +63 -0
- package/src/schemas/output_schemas/wait_v1.schema.json +43 -0
- package/src/schemas/output_schemas/wait_v2.schema.json +42 -0
- package/src/validate.js +1 -1
- package/test/schema.test.js +1 -2
- package/index.js +0 -5
- package/src/schema.js +0 -46
- /package/src/schemas/{analytics_v1.schema.json → src_schemas/analytics_v1.schema.json} +0 -0
- /package/src/schemas/{checkLink_v1.schema.json → src_schemas/checkLink_v1.schema.json} +0 -0
- /package/src/schemas/{checkLink_v2.schema.json → src_schemas/checkLink_v2.schema.json} +0 -0
- /package/src/schemas/{click_v1.schema.json → src_schemas/click_v1.schema.json} +0 -0
- /package/src/schemas/{config_v2.schema.json → src_schemas/config_v2.schema.json} +0 -0
- /package/src/schemas/{context_v2.schema.json → src_schemas/context_v2.schema.json} +0 -0
- /package/src/schemas/{find_v1.schema.json → src_schemas/find_v1.schema.json} +0 -0
- /package/src/schemas/{find_v2.schema.json → src_schemas/find_v2.schema.json} +0 -0
- /package/src/schemas/{goTo_v1.schema.json → src_schemas/goTo_v1.schema.json} +0 -0
- /package/src/schemas/{goTo_v2.schema.json → src_schemas/goTo_v2.schema.json} +0 -0
- /package/src/schemas/{httpRequest_v1.schema.json → src_schemas/httpRequest_v1.schema.json} +0 -0
- /package/src/schemas/{httpRequest_v2.schema.json → src_schemas/httpRequest_v2.schema.json} +0 -0
- /package/src/schemas/{matchText_v1.schema.json → src_schemas/matchText_v1.schema.json} +0 -0
- /package/src/schemas/{moveMouse_v1.schema.json → src_schemas/moveMouse_v1.schema.json} +0 -0
- /package/src/schemas/{runShell_v1.schema.json → src_schemas/runShell_v1.schema.json} +0 -0
- /package/src/schemas/{runShell_v2.schema.json → src_schemas/runShell_v2.schema.json} +0 -0
- /package/src/schemas/{saveScreenshot_v2.schema.json → src_schemas/saveScreenshot_v2.schema.json} +0 -0
- /package/src/schemas/{screenshot_v1.schema.json → src_schemas/screenshot_v1.schema.json} +0 -0
- /package/src/schemas/{scroll_v1.schema.json → src_schemas/scroll_v1.schema.json} +0 -0
- /package/src/schemas/{setVariables_v2.schema.json → src_schemas/setVariables_v2.schema.json} +0 -0
- /package/src/schemas/{spec_v2.schema.json → src_schemas/spec_v2.schema.json} +0 -0
- /package/src/schemas/{startRecording_v1.schema.json → src_schemas/startRecording_v1.schema.json} +0 -0
- /package/src/schemas/{startRecording_v2.schema.json → src_schemas/startRecording_v2.schema.json} +0 -0
- /package/src/schemas/{stopRecording_v1.schema.json → src_schemas/stopRecording_v1.schema.json} +0 -0
- /package/src/schemas/{test_v2.schema.json → src_schemas/test_v2.schema.json} +0 -0
- /package/src/schemas/{typeKeys_v2.schema.json → src_schemas/typeKeys_v2.schema.json} +0 -0
- /package/src/schemas/{type_v1.schema.json → src_schemas/type_v1.schema.json} +0 -0
- /package/src/schemas/{wait_v1.schema.json → src_schemas/wait_v1.schema.json} +0 -0
- /package/src/schemas/{wait_v2.schema.json → src_schemas/wait_v2.schema.json} +0 -0
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
2
|
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
|
|
3
3
|
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
"name": "Ubuntu",
|
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
|
+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
|
|
7
|
+
"features": {
|
|
8
|
+
"ghcr.io/devcontainers/features/node:1": {}
|
|
9
|
+
},
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
12
|
+
// "features": {},
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
15
|
+
// "forwardPorts": [],
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
18
|
+
"postCreateCommand": "npm i",
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// Configure tool-specific properties.
|
|
21
|
+
"customizations": {
|
|
22
|
+
// Configure properties specific to VS Code.
|
|
23
|
+
"vscode": {
|
|
24
|
+
// Add the IDs of extensions you want installed when the container is created.
|
|
25
|
+
"extensions": [
|
|
26
|
+
"github.copilot",
|
|
27
|
+
"aaron-bond.better-comments",
|
|
28
|
+
"esbenp.prettier-vscode",
|
|
29
|
+
"GitHub.vscode-pull-request-github",
|
|
30
|
+
"streetsidesoftware.code-spell-checker"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
36
|
+
// "remoteUser": "root"
|
|
25
37
|
}
|
package/dev/dev.js
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective-common",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
|
|
3
|
+
"version": "1.2.8",
|
|
5
4
|
"description": "Shared components for Doc Detective projects.",
|
|
6
|
-
"main": "index.js",
|
|
5
|
+
"main": "src/index.js",
|
|
7
6
|
"scripts": {
|
|
8
|
-
"
|
|
7
|
+
"dereferenceSchemas": "node ./src/schemas/dereferenceSchemas.js",
|
|
8
|
+
"test": "npm run dereferenceSchemas && jest"
|
|
9
9
|
},
|
|
10
10
|
"precommit": "test",
|
|
11
11
|
"repository": {
|
package/src/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const parser = require("@apidevtools/json-schema-ref-parser");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const { exit } = require("process");
|
|
5
|
+
|
|
6
|
+
(async () => {
|
|
7
|
+
await dereferenceSchemas();
|
|
8
|
+
})();
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Walks through all schema in src/src_schema
|
|
12
|
+
* For each schema, dereferences it and writes it to src/schema
|
|
13
|
+
*/
|
|
14
|
+
async function dereferenceSchemas() {
|
|
15
|
+
const inputDir = path.resolve(`${__dirname}/src_schemas`);
|
|
16
|
+
const outputDir = path.resolve(`${__dirname}/output_schemas`);
|
|
17
|
+
const files = fs.readdirSync(inputDir);
|
|
18
|
+
for await (const file of files) {
|
|
19
|
+
const filePath = path.resolve(`${inputDir}/${file}`);
|
|
20
|
+
// Load from file
|
|
21
|
+
let schema = fs.readFileSync(filePath).toString();
|
|
22
|
+
// Convert to JSON
|
|
23
|
+
schema = JSON.parse(schema);
|
|
24
|
+
// Set ID
|
|
25
|
+
schema.$id = `${filePath}`;
|
|
26
|
+
// Update references to current relative path
|
|
27
|
+
schema = updateRefPaths(schema, inputDir);
|
|
28
|
+
// Dereference schema
|
|
29
|
+
schema = await parser.dereference(schema);
|
|
30
|
+
// Write to file
|
|
31
|
+
fs.writeFileSync(`${outputDir}/${file}`, JSON.stringify(schema, null, 2));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Prepend app-root path to referenced relative paths
|
|
36
|
+
function updateRefPaths(schema) {
|
|
37
|
+
for (let [key, value] of Object.entries(schema)) {
|
|
38
|
+
if (typeof value === "object") {
|
|
39
|
+
updateRefPaths(value);
|
|
40
|
+
}
|
|
41
|
+
if (key === "$ref") {
|
|
42
|
+
schema[key] = path.resolve(`${__dirname}/src_schemas/${value}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return schema;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
|
|
3
|
+
exports.schemas = loadSchemas();
|
|
4
|
+
|
|
5
|
+
// Load schemas from file
|
|
6
|
+
function loadSchemas() {
|
|
7
|
+
const schemas = {};
|
|
8
|
+
// Read files from schema directory
|
|
9
|
+
path = `${__dirname}/output_schemas`;
|
|
10
|
+
var files = fs.readdirSync(path);
|
|
11
|
+
// Loop through all schema files
|
|
12
|
+
files.forEach(async (file) => {
|
|
13
|
+
// Exit early for files that don't match naming pattern
|
|
14
|
+
if (!file.includes(".schema.json")) return;
|
|
15
|
+
const key = file.replace(".schema.json", "");
|
|
16
|
+
// Load schema from file
|
|
17
|
+
let schema = require(`./output_schemas/${file}`);
|
|
18
|
+
// Load into `schema` object
|
|
19
|
+
schemas[key] = schema;
|
|
20
|
+
});
|
|
21
|
+
return schemas;
|
|
22
|
+
}
|