@graphoria/server 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/config/types/db.d.ts +89 -0
- package/dist/src/config/types/db.d.ts.map +1 -1
- package/dist/src/config/types/index.d.ts +2 -2
- package/dist/src/config/types/index.d.ts.map +1 -1
- package/dist/src/configuration/getSchemas/index.d.ts +48 -0
- package/dist/src/configuration/getSchemas/index.d.ts.map +1 -1
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts +24 -0
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts.map +1 -1
- package/dist/src/configuration/index.d.ts +36 -0
- package/dist/src/configuration/index.d.ts.map +1 -1
- package/dist/src/databases/common.d.ts.map +1 -1
- package/dist/src/databases/core/query-builder.d.ts +6 -0
- package/dist/src/databases/core/query-builder.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/getStructure.d.ts +7 -0
- package/dist/src/databases/engines/mssql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/getStructure.d.ts +7 -0
- package/dist/src/databases/engines/mysql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/getStructure.d.ts +7 -0
- package/dist/src/databases/engines/postgresql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/high-level-operations.d.ts +13 -0
- package/dist/src/databases/high-level-operations.d.ts.map +1 -1
- package/dist/src/databases/metadata/structure.d.ts +7 -0
- package/dist/src/databases/metadata/structure.d.ts.map +1 -1
- package/dist/src/databases/transformers/data-transformers.d.ts +37 -0
- package/dist/src/databases/transformers/data-transformers.d.ts.map +1 -1
- package/dist/src/singletons/env.d.ts +18 -0
- package/dist/src/singletons/env.d.ts.map +1 -1
- package/dist/src/types/configuration.d.ts +1 -1
- package/dist/src/types/configuration.d.ts.map +1 -1
- package/dist/src/types/env.d.ts +76 -0
- package/dist/src/types/env.d.ts.map +1 -1
- package/dist/src/types/zod/configuration.d.ts +40 -0
- package/dist/src/types/zod/configuration.d.ts.map +1 -1
- package/dist/src/types/zod/db.d.ts +159 -0
- package/dist/src/types/zod/db.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/config/types/db.ts +47 -0
- package/src/config/types/index.ts +3 -0
- package/src/configuration/index.ts +8 -1
- package/src/databases/common.ts +128 -18
- package/src/databases/engines/mssql/getStructure.ts +1 -0
- package/src/databases/engines/mysql/getStructure.ts +1 -0
- package/src/databases/engines/postgresql/getStructure.ts +1 -0
- package/src/databases/high-level-operations.ts +25 -0
- package/src/types/configuration.ts +7 -1
- package/src/types/zod/db.ts +4 -0
- package/dist/src/console/App.d.ts +0 -3
- package/dist/src/console/App.d.ts.map +0 -1
- package/dist/src/console/Login.d.ts +0 -6
- package/dist/src/console/Login.d.ts.map +0 -1
- package/dist/src/console/client.d.ts +0 -67
- package/dist/src/console/client.d.ts.map +0 -1
- package/dist/src/console/frontend.d.ts +0 -8
- package/dist/src/console/frontend.d.ts.map +0 -1
- package/dist/src/console/pages/ConfigPage.d.ts +0 -2
- package/dist/src/console/pages/ConfigPage.d.ts.map +0 -1
- package/dist/src/console/pages/RolesPage.d.ts +0 -2
- package/dist/src/console/pages/RolesPage.d.ts.map +0 -1
- package/dist/src/console/pages/StatusPage.d.ts +0 -2
- package/dist/src/console/pages/StatusPage.d.ts.map +0 -1
- package/dist/src/console/pages/TablesPage.d.ts +0 -2
- package/dist/src/console/pages/TablesPage.d.ts.map +0 -1
- package/dist/src/console/useApi.d.ts +0 -8
- package/dist/src/console/useApi.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphoria/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Auto-generated GraphQL and REST APIs from database schema - Connect your database to modern APIs instantly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-generated",
|
|
@@ -116,4 +116,4 @@
|
|
|
116
116
|
"engines": {
|
|
117
117
|
"bun": ">=1.3.4"
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|
package/src/config/types/db.ts
CHANGED
|
@@ -18,6 +18,51 @@ import { VirtualColumnZod } from "./virtual-columns";
|
|
|
18
18
|
|
|
19
19
|
export type DatabaseType = "mssql" | "pg" | "mysql";
|
|
20
20
|
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Relationship Join Condition (static-value predicate)
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
/** Comparison operators allowed in a static relationship join condition. */
|
|
26
|
+
export const RELATIONSHIP_CONDITION_OPERATORS = [
|
|
27
|
+
"eq",
|
|
28
|
+
"neq",
|
|
29
|
+
"gt",
|
|
30
|
+
"gte",
|
|
31
|
+
"lt",
|
|
32
|
+
"lte",
|
|
33
|
+
"like",
|
|
34
|
+
"is_null",
|
|
35
|
+
"is_not_null",
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A static-value predicate added to a relationship's JOIN. Targets exactly one
|
|
40
|
+
* side of the relationship — `source` (a column on the declaring table) or
|
|
41
|
+
* `target` (a column on the referenced table) — and compares it to a literal.
|
|
42
|
+
* A `value` is required for every operator except `is_null` / `is_not_null`.
|
|
43
|
+
*/
|
|
44
|
+
export const RelationshipConditionZod = z
|
|
45
|
+
.object({
|
|
46
|
+
/** Column on the declaring (source) table */
|
|
47
|
+
source: z.string().optional(),
|
|
48
|
+
/** Column on the referenced (target) table */
|
|
49
|
+
target: z.string().optional(),
|
|
50
|
+
/** Comparison operator (default `eq`) */
|
|
51
|
+
operator: z.enum(RELATIONSHIP_CONDITION_OPERATORS).optional().default("eq"),
|
|
52
|
+
/** Literal compared against the column (omit for `is_null` / `is_not_null`) */
|
|
53
|
+
value: z.union([z.string(), z.number(), z.boolean()]).optional(),
|
|
54
|
+
})
|
|
55
|
+
.refine((cond) => (cond.source === undefined) !== (cond.target === undefined), {
|
|
56
|
+
message: 'Relationship condition must set exactly one of "source" or "target"',
|
|
57
|
+
})
|
|
58
|
+
.refine(
|
|
59
|
+
(cond) =>
|
|
60
|
+
cond.operator === "is_null" || cond.operator === "is_not_null" || cond.value !== undefined,
|
|
61
|
+
{ message: 'Relationship condition requires a "value" unless operator is is_null/is_not_null' },
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export type RelationshipCondition = z.input<typeof RelationshipConditionZod>;
|
|
65
|
+
|
|
21
66
|
// ============================================================================
|
|
22
67
|
// Table Relationship (config shape, no transform)
|
|
23
68
|
// ============================================================================
|
|
@@ -26,6 +71,8 @@ export const TableRelationshipZod = z.object({
|
|
|
26
71
|
schema: z.string(),
|
|
27
72
|
name: z.string(),
|
|
28
73
|
columns: z.array(z.object({ source: z.string(), target: z.string() })),
|
|
74
|
+
/** Static-value predicates ANDed into the JOIN condition */
|
|
75
|
+
conditions: z.array(RelationshipConditionZod).optional(),
|
|
29
76
|
});
|
|
30
77
|
|
|
31
78
|
export type TableRelationship = z.input<typeof TableRelationshipZod>;
|
|
@@ -104,6 +104,7 @@ export type {
|
|
|
104
104
|
DatabaseType,
|
|
105
105
|
DatabaseConnection,
|
|
106
106
|
TableRelationship,
|
|
107
|
+
RelationshipCondition,
|
|
107
108
|
TableSchemaConfig,
|
|
108
109
|
DatabaseSchemaConfig,
|
|
109
110
|
CustomRepositoryFactory,
|
|
@@ -117,6 +118,8 @@ export type {
|
|
|
117
118
|
|
|
118
119
|
export {
|
|
119
120
|
TableRelationshipZod,
|
|
121
|
+
RelationshipConditionZod,
|
|
122
|
+
RELATIONSHIP_CONDITION_OPERATORS,
|
|
120
123
|
TableSchemaConfigZod,
|
|
121
124
|
DatabaseSchemaConfigZod,
|
|
122
125
|
BunSQLConnectionOptionsZod,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from "path";
|
|
2
|
+
|
|
1
3
|
import { isFunction, isPlainObject } from "es-toolkit";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
|
|
@@ -22,8 +24,13 @@ import { generateOpenAPI } from "./rest/generateOpenAPI";
|
|
|
22
24
|
|
|
23
25
|
export const loadConfiguration = async (config: string): Promise<Configuration> => {
|
|
24
26
|
try {
|
|
27
|
+
// A dynamic import() with a relative specifier resolves against this module,
|
|
28
|
+
// not the project root. Resolve relative paths against the process cwd (the
|
|
29
|
+
// project root) so CONFIGURATION="graphoria.ts" works like an absolute path.
|
|
30
|
+
const configPath = isAbsolute(config) ? config : resolve(process.cwd(), config);
|
|
31
|
+
|
|
25
32
|
// Dynamic import of the TypeScript file
|
|
26
|
-
const configModule = await import(
|
|
33
|
+
const configModule = await import(configPath);
|
|
27
34
|
|
|
28
35
|
if (isFunction(configModule?.default)) {
|
|
29
36
|
return configModule.default({
|
package/src/databases/common.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { isBoolean, isString } from "es-toolkit/compat";
|
|
|
2
2
|
|
|
3
3
|
import type { SelectionAnalysis, VariableDefinition } from "../analyzeQuery/types";
|
|
4
4
|
import type { MergedEntities } from "../configuration/getSchemas/mergeEntities";
|
|
5
|
-
import type { DatabaseType, VirtualColumn } from "../types/configuration";
|
|
5
|
+
import type { DatabaseType, RelationshipCondition, VirtualColumn } from "../types/configuration";
|
|
6
6
|
|
|
7
7
|
import { applyDirectives } from "./directives";
|
|
8
8
|
|
|
@@ -191,21 +191,121 @@ const buildCondition = (
|
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
+
const COLLATION_NAME_RE = /^[A-Za-z0-9_]+$/;
|
|
195
|
+
|
|
196
|
+
// Equating two character columns with different collations raises a hard error (SQL Server:
|
|
197
|
+
// "cannot resolve the collation conflict"; MySQL: "illegal mix of collations"). Coerce the right
|
|
198
|
+
// operand to a shared collation, but only when both columns carry one and the two differ: a null
|
|
199
|
+
// collation marks a non-character column, where COLLATE is itself illegal. Matching or unknown
|
|
200
|
+
// collations leave the equality byte-for-byte unchanged (and keep the join column SARGable).
|
|
201
|
+
const collateSuffix = (
|
|
202
|
+
dbType: DatabaseType,
|
|
203
|
+
parentCollation: string | null | undefined,
|
|
204
|
+
childCollation: string | null | undefined,
|
|
205
|
+
): string => {
|
|
206
|
+
if (!parentCollation || !childCollation || parentCollation === childCollation) return "";
|
|
207
|
+
|
|
208
|
+
if (dbType === "mssql") return " COLLATE DATABASE_DEFAULT";
|
|
209
|
+
if (dbType === "pg") return ` COLLATE "default"`;
|
|
210
|
+
// MySQL has no database-default token; coerce to the left column's own collation name.
|
|
211
|
+
return COLLATION_NAME_RE.test(parentCollation) ? ` COLLATE ${parentCollation}` : "";
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const columnCollation = (
|
|
215
|
+
entities: MergedEntities,
|
|
216
|
+
tableName: string,
|
|
217
|
+
columnName: string,
|
|
218
|
+
): string | null | undefined => {
|
|
219
|
+
const column = entities.queriesMap[tableName]?.columns.find((c) => c.name === columnName);
|
|
220
|
+
return column && "collation" in column ? column.collation : undefined;
|
|
221
|
+
};
|
|
222
|
+
|
|
194
223
|
const pairsToAnd = (
|
|
195
224
|
pairs: {
|
|
196
225
|
parentAlias: string;
|
|
197
226
|
childAlias: string;
|
|
198
227
|
parentColumn: string;
|
|
199
228
|
childColumn: string;
|
|
229
|
+
parentCollation?: string | null;
|
|
230
|
+
childCollation?: string | null;
|
|
200
231
|
}[],
|
|
201
232
|
dbType: DatabaseType,
|
|
202
233
|
) => {
|
|
203
234
|
const wrap = wrapIdentifierFp(dbType);
|
|
204
235
|
return pairs
|
|
205
|
-
.map(
|
|
236
|
+
.map(
|
|
237
|
+
(p) =>
|
|
238
|
+
`${p.parentAlias}.${wrap(p.parentColumn)} = ${p.childAlias}.${wrap(p.childColumn)}${collateSuffix(dbType, p.parentCollation, p.childCollation)}`,
|
|
239
|
+
)
|
|
206
240
|
.join(" AND ");
|
|
207
241
|
};
|
|
208
242
|
|
|
243
|
+
const RELATIONSHIP_CONDITION_SQL_OPERATORS: Record<string, string> = {
|
|
244
|
+
eq: "=",
|
|
245
|
+
neq: "<>",
|
|
246
|
+
gt: ">",
|
|
247
|
+
gte: ">=",
|
|
248
|
+
lt: "<",
|
|
249
|
+
lte: "<=",
|
|
250
|
+
like: "LIKE",
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// Static join-condition values are literals (never bound as params at this layer),
|
|
254
|
+
// so render them safely: escape quotes in strings, reject non-finite numbers, and
|
|
255
|
+
// emit dialect-correct booleans (MSSQL has no boolean type — compare against 1/0).
|
|
256
|
+
const sqlLiteral = (dbType: DatabaseType, value: string | number | boolean): string => {
|
|
257
|
+
if (typeof value === "number") {
|
|
258
|
+
if (!Number.isFinite(value)) {
|
|
259
|
+
throw new Error(`Relationship condition value must be a finite number, got ${value}`);
|
|
260
|
+
}
|
|
261
|
+
return String(value);
|
|
262
|
+
}
|
|
263
|
+
if (typeof value === "boolean") {
|
|
264
|
+
if (dbType === "mssql") return value ? "1" : "0";
|
|
265
|
+
return value ? "TRUE" : "FALSE";
|
|
266
|
+
}
|
|
267
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const renderCondition = (
|
|
271
|
+
dbType: DatabaseType,
|
|
272
|
+
alias: string,
|
|
273
|
+
column: string,
|
|
274
|
+
operator: string,
|
|
275
|
+
value: string | number | boolean | undefined,
|
|
276
|
+
): string => {
|
|
277
|
+
const target = `${alias}.${wrapIdentifierFp(dbType)(column)}`;
|
|
278
|
+
|
|
279
|
+
if (operator === "is_null") return `${target} IS NULL`;
|
|
280
|
+
if (operator === "is_not_null") return `${target} IS NOT NULL`;
|
|
281
|
+
|
|
282
|
+
const sqlOperator = RELATIONSHIP_CONDITION_SQL_OPERATORS[operator];
|
|
283
|
+
if (!sqlOperator || value === undefined) {
|
|
284
|
+
throw new Error(`Invalid relationship condition operator "${operator}"`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return `${target} ${sqlOperator} ${sqlLiteral(dbType, value)}`;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
// A condition targets exactly one side of the relationship: `source` (a column on
|
|
291
|
+
// the declaring table → fromAlias) or `target` (a column on the referenced table →
|
|
292
|
+
// toAlias). The from/to aliases flip between forward and reverse joins.
|
|
293
|
+
const conditionsToAnd = (
|
|
294
|
+
conditions: readonly RelationshipCondition[] | undefined,
|
|
295
|
+
fromAlias: string,
|
|
296
|
+
toAlias: string,
|
|
297
|
+
dbType: DatabaseType,
|
|
298
|
+
): string =>
|
|
299
|
+
(conditions ?? [])
|
|
300
|
+
.map((c) =>
|
|
301
|
+
c.source !== undefined
|
|
302
|
+
? renderCondition(dbType, fromAlias, c.source, c.operator ?? "eq", c.value)
|
|
303
|
+
: renderCondition(dbType, toAlias, c.target!, c.operator ?? "eq", c.value),
|
|
304
|
+
)
|
|
305
|
+
.join(" AND ");
|
|
306
|
+
|
|
307
|
+
const joinParts = (...parts: string[]): string => parts.filter(Boolean).join(" AND ");
|
|
308
|
+
|
|
209
309
|
export const findJoinCondition = (
|
|
210
310
|
entities: MergedEntities,
|
|
211
311
|
parentTableName: string,
|
|
@@ -220,25 +320,35 @@ export const findJoinCondition = (
|
|
|
220
320
|
|
|
221
321
|
return [
|
|
222
322
|
...(relations.relationships?.map((relation) =>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
323
|
+
joinParts(
|
|
324
|
+
pairsToAnd(
|
|
325
|
+
relation.columns.map((c) => ({
|
|
326
|
+
parentAlias,
|
|
327
|
+
childAlias,
|
|
328
|
+
parentColumn: c.source,
|
|
329
|
+
childColumn: c.target,
|
|
330
|
+
parentCollation: columnCollation(entities, parentTableName, c.source),
|
|
331
|
+
childCollation: columnCollation(entities, childTableName, c.target),
|
|
332
|
+
})),
|
|
333
|
+
dbType,
|
|
334
|
+
),
|
|
335
|
+
conditionsToAnd(relation.conditions, parentAlias, childAlias, dbType),
|
|
231
336
|
),
|
|
232
337
|
) ?? []),
|
|
233
338
|
...(relations.relationshipsReversed?.map((relation) =>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
339
|
+
joinParts(
|
|
340
|
+
pairsToAnd(
|
|
341
|
+
relation.columns.map((c) => ({
|
|
342
|
+
parentAlias,
|
|
343
|
+
childAlias,
|
|
344
|
+
parentColumn: c.target,
|
|
345
|
+
childColumn: c.source,
|
|
346
|
+
parentCollation: columnCollation(entities, parentTableName, c.target),
|
|
347
|
+
childCollation: columnCollation(entities, childTableName, c.source),
|
|
348
|
+
})),
|
|
349
|
+
dbType,
|
|
350
|
+
),
|
|
351
|
+
conditionsToAnd(relation.conditions, childAlias, parentAlias, dbType),
|
|
242
352
|
),
|
|
243
353
|
) ?? []),
|
|
244
354
|
].join(" AND ");
|
|
@@ -26,6 +26,7 @@ export const getDatabaseStructure = async (db: Database) => {
|
|
|
26
26
|
c.COLUMN_NAME AS name,
|
|
27
27
|
c.DATA_TYPE AS dataType,
|
|
28
28
|
CAST(CASE WHEN c.IS_NULLABLE = 'YES' THEN 1 ELSE 0 END AS bit) AS isNullable,
|
|
29
|
+
c.COLLATION_NAME AS collation,
|
|
29
30
|
(
|
|
30
31
|
SELECT CAST(value AS NVARCHAR(MAX))
|
|
31
32
|
FROM sys.extended_properties ep
|
|
@@ -70,6 +70,7 @@ export const getDatabaseStructure = async (db: Database) => {
|
|
|
70
70
|
'name', isc.column_name,
|
|
71
71
|
'dataType', isc.data_type,
|
|
72
72
|
'isNullable', CASE WHEN isc.is_nullable = 'YES' THEN true ELSE false END,
|
|
73
|
+
'collation', isc.collation_name,
|
|
73
74
|
'description', NULL
|
|
74
75
|
) ORDER BY isc.ordinal_position SEPARATOR ','), ']') AS JSON),
|
|
75
76
|
JSON_ARRAY()
|
|
@@ -105,6 +105,31 @@ export const getDatabasesStructure = async (
|
|
|
105
105
|
target: target.name,
|
|
106
106
|
};
|
|
107
107
|
}),
|
|
108
|
+
conditions: (fk.conditions ?? []).map((cond) => {
|
|
109
|
+
if (cond.source !== undefined) {
|
|
110
|
+
const sourceColumn = t.columns.find(
|
|
111
|
+
(col) => col.name.toLowerCase() === cond.source!.toLowerCase(),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (!sourceColumn) {
|
|
115
|
+
throw new Error(`Condition column ${cond.source} not found in table ${t.name}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return { ...cond, source: sourceColumn.name };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const targetColumn = toTable.columns.find(
|
|
122
|
+
(col) => col.name.toLowerCase() === cond.target!.toLowerCase(),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
if (!targetColumn) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`Condition column ${cond.target} not found in table ${toTable.name}`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return { ...cond, target: targetColumn.name };
|
|
132
|
+
}),
|
|
108
133
|
};
|
|
109
134
|
});
|
|
110
135
|
|
|
@@ -4,7 +4,13 @@ import type { FilterCondition, OrderByClause } from "../config";
|
|
|
4
4
|
import type { ConfigurationZod } from "./zod/configuration";
|
|
5
5
|
|
|
6
6
|
// Re-export base types from the config module
|
|
7
|
-
export type {
|
|
7
|
+
export type {
|
|
8
|
+
DirectionUnion,
|
|
9
|
+
FilterCondition,
|
|
10
|
+
OrderByClause,
|
|
11
|
+
RelationshipCondition,
|
|
12
|
+
VirtualColumnType,
|
|
13
|
+
} from "../config";
|
|
8
14
|
|
|
9
15
|
export type Configuration = z.infer<typeof ConfigurationZod>;
|
|
10
16
|
|
package/src/types/zod/db.ts
CHANGED
|
@@ -38,6 +38,7 @@ export const TableColumnZod = z
|
|
|
38
38
|
name: z.string(),
|
|
39
39
|
dataType: z.string(),
|
|
40
40
|
isNullable: z.union([z.boolean(), z.number()]),
|
|
41
|
+
collation: z.string().nullable().optional(),
|
|
41
42
|
description: z.string().nullable().optional(),
|
|
42
43
|
})
|
|
43
44
|
.transform((val) => ({
|
|
@@ -45,6 +46,9 @@ export const TableColumnZod = z
|
|
|
45
46
|
dataType: val.dataType,
|
|
46
47
|
isNullable: typeof val.isNullable === "boolean" ? val.isNullable : val.isNullable === 1,
|
|
47
48
|
description: val.description ?? null,
|
|
49
|
+
// Optional so config/virtual columns (which never carry a DB collation) stay assignable to
|
|
50
|
+
// TableColumn; a non-character column reports no collation and is simply omitted here.
|
|
51
|
+
...(val.collation ? { collation: val.collation } : {}),
|
|
48
52
|
}));
|
|
49
53
|
|
|
50
54
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/console/App.tsx"],"names":[],"mappings":"AAaA,OAAO,aAAa,CAAC;AASrB,eAAO,MAAM,GAAG,+CA6Df,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Login.d.ts","sourceRoot":"","sources":["../../../src/console/Login.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIrC,eAAO,MAAM,KAAK,GAAI,qBAAqB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,CAAA;CAAE,4CAwC/E,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export declare const apiBase: string;
|
|
2
|
-
export type Meta = {
|
|
3
|
-
name: string;
|
|
4
|
-
version: string;
|
|
5
|
-
adminSecretHeader: string;
|
|
6
|
-
};
|
|
7
|
-
export type TablesResponse = {
|
|
8
|
-
tables: {
|
|
9
|
-
schema: string;
|
|
10
|
-
name: string;
|
|
11
|
-
entityType: string;
|
|
12
|
-
description: string | null;
|
|
13
|
-
columns: {
|
|
14
|
-
name: string;
|
|
15
|
-
dataType?: string;
|
|
16
|
-
isNullable?: boolean;
|
|
17
|
-
description?: string | null;
|
|
18
|
-
}[];
|
|
19
|
-
relationships: {
|
|
20
|
-
schema: string;
|
|
21
|
-
name: string;
|
|
22
|
-
}[];
|
|
23
|
-
}[];
|
|
24
|
-
};
|
|
25
|
-
export type PermissionValue = "ALL" | string[] | Record<string, "ALL" | {
|
|
26
|
-
columns?: "ALL" | string[];
|
|
27
|
-
filter?: unknown;
|
|
28
|
-
orderBy?: unknown;
|
|
29
|
-
}>;
|
|
30
|
-
export type RolesResponse = {
|
|
31
|
-
roles: string[];
|
|
32
|
-
permissions: Record<string, Record<string, PermissionValue>>;
|
|
33
|
-
};
|
|
34
|
-
export type StatusResponse = {
|
|
35
|
-
uptimeSeconds: number;
|
|
36
|
-
tokenStrategy: string;
|
|
37
|
-
databases: {
|
|
38
|
-
name: string;
|
|
39
|
-
type: string;
|
|
40
|
-
connected: boolean;
|
|
41
|
-
}[];
|
|
42
|
-
publishers: string[];
|
|
43
|
-
cron: {
|
|
44
|
-
name: string;
|
|
45
|
-
pattern: string;
|
|
46
|
-
executionCount: number;
|
|
47
|
-
isRunning: boolean;
|
|
48
|
-
isBusy: boolean;
|
|
49
|
-
nextRun: string | null;
|
|
50
|
-
}[];
|
|
51
|
-
};
|
|
52
|
-
export type ConfigResponse = {
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
prefixes: Record<string, string>;
|
|
56
|
-
features: Record<string, boolean>;
|
|
57
|
-
};
|
|
58
|
-
export declare const getSecret: () => string | null;
|
|
59
|
-
export declare const setSecret: (secret: string) => void;
|
|
60
|
-
export declare const clearSecret: () => void;
|
|
61
|
-
export declare class AuthError extends Error {
|
|
62
|
-
}
|
|
63
|
-
export declare const setAdminHeaderName: (name: string) => void;
|
|
64
|
-
export declare const onAuthFail: (handler: () => void) => void;
|
|
65
|
-
export declare const getMeta: () => Promise<Meta>;
|
|
66
|
-
export declare const apiFetch: <T>(path: string) => Promise<T>;
|
|
67
|
-
//# sourceMappingURL=client.d.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GAKG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigPage.d.ts","sourceRoot":"","sources":["../../../../src/console/pages/ConfigPage.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,+CA+CtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RolesPage.d.ts","sourceRoot":"","sources":["../../../../src/console/pages/RolesPage.tsx"],"names":[],"mappings":"AAmCA,eAAO,MAAM,SAAS,+CAqCrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPage.d.ts","sourceRoot":"","sources":["../../../../src/console/pages/StatusPage.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,+CAiFtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TablesPage.d.ts","sourceRoot":"","sources":["../../../../src/console/pages/TablesPage.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,+CAiDtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.d.ts","sourceRoot":"","sources":["../../../src/console/useApi.ts"],"names":[],"mappings":"AAIA,KAAK,QAAQ,CAAC,CAAC,IAAI;IAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,MAAM,MAAM,KAAG,QAAQ,CAAC,CAAC,CAgBlD,CAAC"}
|