jspurefix 3.4.0 → 4.0.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.
Files changed (243) hide show
  1. package/appveyor.yml +1 -1
  2. package/dist/buffer/ascii/ascii-encoder.d.ts +2 -2
  3. package/dist/buffer/ascii/ascii-encoder.js +1 -1
  4. package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
  5. package/dist/buffer/ascii/ascii-parser-state.d.ts +3 -2
  6. package/dist/buffer/ascii/ascii-parser-state.js +1 -2
  7. package/dist/buffer/ascii/ascii-parser-state.js.map +1 -1
  8. package/dist/buffer/ascii/ascii-parser.d.ts +1 -1
  9. package/dist/buffer/ascii/ascii-parser.js +5 -4
  10. package/dist/buffer/ascii/ascii-parser.js.map +1 -1
  11. package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
  12. package/dist/buffer/ascii/ascii-view.d.ts +4 -3
  13. package/dist/buffer/ascii/ascii-view.js +8 -5
  14. package/dist/buffer/ascii/ascii-view.js.map +1 -1
  15. package/dist/buffer/encode-proxy.js +1 -1
  16. package/dist/buffer/encode-proxy.js.map +1 -1
  17. package/dist/buffer/fixml/fixml-encoder.d.ts +2 -2
  18. package/dist/buffer/fixml/fixml-encoder.js +1 -1
  19. package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
  20. package/dist/buffer/fixml/fixml-parser.js +2 -2
  21. package/dist/buffer/fixml/fixml-parser.js.map +1 -1
  22. package/dist/buffer/fixml/fixml-view.d.ts +3 -2
  23. package/dist/buffer/fixml/fixml-view.js +5 -4
  24. package/dist/buffer/fixml/fixml-view.js.map +1 -1
  25. package/dist/buffer/msg-encoder.d.ts +2 -2
  26. package/dist/buffer/msg-encoder.js.map +1 -1
  27. package/dist/buffer/msg-view.d.ts +8 -6
  28. package/dist/buffer/msg-view.js +10 -8
  29. package/dist/buffer/msg-view.js.map +1 -1
  30. package/dist/buffer/segment/segment-description.d.ts +3 -3
  31. package/dist/buffer/segment/segment-description.js.map +1 -1
  32. package/dist/buffer/tag/tags.d.ts +2 -5
  33. package/dist/buffer/tag/tags.js +4 -5
  34. package/dist/buffer/tag/tags.js.map +1 -1
  35. package/dist/collections/collection.d.ts +0 -1
  36. package/dist/collections/collection.js.map +1 -1
  37. package/dist/collections/index.d.ts +0 -1
  38. package/dist/collections/index.js +0 -17
  39. package/dist/collections/index.js.map +1 -1
  40. package/dist/config/js-fix-config.d.ts +2 -1
  41. package/dist/config/js-fix-config.js +3 -3
  42. package/dist/config/js-fix-config.js.map +1 -1
  43. package/dist/dictionary/compiler/compiler-type.d.ts +3 -3
  44. package/dist/dictionary/compiler/compiler-type.js.map +1 -1
  45. package/dist/dictionary/compiler/enum-compiler.js +2 -2
  46. package/dist/dictionary/compiler/enum-compiler.js.map +1 -1
  47. package/dist/dictionary/compiler/msg-compiler.d.ts +1 -2
  48. package/dist/dictionary/compiler/msg-compiler.js +6 -7
  49. package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
  50. package/dist/dictionary/contained/contained-component-field.d.ts +1 -1
  51. package/dist/dictionary/contained/contained-component-field.js.map +1 -1
  52. package/dist/dictionary/contained/contained-field-set.d.ts +9 -20
  53. package/dist/dictionary/contained/contained-field-set.js +16 -149
  54. package/dist/dictionary/contained/contained-field-set.js.map +1 -1
  55. package/dist/dictionary/contained/contained-group-field.d.ts +1 -1
  56. package/dist/dictionary/contained/contained-group-field.js.map +1 -1
  57. package/dist/dictionary/contained/contained-set-builder.d.ts +15 -0
  58. package/dist/dictionary/contained/contained-set-builder.js +142 -0
  59. package/dist/dictionary/contained/contained-set-builder.js.map +1 -0
  60. package/dist/dictionary/contained/contained-set.d.ts +32 -0
  61. package/dist/{types/FIX.5.0SP2/quickfix/xm_lnon_fix.js → dictionary/contained/contained-set.js} +1 -1
  62. package/dist/dictionary/contained/contained-set.js.map +1 -0
  63. package/dist/dictionary/contained/contained-simple-field.d.ts +1 -1
  64. package/dist/dictionary/contained/contained-simple-field.js.map +1 -1
  65. package/dist/dictionary/contained/index.d.ts +4 -1
  66. package/dist/dictionary/contained/index.js +4 -1
  67. package/dist/dictionary/contained/index.js.map +1 -1
  68. package/dist/dictionary/definition/category-simple-set.d.ts +1 -2
  69. package/dist/dictionary/definition/category-simple-set.js +1 -2
  70. package/dist/dictionary/definition/category-simple-set.js.map +1 -1
  71. package/dist/dictionary/definition/component-field-definition.d.ts +1 -1
  72. package/dist/dictionary/definition/component-field-definition.js +2 -2
  73. package/dist/dictionary/definition/component-field-definition.js.map +1 -1
  74. package/dist/dictionary/definition/fix-definitions.d.ts +8 -9
  75. package/dist/dictionary/definition/fix-definitions.js +22 -20
  76. package/dist/dictionary/definition/fix-definitions.js.map +1 -1
  77. package/dist/dictionary/definition/group-field-definition.d.ts +1 -1
  78. package/dist/dictionary/definition/group-field-definition.js +2 -2
  79. package/dist/dictionary/definition/group-field-definition.js.map +1 -1
  80. package/dist/dictionary/definition/message-definition.d.ts +1 -1
  81. package/dist/dictionary/definition/message-definition.js +2 -2
  82. package/dist/dictionary/definition/message-definition.js.map +1 -1
  83. package/dist/dictionary/definition/simple-field-definition.d.ts +2 -3
  84. package/dist/dictionary/definition/simple-field-definition.js +6 -7
  85. package/dist/dictionary/definition/simple-field-definition.js.map +1 -1
  86. package/dist/dictionary/parser/fix-repository/repository.js +20 -20
  87. package/dist/dictionary/parser/fix-repository/repository.js.map +1 -1
  88. package/dist/dictionary/parser/fixml/components-parser.js +18 -16
  89. package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
  90. package/dist/dictionary/parser/fixml/fields-parser.js +2 -3
  91. package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
  92. package/dist/dictionary/parser/fixml/include-graph.js +8 -9
  93. package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
  94. package/dist/dictionary/parser/quickfix/field-definition-parser.js.map +1 -1
  95. package/dist/dictionary/parser/quickfix/message-parser.js +2 -1
  96. package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
  97. package/dist/dictionary/parser/quickfix/node-parser.js +3 -2
  98. package/dist/dictionary/parser/quickfix/node-parser.js.map +1 -1
  99. package/dist/dictionary/parser/quickfix/parse-context.d.ts +3 -3
  100. package/dist/dictionary/parser/quickfix/parse-context.js.map +1 -1
  101. package/dist/dictionary/parser/quickfix/parse-progress.d.ts +1 -2
  102. package/dist/dictionary/parser/quickfix/parse-progress.js +2 -3
  103. package/dist/dictionary/parser/quickfix/parse-progress.js.map +1 -1
  104. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-builder.js +4 -5
  105. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-builder.js.map +1 -1
  106. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +6 -6
  107. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
  108. package/dist/dictionary/parser/quickfix/quick-fix-xml-formatter.d.ts +1 -1
  109. package/dist/dictionary/parser/quickfix/quick-fix-xml-formatter.js.map +1 -1
  110. package/dist/dictionary/set-reduce.d.ts +2 -2
  111. package/dist/dictionary/set-reduce.js.map +1 -1
  112. package/dist/index.d.ts +0 -1
  113. package/dist/index.js +0 -1
  114. package/dist/index.js.map +1 -1
  115. package/dist/jsfix-cmd.js +4 -5
  116. package/dist/jsfix-cmd.js.map +1 -1
  117. package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +7 -8
  118. package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
  119. package/dist/sample/tcp/trade-capture/trade-capture-client.js +3 -4
  120. package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
  121. package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -1
  122. package/dist/store/fix-msg-ascii-store-resend.d.ts +4 -3
  123. package/dist/store/fix-msg-ascii-store-resend.js +21 -5
  124. package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
  125. package/dist/store/fix-msg-memory-store.js +3 -4
  126. package/dist/store/fix-msg-memory-store.js.map +1 -1
  127. package/dist/store/fix-msg-store-record.js.map +1 -1
  128. package/dist/test/ascii/ascii-encoder.test.js.map +1 -1
  129. package/dist/test/ascii/ascii-store-replay.test.js +14 -1
  130. package/dist/test/ascii/ascii-store-replay.test.js.map +1 -1
  131. package/dist/test/ascii/fix-log-replay.test.js.map +1 -1
  132. package/dist/test/ascii/fix-repo-dict.test.js.map +1 -1
  133. package/dist/test/ascii/qf-50sp0-dict.test.js +7 -7
  134. package/dist/test/ascii/qf-50sp0-dict.test.js.map +1 -1
  135. package/dist/test/ascii/qf-50sp2-dict.test.js +5 -2
  136. package/dist/test/ascii/qf-50sp2-dict.test.js.map +1 -1
  137. package/dist/test/ascii/session.test.js +64 -15
  138. package/dist/test/ascii/session.test.js.map +1 -1
  139. package/dist/test/env/encoder-test.d.ts +3 -3
  140. package/dist/test/env/encoder-test.js.map +1 -1
  141. package/dist/test/env/set-constraint-helper.d.ts +4 -4
  142. package/dist/test/env/set-constraint-helper.js.map +1 -1
  143. package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
  144. package/dist/transport/ascii/ascii-session.js +5 -2
  145. package/dist/transport/ascii/ascii-session.js.map +1 -1
  146. package/dist/transport/fixml/fixml-session.js.map +1 -1
  147. package/dist/transport/http/http-acceptor.js +3 -4
  148. package/dist/transport/http/http-acceptor.js.map +1 -1
  149. package/dist/transport/http/http-json-sample-adapter.js +3 -4
  150. package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
  151. package/dist/transport/session/dynamic-session-manager.d.ts +8 -0
  152. package/dist/transport/session/dynamic-session-manager.js +15 -0
  153. package/dist/transport/session/dynamic-session-manager.js.map +1 -0
  154. package/dist/transport/session/session-description.d.ts +9 -7
  155. package/dist/transport/session/session-description.js.map +1 -1
  156. package/dist/util/json-helper.d.ts +2 -2
  157. package/dist/util/json-helper.js.map +1 -1
  158. package/dist/util/message-generator.js +1 -1
  159. package/dist/util/message-generator.js.map +1 -1
  160. package/package.json +21 -21
  161. package/src/buffer/ascii/ascii-encoder.ts +7 -7
  162. package/src/buffer/ascii/ascii-parser-state.ts +4 -4
  163. package/src/buffer/ascii/ascii-parser.ts +6 -5
  164. package/src/buffer/ascii/ascii-segment-parser.ts +2 -2
  165. package/src/buffer/ascii/ascii-view.ts +9 -7
  166. package/src/buffer/encode-proxy.ts +9 -9
  167. package/src/buffer/fixml/fixml-encoder.ts +14 -10
  168. package/src/buffer/fixml/fixml-parser.ts +5 -5
  169. package/src/buffer/fixml/fixml-view.ts +5 -5
  170. package/src/buffer/msg-encoder.ts +3 -3
  171. package/src/buffer/msg-view.ts +18 -18
  172. package/src/buffer/segment/segment-description.ts +2 -2
  173. package/src/buffer/tag/tags.ts +4 -6
  174. package/src/collections/collection.ts +0 -1
  175. package/src/collections/index.ts +1 -1
  176. package/src/config/js-fix-config.ts +3 -2
  177. package/src/dictionary/compiler/compiler-type.ts +8 -2
  178. package/src/dictionary/compiler/enum-compiler.ts +2 -2
  179. package/src/dictionary/compiler/msg-compiler.ts +11 -12
  180. package/src/dictionary/contained/contained-component-field.ts +1 -1
  181. package/src/dictionary/contained/contained-field-set.ts +21 -176
  182. package/src/dictionary/contained/contained-group-field.ts +1 -1
  183. package/src/dictionary/contained/contained-set-builder.ts +164 -0
  184. package/src/dictionary/contained/contained-set.ts +83 -0
  185. package/src/dictionary/contained/contained-simple-field.ts +1 -1
  186. package/src/dictionary/contained/index.ts +4 -1
  187. package/src/dictionary/definition/category-simple-set.ts +1 -2
  188. package/src/dictionary/definition/component-field-definition.ts +1 -1
  189. package/src/dictionary/definition/fix-definitions.ts +28 -26
  190. package/src/dictionary/definition/group-field-definition.ts +1 -1
  191. package/src/dictionary/definition/message-definition.ts +6 -6
  192. package/src/dictionary/definition/simple-field-definition.ts +9 -10
  193. package/src/dictionary/parser/fix-repository/repository.ts +47 -40
  194. package/src/dictionary/parser/fixml/components-parser.ts +41 -38
  195. package/src/dictionary/parser/fixml/fields-parser.ts +3 -4
  196. package/src/dictionary/parser/fixml/include-graph.ts +13 -14
  197. package/src/dictionary/parser/quickfix/field-definition-parser.ts +5 -5
  198. package/src/dictionary/parser/quickfix/message-parser.ts +7 -5
  199. package/src/dictionary/parser/quickfix/node-parser.ts +13 -6
  200. package/src/dictionary/parser/quickfix/parse-context.ts +2 -2
  201. package/src/dictionary/parser/quickfix/parse-progress.ts +2 -3
  202. package/src/dictionary/parser/quickfix/quick-fix-xml-file-builder.ts +4 -5
  203. package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +10 -12
  204. package/src/dictionary/parser/quickfix/quick-fix-xml-formatter.ts +1 -1
  205. package/src/dictionary/set-reduce.ts +3 -3
  206. package/src/index.ts +0 -1
  207. package/src/jsfix-cmd.ts +5 -6
  208. package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +7 -8
  209. package/src/sample/tcp/trade-capture/trade-capture-client.ts +4 -5
  210. package/src/sample/tcp/trade-capture/trade-capture-server.ts +1 -1
  211. package/src/store/fix-msg-ascii-store-resend.ts +64 -8
  212. package/src/store/fix-msg-memory-store.ts +3 -4
  213. package/src/store/fix-msg-store-record.ts +1 -1
  214. package/src/transport/ascii/ascii-msg-transmitter.ts +6 -6
  215. package/src/transport/ascii/ascii-session.ts +11 -7
  216. package/src/transport/fixml/fixml-session.ts +3 -3
  217. package/src/transport/http/http-acceptor.ts +4 -5
  218. package/src/transport/http/http-json-sample-adapter.ts +3 -4
  219. package/src/transport/session/dynamic-session-manager.ts +16 -0
  220. package/src/transport/session/session-description.ts +10 -7
  221. package/src/util/json-helper.ts +3 -3
  222. package/src/util/message-generator.ts +4 -4
  223. package/dist/collections/dictionary.d.ts +0 -15
  224. package/dist/collections/dictionary.js +0 -57
  225. package/dist/collections/dictionary.js.map +0 -1
  226. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.d.ts +0 -31
  227. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js +0 -3
  228. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js.map +0 -1
  229. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.d.ts +0 -26
  230. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js +0 -3
  231. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js.map +0 -1
  232. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.d.ts +0 -5
  233. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js +0 -3
  234. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js.map +0 -1
  235. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.d.ts +0 -8
  236. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js +0 -3
  237. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js.map +0 -1
  238. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.d.ts +0 -4
  239. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js +0 -3
  240. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js.map +0 -1
  241. package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.d.ts +0 -6
  242. package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.js.map +0 -1
  243. package/src/collections/dictionary.ts +0 -62
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Repository = void 0;
4
4
  const definition_1 = require("../../definition");
5
- const collections_1 = require("../../../collections");
6
5
  const contained_1 = require("../../contained");
7
6
  const fix_versions_1 = require("../../fix-versions");
8
7
  const fix_definition_source_1 = require("../../fix-definition-source");
@@ -11,7 +10,7 @@ class Repository {
11
10
  constructor(version, getLogger) {
12
11
  this.version = version;
13
12
  this.getLogger = getLogger;
14
- this.groupLookup = new collections_1.Dictionary();
13
+ this.groupLookup = new Map();
15
14
  this.logger = getLogger('Repository');
16
15
  this.includesAbbreviations = Repository.doesIncludeAbbreviations(version);
17
16
  this.definitions = new definition_1.FixDefinitions(fix_definition_source_1.FixDefinitionSource.FixRepo, version);
@@ -71,9 +70,9 @@ class Repository {
71
70
  summarise() {
72
71
  const logger = this.logger;
73
72
  const definitions = this.definitions;
74
- logger.info(`definitions: ${definitions.simple.count()} fields`);
75
- logger.info(`definitions: ${definitions.component.count()} components`);
76
- logger.info(`definitions: ${definitions.message.count()} messages`);
73
+ logger.info(`definitions: ${definitions.simple.size} fields`);
74
+ logger.info(`definitions: ${definitions.component.size} components`);
75
+ logger.info(`definitions: ${definitions.message.size} messages`);
77
76
  }
78
77
  toDefinitions() {
79
78
  this.fields();
@@ -95,13 +94,13 @@ class Repository {
95
94
  header() {
96
95
  const h = this.definitions.component.get('StandardHeader');
97
96
  if (h) {
98
- this.definitions.component.add('header', h);
97
+ this.definitions.component.set('header', h);
99
98
  }
100
99
  }
101
100
  trailer() {
102
101
  const t = this.definitions.component.get('StandardTrailer');
103
102
  if (t) {
104
- this.definitions.component.add('trailer', t);
103
+ this.definitions.component.set('trailer', t);
105
104
  }
106
105
  }
107
106
  static isNative(f) {
@@ -141,8 +140,8 @@ class Repository {
141
140
  this.dataTypeLookup = this.types();
142
141
  const definitions = this.definitions;
143
142
  const types = this.dataTypeLookup;
144
- types.remove('boolean');
145
- types.remove('data');
143
+ types.delete('boolean');
144
+ types.delete('data');
146
145
  this.Fields.forEach((f) => {
147
146
  const type = this.getType(f);
148
147
  definitions.addSimpleFieldDef(Repository.makeSimple(f, type));
@@ -154,20 +153,21 @@ class Repository {
154
153
  let content = a.get(current.ComponentID);
155
154
  if (!content) {
156
155
  content = [];
157
- a.add(current.ComponentID, content);
156
+ a.set(current.ComponentID, content);
158
157
  }
159
158
  content[content.length] = current;
160
159
  return a;
161
- }, new collections_1.Dictionary());
160
+ }, new Map());
162
161
  }
163
162
  resolveToFieldSet(content, parentSet) {
163
+ const builder = new contained_1.ContainedSetBuilder(parentSet);
164
164
  content.forEach((current) => {
165
165
  const required = current.Reqd === '1';
166
166
  const tag = parseInt(current.TagText, 10);
167
167
  if (!isNaN(tag)) {
168
168
  const sf = this.definitions.tagToSimple[tag];
169
169
  if (sf) {
170
- parentSet.add(new contained_1.ContainedSimpleField(sf, parentSet.fields.length, required, false));
170
+ builder.add(new contained_1.ContainedSimpleField(sf, parentSet.fields.length, required, false));
171
171
  }
172
172
  }
173
173
  else {
@@ -181,11 +181,11 @@ class Repository {
181
181
  if (childSet) {
182
182
  switch (childSet.type) {
183
183
  case contained_set_type_1.ContainedSetType.Component: {
184
- parentSet.add(new contained_1.ContainedComponentField(childSet, parentSet.fields.length, required));
184
+ builder.add(new contained_1.ContainedComponentField(childSet, parentSet.fields.length, required));
185
185
  break;
186
186
  }
187
187
  case contained_set_type_1.ContainedSetType.Group: {
188
- parentSet.add(new contained_1.ContainedGroupField(childSet, parentSet.fields.length, required));
188
+ builder.add(new contained_1.ContainedGroupField(childSet, parentSet.fields.length, required));
189
189
  break;
190
190
  }
191
191
  default: {
@@ -208,7 +208,7 @@ class Repository {
208
208
  if (!def) {
209
209
  def = new definition_1.GroupFieldDefinition(c.Name, c.AbbrName, c.CategoryID, noField, c.Description);
210
210
  this.resolveToFieldSet(content.slice(1), def);
211
- this.groupLookup.add(c.ComponentID, def);
211
+ this.groupLookup.set(c.ComponentID, def);
212
212
  }
213
213
  return def;
214
214
  }
@@ -238,16 +238,16 @@ class Repository {
238
238
  }
239
239
  components() {
240
240
  return this.Components.reduce((a, current) => {
241
- a.add(current.Name, current);
242
- a.add(current.ComponentID, current);
241
+ a.set(current.Name, current);
242
+ a.set(current.ComponentID, current);
243
243
  return a;
244
- }, new collections_1.Dictionary());
244
+ }, new Map());
245
245
  }
246
246
  types() {
247
247
  return this.DataTypes.reduce((a, current) => {
248
- a.add(current.Name, current);
248
+ a.set(current.Name, current);
249
249
  return a;
250
- }, new collections_1.Dictionary());
250
+ }, new Map());
251
251
  }
252
252
  }
253
253
  exports.Repository = Repository;
@@ -1 +1 @@
1
- {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fix-repository/repository.ts"],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,CAAA;YACpC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAA;QACvC,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAmC,EAAE,OAA6B,EAAE,EAAE;YACnG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAC5B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;YACnC,OAAO,CAAC,CAAA;QACV,CAAC,EAAE,IAAI,wBAAU,EAAwB,CAAC,CAAA;IAC5C,CAAC;IAEO,KAAK;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAkC,EAAE,OAA4B,EAAE,EAAE;YAChG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAC5B,OAAO,CAAC,CAAA;QACV,CAAC,EAAE,IAAI,wBAAU,EAAuB,CAAC,CAAA;IAC3C,CAAC;CACF;AA/RD,gCA+RC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\r\nimport {\r\n SimpleFieldDefinition, GroupFieldDefinition, ComponentFieldDefinition,\r\n MessageDefinition, FixDefinitions\r\n} from '../../definition'\r\nimport { Dictionary } from '../../../collections'\r\nimport { ContainedFieldSet, ContainedComponentField, ContainedGroupField, ContainedSimpleField } from '../../contained'\r\nimport { FixVersion } from '../../fix-versions'\r\nimport { GetJsFixLogger, IJsFixLogger } from '../../../config'\r\nimport { FixDefinitionSource } from '../../fix-definition-source'\r\nimport { ContainedSetType } from '../../contained-set-type'\r\nimport { IRepositoryMessage } from './repository-message'\r\nimport { IRepositoryEnum } from './repository-enum'\r\nimport { IRepositoryDataType } from './repository-data-type'\r\nimport { IRepositoryComponent } from './repository-component'\r\nimport { IRepositoryField } from './repository-field'\r\nimport { IRepositoryAbbreviation } from './repository-abbreviation'\r\nimport { IRepositoryMsgContent } from './repository-msg-content'\r\n\r\nexport class Repository {\r\n public Enums: IRepositoryEnum[]\r\n public Fields: IRepositoryField[]\r\n public DataTypes: IRepositoryDataType[]\r\n public Components: IRepositoryComponent[]\r\n public Messages: IRepositoryMessage[]\r\n public MsgContents: IRepositoryMsgContent[]\r\n public Abbreviations: IRepositoryAbbreviation[]\r\n public includesAbbreviations: boolean\r\n // derived from above\r\n public readonly definitions: FixDefinitions\r\n private readonly groupLookup: Dictionary<GroupFieldDefinition> = new Dictionary<GroupFieldDefinition>()\r\n private contentLookup: Dictionary<IRepositoryMsgContent[]>\r\n private componentLookup: Dictionary<IRepositoryComponent>\r\n private dataTypeLookup: Dictionary<IRepositoryDataType>\r\n private readonly logger: IJsFixLogger\r\n\r\n constructor (public readonly version: FixVersion, public readonly getLogger: GetJsFixLogger) {\r\n this.logger = getLogger('Repository')\r\n this.includesAbbreviations = Repository.doesIncludeAbbreviations(version)\r\n this.definitions = new FixDefinitions(FixDefinitionSource.FixRepo, version)\r\n }\r\n\r\n private static doesIncludeAbbreviations (version: FixVersion): boolean {\r\n let includesAbbreviations: boolean\r\n switch (version) {\r\n case FixVersion.FIX44:\r\n case FixVersion.FIX50:\r\n case FixVersion.FIX50SP1:\r\n case FixVersion.FIX50SP2:\r\n includesAbbreviations = true\r\n break\r\n\r\n default: {\r\n includesAbbreviations = false\r\n break\r\n }\r\n }\r\n return includesAbbreviations\r\n }\r\n\r\n public assign (name: string, data: ILooseObject[]): void {\r\n switch (name) {\r\n case 'Fields': {\r\n this.Fields = data as IRepositoryField[]\r\n break\r\n }\r\n\r\n case 'Enums': {\r\n this.Enums = data as IRepositoryEnum[]\r\n break\r\n }\r\n\r\n case 'Datatypes': {\r\n this.DataTypes = data as IRepositoryDataType[]\r\n break\r\n }\r\n\r\n case 'Components': {\r\n this.Components = data as IRepositoryComponent[]\r\n break\r\n }\r\n\r\n case 'Messages': {\r\n this.Messages = data as IRepositoryMessage[]\r\n break\r\n }\r\n\r\n case 'MsgContents': {\r\n this.MsgContents = data as IRepositoryMsgContent[]\r\n if (!this.includesAbbreviations) {\r\n this.toDefinitions()\r\n }\r\n break\r\n }\r\n\r\n case 'Abbreviations': {\r\n this.Abbreviations = data as IRepositoryAbbreviation[]\r\n this.toDefinitions()\r\n break\r\n }\r\n }\r\n }\r\n\r\n private summarise (): void {\r\n const logger = this.logger\r\n const definitions = this.definitions\r\n logger.info(`definitions: ${definitions.simple.count()} fields`)\r\n logger.info(`definitions: ${definitions.component.count()} components`)\r\n logger.info(`definitions: ${definitions.message.count()} messages`)\r\n }\r\n\r\n private toDefinitions (): void {\r\n this.fields()\r\n this.complex()\r\n this.header()\r\n this.trailer()\r\n this.summarise()\r\n }\r\n\r\n private complex (): void {\r\n this.contentLookup = this.contents()\r\n this.componentLookup = this.components()\r\n this.Components.forEach((c: IRepositoryComponent) => this.resolve(c))\r\n this.Messages.forEach((m: IRepositoryMessage) => {\r\n const msg = this.message(m)\r\n this.logger.debug(`${msg.toString()}`)\r\n this.definitions.addMessage(msg)\r\n })\r\n }\r\n\r\n private header (): void {\r\n const h: ComponentFieldDefinition | null = this.definitions.component.get('StandardHeader')\r\n if (h) {\r\n this.definitions.component.add('header', h)\r\n }\r\n }\r\n\r\n private trailer (): void {\r\n const t: ComponentFieldDefinition | null = this.definitions.component.get('StandardTrailer')\r\n if (t) {\r\n this.definitions.component.add('trailer', t)\r\n }\r\n }\r\n\r\n private static isNative (f: IRepositoryField): boolean {\r\n return f.Type === 'Boolean' ||\r\n f.Type === 'data' ||\r\n f.Type === 'LocalMktDate' ||\r\n f.Type === 'UTCDateOnly' ||\r\n f.Type === 'UTCTimestamp'\r\n }\r\n\r\n private static makeSimple (f: IRepositoryField, type: string): SimpleFieldDefinition {\r\n return new SimpleFieldDefinition(\r\n f.Tag,\r\n f.Name,\r\n f.AbbrName ? f.AbbrName : f.Name,\r\n f.BaseCategory,\r\n f.BaseCategoryAbbrName,\r\n type.toUpperCase(),\r\n f.Description)\r\n }\r\n\r\n private getType (f: IRepositoryField): string {\r\n const types = this.dataTypeLookup\r\n const nativeType = Repository.isNative(f)\r\n let type = f.Type\r\n const mapped = !nativeType && types.get(type)\r\n if (f.Type !== 'Length' && mapped) {\r\n type = mapped.BaseType ?? type\r\n }\r\n return type\r\n }\r\n\r\n private fieldEnums (): void {\r\n const definitions = this.definitions\r\n for (const e of this.Enums) {\r\n const field: SimpleFieldDefinition = definitions.tagToSimple[parseInt(e.Tag, 10)]\r\n if (field == null) {\r\n continue\r\n }\r\n if (e.Value && e.SymbolicName) {\r\n field.addEnum(e.Value, e.SymbolicName, e.Description)\r\n }\r\n }\r\n }\r\n\r\n private fields (): void {\r\n this.dataTypeLookup = this.types()\r\n const definitions = this.definitions\r\n const types = this.dataTypeLookup\r\n types.remove('boolean')\r\n types.remove('data')\r\n this.Fields.forEach((f: IRepositoryField) => {\r\n const type = this.getType(f)\r\n definitions.addSimpleFieldDef(Repository.makeSimple(f, type))\r\n })\r\n this.fieldEnums()\r\n }\r\n\r\n private contents (): Dictionary<IRepositoryMsgContent[]> {\r\n return this.MsgContents.reduce((a, current) => {\r\n let content: IRepositoryMsgContent[] | null = a.get(current.ComponentID)\r\n if (!content) {\r\n content = []\r\n a.add(current.ComponentID, content)\r\n }\r\n content[content.length] = current\r\n return a\r\n }, new Dictionary<IRepositoryMsgContent[]>())\r\n }\r\n\r\n private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet: ContainedFieldSet): void {\r\n content.forEach((current: IRepositoryMsgContent) => {\r\n const required: boolean = current.Reqd === '1'\r\n const tag: number = parseInt(current.TagText, 10)\r\n if (!isNaN(tag)) {\r\n const sf: SimpleFieldDefinition = this.definitions.tagToSimple[tag]\r\n if (sf) {\r\n parentSet.add(new ContainedSimpleField(sf, parentSet.fields.length, required, false))\r\n }\r\n } else {\r\n // is there a definition for this type yet create.\r\n let childSet: ContainedFieldSet | null = this.definitions.component.get(current.TagText)\r\n if (!childSet) {\r\n const cl: IRepositoryComponent | null = this.componentLookup.get(current.TagText)\r\n if (cl) {\r\n childSet = this.resolve(cl)\r\n }\r\n }\r\n if (childSet) {\r\n switch (childSet.type) {\r\n case ContainedSetType.Component: {\r\n parentSet.add(new ContainedComponentField(childSet as ComponentFieldDefinition, parentSet.fields.length, required))\r\n break\r\n }\r\n\r\n case ContainedSetType.Group: {\r\n parentSet.add(new ContainedGroupField(childSet as GroupFieldDefinition, parentSet.fields.length, required))\r\n break\r\n }\r\n\r\n default: {\r\n throw new Error(`unknown set type ${childSet.type}`)\r\n }\r\n }\r\n }\r\n }\r\n return parentSet\r\n })\r\n }\r\n\r\n private resolve (c: IRepositoryComponent): ContainedFieldSet {\r\n switch (c.ComponentType) {\r\n case 'ImplicitBlockRepeating':\r\n case 'BlockRepeating': {\r\n const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []\r\n const noField: SimpleFieldDefinition = this.definitions.tagToSimple[parseInt(content[0].TagText, 10)]\r\n let def: GroupFieldDefinition | null = this.groupLookup.get(c.ComponentID)\r\n if (!def) {\r\n def = new GroupFieldDefinition(c.Name, c.AbbrName, c.CategoryID, noField, c.Description)\r\n this.resolveToFieldSet(content.slice(1), def)\r\n this.groupLookup.add(c.ComponentID, def)\r\n }\r\n return def\r\n }\r\n\r\n default: {\r\n const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []\r\n let def: ComponentFieldDefinition | null = this.definitions.component.get(c.Name)\r\n if (!def) {\r\n def = new ComponentFieldDefinition(c.Name, c.AbbrName, c.CategoryID, c.Description)\r\n this.resolveToFieldSet(content, def)\r\n this.definitions.addComponentFieldDef(def)\r\n }\r\n return def\r\n }\r\n }\r\n }\r\n\r\n private message (m: IRepositoryMessage): MessageDefinition {\r\n const definitions = this.definitions\r\n const content: IRepositoryMsgContent[] = this.contentLookup.get(m.ComponentID) ?? []\r\n let def: MessageDefinition | null = definitions.message.get(m.Name)\r\n if (!def) {\r\n def = new MessageDefinition(m.Name, m.AbbrName, m.MsgType, m.CategoryID, m.Description)\r\n this.resolveToFieldSet(content, def)\r\n definitions.addComponentFieldDef(def)\r\n }\r\n return def\r\n }\r\n\r\n private components (): Dictionary<IRepositoryComponent> {\r\n return this.Components.reduce((a: Dictionary<IRepositoryComponent>, current: IRepositoryComponent) => {\r\n a.add(current.Name, current)\r\n a.add(current.ComponentID, current)\r\n return a\r\n }, new Dictionary<IRepositoryComponent>())\r\n }\r\n\r\n private types (): Dictionary<IRepositoryDataType> {\r\n return this.DataTypes.reduce((a: Dictionary<IRepositoryDataType>, current: IRepositoryDataType) => {\r\n a.add(current.Name, current)\r\n return a\r\n }, new Dictionary<IRepositoryDataType>())\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fix-repository/repository.ts"],"names":[],"mappings":";;;AACA,iDAGyB;AAEzB,+CAMwB;AACxB,qDAA+C;AAE/C,uEAAiE;AACjE,iEAA2D;AAS3D,MAAa,UAAU;IAiBrB,YAA6B,OAAmB,EAAkB,SAAyB;QAA9D,YAAO,GAAP,OAAO,CAAY;QAAkB,cAAS,GAAT,SAAS,CAAgB;QAN1E,gBAAW,GAAsC,IAAI,GAAG,EAAgC,CAAA;QAOvG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;QACrC,IAAI,CAAC,qBAAqB,GAAG,UAAU,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAA;QACzE,IAAI,CAAC,WAAW,GAAG,IAAI,2BAAc,CAAC,2CAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7E,CAAC;IAEO,MAAM,CAAC,wBAAwB,CAAE,OAAmB;QAC1D,IAAI,qBAA8B,CAAA;QAClC,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,yBAAU,CAAC,KAAK,CAAC;YACtB,KAAK,yBAAU,CAAC,KAAK,CAAC;YACtB,KAAK,yBAAU,CAAC,QAAQ,CAAC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AC;CACF;AAhSD,gCAgSC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\r\nimport {\r\n SimpleFieldDefinition, GroupFieldDefinition, ComponentFieldDefinition,\r\n MessageDefinition, FixDefinitions\r\n} from '../../definition'\r\n\r\nimport {\r\n IContainedSet,\r\n ContainedComponentField,\r\n ContainedGroupField,\r\n ContainedSimpleField,\r\n ContainedSetBuilder\r\n} from '../../contained'\r\nimport { FixVersion } from '../../fix-versions'\r\nimport { GetJsFixLogger, IJsFixLogger } from '../../../config'\r\nimport { FixDefinitionSource } from '../../fix-definition-source'\r\nimport { ContainedSetType } from '../../contained-set-type'\r\nimport { IRepositoryMessage } from './repository-message'\r\nimport { IRepositoryEnum } from './repository-enum'\r\nimport { IRepositoryDataType } from './repository-data-type'\r\nimport { IRepositoryComponent } from './repository-component'\r\nimport { IRepositoryField } from './repository-field'\r\nimport { IRepositoryAbbreviation } from './repository-abbreviation'\r\nimport { IRepositoryMsgContent } from './repository-msg-content'\r\n\r\nexport class Repository {\r\n public Enums: IRepositoryEnum[]\r\n public Fields: IRepositoryField[]\r\n public DataTypes: IRepositoryDataType[]\r\n public Components: IRepositoryComponent[]\r\n public Messages: IRepositoryMessage[]\r\n public MsgContents: IRepositoryMsgContent[]\r\n public Abbreviations: IRepositoryAbbreviation[]\r\n public includesAbbreviations: boolean\r\n // derived from above\r\n public readonly definitions: FixDefinitions\r\n private readonly groupLookup: Map<string, GroupFieldDefinition> = new Map<string, GroupFieldDefinition>()\r\n private contentLookup: Map<string, IRepositoryMsgContent[]>\r\n private componentLookup: Map<string, IRepositoryComponent>\r\n private dataTypeLookup: Map<string, IRepositoryDataType>\r\n private readonly logger: IJsFixLogger\r\n\r\n constructor (public readonly version: FixVersion, public readonly getLogger: GetJsFixLogger) {\r\n this.logger = getLogger('Repository')\r\n this.includesAbbreviations = Repository.doesIncludeAbbreviations(version)\r\n this.definitions = new FixDefinitions(FixDefinitionSource.FixRepo, version)\r\n }\r\n\r\n private static doesIncludeAbbreviations (version: FixVersion): boolean {\r\n let includesAbbreviations: boolean\r\n switch (version) {\r\n case FixVersion.FIX44:\r\n case FixVersion.FIX50:\r\n case FixVersion.FIX50SP1:\r\n case FixVersion.FIX50SP2:\r\n includesAbbreviations = true\r\n break\r\n\r\n default: {\r\n includesAbbreviations = false\r\n break\r\n }\r\n }\r\n return includesAbbreviations\r\n }\r\n\r\n public assign (name: string, data: ILooseObject[]): void {\r\n switch (name) {\r\n case 'Fields': {\r\n this.Fields = data as IRepositoryField[]\r\n break\r\n }\r\n\r\n case 'Enums': {\r\n this.Enums = data as IRepositoryEnum[]\r\n break\r\n }\r\n\r\n case 'Datatypes': {\r\n this.DataTypes = data as IRepositoryDataType[]\r\n break\r\n }\r\n\r\n case 'Components': {\r\n this.Components = data as IRepositoryComponent[]\r\n break\r\n }\r\n\r\n case 'Messages': {\r\n this.Messages = data as IRepositoryMessage[]\r\n break\r\n }\r\n\r\n case 'MsgContents': {\r\n this.MsgContents = data as IRepositoryMsgContent[]\r\n if (!this.includesAbbreviations) {\r\n this.toDefinitions()\r\n }\r\n break\r\n }\r\n\r\n case 'Abbreviations': {\r\n this.Abbreviations = data as IRepositoryAbbreviation[]\r\n this.toDefinitions()\r\n break\r\n }\r\n }\r\n }\r\n\r\n private summarise (): void {\r\n const logger = this.logger\r\n const definitions = this.definitions\r\n logger.info(`definitions: ${definitions.simple.size} fields`)\r\n logger.info(`definitions: ${definitions.component.size} components`)\r\n logger.info(`definitions: ${definitions.message.size} messages`)\r\n }\r\n\r\n private toDefinitions (): void {\r\n this.fields()\r\n this.complex()\r\n this.header()\r\n this.trailer()\r\n this.summarise()\r\n }\r\n\r\n private complex (): void {\r\n this.contentLookup = this.contents()\r\n this.componentLookup = this.components()\r\n this.Components.forEach((c: IRepositoryComponent) => this.resolve(c))\r\n this.Messages.forEach((m: IRepositoryMessage) => {\r\n const msg = this.message(m)\r\n this.logger.debug(`${msg.toString()}`)\r\n this.definitions.addMessage(msg)\r\n })\r\n }\r\n\r\n private header (): void {\r\n const h: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardHeader')\r\n if (h) {\r\n this.definitions.component.set('header', h)\r\n }\r\n }\r\n\r\n private trailer (): void {\r\n const t: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardTrailer')\r\n if (t) {\r\n this.definitions.component.set('trailer', t)\r\n }\r\n }\r\n\r\n private static isNative (f: IRepositoryField): boolean {\r\n return f.Type === 'Boolean' ||\r\n f.Type === 'data' ||\r\n f.Type === 'LocalMktDate' ||\r\n f.Type === 'UTCDateOnly' ||\r\n f.Type === 'UTCTimestamp'\r\n }\r\n\r\n private static makeSimple (f: IRepositoryField, type: string): SimpleFieldDefinition {\r\n return new SimpleFieldDefinition(\r\n f.Tag,\r\n f.Name,\r\n f.AbbrName ? f.AbbrName : f.Name,\r\n f.BaseCategory,\r\n f.BaseCategoryAbbrName,\r\n type.toUpperCase(),\r\n f.Description)\r\n }\r\n\r\n private getType (f: IRepositoryField): string {\r\n const types = this.dataTypeLookup\r\n const nativeType = Repository.isNative(f)\r\n let type = f.Type\r\n const mapped = !nativeType && types.get(type)\r\n if (f.Type !== 'Length' && mapped) {\r\n type = mapped.BaseType ?? type\r\n }\r\n return type\r\n }\r\n\r\n private fieldEnums (): void {\r\n const definitions = this.definitions\r\n for (const e of this.Enums) {\r\n const field: SimpleFieldDefinition = definitions.tagToSimple[parseInt(e.Tag, 10)]\r\n if (field == null) {\r\n continue\r\n }\r\n if (e.Value && e.SymbolicName) {\r\n field.addEnum(e.Value, e.SymbolicName, e.Description)\r\n }\r\n }\r\n }\r\n\r\n private fields (): void {\r\n this.dataTypeLookup = this.types()\r\n const definitions = this.definitions\r\n const types = this.dataTypeLookup\r\n types.delete('boolean')\r\n types.delete('data')\r\n this.Fields.forEach((f: IRepositoryField) => {\r\n const type = this.getType(f)\r\n definitions.addSimpleFieldDef(Repository.makeSimple(f, type))\r\n })\r\n this.fieldEnums()\r\n }\r\n\r\n private contents (): Map<string, IRepositoryMsgContent[]> {\r\n return this.MsgContents.reduce((a, current) => {\r\n let content: IRepositoryMsgContent[] | undefined = a.get(current.ComponentID)\r\n if (!content) {\r\n content = []\r\n a.set(current.ComponentID, content)\r\n }\r\n content[content.length] = current\r\n return a\r\n }, new Map<string, IRepositoryMsgContent[]>())\r\n }\r\n\r\n private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet: IContainedSet): void {\r\n const builder = new ContainedSetBuilder(parentSet)\r\n content.forEach((current: IRepositoryMsgContent) => {\r\n const required: boolean = current.Reqd === '1'\r\n const tag: number = parseInt(current.TagText, 10)\r\n if (!isNaN(tag)) {\r\n const sf: SimpleFieldDefinition = this.definitions.tagToSimple[tag]\r\n if (sf) {\r\n builder.add(new ContainedSimpleField(sf, parentSet.fields.length, required, false))\r\n }\r\n } else {\r\n // is there a definition for this type yet create.\r\n let childSet: IContainedSet | undefined = this.definitions.component.get(current.TagText)\r\n if (!childSet) {\r\n const cl: IRepositoryComponent | undefined = this.componentLookup.get(current.TagText)\r\n if (cl) {\r\n childSet = this.resolve(cl)\r\n }\r\n }\r\n if (childSet) {\r\n switch (childSet.type) {\r\n case ContainedSetType.Component: {\r\n builder.add(new ContainedComponentField(childSet as ComponentFieldDefinition, parentSet.fields.length, required))\r\n break\r\n }\r\n\r\n case ContainedSetType.Group: {\r\n builder.add(new ContainedGroupField(childSet as GroupFieldDefinition, parentSet.fields.length, required))\r\n break\r\n }\r\n\r\n default: {\r\n throw new Error(`unknown set type ${childSet.type}`)\r\n }\r\n }\r\n }\r\n }\r\n return parentSet\r\n })\r\n }\r\n\r\n private resolve (c: IRepositoryComponent): IContainedSet {\r\n switch (c.ComponentType) {\r\n case 'ImplicitBlockRepeating':\r\n case 'BlockRepeating': {\r\n const content: IRepositoryMsgContent[] | undefined = this.contentLookup.get(c.ComponentID) ?? []\r\n const noField: SimpleFieldDefinition = this.definitions.tagToSimple[parseInt(content[0].TagText, 10)]\r\n let def: GroupFieldDefinition | undefined = this.groupLookup.get(c.ComponentID)\r\n if (!def) {\r\n def = new GroupFieldDefinition(c.Name, c.AbbrName, c.CategoryID, noField, c.Description)\r\n this.resolveToFieldSet(content.slice(1), def)\r\n this.groupLookup.set(c.ComponentID, def)\r\n }\r\n return def\r\n }\r\n\r\n default: {\r\n const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []\r\n let def: ComponentFieldDefinition | undefined = this.definitions.component.get(c.Name)\r\n if (!def) {\r\n def = new ComponentFieldDefinition(c.Name, c.AbbrName, c.CategoryID, c.Description)\r\n this.resolveToFieldSet(content, def)\r\n this.definitions.addComponentFieldDef(def)\r\n }\r\n return def\r\n }\r\n }\r\n }\r\n\r\n private message (m: IRepositoryMessage): MessageDefinition {\r\n const definitions = this.definitions\r\n const content: IRepositoryMsgContent[] = this.contentLookup.get(m.ComponentID) ?? []\r\n let def: MessageDefinition | undefined = definitions.message.get(m.Name)\r\n if (!def) {\r\n def = new MessageDefinition(m.Name, m.AbbrName, m.MsgType, m.CategoryID, m.Description)\r\n this.resolveToFieldSet(content, def)\r\n definitions.addComponentFieldDef(def)\r\n }\r\n return def\r\n }\r\n\r\n private components (): Map<string, IRepositoryComponent> {\r\n return this.Components.reduce((a: Map<string, IRepositoryComponent>, current: IRepositoryComponent) => {\r\n a.set(current.Name, current)\r\n a.set(current.ComponentID, current)\r\n return a\r\n }, new Map<string, IRepositoryComponent>())\r\n }\r\n\r\n private types (): Map<string, IRepositoryDataType> {\r\n return this.DataTypes.reduce((a: Map<string, IRepositoryDataType>, current: IRepositoryDataType) => {\r\n a.set(current.Name, current)\r\n return a\r\n }, new Map<string, IRepositoryDataType>())\r\n }\r\n}\r\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentsParser = void 0;
4
- const collections_1 = require("../../../collections");
5
4
  const xsd_parser_1 = require("./xsd-parser");
6
5
  const contained_1 = require("../../contained");
7
6
  const definition_1 = require("../../definition");
@@ -9,10 +8,10 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
9
8
  constructor(definitions) {
10
9
  super(definitions);
11
10
  this.definitions = definitions;
12
- this.attributeGroups = new collections_1.Dictionary();
13
- this.groups = new collections_1.Dictionary();
11
+ this.attributeGroups = new Map();
12
+ this.groups = new Map();
14
13
  this.unboundElements = [];
15
- this.complexTypes = new collections_1.Dictionary();
14
+ this.complexTypes = new Map();
16
15
  this.currentAttributeGroupStack = [];
17
16
  }
18
17
  static getName(group, attributeGroup, type) {
@@ -49,7 +48,7 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
49
48
  if (this.currentComplexType != null) {
50
49
  const complex = this.currentComplexType;
51
50
  this.previousComplexType = complex;
52
- this.complexTypes.addUpdate(complex.name, complex);
51
+ this.complexTypes.set(complex.name, complex);
53
52
  this.newComplexTypes.push(complex);
54
53
  this.currentComplexType = null;
55
54
  }
@@ -57,7 +56,7 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
57
56
  }
58
57
  case 'xs:group': {
59
58
  if (this.currentGroup) {
60
- this.groups.addUpdate(this.currentGroup.name, this.currentGroup);
59
+ this.groups.set(this.currentGroup.name, this.currentGroup);
61
60
  this.currentGroup = null;
62
61
  }
63
62
  break;
@@ -67,7 +66,7 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
67
66
  if (attributeStack.length > 0) {
68
67
  const group = attributeStack.pop();
69
68
  if (group === null || group === void 0 ? void 0 : group.name) {
70
- this.attributeGroups.addUpdate(group === null || group === void 0 ? void 0 : group.name, group);
69
+ this.attributeGroups.set(group === null || group === void 0 ? void 0 : group.name, group);
71
70
  }
72
71
  }
73
72
  break;
@@ -220,17 +219,18 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
220
219
  const isGroup = element.maxOccurs === 'unbounded';
221
220
  const isComponent = element.maxOccurs === '1' || !isGroup;
222
221
  const key = element.type || element.ref || element.name;
222
+ const builder = new contained_1.ContainedSetBuilder(set);
223
223
  const containedType = this.complexTypes.get(key);
224
224
  if (containedType) {
225
225
  if (isComponent) {
226
226
  const containedDefinition = this.getComponent(containedType);
227
227
  const containedField = new contained_1.ContainedComponentField(containedDefinition, set.fields.length, minOccurs > 0, element.name);
228
- set.add(containedField);
228
+ builder.add(containedField);
229
229
  }
230
230
  else if (isGroup) {
231
231
  const containedDefinition = this.getGroup(containedType);
232
232
  const containedField = new contained_1.ContainedGroupField(containedDefinition, set.fields.length, minOccurs > 0, element.name);
233
- set.add(containedField);
233
+ builder.add(containedField);
234
234
  }
235
235
  }
236
236
  else {
@@ -268,7 +268,8 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
268
268
  }
269
269
  if (sf) {
270
270
  const contained = new contained_1.ContainedSimpleField(sf, set.fields.length, attribute.use !== 'optional', true, attribute.name);
271
- set.add(contained);
271
+ const builder = new contained_1.ContainedSetBuilder(set);
272
+ builder.add(contained);
272
273
  }
273
274
  else if (set.name !== 'FixmlAttributes') {
274
275
  throw new Error(`unable to resolve simple attribute ${attribute.name}`);
@@ -320,8 +321,8 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
320
321
  }
321
322
  const component = new definition_1.ComponentFieldDefinition(name, name, category, null);
322
323
  this.populateSet(type, component);
323
- definitions.component.addUpdate(component.name, component);
324
- definitions.component.addUpdate(type.name, component);
324
+ definitions.component.set(component.name, component);
325
+ definitions.component.set(type.name, component);
325
326
  return component;
326
327
  }
327
328
  getMessage(type) {
@@ -329,14 +330,15 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
329
330
  const messages = definitions.message;
330
331
  const name = type.appInfo.name;
331
332
  const message = new definition_1.MessageDefinition(name, type.messageName, type.appInfo.MsgID, type.appInfo.Category, type.annotation.documentation);
333
+ const builder = new contained_1.ContainedSetBuilder(message);
332
334
  const abstractMessage = definitions.component.get('Message');
333
335
  abstractMessage === null || abstractMessage === void 0 ? void 0 : abstractMessage.fields.forEach((f) => {
334
- message.add(f);
336
+ builder.add(f);
335
337
  });
336
338
  this.populateSet(type, message);
337
- messages.addUpdate(message.name, message);
339
+ messages.set(message.name, message);
338
340
  if (type.messageName && type.messageName !== name) {
339
- messages.addUpdate(type.messageName, message);
341
+ messages.set(type.messageName, message);
340
342
  }
341
343
  return message;
342
344
  }
@@ -401,7 +403,7 @@ class ComponentsParser extends xsd_parser_1.XsdParser {
401
403
  const definitions = this.definitions;
402
404
  const component = definitions.component.get(e.type);
403
405
  if (component) {
404
- definitions.component.addUpdate(e.name, component);
406
+ definitions.component.set(e.name, component);
405
407
  }
406
408
  });
407
409
  }
@@ -1 +1 @@
1
- {"version":3,"file":"components-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/components-parser.ts"],"names":[],"mappings":";;;AACA,sDAAiD;AACjD,6CAAwC;AACxC,+CAMwB;AACxB,iDAKyB;AAEzB,MAAa,gBAAiB,SAAQ,sBAAS;IAY7C,YAAoC,WAA2B;QAC7D,KAAK,CAAC,WAAW,CAAC,CAAA;QADgB,gBAAW,GAAX,WAAW,CAAgB;QAX9C,oBAAe,GAAgC,IAAI,wBAAU,EAAmB,CAAA;QAChF,WAAM,GAAuB,IAAI,wBAAU,EAAU,CAAA;QACrD,oBAAe,GAAe,EAAE,CAAA;QAChC,iBAAY,GAA6B,IAAI,wBAAU,EAAgB,CAAA;QAIvE,+BAA0B,GAAsB,EAAE,CAAA;IAMnE,CAAC;IAEO,MAAM,CAAC,OAAO,CAAE,KAAsB,EAAE,cAAwC,EAAE,IAAkB;QAC1G,IAAI,IAAY,CAAA;QAChB,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,EAAE,CAAC;YAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAC1B,CAAC;aAAM,IAAI,KAAK,EAAE,CAAC;YACjB,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACnB,CAAC;aAAM,IAAI,cAAc,EAAE,CAAC;YAC1B,IAAI,GAAG,cAAc,CAAC,IAAI,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,I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CAAC;IACH,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,IAAkB,EAAE,EAAE;YAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAW,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;YACpC,MAAM,SAAS,GAAoC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACpF,IAAI,SAAS,EAAE,CAAC;gBACd,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;YACpD,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9bD,4CA8bC","sourcesContent":["import { ISaxNode } from '../../sax-node'\r\nimport { Dictionary } from '../../../collections'\r\nimport { XsdParser } from './xsd-parser'\r\nimport {\r\n ContainedGroupField,\r\n ContainedFieldSet,\r\n ContainedComponentField,\r\n ContainedSimpleField,\r\n ContainedField\r\n} from '../../contained'\r\nimport {\r\n MessageDefinition,\r\n FixDefinitions,\r\n GroupFieldDefinition,\r\n ComponentFieldDefinition\r\n} from '../../definition'\r\n\r\nexport class ComponentsParser extends XsdParser {\r\n private readonly attributeGroups: Dictionary<IAttributeGroup> = new Dictionary<IAttributeGroup>()\r\n private readonly groups: Dictionary<IGroup> = new Dictionary<IGroup>()\r\n private readonly unboundElements: IElement[] = []\r\n private readonly complexTypes: Dictionary<IComplexType> = new Dictionary<IComplexType>()\r\n\r\n private newComplexTypes: IComplexType[]\r\n private currentGroup: (IGroup | null)\r\n private readonly currentAttributeGroupStack: IAttributeGroup[] = []\r\n private currentComplexType: (IComplexType | null)\r\n private previousComplexType: IComplexType\r\n\r\n public constructor (public readonly definitions: FixDefinitions) {\r\n super(definitions)\r\n }\r\n\r\n private static getName (group: (IGroup | null), attributeGroup: (IAttributeGroup | null), type: IComplexType): string {\r\n let name: string\r\n if (type?.appInfo) {\r\n name = type.appInfo.name\r\n } else if (group) {\r\n name = group.name\r\n } else if (attributeGroup) {\r\n name = attributeGroup.name\r\n } else {\r\n name = type.name\r\n }\r\n return name\r\n }\r\n\r\n public value (line: number, n: string, v: string): void {\r\n // do nothing\r\n switch (n) {\r\n case 'xs:documentation': {\r\n if (this.currentComplexType?.annotation) {\r\n this.currentComplexType.annotation.documentation = v\r\n }\r\n break\r\n }\r\n }\r\n this.pending = null\r\n }\r\n\r\n public close (line: number, node: string): void {\r\n switch (node) {\r\n case 'xs:complexType': {\r\n if (this.currentComplexType != null) {\r\n const complex: IComplexType = this.currentComplexType\r\n this.previousComplexType = complex\r\n this.complexTypes.addUpdate(complex.name, complex)\r\n this.newComplexTypes.push(complex)\r\n this.currentComplexType = null\r\n }\r\n break\r\n }\r\n\r\n case 'xs:group': {\r\n if (this.currentGroup) {\r\n this.groups.addUpdate(this.currentGroup.name, this.currentGroup)\r\n this.currentGroup = null\r\n }\r\n break\r\n }\r\n\r\n case 'xs:attributeGroup': {\r\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (attributeStack.length > 0) {\r\n const group: IAttributeGroup | undefined = attributeStack.pop()\r\n if (group?.name) {\r\n this.attributeGroups.addUpdate(group?.name, group)\r\n }\r\n }\r\n break\r\n }\r\n\r\n case 'xs:schema': {\r\n this.insertFields()\r\n break\r\n }\r\n }\r\n }\r\n\r\n public open (line: number, node: ISaxNode): void {\r\n switch (node.name) {\r\n case 'xs:schema': {\r\n this.newComplexTypes = []\r\n break\r\n }\r\n\r\n case 'xs:group': {\r\n this.xsGroup(node)\r\n break\r\n }\r\n\r\n case 'xs:attributeGroup': {\r\n this.xsAttributeGroup(node)\r\n break\r\n }\r\n\r\n case 'xs:element': {\r\n this.xsElement(node)\r\n break\r\n }\r\n\r\n case 'xs:appinfo': {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.appInfo = {} as IAppInfo\r\n }\r\n break\r\n }\r\n\r\n case 'xs:attribute': {\r\n this.xsAttribute(node)\r\n break\r\n }\r\n\r\n case 'xs:complexType': {\r\n const unbound: IElement[] = this.unboundElements\r\n this.currentComplexType = {\r\n name: node.attributes.name || unbound[unbound.length - 1].name\r\n } as IComplexType\r\n break\r\n }\r\n\r\n case 'xs:extension': {\r\n const current: IComplexType | null = this.currentComplexType\r\n if (current && node.attributes.base) {\r\n current.extensionBase = node.attributes.base\r\n }\r\n break\r\n }\r\n\r\n case 'fm:Xref': {\r\n this.assign(node, this.currentComplexType?.appInfo)\r\n break\r\n }\r\n\r\n case 'xs:annotation': {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.annotation = {} as IAnnotation\r\n }\r\n break\r\n }\r\n\r\n case 'xs:documentation': {\r\n if (this.currentComplexType) {\r\n this.pending = node.name\r\n }\r\n break\r\n }\r\n }\r\n }\r\n\r\n private xsAttribute (node: ISaxNode): void {\r\n const attribute: IAttribute = {} as IAttribute\r\n this.assign(node, attribute)\r\n const stack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (stack.length > 0) {\r\n const peek: IAttributeGroup = stack[stack.length - 1]\r\n const groupAttributes: IAttribute[] = peek.attributes\r\n groupAttributes[groupAttributes.length] = attribute\r\n }\r\n }\r\n\r\n private xsGroup (node: ISaxNode): void {\r\n if (node.attributes.name) {\r\n this.currentGroup = {\r\n name: node.attributes.name,\r\n elements: [] as IElement[]\r\n } as IGroup\r\n } else if (node.attributes.ref) {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.group = node.attributes.ref\r\n } else if (this.currentGroup) {\r\n // this is part of a sequence for a group\r\n const elements = this.currentGroup.elements\r\n elements[elements.length] = {\r\n type: node.name,\r\n name: node.attributes.ref\r\n } as IElement\r\n }\r\n }\r\n }\r\n\r\n private xsAttributeGroup (node: ISaxNode): void {\r\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (node.attributes.name) {\r\n attributeStack.push({\r\n name: node.attributes.name,\r\n attributes: [] as IAttribute[]\r\n } as IAttributeGroup)\r\n } else if (node.attributes.ref) {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.attributeGroup = node.attributes.ref\r\n } else if (attributeStack.length > 0) {\r\n const peek: IAttributeGroup = attributeStack[attributeStack.length - 1]\r\n peek.attributes[peek.attributes.length] = {\r\n type: node.name,\r\n name: node.attributes.ref\r\n } as IAttribute\r\n }\r\n }\r\n }\r\n\r\n private xsElement (node: ISaxNode): void {\r\n const element: IElement = {} as IElement\r\n this.assign(node, element)\r\n const currentComplex: IComplexType | null = this.currentComplexType\r\n const currentGroup: IGroup | null = this.currentGroup\r\n if (!currentGroup && currentComplex) {\r\n if (!currentComplex.element) {\r\n currentComplex.element = []\r\n }\r\n const elements: IElement[] = currentComplex.element\r\n elements[elements.length] = element\r\n } else if (currentGroup) {\r\n const elements: IElement[] = currentGroup.elements\r\n elements[elements.length] = element\r\n } else {\r\n if (element.substitutionGroup && this.previousComplexType) {\r\n this.previousComplexType.messageName = element.name\r\n } else {\r\n this.unboundElements.push(element)\r\n }\r\n }\r\n }\r\n\r\n private addElement (set: ContainedFieldSet, element: IElement): void {\r\n const minOccurs: number = parseInt(element.minOccurs, 10)\r\n const isGroup: boolean = element.maxOccurs === 'unbounded'\r\n const isComponent: boolean = element.maxOccurs === '1' || !isGroup\r\n const key = element.type || element.ref || element.name\r\n const containedType: IComplexType | null = this.complexTypes.get(key)\r\n if (containedType) {\r\n if (isComponent) {\r\n const containedDefinition: ComponentFieldDefinition = this.getComponent(containedType)\r\n const containedField: ContainedComponentField =\r\n new ContainedComponentField(containedDefinition,\r\n set.fields.length,\r\n minOccurs > 0,\r\n element.name)\r\n set.add(containedField)\r\n } else if (isGroup) {\r\n const containedDefinition: GroupFieldDefinition = this.getGroup(containedType)\r\n const containedField: ContainedGroupField =\r\n new ContainedGroupField(containedDefinition,\r\n set.fields.length,\r\n minOccurs > 0,\r\n element.name)\r\n set.add(containedField)\r\n }\r\n } else {\r\n if (key !== 'Message') {\r\n throw new Error(`cannot resolve component ${key} contained in ${set.name}`)\r\n }\r\n }\r\n }\r\n\r\n private addElements (set: ContainedFieldSet, elements: IElement[]): void {\r\n if (elements) {\r\n elements.forEach((element: IElement) => {\r\n switch (element.type) {\r\n case 'xs:group': {\r\n const groupElements: IGroup | null = this.groups.get(element.name)\r\n if (groupElements) {\r\n this.addElements(set, groupElements.elements)\r\n } else {\r\n throw new Error(`unable to get xs:group ${element.name}`)\r\n }\r\n }\r\n break\r\n\r\n default: {\r\n this.addElement(set, element)\r\n }\r\n }\r\n })\r\n }\r\n }\r\n\r\n private addSimpleAttribute (set: ContainedFieldSet, attribute: IAttribute): void {\r\n let sf = this.definitions.getSimple(attribute.type)\r\n if (!sf) {\r\n sf = this.definitions.getSimple(attribute.name, set.category)\r\n }\r\n if (sf) {\r\n const contained: ContainedSimpleField = new ContainedSimpleField(sf,\r\n set.fields.length,\r\n attribute.use !== 'optional',\r\n true,\r\n attribute.name)\r\n set.add(contained)\r\n } else if (set.name !== 'FixmlAttributes') {\r\n throw new Error(`unable to resolve simple attribute ${attribute.name}`)\r\n }\r\n }\r\n\r\n private addAttributes (set: ContainedFieldSet, attributes: IAttribute[]): void {\r\n attributes.forEach((attribute: IAttribute) => {\r\n switch (attribute.type) {\r\n case 'xs:attributeGroup': {\r\n const attributeGroup: IAttributeGroup | null = this.attributeGroups.get(attribute.name)\r\n if (attributeGroup) {\r\n this.addAttributes(set, attributeGroup.attributes)\r\n } else {\r\n throw new Error(`unable to get xs:attributeGroup ${attribute.name}`)\r\n }\r\n break\r\n }\r\n\r\n default: {\r\n this.addSimpleAttribute(set, attribute)\r\n }\r\n }\r\n })\r\n }\r\n\r\n private getGroup (type: IComplexType): GroupFieldDefinition {\r\n const group: IGroup | null = this.groups.get(type.group)\r\n const attributeGroup: IAttributeGroup | null = this.attributeGroups.get(type.attributeGroup)\r\n const name: string = ComponentsParser.getName(group, attributeGroup, type)\r\n const category = type.appInfo != null ? type.appInfo.Category : null\r\n const groupDefinition: GroupFieldDefinition = new GroupFieldDefinition(name, name, category, null, null)\r\n this.populateSet(type, groupDefinition)\r\n return groupDefinition\r\n }\r\n\r\n private getComponent (type: IComplexType): ComponentFieldDefinition {\r\n const definitions: FixDefinitions = this.definitions\r\n const group: IGroup | null = this.groups.get(type.group)\r\n const attributeGroup: IAttributeGroup | null = this.attributeGroups.get(type.attributeGroup)\r\n let name: string = ComponentsParser.getName(group, attributeGroup, type)\r\n const cached: ComponentFieldDefinition | null = definitions.component.get(name)\r\n if (cached) {\r\n return cached\r\n }\r\n\r\n const category = type.appInfo != null ? type.appInfo.Category : null\r\n if (type.extensionBase) {\r\n const base: IComplexType | null = this.complexTypes.get(type.extensionBase)\r\n if (base) {\r\n name = base.appInfo.name\r\n }\r\n }\r\n const component: ComponentFieldDefinition = new ComponentFieldDefinition(name, name, category, null)\r\n this.populateSet(type, component)\r\n definitions.component.addUpdate(component.name, component)\r\n definitions.component.addUpdate(type.name, component)\r\n return component\r\n }\r\n\r\n private getMessage (type: IComplexType): MessageDefinition {\r\n const definitions: FixDefinitions = this.definitions\r\n const messages = definitions.message\r\n const name: string = type.appInfo.name\r\n const message: MessageDefinition = new MessageDefinition(name,\r\n type.messageName,\r\n type.appInfo.MsgID,\r\n type.appInfo.Category,\r\n type.annotation.documentation)\r\n const abstractMessage: ComponentFieldDefinition | null = definitions.component.get('Message')\r\n abstractMessage?.fields.forEach((f: ContainedField) => {\r\n message.add(f)\r\n })\r\n this.populateSet(type, message)\r\n messages.addUpdate(message.name, message)\r\n if (type.messageName && type.messageName !== name) {\r\n messages.addUpdate(type.messageName, message)\r\n }\r\n\r\n return message\r\n }\r\n\r\n private getBaseAttributes (type: IComplexType): (IAttributeGroup | null) {\r\n const attributeGroups: Dictionary<IAttributeGroup> = this.attributeGroups\r\n let baseGroup\r\n if (type.extensionBase) {\r\n const base: IComplexType | null = this.complexTypes.get(type.extensionBase)\r\n if (base) {\r\n baseGroup = attributeGroups.get(base.attributeGroup)\r\n }\r\n return baseGroup ?? null\r\n }\r\n return null\r\n }\r\n\r\n private populateSet (type: IComplexType, set: ContainedFieldSet): void {\r\n const group: IGroup | null = this.groups.get(type.group)\r\n const elements: IElement[] = group ? group.elements : type.element\r\n const attributeGroups = this.attributeGroups\r\n const attributeGroup: IAttributeGroup | null = attributeGroups.get(type.attributeGroup)\r\n const baseGroup: IAttributeGroup | null = this.getBaseAttributes(type)\r\n // if a base is specified add the attributes from there\r\n if (baseGroup) {\r\n this.addAttributes(set, baseGroup.attributes)\r\n }\r\n if (attributeGroup) {\r\n this.addAttributes(set, attributeGroup.attributes)\r\n }\r\n this.addElements(set, elements)\r\n }\r\n\r\n private constructType (type: IComplexType): void {\r\n const componentType: string = type.appInfo != null ? type.appInfo.ComponentType : 'Block'\r\n switch (componentType) {\r\n case 'Message': {\r\n const message: MessageDefinition = this.getMessage(type)\r\n if (!message) {\r\n throw new Error(`cannot resolve ${type.name}`)\r\n }\r\n break\r\n }\r\n\r\n // these may be included from top level messages and added into definitions\r\n case 'Block': {\r\n const component: ComponentFieldDefinition = this.getComponent(type)\r\n if (!component) {\r\n throw new Error(`cannot resolve ${type.name}`)\r\n }\r\n break\r\n }\r\n\r\n case 'ImplicitBlock':\r\n case 'XMLDataBlock':\r\n case 'BlockRepeating':\r\n case 'ImplicitBlockRepeating': {\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown type ${componentType}`)\r\n }\r\n }\r\n\r\n private insertFields (): void {\r\n this.newComplexTypes.forEach((type: IComplexType) => {\r\n this.constructType(type)\r\n })\r\n this.unboundElements.forEach((e: IElement) => {\r\n const definitions = this.definitions\r\n const component: ComponentFieldDefinition | null = definitions.component.get(e.type)\r\n if (component) {\r\n definitions.component.addUpdate(e.name, component)\r\n }\r\n })\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"components-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/components-parser.ts"],"names":[],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EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;YACpC,MAAM,SAAS,GAAyC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACzF,IAAI,SAAS,EAAE,CAAC;gBACd,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAjcD,4CAicC","sourcesContent":["import { ISaxNode } from '../../sax-node'\r\nimport { XsdParser } from './xsd-parser'\r\nimport {\r\n ContainedGroupField,\r\n IContainedSet,\r\n ContainedSetBuilder,\r\n ContainedComponentField,\r\n ContainedSimpleField,\r\n ContainedField\r\n} from '../../contained'\r\nimport {\r\n MessageDefinition,\r\n FixDefinitions,\r\n GroupFieldDefinition,\r\n ComponentFieldDefinition\r\n} from '../../definition'\r\n\r\nexport class ComponentsParser extends XsdParser {\r\n private readonly attributeGroups: Map<string, IAttributeGroup> = new Map<string, IAttributeGroup>()\r\n private readonly groups: Map<string, IGroup> = new Map<string, IGroup>()\r\n private readonly unboundElements: IElement[] = []\r\n private readonly complexTypes: Map<string, IComplexType> = new Map<string, IComplexType>()\r\n\r\n private newComplexTypes: IComplexType[]\r\n private currentGroup: (IGroup | null)\r\n private readonly currentAttributeGroupStack: IAttributeGroup[] = []\r\n private currentComplexType: (IComplexType | null)\r\n private previousComplexType: IComplexType\r\n\r\n public constructor (public readonly definitions: FixDefinitions) {\r\n super(definitions)\r\n }\r\n\r\n private static getName (group: (IGroup | undefined), attributeGroup: (IAttributeGroup | undefined), type: IComplexType): string {\r\n let name: string\r\n if (type?.appInfo) {\r\n name = type.appInfo.name\r\n } else if (group) {\r\n name = group.name\r\n } else if (attributeGroup) {\r\n name = attributeGroup.name\r\n } else {\r\n name = type.name\r\n }\r\n return name\r\n }\r\n\r\n public value (line: number, n: string, v: string): void {\r\n // do nothing\r\n switch (n) {\r\n case 'xs:documentation': {\r\n if (this.currentComplexType?.annotation) {\r\n this.currentComplexType.annotation.documentation = v\r\n }\r\n break\r\n }\r\n }\r\n this.pending = null\r\n }\r\n\r\n public close (line: number, node: string): void {\r\n switch (node) {\r\n case 'xs:complexType': {\r\n if (this.currentComplexType != null) {\r\n const complex: IComplexType = this.currentComplexType\r\n this.previousComplexType = complex\r\n this.complexTypes.set(complex.name, complex)\r\n this.newComplexTypes.push(complex)\r\n this.currentComplexType = null\r\n }\r\n break\r\n }\r\n\r\n case 'xs:group': {\r\n if (this.currentGroup) {\r\n this.groups.set(this.currentGroup.name, this.currentGroup)\r\n this.currentGroup = null\r\n }\r\n break\r\n }\r\n\r\n case 'xs:attributeGroup': {\r\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (attributeStack.length > 0) {\r\n const group: IAttributeGroup | undefined = attributeStack.pop()\r\n if (group?.name) {\r\n this.attributeGroups.set(group?.name, group)\r\n }\r\n }\r\n break\r\n }\r\n\r\n case 'xs:schema': {\r\n this.insertFields()\r\n break\r\n }\r\n }\r\n }\r\n\r\n public open (line: number, node: ISaxNode): void {\r\n switch (node.name) {\r\n case 'xs:schema': {\r\n this.newComplexTypes = []\r\n break\r\n }\r\n\r\n case 'xs:group': {\r\n this.xsGroup(node)\r\n break\r\n }\r\n\r\n case 'xs:attributeGroup': {\r\n this.xsAttributeGroup(node)\r\n break\r\n }\r\n\r\n case 'xs:element': {\r\n this.xsElement(node)\r\n break\r\n }\r\n\r\n case 'xs:appinfo': {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.appInfo = {} as IAppInfo\r\n }\r\n break\r\n }\r\n\r\n case 'xs:attribute': {\r\n this.xsAttribute(node)\r\n break\r\n }\r\n\r\n case 'xs:complexType': {\r\n const unbound: IElement[] = this.unboundElements\r\n this.currentComplexType = {\r\n name: node.attributes.name || unbound[unbound.length - 1].name\r\n } as IComplexType\r\n break\r\n }\r\n\r\n case 'xs:extension': {\r\n const current: IComplexType | null = this.currentComplexType\r\n if (current && node.attributes.base) {\r\n current.extensionBase = node.attributes.base\r\n }\r\n break\r\n }\r\n\r\n case 'fm:Xref': {\r\n this.assign(node, this.currentComplexType?.appInfo)\r\n break\r\n }\r\n\r\n case 'xs:annotation': {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.annotation = {} as IAnnotation\r\n }\r\n break\r\n }\r\n\r\n case 'xs:documentation': {\r\n if (this.currentComplexType) {\r\n this.pending = node.name\r\n }\r\n break\r\n }\r\n }\r\n }\r\n\r\n private xsAttribute (node: ISaxNode): void {\r\n const attribute: IAttribute = {} as IAttribute\r\n this.assign(node, attribute)\r\n const stack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (stack.length > 0) {\r\n const peek: IAttributeGroup = stack[stack.length - 1]\r\n const groupAttributes: IAttribute[] = peek.attributes\r\n groupAttributes[groupAttributes.length] = attribute\r\n }\r\n }\r\n\r\n private xsGroup (node: ISaxNode): void {\r\n if (node.attributes.name) {\r\n this.currentGroup = {\r\n name: node.attributes.name,\r\n elements: [] as IElement[]\r\n } as IGroup\r\n } else if (node.attributes.ref) {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.group = node.attributes.ref\r\n } else if (this.currentGroup) {\r\n // this is part of a sequence for a group\r\n const elements = this.currentGroup.elements\r\n elements[elements.length] = {\r\n type: node.name,\r\n name: node.attributes.ref\r\n } as IElement\r\n }\r\n }\r\n }\r\n\r\n private xsAttributeGroup (node: ISaxNode): void {\r\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\r\n if (node.attributes.name) {\r\n attributeStack.push({\r\n name: node.attributes.name,\r\n attributes: [] as IAttribute[]\r\n } as IAttributeGroup)\r\n } else if (node.attributes.ref) {\r\n if (this.currentComplexType) {\r\n this.currentComplexType.attributeGroup = node.attributes.ref\r\n } else if (attributeStack.length > 0) {\r\n const peek: IAttributeGroup = attributeStack[attributeStack.length - 1]\r\n peek.attributes[peek.attributes.length] = {\r\n type: node.name,\r\n name: node.attributes.ref\r\n } as IAttribute\r\n }\r\n }\r\n }\r\n\r\n private xsElement (node: ISaxNode): void {\r\n const element: IElement = {} as IElement\r\n this.assign(node, element)\r\n const currentComplex: IComplexType | null = this.currentComplexType\r\n const currentGroup: IGroup | null = this.currentGroup\r\n if (!currentGroup && currentComplex) {\r\n if (!currentComplex.element) {\r\n currentComplex.element = []\r\n }\r\n const elements: IElement[] = currentComplex.element\r\n elements[elements.length] = element\r\n } else if (currentGroup) {\r\n const elements: IElement[] = currentGroup.elements\r\n elements[elements.length] = element\r\n } else {\r\n if (element.substitutionGroup && this.previousComplexType) {\r\n this.previousComplexType.messageName = element.name\r\n } else {\r\n this.unboundElements.push(element)\r\n }\r\n }\r\n }\r\n\r\n private addElement (set: IContainedSet, element: IElement): void {\r\n const minOccurs: number = parseInt(element.minOccurs, 10)\r\n const isGroup: boolean = element.maxOccurs === 'unbounded'\r\n const isComponent: boolean = element.maxOccurs === '1' || !isGroup\r\n const key = element.type || element.ref || element.name\r\n const builder = new ContainedSetBuilder(set)\r\n const containedType: IComplexType | undefined = this.complexTypes.get(key)\r\n if (containedType) {\r\n if (isComponent) {\r\n const containedDefinition: ComponentFieldDefinition = this.getComponent(containedType)\r\n const containedField: ContainedComponentField =\r\n new ContainedComponentField(containedDefinition,\r\n set.fields.length,\r\n minOccurs > 0,\r\n element.name)\r\n builder.add(containedField)\r\n } else if (isGroup) {\r\n const containedDefinition: GroupFieldDefinition = this.getGroup(containedType)\r\n const containedField: ContainedGroupField =\r\n new ContainedGroupField(containedDefinition,\r\n set.fields.length,\r\n minOccurs > 0,\r\n element.name)\r\n builder.add(containedField)\r\n }\r\n } else {\r\n if (key !== 'Message') {\r\n throw new Error(`cannot resolve component ${key} contained in ${set.name}`)\r\n }\r\n }\r\n }\r\n\r\n private addElements (set: IContainedSet, elements: IElement[]): void {\r\n if (elements) {\r\n elements.forEach((element: IElement) => {\r\n switch (element.type) {\r\n case 'xs:group': {\r\n const groupElements: IGroup | undefined = this.groups.get(element.name)\r\n if (groupElements) {\r\n this.addElements(set, groupElements.elements)\r\n } else {\r\n throw new Error(`unable to get xs:group ${element.name}`)\r\n }\r\n }\r\n break\r\n\r\n default: {\r\n this.addElement(set, element)\r\n }\r\n }\r\n })\r\n }\r\n }\r\n\r\n private addSimpleAttribute (set: IContainedSet, attribute: IAttribute): void {\r\n let sf = this.definitions.getSimple(attribute.type)\r\n if (!sf) {\r\n sf = this.definitions.getSimple(attribute.name, set.category)\r\n }\r\n if (sf) {\r\n const contained: ContainedSimpleField = new ContainedSimpleField(sf,\r\n set.fields.length,\r\n attribute.use !== 'optional',\r\n true,\r\n attribute.name)\r\n const builder = new ContainedSetBuilder(set)\r\n builder.add(contained)\r\n } else if (set.name !== 'FixmlAttributes') {\r\n throw new Error(`unable to resolve simple attribute ${attribute.name}`)\r\n }\r\n }\r\n\r\n private addAttributes (set: IContainedSet, attributes: IAttribute[]): void {\r\n attributes.forEach((attribute: IAttribute) => {\r\n switch (attribute.type) {\r\n case 'xs:attributeGroup': {\r\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(attribute.name)\r\n if (attributeGroup) {\r\n this.addAttributes(set, attributeGroup.attributes)\r\n } else {\r\n throw new Error(`unable to get xs:attributeGroup ${attribute.name}`)\r\n }\r\n break\r\n }\r\n\r\n default: {\r\n this.addSimpleAttribute(set, attribute)\r\n }\r\n }\r\n })\r\n }\r\n\r\n private getGroup (type: IComplexType): GroupFieldDefinition {\r\n const group: IGroup | undefined = this.groups.get(type.group)\r\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\r\n const name: string = ComponentsParser.getName(group, attributeGroup, type)\r\n const category = type.appInfo != null ? type.appInfo.Category : null\r\n const groupDefinition: GroupFieldDefinition = new GroupFieldDefinition(name, name, category, null, null)\r\n this.populateSet(type, groupDefinition)\r\n return groupDefinition\r\n }\r\n\r\n private getComponent (type: IComplexType): ComponentFieldDefinition {\r\n const definitions: FixDefinitions = this.definitions\r\n const group: IGroup | undefined = this.groups.get(type.group)\r\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\r\n let name: string = ComponentsParser.getName(group, attributeGroup, type)\r\n const cached: ComponentFieldDefinition | undefined = definitions.component.get(name)\r\n if (cached) {\r\n return cached\r\n }\r\n\r\n const category = type.appInfo != null ? type.appInfo.Category : null\r\n if (type.extensionBase) {\r\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\r\n if (base) {\r\n name = base.appInfo.name\r\n }\r\n }\r\n const component: ComponentFieldDefinition = new ComponentFieldDefinition(name, name, category, null)\r\n this.populateSet(type, component)\r\n definitions.component.set(component.name, component)\r\n definitions.component.set(type.name, component)\r\n return component\r\n }\r\n\r\n private getMessage (type: IComplexType): MessageDefinition {\r\n const definitions: FixDefinitions = this.definitions\r\n const messages = definitions.message\r\n const name: string = type.appInfo.name\r\n const message: MessageDefinition = new MessageDefinition(name,\r\n type.messageName,\r\n type.appInfo.MsgID,\r\n type.appInfo.Category,\r\n type.annotation.documentation)\r\n const builder = new ContainedSetBuilder(message)\r\n const abstractMessage: ComponentFieldDefinition | undefined = definitions.component.get('Message')\r\n abstractMessage?.fields.forEach((f: ContainedField) => {\r\n builder.add(f)\r\n })\r\n this.populateSet(type, message)\r\n messages.set(message.name, message)\r\n if (type.messageName && type.messageName !== name) {\r\n messages.set(type.messageName, message)\r\n }\r\n\r\n return message\r\n }\r\n\r\n private getBaseAttributes (type: IComplexType): (IAttributeGroup | null) {\r\n const attributeGroups: Map<string, IAttributeGroup> = this.attributeGroups\r\n let baseGroup\r\n if (type.extensionBase) {\r\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\r\n if (base) {\r\n baseGroup = attributeGroups.get(base.attributeGroup)\r\n }\r\n return baseGroup ?? null\r\n }\r\n return null\r\n }\r\n\r\n private populateSet (type: IComplexType, set: IContainedSet): void {\r\n const group: IGroup | undefined = this.groups.get(type.group)\r\n const elements: IElement[] = group ? group.elements : type.element\r\n const attributeGroups = this.attributeGroups\r\n const attributeGroup: IAttributeGroup | undefined = attributeGroups.get(type.attributeGroup)\r\n const baseGroup: IAttributeGroup | null = this.getBaseAttributes(type)\r\n // if a base is specified add the attributes from there\r\n if (baseGroup) {\r\n this.addAttributes(set, baseGroup.attributes)\r\n }\r\n if (attributeGroup) {\r\n this.addAttributes(set, attributeGroup.attributes)\r\n }\r\n this.addElements(set, elements)\r\n }\r\n\r\n private constructType (type: IComplexType): void {\r\n const componentType: string = type.appInfo != null ? type.appInfo.ComponentType : 'Block'\r\n switch (componentType) {\r\n case 'Message': {\r\n const message: MessageDefinition = this.getMessage(type)\r\n if (!message) {\r\n throw new Error(`cannot resolve ${type.name}`)\r\n }\r\n break\r\n }\r\n\r\n // these may be included from top level messages and added into definitions\r\n case 'Block': {\r\n const component: ComponentFieldDefinition = this.getComponent(type)\r\n if (!component) {\r\n throw new Error(`cannot resolve ${type.name}`)\r\n }\r\n break\r\n }\r\n\r\n case 'ImplicitBlock':\r\n case 'XMLDataBlock':\r\n case 'BlockRepeating':\r\n case 'ImplicitBlockRepeating': {\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown type ${componentType}`)\r\n }\r\n }\r\n\r\n private insertFields (): void {\r\n this.newComplexTypes.forEach((type: IComplexType) => {\r\n this.constructType(type)\r\n })\r\n this.unboundElements.forEach((e: IElement) => {\r\n const definitions = this.definitions\r\n const component: ComponentFieldDefinition | undefined = definitions.component.get(e.type)\r\n if (component) {\r\n definitions.component.set(e.name, component)\r\n }\r\n })\r\n }\r\n}\r\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FieldsParser = void 0;
4
- const collections_1 = require("../../../collections");
5
4
  const definition_1 = require("../../definition");
6
5
  const xsd_parser_1 = require("./xsd-parser");
7
6
  class FieldsParser extends xsd_parser_1.XsdParser {
@@ -14,7 +13,7 @@ class FieldsParser extends xsd_parser_1.XsdParser {
14
13
  const current = this.current;
15
14
  switch (n) {
16
15
  case 'fm:EnumDoc': {
17
- current.enums.add(current.currentEnum, v);
16
+ current.enums.set(current.currentEnum, v);
18
17
  break;
19
18
  }
20
19
  case 'xs:documentation': {
@@ -54,7 +53,7 @@ class FieldsParser extends xsd_parser_1.XsdParser {
54
53
  }
55
54
  case 'fm:EnumDoc': {
56
55
  if (!this.current.enums) {
57
- this.current.enums = new collections_1.Dictionary();
56
+ this.current.enums = new Map();
58
57
  }
59
58
  this.current.currentEnum = node.attributes.value;
60
59
  this.pending = node.name;
@@ -1 +1 @@
1
- {"version":3,"file":"fields-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/fields-parser.ts"],"names":[],"mappings":";;;AACA,sDAAiD;AACjD,iDAAwE;AACxE,6CAAwC;AAwBxC,MAAa,YAAa,SAAQ,sBAAS;IAEzC,YAAoC,WAA2B;QAC7D,KAAK,CAAC,WAAW,CAAC,CAAA;QADgB,gBAAW,GAAX,WAAW,CAAgB;QAD9C,UAAK,GAAa,EAAE,CAAA;IAGrC,CAAC;IAEM,KAAK,CAAE,IAAY,EAAE,CAAS,EAAE,CAAS;QAC9C,MAAM,OAAO,GAAiB,IAAI,CAAC,OAAuB,CAAA;QAC1D,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,YAAY,CAAC,CAAC,CAAC;gBAClB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;gBACzC,MAAK;YACP,CAAC;YACD,KAAK,kBAAkB,CAAC,CAAC,CAAC;gBACxB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;gBAC9B,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IAEM,KAAK,CAAE,IAAY,EAAE,IAAY;QACtC,MAAM,OAAO,GAAiB,IAAI,CAAC,OAAuB,CAAA;QAC1D,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,eAAe,CAAC,CAAC,CAAC;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,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtGD,oCAsGC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\r\nimport { Dictionary } from '../../../collections'\r\nimport { SimpleFieldDefinition, FixDefinitions } from '../../definition'\r\nimport { XsdParser } from './xsd-parser'\r\nimport { ISaxNode } from '../../sax-node'\r\n\r\ninterface ISimpleField extends ILooseObject {\r\n restrictionBase: string\r\n documentation: string\r\n Protocol: string\r\n simpleTypeName: string\r\n name: string\r\n ComponentType: string\r\n Tag: string\r\n Type: string\r\n AbbrName: string\r\n Category: string\r\n CategoryAbbrName: string\r\n enums: Dictionary<string>\r\n currentEnum: string\r\n}\r\n\r\ninterface IAlias {\r\n name: string\r\n mapped: string\r\n}\r\n\r\nexport class FieldsParser extends XsdParser {\r\n private readonly alias: IAlias[] = []\r\n public constructor (public readonly definitions: FixDefinitions) {\r\n super(definitions)\r\n }\r\n\r\n public value (line: number, n: string, v: string): void {\r\n const current: ISimpleField = this.current as ISimpleField\r\n switch (n) {\r\n case 'fm:EnumDoc': {\r\n current.enums.add(current.currentEnum, v)\r\n break\r\n }\r\n case 'xs:documentation': {\r\n this.current.documentation = v\r\n break\r\n }\r\n }\r\n }\r\n\r\n public close (line: number, node: string): void {\r\n const current: ISimpleField = this.current as ISimpleField\r\n switch (node) {\r\n case 'xs:simpleType': {\r\n this.data[this.data.length] = current\r\n break\r\n }\r\n\r\n case 'xs:schema': {\r\n this.insertFields()\r\n break\r\n }\r\n }\r\n }\r\n\r\n public open (line: number, node: ISaxNode): void {\r\n switch (node.name) {\r\n case 'xs:simpleType': {\r\n this.current = {\r\n simpleTypeName: node.attributes.name\r\n } as ISimpleField\r\n break\r\n }\r\n\r\n case 'fm:Xref': {\r\n this.assign(node)\r\n break\r\n }\r\n\r\n case 'xs:restriction': {\r\n this.current.restrictionBase = node.attributes.base\r\n break\r\n }\r\n\r\n case 'fm:EnumDoc': {\r\n if (!this.current.enums) {\r\n this.current.enums = new Dictionary<string>()\r\n }\r\n this.current.currentEnum = node.attributes.value\r\n this.pending = node.name\r\n break\r\n }\r\n\r\n default:\r\n this.pending = node.name\r\n }\r\n }\r\n\r\n private insertFields (): void {\r\n const alias = this.alias\r\n this.data.forEach((f: ISimpleField) => {\r\n const sf: SimpleFieldDefinition = new SimpleFieldDefinition(f.Tag,\r\n f.name,\r\n f.AbbrName,\r\n f.Category,\r\n f.CategoryAbbrName,\r\n f.Type,\r\n f.documentation)\r\n if (f.enums) {\r\n f.enums.forEach((k: string, v: string) => {\r\n sf.addEnum(k, v)\r\n })\r\n }\r\n if (f.name && f.Type && f.Tag) {\r\n this.definitions.addSimpleFieldDef(sf, f.simpleTypeName)\r\n } else if (f.restrictionBase && f.simpleTypeName) {\r\n let mapped = f.simpleTypeName\r\n if (mapped.endsWith('_t')) {\r\n mapped = mapped.replace(/_t$/, '')\r\n } else {\r\n mapped = f.restrictionBase\r\n }\r\n alias.push({\r\n name: f.simpleTypeName,\r\n mapped\r\n })\r\n }\r\n })\r\n alias.forEach((a: IAlias) => {\r\n this.definitions.addSimpleAlias(a.mapped, a.name)\r\n })\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"fields-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/fields-parser.ts"],"names":[],"mappings":";;;AACA,iDAAwE;AACxE,6CAAwC;AAwBxC,MAAa,YAAa,SAAQ,sBAAS;IAEzC,YAAoC,WAA2B;QAC7D,KAAK,CAAC,WAAW,CAAC,CAAA;QADgB,gBAAW,GAAX,WAAW,CAAgB;QAD9C,UAAK,GAAa,EAAE,CAAA;IAGrC,CAAC;IAEM,KAAK,CAAE,IAAY,EAAE,CAAS,EAAE,CAAS;QAC9C,MAAM,OAAO,GAAiB,IAAI,CAAC,OAAuB,CAAA;QAC1D,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,YAAY,CAAC,CAAC,CAAC;gBAClB,OAAO,CAAC,KAAK,C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AAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;gBACpC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC,CAAC,eAAe,CAAA;gBAC5B,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,CAAC,CAAC,cAAc;oBACtB,MAAM;iBACP,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtGD,oCAsGC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\r\nimport { SimpleFieldDefinition, FixDefinitions } from '../../definition'\r\nimport { XsdParser } from './xsd-parser'\r\nimport { ISaxNode } from '../../sax-node'\r\n\r\ninterface ISimpleField extends ILooseObject {\r\n restrictionBase: string\r\n documentation: string\r\n Protocol: string\r\n simpleTypeName: string\r\n name: string\r\n ComponentType: string\r\n Tag: string\r\n Type: string\r\n AbbrName: string\r\n Category: string\r\n CategoryAbbrName: string\r\n enums: Map<string, string>\r\n currentEnum: string\r\n}\r\n\r\ninterface IAlias {\r\n name: string\r\n mapped: string\r\n}\r\n\r\nexport class FieldsParser extends XsdParser {\r\n private readonly alias: IAlias[] = []\r\n public constructor (public readonly definitions: FixDefinitions) {\r\n super(definitions)\r\n }\r\n\r\n public value (line: number, n: string, v: string): void {\r\n const current: ISimpleField = this.current as ISimpleField\r\n switch (n) {\r\n case 'fm:EnumDoc': {\r\n current.enums.set(current.currentEnum, v)\r\n break\r\n }\r\n case 'xs:documentation': {\r\n this.current.documentation = v\r\n break\r\n }\r\n }\r\n }\r\n\r\n public close (line: number, node: string): void {\r\n const current: ISimpleField = this.current as ISimpleField\r\n switch (node) {\r\n case 'xs:simpleType': {\r\n this.data[this.data.length] = current\r\n break\r\n }\r\n\r\n case 'xs:schema': {\r\n this.insertFields()\r\n break\r\n }\r\n }\r\n }\r\n\r\n public open (line: number, node: ISaxNode): void {\r\n switch (node.name) {\r\n case 'xs:simpleType': {\r\n this.current = {\r\n simpleTypeName: node.attributes.name\r\n } as ISimpleField\r\n break\r\n }\r\n\r\n case 'fm:Xref': {\r\n this.assign(node)\r\n break\r\n }\r\n\r\n case 'xs:restriction': {\r\n this.current.restrictionBase = node.attributes.base\r\n break\r\n }\r\n\r\n case 'fm:EnumDoc': {\r\n if (!this.current.enums) {\r\n this.current.enums = new Map<string, string>()\r\n }\r\n this.current.currentEnum = node.attributes.value\r\n this.pending = node.name\r\n break\r\n }\r\n\r\n default:\r\n this.pending = node.name\r\n }\r\n }\r\n\r\n private insertFields (): void {\r\n const alias = this.alias\r\n this.data.forEach((f: ISimpleField) => {\r\n const sf: SimpleFieldDefinition = new SimpleFieldDefinition(f.Tag,\r\n f.name,\r\n f.AbbrName,\r\n f.Category,\r\n f.CategoryAbbrName,\r\n f.Type,\r\n f.documentation)\r\n if (f.enums) {\r\n f.enums.forEach((k: string, v: string) => {\r\n sf.addEnum(k, v)\r\n })\r\n }\r\n if (f.name && f.Type && f.Tag) {\r\n this.definitions.addSimpleFieldDef(sf, f.simpleTypeName)\r\n } else if (f.restrictionBase && f.simpleTypeName) {\r\n let mapped = f.simpleTypeName\r\n if (mapped.endsWith('_t')) {\r\n mapped = mapped.replace(/_t$/, '')\r\n } else {\r\n mapped = f.restrictionBase\r\n }\r\n alias.push({\r\n name: f.simpleTypeName,\r\n mapped\r\n })\r\n }\r\n })\r\n alias.forEach((a: IAlias) => {\r\n this.definitions.addSimpleAlias(a.mapped, a.name)\r\n })\r\n }\r\n}\r\n"]}
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.IncludeGraph = void 0;
13
- const collections_1 = require("../../../collections");
14
13
  const path = require("path");
15
14
  const fs = require("fs");
16
15
  class IncludeGraph {
@@ -75,16 +74,16 @@ class IncludeGraph {
75
74
  assignNodes() {
76
75
  let next = 0;
77
76
  this.nodes = this.includes.reduce((a, current) => {
78
- if (!a.containsKey(current.parent)) {
79
- a.add(current.parent, next++);
77
+ if (!a.has(current.parent)) {
78
+ a.set(current.parent, next++);
80
79
  }
81
80
  current.children.forEach((c) => {
82
- if (!a.containsKey(c)) {
83
- a.add(c, next++);
81
+ if (!a.has(c)) {
82
+ a.set(c, next++);
84
83
  }
85
84
  });
86
85
  return a;
87
- }, new collections_1.Dictionary());
86
+ }, new Map());
88
87
  }
89
88
  scanIncludes(file) {
90
89
  return __awaiter(this, void 0, void 0, function* () {
@@ -116,16 +115,16 @@ class IncludeGraph {
116
115
  const q = [];
117
116
  q.push([main]);
118
117
  const ordered = [];
119
- const seen = new collections_1.Dictionary();
118
+ const seen = new Map();
120
119
  return yield new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
121
120
  try {
122
121
  while (q.length > 0) {
123
122
  const batch = q.pop();
124
123
  for (const next of batch) {
125
- if (seen.containsKey(next)) {
124
+ if (seen.has(next)) {
126
125
  continue;
127
126
  }
128
- seen.add(next, true);
127
+ seen.set(next, true);
129
128
  const includes = yield this.scanIncludes(next);
130
129
  ordered.push({
131
130
  parent: next,