fastify-hl7 2.2.0 → 3.1.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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ If you are using this NPM package, please consider giving it a :star: star.
9
9
  This will increase its visibility and solicit more contribution from the outside.
10
10
 
11
11
  This documentation is how to use this plugin, not on how to use the libraries above.
12
- Head [here](#external-libraries) if you need help with those.
12
+ Head [here](#external-libraries-options) if you need help with those.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -19,7 +19,7 @@ Head [here](#external-libraries) if you need help with those.
19
19
  2. [Client Quick Start](#client-quick-start)
20
20
  3. [Full Documentation](#full-documentation)
21
21
  1. [This Library Options](#this-library-options)
22
- 2. [External Libraries](#external-libraries)
22
+ 2. [External Libraries Options](#external-libraries-options)
23
23
  4. [Acknowledgements](#acknowledgements)
24
24
  5. [License](#license)
25
25
 
@@ -34,48 +34,51 @@ npm install fastify-hl7
34
34
  Register this as a plugin.
35
35
 
36
36
  ```ts
37
- await fastify.register(fastifyHL7)
37
+ await fastify.register(fastifyHL7);
38
38
  ```
39
39
 
40
40
  ### Server Quick Start
41
41
 
42
42
  ```ts
43
43
  const listener = fastify.hl7.createInbound(
44
- 'ib_adt',
45
- {port: 3001},
44
+ "ib_adt",
45
+ { port: 3001 },
46
46
  async (req, res) => {
47
- const messageReq = req.getMessage()
48
- const messageType = req.getType()
47
+ const messageReq = req.getMessage();
48
+ const messageType = req.getType();
49
49
  // your logic here
50
- await res.sendResponse('AA')
51
- })
50
+ await res.sendResponse("AA");
51
+ },
52
+ );
52
53
  ```
53
- This will create a inbound connection. You can optionally return it to a variable to attach advanced listeners.
54
+
55
+ This will create a inbound connection. You can optionally return it to a variable to attach advanced listeners.
54
56
 
55
57
  ### Client Quick Start
56
58
 
57
59
  ```ts
58
60
  import fastify from "fastify";
59
61
 
60
- fastify.hl7.createClient('localhost', {host: '0.0.0.0'})
62
+ fastify.hl7.createClient("localhost", { host: "0.0.0.0" });
61
63
  ```
62
64
 
63
65
  This will create a "client" class that will then allow you to attach different outbound connections.
64
- The name ```localhost``` in a unique identifier to this host, so it can be used to attach different outbound connections to this server/broker.
66
+ The name `localhost` in a unique identifier to this host, so it can be used to attach different outbound connections to this server/broker.
65
67
 
66
68
  There might be times when your HL7 messages need to cross-over to different hosts/server/inbound endpoints and this is how you would get them.
67
69
 
68
- Within your code now you can use the fastify context and access the ```hl7``` decorator,
70
+ Within your code now you can use the fastify context and access the `hl7` decorator,
69
71
  and create an outbound connection.
70
72
 
71
73
  ```ts
72
74
  const client = fastify.hl7.createConnection(
73
- 'ob_adt',
74
- {port: 3001},
75
+ "ob_adt",
76
+ { port: 3001 },
75
77
  async (res) => {
76
- const messageRes = res.getMessage()
78
+ const messageRes = res.getMessage();
77
79
  // Your code here. Either a failure or a success, but still do your work here.
78
- })
80
+ },
81
+ );
79
82
 
80
83
  // building a HL7 Message Segment
81
84
  const message = app.hl7.buildMessage({
@@ -83,10 +86,10 @@ const message = app.hl7.buildMessage({
83
86
  msh_9_1: "ADT",
84
87
  msh_9_2: "A01",
85
88
  msh_11_1: "D",
86
- }
87
- })
89
+ },
90
+ });
88
91
 
89
- await client.sendMessage(message)
92
+ await client.sendMessage(message);
90
93
  ```
91
94
 
92
95
  ## Full Documentation
@@ -95,21 +98,19 @@ await client.sendMessage(message)
95
98
 
96
99
  ### `enableServer`
97
100
 
98
- If this is not set, enableServer will be set to ```true```. You need to set this to ```false``` will turn off the server capabilities.
99
-
101
+ If this is not set, enableServer will be set to `true`. You need to set this to `false` will turn off the server capabilities.
100
102
 
101
- ### ```serverOptions```
103
+ ### `serverOptions`
102
104
 
103
105
  Set this using the options from the [node-hl7-serer](https://github.com/Bugs5382/node-hl7-server/blob/main/README.md) library ServerOptions values to override server creation.
104
106
  This could be enabling IPv4 or IPv6 and other server options including TLS. Since you cannot set this after run time, it has to be set during registration.
105
107
 
106
- ### External Libraries
108
+ ### External Libraries Options
107
109
 
108
- * [node-hl7-client](https://github.com/Bugs5382/node-hl7-client/blob/main/README.md) - For the Client, Parser, and Builder to review their options that can be passed as props.
109
- * [node-hl7-server](https://github.com/Bugs5382/node-hl7-server/blob/main/README.md) - For the Server to the options that can be passed as props.
110
+ - [node-hl7-client](https://github.com/Bugs5382/node-hl7-client/blob/main/README.md) - For the Client, Parser, and Builder to review their options that can be passed as props.
111
+ - [node-hl7-server](https://github.com/Bugs5382/node-hl7-server/blob/main/README.md) - For the Server to the options that can be passed as props.
110
112
 
111
- Please review the library for more complete documentation.
112
- A far as this plugin for Fastify, there are no options to pass.
113
+ Please review the libraries for more complete documentation.
113
114
 
114
115
  ## Acknowledgements
115
116
 
@@ -117,4 +118,4 @@ A far as this plugin for Fastify, there are no options to pass.
117
118
 
118
119
  ## License
119
120
 
120
- Licensed under [MIT](./LICENSE).
121
+ Licensed under [MIT](./LICENSE).
@@ -35,7 +35,7 @@ class HL7Client {
35
35
  * @since 1.0.0
36
36
  */
37
37
  async closeAll() {
38
- this._clientConnections.forEach(outbound => {
38
+ this._clientConnections.forEach((outbound) => {
39
39
  outbound.ports.map(async (port) => {
40
40
  await port.connection.close();
41
41
  });
@@ -44,19 +44,19 @@ class HL7Client {
44
44
  }
45
45
  /**
46
46
  * Build a HL7 Batch
47
- * @description Create a properly formatted HL7 Batch.
47
+ *@remarks Create a properly formatted HL7 Batch.
48
48
  * @since 1.0.0
49
49
  * @param props
50
50
  */
51
51
  buildBatch(props) {
52
- if (typeof props !== 'undefined' && typeof props.text !== 'undefined') {
53
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
52
+ if (typeof props !== "undefined" && typeof props.text !== "undefined") {
53
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("Use processMessage method. This is for building.");
54
54
  }
55
55
  return new node_hl7_client_1.Batch({ ...props });
56
56
  }
57
57
  /**
58
58
  * Build Date
59
- * @description Build a date string based off HL7 Standards
59
+ *@remarks Build a date string based off HL7 Standards
60
60
  * @since 2.1.0
61
61
  * @param date
62
62
  * @param length Options are 8, 12, or 14 (default)
@@ -66,25 +66,27 @@ class HL7Client {
66
66
  }
67
67
  /**
68
68
  * Build a HL7 File Batch
69
- * @description Create a properly formatted HL7 File Batch.
69
+ *@remarks Create a properly formatted HL7 File Batch.
70
70
  * @since 1.0.0
71
71
  * @param props
72
72
  */
73
73
  buildFileBatch(props) {
74
- if (typeof props !== 'undefined' && (typeof props.fullFilePath !== 'undefined' || typeof props.fileBuffer !== 'undefined')) {
75
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use readFile or readFileBuffer method. This is for building.');
74
+ if (typeof props !== "undefined" &&
75
+ (typeof props.fullFilePath !== "undefined" ||
76
+ typeof props.fileBuffer !== "undefined")) {
77
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("Use readFile or readFileBuffer method. This is for building.");
76
78
  }
77
79
  return new node_hl7_client_1.FileBatch({ ...props });
78
80
  }
79
81
  /**
80
82
  * Build a HL7 Message
81
- * @description Create a properly formatted HL7 message.
83
+ *@remarks Create a properly formatted HL7 message.
82
84
  * @since 1.0.0
83
85
  * @param props
84
86
  */
85
87
  buildMessage(props) {
86
- if (typeof props !== 'undefined' && typeof props.text !== 'undefined') {
87
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
88
+ if (typeof props !== "undefined" && typeof props.text !== "undefined") {
89
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("Use processMessage method. This is for building.");
88
90
  }
89
91
  return new node_hl7_client_1.Message({ ...props });
90
92
  }
@@ -96,12 +98,12 @@ class HL7Client {
96
98
  createClient(name, props) {
97
99
  const nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
98
100
  if (nameFormat.test(name)) {
99
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
101
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~.");
100
102
  }
101
103
  // make sure that this does not exist already...
102
104
  this._clientConnections.forEach((connections) => {
103
105
  if (connections.name === name) {
104
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must be unique.');
106
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("name must be unique.");
105
107
  }
106
108
  // nto in the Client class yet
107
109
  // if (client.getHost() === props.host) {
@@ -114,13 +116,13 @@ class HL7Client {
114
116
  this._clientConnections.push({
115
117
  name,
116
118
  client,
117
- ports: []
119
+ ports: [],
118
120
  });
119
121
  return client;
120
122
  }
121
123
  /**
122
124
  * Create an HL7 Outbound Connection
123
- * @description Connect to an HL7 Server/Broker
125
+ *@remarks Connect to an HL7 Server/Broker
124
126
  * @since 1.0.0
125
127
  * @param name The name stored within created client connections.
126
128
  * @param props
@@ -129,10 +131,10 @@ class HL7Client {
129
131
  createConnection(name, props, handler) {
130
132
  const nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
131
133
  if (nameFormat.test(name)) {
132
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
134
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~.");
133
135
  }
134
- const getConnection = this._clientConnections.find(client => client.name === name);
135
- if (typeof getConnection !== 'undefined') {
136
+ const getConnection = this._clientConnections.find((client) => client.name === name);
137
+ if (typeof getConnection !== "undefined") {
136
138
  // make sure port is not used all ready
137
139
  getConnection.ports.forEach((outbound) => {
138
140
  if (outbound.port === props.port.toString()) {
@@ -142,11 +144,14 @@ class HL7Client {
142
144
  // create outbound port to the server in getConnection.client
143
145
  const outbound = new node_hl7_client_1.Connection(getConnection.client, props, handler);
144
146
  // add it to the array of known ports. need to know this, so we can get it later if needed.
145
- getConnection.ports.push({ port: props.port.toString(), connection: outbound });
147
+ getConnection.ports.push({
148
+ port: props.port.toString(),
149
+ connection: outbound,
150
+ });
146
151
  // return it right away. the user might do something with it.
147
152
  return outbound;
148
153
  }
149
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('No valid client. Improper setup of a outbound connection.');
154
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("No valid client. Improper setup of a outbound connection.");
150
155
  }
151
156
  /**
152
157
  * Get Client by the name
@@ -154,8 +159,8 @@ class HL7Client {
154
159
  * @param name
155
160
  */
156
161
  getClientByName(name) {
157
- const connection = this._clientConnections.find(connection => connection.name === name);
158
- if (typeof connection !== 'undefined') {
162
+ const connection = this._clientConnections.find((connection) => connection.name === name);
163
+ if (typeof connection !== "undefined") {
159
164
  return connection.client;
160
165
  }
161
166
  return undefined;
@@ -167,8 +172,8 @@ class HL7Client {
167
172
  */
168
173
  getClientConnectionByPort(port) {
169
174
  let connection;
170
- this._clientConnections.forEach(outbound => {
171
- outbound.ports.forEach(aPort => {
175
+ this._clientConnections.forEach((outbound) => {
176
+ outbound.ports.forEach((aPort) => {
172
177
  if (aPort.port === port) {
173
178
  connection = aPort.connection;
174
179
  }
@@ -178,7 +183,7 @@ class HL7Client {
178
183
  }
179
184
  /**
180
185
  * Process a HL7
181
- * @description A HL7 message that could either be a Message (MSH) or Batch (BHS)
186
+ *@remarks A HL7 message that could either be a Message (MSH) or Batch (BHS)
182
187
  * @since 1.0.0
183
188
  * @param text Raw HL& String
184
189
  */
@@ -192,7 +197,7 @@ class HL7Client {
192
197
  }
193
198
  /**
194
199
  * Read File
195
- * @description Pass the correct path of the file you want to read.
200
+ *@remarks Pass the correct path of the file you want to read.
196
201
  * @since 1.0.0
197
202
  * @param fullFilePath
198
203
  * @returns FileBatch
@@ -206,7 +211,7 @@ class HL7Client {
206
211
  }
207
212
  /**
208
213
  * Read a File Buffer
209
- * @description Translate an already Buffered HL7 FHS segment to decode it.
214
+ *@remarks Translate an already Buffered HL7 FHS segment to decode it.
210
215
  * @since 1.0.0
211
216
  * @param fileBuffer
212
217
  * @returns FileBatch
@@ -14,8 +14,8 @@ class HL7Server {
14
14
  * @param port
15
15
  */
16
16
  async close(port) {
17
- const inbound = this._serverInboundConnections.find(server => server.port === port);
18
- if (typeof inbound !== 'undefined') {
17
+ const inbound = this._serverInboundConnections.find((server) => server.port === port);
18
+ if (typeof inbound !== "undefined") {
19
19
  return await inbound.server.close(); // close the server for all inbound connections
20
20
  }
21
21
  throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE(`No inbound server listening on port: ${port}`);
@@ -40,13 +40,13 @@ class HL7Server {
40
40
  createInbound(name, props, handler) {
41
41
  const nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
42
42
  if (nameFormat.test(name)) {
43
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
43
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~.");
44
44
  }
45
45
  const inbound = new node_hl7_server_1.Inbound(this._server, props, handler);
46
46
  this._serverInboundConnections.push({
47
47
  name,
48
48
  port: props.port.toString(),
49
- server: inbound
49
+ server: inbound,
50
50
  });
51
51
  return inbound;
52
52
  }
@@ -56,8 +56,8 @@ class HL7Server {
56
56
  * @param name
57
57
  */
58
58
  getServerByName(name) {
59
- const inbound = this._serverInboundConnections.find(inbound => inbound.name === name);
60
- if (typeof inbound !== 'undefined') {
59
+ const inbound = this._serverInboundConnections.find((inbound) => inbound.name === name);
60
+ if (typeof inbound !== "undefined") {
61
61
  return inbound.server;
62
62
  }
63
63
  return undefined;
@@ -68,8 +68,8 @@ class HL7Server {
68
68
  * @param port
69
69
  */
70
70
  getServerByPort(port) {
71
- const inbound = this._serverInboundConnections.find(inbound => inbound.port === port);
72
- if (typeof inbound !== 'undefined') {
71
+ const inbound = this._serverInboundConnections.find((inbound) => inbound.port === port);
72
+ if (typeof inbound !== "undefined") {
73
73
  return inbound.server;
74
74
  }
75
75
  return undefined;
package/lib/cjs/errors.js CHANGED
@@ -7,7 +7,7 @@ exports.errors = void 0;
7
7
  const error_1 = __importDefault(require("@fastify/error"));
8
8
  exports.errors = {
9
9
  /** Error if there is an setup error of the plugin itself. */
10
- FASTIFY_HL7_ERR_SETUP_ERRORS: (0, error_1.default)('FASTIFY_HL7_ERR_SETUP_ERRORS', 'Setup error: %s'),
10
+ FASTIFY_HL7_ERR_SETUP_ERRORS: (0, error_1.default)("FASTIFY_HL7_ERR_SETUP_ERRORS", "Setup error: %s"),
11
11
  /** If an invalid usage error was done, this error would pop up. */
12
- FASTIFY_HL7_ERR_USAGE: (0, error_1.default)('FASTIFY_HL7_ERR_USAGE', 'Usage error: %s')
12
+ FASTIFY_HL7_ERR_USAGE: (0, error_1.default)("FASTIFY_HL7_ERR_USAGE", "Usage error: %s"),
13
13
  };
package/lib/cjs/index.js CHANGED
@@ -31,12 +31,12 @@ __exportStar(require("./types.js"), exports);
31
31
  * @param connection
32
32
  */
33
33
  const decorateFastifyInstance = (fastify, _opts, connection) => {
34
- if (typeof fastify.hl7 !== 'undefined') {
35
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_SETUP_ERRORS('Already registered.');
34
+ if (typeof fastify.hl7 !== "undefined") {
35
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_SETUP_ERRORS("Already registered.");
36
36
  }
37
- if (typeof fastify.hl7 === 'undefined') {
38
- fastify.log.trace('[fastify-hl7] Decorate Fastify');
39
- fastify.decorate('hl7', connection);
37
+ if (typeof fastify.hl7 === "undefined") {
38
+ fastify.log.trace("[fastify-hl7] Decorate Fastify");
39
+ fastify.decorate("hl7", connection);
40
40
  }
41
41
  };
42
42
  const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
@@ -48,15 +48,17 @@ const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
48
48
  // A server can host many HL7 Inbound connections via different ports, this is fine.
49
49
  // Clients are different as an app could talk to different servers, on many ports.
50
50
  // So we need to do something different.
51
- const serverInstance = (typeof opts.enableServer !== 'undefined' && opts.enableServer) ? new node_hl7_server_1.default(opts.serverOptions) : undefined;
51
+ const serverInstance = typeof opts.enableServer !== "undefined" && opts.enableServer
52
+ ? new node_hl7_server_1.default(opts.serverOptions)
53
+ : undefined;
52
54
  // Server Functions
53
55
  let server;
54
- if (typeof serverInstance !== 'undefined') {
56
+ if (typeof serverInstance !== "undefined") {
55
57
  // Server Functions
56
58
  server = new hL7Server_js_1.HL7Server(serverInstance);
57
59
  // before we close fastify, make sure all server instances are closed
58
- fastify.addHook('preClose', async () => {
59
- if (typeof server !== 'undefined') {
60
+ fastify.addHook("preClose", async () => {
61
+ if (typeof server !== "undefined") {
60
62
  await server.closeAll();
61
63
  }
62
64
  });
@@ -64,8 +66,8 @@ const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
64
66
  // Client Functions
65
67
  const client = new hL7Client_js_1.HL7Client();
66
68
  // run these before fastify closes
67
- fastify.addHook('preClose', async () => {
68
- if (typeof client !== 'undefined') {
69
+ fastify.addHook("preClose", async () => {
70
+ if (typeof client !== "undefined") {
69
71
  await client.closeAll();
70
72
  }
71
73
  });
@@ -84,25 +86,25 @@ const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
84
86
  return client.buildMessage(props);
85
87
  },
86
88
  closeServer: async function (port) {
87
- if (typeof server !== 'undefined') {
89
+ if (typeof server !== "undefined") {
88
90
  return await server.close(port);
89
91
  }
90
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('server was not started. re-register plugin with enableServer set to true.');
92
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("server was not started. re-register plugin with enableServer set to true.");
91
93
  },
92
94
  closeServerAll: async () => {
93
- if (typeof server !== 'undefined') {
95
+ if (typeof server !== "undefined") {
94
96
  return await server.closeAll();
95
97
  }
96
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('server was not started. re-register plugin with enableServer set to true.');
98
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("server was not started. re-register plugin with enableServer set to true.");
97
99
  },
98
100
  createClient: function (name, props) {
99
101
  return client.createClient(name, props);
100
102
  },
101
103
  createInbound: function (name, props, handler) {
102
- if (typeof server !== 'undefined') {
104
+ if (typeof server !== "undefined") {
103
105
  return server.createInbound(name, props, handler);
104
106
  }
105
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('server was not started. re-register plugin with enableServer set to true.');
107
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("server was not started. re-register plugin with enableServer set to true.");
106
108
  },
107
109
  createConnection: function (name, props, handler) {
108
110
  return client.createConnection(name, props, handler);
@@ -114,16 +116,16 @@ const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
114
116
  return client.getClientConnectionByPort(port);
115
117
  },
116
118
  getServerByName: function (name) {
117
- if (typeof server !== 'undefined') {
119
+ if (typeof server !== "undefined") {
118
120
  return server.getServerByName(name);
119
121
  }
120
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('server was not started. re-register plugin with enableServer set to true.');
122
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("server was not started. re-register plugin with enableServer set to true.");
121
123
  },
122
124
  getServerByPort: function (port) {
123
- if (typeof server !== 'undefined') {
125
+ if (typeof server !== "undefined") {
124
126
  return server.getServerByPort(port);
125
127
  }
126
- throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('server was not started. re-register plugin with enableServer set to true.');
128
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("server was not started. re-register plugin with enableServer set to true.");
127
129
  },
128
130
  processHL7: function (text) {
129
131
  return client.processHL7(text);
@@ -133,7 +135,7 @@ const fastifyHL7 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
133
135
  },
134
136
  readFileBuffer: function (fileBuffer) {
135
137
  return client.readFileBuffer(fileBuffer);
136
- }
138
+ },
137
139
  });
138
140
  });
139
141
  exports.default = fastifyHL7;
@@ -7,7 +7,7 @@ exports.validateOpts = void 0;
7
7
  */
8
8
  const validateOpts = async (opts) => {
9
9
  // Mandatory, Defaulted
10
- if (typeof opts.enableServer === 'undefined') {
10
+ if (typeof opts.enableServer === "undefined") {
11
11
  opts.enableServer = true;
12
12
  }
13
13
  return opts;
package/lib/esm/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { HL7 } from 'fastify';
2
- import fastifyHL7 from '.';
3
- import { AServers, FastifyHL7Options } from './decorate.js';
4
- import { HL7Client } from './class/hL7Client.js';
5
- import { HL7Server } from './class/hL7Server.js';
1
+ import { HL7 } from "fastify";
2
+ import fastifyHL7 from ".";
3
+ import { AServers, FastifyHL7Options } from "./decorate.js";
4
+ import { HL7Client } from "./class/hL7Client.js";
5
+ import { HL7Server } from "./class/hL7Server.js";
6
6
  export default fastifyHL7;
7
7
  export { fastifyHL7, HL7, FastifyHL7Options, HL7Client, HL7Server, AServers };
package/lib/esm/api.js CHANGED
@@ -1,5 +1,5 @@
1
- import fastifyHL7 from '.';
2
- import { HL7Client } from './class/hL7Client.js';
3
- import { HL7Server } from './class/hL7Server.js';
1
+ import fastifyHL7 from ".";
2
+ import { HL7Client } from "./class/hL7Client.js";
3
+ import { HL7Server } from "./class/hL7Server.js";
4
4
  export default fastifyHL7;
5
5
  export { fastifyHL7, HL7Client, HL7Server };
@@ -1,4 +1,4 @@
1
- import Client, { Batch, ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuilderOptions, ClientListenerOptions, ClientOptions, FileBatch, Connection, Message, OutboundHandler } from 'node-hl7-client';
1
+ import Client, { Batch, ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuilderOptions, ClientListenerOptions, ClientOptions, FileBatch, Connection, Message, OutboundHandler } from "node-hl7-client";
2
2
  export declare class HL7Client {
3
3
  /** @internal */
4
4
  private readonly _clientConnections;
@@ -10,14 +10,14 @@ export declare class HL7Client {
10
10
  closeAll(): Promise<boolean>;
11
11
  /**
12
12
  * Build a HL7 Batch
13
- * @description Create a properly formatted HL7 Batch.
13
+ *@remarks Create a properly formatted HL7 Batch.
14
14
  * @since 1.0.0
15
15
  * @param props
16
16
  */
17
17
  buildBatch(props?: ClientBuilderOptions): Batch;
18
18
  /**
19
19
  * Build Date
20
- * @description Build a date string based off HL7 Standards
20
+ *@remarks Build a date string based off HL7 Standards
21
21
  * @since 2.1.0
22
22
  * @param date
23
23
  * @param length Options are 8, 12, or 14 (default)
@@ -25,14 +25,14 @@ export declare class HL7Client {
25
25
  buildDate(date: Date, length?: string): string;
26
26
  /**
27
27
  * Build a HL7 File Batch
28
- * @description Create a properly formatted HL7 File Batch.
28
+ *@remarks Create a properly formatted HL7 File Batch.
29
29
  * @since 1.0.0
30
30
  * @param props
31
31
  */
32
32
  buildFileBatch(props?: ClientBuilderFileOptions): FileBatch;
33
33
  /**
34
34
  * Build a HL7 Message
35
- * @description Create a properly formatted HL7 message.
35
+ *@remarks Create a properly formatted HL7 message.
36
36
  * @since 1.0.0
37
37
  * @param props
38
38
  */
@@ -45,7 +45,7 @@ export declare class HL7Client {
45
45
  createClient(name: string, props: ClientOptions): Client;
46
46
  /**
47
47
  * Create an HL7 Outbound Connection
48
- * @description Connect to an HL7 Server/Broker
48
+ *@remarks Connect to an HL7 Server/Broker
49
49
  * @since 1.0.0
50
50
  * @param name The name stored within created client connections.
51
51
  * @param props
@@ -66,14 +66,14 @@ export declare class HL7Client {
66
66
  getClientConnectionByPort(port: string): Connection | undefined;
67
67
  /**
68
68
  * Process a HL7
69
- * @description A HL7 message that could either be a Message (MSH) or Batch (BHS)
69
+ *@remarks A HL7 message that could either be a Message (MSH) or Batch (BHS)
70
70
  * @since 1.0.0
71
71
  * @param text Raw HL& String
72
72
  */
73
73
  processHL7(text: string): Message | Batch;
74
74
  /**
75
75
  * Read File
76
- * @description Pass the correct path of the file you want to read.
76
+ *@remarks Pass the correct path of the file you want to read.
77
77
  * @since 1.0.0
78
78
  * @param fullFilePath
79
79
  * @returns FileBatch
@@ -85,7 +85,7 @@ export declare class HL7Client {
85
85
  readFile(fullFilePath: string): FileBatch;
86
86
  /**
87
87
  * Read a File Buffer
88
- * @description Translate an already Buffered HL7 FHS segment to decode it.
88
+ *@remarks Translate an already Buffered HL7 FHS segment to decode it.
89
89
  * @since 1.0.0
90
90
  * @param fileBuffer
91
91
  * @returns FileBatch