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
package/src/buffer/msg-view.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { TagPos } from './tag/tag-pos'
|
|
2
2
|
import { SegmentDescription } from './segment/segment-description'
|
|
3
3
|
import { Structure } from './structure'
|
|
4
|
-
import { Dictionary } from '../collections'
|
|
5
4
|
import { Tags } from './tag/tags'
|
|
6
5
|
import {
|
|
7
6
|
ContainedComponentField,
|
|
8
7
|
ContainedField,
|
|
9
|
-
|
|
8
|
+
IContainedSet,
|
|
10
9
|
ContainedGroupField,
|
|
11
10
|
ContainedSimpleField
|
|
12
11
|
} from '../dictionary/contained'
|
|
13
12
|
import { SetReduce } from '../dictionary'
|
|
14
13
|
import { ILooseObject } from '../collections/collection'
|
|
15
14
|
import { ElasticBuffer } from './elastic-buffer'
|
|
16
|
-
import { GroupFieldDefinition, SimpleFieldDefinition } from '../dictionary/definition'
|
|
15
|
+
import { FixDefinitions, GroupFieldDefinition, SimpleFieldDefinition } from '../dictionary/definition'
|
|
17
16
|
import { ITypeDispatcher } from '../dictionary/type-dispatcher'
|
|
18
17
|
import { ContainedSetType } from '../dictionary/contained-set-type'
|
|
19
18
|
|
|
@@ -22,7 +21,7 @@ export abstract class MsgView {
|
|
|
22
21
|
protected sortedTagPosBackwards: TagPos[]
|
|
23
22
|
private readonly reducer: SetReduce<ILooseObject> = new SetReduce<ILooseObject>()
|
|
24
23
|
|
|
25
|
-
protected constructor (public readonly segment: SegmentDescription, public readonly structure: Structure | null) {
|
|
24
|
+
protected constructor (public readonly definitions: FixDefinitions, public readonly segment: SegmentDescription, public readonly structure: Structure | null) {
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
protected static asVerbose = (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos): string => {
|
|
@@ -185,12 +184,12 @@ export abstract class MsgView {
|
|
|
185
184
|
* returns typed value of a sinple field within this view
|
|
186
185
|
* @param tagOrName the name or tag of required field e.g. 8, BeginString
|
|
187
186
|
*/
|
|
188
|
-
public getTyped (tagOrName: number | string):
|
|
187
|
+
public getTyped (tagOrName: number | string): (boolean | string | number | Date | Buffer | null) {
|
|
189
188
|
const tag: number = this.resolveTag(tagOrName)
|
|
190
189
|
if (tag == null) {
|
|
191
190
|
return null
|
|
192
191
|
}
|
|
193
|
-
const field: SimpleFieldDefinition | null = this.
|
|
192
|
+
const field: SimpleFieldDefinition | null = this.definitions.tagToSimple[tag] ?? null
|
|
194
193
|
if (field == null) {
|
|
195
194
|
return null
|
|
196
195
|
}
|
|
@@ -201,7 +200,7 @@ export abstract class MsgView {
|
|
|
201
200
|
* use a varargs list of tags or tag names to fetch typed values for those fields within this view.
|
|
202
201
|
* @param tagOrNames list of tags e.g. 'BeginString', 'BodyLength', ...
|
|
203
202
|
*/
|
|
204
|
-
public getTypedList (...tagOrNames: Array<number | string>): Array<boolean | string | number | Date | null> {
|
|
203
|
+
public getTypedList (...tagOrNames: Array<number | string>): Array<boolean | string | number | Date | Buffer | null> {
|
|
205
204
|
return tagOrNames.map((s) => this.getTyped(s))
|
|
206
205
|
}
|
|
207
206
|
|
|
@@ -209,7 +208,7 @@ export abstract class MsgView {
|
|
|
209
208
|
* use an array of tags or tag names to fetch typed values for those fields within this view.
|
|
210
209
|
* @param tagOrName the list of params as array ['BeginString','BodyLength', 'MsgType']
|
|
211
210
|
*/
|
|
212
|
-
public getTypedTags (tagOrName: Array<string | number>): Array<boolean | string | number | Date | null> {
|
|
211
|
+
public getTypedTags (tagOrName: Array<string | number>): Array<boolean | string | number | Date | Buffer | null> {
|
|
213
212
|
return tagOrName.map((s) => this.getTyped(s))
|
|
214
213
|
}
|
|
215
214
|
|
|
@@ -297,14 +296,15 @@ export abstract class MsgView {
|
|
|
297
296
|
|
|
298
297
|
protected abstract stringAtPosition (position: number): string | null
|
|
299
298
|
|
|
300
|
-
protected abstract toTyped (field: SimpleFieldDefinition): boolean | string | number | Date
|
|
299
|
+
protected abstract toTyped (field: SimpleFieldDefinition): boolean | string | number | Date | Buffer | null
|
|
301
300
|
|
|
302
301
|
protected resolveTag (tagOrName: number | string): number {
|
|
303
302
|
let tag: number
|
|
303
|
+
const set = this.segment.set
|
|
304
304
|
if (typeof (tagOrName) === 'string') {
|
|
305
|
-
if (
|
|
306
|
-
const cf =
|
|
307
|
-
const f: SimpleFieldDefinition | null = cf ? cf.definition : this.
|
|
305
|
+
if (set == null) return 0
|
|
306
|
+
const cf = set.simple.get(tagOrName)
|
|
307
|
+
const f: SimpleFieldDefinition | null = cf ? cf.definition : this.definitions.simple.get(tagOrName) ?? null
|
|
308
308
|
if (f == null) {
|
|
309
309
|
return -1
|
|
310
310
|
}
|
|
@@ -382,7 +382,7 @@ export abstract class MsgView {
|
|
|
382
382
|
return groupArray
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
private asLoose (def:
|
|
385
|
+
private asLoose (def: IContainedSet): ILooseObject {
|
|
386
386
|
// eslint-disable-next-line
|
|
387
387
|
return this.reducer.reduce(def, {
|
|
388
388
|
group: (a: ILooseObject, field: ContainedGroupField) => { this.asLooseGroup(a, field) },
|
|
@@ -398,7 +398,7 @@ export abstract class MsgView {
|
|
|
398
398
|
}, {}))
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
private missingRequired (def:
|
|
401
|
+
private missingRequired (def: IContainedSet, tags: number []): number[] {
|
|
402
402
|
const reducer = new SetReduce<number[]>()
|
|
403
403
|
const dispatcher: ITypeDispatcher<number[]> = {
|
|
404
404
|
group: (a: number[], field: ContainedGroupField) => { this.missingGroup(def, field, a) },
|
|
@@ -421,7 +421,7 @@ export abstract class MsgView {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
private missingGroup (def:
|
|
424
|
+
private missingGroup (def: IContainedSet, gf: ContainedGroupField, tags: number []): void {
|
|
425
425
|
const name = gf.definition.noOfField ? gf.definition.noOfField.name : def.name
|
|
426
426
|
const groupView: MsgView | null = this.getView(name) ?? this.getView(gf.definition.name)
|
|
427
427
|
if (groupView == null) {
|
|
@@ -448,7 +448,7 @@ export abstract class MsgView {
|
|
|
448
448
|
const def = sf.definition
|
|
449
449
|
const position: number = this.getPosition(def.tag)
|
|
450
450
|
if (position >= 0) {
|
|
451
|
-
const asSimple: boolean | string | number | Date = this.toTyped(def)
|
|
451
|
+
const asSimple: boolean | string | number | Date | Buffer | null = this.toTyped(def)
|
|
452
452
|
if (asSimple != null) { // beware, may be false value
|
|
453
453
|
a[sf.name] = asSimple
|
|
454
454
|
}
|
|
@@ -483,11 +483,11 @@ export abstract class MsgView {
|
|
|
483
483
|
if (structure == null) return ''
|
|
484
484
|
const tags: Tags = structure.tags
|
|
485
485
|
const count: number = segment.endPosition - segment.startPosition
|
|
486
|
-
const simple:
|
|
486
|
+
const simple: Map<string, SimpleFieldDefinition> = this.definitions.simple
|
|
487
487
|
|
|
488
488
|
for (let i: number = segment.startPosition; i <= segment.endPosition; ++i) {
|
|
489
489
|
const tagPos: TagPos = tags.tagPos[i]
|
|
490
|
-
const field: SimpleFieldDefinition |
|
|
490
|
+
const field: SimpleFieldDefinition | undefined = simple.get(tagPos.tag.toString())
|
|
491
491
|
const val: string | null = this.stringAtPosition(i) ?? ''
|
|
492
492
|
// [0] 8 (BeginString) = FIX4.4
|
|
493
493
|
const token = field ? getToken(field, val, i - segment.startPosition, count, tagPos) : `[${i}] ${tagPos.tag} (unknown) = ${val}, `
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INumericKeyed } from '../../collections/collection'
|
|
2
|
-
import { ContainedField,
|
|
2
|
+
import { ContainedField, IContainedSet } from '../../dictionary/contained'
|
|
3
3
|
import { GroupFieldDefinition } from '../../dictionary/definition'
|
|
4
4
|
import { SegmentType } from './segment-type'
|
|
5
5
|
import { ElasticBuffer } from '../elastic-buffer'
|
|
@@ -16,7 +16,7 @@ export class SegmentDescription {
|
|
|
16
16
|
constructor (
|
|
17
17
|
public name: string,
|
|
18
18
|
public startTag: number,
|
|
19
|
-
public set:
|
|
19
|
+
public set: IContainedSet | null,
|
|
20
20
|
public startPosition: number,
|
|
21
21
|
public readonly depth: number,
|
|
22
22
|
public readonly type: SegmentType) {
|
package/src/buffer/tag/tags.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { FixDefinitions } from '../../dictionary/definition'
|
|
2
|
-
import { ContainedSimpleField } from '../../dictionary/contained'
|
|
3
1
|
import { TagPos } from './tag-pos'
|
|
4
2
|
import { MsgTag } from '../../types'
|
|
5
3
|
import { TagType } from './tag-type'
|
|
@@ -13,11 +11,11 @@ export class Tags {
|
|
|
13
11
|
public tagPos: TagPos[] = new Array(this.startingLength)
|
|
14
12
|
public nextTagPos: number = 0
|
|
15
13
|
|
|
16
|
-
constructor (public readonly
|
|
14
|
+
constructor (public readonly startingLength: number = 30 * 1000) {
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
public static toJSType (
|
|
20
|
-
switch (
|
|
17
|
+
public static toJSType (tagType: TagType): string {
|
|
18
|
+
switch (tagType) {
|
|
21
19
|
case TagType.String:
|
|
22
20
|
return 'string'
|
|
23
21
|
|
|
@@ -103,7 +101,7 @@ export class Tags {
|
|
|
103
101
|
|
|
104
102
|
public clone (): Tags {
|
|
105
103
|
const next: number = this.nextTagPos
|
|
106
|
-
const cloned: Tags = new Tags(
|
|
104
|
+
const cloned: Tags = new Tags(next)
|
|
107
105
|
cloned.nextTagPos = next
|
|
108
106
|
for (let i = 0; i < next; ++i) {
|
|
109
107
|
cloned.tagPos[i] = this.tagPos[i].clone()
|
package/src/collections/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FixDefinitions } from '../dictionary/definition'
|
|
2
|
-
import { ISessionDescription
|
|
2
|
+
import { ISessionDescription } from '../transport/session/session-description'
|
|
3
|
+
import { ISessionMsgFactory } from '../transport/session/session-msg-factory'
|
|
3
4
|
import { JsFixLoggerFactory } from './js-fix-logger-factory'
|
|
4
5
|
import { EmptyLogFactory } from './empty-log-factory'
|
|
5
|
-
import { AsciiChars } from '../buffer/ascii'
|
|
6
|
+
import { AsciiChars } from '../buffer/ascii/ascii-chars'
|
|
6
7
|
import { DependencyContainer } from 'tsyringe'
|
|
7
8
|
|
|
8
9
|
export interface IJsFixConfig {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ContainedField,
|
|
3
|
+
ContainedGroupField,
|
|
4
|
+
ContainedComponentField,
|
|
5
|
+
ContainedFieldType,
|
|
6
|
+
IContainedSet
|
|
7
|
+
} from '../contained'
|
|
2
8
|
import { FixDefinitions } from '../definition'
|
|
3
9
|
|
|
4
10
|
import _ = require('lodash')
|
|
@@ -7,7 +13,7 @@ import { FixDefinitionSource } from '../fix-definition-source'
|
|
|
7
13
|
|
|
8
14
|
export class CompilerType {
|
|
9
15
|
public readonly snaked: string
|
|
10
|
-
constructor (public readonly definitions: FixDefinitions, public readonly set:
|
|
16
|
+
constructor (public readonly definitions: FixDefinitions, public readonly set: IContainedSet, public readonly qualifiedName: string) {
|
|
11
17
|
const snake = _.snakeCase(this.qualifiedName)
|
|
12
18
|
if (set.type === ContainedSetType.Msg) {
|
|
13
19
|
this.snaked = `./${snake}`
|
|
@@ -73,7 +73,7 @@ export class EnumCompiler {
|
|
|
73
73
|
}
|
|
74
74
|
return this.create(field.name, field.description, () => {
|
|
75
75
|
const newLine = require('os').EOL
|
|
76
|
-
return field.enums.keys().reduce((a: number, latest: string, i: number, arr: string[]) => {
|
|
76
|
+
return Array.from(field.enums.keys()).reduce((a: number, latest: string, i: number, arr: string[]) => {
|
|
77
77
|
const k = field.resolveEnum(latest)
|
|
78
78
|
let v: any = latest
|
|
79
79
|
switch (field.tagType) {
|
|
@@ -120,7 +120,7 @@ export class EnumCompiler {
|
|
|
120
120
|
|
|
121
121
|
private toDo (): SimpleFieldDefinition[] {
|
|
122
122
|
const done: ILooseObject = {}
|
|
123
|
-
return this.definitions.simple.values().reduce((a: SimpleFieldDefinition[], latest: SimpleFieldDefinition) => {
|
|
123
|
+
return Array.from(this.definitions.simple.values()).reduce((a: SimpleFieldDefinition[], latest: SimpleFieldDefinition) => {
|
|
124
124
|
if (latest.isEnum() && !done[latest.name]) {
|
|
125
125
|
done[latest.name] = true
|
|
126
126
|
a.push(latest)
|
|
@@ -4,14 +4,13 @@ import { ICompilerSettings } from './compiler-settings'
|
|
|
4
4
|
import { FixDefinitions } from '../definition'
|
|
5
5
|
import {
|
|
6
6
|
ContainedComponentField,
|
|
7
|
-
|
|
7
|
+
IContainedSet,
|
|
8
8
|
ContainedGroupField,
|
|
9
9
|
ContainedSimpleField,
|
|
10
10
|
FieldsDispatch
|
|
11
11
|
} from '../contained'
|
|
12
12
|
import { StandardSnippet } from './standard-snippet'
|
|
13
13
|
import { CompilerType } from './compiler-type'
|
|
14
|
-
import { Dictionary } from '../../collections'
|
|
15
14
|
|
|
16
15
|
import * as fs from 'fs'
|
|
17
16
|
import * as Util from 'util'
|
|
@@ -20,22 +19,22 @@ import { SetReduce } from '../set-reduce'
|
|
|
20
19
|
import { ContainedSetType } from '../contained-set-type'
|
|
21
20
|
import { TagType } from '../../buffer/tag/tag-type'
|
|
22
21
|
|
|
23
|
-
const newLine = require('os').EOL
|
|
22
|
+
const newLine: string = require('os').EOL
|
|
24
23
|
const justifiedWidth: number = 50
|
|
25
24
|
|
|
26
25
|
export class MsgCompiler {
|
|
27
26
|
readonly queue: CompilerType[] = []
|
|
28
27
|
readonly snippets: StandardSnippet
|
|
29
28
|
readonly buffer: ElasticBuffer = new ElasticBuffer()
|
|
30
|
-
readonly completed:
|
|
29
|
+
readonly completed: Map<string, CompilerType>
|
|
31
30
|
|
|
32
31
|
constructor (public readonly definitions: FixDefinitions, public readonly settings: ICompilerSettings) {
|
|
33
|
-
this.completed = new
|
|
32
|
+
this.completed = new Map<string, CompilerType>()
|
|
34
33
|
this.snippets = new StandardSnippet(this.settings)
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
public async generate (): Promise<void> {
|
|
38
|
-
const types: string[] = this.settings.types ?? this.definitions.message.keys()
|
|
37
|
+
const types: string[] = this.settings.types ?? Array.from(this.definitions.message.keys())
|
|
39
38
|
await this.createTypes(types)
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -76,7 +75,7 @@ export class MsgCompiler {
|
|
|
76
75
|
const writeFile = Util.promisify(fs.writeFile)
|
|
77
76
|
const settings = this.settings
|
|
78
77
|
const fileName = 'index.ts'
|
|
79
|
-
const done = this.completed.values()
|
|
78
|
+
const done = Array.from(this.completed.values())
|
|
80
79
|
const exports: string[] = done.reduce<string[]>((prev: string[], current: CompilerType) => {
|
|
81
80
|
prev.push(`export * from '${current.snaked}'`)
|
|
82
81
|
return prev
|
|
@@ -126,7 +125,7 @@ export class MsgCompiler {
|
|
|
126
125
|
return
|
|
127
126
|
}
|
|
128
127
|
this.queue.push(ct)
|
|
129
|
-
completed.
|
|
128
|
+
completed.set(fullName, ct)
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
private simpleComment (simple: ContainedSimpleField): string {
|
|
@@ -137,7 +136,7 @@ export class MsgCompiler {
|
|
|
137
136
|
const snippets = this.snippets
|
|
138
137
|
const settings = this.settings
|
|
139
138
|
const buffer = this.buffer
|
|
140
|
-
const len = buffer.writeString(snippets.simple(simple.name, Tags.toJSType(simple), simple.required, 1))
|
|
139
|
+
const len = buffer.writeString(snippets.simple(simple.name, Tags.toJSType(simple.definition.tagType), simple.required, 1))
|
|
141
140
|
if (settings.tags) {
|
|
142
141
|
buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))
|
|
143
142
|
}
|
|
@@ -155,7 +154,7 @@ export class MsgCompiler {
|
|
|
155
154
|
buffer.writeString(newLine)
|
|
156
155
|
}
|
|
157
156
|
|
|
158
|
-
private tagSummary (definition:
|
|
157
|
+
private tagSummary (definition: IContainedSet, max: number = 3): string {
|
|
159
158
|
function tagTxt (tag: number): string {
|
|
160
159
|
const name = definition.getFieldName(tag)
|
|
161
160
|
return `${name}.${tag}`
|
|
@@ -174,7 +173,7 @@ export class MsgCompiler {
|
|
|
174
173
|
return `${front} .. ${tagTxt(flattened[flattened.length - 1])}`
|
|
175
174
|
}
|
|
176
175
|
|
|
177
|
-
private setComment (set:
|
|
176
|
+
private setComment (set: IContainedSet, position: number, len: number): void {
|
|
178
177
|
if (this.settings.tags) {
|
|
179
178
|
const tagTxt = this.tagSummary(set)
|
|
180
179
|
const buffer = this.buffer
|
|
@@ -206,7 +205,7 @@ export class MsgCompiler {
|
|
|
206
205
|
const snippets = this.snippets
|
|
207
206
|
const buffer = this.buffer
|
|
208
207
|
compilerType.set.localAttribute.forEach((simple: ContainedSimpleField) => {
|
|
209
|
-
const len = buffer.writeString(snippets.simple(simple.definition.name, Tags.toJSType(simple), simple.required, 1))
|
|
208
|
+
const len = buffer.writeString(snippets.simple(simple.definition.name, Tags.toJSType(simple.definition.tagType), simple.required, 1))
|
|
210
209
|
if (settings.tags) {
|
|
211
210
|
buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))
|
|
212
211
|
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { INumericKeyed } from '../../collections/collection'
|
|
2
|
-
import { Dictionary } from '../../collections'
|
|
3
|
-
import { ContainedComponentField } from './contained-component-field'
|
|
4
2
|
import { ContainedField } from './contained-field'
|
|
5
|
-
import { ContainedGroupField } from './contained-group-field'
|
|
6
3
|
import { ContainedSimpleField } from './contained-simple-field'
|
|
7
4
|
import { ElasticBuffer } from '../../buffer/elastic-buffer'
|
|
8
|
-
import { ContainedFieldType } from './contained-field-type'
|
|
9
|
-
import { TagType } from '../../buffer/tag/tag-type'
|
|
10
5
|
import { ContainedSetType } from '../contained-set-type'
|
|
6
|
+
import { IContainedSet } from './contained-set'
|
|
11
7
|
|
|
12
|
-
export abstract class ContainedFieldSet {
|
|
8
|
+
export abstract class ContainedFieldSet implements IContainedSet {
|
|
13
9
|
/**
|
|
14
10
|
* index of name to any group that may be present within the field list
|
|
15
11
|
*/
|
|
16
|
-
public readonly groups:
|
|
12
|
+
public readonly groups: Map<string, IContainedSet> = new Map<string, IContainedSet>()
|
|
17
13
|
/**
|
|
18
14
|
* index of name to any component that may be present within the field list
|
|
19
15
|
*/
|
|
20
|
-
public readonly components:
|
|
16
|
+
public readonly components: Map<string, IContainedSet> = new Map<string, IContainedSet>()
|
|
21
17
|
/**
|
|
22
18
|
* index of name to any simple field that may be present within the field list
|
|
23
19
|
*/
|
|
24
|
-
public readonly simple:
|
|
20
|
+
public readonly simple: Map<string, ContainedSimpleField> = new Map<string, ContainedSimpleField>()
|
|
25
21
|
/**
|
|
26
22
|
* sequence of fields representing this type - can be simple, group or component
|
|
27
23
|
*/
|
|
@@ -57,11 +53,11 @@ export abstract class ContainedFieldSet {
|
|
|
57
53
|
/**
|
|
58
54
|
* only repository directly in this set indexed by name
|
|
59
55
|
*/
|
|
60
|
-
public readonly localNameToField:
|
|
56
|
+
public readonly localNameToField: Map<string, ContainedField> = new Map<string, ContainedField>()
|
|
61
57
|
/**
|
|
62
58
|
* for FixMl notation this set of fields appear as attributes i.e. <Pty ID="323" R="38">
|
|
63
59
|
*/
|
|
64
|
-
public readonly nameToLocalAttribute:
|
|
60
|
+
public readonly nameToLocalAttribute: Map<string, ContainedSimpleField> = new Map<string, ContainedSimpleField>()
|
|
65
61
|
/**
|
|
66
62
|
* all attributes in order of being declared
|
|
67
63
|
*/
|
|
@@ -114,187 +110,36 @@ export abstract class ContainedFieldSet {
|
|
|
114
110
|
|
|
115
111
|
public abstract getPrefix (): string
|
|
116
112
|
|
|
113
|
+
public keys (): number[] {
|
|
114
|
+
const keys: string[] = Object.keys(this.containedTag)
|
|
115
|
+
const nums: number[] = new Array(keys.length)
|
|
116
|
+
for (let j: number = 0; j < keys.length; ++j) {
|
|
117
|
+
nums[j] = parseInt(keys[j], 10)
|
|
118
|
+
}
|
|
119
|
+
return nums
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
public getFieldName (tag: number): string {
|
|
118
123
|
const s = this.tagToSimple[tag]
|
|
119
124
|
if (s == null) {
|
|
120
|
-
const gf = this.tagToField[tag]
|
|
125
|
+
const gf: ContainedField = this.tagToField[tag]
|
|
121
126
|
if (gf !== null) {
|
|
122
|
-
return `${gf.
|
|
127
|
+
return `${gf.name}`
|
|
123
128
|
}
|
|
124
129
|
return `${tag}`
|
|
125
130
|
}
|
|
126
131
|
return s.name
|
|
127
132
|
}
|
|
128
133
|
|
|
129
|
-
/**
|
|
130
|
-
* adds a field to this set - simple, component or group
|
|
131
|
-
* @param field
|
|
132
|
-
*/
|
|
133
|
-
public add (field: ContainedField): void {
|
|
134
|
-
this.fields.push(field)
|
|
135
|
-
this.localNameToField.addUpdate(field.name, field)
|
|
136
|
-
this.addUpdate(field)
|
|
137
|
-
this.addContained(this, field)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
134
|
/**
|
|
141
135
|
* recurses down a path to return nested set definitiom of a group or component
|
|
142
136
|
* given in dot notation 'SecListGrp.NoRelatedSym.SecurityTradingRules.BaseTradingRules'
|
|
143
137
|
* @param path in dot notation
|
|
144
138
|
*/
|
|
145
|
-
public getSet (path: string): (
|
|
139
|
+
public getSet (path: string): (IContainedSet | null) {
|
|
146
140
|
if (!path) return null
|
|
147
|
-
return path.split('.').reduce((set:
|
|
148
|
-
return set.groups.get(next)
|
|
141
|
+
return path.split('.').reduce((set: IContainedSet, next: string): (IContainedSet | null) => {
|
|
142
|
+
return set.groups.get(next) ?? set.components.get(next) ?? null
|
|
149
143
|
}, this)
|
|
150
144
|
}
|
|
151
|
-
|
|
152
|
-
private addUpdate (field: ContainedField): void {
|
|
153
|
-
switch (field.type) {
|
|
154
|
-
case ContainedFieldType.Simple: {
|
|
155
|
-
this.addLocalSimple(field as ContainedSimpleField)
|
|
156
|
-
break
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
case ContainedFieldType.Component: {
|
|
160
|
-
const cf = field as ContainedComponentField
|
|
161
|
-
const definition = cf.definition
|
|
162
|
-
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
163
|
-
this.localNameToField.addUpdate(definition.abbreviation, field)
|
|
164
|
-
}
|
|
165
|
-
break
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
case ContainedFieldType.Group: {
|
|
169
|
-
const gf = field as ContainedComponentField
|
|
170
|
-
const definition = gf.definition
|
|
171
|
-
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
172
|
-
this.localNameToField.addUpdate(definition.abbreviation, field)
|
|
173
|
-
}
|
|
174
|
-
break
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
default:
|
|
178
|
-
throw new Error(`unknown field type ${field.type}`)
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
private addLocalSimple (field: ContainedSimpleField): void {
|
|
183
|
-
const definition = field.definition
|
|
184
|
-
if (definition.abbreviation && definition.abbreviation !== definition.name) {
|
|
185
|
-
this.localNameToField.addUpdate(definition.abbreviation, field)
|
|
186
|
-
}
|
|
187
|
-
if (definition.baseCategoryAbbreviation && definition.baseCategory === this.category) {
|
|
188
|
-
this.localNameToField.addUpdate(definition.baseCategoryAbbreviation, field)
|
|
189
|
-
}
|
|
190
|
-
if (field.attribute) {
|
|
191
|
-
this.nameToLocalAttribute.addUpdate(definition.abbreviation, field)
|
|
192
|
-
this.localAttribute.push(field)
|
|
193
|
-
// an attribute for FixMl lives in attribute set not fields - in this case xml sub elements
|
|
194
|
-
this.fields.pop()
|
|
195
|
-
}
|
|
196
|
-
const tag = definition.tag
|
|
197
|
-
this.localTag[tag] = field
|
|
198
|
-
if (field.required) {
|
|
199
|
-
this.localRequired[tag] = field
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private addContained (parent: ContainedFieldSet, field: ContainedField): void {
|
|
204
|
-
switch (field.type) {
|
|
205
|
-
case ContainedFieldType.Group: {
|
|
206
|
-
this.addGroupFieldDef(field as ContainedGroupField)
|
|
207
|
-
break
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
case ContainedFieldType.Component: {
|
|
211
|
-
this.addComponentFieldDef(field as ContainedComponentField)
|
|
212
|
-
break
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
case ContainedFieldType.Simple: {
|
|
216
|
-
this.addSimpleFieldDef(parent, field as ContainedSimpleField)
|
|
217
|
-
break
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
default:
|
|
221
|
-
throw new Error(`unknown field type ${field.type}`)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private addAllFields (containedField: ContainedFieldSet): void {
|
|
226
|
-
containedField.fields.forEach((f: ContainedField) => {
|
|
227
|
-
this.addContained(containedField, f)
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
private addGroupFieldDef (groupField: ContainedGroupField): void {
|
|
232
|
-
if (this.groups.containsKey(groupField.name)) {
|
|
233
|
-
return
|
|
234
|
-
}
|
|
235
|
-
const definition = groupField.definition
|
|
236
|
-
this.groups.add(groupField.name, groupField)
|
|
237
|
-
const nof = definition.noOfField
|
|
238
|
-
if (nof) {
|
|
239
|
-
const tag = nof.tag
|
|
240
|
-
this.containedTag[tag] = true
|
|
241
|
-
this.flattenedTag.push(tag)
|
|
242
|
-
}
|
|
243
|
-
this.addAllFields(definition)
|
|
244
|
-
this.mapAllBelow(definition, groupField)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
private addComponentFieldDef (componentField: ContainedComponentField): void {
|
|
248
|
-
const components = this.components
|
|
249
|
-
if (components.containsKey(componentField.name)) {
|
|
250
|
-
return
|
|
251
|
-
}
|
|
252
|
-
const definition = componentField.definition
|
|
253
|
-
components.add(componentField.name, componentField)
|
|
254
|
-
this.addAllFields(definition)
|
|
255
|
-
this.mapAllBelow(definition, componentField)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
public keys (): number[] {
|
|
259
|
-
const keys: string[] = Object.keys(this.containedTag)
|
|
260
|
-
const nums: number[] = new Array(keys.length)
|
|
261
|
-
for (let j: number = 0; j < keys.length; ++j) {
|
|
262
|
-
nums[j] = parseInt(keys[j], 10)
|
|
263
|
-
}
|
|
264
|
-
return nums
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private mapAllBelow (set: ContainedFieldSet, field: ContainedField): void {
|
|
268
|
-
// point all tags in this component to this field.
|
|
269
|
-
const tagsBelow: number[] = set.keys()
|
|
270
|
-
for (const t of tagsBelow) {
|
|
271
|
-
this.tagToField[t] = field
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
private addSimpleFieldDef (parent: ContainedFieldSet, field: ContainedSimpleField): void {
|
|
276
|
-
if (this.simple.containsKey(field.name)) {
|
|
277
|
-
return
|
|
278
|
-
}
|
|
279
|
-
if (!this.firstSimple) {
|
|
280
|
-
this.firstSimple = field
|
|
281
|
-
}
|
|
282
|
-
switch (field.definition.tagType) {
|
|
283
|
-
case TagType.RawData: {
|
|
284
|
-
const dataLengthField: ContainedSimpleField = parent.fields[field.position - 1] as ContainedSimpleField
|
|
285
|
-
if (dataLengthField && dataLengthField.definition.tagType === TagType.Length) {
|
|
286
|
-
this.containedLength[dataLengthField.definition.tag] = true
|
|
287
|
-
this.containsRaw = true
|
|
288
|
-
}
|
|
289
|
-
break
|
|
290
|
-
}
|
|
291
|
-
default:
|
|
292
|
-
break
|
|
293
|
-
}
|
|
294
|
-
const tag = field.definition.tag
|
|
295
|
-
this.simple.add(field.name, field)
|
|
296
|
-
this.containedTag[tag] = true
|
|
297
|
-
this.flattenedTag.push(tag)
|
|
298
|
-
this.tagToSimple[tag] = field
|
|
299
|
-
}
|
|
300
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContainedField } from './contained-field'
|
|
2
|
-
import { GroupFieldDefinition } from '../definition'
|
|
2
|
+
import { GroupFieldDefinition } from '../definition/group-field-definition'
|
|
3
3
|
import { ContainedFieldType } from './contained-field-type'
|
|
4
4
|
|
|
5
5
|
export class ContainedGroupField extends ContainedField {
|