@uigraph/sdk 1.1.34
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 +7 -0
- package/dist/__animated-nodes.CUxruu-b.cjs +1 -0
- package/dist/__animated-nodes.C_COfaOh.mjs +94 -0
- package/dist/__animated-nodes.CrIWsAOl.cjs +99 -0
- package/dist/__animated-nodes.DI0XYTuw.mjs +2 -0
- package/dist/__aws-icons.BEeU8uCn.cjs +1 -0
- package/dist/__aws-icons.Vs3L4Tqu.cjs +5920 -0
- package/dist/__aws-icons.agWBtDk7.mjs +2 -0
- package/dist/__aws-icons.d3E71nM8.mjs +5915 -0
- package/dist/__azure-icons.BpVFW8Gy.cjs +5552 -0
- package/dist/__azure-icons.CHjqkspj.mjs +5547 -0
- package/dist/__azure-icons.DJJasII-.cjs +1 -0
- package/dist/__azure-icons.DgR1F6C6.mjs +2 -0
- package/dist/__component-type.69UkUMKl.cjs +54 -0
- package/dist/__component-type.CO8FgnQE.d.mts +24 -0
- package/dist/__component-type.CYmD-KIu.mjs +23 -0
- package/dist/__component-type.tW2Xh7Xk.d.cts +24 -0
- package/dist/__headless.AhKww75N.cjs +110 -0
- package/dist/__headless.B7jwmaZK.d.cts +127 -0
- package/dist/__headless.CP3up7Jj.mjs +104 -0
- package/dist/__headless.DiJZCsKx.d.mts +127 -0
- package/dist/__index.BC7AYPW7.d.cts +116 -0
- package/dist/__index.Banqjcwy.d.mts +116 -0
- package/dist/animated-nodes.cjs +3 -0
- package/dist/animated-nodes.d.cts +16 -0
- package/dist/animated-nodes.d.mts +16 -0
- package/dist/animated-nodes.mjs +3 -0
- package/dist/aws-icons.cjs +3 -0
- package/dist/aws-icons.d.cts +11 -0
- package/dist/aws-icons.d.mts +11 -0
- package/dist/aws-icons.mjs +3 -0
- package/dist/azure-icons.cjs +3 -0
- package/dist/azure-icons.d.cts +11 -0
- package/dist/azure-icons.d.mts +11 -0
- package/dist/azure-icons.mjs +3 -0
- package/dist/browser.cjs +81 -0
- package/dist/browser.d.cts +10 -0
- package/dist/browser.d.mts +10 -0
- package/dist/browser.mjs +79 -0
- package/dist/headless.cjs +3 -0
- package/dist/headless.d.cts +3 -0
- package/dist/headless.d.mts +3 -0
- package/dist/headless.mjs +3 -0
- package/dist/index.cjs +4629 -0
- package/dist/index.d.cts +767 -0
- package/dist/index.d.mts +767 -0
- package/dist/index.mjs +4589 -0
- package/package.json +109 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
import { a as MermaidNode, c as SequenceParticipant, d as ServerComponentField, f as ServerComponentFieldInput, i as MermaidEdge, l as SubgraphInfo, n as RFComponentField, o as SequenceDiagramData, r as ReactFlowData, s as SequenceMessage, t as CustomData, u as SubgraphLayout } from "./__index.BC7AYPW7.cjs";
|
|
2
|
+
import { t as ComponentInputType } from "./__component-type.tW2Xh7Xk.cjs";
|
|
3
|
+
import { t as contextSchema } from "./__headless.B7jwmaZK.cjs";
|
|
4
|
+
import z$1, { z } from "zod";
|
|
5
|
+
import { Edge, Node } from "@xyflow/react";
|
|
6
|
+
|
|
7
|
+
//#region src/react-flow/data-source/nosql-schema.d.ts
|
|
8
|
+
type NestedFieldInternal$1 = {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
fields?: NestedFieldInternal$1[];
|
|
14
|
+
itemType?: string;
|
|
15
|
+
itemFields?: NestedFieldInternal$1[];
|
|
16
|
+
};
|
|
17
|
+
type MongoNestedFieldInternal$1 = {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
required: boolean;
|
|
22
|
+
fields?: MongoNestedFieldInternal$1[];
|
|
23
|
+
itemType?: string;
|
|
24
|
+
itemFields?: MongoNestedFieldInternal$1[];
|
|
25
|
+
refCollectionId?: string | null;
|
|
26
|
+
};
|
|
27
|
+
type DynamoAttributeInternal$1 = {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
notes?: string;
|
|
33
|
+
fields?: DynamoAttributeInternal$1[];
|
|
34
|
+
itemType?: string;
|
|
35
|
+
itemFields?: DynamoAttributeInternal$1[];
|
|
36
|
+
};
|
|
37
|
+
declare const DynamoEditorSchema$1: z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
description: z.ZodString;
|
|
40
|
+
dialect: z.ZodLiteral<"dynamodb">;
|
|
41
|
+
primaryKey: z.ZodObject<{
|
|
42
|
+
partitionKey: z.ZodString;
|
|
43
|
+
partitionKeyType: z.ZodOptional<z.ZodString>;
|
|
44
|
+
sortKey: z.ZodString;
|
|
45
|
+
sortKeyType: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
globalSecondaryIndexes: z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
partitionKey: z.ZodString;
|
|
51
|
+
partitionKeyType: z.ZodOptional<z.ZodString>;
|
|
52
|
+
sortKey: z.ZodOptional<z.ZodString>;
|
|
53
|
+
sortKeyType: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
attributes: z.ZodArray<z.ZodType<DynamoAttributeInternal$1, unknown, z.core.$ZodTypeInternals<DynamoAttributeInternal$1, unknown>>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
declare const MongoEditorSchema$1: z.ZodObject<{
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
description: z.ZodString;
|
|
60
|
+
dialect: z.ZodLiteral<"mongodb">;
|
|
61
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
tags: z.ZodString;
|
|
65
|
+
description: z.ZodString;
|
|
66
|
+
fields: z.ZodArray<z.ZodType<MongoNestedFieldInternal$1, unknown, z.core.$ZodTypeInternals<MongoNestedFieldInternal$1, unknown>>>;
|
|
67
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
fieldName: z.ZodString;
|
|
73
|
+
order: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
unique: z.ZodBoolean;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
declare const JsonEditorSchema$1: z.ZodObject<{
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
description: z.ZodString;
|
|
82
|
+
dialect: z.ZodLiteral<"json">;
|
|
83
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
label: z.ZodOptional<z.ZodString>;
|
|
87
|
+
description: z.ZodOptional<z.ZodString>;
|
|
88
|
+
tags: z.ZodOptional<z.ZodString>;
|
|
89
|
+
fields: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
type: z.ZodString;
|
|
93
|
+
required: z.ZodBoolean;
|
|
94
|
+
isArray: z.ZodBoolean;
|
|
95
|
+
reference: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
collectionId: z.ZodString;
|
|
97
|
+
fieldId: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
100
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal$1, unknown, z.core.$ZodTypeInternals<NestedFieldInternal$1, unknown>>>>;
|
|
101
|
+
itemType: z.ZodOptional<z.ZodString>;
|
|
102
|
+
itemFields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal$1, unknown, z.core.$ZodTypeInternals<NestedFieldInternal$1, unknown>>>>;
|
|
103
|
+
}, z.core.$strip>>>;
|
|
104
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
fields: z.ZodArray<z.ZodString>;
|
|
108
|
+
unique: z.ZodBoolean;
|
|
109
|
+
ttl: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
sample: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/react-flow/data-source/index.d.ts
|
|
116
|
+
interface DataSource {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
sourceType: 'file' | 'manual' | 'editor';
|
|
120
|
+
sourceContent?: z$1.infer<typeof JsonEditorSchema$1> | z$1.infer<typeof DynamoEditorSchema$1> | z$1.infer<typeof MongoEditorSchema$1>;
|
|
121
|
+
dialect: SchemaDialect;
|
|
122
|
+
schemaAst: SchemaAST;
|
|
123
|
+
createdAt: number;
|
|
124
|
+
modifiedAt: number | null;
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/react-flow/node/sql-node.d.ts
|
|
128
|
+
interface DatabaseTableSQLNodeData extends Record<string, unknown> {
|
|
129
|
+
style?: {
|
|
130
|
+
baseColor?: string;
|
|
131
|
+
};
|
|
132
|
+
isForcedOpen?: boolean;
|
|
133
|
+
localTable?: {
|
|
134
|
+
baseId: string;
|
|
135
|
+
tableId: string;
|
|
136
|
+
};
|
|
137
|
+
serviceTable?: {
|
|
138
|
+
serviceId: string;
|
|
139
|
+
serviceDbId: string;
|
|
140
|
+
tableName: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/sql-parser/types.d.ts
|
|
145
|
+
type SchemaDialect = 'mysql' | 'sqlite' | 'postgresql' | 'json' | 'mongodb' | 'dynamodb';
|
|
146
|
+
interface SchemaAST {
|
|
147
|
+
dialect: SchemaDialect;
|
|
148
|
+
tables: TableAST[];
|
|
149
|
+
metadata?: {
|
|
150
|
+
version?: string;
|
|
151
|
+
createdAt?: Date;
|
|
152
|
+
sourceFile?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
interface TableAST {
|
|
156
|
+
type: 'table';
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
columns: ColumnAST[];
|
|
160
|
+
constraints: ConstraintAST[];
|
|
161
|
+
indexes: IndexAST[];
|
|
162
|
+
options?: TableOptionsAST;
|
|
163
|
+
position?: {
|
|
164
|
+
x: number;
|
|
165
|
+
y: number;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
interface ColumnAST {
|
|
169
|
+
type: 'column';
|
|
170
|
+
name: string;
|
|
171
|
+
dataType: DataTypeAST;
|
|
172
|
+
nullable: boolean;
|
|
173
|
+
defaultValue?: DefaultValueAST;
|
|
174
|
+
autoIncrement?: boolean;
|
|
175
|
+
comment?: string;
|
|
176
|
+
collation?: string;
|
|
177
|
+
charset?: string;
|
|
178
|
+
}
|
|
179
|
+
interface DataTypeAST {
|
|
180
|
+
name: string;
|
|
181
|
+
unsigned?: boolean;
|
|
182
|
+
timezone?: boolean;
|
|
183
|
+
parameters?: (number | string)[];
|
|
184
|
+
}
|
|
185
|
+
interface DefaultValueAST {
|
|
186
|
+
type: 'literal' | 'function' | 'expression';
|
|
187
|
+
value: string | number | boolean | null;
|
|
188
|
+
raw?: string;
|
|
189
|
+
}
|
|
190
|
+
type ConstraintAST = PrimaryKeyConstraintAST | ForeignKeyConstraintAST | UniqueConstraintAST | CheckConstraintAST;
|
|
191
|
+
interface PrimaryKeyConstraintAST {
|
|
192
|
+
type: 'primary_key';
|
|
193
|
+
name?: string;
|
|
194
|
+
columns: string[];
|
|
195
|
+
}
|
|
196
|
+
interface ForeignKeyConstraintAST {
|
|
197
|
+
type: 'foreign_key';
|
|
198
|
+
name?: string;
|
|
199
|
+
columns: string[];
|
|
200
|
+
referencedTable: string;
|
|
201
|
+
referencedColumns: string[];
|
|
202
|
+
onDelete?: ReferentialActionAST;
|
|
203
|
+
onUpdate?: ReferentialActionAST;
|
|
204
|
+
}
|
|
205
|
+
interface UniqueConstraintAST {
|
|
206
|
+
type: 'unique';
|
|
207
|
+
name?: string;
|
|
208
|
+
columns: string[];
|
|
209
|
+
}
|
|
210
|
+
interface CheckConstraintAST {
|
|
211
|
+
type: 'check';
|
|
212
|
+
name?: string;
|
|
213
|
+
expression: string;
|
|
214
|
+
}
|
|
215
|
+
type ReferentialActionAST = 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION';
|
|
216
|
+
interface IndexAST {
|
|
217
|
+
type: 'index';
|
|
218
|
+
name: string;
|
|
219
|
+
columns: IndexColumnAST[];
|
|
220
|
+
unique: boolean;
|
|
221
|
+
method?: IndexMethodAST;
|
|
222
|
+
where?: string;
|
|
223
|
+
}
|
|
224
|
+
interface IndexColumnAST {
|
|
225
|
+
name: string;
|
|
226
|
+
order?: 'ASC' | 'DESC';
|
|
227
|
+
length?: number;
|
|
228
|
+
}
|
|
229
|
+
type IndexMethodAST = 'btree' | 'hash' | 'gin' | 'gist' | 'spgist' | 'brin';
|
|
230
|
+
interface TableOptionsAST {
|
|
231
|
+
engine?: string;
|
|
232
|
+
charset?: string;
|
|
233
|
+
collation?: string;
|
|
234
|
+
autoIncrement?: number;
|
|
235
|
+
comment?: string;
|
|
236
|
+
rowFormat?: string;
|
|
237
|
+
tablespace?: string;
|
|
238
|
+
}
|
|
239
|
+
interface SchemaUIRepresentation {
|
|
240
|
+
tables: {
|
|
241
|
+
id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
position: {
|
|
244
|
+
x: number;
|
|
245
|
+
y: number;
|
|
246
|
+
};
|
|
247
|
+
columns: {
|
|
248
|
+
name: string;
|
|
249
|
+
type: string;
|
|
250
|
+
isPrimaryKey: boolean;
|
|
251
|
+
isForeignKey: boolean;
|
|
252
|
+
nullable: boolean;
|
|
253
|
+
defaultValue?: string;
|
|
254
|
+
}[];
|
|
255
|
+
}[];
|
|
256
|
+
relationships: {
|
|
257
|
+
id: string;
|
|
258
|
+
sourceTable: string;
|
|
259
|
+
sourceColumn: string;
|
|
260
|
+
targetTable: string;
|
|
261
|
+
targetColumn: string;
|
|
262
|
+
onDelete?: string;
|
|
263
|
+
onUpdate?: string;
|
|
264
|
+
}[];
|
|
265
|
+
}
|
|
266
|
+
interface TParsedTable {
|
|
267
|
+
name: string;
|
|
268
|
+
columns: TParsedColumn[];
|
|
269
|
+
primaryKeys: string[];
|
|
270
|
+
foreignKeys: TParsedForeignKey[];
|
|
271
|
+
indexes: TParsedIndex[];
|
|
272
|
+
}
|
|
273
|
+
interface TParsedColumn {
|
|
274
|
+
name: string;
|
|
275
|
+
type: string;
|
|
276
|
+
nullable: boolean;
|
|
277
|
+
defaultValue?: string;
|
|
278
|
+
description?: string;
|
|
279
|
+
}
|
|
280
|
+
interface TParsedForeignKey {
|
|
281
|
+
columnName: string;
|
|
282
|
+
referencedTable: string;
|
|
283
|
+
referencedColumn: string;
|
|
284
|
+
constraintName?: string;
|
|
285
|
+
}
|
|
286
|
+
interface TParsedIndex {
|
|
287
|
+
name: string;
|
|
288
|
+
columns: string[];
|
|
289
|
+
unique: boolean;
|
|
290
|
+
}
|
|
291
|
+
interface TParsedSchema {
|
|
292
|
+
tables: TParsedTable[];
|
|
293
|
+
relationships: TParsedForeignKey[];
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/sql-parser/ast-converter.d.ts
|
|
297
|
+
/**
|
|
298
|
+
* Convert AST to UI representation (ReactFlow nodes and edges)
|
|
299
|
+
*/
|
|
300
|
+
declare class AstToUiConverter {
|
|
301
|
+
/**
|
|
302
|
+
* Convert schema AST to ReactFlow nodes and edges
|
|
303
|
+
*/
|
|
304
|
+
static updateReactFlow({
|
|
305
|
+
nodes,
|
|
306
|
+
edges,
|
|
307
|
+
schema,
|
|
308
|
+
sourceId,
|
|
309
|
+
oldDataSources
|
|
310
|
+
}: {
|
|
311
|
+
nodes: Node[];
|
|
312
|
+
edges: Edge[];
|
|
313
|
+
sourceId: string;
|
|
314
|
+
schema: SchemaAST;
|
|
315
|
+
oldDataSources: DataSource[];
|
|
316
|
+
}): {
|
|
317
|
+
nodes: Node[];
|
|
318
|
+
edges: Edge[];
|
|
319
|
+
};
|
|
320
|
+
static toReactFlow(schema: SchemaAST, sourceId: string): {
|
|
321
|
+
nodes: Node<DatabaseTableSQLNodeData>[];
|
|
322
|
+
edges: Edge[];
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Calculate smart layout that groups related tables and separates unrelated ones
|
|
326
|
+
*/
|
|
327
|
+
private static calculateSmartLayout;
|
|
328
|
+
/**
|
|
329
|
+
* Layout a component of related tables using Sugiyama layered approach
|
|
330
|
+
*/
|
|
331
|
+
private static layoutComponentHierarchical;
|
|
332
|
+
/**
|
|
333
|
+
* Convert table AST to ReactFlow node
|
|
334
|
+
*/
|
|
335
|
+
private static tableAstToNode;
|
|
336
|
+
/**
|
|
337
|
+
* Extract primary keys from table
|
|
338
|
+
*/
|
|
339
|
+
static extractPrimaryKeys(table: TableAST): string[];
|
|
340
|
+
/**
|
|
341
|
+
* Extract foreign keys from table
|
|
342
|
+
*/
|
|
343
|
+
static extractForeignKeys(table: TableAST): ForeignKeyConstraintAST[];
|
|
344
|
+
/**
|
|
345
|
+
* Format data type for display
|
|
346
|
+
*/
|
|
347
|
+
static formatDataType(column: ColumnAST): string;
|
|
348
|
+
/**
|
|
349
|
+
* Create edges from foreign key relationships
|
|
350
|
+
*/
|
|
351
|
+
private static createEdgesFromTable;
|
|
352
|
+
}
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/sql-parser/ast-generator.d.ts
|
|
355
|
+
declare class AstToSqlGenerator {
|
|
356
|
+
private dialect;
|
|
357
|
+
private indentSize;
|
|
358
|
+
constructor(dialect?: SchemaDialect, indentSize?: number);
|
|
359
|
+
private generateNoSQL;
|
|
360
|
+
/**
|
|
361
|
+
* Generate SQL from schema AST
|
|
362
|
+
*/
|
|
363
|
+
private generateSQL;
|
|
364
|
+
generate(schema: SchemaAST): string;
|
|
365
|
+
/**
|
|
366
|
+
* Generate CREATE TABLE statement
|
|
367
|
+
*/
|
|
368
|
+
private generateCreateTable;
|
|
369
|
+
/**
|
|
370
|
+
* Generate column definition
|
|
371
|
+
*/
|
|
372
|
+
private generateColumn;
|
|
373
|
+
/**
|
|
374
|
+
* Generate data type string
|
|
375
|
+
*/
|
|
376
|
+
private generateDataType;
|
|
377
|
+
/**
|
|
378
|
+
* Generate default value
|
|
379
|
+
*/
|
|
380
|
+
private generateDefaultValue;
|
|
381
|
+
/**
|
|
382
|
+
* Generate constraint definition
|
|
383
|
+
*/
|
|
384
|
+
private generateConstraint;
|
|
385
|
+
/**
|
|
386
|
+
* Generate PRIMARY KEY constraint
|
|
387
|
+
*/
|
|
388
|
+
private generatePrimaryKey;
|
|
389
|
+
/**
|
|
390
|
+
* Generate FOREIGN KEY constraint
|
|
391
|
+
*/
|
|
392
|
+
private generateForeignKey;
|
|
393
|
+
/**
|
|
394
|
+
* Generate UNIQUE constraint
|
|
395
|
+
*/
|
|
396
|
+
private generateUnique;
|
|
397
|
+
/**
|
|
398
|
+
* Generate CHECK constraint
|
|
399
|
+
*/
|
|
400
|
+
private generateCheck;
|
|
401
|
+
/**
|
|
402
|
+
* Generate INDEX definition (MySQL inline)
|
|
403
|
+
*/
|
|
404
|
+
private generateIndex;
|
|
405
|
+
/**
|
|
406
|
+
* Generate INDEX definition (PostgreSQL separate statement)
|
|
407
|
+
*/
|
|
408
|
+
private generatePostgresIndex;
|
|
409
|
+
/**
|
|
410
|
+
* Generate table options
|
|
411
|
+
*/
|
|
412
|
+
private generateTableOptions;
|
|
413
|
+
/**
|
|
414
|
+
* Quote identifier based on dialect
|
|
415
|
+
*/
|
|
416
|
+
private quoteIdentifier;
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/sql-parser/ast-parser.d.ts
|
|
420
|
+
declare class SqlToAstParser {
|
|
421
|
+
private dialect;
|
|
422
|
+
constructor(dialect?: SchemaDialect);
|
|
423
|
+
/**
|
|
424
|
+
* Parse SQL dump into AST
|
|
425
|
+
*/
|
|
426
|
+
private parseSQL;
|
|
427
|
+
private parseNoSQL;
|
|
428
|
+
parse(sqlContent: string, useStrictNoSQL?: boolean): SchemaAST;
|
|
429
|
+
/**
|
|
430
|
+
* Auto-detect SQL dialect
|
|
431
|
+
*/
|
|
432
|
+
static detectDialect(sqlContent: string): SchemaDialect;
|
|
433
|
+
/**
|
|
434
|
+
* Extract all tables from SQL content
|
|
435
|
+
*/
|
|
436
|
+
private extractTables;
|
|
437
|
+
private extractCreateTableComponents;
|
|
438
|
+
private findClosingParenthesis;
|
|
439
|
+
private applyAlterTableStatements;
|
|
440
|
+
/**
|
|
441
|
+
* Clean SQL content (remove comments, normalize whitespace)
|
|
442
|
+
*/
|
|
443
|
+
private cleanSql;
|
|
444
|
+
/**
|
|
445
|
+
* Clean identifier (remove quotes, backticks)
|
|
446
|
+
*/
|
|
447
|
+
private cleanIdentifier;
|
|
448
|
+
private normalizeTableName;
|
|
449
|
+
private normalizeTableKey;
|
|
450
|
+
private parseNoSqlType;
|
|
451
|
+
/**
|
|
452
|
+
* Parse table definition
|
|
453
|
+
*/
|
|
454
|
+
private parseTableDefinition;
|
|
455
|
+
/**
|
|
456
|
+
* Split table body by commas, respecting parentheses
|
|
457
|
+
*/
|
|
458
|
+
private splitTableBody;
|
|
459
|
+
/**
|
|
460
|
+
* Parse column definition
|
|
461
|
+
*/
|
|
462
|
+
private parseColumn;
|
|
463
|
+
private splitColumnDefinition;
|
|
464
|
+
private applyInlineColumnConstraints;
|
|
465
|
+
/**
|
|
466
|
+
* Parse data type
|
|
467
|
+
*/
|
|
468
|
+
private parseDataType;
|
|
469
|
+
/**
|
|
470
|
+
* Parse default value
|
|
471
|
+
*/
|
|
472
|
+
private parseDefaultValue;
|
|
473
|
+
/**
|
|
474
|
+
* Parse constraint
|
|
475
|
+
*/
|
|
476
|
+
private parseConstraint;
|
|
477
|
+
/**
|
|
478
|
+
* Parse primary key constraint
|
|
479
|
+
*/
|
|
480
|
+
private parsePrimaryKey;
|
|
481
|
+
/**
|
|
482
|
+
* Parse foreign key constraint
|
|
483
|
+
*/
|
|
484
|
+
private parseForeignKey;
|
|
485
|
+
private extractReferentialAction;
|
|
486
|
+
/**
|
|
487
|
+
* Parse unique constraint
|
|
488
|
+
*/
|
|
489
|
+
private parseUnique;
|
|
490
|
+
/**
|
|
491
|
+
* Parse check constraint
|
|
492
|
+
*/
|
|
493
|
+
private parseCheck;
|
|
494
|
+
/**
|
|
495
|
+
* Parse index definition
|
|
496
|
+
*/
|
|
497
|
+
private parseIndex;
|
|
498
|
+
/**
|
|
499
|
+
* Parse table options
|
|
500
|
+
*/
|
|
501
|
+
private parseTableOptions;
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/sql-parser/utils.d.ts
|
|
505
|
+
declare function generateTableNodeId(baseId: string, tableId?: string | null): string;
|
|
506
|
+
declare function generateUUID(): string;
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/nosql-parser/nosql-schema.d.ts
|
|
509
|
+
type NoSQLDialect = 'dynamodb' | 'mongodb' | 'json';
|
|
510
|
+
type NestedFieldInternal = {
|
|
511
|
+
id: string;
|
|
512
|
+
name: string;
|
|
513
|
+
type: string;
|
|
514
|
+
required: boolean;
|
|
515
|
+
fields?: NestedFieldInternal[];
|
|
516
|
+
itemType?: string;
|
|
517
|
+
itemFields?: NestedFieldInternal[];
|
|
518
|
+
};
|
|
519
|
+
declare const DialectIdSchema: z.ZodUnion<readonly [z.ZodLiteral<NoSQLDialect>, z.ZodLiteral<NoSQLDialect>, z.ZodLiteral<NoSQLDialect>]>;
|
|
520
|
+
declare const EditorSupportedDialectSchema: z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<NoSQLDialect>, z.ZodLiteral<NoSQLDialect>, z.ZodLiteral<NoSQLDialect>]>, z.ZodLiteral<"nosql">]>;
|
|
521
|
+
declare const BasicDetailsSchema: z.ZodObject<{
|
|
522
|
+
name: z.ZodString;
|
|
523
|
+
description: z.ZodOptional<z.ZodString>;
|
|
524
|
+
}, z.core.$strip>;
|
|
525
|
+
declare const NestedFieldSchema: z.ZodType<NestedFieldInternal>;
|
|
526
|
+
declare const NoSqlFieldSchema: z.ZodLazy<z.ZodObject<{
|
|
527
|
+
id: z.ZodString;
|
|
528
|
+
name: z.ZodString;
|
|
529
|
+
type: z.ZodString;
|
|
530
|
+
required: z.ZodBoolean;
|
|
531
|
+
isArray: z.ZodBoolean;
|
|
532
|
+
reference: z.ZodOptional<z.ZodObject<{
|
|
533
|
+
collectionId: z.ZodString;
|
|
534
|
+
fieldId: z.ZodOptional<z.ZodString>;
|
|
535
|
+
}, z.core.$strip>>;
|
|
536
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
537
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
538
|
+
itemType: z.ZodOptional<z.ZodString>;
|
|
539
|
+
itemFields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
declare const DocumentIndexSchema: z.ZodObject<{
|
|
542
|
+
id: z.ZodString;
|
|
543
|
+
name: z.ZodString;
|
|
544
|
+
fields: z.ZodArray<z.ZodString>;
|
|
545
|
+
unique: z.ZodBoolean;
|
|
546
|
+
ttl: z.ZodOptional<z.ZodString>;
|
|
547
|
+
}, z.core.$strip>;
|
|
548
|
+
declare const DocumentCollectionSchema: z.ZodObject<{
|
|
549
|
+
id: z.ZodString;
|
|
550
|
+
name: z.ZodString;
|
|
551
|
+
label: z.ZodOptional<z.ZodString>;
|
|
552
|
+
description: z.ZodOptional<z.ZodString>;
|
|
553
|
+
tags: z.ZodOptional<z.ZodString>;
|
|
554
|
+
fields: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
555
|
+
id: z.ZodString;
|
|
556
|
+
name: z.ZodString;
|
|
557
|
+
type: z.ZodString;
|
|
558
|
+
required: z.ZodBoolean;
|
|
559
|
+
isArray: z.ZodBoolean;
|
|
560
|
+
reference: z.ZodOptional<z.ZodObject<{
|
|
561
|
+
collectionId: z.ZodString;
|
|
562
|
+
fieldId: z.ZodOptional<z.ZodString>;
|
|
563
|
+
}, z.core.$strip>>;
|
|
564
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
565
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
566
|
+
itemType: z.ZodOptional<z.ZodString>;
|
|
567
|
+
itemFields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
568
|
+
}, z.core.$strip>>>;
|
|
569
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
570
|
+
id: z.ZodString;
|
|
571
|
+
name: z.ZodString;
|
|
572
|
+
fields: z.ZodArray<z.ZodString>;
|
|
573
|
+
unique: z.ZodBoolean;
|
|
574
|
+
ttl: z.ZodOptional<z.ZodString>;
|
|
575
|
+
}, z.core.$strip>>;
|
|
576
|
+
sample: z.ZodOptional<z.ZodString>;
|
|
577
|
+
}, z.core.$strip>;
|
|
578
|
+
type MongoNestedFieldInternal = {
|
|
579
|
+
id: string;
|
|
580
|
+
name: string;
|
|
581
|
+
type: string;
|
|
582
|
+
required: boolean;
|
|
583
|
+
fields?: MongoNestedFieldInternal[];
|
|
584
|
+
itemType?: string;
|
|
585
|
+
itemFields?: MongoNestedFieldInternal[];
|
|
586
|
+
refCollectionId?: string | null;
|
|
587
|
+
};
|
|
588
|
+
declare const MongoNestedFieldSchema: z.ZodType<MongoNestedFieldInternal>;
|
|
589
|
+
declare const MongoIndexFieldSchema: z.ZodObject<{
|
|
590
|
+
id: z.ZodString;
|
|
591
|
+
fieldName: z.ZodString;
|
|
592
|
+
order: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
|
|
593
|
+
}, z.core.$strip>;
|
|
594
|
+
declare const MongoIndexSchema: z.ZodObject<{
|
|
595
|
+
id: z.ZodString;
|
|
596
|
+
name: z.ZodString;
|
|
597
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
598
|
+
id: z.ZodString;
|
|
599
|
+
fieldName: z.ZodString;
|
|
600
|
+
order: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
|
|
601
|
+
}, z.core.$strip>>;
|
|
602
|
+
unique: z.ZodBoolean;
|
|
603
|
+
}, z.core.$strip>;
|
|
604
|
+
declare const MongoCollectionSchema: z.ZodObject<{
|
|
605
|
+
id: z.ZodString;
|
|
606
|
+
name: z.ZodString;
|
|
607
|
+
tags: z.ZodString;
|
|
608
|
+
description: z.ZodString;
|
|
609
|
+
fields: z.ZodArray<z.ZodType<MongoNestedFieldInternal, unknown, z.core.$ZodTypeInternals<MongoNestedFieldInternal, unknown>>>;
|
|
610
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
611
|
+
id: z.ZodString;
|
|
612
|
+
name: z.ZodString;
|
|
613
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
614
|
+
id: z.ZodString;
|
|
615
|
+
fieldName: z.ZodString;
|
|
616
|
+
order: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
|
|
617
|
+
}, z.core.$strip>>;
|
|
618
|
+
unique: z.ZodBoolean;
|
|
619
|
+
}, z.core.$strip>>;
|
|
620
|
+
}, z.core.$strip>;
|
|
621
|
+
type DynamoAttributeInternal = {
|
|
622
|
+
id: string;
|
|
623
|
+
name: string;
|
|
624
|
+
type: string;
|
|
625
|
+
required: boolean;
|
|
626
|
+
notes?: string;
|
|
627
|
+
fields?: DynamoAttributeInternal[];
|
|
628
|
+
itemType?: string;
|
|
629
|
+
itemFields?: DynamoAttributeInternal[];
|
|
630
|
+
};
|
|
631
|
+
declare const DynamoGsiSchema: z.ZodObject<{
|
|
632
|
+
id: z.ZodString;
|
|
633
|
+
name: z.ZodString;
|
|
634
|
+
partitionKey: z.ZodString;
|
|
635
|
+
partitionKeyType: z.ZodOptional<z.ZodString>;
|
|
636
|
+
sortKey: z.ZodOptional<z.ZodString>;
|
|
637
|
+
sortKeyType: z.ZodOptional<z.ZodString>;
|
|
638
|
+
}, z.core.$strip>;
|
|
639
|
+
declare const DynamoAttributeSchema: z.ZodType<DynamoAttributeInternal>;
|
|
640
|
+
declare const DynamoEditorSchema: z.ZodObject<{
|
|
641
|
+
name: z.ZodString;
|
|
642
|
+
description: z.ZodOptional<z.ZodString>;
|
|
643
|
+
dialect: z.ZodLiteral<"dynamodb">;
|
|
644
|
+
primaryKey: z.ZodObject<{
|
|
645
|
+
partitionKey: z.ZodString;
|
|
646
|
+
partitionKeyType: z.ZodOptional<z.ZodString>;
|
|
647
|
+
sortKey: z.ZodOptional<z.ZodString>;
|
|
648
|
+
sortKeyType: z.ZodOptional<z.ZodString>;
|
|
649
|
+
}, z.core.$strip>;
|
|
650
|
+
globalSecondaryIndexes: z.ZodArray<z.ZodObject<{
|
|
651
|
+
id: z.ZodString;
|
|
652
|
+
name: z.ZodString;
|
|
653
|
+
partitionKey: z.ZodString;
|
|
654
|
+
partitionKeyType: z.ZodOptional<z.ZodString>;
|
|
655
|
+
sortKey: z.ZodOptional<z.ZodString>;
|
|
656
|
+
sortKeyType: z.ZodOptional<z.ZodString>;
|
|
657
|
+
}, z.core.$strip>>;
|
|
658
|
+
attributes: z.ZodArray<z.ZodType<DynamoAttributeInternal, unknown, z.core.$ZodTypeInternals<DynamoAttributeInternal, unknown>>>;
|
|
659
|
+
}, z.core.$strip>;
|
|
660
|
+
declare const MongoEditorSchema: z.ZodObject<{
|
|
661
|
+
name: z.ZodString;
|
|
662
|
+
description: z.ZodOptional<z.ZodString>;
|
|
663
|
+
dialect: z.ZodLiteral<"mongodb">;
|
|
664
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
665
|
+
id: z.ZodString;
|
|
666
|
+
name: z.ZodString;
|
|
667
|
+
tags: z.ZodString;
|
|
668
|
+
description: z.ZodString;
|
|
669
|
+
fields: z.ZodArray<z.ZodType<MongoNestedFieldInternal, unknown, z.core.$ZodTypeInternals<MongoNestedFieldInternal, unknown>>>;
|
|
670
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
671
|
+
id: z.ZodString;
|
|
672
|
+
name: z.ZodString;
|
|
673
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
674
|
+
id: z.ZodString;
|
|
675
|
+
fieldName: z.ZodString;
|
|
676
|
+
order: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
|
|
677
|
+
}, z.core.$strip>>;
|
|
678
|
+
unique: z.ZodBoolean;
|
|
679
|
+
}, z.core.$strip>>;
|
|
680
|
+
}, z.core.$strip>>;
|
|
681
|
+
}, z.core.$strip>;
|
|
682
|
+
declare const JsonEditorSchema: z.ZodObject<{
|
|
683
|
+
name: z.ZodString;
|
|
684
|
+
description: z.ZodOptional<z.ZodString>;
|
|
685
|
+
dialect: z.ZodLiteral<"json">;
|
|
686
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
687
|
+
id: z.ZodString;
|
|
688
|
+
name: z.ZodString;
|
|
689
|
+
label: z.ZodOptional<z.ZodString>;
|
|
690
|
+
description: z.ZodOptional<z.ZodString>;
|
|
691
|
+
tags: z.ZodOptional<z.ZodString>;
|
|
692
|
+
fields: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
693
|
+
id: z.ZodString;
|
|
694
|
+
name: z.ZodString;
|
|
695
|
+
type: z.ZodString;
|
|
696
|
+
required: z.ZodBoolean;
|
|
697
|
+
isArray: z.ZodBoolean;
|
|
698
|
+
reference: z.ZodOptional<z.ZodObject<{
|
|
699
|
+
collectionId: z.ZodString;
|
|
700
|
+
fieldId: z.ZodOptional<z.ZodString>;
|
|
701
|
+
}, z.core.$strip>>;
|
|
702
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
703
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
704
|
+
itemType: z.ZodOptional<z.ZodString>;
|
|
705
|
+
itemFields: z.ZodOptional<z.ZodArray<z.ZodType<NestedFieldInternal, unknown, z.core.$ZodTypeInternals<NestedFieldInternal, unknown>>>>;
|
|
706
|
+
}, z.core.$strip>>>;
|
|
707
|
+
indexes: z.ZodArray<z.ZodObject<{
|
|
708
|
+
id: z.ZodString;
|
|
709
|
+
name: z.ZodString;
|
|
710
|
+
fields: z.ZodArray<z.ZodString>;
|
|
711
|
+
unique: z.ZodBoolean;
|
|
712
|
+
ttl: z.ZodOptional<z.ZodString>;
|
|
713
|
+
}, z.core.$strip>>;
|
|
714
|
+
sample: z.ZodOptional<z.ZodString>;
|
|
715
|
+
}, z.core.$strip>>;
|
|
716
|
+
}, z.core.$strip>;
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/nosql-parser/convert-ast.d.ts
|
|
719
|
+
declare function convertDynamoSchemaToAst(schema: z.infer<typeof DynamoEditorSchema>): SchemaAST;
|
|
720
|
+
declare function convertMongoSchemaToAst(schema: z.infer<typeof MongoEditorSchema>): SchemaAST;
|
|
721
|
+
declare function convertJsonSchemaToAst(schema: z.infer<typeof JsonEditorSchema>): SchemaAST;
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/nosql-parser/index.d.ts
|
|
724
|
+
declare function convertNoSQLToAst(input: unknown): SchemaAST;
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/sync-data/sync-base-data.d.ts
|
|
727
|
+
type Options = {
|
|
728
|
+
keepPrev?: boolean;
|
|
729
|
+
includeNodePositions?: boolean;
|
|
730
|
+
includeNodeDimensions?: boolean;
|
|
731
|
+
};
|
|
732
|
+
declare function syncBaseData(prev: ReactFlowData, next: ReactFlowData, options?: Options): ReactFlowData;
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/mermaid-converter/mermaid-sanitizer.d.ts
|
|
735
|
+
declare function sanitizeMermaidLabels(src: string): string;
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/mermaid-converter/mermaid-to-react-flow.d.ts
|
|
738
|
+
declare function convertMermaidToReactFlow(mermaidCode: string): Promise<ReactFlowData>;
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/components/data-structure.d.ts
|
|
741
|
+
declare function flattenMetaData(fields: ServerComponentField[], fieldsValues: ServerComponentField[]): Record<string, any>;
|
|
742
|
+
declare function buildMetaData(fields: ServerComponentField[], data: Record<string, any | null>): ServerComponentFieldInput[];
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/mermaid-converter/context/convert-with-context.d.ts
|
|
745
|
+
type ResolverOptions = {
|
|
746
|
+
repositionNodes?: boolean;
|
|
747
|
+
resolveCloudIcon?: (cloud: string | undefined, service: string) => Promise<string | undefined | null>;
|
|
748
|
+
};
|
|
749
|
+
declare function convertMermaidToReactFlowWithContext(mermaidCode: string, context: z$1.infer<typeof contextSchema>, options?: ResolverOptions): Promise<ReactFlowData>;
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/uig-converter/types.d.ts
|
|
752
|
+
type UiGraphInput = {
|
|
753
|
+
nodes: Node[];
|
|
754
|
+
edges: Edge[];
|
|
755
|
+
};
|
|
756
|
+
type UiGraphOptions = {
|
|
757
|
+
detailedContext?: boolean;
|
|
758
|
+
};
|
|
759
|
+
type UigOutput = {
|
|
760
|
+
mermaid: string;
|
|
761
|
+
context: z$1.infer<typeof contextSchema>;
|
|
762
|
+
};
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region src/uig-converter/index.d.ts
|
|
765
|
+
declare function convertUiGraphToMermaid(input: UiGraphInput, options?: UiGraphOptions): UigOutput;
|
|
766
|
+
//#endregion
|
|
767
|
+
export { AstToSqlGenerator, AstToUiConverter, BasicDetailsSchema, CheckConstraintAST, ColumnAST, ComponentInputType, ConstraintAST, CustomData, DataTypeAST, DefaultValueAST, DialectIdSchema, DocumentCollectionSchema, DocumentIndexSchema, DynamoAttributeSchema, DynamoEditorSchema, DynamoGsiSchema, EditorSupportedDialectSchema, ForeignKeyConstraintAST, IndexAST, IndexColumnAST, IndexMethodAST, JsonEditorSchema, MermaidEdge, MermaidNode, MongoCollectionSchema, MongoEditorSchema, MongoIndexFieldSchema, MongoIndexSchema, MongoNestedFieldSchema, NestedFieldSchema, NoSqlFieldSchema, PrimaryKeyConstraintAST, RFComponentField, ReactFlowData, ReferentialActionAST, SchemaAST, SchemaDialect, SchemaUIRepresentation, SequenceDiagramData, SequenceMessage, SequenceParticipant, ServerComponentField, ServerComponentFieldInput, SqlToAstParser, SubgraphInfo, SubgraphLayout, TParsedColumn, TParsedForeignKey, TParsedIndex, TParsedSchema, TParsedTable, TableAST, TableOptionsAST, UniqueConstraintAST, buildMetaData, contextSchema, convertDynamoSchemaToAst, convertJsonSchemaToAst, convertMermaidToReactFlow, convertMermaidToReactFlowWithContext, convertMongoSchemaToAst, convertNoSQLToAst, convertUiGraphToMermaid, flattenMetaData, generateTableNodeId, generateUUID, sanitizeMermaidLabels, syncBaseData };
|