fastify-hl7 2.1.0 → 2.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.
@@ -0,0 +1,66 @@
1
+ import Server, { Inbound, InboundHandler, ListenerOptions } from 'node-hl7-server';
2
+ import Client, { Batch, ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuilderOptions, ClientListenerOptions, ClientOptions, Connection, FileBatch, Message, OutboundHandler } from 'node-hl7-client';
3
+ declare module 'fastify' {
4
+ interface HL7 {
5
+ /** Server Instance
6
+ * @since 1.0.0 **/
7
+ _serverInstance?: Server;
8
+ /** Build HL7 Batch
9
+ * @since 1.0.0 */
10
+ buildBatch: (props?: ClientBuilderOptions) => Batch;
11
+ /** BBuild Date
12
+ * @since 2.1.0
13
+ */
14
+ buildDate: (date: Date, length?: string) => string;
15
+ /** Build HL7 File Batch
16
+ * @since 1.0.0 */
17
+ buildFileBatch: (props?: ClientBuilderFileOptions) => FileBatch;
18
+ /** Build HL7 Message
19
+ * @since 1.0.0 */
20
+ buildMessage: (props?: ClientBuilderMessageOptions) => Message;
21
+ /** Close a incoming HL7 port.
22
+ * @since 1.0.0 */
23
+ closeServer: (port: string) => Promise<boolean>;
24
+ /** Close all incoming HL7 ports.
25
+ * @since 1.0.0 */
26
+ closeServerAll: () => Promise<boolean>;
27
+ /** Create Client
28
+ * @description Connecting to a remote server/broker that accepts connections.
29
+ * @since 1.0.0 */
30
+ createClient: (name: string, props: ClientOptions) => Client;
31
+ /** Create an incoming port connection on the server.
32
+ * @since 1.0.0 */
33
+ createInbound: (name: string, props: ListenerOptions, handler: InboundHandler) => Inbound;
34
+ /** Create Outgoing Client Port
35
+ * @description This is on the established client that we are already a part off.
36
+ * @since 1.0.0 */
37
+ createConnection: (name: string, props: ClientListenerOptions, handler: OutboundHandler) => Connection;
38
+ /** Get Client (Outbound) connection by name.
39
+ * @since 1.0.0 */
40
+ getClientByName: (name: string) => Client | undefined;
41
+ /** Get Client Connection (Outbound) connection by port.
42
+ * @since 1.0.0 */
43
+ getClientConnectionByPort: (port: string) => Connection | undefined;
44
+ /** Get Server (Inbound) connection by port.
45
+ * @since 1.0.0 */
46
+ getServerByPort: (port: string) => Inbound | undefined;
47
+ /** Get Server (Inbound) connection by name.
48
+ * @since 1.0.0 */
49
+ getServerByName: (name: string) => Inbound | undefined;
50
+ /** Process an HL7 string.
51
+ * @since 1.0.0 */
52
+ processHL7: (text: string) => Message | Batch;
53
+ /** Read a file from a path.
54
+ * @since 1.0.0 */
55
+ readFile: (fullFilePath: string) => FileBatch;
56
+ /** Read a buffer that was a file batch.
57
+ * @since 1.0.0 */
58
+ readFileBuffer: (fileBuffer: Buffer) => FileBatch;
59
+ }
60
+ interface FastifyInstance {
61
+ /** Main Decorator for Fastify
62
+ * @description hl7 is the decorator that everything hangs off.
63
+ * @since 1.0.0 **/
64
+ hl7: HL7;
65
+ }
66
+ }
@@ -0,0 +1,6 @@
1
+ import { FastifyHL7Options } from './decorate.js';
2
+ /**
3
+ * @since 1.0.0
4
+ * @param opts
5
+ */
6
+ export declare const validateOpts: (opts: FastifyHL7Options) => Promise<FastifyHL7Options>;
@@ -1,6 +1,7 @@
1
- /// <reference types="node" />
2
1
  import Client, { Batch, ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuilderOptions, ClientListenerOptions, ClientOptions, FileBatch, Connection, Message, OutboundHandler } from 'node-hl7-client';
3
2
  export declare class HL7Client {
3
+ /** @internal */
4
+ private readonly _clientConnections;
4
5
  constructor();
5
6
  /**
6
7
  * Close All Connections for this Client
@@ -77,9 +78,9 @@ export declare class HL7Client {
77
78
  * @param fullFilePath
78
79
  * @returns FileBatch
79
80
  * @example
80
- *
81
+ * ```ts
81
82
  * fastify.hl7.readFile( path.join('temp/', 'hl7.readTestBHS.20231208.hl7') )
82
- *
83
+ * ```
83
84
  */
84
85
  readFile(fullFilePath: string): FileBatch;
85
86
  /**
@@ -89,10 +90,10 @@ export declare class HL7Client {
89
90
  * @param fileBuffer
90
91
  * @returns FileBatch
91
92
  * @example
92
- *
93
+ * ```ts
93
94
  * const fileBuffer = fs.readFileSync(path.join('temp/', 'hl7.readTestBHS.20231208.hl7'))
94
95
  * fastify.hl7.readFileBuffer(fileBuffer)
95
- *
96
+ * ```
96
97
  */
97
98
  readFileBuffer(fileBuffer: Buffer): FileBatch;
98
99
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import Server, { Inbound, InboundHandler, ListenerOptions } from 'node-hl7-server';
3
2
  import Client, { Batch, ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuilderOptions, ClientListenerOptions, ClientOptions, Connection, FileBatch, Message, OutboundHandler } from 'node-hl7-client';
4
3
  declare module 'fastify' {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-hl7",
3
- "version": "2.1.0",
3
+ "version": "2.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",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "scripts": {
23
23
  "clean": "rm -rf lib coverage docs",
24
- "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && ./bin/build-types.sh",
25
- "build:watch": "tsc -p tsconfig.esm.json -w",
24
+ "build": "tsc -p src/tsconfig.esm.json && tsc -p src/tsconfig.cjs.json && tsc -p src/tsconfig.types.json && ./bin/build-types.sh",
25
+ "build:watch": "tsc -p src/tsconfig.esm.json -w",
26
26
  "npmPkgJsonLint": "npmPkgJsonLint .",
27
- "lint": "npmPkgJsonLint . && ts-standard | snazzy",
28
- "lint:fix": "npmPkgJsonLint . && ts-standard --fix | snazzy",
27
+ "lint": "npmPkgJsonLint . && ts-standard -p src/tsconfig.esm.json | snazzy",
28
+ "lint:fix": "npmPkgJsonLint . && ts-standard -p src/tsconfig.esm.json --fix | snazzy",
29
29
  "pack": "npm pack",
30
30
  "prepublishOnly": "npm run clean && npm run build && npm run pack",
31
31
  "test": "vitest run",
@@ -57,10 +57,10 @@
57
57
  },
58
58
  "homepage": "https://github.com/Bugs5382/fastify-hl7#readme",
59
59
  "dependencies": {
60
- "@fastify/error": "^3.4.1",
60
+ "@fastify/error": "^4.0.0",
61
61
  "fastify-plugin": "^4.5.1",
62
- "node-hl7-client": "^2.0.0",
63
- "node-hl7-server": "^2.0.0"
62
+ "node-hl7-client": "^2.3.0",
63
+ "node-hl7-server": "^2.4.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@semantic-release/changelog": "^6.0.3",
@@ -68,16 +68,15 @@
68
68
  "@semantic-release/git": "^10.0.1",
69
69
  "@semantic-release/release-notes-generator": "^12.1.0",
70
70
  "@the-rabbit-hole/semantic-release-config": "^1.5.0",
71
- "@types/node": "^20.11.19",
72
- "@types/randomstring": "^1.1.11",
71
+ "@types/node": "^20.14.8",
72
+ "@types/randomstring": "^1.3.0",
73
73
  "@types/tcp-port-used": "^1.0.4",
74
- "@typescript-eslint/parser": "^7.0.2",
75
- "@vitest/coverage-v8": "^1.3.1",
76
- "@vitest/ui": "^1.3.1",
77
- "clean-publish": "^4.2.0",
78
- "fastify": "^4.26.1",
79
- "npm-check-updates": "^16.14.15",
80
- "npm-package-json-lint": "^7.1.0",
74
+ "@typescript-eslint/parser": "^7.14.1",
75
+ "@vitest/coverage-v8": "^1.6.0",
76
+ "@vitest/ui": "^1.6.0",
77
+ "fastify": "^4.28.0",
78
+ "npm-check-updates": "^16.14.20",
79
+ "npm-package-json-lint": "^8.0.0",
81
80
  "portfinder": "^1.0.32",
82
81
  "pre-commit": "^1.2.2",
83
82
  "semantic-release": "^22.0.12",
@@ -85,10 +84,10 @@
85
84
  "tcp-port-used": "^1.0.2",
86
85
  "ts-node": "^10.9.2",
87
86
  "ts-standard": "^12.0.2",
88
- "tsd": "^0.30.5",
89
- "typedoc": "^0.25.8",
90
- "typescript": "^5.3.3",
91
- "vitest": "^1.3.1"
87
+ "tsd": "^0.31.1",
88
+ "typedoc": "^0.26.2",
89
+ "typescript": "^5.5.2",
90
+ "vitest": "^1.6.0"
92
91
  },
93
92
  "precommit": [
94
93
  "lint:fix",