node-opcua-address-space 2.181.1 → 2.182.2

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 (121) hide show
  1. package/api/helpers/ensure_secure_access.ts +53 -2
  2. package/api/index.ts +30 -1
  3. package/api/loader/generateAddressSpaceRaw.ts +44 -139
  4. package/api/loader/load_nodeset2.ts +5 -0
  5. package/api/loader/narrow_instance_datatypes.ts +264 -0
  6. package/api/loader/nodeset_builtin_formats.ts +143 -0
  7. package/api/loader/nodeset_format.ts +153 -0
  8. package/api/loader/nodeset_image.ts +37 -4
  9. package/api/loader/nodeset_image_codec.ts +153 -34
  10. package/api/loader/nodeset_record.ts +26 -2
  11. package/api/loader/nodeset_record_applier.ts +54 -3
  12. package/api/loader/nodeset_records_to_xml.ts +620 -0
  13. package/api/loader/nodeset_source.ts +185 -26
  14. package/api/loader/nodeset_to_image.ts +16 -5
  15. package/api/loader/nodeset_xml_header.ts +119 -0
  16. package/api/loader/nodeset_xml_primitives.ts +209 -0
  17. package/api/loader/nodeset_xml_producer.ts +61 -2
  18. package/api/loader/parsers/variant_parser.ts +9 -0
  19. package/bin/nodeset_equivalence.js +750 -0
  20. package/bin/nodeset_tool_common.js +72 -0
  21. package/bin/opcua-nodeset-image.js +93 -103
  22. package/bin/opcua-nodeset-live.js +139 -0
  23. package/dist/api/helpers/ensure_secure_access.d.ts +20 -0
  24. package/dist/api/helpers/ensure_secure_access.js +39 -0
  25. package/dist/api/helpers/ensure_secure_access.js.map +1 -1
  26. package/dist/api/index.d.ts +7 -2
  27. package/dist/api/index.js +21 -1
  28. package/dist/api/index.js.map +1 -1
  29. package/dist/api/loader/generateAddressSpaceRaw.d.ts +1 -7
  30. package/dist/api/loader/generateAddressSpaceRaw.js +32 -125
  31. package/dist/api/loader/generateAddressSpaceRaw.js.map +1 -1
  32. package/dist/api/loader/load_nodeset2.js +4 -0
  33. package/dist/api/loader/load_nodeset2.js.map +1 -1
  34. package/dist/api/loader/narrow_instance_datatypes.d.ts +30 -0
  35. package/dist/api/loader/narrow_instance_datatypes.js +217 -0
  36. package/dist/api/loader/narrow_instance_datatypes.js.map +1 -0
  37. package/dist/api/loader/nodeset_builtin_formats.d.ts +27 -0
  38. package/dist/api/loader/nodeset_builtin_formats.js +133 -0
  39. package/dist/api/loader/nodeset_builtin_formats.js.map +1 -0
  40. package/dist/api/loader/nodeset_format.d.ts +123 -0
  41. package/dist/api/loader/nodeset_format.js +63 -0
  42. package/dist/api/loader/nodeset_format.js.map +1 -0
  43. package/dist/api/loader/nodeset_image.d.ts +17 -1
  44. package/dist/api/loader/nodeset_image.js +32 -4
  45. package/dist/api/loader/nodeset_image.js.map +1 -1
  46. package/dist/api/loader/nodeset_image_codec.d.ts +4 -0
  47. package/dist/api/loader/nodeset_image_codec.js +142 -53
  48. package/dist/api/loader/nodeset_image_codec.js.map +1 -1
  49. package/dist/api/loader/nodeset_record.d.ts +26 -2
  50. package/dist/api/loader/nodeset_record.js +11 -2
  51. package/dist/api/loader/nodeset_record.js.map +1 -1
  52. package/dist/api/loader/nodeset_record_applier.js +52 -3
  53. package/dist/api/loader/nodeset_record_applier.js.map +1 -1
  54. package/dist/api/loader/nodeset_records_to_xml.d.ts +16 -0
  55. package/dist/api/loader/nodeset_records_to_xml.js +536 -0
  56. package/dist/api/loader/nodeset_records_to_xml.js.map +1 -0
  57. package/dist/api/loader/nodeset_source.d.ts +68 -7
  58. package/dist/api/loader/nodeset_source.js +157 -20
  59. package/dist/api/loader/nodeset_source.js.map +1 -1
  60. package/dist/api/loader/nodeset_to_image.d.ts +4 -4
  61. package/dist/api/loader/nodeset_to_image.js +14 -4
  62. package/dist/api/loader/nodeset_to_image.js.map +1 -1
  63. package/dist/api/loader/nodeset_xml_header.d.ts +22 -0
  64. package/dist/api/loader/nodeset_xml_header.js +113 -0
  65. package/dist/api/loader/nodeset_xml_header.js.map +1 -0
  66. package/dist/api/loader/nodeset_xml_primitives.d.ts +37 -0
  67. package/dist/api/loader/nodeset_xml_primitives.js +196 -0
  68. package/dist/api/loader/nodeset_xml_primitives.js.map +1 -0
  69. package/dist/api/loader/nodeset_xml_producer.js +56 -1
  70. package/dist/api/loader/nodeset_xml_producer.js.map +1 -1
  71. package/dist/api/loader/parsers/variant_parser.js +7 -0
  72. package/dist/api/loader/parsers/variant_parser.js.map +1 -1
  73. package/dist/impl/_instantiate_helpers.js +1 -0
  74. package/dist/impl/_instantiate_helpers.js.map +1 -1
  75. package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js +4 -0
  76. package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  77. package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +14 -0
  78. package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  79. package/dist/impl/base_node_impl.d.ts +9 -0
  80. package/dist/impl/base_node_impl.js +11 -0
  81. package/dist/impl/base_node_impl.js.map +1 -1
  82. package/dist/impl/base_node_private.js +67 -97
  83. package/dist/impl/base_node_private.js.map +1 -1
  84. package/dist/impl/nodeset_tools/construct_namespace_dependency.js +5 -1
  85. package/dist/impl/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  86. package/dist/impl/nodeset_tools/nodeset_to_records.js +61 -15
  87. package/dist/impl/nodeset_tools/nodeset_to_records.js.map +1 -1
  88. package/dist/impl/nodeset_tools/nodeset_to_xml.d.ts +1 -8
  89. package/dist/impl/nodeset_tools/nodeset_to_xml.js +174 -190
  90. package/dist/impl/nodeset_tools/nodeset_to_xml.js.map +1 -1
  91. package/dist/impl/ua_data_type_impl.d.ts +21 -0
  92. package/dist/impl/ua_data_type_impl.js +27 -2
  93. package/dist/impl/ua_data_type_impl.js.map +1 -1
  94. package/dist/impl/ua_object_type_impl.d.ts +9 -0
  95. package/dist/impl/ua_object_type_impl.js +12 -1
  96. package/dist/impl/ua_object_type_impl.js.map +1 -1
  97. package/dist/impl/ua_variable_impl.js +27 -10
  98. package/dist/impl/ua_variable_impl.js.map +1 -1
  99. package/dist/impl/ua_variable_impl_ext_obj.js +19 -2
  100. package/dist/impl/ua_variable_impl_ext_obj.js.map +1 -1
  101. package/dist/impl/ua_variable_type_impl.d.ts +8 -1
  102. package/dist/impl/ua_variable_type_impl.js +39 -2
  103. package/dist/impl/ua_variable_type_impl.js.map +1 -1
  104. package/dist/tsconfig_base.tsbuildinfo +1 -1
  105. package/distNodeJS/generate_address_space.js +4 -0
  106. package/distNodeJS/generate_address_space.js.map +1 -1
  107. package/impl/_instantiate_helpers.ts +3 -0
  108. package/impl/alarms_and_conditions/ua_alarm_condition_impl.ts +10 -0
  109. package/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +17 -0
  110. package/impl/base_node_impl.ts +15 -0
  111. package/impl/base_node_private.ts +97 -146
  112. package/impl/nodeset_tools/construct_namespace_dependency.ts +5 -1
  113. package/impl/nodeset_tools/nodeset_to_records.ts +66 -16
  114. package/impl/nodeset_tools/nodeset_to_xml.ts +127 -160
  115. package/impl/ua_data_type_impl.ts +40 -2
  116. package/impl/ua_object_type_impl.ts +16 -3
  117. package/impl/ua_variable_impl.ts +27 -10
  118. package/impl/ua_variable_impl_ext_obj.ts +20 -2
  119. package/impl/ua_variable_type_impl.ts +48 -2
  120. package/package.json +29 -27
  121. package/source_nodejs/generate_address_space.ts +7 -1
@@ -6,6 +6,7 @@
6
6
  * may hold the XML, or a precompiled image of it (see `nodeset_image.ts`), told apart by the
7
7
  * first bytes.
8
8
  */
9
+ import { type NodesetDocument } from "./nodeset_format.js";
9
10
  /** one piece of a NodeSet2 document: text, or UTF-8 bytes */
10
11
  export type NodesetChunk = string | Uint8Array;
11
12
  /** a document delivered in pieces: an async iterable (a Node.js Readable, a web ReadableStream, an async generator) or a plain iterable */
@@ -48,8 +49,22 @@ export interface NamedNodesetSource {
48
49
  */
49
50
  imageKey?: string;
50
51
  }
51
- /** what a source turned out to hold */
52
- export type NodesetSourceKind = "xml" | "image";
52
+ /**
53
+ * how a document arrived, before anything has been decided about what it says: as text, or as
54
+ * bytes that are not text until something inflates or decodes them.
55
+ *
56
+ * This is not the format. It is the one thing that can be settled synchronously on a first
57
+ * chunk, and it decides only whether the reader decodes as it goes or keeps the bytes intact.
58
+ */
59
+ export type NodesetContainer = "text" | "bytes";
60
+ /**
61
+ * the name of the format a source turned out to be written in.
62
+ *
63
+ * This used to be a closed pair, XML or image. It is now whatever is registered, so that a
64
+ * format the loader has never heard of can identify itself; the two built-ins go on reading the
65
+ * documents they always did.
66
+ */
67
+ export type NodesetSourceKind = string;
53
68
  export interface NodesetReaderOptions {
54
69
  /** keep the bytes read so that {@link NodesetReader.digest} can be computed */
55
70
  hash?: boolean;
@@ -76,7 +91,9 @@ export declare class NodesetReader {
76
91
  private bodyStarted;
77
92
  private decoder;
78
93
  private atStart;
79
- private kind;
94
+ private container;
95
+ private formatName;
96
+ private allBytesValue;
80
97
  private readonly hashed;
81
98
  private bytesRead;
82
99
  private readonly encoder;
@@ -86,16 +103,42 @@ export declare class NodesetReader {
86
103
  whole: boolean, options?: NodesetReaderOptions);
87
104
  /** the key a caller named for this source, if any */
88
105
  get imageKey(): string | undefined;
89
- /** XML or image: decided on the first bytes */
106
+ /**
107
+ * how this document arrived: as text, or as bytes. Settled on the first chunk, and never a
108
+ * statement about which format the document is written in.
109
+ */
110
+ probeContainer(): Promise<NodesetContainer>;
111
+ /**
112
+ * which registered format claims this document.
113
+ *
114
+ * Two stages, because one is not enough. The container is decided synchronously on the first
115
+ * chunk; the format is decided from the head of the document *after* it has been inflated,
116
+ * which is the only way to tell one gzipped serialisation from another. The loader used to
117
+ * skip that second stage and take any gzip stream for one of its own images, so a foreign
118
+ * compressed nodeset was not rejected but misread.
119
+ */
90
120
  probe(): Promise<NodesetSourceKind>;
121
+ /**
122
+ * the beginning of the document as a sniffer sees it: inflated when it arrived gzipped, so
123
+ * that no format has to know how a document happened to be stored.
124
+ *
125
+ * A byte document is read whole. That is not a concession: every format that arrives as bytes
126
+ * is line-delimited or an archive, and reads whole anyway, and the bytes are kept so the read
127
+ * is not repeated. Text streams on, and is sniffed on as much of the head as has arrived.
128
+ */
129
+ private sniffHead;
130
+ private headTextLength;
91
131
  /**
92
132
  * read from the start until `complete(text)` holds or the source ends; what was read stays
93
133
  * in the reader and is delivered again, first, by {@link chunks}
94
134
  */
95
135
  readHead(complete: (text: string) => boolean): Promise<string>;
96
- /** the whole document as text chunks, from the start; usable once */
97
- chunks(): AsyncGenerator<string>;
98
- /** the whole document as raw bytes, from the start, for a source holding an image; usable once */
136
+ /**
137
+ * the whole document from the start, usable once: text chunks for a document that arrived as
138
+ * text, byte chunks for one that did not. A caller that wants text either way decodes.
139
+ */
140
+ chunks(): AsyncGenerator<NodesetChunk>;
141
+ /** the whole document as raw bytes, from the start, for a source holding bytes; usable once */
99
142
  bytes(): AsyncGenerator<Uint8Array>;
100
143
  /** the whole document as one byte array; reads the source to its end and keeps it */
101
144
  allBytes(): Promise<Uint8Array>;
@@ -106,6 +149,13 @@ export declare class NodesetReader {
106
149
  * whole, once the body has been read to its end otherwise
107
150
  */
108
151
  digest(): Promise<string>;
152
+ /**
153
+ * the digest if it has already been computed, without computing one.
154
+ *
155
+ * A format may want to record what it read from, but must never be the thing that forces a
156
+ * stream to be drained to find out.
157
+ */
158
+ digestIfKnown(): string | undefined;
109
159
  private startBody;
110
160
  /** the next non-empty chunk, kept in the head until the body starts; undefined at the end */
111
161
  private pull;
@@ -122,3 +172,14 @@ export declare function openNodesetSource(source: NodesetSource, index: number,
122
172
  hash?: boolean;
123
173
  whole?: boolean;
124
174
  }): NodesetReader;
175
+ /**
176
+ * a {@link NodesetDocument} over a reader: what a format is handed.
177
+ *
178
+ * The point of the facade is that a format never touches the reader. It asks for the document in
179
+ * the shape it wants -- lines, text, bytes, a stream -- and the reader answers each of those once
180
+ * and shares the answer, so a format that wants both the lines and the raw bytes pays for one
181
+ * read and one inflate rather than two.
182
+ *
183
+ * @internal
184
+ */
185
+ export declare function nodesetDocumentOf(reader: NodesetReader): NodesetDocument;
@@ -11,8 +11,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.NodesetReader = void 0;
12
12
  exports.sha256Hex = sha256Hex;
13
13
  exports.openNodesetSource = openNodesetSource;
14
+ exports.nodesetDocumentOf = nodesetDocumentOf;
15
+ const nodeset_format_js_1 = require("./nodeset_format.js");
14
16
  const nodeset_image_js_1 = require("./nodeset_image.js");
15
17
  const BOM = 0xfeff;
18
+ /** how many characters of a document a format sniffer is shown */
19
+ const HEAD_CHARS = 4096;
16
20
  /**
17
21
  * reads a source as text, once: the head first, as far as a predicate needs it, then the whole
18
22
  * document with the head included, so that a stream that cannot be reopened is never read twice
@@ -33,7 +37,9 @@ class NodesetReader {
33
37
  bodyStarted = false;
34
38
  decoder = null;
35
39
  atStart = true;
36
- kind;
40
+ container;
41
+ formatName;
42
+ allBytesValue;
37
43
  hashed;
38
44
  bytesRead = 0;
39
45
  encoder = new TextEncoder();
@@ -51,12 +57,65 @@ class NodesetReader {
51
57
  get imageKey() {
52
58
  return this.options.imageKey;
53
59
  }
54
- /** XML or image: decided on the first bytes */
55
- async probe() {
56
- if (this.kind === undefined) {
60
+ /**
61
+ * how this document arrived: as text, or as bytes. Settled on the first chunk, and never a
62
+ * statement about which format the document is written in.
63
+ */
64
+ async probeContainer() {
65
+ if (this.container === undefined) {
57
66
  await this.pull();
58
67
  }
59
- return this.kind ?? "xml";
68
+ return this.container ?? "text";
69
+ }
70
+ /**
71
+ * which registered format claims this document.
72
+ *
73
+ * Two stages, because one is not enough. The container is decided synchronously on the first
74
+ * chunk; the format is decided from the head of the document *after* it has been inflated,
75
+ * which is the only way to tell one gzipped serialisation from another. The loader used to
76
+ * skip that second stage and take any gzip stream for one of its own images, so a foreign
77
+ * compressed nodeset was not rejected but misread.
78
+ */
79
+ async probe() {
80
+ if (this.formatName !== undefined) {
81
+ return this.formatName;
82
+ }
83
+ const head = await this.sniffHead();
84
+ const format = (0, nodeset_format_js_1.findNodesetFormat)(head);
85
+ if (!format) {
86
+ throw new Error(`nodeset source ${this.name}: no registered format recognises this document`);
87
+ }
88
+ this.formatName = format.name;
89
+ return this.formatName;
90
+ }
91
+ /**
92
+ * the beginning of the document as a sniffer sees it: inflated when it arrived gzipped, so
93
+ * that no format has to know how a document happened to be stored.
94
+ *
95
+ * A byte document is read whole. That is not a concession: every format that arrives as bytes
96
+ * is line-delimited or an archive, and reads whole anyway, and the bytes are kept so the read
97
+ * is not repeated. Text streams on, and is sniffed on as much of the head as has arrived.
98
+ */
99
+ async sniffHead() {
100
+ if ((await this.probeContainer()) === "bytes") {
101
+ const all = await this.allBytes();
102
+ const gzip = (0, nodeset_image_js_1.isGzip)(all);
103
+ const text = gzip
104
+ ? ((await (0, nodeset_image_js_1.inflatedImageLines)(all))[0] ?? "")
105
+ : new TextDecoder("utf-8").decode(all.subarray(0, HEAD_CHARS));
106
+ return makeHead(this.name, text, gzip);
107
+ }
108
+ while (this.headTextLength() < HEAD_CHARS) {
109
+ if ((await this.pull()) === undefined)
110
+ break;
111
+ }
112
+ return makeHead(this.name, this.head.join("").slice(0, HEAD_CHARS), false);
113
+ }
114
+ headTextLength() {
115
+ let total = 0;
116
+ for (const chunk of this.head)
117
+ total += chunk.length;
118
+ return total;
60
119
  }
61
120
  /**
62
121
  * read from the start until `complete(text)` holds or the source ends; what was read stays
@@ -66,8 +125,8 @@ class NodesetReader {
66
125
  if (this.bodyStarted) {
67
126
  throw new Error(`nodeset source ${this.name}: the head cannot be read once the body has been`);
68
127
  }
69
- if ((await this.probe()) !== "xml") {
70
- throw new Error(`nodeset source ${this.name}: not XML`);
128
+ if ((await this.probeContainer()) !== "text") {
129
+ throw new Error(`nodeset source ${this.name}: the head of a byte document is not text`);
71
130
  }
72
131
  let text = this.head.join("");
73
132
  while (!complete(text)) {
@@ -79,12 +138,13 @@ class NodesetReader {
79
138
  }
80
139
  return text;
81
140
  }
82
- /** the whole document as text chunks, from the start; usable once */
141
+ /**
142
+ * the whole document from the start, usable once: text chunks for a document that arrived as
143
+ * text, byte chunks for one that did not. A caller that wants text either way decodes.
144
+ */
83
145
  async *chunks() {
84
146
  this.startBody();
85
- if ((await this.probe()) !== "xml") {
86
- throw new Error(`nodeset source ${this.name}: not XML`);
87
- }
147
+ await this.probeContainer();
88
148
  const head = this.head;
89
149
  this.head = [];
90
150
  for (const chunk of head) {
@@ -98,11 +158,11 @@ class NodesetReader {
98
158
  yield chunk;
99
159
  }
100
160
  }
101
- /** the whole document as raw bytes, from the start, for a source holding an image; usable once */
161
+ /** the whole document as raw bytes, from the start, for a source holding bytes; usable once */
102
162
  async *bytes() {
103
163
  this.startBody();
104
- if ((await this.probe()) !== "image") {
105
- throw new Error(`nodeset source ${this.name}: not an image`);
164
+ if ((await this.probeContainer()) !== "bytes") {
165
+ throw new Error(`nodeset source ${this.name}: not a byte document`);
106
166
  }
107
167
  const head = this.head;
108
168
  this.head = [];
@@ -119,6 +179,9 @@ class NodesetReader {
119
179
  }
120
180
  /** the whole document as one byte array; reads the source to its end and keeps it */
121
181
  async allBytes() {
182
+ if (this.allBytesValue !== undefined) {
183
+ return this.allBytesValue;
184
+ }
122
185
  if (this.bodyStarted) {
123
186
  throw new Error(`nodeset source ${this.name}: a source is read once`);
124
187
  }
@@ -126,7 +189,10 @@ class NodesetReader {
126
189
  /* read to the end */
127
190
  }
128
191
  const parts = this.head.map((chunk) => (typeof chunk === "string" ? this.encoder.encode(chunk) : chunk));
129
- return concat(parts);
192
+ // kept, so that the sniff and the format that follows it share one array: the inflated
193
+ // lines are cached against the identity of these bytes, and a second concat would miss
194
+ this.allBytesValue = concat(parts);
195
+ return this.allBytesValue;
130
196
  }
131
197
  /** the bytes read so far; the whole document once it has been read */
132
198
  get length() {
@@ -156,6 +222,15 @@ class NodesetReader {
156
222
  this.digestValue = await sha256Hex(bytes);
157
223
  return this.digestValue;
158
224
  }
225
+ /**
226
+ * the digest if it has already been computed, without computing one.
227
+ *
228
+ * A format may want to record what it read from, but must never be the thing that forces a
229
+ * stream to be drained to find out.
230
+ */
231
+ digestIfKnown() {
232
+ return this.digestValue;
233
+ }
159
234
  startBody() {
160
235
  if (this.bodyStarted) {
161
236
  throw new Error(`nodeset source ${this.name}: a source is read once`);
@@ -177,8 +252,8 @@ class NodesetReader {
177
252
  const result = await this.iterator.next();
178
253
  if (result.done) {
179
254
  this.exhausted = true;
180
- if (this.kind === undefined) {
181
- this.kind = "xml";
255
+ if (this.container === undefined) {
256
+ this.container = "text";
182
257
  }
183
258
  const tail = this.decoder ? this.decoder.decode() : "";
184
259
  if (tail.length > 0) {
@@ -208,15 +283,16 @@ class NodesetReader {
208
283
  if (chunk.length === 0) {
209
284
  return undefined;
210
285
  }
211
- if (this.kind === undefined) {
212
- this.kind = typeof chunk !== "string" && (0, nodeset_image_js_1.isNodesetImage)(chunk) ? "image" : "xml";
286
+ if (this.container === undefined) {
287
+ // text unless the bytes say otherwise; a string chunk is text by construction
288
+ this.container = typeof chunk !== "string" && (0, nodeset_image_js_1.isNodesetImage)(chunk) ? "bytes" : "text";
213
289
  }
214
290
  const raw = typeof chunk === "string" ? this.encoder.encode(chunk) : chunk;
215
291
  this.bytesRead += raw.length;
216
292
  if (this.hashed) {
217
293
  this.hashed.push(raw);
218
294
  }
219
- if (this.kind === "image") {
295
+ if (this.container === "bytes") {
220
296
  const bytes = typeof chunk === "string" ? raw : chunk;
221
297
  if (!this.bodyStarted)
222
298
  this.head.push(bytes);
@@ -304,4 +380,65 @@ function openNodesetSource(source, index, options = {}) {
304
380
  };
305
381
  return new NodesetReader(name, open, whole, { hash: options.hash, imageKey });
306
382
  }
383
+ /** the head a sniffer is shown, with its first line split out for the line-delimited formats */
384
+ function makeHead(name, text, gzip) {
385
+ const newline = text.indexOf("\n");
386
+ const firstLine = newline < 0 ? text : text.slice(0, newline);
387
+ return { name, text, gzip, firstLine: firstLine.endsWith("\r") ? firstLine.slice(0, -1) : firstLine };
388
+ }
389
+ /**
390
+ * a {@link NodesetDocument} over a reader: what a format is handed.
391
+ *
392
+ * The point of the facade is that a format never touches the reader. It asks for the document in
393
+ * the shape it wants -- lines, text, bytes, a stream -- and the reader answers each of those once
394
+ * and shares the answer, so a format that wants both the lines and the raw bytes pays for one
395
+ * read and one inflate rather than two.
396
+ *
397
+ * @internal
398
+ */
399
+ function nodesetDocumentOf(reader) {
400
+ let inflatedBytes;
401
+ let textValue;
402
+ let linesValue;
403
+ const rawBytes = () => reader.allBytes();
404
+ const bytes = () => {
405
+ if (!inflatedBytes) {
406
+ inflatedBytes = (async () => {
407
+ const raw = await rawBytes();
408
+ if (!(0, nodeset_image_js_1.isGzip)(raw))
409
+ return raw;
410
+ // one inflate, shared with lines(): both go through the cache keyed on these bytes
411
+ return new TextEncoder().encode((await (0, nodeset_image_js_1.inflatedImageLines)(raw)).join("\n"));
412
+ })();
413
+ }
414
+ return inflatedBytes;
415
+ };
416
+ const lines = () => {
417
+ if (!linesValue) {
418
+ linesValue = (async () => {
419
+ const raw = await rawBytes();
420
+ if ((0, nodeset_image_js_1.isGzip)(raw))
421
+ return await (0, nodeset_image_js_1.inflatedImageLines)(raw);
422
+ return new TextDecoder("utf-8").decode(raw).split("\n");
423
+ })();
424
+ }
425
+ return linesValue;
426
+ };
427
+ const text = () => {
428
+ if (!textValue) {
429
+ textValue = (async () => (await lines()).join("\n"))();
430
+ }
431
+ return textValue;
432
+ };
433
+ return {
434
+ name: reader.name,
435
+ bytes,
436
+ text,
437
+ lines,
438
+ rawBytes,
439
+ chunks: () => reader.chunks(),
440
+ readHead: (complete) => reader.readHead(complete),
441
+ digest: () => reader.digestIfKnown()
442
+ };
443
+ }
307
444
  //# sourceMappingURL=nodeset_source.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeset_source.js","sourceRoot":"","sources":["../../../api/loader/nodeset_source.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAySH,8BAGC;AA0BD,8CAiCC;AArWD,yDAAoD;AAgDpD,MAAM,GAAG,GAAG,MAAM,CAAC;AA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QACT,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,GAAG,EAAE;QACd,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,SAAS,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC3D,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK;QACL,IAAI;QACJ,KAAK;QACL,QAAQ;QACR,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;QAC7B,QAAQ,EAAE,CAAC,QAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACzE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE;KACvC,CAAC;AACN,CAAC"}
@@ -1,13 +1,13 @@
1
- /**
2
- * @module node-opcua-address-space
3
- */
4
1
  import { type NodesetImageWriterOptions } from "./nodeset_image.js";
5
2
  import { type NodesetSource } from "./nodeset_source.js";
6
3
  export interface NodesetToImageOptions extends Pick<NodesetImageWriterOptions, "addressSpaceVersion" | "createdAt"> {
7
4
  }
8
5
  /**
9
- * the precompiled image of a NodeSet2 document, built from the source alone: converting a file
6
+ * the precompiled image of a nodeset document, built from the source alone: converting a file
10
7
  * needs neither its dependencies nor an address space. A source that already holds an image is
11
8
  * returned as it is, once read through to check it.
9
+ *
10
+ * Any registered format can be the input, not only NodeSet2 XML: an image is a cache of records,
11
+ * and records are what every format produces.
12
12
  */
13
13
  export declare function nodesetToImage(source: NodesetSource, options?: NodesetToImageOptions): Promise<Uint8Array>;
@@ -4,25 +4,35 @@ exports.nodesetToImage = nodesetToImage;
4
4
  /**
5
5
  * @module node-opcua-address-space
6
6
  */
7
+ const nodeset_builtin_formats_js_1 = require("./nodeset_builtin_formats.js");
8
+ const nodeset_format_js_1 = require("./nodeset_format.js");
7
9
  const nodeset_image_js_1 = require("./nodeset_image.js");
8
10
  const nodeset_source_js_1 = require("./nodeset_source.js");
9
- const nodeset_xml_producer_js_1 = require("./nodeset_xml_producer.js");
11
+ (0, nodeset_builtin_formats_js_1.registerBuiltinNodesetFormats)();
10
12
  /**
11
- * the precompiled image of a NodeSet2 document, built from the source alone: converting a file
13
+ * the precompiled image of a nodeset document, built from the source alone: converting a file
12
14
  * needs neither its dependencies nor an address space. A source that already holds an image is
13
15
  * returned as it is, once read through to check it.
16
+ *
17
+ * Any registered format can be the input, not only NodeSet2 XML: an image is a cache of records,
18
+ * and records are what every format produces.
14
19
  */
15
20
  async function nodesetToImage(source, options = {}) {
16
21
  const reader = (0, nodeset_source_js_1.openNodesetSource)(source, 0, { hash: true });
17
- if ((await reader.probe()) === "image") {
22
+ const formatName = await reader.probe();
23
+ if (formatName === nodeset_builtin_formats_js_1.NDJSON_IMAGE_FORMAT) {
18
24
  const bytes = await reader.allBytes();
19
25
  for await (const _record of (0, nodeset_image_js_1.imageNodesetRecords)(bytes)) {
20
26
  /* a corrupt image is refused here rather than at load time */
21
27
  }
22
28
  return bytes;
23
29
  }
30
+ const format = (0, nodeset_format_js_1.nodesetFormatByName)(formatName);
31
+ if (!format) {
32
+ throw new Error(`nodeset source ${reader.name}: its format is no longer registered`);
33
+ }
24
34
  const writer = new nodeset_image_js_1.NodesetImageWriter({ ...options });
25
- for await (const record of (0, nodeset_xml_producer_js_1.xmlNodesetRecords)(reader.chunks())) {
35
+ for await (const record of format.records((0, nodeset_source_js_1.nodesetDocumentOf)(reader))) {
26
36
  writer.apply(record);
27
37
  }
28
38
  return writer.finish(await reader.digest(), reader.length);
@@ -1 +1 @@
1
- {"version":3,"file":"nodeset_to_image.js","sourceRoot":"","sources":["../../../api/loader/nodeset_to_image.ts"],"names":[],"mappings":";;AAcA,wCAcC;AA5BD;;GAEG;AACH,yDAA6G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,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACxC,IAAI,UAAU,KAAK,gDAAmB,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,IAAA,sCAAmB,EAAC,KAAK,CAAC,EAAE,CAAC;YACrD,8DAA8D;QAClE,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,IAAI,sCAAsC,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,qCAAkB,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtD,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,IAAA,qCAAiB,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACnE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module node-opcua-address-space
3
+ *
4
+ * Reading the header of a NodeSet2 XML document: its `NamespaceUris` and its `Models`, and
5
+ * nothing else.
6
+ *
7
+ * This is the dependency pre-pass. Before any document is loaded the loader has to know what each
8
+ * one defines and what each one needs, so that it can sort them; it does that by reading every
9
+ * source no further than the end of its header, which on the standard nodeset is a few hundred
10
+ * bytes of a four megabyte file.
11
+ *
12
+ * It lives apart from the loader because the built-in XML format needs it too, and a format
13
+ * cannot import the loader that drives it.
14
+ */
15
+ import type { NodesetModelInfo } from "./nodeset_format.js";
16
+ type NodesetInfo = NodesetModelInfo;
17
+ /** the `NamespaceUris` and `Models` a NodeSet2 header declares */
18
+ export declare function parseDependencies(xmlData: string): Promise<NodesetInfo>;
19
+ export declare function headerComplete(text: string): boolean;
20
+ /** the `<UANodeSet ...>` opener up to the end of `</Models>` or `</NamespaceUris>`, whichever comes last */
21
+ export declare function sliceHeader(xmlData: string, name: string): string;
22
+ export {};
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-address-space
4
+ *
5
+ * Reading the header of a NodeSet2 XML document: its `NamespaceUris` and its `Models`, and
6
+ * nothing else.
7
+ *
8
+ * This is the dependency pre-pass. Before any document is loaded the loader has to know what each
9
+ * one defines and what each one needs, so that it can sort them; it does that by reading every
10
+ * source no further than the end of its header, which on the standard nodeset is a few hundred
11
+ * bytes of a four megabyte file.
12
+ *
13
+ * It lives apart from the loader because the built-in XML format needs it too, and a format
14
+ * cannot import the loader that drives it.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.parseDependencies = parseDependencies;
18
+ exports.headerComplete = headerComplete;
19
+ exports.sliceHeader = sliceHeader;
20
+ const node_opcua_date_time_1 = require("node-opcua-date-time");
21
+ const node_opcua_debug_1 = require("node-opcua-debug");
22
+ const node_opcua_xml2json_1 = require("node-opcua-xml2json");
23
+ const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("generateAddressSpaceRaw");
24
+ /** the `NamespaceUris` and `Models` a NodeSet2 header declares */
25
+ async function parseDependencies(xmlData) {
26
+ const namespaceUris = [];
27
+ const models = [];
28
+ let currentModel;
29
+ const state0 = {
30
+ parser: {
31
+ UANodeSet: {
32
+ parser: {
33
+ NamespaceUris: {
34
+ parser: {
35
+ Uri: {
36
+ finish() {
37
+ namespaceUris.push(this.text);
38
+ }
39
+ }
40
+ }
41
+ },
42
+ Models: {
43
+ parser: {
44
+ Model: {
45
+ init(_elementName, attrs) {
46
+ const modelUri = attrs.ModelUri;
47
+ const version = attrs.Version;
48
+ const publicationDate = new Date(Date.parse(attrs.PublicationDate));
49
+ currentModel = {
50
+ modelUri,
51
+ version,
52
+ publicationDate,
53
+ requiredModel: []
54
+ };
55
+ doDebug && console.log(`currentModel = ${JSON.stringify(currentModel)}`);
56
+ models.push(currentModel);
57
+ },
58
+ parser: {
59
+ RequiredModel: {
60
+ init(_elementName, attrs) {
61
+ const modelUri = attrs.ModelUri;
62
+ const version = attrs.Version;
63
+ const publicationDate = new Date(Date.parse(attrs.PublicationDate));
64
+ if (!currentModel) {
65
+ throw new Error("Internal Error");
66
+ }
67
+ currentModel.requiredModel.push({
68
+ modelUri,
69
+ version,
70
+ publicationDate
71
+ });
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ };
82
+ const parser = new node_opcua_xml2json_1.Xml2Json(state0);
83
+ parser.parseString(xmlData);
84
+ if (models.length === 0 && namespaceUris.length >= 1) {
85
+ models.push({
86
+ modelUri: namespaceUris[0],
87
+ version: "1",
88
+ publicationDate: (0, node_opcua_date_time_1.getMinOPCUADate)(),
89
+ requiredModel: []
90
+ });
91
+ }
92
+ return { models, namespaceUris: namespaceUris };
93
+ }
94
+ /**
95
+ * the header of a NodeSet2 file (`NamespaceUris`, `Models`) precedes the aliases and the nodes: the
96
+ * dependency pre-pass has read enough once both closers were seen, or once the body has begun
97
+ */
98
+ const BODY_START = /<(Aliases|Extensions|UAObject|UAVariable|UADataType|UAReferenceType|UAObjectType|UAVariableType|UAMethod|UAView)[\s/>]/;
99
+ function headerComplete(text) {
100
+ return (text.includes("</Models>") && text.includes("</NamespaceUris>")) || BODY_START.test(text);
101
+ }
102
+ /** the `<UANodeSet ...>` opener up to the end of `</Models>` or `</NamespaceUris>`, whichever comes last */
103
+ function sliceHeader(xmlData, name) {
104
+ const indexStart = xmlData.match(/<UANodeSet/m)?.index;
105
+ const i1 = (xmlData.match(/<\/Models>/m)?.index || 0) + "</Models>".length;
106
+ const i2 = (xmlData.match(/<\/NamespaceUris>/m)?.index || 0) + "</NamespaceUris>".length;
107
+ const indexEnd = Math.max(i1, i2);
108
+ if (indexStart === undefined) {
109
+ throw new Error(`nodeset source ${name}: no <UANodeSet> element found`);
110
+ }
111
+ return xmlData.substring(indexStart, indexEnd);
112
+ }
113
+ //# sourceMappingURL=nodeset_xml_header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeset_xml_header.js","sourceRoot":"","sources":["../../../api/loader/nodeset_xml_header.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAaH,8CAsEC;AAQD,wCAEC;AAGD,kCASC;AAvGD,+DAAuD;AACvD,uDAAkD;AAClD,6DAAuH;AAGvH,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,yBAAyB,CAAC,CAAC;AAK1D,kEAAkE;AAC3D,KAAK,UAAU,iBAAiB,CAAC,OAAe;IACnD,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,IAAI,YAA+B,CAAC;IACpC,MAAM,MAAM,GAAsB;QAC9B,MAAM,EAAE;YACJ,SAAS,EAAE;gBACP,MAAM,EAAE;oBACJ,aAAa,EAAE;wBACX,MAAM,EAAE;4BACJ,GAAG,EAA4C;gCAC3C,MAAM;oCACF,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gCAClC,CAAC;6BACJ;yBACJ;qBACJ;oBACD,MAAM,EAAE;wBACJ,MAAM,EAAE;4BACJ,KAAK,EAAE;gCACH,IAAI,CAAC,YAAoB,EAAE,KAAoB;oCAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;oCAChC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;oCAC9B,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC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