hyperterse 1.0.0-beta.5
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/bin.js +18 -0
- package/install.js +114 -0
- package/package.json +37 -0
package/bin.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is used to run the Hyperterse binary.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
const binPath = path.join(__dirname, 'bin', process.platform === 'win32' ? 'hyperterse.exe' : 'hyperterse');
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(binPath)) {
|
|
14
|
+
console.error('Hyperterse binary not found');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
execSync(binPath, { stdio: 'inherit' });
|
package/install.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-install script to download the correct binary for the current platform
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const https = require('https');
|
|
10
|
+
const http = require('http');
|
|
11
|
+
|
|
12
|
+
// Version is read from package.json (npm_package_version) or can be overridden via environment variable
|
|
13
|
+
const VERSION = process.env.npm_package_version || '0.0.0';
|
|
14
|
+
const BASE_URL = `https://github.com/hyperterse/hyperterse/releases/download/v${VERSION}`;
|
|
15
|
+
|
|
16
|
+
// Detect platform and architecture
|
|
17
|
+
const platform = process.platform;
|
|
18
|
+
const arch = process.arch;
|
|
19
|
+
|
|
20
|
+
// Map Node.js arch to Go arch
|
|
21
|
+
const archMap = {
|
|
22
|
+
'x64': 'amd64',
|
|
23
|
+
'arm64': 'arm64',
|
|
24
|
+
'arm': 'arm',
|
|
25
|
+
'ia32': 'amd64', // 32-bit x86 -> amd64
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Map Node.js platform to Go OS
|
|
29
|
+
const platformMap = {
|
|
30
|
+
'darwin': 'darwin',
|
|
31
|
+
'linux': 'linux',
|
|
32
|
+
'win32': 'windows',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const goArch = archMap[arch] || arch;
|
|
36
|
+
const goOS = platformMap[platform] || platform;
|
|
37
|
+
|
|
38
|
+
// Determine binary name and extension
|
|
39
|
+
const binaryName = platform === 'win32'
|
|
40
|
+
? `hyperterse-${goOS}-${goArch}.exe`
|
|
41
|
+
: `hyperterse-${goOS}-${goArch}`;
|
|
42
|
+
|
|
43
|
+
const downloadUrl = `${BASE_URL}/${binaryName}`;
|
|
44
|
+
const binDir = path.join(__dirname, 'dist');
|
|
45
|
+
const binPath = path.join(binDir, platform === 'win32' ? 'hyperterse.exe' : 'hyperterse');
|
|
46
|
+
|
|
47
|
+
// Create bin directory if it doesn't exist
|
|
48
|
+
if (!fs.existsSync(binDir)) {
|
|
49
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Download function
|
|
53
|
+
function download(url, dest) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const protocol = url.startsWith('https') ? https : http;
|
|
56
|
+
const file = fs.createWriteStream(binPath);
|
|
57
|
+
|
|
58
|
+
protocol.get(url, (response) => {
|
|
59
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
60
|
+
// Follow redirect
|
|
61
|
+
return download(response.headers.location, dest).then(resolve).catch(reject);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (response.statusCode !== 200) {
|
|
65
|
+
reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
response.pipe(file);
|
|
70
|
+
file.on('finish', () => {
|
|
71
|
+
file.close();
|
|
72
|
+
resolve();
|
|
73
|
+
});
|
|
74
|
+
}).on('error', (err) => {
|
|
75
|
+
fs.unlinkSync(dest);
|
|
76
|
+
reject(err);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Main installation logic
|
|
82
|
+
async function install() {
|
|
83
|
+
// Check if binary already exists
|
|
84
|
+
if (fs.existsSync(binPath)) {
|
|
85
|
+
console.log('Binary already exists, skipping download.');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
console.log(`Downloading hyperterse ${VERSION} for ${platform}-${arch}...`);
|
|
90
|
+
console.log(`URL: ${downloadUrl}`);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
// Download archive
|
|
94
|
+
await download(downloadUrl);
|
|
95
|
+
|
|
96
|
+
// Make binary executable (Unix)
|
|
97
|
+
if (platform !== 'win32') {
|
|
98
|
+
fs.chmodSync(binPath, '755');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log('✓ Installation complete!');
|
|
102
|
+
process.exit(0);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error('Error installing binary:', error.message);
|
|
105
|
+
console.error('You may need to manually download the binary from:', downloadUrl);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Run installation
|
|
111
|
+
install().catch((err) => {
|
|
112
|
+
console.error('Installation failed:', err);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hyperterse",
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
|
+
"description": "A declarative interface to connect your database to your AI agents",
|
|
5
|
+
"author": "Samrith Shankar <samrith@outlook.com>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/hyperterse/hyperterse.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://hyperterse.com",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/hyperterse/hyperterse/issues"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"hyperterse": "bin.js"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"postinstall": "./install.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin.js",
|
|
23
|
+
"install.js",
|
|
24
|
+
"../../LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"hyperterse",
|
|
28
|
+
"database",
|
|
29
|
+
"api",
|
|
30
|
+
"mcp",
|
|
31
|
+
"ai",
|
|
32
|
+
"agents"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|