Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-opcua-data-model

Package Overview
Dependencies
Maintainers
1
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-data-model - npm Package Compare versions

Comparing version 2.6.0-alpha.7 to 2.6.1

3

dist/access_level.js

@@ -22,2 +22,4 @@ "use strict";

exports.convertAccessLevelFlagToByte = convertAccessLevelFlagToByte;
// @example
// makeAccessLevelFlag("CurrentRead | CurrentWrite").should.eql(0x03);
function makeAccessLevelFlag(str) {

@@ -53,2 +55,3 @@ if (typeof str === "number") {

exports.randomAccessLevel = randomAccessLevel;
// tslint:disable:no-bitwise
function accessLevelFlagToString(accessLevelFlag) {

@@ -55,0 +58,0 @@ const retVal = [];

@@ -0,1 +1,4 @@

/**
* @module node-opcua-data-model
*/
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";

@@ -2,0 +5,0 @@ import { Enum } from "node-opcua-enum";

@@ -0,3 +1,6 @@

/**
* @module node-opcua-data-model
*/
import { QualifiedNameLike } from "./qualified_name";
export declare function isDataEncoding(dataEncoding: any): boolean;
export declare function isValidDataEncoding(dataEncoding?: string | null | QualifiedNameLike): boolean;

@@ -17,2 +17,3 @@ "use strict";

if (dataEncoding && (dataEncoding.name || dataEncoding.text)) {
// tslint:disable:no-console
console.log(" isValidDataEncoding => expecting a string here , not a LocalizedText or a QualifiedName ");

@@ -19,0 +20,0 @@ return false;

@@ -16,2 +16,9 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";

innerDiagnosticInfo: DiagnosticInfo;
/**
*
* @class DiagnosticInfo
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options?: any);

@@ -18,0 +25,0 @@ encode(stream: OutputBinaryStream): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeDiagnosticInfo = exports.encodeDiagnosticInfo = exports.DiagnosticInfo_EncodingByte = exports.DiagnosticInfo = exports.schemaDiagnosticInfo = void 0;
/**
* @module node-opcua-data-model
*/
const node_opcua_assert_1 = require("node-opcua-assert");

@@ -9,2 +12,3 @@ const node_opcua_factory_1 = require("node-opcua-factory");

const node_opcua_factory_2 = require("node-opcua-factory");
// --------------------------------------------------------------------------------------------
exports.schemaDiagnosticInfo = node_opcua_factory_1.buildStructuredType({

@@ -53,4 +57,11 @@ name: "DiagnosticInfo",

});
let DiagnosticInfo = (() => {
let DiagnosticInfo = /** @class */ (() => {
class DiagnosticInfo extends node_opcua_factory_1.BaseUAObject {
/**
*
* @class DiagnosticInfo
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options) {

@@ -60,2 +71,3 @@ options = options || {};

const schema = exports.schemaDiagnosticInfo;
/* istanbul ignore next */
if (node_opcua_factory_1.parameters.debugSchemaHelper) {

@@ -102,2 +114,3 @@ node_opcua_factory_2.check_options_correctness_against_schema(this, schema, options);

})(DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte || (exports.DiagnosticInfo_EncodingByte = {}));
// tslint:disable:no-bitwise
function getDiagnosticInfoEncodingByte(diagnosticInfo) {

@@ -131,21 +144,29 @@ node_opcua_assert_1.assert(diagnosticInfo);

const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo);
// write encoding byte
node_opcua_basic_types_1.encodeByte(encodingMask, stream);
// write symbolic id
if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
node_opcua_basic_types_1.encodeInt32(diagnosticInfo.symbolicId, stream);
}
// write namespace uri
if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
node_opcua_basic_types_1.encodeInt32(diagnosticInfo.namespaceURI, stream);
}
// write locale
if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
node_opcua_basic_types_1.encodeInt32(diagnosticInfo.locale, stream);
}
// write localized text
if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
node_opcua_basic_types_1.encodeInt32(diagnosticInfo.localizedText, stream);
}
// write additional info
if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
node_opcua_basic_types_1.encodeString(diagnosticInfo.additionalInfo, stream);
}
// write inner status code
if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
node_opcua_basic_types_1.encodeStatusCode(diagnosticInfo.innerStatusCode, stream);
}
// write innerDiagnosticInfo
if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {

@@ -166,2 +187,3 @@ node_opcua_assert_1.assert(diagnosticInfo.innerDiagnosticInfo !== null, "missing innerDiagnosticInfo");

cursorBefore = stream.length;
// read symbolic id
if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {

@@ -172,2 +194,3 @@ diagnosticInfo.symbolicId = node_opcua_basic_types_1.decodeInt32(stream);

}
// read namespace uri
if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {

@@ -178,2 +201,3 @@ diagnosticInfo.namespaceURI = node_opcua_basic_types_1.decodeInt32(stream);

}
// read locale
if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {

@@ -184,2 +208,3 @@ diagnosticInfo.locale = node_opcua_basic_types_1.decodeInt32(stream);

}
// read localized text
if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {

@@ -190,2 +215,3 @@ diagnosticInfo.localizedText = node_opcua_basic_types_1.decodeInt32(stream);

}
// read additional info
if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {

@@ -196,2 +222,3 @@ diagnosticInfo.additionalInfo = node_opcua_basic_types_1.decodeString(stream);

}
// read inner status code
if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {

@@ -202,2 +229,3 @@ diagnosticInfo.innerStatusCode = node_opcua_basic_types_1.decodeStatusCode(stream);

}
// read inner status code
if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {

@@ -214,20 +242,27 @@ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});

const encodingMask = node_opcua_basic_types_1.decodeByte(stream);
// read symbolic id
if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
diagnosticInfo.symbolicId = node_opcua_basic_types_1.decodeInt32(stream);
}
// read namespace uri
if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
diagnosticInfo.namespaceURI = node_opcua_basic_types_1.decodeInt32(stream);
}
// read locale
if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
diagnosticInfo.locale = node_opcua_basic_types_1.decodeInt32(stream);
}
// read localized text
if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
diagnosticInfo.localizedText = node_opcua_basic_types_1.decodeInt32(stream);
}
// read additional info
if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
diagnosticInfo.additionalInfo = node_opcua_basic_types_1.decodeString(stream);
}
// read inner status code
if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
diagnosticInfo.innerStatusCode = node_opcua_basic_types_1.decodeStatusCode(stream);
}
// read inner status code
if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {

@@ -256,3 +291,8 @@ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});

exports.decodeDiagnosticInfo = decodeDiagnosticInfo;
// Note:
// the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
// in the response header. Only the index of the corresponding string in the string table is encoded. An index
// of −1 indicates that there is no value for the string.
//
node_opcua_factory_1.registerSpecialVariantEncoder(DiagnosticInfo);
//# sourceMappingURL=diagnostic_info.js.map

@@ -0,1 +1,4 @@

/**
* @module node-opcua-data-model
*/
export * from "./access_level";

@@ -2,0 +5,0 @@ export * from "./localized_text";

@@ -13,2 +13,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-data-model
*/
__exportStar(require("./access_level"), exports);

@@ -15,0 +18,0 @@ __exportStar(require("./localized_text"), exports);

@@ -16,2 +16,9 @@ import { LocaleId, UAString } from "node-opcua-basic-types";

text: UAString;
/**
*
* @class LocalizedText
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options?: LocalizedTextOptions | string);

@@ -18,0 +25,0 @@ toString(): string;

@@ -17,2 +17,3 @@ "use strict";

if (!value.hasOwnProperty("text")) {
// tslint:disable:no-console
console.log("value = ", value);

@@ -24,2 +25,4 @@ throw new Error("cannot coerce to coerceLocalizedText");

exports.coerceLocalizedText = coerceLocalizedText;
// --------------------------------------------------------------------------------------------
// see Part 3 - $8.5 page 63
const schemaLocalizedText = node_opcua_factory_1.buildStructuredType({

@@ -41,4 +44,11 @@ name: "LocalizedText",

schemaLocalizedText.coerce = coerceLocalizedText;
let LocalizedText = (() => {
let LocalizedText = /** @class */ (() => {
class LocalizedText extends node_opcua_factory_1.BaseUAObject {
/**
*
* @class LocalizedText
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options) {

@@ -51,6 +61,15 @@ super();

options = options || {};
/* istanbul ignore next */
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
node_opcua_factory_1.check_options_correctness_against_schema(this, schema, options);
}
/**
* @property locale
* @type {UAString}
*/
this.locale = node_opcua_factory_1.initialize_field(schema.fields[0], options.locale);
/**
* @property text
* @type {UAString}
*/
this.text = node_opcua_factory_1.initialize_field(schema.fields[1], options.text);

@@ -64,2 +83,4 @@ }

}
// xx static encodingDefaultBinary = makeExpandedNodeId(0, 0);
// xx static encodingDefaultXml = makeExpandedNodeId(0, 0);
static coerce(value) {

@@ -71,3 +92,5 @@ return coerceLocalizedText(value);

}
// OPCUA Part 6 $ 5.2.2.14 : localizedText have a special encoding
encode(stream) {
// tslint:disable:no-bitwise
const encodingMask = getLocalizeText_EncodingByte(this);

@@ -101,2 +124,3 @@ node_opcua_basic_types_1.encodeByte(encodingMask, stream);

tracer.trace("member", "text", this.text, cursorBefore, stream.length, "text");
// cursor_before = stream.length;
}

@@ -131,2 +155,3 @@ else {

exports.LocalizedText = LocalizedText;
// not an extension object registerClassDefinition("LocalizedText", LocalizedText);
node_opcua_factory_1.registerSpecialVariantEncoder(LocalizedText);

@@ -133,0 +158,0 @@ function getLocalizeText_EncodingByte(localizedText) {

@@ -0,1 +1,4 @@

/**
* @module node-opcua-data-model
*/
export declare enum NodeClassMask {

@@ -2,0 +5,0 @@ Object = 1,

"use strict";
/**
* @module node-opcua-data-model
*/
// tslint:disable:no-bitwise
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeNodeClassMask = exports.NodeClassMask = void 0;
// Specifies the NodeClasses of the TargetNodes. Only TargetNodes with the
// selected NodeClasses are returned. The NodeClasses are assigned the
// following bits:
// If set to zero, then all NodeClasses are returned.
// @example
// var mask = NodeClassMask.get("Object | ObjectType");
// mask.value.should.eql(1 + (1<<3));
var NodeClassMask;

@@ -23,4 +34,7 @@ (function (NodeClassMask) {

}
// @example
// makeNodeClassMask("Method | Object").should.eql(5);
function makeNodeClassMask(str) {
const classMask = makeFlagFromString(NodeClassMask, str);
/* istanbul ignore next */
if (!classMask) {

@@ -27,0 +41,0 @@ throw new Error(" cannot find class mask for " + str);

5

dist/nodeclass.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaEnumNodeClass = exports.NodeClass = void 0;
/**
* @module node-opcua-data-model
*/
const node_opcua_factory_1 = require("node-opcua-factory");

@@ -15,3 +18,3 @@ var NodeClass;

NodeClass[NodeClass["DataType"] = 64] = "DataType";
NodeClass[NodeClass["View"] = 128] = "View";
NodeClass[NodeClass["View"] = 128] = "View"; // The node is a view.
})(NodeClass = exports.NodeClass || (exports.NodeClass = {}));

@@ -18,0 +21,0 @@ exports.schemaEnumNodeClass = {

@@ -17,4 +17,23 @@ import { BaseUAObject, StructuredTypeSchema } from "node-opcua-factory";

name: UAString;
/**
*
* @class QualifiedName
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options?: QualifiedNameOptions);
/**
* encode the object into a binary stream
* @method encode
*
* @param stream {BinaryStream}
*/
encode(stream: OutputBinaryStream): void;
/**
* decode the object from a binary stream
* @method decode
*
* @param stream {BinaryStream}
*/
decode(stream: BinaryStream): void;

@@ -25,2 +44,12 @@ toString(): string;

export declare type QualifiedNameLike = QualifiedNameOptions | string;
/**
* @method stringToQualifiedName
* @param value {String}
* @return {{namespaceIndex: Number, name: String}}
*
* @example
*
* stringToQualifiedName("Hello") => {namespaceIndex: 0, name: "Hello"}
* stringToQualifiedName("3:Hello") => {namespaceIndex: 3, name: "Hello"}
*/
export declare function stringToQualifiedName(value: string): QualifiedName;

@@ -27,0 +56,0 @@ export declare function coerceQualifiedName(value: null): null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeQualifiedName = exports.encodeQualifiedName = exports.coerceQualifiedName = exports.stringToQualifiedName = exports.QualifiedName = exports.schemaQualifiedName = void 0;
/**
* @module node-opcua-data-model
*/
const node_opcua_assert_1 = require("node-opcua-assert");

@@ -25,4 +28,11 @@ const node_opcua_factory_1 = require("node-opcua-factory");

exports.schemaQualifiedName.coerce = coerceQualifiedName;
let QualifiedName = (() => {
let QualifiedName = /** @class */ (() => {
class QualifiedName extends node_opcua_factory_1.BaseUAObject {
/**
*
* @class QualifiedName
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/
constructor(options) {

@@ -32,9 +42,25 @@ super();

options = options || {};
/* istanbul ignore next */
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
node_opcua_factory_1.check_options_correctness_against_schema(this, schema, options);
}
/**
* @property namespaceIndex
* @type {Int32}
*/
this.namespaceIndex = node_opcua_factory_1.initialize_field(schema.fields[0], options.namespaceIndex);
/**
* @property name
* @type {UAString}
*/
this.name = node_opcua_factory_1.initialize_field(schema.fields[1], options.name);
}
/**
* encode the object into a binary stream
* @method encode
*
* @param stream {BinaryStream}
*/
encode(stream) {
// call base class implementation first
super.encode(stream);

@@ -44,3 +70,10 @@ node_opcua_basic_types_1.encodeUInt16(this.namespaceIndex, stream);

}
/**
* decode the object from a binary stream
* @method decode
*
* @param stream {BinaryStream}
*/
decode(stream) {
// call base class implementation first
super.decode(stream);

@@ -71,2 +104,5 @@ this.namespaceIndex = node_opcua_basic_types_1.decodeUInt16(stream);

QualifiedName.prototype.schema = QualifiedName.schema;
// xx QualifiedName.prototype.isEmpty = function (): boolean {
// xx return !this.name || this.name.length === 0;
// xx}
function isInteger(value) {

@@ -77,2 +113,12 @@ return typeof value === "number" &&

}
/**
* @method stringToQualifiedName
* @param value {String}
* @return {{namespaceIndex: Number, name: String}}
*
* @example
*
* stringToQualifiedName("Hello") => {namespaceIndex: 0, name: "Hello"}
* stringToQualifiedName("3:Hello") => {namespaceIndex: 3, name: "Hello"}
*/
function stringToQualifiedName(value) {

@@ -79,0 +125,0 @@ const splitArray = value.split(":");

@@ -0,1 +1,4 @@

/**
* @module node-opcua-data-model
*/
import { Enum } from "node-opcua-enum";

@@ -2,0 +5,0 @@ export declare enum ResultMask {

@@ -19,2 +19,5 @@ "use strict";

exports._enumerationResultMask = node_opcua_factory_1.registerEnumeration(exports.schemaResultMask);
// The ReferenceDescription type is defined in 7.24.
// @example
// makeNodeClassMask("Method | Object").should.eql(5);
function makeResultMask(str) {

@@ -21,0 +24,0 @@ const flags = str.split(" | ");

"use strict";
/**
* @module node-opcua-data-model
*/
// tslint:disable:no-bitwise
/*
* This Structured DataType defines the local time that may or may not take daylight saving time
* into account. Its elements are described in Table 24.
* Table 24 – TimeZoneDataType Definition
* Name Type Description
* TimeZoneDataType structure
* offset Int16 The offset in minutes from UtcTime
* daylightSavingInOffset Boolean If TRUE, then daylight saving time (DST) is in effect and offset
* includes the DST correction. If FALSE then the offset does not
* include the DST correction and DST may or may not have
* been in effect.
*/
// todo : repair exports.TimeZoneDataType = require("./_generated_/_tuto").TimeZoneDataType;
//# sourceMappingURL=time_zone.js.map

@@ -0,1 +1,4 @@

/**
* @module node-opcua-data-model
*/
export declare enum WriteMask {

@@ -2,0 +5,0 @@ AccessLevel = 1,

"use strict";
/**
* @module node-opcua-data-model
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.WriteMask = void 0;
// tslint:disable:no-bitwise
var WriteMask;

@@ -32,3 +36,7 @@ (function (WriteMask) {

WriteMask[WriteMask["AccessLevelEx"] = 33554432] = "AccessLevelEx";
// It does not apply for
// Variables since this is handled by the AccessLevel and UserAccessLevel
// Attributes for the Variable. For Variables this bit shall be set to 0.
// Reserved 22:31 Reserved for future use. Shall always be zero.
})(WriteMask = exports.WriteMask || (exports.WriteMask = {}));
//# sourceMappingURL=write_mask.js.map
{
"name": "node-opcua-data-model",
"version": "2.6.0-alpha.7",
"version": "2.6.1",
"description": "pure nodejs OPCUA SDK - module -data-model",

@@ -13,14 +13,14 @@ "scripts": {

"dependencies": {
"node-opcua-assert": "^2.6.0-alpha.1",
"node-opcua-basic-types": "^2.6.0-alpha.1",
"node-opcua-binary-stream": "^2.6.0-alpha.1",
"node-opcua-enum": "^2.6.0-alpha.1",
"node-opcua-factory": "^2.6.0-alpha.7",
"node-opcua-nodeid": "^2.6.0-alpha.1",
"node-opcua-status-code": "^2.6.0-alpha.1",
"node-opcua-utils": "^2.6.0-alpha.1",
"node-opcua-assert": "^2.6.1",
"node-opcua-basic-types": "^2.6.1",
"node-opcua-binary-stream": "^2.6.1",
"node-opcua-enum": "^2.6.1",
"node-opcua-factory": "^2.6.1",
"node-opcua-nodeid": "^2.6.1",
"node-opcua-status-code": "^2.6.1",
"node-opcua-utils": "^2.6.1",
"underscore": "^1.10.2"
},
"devDependencies": {
"node-opcua-packet-analyzer": "^2.6.0-alpha.7",
"node-opcua-packet-analyzer": "^2.6.1",
"should": "^13.2.3",

@@ -44,3 +44,3 @@ "source-map-support": "^0.5.19"

"homepage": "http://node-opcua.github.io/",
"gitHead": "6af0c6f183dcb96ddc5a2befc98851d0960c5fd0"
"gitHead": "15f0c0f83232fc63310dc04fea187048c7a01e4b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc