node-opcua-data-model 2.70.0 → 2.71.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/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- /**
2
- * @module node-opcua-data-model
3
- */
4
- export * from "./access_level";
5
- export * from "./access_level_ex";
6
- export * from "./access_restrictions";
7
- export * from "./localized_text";
8
- export * from "./qualified_name";
9
- export * from "./diagnostic_info";
10
- export * from "./nodeclass";
11
- export * from "./attributeIds";
12
- export * from "./node_class_mask";
13
- export * from "./result_mask";
14
- export * from "./BrowseDirection";
15
- export * from "./data_encoding";
16
- export * from "./write_mask";
17
- export * from "./permission_flag";
1
+ /**
2
+ * @module node-opcua-data-model
3
+ */
4
+ export * from "./access_level";
5
+ export * from "./access_level_ex";
6
+ export * from "./access_restrictions";
7
+ export * from "./localized_text";
8
+ export * from "./qualified_name";
9
+ export * from "./diagnostic_info";
10
+ export * from "./nodeclass";
11
+ export * from "./attributeIds";
12
+ export * from "./node_class_mask";
13
+ export * from "./result_mask";
14
+ export * from "./BrowseDirection";
15
+ export * from "./data_encoding";
16
+ export * from "./write_mask";
17
+ export * from "./permission_flag";
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
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-data-model
19
- */
20
- __exportStar(require("./access_level"), exports);
21
- __exportStar(require("./access_level_ex"), exports);
22
- __exportStar(require("./access_restrictions"), exports);
23
- __exportStar(require("./localized_text"), exports);
24
- __exportStar(require("./qualified_name"), exports);
25
- __exportStar(require("./diagnostic_info"), exports);
26
- __exportStar(require("./nodeclass"), exports);
27
- __exportStar(require("./attributeIds"), exports);
28
- __exportStar(require("./node_class_mask"), exports);
29
- __exportStar(require("./result_mask"), exports);
30
- __exportStar(require("./BrowseDirection"), exports);
31
- __exportStar(require("./data_encoding"), exports);
32
- __exportStar(require("./write_mask"), exports);
33
- __exportStar(require("./permission_flag"), 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-data-model
19
+ */
20
+ __exportStar(require("./access_level"), exports);
21
+ __exportStar(require("./access_level_ex"), exports);
22
+ __exportStar(require("./access_restrictions"), exports);
23
+ __exportStar(require("./localized_text"), exports);
24
+ __exportStar(require("./qualified_name"), exports);
25
+ __exportStar(require("./diagnostic_info"), exports);
26
+ __exportStar(require("./nodeclass"), exports);
27
+ __exportStar(require("./attributeIds"), exports);
28
+ __exportStar(require("./node_class_mask"), exports);
29
+ __exportStar(require("./result_mask"), exports);
30
+ __exportStar(require("./BrowseDirection"), exports);
31
+ __exportStar(require("./data_encoding"), exports);
32
+ __exportStar(require("./write_mask"), exports);
33
+ __exportStar(require("./permission_flag"), exports);
34
34
  //# sourceMappingURL=index.js.map
@@ -1,24 +1,24 @@
1
- import { LocaleId, UAString } from "node-opcua-basic-types";
2
- import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
3
- import { BaseUAObject, DecodeDebugOptions, StructuredTypeSchema } from "node-opcua-factory";
4
- export declare function coerceLocalizedText(value?: null | string | LocalizedTextOptions): LocalizedText | null;
5
- export interface LocalizedTextOptions {
6
- locale?: LocaleId;
7
- text?: UAString;
8
- }
9
- export declare class LocalizedText extends BaseUAObject {
10
- static get schema(): StructuredTypeSchema;
11
- get schema(): StructuredTypeSchema;
12
- static possibleFields: string[];
13
- static coerce(value?: null | string | LocalizedTextOptions): LocalizedText | null;
14
- locale: LocaleId;
15
- text: UAString;
16
- constructor(options?: LocalizedTextOptions | string | null);
17
- toString(): string;
18
- encode(stream: OutputBinaryStream): void;
19
- decodeDebug(stream: BinaryStream, options: DecodeDebugOptions): void;
20
- decode(stream: BinaryStream): void;
21
- }
22
- export declare type LocalizedTextLike = LocalizedTextOptions | string;
23
- export declare function encodeLocalizedText(value: LocalizedText, stream: OutputBinaryStream): void;
24
- export declare function decodeLocalizedText(stream: BinaryStream, value?: LocalizedText): LocalizedText;
1
+ import { LocaleId, UAString } from "node-opcua-basic-types";
2
+ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
3
+ import { BaseUAObject, DecodeDebugOptions, StructuredTypeSchema } from "node-opcua-factory";
4
+ export declare function coerceLocalizedText(value?: null | string | LocalizedTextOptions): LocalizedText | null;
5
+ export interface LocalizedTextOptions {
6
+ locale?: LocaleId;
7
+ text?: UAString;
8
+ }
9
+ export declare class LocalizedText extends BaseUAObject {
10
+ static get schema(): StructuredTypeSchema;
11
+ get schema(): StructuredTypeSchema;
12
+ static possibleFields: string[];
13
+ static coerce(value?: null | string | LocalizedTextOptions): LocalizedText | null;
14
+ locale: LocaleId;
15
+ text: UAString;
16
+ constructor(options?: LocalizedTextOptions | string | null);
17
+ toString(): string;
18
+ encode(stream: OutputBinaryStream): void;
19
+ decodeDebug(stream: BinaryStream, options: DecodeDebugOptions): void;
20
+ decode(stream: BinaryStream): void;
21
+ }
22
+ export declare type LocalizedTextLike = LocalizedTextOptions | string;
23
+ export declare function encodeLocalizedText(value: LocalizedText, stream: OutputBinaryStream): void;
24
+ export declare function decodeLocalizedText(stream: BinaryStream, value?: LocalizedText): LocalizedText;
@@ -1,152 +1,152 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeLocalizedText = exports.encodeLocalizedText = exports.LocalizedText = exports.coerceLocalizedText = void 0;
4
- const node_opcua_basic_types_1 = require("node-opcua-basic-types");
5
- const node_opcua_factory_1 = require("node-opcua-factory");
6
- function coerceLocalizedText(value) {
7
- if (value === undefined || value === null) {
8
- return null;
9
- }
10
- if (value instanceof LocalizedText) {
11
- return value;
12
- }
13
- return new LocalizedText(value);
14
- }
15
- exports.coerceLocalizedText = coerceLocalizedText;
16
- // --------------------------------------------------------------------------------------------
17
- // see Part 3 - $8.5 page 63
18
- const schemaLocalizedText = (0, node_opcua_factory_1.buildStructuredType)({
19
- name: "LocalizedText",
20
- baseType: "BaseUAObject",
21
- fields: [
22
- {
23
- name: "locale",
24
- fieldType: "LocaleId",
25
- defaultValue: null
26
- },
27
- {
28
- name: "text",
29
- fieldType: "UAString",
30
- defaultValue: null
31
- }
32
- ]
33
- });
34
- schemaLocalizedText.coerce = coerceLocalizedText;
35
- class LocalizedText extends node_opcua_factory_1.BaseUAObject {
36
- constructor(options) {
37
- super();
38
- if (options === null) {
39
- this.locale = null;
40
- this.text = null;
41
- return;
42
- }
43
- if (typeof options === "string") {
44
- this.locale = null;
45
- this.text = options;
46
- return;
47
- }
48
- /* istanbul ignore next */
49
- if (node_opcua_factory_1.parameters.debugSchemaHelper) {
50
- const schema = schemaLocalizedText;
51
- (0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
52
- }
53
- this.locale = (options === null || options === void 0 ? void 0 : options.locale) || null;
54
- this.text = (options === null || options === void 0 ? void 0 : options.text) || null;
55
- }
56
- static get schema() {
57
- return schemaLocalizedText;
58
- }
59
- get schema() {
60
- return schemaLocalizedText;
61
- }
62
- static coerce(value) {
63
- return coerceLocalizedText(value);
64
- }
65
- toString() {
66
- return "locale=" + this.locale + " text=" + this.text;
67
- }
68
- // OPCUA Part 6 $ 5.2.2.14 : localizedText have a special encoding
69
- encode(stream) {
70
- // tslint:disable:no-bitwise
71
- const encodingMask = getLocalizeText_EncodingByte(this);
72
- (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
73
- if ((encodingMask & 0x01) === 0x01) {
74
- (0, node_opcua_basic_types_1.encodeString)(this.locale, stream);
75
- }
76
- if ((encodingMask & 0x02) === 0x02) {
77
- (0, node_opcua_basic_types_1.encodeString)(this.text, stream);
78
- }
79
- }
80
- decodeDebug(stream, options) {
81
- let cursorBefore;
82
- const tracer = options.tracer;
83
- tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
84
- cursorBefore = stream.length;
85
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
86
- tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
87
- cursorBefore = stream.length;
88
- if ((encodingMask & 0x01) === 0x01) {
89
- this.locale = (0, node_opcua_basic_types_1.decodeString)(stream);
90
- tracer.trace("member", "locale", this.locale, cursorBefore, stream.length, "locale");
91
- cursorBefore = stream.length;
92
- }
93
- else {
94
- this.locale = null;
95
- }
96
- if ((encodingMask & 0x02) === 0x02) {
97
- this.text = (0, node_opcua_basic_types_1.decodeString)(stream);
98
- tracer.trace("member", "text", this.text, cursorBefore, stream.length, "text");
99
- // cursor_before = stream.length;
100
- }
101
- else {
102
- this.text = null;
103
- }
104
- tracer.trace("end", options.name, stream.length, stream.length);
105
- }
106
- decode(stream) {
107
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
108
- if ((encodingMask & 0x01) === 0x01) {
109
- this.locale = (0, node_opcua_basic_types_1.decodeString)(stream);
110
- }
111
- else {
112
- this.locale = null;
113
- }
114
- if ((encodingMask & 0x02) === 0x02) {
115
- this.text = (0, node_opcua_basic_types_1.decodeString)(stream);
116
- }
117
- else {
118
- this.text = null;
119
- }
120
- }
121
- }
122
- exports.LocalizedText = LocalizedText;
123
- LocalizedText.possibleFields = ["locale", "text"];
124
- // not an extension object registerClassDefinition("LocalizedText", LocalizedText);
125
- (0, node_opcua_factory_1.registerSpecialVariantEncoder)(LocalizedText);
126
- function getLocalizeText_EncodingByte(localizedText) {
127
- let encodingMask = 0;
128
- if (localizedText.locale) {
129
- encodingMask |= 0x01;
130
- }
131
- if (localizedText.text) {
132
- encodingMask |= 0x02;
133
- }
134
- return encodingMask;
135
- }
136
- const emptyLocalizedText = new LocalizedText({});
137
- function encodeLocalizedText(value, stream) {
138
- if (value) {
139
- value.encode(stream);
140
- }
141
- else {
142
- emptyLocalizedText.encode(stream);
143
- }
144
- }
145
- exports.encodeLocalizedText = encodeLocalizedText;
146
- function decodeLocalizedText(stream, value) {
147
- value = value || new LocalizedText(null);
148
- value.decode(stream);
149
- return value;
150
- }
151
- exports.decodeLocalizedText = decodeLocalizedText;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeLocalizedText = exports.encodeLocalizedText = exports.LocalizedText = exports.coerceLocalizedText = void 0;
4
+ const node_opcua_basic_types_1 = require("node-opcua-basic-types");
5
+ const node_opcua_factory_1 = require("node-opcua-factory");
6
+ function coerceLocalizedText(value) {
7
+ if (value === undefined || value === null) {
8
+ return null;
9
+ }
10
+ if (value instanceof LocalizedText) {
11
+ return value;
12
+ }
13
+ return new LocalizedText(value);
14
+ }
15
+ exports.coerceLocalizedText = coerceLocalizedText;
16
+ // --------------------------------------------------------------------------------------------
17
+ // see Part 3 - $8.5 page 63
18
+ const schemaLocalizedText = (0, node_opcua_factory_1.buildStructuredType)({
19
+ name: "LocalizedText",
20
+ baseType: "BaseUAObject",
21
+ fields: [
22
+ {
23
+ name: "locale",
24
+ fieldType: "LocaleId",
25
+ defaultValue: null
26
+ },
27
+ {
28
+ name: "text",
29
+ fieldType: "UAString",
30
+ defaultValue: null
31
+ }
32
+ ]
33
+ });
34
+ schemaLocalizedText.coerce = coerceLocalizedText;
35
+ class LocalizedText extends node_opcua_factory_1.BaseUAObject {
36
+ constructor(options) {
37
+ super();
38
+ if (options === null) {
39
+ this.locale = null;
40
+ this.text = null;
41
+ return;
42
+ }
43
+ if (typeof options === "string") {
44
+ this.locale = null;
45
+ this.text = options;
46
+ return;
47
+ }
48
+ /* istanbul ignore next */
49
+ if (node_opcua_factory_1.parameters.debugSchemaHelper) {
50
+ const schema = schemaLocalizedText;
51
+ (0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
52
+ }
53
+ this.locale = (options === null || options === void 0 ? void 0 : options.locale) || null;
54
+ this.text = (options === null || options === void 0 ? void 0 : options.text) || null;
55
+ }
56
+ static get schema() {
57
+ return schemaLocalizedText;
58
+ }
59
+ get schema() {
60
+ return schemaLocalizedText;
61
+ }
62
+ static coerce(value) {
63
+ return coerceLocalizedText(value);
64
+ }
65
+ toString() {
66
+ return "locale=" + this.locale + " text=" + this.text;
67
+ }
68
+ // OPCUA Part 6 $ 5.2.2.14 : localizedText have a special encoding
69
+ encode(stream) {
70
+ // tslint:disable:no-bitwise
71
+ const encodingMask = getLocalizeText_EncodingByte(this);
72
+ (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
73
+ if ((encodingMask & 0x01) === 0x01) {
74
+ (0, node_opcua_basic_types_1.encodeString)(this.locale, stream);
75
+ }
76
+ if ((encodingMask & 0x02) === 0x02) {
77
+ (0, node_opcua_basic_types_1.encodeString)(this.text, stream);
78
+ }
79
+ }
80
+ decodeDebug(stream, options) {
81
+ let cursorBefore;
82
+ const tracer = options.tracer;
83
+ tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
84
+ cursorBefore = stream.length;
85
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
86
+ tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
87
+ cursorBefore = stream.length;
88
+ if ((encodingMask & 0x01) === 0x01) {
89
+ this.locale = (0, node_opcua_basic_types_1.decodeString)(stream);
90
+ tracer.trace("member", "locale", this.locale, cursorBefore, stream.length, "locale");
91
+ cursorBefore = stream.length;
92
+ }
93
+ else {
94
+ this.locale = null;
95
+ }
96
+ if ((encodingMask & 0x02) === 0x02) {
97
+ this.text = (0, node_opcua_basic_types_1.decodeString)(stream);
98
+ tracer.trace("member", "text", this.text, cursorBefore, stream.length, "text");
99
+ // cursor_before = stream.length;
100
+ }
101
+ else {
102
+ this.text = null;
103
+ }
104
+ tracer.trace("end", options.name, stream.length, stream.length);
105
+ }
106
+ decode(stream) {
107
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
108
+ if ((encodingMask & 0x01) === 0x01) {
109
+ this.locale = (0, node_opcua_basic_types_1.decodeString)(stream);
110
+ }
111
+ else {
112
+ this.locale = null;
113
+ }
114
+ if ((encodingMask & 0x02) === 0x02) {
115
+ this.text = (0, node_opcua_basic_types_1.decodeString)(stream);
116
+ }
117
+ else {
118
+ this.text = null;
119
+ }
120
+ }
121
+ }
122
+ exports.LocalizedText = LocalizedText;
123
+ LocalizedText.possibleFields = ["locale", "text"];
124
+ // not an extension object registerClassDefinition("LocalizedText", LocalizedText);
125
+ (0, node_opcua_factory_1.registerSpecialVariantEncoder)(LocalizedText);
126
+ function getLocalizeText_EncodingByte(localizedText) {
127
+ let encodingMask = 0;
128
+ if (localizedText.locale) {
129
+ encodingMask |= 0x01;
130
+ }
131
+ if (localizedText.text) {
132
+ encodingMask |= 0x02;
133
+ }
134
+ return encodingMask;
135
+ }
136
+ const emptyLocalizedText = new LocalizedText({});
137
+ function encodeLocalizedText(value, stream) {
138
+ if (value) {
139
+ value.encode(stream);
140
+ }
141
+ else {
142
+ emptyLocalizedText.encode(stream);
143
+ }
144
+ }
145
+ exports.encodeLocalizedText = encodeLocalizedText;
146
+ function decodeLocalizedText(stream, value) {
147
+ value = value || new LocalizedText(null);
148
+ value.decode(stream);
149
+ return value;
150
+ }
151
+ exports.decodeLocalizedText = decodeLocalizedText;
152
152
  //# sourceMappingURL=localized_text.js.map
@@ -1,14 +1,14 @@
1
- /**
2
- * @module node-opcua-data-model
3
- */
4
- export declare enum NodeClassMask {
5
- Object = 1,
6
- Variable = 2,
7
- Method = 4,
8
- ObjectType = 8,
9
- VariableType = 16,
10
- ReferenceType = 32,
11
- DataType = 64,
12
- View = 128
13
- }
14
- export declare function makeNodeClassMask(str: string): NodeClassMask;
1
+ /**
2
+ * @module node-opcua-data-model
3
+ */
4
+ export declare enum NodeClassMask {
5
+ Object = 1,
6
+ Variable = 2,
7
+ Method = 4,
8
+ ObjectType = 8,
9
+ VariableType = 16,
10
+ ReferenceType = 32,
11
+ DataType = 64,
12
+ View = 128
13
+ }
14
+ export declare function makeNodeClassMask(str: string): NodeClassMask;
@@ -1,45 +1,45 @@
1
- "use strict";
2
- /**
3
- * @module node-opcua-data-model
4
- */
5
- // tslint:disable:no-bitwise
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeNodeClassMask = exports.NodeClassMask = void 0;
8
- // Specifies the NodeClasses of the TargetNodes. Only TargetNodes with the
9
- // selected NodeClasses are returned. The NodeClasses are assigned the
10
- // following bits:
11
- // If set to zero, then all NodeClasses are returned.
12
- // @example
13
- // var mask = NodeClassMask.get("Object | ObjectType");
14
- // mask.value.should.eql(1 + (1<<3));
15
- var NodeClassMask;
16
- (function (NodeClassMask) {
17
- NodeClassMask[NodeClassMask["Object"] = 1] = "Object";
18
- NodeClassMask[NodeClassMask["Variable"] = 2] = "Variable";
19
- NodeClassMask[NodeClassMask["Method"] = 4] = "Method";
20
- NodeClassMask[NodeClassMask["ObjectType"] = 8] = "ObjectType";
21
- NodeClassMask[NodeClassMask["VariableType"] = 16] = "VariableType";
22
- NodeClassMask[NodeClassMask["ReferenceType"] = 32] = "ReferenceType";
23
- NodeClassMask[NodeClassMask["DataType"] = 64] = "DataType";
24
- NodeClassMask[NodeClassMask["View"] = 128] = "View";
25
- })(NodeClassMask = exports.NodeClassMask || (exports.NodeClassMask = {}));
26
- function makeFlagFromString(type, str) {
27
- const flags = str.split(" | ");
28
- let result = 0;
29
- for (const flag of flags) {
30
- result |= type[flag];
31
- }
32
- return result;
33
- }
34
- // @example
35
- // makeNodeClassMask("Method | Object").should.eql(5);
36
- function makeNodeClassMask(str) {
37
- const classMask = makeFlagFromString(NodeClassMask, str);
38
- /* istanbul ignore next */
39
- if (!classMask) {
40
- throw new Error(" cannot find class mask for " + str);
41
- }
42
- return classMask;
43
- }
44
- exports.makeNodeClassMask = makeNodeClassMask;
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-data-model
4
+ */
5
+ // tslint:disable:no-bitwise
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.makeNodeClassMask = exports.NodeClassMask = void 0;
8
+ // Specifies the NodeClasses of the TargetNodes. Only TargetNodes with the
9
+ // selected NodeClasses are returned. The NodeClasses are assigned the
10
+ // following bits:
11
+ // If set to zero, then all NodeClasses are returned.
12
+ // @example
13
+ // var mask = NodeClassMask.get("Object | ObjectType");
14
+ // mask.value.should.eql(1 + (1<<3));
15
+ var NodeClassMask;
16
+ (function (NodeClassMask) {
17
+ NodeClassMask[NodeClassMask["Object"] = 1] = "Object";
18
+ NodeClassMask[NodeClassMask["Variable"] = 2] = "Variable";
19
+ NodeClassMask[NodeClassMask["Method"] = 4] = "Method";
20
+ NodeClassMask[NodeClassMask["ObjectType"] = 8] = "ObjectType";
21
+ NodeClassMask[NodeClassMask["VariableType"] = 16] = "VariableType";
22
+ NodeClassMask[NodeClassMask["ReferenceType"] = 32] = "ReferenceType";
23
+ NodeClassMask[NodeClassMask["DataType"] = 64] = "DataType";
24
+ NodeClassMask[NodeClassMask["View"] = 128] = "View";
25
+ })(NodeClassMask = exports.NodeClassMask || (exports.NodeClassMask = {}));
26
+ function makeFlagFromString(type, str) {
27
+ const flags = str.split(" | ");
28
+ let result = 0;
29
+ for (const flag of flags) {
30
+ result |= type[flag];
31
+ }
32
+ return result;
33
+ }
34
+ // @example
35
+ // makeNodeClassMask("Method | Object").should.eql(5);
36
+ function makeNodeClassMask(str) {
37
+ const classMask = makeFlagFromString(NodeClassMask, str);
38
+ /* istanbul ignore next */
39
+ if (!classMask) {
40
+ throw new Error(" cannot find class mask for " + str);
41
+ }
42
+ return classMask;
43
+ }
44
+ exports.makeNodeClassMask = makeNodeClassMask;
45
45
  //# sourceMappingURL=node_class_mask.js.map
@@ -1,16 +1,16 @@
1
- export declare enum NodeClass {
2
- Unspecified = 0,
3
- Object = 1,
4
- Variable = 2,
5
- Method = 4,
6
- ObjectType = 8,
7
- VariableType = 16,
8
- ReferenceType = 32,
9
- DataType = 64,
10
- View = 128
11
- }
12
- export declare const schemaEnumNodeClass: {
13
- name: string;
14
- documentation: string;
15
- enumValues: typeof NodeClass;
16
- };
1
+ export declare enum NodeClass {
2
+ Unspecified = 0,
3
+ Object = 1,
4
+ Variable = 2,
5
+ Method = 4,
6
+ ObjectType = 8,
7
+ VariableType = 16,
8
+ ReferenceType = 32,
9
+ DataType = 64,
10
+ View = 128
11
+ }
12
+ export declare const schemaEnumNodeClass: {
13
+ name: string;
14
+ documentation: string;
15
+ enumValues: typeof NodeClass;
16
+ };