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
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ContainedFieldSet } from './contained-field-set'
|
|
2
|
+
import { ContainedField } from './contained-field'
|
|
3
|
+
import { ContainedFieldType } from './contained-field-type'
|
|
4
|
+
import { ContainedSimpleField } from './contained-simple-field'
|
|
5
|
+
import { ContainedComponentField } from './contained-component-field'
|
|
6
|
+
import { ContainedGroupField } from './contained-group-field'
|
|
7
|
+
import { TagType } from '../../buffer/tag/tag-type'
|
|
8
|
+
import { IContainedSet } from './contained-set'
|
|
9
|
+
|
|
10
|
+
export class ContainedSetBuilder {
|
|
11
|
+
public constructor (public set: IContainedSet) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* adds a field to this set - simple, component or group
|
|
16
|
+
* @param field
|
|
17
|
+
*/
|
|
18
|
+
public add (field: ContainedField): void {
|
|
19
|
+
this.set.fields.push(field)
|
|
20
|
+
this.set.localNameToField.set(field.name, field)
|
|
21
|
+
this.addUpdate(field)
|
|
22
|
+
this.addContained(this.set, field)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private addUpdate (field: ContainedField): void {
|
|
26
|
+
switch (field.type) {
|
|
27
|
+
case ContainedFieldType.Simple: {
|
|
28
|
+
this.addLocalSimple(field as ContainedSimpleField)
|
|
29
|
+
break
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
case ContainedFieldType.Component: {
|
|
33
|
+
const cf = field as ContainedComponentField
|
|
34
|
+
const definition = cf.definition
|
|
35
|
+
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
36
|
+
this.set.localNameToField.set(definition.abbreviation, field)
|
|
37
|
+
}
|
|
38
|
+
break
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
case ContainedFieldType.Group: {
|
|
42
|
+
const gf = field as ContainedComponentField
|
|
43
|
+
const definition = gf.definition
|
|
44
|
+
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
45
|
+
this.set.localNameToField.set(definition.abbreviation, field)
|
|
46
|
+
}
|
|
47
|
+
break
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
default:
|
|
51
|
+
throw new Error(`unknown field type ${field.type}`)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private addLocalSimple (field: ContainedSimpleField): void {
|
|
56
|
+
const definition = field.definition
|
|
57
|
+
if (definition.abbreviation && definition.abbreviation !== definition.name) {
|
|
58
|
+
this.set.localNameToField.set(definition.abbreviation, field)
|
|
59
|
+
}
|
|
60
|
+
if (definition.baseCategoryAbbreviation && definition.baseCategory === this.set.category) {
|
|
61
|
+
this.set.localNameToField.set(definition.baseCategoryAbbreviation, field)
|
|
62
|
+
}
|
|
63
|
+
if (field.attribute) {
|
|
64
|
+
this.set.nameToLocalAttribute.set(definition.abbreviation, field)
|
|
65
|
+
this.set.localAttribute.push(field)
|
|
66
|
+
// an attribute for FixMl lives in attribute set not fields - in this case xml sub elements
|
|
67
|
+
this.set.fields.pop()
|
|
68
|
+
}
|
|
69
|
+
const tag = definition.tag
|
|
70
|
+
this.set.localTag[tag] = field
|
|
71
|
+
if (field.required) {
|
|
72
|
+
this.set.localRequired[tag] = field
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private addContained (parent: IContainedSet, field: ContainedField): void {
|
|
77
|
+
switch (field.type) {
|
|
78
|
+
case ContainedFieldType.Group: {
|
|
79
|
+
this.addGroupFieldDef(field as ContainedGroupField)
|
|
80
|
+
break
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
case ContainedFieldType.Component: {
|
|
84
|
+
this.addComponentFieldDef(field as ContainedComponentField)
|
|
85
|
+
break
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
case ContainedFieldType.Simple: {
|
|
89
|
+
this.addSimpleFieldDef(parent, field as ContainedSimpleField)
|
|
90
|
+
break
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
throw new Error(`unknown field type ${field.type}`)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private addGroupFieldDef (groupField: ContainedGroupField): void {
|
|
99
|
+
if (this.set.groups.has(groupField.name)) {
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
const definition = groupField.definition
|
|
103
|
+
this.set.groups.set(groupField.name, definition)
|
|
104
|
+
const nof = definition.noOfField
|
|
105
|
+
if (nof) {
|
|
106
|
+
const tag = nof.tag
|
|
107
|
+
this.set.containedTag[tag] = true
|
|
108
|
+
this.set.flattenedTag.push(tag)
|
|
109
|
+
}
|
|
110
|
+
this.addAllFields(definition)
|
|
111
|
+
this.mapAllBelow(definition, groupField)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private addComponentFieldDef (componentField: ContainedComponentField): void {
|
|
115
|
+
const components = this.set.components
|
|
116
|
+
if (components.has(componentField.name)) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
const definition = componentField.definition
|
|
120
|
+
components.set(componentField.name, definition)
|
|
121
|
+
this.addAllFields(definition)
|
|
122
|
+
this.mapAllBelow(definition, componentField)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private mapAllBelow (set: ContainedFieldSet, field: ContainedField): void {
|
|
126
|
+
// point all tags in this component to this field.
|
|
127
|
+
const tagsBelow: number[] = set.keys()
|
|
128
|
+
for (const t of tagsBelow) {
|
|
129
|
+
this.set.tagToField[t] = field
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private addSimpleFieldDef (parent: IContainedSet, field: ContainedSimpleField): void {
|
|
134
|
+
if (this.set.simple.has(field.name)) {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
if (!this.set.firstSimple) {
|
|
138
|
+
this.set.firstSimple = field
|
|
139
|
+
}
|
|
140
|
+
switch (field.definition.tagType) {
|
|
141
|
+
case TagType.RawData: {
|
|
142
|
+
const dataLengthField: ContainedSimpleField = parent.fields[field.position - 1] as ContainedSimpleField
|
|
143
|
+
if (dataLengthField && dataLengthField.definition.tagType === TagType.Length) {
|
|
144
|
+
this.set.containedLength[dataLengthField.definition.tag] = true
|
|
145
|
+
this.set.containsRaw = true
|
|
146
|
+
}
|
|
147
|
+
break
|
|
148
|
+
}
|
|
149
|
+
default:
|
|
150
|
+
break
|
|
151
|
+
}
|
|
152
|
+
const tag = field.definition.tag
|
|
153
|
+
this.set.simple.set(field.name, field)
|
|
154
|
+
this.set.containedTag[tag] = true
|
|
155
|
+
this.set.flattenedTag.push(tag)
|
|
156
|
+
this.set.tagToSimple[tag] = field
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private addAllFields (containedField: ContainedFieldSet): void {
|
|
160
|
+
containedField.fields.forEach((f: ContainedField) => {
|
|
161
|
+
this.addContained(containedField, f)
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ContainedSimpleField } from './contained-simple-field'
|
|
2
|
+
import { ContainedField } from './contained-field'
|
|
3
|
+
import { INumericKeyed } from '../../collections/collection'
|
|
4
|
+
import { ContainedSetType } from '../contained-set-type'
|
|
5
|
+
|
|
6
|
+
export interface IContainedSet {
|
|
7
|
+
/**
|
|
8
|
+
* index of name to any group that may be present within the field list
|
|
9
|
+
*/
|
|
10
|
+
readonly groups: Map<string, IContainedSet>
|
|
11
|
+
/**
|
|
12
|
+
* index of name to any component that may be present within the field list
|
|
13
|
+
*/
|
|
14
|
+
readonly components: Map<string, IContainedSet>
|
|
15
|
+
/**
|
|
16
|
+
* index of name to any simple field that may be present within the field list
|
|
17
|
+
*/
|
|
18
|
+
readonly simple: Map<string, ContainedSimpleField>
|
|
19
|
+
/**
|
|
20
|
+
* sequence of fields representing this type - can be simple, group or component
|
|
21
|
+
*/
|
|
22
|
+
readonly fields: ContainedField[]
|
|
23
|
+
/**
|
|
24
|
+
* any tag at any level i.e. does this set contain a tag
|
|
25
|
+
*/
|
|
26
|
+
readonly containedTag: INumericKeyed<boolean>
|
|
27
|
+
/**
|
|
28
|
+
* any tag at any level ordered i.e. all tags flattened to list
|
|
29
|
+
*/
|
|
30
|
+
readonly flattenedTag: number[]
|
|
31
|
+
/**
|
|
32
|
+
* any data tags contained length within this set.
|
|
33
|
+
*/
|
|
34
|
+
readonly containedLength: INumericKeyed<boolean>
|
|
35
|
+
/**
|
|
36
|
+
* tags only in repository at this level, not from any at deeper levels
|
|
37
|
+
*/
|
|
38
|
+
readonly localTag: INumericKeyed<ContainedSimpleField>
|
|
39
|
+
/**
|
|
40
|
+
* tags marked required at this level only
|
|
41
|
+
*/
|
|
42
|
+
readonly localRequired: INumericKeyed<ContainedSimpleField>
|
|
43
|
+
/**
|
|
44
|
+
* all tags contained within this field set flattened from all levels
|
|
45
|
+
*/
|
|
46
|
+
readonly tagToSimple: INumericKeyed<ContainedSimpleField>
|
|
47
|
+
/**
|
|
48
|
+
* direct any tag contained within this set to field one level down where it belongs.
|
|
49
|
+
*/
|
|
50
|
+
readonly tagToField: INumericKeyed<ContainedField>
|
|
51
|
+
/**
|
|
52
|
+
* only repository directly in this set indexed by name
|
|
53
|
+
*/
|
|
54
|
+
readonly localNameToField: Map<string, ContainedField>
|
|
55
|
+
/**
|
|
56
|
+
* for FixMl notation this set of fields appear as attributes i.e. <Pty ID="323" R="38">
|
|
57
|
+
*/
|
|
58
|
+
readonly nameToLocalAttribute: Map<string, ContainedSimpleField>
|
|
59
|
+
/**
|
|
60
|
+
* all attributes in order of being declared
|
|
61
|
+
*/
|
|
62
|
+
readonly localAttribute: ContainedSimpleField[]
|
|
63
|
+
readonly type: ContainedSetType
|
|
64
|
+
readonly name: string
|
|
65
|
+
readonly category: string | null
|
|
66
|
+
readonly abbreviation: string | null
|
|
67
|
+
readonly description: string | null
|
|
68
|
+
/**
|
|
69
|
+
* at any level on this set, first declared simple field
|
|
70
|
+
*/
|
|
71
|
+
firstSimple: (ContainedSimpleField | null)
|
|
72
|
+
containsRaw: boolean
|
|
73
|
+
|
|
74
|
+
toString: () => string
|
|
75
|
+
|
|
76
|
+
getPrefix: () => string
|
|
77
|
+
|
|
78
|
+
getFieldName: (tag: number) => string
|
|
79
|
+
|
|
80
|
+
getSet: (path: string) => IContainedSet | null
|
|
81
|
+
|
|
82
|
+
keys: () => number[]
|
|
83
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContainedField } from './contained-field'
|
|
2
|
-
import { SimpleFieldDefinition } from '../definition'
|
|
2
|
+
import { SimpleFieldDefinition } from '../definition/simple-field-definition'
|
|
3
3
|
import { ContainedFieldType } from './contained-field-type'
|
|
4
4
|
|
|
5
5
|
export class ContainedSimpleField extends ContainedField {
|
|
@@ -2,7 +2,10 @@ export * from './contained-component-field'
|
|
|
2
2
|
export * from './contained-field-type'
|
|
3
3
|
export * from './contained-field'
|
|
4
4
|
export * from './contained-field-dispatch'
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './fields-dispatch'
|
|
6
|
+
export * from './contained-set'
|
|
7
|
+
export * from './contained-set-builder'
|
|
6
8
|
export * from './contained-group-field'
|
|
7
9
|
export * from './contained-simple-field'
|
|
8
10
|
export * from './fields-dispatch'
|
|
11
|
+
export * from './contained-set-builder'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SimpleFieldDefinition } from './simple-field-definition'
|
|
2
|
-
import { Dictionary } from '../../collections'
|
|
3
2
|
|
|
4
3
|
export class CategorySimpleSet {
|
|
5
|
-
public readonly simple:
|
|
4
|
+
public readonly simple: Map<string, SimpleFieldDefinition> = new Map<string, SimpleFieldDefinition>()
|
|
6
5
|
constructor (public readonly category: string) {
|
|
7
6
|
}
|
|
8
7
|
}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { INumericKeyed } from '../../collections/collection'
|
|
2
|
-
import { Dictionary } from '../../collections'
|
|
3
2
|
import { ComponentFieldDefinition } from './component-field-definition'
|
|
4
3
|
import { MessageDefinition } from './message-definition'
|
|
5
4
|
import { SimpleFieldDefinition } from './simple-field-definition'
|
|
6
5
|
import { FixVersion } from '../fix-versions'
|
|
7
6
|
import { CategorySimpleSet } from './category-simple-set'
|
|
8
|
-
import { ContainedFieldSet } from '../contained'
|
|
9
7
|
import { FixDefinitionSource } from '../fix-definition-source'
|
|
10
8
|
import { FixVersionParser } from './fix-version-parser'
|
|
9
|
+
import { IContainedSet } from '../contained/contained-set'
|
|
11
10
|
|
|
12
11
|
export class FixDefinitions {
|
|
13
12
|
/**
|
|
14
13
|
* all simple fields defined from source definition indexed via name
|
|
15
14
|
* e.g. 'BeginString'
|
|
16
15
|
*/
|
|
17
|
-
public readonly simple:
|
|
16
|
+
public readonly simple: Map<string, SimpleFieldDefinition> = new Map<string, SimpleFieldDefinition>()
|
|
18
17
|
/**
|
|
19
18
|
* all components defined from source definition indexed via name
|
|
20
19
|
* e.g. 'Instrument'
|
|
21
20
|
*/
|
|
22
|
-
public readonly component:
|
|
21
|
+
public readonly component: Map<string, ComponentFieldDefinition> = new Map<string, ComponentFieldDefinition>()
|
|
23
22
|
/**
|
|
24
23
|
* all messages defined from source definition indexed via name
|
|
25
24
|
* e.g. 'Logon'
|
|
26
25
|
*/
|
|
27
|
-
public readonly message:
|
|
26
|
+
public readonly message: Map<string, MessageDefinition> = new Map<string, MessageDefinition>()
|
|
28
27
|
/**
|
|
29
28
|
* all messages defined from source definition indexed via tag id
|
|
30
29
|
* e.g. 8
|
|
@@ -33,7 +32,7 @@ export class FixDefinitions {
|
|
|
33
32
|
/**
|
|
34
33
|
* all fields within a category indexed via name used for FIXML
|
|
35
34
|
*/
|
|
36
|
-
public readonly categorySimple:
|
|
35
|
+
public readonly categorySimple: Map<string, CategorySimpleSet> = new Map<string, CategorySimpleSet>()
|
|
37
36
|
|
|
38
37
|
constructor (public readonly source: FixDefinitionSource, public readonly version: FixVersion) {
|
|
39
38
|
}
|
|
@@ -52,11 +51,14 @@ export class FixDefinitions {
|
|
|
52
51
|
|
|
53
52
|
public toString (): string {
|
|
54
53
|
const msgs = this.message.values()
|
|
55
|
-
const strs: String[] =
|
|
54
|
+
const strs: String[] = []
|
|
55
|
+
for (const message of msgs) {
|
|
56
|
+
strs.push(message.toString())
|
|
57
|
+
}
|
|
56
58
|
return JSON.stringify(strs, null, 4)
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
public containedSet (type: string):
|
|
61
|
+
public containedSet (type: string): IContainedSet | undefined {
|
|
60
62
|
return this.message.get(type) ?? this.component.get(type)
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -66,7 +68,7 @@ export class FixDefinitions {
|
|
|
66
68
|
* 'SecurityList.SecListGrp.NoRelatedSym.SecurityTradingRules'
|
|
67
69
|
* @param path dot denoted path too field set nested from root
|
|
68
70
|
*/
|
|
69
|
-
public getSet (path: string):
|
|
71
|
+
public getSet (path: string): IContainedSet | undefined {
|
|
70
72
|
const idx = path.indexOf('.')
|
|
71
73
|
let name: string = path
|
|
72
74
|
if (idx > 0) {
|
|
@@ -74,7 +76,7 @@ export class FixDefinitions {
|
|
|
74
76
|
} else {
|
|
75
77
|
return this.message.get(name)
|
|
76
78
|
}
|
|
77
|
-
return this.message.get(name)?.getSet(path.substring(idx + 1)) ??
|
|
79
|
+
return this.message.get(name)?.getSet(path.substring(idx + 1)) ?? undefined
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
/**
|
|
@@ -84,13 +86,13 @@ export class FixDefinitions {
|
|
|
84
86
|
*/
|
|
85
87
|
public addMessage (message: MessageDefinition): void {
|
|
86
88
|
const messages = this.message
|
|
87
|
-
messages.
|
|
89
|
+
messages.set(message.name, message)
|
|
88
90
|
if (message.msgType && message.msgType !== message.name) {
|
|
89
|
-
messages.
|
|
91
|
+
messages.set(message.msgType, message)
|
|
90
92
|
}
|
|
91
93
|
if (message.abbreviation) {
|
|
92
94
|
if (message.abbreviation !== message.name) {
|
|
93
|
-
messages.
|
|
95
|
+
messages.set(message.abbreviation, message)
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
}
|
|
@@ -100,7 +102,7 @@ export class FixDefinitions {
|
|
|
100
102
|
* @param field
|
|
101
103
|
*/
|
|
102
104
|
public addComponentFieldDef (field: ComponentFieldDefinition): void {
|
|
103
|
-
this.component.
|
|
105
|
+
this.component.set(field.name, field)
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
/**
|
|
@@ -109,10 +111,10 @@ export class FixDefinitions {
|
|
|
109
111
|
* @param name of the field to fetch
|
|
110
112
|
* @param cat optional category from which field belongs
|
|
111
113
|
*/
|
|
112
|
-
public getSimple (name: string, cat?: string | null): SimpleFieldDefinition |
|
|
113
|
-
let sf: SimpleFieldDefinition |
|
|
114
|
+
public getSimple (name: string, cat?: string | null): SimpleFieldDefinition | undefined {
|
|
115
|
+
let sf: SimpleFieldDefinition | undefined
|
|
114
116
|
if (cat) {
|
|
115
|
-
const category
|
|
117
|
+
const category = this.categorySimple.get(cat)
|
|
116
118
|
if (category) {
|
|
117
119
|
sf = category.simple.get(name)
|
|
118
120
|
}
|
|
@@ -131,7 +133,7 @@ export class FixDefinitions {
|
|
|
131
133
|
public addSimpleAlias (from: string, to: string): void {
|
|
132
134
|
const simple = this.simple.get(from)
|
|
133
135
|
if (simple) {
|
|
134
|
-
this.simple.
|
|
136
|
+
this.simple.set(to, simple)
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -144,27 +146,27 @@ export class FixDefinitions {
|
|
|
144
146
|
public addSimpleFieldDef (field: SimpleFieldDefinition, typeName: string | null = null): void {
|
|
145
147
|
this.assignCategory(field)
|
|
146
148
|
const simple = this.simple
|
|
147
|
-
simple.
|
|
148
|
-
simple.
|
|
149
|
+
simple.set(field.num, field)
|
|
150
|
+
simple.set(field.name, field)
|
|
149
151
|
this.tagToSimple[field.tag] = field
|
|
150
152
|
if (field.abbreviation && field.abbreviation !== field.name) {
|
|
151
|
-
if (!simple.
|
|
152
|
-
simple.
|
|
153
|
+
if (!simple.has(field.abbreviation)) {
|
|
154
|
+
simple.set(field.abbreviation, field)
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
if (typeName && typeName !== field.name && field.name && field.type) {
|
|
156
|
-
simple.
|
|
158
|
+
simple.set(typeName, field)
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
private assignCategory (field: SimpleFieldDefinition): void {
|
|
161
163
|
if (field.baseCategory && field.baseCategoryAbbreviation) {
|
|
162
|
-
let category
|
|
164
|
+
let category = this.categorySimple.get(field.baseCategory)
|
|
163
165
|
if (!category) {
|
|
164
166
|
category = new CategorySimpleSet(field.baseCategory)
|
|
165
|
-
this.categorySimple.
|
|
167
|
+
this.categorySimple.set(field.baseCategory, category)
|
|
166
168
|
}
|
|
167
|
-
category.simple.
|
|
169
|
+
category.simple.set(field.baseCategoryAbbreviation, field)
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ContainedFieldSet } from '../contained'
|
|
1
|
+
import { ContainedFieldSet } from '../contained/contained-field-set'
|
|
2
2
|
import { ContainedSetType } from '../contained-set-type'
|
|
3
3
|
|
|
4
4
|
export class MessageDefinition extends ContainedFieldSet {
|
|
5
|
-
constructor (
|
|
6
|
-
|
|
5
|
+
constructor (readonly name: string,
|
|
6
|
+
readonly abbreviation: string,
|
|
7
7
|
public readonly msgType: string,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
readonly category: string,
|
|
9
|
+
readonly description: string | null) {
|
|
10
10
|
super(ContainedSetType.Msg, name, category, abbreviation, description)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
getPrefix (): string {
|
|
14
14
|
return `M.${this.msgType}`
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Dictionary } from '../../collections'
|
|
2
1
|
import { FieldEnum } from '../field-enum'
|
|
3
2
|
import { Tags } from '../../buffer/tag/tags'
|
|
4
3
|
import { AsciiChars } from '../../buffer/ascii/ascii-chars'
|
|
@@ -8,8 +7,8 @@ import { TagType } from '../../buffer/tag/tag-type'
|
|
|
8
7
|
export class SimpleFieldDefinition {
|
|
9
8
|
public readonly tag: number
|
|
10
9
|
public readonly tagType: TagType
|
|
11
|
-
public enums:
|
|
12
|
-
public enumVals:
|
|
10
|
+
public enums: Map<string, FieldEnum>
|
|
11
|
+
public enumVals: Map<string, boolean>
|
|
13
12
|
|
|
14
13
|
constructor (public readonly num: string,
|
|
15
14
|
public readonly name: string,
|
|
@@ -31,7 +30,7 @@ export class SimpleFieldDefinition {
|
|
|
31
30
|
if (!enums) {
|
|
32
31
|
return false
|
|
33
32
|
}
|
|
34
|
-
return enums.
|
|
33
|
+
return enums.has(key)
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
public resolveEnum (key: string): string {
|
|
@@ -39,7 +38,7 @@ export class SimpleFieldDefinition {
|
|
|
39
38
|
if (!enums) {
|
|
40
39
|
return key
|
|
41
40
|
}
|
|
42
|
-
const e: FieldEnum |
|
|
41
|
+
const e: FieldEnum | undefined = enums.get(key)
|
|
43
42
|
if (e) {
|
|
44
43
|
return e.val
|
|
45
44
|
}
|
|
@@ -55,7 +54,7 @@ export class SimpleFieldDefinition {
|
|
|
55
54
|
if (atDigit) {
|
|
56
55
|
converted = `E${converted}`
|
|
57
56
|
}
|
|
58
|
-
if (this.enumVals.
|
|
57
|
+
if (this.enumVals.has(converted)) {
|
|
59
58
|
converted = `${converted}2`
|
|
60
59
|
}
|
|
61
60
|
return converted
|
|
@@ -65,13 +64,13 @@ export class SimpleFieldDefinition {
|
|
|
65
64
|
let enums = this.enums
|
|
66
65
|
let enumVals = this.enumVals
|
|
67
66
|
if (enums == null) {
|
|
68
|
-
this.enums = enums = new
|
|
69
|
-
this.enumVals = enumVals = new
|
|
67
|
+
this.enums = enums = new Map<string, FieldEnum>()
|
|
68
|
+
this.enumVals = enumVals = new Map<string, boolean>()
|
|
70
69
|
}
|
|
71
70
|
if (!description) description = val
|
|
72
71
|
val = this.patchEnumValue(val)
|
|
73
|
-
enums.
|
|
74
|
-
enumVals.
|
|
72
|
+
enums.set(key, new FieldEnum(key, val, description ?? ''))
|
|
73
|
+
enumVals.set(val, true)
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
public toString (): string {
|