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

node-opcua-factory

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-factory - npm Package Compare versions

Comparing version 2.77.0 to 2.78.0

2

dist/datatype_factory.d.ts

@@ -18,2 +18,4 @@ import { ExpandedNodeId, NodeId } from "node-opcua-nodeid";

constructor(baseDataFactories: DataTypeFactory[]);
getStructureIterator(): IterableIterator<StructureInfo>;
getEnumIterator(): IterableIterator<EnumerationDefinitionSchema>;
repairBaseDataFactories(baseDataFactories: DataTypeFactory[]): void;

@@ -20,0 +22,0 @@ hasBuiltInType(name: string): boolean;

18

dist/datatype_factory.js

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

}
getStructureIterator() {
return this._structureInfoByDataTypeMap.values();
}
getEnumIterator() {
return this._enumerations.values();
}
repairBaseDataFactories(baseDataFactories) {

@@ -240,5 +246,4 @@ this.baseDataFactories = baseDataFactories;

if (this._structureInfoByName.has(typeName)) {
warningLog(this.getStructureInfoByTypeName(typeName));
warningLog("target namespace = `" + this.targetNamespace + "`");
warningLog(" registerFactory : " + typeName + " already registered. dataTypeNodeId=", dataTypeNodeId.toString());
warningLog("registerFactory : " + typeName + " already registered. dataTypeNodeId=", dataTypeNodeId.toString());
return;

@@ -283,6 +288,7 @@ }

if (dataFactory.hasConstructor(schema.encodingDefaultBinary)) {
console.log("schema", schema.name);
console.log("schema", schema.dataTypeNodeId.toString());
console.log("schema", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
console.log("schema", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
write("ERROR: cannot find constructor for encodingDefaultBinary");
write("schema name:", schema.name, "(abstract=", schema.isAbstract, ")");
write(" dataType NodeId:", schema.dataTypeNodeId.toString());
write("encoding Default Binary:", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
write("encoding Default Xml :", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
// return;

@@ -289,0 +295,0 @@ // throw new Error("Not in Binary Encoding Map!!!!! " + schema.encodingDefaultBinary);

import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
import { Enum, EnumItem, _TypescriptEnum } from "node-opcua-enum";
import { NodeId } from "node-opcua-nodeid";
import { TypeSchemaBase } from "./builtin_types";

@@ -17,3 +18,4 @@ import { EnumerationDefinition, TypeSchemaConstructorOptions } from "./types";

lengthInBits: number;
constructor(options: EnumerationDefinitionOptions);
dataTypeNodeId: NodeId;
constructor(dataTypeNodeId: NodeId, options: EnumerationDefinitionOptions);
}

@@ -20,0 +22,0 @@ /**

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

const node_opcua_assert_1 = require("node-opcua-assert");
const node_opcua_constants_1 = require("node-opcua-constants");
const node_opcua_enum_1 = require("node-opcua-enum");
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
const builtin_types_1 = require("./builtin_types");

@@ -28,4 +30,5 @@ function _encode_enumeration(typedEnum, value, stream) {

// xx decode: (stream: BinaryStream) => EnumItem;
constructor(options) {
constructor(dataTypeNodeId, options) {
super(options);
this.dataTypeNodeId = dataTypeNodeId;
// create a new Enum

@@ -58,2 +61,3 @@ this.enumValues = (0, node_opcua_enum_1.adaptTypescriptEnum)(options.enumValues);

function registerEnumeration(options) {
const dataTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.DataTypeIds[options.name]);
(0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(options, "name"));

@@ -65,3 +69,3 @@ (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(options, "enumValues"));

}
const enumerationDefinition = new EnumerationDefinitionSchema(options);
const enumerationDefinition = new EnumerationDefinitionSchema(dataTypeNodeId, options);
_enumerations.set(name, enumerationDefinition);

@@ -68,0 +72,0 @@ return enumerationDefinition.typedEnum;

{
"name": "node-opcua-factory",
"version": "2.77.0",
"version": "2.78.0",
"description": "pure nodejs OPCUA SDK - module -factory",

@@ -45,3 +45,3 @@ "main": "./dist/index.js",

"homepage": "http://node-opcua.github.io/",
"gitHead": "5c8d45772d786fa4ba59369dd26679353ab5482b"
"gitHead": "31c6eee3c51f52427584364fff2fdb07bbac65be"
}

@@ -50,2 +50,9 @@ /**

public getStructureIterator(): IterableIterator<StructureInfo> {
return this._structureInfoByDataTypeMap.values();
}
public getEnumIterator(): IterableIterator<EnumerationDefinitionSchema> {
return this._enumerations.values();
}
public repairBaseDataFactories(baseDataFactories: DataTypeFactory[]): void {

@@ -298,5 +305,4 @@ this.baseDataFactories = baseDataFactories;

if (this._structureInfoByName.has(typeName)) {
warningLog(this.getStructureInfoByTypeName(typeName));
warningLog("target namespace = `" + this.targetNamespace + "`");
warningLog(" registerFactory : " + typeName + " already registered. dataTypeNodeId=", dataTypeNodeId.toString());
warningLog("registerFactory : " + typeName + " already registered. dataTypeNodeId=", dataTypeNodeId.toString());
return;

@@ -330,3 +336,3 @@ }

}
function dumpDataFactory(dataFactory: DataTypeFactory, write: any) {
function dumpDataFactory(dataFactory: DataTypeFactory, write: (...args: [any, ...any[]])=>void) {
for (const structureTypeName of dataFactory.structuredTypesNames()) {

@@ -344,6 +350,7 @@ const schema = dataFactory.getStructuredTypeSchema(structureTypeName);

if (dataFactory.hasConstructor(schema.encodingDefaultBinary)) {
console.log("schema", schema.name);
console.log("schema", schema.dataTypeNodeId.toString());
console.log("schema", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
console.log("schema", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
write("ERROR: cannot find constructor for encodingDefaultBinary");
write("schema name:", schema.name, "(abstract=", schema.isAbstract,")");
write(" dataType NodeId:", schema.dataTypeNodeId.toString());
write("encoding Default Binary:", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
write("encoding Default Xml :", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
// return;

@@ -350,0 +357,0 @@ // throw new Error("Not in Binary Encoding Map!!!!! " + schema.encodingDefaultBinary);

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

import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
import { Enum, EnumItem, _TypescriptEnum , adaptTypescriptEnum} from "node-opcua-enum";
import { DataTypeIds } from "node-opcua-constants";
import { Enum, EnumItem, _TypescriptEnum, adaptTypescriptEnum } from "node-opcua-enum";
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
import { TypeSchemaBase } from "./builtin_types";

@@ -28,3 +30,2 @@ import { EnumerationDefinition, TypeSchemaConstructorOptions } from "./types";

export interface EnumerationDefinitionOptions extends TypeSchemaConstructorOptions {

@@ -41,3 +42,2 @@ enumValues: _TypescriptEnum | string[];

export class EnumerationDefinitionSchema extends TypeSchemaBase implements EnumerationDefinition {

@@ -47,7 +47,9 @@ public enumValues: _TypescriptEnum;

public lengthInBits: number;
public dataTypeNodeId: NodeId;
// xx encode: (value: EnumItem, stream: OutputBinaryStream) => void;
// xx decode: (stream: BinaryStream) => EnumItem;
constructor(options: EnumerationDefinitionOptions) {
constructor(dataTypeNodeId: NodeId, options: EnumerationDefinitionOptions) {
super(options);
this.dataTypeNodeId = dataTypeNodeId;
// create a new Enum

@@ -83,2 +85,4 @@ this.enumValues = adaptTypescriptEnum(options.enumValues);

export function registerEnumeration(options: EnumerationDefinitionOptions): Enum {
const dataTypeNodeId = resolveNodeId(DataTypeIds[options.name as any]);
assert(Object.prototype.hasOwnProperty.call(options, "name"));

@@ -91,3 +95,3 @@ assert(Object.prototype.hasOwnProperty.call(options, "enumValues"));

}
const enumerationDefinition = new EnumerationDefinitionSchema(options);
const enumerationDefinition = new EnumerationDefinitionSchema(dataTypeNodeId, options);
_enumerations.set(name, enumerationDefinition);

@@ -108,2 +112,1 @@

}

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