jspurefix 1.1.2 → 1.4.1
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/.travis.yml +1 -1
- package/README.md +48 -2
- package/appveyor.yml +43 -11
- package/data/FIX44-MD.xml +6596 -0
- package/data/examples/FIX.4.4/jsfix.test_client.txt +15 -13
- package/data/session/test-qf44-acceptor.json +21 -0
- package/data/session/test-qf44-initiator.json +22 -0
- package/dist/buffer/ascii/ascii-encoder.d.ts +9 -2
- package/dist/buffer/ascii/ascii-encoder.js +72 -31
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser.d.ts +1 -0
- package/dist/buffer/ascii/ascii-parser.js +7 -1
- package/dist/buffer/ascii/ascii-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.d.ts +0 -2
- package/dist/buffer/ascii/ascii-segment-parser.js +19 -25
- package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +2 -0
- package/dist/buffer/ascii/ascii-view.js +4 -0
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/ascii/time-formatter.js.map +1 -1
- package/dist/buffer/ascii-chars.d.ts +1 -0
- package/dist/buffer/ascii-chars.js +1 -0
- package/dist/buffer/ascii-chars.js.map +1 -1
- package/dist/buffer/elastic-buffer.d.ts +1 -0
- package/dist/buffer/elastic-buffer.js +8 -0
- package/dist/buffer/elastic-buffer.js.map +1 -1
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.d.ts +3 -0
- package/dist/buffer/fixml/fixml-encoder.js +6 -0
- package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
- package/dist/buffer/fixml/fixml-view.d.ts +2 -0
- package/dist/buffer/fixml/fixml-view.js +3 -0
- package/dist/buffer/fixml/fixml-view.js.map +1 -1
- package/dist/buffer/msg-encoder.d.ts +2 -0
- package/dist/buffer/msg-encoder.js.map +1 -1
- package/dist/buffer/msg-view.d.ts +2 -0
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/buffer/tags.js +5 -5
- package/dist/buffer/tags.js.map +1 -1
- package/dist/collections/dictionary.d.ts +1 -0
- package/dist/collections/dictionary.js +5 -0
- package/dist/collections/dictionary.js.map +1 -1
- package/dist/config/js-fix-config.d.ts +2 -0
- package/dist/config/js-fix-config.js +1 -0
- package/dist/config/js-fix-config.js.map +1 -1
- package/dist/dict-parser.js +2 -2
- package/dist/dict-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-set-parser.js +11 -4
- package/dist/dictionary/parser/quickfix/field-set-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/message-parser.js +4 -0
- package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.d.ts +1 -0
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +15 -0
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/jsfix-cmd.js +2 -1
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/sample/http/oms/app.js +2 -0
- package/dist/sample/http/oms/app.js.map +1 -1
- package/dist/sample/launcher.d.ts +3 -2
- package/dist/sample/launcher.js +12 -3
- package/dist/sample/launcher.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → qf-md}/app.d.ts +0 -0
- package/dist/sample/tcp/qf-md/app.js +22 -0
- package/dist/sample/tcp/qf-md/app.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-client.d.ts +15 -0
- package/dist/sample/tcp/qf-md/md-client.js +42 -0
- package/dist/sample/tcp/qf-md/md-client.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-factory.d.ts +4 -0
- package/dist/sample/tcp/qf-md/md-factory.js +35 -0
- package/dist/sample/tcp/qf-md/md-factory.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-server.d.ts +16 -0
- package/dist/sample/tcp/qf-md/md-server.js +44 -0
- package/dist/sample/tcp/qf-md/md-server.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/app.d.ts +1 -0
- package/dist/sample/tcp/recovering-skeleton/app.js +27 -0
- package/dist/sample/tcp/recovering-skeleton/app.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.d.ts +2 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js +3 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.d.ts +7 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +52 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.d.ts +16 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js +45 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.d.ts +16 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js +52 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js.map +1 -0
- package/dist/sample/tcp/skeleton/app.js +2 -0
- package/dist/sample/tcp/skeleton/app.js.map +1 -1
- package/dist/sample/tcp/skeleton/skeleton-session.d.ts +5 -1
- package/dist/sample/tcp/skeleton/skeleton-session.js +22 -3
- package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/app.d.ts +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/app.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/app.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.d.ts +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.js +8 -4
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.js +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-resend.d.ts +6 -2
- package/dist/store/fix-msg-ascii-store-resend.js +49 -22
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-memory-store.d.ts +11 -8
- package/dist/store/fix-msg-memory-store.js +108 -42
- package/dist/store/fix-msg-memory-store.js.map +1 -1
- package/dist/store/fix-msg-store-record.d.ts +7 -3
- package/dist/store/fix-msg-store-record.js +5 -1
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/store/fix-msg-store.d.ts +13 -9
- package/dist/store/fix-msg-store.js.map +1 -1
- package/dist/test/ascii-encode.test.js +20 -3
- package/dist/test/ascii-encode.test.js.map +1 -1
- package/dist/test/ascii-encoder.test.d.ts +1 -0
- package/dist/test/ascii-encoder.test.js +505 -0
- package/dist/test/ascii-encoder.test.js.map +1 -0
- package/dist/test/ascii-parser.test.js +8 -6
- package/dist/test/ascii-parser.test.js.map +1 -1
- package/dist/test/ascii-segment.test.js +6 -5
- package/dist/test/ascii-segment.test.js.map +1 -1
- package/dist/test/ascii-store-replay.test.js +59 -44
- package/dist/test/ascii-store-replay.test.js.map +1 -1
- package/dist/test/logon.test.js +1 -1
- package/dist/test/logon.test.js.map +1 -1
- package/dist/test/memory-store.test.js +24 -19
- package/dist/test/memory-store.test.js.map +1 -1
- package/dist/test/qf-full-msg.test.js +19 -14
- package/dist/test/qf-full-msg.test.js.map +1 -1
- package/dist/test/repo-full-ascii-msg.test.js +17 -15
- package/dist/test/repo-full-ascii-msg.test.js.map +1 -1
- package/dist/test/repo-full-fixml-msg.test.js +14 -14
- package/dist/test/repo-full-fixml-msg.test.js.map +1 -1
- package/dist/test/session-state.test.js +2 -2
- package/dist/test/session-state.test.js.map +1 -1
- package/dist/test/session.test.js +263 -143
- package/dist/test/session.test.js.map +1 -1
- package/dist/test/view-decode.test.js +2 -1
- package/dist/test/view-decode.test.js.map +1 -1
- package/dist/transport/a-session-msg-factory.d.ts +23 -0
- package/dist/transport/a-session-msg-factory.js +58 -0
- package/dist/transport/a-session-msg-factory.js.map +1 -0
- package/dist/transport/ascii/ascii-msg-transmitter.d.ts +1 -0
- package/dist/transport/ascii/ascii-msg-transmitter.js +39 -8
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session-msg-factory.d.ts +16 -0
- package/dist/transport/ascii/ascii-session-msg-factory.js +47 -0
- package/dist/transport/ascii/ascii-session-msg-factory.js.map +1 -0
- package/dist/transport/ascii/ascii-session.d.ts +10 -2
- package/dist/transport/ascii/ascii-session.js +86 -31
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/ascii/index.d.ts +1 -0
- package/dist/transport/ascii/index.js +1 -0
- package/dist/transport/ascii/index.js.map +1 -1
- package/dist/transport/ascii-session-msg-factory.d.ts +16 -0
- package/dist/transport/ascii-session-msg-factory.js +47 -0
- package/dist/transport/ascii-session-msg-factory.js.map +1 -0
- package/dist/transport/duplex/http-duplex.js +2 -2
- package/dist/transport/duplex/http-duplex.js.map +1 -1
- package/dist/transport/fix-msg-factory.d.ts +1 -1
- package/dist/transport/fix-msg-factory.js.map +1 -1
- package/dist/transport/fix-session-state.d.ts +38 -12
- package/dist/transport/fix-session-state.js +49 -15
- package/dist/transport/fix-session-state.js.map +1 -1
- package/dist/transport/fix-session.d.ts +13 -6
- package/dist/transport/fix-session.js +143 -39
- package/dist/transport/fix-session.js.map +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.d.ts +13 -0
- package/dist/transport/fixml/fixml-session-msg-factory.js +68 -0
- package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -0
- package/dist/transport/fixml/fixml-session.js +1 -1
- package/dist/transport/fixml/fixml-session.js.map +1 -1
- package/dist/transport/fixml/index.d.ts +2 -1
- package/dist/transport/fixml/index.js +2 -1
- package/dist/transport/fixml/index.js.map +1 -1
- package/dist/transport/fixml-session-msg-factory.d.ts +13 -0
- package/dist/transport/fixml-session-msg-factory.js +68 -0
- package/dist/transport/fixml-session-msg-factory.js.map +1 -0
- package/dist/transport/http/http-acceptor.js +8 -7
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/msg-transmitter.js +4 -3
- package/dist/transport/msg-transmitter.js.map +1 -1
- package/dist/transport/msg-transport.js +3 -2
- package/dist/transport/msg-transport.js.map +1 -1
- package/dist/transport/session-description.d.ts +1 -1
- package/dist/transport/session-description.js.map +1 -1
- package/dist/transport/session-msg-factory.d.ts +2 -2
- package/dist/transport/session-msg-factory.js +2 -2
- package/dist/transport/session-msg-factory.js.map +1 -1
- package/dist/transport/tcp/acceptor.js +5 -3
- package/dist/transport/tcp/acceptor.js.map +1 -1
- package/dist/transport/tcp/index.d.ts +1 -0
- package/dist/transport/tcp/index.js +1 -0
- package/dist/transport/tcp/index.js.map +1 -1
- package/dist/transport/tcp/initiator.js +1 -0
- package/dist/transport/tcp/initiator.js.map +1 -1
- package/dist/transport/tcp/recovering-initiator.d.ts +17 -0
- package/dist/transport/tcp/recovering-initiator.js +30 -0
- package/dist/transport/tcp/recovering-initiator.js.map +1 -0
- package/dist/transport/tcp/recovering-tcp-initiator.d.ts +28 -0
- package/dist/transport/tcp/recovering-tcp-initiator.js +120 -0
- package/dist/transport/tcp/recovering-tcp-initiator.js.map +1 -0
- package/dist/transport/tcp/tcp-acceptor.d.ts +7 -0
- package/dist/transport/tcp/tcp-acceptor.js +43 -11
- package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator.d.ts +4 -0
- package/dist/transport/tcp/tcp-initiator.js +72 -35
- package/dist/transport/tcp/tcp-initiator.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/advertisement.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/advertisement.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_instruction.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_instruction.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_instruction_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_instruction_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_report_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_report_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/assignment_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/assignment_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/bid_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/bid_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/bid_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/bid_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/business_message_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/business_message_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_assignment.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_assignment.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_inquiry.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_inquiry.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_inquiry_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_inquiry_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_replace_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_replace_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/derivative_security_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/derivative_security_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/derivative_security_list_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/derivative_security_list_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/dont_know_trade.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/dont_know_trade.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/email.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/email.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/execution_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/execution_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/heartbeat.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/heartbeat.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/index.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/index.js +4 -0
- package/dist/types/FIX4.4/quickfix/index.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/ioi.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/ioi.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_execute.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_execute.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_strike_price.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_strike_price.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/logon.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/logon.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/logout.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/logout.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_incremental_refresh.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_incremental_refresh.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_request_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_request_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/mass_quote.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/mass_quote.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/mass_quote_acknowledgement.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/mass_quote_acknowledgement.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/multileg_order_cancel_replace.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/multileg_order_cancel_replace.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_cross.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_cross.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_multileg.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_multileg.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_single.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_single.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/news.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/news.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_replace_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_replace_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_maintenance_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_maintenance_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_maintenance_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_maintenance_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_cancel.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_cancel.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_request_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_request_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_status_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_status_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/registration_instructions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/registration_instructions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/registration_instructions_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/registration_instructions_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/request_for_positions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/request_for_positions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/request_for_positions_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/request_for_positions_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/resend_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/resend_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/rfq_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/rfq_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_definition.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_definition.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_definition_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_definition_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_list_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_list_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_type_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_type_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_types.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_types.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/sequence_reset.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/sequence_reset.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/set/header.d.ts +31 -0
- package/dist/types/FIX4.4/quickfix/set/header.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/header.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/hop.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/set/hop.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/hop.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.d.ts +5 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.d.ts +31 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.d.ts +6 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.d.ts +6 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/settlement_instruction_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/settlement_instruction_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/settlement_instructions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/settlement_instructions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/test_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/test_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trading_session_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trading_session_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trading_session_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trading_session_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/user_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/user_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/user_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/user_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/xm_lnon_fix.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/xm_lnon_fix.js.map +1 -1
- package/dist/types/FIX4.4/repo/enum/all-enum.js.map +1 -1
- package/package.json +25 -21
- package/script/build.sh +1 -0
- package/src/buffer/ascii/ascii-encoder.ts +110 -33
- package/src/buffer/ascii/ascii-parser.ts +8 -1
- package/src/buffer/ascii/ascii-segment-parser.ts +44 -38
- package/src/buffer/ascii/ascii-view.ts +5 -0
- package/src/buffer/ascii/time-formatter.ts +2 -2
- package/src/buffer/ascii-chars.ts +1 -0
- package/src/buffer/elastic-buffer.ts +9 -0
- package/src/buffer/encode-proxy.ts +2 -2
- package/src/buffer/fixml/fixml-encoder.ts +8 -0
- package/src/buffer/fixml/fixml-view.ts +5 -0
- package/src/buffer/msg-encoder.ts +2 -0
- package/src/buffer/msg-view.ts +3 -0
- package/src/buffer/tags.ts +1 -1
- package/src/collections/dictionary.ts +6 -0
- package/src/config/js-fix-config.ts +2 -0
- package/src/dictionary/parser/quickfix/field-set-parser.ts +11 -4
- package/src/dictionary/parser/quickfix/message-parser.ts +4 -0
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +16 -0
- package/src/jsfix-cmd.ts +2 -1
- package/src/sample/http/oms/app.ts +2 -0
- package/src/sample/launcher.ts +17 -7
- package/src/sample/tcp/qf-md/app.ts +26 -0
- package/src/sample/tcp/qf-md/md-client.ts +51 -0
- package/src/sample/tcp/qf-md/md-factory.ts +34 -0
- package/src/sample/tcp/qf-md/md-server.ts +56 -0
- package/src/sample/tcp/recovering-skeleton/app.ts +33 -0
- package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +41 -0
- package/src/sample/tcp/recovering-skeleton/skeleton-client.ts +54 -0
- package/src/sample/tcp/recovering-skeleton/skeleton-server.ts +60 -0
- package/src/sample/tcp/skeleton/app.ts +2 -0
- package/src/sample/tcp/skeleton/skeleton-session.ts +26 -4
- package/src/sample/tcp/tls-trade-capture/app.ts +1 -1
- package/src/sample/tcp/{trade_capture → trade-capture}/app.ts +0 -0
- package/src/sample/tcp/{trade_capture → trade-capture}/index.ts +0 -0
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.ts +10 -5
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.ts +2 -2
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-factory.ts +0 -0
- package/src/store/fix-msg-ascii-store-resend.ts +87 -0
- package/src/store/fix-msg-memory-store.ts +171 -0
- package/src/store/fix-msg-store-record.ts +23 -0
- package/src/store/fix-msg-store.ts +23 -0
- package/src/store/index.ts +4 -0
- package/src/transport/a-session-msg-factory.ts +81 -0
- package/src/transport/ascii/ascii-msg-transmitter.ts +32 -11
- package/src/transport/ascii/ascii-session-msg-factory.ts +62 -0
- package/src/transport/ascii/ascii-session.ts +100 -36
- package/src/transport/ascii/index.ts +1 -0
- package/src/transport/duplex/http-duplex.ts +2 -2
- package/src/transport/fix-msg-factory.ts +1 -1
- package/src/transport/fix-session-state.ts +67 -15
- package/src/transport/fix-session.ts +156 -43
- package/src/transport/fixml/fixml-session-msg-factory.ts +76 -0
- package/src/transport/fixml/fixml-session.ts +1 -1
- package/src/transport/fixml/index.ts +2 -1
- package/src/transport/http/http-acceptor.ts +7 -6
- package/src/transport/index.ts +1 -1
- package/src/transport/msg-transmitter.ts +4 -3
- package/src/transport/msg-transport.ts +3 -2
- package/src/transport/session-description.ts +1 -1
- package/src/transport/tcp/acceptor.ts +5 -3
- package/src/transport/tcp/index.ts +1 -0
- package/src/transport/tcp/initiator.ts +1 -0
- package/src/transport/tcp/recovering-tcp-initiator.ts +149 -0
- package/src/transport/tcp/tcp-acceptor.ts +46 -11
- package/src/transport/tcp/tcp-initiator.ts +77 -40
- package/src/types/FIX4.4/quickfix/advertisement.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_instruction.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_instruction_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_report_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/assignment_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/bid_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/bid_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/business_message_reject.ts +5 -0
- package/src/types/FIX4.4/quickfix/collateral_assignment.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_inquiry.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_inquiry_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/confirmation.ts +4 -0
- package/src/types/FIX4.4/quickfix/confirmation_ack.ts +5 -0
- package/src/types/FIX4.4/quickfix/confirmation_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/cross_order_cancel_replace_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/cross_order_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/derivative_security_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/derivative_security_list_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/dont_know_trade.ts +4 -0
- package/src/types/FIX4.4/quickfix/email.ts +4 -0
- package/src/types/FIX4.4/quickfix/execution_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/heartbeat.ts +5 -0
- package/src/types/FIX4.4/quickfix/index.ts +4 -0
- package/src/types/FIX4.4/quickfix/ioi.ts +4 -0
- package/src/types/FIX4.4/quickfix/list_cancel_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/list_execute.ts +6 -1
- package/src/types/FIX4.4/quickfix/list_status.ts +4 -0
- package/src/types/FIX4.4/quickfix/list_status_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/list_strike_price.ts +4 -0
- package/src/types/FIX4.4/quickfix/logon.ts +4 -0
- package/src/types/FIX4.4/quickfix/logout.ts +6 -1
- package/src/types/FIX4.4/quickfix/market_data_incremental_refresh.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_request_reject.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.ts +4 -0
- package/src/types/FIX4.4/quickfix/mass_quote.ts +4 -0
- package/src/types/FIX4.4/quickfix/mass_quote_acknowledgement.ts +4 -0
- package/src/types/FIX4.4/quickfix/multileg_order_cancel_replace.ts +4 -0
- package/src/types/FIX4.4/quickfix/network_counterparty_system_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/network_counterparty_system_status_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_cross.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_multileg.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_single.ts +4 -0
- package/src/types/FIX4.4/quickfix/news.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_cancel_reject.ts +5 -0
- package/src/types/FIX4.4/quickfix/order_cancel_replace_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_cancel_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_maintenance_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_maintenance_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_cancel.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_request_reject.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_status_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/registration_instructions.ts +4 -0
- package/src/types/FIX4.4/quickfix/registration_instructions_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/reject.ts +6 -1
- package/src/types/FIX4.4/quickfix/request_for_positions.ts +4 -0
- package/src/types/FIX4.4/quickfix/request_for_positions_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/resend_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/rfq_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_definition.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_definition_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_list_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_status.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_type_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/security_types.ts +4 -0
- package/src/types/FIX4.4/quickfix/sequence_reset.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/hop.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/hop_no_hops.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/standard_header.ts +31 -0
- package/src/types/FIX4.4/quickfix/set/standard_trailer.ts +5 -0
- package/src/types/FIX4.4/quickfix/settlement_instruction_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/settlement_instructions.ts +4 -0
- package/src/types/FIX4.4/quickfix/test_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_request_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/trading_session_status.ts +5 -0
- package/src/types/FIX4.4/quickfix/trading_session_status_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/user_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/user_response.ts +5 -0
- package/src/types/FIX4.4/quickfix/xm_lnon_fix.ts +5 -0
- package/src/types/FIX4.4/repo/enum/all-enum.ts +0 -1
- package/dist/sample/tcp/tls-trade-capture/jsfix.test_client.txt +0 -77
- package/dist/sample/tcp/tls-trade-capture/jsfix.test_server.txt +0 -77
- package/dist/sample/tcp/trade_capture/jsfix.test_client.txt +0 -75
- package/dist/sample/tcp/trade_capture/jsfix.test_server.txt +0 -75
- package/dist/sample/tcp/trade_capture/trade-capture-client.js.map +0 -1
- package/dist/sample/tcp/trade_capture/trade-capture-server.js.map +0 -1
- package/src/transport/session-msg-factory.ts +0 -195
- package/src/transport/tcp/resilient-initiator.ts +0 -35
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixmlSessionMsgFactory = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const a_session_msg_factory_1 = require("../a-session-msg-factory");
|
|
6
|
+
const FIXML50SP2_1 = require("../../types/FIXML50SP2");
|
|
7
|
+
class FixmlSessionMsgFactory extends a_session_msg_factory_1.ASessionMsgFactory {
|
|
8
|
+
constructor(description, mutator = null) {
|
|
9
|
+
super(description, mutator);
|
|
10
|
+
this.description = description;
|
|
11
|
+
}
|
|
12
|
+
logon(userRequestId = '', isResponse = false) {
|
|
13
|
+
return this.fixmlLogon(userRequestId, isResponse);
|
|
14
|
+
}
|
|
15
|
+
logout(msgType, text) {
|
|
16
|
+
return this.fixmlLogout(msgType, msgType !== 'UserReq');
|
|
17
|
+
}
|
|
18
|
+
header(msgType, seqNum = 0, time = new Date(), overrideData) {
|
|
19
|
+
const description = this.description;
|
|
20
|
+
const o = {
|
|
21
|
+
SenderCompID: description.SenderCompId,
|
|
22
|
+
TargetCompID: description.TargetCompID,
|
|
23
|
+
SenderSubID: description.SenderSubID,
|
|
24
|
+
TargetSubID: description.TargetSubID
|
|
25
|
+
};
|
|
26
|
+
return this.mutate(o, 'StandardHeader');
|
|
27
|
+
}
|
|
28
|
+
fixmlLogon(userRequestId, isResponse) {
|
|
29
|
+
const description = this.description;
|
|
30
|
+
if (!isResponse) {
|
|
31
|
+
const o = {
|
|
32
|
+
Username: description.Username,
|
|
33
|
+
Password: description.Password,
|
|
34
|
+
UserRequestID: userRequestId,
|
|
35
|
+
UserRequestType: FIXML50SP2_1.UserRequestType.LogOnUser
|
|
36
|
+
};
|
|
37
|
+
return this.mutate(o, types_1.MsgType.Logon);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const o = {
|
|
41
|
+
Username: description.Username,
|
|
42
|
+
UserRequestID: userRequestId,
|
|
43
|
+
UserStatus: FIXML50SP2_1.UserStatus.LoggedIn
|
|
44
|
+
};
|
|
45
|
+
return this.mutate(o, types_1.MsgType.Logon);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
fixmlLogout(userRequestId, isResponse) {
|
|
49
|
+
if (!isResponse) {
|
|
50
|
+
const o = {
|
|
51
|
+
Username: this.description.Username,
|
|
52
|
+
UserRequestID: userRequestId,
|
|
53
|
+
UserRequestType: FIXML50SP2_1.UserRequestType.LogOffUser
|
|
54
|
+
};
|
|
55
|
+
return this.mutate(o, types_1.MsgType.Logout);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const o = {
|
|
59
|
+
Username: this.description.Username,
|
|
60
|
+
UserRequestID: userRequestId,
|
|
61
|
+
UserStatus: FIXML50SP2_1.UserStatus.NotLoggedIn
|
|
62
|
+
};
|
|
63
|
+
return this.mutate(o, types_1.MsgType.Logout);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.FixmlSessionMsgFactory = FixmlSessionMsgFactory;
|
|
68
|
+
//# sourceMappingURL=fixml-session-msg-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixml-session-msg-factory.js","sourceRoot":"","sources":["../../../src/transport/fixml/fixml-session-msg-factory.ts"],"names":[],"mappings":";;;AAEA,uCAAqC;AACrC,oEAA4E;AAE5E,uDAM+B;AAE/B,MAAa,sBAAuB,SAAQ,0CAAkB;IAE5D,YAAsB,WAAgC,EAAE,UAAyB,IAAI;QACnF,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QADP,gBAAW,GAAX,WAAW,CAAqB;IAEtD,CAAC;IAEM,KAAK,CAAE,gBAAwB,EAAE,EAAE,aAAsB,KAAK;QACnE,OAAO,IAAI,CAAC,UAAU,CAAC,aA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QAC7D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,CAAC,GAAiB;gBACtB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;gBACnC,aAAa,EAAE,aAAa;gBAC5B,eAAe,EAAE,4BAAe,CAAC,UAAU;aAC5B,CAAA;YACjB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,eAAO,CAAC,MAAM,CAAC,CAAA;SACtC;aAAM;YACL,MAAM,CAAC,GAAkB;gBACvB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;gBACnC,aAAa,EAAE,aAAa;gBAC5B,UAAU,EAAE,uBAAU,CAAC,WAAW;aAClB,CAAA;YAClB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,eAAO,CAAC,MAAM,CAAC,CAAA;SACtC;IACH,CAAC;CACF;AA9DD,wDA8DC","sourcesContent":["import { ISessionDescription } from './../session-description'\r\nimport { ILooseObject } from '../../collections/collection'\r\nimport { MsgType } from '../../types'\r\nimport { ASessionMsgFactory, ObjectMutator } from '../a-session-msg-factory'\r\n\r\nimport {\r\n IStandardHeader,\r\n IUserRequest,\r\n IUserResponse,\r\n UserRequestType,\r\n UserStatus\r\n} from '../../types/FIXML50SP2'\r\n\r\nexport class FixmlSessionMsgFactory extends ASessionMsgFactory {\r\n\r\n constructor (readonly description: ISessionDescription, mutator: ObjectMutator = null) {\r\n super(description, mutator)\r\n }\r\n\r\n public logon (userRequestId: string = '', isResponse: boolean = false): ILooseObject {\r\n return this.fixmlLogon(userRequestId, isResponse)\r\n }\r\n\r\n public logout (msgType: string, text: string): ILooseObject {\r\n return this.fixmlLogout(msgType, msgType !== 'UserReq')\r\n }\r\n\r\n public header (msgType: string, seqNum: number = 0, time: Date = new Date(), overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n const description = this.description\r\n const o: IStandardHeader = {\r\n SenderCompID: description.SenderCompId,\r\n TargetCompID: description.TargetCompID,\r\n SenderSubID: description.SenderSubID,\r\n TargetSubID: description.TargetSubID\r\n } as IStandardHeader\r\n return this.mutate(o, 'StandardHeader')\r\n }\r\n\r\n private fixmlLogon (userRequestId: string, isResponse: boolean): ILooseObject {\r\n const description = this.description\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOnUser\r\n } as IUserRequest\r\n return this.mutate(o, MsgType.Logon)\r\n } else {\r\n const o: IUserResponse = {\r\n Username: description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.LoggedIn\r\n } as IUserResponse\r\n return this.mutate(o, MsgType.Logon)\r\n }\r\n }\r\n\r\n private fixmlLogout (userRequestId: string, isResponse: boolean): ILooseObject {\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOffUser\r\n } as IUserRequest\r\n return this.mutate(o, MsgType.Logout)\r\n } else {\r\n const o: IUserResponse = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.NotLoggedIn\r\n } as IUserResponse\r\n return this.mutate(o, MsgType.Logout)\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -61,7 +61,7 @@ class FixmlSession extends fix_session_1.FixSession {
|
|
|
61
61
|
peerLogon(view) {
|
|
62
62
|
const logger = this.sessionLogger;
|
|
63
63
|
const state = this.sessionState;
|
|
64
|
-
state.state = fix_session_state_1.SessionState.
|
|
64
|
+
state.state = fix_session_state_1.SessionState.InitiationLogonReceived;
|
|
65
65
|
state.peerCompId = view.getTyped(types_1.MsgTag.SenderCompID);
|
|
66
66
|
if (this.acceptor) {
|
|
67
67
|
const reqId = view.getString('UserReqID');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixml-session.js","sourceRoot":"","sources":["../../../src/transport/fixml/fixml-session.ts"],"names":[],"mappings":";;;AACA,4DAAmD;AAEnD,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C,SAAS,CAAC,IAAI,CAAC,CAAA;wBACpB,MAAK;qBACN;oBAED,KAAK,uBAAU,CAAC,WAAW,CAAC,CAAC;wBAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;wBACrB,MAAK;qBACN;iBACF;gBACD,MAAK;aACN;SACF;IACH,CAAC;IAEO,SAAS,CAAE,IAAa;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAA;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAA;QAC/B,KAAK,CAAC,KAAK,GAAG,gCAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"fixml-session.js","sourceRoot":"","sources":["../../../src/transport/fixml/fixml-session.ts"],"names":[],"mappings":";;;AACA,4DAAmD;AAEnD,uDAAoE;AACpE,uCAAoC;AACpC,gDAA2C;AAE3C,MAAsB,YAAa,SAAQ,wBAAU;IAEnD,YAAuC,MAAoB;QACzD,KAAK,CAAC,MAAM,CAAC,CAAA;QADwB,WAAM,GAAN,MAAM,CAAc;QAEzD,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAA;QAClC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAA;QACjC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAA;IACpC,CAAC;IAES,KAAK,CAAE,OAAe,EAAE,IAAa;QAE7C,QAAQ,OAAO,EAAE;YACf,KAAK,SAAS,CAAC;YACf,KAAK,SAAS,CAAC,CAAC;gBACd,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBAChC,MAAK;aACN;YAED,OAAO,CAAC,CAAC;gBACP,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACnC,MAAK;aACN;SACF;IACH,CAAC;IAES,YAAY,CAAE,OAAe,EAAE,IAAa;QACpD,QAAQ,OAAO,EAAE;YACf,KAAK,SAAS,CAAC,CAAC;gBACd,MAAM,OAAO,GAAW,IAAI,CAAC,QAAQ,CA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CAAA;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;CACF;AAzED,oCAyEC","sourcesContent":["import { MsgView } from '../../buffer'\r\nimport { SessionState } from '../fix-session-state'\r\nimport { IJsFixConfig } from '../../config'\r\nimport { UserRequestType, UserStatus } from '../../types/FIXML50SP2'\r\nimport { MsgTag } from '../../types'\r\nimport { FixSession } from '../fix-session'\r\n\r\nexport abstract class FixmlSession extends FixSession {\r\n\r\n protected constructor (public readonly config: IJsFixConfig) {\r\n super(config)\r\n this.requestLogoutType = 'UserReq'\r\n this.requestLogonType = 'UserReq'\r\n this.respondLogoutType = 'UserRsp'\r\n }\r\n\r\n protected onMsg (msgType: string, view: MsgView): void {\r\n\r\n switch (msgType) {\r\n case 'UserReq':\r\n case 'UserRsp': {\r\n this.onSessionMsg(msgType, view)\r\n break\r\n }\r\n\r\n default: {\r\n this.checkForwardMsg(msgType, view)\r\n break\r\n }\r\n }\r\n }\r\n\r\n protected onSessionMsg (msgType: string, view: MsgView): void {\r\n switch (msgType) {\r\n case 'UserReq': {\r\n const reqType: number = view.getTyped('UserReqTyp')\r\n switch (reqType) {\r\n case UserRequestType.LogOnUser: {\r\n this.peerLogon(view)\r\n break\r\n }\r\n\r\n case UserRequestType.LogOffUser: {\r\n this.peerLogout(view)\r\n break\r\n }\r\n }\r\n break\r\n }\r\n\r\n case 'UserRsp': {\r\n const userStatus: number = view.getTyped('UserStatus')\r\n switch (userStatus) {\r\n case UserStatus.LoggedIn: {\r\n this.peerLogon(view)\r\n break\r\n }\r\n\r\n case UserStatus.NotLoggedIn: {\r\n this.peerLogout(view)\r\n break\r\n }\r\n }\r\n break\r\n }\r\n }\r\n }\r\n\r\n private peerLogon (view: MsgView) {\r\n const logger = this.sessionLogger\r\n const state = this.sessionState\r\n state.state = SessionState.InitiationLogonReceived\r\n state.peerCompId = view.getTyped(MsgTag.SenderCompID)\r\n if (this.acceptor) {\r\n const reqId: string = view.getString('UserReqID')\r\n this.send('UserRsp', this.config.factory.logon(reqId, true))\r\n }\r\n logger.info(`system ready, inform app`)\r\n this.onReady(view)\r\n }\r\n}\r\n"]}
|
|
@@ -11,7 +11,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./acceptor"), exports);
|
|
14
|
-
__exportStar(require("./fixml-msg-transmitter"), exports);
|
|
15
14
|
__exportStar(require("./fixml-request"), exports);
|
|
16
15
|
__exportStar(require("./fixml-session"), exports);
|
|
16
|
+
__exportStar(require("./fixml-msg-transmitter"), exports);
|
|
17
|
+
__exportStar(require("./fixml-session-msg-factory"), exports);
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/fixml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/fixml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA0B;AAC1B,kDAA+B;AAC/B,kDAA+B;AAC/B,0DAAuC;AACvC,8DAA2C","sourcesContent":["export * from './acceptor'\r\nexport * from './fixml-request'\r\nexport * from './fixml-session'\r\nexport * from './fixml-msg-transmitter'\r\nexport * from './fixml-session-msg-factory'\r\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ISessionDescription } from './session-description';
|
|
2
|
+
import { ILooseObject } from '../collections/collection';
|
|
3
|
+
import { ASessionMsgFactory, ObjectMutator } from '.';
|
|
4
|
+
import { IStandardHeader } from '../types/FIXML50SP2';
|
|
5
|
+
export declare class FixmlSessionMsgFactory extends ASessionMsgFactory {
|
|
6
|
+
readonly description: ISessionDescription;
|
|
7
|
+
constructor(description: ISessionDescription, mutator?: ObjectMutator);
|
|
8
|
+
logon(userRequestId?: string, isResponse?: boolean): ILooseObject;
|
|
9
|
+
logout(msgType: string, text: string): ILooseObject;
|
|
10
|
+
header(msgType: string, seqNum?: number, time?: Date, overrideData?: Partial<IStandardHeader>): ILooseObject;
|
|
11
|
+
private fixmlLogon;
|
|
12
|
+
private fixmlLogout;
|
|
13
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixmlSessionMsgFactory = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const FIXML50SP2_1 = require("../types/FIXML50SP2");
|
|
7
|
+
class FixmlSessionMsgFactory extends _1.ASessionMsgFactory {
|
|
8
|
+
constructor(description, mutator = null) {
|
|
9
|
+
super(description, mutator);
|
|
10
|
+
this.description = description;
|
|
11
|
+
}
|
|
12
|
+
logon(userRequestId = '', isResponse = false) {
|
|
13
|
+
return this.fixmlLogon(userRequestId, isResponse);
|
|
14
|
+
}
|
|
15
|
+
logout(msgType, text) {
|
|
16
|
+
return this.fixmlLogout(msgType, msgType !== 'UserReq');
|
|
17
|
+
}
|
|
18
|
+
header(msgType, seqNum = 0, time = new Date(), overrideData) {
|
|
19
|
+
const description = this.description;
|
|
20
|
+
const o = {
|
|
21
|
+
SenderCompID: description.SenderCompId,
|
|
22
|
+
TargetCompID: description.TargetCompID,
|
|
23
|
+
SenderSubID: description.SenderSubID,
|
|
24
|
+
TargetSubID: description.TargetSubID
|
|
25
|
+
};
|
|
26
|
+
return this.mutate(o, 'StandardHeader');
|
|
27
|
+
}
|
|
28
|
+
fixmlLogon(userRequestId, isResponse) {
|
|
29
|
+
const description = this.description;
|
|
30
|
+
if (!isResponse) {
|
|
31
|
+
const o = {
|
|
32
|
+
Username: description.Username,
|
|
33
|
+
Password: description.Password,
|
|
34
|
+
UserRequestID: userRequestId,
|
|
35
|
+
UserRequestType: FIXML50SP2_1.UserRequestType.LogOnUser
|
|
36
|
+
};
|
|
37
|
+
return this.mutate(o, types_1.MsgType.Logon);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const o = {
|
|
41
|
+
Username: description.Username,
|
|
42
|
+
UserRequestID: userRequestId,
|
|
43
|
+
UserStatus: FIXML50SP2_1.UserStatus.LoggedIn
|
|
44
|
+
};
|
|
45
|
+
return this.mutate(o, types_1.MsgType.Logon);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
fixmlLogout(userRequestId, isResponse) {
|
|
49
|
+
if (!isResponse) {
|
|
50
|
+
const o = {
|
|
51
|
+
Username: this.description.Username,
|
|
52
|
+
UserRequestID: userRequestId,
|
|
53
|
+
UserRequestType: FIXML50SP2_1.UserRequestType.LogOffUser
|
|
54
|
+
};
|
|
55
|
+
return this.mutate(o, types_1.MsgType.Logout);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const o = {
|
|
59
|
+
Username: this.description.Username,
|
|
60
|
+
UserRequestID: userRequestId,
|
|
61
|
+
UserStatus: FIXML50SP2_1.UserStatus.NotLoggedIn
|
|
62
|
+
};
|
|
63
|
+
return this.mutate(o, types_1.MsgType.Logout);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.FixmlSessionMsgFactory = FixmlSessionMsgFactory;
|
|
68
|
+
//# sourceMappingURL=fixml-session-msg-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixml-session-msg-factory.js","sourceRoot":"","sources":["../../src/transport/fixml-session-msg-factory.ts"],"names":[],"mappings":";;;AAEA,oCAAkC;AAClC,wBAAqD;AAErD,oDAM4B;AAE5B,MAAa,sBAAuB,SAAQ,qBAAkB;IAE5D,YAAsB,WAAgC,EAAE,UAAyB,IAAI;QACnF,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QADP,gBAAW,GAAX,WAAW,CAAqB;IAEtD,CAAC;IAEM,KAAK,CAAE,gBAAwB,EA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CAAA;SACrC;IACH,CAAC;IAEO,WAAW,CAAE,aAAqB,EAAE,UAAmB;QAC7D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,CAAC,GAAiB;gBACtB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;gBACnC,aAAa,EAAE,aAAa;gBAC5B,eAAe,EAAE,4BAAe,CAAC,UAAU;aAC5B,CAAA;YACjB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,eAAO,CAAC,MAAM,CAAC,CAAA;SACtC;aAAM;YACL,MAAM,CAAC,GAAkB;gBACvB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;gBACnC,aAAa,EAAE,aAAa;gBAC5B,UAAU,EAAE,uBAAU,CAAC,WAAW;aAClB,CAAA;YAClB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,eAAO,CAAC,MAAM,CAAC,CAAA;SACtC;IACH,CAAC;CACF;AA9DD,wDA8DC","sourcesContent":["import { ISessionDescription } from './session-description'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { MsgType } from '../types'\r\nimport { ASessionMsgFactory, ObjectMutator } from '.'\r\n\r\nimport {\r\n IStandardHeader,\r\n IUserRequest,\r\n IUserResponse,\r\n UserRequestType,\r\n UserStatus\r\n} from '../types/FIXML50SP2'\r\n\r\nexport class FixmlSessionMsgFactory extends ASessionMsgFactory {\r\n\r\n constructor (readonly description: ISessionDescription, mutator: ObjectMutator = null) {\r\n super(description, mutator)\r\n }\r\n\r\n public logon (userRequestId: string = '', isResponse: boolean = false): ILooseObject {\r\n return this.fixmlLogon(userRequestId, isResponse)\r\n }\r\n\r\n public logout (msgType: string, text: string): ILooseObject {\r\n return this.fixmlLogout(msgType, msgType !== 'UserReq')\r\n }\r\n\r\n public header (msgType: string, seqNum: number = 0, time: Date = new Date(), overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n const description = this.description\r\n const o: IStandardHeader = {\r\n SenderCompID: description.SenderCompId,\r\n TargetCompID: description.TargetCompID,\r\n SenderSubID: description.SenderSubID,\r\n TargetSubID: description.TargetSubID\r\n } as IStandardHeader\r\n return this.mutate(o, 'StandardHeader')\r\n }\r\n\r\n private fixmlLogon (userRequestId: string, isResponse: boolean): ILooseObject {\r\n const description = this.description\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOnUser\r\n } as IUserRequest\r\n return this.mutate(o, MsgType.Logon)\r\n } else {\r\n const o: IUserResponse = {\r\n Username: description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.LoggedIn\r\n } as IUserResponse\r\n return this.mutate(o, MsgType.Logon)\r\n }\r\n }\r\n\r\n private fixmlLogout (userRequestId: string, isResponse: boolean): ILooseObject {\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOffUser\r\n } as IUserRequest\r\n return this.mutate(o, MsgType.Logout)\r\n } else {\r\n const o: IUserResponse = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.NotLoggedIn\r\n } as IUserResponse\r\n return this.mutate(o, MsgType.Logout)\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -16,6 +16,7 @@ const duplex_1 = require("../duplex");
|
|
|
16
16
|
const collections_1 = require("../../collections");
|
|
17
17
|
const express = require("express");
|
|
18
18
|
const bodyParser = require("body-parser");
|
|
19
|
+
const uuid_1 = require("uuid");
|
|
19
20
|
class HttpAcceptor extends fix_acceptor_1.FixAcceptor {
|
|
20
21
|
constructor(config) {
|
|
21
22
|
super(config.description.application);
|
|
@@ -50,11 +51,9 @@ class HttpAcceptor extends fix_acceptor_1.FixAcceptor {
|
|
|
50
51
|
this.server.close(callback);
|
|
51
52
|
}
|
|
52
53
|
saveTransport(tid, transport) {
|
|
53
|
-
const uuidv3 = require('uuid/v3');
|
|
54
54
|
this.transports[tid] = transport;
|
|
55
|
-
const app = this.config.description.application;
|
|
56
55
|
const keys = Object.keys(this.transports);
|
|
57
|
-
const a =
|
|
56
|
+
const a = uuid_1.v4();
|
|
58
57
|
this.keys.addUpdate(a, transport);
|
|
59
58
|
this.logger.info(`new transport id = ${tid} token = ${a} created total transports = ${keys.length}`);
|
|
60
59
|
this.emit('transport', transport);
|
|
@@ -131,16 +130,16 @@ class HttpAcceptor extends fix_acceptor_1.FixAcceptor {
|
|
|
131
130
|
const authorise = `${root}authorise`;
|
|
132
131
|
const query = `${root}query`;
|
|
133
132
|
this.logger.info(`uri: authorise ${authorise}, query ${query}`);
|
|
134
|
-
router.post(authorise, (req, res) => {
|
|
133
|
+
router.post(authorise, (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
135
134
|
if (!req.headers.authorization) {
|
|
136
135
|
this.logger.info('logon');
|
|
137
|
-
this.logon(req, res);
|
|
136
|
+
yield this.logon(req, res);
|
|
138
137
|
}
|
|
139
138
|
else {
|
|
140
139
|
this.logger.info('logout');
|
|
141
|
-
this.logout(req, res);
|
|
140
|
+
yield this.logout(req, res);
|
|
142
141
|
}
|
|
143
|
-
});
|
|
142
|
+
}));
|
|
144
143
|
router.get(query, (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
145
144
|
const headers = req.headers;
|
|
146
145
|
const body = req.body;
|
|
@@ -155,6 +154,8 @@ class HttpAcceptor extends fix_acceptor_1.FixAcceptor {
|
|
|
155
154
|
const d = t.duplex;
|
|
156
155
|
this.respond(d, res).then(() => {
|
|
157
156
|
this.logger.info(`responded to ${req.url}`);
|
|
157
|
+
}).catch(e => {
|
|
158
|
+
res.send(e);
|
|
158
159
|
});
|
|
159
160
|
d.readable.push(body.fixml);
|
|
160
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-acceptor.js","sourceRoot":"","sources":["../../../src/transport/http/http-acceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;A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sourcesContent":["import { MsgTransport } from '../msg-transport'\r\nimport { FixAcceptor } from '../fix-acceptor'\r\nimport { IJsFixConfig, IJsFixLogger } from '../../config'\r\nimport { IFixmlRequest } from '../fixml'\r\nimport { StringDuplex, FixDuplex } from '../duplex'\r\nimport { Dictionary } from '../../collections'\r\n\r\nimport * as express from 'express'\r\nimport * as bodyParser from 'body-parser'\r\nimport * as http from 'http'\r\n\r\nexport class HttpAcceptor extends FixAcceptor {\r\n private app: express.Express = express()\r\n private server: http.Server\r\n private readonly logger: IJsFixLogger\r\n private readonly router: express.Router\r\n private nextId: number = 0\r\n private keys: Dictionary<MsgTransport> = new Dictionary()\r\n\r\n constructor (public readonly config: IJsFixConfig) {\r\n super(config.description.application)\r\n this.logger = config.logFactory.logger(`${config.description.application.name}:HttpAcceptor`)\r\n this.logger.info('creating http server')\r\n this.router = express.Router()\r\n this.router.use(bodyParser.json())\r\n this.subscribe()\r\n this.app.use('/', this.router)\r\n }\r\n\r\n public listen (): void {\r\n const app = this.config.description.application\r\n const port = app.http.port\r\n const logger = this.logger\r\n logger.info(`start to listen ${port}`)\r\n this.server = this.app.listen(port, () => {\r\n logger.info(`app listening at http://localhost:${port}${app.http.uri}`)\r\n })\r\n this.server.on('error', ((err: Error) => {\r\n logger.error(err)\r\n this.emit('error', err)\r\n }))\r\n }\r\n\r\n public close (callback?: (err?: Error) => void): void {\r\n const app = this.config.description.application\r\n const port = app.http.port\r\n this.logger.info(`close listener on port ${port}`)\r\n this.server.close(callback)\r\n }\r\n\r\n private saveTransport (tid: number, transport: MsgTransport): string {\r\n const uuidv3 = require('uuid/v3')\r\n this.transports[tid] = transport\r\n const app = this.config.description.application\r\n const keys: string[] = Object.keys(this.transports)\r\n const a = uuidv3(app.http.uri, uuidv3.URL)\r\n this.keys.addUpdate(a, transport)\r\n this.logger.info(`new transport id = ${tid} token = ${a} created total transports = ${keys.length}`)\r\n this.emit('transport', transport)\r\n return a\r\n }\r\n\r\n private harvestTransport (token: string, tid: number): void {\r\n delete this.transports[tid]\r\n this.keys.remove(token)\r\n const keys: string[] = Object.keys(this.transports)\r\n this.logger.info(`transport ${tid} ends total transports = ${keys.length}`)\r\n }\r\n\r\n private respond (duplex: FixDuplex, res: express.Response, token: string = null): Promise<any> {\r\n return new Promise<any>((accept, reject) => {\r\n res.setHeader('Content-Type', 'application/json')\r\n const timer = setTimeout(() => {\r\n const businessReject = `<FIXML><BizMsgRej BizRejRsn=\"4\" Txt=\"no response from application\"/></FIXML>`\r\n const b = Buffer.from(businessReject, 'utf-8')\r\n duplex.writable.removeListener('data', transmit)\r\n res.send(b)\r\n reject(new Error('no response'))\r\n }, 5000)\r\n\r\n const transmit = (d: Buffer) => {\r\n this.logger.info('responding to request')\r\n clearTimeout(timer)\r\n if (token) {\r\n res.setHeader('authorization', token)\r\n }\r\n duplex.writable.removeListener('data', transmit)\r\n res.send(d)\r\n accept(true)\r\n }\r\n\r\n duplex.writable.on('data', transmit)\r\n })\r\n }\r\n\r\n private async logon (req: express.Request, res: express.Response) {\r\n const body: IFixmlRequest = req.body\r\n const id = this.nextId++\r\n this.logger.info(JSON.stringify(body, null,4))\r\n // check hand back session key\r\n const d = new StringDuplex()\r\n const transport = new MsgTransport(id, this.config, d)\r\n const token = this.saveTransport(id, transport)\r\n this.respond(d, res, token).then(() => {\r\n this.logger.info('responded to logon')\r\n }).catch((e: Error) => {\r\n this.logger.error(e)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n\r\n private async logout (req: express.Request, res: express.Response) {\r\n const headers = req.headers\r\n const body: IFixmlRequest = req.body\r\n const t: MsgTransport = this.keys.get(headers.authorization)\r\n if (t) {\r\n const token = req.headers.authorization\r\n this.harvestTransport(token, t.id)\r\n const d = t.duplex\r\n this.respond(d, res, token).then(() => {\r\n this.logger.info('responded to logout')\r\n t.end()\r\n }).catch((e: Error) => {\r\n this.logger.error(e)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n }\r\n\r\n private subscribe (): void {\r\n const router = this.router\r\n const app = this.config.description.application\r\n const root = app.http.uri\r\n const authorise = `${root}authorise`\r\n const query = `${root}query`\r\n this.logger.info(`uri: authorise ${authorise}, query ${query}`)\r\n router.post(authorise, (req: express.Request, res: express.Response) => {\r\n if (!req.headers.authorization) {\r\n this.logger.info('logon')\r\n this.logon(req, res)\r\n } else {\r\n this.logger.info('logout')\r\n this.logout(req, res)\r\n }\r\n })\r\n\r\n router.get(query, async (req: express.Request, res: express.Response) => {\r\n const headers = req.headers\r\n const body: IFixmlRequest = req.body\r\n const t: MsgTransport = this.keys.get(headers.authorization)\r\n if (!t) {\r\n this.logger.info(`received request with no token`)\r\n res.send({\r\n error: 'no key with query'\r\n })\r\n } else {\r\n const d = t.duplex\r\n this.respond(d, res).then(() => {\r\n this.logger.info(`responded to ${req.url}`)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n })\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"http-acceptor.js","sourceRoot":"","sources":["../../../src/transport/http/http-acceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+C;AAC/C,kDAA6C;AAG7C,sCAAmD;AACnD,mDAA8C;AAE9C,mCAAkC;AAClC,0CAAyC;AAEzC,+BAAmC;AAEnC,MAAa,YAAa,SAAQ,0BAAW;IAQ3C,YAA6B,MAAoB;QAC/C,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QADV,WAAM,GAAN,MAAM,CAAc;QAPzC,QAAG,GAAoB,OAAO,EAAE,CAAA;QAIhC,WAAM,GAAW,CAAC,CAAA;QAClB,SAAI,GAA6B,IAAI,wBAAU,EAAE,CAAA;QAIvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,CAAA;QAC7F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACxC,IAAI,C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C,gCAAgC,CAAC,CAAA;gBAClD,GAAG,CAAC,IAAI,CAAC;oBACP,KAAK,EAAE,mBAAmB;iBAC3B,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;gBAClB,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;gBAC7C,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBACX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACb,CAAC,CAAC,CAAA;gBACF,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;aAC5B;QACH,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CACF;AAzJD,oCAyJC","sourcesContent":["import { MsgTransport } from '../msg-transport'\r\nimport { FixAcceptor } from '../fix-acceptor'\r\nimport { IJsFixConfig, IJsFixLogger } from '../../config'\r\nimport { IFixmlRequest } from '../fixml'\r\nimport { StringDuplex, FixDuplex } from '../duplex'\r\nimport { Dictionary } from '../../collections'\r\n\r\nimport * as express from 'express'\r\nimport * as bodyParser from 'body-parser'\r\nimport * as http from 'http'\r\nimport { v4 as uuidv4 } from 'uuid'\r\n\r\nexport class HttpAcceptor extends FixAcceptor {\r\n private app: express.Express = express()\r\n private server: http.Server\r\n private readonly logger: IJsFixLogger\r\n private readonly router: express.Router\r\n private nextId: number = 0\r\n private keys: Dictionary<MsgTransport> = new Dictionary()\r\n\r\n constructor (public readonly config: IJsFixConfig) {\r\n super(config.description.application)\r\n this.logger = config.logFactory.logger(`${config.description.application.name}:HttpAcceptor`)\r\n this.logger.info('creating http server')\r\n this.router = express.Router()\r\n this.router.use(bodyParser.json())\r\n this.subscribe()\r\n this.app.use('/', this.router)\r\n }\r\n\r\n public listen (): void {\r\n const app = this.config.description.application\r\n const port = app.http.port\r\n const logger = this.logger\r\n logger.info(`start to listen ${port}`)\r\n this.server = this.app.listen(port, () => {\r\n logger.info(`app listening at http://localhost:${port}${app.http.uri}`)\r\n })\r\n this.server.on('error', ((err: Error) => {\r\n logger.error(err)\r\n this.emit('error', err)\r\n }))\r\n }\r\n\r\n public close (callback?: (err?: Error) => void): void {\r\n const app = this.config.description.application\r\n const port = app.http.port\r\n this.logger.info(`close listener on port ${port}`)\r\n this.server.close(callback)\r\n }\r\n\r\n private saveTransport (tid: number, transport: MsgTransport): string {\r\n this.transports[tid] = transport\r\n const keys: string[] = Object.keys(this.transports)\r\n const a = uuidv4()\r\n this.keys.addUpdate(a, transport)\r\n this.logger.info(`new transport id = ${tid} token = ${a} created total transports = ${keys.length}`)\r\n this.emit('transport', transport)\r\n return a\r\n }\r\n\r\n private harvestTransport (token: string, tid: number): void {\r\n delete this.transports[tid]\r\n this.keys.remove(token)\r\n const keys: string[] = Object.keys(this.transports)\r\n this.logger.info(`transport ${tid} ends total transports = ${keys.length}`)\r\n }\r\n\r\n private respond (duplex: FixDuplex, res: express.Response, token: string = null): Promise<any> {\r\n return new Promise<any>((accept, reject) => {\r\n res.setHeader('Content-Type', 'application/json')\r\n const timer = setTimeout(() => {\r\n const businessReject = `<FIXML><BizMsgRej BizRejRsn=\"4\" Txt=\"no response from application\"/></FIXML>`\r\n const b = Buffer.from(businessReject, 'utf-8')\r\n duplex.writable.removeListener('data', transmit)\r\n res.send(b)\r\n reject(new Error('no response'))\r\n }, 5000)\r\n\r\n const transmit = (d: Buffer) => {\r\n this.logger.info('responding to request')\r\n clearTimeout(timer)\r\n if (token) {\r\n res.setHeader('authorization', token)\r\n }\r\n duplex.writable.removeListener('data', transmit)\r\n res.send(d)\r\n accept(true)\r\n }\r\n\r\n duplex.writable.on('data', transmit)\r\n })\r\n }\r\n\r\n private async logon (req: express.Request, res: express.Response) {\r\n const body: IFixmlRequest = req.body\r\n const id = this.nextId++\r\n this.logger.info(JSON.stringify(body, null,4))\r\n // check hand back session key\r\n const d = new StringDuplex()\r\n const transport = new MsgTransport(id, this.config, d)\r\n const token = this.saveTransport(id, transport)\r\n this.respond(d, res, token).then(() => {\r\n this.logger.info('responded to logon')\r\n }).catch((e: Error) => {\r\n this.logger.error(e)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n\r\n private async logout (req: express.Request, res: express.Response) {\r\n const headers = req.headers\r\n const body: IFixmlRequest = req.body\r\n const t: MsgTransport = this.keys.get(headers.authorization)\r\n if (t) {\r\n const token = req.headers.authorization\r\n this.harvestTransport(token, t.id)\r\n const d = t.duplex\r\n this.respond(d, res, token).then(() => {\r\n this.logger.info('responded to logout')\r\n t.end()\r\n }).catch((e: Error) => {\r\n this.logger.error(e)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n }\r\n\r\n private subscribe (): void {\r\n const router = this.router\r\n const app = this.config.description.application\r\n const root = app.http.uri\r\n const authorise = `${root}authorise`\r\n const query = `${root}query`\r\n this.logger.info(`uri: authorise ${authorise}, query ${query}`)\r\n router.post(authorise, async (req: express.Request, res: express.Response) => {\r\n if (!req.headers.authorization) {\r\n this.logger.info('logon')\r\n await this.logon(req, res)\r\n } else {\r\n this.logger.info('logout')\r\n await this.logout(req, res)\r\n }\r\n })\r\n\r\n router.get(query, async (req: express.Request, res: express.Response) => {\r\n const headers = req.headers\r\n const body: IFixmlRequest = req.body\r\n const t: MsgTransport = this.keys.get(headers.authorization)\r\n if (!t) {\r\n this.logger.info(`received request with no token`)\r\n res.send({\r\n error: 'no key with query'\r\n })\r\n } else {\r\n const d = t.duplex\r\n this.respond(d, res).then(() => {\r\n this.logger.info(`responded to ${req.url}`)\r\n }).catch(e => {\r\n res.send(e)\r\n })\r\n d.readable.push(body.fixml)\r\n }\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -2,7 +2,7 @@ export * from './tcp';
|
|
|
2
2
|
export * from './http';
|
|
3
3
|
export * from './ascii';
|
|
4
4
|
export * from './duplex';
|
|
5
|
-
export * from './session-msg-factory';
|
|
5
|
+
export * from './a-session-msg-factory';
|
|
6
6
|
export * from './make-config';
|
|
7
7
|
export * from './fix-acceptor';
|
|
8
8
|
export * from './fix-initiator';
|
package/dist/transport/index.js
CHANGED
|
@@ -14,7 +14,7 @@ __exportStar(require("./tcp"), exports);
|
|
|
14
14
|
__exportStar(require("./http"), exports);
|
|
15
15
|
__exportStar(require("./ascii"), exports);
|
|
16
16
|
__exportStar(require("./duplex"), exports);
|
|
17
|
-
__exportStar(require("./session-msg-factory"), exports);
|
|
17
|
+
__exportStar(require("./a-session-msg-factory"), exports);
|
|
18
18
|
__exportStar(require("./make-config"), exports);
|
|
19
19
|
__exportStar(require("./fix-acceptor"), exports);
|
|
20
20
|
__exportStar(require("./fix-initiator"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAqB;AACrB,yCAAsB;AACtB,0CAAuB;AACvB,2CAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAqB;AACrB,yCAAsB;AACtB,0CAAuB;AACvB,2CAAwB;AACxB,0DAAuC;AACvC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,oDAAiC;AACjC,gDAA6B;AAC7B,sDAAmC;AACnC,oDAAiC;AACjC,kDAA+B;AAC/B,gDAA6B;AAC7B,wDAAqC","sourcesContent":["export * from './tcp'\r\nexport * from './http'\r\nexport * from './ascii'\r\nexport * from './duplex'\r\nexport * from './a-session-msg-factory'\r\nexport * from './make-config'\r\nexport * from './fix-acceptor'\r\nexport * from './fix-initiator'\r\nexport * from './fix-msg-factory'\r\nexport * from './fix-session'\r\nexport * from './fix-session-state'\r\nexport * from './msg-transmitter'\r\nexport * from './msg-transport'\r\nexport * from './msg-payload'\r\nexport * from './session-description'\r\n"]}
|
|
@@ -29,11 +29,12 @@ class MsgTransmitter extends events.EventEmitter {
|
|
|
29
29
|
transform(payload, encoding, done) {
|
|
30
30
|
try {
|
|
31
31
|
const msgType = payload.msgType;
|
|
32
|
-
transmitter.
|
|
32
|
+
transmitter.encoder.reset();
|
|
33
33
|
transmitter.encodeMessage(msgType, payload.obj);
|
|
34
|
-
payload.encoded = transmitter.
|
|
34
|
+
payload.encoded = transmitter.encoder.trim();
|
|
35
35
|
this.push(payload.encoded);
|
|
36
|
-
transmitter.
|
|
36
|
+
const encodedTxt = transmitter.buffer.toString();
|
|
37
|
+
transmitter.emit('encoded', msgType, encodedTxt);
|
|
37
38
|
done();
|
|
38
39
|
}
|
|
39
40
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msg-transmitter.js","sourceRoot":"","sources":["../../src/transport/msg-transmitter.ts"],"names":[],"mappings":";;;AAAA,sCAAqD;AAErD,mCAAkC;AAClC,+CAA0C;AAG1C,iCAAgC;AAEhC,MAAsB,cAAe,SAAQ,MAAM,CAAC,YAAY;IAK9D,YAAuC,WAA2B,EAC3B,OAA4B;QACjE,KAAK,EAAE,CAAA;QAF8B,gBAAW,GAAX,WAAW,CAAgB;QAC3B,YAAO,GAAP,OAAO,CAAqB;QAJnD,WAAM,GAAkB,IAAI,sBAAa,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;QAMlE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACxC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YAChC,IAAI,CAAC,IAAI,CA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e,EAAE,GAAiB;QAC7C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,wBAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IACvD,CAAC;IAOO,aAAa;QACnB,MAAM,WAAW,GAAG,IAAI,CAAA;QACxB,OAAO,IAAI,kBAAS,CAAC;YACnB,kBAAkB,EAAE,IAAI;YACxB,SAAS,CAAE,OAAmB,EAAE,QAAQ,EAAE,IAAc;gBACtD,IAAI;oBACF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;oBAC/B,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;oBAC3B,WAAW,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;oBAC/C,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;oBAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;oBAC1B,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;oBAChD,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;oBAChD,IAAI,EAAE,CAAA;iBACP;gBAAC,OAAO,CAAC,EAAE;oBACV,IAAI,CAAC,CAAC,CAAC,CAAA;iBACR;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AA/CD,wCA+CC","sourcesContent":["import { MsgEncoder, ElasticBuffer } from '../buffer'\r\nimport { FixDefinitions } from '../dictionary'\r\nimport { Transform } from 'stream'\r\nimport { MsgPayload } from './msg-payload'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { ISessionDescription } from './session-description'\r\nimport * as events from 'events'\r\n\r\nexport abstract class MsgTransmitter extends events.EventEmitter {\r\n public readonly encodeStream: Transform\r\n public readonly buffer: ElasticBuffer = new ElasticBuffer(10 * 1024)\r\n protected encoder: MsgEncoder\r\n\r\n protected constructor (public readonly definitions: FixDefinitions,\r\n public readonly session: ISessionDescription) {\r\n super()\r\n this.encodeStream = this.encoderStream()\r\n this.encodeStream.on('error', (e: Error) => {\r\n this.emit('error', e)\r\n })\r\n this.encodeStream.on('done', () => {\r\n this.emit('done')\r\n })\r\n }\r\n\r\n // messages at front, byte stream at back\r\n public send (msgType: string, obj: ILooseObject): void {\r\n this.encodeStream.write(new MsgPayload(msgType, obj))\r\n }\r\n\r\n public abstract encodeMessage (msgType: string, obj: ILooseObject): void\r\n\r\n // read fix messages from one side, encode buffers on other ready to pipe\r\n // to output stream, say a socket\r\n\r\n private encoderStream (): Transform {\r\n const transmitter = this\r\n return new Transform({\r\n writableObjectMode: true,\r\n transform (payload: MsgPayload, encoding, done: Function) {\r\n try {\r\n const msgType = payload.msgType\r\n transmitter.encoder.reset()\r\n transmitter.encodeMessage(msgType, payload.obj)\r\n payload.encoded = transmitter.encoder.trim()\r\n this.push(payload.encoded)\r\n const encodedTxt = transmitter.buffer.toString()\r\n transmitter.emit('encoded', msgType, encodedTxt)\r\n done()\r\n } catch (e) {\r\n done(e)\r\n }\r\n }\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -13,13 +13,14 @@ class MsgTransport {
|
|
|
13
13
|
if (!delimiter) {
|
|
14
14
|
throw new Error(`no delimiter char given.`);
|
|
15
15
|
}
|
|
16
|
+
const logDelimiter = config.logDelimiter || buffer_1.AsciiChars.Pipe;
|
|
16
17
|
const description = config.description;
|
|
17
18
|
const definitions = config.definitions;
|
|
18
19
|
const protocol = description.application.protocol;
|
|
19
20
|
switch (protocol) {
|
|
20
21
|
case 'ascii': {
|
|
21
22
|
this.transmitter = new ascii_1.AsciiMsgTransmitter(config);
|
|
22
|
-
this.receiver = new buffer_1.AsciiParser(definitions, duplex.readable, delimiter,
|
|
23
|
+
this.receiver = new buffer_1.AsciiParser(definitions, duplex.readable, delimiter, logDelimiter);
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
case 'fixml': {
|
|
@@ -41,7 +42,7 @@ class MsgTransport {
|
|
|
41
42
|
wait() {
|
|
42
43
|
return new Promise((resolve, reject) => {
|
|
43
44
|
this.receiver.on('end', () => {
|
|
44
|
-
resolve(
|
|
45
|
+
resolve(this.id);
|
|
45
46
|
});
|
|
46
47
|
this.receiver.on('error', (e) => {
|
|
47
48
|
reject(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msg-transport.js","sourceRoot":"","sources":["../../src/transport/msg-transport.ts"],"names":[],"mappings":";;;AAAA,sCAA2E;AAC3E,mCAA6C;AAE7C,mCAA6C;AAI7C,MAAa,YAAY;IAIvB,YAA6B,EAAU,EACV,MAAoB,EACpB,MAAiB;QAFjB,OAAE,GAAF,EAAE,CAAQ;QACV,WAAM,GAAN,MAAM,CAAc;QACpB,WAAM,GAAN,MAAM,CAAW;QAE5C,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;SAC5C;QACD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;QACtC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;QACtC,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAA;QACjD,QAAQ,QAAQ,EAAE;YAChB,KAAK,OAAO,CAAC,CAAC;gBAGZ,IAAI,CAAC,WAAW,GAAG,IAAI,2BAAmB,CAAC,MAAM,CAAC,CAAA;gBAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAW,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"msg-transport.js","sourceRoot":"","sources":["../../src/transport/msg-transport.ts"],"names":[],"mappings":";;;AAAA,sCAA2E;AAC3E,mCAA6C;AAE7C,mCAA6C;AAI7C,MAAa,YAAY;IAIvB,YAA6B,EAAU,EACV,MAA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AAG,EAAE,CAAA;IACnB,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAC3B,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC9B,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACjC,MAAM,CAAC,CAAC,CAAC,CAAA;YACX,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA3DD,oCA2DC","sourcesContent":["import { AsciiParser, FiXmlParser, MsgParser, AsciiChars } from '../buffer'\r\nimport { AsciiMsgTransmitter } from './ascii'\r\nimport { MsgTransmitter } from './msg-transmitter'\r\nimport { FixmlMsgTransmitter } from './fixml'\r\nimport { FixDuplex } from './duplex'\r\nimport { IJsFixConfig } from '../config'\r\n\r\nexport class MsgTransport {\r\n public readonly transmitter: MsgTransmitter\r\n public readonly receiver: MsgParser\r\n\r\n constructor (public readonly id: number,\r\n public readonly config: IJsFixConfig,\r\n public readonly duplex: FixDuplex) {\r\n\r\n const delimiter = config.delimiter\r\n if (!delimiter) {\r\n throw new Error(`no delimiter char given.`)\r\n }\r\n const logDelimiter = config.logDelimiter || AsciiChars.Pipe\r\n const description = config.description\r\n const definitions = config.definitions\r\n const protocol = description.application.protocol\r\n switch (protocol) {\r\n case 'ascii': {\r\n // let parser replace delimiter with Pipe so fix log does not require\r\n // expensive replace\r\n this.transmitter = new AsciiMsgTransmitter(config)\r\n this.receiver = new AsciiParser(definitions, duplex.readable, delimiter, logDelimiter)\r\n break\r\n }\r\n\r\n case 'fixml': {\r\n this.transmitter = new FixmlMsgTransmitter(config)\r\n this.receiver = new FiXmlParser(config, duplex.readable)\r\n break\r\n }\r\n\r\n default: {\r\n throw new Error(`session Protocol must ascii or fixml. got ${protocol}`)\r\n }\r\n }\r\n\r\n // pipe the encoder to say a socket.\r\n if (duplex.writable) {\r\n this.transmitter.encodeStream.pipe(duplex.writable)\r\n }\r\n }\r\n\r\n public end (): void {\r\n this.duplex.end()\r\n }\r\n\r\n public wait (): Promise<any> {\r\n return new Promise<any>((resolve, reject) => {\r\n this.receiver.on('end', () => {\r\n resolve(this.id)\r\n })\r\n this.receiver.on('error', (e) => {\r\n reject(e)\r\n })\r\n this.transmitter.on('error', (e) => {\r\n reject(e)\r\n })\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -12,7 +12,7 @@ export interface ITlsOptions {
|
|
|
12
12
|
export interface ITcpTransportDescription {
|
|
13
13
|
readonly port: number;
|
|
14
14
|
readonly host: string;
|
|
15
|
-
readonly tls
|
|
15
|
+
readonly tls?: ITlsOptions;
|
|
16
16
|
}
|
|
17
17
|
export interface IHttpAdapter {
|
|
18
18
|
getOptions(data: Buffer): IHtmlOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-description.js","sourceRoot":"","sources":["../../src/transport/session-description.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\r\nexport interface ITcpTransportDescription {\r\n readonly port: number\r\n readonly host: string,\r\n readonly tls
|
|
1
|
+
{"version":3,"file":"session-description.js","sourceRoot":"","sources":["../../src/transport/session-description.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\r\nexport interface ITcpTransportDescription {\r\n readonly port: number\r\n readonly host: string,\r\n readonly tls?: ITlsOptions\r\n}\r\n\r\nexport interface IHttpAdapter {\r\n getOptions (data: Buffer): IHtmlOptions\r\n beginMessage (msgType: string): void\r\n endMessage (m: any): Buffer\r\n}\r\n\r\nexport interface IHtmlOptions {\r\n method: string,\r\n uri: string,\r\n json: boolean,\r\n body: any,\r\n headers: any,\r\n resolveWithFullResponse: boolean\r\n}\r\n\r\nexport interface IHtmlRoute {\r\n name: string,\r\n value: IHtmlOptions\r\n}\r\n\r\nexport interface IHttpTransportDescription {\r\n readonly port: number\r\n readonly uri: string,\r\n readonly options: IHtmlRoute[]\r\n adapter: IHttpAdapter\r\n}\r\n\r\nexport interface IMsgApplication {\r\n readonly name: string\r\n readonly type: string,\r\n readonly reconnectSeconds: number\r\n readonly tcp?: ITcpTransportDescription,\r\n readonly http?: IHttpTransportDescription,\r\n readonly protocol: string,\r\n readonly dictionary: string\r\n}\r\n\r\nexport interface ISessionDescription {\r\n readonly application?: IMsgApplication\r\n readonly Name: string\r\n readonly Username: string\r\n readonly Password: string\r\n HeartBtInt: number\r\n readonly SenderCompId: string\r\n readonly TargetCompID: string\r\n readonly ResetSeqNumFlag: boolean\r\n readonly LastSentSeqNum?: number\r\n readonly LastReceivedSeqNum?: number\r\n readonly SenderSubID: string\r\n readonly TargetSubID: string\r\n readonly BeginString: string\r\n readonly BodyLengthChars?: number,\r\n}\r\n"]}
|
|
@@ -16,13 +16,13 @@ export declare class SessionMsgFactory implements ISessionMsgFactory {
|
|
|
16
16
|
testRequest(reqId?: string): ILooseObject;
|
|
17
17
|
heartbeat(testReqId: string): ILooseObject;
|
|
18
18
|
resendRequest(from: number, to: number): ILooseObject;
|
|
19
|
-
sequenceReset(newSeqNo: number): ILooseObject;
|
|
19
|
+
sequenceReset(newSeqNo: number, gapFill?: boolean): ILooseObject;
|
|
20
20
|
header(msgType: string, seqNum?: number, time?: Date, overrideData?: Partial<IStandardHeader>): ILooseObject;
|
|
21
21
|
trailer(checksum: number): ILooseObject;
|
|
22
22
|
private asciiLogon;
|
|
23
23
|
private asciiLogout;
|
|
24
24
|
private fixmlLogon;
|
|
25
25
|
private fixmlLogout;
|
|
26
|
-
|
|
26
|
+
protected asciiHeader(msgType: string, seqNum: number, time: Date, overrideData?: Partial<IStandardHeader>): ILooseObject;
|
|
27
27
|
private fixmlHeader;
|
|
28
28
|
}
|
|
@@ -54,9 +54,9 @@ class SessionMsgFactory {
|
|
|
54
54
|
};
|
|
55
55
|
return this.mutator ? this.mutator(this.description, types_1.MsgType.ResendRequest, o) : o;
|
|
56
56
|
}
|
|
57
|
-
sequenceReset(newSeqNo) {
|
|
57
|
+
sequenceReset(newSeqNo, gapFill) {
|
|
58
58
|
const o = {
|
|
59
|
-
GapFillFlag: true,
|
|
59
|
+
GapFillFlag: gapFill === true,
|
|
60
60
|
NewSeqNo: newSeqNo
|
|
61
61
|
};
|
|
62
62
|
return this.mutator ? this.mutator(this.description, types_1.MsgType.SequenceReset, o) : o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-msg-factory.js","sourceRoot":"","sources":["../../src/transport/session-msg-factory.ts"],"names":[],"mappings":";;;AAGA,oCAAkC;AAElC,+CAW6B;AAE7B,oDAM4B;AAK5B,MAAa,iBAAiB;IAI5B,YAA6B,WAAgC,EAAS,UAAyB,IAAI;QAAtE,gBAAW,GAAX,WAAW,CAAqB;QAAS,YAAO,GAAP,OAAO,CAAsB;QACjG,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,QAAQ,KAAK,OAAO,CAAA;IAC7D,CAAC;IAEM,MAAM,CAAE,OAAe,EAAE,KAAa,EAAE,GAAW,EAAE,MAAc;QACxE,MAAM,CAAC,GAAY;YACjB,UAA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G,CAAC,CAAC,GAAG,CAAC,CAAA;QACpD,MAAM,CAAC,mBACL,WAAW,EAAE,WAAW,CAAC,WAAW,EACpC,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,WAAW,EAAE,WAAW,CAAC,WAAW,IACjC,YAAY,CAChB,CAAA;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC;IAEO,WAAW;QACjB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QACpC,MAAM,CAAC,GAAyB;YAC9B,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,WAAW,EAAE,WAAW,CAAC,WAAW;SACb,CAAA;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,eAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC;CACF;AArKD,8CAqKC","sourcesContent":["import { ISessionMsgFactory } from './fix-msg-factory'\r\nimport { ISessionDescription } from './session-description'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { MsgType } from '../types'\r\n\r\nimport {\r\n EncryptMethod,\r\n IHeartbeat,\r\n ILogon,\r\n ILogout,\r\n IReject,\r\n IResendRequest,\r\n ISequenceReset,\r\n IStandardHeader,\r\n IStandardTrailer,\r\n ITestRequest\r\n} from '../types/FIX4.4/repo'\r\n\r\nimport {\r\n IStandardHeader as IStandardHeaderFixml,\r\n IUserRequest,\r\n IUserResponse,\r\n UserRequestType,\r\n UserStatus\r\n} from '../types/FIXML50SP2'\r\n\r\nexport interface ObjectMutator { (description: ISessionDescription, type: string, o: ILooseObject): ILooseObject\r\n}\r\n\r\nexport class SessionMsgFactory implements ISessionMsgFactory {\r\n\r\n public isAscii: boolean\r\n\r\n constructor (public readonly description: ISessionDescription, public mutator: ObjectMutator = null) {\r\n this.isAscii = description.application.protocol === 'ascii'\r\n }\r\n\r\n public reject (msgType: string, seqNo: number, msg: string, reason: number): ILooseObject {\r\n const o: IReject = {\r\n RefMsgType: msgType,\r\n SessionRejectReason: reason,\r\n RefSeqNum: seqNo,\r\n Text: msg\r\n } as IReject\r\n return this.mutator ? this.mutator(this.description, MsgType.Reject, o) : o\r\n }\r\n\r\n public logon (userRequestId: string = '', isResponse: boolean = false): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiLogon()\r\n } else {\r\n return this.fixmlLogon(userRequestId, isResponse)\r\n }\r\n }\r\n\r\n public logout (msgType: string, text: string): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiLogout(text)\r\n } else {\r\n return this.fixmlLogout(text, msgType !== 'UserReq')\r\n }\r\n }\r\n\r\n public testRequest (reqId: string = `ping-${new Date().toUTCString()}`): ILooseObject {\r\n const o: ITestRequest = {\r\n TestReqID: reqId\r\n } as ITestRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.TestRequest, o) : o\r\n }\r\n\r\n public heartbeat (testReqId: string): ILooseObject {\r\n const o: IHeartbeat = {\r\n TestReqID: testReqId\r\n } as IHeartbeat\r\n return this.mutator ? this.mutator(this.description, MsgType.Heartbeat, o) : o\r\n }\r\n\r\n public resendRequest (from: number, to: number): ILooseObject {\r\n const o: IResendRequest = {\r\n BeginSeqNo: from,\r\n EndSeqNo: to\r\n } as IResendRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.ResendRequest, o) : o\r\n }\r\n\r\n public sequenceReset (newSeqNo: number): ILooseObject {\r\n const o: ISequenceReset = {\r\n GapFillFlag: true,\r\n NewSeqNo: newSeqNo\r\n } as ISequenceReset\r\n return this.mutator ? this.mutator(this.description, MsgType.SequenceReset, o) : o\r\n }\r\n\r\n public header (msgType: string, seqNum: number = 0, time: Date = new Date(), overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiHeader(msgType, seqNum, time, overrideData)\r\n } else {\r\n return this.fixmlHeader()\r\n }\r\n }\r\n\r\n public trailer (checksum: number): ILooseObject {\r\n const s = checksum.toString()\r\n const padded = s.padStart(3, '0')\r\n return {\r\n CheckSum: padded\r\n } as IStandardTrailer\r\n }\r\n\r\n private asciiLogon (): ILooseObject {\r\n const description = this.description\r\n const o: ILogon = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n HeartBtInt: description.HeartBtInt,\r\n ResetSeqNumFlag: description.ResetSeqNumFlag,\r\n EncryptMethod: EncryptMethod.None\r\n } as ILogon\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n\r\n private asciiLogout (text: string): ILooseObject {\r\n const o: ILogout = {\r\n Text: text\r\n } as ILogout\r\n return this.mutator ? this.mutator(this.description, MsgType.Logout, o) : o\r\n }\r\n\r\n private fixmlLogon (userRequestId: string, isResponse: boolean): ILooseObject {\r\n const description = this.description\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOnUser\r\n } as IUserRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n } else {\r\n const o: IUserResponse = {\r\n Username: description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.LoggedIn\r\n } as IUserResponse\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n }\r\n\r\n private fixmlLogout (userRequestId: string, isResponse: boolean): ILooseObject {\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOffUser\r\n } as IUserRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n } else {\r\n const o: IUserResponse = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.NotLoggedIn\r\n } as IUserResponse\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n }\r\n\r\n private asciiHeader (msgType: string, seqNum: number, time: Date, overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n const description = this.description\r\n const bodyLength: number = Math.max(4, description.BodyLengthChars || 7)\r\n const placeHolder = Math.pow(10, bodyLength - 1) + 1\r\n const o: IStandardHeader = {\r\n BeginString: description.BeginString,\r\n BodyLength: placeHolder,\r\n MsgType: msgType,\r\n SenderCompID: description.SenderCompId,\r\n MsgSeqNum: seqNum,\r\n SendingTime: time,\r\n TargetCompID: description.TargetCompID,\r\n TargetSubID: description.TargetSubID,\r\n ...overrideData\r\n }\r\n return this.mutator ? this.mutator(description, 'StandardHeader', o) : o\r\n }\r\n\r\n private fixmlHeader (): ILooseObject {\r\n const description = this.description\r\n const o: IStandardHeaderFixml = {\r\n SenderCompID: description.SenderCompId,\r\n TargetCompID: description.TargetCompID,\r\n SenderSubID: description.SenderSubID,\r\n TargetSubID: description.TargetSubID\r\n } as IStandardHeaderFixml\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"session-msg-factory.js","sourceRoot":"","sources":["../../src/transport/session-msg-factory.ts"],"names":[],"mappings":";;;AAGA,oCAAkC;AAElC,+CAW6B;AAE7B,oDAM4B;AAO5B,MAAa,iBAAiB;IAI5B,YAA6B,WAAgC,EAAS,UAAyB,IAAI;QAAtE,gBAAW,GAAX,WAAW,CAAqB;QAAS,YAAO,GAAP,OAAO,CAAsB;QACjG,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,WAAW,CAA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UAAU,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,IAAI,CAAC,CAAC,CAAA;QACxE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;QACpD,MAAM,CAAC,mBACL,WAAW,EAAE,WAAW,CAAC,WAAW,EACpC,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,WAAW,EAAE,WAAW,CAAC,WAAW,IACjC,YAAY,CAChB,CAAA;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC;IAEO,WAAW;QACjB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QACpC,MAAM,CAAC,GAAyB;YAC9B,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,WAAW,EAAE,WAAW,CAAC,WAAW;SACb,CAAA;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,eAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC;CACF;AArKD,8CAqKC","sourcesContent":["import { ISessionMsgFactory } from './fix-msg-factory'\r\nimport { ISessionDescription } from './session-description'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { MsgType } from '../types'\r\n\r\nimport {\r\n EncryptMethod,\r\n IHeartbeat,\r\n ILogon,\r\n ILogout,\r\n IReject,\r\n IResendRequest,\r\n ISequenceReset,\r\n IStandardHeader,\r\n IStandardTrailer,\r\n ITestRequest\r\n} from '../types/FIX4.4/repo'\r\n\r\nimport {\r\n IStandardHeader as IStandardHeaderFixml,\r\n IUserRequest,\r\n IUserResponse,\r\n UserRequestType,\r\n UserStatus\r\n} from '../types/FIXML50SP2'\r\n\r\nexport interface ObjectMutator { (description: ISessionDescription, type: string, o: ILooseObject): ILooseObject\r\n}\r\n\r\n\r\n\r\nexport class SessionMsgFactory implements ISessionMsgFactory {\r\n\r\n public isAscii: boolean\r\n\r\n constructor (public readonly description: ISessionDescription, public mutator: ObjectMutator = null) {\r\n this.isAscii = description.application.protocol === 'ascii'\r\n }\r\n\r\n public reject (msgType: string, seqNo: number, msg: string, reason: number): ILooseObject {\r\n const o: IReject = {\r\n RefMsgType: msgType,\r\n SessionRejectReason: reason,\r\n RefSeqNum: seqNo,\r\n Text: msg\r\n } as IReject\r\n return this.mutator ? this.mutator(this.description, MsgType.Reject, o) : o\r\n }\r\n\r\n public logon (userRequestId: string = '', isResponse: boolean = false): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiLogon()\r\n } else {\r\n return this.fixmlLogon(userRequestId, isResponse)\r\n }\r\n }\r\n\r\n public logout (msgType: string, text: string): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiLogout(text)\r\n } else {\r\n return this.fixmlLogout(text, msgType !== 'UserReq')\r\n }\r\n }\r\n\r\n public testRequest (reqId: string = `ping-${new Date().toUTCString()}`): ILooseObject {\r\n const o: ITestRequest = {\r\n TestReqID: reqId\r\n } as ITestRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.TestRequest, o) : o\r\n }\r\n\r\n public heartbeat (testReqId: string): ILooseObject {\r\n const o: IHeartbeat = {\r\n TestReqID: testReqId\r\n } as IHeartbeat\r\n return this.mutator ? this.mutator(this.description, MsgType.Heartbeat, o) : o\r\n }\r\n\r\n public resendRequest (from: number, to: number): ILooseObject {\r\n const o: IResendRequest = {\r\n BeginSeqNo: from,\r\n EndSeqNo: to\r\n } as IResendRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.ResendRequest, o) : o\r\n }\r\n\r\n public sequenceReset (newSeqNo: number, gapFill?: boolean): ILooseObject {\r\n const o: ISequenceReset = {\r\n GapFillFlag: gapFill === true,\r\n NewSeqNo: newSeqNo\r\n } as ISequenceReset\r\n return this.mutator ? this.mutator(this.description, MsgType.SequenceReset, o) : o\r\n }\r\n\r\n public header (msgType: string, seqNum: number = 0, time: Date = new Date(), overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n if (this.isAscii) {\r\n return this.asciiHeader(msgType, seqNum, time, overrideData)\r\n } else {\r\n return this.fixmlHeader()\r\n }\r\n }\r\n\r\n public trailer (checksum: number): ILooseObject {\r\n const s = checksum.toString()\r\n const padded = s.padStart(3, '0')\r\n return {\r\n CheckSum: padded\r\n } as IStandardTrailer\r\n }\r\n\r\n private asciiLogon (): ILooseObject {\r\n const description = this.description\r\n const o: ILogon = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n HeartBtInt: description.HeartBtInt,\r\n ResetSeqNumFlag: description.ResetSeqNumFlag,\r\n EncryptMethod: EncryptMethod.None\r\n } as ILogon\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n\r\n private asciiLogout (text: string): ILooseObject {\r\n const o: ILogout = {\r\n Text: text\r\n } as ILogout\r\n return this.mutator ? this.mutator(this.description, MsgType.Logout, o) : o\r\n }\r\n\r\n private fixmlLogon (userRequestId: string, isResponse: boolean): ILooseObject {\r\n const description = this.description\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: description.Username,\r\n Password: description.Password,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOnUser\r\n } as IUserRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n } else {\r\n const o: IUserResponse = {\r\n Username: description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.LoggedIn\r\n } as IUserResponse\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n }\r\n\r\n private fixmlLogout (userRequestId: string, isResponse: boolean): ILooseObject {\r\n if (!isResponse) {\r\n const o: IUserRequest = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserRequestType: UserRequestType.LogOffUser\r\n } as IUserRequest\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n } else {\r\n const o: IUserResponse = {\r\n Username: this.description.Username,\r\n UserRequestID: userRequestId,\r\n UserStatus: UserStatus.NotLoggedIn\r\n } as IUserResponse\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n }\r\n }\r\n\r\n protected asciiHeader (msgType: string, seqNum: number, time: Date, overrideData?: Partial<IStandardHeader>): ILooseObject {\r\n const description = this.description\r\n const bodyLength: number = Math.max(4, description.BodyLengthChars || 7)\r\n const placeHolder = Math.pow(10, bodyLength - 1) + 1\r\n const o: IStandardHeader = {\r\n BeginString: description.BeginString,\r\n BodyLength: placeHolder,\r\n MsgType: msgType,\r\n SenderCompID: description.SenderCompId,\r\n MsgSeqNum: seqNum,\r\n SendingTime: time,\r\n TargetCompID: description.TargetCompID,\r\n TargetSubID: description.TargetSubID,\r\n ...overrideData\r\n }\r\n return this.mutator ? this.mutator(description, 'StandardHeader', o) : o\r\n }\r\n\r\n private fixmlHeader (): ILooseObject {\r\n const description = this.description\r\n const o: IStandardHeaderFixml = {\r\n SenderCompID: description.SenderCompId,\r\n TargetCompID: description.TargetCompID,\r\n SenderSubID: description.SenderSubID,\r\n TargetSubID: description.TargetSubID\r\n } as IStandardHeaderFixml\r\n return this.mutator ? this.mutator(this.description, MsgType.Logon, o) : o\r\n } \r\n}\r\n"]}
|
|
@@ -26,9 +26,11 @@ function acceptor(config, sessionFactory) {
|
|
|
26
26
|
accept(true);
|
|
27
27
|
});
|
|
28
28
|
}).catch((e) => {
|
|
29
|
-
logger.error
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
logger.info(`error in session - close listener ${e.message}`);
|
|
30
|
+
acceptor.close(() => {
|
|
31
|
+
logger.info('acceptor closed.');
|
|
32
|
+
reject(e);
|
|
33
|
+
});
|
|
32
34
|
});
|
|
33
35
|
});
|
|
34
36
|
acceptor.listen();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptor.js","sourceRoot":"","sources":["../../../src/transport/tcp/acceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,iDAA4C;AAI5C,SAAgB,QAAQ,CAAE,MAAoB,EAAE,cAA8B;IAC5E,OAAO,IAAI,OAAO,CAAM,CAAO,MAAM,EAAE,MAAM,EAAE,EAAE;QAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACnD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxB,MAAM,QAAQ,GAAgB,IAAI,0BAAW,CAAC,MAAM,CAAC,CAAA;QACrD,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAe,EAAE,EAAE;YAC3C,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;YACrC,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;YAC9C,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC/B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBACnB,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE;oBAClB,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;oBAC/B,MAAM,CAAC,IAAI,CAAC,CAAA;gBACd,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;gBACpB,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"acceptor.js","sourceRoot":"","sources":["../../../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AAA;AACJ,CAAC;AAxBD,4BAwBC","sourcesContent":["import { IJsFixConfig } from '../../config'\r\nimport { FixAcceptor } from '../fix-acceptor'\r\nimport { TcpAcceptor } from './tcp-acceptor'\r\nimport { MsgTransport } from '../msg-transport'\r\nimport { MakeFixSession } from '../make-fixl-session'\r\n\r\nexport function acceptor (config: IJsFixConfig, sessionFactory: MakeFixSession): Promise<any> {\r\n return new Promise<any>(async (accept, reject) => {\r\n const logger = config.logFactory.logger('acceptor')\r\n logger.info('starting.')\r\n const acceptor: FixAcceptor = new TcpAcceptor(config)\r\n acceptor.on('transport', (t: MsgTransport) => {\r\n logger.info('creates new transport.')\r\n const acceptorSession = sessionFactory(config)\r\n acceptorSession.run(t).then(() => {\r\n logger.info('ends')\r\n acceptor.close(() => {\r\n logger.info('acceptor closed.')\r\n accept(true)\r\n })\r\n }).catch((e: Error) => {\r\n logger.info(`error in session - close listener ${e.message}`)\r\n acceptor.close(() => {\r\n logger.info('acceptor closed.')\r\n reject(e)\r\n })\r\n })\r\n })\r\n acceptor.listen()\r\n })\r\n}\r\n"]}
|