doc-detective-common

1.21.0 • Public • Published

Doc Detective Common

Current version NPM Shield Discord Shield

Shared resources for Doc Detective projects.

Install

npm i doc-detective-common

Init

const common = require("doc-detective-common");

Methods

.validate(schemaKey: string, object: object)

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
    }
  ]
}

Usage

const schemaKey = "runShell_v1";
const object = {
  action: "runShell",
  command: "echo $username",
};
console.log(common.validate(schemaKey, object));

.readFile(fileURL)

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.

Objects

.schemas

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}
}

Readme

Keywords

none

Package Sidebar

Install

npm i doc-detective-common

Weekly Downloads

124

Version

1.21.0

License

MIT

Unpacked Size

802 kB

Total Files

82

Last publish

Collaborators

  • hawkeyexl