Socket
Book a DemoInstallSign in
Socket

infohub-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infohub-client

Client library for CCV3 Infohub API

1.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

infohub-client

InformationHub

Information Hub Access. Simple shim for the Information Hub Data API. Provides CRUD operations.

For now, only implements operations on entities -- Create, Update, Read, Read Multiple, Delete and Delete Multiple. To be extended as we get a better idea of actual requirements.

The selection, attribute and cursor parameters passed to operations have the same format as defined by the Information Hub Data API.

The response object returned by operations has the same properties as defined by the Information Hub Data API. In addition, it is annotated with these methods:

  • response.anyProblems() - returns true if errors are present
  • response.errors.toError() - returns an Error object for the response errors (undefined if there are no errors)
  • response.errors.throw() - throws an error if there are response errors; does nothing otherwise

The Information Hub Access module accepts these configuration properties:

  • baseURL - The base URL for the Information Hub Data API; default is http://localhost/dataapi/, note the trailing slash (/).

For use in Nxus projects, wrap this client as the proxy for a NxusModule to pass in configuration from nxus config:

import {NxusModule} from 'nxus-core'

import {default as Client} from 'infohub-client'

class InformationHub extends NxusModule {

constructor(options) {
  super()
  this.client = new Client({baseURL: this.config.baseURL})
  this.__proxy.use(this.client)
}

} var informationHub = InformationHub.getProxy()

export {InformationHub as default, informationHub}

Parameters

  • options Object configuration options; for now, the only option is baseURL, which sets the base URL for the information hub service

getEntity

Gets an entity specified by id.

Parameters

  • id string entity id
  • attrs Object (optional) attribute parameters

Returns Promise Promise that resolves to a response object.

getEntities

Gets entities specified by selection parameters.

Parameters

  • sel Object selection parameters
  • attrs Object (optional) attribute parameters
  • cursor Object (optional) cursor parameters

Returns Promise Promise that resolves to a response object.

createEntity

Creates an entity.

Parameters

Returns Promise Promise that resolves to a response object.

updateEntity

Updates an entity specified by id.

Parameters

Returns Promise Promise that resolves to a response object.

deleteEntity

Deletes an entity specified by id.

Parameters

Returns Promise Promise that resolves to a response object.

deleteEntities

Deletes entities specified by selection parameters.

Parameters

  • sel Object selection parameters

Returns Promise Promise that resolves to a response object.

getSchemas

Gets schemas

Parameters

  • sel
  • attrs
  • cursor
  • cache (optional, default true)

Returns Promise Promise that resolves to a response object.

FAQs

Package last updated on 28 Jul 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.