@dave-inthecloud/mirthsync 0.0.0-stage → 3.8.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/README.md +83 -2
- package/bin/mirthsync.js +181 -0
- package/lib/mirthsync.jar +0 -0
- package/package.json +47 -4
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dave-inthecloud/mirthsync
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DevOps tool for Mirth Connect and Open Integration Engine version control and CI/CD automation.
|
|
4
|
+
|
|
5
|
+
> **Fork notice:** this is a fork of [@saga-it/mirthsync](https://www.npmjs.com/package/@saga-it/mirthsync)
|
|
6
|
+
> by Saga IT. It adds the orphan-check performance fix proposed upstream in
|
|
7
|
+
> [SagaHealthcareIT/mirthsync#97](https://github.com/SagaHealthcareIT/mirthsync/pull/97)
|
|
8
|
+
> (`pull` with a few hundred channels goes from minutes to seconds). Once that fix is
|
|
9
|
+
> released upstream, switch back to `@saga-it/mirthsync`.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @dave-inthecloud/mirthsync
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
**Java JRE or JDK version 8 or higher is required.**
|
|
20
|
+
|
|
21
|
+
If Java is not installed, mirthsync will display platform-specific installation instructions when you run it.
|
|
22
|
+
|
|
23
|
+
### Quick Java Installation
|
|
24
|
+
|
|
25
|
+
**macOS:**
|
|
26
|
+
```bash
|
|
27
|
+
brew install openjdk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Linux (Debian/Ubuntu):**
|
|
31
|
+
```bash
|
|
32
|
+
sudo apt update && sudo apt install default-jre
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Linux (Fedora/RHEL):**
|
|
36
|
+
```bash
|
|
37
|
+
sudo dnf install java-latest-openjdk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Windows:**
|
|
41
|
+
```bash
|
|
42
|
+
winget install Microsoft.OpenJDK.21
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
After installation, mirthsync is available globally:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Show help
|
|
51
|
+
mirthsync -h
|
|
52
|
+
|
|
53
|
+
# Pull configuration from a Mirth Connect server
|
|
54
|
+
mirthsync -s https://localhost:8443/api -u admin -p admin pull -t ./mirth-config
|
|
55
|
+
|
|
56
|
+
# Push configuration to a server
|
|
57
|
+
mirthsync -s https://localhost:8443/api -u admin -p admin push -t ./mirth-config
|
|
58
|
+
|
|
59
|
+
# Git operations (no server credentials required)
|
|
60
|
+
mirthsync -t ./mirth-config git status
|
|
61
|
+
mirthsync -t ./mirth-config git add
|
|
62
|
+
mirthsync -t ./mirth-config --commit-message "Updated channels" git commit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
|
|
67
|
+
- Synchronize channels, code templates, configuration maps, and global scripts
|
|
68
|
+
- Built-in Git integration for version control
|
|
69
|
+
- Token-based or username/password authentication
|
|
70
|
+
- Orphaned file detection and cleanup
|
|
71
|
+
- Bulk channel deployment
|
|
72
|
+
- Multiple disk modes (backup, groups, items, code)
|
|
73
|
+
- CI/CD pipeline integration
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
Product page: https://saga-it.com/products/mirthsync
|
|
78
|
+
|
|
79
|
+
For complete documentation and source, visit:
|
|
80
|
+
https://github.com/SagaHealthcareIT/mirthsync
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
Eclipse Public License 1.0
|
package/bin/mirthsync.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn, spawnSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const JAR_NAME = 'mirthsync.jar';
|
|
8
|
+
|
|
9
|
+
function getJavaInstallInstructions() {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
|
|
12
|
+
let instructions = `
|
|
13
|
+
Java is required to run mirthsync but was not found on your system.
|
|
14
|
+
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
switch (platform) {
|
|
18
|
+
case 'darwin':
|
|
19
|
+
instructions += `To install Java on macOS:
|
|
20
|
+
|
|
21
|
+
Using Homebrew (recommended):
|
|
22
|
+
brew install openjdk
|
|
23
|
+
|
|
24
|
+
Or download from:
|
|
25
|
+
https://adoptium.net/
|
|
26
|
+
|
|
27
|
+
After installation, you may need to add Java to your PATH:
|
|
28
|
+
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
|
|
29
|
+
source ~/.zshrc
|
|
30
|
+
`;
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case 'linux':
|
|
34
|
+
instructions += `To install Java on Linux:
|
|
35
|
+
|
|
36
|
+
Debian/Ubuntu:
|
|
37
|
+
sudo apt update && sudo apt install default-jre
|
|
38
|
+
|
|
39
|
+
Fedora/RHEL/CentOS:
|
|
40
|
+
sudo dnf install java-latest-openjdk
|
|
41
|
+
|
|
42
|
+
Arch Linux:
|
|
43
|
+
sudo pacman -S jre-openjdk
|
|
44
|
+
|
|
45
|
+
Or download from:
|
|
46
|
+
https://adoptium.net/
|
|
47
|
+
`;
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'win32':
|
|
51
|
+
instructions += `To install Java on Windows:
|
|
52
|
+
|
|
53
|
+
Using winget:
|
|
54
|
+
winget install Microsoft.OpenJDK.21
|
|
55
|
+
|
|
56
|
+
Using Chocolatey:
|
|
57
|
+
choco install openjdk
|
|
58
|
+
|
|
59
|
+
Or download from:
|
|
60
|
+
https://adoptium.net/
|
|
61
|
+
|
|
62
|
+
After installation, you may need to restart your terminal.
|
|
63
|
+
`;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
default:
|
|
67
|
+
instructions += `Please install Java JRE or JDK version 8 or higher.
|
|
68
|
+
Download from: https://adoptium.net/
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
instructions += `
|
|
73
|
+
Minimum required version: Java 8
|
|
74
|
+
Recommended: Java 11, 17, or 21 (LTS versions)
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
return instructions;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function findJava() {
|
|
81
|
+
// Check if java is in PATH
|
|
82
|
+
const javaCommand = process.platform === 'win32' ? 'java.exe' : 'java';
|
|
83
|
+
|
|
84
|
+
// Try running java -version to check if it's available. As with the
|
|
85
|
+
// main spawn below, do not use a shell here: it is unnecessary for a
|
|
86
|
+
// no-argument detection call, and a shell launched when java is absent
|
|
87
|
+
// can still write to stderr, which would be misread as "java present".
|
|
88
|
+
const result = spawnSync(javaCommand, ['-version'], {
|
|
89
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
90
|
+
encoding: 'utf8'
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (!result.error && (result.status === 0 || result.stderr)) {
|
|
94
|
+
// Java outputs version to stderr
|
|
95
|
+
return javaCommand;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Check JAVA_HOME
|
|
99
|
+
const javaHome = process.env.JAVA_HOME;
|
|
100
|
+
if (javaHome) {
|
|
101
|
+
const javaPath = path.join(javaHome, 'bin', javaCommand);
|
|
102
|
+
if (fs.existsSync(javaPath)) {
|
|
103
|
+
const homeResult = spawnSync(javaPath, ['-version'], {
|
|
104
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
105
|
+
encoding: 'utf8'
|
|
106
|
+
});
|
|
107
|
+
if (!homeResult.error && (homeResult.status === 0 || homeResult.stderr)) {
|
|
108
|
+
return javaPath;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function getJarPath() {
|
|
117
|
+
// The JAR is in ../lib/ relative to this script
|
|
118
|
+
return path.join(__dirname, '..', 'lib', JAR_NAME);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function main() {
|
|
122
|
+
// Find Java
|
|
123
|
+
const javaPath = findJava();
|
|
124
|
+
|
|
125
|
+
if (!javaPath) {
|
|
126
|
+
console.error(getJavaInstallInstructions());
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Find the JAR file
|
|
131
|
+
const jarPath = getJarPath();
|
|
132
|
+
|
|
133
|
+
if (!fs.existsSync(jarPath)) {
|
|
134
|
+
console.error(`Error: mirthsync JAR file not found at ${jarPath}`);
|
|
135
|
+
console.error('This may indicate a corrupted installation. Try reinstalling:');
|
|
136
|
+
console.error(' npm uninstall -g @dave-inthecloud/mirthsync');
|
|
137
|
+
console.error(' npm install -g @dave-inthecloud/mirthsync');
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Build the command arguments
|
|
142
|
+
const args = ['-jar', jarPath, ...process.argv.slice(2)];
|
|
143
|
+
|
|
144
|
+
// Spawn Java process with inherited stdio for full interactivity.
|
|
145
|
+
//
|
|
146
|
+
// Do NOT run this through a shell. With shell:true on Windows, Node
|
|
147
|
+
// concatenates the argv into a single command string without quoting
|
|
148
|
+
// (see Node's DEP0190 warning), so any argument containing a space —
|
|
149
|
+
// e.g. -r "Channels/Default Group/Sample Channel" — is word-split by the
|
|
150
|
+
// shell before Java ever sees it, and mirthsync fails to parse the command.
|
|
151
|
+
// Passing the argv array directly lets the runtime deliver each argument to
|
|
152
|
+
// Java verbatim, spaces and all, identically on every platform. A shell was
|
|
153
|
+
// never needed for resolution: findJava() always returns a concrete
|
|
154
|
+
// executable name ("java.exe") or absolute path, which spawn() locates on
|
|
155
|
+
// PATH on its own.
|
|
156
|
+
const child = spawn(javaPath, args, {
|
|
157
|
+
stdio: 'inherit'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Forward signals to child process
|
|
161
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
162
|
+
signals.forEach(signal => {
|
|
163
|
+
process.on(signal, () => {
|
|
164
|
+
if (!child.killed) {
|
|
165
|
+
child.kill(signal);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Exit with the same code as the Java process
|
|
171
|
+
child.on('close', (code) => {
|
|
172
|
+
process.exit(code || 0);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
child.on('error', (err) => {
|
|
176
|
+
console.error(`Failed to start mirthsync: ${err.message}`);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
main();
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dave-inthecloud/mirthsync",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.8.1",
|
|
4
|
+
"description": "DevOps tool for Mirth Connect and Open Integration Engine version control and CI/CD automation (fork of @saga-it/mirthsync with the orphan-check performance fix)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mirth",
|
|
7
|
+
"mirth-connect",
|
|
8
|
+
"open-integration-engine",
|
|
9
|
+
"oie",
|
|
10
|
+
"healthcare",
|
|
11
|
+
"hl7",
|
|
12
|
+
"fhir",
|
|
13
|
+
"dicom",
|
|
14
|
+
"devops",
|
|
15
|
+
"ci-cd",
|
|
16
|
+
"version-control",
|
|
17
|
+
"integration-engine"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/dave-InTheCloud/mirthsync#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/dave-InTheCloud/mirthsync/issues"
|
|
22
|
+
},
|
|
23
|
+
"license": "EPL-1.0",
|
|
24
|
+
"author": "Saga IT LLC",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/dave-InTheCloud/mirthsync.git"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"mirthsync": "bin/mirthsync.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/",
|
|
34
|
+
"lib/",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=14.0.0"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"darwin",
|
|
42
|
+
"linux",
|
|
43
|
+
"win32"
|
|
44
|
+
],
|
|
45
|
+
"preferGlobal": true,
|
|
46
|
+
"contributors": [
|
|
47
|
+
"dave-InTheCloud (https://github.com/dave-InTheCloud)"
|
|
48
|
+
]
|
|
49
|
+
}
|