@syncbridge/hl7 0.4.1
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.
- package/LICENSE +15 -0
- package/README.md +1 -0
- package/components/hl7-client.component.d.ts +37 -0
- package/components/hl7-client.component.js +137 -0
- package/components/hl7-client.variables.d.ts +15 -0
- package/components/hl7-client.variables.js +72 -0
- package/components/hl7-server.component.d.ts +44 -0
- package/components/hl7-server.component.js +147 -0
- package/components/hl7-server.variables.d.ts +6 -0
- package/components/hl7-server.variables.js +6 -0
- package/components.d.ts +2 -0
- package/components.js +2 -0
- package/constants.d.ts +4 -0
- package/constants.js +7 -0
- package/index.d.ts +5 -0
- package/index.js +9 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright (c) 2025 Panates (Panates Teknoloji Yatirim A.S.). All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software and associated documentation files (the "Software") are
|
|
4
|
+
the proprietary property of Panates and are protected by copyright laws
|
|
5
|
+
and international copyright treaties.
|
|
6
|
+
|
|
7
|
+
Unauthorized copying, distribution, modification, reverse engineering,
|
|
8
|
+
or use of this software, in whole or in part, is strictly prohibited
|
|
9
|
+
without the express written permission of Panates.
|
|
10
|
+
|
|
11
|
+
This Software is provided solely for use in accordance with the terms
|
|
12
|
+
of a valid license agreement. Any unauthorized use may result in
|
|
13
|
+
civil and/or criminal penalties.
|
|
14
|
+
|
|
15
|
+
For licensing inquiries, please contact: info@panates.com
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SyncBridge Ngrok Connectors
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { AddressInfo } from 'node:net';
|
|
3
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
4
|
+
import { ComponentBase } from '@syncbridge/common';
|
|
5
|
+
import { HL7Message } from 'hl7v2';
|
|
6
|
+
import { Hl7Client, HL7Middleware } from 'hl7v2-net';
|
|
7
|
+
import { HL7ClientVariables } from './hl7-client.variables.js';
|
|
8
|
+
/**
|
|
9
|
+
* HL7Client component
|
|
10
|
+
*/
|
|
11
|
+
export declare class HL7ClientComponent<TEvents extends HL7ClientComponent.Events = HL7ClientComponent.Events> extends ComponentBase<TEvents> {
|
|
12
|
+
protected _stopping?: boolean;
|
|
13
|
+
protected _address?: any;
|
|
14
|
+
client: Hl7Client;
|
|
15
|
+
transmitLogger?: TransmitLogger;
|
|
16
|
+
values: HL7ClientVariables;
|
|
17
|
+
protected _init(): Promise<void>;
|
|
18
|
+
protected _start(abortSignal: AbortSignal): Promise<void>;
|
|
19
|
+
protected _stop(): Promise<void>;
|
|
20
|
+
use(handler: HL7Middleware, priority?: number): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @namespace
|
|
24
|
+
*/
|
|
25
|
+
export declare namespace HL7ClientComponent {
|
|
26
|
+
interface Events extends ComponentBase.Events {
|
|
27
|
+
connect: [info: AddressInfo];
|
|
28
|
+
ready: [info: AddressInfo];
|
|
29
|
+
close: [info: AddressInfo];
|
|
30
|
+
error: [error: Error, info: AddressInfo];
|
|
31
|
+
message: [message: HL7Message, info: AddressInfo];
|
|
32
|
+
data: [data: Buffer, info: AddressInfo];
|
|
33
|
+
transmit: [data: Buffer, info: AddressInfo];
|
|
34
|
+
}
|
|
35
|
+
const Variables: typeof HL7ClientVariables;
|
|
36
|
+
type Variables = HL7ClientVariables;
|
|
37
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
4
|
+
import { Component, ComponentBase, ServiceStatus } from '@syncbridge/common';
|
|
5
|
+
import { Hl7Client } from 'hl7v2-net';
|
|
6
|
+
import { noOp, panatesAuthor } from '../constants.js';
|
|
7
|
+
import { HL7ClientVariables } from './hl7-client.variables.js';
|
|
8
|
+
/**
|
|
9
|
+
* HL7Client component
|
|
10
|
+
*/
|
|
11
|
+
let HL7ClientComponent = class HL7ClientComponent extends ComponentBase {
|
|
12
|
+
_stopping;
|
|
13
|
+
_address;
|
|
14
|
+
transmitLogger;
|
|
15
|
+
async _init() {
|
|
16
|
+
await super._init();
|
|
17
|
+
this.values.reconnect = this.values.reconnect || {};
|
|
18
|
+
try {
|
|
19
|
+
if (this.values.tls) {
|
|
20
|
+
this.client = Hl7Client.createTlsClient({
|
|
21
|
+
host: this.values.host,
|
|
22
|
+
port: this.values.port,
|
|
23
|
+
connectTimeout: this.values.connectTimeout,
|
|
24
|
+
responseTimeout: this.values.responseTimeout,
|
|
25
|
+
keepAlive: this.values.keepAlive,
|
|
26
|
+
reconnect: this.values.reconnect,
|
|
27
|
+
...this.values.tls,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.client = Hl7Client.createClient({
|
|
32
|
+
host: this.values.host,
|
|
33
|
+
port: this.values.port,
|
|
34
|
+
connectTimeout: this.values.connectTimeout,
|
|
35
|
+
responseTimeout: this.values.responseTimeout,
|
|
36
|
+
keepAlive: this.values.keepAlive,
|
|
37
|
+
reconnect: {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
strategy: 'exponential',
|
|
40
|
+
...this.values.reconnect,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
this.client.on('connect', () => {
|
|
45
|
+
this._address = { ...this.client.address() };
|
|
46
|
+
this._address.toString = function () {
|
|
47
|
+
return `${this.address}:${this.port}`;
|
|
48
|
+
}.bind(this._address);
|
|
49
|
+
if (this.transmitLogger)
|
|
50
|
+
this.transmitLogger.info('Connected', `${this._address}`);
|
|
51
|
+
this.logger?.trace(`Connected to ${this._address}`);
|
|
52
|
+
this.emit('connect', this._address);
|
|
53
|
+
});
|
|
54
|
+
this.client.on('ready', () => this.emit('ready', this._address));
|
|
55
|
+
this.client.on('close', () => {
|
|
56
|
+
if (this.transmitLogger)
|
|
57
|
+
this.transmitLogger.info('Disconnected', this._address);
|
|
58
|
+
this.logger?.trace(`Disconnected from ${this._address}`);
|
|
59
|
+
this.emit('close', this._address);
|
|
60
|
+
});
|
|
61
|
+
this.client.on('error', error => {
|
|
62
|
+
error = error instanceof AggregateError ? error.errors[0] : error;
|
|
63
|
+
if (error.code === 'ECONNREFUSED')
|
|
64
|
+
error.message = `Connection refused to ${error.address}:${error.port}`;
|
|
65
|
+
this.logger?.error(error);
|
|
66
|
+
this.emit('error', error, this._address);
|
|
67
|
+
});
|
|
68
|
+
this.client.on('message', message => {
|
|
69
|
+
this.logger?.trace(`HL7 message (${message.messageType}) received from ${this.client.uri}`);
|
|
70
|
+
this.emit('message', message, this._address);
|
|
71
|
+
});
|
|
72
|
+
this.client.on('send', message => {
|
|
73
|
+
this.logger?.trace(`HL7 message (${message.messageType}) sent to ${this.client.uri}`);
|
|
74
|
+
this.emit('send', message, this._address);
|
|
75
|
+
});
|
|
76
|
+
this.client.on('data', data => {
|
|
77
|
+
this.emit('data', data, this._address);
|
|
78
|
+
});
|
|
79
|
+
const { communicationLogs } = this.values;
|
|
80
|
+
const { dataDirectory } = this.processor;
|
|
81
|
+
if (communicationLogs) {
|
|
82
|
+
const transmitLogger = (this.transmitLogger = new TransmitLogger({
|
|
83
|
+
...communicationLogs,
|
|
84
|
+
logDirectory: dataDirectory
|
|
85
|
+
? path.join(dataDirectory, 'comm-logs')
|
|
86
|
+
: undefined,
|
|
87
|
+
name: this.path.replace(/\//g, '-'),
|
|
88
|
+
maxFiles: communicationLogs?.maxFiles,
|
|
89
|
+
maxFileSize: communicationLogs?.maxFileSize,
|
|
90
|
+
}));
|
|
91
|
+
this.on('data', (data, info) => {
|
|
92
|
+
transmitLogger.received(data, info);
|
|
93
|
+
});
|
|
94
|
+
this.on('transmit', (data, info) => {
|
|
95
|
+
transmitLogger.transmitted(data, info);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
this.logger?.error(err);
|
|
101
|
+
this.setStatus(ServiceStatus.unhealthy, err.message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async _start(abortSignal) {
|
|
105
|
+
this._stopping = false;
|
|
106
|
+
this.client.connect().catch(noOp);
|
|
107
|
+
await super._start(abortSignal);
|
|
108
|
+
}
|
|
109
|
+
async _stop() {
|
|
110
|
+
this._stopping = true;
|
|
111
|
+
await this.client.close(30000);
|
|
112
|
+
return super._stop();
|
|
113
|
+
}
|
|
114
|
+
use(handler, priority) {
|
|
115
|
+
return this.client.use(handler, priority);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
__decorate([
|
|
119
|
+
Component.UseVariables(),
|
|
120
|
+
__metadata("design:type", HL7ClientVariables)
|
|
121
|
+
], HL7ClientComponent.prototype, "values", void 0);
|
|
122
|
+
HL7ClientComponent = __decorate([
|
|
123
|
+
Component({
|
|
124
|
+
className: 'HL7Client',
|
|
125
|
+
displayName: 'HL7 Client',
|
|
126
|
+
description: 'HL7 Client component',
|
|
127
|
+
author: panatesAuthor,
|
|
128
|
+
tags: ['hl7', 'client'],
|
|
129
|
+
})
|
|
130
|
+
], HL7ClientComponent);
|
|
131
|
+
export { HL7ClientComponent };
|
|
132
|
+
/**
|
|
133
|
+
* @namespace
|
|
134
|
+
*/
|
|
135
|
+
(function (HL7ClientComponent) {
|
|
136
|
+
HL7ClientComponent.Variables = HL7ClientVariables;
|
|
137
|
+
})(HL7ClientComponent || (HL7ClientComponent = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
2
|
+
import { TcpClientComponent } from '@syncbridge/net';
|
|
3
|
+
/**
|
|
4
|
+
* Variables
|
|
5
|
+
*/
|
|
6
|
+
export declare class HL7ClientVariables {
|
|
7
|
+
host: string;
|
|
8
|
+
port: number;
|
|
9
|
+
keepAlive: boolean;
|
|
10
|
+
connectTimeout: number;
|
|
11
|
+
responseTimeout: number;
|
|
12
|
+
tls: TcpClientComponent.TlsVariables;
|
|
13
|
+
reconnect: TcpClientComponent.ReconnectVariables;
|
|
14
|
+
communicationLogs?: TransmitLogger.Variables;
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
3
|
+
import { DefineVariable } from '@syncbridge/common';
|
|
4
|
+
import { TcpClientComponent } from '@syncbridge/net';
|
|
5
|
+
/**
|
|
6
|
+
* Variables
|
|
7
|
+
*/
|
|
8
|
+
export class HL7ClientVariables {
|
|
9
|
+
}
|
|
10
|
+
__decorate([
|
|
11
|
+
DefineVariable({
|
|
12
|
+
label: 'Host',
|
|
13
|
+
description: 'Hostname or IP address to be connected to',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], HL7ClientVariables.prototype, "host", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
DefineVariable({
|
|
20
|
+
label: 'Port',
|
|
21
|
+
description: 'Port number of target listener',
|
|
22
|
+
required: true,
|
|
23
|
+
minValue: 1,
|
|
24
|
+
maxValue: 65535,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], HL7ClientVariables.prototype, "port", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
DefineVariable({
|
|
30
|
+
label: 'Keep alive',
|
|
31
|
+
description: 'Enables keep-alive on the TCP socket',
|
|
32
|
+
default: false,
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", Boolean)
|
|
35
|
+
], HL7ClientVariables.prototype, "keepAlive", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
DefineVariable({
|
|
38
|
+
label: 'Connect timeout',
|
|
39
|
+
description: 'Connection timeout in milliseconds',
|
|
40
|
+
default: 10000,
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], HL7ClientVariables.prototype, "connectTimeout", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
DefineVariable({
|
|
46
|
+
label: 'Response timeout',
|
|
47
|
+
description: 'Response timeout in milliseconds',
|
|
48
|
+
default: 30000,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], HL7ClientVariables.prototype, "responseTimeout", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
DefineVariable({
|
|
54
|
+
label: 'TLS',
|
|
55
|
+
description: 'TLS options',
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:type", TcpClientComponent.TlsVariables)
|
|
58
|
+
], HL7ClientVariables.prototype, "tls", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
DefineVariable({
|
|
61
|
+
label: 'Reconnect',
|
|
62
|
+
description: 'Reconnect options',
|
|
63
|
+
}),
|
|
64
|
+
__metadata("design:type", TcpClientComponent.ReconnectVariables)
|
|
65
|
+
], HL7ClientVariables.prototype, "reconnect", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
DefineVariable({
|
|
68
|
+
label: 'Communication Logs',
|
|
69
|
+
description: 'Stores communication logs if enabled',
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", TransmitLogger.Variables)
|
|
72
|
+
], HL7ClientVariables.prototype, "communicationLogs", void 0);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import net, { AddressInfo } from 'node:net';
|
|
2
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
3
|
+
import { ComponentBase } from '@syncbridge/common';
|
|
4
|
+
import { TcpServerComponent } from '@syncbridge/net';
|
|
5
|
+
import { HL7Message } from 'hl7v2';
|
|
6
|
+
import { HL7Middleware, HL7Server, HL7Socket } from 'hl7v2-net';
|
|
7
|
+
import { HL7ServerVariables } from './hl7-server.variables.js';
|
|
8
|
+
/**
|
|
9
|
+
* HL7Server component
|
|
10
|
+
*/
|
|
11
|
+
export declare class HL7ServerComponent<TEvents extends HL7ServerComponent.Events = HL7ServerComponent.Events> extends ComponentBase<TEvents> {
|
|
12
|
+
protected _stopping?: boolean;
|
|
13
|
+
server: HL7Server;
|
|
14
|
+
transmitLogger?: TransmitLogger;
|
|
15
|
+
values: HL7ServerVariables;
|
|
16
|
+
protected _init(): Promise<void>;
|
|
17
|
+
protected _start(abortSignal: AbortSignal): Promise<void>;
|
|
18
|
+
protected _stop(): Promise<void>;
|
|
19
|
+
use(handler: HL7Middleware, priority?: number): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @namespace
|
|
23
|
+
*/
|
|
24
|
+
export declare namespace HL7ServerComponent {
|
|
25
|
+
interface Events extends ComponentBase.Events {
|
|
26
|
+
listening: [];
|
|
27
|
+
close: [];
|
|
28
|
+
connection: [info: AddressInfo, socket: HL7Socket];
|
|
29
|
+
disconnect: [info: AddressInfo, socket: HL7Socket];
|
|
30
|
+
drop: [data?: net.DropArgument];
|
|
31
|
+
error: [error: Error, info?: AddressInfo, socket?: HL7Socket | undefined];
|
|
32
|
+
warning: [
|
|
33
|
+
error: Error | string,
|
|
34
|
+
info: AddressInfo,
|
|
35
|
+
socket: HL7Socket | undefined
|
|
36
|
+
];
|
|
37
|
+
message: [message: HL7Message, info: AddressInfo, socket: HL7Socket];
|
|
38
|
+
transmit: [message: HL7Message, info: AddressInfo, socket: HL7Socket];
|
|
39
|
+
}
|
|
40
|
+
const Variables: typeof HL7ServerVariables;
|
|
41
|
+
type Variables = HL7ServerVariables;
|
|
42
|
+
const TlsVariables: typeof import("packages-ext/net/build/components/tcp-server.variables.js").TcpServerTlsVariables;
|
|
43
|
+
type TlsVariables = TcpServerComponent.TlsVariables;
|
|
44
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { TransmitLogger } from '@syncbridge/builtins';
|
|
4
|
+
import { Component, ComponentBase, ServiceStatus } from '@syncbridge/common';
|
|
5
|
+
import { TcpServerComponent } from '@syncbridge/net';
|
|
6
|
+
import { HL7Server } from 'hl7v2-net';
|
|
7
|
+
import { panatesAuthor } from '../constants.js';
|
|
8
|
+
import { HL7ServerVariables } from './hl7-server.variables.js';
|
|
9
|
+
/**
|
|
10
|
+
* HL7Server component
|
|
11
|
+
*/
|
|
12
|
+
let HL7ServerComponent = class HL7ServerComponent extends ComponentBase {
|
|
13
|
+
_stopping;
|
|
14
|
+
transmitLogger;
|
|
15
|
+
async _init() {
|
|
16
|
+
await super._init();
|
|
17
|
+
try {
|
|
18
|
+
if (this.values.tls) {
|
|
19
|
+
this.server = HL7Server.createTlsServer(this.values.tls);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.server = HL7Server.createServer();
|
|
23
|
+
}
|
|
24
|
+
this.server.on('listening', () => this.emit('listening'));
|
|
25
|
+
this.server.on('close', () => this.emit('close'));
|
|
26
|
+
this.server.on('connection', socket => {
|
|
27
|
+
this.logger?.trace(`Connection from: ${socket.remoteAddress()}`);
|
|
28
|
+
const info = {
|
|
29
|
+
address: socket.remoteAddress(),
|
|
30
|
+
toString: () => socket.remoteAddress(),
|
|
31
|
+
};
|
|
32
|
+
this.emit('connection', info, socket);
|
|
33
|
+
});
|
|
34
|
+
this.server.on('disconnect', socket => {
|
|
35
|
+
this.logger?.trace(`Disconnected: ${socket.remoteAddress()}`);
|
|
36
|
+
const info = {
|
|
37
|
+
address: socket.remoteAddress(),
|
|
38
|
+
toString: () => socket.remoteAddress(),
|
|
39
|
+
};
|
|
40
|
+
this.emit('disconnect', info, socket);
|
|
41
|
+
});
|
|
42
|
+
this.server.on('error', (error, socket) => {
|
|
43
|
+
if (socket) {
|
|
44
|
+
error.message = error.message + ` [${socket?.remoteAddress()}]`;
|
|
45
|
+
}
|
|
46
|
+
if (error.code === 'ECONNRESET')
|
|
47
|
+
return;
|
|
48
|
+
this.logger?.error(error);
|
|
49
|
+
if (socket) {
|
|
50
|
+
const info = {
|
|
51
|
+
address: socket.remoteAddress(),
|
|
52
|
+
toString: () => socket.remoteAddress(),
|
|
53
|
+
};
|
|
54
|
+
this.emit('error', error, info, socket);
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
this.emit('error', error);
|
|
58
|
+
});
|
|
59
|
+
this.server.on('message', (message, socket) => {
|
|
60
|
+
this.logger?.trace(`HL7 message (${message.messageType}) received from ${socket.remoteAddress()}`);
|
|
61
|
+
const info = {
|
|
62
|
+
address: socket.remoteAddress(),
|
|
63
|
+
toString: () => socket.remoteAddress(),
|
|
64
|
+
};
|
|
65
|
+
this.emit('message', message, info, socket);
|
|
66
|
+
});
|
|
67
|
+
this.server.on('send', (message, socket) => {
|
|
68
|
+
this.logger?.trace(`HL7 message (${message.messageType}) sent to ${socket.remoteAddress()}`);
|
|
69
|
+
const info = {
|
|
70
|
+
address: socket.remoteAddress(),
|
|
71
|
+
toString: () => socket.remoteAddress(),
|
|
72
|
+
};
|
|
73
|
+
this.emit('send', message, info, socket);
|
|
74
|
+
});
|
|
75
|
+
this.server.on('data', (data, socket) => {
|
|
76
|
+
const info = {
|
|
77
|
+
address: socket.remoteAddress(),
|
|
78
|
+
toString: () => socket.remoteAddress(),
|
|
79
|
+
};
|
|
80
|
+
this.emit('data', data, info, socket);
|
|
81
|
+
});
|
|
82
|
+
this.server.on('write', (data, socket) => {
|
|
83
|
+
const info = {
|
|
84
|
+
address: socket.remoteAddress(),
|
|
85
|
+
toString: () => socket.remoteAddress(),
|
|
86
|
+
};
|
|
87
|
+
this.emit('transmit', data, info, socket);
|
|
88
|
+
});
|
|
89
|
+
const { communicationLogs } = this.values;
|
|
90
|
+
const { dataDirectory } = this.processor;
|
|
91
|
+
if (communicationLogs) {
|
|
92
|
+
const transmitLogger = (this.transmitLogger = new TransmitLogger({
|
|
93
|
+
...communicationLogs,
|
|
94
|
+
logDirectory: dataDirectory
|
|
95
|
+
? path.join(dataDirectory, 'comm-logs')
|
|
96
|
+
: undefined,
|
|
97
|
+
name: this.path.replace(/\//g, '-'),
|
|
98
|
+
maxFiles: communicationLogs?.maxFiles,
|
|
99
|
+
maxFileSize: communicationLogs?.maxFileSize,
|
|
100
|
+
}));
|
|
101
|
+
this.on('data', (data, info) => {
|
|
102
|
+
transmitLogger.received(data, info);
|
|
103
|
+
});
|
|
104
|
+
this.on('transmit', (data, info) => {
|
|
105
|
+
transmitLogger.transmitted(data, info);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
this.logger?.error(err);
|
|
111
|
+
this.setStatus(ServiceStatus.unhealthy, err.message);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async _start(abortSignal) {
|
|
115
|
+
this._stopping = false;
|
|
116
|
+
await this.server.listen(this.values.port);
|
|
117
|
+
super._start(abortSignal);
|
|
118
|
+
}
|
|
119
|
+
async _stop() {
|
|
120
|
+
this._stopping = true;
|
|
121
|
+
await this.server.close(30000);
|
|
122
|
+
}
|
|
123
|
+
use(handler, priority) {
|
|
124
|
+
return this.server.use(handler, priority);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
__decorate([
|
|
128
|
+
Component.UseVariables(),
|
|
129
|
+
__metadata("design:type", HL7ServerVariables)
|
|
130
|
+
], HL7ServerComponent.prototype, "values", void 0);
|
|
131
|
+
HL7ServerComponent = __decorate([
|
|
132
|
+
Component({
|
|
133
|
+
className: 'HL7Server',
|
|
134
|
+
displayName: 'HL7 Server',
|
|
135
|
+
description: 'HL7 server component',
|
|
136
|
+
author: panatesAuthor,
|
|
137
|
+
tags: ['hl7', 'server'],
|
|
138
|
+
})
|
|
139
|
+
], HL7ServerComponent);
|
|
140
|
+
export { HL7ServerComponent };
|
|
141
|
+
/**
|
|
142
|
+
* @namespace
|
|
143
|
+
*/
|
|
144
|
+
(function (HL7ServerComponent) {
|
|
145
|
+
HL7ServerComponent.Variables = HL7ServerVariables;
|
|
146
|
+
HL7ServerComponent.TlsVariables = TcpServerComponent.TlsVariables;
|
|
147
|
+
})(HL7ServerComponent || (HL7ServerComponent = {}));
|
package/components.d.ts
ADDED
package/components.js
ADDED
package/constants.d.ts
ADDED
package/constants.js
ADDED
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { makeExtensionPackage } from '@syncbridge/common';
|
|
2
|
+
import * as components from './components.js';
|
|
3
|
+
export { components };
|
|
4
|
+
export * from './components.js';
|
|
5
|
+
const cfg = makeExtensionPackage({
|
|
6
|
+
processors: [],
|
|
7
|
+
components: Object.values(components),
|
|
8
|
+
});
|
|
9
|
+
export default cfg;
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@syncbridge/hl7",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "SyncBridge HL7 connection components",
|
|
5
|
+
"author": "Panates Inc",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"ansi-colors": "^4.1.3",
|
|
9
|
+
"fast-tokenizer": "^1.9.0",
|
|
10
|
+
"hl7v2": "^1.7.0",
|
|
11
|
+
"hl7v2-net": "^1.7.0",
|
|
12
|
+
"node-events-async": "^1.5.0"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@syncbridge/common": "^0.4.1",
|
|
16
|
+
"@syncbridge/builtins": "^0.4.1",
|
|
17
|
+
"@syncbridge/net": "^0.4.1"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./index.d.ts",
|
|
22
|
+
"default": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"module": "./index.js",
|
|
28
|
+
"types": "./index.d.ts",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|