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,416 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const path = require("path");
13
- const buffer_1 = require("../buffer");
14
- const transport_1 = require("../transport");
15
- const config_1 = require("../config");
16
- const util_1 = require("../util");
17
- const root = path.join(__dirname, '../../data');
18
- let definitions;
19
- let session;
20
- let encoder;
21
- let nos;
22
- let er;
23
- const localDate = new Date(2018, 6, 25);
24
- const utcTimeStamp = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246));
25
- const utcDate = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0));
26
- const utcTime = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246));
27
- beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
28
- const sessionDescription = require(path.join(root, 'session/qf-fix44.json'));
29
- definitions = yield util_1.getDefinitions(sessionDescription.application.dictionary);
30
- const config = new config_1.JsFixConfig(new transport_1.SessionMsgFactory(sessionDescription), definitions, sessionDescription, buffer_1.AsciiChars.Pipe);
31
- session = new transport_1.AsciiMsgTransmitter(config);
32
- encoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Pipe);
33
- nos = definitions.message.get('NewOrderSingle');
34
- er = definitions.message.get('ExecutionReport');
35
- }), 45000);
36
- test('expect a definition ', () => {
37
- expect(nos).toBeTruthy();
38
- });
39
- function toFix(o, set, enc) {
40
- const theEncode = enc ? enc : encoder;
41
- session.buffer.reset();
42
- if (set) {
43
- theEncode.encode(o, set.name);
44
- }
45
- else {
46
- theEncode.encode(o, nos.name);
47
- }
48
- return session.buffer.toString();
49
- }
50
- function toFixMessage(o, msg) {
51
- session.encodeMessage(msg.msgType, o);
52
- return session.buffer.toString();
53
- }
54
- class ParsingResult {
55
- constructor(event, msgType, view, contents, parser) {
56
- this.event = event;
57
- this.msgType = msgType;
58
- this.view = view;
59
- this.contents = contents;
60
- this.parser = parser;
61
- }
62
- }
63
- function toParse(text, chunks = false) {
64
- return new Promise((resolve, reject) => {
65
- const parser = new buffer_1.AsciiParser(definitions, new transport_1.StringDuplex(text, chunks).readable, buffer_1.AsciiChars.Pipe);
66
- parser.on('error', (e) => {
67
- reject(e);
68
- });
69
- parser.on('msg', (msgType, view) => {
70
- resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser));
71
- });
72
- parser.on('done', () => {
73
- resolve(new ParsingResult('done', null, null, parser.state.elasticBuffer.toString(), parser));
74
- });
75
- });
76
- }
77
- test('encode heartbeat', () => __awaiter(void 0, void 0, void 0, function* () {
78
- const factory = session.config.factory;
79
- const hb = factory.heartbeat('test01');
80
- const hbd = definitions.message.get('Heartbeat');
81
- const fix = toFixMessage(hb, hbd);
82
- expect(fix).toBeTruthy();
83
- const res = yield toParse(fix);
84
- expect(res.event).toEqual('msg');
85
- expect(res.msgType).toEqual('0');
86
- const len = res.view.getTyped(buffer_1.Tags.BodyLengthTag);
87
- const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length;
88
- expect(len).toEqual(expected);
89
- }));
90
- test('encode custom header PossDupFlag', () => {
91
- const no = {
92
- StandardHeader: {
93
- PossDupFlag: true
94
- }
95
- };
96
- const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
97
- expect(fix).toMatch('43=Y|');
98
- });
99
- test('encode custom header PossDupFlag', () => {
100
- const no = {
101
- StandardHeader: {
102
- MsgSeqNum: 9999
103
- }
104
- };
105
- const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
106
- expect(fix).toMatch('34=9999|');
107
- });
108
- test('encode string ClOrdID ', () => {
109
- const no = {};
110
- no.ClOrdID = 'Order-a';
111
- const fix = toFix(no);
112
- expect(fix).toEqual('11=Order-a|');
113
- });
114
- test('encode empty string', () => {
115
- const no = {};
116
- no.ClOrdID = '';
117
- const fix = toFix(no);
118
- expect(fix).toEqual('11=|');
119
- });
120
- test('encode null string', () => {
121
- const no = {};
122
- no.ClOrdID = null;
123
- const fix = toFix(no);
124
- expect(fix).toEqual('');
125
- });
126
- test('encode +ve numeric (int) Price ', () => {
127
- const no = {};
128
- no.Price = 100;
129
- const fix = toFix(no);
130
- expect(fix).toEqual('44=100|');
131
- });
132
- test('encode -ve numeric (int) Price ', () => {
133
- const no = {};
134
- no.Price = -100;
135
- const fix = toFix(no);
136
- expect(fix).toEqual('44=-100|');
137
- });
138
- test('encode +ve numeric (double 8dp) Price ', () => {
139
- const no = {};
140
- no.Price = 123.12345678;
141
- const fix = toFix(no);
142
- expect(fix).toEqual('44=123.12345678|');
143
- });
144
- test('encode +ve numeric (double 14dp) Price ', () => {
145
- const no = {};
146
- no.Price = 123.12345678901234;
147
- const fix = toFix(no);
148
- expect(fix).toEqual('44=123.12345678901234|');
149
- });
150
- test('encode -ve numeric (double 14dp) Price ', () => {
151
- const no = {};
152
- no.Price = -123.12345678901234;
153
- const fix = toFix(no);
154
- expect(fix).toEqual('44=-123.12345678901234|');
155
- });
156
- test('encode +ve string Price ', () => {
157
- const no = {};
158
- no.Price = '123.12345678901234';
159
- const fix = toFix(no);
160
- expect(fix).toEqual('44=123.12345678901234|');
161
- });
162
- test('encode LocalDate TradeDate ', () => {
163
- const no = {};
164
- no.TradeDate = localDate;
165
- const fix = toFix(no);
166
- expect(fix).toEqual('75=20180725|');
167
- });
168
- test('encode UTCTIMESTAMP ExpireTime ', () => {
169
- const no = {};
170
- no.ExpireTime = utcTimeStamp;
171
- const fix = toFix(no);
172
- expect(fix).toEqual('126=20180610-16:35:00.246|');
173
- });
174
- test('encode UTCTIMESTAMP ExpireTime - check padding', () => {
175
- const no = {};
176
- no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1));
177
- const fix = toFix(no);
178
- expect(fix).toEqual('126=20180101-00:00:00.001|');
179
- });
180
- test('encode UTCDATEONLY MDEntryDate', () => {
181
- const mdGrp = definitions.component.get('MDFullGrp');
182
- expect(mdGrp).toBeTruthy();
183
- const grp = {
184
- NoMDEntries: [
185
- {
186
- MDEntryType: '0',
187
- MDEntryDate: utcDate
188
- }
189
- ]
190
- };
191
- const fix = toFix(grp, mdGrp);
192
- expect(fix).toEqual('268=1|269=0|272=20180610|');
193
- });
194
- test('encode UTCTIMEONLY MDEntryTime', () => {
195
- const mdGrp = definitions.component.get('MDFullGrp');
196
- expect(mdGrp).toBeTruthy();
197
- const grp = {
198
- NoMDEntries: [
199
- {
200
- MDEntryType: '0',
201
- MDEntryTime: utcTime
202
- }
203
- ]
204
- };
205
- const fix = toFix(grp, mdGrp);
206
- expect(fix).toEqual('268=1|269=0|273=16:35:00.246|');
207
- });
208
- test('encode BOOLEAN (true) ReportToExch', () => {
209
- expect(er).toBeTruthy();
210
- const e = {};
211
- e.ReportToExch = true;
212
- const fix = toFix(e, er);
213
- expect(fix).toEqual('113=Y|');
214
- });
215
- test('encode BOOLEAN (truthy) ReportToExch', () => {
216
- expect(er).toBeTruthy();
217
- const e = {};
218
- e.ReportToExch = 1;
219
- const fix = toFix(e, er);
220
- expect(fix).toEqual('113=Y|');
221
- });
222
- test('encode BOOLEAN (string) ReportToExch', () => {
223
- expect(er).toBeTruthy();
224
- const e = {};
225
- e.ReportToExch = 'TRUE';
226
- const fix = toFix(e, er);
227
- expect(fix).toEqual('113=Y|');
228
- });
229
- test('encode BOOLEAN (false) ReportToExch', () => {
230
- expect(er).toBeTruthy();
231
- const e = {};
232
- e.ReportToExch = false;
233
- const fix = toFix(e, er);
234
- expect(fix).toEqual('113=N|');
235
- });
236
- test('encode BOOLEAN (falsy) ReportToExch', () => {
237
- expect(er).toBeTruthy();
238
- const e = {};
239
- e.ReportToExch = 0;
240
- const fix = toFix(e, er);
241
- expect(fix).toEqual('113=N|');
242
- });
243
- test('encode RawData EncodedText', () => {
244
- expect(er).toBeTruthy();
245
- const toEncode = 'this is fix';
246
- const e = {
247
- EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
248
- };
249
- const fix = toFix(e, er);
250
- expect(fix).toEqual('354=11|355=this is fix|');
251
- });
252
- test('encode empty RawData EncodedText', () => {
253
- expect(er).toBeTruthy();
254
- const toEncode = '';
255
- const e = {
256
- EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
257
- };
258
- const fix = toFix(e, er);
259
- expect(fix).toEqual('354=0|355=|');
260
- });
261
- function getParties() {
262
- return {
263
- 'Parties': {
264
- 'NoPartyIDs': [
265
- {
266
- 'PartyID': 'magna.',
267
- 'PartyIDSource': '9',
268
- 'PartyRole': 28
269
- },
270
- {
271
- 'PartyID': 'iaculis',
272
- 'PartyIDSource': 'F',
273
- 'PartyRole': 2
274
- }
275
- ]
276
- }
277
- };
278
- }
279
- function getPartiesNoDelimiter() {
280
- return {
281
- 'Parties': {
282
- 'NoPartyIDs': [
283
- {
284
- 'PartyIDSource': '9',
285
- 'PartyRole': 28
286
- }
287
- ]
288
- }
289
- };
290
- }
291
- test('encode repeated group of simple repository Parties', () => {
292
- expect(er).toBeTruthy();
293
- const e = getParties();
294
- const fix = toFix(e, er);
295
- expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|');
296
- });
297
- test('use a carat as log delimiter', () => {
298
- expect(er).toBeTruthy();
299
- const caratEncoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Soh, buffer_1.AsciiChars.Carat);
300
- const e = getParties();
301
- const fix = toFix(e, er, caratEncoder);
302
- expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
303
- });
304
- test('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {
305
- expect(er).toBeTruthy();
306
- const caratEncoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Soh, buffer_1.AsciiChars.Carat);
307
- const e = getParties();
308
- const fix = toFix(e, er, caratEncoder);
309
- expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
310
- const trimmed = caratEncoder.trim().toString();
311
- expect(trimmed).toEqual('453=2448=magna.447=9452=28448=iaculis447=F452=2');
312
- });
313
- test('encode repeated group with no delimiter - should throw', () => {
314
- expect(er).toBeTruthy();
315
- const e = getPartiesNoDelimiter();
316
- function run() {
317
- toFix(e, er);
318
- }
319
- expect(run).toThrow(/no delimiter/);
320
- });
321
- test('encode repeated group with no array - should throw', () => {
322
- expect(er).toBeTruthy();
323
- const e = {
324
- 'Parties': {
325
- 'NoPartyIDs': 'should be an array'
326
- }
327
- };
328
- function run() {
329
- toFix(e, er);
330
- }
331
- expect(run).toThrow(/expected array/);
332
- });
333
- test('encode repeated group with empty array', () => {
334
- expect(er).toBeTruthy();
335
- const e = {
336
- 'Parties': {
337
- 'NoPartyIDs': []
338
- }
339
- };
340
- expect(toFix(e, er)).toEqual('453=0|');
341
- });
342
- function getInstrument() {
343
- return {
344
- 'Instrument': {
345
- 'Symbol': 'ac,',
346
- 'SymbolSfx': 'non',
347
- 'SecurityID': 'Pellentesque',
348
- 'SecurityIDSource': 'B',
349
- 'Product': 2
350
- }
351
- };
352
- }
353
- function getInstrumentNestedGroup() {
354
- return {
355
- 'Instrument': {
356
- 'Symbol': 'ac,',
357
- 'SymbolSfx': 'non',
358
- 'SecurityID': 'Pellentesque',
359
- 'SecurityIDSource': 'B',
360
- 'SecAltIDGrp': {
361
- 'NoSecurityAltID': [
362
- {
363
- 'SecurityAltID': 'lorem',
364
- 'SecurityAltIDSource': 'consequat'
365
- },
366
- {
367
- 'SecurityAltID': 'sapien',
368
- 'SecurityAltIDSource': 'tempor'
369
- }
370
- ]
371
- },
372
- 'Product': 2
373
- }
374
- };
375
- }
376
- test('encode component', () => {
377
- expect(er).toBeTruthy();
378
- const e = getInstrument();
379
- expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|');
380
- });
381
- test('encode component nested group', () => {
382
- expect(er).toBeTruthy();
383
- const e = getInstrumentNestedGroup();
384
- expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|');
385
- });
386
- test('encode group missing delimiter', () => {
387
- expect(er).toBeTruthy();
388
- const e = getInstrumentNestedGroup();
389
- delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID'];
390
- function run() {
391
- toFix(e, er);
392
- }
393
- expect(run).toThrow(/group instance with no delimiter field SecurityAltID/);
394
- });
395
- test('encode group not an array of', () => {
396
- expect(er).toBeTruthy();
397
- const e = {
398
- 'Instrument': {
399
- 'Symbol': 'ac,',
400
- 'SymbolSfx': 'non',
401
- 'SecurityID': 'Pellentesque',
402
- 'SecurityIDSource': 'B',
403
- 'SecAltIDGrp': {
404
- 'NoSecurityAltID': {
405
- elements: []
406
- }
407
- },
408
- 'Product': 2
409
- }
410
- };
411
- function run() {
412
- toFix(e, er);
413
- }
414
- expect(run).toThrow(/expected array instance for group NoSecurityAltID/);
415
- });
416
- //# sourceMappingURL=ascii-encode.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ascii-encode.test.js","sourceRoot":"","sources":["../../src/test/ascii-encode.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAE5B,sCAA+F;AAE/F,4CAAwG;AACxG,sCAAuC;AACvC,kCAAwC;AAExC,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAEvD,IAAI,WAA2B,CAAA;AAC/B,IAAI,OAA4B,CAAA;AAChC,IAAI,OAAqB,CAAA;AACzB,IAAI,GAAsB,CAAA;AAC1B,IAAI,EAAqB,CAAA;AAEzB,MAAM,SAAS,GAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,YAAY,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1E,MAAM,OAAO,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACjE,MAAM,OAA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;QACV,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACd,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAA;AAC1E,CAAC,CAAC,CAAA","sourcesContent":["import * as path from 'path'\r\nimport { ComponentFieldDefinition, ContainedFieldSet, FixDefinitions, MessageDefinition } from '../dictionary'\r\nimport { AsciiChars, AsciiEncoder, AsciiParser, MsgView, Tags, TimeFormatter } from '../buffer'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { AsciiMsgTransmitter, ISessionDescription, SessionMsgFactory, StringDuplex } from '../transport'\r\nimport { JsFixConfig } from '../config'\r\nimport { getDefinitions } from '../util'\r\n\r\nconst root: string = path.join(__dirname, '../../data')\r\n\r\nlet definitions: FixDefinitions\r\nlet session: AsciiMsgTransmitter\r\nlet encoder: AsciiEncoder\r\nlet nos: MessageDefinition\r\nlet er: MessageDefinition\r\n\r\nconst localDate: Date = new Date(2018, 6, 25)\r\nconst utcTimeStamp: Date = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246))\r\nconst utcDate: Date = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0))\r\nconst utcTime: Date = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246))\r\n\r\nbeforeAll(async () => {\r\n const sessionDescription: ISessionDescription = require(path.join(root, 'session/qf-fix44.json'))\r\n definitions = await getDefinitions(sessionDescription.application.dictionary)\r\n const config = new JsFixConfig(new SessionMsgFactory(sessionDescription), definitions, sessionDescription, AsciiChars.Pipe)\r\n session = new AsciiMsgTransmitter(config)\r\n encoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Pipe)\r\n nos = definitions.message.get('NewOrderSingle')\r\n er = definitions.message.get('ExecutionReport')\r\n}, 45000)\r\n\r\ntest('expect a definition ', () => {\r\n expect(nos).toBeTruthy()\r\n})\r\n\r\nfunction toFix (o: ILooseObject, set?: ContainedFieldSet, enc?: AsciiEncoder): string {\r\n const theEncode = enc ? enc : encoder\r\n session.buffer.reset()\r\n if (set) {\r\n theEncode.encode(o, set.name)\r\n } else {\r\n theEncode.encode(o, nos.name)\r\n }\r\n return session.buffer.toString()\r\n}\r\n\r\nfunction toFixMessage (o: ILooseObject, msg: MessageDefinition): string {\r\n session.encodeMessage(msg.msgType, o)\r\n return session.buffer.toString()\r\n}\r\n\r\nclass ParsingResult {\r\n constructor (public readonly event: string, public readonly msgType: string, public readonly view: MsgView,\r\n public readonly contents: string, public readonly parser: AsciiParser) {\r\n }\r\n}\r\n\r\nfunction toParse (text: string, chunks: boolean = false): Promise<ParsingResult> {\r\n return new Promise<any>((resolve, reject) => {\r\n const parser = new AsciiParser(definitions, new StringDuplex(text, chunks).readable, AsciiChars.Pipe)\r\n parser.on('error', (e: Error) => {\r\n reject(e)\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser))\r\n })\r\n parser.on('done', () => {\r\n resolve(new ParsingResult('done', null,null, parser.state.elasticBuffer.toString(), parser))\r\n })\r\n })\r\n}\r\n\r\ntest('encode heartbeat', async () => {\r\n const factory = session.config.factory\r\n const hb = factory.heartbeat('test01')\r\n const hbd = definitions.message.get('Heartbeat')\r\n const fix = toFixMessage(hb, hbd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual('0')\r\n const len = res.view.getTyped(Tags.BodyLengthTag)\r\n const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length\r\n expect(len).toEqual(expected)\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n PossDupFlag: true\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('43=Y|')\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n MsgSeqNum: 9999\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('34=9999|')\r\n})\r\n\r\ntest('encode string ClOrdID ', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = 'Order-a'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=Order-a|')\r\n})\r\n\r\ntest('encode empty string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = ''\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=|')\r\n})\r\n\r\ntest('encode null string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = null\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('encode +ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=100|')\r\n})\r\n\r\ntest('encode -ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-100|')\r\n})\r\n\r\ntest('encode +ve numeric (double 8dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678|')\r\n})\r\n\r\ntest('encode +ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode -ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-123.12345678901234|')\r\n})\r\n\r\ntest('encode +ve string Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = '123.12345678901234'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode LocalDate TradeDate ', () => {\r\n const no: ILooseObject = {}\r\n no.TradeDate = localDate\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('75=20180725|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime ', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = utcTimeStamp\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180610-16:35:00.246|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime - check padding', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1))\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180101-00:00:00.001|')\r\n})\r\n\r\ntest('encode UTCDATEONLY MDEntryDate', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryDate: utcDate\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|272=20180610|')\r\n})\r\n\r\ntest('encode UTCTIMEONLY MDEntryTime', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryTime: utcTime\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|273=16:35:00.246|')\r\n})\r\n\r\ntest('encode BOOLEAN (true) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = true\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (truthy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 1\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (string) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 'TRUE'\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (false) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = false\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode BOOLEAN (falsy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 0\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = 'this is fix'\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=11|355=this is fix|')\r\n})\r\n\r\ntest('encode empty RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = ''\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=0|355=|')\r\n})\r\n\r\nfunction getParties (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n 'PartyID': 'magna.',\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n },\r\n {\r\n 'PartyID': 'iaculis',\r\n 'PartyIDSource': 'F',\r\n 'PartyRole': 2\r\n }]\r\n }\r\n }\r\n}\r\n\r\nfunction getPartiesNoDelimiter (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n // missing PartyID\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n\r\ntest('encode repeated group of simple repository Parties', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|')\r\n})\r\n\r\ntest('use a carat as log delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n})\r\n\r\ntest('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n const trimmed = caratEncoder.trim().toString()\r\n expect(trimmed).toEqual('453=2\u0001448=magna.\u0001447=9\u0001452=28\u0001448=iaculis\u0001447=F\u0001452=2\u0001')\r\n})\r\n\r\ntest('encode repeated group with no delimiter - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getPartiesNoDelimiter()\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/no delimiter/)\r\n})\r\n\r\ntest('encode repeated group with no array - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': 'should be an array'\r\n }\r\n }\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array/)\r\n})\r\n\r\ntest('encode repeated group with empty array', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': []\r\n }\r\n }\r\n expect(toFix(e, er)).toEqual('453=0|')\r\n})\r\n\r\nfunction getInstrument (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\nfunction getInstrumentNestedGroup (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': [\r\n {\r\n 'SecurityAltID': 'lorem',\r\n 'SecurityAltIDSource': 'consequat'\r\n },\r\n {\r\n 'SecurityAltID': 'sapien',\r\n 'SecurityAltIDSource': 'tempor'\r\n }\r\n ]\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\ntest('encode component', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrument()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|')\r\n})\r\n\r\ntest('encode component nested group', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|')\r\n})\r\n\r\ntest('encode group missing delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID']\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/group instance with no delimiter field SecurityAltID/)\r\n})\r\n\r\ntest('encode group not an array of', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': {\r\n elements: []\r\n }\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array instance for group NoSecurityAltID/)\r\n})\r\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"ascii-encoder.test.js","sourceRoot":"","sources":["../../src/test/ascii-encoder.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAE5B,sCAA+F;AAE/F,4CAAqF;AACrF,sCAAuC;AACvC,kCAAwC;AACxC,uDAAmK;AACnK,0BAA4B;AAC5B,8CAA2D;AAE3D,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAEvD,IAAI,WAA2B,CAAA;AAC/B,IAAI,OAA4B,CAAA;AAChC,IAAI,OAAqB,CAAA;AACzB,IAAI,GAAsB,CAAA;AAC1B,IAAI,EAAqB,CAAA;AAEzB,MAAM,SAAS,GAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,YAAY,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1E,MAAM,OAAO,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACjE,MAAM,OAAO,GA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CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAO,CAAC,cAAc,CAAC,CAAA;IACnD,MAAM,MAAM,GAAoB,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;IACnD,MAAM,CAAC,GAAoB,MAAM,CAAC,cAAc,CAAA;IAChD,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACzC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACvC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAO,CAAC,cAAc,CAAC,CAAA;AACnD,CAAC,CAAA,CAAC,CAAA","sourcesContent":["import * as path from 'path'\r\nimport { ComponentFieldDefinition, ContainedFieldSet, FixDefinitions, MessageDefinition } from '../dictionary'\r\nimport { AsciiChars, AsciiEncoder, AsciiParser, MsgView, Tags, TimeFormatter } from '../buffer'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { AsciiMsgTransmitter, ISessionDescription, StringDuplex } from '../transport'\r\nimport { JsFixConfig } from '../config'\r\nimport { getDefinitions } from '../util'\r\nimport { IInstrument, INewOrderSingle, IOrderQtyData, OrdType, SecurityIDSource, SecurityType, Side, TimeInForce, IStandardHeader } from '../types/FIX4.4/quickfix'\r\nimport { MsgType } from '..'\r\nimport { AsciiSessionMsgFactory } from '../transport/ascii'\r\n\r\nconst root: string = path.join(__dirname, '../../data')\r\n\r\nlet definitions: FixDefinitions\r\nlet session: AsciiMsgTransmitter\r\nlet encoder: AsciiEncoder\r\nlet nos: MessageDefinition\r\nlet er: MessageDefinition\r\n\r\nconst localDate: Date = new Date(2018, 6, 25)\r\nconst utcTimeStamp: Date = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246))\r\nconst utcDate: Date = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0))\r\nconst utcTime: Date = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246))\r\n\r\nbeforeAll(async () => {\r\n const sessionDescription: ISessionDescription = require(path.join(root, 'session/qf-fix44.json'))\r\n definitions = await getDefinitions(sessionDescription.application.dictionary)\r\n const config = new JsFixConfig(new AsciiSessionMsgFactory(sessionDescription), definitions, sessionDescription, AsciiChars.Pipe)\r\n session = new AsciiMsgTransmitter(config)\r\n encoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Pipe)\r\n nos = definitions.message.get('NewOrderSingle')\r\n er = definitions.message.get('ExecutionReport')\r\n}, 45000)\r\n\r\ntest('expect a definition ', () => {\r\n expect(nos).toBeTruthy()\r\n})\r\n\r\nfunction toFix (o: ILooseObject, set?: ContainedFieldSet, enc?: AsciiEncoder): string {\r\n const theEncode = enc ? enc : encoder\r\n session.buffer.reset()\r\n if (set) {\r\n theEncode.encode(o, set.name)\r\n } else {\r\n theEncode.encode(o, nos.name)\r\n }\r\n return session.buffer.toString()\r\n}\r\n\r\nfunction toFixMessage (o: ILooseObject, msg: MessageDefinition): string {\r\n session.encodeMessage(msg.msgType, o)\r\n return session.buffer.toString()\r\n}\r\n\r\nclass ParsingResult {\r\n constructor (public readonly event: string, public readonly msgType: string, public readonly view: MsgView,\r\n public readonly contents: string, public readonly parser: AsciiParser) {\r\n }\r\n}\r\n\r\nfunction toParse (text: string, chunks: boolean = false): Promise<ParsingResult> {\r\n return new Promise<any>((resolve, reject) => {\r\n const parser = new AsciiParser(definitions, new StringDuplex(text, chunks).readable, AsciiChars.Pipe)\r\n parser.on('error', (e: Error) => {\r\n reject(e)\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser))\r\n })\r\n parser.on('done', () => {\r\n resolve(new ParsingResult('done', null,null, parser.state.elasticBuffer.toString(), parser))\r\n })\r\n })\r\n}\r\n\r\ntest('encode heartbeat', async () => {\r\n const factory = session.config.factory\r\n const hb = factory.heartbeat('test01')\r\n const hbd = definitions.message.get('Heartbeat')\r\n const fix = toFixMessage(hb, hbd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual('0')\r\n const len = res.view.getTyped(Tags.BodyLengthTag)\r\n const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length\r\n expect(len).toEqual(expected)\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n PossDupFlag: true\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('43=Y|')\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n MsgSeqNum: 9999\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('34=9999|')\r\n})\r\n\r\ntest('encode string ClOrdID ', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = 'Order-a'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=Order-a|')\r\n})\r\n\r\ntest('should not encode empty string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = ''\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('should not encode null string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = null\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('encode +ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=100|')\r\n})\r\n\r\ntest('encode -ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-100|')\r\n})\r\n\r\ntest('encode +ve numeric (double 8dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678|')\r\n})\r\n\r\ntest('encode +ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode -ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-123.12345678901234|')\r\n})\r\n\r\ntest('encode +ve string Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = '123.12345678901234'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode LocalDate TradeDate ', () => {\r\n const no: ILooseObject = {}\r\n no.TradeDate = localDate\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('75=20180725|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime ', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = utcTimeStamp\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180610-16:35:00.246|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime - check padding', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1))\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180101-00:00:00.001|')\r\n})\r\n\r\ntest('encode UTCDATEONLY MDEntryDate', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryDate: utcDate\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|272=20180610|')\r\n})\r\n\r\ntest('encode UTCTIMEONLY MDEntryTime', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryTime: utcTime\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|273=16:35:00.246|')\r\n})\r\n\r\ntest('encode BOOLEAN (true) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = true\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (truthy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 1\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (string) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 'TRUE'\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (false) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = false\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode BOOLEAN (falsy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 0\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = 'this is fix'\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=11|355=this is fix|')\r\n})\r\n\r\ntest('encode empty RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = ''\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=0|355=|')\r\n})\r\n\r\nfunction getParties (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n 'PartyID': 'magna.',\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n },\r\n {\r\n 'PartyID': 'iaculis',\r\n 'PartyIDSource': 'F',\r\n 'PartyRole': 2\r\n }]\r\n }\r\n }\r\n}\r\n\r\nfunction getPartiesNoDelimiter (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n // missing PartyID\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n\r\ntest('encode repeated group of simple repository Parties', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|')\r\n})\r\n\r\ntest('use a carat as log delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n})\r\n\r\ntest('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n const trimmed = caratEncoder.trim().toString()\r\n expect(trimmed).toEqual('453=2\u0001448=magna.\u0001447=9\u0001452=28\u0001448=iaculis\u0001447=F\u0001452=2\u0001')\r\n})\r\n\r\ntest('encode repeated group with no delimiter - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getPartiesNoDelimiter()\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/no delimiter/)\r\n})\r\n\r\ntest('encode repeated group with no array - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': 'should be an array'\r\n }\r\n }\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array/)\r\n})\r\n\r\ntest('encode repeated group with empty array', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': []\r\n }\r\n }\r\n expect(toFix(e, er)).toEqual('453=0|')\r\n})\r\n\r\nfunction getInstrument (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\nfunction getInstrumentNestedGroup (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': [\r\n {\r\n 'SecurityAltID': 'lorem',\r\n 'SecurityAltIDSource': 'consequat'\r\n },\r\n {\r\n 'SecurityAltID': 'sapien',\r\n 'SecurityAltIDSource': 'tempor'\r\n }\r\n ]\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\ntest('encode component', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrument()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|')\r\n})\r\n\r\ntest('encode component nested group', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|')\r\n})\r\n\r\ntest('encode group missing delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID']\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/group instance [1] inconsisent delimeter 456 expected tag 455/)\r\n})\r\n\r\ntest('encode group not an array of', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': {\r\n elements: []\r\n }\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array instance for group NoSecurityAltID/)\r\n})\r\n\r\nfunction getCompID (securityType: SecurityType): string {\r\n switch (securityType) {\r\n case SecurityType.CommonStock: {\r\n return 'DepA'\r\n }\r\n\r\n case SecurityType.CorporateBond: {\r\n return 'DepB'\r\n }\r\n\r\n case SecurityType.ConvertibleBond: {\r\n return 'DepC'\r\n }\r\n\r\n default:\r\n return 'DepD'\r\n }\r\n}\r\n\r\nfunction createOrder (id: number, symbol: string, securityType: SecurityType, side: Side, qty: number, price: number): INewOrderSingle {\r\n return {\r\n StandardHeader: {\r\n DeliverToCompID: getCompID(securityType)\r\n } as IStandardHeader,\r\n ClOrdID: `Cli${id}`,\r\n Account: 'MyAcc',\r\n Side: side,\r\n Price: price,\r\n OrdType: OrdType.Limit,\r\n OrderQtyData: {\r\n OrderQty: qty\r\n } as IOrderQtyData,\r\n Instrument: {\r\n SecurityType: securityType,\r\n Symbol: symbol,\r\n SecurityID: '459200101',\r\n SecurityIDSource: SecurityIDSource.IsinNumber\r\n } as IInstrument,\r\n TimeInForce: TimeInForce.Day\r\n } as INewOrderSingle\r\n}\r\n\r\ntest('encode custom header 1 - expect DeliverToCompID DepA', async () => {\r\n const type = SecurityType.CommonStock\r\n const o1 = createOrder(1, 'MS', type, Side.Buy, 100, 1000.0)\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n const tag = res.view.getTyped('DeliverToCompID')\r\n expect(tag).toEqual('DepA')\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepA')\r\n})\r\n\r\ntest('encode custom header 2 - expect DeliverToCompID DepC', async () => {\r\n const type = SecurityType.ConvertibleBond\r\n const o1 = createOrder(1, 'MSCb', type, Side.Buy, 100, 1000.0)\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n const tag = res.view.getTyped('DeliverToCompID')\r\n expect(tag).toEqual('DepC')\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepC')\r\n})\r\n\r\ntest('encode custom header - include MsgSeqNum (for resends we do not want to overwrite)', async () => {\r\n const type = SecurityType.ConvertibleBond\r\n const seqNum: number = 10\r\n const o1 = createOrder(1, 'MSCb', type, Side.Buy, 100, 1000.0)\r\n o1.StandardHeader.MsgSeqNum = seqNum\r\n o1.StandardHeader.PossDupFlag = true\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n expect(nosd).toBeTruthy()\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n const h: IStandardHeader = parsed.StandardHeader\r\n expect(h.DeliverToCompID).toEqual('DepC')\r\n expect(h.MsgSeqNum).toEqual(seqNum)\r\n expect(h.BeginString).toEqual('FIX4.4')\r\n expect(h.PossDupFlag).toEqual(true)\r\n expect(h.MsgType).toEqual(MsgType.NewOrderSingle)\r\n})\r\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"ascii-parser.test.js","sourceRoot":"","sources":["../../src/test/ascii-parser.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAiF;AAEjF,kCAAoD;AACpD,4CAAgE;AAChE,6BAA4B;AAC5B,0BAA4B;AAE5B,IAAI,WAA2B,CAAA;AAC/B,IAAI,UAAsB,CAAA;AAC1B,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AACvD,MAAM,KAAK,GAAW,wNAAwN,CAAA;AAC9O,MAAM,cAAc,GAAG;IACrB,IAAI,eAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtB,IAAI,eAAM,CAAC,CAAC,EAAE,CAAC,EAAE,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,CAAC,CAAA,CAAC,CAAA","sourcesContent":["import { TagPos, SegmentType, MsgView, AsciiChars, AsciiParser } from '../buffer'\r\nimport { FixDefinitions } from '../dictionary'\r\nimport { JsonHelper, getDefinitions } from '../util'\r\nimport { ISessionDescription, StringDuplex } from '../transport'\r\nimport * as path from 'path'\r\nimport { MsgType } from '..'\r\n\r\nlet definitions: FixDefinitions\r\nlet jsonHelper: JsonHelper\r\nconst root: string = path.join(__dirname, '../../data')\r\nconst logon: string = '8=FIX4.4|9=0000208|35=A|49=sender-10|56=target-20|34=1|57=sub-a|52=20180610-10:39:01.621|98=2|108=62441|95=20|96=VgfoSqo56NqSVI1fLdlI|141=Y|789=4886|383=20|384=1|372=ipsum|385=R|464=N|553=sit|554=consectetur|10=49|'\r\nconst expectedTagPos = [\r\n new TagPos(0, 8, 2, 6),\r\n new TagPos(1, 9, 11, 7),\r\n new TagPos(2, 35, 22, 1),\r\n new TagPos(3, 49, 27, 9),\r\n new TagPos(4, 56, 40, 9),\r\n new TagPos(5, 34, 53, 1),\r\n new TagPos(6, 57, 58, 5),\r\n new TagPos(7, 52, 67, 21),\r\n new TagPos(8, 98, 92, 1),\r\n new TagPos(9, 108, 98, 5),\r\n new TagPos(10, 95, 107, 2),\r\n new TagPos(11, 96, 113, 20),\r\n new TagPos(12, 141, 138, 1),\r\n new TagPos(13, 789, 144, 4),\r\n new TagPos(14, 383, 153, 2),\r\n new TagPos(15, 384, 160, 1),\r\n new TagPos(16, 372, 166, 5),\r\n new TagPos(17, 385, 176, 1),\r\n new TagPos(18, 464, 182, 1),\r\n new TagPos(19, 553, 188, 3),\r\n new TagPos(20, 554, 196, 11),\r\n new TagPos(21, 10, 211, 2)]\r\n\r\nbeforeAll(async () => {\r\n expect.assertions(1)\r\n const sessionDescription: ISessionDescription = require(path.join(root, 'session/test-initiator.json'))\r\n definitions = await getDefinitions(sessionDescription.application.dictionary)\r\n jsonHelper = new JsonHelper(definitions)\r\n}, 45000)\r\n\r\nclass ParsingResult {\r\n constructor (public readonly event: string, public readonly msgType: string, public readonly view: MsgView,\r\n public readonly contents: string, public readonly parser: AsciiParser) {\r\n }\r\n}\r\n\r\nfunction toParse (text: string, chunks: boolean = false): Promise<ParsingResult> {\r\n return new Promise<any>((resolve, reject) => {\r\n const parser = new AsciiParser(definitions, new StringDuplex(text, chunks).readable, AsciiChars.Pipe)\r\n const buffer = parser.state.elasticBuffer\r\n parser.on('error', (e: Error) => {\r\n reject(e)\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n resolve(new ParsingResult('msg', msgType, view.clone(), buffer.toString(), parser))\r\n })\r\n parser.on('done', () => {\r\n resolve(new ParsingResult('done', null,null, buffer.toString(), parser))\r\n })\r\n })\r\n}\r\n\r\ntest('begin string incorrectly placed', () => {\r\n return expect(toParse('8=FIX4.4|8=FIX4.4|')).rejects.toEqual(\r\n new Error('BeginString: not expected at position [2]')\r\n )\r\n})\r\n\r\ntest('body length incorrectly placed', () => {\r\n return expect(toParse('8=FIX4.4|9=101|9=101|')).rejects.toEqual(\r\n new Error('BodyLengthTag: not expected at position [3]')\r\n )\r\n})\r\n\r\ntest('msg type incorrectly placed', () => {\r\n return expect(toParse('8=FIX4.4|9=101|35=A|35=A|')).rejects.toEqual(\r\n new Error('MsgTag: not expected at position [4]')\r\n )\r\n})\r\n\r\ntest('do not start with 8=', () => {\r\n return expect(toParse('59=FIX4.4|')).rejects.toEqual(\r\n new Error('position 1 [59] must be BeginString: 8=')\r\n )\r\n})\r\n\r\ntest('body length incorrectly placed', () => {\r\n return expect(toParse('8=FIX4.4|59=101|9=101|')).rejects.toEqual(\r\n new Error('position 2 [59] must be BodyLengthTag: 9=')\r\n )\r\n})\r\n\r\ntest('msgTag incorrectly placed', () => {\r\n return expect(toParse('8=FIX4.4|9=101|59=A|')).rejects.toEqual(\r\n new Error('position 3 [59] must be MsgTag: 35=')\r\n )\r\n})\r\n\r\ntest('first 3 fields correctly placed', async () => {\r\n const res: ParsingResult = await toParse('8=FIX4.4|9=101|35=A|')\r\n expect(res.event).toEqual('done')\r\n})\r\n\r\ntest('complete msg parsed', async () => {\r\n const res: ParsingResult = await toParse(logon)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n})\r\n\r\ntest('complete msg in chunks parsed', async () => {\r\n const res: ParsingResult = await toParse(logon, true)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n})\r\n\r\ntest('msg sent in chunks matches parser buffer', async () => {\r\n const res: ParsingResult = await toParse(logon, true)\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n expect(res.contents).toEqual(logon)\r\n})\r\n\r\ntest('logon parsers to correct tag set', async () => {\r\n const res: ParsingResult = await toParse(logon, true)\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n expect(res.view.structure.tags.tagPos).toEqual(expectedTagPos)\r\n})\r\n\r\ntest('tags other than 10 past body length', async () => {\r\n const begin = '8=FIX4.4|9=0000208|'\r\n const changed = logon.replace('10=49|','555=you know nothin|10=49')\r\n return expect(toParse(changed)).rejects.toEqual(\r\n new Error(`Tag: [555] cant be after ${208 + begin.length - 1}`)\r\n )\r\n})\r\n\r\ntest('unknown message type', async () => {\r\n const changed = logon.replace('35=A', '35=ZZ')\r\n const res = await toParse(changed)\r\n expect(res.view).toBeTruthy()\r\n expect(res.view.segment.type).toEqual(SegmentType.Unknown)\r\n})\r\n\r\ntest('missing 1 required tag', async () => {\r\n const changed = logon.replace('108=62441|','000=62441|')\r\n const res = await toParse(changed)\r\n expect(res.view).toBeTruthy()\r\n const missing = res.view.missing()\r\n expect(missing).toEqual([108])\r\n})\r\n\r\ntest('missing 2 required tags', async () => {\r\n // const changed = logon.replace('108=62441|','000=62441|')\r\n const changed = logon.replace('98=2|108=62441|','01=2|000=62441|')\r\n const res = await toParse(changed)\r\n expect(res.view).toBeTruthy()\r\n const missing = res.view.missing()\r\n expect(missing).toEqual([98, 108])\r\n})\r\n"]}
@@ -1 +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EAAE;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,4BAA4B,CAAC,CAAA;IACrE,MAAM,GAAG,GAAkB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAO,CAAC,KAAK,CAAC,CAAA;IAC1C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;IAC5C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;AACpE,CAAC,CAAA,CAAC,CAAA;AAEF,IAAI,CAAC,qBAAqB,EAAE,GAAS,EAAE;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAA;IACjE,MAAM,GAAG,GAAkB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAO,CAAC,KAAK,CAAC,CAAA;IAC1C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;IAC5C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACrE,CAAC,CAAA,CAAC,CAAA","sourcesContent":["import { AsciiParser, AsciiChars, MsgView, SegmentDescription } from '../buffer'\r\nimport { FixDefinitions } from '../dictionary'\r\nimport { ISessionDescription, StringDuplex } from '../transport'\r\nimport { ILogon } from '../types/FIX4.4/repo'\r\nimport { getDefinitions, JsonHelper } from '../util'\r\nimport * as path from 'path'\r\nimport { MsgType } from '..'\r\n\r\nlet definitions: FixDefinitions\r\nlet jsonHelper: JsonHelper\r\nconst root: string = path.join(__dirname, '../../data')\r\nconst logon: string = '8=FIX4.4|9=0000208|35=A|49=sender-10|56=target-20|34=1|57=sub-a|52=20180610-10:39:01.621|98=2|108=62441|95=20|96=VgfoSqo56NqSVI1fLdlI|141=Y|789=4886|383=20|384=1|372=ipsum|385=R|464=N|553=sit|554=consectetur|10=49|'\r\n\r\nbeforeAll(async () => {\r\n const sessionDescription: ISessionDescription = require(path.join(root, 'session/test-initiator.json'))\r\n definitions = await getDefinitions(sessionDescription.application.dictionary)\r\n jsonHelper = new JsonHelper(definitions)\r\n}, 45000)\r\n\r\nclass ParsingResult {\r\n constructor (public readonly event: string,\r\n public readonly msgType: string,\r\n public readonly view: MsgView,\r\n public readonly contents: string,\r\n public readonly parser: AsciiParser) {\r\n }\r\n}\r\n\r\nfunction toParse (text: string, chunks: boolean = false): Promise<ParsingResult> {\r\n return new Promise<any>((resolve, reject) => {\r\n const parser = new AsciiParser(definitions, new StringDuplex(text, chunks).readable, AsciiChars.Pipe)\r\n parser.on('error', (e: Error) => {\r\n reject(e)\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser))\r\n })\r\n parser.on('done', () => {\r\n resolve(new ParsingResult('done', null,null, parser.state.elasticBuffer.toString(), parser))\r\n })\r\n })\r\n}\r\n\r\ntest('0 gaps', async () => {\r\n const res: ParsingResult = await toParse(logon)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n const unknowns: SegmentDescription[] = res.view.structure.layout['.undefined']\r\n expect(unknowns).toBeFalsy()\r\n const o: ILogon = res.view.toObject()\r\n expect(o).toBeTruthy()\r\n expect(o.Password).toEqual('consectetur')\r\n expect(o.Username).toEqual('sit')\r\n})\r\n\r\ntest('1 gap', async () => {\r\n const gap = logon.replace('108=62441|', '108=62441|9999=im not here')\r\n const res: ParsingResult = await toParse(gap)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n const unknown: SegmentDescription = res.view.structure.layout['.undefined']\r\n expect(unknown).toBeTruthy()\r\n expect(unknown.startTag).toEqual(9999)\r\n expect(unknown.startPosition).toEqual(10)\r\n const o: ILogon = res.view.toObject()\r\n expect(o).toBeTruthy()\r\n expect(o.Password).toEqual('consectetur')\r\n expect(o.Username).toEqual('sit')\r\n})\r\n\r\ntest('1 gap next to 1 gap', async () => {\r\n const gap = logon.replace('108=62441|', '108=62441|1=gap|2=gap|')\r\n const res: ParsingResult = await toParse(gap)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n const unknowns: SegmentDescription[] = res.view.structure.layout['.undefined']\r\n expect(unknowns).toBeTruthy()\r\n expect(Array.isArray(unknowns)).toEqual(true)\r\n expect(unknowns[0].startTag).toEqual(1)\r\n expect(unknowns[0].startPosition).toEqual(10)\r\n expect(unknowns[1].startTag).toEqual(2)\r\n expect(unknowns[1].startPosition).toEqual(11)\r\n const o: ILogon = res.view.toObject()\r\n expect(o).toBeTruthy()\r\n expect(o.Password).toEqual('consectetur')\r\n expect(o.Username).toEqual('sit')\r\n})\r\n\r\ntest('1 gap undefined msg', async () => {\r\n const gap = logon.replace('108=62441|', '108=62441|9999=im not here')\r\n const res: ParsingResult = await toParse(gap)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n expect(res.view.getUndefined()).toBeTruthy()\r\n expect(res.view.undefinedForMsg()).toEqual('undefined tag = 9999')\r\n})\r\n\r\ntest('2 gap undefined msg', async () => {\r\n const gap = logon.replace('108=62441|', '108=62441|1=gap|2=gap|')\r\n const res: ParsingResult = await toParse(gap)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.Logon)\r\n expect(res.view.getUndefined()).toBeTruthy()\r\n expect(res.view.undefinedForMsg()).toEqual('undefined tags = 1, 2')\r\n})\r\n"]}
@@ -1 +0,0 @@
1
- export {};