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

node-opcua-data-value

Package Overview
Dependencies
Maintainers
1
Versions
205
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.132.0 to 2.133.0

72

dist/datavalue.d.ts

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

type NumericalRange = any;
/**
* @internal
* @param dataValue
* @param stream
*/
export declare function encodeDataValue(dataValue: DataValue, stream: OutputBinaryStream): void;

@@ -22,3 +27,9 @@ export declare function decodeDataValue(stream: BinaryStream, dataValue?: DataValue): DataValue;

export declare class DataValue extends BaseUAObject {
/**
* @internal
*/
static possibleFields: string[];
/**
* @internal
*/
static schema: IStructuredTypeSchema;

@@ -33,6 +44,2 @@ value: Variant;

*
* @class DataValue
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/

@@ -48,3 +55,19 @@ constructor(options?: DataValueOptions | null);

export type DataValueLike = DataValueOptions | DataValue;
/**
* apply the provided timestampsToReturn flag to the dataValue and return a cloned dataValue
* with the specified timestamps.
* @param dataValue
* @param timestampsToReturn
* @param attributeId
* @returns
*/
export declare function apply_timestamps(dataValue: DataValue, timestampsToReturn: TimestampsToReturn, attributeId: AttributeIds): DataValue;
/**
*
* @param dataValue a DataValue
* @param timestampsToReturn a TimestampsToReturn flag to determine which timestamp should be kept
* @param attributeId if attributeId is not Value, sourceTimestamp will forcefully be set to null
* @param now an optional current clock to be used to set the serverTimestamp
* @returns
*/
export declare function apply_timestamps_no_copy(dataValue: DataValue, timestampsToReturn: TimestampsToReturn, attributeId: AttributeIds, now?: PreciseClock): DataValue;

@@ -58,17 +81,50 @@ /**

export declare function extractRange(dataValue: DataValue, indexRange: NumericalRange): DataValue;
/**
* returns true if the sourceTimestamp and sourcePicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
export declare function sourceTimestampHasChanged(dataValue1: DataValue, dataValue2: DataValue): boolean;
/**
* returns true if the serverTimestamp and serverPicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
export declare function serverTimestampHasChanged(dataValue1: DataValue, dataValue2: DataValue): boolean;
/**
* return if the timestamps of the two dataValue are different
*
* - if timestampsToReturn is not specified, both sourceTimestamp are compared
* - if timestampsToReturn is **Neither**, the function returns false
* - if timestampsToReturn is **Both**, both sourceTimestamp and serverTimestamp are compared
* - if timestampsToReturn is **Source**, only sourceTimestamp are compared
* - if timestampsToReturn is **Server**, only serverTimestamp are compared
*
* @param dataValue1
* @param dataValue2
* @param timestampsToReturn
* @returns
*/
export declare function timestampHasChanged(dataValue1: DataValue, dataValue2: DataValue, timestampsToReturn?: TimestampsToReturn): boolean;
/**
* @param statusCode1
* @param statusCode2
* @returns true if the two statusCodes are identical, i.e have the same value
*/
export declare function sameStatusCode(statusCode1: StatusCode, statusCode2: StatusCode): boolean;
/**
* @method sameDataValue
* @param v1 {DataValue}
* @param v2 {DataValue}
* @param [timestampsToReturn {TimestampsToReturn}]
* @return {boolean} true if data values are identical
*/
export declare function sameDataValue(v1: DataValue, v2: DataValue, timestampsToReturn?: TimestampsToReturn): boolean;
/**
* a DataValueOptions specialized for a specific DataType
*/
export interface DataValueOptionsT<T, DT extends DataType> extends DataValueOptions {
value: VariantOptionsT<T, DT>;
}
/**
* a DataValue specialized for a specific DataType
*/
export declare interface DataValueT<T, DT extends DataType> extends DataValue {

@@ -75,0 +131,0 @@ value: VariantT<T, DT>;

@@ -55,2 +55,7 @@ "use strict";

}
/**
* @internal
* @param dataValue
* @param stream
*/
function encodeDataValue(dataValue, stream) {

@@ -220,6 +225,2 @@ const encodingMask = getDataValue_EncodingByte(dataValue);

*
* @class DataValue
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/

@@ -293,2 +294,5 @@ constructor(options) {

exports.DataValue = DataValue;
/**
* @internal
*/
DataValue.possibleFields = [

@@ -302,2 +306,5 @@ "value",

];
/**
* @internal
*/
DataValue.schema = schemaDataValue;

@@ -315,2 +322,10 @@ DataValue.prototype.schema = DataValue.schema;

}
/**
* apply the provided timestampsToReturn flag to the dataValue and return a cloned dataValue
* with the specified timestamps.
* @param dataValue
* @param timestampsToReturn
* @param attributeId
* @returns
*/
function apply_timestamps(dataValue, timestampsToReturn, attributeId) {

@@ -360,2 +375,10 @@ let cloneDataValue = null;

}
/**
*
* @param dataValue a DataValue
* @param timestampsToReturn a TimestampsToReturn flag to determine which timestamp should be kept
* @param attributeId if attributeId is not Value, sourceTimestamp will forcefully be set to null
* @param now an optional current clock to be used to set the serverTimestamp
* @returns
*/
function apply_timestamps_no_copy(dataValue, timestampsToReturn, attributeId, now) {

@@ -370,7 +393,9 @@ switch (timestampsToReturn) {

case TimestampsToReturn_enum_1.TimestampsToReturn.Server:
now = now || (0, node_opcua_date_time_1.getCurrentClock)();
dataValue.serverTimestamp = now.timestamp;
dataValue.serverPicoseconds = now.picoseconds;
dataValue.sourceTimestamp = null;
dataValue.sourcePicoseconds = 0;
if (!dataValue.serverTimestamp) {
now = now || (0, node_opcua_date_time_1.getCurrentClock)();
dataValue.serverTimestamp = now.timestamp;
dataValue.serverPicoseconds = now.picoseconds;
}
break;

@@ -382,5 +407,7 @@ case TimestampsToReturn_enum_1.TimestampsToReturn.Source:

(0, node_opcua_assert_1.assert)(timestampsToReturn === TimestampsToReturn_enum_1.TimestampsToReturn.Both);
now = now || (0, node_opcua_date_time_1.getCurrentClock)();
dataValue.serverTimestamp = now.timestamp;
dataValue.serverPicoseconds = now.picoseconds;
if (!dataValue.serverTimestamp) {
now = now || (0, node_opcua_date_time_1.getCurrentClock)();
dataValue.serverTimestamp = now.timestamp;
dataValue.serverPicoseconds = now.picoseconds;
}
break;

@@ -394,2 +421,5 @@ }

}
/**
* @deprecated
*/
function apply_timestamps2(dataValue, timestampsToReturn, attributeId) {

@@ -431,3 +461,3 @@ (0, node_opcua_assert_1.assert)(attributeId > 0);

/*
* @method _clone_with_array_replacement
* @param dataValue

@@ -505,2 +535,8 @@ * @param result

}
/**
* returns true if the sourceTimestamp and sourcePicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
function sourceTimestampHasChanged(dataValue1, dataValue2) {

@@ -510,2 +546,8 @@ return (!sameDate(dataValue1.sourceTimestamp, dataValue2.sourceTimestamp) ||

}
/**
* returns true if the serverTimestamp and serverPicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
function serverTimestampHasChanged(dataValue1, dataValue2) {

@@ -515,2 +557,16 @@ return (!sameDate(dataValue1.serverTimestamp, dataValue2.serverTimestamp) ||

}
/**
* return if the timestamps of the two dataValue are different
*
* - if timestampsToReturn is not specified, both sourceTimestamp are compared
* - if timestampsToReturn is **Neither**, the function returns false
* - if timestampsToReturn is **Both**, both sourceTimestamp and serverTimestamp are compared
* - if timestampsToReturn is **Source**, only sourceTimestamp are compared
* - if timestampsToReturn is **Server**, only serverTimestamp are compared
*
* @param dataValue1
* @param dataValue2
* @param timestampsToReturn
* @returns
*/
function timestampHasChanged(dataValue1, dataValue2, timestampsToReturn) {

@@ -533,2 +589,7 @@ // TODO: timestampsToReturn = timestampsToReturn || { key: "Neither"};

}
/**
* @param statusCode1
* @param statusCode2
* @returns true if the two statusCodes are identical, i.e have the same value
*/
function sameStatusCode(statusCode1, statusCode2) {

@@ -538,6 +599,2 @@ return statusCode1.value === statusCode2.value;

/**
* @method sameDataValue
* @param v1 {DataValue}
* @param v2 {DataValue}
* @param [timestampsToReturn {TimestampsToReturn}]
* @return {boolean} true if data values are identical

@@ -544,0 +601,0 @@ */

@@ -5,2 +5,5 @@ /**

import { Enum } from "node-opcua-enum";
/**
* @private
*/
export declare enum DataValueEncodingByte {

@@ -14,2 +17,5 @@ Value = 1,

}
/**
* @private
*/
export declare const schemaDataValueEncodingByte: {

@@ -19,2 +25,5 @@ name: string;

};
/**
* @private
*/
export declare const _enumerationDataValueEncodingByte: Enum;

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

const node_opcua_factory_1 = require("node-opcua-factory");
/**
* @private
*/
var DataValueEncodingByte;

@@ -15,2 +18,5 @@ (function (DataValueEncodingByte) {

})(DataValueEncodingByte || (exports.DataValueEncodingByte = DataValueEncodingByte = {}));
/**
* @private
*/
exports.schemaDataValueEncodingByte = {

@@ -20,3 +26,6 @@ name: "DataValue_EncodingByte",

};
/**
* @private
*/
exports._enumerationDataValueEncodingByte = (0, node_opcua_factory_1.registerEnumeration)(exports.schemaDataValueEncodingByte);
//# sourceMappingURL=DataValueEncodingByte_enum.js.map

@@ -5,2 +5,5 @@ /**

import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
/**
* a enumeration that specifies how the source timestamp should be returned.
*/
export declare enum TimestampsToReturn {

@@ -13,2 +16,5 @@ Source = 0,

}
/**
* @private
*/
export declare const schemaTimestampsToReturn: {

@@ -18,5 +24,14 @@ name: string;

};
/**
* @private
*/
export declare function encodeTimestampsToReturn(value: TimestampsToReturn, stream: OutputBinaryStream): void;
/**
* @private
*/
export declare function decodeTimestampsToReturn(stream: BinaryStream, value?: TimestampsToReturn): TimestampsToReturn;
/**
* @private
*/
export declare const _enumerationTimestampsToReturn: import("node-opcua-enum").Enum;
export declare function coerceTimestampsToReturn(value: number | null | undefined): TimestampsToReturn;

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

const node_opcua_factory_1 = require("node-opcua-factory");
/**
* a enumeration that specifies how the source timestamp should be returned.
*/
var TimestampsToReturn;

@@ -17,2 +20,5 @@ (function (TimestampsToReturn) {

})(TimestampsToReturn || (exports.TimestampsToReturn = TimestampsToReturn = {}));
/**
* @private
*/
exports.schemaTimestampsToReturn = {

@@ -22,2 +28,5 @@ name: "TimestampsToReturn",

};
/**
* @private
*/
function encodeTimestampsToReturn(value, stream) {

@@ -29,5 +38,11 @@ stream.writeUInt32(value);

}
/**
* @private
*/
function decodeTimestampsToReturn(stream, value) {
return clamp(TimestampsToReturn.Source, stream.readUInt32(), TimestampsToReturn.Invalid);
}
/**
* @private
*/
exports._enumerationTimestampsToReturn = (0, node_opcua_factory_1.registerEnumeration)(exports.schemaTimestampsToReturn);

@@ -34,0 +49,0 @@ function coerceTimestampsToReturn(value) {

28

package.json

@@ -5,3 +5,3 @@ {

"types": "./dist/index.d.ts",
"version": "2.132.0",
"version": "2.133.0",
"description": "pure nodejs OPCUA SDK - module data-value",

@@ -17,16 +17,16 @@ "scripts": {

"node-opcua-assert": "2.120.0",
"node-opcua-basic-types": "2.132.0",
"node-opcua-binary-stream": "2.128.0",
"node-opcua-data-model": "2.132.0",
"node-opcua-date-time": "2.132.0",
"node-opcua-enum": "2.128.0",
"node-opcua-factory": "2.132.0",
"node-opcua-status-code": "2.128.0",
"node-opcua-variant": "2.132.0"
"node-opcua-basic-types": "2.133.0",
"node-opcua-binary-stream": "2.133.0",
"node-opcua-data-model": "2.133.0",
"node-opcua-date-time": "2.133.0",
"node-opcua-enum": "2.133.0",
"node-opcua-factory": "2.133.0",
"node-opcua-status-code": "2.133.0",
"node-opcua-variant": "2.133.0"
},
"devDependencies": {
"node-opcua-debug": "2.128.0",
"node-opcua-extension-object": "2.132.0",
"node-opcua-numeric-range": "2.132.0",
"node-opcua-packet-analyzer": "2.132.0"
"node-opcua-debug": "2.133.0",
"node-opcua-extension-object": "2.133.0",
"node-opcua-numeric-range": "2.133.0",
"node-opcua-packet-analyzer": "2.133.0"
},

@@ -48,3 +48,3 @@ "author": "Etienne Rossignon",

"homepage": "http://node-opcua.github.io/",
"gitHead": "5fab0f1eac0e59abf94bab9034035aec44890456",
"gitHead": "921bb04f2e7ce3109dd051ff27a2210edf700344",
"files": [

@@ -51,0 +51,0 @@ "dist",

@@ -68,2 +68,7 @@ /**

/**
* @internal
* @param dataValue
* @param stream
*/
export function encodeDataValue(dataValue: DataValue, stream: OutputBinaryStream): void {

@@ -251,2 +256,5 @@ const encodingMask = getDataValue_EncodingByte(dataValue);

export class DataValue extends BaseUAObject {
/**
* @internal
*/
public static possibleFields: string[] = [

@@ -260,2 +268,5 @@ "value",

];
/**
* @internal
*/
public static schema = schemaDataValue;

@@ -271,6 +282,2 @@ public value: Variant;

*
* @class DataValue
* @constructor
* @extends BaseUAObject
* @param options {Object}
*/

@@ -364,2 +371,10 @@ constructor(options?: DataValueOptions | null) {

/**
* apply the provided timestampsToReturn flag to the dataValue and return a cloned dataValue
* with the specified timestamps.
* @param dataValue
* @param timestampsToReturn
* @param attributeId
* @returns
*/
export function apply_timestamps(

@@ -415,2 +430,10 @@ dataValue: DataValue,

/**
*
* @param dataValue a DataValue
* @param timestampsToReturn a TimestampsToReturn flag to determine which timestamp should be kept
* @param attributeId if attributeId is not Value, sourceTimestamp will forcefully be set to null
* @param now an optional current clock to be used to set the serverTimestamp
* @returns
*/
export function apply_timestamps_no_copy(

@@ -430,7 +453,9 @@ dataValue: DataValue,

case TimestampsToReturn.Server:
now = now || getCurrentClock();
dataValue.serverTimestamp = now.timestamp as DateTime;
dataValue.serverPicoseconds = now.picoseconds;
dataValue.sourceTimestamp = null;
dataValue.sourcePicoseconds = 0;
if (!dataValue.serverTimestamp) {
now = now || getCurrentClock();
dataValue.serverTimestamp = now.timestamp as DateTime;
dataValue.serverPicoseconds = now.picoseconds;
}
break;

@@ -442,5 +467,7 @@ case TimestampsToReturn.Source:

assert(timestampsToReturn === TimestampsToReturn.Both);
now = now || getCurrentClock();
dataValue.serverTimestamp = now.timestamp as DateTime;
dataValue.serverPicoseconds = now.picoseconds;
if (!dataValue.serverTimestamp) {
now = now || getCurrentClock();
dataValue.serverTimestamp = now.timestamp as DateTime;
dataValue.serverPicoseconds = now.picoseconds;
}
break;

@@ -455,2 +482,5 @@ }

/**
* @deprecated
*/
function apply_timestamps2(dataValue: DataValue, timestampsToReturn: TimestampsToReturn, attributeId: AttributeIds): DataValue {

@@ -495,3 +525,3 @@ assert(attributeId > 0);

/*
* @method _clone_with_array_replacement
* @param dataValue

@@ -580,2 +610,8 @@ * @param result

/**
* returns true if the sourceTimestamp and sourcePicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
export function sourceTimestampHasChanged(dataValue1: DataValue, dataValue2: DataValue): boolean {

@@ -588,2 +624,8 @@ return (

/**
* returns true if the serverTimestamp and serverPicoseconds of the two dataValue are different
* @param dataValue1
* @param dataValue2
* @returns
*/
export function serverTimestampHasChanged(dataValue1: DataValue, dataValue2: DataValue): boolean {

@@ -596,2 +638,18 @@ return (

/**
* return if the timestamps of the two dataValue are different
*
* - if timestampsToReturn is not specified, both sourceTimestamp are compared
* - if timestampsToReturn is **Neither**, the function returns false
* - if timestampsToReturn is **Both**, both sourceTimestamp and serverTimestamp are compared
* - if timestampsToReturn is **Source**, only sourceTimestamp are compared
* - if timestampsToReturn is **Server**, only serverTimestamp are compared
*
* @param dataValue1
* @param dataValue2
* @param timestampsToReturn
* @returns
*/
export function timestampHasChanged(

@@ -619,2 +677,7 @@ dataValue1: DataValue,

/**
* @param statusCode1
* @param statusCode2
* @returns true if the two statusCodes are identical, i.e have the same value
*/
export function sameStatusCode(statusCode1: StatusCode, statusCode2: StatusCode): boolean {

@@ -625,6 +688,2 @@ return statusCode1.value === statusCode2.value;

/**
* @method sameDataValue
* @param v1 {DataValue}
* @param v2 {DataValue}
* @param [timestampsToReturn {TimestampsToReturn}]
* @return {boolean} true if data values are identical

@@ -664,3 +723,5 @@ */

}
/**
* a DataValueOptions specialized for a specific DataType
*/
export interface DataValueOptionsT<T, DT extends DataType> extends DataValueOptions {

@@ -670,2 +731,5 @@ value: VariantOptionsT<T, DT>;

/**
* a DataValue specialized for a specific DataType
*/
export declare interface DataValueT<T, DT extends DataType> extends DataValue {

@@ -672,0 +736,0 @@ value: VariantT<T, DT>;

@@ -7,2 +7,5 @@ /**

/**
* @private
*/
export enum DataValueEncodingByte {

@@ -16,2 +19,5 @@ Value = 0x01,

}
/**
* @private
*/
export const schemaDataValueEncodingByte = {

@@ -22,2 +28,5 @@ name: "DataValue_EncodingByte",

};
/**
* @private
*/
export const _enumerationDataValueEncodingByte: Enum = registerEnumeration(schemaDataValueEncodingByte);

@@ -7,2 +7,5 @@ /**

/**
* a enumeration that specifies how the source timestamp should be returned.
*/
export enum TimestampsToReturn {

@@ -16,2 +19,5 @@ Source = 0,

/**
* @private
*/
export const schemaTimestampsToReturn = {

@@ -23,2 +29,5 @@ name: "TimestampsToReturn",

/**
* @private
*/
export function encodeTimestampsToReturn(value: TimestampsToReturn, stream: OutputBinaryStream): void {

@@ -32,2 +41,5 @@ stream.writeUInt32(value);

/**
* @private
*/
export function decodeTimestampsToReturn(stream: BinaryStream, value?: TimestampsToReturn): TimestampsToReturn {

@@ -37,2 +49,5 @@ return clamp(TimestampsToReturn.Source, stream.readUInt32(), TimestampsToReturn.Invalid) as TimestampsToReturn;

/**
* @private
*/
export const _enumerationTimestampsToReturn = registerEnumeration(schemaTimestampsToReturn);

@@ -39,0 +54,0 @@

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