jspurefix 5.2.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/BACKPORT_PLAN.md +135 -39
  2. package/dist/config/js-fix-config.d.ts +2 -0
  3. package/dist/config/js-fix-config.js.map +1 -1
  4. package/dist/dictionary/parser/quickfix/dictionary-validator.d.ts +39 -0
  5. package/dist/dictionary/parser/quickfix/dictionary-validator.js +321 -0
  6. package/dist/dictionary/parser/quickfix/dictionary-validator.js.map +1 -0
  7. package/dist/dictionary/parser/quickfix/index-visitor.d.ts +10 -0
  8. package/dist/dictionary/parser/quickfix/index-visitor.js +68 -0
  9. package/dist/dictionary/parser/quickfix/index-visitor.js.map +1 -0
  10. package/dist/dictionary/parser/quickfix/index.d.ts +7 -0
  11. package/dist/dictionary/parser/quickfix/index.js +7 -0
  12. package/dist/dictionary/parser/quickfix/index.js.map +1 -1
  13. package/dist/dictionary/parser/quickfix/quick-fix-graph-file-parser.d.ts +13 -0
  14. package/dist/dictionary/parser/quickfix/quick-fix-graph-file-parser.js +65 -0
  15. package/dist/dictionary/parser/quickfix/quick-fix-graph-file-parser.js.map +1 -0
  16. package/dist/dictionary/parser/quickfix/quick-fix-graph-parser.d.ts +73 -0
  17. package/dist/dictionary/parser/quickfix/quick-fix-graph-parser.js +363 -0
  18. package/dist/dictionary/parser/quickfix/quick-fix-graph-parser.js.map +1 -0
  19. package/dist/dictionary/parser/quickfix/sax-tree-builder.d.ts +5 -0
  20. package/dist/dictionary/parser/quickfix/sax-tree-builder.js +103 -0
  21. package/dist/dictionary/parser/quickfix/sax-tree-builder.js.map +1 -0
  22. package/dist/dictionary/parser/quickfix/validation-error.d.ts +17 -0
  23. package/dist/dictionary/parser/quickfix/validation-error.js +32 -0
  24. package/dist/dictionary/parser/quickfix/validation-error.js.map +1 -0
  25. package/dist/dictionary/parser/quickfix/x-element.d.ts +26 -0
  26. package/dist/dictionary/parser/quickfix/x-element.js +82 -0
  27. package/dist/dictionary/parser/quickfix/x-element.js.map +1 -0
  28. package/dist/store/file-session-store.d.ts +42 -0
  29. package/dist/store/file-session-store.js +256 -0
  30. package/dist/store/file-session-store.js.map +1 -0
  31. package/dist/store/file-session-stream-provider.d.ts +25 -0
  32. package/dist/store/file-session-stream-provider.js +162 -0
  33. package/dist/store/file-session-stream-provider.js.map +1 -0
  34. package/dist/store/fix-msg-ascii-store-resend.js +6 -0
  35. package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
  36. package/dist/store/fix-session-store-factory.d.ts +13 -0
  37. package/dist/store/fix-session-store-factory.js +21 -0
  38. package/dist/store/fix-session-store-factory.js.map +1 -0
  39. package/dist/store/fix-session-store.d.ts +19 -0
  40. package/dist/store/fix-session-store.js +3 -0
  41. package/dist/store/fix-session-store.js.map +1 -0
  42. package/dist/store/index.d.ts +9 -0
  43. package/dist/store/index.js +9 -0
  44. package/dist/store/index.js.map +1 -1
  45. package/dist/store/memory-session-store.d.ts +27 -0
  46. package/dist/store/memory-session-store.js +104 -0
  47. package/dist/store/memory-session-store.js.map +1 -0
  48. package/dist/store/memory-session-stream-provider.d.ts +26 -0
  49. package/dist/store/memory-session-stream-provider.js +103 -0
  50. package/dist/store/memory-session-stream-provider.js.map +1 -0
  51. package/dist/store/session-id.d.ts +9 -0
  52. package/dist/store/session-id.js +55 -0
  53. package/dist/store/session-id.js.map +1 -0
  54. package/dist/store/session-stream-provider.d.ts +15 -0
  55. package/dist/store/session-stream-provider.js +3 -0
  56. package/dist/store/session-stream-provider.js.map +1 -0
  57. package/dist/store/store-config.d.ts +5 -0
  58. package/dist/store/store-config.js +3 -0
  59. package/dist/store/store-config.js.map +1 -0
  60. package/dist/transport/ascii/ascii-session.d.ts +6 -1
  61. package/dist/transport/ascii/ascii-session.js +37 -5
  62. package/dist/transport/ascii/ascii-session.js.map +1 -1
  63. package/dist/transport/session/session-description.d.ts +2 -0
  64. package/dist/transport/session/session-description.js.map +1 -1
  65. package/dist/util/definition-factory.js +1 -1
  66. package/dist/util/definition-factory.js.map +1 -1
  67. package/jsfix.test_client.txt +67 -67
  68. package/jsfix.test_server.txt +64 -64
  69. package/package.json +6 -6
  70. package/src/config/js-fix-config.ts +2 -0
  71. package/src/dictionary/parser/quickfix/dictionary-validator.ts +473 -0
  72. package/src/dictionary/parser/quickfix/index-visitor.ts +100 -0
  73. package/src/dictionary/parser/quickfix/index.ts +7 -0
  74. package/src/dictionary/parser/quickfix/quick-fix-graph-file-parser.ts +63 -0
  75. package/src/dictionary/parser/quickfix/quick-fix-graph-parser.ts +450 -0
  76. package/src/dictionary/parser/quickfix/sax-tree-builder.ts +112 -0
  77. package/src/dictionary/parser/quickfix/validation-error.ts +34 -0
  78. package/src/dictionary/parser/quickfix/x-element.ts +115 -0
  79. package/src/store/file-session-store.ts +294 -0
  80. package/src/store/file-session-stream-provider.ts +123 -0
  81. package/src/store/fix-msg-ascii-store-resend.ts +8 -0
  82. package/src/store/fix-session-store-factory.ts +31 -0
  83. package/src/store/fix-session-store.ts +37 -0
  84. package/src/store/index.ts +9 -0
  85. package/src/store/memory-session-store.ts +102 -0
  86. package/src/store/memory-session-stream-provider.ts +97 -0
  87. package/src/store/session-id.ts +32 -0
  88. package/src/store/session-stream-provider.ts +74 -0
  89. package/src/store/store-config.ts +16 -0
  90. package/src/transport/ascii/ascii-session.ts +57 -6
  91. package/src/transport/session/session-description.ts +2 -0
  92. package/src/util/definition-factory.ts +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary-validator.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/quickfix/dictionary-validator.ts"],"names":[],"mappings":";;;AACA,yDAI2B;AAwB3B,MAAa,mBAAmB;IAAhC;QACmB,YAAO,GAAsB,EAAE,CAAA;QAG/B,iBAAY,GAAG,IAAI,GAAG,EAA+B,CAAA;QACrD,gBAAW,GAAG,IAAI,GAAG,EAA+B,CAAA;QACpD,qBAAgB,GAAG,IAAI,GAAG,EAAmC,CAA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,CAAC,GAAG,CAAC,EACf,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACf,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;CACF;AA3bD,kDA2bC","sourcesContent":["import { XDocument, XNode } from './x-element'\nimport {\n DictionaryValidationException,\n ValidationError,\n ValidationSeverity\n} from './validation-error'\n\ninterface FieldDefinitionInfo {\n readonly name: string\n readonly tag: number\n readonly type: string\n readonly lineNumber?: number\n}\n\ninterface ComponentDefinitionInfo {\n readonly name: string\n readonly lineNumber?: number\n}\n\ninterface MessageDefinitionInfo {\n readonly name: string\n readonly msgType: string\n readonly lineNumber?: number\n}\n\n/**\n * Validates FIX dictionary XML for common errors like duplicates, missing references, etc.\n * Port of C# DictionaryValidator — operates on an XDocument tree built by SaxTreeBuilder.\n */\nexport class DictionaryValidator {\n private readonly _errors: ValidationError[] = []\n\n // Track definitions — case-sensitive for exact matching\n private readonly fieldsByName = new Map<string, FieldDefinitionInfo>()\n private readonly fieldsByTag = new Map<number, FieldDefinitionInfo>()\n private readonly componentsByName = new Map<string, ComponentDefinitionInfo>()\n private readonly messagesByName = new Map<string, MessageDefinitionInfo>()\n private readonly messagesByMsgType = new Map<string, MessageDefinitionInfo>()\n\n // Case-insensitive lookup for \"did you mean\" suggestions\n private readonly fieldNamesCaseInsensitive = new Map<string, string>()\n private readonly componentNamesCaseInsensitive = new Map<string, string>()\n\n // Track what's referenced (to find unused definitions)\n private readonly referencedFields = new Set<string>()\n private readonly referencedComponents = new Set<string>()\n\n // All known names for \"did you mean\" suggestions\n private readonly allFieldNames: string[] = []\n private readonly allComponentNames: string[] = []\n\n get errors (): ReadonlyArray<ValidationError> {\n return this._errors\n }\n\n get hasErrors (): boolean {\n return this._errors.some(e => e.severity === ValidationSeverity.Error)\n }\n\n get hasWarnings (): boolean {\n return this._errors.some(e => e.severity === ValidationSeverity.Warning)\n }\n\n validate (doc: XDocument): void {\n // First pass: collect all definitions\n this.collectFieldDefinitions(doc)\n this.collectComponentDefinitions(doc)\n this.collectMessageDefinitions(doc)\n\n // Second pass: validate references\n this.validateHeader(doc)\n this.validateTrailer(doc)\n this.validateComponentReferences(doc)\n this.validateMessageReferences(doc)\n\n // Third pass: check for unused definitions (warnings only)\n this.checkUnusedDefinitions()\n }\n\n throwIfErrors (): void {\n if (this.hasErrors) {\n throw new DictionaryValidationException(this._errors)\n }\n }\n\n // ── Field Validation ──\n\n private collectFieldDefinitions (doc: XDocument): void {\n const fieldsNode = doc.firstDescendant('fields')\n if (!fieldsNode) {\n this.addError('MISSING_FIELDS', 'No <fields> section found in dictionary')\n return\n }\n\n for (const field of fieldsNode.elements('field')) {\n this.validateFieldDefinition(field)\n }\n }\n\n private validateFieldDefinition (field: XNode): void {\n const name = field.attribute('name')\n const numberStr = field.attribute('number')\n const type = field.attribute('type')\n const lineNumber = field.line\n\n if (!name) {\n this.addError('FIELD_NO_NAME', 'Field definition missing \\'name\\' attribute', undefined, undefined, lineNumber)\n return\n }\n\n const tag = numberStr != null ? parseInt(numberStr, 10) : NaN\n if (!numberStr || isNaN(tag)) {\n this.addError('FIELD_NO_TAG', `Field '${name}' missing or invalid 'number' attribute`, name, 'field', lineNumber)\n return\n }\n\n if (!type) {\n this.addWarning('FIELD_NO_TYPE', `Field '${name}' missing 'type' attribute, defaulting to STRING`, name, 'field', lineNumber)\n }\n\n this.allFieldNames.push(name)\n\n // Check for duplicate by name\n const existingByName = this.fieldsByName.get(name)\n if (existingByName) {\n this.addError('DUPLICATE_FIELD_NAME',\n `Duplicate field name '${name}' (tag ${tag}). Previously defined with tag ${existingByName.tag}`,\n name, 'field', lineNumber,\n existingByName.tag === tag ? 'Remove the duplicate definition' : 'Use unique field names')\n return\n }\n\n // Check for duplicate by tag\n const existingByTag = this.fieldsByTag.get(tag)\n if (existingByTag) {\n this.addError('DUPLICATE_FIELD_TAG',\n `Duplicate field tag ${tag} for '${name}'. Tag already used by field '${existingByTag.name}'`,\n name, 'field', lineNumber,\n 'Each tag number must be unique')\n return\n }\n\n const info: FieldDefinitionInfo = { name, tag, type: type ?? 'STRING', lineNumber }\n this.fieldsByName.set(name, info)\n this.fieldsByTag.set(tag, info)\n this.fieldNamesCaseInsensitive.set(name.toLowerCase(), name)\n\n this.validateFieldEnums(field, name, lineNumber)\n }\n\n private validateFieldEnums (field: XNode, fieldName: string, lineNumber?: number): void {\n const values = field.elements('value')\n if (values.length === 0) return\n\n const seenEnumKeys = new Set<string>()\n const seenEnumDescriptions = new Set<string>()\n\n for (const value of values) {\n const enumKey = value.attribute('enum')\n const description = value.attribute('description')\n const valueLine = value.line ?? lineNumber\n\n if (!enumKey) {\n this.addError('ENUM_NO_KEY', `Field '${fieldName}' has enum value without 'enum' attribute`,\n fieldName, 'field', valueLine)\n continue\n }\n\n if (!description) {\n this.addWarning('ENUM_NO_DESC', `Field '${fieldName}' enum '${enumKey}' has no description`,\n fieldName, 'field', valueLine)\n }\n\n if (seenEnumKeys.has(enumKey)) {\n this.addError('DUPLICATE_ENUM_KEY',\n `Field '${fieldName}' has duplicate enum key '${enumKey}'`,\n fieldName, 'field', valueLine)\n }\n seenEnumKeys.add(enumKey)\n\n if (description != null) {\n const descLower = description.toLowerCase()\n if (seenEnumDescriptions.has(descLower)) {\n this.addWarning('DUPLICATE_ENUM_DESC',\n `Field '${fieldName}' has duplicate enum description '${description}' which may cause naming conflicts`,\n fieldName, 'field', valueLine)\n }\n seenEnumDescriptions.add(descLower)\n }\n }\n }\n\n // ── Component Validation ──\n\n private collectComponentDefinitions (doc: XDocument): void {\n const componentsNode = doc.firstDescendant('components')\n if (!componentsNode) {\n // Components are optional\n return\n }\n\n for (const component of componentsNode.elements('component')) {\n this.validateComponentDefinition(component)\n }\n }\n\n private validateComponentDefinition (component: XNode): void {\n const name = component.attribute('name')\n const lineNumber = component.line\n\n if (!name) {\n this.addError('COMPONENT_NO_NAME', 'Component definition missing \\'name\\' attribute', undefined, undefined, lineNumber)\n return\n }\n\n this.allComponentNames.push(name)\n\n const existing = this.componentsByName.get(name)\n if (existing) {\n this.addError('DUPLICATE_COMPONENT',\n `Duplicate component name '${name}'`,\n name, 'component', lineNumber,\n `Previously defined at line ${existing.lineNumber ?? '?'}`)\n return\n }\n\n this.componentsByName.set(name, { name, lineNumber })\n this.componentNamesCaseInsensitive.set(name.toLowerCase(), name)\n\n this.validateFieldReferences(component, name, 'component')\n }\n\n // ── Message Validation ──\n\n private collectMessageDefinitions (doc: XDocument): void {\n const messagesNode = doc.firstDescendant('messages')\n if (!messagesNode) {\n this.addError('MISSING_MESSAGES', 'No <messages> section found in dictionary')\n return\n }\n\n for (const message of messagesNode.elements('message')) {\n this.validateMessageDefinition(message)\n }\n }\n\n private validateMessageDefinition (message: XNode): void {\n const name = message.attribute('name')\n const msgType = message.attribute('msgtype')\n const lineNumber = message.line\n\n if (!name) {\n this.addError('MESSAGE_NO_NAME', 'Message definition missing \\'name\\' attribute', undefined, undefined, lineNumber)\n return\n }\n\n if (!msgType) {\n this.addError('MESSAGE_NO_MSGTYPE', `Message '${name}' missing 'msgtype' attribute`,\n name, 'message', lineNumber)\n return\n }\n\n const existingByName = this.messagesByName.get(name)\n if (existingByName) {\n this.addError('DUPLICATE_MESSAGE_NAME',\n `Duplicate message name '${name}'`,\n name, 'message', lineNumber,\n `Previously defined at line ${existingByName.lineNumber ?? '?'}`)\n return\n }\n\n const existingByType = this.messagesByMsgType.get(msgType)\n if (existingByType) {\n this.addError('DUPLICATE_MESSAGE_TYPE',\n `Duplicate message type '${msgType}' for message '${name}'. Type already used by '${existingByType.name}'`,\n name, 'message', lineNumber)\n return\n }\n\n const info: MessageDefinitionInfo = { name, msgType, lineNumber }\n this.messagesByName.set(name, info)\n this.messagesByMsgType.set(msgType, info)\n\n this.validateFieldReferences(message, name, 'message')\n }\n\n // ── Reference Validation ──\n\n private validateHeader (doc: XDocument): void {\n const header = doc.firstDescendant('header')\n if (!header) {\n this.addError('MISSING_HEADER', 'No <header> section found in dictionary')\n return\n }\n this.validateFieldReferences(header, 'StandardHeader', 'header')\n }\n\n private validateTrailer (doc: XDocument): void {\n const trailer = doc.firstDescendant('trailer')\n if (!trailer) {\n this.addError('MISSING_TRAILER', 'No <trailer> section found in dictionary')\n return\n }\n this.validateFieldReferences(trailer, 'StandardTrailer', 'trailer')\n }\n\n private validateComponentReferences (doc: XDocument): void {\n const componentsNode = doc.firstDescendant('components')\n if (!componentsNode) return\n\n for (const component of componentsNode.elements('component')) {\n const name = component.attribute('name')\n if (!name) continue\n\n for (const compRef of component.descendants('component')) {\n this.validateComponentReference(compRef, name, 'component')\n }\n }\n }\n\n private validateMessageReferences (doc: XDocument): void {\n const messagesNode = doc.firstDescendant('messages')\n if (!messagesNode) return\n\n for (const message of messagesNode.elements('message')) {\n const name = message.attribute('name')\n if (!name) continue\n\n for (const compRef of message.descendants('component')) {\n this.validateComponentReference(compRef, name, 'message')\n }\n }\n }\n\n private validateFieldReferences (container: XNode, containerName: string, containerType: string): void {\n for (const fieldRef of container.elements('field')) {\n const fieldName = fieldRef.attribute('name')\n const lineNumber = fieldRef.line\n\n if (!fieldName) {\n this.addError('FIELD_REF_NO_NAME',\n `Field reference in ${containerType} '${containerName}' missing 'name' attribute`,\n containerName, containerType, lineNumber)\n continue\n }\n\n this.referencedFields.add(fieldName)\n\n if (!this.fieldsByName.has(fieldName)) {\n // Check for case mismatch first\n const correctCase = this.fieldNamesCaseInsensitive.get(fieldName.toLowerCase())\n const suggestion = correctCase ?? DictionaryValidator.findSimilar(fieldName, this.allFieldNames)\n\n this.addError('UNDEFINED_FIELD',\n `Field '${fieldName}' referenced in ${containerType} '${containerName}' is not defined`,\n fieldName, 'field reference', lineNumber,\n suggestion != null ? `Did you mean '${suggestion}'?` : 'Add the field to the <fields> section')\n }\n }\n\n // Recursively check groups\n for (const group of container.elements('group')) {\n const groupName = group.attribute('name') ?? 'unknown'\n this.referencedFields.add(groupName)\n\n if (groupName !== 'unknown' && !this.fieldsByName.has(groupName)) {\n const lineNumber = group.line\n const suggestion = DictionaryValidator.findSimilar(groupName, this.allFieldNames)\n\n this.addError('UNDEFINED_GROUP_FIELD',\n `Group '${groupName}' in ${containerType} '${containerName}' has no corresponding field definition (for the repeating count)`,\n groupName, 'group', lineNumber,\n suggestion != null ? `Did you mean '${suggestion}'?` : 'Add a NUMINGROUP field for this group')\n }\n\n this.validateFieldReferences(group, `${containerName}.${groupName}`, 'group')\n }\n }\n\n private validateComponentReference (compRef: XNode, containerName: string, containerType: string): void {\n const compName = compRef.attribute('name')\n const lineNumber = compRef.line\n\n if (!compName) {\n this.addError('COMPONENT_REF_NO_NAME',\n `Component reference in ${containerType} '${containerName}' missing 'name' attribute`,\n containerName, containerType, lineNumber)\n return\n }\n\n this.referencedComponents.add(compName)\n\n if (!this.componentsByName.has(compName) &&\n compName !== 'StandardHeader' && compName !== 'StandardTrailer') {\n const suggestion = DictionaryValidator.findSimilar(compName, this.allComponentNames)\n this.addError('UNDEFINED_COMPONENT',\n `Component '${compName}' referenced in ${containerType} '${containerName}' is not defined`,\n compName, 'component reference', lineNumber,\n suggestion != null ? `Did you mean '${suggestion}'?` : 'Add the component to the <components> section')\n }\n }\n\n private checkUnusedDefinitions (): void {\n for (const field of this.fieldsByName.values()) {\n if (!this.referencedFields.has(field.name)) {\n this.addWarning('UNUSED_FIELD',\n `Field '${field.name}' (tag ${field.tag}) is defined but never referenced`,\n field.name, 'field', field.lineNumber)\n }\n }\n\n for (const comp of this.componentsByName.values()) {\n if (!this.referencedComponents.has(comp.name)) {\n this.addWarning('UNUSED_COMPONENT',\n `Component '${comp.name}' is defined but never referenced`,\n comp.name, 'component', comp.lineNumber)\n }\n }\n }\n\n // ── Helpers ──\n\n private addError (code: string, message: string, elementName?: string,\n elementType?: string, lineNumber?: number, suggestion?: string): void {\n this._errors.push({ severity: ValidationSeverity.Error, code, message, elementName, elementType, lineNumber, suggestion })\n }\n\n private addWarning (code: string, message: string, elementName?: string,\n elementType?: string, lineNumber?: number, suggestion?: string): void {\n this._errors.push({ severity: ValidationSeverity.Warning, code, message, elementName, elementType, lineNumber, suggestion })\n }\n\n static findSimilar (input: string, candidates: string[]): string | null {\n let bestMatch: string | null = null\n let bestDistance = Infinity\n const maxDistance = Math.max(3, Math.floor(input.length / 2))\n const inputLower = input.toLowerCase()\n\n for (const candidate of candidates) {\n const distance = DictionaryValidator.levenshteinDistance(inputLower, candidate.toLowerCase())\n if (distance < bestDistance && distance <= maxDistance) {\n bestDistance = distance\n bestMatch = candidate\n }\n }\n\n return bestMatch\n }\n\n static levenshteinDistance (s1: string, s2: string): number {\n const n = s1.length\n const m = s2.length\n if (n === 0) return m\n if (m === 0) return n\n\n const d: number[][] = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0))\n\n for (let i = 0; i <= n; i++) d[i][0] = i\n for (let j = 0; j <= m; j++) d[0][j] = j\n\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= m; j++) {\n const cost = s1[i - 1] === s2[j - 1] ? 0 : 1\n d[i][j] = Math.min(\n d[i - 1][j] + 1,\n d[i][j - 1] + 1,\n d[i - 1][j - 1] + cost)\n }\n }\n\n return d[n][m]\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { ContainedFieldSet } from '../../contained/contained-field-set';
2
+ import { FixDefinitions } from '../../definition/fix-definitions';
3
+ import { IContainedSet } from '../../contained/contained-set';
4
+ export declare class IndexVisitor {
5
+ private readonly visited;
6
+ compute(definitions: FixDefinitions): void;
7
+ reindex(set: IContainedSet): void;
8
+ static clearAggregated(set: ContainedFieldSet): void;
9
+ private static clearObject;
10
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IndexVisitor = void 0;
4
+ const contained_field_type_1 = require("../../contained/contained-field-type");
5
+ const contained_set_builder_1 = require("../../contained/contained-set-builder");
6
+ class IndexVisitor {
7
+ constructor() {
8
+ this.visited = new Set();
9
+ }
10
+ compute(definitions) {
11
+ const messages = new Set(definitions.message.values());
12
+ for (const msg of messages) {
13
+ this.reindex(msg);
14
+ }
15
+ }
16
+ reindex(set) {
17
+ if (this.visited.has(set))
18
+ return;
19
+ this.visited.add(set);
20
+ for (const field of set.fields) {
21
+ if (field.type === contained_field_type_1.ContainedFieldType.Group) {
22
+ const gf = field;
23
+ if (gf.definition)
24
+ this.reindex(gf.definition);
25
+ }
26
+ else if (field.type === contained_field_type_1.ContainedFieldType.Component) {
27
+ const cf = field;
28
+ if (cf.definition)
29
+ this.reindex(cf.definition);
30
+ }
31
+ }
32
+ const level0 = [...set.fields];
33
+ IndexVisitor.clearAggregated(set);
34
+ const builder = new contained_set_builder_1.ContainedSetBuilder(set);
35
+ for (const field of level0) {
36
+ builder.add(field);
37
+ }
38
+ }
39
+ static clearAggregated(set) {
40
+ set.fields.length = 0;
41
+ set.simple.clear();
42
+ set.groups.clear();
43
+ set.components.clear();
44
+ set.localNameToField.clear();
45
+ set.flattenedTag.length = 0;
46
+ set.localAttribute.length = 0;
47
+ set.nameToLocalAttribute.clear();
48
+ set.firstSimple = null;
49
+ set.containsRaw = false;
50
+ IndexVisitor.clearObject(set.containedTag);
51
+ IndexVisitor.clearObject(set.localTag);
52
+ IndexVisitor.clearObject(set.localRequired);
53
+ IndexVisitor.clearObject(set.tagToSimple);
54
+ IndexVisitor.clearObject(set.tagToField);
55
+ IndexVisitor.clearObject(set.containedLength);
56
+ const def = set;
57
+ if (def.noOfField) {
58
+ set.containedTag[def.noOfField.tag] = true;
59
+ }
60
+ }
61
+ static clearObject(obj) {
62
+ for (const k of Object.keys(obj)) {
63
+ delete obj[k];
64
+ }
65
+ }
66
+ }
67
+ exports.IndexVisitor = IndexVisitor;
68
+ //# sourceMappingURL=index-visitor.js.map
@@ -0,0 +1 @@
1
+ {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AC5C,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,WAAW,CAAE,GAA4B;QACtD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACH,CAAC;CACF;AA9ED,oCA8EC","sourcesContent":["/**\n * Post-processing reindexer for ContainedFieldSet.\n *\n * After the graph parser drains its work queue, parent sets may not yet\n * know about all tags in their nested groups/components — because those\n * children may have been resolved AFTER the parent. This visitor walks\n * every message/component/group definition in post-order (children first),\n * clears the aggregated tag indices, and re-adds direct fields via\n * ContainedSetBuilder, which propagates child tags upward correctly.\n *\n * Equivalent to the C# IndexVisitor + ContainedFieldSet.Index() pair.\n */\nimport { ContainedFieldSet } from '../../contained/contained-field-set'\nimport { ContainedField } from '../../contained/contained-field'\nimport { ContainedFieldType } from '../../contained/contained-field-type'\nimport { ContainedGroupField } from '../../contained/contained-group-field'\nimport { ContainedComponentField } from '../../contained/contained-component-field'\nimport { ContainedSetBuilder } from '../../contained/contained-set-builder'\nimport { FixDefinitions } from '../../definition/fix-definitions'\nimport { IContainedSet } from '../../contained/contained-set'\n\nexport class IndexVisitor {\n private readonly visited = new Set<IContainedSet>()\n\n /**\n * Reindex every message in the definitions. Components and groups are\n * reindexed transitively as they are encountered during message reindexing.\n */\n compute (definitions: FixDefinitions): void {\n // Use a Set to dedupe — definitions.message contains duplicate entries (by name + msgType + abbreviation)\n const messages = new Set(definitions.message.values())\n for (const msg of messages) {\n this.reindex(msg)\n }\n }\n\n /**\n * Reindex a single set: post-order traversal ensures every nested\n * group/component is fully indexed before its parent is rebuilt.\n */\n reindex (set: IContainedSet): void {\n if (this.visited.has(set)) return\n this.visited.add(set)\n\n // First, recurse into all child groups/components (post-order)\n for (const field of set.fields) {\n if (field.type === ContainedFieldType.Group) {\n const gf = field as ContainedGroupField\n if (gf.definition) this.reindex(gf.definition)\n } else if (field.type === ContainedFieldType.Component) {\n const cf = field as ContainedComponentField\n if (cf.definition) this.reindex(cf.definition)\n }\n }\n\n // Save direct fields, clear all aggregated state, re-add via builder\n const level0: ContainedField[] = [...set.fields]\n IndexVisitor.clearAggregated(set as ContainedFieldSet)\n\n const builder = new ContainedSetBuilder(set)\n for (const field of level0) {\n builder.add(field)\n }\n }\n\n /**\n * Reset every aggregated index on a set without touching its identity.\n * Direct fields are passed back via the return of clearAggregated for\n * the caller to re-add.\n */\n static clearAggregated (set: ContainedFieldSet): void {\n set.fields.length = 0\n set.simple.clear()\n set.groups.clear()\n set.components.clear()\n set.localNameToField.clear()\n set.flattenedTag.length = 0\n set.localAttribute.length = 0\n set.nameToLocalAttribute.clear()\n set.firstSimple = null\n set.containsRaw = false\n IndexVisitor.clearObject(set.containedTag)\n IndexVisitor.clearObject(set.localTag)\n IndexVisitor.clearObject(set.localRequired)\n IndexVisitor.clearObject(set.tagToSimple)\n IndexVisitor.clearObject(set.tagToField)\n IndexVisitor.clearObject(set.containedLength)\n // Re-add the noOfField tag for groups (otherwise the group counter is lost)\n const def = set as any\n if (def.noOfField) {\n set.containedTag[def.noOfField.tag] = true\n }\n }\n\n private static clearObject (obj: Record<string, unknown>): void {\n for (const k of Object.keys(obj)) {\n delete obj[k]\n }\n }\n}\n"]}
@@ -1 +1,8 @@
1
1
  export * from './quick-fix-xml-file-parser';
2
+ export * from './quick-fix-graph-parser';
3
+ export * from './quick-fix-graph-file-parser';
4
+ export * from './x-element';
5
+ export * from './sax-tree-builder';
6
+ export * from './dictionary-validator';
7
+ export * from './validation-error';
8
+ export * from './index-visitor';
@@ -15,4 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./quick-fix-xml-file-parser"), exports);
18
+ __exportStar(require("./quick-fix-graph-parser"), exports);
19
+ __exportStar(require("./quick-fix-graph-file-parser"), exports);
20
+ __exportStar(require("./x-element"), exports);
21
+ __exportStar(require("./sax-tree-builder"), exports);
22
+ __exportStar(require("./dictionary-validator"), exports);
23
+ __exportStar(require("./validation-error"), exports);
24
+ __exportStar(require("./index-visitor"), exports);
18
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/quickfix/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C","sourcesContent":["export * from './quick-fix-xml-file-parser'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/quickfix/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C;AAC3C,2DAAwC;AACxC,gEAA6C;AAC7C,8CAA2B;AAC3B,qDAAkC;AAClC,yDAAsC;AACtC,qDAAkC;AAClC,kDAA+B","sourcesContent":["export * from './quick-fix-xml-file-parser'\nexport * from './quick-fix-graph-parser'\nexport * from './quick-fix-graph-file-parser'\nexport * from './x-element'\nexport * from './sax-tree-builder'\nexport * from './dictionary-validator'\nexport * from './validation-error'\nexport * from './index-visitor'\n"]}
@@ -0,0 +1,13 @@
1
+ import { FixParser } from '../../fix-parser';
2
+ import { FixDefinitions } from '../../definition/fix-definitions';
3
+ import { GetJsFixLogger } from '../../../config';
4
+ import { MakeDuplex } from '../../../transport';
5
+ import { QuickFixGraphParserOptions } from './quick-fix-graph-parser';
6
+ export declare class QuickFixGraphFileParser extends FixParser {
7
+ readonly make: MakeDuplex;
8
+ readonly getLogger: GetJsFixLogger;
9
+ readonly options: QuickFixGraphParserOptions;
10
+ constructor(make: MakeDuplex, getLogger: GetJsFixLogger, options?: QuickFixGraphParserOptions);
11
+ parse(): Promise<FixDefinitions>;
12
+ private readAll;
13
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.QuickFixGraphFileParser = void 0;
13
+ const fix_parser_1 = require("../../fix-parser");
14
+ const fix_definitions_1 = require("../../definition/fix-definitions");
15
+ const sax_tree_builder_1 = require("./sax-tree-builder");
16
+ const quick_fix_graph_parser_1 = require("./quick-fix-graph-parser");
17
+ const fix_definition_source_1 = require("../../fix-definition-source");
18
+ const version_util_1 = require("../../version-util");
19
+ class QuickFixGraphFileParser extends fix_parser_1.FixParser {
20
+ constructor(make, getLogger, options = {}) {
21
+ super();
22
+ this.make = make;
23
+ this.getLogger = getLogger;
24
+ this.options = options;
25
+ }
26
+ parse() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ var _a, _b, _c;
29
+ const xml = yield this.readAll();
30
+ const doc = sax_tree_builder_1.SaxTreeBuilder.parse(xml);
31
+ const fixRoot = doc.firstDescendant('fix');
32
+ if (!fixRoot)
33
+ throw new Error('no <fix> root element');
34
+ const major = parseInt((_a = fixRoot.attribute('major')) !== null && _a !== void 0 ? _a : '0', 10);
35
+ const minor = parseInt((_b = fixRoot.attribute('minor')) !== null && _b !== void 0 ? _b : '0', 10);
36
+ const servicepack = parseInt((_c = fixRoot.attribute('servicepack')) !== null && _c !== void 0 ? _c : '0', 10);
37
+ const description = (major !== 5 || servicepack === 0)
38
+ ? `FIX.${major}.${minor}`
39
+ : `FIX.${major}.${minor}SP${servicepack}`;
40
+ const definitions = new fix_definitions_1.FixDefinitions(fix_definition_source_1.FixDefinitionSource.QuickFix, version_util_1.VersionUtil.resolve(description));
41
+ const parser = new quick_fix_graph_parser_1.QuickFixGraphParser(definitions, this.options);
42
+ return parser.parseDocument(doc);
43
+ });
44
+ }
45
+ readAll() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const duplex = this.make();
48
+ const readable = duplex.readable;
49
+ return yield new Promise((resolve, reject) => {
50
+ const chunks = [];
51
+ readable.on('data', (chunk) => {
52
+ chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
53
+ });
54
+ readable.on('end', () => {
55
+ resolve(Buffer.concat(chunks).toString('utf-8'));
56
+ });
57
+ readable.on('error', (err) => {
58
+ reject(err);
59
+ });
60
+ });
61
+ });
62
+ }
63
+ }
64
+ exports.QuickFixGraphFileParser = QuickFixGraphFileParser;
65
+ //# sourceMappingURL=quick-fix-graph-file-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quick-fix-graph-file-parser.js","sourceRoot":"","sources":["../../../../src/dictionary/parser/quickfix/quick-fix-graph-file-parser.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,iDAA4C;AAC5C,sEAAiE;AAGjE,yDAAmD;AACnD,qEAA0F;AAC1F,uEAAiE;AACjE,qDAAgD;AAEhD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,YACkB,IAAgB,EAChB,SAAyB,EACzB,UAAsC,EAAE;QAExD,KAAK,EAAE,CAAA;QAJS,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAgB;QACzB,YAAO,GAAP,OAAO,CAAiC;IAG1D,CAAC;IAEY,KAAK;;;YAChB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;YAChC,MAAM,GAAG,GAAG,iCAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAErC,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;YAC1C,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;YACtD,MAAM,KAAK,GAAG,QAAQ,CAA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C,CAAA;gBACrE,CAAC,CAAC,CAAA;gBACF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBACtB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;gBAClD,CAAC,CAAC,CAAA;gBACF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;oBAClC,MAAM,CAAC,GAAG,CAAC,CAAA;gBACb,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAhDD,0DAgDC","sourcesContent":["/**\n * Drop-in replacement for QuickFixXmlFileParser that uses the graph-based\n * parser internally. Maintains the same constructor signature so it can be\n * swapped in the DefinitionFactory without changes to call sites.\n */\nimport { FixParser } from '../../fix-parser'\nimport { FixDefinitions } from '../../definition/fix-definitions'\nimport { GetJsFixLogger } from '../../../config'\nimport { MakeDuplex } from '../../../transport'\nimport { SaxTreeBuilder } from './sax-tree-builder'\nimport { QuickFixGraphParser, QuickFixGraphParserOptions } from './quick-fix-graph-parser'\nimport { FixDefinitionSource } from '../../fix-definition-source'\nimport { VersionUtil } from '../../version-util'\n\nexport class QuickFixGraphFileParser extends FixParser {\n constructor (\n public readonly make: MakeDuplex,\n public readonly getLogger: GetJsFixLogger,\n public readonly options: QuickFixGraphParserOptions = {}\n ) {\n super()\n }\n\n public async parse (): Promise<FixDefinitions> {\n const xml = await this.readAll()\n const doc = SaxTreeBuilder.parse(xml)\n\n const fixRoot = doc.firstDescendant('fix')\n if (!fixRoot) throw new Error('no <fix> root element')\n const major = parseInt(fixRoot.attribute('major') ?? '0', 10)\n const minor = parseInt(fixRoot.attribute('minor') ?? '0', 10)\n const servicepack = parseInt(fixRoot.attribute('servicepack') ?? '0', 10)\n const description = (major !== 5 || servicepack === 0)\n ? `FIX.${major}.${minor}`\n : `FIX.${major}.${minor}SP${servicepack}`\n\n const definitions = new FixDefinitions(FixDefinitionSource.QuickFix, VersionUtil.resolve(description))\n const parser = new QuickFixGraphParser(definitions, this.options)\n return parser.parseDocument(doc)\n }\n\n /**\n * Read the entire duplex stream into a UTF-8 string. The graph parser\n * needs the full document in memory because it walks the XDocument tree\n * with random access — unlike the legacy SAX-streaming parser.\n */\n private async readAll (): Promise<string> {\n const duplex = this.make()\n const readable = duplex.readable\n return await new Promise<string>((resolve, reject) => {\n const chunks: Buffer[] = []\n readable.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n })\n readable.on('end', () => {\n resolve(Buffer.concat(chunks).toString('utf-8'))\n })\n readable.on('error', (err: Error) => {\n reject(err)\n })\n })\n }\n}\n"]}
@@ -0,0 +1,73 @@
1
+ import { XDocument, XNode } from './x-element';
2
+ import { DictionaryValidator } from './dictionary-validator';
3
+ import { FixDefinitions } from '../../definition/fix-definitions';
4
+ import { SimpleFieldDefinition } from '../../definition/simple-field-definition';
5
+ import { MessageDefinition } from '../../definition/message-definition';
6
+ export declare enum NodeElementType {
7
+ MessageDefinition = "MessageDefinition",
8
+ SimpleFieldDefinition = "SimpleFieldDefinition",
9
+ SimpleFieldDeclaration = "SimpleFieldDeclaration",
10
+ InlineGroupDefinition = "InlineGroupDefinition",
11
+ GroupDefinition = "GroupDefinition",
12
+ GroupDeclaration = "GroupDeclaration",
13
+ ComponentDefinition = "ComponentDefinition",
14
+ ComponentDeclaration = "ComponentDeclaration"
15
+ }
16
+ export interface Edge {
17
+ readonly head: number;
18
+ readonly tail: number;
19
+ }
20
+ export declare class GraphNode {
21
+ readonly id: number;
22
+ readonly name: string;
23
+ readonly type: NodeElementType;
24
+ readonly element: XNode;
25
+ private readonly _edges;
26
+ constructor(id: number, name: string, type: NodeElementType, element: XNode);
27
+ get edges(): ReadonlyArray<Edge>;
28
+ makeEdge(tail: number): Edge;
29
+ isRequired(): boolean;
30
+ toString(): string;
31
+ }
32
+ export interface QuickFixGraphParserOptions {
33
+ validateBeforeParsing?: boolean;
34
+ }
35
+ export declare class QuickFixGraphParser {
36
+ private readonly definitions;
37
+ private readonly nodes;
38
+ private readonly containedSets;
39
+ private readonly queue;
40
+ private nextId;
41
+ private header;
42
+ private trailer;
43
+ validator: DictionaryValidator | null;
44
+ readonly validateBeforeParsing: boolean;
45
+ constructor(definitions: FixDefinitions, options?: QuickFixGraphParserOptions);
46
+ parseText(xml: string): FixDefinitions;
47
+ parseDocument(doc: XDocument): FixDefinitions;
48
+ private makeNode;
49
+ private constructTailNode;
50
+ private parseVersion;
51
+ private parseFields;
52
+ private parseComponents;
53
+ private parseHeader;
54
+ private parseTrailer;
55
+ private parseMessages;
56
+ private work;
57
+ private getComponentDefinition;
58
+ private componentDeclaration;
59
+ private messageDefinition;
60
+ private componentDefinition;
61
+ private groupDefinition;
62
+ private inlineGroupDefinition;
63
+ private simpleFieldDeclaration;
64
+ private expandSet;
65
+ private expandField;
66
+ private expandGroup;
67
+ private expandComponent;
68
+ private expandSetChild;
69
+ static nameFrom(element: XNode): string;
70
+ static getField(element: XNode): SimpleFieldDefinition;
71
+ static getMessage(element: XNode): MessageDefinition;
72
+ static parse(xml: string, options?: QuickFixGraphParserOptions): FixDefinitions;
73
+ }