@waylay/client

2.45.0-beta.2

Waylay SDK

The Javascript SDK that lets you use the Waylay REST Services.

Waylay

Waylay
Parameters
options (Object?) configuration options for this waylay client
Name Description
options.gateway string? the api gateway url prefix, hostname or id ( production , on-demand , ...). If set, the client uses the API gateway if supported (and not overridden by options.<service>.baseUrl ).
options.clientID string? [Deprecated] the clientID (apiKey) to authenticate this client
options.secret string? [Deprecated] the secret (apiSecret) to authenticate this client
options.domain string? [Deprecated] the tenant domain used by this client (for authentication and as default endpoint). Note that any domain in the token takes precedence.
options.token string? the jwt token to authenticate this client (alternative to clientId, secret, domain arguments).
options.globalSettings Object? the organisation settings to use for this client (see withSettings ).
options.enforceGateway boolean (default false) if true, only allow the waylay client to use API gateway endpoints (except those configured through options.<service>.baseUrl ).
options.enforceConfigured boolean (default false) if true, only allow the waylay client to use configured enpoints (no fallback to hardcoded production endpoints or legacy domain api).
Properties
data (Data?) : the data service
resources (Resources?) : the resources service
alarms (Alarms?) : the alarms service
types (Types?) : the types service
constraints (Constraints?) : the constraints service
transformers (Transformers?) : the transformers service
tasks (Tasks?) : the tasks service
templates (Templates?) : the templates service
sensors (Sensors?) : the sensors service
actuators (Actuators?) : the actuators service
converter (Converter?) : the converter service
webscripts (Webscripts?) : the webscripts service
byoml (Byoml?) : the byoml service
storage (Storage?) : the storage service
analytics (Analytics?) : the analytics service
vault (Vault?) : the vault service
stats (Stats?) : the stats service
account (Account?) : the account service
users (Users?) : the users service
tenants (Tenants?) : the tenants service
roles (Roles?) : the roles service
predefinedRoles (PredefinedRoles?) : the predefinedRoles service
permissions (Permissions?) : the permissions service
twoFA (TwoFA?) : the twoFA service
hoard (Hoard?) : the hoard service
nlp (Nlp?) : the nlp service
Example
const Waylay = require('@waylay/client')
const gateway = 'https://api-io.waylay.io'
// authenticate with apiKey/apiSecret
const waylay = new Waylay({ gateway })
await waylay.authenticate(myApiKey, myApiSecret)
// ... or login with username/password
const waylay = new Waylay({ gateway })
await waylay.login(username, password, domain)
// ... or initialise with waylay token
const waylay = new Waylay({ gateway, token: myStoredWaylayJwtToken})
// Legacy configuration without gateway:
// configure waylay endpoints from tenant configuration automatically
const waylay = new Waylay({ domain: 'my-domain.waylay.io', clientID: mayApiKey, secret: myApiSecret })
await waylay.loadSettings()
// ... or provide the tenant organisation settings yourself
const waylay = waylay.withSettings(myOrgSettings)
Instance Members
token
token
domain
domain
login(email, password, domain?, otpCode?)
authenticate(apiKey, apiSecret)
ping()
me()
loadSettings()
withSettings(settings?)
settings()
baseUrl

Waylay Services

The Waylay client gives acces to the following REST Resources.

Data

Data

Extends Resource

Instance Members
getSeries(resource, params)
postSeries(message, params)
postSeries(resourceOrBulkEvent, messageOrParams, params?)
deleteSeries(resource, metrics, params = {})
getMetricSeries(resource, metric, options)
getLastDatapointsForMetric(resource, metric, options?)
getDatapointsForMetricRaw(resource, metric, options?)
queryTimeSeries(query)
queryMessages(query)
getLastMetric(resource, metric)
getLatestDocument(resource)
getLatestMessages(resource, filter?)
remove(resource, params?)

Resources

Resources
Static Members
batch
Instance Members
data
create(resource)
get(id, opts)
children(id, params?)
parent(id)
references(id)
referrers(id, params)
update(id, resource)
replace(id, resource)
remove(id)
search(params, opts = {})
executeCommand(resource, command, properties)
commandLogs(resource, opts)
changelog(resource, query)

Types

Types
Static Members
batch
Instance Members
create(type)
remove(id)
update(id, type)
patch(id, data)
list(qs)
get(id)
constraints(id, options)
revalidate(id)
changelog(id, query)

Constraints

Constraints
Instance Members
list(params?, options)
get(id)
create(constraint)
update(id, constraint)
remove(id)

Alarms

Alarms
Static Members
batch
Instance Members
create(alarm)
get(id)
search(query)
timeline(resourceIds, from?, to?)
update(id, alarm)
remove(id)
removeAll(filter)

Transformers

Transformers

Extends Plugs

Related
Plugs

Tasks

Tasks
Static Members
batch
Instance Members
create(task, params?)
update(id, task)
list(filter?, params?, options?)
remove(id)
batchRemove(taskIdList)
get(id, params, options)
start(id)
stop(id)
stopAndRemove(id)
log(options)
pushState(id, node, state)
patchNode(id, node, data)

Templates

Templates

Extends Resource

Instance Members
create(template, params?)
update(name, template, params?)
list(filter?, params?, options?)
get(name, params)
remove(id)
variables(graph)
declarativeBindings(graph)
getDiscoveryTemplate()
setDiscoveryTemplate(name?)
patch(params, command)

Sensors

Sensors

Extends Plugs

Related
Plugs

Actuators

Actuators

Extends Plugs

Related
Plugs

Plugs

Plugs
Instance Members
execute(name, version, body)
debug(scriptContext)
list(query, opts)
get(name, version, params)
create(plug)
remove(name, params, force)
getScript(name, version)
getVersions(name, params)
patchMetadata(name, version, metadata)
patchDocumentation(name, version, documentation)

Converter

Configure and test converter configurations for channels

Converter
Instance Members
getAll()
get(converterName)
create(converterName, type, template)
update(converterName, type, template)
delete(converterName)
convert(converterName, payload, params)
test(type, template, payload)

Webscripts

Webscripts

Extends Resource

Parameters
options (any)
client (any)
Instance Members
call(namespace, name, version, body)
list(params, opts)
exists(name)
get(name, version)
create(webscript)
remove(name)
update(name, webscript)
log(name, version)

Byoml

Byoml
Instance Members
list()
get(name)
exampleInput(name)
predict(name, payload)
regress(name, payload)
classify(name, payload)
remove(name)
patch(name, model)

Queries

Execute multivariate timeseries queries. Query definitions can be stored and called by name. (doc)

Queries
Instance Members
execute(queryNameOrDefinition, params?, options?)
list(params?, options?)
get(queryName, params?, options?)
create(queryName, queryDefinition, metaData?, params?, options?)
update(queryName, queryDefinition, metaData?, params?, options?)
remove(queryName, params?, options?)

Storage

The waylay Storage service that interacts with file storage objects.

Storage
Properties
bucket (StorageBucket?) : Manage the buckets using the /bucket/ API.
object (StorageObject?) : Manage the file objects using the /bucket/{bucket}/{object_path} API.
folder (StorageFolder?) : Manage the folder objects using the /bucket/{bucket}/{folder_path}/ API.
content (StorageContent?) : Access and modify the actual content of file objects, using signed urls.
subscription (StorageSubscription?) : Manage the subscriptions of the storage service using the /subscription API.
Static Members
new StorageBucket()
new StorageObject()
new StorageFolder()
new StorageSubscription()
new StorageContent(params, client)

Admin Services

The following services manage users, authorizations and settings for the Waylay platform.

Admin Services
Static Members
Account
OrganisationSettings
Vault
Users
Tenants
Roles
PredefinedRoles
Permissions
TwoFA
Hoard

Deprecated Services

Deprecated Services
Static Members
Analytics
Stats

Storage Entities

Request/Response message objects for Waylay Storage

Storage Entities
Static Members
StorageBucketEntity
StorageObjectEntity
StorageStoreEntity
StorageSubscriptionEntity
SubscriptionChannel
SubscriptionFilter
StorageNotification
HALResponse
PagedListResponse
PagedRemoveResponse

Queries Entities

Request/Response message objects for Waylay Query

Queries Entities
Static Members
QueryResponse
RowDataResponse
SeriesDataResponse
MessageObject
QueryDefinition
SeriesDefinition
SearchFilter
QueryDefinitionListResponse
QueryDefinitionEntry
QueryDefinitionResponse
SystemAttributes
UserAttributes

Rule Engine Entities

Request/Response message objects for the rule Engine

Rule Engine Entities
Static Members
TemplateFilterParams
PatchCommand
UpdatePlugPatch