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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILooseObject } from '../collections/collection';
|
|
2
|
+
export interface IFixResendRecord {
|
|
3
|
+
readonly object: ILooseObject;
|
|
4
|
+
readonly msgType: string;
|
|
5
|
+
readonly seqNum: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class FixResendRecord implements IFixResendRecord {
|
|
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.FixResendRecord = void 0;
|
|
4
|
+
class FixResendRecord {
|
|
5
|
+
constructor(object, msgType, seqNum) {
|
|
6
|
+
this.object = object;
|
|
7
|
+
this.msgType = msgType;
|
|
8
|
+
this.seqNum = seqNum;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.FixResendRecord = FixResendRecord;
|
|
12
|
+
//# sourceMappingURL=fix-resend-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-resend-record.js","sourceRoot":"","sources":["../../src/store/fix-resend-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 IFixResendRecord {\r\n readonly object: ILooseObject\r\n readonly msgType: string\r\n readonly seqNum: number\r\n}\r\n\r\nexport class FixResendRecord implements IFixResendRecord {\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-record.js","sourceRoot":"","sources":["../../src/store/replay-record.ts"],"names":[],"mappings":"","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\nimport { IFixMsgStoreRecord } from './fix-msg-store-record'\r\n\r\nexport interface IStoreReplayRecord {\r\n readonly object: ILooseObject\r\n readonly storeRecord: IFixMsgStoreRecord\r\n}\r\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILooseObject } from '../collections/collection';
|
|
2
|
+
export interface IStoreReplayRecord {
|
|
3
|
+
readonly object: ILooseObject;
|
|
4
|
+
readonly msgType: string;
|
|
5
|
+
readonly seqNum: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class StoreReplayRecord implements IStoreReplayRecord {
|
|
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.StoreReplayRecord = void 0;
|
|
4
|
+
class StoreReplayRecord {
|
|
5
|
+
constructor(object, msgType, seqNum) {
|
|
6
|
+
this.object = object;
|
|
7
|
+
this.msgType = msgType;
|
|
8
|
+
this.seqNum = seqNum;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.StoreReplayRecord = StoreReplayRecord;
|
|
12
|
+
//# sourceMappingURL=store-replay-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-replay-record.js","sourceRoot":"","sources":["../../src/store/store-replay-record.ts"],"names":[],"mappings":";;;AAQA,MAAa,iBAAiB;IAC5B,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,8CAKC","sourcesContent":["import { ILooseObject } from '../collections/collection'\r\n\r\nexport interface IStoreReplayRecord {\r\n readonly object: ILooseObject\r\n readonly msgType: string\r\n readonly seqNum: number\r\n}\r\n\r\nexport class StoreReplayRecord implements IStoreReplayRecord {\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"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ITcpTransportDescription } from '../session-description';
|
|
3
|
+
import { ConnectionOptions, TlsOptions } from 'tls';
|
|
4
|
+
export declare function getTlsOptions(tcp: ITcpTransportDescription): TlsOptions;
|
|
5
|
+
export declare function getTlsConnectionOptions(tcp: ITcpTransportDescription): ConnectionOptions;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTlsConnectionOptions = exports.getTlsOptions = void 0;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
function read(filePath) {
|
|
7
|
+
const root = path.join(__dirname, '../../../');
|
|
8
|
+
const fullPath = path.join(root, filePath);
|
|
9
|
+
return fs.readFileSync(fullPath, {
|
|
10
|
+
encoding: 'utf8', flag: 'r'
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function getTlsOptions(tcp) {
|
|
14
|
+
let tlsOptions = null;
|
|
15
|
+
if (tcp.key) {
|
|
16
|
+
tlsOptions = {
|
|
17
|
+
key: read(tcp.key),
|
|
18
|
+
cert: read(tcp.cert),
|
|
19
|
+
requestCert: tcp.requestCert,
|
|
20
|
+
rejectUnauthorized: tcp.rejectUnauthorized
|
|
21
|
+
};
|
|
22
|
+
if (tcp.ca && tcp.ca.length > 0) {
|
|
23
|
+
tlsOptions.ca = tcp.ca.map(i => read(i));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return tlsOptions;
|
|
27
|
+
}
|
|
28
|
+
exports.getTlsOptions = getTlsOptions;
|
|
29
|
+
function getTlsConnectionOptions(tcp) {
|
|
30
|
+
let connectionOptions = null;
|
|
31
|
+
if (tcp.key) {
|
|
32
|
+
connectionOptions = {
|
|
33
|
+
port: tcp.port,
|
|
34
|
+
host: tcp.host,
|
|
35
|
+
key: read(tcp.key),
|
|
36
|
+
cert: read(tcp.cert)
|
|
37
|
+
};
|
|
38
|
+
if (tcp.ca && tcp.ca.length > 0) {
|
|
39
|
+
connectionOptions.ca = tcp.ca.map(i => read(i));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return connectionOptions;
|
|
43
|
+
}
|
|
44
|
+
exports.getTlsConnectionOptions = getTlsConnectionOptions;
|
|
45
|
+
//# sourceMappingURL=tls-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tls-options.js","sourceRoot":"","sources":["../../src/transport/tcp/tls-options.ts"],"names":[],"mappings":";;;AAEA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,SAAS,IAAI,CAAE,QAAgB;IAC7B,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC1C,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAC7B;QACE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;KAC5B,CAAC,CAAA;AACN,CAAC;AAED,SAAgB,aAAa,CAAE,GAA6B;IAC1D,IAAI,UAAU,GAAe,IAAI,CAAA;IACjC,IAAI,GAAG,CAAC,GAAG,EAAE;QACX,UAAU,GAAG;YACX,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAClB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YACpB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;SAC7B,CAAA;QACf,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,UAAU,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;SACzC;KACF;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAdD,sCAcC;AAED,SAAgB,uBAAuB,CAAE,GAA6B;IACpE,IAAI,iBAAiB,GAAsB,IAAI,CAAA;IAC/C,IAAI,GAAG,CAAC,GAAG,EAAE;QACX,iBAAiB,GAAG;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAClB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;SACA,CAAA;QACtB,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,iBAAiB,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;SAChD;KACF;IACD,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAdD,0DAcC","sourcesContent":["import { ITcpTransportDescription } from '../session-description'\r\nimport { ConnectionOptions, TlsOptions} from 'tls'\r\nconst path = require('path')\r\nconst fs = require('fs')\r\n\r\nfunction read (filePath: string) {\r\n const root: string = path.join(__dirname, '../../../')\r\n const fullPath = path.join(root, filePath)\r\n return fs.readFileSync(fullPath,\r\n {\r\n encoding: 'utf8', flag: 'r'\r\n })\r\n}\r\n\r\nexport function getTlsOptions (tcp: ITcpTransportDescription): TlsOptions {\r\n let tlsOptions: TlsOptions = null\r\n if (tcp.key) {\r\n tlsOptions = {\r\n key: read(tcp.key),\r\n cert: read(tcp.cert),\r\n requestCert: tcp.requestCert,\r\n rejectUnauthorized: tcp.rejectUnauthorized\r\n } as TlsOptions\r\n if (tcp.ca && tcp.ca.length > 0) {\r\n tlsOptions.ca = tcp.ca.map(i => read(i))\r\n }\r\n }\r\n return tlsOptions\r\n}\r\n\r\nexport function getTlsConnectionOptions (tcp: ITcpTransportDescription): ConnectionOptions {\r\n let connectionOptions: ConnectionOptions = null\r\n if (tcp.key) {\r\n connectionOptions = {\r\n port: tcp.port,\r\n host: tcp.host,\r\n key: read(tcp.key),\r\n cert: read(tcp.cert)\r\n } as ConnectionOptions\r\n if (tcp.ca && tcp.ca.length > 0) {\r\n connectionOptions.ca = tcp.ca.map(i => read(i))\r\n }\r\n }\r\n return connectionOptions\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const buffer_1 = require("../buffer");
|
|
14
|
+
const transport_1 = require("../transport");
|
|
15
|
+
const config_1 = require("../config");
|
|
16
|
+
const util_1 = require("../util");
|
|
17
|
+
const root = path.join(__dirname, '../../data');
|
|
18
|
+
let definitions;
|
|
19
|
+
let session;
|
|
20
|
+
let encoder;
|
|
21
|
+
let nos;
|
|
22
|
+
let er;
|
|
23
|
+
const localDate = new Date(2018, 6, 25);
|
|
24
|
+
const utcTimeStamp = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246));
|
|
25
|
+
const utcDate = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0));
|
|
26
|
+
const utcTime = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246));
|
|
27
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const sessionDescription = require(path.join(root, 'session/qf-fix44.json'));
|
|
29
|
+
definitions = yield util_1.getDefinitions(sessionDescription.application.dictionary);
|
|
30
|
+
const config = new config_1.JsFixConfig(new transport_1.SessionMsgFactory(sessionDescription), definitions, sessionDescription, buffer_1.AsciiChars.Pipe);
|
|
31
|
+
session = new transport_1.AsciiMsgTransmitter(config);
|
|
32
|
+
encoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Pipe);
|
|
33
|
+
nos = definitions.message.get('NewOrderSingle');
|
|
34
|
+
er = definitions.message.get('ExecutionReport');
|
|
35
|
+
}), 45000);
|
|
36
|
+
test('expect a definition ', () => {
|
|
37
|
+
expect(nos).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
function toFix(o, set, enc) {
|
|
40
|
+
const theEncode = enc ? enc : encoder;
|
|
41
|
+
session.buffer.reset();
|
|
42
|
+
if (set) {
|
|
43
|
+
theEncode.encode(o, set.name);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
theEncode.encode(o, nos.name);
|
|
47
|
+
}
|
|
48
|
+
return session.buffer.toString();
|
|
49
|
+
}
|
|
50
|
+
function toFixMessage(o, msg) {
|
|
51
|
+
session.encodeMessage(msg.msgType, o);
|
|
52
|
+
return session.buffer.toString();
|
|
53
|
+
}
|
|
54
|
+
class ParsingResult {
|
|
55
|
+
constructor(event, msgType, view, contents, parser) {
|
|
56
|
+
this.event = event;
|
|
57
|
+
this.msgType = msgType;
|
|
58
|
+
this.view = view;
|
|
59
|
+
this.contents = contents;
|
|
60
|
+
this.parser = parser;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function toParse(text, chunks = false) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const parser = new buffer_1.AsciiParser(definitions, new transport_1.StringDuplex(text, chunks).readable, buffer_1.AsciiChars.Pipe);
|
|
66
|
+
parser.on('error', (e) => {
|
|
67
|
+
reject(e);
|
|
68
|
+
});
|
|
69
|
+
parser.on('msg', (msgType, view) => {
|
|
70
|
+
resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser));
|
|
71
|
+
});
|
|
72
|
+
parser.on('done', () => {
|
|
73
|
+
resolve(new ParsingResult('done', null, null, parser.state.elasticBuffer.toString(), parser));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
test('encode heartbeat', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const factory = session.config.factory;
|
|
79
|
+
const hb = factory.heartbeat('test01');
|
|
80
|
+
const hbd = definitions.message.get('Heartbeat');
|
|
81
|
+
const fix = toFixMessage(hb, hbd);
|
|
82
|
+
expect(fix).toBeTruthy();
|
|
83
|
+
const res = yield toParse(fix);
|
|
84
|
+
expect(res.event).toEqual('msg');
|
|
85
|
+
expect(res.msgType).toEqual('0');
|
|
86
|
+
const len = res.view.getTyped(buffer_1.Tags.BodyLengthTag);
|
|
87
|
+
const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length;
|
|
88
|
+
expect(len).toEqual(expected);
|
|
89
|
+
}));
|
|
90
|
+
test('encode custom header PossDupFlag', () => {
|
|
91
|
+
const no = {
|
|
92
|
+
StandardHeader: {
|
|
93
|
+
PossDupFlag: true
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
|
|
97
|
+
expect(fix).toMatch('43=Y|');
|
|
98
|
+
});
|
|
99
|
+
test('encode custom header PossDupFlag', () => {
|
|
100
|
+
const no = {
|
|
101
|
+
StandardHeader: {
|
|
102
|
+
MsgSeqNum: 9999
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
|
|
106
|
+
expect(fix).toMatch('34=9999|');
|
|
107
|
+
});
|
|
108
|
+
test('encode string ClOrdID ', () => {
|
|
109
|
+
const no = {};
|
|
110
|
+
no.ClOrdID = 'Order-a';
|
|
111
|
+
const fix = toFix(no);
|
|
112
|
+
expect(fix).toEqual('11=Order-a|');
|
|
113
|
+
});
|
|
114
|
+
test('encode empty string', () => {
|
|
115
|
+
const no = {};
|
|
116
|
+
no.ClOrdID = '';
|
|
117
|
+
const fix = toFix(no);
|
|
118
|
+
expect(fix).toEqual('11=|');
|
|
119
|
+
});
|
|
120
|
+
test('encode null string', () => {
|
|
121
|
+
const no = {};
|
|
122
|
+
no.ClOrdID = null;
|
|
123
|
+
const fix = toFix(no);
|
|
124
|
+
expect(fix).toEqual('');
|
|
125
|
+
});
|
|
126
|
+
test('encode +ve numeric (int) Price ', () => {
|
|
127
|
+
const no = {};
|
|
128
|
+
no.Price = 100;
|
|
129
|
+
const fix = toFix(no);
|
|
130
|
+
expect(fix).toEqual('44=100|');
|
|
131
|
+
});
|
|
132
|
+
test('encode -ve numeric (int) Price ', () => {
|
|
133
|
+
const no = {};
|
|
134
|
+
no.Price = -100;
|
|
135
|
+
const fix = toFix(no);
|
|
136
|
+
expect(fix).toEqual('44=-100|');
|
|
137
|
+
});
|
|
138
|
+
test('encode +ve numeric (double 8dp) Price ', () => {
|
|
139
|
+
const no = {};
|
|
140
|
+
no.Price = 123.12345678;
|
|
141
|
+
const fix = toFix(no);
|
|
142
|
+
expect(fix).toEqual('44=123.12345678|');
|
|
143
|
+
});
|
|
144
|
+
test('encode +ve numeric (double 14dp) Price ', () => {
|
|
145
|
+
const no = {};
|
|
146
|
+
no.Price = 123.12345678901234;
|
|
147
|
+
const fix = toFix(no);
|
|
148
|
+
expect(fix).toEqual('44=123.12345678901234|');
|
|
149
|
+
});
|
|
150
|
+
test('encode -ve numeric (double 14dp) Price ', () => {
|
|
151
|
+
const no = {};
|
|
152
|
+
no.Price = -123.12345678901234;
|
|
153
|
+
const fix = toFix(no);
|
|
154
|
+
expect(fix).toEqual('44=-123.12345678901234|');
|
|
155
|
+
});
|
|
156
|
+
test('encode +ve string Price ', () => {
|
|
157
|
+
const no = {};
|
|
158
|
+
no.Price = '123.12345678901234';
|
|
159
|
+
const fix = toFix(no);
|
|
160
|
+
expect(fix).toEqual('44=123.12345678901234|');
|
|
161
|
+
});
|
|
162
|
+
test('encode LocalDate TradeDate ', () => {
|
|
163
|
+
const no = {};
|
|
164
|
+
no.TradeDate = localDate;
|
|
165
|
+
const fix = toFix(no);
|
|
166
|
+
expect(fix).toEqual('75=20180725|');
|
|
167
|
+
});
|
|
168
|
+
test('encode UTCTIMESTAMP ExpireTime ', () => {
|
|
169
|
+
const no = {};
|
|
170
|
+
no.ExpireTime = utcTimeStamp;
|
|
171
|
+
const fix = toFix(no);
|
|
172
|
+
expect(fix).toEqual('126=20180610-16:35:00.246|');
|
|
173
|
+
});
|
|
174
|
+
test('encode UTCTIMESTAMP ExpireTime - check padding', () => {
|
|
175
|
+
const no = {};
|
|
176
|
+
no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1));
|
|
177
|
+
const fix = toFix(no);
|
|
178
|
+
expect(fix).toEqual('126=20180101-00:00:00.001|');
|
|
179
|
+
});
|
|
180
|
+
test('encode UTCDATEONLY MDEntryDate', () => {
|
|
181
|
+
const mdGrp = definitions.component.get('MDFullGrp');
|
|
182
|
+
expect(mdGrp).toBeTruthy();
|
|
183
|
+
const grp = {
|
|
184
|
+
NoMDEntries: [
|
|
185
|
+
{
|
|
186
|
+
MDEntryType: '0',
|
|
187
|
+
MDEntryDate: utcDate
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
};
|
|
191
|
+
const fix = toFix(grp, mdGrp);
|
|
192
|
+
expect(fix).toEqual('268=1|269=0|272=20180610|');
|
|
193
|
+
});
|
|
194
|
+
test('encode UTCTIMEONLY MDEntryTime', () => {
|
|
195
|
+
const mdGrp = definitions.component.get('MDFullGrp');
|
|
196
|
+
expect(mdGrp).toBeTruthy();
|
|
197
|
+
const grp = {
|
|
198
|
+
NoMDEntries: [
|
|
199
|
+
{
|
|
200
|
+
MDEntryType: '0',
|
|
201
|
+
MDEntryTime: utcTime
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
const fix = toFix(grp, mdGrp);
|
|
206
|
+
expect(fix).toEqual('268=1|269=0|273=16:35:00.246|');
|
|
207
|
+
});
|
|
208
|
+
test('encode BOOLEAN (true) ReportToExch', () => {
|
|
209
|
+
expect(er).toBeTruthy();
|
|
210
|
+
const e = {};
|
|
211
|
+
e.ReportToExch = true;
|
|
212
|
+
const fix = toFix(e, er);
|
|
213
|
+
expect(fix).toEqual('113=Y|');
|
|
214
|
+
});
|
|
215
|
+
test('encode BOOLEAN (truthy) ReportToExch', () => {
|
|
216
|
+
expect(er).toBeTruthy();
|
|
217
|
+
const e = {};
|
|
218
|
+
e.ReportToExch = 1;
|
|
219
|
+
const fix = toFix(e, er);
|
|
220
|
+
expect(fix).toEqual('113=Y|');
|
|
221
|
+
});
|
|
222
|
+
test('encode BOOLEAN (string) ReportToExch', () => {
|
|
223
|
+
expect(er).toBeTruthy();
|
|
224
|
+
const e = {};
|
|
225
|
+
e.ReportToExch = 'TRUE';
|
|
226
|
+
const fix = toFix(e, er);
|
|
227
|
+
expect(fix).toEqual('113=Y|');
|
|
228
|
+
});
|
|
229
|
+
test('encode BOOLEAN (false) ReportToExch', () => {
|
|
230
|
+
expect(er).toBeTruthy();
|
|
231
|
+
const e = {};
|
|
232
|
+
e.ReportToExch = false;
|
|
233
|
+
const fix = toFix(e, er);
|
|
234
|
+
expect(fix).toEqual('113=N|');
|
|
235
|
+
});
|
|
236
|
+
test('encode BOOLEAN (falsy) ReportToExch', () => {
|
|
237
|
+
expect(er).toBeTruthy();
|
|
238
|
+
const e = {};
|
|
239
|
+
e.ReportToExch = 0;
|
|
240
|
+
const fix = toFix(e, er);
|
|
241
|
+
expect(fix).toEqual('113=N|');
|
|
242
|
+
});
|
|
243
|
+
test('encode RawData EncodedText', () => {
|
|
244
|
+
expect(er).toBeTruthy();
|
|
245
|
+
const toEncode = 'this is fix';
|
|
246
|
+
const e = {
|
|
247
|
+
EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
|
|
248
|
+
};
|
|
249
|
+
const fix = toFix(e, er);
|
|
250
|
+
expect(fix).toEqual('354=11|355=this is fix|');
|
|
251
|
+
});
|
|
252
|
+
test('encode empty RawData EncodedText', () => {
|
|
253
|
+
expect(er).toBeTruthy();
|
|
254
|
+
const toEncode = '';
|
|
255
|
+
const e = {
|
|
256
|
+
EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
|
|
257
|
+
};
|
|
258
|
+
const fix = toFix(e, er);
|
|
259
|
+
expect(fix).toEqual('354=0|355=|');
|
|
260
|
+
});
|
|
261
|
+
function getParties() {
|
|
262
|
+
return {
|
|
263
|
+
'Parties': {
|
|
264
|
+
'NoPartyIDs': [
|
|
265
|
+
{
|
|
266
|
+
'PartyID': 'magna.',
|
|
267
|
+
'PartyIDSource': '9',
|
|
268
|
+
'PartyRole': 28
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
'PartyID': 'iaculis',
|
|
272
|
+
'PartyIDSource': 'F',
|
|
273
|
+
'PartyRole': 2
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function getPartiesNoDelimiter() {
|
|
280
|
+
return {
|
|
281
|
+
'Parties': {
|
|
282
|
+
'NoPartyIDs': [
|
|
283
|
+
{
|
|
284
|
+
'PartyIDSource': '9',
|
|
285
|
+
'PartyRole': 28
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
test('encode repeated group of simple repository Parties', () => {
|
|
292
|
+
expect(er).toBeTruthy();
|
|
293
|
+
const e = getParties();
|
|
294
|
+
const fix = toFix(e, er);
|
|
295
|
+
expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|');
|
|
296
|
+
});
|
|
297
|
+
test('use a carat as log delimiter', () => {
|
|
298
|
+
expect(er).toBeTruthy();
|
|
299
|
+
const caratEncoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Soh, buffer_1.AsciiChars.Carat);
|
|
300
|
+
const e = getParties();
|
|
301
|
+
const fix = toFix(e, er, caratEncoder);
|
|
302
|
+
expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
|
|
303
|
+
});
|
|
304
|
+
test('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {
|
|
305
|
+
expect(er).toBeTruthy();
|
|
306
|
+
const caratEncoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Soh, buffer_1.AsciiChars.Carat);
|
|
307
|
+
const e = getParties();
|
|
308
|
+
const fix = toFix(e, er, caratEncoder);
|
|
309
|
+
expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
|
|
310
|
+
const trimmed = caratEncoder.trim().toString();
|
|
311
|
+
expect(trimmed).toEqual('453=2448=magna.447=9452=28448=iaculis447=F452=2');
|
|
312
|
+
});
|
|
313
|
+
test('encode repeated group with no delimiter - should throw', () => {
|
|
314
|
+
expect(er).toBeTruthy();
|
|
315
|
+
const e = getPartiesNoDelimiter();
|
|
316
|
+
function run() {
|
|
317
|
+
toFix(e, er);
|
|
318
|
+
}
|
|
319
|
+
expect(run).toThrow(/no delimiter/);
|
|
320
|
+
});
|
|
321
|
+
test('encode repeated group with no array - should throw', () => {
|
|
322
|
+
expect(er).toBeTruthy();
|
|
323
|
+
const e = {
|
|
324
|
+
'Parties': {
|
|
325
|
+
'NoPartyIDs': 'should be an array'
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
function run() {
|
|
329
|
+
toFix(e, er);
|
|
330
|
+
}
|
|
331
|
+
expect(run).toThrow(/expected array/);
|
|
332
|
+
});
|
|
333
|
+
test('encode repeated group with empty array', () => {
|
|
334
|
+
expect(er).toBeTruthy();
|
|
335
|
+
const e = {
|
|
336
|
+
'Parties': {
|
|
337
|
+
'NoPartyIDs': []
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
expect(toFix(e, er)).toEqual('453=0|');
|
|
341
|
+
});
|
|
342
|
+
function getInstrument() {
|
|
343
|
+
return {
|
|
344
|
+
'Instrument': {
|
|
345
|
+
'Symbol': 'ac,',
|
|
346
|
+
'SymbolSfx': 'non',
|
|
347
|
+
'SecurityID': 'Pellentesque',
|
|
348
|
+
'SecurityIDSource': 'B',
|
|
349
|
+
'Product': 2
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function getInstrumentNestedGroup() {
|
|
354
|
+
return {
|
|
355
|
+
'Instrument': {
|
|
356
|
+
'Symbol': 'ac,',
|
|
357
|
+
'SymbolSfx': 'non',
|
|
358
|
+
'SecurityID': 'Pellentesque',
|
|
359
|
+
'SecurityIDSource': 'B',
|
|
360
|
+
'SecAltIDGrp': {
|
|
361
|
+
'NoSecurityAltID': [
|
|
362
|
+
{
|
|
363
|
+
'SecurityAltID': 'lorem',
|
|
364
|
+
'SecurityAltIDSource': 'consequat'
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
'SecurityAltID': 'sapien',
|
|
368
|
+
'SecurityAltIDSource': 'tempor'
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
'Product': 2
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
test('encode component', () => {
|
|
377
|
+
expect(er).toBeTruthy();
|
|
378
|
+
const e = getInstrument();
|
|
379
|
+
expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|');
|
|
380
|
+
});
|
|
381
|
+
test('encode component nested group', () => {
|
|
382
|
+
expect(er).toBeTruthy();
|
|
383
|
+
const e = getInstrumentNestedGroup();
|
|
384
|
+
expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|');
|
|
385
|
+
});
|
|
386
|
+
test('encode group missing delimiter', () => {
|
|
387
|
+
expect(er).toBeTruthy();
|
|
388
|
+
const e = getInstrumentNestedGroup();
|
|
389
|
+
delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID'];
|
|
390
|
+
function run() {
|
|
391
|
+
toFix(e, er);
|
|
392
|
+
}
|
|
393
|
+
expect(run).toThrow(/group instance with no delimiter field SecurityAltID/);
|
|
394
|
+
});
|
|
395
|
+
test('encode group not an array of', () => {
|
|
396
|
+
expect(er).toBeTruthy();
|
|
397
|
+
const e = {
|
|
398
|
+
'Instrument': {
|
|
399
|
+
'Symbol': 'ac,',
|
|
400
|
+
'SymbolSfx': 'non',
|
|
401
|
+
'SecurityID': 'Pellentesque',
|
|
402
|
+
'SecurityIDSource': 'B',
|
|
403
|
+
'SecAltIDGrp': {
|
|
404
|
+
'NoSecurityAltID': {
|
|
405
|
+
elements: []
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
'Product': 2
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
function run() {
|
|
412
|
+
toFix(e, er);
|
|
413
|
+
}
|
|
414
|
+
expect(run).toThrow(/expected array instance for group NoSecurityAltID/);
|
|
415
|
+
});
|
|
416
|
+
//# sourceMappingURL=ascii-encode.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ascii-encode.test.js","sourceRoot":"","sources":["../../src/test/ascii-encode.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAE5B,sCAA+F;AAE/F,4CAAwG;AACxG,sCAAuC;AACvC,kCAAwC;AAExC,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAEvD,IAAI,WAA2B,CAAA;AAC/B,IAAI,OAA4B,CAAA;AAChC,IAAI,OAAqB,CAAA;AACzB,IAAI,GAAsB,CAAA;AAC1B,IAAI,EAAqB,CAAA;AAEzB,MAAM,SAAS,GAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,YAAY,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1E,MAAM,OAAO,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACjE,MAAM,OAAO,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAEpE,SAAS,CAAC,GAAS,EAAE;IACnB,MAAM,kBAAkB,GAAwB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAA;IACjG,WAAW,GAAG,MAA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iB,wBAAwB,EAAE,CAAA;IAClD,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,+FAA+F,CAAC,CAAA;AAC/H,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;IACvB,MAAM,CAAC,GAAiB,wBAAwB,EAAE,CAAA;IAClD,OAAO,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;IACnE,SAAS,GAAG;QACV,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACd,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,sDAAsD,CAAC,CAAA;AAC7E,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;IACxC,MAAM,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;IACvB,MAAM,CAAC,GAAiB;QACtB,YAAY,EAAE;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,cAAc;YAC5B,kBAAkB,EAAE,GAAG;YACvB,aAAa,EAAE;gBACb,iBAAiB,EAAE;oBACjB,QAAQ,EAAE,EAAE;iBACb;aACF;YACD,SAAS,EAAE,CAAC;SACb;KACF,CAAA;IACD,SAAS,GAAG;QACV,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACd,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAA;AAC1E,CAAC,CAAC,CAAA","sourcesContent":["import * as path from 'path'\r\nimport { ComponentFieldDefinition, ContainedFieldSet, FixDefinitions, MessageDefinition } from '../dictionary'\r\nimport { AsciiChars, AsciiEncoder, AsciiParser, MsgView, Tags, TimeFormatter } from '../buffer'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { AsciiMsgTransmitter, ISessionDescription, SessionMsgFactory, StringDuplex } from '../transport'\r\nimport { JsFixConfig } from '../config'\r\nimport { getDefinitions } from '../util'\r\n\r\nconst root: string = path.join(__dirname, '../../data')\r\n\r\nlet definitions: FixDefinitions\r\nlet session: AsciiMsgTransmitter\r\nlet encoder: AsciiEncoder\r\nlet nos: MessageDefinition\r\nlet er: MessageDefinition\r\n\r\nconst localDate: Date = new Date(2018, 6, 25)\r\nconst utcTimeStamp: Date = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246))\r\nconst utcDate: Date = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0))\r\nconst utcTime: Date = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246))\r\n\r\nbeforeAll(async () => {\r\n const sessionDescription: ISessionDescription = require(path.join(root, 'session/qf-fix44.json'))\r\n definitions = await getDefinitions(sessionDescription.application.dictionary)\r\n const config = new JsFixConfig(new SessionMsgFactory(sessionDescription), definitions, sessionDescription, AsciiChars.Pipe)\r\n session = new AsciiMsgTransmitter(config)\r\n encoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Pipe)\r\n nos = definitions.message.get('NewOrderSingle')\r\n er = definitions.message.get('ExecutionReport')\r\n}, 45000)\r\n\r\ntest('expect a definition ', () => {\r\n expect(nos).toBeTruthy()\r\n})\r\n\r\nfunction toFix (o: ILooseObject, set?: ContainedFieldSet, enc?: AsciiEncoder): string {\r\n const theEncode = enc ? enc : encoder\r\n session.buffer.reset()\r\n if (set) {\r\n theEncode.encode(o, set.name)\r\n } else {\r\n theEncode.encode(o, nos.name)\r\n }\r\n return session.buffer.toString()\r\n}\r\n\r\nfunction toFixMessage (o: ILooseObject, msg: MessageDefinition): string {\r\n session.encodeMessage(msg.msgType, o)\r\n return session.buffer.toString()\r\n}\r\n\r\nclass ParsingResult {\r\n constructor (public readonly event: string, public readonly msgType: string, public readonly view: MsgView,\r\n public readonly contents: string, public readonly parser: AsciiParser) {\r\n }\r\n}\r\n\r\nfunction toParse (text: string, chunks: boolean = false): Promise<ParsingResult> {\r\n return new Promise<any>((resolve, reject) => {\r\n const parser = new AsciiParser(definitions, new StringDuplex(text, chunks).readable, AsciiChars.Pipe)\r\n parser.on('error', (e: Error) => {\r\n reject(e)\r\n })\r\n parser.on('msg', (msgType: string, view: MsgView) => {\r\n resolve(new ParsingResult('msg', msgType, view.clone(), parser.state.elasticBuffer.toString(), parser))\r\n })\r\n parser.on('done', () => {\r\n resolve(new ParsingResult('done', null,null, parser.state.elasticBuffer.toString(), parser))\r\n })\r\n })\r\n}\r\n\r\ntest('encode heartbeat', async () => {\r\n const factory = session.config.factory\r\n const hb = factory.heartbeat('test01')\r\n const hbd = definitions.message.get('Heartbeat')\r\n const fix = toFixMessage(hb, hbd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await toParse(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual('0')\r\n const len = res.view.getTyped(Tags.BodyLengthTag)\r\n const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length\r\n expect(len).toEqual(expected)\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n PossDupFlag: true\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('43=Y|')\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n MsgSeqNum: 9999\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('34=9999|')\r\n})\r\n\r\ntest('encode string ClOrdID ', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = 'Order-a'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=Order-a|')\r\n})\r\n\r\ntest('encode empty string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = ''\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=|')\r\n})\r\n\r\ntest('encode null string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = null\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('encode +ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=100|')\r\n})\r\n\r\ntest('encode -ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-100|')\r\n})\r\n\r\ntest('encode +ve numeric (double 8dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678|')\r\n})\r\n\r\ntest('encode +ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode -ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-123.12345678901234|')\r\n})\r\n\r\ntest('encode +ve string Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = '123.12345678901234'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode LocalDate TradeDate ', () => {\r\n const no: ILooseObject = {}\r\n no.TradeDate = localDate\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('75=20180725|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime ', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = utcTimeStamp\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180610-16:35:00.246|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime - check padding', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1))\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180101-00:00:00.001|')\r\n})\r\n\r\ntest('encode UTCDATEONLY MDEntryDate', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryDate: utcDate\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|272=20180610|')\r\n})\r\n\r\ntest('encode UTCTIMEONLY MDEntryTime', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryTime: utcTime\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|273=16:35:00.246|')\r\n})\r\n\r\ntest('encode BOOLEAN (true) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = true\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (truthy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 1\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (string) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 'TRUE'\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (false) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = false\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode BOOLEAN (falsy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 0\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = 'this is fix'\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=11|355=this is fix|')\r\n})\r\n\r\ntest('encode empty RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = ''\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=0|355=|')\r\n})\r\n\r\nfunction getParties (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n 'PartyID': 'magna.',\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n },\r\n {\r\n 'PartyID': 'iaculis',\r\n 'PartyIDSource': 'F',\r\n 'PartyRole': 2\r\n }]\r\n }\r\n }\r\n}\r\n\r\nfunction getPartiesNoDelimiter (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n // missing PartyID\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n\r\ntest('encode repeated group of simple repository Parties', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|')\r\n})\r\n\r\ntest('use a carat as log delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n})\r\n\r\ntest('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n const trimmed = caratEncoder.trim().toString()\r\n expect(trimmed).toEqual('453=2\u0001448=magna.\u0001447=9\u0001452=28\u0001448=iaculis\u0001447=F\u0001452=2\u0001')\r\n})\r\n\r\ntest('encode repeated group with no delimiter - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getPartiesNoDelimiter()\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/no delimiter/)\r\n})\r\n\r\ntest('encode repeated group with no array - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': 'should be an array'\r\n }\r\n }\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array/)\r\n})\r\n\r\ntest('encode repeated group with empty array', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': []\r\n }\r\n }\r\n expect(toFix(e, er)).toEqual('453=0|')\r\n})\r\n\r\nfunction getInstrument (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\nfunction getInstrumentNestedGroup (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': [\r\n {\r\n 'SecurityAltID': 'lorem',\r\n 'SecurityAltIDSource': 'consequat'\r\n },\r\n {\r\n 'SecurityAltID': 'sapien',\r\n 'SecurityAltIDSource': 'tempor'\r\n }\r\n ]\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\ntest('encode component', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrument()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|')\r\n})\r\n\r\ntest('encode component nested group', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|')\r\n})\r\n\r\ntest('encode group missing delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID']\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/group instance with no delimiter field SecurityAltID/)\r\n})\r\n\r\ntest('encode group not an array of', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': {\r\n elements: []\r\n }\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array instance for group NoSecurityAltID/)\r\n})\r\n"]}
|
|
@@ -29,7 +29,7 @@ const utcDate = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0));
|
|
|
29
29
|
const utcTime = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246));
|
|
30
30
|
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
const sessionDescription = require(path.join(root, 'session/qf-fix44.json'));
|
|
32
|
-
definitions = yield
|
|
32
|
+
definitions = yield util_1.getDefinitions(sessionDescription.application.dictionary);
|
|
33
33
|
const config = new config_1.JsFixConfig(new ascii_1.AsciiSessionMsgFactory(sessionDescription), definitions, sessionDescription, buffer_1.AsciiChars.Pipe);
|
|
34
34
|
session = new transport_1.AsciiMsgTransmitter(config);
|
|
35
35
|
encoder = new buffer_1.AsciiEncoder(session.buffer, definitions, new buffer_1.TimeFormatter(session.buffer), buffer_1.AsciiChars.Pipe);
|
|
@@ -393,7 +393,7 @@ test('encode group missing delimiter', () => {
|
|
|
393
393
|
function run() {
|
|
394
394
|
toFix(e, er);
|
|
395
395
|
}
|
|
396
|
-
expect(run).toThrow(/group instance
|
|
396
|
+
expect(run).toThrow(/group instance [1] inconsisent delimeter 456 expected tag 455/);
|
|
397
397
|
});
|
|
398
398
|
test('encode group not an array of', () => {
|
|
399
399
|
expect(er).toBeTruthy();
|