admindb 2.1.0 → 2.2.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 +41 -12
- package/dist/app.d.ts +1 -69
- package/dist/app.js +3 -30
- package/dist/auth/config.d.ts +1 -19
- package/dist/auth/config.js +0 -26
- package/dist/auth/crypto.d.ts +1 -27
- package/dist/auth/crypto.js +1 -26
- package/dist/auth/index.d.ts +1 -5
- package/dist/auth/index.js +0 -1
- package/dist/auth/middleware.d.ts +1 -14
- package/dist/auth/middleware.js +0 -15
- package/dist/auth/routes.d.ts +1 -7
- package/dist/auth/routes.js +0 -8
- package/dist/auth/types.d.ts +1 -35
- package/dist/auth/types.js +1 -5
- package/dist/cli/args.d.ts +1 -45
- package/dist/cli/args.js +3 -11
- package/dist/cli/config.d.ts +1 -56
- package/dist/cli/config.js +0 -5
- package/dist/cli/index.d.ts +1 -4
- package/dist/cli/index.js +0 -1
- package/dist/cli/runner.d.ts +1 -1
- package/dist/cli/runner.js +6 -17
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +0 -1
- package/dist/data/chain.d.ts +1 -0
- package/dist/data/chain.js +707 -0
- package/dist/data/datasets.d.ts +1 -17
- package/dist/data/datasets.js +0 -4
- package/dist/data/detector.d.ts +1 -30
- package/dist/data/detector.js +53 -14
- package/dist/data/engine.d.ts +1 -10
- package/dist/data/engine.js +82 -48
- package/dist/data/index.d.ts +1 -5
- package/dist/data/index.js +1 -1
- package/dist/data/strategies.d.ts +1 -30
- package/dist/data/strategies.js +4 -8
- package/dist/data/types.d.ts +1 -73
- package/dist/data/types.js +0 -3
- package/dist/db/database.d.ts +1 -119
- package/dist/db/database.js +20 -14
- package/dist/db/export.d.ts +1 -12
- package/dist/db/export.js +54 -6
- package/dist/db/filters.d.ts +1 -22
- package/dist/db/filters.js +0 -16
- package/dist/db/index.d.ts +1 -8
- package/dist/db/index.js +0 -1
- package/dist/db/introspection.d.ts +1 -6
- package/dist/db/introspection.js +0 -5
- package/dist/db/manager.d.ts +1 -81
- package/dist/db/manager.js +13 -59
- package/dist/db/migrations.d.ts +1 -5
- package/dist/db/migrations.js +2 -5
- package/dist/db/postgres.d.ts +1 -85
- package/dist/db/postgres.js +21 -31
- package/dist/db/types.d.ts +1 -206
- package/dist/db/types.js +0 -1
- package/dist/index.d.ts +1 -23
- package/dist/index.js +0 -14
- package/dist/public/css/app.css +1 -1
- package/dist/public/js/api.js +1 -47
- package/dist/public/js/app.js +1 -262
- package/dist/public/js/browse.js +1 -1371
- package/dist/public/js/common.js +1 -0
- package/dist/public/js/databases.js +1 -235
- package/dist/public/js/designer.js +1 -258
- package/dist/public/js/forms.js +1 -826
- package/dist/public/js/home.js +1 -0
- package/dist/public/js/inspector.js +1 -638
- package/dist/public/js/query.js +1 -322
- package/dist/public/js/schema.js +1 -447
- package/dist/public/js/seed.js +1 -1090
- package/dist/routes/api/erd.d.ts +1 -0
- package/dist/routes/api/erd.js +50 -0
- package/dist/routes/api/helpers.d.ts +1 -42
- package/dist/routes/api/helpers.js +33 -3
- package/dist/routes/api/import-export.d.ts +1 -3
- package/dist/routes/api/import-export.js +0 -2
- package/dist/routes/api/index.d.ts +1 -4
- package/dist/routes/api/index.js +15 -4
- package/dist/routes/api/query.d.ts +1 -3
- package/dist/routes/api/query.js +13 -11
- package/dist/routes/api/rows.d.ts +1 -3
- package/dist/routes/api/rows.js +0 -11
- package/dist/routes/api/seed.d.ts +1 -3
- package/dist/routes/api/seed.js +79 -8
- package/dist/routes/api/tables.d.ts +1 -3
- package/dist/routes/api/tables.js +77 -6
- package/dist/routes/databases.d.ts +1 -26
- package/dist/routes/databases.js +1 -3
- package/dist/routes/index.d.ts +1 -3
- package/dist/routes/index.js +0 -1
- package/dist/routes/pages.d.ts +1 -9
- package/dist/routes/pages.js +18 -11
- package/dist/serverless.d.ts +1 -40
- package/dist/serverless.js +3 -39
- package/dist/sql/classifier.d.ts +1 -19
- package/dist/sql/classifier.js +0 -13
- package/dist/sql/error-analyzer.d.ts +1 -0
- package/dist/sql/error-analyzer.js +550 -0
- package/dist/sql/generator.d.ts +1 -81
- package/dist/sql/generator.js +0 -29
- package/dist/sql/index.d.ts +1 -2
- package/dist/sql/index.js +0 -1
- package/dist/types/api.d.ts +1 -412
- package/dist/types/api.js +0 -7
- package/dist/utils/colors.d.ts +1 -40
- package/dist/utils/colors.js +0 -10
- package/dist/utils/common.d.ts +1 -50
- package/dist/utils/common.js +19 -23
- package/dist/utils/csv.d.ts +1 -15
- package/dist/utils/csv.js +0 -13
- package/dist/utils/datatype.d.ts +1 -49
- package/dist/utils/datatype.js +0 -41
- package/dist/utils/icons.d.ts +1 -11
- package/dist/utils/icons.js +25 -16
- package/dist/utils/index.d.ts +1 -4
- package/dist/utils/index.js +0 -1
- package/dist/utils/logger.d.ts +1 -10
- package/dist/utils/logger.js +0 -4
- package/dist/views/layouts/main.hbs +14 -5
- package/dist/views/pages/databases.hbs +0 -18
- package/dist/views/pages/designer.hbs +0 -10
- package/dist/views/pages/erd.hbs +1241 -0
- package/dist/views/pages/error.hbs +0 -2
- package/dist/views/pages/form.hbs +0 -5
- package/dist/views/pages/home.hbs +98 -10
- package/dist/views/pages/info.hbs +107 -0
- package/dist/views/pages/login.hbs +0 -13
- package/dist/views/pages/query.hbs +54 -21
- package/dist/views/pages/schema.hbs +0 -20
- package/dist/views/pages/seed.hbs +435 -202
- package/dist/views/pages/table.hbs +0 -14
- package/dist/views/partials/icon.hbs +0 -1
- package/dist/views/partials/navbar.hbs +0 -6
- package/dist/views/partials/sidebar.hbs +12 -8
- package/docs/API.md +6 -1
- package/docs/EXAMPLES.md +3 -0
- package/package.json +7 -5
- package/dist/app.js.map +0 -1
- package/dist/auth/config.js.map +0 -1
- package/dist/auth/crypto.js.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/middleware.js.map +0 -1
- package/dist/auth/routes.js.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/runner.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/data/datasets.js.map +0 -1
- package/dist/data/detector.js.map +0 -1
- package/dist/data/engine.js.map +0 -1
- package/dist/data/index.js.map +0 -1
- package/dist/data/strategies.js.map +0 -1
- package/dist/data/types.js.map +0 -1
- package/dist/db/database.js.map +0 -1
- package/dist/db/export.js.map +0 -1
- package/dist/db/filters.js.map +0 -1
- package/dist/db/index.js.map +0 -1
- package/dist/db/introspection.js.map +0 -1
- package/dist/db/manager.js.map +0 -1
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/postgres.js.map +0 -1
- package/dist/db/types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/public/css/input.css +0 -302
- package/dist/public/js/icons.js +0 -51
- package/dist/routes/api/helpers.js.map +0 -1
- package/dist/routes/api/import-export.js.map +0 -1
- package/dist/routes/api/index.js.map +0 -1
- package/dist/routes/api/query.js.map +0 -1
- package/dist/routes/api/rows.js.map +0 -1
- package/dist/routes/api/seed.js.map +0 -1
- package/dist/routes/api/tables.js.map +0 -1
- package/dist/routes/databases.js.map +0 -1
- package/dist/routes/index.js.map +0 -1
- package/dist/routes/pages.js.map +0 -1
- package/dist/serverless.js.map +0 -1
- package/dist/sql/classifier.js.map +0 -1
- package/dist/sql/generator.js.map +0 -1
- package/dist/sql/index.js.map +0 -1
- package/dist/types/api.js.map +0 -1
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/csv.js.map +0 -1
- package/dist/utils/datatype.js.map +0 -1
- package/dist/utils/icons.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.js.map +0 -1
package/dist/sql/generator.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Pure SQL generators. Kept completely free of any I/O so they are easy to
|
|
4
|
-
* unit-test. Both the "run" and the "generate" (get-query) variants of every
|
|
5
|
-
* mutating operation share these functions.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.DESIGNER_TYPES = exports.POSTGRES_DESIGNER_TYPES = exports.SQLITE_DESIGNER_TYPES = void 0;
|
|
9
4
|
exports.getDesignerTypes = getDesignerTypes;
|
|
@@ -88,15 +83,12 @@ function getDesignerTypes(dialect = 'sqlite') {
|
|
|
88
83
|
return dialect === 'postgres' ? exports.POSTGRES_DESIGNER_TYPES : exports.SQLITE_DESIGNER_TYPES;
|
|
89
84
|
}
|
|
90
85
|
const IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_$]*$/;
|
|
91
|
-
/** Quote an SQL identifier (table/column name), escaping embedded double quotes. */
|
|
92
86
|
function quoteIdentifier(identifier) {
|
|
93
87
|
return `"${String(identifier).replace(/"/g, '""')}"`;
|
|
94
88
|
}
|
|
95
|
-
/** Escape a string for use inside a single-quoted SQL literal. */
|
|
96
89
|
function escapeString(value) {
|
|
97
90
|
return `'${String(value).replace(/'/g, "''")}'`;
|
|
98
91
|
}
|
|
99
|
-
/** Render a JS value as a safe SQL literal. */
|
|
100
92
|
function sqlValue(value) {
|
|
101
93
|
if (value === null || value === undefined)
|
|
102
94
|
return 'NULL';
|
|
@@ -112,10 +104,6 @@ function sqlValue(value) {
|
|
|
112
104
|
return escapeString(value.toISOString());
|
|
113
105
|
return escapeString(String(value));
|
|
114
106
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Map a designer-friendly or custom SQL type to a real database column type.
|
|
117
|
-
* DATE-style types map to a datetime column with a current-timestamp default.
|
|
118
|
-
*/
|
|
119
107
|
function mapColumnType(type) {
|
|
120
108
|
const t = String(type ?? '').trim().toUpperCase();
|
|
121
109
|
if (!t)
|
|
@@ -196,7 +184,6 @@ function validateIdentifier(kind, name) {
|
|
|
196
184
|
throw new Error(`Invalid ${label.toLowerCase()} name: "${trimmed}". Use letters, digits and underscores.`);
|
|
197
185
|
}
|
|
198
186
|
}
|
|
199
|
-
/** Format a raw user-provided default value safely for SQL DDL. */
|
|
200
187
|
function formatSqlDefault(raw, colType) {
|
|
201
188
|
const s = String(raw ?? '').trim().replace(/;/g, '');
|
|
202
189
|
if (!s)
|
|
@@ -219,11 +206,6 @@ function formatSqlDefault(raw, colType) {
|
|
|
219
206
|
}
|
|
220
207
|
return s;
|
|
221
208
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Render a single column definition.
|
|
224
|
-
* When `forAddColumn` is set, enforces SQLite's ADD COLUMN restrictions
|
|
225
|
-
* (no PRIMARY KEY / UNIQUE, NOT NULL requires a default, FK requires NULL default).
|
|
226
|
-
*/
|
|
227
209
|
function renderColumnDef(col, opts = {}) {
|
|
228
210
|
const colName = String(col?.name ?? '').trim();
|
|
229
211
|
validateIdentifier('column', colName);
|
|
@@ -258,7 +240,6 @@ function renderColumnDef(col, opts = {}) {
|
|
|
258
240
|
}
|
|
259
241
|
return def;
|
|
260
242
|
}
|
|
261
|
-
/** Build a `CREATE TABLE` statement from structured column definitions. */
|
|
262
243
|
function generateCreateTable(tableName, columns) {
|
|
263
244
|
const table = String(tableName ?? '').trim();
|
|
264
245
|
validateIdentifier('table', table);
|
|
@@ -282,38 +263,32 @@ function generateCreateTable(tableName, columns) {
|
|
|
282
263
|
throw new Error('At most one primary key column is allowed.');
|
|
283
264
|
return `CREATE TABLE ${quoteIdentifier(table)} (\n ${parts.join(',\n ')}\n);`;
|
|
284
265
|
}
|
|
285
|
-
/** Build an `ALTER TABLE … ADD COLUMN` statement. */
|
|
286
266
|
function generateAddColumn(tableName, col) {
|
|
287
267
|
const table = String(tableName ?? '').trim();
|
|
288
268
|
validateIdentifier('table', table);
|
|
289
269
|
const def = renderColumnDef(col, { forAddColumn: true });
|
|
290
270
|
return `ALTER TABLE ${quoteIdentifier(table)} ADD COLUMN ${def};`;
|
|
291
271
|
}
|
|
292
|
-
/** Build an `ALTER TABLE … RENAME TO …` statement. */
|
|
293
272
|
function generateRenameTable(tableName, newName) {
|
|
294
273
|
validateIdentifier('table', tableName);
|
|
295
274
|
validateIdentifier('table', newName);
|
|
296
275
|
return `ALTER TABLE ${quoteIdentifier(tableName)} RENAME TO ${quoteIdentifier(newName)};`;
|
|
297
276
|
}
|
|
298
|
-
/** Build an `ALTER TABLE … RENAME COLUMN … TO …` statement. */
|
|
299
277
|
function generateRenameColumn(tableName, oldName, newName) {
|
|
300
278
|
validateIdentifier('table', tableName);
|
|
301
279
|
validateIdentifier('column', oldName);
|
|
302
280
|
validateIdentifier('column', newName);
|
|
303
281
|
return `ALTER TABLE ${quoteIdentifier(tableName)} RENAME COLUMN ${quoteIdentifier(oldName)} TO ${quoteIdentifier(newName)};`;
|
|
304
282
|
}
|
|
305
|
-
/** Build an `ALTER TABLE … DROP COLUMN …` statement. */
|
|
306
283
|
function generateDropColumn(tableName, column) {
|
|
307
284
|
validateIdentifier('table', tableName);
|
|
308
285
|
validateIdentifier('column', column);
|
|
309
286
|
return `ALTER TABLE ${quoteIdentifier(tableName)} DROP COLUMN ${quoteIdentifier(column)};`;
|
|
310
287
|
}
|
|
311
|
-
/** Build a `DROP TABLE …` statement. */
|
|
312
288
|
function generateDropTable(tableName) {
|
|
313
289
|
validateIdentifier('table', tableName);
|
|
314
290
|
return `DROP TABLE ${quoteIdentifier(tableName)};`;
|
|
315
291
|
}
|
|
316
|
-
/** Build a `CREATE INDEX` (or `CREATE UNIQUE INDEX`) statement. */
|
|
317
292
|
function generateCreateIndex(tableName, index) {
|
|
318
293
|
validateIdentifier('table', tableName);
|
|
319
294
|
const cols = Array.isArray(index?.columns) ? index.columns : [];
|
|
@@ -328,21 +303,17 @@ function generateCreateIndex(tableName, index) {
|
|
|
328
303
|
validateIdentifier('index', name);
|
|
329
304
|
return `CREATE ${unique}INDEX ${quoteIdentifier(name)} ON ${quoteIdentifier(tableName)} (${cols.map(quoteIdentifier).join(', ')});`;
|
|
330
305
|
}
|
|
331
|
-
/** Build a `DROP INDEX …` statement. */
|
|
332
306
|
function generateDropIndex(indexName) {
|
|
333
307
|
validateIdentifier('index', indexName);
|
|
334
308
|
return `DROP INDEX ${quoteIdentifier(indexName)};`;
|
|
335
309
|
}
|
|
336
|
-
/** Build an `INSERT` statement from column/value pairs. */
|
|
337
310
|
function generateInsert(table, fields) {
|
|
338
311
|
const cols = fields.map((f) => quoteIdentifier(f.column));
|
|
339
312
|
const vals = fields.map((f) => sqlValue(f.value));
|
|
340
313
|
return `INSERT INTO ${quoteIdentifier(table)} (${cols.join(', ')}) VALUES (${vals.join(', ')});`;
|
|
341
314
|
}
|
|
342
|
-
/** Build an `UPDATE` statement from SET fields and a WHERE clause. */
|
|
343
315
|
function generateUpdate(table, fields, where) {
|
|
344
316
|
const sets = fields.map((f) => `${quoteIdentifier(f.column)} = ${sqlValue(f.value)}`);
|
|
345
317
|
const conds = where.map((w) => `${quoteIdentifier(w.column)} = ${sqlValue(w.value)}`);
|
|
346
318
|
return `UPDATE ${quoteIdentifier(table)} SET ${sets.join(', ')} WHERE ${conds.join(' AND ')};`;
|
|
347
319
|
}
|
|
348
|
-
//# sourceMappingURL=generator.js.map
|
package/dist/sql/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './classifier';
|
|
2
|
-
export * from './generator';
|
|
1
|
+
export * from './classifier';export * from './generator';
|
package/dist/sql/index.js
CHANGED
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./classifier"), exports);
|
|
18
18
|
__exportStar(require("./generator"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,412 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* AdminDB — Strongly typed API request and response interfaces.
|
|
3
|
-
*
|
|
4
|
-
* Every REST API endpoint returns a standardized envelope:
|
|
5
|
-
* `{ success: true, data: T }` on success, or `{ success: false, error: string }` on failure.
|
|
6
|
-
*/
|
|
7
|
-
import type { ColumnInfo, ForeignKeyInfo, IndexInfo, SavedQuery, SchemaInfo, TableInfoData, TableListItem, WhereClause, RowFilters } from '../db/database';
|
|
8
|
-
import type { DatabaseEntry } from '../db/manager';
|
|
9
|
-
import type { ColumnDef, IndexDef } from '../sql/generator';
|
|
10
|
-
import type { ColumnGeneratorConfig, ColumnPlan, GeneratorStrategyId, StrategyDescriptor, StrategyCategory } from '../data/index';
|
|
11
|
-
export type { ColumnInfo, ForeignKeyInfo, IndexInfo, SavedQuery, SchemaInfo, TableInfoData, TableListItem, WhereClause, RowFilters, ColumnDef, IndexDef, ColumnGeneratorConfig, ColumnPlan, GeneratorStrategyId, StrategyDescriptor, StrategyCategory, };
|
|
12
|
-
/** Successful API response container. */
|
|
13
|
-
export interface ApiSuccessResponse<T = unknown> {
|
|
14
|
-
success: true;
|
|
15
|
-
data: T;
|
|
16
|
-
}
|
|
17
|
-
/** Error API response container. */
|
|
18
|
-
export interface ApiErrorResponse<T = unknown> {
|
|
19
|
-
success: false;
|
|
20
|
-
error: string;
|
|
21
|
-
data?: T;
|
|
22
|
-
}
|
|
23
|
-
/** Discriminated union of all API responses. */
|
|
24
|
-
export type ApiResponse<T = unknown> = ApiSuccessResponse<T> | ApiErrorResponse<T>;
|
|
25
|
-
/** GET /api/tables */
|
|
26
|
-
export type ListTablesResponseData = TableListItem[];
|
|
27
|
-
export type ListTablesResponse = ApiResponse<ListTablesResponseData>;
|
|
28
|
-
/** GET /api/tables/:table/info */
|
|
29
|
-
export type TableInfoResponseData = TableInfoData;
|
|
30
|
-
export type TableInfoResponse = ApiResponse<TableInfoResponseData>;
|
|
31
|
-
/** GET /api/tables/:table/fk-options */
|
|
32
|
-
export type FkOptionsResponseData = Record<string, {
|
|
33
|
-
value: unknown;
|
|
34
|
-
label: string;
|
|
35
|
-
}[]>;
|
|
36
|
-
export type FkOptionsResponse = ApiResponse<FkOptionsResponseData>;
|
|
37
|
-
/** GET /api/tables/:table/rows */
|
|
38
|
-
export interface GetRowsResponseData {
|
|
39
|
-
rows: Record<string, unknown>[];
|
|
40
|
-
count: number;
|
|
41
|
-
page: number;
|
|
42
|
-
limit: number;
|
|
43
|
-
filters: RowFilters;
|
|
44
|
-
}
|
|
45
|
-
export type GetRowsResponse = ApiResponse<GetRowsResponseData>;
|
|
46
|
-
/** GET /api/tables/:table/row/:id */
|
|
47
|
-
export type GetRowResponseData = Record<string, unknown>;
|
|
48
|
-
export type GetRowResponse = ApiResponse<GetRowResponseData>;
|
|
49
|
-
/** GET /api/tables/:table/rows/:id/references */
|
|
50
|
-
export interface RowReferenceGroup {
|
|
51
|
-
table: string;
|
|
52
|
-
from: string;
|
|
53
|
-
to: string;
|
|
54
|
-
value: unknown;
|
|
55
|
-
count: number;
|
|
56
|
-
columns: string[];
|
|
57
|
-
rows: Record<string, unknown>[];
|
|
58
|
-
}
|
|
59
|
-
export interface GetRowReferencesResponseData {
|
|
60
|
-
references: RowReferenceGroup[];
|
|
61
|
-
}
|
|
62
|
-
export type GetRowReferencesResponse = ApiResponse<GetRowReferencesResponseData>;
|
|
63
|
-
/** POST /api/tables/:table/rows */
|
|
64
|
-
export interface InsertRowRequestBody {
|
|
65
|
-
values: Record<string, unknown>;
|
|
66
|
-
}
|
|
67
|
-
export interface InsertRowResponseData {
|
|
68
|
-
message: string;
|
|
69
|
-
rowId?: number | bigint;
|
|
70
|
-
sql: string;
|
|
71
|
-
}
|
|
72
|
-
export type InsertRowResponse = ApiResponse<InsertRowResponseData>;
|
|
73
|
-
/** POST /api/tables/:table/rows/generate */
|
|
74
|
-
export interface GenerateInsertRequestBody {
|
|
75
|
-
values: Record<string, unknown>;
|
|
76
|
-
}
|
|
77
|
-
export interface GenerateInsertResponseData {
|
|
78
|
-
sql: string;
|
|
79
|
-
}
|
|
80
|
-
export type GenerateInsertResponse = ApiResponse<GenerateInsertResponseData>;
|
|
81
|
-
/** POST /api/tables/:table/rows/import */
|
|
82
|
-
export interface ImportCsvRequestBody {
|
|
83
|
-
csv: string;
|
|
84
|
-
}
|
|
85
|
-
export interface ImportCsvResponseData {
|
|
86
|
-
message: string;
|
|
87
|
-
inserted?: number;
|
|
88
|
-
skipped?: number;
|
|
89
|
-
}
|
|
90
|
-
export type ImportCsvResponse = ApiResponse<ImportCsvResponseData>;
|
|
91
|
-
/** PUT /api/tables/:table/row/:id */
|
|
92
|
-
export interface UpdateRowRequestBody {
|
|
93
|
-
values: Record<string, unknown>;
|
|
94
|
-
nulls?: string[];
|
|
95
|
-
}
|
|
96
|
-
export interface UpdateRowResponseData {
|
|
97
|
-
message: string;
|
|
98
|
-
sql: string;
|
|
99
|
-
}
|
|
100
|
-
export type UpdateRowResponse = ApiResponse<UpdateRowResponseData>;
|
|
101
|
-
/** PUT /api/tables/:table/row/:id/generate */
|
|
102
|
-
export interface GenerateUpdateRequestBody {
|
|
103
|
-
values: Record<string, unknown>;
|
|
104
|
-
nulls?: string[];
|
|
105
|
-
}
|
|
106
|
-
export interface GenerateUpdateResponseData {
|
|
107
|
-
sql: string;
|
|
108
|
-
}
|
|
109
|
-
export type GenerateUpdateResponse = ApiResponse<GenerateUpdateResponseData>;
|
|
110
|
-
/** DELETE /api/tables/:table/row/:id */
|
|
111
|
-
export interface DeleteRowResponseData {
|
|
112
|
-
message: string;
|
|
113
|
-
}
|
|
114
|
-
export type DeleteRowResponse = ApiResponse<DeleteRowResponseData>;
|
|
115
|
-
/** GET /api/tables/:table/row/:id/blob/:column/meta */
|
|
116
|
-
export interface BlobMetaResponseData {
|
|
117
|
-
isNull: boolean;
|
|
118
|
-
mime?: string;
|
|
119
|
-
ext?: string;
|
|
120
|
-
isImage?: boolean;
|
|
121
|
-
isText?: boolean;
|
|
122
|
-
isPdf?: boolean;
|
|
123
|
-
isAudio?: boolean;
|
|
124
|
-
isVideo?: boolean;
|
|
125
|
-
size: number;
|
|
126
|
-
sizeFormatted: string;
|
|
127
|
-
hexDump?: {
|
|
128
|
-
lines: {
|
|
129
|
-
offset: string;
|
|
130
|
-
hex: string;
|
|
131
|
-
ascii: string;
|
|
132
|
-
}[];
|
|
133
|
-
totalBytes: number;
|
|
134
|
-
truncated: boolean;
|
|
135
|
-
};
|
|
136
|
-
textPreview?: string | null;
|
|
137
|
-
}
|
|
138
|
-
export type BlobMetaResponse = ApiResponse<BlobMetaResponseData>;
|
|
139
|
-
/** PUT /api/tables/:table/row/:id/blob/:column */
|
|
140
|
-
export interface UpdateBlobRequestBody {
|
|
141
|
-
data: string;
|
|
142
|
-
format?: 'base64' | 'hex' | 'text';
|
|
143
|
-
}
|
|
144
|
-
export interface UpdateBlobResponseData {
|
|
145
|
-
message: string;
|
|
146
|
-
size: number;
|
|
147
|
-
}
|
|
148
|
-
export type UpdateBlobResponse = ApiResponse<UpdateBlobResponseData>;
|
|
149
|
-
/** GET /api/tables/:table/ddl */
|
|
150
|
-
export interface TableDdlResponseData {
|
|
151
|
-
table: string;
|
|
152
|
-
ddl: string;
|
|
153
|
-
}
|
|
154
|
-
export type TableDdlResponse = ApiResponse<TableDdlResponseData>;
|
|
155
|
-
/** POST /api/tables/:table/rows/bulk-impact */
|
|
156
|
-
export interface BulkImpactRequestBody {
|
|
157
|
-
ids: (string | number)[];
|
|
158
|
-
}
|
|
159
|
-
export interface BulkImpactReference {
|
|
160
|
-
table: string;
|
|
161
|
-
from: string;
|
|
162
|
-
to: string;
|
|
163
|
-
count: number;
|
|
164
|
-
}
|
|
165
|
-
export interface BulkImpactResponseData {
|
|
166
|
-
selected: number;
|
|
167
|
-
references: BulkImpactReference[];
|
|
168
|
-
total: number;
|
|
169
|
-
}
|
|
170
|
-
export type BulkImpactResponse = ApiResponse<BulkImpactResponseData>;
|
|
171
|
-
/** POST /api/tables/:table/rows/bulk-delete */
|
|
172
|
-
export interface BulkDeleteRequestBody {
|
|
173
|
-
ids: (string | number)[];
|
|
174
|
-
confirmImpact?: boolean;
|
|
175
|
-
}
|
|
176
|
-
export interface BulkDeleteResponseData {
|
|
177
|
-
message: string;
|
|
178
|
-
deleted: number;
|
|
179
|
-
}
|
|
180
|
-
export type BulkDeleteResponse = ApiResponse<BulkDeleteResponseData>;
|
|
181
|
-
/** POST /api/tables/:table/rows/bulk-export */
|
|
182
|
-
export interface BulkExportRequestBody {
|
|
183
|
-
ids: (string | number)[];
|
|
184
|
-
format?: 'csv' | 'json';
|
|
185
|
-
}
|
|
186
|
-
export interface BulkExportResponseData {
|
|
187
|
-
format: string;
|
|
188
|
-
filename: string;
|
|
189
|
-
content: string;
|
|
190
|
-
rowCount: number;
|
|
191
|
-
}
|
|
192
|
-
export type BulkExportResponse = ApiResponse<BulkExportResponseData>;
|
|
193
|
-
/** POST /api/tables/:table/rows/bulk-update */
|
|
194
|
-
export interface BulkUpdateItem {
|
|
195
|
-
id: string | number;
|
|
196
|
-
values?: Record<string, unknown>;
|
|
197
|
-
nulls?: string[];
|
|
198
|
-
}
|
|
199
|
-
export interface BulkUpdateRequestBody {
|
|
200
|
-
updates: BulkUpdateItem[];
|
|
201
|
-
}
|
|
202
|
-
export interface BulkUpdateResponseData {
|
|
203
|
-
message: string;
|
|
204
|
-
updated: number;
|
|
205
|
-
}
|
|
206
|
-
export type BulkUpdateResponse = ApiResponse<BulkUpdateResponseData>;
|
|
207
|
-
/** GET /api/tables/:table/seed/config */
|
|
208
|
-
export interface SeedConfigResponseData {
|
|
209
|
-
table: string;
|
|
210
|
-
columns: ColumnGeneratorConfig[];
|
|
211
|
-
maxRows: number;
|
|
212
|
-
}
|
|
213
|
-
export type SeedConfigResponse = ApiResponse<SeedConfigResponseData>;
|
|
214
|
-
/** POST /api/tables/:table/seed/generate */
|
|
215
|
-
export interface SeedGenerateRequestBody {
|
|
216
|
-
count?: number;
|
|
217
|
-
plan?: Record<string, ColumnPlan>;
|
|
218
|
-
}
|
|
219
|
-
export interface SeedGenerateResponseData {
|
|
220
|
-
table: string;
|
|
221
|
-
count: number;
|
|
222
|
-
sql: string;
|
|
223
|
-
previewRows?: Record<string, unknown>[];
|
|
224
|
-
warnings: string[];
|
|
225
|
-
}
|
|
226
|
-
export type SeedGenerateResponse = ApiResponse<SeedGenerateResponseData>;
|
|
227
|
-
/** POST /api/tables/:table/seed */
|
|
228
|
-
export interface SeedInsertRequestBody {
|
|
229
|
-
count?: number;
|
|
230
|
-
plan?: Record<string, ColumnPlan>;
|
|
231
|
-
truncate?: boolean;
|
|
232
|
-
}
|
|
233
|
-
export interface SeedInsertResponseData {
|
|
234
|
-
message: string;
|
|
235
|
-
inserted: number;
|
|
236
|
-
skipped: number;
|
|
237
|
-
warnings: string[];
|
|
238
|
-
elapsedMs?: number;
|
|
239
|
-
}
|
|
240
|
-
export type SeedInsertResponse = ApiResponse<SeedInsertResponseData>;
|
|
241
|
-
/** POST /api/tables */
|
|
242
|
-
export interface CreateTableRequestBody {
|
|
243
|
-
name: string;
|
|
244
|
-
columns: ColumnDef[];
|
|
245
|
-
}
|
|
246
|
-
export interface CreateTableResponseData {
|
|
247
|
-
message: string;
|
|
248
|
-
sql: string;
|
|
249
|
-
}
|
|
250
|
-
export type CreateTableResponse = ApiResponse<CreateTableResponseData>;
|
|
251
|
-
/** POST /api/tables/generate */
|
|
252
|
-
export interface GenerateCreateTableRequestBody {
|
|
253
|
-
name: string;
|
|
254
|
-
columns: ColumnDef[];
|
|
255
|
-
}
|
|
256
|
-
export interface GenerateCreateTableResponseData {
|
|
257
|
-
sql: string;
|
|
258
|
-
}
|
|
259
|
-
export type GenerateCreateTableResponse = ApiResponse<GenerateCreateTableResponseData>;
|
|
260
|
-
/** GET /api/tables/:table/schema */
|
|
261
|
-
export type GetSchemaResponseData = SchemaInfo;
|
|
262
|
-
export type GetSchemaResponse = ApiResponse<GetSchemaResponseData>;
|
|
263
|
-
/** POST /api/tables/:table/rename */
|
|
264
|
-
export interface RenameTableRequestBody {
|
|
265
|
-
name: string;
|
|
266
|
-
}
|
|
267
|
-
export interface RenameTableResponseData {
|
|
268
|
-
message: string;
|
|
269
|
-
sql: string;
|
|
270
|
-
table: string;
|
|
271
|
-
}
|
|
272
|
-
export type RenameTableResponse = ApiResponse<RenameTableResponseData>;
|
|
273
|
-
/** POST /api/tables/:table/columns */
|
|
274
|
-
export interface AddColumnRequestBody {
|
|
275
|
-
column: ColumnDef;
|
|
276
|
-
}
|
|
277
|
-
export interface AddColumnResponseData {
|
|
278
|
-
message: string;
|
|
279
|
-
sql: string;
|
|
280
|
-
}
|
|
281
|
-
export type AddColumnResponse = ApiResponse<AddColumnResponseData>;
|
|
282
|
-
/** PUT /api/tables/:table/columns/:column */
|
|
283
|
-
export interface RenameColumnRequestBody {
|
|
284
|
-
name: string;
|
|
285
|
-
}
|
|
286
|
-
export interface RenameColumnResponseData {
|
|
287
|
-
message: string;
|
|
288
|
-
sql: string;
|
|
289
|
-
}
|
|
290
|
-
export type RenameColumnResponse = ApiResponse<RenameColumnResponseData>;
|
|
291
|
-
/** DELETE /api/tables/:table/columns/:column */
|
|
292
|
-
export interface DropColumnResponseData {
|
|
293
|
-
message: string;
|
|
294
|
-
sql: string;
|
|
295
|
-
}
|
|
296
|
-
export type DropColumnResponse = ApiResponse<DropColumnResponseData>;
|
|
297
|
-
/** DELETE /api/tables/:table */
|
|
298
|
-
export interface DropTableResponseData {
|
|
299
|
-
message: string;
|
|
300
|
-
sql: string;
|
|
301
|
-
}
|
|
302
|
-
export type DropTableResponse = ApiResponse<DropTableResponseData>;
|
|
303
|
-
/** POST /api/tables/:table/indexes */
|
|
304
|
-
export interface CreateIndexRequestBody {
|
|
305
|
-
name?: string;
|
|
306
|
-
columns: string[];
|
|
307
|
-
unique?: boolean;
|
|
308
|
-
}
|
|
309
|
-
export interface CreateIndexResponseData {
|
|
310
|
-
message: string;
|
|
311
|
-
sql: string;
|
|
312
|
-
}
|
|
313
|
-
export type CreateIndexResponse = ApiResponse<CreateIndexResponseData>;
|
|
314
|
-
/** DELETE /api/tables/:table/indexes/:index */
|
|
315
|
-
export interface DropIndexResponseData {
|
|
316
|
-
message: string;
|
|
317
|
-
sql: string;
|
|
318
|
-
}
|
|
319
|
-
export type DropIndexResponse = ApiResponse<DropIndexResponseData>;
|
|
320
|
-
/** POST /api/query request */
|
|
321
|
-
export interface ExecuteQueryRequestBody {
|
|
322
|
-
sql: string;
|
|
323
|
-
}
|
|
324
|
-
/** Result when SQL is classified as COUNT */
|
|
325
|
-
export interface QueryCountResult {
|
|
326
|
-
kind: 'count';
|
|
327
|
-
count: number;
|
|
328
|
-
message: string;
|
|
329
|
-
}
|
|
330
|
-
/** Result when SQL is classified as SELECT / READ */
|
|
331
|
-
export interface QuerySelectResult {
|
|
332
|
-
kind: 'select';
|
|
333
|
-
columns: string[];
|
|
334
|
-
rows: Record<string, unknown>[];
|
|
335
|
-
}
|
|
336
|
-
/** Result when SQL is a write statement (INSERT, UPDATE, DELETE, DDL, Script) */
|
|
337
|
-
export interface QueryWriteResult {
|
|
338
|
-
kind: 'write';
|
|
339
|
-
changes: number | null;
|
|
340
|
-
message: string;
|
|
341
|
-
}
|
|
342
|
-
/** Discriminated union of all query results */
|
|
343
|
-
export type ExecuteQueryResponseData = QueryCountResult | QuerySelectResult | QueryWriteResult;
|
|
344
|
-
export type ExecuteQueryResponse = ApiResponse<ExecuteQueryResponseData>;
|
|
345
|
-
/** POST /api/query/export */
|
|
346
|
-
export interface ExportQueryRequestBody {
|
|
347
|
-
sql: string;
|
|
348
|
-
format?: 'csv' | 'json';
|
|
349
|
-
}
|
|
350
|
-
/** GET /api/queries */
|
|
351
|
-
export type ListSavedQueriesResponseData = SavedQuery[];
|
|
352
|
-
export type ListSavedQueriesResponse = ApiResponse<ListSavedQueriesResponseData>;
|
|
353
|
-
/** POST /api/queries */
|
|
354
|
-
export interface SaveQueryRequestBody {
|
|
355
|
-
name: string;
|
|
356
|
-
sql: string;
|
|
357
|
-
}
|
|
358
|
-
export interface SaveQueryResponseData {
|
|
359
|
-
message: string;
|
|
360
|
-
}
|
|
361
|
-
export type SaveQueryResponse = ApiResponse<SaveQueryResponseData>;
|
|
362
|
-
/** DELETE /api/queries/:id */
|
|
363
|
-
export interface DeleteSavedQueryResponseData {
|
|
364
|
-
message: string;
|
|
365
|
-
}
|
|
366
|
-
export type DeleteSavedQueryResponse = ApiResponse<DeleteSavedQueryResponseData>;
|
|
367
|
-
export interface DatabaseRow extends DatabaseEntry {
|
|
368
|
-
sizeLabel: string;
|
|
369
|
-
modifiedLabel: string;
|
|
370
|
-
tables: number;
|
|
371
|
-
}
|
|
372
|
-
/** GET /api/databases */
|
|
373
|
-
export type ListDatabasesResponseData = DatabaseRow[];
|
|
374
|
-
export type ListDatabasesResponse = ApiResponse<ListDatabasesResponseData>;
|
|
375
|
-
/** POST /api/databases */
|
|
376
|
-
export interface CreateDatabaseRequestBody {
|
|
377
|
-
name: string;
|
|
378
|
-
}
|
|
379
|
-
export interface CreateDatabaseResponseData {
|
|
380
|
-
id: string;
|
|
381
|
-
message: string;
|
|
382
|
-
}
|
|
383
|
-
export type CreateDatabaseResponse = ApiResponse<CreateDatabaseResponseData>;
|
|
384
|
-
/** POST /api/databases/open */
|
|
385
|
-
export interface OpenDatabaseRequestBody {
|
|
386
|
-
path: string;
|
|
387
|
-
}
|
|
388
|
-
export interface OpenDatabaseResponseData {
|
|
389
|
-
id: string;
|
|
390
|
-
message: string;
|
|
391
|
-
}
|
|
392
|
-
export type OpenDatabaseResponse = ApiResponse<OpenDatabaseResponseData>;
|
|
393
|
-
/** DELETE /api/databases/:id */
|
|
394
|
-
export interface DeleteDatabaseResponseData {
|
|
395
|
-
message: string;
|
|
396
|
-
}
|
|
397
|
-
export type DeleteDatabaseResponse = ApiResponse<DeleteDatabaseResponseData>;
|
|
398
|
-
export interface FsEntry {
|
|
399
|
-
name: string;
|
|
400
|
-
path: string;
|
|
401
|
-
isDir: boolean;
|
|
402
|
-
isDb: boolean;
|
|
403
|
-
size: number;
|
|
404
|
-
}
|
|
405
|
-
/** GET /api/fs/list */
|
|
406
|
-
export interface ListFsResponseData {
|
|
407
|
-
path: string;
|
|
408
|
-
name: string;
|
|
409
|
-
parent: string | null;
|
|
410
|
-
entries: FsEntry[];
|
|
411
|
-
}
|
|
412
|
-
export type ListFsResponse = ApiResponse<ListFsResponseData>;
|
|
1
|
+
import type {ColumnInfo,ForeignKeyInfo,IndexInfo,SavedQuery,SchemaInfo,TableInfoData,TableListItem,WhereClause,RowFilters} from '../db/database';import type {DatabaseEntry} from '../db/manager';import type {ColumnDef,IndexDef} from '../sql/generator';import type {ColumnGeneratorConfig,ColumnPlan,GeneratorStrategyId,StrategyDescriptor,StrategyCategory} from '../data/index';export type {ColumnInfo,ForeignKeyInfo,IndexInfo,SavedQuery,SchemaInfo,TableInfoData,TableListItem,WhereClause,RowFilters,ColumnDef,IndexDef,ColumnGeneratorConfig,ColumnPlan,GeneratorStrategyId,StrategyDescriptor,StrategyCategory,};export interface ApiSuccessResponse<T=unknown>{success:true;data:T;}export interface ApiErrorResponse<T=unknown>{success:false;error:string;data?:T;}export type ApiResponse<T=unknown>=ApiSuccessResponse<T>|ApiErrorResponse<T>;export type ListTablesResponseData=TableListItem[];export type ListTablesResponse=ApiResponse<ListTablesResponseData>;export type TableInfoResponseData=TableInfoData;export type TableInfoResponse=ApiResponse<TableInfoResponseData>;export type FkOptionsResponseData=Record<string,{value:unknown;label:string;}[]>;export type FkOptionsResponse=ApiResponse<FkOptionsResponseData>;export interface GetRowsResponseData{rows:Record<string,unknown>[];count:number;page:number;limit:number;filters:RowFilters;}export type GetRowsResponse=ApiResponse<GetRowsResponseData>;export type GetRowResponseData=Record<string,unknown>;export type GetRowResponse=ApiResponse<GetRowResponseData>;export interface RowReferenceGroup{table:string; from :string;to:string;value:unknown;count:number;columns:string[];rows:Record<string,unknown>[];}export interface GetRowReferencesResponseData{references:RowReferenceGroup[];}export type GetRowReferencesResponse=ApiResponse<GetRowReferencesResponseData>;export interface InsertRowRequestBody{values:Record<string,unknown>;}export interface InsertRowResponseData{message:string;rowId?:number|bigint;sql:string;}export type InsertRowResponse=ApiResponse<InsertRowResponseData>;export interface GenerateInsertRequestBody{values:Record<string,unknown>;}export interface GenerateInsertResponseData{sql:string;}export type GenerateInsertResponse=ApiResponse<GenerateInsertResponseData>;export interface ImportCsvRequestBody{csv:string;}export interface ImportCsvResponseData{message:string;inserted?:number;skipped?:number;}export type ImportCsvResponse=ApiResponse<ImportCsvResponseData>;export interface UpdateRowRequestBody{values:Record<string,unknown>;nulls?:string[];}export interface UpdateRowResponseData{message:string;sql:string;}export type UpdateRowResponse=ApiResponse<UpdateRowResponseData>;export interface GenerateUpdateRequestBody{values:Record<string,unknown>;nulls?:string[];}export interface GenerateUpdateResponseData{sql:string;}export type GenerateUpdateResponse=ApiResponse<GenerateUpdateResponseData>;export interface DeleteRowResponseData{message:string;}export type DeleteRowResponse=ApiResponse<DeleteRowResponseData>;export interface BlobMetaResponseData{isNull:boolean;mime?:string;ext?:string;isImage?:boolean;isText?:boolean;isPdf?:boolean;isAudio?:boolean;isVideo?:boolean;size:number;sizeFormatted:string;hexDump?:{lines:{offset:string;hex:string;ascii:string;}[];totalBytes:number;truncated:boolean;};textPreview?:string|null;}export type BlobMetaResponse=ApiResponse<BlobMetaResponseData>;export interface UpdateBlobRequestBody{data:string;format?:'base64'|'hex'|'text';}export interface UpdateBlobResponseData{message:string;size:number;}export type UpdateBlobResponse=ApiResponse<UpdateBlobResponseData>;export interface TableDdlResponseData{table:string;ddl:string;}export type TableDdlResponse=ApiResponse<TableDdlResponseData>;export interface BulkImpactRequestBody{ids:(string|number)[];}export interface BulkImpactReference{table:string; from :string;to:string;count:number;}export interface BulkImpactResponseData{selected:number;references:BulkImpactReference[];total:number;}export type BulkImpactResponse=ApiResponse<BulkImpactResponseData>;export interface BulkDeleteRequestBody{ids:(string|number)[];confirmImpact?:boolean;}export interface BulkDeleteResponseData{message:string;deleted:number;}export type BulkDeleteResponse=ApiResponse<BulkDeleteResponseData>;export interface BulkExportRequestBody{ids:(string|number)[];format?:'csv'|'json';}export interface BulkExportResponseData{format:string;filename:string;content:string;rowCount:number;}export type BulkExportResponse=ApiResponse<BulkExportResponseData>;export interface BulkUpdateItem{id:string|number;values?:Record<string,unknown>;nulls?:string[];}export interface BulkUpdateRequestBody{updates:BulkUpdateItem[];}export interface BulkUpdateResponseData{message:string;updated:number;}export type BulkUpdateResponse=ApiResponse<BulkUpdateResponseData>;export interface SeedConfigResponseData{table:string;columns:ColumnGeneratorConfig[];maxRows:number;}export type SeedConfigResponse=ApiResponse<SeedConfigResponseData>;export interface SeedGenerateRequestBody{count?:number;plan?:Record<string,ColumnPlan>;}export interface SeedGenerateResponseData{table:string;count:number;sql:string;previewRows?:Record<string,unknown>[];warnings:string[];}export type SeedGenerateResponse=ApiResponse<SeedGenerateResponseData>;export interface SeedInsertRequestBody{count?:number;plan?:Record<string,ColumnPlan>;truncate?:boolean;}export interface SeedInsertResponseData{message:string;inserted:number;skipped:number;warnings:string[];elapsedMs?:number;}export type SeedInsertResponse=ApiResponse<SeedInsertResponseData>;export interface CreateTableRequestBody{name:string;columns:ColumnDef[];}export interface CreateTableResponseData{message:string;sql:string;}export type CreateTableResponse=ApiResponse<CreateTableResponseData>;export interface GenerateCreateTableRequestBody{name:string;columns:ColumnDef[];}export interface GenerateCreateTableResponseData{sql:string;}export type GenerateCreateTableResponse=ApiResponse<GenerateCreateTableResponseData>;export type GetSchemaResponseData=SchemaInfo;export type GetSchemaResponse=ApiResponse<GetSchemaResponseData>;export interface RenameTableRequestBody{name:string;}export interface RenameTableResponseData{message:string;sql:string;table:string;}export type RenameTableResponse=ApiResponse<RenameTableResponseData>;export interface AddColumnRequestBody{column:ColumnDef;}export interface AddColumnResponseData{message:string;sql:string;}export type AddColumnResponse=ApiResponse<AddColumnResponseData>;export interface RenameColumnRequestBody{name:string;}export interface RenameColumnResponseData{message:string;sql:string;}export type RenameColumnResponse=ApiResponse<RenameColumnResponseData>;export interface DropColumnResponseData{message:string;sql:string;}export type DropColumnResponse=ApiResponse<DropColumnResponseData>;export interface DropTableResponseData{message:string;sql:string;}export type DropTableResponse=ApiResponse<DropTableResponseData>;export interface CreateIndexRequestBody{name?:string;columns:string[];unique?:boolean;}export interface CreateIndexResponseData{message:string;sql:string;}export type CreateIndexResponse=ApiResponse<CreateIndexResponseData>;export interface DropIndexResponseData{message:string;sql:string;}export type DropIndexResponse=ApiResponse<DropIndexResponseData>;export interface ExecuteQueryRequestBody{sql:string;}export interface QueryCountResult{kind:'count';count:number;message:string;}export interface QuerySelectResult{kind:'select';columns:string[];rows:Record<string,unknown>[];}export interface QueryWriteResult{kind:'write';changes:number|null;message:string;}export type ExecuteQueryResponseData=QueryCountResult|QuerySelectResult|QueryWriteResult;export type ExecuteQueryResponse=ApiResponse<ExecuteQueryResponseData>;export interface ExportQueryRequestBody{sql:string;format?:'csv'|'json';}export type ListSavedQueriesResponseData=SavedQuery[];export type ListSavedQueriesResponse=ApiResponse<ListSavedQueriesResponseData>;export interface SaveQueryRequestBody{name:string;sql:string;}export interface SaveQueryResponseData{message:string;}export type SaveQueryResponse=ApiResponse<SaveQueryResponseData>;export interface DeleteSavedQueryResponseData{message:string;}export type DeleteSavedQueryResponse=ApiResponse<DeleteSavedQueryResponseData>;export interface DatabaseRow extends DatabaseEntry{sizeLabel:string;modifiedLabel:string;tables:number;}export type ListDatabasesResponseData=DatabaseRow[];export type ListDatabasesResponse=ApiResponse<ListDatabasesResponseData>;export interface CreateDatabaseRequestBody{name:string;}export interface CreateDatabaseResponseData{id:string;message:string;}export type CreateDatabaseResponse=ApiResponse<CreateDatabaseResponseData>;export interface OpenDatabaseRequestBody{path:string;}export interface OpenDatabaseResponseData{id:string;message:string;}export type OpenDatabaseResponse=ApiResponse<OpenDatabaseResponseData>;export interface DeleteDatabaseResponseData{message:string;}export type DeleteDatabaseResponse=ApiResponse<DeleteDatabaseResponseData>;export interface FsEntry{name:string;path:string;isDir:boolean;isDb:boolean;size:number;}export interface ListFsResponseData{path:string;name:string;parent:string|null;entries:FsEntry[];}export type ListFsResponse=ApiResponse<ListFsResponseData>;
|
package/dist/types/api.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AdminDB — Strongly typed API request and response interfaces.
|
|
4
|
-
*
|
|
5
|
-
* Every REST API endpoint returns a standardized envelope:
|
|
6
|
-
* `{ success: true, data: T }` on success, or `{ success: false, error: string }` on failure.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=api.js.map
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Lightweight ANSI color utility with zero runtime dependencies.
|
|
3
|
-
*
|
|
4
|
-
* Supports detection of terminal color capabilities via `process.stdout.isTTY`,
|
|
5
|
-
* `FORCE_COLOR`, `NO_COLOR`, and CI environments.
|
|
6
|
-
*/
|
|
7
|
-
export declare function supportsColor(): boolean;
|
|
8
|
-
export declare const c: {
|
|
9
|
-
reset: (str: unknown) => string;
|
|
10
|
-
bold: (str: unknown) => string;
|
|
11
|
-
dim: (str: unknown) => string;
|
|
12
|
-
italic: (str: unknown) => string;
|
|
13
|
-
underline: (str: unknown) => string;
|
|
14
|
-
inverse: (str: unknown) => string;
|
|
15
|
-
black: (str: unknown) => string;
|
|
16
|
-
red: (str: unknown) => string;
|
|
17
|
-
green: (str: unknown) => string;
|
|
18
|
-
yellow: (str: unknown) => string;
|
|
19
|
-
blue: (str: unknown) => string;
|
|
20
|
-
magenta: (str: unknown) => string;
|
|
21
|
-
cyan: (str: unknown) => string;
|
|
22
|
-
white: (str: unknown) => string;
|
|
23
|
-
gray: (str: unknown) => string;
|
|
24
|
-
brightRed: (str: unknown) => string;
|
|
25
|
-
brightGreen: (str: unknown) => string;
|
|
26
|
-
brightYellow: (str: unknown) => string;
|
|
27
|
-
brightBlue: (str: unknown) => string;
|
|
28
|
-
brightMagenta: (str: unknown) => string;
|
|
29
|
-
brightCyan: (str: unknown) => string;
|
|
30
|
-
brightWhite: (str: unknown) => string;
|
|
31
|
-
bgBlack: (str: unknown) => string;
|
|
32
|
-
bgRed: (str: unknown) => string;
|
|
33
|
-
bgGreen: (str: unknown) => string;
|
|
34
|
-
bgYellow: (str: unknown) => string;
|
|
35
|
-
bgBlue: (str: unknown) => string;
|
|
36
|
-
bgMagenta: (str: unknown) => string;
|
|
37
|
-
bgCyan: (str: unknown) => string;
|
|
38
|
-
bgWhite: (str: unknown) => string;
|
|
39
|
-
bgGray: (str: unknown) => string;
|
|
40
|
-
};
|
|
1
|
+
export declare function supportsColor():boolean;export declare const c:{reset:(str:unknown)=>string;bold:(str:unknown)=>string;dim:(str:unknown)=>string;italic:(str:unknown)=>string;underline:(str:unknown)=>string;inverse:(str:unknown)=>string;black:(str:unknown)=>string;red:(str:unknown)=>string;green:(str:unknown)=>string;yellow:(str:unknown)=>string;blue:(str:unknown)=>string;magenta:(str:unknown)=>string;cyan:(str:unknown)=>string;white:(str:unknown)=>string;gray:(str:unknown)=>string;brightRed:(str:unknown)=>string;brightGreen:(str:unknown)=>string;brightYellow:(str:unknown)=>string;brightBlue:(str:unknown)=>string;brightMagenta:(str:unknown)=>string;brightCyan:(str:unknown)=>string;brightWhite:(str:unknown)=>string;bgBlack:(str:unknown)=>string;bgRed:(str:unknown)=>string;bgGreen:(str:unknown)=>string;bgYellow:(str:unknown)=>string;bgBlue:(str:unknown)=>string;bgMagenta:(str:unknown)=>string;bgCyan:(str:unknown)=>string;bgWhite:(str:unknown)=>string;bgGray:(str:unknown)=>string;};
|
package/dist/utils/colors.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Lightweight ANSI color utility with zero runtime dependencies.
|
|
4
|
-
*
|
|
5
|
-
* Supports detection of terminal color capabilities via `process.stdout.isTTY`,
|
|
6
|
-
* `FORCE_COLOR`, `NO_COLOR`, and CI environments.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.c = void 0;
|
|
10
4
|
exports.supportsColor = supportsColor;
|
|
@@ -32,7 +26,6 @@ exports.c = {
|
|
|
32
26
|
italic: wrap('\x1b[3m', '\x1b[23m'),
|
|
33
27
|
underline: wrap('\x1b[4m', '\x1b[24m'),
|
|
34
28
|
inverse: wrap('\x1b[7m', '\x1b[27m'),
|
|
35
|
-
// Foreground colors
|
|
36
29
|
black: wrap('\x1b[30m', '\x1b[39m'),
|
|
37
30
|
red: wrap('\x1b[31m', '\x1b[39m'),
|
|
38
31
|
green: wrap('\x1b[32m', '\x1b[39m'),
|
|
@@ -42,7 +35,6 @@ exports.c = {
|
|
|
42
35
|
cyan: wrap('\x1b[36m', '\x1b[39m'),
|
|
43
36
|
white: wrap('\x1b[37m', '\x1b[39m'),
|
|
44
37
|
gray: wrap('\x1b[90m', '\x1b[39m'),
|
|
45
|
-
// Bright foregrounds
|
|
46
38
|
brightRed: wrap('\x1b[91m', '\x1b[39m'),
|
|
47
39
|
brightGreen: wrap('\x1b[92m', '\x1b[39m'),
|
|
48
40
|
brightYellow: wrap('\x1b[93m', '\x1b[39m'),
|
|
@@ -50,7 +42,6 @@ exports.c = {
|
|
|
50
42
|
brightMagenta: wrap('\x1b[95m', '\x1b[39m'),
|
|
51
43
|
brightCyan: wrap('\x1b[96m', '\x1b[39m'),
|
|
52
44
|
brightWhite: wrap('\x1b[97m', '\x1b[39m'),
|
|
53
|
-
// Background colors
|
|
54
45
|
bgBlack: wrap('\x1b[40m', '\x1b[49m'),
|
|
55
46
|
bgRed: wrap('\x1b[41m', '\x1b[49m'),
|
|
56
47
|
bgGreen: wrap('\x1b[42m', '\x1b[49m'),
|
|
@@ -61,4 +52,3 @@ exports.c = {
|
|
|
61
52
|
bgWhite: wrap('\x1b[47m', '\x1b[49m'),
|
|
62
53
|
bgGray: wrap('\x1b[100m', '\x1b[49m'),
|
|
63
54
|
};
|
|
64
|
-
//# sourceMappingURL=colors.js.map
|