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.0.0-alpha.8 to 2.0.0-alpha.9

4

dist/factories_baseobject.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:no-shadowed-variable
/**
* @module opcua.address_space.types
* @module node-opcua-factory
*/
// tslint:disable:no-shadowed-variable
const chalk_1 = require("chalk");

@@ -8,0 +8,0 @@ const node_opcua_assert_1 = require("node-opcua-assert");

@@ -30,12 +30,12 @@ import { BinaryStream } from "node-opcua-binary-stream";

*
* @param [schema.decode] {Function} optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode] optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode.stream] {BinaryStream}
*
* @param [schema.coerce] {Function} optional, a method to convert a value into the request type.
* @param [schema.coerce] optional, a method to convert a value into the request type.
* @param schema.coerce.value {*} the value to coerce.
*
* @param [schema.random] {Function} optional, a method to construct a random object of this type
* @param [schema.random] optional, a method to construct a random object of this type
*
* @param [schema.toJSON]{Function} optional, a method to convert a value into the request type.
* @param [schema.toJSON]optional, a method to convert a value into the request type.
*/
export declare function registerBasicType(schema: BasicTypeOptions): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/
const node_opcua_assert_1 = require("node-opcua-assert");
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
const _ = require("underscore");
const util = require("util");
const factories_builtin_types_1 = require("./factories_builtin_types");
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
const util = require("util");
/**

@@ -28,11 +28,11 @@ * register a Basic Type ,

*
* @param [schema.decode] {Function} optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode] optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode.stream] {BinaryStream}
*
* @param [schema.coerce] {Function} optional, a method to convert a value into the request type.
* @param [schema.coerce] optional, a method to convert a value into the request type.
* @param schema.coerce.value {*} the value to coerce.
*
* @param [schema.random] {Function} optional, a method to construct a random object of this type
* @param [schema.random] optional, a method to construct a random object of this type
*
* @param [schema.toJSON]{Function} optional, a method to convert a value into the request type.
* @param [schema.toJSON]optional, a method to convert a value into the request type.
*/

@@ -44,2 +44,3 @@ function registerBasicType(schema) {

if (!t) {
// tslint:disable-next-line:no-console
console.log(util.inspect(schema, { colors: true }));

@@ -60,9 +61,9 @@ throw new Error(" cannot find subtype " + schema.subType);

name,
subType: schema.subType,
coerce: coerceFunc,
decode: decodeFunc,
encode: encodeFunc,
decode: decodeFunc,
random,
defaultValue,
coerce: coerceFunc,
toJSON: toJSONFunc,
subType: schema.subType,
random
};

@@ -88,6 +89,6 @@ factories_builtin_types_1.registerType(newSchema);

subType: "String",
defaultValue: null,
decode: node_opcua_basic_types_1.decodeLocaleId,
encode: node_opcua_basic_types_1.encodeLocaleId,
decode: node_opcua_basic_types_1.decodeLocaleId,
validate: node_opcua_basic_types_1.validateLocaleId,
defaultValue: null
});

@@ -94,0 +95,0 @@ registerBasicType({ name: "ContinuationPoint", subType: "ByteString" });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-factory
*/
const node_opcua_assert_1 = require("node-opcua-assert");

@@ -4,0 +7,0 @@ const _ = require("underscore");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -6,0 +6,0 @@ const node_opcua_assert_1 = require("node-opcua-assert");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -6,0 +6,0 @@ const node_opcua_assert_1 = require("node-opcua-assert");

/**
* @module opcua.miscellaneous
* @module node-opcua-factory
* @class Factory

@@ -4,0 +4,0 @@ * @static

"use strict";
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
* @class Factory

@@ -53,2 +53,5 @@ * @static

}
if (expandedId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeId");
}
return constructorMap[expandedId.value];

@@ -66,2 +69,5 @@ }

}
if (expandedId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeId");
}
return !!constructorMap[expandedId.value];

@@ -82,2 +88,6 @@ }

/* istanbul ignore next */
if (expandedNodeId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeid");
}
/* istanbul ignore next */
if (expandedNodeId.value in constructorMap) {

@@ -84,0 +94,0 @@ throw new Error(" Class " + className + " with ID " + expandedNodeId +

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-factory
*/
const _FIRST_INTERNAL_ID = 0xFFFE0000;

@@ -4,0 +7,0 @@ let _nextAvailableId = _FIRST_INTERNAL_ID;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -6,0 +6,0 @@ const node_opcua_assert_1 = require("node-opcua-assert");

@@ -0,4 +1,7 @@

/**
* @module node-opcua-factory
*/
import { CommonInterface, FieldCategory, FieldInterfaceOptions, FieldType, StructuredTypeOptions, TypeSchemaBase } from "./types";
import { NodeId, ExpandedNodeId } from "node-opcua-nodeid";
import { BinaryStream } from "node-opcua-binary-stream";
import { ExpandedNodeId, NodeId } from "node-opcua-nodeid";
export declare function figureOutFieldCategory(field: FieldInterfaceOptions): FieldCategory;

@@ -5,0 +8,0 @@ export declare function figureOutSchema(field: FieldInterfaceOptions, category: FieldCategory): CommonInterface;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-factory
*/
const types_1 = require("./types");
const factories_builtin_types_1 = require("./factories_builtin_types");
const factories_enumerations_1 = require("./factories_enumerations");
const factories_factories_1 = require("./factories_factories");
const factories_enumerations_1 = require("./factories_enumerations");
const factories_builtin_types_1 = require("./factories_builtin_types");
const factories_schema_helpers_1 = require("./factories_schema_helpers");

@@ -74,7 +77,7 @@ const node_opcua_nodeid_1 = require("node-opcua-nodeid");

name: node_opcua_utils_1.lowerFirstLetter(fieldLight.name),
category,
defaultValue: fieldLight.defaultValue,
isArray: fieldLight.isArray,
documentation: fieldLight.documentation,
fieldType: fieldLight.fieldType,
defaultValue: fieldLight.defaultValue,
category,
schema

@@ -163,3 +166,4 @@ };

if (!_.isObject(options) && !(typeof (options) === "object")) {
let message = chalk_1.default.red(" Invalid options specified while trying to construct a ") + " " + chalk_1.default.yellow(schema.name);
let message = chalk_1.default.red(" Invalid options specified while trying to construct a ")
+ " " + chalk_1.default.yellow(schema.name);
message += "\n";

@@ -169,4 +173,4 @@ message += chalk_1.default.red(" expecting a ") + chalk_1.default.yellow(" Object ");

message += chalk_1.default.red(" and got a ") + chalk_1.default.yellow((typeof options)) + chalk_1.default.red(" instead ");
console.log(" Schema = ", schema);
console.log(" options = ", options);
// console.log(" Schema = ", schema);
// console.log(" options = ", options);
throw new Error(message);

@@ -186,7 +190,6 @@ }

if (invalidOptionsFields.length > 0) {
// tslint:disable:no-console
console.log("expected schema", schema.name);
// xx console.log("schema", schema);
console.log(chalk_1.default.yellow("possible fields= "), possibleFields.sort().join(" "));
console.log(chalk_1.default.red("current fields= "), currentFields.sort().join(" "));
// display_trace_from_this_projet_only();
console.log(chalk_1.default.cyan("invalid_options_fields= "), invalidOptionsFields.sort().join(" "));

@@ -193,0 +196,0 @@ }

@@ -0,1 +1,4 @@

/**
* @module node-opcua-factory
*/
export * from "./factories_id_generator";

@@ -2,0 +5,0 @@ export * from "./factories_enumerations";

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

Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-factory
*/
__export(require("./factories_id_generator"));

@@ -8,0 +11,0 @@ __export(require("./factories_enumerations"));

import { BinaryStream } from "node-opcua-binary-stream";
import { Enum } from "node-opcua-enum";
import { NodeId } from "node-opcua-nodeid";
import { ConstructorFunc } from "./factories_factories";
import { NodeId } from "node-opcua-nodeid";
import { FieldInterfaceOptions } from "./types";

@@ -6,0 +6,0 @@ export interface CommonInterface {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module node-opcua-factory
*/
const node_opcua_assert_1 = require("node-opcua-assert");
const _ = require("underscore");
const node_opcua_assert_1 = require("node-opcua-assert");
var FieldCategory;

@@ -6,0 +9,0 @@ (function (FieldCategory) {

{
"name": "node-opcua-factory",
"version": "2.0.0-alpha.8",
"version": "2.0.0-alpha.9",
"description": "pure nodejs OPCUA SDK - module -factory",

@@ -13,14 +13,14 @@ "main": "./dist/index.js",

"chalk": "^2.4.1",
"node-opcua-assert": "^2.0.0-alpha.8",
"node-opcua-basic-types": "^2.0.0-alpha.8",
"node-opcua-binary-stream": "^2.0.0-alpha.8",
"node-opcua-enum": "^2.0.0-alpha.8",
"node-opcua-guid": "^2.0.0-alpha.8",
"node-opcua-nodeid": "^2.0.0-alpha.8",
"node-opcua-status-code": "^2.0.0-alpha.8",
"node-opcua-utils": "^2.0.0-alpha.8",
"node-opcua-assert": "^2.0.0-alpha.9",
"node-opcua-basic-types": "^2.0.0-alpha.9",
"node-opcua-binary-stream": "^2.0.0-alpha.9",
"node-opcua-enum": "^2.0.0-alpha.9",
"node-opcua-guid": "^2.0.0-alpha.9",
"node-opcua-nodeid": "^2.0.0-alpha.9",
"node-opcua-status-code": "^2.0.0-alpha.9",
"node-opcua-utils": "^2.0.0-alpha.9",
"underscore": "^1.9.1"
},
"devDependencies": {
"node-opcua-debug": "^2.0.0-alpha.8"
"node-opcua-debug": "^2.0.0-alpha.9"
},

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

"homepage": "http://node-opcua.github.io/",
"gitHead": "7bbf38d5a3cd29cb6aed6ca38078f4d89d3f956a"
"gitHead": "cd7120d1840593757f0f3c9e53be4e85883dc0e6"
}

@@ -1,5 +0,5 @@

// tslint:disable:no-shadowed-variable
/**
* @module opcua.address_space.types
* @module node-opcua-factory
*/
// tslint:disable:no-shadowed-variable
import chalk from "chalk";

@@ -6,0 +6,0 @@ import assert from "node-opcua-assert";

/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/
import assert from "node-opcua-assert";
import { decodeLocaleId, encodeLocaleId, validateLocaleId } from "node-opcua-basic-types";
import { BinaryStream } from "node-opcua-binary-stream";
import * as _ from "underscore";
import { registerType, findSimpleType } from "./factories_builtin_types";
import { validateLocaleId, decodeLocaleId, encodeLocaleId } from "node-opcua-basic-types";
import * as util from "util";
import { BinaryStream } from "node-opcua-binary-stream";
import { findSimpleType, registerType } from "./factories_builtin_types";
import { BasicTypeDefinition, BasicTypeDefinitionOptions } from "./types";
export interface BasicTypeOptions {

@@ -41,11 +40,11 @@ name: string;

*
* @param [schema.decode] {Function} optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode] optional,a specific decoder function that returns the decode value out of the stream.
* @param [schema.decode.stream] {BinaryStream}
*
* @param [schema.coerce] {Function} optional, a method to convert a value into the request type.
* @param [schema.coerce] optional, a method to convert a value into the request type.
* @param schema.coerce.value {*} the value to coerce.
*
* @param [schema.random] {Function} optional, a method to construct a random object of this type
* @param [schema.random] optional, a method to construct a random object of this type
*
* @param [schema.toJSON]{Function} optional, a method to convert a value into the request type.
* @param [schema.toJSON]optional, a method to convert a value into the request type.
*/

@@ -60,2 +59,3 @@ export function registerBasicType(schema: BasicTypeOptions) {

if (!t) {
// tslint:disable-next-line:no-console
console.log(util.inspect(schema, { colors: true}));

@@ -81,9 +81,15 @@ throw new Error(" cannot find subtype " + schema.subType);

name,
subType: schema.subType,
coerce: coerceFunc,
decode: decodeFunc,
encode: encodeFunc,
decode: decodeFunc,
random,
defaultValue,
coerce: coerceFunc,
toJSON: toJSONFunc,
subType: schema.subType,
random
};

@@ -111,6 +117,8 @@ registerType(newSchema);

subType: "String",
defaultValue: null,
decode: decodeLocaleId,
encode: encodeLocaleId,
decode: decodeLocaleId,
validate: validateLocaleId,
defaultValue: null
});

@@ -117,0 +125,0 @@

@@ -0,4 +1,7 @@

/**
* @module node-opcua-factory
*/
import assert from "node-opcua-assert";
import { BinaryStream } from "node-opcua-binary-stream";
import * as _ from "underscore";
import { BinaryStream } from "node-opcua-binary-stream";

@@ -17,2 +20,3 @@ import { registerType } from "./factories_builtin_types";

}
function _self_decode(constructor: any) {

@@ -26,2 +30,3 @@ assert(_.isFunction(constructor));

}
function _self_coerce(constructor: any) {

@@ -37,3 +42,2 @@ assert(_.isFunction(constructor));

assert(_.isFunction(constructor));

@@ -46,5 +50,9 @@

subType: name,
encode: _self_encode(constructor),
decode: _self_decode(constructor),
coerce: _self_coerce(constructor),
defaultValue: () => new constructor()

@@ -54,2 +62,1 @@ });

}
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -4,0 +4,0 @@ import assert from "node-opcua-assert";

/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -4,0 +4,0 @@ import assert from "node-opcua-assert";

/**
* @module opcua.miscellaneous
* @module node-opcua-factory
* @class Factory

@@ -70,2 +70,5 @@ * @static

}
if (expandedId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeId");
}
return constructorMap[expandedId.value];

@@ -83,2 +86,5 @@ }

}
if (expandedId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeId");
}
return !!constructorMap[expandedId.value];

@@ -102,2 +108,7 @@ }

/* istanbul ignore next */
if (expandedNodeId.value instanceof Buffer) {
throw new Error("getConstructor not implemented for opaque nodeid");
}
/* istanbul ignore next */
if (expandedNodeId.value in constructorMap) {

@@ -107,4 +118,4 @@ throw new Error(" Class " + className + " with ID " + expandedNodeId +

}
constructorMap[expandedNodeId.value] = classConstructor;
}

@@ -0,1 +1,4 @@

/**
* @module node-opcua-factory
*/
const _FIRST_INTERNAL_ID = 0xFFFE0000;

@@ -16,4 +19,1 @@

}
/**
* @module opcua.miscellaneous
* @module node-opcua-factory
*/

@@ -4,0 +4,0 @@ import assert from "node-opcua-assert";

@@ -0,1 +1,4 @@

/**
* @module node-opcua-factory
*/
import {

@@ -10,12 +13,11 @@ CommonInterface,

import { getBuildInType, hasBuiltInType } from "./factories_builtin_types";
import { getEnumeration, hasEnumeration } from "./factories_enumerations";
import { getStructuredTypeSchema, getStructureTypeConstructor } from "./factories_factories";
import { getEnumeration, hasEnumeration } from "./factories_enumerations";
import { getBuildInType, hasBuiltInType } from "./factories_builtin_types";
import { parameters } from "./factories_schema_helpers";
import { NodeId, ExpandedNodeId } from "node-opcua-nodeid";
import { BinaryStream } from "node-opcua-binary-stream";
import { display_trace_from_this_projet_only } from "node-opcua-debug";
import { ExpandedNodeId, NodeId } from "node-opcua-nodeid";
import { capitalizeFirstLetter, lowerFirstLetter } from "node-opcua-utils";
import { display_trace_from_this_projet_only } from "node-opcua-debug";

@@ -90,7 +92,9 @@ import chalk from "chalk";

name: lowerFirstLetter(fieldLight.name),
category,
defaultValue: fieldLight.defaultValue,
isArray: fieldLight.isArray,
documentation: fieldLight.documentation,
fieldType: fieldLight.fieldType,
defaultValue: fieldLight.defaultValue,
category,
schema

@@ -102,17 +106,17 @@ };

fields: FieldType[];
id: NodeId;
baseType: string;
_possibleFields: string[];
_baseSchema: StructuredTypeSchema | null;
public fields: FieldType[];
public id: NodeId;
public baseType: string;
public _possibleFields: string[];
public _baseSchema: StructuredTypeSchema | null;
documentation?: string;
public documentation?: string;
isValid?: (options: any) => boolean;
public isValid?: (options: any) => boolean;
decodeDebug?: (stream: BinaryStream, options: any) => any;
constructHook?: (options: any) => any;
public decodeDebug?: (stream: BinaryStream, options: any) => any;
public constructHook?: (options: any) => any;
encodingDefaultBinary?: ExpandedNodeId;
encodingDefaultXml?: ExpandedNodeId;
public encodingDefaultBinary?: ExpandedNodeId;
public encodingDefaultXml?: ExpandedNodeId;

@@ -130,3 +134,2 @@ constructor(options: StructuredTypeOptions) {

/**

@@ -195,3 +198,2 @@ *

/**

@@ -213,3 +215,4 @@ * check correctness of option fields against scheme

if (!_.isObject(options) && !(typeof(options) === "object")) {
let message = chalk.red(" Invalid options specified while trying to construct a ") + " " + chalk.yellow(schema.name);
let message = chalk.red(" Invalid options specified while trying to construct a ")
+ " " + chalk.yellow(schema.name);
message += "\n";

@@ -219,4 +222,4 @@ message += chalk.red(" expecting a ") + chalk.yellow(" Object ");

message += chalk.red(" and got a ") + chalk.yellow((typeof options)) + chalk.red(" instead ");
console.log(" Schema = ", schema);
console.log(" options = ", options);
// console.log(" Schema = ", schema);
// console.log(" options = ", options);
throw new Error(message);

@@ -241,7 +244,6 @@ }

if (invalidOptionsFields.length > 0) {
// tslint:disable:no-console
console.log("expected schema", schema.name);
// xx console.log("schema", schema);
console.log(chalk.yellow("possible fields= "), possibleFields.sort().join(" "));
console.log(chalk.red("current fields= "), currentFields.sort().join(" "));
// display_trace_from_this_projet_only();
console.log(chalk.cyan("invalid_options_fields= "), invalidOptionsFields.sort().join(" "));

@@ -255,7 +257,4 @@ }

export function buildStructuredType(schemaLight: StructuredTypeOptions): StructuredTypeSchema {
return new StructuredTypeSchema(schemaLight);
}

@@ -0,1 +1,4 @@

/**
* @module node-opcua-factory
*/
export * from "./factories_id_generator";

@@ -2,0 +5,0 @@ export * from "./factories_enumerations";

@@ -0,7 +1,10 @@

/**
* @module node-opcua-factory
*/
import assert from "node-opcua-assert";
import { BinaryStream } from "node-opcua-binary-stream";
import { Enum, EnumItem } from "node-opcua-enum";
import { NodeId } from "node-opcua-nodeid";
import * as _ from "underscore";
import assert from "node-opcua-assert";
import { Enum, EnumItem } from "node-opcua-enum";
import { ConstructorFunc } from "./factories_factories";
import { NodeId } from "node-opcua-nodeid";
import { FieldInterfaceOptions } from "./types";

@@ -57,2 +60,3 @@

// tslint:disable:no-empty-interface
export interface FieldEnumeration extends StructuredTypeField {

@@ -94,3 +98,2 @@ // xx category: FieldCategory.enumeration;

export interface TypeSchemaConstructorOptions {

@@ -126,3 +129,2 @@ name: string;

// tslint:disable-next-line:no-empty

@@ -146,9 +148,9 @@ function defaultEncode(value: any, stream: BinaryStream): void {

name: string;
defaultValue: any;
encode?: (value: any, stream: BinaryStream) => void;
decode?: (stream: BinaryStream) => any;
coerce?: (value: any) => any;
public name: string;
public defaultValue: any;
public encode?: (value: any, stream: BinaryStream) => void;
public decode?: (stream: BinaryStream) => any;
public coerce?: (value: any) => any;
category: FieldCategory;
public category: FieldCategory;

@@ -176,3 +178,3 @@ constructor(options: TypeSchemaConstructorOptions) {

*/
computer_default_value(defaultValue: any): any {
public computer_default_value(defaultValue: any): any {

@@ -196,3 +198,3 @@ if (defaultValue === undefined) {

*/
initialize_value(value: any, defaultValue: any): any {
public initialize_value(value: any, defaultValue: any): any {

@@ -217,2 +219,1 @@ if (value === undefined) {

}

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

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