Skip to content

Commit

Permalink
docs: updating docs
Browse files Browse the repository at this point in the history
* Enumeration's done
* general lint formatting issues

#13

[ci skip]
  • Loading branch information
Bugs5382 committed Dec 20, 2023
1 parent a89981c commit 41f0efb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/client/hl7Outbound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import net, { Socket } from 'node:net'
import tls from 'node:tls'
import { Batch } from '../builder/batch.js'
import { Message } from '../builder/message.js'
import {CR, FS, VT} from "../utils/constants";
import { CR, FS, VT } from '../utils/constants.js'
import { ReadyState } from '../utils/enum.js'
import { HL7FatalError } from '../utils/exception.js'
import { ClientListenerOptions, normalizeClientListenerOptions } from '../utils/normalizedClient.js'
import { expBackoff, randomString } from '../utils/utils.js'
import { Client } from './client.js'
import {InboundResponse} from "./module/inboundResponse";
import { InboundResponse } from './module/inboundResponse.js'

/**
* Outbound Handler
* @since 1.0.0
*/
export type OutboundHandler = (res: InboundResponse) => Promise<void>

/** HL7 Outbound Class
Expand Down
6 changes: 2 additions & 4 deletions src/client/module/inboundResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Message} from "../../builder/message.js";

import { Message } from '../../builder/message.js'

/**
* Inbound Request
Expand All @@ -16,7 +15,7 @@ export class InboundResponse {
* @param data
*/
constructor (data: string) {
this._message = new Message({text: data.toString()})
this._message = new Message({ text: data.toString() })
}

/** '
Expand All @@ -27,5 +26,4 @@ export class InboundResponse {
getMessage (): Message {
return this._message
}

}
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { NodeBase } from './builder/modules/nodeBase.js'
import { EmptyNode } from './builder/modules/emptyNode.js'
import { ValueNode } from './builder/modules/valueNode.js'
import { RootBase } from './builder/modules/rootBase.js'
import { Node } from './builder/interface/node.js'
import { Client } from './client/client.js'
import { Component } from './builder/modules/component.js'
Expand Down Expand Up @@ -52,4 +54,4 @@ export type { ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuild
export type { HL7Error, HL7FatalError, HL7ParserError } from './utils/exception.js'

export default Client
export { Client, HL7Outbound, OutboundHandler, FileBatch, Batch, Message, Segment, SegmentList, Component, SubComponent, Field, FieldRepetition, ParserPlan, Node, NodeBase, EmptyNode, Delimiters, ReadyState }
export { Client, HL7Outbound, OutboundHandler, FileBatch, Batch, Message, Segment, SegmentList, Component, SubComponent, Field, FieldRepetition, ParserPlan, Node, RootBase, NodeBase, ValueNode, EmptyNode, Delimiters, ReadyState }
1 change: 0 additions & 1 deletion src/specification/2.7.1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Message } from '../builder/message.js'
import { randomString } from '../utils/utils.js'
import { HL7_2_7 } from './2.7.js'

/**
Expand Down
1 change: 0 additions & 1 deletion src/specification/2.7.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Message } from '../builder/message.js'
import { randomString } from '../utils/utils.js'
import { HL7_2_6 } from './2.6.js'

/**
Expand Down
1 change: 0 additions & 1 deletion src/specification/2.8.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Message } from '../builder/message.js'
import { randomString } from '../utils/utils.js'
import { HL7_2_7_1 } from './2.7.1.js'

/**
Expand Down
6 changes: 3 additions & 3 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @internal */
export const VT = String.fromCharCode(0x0b);
export const VT = String.fromCharCode(0x0b)

/** @internal */
export const FS = String.fromCharCode(0x1c);
export const FS = String.fromCharCode(0x1c)

/** @internal */
export const CR = String.fromCharCode(0x0d);
export const CR = String.fromCharCode(0x0d)
13 changes: 13 additions & 0 deletions src/utils/enum.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
/**
* Type of Segments Values
* @description Used during the class creation to give each type its own index value.
* This is done during the constructor phase of the classes.
* @since 1.0.0
*/
export enum Delimiters {
/** Usually each line of the overall HL7 Message. */
Segment,
/** The field of each segment. Usually separated with a | */
Field,
/** Usually within each Field, seperated by ^ */
Component,
/** Usually within each Component, seperated by & */
Repetition,
/** The escape string used within the code. */
Escape,
/** Usually within each Field, seperated by ~ */
SubComponent
}

/**
* State of the Connected to the Server
* @description These are the states that are used to track the connecting to the server side and also during the auto-reconnect phase.
* @since 1.0.0
*/
export enum ReadyState {
/** The client is trying to connect to the server. */
CONNECTING,
/** The client is connected to the server. */
CONNECTED,
/** The client is open, but not yet trying to connect to the server. */
OPEN,
/** The client is closing the connection by force or by timeout */
CLOSING,
/** The client connection is closed. */
CLOSED
}

0 comments on commit 41f0efb

Please sign in to comment.