jspurefix 1.4.1 → 2.0.3

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 (879) hide show
  1. package/.eslintrc.js +6 -0
  2. package/appveyor.yml +4 -0
  3. package/dist/buffer/{ascii-chars.d.ts → ascii/ascii-chars.d.ts} +0 -0
  4. package/dist/buffer/{ascii-chars.js → ascii/ascii-chars.js} +0 -0
  5. package/dist/buffer/ascii/ascii-chars.js.map +1 -0
  6. package/dist/buffer/ascii/ascii-encoder.d.ts +4 -2
  7. package/dist/buffer/ascii/ascii-encoder.js +54 -32
  8. package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
  9. package/dist/buffer/ascii/ascii-parser-state.d.ts +3 -10
  10. package/dist/buffer/ascii/ascii-parser-state.js +37 -25
  11. package/dist/buffer/ascii/ascii-parser-state.js.map +1 -1
  12. package/dist/buffer/ascii/ascii-parser.d.ts +7 -7
  13. package/dist/buffer/ascii/ascii-parser.js +50 -24
  14. package/dist/buffer/ascii/ascii-parser.js.map +1 -1
  15. package/dist/buffer/ascii/ascii-segment-parser.d.ts +2 -2
  16. package/dist/buffer/ascii/ascii-segment-parser.js +34 -13
  17. package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
  18. package/dist/buffer/ascii/ascii-view.d.ts +2 -4
  19. package/dist/buffer/ascii/ascii-view.js +11 -15
  20. package/dist/buffer/ascii/ascii-view.js.map +1 -1
  21. package/dist/buffer/ascii/index.d.ts +1 -0
  22. package/dist/buffer/ascii/index.js +1 -0
  23. package/dist/buffer/ascii/index.js.map +1 -1
  24. package/dist/buffer/ascii/parse-state.d.ts +8 -0
  25. package/dist/buffer/ascii/parse-state.js +13 -0
  26. package/dist/buffer/ascii/parse-state.js.map +1 -0
  27. package/dist/buffer/ascii/time-formatter.js +1 -1
  28. package/dist/buffer/ascii/time-formatter.js.map +1 -1
  29. package/dist/buffer/elastic-buffer.js +29 -8
  30. package/dist/buffer/elastic-buffer.js.map +1 -1
  31. package/dist/buffer/encode-proxy.d.ts +1 -1
  32. package/dist/buffer/encode-proxy.js +16 -17
  33. package/dist/buffer/encode-proxy.js.map +1 -1
  34. package/dist/buffer/fixml/fixml-encoder.d.ts +2 -1
  35. package/dist/buffer/fixml/fixml-encoder.js +43 -20
  36. package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
  37. package/dist/buffer/fixml/fixml-parser.js +47 -24
  38. package/dist/buffer/fixml/fixml-parser.js.map +1 -1
  39. package/dist/buffer/fixml/fixml-view.d.ts +2 -4
  40. package/dist/buffer/fixml/fixml-view.js +13 -16
  41. package/dist/buffer/fixml/fixml-view.js.map +1 -1
  42. package/dist/buffer/fixml/populated-attributes.d.ts +5 -0
  43. package/dist/buffer/fixml/populated-attributes.js +3 -0
  44. package/dist/buffer/fixml/populated-attributes.js.map +1 -0
  45. package/dist/buffer/index.d.ts +4 -8
  46. package/dist/buffer/index.js +4 -8
  47. package/dist/buffer/index.js.map +1 -1
  48. package/dist/buffer/msg-encoder.d.ts +2 -1
  49. package/dist/buffer/msg-encoder.js.map +1 -1
  50. package/dist/buffer/msg-view.d.ts +3 -5
  51. package/dist/buffer/msg-view.js +8 -5
  52. package/dist/buffer/msg-view.js.map +1 -1
  53. package/dist/buffer/{segment-description.d.ts → segment/segment-description.d.ts} +3 -10
  54. package/dist/buffer/{segment-description.js → segment/segment-description.js} +5 -13
  55. package/dist/buffer/segment/segment-description.js.map +1 -0
  56. package/dist/buffer/{segment-summary.d.ts → segment/segment-summary.d.ts} +0 -0
  57. package/dist/buffer/{segment-summary.js → segment/segment-summary.js} +0 -0
  58. package/dist/buffer/segment/segment-summary.js.map +1 -0
  59. package/dist/buffer/segment/segment-type.d.ts +8 -0
  60. package/dist/buffer/segment/segment-type.js +13 -0
  61. package/dist/buffer/segment/segment-type.js.map +1 -0
  62. package/dist/buffer/structure.d.ts +3 -3
  63. package/dist/buffer/structure.js +1 -1
  64. package/dist/buffer/structure.js.map +1 -1
  65. package/dist/buffer/{tag-pos.d.ts → tag/tag-pos.d.ts} +0 -0
  66. package/dist/buffer/{tag-pos.js → tag/tag-pos.js} +0 -0
  67. package/dist/buffer/tag/tag-pos.js.map +1 -0
  68. package/dist/buffer/tag/tag-type.d.ts +13 -0
  69. package/dist/buffer/tag/tag-type.js +18 -0
  70. package/dist/buffer/tag/tag-type.js.map +1 -0
  71. package/dist/buffer/{tags.d.ts → tag/tags.d.ts} +3 -14
  72. package/dist/buffer/{tags.js → tag/tags.js} +24 -37
  73. package/dist/buffer/tag/tags.js.map +1 -0
  74. package/dist/config/get-js-fx-logger.d.ts +4 -0
  75. package/dist/config/get-js-fx-logger.js +3 -0
  76. package/dist/config/get-js-fx-logger.js.map +1 -0
  77. package/dist/config/index.d.ts +1 -0
  78. package/dist/config/index.js +1 -0
  79. package/dist/config/index.js.map +1 -1
  80. package/dist/config/js-fix-config.d.ts +4 -1
  81. package/dist/config/js-fix-config.js +3 -3
  82. package/dist/config/js-fix-config.js.map +1 -1
  83. package/dist/config/js-fix-logger.d.ts +0 -3
  84. package/dist/config/js-fix-logger.js.map +1 -1
  85. package/dist/dict-parser.js +28 -23
  86. package/dist/dict-parser.js.map +1 -1
  87. package/dist/dictionary/compiler/compiler-type.js +7 -7
  88. package/dist/dictionary/compiler/compiler-type.js.map +1 -1
  89. package/dist/dictionary/compiler/enum-compiler.d.ts +1 -0
  90. package/dist/dictionary/compiler/enum-compiler.js +11 -1
  91. package/dist/dictionary/compiler/enum-compiler.js.map +1 -1
  92. package/dist/dictionary/compiler/msg-compiler.js +8 -6
  93. package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
  94. package/dist/dictionary/contained/contained-component-field.js +2 -1
  95. package/dist/dictionary/contained/contained-component-field.js.map +1 -1
  96. package/dist/dictionary/contained/contained-field-dispatch.d.ts +1 -14
  97. package/dist/dictionary/contained/contained-field-dispatch.js +4 -4
  98. package/dist/dictionary/contained/contained-field-dispatch.js.map +1 -1
  99. package/dist/dictionary/contained/contained-field-dispatcher.d.ts +14 -0
  100. package/dist/dictionary/contained/contained-field-dispatcher.js +3 -0
  101. package/dist/dictionary/contained/contained-field-dispatcher.js.map +1 -0
  102. package/dist/dictionary/contained/contained-field-set.d.ts +1 -1
  103. package/dist/dictionary/contained/contained-field-set.js +12 -11
  104. package/dist/dictionary/contained/contained-field-set.js.map +1 -1
  105. package/dist/dictionary/contained/contained-field-type.d.ts +5 -0
  106. package/dist/dictionary/contained/contained-field-type.js +10 -0
  107. package/dist/dictionary/contained/contained-field-type.js.map +1 -0
  108. package/dist/dictionary/contained/contained-field.d.ts +1 -5
  109. package/dist/dictionary/contained/contained-field.js +1 -7
  110. package/dist/dictionary/contained/contained-field.js.map +1 -1
  111. package/dist/dictionary/contained/contained-group-field.js +2 -1
  112. package/dist/dictionary/contained/contained-group-field.js.map +1 -1
  113. package/dist/dictionary/contained/contained-simple-field.js +2 -1
  114. package/dist/dictionary/contained/contained-simple-field.js.map +1 -1
  115. package/dist/dictionary/{fields-dispatch.d.ts → contained/field-dispatcher.d.ts} +3 -2
  116. package/dist/dictionary/contained/field-dispatcher.js +3 -0
  117. package/dist/dictionary/contained/field-dispatcher.js.map +1 -0
  118. package/dist/dictionary/contained/fields-dispatch.d.ts +6 -0
  119. package/dist/dictionary/contained/fields-dispatch.js +42 -0
  120. package/dist/dictionary/contained/fields-dispatch.js.map +1 -0
  121. package/dist/dictionary/contained/index.d.ts +2 -0
  122. package/dist/dictionary/contained/index.js +2 -0
  123. package/dist/dictionary/contained/index.js.map +1 -1
  124. package/dist/dictionary/contained-set-type.d.ts +5 -0
  125. package/dist/dictionary/contained-set-type.js +10 -0
  126. package/dist/dictionary/contained-set-type.js.map +1 -0
  127. package/dist/dictionary/definition/component-field-definition.js +2 -2
  128. package/dist/dictionary/definition/component-field-definition.js.map +1 -1
  129. package/dist/dictionary/definition/fix-definitions.d.ts +2 -1
  130. package/dist/dictionary/definition/fix-definitions.js.map +1 -1
  131. package/dist/dictionary/definition/group-field-definition.js +2 -2
  132. package/dist/dictionary/definition/group-field-definition.js.map +1 -1
  133. package/dist/dictionary/definition/index.d.ts +0 -1
  134. package/dist/dictionary/definition/index.js +0 -1
  135. package/dist/dictionary/definition/index.js.map +1 -1
  136. package/dist/dictionary/definition/message-definition.js +2 -2
  137. package/dist/dictionary/definition/message-definition.js.map +1 -1
  138. package/dist/dictionary/definition/simple-field-definition.d.ts +1 -1
  139. package/dist/dictionary/definition/simple-field-definition.js +5 -4
  140. package/dist/dictionary/definition/simple-field-definition.js.map +1 -1
  141. package/dist/dictionary/dict-primitive.d.ts +0 -11
  142. package/dist/dictionary/dict-primitive.js +0 -7
  143. package/dist/dictionary/dict-primitive.js.map +1 -1
  144. package/dist/dictionary/fix-definition-source.d.ts +6 -0
  145. package/dist/dictionary/fix-definition-source.js +11 -0
  146. package/dist/dictionary/fix-definition-source.js.map +1 -0
  147. package/dist/dictionary/fix-versions.d.ts +0 -9
  148. package/dist/dictionary/fix-versions.js +1 -39
  149. package/dist/dictionary/fix-versions.js.map +1 -1
  150. package/dist/dictionary/index.d.ts +1 -5
  151. package/dist/dictionary/index.js +1 -5
  152. package/dist/dictionary/index.js.map +1 -1
  153. package/dist/dictionary/parser/fix-repository/abbreviations-parser.d.ts +1 -3
  154. package/dist/dictionary/parser/fix-repository/abbreviations-parser.js +2 -3
  155. package/dist/dictionary/parser/fix-repository/abbreviations-parser.js.map +1 -1
  156. package/dist/dictionary/parser/fix-repository/base-parser.d.ts +2 -4
  157. package/dist/dictionary/parser/fix-repository/base-parser.js +1 -2
  158. package/dist/dictionary/parser/fix-repository/base-parser.js.map +1 -1
  159. package/dist/dictionary/parser/fix-repository/components-parser.d.ts +1 -3
  160. package/dist/dictionary/parser/fix-repository/components-parser.js +2 -3
  161. package/dist/dictionary/parser/fix-repository/components-parser.js.map +1 -1
  162. package/dist/dictionary/parser/fix-repository/data-types-parser.d.ts +1 -3
  163. package/dist/dictionary/parser/fix-repository/data-types-parser.js +2 -3
  164. package/dist/dictionary/parser/fix-repository/data-types-parser.js.map +1 -1
  165. package/dist/dictionary/parser/fix-repository/enums-parser.d.ts +1 -3
  166. package/dist/dictionary/parser/fix-repository/enums-parser.js +2 -3
  167. package/dist/dictionary/parser/fix-repository/enums-parser.js.map +1 -1
  168. package/dist/dictionary/parser/fix-repository/fields-parser.d.ts +1 -3
  169. package/dist/dictionary/parser/fix-repository/fields-parser.js +2 -3
  170. package/dist/dictionary/parser/fix-repository/fields-parser.js.map +1 -1
  171. package/dist/dictionary/parser/fix-repository/messages-parser.d.ts +1 -3
  172. package/dist/dictionary/parser/fix-repository/messages-parser.js +2 -3
  173. package/dist/dictionary/parser/fix-repository/messages-parser.js.map +1 -1
  174. package/dist/dictionary/parser/fix-repository/msg-contents-parser.d.ts +1 -3
  175. package/dist/dictionary/parser/fix-repository/msg-contents-parser.js +2 -3
  176. package/dist/dictionary/parser/fix-repository/msg-contents-parser.js.map +1 -1
  177. package/dist/dictionary/parser/fix-repository/repository-abbreviation.d.ts +5 -0
  178. package/dist/dictionary/parser/fix-repository/repository-abbreviation.js +3 -0
  179. package/dist/dictionary/parser/fix-repository/repository-abbreviation.js.map +1 -0
  180. package/dist/dictionary/parser/fix-repository/repository-component.d.ts +10 -0
  181. package/dist/dictionary/parser/fix-repository/repository-component.js +3 -0
  182. package/dist/dictionary/parser/fix-repository/repository-component.js.map +1 -0
  183. package/dist/dictionary/parser/fix-repository/repository-data-type.d.ts +6 -0
  184. package/dist/dictionary/parser/fix-repository/repository-data-type.js +3 -0
  185. package/dist/dictionary/parser/fix-repository/repository-data-type.js.map +1 -0
  186. package/dist/dictionary/parser/fix-repository/repository-enum.d.ts +7 -0
  187. package/dist/{transport/fix-msg-factory.js → dictionary/parser/fix-repository/repository-enum.js} +1 -1
  188. package/dist/dictionary/parser/fix-repository/repository-enum.js.map +1 -0
  189. package/dist/dictionary/parser/fix-repository/repository-field.d.ts +11 -0
  190. package/dist/dictionary/parser/fix-repository/repository-field.js +3 -0
  191. package/dist/dictionary/parser/fix-repository/repository-field.js.map +1 -0
  192. package/dist/dictionary/parser/fix-repository/repository-message.d.ts +11 -0
  193. package/dist/{transport/make-fixl-session.js → dictionary/parser/fix-repository/repository-message.js} +1 -1
  194. package/dist/dictionary/parser/fix-repository/repository-message.js.map +1 -0
  195. package/dist/dictionary/parser/fix-repository/repository-msg-content.d.ts +9 -0
  196. package/dist/dictionary/parser/fix-repository/repository-msg-content.js +3 -0
  197. package/dist/dictionary/parser/fix-repository/repository-msg-content.js.map +1 -0
  198. package/dist/dictionary/parser/fix-repository/repository-type.d.ts +0 -53
  199. package/dist/dictionary/parser/fix-repository/repository-type.js +0 -2
  200. package/dist/dictionary/parser/fix-repository/repository-type.js.map +1 -1
  201. package/dist/dictionary/parser/fix-repository/repository-xml-parser.js +10 -10
  202. package/dist/dictionary/parser/fix-repository/repository-xml-parser.js.map +1 -1
  203. package/dist/dictionary/parser/fix-repository/repository.d.ts +12 -1
  204. package/dist/dictionary/parser/fix-repository/repository.js +50 -28
  205. package/dist/dictionary/parser/fix-repository/repository.js.map +1 -1
  206. package/dist/dictionary/parser/fixml/components-parser.d.ts +1 -1
  207. package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
  208. package/dist/dictionary/parser/fixml/fields-parser.d.ts +1 -1
  209. package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
  210. package/dist/dictionary/parser/fixml/fix-xsd-parser.js +3 -2
  211. package/dist/dictionary/parser/fixml/fix-xsd-parser.js.map +1 -1
  212. package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
  213. package/dist/dictionary/parser/fixml/xsd-parser.d.ts +1 -1
  214. package/dist/dictionary/parser/fixml/xsd-parser.js.map +1 -1
  215. package/dist/dictionary/parser/quickfix/field-definition-parser.d.ts +4 -4
  216. package/dist/dictionary/parser/quickfix/field-definition-parser.js +3 -3
  217. package/dist/dictionary/parser/quickfix/field-definition-parser.js.map +1 -1
  218. package/dist/dictionary/parser/quickfix/field-set-parser.d.ts +4 -4
  219. package/dist/dictionary/parser/quickfix/field-set-parser.js +3 -3
  220. package/dist/dictionary/parser/quickfix/field-set-parser.js.map +1 -1
  221. package/dist/dictionary/parser/quickfix/message-parser.d.ts +4 -4
  222. package/dist/dictionary/parser/quickfix/message-parser.js +3 -3
  223. package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
  224. package/dist/dictionary/parser/quickfix/node-parser.d.ts +4 -5
  225. package/dist/dictionary/parser/quickfix/node-parser.js +4 -4
  226. package/dist/dictionary/parser/quickfix/node-parser.js.map +1 -1
  227. package/dist/dictionary/parser/quickfix/parse-state.d.ts +8 -0
  228. package/dist/dictionary/parser/quickfix/parse-state.js +13 -0
  229. package/dist/dictionary/parser/quickfix/parse-state.js.map +1 -0
  230. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.d.ts +1 -9
  231. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +28 -35
  232. package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
  233. package/dist/dictionary/sax-node.d.ts +6 -0
  234. package/dist/{types/FIX4.4/quickfix/set/trailer.js → dictionary/sax-node.js} +1 -1
  235. package/dist/dictionary/sax-node.js.map +1 -0
  236. package/dist/dictionary/set-reduce.d.ts +5 -12
  237. package/dist/dictionary/set-reduce.js +28 -26
  238. package/dist/dictionary/set-reduce.js.map +1 -1
  239. package/dist/dictionary/type-dispatcher.d.ts +12 -0
  240. package/dist/dictionary/type-dispatcher.js +3 -0
  241. package/dist/dictionary/type-dispatcher.js.map +1 -0
  242. package/dist/dictionary/version-util.d.ts +4 -0
  243. package/dist/dictionary/version-util.js +36 -0
  244. package/dist/dictionary/version-util.js.map +1 -0
  245. package/dist/index.d.ts +1 -0
  246. package/dist/index.js +1 -0
  247. package/dist/index.js.map +1 -1
  248. package/dist/jsfix-cmd.d.ts +5 -0
  249. package/dist/jsfix-cmd.js +28 -21
  250. package/dist/jsfix-cmd.js.map +1 -1
  251. package/dist/runtime/di-tokens.d.ts +28 -0
  252. package/dist/runtime/di-tokens.js +33 -0
  253. package/dist/runtime/di-tokens.js.map +1 -0
  254. package/dist/runtime/engine-factory.d.ts +4 -0
  255. package/dist/runtime/engine-factory.js +3 -0
  256. package/dist/runtime/engine-factory.js.map +1 -0
  257. package/dist/runtime/index.d.ts +5 -0
  258. package/dist/runtime/index.js +18 -0
  259. package/dist/runtime/index.js.map +1 -0
  260. package/dist/runtime/make-config.d.ts +11 -0
  261. package/dist/runtime/make-config.js +57 -0
  262. package/dist/runtime/make-config.js.map +1 -0
  263. package/dist/runtime/session-container.d.ts +16 -0
  264. package/dist/runtime/session-container.js +168 -0
  265. package/dist/runtime/session-container.js.map +1 -0
  266. package/dist/runtime/session-launcher.d.ts +27 -0
  267. package/dist/runtime/session-launcher.js +131 -0
  268. package/dist/runtime/session-launcher.js.map +1 -0
  269. package/dist/sample/http/oms/app.d.ts +1 -1
  270. package/dist/sample/http/oms/app.js +16 -14
  271. package/dist/sample/http/oms/app.js.map +1 -1
  272. package/dist/sample/http/oms/http-client.js +22 -2
  273. package/dist/sample/http/oms/http-client.js.map +1 -1
  274. package/dist/sample/http/oms/http-server.js +21 -2
  275. package/dist/sample/http/oms/http-server.js.map +1 -1
  276. package/dist/sample/tcp/qf-md/app.d.ts +1 -1
  277. package/dist/sample/tcp/qf-md/app.js +11 -11
  278. package/dist/sample/tcp/qf-md/app.js.map +1 -1
  279. package/dist/sample/tcp/qf-md/md-client.js +21 -2
  280. package/dist/sample/tcp/qf-md/md-client.js.map +1 -1
  281. package/dist/sample/tcp/qf-md/md-server.js +20 -2
  282. package/dist/sample/tcp/qf-md/md-server.js.map +1 -1
  283. package/dist/sample/tcp/recovering-skeleton/app.d.ts +1 -1
  284. package/dist/sample/tcp/recovering-skeleton/app.js +36 -16
  285. package/dist/sample/tcp/recovering-skeleton/app.js.map +1 -1
  286. package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.d.ts +3 -1
  287. package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +30 -8
  288. package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
  289. package/dist/sample/tcp/recovering-skeleton/skeleton-client.d.ts +1 -1
  290. package/dist/sample/tcp/recovering-skeleton/skeleton-client.js +22 -3
  291. package/dist/sample/tcp/recovering-skeleton/skeleton-client.js.map +1 -1
  292. package/dist/sample/tcp/recovering-skeleton/skeleton-server.js +21 -2
  293. package/dist/sample/tcp/recovering-skeleton/skeleton-server.js.map +1 -1
  294. package/dist/sample/tcp/skeleton/app.d.ts +1 -1
  295. package/dist/sample/tcp/skeleton/app.js +8 -13
  296. package/dist/sample/tcp/skeleton/app.js.map +1 -1
  297. package/dist/sample/tcp/skeleton/skeleton-session.d.ts +1 -1
  298. package/dist/sample/tcp/skeleton/skeleton-session.js +26 -4
  299. package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
  300. package/dist/sample/tcp/tls-trade-capture/app.d.ts +1 -1
  301. package/dist/sample/tcp/tls-trade-capture/app.js +4 -24
  302. package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
  303. package/dist/sample/tcp/trade-capture/app-launcher.d.ts +6 -0
  304. package/dist/sample/tcp/trade-capture/app-launcher.js +21 -0
  305. package/dist/sample/tcp/trade-capture/app-launcher.js.map +1 -0
  306. package/dist/sample/tcp/trade-capture/app.d.ts +1 -1
  307. package/dist/sample/tcp/trade-capture/app.js +4 -21
  308. package/dist/sample/tcp/trade-capture/app.js.map +1 -1
  309. package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
  310. package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -1
  311. package/dist/sample/tcp/trade-capture/trade-factory.js +7 -1
  312. package/dist/sample/tcp/trade-capture/trade-factory.js.map +1 -1
  313. package/dist/store/fix-msg-ascii-store-resend.d.ts +1 -1
  314. package/dist/store/fix-msg-ascii-store-resend.js +2 -1
  315. package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
  316. package/dist/store/fix-msg-memory-store.d.ts +1 -1
  317. package/dist/store/fix-msg-memory-store.js.map +1 -1
  318. package/dist/store/fix-msg-store-record.d.ts +2 -0
  319. package/dist/store/fix-msg-store-record.js +4 -0
  320. package/dist/store/fix-msg-store-record.js.map +1 -1
  321. package/dist/store/fix-msg-store-state.d.ts +6 -0
  322. package/dist/store/fix-msg-store-state.js +3 -0
  323. package/dist/store/fix-msg-store-state.js.map +1 -0
  324. package/dist/store/fix-msg-store.d.ts +1 -6
  325. package/dist/store/fix-msg-store.js.map +1 -1
  326. package/dist/test/ascii/ascii-encoder.test.d.ts +1 -0
  327. package/dist/test/{ascii-encoder.test.js → ascii/ascii-encoder.test.js} +57 -55
  328. package/dist/test/ascii/ascii-encoder.test.js.map +1 -0
  329. package/dist/test/ascii/ascii-parser.test.d.ts +1 -0
  330. package/dist/test/{ascii-parser.test.js → ascii/ascii-parser.test.js} +33 -52
  331. package/dist/test/ascii/ascii-parser.test.js.map +1 -0
  332. package/dist/test/ascii/ascii-segment.test.d.ts +1 -0
  333. package/dist/test/{ascii-segment.test.js → ascii/ascii-segment.test.js} +20 -41
  334. package/dist/test/ascii/ascii-segment.test.js.map +1 -0
  335. package/dist/test/ascii/ascii-store-replay.test.d.ts +1 -0
  336. package/dist/test/{ascii-store-replay.test.js → ascii/ascii-store-replay.test.js} +14 -43
  337. package/dist/test/ascii/ascii-store-replay.test.js.map +1 -0
  338. package/dist/test/ascii/ascii-tag-pos.test.d.ts +1 -0
  339. package/dist/test/{ascii-tag-pos.test.js → ascii/ascii-tag-pos.test.js} +10 -10
  340. package/dist/test/ascii/ascii-tag-pos.test.js.map +1 -0
  341. package/dist/test/ascii/execution-report.test.d.ts +1 -0
  342. package/dist/test/{execution-report.test.js → ascii/execution-report.test.js} +51 -52
  343. package/dist/test/ascii/execution-report.test.js.map +1 -0
  344. package/dist/test/ascii/fix-log-replay.test.d.ts +1 -0
  345. package/dist/test/{fix-log-replay.test.js → ascii/fix-log-replay.test.js} +8 -6
  346. package/dist/test/ascii/fix-log-replay.test.js.map +1 -0
  347. package/dist/test/ascii/fix-repo-dict.test.d.ts +1 -0
  348. package/dist/test/{fix-repo-dict.test.js → ascii/fix-repo-dict.test.js} +8 -7
  349. package/dist/test/ascii/fix-repo-dict.test.js.map +1 -0
  350. package/dist/test/ascii/includes.test.d.ts +1 -0
  351. package/dist/test/{includes.test.js → ascii/includes.test.js} +3 -2
  352. package/dist/test/ascii/includes.test.js.map +1 -0
  353. package/dist/test/ascii/logon.test.d.ts +1 -0
  354. package/dist/test/{logon.test.js → ascii/logon.test.js} +11 -13
  355. package/dist/test/ascii/logon.test.js.map +1 -0
  356. package/dist/test/ascii/memory-store.test.d.ts +1 -0
  357. package/dist/test/{memory-store.test.js → ascii/memory-store.test.js} +12 -12
  358. package/dist/test/ascii/memory-store.test.js.map +1 -0
  359. package/dist/test/ascii/qf-full-msg.test.d.ts +1 -0
  360. package/dist/test/{qf-full-msg.test.js → ascii/qf-full-msg.test.js} +21 -17
  361. package/dist/test/ascii/qf-full-msg.test.js.map +1 -0
  362. package/dist/test/ascii/repo-full-ascii-msg.test.d.ts +1 -0
  363. package/dist/test/{repo-full-ascii-msg.test.js → ascii/repo-full-ascii-msg.test.js} +20 -16
  364. package/dist/test/ascii/repo-full-ascii-msg.test.js.map +1 -0
  365. package/dist/test/ascii/session-state.test.d.ts +1 -0
  366. package/dist/test/{session-state.test.js → ascii/session-state.test.js} +2 -1
  367. package/dist/test/ascii/session-state.test.js.map +1 -0
  368. package/dist/test/ascii/session.test.d.ts +1 -0
  369. package/dist/test/{session.test.js → ascii/session.test.js} +14 -145
  370. package/dist/test/ascii/session.test.js.map +1 -0
  371. package/dist/test/ascii/time-formatter.test.d.ts +1 -0
  372. package/dist/test/{time-formatter.test.js → ascii/time-formatter.test.js} +4 -2
  373. package/dist/test/ascii/time-formatter.test.js.map +1 -0
  374. package/dist/test/ascii/view-decode.test.d.ts +1 -0
  375. package/dist/test/{view-decode.test.js → ascii/view-decode.test.js} +11 -36
  376. package/dist/test/ascii/view-decode.test.js.map +1 -0
  377. package/dist/test/elastic-buffer.test.d.ts +1 -1
  378. package/dist/test/elastic-buffer.test.js +3 -1
  379. package/dist/test/elastic-buffer.test.js.map +1 -1
  380. package/dist/test/encode-proxy.test.d.ts +1 -1
  381. package/dist/test/encode-proxy.test.js +9 -9
  382. package/dist/test/encode-proxy.test.js.map +1 -1
  383. package/dist/test/env/experiment.d.ts +23 -0
  384. package/dist/test/env/experiment.js +33 -0
  385. package/dist/test/env/experiment.js.map +1 -0
  386. package/dist/test/env/parsing-result.d.ts +10 -0
  387. package/dist/test/env/parsing-result.js +14 -0
  388. package/dist/test/env/parsing-result.js.map +1 -0
  389. package/dist/test/env/setup.d.ts +39 -0
  390. package/dist/test/env/setup.js +98 -0
  391. package/dist/test/env/setup.js.map +1 -0
  392. package/dist/test/env/skeleton-runner.d.ts +15 -0
  393. package/dist/test/env/skeleton-runner.js +108 -0
  394. package/dist/test/env/skeleton-runner.js.map +1 -0
  395. package/dist/test/env/test-recovery.d.ts +13 -0
  396. package/dist/test/env/test-recovery.js +41 -0
  397. package/dist/test/env/test-recovery.js.map +1 -0
  398. package/dist/test/{to-views.d.ts → env/to-views.d.ts} +2 -2
  399. package/dist/test/{to-views.js → env/to-views.js} +8 -7
  400. package/dist/test/env/to-views.js.map +1 -0
  401. package/dist/test/fixml/fixml-alloc-parse.test.d.ts +1 -0
  402. package/dist/test/{fixml-alloc-parse.test.js → fixml/fixml-alloc-parse.test.js} +2 -1
  403. package/dist/test/fixml/fixml-alloc-parse.test.js.map +1 -0
  404. package/dist/test/fixml/fixml-mkt-data-fut-parse.test.d.ts +1 -0
  405. package/dist/test/{fixml-mkt-data-fut-parse.test.js → fixml/fixml-mkt-data-fut-parse.test.js} +2 -1
  406. package/dist/test/fixml/fixml-mkt-data-fut-parse.test.js.map +1 -0
  407. package/dist/test/fixml/fixml-mkt-data-settle-parse.test.d.ts +1 -0
  408. package/dist/test/{fixml-mkt-data-settle-parse.test.js → fixml/fixml-mkt-data-settle-parse.test.js} +2 -1
  409. package/dist/test/fixml/fixml-mkt-data-settle-parse.test.js.map +1 -0
  410. package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.d.ts +1 -0
  411. package/dist/test/{fixml-tc-bi-lateral-parse.test.js → fixml/fixml-tc-bi-lateral-parse.test.js} +2 -1
  412. package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.js.map +1 -0
  413. package/dist/test/fixml/repo-full-fixml-msg.test.d.ts +1 -0
  414. package/dist/test/{repo-full-fixml-msg.test.js → fixml/repo-full-fixml-msg.test.js} +17 -10
  415. package/dist/test/fixml/repo-full-fixml-msg.test.js.map +1 -0
  416. package/dist/transport/ascii/ascii-msg-transmitter.js +25 -6
  417. package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
  418. package/dist/transport/ascii/ascii-session-msg-factory.d.ts +2 -2
  419. package/dist/transport/ascii/ascii-session-msg-factory.js +1 -1
  420. package/dist/transport/ascii/ascii-session-msg-factory.js.map +1 -1
  421. package/dist/transport/ascii/ascii-session.d.ts +1 -1
  422. package/dist/transport/ascii/ascii-session.js +26 -23
  423. package/dist/transport/ascii/ascii-session.js.map +1 -1
  424. package/dist/transport/ascii/index.d.ts +0 -1
  425. package/dist/transport/ascii/index.js +0 -1
  426. package/dist/transport/ascii/index.js.map +1 -1
  427. package/dist/transport/duplex/http-duplex.d.ts +1 -1
  428. package/dist/transport/duplex/http-duplex.js.map +1 -1
  429. package/dist/transport/duplex/tcp-duplex.js +22 -2
  430. package/dist/transport/duplex/tcp-duplex.js.map +1 -1
  431. package/dist/transport/factory/index.d.ts +1 -0
  432. package/dist/transport/factory/index.js +14 -0
  433. package/dist/transport/factory/index.js.map +1 -0
  434. package/dist/transport/{msg-transport.d.ts → factory/msg-transport.d.ts} +4 -4
  435. package/dist/transport/factory/msg-transport.js +61 -0
  436. package/dist/transport/factory/msg-transport.js.map +1 -0
  437. package/dist/transport/fix-acceptor.d.ts +2 -2
  438. package/dist/transport/fix-acceptor.js.map +1 -1
  439. package/dist/transport/fix-entity.d.ts +8 -0
  440. package/dist/transport/fix-entity.js +12 -0
  441. package/dist/transport/fix-entity.js.map +1 -0
  442. package/dist/transport/fix-initiator.d.ts +2 -2
  443. package/dist/transport/fix-initiator.js.map +1 -1
  444. package/dist/transport/fixml/fixml-msg-transmitter.js +23 -5
  445. package/dist/transport/fixml/fixml-msg-transmitter.js.map +1 -1
  446. package/dist/transport/fixml/fixml-session-msg-factory.d.ts +2 -2
  447. package/dist/transport/fixml/fixml-session-msg-factory.js +1 -1
  448. package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -1
  449. package/dist/transport/fixml/fixml-session.d.ts +1 -1
  450. package/dist/transport/fixml/fixml-session.js +3 -3
  451. package/dist/transport/fixml/fixml-session.js.map +1 -1
  452. package/dist/transport/fixml/index.d.ts +0 -2
  453. package/dist/transport/fixml/index.js +0 -2
  454. package/dist/transport/fixml/index.js.map +1 -1
  455. package/dist/transport/http/html-options.d.ts +8 -0
  456. package/dist/{store/replay-record.js → transport/http/html-options.js} +1 -1
  457. package/dist/transport/http/html-options.js.map +1 -0
  458. package/dist/transport/http/html-route.d.ts +5 -0
  459. package/dist/{types/FIX4.4/quickfix/set/header.js → transport/http/html-route.js} +1 -1
  460. package/dist/transport/http/html-route.js.map +1 -0
  461. package/dist/transport/http/http-acceptor-listener.d.ts +7 -0
  462. package/dist/transport/http/http-acceptor-listener.js +68 -0
  463. package/dist/transport/http/http-acceptor-listener.js.map +1 -0
  464. package/dist/transport/http/http-acceptor.js +24 -5
  465. package/dist/transport/http/http-acceptor.js.map +1 -1
  466. package/dist/transport/http/http-adapter.d.ts +7 -0
  467. package/dist/transport/http/http-adapter.js +3 -0
  468. package/dist/transport/http/http-adapter.js.map +1 -0
  469. package/dist/transport/http/http-initiator.d.ts +9 -3
  470. package/dist/transport/http/http-initiator.js +57 -26
  471. package/dist/transport/http/http-initiator.js.map +1 -1
  472. package/dist/transport/http/http-json-sample-adapter.d.ts +2 -1
  473. package/dist/transport/http/http-json-sample-adapter.js +21 -2
  474. package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
  475. package/dist/transport/http/http-transaction.d.ts +1 -1
  476. package/dist/transport/http/http-transaction.js.map +1 -1
  477. package/dist/transport/http/http-transport-description.d.ts +8 -0
  478. package/dist/transport/http/http-transport-description.js +3 -0
  479. package/dist/transport/http/http-transport-description.js.map +1 -0
  480. package/dist/transport/http/index.d.ts +1 -0
  481. package/dist/transport/http/index.js +1 -0
  482. package/dist/transport/http/index.js.map +1 -1
  483. package/dist/transport/index.d.ts +11 -10
  484. package/dist/transport/index.js +11 -10
  485. package/dist/transport/index.js.map +1 -1
  486. package/dist/transport/msg-application.d.ts +12 -0
  487. package/dist/transport/msg-application.js +3 -0
  488. package/dist/transport/msg-application.js.map +1 -0
  489. package/dist/transport/msg-transmitter.d.ts +5 -5
  490. package/dist/transport/msg-transmitter.js +2 -3
  491. package/dist/transport/msg-transmitter.js.map +1 -1
  492. package/dist/transport/{a-session-msg-factory.d.ts → session/a-session-msg-factory.d.ts} +3 -3
  493. package/dist/transport/{a-session-msg-factory.js → session/a-session-msg-factory.js} +1 -1
  494. package/dist/transport/session/a-session-msg-factory.js.map +1 -0
  495. package/dist/transport/session/fix-session-state-args.d.ts +8 -0
  496. package/dist/transport/session/fix-session-state-args.js +3 -0
  497. package/dist/transport/session/fix-session-state-args.js.map +1 -0
  498. package/dist/transport/session/fix-session-state.d.ts +32 -0
  499. package/dist/transport/{fix-session-state.js → session/fix-session-state.js} +22 -55
  500. package/dist/transport/session/fix-session-state.js.map +1 -0
  501. package/dist/transport/{fix-session.d.ts → session/fix-session.d.ts} +6 -5
  502. package/dist/transport/{fix-session.js → session/fix-session.js} +45 -43
  503. package/dist/transport/session/fix-session.js.map +1 -0
  504. package/dist/transport/{make-fixl-session.d.ts → session/make-fix-session.d.ts} +1 -1
  505. package/dist/transport/session/make-fix-session.js +3 -0
  506. package/dist/transport/session/make-fix-session.js.map +1 -0
  507. package/dist/transport/session/session-description.d.ts +17 -0
  508. package/dist/transport/{session-description.js → session/session-description.js} +0 -0
  509. package/dist/transport/session/session-description.js.map +1 -0
  510. package/dist/transport/{fix-msg-factory.d.ts → session/session-msg-factory.d.ts} +2 -2
  511. package/dist/transport/session/session-msg-factory.js +3 -0
  512. package/dist/transport/session/session-msg-factory.js.map +1 -0
  513. package/dist/transport/session/session-state.d.ts +25 -0
  514. package/dist/transport/session/session-state.js +30 -0
  515. package/dist/transport/session/session-state.js.map +1 -0
  516. package/dist/transport/tcp/index.d.ts +3 -2
  517. package/dist/transport/tcp/index.js +3 -2
  518. package/dist/transport/tcp/index.js.map +1 -1
  519. package/dist/transport/tcp/recovering-tcp-initiator.d.ts +7 -9
  520. package/dist/transport/tcp/recovering-tcp-initiator.js +41 -16
  521. package/dist/transport/tcp/recovering-tcp-initiator.js.map +1 -1
  522. package/dist/transport/tcp/tcp-acceptor-listener.d.ts +7 -0
  523. package/dist/transport/tcp/tcp-acceptor-listener.js +70 -0
  524. package/dist/transport/tcp/tcp-acceptor-listener.js.map +1 -0
  525. package/dist/transport/tcp/tcp-acceptor.js +29 -12
  526. package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
  527. package/dist/transport/tcp/tcp-initiator-connector.d.ts +10 -0
  528. package/dist/transport/tcp/tcp-initiator-connector.js +97 -0
  529. package/dist/transport/tcp/tcp-initiator-connector.js.map +1 -0
  530. package/dist/transport/tcp/tcp-initiator.d.ts +2 -2
  531. package/dist/transport/tcp/tcp-initiator.js +28 -9
  532. package/dist/transport/tcp/tcp-initiator.js.map +1 -1
  533. package/dist/transport/tcp/tcp-transport-description.d.ts +6 -0
  534. package/dist/transport/tcp/tcp-transport-description.js +3 -0
  535. package/dist/transport/tcp/tcp-transport-description.js.map +1 -0
  536. package/dist/transport/tcp/tls-options-factory.d.ts +9 -0
  537. package/dist/transport/tcp/tls-options-factory.js +53 -0
  538. package/dist/transport/tcp/tls-options-factory.js.map +1 -0
  539. package/dist/transport/tcp/tls-options.d.ts +10 -5
  540. package/dist/transport/tcp/tls-options.js +0 -49
  541. package/dist/transport/tcp/tls-options.js.map +1 -1
  542. package/dist/transport/tick-action.d.ts +8 -0
  543. package/dist/transport/tick-action.js +13 -0
  544. package/dist/transport/tick-action.js.map +1 -0
  545. package/dist/util/buffer-helper.js +1 -1
  546. package/dist/util/buffer-helper.js.map +1 -1
  547. package/dist/util/definition-factory.d.ts +10 -0
  548. package/dist/util/definition-factory.js +56 -0
  549. package/dist/util/definition-factory.js.map +1 -0
  550. package/dist/util/dictionary-path.d.ts +4 -0
  551. package/dist/util/dictionary-path.js +3 -0
  552. package/dist/util/dictionary-path.js.map +1 -0
  553. package/dist/util/index.d.ts +1 -1
  554. package/dist/util/index.js +1 -1
  555. package/dist/util/index.js.map +1 -1
  556. package/dist/util/json-helper.d.ts +3 -1
  557. package/dist/util/json-helper.js +13 -12
  558. package/dist/util/json-helper.js.map +1 -1
  559. package/dist/util/message-generator.d.ts +1 -1
  560. package/dist/util/message-generator.js +16 -15
  561. package/dist/util/message-generator.js.map +1 -1
  562. package/dist/util/replay.d.ts +6 -3
  563. package/dist/util/replay.js +24 -26
  564. package/dist/util/replay.js.map +1 -1
  565. package/package.json +18 -13
  566. package/script/build.cmd +1 -0
  567. package/script/build.sh +1 -0
  568. package/script/test.cmd +3 -0
  569. package/src/buffer/{ascii-chars.ts → ascii/ascii-chars.ts} +0 -0
  570. package/src/buffer/ascii/ascii-encoder.ts +9 -6
  571. package/src/buffer/ascii/ascii-parser-state.ts +7 -12
  572. package/src/buffer/ascii/ascii-parser.ts +23 -16
  573. package/src/buffer/ascii/ascii-segment-parser.ts +14 -8
  574. package/src/buffer/ascii/ascii-view.ts +4 -9
  575. package/src/buffer/ascii/index.ts +1 -0
  576. package/src/buffer/ascii/parse-state.ts +8 -0
  577. package/src/buffer/ascii/time-formatter.ts +1 -1
  578. package/src/buffer/elastic-buffer.ts +7 -2
  579. package/src/buffer/encode-proxy.ts +9 -4
  580. package/src/buffer/fixml/fixml-encoder.ts +15 -11
  581. package/src/buffer/fixml/fixml-parser.ts +16 -6
  582. package/src/buffer/fixml/fixml-view.ts +4 -9
  583. package/src/buffer/fixml/populated-attributes.ts +6 -0
  584. package/src/buffer/index.ts +4 -8
  585. package/src/buffer/msg-encoder.ts +2 -1
  586. package/src/buffer/msg-view.ts +13 -9
  587. package/src/buffer/{segment-description.ts → segment/segment-description.ts} +4 -11
  588. package/src/buffer/{segment-summary.ts → segment/segment-summary.ts} +0 -0
  589. package/src/buffer/segment/segment-type.ts +8 -0
  590. package/src/buffer/structure.ts +3 -3
  591. package/src/buffer/{tag-pos.ts → tag/tag-pos.ts} +0 -0
  592. package/src/buffer/tag/tag-type.ts +13 -0
  593. package/src/buffer/{tags.ts → tag/tags.ts} +4 -16
  594. package/src/config/get-js-fx-logger.ts +4 -0
  595. package/src/config/index.ts +1 -0
  596. package/src/config/js-fix-config.ts +5 -2
  597. package/src/config/js-fix-logger.ts +0 -3
  598. package/src/dictionary/compiler/compiler-type.ts +3 -3
  599. package/src/dictionary/compiler/enum-compiler.ts +12 -1
  600. package/src/dictionary/compiler/msg-compiler.ts +8 -7
  601. package/src/dictionary/contained/contained-component-field.ts +2 -1
  602. package/src/dictionary/contained/contained-field-dispatch.ts +3 -7
  603. package/src/dictionary/contained/contained-field-dispatcher.ts +9 -0
  604. package/src/dictionary/contained/contained-field-set.ts +5 -3
  605. package/src/dictionary/contained/contained-field-type.ts +5 -0
  606. package/src/dictionary/contained/contained-field.ts +1 -6
  607. package/src/dictionary/contained/contained-group-field.ts +2 -1
  608. package/src/dictionary/contained/contained-simple-field.ts +2 -1
  609. package/src/dictionary/contained/field-dispatcher.ts +9 -0
  610. package/src/dictionary/contained/fields-dispatch.ts +46 -0
  611. package/src/dictionary/contained/index.ts +2 -0
  612. package/src/dictionary/contained-set-type.ts +5 -0
  613. package/src/dictionary/definition/component-field-definition.ts +1 -1
  614. package/src/dictionary/definition/fix-definitions.ts +2 -1
  615. package/src/dictionary/definition/group-field-definition.ts +1 -1
  616. package/src/dictionary/definition/index.ts +0 -1
  617. package/src/dictionary/definition/message-definition.ts +1 -1
  618. package/src/dictionary/definition/simple-field-definition.ts +3 -1
  619. package/src/dictionary/dict-primitive.ts +0 -13
  620. package/src/dictionary/fix-definition-source.ts +6 -0
  621. package/src/dictionary/fix-versions.ts +0 -32
  622. package/src/dictionary/index.ts +1 -5
  623. package/src/dictionary/parser/fix-repository/abbreviations-parser.ts +2 -3
  624. package/src/dictionary/parser/fix-repository/base-parser.ts +2 -3
  625. package/src/dictionary/parser/fix-repository/components-parser.ts +2 -3
  626. package/src/dictionary/parser/fix-repository/data-types-parser.ts +2 -3
  627. package/src/dictionary/parser/fix-repository/enums-parser.ts +2 -3
  628. package/src/dictionary/parser/fix-repository/fields-parser.ts +2 -3
  629. package/src/dictionary/parser/fix-repository/messages-parser.ts +2 -3
  630. package/src/dictionary/parser/fix-repository/msg-contents-parser.ts +2 -3
  631. package/src/dictionary/parser/fix-repository/repository-abbreviation.ts +6 -0
  632. package/src/dictionary/parser/fix-repository/repository-component.ts +11 -0
  633. package/src/dictionary/parser/fix-repository/repository-data-type.ts +7 -0
  634. package/src/dictionary/parser/fix-repository/repository-enum.ts +8 -0
  635. package/src/dictionary/parser/fix-repository/repository-field.ts +12 -0
  636. package/src/dictionary/parser/fix-repository/repository-message.ts +12 -0
  637. package/src/dictionary/parser/fix-repository/repository-msg-content.ts +10 -0
  638. package/src/dictionary/parser/fix-repository/repository-type.ts +0 -59
  639. package/src/dictionary/parser/fix-repository/repository-xml-parser.ts +10 -9
  640. package/src/dictionary/parser/fix-repository/repository.ts +69 -38
  641. package/src/dictionary/parser/fixml/components-parser.ts +6 -3
  642. package/src/dictionary/parser/fixml/fields-parser.ts +1 -1
  643. package/src/dictionary/parser/fixml/fix-xsd-parser.ts +2 -1
  644. package/src/dictionary/parser/fixml/include-graph.ts +2 -1
  645. package/src/dictionary/parser/fixml/xsd-parser.ts +2 -1
  646. package/src/dictionary/parser/quickfix/field-definition-parser.ts +4 -5
  647. package/src/dictionary/parser/quickfix/field-set-parser.ts +4 -5
  648. package/src/dictionary/parser/quickfix/message-parser.ts +4 -5
  649. package/src/dictionary/parser/quickfix/node-parser.ts +3 -6
  650. package/src/dictionary/parser/quickfix/parse-state.ts +8 -0
  651. package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +9 -15
  652. package/src/dictionary/sax-node.ts +7 -0
  653. package/src/dictionary/set-reduce.ts +30 -31
  654. package/src/dictionary/type-dispatcher.ts +7 -0
  655. package/src/dictionary/version-util.ts +25 -0
  656. package/src/index.ts +1 -0
  657. package/src/jsfix-cmd.ts +31 -16
  658. package/src/runtime/di-tokens.ts +48 -0
  659. package/src/runtime/engine-factory.ts +5 -0
  660. package/src/runtime/index.ts +5 -0
  661. package/src/runtime/make-config.ts +35 -0
  662. package/src/runtime/session-container.ts +180 -0
  663. package/src/runtime/session-launcher.ts +127 -0
  664. package/src/sample/http/oms/app.ts +20 -14
  665. package/src/sample/http/oms/http-client.ts +5 -2
  666. package/src/sample/http/oms/http-server.ts +5 -1
  667. package/src/sample/tcp/qf-md/app.ts +12 -12
  668. package/src/sample/tcp/qf-md/md-client.ts +4 -1
  669. package/src/sample/tcp/qf-md/md-server.ts +3 -1
  670. package/src/sample/tcp/recovering-skeleton/app.ts +37 -15
  671. package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +16 -9
  672. package/src/sample/tcp/recovering-skeleton/skeleton-client.ts +4 -2
  673. package/src/sample/tcp/recovering-skeleton/skeleton-server.ts +4 -2
  674. package/src/sample/tcp/skeleton/app.ts +10 -15
  675. package/src/sample/tcp/skeleton/skeleton-session.ts +8 -4
  676. package/src/sample/tcp/tls-trade-capture/app.ts +8 -31
  677. package/src/sample/tcp/trade-capture/app-launcher.ts +22 -0
  678. package/src/sample/tcp/trade-capture/app.ts +3 -26
  679. package/src/sample/tcp/trade-capture/trade-capture-client.ts +2 -1
  680. package/src/sample/tcp/trade-capture/trade-capture-server.ts +2 -1
  681. package/src/sample/tcp/trade-capture/trade-factory.ts +7 -1
  682. package/src/store/fix-msg-ascii-store-resend.ts +3 -2
  683. package/src/store/fix-msg-memory-store.ts +1 -1
  684. package/src/store/fix-msg-store-record.ts +6 -0
  685. package/src/store/fix-msg-store-state.ts +6 -0
  686. package/src/store/fix-msg-store.ts +1 -7
  687. package/src/transport/ascii/ascii-msg-transmitter.ts +9 -5
  688. package/src/transport/ascii/ascii-session-msg-factory.ts +2 -2
  689. package/src/transport/ascii/ascii-session.ts +9 -6
  690. package/src/transport/ascii/index.ts +0 -1
  691. package/src/transport/duplex/http-duplex.ts +1 -1
  692. package/src/transport/duplex/tcp-duplex.ts +4 -1
  693. package/src/transport/factory/index.ts +1 -0
  694. package/src/transport/factory/msg-transport.ts +55 -0
  695. package/src/transport/fix-acceptor.ts +2 -2
  696. package/src/transport/fix-entity.ts +9 -0
  697. package/src/transport/fix-initiator.ts +2 -2
  698. package/src/transport/fixml/fixml-msg-transmitter.ts +8 -4
  699. package/src/transport/fixml/fixml-session-msg-factory.ts +2 -2
  700. package/src/transport/fixml/fixml-session.ts +2 -2
  701. package/src/transport/fixml/index.ts +0 -2
  702. package/src/transport/http/html-options.ts +8 -0
  703. package/src/transport/http/html-route.ts +6 -0
  704. package/src/transport/http/http-acceptor-listener.ts +42 -0
  705. package/src/transport/http/http-acceptor.ts +5 -2
  706. package/src/transport/http/http-adapter.ts +7 -0
  707. package/src/transport/http/http-initiator.ts +40 -25
  708. package/src/transport/http/http-json-sample-adapter.ts +7 -2
  709. package/src/transport/http/http-transaction.ts +1 -1
  710. package/src/transport/http/http-transport-description.ts +9 -0
  711. package/src/transport/http/index.ts +1 -0
  712. package/src/transport/index.ts +11 -10
  713. package/src/transport/msg-application.ts +13 -0
  714. package/src/transport/msg-transmitter.ts +5 -5
  715. package/src/transport/{a-session-msg-factory.ts → session/a-session-msg-factory.ts} +4 -4
  716. package/src/transport/session/fix-session-state-args.ts +9 -0
  717. package/src/transport/{fix-session-state.ts → session/fix-session-state.ts} +4 -44
  718. package/src/transport/{fix-session.ts → session/fix-session.ts} +10 -7
  719. package/src/transport/{make-fixl-session.ts → session/make-fix-session.ts} +1 -1
  720. package/src/transport/session/session-description.ts +18 -0
  721. package/src/transport/{fix-msg-factory.ts → session/session-msg-factory.ts} +2 -2
  722. package/src/transport/session/session-state.ts +25 -0
  723. package/src/transport/tcp/index.ts +3 -2
  724. package/src/transport/tcp/recovering-tcp-initiator.ts +24 -13
  725. package/src/transport/tcp/tcp-acceptor-listener.ts +45 -0
  726. package/src/transport/tcp/tcp-acceptor.ts +11 -10
  727. package/src/transport/tcp/tcp-initiator-connector.ts +71 -0
  728. package/src/transport/tcp/tcp-initiator.ts +10 -6
  729. package/src/transport/tcp/tcp-transport-description.ts +7 -0
  730. package/src/transport/tcp/tls-options-factory.ts +55 -0
  731. package/src/transport/tcp/tls-options.ts +9 -51
  732. package/src/transport/tick-action.ts +8 -0
  733. package/src/util/definition-factory.ts +47 -0
  734. package/src/util/dictionary-path.ts +4 -0
  735. package/src/util/index.ts +1 -1
  736. package/src/util/json-helper.ts +14 -4
  737. package/src/util/message-generator.ts +6 -3
  738. package/src/util/replay.ts +26 -21
  739. package/tsconfig.json +2 -0
  740. package/dist/buffer/ascii-chars.js.map +0 -1
  741. package/dist/buffer/segment-description.js.map +0 -1
  742. package/dist/buffer/segment-summary.js.map +0 -1
  743. package/dist/buffer/tag-pos.js.map +0 -1
  744. package/dist/buffer/tags.js.map +0 -1
  745. package/dist/dictionary/fields-dispatch.js +0 -40
  746. package/dist/dictionary/fields-dispatch.js.map +0 -1
  747. package/dist/sample/launcher.d.ts +0 -12
  748. package/dist/sample/launcher.js +0 -63
  749. package/dist/sample/launcher.js.map +0 -1
  750. package/dist/sample/tcp/recovering-skeleton/respawn-2.d.ts +0 -2
  751. package/dist/sample/tcp/recovering-skeleton/respawn-2.js +0 -3
  752. package/dist/sample/tcp/recovering-skeleton/respawn-2.js.map +0 -1
  753. package/dist/store/fix-msg-ascii-store-recovery.d.ts +0 -12
  754. package/dist/store/fix-msg-ascii-store-recovery.js +0 -60
  755. package/dist/store/fix-msg-ascii-store-recovery.js.map +0 -1
  756. package/dist/store/fix-msg-ascii-store-replay.d.ts +0 -13
  757. package/dist/store/fix-msg-ascii-store-replay.js +0 -60
  758. package/dist/store/fix-msg-ascii-store-replay.js.map +0 -1
  759. package/dist/store/fix-replay-record.d.ts +0 -12
  760. package/dist/store/fix-replay-record.js +0 -12
  761. package/dist/store/fix-replay-record.js.map +0 -1
  762. package/dist/store/fix-resend-record.d.ts +0 -12
  763. package/dist/store/fix-resend-record.js +0 -12
  764. package/dist/store/fix-resend-record.js.map +0 -1
  765. package/dist/store/replay-record.d.ts +0 -6
  766. package/dist/store/replay-record.js.map +0 -1
  767. package/dist/store/store-replay-record.d.ts +0 -12
  768. package/dist/store/store-replay-record.js +0 -12
  769. package/dist/store/store-replay-record.js.map +0 -1
  770. package/dist/tcp/tls-options.d.ts +0 -5
  771. package/dist/tcp/tls-options.js +0 -45
  772. package/dist/tcp/tls-options.js.map +0 -1
  773. package/dist/test/ascii-encode.test.d.ts +0 -1
  774. package/dist/test/ascii-encode.test.js +0 -416
  775. package/dist/test/ascii-encode.test.js.map +0 -1
  776. package/dist/test/ascii-encoder.test.d.ts +0 -1
  777. package/dist/test/ascii-encoder.test.js.map +0 -1
  778. package/dist/test/ascii-parser.test.d.ts +0 -1
  779. package/dist/test/ascii-parser.test.js.map +0 -1
  780. package/dist/test/ascii-segment.test.d.ts +0 -1
  781. package/dist/test/ascii-segment.test.js.map +0 -1
  782. package/dist/test/ascii-store-recovery.test.d.ts +0 -1
  783. package/dist/test/ascii-store-recovery.test.js +0 -50
  784. package/dist/test/ascii-store-recovery.test.js.map +0 -1
  785. package/dist/test/ascii-store-replay.test.d.ts +0 -1
  786. package/dist/test/ascii-store-replay.test.js.map +0 -1
  787. package/dist/test/ascii-tag-pos.test.d.ts +0 -1
  788. package/dist/test/ascii-tag-pos.test.js.map +0 -1
  789. package/dist/test/execution-report.test.d.ts +0 -1
  790. package/dist/test/execution-report.test.js.map +0 -1
  791. package/dist/test/fix-log-replay.test.d.ts +0 -1
  792. package/dist/test/fix-log-replay.test.js.map +0 -1
  793. package/dist/test/fix-repo-dict.test.d.ts +0 -1
  794. package/dist/test/fix-repo-dict.test.js.map +0 -1
  795. package/dist/test/fixml-alloc-parse.test.d.ts +0 -1
  796. package/dist/test/fixml-alloc-parse.test.js.map +0 -1
  797. package/dist/test/fixml-mkt-data-fut-parse.test.d.ts +0 -1
  798. package/dist/test/fixml-mkt-data-fut-parse.test.js.map +0 -1
  799. package/dist/test/fixml-mkt-data-settle-parse.test.d.ts +0 -1
  800. package/dist/test/fixml-mkt-data-settle-parse.test.js.map +0 -1
  801. package/dist/test/fixml-tc-bi-lateral-parse.test.d.ts +0 -1
  802. package/dist/test/fixml-tc-bi-lateral-parse.test.js.map +0 -1
  803. package/dist/test/includes.test.d.ts +0 -1
  804. package/dist/test/includes.test.js.map +0 -1
  805. package/dist/test/logon.test.d.ts +0 -1
  806. package/dist/test/logon.test.js.map +0 -1
  807. package/dist/test/memory-store.test.d.ts +0 -1
  808. package/dist/test/memory-store.test.js.map +0 -1
  809. package/dist/test/qf-full-msg.test.d.ts +0 -1
  810. package/dist/test/qf-full-msg.test.js.map +0 -1
  811. package/dist/test/repo-full-ascii-msg.test.d.ts +0 -1
  812. package/dist/test/repo-full-ascii-msg.test.js.map +0 -1
  813. package/dist/test/repo-full-fixml-msg.test.d.ts +0 -1
  814. package/dist/test/repo-full-fixml-msg.test.js.map +0 -1
  815. package/dist/test/session-state.test.d.ts +0 -1
  816. package/dist/test/session-state.test.js.map +0 -1
  817. package/dist/test/session.test.d.ts +0 -1
  818. package/dist/test/session.test.js.map +0 -1
  819. package/dist/test/time-formatter.test.d.ts +0 -1
  820. package/dist/test/time-formatter.test.js.map +0 -1
  821. package/dist/test/to-views.js.map +0 -1
  822. package/dist/test/view-decode.test.d.ts +0 -1
  823. package/dist/test/view-decode.test.js.map +0 -1
  824. package/dist/transport/a-session-msg-factory.js.map +0 -1
  825. package/dist/transport/ascii-session-msg-factory.d.ts +0 -16
  826. package/dist/transport/ascii-session-msg-factory.js +0 -47
  827. package/dist/transport/ascii-session-msg-factory.js.map +0 -1
  828. package/dist/transport/fix-msg-factory.js.map +0 -1
  829. package/dist/transport/fix-session-state.d.ts +0 -70
  830. package/dist/transport/fix-session-state.js.map +0 -1
  831. package/dist/transport/fix-session.js.map +0 -1
  832. package/dist/transport/fixml/acceptor.d.ts +0 -3
  833. package/dist/transport/fixml/acceptor.js +0 -38
  834. package/dist/transport/fixml/acceptor.js.map +0 -1
  835. package/dist/transport/fixml-session-msg-factory.d.ts +0 -13
  836. package/dist/transport/fixml-session-msg-factory.js +0 -68
  837. package/dist/transport/fixml-session-msg-factory.js.map +0 -1
  838. package/dist/transport/make-config.d.ts +0 -4
  839. package/dist/transport/make-config.js +0 -31
  840. package/dist/transport/make-config.js.map +0 -1
  841. package/dist/transport/make-fixl-session.js.map +0 -1
  842. package/dist/transport/msg-transport.js +0 -57
  843. package/dist/transport/msg-transport.js.map +0 -1
  844. package/dist/transport/session-description.d.ts +0 -64
  845. package/dist/transport/session-description.js.map +0 -1
  846. package/dist/transport/session-msg-factory.d.ts +0 -28
  847. package/dist/transport/session-msg-factory.js +0 -153
  848. package/dist/transport/session-msg-factory.js.map +0 -1
  849. package/dist/transport/tcp/acceptor.d.ts +0 -3
  850. package/dist/transport/tcp/acceptor.js +0 -40
  851. package/dist/transport/tcp/acceptor.js.map +0 -1
  852. package/dist/transport/tcp/initiator.d.ts +0 -3
  853. package/dist/transport/tcp/initiator.js +0 -67
  854. package/dist/transport/tcp/initiator.js.map +0 -1
  855. package/dist/transport/tcp/recovering-initiator.d.ts +0 -17
  856. package/dist/transport/tcp/recovering-initiator.js +0 -30
  857. package/dist/transport/tcp/recovering-initiator.js.map +0 -1
  858. package/dist/transport/tcp/recovering_initiator.d.ts +0 -12
  859. package/dist/transport/tcp/recovering_initiator.js +0 -25
  860. package/dist/transport/tcp/recovering_initiator.js.map +0 -1
  861. package/dist/transport/tcp/resilient-initiator.d.ts +0 -12
  862. package/dist/transport/tcp/resilient-initiator.js +0 -41
  863. package/dist/transport/tcp/resilient-initiator.js.map +0 -1
  864. package/dist/types/FIX4.4/quickfix/set/header.d.ts +0 -31
  865. package/dist/types/FIX4.4/quickfix/set/header.js.map +0 -1
  866. package/dist/types/FIX4.4/quickfix/set/trailer.d.ts +0 -6
  867. package/dist/types/FIX4.4/quickfix/set/trailer.js.map +0 -1
  868. package/dist/util/dictionary-definitions.d.ts +0 -8
  869. package/dist/util/dictionary-definitions.js +0 -51
  870. package/dist/util/dictionary-definitions.js.map +0 -1
  871. package/src/dictionary/fields-dispatch.ts +0 -45
  872. package/src/sample/launcher.ts +0 -56
  873. package/src/transport/fixml/acceptor.ts +0 -29
  874. package/src/transport/make-config.ts +0 -19
  875. package/src/transport/msg-transport.ts +0 -67
  876. package/src/transport/session-description.ts +0 -70
  877. package/src/transport/tcp/acceptor.ts +0 -31
  878. package/src/transport/tcp/initiator.ts +0 -59
  879. package/src/util/dictionary-definitions.ts +0 -41
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonHelper = void 0;
4
- const buffer_1 = require("../buffer");
5
- const dictionary_1 = require("../dictionary");
4
+ const contained_1 = require("../dictionary/contained");
6
5
  const moment = require("moment");
6
+ const tag_type_1 = require("../buffer/tag/tag-type");
7
7
  class JsonHelper {
8
8
  constructor(definitions) {
9
9
  this.definitions = definitions;
10
+ this.dispatcher = new contained_1.FieldsDispatch();
10
11
  }
11
12
  static patchSimple(object, field) {
12
13
  let name = field.definition.name;
@@ -21,36 +22,36 @@ class JsonHelper {
21
22
  return;
22
23
  }
23
24
  switch (field.definition.tagType) {
24
- case buffer_1.TagType.RawData: {
25
+ case tag_type_1.TagType.RawData: {
25
26
  object[name] = Buffer.from(v, 'utf8');
26
27
  break;
27
28
  }
28
- case buffer_1.TagType.UtcTimestamp:
29
+ case tag_type_1.TagType.UtcTimestamp:
29
30
  const m = moment(v);
30
31
  const d = m.toDate();
31
32
  object[name] = d;
32
33
  break;
33
- case buffer_1.TagType.UtcDateOnly: {
34
+ case tag_type_1.TagType.UtcDateOnly: {
34
35
  const m = moment(v);
35
36
  object[name] = m.toDate();
36
37
  break;
37
38
  }
38
- case buffer_1.TagType.UtcTimeOnly: {
39
+ case tag_type_1.TagType.UtcTimeOnly: {
39
40
  const m = moment(v);
40
41
  object[name] = m.toDate();
41
42
  break;
42
43
  }
43
- case buffer_1.TagType.LocalDate: {
44
+ case tag_type_1.TagType.LocalDate: {
44
45
  const m = moment(v);
45
46
  object[name] = m.toDate();
46
47
  break;
47
48
  }
48
- case buffer_1.TagType.Float: {
49
+ case tag_type_1.TagType.Float: {
49
50
  object[name] = parseFloat(v);
50
51
  break;
51
52
  }
52
- case buffer_1.TagType.Int:
53
- case buffer_1.TagType.Length: {
53
+ case tag_type_1.TagType.Int:
54
+ case tag_type_1.TagType.Length: {
54
55
  object[name] = parseInt(v, 10);
55
56
  break;
56
57
  }
@@ -81,8 +82,8 @@ class JsonHelper {
81
82
  group: (gf) => this.patchGroup(object, gf),
82
83
  component: (cf) => this.patchComponent(object, cf)
83
84
  };
84
- dictionary_1.dispatchFields(set.localAttribute, dispatcher);
85
- dictionary_1.dispatchFields(set.fields, dispatcher);
85
+ this.dispatcher.dispatchFields(set.localAttribute, dispatcher);
86
+ this.dispatcher.dispatchFields(set.fields, dispatcher);
86
87
  }
87
88
  patchComponent(object, cf) {
88
89
  const c = object[cf.name] || object[cf.definition.name];
@@ -1 +1 @@
1
- {"version":3,"file":"json-helper.js","sourceRoot":"","sources":["../../src/util/json-helper.ts"],"names":[],"mappings":";;;AAAA,sCAAmC;AAEnC,8CAA0L;AAC1L,iCAAiC;AAEjC,MAAa,UAAU;IACrB,YAA6B,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;IACxD,CAAC;IAE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EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAC/D,SAAS,EAAE,CAAC,EAA2B,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC;SAC5E,CAAA;QAED,2BAAc,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;QAC9C,2BAAc,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACxC,CAAC;IAEO,cAAc,CAAE,MAAoB,EAAE,EAA2B;QACvE,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACvD,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;SACvC;IACH,CAAC;IAEO,UAAU,CAAE,MAAoB,EAAE,EAAuB;QAC/D,MAAM,GAAG,GAAmB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACzE,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAChB,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;YACxC,CAAC,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAzGD,gCAyGC","sourcesContent":["import { TagType } from '../buffer'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { ContainedSimpleField, ContainedFieldSet, ContainedGroupField, ContainedComponentField, dispatchFields, IFieldDispatcher, FixDefinitions, MessageDefinition } from '../dictionary'\r\nimport moment = require('moment')\r\n\r\nexport class JsonHelper {\r\n constructor (public readonly definitions: FixDefinitions) {\r\n }\r\n\r\n private static patchSimple (object: ILooseObject, field: ContainedSimpleField) {\r\n let name: string = field.definition.name\r\n let v: any = object[name]\r\n if (v == null) {\r\n v = object[field.name]\r\n if (v !== null) {\r\n name = field.name\r\n }\r\n }\r\n if (v == null) {\r\n return\r\n }\r\n switch (field.definition.tagType) {\r\n case TagType.RawData: {\r\n object[name] = Buffer.from(v, 'utf8')\r\n break\r\n }\r\n\r\n case TagType.UtcTimestamp:\r\n const m = moment(v)\r\n const d = m.toDate()\r\n object[name] = d\r\n break\r\n\r\n case TagType.UtcDateOnly: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.UtcTimeOnly: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.LocalDate: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.Float: {\r\n object[name] = parseFloat(v)\r\n break\r\n }\r\n\r\n case TagType.Int:\r\n case TagType.Length: {\r\n object[name] = parseInt(v, 10)\r\n break\r\n }\r\n }\r\n }\r\n\r\n public fromJson (fileName: string, msgType: string): ILooseObject {\r\n const msg: ILooseObject = require(fileName)\r\n const def: MessageDefinition = this.definitions.message.get(msgType)\r\n if (!def) {\r\n return msg\r\n }\r\n if (msg.Batch) {\r\n msg.Batch.forEach((m: ILooseObject) => {\r\n this.patchJsonFields(def, m)\r\n })\r\n } else {\r\n this.patchJsonFields(def, msg)\r\n }\r\n return msg\r\n }\r\n\r\n public patchJsonFields (set: ContainedFieldSet, object: ILooseObject): void {\r\n if (!object) {\r\n return\r\n }\r\n\r\n const dispatcher: IFieldDispatcher = {\r\n simple: (field: ContainedSimpleField) => JsonHelper.patchSimple(object, field),\r\n group: (gf: ContainedGroupField) => this.patchGroup(object, gf),\r\n component: (cf: ContainedComponentField) => this.patchComponent(object, cf)\r\n }\r\n\r\n dispatchFields(set.localAttribute, dispatcher)\r\n dispatchFields(set.fields, dispatcher)\r\n }\r\n\r\n private patchComponent (object: ILooseObject, cf: ContainedComponentField) {\r\n const c = object[cf.name] || object[cf.definition.name]\r\n if (c) {\r\n this.patchJsonFields(cf.definition, c)\r\n }\r\n }\r\n\r\n private patchGroup (object: ILooseObject, gf: ContainedGroupField) {\r\n const arr: ILooseObject[] = object[gf.definition.name] || object[gf.name]\r\n if (arr) {\r\n arr.forEach((o) => {\r\n this.patchJsonFields(gf.definition, o)\r\n })\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"json-helper.js","sourceRoot":"","sources":["../../src/util/json-helper.ts"],"names":[],"mappings":";;;AACA,uDAMgC;AAGhC,iCAAiC;AAEjC,qDAAgD;AAEhD,MAAa,UAAU;IAErB,YAA6B,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;QADxD,eAAU,GAAmB,IAAI,0BAAc,EAAE,CAAA;IAEjD,CAAC;IAEO,MAAM,CAAC,WAAW,CAAE,MAAoB,EAAE,KAA2B;QAC3E,IAAI,IAAI,GAAW,KAAK,CAAC,UAAU,CAAC,IAAI,CAAA;QACxC,IAAI,CAAC,GAAQ,MAAM,CAAC,IAAI,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,IAAI,EAAE;YACb,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtB,IAAI,CAAC,KAAK,IAAI,EAAE;gBACd,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;aAClB;SACF;QACD,IAAI,CAAC,IAAI,IAAI,EAAE;YACb,OAAM;SACP;QACD,QAAQ,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE;YAChC,KAAK,kBAAO,CAAC,OAAO,CAAC,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;gBACrC,MAAK;aACN;YAED,KAAK,kBAAO,CAAC,YAAY;gBACvB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;gBACnB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,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C,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACzE,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAChB,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;YACxC,CAAC,CAAC,CAAA;SACH;IACH,CAAC;CACF;AA1GD,gCA0GC","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\nimport {\r\n ContainedSimpleField,\r\n ContainedFieldSet,\r\n ContainedGroupField,\r\n ContainedComponentField,\r\n FieldsDispatch\r\n} from '../dictionary/contained'\r\nimport { FixDefinitions, MessageDefinition } from '../dictionary/definition'\r\n\r\nimport moment = require('moment')\r\nimport { IFieldDispatcher } from '../dictionary/contained/field-dispatcher'\r\nimport { TagType } from '../buffer/tag/tag-type'\r\n\r\nexport class JsonHelper {\r\n dispatcher: FieldsDispatch = new FieldsDispatch()\r\n constructor (public readonly definitions: FixDefinitions) {\r\n }\r\n\r\n private static patchSimple (object: ILooseObject, field: ContainedSimpleField) {\r\n let name: string = field.definition.name\r\n let v: any = object[name]\r\n if (v == null) {\r\n v = object[field.name]\r\n if (v !== null) {\r\n name = field.name\r\n }\r\n }\r\n if (v == null) {\r\n return\r\n }\r\n switch (field.definition.tagType) {\r\n case TagType.RawData: {\r\n object[name] = Buffer.from(v, 'utf8')\r\n break\r\n }\r\n\r\n case TagType.UtcTimestamp:\r\n const m = moment(v)\r\n const d = m.toDate()\r\n object[name] = d\r\n break\r\n\r\n case TagType.UtcDateOnly: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.UtcTimeOnly: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.LocalDate: {\r\n const m = moment(v)\r\n object[name] = m.toDate()\r\n break\r\n }\r\n\r\n case TagType.Float: {\r\n object[name] = parseFloat(v)\r\n break\r\n }\r\n\r\n case TagType.Int:\r\n case TagType.Length: {\r\n object[name] = parseInt(v, 10)\r\n break\r\n }\r\n }\r\n }\r\n\r\n public fromJson (fileName: string, msgType: string): ILooseObject {\r\n const msg: ILooseObject = require(fileName)\r\n const def: MessageDefinition = this.definitions.message.get(msgType)\r\n if (!def) {\r\n return msg\r\n }\r\n if (msg.Batch) {\r\n msg.Batch.forEach((m: ILooseObject) => {\r\n this.patchJsonFields(def, m)\r\n })\r\n } else {\r\n this.patchJsonFields(def, msg)\r\n }\r\n return msg\r\n }\r\n\r\n public patchJsonFields (set: ContainedFieldSet, object: ILooseObject): void {\r\n if (!object) {\r\n return\r\n }\r\n\r\n const dispatcher: IFieldDispatcher = {\r\n simple: (field: ContainedSimpleField) => JsonHelper.patchSimple(object, field),\r\n group: (gf: ContainedGroupField) => this.patchGroup(object, gf),\r\n component: (cf: ContainedComponentField) => this.patchComponent(object, cf)\r\n }\r\n\r\n this.dispatcher.dispatchFields(set.localAttribute, dispatcher)\r\n this.dispatcher.dispatchFields(set.fields, dispatcher)\r\n }\r\n\r\n private patchComponent (object: ILooseObject, cf: ContainedComponentField) {\r\n const c = object[cf.name] || object[cf.definition.name]\r\n if (c) {\r\n this.patchJsonFields(cf.definition, c)\r\n }\r\n }\r\n\r\n private patchGroup (object: ILooseObject, gf: ContainedGroupField) {\r\n const arr: ILooseObject[] = object[gf.definition.name] || object[gf.name]\r\n if (arr) {\r\n arr.forEach((o) => {\r\n this.patchJsonFields(gf.definition, o)\r\n })\r\n }\r\n }\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { ILooseObject } from '../collections/collection';
2
- import { FixDefinitions, SimpleFieldDefinition } from '../dictionary';
2
+ import { FixDefinitions, SimpleFieldDefinition } from '../dictionary/definition';
3
3
  export declare class MessageGenerator {
4
4
  readonly words: string[];
5
5
  readonly definitions: FixDefinitions;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageGenerator = void 0;
4
- const buffer_1 = require("../buffer");
5
4
  const dictionary_1 = require("../dictionary");
5
+ const tag_type_1 = require("../buffer/tag/tag-type");
6
6
  class MessageGenerator {
7
7
  constructor(words, definitions) {
8
8
  this.words = words;
@@ -15,13 +15,13 @@ class MessageGenerator {
15
15
  const keys = field.enums.keys();
16
16
  const choice = keys[Math.floor(Math.random() * keys.length)];
17
17
  switch (tagType) {
18
- case buffer_1.TagType.Int: {
18
+ case tag_type_1.TagType.Int: {
19
19
  return parseInt(choice, 10);
20
20
  }
21
- case buffer_1.TagType.Float: {
21
+ case tag_type_1.TagType.Float: {
22
22
  return parseFloat(choice);
23
23
  }
24
- case buffer_1.TagType.Boolean: {
24
+ case tag_type_1.TagType.Boolean: {
25
25
  return choice === 'Y';
26
26
  }
27
27
  default: {
@@ -56,7 +56,8 @@ class MessageGenerator {
56
56
  return this.toObject(def, density, repeatGroups);
57
57
  }
58
58
  toObject(set, density, repeatGroups) {
59
- return dictionary_1.reduceSet(set, {
59
+ const reducer = new dictionary_1.SetReduce();
60
+ return reducer.reduce(set, {
60
61
  simple: (a, sf) => {
61
62
  const tag = sf.definition.tag;
62
63
  let include = tag === set.firstSimple.definition.tag || this.length > 0 || Math.random() <= density;
@@ -87,10 +88,10 @@ class MessageGenerator {
87
88
  createSimple(field) {
88
89
  const tagType = field.definition.tagType;
89
90
  switch (tagType) {
90
- case buffer_1.TagType.String: {
91
+ case tag_type_1.TagType.String: {
91
92
  return this.nextString();
92
93
  }
93
- case buffer_1.TagType.Float: {
94
+ case tag_type_1.TagType.Float: {
94
95
  this.length = 0;
95
96
  const sign = MessageGenerator.randomIntFromInterval(1, 10) <= 5 ? 1 : -1;
96
97
  const num = sign * MessageGenerator.randomIntFromInterval(1, 100000);
@@ -98,38 +99,38 @@ class MessageGenerator {
98
99
  const r = num * Math.pow(10, -1 * raised);
99
100
  return Math.round(r * 1e7) / 1e7;
100
101
  }
101
- case buffer_1.TagType.Int: {
102
+ case tag_type_1.TagType.Int: {
102
103
  this.length = 0;
103
104
  return MessageGenerator.randomIntFromInterval(1, 100000);
104
105
  }
105
- case buffer_1.TagType.Length: {
106
+ case tag_type_1.TagType.Length: {
106
107
  this.length = MessageGenerator.randomIntFromInterval(5, 20);
107
108
  return this.length;
108
109
  }
109
- case buffer_1.TagType.Boolean: {
110
+ case tag_type_1.TagType.Boolean: {
110
111
  this.length = 0;
111
112
  return MessageGenerator.randomIntFromInterval(1, 2) === 1;
112
113
  }
113
- case buffer_1.TagType.UtcDateOnly: {
114
+ case tag_type_1.TagType.UtcDateOnly: {
114
115
  this.length = 0;
115
116
  const now = new Date();
116
117
  return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 0, 0, 0, 0));
117
118
  }
118
- case buffer_1.TagType.UtcTimeOnly: {
119
+ case tag_type_1.TagType.UtcTimeOnly: {
119
120
  this.length = 0;
120
121
  const s = new Date();
121
122
  return new Date(Date.UTC(0, 0, 0, s.getUTCHours(), s.getUTCMinutes(), s.getUTCSeconds(), s.getUTCMilliseconds()));
122
123
  }
123
- case buffer_1.TagType.UtcTimestamp: {
124
+ case tag_type_1.TagType.UtcTimestamp: {
124
125
  this.length = 0;
125
126
  const now = new Date();
126
127
  return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()));
127
128
  }
128
- case buffer_1.TagType.LocalDate: {
129
+ case tag_type_1.TagType.LocalDate: {
129
130
  const now = new Date();
130
131
  return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
131
132
  }
132
- case buffer_1.TagType.RawData: {
133
+ case tag_type_1.TagType.RawData: {
133
134
  const length = this.length;
134
135
  this.length = 0;
135
136
  return length > 0 ? MessageGenerator.makeBuffer(length) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"message-generator.js","sourceRoot":"","sources":["../../src/util/message-generator.ts"],"names":[],"mappings":";;;AAAA,sCAAmC;AAEnC,8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AAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;gBACtB,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,EAC5D,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;aAChB;YAED,KAAK,gBAAO,CAAC,OAAO,CAAC,CAAC;gBACpB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;gBAC1B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;gBACf,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;aAC/D;YAED,OAAO,CAAC,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;aACjD;SACF;IACH,CAAC;IAEO,UAAU;QAChB,MAAM,KAAK,GAAa,IAAI,CAAC,KAAK,CAAA;QAClC,MAAM,CAAC,GAAW,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE;YAC9B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;SACd;QACD,OAAO,CAAC,CAAA;IACV,CAAC;CACF;AAzKD,4CAyKC","sourcesContent":["import { TagType } from '../buffer'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { ContainedComponentField, ContainedGroupField, ContainedFieldSet, ContainedSimpleField, FixDefinitions, MessageDefinition, SimpleFieldDefinition, reduceSet } from '../dictionary'\r\n\r\nexport class MessageGenerator {\r\n private word: number = 0\r\n private length: number = 0\r\n\r\n constructor (public readonly words: string[], public readonly definitions: FixDefinitions) {\r\n }\r\n\r\n public static getRandomEnum (field: SimpleFieldDefinition) {\r\n const tagType: TagType = field.tagType\r\n const keys: string[] = field.enums.keys()\r\n const choice: string = keys[Math.floor(Math.random() * keys.length)]\r\n switch (tagType) {\r\n case TagType.Int: {\r\n return parseInt(choice, 10)\r\n }\r\n case TagType.Float: {\r\n return parseFloat(choice)\r\n }\r\n case TagType.Boolean: {\r\n return choice === 'Y'\r\n }\r\n default: {\r\n return choice\r\n }\r\n }\r\n }\r\n\r\n private static randomIntFromInterval (min: number, max: number): number {\r\n return Math.floor(Math.random() * (max - min + 1) + min)\r\n }\r\n\r\n private static makeRandomString (len: number): string {\r\n let text: string = ''\r\n const possible: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\r\n\r\n for (let i: number = 0; i < len; i++) {\r\n text += possible.charAt(Math.floor(Math.random() * possible.length))\r\n }\r\n\r\n return text\r\n }\r\n\r\n private static makeBuffer (len: number): Buffer {\r\n return Buffer.from(MessageGenerator.makeRandomString(len))\r\n }\r\n\r\n public generate (msgType: string, density?: number, repeatGroups: boolean = true): ILooseObject {\r\n if (!density) {\r\n density = 1.0\r\n }\r\n density = Math.max(0.2, density)\r\n density = Math.min(1.0, density)\r\n const def: MessageDefinition = this.definitions.message.get(msgType)\r\n if (!def) {\r\n throw new Error(`definitions do not contain type ${msgType}`)\r\n }\r\n return this.toObject(def, density, repeatGroups)\r\n }\r\n\r\n private toObject (set: ContainedFieldSet, density: number, repeatGroups: boolean): ILooseObject {\r\n return reduceSet<ILooseObject>(set, {\r\n simple: (a: ILooseObject, sf: ContainedSimpleField) => {\r\n const tag: number = sf.definition.tag\r\n let include = tag === set.firstSimple.definition.tag || this.length > 0 || Math.random() <= density\r\n if (include) {\r\n const val: any = sf.definition.isEnum() ? MessageGenerator.getRandomEnum(sf.definition) : this.createSimple(sf)\r\n if (val != null) {\r\n a[sf.name] = val\r\n }\r\n }\r\n },\r\n component: (a: ILooseObject, cf: ContainedComponentField) => {\r\n if (cf.name !== 'StandardHeader' && cf.name !== 'StandardTrailer') {\r\n a[cf.name] = this.toObject(cf.definition, density, repeatGroups)\r\n }\r\n },\r\n group: (a: ILooseObject, gf: ContainedGroupField) => {\r\n if (repeatGroups) {\r\n const numberGroups: number = MessageGenerator.randomIntFromInterval(1, 3)\r\n const arr: ILooseObject[] = new Array(numberGroups)\r\n a[gf.name] = arr\r\n for (let j: number = 0; j < numberGroups; ++j) {\r\n arr[j] = this.toObject(gf.definition, density, repeatGroups)\r\n }\r\n }\r\n }\r\n }, {})\r\n }\r\n\r\n private createSimple (field: ContainedSimpleField): any {\r\n const tagType: TagType = field.definition.tagType\r\n switch (tagType) {\r\n\r\n case TagType.String: {\r\n return this.nextString()\r\n }\r\n\r\n case TagType.Float: {\r\n this.length = 0\r\n const sign = MessageGenerator.randomIntFromInterval(1, 10) <= 5 ? 1 : -1\r\n const num = sign * MessageGenerator.randomIntFromInterval(1, 100000)\r\n const raised = MessageGenerator.randomIntFromInterval(1, 8)\r\n const r = num * Math.pow(10, -1 * raised)\r\n // console.log(`sign = ${sign} num = ${num} raised = ${raised} r = ${r} ret = ${ret}`)\r\n return Math.round(r * 1e7) / 1e7\r\n }\r\n\r\n case TagType.Int: {\r\n this.length = 0\r\n return MessageGenerator.randomIntFromInterval(1, 100000)\r\n }\r\n\r\n case TagType.Length: {\r\n this.length = MessageGenerator.randomIntFromInterval(5, 20)\r\n return this.length\r\n }\r\n\r\n case TagType.Boolean: {\r\n this.length = 0\r\n return MessageGenerator.randomIntFromInterval(1, 2) === 1\r\n }\r\n\r\n case TagType.UtcDateOnly: {\r\n this.length = 0\r\n const now: Date = new Date()\r\n return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()\r\n , 0, 0, 0, 0))\r\n }\r\n\r\n case TagType.UtcTimeOnly: {\r\n this.length = 0\r\n const s: Date = new Date()\r\n return new Date(Date.UTC(0, 0, 0, s.getUTCHours(), s.getUTCMinutes(),\r\n s.getUTCSeconds(), s.getUTCMilliseconds()))\r\n }\r\n\r\n case TagType.UtcTimestamp: {\r\n this.length = 0\r\n const now: Date = new Date()\r\n return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),\r\n now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()))\r\n }\r\n\r\n case TagType.LocalDate: {\r\n const now = new Date()\r\n return new Date(now.getFullYear(), now.getMonth(), now.getDate()\r\n , 0, 0, 0, 0)\r\n }\r\n\r\n case TagType.RawData: {\r\n const length = this.length\r\n this.length = 0\r\n return length > 0 ? MessageGenerator.makeBuffer(length) : null\r\n }\r\n\r\n default: {\r\n throw new Error(`cannot manage type ${tagType}`)\r\n }\r\n }\r\n }\r\n\r\n private nextString (): string {\r\n const words: string[] = this.words\r\n const w: string = words[this.word++]\r\n if (this.word === words.length) {\r\n this.word = 0\r\n }\r\n return w\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"message-generator.js","sourceRoot":"","sources":["../../src/util/message-generator.ts"],"names":[],"mappings":";;;AAGA,8CAAyC;AACzC,qDAAgD;AAEhD,MAAa,gBAAgB;IAI3B,YAA6B,KAAe,EAAkB,WAA2B;QAA5D,UAAK,GAAL,KAAK,CAAU;QAAkB,gBAAW,GAAX,WAAW,CAAgB;QAHjF,SAAI,GAAW,CAAC,CAAA;QAChB,WAAM,GAAW,CAAC,CAAA;IAG1B,CAAC;IAEM,MAAM,CAAC,aAAa,CAAE,KAA4B;QACvD,MAAM,OAAO,GAAY,KAAK,CAAC,OAAO,CAAA;QACtC,MAAM,IAAI,GAAa,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;QACzC,MAAM,MAAM,GAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;QACpE,QAAQ,OAAO,EAAE;YACf,KAAK,kBAAO,CAAC,GAAG,CAAC,CAAC;gBAChB,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;aAC5B;YACD,KAAK,kBAAO,CAAC,KAAK,CA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ACH,CAAC;IAEO,UAAU;QAChB,MAAM,KAAK,GAAa,IAAI,CAAC,KAAK,CAAA;QAClC,MAAM,CAAC,GAAW,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE;YAC9B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;SACd;QACD,OAAO,CAAC,CAAA;IACV,CAAC;CACF;AA1KD,4CA0KC","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\nimport { ContainedComponentField, ContainedGroupField, ContainedFieldSet, ContainedSimpleField } from '../dictionary/contained'\r\nimport { FixDefinitions, MessageDefinition, SimpleFieldDefinition } from '../dictionary/definition'\r\nimport { SetReduce } from '../dictionary'\r\nimport { TagType } from '../buffer/tag/tag-type'\r\n\r\nexport class MessageGenerator {\r\n private word: number = 0\r\n private length: number = 0\r\n\r\n constructor (public readonly words: string[], public readonly definitions: FixDefinitions) {\r\n }\r\n\r\n public static getRandomEnum (field: SimpleFieldDefinition) {\r\n const tagType: TagType = field.tagType\r\n const keys: string[] = field.enums.keys()\r\n const choice: string = keys[Math.floor(Math.random() * keys.length)]\r\n switch (tagType) {\r\n case TagType.Int: {\r\n return parseInt(choice, 10)\r\n }\r\n case TagType.Float: {\r\n return parseFloat(choice)\r\n }\r\n case TagType.Boolean: {\r\n return choice === 'Y'\r\n }\r\n default: {\r\n return choice\r\n }\r\n }\r\n }\r\n\r\n private static randomIntFromInterval (min: number, max: number): number {\r\n return Math.floor(Math.random() * (max - min + 1) + min)\r\n }\r\n\r\n private static makeRandomString (len: number): string {\r\n let text: string = ''\r\n const possible: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\r\n\r\n for (let i: number = 0; i < len; i++) {\r\n text += possible.charAt(Math.floor(Math.random() * possible.length))\r\n }\r\n\r\n return text\r\n }\r\n\r\n private static makeBuffer (len: number): Buffer {\r\n return Buffer.from(MessageGenerator.makeRandomString(len))\r\n }\r\n\r\n public generate (msgType: string, density?: number, repeatGroups: boolean = true): ILooseObject {\r\n if (!density) {\r\n density = 1.0\r\n }\r\n density = Math.max(0.2, density)\r\n density = Math.min(1.0, density)\r\n const def: MessageDefinition = this.definitions.message.get(msgType)\r\n if (!def) {\r\n throw new Error(`definitions do not contain type ${msgType}`)\r\n }\r\n return this.toObject(def, density, repeatGroups)\r\n }\r\n\r\n private toObject (set: ContainedFieldSet, density: number, repeatGroups: boolean): ILooseObject {\r\n const reducer = new SetReduce<ILooseObject>()\r\n return reducer.reduce(set, {\r\n simple: (a: ILooseObject, sf: ContainedSimpleField) => {\r\n const tag: number = sf.definition.tag\r\n let include = tag === set.firstSimple.definition.tag || this.length > 0 || Math.random() <= density\r\n if (include) {\r\n const val: any = sf.definition.isEnum() ? MessageGenerator.getRandomEnum(sf.definition) : this.createSimple(sf)\r\n if (val != null) {\r\n a[sf.name] = val\r\n }\r\n }\r\n },\r\n component: (a: ILooseObject, cf: ContainedComponentField) => {\r\n if (cf.name !== 'StandardHeader' && cf.name !== 'StandardTrailer') {\r\n a[cf.name] = this.toObject(cf.definition, density, repeatGroups)\r\n }\r\n },\r\n group: (a: ILooseObject, gf: ContainedGroupField) => {\r\n if (repeatGroups) {\r\n const numberGroups: number = MessageGenerator.randomIntFromInterval(1, 3)\r\n const arr: ILooseObject[] = new Array(numberGroups)\r\n a[gf.name] = arr\r\n for (let j: number = 0; j < numberGroups; ++j) {\r\n arr[j] = this.toObject(gf.definition, density, repeatGroups)\r\n }\r\n }\r\n }\r\n }, {})\r\n }\r\n\r\n private createSimple (field: ContainedSimpleField): any {\r\n const tagType: TagType = field.definition.tagType\r\n switch (tagType) {\r\n\r\n case TagType.String: {\r\n return this.nextString()\r\n }\r\n\r\n case TagType.Float: {\r\n this.length = 0\r\n const sign = MessageGenerator.randomIntFromInterval(1, 10) <= 5 ? 1 : -1\r\n const num = sign * MessageGenerator.randomIntFromInterval(1, 100000)\r\n const raised = MessageGenerator.randomIntFromInterval(1, 8)\r\n const r = num * Math.pow(10, -1 * raised)\r\n // console.log(`sign = ${sign} num = ${num} raised = ${raised} r = ${r} ret = ${ret}`)\r\n return Math.round(r * 1e7) / 1e7\r\n }\r\n\r\n case TagType.Int: {\r\n this.length = 0\r\n return MessageGenerator.randomIntFromInterval(1, 100000)\r\n }\r\n\r\n case TagType.Length: {\r\n this.length = MessageGenerator.randomIntFromInterval(5, 20)\r\n return this.length\r\n }\r\n\r\n case TagType.Boolean: {\r\n this.length = 0\r\n return MessageGenerator.randomIntFromInterval(1, 2) === 1\r\n }\r\n\r\n case TagType.UtcDateOnly: {\r\n this.length = 0\r\n const now: Date = new Date()\r\n return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()\r\n , 0, 0, 0, 0))\r\n }\r\n\r\n case TagType.UtcTimeOnly: {\r\n this.length = 0\r\n const s: Date = new Date()\r\n return new Date(Date.UTC(0, 0, 0, s.getUTCHours(), s.getUTCMinutes(),\r\n s.getUTCSeconds(), s.getUTCMilliseconds()))\r\n }\r\n\r\n case TagType.UtcTimestamp: {\r\n this.length = 0\r\n const now: Date = new Date()\r\n return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),\r\n now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()))\r\n }\r\n\r\n case TagType.LocalDate: {\r\n const now = new Date()\r\n return new Date(now.getFullYear(), now.getMonth(), now.getDate()\r\n , 0, 0, 0, 0)\r\n }\r\n\r\n case TagType.RawData: {\r\n const length = this.length\r\n this.length = 0\r\n return length > 0 ? MessageGenerator.makeBuffer(length) : null\r\n }\r\n\r\n default: {\r\n throw new Error(`cannot manage type ${tagType}`)\r\n }\r\n }\r\n }\r\n\r\n private nextString (): string {\r\n const words: string[] = this.words\r\n const w: string = words[this.word++]\r\n if (this.word === words.length) {\r\n this.word = 0\r\n }\r\n return w\r\n }\r\n}\r\n"]}
@@ -1,4 +1,7 @@
1
1
  import { MsgView } from '../buffer';
2
- import { FixDefinitions } from '../dictionary';
3
- import { ISessionDescription } from '../transport';
4
- export declare function replayFixFile(definitions: FixDefinitions, sessionDescription: ISessionDescription, replayFile: string, delimiter: number): Promise<MsgView[]>;
2
+ import { IJsFixConfig } from '../config';
3
+ export declare class FileReplayer {
4
+ readonly config: IJsFixConfig;
5
+ constructor(config: IJsFixConfig);
6
+ replayFixFile(replayFile: string): Promise<MsgView[]>;
7
+ }
@@ -1,34 +1,32 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.replayFixFile = void 0;
3
+ exports.FileReplayer = void 0;
13
4
  const transport_1 = require("../transport");
14
- const config_1 = require("../config");
15
- function replayFixFile(definitions, sessionDescription, replayFile, delimiter) {
16
- return __awaiter(this, void 0, void 0, function* () {
5
+ const factory_1 = require("../transport/factory");
6
+ class FileReplayer {
7
+ constructor(config) {
8
+ this.config = config;
9
+ }
10
+ replayFixFile(replayFile) {
17
11
  return new Promise((accept, reject) => {
18
- const arr = [];
19
- const config = new config_1.JsFixConfig(null, definitions, sessionDescription, delimiter);
20
- const transport = new transport_1.MsgTransport(1, config, new transport_1.FileDuplex(replayFile));
21
- transport.receiver.on('msg', (msgType, m) => {
22
- arr.push(m.clone());
23
- });
24
- transport.receiver.on('end', () => {
25
- accept(arr);
26
- });
27
- transport.receiver.on('error', (e) => {
12
+ try {
13
+ const arr = [];
14
+ const transport = new factory_1.MsgTransport(1, this.config, new transport_1.FileDuplex(replayFile));
15
+ transport.receiver.on('msg', (msgType, m) => {
16
+ arr.push(m.clone());
17
+ });
18
+ transport.receiver.on('end', () => {
19
+ accept(arr);
20
+ });
21
+ transport.receiver.on('error', (e) => {
22
+ reject(e);
23
+ });
24
+ }
25
+ catch (e) {
28
26
  reject(e);
29
- });
27
+ }
30
28
  });
31
- });
29
+ }
32
30
  }
33
- exports.replayFixFile = replayFixFile;
31
+ exports.FileReplayer = FileReplayer;
34
32
  //# sourceMappingURL=replay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/util/replay.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,4CAA4E;AAC5E,sCAAuC;AAEvC,SAAsB,aAAa,CAAE,WAA2B,EAC5B,kBAAuC,EACvC,UAAkB,EAClB,SAAiB;;QACnD,OAAO,IAAI,OAAO,CAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YAC/C,MAAM,GAAG,GAAc,EAAE,CAAA;YACzB,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAA;YAChF,MAAM,SAAS,GAAiB,IAAI,wBAAY,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,sBAAU,CAAC,UAAU,CAAC,CAAC,CAAA;YACvF,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,OAAe,EAAE,CAAU,EAAE,EAAE;gBAE3D,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;YACF,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAChC,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YACF,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACnC,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA;AAnBD,sCAmBC","sourcesContent":["import { MsgView } from '../buffer'\r\nimport { FixDefinitions } from '../dictionary'\r\nimport { ISessionDescription, MsgTransport, FileDuplex } from '../transport'\r\nimport { JsFixConfig } from '../config'\r\n\r\nexport async function replayFixFile (definitions: FixDefinitions,\r\n sessionDescription: ISessionDescription,\r\n replayFile: string,\r\n delimiter: number): Promise<MsgView[]> {\r\n return new Promise<MsgView[]>((accept, reject) => {\r\n const arr: MsgView[] = []\r\n const config = new JsFixConfig(null, definitions, sessionDescription, delimiter)\r\n const transport: MsgTransport = new MsgTransport(1, config, new FileDuplex(replayFile))\r\n transport.receiver.on('msg', (msgType: string, m: MsgView) => {\r\n // note must clone if a view is to be saved after this call\r\n arr.push(m.clone())\r\n })\r\n transport.receiver.on('end', () => {\r\n accept(arr)\r\n })\r\n transport.receiver.on('error', (e) => {\r\n reject(e)\r\n })\r\n })\r\n}\r\n"]}
1
+ {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/util/replay.ts"],"names":[],"mappings":";;;AACA,4CAAyC;AAEzC,kDAAmD;AAEnD,MAAa,YAAY;IACvB,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACjD,CAAC;IAED,aAAa,CAAE,UAAkB;QAC/B,OAAO,IAAI,OAAO,CAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YAC/C,IAAI;gBACF,MAAM,GAAG,GAAc,EAAE,CAAA;gBACzB,MAAM,SAAS,GAAiB,IAAI,sBAAY,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,sBAAU,CAAC,UAAU,CAAC,CAAC,CAAA;gBAC5F,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,OAAe,EAAE,CAAU,EAAE,EAAE;oBAE3D,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBACrB,CAAC,CAAC,CAAA;gBACF,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBAChC,MAAM,CAAC,GAAG,CAAC,CAAA;gBACb,CAAC,CAAC,CAAA;gBACF,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACnC,MAAM,CAAC,CAAC,CAAC,CAAA;gBACX,CAAC,CAAC,CAAA;aACH;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,CAAC,CAAC,CAAA;aACV;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAxBD,oCAwBC","sourcesContent":["import { MsgView } from '../buffer'\r\nimport { FileDuplex } from '../transport'\r\nimport { IJsFixConfig } from '../config'\r\nimport { MsgTransport } from '../transport/factory'\r\n\r\nexport class FileReplayer {\r\n constructor (public readonly config: IJsFixConfig) {\r\n }\r\n\r\n replayFixFile (replayFile: string): Promise<MsgView[]> {\r\n return new Promise<MsgView[]>((accept, reject) => {\r\n try {\r\n const arr: MsgView[] = []\r\n const transport: MsgTransport = new MsgTransport(1, this.config, new FileDuplex(replayFile))\r\n transport.receiver.on('msg', (msgType: string, m: MsgView) => {\r\n // note must clone if a view is to be saved after this call\r\n arr.push(m.clone())\r\n })\r\n transport.receiver.on('end', () => {\r\n accept(arr)\r\n })\r\n transport.receiver.on('error', (e) => {\r\n reject(e)\r\n })\r\n } catch (e) {\r\n reject(e)\r\n }\r\n })\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jspurefix",
3
- "version": "1.4.1",
3
+ "version": "2.0.3",
4
4
  "description": "pure node js fix engine",
5
5
  "keywords": [
6
6
  "typescript",
@@ -23,6 +23,7 @@
23
23
  "url": "git+https://github.com/TimelordUK/jspurefix.git"
24
24
  },
25
25
  "scripts": {
26
+ "circular": "madge --circular --extensions js dist && madge --circular --extensions ts src",
26
27
  "test": "jest",
27
28
  "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
28
29
  "cmd": "cd dist && node jsfix-cmd",
@@ -40,6 +41,7 @@
40
41
  "tcp-qf-md": "cd dist/sample/tcp/qf-md && node app",
41
42
  "tcp-tls-tc": "cd dist/sample/tcp/tls-trade-capture && node app",
42
43
  "tcp-tc": "cd dist/sample/tcp/trade-capture && node app",
44
+ "tcp-rec-sk": "cd dist/sample/tcp/recovering-skeleton && node app",
43
45
  "tcp-sk": "cd dist/sample/tcp/skeleton && node app",
44
46
  "http-oms": "cd dist/sample/http/oms && node app",
45
47
  "repo40-compile": "cd dist && node jsfix-cmd \"--dict=repo40\" \"--compile\"",
@@ -60,18 +62,20 @@
60
62
  "license": "MIT",
61
63
  "dependencies": {
62
64
  "align-text": "^1.0.2",
63
- "express": "^4.17.1",
65
+ "express": "^4.17.2",
64
66
  "lodash": "^4.17.21",
65
67
  "log4js": "^6.3.0",
66
- "mathjs": "^10.0.0",
68
+ "mathjs": "^10.0.2",
67
69
  "minimist": "^1.2.5",
68
70
  "moment": "^2.29.1",
69
71
  "node-fs-extra": "^0.8.2",
72
+ "reflect-metadata": "^0.1.13",
70
73
  "request": "^2.88.2",
71
74
  "request-promise-native": "^1.0.9",
72
75
  "sax": "^1.2.4",
76
+ "tsyringe": "^4.6.0",
73
77
  "uuid": "^8.3.2",
74
- "winston": "^3.3.3",
78
+ "winston": "^3.3.4",
75
79
  "word-wrap": "^1.2.3",
76
80
  "xml2js": "^0.4.23",
77
81
  "xmlbuilder": "^15.1.1",
@@ -79,22 +83,23 @@
79
83
  },
80
84
  "devDependencies": {
81
85
  "@types/express": "^4.17.13",
82
- "@types/express-serve-static-core": "^4.17.26",
83
- "@types/jest": "^27.0.3",
84
- "@types/lodash": "^4.14.177",
86
+ "@types/express-serve-static-core": "^4.17.27",
87
+ "@types/jest": "^27.4.0",
88
+ "@types/lodash": "^4.14.178",
85
89
  "@types/mathjs": "^9.4.1",
86
90
  "@types/minimist": "^1.2.2",
87
- "@types/node": "^16.11.11",
91
+ "@types/node": "^17.0.8",
88
92
  "@types/request-promise-native": "^1.0.18",
89
- "@types/sax": "^1.2.3",
90
- "@types/uuid": "^8.3.3",
93
+ "@types/sax": "^1.2.4",
94
+ "@types/uuid": "^8.3.4",
91
95
  "@types/winston": "^2.4.4",
92
96
  "@types/xmlbuilder": "0.0.35",
93
- "jest": "^27.4.3",
97
+ "jest": "^27.4.7",
98
+ "madge": "^5.0.1",
94
99
  "standard": "^16.0.4",
95
- "ts-jest": "^27.0.7",
100
+ "ts-jest": "^27.1.2",
96
101
  "tslint": "^6.1.3",
97
102
  "tslint-config-standard": "^9.0.0",
98
- "typescript": "^4.5.2"
103
+ "typescript": "^4.5.4"
99
104
  }
100
105
  }
package/script/build.cmd CHANGED
@@ -3,3 +3,4 @@
3
3
  rem install typescript if not installed
4
4
  call node_modules\.bin\tsc --version
5
5
  call node_modules\.bin\tsc
6
+ call npm run circular
package/script/build.sh CHANGED
@@ -3,3 +3,4 @@ npm install
3
3
  npm run unzip-repo
4
4
  ./node_modules/.bin/tsc --version
5
5
  ./node_modules/.bin/tsc
6
+ npm run circular
package/script/test.cmd CHANGED
@@ -1,3 +1,6 @@
1
+ call npm run repo44-bench-er
1
2
  call npm run tcp-tc
2
3
  call npm run http-oms
4
+ call npm run tcp-qf-md
5
+ call npm run tcp-rec-sk
3
6
  call npm t
@@ -1,14 +1,17 @@
1
1
  import { ILooseObject } from '../../collections/collection'
2
- import { ContainedGroupField, ContainedSimpleField,
2
+ import {
3
+ ContainedGroupField, ContainedSimpleField,
3
4
  ContainedFieldSet, ContainedField,
4
- ContainedComponentField, SimpleFieldDefinition,
5
- FixDefinitions, dispatchFields } from '../../dictionary'
5
+ ContainedComponentField, FieldsDispatch
6
+ } from '../../dictionary/contained'
7
+ import { SimpleFieldDefinition, FixDefinitions } from '../../dictionary/definition'
6
8
  import { MsgEncoder } from '../msg-encoder'
7
9
  import { ElasticBuffer } from '../elastic-buffer'
8
10
  import { TimeFormatter } from './time-formatter'
9
11
  import { ITimeFormatter } from './itime-formatter'
10
- import { AsciiChars } from '../ascii-chars'
11
- import { Tags, TagType } from '../tags'
12
+ import { AsciiChars } from './ascii-chars'
13
+ import { Tags } from '../tag/tags'
14
+ import { TagType } from '../tag/tag-type'
12
15
 
13
16
  export class AsciiEncoder extends MsgEncoder {
14
17
 
@@ -55,7 +58,7 @@ export class AsciiEncoder extends MsgEncoder {
55
58
 
56
59
  private encodeObject (objectToEncode: ILooseObject, set: ContainedFieldSet, state: AsciiEncodeSetSummary): void {
57
60
  const fields: ContainedField[] = this.getFields(set, objectToEncode)
58
- dispatchFields(fields, {
61
+ new FieldsDispatch().dispatchFields(fields, {
59
62
  simple: (sf: ContainedSimpleField) => {
60
63
  const val: any = objectToEncode[sf.name]
61
64
  // Empty strings are omitted as they result in empty values for tags, which are considered malformed.
@@ -1,16 +1,11 @@
1
- import { Tags } from '../tags'
2
- import { MessageDefinition } from '../../dictionary'
1
+ import { Tags } from '../tag/tags'
2
+ import { MessageDefinition } from '../../dictionary/definition'
3
3
  import { ElasticBuffer } from '../elastic-buffer'
4
+ import { ParseState } from './parse-state'
5
+ import { inject, injectable } from 'tsyringe'
6
+ import { DITokens } from '../../runtime/di-tokens'
4
7
 
5
- export enum ParseState {
6
- BeginField = 1,
7
- ParsingTag = 2,
8
- ParsingValue = 3,
9
- ParsingRawDataLength = 4,
10
- ParsingRawData = 5,
11
- MsgComplete = 6
12
- }
13
-
8
+ @injectable()
14
9
  export class AsciiParserState {
15
10
  public message: MessageDefinition
16
11
  public locations: Tags
@@ -26,7 +21,7 @@ export class AsciiParserState {
26
21
  public rawDataRead: number
27
22
  public msgType: string
28
23
 
29
- constructor (public readonly elasticBuffer: ElasticBuffer) {
24
+ constructor (@inject(DITokens.ParseBuffer) public readonly elasticBuffer: ElasticBuffer) {
30
25
  }
31
26
 
32
27
  public beginTag (pos: number) {
@@ -1,37 +1,44 @@
1
- import { FixDefinitions } from '../../dictionary'
2
- import { AsciiChars } from '../ascii-chars'
1
+ import { AsciiChars } from './ascii-chars'
3
2
  import { AsciiView } from './ascii-view'
4
3
  import { AsciiSegmentParser } from './ascii-segment-parser'
5
- import { AsciiParserState, ParseState } from './ascii-parser-state'
4
+ import { AsciiParserState } from './ascii-parser-state'
6
5
  import { Structure } from '../structure'
7
- import { Tags } from '../tags'
6
+ import { Tags } from '../tag/tags'
8
7
  import { MsgParser } from '../msg-parser'
9
8
  import { MsgView } from '../msg-view'
10
9
  import { Readable } from 'stream'
11
10
  import { ElasticBuffer } from '../elastic-buffer'
12
- import { SegmentDescription, SegmentType } from '../segment-description'
13
-
11
+ import { SegmentDescription } from '../segment/segment-description'
12
+ import { ParseState } from './parse-state'
13
+ import { IJsFixConfig } from '../../config'
14
+ import { inject, injectable } from 'tsyringe'
15
+ import { DITokens } from '../../runtime/di-tokens'
16
+ import { SegmentType } from '../segment/segment-type'
17
+
18
+ @injectable()
14
19
  export class AsciiParser extends MsgParser {
15
20
  private static nextId: number = 0
16
21
  public readonly id: number
17
22
  public readonly state: AsciiParserState
18
- private readonly receivingBuffer: ElasticBuffer
19
23
  private readonly segmentParser: AsciiSegmentParser
24
+ public readonly delimiter: number
25
+ public readonly writeDelimiter: number
20
26
 
21
27
  // allocate enough in receive buffer so buffer does not constant resize back after large messages
22
28
  // want to keep one slice of memory and constantly reuse it
23
29
 
24
- constructor (public readonly definitions: FixDefinitions,
25
- public readonly readStream: Readable,
26
- public readonly delimiter: number,
27
- public readonly writeDelimiter: number = delimiter,
28
- public readonly maxMessageLen: number = 160 * 1024) {
30
+ constructor (@inject(DITokens.IJsFixConfig) public readonly config: IJsFixConfig,
31
+ @inject(DITokens.readStream) public readonly readStream: Readable,
32
+ @inject(DITokens.ParseBuffer) protected readonly receivingBuffer: ElasticBuffer) {
29
33
  super()
34
+
35
+ this.delimiter = config.delimiter
36
+ this.writeDelimiter = config.logDelimiter || AsciiChars.Pipe
37
+ const definitions = config.definitions
30
38
  this.id = AsciiParser.nextId++
31
- this.segmentParser = new AsciiSegmentParser(definitions)
32
- this.receivingBuffer = new ElasticBuffer(maxMessageLen)
33
- this.state = new AsciiParserState(this.receivingBuffer)
34
- this.state.locations = new Tags(definitions, maxMessageLen / 10)
39
+ this.segmentParser = config.sessionContainer.resolve<AsciiSegmentParser>(AsciiSegmentParser)
40
+ this.state = config.sessionContainer.resolve<AsciiParserState>(AsciiParserState)
41
+ this.state.locations = new Tags(definitions, this.receivingBuffer.size / 10)
35
42
  this.state.beginMessage()
36
43
  if (readStream !== null) {
37
44
  this.subscribe()
@@ -1,21 +1,27 @@
1
+ import { SegmentDescription } from '../segment/segment-description'
2
+ import { Structure } from '../structure'
3
+ import { Tags } from '../tag/tags'
4
+ import {
5
+ FixDefinitions,
6
+ MessageDefinition
7
+ } from '../../dictionary/definition'
1
8
  import {
2
9
  ContainedComponentField,
3
- ContainedFieldType,
4
10
  ContainedGroupField,
5
11
  ContainedSimpleField,
6
- FixDefinitions,
7
- MessageDefinition
8
- } from '../..'
9
- import { SegmentDescription, SegmentType } from '../segment-description'
10
- import { Structure } from '../structure'
11
- import { Tags } from '../tags'
12
+ ContainedFieldType
13
+ } from '../../dictionary/contained'
14
+ import { inject, injectable } from 'tsyringe'
15
+ import { DITokens } from '../../runtime/di-tokens'
16
+ import { SegmentType } from '../segment/segment-type'
12
17
 
13
18
  // this takes linear time i.e. it constantly makes forward progress
14
19
  // one tag at a time
15
20
 
21
+ @injectable()
16
22
  export class AsciiSegmentParser {
17
23
 
18
- constructor (public readonly definitions: FixDefinitions) {
24
+ constructor (@inject(DITokens.Definitions) public readonly definitions: FixDefinitions) {
19
25
  }
20
26
 
21
27
  public parse (msgType: string, tags: Tags, last: number): Structure {