Function
Static Public Summary | ||
public |
addReferences(nodeId: NodeId, references: Object): Promise Adds references to a node. |
|
public |
async approveToContinue(undefined: HookContext, error: Error): Promise |
|
public |
async askForConfirmation(undefined: undefined): Promise |
|
public |
callMethod(methodId: NodeId, args: Array<node-opcua~Variant>): * Calls an OPC-UA method on the server. |
|
public |
callScript(scriptId: NodeId, parameters: Object): * Calls a server script on the server. |
|
public |
async checkAtserver(context: HookContext): Promise |
|
public |
async checkServerscripts(undefined: HookContext): Promise |
|
public |
Cleans up after the app ended with the specified code or signal. |
|
public |
createNode(nodeId: NodeId, options: Object): * Creates a new Node on the server. |
|
public |
decodeVariant(buffer: Buffer, options: Object): * Returns a node-opcua~Variant from a Buffer with the given dataType and arrayType. |
|
public |
delay(ms: *): * Returns a promise that resolves after the given duration. |
|
public |
Creates a new WriteStream to write to path. |
|
public |
encodeVariant(variant: node-opcua~Variant): Buffer Returns a buffer containing a node-opcua~Variants encoded value. |
|
public |
escapeForRegExp(source: string): * Returns a string with all special regular expression characters escaped. |
|
public |
finishTask(): Promise<void> Closes open sessions once a task is complete. |
|
public |
Returns the fs~Stats for a path. |
|
public |
handleTaskError(error: Error) Adds additional infomation to the error's message and rethows it. |
|
public |
async importTask(): Promise<void> Imports all xml files needed for atscm usage. |
|
public |
isDefinitionFile(path: string): boolean Returns |
|
public |
async loadProjectRequirement(): Promise |
|
public |
async loadRemoteVersion(): Promise |
|
public |
performPull(nodes: NodeId[], options: Object): * Pulls the given nodes from the server. |
|
public |
performPush(path: string, options: Object): * Pushes the given path to the server. |
|
public |
Picks some properties from an object and returns a new object containing these. |
|
public |
promisified(fn: *) Wraps a function with an async callback in a promise. |
|
public |
Pulls all nodes from atvise server. |
|
public |
async push(): * Pushes AtviseFiles to atvise server. |
|
public |
Reads a single node's value. |
|
public |
reportProgress(task: Promise<any>, options: Object): * Prints the progress of a task. |
|
public |
Switches keys and values in an object. |
|
public |
setupContext(undefined: Partial): HookContext |
|
public |
sortReferences(references: Object): * Sorts the given references before they are persisted to disk. |
|
public |
Starts a new source browser at the given path. |
|
public |
async updateFile(path: string, update: UpdateFn, encoding: undefined): Promise |
|
public |
async updateJson(path: string, update: UpdateFn): Promise |
|
public |
validateDirectoryExists(directoryPath: string): Promise<fs~Stats, Error> Checks it a given path holds a directory and returns it's fs~Stats if found. |
|
public |
waitForDependencies(Stream: QueueStream): Class<WaitingStream> A mixin that transforms a regular stream into a WaitingStream, which makes it wait for a node's dependencies to be transformed. |
|
public |
async watch(options: Object): Promise<{serverwatcher: Watcher, fileWatcher: sane~Watcher}, Error>{serverwatcher:> The gulp task invoced when running |
|
public |
writeNode(nodeId: NodeId, value: node-opcua~Variant): Promise<node-opcua~StatusCodes Writes a single node's value. |
Static Public
public addReferences(nodeId: NodeId, references: Object): Promise source
import {addReferences} from 'atscm/src/api.js'
Adds references to a node.
Example:
import { ReferenceTypeIds } from 'node-opcua/lib/opcua_node_ids';
addReferences('AGENT.DISPLAYS.Main', {
[47]: ['VariableTypes.ATVISE.Display'],
// equals:
[ReferenceTypeIds.HasTypeDefinition]: ['VariableTypes.ATVISE.Display'],
})
.then(() => console.log('Done!'))
.catch(console.error);
public async approveToContinue(undefined: HookContext, error: Error): Promise source
import {approveToContinue} from 'atscm/src/hooks/check-atserver.ts'
Params:
Name | Type | Attribute | Description |
undefined | HookContext | ||
error | Error |
public async askForConfirmation(undefined: undefined): Promise source
import {askForConfirmation} from 'atscm/src/hooks/check-atserver.ts'
Params:
Name | Type | Attribute | Description |
undefined | undefined |
public callMethod(methodId: NodeId, args: Array<node-opcua~Variant>): * source
import {callMethod} from 'atscm/src/api.js'
Calls an OPC-UA method on the server.
Params:
Name | Type | Attribute | Description |
methodId | NodeId | The method's id. |
|
args | Array<node-opcua~Variant> | The arguments to pass. |
Return:
* |
public callScript(scriptId: NodeId, parameters: Object): * source
import {callScript} from 'atscm/src/api.js'
Calls a server script on the server.
Return:
* |
public async checkAtserver(context: HookContext): Promise source
import checkAtserver from 'atscm/src/hooks/check-atserver.ts'
Params:
Name | Type | Attribute | Description |
context | HookContext |
public async checkServerscripts(undefined: HookContext): Promise source
import checkServerscripts from 'atscm/src/hooks/check-serverscripts.ts'
Params:
Name | Type | Attribute | Description |
undefined | HookContext |
public cleanup(exitCode: number, signal: string, uninstall: function()): boolean source
import cleanup from 'atscm/src/util/cleanup.js'
Cleans up after the app ended with the specified code or signal.
Test:
public createNode(nodeId: NodeId, options: Object): * source
import {createNode} from 'atscm/src/api.js'
Creates a new Node on the server.
Params:
Name | Type | Attribute | Description |
nodeId | NodeId | The new node's id. |
|
options | Object | The options to use. |
|
options.name | string | The node's name. |
|
options.parentNodeId | NodeId |
|
The node's parent, defaults to the calculated parent
( |
options.nodeClass | node-opcua~NodeClass |
|
The node's class, defaults so
|
options.typeDefinition | NodeId |
|
The node's type definition, must be provided for non-variable nodes. |
options.modellingRule | NodeId |
|
The node's modelling rule. |
options.reference | string |
|
Name of the type of the node's reference to it's parent. |
options.value | node-opcua~Variant |
|
The node's value, required for all variable nodes. |
Return:
* |
public decodeVariant(buffer: Buffer, options: Object): * source
import {decodeVariant} from 'atscm/src/lib/coding.js'
Returns a node-opcua~Variant from a Buffer with the given dataType and arrayType.
Params:
Name | Type | Attribute | Description |
buffer | Buffer | The buffer to decode from. |
|
options | Object | The options to use. |
|
options.dataType | node-opcua~DataType | The data type to decode to. |
|
options.arrayType | node-opcua~VariantArrayType | The array type to decode to. |
Return:
* |
public delay(ms: *): * source
import {delay} from 'atscm/src/lib/helpers/async.ts'
Returns a promise that resolves after the given duration.
Params:
Name | Type | Attribute | Description |
ms | * | Milliseconds to delay. |
Return:
* | A promise resolved after the specified delay. |
Test:
public dest(path: string, options: Object): * source
import dest from 'atscm/src/lib/gulp/dest.js'
Creates a new WriteStream to write to path.
Params:
Name | Type | Attribute | Description |
path | string | The path to write to. |
|
options | Object |
|
The options to use. Passed to WriteStream#constructor. |
Return:
* |
public encodeVariant(variant: node-opcua~Variant): Buffer source
import {encodeVariant} from 'atscm/src/lib/coding.js'
Returns a buffer containing a node-opcua~Variants encoded value.
Params:
Name | Type | Attribute | Description |
variant | node-opcua~Variant | The variant to encode. |
Return:
Buffer | A buffer containing the encoded value. |
public escapeForRegExp(source: string): * source
import {escapeForRegExp} from 'atscm/src/lib/regexp.ts'
Returns a string with all special regular expression characters escaped.
Params:
Name | Type | Attribute | Description |
source | string |
Return:
* |
public finishTask(): Promise<void> source
import {finishTask} from 'atscm/src/lib/helpers/tasks.js'
Closes open sessions once a task is complete.
public getStat(path: string): Promise<fs~Stats, Error> source
import {getStat} from 'atscm/src/util/fs.js'
Returns the fs~Stats for a path.
Params:
Name | Type | Attribute | Description |
path | string | The path to look at. |
Return:
Promise<fs~Stats, Error> | Fulfilled with the requested stats or rejected with the error that occurred. |
Test:
public handleTaskError(error: Error) source
import {handleTaskError} from 'atscm/src/lib/helpers/tasks.js'
Adds additional infomation to the error's message and rethows it.
Params:
Name | Type | Attribute | Description |
error | Error | The error that occured. |
Throw:
The extended error. |
public async importTask(): Promise<void> source
import importTask from 'atscm/src/tasks/import.js'
Imports all xml files needed for atscm usage.
Test:
public isDefinitionFile(path: string): boolean source
import {isDefinitionFile} from 'atscm/src/lib/gulp/src.ts'
Returns true
for definition file paths.
Params:
Name | Type | Attribute | Description |
path | string |
public async loadProjectRequirement(): Promise source
import {loadProjectRequirement} from 'atscm/src/hooks/check-atserver.ts'
public async loadRemoteVersion(): Promise source
import {loadRemoteVersion} from 'atscm/src/hooks/check-atserver.ts'
public performPull(nodes: NodeId[], options: Object): * source
import {performPull} from 'atscm/src/tasks/pull.js'
Pulls the given nodes from the server.
Params:
Name | Type | Attribute | Description |
nodes | NodeId[] | The nodes to pull from the server. |
|
options | Object | Options passed to NodeBrowser. |
Return:
* |
public performPush(path: string, options: Object): * source
import {performPush} from 'atscm/src/tasks/push.js'
Pushes the given path to the server.
Return:
* |
public pick(obj: Object, properties: Array<string>): Object source
import {pick} from 'atscm/src/lib/helpers/Object.js'
Picks some properties from an object and returns a new object containing these.
public promisified(fn: *) source
import {promisified} from 'atscm/src/lib/helpers/async.ts'
Wraps a function with an async callback in a promise.
Params:
Name | Type | Attribute | Description |
fn | * | The function to promisify. |
Test:
public async pull(options: Object): * source
import pull from 'atscm/src/tasks/pull.js'
Pulls all nodes from atvise server.
Return:
* |
Test:
public async push(): * source
import push from 'atscm/src/tasks/push.js'
Pushes AtviseFiles to atvise server.
Return:
* |
Test:
public async readNode(nodeId: NodeId): Promise<any> source
import {readNode} from 'atscm/src/api.js'
Reads a single node's value.
Params:
Name | Type | Attribute | Description |
nodeId | NodeId | The node to read. |
public reportProgress(task: Promise<any>, options: Object): * source
import {reportProgress} from 'atscm/src/lib/helpers/log.js'
Prints the progress of a task.
Params:
Name | Type | Attribute | Description |
task | Promise<any> | The task to print the progress for. |
|
options | Object | The options used. |
|
options.getter | function(): number | A function returning the current progress. |
|
options.formatter | function(value: number): string | A function returning a log message for the progress passed. |
|
options.level | string |
|
The log level to use. |
options.logResult | boolean |
|
If the final progress should be printed. |
Return:
* |
Example:
const task = doSomething(); // Returns a Promise
reportProgress(task, {
getter: () => getTaskProgress(), // returns a number, e.g. 13 if 13 files have been written
formatter: value => `${value} files written`,
})
.then(result => { // Results get passed directly from `task`
console.log(`The result is: ${result}`);
})
.catch(console.error) // which means you need error handling as well!
public reverse(obj: Object): Object source
import {reverse} from 'atscm/src/lib/helpers/Object.js'
Switches keys and values in an object. E.G.: { "a": 1 } becomes { 1: "a" }.
Params:
Name | Type | Attribute | Description |
obj | Object | The object to reverse. |
Test:
public setupContext(undefined: Partial): HookContext source
import {setupContext} from 'atscm/src/hooks/hooks.ts'
Params:
Name | Type | Attribute | Description |
undefined | Partial |
Return:
HookContext |
public sortReferences(references: Object): * source
import {sortReferences} from 'atscm/src/lib/helpers/mapping.js'
Sorts the given references before they are persisted to disk.
Params:
Name | Type | Attribute | Description |
references | Object | The references to be sorted. |
Return:
* |
public src(path: string, options: SourceBrowserOptions): undefined source
import src from 'atscm/src/lib/gulp/src.ts'
Starts a new source browser at the given path.
Params:
Name | Type | Attribute | Description |
path | string | ||
options | SourceBrowserOptions |
public async updateFile(path: string, update: UpdateFn, encoding: undefined): Promise source
import {updateFile} from 'atscm/src/lib/helpers/fs.ts'
public async updateJson(path: string, update: UpdateFn): Promise source
import {updateJson} from 'atscm/src/lib/helpers/fs.ts'
Params:
Name | Type | Attribute | Description |
path | string | ||
update | UpdateFn |
public validateDirectoryExists(directoryPath: string): Promise<fs~Stats, Error> source
import {validateDirectoryExists} from 'atscm/src/util/fs.js'
Checks it a given path holds a directory and returns it's fs~Stats if found.
Params:
Name | Type | Attribute | Description |
directoryPath | string | The path to look at. |
Return:
Promise<fs~Stats, Error> | Fulfilled with the directory's stats or rejected with the error that occurred. |
Test:
public waitForDependencies(Stream: QueueStream): Class<WaitingStream> source
import {waitForDependencies} from 'atscm/src/lib/server/WaitingStream.js'
A mixin that transforms a regular stream into a WaitingStream, which makes it wait for a node's dependencies to be transformed.
Params:
Name | Type | Attribute | Description |
Stream | QueueStream | The node stream to inherit from. |
Example:
import QueueStream from 'atscm/src/lib/server/QueueStream';
import { waitForDependencies } from 'atscm/src/lib/server/WaitingStream';
class MyWaitingStream extends waitForDependencies(QueueStream) {
dependenciesFor(file) {
return [
// An array of node ids
];
}
}
public async watch(options: Object): Promise<{serverwatcher: Watcher, fileWatcher: sane~Watcher}, Error>{serverwatcher:> source
import watch from 'atscm/src/tasks/watch.js'
The gulp task invoced when running atscm watch
.
Params:
Name | Type | Attribute | Description |
options | Object | The options to pass to the watch task, see WatchTask#run for available options. |
Return:
Promise<{serverwatcher: Watcher, fileWatcher: sane~Watcher}, Error>{serverwatcher:> | Fulfilled once all watchers are set up and Browsersync was initialized. |
Test:
public writeNode(nodeId: NodeId, value: node-opcua~Variant): Promise<node-opcua~StatusCodes source
import {writeNode} from 'atscm/src/api.js'
Writes a single node's value.
Params:
Name | Type | Attribute | Description |
nodeId | NodeId | The node to write. |
|
value | node-opcua~Variant | The value to write. |
Return:
Promise<node-opcua~StatusCodes | The operation status result. |