node-opcua-client-dynamic-extension-object 2.97.0 → 2.98.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/convert_data_type_definition_to_structuretype_schema.d.ts +14 -14
- package/dist/convert_data_type_definition_to_structuretype_schema.js +410 -410
- package/dist/convert_structuretype_schema_to_structure_definition.d.ts +3 -3
- package/dist/convert_structuretype_schema_to_structure_definition.js +53 -53
- package/dist/extra_data_type_manager.d.ts +16 -16
- package/dist/extra_data_type_manager.js +78 -78
- package/dist/get_extension_object_constructor.d.ts +7 -7
- package/dist/get_extension_object_constructor.js +37 -37
- package/dist/get_extra_data_type_manager.d.ts +3 -3
- package/dist/get_extra_data_type_manager.js +51 -51
- package/dist/index.d.ts +13 -13
- package/dist/index.js +29 -29
- package/dist/populate_data_type_manager.d.ts +3 -3
- package/dist/populate_data_type_manager.js +88 -88
- package/dist/private/find_encodings.d.ts +4 -4
- package/dist/private/find_encodings.js +55 -55
- package/dist/private/populate_data_type_manager_103.d.ts +9 -9
- package/dist/private/populate_data_type_manager_103.js +639 -639
- package/dist/private/populate_data_type_manager_104.d.ts +9 -9
- package/dist/private/populate_data_type_manager_104.js +217 -217
- package/dist/promote_opaque_structure.d.ts +7 -7
- package/dist/promote_opaque_structure.js +46 -46
- package/dist/promote_opaque_structure_in_notification_data.d.ts +3 -3
- package/dist/promote_opaque_structure_in_notification_data.js +51 -51
- package/dist/resolve_dynamic_extension_object.d.ts +6 -6
- package/dist/resolve_dynamic_extension_object.js +177 -177
- package/package.json +22 -18
- package/test/test_convertStructureTypeSchemaToStructureDefinition.ts +0 -117
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IStructuredTypeSchema } from "node-opcua-factory";
|
|
2
|
-
import { StructureDefinition } from "node-opcua-types";
|
|
3
|
-
export declare function convertStructureTypeSchemaToStructureDefinition(st: IStructuredTypeSchema): StructureDefinition;
|
|
1
|
+
import { IStructuredTypeSchema } from "node-opcua-factory";
|
|
2
|
+
import { StructureDefinition } from "node-opcua-types";
|
|
3
|
+
export declare function convertStructureTypeSchemaToStructureDefinition(st: IStructuredTypeSchema): StructureDefinition;
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertStructureTypeSchemaToStructureDefinition = void 0;
|
|
4
|
-
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
5
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
6
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
7
|
-
function _getDataType(field) {
|
|
8
|
-
switch (field.category) {
|
|
9
|
-
case node_opcua_factory_1.FieldCategory.complex:
|
|
10
|
-
return (0, node_opcua_nodeid_1.resolveNodeId)(field.schema.dataTypeNodeId);
|
|
11
|
-
case node_opcua_factory_1.FieldCategory.basic:
|
|
12
|
-
return (0, node_opcua_nodeid_1.resolveNodeId)(field.fieldType);
|
|
13
|
-
case node_opcua_factory_1.FieldCategory.enumeration:
|
|
14
|
-
default:
|
|
15
|
-
return (0, node_opcua_nodeid_1.resolveNodeId)(field.dataType);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function convertStructureTypeSchemaToStructureDefinition(st) {
|
|
19
|
-
var _a;
|
|
20
|
-
let structureType = node_opcua_types_1.StructureType.Invalid;
|
|
21
|
-
let isUnion = false;
|
|
22
|
-
if (st.baseType === "Union") {
|
|
23
|
-
structureType = node_opcua_types_1.StructureType.Union;
|
|
24
|
-
isUnion = true;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
structureType = node_opcua_types_1.StructureType.Structure;
|
|
28
|
-
}
|
|
29
|
-
// convert partial field (not including base class)
|
|
30
|
-
const structureDefinition = {
|
|
31
|
-
fields: [],
|
|
32
|
-
baseDataType: (_a = st.getBaseSchema()) === null || _a === void 0 ? void 0 : _a.dataTypeNodeId,
|
|
33
|
-
defaultEncodingId: st.encodingDefaultBinary,
|
|
34
|
-
structureType
|
|
35
|
-
};
|
|
36
|
-
const fields = structureDefinition.fields || [];
|
|
37
|
-
for (const f of st.fields) {
|
|
38
|
-
const dataType = _getDataType(f);
|
|
39
|
-
if (isUnion && f.originalName === "SwitchField") {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
fields.push({
|
|
43
|
-
arrayDimensions: f.isArray ? [] : undefined,
|
|
44
|
-
valueRank: f.isArray ? 1 : -1,
|
|
45
|
-
dataType,
|
|
46
|
-
isOptional: isUnion ? undefined : f.switchValue !== undefined,
|
|
47
|
-
description: f.documentation || undefined,
|
|
48
|
-
name: f.originalName
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return new node_opcua_types_1.StructureDefinition(structureDefinition);
|
|
52
|
-
}
|
|
53
|
-
exports.convertStructureTypeSchemaToStructureDefinition = convertStructureTypeSchemaToStructureDefinition;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertStructureTypeSchemaToStructureDefinition = void 0;
|
|
4
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
5
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
6
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
7
|
+
function _getDataType(field) {
|
|
8
|
+
switch (field.category) {
|
|
9
|
+
case node_opcua_factory_1.FieldCategory.complex:
|
|
10
|
+
return (0, node_opcua_nodeid_1.resolveNodeId)(field.schema.dataTypeNodeId);
|
|
11
|
+
case node_opcua_factory_1.FieldCategory.basic:
|
|
12
|
+
return (0, node_opcua_nodeid_1.resolveNodeId)(field.fieldType);
|
|
13
|
+
case node_opcua_factory_1.FieldCategory.enumeration:
|
|
14
|
+
default:
|
|
15
|
+
return (0, node_opcua_nodeid_1.resolveNodeId)(field.dataType);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function convertStructureTypeSchemaToStructureDefinition(st) {
|
|
19
|
+
var _a;
|
|
20
|
+
let structureType = node_opcua_types_1.StructureType.Invalid;
|
|
21
|
+
let isUnion = false;
|
|
22
|
+
if (st.baseType === "Union") {
|
|
23
|
+
structureType = node_opcua_types_1.StructureType.Union;
|
|
24
|
+
isUnion = true;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
structureType = node_opcua_types_1.StructureType.Structure;
|
|
28
|
+
}
|
|
29
|
+
// convert partial field (not including base class)
|
|
30
|
+
const structureDefinition = {
|
|
31
|
+
fields: [],
|
|
32
|
+
baseDataType: (_a = st.getBaseSchema()) === null || _a === void 0 ? void 0 : _a.dataTypeNodeId,
|
|
33
|
+
defaultEncodingId: st.encodingDefaultBinary,
|
|
34
|
+
structureType
|
|
35
|
+
};
|
|
36
|
+
const fields = structureDefinition.fields || [];
|
|
37
|
+
for (const f of st.fields) {
|
|
38
|
+
const dataType = _getDataType(f);
|
|
39
|
+
if (isUnion && f.originalName === "SwitchField") {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
fields.push({
|
|
43
|
+
arrayDimensions: f.isArray ? [] : undefined,
|
|
44
|
+
valueRank: f.isArray ? 1 : -1,
|
|
45
|
+
dataType,
|
|
46
|
+
isOptional: isUnion ? undefined : f.switchValue !== undefined,
|
|
47
|
+
description: f.documentation || undefined,
|
|
48
|
+
name: f.originalName
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return new node_opcua_types_1.StructureDefinition(structureDefinition);
|
|
52
|
+
}
|
|
53
|
+
exports.convertStructureTypeSchemaToStructureDefinition = convertStructureTypeSchemaToStructureDefinition;
|
|
54
54
|
//# sourceMappingURL=convert_structuretype_schema_to_structure_definition.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ConstructorFunc, DataTypeFactory } from "node-opcua-factory";
|
|
2
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
3
|
-
import { AnyConstructorFunc } from "node-opcua-schemas";
|
|
4
|
-
export declare class ExtraDataTypeManager {
|
|
5
|
-
namespaceArray: string[];
|
|
6
|
-
private dataTypeFactoryMapByNamespace;
|
|
7
|
-
constructor();
|
|
8
|
-
setNamespaceArray(namespaceArray: string[]): void;
|
|
9
|
-
hasDataTypeFactory(namespaceIndex: number): boolean;
|
|
10
|
-
registerDataTypeFactory(namespaceIndex: number, dataTypeFactory: DataTypeFactory): void;
|
|
11
|
-
getDataTypeFactoryForNamespace(namespaceIndex: number): DataTypeFactory;
|
|
12
|
-
getDataTypeFactory(namespaceIndex: number): DataTypeFactory;
|
|
13
|
-
getExtensionObjectConstructorFromDataType(dataTypeNodeId: NodeId): AnyConstructorFunc;
|
|
14
|
-
getExtensionObjectConstructorFromBinaryEncoding(binaryEncodingNodeId: NodeId): ConstructorFunc;
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
1
|
+
import { ConstructorFunc, DataTypeFactory } from "node-opcua-factory";
|
|
2
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
3
|
+
import { AnyConstructorFunc } from "node-opcua-schemas";
|
|
4
|
+
export declare class ExtraDataTypeManager {
|
|
5
|
+
namespaceArray: string[];
|
|
6
|
+
private dataTypeFactoryMapByNamespace;
|
|
7
|
+
constructor();
|
|
8
|
+
setNamespaceArray(namespaceArray: string[]): void;
|
|
9
|
+
hasDataTypeFactory(namespaceIndex: number): boolean;
|
|
10
|
+
registerDataTypeFactory(namespaceIndex: number, dataTypeFactory: DataTypeFactory): void;
|
|
11
|
+
getDataTypeFactoryForNamespace(namespaceIndex: number): DataTypeFactory;
|
|
12
|
+
getDataTypeFactory(namespaceIndex: number): DataTypeFactory;
|
|
13
|
+
getExtensionObjectConstructorFromDataType(dataTypeNodeId: NodeId): AnyConstructorFunc;
|
|
14
|
+
getExtensionObjectConstructorFromBinaryEncoding(binaryEncodingNodeId: NodeId): ConstructorFunc;
|
|
15
|
+
toString(): string;
|
|
16
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExtraDataTypeManager = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-client-dynamic-extension-object
|
|
6
|
-
*/
|
|
7
|
-
const util_1 = require("util");
|
|
8
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
9
|
-
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
10
|
-
class ExtraDataTypeManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.namespaceArray = [];
|
|
13
|
-
this.dataTypeFactoryMapByNamespace = {};
|
|
14
|
-
/* */
|
|
15
|
-
}
|
|
16
|
-
setNamespaceArray(namespaceArray) {
|
|
17
|
-
this.namespaceArray = namespaceArray;
|
|
18
|
-
}
|
|
19
|
-
hasDataTypeFactory(namespaceIndex) {
|
|
20
|
-
return !!Object.prototype.hasOwnProperty.call(this.dataTypeFactoryMapByNamespace, namespaceIndex);
|
|
21
|
-
}
|
|
22
|
-
registerDataTypeFactory(namespaceIndex, dataTypeFactory) {
|
|
23
|
-
/* istanbul ignore next */
|
|
24
|
-
(0, node_opcua_assert_1.assert)(namespaceIndex !== 0, "registerTypeDictionary cannot be used for namespace 0");
|
|
25
|
-
if (this.hasDataTypeFactory(namespaceIndex)) {
|
|
26
|
-
throw new Error("Dictionary already registered");
|
|
27
|
-
}
|
|
28
|
-
this.dataTypeFactoryMapByNamespace[namespaceIndex] = dataTypeFactory;
|
|
29
|
-
}
|
|
30
|
-
getDataTypeFactoryForNamespace(namespaceIndex) {
|
|
31
|
-
(0, node_opcua_assert_1.assert)(namespaceIndex !== 0, "getTypeDictionaryForNamespace cannot be used for namespace 0");
|
|
32
|
-
return this.dataTypeFactoryMapByNamespace[namespaceIndex];
|
|
33
|
-
}
|
|
34
|
-
getDataTypeFactory(namespaceIndex) {
|
|
35
|
-
if (namespaceIndex === 0) {
|
|
36
|
-
return (0, node_opcua_factory_1.getStandardDataTypeFactory)();
|
|
37
|
-
}
|
|
38
|
-
return this.dataTypeFactoryMapByNamespace[namespaceIndex];
|
|
39
|
-
}
|
|
40
|
-
getExtensionObjectConstructorFromDataType(dataTypeNodeId) {
|
|
41
|
-
const dataTypeFactory = this.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
42
|
-
if (!dataTypeFactory) {
|
|
43
|
-
throw new Error("cannot find dataFactory for namespace=" + dataTypeNodeId.namespace + " when requested for " + dataTypeNodeId.toString());
|
|
44
|
-
}
|
|
45
|
-
// find schema corresponding to dataTypeNodeId in typeDictionary
|
|
46
|
-
const Constructor = dataTypeFactory.findStructureInfoForDataType(dataTypeNodeId).constructor;
|
|
47
|
-
if (!Constructor) {
|
|
48
|
-
throw new Error("Cannot find Extension Object Constructor for Abstract dataType");
|
|
49
|
-
}
|
|
50
|
-
return Constructor;
|
|
51
|
-
}
|
|
52
|
-
getExtensionObjectConstructorFromBinaryEncoding(binaryEncodingNodeId) {
|
|
53
|
-
const dataTypeFactory = this.getDataTypeFactoryForNamespace(binaryEncodingNodeId.namespace);
|
|
54
|
-
const Constructor = dataTypeFactory.getConstructor(binaryEncodingNodeId);
|
|
55
|
-
if (!Constructor) {
|
|
56
|
-
throw new Error("getExtensionObjectConstructorFromBinaryEncoding cannot find constructor for binaryEncoding " +
|
|
57
|
-
binaryEncodingNodeId.toString());
|
|
58
|
-
}
|
|
59
|
-
return Constructor;
|
|
60
|
-
}
|
|
61
|
-
toString() {
|
|
62
|
-
const l = [];
|
|
63
|
-
function write(...args) {
|
|
64
|
-
l.push(util_1.format.apply(util_1.format, args));
|
|
65
|
-
}
|
|
66
|
-
write("ExtraDataTypeManager");
|
|
67
|
-
for (let n = 0; n < this.namespaceArray.length; n++) {
|
|
68
|
-
write("------------- namespace:", this.namespaceArray[n]);
|
|
69
|
-
const dataFactory = this.dataTypeFactoryMapByNamespace[n];
|
|
70
|
-
if (!dataFactory) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
write(dataFactory.toString());
|
|
74
|
-
}
|
|
75
|
-
return l.join("\n");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.ExtraDataTypeManager = ExtraDataTypeManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtraDataTypeManager = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-client-dynamic-extension-object
|
|
6
|
+
*/
|
|
7
|
+
const util_1 = require("util");
|
|
8
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
9
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
10
|
+
class ExtraDataTypeManager {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.namespaceArray = [];
|
|
13
|
+
this.dataTypeFactoryMapByNamespace = {};
|
|
14
|
+
/* */
|
|
15
|
+
}
|
|
16
|
+
setNamespaceArray(namespaceArray) {
|
|
17
|
+
this.namespaceArray = namespaceArray;
|
|
18
|
+
}
|
|
19
|
+
hasDataTypeFactory(namespaceIndex) {
|
|
20
|
+
return !!Object.prototype.hasOwnProperty.call(this.dataTypeFactoryMapByNamespace, namespaceIndex);
|
|
21
|
+
}
|
|
22
|
+
registerDataTypeFactory(namespaceIndex, dataTypeFactory) {
|
|
23
|
+
/* istanbul ignore next */
|
|
24
|
+
(0, node_opcua_assert_1.assert)(namespaceIndex !== 0, "registerTypeDictionary cannot be used for namespace 0");
|
|
25
|
+
if (this.hasDataTypeFactory(namespaceIndex)) {
|
|
26
|
+
throw new Error("Dictionary already registered");
|
|
27
|
+
}
|
|
28
|
+
this.dataTypeFactoryMapByNamespace[namespaceIndex] = dataTypeFactory;
|
|
29
|
+
}
|
|
30
|
+
getDataTypeFactoryForNamespace(namespaceIndex) {
|
|
31
|
+
(0, node_opcua_assert_1.assert)(namespaceIndex !== 0, "getTypeDictionaryForNamespace cannot be used for namespace 0");
|
|
32
|
+
return this.dataTypeFactoryMapByNamespace[namespaceIndex];
|
|
33
|
+
}
|
|
34
|
+
getDataTypeFactory(namespaceIndex) {
|
|
35
|
+
if (namespaceIndex === 0) {
|
|
36
|
+
return (0, node_opcua_factory_1.getStandardDataTypeFactory)();
|
|
37
|
+
}
|
|
38
|
+
return this.dataTypeFactoryMapByNamespace[namespaceIndex];
|
|
39
|
+
}
|
|
40
|
+
getExtensionObjectConstructorFromDataType(dataTypeNodeId) {
|
|
41
|
+
const dataTypeFactory = this.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
42
|
+
if (!dataTypeFactory) {
|
|
43
|
+
throw new Error("cannot find dataFactory for namespace=" + dataTypeNodeId.namespace + " when requested for " + dataTypeNodeId.toString());
|
|
44
|
+
}
|
|
45
|
+
// find schema corresponding to dataTypeNodeId in typeDictionary
|
|
46
|
+
const Constructor = dataTypeFactory.findStructureInfoForDataType(dataTypeNodeId).constructor;
|
|
47
|
+
if (!Constructor) {
|
|
48
|
+
throw new Error("Cannot find Extension Object Constructor for Abstract dataType");
|
|
49
|
+
}
|
|
50
|
+
return Constructor;
|
|
51
|
+
}
|
|
52
|
+
getExtensionObjectConstructorFromBinaryEncoding(binaryEncodingNodeId) {
|
|
53
|
+
const dataTypeFactory = this.getDataTypeFactoryForNamespace(binaryEncodingNodeId.namespace);
|
|
54
|
+
const Constructor = dataTypeFactory.getConstructor(binaryEncodingNodeId);
|
|
55
|
+
if (!Constructor) {
|
|
56
|
+
throw new Error("getExtensionObjectConstructorFromBinaryEncoding cannot find constructor for binaryEncoding " +
|
|
57
|
+
binaryEncodingNodeId.toString());
|
|
58
|
+
}
|
|
59
|
+
return Constructor;
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
const l = [];
|
|
63
|
+
function write(...args) {
|
|
64
|
+
l.push(util_1.format.apply(util_1.format, args));
|
|
65
|
+
}
|
|
66
|
+
write("ExtraDataTypeManager");
|
|
67
|
+
for (let n = 0; n < this.namespaceArray.length; n++) {
|
|
68
|
+
write("------------- namespace:", this.namespaceArray[n]);
|
|
69
|
+
const dataFactory = this.dataTypeFactoryMapByNamespace[n];
|
|
70
|
+
if (!dataFactory) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
write(dataFactory.toString());
|
|
74
|
+
}
|
|
75
|
+
return l.join("\n");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ExtraDataTypeManager = ExtraDataTypeManager;
|
|
79
79
|
//# sourceMappingURL=extra_data_type_manager.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
2
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
3
|
-
import { AnyConstructorFunc } from "node-opcua-schemas";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export declare function getExtensionObjectConstructor(session: IBasicSession, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>;
|
|
1
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
2
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
3
|
+
import { AnyConstructorFunc } from "node-opcua-schemas";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare function getExtensionObjectConstructor(session: IBasicSession, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getExtensionObjectConstructor = void 0;
|
|
13
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
14
|
-
//
|
|
15
|
-
const get_extra_data_type_manager_1 = require("./get_extra_data_type_manager");
|
|
16
|
-
const populate_data_type_manager_104_1 = require("./private/populate_data_type_manager_104");
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
function getExtensionObjectConstructor(session, dataTypeNodeId) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const extraDataTypeManager = yield (0, get_extra_data_type_manager_1.getExtraDataTypeManager)(session);
|
|
23
|
-
const dataTypeFactory = extraDataTypeManager.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
24
|
-
const structureInfo = dataTypeFactory.getStructureInfoForDataType(dataTypeNodeId);
|
|
25
|
-
if (structureInfo) {
|
|
26
|
-
return structureInfo.constructor;
|
|
27
|
-
}
|
|
28
|
-
const dataValue = yield session.read({
|
|
29
|
-
nodeId: dataTypeNodeId,
|
|
30
|
-
attributeId: node_opcua_data_model_1.AttributeIds.BrowseName
|
|
31
|
-
});
|
|
32
|
-
const browseName = dataValue.value.value;
|
|
33
|
-
yield (0, populate_data_type_manager_104_1.readDataTypeDefinitionAndBuildType)(session, dataTypeNodeId, browseName.name, dataTypeFactory, {});
|
|
34
|
-
return yield extraDataTypeManager.getExtensionObjectConstructorFromDataType(dataTypeNodeId);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
exports.getExtensionObjectConstructor = getExtensionObjectConstructor;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getExtensionObjectConstructor = void 0;
|
|
13
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
14
|
+
//
|
|
15
|
+
const get_extra_data_type_manager_1 = require("./get_extra_data_type_manager");
|
|
16
|
+
const populate_data_type_manager_104_1 = require("./private/populate_data_type_manager_104");
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
function getExtensionObjectConstructor(session, dataTypeNodeId) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const extraDataTypeManager = yield (0, get_extra_data_type_manager_1.getExtraDataTypeManager)(session);
|
|
23
|
+
const dataTypeFactory = extraDataTypeManager.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
24
|
+
const structureInfo = dataTypeFactory.getStructureInfoForDataType(dataTypeNodeId);
|
|
25
|
+
if (structureInfo) {
|
|
26
|
+
return structureInfo.constructor;
|
|
27
|
+
}
|
|
28
|
+
const dataValue = yield session.read({
|
|
29
|
+
nodeId: dataTypeNodeId,
|
|
30
|
+
attributeId: node_opcua_data_model_1.AttributeIds.BrowseName
|
|
31
|
+
});
|
|
32
|
+
const browseName = dataValue.value.value;
|
|
33
|
+
yield (0, populate_data_type_manager_104_1.readDataTypeDefinitionAndBuildType)(session, dataTypeNodeId, browseName.name, dataTypeFactory, {});
|
|
34
|
+
return yield extraDataTypeManager.getExtensionObjectConstructorFromDataType(dataTypeNodeId);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.getExtensionObjectConstructor = getExtensionObjectConstructor;
|
|
38
38
|
//# sourceMappingURL=get_extension_object_constructor.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
-
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
3
|
-
export declare function getExtraDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager>;
|
|
1
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
+
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
3
|
+
export declare function getExtraDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getExtraDataTypeManager = void 0;
|
|
13
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
14
|
-
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
15
|
-
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
16
|
-
//
|
|
17
|
-
const extra_data_type_manager_1 = require("./extra_data_type_manager");
|
|
18
|
-
const populate_data_type_manager_1 = require("./populate_data_type_manager");
|
|
19
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
20
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
21
|
-
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
22
|
-
function getExtraDataTypeManager(session) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const sessionPriv = session;
|
|
25
|
-
if (!sessionPriv.$$extraDataTypeManager) {
|
|
26
|
-
const dataTypeManager = new extra_data_type_manager_1.ExtraDataTypeManager();
|
|
27
|
-
const namespaceArray = yield (0, node_opcua_pseudo_session_1.readNamespaceArray)(sessionPriv);
|
|
28
|
-
// istanbul ignore next
|
|
29
|
-
if (namespaceArray.length === 0) {
|
|
30
|
-
errorLog("namespaceArray is not populated ! Your server must expose a list of namespace ");
|
|
31
|
-
}
|
|
32
|
-
// istanbul ignore next
|
|
33
|
-
if (doDebug) {
|
|
34
|
-
debugLog("Namespace Array = ", namespaceArray.join("\n "));
|
|
35
|
-
}
|
|
36
|
-
sessionPriv.$$extraDataTypeManager = dataTypeManager;
|
|
37
|
-
dataTypeManager.setNamespaceArray(namespaceArray);
|
|
38
|
-
for (let namespaceIndex = 1; namespaceIndex < namespaceArray.length; namespaceIndex++) {
|
|
39
|
-
const dataTypeFactory1 = new node_opcua_factory_1.DataTypeFactory([(0, node_opcua_factory_1.getStandardDataTypeFactory)()]);
|
|
40
|
-
dataTypeManager.registerDataTypeFactory(namespaceIndex, dataTypeFactory1);
|
|
41
|
-
}
|
|
42
|
-
yield (0, populate_data_type_manager_1.populateDataTypeManager)(session, dataTypeManager);
|
|
43
|
-
}
|
|
44
|
-
// istanbul ignore next
|
|
45
|
-
if (sessionPriv.$$extraDataTypeManager.namespaceArray.length === 0) {
|
|
46
|
-
throw new Error("namespaceArray is not populated ! Your server must expose a list of namespace ");
|
|
47
|
-
}
|
|
48
|
-
return sessionPriv.$$extraDataTypeManager;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.getExtraDataTypeManager = getExtraDataTypeManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getExtraDataTypeManager = void 0;
|
|
13
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
14
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
15
|
+
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
16
|
+
//
|
|
17
|
+
const extra_data_type_manager_1 = require("./extra_data_type_manager");
|
|
18
|
+
const populate_data_type_manager_1 = require("./populate_data_type_manager");
|
|
19
|
+
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
20
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
21
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
22
|
+
function getExtraDataTypeManager(session) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const sessionPriv = session;
|
|
25
|
+
if (!sessionPriv.$$extraDataTypeManager) {
|
|
26
|
+
const dataTypeManager = new extra_data_type_manager_1.ExtraDataTypeManager();
|
|
27
|
+
const namespaceArray = yield (0, node_opcua_pseudo_session_1.readNamespaceArray)(sessionPriv);
|
|
28
|
+
// istanbul ignore next
|
|
29
|
+
if (namespaceArray.length === 0) {
|
|
30
|
+
errorLog("namespaceArray is not populated ! Your server must expose a list of namespace ");
|
|
31
|
+
}
|
|
32
|
+
// istanbul ignore next
|
|
33
|
+
if (doDebug) {
|
|
34
|
+
debugLog("Namespace Array = ", namespaceArray.join("\n "));
|
|
35
|
+
}
|
|
36
|
+
sessionPriv.$$extraDataTypeManager = dataTypeManager;
|
|
37
|
+
dataTypeManager.setNamespaceArray(namespaceArray);
|
|
38
|
+
for (let namespaceIndex = 1; namespaceIndex < namespaceArray.length; namespaceIndex++) {
|
|
39
|
+
const dataTypeFactory1 = new node_opcua_factory_1.DataTypeFactory([(0, node_opcua_factory_1.getStandardDataTypeFactory)()]);
|
|
40
|
+
dataTypeManager.registerDataTypeFactory(namespaceIndex, dataTypeFactory1);
|
|
41
|
+
}
|
|
42
|
+
yield (0, populate_data_type_manager_1.populateDataTypeManager)(session, dataTypeManager);
|
|
43
|
+
}
|
|
44
|
+
// istanbul ignore next
|
|
45
|
+
if (sessionPriv.$$extraDataTypeManager.namespaceArray.length === 0) {
|
|
46
|
+
throw new Error("namespaceArray is not populated ! Your server must expose a list of namespace ");
|
|
47
|
+
}
|
|
48
|
+
return sessionPriv.$$extraDataTypeManager;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.getExtraDataTypeManager = getExtraDataTypeManager;
|
|
52
52
|
//# sourceMappingURL=get_extra_data_type_manager.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-client-dynamic-extension-object
|
|
3
|
-
*/
|
|
4
|
-
export * from "./populate_data_type_manager";
|
|
5
|
-
export * from "./extra_data_type_manager";
|
|
6
|
-
export * from "./resolve_dynamic_extension_object";
|
|
7
|
-
export * from "./promote_opaque_structure";
|
|
8
|
-
export * from "./get_extension_object_constructor";
|
|
9
|
-
export * from "./get_extra_data_type_manager";
|
|
10
|
-
export * from "./resolve_dynamic_extension_object";
|
|
11
|
-
export * from "./convert_data_type_definition_to_structuretype_schema";
|
|
12
|
-
export * from "./convert_structuretype_schema_to_structure_definition";
|
|
13
|
-
export * from "./promote_opaque_structure_in_notification_data";
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-client-dynamic-extension-object
|
|
3
|
+
*/
|
|
4
|
+
export * from "./populate_data_type_manager";
|
|
5
|
+
export * from "./extra_data_type_manager";
|
|
6
|
+
export * from "./resolve_dynamic_extension_object";
|
|
7
|
+
export * from "./promote_opaque_structure";
|
|
8
|
+
export * from "./get_extension_object_constructor";
|
|
9
|
+
export * from "./get_extra_data_type_manager";
|
|
10
|
+
export * from "./resolve_dynamic_extension_object";
|
|
11
|
+
export * from "./convert_data_type_definition_to_structuretype_schema";
|
|
12
|
+
export * from "./convert_structuretype_schema_to_structure_definition";
|
|
13
|
+
export * from "./promote_opaque_structure_in_notification_data";
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* @module node-opcua-client-dynamic-extension-object
|
|
19
|
-
*/
|
|
20
|
-
__exportStar(require("./populate_data_type_manager"), exports);
|
|
21
|
-
__exportStar(require("./extra_data_type_manager"), exports);
|
|
22
|
-
__exportStar(require("./resolve_dynamic_extension_object"), exports);
|
|
23
|
-
__exportStar(require("./promote_opaque_structure"), exports);
|
|
24
|
-
__exportStar(require("./get_extension_object_constructor"), exports);
|
|
25
|
-
__exportStar(require("./get_extra_data_type_manager"), exports);
|
|
26
|
-
__exportStar(require("./resolve_dynamic_extension_object"), exports);
|
|
27
|
-
__exportStar(require("./convert_data_type_definition_to_structuretype_schema"), exports);
|
|
28
|
-
__exportStar(require("./convert_structuretype_schema_to_structure_definition"), exports);
|
|
29
|
-
__exportStar(require("./promote_opaque_structure_in_notification_data"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* @module node-opcua-client-dynamic-extension-object
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("./populate_data_type_manager"), exports);
|
|
21
|
+
__exportStar(require("./extra_data_type_manager"), exports);
|
|
22
|
+
__exportStar(require("./resolve_dynamic_extension_object"), exports);
|
|
23
|
+
__exportStar(require("./promote_opaque_structure"), exports);
|
|
24
|
+
__exportStar(require("./get_extension_object_constructor"), exports);
|
|
25
|
+
__exportStar(require("./get_extra_data_type_manager"), exports);
|
|
26
|
+
__exportStar(require("./resolve_dynamic_extension_object"), exports);
|
|
27
|
+
__exportStar(require("./convert_data_type_definition_to_structuretype_schema"), exports);
|
|
28
|
+
__exportStar(require("./convert_structuretype_schema_to_structure_definition"), exports);
|
|
29
|
+
__exportStar(require("./promote_opaque_structure_in_notification_data"), exports);
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
-
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
3
|
-
export declare function populateDataTypeManager(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>;
|
|
1
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
+
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
3
|
+
export declare function populateDataTypeManager(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>;
|