From e0be38ff411122229d9dbf3acf7a864b7f59f229 Mon Sep 17 00:00:00 2001 From: Bugs5382 Date: Sun, 23 Jun 2024 07:37:27 -0400 Subject: [PATCH 1/2] docs: updated docs [ci skip] --- src/client/client.ts | 9 ++++++--- src/client/connection.ts | 4 ++-- src/client/module/inboundResponse.ts | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index ef6621b..277cd69 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -30,6 +30,9 @@ export class Client extends EventEmitter { } /** + * This creates a new client to a new server connection. + * This is the remote side in which we will connect. + * Then using the createConnection {@link createConnection} method establish a connection to the port. * @since 1.0.0 * @param props * @example @@ -71,11 +74,11 @@ export class Client extends EventEmitter { createConnection (props: ClientListenerOptions, cb: OutboundHandler): Connection { const outbound = new Connection(this, props, cb) - outbound.on('client.acknowledged', (total) => { + outbound.on('client.acknowledged', (total: number) => { this.stats._totalAck = this.stats._totalAck + total }) - outbound.on('client.sent', (total) => { + outbound.on('client.sent', (total: number) => { this.stats._totalSent = this.stats._totalSent + total }) @@ -87,7 +90,7 @@ export class Client extends EventEmitter { } /** - * Get the host that we will connect to. + * Get the host that we will connect to. * The port might be different from each different "connection" * @since 1.1.0 */ diff --git a/src/client/connection.ts b/src/client/connection.ts index 5908fa1..dfe63fa 100644 --- a/src/client/connection.ts +++ b/src/client/connection.ts @@ -14,7 +14,7 @@ import { Client } from './client.js' import { InboundResponse } from './module/inboundResponse.js' /* eslint-disable */ -export interface Connection extends EventEmitter { +export interface IConnection extends EventEmitter { /** The connection has been closed manually. You have to start the connection again. */ on(name: 'close', cb: () => void): this; /** The connection is made. */ @@ -37,7 +37,7 @@ export interface Connection extends EventEmitter { /** Connection Class * @description Create a connection customer that will listen to result send to the particular port. * @since 1.0.0 */ -export class Connection extends EventEmitter implements Connection { +export class Connection extends EventEmitter implements IConnection { /** @internal */ _handler: OutboundHandler /** @internal */ diff --git a/src/client/module/inboundResponse.ts b/src/client/module/inboundResponse.ts index 8365123..41e0541 100644 --- a/src/client/module/inboundResponse.ts +++ b/src/client/module/inboundResponse.ts @@ -10,7 +10,8 @@ export class InboundResponse { /** * Process the Inbound Response from the Server - * @description This takes the string of the response from the server and makes it a message. A response from a broker SHOULD always be a + * @description This takes the string of the response from the server and makes it a message. + * A response from a broker SHOULD always be a properly formated Hl7 message, we hope. * @since 1.0.0 * @param data */ From 6b884ff6c5a6e43bbb52c4de37a8afec229c599e Mon Sep 17 00:00:00 2001 From: Bugs5382 Date: Sun, 23 Jun 2024 08:29:41 -0400 Subject: [PATCH 2/2] feat: typedoc working! - closes #37 --- .github/workflows/deploy-docs.yml | 28 ++++++++++++++++++++++++++++ README.md | 4 +++- package.json | 2 +- src/client/client.ts | 2 +- src/index.ts | 4 ++-- src/utils/normalizedBuilder.ts | 2 +- src/utils/utils.ts | 2 +- tsconfig.cjs.json | 8 ++++---- tsconfig.esm.json | 14 +++++--------- tsconfig.json | 28 +++++++++++++++------------- typedoc.json | 2 +- 11 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..421be0d --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,28 @@ +name: Deploy Typedoc to GitHub Pages + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + - name: Install dependencies + run: npm install + - name: Generate Typedoc documentation + run: npm run typedoc + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GH_TOKEN }} + publish_dir: ./docs + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' \ No newline at end of file diff --git a/README.md b/README.md index 0963ea2..8501aa3 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,9 @@ They might be sans uppercase throughout the documentation, but they would have t ## Documentation -It's way too extensive to include on this README alone. Please [read this](pages/index.md) to gain more information. +It's way too extensive to include on this README alone. +Please [read this](pages/index.md) to gain more information. +GitHub pages now has mostly full listing of all methods, classes, etc., but only for the most recent release. ## Acknowledgements diff --git a/package.json b/package.json index febdcf8..30a65ce 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "ts-node": "^10.9.2", "ts-standard": "^12.0.2", "tsd": "^0.31.1", - "typedoc": "^0.26.0", + "typedoc": "^0.26.1", "typescript": "5.5.2", "vitest": "^1.6.0" }, diff --git a/src/client/client.ts b/src/client/client.ts index 277cd69..2081c3f 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -32,7 +32,7 @@ export class Client extends EventEmitter { /** * This creates a new client to a new server connection. * This is the remote side in which we will connect. - * Then using the createConnection {@link createConnection} method establish a connection to the port. + * Then using the {@link createConnection} method, you establish a connection to the port. * @since 1.0.0 * @param props * @example diff --git a/src/index.ts b/src/index.ts index d6570ed..ea21b5c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import { Client } from './client/client.js' import { Message } from './builder/message.js' import { Batch } from './builder/batch.js' import { FileBatch } from './builder/fileBatch.js' -import { Connection } from './client/connection.js' +import { Connection, IConnection } from './client/connection.js' import { Delimiters, ReadyState } from './utils/enum.js' import { OutboundHandler } from './utils/normalizedClient.js' import { InboundResponse } from './client/module/inboundResponse.js' @@ -18,4 +18,4 @@ export type { ClientBuilderFileOptions, ClientBuilderMessageOptions, ClientBuild export type { HL7Error, HL7FatalError, HL7ParserError } from './utils/exception.js' export default Client -export { Client, Connection, OutboundHandler, InboundResponse, FileBatch, Batch, Message, ReadyState, NodeBase, EmptyNode, Segment, Delimiters, HL7Node } +export { Client, Connection, IConnection, OutboundHandler, InboundResponse, FileBatch, Batch, Message, ReadyState, NodeBase, EmptyNode, Segment, Delimiters, HL7Node } diff --git a/src/utils/normalizedBuilder.ts b/src/utils/normalizedBuilder.ts index f8d4449..df680f8 100644 --- a/src/utils/normalizedBuilder.ts +++ b/src/utils/normalizedBuilder.ts @@ -1,6 +1,6 @@ import fs from 'fs' import { HL7_2_7 } from '../specification/2.7.js' -import { MSH } from '../specification/specification' +import { MSH } from '../specification/specification.js' import { HL7FatalError } from './exception.js' import { ParserPlan } from './parserPlan.js' import { isBatch } from './utils.js' diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 9ebe87d..207158c 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -163,7 +163,7 @@ export const validIPv6 = (ip: string): boolean => { } /** - * Generate a random String + * Generate a random string * @since 1.0.0 * @param length */ diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index 655ed56..69ffada 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -1,9 +1,9 @@ { - "extends": "./tsconfig.build.json", + "extends": "./tsconfig.json", "compilerOptions": { - "declaration": false, - "sourceMap": false, "module": "commonjs", - "outDir": "./lib/cjs" + "outDir": "./lib/cjs", + "declaration": false, + "sourceMap": false } } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 84bbf40..26fc9aa 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -1,13 +1,9 @@ { - "extends": "./tsconfig.build.json", + "extends": "./tsconfig.json", "compilerOptions": { - "declaration": false, - "sourceMap": false, - "target": "ES2022", - "lib": [ - "es2021" - ], - "module": "es6", - "outDir": "./lib/esm" + "module": "ESNext", + "outDir": "./lib/esm", + "declaration": true, + "sourceMap": true } } diff --git a/tsconfig.json b/tsconfig.json index f8503a6..65d3e2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,25 @@ { "compilerOptions": { - "allowJs": false, - "stripInternal": true, + "target": "ES2020", + "module": "commonjs", + "lib": ["ES2020"], + "outDir": "./dist", + "rootDir": "./src", "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, "noImplicitAny": true, + "noImplicitReturns": true, "noImplicitThis": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true, + "typeRoots": ["./node_modules/@types"], "moduleResolution": "node", - "strictNullChecks": true, - "typeRoots": [ - "./node_modules/@types", - "./@types" - ], - "esModuleInterop": true + "sourceMap": true, + "declaration": true }, - "compileOnSave": true + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "**/*.spec.ts"] } diff --git a/typedoc.json b/typedoc.json index aeefb48..d88749c 100644 --- a/typedoc.json +++ b/typedoc.json @@ -2,7 +2,7 @@ "entryPoints": ["src/api.ts"], "excludeExternals": true, "excludeInternal": true, - "includeVersion": false, + "includeVersion": true, "githubPages": false, "out": "./docs", "name": "Node HL7 Client",