@waylay/client

3.4.9

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? Sets the gateway host or url prefix that will be used as an endpoint prefix for each service.
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
types (Types?) : The types service
constraints (Constraints?) : The constraints service
alarms (Alarms?) : The alarms 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
queries (Queries?) : The queries service
storage (Storage?) : The storage service
registry (Registry?) : (PREVIEW) The registry v2 service
account (Account?) : The account service
organisationSettings (OrganisationSettings?) : The settings service
vault (Vault?) : The vault 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
license (License?) : The license service
stats (Stats?) : (DEPRECATED) the stats 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
▸ refreshToken
▸ domain
▸ domain
▸ login(email, password, domain?, otpCode?)
▸ authenticate(apiKey, apiSecret)
▸ ping()
▸ me()
▸ loadSettings()
▸ withSettings(settings?)
▸ settings()
▸ baseUrl
▸ gateway
▸ gateway

Waylay Services

The Waylay client gives access 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?)
▸ ws(resource?)

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, params?)
▸ search(params, opts = {})
▸ changelog(resource, query)

Types

Types
Static Members
▸ batch
Instance Members
▸ create(type)
▸ remove(id)
▸ update(id, type)
▸ patch(id, data)
▸ list(qs, opts = {})
▸ 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?)
▸ count(options)
▸ remove(id, forceStop)
▸ batchRemove(taskIdList)
▸ get(id, params, options)
▸ start(id)
▸ stop(id)
▸ stopAndRemove(id)
▸ log(options)
▸ logsUrl(searchParams)
▸ eventsUrl(taskId)
▸ performNodeAction(id, node, params)
▸ pushState(id, node, state)
▸ patchNode(id, node, data)

Templates

Templates

Extends Resource

Parameters
options ((Options | null))
client (Client)
Instance Members
▸ create(template, params?)
▸ update(name, template, params?)
▸ copy(name, newName, options = {})
▸ list(filter?, params?, options?)
▸ get(name, params)
▸ remove(id)
▸ variables(graph)
▸ declarativeBindings(graph)
▸ getDiscoveryTemplate()
▸ setDiscoveryTemplate(name?)
▸ patch(params, command)
▸ getRun(id)
▸ run(id, data, params = {}, options?)
▸ debug(name?, data, params = {nodeToDebug:''}, options?)

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, versionOrParams, params, version)
▸ create(plug)
▸ remove(name, params)
▸ removeVersion(name, version, params)
▸ getScript(name, version)
▸ getVersions(name, params)
▸ patchMetadata(name, version, metadata)
▸ patchDocumentation(name, version, documentation)
▸ listTags(params)
▸ getTag(name)

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

the Waylay Webscripts service

Webscripts
Properties
logs (WebscriptLogs?) : Access logs for webscripts using /webscripts/ API endpoint
Static Members
▸ new WebscriptLogs()
Instance Members
▸ logs
▸ call(namespace, name, version = 'latest', body?, options?)
▸ list(params, opts)
▸ exists(name)
▸ get(name, version)
▸ create(webscript)
▸ remove(name)
▸ update(name, webscript)
▸ log(name, version)
▸ operation(name)
▸ triggerUrl(tenant, 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
▸ License

Preview Services

The following services are preview features

Registry

The waylay Plug Registry service that manages the life cycle of functions. This SDK uses the registry v2 REST api and superseeds the legacy lifecyle management calls in sensors, actuators, transformers and webscripts.

Registry
Properties
runtimes (Registry.Runtimes?) : Access and list the supported runtimes for functions.
jobs (Registry.Jobs?) : Access and List jobs and their corresponding events.
webscripts (Registry.Webscripts?) : List and manage webscripts .
plugs (Registry.Plugs?) : List and manage plugs .
models (Registry.Models?) : List and manage models .
Static Members
▸ new Runtimes()
▸ new Jobs()
▸ new Webscripts(options, client?)
▸ new Plugs(options, client?)
▸ new Models(options, client?)

Deprecated Services

Stats

Allows you to retrieve Waylay application statistics

Stats
Deprecated: This service is only use for legacy reasons, replaced by the Billing service.
Instance Members
▸ getMetrics(params?)
▸ getMetric(name, params?)

Storage Entities

Request/Response message objects for Waylay Storage

Storage Entities
Static Members
▸ StorageBucketEntity
▸ StorageObjectEntity
▸ StorageStoreEntity
▸ StorageSubscriptionEntity
▸ SubscriptionChannel
▸ SubscriptionFilter
▸ StorageNotification
▸ HALResponse
▸ PagedListResponse
▸ PagedRemoveResponse
▸ URLParams
▸ ListParams
▸ SignParams
▸ DeleteParams

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
▸ PatchCommand
▸ UpdatePlugPatch
▸ PlugVersion
▸ PlugExecutionData
▸ ListPlugTagParams
▸ Task
▸ TaskType
▸ TaskStatus
▸ TaskDefaults
▸ TaskOutput
▸ LogEntry
▸ Sensor
▸ Template
▸ TemplateNode
▸ TemplateMetadata
▸ TemplateNote
▸ TemplateNodePosterior
▸ TemplateRun
▸ TemplateURLParams
▸ TemplateFilterParams
▸ TemplateRunParams
▸ TemplateRunData
▸ TemplateRunResult
▸ TemplateRunResponse
▸ TemplateDebugResult
▸ TemplateDebugParams
▸ TemplateDebugData
▸ DataItem
▸ TemplateRunConfiguration
▸ ResourceMetaData
▸ Variable

Registry Entities

Request/Response message objects for Registry

Registry Entities
Static Members
▸ TagEntity
▸ InterfacePropertyEntity
▸ AsyncQueryParams
▸ Documentation
▸ DocumentationProperty
▸ MetadataBody
▸ PlugMetadata
▸ PlugInterface
▸ PlugPatchManifest
▸ WebscriptPatchManifest
▸ ModelPatchManifest
▸ PatchManifest
▸ EventSourceResponse
▸ RegistryURLParams
▸ FunctionArchiveContent
▸ FunctionDownloadOptions
▸ FunctionMeta
▸ FunctionPatchManifest
▸ FunctionUploadOptions
▸ FunctionDeployOverrides
▸ ResourceLimits
▸ EmptyRequest
▸ RegistryResponse

Admin Entities

Request and response objects for the Admin services.

Admin Entities
Static Members
▸ Me
▸ LegacyMe
▸ ApiCredentials
▸ ApiKey
▸ UserFilter
▸ UserFilterUpdateContent
▸ TenantInfo
▸ LicenseStatus
▸ LicenseKey
▸ LicenseDetails
▸ LicenseMetricDefinitions
▸ LicenseMetricBreachSummary

Common Entities

Common type definitions for the Waylay SDK.

Common Entities
Static Members
▸ ResponseType
▸ RequestOptions

Webscript Entities

Type definitions for the Webscript services.

Webscript Entities
Static Members
▸ WebscriptURLParams
▸ WebscriptLogsResponse
▸ WebscriptLogsResponseEntry
▸ WebscriptLogsRequestBody