fastify-hl7 1.1.3 → 1.2.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.
@@ -72,7 +72,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
72
72
  Object.defineProperty(exports, "__esModule", { value: true });
73
73
  exports.HL7Client = void 0;
74
74
  var node_hl7_client_1 = __importStar(require("node-hl7-client"));
75
- var errors_1 = require("../errors");
75
+ var errors_js_1 = require("../errors.js");
76
76
  var HL7Client = /** @class */ (function () {
77
77
  function HL7Client() {
78
78
  this._clientConnections = [];
@@ -109,7 +109,7 @@ var HL7Client = /** @class */ (function () {
109
109
  */
110
110
  HL7Client.prototype.buildBatch = function (props) {
111
111
  if (typeof props !== 'undefined' && typeof props.text !== 'undefined') {
112
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
112
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
113
113
  }
114
114
  return new node_hl7_client_1.Batch(__assign({}, props));
115
115
  };
@@ -121,7 +121,7 @@ var HL7Client = /** @class */ (function () {
121
121
  */
122
122
  HL7Client.prototype.buildFileBatch = function (props) {
123
123
  if (typeof props !== 'undefined' && (typeof props.fullFilePath !== 'undefined' || typeof props.fileBuffer !== 'undefined')) {
124
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('Use readFile or readFileBuffer method. This is for building.');
124
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use readFile or readFileBuffer method. This is for building.');
125
125
  }
126
126
  return new node_hl7_client_1.FileBatch(__assign({}, props));
127
127
  };
@@ -133,7 +133,7 @@ var HL7Client = /** @class */ (function () {
133
133
  */
134
134
  HL7Client.prototype.buildMessage = function (props) {
135
135
  if (typeof props !== 'undefined' && typeof props.text !== 'undefined') {
136
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
136
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('Use processMessage method. This is for building.');
137
137
  }
138
138
  return new node_hl7_client_1.Message(__assign({}, props));
139
139
  };
@@ -145,12 +145,12 @@ var HL7Client = /** @class */ (function () {
145
145
  HL7Client.prototype.createClient = function (name, props) {
146
146
  var nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
147
147
  if (nameFormat.test(name)) {
148
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
148
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
149
149
  }
150
150
  // make sure that this does not exist already...
151
151
  this._clientConnections.forEach(function (connections) {
152
152
  if (connections.name === name) {
153
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('name must be unique.');
153
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must be unique.');
154
154
  }
155
155
  // nto in the Client class yet
156
156
  // if (client.getHost() === props.host) {
@@ -178,14 +178,14 @@ var HL7Client = /** @class */ (function () {
178
178
  HL7Client.prototype.createOutbound = function (name, props, handler) {
179
179
  var nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
180
180
  if (nameFormat.test(name)) {
181
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
181
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
182
182
  }
183
183
  var getConnection = this._clientConnections.find(function (client) { return client.name === name; });
184
184
  if (typeof getConnection !== 'undefined') {
185
185
  // make sure port is not used all ready
186
186
  getConnection.ports.forEach(function (outbound) {
187
187
  if (outbound.port === props.port.toString()) {
188
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE("port ".concat(props.port, " is already used with this client. Choose a new outgoing port."));
188
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("port ".concat(props.port, " is already used with this client. Choose a new outgoing port."));
189
189
  }
190
190
  });
191
191
  // create outbound port to the server in getConnection.client
@@ -195,7 +195,7 @@ var HL7Client = /** @class */ (function () {
195
195
  // return it right away. the user might do something with it.
196
196
  return outbound;
197
197
  }
198
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('No valid client. Improper setup of a outbound connection.');
198
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('No valid client. Improper setup of a outbound connection.');
199
199
  };
200
200
  /**
201
201
  * Get Client by the name
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.HL7Server = void 0;
40
40
  var node_hl7_server_1 = require("node-hl7-server");
41
- var errors_1 = require("../errors");
41
+ var errors_js_1 = require("../errors.js");
42
42
  var HL7Server = /** @class */ (function () {
43
43
  function HL7Server(server) {
44
44
  this._server = server;
@@ -59,7 +59,7 @@ var HL7Server = /** @class */ (function () {
59
59
  if (!(typeof inbound !== 'undefined')) return [3 /*break*/, 2];
60
60
  return [4 /*yield*/, inbound.server.close()]; // close the server for all inbound connections
61
61
  case 1: return [2 /*return*/, _a.sent()]; // close the server for all inbound connections
62
- case 2: throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE("No inbound server listening on port: ".concat(port));
62
+ case 2: throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE("No inbound server listening on port: ".concat(port));
63
63
  }
64
64
  });
65
65
  });
@@ -96,7 +96,7 @@ var HL7Server = /** @class */ (function () {
96
96
  HL7Server.prototype.createInbound = function (name, props, handler) {
97
97
  var nameFormat = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; //eslint-disable-line
98
98
  if (nameFormat.test(name)) {
99
- throw new errors_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
99
+ throw new errors_js_1.errors.FASTIFY_HL7_ERR_USAGE('name must not contain certain characters: `!@#$%^&*()+\\-=\\[\\]{};\':"\\\\|,.<>\\/?~.');
100
100
  }
101
101
  var inbound = new node_hl7_server_1.HL7Inbound(this._server, props, handler);
102
102
  this._serverInboundConnections.push({
@@ -1,5 +1,5 @@
1
1
  import Client, { Batch, FileBatch, HL7Outbound, isBatch, Message } from 'node-hl7-client';
2
- import { errors } from '../errors';
2
+ import { errors } from '../errors.js';
3
3
  export class HL7Client {
4
4
  /** @internal */
5
5
  _clientConnections;
@@ -1,5 +1,5 @@
1
1
  import { HL7Inbound } from 'node-hl7-server';
2
- import { errors } from '../errors';
2
+ import { errors } from '../errors.js';
3
3
  export class HL7Server {
4
4
  _server;
5
5
  _serverInboundConnections;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-hl7",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "A Fastify HL7 Plugin Developed in Pure TypeScript.",
5
5
  "module": "./lib/esm/index.js",
6
6
  "main": "./lib/cjs/index.js",
@@ -61,7 +61,7 @@
61
61
  "@fastify/error": "^3.4.1",
62
62
  "fastify-plugin": "^4.5.1",
63
63
  "node-hl7-client": "^1.1.2",
64
- "node-hl7-server": "^1.2.1"
64
+ "node-hl7-server": "^1.2.3"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@semantic-release/changelog": "^6.0.3",