jspurefix 5.10.2 → 5.10.4

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.
Files changed (50) hide show
  1. package/dist/buffer/encode-proxy.js.map +1 -1
  2. package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
  3. package/dist/buffer/msg-view.js.map +1 -1
  4. package/dist/config/winston-logger.js.map +1 -1
  5. package/dist/dictionary/compiler/standard-snippet.js +2 -2
  6. package/dist/dictionary/compiler/standard-snippet.js.map +1 -1
  7. package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
  8. package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
  9. package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
  10. package/dist/jsfix-bench.js.map +1 -1
  11. package/dist/jsfix-cmd.js +2 -2
  12. package/dist/jsfix-cmd.js.map +1 -1
  13. package/dist/runtime/session-container.js +11 -8
  14. package/dist/runtime/session-container.js.map +1 -1
  15. package/dist/sample/http/oms/app.js.map +1 -1
  16. package/dist/sample/http/oms/oms-factory.js.map +1 -1
  17. package/dist/sample/tcp/qf-md/app.js.map +1 -1
  18. package/dist/sample/tcp/skeleton/app.js.map +1 -1
  19. package/dist/sample/tcp/trade-capture/app-launcher.js.map +1 -1
  20. package/dist/store/fix-msg-memory-store.js.map +1 -1
  21. package/dist/transport/duplex/http-duplex.d.ts +1 -1
  22. package/dist/transport/duplex/http-duplex.js +2 -5
  23. package/dist/transport/duplex/http-duplex.js.map +1 -1
  24. package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -1
  25. package/dist/transport/session/clone-session-description.js.map +1 -1
  26. package/dist/transport/tcp/tls-options-factory.js.map +1 -1
  27. package/jsfix.test_client.txt +62 -62
  28. package/jsfix.test_server.txt +72 -72
  29. package/package.json +5 -5
  30. package/src/buffer/encode-proxy.ts +1 -1
  31. package/src/buffer/fixml/fixml-encoder.ts +1 -1
  32. package/src/buffer/msg-view.ts +1 -1
  33. package/src/config/winston-logger.ts +1 -1
  34. package/src/dictionary/compiler/standard-snippet.ts +2 -2
  35. package/src/dictionary/parser/fixml/components-parser.ts +2 -2
  36. package/src/dictionary/parser/fixml/fields-parser.ts +1 -1
  37. package/src/dictionary/parser/fixml/include-graph.ts +1 -1
  38. package/src/jsfix-bench.ts +1 -1
  39. package/src/jsfix-cmd.ts +2 -2
  40. package/src/runtime/session-container.ts +12 -4
  41. package/src/sample/http/oms/app.ts +1 -1
  42. package/src/sample/http/oms/oms-factory.ts +4 -4
  43. package/src/sample/tcp/qf-md/app.ts +1 -1
  44. package/src/sample/tcp/skeleton/app.ts +1 -1
  45. package/src/sample/tcp/trade-capture/app-launcher.ts +1 -1
  46. package/src/store/fix-msg-memory-store.ts +1 -1
  47. package/src/transport/duplex/http-duplex.ts +4 -2
  48. package/src/transport/fixml/fixml-session-msg-factory.ts +5 -5
  49. package/src/transport/session/clone-session-description.ts +1 -1
  50. package/src/transport/tcp/tls-options-factory.ts +2 -2
@@ -125,7 +125,7 @@ export class FixmlEncoder extends MsgEncoder {
125
125
  new FieldsDispatch().dispatchFields(fields, {
126
126
  group: (g: ContainedGroupField) => { this.complexGroup(o, g, depth) },
127
127
  component: (c: ContainedComponentField) => { this.complexComponent(o, c, depth) }
128
- } as IFieldDispatcher)
128
+ })
129
129
  if (fields.length) {
130
130
  const end: string = `${newLine}${indent}</${name}>`
131
131
  buffer.writeString(`${end}`)
@@ -411,7 +411,7 @@ export abstract class MsgView {
411
411
  group: (a: ILooseObject, field: ContainedGroupField) => { this.asLooseGroup(a, field) },
412
412
  simple: (a: ILooseObject, field: ContainedSimpleField) => { this.asLooseSimple(a, field) },
413
413
  component: (a: ILooseObject, field: ContainedComponentField) => { this.asLooseComponent(a, field) }
414
- } as ITypeDispatcher<ILooseObject>, def.localAttribute.reduce<ILooseObject>((a: ILooseObject, sf: ContainedSimpleField) => {
414
+ }, def.localAttribute.reduce<ILooseObject>((a: ILooseObject, sf: ContainedSimpleField) => {
415
415
  const def = sf.definition
416
416
  const position: number = this.getPosition(def.tag)
417
417
  if (position >= 0) {
@@ -109,6 +109,6 @@ export class WinstonLogger {
109
109
  message: `${e.message} : ${e.stack}`
110
110
  })
111
111
  }
112
- } as IJsFixLogger
112
+ }
113
113
  }
114
114
  }
@@ -6,8 +6,8 @@ export class StandardSnippet {
6
6
  }
7
7
 
8
8
  private static rhsJustify (txt: string, width: number): string {
9
- const align = require('align-text')
10
- return align(txt, width)
9
+ const pad = ' '.repeat(Math.max(0, width))
10
+ return txt.split(/\r\n|\n/).map(line => pad + line).join('\n')
11
11
  }
12
12
 
13
13
  // import { camelName } from './component/name_underscore'
@@ -184,7 +184,7 @@ export class ComponentsParser extends XsdParser {
184
184
  this.currentGroup = {
185
185
  name: node.attributes.name,
186
186
  elements: [] as IElement[]
187
- } as IGroup
187
+ }
188
188
  } else if (node.attributes.ref) {
189
189
  if (this.currentComplexType) {
190
190
  this.currentComplexType.group = node.attributes.ref
@@ -205,7 +205,7 @@ export class ComponentsParser extends XsdParser {
205
205
  attributeStack.push({
206
206
  name: node.attributes.name,
207
207
  attributes: [] as IAttribute[]
208
- } as IAttributeGroup)
208
+ })
209
209
  } else if (node.attributes.ref) {
210
210
  if (this.currentComplexType) {
211
211
  this.currentComplexType.attributeGroup = node.attributes.ref
@@ -64,7 +64,7 @@ export class FieldsParser extends XsdParser {
64
64
  case 'xs:simpleType': {
65
65
  this.current = {
66
66
  simpleTypeName: node.attributes.name
67
- } as ISimpleField
67
+ }
68
68
  break
69
69
  }
70
70
 
@@ -138,7 +138,7 @@ export class IncludeGraph {
138
138
  ordered.push({
139
139
  parent: next,
140
140
  children: includes
141
- } as IInclude)
141
+ })
142
142
  q.push(includes)
143
143
  }
144
144
  }
@@ -178,7 +178,7 @@ async function main (): Promise<void> {
178
178
  }
179
179
 
180
180
  console.log(`${path.relative(root, fixPath)} ${perInvocation} msg/pass dict ${argv.dict}`)
181
- const suite = await new BenchRunner(benchOptions).runAll(argv.label, cases as IBenchCase[])
181
+ const suite = await new BenchRunner(benchOptions).runAll(argv.label, cases)
182
182
 
183
183
  if (argv.json) {
184
184
  console.log(JSON.stringify(suite, null, 2))
package/src/jsfix-cmd.ts CHANGED
@@ -21,7 +21,7 @@ import { DITokens } from './runtime/di-tokens'
21
21
  import buildOptions from 'minimist-options'
22
22
  import { QuickFixXmlFileBuilder } from './dictionary/parser/quickfix/quick-fix-xml-file-builder'
23
23
 
24
- const fs = require('node-fs-extra')
24
+ const fs = require('fs')
25
25
 
26
26
  const options = buildOptions({
27
27
  dict: {
@@ -439,7 +439,7 @@ export class JsfixCmd {
439
439
 
440
440
  async ensureExists (path: string): Promise<any> {
441
441
  return await new Promise<any>((resolve, reject) => {
442
- fs.mkdirp(path, (err: Error) => {
442
+ fs.mkdir(path, { recursive: true }, (err: Error) => {
443
443
  if (err) {
444
444
  reject(err)
445
445
  } else {
@@ -8,7 +8,6 @@ import {
8
8
  TcpAcceptorListener, RecoveringTcpInitiator,
9
9
  TcpInitiatorConnector, TcpInitiator
10
10
  } from '../transport/tcp'
11
- import { HttpInitiator, HttpAcceptorListener, HttpJsonSampleAdapter } from '../transport/http'
12
11
  import { ISessionMsgFactory, MsgTransmitter, ISessionDescription } from '../transport'
13
12
  import { AsciiMsgTransmitter } from '../transport/ascii/ascii-msg-transmitter'
14
13
  import { FixmlMsgTransmitter } from '../transport/fixml/fixml-msg-transmitter'
@@ -18,7 +17,15 @@ import { ElasticBuffer, MsgEncoder, MsgParser } from '../buffer'
18
17
  import { AsciiParser, AsciiParserState, AsciiSegmentParser } from '../buffer/ascii'
19
18
  import { FixmlEncoder, FiXmlParser } from '../buffer/fixml'
20
19
  import { FixEntity } from '../transport/fix-entity'
21
- import { IHttpAdapter } from '../transport/http/http-adapter'
20
+ import type { IHttpAdapter } from '../transport/http/http-adapter'
21
+
22
+ /**
23
+ * The http transport pulls in express. Only a fixml session registers it, so resolve
24
+ * it on demand - an ascii application should neither load that tree nor inherit it.
25
+ */
26
+ function httpTransport (): typeof import('../transport/http') {
27
+ return require('../transport/http')
28
+ }
22
29
 
23
30
  /**
24
31
  * Supplies the session message factory for a description. Return null to accept the
@@ -165,10 +172,11 @@ export class SessionContainer {
165
172
  useClass: FixmlEncoder
166
173
  })
167
174
  sessionContainer.registerInstance<ElasticBuffer>(DITokens.TransmitBuffer, new ElasticBuffer(sendSize))
168
- sessionContainer.register<HttpAcceptorListener>(HttpAcceptorListener, {
175
+ const { HttpInitiator, HttpAcceptorListener, HttpJsonSampleAdapter } = httpTransport()
176
+ sessionContainer.register(HttpAcceptorListener, {
169
177
  useClass: HttpAcceptorListener
170
178
  })
171
- sessionContainer.register<HttpInitiator>(HttpInitiator, {
179
+ sessionContainer.register(HttpInitiator, {
172
180
  useClass: HttpInitiator
173
181
  })
174
182
  if (this.isInitiator(description)) {
@@ -22,7 +22,7 @@ class AppLauncher extends SessionLauncher {
22
22
  makeSession: (sessionConfig: IJsFixConfig) => isInitiator
23
23
  ? new HttpClient(sessionConfig)
24
24
  : new HttpServer(sessionConfig)
25
- } as EngineFactory
25
+ }
26
26
  }
27
27
 
28
28
  async waitFor (ms: number): Promise<any> {
@@ -27,12 +27,12 @@ export class OmsFactory {
27
27
  OrdType: OrdType.Limit,
28
28
  OrderQtyData: {
29
29
  OrderQty: qty
30
- } as IOrderQtyData,
30
+ },
31
31
  Instrument: {
32
32
  Symbol: symbol,
33
33
  SecurityID: '459200101',
34
34
  SecurityIDSource: SecurityIDSource.IsinNumber
35
- } as IInstrument,
35
+ },
36
36
  TimeInForce: TimeInForce.GoodTillCancelGtc
37
37
  } as INewOrderSingle
38
38
  }
@@ -53,12 +53,12 @@ export class OmsFactory {
53
53
  Price: order.Price,
54
54
  OrderQtyData: {
55
55
  OrderQty: order?.OrderQtyData?.OrderQty
56
- } as IOrderQtyData,
56
+ },
57
57
  Instrument: {
58
58
  Symbol: order?.Instrument?.Symbol,
59
59
  SecurityID: order?.Instrument?.SecurityID,
60
60
  SecurityIDSource: SecurityIDSource.IsinNumber
61
- } as IInstrument
61
+ }
62
62
  } as IExecutionReport
63
63
  }
64
64
  }
@@ -18,7 +18,7 @@ class AppLauncher extends SessionLauncher {
18
18
  makeSession: (sessionConfig: IJsFixConfig) => isInitiator
19
19
  ? new MDClient(sessionConfig)
20
20
  : new MDServer(sessionConfig)
21
- } as EngineFactory
21
+ }
22
22
  }
23
23
  }
24
24
 
@@ -14,7 +14,7 @@ class AppLauncher extends SessionLauncher {
14
14
  protected override makeFactory (config: IJsFixConfig): EngineFactory {
15
15
  return {
16
16
  makeSession: (sessionConfig: IJsFixConfig) => new SkeletonSession(sessionConfig, 45, false)
17
- } as EngineFactory
17
+ }
18
18
  }
19
19
  }
20
20
 
@@ -17,6 +17,6 @@ export class AppLauncher extends SessionLauncher {
17
17
  makeSession: (sessionConfig: IJsFixConfig) => isInitiator
18
18
  ? new TradeCaptureClient(sessionConfig)
19
19
  : new TradeCaptureServer(sessionConfig)
20
- } as EngineFactory
20
+ }
21
21
  }
22
22
  }
@@ -104,7 +104,7 @@ export class FixMsgMemoryStore implements IFixMsgStore {
104
104
  lastSeq: arr.length > 0 ? arr[arr.length - 1].seqNum : 0,
105
105
  id: this.id,
106
106
  length: arr.length
107
- } as IFixMsgStoreState
107
+ }
108
108
  }
109
109
 
110
110
  public async getState (): Promise<IFixMsgStoreState> {
@@ -1,7 +1,6 @@
1
1
  import { FixDuplex } from './fix-duplex'
2
2
  import { Readable, Writable } from 'stream'
3
- import axios from 'axios'
4
- import { IHttpAdapter } from '../http/http-adapter'
3
+ import type { IHttpAdapter } from '../http/http-adapter'
5
4
 
6
5
  export class HttpDuplex extends FixDuplex {
7
6
  public constructor (public readonly adapter: IHttpAdapter) {
@@ -29,6 +28,9 @@ export class HttpDuplex extends FixDuplex {
29
28
  const adapter = this.adapter
30
29
  const options = adapter.getOptions(data)
31
30
  if (options) {
31
+ // resolved here rather than at module scope - this file is on the barrel
32
+ // export, and an ascii application should not load axios to reach it
33
+ const axios = require('axios').default
32
34
  axios(options).then((message: any) => {
33
35
  const body = adapter.endMessage(message)
34
36
  forward.push(body)
@@ -31,7 +31,7 @@ export class FixmlSessionMsgFactory extends ASessionMsgFactory {
31
31
  TargetCompID: description.TargetCompID,
32
32
  SenderSubID: description.SenderSubID,
33
33
  TargetSubID: description.TargetSubID
34
- } as IStandardHeader
34
+ }
35
35
  return this.mutate(o, 'StandardHeader')
36
36
  }
37
37
 
@@ -45,14 +45,14 @@ export class FixmlSessionMsgFactory extends ASessionMsgFactory {
45
45
  UserRequestType: UserRequestType.LogOnUser,
46
46
  // same escape hatch as the ascii factory - see ISessionDescription.Logon
47
47
  ...description.Logon
48
- } as IUserRequest
48
+ }
49
49
  return this.mutate(o, MsgType.Logon)
50
50
  } else {
51
51
  const o: IUserResponse = {
52
52
  Username: description.Username,
53
53
  UserRequestID: userRequestId,
54
54
  UserStatus: UserStatus.LoggedIn
55
- } as IUserResponse
55
+ }
56
56
  return this.mutate(o, MsgType.Logon)
57
57
  }
58
58
  }
@@ -63,14 +63,14 @@ export class FixmlSessionMsgFactory extends ASessionMsgFactory {
63
63
  Username: this.description.Username,
64
64
  UserRequestID: userRequestId,
65
65
  UserRequestType: UserRequestType.LogOffUser
66
- } as IUserRequest
66
+ }
67
67
  return this.mutate(o, MsgType.Logout)
68
68
  } else {
69
69
  const o: IUserResponse = {
70
70
  Username: this.description.Username,
71
71
  UserRequestID: userRequestId,
72
72
  UserStatus: UserStatus.NotLoggedIn
73
- } as IUserResponse
73
+ }
74
74
  return this.mutate(o, MsgType.Logout)
75
75
  }
76
76
  }
@@ -37,5 +37,5 @@ export function cloneSessionDescription (
37
37
  * late binding - i.e. wildcard TargetCompID resolved from the peer's Logon.
38
38
  */
39
39
  export function asMutable (description: ISessionDescription): MutableSessionDescription {
40
- return description as MutableSessionDescription
40
+ return description
41
41
  }
@@ -36,7 +36,7 @@ export class TlsOptionsFactory {
36
36
  tlsOptions = {
37
37
  requestCert: TlsOptionsFactory.asBoolean(tls.requestCert),
38
38
  rejectUnauthorized: TlsOptionsFactory.asBoolean(tls.rejectUnauthorized)
39
- } as TlsOptions
39
+ }
40
40
 
41
41
  if (tls.key) {
42
42
  tlsOptions.key = TlsOptionsFactory.read(tls.key)
@@ -64,7 +64,7 @@ export class TlsOptionsFactory {
64
64
  connectionOptions = {
65
65
  port: tcp.port,
66
66
  host: tcp.host
67
- } as ConnectionOptions
67
+ }
68
68
  if (tls.key) {
69
69
  connectionOptions.key = TlsOptionsFactory.read(tcp.tls?.key ?? '')
70
70
  connectionOptions.cert = tcp.tls?.cert ? TlsOptionsFactory.read(tcp?.tls?.cert) : undefined