@constructive-io/schema-builder 0.2.0 → 0.4.0
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/CHANGELOG.md +23 -0
- package/README.md +12 -4
- package/dist/card-widths-CmIxkRfh.cjs +28 -0
- package/dist/card-widths-CmIxkRfh.cjs.map +1 -0
- package/dist/card-widths-pI4Kw4Xz.js +22 -0
- package/dist/card-widths-pI4Kw4Xz.js.map +1 -0
- package/dist/core-CVxnNLs7.cjs +66 -0
- package/dist/core-CVxnNLs7.cjs.map +1 -0
- package/dist/core-DJ5kA4r-.js +49 -0
- package/dist/core-DJ5kA4r-.js.map +1 -0
- package/dist/core.cjs +14 -212
- package/dist/core.d.cts +3 -54
- package/dist/core.d.ts +3 -54
- package/dist/core.js +3 -200
- package/dist/create-table-card-B6SMrt_g.js +7691 -0
- package/dist/create-table-card-B6SMrt_g.js.map +1 -0
- package/dist/create-table-card-BrQ7pB_U.cjs +7732 -0
- package/dist/create-table-card-BrQ7pB_U.cjs.map +1 -0
- package/dist/delete-confirm-dialog-Ch4tWj6B.cjs +42 -0
- package/dist/delete-confirm-dialog-Ch4tWj6B.cjs.map +1 -0
- package/dist/delete-confirm-dialog-K0AWE643.js +37 -0
- package/dist/delete-confirm-dialog-K0AWE643.js.map +1 -0
- package/dist/empty-state-card-5t7LygTB.cjs +62 -0
- package/dist/empty-state-card-5t7LygTB.cjs.map +1 -0
- package/dist/empty-state-card-C-Nylatg.js +57 -0
- package/dist/empty-state-card-C-Nylatg.js.map +1 -0
- package/dist/fields.cjs +8 -7763
- package/dist/fields.d.cts +38 -39
- package/dist/fields.d.ts +38 -39
- package/dist/fields.js +2 -7735
- package/dist/generated-types-DZMUyNBH.d.cts +27 -0
- package/dist/generated-types-DZMUyNBH.d.ts +27 -0
- package/dist/index--9KTz1LB.d.cts +56 -0
- package/dist/index-10idAfdb.d.cts +7 -0
- package/dist/index-BcdFaKFS.d.ts +7 -0
- package/dist/index-euaSKMQK.d.ts +56 -0
- package/dist/index.cjs +392 -13730
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -10
- package/dist/index.d.ts +4 -10
- package/dist/index.js +381 -13698
- package/dist/index.js.map +1 -1
- package/dist/indexes-view-CBzYpKcd.js +736 -0
- package/dist/indexes-view-CBzYpKcd.js.map +1 -0
- package/dist/indexes-view-D1K24ts1.cjs +759 -0
- package/dist/indexes-view-D1K24ts1.cjs.map +1 -0
- package/dist/indexes.cjs +6 -1041
- package/dist/indexes.d.cts +27 -27
- package/dist/indexes.d.ts +27 -27
- package/dist/indexes.js +2 -1016
- package/dist/invalidate-database-entities-BFCWf5Zf.js +2561 -0
- package/dist/invalidate-database-entities-BFCWf5Zf.js.map +1 -0
- package/dist/invalidate-database-entities-Gs5k8A-M.cjs +2864 -0
- package/dist/invalidate-database-entities-Gs5k8A-M.cjs.map +1 -0
- package/dist/keyboard-activation-BQiV0scm.js +13 -0
- package/dist/keyboard-activation-BQiV0scm.js.map +1 -0
- package/dist/keyboard-activation-D-L0IU6Y.cjs +19 -0
- package/dist/keyboard-activation-D-L0IU6Y.cjs.map +1 -0
- package/dist/policies-view-CkvGpJBo.cjs +1023 -0
- package/dist/policies-view-CkvGpJBo.cjs.map +1 -0
- package/dist/policies-view-DTfAhX7G.js +1018 -0
- package/dist/policies-view-DTfAhX7G.js.map +1 -0
- package/dist/policies.cjs +10 -5939
- package/dist/policies.d.cts +55 -50
- package/dist/policies.d.ts +55 -50
- package/dist/policies.js +4 -5911
- package/dist/policy-config-form-EEcQ9ywL.js +2502 -0
- package/dist/policy-config-form-EEcQ9ywL.js.map +1 -0
- package/dist/policy-config-form-RP9010zj.cjs +2629 -0
- package/dist/policy-config-form-RP9010zj.cjs.map +1 -0
- package/dist/policy-types-D_sYWb-b.d.cts +81 -0
- package/dist/policy-types-D_sYWb-b.d.ts +81 -0
- package/dist/query-BGtzUV7Y.cjs +233 -0
- package/dist/query-BGtzUV7Y.cjs.map +1 -0
- package/dist/query-r6j8IjQB.js +192 -0
- package/dist/query-r6j8IjQB.js.map +1 -0
- package/dist/relationships-view-C884EvGj.js +2417 -0
- package/dist/relationships-view-C884EvGj.js.map +1 -0
- package/dist/relationships-view-DlBs-gCF.cjs +2452 -0
- package/dist/relationships-view-DlBs-gCF.cjs.map +1 -0
- package/dist/relationships.cjs +9 -4328
- package/dist/relationships.d.cts +92 -92
- package/dist/relationships.d.ts +92 -92
- package/dist/relationships.js +2 -4300
- package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
- package/dist/schema-builder-sidebar-DAgK7ZTu.js +654 -0
- package/dist/schema-builder-sidebar-DAgK7ZTu.js.map +1 -0
- package/dist/schema-builder-sidebar-L3TcQeQr.cjs +671 -0
- package/dist/schema-builder-sidebar-L3TcQeQr.cjs.map +1 -0
- package/dist/table-editor-B-5i1M79.js +1906 -0
- package/dist/table-editor-B-5i1M79.js.map +1 -0
- package/dist/table-editor-BdLdVZfh.cjs +1935 -0
- package/dist/table-editor-BdLdVZfh.cjs.map +1 -0
- package/dist/tables.cjs +6 -5643
- package/dist/tables.d.cts +22 -21
- package/dist/tables.d.ts +22 -21
- package/dist/tables.js +3 -5618
- package/dist/testing.cjs +63 -62
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +62 -61
- package/dist/testing.js.map +1 -1
- package/dist/types-CXNRA22N.d.cts +450 -0
- package/dist/types-CXNRA22N.d.ts +450 -0
- package/dist/use-update-table-DlLX9fdE.js +244 -0
- package/dist/use-update-table-DlLX9fdE.js.map +1 -0
- package/dist/use-update-table-vcoHVolI.cjs +291 -0
- package/dist/use-update-table-vcoHVolI.cjs.map +1 -0
- package/package.json +8 -6
- package/dist/core.cjs.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/fields.cjs.map +0 -1
- package/dist/fields.js.map +0 -1
- package/dist/generated-types-CnAlqHU_.d.cts +0 -25
- package/dist/generated-types-CnAlqHU_.d.ts +0 -25
- package/dist/indexes.cjs.map +0 -1
- package/dist/indexes.js.map +0 -1
- package/dist/policies.cjs.map +0 -1
- package/dist/policies.js.map +0 -1
- package/dist/policy-types-CEYAR5TN.d.cts +0 -79
- package/dist/policy-types-CEYAR5TN.d.ts +0 -79
- package/dist/relationships.cjs.map +0 -1
- package/dist/relationships.js.map +0 -1
- package/dist/tables.cjs.map +0 -1
- package/dist/tables.js.map +0 -1
- package/dist/types-Du86atZ8.d.cts +0 -199
- package/dist/types-Du86atZ8.d.ts +0 -199
- package/dist/types-bX2dCrdl.d.cts +0 -52
- package/dist/types-bX2dCrdl.d.ts +0 -52
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import "zustand";
|
|
3
|
+
//#region src/schema/schema-builder-core/lib/types/cell-types.d.ts
|
|
4
|
+
type CellType = 'text' | 'textarea' | 'email' | 'url' | 'phone' | 'citext' | 'bpchar' | 'number' | 'integer' | 'smallint' | 'decimal' | 'currency' | 'percentage' | 'date' | 'datetime' | 'time' | 'timestamptz' | 'interval' | 'boolean' | 'toggle' | 'bit' | 'json' | 'jsonb' | 'array' | 'text-array' | 'uuid-array' | 'number-array' | 'integer-array' | 'date-array' | 'geometry' | 'geometry-point' | 'geometry-collection' | 'inet' | 'image' | 'file' | 'video' | 'audio' | 'upload' | 'uuid' | 'color' | 'rating' | 'tags' | 'tsvector' | 'origin' | 'relation' | 'unknown';
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/schema/schema-builder-core/lib/schema/types.d.ts
|
|
7
|
+
interface FlowNode<Data = Record<string, unknown>, Type extends string = string> {
|
|
8
|
+
id: string;
|
|
9
|
+
type?: Type;
|
|
10
|
+
position: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
data: Data;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
interface FlowEdge<Data = Record<string, unknown>> {
|
|
18
|
+
id: string;
|
|
19
|
+
source: string;
|
|
20
|
+
target: string;
|
|
21
|
+
sourceHandle?: string | null;
|
|
22
|
+
targetHandle?: string | null;
|
|
23
|
+
data?: Data;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
declare const RelationshipTypes: {
|
|
27
|
+
readonly ONE_TO_ONE: "one-to-one";
|
|
28
|
+
readonly BELONGS_TO: "belongs-to";
|
|
29
|
+
readonly ONE_TO_MANY: "one-to-many";
|
|
30
|
+
readonly MANY_TO_MANY: "many-to-many";
|
|
31
|
+
};
|
|
32
|
+
declare const ForeignKeyActions: {
|
|
33
|
+
readonly CASCADE: "c";
|
|
34
|
+
readonly RESTRICT: "r";
|
|
35
|
+
readonly SET_NULL: "n";
|
|
36
|
+
readonly SET_DEFAULT: "d";
|
|
37
|
+
readonly NO_ACTION: "a";
|
|
38
|
+
};
|
|
39
|
+
type RelationshipType = (typeof RelationshipTypes)[keyof typeof RelationshipTypes];
|
|
40
|
+
type ForeignKeyAction = (typeof ForeignKeyActions)[keyof typeof ForeignKeyActions];
|
|
41
|
+
interface TableField {
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
isPrimary?: boolean;
|
|
45
|
+
isForeign?: boolean;
|
|
46
|
+
isUnique?: boolean;
|
|
47
|
+
isNullable?: boolean;
|
|
48
|
+
isIndexed?: boolean;
|
|
49
|
+
foreignKey?: {
|
|
50
|
+
targetTable: string;
|
|
51
|
+
targetField: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface NodeConnections {
|
|
55
|
+
/** Field names that are sources of outgoing edges (FK fields) */
|
|
56
|
+
source: Set<string>;
|
|
57
|
+
/** Field names that are targets of incoming edges (PK fields) */
|
|
58
|
+
target: Set<string>;
|
|
59
|
+
}
|
|
60
|
+
interface TableNodeData extends Record<string, unknown> {
|
|
61
|
+
label: string;
|
|
62
|
+
fields: TableField[];
|
|
63
|
+
selected?: boolean;
|
|
64
|
+
/** Pre-computed connection info - when provided, node skips useEdges() call */
|
|
65
|
+
connections?: NodeConnections;
|
|
66
|
+
}
|
|
67
|
+
type TableNode = FlowNode<TableNodeData, 'tableNode'>;
|
|
68
|
+
interface SchemaEdgeData extends Record<string, unknown> {
|
|
69
|
+
sourceField?: string;
|
|
70
|
+
targetField?: string;
|
|
71
|
+
relationType?: RelationshipType;
|
|
72
|
+
onDelete?: ForeignKeyAction;
|
|
73
|
+
onUpdate?: ForeignKeyAction;
|
|
74
|
+
}
|
|
75
|
+
type SchemaEdge = FlowEdge<SchemaEdgeData>;
|
|
76
|
+
interface SchemaData {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
category: string;
|
|
80
|
+
nodes: TableNode[];
|
|
81
|
+
edges: SchemaEdge[];
|
|
82
|
+
}
|
|
83
|
+
interface FieldConstraints {
|
|
84
|
+
nullable?: boolean;
|
|
85
|
+
unique?: boolean;
|
|
86
|
+
primaryKey?: boolean;
|
|
87
|
+
defaultValue?: string | number | boolean | null;
|
|
88
|
+
minLength?: number;
|
|
89
|
+
maxLength?: number;
|
|
90
|
+
minValue?: number;
|
|
91
|
+
maxValue?: number;
|
|
92
|
+
pattern?: string;
|
|
93
|
+
enumValues?: string[];
|
|
94
|
+
precision?: number;
|
|
95
|
+
scale?: number;
|
|
96
|
+
checkExpression?: string;
|
|
97
|
+
}
|
|
98
|
+
interface FieldDefinition {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
type: CellType;
|
|
102
|
+
label?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
constraints: FieldConstraints;
|
|
105
|
+
fieldOrder?: number;
|
|
106
|
+
isHidden?: boolean;
|
|
107
|
+
isRequired?: boolean;
|
|
108
|
+
metadata?: {
|
|
109
|
+
elementType?: CellType;
|
|
110
|
+
targetTable?: string;
|
|
111
|
+
targetField?: string;
|
|
112
|
+
geoType?: 'Point' | 'Polygon' | 'LineString' | 'MultiPoint' | 'MultiPolygon' | 'MultiLineString';
|
|
113
|
+
smartTags?: Record<string, unknown> | null;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
interface TableDefinition {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
fields: FieldDefinition[];
|
|
122
|
+
indexes?: IndexDefinition[];
|
|
123
|
+
constraints?: TableConstraint[];
|
|
124
|
+
category?: 'CORE' | 'MODULE' | 'APP';
|
|
125
|
+
smartTags?: Record<string, unknown>;
|
|
126
|
+
}
|
|
127
|
+
declare const INDEX_TYPE_LABELS: {
|
|
128
|
+
readonly btree: "B-Tree";
|
|
129
|
+
readonly hash: "Hash";
|
|
130
|
+
readonly gin: "GIN";
|
|
131
|
+
readonly gist: "GiST";
|
|
132
|
+
readonly spgist: "SP-GiST";
|
|
133
|
+
readonly brin: "BRIN";
|
|
134
|
+
};
|
|
135
|
+
type IndexType = keyof typeof INDEX_TYPE_LABELS;
|
|
136
|
+
interface IndexDefinition {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
fields: string[];
|
|
140
|
+
unique?: boolean;
|
|
141
|
+
type?: IndexType;
|
|
142
|
+
createdAt?: string;
|
|
143
|
+
}
|
|
144
|
+
interface BaseConstraint {
|
|
145
|
+
id: string;
|
|
146
|
+
name?: string;
|
|
147
|
+
fields: string[];
|
|
148
|
+
createdAt?: string;
|
|
149
|
+
}
|
|
150
|
+
interface PrimaryKeyConstraint extends BaseConstraint {
|
|
151
|
+
type: 'primary_key';
|
|
152
|
+
}
|
|
153
|
+
interface ForeignKeyConstraint extends BaseConstraint {
|
|
154
|
+
type: 'foreign_key';
|
|
155
|
+
referencedTable: string;
|
|
156
|
+
referencedFields: string[];
|
|
157
|
+
onDelete?: ForeignKeyAction;
|
|
158
|
+
onUpdate?: ForeignKeyAction;
|
|
159
|
+
/** UI relationship type - stored in smartTags */
|
|
160
|
+
relationshipType?: RelationshipType;
|
|
161
|
+
/** Metadata stored via GraphQL smartTags field */
|
|
162
|
+
smartTags?: {
|
|
163
|
+
relationshipType?: RelationshipType;
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
} | null;
|
|
166
|
+
}
|
|
167
|
+
interface UniqueConstraint extends BaseConstraint {
|
|
168
|
+
type: 'unique';
|
|
169
|
+
}
|
|
170
|
+
interface CheckConstraint extends BaseConstraint {
|
|
171
|
+
type: 'check';
|
|
172
|
+
checkExpression: string;
|
|
173
|
+
}
|
|
174
|
+
type TableConstraint = PrimaryKeyConstraint | ForeignKeyConstraint | UniqueConstraint | CheckConstraint;
|
|
175
|
+
interface DbLightSchema {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
version: string;
|
|
180
|
+
tables: TableDefinition[];
|
|
181
|
+
relationships?: RelationshipDefinition[];
|
|
182
|
+
metadata?: {
|
|
183
|
+
createdAt: string;
|
|
184
|
+
updatedAt: string;
|
|
185
|
+
author?: string;
|
|
186
|
+
tags?: string[];
|
|
187
|
+
databaseId?: string;
|
|
188
|
+
databaseName?: string;
|
|
189
|
+
databaseLabel?: string | null;
|
|
190
|
+
schemaId?: string | null;
|
|
191
|
+
sourceType?: 'remote-database' | 'template' | 'custom';
|
|
192
|
+
ownerId?: string | null;
|
|
193
|
+
ownerName?: string | null;
|
|
194
|
+
tableCount?: number;
|
|
195
|
+
fieldCount?: number;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
interface RelationshipDefinition {
|
|
199
|
+
id: string;
|
|
200
|
+
name?: string;
|
|
201
|
+
sourceTable: string;
|
|
202
|
+
sourceField: string;
|
|
203
|
+
targetTable: string;
|
|
204
|
+
targetField: string;
|
|
205
|
+
type: RelationshipType;
|
|
206
|
+
onDelete?: ForeignKeyAction;
|
|
207
|
+
onUpdate?: ForeignKeyAction;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/schema/schema-builder-core/lib/gql/hooks/schema-builder/use-schema-builder-selectors.d.ts
|
|
211
|
+
interface SchemaInfo {
|
|
212
|
+
key: string;
|
|
213
|
+
name: string;
|
|
214
|
+
description: string;
|
|
215
|
+
category: string;
|
|
216
|
+
nodeCount: number;
|
|
217
|
+
edgeCount: number;
|
|
218
|
+
source: 'custom' | 'database';
|
|
219
|
+
schema: SchemaData;
|
|
220
|
+
dbSchema?: DbLightSchema;
|
|
221
|
+
checksum?: string;
|
|
222
|
+
databaseInfo?: {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
label?: string | null;
|
|
226
|
+
schemaId?: string | null;
|
|
227
|
+
ownerName?: string;
|
|
228
|
+
ownerId?: string;
|
|
229
|
+
tableCount: number;
|
|
230
|
+
fieldCount: number;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
interface SchemaBuilderDataState {
|
|
234
|
+
availableSchemas: SchemaInfo[];
|
|
235
|
+
routeOrgId: string | null;
|
|
236
|
+
routeDatabaseId: string | null;
|
|
237
|
+
selectedSchemaKey: string;
|
|
238
|
+
currentSchemaInfo: SchemaInfo | null;
|
|
239
|
+
currentSchema: DbLightSchema | null;
|
|
240
|
+
currentTable: TableDefinition | null;
|
|
241
|
+
selectedTableId: string | null;
|
|
242
|
+
hasResolvedDatabaseLookup: boolean;
|
|
243
|
+
isLoading: boolean;
|
|
244
|
+
isFetching: boolean;
|
|
245
|
+
error: Error | null;
|
|
246
|
+
refetch: () => Promise<unknown>;
|
|
247
|
+
selectTable: (tableId: string | null, tableName?: string | null) => void;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/types.d.ts
|
|
251
|
+
interface SchemaBuilderScope {
|
|
252
|
+
orgId: string;
|
|
253
|
+
databaseId: string;
|
|
254
|
+
userId?: string | null;
|
|
255
|
+
}
|
|
256
|
+
type SchemaBuilderColorMode = 'light' | 'dark';
|
|
257
|
+
interface SchemaBuilderSidebarSections {
|
|
258
|
+
app: boolean;
|
|
259
|
+
system: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface SchemaBuilderPreferences {
|
|
262
|
+
sidebarSectionsExpanded: SchemaBuilderSidebarSections;
|
|
263
|
+
showSystemTablesInSidebar: boolean;
|
|
264
|
+
showSystemTablesInVisualizer: boolean;
|
|
265
|
+
sidebarPinned: boolean;
|
|
266
|
+
typesLibraryExpanded: boolean;
|
|
267
|
+
}
|
|
268
|
+
declare const DEFAULT_SCHEMA_BUILDER_PREFERENCES: Readonly<SchemaBuilderPreferences>;
|
|
269
|
+
interface SchemaBuilderField {
|
|
270
|
+
id: string;
|
|
271
|
+
name: string;
|
|
272
|
+
type?: string | null;
|
|
273
|
+
description?: string | null;
|
|
274
|
+
isNullable?: boolean | null;
|
|
275
|
+
isPrimaryKey?: boolean | null;
|
|
276
|
+
isUnique?: boolean | null;
|
|
277
|
+
[key: string]: unknown;
|
|
278
|
+
}
|
|
279
|
+
interface SchemaBuilderTable {
|
|
280
|
+
id: string;
|
|
281
|
+
name: string;
|
|
282
|
+
label?: string | null;
|
|
283
|
+
description?: string | null;
|
|
284
|
+
category?: string | null;
|
|
285
|
+
schemaId?: string | null;
|
|
286
|
+
fields?: readonly SchemaBuilderField[];
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface SchemaBuilderSchema {
|
|
290
|
+
id: string;
|
|
291
|
+
name: string;
|
|
292
|
+
label?: string | null;
|
|
293
|
+
tables?: readonly SchemaBuilderTable[];
|
|
294
|
+
[key: string]: unknown;
|
|
295
|
+
}
|
|
296
|
+
interface SchemaBuilderIndex {
|
|
297
|
+
id: string;
|
|
298
|
+
name: string;
|
|
299
|
+
tableId?: string | null;
|
|
300
|
+
fieldIds?: readonly string[];
|
|
301
|
+
isUnique?: boolean | null;
|
|
302
|
+
[key: string]: unknown;
|
|
303
|
+
}
|
|
304
|
+
interface SchemaBuilderPolicy {
|
|
305
|
+
id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
tableId?: string | null;
|
|
308
|
+
command?: string | null;
|
|
309
|
+
[key: string]: unknown;
|
|
310
|
+
}
|
|
311
|
+
interface SchemaBuilderRelationship {
|
|
312
|
+
id: string;
|
|
313
|
+
sourceTableId?: string | null;
|
|
314
|
+
targetTableId?: string | null;
|
|
315
|
+
[key: string]: unknown;
|
|
316
|
+
}
|
|
317
|
+
interface SchemaBuilderOperationContext {
|
|
318
|
+
scope: SchemaBuilderScope;
|
|
319
|
+
signal?: AbortSignal;
|
|
320
|
+
/** Generated-SDK registry adapters forward requested result fields here. */
|
|
321
|
+
selection?: Readonly<Record<string, unknown>>;
|
|
322
|
+
}
|
|
323
|
+
type SchemaBuilderVariables = object;
|
|
324
|
+
type SchemaBuilderOperation<TVariables extends SchemaBuilderVariables = SchemaBuilderVariables, TResult = unknown> = (variables: TVariables, context: SchemaBuilderOperationContext) => Promise<TResult>;
|
|
325
|
+
type SchemaBuilderCollection<T> = readonly T[] | {
|
|
326
|
+
nodes?: readonly T[] | null;
|
|
327
|
+
totalCount?: number | null;
|
|
328
|
+
};
|
|
329
|
+
interface SchemaBuilderCoreCapabilities {
|
|
330
|
+
apiSchemas: SchemaBuilderOperation;
|
|
331
|
+
apis: SchemaBuilderOperation;
|
|
332
|
+
databases: SchemaBuilderOperation;
|
|
333
|
+
fields: SchemaBuilderOperation;
|
|
334
|
+
foreignKeyConstraints: SchemaBuilderOperation;
|
|
335
|
+
indices: SchemaBuilderOperation;
|
|
336
|
+
policies: SchemaBuilderOperation;
|
|
337
|
+
primaryKeyConstraints: SchemaBuilderOperation;
|
|
338
|
+
schemas: SchemaBuilderOperation;
|
|
339
|
+
table: SchemaBuilderOperation;
|
|
340
|
+
tables: SchemaBuilderOperation;
|
|
341
|
+
uniqueConstraints: SchemaBuilderOperation;
|
|
342
|
+
users: SchemaBuilderOperation;
|
|
343
|
+
}
|
|
344
|
+
interface SchemaBuilderFieldsCapabilities {
|
|
345
|
+
createField: SchemaBuilderOperation;
|
|
346
|
+
createPrimaryKeyConstraint: SchemaBuilderOperation;
|
|
347
|
+
createUniqueConstraint: SchemaBuilderOperation;
|
|
348
|
+
deleteField: SchemaBuilderOperation;
|
|
349
|
+
deletePrimaryKeyConstraint: SchemaBuilderOperation;
|
|
350
|
+
deleteUniqueConstraint: SchemaBuilderOperation;
|
|
351
|
+
updateField: SchemaBuilderOperation;
|
|
352
|
+
updatePrimaryKeyConstraint: SchemaBuilderOperation;
|
|
353
|
+
}
|
|
354
|
+
interface SchemaBuilderRelationshipsCapabilities {
|
|
355
|
+
createField: SchemaBuilderOperation;
|
|
356
|
+
createForeignKeyConstraint: SchemaBuilderOperation;
|
|
357
|
+
createPrimaryKeyConstraint: SchemaBuilderOperation;
|
|
358
|
+
createRelationProvision: SchemaBuilderOperation;
|
|
359
|
+
createTable: SchemaBuilderOperation;
|
|
360
|
+
createUniqueConstraint: SchemaBuilderOperation;
|
|
361
|
+
deleteForeignKeyConstraint: SchemaBuilderOperation;
|
|
362
|
+
relationProvisions: SchemaBuilderOperation;
|
|
363
|
+
updateForeignKeyConstraint: SchemaBuilderOperation;
|
|
364
|
+
}
|
|
365
|
+
interface SchemaBuilderIndexesCapabilities {
|
|
366
|
+
createIndex: SchemaBuilderOperation;
|
|
367
|
+
deleteIndex: SchemaBuilderOperation;
|
|
368
|
+
updateIndex: SchemaBuilderOperation;
|
|
369
|
+
}
|
|
370
|
+
interface SchemaBuilderPoliciesCapabilities {
|
|
371
|
+
appPermissions: SchemaBuilderOperation;
|
|
372
|
+
createField: SchemaBuilderOperation;
|
|
373
|
+
createSecureTableProvision: SchemaBuilderOperation;
|
|
374
|
+
createTable: SchemaBuilderOperation;
|
|
375
|
+
createTableGrant: SchemaBuilderOperation;
|
|
376
|
+
deletePolicy: SchemaBuilderOperation;
|
|
377
|
+
fields: SchemaBuilderOperation;
|
|
378
|
+
orgPermissions: SchemaBuilderOperation;
|
|
379
|
+
tables: SchemaBuilderOperation;
|
|
380
|
+
updatePolicy: SchemaBuilderOperation;
|
|
381
|
+
}
|
|
382
|
+
interface SchemaBuilderTablesCapabilities {
|
|
383
|
+
deleteTable: SchemaBuilderOperation;
|
|
384
|
+
updateTable: SchemaBuilderOperation;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Imperative data boundary owned by the host. Each feature is isolated so a
|
|
388
|
+
* partial registry install can provide only the capabilities it consumes.
|
|
389
|
+
*/
|
|
390
|
+
interface SchemaBuilderAdapter {
|
|
391
|
+
core: SchemaBuilderCoreCapabilities;
|
|
392
|
+
fields: SchemaBuilderFieldsCapabilities;
|
|
393
|
+
relationships: SchemaBuilderRelationshipsCapabilities;
|
|
394
|
+
indexes: SchemaBuilderIndexesCapabilities;
|
|
395
|
+
policies: SchemaBuilderPoliciesCapabilities;
|
|
396
|
+
tables: SchemaBuilderTablesCapabilities;
|
|
397
|
+
}
|
|
398
|
+
type SchemaBuilderFeature = keyof SchemaBuilderAdapter;
|
|
399
|
+
type SchemaBuilderCoreTabId = 'editor' | 'relationships' | 'indexes' | 'security';
|
|
400
|
+
interface SchemaBuilderNavigationTarget {
|
|
401
|
+
href: string;
|
|
402
|
+
replace?: boolean;
|
|
403
|
+
}
|
|
404
|
+
interface SchemaBuilderTableSelection {
|
|
405
|
+
tableId: string | null;
|
|
406
|
+
tableName: string | null;
|
|
407
|
+
}
|
|
408
|
+
interface SchemaBuilderTabRenderContext {
|
|
409
|
+
scope: SchemaBuilderScope;
|
|
410
|
+
colorMode: SchemaBuilderColorMode;
|
|
411
|
+
selectedTableId: string | null;
|
|
412
|
+
}
|
|
413
|
+
interface SchemaBuilderTab {
|
|
414
|
+
id: string;
|
|
415
|
+
label: ReactNode;
|
|
416
|
+
render: (context: SchemaBuilderTabRenderContext) => ReactNode;
|
|
417
|
+
preload?: () => void | Promise<void>;
|
|
418
|
+
/** Keeps the tab addressable without showing it in the package-owned tab list. */
|
|
419
|
+
hidden?: boolean;
|
|
420
|
+
}
|
|
421
|
+
interface SchemaBuilderInvalidationEvent {
|
|
422
|
+
scope: SchemaBuilderScope;
|
|
423
|
+
feature: SchemaBuilderFeature;
|
|
424
|
+
operation: string;
|
|
425
|
+
}
|
|
426
|
+
interface SchemaBuilderHostOptions {
|
|
427
|
+
adapter: SchemaBuilderAdapter;
|
|
428
|
+
scope: SchemaBuilderScope;
|
|
429
|
+
colorMode: SchemaBuilderColorMode;
|
|
430
|
+
preferences: SchemaBuilderPreferences;
|
|
431
|
+
onPreferencesChange: (preferences: SchemaBuilderPreferences) => void;
|
|
432
|
+
activeTab: string;
|
|
433
|
+
onActiveTabChange: (tabId: string) => void;
|
|
434
|
+
/** Optional host-controlled table selection, such as a URL-backed table id. */
|
|
435
|
+
selectedTableId?: string | null;
|
|
436
|
+
onSelectedTableChange?: (selection: SchemaBuilderTableSelection) => void;
|
|
437
|
+
onNavigate?: (target: SchemaBuilderNavigationTarget) => void;
|
|
438
|
+
onInvalidate?: (event: SchemaBuilderInvalidationEvent) => void;
|
|
439
|
+
tabs?: readonly SchemaBuilderTab[];
|
|
440
|
+
}
|
|
441
|
+
interface SchemaBuilderProps extends SchemaBuilderHostOptions {
|
|
442
|
+
className?: string;
|
|
443
|
+
emptyState?: ReactNode;
|
|
444
|
+
/** Reuses a host-owned schema data boundary instead of starting block-owned queries. */
|
|
445
|
+
dataState?: SchemaBuilderDataState;
|
|
446
|
+
}
|
|
447
|
+
declare function defineSchemaBuilderAdapter<TAdapter extends SchemaBuilderAdapter>(adapter: TAdapter): TAdapter;
|
|
448
|
+
//#endregion
|
|
449
|
+
export { SchemaBuilderTablesCapabilities as A, SchemaBuilderSchema as C, SchemaBuilderTabRenderContext as D, SchemaBuilderTab as E, ForeignKeyAction as F, RelationshipType as I, defineSchemaBuilderAdapter as M, SchemaBuilderDataState as N, SchemaBuilderTable as O, FieldDefinition as P, SchemaBuilderRelationshipsCapabilities as S, SchemaBuilderSidebarSections as T, SchemaBuilderPoliciesCapabilities as _, SchemaBuilderCoreCapabilities as a, SchemaBuilderProps as b, SchemaBuilderField as c, SchemaBuilderIndex as d, SchemaBuilderIndexesCapabilities as f, SchemaBuilderOperationContext as g, SchemaBuilderOperation as h, SchemaBuilderColorMode as i, SchemaBuilderVariables as j, SchemaBuilderTableSelection as k, SchemaBuilderFieldsCapabilities as l, SchemaBuilderNavigationTarget as m, SchemaBuilderAdapter as n, SchemaBuilderCoreTabId as o, SchemaBuilderInvalidationEvent as p, SchemaBuilderCollection as r, SchemaBuilderFeature as s, DEFAULT_SCHEMA_BUILDER_PREFERENCES as t, SchemaBuilderHostOptions as u, SchemaBuilderPolicy as v, SchemaBuilderScope as w, SchemaBuilderRelationship as x, SchemaBuilderPreferences as y };
|
|
450
|
+
//# sourceMappingURL=types-CXNRA22N.d.cts.map
|