aaronhuggins / node-x12

ASC X12 parser, generator, query engine, and mapper; now with support for streams.
https://aaronhuggins.github.io/node-x12/
MIT License
49 stars 14 forks source link

997 TA1 valid EDI #46

Open Jelenbl opened 8 months ago

Jelenbl commented 8 months ago

Error while processing EDI 997 message. Valid 997 can be structured as ISA->TA1->GS .... GE->IEA

Reproduce -

import { X12Parser } from 'node-x12'

const parser = new X12Parser(true) const edi997 = 'payload' const interchange = parser.parse(${edi997})

sample : TA10000000992111121230A*000

ERROR:

ParserError: X12 Standard: TA1 segment cannot appear outside of a functional group. at X12Parser._processSegment (/Users/joshua/Documents/Coding/Scripts/node_modules/node-x12/index.js:861:27) at ../node_modules/node-x12/index.js:653:22 at Array.forEach () at X12Parser.parse (../node_modules/node-x12/index.js:652:22) at file:///../parsingEDI.js:5:26 at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:385:24) at async loadESM (node:internal/process/esm_loader:88:5) at async handleMainPromise (node:internal/modules/run_main:61:12)

aaronhuggins commented 8 months ago

@Jelenbl I can't read your report. Please reformat so I can understand quoted vs JavaScript vs output vs sample.

Please also provide an attached text file with a sample 997 and steps to reproduce, as well as the version number of the library.

Thanks!

Jelenbl commented 8 months ago

@aaronhuggins - Is this more legible?

Situation:

Error while processing EDI 997 message. Valid 997 can be structured as ISA->TA1->GS .... GE->IEA

Sample script

import { X12Parser } from 'node-x12'

const parser = new X12Parser(true)
const edi997 = 'payload'
const interchange = parser.parse(${edi997})

Sample Payload

ISA*00*          *00*          *02*FAKE1          *ZZ*FAKE2          *231102*1338*U*00401*000000717*1*T*>~TA1*000000099*211112*1230*A*000~GS*FA*FAKE1*FAKE2*20231102*1338*717*X*004010~ST*997*00717~AK1*SM*3~AK2*204*0001~AK5*A~AK9*A*1*1*1~SE*6*00717~GE*1*717~IEA*1*000000717

Error Response

ParserError: X12 Standard: TA1 segment cannot appear outside of a functional group.
at X12Parser._processSegment (/Users/joshua/Documents/Coding/Scripts/node_modules/node-x12/index.js:861:27)
at ../node_modules/node-x12/index.js:653:22
at Array.forEach ()
at X12Parser.parse (../node_modules/node-x12/index.js:652:22)
at file:///../parsingEDI.js:5:26
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
aaronhuggins commented 8 months ago

@Jelenbl That's much better, thank you! I think I can work with that. Do you also have the library version you're using?

Jelenbl commented 8 months ago

"node-x12": "^1.7.1",

Jelenbl commented 7 months ago

Any update?

EthanMCunningham commented 3 months ago

Any Updates on a fix for this issue?