Skip to content

Commit

Permalink
feat: added new features in (#30)
Browse files Browse the repository at this point in the history
Closes #28
  • Loading branch information
Bugs5382 committed Feb 22, 2024
2 parents f5e0df3 + 6543743 commit 1d254bd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Expand Up @@ -2,6 +2,7 @@ version: 2
updates:
- package-ecosystem: npm
directory: "/"
target-branch: 'develop'
schedule:
interval: daily
time: "10:00"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
node-version: [ 20.x, 'lts/*' ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -37,7 +37,7 @@ jobs:
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
Expand Down
18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -68,15 +68,15 @@
"@semantic-release/git": "^10.0.1",
"@semantic-release/release-notes-generator": "^12.1.0",
"@the-rabbit-hole/semantic-release-config": "^1.5.0",
"@types/node": "^20.11.16",
"@types/node": "^20.11.19",
"@types/randomstring": "^1.1.11",
"@types/tcp-port-used": "^1.0.4",
"@typescript-eslint/parser": "^6.20.0",
"@vitest/coverage-v8": "^1.2.2",
"@vitest/ui": "^1.2.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitest/coverage-v8": "^1.3.1",
"@vitest/ui": "^1.3.1",
"clean-publish": "^4.2.0",
"fastify": "^4.26.0",
"npm-check-updates": "^16.14.14",
"fastify": "^4.26.1",
"npm-check-updates": "^16.14.15",
"npm-package-json-lint": "^7.1.0",
"portfinder": "^1.0.32",
"pre-commit": "^1.2.2",
Expand All @@ -85,10 +85,10 @@
"tcp-port-used": "^1.0.2",
"ts-node": "^10.9.2",
"ts-standard": "^12.0.2",
"tsd": "^0.30.4",
"typedoc": "^0.25.7",
"tsd": "^0.30.5",
"typedoc": "^0.25.8",
"typescript": "^5.3.3",
"vitest": "^1.2.2"
"vitest": "^1.3.1"
},
"precommit": [
"lint:fix",
Expand Down
13 changes: 12 additions & 1 deletion src/class/hL7Client.ts
Expand Up @@ -9,7 +9,7 @@ import Client, {
Connection,
isBatch,
Message,
OutboundHandler
OutboundHandler, createHL7Date
} from 'node-hl7-client'
import { AClients } from '../decorate.js'
import { errors } from '../errors.js'
Expand Down Expand Up @@ -48,6 +48,17 @@ export class HL7Client {
return new Batch({ ...props })
}

/**
* Build Date
* @description Build a date string based off HL7 Standards
* @since 2.1.0
* @param date
* @param length Options are 8, 12, or 14 (default)
*/
buildDate (date: Date, length?: string): string {
return createHL7Date(date, length)
}

/**
* Build a HL7 File Batch
* @description Create a properly formatted HL7 File Batch.
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Expand Up @@ -76,6 +76,9 @@ const fastifyHL7 = fp<FastifyHL7Options>(async (fastify, opts) => {
buildBatch: function (props: ClientBuilderOptions | undefined): Batch {
return client.buildBatch(props)
},
buildDate: function (date: Date, length?: string): string {
return client.buildDate(date, length)
},
buildFileBatch: function (props: ClientBuilderFileOptions | undefined): FileBatch {
return client.buildFileBatch(props)
},
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Expand Up @@ -17,6 +17,10 @@ declare module 'fastify' {
/** Build HL7 Batch
* @since 1.0.0 */
buildBatch: (props?: ClientBuilderOptions) => Batch
/** BBuild Date
* @since 2.1.0
*/
buildDate: (date: Date, length?: string) => string
/** Build HL7 File Batch
* @since 1.0.0 */
buildFileBatch: (props?: ClientBuilderFileOptions) => FileBatch
Expand Down

0 comments on commit 1d254bd

Please sign in to comment.