node-opcua-factory 2.51.0
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/LICENSE +20 -0
- package/dist/constructor_type.d.ts +15 -0
- package/dist/constructor_type.js +3 -0
- package/dist/constructor_type.js.map +1 -0
- package/dist/datatype_factory.d.ts +40 -0
- package/dist/datatype_factory.js +330 -0
- package/dist/datatype_factory.js.map +1 -0
- package/dist/factories_baseobject.d.ts +56 -0
- package/dist/factories_baseobject.js +498 -0
- package/dist/factories_baseobject.js.map +1 -0
- package/dist/factories_basic_type.d.ts +40 -0
- package/dist/factories_basic_type.js +136 -0
- package/dist/factories_basic_type.js.map +1 -0
- package/dist/factories_builtin_types.d.ts +32 -0
- package/dist/factories_builtin_types.js +262 -0
- package/dist/factories_builtin_types.js.map +1 -0
- package/dist/factories_builtin_types_special.d.ts +5 -0
- package/dist/factories_builtin_types_special.js +46 -0
- package/dist/factories_builtin_types_special.js.map +1 -0
- package/dist/factories_enumerations.d.ts +31 -0
- package/dist/factories_enumerations.js +77 -0
- package/dist/factories_enumerations.js.map +1 -0
- package/dist/factories_factories.d.ts +17 -0
- package/dist/factories_factories.js +54 -0
- package/dist/factories_factories.js.map +1 -0
- package/dist/factories_id_generator.d.ts +3 -0
- package/dist/factories_id_generator.js +22 -0
- package/dist/factories_id_generator.js.map +1 -0
- package/dist/factories_schema_helpers.d.ts +26 -0
- package/dist/factories_schema_helpers.js +121 -0
- package/dist/factories_schema_helpers.js.map +1 -0
- package/dist/factories_structuredTypeSchema.d.ts +46 -0
- package/dist/factories_structuredTypeSchema.js +269 -0
- package/dist/factories_structuredTypeSchema.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +111 -0
- package/dist/types.js +56 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
- package/source/constructor_type.ts +18 -0
- package/source/datatype_factory.ts +368 -0
- package/source/factories_baseobject.ts +567 -0
- package/source/factories_basic_type.ts +168 -0
- package/source/factories_builtin_types.ts +381 -0
- package/source/factories_builtin_types_special.ts +55 -0
- package/source/factories_enumerations.ts +97 -0
- package/source/factories_factories.ts +58 -0
- package/source/factories_id_generator.ts +18 -0
- package/source/factories_schema_helpers.ts +125 -0
- package/source/factories_structuredTypeSchema.ts +330 -0
- package/source/index.ts +15 -0
- package/source/types.ts +180 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-factory
|
|
3
|
+
*/
|
|
4
|
+
import { ExpandedNodeId } from "node-opcua-nodeid";
|
|
5
|
+
import { BaseUAObject } from "./factories_baseobject";
|
|
6
|
+
import { StructuredTypeSchema } from "./factories_structuredTypeSchema";
|
|
7
|
+
declare type BaseUAObjectConstructable = new (options?: any) => BaseUAObject;
|
|
8
|
+
export declare type ConstructorFunc = BaseUAObjectConstructable;
|
|
9
|
+
export interface ConstructorFuncWithSchema extends ConstructorFunc {
|
|
10
|
+
schema: StructuredTypeSchema;
|
|
11
|
+
possibleFields: string[];
|
|
12
|
+
encodingDefaultBinary: ExpandedNodeId;
|
|
13
|
+
encodingDefaultXml: ExpandedNodeId;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constructor_type.js","sourceRoot":"","sources":["../source/constructor_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ExpandedNodeId, NodeId } from "node-opcua-nodeid";
|
|
2
|
+
import { ConstructorFunc, ConstructorFuncWithSchema } from "./constructor_type";
|
|
3
|
+
import { BaseUAObject } from "./factories_baseobject";
|
|
4
|
+
import { EnumerationDefinitionSchema } from "./factories_enumerations";
|
|
5
|
+
import { StructuredTypeSchema } from "./factories_structuredTypeSchema";
|
|
6
|
+
import { BasicTypeDefinition } from "./types";
|
|
7
|
+
export declare class DataTypeFactory {
|
|
8
|
+
defaultByteOrder: string;
|
|
9
|
+
targetNamespace: string;
|
|
10
|
+
imports: string[];
|
|
11
|
+
private _structureTypeConstructorByNameMap;
|
|
12
|
+
private _structureTypeConstructorByDataTypeMap;
|
|
13
|
+
private _structureTypeConstructorByEncodingNodeIdMap;
|
|
14
|
+
private _enumerations;
|
|
15
|
+
private _simpleTypes;
|
|
16
|
+
private baseDataFactories;
|
|
17
|
+
constructor(baseDataFactories: DataTypeFactory[]);
|
|
18
|
+
repairBaseDataFactories(baseDataFactories: DataTypeFactory[]): void;
|
|
19
|
+
registerSimpleType(name: string, dataTypeNodeId: NodeId, def: BasicTypeDefinition): void;
|
|
20
|
+
hasSimpleType(name: string): boolean;
|
|
21
|
+
getSimpleType(name: string): BasicTypeDefinition;
|
|
22
|
+
registerEnumeration(enumeration: EnumerationDefinitionSchema): void;
|
|
23
|
+
hasEnumeration(enumName: string): boolean;
|
|
24
|
+
getEnumeration(enumName: string): EnumerationDefinitionSchema | null;
|
|
25
|
+
findConstructorForDataType(dataTypeNodeId: NodeId): ConstructorFuncWithSchema;
|
|
26
|
+
getConstructorForDataType(dataTypeNodeId: NodeId): ConstructorFuncWithSchema | null;
|
|
27
|
+
structuredTypesNames(): IterableIterator<string>;
|
|
28
|
+
getStructureTypeConstructor(typeName: string): ConstructorFuncWithSchema;
|
|
29
|
+
hasStructuredType(typeName: string): boolean;
|
|
30
|
+
getStructuredTypeSchema(typeName: string): StructuredTypeSchema;
|
|
31
|
+
dump(): void;
|
|
32
|
+
registerClassDefinition(dataTypeNodeId: NodeId, className: string, classConstructor: ConstructorFuncWithSchema): void;
|
|
33
|
+
getConstructor(binaryEncodingNodeId: NodeId): ConstructorFunc | null;
|
|
34
|
+
hasConstructor(binaryEncodingNodeId: NodeId): boolean;
|
|
35
|
+
constructObject(binaryEncodingNodeId: NodeId): BaseUAObject;
|
|
36
|
+
associateWithBinaryEncoding(className: string, expandedNodeId: ExpandedNodeId): void;
|
|
37
|
+
toString(): string;
|
|
38
|
+
private _registerFactory;
|
|
39
|
+
}
|
|
40
|
+
export declare function callConstructor(constructor: ConstructorFunc): BaseUAObject;
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callConstructor = exports.DataTypeFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-factory
|
|
6
|
+
*/
|
|
7
|
+
// tslint:disable:no-console
|
|
8
|
+
const chalk = require("chalk");
|
|
9
|
+
const util = require("util");
|
|
10
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
11
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
12
|
+
const factories_baseobject_1 = require("./factories_baseobject");
|
|
13
|
+
const factories_builtin_types_1 = require("./factories_builtin_types");
|
|
14
|
+
const factories_enumerations_1 = require("./factories_enumerations");
|
|
15
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
16
|
+
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
17
|
+
class DataTypeFactory {
|
|
18
|
+
constructor(baseDataFactories) {
|
|
19
|
+
this.imports = [];
|
|
20
|
+
this._structureTypeConstructorByNameMap = new Map();
|
|
21
|
+
this._structureTypeConstructorByDataTypeMap = new Map();
|
|
22
|
+
this._structureTypeConstructorByEncodingNodeIdMap = new Map();
|
|
23
|
+
this._enumerations = new Map();
|
|
24
|
+
this._simpleTypes = new Map();
|
|
25
|
+
this.defaultByteOrder = "LittleEndian";
|
|
26
|
+
this.targetNamespace = "";
|
|
27
|
+
this.baseDataFactories = baseDataFactories;
|
|
28
|
+
}
|
|
29
|
+
repairBaseDataFactories(baseDataFactories) {
|
|
30
|
+
this.baseDataFactories = baseDataFactories;
|
|
31
|
+
}
|
|
32
|
+
// -----------------------------
|
|
33
|
+
registerSimpleType(name, dataTypeNodeId, def) {
|
|
34
|
+
// istanbul ignore next
|
|
35
|
+
if (this._simpleTypes.has(name)) {
|
|
36
|
+
throw new Error("registerSimpleType " + name + " already register");
|
|
37
|
+
}
|
|
38
|
+
this._simpleTypes.set(name, { nodeId: dataTypeNodeId, definition: def });
|
|
39
|
+
}
|
|
40
|
+
hasSimpleType(name) {
|
|
41
|
+
if (this._simpleTypes.has(name)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
for (const factory of this.baseDataFactories) {
|
|
45
|
+
if (factory.hasSimpleType(name)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const hasSimpleT = (0, factories_builtin_types_1.hasBuiltInType)(name);
|
|
50
|
+
if (hasSimpleT) {
|
|
51
|
+
return hasSimpleT;
|
|
52
|
+
}
|
|
53
|
+
return (0, factories_builtin_types_1.hasBuiltInType)(name);
|
|
54
|
+
}
|
|
55
|
+
getSimpleType(name) {
|
|
56
|
+
if (this._simpleTypes.has(name)) {
|
|
57
|
+
return this._simpleTypes.get(name).definition;
|
|
58
|
+
}
|
|
59
|
+
for (const factory of this.baseDataFactories) {
|
|
60
|
+
if (factory.hasSimpleType(name)) {
|
|
61
|
+
return factory.getSimpleType(name);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return (0, factories_builtin_types_1.getBuildInType)(name);
|
|
65
|
+
}
|
|
66
|
+
// -----------------------------
|
|
67
|
+
// EnumerationDefinitionSchema
|
|
68
|
+
registerEnumeration(enumeration) {
|
|
69
|
+
debugLog("Registering Enumeration ", enumeration.name);
|
|
70
|
+
(0, node_opcua_assert_1.assert)(!this._enumerations.has(enumeration.name));
|
|
71
|
+
this._enumerations.set(enumeration.name, enumeration);
|
|
72
|
+
}
|
|
73
|
+
hasEnumeration(enumName) {
|
|
74
|
+
if (this._enumerations.has(enumName)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
for (const factory of this.baseDataFactories) {
|
|
78
|
+
const e = factory.hasEnumeration(enumName);
|
|
79
|
+
if (e) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if ((0, factories_enumerations_1.hasEnumeration)(enumName)) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
getEnumeration(enumName) {
|
|
89
|
+
if (this._enumerations.has(enumName)) {
|
|
90
|
+
return this._enumerations.get(enumName) || null;
|
|
91
|
+
}
|
|
92
|
+
for (const factory of this.baseDataFactories) {
|
|
93
|
+
const hasEnum = factory.hasEnumeration(enumName);
|
|
94
|
+
if (hasEnum) {
|
|
95
|
+
const e = factory.getEnumeration(enumName);
|
|
96
|
+
return e;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const ee = (0, factories_enumerations_1.getEnumeration)(enumName);
|
|
100
|
+
return ee;
|
|
101
|
+
}
|
|
102
|
+
// ----------------------------
|
|
103
|
+
findConstructorForDataType(dataTypeNodeId) {
|
|
104
|
+
const constructor = this.getConstructorForDataType(dataTypeNodeId);
|
|
105
|
+
if (constructor) {
|
|
106
|
+
return constructor;
|
|
107
|
+
}
|
|
108
|
+
this.getConstructorForDataType(dataTypeNodeId);
|
|
109
|
+
throw new Error("Cannot find StructureType constructor for dataType " + dataTypeNodeId.toString());
|
|
110
|
+
}
|
|
111
|
+
getConstructorForDataType(dataTypeNodeId) {
|
|
112
|
+
const constructor = this._structureTypeConstructorByDataTypeMap.get(dataTypeNodeId.toString());
|
|
113
|
+
if (constructor) {
|
|
114
|
+
return constructor;
|
|
115
|
+
}
|
|
116
|
+
for (const factory of this.baseDataFactories) {
|
|
117
|
+
const constructor2 = factory.getConstructorForDataType(dataTypeNodeId);
|
|
118
|
+
if (constructor2) {
|
|
119
|
+
return constructor2;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
// ----------------------------------------------------------------------------------------------------
|
|
125
|
+
// Access by typeName
|
|
126
|
+
// ----------------------------------------------------------------------------------------------------
|
|
127
|
+
structuredTypesNames() {
|
|
128
|
+
return this._structureTypeConstructorByNameMap.keys();
|
|
129
|
+
}
|
|
130
|
+
getStructureTypeConstructor(typeName) {
|
|
131
|
+
const constructor = this._structureTypeConstructorByNameMap.get(typeName);
|
|
132
|
+
if (constructor) {
|
|
133
|
+
return constructor;
|
|
134
|
+
}
|
|
135
|
+
for (const factory of this.baseDataFactories) {
|
|
136
|
+
if (!factory.hasStructuredType(typeName)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const constructor2 = factory.getStructureTypeConstructor(typeName);
|
|
140
|
+
if (constructor2) {
|
|
141
|
+
return constructor2;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// istanbul ignore next
|
|
145
|
+
if (doDebug) {
|
|
146
|
+
console.log([...this.structuredTypesNames()].join(" "));
|
|
147
|
+
}
|
|
148
|
+
// istanbul ignore next
|
|
149
|
+
throw new Error("Cannot find StructureType constructor for " + typeName + " - it may be abstract, or it could be a basic type");
|
|
150
|
+
}
|
|
151
|
+
hasStructuredType(typeName) {
|
|
152
|
+
if (this._structureTypeConstructorByNameMap.has(typeName)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
for (const factory of this.baseDataFactories) {
|
|
156
|
+
if (factory.hasStructuredType(typeName)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
getStructuredTypeSchema(typeName) {
|
|
163
|
+
const constructor = this.getStructureTypeConstructor(typeName);
|
|
164
|
+
return constructor.schema;
|
|
165
|
+
}
|
|
166
|
+
// istanbul ignore next
|
|
167
|
+
dump() {
|
|
168
|
+
console.log(" dumping registered factories");
|
|
169
|
+
console.log(" Factory ", [...this.structuredTypesNames()].sort().forEach((e) => e));
|
|
170
|
+
console.log(" done");
|
|
171
|
+
}
|
|
172
|
+
registerClassDefinition(dataTypeNodeId, className, classConstructor) {
|
|
173
|
+
this._registerFactory(dataTypeNodeId, className, classConstructor);
|
|
174
|
+
if (classConstructor.encodingDefaultBinary && classConstructor.encodingDefaultBinary.value !== 0) {
|
|
175
|
+
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
// for instance in DI FetchResultDataType should be abstract but is not
|
|
179
|
+
debugLog("warning ", dataTypeNodeId.toString(), "name=", className, " do not have binary encoding");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// ----------------------------------------------------------------------------------------------------
|
|
183
|
+
// Access by binaryEncodingNodeId
|
|
184
|
+
// ----------------------------------------------------------------------------------------------------
|
|
185
|
+
getConstructor(binaryEncodingNodeId) {
|
|
186
|
+
const expandedNodeIdKey = makeExpandedNodeIdKey(binaryEncodingNodeId);
|
|
187
|
+
const constructor = this._structureTypeConstructorByEncodingNodeIdMap.get(expandedNodeIdKey);
|
|
188
|
+
if (constructor) {
|
|
189
|
+
return constructor;
|
|
190
|
+
}
|
|
191
|
+
for (const factory of this.baseDataFactories) {
|
|
192
|
+
const constructor2 = factory.getConstructor(binaryEncodingNodeId);
|
|
193
|
+
if (constructor2) {
|
|
194
|
+
return constructor2;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
debugLog(chalk.red("#getConstructor : cannot find constructor for expandedId "), binaryEncodingNodeId.toString());
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
hasConstructor(binaryEncodingNodeId) {
|
|
201
|
+
if (!binaryEncodingNodeId) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
/* istanbul ignore next */
|
|
205
|
+
if (!verifyExpandedNodeId(binaryEncodingNodeId)) {
|
|
206
|
+
console.log("Invalid expandedNodeId");
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
const expandedNodeIdKey = makeExpandedNodeIdKey(binaryEncodingNodeId);
|
|
210
|
+
const constructor = this._structureTypeConstructorByEncodingNodeIdMap.get(expandedNodeIdKey);
|
|
211
|
+
if (constructor) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
for (const factory of this.baseDataFactories) {
|
|
215
|
+
const constructor2 = factory.getConstructor(binaryEncodingNodeId);
|
|
216
|
+
if (constructor2) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
constructObject(binaryEncodingNodeId) {
|
|
223
|
+
if (!verifyExpandedNodeId(binaryEncodingNodeId)) {
|
|
224
|
+
throw new Error(" constructObject : invalid expandedNodeId provided " + binaryEncodingNodeId.toString());
|
|
225
|
+
}
|
|
226
|
+
const constructor = this.getConstructor(binaryEncodingNodeId);
|
|
227
|
+
if (!constructor) {
|
|
228
|
+
debugLog("Cannot find constructor for " + binaryEncodingNodeId.toString());
|
|
229
|
+
return new factories_baseobject_1.BaseUAObject();
|
|
230
|
+
// throw new Error("Cannot find constructor for " + expandedNodeId.toString());
|
|
231
|
+
}
|
|
232
|
+
return callConstructor(constructor);
|
|
233
|
+
}
|
|
234
|
+
associateWithBinaryEncoding(className, expandedNodeId) {
|
|
235
|
+
const classConstructor = this.getStructureTypeConstructor(className);
|
|
236
|
+
if (doDebug) {
|
|
237
|
+
debugLog(" associateWithBinaryEncoding ", className, expandedNodeId.toString());
|
|
238
|
+
}
|
|
239
|
+
/* istanbul ignore next */
|
|
240
|
+
if (!verifyExpandedNodeId(expandedNodeId)) {
|
|
241
|
+
throw new Error("Invalid expandedNodeId " + expandedNodeId.toString() + " className = " + className);
|
|
242
|
+
}
|
|
243
|
+
const expandedNodeIdKey = makeExpandedNodeIdKey(expandedNodeId);
|
|
244
|
+
/* istanbul ignore next */
|
|
245
|
+
if (this._structureTypeConstructorByEncodingNodeIdMap.has(expandedNodeIdKey)) {
|
|
246
|
+
throw new Error(" Class " +
|
|
247
|
+
className +
|
|
248
|
+
" with ID " +
|
|
249
|
+
expandedNodeId +
|
|
250
|
+
" already in constructorMap for " +
|
|
251
|
+
this._structureTypeConstructorByEncodingNodeIdMap.get(expandedNodeIdKey).name);
|
|
252
|
+
}
|
|
253
|
+
this._structureTypeConstructorByEncodingNodeIdMap.set(expandedNodeIdKey, classConstructor);
|
|
254
|
+
}
|
|
255
|
+
toString() {
|
|
256
|
+
const l = [];
|
|
257
|
+
function write(...args) {
|
|
258
|
+
l.push(util.format.apply(util.format, args));
|
|
259
|
+
}
|
|
260
|
+
dumpDataFactory(this, write);
|
|
261
|
+
return l.join("\n");
|
|
262
|
+
}
|
|
263
|
+
_registerFactory(dataTypeNodeId, typeName, constructor) {
|
|
264
|
+
/* istanbul ignore next */
|
|
265
|
+
if (this.hasStructuredType(typeName)) {
|
|
266
|
+
console.log(this.getStructureTypeConstructor(typeName));
|
|
267
|
+
console.log("target namespace =", this.targetNamespace);
|
|
268
|
+
throw new Error(" registerFactory : " + typeName + " already registered");
|
|
269
|
+
}
|
|
270
|
+
debugLog("registering typeName ", typeName, dataTypeNodeId.toString());
|
|
271
|
+
this._structureTypeConstructorByNameMap.set(typeName, constructor);
|
|
272
|
+
if (dataTypeNodeId.value !== 0) {
|
|
273
|
+
this._structureTypeConstructorByDataTypeMap.set(dataTypeNodeId.toString(), constructor);
|
|
274
|
+
}
|
|
275
|
+
Object.defineProperty(constructor.schema, "$$factory", {
|
|
276
|
+
enumerable: false,
|
|
277
|
+
value: this,
|
|
278
|
+
writable: false
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
exports.DataTypeFactory = DataTypeFactory;
|
|
283
|
+
function dumpSchema(schema, write) {
|
|
284
|
+
write("name ", schema.name);
|
|
285
|
+
write("dataType ", schema.dataTypeNodeId.toString());
|
|
286
|
+
write("binaryEncoding ", schema.encodingDefaultBinary.toString());
|
|
287
|
+
for (const f of schema.fields) {
|
|
288
|
+
write(" ", f.name.padEnd(30, " "), f.isArray ? true : false, f.fieldType);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function dumpDataFactory(dataFactory, write) {
|
|
292
|
+
for (const structureTypeName of dataFactory.structuredTypesNames()) {
|
|
293
|
+
const schema = dataFactory.getStructuredTypeSchema(structureTypeName);
|
|
294
|
+
write("structureTypeName =", structureTypeName);
|
|
295
|
+
if (!dataFactory.getConstructorForDataType(schema.dataTypeNodeId)) {
|
|
296
|
+
write(" ( No constructor for " + schema.name + " " + schema.dataTypeNodeId.toString());
|
|
297
|
+
}
|
|
298
|
+
if (!schema.encodingDefaultBinary) {
|
|
299
|
+
write(" (Schema has no encoding defaultBinary )");
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
if (dataFactory.hasConstructor(schema.encodingDefaultBinary)) {
|
|
303
|
+
console.log("schema", schema.name);
|
|
304
|
+
console.log("schema", schema.dataTypeNodeId.toString());
|
|
305
|
+
console.log("schema", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
|
|
306
|
+
console.log("schema", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
|
|
307
|
+
// return;
|
|
308
|
+
// throw new Error("Not in Binary Encoding Map!!!!! " + schema.encodingDefaultBinary);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
dumpSchema(schema, write);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function verifyExpandedNodeId(expandedNodeId) {
|
|
315
|
+
/* istanbul ignore next */
|
|
316
|
+
if (expandedNodeId.value instanceof Buffer) {
|
|
317
|
+
throw new Error("getConstructor not implemented for opaque nodeid");
|
|
318
|
+
}
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
function makeExpandedNodeIdKey(expandedNodeId) {
|
|
322
|
+
return expandedNodeId.toString();
|
|
323
|
+
}
|
|
324
|
+
function callConstructor(constructor) {
|
|
325
|
+
(0, node_opcua_assert_1.assert)(typeof constructor === "function");
|
|
326
|
+
const constructorFunc = constructor.bind.apply(constructor, arguments);
|
|
327
|
+
return new constructorFunc();
|
|
328
|
+
}
|
|
329
|
+
exports.callConstructor = callConstructor;
|
|
330
|
+
//# sourceMappingURL=datatype_factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datatype_factory.js","sourceRoot":"","sources":["../source/datatype_factory.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,4BAA4B;AAC5B,+BAA+B;AAC/B,6BAA6B;AAE7B,yDAA2C;AAC3C,uDAAiE;AAIjE,iEAAsD;AACtD,uEAA2E;AAC3E,qEAAuG;AAIvG,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MA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AC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC9F,UAAU;gBACV,wFAAwF;aAC3F;SACJ;QACD,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC7B;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,cAAsB;IAChD,0BAA0B;IAC1B,IAAI,cAAc,CAAC,KAAK,YAAY,MAAM,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;KACvE;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,cAAsB;IACjD,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED,SAAgB,eAAe,CAAC,WAA4B;IACxD,IAAA,0BAAM,EAAC,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAQ,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,SAAgB,CAAC,CAAC;IACnF,OAAO,IAAI,eAAe,EAAE,CAAC;AACjC,CAAC;AAJD,0CAIC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
2
|
+
import { StructuredTypeSchema } from "./factories_structuredTypeSchema";
|
|
3
|
+
export interface DecodeDebugOptions {
|
|
4
|
+
tracer: any;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BaseUAObject {
|
|
8
|
+
schema: StructuredTypeSchema;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @class BaseUAObject
|
|
12
|
+
* @constructor
|
|
13
|
+
*/
|
|
14
|
+
export declare class BaseUAObject {
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Encode the object to the binary stream.
|
|
18
|
+
* @class BaseUAObject
|
|
19
|
+
* @method encode
|
|
20
|
+
* @param stream {BinaryStream}
|
|
21
|
+
*/
|
|
22
|
+
encode(stream: OutputBinaryStream): void;
|
|
23
|
+
/**
|
|
24
|
+
* Decode the object from the binary stream.
|
|
25
|
+
* @class BaseUAObject
|
|
26
|
+
* @method decode
|
|
27
|
+
* @param stream {BinaryStream}
|
|
28
|
+
*/
|
|
29
|
+
decode(stream: BinaryStream): void;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate the required size to store this object in a binary stream.
|
|
32
|
+
* @method binaryStoreSize
|
|
33
|
+
* @return number
|
|
34
|
+
*/
|
|
35
|
+
binaryStoreSize(): number;
|
|
36
|
+
/**
|
|
37
|
+
* @method toString
|
|
38
|
+
* @return {String}
|
|
39
|
+
*/
|
|
40
|
+
toString(...args: any[]): string;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* verify that all object attributes values are valid according to schema
|
|
44
|
+
* @method isValid
|
|
45
|
+
* @return boolean
|
|
46
|
+
*/
|
|
47
|
+
isValid(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @method decodeDebug
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
decodeDebug(stream: BinaryStream, options: DecodeDebugOptions): void;
|
|
53
|
+
explore(): string;
|
|
54
|
+
toJSON(): any;
|
|
55
|
+
clone(): any;
|
|
56
|
+
}
|