- X12Element
- X12FatInterchange
- X12FunctionalGroup
- X12Generator
- X12Interchange
- X12Parser
- X12QueryEngine
- X12Segment
- X12SerializationOptions
Class instance wrapper for serialization options.
- X12Transaction
- X12TransactionMap
- X12SerializationOptions ⇒
X12SerializationOptions Set default values for any missing X12SerializationOptions in an options object.
- X12QueryResult :
object A result as resolved by the query engine.
Create an element.
| Param | Type | Description |
|---|---|---|
| value | string |
A value for this element. |
Kind: global class
- X12FatInterchange
- new X12FatInterchange([items], [options])
- .toString([options]) ⇒
string - .toJSEDINotation() ⇒
Array.<JSEDINotation> - .toJSON() ⇒
Array.<object>
Create a fat interchange.
| Param | Type | Description |
|---|---|---|
| [items] | Array.<X12Interchange> | X12SerializationOptions |
The items for this array or options for this interchange. |
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize fat interchange to EDI string.
Kind: instance method of
X12FatInterchange
Returns: string -
This fat interchange converted to EDI string.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options to override serializing back to EDI. |
Serialize interchange to JS EDI Notation object.
Kind: instance method of
X12FatInterchange
Returns: Array.<JSEDINotation> -
This fat interchange converted to an array of JS EDI notation.
Serialize interchange to JSON object.
Kind: instance method of
X12FatInterchange
Returns: Array.<object> -
This fat interchange converted to an array of objects.
Kind: global class
Create a functional group.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Set a GS header on this functional group.
Kind: instance method of
X12FunctionalGroup
| Param | Type | Description |
|---|---|---|
| elements | Array.<string> |
An array of elements for a GS header. |
x12FunctionalGroup.addTransaction() ⇒ X12Transaction
Add a transaction set to this functional group.
Kind: instance method of
X12FunctionalGroup
Returns: X12Transaction -
The transaction which was added to this functional group.
Serialize functional group to EDI string.
Kind: instance method of
X12FunctionalGroup
Returns: string -
This functional group converted to EDI string.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize functional group to JSON object.
Kind: instance method of
X12FunctionalGroup
Returns: object -
This functional group converted to an object.
Kind: global class
Factory for generating EDI from JS EDI Notation.
| Param | Type | Description |
|---|---|---|
| [jsen] | JSEDINotation |
Javascript EDI Notation object to serialize. |
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Set the JS EDI Notation for this instance.
Kind: instance method of X12Generator
| Param | Type | Description |
|---|---|---|
| [jsen] | JSEDINotation |
Javascript EDI Notation object to serialize. |
Get the JS EDI Notation for this instance.
Kind: instance method of X12Generator
Returns: JSEDINotation -
The JS EDI Notation for this instance.
Set the serialization options for this instance.
Kind: instance method of X12Generator
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
x12Generator.getOptions() ⇒ X12SerializationOptions
Get the serialization options for this instance.
Kind: instance method of X12Generator
Returns: X12SerializationOptions -
The serialization options for this instance.
\x12Generator.validate() ⇒ X12Interchange
Validate the EDI in this instance.
Kind: instance method of X12Generator
Returns: X12Interchange -
This instance converted to an interchange.
Serialize the EDI in this instance.
Kind: instance method of X12Generator
Returns: string -
This instance converted to an EDI string.
Kind: global class
Create an interchange.
| Param | Type | Description |
|---|---|---|
| [segmentTerminator] | string | X12SerializationOptions |
A character to terminate segments when serializing; or an instance of X12SerializationOptions. |
| [elementDelimiter] | string |
A character to separate elements when serializing; only required when segmentTerminator is a character. |
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Set an ISA header on this interchange.
Kind: instance method of X12Interchange
| Param | Type | Description |
|---|---|---|
| elements | Array.<string> |
An array of elements for an ISA header. |
x12Interchange.addFunctionalGroup([options]) ⇒ X12FunctionalGroup
Add a functional group to this interchange.
Kind: instance method of X12Interchange
Returns: X12FunctionalGroup -
The functional group added to this interchange.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize interchange to EDI string.
Kind: instance method of X12Interchange
Returns: string -
This interchange converted to an EDI string.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize interchange to JS EDI Notation object.
Kind: instance method of X12Interchange
Returns: JSEDINotation -
This interchange converted to JS EDI Notation object.
Serialize interchange to JSON object.
Kind: instance method of X12Interchange
Returns: object -
This interchange converted to an object.
Kind: global class
Factory for parsing EDI into interchange object.
| Param | Type | Description |
|---|---|---|
| [strict] | boolean | X12SerializationOptions |
Set true to strictly follow the EDI spec; defaults to false. |
| [encoding] | string | X12SerializationOptions |
The encoding to use for this instance when parsing a stream; defaults to UTF-8. |
| [options] | X12SerializationOptions |
The options to use when parsing a stream. |
x12Parser.parse(edi, [options]) ⇒ X12Interchange | X12FatInterchange
Parse an EDI document.
Kind: instance method of X12Parser
Returns: X12Interchange |
X12FatInterchange -
An interchange or fat interchange.
| Param | Type | Description |
|---|---|---|
| edi | string |
An ASCII or UTF8 string of EDI to parse. |
| [options] | X12SerializationOptions |
Options for serializing from EDI. |
x12Parser.getInterchangeFromSegments(segments, [options]) ⇒ X12Interchange | X12FatInterchange
Method for processing an array of segments into the node-x12 object model; typically used with the finished output of a stream.
Kind: instance method of X12Parser
Returns: X12Interchange |
X12FatInterchange -
An interchange or fat interchange.
| Param | Type | Description |
|---|---|---|
| segments | Array.<X12Segment> |
An array of X12Segment objects. |
| [options] | X12SerializationOptions |
Options for serializing from EDI. |
Flush method for Node API Transform stream.
Kind: instance method of X12Parser
| Param | Type | Description |
|---|---|---|
| callback | function |
Callback to execute when finished. |
Transform method for Node API Transform stream.
Kind: instance method of X12Parser
| Param | Type | Description |
|---|---|---|
| chunk | object |
A chunk of data from the read stream. |
| encoding | string |
Chunk enoding. |
| callback | function |
Callback signalling chunk is processed and instance is ready for next chunk. |
Kind: global class
Factory for querying EDI using the node-x12 object model.
| Param | Type | Default | Description |
|---|---|---|---|
| [parser] | X12Parser | boolean |
true |
Pass an external parser or set the strictness of the internal parser. |
x12QueryEngine.query(rawEdi, reference, [defaultValue]) ⇒ Array.<X12QueryResult>
Query all references in an EDI document.
Kind: instance method of X12QueryEngine
Returns: Array.<X12QueryResult> -
An array of results from the EDI document.
| Param | Type | Default | Description |
|---|---|---|---|
| rawEdi | string | X12Interchange |
An ASCII or UTF8 string of EDI to parse, or an interchange. |
|
| reference | string |
The query string to resolve. |
|
| [defaultValue] | string |
null |
A default value to return if result not found. |
x12QueryEngine.querySingle(rawEdi, reference, [defaultValue]) ⇒ X12QueryResult
Query all references in an EDI document and return the first result.
Kind: instance method of X12QueryEngine
Returns: X12QueryResult -
A result from the EDI document.
| Param | Type | Default | Description |
|---|---|---|---|
| rawEdi | string | X12Interchange |
An ASCII or UTF8 string of EDI to parse, or an interchange. |
|
| reference | string |
The query string to resolve. |
|
| [defaultValue] | string |
null |
A default value to return if result not found. |
Kind: global class
- X12Segment
- new X12Segment(tag, [options])
- .setTag(tag)
- .setElements(values) ⇒
this - .addElement(value) ⇒
X12Element - .replaceElement(value, segmentPosition) ⇒
X12Element - .insertElement(value, segmentPosition) ⇒
X12Element - .removeElement(segmentPosition) ⇒
boolean - .valueOf(segmentPosition, [defaultValue]) ⇒
string - .toString([options]) ⇒
string - .toJSON() ⇒
object
Create a segment.
| Param | Type | Description |
|---|---|---|
| tag | string |
The tag for this segment. |
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Set the tag name for the segment if not provided when constructed.
Kind: instance method of X12Segment
| Param | Type | Description |
|---|---|---|
| tag | string |
The tag for this segment. |
Set the elements of this segment.
Kind: instance method of X12Segment
Returns: this -
The current instance of X12Segment.
| Param | Type | Description |
|---|---|---|
| values | Array.<string> |
An array of element values. |
x12Segment.addElement(value) ⇒ X12Element
Add an element to this segment.
Kind: instance method of X12Segment
Returns: X12Element -
The element that was added to this segment.
| Param | Type | Description |
|---|---|---|
| value | string |
A string value. |
x12Segment.replaceElement(value, segmentPosition) ⇒ X12Element
Replace an element at a position in the segment.
Kind: instance method of X12Segment
Returns: X12Element -
The new element if successful, or a null if failed.
| Param | Type | Description |
|---|---|---|
| value | string |
A string value. |
| segmentPosition | number |
A 1-based number indicating the position in the segment. |
x12Segment.insertElement(value, segmentPosition) ⇒ X12Element
Insert an element at a position in the segment.
Kind: instance method of X12Segment
Returns: X12Element -
The new element if successful, or a null if failed.
| Param | Type | Default | Description |
|---|---|---|---|
| value | string |
A string value. |
|
| segmentPosition | number |
1 |
A 1-based number indicating the position in the segment. |
Remove an element at a position in the segment.
Kind: instance method of X12Segment
Returns: boolean -
True if successful.
| Param | Type | Description |
|---|---|---|
| segmentPosition | number |
A 1-based number indicating the position in the segment. |
Get the value of an element in this segment.
Kind: instance method of X12Segment
Returns: string -
If no element is at this position, null or the default value will be returned.
| Param | Type | Description |
|---|---|---|
| segmentPosition | number |
A 1-based number indicating the position in the segment. |
| [defaultValue] | string |
A default value to return if there is no element found. |
Serialize segment to EDI string.
Kind: instance method of X12Segment
Returns: string -
This segment converted to an EDI string.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize transaction set to JSON object.
Kind: instance method of X12Segment
Returns: object -
This segment converted to an object.
Class instance wrapper for serialization options.
Kind: global class
Create a transaction set.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Set a ST header on this transaction set.
Kind: instance method of X12Transaction
| Param | Type | Description |
|---|---|---|
| elements | Array.<string> |
An array of elements for a ST header. |
x12Transaction.addSegment(tag, elements) ⇒ X12Segment
Add a segment to this transaction set.
Kind: instance method of X12Transaction
Returns: X12Segment -
The segment added to this transaction set.
| Param | Type | Description |
|---|---|---|
| tag | string |
The tag for this segment. |
| elements | Array.<string> |
An array of elements for this segment. |
Map data from a javascript object to this transaction set. Will use the txEngine property for Liquid support from this.options if available.
Kind: instance method of X12Transaction
| Param | Type | Description |
|---|---|---|
| input | object |
The input object to create the transaction from. |
| map | object |
The javascript object containing keys and querys to resolve. |
| [macro] | object |
A macro object to add or override methods for the macro directive; properties 'header' and 'segments' are reserved words. |
Map data from a transaction set to a javascript object.
Kind: instance method of X12Transaction
Returns: object -
An object containing resolved values mapped to object keys.
| Param | Type | Description |
|---|---|---|
| map | object |
The javascript object containing keys and querys to resolve. |
| helper | function |
A helper function which will be executed on every resolved query value. |
Serialize transaction set to EDI string.
Kind: instance method of X12Transaction
Returns: string -
This transaction set converted to an EDI string.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing back to EDI. |
Serialize transaction set to JSON object.
Kind: instance method of X12Transaction
Returns: object -
This transaction set converted to an object.
Kind: global class
Factory for mapping transaction set data to javascript object map.
| Param | Type | Description |
|---|---|---|
| map | object |
The javascript object containing keys and querys to resolve. |
| [transaction] | X12Transaction |
A transaction set to map. |
| [helper] | function | 'liquidjs' | 'internal' |
A helper function which will be executed on every resolved query value, or a macro engine. |
| [txEngine] | 'liquidjs' | 'internal' |
A macro engine to use; either 'internal' or 'liquidjs'; defaults to internal for backwords compatibility. |
Set the transaction set to map and optionally a helper function.
Kind: instance method of
X12TransactionMap
| Param | Type | Description |
|---|---|---|
| transaction | X12Transaction |
A transaction set to map. |
| helper | function |
A helper function which will be executed on every resolved query value. |
x12TransactionMap.getTransaction() ⇒ X12Transaction
Set the transaction set to map and optionally a helper function.
Kind: instance method of
X12TransactionMap
Returns: X12Transaction -
The transaction from this instance.
Map data from the transaction set to a javascript object.
Kind: instance method of
X12TransactionMap
Returns: object | Array.<object> -
The transaction set mapped to an object or an array of objects.
| Param | Type | Description |
|---|---|---|
| [map] | object |
The javascript object containing keys and querys to resolve. |
| [callback] | function |
A callback function which will be passed to the helper function. |
x12TransactionMap.fromObject(input, [map], [macroObj]) ⇒ X12Transaction
Map data from a javascript object to the transaction set.
Kind: instance method of
X12TransactionMap
Returns: X12Transaction -
The transaction created from the object values.
| Param | Type | Default | Description |
|---|---|---|---|
| input | object |
The input object to create the transaction from. |
|
| [map] | object |
The map to associate values from the input to the transaction, or a macro object. |
|
| [macroObj] | object |
{} |
A macro object to add or override methods for the macro directive; properties 'header' and 'segments' are reserved words. |
X12SerializationOptions ⇒ X12SerializationOptions
Set default values for any missing X12SerializationOptions in an options object.
Kind: global variable
Returns: X12SerializationOptions -
Serialization options with defaults filled in.
| Param | Type | Description |
|---|---|---|
| [options] | X12SerializationOptions |
Options for serializing to and from EDI. |
A result as resolved by the query engine.
Kind: global typedef
Properties
| Name | Type | Default |
|---|---|---|
| interchange | X12Interchange |
|
| functionalGroup | X12FunctionalGroup |
|
| transaction | X12Transaction |
|
| segment | X12Segment |
|
| element | X12Element |
|
| [value] | string |
null |
| [values] | Array.<(string|Array.<string>)> |
[] |