jspurefix 5.10.2 → 5.10.4

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.
Files changed (50) hide show
  1. package/dist/buffer/encode-proxy.js.map +1 -1
  2. package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
  3. package/dist/buffer/msg-view.js.map +1 -1
  4. package/dist/config/winston-logger.js.map +1 -1
  5. package/dist/dictionary/compiler/standard-snippet.js +2 -2
  6. package/dist/dictionary/compiler/standard-snippet.js.map +1 -1
  7. package/dist/dictionary/parser/fixml/components-parser.js.map +1 -1
  8. package/dist/dictionary/parser/fixml/fields-parser.js.map +1 -1
  9. package/dist/dictionary/parser/fixml/include-graph.js.map +1 -1
  10. package/dist/jsfix-bench.js.map +1 -1
  11. package/dist/jsfix-cmd.js +2 -2
  12. package/dist/jsfix-cmd.js.map +1 -1
  13. package/dist/runtime/session-container.js +11 -8
  14. package/dist/runtime/session-container.js.map +1 -1
  15. package/dist/sample/http/oms/app.js.map +1 -1
  16. package/dist/sample/http/oms/oms-factory.js.map +1 -1
  17. package/dist/sample/tcp/qf-md/app.js.map +1 -1
  18. package/dist/sample/tcp/skeleton/app.js.map +1 -1
  19. package/dist/sample/tcp/trade-capture/app-launcher.js.map +1 -1
  20. package/dist/store/fix-msg-memory-store.js.map +1 -1
  21. package/dist/transport/duplex/http-duplex.d.ts +1 -1
  22. package/dist/transport/duplex/http-duplex.js +2 -5
  23. package/dist/transport/duplex/http-duplex.js.map +1 -1
  24. package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -1
  25. package/dist/transport/session/clone-session-description.js.map +1 -1
  26. package/dist/transport/tcp/tls-options-factory.js.map +1 -1
  27. package/jsfix.test_client.txt +62 -62
  28. package/jsfix.test_server.txt +72 -72
  29. package/package.json +5 -5
  30. package/src/buffer/encode-proxy.ts +1 -1
  31. package/src/buffer/fixml/fixml-encoder.ts +1 -1
  32. package/src/buffer/msg-view.ts +1 -1
  33. package/src/config/winston-logger.ts +1 -1
  34. package/src/dictionary/compiler/standard-snippet.ts +2 -2
  35. package/src/dictionary/parser/fixml/components-parser.ts +2 -2
  36. package/src/dictionary/parser/fixml/fields-parser.ts +1 -1
  37. package/src/dictionary/parser/fixml/include-graph.ts +1 -1
  38. package/src/jsfix-bench.ts +1 -1
  39. package/src/jsfix-cmd.ts +2 -2
  40. package/src/runtime/session-container.ts +12 -4
  41. package/src/sample/http/oms/app.ts +1 -1
  42. package/src/sample/http/oms/oms-factory.ts +4 -4
  43. package/src/sample/tcp/qf-md/app.ts +1 -1
  44. package/src/sample/tcp/skeleton/app.ts +1 -1
  45. package/src/sample/tcp/trade-capture/app-launcher.ts +1 -1
  46. package/src/store/fix-msg-memory-store.ts +1 -1
  47. package/src/transport/duplex/http-duplex.ts +4 -2
  48. package/src/transport/fixml/fixml-session-msg-factory.ts +5 -5
  49. package/src/transport/session/clone-session-description.ts +1 -1
  50. package/src/transport/tcp/tls-options-factory.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"encode-proxy.js","sourceRoot":"","sources":["../../src/buffer/encode-proxy.ts"],"names":[],"mappings":";;;AAEA,uDAOgC;AAChC,6CAAwC;AAExC,MAAa,WAAW;IACtB,YAA6B,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;IACxD,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAE,KAA2B,EAAE,GAAQ;QACpE,MAAM,UAAU,GAA0B,KAAK,CAAC,UAAU,CAAA;QAC1D,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YACxB,MAAM,QAAQ,GAAY,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;YAC9D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,IAAI,sBAAsB,GAAG,GAAG,CAAC,CAAA;YACvE,CAAC;QACH,CAAC;QACD,QAAQ,UAAU,CAAC,OAAO,EAA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G,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBAC9C,OAAO,IAAI,CAAA;YACb,CAAC;SACF,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,OAAO,CAAE,KAAqB,EAAE,GAAQ;QACrD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,8BAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC/B,WAAW,CAAC,gBAAgB,CAAC,KAA6B,EAAE,GAAG,CAAC,CAAA;gBAChE,MAAK;YACP,CAAC;YAED,KAAK,8BAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;gBAClC,GAAG,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAgC,EAAE,GAAG,CAAC,CAAA;gBAC5E,MAAK;YACP,CAAC;YAED,KAAK,8BAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC9B,GAAG,GAAG,WAAW,CAAC,eAAe,CAAC,KAA4B,EAAE,GAAG,CAAC,CAAA;gBACpE,MAAK;YACP,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAEM,IAAI,CAAE,OAAe;QAC1B,MAAM,GAAG,GAAkC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAChF,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAA;QAC3D,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAChD,CAAC;CACF;AAzID,kCAyIC","sourcesContent":["import { ILooseObject } from '../collections/collection'\nimport { FixDefinitions, MessageDefinition, SimpleFieldDefinition } from '../dictionary/definition'\nimport {\n ContainedComponentField,\n ContainedField,\n IContainedSet,\n ContainedFieldType,\n ContainedGroupField,\n ContainedSimpleField\n} from '../dictionary/contained'\nimport { TagType } from './tag/tag-type'\n\nexport class EncodeProxy {\n constructor (public readonly definitions: FixDefinitions) {\n }\n\n private static SimpleFieldCheck (field: ContainedSimpleField, val: any): void {\n const definition: SimpleFieldDefinition = field.definition\n if (definition.isEnum()) {\n const resolved: boolean = definition.containsEnum(String(val))\n if (!resolved) {\n throw new Error(`enum field ${field.name} does not support \"${val}\"`)\n }\n }\n switch (definition.tagType) {\n case TagType.LocalDate:\n case TagType.UtcTimeOnly:\n case TagType.UtcDateOnly:\n case TagType.UtcTimestamp: {\n const isDate: boolean = val instanceof Date\n if (!isDate) {\n throw new Error(`field ${field.name} expects Date but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.Boolean: {\n if (typeof (val) !== typeof true) {\n throw new Error(`field ${field.name} expects boolean but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.String: {\n if (typeof (val) !== 'string') {\n throw new Error(`field ${field.name} expects string but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.RawData: {\n const isBuffer: boolean = val instanceof Buffer\n if (!isBuffer) {\n throw new Error(`field ${field.name} expects Buffer but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.Int:\n case TagType.Float:\n case TagType.Length: {\n if (isNaN(val as number)) {\n throw new Error(`field ${field.name} expects number but receives \"${typeof val}\"`)\n }\n break\n }\n }\n }\n\n private static checkProperties (wrapped: ILooseObject, val: ILooseObject): ILooseObject {\n const keys: string[] = Object.keys(val)\n for (const k of keys) {\n wrapped[k] = val[k]\n }\n return wrapped\n }\n\n private static ComponentFieldCheck (field: ContainedComponentField, val: any): object {\n const isComplex: boolean = typeof val === 'object'\n if (!isComplex) {\n throw new Error(`type ${field.name} is a component but is given type \"${typeof val}\"`)\n }\n return EncodeProxy.checkProperties(new Proxy({}, EncodeProxy.handler(field.definition)), val as ILooseObject)\n }\n\n private static GroupFieldCheck (field: ContainedGroupField, val: any): object {\n const accepted: boolean = Array.isArray(val) || !isNaN(val as number)\n if (!accepted) {\n throw new Error(`type ${field.name} is a group and needs array or number, not \"${typeof val}\"`)\n }\n const gf: ContainedComponentField = field as ContainedComponentField\n const j: number = val\n const isNumber: boolean = !isNaN(val as number)\n if (isNumber) {\n const arr: ILooseObject[] = new Array(j)\n for (let i: number = 0; i < j; ++i) {\n arr[i] = new Proxy({}, EncodeProxy.handler(gf.definition))\n }\n return arr\n } else {\n const arr: ILooseObject[] = val\n for (let i: number = 0; i < arr.length; ++i) {\n arr[i] = EncodeProxy.checkProperties(new Proxy({}, EncodeProxy.handler(gf.definition)), arr[i])\n }\n return arr\n }\n }\n\n private static handler (set: IContainedSet): Object {\n return {\n set (target: ILooseObject, prop: string, val: any): boolean {\n const field: ContainedField | undefined = set.localNameToField.get(prop)\n if (!field) {\n throw new Error(`type ${set.name} has no field named ${prop}`)\n }\n target[prop] = EncodeProxy.examine(field, val)\n return true\n }\n }\n }\n\n private static examine (field: ContainedField, val: any): any {\n switch (field.type) {\n case ContainedFieldType.Simple: {\n EncodeProxy.SimpleFieldCheck(field as ContainedSimpleField, val)\n break\n }\n\n case ContainedFieldType.Component: {\n val = EncodeProxy.ComponentFieldCheck(field as ContainedComponentField, val)\n break\n }\n\n case ContainedFieldType.Group: {\n val = EncodeProxy.GroupFieldCheck(field as ContainedGroupField, val)\n break\n }\n }\n return val\n }\n\n public wrap (msgName: string): ILooseObject {\n const msg: MessageDefinition | undefined = this.definitions.message.get(msgName)\n if (!msg) {\n throw new Error(`no message defined for type ${msgName}`)\n }\n\n return new Proxy({}, EncodeProxy.handler(msg))\n }\n}\n"]}
1
+ {"version":3,"file":"encode-proxy.js","sourceRoot":"","sources":["../../src/buffer/encode-proxy.ts"],"names":[],"mappings":";;;AAEA,uDAOgC;AAChC,6CAAwC;AAExC,MAAa,WAAW;IACtB,YAA6B,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;IACxD,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAE,KAA2B,EAAE,GAAQ;QACpE,MAAM,UAAU,GAA0B,KAAK,C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AAC,CAAA;QAC3D,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAChD,CAAC;CACF;AAzID,kCAyIC","sourcesContent":["import { ILooseObject } from '../collections/collection'\nimport { FixDefinitions, MessageDefinition, SimpleFieldDefinition } from '../dictionary/definition'\nimport {\n ContainedComponentField,\n ContainedField,\n IContainedSet,\n ContainedFieldType,\n ContainedGroupField,\n ContainedSimpleField\n} from '../dictionary/contained'\nimport { TagType } from './tag/tag-type'\n\nexport class EncodeProxy {\n constructor (public readonly definitions: FixDefinitions) {\n }\n\n private static SimpleFieldCheck (field: ContainedSimpleField, val: any): void {\n const definition: SimpleFieldDefinition = field.definition\n if (definition.isEnum()) {\n const resolved: boolean = definition.containsEnum(String(val))\n if (!resolved) {\n throw new Error(`enum field ${field.name} does not support \"${val}\"`)\n }\n }\n switch (definition.tagType) {\n case TagType.LocalDate:\n case TagType.UtcTimeOnly:\n case TagType.UtcDateOnly:\n case TagType.UtcTimestamp: {\n const isDate: boolean = val instanceof Date\n if (!isDate) {\n throw new Error(`field ${field.name} expects Date but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.Boolean: {\n if (typeof (val) !== typeof true) {\n throw new Error(`field ${field.name} expects boolean but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.String: {\n if (typeof (val) !== 'string') {\n throw new Error(`field ${field.name} expects string but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.RawData: {\n const isBuffer: boolean = val instanceof Buffer\n if (!isBuffer) {\n throw new Error(`field ${field.name} expects Buffer but receives \"${typeof val}\"`)\n }\n break\n }\n\n case TagType.Int:\n case TagType.Float:\n case TagType.Length: {\n if (isNaN(val as number)) {\n throw new Error(`field ${field.name} expects number but receives \"${typeof val}\"`)\n }\n break\n }\n }\n }\n\n private static checkProperties (wrapped: ILooseObject, val: ILooseObject): ILooseObject {\n const keys: string[] = Object.keys(val)\n for (const k of keys) {\n wrapped[k] = val[k]\n }\n return wrapped\n }\n\n private static ComponentFieldCheck (field: ContainedComponentField, val: any): object {\n const isComplex: boolean = typeof val === 'object'\n if (!isComplex) {\n throw new Error(`type ${field.name} is a component but is given type \"${typeof val}\"`)\n }\n return EncodeProxy.checkProperties(new Proxy({}, EncodeProxy.handler(field.definition)), val as ILooseObject)\n }\n\n private static GroupFieldCheck (field: ContainedGroupField, val: any): object {\n const accepted: boolean = Array.isArray(val) || !isNaN(val as number)\n if (!accepted) {\n throw new Error(`type ${field.name} is a group and needs array or number, not \"${typeof val}\"`)\n }\n const gf: ContainedComponentField = field\n const j: number = val\n const isNumber: boolean = !isNaN(val as number)\n if (isNumber) {\n const arr: ILooseObject[] = new Array(j)\n for (let i: number = 0; i < j; ++i) {\n arr[i] = new Proxy({}, EncodeProxy.handler(gf.definition))\n }\n return arr\n } else {\n const arr: ILooseObject[] = val\n for (let i: number = 0; i < arr.length; ++i) {\n arr[i] = EncodeProxy.checkProperties(new Proxy({}, EncodeProxy.handler(gf.definition)), arr[i])\n }\n return arr\n }\n }\n\n private static handler (set: IContainedSet): Object {\n return {\n set (target: ILooseObject, prop: string, val: any): boolean {\n const field: ContainedField | undefined = set.localNameToField.get(prop)\n if (!field) {\n throw new Error(`type ${set.name} has no field named ${prop}`)\n }\n target[prop] = EncodeProxy.examine(field, val)\n return true\n }\n }\n }\n\n private static examine (field: ContainedField, val: any): any {\n switch (field.type) {\n case ContainedFieldType.Simple: {\n EncodeProxy.SimpleFieldCheck(field as ContainedSimpleField, val)\n break\n }\n\n case ContainedFieldType.Component: {\n val = EncodeProxy.ComponentFieldCheck(field as ContainedComponentField, val)\n break\n }\n\n case ContainedFieldType.Group: {\n val = EncodeProxy.GroupFieldCheck(field as ContainedGroupField, val)\n break\n }\n }\n return val\n }\n\n public wrap (msgName: string): ILooseObject {\n const msg: MessageDefinition | undefined = this.definitions.message.get(msgName)\n if (!msg) {\n throw new Error(`no message defined for type ${msgName}`)\n }\n\n return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AE,CAAC,UAAU,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;gBAClD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAE,CAAe,EAAE,KAAqB,EAAE,KAAa;QAC7E,MAAM,EAAE,GAA4B,KAAgC,CAAA;QACpE,MAAM,GAAG,GAAG,EAAE,CAAC,UAAU,CAAA;QACzB,MAAM,QAAQ,GAAiB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAC3B,CAAC;CACF,CAAA;AAjNY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,qBAAU,GAAE;IASU,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,cAAc,CAAC,CAAA;IAAyC,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,WAAW,CAAC,CAAA;qCAA5C,8BAAa,EAA6D,2BAAc;GAR1J,YAAY,CAiNxB","sourcesContent":["import { ILooseObject } from '../../collections/collection'\nimport {\n IContainedSet,\n ContainedField,\n ContainedGroupField,\n ContainedComponentField,\n ContainedSimpleField,\n FieldsDispatch\n} from '../../dictionary/contained'\nimport { AsciiChars } from '../ascii'\nimport { MsgEncoder } from '../msg-encoder'\nimport { ElasticBuffer } from '../elastic-buffer'\nimport moment = require('moment')\nimport { FixDefinitions } from '../../dictionary/definition'\nimport { IFieldDispatcher } from '../../dictionary/contained/field-dispatcher'\nimport { TagType } from '../tag/tag-type'\nimport { IPopulatedAttributes } from './populated-attributes'\nimport { inject, injectable } from 'tsyringe'\nimport { DITokens } from '../../runtime/di-tokens'\n\n@injectable()\nexport class FixmlEncoder extends MsgEncoder {\n public attributePerLine: boolean = false\n public readonly eol: string = require('os').EOL\n private readonly beginDoc: string = `<FIXML>${this.eol}`\n private readonly endDoc: string = '</FIXML>'\n private readonly beginBatch: string = `<Batch>${this.eol}`\n private readonly endBatch: string = '</Batch>'\n\n public constructor (@inject(DITokens.TransmitBuffer) public readonly buffer: ElasticBuffer, @inject(DITokens.Definitions) public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n private static asString (sf: ContainedSimpleField, v: any): string {\n switch (sf.definition.tagType) {\n case TagType.String: {\n return v as string\n }\n\n case TagType.Int:\n case TagType.Float:\n case TagType.Length: {\n return v.toString()\n }\n\n case TagType.Boolean: {\n return v ? 'Y' : 'N'\n }\n\n case TagType.UtcTimestamp: {\n const d: Date = v as Date\n return moment(d).utc().format('YYYY-MM-DDTHH:mm:ss.SSS')\n }\n\n case TagType.UtcTimeOnly: {\n const d: Date = v as Date\n return moment.utc(d).format('HH:mm:ss.SSS')\n }\n\n case TagType.LocalDate: {\n const d: Date = v as Date\n return moment(d).format('YYYY-MM-DD')\n }\n\n case TagType.UtcDateOnly: {\n const d: Date = v as Date\n return moment(d).utc(true).format('YYYY-MM-DD')\n }\n }\n return ''\n }\n\n public encodeSet (o: ILooseObject, set: IContainedSet): void {\n const batch: ILooseObject[] = o.Batch\n const toWrite: ILooseObject[] = batch || [o]\n const depth = batch ? 1 : 0\n const buffer = this.buffer\n const begin = this.beginDoc\n const indent: string = '\\t'\n const endBatch = batch ? this.endBatch : ''\n const eol = this.eol\n buffer.reset()\n buffer.writeString(begin)\n if (batch) {\n this.batchStart(o, set, depth)\n }\n toWrite.forEach((next: ILooseObject) => {\n this.toXml(next, set.abbreviation ?? '', set, depth + 1)\n buffer.writeString(eol)\n })\n if (batch) {\n buffer.writeString(`${indent}${endBatch}`)\n }\n\n buffer.writeString(this.endDoc)\n }\n\n private batchStart (o: ILooseObject, set: IContainedSet, depth: number): void {\n const buffer = this.buffer\n const indent: string = '\\t'\n const beginBatch = this.beginBatch\n const hdr: ILooseObject = o.StandardHeader\n const eol = this.eol\n buffer.writeString(`${indent}${beginBatch}`)\n if (hdr) {\n const h = set.fields[0] as ContainedComponentField\n this.toXml(hdr, h.name, h.definition, depth + 1)\n buffer.writeString(eol)\n }\n }\n\n private toXml (o: ILooseObject, name: string, set: IContainedSet, depth: number): void {\n const buffer = this.buffer\n const selfClose: string = '/>'\n const close: string = '>'\n const open: string = '<'\n const indent: string = '\\t'.repeat(depth)\n const newLine = this.eol\n const fields: ContainedField[] = this.getPopulatedFields(set, o)\n const eol: string = fields.length === 0 ? selfClose : close\n buffer.writeString(`${indent}${open}`)\n buffer.writeString(`${name} `)\n this.attributes(o, set, depth, this.attributePerLine)\n buffer.writeString(`${eol}`)\n new FieldsDispatch().dispatchFields(fields, {\n group: (g: ContainedGroupField) => { this.complexGroup(o, g, depth) },\n component: (c: ContainedComponentField) => { this.complexComponent(o, c, depth) }\n } as IFieldDispatcher)\n if (fields.length) {\n const end: string = `${newLine}${indent}</${name}>`\n buffer.writeString(`${end}`)\n }\n }\n\n private getPopulatedFields (set: IContainedSet, o: ILooseObject): ContainedField[] {\n const keys: string[] = Object.keys(o)\n const fields: ContainedField[] = keys.reduce((a: ContainedField[], current: string) => {\n const field: ContainedField | undefined = set.localNameToField.get(current)\n if (field && !set.nameToLocalAttribute.has(current)) {\n a.push(field)\n }\n return a\n }, [])\n fields.sort((a: ContainedField, b: ContainedField) => a.position - b.position)\n return fields\n }\n\n private encodeAttribute (name: string, val: string): void {\n if (val == null) {\n return\n }\n const buffer = this.buffer\n buffer.writeString(name)\n buffer.writeChar(AsciiChars.Equal)\n buffer.writeChar(AsciiChars.Dq)\n buffer.writeString(val)\n buffer.writeChar(AsciiChars.Dq)\n }\n\n private attributes (o: ILooseObject, set: IContainedSet, depth: number, attributePerLine: boolean): void {\n const newLine = this.eol\n const indent: string = '\\t'.repeat(depth + 1)\n const attributes = set.localAttribute\n const buffer = this.buffer\n if (attributes.length && attributePerLine) {\n buffer.writeString(newLine)\n buffer.writeString(indent)\n }\n const populatedAttributes: IPopulatedAttributes = this.getPopulatedAttributes(o, attributes)\n for (let a = 0; a < populatedAttributes.values.length; ++a) {\n const last = a === populatedAttributes.values.length - 1\n const f = populatedAttributes.fields[a]\n if (a || this.attributePerLine) buffer.writeChar(AsciiChars.Space)\n this.encodeAttribute(f.name, FixmlEncoder.asString(f, populatedAttributes.values[a]))\n if (!last && attributePerLine) {\n buffer.writeString(newLine)\n buffer.writeString(indent)\n }\n }\n }\n\n private getPopulatedAttributes (o: ILooseObject, attributes: ContainedSimpleField[]): IPopulatedAttributes {\n return attributes.reduce<IPopulatedAttributes>((a: IPopulatedAttributes, f: ContainedSimpleField) => {\n let v: any = o[f.definition.name]\n if (v == null) {\n v = o[f.name]\n }\n if (v != null) {\n a.values.push(v)\n a.fields.push(f)\n }\n return a\n }, {\n values: [],\n fields: []\n })\n }\n\n private complexGroup (o: ILooseObject, field: ContainedField, depth: number): void {\n const gf: ContainedGroupField = field as ContainedGroupField\n const elements: ILooseObject[] = o[gf.definition.name]\n if (elements) {\n if (Array.isArray(elements)) {\n for (const e of elements) {\n this.buffer.writeString(this.eol)\n this.toXml(e, gf.name, gf.definition, depth + 1)\n }\n } else {\n throw new Error(`expected array for member ${gf.definition.name}`)\n }\n }\n }\n\n private complexComponent (o: ILooseObject, field: ContainedField, depth: number): void {\n const cf: ContainedComponentField = field as ContainedComponentField\n const def = cf.definition\n const instance: ILooseObject = o[def.name]\n if (instance) {\n this.buffer.writeString(this.eol)\n this.toXml(instance, cf.name, def, depth + 1)\n }\n }\n\n reset (): void {\n this.buffer.reset()\n }\n\n trim (): Buffer {\n return this.buffer.copy()\n }\n}\n"]}
1
+ {"version":3,"file":"fixml-encoder.js","sourceRoot":"","sources":["../../../src/buffer/fixml/fixml-encoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,0DAOmC;AACnC,oCAAqC;AACrC,gDAA2C;AAC3C,sDAAiD;AACjD,iCAAiC;AACjC,4DAA4D;AAE5D,8CAAyC;AAEzC,uCAA6C;AAC7C,uDAAkD;AAG3C,IAAM,YAAY,oBAAlB,MAAM,YAAa,SAAQ,wBAAU;IAQ1C,YAAqD,MAAqC,EAAgC,WAA2C;QACnK,KAAK,CAAC,WAAW,CAAC,CAAA;QADiD,WAAM,GAAN,MAAM,CAAe;QAAgD,gBAAW,GAAX,WAAW,CAAgB;QAP9J,qBAAgB,GAAY,KAAK,CAAA;QACxB,QAAG,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;QAC9B,aAAQ,GAAW,UAAU,IAAI,CAAC,GAAG,EAAE,CAAA;QACvC,WAAM,GAAW,UAAU,CAAA;QAC3B,eAAU,GAAW,UAAU,IAAI,CAAC,GAAG,EAAE,CAAA;QACzC,aAAQ,GAAW,UAAU,CAAA;IAI9C,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAE,EAAwB,EAAE,CAAM;QACvD,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC9B,KAAK,kBAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBACpB,OAAO,CAAW,CAAA;YACpB,CAAC;YAED,KAAK,kBAAO,CAAC,GAAG,CAAC;YACjB,KAAK,kBAAO,CAAC,KAAK,CAAC;YACnB,KAAK,kBAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBACpB,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA;YACrB,CAAC;YAED,KAAK,kBAAO,CAAC,OAAO,CAAC,CAAC,CAAC;gBACrB,OAAO,CAAC,CAAC,CAAC,CAA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EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;gBAClD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAE,CAAe,EAAE,KAAqB,EAAE,KAAa;QAC7E,MAAM,EAAE,GAA4B,KAAgC,CAAA;QACpE,MAAM,GAAG,GAAG,EAAE,CAAC,UAAU,CAAA;QACzB,MAAM,QAAQ,GAAiB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAC3B,CAAC;CACF,CAAA;AAjNY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,qBAAU,GAAE;IASU,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,cAAc,CAAC,CAAA;IAAyC,WAAA,IAAA,iBAAM,EAAC,oBAAQ,CAAC,WAAW,CAAC,CAAA;qCAA5C,8BAAa,EAA6D,2BAAc;GAR1J,YAAY,CAiNxB","sourcesContent":["import { ILooseObject } from '../../collections/collection'\nimport {\n IContainedSet,\n ContainedField,\n ContainedGroupField,\n ContainedComponentField,\n ContainedSimpleField,\n FieldsDispatch\n} from '../../dictionary/contained'\nimport { AsciiChars } from '../ascii'\nimport { MsgEncoder } from '../msg-encoder'\nimport { ElasticBuffer } from '../elastic-buffer'\nimport moment = require('moment')\nimport { FixDefinitions } from '../../dictionary/definition'\nimport { IFieldDispatcher } from '../../dictionary/contained/field-dispatcher'\nimport { TagType } from '../tag/tag-type'\nimport { IPopulatedAttributes } from './populated-attributes'\nimport { inject, injectable } from 'tsyringe'\nimport { DITokens } from '../../runtime/di-tokens'\n\n@injectable()\nexport class FixmlEncoder extends MsgEncoder {\n public attributePerLine: boolean = false\n public readonly eol: string = require('os').EOL\n private readonly beginDoc: string = `<FIXML>${this.eol}`\n private readonly endDoc: string = '</FIXML>'\n private readonly beginBatch: string = `<Batch>${this.eol}`\n private readonly endBatch: string = '</Batch>'\n\n public constructor (@inject(DITokens.TransmitBuffer) public readonly buffer: ElasticBuffer, @inject(DITokens.Definitions) public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n private static asString (sf: ContainedSimpleField, v: any): string {\n switch (sf.definition.tagType) {\n case TagType.String: {\n return v as string\n }\n\n case TagType.Int:\n case TagType.Float:\n case TagType.Length: {\n return v.toString()\n }\n\n case TagType.Boolean: {\n return v ? 'Y' : 'N'\n }\n\n case TagType.UtcTimestamp: {\n const d: Date = v as Date\n return moment(d).utc().format('YYYY-MM-DDTHH:mm:ss.SSS')\n }\n\n case TagType.UtcTimeOnly: {\n const d: Date = v as Date\n return moment.utc(d).format('HH:mm:ss.SSS')\n }\n\n case TagType.LocalDate: {\n const d: Date = v as Date\n return moment(d).format('YYYY-MM-DD')\n }\n\n case TagType.UtcDateOnly: {\n const d: Date = v as Date\n return moment(d).utc(true).format('YYYY-MM-DD')\n }\n }\n return ''\n }\n\n public encodeSet (o: ILooseObject, set: IContainedSet): void {\n const batch: ILooseObject[] = o.Batch\n const toWrite: ILooseObject[] = batch || [o]\n const depth = batch ? 1 : 0\n const buffer = this.buffer\n const begin = this.beginDoc\n const indent: string = '\\t'\n const endBatch = batch ? this.endBatch : ''\n const eol = this.eol\n buffer.reset()\n buffer.writeString(begin)\n if (batch) {\n this.batchStart(o, set, depth)\n }\n toWrite.forEach((next: ILooseObject) => {\n this.toXml(next, set.abbreviation ?? '', set, depth + 1)\n buffer.writeString(eol)\n })\n if (batch) {\n buffer.writeString(`${indent}${endBatch}`)\n }\n\n buffer.writeString(this.endDoc)\n }\n\n private batchStart (o: ILooseObject, set: IContainedSet, depth: number): void {\n const buffer = this.buffer\n const indent: string = '\\t'\n const beginBatch = this.beginBatch\n const hdr: ILooseObject = o.StandardHeader\n const eol = this.eol\n buffer.writeString(`${indent}${beginBatch}`)\n if (hdr) {\n const h = set.fields[0] as ContainedComponentField\n this.toXml(hdr, h.name, h.definition, depth + 1)\n buffer.writeString(eol)\n }\n }\n\n private toXml (o: ILooseObject, name: string, set: IContainedSet, depth: number): void {\n const buffer = this.buffer\n const selfClose: string = '/>'\n const close: string = '>'\n const open: string = '<'\n const indent: string = '\\t'.repeat(depth)\n const newLine = this.eol\n const fields: ContainedField[] = this.getPopulatedFields(set, o)\n const eol: string = fields.length === 0 ? selfClose : close\n buffer.writeString(`${indent}${open}`)\n buffer.writeString(`${name} `)\n this.attributes(o, set, depth, this.attributePerLine)\n buffer.writeString(`${eol}`)\n new FieldsDispatch().dispatchFields(fields, {\n group: (g: ContainedGroupField) => { this.complexGroup(o, g, depth) },\n component: (c: ContainedComponentField) => { this.complexComponent(o, c, depth) }\n })\n if (fields.length) {\n const end: string = `${newLine}${indent}</${name}>`\n buffer.writeString(`${end}`)\n }\n }\n\n private getPopulatedFields (set: IContainedSet, o: ILooseObject): ContainedField[] {\n const keys: string[] = Object.keys(o)\n const fields: ContainedField[] = keys.reduce((a: ContainedField[], current: string) => {\n const field: ContainedField | undefined = set.localNameToField.get(current)\n if (field && !set.nameToLocalAttribute.has(current)) {\n a.push(field)\n }\n return a\n }, [])\n fields.sort((a: ContainedField, b: ContainedField) => a.position - b.position)\n return fields\n }\n\n private encodeAttribute (name: string, val: string): void {\n if (val == null) {\n return\n }\n const buffer = this.buffer\n buffer.writeString(name)\n buffer.writeChar(AsciiChars.Equal)\n buffer.writeChar(AsciiChars.Dq)\n buffer.writeString(val)\n buffer.writeChar(AsciiChars.Dq)\n }\n\n private attributes (o: ILooseObject, set: IContainedSet, depth: number, attributePerLine: boolean): void {\n const newLine = this.eol\n const indent: string = '\\t'.repeat(depth + 1)\n const attributes = set.localAttribute\n const buffer = this.buffer\n if (attributes.length && attributePerLine) {\n buffer.writeString(newLine)\n buffer.writeString(indent)\n }\n const populatedAttributes: IPopulatedAttributes = this.getPopulatedAttributes(o, attributes)\n for (let a = 0; a < populatedAttributes.values.length; ++a) {\n const last = a === populatedAttributes.values.length - 1\n const f = populatedAttributes.fields[a]\n if (a || this.attributePerLine) buffer.writeChar(AsciiChars.Space)\n this.encodeAttribute(f.name, FixmlEncoder.asString(f, populatedAttributes.values[a]))\n if (!last && attributePerLine) {\n buffer.writeString(newLine)\n buffer.writeString(indent)\n }\n }\n }\n\n private getPopulatedAttributes (o: ILooseObject, attributes: ContainedSimpleField[]): IPopulatedAttributes {\n return attributes.reduce<IPopulatedAttributes>((a: IPopulatedAttributes, f: ContainedSimpleField) => {\n let v: any = o[f.definition.name]\n if (v == null) {\n v = o[f.name]\n }\n if (v != null) {\n a.values.push(v)\n a.fields.push(f)\n }\n return a\n }, {\n values: [],\n fields: []\n })\n }\n\n private complexGroup (o: ILooseObject, field: ContainedField, depth: number): void {\n const gf: ContainedGroupField = field as ContainedGroupField\n const elements: ILooseObject[] = o[gf.definition.name]\n if (elements) {\n if (Array.isArray(elements)) {\n for (const e of elements) {\n this.buffer.writeString(this.eol)\n this.toXml(e, gf.name, gf.definition, depth + 1)\n }\n } else {\n throw new Error(`expected array for member ${gf.definition.name}`)\n }\n }\n }\n\n private complexComponent (o: ILooseObject, field: ContainedField, depth: number): void {\n const cf: ContainedComponentField = field as ContainedComponentField\n const def = cf.definition\n const instance: ILooseObject = o[def.name]\n if (instance) {\n this.buffer.writeString(this.eol)\n this.toXml(instance, cf.name, def, depth + 1)\n }\n }\n\n reset (): void {\n this.buffer.reset()\n }\n\n trim (): Buffer {\n return this.buffer.copy()\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"msg-view.js","sourceRoot":"","sources":["../../src/buffer/msg-view.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAWtC,8CAAyC;AAEzC,qDAAgD;AAGhD,yEAAmE;AAEnE,MAAsB,OAAO;IAK3B,YAAuC,WAA2B,EAAkB,OAA2B,EAAkB,SAA2B;QAArH,gBAAW,GAAX,WAAW,CAAgB;QAAkB,YAAO,GAAP,OAAO,CAAoB;QAAkB,cAAS,GAAT,SAAS,CAAkB;QAF3I,YAAO,GAA4B,IAAI,sBAAS,EAAgB,CAAA;IAGjF,CAAC;IA+CM,OAAO;;QACZ,MAAM,WAAW,GAAa,EAAE,CAAA;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAA;QAC5B,IAAI,GAAG,IAAI,IAAI;YAAE,OAAO,EAAE,CAAA;QAC1B,MAAM,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,IAAI,mCAAI,IAAI,CAAA;QACzC,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,EAAE,CAAA;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;YAC9B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;YACvC,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAGM,OAAO;QACZ,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI;YAAE,OAAO,EAAE,CAAA;QACnC,IAAI,I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G,CAAC,KAA4B,EAAE,GAAW,EAAE,CAAS,EAAE,KAAa,EAAE,EAAU,EAAU,EAAE;IACrH,MAAM,OAAO,GAAW,CAAC,CAAA;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;IAEjC,IAAI,IAAY,CAAA;IAChB,IAAI,IAAY,CAAA;IAChB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,SAAS,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACnB,IAAI,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAA;QAC5C,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,GAAG,GAAG,EAAE,CAAA;QACjB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,GAAG,GAAG,EAAE,CAAA;QACf,IAAI,GAAG,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,SAAiB,CAAA;IACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACpD,SAAS,GAAG,OAAO,CAAA;IACrB,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IACnC,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,OAAO,IAAI,GAAG,SAAS,EAAE,CAAA;AAC3D,CAAC,AAxBuB,CAwBvB","sourcesContent":["import { TagPos } from './tag/tag-pos'\nimport { SegmentDescription } from './segment/segment-description'\nimport { Structure } from './structure'\nimport { Tags } from './tag/tags'\nimport {\n ContainedComponentField,\n ContainedField,\n IContainedSet,\n ContainedGroupField,\n ContainedSimpleField\n} from '../dictionary/contained'\nimport { SetReduce } from '../dictionary'\nimport { ILooseObject } from '../collections/collection'\nimport { ElasticBuffer } from './elastic-buffer'\nimport { FixDefinitions, GroupFieldDefinition, SimpleFieldDefinition } from '../dictionary/definition'\nimport { ITypeDispatcher } from '../dictionary/type-dispatcher'\nimport { ContainedSetType } from '../dictionary/contained-set-type'\n\nexport abstract class MsgView {\n protected sortedTagPosForwards: TagPos[]\n protected sortedTagPosBackwards: TagPos[]\n private readonly reducer: SetReduce<ILooseObject> = new SetReduce<ILooseObject>()\n\n protected constructor (public readonly definitions: FixDefinitions, public readonly segment: SegmentDescription, public readonly structure: Structure | null) {\n }\n\n protected static asVerbose = (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos): string => {\n const newLine = require('os').EOL\n let desc: string\n let name: string\n if (field) {\n name = field.name || 'unknown'\n if (field.isEnum()) {\n desc = `${val}[${field.resolveEnum(val)}]${newLine}\\t${field.description ?? ''}${newLine}${newLine}`\n } else {\n desc = `${val}${newLine}t${field.description ?? ''}${newLine}${newLine}`\n }\n } else {\n name = 'unknown'\n desc = 'na'\n }\n return `[${i}] ${tp.tag} (${name}) = ${desc}`\n }\n\n protected static asToken = (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos): string => {\n const perLine: number = 2\n const newLine = require('os').EOL\n // [280] 814 (ApplQueueResolution) = 2[OverlayLast][281] 10 (CheckSum) = 80\n let desc: string\n let name: string\n if (field) {\n name = field.name || 'unknown'\n if (field.isEnum()) {\n desc = `${val}[${field.resolveEnum(val)}]`\n } else {\n desc = `${val}`\n }\n } else {\n desc = `${val}`\n name = 'unknown'\n }\n let delimiter: string\n if (i === 1 || (i < count && i % perLine - 1 === 0)) {\n delimiter = newLine\n } else {\n delimiter = i < count ? ', ' : ''\n }\n return `[${i}] ${tp.tag} (${name}) = ${desc}${delimiter}`\n }\n\n // return list of any tags parsed that are not valid\n public invalid (): number[] {\n const invalidTags: number[] = []\n const set = this.segment.set\n if (set == null) return []\n const tags = this.structure?.tags ?? null\n if (tags == null) return []\n for (let i = 0; i < tags.nextTagPos; ++i) {\n const tag = tags.tagPos[i].tag\n if (tag <= 0 || !set.containedTag[tag]) {\n invalidTags[invalidTags.length] = tag\n }\n }\n return invalidTags\n }\n\n // list of tags that must be present\n public missing (): number[] {\n if (this.segment == null) return []\n if (this.segment.set == null) return []\n return this.missingRequired(this.segment.set, [])\n }\n\n /**\n * does this view contain this tag\n * @param tagOrName the name or tag of field to check 8 or BeginString\n */\n public contains (tagOrName: number | string): boolean {\n const tag: number = this.resolveTag(tagOrName)\n const position: number = this.getPosition(tag)\n return position >= 0\n }\n\n /**\n * if this view represents a repeated group then return a sub view representing\n * this instance of repeated group.\n * @param i the index to return i.e. 0 is first within repeated group\n */\n public getGroupInstance (i: number): MsgView | null {\n const instance: SegmentDescription | null = this.segment?.getInstance(i)\n if (!instance) {\n return null\n }\n return this.create(instance)\n }\n\n public getUndefined (): SegmentDescription | SegmentDescription[] | null {\n return this.structure?.layout['.undefined']\n }\n\n public undefinedForMsg (): string | null {\n let msg: string | null = null\n const undefinedTags = this.getUndefined()\n if (undefinedTags) {\n if (Array.isArray(undefinedTags)) {\n msg = 'undefined tags = ' + undefinedTags.map((e: SegmentDescription) => e.startTag.toString()).join(', ')\n } else {\n msg = `undefined tag = ${undefinedTags.startTag}`\n }\n }\n return msg\n }\n\n /**\n * if this view represents a repeated group then return number\n * of repeated instances within this view\n */\n public groupCount (): number {\n const positions = this.segment.delimiterPositions\n return positions ? positions.length : 0\n }\n\n /**\n * regardless of how this type is represented in data dictionary,\n * return its value as a string.\n * @param tagOrName name or tag to return 8 or BeginString\n */\n public getString (tagOrName: number | string): string | null {\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const position: number = this.getPosition(tag)\n if (position < 0) {\n return null\n }\n return this.stringAtPosition(position)\n }\n\n /**\n * for a repeated group, one field may be repeted across each instance of a component\n * return all values for a specified field as array of strings\n * @param tagOrName the name of the repeated field to fetch\n */\n public getStrings (tagOrName: number | string | null = null): Array<(string | null)> | null {\n if (!tagOrName) {\n return this.allStrings()\n }\n tagOrName = tagOrName || -1\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const positions: number[] = this.getPositions(tag)\n if (positions == null) {\n return null\n }\n return positions.map((position: number) => {\n return this.stringAtPosition(position)\n })\n }\n\n /**\n * returns typed value of a sinple field within this view\n * @param tagOrName the name or tag of required field e.g. 8, BeginString\n */\n public getTyped (tagOrName: number | string): (boolean | string | number | Date | Buffer | null) {\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const field: SimpleFieldDefinition | null = this.definitions.tagToSimple[tag] ?? null\n if (field == null) {\n return null\n }\n return this.toTyped(field)\n }\n\n /**\n * use a varargs list of tags or tag names to fetch typed values for those fields within this view.\n * @param tagOrNames list of tags e.g. 'BeginString', 'BodyLength', ...\n */\n public getTypedList (...tagOrNames: Array<number | string>): Array<boolean | string | number | Date | Buffer | null> {\n return tagOrNames.map((s) => this.getTyped(s))\n }\n\n /**\n * use an array of tags or tag names to fetch typed values for those fields within this view.\n * @param tagOrName the list of params as array ['BeginString','BodyLength', 'MsgType']\n */\n public getTypedTags (tagOrName: Array<string | number>): Array<boolean | string | number | Date | Buffer | null> {\n return tagOrName.map((s) => this.getTyped(s))\n }\n\n /**\n * produce an object representation of the view which when coupled with its\n * interface (generated against the same dictionary source) will allow easy\n * navigation of the object where a group is resolved to an array and simple\n * fields are properties. This is relatively expensive operation as every\n * field is fully resolved regardless of depth i.e. all groups and compoennts\n * are fully resolved.\n */\n public toObject (): ILooseObject | ILooseObject[] | null {\n const segment: SegmentDescription = this.segment\n if (segment.set == null) return null\n if (segment.delimiterTag) {\n switch (segment.set.type) {\n case ContainedSetType.Group: {\n return this.asInstances((segment.set as GroupFieldDefinition).name)\n }\n case ContainedSetType.Msg: {\n // this is a batch of messages\n const hdrView = this.getView('Hdr')\n const batch: ILooseObject = {}\n if (hdrView) {\n const name = hdrView.segment.set?.name ?? 'na'\n batch[name] = hdrView.toObject()\n }\n batch[segment.name] = this.asInstances(segment.name)\n return batch\n }\n }\n }\n return this.asLoose(segment.set)\n }\n\n /**\n * easy human-readable format showing each field, its position, value and resolved\n * enum.\n */\n public toString (): string {\n return this.stringify(MsgView.asToken)\n }\n\n public toVerbose (): string {\n return this.stringify(MsgView.asVerbose)\n }\n\n /**\n * a string in JSON format representing this view as an object\n */\n public toJson (): string {\n return JSON.stringify(this.toObject(), null, 4)\n }\n\n /**\n * fetch a nested view, either by a single name - getView('Instrument') - or by a\n * dotted path walked a step at a time - getView('Parties.PtysSubGrp')\n */\n public getView (name: string): MsgView | null {\n // the dotted form is the exception. resolve a plain name without paying for\n // the parts array and the closure a split and reduce would allocate - the\n // component walk in toObject and validate comes through here per component.\n if (!name.includes('.')) {\n return this.resolveChild(name)\n }\n let view: MsgView | null = this\n for (const part of name.split('.')) {\n view = view.resolveChild(part)\n if (!view) {\n return null\n }\n }\n return view\n }\n\n /**\n * resolve one step of a view path against this view\n */\n private resolveChild (name: string): MsgView | null {\n const structure = this.structure\n const singleton: SegmentDescription | null = structure?.firstContainedWithin(name, this.segment) ?? null\n if (singleton) {\n return this.create(singleton)\n }\n // is this a full name where abbreviation exists\n const component: ContainedField | null = this.segment.set?.localNameToField.get(name) ?? null\n\n if (component) {\n const abbreviated: SegmentDescription | null = structure?.firstContainedWithin(component.name, this.segment) ?? null\n if (abbreviated) {\n return this.create(abbreviated)\n }\n }\n return null\n }\n\n public abstract checksum (): number\n\n public abstract clone (): MsgView\n\n protected abstract create (singleton: SegmentDescription): MsgView\n\n protected abstract stringAtPosition (position: number): string | null\n\n protected abstract toTyped (field: SimpleFieldDefinition): boolean | string | number | Date | Buffer | null\n\n protected resolveTag (tagOrName: number | string): number {\n let tag: number\n const set = this.segment.set\n if (typeof (tagOrName) === 'string') {\n if (set == null) return 0\n const cf = set.simple.get(tagOrName)\n const f: SimpleFieldDefinition | null = cf ? cf.definition : this.definitions.simple.get(tagOrName) ?? null\n if (f == null) {\n return -1\n }\n tag = f.tag\n } else {\n tag = tagOrName\n }\n return tag\n }\n\n // fetch all positions of a particular tag.\n protected getPositions (tag: number): number[] {\n const forwards: TagPos[] = this.sortedTagPosForwards\n const backwards: TagPos[] = this.sortedTagPosBackwards\n const position: number = this.binarySearch(tag)\n if (position < 0) {\n return []\n }\n\n const count: number = forwards.length\n const last: number = count - 1\n let end: number = position\n while (end <= last) {\n if (tag !== forwards[end].tag) {\n break\n }\n ++end\n }\n // avoid backtracking over an array by scan forwards on a reversed copy\n let start: number = last - position\n while (start <= last) {\n if (tag !== backwards[start].tag) {\n break\n }\n ++start\n }\n const begin: number = last - (start - 1)\n const len: number = end - begin\n const positions: number[] = new Array(len)\n for (let i: number = begin; i < end; ++i) {\n positions[i - begin] = forwards[i].position\n }\n return positions\n }\n\n protected getPosition (tag: number): number {\n const pos: number = this.binarySearch(tag)\n if (pos >= 0) {\n return this.sortedTagPosForwards[pos].position\n } else {\n return -1\n }\n }\n\n private allStrings (): Array<(string | null)> {\n const segment: SegmentDescription = this.segment\n const range: number[] = []\n if (segment.segmentView) {\n for (const tp of segment.segmentView.tags) {\n range[range.length] = tp.position\n }\n } else {\n for (let i: number = segment.startPosition; i <= segment.endPosition; ++i) {\n range[range.length] = i\n }\n }\n return range.map((i: number) => this.stringAtPosition(i))\n }\n\n private asInstances (name: string): Array<ILooseObject | null> | null {\n const groupView: MsgView | null = this.getView(name)\n if (groupView == null) {\n return null\n }\n const groupArray = new Array<ILooseObject | null>(groupView.groupCount())\n const count: number = groupView.groupCount()\n for (let j: number = 0; j < count; ++j) {\n const instance: MsgView | null = groupView.getGroupInstance(j)\n groupArray[j] = instance?.toObject() ?? null\n }\n return groupArray\n }\n\n private asLoose (def: IContainedSet): ILooseObject {\n\n return this.reducer.reduce(def, {\n group: (a: ILooseObject, field: ContainedGroupField) => { this.asLooseGroup(a, field) },\n simple: (a: ILooseObject, field: ContainedSimpleField) => { this.asLooseSimple(a, field) },\n component: (a: ILooseObject, field: ContainedComponentField) => { this.asLooseComponent(a, field) }\n } as ITypeDispatcher<ILooseObject>, def.localAttribute.reduce<ILooseObject>((a: ILooseObject, sf: ContainedSimpleField) => {\n const def = sf.definition\n const position: number = this.getPosition(def.tag)\n if (position >= 0) {\n a[def.name] = this.toTyped(def)\n }\n return a\n }, {}))\n }\n\n private missingRequired (def: IContainedSet, tags: number []): number[] {\n const reducer = new SetReduce<number[]>()\n const dispatcher: ITypeDispatcher<number[]> = {\n group: (a: number[], field: ContainedGroupField) => { this.missingGroup(def, field, a) },\n simple: (a: number[], field: ContainedSimpleField) => { this.missingSimple(field, a) },\n component: (a: number[], field: ContainedComponentField) => { this.missingComponent(field, a) }\n }\n return reducer.reduce(def, dispatcher, tags)\n }\n\n private missingSimple (sf: ContainedSimpleField, a: number[]): void {\n if (sf.required && this.getPosition(sf.definition.tag) < 0) {\n a.push(sf.definition.tag)\n }\n }\n\n private missingComponent (cf: ContainedComponentField, a: number[]): void {\n const view: MsgView | null = this.getView(cf.name)\n if (view) {\n view.missingRequired(cf.definition, a)\n }\n }\n\n private missingGroup (def: IContainedSet, gf: ContainedGroupField, tags: number []): void {\n const name = gf.definition.noOfField ? gf.definition.noOfField.name : def.name\n const groupView: MsgView | null = this.getView(name) ?? this.getView(gf.definition.name)\n if (groupView == null) {\n return\n }\n const count: number = groupView.groupCount()\n for (let j: number = 0; j < count; ++j) {\n const instance: MsgView | null = groupView.getGroupInstance(j)\n instance?.missingRequired(gf.definition, tags)\n }\n }\n\n private asLooseComponent (a: ILooseObject, cf: ContainedComponentField): void {\n const view: MsgView | null = this.getView(cf.name)\n if (view) {\n const component = view.toObject()\n if (component) {\n a[cf.definition.name] = component\n }\n }\n }\n\n private asLooseSimple (a: ILooseObject, sf: ContainedSimpleField): void {\n const def = sf.definition\n const position: number = this.getPosition(def.tag)\n if (position >= 0) {\n const asSimple: boolean | string | number | Date | Buffer | null = this.toTyped(def)\n if (asSimple != null) { // beware, may be false value\n a[sf.name] = asSimple\n }\n }\n }\n\n private asLooseGroup (a: ILooseObject, gf: ContainedGroupField): void {\n const def = gf.definition\n const name = def.noOfField ? def.noOfField.name : def.name\n const instances: ILooseObject | null = this.asInstances(name) ?? this.asInstances(def.name)\n if (instances) {\n a[def.name] = instances\n }\n }\n\n private binarySearch (tag: number): number {\n if (this.structure == null) return -1\n let forwards = this.sortedTagPosForwards\n if (!forwards) {\n const segment = this.segment\n if (segment.segmentView) {\n // fragmented component: use the collected tags from SegmentView\n forwards = this.sortedTagPosForwards = segment.segmentView.tags.slice()\n forwards.sort(TagPos.compare)\n } else {\n forwards = this.sortedTagPosForwards = this.structure.tags.tagPos.slice(segment.startPosition, segment.endPosition + 1)\n forwards.sort(TagPos.compare)\n }\n this.sortedTagPosBackwards = forwards.slice().reverse()\n }\n return TagPos.binarySearch(forwards, tag)\n }\n\n private stringify (getToken: (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos) => string): string {\n const structure = this.structure\n const buffer: ElasticBuffer = new ElasticBuffer()\n const segment: SegmentDescription = this.segment\n if (structure == null) return ''\n const tags: Tags = structure.tags\n const count: number = segment.endPosition - segment.startPosition\n const simple: Map<string, SimpleFieldDefinition> = this.definitions.simple\n\n for (let i: number = segment.startPosition; i <= segment.endPosition; ++i) {\n const tagPos: TagPos = tags.tagPos[i]\n const field: SimpleFieldDefinition | undefined = simple.get(tagPos.tag.toString())\n const val: string | null = this.stringAtPosition(i) ?? ''\n // [0] 8 (BeginString) = FIX4.4\n const token = field ? getToken(field, val, i - segment.startPosition, count, tagPos) : `[${i}] ${tagPos.tag} (unknown) = ${val}, `\n buffer.writeString(token)\n }\n\n return buffer.toString()\n }\n}\n"]}
1
+ {"version":3,"file":"msg-view.js","sourceRoot":"","sources":["../../src/buffer/msg-view.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAWtC,8CAAyC;AAEzC,qDAAgD;AAGhD,yEAAmE;AAEnE,MAAsB,OAAO;IAK3B,YAAuC,WAA2B,EAAk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ACV,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,SAAS,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACnB,IAAI,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAA;QAC5C,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,GAAG,GAAG,EAAE,CAAA;QACjB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,GAAG,GAAG,EAAE,CAAA;QACf,IAAI,GAAG,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,SAAiB,CAAA;IACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACpD,SAAS,GAAG,OAAO,CAAA;IACrB,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IACnC,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,OAAO,IAAI,GAAG,SAAS,EAAE,CAAA;AAC3D,CAAC,AAxBuB,CAwBvB","sourcesContent":["import { TagPos } from './tag/tag-pos'\nimport { SegmentDescription } from './segment/segment-description'\nimport { Structure } from './structure'\nimport { Tags } from './tag/tags'\nimport {\n ContainedComponentField,\n ContainedField,\n IContainedSet,\n ContainedGroupField,\n ContainedSimpleField\n} from '../dictionary/contained'\nimport { SetReduce } from '../dictionary'\nimport { ILooseObject } from '../collections/collection'\nimport { ElasticBuffer } from './elastic-buffer'\nimport { FixDefinitions, GroupFieldDefinition, SimpleFieldDefinition } from '../dictionary/definition'\nimport { ITypeDispatcher } from '../dictionary/type-dispatcher'\nimport { ContainedSetType } from '../dictionary/contained-set-type'\n\nexport abstract class MsgView {\n protected sortedTagPosForwards: TagPos[]\n protected sortedTagPosBackwards: TagPos[]\n private readonly reducer: SetReduce<ILooseObject> = new SetReduce<ILooseObject>()\n\n protected constructor (public readonly definitions: FixDefinitions, public readonly segment: SegmentDescription, public readonly structure: Structure | null) {\n }\n\n protected static asVerbose = (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos): string => {\n const newLine = require('os').EOL\n let desc: string\n let name: string\n if (field) {\n name = field.name || 'unknown'\n if (field.isEnum()) {\n desc = `${val}[${field.resolveEnum(val)}]${newLine}\\t${field.description ?? ''}${newLine}${newLine}`\n } else {\n desc = `${val}${newLine}t${field.description ?? ''}${newLine}${newLine}`\n }\n } else {\n name = 'unknown'\n desc = 'na'\n }\n return `[${i}] ${tp.tag} (${name}) = ${desc}`\n }\n\n protected static asToken = (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos): string => {\n const perLine: number = 2\n const newLine = require('os').EOL\n // [280] 814 (ApplQueueResolution) = 2[OverlayLast][281] 10 (CheckSum) = 80\n let desc: string\n let name: string\n if (field) {\n name = field.name || 'unknown'\n if (field.isEnum()) {\n desc = `${val}[${field.resolveEnum(val)}]`\n } else {\n desc = `${val}`\n }\n } else {\n desc = `${val}`\n name = 'unknown'\n }\n let delimiter: string\n if (i === 1 || (i < count && i % perLine - 1 === 0)) {\n delimiter = newLine\n } else {\n delimiter = i < count ? ', ' : ''\n }\n return `[${i}] ${tp.tag} (${name}) = ${desc}${delimiter}`\n }\n\n // return list of any tags parsed that are not valid\n public invalid (): number[] {\n const invalidTags: number[] = []\n const set = this.segment.set\n if (set == null) return []\n const tags = this.structure?.tags ?? null\n if (tags == null) return []\n for (let i = 0; i < tags.nextTagPos; ++i) {\n const tag = tags.tagPos[i].tag\n if (tag <= 0 || !set.containedTag[tag]) {\n invalidTags[invalidTags.length] = tag\n }\n }\n return invalidTags\n }\n\n // list of tags that must be present\n public missing (): number[] {\n if (this.segment == null) return []\n if (this.segment.set == null) return []\n return this.missingRequired(this.segment.set, [])\n }\n\n /**\n * does this view contain this tag\n * @param tagOrName the name or tag of field to check 8 or BeginString\n */\n public contains (tagOrName: number | string): boolean {\n const tag: number = this.resolveTag(tagOrName)\n const position: number = this.getPosition(tag)\n return position >= 0\n }\n\n /**\n * if this view represents a repeated group then return a sub view representing\n * this instance of repeated group.\n * @param i the index to return i.e. 0 is first within repeated group\n */\n public getGroupInstance (i: number): MsgView | null {\n const instance: SegmentDescription | null = this.segment?.getInstance(i)\n if (!instance) {\n return null\n }\n return this.create(instance)\n }\n\n public getUndefined (): SegmentDescription | SegmentDescription[] | null {\n return this.structure?.layout['.undefined']\n }\n\n public undefinedForMsg (): string | null {\n let msg: string | null = null\n const undefinedTags = this.getUndefined()\n if (undefinedTags) {\n if (Array.isArray(undefinedTags)) {\n msg = 'undefined tags = ' + undefinedTags.map((e: SegmentDescription) => e.startTag.toString()).join(', ')\n } else {\n msg = `undefined tag = ${undefinedTags.startTag}`\n }\n }\n return msg\n }\n\n /**\n * if this view represents a repeated group then return number\n * of repeated instances within this view\n */\n public groupCount (): number {\n const positions = this.segment.delimiterPositions\n return positions ? positions.length : 0\n }\n\n /**\n * regardless of how this type is represented in data dictionary,\n * return its value as a string.\n * @param tagOrName name or tag to return 8 or BeginString\n */\n public getString (tagOrName: number | string): string | null {\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const position: number = this.getPosition(tag)\n if (position < 0) {\n return null\n }\n return this.stringAtPosition(position)\n }\n\n /**\n * for a repeated group, one field may be repeted across each instance of a component\n * return all values for a specified field as array of strings\n * @param tagOrName the name of the repeated field to fetch\n */\n public getStrings (tagOrName: number | string | null = null): Array<(string | null)> | null {\n if (!tagOrName) {\n return this.allStrings()\n }\n tagOrName = tagOrName || -1\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const positions: number[] = this.getPositions(tag)\n if (positions == null) {\n return null\n }\n return positions.map((position: number) => {\n return this.stringAtPosition(position)\n })\n }\n\n /**\n * returns typed value of a sinple field within this view\n * @param tagOrName the name or tag of required field e.g. 8, BeginString\n */\n public getTyped (tagOrName: number | string): (boolean | string | number | Date | Buffer | null) {\n const tag: number = this.resolveTag(tagOrName)\n if (tag == null) {\n return null\n }\n const field: SimpleFieldDefinition | null = this.definitions.tagToSimple[tag] ?? null\n if (field == null) {\n return null\n }\n return this.toTyped(field)\n }\n\n /**\n * use a varargs list of tags or tag names to fetch typed values for those fields within this view.\n * @param tagOrNames list of tags e.g. 'BeginString', 'BodyLength', ...\n */\n public getTypedList (...tagOrNames: Array<number | string>): Array<boolean | string | number | Date | Buffer | null> {\n return tagOrNames.map((s) => this.getTyped(s))\n }\n\n /**\n * use an array of tags or tag names to fetch typed values for those fields within this view.\n * @param tagOrName the list of params as array ['BeginString','BodyLength', 'MsgType']\n */\n public getTypedTags (tagOrName: Array<string | number>): Array<boolean | string | number | Date | Buffer | null> {\n return tagOrName.map((s) => this.getTyped(s))\n }\n\n /**\n * produce an object representation of the view which when coupled with its\n * interface (generated against the same dictionary source) will allow easy\n * navigation of the object where a group is resolved to an array and simple\n * fields are properties. This is relatively expensive operation as every\n * field is fully resolved regardless of depth i.e. all groups and compoennts\n * are fully resolved.\n */\n public toObject (): ILooseObject | ILooseObject[] | null {\n const segment: SegmentDescription = this.segment\n if (segment.set == null) return null\n if (segment.delimiterTag) {\n switch (segment.set.type) {\n case ContainedSetType.Group: {\n return this.asInstances((segment.set as GroupFieldDefinition).name)\n }\n case ContainedSetType.Msg: {\n // this is a batch of messages\n const hdrView = this.getView('Hdr')\n const batch: ILooseObject = {}\n if (hdrView) {\n const name = hdrView.segment.set?.name ?? 'na'\n batch[name] = hdrView.toObject()\n }\n batch[segment.name] = this.asInstances(segment.name)\n return batch\n }\n }\n }\n return this.asLoose(segment.set)\n }\n\n /**\n * easy human-readable format showing each field, its position, value and resolved\n * enum.\n */\n public toString (): string {\n return this.stringify(MsgView.asToken)\n }\n\n public toVerbose (): string {\n return this.stringify(MsgView.asVerbose)\n }\n\n /**\n * a string in JSON format representing this view as an object\n */\n public toJson (): string {\n return JSON.stringify(this.toObject(), null, 4)\n }\n\n /**\n * fetch a nested view, either by a single name - getView('Instrument') - or by a\n * dotted path walked a step at a time - getView('Parties.PtysSubGrp')\n */\n public getView (name: string): MsgView | null {\n // the dotted form is the exception. resolve a plain name without paying for\n // the parts array and the closure a split and reduce would allocate - the\n // component walk in toObject and validate comes through here per component.\n if (!name.includes('.')) {\n return this.resolveChild(name)\n }\n let view: MsgView | null = this\n for (const part of name.split('.')) {\n view = view.resolveChild(part)\n if (!view) {\n return null\n }\n }\n return view\n }\n\n /**\n * resolve one step of a view path against this view\n */\n private resolveChild (name: string): MsgView | null {\n const structure = this.structure\n const singleton: SegmentDescription | null = structure?.firstContainedWithin(name, this.segment) ?? null\n if (singleton) {\n return this.create(singleton)\n }\n // is this a full name where abbreviation exists\n const component: ContainedField | null = this.segment.set?.localNameToField.get(name) ?? null\n\n if (component) {\n const abbreviated: SegmentDescription | null = structure?.firstContainedWithin(component.name, this.segment) ?? null\n if (abbreviated) {\n return this.create(abbreviated)\n }\n }\n return null\n }\n\n public abstract checksum (): number\n\n public abstract clone (): MsgView\n\n protected abstract create (singleton: SegmentDescription): MsgView\n\n protected abstract stringAtPosition (position: number): string | null\n\n protected abstract toTyped (field: SimpleFieldDefinition): boolean | string | number | Date | Buffer | null\n\n protected resolveTag (tagOrName: number | string): number {\n let tag: number\n const set = this.segment.set\n if (typeof (tagOrName) === 'string') {\n if (set == null) return 0\n const cf = set.simple.get(tagOrName)\n const f: SimpleFieldDefinition | null = cf ? cf.definition : this.definitions.simple.get(tagOrName) ?? null\n if (f == null) {\n return -1\n }\n tag = f.tag\n } else {\n tag = tagOrName\n }\n return tag\n }\n\n // fetch all positions of a particular tag.\n protected getPositions (tag: number): number[] {\n const forwards: TagPos[] = this.sortedTagPosForwards\n const backwards: TagPos[] = this.sortedTagPosBackwards\n const position: number = this.binarySearch(tag)\n if (position < 0) {\n return []\n }\n\n const count: number = forwards.length\n const last: number = count - 1\n let end: number = position\n while (end <= last) {\n if (tag !== forwards[end].tag) {\n break\n }\n ++end\n }\n // avoid backtracking over an array by scan forwards on a reversed copy\n let start: number = last - position\n while (start <= last) {\n if (tag !== backwards[start].tag) {\n break\n }\n ++start\n }\n const begin: number = last - (start - 1)\n const len: number = end - begin\n const positions: number[] = new Array(len)\n for (let i: number = begin; i < end; ++i) {\n positions[i - begin] = forwards[i].position\n }\n return positions\n }\n\n protected getPosition (tag: number): number {\n const pos: number = this.binarySearch(tag)\n if (pos >= 0) {\n return this.sortedTagPosForwards[pos].position\n } else {\n return -1\n }\n }\n\n private allStrings (): Array<(string | null)> {\n const segment: SegmentDescription = this.segment\n const range: number[] = []\n if (segment.segmentView) {\n for (const tp of segment.segmentView.tags) {\n range[range.length] = tp.position\n }\n } else {\n for (let i: number = segment.startPosition; i <= segment.endPosition; ++i) {\n range[range.length] = i\n }\n }\n return range.map((i: number) => this.stringAtPosition(i))\n }\n\n private asInstances (name: string): Array<ILooseObject | null> | null {\n const groupView: MsgView | null = this.getView(name)\n if (groupView == null) {\n return null\n }\n const groupArray = new Array<ILooseObject | null>(groupView.groupCount())\n const count: number = groupView.groupCount()\n for (let j: number = 0; j < count; ++j) {\n const instance: MsgView | null = groupView.getGroupInstance(j)\n groupArray[j] = instance?.toObject() ?? null\n }\n return groupArray\n }\n\n private asLoose (def: IContainedSet): ILooseObject {\n\n return this.reducer.reduce(def, {\n group: (a: ILooseObject, field: ContainedGroupField) => { this.asLooseGroup(a, field) },\n simple: (a: ILooseObject, field: ContainedSimpleField) => { this.asLooseSimple(a, field) },\n component: (a: ILooseObject, field: ContainedComponentField) => { this.asLooseComponent(a, field) }\n }, def.localAttribute.reduce<ILooseObject>((a: ILooseObject, sf: ContainedSimpleField) => {\n const def = sf.definition\n const position: number = this.getPosition(def.tag)\n if (position >= 0) {\n a[def.name] = this.toTyped(def)\n }\n return a\n }, {}))\n }\n\n private missingRequired (def: IContainedSet, tags: number []): number[] {\n const reducer = new SetReduce<number[]>()\n const dispatcher: ITypeDispatcher<number[]> = {\n group: (a: number[], field: ContainedGroupField) => { this.missingGroup(def, field, a) },\n simple: (a: number[], field: ContainedSimpleField) => { this.missingSimple(field, a) },\n component: (a: number[], field: ContainedComponentField) => { this.missingComponent(field, a) }\n }\n return reducer.reduce(def, dispatcher, tags)\n }\n\n private missingSimple (sf: ContainedSimpleField, a: number[]): void {\n if (sf.required && this.getPosition(sf.definition.tag) < 0) {\n a.push(sf.definition.tag)\n }\n }\n\n private missingComponent (cf: ContainedComponentField, a: number[]): void {\n const view: MsgView | null = this.getView(cf.name)\n if (view) {\n view.missingRequired(cf.definition, a)\n }\n }\n\n private missingGroup (def: IContainedSet, gf: ContainedGroupField, tags: number []): void {\n const name = gf.definition.noOfField ? gf.definition.noOfField.name : def.name\n const groupView: MsgView | null = this.getView(name) ?? this.getView(gf.definition.name)\n if (groupView == null) {\n return\n }\n const count: number = groupView.groupCount()\n for (let j: number = 0; j < count; ++j) {\n const instance: MsgView | null = groupView.getGroupInstance(j)\n instance?.missingRequired(gf.definition, tags)\n }\n }\n\n private asLooseComponent (a: ILooseObject, cf: ContainedComponentField): void {\n const view: MsgView | null = this.getView(cf.name)\n if (view) {\n const component = view.toObject()\n if (component) {\n a[cf.definition.name] = component\n }\n }\n }\n\n private asLooseSimple (a: ILooseObject, sf: ContainedSimpleField): void {\n const def = sf.definition\n const position: number = this.getPosition(def.tag)\n if (position >= 0) {\n const asSimple: boolean | string | number | Date | Buffer | null = this.toTyped(def)\n if (asSimple != null) { // beware, may be false value\n a[sf.name] = asSimple\n }\n }\n }\n\n private asLooseGroup (a: ILooseObject, gf: ContainedGroupField): void {\n const def = gf.definition\n const name = def.noOfField ? def.noOfField.name : def.name\n const instances: ILooseObject | null = this.asInstances(name) ?? this.asInstances(def.name)\n if (instances) {\n a[def.name] = instances\n }\n }\n\n private binarySearch (tag: number): number {\n if (this.structure == null) return -1\n let forwards = this.sortedTagPosForwards\n if (!forwards) {\n const segment = this.segment\n if (segment.segmentView) {\n // fragmented component: use the collected tags from SegmentView\n forwards = this.sortedTagPosForwards = segment.segmentView.tags.slice()\n forwards.sort(TagPos.compare)\n } else {\n forwards = this.sortedTagPosForwards = this.structure.tags.tagPos.slice(segment.startPosition, segment.endPosition + 1)\n forwards.sort(TagPos.compare)\n }\n this.sortedTagPosBackwards = forwards.slice().reverse()\n }\n return TagPos.binarySearch(forwards, tag)\n }\n\n private stringify (getToken: (field: SimpleFieldDefinition, val: string, i: number, count: number, tp: TagPos) => string): string {\n const structure = this.structure\n const buffer: ElasticBuffer = new ElasticBuffer()\n const segment: SegmentDescription = this.segment\n if (structure == null) return ''\n const tags: Tags = structure.tags\n const count: number = segment.endPosition - segment.startPosition\n const simple: Map<string, SimpleFieldDefinition> = this.definitions.simple\n\n for (let i: number = segment.startPosition; i <= segment.endPosition; ++i) {\n const tagPos: TagPos = tags.tagPos[i]\n const field: SimpleFieldDefinition | undefined = simple.get(tagPos.tag.toString())\n const val: string | null = this.stringAtPosition(i) ?? ''\n // [0] 8 (BeginString) = FIX4.4\n const token = field ? getToken(field, val, i - segment.startPosition, count, tagPos) : `[${i}] ${tagPos.tag} (unknown) = ${val}, `\n buffer.writeString(token)\n }\n\n return buffer.toString()\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"winston-logger.js","sourceRoot":"","sources":["../../src/config/winston-logger.ts"],"names":[],"mappings":";;;AAEA,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAC/D,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;AAE7C,MAAa,aAAa;IAWxB,YAA6B,UAAe,aAAa,CAAC,cAAc,EAAE;QAA7C,YAAO,GAAP,OAAO,CAAsC;QACxE,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IAEM,MAAM,CAAC,cAAc,CAAE,QAAgB,OAAO;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;YACxB,CAAC;YACD,KAAK,EAAE;YAEP,CAAC;SACc,CAAA;IACnB,CAAC;IAEM,IAAI,CAAE,IAAY;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAA;QAC7B,OAAO;YACL,IAAI,EAAE,UAAU,GAAW;gBACzB,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI;oBACJ,OAAO,EAAE,GAAG;iBACb,CAAC,CAAA;YACJ,CAAC;YACD,KAAK,EAAE,UAAU,GAAW;gBAC1B,MAAM,CAAC,KAAK,CAAC;oBACX,IAAI;oBACJ,OAAO,EAAE,GAAG;iBACb,CAAC,CAAA;YACJ,CAAC;YACD,OAAO,EAAE,UAAU,GAAW;gBAC5B,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI;oBACJ,OAAO,EAAE,GAAG;iBACb,CAAC,CAAA;YACJ,CAAC;YACD,KAAK,EAAE,UAAU,CAAQ;gBACvB,MAAM,CAAC,KAAK,CAAC;oBACX,IAAI;oBACJ,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,KAAK,EAAE;iBACrC,CAAC,CAAA;YACJ,CAAC;SACc,CAAA;IACnB,CAAC;;AA3GH,sCA4GC;AA3GwB,uBAAS,GAAG,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE;IACtD,OAAO,GAAG,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;AAC1E,CAAC,CAAC,CAAA;AAEqB,yBAAW,GAAG,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE;IACxD,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAC,CAAA","sourcesContent":["import { IJsFixLogger } from './js-fix-logger'\nimport { Logger } from 'winston'\nconst { createLogger, format, transports } = require('winston')\nconst { combine, timestamp, printf } = format\n\nexport class WinstonLogger {\n public static readonly appFormat = printf((info: any) => {\n return `${info.timestamp} [${info.type}] ${info.level}: ${info.message}`\n })\n\n public static readonly plainFormat = printf((info: any) => {\n return `${info.message}`\n })\n\n private readonly appLogger: Logger\n\n constructor (public readonly options: any = WinstonLogger.consoleOptions()) {\n this.appLogger = createLogger(options)\n }\n\n public static consoleOptions (level: string = 'debug'): any {\n return {\n format: combine(\n timestamp(),\n WinstonLogger.appFormat\n ),\n level,\n transports: [\n new transports.Console()\n ]\n }\n }\n\n public static fileOptions (fileName: string, level: string = 'debug', maxSize: number = 50 * 1024 * 1024, format: any = combine(\n timestamp(),\n WinstonLogger.appFormat\n )): any {\n return {\n format,\n level,\n transports: [\n new transports.File({\n filename: fileName,\n maxsize: maxSize\n })\n ]\n }\n }\n\n public plain (fileName: string, maxSize: number = 10 * 1024 * 1024): IJsFixLogger {\n const txtLogger: Logger = createLogger({\n format: WinstonLogger.plainFormat,\n level: 'info',\n transports: [\n new transports.File({\n filename: fileName,\n maxsize: maxSize\n })\n ]\n })\n\n return {\n log: function (txt: string) {\n txtLogger.info({\n type: 'info',\n message: txt\n })\n },\n\n info: function (msg: string): void {\n (this as any).log(msg)\n },\n debug: function (msg: string): void {\n (this as any).log(msg)\n },\n warning: function (msg: string): void {\n (this as any).log(msg)\n },\n error: function (): void {\n // nothing\n }\n } as IJsFixLogger\n }\n\n public make (type: string): IJsFixLogger {\n const logger = this.appLogger\n return {\n info: function (msg: string): void {\n logger.info({\n type,\n message: msg\n })\n },\n debug: function (msg: string): void {\n logger.debug({\n type,\n message: msg\n })\n },\n warning: function (msg: string): void {\n logger.warn({\n type,\n message: msg\n })\n },\n error: function (e: Error): void {\n logger.error({\n type,\n message: `${e.message} : ${e.stack}`\n })\n }\n } as IJsFixLogger\n }\n}\n"]}
1
+ {"version":3,"file":"winston-logger.js","sourceRoot":"","sources":["../../src/config/winston-logger.ts"],"names":[],"mappings":";;;AAEA,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAA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AAC,CAAC,CAAA;AAEqB,yBAAW,GAAG,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE;IACxD,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAC,CAAA","sourcesContent":["import { IJsFixLogger } from './js-fix-logger'\nimport { Logger } from 'winston'\nconst { createLogger, format, transports } = require('winston')\nconst { combine, timestamp, printf } = format\n\nexport class WinstonLogger {\n public static readonly appFormat = printf((info: any) => {\n return `${info.timestamp} [${info.type}] ${info.level}: ${info.message}`\n })\n\n public static readonly plainFormat = printf((info: any) => {\n return `${info.message}`\n })\n\n private readonly appLogger: Logger\n\n constructor (public readonly options: any = WinstonLogger.consoleOptions()) {\n this.appLogger = createLogger(options)\n }\n\n public static consoleOptions (level: string = 'debug'): any {\n return {\n format: combine(\n timestamp(),\n WinstonLogger.appFormat\n ),\n level,\n transports: [\n new transports.Console()\n ]\n }\n }\n\n public static fileOptions (fileName: string, level: string = 'debug', maxSize: number = 50 * 1024 * 1024, format: any = combine(\n timestamp(),\n WinstonLogger.appFormat\n )): any {\n return {\n format,\n level,\n transports: [\n new transports.File({\n filename: fileName,\n maxsize: maxSize\n })\n ]\n }\n }\n\n public plain (fileName: string, maxSize: number = 10 * 1024 * 1024): IJsFixLogger {\n const txtLogger: Logger = createLogger({\n format: WinstonLogger.plainFormat,\n level: 'info',\n transports: [\n new transports.File({\n filename: fileName,\n maxsize: maxSize\n })\n ]\n })\n\n return {\n log: function (txt: string) {\n txtLogger.info({\n type: 'info',\n message: txt\n })\n },\n\n info: function (msg: string): void {\n (this as any).log(msg)\n },\n debug: function (msg: string): void {\n (this as any).log(msg)\n },\n warning: function (msg: string): void {\n (this as any).log(msg)\n },\n error: function (): void {\n // nothing\n }\n } as IJsFixLogger\n }\n\n public make (type: string): IJsFixLogger {\n const logger = this.appLogger\n return {\n info: function (msg: string): void {\n logger.info({\n type,\n message: msg\n })\n },\n debug: function (msg: string): void {\n logger.debug({\n type,\n message: msg\n })\n },\n warning: function (msg: string): void {\n logger.warn({\n type,\n message: msg\n })\n },\n error: function (e: Error): void {\n logger.error({\n type,\n message: `${e.message} : ${e.stack}`\n })\n }\n }\n }\n}\n"]}
@@ -40,8 +40,8 @@ class StandardSnippet {
40
40
  this.settings = settings;
41
41
  }
42
42
  static rhsJustify(txt, width) {
43
- const align = require('align-text');
44
- return align(txt, width);
43
+ const pad = ' '.repeat(Math.max(0, width));
44
+ return txt.split(/\r\n|\n/).map(line => pad + line).join('\n');
45
45
  }
46
46
  import(name, isMsg, indent) {
47
47
  const spaces = this.spaces(indent);
@@ -1 +1 @@
1
- {"version":3,"file":"standard-snippet.js","sourceRoot":"","sources":["../../../src/dictionary/compiler/standard-snippet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA2B;AAE3B,MAAa,eAAe;IAC1B,YAA6B,QAA2B;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IACxD,CAAC;IAEO,MAAM,CAAC,UAAU,CAAE,GAAW,EAAE,KAAa;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;QACnC,OAAO,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IAGM,MAAM,CAAE,IAAY,EAAE,KAAc,EAAE,MAAc;QACzD,MAAM,MAAM,GAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAA;QAC1D,OAAO,GAAG,MAAM,aAAa,IAAI,YAAY,IAAI,GAAG,CAAA;IACtD,CAAC;IAEM,SAAS,CAAE,IAAY,EAAE,MAAc;QAC5C,MAAM,MAAM,GAAW,IAAI,CAAC,MAAM,CAAC,MAAM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C,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;QACzD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QAC1C,MAAM,OAAO,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;QACzC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,IAAY;YACtC,IAAI,GAAG,IAAI,IAAI,GAAG,CAAA;YAClB,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAA;YAC9B,OAAO,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;QAC5C,CAAC,CAAC,CAAA;QACF,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACjD,MAAM,MAAM,GAAW,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1C,OAAO,KAAK,GAAG,OAAO;YACpB,MAAM;YACN,OAAO;YACP,KAAK,CAAA;IACT,CAAC;IAEO,OAAO,CAAE,GAAa;QAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA1GD,0CA0GC","sourcesContent":["import { ICompilerSettings } from './compiler-settings'\nimport * as _ from 'lodash'\n\nexport class StandardSnippet {\n constructor (public readonly settings: ICompilerSettings) {\n }\n\n private static rhsJustify (txt: string, width: number): string {\n const align = require('align-text')\n return align(txt, width)\n }\n\n // import { camelName } from './component/name_underscore'\n public import (name: string, isMsg: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n const fileName = _.snakeCase(name)\n const path = isMsg ? `./set/${fileName}` : `./${fileName}`\n return `${spaces}import { I${name} } from '${path}'`\n }\n\n public interface (name: string, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}export interface I${name}`\n }\n\n public startBlockComment (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}/*`\n }\n\n public endBlockComment (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}*/`\n }\n\n public startBlock (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}{`\n }\n\n public endBlock (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}}`\n }\n\n public group (name: string, type: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: I${type}[]`\n }\n\n public component (name: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: I${name}`\n }\n\n public simple (name: string, type: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: ${type}`\n }\n\n public enum (name: string, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `export ${spaces}enum ${name}`\n }\n\n public enumValue (name: string, val: any, indent: number): string {\n const spaces: string = this.spaces(indent)\n if (typeof (val) === 'string') {\n return `${spaces}${name} = '${val}'`\n }\n return `${spaces}${name} = ${val}`\n }\n\n public spaces (indent: number): string {\n return ' '.repeat(this.settings.spaces * indent)\n }\n\n public commentLine (line: string, justify: number): string {\n return StandardSnippet.rhsJustify(`// ${line}`, justify)\n }\n\n public commentBox (str: string): string {\n const wrap = require('word-wrap')\n const text = wrap(str, {\n width: 60,\n indent: ' '\n }\n )\n let lines = text.split('\\n').map((a: string) => a.trim())\n const max = this.longest(lines).length + 2\n const newLine: string = require('os').EOL\n lines = lines.map(function (line: string) {\n line = ` ${line} `\n const diff = max - line.length\n return '*' + line + ' '.repeat(diff) + '*'\n })\n const stars: string = '*'.repeat(lines[0].length)\n const joined: string = lines.join(newLine)\n return stars + newLine +\n joined +\n newLine +\n stars\n }\n\n private longest (arr: string[]): string {\n return arr.reduce(function (a, b) {\n return a.length > b.length ? a : b\n })\n }\n}\n"]}
1
+ {"version":3,"file":"standard-snippet.js","sourceRoot":"","sources":["../../../src/dictionary/compiler/standard-snippet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA2B;AAE3B,MAAa,eAAe;IAC1B,YAA6B,QAA2B;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IACxD,CAAC;IAEO,MAAM,CAAC,UAAU,CAAE,GAAW,EAAE,KAAa;QACnD,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;QAC1C,OAAO,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChE,CAAC;IAGM,MAAM,CAAE,IAAY,EAAE,KAAc,EAAE,MAAc;QACzD,MAAM,MAAM,GAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAA;QAC1D,OAAO,GAAG,MAAM,aAAa,IAAI,YAAY,IAAI,GAAG,CAAA;IACtD,CAAC;IAEM,SAAS,CAAE,IAAY,EAAE,MAAc;QAC5C,MAAM,MAAM,GAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,OAAO,GAAG,MAAM,qBAAqB,IAAI,EAAE,CAAA;IAC7C,CAAC;IAEM,iBAAiB,CAAE,MAAc;QACtC,MAAM,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CAAC,CAAA;QAC1C,MAAM,OAAO,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAA;QACzC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,IAAY;YACtC,IAAI,GAAG,IAAI,IAAI,GAAG,CAAA;YAClB,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAA;YAC9B,OAAO,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;QAC5C,CAAC,CAAC,CAAA;QACF,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACjD,MAAM,MAAM,GAAW,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1C,OAAO,KAAK,GAAG,OAAO;YACpB,MAAM;YACN,OAAO;YACP,KAAK,CAAA;IACT,CAAC;IAEO,OAAO,CAAE,GAAa;QAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA1GD,0CA0GC","sourcesContent":["import { ICompilerSettings } from './compiler-settings'\nimport * as _ from 'lodash'\n\nexport class StandardSnippet {\n constructor (public readonly settings: ICompilerSettings) {\n }\n\n private static rhsJustify (txt: string, width: number): string {\n const pad = ' '.repeat(Math.max(0, width))\n return txt.split(/\\r\\n|\\n/).map(line => pad + line).join('\\n')\n }\n\n // import { camelName } from './component/name_underscore'\n public import (name: string, isMsg: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n const fileName = _.snakeCase(name)\n const path = isMsg ? `./set/${fileName}` : `./${fileName}`\n return `${spaces}import { I${name} } from '${path}'`\n }\n\n public interface (name: string, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}export interface I${name}`\n }\n\n public startBlockComment (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}/*`\n }\n\n public endBlockComment (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}*/`\n }\n\n public startBlock (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}{`\n }\n\n public endBlock (indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}}`\n }\n\n public group (name: string, type: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: I${type}[]`\n }\n\n public component (name: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: I${name}`\n }\n\n public simple (name: string, type: string, required: boolean, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `${spaces}${name}${required ? '' : '?'}: ${type}`\n }\n\n public enum (name: string, indent: number): string {\n const spaces: string = this.spaces(indent)\n return `export ${spaces}enum ${name}`\n }\n\n public enumValue (name: string, val: any, indent: number): string {\n const spaces: string = this.spaces(indent)\n if (typeof (val) === 'string') {\n return `${spaces}${name} = '${val}'`\n }\n return `${spaces}${name} = ${val}`\n }\n\n public spaces (indent: number): string {\n return ' '.repeat(this.settings.spaces * indent)\n }\n\n public commentLine (line: string, justify: number): string {\n return StandardSnippet.rhsJustify(`// ${line}`, justify)\n }\n\n public commentBox (str: string): string {\n const wrap = require('word-wrap')\n const text = wrap(str, {\n width: 60,\n indent: ' '\n }\n )\n let lines = text.split('\\n').map((a: string) => a.trim())\n const max = this.longest(lines).length + 2\n const newLine: string = require('os').EOL\n lines = lines.map(function (line: string) {\n line = ` ${line} `\n const diff = max - line.length\n return '*' + line + ' '.repeat(diff) + '*'\n })\n const stars: string = '*'.repeat(lines[0].length)\n const joined: string = lines.join(newLine)\n return stars + newLine +\n joined +\n newLine +\n stars\n }\n\n private longest (arr: string[]): string {\n return arr.reduce(function (a, b) {\n return a.length > b.length ? a : b\n })\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"components-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/components-parser.ts"],"names":[],"mappings":";;;AACA,6CAAwC;AACxC,+CAOwB;AACxB,iDAKyB;AAEzB,MAAa,gBAAiB,SAAQ,sBAAS;IAY7C,YAAoC,WAA2B;QAC7D,KAAK,CAAC,WAAW,CAAC,CAAA;QADgB,gBAAW,GAAX,WAAW,CAAgB;QAX9C,oBAAe,GAAiC,IAAI,GAAG,EAA2B,CAAA;QAClF,WAAM,GAAwB,IAAI,GAAG,EAAkB,CAAA;QACvD,oBAAe,GAAe,EAAE,CAAA;QAChC,iBAAY,GAA8B,IAAI,GAAG,EAAwB,CAAA;QAIzE,+BAA0B,GAAsB,EAAE,CAAA;IAMnE,CAAC;IAEO,MAAM,CAAC,OAAO,CAAE,KAA2B,EAAE,cAA6C,EAAE,IAAkB;QACpH,IAAI,IAAY,CAAA;QAChB,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,EAAE,CAAC;YAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAC1B,CAAC;aAAM,IAAI,KAAK,EAAE,CAAC;YACjB,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACnB,CAAC;aAAM,IAAI,cAAc,EAAE,CAAC;YAC1B,IAAI,GAAG,cAAc,CAAC,IAAI,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,KAAK,CAAE,IAAY,EAAE,CAAS,EAAE,CAAS;;QAE9C,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,kBAAkB,CAAC,CAAC,CAAC;gBACxB,IAAI,MAAA,IAAI,CAAC,kBAAkB,0CAAE,UAAU,EAAE,CAAC;oBACxC,IAAI,CAAC,kBAAkB,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ClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAW,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;YACpC,MAAM,SAAS,GAAyC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACzF,IAAI,SAAS,EAAE,CAAC;gBACd,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAjcD,4CAicC","sourcesContent":["import { ISaxNode } from '../../sax-node'\nimport { XsdParser } from './xsd-parser'\nimport {\n ContainedGroupField,\n IContainedSet,\n ContainedSetBuilder,\n ContainedComponentField,\n ContainedSimpleField,\n ContainedField\n} from '../../contained'\nimport {\n MessageDefinition,\n FixDefinitions,\n GroupFieldDefinition,\n ComponentFieldDefinition\n} from '../../definition'\n\nexport class ComponentsParser extends XsdParser {\n private readonly attributeGroups: Map<string, IAttributeGroup> = new Map<string, IAttributeGroup>()\n private readonly groups: Map<string, IGroup> = new Map<string, IGroup>()\n private readonly unboundElements: IElement[] = []\n private readonly complexTypes: Map<string, IComplexType> = new Map<string, IComplexType>()\n\n private newComplexTypes: IComplexType[]\n private currentGroup: (IGroup | null)\n private readonly currentAttributeGroupStack: IAttributeGroup[] = []\n private currentComplexType: (IComplexType | null)\n private previousComplexType: IComplexType\n\n public constructor (public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n private static getName (group: (IGroup | undefined), attributeGroup: (IAttributeGroup | undefined), type: IComplexType): string {\n let name: string\n if (type?.appInfo) {\n name = type.appInfo.name\n } else if (group) {\n name = group.name\n } else if (attributeGroup) {\n name = attributeGroup.name\n } else {\n name = type.name\n }\n return name\n }\n\n public value (line: number, n: string, v: string): void {\n // do nothing\n switch (n) {\n case 'xs:documentation': {\n if (this.currentComplexType?.annotation) {\n this.currentComplexType.annotation.documentation = v\n }\n break\n }\n }\n this.pending = null\n }\n\n public close (line: number, node: string): void {\n switch (node) {\n case 'xs:complexType': {\n if (this.currentComplexType != null) {\n const complex: IComplexType = this.currentComplexType\n this.previousComplexType = complex\n this.complexTypes.set(complex.name, complex)\n this.newComplexTypes.push(complex)\n this.currentComplexType = null\n }\n break\n }\n\n case 'xs:group': {\n if (this.currentGroup) {\n this.groups.set(this.currentGroup.name, this.currentGroup)\n this.currentGroup = null\n }\n break\n }\n\n case 'xs:attributeGroup': {\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (attributeStack.length > 0) {\n const group: IAttributeGroup | undefined = attributeStack.pop()\n if (group?.name) {\n this.attributeGroups.set(group?.name, group)\n }\n }\n break\n }\n\n case 'xs:schema': {\n this.insertFields()\n break\n }\n }\n }\n\n public open (line: number, node: ISaxNode): void {\n switch (node.name) {\n case 'xs:schema': {\n this.newComplexTypes = []\n break\n }\n\n case 'xs:group': {\n this.xsGroup(node)\n break\n }\n\n case 'xs:attributeGroup': {\n this.xsAttributeGroup(node)\n break\n }\n\n case 'xs:element': {\n this.xsElement(node)\n break\n }\n\n case 'xs:appinfo': {\n if (this.currentComplexType) {\n this.currentComplexType.appInfo = {} as IAppInfo\n }\n break\n }\n\n case 'xs:attribute': {\n this.xsAttribute(node)\n break\n }\n\n case 'xs:complexType': {\n const unbound: IElement[] = this.unboundElements\n this.currentComplexType = {\n name: node.attributes.name || unbound[unbound.length - 1].name\n } as IComplexType\n break\n }\n\n case 'xs:extension': {\n const current: IComplexType | null = this.currentComplexType\n if (current && node.attributes.base) {\n current.extensionBase = node.attributes.base\n }\n break\n }\n\n case 'fm:Xref': {\n this.assign(node, this.currentComplexType?.appInfo)\n break\n }\n\n case 'xs:annotation': {\n if (this.currentComplexType) {\n this.currentComplexType.annotation = {} as IAnnotation\n }\n break\n }\n\n case 'xs:documentation': {\n if (this.currentComplexType) {\n this.pending = node.name\n }\n break\n }\n }\n }\n\n private xsAttribute (node: ISaxNode): void {\n const attribute: IAttribute = {} as IAttribute\n this.assign(node, attribute)\n const stack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (stack.length > 0) {\n const peek: IAttributeGroup = stack[stack.length - 1]\n const groupAttributes: IAttribute[] = peek.attributes\n groupAttributes[groupAttributes.length] = attribute\n }\n }\n\n private xsGroup (node: ISaxNode): void {\n if (node.attributes.name) {\n this.currentGroup = {\n name: node.attributes.name,\n elements: [] as IElement[]\n } as IGroup\n } else if (node.attributes.ref) {\n if (this.currentComplexType) {\n this.currentComplexType.group = node.attributes.ref\n } else if (this.currentGroup) {\n // this is part of a sequence for a group\n const elements = this.currentGroup.elements\n elements[elements.length] = {\n type: node.name,\n name: node.attributes.ref\n } as IElement\n }\n }\n }\n\n private xsAttributeGroup (node: ISaxNode): void {\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (node.attributes.name) {\n attributeStack.push({\n name: node.attributes.name,\n attributes: [] as IAttribute[]\n } as IAttributeGroup)\n } else if (node.attributes.ref) {\n if (this.currentComplexType) {\n this.currentComplexType.attributeGroup = node.attributes.ref\n } else if (attributeStack.length > 0) {\n const peek: IAttributeGroup = attributeStack[attributeStack.length - 1]\n peek.attributes[peek.attributes.length] = {\n type: node.name,\n name: node.attributes.ref\n } as IAttribute\n }\n }\n }\n\n private xsElement (node: ISaxNode): void {\n const element: IElement = {} as IElement\n this.assign(node, element)\n const currentComplex: IComplexType | null = this.currentComplexType\n const currentGroup: IGroup | null = this.currentGroup\n if (!currentGroup && currentComplex) {\n if (!currentComplex.element) {\n currentComplex.element = []\n }\n const elements: IElement[] = currentComplex.element\n elements[elements.length] = element\n } else if (currentGroup) {\n const elements: IElement[] = currentGroup.elements\n elements[elements.length] = element\n } else {\n if (element.substitutionGroup && this.previousComplexType) {\n this.previousComplexType.messageName = element.name\n } else {\n this.unboundElements.push(element)\n }\n }\n }\n\n private addElement (set: IContainedSet, element: IElement): void {\n const minOccurs: number = parseInt(element.minOccurs, 10)\n const isGroup: boolean = element.maxOccurs === 'unbounded'\n const isComponent: boolean = element.maxOccurs === '1' || !isGroup\n const key = element.type || element.ref || element.name\n const builder = new ContainedSetBuilder(set)\n const containedType: IComplexType | undefined = this.complexTypes.get(key)\n if (containedType) {\n if (isComponent) {\n const containedDefinition: ComponentFieldDefinition = this.getComponent(containedType)\n const containedField: ContainedComponentField =\n new ContainedComponentField(containedDefinition,\n set.fields.length,\n minOccurs > 0,\n element.name)\n builder.add(containedField)\n } else if (isGroup) {\n const containedDefinition: GroupFieldDefinition = this.getGroup(containedType)\n const containedField: ContainedGroupField =\n new ContainedGroupField(containedDefinition,\n set.fields.length,\n minOccurs > 0,\n element.name)\n builder.add(containedField)\n }\n } else {\n if (key !== 'Message') {\n throw new Error(`cannot resolve component ${key} contained in ${set.name}`)\n }\n }\n }\n\n private addElements (set: IContainedSet, elements: IElement[]): void {\n if (elements) {\n elements.forEach((element: IElement) => {\n switch (element.type) {\n case 'xs:group': {\n const groupElements: IGroup | undefined = this.groups.get(element.name)\n if (groupElements) {\n this.addElements(set, groupElements.elements)\n } else {\n throw new Error(`unable to get xs:group ${element.name}`)\n }\n }\n break\n\n default: {\n this.addElement(set, element)\n }\n }\n })\n }\n }\n\n private addSimpleAttribute (set: IContainedSet, attribute: IAttribute): void {\n let sf = this.definitions.getSimple(attribute.type)\n if (!sf) {\n sf = this.definitions.getSimple(attribute.name, set.category)\n }\n if (sf) {\n const contained: ContainedSimpleField = new ContainedSimpleField(sf,\n set.fields.length,\n attribute.use !== 'optional',\n true,\n attribute.name)\n const builder = new ContainedSetBuilder(set)\n builder.add(contained)\n } else if (set.name !== 'FixmlAttributes') {\n throw new Error(`unable to resolve simple attribute ${attribute.name}`)\n }\n }\n\n private addAttributes (set: IContainedSet, attributes: IAttribute[]): void {\n attributes.forEach((attribute: IAttribute) => {\n switch (attribute.type) {\n case 'xs:attributeGroup': {\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(attribute.name)\n if (attributeGroup) {\n this.addAttributes(set, attributeGroup.attributes)\n } else {\n throw new Error(`unable to get xs:attributeGroup ${attribute.name}`)\n }\n break\n }\n\n default: {\n this.addSimpleAttribute(set, attribute)\n }\n }\n })\n }\n\n private getGroup (type: IComplexType): GroupFieldDefinition {\n const group: IGroup | undefined = this.groups.get(type.group)\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\n const name: string = ComponentsParser.getName(group, attributeGroup, type)\n const category = type.appInfo != null ? type.appInfo.Category : null\n const groupDefinition: GroupFieldDefinition = new GroupFieldDefinition(name, name, category, null, null)\n this.populateSet(type, groupDefinition)\n return groupDefinition\n }\n\n private getComponent (type: IComplexType): ComponentFieldDefinition {\n const definitions: FixDefinitions = this.definitions\n const group: IGroup | undefined = this.groups.get(type.group)\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\n let name: string = ComponentsParser.getName(group, attributeGroup, type)\n const cached: ComponentFieldDefinition | undefined = definitions.component.get(name)\n if (cached) {\n return cached\n }\n\n const category = type.appInfo != null ? type.appInfo.Category : null\n if (type.extensionBase) {\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\n if (base) {\n name = base.appInfo.name\n }\n }\n const component: ComponentFieldDefinition = new ComponentFieldDefinition(name, name, category, null)\n this.populateSet(type, component)\n definitions.component.set(component.name, component)\n definitions.component.set(type.name, component)\n return component\n }\n\n private getMessage (type: IComplexType): MessageDefinition {\n const definitions: FixDefinitions = this.definitions\n const messages = definitions.message\n const name: string = type.appInfo.name\n const message: MessageDefinition = new MessageDefinition(name,\n type.messageName,\n type.appInfo.MsgID,\n type.appInfo.Category,\n type.annotation.documentation)\n const builder = new ContainedSetBuilder(message)\n const abstractMessage: ComponentFieldDefinition | undefined = definitions.component.get('Message')\n abstractMessage?.fields.forEach((f: ContainedField) => {\n builder.add(f)\n })\n this.populateSet(type, message)\n messages.set(message.name, message)\n if (type.messageName && type.messageName !== name) {\n messages.set(type.messageName, message)\n }\n\n return message\n }\n\n private getBaseAttributes (type: IComplexType): (IAttributeGroup | null) {\n const attributeGroups: Map<string, IAttributeGroup> = this.attributeGroups\n let baseGroup\n if (type.extensionBase) {\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\n if (base) {\n baseGroup = attributeGroups.get(base.attributeGroup)\n }\n return baseGroup ?? null\n }\n return null\n }\n\n private populateSet (type: IComplexType, set: IContainedSet): void {\n const group: IGroup | undefined = this.groups.get(type.group)\n const elements: IElement[] = group ? group.elements : type.element\n const attributeGroups = this.attributeGroups\n const attributeGroup: IAttributeGroup | undefined = attributeGroups.get(type.attributeGroup)\n const baseGroup: IAttributeGroup | null = this.getBaseAttributes(type)\n // if a base is specified add the attributes from there\n if (baseGroup) {\n this.addAttributes(set, baseGroup.attributes)\n }\n if (attributeGroup) {\n this.addAttributes(set, attributeGroup.attributes)\n }\n this.addElements(set, elements)\n }\n\n private constructType (type: IComplexType): void {\n const componentType: string = type.appInfo != null ? type.appInfo.ComponentType : 'Block'\n switch (componentType) {\n case 'Message': {\n const message: MessageDefinition = this.getMessage(type)\n if (!message) {\n throw new Error(`cannot resolve ${type.name}`)\n }\n break\n }\n\n // these may be included from top level messages and added into definitions\n case 'Block': {\n const component: ComponentFieldDefinition = this.getComponent(type)\n if (!component) {\n throw new Error(`cannot resolve ${type.name}`)\n }\n break\n }\n\n case 'ImplicitBlock':\n case 'XMLDataBlock':\n case 'BlockRepeating':\n case 'ImplicitBlockRepeating': {\n break\n }\n\n default:\n throw new Error(`unknown type ${componentType}`)\n }\n }\n\n private insertFields (): void {\n this.newComplexTypes.forEach((type: IComplexType) => {\n this.constructType(type)\n })\n this.unboundElements.forEach((e: IElement) => {\n const definitions = this.definitions\n const component: ComponentFieldDefinition | undefined = definitions.component.get(e.type)\n if (component) {\n definitions.component.set(e.name, component)\n }\n })\n }\n}\n"]}
1
+ {"version":3,"file":"components-parser.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QACF,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAW,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;YACpC,MAAM,SAAS,GAAyC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACzF,IAAI,SAAS,EAAE,CAAC;gBACd,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAjcD,4CAicC","sourcesContent":["import { ISaxNode } from '../../sax-node'\nimport { XsdParser } from './xsd-parser'\nimport {\n ContainedGroupField,\n IContainedSet,\n ContainedSetBuilder,\n ContainedComponentField,\n ContainedSimpleField,\n ContainedField\n} from '../../contained'\nimport {\n MessageDefinition,\n FixDefinitions,\n GroupFieldDefinition,\n ComponentFieldDefinition\n} from '../../definition'\n\nexport class ComponentsParser extends XsdParser {\n private readonly attributeGroups: Map<string, IAttributeGroup> = new Map<string, IAttributeGroup>()\n private readonly groups: Map<string, IGroup> = new Map<string, IGroup>()\n private readonly unboundElements: IElement[] = []\n private readonly complexTypes: Map<string, IComplexType> = new Map<string, IComplexType>()\n\n private newComplexTypes: IComplexType[]\n private currentGroup: (IGroup | null)\n private readonly currentAttributeGroupStack: IAttributeGroup[] = []\n private currentComplexType: (IComplexType | null)\n private previousComplexType: IComplexType\n\n public constructor (public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n private static getName (group: (IGroup | undefined), attributeGroup: (IAttributeGroup | undefined), type: IComplexType): string {\n let name: string\n if (type?.appInfo) {\n name = type.appInfo.name\n } else if (group) {\n name = group.name\n } else if (attributeGroup) {\n name = attributeGroup.name\n } else {\n name = type.name\n }\n return name\n }\n\n public value (line: number, n: string, v: string): void {\n // do nothing\n switch (n) {\n case 'xs:documentation': {\n if (this.currentComplexType?.annotation) {\n this.currentComplexType.annotation.documentation = v\n }\n break\n }\n }\n this.pending = null\n }\n\n public close (line: number, node: string): void {\n switch (node) {\n case 'xs:complexType': {\n if (this.currentComplexType != null) {\n const complex: IComplexType = this.currentComplexType\n this.previousComplexType = complex\n this.complexTypes.set(complex.name, complex)\n this.newComplexTypes.push(complex)\n this.currentComplexType = null\n }\n break\n }\n\n case 'xs:group': {\n if (this.currentGroup) {\n this.groups.set(this.currentGroup.name, this.currentGroup)\n this.currentGroup = null\n }\n break\n }\n\n case 'xs:attributeGroup': {\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (attributeStack.length > 0) {\n const group: IAttributeGroup | undefined = attributeStack.pop()\n if (group?.name) {\n this.attributeGroups.set(group?.name, group)\n }\n }\n break\n }\n\n case 'xs:schema': {\n this.insertFields()\n break\n }\n }\n }\n\n public open (line: number, node: ISaxNode): void {\n switch (node.name) {\n case 'xs:schema': {\n this.newComplexTypes = []\n break\n }\n\n case 'xs:group': {\n this.xsGroup(node)\n break\n }\n\n case 'xs:attributeGroup': {\n this.xsAttributeGroup(node)\n break\n }\n\n case 'xs:element': {\n this.xsElement(node)\n break\n }\n\n case 'xs:appinfo': {\n if (this.currentComplexType) {\n this.currentComplexType.appInfo = {} as IAppInfo\n }\n break\n }\n\n case 'xs:attribute': {\n this.xsAttribute(node)\n break\n }\n\n case 'xs:complexType': {\n const unbound: IElement[] = this.unboundElements\n this.currentComplexType = {\n name: node.attributes.name || unbound[unbound.length - 1].name\n } as IComplexType\n break\n }\n\n case 'xs:extension': {\n const current: IComplexType | null = this.currentComplexType\n if (current && node.attributes.base) {\n current.extensionBase = node.attributes.base\n }\n break\n }\n\n case 'fm:Xref': {\n this.assign(node, this.currentComplexType?.appInfo)\n break\n }\n\n case 'xs:annotation': {\n if (this.currentComplexType) {\n this.currentComplexType.annotation = {} as IAnnotation\n }\n break\n }\n\n case 'xs:documentation': {\n if (this.currentComplexType) {\n this.pending = node.name\n }\n break\n }\n }\n }\n\n private xsAttribute (node: ISaxNode): void {\n const attribute: IAttribute = {} as IAttribute\n this.assign(node, attribute)\n const stack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (stack.length > 0) {\n const peek: IAttributeGroup = stack[stack.length - 1]\n const groupAttributes: IAttribute[] = peek.attributes\n groupAttributes[groupAttributes.length] = attribute\n }\n }\n\n private xsGroup (node: ISaxNode): void {\n if (node.attributes.name) {\n this.currentGroup = {\n name: node.attributes.name,\n elements: [] as IElement[]\n }\n } else if (node.attributes.ref) {\n if (this.currentComplexType) {\n this.currentComplexType.group = node.attributes.ref\n } else if (this.currentGroup) {\n // this is part of a sequence for a group\n const elements = this.currentGroup.elements\n elements[elements.length] = {\n type: node.name,\n name: node.attributes.ref\n } as IElement\n }\n }\n }\n\n private xsAttributeGroup (node: ISaxNode): void {\n const attributeStack: IAttributeGroup[] = this.currentAttributeGroupStack\n if (node.attributes.name) {\n attributeStack.push({\n name: node.attributes.name,\n attributes: [] as IAttribute[]\n })\n } else if (node.attributes.ref) {\n if (this.currentComplexType) {\n this.currentComplexType.attributeGroup = node.attributes.ref\n } else if (attributeStack.length > 0) {\n const peek: IAttributeGroup = attributeStack[attributeStack.length - 1]\n peek.attributes[peek.attributes.length] = {\n type: node.name,\n name: node.attributes.ref\n } as IAttribute\n }\n }\n }\n\n private xsElement (node: ISaxNode): void {\n const element: IElement = {} as IElement\n this.assign(node, element)\n const currentComplex: IComplexType | null = this.currentComplexType\n const currentGroup: IGroup | null = this.currentGroup\n if (!currentGroup && currentComplex) {\n if (!currentComplex.element) {\n currentComplex.element = []\n }\n const elements: IElement[] = currentComplex.element\n elements[elements.length] = element\n } else if (currentGroup) {\n const elements: IElement[] = currentGroup.elements\n elements[elements.length] = element\n } else {\n if (element.substitutionGroup && this.previousComplexType) {\n this.previousComplexType.messageName = element.name\n } else {\n this.unboundElements.push(element)\n }\n }\n }\n\n private addElement (set: IContainedSet, element: IElement): void {\n const minOccurs: number = parseInt(element.minOccurs, 10)\n const isGroup: boolean = element.maxOccurs === 'unbounded'\n const isComponent: boolean = element.maxOccurs === '1' || !isGroup\n const key = element.type || element.ref || element.name\n const builder = new ContainedSetBuilder(set)\n const containedType: IComplexType | undefined = this.complexTypes.get(key)\n if (containedType) {\n if (isComponent) {\n const containedDefinition: ComponentFieldDefinition = this.getComponent(containedType)\n const containedField: ContainedComponentField =\n new ContainedComponentField(containedDefinition,\n set.fields.length,\n minOccurs > 0,\n element.name)\n builder.add(containedField)\n } else if (isGroup) {\n const containedDefinition: GroupFieldDefinition = this.getGroup(containedType)\n const containedField: ContainedGroupField =\n new ContainedGroupField(containedDefinition,\n set.fields.length,\n minOccurs > 0,\n element.name)\n builder.add(containedField)\n }\n } else {\n if (key !== 'Message') {\n throw new Error(`cannot resolve component ${key} contained in ${set.name}`)\n }\n }\n }\n\n private addElements (set: IContainedSet, elements: IElement[]): void {\n if (elements) {\n elements.forEach((element: IElement) => {\n switch (element.type) {\n case 'xs:group': {\n const groupElements: IGroup | undefined = this.groups.get(element.name)\n if (groupElements) {\n this.addElements(set, groupElements.elements)\n } else {\n throw new Error(`unable to get xs:group ${element.name}`)\n }\n }\n break\n\n default: {\n this.addElement(set, element)\n }\n }\n })\n }\n }\n\n private addSimpleAttribute (set: IContainedSet, attribute: IAttribute): void {\n let sf = this.definitions.getSimple(attribute.type)\n if (!sf) {\n sf = this.definitions.getSimple(attribute.name, set.category)\n }\n if (sf) {\n const contained: ContainedSimpleField = new ContainedSimpleField(sf,\n set.fields.length,\n attribute.use !== 'optional',\n true,\n attribute.name)\n const builder = new ContainedSetBuilder(set)\n builder.add(contained)\n } else if (set.name !== 'FixmlAttributes') {\n throw new Error(`unable to resolve simple attribute ${attribute.name}`)\n }\n }\n\n private addAttributes (set: IContainedSet, attributes: IAttribute[]): void {\n attributes.forEach((attribute: IAttribute) => {\n switch (attribute.type) {\n case 'xs:attributeGroup': {\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(attribute.name)\n if (attributeGroup) {\n this.addAttributes(set, attributeGroup.attributes)\n } else {\n throw new Error(`unable to get xs:attributeGroup ${attribute.name}`)\n }\n break\n }\n\n default: {\n this.addSimpleAttribute(set, attribute)\n }\n }\n })\n }\n\n private getGroup (type: IComplexType): GroupFieldDefinition {\n const group: IGroup | undefined = this.groups.get(type.group)\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\n const name: string = ComponentsParser.getName(group, attributeGroup, type)\n const category = type.appInfo != null ? type.appInfo.Category : null\n const groupDefinition: GroupFieldDefinition = new GroupFieldDefinition(name, name, category, null, null)\n this.populateSet(type, groupDefinition)\n return groupDefinition\n }\n\n private getComponent (type: IComplexType): ComponentFieldDefinition {\n const definitions: FixDefinitions = this.definitions\n const group: IGroup | undefined = this.groups.get(type.group)\n const attributeGroup: IAttributeGroup | undefined = this.attributeGroups.get(type.attributeGroup)\n let name: string = ComponentsParser.getName(group, attributeGroup, type)\n const cached: ComponentFieldDefinition | undefined = definitions.component.get(name)\n if (cached) {\n return cached\n }\n\n const category = type.appInfo != null ? type.appInfo.Category : null\n if (type.extensionBase) {\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\n if (base) {\n name = base.appInfo.name\n }\n }\n const component: ComponentFieldDefinition = new ComponentFieldDefinition(name, name, category, null)\n this.populateSet(type, component)\n definitions.component.set(component.name, component)\n definitions.component.set(type.name, component)\n return component\n }\n\n private getMessage (type: IComplexType): MessageDefinition {\n const definitions: FixDefinitions = this.definitions\n const messages = definitions.message\n const name: string = type.appInfo.name\n const message: MessageDefinition = new MessageDefinition(name,\n type.messageName,\n type.appInfo.MsgID,\n type.appInfo.Category,\n type.annotation.documentation)\n const builder = new ContainedSetBuilder(message)\n const abstractMessage: ComponentFieldDefinition | undefined = definitions.component.get('Message')\n abstractMessage?.fields.forEach((f: ContainedField) => {\n builder.add(f)\n })\n this.populateSet(type, message)\n messages.set(message.name, message)\n if (type.messageName && type.messageName !== name) {\n messages.set(type.messageName, message)\n }\n\n return message\n }\n\n private getBaseAttributes (type: IComplexType): (IAttributeGroup | null) {\n const attributeGroups: Map<string, IAttributeGroup> = this.attributeGroups\n let baseGroup\n if (type.extensionBase) {\n const base: IComplexType | undefined = this.complexTypes.get(type.extensionBase)\n if (base) {\n baseGroup = attributeGroups.get(base.attributeGroup)\n }\n return baseGroup ?? null\n }\n return null\n }\n\n private populateSet (type: IComplexType, set: IContainedSet): void {\n const group: IGroup | undefined = this.groups.get(type.group)\n const elements: IElement[] = group ? group.elements : type.element\n const attributeGroups = this.attributeGroups\n const attributeGroup: IAttributeGroup | undefined = attributeGroups.get(type.attributeGroup)\n const baseGroup: IAttributeGroup | null = this.getBaseAttributes(type)\n // if a base is specified add the attributes from there\n if (baseGroup) {\n this.addAttributes(set, baseGroup.attributes)\n }\n if (attributeGroup) {\n this.addAttributes(set, attributeGroup.attributes)\n }\n this.addElements(set, elements)\n }\n\n private constructType (type: IComplexType): void {\n const componentType: string = type.appInfo != null ? type.appInfo.ComponentType : 'Block'\n switch (componentType) {\n case 'Message': {\n const message: MessageDefinition = this.getMessage(type)\n if (!message) {\n throw new Error(`cannot resolve ${type.name}`)\n }\n break\n }\n\n // these may be included from top level messages and added into definitions\n case 'Block': {\n const component: ComponentFieldDefinition = this.getComponent(type)\n if (!component) {\n throw new Error(`cannot resolve ${type.name}`)\n }\n break\n }\n\n case 'ImplicitBlock':\n case 'XMLDataBlock':\n case 'BlockRepeating':\n case 'ImplicitBlockRepeating': {\n break\n }\n\n default:\n throw new Error(`unknown type ${componentType}`)\n }\n }\n\n private insertFields (): void {\n this.newComplexTypes.forEach((type: IComplexType) => {\n this.constructType(type)\n })\n this.unboundElements.forEach((e: IElement) => {\n const definitions = this.definitions\n const component: ComponentFieldDefinition | undefined = definitions.component.get(e.type)\n if (component) {\n definitions.component.set(e.name, component)\n }\n })\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fields-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/fixml/fields-parser.ts"],"names":[],"mappings":";;;AACA,iD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AI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,CAAA;YAC1D,CAAC;iBAAM,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;gBACjD,IAAI,MAAM,GAAG,CAAC,CAAC,cAAc,CAAA;gBAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;gBACpC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC,CAAC,eAAe,CAAA;gBAC5B,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,CAAC,CAAC,cAAc;oBACtB,MAAM;iBACP,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtGD,oCAsGC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\nimport { SimpleFieldDefinition, FixDefinitions } from '../../definition'\nimport { XsdParser } from './xsd-parser'\nimport { ISaxNode } from '../../sax-node'\n\ninterface ISimpleField extends ILooseObject {\n restrictionBase: string\n documentation: string\n Protocol: string\n simpleTypeName: string\n name: string\n ComponentType: string\n Tag: string\n Type: string\n AbbrName: string\n Category: string\n CategoryAbbrName: string\n enums: Map<string, string>\n currentEnum: string\n}\n\ninterface IAlias {\n name: string\n mapped: string\n}\n\nexport class FieldsParser extends XsdParser {\n private readonly alias: IAlias[] = []\n public constructor (public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n public value (line: number, n: string, v: string): void {\n const current: ISimpleField = this.current as ISimpleField\n switch (n) {\n case 'fm:EnumDoc': {\n current.enums.set(current.currentEnum, v)\n break\n }\n case 'xs:documentation': {\n this.current.documentation = v\n break\n }\n }\n }\n\n public close (line: number, node: string): void {\n const current: ISimpleField = this.current as ISimpleField\n switch (node) {\n case 'xs:simpleType': {\n this.data[this.data.length] = current\n break\n }\n\n case 'xs:schema': {\n this.insertFields()\n break\n }\n }\n }\n\n public open (line: number, node: ISaxNode): void {\n switch (node.name) {\n case 'xs:simpleType': {\n this.current = {\n simpleTypeName: node.attributes.name\n } as ISimpleField\n break\n }\n\n case 'fm:Xref': {\n this.assign(node)\n break\n }\n\n case 'xs:restriction': {\n this.current.restrictionBase = node.attributes.base\n break\n }\n\n case 'fm:EnumDoc': {\n if (!this.current.enums) {\n this.current.enums = new Map<string, string>()\n }\n this.current.currentEnum = node.attributes.value\n this.pending = node.name\n break\n }\n\n default:\n this.pending = node.name\n }\n }\n\n private insertFields (): void {\n const alias = this.alias;\n (this.data as ISimpleField[]).forEach((f: ISimpleField) => {\n const sf: SimpleFieldDefinition = new SimpleFieldDefinition(f.Tag,\n f.name,\n f.AbbrName,\n f.Category,\n f.CategoryAbbrName,\n f.Type,\n f.documentation)\n if (f.enums) {\n f.enums.forEach((k: string, v: string) => {\n sf.addEnum(k, v)\n })\n }\n if (f.name && f.Type && f.Tag) {\n this.definitions.addSimpleFieldDef(sf, f.simpleTypeName)\n } else if (f.restrictionBase && f.simpleTypeName) {\n let mapped = f.simpleTypeName\n if (mapped.endsWith('_t')) {\n mapped = mapped.replace(/_t$/, '')\n } else {\n mapped = f.restrictionBase\n }\n alias.push({\n name: f.simpleTypeName,\n mapped\n })\n }\n })\n alias.forEach((a: IAlias) => {\n this.definitions.addSimpleAlias(a.mapped, a.name)\n })\n }\n}\n"]}
1
+ {"version":3,"file":"fields-parser.js","sourceRoot":"","sources":["../../../../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CAAA;gBAClB,CAAC,CAAC,CAAA;YACJ,CAAC;YACD,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,CAAA;YAC1D,CAAC;iBAAM,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;gBACjD,IAAI,MAAM,GAAG,CAAC,CAAC,cAAc,CAAA;gBAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;gBACpC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC,CAAC,eAAe,CAAA;gBAC5B,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,CAAC,CAAC,cAAc;oBACtB,MAAM;iBACP,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtGD,oCAsGC","sourcesContent":["import { ILooseObject } from '../../../collections/collection'\nimport { SimpleFieldDefinition, FixDefinitions } from '../../definition'\nimport { XsdParser } from './xsd-parser'\nimport { ISaxNode } from '../../sax-node'\n\ninterface ISimpleField extends ILooseObject {\n restrictionBase: string\n documentation: string\n Protocol: string\n simpleTypeName: string\n name: string\n ComponentType: string\n Tag: string\n Type: string\n AbbrName: string\n Category: string\n CategoryAbbrName: string\n enums: Map<string, string>\n currentEnum: string\n}\n\ninterface IAlias {\n name: string\n mapped: string\n}\n\nexport class FieldsParser extends XsdParser {\n private readonly alias: IAlias[] = []\n public constructor (public readonly definitions: FixDefinitions) {\n super(definitions)\n }\n\n public value (line: number, n: string, v: string): void {\n const current: ISimpleField = this.current as ISimpleField\n switch (n) {\n case 'fm:EnumDoc': {\n current.enums.set(current.currentEnum, v)\n break\n }\n case 'xs:documentation': {\n this.current.documentation = v\n break\n }\n }\n }\n\n public close (line: number, node: string): void {\n const current: ISimpleField = this.current as ISimpleField\n switch (node) {\n case 'xs:simpleType': {\n this.data[this.data.length] = current\n break\n }\n\n case 'xs:schema': {\n this.insertFields()\n break\n }\n }\n }\n\n public open (line: number, node: ISaxNode): void {\n switch (node.name) {\n case 'xs:simpleType': {\n this.current = {\n simpleTypeName: node.attributes.name\n }\n break\n }\n\n case 'fm:Xref': {\n this.assign(node)\n break\n }\n\n case 'xs:restriction': {\n this.current.restrictionBase = node.attributes.base\n break\n }\n\n case 'fm:EnumDoc': {\n if (!this.current.enums) {\n this.current.enums = new Map<string, string>()\n }\n this.current.currentEnum = node.attributes.value\n this.pending = node.name\n break\n }\n\n default:\n this.pending = node.name\n }\n }\n\n private insertFields (): void {\n const alias = this.alias;\n (this.data as ISimpleField[]).forEach((f: ISimpleField) => {\n const sf: SimpleFieldDefinition = new SimpleFieldDefinition(f.Tag,\n f.name,\n f.AbbrName,\n f.Category,\n f.CategoryAbbrName,\n f.Type,\n f.documentation)\n if (f.enums) {\n f.enums.forEach((k: string, v: string) => {\n sf.addEnum(k, v)\n })\n }\n if (f.name && f.Type && f.Tag) {\n this.definitions.addSimpleFieldDef(sf, f.simpleTypeName)\n } else if (f.restrictionBase && f.simpleTypeName) {\n let mapped = f.simpleTypeName\n if (mapped.endsWith('_t')) {\n mapped = mapped.replace(/_t$/, '')\n } else {\n mapped = f.restrictionBase\n }\n alias.push({\n name: f.simpleTypeName,\n mapped\n })\n }\n })\n alias.forEach((a: IAlias) => {\n this.definitions.addSimpleAlias(a.mapped, a.name)\n })\n }\n}\n"]}