hyperterse 1.0.0-beta.5 → 1.0.0
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 +201 -0
- package/README.md +348 -0
- package/bin.mjs +37 -0
- package/{install.js → install.mjs} +24 -17
- package/package.json +6 -8
- package/bin.js +0 -18
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# Hyperterse
|
|
6
|
+
|
|
7
|
+
**Connect your data to your agents.**
|
|
8
|
+
|
|
9
|
+
A declarative interface between your data and modern software. Turn database queries into stable APIs and AI-ready tools—without exposing SQL, writing boilerplate, or coupling your application to your database.
|
|
10
|
+
|
|
11
|
+
[Website](https://hyperterse.com) • [Documentation](https://docs.hyperterse.com) • [Quick Start](#quick-start) • [Features](#features) • [Examples](#examples)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## What is Hyperterse?
|
|
18
|
+
|
|
19
|
+
Hyperterse is a high-performance runtime server that transforms database queries into REST endpoints and MCP (Model Context Protocol) tools.
|
|
20
|
+
|
|
21
|
+
You describe your queries once, in a simple configuration file. Hyperterse does the rest:
|
|
22
|
+
|
|
23
|
+
* Generates individual, typed endpoints
|
|
24
|
+
* Validates inputs automatically
|
|
25
|
+
* Produces OpenAPI documentation
|
|
26
|
+
* Exposes queries safely to AI systems
|
|
27
|
+
|
|
28
|
+
No ORMs. No boilerplate. No exposed SQL.
|
|
29
|
+
|
|
30
|
+
## Designed for Modern Systems
|
|
31
|
+
|
|
32
|
+
### AI & LLM Applications
|
|
33
|
+
|
|
34
|
+
Hyperterse is built with AI in mind.
|
|
35
|
+
|
|
36
|
+
* **AI agents and assistants** - Safely query databases through MCP without exposing raw SQL.
|
|
37
|
+
* **LLM tool calling** - Let models discover and invoke database operations autonomously.
|
|
38
|
+
* **Retrieval-augmented generation (RAG)** - Use structured database queries as reliable context.
|
|
39
|
+
* **Conversational interfaces** - Power chatbots that access live business data.
|
|
40
|
+
* **AI-driven analytics** - Enable models to generate insights through validated queries.
|
|
41
|
+
* **Multi-agent systems** - Share consistent database access across agents.
|
|
42
|
+
* **Natural language to SQL pipelines** - Bridge human input and databases using tool calls.
|
|
43
|
+
* **AI dashboards** - Query and visualize data dynamically.
|
|
44
|
+
|
|
45
|
+
### Traditional Use Cases
|
|
46
|
+
|
|
47
|
+
* **Database-backed APIs** without boilerplate
|
|
48
|
+
* **Lightweight microservices** without ORM overhead
|
|
49
|
+
* **Rapid prototyping** with configuration-first workflows
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
Hyperterse comes several features that help you leverage accessing your data in a secure manner for your AI agents and LLMs.
|
|
54
|
+
|
|
55
|
+
### Declarative data interfaces
|
|
56
|
+
|
|
57
|
+
Define the shape and intent of data access once, and let Hyperterse handle execution, validation, and exposure.
|
|
58
|
+
|
|
59
|
+
### Agent-ready by design
|
|
60
|
+
|
|
61
|
+
Connect your data to AI agents through discoverable, callable tools—without exposing SQL, schemas, or credentials.
|
|
62
|
+
|
|
63
|
+
### Zero-boilerplate API
|
|
64
|
+
|
|
65
|
+
Turn queries into production-ready APIs with typed inputs, predictable outputs, and built-in documentation.
|
|
66
|
+
|
|
67
|
+
### Single source of truth
|
|
68
|
+
|
|
69
|
+
Generate REST endpoints, OpenAPI specs, LLM-readable docs, and MCP tools from one configuration file.
|
|
70
|
+
|
|
71
|
+
### Database independence
|
|
72
|
+
|
|
73
|
+
Work across PostgreSQL, MySQL, and Redis using a consistent, unified interface.
|
|
74
|
+
|
|
75
|
+
### Fast and iterative development
|
|
76
|
+
|
|
77
|
+
Update queries and schemas with immediate feedback during development.
|
|
78
|
+
|
|
79
|
+
### Portable deployment
|
|
80
|
+
|
|
81
|
+
Ship a self-contained runtime that moves cleanly from local development to production.
|
|
82
|
+
|
|
83
|
+
### Built to scale
|
|
84
|
+
|
|
85
|
+
Support everything from prototypes to multi-agent systems without changing your architecture.
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
### Installation
|
|
90
|
+
|
|
91
|
+
Install Hyperterse with a single command:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
curl -fsSL https://hyperterse.com/install | bash
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Supported platforms:**
|
|
98
|
+
|
|
99
|
+
* Linux (amd64, arm64, arm)
|
|
100
|
+
* macOS (Intel, Apple Silicon)
|
|
101
|
+
* Windows (amd64, arm64)
|
|
102
|
+
|
|
103
|
+
For more installation options, see the [installation guide](https://docs.hyperterse.com/getting-started/installation).
|
|
104
|
+
|
|
105
|
+
### Your First Query
|
|
106
|
+
|
|
107
|
+
Create a configuration file:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
adapters:
|
|
111
|
+
my_database:
|
|
112
|
+
connector: postgres
|
|
113
|
+
connection_string: "postgresql://user:password@localhost:5432/mydb"
|
|
114
|
+
|
|
115
|
+
queries:
|
|
116
|
+
get-user:
|
|
117
|
+
use: my_database
|
|
118
|
+
description: "Retrieve a user by email address"
|
|
119
|
+
statement: |
|
|
120
|
+
SELECT id, name, email, created_at
|
|
121
|
+
FROM users
|
|
122
|
+
WHERE email = {{ inputs.email }}
|
|
123
|
+
inputs:
|
|
124
|
+
email:
|
|
125
|
+
type: string
|
|
126
|
+
description: "User email address"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Start the server:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
hyperterse run -f config.terse
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Call the endpoint:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
curl -X POST http://localhost:8080/query/get-user \
|
|
139
|
+
-H "Content-Type: application/json" \
|
|
140
|
+
-d '{"email": "user@example.com"}'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Response:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"success": true,
|
|
148
|
+
"error": "",
|
|
149
|
+
"results": [
|
|
150
|
+
{
|
|
151
|
+
"id": 123,
|
|
152
|
+
"name": "John Doe",
|
|
153
|
+
"email": "user@example.com",
|
|
154
|
+
"created_at": "2024-01-01T00:00:00Z"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Documentation
|
|
161
|
+
|
|
162
|
+
📚 **[Read the docs →](https://docs.hyperterse.com)**
|
|
163
|
+
|
|
164
|
+
* **[Getting Started](https://docs.hyperterse.com/getting-started/quick-start)** - Quick start guide and installation
|
|
165
|
+
* **[CLI Reference](https://docs.hyperterse.com/reference/cli)** - Complete command-line interface reference
|
|
166
|
+
* **[Configuration Guide](https://docs.hyperterse.com/reference/configuration)** - Configuration file reference
|
|
167
|
+
* **[Guides](https://docs.hyperterse.com/guides)** - Practical guides for AI integration, OpenAPI, and MCP
|
|
168
|
+
* **[Concepts](https://docs.hyperterse.com/concepts)** - Core concepts: adapters, queries, and inputs
|
|
169
|
+
* **[Databases](https://docs.hyperterse.com/databases)** - Database-specific documentation
|
|
170
|
+
* **[Deployment](https://docs.hyperterse.com/deployment)** - Deployment guides for various platforms
|
|
171
|
+
|
|
172
|
+
### Runtime Endpoints
|
|
173
|
+
|
|
174
|
+
When running, Hyperterse exposes several endpoints:
|
|
175
|
+
|
|
176
|
+
* **OpenAPI Documentation**: `GET /docs` - Interactive API documentation
|
|
177
|
+
* **LLM Documentation**: `GET /llms.txt` - AI-friendly documentation format
|
|
178
|
+
* **MCP Protocol**: `POST /mcp` - Model Context Protocol JSON-RPC endpoint
|
|
179
|
+
|
|
180
|
+
## Examples
|
|
181
|
+
|
|
182
|
+
### MCP Protocol
|
|
183
|
+
|
|
184
|
+
List available tools:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
curl -X POST http://localhost:8080/mcp \
|
|
188
|
+
-H "Content-Type: application/json" \
|
|
189
|
+
-d '{
|
|
190
|
+
"jsonrpc": "2.0",
|
|
191
|
+
"method": "tools/list",
|
|
192
|
+
"id": 1
|
|
193
|
+
}'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Invoke a tool:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
curl -X POST http://localhost:8080/mcp \
|
|
200
|
+
-H "Content-Type: application/json" \
|
|
201
|
+
-d '{
|
|
202
|
+
"jsonrpc": "2.0",
|
|
203
|
+
"method": "tools/call",
|
|
204
|
+
"params": {
|
|
205
|
+
"name": "get-user-by-id",
|
|
206
|
+
"arguments": {
|
|
207
|
+
"userId": "123"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"id": 1
|
|
211
|
+
}'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### User Management
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
queries:
|
|
218
|
+
get-user-by-id:
|
|
219
|
+
use: user_db
|
|
220
|
+
description: "Retrieve user information by ID"
|
|
221
|
+
statement: |
|
|
222
|
+
SELECT id, name, email, created_at
|
|
223
|
+
FROM users
|
|
224
|
+
WHERE id = {{ inputs.userId }}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Analytics
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
queries:
|
|
231
|
+
daily-stats:
|
|
232
|
+
description: "Daily statistics over a date range"
|
|
233
|
+
statement: |
|
|
234
|
+
SELECT
|
|
235
|
+
DATE(created_at) AS date,
|
|
236
|
+
COUNT(*) AS total_events,
|
|
237
|
+
COUNT(DISTINCT user_id) AS unique_users
|
|
238
|
+
FROM events
|
|
239
|
+
WHERE created_at BETWEEN {{ inputs.startDate }} AND {{ inputs.endDate }}
|
|
240
|
+
GROUP BY DATE(created_at)
|
|
241
|
+
ORDER BY date DESC
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## CLI
|
|
245
|
+
|
|
246
|
+
Run:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
hyperterse run -f config.terse
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Development mode (hot reload):
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
hyperterse dev -f config.terse
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Generate artifacts:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
hyperterse generate llms -f config.terse
|
|
262
|
+
hyperterse generate skills -f config.terse
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Initialize:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
hyperterse init
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Upgrade:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
hyperterse upgrade
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Export:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
hyperterse export -f config.terse -o dist
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Configuration
|
|
284
|
+
|
|
285
|
+
Hyperterse uses a simple YAML-like configuration format (`.terse` files) to define your database adapters and queries.
|
|
286
|
+
|
|
287
|
+
**Supported input types:** `string`, `int`, `float`, `boolean`, `uuid`, `datetime`
|
|
288
|
+
|
|
289
|
+
**Template syntax:**
|
|
290
|
+
|
|
291
|
+
```sql
|
|
292
|
+
WHERE price <= {{ inputs.maxPrice }}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Optional inputs:**
|
|
296
|
+
|
|
297
|
+
```yaml
|
|
298
|
+
optional: true
|
|
299
|
+
default: "20"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Multiple databases:** Hyperterse supports multiple adapters in a single configuration file.
|
|
303
|
+
|
|
304
|
+
For complete configuration reference, see the [configuration guide](https://docs.hyperterse.com/reference/configuration).
|
|
305
|
+
|
|
306
|
+
## Security
|
|
307
|
+
|
|
308
|
+
Hyperterse is designed with security as a baseline:
|
|
309
|
+
|
|
310
|
+
* 🔒 **Credentials are never exposed** - Connection strings stay server-side
|
|
311
|
+
* 🛡️ **SQL is never returned to clients** - Raw queries remain hidden
|
|
312
|
+
* ✅ **Inputs are validated and escaped** - Strong typing prevents injection
|
|
313
|
+
* 🔇 **Errors are sanitized by default** - Internal details stay internal
|
|
314
|
+
|
|
315
|
+
For production deployments, place Hyperterse behind a reverse proxy for authentication, rate limiting, and TLS. See the [production security guide](https://docs.hyperterse.com/security/production) for best practices.
|
|
316
|
+
|
|
317
|
+
## Contributing
|
|
318
|
+
|
|
319
|
+
Contributions are welcome! We appreciate your help in making Hyperterse better.
|
|
320
|
+
|
|
321
|
+
1. Fork the repository
|
|
322
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
323
|
+
3. Add tests for your changes
|
|
324
|
+
4. Ensure code follows standard Go formatting
|
|
325
|
+
5. Open a pull request
|
|
326
|
+
|
|
327
|
+
Please keep changes focused and well-tested. For major changes, open an issue first to discuss your proposal. See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed development guidelines.
|
|
328
|
+
|
|
329
|
+
**Please note**: By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). We are committed to providing a welcoming and inclusive environment for all contributors.
|
|
330
|
+
|
|
331
|
+
## Support
|
|
332
|
+
|
|
333
|
+
* 🌐 **Website**: [hyperterse.com](https://hyperterse.com)
|
|
334
|
+
* 📖 **Documentation**: [docs.hyperterse.com](https://docs.hyperterse.com)
|
|
335
|
+
* 🐛 **Issues**: [GitHub Issues](https://github.com/hyperterse/hyperterse/issues)
|
|
336
|
+
* 💬 **Discussions**: [GitHub Discussions](https://github.com/hyperterse/hyperterse/discussions)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
<div align="center">
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
Made with care by the Hyperterse team.
|
|
345
|
+
|
|
346
|
+
[Website](https://hyperterse.com) • [GitHub](https://github.com/hyperterse/hyperterse) • [Documentation](https://docs.hyperterse.com)
|
|
347
|
+
|
|
348
|
+
</div>
|
package/bin.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is used to run the Hyperterse binary.
|
|
5
|
+
* If the binary doesn't exist, it will automatically install it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
import { install } from './install.mjs';
|
|
14
|
+
|
|
15
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const binPath = path.join(__dirname, 'bin', process.platform === 'win32' ? 'hyperterse.exe' : 'hyperterse');
|
|
17
|
+
|
|
18
|
+
(async () => {
|
|
19
|
+
if (!fs.existsSync(binPath)) {
|
|
20
|
+
console.log('Hyperterse binary not found. Installing...');
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
await install();
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error: Binary installation failed');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Verify binary was installed
|
|
30
|
+
if (!fs.existsSync(binPath)) {
|
|
31
|
+
console.error('Error: Binary installation failed');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
execSync(binPath, { stdio: 'inherit' });
|
|
37
|
+
})();
|
|
@@ -4,13 +4,26 @@
|
|
|
4
4
|
* Post-install script to download the correct binary for the current platform
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import https from 'https';
|
|
10
|
+
import http from 'http';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
14
|
|
|
12
15
|
// Version is read from package.json (npm_package_version) or can be overridden via environment variable
|
|
13
|
-
|
|
16
|
+
let VERSION = process.env.npm_package_version;
|
|
17
|
+
if (!VERSION) {
|
|
18
|
+
// Fallback: read from package.json if env var not set
|
|
19
|
+
const packageJsonPath = path.join(__dirname, 'package.json');
|
|
20
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
21
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
22
|
+
VERSION = packageJson.version || '0.0.0';
|
|
23
|
+
} else {
|
|
24
|
+
VERSION = '0.0.0';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
14
27
|
const BASE_URL = `https://github.com/hyperterse/hyperterse/releases/download/v${VERSION}`;
|
|
15
28
|
|
|
16
29
|
// Detect platform and architecture
|
|
@@ -41,7 +54,7 @@ const binaryName = platform === 'win32'
|
|
|
41
54
|
: `hyperterse-${goOS}-${goArch}`;
|
|
42
55
|
|
|
43
56
|
const downloadUrl = `${BASE_URL}/${binaryName}`;
|
|
44
|
-
const binDir = path.join(__dirname, '
|
|
57
|
+
const binDir = path.join(__dirname, 'bin');
|
|
45
58
|
const binPath = path.join(binDir, platform === 'win32' ? 'hyperterse.exe' : 'hyperterse');
|
|
46
59
|
|
|
47
60
|
// Create bin directory if it doesn't exist
|
|
@@ -53,7 +66,7 @@ if (!fs.existsSync(binDir)) {
|
|
|
53
66
|
function download(url, dest) {
|
|
54
67
|
return new Promise((resolve, reject) => {
|
|
55
68
|
const protocol = url.startsWith('https') ? https : http;
|
|
56
|
-
const file = fs.createWriteStream(
|
|
69
|
+
const file = fs.createWriteStream(dest);
|
|
57
70
|
|
|
58
71
|
protocol.get(url, (response) => {
|
|
59
72
|
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
@@ -78,8 +91,8 @@ function download(url, dest) {
|
|
|
78
91
|
});
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
// Main installation
|
|
82
|
-
async function install() {
|
|
94
|
+
// Main installation function
|
|
95
|
+
export async function install() {
|
|
83
96
|
// Check if binary already exists
|
|
84
97
|
if (fs.existsSync(binPath)) {
|
|
85
98
|
console.log('Binary already exists, skipping download.');
|
|
@@ -91,7 +104,7 @@ async function install() {
|
|
|
91
104
|
|
|
92
105
|
try {
|
|
93
106
|
// Download archive
|
|
94
|
-
await download(downloadUrl);
|
|
107
|
+
await download(downloadUrl, binPath);
|
|
95
108
|
|
|
96
109
|
// Make binary executable (Unix)
|
|
97
110
|
if (platform !== 'win32') {
|
|
@@ -99,16 +112,10 @@ async function install() {
|
|
|
99
112
|
}
|
|
100
113
|
|
|
101
114
|
console.log('✓ Installation complete!');
|
|
102
|
-
process.exit(0);
|
|
103
115
|
} catch (error) {
|
|
104
116
|
console.error('Error installing binary:', error.message);
|
|
105
117
|
console.error('You may need to manually download the binary from:', downloadUrl);
|
|
106
|
-
|
|
118
|
+
throw error;
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
// Run installation
|
|
111
|
-
install().catch((err) => {
|
|
112
|
-
console.error('Installation failed:', err);
|
|
113
|
-
process.exit(1);
|
|
114
|
-
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperterse",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A declarative interface to connect your database to your AI agents",
|
|
5
5
|
"author": "Samrith Shankar <samrith@outlook.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -13,15 +13,13 @@
|
|
|
13
13
|
"url": "https://github.com/hyperterse/hyperterse/issues"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
-
"hyperterse": "bin.
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"postinstall": "./install.js"
|
|
16
|
+
"hyperterse": "bin.mjs"
|
|
20
17
|
},
|
|
21
18
|
"files": [
|
|
22
|
-
"bin.
|
|
23
|
-
"install.
|
|
24
|
-
"
|
|
19
|
+
"bin.mjs",
|
|
20
|
+
"install.mjs",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"README.md"
|
|
25
23
|
],
|
|
26
24
|
"keywords": [
|
|
27
25
|
"hyperterse",
|
package/bin.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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' });
|