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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msg-compiler.js","sourceRoot":"","sources":["../../../src/dictionary/compiler/msg-compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAkD;AAClD,+CAAgD;AAGhD,4CAMqB;AACrB,yDAAoD;AACpD,mDAA8C;AAC9C,mDAA8C;AAE9C,yBAAwB;AACxB,6BAA4B;AAC5B,6BAA4B;AAC5B,8CAAyC;AACzC,8DAAwD;AACxD,wDAAmD;AAEnD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;AACjC,MAAM,cAAc,GAAW,EAAE,CAAA;AAEjC,MAAa,WAAW;IAMtB,YAA6B,WAA2B,EAAkB,QAA2B;QAAxE,gBAAW,GAAX,WAAW,CAAgB;QAAkB,aAAQ,GAAR,QAAQ,CAAmB;QAL5F,UAAK,GAAmB,EAAE,CAAA;QAE1B,WAAM,GAAkB,IAAI,sBAAa,EAAE,CAAA;QAIlD,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAU,EAAgB,CAAA;QAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,kCAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpD,CAAC;IAEY,QAAQ;;;YACnB,MAAM,KAAK,GAAa,MAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,mCAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YAC9E,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;;KAC9B;IAEO,WAAW,CAAE,YAA0B;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,QAA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AAK,qCAAgB,CAAC,GAAG,CAAA;QAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAa,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE;YACzD,SAAS,EAAE,CAAC,CAAW,EAAE,CAA0B,EAAE,EAAE;gBACrD,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;gBACnE,OAAO,CAAC,CAAA;YACV,CAAC;YACD,KAAK,EAAE,CAAC,CAAW,EAAE,CAAsB,EAAE,EAAE;gBAC7C,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;gBACnE,OAAO,CAAC,CAAA;YACV,CAAC;SACF,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAhND,kCAgNC","sourcesContent":["import { ElasticBuffer, Tags } from '../../buffer'\r\nimport { AsciiChars } from '../../buffer/ascii/'\r\nimport { ICompilerSettings } from './compiler-settings'\r\nimport { FixDefinitions } from '../definition'\r\nimport {\r\n ContainedComponentField,\r\n ContainedFieldSet,\r\n ContainedGroupField,\r\n ContainedSimpleField,\r\n FieldsDispatch\r\n} from '../contained'\r\nimport { StandardSnippet } from './standard-snippet'\r\nimport { CompilerType } from './compiler-type'\r\nimport { Dictionary } from '../../collections'\r\n\r\nimport * as fs from 'fs'\r\nimport * as Util from 'util'\r\nimport * as Path from 'path'\r\nimport { SetReduce } from '../set-reduce'\r\nimport { ContainedSetType } from '../contained-set-type'\r\nimport { TagType } from '../../buffer/tag/tag-type'\r\n\r\nconst newLine = require('os').EOL\r\nconst justifiedWidth: number = 50\r\n\r\nexport class MsgCompiler {\r\n readonly queue: CompilerType[] = []\r\n readonly snippets: StandardSnippet\r\n readonly buffer: ElasticBuffer = new ElasticBuffer()\r\n readonly completed: Dictionary<CompilerType>\r\n\r\n constructor (public readonly definitions: FixDefinitions, public readonly settings: ICompilerSettings) {\r\n this.completed = new Dictionary<CompilerType>()\r\n this.snippets = new StandardSnippet(this.settings)\r\n }\r\n\r\n public async generate (): Promise<void> {\r\n const types: string[] = this.settings.types ?? this.definitions.message.keys()\r\n await this.createTypes(types)\r\n }\r\n\r\n private getFileName (compilerType: CompilerType): string {\r\n const settings = this.settings\r\n const fileName = `${compilerType.snaked}.ts`\r\n return Path.join(settings.output, fileName)\r\n }\r\n\r\n private async createTypes (types: string[]): Promise<void> {\r\n const definitions = this.definitions\r\n types.forEach((type: string) => {\r\n const definition = definitions.containedSet(type)\r\n if (!definition) {\r\n throw new Error(`no type ${type} defined`)\r\n }\r\n const ct = new CompilerType(this.definitions, definition, definition.name)\r\n this.enqueue(ct)\r\n })\r\n await this.work()\r\n await this.index()\r\n }\r\n\r\n private async work (): Promise<void> {\r\n const q = this.queue\r\n const writeFile = Util.promisify(fs.writeFile)\r\n while (q.length > 0) {\r\n const compilerType = q.pop()\r\n if (!compilerType) continue\r\n const api: string = this.generateMessages(compilerType)\r\n const fullName = this.getFileName(compilerType)\r\n await writeFile(fullName, api, { encoding: 'utf8' }\r\n )\r\n }\r\n }\r\n\r\n private async index (): Promise<void> {\r\n const writeFile = Util.promisify(fs.writeFile)\r\n const settings = this.settings\r\n const fileName = 'index.ts'\r\n const done = this.completed.values()\r\n const exports: string[] = done.reduce<string[]>((prev: string[], current: CompilerType) => {\r\n prev.push(`export * from '${current.snaked}'`)\r\n return prev\r\n }, ['export * from \\'./enum\\''])\r\n exports.sort()\r\n exports.push('')\r\n const api: string = exports.join(newLine)\r\n const fullName: string = Path.join(settings.output, fileName)\r\n await writeFile(fullName, api, { encoding: 'utf8' })\r\n }\r\n\r\n private generateMessages (compilerType: CompilerType): string {\r\n const definition = compilerType.set\r\n const buffer: ElasticBuffer = this.buffer\r\n buffer.reset()\r\n const snippets = this.snippets\r\n // a single class with dependencies included\r\n const ptr: number = this.imports(compilerType)\r\n if (ptr > 0) {\r\n buffer.writeString(newLine)\r\n buffer.writeString(newLine)\r\n }\r\n if (this.settings.comment && definition.description) {\r\n const comment = snippets.commentBox(definition.description)\r\n buffer.writeString(snippets.startBlockComment(0))\r\n buffer.writeString(newLine)\r\n buffer.writeString(comment)\r\n buffer.writeString(newLine)\r\n buffer.writeString(snippets.endBlockComment(0))\r\n buffer.writeString(newLine)\r\n }\r\n buffer.writeString(snippets.interface(compilerType.qualifiedName, 0))\r\n buffer.writeChar(AsciiChars.Space)\r\n buffer.writeString(snippets.startBlock(0))\r\n buffer.writeString(newLine)\r\n this.fields(compilerType)\r\n buffer.writeString(snippets.endBlock(0))\r\n buffer.writeString(newLine)\r\n return buffer.toString()\r\n }\r\n\r\n // only generate once\r\n private enqueue (ct: CompilerType): void {\r\n const completed = this.completed\r\n const fullName = this.getFileName(ct)\r\n if (completed.get(fullName)) {\r\n return\r\n }\r\n this.queue.push(ct)\r\n completed.addUpdate(fullName, ct)\r\n }\r\n\r\n private simpleComment (simple: ContainedSimpleField): string {\r\n return `[${simple.position + 1}] ${simple.definition.tag} (${TagType[simple.definition.tagType]})`\r\n }\r\n\r\n private fieldSimple (simple: ContainedSimpleField): void {\r\n const snippets = this.snippets\r\n const settings = this.settings\r\n const buffer = this.buffer\r\n const len = buffer.writeString(snippets.simple(simple.name, Tags.toJSType(simple), simple.required, 1))\r\n if (settings.tags) {\r\n buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))\r\n }\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private fieldGroup (groupField: ContainedGroupField, compilerType: CompilerType): void {\r\n const buffer = this.buffer\r\n const snippets = this.snippets\r\n // for a group its field name is as defined in type, its type is qualified to avoid collisions\r\n const extended: string = compilerType.getExtended(groupField)\r\n const len = buffer.writeString(snippets.group(compilerType.getFieldGroupName(groupField), extended, groupField.required, 1))\r\n this.setComment(groupField.definition, groupField.position, len)\r\n this.enqueue(new CompilerType(this.definitions, groupField.definition, extended))\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private tagSummary (definition: ContainedFieldSet, max: number = 3): string {\r\n function tagTxt (tag: number): string {\r\n const name = definition.getFieldName(tag)\r\n return `${name}.${tag}`\r\n }\r\n\r\n function setTxt (flattened: number[]): string {\r\n return flattened.map(f => tagTxt(f)).join(', ')\r\n }\r\n\r\n const flattened = definition.flattenedTag\r\n if (max >= flattened.length) {\r\n return setTxt(flattened)\r\n }\r\n\r\n const front = setTxt(flattened.slice(0, max - 1))\r\n return `${front} .. ${tagTxt(flattened[flattened.length - 1])}`\r\n }\r\n\r\n private setComment (set: ContainedFieldSet, position: number, len: number): void {\r\n if (this.settings.tags) {\r\n const tagTxt = this.tagSummary(set)\r\n const buffer = this.buffer\r\n buffer.writeString(this.snippets.commentLine(`[${position + 1}] ${tagTxt}`, justifiedWidth - len))\r\n }\r\n }\r\n\r\n private fieldComponent (componentField: ContainedComponentField, compilerType: CompilerType): void {\r\n const buffer = this.buffer\r\n const snippets = this.snippets\r\n const extended: string = compilerType.getExtended(componentField)\r\n const len = buffer.writeString(snippets.component(extended, componentField.required, 1))\r\n this.enqueue(new CompilerType(this.definitions, componentField.definition, extended))\r\n this.setComment(componentField.definition, componentField.position, len)\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private fields (compilerType: CompilerType): void {\r\n this.attributes(compilerType)\r\n new FieldsDispatch().dispatchFields(compilerType.set.fields, {\r\n group: (g: ContainedGroupField) => { this.fieldGroup(g, compilerType) },\r\n simple: (simple: ContainedSimpleField) => { this.fieldSimple(simple) },\r\n component: (c: ContainedComponentField) => { this.fieldComponent(c, compilerType) }\r\n })\r\n }\r\n\r\n private attributes (compilerType: CompilerType): void {\r\n const settings = this.settings\r\n const snippets = this.snippets\r\n const buffer = this.buffer\r\n compilerType.set.localAttribute.forEach((simple: ContainedSimpleField) => {\r\n const len = buffer.writeString(snippets.simple(simple.definition.name, Tags.toJSType(simple), simple.required, 1))\r\n if (settings.tags) {\r\n buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))\r\n }\r\n buffer.writeString(newLine)\r\n })\r\n }\r\n\r\n private imports (compilerType: CompilerType): number {\r\n const reducer = new SetReduce<string[]>()\r\n const isMsg = compilerType.set.type === ContainedSetType.Msg\r\n const snippets = this.snippets\r\n const imports: string[] = reducer.reduce(compilerType.set, {\r\n component: (a: string[], c: ContainedComponentField) => {\r\n a.push(`${snippets.import(compilerType.getExtended(c), isMsg, 0)}`)\r\n return a\r\n },\r\n group: (a: string[], g: ContainedGroupField) => {\r\n a.push(`${snippets.import(compilerType.getExtended(g), isMsg, 0)}`)\r\n return a\r\n }\r\n }, [])\r\n\r\n return this.buffer.writeString(imports.join(newLine))\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"msg-compiler.js","sourceRoot":"","sources":["../../../src/dictionary/compiler/msg-compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAkD;AAClD,+CAAgD;AAGhD,4CAMqB;AACrB,yDAAoD;AACpD,mDAA8C;AAE9C,yBAAwB;AACxB,6BAA4B;AAC5B,6BAA4B;AAC5B,8CAAyC;AACzC,8DAAwD;AACxD,wDAAmD;AAEnD,MAAM,OAAO,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;AACzC,MAAM,cAAc,GAAW,EAAE,CAAA;AAEjC,MAAa,WAAW;IAMtB,YAA6B,WAA2B,EAAkB,QAA2B;QAAxE,gBAAW,GAAX,WAAW,CAAgB;QAAkB,aAAQ,GAAR,QAAQ,CAAmB;QAL5F,UAAK,GAAmB,EAAE,CAAA;QAE1B,WAAM,GAAkB,IAAI,sBAAa,EAAE,CAAA;QAIlD,IAAI,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AAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAhND,kCAgNC","sourcesContent":["import { ElasticBuffer, Tags } from '../../buffer'\r\nimport { AsciiChars } from '../../buffer/ascii/'\r\nimport { ICompilerSettings } from './compiler-settings'\r\nimport { FixDefinitions } from '../definition'\r\nimport {\r\n ContainedComponentField,\r\n IContainedSet,\r\n ContainedGroupField,\r\n ContainedSimpleField,\r\n FieldsDispatch\r\n} from '../contained'\r\nimport { StandardSnippet } from './standard-snippet'\r\nimport { CompilerType } from './compiler-type'\r\n\r\nimport * as fs from 'fs'\r\nimport * as Util from 'util'\r\nimport * as Path from 'path'\r\nimport { SetReduce } from '../set-reduce'\r\nimport { ContainedSetType } from '../contained-set-type'\r\nimport { TagType } from '../../buffer/tag/tag-type'\r\n\r\nconst newLine: string = require('os').EOL\r\nconst justifiedWidth: number = 50\r\n\r\nexport class MsgCompiler {\r\n readonly queue: CompilerType[] = []\r\n readonly snippets: StandardSnippet\r\n readonly buffer: ElasticBuffer = new ElasticBuffer()\r\n readonly completed: Map<string, CompilerType>\r\n\r\n constructor (public readonly definitions: FixDefinitions, public readonly settings: ICompilerSettings) {\r\n this.completed = new Map<string, CompilerType>()\r\n this.snippets = new StandardSnippet(this.settings)\r\n }\r\n\r\n public async generate (): Promise<void> {\r\n const types: string[] = this.settings.types ?? Array.from(this.definitions.message.keys())\r\n await this.createTypes(types)\r\n }\r\n\r\n private getFileName (compilerType: CompilerType): string {\r\n const settings = this.settings\r\n const fileName = `${compilerType.snaked}.ts`\r\n return Path.join(settings.output, fileName)\r\n }\r\n\r\n private async createTypes (types: string[]): Promise<void> {\r\n const definitions = this.definitions\r\n types.forEach((type: string) => {\r\n const definition = definitions.containedSet(type)\r\n if (!definition) {\r\n throw new Error(`no type ${type} defined`)\r\n }\r\n const ct = new CompilerType(this.definitions, definition, definition.name)\r\n this.enqueue(ct)\r\n })\r\n await this.work()\r\n await this.index()\r\n }\r\n\r\n private async work (): Promise<void> {\r\n const q = this.queue\r\n const writeFile = Util.promisify(fs.writeFile)\r\n while (q.length > 0) {\r\n const compilerType = q.pop()\r\n if (!compilerType) continue\r\n const api: string = this.generateMessages(compilerType)\r\n const fullName = this.getFileName(compilerType)\r\n await writeFile(fullName, api, { encoding: 'utf8' }\r\n )\r\n }\r\n }\r\n\r\n private async index (): Promise<void> {\r\n const writeFile = Util.promisify(fs.writeFile)\r\n const settings = this.settings\r\n const fileName = 'index.ts'\r\n const done = Array.from(this.completed.values())\r\n const exports: string[] = done.reduce<string[]>((prev: string[], current: CompilerType) => {\r\n prev.push(`export * from '${current.snaked}'`)\r\n return prev\r\n }, ['export * from \\'./enum\\''])\r\n exports.sort()\r\n exports.push('')\r\n const api: string = exports.join(newLine)\r\n const fullName: string = Path.join(settings.output, fileName)\r\n await writeFile(fullName, api, { encoding: 'utf8' })\r\n }\r\n\r\n private generateMessages (compilerType: CompilerType): string {\r\n const definition = compilerType.set\r\n const buffer: ElasticBuffer = this.buffer\r\n buffer.reset()\r\n const snippets = this.snippets\r\n // a single class with dependencies included\r\n const ptr: number = this.imports(compilerType)\r\n if (ptr > 0) {\r\n buffer.writeString(newLine)\r\n buffer.writeString(newLine)\r\n }\r\n if (this.settings.comment && definition.description) {\r\n const comment = snippets.commentBox(definition.description)\r\n buffer.writeString(snippets.startBlockComment(0))\r\n buffer.writeString(newLine)\r\n buffer.writeString(comment)\r\n buffer.writeString(newLine)\r\n buffer.writeString(snippets.endBlockComment(0))\r\n buffer.writeString(newLine)\r\n }\r\n buffer.writeString(snippets.interface(compilerType.qualifiedName, 0))\r\n buffer.writeChar(AsciiChars.Space)\r\n buffer.writeString(snippets.startBlock(0))\r\n buffer.writeString(newLine)\r\n this.fields(compilerType)\r\n buffer.writeString(snippets.endBlock(0))\r\n buffer.writeString(newLine)\r\n return buffer.toString()\r\n }\r\n\r\n // only generate once\r\n private enqueue (ct: CompilerType): void {\r\n const completed = this.completed\r\n const fullName = this.getFileName(ct)\r\n if (completed.get(fullName)) {\r\n return\r\n }\r\n this.queue.push(ct)\r\n completed.set(fullName, ct)\r\n }\r\n\r\n private simpleComment (simple: ContainedSimpleField): string {\r\n return `[${simple.position + 1}] ${simple.definition.tag} (${TagType[simple.definition.tagType]})`\r\n }\r\n\r\n private fieldSimple (simple: ContainedSimpleField): void {\r\n const snippets = this.snippets\r\n const settings = this.settings\r\n const buffer = this.buffer\r\n const len = buffer.writeString(snippets.simple(simple.name, Tags.toJSType(simple.definition.tagType), simple.required, 1))\r\n if (settings.tags) {\r\n buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))\r\n }\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private fieldGroup (groupField: ContainedGroupField, compilerType: CompilerType): void {\r\n const buffer = this.buffer\r\n const snippets = this.snippets\r\n // for a group its field name is as defined in type, its type is qualified to avoid collisions\r\n const extended: string = compilerType.getExtended(groupField)\r\n const len = buffer.writeString(snippets.group(compilerType.getFieldGroupName(groupField), extended, groupField.required, 1))\r\n this.setComment(groupField.definition, groupField.position, len)\r\n this.enqueue(new CompilerType(this.definitions, groupField.definition, extended))\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private tagSummary (definition: IContainedSet, max: number = 3): string {\r\n function tagTxt (tag: number): string {\r\n const name = definition.getFieldName(tag)\r\n return `${name}.${tag}`\r\n }\r\n\r\n function setTxt (flattened: number[]): string {\r\n return flattened.map(f => tagTxt(f)).join(', ')\r\n }\r\n\r\n const flattened = definition.flattenedTag\r\n if (max >= flattened.length) {\r\n return setTxt(flattened)\r\n }\r\n\r\n const front = setTxt(flattened.slice(0, max - 1))\r\n return `${front} .. ${tagTxt(flattened[flattened.length - 1])}`\r\n }\r\n\r\n private setComment (set: IContainedSet, position: number, len: number): void {\r\n if (this.settings.tags) {\r\n const tagTxt = this.tagSummary(set)\r\n const buffer = this.buffer\r\n buffer.writeString(this.snippets.commentLine(`[${position + 1}] ${tagTxt}`, justifiedWidth - len))\r\n }\r\n }\r\n\r\n private fieldComponent (componentField: ContainedComponentField, compilerType: CompilerType): void {\r\n const buffer = this.buffer\r\n const snippets = this.snippets\r\n const extended: string = compilerType.getExtended(componentField)\r\n const len = buffer.writeString(snippets.component(extended, componentField.required, 1))\r\n this.enqueue(new CompilerType(this.definitions, componentField.definition, extended))\r\n this.setComment(componentField.definition, componentField.position, len)\r\n buffer.writeString(newLine)\r\n }\r\n\r\n private fields (compilerType: CompilerType): void {\r\n this.attributes(compilerType)\r\n new FieldsDispatch().dispatchFields(compilerType.set.fields, {\r\n group: (g: ContainedGroupField) => { this.fieldGroup(g, compilerType) },\r\n simple: (simple: ContainedSimpleField) => { this.fieldSimple(simple) },\r\n component: (c: ContainedComponentField) => { this.fieldComponent(c, compilerType) }\r\n })\r\n }\r\n\r\n private attributes (compilerType: CompilerType): void {\r\n const settings = this.settings\r\n const snippets = this.snippets\r\n const buffer = this.buffer\r\n compilerType.set.localAttribute.forEach((simple: ContainedSimpleField) => {\r\n const len = buffer.writeString(snippets.simple(simple.definition.name, Tags.toJSType(simple.definition.tagType), simple.required, 1))\r\n if (settings.tags) {\r\n buffer.writeString(snippets.commentLine(this.simpleComment(simple), justifiedWidth - len))\r\n }\r\n buffer.writeString(newLine)\r\n })\r\n }\r\n\r\n private imports (compilerType: CompilerType): number {\r\n const reducer = new SetReduce<string[]>()\r\n const isMsg = compilerType.set.type === ContainedSetType.Msg\r\n const snippets = this.snippets\r\n const imports: string[] = reducer.reduce(compilerType.set, {\r\n component: (a: string[], c: ContainedComponentField) => {\r\n a.push(`${snippets.import(compilerType.getExtended(c), isMsg, 0)}`)\r\n return a\r\n },\r\n group: (a: string[], g: ContainedGroupField) => {\r\n a.push(`${snippets.import(compilerType.getExtended(g), isMsg, 0)}`)\r\n return a\r\n }\r\n }, [])\r\n\r\n return this.buffer.writeString(imports.join(newLine))\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentFieldDefinition } from '../definition';
|
|
1
|
+
import { ComponentFieldDefinition } from '../definition/component-field-definition';
|
|
2
2
|
import { ContainedField } from './contained-field';
|
|
3
3
|
export declare class ContainedComponentField extends ContainedField {
|
|
4
4
|
readonly definition: ComponentFieldDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contained-component-field.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-component-field.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAClD,iEAA2D;AAE3D,MAAa,uBAAwB,SAAQ,gCAAc;IACzD,YAA6B,UAAoC,EACxD,QAAgB,EACP,QAAiB,EACjB,QAAiB;QACjC,KAAK,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,yCAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAJzD,eAAU,GAAV,UAAU,CAA0B;QACxD,aAAQ,GAAR,QAAQ,CAAQ;QACP,aAAQ,GAAR,QAAQ,CAAS;QACjB,aAAQ,GAAR,QAAQ,CAAS;IAEnC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,CAAA;IAC/E,CAAC;CACF;AAXD,0DAWC","sourcesContent":["import { ComponentFieldDefinition } from '../definition'\r\nimport { ContainedField } from './contained-field'\r\nimport { ContainedFieldType } from './contained-field-type'\r\n\r\nexport class ContainedComponentField extends ContainedField {\r\n constructor (public readonly definition: ComponentFieldDefinition,\r\n public position: number,\r\n public readonly required: boolean,\r\n public readonly override?: string) {\r\n super(override ?? definition.name, position, ContainedFieldType.Component, required)\r\n }\r\n\r\n public toString (): string {\r\n return `[${this.position}]=C.${this.definition.fields.length} (${this.name})`\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"contained-component-field.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-component-field.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAClD,iEAA2D;AAE3D,MAAa,uBAAwB,SAAQ,gCAAc;IACzD,YAA6B,UAAoC,EACxD,QAAgB,EACP,QAAiB,EACjB,QAAiB;QACjC,KAAK,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,yCAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAJzD,eAAU,GAAV,UAAU,CAA0B;QACxD,aAAQ,GAAR,QAAQ,CAAQ;QACP,aAAQ,GAAR,QAAQ,CAAS;QACjB,aAAQ,GAAR,QAAQ,CAAS;IAEnC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,CAAA;IAC/E,CAAC;CACF;AAXD,0DAWC","sourcesContent":["import { ComponentFieldDefinition } from '../definition/component-field-definition'\r\nimport { ContainedField } from './contained-field'\r\nimport { ContainedFieldType } from './contained-field-type'\r\n\r\nexport class ContainedComponentField extends ContainedField {\r\n constructor (public readonly definition: ComponentFieldDefinition,\r\n public position: number,\r\n public readonly required: boolean,\r\n public readonly override?: string) {\r\n super(override ?? definition.name, position, ContainedFieldType.Component, required)\r\n }\r\n\r\n public toString (): string {\r\n return `[${this.position}]=C.${this.definition.fields.length} (${this.name})`\r\n }\r\n}\r\n"]}
|
|
@@ -1,19 +1,17 @@
|
|
|
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 { ContainedSetType } from '../contained-set-type';
|
|
8
|
-
|
|
5
|
+
import { IContainedSet } from './contained-set';
|
|
6
|
+
export declare abstract class ContainedFieldSet implements IContainedSet {
|
|
9
7
|
readonly type: ContainedSetType;
|
|
10
8
|
readonly name: string;
|
|
11
9
|
readonly category: string | null;
|
|
12
10
|
readonly abbreviation: string | null;
|
|
13
11
|
readonly description: string | null;
|
|
14
|
-
readonly groups:
|
|
15
|
-
readonly components:
|
|
16
|
-
readonly simple:
|
|
12
|
+
readonly groups: Map<string, IContainedSet>;
|
|
13
|
+
readonly components: Map<string, IContainedSet>;
|
|
14
|
+
readonly simple: Map<string, ContainedSimpleField>;
|
|
17
15
|
readonly fields: ContainedField[];
|
|
18
16
|
readonly containedTag: INumericKeyed<boolean>;
|
|
19
17
|
readonly flattenedTag: number[];
|
|
@@ -22,8 +20,8 @@ export declare abstract class ContainedFieldSet {
|
|
|
22
20
|
readonly localRequired: INumericKeyed<ContainedSimpleField>;
|
|
23
21
|
readonly tagToSimple: INumericKeyed<ContainedSimpleField>;
|
|
24
22
|
readonly tagToField: INumericKeyed<ContainedField>;
|
|
25
|
-
readonly localNameToField:
|
|
26
|
-
readonly nameToLocalAttribute:
|
|
23
|
+
readonly localNameToField: Map<string, ContainedField>;
|
|
24
|
+
readonly nameToLocalAttribute: Map<string, ContainedSimpleField>;
|
|
27
25
|
readonly localAttribute: ContainedSimpleField[];
|
|
28
26
|
firstSimple: (ContainedSimpleField | null);
|
|
29
27
|
containsRaw: boolean;
|
|
@@ -32,16 +30,7 @@ export declare abstract class ContainedFieldSet {
|
|
|
32
30
|
private empty;
|
|
33
31
|
toString(): string;
|
|
34
32
|
abstract getPrefix(): string;
|
|
35
|
-
getFieldName(tag: number): string;
|
|
36
|
-
add(field: ContainedField): void;
|
|
37
|
-
getSet(path: string): (ContainedFieldSet | null);
|
|
38
|
-
private addUpdate;
|
|
39
|
-
private addLocalSimple;
|
|
40
|
-
private addContained;
|
|
41
|
-
private addAllFields;
|
|
42
|
-
private addGroupFieldDef;
|
|
43
|
-
private addComponentFieldDef;
|
|
44
33
|
keys(): number[];
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
getFieldName(tag: number): string;
|
|
35
|
+
getSet(path: string): (IContainedSet | null);
|
|
47
36
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContainedFieldSet = void 0;
|
|
4
|
-
const collections_1 = require("../../collections");
|
|
5
4
|
const elastic_buffer_1 = require("../../buffer/elastic-buffer");
|
|
6
|
-
const contained_field_type_1 = require("./contained-field-type");
|
|
7
|
-
const tag_type_1 = require("../../buffer/tag/tag-type");
|
|
8
5
|
class ContainedFieldSet {
|
|
9
6
|
constructor(type, name, category, abbreviation, description) {
|
|
10
7
|
this.type = type;
|
|
@@ -12,9 +9,9 @@ class ContainedFieldSet {
|
|
|
12
9
|
this.category = category;
|
|
13
10
|
this.abbreviation = abbreviation;
|
|
14
11
|
this.description = description;
|
|
15
|
-
this.groups = new
|
|
16
|
-
this.components = new
|
|
17
|
-
this.simple = new
|
|
12
|
+
this.groups = new Map();
|
|
13
|
+
this.components = new Map();
|
|
14
|
+
this.simple = new Map();
|
|
18
15
|
this.fields = [];
|
|
19
16
|
this.containedTag = {};
|
|
20
17
|
this.flattenedTag = [];
|
|
@@ -23,8 +20,8 @@ class ContainedFieldSet {
|
|
|
23
20
|
this.localRequired = {};
|
|
24
21
|
this.tagToSimple = {};
|
|
25
22
|
this.tagToField = {};
|
|
26
|
-
this.localNameToField = new
|
|
27
|
-
this.nameToLocalAttribute = new
|
|
23
|
+
this.localNameToField = new Map();
|
|
24
|
+
this.nameToLocalAttribute = new Map();
|
|
28
25
|
this.localAttribute = [];
|
|
29
26
|
this.containsRaw = false;
|
|
30
27
|
}
|
|
@@ -51,163 +48,33 @@ class ContainedFieldSet {
|
|
|
51
48
|
buffer.writeString(s);
|
|
52
49
|
return buffer.toString();
|
|
53
50
|
}
|
|
51
|
+
keys() {
|
|
52
|
+
const keys = Object.keys(this.containedTag);
|
|
53
|
+
const nums = new Array(keys.length);
|
|
54
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
55
|
+
nums[j] = parseInt(keys[j], 10);
|
|
56
|
+
}
|
|
57
|
+
return nums;
|
|
58
|
+
}
|
|
54
59
|
getFieldName(tag) {
|
|
55
60
|
const s = this.tagToSimple[tag];
|
|
56
61
|
if (s == null) {
|
|
57
62
|
const gf = this.tagToField[tag];
|
|
58
63
|
if (gf !== null) {
|
|
59
|
-
return `${gf.
|
|
64
|
+
return `${gf.name}`;
|
|
60
65
|
}
|
|
61
66
|
return `${tag}`;
|
|
62
67
|
}
|
|
63
68
|
return s.name;
|
|
64
69
|
}
|
|
65
|
-
add(field) {
|
|
66
|
-
this.fields.push(field);
|
|
67
|
-
this.localNameToField.addUpdate(field.name, field);
|
|
68
|
-
this.addUpdate(field);
|
|
69
|
-
this.addContained(this, field);
|
|
70
|
-
}
|
|
71
70
|
getSet(path) {
|
|
72
71
|
if (!path)
|
|
73
72
|
return null;
|
|
74
73
|
return path.split('.').reduce((set, next) => {
|
|
75
|
-
var _a, _b
|
|
76
|
-
return (
|
|
74
|
+
var _a, _b;
|
|
75
|
+
return (_b = (_a = set.groups.get(next)) !== null && _a !== void 0 ? _a : set.components.get(next)) !== null && _b !== void 0 ? _b : null;
|
|
77
76
|
}, this);
|
|
78
77
|
}
|
|
79
|
-
addUpdate(field) {
|
|
80
|
-
switch (field.type) {
|
|
81
|
-
case contained_field_type_1.ContainedFieldType.Simple: {
|
|
82
|
-
this.addLocalSimple(field);
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case contained_field_type_1.ContainedFieldType.Component: {
|
|
86
|
-
const cf = field;
|
|
87
|
-
const definition = cf.definition;
|
|
88
|
-
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
89
|
-
this.localNameToField.addUpdate(definition.abbreviation, field);
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
case contained_field_type_1.ContainedFieldType.Group: {
|
|
94
|
-
const gf = field;
|
|
95
|
-
const definition = gf.definition;
|
|
96
|
-
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
97
|
-
this.localNameToField.addUpdate(definition.abbreviation, field);
|
|
98
|
-
}
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
default:
|
|
102
|
-
throw new Error(`unknown field type ${field.type}`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
addLocalSimple(field) {
|
|
106
|
-
const definition = field.definition;
|
|
107
|
-
if (definition.abbreviation && definition.abbreviation !== definition.name) {
|
|
108
|
-
this.localNameToField.addUpdate(definition.abbreviation, field);
|
|
109
|
-
}
|
|
110
|
-
if (definition.baseCategoryAbbreviation && definition.baseCategory === this.category) {
|
|
111
|
-
this.localNameToField.addUpdate(definition.baseCategoryAbbreviation, field);
|
|
112
|
-
}
|
|
113
|
-
if (field.attribute) {
|
|
114
|
-
this.nameToLocalAttribute.addUpdate(definition.abbreviation, field);
|
|
115
|
-
this.localAttribute.push(field);
|
|
116
|
-
this.fields.pop();
|
|
117
|
-
}
|
|
118
|
-
const tag = definition.tag;
|
|
119
|
-
this.localTag[tag] = field;
|
|
120
|
-
if (field.required) {
|
|
121
|
-
this.localRequired[tag] = field;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
addContained(parent, field) {
|
|
125
|
-
switch (field.type) {
|
|
126
|
-
case contained_field_type_1.ContainedFieldType.Group: {
|
|
127
|
-
this.addGroupFieldDef(field);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
case contained_field_type_1.ContainedFieldType.Component: {
|
|
131
|
-
this.addComponentFieldDef(field);
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
case contained_field_type_1.ContainedFieldType.Simple: {
|
|
135
|
-
this.addSimpleFieldDef(parent, field);
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
default:
|
|
139
|
-
throw new Error(`unknown field type ${field.type}`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
addAllFields(containedField) {
|
|
143
|
-
containedField.fields.forEach((f) => {
|
|
144
|
-
this.addContained(containedField, f);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
addGroupFieldDef(groupField) {
|
|
148
|
-
if (this.groups.containsKey(groupField.name)) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const definition = groupField.definition;
|
|
152
|
-
this.groups.add(groupField.name, groupField);
|
|
153
|
-
const nof = definition.noOfField;
|
|
154
|
-
if (nof) {
|
|
155
|
-
const tag = nof.tag;
|
|
156
|
-
this.containedTag[tag] = true;
|
|
157
|
-
this.flattenedTag.push(tag);
|
|
158
|
-
}
|
|
159
|
-
this.addAllFields(definition);
|
|
160
|
-
this.mapAllBelow(definition, groupField);
|
|
161
|
-
}
|
|
162
|
-
addComponentFieldDef(componentField) {
|
|
163
|
-
const components = this.components;
|
|
164
|
-
if (components.containsKey(componentField.name)) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const definition = componentField.definition;
|
|
168
|
-
components.add(componentField.name, componentField);
|
|
169
|
-
this.addAllFields(definition);
|
|
170
|
-
this.mapAllBelow(definition, componentField);
|
|
171
|
-
}
|
|
172
|
-
keys() {
|
|
173
|
-
const keys = Object.keys(this.containedTag);
|
|
174
|
-
const nums = new Array(keys.length);
|
|
175
|
-
for (let j = 0; j < keys.length; ++j) {
|
|
176
|
-
nums[j] = parseInt(keys[j], 10);
|
|
177
|
-
}
|
|
178
|
-
return nums;
|
|
179
|
-
}
|
|
180
|
-
mapAllBelow(set, field) {
|
|
181
|
-
const tagsBelow = set.keys();
|
|
182
|
-
for (const t of tagsBelow) {
|
|
183
|
-
this.tagToField[t] = field;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
addSimpleFieldDef(parent, field) {
|
|
187
|
-
if (this.simple.containsKey(field.name)) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (!this.firstSimple) {
|
|
191
|
-
this.firstSimple = field;
|
|
192
|
-
}
|
|
193
|
-
switch (field.definition.tagType) {
|
|
194
|
-
case tag_type_1.TagType.RawData: {
|
|
195
|
-
const dataLengthField = parent.fields[field.position - 1];
|
|
196
|
-
if (dataLengthField && dataLengthField.definition.tagType === tag_type_1.TagType.Length) {
|
|
197
|
-
this.containedLength[dataLengthField.definition.tag] = true;
|
|
198
|
-
this.containsRaw = true;
|
|
199
|
-
}
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
default:
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
const tag = field.definition.tag;
|
|
206
|
-
this.simple.add(field.name, field);
|
|
207
|
-
this.containedTag[tag] = true;
|
|
208
|
-
this.flattenedTag.push(tag);
|
|
209
|
-
this.tagToSimple[tag] = field;
|
|
210
|
-
}
|
|
211
78
|
}
|
|
212
79
|
exports.ContainedFieldSet = ContainedFieldSet;
|
|
213
80
|
//# sourceMappingURL=contained-field-set.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contained-field-set.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-field-set.ts"],"names":[],"mappings":";;;AACA,mDAA8C;AAK9C,gEAA2D;AAC3D,iEAA2D;AAC3D,wDAAmD;AAGnD,MAAsB,iBAAiB;IAkErC,YAAuC,IAAsB,EAC3C,IAAY,EACZ,QAAuB,EACvB,YAA2B,EAC3B,WAA0B;QAJL,SAAI,GAAJ,IAAI,CAAkB;QAC3C,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAe;QACvB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,gBAAW,GAAX,WAAW,CAAe;QAlE5B,WAAM,GAAoC,IAAI,wBAAU,EAAuB,CAAA;QAI/E,eAAU,GAAwC,IAAI,wBAAU,EAA2B,CAAA;QAI3F,WAAM,GAAqC,IAAI,wBAAU,EAAwB,CAAA;QAIjF,WAAM,GAAqB,EAA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CAAC;gBACrB,MAAM,eAAe,GAAyB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAyB,CAAA;gBACvG,IAAI,eAAe,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,KAAK,kBAAO,CAAC,MAAM,EAAE,CAAC;oBAC7E,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;oBAC3D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;gBACzB,CAAC;gBACD,MAAK;YACP,CAAC;YACD;gBACE,MAAK;QACT,CAAC;QACD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAA;QAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAClC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IAC/B,CAAC;CACF;AAhSD,8CAgSC","sourcesContent":["import { INumericKeyed } from '../../collections/collection'\r\nimport { Dictionary } from '../../collections'\r\nimport { ContainedComponentField } from './contained-component-field'\r\nimport { ContainedField } from './contained-field'\r\nimport { ContainedGroupField } from './contained-group-field'\r\nimport { ContainedSimpleField } from './contained-simple-field'\r\nimport { ElasticBuffer } from '../../buffer/elastic-buffer'\r\nimport { ContainedFieldType } from './contained-field-type'\r\nimport { TagType } from '../../buffer/tag/tag-type'\r\nimport { ContainedSetType } from '../contained-set-type'\r\n\r\nexport abstract class ContainedFieldSet {\r\n /**\r\n * index of name to any group that may be present within the field list\r\n */\r\n public readonly groups: Dictionary<ContainedGroupField> = new Dictionary<ContainedGroupField>()\r\n /**\r\n * index of name to any component that may be present within the field list\r\n */\r\n public readonly components: Dictionary<ContainedComponentField> = new Dictionary<ContainedComponentField>()\r\n /**\r\n * index of name to any simple field that may be present within the field list\r\n */\r\n public readonly simple: Dictionary<ContainedSimpleField> = new Dictionary<ContainedSimpleField>()\r\n /**\r\n * sequence of fields representing this type - can be simple, group or component\r\n */\r\n public readonly fields: ContainedField[] = []\r\n /**\r\n * any tag at any level i.e. does this set contain a tag\r\n */\r\n public readonly containedTag: INumericKeyed<boolean> = {}\r\n /**\r\n * any tag at any level ordered i.e. all tags flattened to list\r\n */\r\n public readonly flattenedTag: number[] = []\r\n /**\r\n * any data tags contained length within this set.\r\n */\r\n public readonly containedLength: INumericKeyed<boolean> = {}\r\n /**\r\n * tags only in repository at this level, not from any at deeper levels\r\n */\r\n public readonly localTag: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * tags marked required at this level only\r\n */\r\n public readonly localRequired: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * all tags contained within this field set flattened from all levels\r\n */\r\n public readonly tagToSimple: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * direct any tag contained within this set to field one level down where it belongs.\r\n */\r\n public readonly tagToField: INumericKeyed<ContainedField> = {}\r\n /**\r\n * only repository directly in this set indexed by name\r\n */\r\n public readonly localNameToField: Dictionary<ContainedField> = new Dictionary<ContainedField>()\r\n /**\r\n * for FixMl notation this set of fields appear as attributes i.e. <Pty ID=\"323\" R=\"38\">\r\n */\r\n public readonly nameToLocalAttribute: Dictionary<ContainedSimpleField> = new Dictionary<ContainedSimpleField>()\r\n /**\r\n * all attributes in order of being declared\r\n */\r\n public readonly localAttribute: ContainedSimpleField[] = []\r\n /**\r\n * at any level on this set, first declared simple field\r\n */\r\n public firstSimple: (ContainedSimpleField | null)\r\n /**\r\n * parser needs to know about raw fields, any present in this set?\r\n */\r\n public containsRaw: boolean = false\r\n\r\n protected constructor (public readonly type: ContainedSetType,\r\n public readonly name: string,\r\n public readonly category: string | null,\r\n public readonly abbreviation: string | null,\r\n public readonly description: string | null) {\r\n }\r\n\r\n /**\r\n * not for generral usage, this partially resets the set such it can be used on a second\r\n * pass of the xml parser\r\n */\r\n public reset (): void {\r\n this.groups.clear()\r\n this.components.clear()\r\n this.simple.clear()\r\n this.empty(this.fields)\r\n this.empty(this.flattenedTag)\r\n this.empty(this.localAttribute)\r\n this.localNameToField.clear()\r\n }\r\n\r\n private empty<T> (arr: T[]): void {\r\n while (arr.length > 0) {\r\n arr.pop()\r\n }\r\n }\r\n\r\n public toString (): string {\r\n const buffer = new ElasticBuffer(2 * 1024)\r\n const fields = this.fields\r\n buffer.writeString(`Set: ${this.name}(${this.getPrefix()}) fields [${fields.length}]: `)\r\n const set: string[] = fields.map((f: ContainedField) => f.toString())\r\n const s = set.join(', ')\r\n buffer.writeString(s)\r\n return buffer.toString()\r\n }\r\n\r\n public abstract getPrefix (): string\r\n\r\n public getFieldName (tag: number): string {\r\n const s = this.tagToSimple[tag]\r\n if (s == null) {\r\n const gf = this.tagToField[tag] as ContainedGroupField\r\n if (gf !== null) {\r\n return `${gf.definition.name}`\r\n }\r\n return `${tag}`\r\n }\r\n return s.name\r\n }\r\n\r\n /**\r\n * adds a field to this set - simple, component or group\r\n * @param field\r\n */\r\n public add (field: ContainedField): void {\r\n this.fields.push(field)\r\n this.localNameToField.addUpdate(field.name, field)\r\n this.addUpdate(field)\r\n this.addContained(this, field)\r\n }\r\n\r\n /**\r\n * recurses down a path to return nested set definitiom of a group or component\r\n * given in dot notation 'SecListGrp.NoRelatedSym.SecurityTradingRules.BaseTradingRules'\r\n * @param path in dot notation\r\n */\r\n public getSet (path: string): (ContainedFieldSet | null) {\r\n if (!path) return null\r\n return path.split('.').reduce((set: ContainedFieldSet, next: string): (ContainedFieldSet | null) => {\r\n return set.groups.get(next)?.definition ?? set.components.get(next)?.definition ?? null\r\n }, this)\r\n }\r\n\r\n private addUpdate (field: ContainedField): void {\r\n switch (field.type) {\r\n case ContainedFieldType.Simple: {\r\n this.addLocalSimple(field as ContainedSimpleField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Component: {\r\n const cf = field as ContainedComponentField\r\n const definition = cf.definition\r\n if (definition.abbreviation && definition.abbreviation !== field.name) {\r\n this.localNameToField.addUpdate(definition.abbreviation, field)\r\n }\r\n break\r\n }\r\n\r\n case ContainedFieldType.Group: {\r\n const gf = field as ContainedComponentField\r\n const definition = gf.definition\r\n if (definition.abbreviation && definition.abbreviation !== field.name) {\r\n this.localNameToField.addUpdate(definition.abbreviation, field)\r\n }\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown field type ${field.type}`)\r\n }\r\n }\r\n\r\n private addLocalSimple (field: ContainedSimpleField): void {\r\n const definition = field.definition\r\n if (definition.abbreviation && definition.abbreviation !== definition.name) {\r\n this.localNameToField.addUpdate(definition.abbreviation, field)\r\n }\r\n if (definition.baseCategoryAbbreviation && definition.baseCategory === this.category) {\r\n this.localNameToField.addUpdate(definition.baseCategoryAbbreviation, field)\r\n }\r\n if (field.attribute) {\r\n this.nameToLocalAttribute.addUpdate(definition.abbreviation, field)\r\n this.localAttribute.push(field)\r\n // an attribute for FixMl lives in attribute set not fields - in this case xml sub elements\r\n this.fields.pop()\r\n }\r\n const tag = definition.tag\r\n this.localTag[tag] = field\r\n if (field.required) {\r\n this.localRequired[tag] = field\r\n }\r\n }\r\n\r\n private addContained (parent: ContainedFieldSet, field: ContainedField): void {\r\n switch (field.type) {\r\n case ContainedFieldType.Group: {\r\n this.addGroupFieldDef(field as ContainedGroupField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Component: {\r\n this.addComponentFieldDef(field as ContainedComponentField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Simple: {\r\n this.addSimpleFieldDef(parent, field as ContainedSimpleField)\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown field type ${field.type}`)\r\n }\r\n }\r\n\r\n private addAllFields (containedField: ContainedFieldSet): void {\r\n containedField.fields.forEach((f: ContainedField) => {\r\n this.addContained(containedField, f)\r\n })\r\n }\r\n\r\n private addGroupFieldDef (groupField: ContainedGroupField): void {\r\n if (this.groups.containsKey(groupField.name)) {\r\n return\r\n }\r\n const definition = groupField.definition\r\n this.groups.add(groupField.name, groupField)\r\n const nof = definition.noOfField\r\n if (nof) {\r\n const tag = nof.tag\r\n this.containedTag[tag] = true\r\n this.flattenedTag.push(tag)\r\n }\r\n this.addAllFields(definition)\r\n this.mapAllBelow(definition, groupField)\r\n }\r\n\r\n private addComponentFieldDef (componentField: ContainedComponentField): void {\r\n const components = this.components\r\n if (components.containsKey(componentField.name)) {\r\n return\r\n }\r\n const definition = componentField.definition\r\n components.add(componentField.name, componentField)\r\n this.addAllFields(definition)\r\n this.mapAllBelow(definition, componentField)\r\n }\r\n\r\n public keys (): number[] {\r\n const keys: string[] = Object.keys(this.containedTag)\r\n const nums: number[] = new Array(keys.length)\r\n for (let j: number = 0; j < keys.length; ++j) {\r\n nums[j] = parseInt(keys[j], 10)\r\n }\r\n return nums\r\n }\r\n\r\n private mapAllBelow (set: ContainedFieldSet, field: ContainedField): void {\r\n // point all tags in this component to this field.\r\n const tagsBelow: number[] = set.keys()\r\n for (const t of tagsBelow) {\r\n this.tagToField[t] = field\r\n }\r\n }\r\n\r\n private addSimpleFieldDef (parent: ContainedFieldSet, field: ContainedSimpleField): void {\r\n if (this.simple.containsKey(field.name)) {\r\n return\r\n }\r\n if (!this.firstSimple) {\r\n this.firstSimple = field\r\n }\r\n switch (field.definition.tagType) {\r\n case TagType.RawData: {\r\n const dataLengthField: ContainedSimpleField = parent.fields[field.position - 1] as ContainedSimpleField\r\n if (dataLengthField && dataLengthField.definition.tagType === TagType.Length) {\r\n this.containedLength[dataLengthField.definition.tag] = true\r\n this.containsRaw = true\r\n }\r\n break\r\n }\r\n default:\r\n break\r\n }\r\n const tag = field.definition.tag\r\n this.simple.add(field.name, field)\r\n this.containedTag[tag] = true\r\n this.flattenedTag.push(tag)\r\n this.tagToSimple[tag] = field\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"contained-field-set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AG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACd,MAAM,EAAE,GAAmB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC/C,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;gBAChB,OAAO,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;YACrB,CAAC;YACD,OAAO,GAAG,GAAG,EAAE,CAAA;QACjB,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,CAAA;IACf,CAAC;IAOM,MAAM,CAAE,IAAY;QACzB,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAkB,EAAE,IAAY,EAA0B,EAAE;;YACzF,OAAO,MAAA,MAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAA;QACjE,CAAC,EAAE,IAAI,CAAC,CAAA;IACV,CAAC;CACF;AAzID,8CAyIC","sourcesContent":["import { INumericKeyed } from '../../collections/collection'\r\nimport { ContainedField } from './contained-field'\r\nimport { ContainedSimpleField } from './contained-simple-field'\r\nimport { ElasticBuffer } from '../../buffer/elastic-buffer'\r\nimport { ContainedSetType } from '../contained-set-type'\r\nimport { IContainedSet } from './contained-set'\r\n\r\nexport abstract class ContainedFieldSet implements IContainedSet {\r\n /**\r\n * index of name to any group that may be present within the field list\r\n */\r\n public readonly groups: Map<string, IContainedSet> = new Map<string, IContainedSet>()\r\n /**\r\n * index of name to any component that may be present within the field list\r\n */\r\n public readonly components: Map<string, IContainedSet> = new Map<string, IContainedSet>()\r\n /**\r\n * index of name to any simple field that may be present within the field list\r\n */\r\n public readonly simple: Map<string, ContainedSimpleField> = new Map<string, ContainedSimpleField>()\r\n /**\r\n * sequence of fields representing this type - can be simple, group or component\r\n */\r\n public readonly fields: ContainedField[] = []\r\n /**\r\n * any tag at any level i.e. does this set contain a tag\r\n */\r\n public readonly containedTag: INumericKeyed<boolean> = {}\r\n /**\r\n * any tag at any level ordered i.e. all tags flattened to list\r\n */\r\n public readonly flattenedTag: number[] = []\r\n /**\r\n * any data tags contained length within this set.\r\n */\r\n public readonly containedLength: INumericKeyed<boolean> = {}\r\n /**\r\n * tags only in repository at this level, not from any at deeper levels\r\n */\r\n public readonly localTag: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * tags marked required at this level only\r\n */\r\n public readonly localRequired: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * all tags contained within this field set flattened from all levels\r\n */\r\n public readonly tagToSimple: INumericKeyed<ContainedSimpleField> = {}\r\n /**\r\n * direct any tag contained within this set to field one level down where it belongs.\r\n */\r\n public readonly tagToField: INumericKeyed<ContainedField> = {}\r\n /**\r\n * only repository directly in this set indexed by name\r\n */\r\n public readonly localNameToField: Map<string, ContainedField> = new Map<string, ContainedField>()\r\n /**\r\n * for FixMl notation this set of fields appear as attributes i.e. <Pty ID=\"323\" R=\"38\">\r\n */\r\n public readonly nameToLocalAttribute: Map<string, ContainedSimpleField> = new Map<string, ContainedSimpleField>()\r\n /**\r\n * all attributes in order of being declared\r\n */\r\n public readonly localAttribute: ContainedSimpleField[] = []\r\n /**\r\n * at any level on this set, first declared simple field\r\n */\r\n public firstSimple: (ContainedSimpleField | null)\r\n /**\r\n * parser needs to know about raw fields, any present in this set?\r\n */\r\n public containsRaw: boolean = false\r\n\r\n protected constructor (public readonly type: ContainedSetType,\r\n public readonly name: string,\r\n public readonly category: string | null,\r\n public readonly abbreviation: string | null,\r\n public readonly description: string | null) {\r\n }\r\n\r\n /**\r\n * not for generral usage, this partially resets the set such it can be used on a second\r\n * pass of the xml parser\r\n */\r\n public reset (): void {\r\n this.groups.clear()\r\n this.components.clear()\r\n this.simple.clear()\r\n this.empty(this.fields)\r\n this.empty(this.flattenedTag)\r\n this.empty(this.localAttribute)\r\n this.localNameToField.clear()\r\n }\r\n\r\n private empty<T> (arr: T[]): void {\r\n while (arr.length > 0) {\r\n arr.pop()\r\n }\r\n }\r\n\r\n public toString (): string {\r\n const buffer = new ElasticBuffer(2 * 1024)\r\n const fields = this.fields\r\n buffer.writeString(`Set: ${this.name}(${this.getPrefix()}) fields [${fields.length}]: `)\r\n const set: string[] = fields.map((f: ContainedField) => f.toString())\r\n const s = set.join(', ')\r\n buffer.writeString(s)\r\n return buffer.toString()\r\n }\r\n\r\n public abstract getPrefix (): string\r\n\r\n public keys (): number[] {\r\n const keys: string[] = Object.keys(this.containedTag)\r\n const nums: number[] = new Array(keys.length)\r\n for (let j: number = 0; j < keys.length; ++j) {\r\n nums[j] = parseInt(keys[j], 10)\r\n }\r\n return nums\r\n }\r\n\r\n public getFieldName (tag: number): string {\r\n const s = this.tagToSimple[tag]\r\n if (s == null) {\r\n const gf: ContainedField = this.tagToField[tag]\r\n if (gf !== null) {\r\n return `${gf.name}`\r\n }\r\n return `${tag}`\r\n }\r\n return s.name\r\n }\r\n\r\n /**\r\n * recurses down a path to return nested set definitiom of a group or component\r\n * given in dot notation 'SecListGrp.NoRelatedSym.SecurityTradingRules.BaseTradingRules'\r\n * @param path in dot notation\r\n */\r\n public getSet (path: string): (IContainedSet | null) {\r\n if (!path) return null\r\n return path.split('.').reduce((set: IContainedSet, next: string): (IContainedSet | null) => {\r\n return set.groups.get(next) ?? set.components.get(next) ?? null\r\n }, this)\r\n }\r\n}\r\n"]}
|
|
@@ -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
|
export declare class ContainedGroupField extends ContainedField {
|
|
4
4
|
readonly definition: GroupFieldDefinition;
|
|
5
5
|
readonly position: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contained-group-field.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-group-field.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,iEAA2D;AAE3D,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,YAA6B,UAAgC,EAC3C,QAAgB,EAChB,QAAiB,EACjB,QAAiB;QACjC,KAAK,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,yCAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAJrD,eAAU,GAAV,UAAU,CAAsB;QAC3C,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAS;QACjB,aAAQ,GAAR,QAAQ,CAAS;IAEnC,CAAC;IAEM,QAAQ;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAA;QACX,CAAC;QACD,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAChE,OAAO,IAAI,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC,IAAI,GAAG,CAAA;IACxF,CAAC;CACF;AAhBD,kDAgBC","sourcesContent":["import { ContainedField } from './contained-field'\r\nimport { GroupFieldDefinition } from '../definition'\r\nimport { ContainedFieldType } from './contained-field-type'\r\n\r\nexport class ContainedGroupField extends ContainedField {\r\n constructor (public readonly definition: GroupFieldDefinition,\r\n public readonly position: number,\r\n public readonly required: boolean,\r\n public readonly override?: string) {\r\n super(override ?? definition.name, position, ContainedFieldType.Group, required)\r\n }\r\n\r\n public toString (): string {\r\n const definition = this.definition\r\n if (!definition) {\r\n return ''\r\n }\r\n const tag = definition.noOfField ? definition.noOfField.tag : -1\r\n return `[${this.position}]=G.${this.definition.fields.length}(0=${tag})(${this.name})`\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"contained-group-field.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-group-field.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,iEAA2D;AAE3D,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,YAA6B,UAAgC,EAC3C,QAAgB,EAChB,QAAiB,EACjB,QAAiB;QACjC,KAAK,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,yCAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAJrD,eAAU,GAAV,UAAU,CAAsB;QAC3C,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAS;QACjB,aAAQ,GAAR,QAAQ,CAAS;IAEnC,CAAC;IAEM,QAAQ;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAA;QACX,CAAC;QACD,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAChE,OAAO,IAAI,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC,IAAI,GAAG,CAAA;IACxF,CAAC;CACF;AAhBD,kDAgBC","sourcesContent":["import { ContainedField } from './contained-field'\r\nimport { GroupFieldDefinition } from '../definition/group-field-definition'\r\nimport { ContainedFieldType } from './contained-field-type'\r\n\r\nexport class ContainedGroupField extends ContainedField {\r\n constructor (public readonly definition: GroupFieldDefinition,\r\n public readonly position: number,\r\n public readonly required: boolean,\r\n public readonly override?: string) {\r\n super(override ?? definition.name, position, ContainedFieldType.Group, required)\r\n }\r\n\r\n public toString (): string {\r\n const definition = this.definition\r\n if (!definition) {\r\n return ''\r\n }\r\n const tag = definition.noOfField ? definition.noOfField.tag : -1\r\n return `[${this.position}]=G.${this.definition.fields.length}(0=${tag})(${this.name})`\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContainedField } from './contained-field';
|
|
2
|
+
import { IContainedSet } from './contained-set';
|
|
3
|
+
export declare class ContainedSetBuilder {
|
|
4
|
+
set: IContainedSet;
|
|
5
|
+
constructor(set: IContainedSet);
|
|
6
|
+
add(field: ContainedField): void;
|
|
7
|
+
private addUpdate;
|
|
8
|
+
private addLocalSimple;
|
|
9
|
+
private addContained;
|
|
10
|
+
private addGroupFieldDef;
|
|
11
|
+
private addComponentFieldDef;
|
|
12
|
+
private mapAllBelow;
|
|
13
|
+
private addSimpleFieldDef;
|
|
14
|
+
private addAllFields;
|
|
15
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContainedSetBuilder = void 0;
|
|
4
|
+
const contained_field_type_1 = require("./contained-field-type");
|
|
5
|
+
const tag_type_1 = require("../../buffer/tag/tag-type");
|
|
6
|
+
class ContainedSetBuilder {
|
|
7
|
+
constructor(set) {
|
|
8
|
+
this.set = set;
|
|
9
|
+
}
|
|
10
|
+
add(field) {
|
|
11
|
+
this.set.fields.push(field);
|
|
12
|
+
this.set.localNameToField.set(field.name, field);
|
|
13
|
+
this.addUpdate(field);
|
|
14
|
+
this.addContained(this.set, field);
|
|
15
|
+
}
|
|
16
|
+
addUpdate(field) {
|
|
17
|
+
switch (field.type) {
|
|
18
|
+
case contained_field_type_1.ContainedFieldType.Simple: {
|
|
19
|
+
this.addLocalSimple(field);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case contained_field_type_1.ContainedFieldType.Component: {
|
|
23
|
+
const cf = field;
|
|
24
|
+
const definition = cf.definition;
|
|
25
|
+
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
26
|
+
this.set.localNameToField.set(definition.abbreviation, field);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case contained_field_type_1.ContainedFieldType.Group: {
|
|
31
|
+
const gf = field;
|
|
32
|
+
const definition = gf.definition;
|
|
33
|
+
if (definition.abbreviation && definition.abbreviation !== field.name) {
|
|
34
|
+
this.set.localNameToField.set(definition.abbreviation, field);
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`unknown field type ${field.type}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
addLocalSimple(field) {
|
|
43
|
+
const definition = field.definition;
|
|
44
|
+
if (definition.abbreviation && definition.abbreviation !== definition.name) {
|
|
45
|
+
this.set.localNameToField.set(definition.abbreviation, field);
|
|
46
|
+
}
|
|
47
|
+
if (definition.baseCategoryAbbreviation && definition.baseCategory === this.set.category) {
|
|
48
|
+
this.set.localNameToField.set(definition.baseCategoryAbbreviation, field);
|
|
49
|
+
}
|
|
50
|
+
if (field.attribute) {
|
|
51
|
+
this.set.nameToLocalAttribute.set(definition.abbreviation, field);
|
|
52
|
+
this.set.localAttribute.push(field);
|
|
53
|
+
this.set.fields.pop();
|
|
54
|
+
}
|
|
55
|
+
const tag = definition.tag;
|
|
56
|
+
this.set.localTag[tag] = field;
|
|
57
|
+
if (field.required) {
|
|
58
|
+
this.set.localRequired[tag] = field;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
addContained(parent, field) {
|
|
62
|
+
switch (field.type) {
|
|
63
|
+
case contained_field_type_1.ContainedFieldType.Group: {
|
|
64
|
+
this.addGroupFieldDef(field);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case contained_field_type_1.ContainedFieldType.Component: {
|
|
68
|
+
this.addComponentFieldDef(field);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case contained_field_type_1.ContainedFieldType.Simple: {
|
|
72
|
+
this.addSimpleFieldDef(parent, field);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
default:
|
|
76
|
+
throw new Error(`unknown field type ${field.type}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
addGroupFieldDef(groupField) {
|
|
80
|
+
if (this.set.groups.has(groupField.name)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const definition = groupField.definition;
|
|
84
|
+
this.set.groups.set(groupField.name, definition);
|
|
85
|
+
const nof = definition.noOfField;
|
|
86
|
+
if (nof) {
|
|
87
|
+
const tag = nof.tag;
|
|
88
|
+
this.set.containedTag[tag] = true;
|
|
89
|
+
this.set.flattenedTag.push(tag);
|
|
90
|
+
}
|
|
91
|
+
this.addAllFields(definition);
|
|
92
|
+
this.mapAllBelow(definition, groupField);
|
|
93
|
+
}
|
|
94
|
+
addComponentFieldDef(componentField) {
|
|
95
|
+
const components = this.set.components;
|
|
96
|
+
if (components.has(componentField.name)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const definition = componentField.definition;
|
|
100
|
+
components.set(componentField.name, definition);
|
|
101
|
+
this.addAllFields(definition);
|
|
102
|
+
this.mapAllBelow(definition, componentField);
|
|
103
|
+
}
|
|
104
|
+
mapAllBelow(set, field) {
|
|
105
|
+
const tagsBelow = set.keys();
|
|
106
|
+
for (const t of tagsBelow) {
|
|
107
|
+
this.set.tagToField[t] = field;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
addSimpleFieldDef(parent, field) {
|
|
111
|
+
if (this.set.simple.has(field.name)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!this.set.firstSimple) {
|
|
115
|
+
this.set.firstSimple = field;
|
|
116
|
+
}
|
|
117
|
+
switch (field.definition.tagType) {
|
|
118
|
+
case tag_type_1.TagType.RawData: {
|
|
119
|
+
const dataLengthField = parent.fields[field.position - 1];
|
|
120
|
+
if (dataLengthField && dataLengthField.definition.tagType === tag_type_1.TagType.Length) {
|
|
121
|
+
this.set.containedLength[dataLengthField.definition.tag] = true;
|
|
122
|
+
this.set.containsRaw = true;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
const tag = field.definition.tag;
|
|
130
|
+
this.set.simple.set(field.name, field);
|
|
131
|
+
this.set.containedTag[tag] = true;
|
|
132
|
+
this.set.flattenedTag.push(tag);
|
|
133
|
+
this.set.tagToSimple[tag] = field;
|
|
134
|
+
}
|
|
135
|
+
addAllFields(containedField) {
|
|
136
|
+
containedField.fields.forEach((f) => {
|
|
137
|
+
this.addContained(containedField, f);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.ContainedSetBuilder = ContainedSetBuilder;
|
|
142
|
+
//# sourceMappingURL=contained-set-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contained-set-builder.js","sourceRoot":"","sources":["../../../src/dictionary/contained/contained-set-builder.ts"],"names":[],"mappings":";;;AAEA,iEAA2D;AAI3D,wDAAmD;AAGnD,MAAa,mBAAmB;IAC9B,YAA2B,GAAkB;QAAlB,QAAG,GAAH,GAAG,CAAe;IAC7C,CAAC;IAMM,GAAG,CAAE,KAAqB;QAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAChD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACpC,CAAC;IAEO,SA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C,IAAI,EAAE,KAAK,CAAC,CAAA;QACtC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QACjC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACnC,CAAC;IAEO,YAAY,CAAE,cAAiC;QACrD,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAiB,EAAE,EAAE;YAClD,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA1JD,kDA0JC","sourcesContent":["import { ContainedFieldSet } from './contained-field-set'\r\nimport { ContainedField } from './contained-field'\r\nimport { ContainedFieldType } from './contained-field-type'\r\nimport { ContainedSimpleField } from './contained-simple-field'\r\nimport { ContainedComponentField } from './contained-component-field'\r\nimport { ContainedGroupField } from './contained-group-field'\r\nimport { TagType } from '../../buffer/tag/tag-type'\r\nimport { IContainedSet } from './contained-set'\r\n\r\nexport class ContainedSetBuilder {\r\n public constructor (public set: IContainedSet) {\r\n }\r\n\r\n /**\r\n * adds a field to this set - simple, component or group\r\n * @param field\r\n */\r\n public add (field: ContainedField): void {\r\n this.set.fields.push(field)\r\n this.set.localNameToField.set(field.name, field)\r\n this.addUpdate(field)\r\n this.addContained(this.set, field)\r\n }\r\n\r\n private addUpdate (field: ContainedField): void {\r\n switch (field.type) {\r\n case ContainedFieldType.Simple: {\r\n this.addLocalSimple(field as ContainedSimpleField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Component: {\r\n const cf = field as ContainedComponentField\r\n const definition = cf.definition\r\n if (definition.abbreviation && definition.abbreviation !== field.name) {\r\n this.set.localNameToField.set(definition.abbreviation, field)\r\n }\r\n break\r\n }\r\n\r\n case ContainedFieldType.Group: {\r\n const gf = field as ContainedComponentField\r\n const definition = gf.definition\r\n if (definition.abbreviation && definition.abbreviation !== field.name) {\r\n this.set.localNameToField.set(definition.abbreviation, field)\r\n }\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown field type ${field.type}`)\r\n }\r\n }\r\n\r\n private addLocalSimple (field: ContainedSimpleField): void {\r\n const definition = field.definition\r\n if (definition.abbreviation && definition.abbreviation !== definition.name) {\r\n this.set.localNameToField.set(definition.abbreviation, field)\r\n }\r\n if (definition.baseCategoryAbbreviation && definition.baseCategory === this.set.category) {\r\n this.set.localNameToField.set(definition.baseCategoryAbbreviation, field)\r\n }\r\n if (field.attribute) {\r\n this.set.nameToLocalAttribute.set(definition.abbreviation, field)\r\n this.set.localAttribute.push(field)\r\n // an attribute for FixMl lives in attribute set not fields - in this case xml sub elements\r\n this.set.fields.pop()\r\n }\r\n const tag = definition.tag\r\n this.set.localTag[tag] = field\r\n if (field.required) {\r\n this.set.localRequired[tag] = field\r\n }\r\n }\r\n\r\n private addContained (parent: IContainedSet, field: ContainedField): void {\r\n switch (field.type) {\r\n case ContainedFieldType.Group: {\r\n this.addGroupFieldDef(field as ContainedGroupField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Component: {\r\n this.addComponentFieldDef(field as ContainedComponentField)\r\n break\r\n }\r\n\r\n case ContainedFieldType.Simple: {\r\n this.addSimpleFieldDef(parent, field as ContainedSimpleField)\r\n break\r\n }\r\n\r\n default:\r\n throw new Error(`unknown field type ${field.type}`)\r\n }\r\n }\r\n\r\n private addGroupFieldDef (groupField: ContainedGroupField): void {\r\n if (this.set.groups.has(groupField.name)) {\r\n return\r\n }\r\n const definition = groupField.definition\r\n this.set.groups.set(groupField.name, definition)\r\n const nof = definition.noOfField\r\n if (nof) {\r\n const tag = nof.tag\r\n this.set.containedTag[tag] = true\r\n this.set.flattenedTag.push(tag)\r\n }\r\n this.addAllFields(definition)\r\n this.mapAllBelow(definition, groupField)\r\n }\r\n\r\n private addComponentFieldDef (componentField: ContainedComponentField): void {\r\n const components = this.set.components\r\n if (components.has(componentField.name)) {\r\n return\r\n }\r\n const definition = componentField.definition\r\n components.set(componentField.name, definition)\r\n this.addAllFields(definition)\r\n this.mapAllBelow(definition, componentField)\r\n }\r\n\r\n private mapAllBelow (set: ContainedFieldSet, field: ContainedField): void {\r\n // point all tags in this component to this field.\r\n const tagsBelow: number[] = set.keys()\r\n for (const t of tagsBelow) {\r\n this.set.tagToField[t] = field\r\n }\r\n }\r\n\r\n private addSimpleFieldDef (parent: IContainedSet, field: ContainedSimpleField): void {\r\n if (this.set.simple.has(field.name)) {\r\n return\r\n }\r\n if (!this.set.firstSimple) {\r\n this.set.firstSimple = field\r\n }\r\n switch (field.definition.tagType) {\r\n case TagType.RawData: {\r\n const dataLengthField: ContainedSimpleField = parent.fields[field.position - 1] as ContainedSimpleField\r\n if (dataLengthField && dataLengthField.definition.tagType === TagType.Length) {\r\n this.set.containedLength[dataLengthField.definition.tag] = true\r\n this.set.containsRaw = true\r\n }\r\n break\r\n }\r\n default:\r\n break\r\n }\r\n const tag = field.definition.tag\r\n this.set.simple.set(field.name, field)\r\n this.set.containedTag[tag] = true\r\n this.set.flattenedTag.push(tag)\r\n this.set.tagToSimple[tag] = field\r\n }\r\n\r\n private addAllFields (containedField: ContainedFieldSet): void {\r\n containedField.fields.forEach((f: ContainedField) => {\r\n this.addContained(containedField, f)\r\n })\r\n }\r\n}\r\n"]}
|