{"_id":"@akumzy/node-hl7-server","name":"@akumzy/node-hl7-server","dist-tags":{"latest":"2.4.2"},"versions":{"2.4.2":{"name":"@akumzy/node-hl7-server","version":"2.4.2","description":"Node.js client library for creating a HL7 Server which can accept incoming a properly formatted HL7 message(s), and then parses the HL7 message. Once the message has been parsed you can then do something with the final result that you so desire.","module":"./lib/esm/index.js","main":"./lib/cjs/index.js","types":"./lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js","default":"./lib/cjs/index.js"}},"engines":{"node":"^18 || ^20"},"scripts":{"clean":"rm -rf coverage docs lib temp","build":"tsc -p src/tsconfig.esm.json && tsc -p src/tsconfig.cjs.json && tsc -p src/tsconfig.types.json && ./bin/build-types.sh","build:watch":"tsc -p src/tsconfig.esm.json -w","docker:build":"docker build -t docker-node-hl7-server:latest .","npm:lint":"npmPkgJsonLint .","lint":"npm run npm:lint && ts-standard -p src/tsconfig.esm.json | snazzy","lint:fix":"npm run npm:lint . && ts-standard  -p src/tsconfig.esm.json --fix | snazzy","pack":"npm pack","prepublishOnly":"npm run clean && npm run build && npm run pack","test":"vitest run","test:verbose":"vitest run --reporter verbose","test:watch":"vitest watch","test:coverage":"vitest --coverage","typedoc":"typedoc","typedoc:watch":"typedoc -watch","semantic-release":"semantic-release","semantic-release:dry-run":"semantic-release --dry-run","update":"npx npm-check-updates -u --enginesNode && npm run update:post-update","update:post-update":"npm install && npm run test"},"repository":{"type":"git","url":"git+https://github.com/Bugs5382/node-hl7-server.git"},"keywords":["hl7","hl7-parser","hl7-client","hl7-server","hl7-builder","hl7-speffications","hl7-validation"],"author":{"name":"Shane Froebel"},"license":"MIT","bugs":{"url":"https://github.com/Bugs5382/node-hl7-server/issues"},"homepage":"https://github.com/Bugs5382/node-hl7-server#readme","devDependencies":{"@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.0","@semantic-release/git":"^10.0.1","@semantic-release/release-notes-generator":"^14.0.0","@the-rabbit-hole/semantic-release-config":"^1.5.0","@types/node":"^20.11.16","@types/tcp-port-used":"^1.0.4","@typescript-eslint/parser":"^7.14.1","@vitest/coverage-v8":"^1.2.2","@vitest/ui":"^1.2.2","npm-package-json-lint":"^8.0.0","portfinder":"^1.0.32","pre-commit":"^1.2.2","semantic-release":"^24.0.0","snazzy":"^9.0.0","tcp-port-used":"^1.0.2","ts-node":"^10.9.2","ts-standard":"^12.0.2","tsd":"^0.31.1","typedoc":"^0.26.2","typescript":"5.5.2","vitest":"^1.6.0"},"dependencies":{"@akumzy/node-hl7-client":"^2.3.3"},"precommit":["lint:fix","build"],"_id":"@akumzy/node-hl7-server@2.4.2","gitHead":"9eb9a200e8e40b3b7467646defbec7f5e17ba82e","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-8+zb4fzf7YKTYyj18luQuhdlXDLFGAHH3HQpJW59DSybto505jlRtEiWDvtoc59wfvN7nsLRuggpPmiydaztGw==","shasum":"c47709acf174f65ab3bc7038f321a2cc63e9e3a0","tarball":"https://registry.npmjs.org/@akumzy/node-hl7-server/-/node-hl7-server-2.4.2.tgz","fileCount":37,"unpackedSize":75618,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEdV9nPPX/q58guyVe5GedR/Mu0sk3eo7m0vOWwk7drlAiEAz+69DBumpt7xjI3BgrUVgp+XccMW/+HqLkbhWA/H6b8="}]},"_npmUser":{"name":"akumzy","email":"akumaisaacakuma@gmail.com"},"directories":{},"maintainers":[{"name":"akumzy","email":"akumaisaacakuma@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-hl7-server_2.4.2_1720647422730_0.7970200613922247"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-10T21:37:02.490Z","2.4.2":"2024-07-10T21:37:02.922Z","modified":"2024-07-10T21:37:03.227Z"},"maintainers":[{"name":"akumzy","email":"akumaisaacakuma@gmail.com"}],"description":"Node.js client library for creating a HL7 Server which can accept incoming a properly formatted HL7 message(s), and then parses the HL7 message. Once the message has been parsed you can then do something with the final result that you so desire.","homepage":"https://github.com/Bugs5382/node-hl7-server#readme","keywords":["hl7","hl7-parser","hl7-client","hl7-server","hl7-builder","hl7-speffications","hl7-validation"],"repository":{"type":"git","url":"git+https://github.com/Bugs5382/node-hl7-server.git"},"author":{"name":"Shane Froebel"},"bugs":{"url":"https://github.com/Bugs5382/node-hl7-server/issues"},"license":"MIT","readme":"## Node HL7 Server\n\nNode.js client library for creating a HL7 Server which can accept incoming a properly formatted HL7 message(s), and then parses the HL7 message. Once the message has been parsed you can then do something with the final result that you so desire.\n\nBenefits:\n\n- No other main dependencies (other than the sister app called [@akumzy/node-hl7-client](https://www.npmjs.com/package/@akumzy/node-hl7-client) which also uses no other external dependencies), making this ultra-fast.\n- Automatically re-connect, re-subscribe, or retry sending\n- Written in typescript and published with heavily commented type definitions\n- Intuitive API with named parameters instead of positional\n- TLS/SSL Support for clients connecting, if you want.\n- Typescript, CommonJS, ESM formats all available in one package.\n\n## Table of Contents\n\n1. [Acknowledgements](#acknowledgements)\n2. [Keyword Definitions](#Keyword-Definitions)\n3. [Basic Install](#install)\n4. [License](#license)\n\n## Keyword Definitions\n\nThis NPM is designed to support medical applications with potential impact on patient care and diagnoses, this package documentation, and it's peer package [node-hl7-server]() follow these definitions when it comes to the documentation.\n\nKeywords such as \"MUST\", \"MUST NOT\", \"REQUIRED\",\n\"SHALL\", \"SHALL NOT\", \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\".\nThese are standardized terms for technology documentation interoperability.\nThese words should have these meaning when you are reading them.\nThey might be sans uppercase throughout the documentation, but they would have the same meaning regardless.\n\n- **MUST** - This word, or the terms \"**REQUIRED**\" or \"**SHALL**\", mean that the definition is an absolute requirement of the specification.\n- **MUST NOT** - This phrase, or the phrase \"**SHALL NOT**\", mean that the definition is an absolute prohibition of the specification.\n- **SHOULD** - This word, or the adjective \"**RECOMMENDED**\", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.\n- **SHOULD NOT** - This phrase, or the phrase \"**NOT RECOMMENDED**\", mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful. The full implications should be understood and the case carefully weighed before implementing any behavior described with this label.\n- **MAY** - This word, or the adjective \"**OPTIONAL**\", mean that an item is truly optional. Any implementation which does not include a particular option MUST be prepared to interoperate with another implementation which does include the option, though perhaps with reduced functionality. In the same vein, an implementation which does include a particular option MUST be prepared to interoperate with another implementation, which does not include the option (except, of course, for the feature the option provides.)\n\n## Install\n\nInstall using NPM into your package:\n\n```\nnpm install node-hl7-server\n```\n\nIt has one external dependency of `@akumzy/node-hl7-client`\nas it uses this package to generate the acknowledgement message back to the client\nand also parse the informing message from the server.\n\n## Basic Usage\n\nNon-TLS:\n\n```ts\nimport { Server } from 'node-hl7-server';\n\nconst server = new Server();\n\nconst IB = server.createInbound({ port: 3000 }, async (req, res) => {\n  const messageReq = req.getMessage();\n  const messageRes = res.getAckMessage();\n  // do your code here\n});\n```\n\nThis will start a basic server on port 3000 with basic functionally.\n\nBefore your app shuts down, you should run:\n\n```ts\nawait IB.close();\n```\n\nTo end the connections.\n\nAn HL7 server is designed to be up ready to accept connections at any time, so shutting it down shouldn't really happen.\nYour app needs to be responsible for memory leaks.\nThe server does close the connection once it's finished a reply to the client.\n\nTLS:\n\n```ts\nimport { Server } from 'node-hl7-server';\n\nconst server = new Server({\n  tls: {\n    key: fs.readFileSync(path.join('certs/', 'server-key.pem')), // where your certs are\n    cert: fs.readFileSync(path.join('certs/', 'server-crt.pem')), // where your certs are\n    rejectUnauthorized: false,\n  },\n});\n```\n\nWhen you get a message, you can then parse any segment of the message and do you need to in order for your app to work.\n\n```ts\nconst IB_ADT = server.createInbound({ port: LISTEN_PORT }, async (req, res) => {\n  const messageReq = req.getMessage();\n  const messageRes = res.getAckMessage();\n  const hl7Version = messageReq.get('MSH.12').toString();\n});\n```\n\nIn this case... `res.getAckMessage()` returns a Message object from `@akumzy/node-hl7-client`.\nThen you can query the segment `MSH.12` in this instance and get its result.\n\nPlease consult [@akumzy/node-hl7-client](https://www.npmjs.com/package/@akumzy/node-hl7-client) documentation for further ways to parse the message segment.\n\n### Override MSH Header\n\nIn HL7 specification 2.1 through 2.3.1, MSH header segment could not be 'ACK'.\nIt was a combination of ACK and MSH 9.2 (e.g. ADT_A01) for the full reference of `ACK^A01^ADT_A01`.\nFrom 2.4 specification to current,\na client might be looking for just `ACK` instead of `ADT_A01` given now the output of `ACK^A01^ACK`.\nThis is not default behavior as the two pair results of `ADT_A01` give more information back\nsince MSH 9.1 is usually ACK to start with.\n\nTo override this please setup your listener with:\n\n```ts\nconst listener = server.createInbound({ port: 3000, overrideMSH: true }, async (req, res) => {});\n```\n\n... and if the specification covers the MSH 9.3 as ACK, it will make it so. Otherwise, it will just be empty.\n\n## Docker\n\n```\nnpm run docker:build\n```\n\nThis package, if you download from source,\ncomes with a DockerFile to build a simple docker image with a basic node-hl7-server running.\nAll the server does is respond \"success\" to all properly formatted HL7 messages.\n\nIf you want more a custom instance of this server, download the GIT,\nand modify `docker/server.js` to your liking and then build the docker image and run it.\n\nSuggestions? Open a PR!\n\n## Documentation\n\nGitHub pages now has mostly full listing of all methods, classes, etc., but only for the most recent release.\nYou can view it [here](https://bugs5382.github.io/node-hl7-server/).\n\n## Acknowledgements\n\n- Code Design/Auto Re-Connect/Resend, Inspiration: [node-rabbitmq-client](https://github.com/cody-greene/node-rabbitmq-client)\n- My Wife and Baby Girl.\n\n## License\n\nLicensed under [MIT](./LICENSE).\n","readmeFilename":"README.md"}