node-opcua-factory
Advanced tools
Comparing version 2.5.0-alpha.0 to 2.5.0-alpha.3
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=constructor_type.js.map |
@@ -35,4 +35,5 @@ import { ExpandedNodeId, NodeId } from "node-opcua-nodeid"; | ||
associateWithBinaryEncoding(className: string, expandedNodeId: ExpandedNodeId): void; | ||
registerFactory(dataTypeNodeId: NodeId, typeName: string, constructor: ConstructorFuncWithSchema): void; | ||
private _registerFactory; | ||
toString(): string; | ||
} | ||
export declare function callConstructor(constructor: ConstructorFunc): BaseUAObject; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const _ = require("underscore"); | ||
const util = require("util"); | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
@@ -122,2 +123,5 @@ const node_opcua_debug_1 = require("node-opcua-debug"); | ||
for (const factory of this.baseDataFactories) { | ||
if (!factory.hasStructuredType(typeName)) { | ||
continue; | ||
} | ||
const constructor2 = factory.getStructureTypeConstructor(typeName); | ||
@@ -154,5 +158,9 @@ if (constructor2) { | ||
registerClassDefinition(dataTypeNodeId, className, classConstructor) { | ||
this.registerFactory(dataTypeNodeId, className, classConstructor); | ||
node_opcua_assert_1.assert(classConstructor.encodingDefaultBinary.value !== 0); | ||
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary); | ||
this._registerFactory(dataTypeNodeId, className, classConstructor); | ||
if (classConstructor.encodingDefaultBinary && classConstructor.encodingDefaultBinary.value !== 0) { | ||
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary); | ||
} | ||
else { | ||
console.log("warning ", dataTypeNodeId.toString, "name= ", className, " do not have binary encoding"); | ||
} | ||
} | ||
@@ -228,3 +236,3 @@ // ---------------------------------------------------------------------------------------------------- | ||
} | ||
registerFactory(dataTypeNodeId, typeName, constructor) { | ||
_registerFactory(dataTypeNodeId, typeName, constructor) { | ||
node_opcua_assert_1.assert(dataTypeNodeId.value !== 0, "dataTypeNodeId cannot be null"); | ||
@@ -246,4 +254,33 @@ /* istanbul ignore next */ | ||
} | ||
toString() { | ||
const l = []; | ||
function write(...args) { | ||
l.push(util.format.apply(util.format, args)); | ||
} | ||
dumpDataFactory(this, write); | ||
return l.join("\n"); | ||
} | ||
} | ||
exports.DataTypeFactory = DataTypeFactory; | ||
function dumpSchema(schema, write) { | ||
write("name ", schema.name); | ||
write("dataType ", schema.dataTypeNodeId.toString()); | ||
write("binaryEncoding ", schema.encodingDefaultBinary.toString()); | ||
for (const f of schema.fields) { | ||
write(" ", f.name.padEnd(30, " "), f.isArray ? true : false, f.fieldType); | ||
} | ||
} | ||
function dumpDataFactory(dataFactory, write) { | ||
for (const structureTypeName of dataFactory.structuredTypesNames()) { | ||
const schema = dataFactory.getStructuredTypeSchema(structureTypeName); | ||
if (!dataFactory.findConstructorForDataType(schema.dataTypeNodeId)) { | ||
write(" ( No constructor for " + schema.name + " " + schema.dataTypeNodeId.toString()); | ||
} | ||
if (dataFactory.hasConstructor(schema.encodingDefaultBinary)) { | ||
throw new Error("Not in Binary Encoding Map!!!!!"); | ||
} | ||
write("structureTypeName =", structureTypeName); | ||
dumpSchema(schema, write); | ||
} | ||
} | ||
function verifyExpandedNodeId(expandedNodeId) { | ||
@@ -250,0 +287,0 @@ /* istanbul ignore next */ |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
import { ConstructorFunc } from "./constructor_type"; | ||
export declare function registerSpecialVariantEncoder(constructor: ConstructorFunc): void; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function generate_new_id(): number; | ||
export declare function next_available_id(): number; | ||
export declare function is_internal_id(value: number): boolean; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { FieldType, StructuredTypeField } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { FieldType, StructuredTypeOptions, TypeSchemaBase } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "node-opcua-factory", | ||
"version": "2.5.0-alpha.0", | ||
"version": "2.5.0-alpha.3", | ||
"description": "pure nodejs OPCUA SDK - module -factory", | ||
@@ -40,3 +40,3 @@ "main": "./dist/index.js", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "341ac6292b30304bb028ab10971dc8552ff1a35a" | ||
"gitHead": "6147dcbfbecdb8b72a3d331dd2859cbdf3e3e181" | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -7,2 +7,3 @@ /** | ||
import * as _ from "underscore"; | ||
import * as util from "util"; | ||
@@ -19,2 +20,3 @@ import { assert } from "node-opcua-assert"; | ||
import { BasicTypeDefinition } from "."; | ||
import { link } from "fs"; | ||
@@ -145,2 +147,5 @@ const debugLog = make_debugLog(__filename); | ||
for (const factory of this.baseDataFactories) { | ||
if (!factory.hasStructuredType(typeName)) { | ||
continue; | ||
} | ||
const constructor2 = factory.getStructureTypeConstructor(typeName); | ||
@@ -179,5 +184,8 @@ if (constructor2) { | ||
public registerClassDefinition(dataTypeNodeId: NodeId, className: string, classConstructor: ConstructorFuncWithSchema): void { | ||
this.registerFactory(dataTypeNodeId, className, classConstructor); | ||
assert(classConstructor.encodingDefaultBinary.value !== 0); | ||
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary); | ||
this._registerFactory(dataTypeNodeId, className, classConstructor); | ||
if (classConstructor.encodingDefaultBinary && classConstructor.encodingDefaultBinary.value !== 0) { | ||
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary); | ||
} else { | ||
console.log("warning ", dataTypeNodeId.toString, "name= ", className, " do not have binary encoding"); | ||
} | ||
} | ||
@@ -263,3 +271,3 @@ | ||
public registerFactory(dataTypeNodeId: NodeId, typeName: string, constructor: ConstructorFuncWithSchema): void { | ||
private _registerFactory(dataTypeNodeId: NodeId, typeName: string, constructor: ConstructorFuncWithSchema): void { | ||
assert(dataTypeNodeId.value !== 0, "dataTypeNodeId cannot be null"); | ||
@@ -282,4 +290,36 @@ /* istanbul ignore next */ | ||
public toString(): string { | ||
const l: string[] = []; | ||
function write(...args: [any, ...any[]]) { | ||
l.push(util.format.apply(util.format, args)); | ||
} | ||
dumpDataFactory(this, write); | ||
return l.join("\n"); | ||
} | ||
} | ||
function dumpSchema(schema: StructuredTypeSchema, write: any) { | ||
write("name ", schema.name); | ||
write("dataType ", schema.dataTypeNodeId.toString()); | ||
write("binaryEncoding ", schema.encodingDefaultBinary!.toString()); | ||
for (const f of schema.fields) { | ||
write(" ", f.name.padEnd(30, " "), f.isArray ? true : false, f.fieldType); | ||
} | ||
} | ||
function dumpDataFactory(dataFactory: DataTypeFactory, write: any) { | ||
for (const structureTypeName of dataFactory.structuredTypesNames()) { | ||
const schema = dataFactory.getStructuredTypeSchema(structureTypeName); | ||
if (!dataFactory.findConstructorForDataType(schema.dataTypeNodeId)) { | ||
write(" ( No constructor for " + schema.name + " " + schema.dataTypeNodeId.toString()); | ||
} | ||
if (dataFactory.hasConstructor(schema.encodingDefaultBinary!)) { | ||
throw new Error("Not in Binary Encoding Map!!!!!"); | ||
} | ||
write("structureTypeName =", structureTypeName); | ||
dumpSchema(schema, write); | ||
} | ||
} | ||
function verifyExpandedNodeId(expandedNodeId: NodeId): boolean { | ||
@@ -302,2 +342,1 @@ /* istanbul ignore next */ | ||
} | ||
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,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
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
376044
4065