node-opcua-data-model 2.71.0 → 2.73.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.
Files changed (43) hide show
  1. package/dist/BrowseDirection.d.ts +18 -18
  2. package/dist/BrowseDirection.js +36 -36
  3. package/dist/_make_flag.d.ts +1 -1
  4. package/dist/_make_flag.js +25 -25
  5. package/dist/access_level.d.ts +24 -24
  6. package/dist/access_level.js +85 -86
  7. package/dist/access_level.js.map +1 -1
  8. package/dist/access_level_ex.d.ts +34 -34
  9. package/dist/access_level_ex.js +82 -92
  10. package/dist/access_level_ex.js.map +1 -1
  11. package/dist/access_restrictions.d.ts +9 -9
  12. package/dist/access_restrictions.js +36 -36
  13. package/dist/attributeIds.d.ts +1 -1
  14. package/dist/attributeIds.js +7 -7
  15. package/dist/data_encoding.d.ts +6 -6
  16. package/dist/data_encoding.js +21 -21
  17. package/dist/diagnostic_info.d.ts +69 -69
  18. package/dist/diagnostic_info.js +327 -327
  19. package/dist/index.d.ts +17 -17
  20. package/dist/index.js +33 -33
  21. package/dist/localized_text.d.ts +24 -24
  22. package/dist/localized_text.js +151 -151
  23. package/dist/localized_text.js.map +1 -1
  24. package/dist/node_class_mask.d.ts +14 -14
  25. package/dist/node_class_mask.js +44 -44
  26. package/dist/nodeclass.d.ts +16 -16
  27. package/dist/nodeclass.js +25 -25
  28. package/dist/permission_flag.d.ts +112 -112
  29. package/dist/permission_flag.js +162 -162
  30. package/dist/qualified_name.d.ts +45 -45
  31. package/dist/qualified_name.js +136 -136
  32. package/dist/qualified_name.js.map +1 -1
  33. package/dist/result_mask.d.ts +18 -18
  34. package/dist/result_mask.js +30 -30
  35. package/dist/time_zone.d.ts +3 -3
  36. package/dist/time_zone.js +18 -18
  37. package/dist/write_mask.d.ts +31 -31
  38. package/dist/write_mask.js +40 -40
  39. package/package.json +7 -7
  40. package/source/access_level.ts +9 -11
  41. package/source/access_level_ex.ts +0 -12
  42. package/source/localized_text.ts +1 -1
  43. package/source/qualified_name.ts +1 -1
@@ -1,328 +1,328 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeDiagnosticInfo = exports.encodeDiagnosticInfo = exports.DiagnosticInfo_EncodingByte = exports.filterDiagnosticServiceLevel = exports.filterDiagnosticOperationLevel = exports.filterDiagnosticInfoLevel = exports.RESPONSE_DIAGNOSTICS_MASK_ALL = exports.DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo = exports.schemaDiagnosticInfo = void 0;
4
- /**
5
- * @module node-opcua-data-model
6
- */
7
- const node_opcua_assert_1 = require("node-opcua-assert");
8
- const node_opcua_factory_1 = require("node-opcua-factory");
9
- const node_opcua_status_code_1 = require("node-opcua-status-code");
10
- const node_opcua_basic_types_1 = require("node-opcua-basic-types");
11
- const node_opcua_factory_2 = require("node-opcua-factory");
12
- // --------------------------------------------------------------------------------------------
13
- exports.schemaDiagnosticInfo = (0, node_opcua_factory_1.buildStructuredType)({
14
- name: "DiagnosticInfo",
15
- baseType: "BaseUAObject",
16
- fields: [
17
- {
18
- name: "namespaceUri",
19
- fieldType: "Int32",
20
- defaultValue: -1,
21
- documentation: "The symbolicId is defined within the context of a namespace."
22
- },
23
- {
24
- name: "symbolicId",
25
- fieldType: "Int32",
26
- defaultValue: -1,
27
- documentation: "The symbolicId shall be used to identify a vendor-specific error or condition"
28
- },
29
- {
30
- name: "locale",
31
- fieldType: "Int32",
32
- defaultValue: -1,
33
- documentation: "The locale part of the vendor-specific localized text describing the symbolic id."
34
- },
35
- { name: "localizedText", fieldType: "Int32", defaultValue: -1 },
36
- {
37
- name: "additionalInfo",
38
- fieldType: "String",
39
- defaultValue: null,
40
- documentation: "Vendor-specific diagnostic information."
41
- },
42
- {
43
- name: "innerStatusCode",
44
- fieldType: "StatusCode",
45
- defaultValue: node_opcua_status_code_1.StatusCodes.Good,
46
- documentation: "The StatusCode from the inner operation."
47
- },
48
- {
49
- name: "innerDiagnosticInfo",
50
- fieldType: "DiagnosticInfo",
51
- defaultValue: null,
52
- documentation: "The diagnostic info associated with the inner StatusCode."
53
- }
54
- ]
55
- });
56
- class DiagnosticInfo extends node_opcua_factory_1.BaseUAObject {
57
- /**
58
- *
59
- * @class DiagnosticInfo
60
- * @constructor
61
- * @extends BaseUAObject
62
- * @param options {Object}
63
- */
64
- constructor(options = {}) {
65
- super();
66
- const schema = exports.schemaDiagnosticInfo;
67
- /* istanbul ignore next */
68
- if (node_opcua_factory_1.parameters.debugSchemaHelper) {
69
- (0, node_opcua_factory_2.check_options_correctness_against_schema)(this, schema, options);
70
- }
71
- this.symbolicId = (0, node_opcua_factory_2.initialize_field)(schema.fields[0], options.symbolicId);
72
- this.namespaceURI = (0, node_opcua_factory_2.initialize_field)(schema.fields[1], options.namespaceURI);
73
- this.locale = (0, node_opcua_factory_2.initialize_field)(schema.fields[2], options.locale);
74
- this.localizedText = (0, node_opcua_factory_2.initialize_field)(schema.fields[3], options.localizedText);
75
- this.additionalInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[4], options.additionalInfo);
76
- this.innerStatusCode = (0, node_opcua_factory_2.initialize_field)(schema.fields[5], options.innerStatusCode);
77
- this.innerDiagnosticInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[6], options.innerDiagnosticInfo);
78
- }
79
- encode(stream) {
80
- encode_DiagnosticInfo(this, stream);
81
- }
82
- decode(stream) {
83
- decode_DiagnosticInfo(this, stream);
84
- }
85
- decodeDebug(stream, options) {
86
- decodeDebug_DiagnosticInfo(this, stream, options);
87
- }
88
- static filterForResponse(diagnostic, requestedDiagnostics, diagnosticInfoMask) {
89
- const options = {
90
- symbolicId: (requestedDiagnostics & diagnosticInfoMask.SymbolicId) ? diagnostic.symbolicId : undefined,
91
- localizedText: (requestedDiagnostics & diagnosticInfoMask.LocalizedText) ? diagnostic.localizedText : undefined,
92
- additionalInfo: (requestedDiagnostics & diagnosticInfoMask.AdditionalInfo) ? diagnostic.additionalInfo : undefined,
93
- innerStatusCode: (requestedDiagnostics & diagnosticInfoMask.InnerStatusCode) ? diagnostic.innerStatusCode : undefined,
94
- innerDiagnosticInfo: (requestedDiagnostics & diagnosticInfoMask.InnerDiagnostics) ? diagnostic.innerDiagnosticInfo : (diagnostic.innerDiagnosticInfo ? DiagnosticInfo.filterForResponse(diagnostic.innerDiagnosticInfo, requestedDiagnostics, diagnosticInfoMask) : undefined),
95
- };
96
- return new DiagnosticInfo(options);
97
- }
98
- }
99
- exports.DiagnosticInfo = DiagnosticInfo;
100
- DiagnosticInfo.schema = exports.schemaDiagnosticInfo;
101
- DiagnosticInfo.possibleFields = [
102
- "symbolicId",
103
- "namespaceURI",
104
- "locale",
105
- "localizedText",
106
- "additionalInfo",
107
- "innerStatusCode",
108
- "innerDiagnosticInfo"
109
- ];
110
- DiagnosticInfo.prototype.schema = DiagnosticInfo.schema;
111
- DiagnosticInfo.schema.fields[6].schema = DiagnosticInfo.schema;
112
- var DiagnosticInfo_ServiceLevelMask;
113
- (function (DiagnosticInfo_ServiceLevelMask) {
114
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["None"] = 0] = "None";
115
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["SymbolicId"] = 1] = "SymbolicId";
116
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["LocalizedText"] = 2] = "LocalizedText";
117
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["AdditionalInfo"] = 4] = "AdditionalInfo";
118
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerStatusCode"] = 8] = "InnerStatusCode";
119
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerDiagnostics"] = 16] = "InnerDiagnostics";
120
- })(DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo_ServiceLevelMask || (exports.DiagnosticInfo_ServiceLevelMask = {}));
121
- var DiagnosticInfo_OperationLevelMask;
122
- (function (DiagnosticInfo_OperationLevelMask) {
123
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["SymbolicId"] = 32] = "SymbolicId";
124
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["LocalizedText"] = 64] = "LocalizedText";
125
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["AdditionalInfo"] = 128] = "AdditionalInfo";
126
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerStatusCode"] = 256] = "InnerStatusCode";
127
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerDiagnostics"] = 512] = "InnerDiagnostics";
128
- })(DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_OperationLevelMask || (exports.DiagnosticInfo_OperationLevelMask = {}));
129
- exports.RESPONSE_DIAGNOSTICS_MASK_ALL = 0x3FF;
130
- function filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, diagnosticInfoMask) {
131
- if (!diagnostic) {
132
- return null;
133
- }
134
- return DiagnosticInfo.filterForResponse(diagnostic, returnDiagnostics, diagnosticInfoMask);
135
- }
136
- exports.filterDiagnosticInfoLevel = filterDiagnosticInfoLevel;
137
- function filterDiagnosticOperationLevel(returnDiagnostics, diagnostic) {
138
- return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_OperationLevelMask);
139
- }
140
- exports.filterDiagnosticOperationLevel = filterDiagnosticOperationLevel;
141
- function filterDiagnosticServiceLevel(returnDiagnostics, diagnostic) {
142
- return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_ServiceLevelMask);
143
- }
144
- exports.filterDiagnosticServiceLevel = filterDiagnosticServiceLevel;
145
- var DiagnosticInfo_EncodingByte;
146
- (function (DiagnosticInfo_EncodingByte) {
147
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["SymbolicId"] = 1] = "SymbolicId";
148
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["NamespaceURI"] = 2] = "NamespaceURI";
149
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["LocalizedText"] = 4] = "LocalizedText";
150
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["Locale"] = 8] = "Locale";
151
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["AdditionalInfo"] = 16] = "AdditionalInfo";
152
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerStatusCode"] = 32] = "InnerStatusCode";
153
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerDiagnosticInfo"] = 64] = "InnerDiagnosticInfo";
154
- })(DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte || (exports.DiagnosticInfo_EncodingByte = {}));
155
- // tslint:disable:no-bitwise
156
- function getDiagnosticInfoEncodingByte(diagnosticInfo) {
157
- (0, node_opcua_assert_1.assert)(diagnosticInfo);
158
- let encodingMask = 0;
159
- if (diagnosticInfo.symbolicId >= 0) {
160
- encodingMask |= DiagnosticInfo_EncodingByte.SymbolicId;
161
- }
162
- if (diagnosticInfo.namespaceURI >= 0) {
163
- encodingMask |= DiagnosticInfo_EncodingByte.NamespaceURI;
164
- }
165
- if (diagnosticInfo.localizedText >= 0) {
166
- encodingMask |= DiagnosticInfo_EncodingByte.LocalizedText;
167
- }
168
- if (diagnosticInfo.locale >= 0) {
169
- encodingMask |= DiagnosticInfo_EncodingByte.Locale;
170
- }
171
- if (diagnosticInfo.additionalInfo) {
172
- encodingMask |= DiagnosticInfo_EncodingByte.AdditionalInfo;
173
- }
174
- if (diagnosticInfo.innerStatusCode && diagnosticInfo.innerStatusCode !== node_opcua_status_code_1.StatusCodes.Good) {
175
- encodingMask |= DiagnosticInfo_EncodingByte.InnerStatusCode;
176
- }
177
- if (diagnosticInfo.innerDiagnosticInfo) {
178
- encodingMask |= DiagnosticInfo_EncodingByte.InnerDiagnosticInfo;
179
- }
180
- return encodingMask;
181
- }
182
- function encode_DiagnosticInfo(diagnosticInfo, stream) {
183
- const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo);
184
- // write encoding byte
185
- (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
186
- // write symbolic id
187
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
188
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.symbolicId, stream);
189
- }
190
- // write namespace uri
191
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
192
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.namespaceURI, stream);
193
- }
194
- // write locale
195
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
196
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.locale, stream);
197
- }
198
- // write localized text
199
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
200
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.localizedText, stream);
201
- }
202
- // write additional info
203
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
204
- (0, node_opcua_basic_types_1.encodeString)(diagnosticInfo.additionalInfo, stream);
205
- }
206
- // write inner status code
207
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
208
- (0, node_opcua_basic_types_1.encodeStatusCode)(diagnosticInfo.innerStatusCode, stream);
209
- }
210
- // write innerDiagnosticInfo
211
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
212
- (0, node_opcua_assert_1.assert)(diagnosticInfo.innerDiagnosticInfo !== null, "missing innerDiagnosticInfo");
213
- if (diagnosticInfo.innerDiagnosticInfo) {
214
- encode_DiagnosticInfo(diagnosticInfo.innerDiagnosticInfo, stream);
215
- }
216
- }
217
- }
218
- function decodeDebug_DiagnosticInfo(diagnosticInfo, stream, options) {
219
- const tracer = options.tracer;
220
- tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
221
- let cursorBefore = stream.length;
222
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
223
- tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
224
- tracer.encoding_byte(encodingMask, DiagnosticInfo_EncodingByte, cursorBefore, stream.length);
225
- cursorBefore = stream.length;
226
- // read symbolic id
227
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
228
- diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
229
- tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
230
- cursorBefore = stream.length;
231
- }
232
- // read namespace uri
233
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
234
- diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
235
- tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
236
- cursorBefore = stream.length;
237
- }
238
- // read locale
239
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
240
- diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
241
- tracer.trace("member", "locale", diagnosticInfo.locale, cursorBefore, stream.length, "Int32");
242
- cursorBefore = stream.length;
243
- }
244
- // read localized text
245
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
246
- diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
247
- tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursorBefore, stream.length, "Int32");
248
- cursorBefore = stream.length;
249
- }
250
- // read additional info
251
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
252
- diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
253
- tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursorBefore, stream.length, "String");
254
- cursorBefore = stream.length;
255
- }
256
- // read inner status code
257
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
258
- diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
259
- tracer.trace("member", "innerStatusCode", diagnosticInfo.innerStatusCode, cursorBefore, stream.length, "StatusCode");
260
- cursorBefore = stream.length;
261
- }
262
- // read inner status code
263
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
264
- diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
265
- if (diagnosticInfo.innerDiagnosticInfo) {
266
- diagnosticInfo.innerDiagnosticInfo.decodeDebug(stream, options);
267
- }
268
- tracer.trace("member", "innerDiagnosticInfo", diagnosticInfo.innerDiagnosticInfo, cursorBefore, stream.length, "DiagnosticInfo");
269
- }
270
- tracer.trace("end", options.name, stream.length, stream.length);
271
- }
272
- function decode_DiagnosticInfo(diagnosticInfo, stream) {
273
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
274
- // read symbolic id
275
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
276
- diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
277
- }
278
- // read namespace uri
279
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
280
- diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
281
- }
282
- // read locale
283
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
284
- diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
285
- }
286
- // read localized text
287
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
288
- diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
289
- }
290
- // read additional info
291
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
292
- diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
293
- }
294
- // read inner status code
295
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
296
- diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
297
- }
298
- // read inner status code
299
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
300
- diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
301
- if (diagnosticInfo.innerDiagnosticInfo) {
302
- diagnosticInfo.innerDiagnosticInfo.decode(stream);
303
- }
304
- }
305
- }
306
- const emptyDiagnosticInfo = new DiagnosticInfo({});
307
- function encodeDiagnosticInfo(value, stream) {
308
- if (value === null) {
309
- emptyDiagnosticInfo.encode(stream);
310
- }
311
- else {
312
- value.encode(stream);
313
- }
314
- }
315
- exports.encodeDiagnosticInfo = encodeDiagnosticInfo;
316
- function decodeDiagnosticInfo(stream, _value) {
317
- const value = _value || new DiagnosticInfo();
318
- value.decode(stream);
319
- return value;
320
- }
321
- exports.decodeDiagnosticInfo = decodeDiagnosticInfo;
322
- // Note:
323
- // the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
324
- // in the response header. Only the index of the corresponding string in the string table is encoded. An index
325
- // of −1 indicates that there is no value for the string.
326
- //
327
- (0, node_opcua_factory_1.registerSpecialVariantEncoder)(DiagnosticInfo);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeDiagnosticInfo = exports.encodeDiagnosticInfo = exports.DiagnosticInfo_EncodingByte = exports.filterDiagnosticServiceLevel = exports.filterDiagnosticOperationLevel = exports.filterDiagnosticInfoLevel = exports.RESPONSE_DIAGNOSTICS_MASK_ALL = exports.DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo = exports.schemaDiagnosticInfo = void 0;
4
+ /**
5
+ * @module node-opcua-data-model
6
+ */
7
+ const node_opcua_assert_1 = require("node-opcua-assert");
8
+ const node_opcua_factory_1 = require("node-opcua-factory");
9
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
10
+ const node_opcua_basic_types_1 = require("node-opcua-basic-types");
11
+ const node_opcua_factory_2 = require("node-opcua-factory");
12
+ // --------------------------------------------------------------------------------------------
13
+ exports.schemaDiagnosticInfo = (0, node_opcua_factory_1.buildStructuredType)({
14
+ name: "DiagnosticInfo",
15
+ baseType: "BaseUAObject",
16
+ fields: [
17
+ {
18
+ name: "namespaceUri",
19
+ fieldType: "Int32",
20
+ defaultValue: -1,
21
+ documentation: "The symbolicId is defined within the context of a namespace."
22
+ },
23
+ {
24
+ name: "symbolicId",
25
+ fieldType: "Int32",
26
+ defaultValue: -1,
27
+ documentation: "The symbolicId shall be used to identify a vendor-specific error or condition"
28
+ },
29
+ {
30
+ name: "locale",
31
+ fieldType: "Int32",
32
+ defaultValue: -1,
33
+ documentation: "The locale part of the vendor-specific localized text describing the symbolic id."
34
+ },
35
+ { name: "localizedText", fieldType: "Int32", defaultValue: -1 },
36
+ {
37
+ name: "additionalInfo",
38
+ fieldType: "String",
39
+ defaultValue: null,
40
+ documentation: "Vendor-specific diagnostic information."
41
+ },
42
+ {
43
+ name: "innerStatusCode",
44
+ fieldType: "StatusCode",
45
+ defaultValue: node_opcua_status_code_1.StatusCodes.Good,
46
+ documentation: "The StatusCode from the inner operation."
47
+ },
48
+ {
49
+ name: "innerDiagnosticInfo",
50
+ fieldType: "DiagnosticInfo",
51
+ defaultValue: null,
52
+ documentation: "The diagnostic info associated with the inner StatusCode."
53
+ }
54
+ ]
55
+ });
56
+ class DiagnosticInfo extends node_opcua_factory_1.BaseUAObject {
57
+ /**
58
+ *
59
+ * @class DiagnosticInfo
60
+ * @constructor
61
+ * @extends BaseUAObject
62
+ * @param options {Object}
63
+ */
64
+ constructor(options = {}) {
65
+ super();
66
+ const schema = exports.schemaDiagnosticInfo;
67
+ /* istanbul ignore next */
68
+ if (node_opcua_factory_1.parameters.debugSchemaHelper) {
69
+ (0, node_opcua_factory_2.check_options_correctness_against_schema)(this, schema, options);
70
+ }
71
+ this.symbolicId = (0, node_opcua_factory_2.initialize_field)(schema.fields[0], options.symbolicId);
72
+ this.namespaceURI = (0, node_opcua_factory_2.initialize_field)(schema.fields[1], options.namespaceURI);
73
+ this.locale = (0, node_opcua_factory_2.initialize_field)(schema.fields[2], options.locale);
74
+ this.localizedText = (0, node_opcua_factory_2.initialize_field)(schema.fields[3], options.localizedText);
75
+ this.additionalInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[4], options.additionalInfo);
76
+ this.innerStatusCode = (0, node_opcua_factory_2.initialize_field)(schema.fields[5], options.innerStatusCode);
77
+ this.innerDiagnosticInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[6], options.innerDiagnosticInfo);
78
+ }
79
+ encode(stream) {
80
+ encode_DiagnosticInfo(this, stream);
81
+ }
82
+ decode(stream) {
83
+ decode_DiagnosticInfo(this, stream);
84
+ }
85
+ decodeDebug(stream, options) {
86
+ decodeDebug_DiagnosticInfo(this, stream, options);
87
+ }
88
+ static filterForResponse(diagnostic, requestedDiagnostics, diagnosticInfoMask) {
89
+ const options = {
90
+ symbolicId: (requestedDiagnostics & diagnosticInfoMask.SymbolicId) ? diagnostic.symbolicId : undefined,
91
+ localizedText: (requestedDiagnostics & diagnosticInfoMask.LocalizedText) ? diagnostic.localizedText : undefined,
92
+ additionalInfo: (requestedDiagnostics & diagnosticInfoMask.AdditionalInfo) ? diagnostic.additionalInfo : undefined,
93
+ innerStatusCode: (requestedDiagnostics & diagnosticInfoMask.InnerStatusCode) ? diagnostic.innerStatusCode : undefined,
94
+ innerDiagnosticInfo: (requestedDiagnostics & diagnosticInfoMask.InnerDiagnostics) ? diagnostic.innerDiagnosticInfo : (diagnostic.innerDiagnosticInfo ? DiagnosticInfo.filterForResponse(diagnostic.innerDiagnosticInfo, requestedDiagnostics, diagnosticInfoMask) : undefined),
95
+ };
96
+ return new DiagnosticInfo(options);
97
+ }
98
+ }
99
+ exports.DiagnosticInfo = DiagnosticInfo;
100
+ DiagnosticInfo.schema = exports.schemaDiagnosticInfo;
101
+ DiagnosticInfo.possibleFields = [
102
+ "symbolicId",
103
+ "namespaceURI",
104
+ "locale",
105
+ "localizedText",
106
+ "additionalInfo",
107
+ "innerStatusCode",
108
+ "innerDiagnosticInfo"
109
+ ];
110
+ DiagnosticInfo.prototype.schema = DiagnosticInfo.schema;
111
+ DiagnosticInfo.schema.fields[6].schema = DiagnosticInfo.schema;
112
+ var DiagnosticInfo_ServiceLevelMask;
113
+ (function (DiagnosticInfo_ServiceLevelMask) {
114
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["None"] = 0] = "None";
115
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["SymbolicId"] = 1] = "SymbolicId";
116
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["LocalizedText"] = 2] = "LocalizedText";
117
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["AdditionalInfo"] = 4] = "AdditionalInfo";
118
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerStatusCode"] = 8] = "InnerStatusCode";
119
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerDiagnostics"] = 16] = "InnerDiagnostics";
120
+ })(DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo_ServiceLevelMask || (exports.DiagnosticInfo_ServiceLevelMask = {}));
121
+ var DiagnosticInfo_OperationLevelMask;
122
+ (function (DiagnosticInfo_OperationLevelMask) {
123
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["SymbolicId"] = 32] = "SymbolicId";
124
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["LocalizedText"] = 64] = "LocalizedText";
125
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["AdditionalInfo"] = 128] = "AdditionalInfo";
126
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerStatusCode"] = 256] = "InnerStatusCode";
127
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerDiagnostics"] = 512] = "InnerDiagnostics";
128
+ })(DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_OperationLevelMask || (exports.DiagnosticInfo_OperationLevelMask = {}));
129
+ exports.RESPONSE_DIAGNOSTICS_MASK_ALL = 0x3FF;
130
+ function filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, diagnosticInfoMask) {
131
+ if (!diagnostic) {
132
+ return null;
133
+ }
134
+ return DiagnosticInfo.filterForResponse(diagnostic, returnDiagnostics, diagnosticInfoMask);
135
+ }
136
+ exports.filterDiagnosticInfoLevel = filterDiagnosticInfoLevel;
137
+ function filterDiagnosticOperationLevel(returnDiagnostics, diagnostic) {
138
+ return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_OperationLevelMask);
139
+ }
140
+ exports.filterDiagnosticOperationLevel = filterDiagnosticOperationLevel;
141
+ function filterDiagnosticServiceLevel(returnDiagnostics, diagnostic) {
142
+ return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_ServiceLevelMask);
143
+ }
144
+ exports.filterDiagnosticServiceLevel = filterDiagnosticServiceLevel;
145
+ var DiagnosticInfo_EncodingByte;
146
+ (function (DiagnosticInfo_EncodingByte) {
147
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["SymbolicId"] = 1] = "SymbolicId";
148
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["NamespaceURI"] = 2] = "NamespaceURI";
149
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["LocalizedText"] = 4] = "LocalizedText";
150
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["Locale"] = 8] = "Locale";
151
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["AdditionalInfo"] = 16] = "AdditionalInfo";
152
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerStatusCode"] = 32] = "InnerStatusCode";
153
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerDiagnosticInfo"] = 64] = "InnerDiagnosticInfo";
154
+ })(DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte || (exports.DiagnosticInfo_EncodingByte = {}));
155
+ // tslint:disable:no-bitwise
156
+ function getDiagnosticInfoEncodingByte(diagnosticInfo) {
157
+ (0, node_opcua_assert_1.assert)(diagnosticInfo);
158
+ let encodingMask = 0;
159
+ if (diagnosticInfo.symbolicId >= 0) {
160
+ encodingMask |= DiagnosticInfo_EncodingByte.SymbolicId;
161
+ }
162
+ if (diagnosticInfo.namespaceURI >= 0) {
163
+ encodingMask |= DiagnosticInfo_EncodingByte.NamespaceURI;
164
+ }
165
+ if (diagnosticInfo.localizedText >= 0) {
166
+ encodingMask |= DiagnosticInfo_EncodingByte.LocalizedText;
167
+ }
168
+ if (diagnosticInfo.locale >= 0) {
169
+ encodingMask |= DiagnosticInfo_EncodingByte.Locale;
170
+ }
171
+ if (diagnosticInfo.additionalInfo) {
172
+ encodingMask |= DiagnosticInfo_EncodingByte.AdditionalInfo;
173
+ }
174
+ if (diagnosticInfo.innerStatusCode && diagnosticInfo.innerStatusCode !== node_opcua_status_code_1.StatusCodes.Good) {
175
+ encodingMask |= DiagnosticInfo_EncodingByte.InnerStatusCode;
176
+ }
177
+ if (diagnosticInfo.innerDiagnosticInfo) {
178
+ encodingMask |= DiagnosticInfo_EncodingByte.InnerDiagnosticInfo;
179
+ }
180
+ return encodingMask;
181
+ }
182
+ function encode_DiagnosticInfo(diagnosticInfo, stream) {
183
+ const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo);
184
+ // write encoding byte
185
+ (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
186
+ // write symbolic id
187
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
188
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.symbolicId, stream);
189
+ }
190
+ // write namespace uri
191
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
192
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.namespaceURI, stream);
193
+ }
194
+ // write locale
195
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
196
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.locale, stream);
197
+ }
198
+ // write localized text
199
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
200
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.localizedText, stream);
201
+ }
202
+ // write additional info
203
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
204
+ (0, node_opcua_basic_types_1.encodeString)(diagnosticInfo.additionalInfo, stream);
205
+ }
206
+ // write inner status code
207
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
208
+ (0, node_opcua_basic_types_1.encodeStatusCode)(diagnosticInfo.innerStatusCode, stream);
209
+ }
210
+ // write innerDiagnosticInfo
211
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
212
+ (0, node_opcua_assert_1.assert)(diagnosticInfo.innerDiagnosticInfo !== null, "missing innerDiagnosticInfo");
213
+ if (diagnosticInfo.innerDiagnosticInfo) {
214
+ encode_DiagnosticInfo(diagnosticInfo.innerDiagnosticInfo, stream);
215
+ }
216
+ }
217
+ }
218
+ function decodeDebug_DiagnosticInfo(diagnosticInfo, stream, options) {
219
+ const tracer = options.tracer;
220
+ tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
221
+ let cursorBefore = stream.length;
222
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
223
+ tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
224
+ tracer.encoding_byte(encodingMask, DiagnosticInfo_EncodingByte, cursorBefore, stream.length);
225
+ cursorBefore = stream.length;
226
+ // read symbolic id
227
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
228
+ diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
229
+ tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
230
+ cursorBefore = stream.length;
231
+ }
232
+ // read namespace uri
233
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
234
+ diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
235
+ tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
236
+ cursorBefore = stream.length;
237
+ }
238
+ // read locale
239
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
240
+ diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
241
+ tracer.trace("member", "locale", diagnosticInfo.locale, cursorBefore, stream.length, "Int32");
242
+ cursorBefore = stream.length;
243
+ }
244
+ // read localized text
245
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
246
+ diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
247
+ tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursorBefore, stream.length, "Int32");
248
+ cursorBefore = stream.length;
249
+ }
250
+ // read additional info
251
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
252
+ diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
253
+ tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursorBefore, stream.length, "String");
254
+ cursorBefore = stream.length;
255
+ }
256
+ // read inner status code
257
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
258
+ diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
259
+ tracer.trace("member", "innerStatusCode", diagnosticInfo.innerStatusCode, cursorBefore, stream.length, "StatusCode");
260
+ cursorBefore = stream.length;
261
+ }
262
+ // read inner status code
263
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
264
+ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
265
+ if (diagnosticInfo.innerDiagnosticInfo) {
266
+ diagnosticInfo.innerDiagnosticInfo.decodeDebug(stream, options);
267
+ }
268
+ tracer.trace("member", "innerDiagnosticInfo", diagnosticInfo.innerDiagnosticInfo, cursorBefore, stream.length, "DiagnosticInfo");
269
+ }
270
+ tracer.trace("end", options.name, stream.length, stream.length);
271
+ }
272
+ function decode_DiagnosticInfo(diagnosticInfo, stream) {
273
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
274
+ // read symbolic id
275
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
276
+ diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
277
+ }
278
+ // read namespace uri
279
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
280
+ diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
281
+ }
282
+ // read locale
283
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
284
+ diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
285
+ }
286
+ // read localized text
287
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
288
+ diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
289
+ }
290
+ // read additional info
291
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
292
+ diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
293
+ }
294
+ // read inner status code
295
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
296
+ diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
297
+ }
298
+ // read inner status code
299
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
300
+ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
301
+ if (diagnosticInfo.innerDiagnosticInfo) {
302
+ diagnosticInfo.innerDiagnosticInfo.decode(stream);
303
+ }
304
+ }
305
+ }
306
+ const emptyDiagnosticInfo = new DiagnosticInfo({});
307
+ function encodeDiagnosticInfo(value, stream) {
308
+ if (value === null) {
309
+ emptyDiagnosticInfo.encode(stream);
310
+ }
311
+ else {
312
+ value.encode(stream);
313
+ }
314
+ }
315
+ exports.encodeDiagnosticInfo = encodeDiagnosticInfo;
316
+ function decodeDiagnosticInfo(stream, _value) {
317
+ const value = _value || new DiagnosticInfo();
318
+ value.decode(stream);
319
+ return value;
320
+ }
321
+ exports.decodeDiagnosticInfo = decodeDiagnosticInfo;
322
+ // Note:
323
+ // the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
324
+ // in the response header. Only the index of the corresponding string in the string table is encoded. An index
325
+ // of −1 indicates that there is no value for the string.
326
+ //
327
+ (0, node_opcua_factory_1.registerSpecialVariantEncoder)(DiagnosticInfo);
328
328
  //# sourceMappingURL=diagnostic_info.js.map