mythik-server 0.1.3 → 0.1.4
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 +70 -48
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,6 +30,21 @@ wired in.
|
|
|
30
30
|
npm install mythik-server
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
Install the SQL driver for your selected database explicitly:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install pg # PostgreSQL
|
|
37
|
+
npm install mysql2 # MySQL
|
|
38
|
+
npm install mssql # SQL Server
|
|
39
|
+
npm install better-sqlite3 # SQLite
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
SQLite uses the native `better-sqlite3` adapter. If npm prints warnings
|
|
43
|
+
from that adapter's transitive native-build helpers, the warning belongs
|
|
44
|
+
to the SQLite adapter install path, not to `mythik-server` itself.
|
|
45
|
+
Missing SQL adapter errors include the package name and install command
|
|
46
|
+
for the selected dialect.
|
|
47
|
+
|
|
33
48
|
`mythik` is included as a dependency — no separate install required.
|
|
34
49
|
|
|
35
50
|
## When to install this
|
|
@@ -50,18 +65,18 @@ below for what it actually checks.
|
|
|
50
65
|
|
|
51
66
|
## What you get
|
|
52
67
|
|
|
53
|
-
- **`createServer({ spec, database })`** — main bootstrap. Reads an
|
|
54
|
-
ApiSpec, opens the database connection, registers all declared
|
|
55
|
-
endpoints, and exposes a `start(port)` method.
|
|
56
|
-
|
|
57
|
-
- **Dialect-aware SQL runtime** — generated CRUD, catalogs,
|
|
58
|
-
pagination, auth provider queries, and scope filters compile through
|
|
59
|
-
the selected database driver. Supported dialects are SQL Server,
|
|
60
|
-
PostgreSQL, MySQL, and SQLite.
|
|
61
|
-
|
|
62
|
-
- **Endpoint patterns** — your ApiSpec declares each endpoint as one
|
|
63
|
-
of four shapes; the server wires the route, validates inputs,
|
|
64
|
-
enforces auth, and applies RLS automatically:
|
|
68
|
+
- **`createServer({ spec, database })`** — main bootstrap. Reads an
|
|
69
|
+
ApiSpec, opens the database connection, registers all declared
|
|
70
|
+
endpoints, and exposes a `start(port)` method.
|
|
71
|
+
|
|
72
|
+
- **Dialect-aware SQL runtime** — generated CRUD, catalogs,
|
|
73
|
+
pagination, auth provider queries, and scope filters compile through
|
|
74
|
+
the selected database driver. Supported dialects are SQL Server,
|
|
75
|
+
PostgreSQL, MySQL, and SQLite.
|
|
76
|
+
|
|
77
|
+
- **Endpoint patterns** — your ApiSpec declares each endpoint as one
|
|
78
|
+
of four shapes; the server wires the route, validates inputs,
|
|
79
|
+
enforces auth, and applies RLS automatically:
|
|
65
80
|
- `query` — read with parameters
|
|
66
81
|
- `handler` — custom business logic with an escape hatch
|
|
67
82
|
- `crud` — create / read / update / delete a table row
|
|
@@ -84,36 +99,36 @@ below for what it actually checks.
|
|
|
84
99
|
```ts
|
|
85
100
|
import { createServer } from 'mythik-server';
|
|
86
101
|
|
|
87
|
-
const server = createServer({
|
|
88
|
-
spec: './api-spec.json',
|
|
89
|
-
database: {
|
|
90
|
-
type: 'postgres',
|
|
91
|
-
connectionString: process.env.DATABASE_URL!,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
await server.start(3010);
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
`./api-spec.json` is a Mythik ApiSpec describing endpoints, auth
|
|
99
|
-
policy, catalogs, and CRUD shape. See `ai-context.md` (bundled in the
|
|
100
|
-
`mythik` package) for the ApiSpec schema and patterns.
|
|
101
|
-
|
|
102
|
-
For local demos and tests, SQLite is a one-file option:
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
const server = createServer({
|
|
106
|
-
spec: './api-spec.json',
|
|
107
|
-
database: { type: 'sqlite', filename: './mythik.db' },
|
|
108
|
-
});
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Set `spec.dialect` in the ApiSpec to match the server database when
|
|
112
|
-
Mythik should generate CRUD/catalog/pagination/scope SQL for that
|
|
113
|
-
dialect. Custom SQL remains dialect-native; Mythik compiles named
|
|
114
|
-
params (`@name`) but does not translate a SQL Server query into
|
|
115
|
-
PostgreSQL/MySQL/SQLite SQL at runtime. MySQL generated upsert SQL
|
|
116
|
-
targets MySQL 8.0.19+.
|
|
102
|
+
const server = createServer({
|
|
103
|
+
spec: './api-spec.json',
|
|
104
|
+
database: {
|
|
105
|
+
type: 'postgres',
|
|
106
|
+
connectionString: process.env.DATABASE_URL!,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await server.start(3010);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`./api-spec.json` is a Mythik ApiSpec describing endpoints, auth
|
|
114
|
+
policy, catalogs, and CRUD shape. See `ai-context.md` (bundled in the
|
|
115
|
+
`mythik` package) for the ApiSpec schema and patterns.
|
|
116
|
+
|
|
117
|
+
For local demos and tests, SQLite is a one-file option:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const server = createServer({
|
|
121
|
+
spec: './api-spec.json',
|
|
122
|
+
database: { type: 'sqlite', filename: './mythik.db' },
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Set `spec.dialect` in the ApiSpec to match the server database when
|
|
127
|
+
Mythik should generate CRUD/catalog/pagination/scope SQL for that
|
|
128
|
+
dialect. Custom SQL remains dialect-native; Mythik compiles named
|
|
129
|
+
params (`@name`) but does not translate a SQL Server query into
|
|
130
|
+
PostgreSQL/MySQL/SQLite SQL at runtime. MySQL generated upsert SQL
|
|
131
|
+
targets MySQL 8.0.19+.
|
|
117
132
|
|
|
118
133
|
## ApiSpec philosophy
|
|
119
134
|
|
|
@@ -176,12 +191,19 @@ to detect; in Mythik both `roleAccess` (frontend) and `policies`
|
|
|
176
191
|
- [`mythik-react`](https://github.com/mldixdev/mythik/tree/main/packages/react#readme) — the frontend consuming this API
|
|
177
192
|
- [`mythik-cli`](https://github.com/mldixdev/mythik/tree/main/packages/cli#readme) — author and cross-validate ApiSpecs (the AI-first surface)
|
|
178
193
|
|
|
179
|
-
## Status
|
|
180
|
-
|
|
194
|
+
## Status
|
|
195
|
+
|
|
181
196
|
Public release line. Use with `mythik contract` to cross-check
|
|
182
197
|
frontend specs against backend endpoints before deployment. APIs are
|
|
183
198
|
documented for real-world feedback as the framework evolves.
|
|
184
|
-
|
|
185
|
-
##
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
|
|
200
|
+
## Releases
|
|
201
|
+
|
|
202
|
+
Release notes and patch details are published in the
|
|
203
|
+
[CHANGELOG](https://github.com/mldixdev/mythik/blob/main/CHANGELOG.md)
|
|
204
|
+
and on
|
|
205
|
+
[GitHub Releases](https://github.com/mldixdev/mythik/releases).
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Apache-2.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mythik-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Declarative REST runtime for Mythik ApiSpec contracts, auth, RBAC, catalogs, and CRUD endpoints.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"cors": "^2.8.5",
|
|
42
42
|
"express": "^4.21.2",
|
|
43
43
|
"jsonwebtoken": "^9.0.3",
|
|
44
|
-
"mythik": "0.1.
|
|
44
|
+
"mythik": "0.1.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/bcryptjs": "^3.0.0",
|