jspurefix 3.4.0 → 4.0.0
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/appveyor.yml +1 -1
- package/dist/buffer/ascii/ascii-encoder.d.ts +2 -2
- package/dist/buffer/ascii/ascii-encoder.js +1 -1
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser-state.d.ts +3 -2
- package/dist/buffer/ascii/ascii-parser-state.js +1 -2
- package/dist/buffer/ascii/ascii-parser-state.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser.d.ts +1 -1
- package/dist/buffer/ascii/ascii-parser.js +5 -4
- package/dist/buffer/ascii/ascii-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +4 -3
- package/dist/buffer/ascii/ascii-view.js +8 -5
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/encode-proxy.js +1 -1
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.d.ts +2 -2
- package/dist/buffer/fixml/fixml-encoder.js +1 -1
- package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
- package/dist/buffer/fixml/fixml-parser.js +2 -2
- package/dist/buffer/fixml/fixml-parser.js.map +1 -1
- package/dist/buffer/fixml/fixml-view.d.ts +3 -2
- package/dist/buffer/fixml/fixml-view.js +5 -4
- package/dist/buffer/fixml/fixml-view.js.map +1 -1
- package/dist/buffer/msg-encoder.d.ts +2 -2
- package/dist/buffer/msg-encoder.js.map +1 -1
- package/dist/buffer/msg-view.d.ts +8 -6
- package/dist/buffer/msg-view.js +10 -8
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/buffer/segment/segment-description.d.ts +3 -3
- package/dist/buffer/segment/segment-description.js.map +1 -1
- package/dist/buffer/tag/tags.d.ts +2 -5
- package/dist/buffer/tag/tags.js +4 -5
- package/dist/buffer/tag/tags.js.map +1 -1
- package/dist/collections/collection.d.ts +0 -1
- package/dist/collections/collection.js.map +1 -1
- package/dist/collections/index.d.ts +0 -1
- package/dist/collections/index.js +0 -17
- package/dist/collections/index.js.map +1 -1
- package/dist/config/js-fix-config.d.ts +2 -1
- package/dist/config/js-fix-config.js +3 -3
- package/dist/config/js-fix-config.js.map +1 -1
- package/dist/dictionary/compiler/compiler-type.d.ts +3 -3
- package/dist/dictionary/compiler/compiler-type.js.map +1 -1
- package/dist/dictionary/compiler/enum-compiler.js +2 -2
- package/dist/dictionary/compiler/enum-compiler.js.map +1 -1
- package/dist/dictionary/compiler/msg-compiler.d.ts +1 -2
- package/dist/dictionary/compiler/msg-compiler.js +6 -7
- package/dist/dictionary/compiler/msg-compiler.js.map +1 -1
- package/dist/dictionary/contained/contained-component-field.d.ts +1 -1
- package/dist/dictionary/contained/contained-component-field.js.map +1 -1
- package/dist/dictionary/contained/contained-field-set.d.ts +9 -20
- package/dist/dictionary/contained/contained-field-set.js +16 -149
- package/dist/dictionary/contained/contained-field-set.js.map +1 -1
- package/dist/dictionary/contained/contained-group-field.d.ts +1 -1
- package/dist/dictionary/contained/contained-group-field.js.map +1 -1
- package/dist/dictionary/contained/contained-set-builder.d.ts +15 -0
- package/dist/dictionary/contained/contained-set-builder.js +142 -0
- package/dist/dictionary/contained/contained-set-builder.js.map +1 -0
- package/dist/dictionary/contained/contained-set.d.ts +32 -0
- package/dist/{types/FIX.5.0SP2/quickfix/xm_lnon_fix.js → dictionary/contained/contained-set.js} +1 -1
- package/dist/dictionary/contained/contained-set.js.map +1 -0
- package/dist/dictionary/contained/contained-simple-field.d.ts +1 -1
- package/dist/dictionary/contained/contained-simple-field.js.map +1 -1
- package/dist/dictionary/contained/index.d.ts +4 -1
- package/dist/dictionary/contained/index.js +4 -1
- package/dist/dictionary/contained/index.js.map +1 -1
- package/dist/dictionary/definition/category-simple-set.d.ts +1 -2
- package/dist/dictionary/definition/category-simple-set.js +1 -2
- package/dist/dictionary/definition/category-simple-set.js.map +1 -1
- package/dist/dictionary/definition/component-field-definition.d.ts +1 -1
- package/dist/dictionary/definition/component-field-definition.js +2 -2
- package/dist/dictionary/definition/component-field-definition.js.map +1 -1
- package/dist/dictionary/definition/fix-definitions.d.ts +8 -9
- package/dist/dictionary/definition/fix-definitions.js +22 -20
- package/dist/dictionary/definition/fix-definitions.js.map +1 -1
- package/dist/dictionary/definition/group-field-definition.d.ts +1 -1
- package/dist/dictionary/definition/group-field-definition.js +2 -2
- package/dist/dictionary/definition/group-field-definition.js.map +1 -1
- package/dist/dictionary/definition/message-definition.d.ts +1 -1
- package/dist/dictionary/definition/message-definition.js +2 -2
- package/dist/dictionary/definition/message-definition.js.map +1 -1
- package/dist/dictionary/definition/simple-field-definition.d.ts +2 -3
- package/dist/dictionary/definition/simple-field-definition.js +6 -7
- package/dist/dictionary/definition/simple-field-definition.js.map +1 -1
- package/dist/dictionary/parser/fix-repository/repository.js +20 -20
- package/dist/dictionary/parser/fix-repository/repository.js.map +1 -1
- package/dist/dictionary/parser/fixml/components-parser.js +18 -16
- package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
- package/dist/dictionary/parser/fixml/fields-parser.js +2 -3
- package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
- package/dist/dictionary/parser/fixml/include-graph.js +8 -9
- package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-definition-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/message-parser.js +2 -1
- package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/node-parser.js +3 -2
- package/dist/dictionary/parser/quickfix/node-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/parse-context.d.ts +3 -3
- package/dist/dictionary/parser/quickfix/parse-context.js.map +1 -1
- package/dist/dictionary/parser/quickfix/parse-progress.d.ts +1 -2
- package/dist/dictionary/parser/quickfix/parse-progress.js +2 -3
- package/dist/dictionary/parser/quickfix/parse-progress.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-builder.js +4 -5
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-builder.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +6 -6
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-formatter.d.ts +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-formatter.js.map +1 -1
- package/dist/dictionary/set-reduce.d.ts +2 -2
- package/dist/dictionary/set-reduce.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/jsfix-cmd.js +4 -5
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +7 -8
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-client.js +3 -4
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-resend.d.ts +4 -3
- package/dist/store/fix-msg-ascii-store-resend.js +21 -5
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-memory-store.js +3 -4
- package/dist/store/fix-msg-memory-store.js.map +1 -1
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/test/ascii/ascii-encoder.test.js.map +1 -1
- package/dist/test/ascii/ascii-store-replay.test.js +14 -1
- package/dist/test/ascii/ascii-store-replay.test.js.map +1 -1
- package/dist/test/ascii/fix-log-replay.test.js.map +1 -1
- package/dist/test/ascii/fix-repo-dict.test.js.map +1 -1
- package/dist/test/ascii/qf-50sp0-dict.test.js +7 -7
- package/dist/test/ascii/qf-50sp0-dict.test.js.map +1 -1
- package/dist/test/ascii/qf-50sp2-dict.test.js +5 -2
- package/dist/test/ascii/qf-50sp2-dict.test.js.map +1 -1
- package/dist/test/ascii/session.test.js +64 -15
- package/dist/test/ascii/session.test.js.map +1 -1
- package/dist/test/env/encoder-test.d.ts +3 -3
- package/dist/test/env/encoder-test.js.map +1 -1
- package/dist/test/env/set-constraint-helper.d.ts +4 -4
- package/dist/test/env/set-constraint-helper.js.map +1 -1
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session.js +5 -2
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/fixml/fixml-session.js.map +1 -1
- package/dist/transport/http/http-acceptor.js +3 -4
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/http/http-json-sample-adapter.js +3 -4
- package/dist/transport/http/http-json-sample-adapter.js.map +1 -1
- package/dist/transport/session/dynamic-session-manager.d.ts +8 -0
- package/dist/transport/session/dynamic-session-manager.js +15 -0
- package/dist/transport/session/dynamic-session-manager.js.map +1 -0
- package/dist/transport/session/session-description.d.ts +9 -7
- package/dist/transport/session/session-description.js.map +1 -1
- package/dist/util/json-helper.d.ts +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 +21 -21
- package/src/buffer/ascii/ascii-encoder.ts +7 -7
- package/src/buffer/ascii/ascii-parser-state.ts +4 -4
- package/src/buffer/ascii/ascii-parser.ts +6 -5
- package/src/buffer/ascii/ascii-segment-parser.ts +2 -2
- package/src/buffer/ascii/ascii-view.ts +9 -7
- package/src/buffer/encode-proxy.ts +9 -9
- package/src/buffer/fixml/fixml-encoder.ts +14 -10
- package/src/buffer/fixml/fixml-parser.ts +5 -5
- package/src/buffer/fixml/fixml-view.ts +5 -5
- package/src/buffer/msg-encoder.ts +3 -3
- package/src/buffer/msg-view.ts +18 -18
- package/src/buffer/segment/segment-description.ts +2 -2
- package/src/buffer/tag/tags.ts +4 -6
- package/src/collections/collection.ts +0 -1
- package/src/collections/index.ts +1 -1
- package/src/config/js-fix-config.ts +3 -2
- package/src/dictionary/compiler/compiler-type.ts +8 -2
- package/src/dictionary/compiler/enum-compiler.ts +2 -2
- package/src/dictionary/compiler/msg-compiler.ts +11 -12
- package/src/dictionary/contained/contained-component-field.ts +1 -1
- package/src/dictionary/contained/contained-field-set.ts +21 -176
- package/src/dictionary/contained/contained-group-field.ts +1 -1
- package/src/dictionary/contained/contained-set-builder.ts +164 -0
- package/src/dictionary/contained/contained-set.ts +83 -0
- package/src/dictionary/contained/contained-simple-field.ts +1 -1
- package/src/dictionary/contained/index.ts +4 -1
- package/src/dictionary/definition/category-simple-set.ts +1 -2
- package/src/dictionary/definition/component-field-definition.ts +1 -1
- package/src/dictionary/definition/fix-definitions.ts +28 -26
- package/src/dictionary/definition/group-field-definition.ts +1 -1
- package/src/dictionary/definition/message-definition.ts +6 -6
- package/src/dictionary/definition/simple-field-definition.ts +9 -10
- package/src/dictionary/parser/fix-repository/repository.ts +47 -40
- package/src/dictionary/parser/fixml/components-parser.ts +41 -38
- package/src/dictionary/parser/fixml/fields-parser.ts +3 -4
- package/src/dictionary/parser/fixml/include-graph.ts +13 -14
- package/src/dictionary/parser/quickfix/field-definition-parser.ts +5 -5
- package/src/dictionary/parser/quickfix/message-parser.ts +7 -5
- package/src/dictionary/parser/quickfix/node-parser.ts +13 -6
- package/src/dictionary/parser/quickfix/parse-context.ts +2 -2
- package/src/dictionary/parser/quickfix/parse-progress.ts +2 -3
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-builder.ts +4 -5
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +10 -12
- package/src/dictionary/parser/quickfix/quick-fix-xml-formatter.ts +1 -1
- package/src/dictionary/set-reduce.ts +3 -3
- package/src/index.ts +0 -1
- package/src/jsfix-cmd.ts +5 -6
- package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +7 -8
- package/src/sample/tcp/trade-capture/trade-capture-client.ts +4 -5
- package/src/sample/tcp/trade-capture/trade-capture-server.ts +1 -1
- package/src/store/fix-msg-ascii-store-resend.ts +64 -8
- package/src/store/fix-msg-memory-store.ts +3 -4
- package/src/store/fix-msg-store-record.ts +1 -1
- package/src/transport/ascii/ascii-msg-transmitter.ts +6 -6
- package/src/transport/ascii/ascii-session.ts +11 -7
- package/src/transport/fixml/fixml-session.ts +3 -3
- package/src/transport/http/http-acceptor.ts +4 -5
- package/src/transport/http/http-json-sample-adapter.ts +3 -4
- package/src/transport/session/dynamic-session-manager.ts +16 -0
- package/src/transport/session/session-description.ts +10 -7
- package/src/util/json-helper.ts +3 -3
- package/src/util/message-generator.ts +4 -4
- package/dist/collections/dictionary.d.ts +0 -15
- package/dist/collections/dictionary.js +0 -57
- package/dist/collections/dictionary.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.d.ts +0 -31
- package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js +0 -3
- package/dist/types/FIX.5.0SP2/quickfix/execution_acknowledgement.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.d.ts +0 -26
- package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js +0 -3
- package/dist/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.d.ts +0 -5
- package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js +0 -3
- package/dist/types/FIX.5.0SP2/quickfix/set/hop_grp.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.d.ts +0 -8
- package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js +0 -3
- package/dist/types/FIX.5.0SP2/quickfix/set/msg_type_grp.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.d.ts +0 -4
- package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js +0 -3
- package/dist/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.js.map +0 -1
- package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.d.ts +0 -6
- package/dist/types/FIX.5.0SP2/quickfix/xm_lnon_fix.js.map +0 -1
- package/src/collections/dictionary.ts +0 -62
|
@@ -3,7 +3,6 @@ import { FixAcceptor } from '../fix-acceptor'
|
|
|
3
3
|
import { IJsFixConfig, IJsFixLogger } from '../../config'
|
|
4
4
|
import { IFixmlRequest } from '../fixml'
|
|
5
5
|
import { FixDuplex, StringDuplex, StringDuplexTraits } from '../duplex'
|
|
6
|
-
import { Dictionary } from '../../collections'
|
|
7
6
|
|
|
8
7
|
import * as express from 'express'
|
|
9
8
|
import * as bodyParser from 'body-parser'
|
|
@@ -19,7 +18,7 @@ export class HttpAcceptor extends FixAcceptor {
|
|
|
19
18
|
private readonly logger: IJsFixLogger
|
|
20
19
|
private readonly router: express.Router
|
|
21
20
|
private nextId: number = 0
|
|
22
|
-
private readonly keys:
|
|
21
|
+
private readonly keys: Map<string, MsgTransport> = new Map<string, MsgTransport>()
|
|
23
22
|
|
|
24
23
|
constructor (@inject(DITokens.IJsFixConfig) public readonly config: IJsFixConfig) {
|
|
25
24
|
super(config?.description?.application ?? null)
|
|
@@ -56,7 +55,7 @@ export class HttpAcceptor extends FixAcceptor {
|
|
|
56
55
|
this.transports[tid] = transport
|
|
57
56
|
const keys: string[] = Object.keys(this.transports)
|
|
58
57
|
const a = uuidv4()
|
|
59
|
-
this.keys.
|
|
58
|
+
this.keys.set(a, transport)
|
|
60
59
|
this.logger.info(`new transport id = ${tid} token = ${a} created total transports = ${keys.length}`)
|
|
61
60
|
this.emit('transport', transport)
|
|
62
61
|
return a
|
|
@@ -64,7 +63,7 @@ export class HttpAcceptor extends FixAcceptor {
|
|
|
64
63
|
|
|
65
64
|
private harvestTransport (token: string, tid: number): void {
|
|
66
65
|
delete this.transports[tid]
|
|
67
|
-
this.keys.
|
|
66
|
+
this.keys.delete(token)
|
|
68
67
|
const keys: string[] = Object.keys(this.transports)
|
|
69
68
|
this.logger.info(`transport ${tid} ends total transports = ${keys.length}`)
|
|
70
69
|
}
|
|
@@ -114,7 +113,7 @@ export class HttpAcceptor extends FixAcceptor {
|
|
|
114
113
|
private async logout (req: express.Request, res: express.Response): Promise<void> {
|
|
115
114
|
const headers = req.headers
|
|
116
115
|
const body: IFixmlRequest = req.body
|
|
117
|
-
const t: MsgTransport |
|
|
116
|
+
const t: MsgTransport | undefined = this.keys.get(headers?.authorization ?? '')
|
|
118
117
|
if (t) {
|
|
119
118
|
const token = req.headers.authorization
|
|
120
119
|
if (token) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IJsFixConfig, IJsFixLogger } from '../../config'
|
|
2
2
|
import { HttpTransaction } from './http-transaction'
|
|
3
|
-
import { Dictionary } from '../../collections'
|
|
4
3
|
import { IHttpAdapter } from './http-adapter'
|
|
5
4
|
import { IHtmlRoute } from './html-route'
|
|
6
5
|
import { IHtmlOptions } from './html-options'
|
|
@@ -12,7 +11,7 @@ export class HttpJsonSampleAdapter implements IHttpAdapter {
|
|
|
12
11
|
private readonly logger: IJsFixLogger
|
|
13
12
|
private readonly queue: HttpTransaction[] = []
|
|
14
13
|
private token: string | null = null
|
|
15
|
-
private readonly routes:
|
|
14
|
+
private readonly routes: Map<string, IHtmlRoute> = new Map<string, IHtmlRoute>()
|
|
16
15
|
constructor (@inject(DITokens.IJsFixConfig) public readonly config: IJsFixConfig) {
|
|
17
16
|
this.logger = config.logFactory.logger('http.adapter')
|
|
18
17
|
const routes = this.routes
|
|
@@ -21,9 +20,9 @@ export class HttpJsonSampleAdapter implements IHttpAdapter {
|
|
|
21
20
|
return
|
|
22
21
|
}
|
|
23
22
|
options.forEach((o: IHtmlRoute) => {
|
|
24
|
-
routes.
|
|
23
|
+
routes.set(o.name, o)
|
|
25
24
|
})
|
|
26
|
-
this.logger.info(`instance created routes ${routes.
|
|
25
|
+
this.logger.info(`instance created routes ${routes.size}`)
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
public getOptions (data: Buffer): IHtmlOptions | null {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IJsFixConfig } from '../../config'
|
|
2
|
+
import { IDynamicSessionParams, ISessionDescription } from './session-description'
|
|
3
|
+
|
|
4
|
+
export class DynamicSessionManager {
|
|
5
|
+
constructor (public readonly config: IJsFixConfig) {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
register (dynamicSession: IDynamicSessionParams): void {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
match (dynamicSession: IDynamicSessionParams): (ISessionDescription | null) {
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { IMsgApplication } from '../msg-application'
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
readonly application?: IMsgApplication
|
|
3
|
+
export interface IDynamicSessionParams {
|
|
5
4
|
readonly Name: string
|
|
6
|
-
readonly Username: string
|
|
7
|
-
readonly Password: string
|
|
8
|
-
HeartBtInt: number
|
|
9
5
|
readonly SenderCompId: string
|
|
10
6
|
readonly TargetCompID: string
|
|
11
7
|
readonly ResetSeqNumFlag: boolean
|
|
12
|
-
LastSentSeqNum?: number
|
|
13
|
-
readonly LastReceivedSeqNum?: number
|
|
14
8
|
readonly SenderSubID: string
|
|
15
9
|
readonly TargetSubID: string
|
|
16
10
|
readonly BeginString: string
|
|
11
|
+
readonly Username: string
|
|
12
|
+
readonly Password: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ISessionDescription extends IDynamicSessionParams {
|
|
16
|
+
readonly application?: IMsgApplication
|
|
17
|
+
HeartBtInt: number
|
|
18
|
+
LastSentSeqNum?: number
|
|
19
|
+
readonly LastReceivedSeqNum?: number
|
|
17
20
|
readonly BodyLengthChars?: number
|
|
18
21
|
}
|
package/src/util/json-helper.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILooseObject } from '../collections/collection'
|
|
2
2
|
import {
|
|
3
3
|
ContainedSimpleField,
|
|
4
|
-
|
|
4
|
+
IContainedSet,
|
|
5
5
|
ContainedGroupField,
|
|
6
6
|
ContainedComponentField,
|
|
7
7
|
FieldsDispatch
|
|
@@ -75,7 +75,7 @@ export class JsonHelper {
|
|
|
75
75
|
|
|
76
76
|
public fromJson (fileName: string, msgType: string): ILooseObject {
|
|
77
77
|
const msg: ILooseObject = require(fileName)
|
|
78
|
-
const def: MessageDefinition |
|
|
78
|
+
const def: MessageDefinition | undefined = this.definitions.message.get(msgType)
|
|
79
79
|
if (!def) {
|
|
80
80
|
return msg
|
|
81
81
|
}
|
|
@@ -89,7 +89,7 @@ export class JsonHelper {
|
|
|
89
89
|
return msg
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
public patchJsonFields (set:
|
|
92
|
+
public patchJsonFields (set: IContainedSet, object: ILooseObject): void {
|
|
93
93
|
if (!object) {
|
|
94
94
|
return
|
|
95
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILooseObject } from '../collections/collection'
|
|
2
|
-
import { ContainedComponentField, ContainedGroupField,
|
|
2
|
+
import { ContainedComponentField, ContainedGroupField, IContainedSet, ContainedSimpleField } from '../dictionary/contained'
|
|
3
3
|
import { FixDefinitions, MessageDefinition, SimpleFieldDefinition } from '../dictionary/definition'
|
|
4
4
|
import { SetReduce } from '../dictionary'
|
|
5
5
|
import { TagType } from '../buffer/tag/tag-type'
|
|
@@ -13,7 +13,7 @@ export class MessageGenerator {
|
|
|
13
13
|
|
|
14
14
|
public static getRandomEnum (field: SimpleFieldDefinition): any {
|
|
15
15
|
const tagType: TagType = field.tagType
|
|
16
|
-
const keys: string[] = field.enums.keys()
|
|
16
|
+
const keys: string[] = Array.from(field.enums.keys())
|
|
17
17
|
const choice: string = keys[Math.floor(Math.random() * keys.length)]
|
|
18
18
|
switch (tagType) {
|
|
19
19
|
case TagType.Int: {
|
|
@@ -56,14 +56,14 @@ export class MessageGenerator {
|
|
|
56
56
|
}
|
|
57
57
|
density = Math.max(0.2, density)
|
|
58
58
|
density = Math.min(1.0, density)
|
|
59
|
-
const def: MessageDefinition |
|
|
59
|
+
const def: MessageDefinition | undefined = this.definitions.message.get(msgType)
|
|
60
60
|
if (!def) {
|
|
61
61
|
throw new Error(`definitions do not contain type ${msgType}`)
|
|
62
62
|
}
|
|
63
63
|
return this.toObject(def, density, repeatGroups)
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
private toObject (set:
|
|
66
|
+
private toObject (set: IContainedSet, density: number, repeatGroups: boolean): ILooseObject {
|
|
67
67
|
const reducer = new SetReduce<ILooseObject>()
|
|
68
68
|
return reducer.reduce(set, {
|
|
69
69
|
simple: (a: ILooseObject, sf: ContainedSimpleField) => {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IDictIteratorCb } from './collection';
|
|
2
|
-
export declare class Dictionary<T> {
|
|
3
|
-
private container;
|
|
4
|
-
count(): number;
|
|
5
|
-
values(): T[];
|
|
6
|
-
keys(): string[];
|
|
7
|
-
toString(): string;
|
|
8
|
-
containsKey(key: string): boolean;
|
|
9
|
-
add(key: string, v: T): void;
|
|
10
|
-
addUpdate(key: string, v: T): void;
|
|
11
|
-
remove(key: string): void;
|
|
12
|
-
get(key: string): T | null;
|
|
13
|
-
clear(): void;
|
|
14
|
-
forEach(cb: IDictIteratorCb<T>): void;
|
|
15
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Dictionary = void 0;
|
|
4
|
-
class Dictionary {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.container = {};
|
|
7
|
-
}
|
|
8
|
-
count() {
|
|
9
|
-
const keys = Object.keys(this.container);
|
|
10
|
-
return keys.length;
|
|
11
|
-
}
|
|
12
|
-
values() {
|
|
13
|
-
const va = [];
|
|
14
|
-
const keys = Object.keys(this.container);
|
|
15
|
-
keys.forEach((k) => va.push(this.container[k]));
|
|
16
|
-
return va;
|
|
17
|
-
}
|
|
18
|
-
keys() {
|
|
19
|
-
return Object.keys(this.container);
|
|
20
|
-
}
|
|
21
|
-
toString() {
|
|
22
|
-
return this.keys().reduce((a, current) => {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
const token = a.length > 0 ? ', ' : '';
|
|
25
|
-
return a + `${token}${(_b = (_a = this.container[current]) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''}`;
|
|
26
|
-
}, '');
|
|
27
|
-
}
|
|
28
|
-
containsKey(key) {
|
|
29
|
-
return this.container[key] != null;
|
|
30
|
-
}
|
|
31
|
-
add(key, v) {
|
|
32
|
-
if (this.containsKey(key)) {
|
|
33
|
-
const msg = `duplicate key ${key}`;
|
|
34
|
-
throw new Error(msg);
|
|
35
|
-
}
|
|
36
|
-
this.container[key] = v;
|
|
37
|
-
}
|
|
38
|
-
addUpdate(key, v) {
|
|
39
|
-
this.container[key] = v;
|
|
40
|
-
}
|
|
41
|
-
remove(key) {
|
|
42
|
-
delete this.container[key];
|
|
43
|
-
}
|
|
44
|
-
get(key) {
|
|
45
|
-
return this.container[key];
|
|
46
|
-
}
|
|
47
|
-
clear() {
|
|
48
|
-
this.keys().forEach(k => {
|
|
49
|
-
this.remove(k);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
forEach(cb) {
|
|
53
|
-
Object.keys(this.container).forEach((k) => cb(k, this.container[k]));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.Dictionary = Dictionary;
|
|
57
|
-
//# sourceMappingURL=dictionary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/collections/dictionary.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAAvB;QACU,cAAS,GAAsB,EAAE,CAAA;IA0D3C,CAAC;IAxDQ,KAAK;QACV,MAAM,IAAI,GAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClD,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAEM,MAAM;QACX,MAAM,EAAE,GAAQ,EAAE,CAAA;QAClB,MAAM,IAAI,GAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC/C,OAAO,EAAE,CAAA;IACX,CAAC;IAEM,IAAI;QACT,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,OAAe,EAAE,EAAE;;YACvD,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;YACtC,OAAO,CAAC,GAAG,GAAG,KAAK,GAAG,MAAA,MAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,0CAAE,QAAQ,EAAE,mCAAI,EAAE,EAAE,CAAA;QACnE,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;IAEM,WAAW,CAAE,GAAW;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,CAAA;IACpC,CAAC;IAEM,GAAG,CAAE,GAAW,EAAE,CAAI;QAC3B,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAW,iBAAiB,GAAG,EAAE,CAAA;YAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAEM,SAAS,CAAE,GAAW,EAAE,CAAI;QACjC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAEM,MAAM,CAAE,GAAW;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAEM,GAAG,CAAE,GAAW;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,OAAO,CAAE,EAAsB;QACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9E,CAAC;CACF;AA3DD,gCA2DC","sourcesContent":["import { IDictIteratorCb } from './collection'\r\n\r\nexport class Dictionary<T> {\r\n private container: Record<string, T> = {}\r\n\r\n public count (): number {\r\n const keys: string[] = Object.keys(this.container)\r\n return keys.length\r\n }\r\n\r\n public values (): T[] {\r\n const va: T[] = []\r\n const keys: string[] = Object.keys(this.container)\r\n keys.forEach((k) => va.push(this.container[k]))\r\n return va\r\n }\r\n\r\n public keys (): string[] {\r\n return Object.keys(this.container)\r\n }\r\n\r\n public toString (): string {\r\n return this.keys().reduce((a: string, current: string) => {\r\n const token = a.length > 0 ? ', ' : ''\r\n return a + `${token}${this.container[current]?.toString() ?? ''}`\r\n }, '')\r\n }\r\n\r\n public containsKey (key: string): boolean {\r\n return this.container[key] != null\r\n }\r\n\r\n public add (key: string, v: T): void {\r\n if (this.containsKey(key)) {\r\n const msg: string = `duplicate key ${key}`\r\n throw new Error(msg)\r\n }\r\n this.container[key] = v\r\n }\r\n\r\n public addUpdate (key: string, v: T): void {\r\n this.container[key] = v\r\n }\r\n\r\n public remove (key: string): void {\r\n delete this.container[key]\r\n }\r\n\r\n public get (key: string): T | null {\r\n return this.container[key]\r\n }\r\n\r\n public clear (): void {\r\n this.keys().forEach(k => {\r\n this.remove(k)\r\n })\r\n }\r\n\r\n public forEach (cb: IDictIteratorCb<T>): void {\r\n Object.keys(this.container).forEach((k: string) => cb(k, this.container[k]))\r\n }\r\n}\r\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IStandardHeader } from './set/standard_header';
|
|
3
|
-
import { IInstrument } from './set/instrument';
|
|
4
|
-
import { IUndInstrmtGrp } from './set/und_instrmt_grp';
|
|
5
|
-
import { IInstrmtLegGrp } from './set/instrmt_leg_grp';
|
|
6
|
-
import { IOrderQtyData } from './set/order_qty_data';
|
|
7
|
-
import { IStandardTrailer } from './set/standard_trailer';
|
|
8
|
-
export interface IExecutionAcknowledgement {
|
|
9
|
-
StandardHeader: IStandardHeader;
|
|
10
|
-
OrderID: string;
|
|
11
|
-
SecondaryOrderID?: string;
|
|
12
|
-
ClOrdID?: string;
|
|
13
|
-
ExecAckStatus: string;
|
|
14
|
-
ExecID: string;
|
|
15
|
-
DKReason?: string;
|
|
16
|
-
Instrument: IInstrument;
|
|
17
|
-
UndInstrmtGrp?: IUndInstrmtGrp;
|
|
18
|
-
InstrmtLegGrp?: IInstrmtLegGrp;
|
|
19
|
-
Side: string;
|
|
20
|
-
OrderQtyData: IOrderQtyData;
|
|
21
|
-
LastQty?: number;
|
|
22
|
-
LastPx?: number;
|
|
23
|
-
PriceType?: number;
|
|
24
|
-
LastParPx?: number;
|
|
25
|
-
CumQty?: number;
|
|
26
|
-
AvgPx?: number;
|
|
27
|
-
Text?: string;
|
|
28
|
-
EncodedTextLen?: number;
|
|
29
|
-
EncodedText?: Buffer;
|
|
30
|
-
StandardTrailer: IStandardTrailer;
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution_acknowledgement.js","sourceRoot":"","sources":["../../../../src/types/FIX.5.0SP2/quickfix/execution_acknowledgement.ts"],"names":[],"mappings":"","sourcesContent":["import { IStandardHeader } from './set/standard_header'\r\nimport { IInstrument } from './set/instrument'\r\nimport { IUndInstrmtGrp } from './set/und_instrmt_grp'\r\nimport { IInstrmtLegGrp } from './set/instrmt_leg_grp'\r\nimport { IOrderQtyData } from './set/order_qty_data'\r\nimport { IStandardTrailer } from './set/standard_trailer'\r\n\r\n/*\r\n****************************************************************\r\n* The Execution Report Acknowledgement message is an optional *\r\n* message that provides dual functionality to notify a trading *\r\n* partner that an electronically received execution has either *\r\n* been accepted or rejected (DK'd). *\r\n****************************************************************\r\n*/\r\nexport interface IExecutionAcknowledgement {\r\n StandardHeader: IStandardHeader// [1] BeginString.8, BodyLength.9 .. HopRefID.630\r\n OrderID: string// [2] 37 (String)\r\n SecondaryOrderID?: string// [3] 198 (String)\r\n ClOrdID?: string// [4] 11 (String)\r\n ExecAckStatus: string// [5] 1036 (String)\r\n ExecID: string// [6] 17 (String)\r\n DKReason?: string// [7] 127 (String)\r\n Instrument: IInstrument// [8] Symbol.55, SymbolSfx.65 .. ComplexEventEndTime.1496\r\n UndInstrmtGrp?: IUndInstrmtGrp// [9] NoUnderlyings.711, UnderlyingSymbol.311 .. UnderlyingDetachmentPoint.1460\r\n InstrmtLegGrp?: IInstrmtLegGrp// [10] NoLegs.555, LegSymbol.600 .. LegFlowScheduleType.1440\r\n Side: string// [11] 54 (String)\r\n OrderQtyData: IOrderQtyData// [12] OrderQty.38, CashOrderQty.152 .. RoundingModulus.469\r\n LastQty?: number// [13] 32 (Float)\r\n LastPx?: number// [14] 31 (Float)\r\n PriceType?: number// [15] 423 (Int)\r\n LastParPx?: number// [16] 669 (Float)\r\n CumQty?: number// [17] 14 (Float)\r\n AvgPx?: number// [18] 6 (Float)\r\n Text?: string// [19] 58 (String)\r\n EncodedTextLen?: number// [20] 354 (Int)\r\n EncodedText?: Buffer// [21] 355 (RawData)\r\n StandardTrailer: IStandardTrailer// [22] SignatureLength.93, Signature.89, CheckSum.10\r\n}\r\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IStandardHeader } from './set/standard_header';
|
|
3
|
-
import { IParties } from './set/parties';
|
|
4
|
-
import { IQuotSetAckGrp } from './set/quot_set_ack_grp';
|
|
5
|
-
import { IStandardTrailer } from './set/standard_trailer';
|
|
6
|
-
import { ITargetParties } from './set/target_parties';
|
|
7
|
-
export interface IMassQuoteAcknowledgement {
|
|
8
|
-
StandardHeader: IStandardHeader;
|
|
9
|
-
QuoteReqID?: string;
|
|
10
|
-
QuoteID?: string;
|
|
11
|
-
QuoteStatus: number;
|
|
12
|
-
QuoteRejectReason?: number;
|
|
13
|
-
QuoteResponseLevel?: number;
|
|
14
|
-
QuoteType?: number;
|
|
15
|
-
QuoteCancelType?: number;
|
|
16
|
-
Parties?: IParties[];
|
|
17
|
-
Account?: string;
|
|
18
|
-
AcctIDSource?: number;
|
|
19
|
-
AccountType?: number;
|
|
20
|
-
Text?: string;
|
|
21
|
-
EncodedTextLen?: number;
|
|
22
|
-
EncodedText?: Buffer;
|
|
23
|
-
QuotSetAckGrp?: IQuotSetAckGrp[];
|
|
24
|
-
StandardTrailer: IStandardTrailer;
|
|
25
|
-
TargetParties?: ITargetParties[];
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mass_quote_acknowledgement.js","sourceRoot":"","sources":["../../../../src/types/FIX.5.0SP2/quickfix/mass_quote_acknowledgement.ts"],"names":[],"mappings":"","sourcesContent":["import { IStandardHeader } from './set/standard_header'\r\nimport { IParties } from './set/parties'\r\nimport { IQuotSetAckGrp } from './set/quot_set_ack_grp'\r\nimport { IStandardTrailer } from './set/standard_trailer'\r\nimport { ITargetParties } from './set/target_parties'\r\n\r\n/*\r\n***************************************************************\r\n* Mass Quote Acknowledgement is used as the application level *\r\n* response to a Mass Quote message. *\r\n***************************************************************\r\n*/\r\nexport interface IMassQuoteAcknowledgement {\r\n StandardHeader: IStandardHeader// [1] BeginString.8, BodyLength.9 .. HopRefID.630\r\n QuoteReqID?: string// [2] 131 (String)\r\n QuoteID?: string// [3] 117 (String)\r\n QuoteStatus: number// [4] 297 (Int)\r\n QuoteRejectReason?: number// [5] 300 (Int)\r\n QuoteResponseLevel?: number// [6] 301 (Int)\r\n QuoteType?: number// [7] 537 (Int)\r\n QuoteCancelType?: number// [8] 298 (Int)\r\n Parties?: IParties[]// [9] PartyID.448, PartyIDSource.447 .. PartySubIDType.803\r\n Account?: string// [10] 1 (String)\r\n AcctIDSource?: number// [11] 660 (Int)\r\n AccountType?: number// [12] 581 (Int)\r\n Text?: string// [13] 58 (String)\r\n EncodedTextLen?: number// [14] 354 (Int)\r\n EncodedText?: Buffer// [15] 355 (RawData)\r\n QuotSetAckGrp?: IQuotSetAckGrp[]// [16] QuoteSetID.302, UnderlyingSymbol.311 .. QuoteSetValidUntilTime.367\r\n StandardTrailer: IStandardTrailer// [17] SignatureLength.93, Signature.89, CheckSum.10\r\n TargetParties?: ITargetParties[]// [18] TargetPartyID.1462, TargetPartyIDSource.1463, TargetPartyRole.1464\r\n}\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hop_grp.js","sourceRoot":"","sources":["../../../../../src/types/FIX.5.0SP2/quickfix/set/hop_grp.ts"],"names":[],"mappings":"","sourcesContent":["export interface IHopGrp {\r\n HopCompID?: string // [1] 628 (String)\r\n HopSendingTime?: Date// [2] 629 (UtcTimestamp)\r\n HopRefID?: number// [3] 630 (Int)\r\n}\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msg_type_grp.js","sourceRoot":"","sources":["../../../../../src/types/FIX.5.0SP2/quickfix/set/msg_type_grp.ts"],"names":[],"mappings":"","sourcesContent":["export interface IMsgTypeGrp {\r\n RefMsgType?: string// [1] 372 (String)\r\n MsgDirection?: string// [2] 385 (String)\r\n RefApplVerID?: string// [3] 1130 (String)\r\n RefApplExtID?: number// [4] 1406 (Int)\r\n RefCstmApplVerID?: string// [5] 1131 (String)\r\n DefaultVerIndicator?: boolean// [6] 1410 (Boolean)\r\n}\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"not_affected_orders_grp.js","sourceRoot":"","sources":["../../../../../src/types/FIX.5.0SP2/quickfix/set/not_affected_orders_grp.ts"],"names":[],"mappings":"","sourcesContent":["export interface INotAffectedOrdersGrp {\r\n NotAffOrigClOrdID?: string// [1] 1372 (String)\r\n NotAffectedOrderID?: string// [2] 1371 (String)\r\n}\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xm_lnon_fix.js","sourceRoot":"","sources":["../../../../src/types/FIX.5.0SP2/quickfix/xm_lnon_fix.ts"],"names":[],"mappings":"","sourcesContent":["import { IStandardHeader } from './set/standard_header'\r\nimport { IStandardTrailer } from './set/standard_trailer'\r\n\r\nexport interface IXMLnonFIX {\r\n StandardHeader: IStandardHeader// [1] BeginString.8, BodyLength.9 .. HopRefID.630\r\n StandardTrailer: IStandardTrailer// [2] SignatureLength.93, Signature.89, CheckSum.10\r\n}\r\n"]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { IDictIteratorCb } from './collection'
|
|
2
|
-
|
|
3
|
-
export class Dictionary<T> {
|
|
4
|
-
private container: Record<string, T> = {}
|
|
5
|
-
|
|
6
|
-
public count (): number {
|
|
7
|
-
const keys: string[] = Object.keys(this.container)
|
|
8
|
-
return keys.length
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public values (): T[] {
|
|
12
|
-
const va: T[] = []
|
|
13
|
-
const keys: string[] = Object.keys(this.container)
|
|
14
|
-
keys.forEach((k) => va.push(this.container[k]))
|
|
15
|
-
return va
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public keys (): string[] {
|
|
19
|
-
return Object.keys(this.container)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public toString (): string {
|
|
23
|
-
return this.keys().reduce((a: string, current: string) => {
|
|
24
|
-
const token = a.length > 0 ? ', ' : ''
|
|
25
|
-
return a + `${token}${this.container[current]?.toString() ?? ''}`
|
|
26
|
-
}, '')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public containsKey (key: string): boolean {
|
|
30
|
-
return this.container[key] != null
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public add (key: string, v: T): void {
|
|
34
|
-
if (this.containsKey(key)) {
|
|
35
|
-
const msg: string = `duplicate key ${key}`
|
|
36
|
-
throw new Error(msg)
|
|
37
|
-
}
|
|
38
|
-
this.container[key] = v
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public addUpdate (key: string, v: T): void {
|
|
42
|
-
this.container[key] = v
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public remove (key: string): void {
|
|
46
|
-
delete this.container[key]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public get (key: string): T | null {
|
|
50
|
-
return this.container[key]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public clear (): void {
|
|
54
|
-
this.keys().forEach(k => {
|
|
55
|
-
this.remove(k)
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public forEach (cb: IDictIteratorCb<T>): void {
|
|
60
|
-
Object.keys(this.container).forEach((k: string) => cb(k, this.container[k]))
|
|
61
|
-
}
|
|
62
|
-
}
|