Shared resources for Doc Detective projects.
npm i doc-detective-common
const common = require("doc-detective-common");
Validate that object
matches the specified schema definition.
Returns an object with the following schema:
{
"valid": boolean,
"errors": [
{
"instancePath": string,
"schemaPath": string,
"keyword": string,
"params": [{Object}],
"message": string
}
]
}
const schemaKey = "runShell_v1";
const object = {
action: "runShell",
command: "echo $username",
};
console.log(common.validate(schemaKey, object));
Load file contents from a URL or a file path. If a JSON or YAML file, returns an object. If a different file, returns a string.
JSON schema definitions for various objects used throughout Doc Detective.
Schema objects are located in the /schemas
directory and made available through the .schemas
object.
{
"analytics_v1": {Object},
"checkLink_v1": {Object},
"click_v1": {Object},
"find_v1": {Object},
"goTo_v1": {Object},
"httpRequest_v1": {Object},
"matchText_v1": {Object},
"moveMouse_v1": {Object},
"runShell_v1": {Object},
"screenshot_v1": {Object},
"scroll_v1": {Object},
"startRecording_v1": {Object},
"stopRecording_v1": {Object},
"type_v1": {Object},
"wait_v1": {Object}
}