jspurefix 1.3.0 → 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/README.md +5 -2
- package/data/session/genkey.ps1 +179 -0
- package/dist/buffer/ascii/ascii-encoder.d.ts +1 -1
- package/dist/buffer/ascii/ascii-encoder.js +42 -30
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +2 -2
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/ascii/time-formatter.js.map +1 -1
- package/dist/buffer/elastic-buffer.js +1 -1
- package/dist/buffer/elastic-buffer.js.map +1 -1
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.js +1 -1
- 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-view.d.ts +2 -0
- package/dist/buffer/msg-view.js +2 -2
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/dict-parser.js +9 -9
- package/dist/dict-parser.js.map +1 -1
- package/dist/dictionary/compiler/msg-compiler.js +2 -2
- package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js +1 -1
- package/dist/dictionary/parser/fix-repository/repository-xml-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/jsfix-cmd.js +3 -3
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/sample/http/oms/app.js +2 -2
- package/dist/sample/http/oms/app.js.map +1 -1
- package/dist/sample/launcher.js +2 -2
- package/dist/sample/launcher.js.map +1 -1
- package/dist/sample/tcp/qf-md/app.js +2 -2
- package/dist/sample/tcp/qf-md/app.js.map +1 -1
- 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.js +1 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
- package/dist/sample/tcp/skeleton/app.js +2 -2
- 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 +21 -2
- package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js +2 -2
- package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/app.js +2 -2
- package/dist/sample/tcp/trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.d.ts +1 -0
- package/dist/sample/tcp/trade-capture/trade-capture-client.js +7 -3
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-recovery.d.ts +12 -0
- package/dist/store/fix-msg-ascii-store-recovery.js +60 -0
- package/dist/store/fix-msg-ascii-store-recovery.js.map +1 -0
- package/dist/store/fix-msg-ascii-store-replay.d.ts +13 -0
- package/dist/store/fix-msg-ascii-store-replay.js +60 -0
- package/dist/store/fix-msg-ascii-store-replay.js.map +1 -0
- package/dist/store/fix-msg-ascii-store-resend.js +3 -2
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/store/fix-replay-record.d.ts +12 -0
- package/dist/store/fix-replay-record.js +12 -0
- package/dist/store/fix-replay-record.js.map +1 -0
- package/dist/store/fix-resend-record.d.ts +12 -0
- package/dist/store/fix-resend-record.js +12 -0
- package/dist/store/fix-resend-record.js.map +1 -0
- package/dist/store/replay-record.d.ts +6 -0
- package/dist/store/replay-record.js +3 -0
- package/dist/store/replay-record.js.map +1 -0
- package/dist/store/store-replay-record.d.ts +12 -0
- package/dist/store/store-replay-record.js +12 -0
- package/dist/store/store-replay-record.js.map +1 -0
- package/dist/tcp/tls-options.d.ts +5 -0
- package/dist/tcp/tls-options.js +45 -0
- package/dist/tcp/tls-options.js.map +1 -0
- package/dist/test/ascii-encode.test.d.ts +1 -0
- package/dist/test/ascii-encode.test.js +416 -0
- package/dist/test/ascii-encode.test.js.map +1 -0
- package/dist/test/ascii-encoder.test.js +2 -2
- package/dist/test/ascii-encoder.test.js.map +1 -1
- package/dist/test/ascii-parser.test.js +9 -7
- package/dist/test/ascii-parser.test.js.map +1 -1
- package/dist/test/ascii-segment.test.js +7 -6
- package/dist/test/ascii-segment.test.js.map +1 -1
- package/dist/test/ascii-store-recovery.test.d.ts +1 -0
- package/dist/test/ascii-store-recovery.test.js +50 -0
- package/dist/test/ascii-store-recovery.test.js.map +1 -0
- package/dist/test/ascii-store-replay.test.js +2 -2
- package/dist/test/ascii-store-replay.test.js.map +1 -1
- package/dist/test/ascii-tag-pos.test.js +2 -2
- package/dist/test/ascii-tag-pos.test.js.map +1 -1
- package/dist/test/encode-proxy.test.js +1 -1
- package/dist/test/encode-proxy.test.js.map +1 -1
- package/dist/test/execution-report.test.js +2 -2
- package/dist/test/execution-report.test.js.map +1 -1
- package/dist/test/fix-log-replay.test.js +2 -2
- package/dist/test/fix-log-replay.test.js.map +1 -1
- package/dist/test/fix-repo-dict.test.js +1 -1
- package/dist/test/fix-repo-dict.test.js.map +1 -1
- package/dist/test/logon.test.js +2 -2
- package/dist/test/logon.test.js.map +1 -1
- package/dist/test/memory-store.test.js +2 -2
- package/dist/test/memory-store.test.js.map +1 -1
- package/dist/test/qf-full-msg.test.js +14 -13
- package/dist/test/qf-full-msg.test.js.map +1 -1
- package/dist/test/repo-full-ascii-msg.test.js +10 -9
- package/dist/test/repo-full-ascii-msg.test.js.map +1 -1
- package/dist/test/repo-full-fixml-msg.test.js +15 -15
- package/dist/test/repo-full-fixml-msg.test.js.map +1 -1
- package/dist/test/session.test.js +262 -143
- package/dist/test/session.test.js.map +1 -1
- package/dist/test/to-views.js +1 -1
- package/dist/test/to-views.js.map +1 -1
- package/dist/test/view-decode.test.js +2 -2
- package/dist/test/view-decode.test.js.map +1 -1
- package/dist/transport/ascii/ascii-msg-transmitter.js +6 -3
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session.d.ts +8 -0
- package/dist/transport/ascii/ascii-session.js +67 -19
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/duplex/http-duplex.js +2 -2
- package/dist/transport/duplex/http-duplex.js.map +1 -1
- package/dist/transport/fix-session-state.js +4 -1
- package/dist/transport/fix-session-state.js.map +1 -1
- package/dist/transport/fix-session.d.ts +6 -0
- package/dist/transport/fix-session.js +91 -38
- package/dist/transport/fix-session.js.map +1 -1
- package/dist/transport/http/http-acceptor.js +8 -7
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/make-config.js +1 -1
- package/dist/transport/make-config.js.map +1 -1
- package/dist/transport/session-msg-factory.d.ts +24 -2
- package/dist/transport/session-msg-factory.js +143 -3
- package/dist/transport/session-msg-factory.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_initiator.d.ts +12 -0
- package/dist/transport/tcp/recovering_initiator.js +25 -0
- package/dist/transport/tcp/recovering_initiator.js.map +1 -0
- package/dist/transport/tcp/resilient-initiator.d.ts +12 -0
- package/dist/transport/tcp/resilient-initiator.js +41 -0
- package/dist/transport/tcp/resilient-initiator.js.map +1 -0
- package/dist/transport/tcp/tcp-acceptor.d.ts +7 -0
- package/dist/transport/tcp/tcp-acceptor.js +57 -38
- package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator.d.ts +2 -0
- package/dist/transport/tcp/tcp-initiator.js +59 -32
- package/dist/transport/tcp/tcp-initiator.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/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/util/buffer-helper.js +1 -1
- package/dist/util/buffer-helper.js.map +1 -1
- package/dist/util/json-helper.js +2 -2
- package/dist/util/json-helper.js.map +1 -1
- package/dist/util/message-generator.js +1 -1
- package/dist/util/message-generator.js.map +1 -1
- package/package.json +16 -15
- package/script/genkey.ps1 +179 -179
- package/src/buffer/ascii/ascii-encoder.ts +71 -33
- package/src/buffer/ascii/ascii-view.ts +2 -2
- package/src/buffer/ascii/time-formatter.ts +2 -2
- package/src/buffer/encode-proxy.ts +2 -2
- package/src/buffer/fixml/fixml-view.ts +5 -0
- package/src/buffer/msg-view.ts +3 -0
- package/src/sample/tcp/skeleton/skeleton-session.ts +24 -2
- package/src/sample/tcp/trade-capture/trade-capture-client.ts +8 -3
- package/src/store/fix-msg-ascii-store-resend.ts +3 -2
- package/src/store/fix-msg-store-record.ts +1 -0
- package/src/transport/ascii/ascii-msg-transmitter.ts +6 -3
- package/src/transport/ascii/ascii-session.ts +75 -19
- package/src/transport/duplex/http-duplex.ts +2 -2
- package/src/transport/fix-session-state.ts +4 -1
- package/src/transport/fix-session.ts +98 -37
- package/src/transport/http/http-acceptor.ts +7 -6
- package/src/transport/tcp/tcp-acceptor.ts +59 -35
- package/src/transport/tcp/tcp-initiator.ts +63 -38
package/dist/sample/launcher.js
CHANGED
|
@@ -48,8 +48,8 @@ class Launcher {
|
|
|
48
48
|
const clientDescription = require(path.join(root, this.initiatorConfig));
|
|
49
49
|
const serverDescription = require(path.join(root, this.acceptorConfig));
|
|
50
50
|
this.logger.info(`launching [protocol ${clientDescription.application.protocol}] ...`);
|
|
51
|
-
const clientConfig = yield
|
|
52
|
-
const serverConfig = yield
|
|
51
|
+
const clientConfig = yield transport_1.makeConfig(clientDescription, logFactory, this.makeSessionFactory(clientDescription));
|
|
52
|
+
const serverConfig = yield transport_1.makeConfig(serverDescription, logFactory, this.makeSessionFactory(serverDescription));
|
|
53
53
|
this.logger.info('create acceptor');
|
|
54
54
|
const server = this.getAcceptor(serverConfig);
|
|
55
55
|
this.logger.info('create initiator');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/sample/launcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA4B;AAC5B,sCAA6F;AAC7F,4CAAkF;AAClF,8CAA2D;AAC3D,8CAA2D;AAE3D,MAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,MAAM,UAAU,GAAG,IAAI,+BAAsB,CAAC,sBAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;AAEnF,MAAsB,QAAQ;IAE5B,YAAuC,eAAuB,EAAkB,cAAsB;QAA/D,oBAAe,GAAf,eAAe,CAAQ;QAAkB,mBAAc,GAAd,cAAc,CAAQ;QACpG,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAC7C,CAAC;IAKM,GAAG;QACR,OAAO,IAAI,OAAO,CAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;YAC1B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;gBACtB,MAAM,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AI,CAAC,uBAAuB,iBAAiB,CAAC,WAAW,CAAC,QAAQ,OAAO,CAAC,CAAA;YACtF,MAAM,YAAY,GAAG,MACrB,sBAAU,CAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAA;YACrF,MAAM,YAAY,GAAG,MACrB,sBAAU,CAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAA;YACrF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;YAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAA;YAC9C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAClC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QACtC,CAAC;KAAA;CACF;AA9CD,4BA8CC","sourcesContent":["import * as path from 'path'\r\nimport { WinstonLogger, IJsFixConfig, JsFixWinstonLogFactory, IJsFixLogger } from '../config'\r\nimport { makeConfig, ISessionDescription, ISessionMsgFactory } from '../transport'\r\nimport { AsciiSessionMsgFactory } from '../transport/ascii'\r\nimport { FixmlSessionMsgFactory } from '../transport/fixml'\r\n\r\nconst root = '../../'\r\nconst logFactory = new JsFixWinstonLogFactory(WinstonLogger.consoleOptions('info'))\r\n\r\nexport abstract class Launcher {\r\n protected readonly logger: IJsFixLogger\r\n protected constructor (public readonly initiatorConfig: string, public readonly acceptorConfig: string) {\r\n this.logger = logFactory.logger('launcher')\r\n }\r\n\r\n protected abstract getInitiator (config: IJsFixConfig): Promise<any>\r\n protected abstract getAcceptor (config: IJsFixConfig): Promise<any>\r\n\r\n public run () {\r\n return new Promise<any>((accept, reject) => {\r\n const logger = this.logger\r\n logger.info('launching ..')\r\n this.setup().then(() => {\r\n logger.info('.. done')\r\n accept(true)\r\n }).catch((e: Error) => {\r\n logger.error(e)\r\n reject(e)\r\n })\r\n })\r\n }\r\n\r\n private makeSessionFactory (description: ISessionDescription): ISessionMsgFactory {\r\n const fixml = description.application.protocol !== 'ascii'\r\n const factory = fixml ?\r\n new FixmlSessionMsgFactory(description) :\r\n new AsciiSessionMsgFactory(description)\r\n return factory\r\n }\r\n\r\n private async setup () {\r\n const clientDescription: ISessionDescription = require(path.join(root, this.initiatorConfig))\r\n const serverDescription: ISessionDescription = require(path.join(root, this.acceptorConfig))\r\n this.logger.info(`launching [protocol ${clientDescription.application.protocol}] ...`)\r\n const clientConfig = await\r\n makeConfig(clientDescription, logFactory, this.makeSessionFactory(clientDescription))\r\n const serverConfig = await\r\n makeConfig(serverDescription, logFactory, this.makeSessionFactory(serverDescription))\r\n this.logger.info('create acceptor')\r\n const server = this.getAcceptor(serverConfig)\r\n this.logger.info('create initiator')\r\n const client = this.getInitiator(clientConfig)\r\n this.logger.info('launching ....')\r\n return Promise.all([server, client])\r\n }\r\n}\r\n"]}
|
|
@@ -9,10 +9,10 @@ class AppLauncher extends launcher_1.Launcher {
|
|
|
9
9
|
super('data/session/test-qf44-initiator.json', 'data/session/test-qf44-acceptor.json');
|
|
10
10
|
}
|
|
11
11
|
getAcceptor(config) {
|
|
12
|
-
return
|
|
12
|
+
return transport_1.acceptor(config, c => new md_server_1.MDServer(c));
|
|
13
13
|
}
|
|
14
14
|
getInitiator(config) {
|
|
15
|
-
return
|
|
15
|
+
return transport_1.initiator(config, c => new md_client_1.MDClient(c));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const l = new AppLauncher();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/qf-md/app.ts"],"names":[],"mappings":";;AAAA,2CAAsC;AACtC,2CAAsC;AAEtC,kDAAwD;AACxD,6CAAyC;AAEzC,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,uCAAuC,EACvC,sCAAsC,CAAC,CAAA;IAC3C,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/qf-md/app.ts"],"names":[],"mappings":";;AAAA,2CAAsC;AACtC,2CAAsC;AAEtC,kDAAwD;AACxD,6CAAyC;AAEzC,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,uCAAuC,EACvC,sCAAsC,CAAC,CAAA;IAC3C,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,oBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,oBAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;IAES,YAAY,CAAE,MAAoB;QAC1C,OAAO,qBAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,oBAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD,CAAC;CACF;AAED,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE,CAAA;AAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA","sourcesContent":["import { MDClient } from './md-client'\r\nimport { MDServer } from './md-server'\r\nimport { IJsFixConfig } from '../../../config'\r\nimport { initiator, acceptor } from '../../../transport'\r\nimport { Launcher } from '../../launcher'\r\n\r\nclass AppLauncher extends Launcher {\r\n public constructor () {\r\n super(\r\n 'data/session/test-qf44-initiator.json',\r\n 'data/session/test-qf44-acceptor.json')\r\n }\r\n\r\n protected getAcceptor (config: IJsFixConfig): Promise<any> {\r\n return acceptor(config, c => new MDServer(c))\r\n }\r\n\r\n protected getInitiator (config: IJsFixConfig): Promise<any> {\r\n return initiator(config, c => new MDClient(c))\r\n }\r\n}\r\n\r\nconst l = new AppLauncher()\r\nl.run().then(() => {\r\n console.log('finished.')\r\n})\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"respawn-2.js","sourceRoot":"","sources":["../../../../src/sample/tcp/recovering-skeleton/respawn-2.ts"],"names":[],"mappings":"AAAA,MAAO,KAAK;CAEX","sourcesContent":["class fffff {\r\n\r\n}"]}
|
|
@@ -24,7 +24,7 @@ class RespawnAcceptor {
|
|
|
24
24
|
while (respawned <= respawns) {
|
|
25
25
|
try {
|
|
26
26
|
this.logger.info(`waitFor: waiting for acceptor respawned = ${respawned}`);
|
|
27
|
-
yield
|
|
27
|
+
yield transport_1.acceptor(this.config, (c) => {
|
|
28
28
|
const dropConnectionTimeout = respawned === 0 ? 5 : -1;
|
|
29
29
|
this.logger.info(`waitFor: create a new acceptor session respawned = ${respawned}, dropConnectionTimeout = ${dropConnectionTimeout}`);
|
|
30
30
|
return new skeleton_server_1.SkeletonServer(c, dropConnectionTimeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"respawn-acceptor.js","sourceRoot":"","sources":["../../../../src/sample/tcp/recovering-skeleton/respawn-acceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA6C;AAC7C,uDAAkD;AAElD,MAAa,eAAe;IAG1B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAC3D,CAAC;IAKY,OAAO,CAAE,WAAmB,CAAC;;YACxC,OAAO,IAAI,OAAO,CAAM,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;gBAChD,IAAI,SAAS,GAAG,CAAC,CAAA;gBACjB,OAAO,SAAS,IAAI,QAAQ,EAAE;oBAC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AAC,EAAE;oBACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAA;oBAC5D,MAAM,CAAC,SAAS,CAAC,CAAA;iBAClB;qBAAM;oBACL,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,SAAS,EAAE,CAAC,CAAA;oBAC1C,OAAO,CAAC,SAAS,CAAC,CAAA;iBACnB;YACH,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AApCD,0CAoCC","sourcesContent":["import { IJsFixConfig, IJsFixLogger } from '../../../config'\r\nimport { acceptor } from '../../../transport'\r\nimport { SkeletonServer } from './skeleton-server'\r\n\r\nexport class RespawnAcceptor {\r\n private readonly logger: IJsFixLogger\r\n\r\n constructor (public readonly config: IJsFixConfig) {\r\n this.logger = config.logFactory.logger('RespawnAcceptor')\r\n }\r\n\r\n // if acceptor errors e.g. via a forced connection drop, then respawn\r\n // a set number of times.\r\n\r\n public async waitFor (respawns: number = 1): Promise<any> {\r\n return new Promise<any>(async (resolve, reject) => {\r\n let respawned = 0\r\n while (respawned <= respawns) {\r\n try {\r\n this.logger.info(`waitFor: waiting for acceptor respawned = ${respawned}`)\r\n await acceptor(this.config, (c) => {\r\n const dropConnectionTimeout = respawned === 0 ? 5 : -1\r\n this.logger.info(`waitFor: create a new acceptor session respawned = ${respawned}, dropConnectionTimeout = ${dropConnectionTimeout}`)\r\n return new SkeletonServer(c, dropConnectionTimeout)\r\n })\r\n break\r\n } catch (e) {\r\n this.logger.info(`waitFor: error in acceptor respawned = ${respawned}`)\r\n }\r\n ++respawned\r\n }\r\n if (respawned > 0) {\r\n this.logger.info(`acceptor respawned reject = ${respawned}`)\r\n reject(respawned)\r\n } else {\r\n this.logger.info(`resolve = ${respawned}`)\r\n resolve(respawned)\r\n }\r\n })\r\n }\r\n}\r\n"]}
|
|
@@ -8,10 +8,10 @@ class AppLauncher extends launcher_1.Launcher {
|
|
|
8
8
|
super('data/session/test-initiator.json', 'data/session/test-acceptor.json');
|
|
9
9
|
}
|
|
10
10
|
getAcceptor(config) {
|
|
11
|
-
return
|
|
11
|
+
return transport_1.acceptor(config, c => new skeleton_session_1.SkeletonSession(c));
|
|
12
12
|
}
|
|
13
13
|
getInitiator(config) {
|
|
14
|
-
return
|
|
14
|
+
return transport_1.initiator(config, c => new skeleton_session_1.SkeletonSession(c));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
const l = new AppLauncher();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/skeleton/app.ts"],"names":[],"mappings":";;AACA,6CAAyC;AACzC,yDAAoD;AACpD,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,kCAAkC,EAClC,iCAAiC,CAAC,CAAA;IACtC,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/skeleton/app.ts"],"names":[],"mappings":";;AACA,6CAAyC;AACzC,yDAAoD;AACpD,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,kCAAkC,EAClC,iCAAiC,CAAC,CAAA;IACtC,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,oBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,kCAAe,CAAC,CAAC,CAAC,CAAC,CAAA;IACtD,CAAC;IAES,YAAY,CAAE,MAAoB;QAC1C,OAAO,qBAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,kCAAe,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAED,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE,CAAA;AAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC,CAAC,CAAA","sourcesContent":["import { IJsFixConfig } from '../../../config'\r\nimport { Launcher } from '../../launcher'\r\nimport { SkeletonSession } from './skeleton-session'\r\nimport { initiator, acceptor } from '../../../transport'\r\n\r\nclass AppLauncher extends Launcher {\r\n public constructor () {\r\n super(\r\n 'data/session/test-initiator.json',\r\n 'data/session/test-acceptor.json')\r\n }\r\n\r\n protected getAcceptor (config: IJsFixConfig): Promise<any> {\r\n return acceptor(config, c => new SkeletonSession(c))\r\n }\r\n\r\n protected getInitiator (config: IJsFixConfig): Promise<any> {\r\n return initiator(config, c => new SkeletonSession(c))\r\n }\r\n}\r\n\r\nconst l = new AppLauncher()\r\nl.run().then(() => {\r\n console.log('finished.')\r\n}).catch((e: Error) => {\r\n console.log(e.message)\r\n})\r\n"]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { MsgView } from '../../../buffer';
|
|
2
2
|
import { AsciiSession } from '../../../transport';
|
|
3
3
|
import { IJsFixConfig } from '../../../config';
|
|
4
|
+
import { ILooseObject } from '../../../collections/collection';
|
|
4
5
|
export declare class SkeletonSession extends AsciiSession {
|
|
5
6
|
readonly config: IJsFixConfig;
|
|
6
7
|
readonly logoutSeconds: number;
|
|
8
|
+
useInMemoryStore: boolean;
|
|
7
9
|
private readonly logger;
|
|
8
10
|
private readonly fixLog;
|
|
9
|
-
constructor(config: IJsFixConfig, logoutSeconds?: number);
|
|
11
|
+
constructor(config: IJsFixConfig, logoutSeconds?: number, useInMemoryStore?: boolean);
|
|
10
12
|
protected onApplicationMsg(msgType: string, view: MsgView): void;
|
|
13
|
+
private dispatch;
|
|
14
|
+
sendMessage(msgType: string, obj: ILooseObject): void;
|
|
11
15
|
protected onDecoded(msgType: string, txt: string): void;
|
|
12
16
|
protected onEncoded(msgType: string, txt: string): void;
|
|
13
17
|
protected onLogon(view: MsgView, user: string, password: string): boolean;
|
|
@@ -3,22 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SkeletonSession = void 0;
|
|
4
4
|
const transport_1 = require("../../../transport");
|
|
5
5
|
class SkeletonSession extends transport_1.AsciiSession {
|
|
6
|
-
constructor(config, logoutSeconds = 45) {
|
|
6
|
+
constructor(config, logoutSeconds = 45, useInMemoryStore = false) {
|
|
7
7
|
super(config);
|
|
8
8
|
this.config = config;
|
|
9
9
|
this.logoutSeconds = logoutSeconds;
|
|
10
|
+
this.useInMemoryStore = useInMemoryStore;
|
|
10
11
|
this.logReceivedMsgs = true;
|
|
11
12
|
this.fixLog = config.logFactory.plain(`jsfix.${config.description.application.name}.txt`);
|
|
12
13
|
this.logger = config.logFactory.logger(`${this.me}`);
|
|
13
14
|
}
|
|
14
15
|
onApplicationMsg(msgType, view) {
|
|
16
|
+
if (this.useInMemoryStore) {
|
|
17
|
+
const rec = view.toMsgStoreRecord();
|
|
18
|
+
this.store.put(rec).then(r => {
|
|
19
|
+
this.logger.info(`store state ${JSON.stringify(r, null, 4)}`);
|
|
20
|
+
this.dispatch(msgType, view);
|
|
21
|
+
}).catch(e => {
|
|
22
|
+
this.logger.error(e);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.dispatch(msgType, view);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
dispatch(msgType, view) {
|
|
30
|
+
const o = view.toObject();
|
|
15
31
|
switch (msgType) {
|
|
16
32
|
default: {
|
|
17
|
-
this.logger.info(`received message type ${msgType}`);
|
|
33
|
+
this.logger.info(`received message type ${msgType} ${JSON.stringify(o, null, 4)}`);
|
|
18
34
|
break;
|
|
19
35
|
}
|
|
20
36
|
}
|
|
21
37
|
}
|
|
38
|
+
sendMessage(msgType, obj) {
|
|
39
|
+
this.send(msgType, obj);
|
|
40
|
+
}
|
|
22
41
|
onDecoded(msgType, txt) {
|
|
23
42
|
this.fixLog.info(txt);
|
|
24
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton-session.js","sourceRoot":"","sources":["../../../../src/sample/tcp/skeleton/skeleton-session.ts"],"names":[],"mappings":";;;AACA,kDAAiD;
|
|
1
|
+
{"version":3,"file":"skeleton-session.js","sourceRoot":"","sources":["../../../../src/sample/tcp/skeleton/skeleton-session.ts"],"names":[],"mappings":";;;AACA,kDAAiD;AAIjD,MAAa,eAAgB,SAAQ,wBAAY;IAI/C,YAA6B,MAAoB,EACpB,gBAAwB,EAAE,EACnC,mBAA4B,KAAK;QACnD,KAAK,CAAC,MAAM,CAAC,CAAA;QAHc,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAAa;QACnC,qBAAgB,GAAhB,gBAAgB,CAAiB;QAEnD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,CAAA;QACzF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;IACtD,CAAC;IAES,gBAAgB,CAAE,OAAe,EAAE,IAAa;QAExD,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;YACnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;gBAC7D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AM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAA;QAClD,QAAQ,CAAC,EAAE;YACT,KAAK,WAAW,CAAC,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,aAAa,EAAE,CAAC,CAAA;gBACtD,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,CAAC,IAAI,EAAE,CAAA;gBACb,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC,CAAA;gBACxB,MAAK;aACN;YAED,KAAK,UAAU,CAAC,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;gBAClD,MAAK;aACN;YAED,OAAO,CAAC,CAAC;gBACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAA;gBACxC,MAAK;aACN;SACF;IACH,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;CACF;AArFD,0CAqFC","sourcesContent":["import { MsgView } from '../../../buffer'\r\nimport { AsciiSession } from '../../../transport'\r\nimport { IJsFixLogger, IJsFixConfig } from '../../../config'\r\nimport { ILooseObject } from '../../../collections/collection'\r\n\r\nexport class SkeletonSession extends AsciiSession {\r\n private readonly logger: IJsFixLogger\r\n private readonly fixLog: IJsFixLogger\r\n\r\n constructor (public readonly config: IJsFixConfig,\r\n public readonly logoutSeconds: number = 45,\r\n public useInMemoryStore: boolean = false) {\r\n super(config)\r\n this.logReceivedMsgs = true\r\n this.fixLog = config.logFactory.plain(`jsfix.${config.description.application.name}.txt`)\r\n this.logger = config.logFactory.logger(`${this.me}`)\r\n }\r\n\r\n protected onApplicationMsg (msgType: string, view: MsgView): void {\r\n // dispatch messages\r\n if (this.useInMemoryStore) {\r\n const rec = view.toMsgStoreRecord()\r\n this.store.put(rec).then(r => {\r\n this.logger.info(`store state ${JSON.stringify(r, null, 4)}`)\r\n this.dispatch(msgType, view)\r\n }).catch(e => {\r\n this.logger.error(e)\r\n })\r\n } else {\r\n this.dispatch(msgType, view)\r\n }\r\n }\r\n\r\n private dispatch (msgType: string, view: MsgView) {\r\n const o = view.toObject()\r\n switch (msgType) {\r\n default: {\r\n this.logger.info(`received message type ${msgType} ${JSON.stringify(o, null, 4)}`)\r\n break\r\n }\r\n }\r\n }\r\n\r\n public sendMessage (msgType: string, obj: ILooseObject): void {\r\n this.send(msgType, obj)\r\n }\r\n\r\n // use msgType for example to persist only trade capture messages to database\r\n protected onDecoded (msgType: string, txt: string): void {\r\n this.fixLog.info(txt)\r\n }\r\n\r\n // delimiter substitution now done in encoding\r\n protected onEncoded (msgType: string, txt: string): void {\r\n this.fixLog.info(txt)\r\n }\r\n\r\n protected onLogon (view: MsgView, user: string, password: string): boolean {\r\n this.logger.info(`peer logs in user ${user}`)\r\n return true\r\n }\r\n\r\n protected onReady (view: MsgView): void {\r\n this.logger.info('onReady')\r\n const logoutSeconds = this.logoutSeconds\r\n const t = this.config.description.application.type\r\n switch (t) {\r\n case 'initiator': {\r\n this.logger.info(`will logout after ${logoutSeconds}`)\r\n setTimeout(() => {\r\n this.done()\r\n }, logoutSeconds * 1000)\r\n break\r\n }\r\n\r\n case 'acceptor': {\r\n this.logger.info(`acceptor is ready for requests`)\r\n break\r\n }\r\n\r\n default: {\r\n this.logger.warning(`unknown type ${t}`)\r\n break\r\n }\r\n }\r\n }\r\n\r\n protected onStopped (): void {\r\n this.logger.info('stopped')\r\n }\r\n}\r\n"]}
|
|
@@ -8,12 +8,12 @@ class AppLauncher extends launcher_1.Launcher {
|
|
|
8
8
|
super('data/session/test-initiator-tls.json', 'data/session/test-acceptor-tls.json');
|
|
9
9
|
}
|
|
10
10
|
getAcceptor(config) {
|
|
11
|
-
return
|
|
11
|
+
return transport_1.acceptor(config, c => {
|
|
12
12
|
return new trade_capture_1.TradeCaptureServer(c);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
getInitiator(config) {
|
|
16
|
-
return
|
|
16
|
+
return transport_1.initiator(config, c => {
|
|
17
17
|
return new trade_capture_1.TradeCaptureClient(c);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/tls-trade-capture/app.ts"],"names":[],"mappings":";;AAAA,oDAAyE;AAEzE,6CAAyC;AACzC,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,sCAAsC,EACtC,qCAAqC,CAAC,CAAA;IAC1C,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/tls-trade-capture/app.ts"],"names":[],"mappings":";;AAAA,oDAAyE;AAEzE,6CAAyC;AACzC,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,sCAAsC,EACtC,qCAAqC,CAAC,CAAA;IAC1C,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,oBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;YAC1B,OAAO,IAAI,kCAAkB,CAAC,CAAC,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC;IAES,YAAY,CAAE,MAAoB;QAC1C,OAAO,qBAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;YAC3B,OAAO,IAAI,kCAAkB,CAAC,CAAC,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE,CAAA;AAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClB,CAAC,CAAC,CAAA","sourcesContent":["import { TradeCaptureClient, TradeCaptureServer } from '../trade-capture'\r\nimport { IJsFixConfig } from '../../../config'\r\nimport { Launcher } from '../../launcher'\r\nimport { initiator, acceptor } from '../../../transport'\r\n\r\nclass AppLauncher extends Launcher {\r\n public constructor () {\r\n super(\r\n 'data/session/test-initiator-tls.json',\r\n 'data/session/test-acceptor-tls.json')\r\n }\r\n\r\n protected getAcceptor (config: IJsFixConfig): Promise<any> {\r\n return acceptor(config, c => {\r\n return new TradeCaptureServer(c)\r\n })\r\n }\r\n\r\n protected getInitiator (config: IJsFixConfig): Promise<any> {\r\n return initiator(config, c => {\r\n return new TradeCaptureClient(c)\r\n })\r\n }\r\n}\r\n\r\nconst l = new AppLauncher()\r\nl.run().then(() => {\r\n console.log('finished.')\r\n}).catch(e => {\r\n console.error(e)\r\n})\r\n"]}
|
|
@@ -9,10 +9,10 @@ class AppLauncher extends launcher_1.Launcher {
|
|
|
9
9
|
super('data/session/test-initiator.json', 'data/session/test-acceptor.json');
|
|
10
10
|
}
|
|
11
11
|
getAcceptor(config) {
|
|
12
|
-
return
|
|
12
|
+
return transport_1.acceptor(config, c => new trade_capture_server_1.TradeCaptureServer(c));
|
|
13
13
|
}
|
|
14
14
|
getInitiator(config) {
|
|
15
|
-
return
|
|
15
|
+
return transport_1.initiator(config, c => new trade_capture_client_1.TradeCaptureClient(c));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const l = new AppLauncher();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/trade-capture/app.ts"],"names":[],"mappings":";;AAAA,iEAA2D;AAC3D,iEAA2D;AAE3D,6CAAyC;AACzC,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,kCAAkC,EAClC,iCAAiC,CAAC,CAAA;IACtC,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/sample/tcp/trade-capture/app.ts"],"names":[],"mappings":";;AAAA,iEAA2D;AAC3D,iEAA2D;AAE3D,6CAAyC;AACzC,kDAAwD;AAExD,MAAM,WAAY,SAAQ,mBAAQ;IAChC;QACE,KAAK,CACH,kCAAkC,EAClC,iCAAiC,CAAC,CAAA;IACtC,CAAC;IAES,WAAW,CAAE,MAAoB;QACzC,OAAO,oBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,yCAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC;IAES,YAAY,CAAE,MAAoB;QAC1C,OAAO,qBAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,yCAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1D,CAAC;CACF;AAED,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE,CAAA;AAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClB,CAAC,CAAC,CAAA","sourcesContent":["import { TradeCaptureClient } from './trade-capture-client'\r\nimport { TradeCaptureServer } from './trade-capture-server'\r\nimport { IJsFixConfig } from '../../../config'\r\nimport { Launcher } from '../../launcher'\r\nimport { initiator, acceptor } from '../../../transport'\r\n\r\nclass AppLauncher extends Launcher {\r\n public constructor () {\r\n super(\r\n 'data/session/test-initiator.json',\r\n 'data/session/test-acceptor.json')\r\n }\r\n\r\n protected getAcceptor (config: IJsFixConfig): Promise<any> {\r\n return acceptor(config, c => new TradeCaptureServer(c))\r\n }\r\n\r\n protected getInitiator (config: IJsFixConfig): Promise<any> {\r\n return initiator(config, c => new TradeCaptureClient(c))\r\n }\r\n}\r\n\r\nconst l = new AppLauncher()\r\nl.run().then(() => {\r\n console.log('finished.')\r\n}).catch(e => {\r\n console.error(e)\r\n})\r\n"]}
|
|
@@ -11,6 +11,7 @@ export declare class TradeCaptureClient extends AsciiSession {
|
|
|
11
11
|
protected onStopped(): void;
|
|
12
12
|
protected onDecoded(msgType: string, txt: string): void;
|
|
13
13
|
protected onEncoded(msgType: string, txt: string): void;
|
|
14
|
+
private logoutTimer;
|
|
14
15
|
protected onReady(view: MsgView): void;
|
|
15
16
|
protected onLogon(view: MsgView, user: string, password: string): boolean;
|
|
16
17
|
}
|
|
@@ -39,17 +39,21 @@ class TradeCaptureClient extends transport_1.AsciiSession {
|
|
|
39
39
|
onEncoded(msgType, txt) {
|
|
40
40
|
this.fixLog.info(txt);
|
|
41
41
|
}
|
|
42
|
+
logoutTimer(logoutSeconds = 32) {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
this.done();
|
|
45
|
+
}, logoutSeconds * 1000);
|
|
46
|
+
}
|
|
42
47
|
onReady(view) {
|
|
43
48
|
this.logger.info('ready');
|
|
44
49
|
const tcr = trade_factory_1.TradeFactory.tradeCaptureReportRequest('all-trades', new Date());
|
|
45
50
|
this.send(types_1.MsgType.TradeCaptureReportRequest, tcr);
|
|
46
51
|
const logoutSeconds = 32;
|
|
47
52
|
this.logger.info(`will logout after ${logoutSeconds}`);
|
|
48
|
-
|
|
49
|
-
this.done();
|
|
50
|
-
}, logoutSeconds * 1000);
|
|
53
|
+
this.logoutTimer();
|
|
51
54
|
}
|
|
52
55
|
onLogon(view, user, password) {
|
|
56
|
+
this.logger.info(`onLogon user ${user}`);
|
|
53
57
|
return true;
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trade-capture-client.js","sourceRoot":"","sources":["../../../../src/sample/tcp/trade-capture/trade-capture-client.ts"],"names":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C,QAAQ,EAAE,CAAA;gBACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,cAAc,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAA;gBAClF,MAAK;aACN;SACF;IACH,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;IAGS,SAAS,CAAE,OAAe,EAAE,GAAW;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAGS,SAAS,CAAE,OAAe,EAAE,GAAW;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAES,OAAO,CAAE,IAAa;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACzB,MAAM,GAAG,GAA+B,4BAAY,CAAC,yBAAyB,CAAC,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;QAExG,IAAI,CAAC,IAAI,CAAC,eAAO,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,aAAa,EAAE,CAAC,CAAA;QACtD,
|
|
1
|
+
{"version":3,"file":"trade-capture-client.js","sourceRoot":"","sources":["../../../../src/sample/tcp/trade-capture/trade-capture-client.ts"],"names":[],"mappings":";;;AACA,kDAAiD;AACjD,0CAAwC;AAGxC,sDAAiD;AACjD,mDAA8C;AAE9C,MAAa,kBAAmB,SAAQ,wBAAY;IAKlD,YAA6B,MAAoB;QAC/C,KAAK,CAAC,MAAM,CAAC,CAAA;QADc,WAAM,GAAN,MAAM,CAAc;QAE/C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAU,EAAuB,CAAA;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C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAGS,SAAS,CAAE,OAAe,EAAE,GAAW;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAEO,WAAW,CAAE,gBAAwB,EAAE;QAC7C,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,IAAI,EAAE,CAAA;QACb,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC,CAAA;IAC1B,CAAC;IAES,OAAO,CAAE,IAAa;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACzB,MAAM,GAAG,GAA+B,4BAAY,CAAC,yBAAyB,CAAC,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;QAExG,IAAI,CAAC,IAAI,CAAC,eAAO,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,aAAa,EAAE,CAAC,CAAA;QACtD,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAES,OAAO,CAAE,IAAa,EAAE,IAAY,EAAE,QAAgB;QAC9D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAA;QACxC,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAlED,gDAkEC","sourcesContent":["import { MsgView } from '../../../buffer'\r\nimport { AsciiSession } from '../../../transport'\r\nimport { MsgType } from '../../../types'\r\nimport { ITradeCaptureReport, ITradeCaptureReportRequest, ITradeCaptureReportRequestAck } from '../../../types/FIX4.4/repo'\r\nimport { IJsFixLogger, IJsFixConfig } from '../../../config'\r\nimport { Dictionary } from '../../../collections'\r\nimport { TradeFactory } from './trade-factory'\r\n\r\nexport class TradeCaptureClient extends AsciiSession {\r\n private readonly logger: IJsFixLogger\r\n private readonly fixLog: IJsFixLogger\r\n private reports: Dictionary<ITradeCaptureReport>\r\n\r\n constructor (public readonly config: IJsFixConfig) {\r\n super(config)\r\n this.logReceivedMsgs = true\r\n this.reports = new Dictionary<ITradeCaptureReport>()\r\n this.fixLog = config.logFactory.plain(`jsfix.${config.description.application.name}.txt`)\r\n this.logger = config.logFactory.logger(`${this.me}:TradeCaptureClient`)\r\n }\r\n\r\n protected onApplicationMsg (msgType: string, view: MsgView): void {\r\n this.logger.info(`${view.toJson()}`)\r\n switch (msgType) {\r\n case MsgType.TradeCaptureReport: {\r\n // create an object and cast to the interface\r\n const tc: ITradeCaptureReport = view.toObject()\r\n this.reports.addUpdate(tc.TradeReportID, tc)\r\n this.logger.info(`[reports: ${this.reports.count()}] received tc ExecID = ${tc.ExecID} TradeReportID = ${tc.TradeReportID} Symbol = ${tc.Instrument.Symbol} ${tc.LastQty} @ ${tc.LastPx}`)\r\n break\r\n }\r\n\r\n case MsgType.TradeCaptureReportRequestAck: {\r\n const tc: ITradeCaptureReportRequestAck = view.toObject()\r\n this.logger.info(`received tcr ack ${tc.TradeRequestID} ${tc.TradeRequestStatus}`)\r\n break\r\n }\r\n }\r\n }\r\n\r\n protected onStopped (): void {\r\n this.logger.info('stopped')\r\n }\r\n\r\n // use msgType for example to persist only trade capture messages to database\r\n protected onDecoded (msgType: string, txt: string): void {\r\n this.fixLog.info(txt)\r\n }\r\n\r\n // delimiter substitution now done in encoding\r\n protected onEncoded (msgType: string, txt: string): void {\r\n this.fixLog.info(txt)\r\n }\r\n\r\n private logoutTimer (logoutSeconds: number = 32) {\r\n setTimeout(() => {\r\n this.done()\r\n }, logoutSeconds * 1000)\r\n }\r\n\r\n protected onReady (view: MsgView): void {\r\n this.logger.info('ready')\r\n const tcr: ITradeCaptureReportRequest = TradeFactory.tradeCaptureReportRequest('all-trades', new Date())\r\n // send request to server\r\n this.send(MsgType.TradeCaptureReportRequest, tcr)\r\n const logoutSeconds = 32\r\n this.logger.info(`will logout after ${logoutSeconds}`)\r\n this.logoutTimer()\r\n }\r\n\r\n protected onLogon (view: MsgView, user: string, password: string): boolean {\r\n this.logger.info(`onLogon user ${user}`)\r\n return true\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFixMsgStore } from './fix-msg-store';
|
|
2
|
+
import { ILooseObject } from '../collections/collection';
|
|
3
|
+
import { IFixMsgStoreRecord } from './fix-msg-store-record';
|
|
4
|
+
import { IJsFixConfig } from '../config';
|
|
5
|
+
export declare class FixMsgAsciiStoreRecovery {
|
|
6
|
+
readonly store: IFixMsgStore;
|
|
7
|
+
readonly config: IJsFixConfig;
|
|
8
|
+
constructor(store: IFixMsgStore, config: IJsFixConfig);
|
|
9
|
+
getReplayRequest(startSeq: number, endSeq: number): ILooseObject[];
|
|
10
|
+
createMsg(record: IFixMsgStoreRecord): ILooseObject;
|
|
11
|
+
gap(newSeq: number): ILooseObject;
|
|
12
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixMsgAsciiStoreRecovery = void 0;
|
|
4
|
+
const buffer_1 = require("../buffer");
|
|
5
|
+
class FixMsgAsciiStoreRecovery {
|
|
6
|
+
constructor(store, config) {
|
|
7
|
+
this.store = store;
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
getReplayRequest(startSeq, endSeq) {
|
|
11
|
+
const arr = [];
|
|
12
|
+
let seqNum = startSeq;
|
|
13
|
+
let beginGap = 0;
|
|
14
|
+
while (seqNum <= endSeq) {
|
|
15
|
+
const record = this.store.getSeqNum(seqNum);
|
|
16
|
+
if (record !== null) {
|
|
17
|
+
if (beginGap > 0) {
|
|
18
|
+
arr.push(this.gap(beginGap));
|
|
19
|
+
if (seqNum > beginGap) {
|
|
20
|
+
arr.push(this.gap(seqNum));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
arr.push(this.createMsg(record));
|
|
24
|
+
beginGap = 0;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
if (beginGap === 0) {
|
|
28
|
+
beginGap = seqNum;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
++seqNum;
|
|
32
|
+
}
|
|
33
|
+
if (beginGap > 0) {
|
|
34
|
+
arr.push(this.gap(beginGap));
|
|
35
|
+
if (seqNum > beginGap) {
|
|
36
|
+
arr.push(this.gap(seqNum));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return arr;
|
|
40
|
+
}
|
|
41
|
+
createMsg(record) {
|
|
42
|
+
let res = null;
|
|
43
|
+
const parser = new buffer_1.AsciiParser(this.config.definitions, null, this.config.delimiter);
|
|
44
|
+
parser.on('error', (e) => {
|
|
45
|
+
});
|
|
46
|
+
parser.on('msg', (msgType, view) => {
|
|
47
|
+
res = view.toObject();
|
|
48
|
+
});
|
|
49
|
+
parser.on('done', () => {
|
|
50
|
+
res = null;
|
|
51
|
+
});
|
|
52
|
+
parser.parseText(record.text);
|
|
53
|
+
return res;
|
|
54
|
+
}
|
|
55
|
+
gap(newSeq) {
|
|
56
|
+
return this.config.factory.sequenceReset(newSeq);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.FixMsgAsciiStoreRecovery = FixMsgAsciiStoreRecovery;
|
|
60
|
+
//# sourceMappingURL=fix-msg-ascii-store-recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-msg-ascii-store-recovery.js","sourceRoot":"","sources":["../../src/store/fix-msg-ascii-store-recovery.ts"],"names":[],"mappings":";;;AAIA,sCAAgD;AAGhD,MAAa,wBAAwB;IACnC,YAA6B,KAAmB,EAAkB,MAAoB;QAAzD,UAAK,GAAL,KAAK,CAAc;QAAkB,WAAM,GAAN,MAAM,CAAc;IACtF,CAAC;IAEM,gBAAgB,CAAE,QAAgB,EAAE,MAAc;QAMvD,MAAM,GAAG,GAAmB,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AC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;QAEhC,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,OAAe,EAAE,IAAa,EAAE,EAAE;YAClD,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QACvB,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACrB,GAAG,GAAG,IAAI,CAAA;QACZ,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC7B,OAAO,GAAG,CAAA;IACZ,CAAC;IAEM,GAAG,CAAE,MAAc;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;CACF;AA7DD,4DA6DC","sourcesContent":["import { IFixMsgStore } from './fix-msg-store'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { IFixMsgStoreRecord } from './fix-msg-store-record'\r\nimport { StringDuplex } from '../transport'\r\nimport { AsciiParser, MsgView } from '../buffer'\r\nimport { IJsFixConfig } from '../config'\r\n\r\nexport class FixMsgAsciiStoreRecovery {\r\n constructor (public readonly store: IFixMsgStore, public readonly config: IJsFixConfig) {\r\n }\r\n\r\n public getReplayRequest (startSeq: number, endSeq: number): ILooseObject[] {\r\n\r\n // need to cover request from start to end where any missing numbers are\r\n // included as gaps to allow vector of messages to be sent by the session\r\n // on a request\r\n\r\n const arr: ILooseObject[] = []\r\n let seqNum = startSeq\r\n let beginGap = 0\r\n while (seqNum <= endSeq) {\r\n const record = this.store.getSeqNum(seqNum)\r\n if (record !== null) {\r\n if (beginGap > 0) {\r\n arr.push(this.gap(beginGap))\r\n if (seqNum > beginGap) {\r\n arr.push(this.gap(seqNum))\r\n }\r\n }\r\n // we sent an application msg for this seqNum and hence need to recover it from its record\r\n arr.push(this.createMsg(record))\r\n beginGap = 0\r\n } else {\r\n // this was a non saved message such as heartbeat - will be filled with a gap\r\n if (beginGap === 0) {\r\n beginGap = seqNum\r\n }\r\n }\r\n ++seqNum\r\n }\r\n if (beginGap > 0) {\r\n arr.push(this.gap(beginGap))\r\n if (seqNum > beginGap) {\r\n arr.push(this.gap(seqNum))\r\n }\r\n }\r\n return arr\r\n }\r\n\r\n public createMsg (record: IFixMsgStoreRecord): ILooseObject {\r\n let res: ILooseObject = null\r\n const parser: AsciiParser = new AsciiParser(this.config.definitions, null, this.config.delimiter)\r\n parser.on('error', (e: Error) => {\r\n // log we failed to parse\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n res = view.toObject()\r\n })\r\n parser.on('done', () => {\r\n res = null\r\n })\r\n parser.parseText(record.text)\r\n return res\r\n }\r\n\r\n public gap (newSeq: number): ILooseObject {\r\n return this.config.factory.sequenceReset(newSeq)\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IFixMsgStore } from './fix-msg-store';
|
|
2
|
+
import { IFixMsgStoreRecord } from './fix-msg-store-record';
|
|
3
|
+
import { IJsFixConfig } from '../config';
|
|
4
|
+
import { IFixReplayRecord } from './fix-replay-record';
|
|
5
|
+
export declare class FixMsgAsciiStoreReplay {
|
|
6
|
+
readonly store: IFixMsgStore;
|
|
7
|
+
readonly config: IJsFixConfig;
|
|
8
|
+
constructor(store: IFixMsgStore, config: IJsFixConfig);
|
|
9
|
+
getReplayRequest(startSeq: number, endSeq: number): IFixReplayRecord[];
|
|
10
|
+
createMsg(record: IFixMsgStoreRecord): IFixReplayRecord;
|
|
11
|
+
gap(beginGap: number, seqNum: number, arr: IFixReplayRecord[]): void;
|
|
12
|
+
sequenceReset(newSeq: number): IFixReplayRecord;
|
|
13
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixMsgAsciiStoreReplay = void 0;
|
|
4
|
+
const buffer_1 = require("../buffer");
|
|
5
|
+
const fix_replay_record_1 = require("./fix-replay-record");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
class FixMsgAsciiStoreReplay {
|
|
8
|
+
constructor(store, config) {
|
|
9
|
+
this.store = store;
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
getReplayRequest(startSeq, endSeq) {
|
|
13
|
+
const arr = [];
|
|
14
|
+
let seqNum = startSeq;
|
|
15
|
+
let beginGap = 0;
|
|
16
|
+
while (seqNum <= endSeq) {
|
|
17
|
+
const record = this.store.getSeqNum(seqNum);
|
|
18
|
+
if (record !== null) {
|
|
19
|
+
this.gap(beginGap, seqNum, arr);
|
|
20
|
+
arr.push(this.createMsg(record));
|
|
21
|
+
beginGap = 0;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (beginGap === 0) {
|
|
25
|
+
beginGap = seqNum;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
++seqNum;
|
|
29
|
+
}
|
|
30
|
+
this.gap(beginGap, seqNum, arr);
|
|
31
|
+
return arr;
|
|
32
|
+
}
|
|
33
|
+
createMsg(record) {
|
|
34
|
+
let res = null;
|
|
35
|
+
const parser = new buffer_1.AsciiParser(this.config.definitions, null, this.config.delimiter);
|
|
36
|
+
parser.on('error', (e) => {
|
|
37
|
+
});
|
|
38
|
+
parser.on('msg', (msgType, view) => {
|
|
39
|
+
res = view.toObject();
|
|
40
|
+
});
|
|
41
|
+
parser.on('done', () => {
|
|
42
|
+
res = null;
|
|
43
|
+
});
|
|
44
|
+
parser.parseText(record.text);
|
|
45
|
+
return new fix_replay_record_1.FixReplayRecord(res, record.msgType, record.seqNum);
|
|
46
|
+
}
|
|
47
|
+
gap(beginGap, seqNum, arr) {
|
|
48
|
+
if (beginGap > 0) {
|
|
49
|
+
arr.push(this.sequenceReset(beginGap));
|
|
50
|
+
if (seqNum > beginGap) {
|
|
51
|
+
arr.push(this.sequenceReset(seqNum));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
sequenceReset(newSeq) {
|
|
56
|
+
return new fix_replay_record_1.FixReplayRecord(this.config.factory.sequenceReset(newSeq), types_1.MsgType.SequenceReset, newSeq);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.FixMsgAsciiStoreReplay = FixMsgAsciiStoreReplay;
|
|
60
|
+
//# sourceMappingURL=fix-msg-ascii-store-replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-msg-ascii-store-replay.js","sourceRoot":"","sources":["../../src/store/fix-msg-ascii-store-replay.ts"],"names":[],"mappings":";;;AAGA,sCAAgD;AAEhD,2DAAuE;AACvE,oCAAkC;AAElC,MAAa,sBAAsB;IACjC,YAA6B,KAAmB,EAAkB,MAAoB;QAAzD,UAAK,GAAL,KAAK,CAAc;QAAkB,WAAM,GAAN,MAAM,CAAc;IACtF,CAAC;IAEM,gBAAgB,CAAE,QAAgB,EAAE,MAAc;QAMvD,MAAM,GAAG,GAAuB,EAAE,CAAA;QAClC,IAAI,MAAM,GAAG,QAAQ,CAAA;QACrB,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,OAAO,MAAM,IAAI,MAAM,EAAE;YACvB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;YAC3C,IAAI,MAAM,KAAK,IAAI,EAAE;gBACnB,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;gBAE/B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;gBAChC,QAAQ,GAAG,CAAC,CAAA;aACb;iBAAM;gBAEL,IAAI,QAAQ,KAAK,CAAC,EAAE;oBAClB,QAAQ,GAAG,MAAM,CAAA;iBAClB;aACF;YACD,EAAE,MAAM,CAAA;SACT;QACD,IAAI,CAA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AC,EAAE,eAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IACtG,CAAC;CACF;AA5DD,wDA4DC","sourcesContent":["import { IFixMsgStore } from './fix-msg-store'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { IFixMsgStoreRecord } from './fix-msg-store-record'\r\nimport { AsciiParser, MsgView } from '../buffer'\r\nimport { IJsFixConfig } from '../config'\r\nimport { IFixReplayRecord, FixReplayRecord } from './fix-replay-record'\r\nimport { MsgType } from '../types'\r\n\r\nexport class FixMsgAsciiStoreReplay {\r\n constructor (public readonly store: IFixMsgStore, public readonly config: IJsFixConfig) {\r\n }\r\n\r\n public getReplayRequest (startSeq: number, endSeq: number): IFixReplayRecord[] {\r\n\r\n // need to cover request from start to end where any missing numbers are\r\n // included as gaps to allow vector of messages to be sent by the session\r\n // on a request\r\n\r\n const arr: IFixReplayRecord[] = []\r\n let seqNum = startSeq\r\n let beginGap = 0\r\n while (seqNum <= endSeq) {\r\n const record = this.store.getSeqNum(seqNum)\r\n if (record !== null) {\r\n this.gap(beginGap, seqNum, arr)\r\n // we sent an application msg for this seqNum and hence need to recover it from its record\r\n arr.push(this.createMsg(record))\r\n beginGap = 0\r\n } else {\r\n // this was a non saved message such as heartbeat - will be filled with a gap\r\n if (beginGap === 0) {\r\n beginGap = seqNum\r\n }\r\n }\r\n ++seqNum\r\n }\r\n this.gap(beginGap, seqNum, arr)\r\n return arr\r\n }\r\n\r\n public createMsg (record: IFixMsgStoreRecord): IFixReplayRecord {\r\n let res: ILooseObject = null\r\n const parser: AsciiParser = new AsciiParser(this.config.definitions, null, this.config.delimiter)\r\n parser.on('error', (e: Error) => {\r\n // log we failed to parse\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n res = view.toObject()\r\n })\r\n parser.on('done', () => {\r\n res = null\r\n })\r\n parser.parseText(record.text)\r\n return new FixReplayRecord(res, record.msgType, record.seqNum)\r\n }\r\n\r\n public gap (beginGap: number, seqNum: number, arr: IFixReplayRecord[]) {\r\n if (beginGap > 0) {\r\n arr.push(this.sequenceReset(beginGap))\r\n if (seqNum > beginGap) {\r\n arr.push(this.sequenceReset(seqNum))\r\n }\r\n }\r\n }\r\n\r\n public sequenceReset (newSeq: number): IFixReplayRecord {\r\n return new FixReplayRecord(this.config.factory.sequenceReset(newSeq), MsgType.SequenceReset, newSeq)\r\n }\r\n}\r\n"]}
|
|
@@ -60,8 +60,9 @@ class FixMsgAsciiStoreResend {
|
|
|
60
60
|
parser.parseText(record.encoded);
|
|
61
61
|
}
|
|
62
62
|
sequenceResetGap(startGap, newSeq) {
|
|
63
|
-
const
|
|
64
|
-
gapFill
|
|
63
|
+
const factory = this.config.factory;
|
|
64
|
+
const gapFill = factory.sequenceReset(newSeq, true);
|
|
65
|
+
gapFill.StandardHeader = factory.header(types_1.MsgType.SequenceReset, startGap);
|
|
65
66
|
gapFill.StandardHeader.PossDupFlag = true;
|
|
66
67
|
gapFill.NewSeqNo = newSeq;
|
|
67
68
|
return new fix_msg_store_record_1.FixMsgStoreRecord(types_1.MsgType.SequenceReset, new Date(), newSeq, gapFill, null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-msg-ascii-store-resend.js","sourceRoot":"","sources":["../../src/store/fix-msg-ascii-store-resend.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAE9E,oCAAkC;AAClC,sCAAgD;AAGhD,MAAa,sBAAsB;IAEjC,YAA6B,KAAmB,EAAkB,MAAoB;QAAzD,UAAK,GAAL,KAAK,CAAc;QAAkB,WAAM,GAAN,MAAM,CAAc;QACpF,IAAI,CAAC,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACrF,CAAC;IAEM,gBAAgB,CAAE,QAAgB,EAAE,MAAc;QAMvD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;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EAAE,EACV,MAAM,EACN,OAAO,EACP,IAAI,CAAC,CAAA;IACT,CAAC;CACF;AA/ED,wDA+EC","sourcesContent":["import { IFixMsgStore } from './fix-msg-store'\r\nimport { FixMsgStoreRecord, IFixMsgStoreRecord } from './fix-msg-store-record'\r\nimport { IJsFixConfig } from '../config'\r\nimport { MsgType } from '../types'\r\nimport { AsciiParser, MsgView } from '../buffer'\r\nimport { ISequenceReset, IStandardHeader } from '../types/FIX4.4/repo'\r\n\r\nexport class FixMsgAsciiStoreResend {\r\n parser: AsciiParser\r\n constructor (public readonly store: IFixMsgStore, public readonly config: IJsFixConfig) {\r\n this.parser = new AsciiParser(this.config.definitions, null, this.config.delimiter)\r\n }\r\n\r\n public getResendRequest (startSeq: number, endSeq: number): Promise<IFixMsgStoreRecord[]> {\r\n\r\n // need to cover request from start to end where any missing numbers are\r\n // included as gaps to allow vector of messages to be sent by the session\r\n // on a request\r\n\r\n return new Promise((resolve, reject) => {\r\n this.store.getSeqNumRange(startSeq, endSeq).then(res => {\r\n resolve(this.inflateRange(startSeq, endSeq, res))\r\n }).catch(e => {\r\n reject(e)\r\n })\r\n })\r\n }\r\n\r\n private inflateRange (startSeq: number, endSeq: number, input: IFixMsgStoreRecord[]): IFixMsgStoreRecord[] {\r\n const toResend: IFixMsgStoreRecord[] = []\r\n let expected = startSeq\r\n for (let i = 0; i < input.length; ++i) {\r\n const record = input[i].clone()\r\n const seqNum = record.seqNum\r\n const toGap = seqNum - expected\r\n if (toGap > 0) {\r\n this.gap(expected, seqNum, toResend)\r\n }\r\n expected = seqNum + 1\r\n if (record.encoded) {\r\n this.inflate(record)\r\n }\r\n toResend.push(record)\r\n }\r\n if (endSeq - expected > 0) {\r\n this.gap(expected, endSeq + 1, toResend)\r\n }\r\n return toResend\r\n }\r\n\r\n public gap (beginGap: number, seqNum: number, arr: IFixMsgStoreRecord[]) {\r\n if (beginGap > 0) {\r\n arr.push(this.sequenceResetGap(beginGap, seqNum))\r\n }\r\n }\r\n\r\n // if records were sent as encoded text then inflate back to object\r\n // so can be resent or examined\r\n\r\n public inflate (record: IFixMsgStoreRecord): void {\r\n if (record.obj) return\r\n if (!record.encoded) return\r\n const parser = this.parser\r\n parser.on('error', (e: Error) => {\r\n record.obj = null\r\n })\r\n parser.on('msg', (view: MsgView) => {\r\n record.obj = view.toObject()\r\n })\r\n // inline parse\r\n parser.parseText(record.encoded)\r\n }\r\n\r\n public sequenceResetGap (startGap: number, newSeq: number): IFixMsgStoreRecord {\r\n const factory = this.config.factory\r\n const gapFill: ISequenceReset = factory.sequenceReset(newSeq, true) as ISequenceReset\r\n gapFill.StandardHeader = factory.header(MsgType.SequenceReset, startGap) as IStandardHeader\r\n gapFill.StandardHeader.PossDupFlag = true\r\n gapFill.NewSeqNo = newSeq\r\n return new FixMsgStoreRecord(\r\n MsgType.SequenceReset,\r\n new Date(),\r\n newSeq,\r\n gapFill,\r\n null)\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-msg-store-record.js","sourceRoot":"","sources":["../../src/store/fix-msg-store-record.ts"],"names":[],"mappings":";;;AAWA,MAAa,iBAAiB;IAC5B,YAA6B,OAAe,EACf,SAAe,EACf,MAAc,EACvB,GAAkB,EACT,OAAgB;QAJhB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAM;QACf,WAAM,GAAN,MAAM,CAAQ;QACvB,QAAG,GAAH,GAAG,CAAe;QACT,YAAO,GAAP,OAAO,CAAS;IAC7C,CAAC;
|
|
1
|
+
{"version":3,"file":"fix-msg-store-record.js","sourceRoot":"","sources":["../../src/store/fix-msg-store-record.ts"],"names":[],"mappings":";;;AAWA,MAAa,iBAAiB;IAC5B,YAA6B,OAAe,EACf,SAAe,EACf,MAAc,EACvB,GAAkB,EACT,OAAgB;QAJhB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAM;QACf,WAAM,GAAN,MAAM,CAAQ;QACvB,QAAG,GAAH,GAAG,CAAe;QACT,YAAO,GAAP,OAAO,CAAS;IAC7C,CAAC;IAED,KAAK;QACH,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACjG,CAAC;CACF;AAXD,8CAWC","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\n\r\nexport interface IFixMsgStoreRecord {\r\n readonly msgType: string\r\n readonly timestamp: Date\r\n readonly seqNum: number\r\n obj?: ILooseObject\r\n readonly encoded?: string\r\n clone (): IFixMsgStoreRecord\r\n}\r\n\r\nexport class FixMsgStoreRecord implements IFixMsgStoreRecord {\r\n constructor (public readonly msgType: string,\r\n public readonly timestamp: Date,\r\n public readonly seqNum: number,\r\n public obj?: ILooseObject,\r\n public readonly encoded?: string) {\r\n }\r\n\r\n clone (): IFixMsgStoreRecord {\r\n return new FixMsgStoreRecord(this.msgType, this.timestamp, this.seqNum, this.obj, this.encoded)\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILooseObject } from '../collections/collection';
|
|
2
|
+
export interface IFixReplayRecord {
|
|
3
|
+
readonly object: ILooseObject;
|
|
4
|
+
readonly msgType: string;
|
|
5
|
+
readonly seqNum: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class FixReplayRecord implements IFixReplayRecord {
|
|
8
|
+
readonly object: ILooseObject;
|
|
9
|
+
readonly msgType: string;
|
|
10
|
+
readonly seqNum: number;
|
|
11
|
+
constructor(object: ILooseObject, msgType: string, seqNum: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FixReplayRecord = void 0;
|
|
4
|
+
class FixReplayRecord {
|
|
5
|
+
constructor(object, msgType, seqNum) {
|
|
6
|
+
this.object = object;
|
|
7
|
+
this.msgType = msgType;
|
|
8
|
+
this.seqNum = seqNum;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.FixReplayRecord = FixReplayRecord;
|
|
12
|
+
//# sourceMappingURL=fix-replay-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-replay-record.js","sourceRoot":"","sources":["../../src/store/fix-replay-record.ts"],"names":[],"mappings":";;;AAQA,MAAa,eAAe;IAC1B,YAA6B,MAAoB,EACpB,OAAe,EACf,MAAc;QAFd,WAAM,GAAN,MAAM,CAAc;QACpB,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;IAC3C,CAAC;CACF;AALD,0CAKC","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\n\r\nexport interface IFixReplayRecord {\r\n readonly object: ILooseObject\r\n readonly msgType: string\r\n readonly seqNum: number\r\n}\r\n\r\nexport class FixReplayRecord implements IFixReplayRecord {\r\n constructor (public readonly object: ILooseObject,\r\n public readonly msgType: string,\r\n public readonly seqNum: number) {\r\n }\r\n}\r\n"]}
|