node-opcua-data-model
Advanced tools
Comparing version 2.0.0-alpha.11 to 2.0.0-alpha.12
/** | ||
* @module node-opcua-data-model | ||
*/ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { Enum } from "node-opcua-enum"; | ||
@@ -16,4 +16,4 @@ export declare enum BrowseDirection { | ||
}; | ||
export declare function encodeBrowseDirection(value: BrowseDirection, stream: BinaryStream): void; | ||
export declare function encodeBrowseDirection(value: BrowseDirection, stream: OutputBinaryStream): void; | ||
export declare function decodeBrowseDirection(stream: BinaryStream): BrowseDirection; | ||
export declare const _enumerationBrowseDirection: Enum; |
@@ -5,2 +5,2 @@ /** | ||
export declare function isDataEncoding(dataEncoding: any): boolean; | ||
export declare function isValidDataEncoding(dataEncoding: string): boolean; | ||
export declare function isValidDataEncoding(dataEncoding?: string | null): boolean; |
@@ -10,5 +10,10 @@ "use strict"; | ||
exports.isDataEncoding = isDataEncoding; | ||
const validEncoding = ["DefaultBinary", "DefaultXml"]; | ||
function isValidDataEncoding(dataEncoding) { | ||
const validEncoding = ["DefaultBinary", "DefaultXml"]; | ||
if (!isDataEncoding(dataEncoding)) { | ||
if (dataEncoding && (dataEncoding.name || dataEncoding.text)) { | ||
// tslint:disable:no-console | ||
console.log(" isValidDataEncoding => expecting a string here , not a LocalizedText or a QualifiedName "); | ||
return false; | ||
} | ||
if (!(dataEncoding && typeof dataEncoding === "string")) { | ||
return true; | ||
@@ -15,0 +20,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { BaseUAObject, StructuredTypeSchema } from "node-opcua-factory"; | ||
@@ -24,3 +24,3 @@ import { StatusCode } from "node-opcua-status-code"; | ||
constructor(options: any); | ||
encode(stream: BinaryStream): void; | ||
encode(stream: OutputBinaryStream): void; | ||
decode(stream: BinaryStream): void; | ||
@@ -38,3 +38,3 @@ decodeDebug(stream: BinaryStream, options: any): void; | ||
} | ||
export declare function encodeDiagnosticInfo(value: DiagnosticInfo, stream: BinaryStream): void; | ||
export declare function encodeDiagnosticInfo(value: DiagnosticInfo, stream: OutputBinaryStream): void; | ||
export declare function decodeDiagnosticInfo(stream: BinaryStream): DiagnosticInfo; |
import { LocaleId, UAString } from "node-opcua-basic-types"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { BaseUAObject, StructuredTypeSchema } from "node-opcua-factory"; | ||
@@ -25,3 +25,3 @@ export declare function coerceLocalizedText(value: any): LocalizedText | null; | ||
toString(): string; | ||
encode(stream: BinaryStream): void; | ||
encode(stream: OutputBinaryStream): void; | ||
decodeDebug(stream: BinaryStream, options: any): void; | ||
@@ -31,3 +31,3 @@ decode(stream: BinaryStream): void; | ||
export declare type LocalizedTextLike = LocalizedTextOptions | LocalizedText | string; | ||
export declare function encodeLocalizedText(value: LocalizedText, stream: BinaryStream): void; | ||
export declare function encodeLocalizedText(value: LocalizedText, stream: OutputBinaryStream): void; | ||
export declare function decodeLocalizedText(stream: BinaryStream): LocalizedText; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* @module node-opcua-data-model | ||
*/ | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
const node_opcua_basic_types_1 = require("node-opcua-basic-types"); | ||
@@ -19,4 +15,5 @@ const node_opcua_factory_1 = require("node-opcua-factory"); | ||
} | ||
node_opcua_assert_1.assert(value.hasOwnProperty("locale")); | ||
node_opcua_assert_1.assert(value.hasOwnProperty("text")); | ||
if (!value.hasOwnProperty("text")) { | ||
throw new Error("cannot coerce to coerceLocalizedText"); | ||
} | ||
return new LocalizedText(value); | ||
@@ -23,0 +20,0 @@ } |
import { BaseUAObject, StructuredTypeSchema } from "node-opcua-factory"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { ExpandedNodeId } from "node-opcua-nodeid"; | ||
@@ -31,3 +31,3 @@ import { UAString, UInt16 } from "node-opcua-basic-types"; | ||
*/ | ||
encode(stream: BinaryStream): void; | ||
encode(stream: OutputBinaryStream): void; | ||
/** | ||
@@ -56,3 +56,3 @@ * decode the object from a binary stream | ||
export declare function coerceQualifiedName(value: any): QualifiedName | null; | ||
export declare function encodeQualifiedName(value: QualifiedName, stream: BinaryStream): void; | ||
export declare function encodeQualifiedName(value: QualifiedName, stream: OutputBinaryStream): void; | ||
export declare function decodeQualifiedName(stream: BinaryStream): QualifiedName; |
{ | ||
"name": "node-opcua-data-model", | ||
"version": "2.0.0-alpha.11", | ||
"version": "2.0.0-alpha.12", | ||
"description": "pure nodejs OPCUA SDK - module -data-model", | ||
@@ -14,14 +14,14 @@ "scripts": { | ||
"node-opcua-assert": "^2.0.0-alpha.10", | ||
"node-opcua-basic-types": "^2.0.0-alpha.11", | ||
"node-opcua-binary-stream": "^2.0.0-alpha.10", | ||
"node-opcua-basic-types": "^2.0.0-alpha.12", | ||
"node-opcua-binary-stream": "^2.0.0-alpha.12", | ||
"node-opcua-enum": "^2.0.0-alpha.10", | ||
"node-opcua-factory": "^2.0.0-alpha.11", | ||
"node-opcua-factory": "^2.0.0-alpha.12", | ||
"node-opcua-nodeid": "^2.0.0-alpha.11", | ||
"node-opcua-status-code": "^2.0.0-alpha.10", | ||
"node-opcua-utils": "^2.0.0-alpha.10", | ||
"node-opcua-status-code": "^2.0.0-alpha.12", | ||
"node-opcua-utils": "^2.0.0-alpha.12", | ||
"underscore": "^1.9.1" | ||
}, | ||
"devDependencies": { | ||
"node-opcua-generator": "^2.0.0-alpha.11", | ||
"node-opcua-packet-analyzer": "^2.0.0-alpha.11", | ||
"node-opcua-generator": "^2.0.0-alpha.12", | ||
"node-opcua-packet-analyzer": "^2.0.0-alpha.12", | ||
"should": "13.2.3", | ||
@@ -45,3 +45,3 @@ "source-map-support": "^0.5.10" | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "bf7ea24732637e662af9b5b63941388e89fd3427" | ||
"gitHead": "61699a99c75c631388f2e8d8e33eb209649c5eac" | ||
} |
@@ -6,3 +6,3 @@ // tslint:disable:no-bitwise | ||
*/ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { registerBasicType } from "node-opcua-factory"; | ||
@@ -101,4 +101,4 @@ import * as utils from "node-opcua-utils"; | ||
}, | ||
encode: (value: AccessLevelFlag, stream: BinaryStream) => stream.writeUInt8(value & 0x8F), | ||
encode: (value: AccessLevelFlag, stream: OutputBinaryStream) => stream.writeUInt8(value & 0x8F), | ||
random: randomAccessLevel | ||
}); |
/** | ||
* @module node-opcua-data-model | ||
*/ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { Enum } from "node-opcua-enum"; | ||
@@ -29,3 +29,3 @@ import { registerEnumeration } from "node-opcua-factory"; | ||
export function encodeBrowseDirection(value: BrowseDirection, stream: BinaryStream) { | ||
export function encodeBrowseDirection(value: BrowseDirection, stream: OutputBinaryStream) { | ||
stream.writeUInt32(value); | ||
@@ -32,0 +32,0 @@ } |
@@ -9,10 +9,14 @@ /** | ||
export function isValidDataEncoding(dataEncoding: string): boolean { | ||
const validEncoding = ["DefaultBinary", "DefaultXml"]; | ||
export function isValidDataEncoding(dataEncoding?: string | null): boolean { | ||
const validEncoding = ["DefaultBinary", "DefaultXml"]; | ||
if (!isDataEncoding(dataEncoding)) { | ||
if (dataEncoding && ((dataEncoding as any).name || (dataEncoding as any).text) ) { | ||
// tslint:disable:no-console | ||
console.log(" isValidDataEncoding => expecting a string here , not a LocalizedText or a QualifiedName "); | ||
return false; | ||
} | ||
if (!(dataEncoding && typeof dataEncoding === "string")) { | ||
return true; | ||
} | ||
return validEncoding.indexOf(dataEncoding) !== -1; | ||
return validEncoding.indexOf(dataEncoding as string) !== -1; | ||
} |
@@ -5,3 +5,3 @@ /** | ||
import assert from "node-opcua-assert"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { | ||
@@ -128,3 +128,3 @@ BaseUAObject, | ||
public encode(stream: BinaryStream): void { | ||
public encode(stream: OutputBinaryStream): void { | ||
encode_DiagnosticInfo(this, stream); | ||
@@ -185,3 +185,3 @@ } | ||
function encode_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: BinaryStream): void { | ||
function encode_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: OutputBinaryStream): void { | ||
@@ -330,3 +330,3 @@ const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo); | ||
export function encodeDiagnosticInfo(value: DiagnosticInfo, stream: BinaryStream): void { | ||
export function encodeDiagnosticInfo(value: DiagnosticInfo, stream: OutputBinaryStream): void { | ||
if (value === null) { | ||
@@ -333,0 +333,0 @@ emptyDiagnosticInfo.encode(stream); |
@@ -11,3 +11,3 @@ /** | ||
} from "node-opcua-basic-types"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { | ||
@@ -33,4 +33,5 @@ BaseUAObject, | ||
} | ||
assert(value.hasOwnProperty("locale")); | ||
assert(value.hasOwnProperty("text")); | ||
if (!value.hasOwnProperty("text")) { | ||
throw new Error("cannot coerce to coerceLocalizedText"); | ||
} | ||
return new LocalizedText(value); | ||
@@ -127,3 +128,3 @@ } | ||
// OPCUA Part 6 $ 5.2.2.14 : localizedText have a special encoding | ||
public encode(stream: BinaryStream) { | ||
public encode(stream: OutputBinaryStream) { | ||
@@ -203,3 +204,3 @@ // tslint:disable:no-bitwise | ||
const emptyLocalizedText = new LocalizedText({}); | ||
export function encodeLocalizedText(value: LocalizedText, stream: BinaryStream): void { | ||
export function encodeLocalizedText(value: LocalizedText, stream: OutputBinaryStream): void { | ||
if (value) { | ||
@@ -206,0 +207,0 @@ value.encode(stream); |
@@ -16,3 +16,3 @@ /** | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { ExpandedNodeId, makeExpandedNodeId } from "node-opcua-nodeid"; | ||
@@ -102,3 +102,3 @@ | ||
*/ | ||
public encode(stream: BinaryStream): void { | ||
public encode(stream: OutputBinaryStream): void { | ||
// call base class implementation first | ||
@@ -194,3 +194,3 @@ super.encode(stream); | ||
export function encodeQualifiedName(value: QualifiedName, stream: BinaryStream): void { | ||
export function encodeQualifiedName(value: QualifiedName, stream: OutputBinaryStream): void { | ||
value.encode(stream); | ||
@@ -197,0 +197,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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113195
2194