node-opcua-factory
Advanced tools
Comparing version 2.0.0-alpha.11 to 2.0.0-alpha.12
@@ -1,2 +0,2 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { ExpandedNodeId } from "node-opcua-nodeid"; | ||
@@ -20,3 +20,3 @@ export interface DecodeDebugOptions { | ||
*/ | ||
encode(stream: BinaryStream): void; | ||
encode(stream: OutputBinaryStream): void; | ||
/** | ||
@@ -39,3 +39,3 @@ * Decode the object from the binary stream. | ||
*/ | ||
toString(): string; | ||
toString(...args: any[]): string; | ||
/** | ||
@@ -42,0 +42,0 @@ * |
@@ -38,3 +38,3 @@ "use strict"; | ||
break; | ||
case types_1.FieldCategory.complex: | ||
case types_1.FieldCategory.complex: { | ||
node_opcua_assert_1.default(field.category === types_1.FieldCategory.complex); | ||
@@ -51,3 +51,3 @@ if (!field.fieldTypeConstructor) { | ||
value.decodeDebug(stream, options); | ||
break; | ||
} | ||
} | ||
@@ -271,3 +271,3 @@ return value; | ||
*/ | ||
toString() { | ||
toString(...args) { | ||
if (this.schema && this.schema.hasOwnProperty("toString")) { | ||
@@ -336,3 +336,3 @@ return this.schema.toString.apply(this, arguments); | ||
lines: [], | ||
padding: " ", | ||
padding: " " | ||
}; | ||
@@ -339,0 +339,0 @@ data.lines.push("{" + chalk_1.default.cyan(" /*" + this.schema.name + "*/")); |
@@ -1,6 +0,6 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
export interface BasicTypeOptions { | ||
name: string; | ||
subType: string; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => void; | ||
@@ -7,0 +7,0 @@ validate?: (value: any) => boolean; |
@@ -1,6 +0,6 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { BasicTypeDefinition, BasicTypeDefinitionOptions, TypeSchemaBase } from "./types"; | ||
export declare class BasicTypeSchema extends TypeSchemaBase implements BasicTypeDefinition { | ||
subType: string; | ||
encode: (value: any, stream: BinaryStream) => void; | ||
encode: (value: any, stream: OutputBinaryStream) => void; | ||
decode: (stream: BinaryStream) => any; | ||
@@ -7,0 +7,0 @@ constructor(options: BasicTypeDefinitionOptions); |
@@ -1,2 +0,2 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { Enum, EnumItem } from "node-opcua-enum"; | ||
@@ -8,3 +8,3 @@ import { EnumerationDefinition, TypeSchemaBase, TypeSchemaConstructorOptions } from "./types"; | ||
defaultValue?: EnumItem; | ||
encode?: (value: EnumItem, stream: BinaryStream) => void; | ||
encode?: (value: EnumItem, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => EnumItem; | ||
@@ -11,0 +11,0 @@ } |
@@ -15,3 +15,3 @@ "use strict"; | ||
class EnumerationDefinitionSchema extends types_1.TypeSchemaBase { | ||
// xx encode: (value: EnumItem, stream: BinaryStream) => void; | ||
// xx encode: (value: EnumItem, stream: OutputBinaryStream) => void; | ||
// xx decode: (stream: BinaryStream) => EnumItem; | ||
@@ -18,0 +18,0 @@ constructor(options) { |
@@ -1,2 +0,2 @@ | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { Enum } from "node-opcua-enum"; | ||
@@ -8,3 +8,3 @@ import { NodeId } from "node-opcua-nodeid"; | ||
name: string; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => any; | ||
@@ -66,3 +66,3 @@ coerce?: (value: any) => any; | ||
defaultValue?: any; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => any; | ||
@@ -96,3 +96,3 @@ coerce?: (value: any) => any; | ||
defaultValue: any; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => any; | ||
@@ -99,0 +99,0 @@ coerce?: (value: any) => any; |
{ | ||
"name": "node-opcua-factory", | ||
"version": "2.0.0-alpha.11", | ||
"version": "2.0.0-alpha.12", | ||
"description": "pure nodejs OPCUA SDK - module -factory", | ||
@@ -14,9 +14,9 @@ "main": "./dist/index.js", | ||
"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-guid": "^2.0.0-alpha.10", | ||
"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" | ||
@@ -42,3 +42,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "bf7ea24732637e662af9b5b63941388e89fd3427" | ||
"gitHead": "61699a99c75c631388f2e8d8e33eb209649c5eac" | ||
} |
@@ -7,3 +7,3 @@ /** | ||
import assert from "node-opcua-assert"; | ||
import { BinaryStream, BinaryStreamSizeCalculator } from "node-opcua-binary-stream"; | ||
import { BinaryStream, BinaryStreamSizeCalculator, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { hexDump } from "node-opcua-debug"; | ||
@@ -43,3 +43,3 @@ import * as utils from "node-opcua-utils"; | ||
break; | ||
case FieldCategory.complex: | ||
case FieldCategory.complex: { | ||
assert(field.category === FieldCategory.complex); | ||
@@ -57,3 +57,3 @@ | ||
value.decodeDebug(stream, options); | ||
break; | ||
} | ||
} | ||
@@ -72,3 +72,3 @@ | ||
const _nbElements = process.env.ARRAYLENGTH ? parseInt(process.env.ARRAYLENGTH, 10 ) : 10; | ||
const _nbElements = process.env.ARRAYLENGTH ? parseInt(process.env.ARRAYLENGTH, 10) : 10; | ||
@@ -152,3 +152,3 @@ function _arrayEllipsis(value: any[] | null) { | ||
str = fieldNameF + " " + fieldTypeF + ": " | ||
+ ((value === null || value === undefined) ? chalk.blue("null") : value.toString()); | ||
+ ((value === null || value === undefined) ? chalk.blue("null") : value.toString()); | ||
} | ||
@@ -186,3 +186,3 @@ data.lines.push(str); | ||
const data1 = {padding: padding + " ", lines: []}; | ||
const data1 = { padding: padding + " ", lines: [] }; | ||
applyOnAllSchemaFields(element, _newDesc, data1, _exploreObject, args); | ||
@@ -202,3 +202,3 @@ data.lines = data.lines.concat(data1.lines); | ||
data.lines.push(fieldNameF + " " + fieldTypeF + ": {"); | ||
const data1 = {padding: padding + " ", lines: []}; | ||
const data1 = { padding: padding + " ", lines: [] }; | ||
applyOnAllSchemaFields(value, _newDesc, data1, _exploreObject, args); | ||
@@ -300,3 +300,3 @@ data.lines = data.lines.concat(data1.lines); | ||
*/ | ||
public encode(stream: BinaryStream): void { | ||
public encode(stream: OutputBinaryStream): void { | ||
} | ||
@@ -320,3 +320,3 @@ | ||
const stream = new BinaryStreamSizeCalculator(); | ||
this.encode(stream as BinaryStream); | ||
this.encode(stream as OutputBinaryStream); | ||
return stream.length; | ||
@@ -329,3 +329,3 @@ } | ||
*/ | ||
public toString(): string { | ||
public toString(...args: any[]): string { | ||
@@ -410,3 +410,3 @@ if (this.schema && this.schema.hasOwnProperty("toString")) { | ||
lines: [], | ||
padding: " ", | ||
padding: " " | ||
}; | ||
@@ -459,2 +459,3 @@ | ||
} | ||
// tslint:disable:max-classes-per-file | ||
@@ -464,2 +465,3 @@ export class ExtensionObject extends BaseUAObject { | ||
public static encodingDefaultXml: ExpandedNodeId; | ||
constructor(options: any) { | ||
@@ -471,7 +473,7 @@ super(); | ||
function _visitSchemaChain( | ||
self: BaseUAObject, | ||
schema: StructuredTypeSchema, | ||
options: any, | ||
func: (self: BaseUAObject, schema: StructuredTypeSchema, options: any) => void, | ||
extraData: any | ||
self: BaseUAObject, | ||
schema: StructuredTypeSchema, | ||
options: any, | ||
func: (self: BaseUAObject, schema: StructuredTypeSchema, options: any) => void, | ||
extraData: any | ||
) { | ||
@@ -478,0 +480,0 @@ assert(_.isFunction(func)); |
@@ -6,3 +6,3 @@ /** | ||
import { decodeLocaleId, encodeLocaleId, validateLocaleId } from "node-opcua-basic-types"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import * as _ from "underscore"; | ||
@@ -16,3 +16,3 @@ import * as util from "util"; | ||
subType: string; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => void; | ||
@@ -19,0 +19,0 @@ validate?: (value: any) => boolean; |
@@ -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 * as _ from "underscore"; | ||
@@ -14,3 +14,3 @@ | ||
assert(_.isFunction(constructor)); | ||
return (value: any, stream: BinaryStream) => { | ||
return (value: any, stream: OutputBinaryStream) => { | ||
if (!value || !value.encode) { | ||
@@ -17,0 +17,0 @@ value = new constructor(value); |
@@ -29,3 +29,3 @@ /** | ||
} from "node-opcua-basic-types"; | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { emptyGuid } from "node-opcua-guid"; | ||
@@ -39,3 +39,3 @@ import { makeExpandedNodeId, makeNodeId } from "node-opcua-nodeid"; | ||
// tslint:enable:no-unused-variable | ||
function defaultEncode(value: any, stream: BinaryStream): void { | ||
function defaultEncode(value: any, stream: OutputBinaryStream): void { | ||
@@ -52,3 +52,3 @@ } | ||
public encode: (value: any, stream: BinaryStream) => void; | ||
public encode: (value: any, stream: OutputBinaryStream) => void; | ||
public decode: (stream: BinaryStream) => any; | ||
@@ -78,3 +78,3 @@ | ||
function encodeAny(value: any, stream: BinaryStream) { | ||
function encodeAny(value: any, stream: OutputBinaryStream) { | ||
assert(false, "type 'Any' cannot be encoded"); | ||
@@ -87,3 +87,3 @@ } | ||
function encodeNull(value: any, stream: BinaryStream): void { | ||
function encodeNull(value: any, stream: OutputBinaryStream): void { | ||
} | ||
@@ -103,2 +103,11 @@ | ||
interface T { | ||
subType?: any; | ||
name: string; | ||
encode: (value: any, stream: OutputBinaryStream) => void; | ||
decode: (stream: BinaryStream) => any; | ||
coerce?: any; | ||
defaultValue?: any; | ||
toJSON?: any; | ||
} | ||
// Built-In Type | ||
@@ -105,0 +114,0 @@ const _defaultType: any[] = [ |
@@ -7,3 +7,3 @@ /** | ||
import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { Enum, EnumItem } from "node-opcua-enum"; | ||
@@ -14,3 +14,3 @@ import { EnumerationDefinition, TypeSchemaBase, TypeSchemaConstructorOptions } from "./types"; | ||
function _encode_enumeration(value: EnumItem, stream: BinaryStream): void { | ||
function _encode_enumeration(value: EnumItem, stream: OutputBinaryStream): void { | ||
stream.writeInteger(value.value); | ||
@@ -26,3 +26,3 @@ } | ||
defaultValue?: EnumItem; | ||
encode?: (value: EnumItem, stream: BinaryStream) => void; | ||
encode?: (value: EnumItem, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => EnumItem; | ||
@@ -34,3 +34,3 @@ } | ||
public typedEnum: Enum; | ||
// xx encode: (value: EnumItem, stream: BinaryStream) => void; | ||
// xx encode: (value: EnumItem, stream: OutputBinaryStream) => void; | ||
// xx decode: (stream: BinaryStream) => EnumItem; | ||
@@ -37,0 +37,0 @@ |
@@ -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 { Enum, EnumItem } from "node-opcua-enum"; | ||
@@ -23,3 +23,3 @@ import { NodeId } from "node-opcua-nodeid"; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => any; | ||
@@ -103,3 +103,3 @@ | ||
defaultValue?: any; | ||
encode?: (value: any, stream: BinaryStream) => void; | ||
encode?: (value: any, stream: OutputBinaryStream) => void; | ||
decode?: (stream: BinaryStream) => any; | ||
@@ -150,3 +150,3 @@ coerce?: (value: any) => any; | ||
public defaultValue: any; | ||
public encode?: (value: any, stream: BinaryStream) => void; | ||
public encode?: (value: any, stream: OutputBinaryStream) => void; | ||
public decode?: (stream: BinaryStream) => any; | ||
@@ -153,0 +153,0 @@ public coerce?: (value: any) => any; |
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
171248
3374