jspurefix 3.5.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 (235) 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-memory-store.js +3 -4
  123. package/dist/store/fix-msg-memory-store.js.map +1 -1
  124. package/dist/store/fix-msg-store-record.js.map +1 -1
  125. package/dist/test/ascii/ascii-encoder.test.js.map +1 -1
  126. package/dist/test/ascii/fix-log-replay.test.js.map +1 -1
  127. package/dist/test/ascii/fix-repo-dict.test.js.map +1 -1
  128. package/dist/test/ascii/qf-50sp0-dict.test.js +7 -7
  129. package/dist/test/ascii/qf-50sp0-dict.test.js.map +1 -1
  130. package/dist/test/ascii/qf-50sp2-dict.test.js +5 -2
  131. package/dist/test/ascii/qf-50sp2-dict.test.js.map +1 -1
  132. package/dist/test/env/encoder-test.d.ts +3 -3
  133. package/dist/test/env/encoder-test.js.map +1 -1
  134. package/dist/test/env/set-constraint-helper.d.ts +4 -4
  135. package/dist/test/env/set-constraint-helper.js.map +1 -1
  136. package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
  137. package/dist/transport/ascii/ascii-session.js +1 -1
  138. package/dist/transport/ascii/ascii-session.js.map +1 -1
  139. package/dist/transport/fixml/fixml-session.js.map +1 -1
  140. package/dist/transport/http/http-acceptor.js +3 -4
  141. package/dist/transport/http/http-acceptor.js.map +1 -1
  142. package/dist/transport/http/http-json-sample-adapter.js +3 -4
  143. package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
  144. package/dist/transport/session/dynamic-session-manager.d.ts +8 -0
  145. package/dist/transport/session/dynamic-session-manager.js +15 -0
  146. package/dist/transport/session/dynamic-session-manager.js.map +1 -0
  147. package/dist/transport/session/session-description.d.ts +9 -7
  148. package/dist/transport/session/session-description.js.map +1 -1
  149. package/dist/util/json-helper.d.ts +2 -2
  150. package/dist/util/json-helper.js.map +1 -1
  151. package/dist/util/message-generator.js +1 -1
  152. package/dist/util/message-generator.js.map +1 -1
  153. package/package.json +16 -16
  154. package/src/buffer/ascii/ascii-encoder.ts +7 -7
  155. package/src/buffer/ascii/ascii-parser-state.ts +4 -4
  156. package/src/buffer/ascii/ascii-parser.ts +6 -5
  157. package/src/buffer/ascii/ascii-segment-parser.ts +2 -2
  158. package/src/buffer/ascii/ascii-view.ts +9 -7
  159. package/src/buffer/encode-proxy.ts +9 -9
  160. package/src/buffer/fixml/fixml-encoder.ts +14 -10
  161. package/src/buffer/fixml/fixml-parser.ts +5 -5
  162. package/src/buffer/fixml/fixml-view.ts +5 -5
  163. package/src/buffer/msg-encoder.ts +3 -3
  164. package/src/buffer/msg-view.ts +18 -18
  165. package/src/buffer/segment/segment-description.ts +2 -2
  166. package/src/buffer/tag/tags.ts +4 -6
  167. package/src/collections/collection.ts +0 -1
  168. package/src/collections/index.ts +1 -1
  169. package/src/config/js-fix-config.ts +3 -2
  170. package/src/dictionary/compiler/compiler-type.ts +8 -2
  171. package/src/dictionary/compiler/enum-compiler.ts +2 -2
  172. package/src/dictionary/compiler/msg-compiler.ts +11 -12
  173. package/src/dictionary/contained/contained-component-field.ts +1 -1
  174. package/src/dictionary/contained/contained-field-set.ts +21 -176
  175. package/src/dictionary/contained/contained-group-field.ts +1 -1
  176. package/src/dictionary/contained/contained-set-builder.ts +164 -0
  177. package/src/dictionary/contained/contained-set.ts +83 -0
  178. package/src/dictionary/contained/contained-simple-field.ts +1 -1
  179. package/src/dictionary/contained/index.ts +4 -1
  180. package/src/dictionary/definition/category-simple-set.ts +1 -2
  181. package/src/dictionary/definition/component-field-definition.ts +1 -1
  182. package/src/dictionary/definition/fix-definitions.ts +28 -26
  183. package/src/dictionary/definition/group-field-definition.ts +1 -1
  184. package/src/dictionary/definition/message-definition.ts +6 -6
  185. package/src/dictionary/definition/simple-field-definition.ts +9 -10
  186. package/src/dictionary/parser/fix-repository/repository.ts +47 -40
  187. package/src/dictionary/parser/fixml/components-parser.ts +41 -38
  188. package/src/dictionary/parser/fixml/fields-parser.ts +3 -4
  189. package/src/dictionary/parser/fixml/include-graph.ts +13 -14
  190. package/src/dictionary/parser/quickfix/field-definition-parser.ts +5 -5
  191. package/src/dictionary/parser/quickfix/message-parser.ts +7 -5
  192. package/src/dictionary/parser/quickfix/node-parser.ts +13 -6
  193. package/src/dictionary/parser/quickfix/parse-context.ts +2 -2
  194. package/src/dictionary/parser/quickfix/parse-progress.ts +2 -3
  195. package/src/dictionary/parser/quickfix/quick-fix-xml-file-builder.ts +4 -5
  196. package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +10 -12
  197. package/src/dictionary/parser/quickfix/quick-fix-xml-formatter.ts +1 -1
  198. package/src/dictionary/set-reduce.ts +3 -3
  199. package/src/index.ts +0 -1
  200. package/src/jsfix-cmd.ts +5 -6
  201. package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +7 -8
  202. package/src/sample/tcp/trade-capture/trade-capture-client.ts +4 -5
  203. package/src/sample/tcp/trade-capture/trade-capture-server.ts +1 -1
  204. package/src/store/fix-msg-memory-store.ts +3 -4
  205. package/src/store/fix-msg-store-record.ts +1 -1
  206. package/src/transport/ascii/ascii-msg-transmitter.ts +6 -6
  207. package/src/transport/ascii/ascii-session.ts +6 -6
  208. package/src/transport/fixml/fixml-session.ts +3 -3
  209. package/src/transport/http/http-acceptor.ts +4 -5
  210. package/src/transport/http/http-json-sample-adapter.ts +3 -4
  211. package/src/transport/session/dynamic-session-manager.ts +16 -0
  212. package/src/transport/session/session-description.ts +10 -7
  213. package/src/util/json-helper.ts +3 -3
  214. package/src/util/message-generator.ts +4 -4
  215. package/dist/collections/dictionary.d.ts +0 -15
  216. package/dist/collections/dictionary.js +0 -57
  217. package/dist/collections/dictionary.js.map +0 -1
  218. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.d.ts +0 -31
  219. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js +0 -3
  220. package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js.map +0 -1
  221. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.d.ts +0 -26
  222. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js +0 -3
  223. package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js.map +0 -1
  224. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.d.ts +0 -5
  225. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js +0 -3
  226. package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js.map +0 -1
  227. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.d.ts +0 -8
  228. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js +0 -3
  229. package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js.map +0 -1
  230. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.d.ts +0 -4
  231. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js +0 -3
  232. package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js.map +0 -1
  233. package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.d.ts +0 -6
  234. package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.js.map +0 -1
  235. package/src/collections/dictionary.ts +0 -62
@@ -1,30 +1,29 @@
1
1
  import { INumericKeyed } from '../../collections/collection'
2
- import { Dictionary } from '../../collections'
3
2
  import { ComponentFieldDefinition } from './component-field-definition'
4
3
  import { MessageDefinition } from './message-definition'
5
4
  import { SimpleFieldDefinition } from './simple-field-definition'
6
5
  import { FixVersion } from '../fix-versions'
7
6
  import { CategorySimpleSet } from './category-simple-set'
8
- import { ContainedFieldSet } from '../contained'
9
7
  import { FixDefinitionSource } from '../fix-definition-source'
10
8
  import { FixVersionParser } from './fix-version-parser'
9
+ import { IContainedSet } from '../contained/contained-set'
11
10
 
12
11
  export class FixDefinitions {
13
12
  /**
14
13
  * all simple fields defined from source definition indexed via name
15
14
  * e.g. 'BeginString'
16
15
  */
17
- public readonly simple: Dictionary<SimpleFieldDefinition> = new Dictionary<SimpleFieldDefinition>()
16
+ public readonly simple: Map<string, SimpleFieldDefinition> = new Map<string, SimpleFieldDefinition>()
18
17
  /**
19
18
  * all components defined from source definition indexed via name
20
19
  * e.g. 'Instrument'
21
20
  */
22
- public readonly component: Dictionary<ComponentFieldDefinition> = new Dictionary<ComponentFieldDefinition>()
21
+ public readonly component: Map<string, ComponentFieldDefinition> = new Map<string, ComponentFieldDefinition>()
23
22
  /**
24
23
  * all messages defined from source definition indexed via name
25
24
  * e.g. 'Logon'
26
25
  */
27
- public readonly message: Dictionary<MessageDefinition> = new Dictionary<MessageDefinition>()
26
+ public readonly message: Map<string, MessageDefinition> = new Map<string, MessageDefinition>()
28
27
  /**
29
28
  * all messages defined from source definition indexed via tag id
30
29
  * e.g. 8
@@ -33,7 +32,7 @@ export class FixDefinitions {
33
32
  /**
34
33
  * all fields within a category indexed via name used for FIXML
35
34
  */
36
- public readonly categorySimple: Dictionary<CategorySimpleSet> = new Dictionary<CategorySimpleSet>()
35
+ public readonly categorySimple: Map<string, CategorySimpleSet> = new Map<string, CategorySimpleSet>()
37
36
 
38
37
  constructor (public readonly source: FixDefinitionSource, public readonly version: FixVersion) {
39
38
  }
@@ -52,11 +51,14 @@ export class FixDefinitions {
52
51
 
53
52
  public toString (): string {
54
53
  const msgs = this.message.values()
55
- const strs: String[] = msgs.map(m => m.toString())
54
+ const strs: String[] = []
55
+ for (const message of msgs) {
56
+ strs.push(message.toString())
57
+ }
56
58
  return JSON.stringify(strs, null, 4)
57
59
  }
58
60
 
59
- public containedSet (type: string): ContainedFieldSet | null {
61
+ public containedSet (type: string): IContainedSet | undefined {
60
62
  return this.message.get(type) ?? this.component.get(type)
61
63
  }
62
64
 
@@ -66,7 +68,7 @@ export class FixDefinitions {
66
68
  * 'SecurityList.SecListGrp.NoRelatedSym.SecurityTradingRules'
67
69
  * @param path dot denoted path too field set nested from root
68
70
  */
69
- public getSet (path: string): ContainedFieldSet | null {
71
+ public getSet (path: string): IContainedSet | undefined {
70
72
  const idx = path.indexOf('.')
71
73
  let name: string = path
72
74
  if (idx > 0) {
@@ -74,7 +76,7 @@ export class FixDefinitions {
74
76
  } else {
75
77
  return this.message.get(name)
76
78
  }
77
- return this.message.get(name)?.getSet(path.substring(idx + 1)) ?? null
79
+ return this.message.get(name)?.getSet(path.substring(idx + 1)) ?? undefined
78
80
  }
79
81
 
80
82
  /**
@@ -84,13 +86,13 @@ export class FixDefinitions {
84
86
  */
85
87
  public addMessage (message: MessageDefinition): void {
86
88
  const messages = this.message
87
- messages.addUpdate(message.name, message)
89
+ messages.set(message.name, message)
88
90
  if (message.msgType && message.msgType !== message.name) {
89
- messages.addUpdate(message.msgType, message)
91
+ messages.set(message.msgType, message)
90
92
  }
91
93
  if (message.abbreviation) {
92
94
  if (message.abbreviation !== message.name) {
93
- messages.addUpdate(message.abbreviation, message)
95
+ messages.set(message.abbreviation, message)
94
96
  }
95
97
  }
96
98
  }
@@ -100,7 +102,7 @@ export class FixDefinitions {
100
102
  * @param field
101
103
  */
102
104
  public addComponentFieldDef (field: ComponentFieldDefinition): void {
103
- this.component.addUpdate(field.name, field)
105
+ this.component.set(field.name, field)
104
106
  }
105
107
 
106
108
  /**
@@ -109,10 +111,10 @@ export class FixDefinitions {
109
111
  * @param name of the field to fetch
110
112
  * @param cat optional category from which field belongs
111
113
  */
112
- public getSimple (name: string, cat?: string | null): SimpleFieldDefinition | null {
113
- let sf: SimpleFieldDefinition | null = null
114
+ public getSimple (name: string, cat?: string | null): SimpleFieldDefinition | undefined {
115
+ let sf: SimpleFieldDefinition | undefined
114
116
  if (cat) {
115
- const category: CategorySimpleSet | null = this.categorySimple.get(cat)
117
+ const category = this.categorySimple.get(cat)
116
118
  if (category) {
117
119
  sf = category.simple.get(name)
118
120
  }
@@ -131,7 +133,7 @@ export class FixDefinitions {
131
133
  public addSimpleAlias (from: string, to: string): void {
132
134
  const simple = this.simple.get(from)
133
135
  if (simple) {
134
- this.simple.addUpdate(to, simple)
136
+ this.simple.set(to, simple)
135
137
  }
136
138
  }
137
139
 
@@ -144,27 +146,27 @@ export class FixDefinitions {
144
146
  public addSimpleFieldDef (field: SimpleFieldDefinition, typeName: string | null = null): void {
145
147
  this.assignCategory(field)
146
148
  const simple = this.simple
147
- simple.addUpdate(field.num, field)
148
- simple.addUpdate(field.name, field)
149
+ simple.set(field.num, field)
150
+ simple.set(field.name, field)
149
151
  this.tagToSimple[field.tag] = field
150
152
  if (field.abbreviation && field.abbreviation !== field.name) {
151
- if (!simple.containsKey(field.abbreviation)) {
152
- simple.addUpdate(field.abbreviation, field)
153
+ if (!simple.has(field.abbreviation)) {
154
+ simple.set(field.abbreviation, field)
153
155
  }
154
156
  }
155
157
  if (typeName && typeName !== field.name && field.name && field.type) {
156
- simple.addUpdate(typeName, field)
158
+ simple.set(typeName, field)
157
159
  }
158
160
  }
159
161
 
160
162
  private assignCategory (field: SimpleFieldDefinition): void {
161
163
  if (field.baseCategory && field.baseCategoryAbbreviation) {
162
- let category: CategorySimpleSet | null = this.categorySimple.get(field.baseCategory)
164
+ let category = this.categorySimple.get(field.baseCategory)
163
165
  if (!category) {
164
166
  category = new CategorySimpleSet(field.baseCategory)
165
- this.categorySimple.add(field.baseCategory, category)
167
+ this.categorySimple.set(field.baseCategory, category)
166
168
  }
167
- category.simple.addUpdate(field.baseCategoryAbbreviation, field)
169
+ category.simple.set(field.baseCategoryAbbreviation, field)
168
170
  }
169
171
  }
170
172
  }
@@ -1,4 +1,4 @@
1
- import { ContainedFieldSet } from '../contained'
1
+ import { ContainedFieldSet } from '../contained/contained-field-set'
2
2
  import { SimpleFieldDefinition } from './simple-field-definition'
3
3
  import { ContainedSetType } from '../contained-set-type'
4
4
 
@@ -1,16 +1,16 @@
1
- import { ContainedFieldSet } from '../contained'
1
+ import { ContainedFieldSet } from '../contained/contained-field-set'
2
2
  import { ContainedSetType } from '../contained-set-type'
3
3
 
4
4
  export class MessageDefinition extends ContainedFieldSet {
5
- constructor (public readonly name: string,
6
- public readonly abbreviation: string,
5
+ constructor (readonly name: string,
6
+ readonly abbreviation: string,
7
7
  public readonly msgType: string,
8
- public readonly category: string,
9
- public readonly description: string | null) {
8
+ readonly category: string,
9
+ readonly description: string | null) {
10
10
  super(ContainedSetType.Msg, name, category, abbreviation, description)
11
11
  }
12
12
 
13
- public getPrefix (): string {
13
+ getPrefix (): string {
14
14
  return `M.${this.msgType}`
15
15
  }
16
16
  }
@@ -1,4 +1,3 @@
1
- import { Dictionary } from '../../collections'
2
1
  import { FieldEnum } from '../field-enum'
3
2
  import { Tags } from '../../buffer/tag/tags'
4
3
  import { AsciiChars } from '../../buffer/ascii/ascii-chars'
@@ -8,8 +7,8 @@ import { TagType } from '../../buffer/tag/tag-type'
8
7
  export class SimpleFieldDefinition {
9
8
  public readonly tag: number
10
9
  public readonly tagType: TagType
11
- public enums: Dictionary<FieldEnum>
12
- public enumVals: Dictionary<boolean>
10
+ public enums: Map<string, FieldEnum>
11
+ public enumVals: Map<string, boolean>
13
12
 
14
13
  constructor (public readonly num: string,
15
14
  public readonly name: string,
@@ -31,7 +30,7 @@ export class SimpleFieldDefinition {
31
30
  if (!enums) {
32
31
  return false
33
32
  }
34
- return enums.get(key) != null
33
+ return enums.has(key)
35
34
  }
36
35
 
37
36
  public resolveEnum (key: string): string {
@@ -39,7 +38,7 @@ export class SimpleFieldDefinition {
39
38
  if (!enums) {
40
39
  return key
41
40
  }
42
- const e: FieldEnum | null = enums.get(key)
41
+ const e: FieldEnum | undefined = enums.get(key)
43
42
  if (e) {
44
43
  return e.val
45
44
  }
@@ -55,7 +54,7 @@ export class SimpleFieldDefinition {
55
54
  if (atDigit) {
56
55
  converted = `E${converted}`
57
56
  }
58
- if (this.enumVals.containsKey(converted)) {
57
+ if (this.enumVals.has(converted)) {
59
58
  converted = `${converted}2`
60
59
  }
61
60
  return converted
@@ -65,13 +64,13 @@ export class SimpleFieldDefinition {
65
64
  let enums = this.enums
66
65
  let enumVals = this.enumVals
67
66
  if (enums == null) {
68
- this.enums = enums = new Dictionary<FieldEnum>()
69
- this.enumVals = enumVals = new Dictionary<boolean>()
67
+ this.enums = enums = new Map<string, FieldEnum>()
68
+ this.enumVals = enumVals = new Map<string, boolean>()
70
69
  }
71
70
  if (!description) description = val
72
71
  val = this.patchEnumValue(val)
73
- enums.add(key, new FieldEnum(key, val, description ?? ''))
74
- enumVals.add(val, true)
72
+ enums.set(key, new FieldEnum(key, val, description ?? ''))
73
+ enumVals.set(val, true)
75
74
  }
76
75
 
77
76
  public toString (): string {
@@ -3,8 +3,14 @@ import {
3
3
  SimpleFieldDefinition, GroupFieldDefinition, ComponentFieldDefinition,
4
4
  MessageDefinition, FixDefinitions
5
5
  } from '../../definition'
6
- import { Dictionary } from '../../../collections'
7
- import { ContainedFieldSet, ContainedComponentField, ContainedGroupField, ContainedSimpleField } from '../../contained'
6
+
7
+ import {
8
+ IContainedSet,
9
+ ContainedComponentField,
10
+ ContainedGroupField,
11
+ ContainedSimpleField,
12
+ ContainedSetBuilder
13
+ } from '../../contained'
8
14
  import { FixVersion } from '../../fix-versions'
9
15
  import { GetJsFixLogger, IJsFixLogger } from '../../../config'
10
16
  import { FixDefinitionSource } from '../../fix-definition-source'
@@ -28,10 +34,10 @@ export class Repository {
28
34
  public includesAbbreviations: boolean
29
35
  // derived from above
30
36
  public readonly definitions: FixDefinitions
31
- private readonly groupLookup: Dictionary<GroupFieldDefinition> = new Dictionary<GroupFieldDefinition>()
32
- private contentLookup: Dictionary<IRepositoryMsgContent[]>
33
- private componentLookup: Dictionary<IRepositoryComponent>
34
- private dataTypeLookup: Dictionary<IRepositoryDataType>
37
+ private readonly groupLookup: Map<string, GroupFieldDefinition> = new Map<string, GroupFieldDefinition>()
38
+ private contentLookup: Map<string, IRepositoryMsgContent[]>
39
+ private componentLookup: Map<string, IRepositoryComponent>
40
+ private dataTypeLookup: Map<string, IRepositoryDataType>
35
41
  private readonly logger: IJsFixLogger
36
42
 
37
43
  constructor (public readonly version: FixVersion, public readonly getLogger: GetJsFixLogger) {
@@ -104,9 +110,9 @@ export class Repository {
104
110
  private summarise (): void {
105
111
  const logger = this.logger
106
112
  const definitions = this.definitions
107
- logger.info(`definitions: ${definitions.simple.count()} fields`)
108
- logger.info(`definitions: ${definitions.component.count()} components`)
109
- logger.info(`definitions: ${definitions.message.count()} messages`)
113
+ logger.info(`definitions: ${definitions.simple.size} fields`)
114
+ logger.info(`definitions: ${definitions.component.size} components`)
115
+ logger.info(`definitions: ${definitions.message.size} messages`)
110
116
  }
111
117
 
112
118
  private toDefinitions (): void {
@@ -129,16 +135,16 @@ export class Repository {
129
135
  }
130
136
 
131
137
  private header (): void {
132
- const h: ComponentFieldDefinition | null = this.definitions.component.get('StandardHeader')
138
+ const h: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardHeader')
133
139
  if (h) {
134
- this.definitions.component.add('header', h)
140
+ this.definitions.component.set('header', h)
135
141
  }
136
142
  }
137
143
 
138
144
  private trailer (): void {
139
- const t: ComponentFieldDefinition | null = this.definitions.component.get('StandardTrailer')
145
+ const t: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardTrailer')
140
146
  if (t) {
141
- this.definitions.component.add('trailer', t)
147
+ this.definitions.component.set('trailer', t)
142
148
  }
143
149
  }
144
150
 
@@ -189,8 +195,8 @@ export class Repository {
189
195
  this.dataTypeLookup = this.types()
190
196
  const definitions = this.definitions
191
197
  const types = this.dataTypeLookup
192
- types.remove('boolean')
193
- types.remove('data')
198
+ types.delete('boolean')
199
+ types.delete('data')
194
200
  this.Fields.forEach((f: IRepositoryField) => {
195
201
  const type = this.getType(f)
196
202
  definitions.addSimpleFieldDef(Repository.makeSimple(f, type))
@@ -198,32 +204,33 @@ export class Repository {
198
204
  this.fieldEnums()
199
205
  }
200
206
 
201
- private contents (): Dictionary<IRepositoryMsgContent[]> {
207
+ private contents (): Map<string, IRepositoryMsgContent[]> {
202
208
  return this.MsgContents.reduce((a, current) => {
203
- let content: IRepositoryMsgContent[] | null = a.get(current.ComponentID)
209
+ let content: IRepositoryMsgContent[] | undefined = a.get(current.ComponentID)
204
210
  if (!content) {
205
211
  content = []
206
- a.add(current.ComponentID, content)
212
+ a.set(current.ComponentID, content)
207
213
  }
208
214
  content[content.length] = current
209
215
  return a
210
- }, new Dictionary<IRepositoryMsgContent[]>())
216
+ }, new Map<string, IRepositoryMsgContent[]>())
211
217
  }
212
218
 
213
- private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet: ContainedFieldSet): void {
219
+ private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet: IContainedSet): void {
220
+ const builder = new ContainedSetBuilder(parentSet)
214
221
  content.forEach((current: IRepositoryMsgContent) => {
215
222
  const required: boolean = current.Reqd === '1'
216
223
  const tag: number = parseInt(current.TagText, 10)
217
224
  if (!isNaN(tag)) {
218
225
  const sf: SimpleFieldDefinition = this.definitions.tagToSimple[tag]
219
226
  if (sf) {
220
- parentSet.add(new ContainedSimpleField(sf, parentSet.fields.length, required, false))
227
+ builder.add(new ContainedSimpleField(sf, parentSet.fields.length, required, false))
221
228
  }
222
229
  } else {
223
230
  // is there a definition for this type yet create.
224
- let childSet: ContainedFieldSet | null = this.definitions.component.get(current.TagText)
231
+ let childSet: IContainedSet | undefined = this.definitions.component.get(current.TagText)
225
232
  if (!childSet) {
226
- const cl: IRepositoryComponent | null = this.componentLookup.get(current.TagText)
233
+ const cl: IRepositoryComponent | undefined = this.componentLookup.get(current.TagText)
227
234
  if (cl) {
228
235
  childSet = this.resolve(cl)
229
236
  }
@@ -231,12 +238,12 @@ export class Repository {
231
238
  if (childSet) {
232
239
  switch (childSet.type) {
233
240
  case ContainedSetType.Component: {
234
- parentSet.add(new ContainedComponentField(childSet as ComponentFieldDefinition, parentSet.fields.length, required))
241
+ builder.add(new ContainedComponentField(childSet as ComponentFieldDefinition, parentSet.fields.length, required))
235
242
  break
236
243
  }
237
244
 
238
245
  case ContainedSetType.Group: {
239
- parentSet.add(new ContainedGroupField(childSet as GroupFieldDefinition, parentSet.fields.length, required))
246
+ builder.add(new ContainedGroupField(childSet as GroupFieldDefinition, parentSet.fields.length, required))
240
247
  break
241
248
  }
242
249
 
@@ -250,24 +257,24 @@ export class Repository {
250
257
  })
251
258
  }
252
259
 
253
- private resolve (c: IRepositoryComponent): ContainedFieldSet {
260
+ private resolve (c: IRepositoryComponent): IContainedSet {
254
261
  switch (c.ComponentType) {
255
262
  case 'ImplicitBlockRepeating':
256
263
  case 'BlockRepeating': {
257
- const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []
264
+ const content: IRepositoryMsgContent[] | undefined = this.contentLookup.get(c.ComponentID) ?? []
258
265
  const noField: SimpleFieldDefinition = this.definitions.tagToSimple[parseInt(content[0].TagText, 10)]
259
- let def: GroupFieldDefinition | null = this.groupLookup.get(c.ComponentID)
266
+ let def: GroupFieldDefinition | undefined = this.groupLookup.get(c.ComponentID)
260
267
  if (!def) {
261
268
  def = new GroupFieldDefinition(c.Name, c.AbbrName, c.CategoryID, noField, c.Description)
262
269
  this.resolveToFieldSet(content.slice(1), def)
263
- this.groupLookup.add(c.ComponentID, def)
270
+ this.groupLookup.set(c.ComponentID, def)
264
271
  }
265
272
  return def
266
273
  }
267
274
 
268
275
  default: {
269
276
  const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []
270
- let def: ComponentFieldDefinition | null = this.definitions.component.get(c.Name)
277
+ let def: ComponentFieldDefinition | undefined = this.definitions.component.get(c.Name)
271
278
  if (!def) {
272
279
  def = new ComponentFieldDefinition(c.Name, c.AbbrName, c.CategoryID, c.Description)
273
280
  this.resolveToFieldSet(content, def)
@@ -281,7 +288,7 @@ export class Repository {
281
288
  private message (m: IRepositoryMessage): MessageDefinition {
282
289
  const definitions = this.definitions
283
290
  const content: IRepositoryMsgContent[] = this.contentLookup.get(m.ComponentID) ?? []
284
- let def: MessageDefinition | null = definitions.message.get(m.Name)
291
+ let def: MessageDefinition | undefined = definitions.message.get(m.Name)
285
292
  if (!def) {
286
293
  def = new MessageDefinition(m.Name, m.AbbrName, m.MsgType, m.CategoryID, m.Description)
287
294
  this.resolveToFieldSet(content, def)
@@ -290,18 +297,18 @@ export class Repository {
290
297
  return def
291
298
  }
292
299
 
293
- private components (): Dictionary<IRepositoryComponent> {
294
- return this.Components.reduce((a: Dictionary<IRepositoryComponent>, current: IRepositoryComponent) => {
295
- a.add(current.Name, current)
296
- a.add(current.ComponentID, current)
300
+ private components (): Map<string, IRepositoryComponent> {
301
+ return this.Components.reduce((a: Map<string, IRepositoryComponent>, current: IRepositoryComponent) => {
302
+ a.set(current.Name, current)
303
+ a.set(current.ComponentID, current)
297
304
  return a
298
- }, new Dictionary<IRepositoryComponent>())
305
+ }, new Map<string, IRepositoryComponent>())
299
306
  }
300
307
 
301
- private types (): Dictionary<IRepositoryDataType> {
302
- return this.DataTypes.reduce((a: Dictionary<IRepositoryDataType>, current: IRepositoryDataType) => {
303
- a.add(current.Name, current)
308
+ private types (): Map<string, IRepositoryDataType> {
309
+ return this.DataTypes.reduce((a: Map<string, IRepositoryDataType>, current: IRepositoryDataType) => {
310
+ a.set(current.Name, current)
304
311
  return a
305
- }, new Dictionary<IRepositoryDataType>())
312
+ }, new Map<string, IRepositoryDataType>())
306
313
  }
307
314
  }