Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 3 additions & 49 deletions .npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
{
"extends": "npm-package-json-lint-config-default",
"rules": {
"require-author": "error",
"require-description": "error",
"require-engines": "error",
"require-license": "error",
"require-name": "error",
"require-repository": "error",
"require-version": "error",
"require-bugs": "error",
"require-homepage": "error",
"require-keywords": "error",
"bin-type": "error",
"config-type": "error",
"description-type": "error",
"devDependencies-type": "error",
"directories-type": "error",
"engines-type": "error",
"files-type": "error",
"homepage-type": "error",
"keywords-type": "error",
"license-type": "error",
"main-type": "error",
"man-type": "error",
"name-type": "error",
"preferGlobal-type": "error",
"private-type": "error",
"repository-type": "error",
"scripts-type": "error",
"version-type": "error",
"valid-values-author": ["error", [
"Shane Froebel"
]],
"valid-values-private": ["error", [
false
]],
"no-restricted-dependencies": ["error", [
"gulping-npm-package-json-lint"
]],
"no-restricted-pre-release-dependencies": ["error", [
"gulping-npm-package-json-lint"
]],
"no-restricted-devDependencies": ["error", [
"gulping-npm-package-json-lint"
]],
"no-restricted-pre-release-devDependencies": ["error", [
"gulping-npm-package-json-lint"
]],
"name-format": "error",
"version-format": "error"
"valid-values-author": ["error", ["Shane Froebel"]]
}
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023-2024 Shane
Copyright (c) 2023-2025 Shane

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions __tests__/hl7.sanity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe("node hl7 client - sanity tests", () => {
describe("...Message", () => {
test("error - Message Object - nothing passed", async () => {
try {
// @ts-expect-error
const message = new Message();
} catch (err) {
expect(err).toEqual(
Expand Down Expand Up @@ -195,7 +194,6 @@ describe("node hl7 client - sanity tests", () => {
describe("...Batch", () => {
test("error - Batch Object - single MSH passed", async () => {
try {
// @ts-expect-error
const batch = new Batch({
text: "MSH|^~\\&|||||20081231||ADT^A01^ADT_A01|12345||2.7\rEVN||20081231",
});
Expand Down Expand Up @@ -334,7 +332,6 @@ describe("node hl7 client - sanity tests", () => {

test("...should be used as a Batch", async () => {
try {
// @ts-expect-error
const message = new Message({ text: hl7_batch_msh_string });
} catch (err) {
expect(err).toEqual(
Expand Down
13 changes: 0 additions & 13 deletions __tests__/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions bin/build-types.sh

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginPrettier from 'eslint-plugin-prettier';
import sortClassMembers from "eslint-plugin-sort-class-members";


export default [
pluginJs.configs.recommended,
...tseslint.configs.recommended,
sortClassMembers.configs["flat/recommended"],
{
files: ["**/*.{js,mjs,cjs,ts}"],
plugins: {
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
"exports": {
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"import": "./lib/esm/index.mjs",
"require": "./lib/cjs/index.js",
"default": "./lib/cjs/index.js"
},
"./hl7": {
"types": "./lib/types/hl7.d.ts",
"import": "./lib/esm/hl7.js",
"import": "./lib/esm/hl7.mjs",
"require": "./lib/cjs/hl7.js",
"default": "./lib/cjs/hl7.js"
}
},
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"module": "./lib/esm/index.mjs",
"types": "./lib/types/index.d.ts",
"typesVersions": {
"*": {
Expand All @@ -50,9 +50,8 @@
"LICENSE"
],
"scripts": {
"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",
"build:watch:cjs": "tsc -p src/tsconfig.cjs.json -w",
"build": "tsup",
"build:dev": "NODE_ENV=development tsup",
"clean": "rm -rf coverage docs lib temp",
"format:check": "prettier --check 'pages/**/*.md' 'src/**/*.ts' '__tests__/**/*.ts'",
"format:write": "prettier --write 'pages/**/*.md' 'src/**/*.ts' '__tests__/**/*.ts'",
Expand All @@ -72,36 +71,37 @@
"update:post-update": "npm install && npm run test"
},
"devDependencies": {
"@eslint/js": "^9.26.0",
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
"@eslint/js": "^9.28.0",
"@ianvs/prettier-plugin-sort-imports": "^4.4.2",
"@redis/client": "^5.1.1",
"@shipgirl/typedoc-plugin-versions": "^0.3.1",
"@types/node": "^22.15.17",
"@types/node": "^22.15.29",
"@types/tcp-port-used": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitest/coverage-v8": "^3.1.3",
"@vitest/ui": "^3.1.3",
"eslint": "^9.26.0",
"@typescript-eslint/eslint-plugin": "^8.33.0",
"@typescript-eslint/parser": "^8.33.0",
"@vitest/coverage-v8": "^3.1.4",
"@vitest/ui": "^3.1.4",
"eslint": "^9.28.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.4.0",
"globals": "^16.1.0",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-sort-class-members": "^1.21.0",
"globals": "^16.2.0",
"node-hl7-server": "^3.3.0",
"npm-check-updates": "^18.0.1",
"npm-package-json-lint": "^8.0.0",
"npm-package-json-lint-config-default": "^7.0.1",
"portfinder": "^1.0.37",
"pre-commit": "^1.2.2",
"prettier-plugin-organize-imports": "^4.1.0",
"redis": "^5.0.1",
"redis-memory-server": "^0.12.1",
"snazzy": "^9.0.0",
"sort-package-json": "^3.2.1",
"tcp-port-used": "^1.0.2",
"ts-node": "^10.9.2",
"tsd": "^0.32.0",
"typedoc": "^0.28.4",
"tsup": "^8.5.0",
"typedoc": "^0.28.5",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.0",
"vitest": "^3.1.3"
"typescript-eslint": "^8.33.0",
"vitest": "^3.1.4"
},
"engines": {
"node": ">=20.15.0"
Expand Down
4 changes: 2 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as HL7 from "./hl7.js";
export * as CORE from "./index.js";
export * as HL7 from "./hl7";
export * as CORE from "./index";
20 changes: 10 additions & 10 deletions src/builder/batch.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { HL7FatalError, HL7ParserError } from "../utils/exception.js";
import { normalizedClientBatchBuilderOptions } from "../utils/normalizedBuilder.js";
import { ClientBuilderOptions } from "../utils/types.js";
import { createHL7Date, split } from "../utils/utils.js";
import { FileBatch } from "./fileBatch.js";
import { HL7Node } from "./interface/hL7Node.js";
import { Message } from "./message.js";
import { RootBase } from "./modules/rootBase.js";
import { Segment } from "./modules/segment.js";
import { SegmentList } from "./modules/segmentList.js";
import { HL7FatalError, HL7ParserError } from "@/utils/exception";
import { normalizedClientBatchBuilderOptions } from "@/utils/normalizedBuilder";
import { ClientBuilderOptions } from "@/utils/types";
import { createHL7Date, split } from "@/utils/utils";
import { FileBatch } from "./fileBatch";
import { HL7Node } from "./interface/hL7Node";
import { Message } from "./message";
import { RootBase } from "./modules/rootBase";
import { Segment } from "./modules/segment";
import { SegmentList } from "./modules/segmentList";

/**
* Batch Class
Expand Down
22 changes: 11 additions & 11 deletions src/builder/fileBatch.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { NAME_FORMAT } from "@/utils/constants";
import { HL7FatalError, HL7ParserError } from "@/utils/exception";
import { normalizedClientFileBuilderOptions } from "@/utils/normalizedBuilder";
import { ClientBuilderFileOptions } from "@/utils/types";
import { createHL7Date, split } from "@/utils/utils";
import fs from "node:fs";
import path from "node:path";
import { NAME_FORMAT } from "../utils/constants.js";
import { HL7FatalError, HL7ParserError } from "../utils/exception.js";
import { normalizedClientFileBuilderOptions } from "../utils/normalizedBuilder.js";
import { ClientBuilderFileOptions } from "../utils/types.js";
import { createHL7Date, split } from "../utils/utils.js";
import { Batch } from "./batch.js";
import { HL7Node } from "./interface/hL7Node.js";
import { Message } from "./message.js";
import { RootBase } from "./modules/rootBase.js";
import { Segment } from "./modules/segment.js";
import { SegmentList } from "./modules/segmentList.js";
import { Batch } from "./batch";
import { HL7Node } from "./interface/hL7Node";
import { Message } from "./message";
import { RootBase } from "./modules/rootBase";
import { Segment } from "./modules/segment";
import { SegmentList } from "./modules/segmentList";

/**
* File Batch Class
Expand Down
6 changes: 3 additions & 3 deletions src/builder/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { Batch } from "./batch.js";
export { FileBatch } from "./fileBatch.js";
export { Message } from "./message.js";
export { Batch } from "./batch";
export { FileBatch } from "./fileBatch";
export { Message } from "./message";
20 changes: 10 additions & 10 deletions src/builder/message.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { HL7FatalError, HL7ParserError } from "../utils/exception.js";
import { normalizedClientMessageBuilderOptions } from "../utils/normalizedBuilder.js";
import { ClientBuilderMessageOptions } from "../utils/types.js";
import { isHL7Number, split } from "../utils/utils.js";
import { FileBatch } from "./fileBatch.js";
import { HL7Node } from "./interface/hL7Node.js";
import { NodeBase } from "./modules/nodeBase.js";
import { RootBase } from "./modules/rootBase.js";
import { Segment } from "./modules/segment.js";
import { SegmentList } from "./modules/segmentList.js";
import { HL7FatalError, HL7ParserError } from "@/utils/exception";
import { normalizedClientMessageBuilderOptions } from "@/utils/normalizedBuilder";
import { ClientBuilderMessageOptions } from "@/utils/types";
import { isHL7Number, split } from "@/utils/utils";
import { FileBatch } from "./fileBatch";
import { HL7Node } from "./interface/hL7Node";
import { NodeBase } from "./modules/nodeBase";
import { RootBase } from "./modules/rootBase";
import { Segment } from "./modules/segment";
import { SegmentList } from "./modules/segmentList";

/**
* Message Class
Expand Down
10 changes: 5 additions & 5 deletions src/builder/modules/component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Delimiters } from "../../utils/enum.js";
import { HL7Node } from "../interface/hL7Node.js";
import { NodeBase } from "./nodeBase.js";
import { SubComponent } from "./subComponent.js";
import { ValueNode } from "./valueNode.js";
import { Delimiters } from "@/utils/enum";
import { HL7Node } from "../interface/hL7Node";
import { NodeBase } from "./nodeBase";
import { SubComponent } from "./subComponent";
import { ValueNode } from "./valueNode";

/** @internal */
export class Component extends ValueNode {
Expand Down
2 changes: 1 addition & 1 deletion src/builder/modules/emptyNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HL7Node } from "../interface/hL7Node.js";
import { HL7Node } from "../interface/hL7Node";

/**
* Empty Node
Expand Down
10 changes: 5 additions & 5 deletions src/builder/modules/field.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Delimiters } from "../../utils/enum.js";
import { HL7Node } from "../interface/hL7Node.js";
import { FieldRepetition } from "./fieldRepetition.js";
import { NodeBase } from "./nodeBase.js";
import { ValueNode } from "./valueNode.js";
import { Delimiters } from "@/utils/enum";
import { HL7Node } from "../interface/hL7Node";
import { FieldRepetition } from "./fieldRepetition";
import { NodeBase } from "./nodeBase";
import { ValueNode } from "./valueNode";

/** @internal */
export class Field extends ValueNode {
Expand Down
12 changes: 6 additions & 6 deletions src/builder/modules/fieldRepetition.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Delimiters } from "../../utils/enum.js";
import { HL7FatalError } from "../../utils/exception.js";
import { HL7Node } from "../interface/hL7Node.js";
import { Component } from "./component.js";
import { NodeBase } from "./nodeBase.js";
import { ValueNode } from "./valueNode.js";
import { Delimiters } from "@/utils/enum";
import { HL7FatalError } from "@/utils/exception";
import { HL7Node } from "../interface/hL7Node";
import { Component } from "./component";
import { NodeBase } from "./nodeBase";
import { ValueNode } from "./valueNode";

/** @internal */
export class FieldRepetition extends ValueNode {
Expand Down
17 changes: 8 additions & 9 deletions src/builder/modules/nodeBase.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Delimiters } from "@/utils/enum";
import { HL7FatalError } from "@/utils/exception";
import { isHL7Number, isHL7String, padHL7Date } from "@/utils/utils";
import EventEmitter from "events";
import { Delimiters } from "../../utils/enum.js";
import { HL7FatalError } from "../../utils/exception.js";
import { isHL7Number, isHL7String, padHL7Date } from "../../utils/utils.js";
import { Batch } from "../batch.js";
import { HL7Node } from "../interface/hL7Node.js";
import { Message } from "../message.js";
import { EmptyNode } from "./emptyNode.js";
import { Batch } from "../batch";
import { HL7Node } from "../interface/hL7Node";
import { Message } from "../message";
import { EmptyNode } from "./emptyNode";

/**
* Node Base
* @since 1.0.0
*/
export class NodeBase extends EventEmitter implements HL7Node {
static empty = new EmptyNode();
protected parent: NodeBase | null;

_name: string;
Expand Down Expand Up @@ -40,8 +41,6 @@ export class NodeBase extends EventEmitter implements HL7Node {
this._text = text;
}

static empty = new EmptyNode();

get(path: string | number): HL7Node {
let ret: any;

Expand Down
Loading