jspurefix 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +30 -0
- package/README.md +297 -249
- package/data/session/test-http-initiator.json +2 -2
- package/dist/buffer/ascii/ascii-chars.js.map +1 -1
- package/dist/buffer/ascii/ascii-encoder.js +9 -5
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser-state.d.ts +2 -2
- package/dist/buffer/ascii/ascii-parser-state.js +1 -1
- package/dist/buffer/ascii/ascii-parser-state.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser.d.ts +2 -2
- package/dist/buffer/ascii/ascii-parser.js +17 -11
- package/dist/buffer/ascii/ascii-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.d.ts +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.js +11 -3
- package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +3 -3
- package/dist/buffer/ascii/ascii-view.js +18 -0
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/ascii/itime-formatter.d.ts +12 -12
- package/dist/buffer/ascii/itime-formatter.js.map +1 -1
- package/dist/buffer/ascii/time-formatter.d.ts +6 -6
- package/dist/buffer/ascii/time-formatter.js.map +1 -1
- package/dist/buffer/elastic-buffer.d.ts +1 -1
- package/dist/buffer/elastic-buffer.js +2 -2
- package/dist/buffer/elastic-buffer.js.map +1 -1
- package/dist/buffer/encode-proxy.js +1 -1
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/encoder-state.d.ts +2 -2
- package/dist/buffer/encoder-state.js +4 -1
- package/dist/buffer/encoder-state.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.js +4 -2
- package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
- package/dist/buffer/fixml/fixml-parser.js +61 -39
- package/dist/buffer/fixml/fixml-parser.js.map +1 -1
- package/dist/buffer/fixml/fixml-view.js +3 -3
- package/dist/buffer/fixml/fixml-view.js.map +1 -1
- package/dist/buffer/fixml/populated-attributes.js.map +1 -1
- package/dist/buffer/msg-encoder.js +2 -1
- package/dist/buffer/msg-encoder.js.map +1 -1
- package/dist/buffer/msg-view.d.ts +9 -9
- package/dist/buffer/msg-view.js +58 -25
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/buffer/segment/segment-description.d.ts +4 -4
- package/dist/buffer/segment/segment-description.js +7 -5
- package/dist/buffer/segment/segment-description.js.map +1 -1
- package/dist/buffer/segment/segment-summary.js +2 -1
- package/dist/buffer/segment/segment-summary.js.map +1 -1
- package/dist/buffer/structure.d.ts +1 -1
- package/dist/buffer/structure.js +1 -2
- package/dist/buffer/structure.js.map +1 -1
- package/dist/buffer/time-format-template.js.map +1 -1
- package/dist/collections/collection.d.ts +3 -7
- package/dist/collections/collection.js.map +1 -1
- package/dist/collections/dictionary.d.ts +1 -1
- package/dist/collections/dictionary.js +2 -1
- package/dist/collections/dictionary.js.map +1 -1
- package/dist/config/empty-log-factory.js.map +1 -1
- package/dist/config/get-js-fx-logger.d.ts +1 -3
- package/dist/config/get-js-fx-logger.js.map +1 -1
- package/dist/config/js-fix-config.d.ts +3 -3
- package/dist/config/js-fix-config.js.map +1 -1
- package/dist/config/js-fix-logger.d.ts +5 -5
- package/dist/config/js-fix-logger.js.map +1 -1
- package/dist/config/js-fix-winston-log-factory.d.ts +1 -1
- package/dist/config/js-fix-winston-log-factory.js.map +1 -1
- package/dist/config/winston-logger.js +7 -7
- package/dist/config/winston-logger.js.map +1 -1
- package/dist/dict-parser.js +27 -21
- package/dist/dict-parser.js.map +1 -1
- package/dist/dictionary/compiler/compiler-settings.js.map +1 -1
- package/dist/dictionary/compiler/compiler-type.js.map +1 -1
- package/dist/dictionary/compiler/enum-compiler.d.ts +2 -2
- package/dist/dictionary/compiler/enum-compiler.js +7 -10
- package/dist/dictionary/compiler/enum-compiler.js.map +1 -1
- package/dist/dictionary/compiler/msg-compiler.js +9 -10
- package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
- package/dist/dictionary/compiler/standard-snippet.d.ts +1 -1
- package/dist/dictionary/compiler/standard-snippet.js +11 -10
- package/dist/dictionary/compiler/standard-snippet.js.map +1 -1
- package/dist/dictionary/contained/contained-component-field.d.ts +2 -2
- package/dist/dictionary/contained/contained-component-field.js +1 -1
- package/dist/dictionary/contained/contained-component-field.js.map +1 -1
- package/dist/dictionary/contained/contained-field-dispatcher.d.ts +3 -9
- package/dist/dictionary/contained/contained-field-dispatcher.js.map +1 -1
- package/dist/dictionary/contained/contained-field-set.d.ts +4 -4
- package/dist/dictionary/contained/contained-field-set.js +1 -1
- package/dist/dictionary/contained/contained-field-set.js.map +1 -1
- package/dist/dictionary/contained/contained-field.d.ts +1 -0
- package/dist/dictionary/contained/contained-field.js +3 -0
- package/dist/dictionary/contained/contained-field.js.map +1 -1
- package/dist/dictionary/contained/contained-group-field.d.ts +2 -2
- package/dist/dictionary/contained/contained-group-field.js +1 -1
- package/dist/dictionary/contained/contained-group-field.js.map +1 -1
- package/dist/dictionary/contained/contained-simple-field.d.ts +2 -2
- package/dist/dictionary/contained/contained-simple-field.js +1 -1
- package/dist/dictionary/contained/contained-simple-field.js.map +1 -1
- package/dist/dictionary/contained/field-dispatcher.d.ts +3 -9
- package/dist/dictionary/contained/field-dispatcher.js.map +1 -1
- package/dist/dictionary/contained/fields-dispatch.js +0 -1
- package/dist/dictionary/contained/fields-dispatch.js.map +1 -1
- package/dist/dictionary/definition/component-field-definition.d.ts +3 -3
- package/dist/dictionary/definition/component-field-definition.js +1 -1
- package/dist/dictionary/definition/component-field-definition.js.map +1 -1
- package/dist/dictionary/definition/fix-definitions.d.ts +3 -3
- package/dist/dictionary/definition/fix-definitions.js +3 -2
- package/dist/dictionary/definition/fix-definitions.js.map +1 -1
- package/dist/dictionary/definition/group-field-definition.d.ts +4 -4
- package/dist/dictionary/definition/group-field-definition.js +1 -1
- package/dist/dictionary/definition/group-field-definition.js.map +1 -1
- package/dist/dictionary/definition/message-definition.d.ts +2 -2
- package/dist/dictionary/definition/message-definition.js.map +1 -1
- package/dist/dictionary/definition/simple-field-definition.d.ts +4 -4
- package/dist/dictionary/definition/simple-field-definition.js +3 -2
- package/dist/dictionary/definition/simple-field-definition.js.map +1 -1
- package/dist/dictionary/dict-primitive.d.ts +1 -1
- package/dist/dictionary/dict-primitive.js.map +1 -1
- package/dist/dictionary/field-enum.js.map +1 -1
- package/dist/dictionary/fix-versions.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js +20 -18
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository.js +24 -16
- package/dist/dictionary/parser/fix-repository/repository.js.map +1 -1
- package/dist/dictionary/parser/fixml/components-parser.d.ts +1 -1
- package/dist/dictionary/parser/fixml/components-parser.js +24 -15
- package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
- package/dist/dictionary/parser/fixml/fields-parser.d.ts +1 -1
- package/dist/dictionary/parser/fixml/fields-parser.js +5 -5
- package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
- package/dist/dictionary/parser/fixml/fix-xsd-parser.js +3 -2
- package/dist/dictionary/parser/fixml/fix-xsd-parser.js.map +1 -1
- package/dist/dictionary/parser/fixml/include-graph.d.ts +1 -1
- package/dist/dictionary/parser/fixml/include-graph.js +58 -48
- package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
- package/dist/dictionary/parser/fixml/xsd-parser.d.ts +1 -1
- package/dist/dictionary/parser/fixml/xsd-parser.js +34 -23
- package/dist/dictionary/parser/fixml/xsd-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-definition-parser.js +0 -2
- package/dist/dictionary/parser/quickfix/field-definition-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-set-parser.js +3 -2
- package/dist/dictionary/parser/quickfix/field-set-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/message-parser.js +10 -5
- package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/node-parser.js +14 -8
- package/dist/dictionary/parser/quickfix/node-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/parse-context.d.ts +5 -5
- package/dist/dictionary/parser/quickfix/parse-context.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +22 -19
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/dictionary/set-reduce.js.map +1 -1
- package/dist/dictionary/type-dispatcher.d.ts +3 -9
- package/dist/dictionary/type-dispatcher.js.map +1 -1
- package/dist/dictionary/version-util.js +8 -8
- package/dist/dictionary/version-util.js.map +1 -1
- package/dist/jsfix-cmd.d.ts +3 -1
- package/dist/jsfix-cmd.js +134 -99
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/runtime/make-config.js +34 -14
- package/dist/runtime/make-config.js.map +1 -1
- package/dist/runtime/session-container.d.ts +3 -2
- package/dist/runtime/session-container.js +36 -16
- package/dist/runtime/session-container.js.map +1 -1
- package/dist/runtime/session-launcher.d.ts +10 -6
- package/dist/runtime/session-launcher.js +80 -43
- package/dist/runtime/session-launcher.js.map +1 -1
- package/dist/sample/http/oms/app.js +37 -7
- package/dist/sample/http/oms/app.js.map +1 -1
- package/dist/sample/http/oms/http-client.js +4 -2
- package/dist/sample/http/oms/http-client.js.map +1 -1
- package/dist/sample/http/oms/http-server.js +7 -1
- package/dist/sample/http/oms/http-server.js.map +1 -1
- package/dist/sample/http/oms/oms-factory.js +4 -3
- package/dist/sample/http/oms/oms-factory.js.map +1 -1
- package/dist/sample/tcp/qf-md/app.js +3 -3
- package/dist/sample/tcp/qf-md/app.js.map +1 -1
- package/dist/sample/tcp/qf-md/md-client.js +2 -1
- package/dist/sample/tcp/qf-md/md-client.js.map +1 -1
- package/dist/sample/tcp/qf-md/md-factory.js.map +1 -1
- package/dist/sample/tcp/qf-md/md-server.d.ts +1 -1
- package/dist/sample/tcp/qf-md/md-server.js +2 -1
- package/dist/sample/tcp/qf-md/md-server.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/app.js +29 -16
- package/dist/sample/tcp/recovering-skeleton/app.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.d.ts +9 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +51 -2
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js +2 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js +4 -3
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js.map +1 -1
- package/dist/sample/tcp/skeleton/app.js.map +1 -1
- package/dist/sample/tcp/skeleton/skeleton-session.js +7 -4
- package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/app-launcher.js +3 -3
- package/dist/sample/tcp/trade-capture/app-launcher.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.d.ts +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.js +2 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-server.js +7 -2
- package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-factory.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-resend.js +18 -7
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-memory-store.d.ts +3 -3
- package/dist/store/fix-msg-memory-store.js +93 -69
- package/dist/store/fix-msg-memory-store.js.map +1 -1
- package/dist/store/fix-msg-store-record.d.ts +6 -6
- package/dist/store/fix-msg-store-record.js +2 -1
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/store/fix-msg-store-state.js.map +1 -1
- package/dist/store/fix-msg-store.d.ts +7 -7
- package/dist/store/fix-msg-store.js.map +1 -1
- package/dist/test/ascii/ascii-encoder.test.js +93 -63
- package/dist/test/ascii/ascii-encoder.test.js.map +1 -1
- package/dist/test/ascii/ascii-parser.test.js +28 -24
- package/dist/test/ascii/ascii-parser.test.js.map +1 -1
- package/dist/test/ascii/ascii-segment.test.js +16 -11
- package/dist/test/ascii/ascii-segment.test.js.map +1 -1
- package/dist/test/ascii/ascii-store-replay.test.js +1 -1
- package/dist/test/ascii/ascii-store-replay.test.js.map +1 -1
- package/dist/test/ascii/ascii-tag-pos.test.js +7 -3
- package/dist/test/ascii/ascii-tag-pos.test.js.map +1 -1
- package/dist/test/ascii/execution-report.test.js +80 -72
- package/dist/test/ascii/execution-report.test.js.map +1 -1
- package/dist/test/ascii/fix-log-replay.test.js +1 -1
- package/dist/test/ascii/fix-log-replay.test.js.map +1 -1
- package/dist/test/ascii/fix-repo-dict.test.js +58 -55
- package/dist/test/ascii/fix-repo-dict.test.js.map +1 -1
- package/dist/test/ascii/includes.test.js +1 -1
- package/dist/test/ascii/includes.test.js.map +1 -1
- package/dist/test/ascii/logon.test.js +3 -3
- package/dist/test/ascii/logon.test.js.map +1 -1
- package/dist/test/ascii/memory-store.test.js +3 -3
- package/dist/test/ascii/memory-store.test.js.map +1 -1
- package/dist/test/ascii/qf-full-msg.test.js +19 -16
- package/dist/test/ascii/qf-full-msg.test.js.map +1 -1
- package/dist/test/ascii/repo-full-ascii-msg.test.js +11 -11
- package/dist/test/ascii/repo-full-ascii-msg.test.js.map +1 -1
- package/dist/test/ascii/session-state.test.js.map +1 -1
- package/dist/test/ascii/session.test.js +59 -42
- package/dist/test/ascii/session.test.js.map +1 -1
- package/dist/test/ascii/view-decode.test.js +30 -22
- package/dist/test/ascii/view-decode.test.js.map +1 -1
- package/dist/test/encode-proxy.test.js +29 -29
- package/dist/test/encode-proxy.test.js.map +1 -1
- package/dist/test/env/experiment.js +5 -5
- package/dist/test/env/experiment.js.map +1 -1
- package/dist/test/env/parsing-result.d.ts +3 -3
- package/dist/test/env/parsing-result.js.map +1 -1
- package/dist/test/env/setup.d.ts +2 -2
- package/dist/test/env/setup.js +13 -11
- package/dist/test/env/setup.js.map +1 -1
- package/dist/test/env/skeleton-runner.d.ts +1 -1
- package/dist/test/env/skeleton-runner.js +16 -16
- package/dist/test/env/skeleton-runner.js.map +1 -1
- package/dist/test/env/test-recovery.d.ts +3 -3
- package/dist/test/env/test-recovery.js +1 -1
- package/dist/test/env/test-recovery.js.map +1 -1
- package/dist/test/env/to-views.d.ts +1 -1
- package/dist/test/env/to-views.js +2 -2
- package/dist/test/env/to-views.js.map +1 -1
- package/dist/test/fixml/fixml-alloc-parse.test.js +32 -15
- package/dist/test/fixml/fixml-alloc-parse.test.js.map +1 -1
- package/dist/test/fixml/fixml-mkt-data-fut-parse.test.js +2 -2
- package/dist/test/fixml/fixml-mkt-data-fut-parse.test.js.map +1 -1
- package/dist/test/fixml/fixml-mkt-data-settle-parse.test.js +2 -1
- package/dist/test/fixml/fixml-mkt-data-settle-parse.test.js.map +1 -1
- package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.js +19 -12
- package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.js.map +1 -1
- package/dist/test/fixml/repo-full-fixml-msg.test.js +2 -2
- package/dist/test/fixml/repo-full-fixml-msg.test.js.map +1 -1
- package/dist/transport/ascii/ascii-msg-transmitter.d.ts +1 -1
- package/dist/transport/ascii/ascii-msg-transmitter.js +18 -8
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session-msg-factory.d.ts +3 -3
- package/dist/transport/ascii/ascii-session-msg-factory.js +4 -2
- package/dist/transport/ascii/ascii-session-msg-factory.js.map +1 -1
- package/dist/transport/ascii/ascii-session.d.ts +1 -1
- package/dist/transport/ascii/ascii-session.js +34 -16
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/duplex/http-duplex.js +10 -8
- package/dist/transport/duplex/http-duplex.js.map +1 -1
- package/dist/transport/duplex/string-duplex.js +2 -2
- package/dist/transport/duplex/string-duplex.js.map +1 -1
- package/dist/transport/factory/msg-transport.js +21 -10
- package/dist/transport/factory/msg-transport.js.map +1 -1
- package/dist/transport/fix-acceptor.d.ts +3 -3
- package/dist/transport/fix-acceptor.js.map +1 -1
- package/dist/transport/fix-entity.d.ts +1 -1
- package/dist/transport/fix-entity.js.map +1 -1
- package/dist/transport/fix-initiator.d.ts +2 -2
- package/dist/transport/fix-initiator.js.map +1 -1
- package/dist/transport/fixml/fixml-msg-transmitter.d.ts +1 -1
- package/dist/transport/fixml/fixml-msg-transmitter.js +4 -2
- package/dist/transport/fixml/fixml-msg-transmitter.js.map +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.d.ts +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -1
- package/dist/transport/fixml/fixml-session.js +7 -3
- package/dist/transport/fixml/fixml-session.js.map +1 -1
- package/dist/transport/http/html-options.d.ts +2 -2
- package/dist/transport/http/html-options.js.map +1 -1
- package/dist/transport/http/html-route.js.map +1 -1
- package/dist/transport/http/http-acceptor-listener.js +27 -23
- package/dist/transport/http/http-acceptor-listener.js.map +1 -1
- package/dist/transport/http/http-acceptor.d.ts +2 -2
- package/dist/transport/http/http-acceptor.js +52 -41
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/http/http-adapter.d.ts +3 -3
- package/dist/transport/http/http-adapter.js.map +1 -1
- package/dist/transport/http/http-initiator.js +35 -23
- package/dist/transport/http/http-initiator.js.map +1 -1
- package/dist/transport/http/http-json-sample-adapter.d.ts +4 -4
- package/dist/transport/http/http-json-sample-adapter.js +16 -11
- package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
- package/dist/transport/http/http-transaction.js.map +1 -1
- package/dist/transport/http/http-transport-description.js.map +1 -1
- package/dist/transport/msg-application.js.map +1 -1
- package/dist/transport/msg-transmitter.d.ts +1 -1
- package/dist/transport/msg-transmitter.js +2 -2
- package/dist/transport/msg-transmitter.js.map +1 -1
- package/dist/transport/session/a-session-msg-factory.d.ts +3 -5
- package/dist/transport/session/a-session-msg-factory.js.map +1 -1
- package/dist/transport/session/fix-session-state.d.ts +8 -5
- package/dist/transport/session/fix-session-state.js +21 -16
- package/dist/transport/session/fix-session-state.js.map +1 -1
- package/dist/transport/session/fix-session.d.ts +19 -6
- package/dist/transport/session/fix-session.js +197 -110
- package/dist/transport/session/fix-session.js.map +1 -1
- package/dist/transport/session/make-fix-session.d.ts +1 -3
- package/dist/transport/session/make-fix-session.js.map +1 -1
- package/dist/transport/session/session-description.d.ts +1 -1
- package/dist/transport/session/session-description.js.map +1 -1
- package/dist/transport/session/session-msg-factory.d.ts +9 -9
- package/dist/transport/session/session-msg-factory.js.map +1 -1
- package/dist/transport/tcp/recovering-tcp-initiator.d.ts +4 -2
- package/dist/transport/tcp/recovering-tcp-initiator.js +62 -30
- package/dist/transport/tcp/recovering-tcp-initiator.js.map +1 -1
- package/dist/transport/tcp/tcp-acceptor-listener.js +28 -25
- package/dist/transport/tcp/tcp-acceptor-listener.js.map +1 -1
- package/dist/transport/tcp/tcp-acceptor.d.ts +2 -2
- package/dist/transport/tcp/tcp-acceptor.js +23 -15
- package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator-connector.js +39 -30
- package/dist/transport/tcp/tcp-initiator-connector.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator.d.ts +1 -1
- package/dist/transport/tcp/tcp-initiator.js +130 -104
- package/dist/transport/tcp/tcp-initiator.js.map +1 -1
- package/dist/transport/tcp/tcp-transport-description.js.map +1 -1
- package/dist/transport/tcp/tls-options-factory.d.ts +3 -3
- package/dist/transport/tcp/tls-options-factory.js +10 -3
- package/dist/transport/tcp/tls-options-factory.js.map +1 -1
- package/dist/transport/tcp/tls-options.d.ts +6 -2
- package/dist/transport/tcp/tls-options.js.map +1 -1
- package/dist/util/json-helper.js +2 -1
- package/dist/util/json-helper.js.map +1 -1
- package/dist/util/message-generator.d.ts +1 -1
- package/dist/util/message-generator.js +1 -1
- package/dist/util/message-generator.js.map +1 -1
- package/package.json +53 -48
- package/src/buffer/ascii/ascii-chars.ts +0 -1
- package/src/buffer/ascii/ascii-encoder.ts +18 -16
- package/src/buffer/ascii/ascii-parser-state.ts +4 -4
- package/src/buffer/ascii/ascii-parser.ts +16 -13
- package/src/buffer/ascii/ascii-segment-parser.ts +16 -15
- package/src/buffer/ascii/ascii-view.ts +22 -14
- package/src/buffer/ascii/itime-formatter.ts +12 -12
- package/src/buffer/ascii/time-formatter.ts +11 -12
- package/src/buffer/elastic-buffer.ts +5 -6
- package/src/buffer/encode-proxy.ts +6 -5
- package/src/buffer/encoder-state.ts +7 -3
- package/src/buffer/fixml/fixml-encoder.ts +10 -10
- package/src/buffer/fixml/fixml-parser.ts +80 -60
- package/src/buffer/fixml/fixml-view.ts +6 -7
- package/src/buffer/fixml/populated-attributes.ts +1 -1
- package/src/buffer/msg-encoder.ts +2 -1
- package/src/buffer/msg-view.ts +73 -53
- package/src/buffer/segment/segment-description.ts +13 -13
- package/src/buffer/segment/segment-summary.ts +3 -2
- package/src/buffer/structure.ts +6 -6
- package/src/buffer/time-format-template.ts +1 -1
- package/src/collections/collection.ts +2 -6
- package/src/collections/dictionary.ts +4 -5
- package/src/config/empty-log-factory.ts +1 -0
- package/src/config/get-js-fx-logger.ts +1 -2
- package/src/config/js-fix-config.ts +6 -6
- package/src/config/js-fix-logger.ts +14 -9
- package/src/config/js-fix-winston-log-factory.ts +2 -1
- package/src/config/winston-logger.ts +9 -7
- package/src/dictionary/compiler/compiler-settings.ts +5 -5
- package/src/dictionary/compiler/compiler-type.ts +1 -1
- package/src/dictionary/compiler/enum-compiler.ts +14 -16
- package/src/dictionary/compiler/msg-compiler.ts +15 -17
- package/src/dictionary/compiler/standard-snippet.ts +28 -27
- package/src/dictionary/contained/contained-component-field.ts +5 -4
- package/src/dictionary/contained/contained-field-dispatcher.ts +3 -3
- package/src/dictionary/contained/contained-field-set.ts +21 -21
- package/src/dictionary/contained/contained-field.ts +4 -1
- package/src/dictionary/contained/contained-group-field.ts +4 -4
- package/src/dictionary/contained/contained-simple-field.ts +5 -5
- package/src/dictionary/contained/field-dispatcher.ts +3 -3
- package/src/dictionary/contained/fields-dispatch.ts +0 -1
- package/src/dictionary/definition/component-field-definition.ts +4 -4
- package/src/dictionary/definition/fix-definitions.ts +8 -8
- package/src/dictionary/definition/group-field-definition.ts +5 -5
- package/src/dictionary/definition/message-definition.ts +4 -4
- package/src/dictionary/definition/simple-field-definition.ts +9 -9
- package/src/dictionary/dict-primitive.ts +2 -2
- package/src/dictionary/field-enum.ts +3 -2
- package/src/dictionary/fix-versions.ts +10 -10
- package/src/dictionary/parser/fix-repository/repository-xml-parser.ts +7 -8
- package/src/dictionary/parser/fix-repository/repository.ts +38 -30
- package/src/dictionary/parser/fixml/components-parser.ts +57 -51
- package/src/dictionary/parser/fixml/fields-parser.ts +9 -10
- package/src/dictionary/parser/fixml/fix-xsd-parser.ts +2 -3
- package/src/dictionary/parser/fixml/include-graph.ts +26 -21
- package/src/dictionary/parser/fixml/xsd-parser.ts +5 -5
- package/src/dictionary/parser/quickfix/field-definition-parser.ts +3 -5
- package/src/dictionary/parser/quickfix/field-set-parser.ts +2 -2
- package/src/dictionary/parser/quickfix/message-parser.ts +9 -6
- package/src/dictionary/parser/quickfix/node-parser.ts +20 -18
- package/src/dictionary/parser/quickfix/parse-context.ts +4 -4
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +13 -15
- package/src/dictionary/set-reduce.ts +4 -3
- package/src/dictionary/type-dispatcher.ts +3 -3
- package/src/dictionary/version-util.ts +8 -8
- package/src/jsfix-cmd.ts +82 -58
- package/src/runtime/make-config.ts +15 -10
- package/src/runtime/session-container.ts +26 -18
- package/src/runtime/session-launcher.ts +58 -30
- package/src/sample/http/oms/app.ts +24 -7
- package/src/sample/http/oms/http-client.ts +3 -3
- package/src/sample/http/oms/http-server.ts +7 -1
- package/src/sample/http/oms/oms-factory.ts +3 -3
- package/src/sample/tcp/qf-md/app.ts +3 -3
- package/src/sample/tcp/qf-md/md-client.ts +1 -1
- package/src/sample/tcp/qf-md/md-factory.ts +3 -2
- package/src/sample/tcp/qf-md/md-server.ts +2 -2
- package/src/sample/tcp/recovering-skeleton/app.ts +37 -20
- package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +66 -4
- package/src/sample/tcp/recovering-skeleton/skeleton-client.ts +2 -2
- package/src/sample/tcp/recovering-skeleton/skeleton-server.ts +4 -4
- package/src/sample/tcp/skeleton/app.ts +1 -1
- package/src/sample/tcp/skeleton/skeleton-session.ts +7 -7
- package/src/sample/tcp/tls-trade-capture/app.ts +1 -1
- package/src/sample/tcp/trade-capture/app-launcher.ts +4 -4
- package/src/sample/tcp/trade-capture/trade-capture-client.ts +7 -5
- package/src/sample/tcp/trade-capture/trade-capture-server.ts +10 -5
- package/src/sample/tcp/trade-capture/trade-factory.ts +1 -1
- package/src/store/fix-msg-ascii-store-resend.ts +5 -6
- package/src/store/fix-msg-memory-store.ts +22 -21
- package/src/store/fix-msg-store-record.ts +8 -8
- package/src/store/fix-msg-store-state.ts +2 -2
- package/src/store/fix-msg-store.ts +7 -7
- package/src/transport/ascii/ascii-msg-transmitter.ts +20 -14
- package/src/transport/ascii/ascii-session-msg-factory.ts +5 -6
- package/src/transport/ascii/ascii-session.ts +40 -29
- package/src/transport/duplex/http-duplex.ts +11 -9
- package/src/transport/duplex/string-duplex.ts +4 -5
- package/src/transport/factory/msg-transport.ts +5 -6
- package/src/transport/fix-acceptor.ts +2 -2
- package/src/transport/fix-entity.ts +1 -1
- package/src/transport/fix-initiator.ts +1 -1
- package/src/transport/fixml/fixml-msg-transmitter.ts +4 -3
- package/src/transport/fixml/fixml-session-msg-factory.ts +1 -2
- package/src/transport/fixml/fixml-session.ts +7 -6
- package/src/transport/http/html-options.ts +5 -5
- package/src/transport/http/html-route.ts +1 -1
- package/src/transport/http/http-acceptor-listener.ts +6 -4
- package/src/transport/http/http-acceptor.ts +36 -34
- package/src/transport/http/http-adapter.ts +3 -3
- package/src/transport/http/http-initiator.ts +22 -16
- package/src/transport/http/http-json-sample-adapter.ts +17 -16
- package/src/transport/http/http-transaction.ts +1 -1
- package/src/transport/http/http-transport-description.ts +1 -1
- package/src/transport/msg-application.ts +4 -4
- package/src/transport/msg-transmitter.ts +5 -5
- package/src/transport/session/a-session-msg-factory.ts +2 -3
- package/src/transport/session/fix-session-state.ts +24 -18
- package/src/transport/session/fix-session.ts +169 -96
- package/src/transport/session/make-fix-session.ts +1 -2
- package/src/transport/session/session-description.ts +2 -2
- package/src/transport/session/session-msg-factory.ts +9 -9
- package/src/transport/tcp/recovering-tcp-initiator.ts +39 -21
- package/src/transport/tcp/tcp-acceptor-listener.ts +4 -3
- package/src/transport/tcp/tcp-acceptor.ts +23 -22
- package/src/transport/tcp/tcp-initiator-connector.ts +16 -10
- package/src/transport/tcp/tcp-initiator.ts +57 -46
- package/src/transport/tcp/tcp-transport-description.ts +1 -1
- package/src/transport/tcp/tls-options-factory.ts +21 -8
- package/src/transport/tcp/tls-options.ts +11 -7
- package/src/util/json-helper.ts +6 -5
- package/src/util/message-generator.ts +6 -7
- package/tsconfig.json +2 -0
- package/.eslintrc.js +0 -6
- package/dist/buffer/ascii-chars.d.ts +0 -22
- package/dist/buffer/ascii-chars.js +0 -29
- package/dist/buffer/ascii-chars.js.map +0 -1
- package/dist/buffer/segment-description.d.ts +0 -33
- package/dist/buffer/segment-description.js +0 -80
- package/dist/buffer/segment-description.js.map +0 -1
- package/dist/buffer/segment-summary.d.ts +0 -13
- package/dist/buffer/segment-summary.js +0 -20
- package/dist/buffer/segment-summary.js.map +0 -1
- package/dist/buffer/tag-pos.d.ts +0 -12
- package/dist/buffer/tag-pos.js +0 -55
- package/dist/buffer/tag-pos.js.map +0 -1
- package/dist/buffer/tags.d.ts +0 -32
- package/dist/buffer/tags.js +0 -135
- package/dist/buffer/tags.js.map +0 -1
- package/dist/dictionary/fields-dispatch.d.ts +0 -13
- package/dist/dictionary/fields-dispatch.js +0 -40
- package/dist/dictionary/fields-dispatch.js.map +0 -1
- package/dist/sample/launcher.d.ts +0 -12
- package/dist/sample/launcher.js +0 -63
- package/dist/sample/launcher.js.map +0 -1
- package/dist/test/ascii-encoder.test.d.ts +0 -1
- package/dist/test/ascii-encoder.test.js +0 -529
- package/dist/test/ascii-encoder.test.js.map +0 -1
- package/dist/test/ascii-parser.test.d.ts +0 -1
- package/dist/test/ascii-parser.test.js +0 -142
- package/dist/test/ascii-parser.test.js.map +0 -1
- package/dist/test/ascii-segment.test.d.ts +0 -1
- package/dist/test/ascii-segment.test.js +0 -107
- package/dist/test/ascii-segment.test.js.map +0 -1
- package/dist/test/ascii-store-replay.test.d.ts +0 -1
- package/dist/test/ascii-store-replay.test.js +0 -121
- package/dist/test/ascii-store-replay.test.js.map +0 -1
- package/dist/test/ascii-tag-pos.test.d.ts +0 -1
- package/dist/test/ascii-tag-pos.test.js +0 -105
- package/dist/test/ascii-tag-pos.test.js.map +0 -1
- package/dist/test/execution-report.test.d.ts +0 -1
- package/dist/test/execution-report.test.js +0 -490
- package/dist/test/execution-report.test.js.map +0 -1
- package/dist/test/fix-log-replay.test.d.ts +0 -1
- package/dist/test/fix-log-replay.test.js +0 -45
- package/dist/test/fix-log-replay.test.js.map +0 -1
- package/dist/test/fix-repo-dict.test.d.ts +0 -1
- package/dist/test/fix-repo-dict.test.js +0 -127
- package/dist/test/fix-repo-dict.test.js.map +0 -1
- package/dist/test/fixml-alloc-parse.test.d.ts +0 -1
- package/dist/test/fixml-alloc-parse.test.js +0 -160
- package/dist/test/fixml-alloc-parse.test.js.map +0 -1
- package/dist/test/fixml-mkt-data-fut-parse.test.d.ts +0 -1
- package/dist/test/fixml-mkt-data-fut-parse.test.js +0 -60
- package/dist/test/fixml-mkt-data-fut-parse.test.js.map +0 -1
- package/dist/test/fixml-mkt-data-settle-parse.test.d.ts +0 -1
- package/dist/test/fixml-mkt-data-settle-parse.test.js +0 -33
- package/dist/test/fixml-mkt-data-settle-parse.test.js.map +0 -1
- package/dist/test/fixml-tc-bi-lateral-parse.test.d.ts +0 -1
- package/dist/test/fixml-tc-bi-lateral-parse.test.js +0 -96
- package/dist/test/fixml-tc-bi-lateral-parse.test.js.map +0 -1
- package/dist/test/includes.test.d.ts +0 -1
- package/dist/test/includes.test.js +0 -42
- package/dist/test/includes.test.js.map +0 -1
- package/dist/test/logon.test.d.ts +0 -1
- package/dist/test/logon.test.js +0 -93
- package/dist/test/logon.test.js.map +0 -1
- package/dist/test/memory-store.test.d.ts +0 -1
- package/dist/test/memory-store.test.js +0 -75
- package/dist/test/memory-store.test.js.map +0 -1
- package/dist/test/qf-full-msg.test.d.ts +0 -1
- package/dist/test/qf-full-msg.test.js +0 -76
- package/dist/test/qf-full-msg.test.js.map +0 -1
- package/dist/test/repo-full-ascii-msg.test.d.ts +0 -1
- package/dist/test/repo-full-ascii-msg.test.js +0 -82
- package/dist/test/repo-full-ascii-msg.test.js.map +0 -1
- package/dist/test/repo-full-fixml-msg.test.d.ts +0 -1
- package/dist/test/repo-full-fixml-msg.test.js +0 -136
- package/dist/test/repo-full-fixml-msg.test.js.map +0 -1
- package/dist/test/session-state.test.d.ts +0 -1
- package/dist/test/session-state.test.js +0 -74
- package/dist/test/session-state.test.js.map +0 -1
- package/dist/test/session.test.d.ts +0 -1
- package/dist/test/session.test.js +0 -412
- package/dist/test/session.test.js.map +0 -1
- package/dist/test/time-formatter.test.d.ts +0 -1
- package/dist/test/time-formatter.test.js +0 -78
- package/dist/test/time-formatter.test.js.map +0 -1
- package/dist/test/to-views.d.ts +0 -11
- package/dist/test/to-views.js +0 -55
- package/dist/test/to-views.js.map +0 -1
- package/dist/test/view-decode.test.d.ts +0 -1
- package/dist/test/view-decode.test.js +0 -208
- package/dist/test/view-decode.test.js.map +0 -1
- package/dist/transport/a-session-msg-factory.d.ts +0 -23
- package/dist/transport/a-session-msg-factory.js +0 -58
- package/dist/transport/a-session-msg-factory.js.map +0 -1
- package/dist/transport/ascii-session-msg-factory.d.ts +0 -16
- package/dist/transport/ascii-session-msg-factory.js +0 -47
- package/dist/transport/ascii-session-msg-factory.js.map +0 -1
- package/dist/transport/fix-msg-factory.d.ts +0 -15
- package/dist/transport/fix-msg-factory.js +0 -3
- package/dist/transport/fix-msg-factory.js.map +0 -1
- package/dist/transport/fix-session-state-args.d.ts +0 -8
- package/dist/transport/fix-session-state-args.js +0 -3
- package/dist/transport/fix-session-state-args.js.map +0 -1
- package/dist/transport/fix-session-state.d.ts +0 -32
- package/dist/transport/fix-session-state.js +0 -133
- package/dist/transport/fix-session-state.js.map +0 -1
- package/dist/transport/fix-session.d.ts +0 -50
- package/dist/transport/fix-session.js +0 -290
- package/dist/transport/fix-session.js.map +0 -1
- package/dist/transport/fixml/acceptor.d.ts +0 -3
- package/dist/transport/fixml/acceptor.js +0 -38
- package/dist/transport/fixml/acceptor.js.map +0 -1
- package/dist/transport/fixml-session-msg-factory.d.ts +0 -13
- package/dist/transport/fixml-session-msg-factory.js +0 -68
- package/dist/transport/fixml-session-msg-factory.js.map +0 -1
- package/dist/transport/make-config.d.ts +0 -4
- package/dist/transport/make-config.js +0 -31
- package/dist/transport/make-config.js.map +0 -1
- package/dist/transport/make-fix-session.d.ts +0 -5
- package/dist/transport/make-fix-session.js +0 -3
- package/dist/transport/make-fix-session.js.map +0 -1
- package/dist/transport/make-fixl-session.d.ts +0 -5
- package/dist/transport/make-fixl-session.js +0 -3
- package/dist/transport/make-fixl-session.js.map +0 -1
- package/dist/transport/msg-transport.d.ts +0 -14
- package/dist/transport/msg-transport.js +0 -57
- package/dist/transport/msg-transport.js.map +0 -1
- package/dist/transport/session-description.d.ts +0 -64
- package/dist/transport/session-description.js +0 -3
- package/dist/transport/session-description.js.map +0 -1
- package/dist/transport/session-msg-factory.d.ts +0 -6
- package/dist/transport/session-msg-factory.js +0 -13
- package/dist/transport/session-msg-factory.js.map +0 -1
- package/dist/transport/session-state.d.ts +0 -25
- package/dist/transport/session-state.js +0 -30
- package/dist/transport/session-state.js.map +0 -1
- package/dist/transport/tcp/acceptor.d.ts +0 -3
- package/dist/transport/tcp/acceptor.js +0 -40
- package/dist/transport/tcp/acceptor.js.map +0 -1
- package/dist/transport/tcp/initiator.d.ts +0 -3
- package/dist/transport/tcp/initiator.js +0 -67
- package/dist/transport/tcp/initiator.js.map +0 -1
- package/dist/util/dictionary-definitions.d.ts +0 -8
- package/dist/util/dictionary-definitions.js +0 -51
- package/dist/util/dictionary-definitions.js.map +0 -1
- package/tslint.json +0 -3
package/src/jsfix-cmd.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { MsgTag } from './types'
|
|
|
11
11
|
import { IJsFixConfig } from './config'
|
|
12
12
|
|
|
13
13
|
import * as util from 'util'
|
|
14
|
-
const fs = require('node-fs-extra')
|
|
15
14
|
import * as minimist from 'minimist'
|
|
16
15
|
import * as path from 'path'
|
|
17
16
|
import { MsgTransport } from './transport/factory'
|
|
@@ -19,6 +18,7 @@ import { EnumCompiler, ICompilerSettings, MsgCompiler } from './dictionary/compi
|
|
|
19
18
|
import { AsciiMsgTransmitter } from './transport/ascii/ascii-msg-transmitter'
|
|
20
19
|
import { SessionContainer } from './runtime'
|
|
21
20
|
import { DITokens } from './runtime/di-tokens'
|
|
21
|
+
const fs = require('node-fs-extra')
|
|
22
22
|
|
|
23
23
|
const argv: any = minimist(process.argv.slice(2))
|
|
24
24
|
|
|
@@ -49,7 +49,7 @@ export class JsfixCmd {
|
|
|
49
49
|
private sessionDescription: ISessionDescription
|
|
50
50
|
private delimiter: number = AsciiChars.Soh
|
|
51
51
|
private stats: ILooseObject = {}
|
|
52
|
-
private filter: string = null
|
|
52
|
+
private filter: string | null = null
|
|
53
53
|
private messages: number = 0
|
|
54
54
|
private print: boolean = true
|
|
55
55
|
|
|
@@ -89,20 +89,19 @@ export class JsfixCmd {
|
|
|
89
89
|
return mode
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
private static async writeFile (name: string, api: string) {
|
|
92
|
+
private static async writeFile (name: string, api: string): Promise<void> {
|
|
93
93
|
const writer = util.promisify(fs.writeFile)
|
|
94
|
-
await writer(name, api, {
|
|
95
|
-
encoding: 'utf8'}
|
|
94
|
+
await writer(name, api, { encoding: 'utf8' }
|
|
96
95
|
).catch((e: Error) => {
|
|
97
96
|
throw e
|
|
98
97
|
})
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
public exec (): Promise<any> {
|
|
102
|
-
return new Promise<any>((resolve, reject) => {
|
|
100
|
+
public async exec (): Promise<any> {
|
|
101
|
+
return await new Promise<any>((resolve, reject) => {
|
|
103
102
|
this.init().then(async () => {
|
|
104
103
|
let actioned: boolean = true
|
|
105
|
-
|
|
104
|
+
const command = JsfixCmd.getCommand()
|
|
106
105
|
|
|
107
106
|
switch (command) {
|
|
108
107
|
case Command.Generate: {
|
|
@@ -168,8 +167,8 @@ export class JsfixCmd {
|
|
|
168
167
|
})
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
private firstMessage (t: MsgTransport): Promise<MsgView> {
|
|
172
|
-
return new Promise<MsgView>((resolve, reject) => {
|
|
170
|
+
private async firstMessage (t: MsgTransport): Promise<MsgView> {
|
|
171
|
+
return await new Promise<MsgView>((resolve, reject) => {
|
|
173
172
|
t.receiver.on('msg', (msgType: string, msgView: MsgView) => {
|
|
174
173
|
resolve(msgView.clone())
|
|
175
174
|
})
|
|
@@ -179,7 +178,7 @@ export class JsfixCmd {
|
|
|
179
178
|
})
|
|
180
179
|
}
|
|
181
180
|
|
|
182
|
-
|
|
181
|
+
protected async generate (): Promise<void> {
|
|
183
182
|
const lipPath: string = path.join(this.root, 'data/examples/lipsum.txt')
|
|
184
183
|
const words: string[] = await getWords(lipPath)
|
|
185
184
|
const generator = new MessageGenerator(words, this.definitions)
|
|
@@ -199,7 +198,7 @@ export class JsfixCmd {
|
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
200
|
|
|
202
|
-
private async single (generator: MessageGenerator, density: number) {
|
|
201
|
+
private async single (generator: MessageGenerator, density: number): Promise<void> {
|
|
203
202
|
if (!argv.type) {
|
|
204
203
|
console.log('specify type to generate e.g. --type = AE')
|
|
205
204
|
return
|
|
@@ -220,14 +219,14 @@ export class JsfixCmd {
|
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
221
|
|
|
223
|
-
private async script (generator: MessageGenerator, density: number) {
|
|
224
|
-
|
|
222
|
+
private async script (generator: MessageGenerator, density: number): Promise<void> {
|
|
223
|
+
const buffer: ElasticBuffer = new ElasticBuffer()
|
|
225
224
|
const repeats: number = argv.repeats || 50
|
|
226
225
|
const key: string = MsgTag.MsgType.toString()
|
|
227
226
|
const sf = this.definitions.simple.get(key)
|
|
228
227
|
const session: AsciiMsgTransmitter = this.session
|
|
229
228
|
for (let i = 0; i < repeats; ++i) {
|
|
230
|
-
const msgType: string = MessageGenerator.getRandomEnum(sf).toString()
|
|
229
|
+
const msgType: string = sf ? MessageGenerator.getRandomEnum(sf).toString() : ''
|
|
231
230
|
console.log(`i = ${i} ${msgType}`)
|
|
232
231
|
const obj: ILooseObject = generator.generate(msgType, density)
|
|
233
232
|
session.encodeMessage(msgType, obj)
|
|
@@ -237,9 +236,9 @@ export class JsfixCmd {
|
|
|
237
236
|
await JsfixCmd.writeFile('./fix.txt', buffer.slice().toString('utf8'))
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
private async unitTest (fix: string, obj: ILooseObject, ft: MsgTransport) {
|
|
239
|
+
private async unitTest (fix: string, obj: ILooseObject, ft: MsgTransport): Promise<void> {
|
|
241
240
|
const view: MsgView = await this.firstMessage(ft)
|
|
242
|
-
const summary = view
|
|
241
|
+
const summary = view?.structure?.summary()
|
|
243
242
|
|
|
244
243
|
await JsfixCmd.writeFile('./fix.txt', fix)
|
|
245
244
|
await JsfixCmd.writeFile('./object.json', JSON.stringify(obj, null, 4))
|
|
@@ -262,7 +261,7 @@ export class JsfixCmd {
|
|
|
262
261
|
}
|
|
263
262
|
|
|
264
263
|
private field (): void {
|
|
265
|
-
let sf: SimpleFieldDefinition
|
|
264
|
+
let sf: SimpleFieldDefinition | null
|
|
266
265
|
const tag: number = parseInt(argv.field, 10)
|
|
267
266
|
const definitions = this.definitions
|
|
268
267
|
if (!isNaN(tag)) {
|
|
@@ -275,19 +274,19 @@ export class JsfixCmd {
|
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
ensureExists (path: string): Promise<any> {
|
|
279
|
-
return new Promise<any>((
|
|
277
|
+
async ensureExists (path: string): Promise<any> {
|
|
278
|
+
return await new Promise<any>((resolve, reject) => {
|
|
280
279
|
fs.mkdirp(path, (err: Error) => {
|
|
281
280
|
if (err) {
|
|
282
281
|
reject(err)
|
|
283
282
|
} else {
|
|
284
|
-
|
|
283
|
+
resolve(true)
|
|
285
284
|
}
|
|
286
285
|
})
|
|
287
286
|
})
|
|
288
287
|
}
|
|
289
288
|
|
|
290
|
-
private async compileDefinitions (outputPath: string) {
|
|
289
|
+
private async compileDefinitions (outputPath: string): Promise<void> {
|
|
291
290
|
await this.ensureExists(path.join(outputPath, 'set'))
|
|
292
291
|
await this.ensureExists(path.join(outputPath, 'enum'))
|
|
293
292
|
const definitions = this.definitions
|
|
@@ -300,7 +299,7 @@ export class JsfixCmd {
|
|
|
300
299
|
await enumCompiler.generate(writeFile)
|
|
301
300
|
}
|
|
302
301
|
|
|
303
|
-
private async compile () {
|
|
302
|
+
private async compile (): Promise<void> {
|
|
304
303
|
let output = argv.output
|
|
305
304
|
const dp = new DefinitionFactory().getDictPath(argv.dict)
|
|
306
305
|
if (dp) {
|
|
@@ -361,13 +360,12 @@ export class JsfixCmd {
|
|
|
361
360
|
}
|
|
362
361
|
}
|
|
363
362
|
|
|
364
|
-
private subscribe (ft: MsgTransport) {
|
|
363
|
+
private subscribe (ft: MsgTransport): void {
|
|
365
364
|
this.messages = 0
|
|
366
365
|
this.stats = {}
|
|
367
366
|
const filter = this.filter
|
|
368
367
|
// the receiver is message parser which is piped from an input stream - file, socket
|
|
369
368
|
ft.receiver.on('msg', (msgType: string, m: AsciiView) => {
|
|
370
|
-
|
|
371
369
|
if (filter) {
|
|
372
370
|
if (msgType !== filter) {
|
|
373
371
|
return
|
|
@@ -378,17 +376,19 @@ export class JsfixCmd {
|
|
|
378
376
|
})
|
|
379
377
|
}
|
|
380
378
|
|
|
381
|
-
private onMsg (msgType: string, m: MsgView) {
|
|
379
|
+
private onMsg (msgType: string, m: MsgView): void {
|
|
382
380
|
const mode: PrintMode = JsfixCmd.getPrintMode()
|
|
383
381
|
const print = this.print
|
|
384
382
|
const stats = this.stats
|
|
385
383
|
switch (mode) {
|
|
386
384
|
case PrintMode.Stats: {
|
|
385
|
+
let i: number = 0
|
|
387
386
|
if (!stats[msgType]) {
|
|
388
|
-
|
|
387
|
+
i = 1
|
|
389
388
|
} else {
|
|
390
|
-
|
|
389
|
+
i = stats[msgType] as number + 1
|
|
391
390
|
}
|
|
391
|
+
stats[msgType] = i
|
|
392
392
|
break
|
|
393
393
|
}
|
|
394
394
|
|
|
@@ -404,14 +404,14 @@ export class JsfixCmd {
|
|
|
404
404
|
const asObject: ILooseObject = m.toObject()
|
|
405
405
|
if (print) {
|
|
406
406
|
const def = this.definitions.message.get(msgType)
|
|
407
|
-
console.log(`${msgType} [${def
|
|
407
|
+
console.log(`${msgType} [${def?.name}] = ${JSON.stringify(asObject, null, 4)}`)
|
|
408
408
|
console.log()
|
|
409
409
|
}
|
|
410
410
|
break
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
case PrintMode.Structure: {
|
|
414
|
-
const summary = m
|
|
414
|
+
const summary = m?.structure?.summary()
|
|
415
415
|
if (print) {
|
|
416
416
|
console.log(JSON.stringify(summary, null, 4))
|
|
417
417
|
}
|
|
@@ -448,35 +448,59 @@ export class JsfixCmd {
|
|
|
448
448
|
await this.dispatch(ft)
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
private async promisedRead (f: string): Promise<string> {
|
|
452
|
+
return new Promise((resolve, reject) => {
|
|
453
|
+
fs.readFile(f, 'utf8', async (err: Error, contents: string) => {
|
|
454
|
+
if (err) {
|
|
455
|
+
reject(err)
|
|
456
|
+
}
|
|
457
|
+
resolve(contents)
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
async benchParse (contents: string, iterations: number, print: boolean): Promise<void> {
|
|
463
|
+
return new Promise((resolve, reject) => {
|
|
464
|
+
const toParse = new StringDuplex(contents.repeat(iterations), false)
|
|
465
|
+
const startsAt: Date = new Date()
|
|
466
|
+
let i = 0
|
|
467
|
+
const config = this.config
|
|
468
|
+
const buffer = config.sessionContainer.resolve<ElasticBuffer>(DITokens.ParseBuffer)
|
|
469
|
+
const asciiParser: MsgParser = new AsciiParser(config, toParse.readable, buffer)
|
|
470
|
+
function printer (msgType: string, v: MsgView): void {
|
|
471
|
+
const elapsed: number = new Date().getTime() - startsAt.getTime()
|
|
472
|
+
console.log(contents)
|
|
473
|
+
console.log(v.toString())
|
|
474
|
+
console.log(`[${msgType}]: iterations = ${iterations}, fields = ${v?.structure?.tags.nextTagPos}, length = ${contents.length} chars, elapsed ms ${elapsed}, ${(elapsed / iterations) * 1000} micros per msg`)
|
|
475
|
+
}
|
|
476
|
+
asciiParser.on('msg', (msgType: string, v: MsgView) => {
|
|
477
|
+
++i
|
|
478
|
+
if (i === iterations) {
|
|
479
|
+
if (print) {
|
|
480
|
+
printer(msgType, v)
|
|
481
|
+
}
|
|
482
|
+
resolve()
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
asciiParser.on('error', e => reject(e))
|
|
486
|
+
})
|
|
487
|
+
}
|
|
488
|
+
|
|
451
489
|
private async benchmark (repeats: number): Promise<any> {
|
|
452
490
|
if (!argv.fix) {
|
|
453
491
|
console.log('provide a path to fix file i.e. --fix=data/examples/execution-report/fix.txt')
|
|
454
492
|
return
|
|
455
493
|
}
|
|
456
|
-
return new Promise<any>((
|
|
494
|
+
return await new Promise<any>((resolve, reject) => {
|
|
457
495
|
const fix: string = this.norm(argv.fix)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
let i = 0
|
|
466
|
-
const config = this.config
|
|
467
|
-
const buffer = config.sessionContainer.resolve<ElasticBuffer>(DITokens.ParseBuffer)
|
|
468
|
-
const asciiParser: MsgParser = new AsciiParser(config, toParse.readable, buffer)
|
|
469
|
-
asciiParser.on('msg', (msgType: string, v: MsgView) => {
|
|
470
|
-
++i
|
|
471
|
-
if (i === repeats) {
|
|
472
|
-
const elapsed: number = new Date().getTime() - startsAt.getTime()
|
|
473
|
-
console.log(contents)
|
|
474
|
-
console.log(v.toString())
|
|
475
|
-
console.log(`[${msgType}]: repeats = ${repeats}, fields = ${v.structure.tags.nextTagPos}, length = ${contents.length} chars, elapsed ms ${elapsed}, ${(elapsed / repeats) * 1000} micros per msg`)
|
|
476
|
-
accept(true)
|
|
477
|
-
}
|
|
496
|
+
this.promisedRead(fix)
|
|
497
|
+
.then(contents => {
|
|
498
|
+
this.benchParse(contents, repeats, true)
|
|
499
|
+
.then((a: any) => resolve(a))
|
|
500
|
+
.catch(e => reject(e))
|
|
501
|
+
}).catch(e => {
|
|
502
|
+
reject(e)
|
|
478
503
|
})
|
|
479
|
-
})
|
|
480
504
|
})
|
|
481
505
|
}
|
|
482
506
|
|
|
@@ -521,23 +545,23 @@ function showHelp (): void {
|
|
|
521
545
|
console.log()
|
|
522
546
|
|
|
523
547
|
console.log('token format use fix repo dictionary')
|
|
524
|
-
console.log('jsfix-cmd --dict=data/fix_repo/FIX.4.4/Base --fix=data/examples/quickfix/FIX.4.4/execution-report/fix.txt'
|
|
525
|
-
|
|
548
|
+
console.log('jsfix-cmd --dict=data/fix_repo/FIX.4.4/Base --fix=data/examples/quickfix/FIX.4.4/execution-report/fix.txt' +
|
|
549
|
+
' --delimiter="|" --tokens')
|
|
526
550
|
console.log()
|
|
527
551
|
|
|
528
552
|
console.log('structure format i.e. show locations of components etc.')
|
|
529
553
|
console.log('jsfix-cmd --dict=data/FIX44.xml --fix=data/examples/FIX.4.4/quickfix/execution-report/fix.txt' +
|
|
530
|
-
|
|
554
|
+
' --delimiter="|" --tokens --structures')
|
|
531
555
|
console.log()
|
|
532
556
|
|
|
533
557
|
console.log('full JS object in JSON format.')
|
|
534
558
|
console.log('jsfix-cmd --dict=data/FIX44.xml --fix=data/examples/FIX.4.4/quickfix/execution-report/fix.txt' +
|
|
535
|
-
|
|
559
|
+
' --delimiter="|" --tokens --objects')
|
|
536
560
|
console.log()
|
|
537
561
|
|
|
538
562
|
console.log('full JS object in JSON format - filter only type messages.')
|
|
539
563
|
console.log('jsfix-cmd --dict=data/FIX44.xml --fix=data/examples/FIX.4.4/quickfix/execution-report/fix.txt' +
|
|
540
|
-
|
|
564
|
+
' --delimiter="|" --tokens --type=8 --objects')
|
|
541
565
|
console.log()
|
|
542
566
|
|
|
543
567
|
console.log('timing stats and message counts. Structured parsing of all messages.')
|
|
@@ -546,7 +570,7 @@ function showHelp (): void {
|
|
|
546
570
|
|
|
547
571
|
console.log('encode a json object to fix format')
|
|
548
572
|
console.log('jsfix-cmd --json=data/examples/FIX.4.4/quickfix/execution-report/object.json' +
|
|
549
|
-
|
|
573
|
+
' --session=data/session.json --type=8 --delimiter="|"')
|
|
550
574
|
console.log()
|
|
551
575
|
|
|
552
576
|
console.log('display field definition')
|
|
@@ -14,19 +14,24 @@ export class RuntimeFactory {
|
|
|
14
14
|
@inject(DITokens.ISessionMsgFactory) public readonly msgFactory: ISessionMsgFactory,
|
|
15
15
|
@inject(DITokens.ISessionDescription) public readonly description: ISessionDescription) {}
|
|
16
16
|
|
|
17
|
-
makeConfig (): Promise<IJsFixConfig> {
|
|
18
|
-
const description = this.description
|
|
19
|
-
return new Promise<IJsFixConfig>((
|
|
17
|
+
async makeConfig (): Promise<IJsFixConfig> {
|
|
18
|
+
const description = this.description || null
|
|
19
|
+
return await new Promise<IJsFixConfig>((resolve, reject) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
if (!description) reject(new Error('no description object'))
|
|
22
|
+
const path = description.application?.dictionary ?? 'na'
|
|
23
|
+
if (!path) reject(new Error('no dictionary in application object'))
|
|
24
|
+
const type = description.application?.type ?? null
|
|
25
|
+
if (!type) reject(new Error('no application type in application object'))
|
|
26
|
+
this.definitionFactory.getDefinitions(path,
|
|
22
27
|
(t: string) => {
|
|
23
|
-
return this.logFactory.logger(`${
|
|
28
|
+
return this.logFactory.logger(`${type}.${t}`)
|
|
24
29
|
}).then((definitions: FixDefinitions) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const config = new JsFixConfig(this.msgFactory, definitions, description, AsciiChars.Soh, this.logFactory)
|
|
31
|
+
resolve(config)
|
|
32
|
+
}).catch(e => {
|
|
33
|
+
reject(e)
|
|
34
|
+
})
|
|
30
35
|
} catch (e) {
|
|
31
36
|
reject(e)
|
|
32
37
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { container, DependencyContainer } from 'tsyringe'
|
|
2
2
|
import { DefinitionFactory } from '../util'
|
|
3
|
-
import { IJsFixConfig, JsFixWinstonLogFactory, WinstonLogger } from '../config'
|
|
3
|
+
import { IJsFixConfig, JsFixLoggerFactory, JsFixWinstonLogFactory, WinstonLogger } from '../config'
|
|
4
4
|
import { DITokens } from './di-tokens'
|
|
5
5
|
import { RuntimeFactory } from './make-config'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
TcpAcceptorListener, RecoveringTcpInitiator,
|
|
9
|
+
TcpInitiatorConnector, TcpInitiator
|
|
10
|
+
} from '../transport/tcp'
|
|
9
11
|
import { HttpInitiator, HttpAcceptorListener, HttpJsonSampleAdapter } from '../transport/http'
|
|
10
12
|
import { ISessionMsgFactory, MsgTransmitter, ISessionDescription } from '../transport'
|
|
11
13
|
import { AsciiMsgTransmitter } from '../transport/ascii/ascii-msg-transmitter'
|
|
@@ -19,14 +21,20 @@ import { FixEntity } from '../transport/fix-entity'
|
|
|
19
21
|
import { IHttpAdapter } from '../transport/http/http-adapter'
|
|
20
22
|
|
|
21
23
|
export class SessionContainer {
|
|
22
|
-
|
|
23
24
|
public reset (): void {
|
|
24
25
|
container.reset()
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
public registerGlobal (
|
|
28
|
+
public registerGlobal (loggerFactory?: JsFixLoggerFactory): void
|
|
29
|
+
public registerGlobal (level: string): void
|
|
30
|
+
public registerGlobal (levelOrLoggerFactory: string | JsFixLoggerFactory = 'info'): void {
|
|
28
31
|
container.registerInstance(DefinitionFactory, new DefinitionFactory())
|
|
29
|
-
|
|
32
|
+
let lf: JsFixLoggerFactory
|
|
33
|
+
if (typeof levelOrLoggerFactory === 'string') {
|
|
34
|
+
lf = new JsFixWinstonLogFactory(WinstonLogger.consoleOptions(levelOrLoggerFactory))
|
|
35
|
+
} else {
|
|
36
|
+
lf = levelOrLoggerFactory
|
|
37
|
+
}
|
|
30
38
|
container.registerInstance(DITokens.JsFixLoggerFactory, lf)
|
|
31
39
|
container.register<RuntimeFactory>(RuntimeFactory, {
|
|
32
40
|
useClass: RuntimeFactory
|
|
@@ -38,9 +46,9 @@ export class SessionContainer {
|
|
|
38
46
|
|
|
39
47
|
protected makeSessionFactory (description: ISessionDescription): ISessionMsgFactory {
|
|
40
48
|
const fixml = !this.isAscii(description)
|
|
41
|
-
return fixml
|
|
42
|
-
new FixmlSessionMsgFactory(description)
|
|
43
|
-
new AsciiSessionMsgFactory(description)
|
|
49
|
+
return fixml
|
|
50
|
+
? new FixmlSessionMsgFactory(description)
|
|
51
|
+
: new AsciiSessionMsgFactory(description)
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
public newChild (description: ISessionDescription): DependencyContainer {
|
|
@@ -51,8 +59,8 @@ export class SessionContainer {
|
|
|
51
59
|
return sessionContainer
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
public makeSystem (description: ISessionDescription): Promise<DependencyContainer> {
|
|
55
|
-
return new Promise<DependencyContainer>((resolve, reject) => {
|
|
62
|
+
public async makeSystem (description: ISessionDescription): Promise<DependencyContainer> {
|
|
63
|
+
return await new Promise<DependencyContainer>((resolve, reject) => {
|
|
56
64
|
const sessionContainer = this.newChild(description)
|
|
57
65
|
const factory = sessionContainer.resolve<RuntimeFactory>(RuntimeFactory)
|
|
58
66
|
factory.makeConfig().then((c: IJsFixConfig) => {
|
|
@@ -65,14 +73,14 @@ export class SessionContainer {
|
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
public isAscii (description: ISessionDescription): boolean {
|
|
68
|
-
return description.application
|
|
76
|
+
return description.application?.protocol === 'ascii'
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
public isInitiator (description: ISessionDescription): boolean {
|
|
72
|
-
return description.application
|
|
80
|
+
return description.application?.type === 'initiator'
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
public asAscii (description: ISessionDescription, sessionContainer: DependencyContainer) {
|
|
83
|
+
public asAscii (description: ISessionDescription, sessionContainer: DependencyContainer): void {
|
|
76
84
|
sessionContainer.register<MsgTransmitter>(DITokens.MsgTransmitter, {
|
|
77
85
|
useClass: AsciiMsgTransmitter
|
|
78
86
|
})
|
|
@@ -105,7 +113,7 @@ export class SessionContainer {
|
|
|
105
113
|
sessionContainer.register<TcpInitiatorConnector>(TcpInitiatorConnector, {
|
|
106
114
|
useClass: TcpInitiatorConnector
|
|
107
115
|
})
|
|
108
|
-
if (description.application
|
|
116
|
+
if (description.application?.resilient) {
|
|
109
117
|
sessionContainer.register<FixEntity>(DITokens.FixEntity, {
|
|
110
118
|
useClass: RecoveringTcpInitiator
|
|
111
119
|
})
|
|
@@ -121,7 +129,7 @@ export class SessionContainer {
|
|
|
121
129
|
}
|
|
122
130
|
}
|
|
123
131
|
|
|
124
|
-
public asFixml (description: ISessionDescription, sessionContainer: DependencyContainer) {
|
|
132
|
+
public asFixml (description: ISessionDescription, sessionContainer: DependencyContainer): void {
|
|
125
133
|
sessionContainer.register<MsgTransmitter>(DITokens.MsgTransmitter, {
|
|
126
134
|
useClass: FixmlMsgTransmitter
|
|
127
135
|
})
|
|
@@ -157,7 +165,7 @@ export class SessionContainer {
|
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
|
|
160
|
-
protected asciiConstants (c: IJsFixConfig, sessionContainer: DependencyContainer) {
|
|
168
|
+
protected asciiConstants (c: IJsFixConfig, sessionContainer: DependencyContainer): void {
|
|
161
169
|
sessionContainer.register(DITokens.delimiter, {
|
|
162
170
|
useValue: c.delimiter
|
|
163
171
|
})
|
|
@@ -166,7 +174,7 @@ export class SessionContainer {
|
|
|
166
174
|
})
|
|
167
175
|
}
|
|
168
176
|
|
|
169
|
-
public registerSession (c: IJsFixConfig, sessionContainer: DependencyContainer) {
|
|
177
|
+
public registerSession (c: IJsFixConfig, sessionContainer: DependencyContainer): void {
|
|
170
178
|
if (this.isAscii(c.description)) {
|
|
171
179
|
this.asAscii(c.description, sessionContainer)
|
|
172
180
|
this.asciiConstants(c, sessionContainer)
|
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
import * as path from 'path'
|
|
2
|
-
import { IJsFixConfig, IJsFixLogger, JsFixWinstonLogFactory, WinstonLogger } from '../config'
|
|
2
|
+
import { IJsFixConfig, IJsFixLogger, JsFixLoggerFactory, JsFixWinstonLogFactory, WinstonLogger } from '../config'
|
|
3
3
|
import { ISessionDescription, FixEntity, FixSession } from '../transport'
|
|
4
4
|
import { DependencyContainer } from 'tsyringe'
|
|
5
5
|
import { EngineFactory } from './engine-factory'
|
|
6
6
|
import { SessionContainer } from './session-container'
|
|
7
7
|
import { DITokens } from './di-tokens'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const defaultLoggerFactory = new JsFixWinstonLogFactory(WinstonLogger.consoleOptions('info'))
|
|
10
10
|
|
|
11
11
|
export abstract class SessionLauncher {
|
|
12
12
|
public root: string = '../../'
|
|
13
13
|
protected readonly logger: IJsFixLogger
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
public readonly initiatorConfig: ISessionDescription
|
|
15
|
+
public readonly acceptorConfig: ISessionDescription | null
|
|
16
|
+
protected constructor (initiatorConfig: string | ISessionDescription,
|
|
17
|
+
acceptorConfig: string | ISessionDescription | null = null,
|
|
18
|
+
private readonly loggerFactory: JsFixLoggerFactory = defaultLoggerFactory) {
|
|
19
|
+
this.logger = this.loggerFactory.logger('launcher')
|
|
20
|
+
this.initiatorConfig = this.loadConfig(initiatorConfig)
|
|
21
|
+
this.acceptorConfig = acceptorConfig ? this.loadConfig(acceptorConfig) : null
|
|
17
22
|
}
|
|
23
|
+
|
|
18
24
|
protected sessionContainer: SessionContainer = new SessionContainer()
|
|
19
25
|
|
|
20
|
-
private empty (): Promise<any> {
|
|
21
|
-
return new Promise((resolve,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
private async empty (): Promise<any> {
|
|
27
|
+
return await new Promise((resolve, reject) => {
|
|
28
|
+
try {
|
|
29
|
+
setImmediate(() => {
|
|
30
|
+
this.logger.info('resolving an empty promise')
|
|
31
|
+
resolve(null)
|
|
32
|
+
})
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e)
|
|
35
|
+
}
|
|
26
36
|
})
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
protected getAcceptor (sessionContainer: DependencyContainer): Promise<any> {
|
|
39
|
+
protected async getAcceptor (sessionContainer: DependencyContainer): Promise<any> {
|
|
30
40
|
if (sessionContainer.isRegistered<FixEntity>(DITokens.FixEntity)) {
|
|
31
41
|
const entity = sessionContainer.resolve<FixEntity>(DITokens.FixEntity)
|
|
32
42
|
return entity.start()
|
|
@@ -35,7 +45,7 @@ export abstract class SessionLauncher {
|
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
47
|
|
|
38
|
-
protected getInitiator (sessionContainer: DependencyContainer): Promise<any> {
|
|
48
|
+
protected async getInitiator (sessionContainer: DependencyContainer): Promise<any> {
|
|
39
49
|
if (sessionContainer.isRegistered<FixEntity>(DITokens.FixEntity)) {
|
|
40
50
|
const entity = sessionContainer.resolve<FixEntity>(DITokens.FixEntity)
|
|
41
51
|
return entity.start()
|
|
@@ -44,17 +54,17 @@ export abstract class SessionLauncher {
|
|
|
44
54
|
}
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
protected makeFactory (config: IJsFixConfig): EngineFactory {
|
|
57
|
+
protected makeFactory (config: IJsFixConfig): EngineFactory | null {
|
|
48
58
|
return null
|
|
49
59
|
}
|
|
50
60
|
|
|
51
|
-
public run () {
|
|
52
|
-
return new Promise<any>((
|
|
61
|
+
public async run (): Promise<boolean> {
|
|
62
|
+
return await new Promise<any>((resolve, reject) => {
|
|
53
63
|
const logger = this.logger
|
|
54
64
|
logger.info('launching ..')
|
|
55
65
|
this.setup().then(() => {
|
|
56
66
|
logger.info('.. done')
|
|
57
|
-
|
|
67
|
+
resolve(true)
|
|
58
68
|
}).catch((e: Error) => {
|
|
59
69
|
logger.error(e)
|
|
60
70
|
reject(e)
|
|
@@ -62,7 +72,7 @@ export abstract class SessionLauncher {
|
|
|
62
72
|
})
|
|
63
73
|
}
|
|
64
74
|
|
|
65
|
-
public exec () {
|
|
75
|
+
public exec (): void {
|
|
66
76
|
this.run().then(() => {
|
|
67
77
|
console.log('finished.')
|
|
68
78
|
}).catch(e => {
|
|
@@ -82,9 +92,11 @@ export abstract class SessionLauncher {
|
|
|
82
92
|
this.logger.info('bypass register via DI')
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
private makeSystem (description: ISessionDescription): Promise<DependencyContainer> {
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
private async makeSystem (description: ISessionDescription): Promise<DependencyContainer> {
|
|
96
|
+
const name = description.application?.name ?? 'na'
|
|
97
|
+
const protocol = description.application?.protocol ?? 'ascii'
|
|
98
|
+
this.logger.info(`creating app ${name} [protocol ${protocol}]`)
|
|
99
|
+
return await this.sessionContainer.makeSystem(description)
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
private register (container: DependencyContainer): void {
|
|
@@ -102,26 +114,42 @@ export abstract class SessionLauncher {
|
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
private async makeClient (): Promise<any> {
|
|
105
|
-
const
|
|
106
|
-
const sessionContainer = await this.makeSystem(description)
|
|
117
|
+
const sessionContainer = await this.makeSystem(this.initiatorConfig)
|
|
107
118
|
this.register(sessionContainer)
|
|
108
119
|
this.logger.info('create initiator')
|
|
109
|
-
return this.getInitiator(sessionContainer)
|
|
120
|
+
return await this.getInitiator(sessionContainer)
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
private async makeServer (): Promise<any> {
|
|
113
|
-
|
|
114
|
-
const sessionContainer = await this.makeSystem(
|
|
124
|
+
if (!this.acceptorConfig) return
|
|
125
|
+
const sessionContainer = await this.makeSystem(this.acceptorConfig)
|
|
115
126
|
this.register(sessionContainer)
|
|
116
127
|
this.logger.info('create acceptor')
|
|
117
|
-
return this.getAcceptor(sessionContainer)
|
|
128
|
+
return await this.getAcceptor(sessionContainer)
|
|
118
129
|
}
|
|
119
130
|
|
|
120
|
-
|
|
121
|
-
this.sessionContainer.registerGlobal()
|
|
131
|
+
async serverOrEmpty (): Promise<any> {
|
|
122
132
|
const server = this.acceptorConfig ? this.makeServer() : this.empty()
|
|
133
|
+
return server
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async clientOrEmpty (): Promise<any> {
|
|
123
137
|
const client = this.initiatorConfig ? this.makeClient() : this.empty()
|
|
138
|
+
return client
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private async setup (): Promise<any> {
|
|
142
|
+
this.sessionContainer.registerGlobal(this.loggerFactory)
|
|
143
|
+
const server = this.serverOrEmpty()
|
|
144
|
+
const client = this.clientOrEmpty()
|
|
124
145
|
this.logger.info('launching ....')
|
|
125
|
-
return Promise.all([server, client])
|
|
146
|
+
return await Promise.all([server, client])
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private loadConfig (config: string | ISessionDescription): ISessionDescription {
|
|
150
|
+
if (typeof config === 'string') {
|
|
151
|
+
return require(path.join(this.root, config))
|
|
152
|
+
}
|
|
153
|
+
return config
|
|
126
154
|
}
|
|
127
155
|
}
|