node-opcua-factory 2.97.0 → 2.98.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/package.json +9 -9
- package/dist/base_ua_object.d.ts +0 -53
- package/dist/base_ua_object.js +0 -548
- package/dist/base_ua_object.js.map +0 -1
- package/dist/basic_type.d.ts +0 -40
- package/dist/basic_type.js +0 -119
- package/dist/basic_type.js.map +0 -1
- package/dist/builtin_types.d.ts +0 -46
- package/dist/builtin_types.js +0 -284
- package/dist/builtin_types.js.map +0 -1
- package/dist/builtin_types_special.d.ts +0 -5
- package/dist/builtin_types_special.js +0 -46
- package/dist/builtin_types_special.js.map +0 -1
- package/dist/datatype_factory.d.ts +0 -43
- package/dist/datatype_factory.js +0 -308
- package/dist/datatype_factory.js.map +0 -1
- package/dist/encode_decode.d.ts +0 -9
- package/dist/encode_decode.js +0 -40
- package/dist/encode_decode.js.map +0 -1
- package/dist/enumerations.d.ts +0 -34
- package/dist/enumerations.js +0 -82
- package/dist/enumerations.js.map +0 -1
- package/dist/get_built_in_type.d.ts +0 -0
- package/dist/get_built_in_type.js +0 -2
- package/dist/get_built_in_type.js.map +0 -1
- package/dist/get_standard_data_type_factory.d.ts +0 -5
- package/dist/get_standard_data_type_factory.js +0 -30
- package/dist/get_standard_data_type_factory.js.map +0 -1
- package/dist/get_structured_type_schema.d.ts +0 -1
- package/dist/get_structured_type_schema.js +0 -9
- package/dist/get_structured_type_schema.js.map +0 -1
- package/dist/id_generator.d.ts +0 -3
- package/dist/id_generator.js +0 -22
- package/dist/id_generator.js.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/nodeid_type.d.ts +0 -13
- package/dist/nodeid_type.js +0 -19
- package/dist/nodeid_type.js.map +0 -1
- package/dist/parameters.d.ts +0 -3
- package/dist/parameters.js +0 -7
- package/dist/parameters.js.map +0 -1
- package/dist/register_class_definition.d.ts +0 -3
- package/dist/register_class_definition.js +0 -9
- package/dist/register_class_definition.js.map +0 -1
- package/dist/schema_helpers.d.ts +0 -24
- package/dist/schema_helpers.js +0 -100
- package/dist/schema_helpers.js.map +0 -1
- package/dist/structured_type_schema.d.ts +0 -39
- package/dist/structured_type_schema.js +0 -284
- package/dist/structured_type_schema.js.map +0 -1
- package/dist/types.d.ts +0 -160
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
package/dist/datatype_factory.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataTypeFactory = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-factory
|
|
6
|
-
*/
|
|
7
|
-
const util = require("util");
|
|
8
|
-
const chalk = require("chalk");
|
|
9
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
10
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
11
|
-
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
12
|
-
const builtin_types_1 = require("./builtin_types");
|
|
13
|
-
const enumerations_1 = require("./enumerations");
|
|
14
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
15
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
16
|
-
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
17
|
-
class DataTypeFactory {
|
|
18
|
-
constructor(baseDataFactories) {
|
|
19
|
-
this.imports = [];
|
|
20
|
-
this._structureInfoByName = new Map();
|
|
21
|
-
this._structureInfoByDataTypeMap = new Map();
|
|
22
|
-
this._structureInfoByEncodingMap = new Map();
|
|
23
|
-
this._enumerations = new Map();
|
|
24
|
-
this.defaultByteOrder = "LittleEndian";
|
|
25
|
-
this.targetNamespace = "";
|
|
26
|
-
this.baseDataFactories = baseDataFactories;
|
|
27
|
-
}
|
|
28
|
-
getStructureIterator() {
|
|
29
|
-
return this._structureInfoByDataTypeMap.values();
|
|
30
|
-
}
|
|
31
|
-
getEnumIterator() {
|
|
32
|
-
return this._enumerations.values();
|
|
33
|
-
}
|
|
34
|
-
repairBaseDataFactories(baseDataFactories) {
|
|
35
|
-
this.baseDataFactories = baseDataFactories;
|
|
36
|
-
}
|
|
37
|
-
hasBuiltInType(name) {
|
|
38
|
-
return (0, builtin_types_1.hasBuiltInType)(name);
|
|
39
|
-
}
|
|
40
|
-
getBuiltInType(name) {
|
|
41
|
-
return (0, builtin_types_1.getBuiltInType)(name);
|
|
42
|
-
}
|
|
43
|
-
getBuiltInTypeByDataType(nodeId) {
|
|
44
|
-
return (0, builtin_types_1.getBuiltInType)(node_opcua_constants_1.DataTypeIds[nodeId.value]);
|
|
45
|
-
}
|
|
46
|
-
// -----------------------------
|
|
47
|
-
// EnumerationDefinitionSchema
|
|
48
|
-
registerEnumeration(enumeration) {
|
|
49
|
-
(0, node_opcua_assert_1.assert)(!this._enumerations.has(enumeration.name), "enumeration already registered");
|
|
50
|
-
this._enumerations.set(enumeration.name, enumeration);
|
|
51
|
-
}
|
|
52
|
-
hasEnumeration(enumName) {
|
|
53
|
-
if (this._enumerations.has(enumName)) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
for (const factory of this.baseDataFactories) {
|
|
57
|
-
const e = factory.hasEnumeration(enumName);
|
|
58
|
-
if (e) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if ((0, enumerations_1.hasBuiltInEnumeration)(enumName)) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
getEnumeration(enumName) {
|
|
68
|
-
if (this._enumerations.has(enumName)) {
|
|
69
|
-
return this._enumerations.get(enumName) || null;
|
|
70
|
-
}
|
|
71
|
-
for (const factory of this.baseDataFactories) {
|
|
72
|
-
const hasEnum = factory.hasEnumeration(enumName);
|
|
73
|
-
if (hasEnum) {
|
|
74
|
-
const e = factory.getEnumeration(enumName);
|
|
75
|
-
return e;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const ee = (0, enumerations_1.getBuiltInEnumeration)(enumName);
|
|
79
|
-
return ee;
|
|
80
|
-
}
|
|
81
|
-
// ----------------------------
|
|
82
|
-
findStructureInfoForDataType(dataTypeNodeId) {
|
|
83
|
-
const structureInfo = this.getStructureInfoForDataType(dataTypeNodeId);
|
|
84
|
-
if (structureInfo) {
|
|
85
|
-
return structureInfo;
|
|
86
|
-
}
|
|
87
|
-
this.getStructureInfoForDataType(dataTypeNodeId);
|
|
88
|
-
throw new Error("Cannot find StructureType constructor for dataType " + dataTypeNodeId.toString());
|
|
89
|
-
}
|
|
90
|
-
getStructureInfoForDataType(dataTypeNodeId) {
|
|
91
|
-
const structureInfo = this._structureInfoByDataTypeMap.get(dataTypeNodeId.toString());
|
|
92
|
-
if (structureInfo) {
|
|
93
|
-
return structureInfo;
|
|
94
|
-
}
|
|
95
|
-
for (const factory of this.baseDataFactories) {
|
|
96
|
-
const structureInfo2 = factory.getStructureInfoForDataType(dataTypeNodeId);
|
|
97
|
-
if (structureInfo2) {
|
|
98
|
-
return structureInfo2;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
// ----------------------------------------------------------------------------------------------------
|
|
104
|
-
// Access by typeName
|
|
105
|
-
// ----------------------------------------------------------------------------------------------------
|
|
106
|
-
structuredTypesNames() {
|
|
107
|
-
return this._structureInfoByName.keys();
|
|
108
|
-
}
|
|
109
|
-
enumerations() {
|
|
110
|
-
return this._enumerations.keys();
|
|
111
|
-
}
|
|
112
|
-
getStructureInfoByTypeName(typeName) {
|
|
113
|
-
const structureInfo = this._structureInfoByName.get(typeName);
|
|
114
|
-
if (structureInfo) {
|
|
115
|
-
return structureInfo;
|
|
116
|
-
}
|
|
117
|
-
for (const factory of this.baseDataFactories) {
|
|
118
|
-
if (!factory.hasStructureByTypeName(typeName)) {
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
const structureInfo2 = factory.getStructureInfoByTypeName(typeName);
|
|
122
|
-
if (structureInfo2) {
|
|
123
|
-
return structureInfo2;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// istanbul ignore next
|
|
127
|
-
if (doDebug) {
|
|
128
|
-
console.log([...this.structuredTypesNames()].join(" "));
|
|
129
|
-
}
|
|
130
|
-
// istanbul ignore next
|
|
131
|
-
throw new Error("Cannot find StructureType constructor for " + typeName + " - it may be abstract, or it could be a basic type");
|
|
132
|
-
}
|
|
133
|
-
hasStructureByTypeName(typeName) {
|
|
134
|
-
if (this._structureInfoByName.has(typeName)) {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
for (const factory of this.baseDataFactories) {
|
|
138
|
-
if (factory.hasStructureByTypeName(typeName)) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
getStructuredTypeSchema(typeName) {
|
|
145
|
-
const structureInfo = this.getStructureInfoByTypeName(typeName);
|
|
146
|
-
return structureInfo.schema;
|
|
147
|
-
}
|
|
148
|
-
// istanbul ignore next
|
|
149
|
-
dump() {
|
|
150
|
-
console.log(" dumping registered factories");
|
|
151
|
-
console.log(" Factory ", [...this.structuredTypesNames()].sort().forEach((e) => e));
|
|
152
|
-
console.log(" done");
|
|
153
|
-
}
|
|
154
|
-
registerAbstractStructure(dataTypeNodeId, className, schema) {
|
|
155
|
-
schema.isAbstract = true;
|
|
156
|
-
this._registerFactory(dataTypeNodeId, className, null, schema);
|
|
157
|
-
}
|
|
158
|
-
registerClassDefinition(dataTypeNodeId, className, classConstructor) {
|
|
159
|
-
this._registerFactory(dataTypeNodeId, className, classConstructor, classConstructor.schema);
|
|
160
|
-
if (classConstructor.encodingDefaultBinary && classConstructor.encodingDefaultBinary.value !== 0) {
|
|
161
|
-
this.associateWithBinaryEncoding(className, classConstructor.encodingDefaultBinary);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// for instance in DI FetchResultDataType should be abstract but is not
|
|
165
|
-
warningLog("warning ", dataTypeNodeId.toString(), "name=", className, " do not have binary encoding");
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// ----------------------------------------------------------------------------------------------------
|
|
169
|
-
// Access by binaryEncodingNodeId
|
|
170
|
-
// ----------------------------------------------------------------------------------------------------
|
|
171
|
-
getConstructor(binaryEncodingNodeId) {
|
|
172
|
-
const expandedNodeIdKey = makeExpandedNodeIdKey(binaryEncodingNodeId);
|
|
173
|
-
const structureInfo = this._structureInfoByEncodingMap.get(expandedNodeIdKey);
|
|
174
|
-
if (!structureInfo)
|
|
175
|
-
return null;
|
|
176
|
-
const Constructor = structureInfo.constructor;
|
|
177
|
-
if (Constructor) {
|
|
178
|
-
return Constructor;
|
|
179
|
-
}
|
|
180
|
-
for (const factory of this.baseDataFactories) {
|
|
181
|
-
const Constructor2 = factory.getConstructor(binaryEncodingNodeId);
|
|
182
|
-
if (Constructor2) {
|
|
183
|
-
return Constructor2;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
debugLog(chalk.red("#getConstructor : cannot find constructor for expandedId "), binaryEncodingNodeId.toString());
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
hasConstructor(binaryEncodingNodeId) {
|
|
190
|
-
if (!binaryEncodingNodeId) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
verifyExpandedNodeId(binaryEncodingNodeId);
|
|
194
|
-
const expandedNodeIdKey = makeExpandedNodeIdKey(binaryEncodingNodeId);
|
|
195
|
-
const constructor = this._structureInfoByEncodingMap.get(expandedNodeIdKey);
|
|
196
|
-
if (constructor) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
for (const factory of this.baseDataFactories) {
|
|
200
|
-
const constructor2 = factory.getConstructor(binaryEncodingNodeId);
|
|
201
|
-
if (constructor2) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
constructObject(binaryEncodingNodeId) {
|
|
208
|
-
verifyExpandedNodeId(binaryEncodingNodeId);
|
|
209
|
-
const Constructor = this.getConstructor(binaryEncodingNodeId);
|
|
210
|
-
if (!Constructor) {
|
|
211
|
-
debugLog("Cannot find constructor for " + binaryEncodingNodeId.toString());
|
|
212
|
-
throw new Error("Cannot find constructor for " + binaryEncodingNodeId.toString());
|
|
213
|
-
}
|
|
214
|
-
return new Constructor();
|
|
215
|
-
}
|
|
216
|
-
associateWithBinaryEncoding(className, expandedNodeId) {
|
|
217
|
-
const structureInfo = this.getStructureInfoByTypeName(className);
|
|
218
|
-
if (doDebug) {
|
|
219
|
-
debugLog(" associateWithBinaryEncoding ", className, expandedNodeId.toString());
|
|
220
|
-
}
|
|
221
|
-
verifyExpandedNodeId(expandedNodeId);
|
|
222
|
-
const expandedNodeIdKey = makeExpandedNodeIdKey(expandedNodeId);
|
|
223
|
-
/* istanbul ignore next */
|
|
224
|
-
if (this._structureInfoByEncodingMap.has(expandedNodeIdKey)) {
|
|
225
|
-
throw new Error(" Class " +
|
|
226
|
-
className +
|
|
227
|
-
" with ID " +
|
|
228
|
-
expandedNodeId +
|
|
229
|
-
" already in constructorMap for " +
|
|
230
|
-
this._structureInfoByEncodingMap.get(expandedNodeIdKey).schema.name);
|
|
231
|
-
}
|
|
232
|
-
this._structureInfoByEncodingMap.set(expandedNodeIdKey, structureInfo);
|
|
233
|
-
}
|
|
234
|
-
toString() {
|
|
235
|
-
const l = [];
|
|
236
|
-
function write(...args) {
|
|
237
|
-
l.push(util.format.apply(util.format, args));
|
|
238
|
-
}
|
|
239
|
-
dumpDataFactory(this, write);
|
|
240
|
-
return l.join("\n");
|
|
241
|
-
}
|
|
242
|
-
_registerFactory(dataTypeNodeId, typeName, constructor, schema) {
|
|
243
|
-
/* istanbul ignore next */
|
|
244
|
-
if (this._structureInfoByName.has(typeName)) {
|
|
245
|
-
warningLog("target namespace = `" + this.targetNamespace + "`");
|
|
246
|
-
warningLog("registerFactory : " + typeName + " already registered. dataTypeNodeId=", dataTypeNodeId.toString());
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
debugLog("registering typeName ", typeName, dataTypeNodeId.toString(), "isAbstract ", schema.isAbstract);
|
|
250
|
-
const structureInfo = { constructor, schema };
|
|
251
|
-
this._structureInfoByName.set(typeName, structureInfo);
|
|
252
|
-
if (dataTypeNodeId.value !== 0) {
|
|
253
|
-
this._structureInfoByDataTypeMap.set(dataTypeNodeId.toString(), structureInfo);
|
|
254
|
-
}
|
|
255
|
-
// console.log("is this neceesary anymore ?");
|
|
256
|
-
// if (constructor) {
|
|
257
|
-
// Object.defineProperty(constructor.schema, "$$factory", {
|
|
258
|
-
// enumerable: false,
|
|
259
|
-
// value: this,
|
|
260
|
-
// writable: false
|
|
261
|
-
// });
|
|
262
|
-
// }
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
exports.DataTypeFactory = DataTypeFactory;
|
|
266
|
-
function dumpSchema(schema, write) {
|
|
267
|
-
write("name ", schema.name);
|
|
268
|
-
write("dataType ", schema.dataTypeNodeId.toString());
|
|
269
|
-
write("binaryEncoding ", schema.encodingDefaultBinary.toString());
|
|
270
|
-
for (const f of schema.fields) {
|
|
271
|
-
write(" ", f.name.padEnd(30, " "), f.isArray ? true : false, f.fieldType);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
function dumpDataFactory(dataFactory, write) {
|
|
275
|
-
for (const structureTypeName of dataFactory.structuredTypesNames()) {
|
|
276
|
-
const schema = dataFactory.getStructuredTypeSchema(structureTypeName);
|
|
277
|
-
write("structureTypeName =", structureTypeName);
|
|
278
|
-
if (!dataFactory.getStructureInfoForDataType(schema.dataTypeNodeId)) {
|
|
279
|
-
write(" ( No constructor for " + schema.name + " " + schema.dataTypeNodeId.toString());
|
|
280
|
-
}
|
|
281
|
-
if (!schema.encodingDefaultBinary) {
|
|
282
|
-
write(" (Schema has no encoding defaultBinary )");
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
if (dataFactory.hasConstructor(schema.encodingDefaultBinary)) {
|
|
286
|
-
write("ERROR: cannot find constructor for encodingDefaultBinary");
|
|
287
|
-
write("schema name:", schema.name, "(abstract=", schema.isAbstract, ")");
|
|
288
|
-
write(" dataType NodeId:", schema.dataTypeNodeId.toString());
|
|
289
|
-
write("encoding Default Binary:", schema.encodingDefaultBinary ? schema.encodingDefaultBinary.toString() : " ");
|
|
290
|
-
write("encoding Default Xml :", schema.encodingDefaultXml ? schema.encodingDefaultXml.toString() : " ");
|
|
291
|
-
// return;
|
|
292
|
-
// throw new Error("Not in Binary Encoding Map!!!!! " + schema.encodingDefaultBinary);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
dumpSchema(schema, write);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function verifyExpandedNodeId(expandedNodeId) {
|
|
299
|
-
/* istanbul ignore next */
|
|
300
|
-
if (expandedNodeId.value instanceof Buffer) {
|
|
301
|
-
throw new Error("getConstructor not implemented for opaque nodeid");
|
|
302
|
-
}
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
function makeExpandedNodeIdKey(expandedNodeId) {
|
|
306
|
-
return expandedNodeId.toString();
|
|
307
|
-
}
|
|
308
|
-
//# sourceMappingURL=datatype_factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datatype_factory.js","sourceRoot":"","sources":["../source/datatype_factory.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,6BAA6B;AAC7B,+BAA+B;AAE/B,yDAA2C;AAC3C,uDAAkF;AAElF,+DAAmD;AAEnD,mDAAmF;AACnF,iDAA2G;AAU3G,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,C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AC,0CAA0C,CAAC,CAAC;SACrD;aAAM;YACH,IAAI,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;gBAC1D,KAAK,CAAC,0DAA0D,CAAC,CAAC;gBAClE,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,UAAU,EAAC,GAAG,CAAC,CAAC;gBACpF,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACpE,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAChH,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC1G,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"}
|
package/dist/encode_decode.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { OutputBinaryStream, BinaryStream } from "node-opcua-binary-stream";
|
|
2
|
-
export declare function defaultEncode(value: any, stream: OutputBinaryStream): void;
|
|
3
|
-
export declare function defaultDecode(stream: BinaryStream): any;
|
|
4
|
-
export declare function defaultGuidValue(): any;
|
|
5
|
-
export declare function toJSONGuid(value: any): any;
|
|
6
|
-
export declare function encodeAny(value: any, stream: OutputBinaryStream): void;
|
|
7
|
-
export declare function decodeAny(stream: BinaryStream): void;
|
|
8
|
-
export declare function encodeNull(value: any, stream: OutputBinaryStream): void;
|
|
9
|
-
export declare function decodeNull(stream: BinaryStream): any;
|
package/dist/encode_decode.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeNull = exports.encodeNull = exports.decodeAny = exports.encodeAny = exports.toJSONGuid = exports.defaultGuidValue = exports.defaultDecode = exports.defaultEncode = void 0;
|
|
4
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
5
|
-
function defaultEncode(value, stream) {
|
|
6
|
-
/** */
|
|
7
|
-
}
|
|
8
|
-
exports.defaultEncode = defaultEncode;
|
|
9
|
-
function defaultDecode(stream) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
exports.defaultDecode = defaultDecode;
|
|
13
|
-
function defaultGuidValue() {
|
|
14
|
-
return Buffer.alloc(0);
|
|
15
|
-
}
|
|
16
|
-
exports.defaultGuidValue = defaultGuidValue;
|
|
17
|
-
function toJSONGuid(value) {
|
|
18
|
-
if (typeof value === "string") {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
(0, node_opcua_assert_1.default)(value instanceof Buffer);
|
|
22
|
-
return value.toString("base64");
|
|
23
|
-
}
|
|
24
|
-
exports.toJSONGuid = toJSONGuid;
|
|
25
|
-
function encodeAny(value, stream) {
|
|
26
|
-
(0, node_opcua_assert_1.default)(false, "type 'Any' cannot be encoded");
|
|
27
|
-
}
|
|
28
|
-
exports.encodeAny = encodeAny;
|
|
29
|
-
function decodeAny(stream) {
|
|
30
|
-
(0, node_opcua_assert_1.default)(false, "type 'Any' cannot be decoded");
|
|
31
|
-
}
|
|
32
|
-
exports.decodeAny = decodeAny;
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
34
|
-
function encodeNull(value, stream) { }
|
|
35
|
-
exports.encodeNull = encodeNull;
|
|
36
|
-
function decodeNull(stream) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
exports.decodeNull = decodeNull;
|
|
40
|
-
//# sourceMappingURL=encode_decode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode_decode.js","sourceRoot":"","sources":["../source/encode_decode.ts"],"names":[],"mappings":";;;AAAA,yDAAuC;AAGvC,SAAgB,aAAa,CAAC,KAAU,EAAE,MAA0B;IAChE,MAAM;AACV,CAAC;AAFD,sCAEC;AAED,SAAgB,aAAa,CAAC,MAAoB;IAC9C,OAAO,IAAI,CAAC;AAChB,CAAC;AAFD,sCAEC;AAED,SAAgB,gBAAgB;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAFD,4CAEC;AAED,SAAgB,UAAU,CAAC,KAAU;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO,KAAK,CAAC;KAChB;IACD,IAAA,2BAAM,EAAC,KAAK,YAAY,MAAM,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAND,gCAMC;AAED,SAAgB,SAAS,CAAC,KAAU,EAAE,MAA0B;IAC5D,IAAA,2BAAM,EAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;AAClD,CAAC;AAFD,8BAEC;AAED,SAAgB,SAAS,CAAC,MAAoB;IAC1C,IAAA,2BAAM,EAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;AAClD,CAAC;AAFD,8BAEC;AAED,gEAAgE;AAChE,SAAgB,UAAU,CAAC,KAAU,EAAE,MAA0B,IAAS,CAAC;AAA3E,gCAA2E;AAE3E,SAAgB,UAAU,CAAC,MAAoB;IAC3C,OAAO,IAAI,CAAC;AAChB,CAAC;AAFD,gCAEC"}
|
package/dist/enumerations.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
2
|
-
import { Enum, EnumItem, _TypescriptEnum } from "node-opcua-enum";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { TypeSchemaBase } from "./builtin_types";
|
|
5
|
-
import { EnumerationDefinition, TypeSchemaConstructorOptions } from "./types";
|
|
6
|
-
export interface EnumerationDefinitionOptions extends TypeSchemaConstructorOptions {
|
|
7
|
-
enumValues: _TypescriptEnum | string[];
|
|
8
|
-
typedEnum?: Enum;
|
|
9
|
-
lengthInBits?: number;
|
|
10
|
-
defaultValue?: EnumItem;
|
|
11
|
-
encode?: (value: EnumItem, stream: OutputBinaryStream) => void;
|
|
12
|
-
decode?: (stream: BinaryStream) => EnumItem;
|
|
13
|
-
}
|
|
14
|
-
export declare class EnumerationDefinitionSchema extends TypeSchemaBase implements EnumerationDefinition {
|
|
15
|
-
enumValues: _TypescriptEnum;
|
|
16
|
-
typedEnum: Enum;
|
|
17
|
-
lengthInBits: number;
|
|
18
|
-
dataTypeNodeId: NodeId;
|
|
19
|
-
constructor(dataTypeNodeId: NodeId, options: EnumerationDefinitionOptions);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @method registerEnumeration
|
|
23
|
-
* @param options
|
|
24
|
-
* @param options.name {string}
|
|
25
|
-
* @param options.enumValues [{key:Name, value:values}]
|
|
26
|
-
* @param options.encode
|
|
27
|
-
* @param options.decode
|
|
28
|
-
* @param options.typedEnum
|
|
29
|
-
* @param options.defaultValue
|
|
30
|
-
* @return {Enum}
|
|
31
|
-
*/
|
|
32
|
-
export declare function registerEnumeration(options: EnumerationDefinitionOptions): Enum;
|
|
33
|
-
export declare function hasBuiltInEnumeration(enumerationName: string): boolean;
|
|
34
|
-
export declare function getBuiltInEnumeration(enumerationName: string): EnumerationDefinitionSchema;
|
package/dist/enumerations.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuiltInEnumeration = exports.hasBuiltInEnumeration = exports.registerEnumeration = exports.EnumerationDefinitionSchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-factory
|
|
6
|
-
*/
|
|
7
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
-
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
9
|
-
const node_opcua_enum_1 = require("node-opcua-enum");
|
|
10
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
|
-
const builtin_types_1 = require("./builtin_types");
|
|
12
|
-
function _encode_enumeration(typedEnum, value, stream) {
|
|
13
|
-
(0, node_opcua_assert_1.assert)(typeof value === "number", "Expecting a number here");
|
|
14
|
-
(0, node_opcua_assert_1.assert)(typedEnum.get(value) !== undefined, "expecting a valid value");
|
|
15
|
-
stream.writeInteger(value);
|
|
16
|
-
}
|
|
17
|
-
function _decode_enumeration(typedEnum, stream) {
|
|
18
|
-
const value = stream.readInteger();
|
|
19
|
-
const e = typedEnum.get(value);
|
|
20
|
-
// istanbul ignore next
|
|
21
|
-
if (!e) {
|
|
22
|
-
throw new Error("cannot coerce value=" + value + " to " + typedEnum.constructor.name);
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
class EnumerationDefinitionSchema extends builtin_types_1.TypeSchemaBase {
|
|
27
|
-
// xx encode: (value: EnumItem, stream: OutputBinaryStream) => void;
|
|
28
|
-
// xx decode: (stream: BinaryStream) => EnumItem;
|
|
29
|
-
constructor(dataTypeNodeId, options) {
|
|
30
|
-
super(options);
|
|
31
|
-
this.dataTypeNodeId = dataTypeNodeId;
|
|
32
|
-
// create a new Enum
|
|
33
|
-
this.enumValues = (0, node_opcua_enum_1.adaptTypescriptEnum)(options.enumValues);
|
|
34
|
-
const typedEnum = new node_opcua_enum_1.Enum(options.enumValues);
|
|
35
|
-
options.typedEnum = typedEnum;
|
|
36
|
-
(0, node_opcua_assert_1.assert)(!options.encode || typeof options.encode === "function");
|
|
37
|
-
(0, node_opcua_assert_1.assert)(!options.decode || typeof options.decode === "function");
|
|
38
|
-
this.encode = options.encode || _encode_enumeration.bind(null, typedEnum);
|
|
39
|
-
this.decode = options.decode || _decode_enumeration.bind(null, typedEnum);
|
|
40
|
-
this.typedEnum = options.typedEnum;
|
|
41
|
-
this.defaultValue = this.typedEnum.getDefaultValue().value;
|
|
42
|
-
this.lengthInBits = options.lengthInBits || 32;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.EnumerationDefinitionSchema = EnumerationDefinitionSchema;
|
|
46
|
-
const _enumerations = new Map();
|
|
47
|
-
/**
|
|
48
|
-
* @method registerEnumeration
|
|
49
|
-
* @param options
|
|
50
|
-
* @param options.name {string}
|
|
51
|
-
* @param options.enumValues [{key:Name, value:values}]
|
|
52
|
-
* @param options.encode
|
|
53
|
-
* @param options.decode
|
|
54
|
-
* @param options.typedEnum
|
|
55
|
-
* @param options.defaultValue
|
|
56
|
-
* @return {Enum}
|
|
57
|
-
*/
|
|
58
|
-
function registerEnumeration(options) {
|
|
59
|
-
const dataTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.DataTypeIds[options.name]);
|
|
60
|
-
(0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(options, "name"));
|
|
61
|
-
(0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(options, "enumValues"));
|
|
62
|
-
const name = options.name;
|
|
63
|
-
if (Object.prototype.hasOwnProperty.call(_enumerations, name)) {
|
|
64
|
-
throw new Error("factories.registerEnumeration : Enumeration " + options.name + " has been already inserted");
|
|
65
|
-
}
|
|
66
|
-
const enumerationDefinition = new EnumerationDefinitionSchema(dataTypeNodeId, options);
|
|
67
|
-
_enumerations.set(name, enumerationDefinition);
|
|
68
|
-
return enumerationDefinition.typedEnum;
|
|
69
|
-
}
|
|
70
|
-
exports.registerEnumeration = registerEnumeration;
|
|
71
|
-
function hasBuiltInEnumeration(enumerationName) {
|
|
72
|
-
return _enumerations.has(enumerationName);
|
|
73
|
-
}
|
|
74
|
-
exports.hasBuiltInEnumeration = hasBuiltInEnumeration;
|
|
75
|
-
function getBuiltInEnumeration(enumerationName) {
|
|
76
|
-
if (!hasBuiltInEnumeration(enumerationName)) {
|
|
77
|
-
throw new Error("Cannot find enumeration with type " + enumerationName);
|
|
78
|
-
}
|
|
79
|
-
return _enumerations.get(enumerationName);
|
|
80
|
-
}
|
|
81
|
-
exports.getBuiltInEnumeration = getBuiltInEnumeration;
|
|
82
|
-
//# sourceMappingURL=enumerations.js.map
|
package/dist/enumerations.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enumerations.js","sourceRoot":"","sources":["../source/enumerations.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAG3C,+DAAmD;AACnD,qDAAuF;AACvF,yDAA0D;AAC1D,mDAAiD;AAGjD,SAAS,mBAAmB,CAAC,SAAe,EAAE,KAAa,EAAE,MAA0B;IACnF,IAAA,0BAAM,EAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,yBAAyB,CAAC,CAAC;IAC7D,IAAA,0BAAM,EAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,yBAAyB,CAAC,CAAC;IACtE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAe,EAAE,MAAoB;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAkB,CAAC;IAChD,uBAAuB;IACvB,IAAI,CAAC,CAAC,E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|
|
1
|
-
{"version":3,"file":"get_built_in_type.js","sourceRoot":"","sources":["../source/get_built_in_type.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { DataTypeFactory } from "./datatype_factory";
|
|
2
|
-
import { ConstructorFuncWithSchema } from "./types";
|
|
3
|
-
export declare function getStandardDataTypeFactory(): DataTypeFactory;
|
|
4
|
-
export declare function getStructureTypeConstructor(typeName: string): ConstructorFuncWithSchema;
|
|
5
|
-
export declare function dump(): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dump = exports.getStructureTypeConstructor = exports.getStandardDataTypeFactory = void 0;
|
|
4
|
-
const datatype_factory_1 = require("./datatype_factory");
|
|
5
|
-
let globalFactory;
|
|
6
|
-
function getStandardDataTypeFactory() {
|
|
7
|
-
if (!globalFactory) {
|
|
8
|
-
globalFactory = new datatype_factory_1.DataTypeFactory([]);
|
|
9
|
-
globalFactory.targetNamespace = "http://opcfoundation.org/UA/";
|
|
10
|
-
}
|
|
11
|
-
return globalFactory;
|
|
12
|
-
}
|
|
13
|
-
exports.getStandardDataTypeFactory = getStandardDataTypeFactory;
|
|
14
|
-
function getStructureTypeConstructor(typeName) {
|
|
15
|
-
const structureInfo = getStandardDataTypeFactory().getStructureInfoByTypeName(typeName);
|
|
16
|
-
if (!structureInfo) {
|
|
17
|
-
throw new Error("cannot find Structure Information for " + typeName);
|
|
18
|
-
}
|
|
19
|
-
if (!structureInfo.constructor) {
|
|
20
|
-
throw new Error("cannot Structure is Abstract ! " + typeName);
|
|
21
|
-
}
|
|
22
|
-
return structureInfo.constructor;
|
|
23
|
-
}
|
|
24
|
-
exports.getStructureTypeConstructor = getStructureTypeConstructor;
|
|
25
|
-
/* istanbul ignore next */
|
|
26
|
-
function dump() {
|
|
27
|
-
getStandardDataTypeFactory().dump();
|
|
28
|
-
}
|
|
29
|
-
exports.dump = dump;
|
|
30
|
-
//# sourceMappingURL=get_standard_data_type_factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_standard_data_type_factory.js","sourceRoot":"","sources":["../source/get_standard_data_type_factory.ts"],"names":[],"mappings":";;;AAKA,yDAAqD;AAIrD,IAAI,aAA8B,CAAC;AAEnC,SAAgB,0BAA0B;IACtC,IAAI,CAAC,aAAa,EAAE;QAChB,aAAa,GAAG,IAAI,kCAAe,CAAC,EAAE,CAAC,CAAC;QACxC,aAAa,CAAC,eAAe,GAAG,8BAA8B,CAAC;KAClE;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAND,gEAMC;AAED,SAAgB,2BAA2B,CAAC,QAAgB;IACxD,MAAM,aAAa,GAAI,0BAA0B,EAAE,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IACzF,IAAI,CAAC,aAAa,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAE,QAAQ,CAAC,CAAA;KACtE;IACD,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAE,QAAQ,CAAC,CAAA;KAChE;IACD,OAAO,aAAa,CAAC,WAAW,CAAC;AACrC,CAAC;AATD,kEASC;AAID,0BAA0B;AAC1B,SAAgB,IAAI;IAChB,0BAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC;AAFD,oBAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// export function getStructuredTypeSchema(typeName: string): IStructuredTypeSchema {
|
|
4
|
-
// return getStandardDataTypeFactory().getStructuredTypeSchema(typeName);
|
|
5
|
-
// }
|
|
6
|
-
// export function constructObject(binaryEncodingNodeId: ExpandedNodeId): IBaseUAObject {
|
|
7
|
-
// return getStandardDataTypeFactory().constructObject(binaryEncodingNodeId);
|
|
8
|
-
// }
|
|
9
|
-
//# sourceMappingURL=get_structured_type_schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_structured_type_schema.js","sourceRoot":"","sources":["../source/get_structured_type_schema.ts"],"names":[],"mappings":";;AAIA,qFAAqF;AACrF,6EAA6E;AAC7E,IAAI;AACJ,yFAAyF;AACzF,iFAAiF;AACjF,IAAI"}
|
package/dist/id_generator.d.ts
DELETED
package/dist/id_generator.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.is_internal_id = exports.next_available_id = exports.generate_new_id = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-factory
|
|
6
|
-
*/
|
|
7
|
-
const _FIRST_INTERNAL_ID = 0xfffe0000;
|
|
8
|
-
let _nextAvailableId = _FIRST_INTERNAL_ID;
|
|
9
|
-
function generate_new_id() {
|
|
10
|
-
_nextAvailableId += 1;
|
|
11
|
-
return _nextAvailableId;
|
|
12
|
-
}
|
|
13
|
-
exports.generate_new_id = generate_new_id;
|
|
14
|
-
function next_available_id() {
|
|
15
|
-
return -1;
|
|
16
|
-
}
|
|
17
|
-
exports.next_available_id = next_available_id;
|
|
18
|
-
function is_internal_id(value) {
|
|
19
|
-
return value >= _FIRST_INTERNAL_ID;
|
|
20
|
-
}
|
|
21
|
-
exports.is_internal_id = is_internal_id;
|
|
22
|
-
//# sourceMappingURL=id_generator.js.map
|
package/dist/id_generator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id_generator.js","sourceRoot":"","sources":["../source/id_generator.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC,IAAI,gBAAgB,GAAG,kBAAkB,CAAC;AAE1C,SAAgB,eAAe;IAC3B,gBAAgB,IAAI,CAAC,CAAC;IACtB,OAAO,gBAAgB,CAAC;AAC5B,CAAC;AAHD,0CAGC;AAED,SAAgB,iBAAiB;IAC7B,OAAO,CAAC,CAAC,CAAC;AACd,CAAC;AAFD,8CAEC;AACD,SAAgB,cAAc,CAAC,KAAa;IACxC,OAAO,KAAK,IAAI,kBAAkB,CAAC;AACvC,CAAC;AAFD,wCAEC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-factory
|
|
3
|
-
*/
|
|
4
|
-
export * from "./base_ua_object";
|
|
5
|
-
export * from "./basic_type";
|
|
6
|
-
export * from "./builtin_types_special";
|
|
7
|
-
export * from "./builtin_types";
|
|
8
|
-
export * from "./datatype_factory";
|
|
9
|
-
export * from "./enumerations";
|
|
10
|
-
export * from "./get_standard_data_type_factory";
|
|
11
|
-
export * from "./get_structured_type_schema";
|
|
12
|
-
export * from "./id_generator";
|
|
13
|
-
export * from "./nodeid_type";
|
|
14
|
-
export * from "./parameters";
|
|
15
|
-
export * from "./register_class_definition";
|
|
16
|
-
export * from "./schema_helpers";
|
|
17
|
-
export * from "./structured_type_schema";
|
|
18
|
-
export * from "./types";
|