Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ubio/protocol

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ubio/protocol

ubio Automation Protocol

npmnpm
Version
0.2.1
Version published
Weekly downloads
13
-79.69%
Maintainers
1
Weekly downloads
 
Created
Source

ubio Automation Protocol

Note: This repository is under active development. Please expect breaking changes in v0.x.x releases.

Terminology

Domain is a colection of input, output and type definitions. Domains are uniquely identified by id which is a PascalCase string. Example: FlightBooking.

Definition is a JSON Schema object, uniquely identified by id, which consists of domain id and definition key, separated with dot. Example: Generic.Price.

Definitions also have $id attribute which is a fragment identifier used to uniquely reference definitions in JSON Schema validation. Example: #Generic.Price.

Public API

protocol.getAllDomains(): Array

Returns an array of all Domain instances supported by protocol.

protocol.getDomain(id: String): Domain?

Returns Domain instance with specified id, or null if no such domain exists.

protocol.getDef(domainId: String, key: String): Def?

Returns Def instance by specified domainId and key, or null if no such definition exists.

protocol.getDef(id: String): Def?

Returns Def instance by definition id (domainId and key, separated with dot) or null if no such definition exists.

async protocol.validate(id: String, object: Any): { valid: Boolean, errors: Array? }

Validates specified object against definition JSON schema.

Definition is resolved by definition id.

If object is invalid, errors will contain an array of errors in AJV-compatible format.

async protocol.validate(domainId: String, key: String, object: Any): { valid: Boolean, errors: Array? }

Validates specified object against definition JSON schema.

Definition is resolved by definition domainId and key.

If object is invalid, errors will contain an array of errors in AJV-compatible format.

domain.getInputs(): Array

Returns all input definitions of domain.

domain.getOutputs(): Array

Returns all output definitions of domain.

domain.getTypes(): Array

Returns all type definitions of domain.

domain.getDefs(): Array

Returns all definitions of domain.

domain.getDef(key: String): Array

Returns Def instance belonging to this domain by key, or null if no such definition exists.

def.validate(object): { valid: Boolean, errors: Array? }

Validates specified object against definition JSON schema.

If object is invalid, errors will contain an array of errors in AJV-compatible format.

FAQs

Package last updated on 17 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts