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.
- package/.eslintrc.js +6 -0
- package/appveyor.yml +4 -0
- package/dist/buffer/{ascii-chars.d.ts → ascii/ascii-chars.d.ts} +0 -0
- package/dist/buffer/{ascii-chars.js → ascii/ascii-chars.js} +0 -0
- package/dist/buffer/ascii/ascii-chars.js.map +1 -0
- package/dist/buffer/ascii/ascii-encoder.d.ts +4 -2
- package/dist/buffer/ascii/ascii-encoder.js +54 -32
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser-state.d.ts +3 -10
- package/dist/buffer/ascii/ascii-parser-state.js +37 -25
- package/dist/buffer/ascii/ascii-parser-state.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser.d.ts +7 -7
- package/dist/buffer/ascii/ascii-parser.js +50 -24
- package/dist/buffer/ascii/ascii-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.d.ts +2 -2
- package/dist/buffer/ascii/ascii-segment-parser.js +34 -13
- package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +2 -4
- package/dist/buffer/ascii/ascii-view.js +11 -15
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/ascii/index.d.ts +1 -0
- package/dist/buffer/ascii/index.js +1 -0
- package/dist/buffer/ascii/index.js.map +1 -1
- package/dist/buffer/ascii/parse-state.d.ts +8 -0
- package/dist/buffer/ascii/parse-state.js +13 -0
- package/dist/buffer/ascii/parse-state.js.map +1 -0
- package/dist/buffer/ascii/time-formatter.js +1 -1
- package/dist/buffer/ascii/time-formatter.js.map +1 -1
- package/dist/buffer/elastic-buffer.js +29 -8
- package/dist/buffer/elastic-buffer.js.map +1 -1
- package/dist/buffer/encode-proxy.d.ts +1 -1
- package/dist/buffer/encode-proxy.js +16 -17
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.d.ts +2 -1
- package/dist/buffer/fixml/fixml-encoder.js +43 -20
- package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
- package/dist/buffer/fixml/fixml-parser.js +47 -24
- package/dist/buffer/fixml/fixml-parser.js.map +1 -1
- package/dist/buffer/fixml/fixml-view.d.ts +2 -4
- package/dist/buffer/fixml/fixml-view.js +13 -16
- package/dist/buffer/fixml/fixml-view.js.map +1 -1
- package/dist/buffer/fixml/populated-attributes.d.ts +5 -0
- package/dist/buffer/fixml/populated-attributes.js +3 -0
- package/dist/buffer/fixml/populated-attributes.js.map +1 -0
- package/dist/buffer/index.d.ts +4 -8
- package/dist/buffer/index.js +4 -8
- package/dist/buffer/index.js.map +1 -1
- package/dist/buffer/msg-encoder.d.ts +2 -1
- package/dist/buffer/msg-encoder.js.map +1 -1
- package/dist/buffer/msg-view.d.ts +3 -5
- package/dist/buffer/msg-view.js +8 -5
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/buffer/{segment-description.d.ts → segment/segment-description.d.ts} +3 -10
- package/dist/buffer/{segment-description.js → segment/segment-description.js} +5 -13
- package/dist/buffer/segment/segment-description.js.map +1 -0
- package/dist/buffer/{segment-summary.d.ts → segment/segment-summary.d.ts} +0 -0
- package/dist/buffer/{segment-summary.js → segment/segment-summary.js} +0 -0
- package/dist/buffer/segment/segment-summary.js.map +1 -0
- package/dist/buffer/segment/segment-type.d.ts +8 -0
- package/dist/buffer/segment/segment-type.js +13 -0
- package/dist/buffer/segment/segment-type.js.map +1 -0
- package/dist/buffer/structure.d.ts +3 -3
- package/dist/buffer/structure.js +1 -1
- package/dist/buffer/structure.js.map +1 -1
- package/dist/buffer/{tag-pos.d.ts → tag/tag-pos.d.ts} +0 -0
- package/dist/buffer/{tag-pos.js → tag/tag-pos.js} +0 -0
- package/dist/buffer/tag/tag-pos.js.map +1 -0
- package/dist/buffer/tag/tag-type.d.ts +13 -0
- package/dist/buffer/tag/tag-type.js +18 -0
- package/dist/buffer/tag/tag-type.js.map +1 -0
- package/dist/buffer/{tags.d.ts → tag/tags.d.ts} +3 -14
- package/dist/buffer/{tags.js → tag/tags.js} +24 -37
- package/dist/buffer/tag/tags.js.map +1 -0
- package/dist/config/get-js-fx-logger.d.ts +4 -0
- package/dist/config/get-js-fx-logger.js +3 -0
- package/dist/config/get-js-fx-logger.js.map +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/js-fix-config.d.ts +4 -1
- package/dist/config/js-fix-config.js +3 -3
- package/dist/config/js-fix-config.js.map +1 -1
- package/dist/config/js-fix-logger.d.ts +0 -3
- package/dist/config/js-fix-logger.js.map +1 -1
- package/dist/dict-parser.js +28 -23
- package/dist/dict-parser.js.map +1 -1
- package/dist/dictionary/compiler/compiler-type.js +7 -7
- package/dist/dictionary/compiler/compiler-type.js.map +1 -1
- package/dist/dictionary/compiler/enum-compiler.d.ts +1 -0
- package/dist/dictionary/compiler/enum-compiler.js +11 -1
- package/dist/dictionary/compiler/enum-compiler.js.map +1 -1
- package/dist/dictionary/compiler/msg-compiler.js +8 -6
- package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
- package/dist/dictionary/contained/contained-component-field.js +2 -1
- package/dist/dictionary/contained/contained-component-field.js.map +1 -1
- package/dist/dictionary/contained/contained-field-dispatch.d.ts +1 -14
- package/dist/dictionary/contained/contained-field-dispatch.js +4 -4
- package/dist/dictionary/contained/contained-field-dispatch.js.map +1 -1
- package/dist/dictionary/contained/contained-field-dispatcher.d.ts +14 -0
- package/dist/dictionary/contained/contained-field-dispatcher.js +3 -0
- package/dist/dictionary/contained/contained-field-dispatcher.js.map +1 -0
- package/dist/dictionary/contained/contained-field-set.d.ts +1 -1
- package/dist/dictionary/contained/contained-field-set.js +12 -11
- package/dist/dictionary/contained/contained-field-set.js.map +1 -1
- package/dist/dictionary/contained/contained-field-type.d.ts +5 -0
- package/dist/dictionary/contained/contained-field-type.js +10 -0
- package/dist/dictionary/contained/contained-field-type.js.map +1 -0
- package/dist/dictionary/contained/contained-field.d.ts +1 -5
- package/dist/dictionary/contained/contained-field.js +1 -7
- package/dist/dictionary/contained/contained-field.js.map +1 -1
- package/dist/dictionary/contained/contained-group-field.js +2 -1
- package/dist/dictionary/contained/contained-group-field.js.map +1 -1
- package/dist/dictionary/contained/contained-simple-field.js +2 -1
- package/dist/dictionary/contained/contained-simple-field.js.map +1 -1
- package/dist/dictionary/{fields-dispatch.d.ts → contained/field-dispatcher.d.ts} +3 -2
- package/dist/dictionary/contained/field-dispatcher.js +3 -0
- package/dist/dictionary/contained/field-dispatcher.js.map +1 -0
- package/dist/dictionary/contained/fields-dispatch.d.ts +6 -0
- package/dist/dictionary/contained/fields-dispatch.js +42 -0
- package/dist/dictionary/contained/fields-dispatch.js.map +1 -0
- package/dist/dictionary/contained/index.d.ts +2 -0
- package/dist/dictionary/contained/index.js +2 -0
- package/dist/dictionary/contained/index.js.map +1 -1
- package/dist/dictionary/contained-set-type.d.ts +5 -0
- package/dist/dictionary/contained-set-type.js +10 -0
- package/dist/dictionary/contained-set-type.js.map +1 -0
- package/dist/dictionary/definition/component-field-definition.js +2 -2
- package/dist/dictionary/definition/component-field-definition.js.map +1 -1
- package/dist/dictionary/definition/fix-definitions.d.ts +2 -1
- package/dist/dictionary/definition/fix-definitions.js.map +1 -1
- package/dist/dictionary/definition/group-field-definition.js +2 -2
- package/dist/dictionary/definition/group-field-definition.js.map +1 -1
- package/dist/dictionary/definition/index.d.ts +0 -1
- package/dist/dictionary/definition/index.js +0 -1
- package/dist/dictionary/definition/index.js.map +1 -1
- package/dist/dictionary/definition/message-definition.js +2 -2
- package/dist/dictionary/definition/message-definition.js.map +1 -1
- package/dist/dictionary/definition/simple-field-definition.d.ts +1 -1
- package/dist/dictionary/definition/simple-field-definition.js +5 -4
- package/dist/dictionary/definition/simple-field-definition.js.map +1 -1
- package/dist/dictionary/dict-primitive.d.ts +0 -11
- package/dist/dictionary/dict-primitive.js +0 -7
- package/dist/dictionary/dict-primitive.js.map +1 -1
- package/dist/dictionary/fix-definition-source.d.ts +6 -0
- package/dist/dictionary/fix-definition-source.js +11 -0
- package/dist/dictionary/fix-definition-source.js.map +1 -0
- package/dist/dictionary/fix-versions.d.ts +0 -9
- package/dist/dictionary/fix-versions.js +1 -39
- package/dist/dictionary/fix-versions.js.map +1 -1
- package/dist/dictionary/index.d.ts +1 -5
- package/dist/dictionary/index.js +1 -5
- package/dist/dictionary/index.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/abbreviations-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/abbreviations-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/abbreviations-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/base-parser.d.ts +2 -4
- package/dist/dictionary/parser/fix-repository/base-parser.js +1 -2
- package/dist/dictionary/parser/fix-repository/base-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/components-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/components-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/components-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/data-types-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/data-types-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/data-types-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/enums-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/enums-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/enums-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/fields-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/fields-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/fields-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/messages-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/messages-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/messages-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/msg-contents-parser.d.ts +1 -3
- package/dist/dictionary/parser/fix-repository/msg-contents-parser.js +2 -3
- package/dist/dictionary/parser/fix-repository/msg-contents-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository-abbreviation.d.ts +5 -0
- package/dist/dictionary/parser/fix-repository/repository-abbreviation.js +3 -0
- package/dist/dictionary/parser/fix-repository/repository-abbreviation.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-component.d.ts +10 -0
- package/dist/dictionary/parser/fix-repository/repository-component.js +3 -0
- package/dist/dictionary/parser/fix-repository/repository-component.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-data-type.d.ts +6 -0
- package/dist/dictionary/parser/fix-repository/repository-data-type.js +3 -0
- package/dist/dictionary/parser/fix-repository/repository-data-type.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-enum.d.ts +7 -0
- package/dist/{transport/fix-msg-factory.js → dictionary/parser/fix-repository/repository-enum.js} +1 -1
- package/dist/dictionary/parser/fix-repository/repository-enum.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-field.d.ts +11 -0
- package/dist/dictionary/parser/fix-repository/repository-field.js +3 -0
- package/dist/dictionary/parser/fix-repository/repository-field.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-message.d.ts +11 -0
- package/dist/{transport/make-fixl-session.js → dictionary/parser/fix-repository/repository-message.js} +1 -1
- package/dist/dictionary/parser/fix-repository/repository-message.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-msg-content.d.ts +9 -0
- package/dist/dictionary/parser/fix-repository/repository-msg-content.js +3 -0
- package/dist/dictionary/parser/fix-repository/repository-msg-content.js.map +1 -0
- package/dist/dictionary/parser/fix-repository/repository-type.d.ts +0 -53
- package/dist/dictionary/parser/fix-repository/repository-type.js +0 -2
- package/dist/dictionary/parser/fix-repository/repository-type.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js +10 -10
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository.d.ts +12 -1
- package/dist/dictionary/parser/fix-repository/repository.js +50 -28
- 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.map +1 -1
- package/dist/dictionary/parser/fixml/fields-parser.d.ts +1 -1
- 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.js.map +1 -1
- package/dist/dictionary/parser/fixml/xsd-parser.d.ts +1 -1
- package/dist/dictionary/parser/fixml/xsd-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-definition-parser.d.ts +4 -4
- package/dist/dictionary/parser/quickfix/field-definition-parser.js +3 -3
- package/dist/dictionary/parser/quickfix/field-definition-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-set-parser.d.ts +4 -4
- package/dist/dictionary/parser/quickfix/field-set-parser.js +3 -3
- package/dist/dictionary/parser/quickfix/field-set-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/message-parser.d.ts +4 -4
- package/dist/dictionary/parser/quickfix/message-parser.js +3 -3
- package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/node-parser.d.ts +4 -5
- package/dist/dictionary/parser/quickfix/node-parser.js +4 -4
- package/dist/dictionary/parser/quickfix/node-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/parse-state.d.ts +8 -0
- package/dist/dictionary/parser/quickfix/parse-state.js +13 -0
- package/dist/dictionary/parser/quickfix/parse-state.js.map +1 -0
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.d.ts +1 -9
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +28 -35
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/dictionary/sax-node.d.ts +6 -0
- package/dist/{types/FIX4.4/quickfix/set/trailer.js → dictionary/sax-node.js} +1 -1
- package/dist/dictionary/sax-node.js.map +1 -0
- package/dist/dictionary/set-reduce.d.ts +5 -12
- package/dist/dictionary/set-reduce.js +28 -26
- package/dist/dictionary/set-reduce.js.map +1 -1
- package/dist/dictionary/type-dispatcher.d.ts +12 -0
- package/dist/dictionary/type-dispatcher.js +3 -0
- package/dist/dictionary/type-dispatcher.js.map +1 -0
- package/dist/dictionary/version-util.d.ts +4 -0
- package/dist/dictionary/version-util.js +36 -0
- package/dist/dictionary/version-util.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsfix-cmd.d.ts +5 -0
- package/dist/jsfix-cmd.js +28 -21
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/runtime/di-tokens.d.ts +28 -0
- package/dist/runtime/di-tokens.js +33 -0
- package/dist/runtime/di-tokens.js.map +1 -0
- package/dist/runtime/engine-factory.d.ts +4 -0
- package/dist/runtime/engine-factory.js +3 -0
- package/dist/runtime/engine-factory.js.map +1 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +18 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/make-config.d.ts +11 -0
- package/dist/runtime/make-config.js +57 -0
- package/dist/runtime/make-config.js.map +1 -0
- package/dist/runtime/session-container.d.ts +16 -0
- package/dist/runtime/session-container.js +168 -0
- package/dist/runtime/session-container.js.map +1 -0
- package/dist/runtime/session-launcher.d.ts +27 -0
- package/dist/runtime/session-launcher.js +131 -0
- package/dist/runtime/session-launcher.js.map +1 -0
- package/dist/sample/http/oms/app.d.ts +1 -1
- package/dist/sample/http/oms/app.js +16 -14
- package/dist/sample/http/oms/app.js.map +1 -1
- package/dist/sample/http/oms/http-client.js +22 -2
- package/dist/sample/http/oms/http-client.js.map +1 -1
- package/dist/sample/http/oms/http-server.js +21 -2
- package/dist/sample/http/oms/http-server.js.map +1 -1
- package/dist/sample/tcp/qf-md/app.d.ts +1 -1
- package/dist/sample/tcp/qf-md/app.js +11 -11
- package/dist/sample/tcp/qf-md/app.js.map +1 -1
- package/dist/sample/tcp/qf-md/md-client.js +21 -2
- package/dist/sample/tcp/qf-md/md-client.js.map +1 -1
- package/dist/sample/tcp/qf-md/md-server.js +20 -2
- package/dist/sample/tcp/qf-md/md-server.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/app.d.ts +1 -1
- package/dist/sample/tcp/recovering-skeleton/app.js +36 -16
- package/dist/sample/tcp/recovering-skeleton/app.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.d.ts +3 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +30 -8
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.d.ts +1 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js +22 -3
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js +21 -2
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js.map +1 -1
- package/dist/sample/tcp/skeleton/app.d.ts +1 -1
- package/dist/sample/tcp/skeleton/app.js +8 -13
- package/dist/sample/tcp/skeleton/app.js.map +1 -1
- package/dist/sample/tcp/skeleton/skeleton-session.d.ts +1 -1
- package/dist/sample/tcp/skeleton/skeleton-session.js +26 -4
- package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.d.ts +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js +4 -24
- package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/app-launcher.d.ts +6 -0
- package/dist/sample/tcp/trade-capture/app-launcher.js +21 -0
- package/dist/sample/tcp/trade-capture/app-launcher.js.map +1 -0
- package/dist/sample/tcp/trade-capture/app.d.ts +1 -1
- package/dist/sample/tcp/trade-capture/app.js +4 -21
- package/dist/sample/tcp/trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-factory.js +7 -1
- package/dist/sample/tcp/trade-capture/trade-factory.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-resend.d.ts +1 -1
- package/dist/store/fix-msg-ascii-store-resend.js +2 -1
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-memory-store.d.ts +1 -1
- package/dist/store/fix-msg-memory-store.js.map +1 -1
- package/dist/store/fix-msg-store-record.d.ts +2 -0
- package/dist/store/fix-msg-store-record.js +4 -0
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/store/fix-msg-store-state.d.ts +6 -0
- package/dist/store/fix-msg-store-state.js +3 -0
- package/dist/store/fix-msg-store-state.js.map +1 -0
- package/dist/store/fix-msg-store.d.ts +1 -6
- package/dist/store/fix-msg-store.js.map +1 -1
- package/dist/test/ascii/ascii-encoder.test.d.ts +1 -0
- package/dist/test/{ascii-encoder.test.js → ascii/ascii-encoder.test.js} +57 -55
- package/dist/test/ascii/ascii-encoder.test.js.map +1 -0
- package/dist/test/ascii/ascii-parser.test.d.ts +1 -0
- package/dist/test/{ascii-parser.test.js → ascii/ascii-parser.test.js} +33 -52
- package/dist/test/ascii/ascii-parser.test.js.map +1 -0
- package/dist/test/ascii/ascii-segment.test.d.ts +1 -0
- package/dist/test/{ascii-segment.test.js → ascii/ascii-segment.test.js} +20 -41
- package/dist/test/ascii/ascii-segment.test.js.map +1 -0
- package/dist/test/ascii/ascii-store-replay.test.d.ts +1 -0
- package/dist/test/{ascii-store-replay.test.js → ascii/ascii-store-replay.test.js} +14 -43
- package/dist/test/ascii/ascii-store-replay.test.js.map +1 -0
- package/dist/test/ascii/ascii-tag-pos.test.d.ts +1 -0
- package/dist/test/{ascii-tag-pos.test.js → ascii/ascii-tag-pos.test.js} +10 -10
- package/dist/test/ascii/ascii-tag-pos.test.js.map +1 -0
- package/dist/test/ascii/execution-report.test.d.ts +1 -0
- package/dist/test/{execution-report.test.js → ascii/execution-report.test.js} +51 -52
- package/dist/test/ascii/execution-report.test.js.map +1 -0
- package/dist/test/ascii/fix-log-replay.test.d.ts +1 -0
- package/dist/test/{fix-log-replay.test.js → ascii/fix-log-replay.test.js} +8 -6
- package/dist/test/ascii/fix-log-replay.test.js.map +1 -0
- package/dist/test/ascii/fix-repo-dict.test.d.ts +1 -0
- package/dist/test/{fix-repo-dict.test.js → ascii/fix-repo-dict.test.js} +8 -7
- package/dist/test/ascii/fix-repo-dict.test.js.map +1 -0
- package/dist/test/ascii/includes.test.d.ts +1 -0
- package/dist/test/{includes.test.js → ascii/includes.test.js} +3 -2
- package/dist/test/ascii/includes.test.js.map +1 -0
- package/dist/test/ascii/logon.test.d.ts +1 -0
- package/dist/test/{logon.test.js → ascii/logon.test.js} +11 -13
- package/dist/test/ascii/logon.test.js.map +1 -0
- package/dist/test/ascii/memory-store.test.d.ts +1 -0
- package/dist/test/{memory-store.test.js → ascii/memory-store.test.js} +12 -12
- package/dist/test/ascii/memory-store.test.js.map +1 -0
- package/dist/test/ascii/qf-full-msg.test.d.ts +1 -0
- package/dist/test/{qf-full-msg.test.js → ascii/qf-full-msg.test.js} +21 -17
- package/dist/test/ascii/qf-full-msg.test.js.map +1 -0
- package/dist/test/ascii/repo-full-ascii-msg.test.d.ts +1 -0
- package/dist/test/{repo-full-ascii-msg.test.js → ascii/repo-full-ascii-msg.test.js} +20 -16
- package/dist/test/ascii/repo-full-ascii-msg.test.js.map +1 -0
- package/dist/test/ascii/session-state.test.d.ts +1 -0
- package/dist/test/{session-state.test.js → ascii/session-state.test.js} +2 -1
- package/dist/test/ascii/session-state.test.js.map +1 -0
- package/dist/test/ascii/session.test.d.ts +1 -0
- package/dist/test/{session.test.js → ascii/session.test.js} +14 -145
- package/dist/test/ascii/session.test.js.map +1 -0
- package/dist/test/ascii/time-formatter.test.d.ts +1 -0
- package/dist/test/{time-formatter.test.js → ascii/time-formatter.test.js} +4 -2
- package/dist/test/ascii/time-formatter.test.js.map +1 -0
- package/dist/test/ascii/view-decode.test.d.ts +1 -0
- package/dist/test/{view-decode.test.js → ascii/view-decode.test.js} +11 -36
- package/dist/test/ascii/view-decode.test.js.map +1 -0
- package/dist/test/elastic-buffer.test.d.ts +1 -1
- package/dist/test/elastic-buffer.test.js +3 -1
- package/dist/test/elastic-buffer.test.js.map +1 -1
- package/dist/test/encode-proxy.test.d.ts +1 -1
- package/dist/test/encode-proxy.test.js +9 -9
- package/dist/test/encode-proxy.test.js.map +1 -1
- package/dist/test/env/experiment.d.ts +23 -0
- package/dist/test/env/experiment.js +33 -0
- package/dist/test/env/experiment.js.map +1 -0
- package/dist/test/env/parsing-result.d.ts +10 -0
- package/dist/test/env/parsing-result.js +14 -0
- package/dist/test/env/parsing-result.js.map +1 -0
- package/dist/test/env/setup.d.ts +39 -0
- package/dist/test/env/setup.js +98 -0
- package/dist/test/env/setup.js.map +1 -0
- package/dist/test/env/skeleton-runner.d.ts +15 -0
- package/dist/test/env/skeleton-runner.js +108 -0
- package/dist/test/env/skeleton-runner.js.map +1 -0
- package/dist/test/env/test-recovery.d.ts +13 -0
- package/dist/test/env/test-recovery.js +41 -0
- package/dist/test/env/test-recovery.js.map +1 -0
- package/dist/test/{to-views.d.ts → env/to-views.d.ts} +2 -2
- package/dist/test/{to-views.js → env/to-views.js} +8 -7
- package/dist/test/env/to-views.js.map +1 -0
- package/dist/test/fixml/fixml-alloc-parse.test.d.ts +1 -0
- package/dist/test/{fixml-alloc-parse.test.js → fixml/fixml-alloc-parse.test.js} +2 -1
- package/dist/test/fixml/fixml-alloc-parse.test.js.map +1 -0
- package/dist/test/fixml/fixml-mkt-data-fut-parse.test.d.ts +1 -0
- package/dist/test/{fixml-mkt-data-fut-parse.test.js → fixml/fixml-mkt-data-fut-parse.test.js} +2 -1
- package/dist/test/fixml/fixml-mkt-data-fut-parse.test.js.map +1 -0
- package/dist/test/fixml/fixml-mkt-data-settle-parse.test.d.ts +1 -0
- package/dist/test/{fixml-mkt-data-settle-parse.test.js → fixml/fixml-mkt-data-settle-parse.test.js} +2 -1
- package/dist/test/fixml/fixml-mkt-data-settle-parse.test.js.map +1 -0
- package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.d.ts +1 -0
- package/dist/test/{fixml-tc-bi-lateral-parse.test.js → fixml/fixml-tc-bi-lateral-parse.test.js} +2 -1
- package/dist/test/fixml/fixml-tc-bi-lateral-parse.test.js.map +1 -0
- package/dist/test/fixml/repo-full-fixml-msg.test.d.ts +1 -0
- package/dist/test/{repo-full-fixml-msg.test.js → fixml/repo-full-fixml-msg.test.js} +17 -10
- package/dist/test/fixml/repo-full-fixml-msg.test.js.map +1 -0
- package/dist/transport/ascii/ascii-msg-transmitter.js +25 -6
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session-msg-factory.d.ts +2 -2
- package/dist/transport/ascii/ascii-session-msg-factory.js +1 -1
- 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 +26 -23
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/ascii/index.d.ts +0 -1
- package/dist/transport/ascii/index.js +0 -1
- package/dist/transport/ascii/index.js.map +1 -1
- package/dist/transport/duplex/http-duplex.d.ts +1 -1
- package/dist/transport/duplex/http-duplex.js.map +1 -1
- package/dist/transport/duplex/tcp-duplex.js +22 -2
- package/dist/transport/duplex/tcp-duplex.js.map +1 -1
- package/dist/transport/factory/index.d.ts +1 -0
- package/dist/transport/factory/index.js +14 -0
- package/dist/transport/factory/index.js.map +1 -0
- package/dist/transport/{msg-transport.d.ts → factory/msg-transport.d.ts} +4 -4
- package/dist/transport/factory/msg-transport.js +61 -0
- package/dist/transport/factory/msg-transport.js.map +1 -0
- package/dist/transport/fix-acceptor.d.ts +2 -2
- package/dist/transport/fix-acceptor.js.map +1 -1
- package/dist/transport/fix-entity.d.ts +8 -0
- package/dist/transport/fix-entity.js +12 -0
- package/dist/transport/fix-entity.js.map +1 -0
- 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.js +23 -5
- package/dist/transport/fixml/fixml-msg-transmitter.js.map +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.d.ts +2 -2
- package/dist/transport/fixml/fixml-session-msg-factory.js +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -1
- package/dist/transport/fixml/fixml-session.d.ts +1 -1
- package/dist/transport/fixml/fixml-session.js +3 -3
- package/dist/transport/fixml/fixml-session.js.map +1 -1
- package/dist/transport/fixml/index.d.ts +0 -2
- package/dist/transport/fixml/index.js +0 -2
- package/dist/transport/fixml/index.js.map +1 -1
- package/dist/transport/http/html-options.d.ts +8 -0
- package/dist/{store/replay-record.js → transport/http/html-options.js} +1 -1
- package/dist/transport/http/html-options.js.map +1 -0
- package/dist/transport/http/html-route.d.ts +5 -0
- package/dist/{types/FIX4.4/quickfix/set/header.js → transport/http/html-route.js} +1 -1
- package/dist/transport/http/html-route.js.map +1 -0
- package/dist/transport/http/http-acceptor-listener.d.ts +7 -0
- package/dist/transport/http/http-acceptor-listener.js +68 -0
- package/dist/transport/http/http-acceptor-listener.js.map +1 -0
- package/dist/transport/http/http-acceptor.js +24 -5
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/http/http-adapter.d.ts +7 -0
- package/dist/transport/http/http-adapter.js +3 -0
- package/dist/transport/http/http-adapter.js.map +1 -0
- package/dist/transport/http/http-initiator.d.ts +9 -3
- package/dist/transport/http/http-initiator.js +57 -26
- package/dist/transport/http/http-initiator.js.map +1 -1
- package/dist/transport/http/http-json-sample-adapter.d.ts +2 -1
- package/dist/transport/http/http-json-sample-adapter.js +21 -2
- package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
- package/dist/transport/http/http-transaction.d.ts +1 -1
- package/dist/transport/http/http-transaction.js.map +1 -1
- package/dist/transport/http/http-transport-description.d.ts +8 -0
- package/dist/transport/http/http-transport-description.js +3 -0
- package/dist/transport/http/http-transport-description.js.map +1 -0
- package/dist/transport/http/index.d.ts +1 -0
- package/dist/transport/http/index.js +1 -0
- package/dist/transport/http/index.js.map +1 -1
- package/dist/transport/index.d.ts +11 -10
- package/dist/transport/index.js +11 -10
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/msg-application.d.ts +12 -0
- package/dist/transport/msg-application.js +3 -0
- package/dist/transport/msg-application.js.map +1 -0
- package/dist/transport/msg-transmitter.d.ts +5 -5
- package/dist/transport/msg-transmitter.js +2 -3
- package/dist/transport/msg-transmitter.js.map +1 -1
- package/dist/transport/{a-session-msg-factory.d.ts → session/a-session-msg-factory.d.ts} +3 -3
- package/dist/transport/{a-session-msg-factory.js → session/a-session-msg-factory.js} +1 -1
- package/dist/transport/session/a-session-msg-factory.js.map +1 -0
- package/dist/transport/session/fix-session-state-args.d.ts +8 -0
- package/dist/transport/session/fix-session-state-args.js +3 -0
- package/dist/transport/session/fix-session-state-args.js.map +1 -0
- package/dist/transport/session/fix-session-state.d.ts +32 -0
- package/dist/transport/{fix-session-state.js → session/fix-session-state.js} +22 -55
- package/dist/transport/session/fix-session-state.js.map +1 -0
- package/dist/transport/{fix-session.d.ts → session/fix-session.d.ts} +6 -5
- package/dist/transport/{fix-session.js → session/fix-session.js} +45 -43
- package/dist/transport/session/fix-session.js.map +1 -0
- package/dist/transport/{make-fixl-session.d.ts → session/make-fix-session.d.ts} +1 -1
- package/dist/transport/session/make-fix-session.js +3 -0
- package/dist/transport/session/make-fix-session.js.map +1 -0
- package/dist/transport/session/session-description.d.ts +17 -0
- package/dist/transport/{session-description.js → session/session-description.js} +0 -0
- package/dist/transport/session/session-description.js.map +1 -0
- package/dist/transport/{fix-msg-factory.d.ts → session/session-msg-factory.d.ts} +2 -2
- package/dist/transport/session/session-msg-factory.js +3 -0
- package/dist/transport/session/session-msg-factory.js.map +1 -0
- package/dist/transport/session/session-state.d.ts +25 -0
- package/dist/transport/session/session-state.js +30 -0
- package/dist/transport/session/session-state.js.map +1 -0
- package/dist/transport/tcp/index.d.ts +3 -2
- package/dist/transport/tcp/index.js +3 -2
- package/dist/transport/tcp/index.js.map +1 -1
- package/dist/transport/tcp/recovering-tcp-initiator.d.ts +7 -9
- package/dist/transport/tcp/recovering-tcp-initiator.js +41 -16
- package/dist/transport/tcp/recovering-tcp-initiator.js.map +1 -1
- package/dist/transport/tcp/tcp-acceptor-listener.d.ts +7 -0
- package/dist/transport/tcp/tcp-acceptor-listener.js +70 -0
- package/dist/transport/tcp/tcp-acceptor-listener.js.map +1 -0
- package/dist/transport/tcp/tcp-acceptor.js +29 -12
- package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator-connector.d.ts +10 -0
- package/dist/transport/tcp/tcp-initiator-connector.js +97 -0
- package/dist/transport/tcp/tcp-initiator-connector.js.map +1 -0
- package/dist/transport/tcp/tcp-initiator.d.ts +2 -2
- package/dist/transport/tcp/tcp-initiator.js +28 -9
- package/dist/transport/tcp/tcp-initiator.js.map +1 -1
- package/dist/transport/tcp/tcp-transport-description.d.ts +6 -0
- package/dist/transport/tcp/tcp-transport-description.js +3 -0
- package/dist/transport/tcp/tcp-transport-description.js.map +1 -0
- package/dist/transport/tcp/tls-options-factory.d.ts +9 -0
- package/dist/transport/tcp/tls-options-factory.js +53 -0
- package/dist/transport/tcp/tls-options-factory.js.map +1 -0
- package/dist/transport/tcp/tls-options.d.ts +10 -5
- package/dist/transport/tcp/tls-options.js +0 -49
- package/dist/transport/tcp/tls-options.js.map +1 -1
- package/dist/transport/tick-action.d.ts +8 -0
- package/dist/transport/tick-action.js +13 -0
- package/dist/transport/tick-action.js.map +1 -0
- package/dist/util/buffer-helper.js +1 -1
- package/dist/util/buffer-helper.js.map +1 -1
- package/dist/util/definition-factory.d.ts +10 -0
- package/dist/util/definition-factory.js +56 -0
- package/dist/util/definition-factory.js.map +1 -0
- package/dist/util/dictionary-path.d.ts +4 -0
- package/dist/util/dictionary-path.js +3 -0
- package/dist/util/dictionary-path.js.map +1 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/json-helper.d.ts +3 -1
- package/dist/util/json-helper.js +13 -12
- package/dist/util/json-helper.js.map +1 -1
- package/dist/util/message-generator.d.ts +1 -1
- package/dist/util/message-generator.js +16 -15
- package/dist/util/message-generator.js.map +1 -1
- package/dist/util/replay.d.ts +6 -3
- package/dist/util/replay.js +24 -26
- package/dist/util/replay.js.map +1 -1
- package/package.json +18 -13
- package/script/build.cmd +1 -0
- package/script/build.sh +1 -0
- package/script/test.cmd +3 -0
- package/src/buffer/{ascii-chars.ts → ascii/ascii-chars.ts} +0 -0
- package/src/buffer/ascii/ascii-encoder.ts +9 -6
- package/src/buffer/ascii/ascii-parser-state.ts +7 -12
- package/src/buffer/ascii/ascii-parser.ts +23 -16
- package/src/buffer/ascii/ascii-segment-parser.ts +14 -8
- package/src/buffer/ascii/ascii-view.ts +4 -9
- package/src/buffer/ascii/index.ts +1 -0
- package/src/buffer/ascii/parse-state.ts +8 -0
- package/src/buffer/ascii/time-formatter.ts +1 -1
- package/src/buffer/elastic-buffer.ts +7 -2
- package/src/buffer/encode-proxy.ts +9 -4
- package/src/buffer/fixml/fixml-encoder.ts +15 -11
- package/src/buffer/fixml/fixml-parser.ts +16 -6
- package/src/buffer/fixml/fixml-view.ts +4 -9
- package/src/buffer/fixml/populated-attributes.ts +6 -0
- package/src/buffer/index.ts +4 -8
- package/src/buffer/msg-encoder.ts +2 -1
- package/src/buffer/msg-view.ts +13 -9
- package/src/buffer/{segment-description.ts → segment/segment-description.ts} +4 -11
- package/src/buffer/{segment-summary.ts → segment/segment-summary.ts} +0 -0
- package/src/buffer/segment/segment-type.ts +8 -0
- package/src/buffer/structure.ts +3 -3
- package/src/buffer/{tag-pos.ts → tag/tag-pos.ts} +0 -0
- package/src/buffer/tag/tag-type.ts +13 -0
- package/src/buffer/{tags.ts → tag/tags.ts} +4 -16
- package/src/config/get-js-fx-logger.ts +4 -0
- package/src/config/index.ts +1 -0
- package/src/config/js-fix-config.ts +5 -2
- package/src/config/js-fix-logger.ts +0 -3
- package/src/dictionary/compiler/compiler-type.ts +3 -3
- package/src/dictionary/compiler/enum-compiler.ts +12 -1
- package/src/dictionary/compiler/msg-compiler.ts +8 -7
- package/src/dictionary/contained/contained-component-field.ts +2 -1
- package/src/dictionary/contained/contained-field-dispatch.ts +3 -7
- package/src/dictionary/contained/contained-field-dispatcher.ts +9 -0
- package/src/dictionary/contained/contained-field-set.ts +5 -3
- package/src/dictionary/contained/contained-field-type.ts +5 -0
- package/src/dictionary/contained/contained-field.ts +1 -6
- package/src/dictionary/contained/contained-group-field.ts +2 -1
- package/src/dictionary/contained/contained-simple-field.ts +2 -1
- package/src/dictionary/contained/field-dispatcher.ts +9 -0
- package/src/dictionary/contained/fields-dispatch.ts +46 -0
- package/src/dictionary/contained/index.ts +2 -0
- package/src/dictionary/contained-set-type.ts +5 -0
- package/src/dictionary/definition/component-field-definition.ts +1 -1
- package/src/dictionary/definition/fix-definitions.ts +2 -1
- package/src/dictionary/definition/group-field-definition.ts +1 -1
- package/src/dictionary/definition/index.ts +0 -1
- package/src/dictionary/definition/message-definition.ts +1 -1
- package/src/dictionary/definition/simple-field-definition.ts +3 -1
- package/src/dictionary/dict-primitive.ts +0 -13
- package/src/dictionary/fix-definition-source.ts +6 -0
- package/src/dictionary/fix-versions.ts +0 -32
- package/src/dictionary/index.ts +1 -5
- package/src/dictionary/parser/fix-repository/abbreviations-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/base-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/components-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/data-types-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/enums-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/fields-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/messages-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/msg-contents-parser.ts +2 -3
- package/src/dictionary/parser/fix-repository/repository-abbreviation.ts +6 -0
- package/src/dictionary/parser/fix-repository/repository-component.ts +11 -0
- package/src/dictionary/parser/fix-repository/repository-data-type.ts +7 -0
- package/src/dictionary/parser/fix-repository/repository-enum.ts +8 -0
- package/src/dictionary/parser/fix-repository/repository-field.ts +12 -0
- package/src/dictionary/parser/fix-repository/repository-message.ts +12 -0
- package/src/dictionary/parser/fix-repository/repository-msg-content.ts +10 -0
- package/src/dictionary/parser/fix-repository/repository-type.ts +0 -59
- package/src/dictionary/parser/fix-repository/repository-xml-parser.ts +10 -9
- package/src/dictionary/parser/fix-repository/repository.ts +69 -38
- package/src/dictionary/parser/fixml/components-parser.ts +6 -3
- package/src/dictionary/parser/fixml/fields-parser.ts +1 -1
- package/src/dictionary/parser/fixml/fix-xsd-parser.ts +2 -1
- package/src/dictionary/parser/fixml/include-graph.ts +2 -1
- package/src/dictionary/parser/fixml/xsd-parser.ts +2 -1
- package/src/dictionary/parser/quickfix/field-definition-parser.ts +4 -5
- package/src/dictionary/parser/quickfix/field-set-parser.ts +4 -5
- package/src/dictionary/parser/quickfix/message-parser.ts +4 -5
- package/src/dictionary/parser/quickfix/node-parser.ts +3 -6
- package/src/dictionary/parser/quickfix/parse-state.ts +8 -0
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +9 -15
- package/src/dictionary/sax-node.ts +7 -0
- package/src/dictionary/set-reduce.ts +30 -31
- package/src/dictionary/type-dispatcher.ts +7 -0
- package/src/dictionary/version-util.ts +25 -0
- package/src/index.ts +1 -0
- package/src/jsfix-cmd.ts +31 -16
- package/src/runtime/di-tokens.ts +48 -0
- package/src/runtime/engine-factory.ts +5 -0
- package/src/runtime/index.ts +5 -0
- package/src/runtime/make-config.ts +35 -0
- package/src/runtime/session-container.ts +180 -0
- package/src/runtime/session-launcher.ts +127 -0
- package/src/sample/http/oms/app.ts +20 -14
- package/src/sample/http/oms/http-client.ts +5 -2
- package/src/sample/http/oms/http-server.ts +5 -1
- package/src/sample/tcp/qf-md/app.ts +12 -12
- package/src/sample/tcp/qf-md/md-client.ts +4 -1
- package/src/sample/tcp/qf-md/md-server.ts +3 -1
- package/src/sample/tcp/recovering-skeleton/app.ts +37 -15
- package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +16 -9
- package/src/sample/tcp/recovering-skeleton/skeleton-client.ts +4 -2
- package/src/sample/tcp/recovering-skeleton/skeleton-server.ts +4 -2
- package/src/sample/tcp/skeleton/app.ts +10 -15
- package/src/sample/tcp/skeleton/skeleton-session.ts +8 -4
- package/src/sample/tcp/tls-trade-capture/app.ts +8 -31
- package/src/sample/tcp/trade-capture/app-launcher.ts +22 -0
- package/src/sample/tcp/trade-capture/app.ts +3 -26
- package/src/sample/tcp/trade-capture/trade-capture-client.ts +2 -1
- package/src/sample/tcp/trade-capture/trade-capture-server.ts +2 -1
- package/src/sample/tcp/trade-capture/trade-factory.ts +7 -1
- package/src/store/fix-msg-ascii-store-resend.ts +3 -2
- package/src/store/fix-msg-memory-store.ts +1 -1
- package/src/store/fix-msg-store-record.ts +6 -0
- package/src/store/fix-msg-store-state.ts +6 -0
- package/src/store/fix-msg-store.ts +1 -7
- package/src/transport/ascii/ascii-msg-transmitter.ts +9 -5
- package/src/transport/ascii/ascii-session-msg-factory.ts +2 -2
- package/src/transport/ascii/ascii-session.ts +9 -6
- package/src/transport/ascii/index.ts +0 -1
- package/src/transport/duplex/http-duplex.ts +1 -1
- package/src/transport/duplex/tcp-duplex.ts +4 -1
- package/src/transport/factory/index.ts +1 -0
- package/src/transport/factory/msg-transport.ts +55 -0
- package/src/transport/fix-acceptor.ts +2 -2
- package/src/transport/fix-entity.ts +9 -0
- package/src/transport/fix-initiator.ts +2 -2
- package/src/transport/fixml/fixml-msg-transmitter.ts +8 -4
- package/src/transport/fixml/fixml-session-msg-factory.ts +2 -2
- package/src/transport/fixml/fixml-session.ts +2 -2
- package/src/transport/fixml/index.ts +0 -2
- package/src/transport/http/html-options.ts +8 -0
- package/src/transport/http/html-route.ts +6 -0
- package/src/transport/http/http-acceptor-listener.ts +42 -0
- package/src/transport/http/http-acceptor.ts +5 -2
- package/src/transport/http/http-adapter.ts +7 -0
- package/src/transport/http/http-initiator.ts +40 -25
- package/src/transport/http/http-json-sample-adapter.ts +7 -2
- package/src/transport/http/http-transaction.ts +1 -1
- package/src/transport/http/http-transport-description.ts +9 -0
- package/src/transport/http/index.ts +1 -0
- package/src/transport/index.ts +11 -10
- package/src/transport/msg-application.ts +13 -0
- package/src/transport/msg-transmitter.ts +5 -5
- package/src/transport/{a-session-msg-factory.ts → session/a-session-msg-factory.ts} +4 -4
- package/src/transport/session/fix-session-state-args.ts +9 -0
- package/src/transport/{fix-session-state.ts → session/fix-session-state.ts} +4 -44
- package/src/transport/{fix-session.ts → session/fix-session.ts} +10 -7
- package/src/transport/{make-fixl-session.ts → session/make-fix-session.ts} +1 -1
- package/src/transport/session/session-description.ts +18 -0
- package/src/transport/{fix-msg-factory.ts → session/session-msg-factory.ts} +2 -2
- package/src/transport/session/session-state.ts +25 -0
- package/src/transport/tcp/index.ts +3 -2
- package/src/transport/tcp/recovering-tcp-initiator.ts +24 -13
- package/src/transport/tcp/tcp-acceptor-listener.ts +45 -0
- package/src/transport/tcp/tcp-acceptor.ts +11 -10
- package/src/transport/tcp/tcp-initiator-connector.ts +71 -0
- package/src/transport/tcp/tcp-initiator.ts +10 -6
- package/src/transport/tcp/tcp-transport-description.ts +7 -0
- package/src/transport/tcp/tls-options-factory.ts +55 -0
- package/src/transport/tcp/tls-options.ts +9 -51
- package/src/transport/tick-action.ts +8 -0
- package/src/util/definition-factory.ts +47 -0
- package/src/util/dictionary-path.ts +4 -0
- package/src/util/index.ts +1 -1
- package/src/util/json-helper.ts +14 -4
- package/src/util/message-generator.ts +6 -3
- package/src/util/replay.ts +26 -21
- package/tsconfig.json +2 -0
- package/dist/buffer/ascii-chars.js.map +0 -1
- package/dist/buffer/segment-description.js.map +0 -1
- package/dist/buffer/segment-summary.js.map +0 -1
- package/dist/buffer/tag-pos.js.map +0 -1
- package/dist/buffer/tags.js.map +0 -1
- 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/sample/tcp/recovering-skeleton/respawn-2.d.ts +0 -2
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js +0 -3
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js.map +0 -1
- package/dist/store/fix-msg-ascii-store-recovery.d.ts +0 -12
- package/dist/store/fix-msg-ascii-store-recovery.js +0 -60
- package/dist/store/fix-msg-ascii-store-recovery.js.map +0 -1
- package/dist/store/fix-msg-ascii-store-replay.d.ts +0 -13
- package/dist/store/fix-msg-ascii-store-replay.js +0 -60
- package/dist/store/fix-msg-ascii-store-replay.js.map +0 -1
- package/dist/store/fix-replay-record.d.ts +0 -12
- package/dist/store/fix-replay-record.js +0 -12
- package/dist/store/fix-replay-record.js.map +0 -1
- package/dist/store/fix-resend-record.d.ts +0 -12
- package/dist/store/fix-resend-record.js +0 -12
- package/dist/store/fix-resend-record.js.map +0 -1
- package/dist/store/replay-record.d.ts +0 -6
- package/dist/store/replay-record.js.map +0 -1
- package/dist/store/store-replay-record.d.ts +0 -12
- package/dist/store/store-replay-record.js +0 -12
- package/dist/store/store-replay-record.js.map +0 -1
- package/dist/tcp/tls-options.d.ts +0 -5
- package/dist/tcp/tls-options.js +0 -45
- package/dist/tcp/tls-options.js.map +0 -1
- package/dist/test/ascii-encode.test.d.ts +0 -1
- package/dist/test/ascii-encode.test.js +0 -416
- package/dist/test/ascii-encode.test.js.map +0 -1
- package/dist/test/ascii-encoder.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/ascii-segment.test.d.ts +0 -1
- package/dist/test/ascii-segment.test.js.map +0 -1
- package/dist/test/ascii-store-recovery.test.d.ts +0 -1
- package/dist/test/ascii-store-recovery.test.js +0 -50
- package/dist/test/ascii-store-recovery.test.js.map +0 -1
- package/dist/test/ascii-store-replay.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/execution-report.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/fix-repo-dict.test.d.ts +0 -1
- 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.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.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.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.map +0 -1
- package/dist/test/includes.test.d.ts +0 -1
- package/dist/test/includes.test.js.map +0 -1
- package/dist/test/logon.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/qf-full-msg.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/repo-full-fixml-msg.test.d.ts +0 -1
- 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.map +0 -1
- package/dist/test/session.test.d.ts +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.js.map +0 -1
- package/dist/transport/fix-session-state.d.ts +0 -70
- package/dist/transport/fix-session-state.js.map +0 -1
- 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-fixl-session.js.map +0 -1
- 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.map +0 -1
- package/dist/transport/session-msg-factory.d.ts +0 -28
- package/dist/transport/session-msg-factory.js +0 -153
- package/dist/transport/session-msg-factory.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/transport/tcp/recovering-initiator.d.ts +0 -17
- package/dist/transport/tcp/recovering-initiator.js +0 -30
- package/dist/transport/tcp/recovering-initiator.js.map +0 -1
- package/dist/transport/tcp/recovering_initiator.d.ts +0 -12
- package/dist/transport/tcp/recovering_initiator.js +0 -25
- package/dist/transport/tcp/recovering_initiator.js.map +0 -1
- package/dist/transport/tcp/resilient-initiator.d.ts +0 -12
- package/dist/transport/tcp/resilient-initiator.js +0 -41
- package/dist/transport/tcp/resilient-initiator.js.map +0 -1
- package/dist/types/FIX4.4/quickfix/set/header.d.ts +0 -31
- package/dist/types/FIX4.4/quickfix/set/header.js.map +0 -1
- package/dist/types/FIX4.4/quickfix/set/trailer.d.ts +0 -6
- package/dist/types/FIX4.4/quickfix/set/trailer.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/src/dictionary/fields-dispatch.ts +0 -45
- package/src/sample/launcher.ts +0 -56
- package/src/transport/fixml/acceptor.ts +0 -29
- package/src/transport/make-config.ts +0 -19
- package/src/transport/msg-transport.ts +0 -67
- package/src/transport/session-description.ts +0 -70
- package/src/transport/tcp/acceptor.ts +0 -31
- package/src/transport/tcp/initiator.ts +0 -59
- package/src/util/dictionary-definitions.ts +0 -41
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.TcpInitiatorConnector = void 0;
|
|
25
|
+
const tcp_initiator_1 = require("./tcp-initiator");
|
|
26
|
+
const tsyringe_1 = require("tsyringe");
|
|
27
|
+
const di_tokens_1 = require("../../runtime/di-tokens");
|
|
28
|
+
const fix_entity_1 = require("../fix-entity");
|
|
29
|
+
let TcpInitiatorConnector = class TcpInitiatorConnector extends fix_entity_1.FixEntity {
|
|
30
|
+
constructor(config) {
|
|
31
|
+
super(config);
|
|
32
|
+
this.config = config;
|
|
33
|
+
}
|
|
34
|
+
start(reconnectTimeout = 0) {
|
|
35
|
+
return new Promise((accept, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const logger = this.config.logFactory.logger('initiator');
|
|
37
|
+
const sessionContainer = this.config.sessionContainer;
|
|
38
|
+
if (!sessionContainer.isRegistered(di_tokens_1.DITokens.FixSession)) {
|
|
39
|
+
reject(new Error(`application must register a DI token '${di_tokens_1.DITokens.FixSession}' - see src/sample`));
|
|
40
|
+
}
|
|
41
|
+
logger.info(`create session with DI Token ${di_tokens_1.DITokens.FixSession}`);
|
|
42
|
+
const initiatorSession = sessionContainer.resolve(di_tokens_1.DITokens.FixSession);
|
|
43
|
+
let connecting = true;
|
|
44
|
+
while (connecting) {
|
|
45
|
+
try {
|
|
46
|
+
yield this.connect(initiatorSession);
|
|
47
|
+
logger.info('session has ended');
|
|
48
|
+
connecting = false;
|
|
49
|
+
accept(true);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (!reconnectTimeout) {
|
|
53
|
+
connecting = false;
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
logger.info(`waiting ${reconnectTimeout} to reconnect following error`);
|
|
58
|
+
yield this.delay(reconnectTimeout);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
delay(p) {
|
|
65
|
+
return new Promise((accept) => {
|
|
66
|
+
if (!p) {
|
|
67
|
+
accept(true);
|
|
68
|
+
}
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
accept(true);
|
|
71
|
+
}, p);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
connect(initiatorSession) {
|
|
75
|
+
return new Promise((accept, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const logger = this.config.logFactory.logger('initiator');
|
|
77
|
+
const initiator = this.config.sessionContainer.resolve(tcp_initiator_1.TcpInitiator);
|
|
78
|
+
logger.info('connecting ...');
|
|
79
|
+
const initiatorTransport = yield initiator.connect(22);
|
|
80
|
+
logger.info('... connected, run session');
|
|
81
|
+
initiatorSession.run(initiatorTransport).then(() => {
|
|
82
|
+
logger.info('ends');
|
|
83
|
+
accept(true);
|
|
84
|
+
}).catch((e) => {
|
|
85
|
+
logger.error(e);
|
|
86
|
+
reject(e);
|
|
87
|
+
});
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
TcpInitiatorConnector = __decorate([
|
|
92
|
+
(0, tsyringe_1.injectable)(),
|
|
93
|
+
__param(0, (0, tsyringe_1.inject)(di_tokens_1.DITokens.IJsFixConfig)),
|
|
94
|
+
__metadata("design:paramtypes", [Object])
|
|
95
|
+
], TcpInitiatorConnector);
|
|
96
|
+
exports.TcpInitiatorConnector = TcpInitiatorConnector;
|
|
97
|
+
//# sourceMappingURL=tcp-initiator-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp-initiator-connector.js","sourceRoot":"","sources":["../../../src/transport/tcp/tcp-initiator-connector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,mDAA8C;AAG9C,uCAA6C;AAC7C,uDAAkD;AAClD,8CAAyC;AAGzC,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,sBAAS;IAClD,YAA4D,MAAoB;QAC9E,KAAK,CAAC,MAAM,CAAC,CAAA;QAD6C,WAAM,GAAN,MAAM,CAAc;IAEhF,CAAC;IACD,KAAK,CAAE,mBAA2B,CAAC;QACjC,OAAO,IAAI,OAAO,CAAM,CAAO,MAAM,EAAE,MAAM,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;YACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA;YACrD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,oBAAQ,CAA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YAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;YACzD,MAAM,SAAS,GAAiB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAe,4BAAY,CAAC,CAAA;YAChG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAC7B,MAAM,kBAAkB,GAAiB,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YACpE,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;YACzC,gBAAgB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACjD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBACnB,MAAM,CAAC,IAAI,CAAC,CAAA;YACd,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;gBACpB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBACf,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA5DY,qBAAqB;IADjC,IAAA,qBAAU,GAAE;IAEG,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,YAAY,CAAC,CAAA;;GADhC,qBAAqB,CA4DjC;AA5DY,sDAAqB","sourcesContent":["import { IJsFixConfig } from '../../config'\r\nimport { FixInitiator } from '../fix-initiator'\r\nimport { TcpInitiator } from './tcp-initiator'\r\nimport { MsgTransport } from '../factory'\r\nimport { FixSession } from '../session/fix-session'\r\nimport { inject, injectable } from 'tsyringe'\r\nimport { DITokens } from '../../runtime/di-tokens'\r\nimport { FixEntity } from '../fix-entity'\r\n\r\n@injectable()\r\nexport class TcpInitiatorConnector extends FixEntity {\r\n constructor (@inject(DITokens.IJsFixConfig) public readonly config: IJsFixConfig) {\r\n super(config)\r\n }\r\n start (reconnectTimeout: number = 0): Promise<any> {\r\n return new Promise<any>(async (accept, reject) => {\r\n const logger = this.config.logFactory.logger('initiator')\r\n const sessionContainer = this.config.sessionContainer\r\n if (!sessionContainer.isRegistered(DITokens.FixSession)) {\r\n reject(new Error(`application must register a DI token '${DITokens.FixSession}' - see src/sample`))\r\n }\r\n logger.info(`create session with DI Token ${DITokens.FixSession}`)\r\n const initiatorSession = sessionContainer.resolve<FixSession>(DITokens.FixSession)\r\n let connecting: boolean = true\r\n while (connecting) {\r\n try {\r\n await this.connect(initiatorSession)\r\n logger.info('session has ended')\r\n connecting = false\r\n accept(true)\r\n } catch (e) {\r\n if (!reconnectTimeout) {\r\n connecting = false\r\n reject(e)\r\n } else {\r\n logger.info(`waiting ${reconnectTimeout} to reconnect following error`)\r\n await this.delay(reconnectTimeout)\r\n }\r\n }\r\n }\r\n })\r\n }\r\n\r\n delay (p: number): Promise<any> {\r\n return new Promise<any>((accept) => {\r\n if (!p) {\r\n accept(true)\r\n }\r\n setTimeout(() => {\r\n accept(true)\r\n }, p)\r\n })\r\n }\r\n\r\n connect (initiatorSession: FixSession): Promise<any> {\r\n return new Promise<any>(async (accept, reject) => {\r\n const logger = this.config.logFactory.logger('initiator')\r\n const initiator: FixInitiator = this.config.sessionContainer.resolve<FixInitiator>(TcpInitiator)\r\n logger.info('connecting ...')\r\n const initiatorTransport: MsgTransport = await initiator.connect(22)\r\n logger.info('... connected, run session')\r\n initiatorSession.run(initiatorTransport).then(() => {\r\n logger.info('ends')\r\n accept(true)\r\n }).catch((e: Error) => {\r\n logger.error(e)\r\n reject(e)\r\n })\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ITcpTransportDescription } from '../session-description';
|
|
2
1
|
import { FixInitiator } from '../fix-initiator';
|
|
3
|
-
import { MsgTransport } from '../
|
|
2
|
+
import { MsgTransport } from '../factory';
|
|
4
3
|
import { IJsFixConfig } from '../../config';
|
|
4
|
+
import { ITcpTransportDescription } from './tcp-transport-description';
|
|
5
5
|
export declare enum InitiatorState {
|
|
6
6
|
Idle = 1,
|
|
7
7
|
Connecting = 2,
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
2
14
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
15
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
16
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,12 +23,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
24
|
exports.TcpInitiator = exports.InitiatorState = void 0;
|
|
13
25
|
const fix_initiator_1 = require("../fix-initiator");
|
|
14
|
-
const
|
|
26
|
+
const factory_1 = require("../factory");
|
|
15
27
|
const duplex_1 = require("../duplex");
|
|
16
28
|
const util = require("util");
|
|
17
29
|
const tls_1 = require("tls");
|
|
18
|
-
const tls_options_1 = require("./tls-options");
|
|
19
30
|
const net_1 = require("net");
|
|
31
|
+
const tls_options_factory_1 = require("./tls-options-factory");
|
|
32
|
+
const tsyringe_1 = require("tsyringe");
|
|
33
|
+
const di_tokens_1 = require("../../runtime/di-tokens");
|
|
20
34
|
var InitiatorState;
|
|
21
35
|
(function (InitiatorState) {
|
|
22
36
|
InitiatorState[InitiatorState["Idle"] = 1] = "Idle";
|
|
@@ -24,7 +38,7 @@ var InitiatorState;
|
|
|
24
38
|
InitiatorState[InitiatorState["Connected"] = 3] = "Connected";
|
|
25
39
|
InitiatorState[InitiatorState["Stopped"] = 4] = "Stopped";
|
|
26
40
|
})(InitiatorState = exports.InitiatorState || (exports.InitiatorState = {}));
|
|
27
|
-
class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
41
|
+
let TcpInitiator = class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
28
42
|
constructor(jsFixConfig) {
|
|
29
43
|
super(jsFixConfig.description.application);
|
|
30
44
|
this.jsFixConfig = jsFixConfig;
|
|
@@ -83,7 +97,7 @@ class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
|
83
97
|
return new Promise((resolve, reject) => {
|
|
84
98
|
try {
|
|
85
99
|
this.logger.info(`unsecureDuplex try to connect to endPoint`);
|
|
86
|
-
const socket = net_1.createConnection(tcp, () => {
|
|
100
|
+
const socket = (0, net_1.createConnection)(tcp, () => {
|
|
87
101
|
try {
|
|
88
102
|
this.logger.info(`net.createConnection cb, resolving`);
|
|
89
103
|
const tcpDuplex = new duplex_1.TcpDuplex(socket);
|
|
@@ -103,10 +117,10 @@ class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
|
103
117
|
return new Promise((resolve, reject) => {
|
|
104
118
|
let tlsSocket = null;
|
|
105
119
|
const tcp = this.tcp;
|
|
106
|
-
const connectionOptions =
|
|
120
|
+
const connectionOptions = tls_options_factory_1.TlsOptionsFactory.getTlsConnectionOptions(tcp);
|
|
107
121
|
if (connectionOptions) {
|
|
108
122
|
try {
|
|
109
|
-
tlsSocket = tls_1.connect(connectionOptions, () => {
|
|
123
|
+
tlsSocket = (0, tls_1.connect)(connectionOptions, () => {
|
|
110
124
|
this.logger.info(`client connected ${tlsSocket.authorized ? 'authorized' : 'unauthorized'}`);
|
|
111
125
|
if (!tlsSocket.authorized) {
|
|
112
126
|
const error = tlsSocket.authorizationError;
|
|
@@ -135,12 +149,12 @@ class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
|
135
149
|
tryConnect() {
|
|
136
150
|
return new Promise((resolve, reject) => {
|
|
137
151
|
const tcp = this.tcp;
|
|
138
|
-
const connectionOptions =
|
|
152
|
+
const connectionOptions = tls_options_factory_1.TlsOptionsFactory.getTlsConnectionOptions(tcp);
|
|
139
153
|
const connector = connectionOptions ? this.tlsDuplex() : this.unsecureDuplex();
|
|
140
154
|
this.logger.info(`tryConnect ${tcp.host}:${tcp.port}`);
|
|
141
155
|
connector.then(duplex => {
|
|
142
156
|
this.duplex = duplex;
|
|
143
|
-
resolve(new
|
|
157
|
+
resolve(new factory_1.MsgTransport(0, this.jsFixConfig, duplex));
|
|
144
158
|
}).catch(e => {
|
|
145
159
|
reject(e);
|
|
146
160
|
});
|
|
@@ -180,6 +194,11 @@ class TcpInitiator extends fix_initiator_1.FixInitiator {
|
|
|
180
194
|
});
|
|
181
195
|
}));
|
|
182
196
|
}
|
|
183
|
-
}
|
|
197
|
+
};
|
|
198
|
+
TcpInitiator = __decorate([
|
|
199
|
+
(0, tsyringe_1.injectable)(),
|
|
200
|
+
__param(0, (0, tsyringe_1.inject)(di_tokens_1.DITokens.IJsFixConfig)),
|
|
201
|
+
__metadata("design:paramtypes", [Object])
|
|
202
|
+
], TcpInitiator);
|
|
184
203
|
exports.TcpInitiator = TcpInitiator;
|
|
185
204
|
//# sourceMappingURL=tcp-initiator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcp-initiator.js","sourceRoot":"","sources":["../../../src/transport/tcp/tcp-initiator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,OAAO,EAAE,CAAC,CAAA;gBAC1E,CAAC,CAAC,CAAA;YACJ,CAAC,EAAE,WAAW,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;YACvC,cAAc,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC9C,IAAI,CAAC,UAAU,EAAE,CAAA;gBACjB,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAA;gBACnC,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,gBAAgB,cAAc,oBAAoB,CAAC,CAAA;gBAC1F,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;gBACrE,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBACpB,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CACF;AApKD,oCAoKC","sourcesContent":["import { ITcpTransportDescription } from '../session-description'\r\nimport { FixInitiator } from '../fix-initiator'\r\nimport { MsgTransport } from '../msg-transport'\r\n\r\nimport { IJsFixConfig, IJsFixLogger } from '../../config'\r\nimport { TcpDuplex, FixDuplex } from '../duplex'\r\n\r\nimport * as util from 'util'\r\nimport { connect as tlsConnect, ConnectionOptions, TLSSocket } from 'tls'\r\nimport { getTlsConnectionOptions } from './tls-options'\r\nimport { createConnection } from 'net'\r\nimport Timeout = NodeJS.Timeout\r\n\r\nexport enum InitiatorState {\r\n Idle = 1,\r\n Connecting = 2,\r\n Connected = 3,\r\n Stopped = 4\r\n}\r\n\r\nexport class TcpInitiator extends FixInitiator {\r\n public tcp: ITcpTransportDescription\r\n public state: InitiatorState = InitiatorState.Idle\r\n private readonly logger: IJsFixLogger\r\n private duplex: FixDuplex\r\n private th: Timeout = null\r\n\r\n constructor (public readonly jsFixConfig: IJsFixConfig) {\r\n super(jsFixConfig.description.application)\r\n this.logger = jsFixConfig.logFactory.logger(`${this.application.name}:TcpInitiator`)\r\n if (!this.application) {\r\n const e: Error = new Error(`no application in session description.`)\r\n this.logger.error(e)\r\n throw e\r\n }\r\n this.tcp = this.application.tcp\r\n if (!this.tcp) {\r\n const e = new Error(`no tcp in session description need tcp { host: hostname, port: port }`)\r\n this.logger.error(e)\r\n throw e\r\n }\r\n }\r\n\r\n public end (): void {\r\n this.clearTimer()\r\n switch (this.state) {\r\n case InitiatorState.Connected: {\r\n this.logger.info('end')\r\n this.duplex.end()\r\n this.state = InitiatorState.Stopped\r\n break\r\n }\r\n\r\n default: {\r\n this.logger.info(`end :state ${this.state}`)\r\n this.state = InitiatorState.Stopped\r\n break\r\n }\r\n }\r\n }\r\n\r\n public connect (timeoutSeconds: number): Promise<MsgTransport> {\r\n return new Promise<MsgTransport>(async (resolve, reject) => {\r\n switch (this.state) {\r\n case InitiatorState.Idle: {\r\n this.state = InitiatorState.Connecting\r\n this.logger.info(`connecting with timeout ${timeoutSeconds}`)\r\n this.tryConnect().then((t: MsgTransport) => resolve(t)).catch((e: Error) => {\r\n this.logger.error(e)\r\n this.repeatConnect(timeoutSeconds).then((t: MsgTransport) => resolve(t)).catch((e: Error) => reject(e))\r\n })\r\n break\r\n }\r\n\r\n default:\r\n const e: Error = new Error(`connect not valid from non idle state`)\r\n this.logger.warning(`rejecting from state ${this.state}`)\r\n reject(e)\r\n }\r\n })\r\n }\r\n\r\n private unsecureDuplex (): Promise<TcpDuplex> {\r\n const tcp = this.tcp\r\n return new Promise<TcpDuplex>((resolve, reject) => {\r\n try {\r\n this.logger.info(`unsecureDuplex try to connect to endPoint`)\r\n const socket = createConnection(tcp, () => {\r\n try {\r\n this.logger.info(`net.createConnection cb, resolving`)\r\n const tcpDuplex = new TcpDuplex(socket)\r\n resolve(tcpDuplex)\r\n } catch (e) {\r\n reject(e)\r\n }\r\n })\r\n } catch (e) {\r\n reject(e)\r\n }\r\n })\r\n }\r\n\r\n private tlsDuplex (): Promise < TcpDuplex > {\r\n return new Promise<TcpDuplex>((resolve, reject) => {\r\n let tlsSocket: TLSSocket = null\r\n const tcp = this.tcp\r\n const connectionOptions: ConnectionOptions = getTlsConnectionOptions(tcp)\r\n if (connectionOptions) {\r\n try {\r\n tlsSocket = tlsConnect(connectionOptions, () => {\r\n this.logger.info(`client connected ${tlsSocket.authorized ? 'authorized' : 'unauthorized'}`)\r\n if (!tlsSocket.authorized) {\r\n const error = tlsSocket.authorizationError\r\n this.logger.warning(`rejecting from state ${this.state} authorizationError ${error}`)\r\n tlsSocket.end()\r\n reject(error)\r\n } else {\r\n tlsSocket.setEncoding('utf8')\r\n const tlsDuplex = new TcpDuplex(tlsSocket)\r\n if (tcp.tls.enableTrace) {\r\n this.logger.info(`enabling tls session trace`)\r\n tlsSocket.enableTrace()\r\n }\r\n this.logger.info(`tlsDuplex resolving`)\r\n resolve(tlsDuplex)\r\n }\r\n })\r\n } catch (e) {\r\n reject(e)\r\n }\r\n }\r\n })\r\n }\r\n\r\n private tryConnect (): Promise < MsgTransport > {\r\n return new Promise<MsgTransport>((resolve, reject) => {\r\n const tcp = this.tcp\r\n const connectionOptions: ConnectionOptions = getTlsConnectionOptions(tcp)\r\n const connector = connectionOptions ? this.tlsDuplex() : this.unsecureDuplex()\r\n this.logger.info(`tryConnect ${tcp.host}:${tcp.port}`)\r\n connector.then(duplex => {\r\n this.duplex = duplex\r\n resolve(new MsgTransport(0, this.jsFixConfig, duplex))\r\n }).catch(e => {\r\n reject(e)\r\n })\r\n })\r\n }\r\n\r\n public clearTimer () {\r\n if (this .th) {\r\n clearInterval(this.th)\r\n this.th = null\r\n }\r\n }\r\n\r\n private repeatConnect (timeoutSeconds: number): Promise < MsgTransport > {\r\n return new Promise<MsgTransport>(async (resolve, reject) => {\r\n const application = this.application\r\n const promisify = util.promisify\r\n const timeoutPromise = promisify(setTimeout)\r\n let retries = 0\r\n this.th = setInterval(() => {\r\n ++retries\r\n this.tryConnect().then((t: MsgTransport) => {\r\n this.state = InitiatorState.Connected\r\n this.clearTimer()\r\n resolve(t)\r\n }).catch((e: Error) => {\r\n this.logger.info(`${application.name}: retries ${retries} ${e.message}`)\r\n })\r\n }, application.reconnectSeconds * 1000)\r\n timeoutPromise(timeoutSeconds * 1000).then(() => {\r\n this.clearTimer()\r\n this.state = InitiatorState.Stopped\r\n const e = new Error(`${application.name}: timeout of ${timeoutSeconds} whilst connecting`)\r\n this.logger.warning(`repeatConnect reject with message ${e.message}`)\r\n reject(e)\r\n }).catch(e => {\r\n this.logger.error(e)\r\n reject(e)\r\n })\r\n })\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"tcp-initiator.js","sourceRoot":"","sources":["../../../src/transport/tcp/tcp-initiator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA+C;AAC/C,wCAAyC;AAGzC,sCAAgD;AAEhD,6BAA4B;AAC5B,6BAAyE;AACzE,6BAAsC;AAEtC,+DAAyD;AACzD,uCAA6C;AAC7C,uDAAkD;AAGlD,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,mDAAQ,CAAA;IACR,+DAAc,CAAA;IACd,6DAAa,CAAA;IACb,yDAAW,CAAA;AACb,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAGD,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,4BAAY;IAO5C,YAA4D,WAAyB;QACnF,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QADgB,gBAAW,GAAX,WAAW,CAAc;QAL9E,UAAK,GAAmB,cAAc,CAAC,IAAI,CAAA;QAG1C,OAAE,GAAY,IAAI,CAAA;QAIxB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,I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C,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBACpB,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AApKY,YAAY;IADxB,IAAA,qBAAU,GAAE;IAQG,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,YAAY,CAAC,CAAA;;GAPhC,YAAY,CAoKxB;AApKY,oCAAY","sourcesContent":["\r\nimport { FixInitiator } from '../fix-initiator'\r\nimport { MsgTransport } from '../factory'\r\n\r\nimport { IJsFixConfig, IJsFixLogger } from '../../config'\r\nimport { TcpDuplex, FixDuplex } from '../duplex'\r\n\r\nimport * as util from 'util'\r\nimport { connect as tlsConnect, ConnectionOptions, TLSSocket } from 'tls'\r\nimport { createConnection } from 'net'\r\nimport Timeout = NodeJS.Timeout\r\nimport { TlsOptionsFactory } from './tls-options-factory'\r\nimport { inject, injectable } from 'tsyringe'\r\nimport { DITokens } from '../../runtime/di-tokens'\r\nimport { ITcpTransportDescription } from './tcp-transport-description'\r\n\r\nexport enum InitiatorState {\r\n Idle = 1,\r\n Connecting = 2,\r\n Connected = 3,\r\n Stopped = 4\r\n}\r\n\r\n@injectable()\r\nexport class TcpInitiator extends FixInitiator {\r\n public tcp: ITcpTransportDescription\r\n public state: InitiatorState = InitiatorState.Idle\r\n private readonly logger: IJsFixLogger\r\n private duplex: FixDuplex\r\n private th: Timeout = null\r\n\r\n constructor (@inject(DITokens.IJsFixConfig) public readonly jsFixConfig: IJsFixConfig) {\r\n super(jsFixConfig.description.application)\r\n this.logger = jsFixConfig.logFactory.logger(`${this.application.name}:TcpInitiator`)\r\n if (!this.application) {\r\n const e: Error = new Error(`no application in session description.`)\r\n this.logger.error(e)\r\n throw e\r\n }\r\n this.tcp = this.application.tcp\r\n if (!this.tcp) {\r\n const e = new Error(`no tcp in session description need tcp { host: hostname, port: port }`)\r\n this.logger.error(e)\r\n throw e\r\n }\r\n }\r\n\r\n public end (): void {\r\n this.clearTimer()\r\n switch (this.state) {\r\n case InitiatorState.Connected: {\r\n this.logger.info('end')\r\n this.duplex.end()\r\n this.state = InitiatorState.Stopped\r\n break\r\n }\r\n\r\n default: {\r\n this.logger.info(`end :state ${this.state}`)\r\n this.state = InitiatorState.Stopped\r\n break\r\n }\r\n }\r\n }\r\n\r\n public connect (timeoutSeconds: number): Promise<MsgTransport> {\r\n return new Promise<MsgTransport>(async (resolve, reject) => {\r\n switch (this.state) {\r\n case InitiatorState.Idle: {\r\n this.state = InitiatorState.Connecting\r\n this.logger.info(`connecting with timeout ${timeoutSeconds}`)\r\n this.tryConnect().then((t: MsgTransport) => resolve(t)).catch((e: Error) => {\r\n this.logger.error(e)\r\n this.repeatConnect(timeoutSeconds).then((t: MsgTransport) => resolve(t)).catch((e: Error) => reject(e))\r\n })\r\n break\r\n }\r\n\r\n default:\r\n const e: Error = new Error(`connect not valid from non idle state`)\r\n this.logger.warning(`rejecting from state ${this.state}`)\r\n reject(e)\r\n }\r\n })\r\n }\r\n\r\n private unsecureDuplex (): Promise<TcpDuplex> {\r\n const tcp = this.tcp\r\n return new Promise<TcpDuplex>((resolve, reject) => {\r\n try {\r\n this.logger.info(`unsecureDuplex try to connect to endPoint`)\r\n const socket = createConnection(tcp, () => {\r\n try {\r\n this.logger.info(`net.createConnection cb, resolving`)\r\n const tcpDuplex = new TcpDuplex(socket)\r\n resolve(tcpDuplex)\r\n } catch (e) {\r\n reject(e)\r\n }\r\n })\r\n } catch (e) {\r\n reject(e)\r\n }\r\n })\r\n }\r\n\r\n private tlsDuplex (): Promise < TcpDuplex > {\r\n return new Promise<TcpDuplex>((resolve, reject) => {\r\n let tlsSocket: TLSSocket = null\r\n const tcp = this.tcp\r\n const connectionOptions: ConnectionOptions = TlsOptionsFactory.getTlsConnectionOptions(tcp)\r\n if (connectionOptions) {\r\n try {\r\n tlsSocket = tlsConnect(connectionOptions, () => {\r\n this.logger.info(`client connected ${tlsSocket.authorized ? 'authorized' : 'unauthorized'}`)\r\n if (!tlsSocket.authorized) {\r\n const error = tlsSocket.authorizationError\r\n this.logger.warning(`rejecting from state ${this.state} authorizationError ${error}`)\r\n tlsSocket.end()\r\n reject(error)\r\n } else {\r\n tlsSocket.setEncoding('utf8')\r\n const tlsDuplex = new TcpDuplex(tlsSocket)\r\n if (tcp.tls.enableTrace) {\r\n this.logger.info(`enabling tls session trace`)\r\n tlsSocket.enableTrace()\r\n }\r\n this.logger.info(`tlsDuplex resolving`)\r\n resolve(tlsDuplex)\r\n }\r\n })\r\n } catch (e) {\r\n reject(e)\r\n }\r\n }\r\n })\r\n }\r\n\r\n private tryConnect (): Promise < MsgTransport > {\r\n return new Promise<MsgTransport>((resolve, reject) => {\r\n const tcp = this.tcp\r\n const connectionOptions: ConnectionOptions = TlsOptionsFactory.getTlsConnectionOptions(tcp)\r\n const connector = connectionOptions ? this.tlsDuplex() : this.unsecureDuplex()\r\n this.logger.info(`tryConnect ${tcp.host}:${tcp.port}`)\r\n connector.then(duplex => {\r\n this.duplex = duplex\r\n resolve(new MsgTransport(0, this.jsFixConfig, duplex))\r\n }).catch(e => {\r\n reject(e)\r\n })\r\n })\r\n }\r\n\r\n public clearTimer () {\r\n if (this .th) {\r\n clearInterval(this.th)\r\n this.th = null\r\n }\r\n }\r\n\r\n private repeatConnect (timeoutSeconds: number): Promise < MsgTransport > {\r\n return new Promise<MsgTransport>(async (resolve, reject) => {\r\n const application = this.application\r\n const promisify = util.promisify\r\n const timeoutPromise = promisify(setTimeout)\r\n let retries = 0\r\n this.th = setInterval(() => {\r\n ++retries\r\n this.tryConnect().then((t: MsgTransport) => {\r\n this.state = InitiatorState.Connected\r\n this.clearTimer()\r\n resolve(t)\r\n }).catch((e: Error) => {\r\n this.logger.info(`${application.name}: retries ${retries} ${e.message}`)\r\n })\r\n }, application.reconnectSeconds * 1000)\r\n timeoutPromise(timeoutSeconds * 1000).then(() => {\r\n this.clearTimer()\r\n this.state = InitiatorState.Stopped\r\n const e = new Error(`${application.name}: timeout of ${timeoutSeconds} whilst connecting`)\r\n this.logger.warning(`repeatConnect reject with message ${e.message}`)\r\n reject(e)\r\n }).catch(e => {\r\n this.logger.error(e)\r\n reject(e)\r\n })\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp-transport-description.js","sourceRoot":"","sources":["../../../src/transport/tcp/tcp-transport-description.ts"],"names":[],"mappings":"","sourcesContent":["import { ITlsOptions } from './tls-options'\r\n\r\nexport interface ITcpTransportDescription {\r\n readonly port: number\r\n readonly host: string,\r\n readonly tls?: ITlsOptions\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ConnectionOptions, TlsOptions } from 'tls';
|
|
3
|
+
import { ITlsOptions } from './tls-options';
|
|
4
|
+
import { ITcpTransportDescription } from './tcp-transport-description';
|
|
5
|
+
export declare class TlsOptionsFactory {
|
|
6
|
+
static read(filePath: string): any;
|
|
7
|
+
static getTlsOptions(tls: ITlsOptions): TlsOptions;
|
|
8
|
+
static getTlsConnectionOptions(tcp: ITcpTransportDescription): ConnectionOptions;
|
|
9
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TlsOptionsFactory = void 0;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
class TlsOptionsFactory {
|
|
7
|
+
static read(filePath) {
|
|
8
|
+
const root = path.join(__dirname, '../../../');
|
|
9
|
+
const fullPath = path.join(root, filePath);
|
|
10
|
+
return fs.readFileSync(fullPath, {
|
|
11
|
+
encoding: 'utf8', flag: 'r'
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
static getTlsOptions(tls) {
|
|
15
|
+
let tlsOptions = null;
|
|
16
|
+
if (tls && tls.key) {
|
|
17
|
+
tlsOptions = {
|
|
18
|
+
key: TlsOptionsFactory.read(tls.key),
|
|
19
|
+
cert: TlsOptionsFactory.read(tls.cert),
|
|
20
|
+
requestCert: tls.requestCert,
|
|
21
|
+
rejectUnauthorized: tls.rejectUnauthorized
|
|
22
|
+
};
|
|
23
|
+
if (tls.ca && tls.ca.length > 0) {
|
|
24
|
+
tlsOptions.ca = tls.ca.map(i => TlsOptionsFactory.read(i));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return tlsOptions;
|
|
28
|
+
}
|
|
29
|
+
static getTlsConnectionOptions(tcp) {
|
|
30
|
+
let connectionOptions = null;
|
|
31
|
+
const tls = tcp.tls;
|
|
32
|
+
if (tls && tls.key) {
|
|
33
|
+
connectionOptions = {
|
|
34
|
+
port: tcp.port,
|
|
35
|
+
host: tcp.host,
|
|
36
|
+
key: TlsOptionsFactory.read(tcp.tls.key),
|
|
37
|
+
cert: TlsOptionsFactory.read(tcp.tls.cert)
|
|
38
|
+
};
|
|
39
|
+
if (tcp.tls.ca && tcp.tls.ca.length > 0) {
|
|
40
|
+
connectionOptions.ca = tcp.tls.ca.map(i => TlsOptionsFactory.read(i));
|
|
41
|
+
}
|
|
42
|
+
if (tcp.tls.timeout) {
|
|
43
|
+
connectionOptions.timeout = tcp.tls.timeout;
|
|
44
|
+
}
|
|
45
|
+
if (tcp.tls.sessionTimeout) {
|
|
46
|
+
connectionOptions.sessionTimeout = tcp.tls.sessionTimeout;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return connectionOptions;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.TlsOptionsFactory = TlsOptionsFactory;
|
|
53
|
+
//# sourceMappingURL=tls-options-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tls-options-factory.js","sourceRoot":"","sources":["../../../src/transport/tcp/tls-options-factory.ts"],"names":[],"mappings":";;;AAGA,MAAM,IAAI,GAAG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GAAG,CAAC,GAAG,EAAE;YAClB,iBAAiB,GAAG;gBAClB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;gBACxC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;aACtB,CAAA;YACtB,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvC,iBAAiB,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;aACtE;YACD,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE;gBACnB,iBAAiB,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAA;aAC5C;YACD,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE;gBAC1B,iBAAiB,CAAC,cAAc,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAA;aAC1D;SACF;QACD,OAAO,iBAAiB,CAAA;IAC1B,CAAC;CACF;AAhDD,8CAgDC","sourcesContent":["import { ConnectionOptions, TlsOptions } from 'tls'\r\nimport { ITlsOptions } from './tls-options'\r\nimport { ITcpTransportDescription } from './tcp-transport-description'\r\nconst path = require('path')\r\nconst fs = require('fs')\r\n\r\nexport class TlsOptionsFactory {\r\n static read (filePath: string) {\r\n const root: string = path.join(__dirname, '../../../')\r\n const fullPath = path.join(root, filePath)\r\n return fs.readFileSync(fullPath,\r\n {\r\n encoding: 'utf8', flag: 'r'\r\n })\r\n }\r\n\r\n static getTlsOptions (tls: ITlsOptions): TlsOptions {\r\n let tlsOptions: TlsOptions = null\r\n if (tls && tls.key) {\r\n tlsOptions = {\r\n key: TlsOptionsFactory.read(tls.key),\r\n cert: TlsOptionsFactory.read(tls.cert),\r\n requestCert: tls.requestCert,\r\n rejectUnauthorized: tls.rejectUnauthorized\r\n } as TlsOptions\r\n if (tls.ca && tls.ca.length > 0) {\r\n tlsOptions.ca = tls.ca.map(i => TlsOptionsFactory.read(i))\r\n }\r\n }\r\n return tlsOptions\r\n }\r\n\r\n static getTlsConnectionOptions (tcp: ITcpTransportDescription): ConnectionOptions {\r\n let connectionOptions: ConnectionOptions = null\r\n const tls = tcp.tls\r\n if (tls && tls.key) {\r\n connectionOptions = {\r\n port: tcp.port,\r\n host: tcp.host,\r\n key: TlsOptionsFactory.read(tcp.tls.key),\r\n cert: TlsOptionsFactory.read(tcp.tls.cert)\r\n } as ConnectionOptions\r\n if (tcp.tls.ca && tcp.tls.ca.length > 0) {\r\n connectionOptions.ca = tcp.tls.ca.map(i => TlsOptionsFactory.read(i))\r\n }\r\n if (tcp.tls.timeout) {\r\n connectionOptions.timeout = tcp.tls.timeout\r\n }\r\n if (tcp.tls.sessionTimeout) {\r\n connectionOptions.sessionTimeout = tcp.tls.sessionTimeout\r\n }\r\n }\r\n return connectionOptions\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export interface ITlsOptions {
|
|
2
|
+
readonly key: string;
|
|
3
|
+
readonly cert: string;
|
|
4
|
+
readonly ca?: string[];
|
|
5
|
+
readonly timeout?: number;
|
|
6
|
+
readonly sessionTimeout?: number;
|
|
7
|
+
readonly enableTrace?: boolean;
|
|
8
|
+
readonly requestCert?: boolean;
|
|
9
|
+
readonly rejectUnauthorized?: boolean;
|
|
10
|
+
}
|
|
@@ -1,52 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTlsConnectionOptions = exports.getTlsOptions = void 0;
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
function read(filePath) {
|
|
7
|
-
const root = path.join(__dirname, '../../../');
|
|
8
|
-
const fullPath = path.join(root, filePath);
|
|
9
|
-
return fs.readFileSync(fullPath, {
|
|
10
|
-
encoding: 'utf8', flag: 'r'
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function getTlsOptions(tls) {
|
|
14
|
-
let tlsOptions = null;
|
|
15
|
-
if (tls && tls.key) {
|
|
16
|
-
tlsOptions = {
|
|
17
|
-
key: read(tls.key),
|
|
18
|
-
cert: read(tls.cert),
|
|
19
|
-
requestCert: tls.requestCert,
|
|
20
|
-
rejectUnauthorized: tls.rejectUnauthorized
|
|
21
|
-
};
|
|
22
|
-
if (tls.ca && tls.ca.length > 0) {
|
|
23
|
-
tlsOptions.ca = tls.ca.map(i => read(i));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return tlsOptions;
|
|
27
|
-
}
|
|
28
|
-
exports.getTlsOptions = getTlsOptions;
|
|
29
|
-
function getTlsConnectionOptions(tcp) {
|
|
30
|
-
let connectionOptions = null;
|
|
31
|
-
const tls = tcp.tls;
|
|
32
|
-
if (tls && tls.key) {
|
|
33
|
-
connectionOptions = {
|
|
34
|
-
port: tcp.port,
|
|
35
|
-
host: tcp.host,
|
|
36
|
-
key: read(tcp.tls.key),
|
|
37
|
-
cert: read(tcp.tls.cert)
|
|
38
|
-
};
|
|
39
|
-
if (tcp.tls.ca && tcp.tls.ca.length > 0) {
|
|
40
|
-
connectionOptions.ca = tcp.tls.ca.map(i => read(i));
|
|
41
|
-
}
|
|
42
|
-
if (tcp.tls.timeout) {
|
|
43
|
-
connectionOptions.timeout = tcp.tls.timeout;
|
|
44
|
-
}
|
|
45
|
-
if (tcp.tls.sessionTimeout) {
|
|
46
|
-
connectionOptions.sessionTimeout = tcp.tls.sessionTimeout;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return connectionOptions;
|
|
50
|
-
}
|
|
51
|
-
exports.getTlsConnectionOptions = getTlsConnectionOptions;
|
|
52
3
|
//# sourceMappingURL=tls-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tls-options.js","sourceRoot":"","sources":["../../../src/transport/tcp/tls-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tls-options.js","sourceRoot":"","sources":["../../../src/transport/tcp/tls-options.ts"],"names":[],"mappings":"","sourcesContent":["export interface ITlsOptions {\r\n readonly key: string,\r\n readonly cert: string,\r\n readonly ca?: string[],\r\n readonly timeout?: number,\r\n readonly sessionTimeout?: number,\r\n readonly enableTrace?: boolean,\r\n readonly requestCert?: boolean,\r\n readonly rejectUnauthorized?: boolean\r\n}\r\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TickAction = void 0;
|
|
4
|
+
var TickAction;
|
|
5
|
+
(function (TickAction) {
|
|
6
|
+
TickAction[TickAction["Nothing"] = 1] = "Nothing";
|
|
7
|
+
TickAction[TickAction["Heartbeat"] = 2] = "Heartbeat";
|
|
8
|
+
TickAction[TickAction["TestRequest"] = 3] = "TestRequest";
|
|
9
|
+
TickAction[TickAction["TerminateOnError"] = 4] = "TerminateOnError";
|
|
10
|
+
TickAction[TickAction["WaitLogoutConfirmExpired"] = 5] = "WaitLogoutConfirmExpired";
|
|
11
|
+
TickAction[TickAction["Stop"] = 6] = "Stop";
|
|
12
|
+
})(TickAction = exports.TickAction || (exports.TickAction = {}));
|
|
13
|
+
//# sourceMappingURL=tick-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tick-action.js","sourceRoot":"","sources":["../../src/transport/tick-action.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,iDAAW,CAAA;IACX,qDAAa,CAAA;IACb,yDAAe,CAAA;IACf,mEAAoB,CAAA;IACpB,mFAA4B,CAAA;IAC5B,2CAAQ,CAAA;AACV,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","sourcesContent":["export enum TickAction {\r\n Nothing = 1,\r\n Heartbeat = 2,\r\n TestRequest = 3,\r\n TerminateOnError = 4,\r\n WaitLogoutConfirmExpired = 5,\r\n Stop = 6\r\n}\r\n"]}
|
|
@@ -14,7 +14,7 @@ const util_1 = require("util");
|
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
function getWords(path) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const readFile = util_1.promisify(fs.readFile);
|
|
17
|
+
const readFile = (0, util_1.promisify)(fs.readFile);
|
|
18
18
|
const res = yield readFile(path);
|
|
19
19
|
return res.toString().split(' ').map((w) => w.trim());
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-helper.js","sourceRoot":"","sources":["../../src/util/buffer-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAgC;AAChC,yBAAwB;AAExB,SAAsB,QAAQ,CAAE,IAAY;;QAC1C,MAAM,QAAQ,GAAmC,gBAAS,
|
|
1
|
+
{"version":3,"file":"buffer-helper.js","sourceRoot":"","sources":["../../src/util/buffer-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAgC;AAChC,yBAAwB;AAExB,SAAsB,QAAQ,CAAE,IAAY;;QAC1C,MAAM,QAAQ,GAAmC,IAAA,gBAAS,EAAC,EAAE,CAAC,QAAQ,CAAC,CAAA;QACvE,MAAM,GAAG,GAAW,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;QACxC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC/D,CAAC;CAAA;AAJD,4BAIC","sourcesContent":["import { promisify } from 'util'\r\nimport * as fs from 'fs'\r\n\r\nexport async function getWords (path: string): Promise<string[]> {\r\n const readFile: (s: string) => Promise<Buffer> = promisify(fs.readFile)\r\n const res: Buffer = await readFile(path)\r\n return res.toString().split(' ').map((w: string) => w.trim())\r\n}\r\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FixParser } from '../dictionary';
|
|
2
|
+
import { FixDefinitions } from '../dictionary/definition';
|
|
3
|
+
import { GetJsFixLogger } from '../config';
|
|
4
|
+
import { IDictionaryPath } from './dictionary-path';
|
|
5
|
+
export declare class DefinitionFactory {
|
|
6
|
+
getDictPath(p: string): IDictionaryPath;
|
|
7
|
+
getDefinitions(path: string, getLogger?: GetJsFixLogger): Promise<FixDefinitions>;
|
|
8
|
+
getParser(path: string, getLogger: GetJsFixLogger): FixParser;
|
|
9
|
+
norm(p: string): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
exports.DefinitionFactory = void 0;
|
|
13
|
+
const config_1 = require("../config");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const fs = require("fs");
|
|
16
|
+
const parser_1 = require("../dictionary/parser");
|
|
17
|
+
const root = path.join(__dirname, '../../');
|
|
18
|
+
class DefinitionFactory {
|
|
19
|
+
getDictPath(p) {
|
|
20
|
+
const dictionary = require(path.join(root, 'data/dictionary.json'));
|
|
21
|
+
return dictionary[p];
|
|
22
|
+
}
|
|
23
|
+
getDefinitions(path, getLogger = config_1.makeEmptyLogger) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const dp = this.getDictPath(path);
|
|
26
|
+
if (dp) {
|
|
27
|
+
path = dp.dict;
|
|
28
|
+
}
|
|
29
|
+
path = this.norm(path);
|
|
30
|
+
const parser = this.getParser(path, getLogger);
|
|
31
|
+
return parser.parse();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
getParser(path, getLogger) {
|
|
35
|
+
let parser;
|
|
36
|
+
if (fs.lstatSync(path).isDirectory() && path.indexOf('fixml') >= 0) {
|
|
37
|
+
parser = new parser_1.FixXsdParser(path, getLogger);
|
|
38
|
+
}
|
|
39
|
+
else if (fs.lstatSync(path).isDirectory()) {
|
|
40
|
+
parser = new parser_1.RepositoryXmlParser(path, getLogger);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
parser = new parser_1.QuickFixXmlFileParser(path, getLogger);
|
|
44
|
+
}
|
|
45
|
+
return parser;
|
|
46
|
+
}
|
|
47
|
+
norm(p) {
|
|
48
|
+
let f = p;
|
|
49
|
+
if (!path.isAbsolute(p)) {
|
|
50
|
+
f = path.join(root, f);
|
|
51
|
+
}
|
|
52
|
+
return f;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.DefinitionFactory = DefinitionFactory;
|
|
56
|
+
//# sourceMappingURL=definition-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition-factory.js","sourceRoot":"","sources":["../../src/util/definition-factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,sCAA2D;AAC3D,6BAA4B;AAC5B,yBAAwB;AACx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CAAC,GAAW,CAAC,CAAA;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;YACvB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;SACvB;QACD,OAAO,CAAC,CAAA;IACV,CAAC;CACF;AApCD,8CAoCC","sourcesContent":["import { FixParser } from '../dictionary'\r\nimport { FixDefinitions } from '../dictionary/definition'\r\nimport { GetJsFixLogger, makeEmptyLogger } from '../config'\r\nimport * as path from 'path'\r\nimport * as fs from 'fs'\r\nimport { FixXsdParser, QuickFixXmlFileParser, RepositoryXmlParser } from '../dictionary/parser'\r\nimport { IDictionaryPath } from './dictionary-path'\r\n\r\nconst root: string = path.join(__dirname, '../../')\r\n\r\nexport class DefinitionFactory {\r\n\r\n getDictPath (p: string): IDictionaryPath {\r\n const dictionary = require(path.join(root, 'data/dictionary.json'))\r\n return dictionary[p]\r\n }\r\n\r\n async getDefinitions (path: string, getLogger: GetJsFixLogger = makeEmptyLogger): Promise<FixDefinitions> {\r\n const dp: IDictionaryPath = this.getDictPath(path)\r\n if (dp) {\r\n path = dp.dict\r\n }\r\n path = this.norm(path)\r\n const parser = this.getParser(path, getLogger)\r\n return parser.parse()\r\n }\r\n\r\n getParser (path: string, getLogger: GetJsFixLogger): FixParser {\r\n let parser: FixParser\r\n if (fs.lstatSync(path).isDirectory() && path.indexOf('fixml') >= 0) {\r\n parser = new FixXsdParser(path, getLogger)\r\n } else if (fs.lstatSync(path).isDirectory()) {\r\n parser = new RepositoryXmlParser(path, getLogger)\r\n } else {\r\n parser = new QuickFixXmlFileParser(path, getLogger)\r\n }\r\n return parser\r\n }\r\n\r\n norm (p: string): string {\r\n let f: string = p\r\n if (!path.isAbsolute(p)) {\r\n f = path.join(root, f)\r\n }\r\n return f\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary-path.js","sourceRoot":"","sources":["../../src/util/dictionary-path.ts"],"names":[],"mappings":"","sourcesContent":["export interface IDictionaryPath {\r\n output: string,\r\n dict: string\r\n}\r\n"]}
|
package/dist/util/index.d.ts
CHANGED
package/dist/util/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./definition-factory"), exports);
|
|
14
14
|
__exportStar(require("./json-helper"), exports);
|
|
15
15
|
__exportStar(require("./message-generator"), exports);
|
|
16
16
|
__exportStar(require("./replay"), exports);
|
package/dist/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAoC;AACpC,gDAA6B;AAC7B,sDAAmC;AACnC,2CAAwB;AACxB,kDAA+B","sourcesContent":["export * from './definition-factory'\r\nexport * from './json-helper'\r\nexport * from './message-generator'\r\nexport * from './replay'\r\nexport * from './buffer-helper'\r\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ILooseObject } from '../collections/collection';
|
|
2
|
-
import { ContainedFieldSet,
|
|
2
|
+
import { ContainedFieldSet, FieldsDispatch } from '../dictionary/contained';
|
|
3
|
+
import { FixDefinitions } from '../dictionary/definition';
|
|
3
4
|
export declare class JsonHelper {
|
|
4
5
|
readonly definitions: FixDefinitions;
|
|
6
|
+
dispatcher: FieldsDispatch;
|
|
5
7
|
constructor(definitions: FixDefinitions);
|
|
6
8
|
private static patchSimple;
|
|
7
9
|
fromJson(fileName: string, msgType: string): ILooseObject;
|