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,8 +3,14 @@ import {
|
|
|
3
3
|
SimpleFieldDefinition, GroupFieldDefinition, ComponentFieldDefinition,
|
|
4
4
|
MessageDefinition, FixDefinitions
|
|
5
5
|
} from '../../definition'
|
|
6
|
-
|
|
7
|
-
import {
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
IContainedSet,
|
|
9
|
+
ContainedComponentField,
|
|
10
|
+
ContainedGroupField,
|
|
11
|
+
ContainedSimpleField,
|
|
12
|
+
ContainedSetBuilder
|
|
13
|
+
} from '../../contained'
|
|
8
14
|
import { FixVersion } from '../../fix-versions'
|
|
9
15
|
import { GetJsFixLogger, IJsFixLogger } from '../../../config'
|
|
10
16
|
import { FixDefinitionSource } from '../../fix-definition-source'
|
|
@@ -28,10 +34,10 @@ export class Repository {
|
|
|
28
34
|
public includesAbbreviations: boolean
|
|
29
35
|
// derived from above
|
|
30
36
|
public readonly definitions: FixDefinitions
|
|
31
|
-
private readonly groupLookup:
|
|
32
|
-
private contentLookup:
|
|
33
|
-
private componentLookup:
|
|
34
|
-
private dataTypeLookup:
|
|
37
|
+
private readonly groupLookup: Map<string, GroupFieldDefinition> = new Map<string, GroupFieldDefinition>()
|
|
38
|
+
private contentLookup: Map<string, IRepositoryMsgContent[]>
|
|
39
|
+
private componentLookup: Map<string, IRepositoryComponent>
|
|
40
|
+
private dataTypeLookup: Map<string, IRepositoryDataType>
|
|
35
41
|
private readonly logger: IJsFixLogger
|
|
36
42
|
|
|
37
43
|
constructor (public readonly version: FixVersion, public readonly getLogger: GetJsFixLogger) {
|
|
@@ -104,9 +110,9 @@ export class Repository {
|
|
|
104
110
|
private summarise (): void {
|
|
105
111
|
const logger = this.logger
|
|
106
112
|
const definitions = this.definitions
|
|
107
|
-
logger.info(`definitions: ${definitions.simple.
|
|
108
|
-
logger.info(`definitions: ${definitions.component.
|
|
109
|
-
logger.info(`definitions: ${definitions.message.
|
|
113
|
+
logger.info(`definitions: ${definitions.simple.size} fields`)
|
|
114
|
+
logger.info(`definitions: ${definitions.component.size} components`)
|
|
115
|
+
logger.info(`definitions: ${definitions.message.size} messages`)
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
private toDefinitions (): void {
|
|
@@ -129,16 +135,16 @@ export class Repository {
|
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
private header (): void {
|
|
132
|
-
const h: ComponentFieldDefinition |
|
|
138
|
+
const h: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardHeader')
|
|
133
139
|
if (h) {
|
|
134
|
-
this.definitions.component.
|
|
140
|
+
this.definitions.component.set('header', h)
|
|
135
141
|
}
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
private trailer (): void {
|
|
139
|
-
const t: ComponentFieldDefinition |
|
|
145
|
+
const t: ComponentFieldDefinition | undefined = this.definitions.component.get('StandardTrailer')
|
|
140
146
|
if (t) {
|
|
141
|
-
this.definitions.component.
|
|
147
|
+
this.definitions.component.set('trailer', t)
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
|
|
@@ -189,8 +195,8 @@ export class Repository {
|
|
|
189
195
|
this.dataTypeLookup = this.types()
|
|
190
196
|
const definitions = this.definitions
|
|
191
197
|
const types = this.dataTypeLookup
|
|
192
|
-
types.
|
|
193
|
-
types.
|
|
198
|
+
types.delete('boolean')
|
|
199
|
+
types.delete('data')
|
|
194
200
|
this.Fields.forEach((f: IRepositoryField) => {
|
|
195
201
|
const type = this.getType(f)
|
|
196
202
|
definitions.addSimpleFieldDef(Repository.makeSimple(f, type))
|
|
@@ -198,32 +204,33 @@ export class Repository {
|
|
|
198
204
|
this.fieldEnums()
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
private contents ():
|
|
207
|
+
private contents (): Map<string, IRepositoryMsgContent[]> {
|
|
202
208
|
return this.MsgContents.reduce((a, current) => {
|
|
203
|
-
let content: IRepositoryMsgContent[] |
|
|
209
|
+
let content: IRepositoryMsgContent[] | undefined = a.get(current.ComponentID)
|
|
204
210
|
if (!content) {
|
|
205
211
|
content = []
|
|
206
|
-
a.
|
|
212
|
+
a.set(current.ComponentID, content)
|
|
207
213
|
}
|
|
208
214
|
content[content.length] = current
|
|
209
215
|
return a
|
|
210
|
-
}, new
|
|
216
|
+
}, new Map<string, IRepositoryMsgContent[]>())
|
|
211
217
|
}
|
|
212
218
|
|
|
213
|
-
private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet:
|
|
219
|
+
private resolveToFieldSet (content: IRepositoryMsgContent[], parentSet: IContainedSet): void {
|
|
220
|
+
const builder = new ContainedSetBuilder(parentSet)
|
|
214
221
|
content.forEach((current: IRepositoryMsgContent) => {
|
|
215
222
|
const required: boolean = current.Reqd === '1'
|
|
216
223
|
const tag: number = parseInt(current.TagText, 10)
|
|
217
224
|
if (!isNaN(tag)) {
|
|
218
225
|
const sf: SimpleFieldDefinition = this.definitions.tagToSimple[tag]
|
|
219
226
|
if (sf) {
|
|
220
|
-
|
|
227
|
+
builder.add(new ContainedSimpleField(sf, parentSet.fields.length, required, false))
|
|
221
228
|
}
|
|
222
229
|
} else {
|
|
223
230
|
// is there a definition for this type yet create.
|
|
224
|
-
let childSet:
|
|
231
|
+
let childSet: IContainedSet | undefined = this.definitions.component.get(current.TagText)
|
|
225
232
|
if (!childSet) {
|
|
226
|
-
const cl: IRepositoryComponent |
|
|
233
|
+
const cl: IRepositoryComponent | undefined = this.componentLookup.get(current.TagText)
|
|
227
234
|
if (cl) {
|
|
228
235
|
childSet = this.resolve(cl)
|
|
229
236
|
}
|
|
@@ -231,12 +238,12 @@ export class Repository {
|
|
|
231
238
|
if (childSet) {
|
|
232
239
|
switch (childSet.type) {
|
|
233
240
|
case ContainedSetType.Component: {
|
|
234
|
-
|
|
241
|
+
builder.add(new ContainedComponentField(childSet as ComponentFieldDefinition, parentSet.fields.length, required))
|
|
235
242
|
break
|
|
236
243
|
}
|
|
237
244
|
|
|
238
245
|
case ContainedSetType.Group: {
|
|
239
|
-
|
|
246
|
+
builder.add(new ContainedGroupField(childSet as GroupFieldDefinition, parentSet.fields.length, required))
|
|
240
247
|
break
|
|
241
248
|
}
|
|
242
249
|
|
|
@@ -250,24 +257,24 @@ export class Repository {
|
|
|
250
257
|
})
|
|
251
258
|
}
|
|
252
259
|
|
|
253
|
-
private resolve (c: IRepositoryComponent):
|
|
260
|
+
private resolve (c: IRepositoryComponent): IContainedSet {
|
|
254
261
|
switch (c.ComponentType) {
|
|
255
262
|
case 'ImplicitBlockRepeating':
|
|
256
263
|
case 'BlockRepeating': {
|
|
257
|
-
const content: IRepositoryMsgContent[] |
|
|
264
|
+
const content: IRepositoryMsgContent[] | undefined = this.contentLookup.get(c.ComponentID) ?? []
|
|
258
265
|
const noField: SimpleFieldDefinition = this.definitions.tagToSimple[parseInt(content[0].TagText, 10)]
|
|
259
|
-
let def: GroupFieldDefinition |
|
|
266
|
+
let def: GroupFieldDefinition | undefined = this.groupLookup.get(c.ComponentID)
|
|
260
267
|
if (!def) {
|
|
261
268
|
def = new GroupFieldDefinition(c.Name, c.AbbrName, c.CategoryID, noField, c.Description)
|
|
262
269
|
this.resolveToFieldSet(content.slice(1), def)
|
|
263
|
-
this.groupLookup.
|
|
270
|
+
this.groupLookup.set(c.ComponentID, def)
|
|
264
271
|
}
|
|
265
272
|
return def
|
|
266
273
|
}
|
|
267
274
|
|
|
268
275
|
default: {
|
|
269
276
|
const content: IRepositoryMsgContent[] | null = this.contentLookup.get(c.ComponentID) ?? []
|
|
270
|
-
let def: ComponentFieldDefinition |
|
|
277
|
+
let def: ComponentFieldDefinition | undefined = this.definitions.component.get(c.Name)
|
|
271
278
|
if (!def) {
|
|
272
279
|
def = new ComponentFieldDefinition(c.Name, c.AbbrName, c.CategoryID, c.Description)
|
|
273
280
|
this.resolveToFieldSet(content, def)
|
|
@@ -281,7 +288,7 @@ export class Repository {
|
|
|
281
288
|
private message (m: IRepositoryMessage): MessageDefinition {
|
|
282
289
|
const definitions = this.definitions
|
|
283
290
|
const content: IRepositoryMsgContent[] = this.contentLookup.get(m.ComponentID) ?? []
|
|
284
|
-
let def: MessageDefinition |
|
|
291
|
+
let def: MessageDefinition | undefined = definitions.message.get(m.Name)
|
|
285
292
|
if (!def) {
|
|
286
293
|
def = new MessageDefinition(m.Name, m.AbbrName, m.MsgType, m.CategoryID, m.Description)
|
|
287
294
|
this.resolveToFieldSet(content, def)
|
|
@@ -290,18 +297,18 @@ export class Repository {
|
|
|
290
297
|
return def
|
|
291
298
|
}
|
|
292
299
|
|
|
293
|
-
private components ():
|
|
294
|
-
return this.Components.reduce((a:
|
|
295
|
-
a.
|
|
296
|
-
a.
|
|
300
|
+
private components (): Map<string, IRepositoryComponent> {
|
|
301
|
+
return this.Components.reduce((a: Map<string, IRepositoryComponent>, current: IRepositoryComponent) => {
|
|
302
|
+
a.set(current.Name, current)
|
|
303
|
+
a.set(current.ComponentID, current)
|
|
297
304
|
return a
|
|
298
|
-
}, new
|
|
305
|
+
}, new Map<string, IRepositoryComponent>())
|
|
299
306
|
}
|
|
300
307
|
|
|
301
|
-
private types ():
|
|
302
|
-
return this.DataTypes.reduce((a:
|
|
303
|
-
a.
|
|
308
|
+
private types (): Map<string, IRepositoryDataType> {
|
|
309
|
+
return this.DataTypes.reduce((a: Map<string, IRepositoryDataType>, current: IRepositoryDataType) => {
|
|
310
|
+
a.set(current.Name, current)
|
|
304
311
|
return a
|
|
305
|
-
}, new
|
|
312
|
+
}, new Map<string, IRepositoryDataType>())
|
|
306
313
|
}
|
|
307
314
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ISaxNode } from '../../sax-node'
|
|
2
|
-
import { Dictionary } from '../../../collections'
|
|
3
2
|
import { XsdParser } from './xsd-parser'
|
|
4
3
|
import {
|
|
5
4
|
ContainedGroupField,
|
|
6
|
-
|
|
5
|
+
IContainedSet,
|
|
6
|
+
ContainedSetBuilder,
|
|
7
7
|
ContainedComponentField,
|
|
8
8
|
ContainedSimpleField,
|
|
9
9
|
ContainedField
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from '../../definition'
|
|
17
17
|
|
|
18
18
|
export class ComponentsParser extends XsdParser {
|
|
19
|
-
private readonly attributeGroups:
|
|
20
|
-
private readonly groups:
|
|
19
|
+
private readonly attributeGroups: Map<string, IAttributeGroup> = new Map<string, IAttributeGroup>()
|
|
20
|
+
private readonly groups: Map<string, IGroup> = new Map<string, IGroup>()
|
|
21
21
|
private readonly unboundElements: IElement[] = []
|
|
22
|
-
private readonly complexTypes:
|
|
22
|
+
private readonly complexTypes: Map<string, IComplexType> = new Map<string, IComplexType>()
|
|
23
23
|
|
|
24
24
|
private newComplexTypes: IComplexType[]
|
|
25
25
|
private currentGroup: (IGroup | null)
|
|
@@ -31,7 +31,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
31
31
|
super(definitions)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
private static getName (group: (IGroup |
|
|
34
|
+
private static getName (group: (IGroup | undefined), attributeGroup: (IAttributeGroup | undefined), type: IComplexType): string {
|
|
35
35
|
let name: string
|
|
36
36
|
if (type?.appInfo) {
|
|
37
37
|
name = type.appInfo.name
|
|
@@ -64,7 +64,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
64
64
|
if (this.currentComplexType != null) {
|
|
65
65
|
const complex: IComplexType = this.currentComplexType
|
|
66
66
|
this.previousComplexType = complex
|
|
67
|
-
this.complexTypes.
|
|
67
|
+
this.complexTypes.set(complex.name, complex)
|
|
68
68
|
this.newComplexTypes.push(complex)
|
|
69
69
|
this.currentComplexType = null
|
|
70
70
|
}
|
|
@@ -73,7 +73,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
73
73
|
|
|
74
74
|
case 'xs:group': {
|
|
75
75
|
if (this.currentGroup) {
|
|
76
|
-
this.groups.
|
|
76
|
+
this.groups.set(this.currentGroup.name, this.currentGroup)
|
|
77
77
|
this.currentGroup = null
|
|
78
78
|
}
|
|
79
79
|
break
|
|
@@ -84,7 +84,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
84
84
|
if (attributeStack.length > 0) {
|
|
85
85
|
const group: IAttributeGroup | undefined = attributeStack.pop()
|
|
86
86
|
if (group?.name) {
|
|
87
|
-
this.attributeGroups.
|
|
87
|
+
this.attributeGroups.set(group?.name, group)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
break
|
|
@@ -242,12 +242,13 @@ export class ComponentsParser extends XsdParser {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
private addElement (set:
|
|
245
|
+
private addElement (set: IContainedSet, element: IElement): void {
|
|
246
246
|
const minOccurs: number = parseInt(element.minOccurs, 10)
|
|
247
247
|
const isGroup: boolean = element.maxOccurs === 'unbounded'
|
|
248
248
|
const isComponent: boolean = element.maxOccurs === '1' || !isGroup
|
|
249
249
|
const key = element.type || element.ref || element.name
|
|
250
|
-
const
|
|
250
|
+
const builder = new ContainedSetBuilder(set)
|
|
251
|
+
const containedType: IComplexType | undefined = this.complexTypes.get(key)
|
|
251
252
|
if (containedType) {
|
|
252
253
|
if (isComponent) {
|
|
253
254
|
const containedDefinition: ComponentFieldDefinition = this.getComponent(containedType)
|
|
@@ -256,7 +257,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
256
257
|
set.fields.length,
|
|
257
258
|
minOccurs > 0,
|
|
258
259
|
element.name)
|
|
259
|
-
|
|
260
|
+
builder.add(containedField)
|
|
260
261
|
} else if (isGroup) {
|
|
261
262
|
const containedDefinition: GroupFieldDefinition = this.getGroup(containedType)
|
|
262
263
|
const containedField: ContainedGroupField =
|
|
@@ -264,7 +265,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
264
265
|
set.fields.length,
|
|
265
266
|
minOccurs > 0,
|
|
266
267
|
element.name)
|
|
267
|
-
|
|
268
|
+
builder.add(containedField)
|
|
268
269
|
}
|
|
269
270
|
} else {
|
|
270
271
|
if (key !== 'Message') {
|
|
@@ -273,12 +274,12 @@ export class ComponentsParser extends XsdParser {
|
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
private addElements (set:
|
|
277
|
+
private addElements (set: IContainedSet, elements: IElement[]): void {
|
|
277
278
|
if (elements) {
|
|
278
279
|
elements.forEach((element: IElement) => {
|
|
279
280
|
switch (element.type) {
|
|
280
281
|
case 'xs:group': {
|
|
281
|
-
const groupElements: IGroup |
|
|
282
|
+
const groupElements: IGroup | undefined = this.groups.get(element.name)
|
|
282
283
|
if (groupElements) {
|
|
283
284
|
this.addElements(set, groupElements.elements)
|
|
284
285
|
} else {
|
|
@@ -295,7 +296,7 @@ export class ComponentsParser extends XsdParser {
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
private addSimpleAttribute (set:
|
|
299
|
+
private addSimpleAttribute (set: IContainedSet, attribute: IAttribute): void {
|
|
299
300
|
let sf = this.definitions.getSimple(attribute.type)
|
|
300
301
|
if (!sf) {
|
|
301
302
|
sf = this.definitions.getSimple(attribute.name, set.category)
|
|
@@ -306,17 +307,18 @@ export class ComponentsParser extends XsdParser {
|
|
|
306
307
|
attribute.use !== 'optional',
|
|
307
308
|
true,
|
|
308
309
|
attribute.name)
|
|
309
|
-
set
|
|
310
|
+
const builder = new ContainedSetBuilder(set)
|
|
311
|
+
builder.add(contained)
|
|
310
312
|
} else if (set.name !== 'FixmlAttributes') {
|
|
311
313
|
throw new Error(`unable to resolve simple attribute ${attribute.name}`)
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
316
|
|
|
315
|
-
private addAttributes (set:
|
|
317
|
+
private addAttributes (set: IContainedSet, attributes: IAttribute[]): void {
|
|
316
318
|
attributes.forEach((attribute: IAttribute) => {
|
|
317
319
|
switch (attribute.type) {
|
|
318
320
|
case 'xs:attributeGroup': {
|
|
319
|
-
const attributeGroup: IAttributeGroup |
|
|
321
|
+
const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(attribute.name)
|
|
320
322
|
if (attributeGroup) {
|
|
321
323
|
this.addAttributes(set, attributeGroup.attributes)
|
|
322
324
|
} else {
|
|
@@ -333,8 +335,8 @@ export class ComponentsParser extends XsdParser {
|
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
private getGroup (type: IComplexType): GroupFieldDefinition {
|
|
336
|
-
const group: IGroup |
|
|
337
|
-
const attributeGroup: IAttributeGroup |
|
|
338
|
+
const group: IGroup | undefined = this.groups.get(type.group)
|
|
339
|
+
const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)
|
|
338
340
|
const name: string = ComponentsParser.getName(group, attributeGroup, type)
|
|
339
341
|
const category = type.appInfo != null ? type.appInfo.Category : null
|
|
340
342
|
const groupDefinition: GroupFieldDefinition = new GroupFieldDefinition(name, name, category, null, null)
|
|
@@ -344,25 +346,25 @@ export class ComponentsParser extends XsdParser {
|
|
|
344
346
|
|
|
345
347
|
private getComponent (type: IComplexType): ComponentFieldDefinition {
|
|
346
348
|
const definitions: FixDefinitions = this.definitions
|
|
347
|
-
const group: IGroup |
|
|
348
|
-
const attributeGroup: IAttributeGroup |
|
|
349
|
+
const group: IGroup | undefined = this.groups.get(type.group)
|
|
350
|
+
const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)
|
|
349
351
|
let name: string = ComponentsParser.getName(group, attributeGroup, type)
|
|
350
|
-
const cached: ComponentFieldDefinition |
|
|
352
|
+
const cached: ComponentFieldDefinition | undefined = definitions.component.get(name)
|
|
351
353
|
if (cached) {
|
|
352
354
|
return cached
|
|
353
355
|
}
|
|
354
356
|
|
|
355
357
|
const category = type.appInfo != null ? type.appInfo.Category : null
|
|
356
358
|
if (type.extensionBase) {
|
|
357
|
-
const base: IComplexType |
|
|
359
|
+
const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)
|
|
358
360
|
if (base) {
|
|
359
361
|
name = base.appInfo.name
|
|
360
362
|
}
|
|
361
363
|
}
|
|
362
364
|
const component: ComponentFieldDefinition = new ComponentFieldDefinition(name, name, category, null)
|
|
363
365
|
this.populateSet(type, component)
|
|
364
|
-
definitions.component.
|
|
365
|
-
definitions.component.
|
|
366
|
+
definitions.component.set(component.name, component)
|
|
367
|
+
definitions.component.set(type.name, component)
|
|
366
368
|
return component
|
|
367
369
|
}
|
|
368
370
|
|
|
@@ -375,24 +377,25 @@ export class ComponentsParser extends XsdParser {
|
|
|
375
377
|
type.appInfo.MsgID,
|
|
376
378
|
type.appInfo.Category,
|
|
377
379
|
type.annotation.documentation)
|
|
378
|
-
const
|
|
380
|
+
const builder = new ContainedSetBuilder(message)
|
|
381
|
+
const abstractMessage: ComponentFieldDefinition | undefined = definitions.component.get('Message')
|
|
379
382
|
abstractMessage?.fields.forEach((f: ContainedField) => {
|
|
380
|
-
|
|
383
|
+
builder.add(f)
|
|
381
384
|
})
|
|
382
385
|
this.populateSet(type, message)
|
|
383
|
-
messages.
|
|
386
|
+
messages.set(message.name, message)
|
|
384
387
|
if (type.messageName && type.messageName !== name) {
|
|
385
|
-
messages.
|
|
388
|
+
messages.set(type.messageName, message)
|
|
386
389
|
}
|
|
387
390
|
|
|
388
391
|
return message
|
|
389
392
|
}
|
|
390
393
|
|
|
391
394
|
private getBaseAttributes (type: IComplexType): (IAttributeGroup | null) {
|
|
392
|
-
const attributeGroups:
|
|
395
|
+
const attributeGroups: Map<string, IAttributeGroup> = this.attributeGroups
|
|
393
396
|
let baseGroup
|
|
394
397
|
if (type.extensionBase) {
|
|
395
|
-
const base: IComplexType |
|
|
398
|
+
const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)
|
|
396
399
|
if (base) {
|
|
397
400
|
baseGroup = attributeGroups.get(base.attributeGroup)
|
|
398
401
|
}
|
|
@@ -401,11 +404,11 @@ export class ComponentsParser extends XsdParser {
|
|
|
401
404
|
return null
|
|
402
405
|
}
|
|
403
406
|
|
|
404
|
-
private populateSet (type: IComplexType, set:
|
|
405
|
-
const group: IGroup |
|
|
407
|
+
private populateSet (type: IComplexType, set: IContainedSet): void {
|
|
408
|
+
const group: IGroup | undefined = this.groups.get(type.group)
|
|
406
409
|
const elements: IElement[] = group ? group.elements : type.element
|
|
407
410
|
const attributeGroups = this.attributeGroups
|
|
408
|
-
const attributeGroup: IAttributeGroup |
|
|
411
|
+
const attributeGroup: IAttributeGroup | undefined = attributeGroups.get(type.attributeGroup)
|
|
409
412
|
const baseGroup: IAttributeGroup | null = this.getBaseAttributes(type)
|
|
410
413
|
// if a base is specified add the attributes from there
|
|
411
414
|
if (baseGroup) {
|
|
@@ -455,9 +458,9 @@ export class ComponentsParser extends XsdParser {
|
|
|
455
458
|
})
|
|
456
459
|
this.unboundElements.forEach((e: IElement) => {
|
|
457
460
|
const definitions = this.definitions
|
|
458
|
-
const component: ComponentFieldDefinition |
|
|
461
|
+
const component: ComponentFieldDefinition | undefined = definitions.component.get(e.type)
|
|
459
462
|
if (component) {
|
|
460
|
-
definitions.component.
|
|
463
|
+
definitions.component.set(e.name, component)
|
|
461
464
|
}
|
|
462
465
|
})
|
|
463
466
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ILooseObject } from '../../../collections/collection'
|
|
2
|
-
import { Dictionary } from '../../../collections'
|
|
3
2
|
import { SimpleFieldDefinition, FixDefinitions } from '../../definition'
|
|
4
3
|
import { XsdParser } from './xsd-parser'
|
|
5
4
|
import { ISaxNode } from '../../sax-node'
|
|
@@ -16,7 +15,7 @@ interface ISimpleField extends ILooseObject {
|
|
|
16
15
|
AbbrName: string
|
|
17
16
|
Category: string
|
|
18
17
|
CategoryAbbrName: string
|
|
19
|
-
enums:
|
|
18
|
+
enums: Map<string, string>
|
|
20
19
|
currentEnum: string
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -35,7 +34,7 @@ export class FieldsParser extends XsdParser {
|
|
|
35
34
|
const current: ISimpleField = this.current as ISimpleField
|
|
36
35
|
switch (n) {
|
|
37
36
|
case 'fm:EnumDoc': {
|
|
38
|
-
current.enums.
|
|
37
|
+
current.enums.set(current.currentEnum, v)
|
|
39
38
|
break
|
|
40
39
|
}
|
|
41
40
|
case 'xs:documentation': {
|
|
@@ -81,7 +80,7 @@ export class FieldsParser extends XsdParser {
|
|
|
81
80
|
|
|
82
81
|
case 'fm:EnumDoc': {
|
|
83
82
|
if (!this.current.enums) {
|
|
84
|
-
this.current.enums = new
|
|
83
|
+
this.current.enums = new Map<string, string>()
|
|
85
84
|
}
|
|
86
85
|
this.current.currentEnum = node.attributes.value
|
|
87
86
|
this.pending = node.name
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SAXStream } from '../../dict-primitive'
|
|
2
|
-
import { Dictionary } from '../../../collections'
|
|
3
2
|
import { INumericKeyed } from '../../../collections/collection'
|
|
4
3
|
import * as path from 'path'
|
|
5
4
|
import * as fs from 'fs'
|
|
@@ -21,7 +20,7 @@ export interface IGraphNode {
|
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
export class IncludeGraph {
|
|
24
|
-
private nodes:
|
|
23
|
+
private nodes: Map<string, number>
|
|
25
24
|
private includes: IInclude[]
|
|
26
25
|
private graph: INumericKeyed<IGraphNode>
|
|
27
26
|
constructor (public readonly root: string, public readonly main: string) {
|
|
@@ -34,7 +33,7 @@ export class IncludeGraph {
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
public resolve (file: string): string[] | null {
|
|
37
|
-
const label: number |
|
|
36
|
+
const label: number | undefined = this.nodes.get(file)
|
|
38
37
|
if (label == null) {
|
|
39
38
|
return null
|
|
40
39
|
}
|
|
@@ -60,7 +59,7 @@ export class IncludeGraph {
|
|
|
60
59
|
private getGraph (): void {
|
|
61
60
|
const nodes = this.nodes
|
|
62
61
|
this.graph = this.includes.reduce<INumericKeyed<IGraphNode>>((a: INumericKeyed<IGraphNode>, current: IInclude) => {
|
|
63
|
-
const parent: number |
|
|
62
|
+
const parent: number | undefined = nodes.get(current.parent)
|
|
64
63
|
if (parent == null) return a
|
|
65
64
|
let parentNode = a[parent]
|
|
66
65
|
if (!parentNode) {
|
|
@@ -71,7 +70,7 @@ export class IncludeGraph {
|
|
|
71
70
|
} as IGraphNode
|
|
72
71
|
}
|
|
73
72
|
current.children.forEach((s: string) => {
|
|
74
|
-
const child: number |
|
|
73
|
+
const child: number | undefined = nodes.get(s)
|
|
75
74
|
if (child) {
|
|
76
75
|
if (!parentNode.edges.includes(child)) {
|
|
77
76
|
parentNode.edges.push(child)
|
|
@@ -84,17 +83,17 @@ export class IncludeGraph {
|
|
|
84
83
|
|
|
85
84
|
private assignNodes (): void {
|
|
86
85
|
let next: number = 0
|
|
87
|
-
this.nodes = this.includes.reduce((a:
|
|
88
|
-
if (!a.
|
|
89
|
-
a.
|
|
86
|
+
this.nodes = this.includes.reduce((a: Map<string, number>, current: IInclude) => {
|
|
87
|
+
if (!a.has(current.parent)) {
|
|
88
|
+
a.set(current.parent, next++)
|
|
90
89
|
}
|
|
91
90
|
current.children.forEach((c: string) => {
|
|
92
|
-
if (!a.
|
|
93
|
-
a.
|
|
91
|
+
if (!a.has(c)) {
|
|
92
|
+
a.set(c, next++)
|
|
94
93
|
}
|
|
95
94
|
})
|
|
96
95
|
return a
|
|
97
|
-
}, new
|
|
96
|
+
}, new Map<string, number>())
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
private async scanIncludes (file: string): Promise<string[]> {
|
|
@@ -125,16 +124,16 @@ export class IncludeGraph {
|
|
|
125
124
|
const q: any[] = []
|
|
126
125
|
q.push([main])
|
|
127
126
|
const ordered: IInclude[] = []
|
|
128
|
-
const seen:
|
|
127
|
+
const seen: Map<string, boolean> = new Map<string, boolean>()
|
|
129
128
|
return await new Promise<IInclude[]>(async (resolve, reject) => {
|
|
130
129
|
try {
|
|
131
130
|
while (q.length > 0) {
|
|
132
131
|
const batch: string[] = q.pop()
|
|
133
132
|
for (const next of batch) {
|
|
134
|
-
if (seen.
|
|
133
|
+
if (seen.has(next)) {
|
|
135
134
|
continue
|
|
136
135
|
}
|
|
137
|
-
seen.
|
|
136
|
+
seen.set(next, true)
|
|
138
137
|
const includes: string[] = await this.scanIncludes(next)
|
|
139
138
|
ordered.push({
|
|
140
139
|
parent: next,
|
|
@@ -13,12 +13,12 @@ export class FieldDefinitionParser extends NodeParser {
|
|
|
13
13
|
switch (node.name) {
|
|
14
14
|
case 'field': {
|
|
15
15
|
this.currentField = new SimpleFieldDefinition(
|
|
16
|
-
node.attributes.number,
|
|
17
|
-
node.attributes.name,
|
|
18
|
-
node.attributes.name,
|
|
16
|
+
node.attributes.number as string,
|
|
17
|
+
node.attributes.name as string,
|
|
18
|
+
node.attributes.name as string,
|
|
19
19
|
null,
|
|
20
20
|
null,
|
|
21
|
-
node.attributes.type,
|
|
21
|
+
node.attributes.type as string,
|
|
22
22
|
null)
|
|
23
23
|
this.progress.newDefines++
|
|
24
24
|
this.progress.definitions.addSimpleFieldDef(this.currentField)
|
|
@@ -26,7 +26,7 @@ export class FieldDefinitionParser extends NodeParser {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
case 'value': {
|
|
29
|
-
this.currentField.addEnum(node.attributes.enum, node.attributes.description)
|
|
29
|
+
this.currentField.addEnum(node.attributes.enum as string, node.attributes.description as string)
|
|
30
30
|
break
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { MessageDefinition } from '../../definition'
|
|
2
2
|
import { NodeParser } from './node-parser'
|
|
3
3
|
import { ParseContext } from './parse-context'
|
|
4
|
-
import { ContainedComponentField } from '../../contained'
|
|
4
|
+
import { ContainedComponentField, ContainedSetBuilder } from '../../contained'
|
|
5
5
|
import { ISaxNode } from '../../sax-node'
|
|
6
6
|
import { ParseProgress } from './parse-progress'
|
|
7
|
+
import { ILooseObject } from '../../../collections/collection'
|
|
7
8
|
|
|
8
9
|
export class MessageParser extends NodeParser {
|
|
9
10
|
constructor (protected readonly progress: ParseProgress) {
|
|
@@ -13,8 +14,8 @@ export class MessageParser extends NodeParser {
|
|
|
13
14
|
public open (line: number, node: ISaxNode): void {
|
|
14
15
|
switch (node.name) {
|
|
15
16
|
case 'message': {
|
|
16
|
-
const att:
|
|
17
|
-
const msg: MessageDefinition = new MessageDefinition(att.name, att.name, att.msgtype, att.msgcat, null)
|
|
17
|
+
const att: ILooseObject = node.attributes
|
|
18
|
+
const msg: MessageDefinition = new MessageDefinition(att.name as string, att.name as string, att.msgtype as string, att.msgcat as string, null)
|
|
18
19
|
const context: ParseContext = new ParseContext(msg.name, true, msg)
|
|
19
20
|
this.header(msg, context)
|
|
20
21
|
break
|
|
@@ -27,7 +28,7 @@ export class MessageParser extends NodeParser {
|
|
|
27
28
|
|
|
28
29
|
case 'component': {
|
|
29
30
|
if (node.isSelfClosing) {
|
|
30
|
-
this.addComponentField(node.attributes.name, node)
|
|
31
|
+
this.addComponentField(node.attributes.name as string, node)
|
|
31
32
|
}
|
|
32
33
|
break
|
|
33
34
|
}
|
|
@@ -43,12 +44,13 @@ export class MessageParser extends NodeParser {
|
|
|
43
44
|
|
|
44
45
|
private header (msg: MessageDefinition, context: ParseContext): void {
|
|
45
46
|
const hdr = this.progress.definitions.component.get('StandardHeader')
|
|
47
|
+
const builder = new ContainedSetBuilder(msg)
|
|
46
48
|
const contained = hdr
|
|
47
49
|
? new ContainedComponentField(hdr, msg.fields.length, true)
|
|
48
50
|
: null
|
|
49
51
|
if (contained) {
|
|
50
52
|
this.progress.newAdds++
|
|
51
|
-
|
|
53
|
+
builder.add(contained)
|
|
52
54
|
this.startContext(context)
|
|
53
55
|
}
|
|
54
56
|
}
|