node-opcua-factory 2.71.0 → 2.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constructor_type.d.ts +15 -15
- package/dist/constructor_type.js +2 -2
- package/dist/datatype_factory.d.ts +39 -39
- package/dist/datatype_factory.js +322 -322
- package/dist/factories_baseobject.d.ts +56 -56
- package/dist/factories_baseobject.js +534 -534
- package/dist/factories_basic_type.d.ts +40 -40
- package/dist/factories_basic_type.js +135 -135
- package/dist/factories_builtin_types.d.ts +32 -32
- package/dist/factories_builtin_types.js +261 -261
- package/dist/factories_builtin_types_special.d.ts +5 -5
- package/dist/factories_builtin_types_special.js +45 -45
- package/dist/factories_enumerations.d.ts +31 -31
- package/dist/factories_enumerations.js +77 -77
- package/dist/factories_factories.d.ts +17 -17
- package/dist/factories_factories.js +53 -53
- package/dist/factories_id_generator.d.ts +3 -3
- package/dist/factories_id_generator.js +21 -21
- package/dist/factories_schema_helpers.d.ts +27 -27
- package/dist/factories_schema_helpers.js +121 -121
- package/dist/factories_structuredTypeSchema.d.ts +45 -45
- package/dist/factories_structuredTypeSchema.js +276 -276
- package/dist/index.d.ts +15 -15
- package/dist/index.js +31 -31
- package/dist/types.d.ts +110 -110
- package/dist/types.js +51 -51
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
2
|
-
import { Enum } from "node-opcua-enum";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { ConstructorFunc } from "./constructor_type";
|
|
5
|
-
export interface CommonInterface {
|
|
6
|
-
name: string;
|
|
7
|
-
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
8
|
-
decode?: (stream: BinaryStream) => any;
|
|
9
|
-
coerce?: (value: any) => any;
|
|
10
|
-
toJSON?: (value: any) => any;
|
|
11
|
-
random?: () => any;
|
|
12
|
-
validate?: (value: any) => void;
|
|
13
|
-
defaultValue?: any;
|
|
14
|
-
computer_default_value(defaultValue: any): any;
|
|
15
|
-
}
|
|
16
|
-
export declare enum FieldCategory {
|
|
17
|
-
enumeration = "enumeration",
|
|
18
|
-
complex = "complex",
|
|
19
|
-
basic = "basic"
|
|
20
|
-
}
|
|
21
|
-
export interface StructuredTypeField {
|
|
22
|
-
name: string;
|
|
23
|
-
fieldType: string;
|
|
24
|
-
isArray?: boolean;
|
|
25
|
-
documentation?: string;
|
|
26
|
-
category: FieldCategory;
|
|
27
|
-
schema: CommonInterface;
|
|
28
|
-
fieldTypeConstructor?: ConstructorFunc;
|
|
29
|
-
subType?: string;
|
|
30
|
-
defaultValue?: any;
|
|
31
|
-
validate?: (value: any) => boolean;
|
|
32
|
-
decode?: (stream: BinaryStream) => any;
|
|
33
|
-
switchBit?: number;
|
|
34
|
-
switchValue?: number;
|
|
35
|
-
}
|
|
36
|
-
export interface FieldEnumeration extends StructuredTypeField {
|
|
37
|
-
}
|
|
38
|
-
export interface FieldComplex extends StructuredTypeField {
|
|
39
|
-
}
|
|
40
|
-
export interface FieldBasic extends StructuredTypeField {
|
|
41
|
-
}
|
|
42
|
-
export declare type FieldType = FieldEnumeration | FieldComplex | FieldBasic;
|
|
43
|
-
export declare type DefaultValueFunc = () => any;
|
|
44
|
-
export interface FieldInterfaceOptions {
|
|
45
|
-
name: string;
|
|
46
|
-
fieldType: string;
|
|
47
|
-
isArray?: boolean;
|
|
48
|
-
documentation?: string;
|
|
49
|
-
category?: FieldCategory;
|
|
50
|
-
defaultValue?: any | DefaultValueFunc;
|
|
51
|
-
schema?: any;
|
|
52
|
-
switchBit?: number;
|
|
53
|
-
switchValue?: number;
|
|
54
|
-
}
|
|
55
|
-
export interface StructuredTypeOptions {
|
|
56
|
-
name: string;
|
|
57
|
-
id?: number | NodeId;
|
|
58
|
-
fields: FieldInterfaceOptions[];
|
|
59
|
-
documentation?: string;
|
|
60
|
-
baseType: string;
|
|
61
|
-
_resolved?: boolean;
|
|
62
|
-
bitFields?: any[];
|
|
63
|
-
base?: StructuredTypeOptions;
|
|
64
|
-
}
|
|
65
|
-
export interface TypeSchemaConstructorOptions {
|
|
66
|
-
name: string;
|
|
67
|
-
category?: FieldCategory;
|
|
68
|
-
defaultValue?: any;
|
|
69
|
-
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
70
|
-
decode?: (stream: BinaryStream) => any;
|
|
71
|
-
coerce?: (value: any) => any;
|
|
72
|
-
}
|
|
73
|
-
export interface BasicTypeDefinitionOptions extends TypeSchemaConstructorOptions {
|
|
74
|
-
subType: string;
|
|
75
|
-
toJSON?: (value: any) => any;
|
|
76
|
-
random?: () => any;
|
|
77
|
-
validate?: (value: any) => void;
|
|
78
|
-
}
|
|
79
|
-
export interface BasicTypeDefinition extends CommonInterface {
|
|
80
|
-
subType: string;
|
|
81
|
-
}
|
|
82
|
-
export interface BuiltInTypeDefinition extends BasicTypeDefinition {
|
|
83
|
-
}
|
|
84
|
-
export interface EnumerationDefinition extends CommonInterface {
|
|
85
|
-
typedEnum: Enum;
|
|
86
|
-
documentation?: string;
|
|
87
|
-
}
|
|
88
|
-
export declare type TypeDefinition = BuiltInTypeDefinition | EnumerationDefinition | BasicTypeDefinition | TypeSchemaBase;
|
|
89
|
-
/**
|
|
90
|
-
* @class TypeSchemaBase
|
|
91
|
-
* @param options {Object}
|
|
92
|
-
* @constructor
|
|
93
|
-
* create a new type Schema
|
|
94
|
-
*/
|
|
95
|
-
export declare class TypeSchemaBase implements CommonInterface {
|
|
96
|
-
name: string;
|
|
97
|
-
defaultValue: any;
|
|
98
|
-
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
99
|
-
decode?: (stream: BinaryStream) => any;
|
|
100
|
-
coerce?: (value: any) => any;
|
|
101
|
-
toJSON?: () => string;
|
|
102
|
-
category: FieldCategory;
|
|
103
|
-
constructor(options: TypeSchemaConstructorOptions);
|
|
104
|
-
/**
|
|
105
|
-
* @method computer_default_value
|
|
106
|
-
* @param defaultValue {*} the default value
|
|
107
|
-
* @return {*}
|
|
108
|
-
*/
|
|
109
|
-
computer_default_value(defaultValue: unknown): any;
|
|
110
|
-
}
|
|
1
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
2
|
+
import { Enum } from "node-opcua-enum";
|
|
3
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
+
import { ConstructorFunc } from "./constructor_type";
|
|
5
|
+
export interface CommonInterface {
|
|
6
|
+
name: string;
|
|
7
|
+
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
8
|
+
decode?: (stream: BinaryStream) => any;
|
|
9
|
+
coerce?: (value: any) => any;
|
|
10
|
+
toJSON?: (value: any) => any;
|
|
11
|
+
random?: () => any;
|
|
12
|
+
validate?: (value: any) => void;
|
|
13
|
+
defaultValue?: any;
|
|
14
|
+
computer_default_value(defaultValue: any): any;
|
|
15
|
+
}
|
|
16
|
+
export declare enum FieldCategory {
|
|
17
|
+
enumeration = "enumeration",
|
|
18
|
+
complex = "complex",
|
|
19
|
+
basic = "basic"
|
|
20
|
+
}
|
|
21
|
+
export interface StructuredTypeField {
|
|
22
|
+
name: string;
|
|
23
|
+
fieldType: string;
|
|
24
|
+
isArray?: boolean;
|
|
25
|
+
documentation?: string;
|
|
26
|
+
category: FieldCategory;
|
|
27
|
+
schema: CommonInterface;
|
|
28
|
+
fieldTypeConstructor?: ConstructorFunc;
|
|
29
|
+
subType?: string;
|
|
30
|
+
defaultValue?: any;
|
|
31
|
+
validate?: (value: any) => boolean;
|
|
32
|
+
decode?: (stream: BinaryStream) => any;
|
|
33
|
+
switchBit?: number;
|
|
34
|
+
switchValue?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FieldEnumeration extends StructuredTypeField {
|
|
37
|
+
}
|
|
38
|
+
export interface FieldComplex extends StructuredTypeField {
|
|
39
|
+
}
|
|
40
|
+
export interface FieldBasic extends StructuredTypeField {
|
|
41
|
+
}
|
|
42
|
+
export declare type FieldType = FieldEnumeration | FieldComplex | FieldBasic;
|
|
43
|
+
export declare type DefaultValueFunc = () => any;
|
|
44
|
+
export interface FieldInterfaceOptions {
|
|
45
|
+
name: string;
|
|
46
|
+
fieldType: string;
|
|
47
|
+
isArray?: boolean;
|
|
48
|
+
documentation?: string;
|
|
49
|
+
category?: FieldCategory;
|
|
50
|
+
defaultValue?: any | DefaultValueFunc;
|
|
51
|
+
schema?: any;
|
|
52
|
+
switchBit?: number;
|
|
53
|
+
switchValue?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface StructuredTypeOptions {
|
|
56
|
+
name: string;
|
|
57
|
+
id?: number | NodeId;
|
|
58
|
+
fields: FieldInterfaceOptions[];
|
|
59
|
+
documentation?: string;
|
|
60
|
+
baseType: string;
|
|
61
|
+
_resolved?: boolean;
|
|
62
|
+
bitFields?: any[];
|
|
63
|
+
base?: StructuredTypeOptions;
|
|
64
|
+
}
|
|
65
|
+
export interface TypeSchemaConstructorOptions {
|
|
66
|
+
name: string;
|
|
67
|
+
category?: FieldCategory;
|
|
68
|
+
defaultValue?: any;
|
|
69
|
+
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
70
|
+
decode?: (stream: BinaryStream) => any;
|
|
71
|
+
coerce?: (value: any) => any;
|
|
72
|
+
}
|
|
73
|
+
export interface BasicTypeDefinitionOptions extends TypeSchemaConstructorOptions {
|
|
74
|
+
subType: string;
|
|
75
|
+
toJSON?: (value: any) => any;
|
|
76
|
+
random?: () => any;
|
|
77
|
+
validate?: (value: any) => void;
|
|
78
|
+
}
|
|
79
|
+
export interface BasicTypeDefinition extends CommonInterface {
|
|
80
|
+
subType: string;
|
|
81
|
+
}
|
|
82
|
+
export interface BuiltInTypeDefinition extends BasicTypeDefinition {
|
|
83
|
+
}
|
|
84
|
+
export interface EnumerationDefinition extends CommonInterface {
|
|
85
|
+
typedEnum: Enum;
|
|
86
|
+
documentation?: string;
|
|
87
|
+
}
|
|
88
|
+
export declare type TypeDefinition = BuiltInTypeDefinition | EnumerationDefinition | BasicTypeDefinition | TypeSchemaBase;
|
|
89
|
+
/**
|
|
90
|
+
* @class TypeSchemaBase
|
|
91
|
+
* @param options {Object}
|
|
92
|
+
* @constructor
|
|
93
|
+
* create a new type Schema
|
|
94
|
+
*/
|
|
95
|
+
export declare class TypeSchemaBase implements CommonInterface {
|
|
96
|
+
name: string;
|
|
97
|
+
defaultValue: any;
|
|
98
|
+
encode?: (value: any, stream: OutputBinaryStream) => void;
|
|
99
|
+
decode?: (stream: BinaryStream) => any;
|
|
100
|
+
coerce?: (value: any) => any;
|
|
101
|
+
toJSON?: () => string;
|
|
102
|
+
category: FieldCategory;
|
|
103
|
+
constructor(options: TypeSchemaConstructorOptions);
|
|
104
|
+
/**
|
|
105
|
+
* @method computer_default_value
|
|
106
|
+
* @param defaultValue {*} the default value
|
|
107
|
+
* @return {*}
|
|
108
|
+
*/
|
|
109
|
+
computer_default_value(defaultValue: unknown): any;
|
|
110
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeSchemaBase = exports.FieldCategory = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-factory
|
|
6
|
-
*/
|
|
7
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
-
var FieldCategory;
|
|
9
|
-
(function (FieldCategory) {
|
|
10
|
-
FieldCategory["enumeration"] = "enumeration";
|
|
11
|
-
FieldCategory["complex"] = "complex";
|
|
12
|
-
FieldCategory["basic"] = "basic";
|
|
13
|
-
})(FieldCategory = exports.FieldCategory || (exports.FieldCategory = {}));
|
|
14
|
-
/**
|
|
15
|
-
* @class TypeSchemaBase
|
|
16
|
-
* @param options {Object}
|
|
17
|
-
* @constructor
|
|
18
|
-
* create a new type Schema
|
|
19
|
-
*/
|
|
20
|
-
class TypeSchemaBase {
|
|
21
|
-
constructor(options) {
|
|
22
|
-
(0, node_opcua_assert_1.assert)(options.category !== null);
|
|
23
|
-
this.encode = options.encode || undefined;
|
|
24
|
-
this.decode = options.decode || undefined;
|
|
25
|
-
this.coerce = options.coerce;
|
|
26
|
-
this.category = options.category || FieldCategory.basic;
|
|
27
|
-
this.name = options.name;
|
|
28
|
-
for (const prop in options) {
|
|
29
|
-
if (Object.prototype.hasOwnProperty.call(options, prop)) {
|
|
30
|
-
this[prop] = options[prop];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @method computer_default_value
|
|
36
|
-
* @param defaultValue {*} the default value
|
|
37
|
-
* @return {*}
|
|
38
|
-
*/
|
|
39
|
-
computer_default_value(defaultValue) {
|
|
40
|
-
if (defaultValue === undefined) {
|
|
41
|
-
defaultValue = this.defaultValue;
|
|
42
|
-
}
|
|
43
|
-
if (typeof defaultValue === "function") {
|
|
44
|
-
// be careful not to cache this value , it must be call each time to make sure
|
|
45
|
-
// we do not end up with the same value/instance twice.
|
|
46
|
-
defaultValue = defaultValue();
|
|
47
|
-
}
|
|
48
|
-
return defaultValue;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.TypeSchemaBase = TypeSchemaBase;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeSchemaBase = exports.FieldCategory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-factory
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
+
var FieldCategory;
|
|
9
|
+
(function (FieldCategory) {
|
|
10
|
+
FieldCategory["enumeration"] = "enumeration";
|
|
11
|
+
FieldCategory["complex"] = "complex";
|
|
12
|
+
FieldCategory["basic"] = "basic";
|
|
13
|
+
})(FieldCategory = exports.FieldCategory || (exports.FieldCategory = {}));
|
|
14
|
+
/**
|
|
15
|
+
* @class TypeSchemaBase
|
|
16
|
+
* @param options {Object}
|
|
17
|
+
* @constructor
|
|
18
|
+
* create a new type Schema
|
|
19
|
+
*/
|
|
20
|
+
class TypeSchemaBase {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
(0, node_opcua_assert_1.assert)(options.category !== null);
|
|
23
|
+
this.encode = options.encode || undefined;
|
|
24
|
+
this.decode = options.decode || undefined;
|
|
25
|
+
this.coerce = options.coerce;
|
|
26
|
+
this.category = options.category || FieldCategory.basic;
|
|
27
|
+
this.name = options.name;
|
|
28
|
+
for (const prop in options) {
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(options, prop)) {
|
|
30
|
+
this[prop] = options[prop];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @method computer_default_value
|
|
36
|
+
* @param defaultValue {*} the default value
|
|
37
|
+
* @return {*}
|
|
38
|
+
*/
|
|
39
|
+
computer_default_value(defaultValue) {
|
|
40
|
+
if (defaultValue === undefined) {
|
|
41
|
+
defaultValue = this.defaultValue;
|
|
42
|
+
}
|
|
43
|
+
if (typeof defaultValue === "function") {
|
|
44
|
+
// be careful not to cache this value , it must be call each time to make sure
|
|
45
|
+
// we do not end up with the same value/instance twice.
|
|
46
|
+
defaultValue = defaultValue();
|
|
47
|
+
}
|
|
48
|
+
return defaultValue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.TypeSchemaBase = TypeSchemaBase;
|
|
52
52
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-factory",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.1",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -factory",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"chalk": "4.1.2",
|
|
16
16
|
"node-opcua-assert": "2.66.0",
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
17
|
+
"node-opcua-basic-types": "2.72.1",
|
|
18
18
|
"node-opcua-binary-stream": "2.71.0",
|
|
19
19
|
"node-opcua-debug": "2.71.0",
|
|
20
20
|
"node-opcua-enum": "2.71.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"internet of things"
|
|
39
39
|
],
|
|
40
40
|
"homepage": "http://node-opcua.github.io/",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "ba98dd91a9eada9815268c66c98ca5391bc884e7"
|
|
42
42
|
}
|