db-model-router 1.0.5 → 1.0.7
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 +150 -11
- package/TODO.md +0 -14
- package/db-manager/.dbmanager.sqlite +0 -0
- package/db-manager/README.md +223 -0
- package/db-manager/adapter-proxy.js +361 -0
- package/db-manager/demo/cockroachdb.env +6 -0
- package/db-manager/demo/demo.sqlite +0 -0
- package/db-manager/demo/dynamodb.env +7 -0
- package/db-manager/demo/mongodb.env +4 -0
- package/db-manager/demo/mssql.env +6 -0
- package/db-manager/demo/mysql.env +6 -0
- package/db-manager/demo/oracle.env +6 -0
- package/db-manager/demo/postgres.env +6 -0
- package/db-manager/demo/redis.env +4 -0
- package/db-manager/demo/seeds/cockroachdb.sql +32 -0
- package/db-manager/demo/seeds/mssql.sql +32 -0
- package/db-manager/demo/seeds/mysql.sql +32 -0
- package/db-manager/demo/seeds/oracle.sql +43 -0
- package/db-manager/demo/seeds/postgres.sql +32 -0
- package/db-manager/demo/seeds/sqlite3.sql +32 -0
- package/db-manager/demo/sqlite3.env +2 -0
- package/db-manager/metadata-db.js +170 -0
- package/db-manager/public/.gitkeep +1 -0
- package/db-manager/public/css/style.css +1413 -0
- package/db-manager/public/js/app.js +1370 -0
- package/db-manager/routes/api.js +388 -0
- package/db-manager/routes/views.js +61 -0
- package/db-manager/server.js +39 -0
- package/db-manager/utils/build-filter-config.js +18 -0
- package/db-manager/utils/csv-export.js +59 -0
- package/db-manager/utils/export-filename.js +39 -0
- package/db-manager/utils/filter-tables.js +20 -0
- package/db-manager/utils/parse-filters.js +93 -0
- package/db-manager/utils/sort-state.js +35 -0
- package/db-manager/views/.gitkeep +1 -0
- package/db-manager/views/dashboard.ejs +53 -0
- package/db-manager/views/history.ejs +52 -0
- package/db-manager/views/index.ejs +35 -0
- package/db-manager/views/layout.ejs +31 -0
- package/db-manager/views/partials/data-panel.ejs +74 -0
- package/db-manager/views/partials/header.ejs +36 -0
- package/db-manager/views/partials/sidebar.ejs +30 -0
- package/db-manager/views/query.ejs +58 -0
- package/dbmr.schema.json +23 -45
- package/demo/.env.example +1 -0
- package/demo/app.js +3 -1
- package/demo/commons/db.js +11 -0
- package/demo/commons/migrate.js +3 -0
- package/demo/commons/modules.js +18 -0
- package/demo/commons/password.js +36 -0
- package/demo/commons/webhook.js +81 -0
- package/demo/dbmr.schema.json +22 -46
- package/demo/middleware/authenticate.js +14 -0
- package/demo/middleware/hasPermission.js +30 -0
- package/demo/middleware/tenantIsolation.js +17 -0
- package/demo/migrations/20260509170349_create_saas_tables.sql +69 -0
- package/demo/migrations/{20260430155809_create_tables.sql → 20260509170349_create_tables.sql} +11 -25
- package/demo/models/addresses.js +5 -3
- package/demo/models/cart_items.js +5 -3
- package/demo/models/carts.js +5 -3
- package/demo/models/categories.js +5 -3
- package/demo/models/coupons.js +5 -3
- package/demo/models/index.js +43 -0
- package/demo/models/order_items.js +4 -2
- package/demo/models/orders.js +5 -3
- package/demo/models/payments.js +5 -3
- package/demo/models/product_images.js +4 -2
- package/demo/models/product_reviews.js +5 -3
- package/demo/models/product_variants.js +5 -3
- package/demo/models/products.js +5 -3
- package/demo/models/role_permissions.js +17 -0
- package/demo/models/roles.js +17 -0
- package/demo/models/shipments.js +5 -3
- package/demo/models/tenants.js +18 -0
- package/demo/models/users.js +12 -8
- package/demo/models/webhook_logs.js +22 -0
- package/demo/models/webhooks.js +19 -0
- package/demo/models/wishlists.js +4 -2
- package/demo/openapi.json +1744 -616
- package/demo/package-lock.json +24 -24
- package/demo/package.json +9 -0
- package/demo/routes/{addresses.js → addresses/index.js} +1 -1
- package/demo/routes/auth/index.js +55 -0
- package/demo/routes/carts/{cart_items.js → cart_items/index.js} +1 -1
- package/demo/routes/{carts.js → carts/index.js} +1 -1
- package/demo/routes/{categories.js → categories/index.js} +1 -1
- package/demo/routes/{coupons.js → coupons/index.js} +1 -1
- package/demo/routes/index.js +39 -24
- package/demo/routes/{orders.js → orders/index.js} +1 -1
- package/demo/routes/orders/{order_items.js → order_items/index.js} +1 -1
- package/demo/routes/orders/{payments.js → payments/index.js} +1 -1
- package/demo/routes/orders/{shipments.js → shipments/index.js} +1 -1
- package/demo/routes/{products.js → products/index.js} +1 -1
- package/demo/routes/products/{product_images.js → product_images/index.js} +1 -1
- package/demo/routes/products/{product_reviews.js → product_reviews/index.js} +1 -1
- package/demo/routes/products/{product_variants.js → product_variants/index.js} +1 -1
- package/demo/routes/roles/index.js +75 -0
- package/demo/routes/roles/permissions/index.js +47 -0
- package/demo/routes/tenants/index.js +45 -0
- package/demo/routes/users/index.js +45 -0
- package/demo/routes/{wishlists.js → wishlists/index.js} +1 -1
- package/demo/seeds/saas-seed.js +329 -0
- package/docker-compose.yml +61 -0
- package/package.json +120 -113
- package/scripts/demo-create.js +1 -1
- package/skill/SKILL.md +119 -3
- package/src/cli/commands/db-manager.js +134 -0
- package/src/cli/commands/generate.js +112 -43
- package/src/cli/commands/help.js +0 -1
- package/src/cli/diff-engine.js +2 -1
- package/src/cli/generate-model.js +9 -4
- package/src/cli/generate-openapi.js +40 -13
- package/src/cli/generate-route.js +61 -22
- package/src/cli/generate-saas-structure.js +122 -0
- package/src/cli/init/generators.js +42 -30
- package/src/cli/init.js +8 -0
- package/src/cli/main.js +8 -1
- package/src/cli/saas/generate-saas-middleware.js +108 -0
- package/src/cli/saas/generate-saas-migrations.js +480 -0
- package/src/cli/saas/generate-saas-models.js +211 -0
- package/src/cli/saas/generate-saas-openapi.js +419 -0
- package/src/cli/saas/generate-saas-routes.js +435 -0
- package/src/cli/saas/generate-saas-seeds.js +243 -0
- package/src/cli/saas/generate-saas-utils.js +176 -0
- package/src/commons/kafka.js +139 -0
- package/src/commons/model.js +29 -9
- package/src/index.js +2 -0
- package/src/mssql/db.js +41 -3
- package/src/mysql/db.js +3 -0
- package/src/postgres/db.js +6 -0
- package/src/sqlite3/db.js +11 -0
- package/demo/docs/llm.md +0 -197
- package/demo/llms.txt +0 -70
- package/demo/routes/users.js +0 -6
- package/src/cli/commands/generate-llm-docs.js +0 -418
- /package/demo/migrations/{20260430155808_create_migrations_table.sql → 20260509170349_create_migrations_table.sql} +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const { hashPassword } = require("../commons/password");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Super Admin email address.
|
|
9
|
+
*/
|
|
10
|
+
const SUPER_ADMIN_EMAIL = "admin@system.local";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Generated password for the Super Admin.
|
|
14
|
+
* This is cryptographically random and unique per generation.
|
|
15
|
+
*/
|
|
16
|
+
const SUPER_ADMIN_PASSWORD = "64c2b0d97c199df8b674e4854baa4d28";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Super Admin permissions: all actions for all modules with global scope.
|
|
20
|
+
*/
|
|
21
|
+
const SUPER_ADMIN_PERMISSIONS = [
|
|
22
|
+
{
|
|
23
|
+
"module": "users",
|
|
24
|
+
"action": "read",
|
|
25
|
+
"scope": "global"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"module": "users",
|
|
29
|
+
"action": "write",
|
|
30
|
+
"scope": "global"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"module": "users",
|
|
34
|
+
"action": "update",
|
|
35
|
+
"scope": "global"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"module": "users",
|
|
39
|
+
"action": "delete",
|
|
40
|
+
"scope": "global"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"module": "users",
|
|
44
|
+
"action": "export",
|
|
45
|
+
"scope": "global"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"module": "users",
|
|
49
|
+
"action": "approve",
|
|
50
|
+
"scope": "global"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"module": "users",
|
|
54
|
+
"action": "global",
|
|
55
|
+
"scope": "global"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"module": "tenants",
|
|
59
|
+
"action": "read",
|
|
60
|
+
"scope": "global"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"module": "tenants",
|
|
64
|
+
"action": "write",
|
|
65
|
+
"scope": "global"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"module": "tenants",
|
|
69
|
+
"action": "update",
|
|
70
|
+
"scope": "global"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"module": "tenants",
|
|
74
|
+
"action": "delete",
|
|
75
|
+
"scope": "global"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"module": "tenants",
|
|
79
|
+
"action": "export",
|
|
80
|
+
"scope": "global"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"module": "tenants",
|
|
84
|
+
"action": "approve",
|
|
85
|
+
"scope": "global"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"module": "tenants",
|
|
89
|
+
"action": "global",
|
|
90
|
+
"scope": "global"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"module": "roles",
|
|
94
|
+
"action": "read",
|
|
95
|
+
"scope": "global"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"module": "roles",
|
|
99
|
+
"action": "write",
|
|
100
|
+
"scope": "global"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"module": "roles",
|
|
104
|
+
"action": "update",
|
|
105
|
+
"scope": "global"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"module": "roles",
|
|
109
|
+
"action": "delete",
|
|
110
|
+
"scope": "global"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"module": "roles",
|
|
114
|
+
"action": "export",
|
|
115
|
+
"scope": "global"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"module": "roles",
|
|
119
|
+
"action": "approve",
|
|
120
|
+
"scope": "global"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"module": "roles",
|
|
124
|
+
"action": "global",
|
|
125
|
+
"scope": "global"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"module": "permissions",
|
|
129
|
+
"action": "read",
|
|
130
|
+
"scope": "global"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"module": "permissions",
|
|
134
|
+
"action": "write",
|
|
135
|
+
"scope": "global"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"module": "permissions",
|
|
139
|
+
"action": "update",
|
|
140
|
+
"scope": "global"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"module": "permissions",
|
|
144
|
+
"action": "delete",
|
|
145
|
+
"scope": "global"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"module": "permissions",
|
|
149
|
+
"action": "export",
|
|
150
|
+
"scope": "global"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"module": "permissions",
|
|
154
|
+
"action": "approve",
|
|
155
|
+
"scope": "global"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"module": "permissions",
|
|
159
|
+
"action": "global",
|
|
160
|
+
"scope": "global"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"module": "webhooks",
|
|
164
|
+
"action": "read",
|
|
165
|
+
"scope": "global"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"module": "webhooks",
|
|
169
|
+
"action": "write",
|
|
170
|
+
"scope": "global"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"module": "webhooks",
|
|
174
|
+
"action": "update",
|
|
175
|
+
"scope": "global"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"module": "webhooks",
|
|
179
|
+
"action": "delete",
|
|
180
|
+
"scope": "global"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"module": "webhooks",
|
|
184
|
+
"action": "export",
|
|
185
|
+
"scope": "global"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"module": "webhooks",
|
|
189
|
+
"action": "approve",
|
|
190
|
+
"scope": "global"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"module": "webhooks",
|
|
194
|
+
"action": "global",
|
|
195
|
+
"scope": "global"
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Tenant Admin permissions: CRUD for users and roles with tenant scope.
|
|
201
|
+
*/
|
|
202
|
+
const TENANT_ADMIN_PERMISSIONS = [
|
|
203
|
+
{
|
|
204
|
+
"module": "users",
|
|
205
|
+
"action": "read",
|
|
206
|
+
"scope": "tenant"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"module": "users",
|
|
210
|
+
"action": "write",
|
|
211
|
+
"scope": "tenant"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"module": "users",
|
|
215
|
+
"action": "update",
|
|
216
|
+
"scope": "tenant"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"module": "users",
|
|
220
|
+
"action": "delete",
|
|
221
|
+
"scope": "tenant"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"module": "roles",
|
|
225
|
+
"action": "read",
|
|
226
|
+
"scope": "tenant"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"module": "roles",
|
|
230
|
+
"action": "write",
|
|
231
|
+
"scope": "tenant"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"module": "roles",
|
|
235
|
+
"action": "update",
|
|
236
|
+
"scope": "tenant"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"module": "roles",
|
|
240
|
+
"action": "delete",
|
|
241
|
+
"scope": "tenant"
|
|
242
|
+
}
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Write the credentials.md file with the super admin login details.
|
|
247
|
+
*/
|
|
248
|
+
function writeCredentials() {
|
|
249
|
+
const content = `# Super Admin Credentials
|
|
250
|
+
|
|
251
|
+
**Email:** ${SUPER_ADMIN_EMAIL}
|
|
252
|
+
**Password:** ${SUPER_ADMIN_PASSWORD}
|
|
253
|
+
|
|
254
|
+
> ⚠️ **WARNING:** Change this password after first login. This file should not be committed to version control.
|
|
255
|
+
`;
|
|
256
|
+
fs.writeFileSync(path.join(process.cwd(), "credentials.md"), content, "utf8");
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Seed the database with Super Admin user and Tenant Admin Role.
|
|
261
|
+
*
|
|
262
|
+
* @param {object} db - Database connection/query interface
|
|
263
|
+
* @returns {Promise<void>}
|
|
264
|
+
*/
|
|
265
|
+
async function seed(db) {
|
|
266
|
+
const passwordHash = await hashPassword(SUPER_ADMIN_PASSWORD);
|
|
267
|
+
|
|
268
|
+
// Insert Super Admin role with all permissions
|
|
269
|
+
const superAdminRoleResult = await db("roles").insert({
|
|
270
|
+
tenant_id: null,
|
|
271
|
+
name: "Super Admin",
|
|
272
|
+
created_at: new Date(),
|
|
273
|
+
modified_at: new Date(),
|
|
274
|
+
});
|
|
275
|
+
const superAdminRoleId = Array.isArray(superAdminRoleResult)
|
|
276
|
+
? superAdminRoleResult[0]
|
|
277
|
+
: superAdminRoleResult;
|
|
278
|
+
|
|
279
|
+
// Insert Super Admin permissions
|
|
280
|
+
for (const perm of SUPER_ADMIN_PERMISSIONS) {
|
|
281
|
+
await db("role_permissions").insert({
|
|
282
|
+
role_id: superAdminRoleId,
|
|
283
|
+
permission: JSON.stringify(perm),
|
|
284
|
+
created_at: new Date(),
|
|
285
|
+
modified_at: new Date(),
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Insert Super Admin user
|
|
290
|
+
await db("users").insert({
|
|
291
|
+
email: SUPER_ADMIN_EMAIL,
|
|
292
|
+
password_hash: passwordHash,
|
|
293
|
+
name: "Super Admin",
|
|
294
|
+
tenant_id: null,
|
|
295
|
+
role_id: superAdminRoleId,
|
|
296
|
+
created_at: new Date(),
|
|
297
|
+
modified_at: new Date(),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Insert Tenant Admin Role
|
|
301
|
+
const tenantAdminRoleResult = await db("roles").insert({
|
|
302
|
+
tenant_id: null,
|
|
303
|
+
name: "Tenant Admin",
|
|
304
|
+
created_at: new Date(),
|
|
305
|
+
modified_at: new Date(),
|
|
306
|
+
});
|
|
307
|
+
const tenantAdminRoleId = Array.isArray(tenantAdminRoleResult)
|
|
308
|
+
? tenantAdminRoleResult[0]
|
|
309
|
+
: tenantAdminRoleResult;
|
|
310
|
+
|
|
311
|
+
// Insert Tenant Admin permissions
|
|
312
|
+
for (const perm of TENANT_ADMIN_PERMISSIONS) {
|
|
313
|
+
await db("role_permissions").insert({
|
|
314
|
+
role_id: tenantAdminRoleId,
|
|
315
|
+
permission: JSON.stringify(perm),
|
|
316
|
+
created_at: new Date(),
|
|
317
|
+
modified_at: new Date(),
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Write credentials file
|
|
322
|
+
writeCredentials();
|
|
323
|
+
|
|
324
|
+
console.log("SaaS seed completed successfully.");
|
|
325
|
+
console.log("Super Admin:", SUPER_ADMIN_EMAIL);
|
|
326
|
+
console.log("Credentials written to credentials.md");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
module.exports = { seed, SUPER_ADMIN_PERMISSIONS, TENANT_ADMIN_PERMISSIONS, SUPER_ADMIN_EMAIL, SUPER_ADMIN_PASSWORD };
|
package/docker-compose.yml
CHANGED
|
@@ -143,3 +143,64 @@ services:
|
|
|
143
143
|
start_period: 90s
|
|
144
144
|
networks:
|
|
145
145
|
- db-network
|
|
146
|
+
|
|
147
|
+
zookeeper:
|
|
148
|
+
image: confluentinc/cp-zookeeper:7.6.0
|
|
149
|
+
container_name: db-model-router-zookeeper
|
|
150
|
+
restart: unless-stopped
|
|
151
|
+
ports:
|
|
152
|
+
- "2181:2181"
|
|
153
|
+
environment:
|
|
154
|
+
ZOOKEEPER_CLIENT_PORT: 2181
|
|
155
|
+
ZOOKEEPER_TICK_TIME: 2000
|
|
156
|
+
healthcheck:
|
|
157
|
+
test: ["CMD-SHELL", "echo srvr | nc localhost 2181 || exit 1"]
|
|
158
|
+
interval: 10s
|
|
159
|
+
timeout: 5s
|
|
160
|
+
retries: 5
|
|
161
|
+
start_period: 15s
|
|
162
|
+
networks:
|
|
163
|
+
- db-network
|
|
164
|
+
|
|
165
|
+
kafka:
|
|
166
|
+
image: confluentinc/cp-kafka:7.6.0
|
|
167
|
+
container_name: db-model-router-kafka
|
|
168
|
+
restart: unless-stopped
|
|
169
|
+
depends_on:
|
|
170
|
+
zookeeper:
|
|
171
|
+
condition: service_healthy
|
|
172
|
+
ports:
|
|
173
|
+
- "9092:9092"
|
|
174
|
+
- "29092:29092"
|
|
175
|
+
environment:
|
|
176
|
+
KAFKA_BROKER_ID: 1
|
|
177
|
+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
|
178
|
+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
|
|
179
|
+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
|
180
|
+
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
|
181
|
+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
182
|
+
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
|
183
|
+
healthcheck:
|
|
184
|
+
test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092"]
|
|
185
|
+
interval: 10s
|
|
186
|
+
timeout: 10s
|
|
187
|
+
retries: 10
|
|
188
|
+
start_period: 30s
|
|
189
|
+
networks:
|
|
190
|
+
- db-network
|
|
191
|
+
|
|
192
|
+
kafka-ui:
|
|
193
|
+
image: provectuslabs/kafka-ui:latest
|
|
194
|
+
container_name: db-model-router-kafka-ui
|
|
195
|
+
restart: unless-stopped
|
|
196
|
+
depends_on:
|
|
197
|
+
kafka:
|
|
198
|
+
condition: service_healthy
|
|
199
|
+
ports:
|
|
200
|
+
- "8090:8080"
|
|
201
|
+
environment:
|
|
202
|
+
KAFKA_CLUSTERS_0_NAME: local
|
|
203
|
+
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
|
|
204
|
+
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper:2181
|
|
205
|
+
networks:
|
|
206
|
+
- db-network
|
package/package.json
CHANGED
|
@@ -1,113 +1,120 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "db-model-router",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Generative API Creation using mysql2 and express libraries in node js",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"db-model-router": "src/cli/main.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"dev": "nodemon src/serve.js",
|
|
11
|
-
"test": "dotenv -e env/.env.default -- mocha --exit",
|
|
12
|
-
"test:sqlite3": "dotenv -e env/.env.sqlite3 -- mocha test/adapters/sqlite3.*.test.js test/properties/sqlite3.filter.property.test.js --timeout 15000 --exit",
|
|
13
|
-
"test:mysql": "dotenv -e env/.env.mysql -- mocha test/adapters/mysql.*.test.js test/properties/mysql.filter.property.test.js --timeout 15000 --exit",
|
|
14
|
-
"test:postgres": "dotenv -e env/.env.postgres -- mocha test/adapters/postgres.*.test.js test/properties/postgres.filter.property.test.js --timeout 15000 --exit",
|
|
15
|
-
"test:oracle": "dotenv -e env/.env.oracle -- mocha test/adapters/oracle.*.test.js test/properties/oracle.filter.property.test.js --timeout 30000 --exit",
|
|
16
|
-
"test:mongodb": "dotenv -e env/.env.mongodb -- mocha test/adapters/mongodb.*.test.js test/properties/mongodb.filter.property.test.js --timeout 15000 --exit",
|
|
17
|
-
"test:dynamodb": "dotenv -e env/.env.dynamodb -- mocha test/adapters/dynamodb.*.test.js test/properties/dynamodb.filter.property.test.js --timeout 15000 --exit",
|
|
18
|
-
"test:redis": "dotenv -e env/.env.redis -- mocha test/adapters/redis.*.test.js --timeout 15000 --exit",
|
|
19
|
-
"test:cockroachdb": "dotenv -e env/.env.cockroachdb -- mocha test/adapters/cockroachdb.*.test.js --timeout 15000 --exit",
|
|
20
|
-
"test:mssql": "dotenv -e env/.env.mssql -- mocha test/adapters/mssql.*.test.js --timeout 30000 --exit",
|
|
21
|
-
"test:
|
|
22
|
-
"test:
|
|
23
|
-
"
|
|
24
|
-
"demo:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"express":
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"optional": true
|
|
76
|
-
},
|
|
77
|
-
"
|
|
78
|
-
"optional": true
|
|
79
|
-
},
|
|
80
|
-
"@aws-sdk/
|
|
81
|
-
"optional": true
|
|
82
|
-
},
|
|
83
|
-
"
|
|
84
|
-
"optional": true
|
|
85
|
-
},
|
|
86
|
-
"
|
|
87
|
-
"optional": true
|
|
88
|
-
},
|
|
89
|
-
"
|
|
90
|
-
"optional": true
|
|
91
|
-
},
|
|
92
|
-
"
|
|
93
|
-
"optional": true
|
|
94
|
-
},
|
|
95
|
-
"
|
|
96
|
-
"optional": true
|
|
97
|
-
},
|
|
98
|
-
"
|
|
99
|
-
"optional": true
|
|
100
|
-
},
|
|
101
|
-
"
|
|
102
|
-
"optional": true
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "db-model-router",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Generative API Creation using mysql2 and express libraries in node js",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"db-model-router": "src/cli/main.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "nodemon src/serve.js",
|
|
11
|
+
"test": "dotenv -e env/.env.default -- mocha --exit",
|
|
12
|
+
"test:sqlite3": "dotenv -e env/.env.sqlite3 -- mocha test/adapters/sqlite3.*.test.js test/properties/sqlite3.filter.property.test.js --timeout 15000 --exit",
|
|
13
|
+
"test:mysql": "dotenv -e env/.env.mysql -- mocha test/adapters/mysql.*.test.js test/properties/mysql.filter.property.test.js --timeout 15000 --exit",
|
|
14
|
+
"test:postgres": "dotenv -e env/.env.postgres -- mocha test/adapters/postgres.*.test.js test/properties/postgres.filter.property.test.js --timeout 15000 --exit",
|
|
15
|
+
"test:oracle": "dotenv -e env/.env.oracle -- mocha test/adapters/oracle.*.test.js test/properties/oracle.filter.property.test.js --timeout 30000 --exit",
|
|
16
|
+
"test:mongodb": "dotenv -e env/.env.mongodb -- mocha test/adapters/mongodb.*.test.js test/properties/mongodb.filter.property.test.js --timeout 15000 --exit",
|
|
17
|
+
"test:dynamodb": "dotenv -e env/.env.dynamodb -- mocha test/adapters/dynamodb.*.test.js test/properties/dynamodb.filter.property.test.js --timeout 15000 --exit",
|
|
18
|
+
"test:redis": "dotenv -e env/.env.redis -- mocha test/adapters/redis.*.test.js --timeout 15000 --exit",
|
|
19
|
+
"test:cockroachdb": "dotenv -e env/.env.cockroachdb -- mocha test/adapters/cockroachdb.*.test.js --timeout 15000 --exit",
|
|
20
|
+
"test:mssql": "dotenv -e env/.env.mssql -- mocha test/adapters/mssql.*.test.js --timeout 30000 --exit",
|
|
21
|
+
"test:kafka": "dotenv -e env/.env.kafka -- mocha test/kafka.test.js test/kafka.integration.test.js --timeout 30000 --exit",
|
|
22
|
+
"test:properties": "mocha test/properties/*.property.test.js --timeout 30000 --exit",
|
|
23
|
+
"test:all": "mocha test/adapters/*.test.js test/properties/*.property.test.js test/function.test.js --timeout 30000 --exit",
|
|
24
|
+
"demo:clear": "node -e \"var fs=require('fs'),p=require('path'),d=p.join(__dirname,'demo');fs.existsSync(d)&&fs.rmSync(d,{recursive:true,force:true});fs.mkdirSync(d,{recursive:true})\"",
|
|
25
|
+
"demo:create": "node scripts/demo-create.js"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/AvinashSKaranth/db-model-router"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"mysql2",
|
|
33
|
+
"sqlite3",
|
|
34
|
+
"oracledb",
|
|
35
|
+
"postgres",
|
|
36
|
+
"pg",
|
|
37
|
+
"dynamodb",
|
|
38
|
+
"mongodb",
|
|
39
|
+
"mssql",
|
|
40
|
+
"express",
|
|
41
|
+
"ultimate-express",
|
|
42
|
+
"generative",
|
|
43
|
+
"rest",
|
|
44
|
+
"api"
|
|
45
|
+
],
|
|
46
|
+
"author": "Avinash S Karanth",
|
|
47
|
+
"license": "Apache-2.0",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/AvinashSKaranth/db-model-router/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/AvinashSKaranth/db-model-router#readme",
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"dotenv": "^10.0.0",
|
|
54
|
+
"ejs": "^5.0.2",
|
|
55
|
+
"inquirer": "^8.2.6",
|
|
56
|
+
"lodash": "^4.17.21",
|
|
57
|
+
"node-input-validator": "^4.5.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@aws-sdk/client-dynamodb": "^3.1039.0",
|
|
61
|
+
"@aws-sdk/lib-dynamodb": "^3.1039.0",
|
|
62
|
+
"better-sqlite3": "^12.9.0",
|
|
63
|
+
"express": "^4.17.2 || ^5.0.0",
|
|
64
|
+
"ioredis": "^5.10.1",
|
|
65
|
+
"kafkajs": "^2.2.4",
|
|
66
|
+
"mongodb": "^7.2.0",
|
|
67
|
+
"mssql": "^12.5.0",
|
|
68
|
+
"mysql2": "^3.22.3",
|
|
69
|
+
"oracledb": "^6.10.0",
|
|
70
|
+
"pg": "^8.20.0",
|
|
71
|
+
"ultimate-express": "^2.0.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"express": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"ultimate-express": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@aws-sdk/client-dynamodb": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"@aws-sdk/lib-dynamodb": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"better-sqlite3": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"ioredis": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"kafkajs": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"mongodb": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"mssql": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"mysql2": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"oracledb": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"pg": {
|
|
108
|
+
"optional": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"devDependencies": {
|
|
112
|
+
"dotenv-cli": "^11.0.0",
|
|
113
|
+
"express": "^4.21.0",
|
|
114
|
+
"faker": "^5.5.3",
|
|
115
|
+
"fast-check": "^4.6.0",
|
|
116
|
+
"kafkajs": "^2.2.4",
|
|
117
|
+
"mocha": "^11.7.2",
|
|
118
|
+
"supertest": "^6.2.4"
|
|
119
|
+
}
|
|
120
|
+
}
|
package/scripts/demo-create.js
CHANGED