@prisma/studio-core 0.0.0 → 0.2.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.
Files changed (42) hide show
  1. package/dist/CPIOZS5X-V4BHP4CI.js +1 -0
  2. package/dist/OKF6E45R-XYOIK2NY.js +1 -0
  3. package/dist/adapter-CKFCHq71.d.cts +201 -0
  4. package/dist/adapter-CKFCHq71.d.ts +201 -0
  5. package/dist/chunk-2ZJZX5I7.js +0 -0
  6. package/dist/chunk-5MNS4IJC.js +1332 -0
  7. package/dist/chunk-BMVJYUJW.js +1 -0
  8. package/dist/chunk-N2MLAUEV.js +1 -0
  9. package/dist/chunk-P72NBTYE.js +1 -0
  10. package/dist/chunk-XS52QRY2.js +1 -0
  11. package/dist/data/accelerate/index.cjs +1 -0
  12. package/dist/data/accelerate/index.d.cts +47 -0
  13. package/dist/data/accelerate/index.d.ts +47 -0
  14. package/dist/data/accelerate/index.js +1 -0
  15. package/dist/data/bff/index.cjs +1 -0
  16. package/dist/data/bff/index.d.cts +55 -0
  17. package/dist/data/bff/index.d.ts +55 -0
  18. package/dist/data/bff/index.js +1 -0
  19. package/dist/data/index.cjs +1 -1
  20. package/dist/data/index.d.cts +3 -2
  21. package/dist/data/index.d.ts +3 -2
  22. package/dist/data/index.js +1 -0
  23. package/dist/data/pglite/index.cjs +1 -0
  24. package/dist/data/pglite/index.d.cts +26 -0
  25. package/dist/data/pglite/index.d.ts +26 -0
  26. package/dist/data/pglite/index.js +1 -0
  27. package/dist/data/postgres-core/index.cjs +1 -0
  28. package/dist/data/postgres-core/index.d.cts +154 -0
  29. package/dist/data/postgres-core/index.d.ts +154 -0
  30. package/dist/data/postgres-core/index.js +1 -0
  31. package/dist/index-BDPv5Gnt.d.ts +48 -0
  32. package/dist/index-BNAA6jKD.d.cts +48 -0
  33. package/dist/ui/index.cjs +1523 -1
  34. package/dist/ui/index.css +1967 -0
  35. package/dist/ui/index.d.cts +10 -2
  36. package/dist/ui/index.d.ts +10 -2
  37. package/dist/ui/index.js +194 -1
  38. package/package.json +124 -21
  39. package/data/index.ts +0 -1
  40. package/tsconfig.json +0 -6
  41. package/tsup.config.ts +0 -11
  42. package/ui/index.tsx +0 -1
@@ -0,0 +1 @@
1
+ import{a as l,b as a,c as m,d as s,e as u,f as v}from"./chunk-5MNS4IJC.js";import{Z as c,g as n,q as e}from"./chunk-N2MLAUEV.js";import"./chunk-BMVJYUJW.js";var p=i=>{let[r,t]=l({prefix:"TanstackQueryDevtools"}),d=c(),f=n(()=>{let o=r.theme_preference||a;return o!=="system"?o:d()});return e(m.Provider,{value:i,get children(){return e(s,{localStore:r,setLocalStore:t,get children(){return e(u.Provider,{value:f,get children(){return e(v,{localStore:r,setLocalStore:t})}})}})}})},E=p;export{E as default};
@@ -0,0 +1 @@
1
+ import{a as c,b as s,c as u,d as i,e as m,g as d,h as P}from"./chunk-5MNS4IJC.js";import{Z as a,g as l,q as e}from"./chunk-N2MLAUEV.js";import"./chunk-BMVJYUJW.js";var C=t=>{let[r,o]=c({prefix:"TanstackQueryDevtools"}),v=a(),h=l(()=>{let n=r.theme_preference||s;return n!=="system"?n:v()});return e(u.Provider,{value:t,get children(){return e(i,{disabled:!0,localStore:r,setLocalStore:o,get children(){return e(m.Provider,{value:h,get children(){return e(d,{get children(){return e(P,{localStore:r,setLocalStore:o,get onClose(){return t.onClose},showPanelViewOnly:!0})}})}})}})}})},E=C;export{E as default};
@@ -0,0 +1,201 @@
1
+ type Either<E, R> = [E] | [null, R];
2
+ type NumericString = `${number}`;
3
+ type BigIntString = `${bigint}`;
4
+
5
+ interface Adapter {
6
+ /**
7
+ * The schema studio will choose by default.
8
+ *
9
+ * e.g. `public` for PostgreSQL
10
+ */
11
+ readonly defaultSchema?: string;
12
+ /**
13
+ * Introspects the database and returns structured information about the schemas, tables, etc.
14
+ *
15
+ * @param options - Options for the introspection request.
16
+ */
17
+ introspect(options: AdapterIntrospectOptions): Promise<Either<Error, Introspection>>;
18
+ /**
19
+ * Executes a structured query against the database.
20
+ */
21
+ query(details: AdapterQueryDetails, options: AdapterQueryOptions): Promise<Either<Error, AdapterQueryResult>>;
22
+ /**
23
+ * Inserts a single row into the database.
24
+ */
25
+ insert(details: AdapterInsertDetails, options: AdapterInsertOptions): Promise<Either<Error, AdapterInsertResult>>;
26
+ /**
27
+ * Updates a given row in the database with given changes.
28
+ */
29
+ update(details: AdapterUpdateDetails, options: AdapterUpdateOptions): Promise<Either<Error, AdapterUpdateResult>>;
30
+ /**
31
+ * Deletes given rows from the database.
32
+ */
33
+ delete(details: AdapterDeleteDetails, options: AdapterDeleteOptions): Promise<Either<Error, AdapterDeleteResult>>;
34
+ }
35
+ interface AdapterBaseOptions {
36
+ }
37
+ interface AdapterIntrospectOptions extends AdapterBaseOptions {
38
+ }
39
+ interface AdapterQueryOptions extends AdapterBaseOptions {
40
+ abortSignal: AbortSignal;
41
+ }
42
+ interface AdapterInsertOptions extends AdapterBaseOptions {
43
+ }
44
+ interface AdapterUpdateOptions extends AdapterBaseOptions {
45
+ }
46
+ interface AdapterDeleteOptions extends AdapterBaseOptions {
47
+ }
48
+ type SchemaName = string;
49
+ interface Introspection {
50
+ schemas: Record<SchemaName, Schema>;
51
+ timezone: string;
52
+ }
53
+ type TableName = string;
54
+ interface Schema {
55
+ tables: Record<TableName, Table>;
56
+ }
57
+ type ColumnName = string;
58
+ interface Table {
59
+ columns: Record<ColumnName, Column>;
60
+ name: TableName;
61
+ schema: SchemaName;
62
+ }
63
+ interface Column {
64
+ datatype: DataType;
65
+ isComputed: boolean;
66
+ isInPrimaryKey: boolean;
67
+ name: ColumnName;
68
+ nullable: boolean;
69
+ schema: SchemaName;
70
+ table: TableName;
71
+ }
72
+ interface DataType {
73
+ /**
74
+ * A simplification/normalization for UI usage.
75
+ *
76
+ * e.g. varchar and char are strings.
77
+ */
78
+ group: DataTypeGroup;
79
+ /**
80
+ * Is this a native array type?
81
+ */
82
+ isArray: boolean;
83
+ /**
84
+ * Is a native database datatype or a user-defined datatype?
85
+ *
86
+ * e.g. PostgreSQL enums are user-defined datatypes, but `int4` is a native datatype.
87
+ */
88
+ isNative: boolean;
89
+ /**
90
+ * Will be displayed as-is.
91
+ */
92
+ name: string;
93
+ /**
94
+ * Enum values for enum types.
95
+ */
96
+ options: string[];
97
+ /**
98
+ * The schema the datatype belongs to.
99
+ */
100
+ schema: string;
101
+ }
102
+ type DataTypeGroup = "string" | "datetime" | "boolean" | "enum" | "time" | "raw" | "numeric" | "json";
103
+ interface AdapterQueryDetails {
104
+ /**
105
+ * Zero-based index of the page to fetch.
106
+ */
107
+ pageIndex: number;
108
+ /**
109
+ * Maximum number of rows to fetch from the database.
110
+ */
111
+ pageSize: number;
112
+ /**
113
+ * Sort order for the query.
114
+ */
115
+ sortOrder: SortOrderItem[];
116
+ /**
117
+ * The table to select from.
118
+ */
119
+ table: Table;
120
+ }
121
+ interface SortOrderItem {
122
+ /**
123
+ * The column to sort by.
124
+ */
125
+ column: ColumnName;
126
+ /**
127
+ * The direction to sort the column by.
128
+ */
129
+ direction: SortDirection;
130
+ }
131
+ type SortDirection = "asc" | "desc";
132
+ interface AdapterQueryResult {
133
+ /**
134
+ * The total number of rows the query would return if not limited.
135
+ *
136
+ * If the database does not support counting rows, this should be set to `Infinity`.
137
+ */
138
+ filteredRowCount: number | bigint | NumericString | BigIntString;
139
+ /**
140
+ * The rows returned by the query.
141
+ */
142
+ rows: Record<ColumnName, unknown>[];
143
+ }
144
+ interface AdapterInsertDetails {
145
+ /**
146
+ * The table to insert into.
147
+ */
148
+ table: Table;
149
+ /**
150
+ * The values to insert into the table.
151
+ * - The keys should match the column names in the table.
152
+ * - The values should be the values to insert into the table.
153
+ */
154
+ rows: Record<string, unknown>[];
155
+ }
156
+ interface AdapterInsertResult {
157
+ /**
158
+ * The freshly inserted row data.
159
+ */
160
+ rows: Record<string, unknown>[];
161
+ }
162
+ interface AdapterUpdateDetails {
163
+ /**
164
+ * Changes to apply to the row.
165
+ */
166
+ changes: Record<ColumnName, unknown>;
167
+ /**
168
+ * The row to update.
169
+ */
170
+ row: Record<ColumnName, unknown>;
171
+ /**
172
+ * The table to update in.
173
+ */
174
+ table: Table;
175
+ }
176
+ interface AdapterUpdateResult {
177
+ /**
178
+ * The updated row data.
179
+ */
180
+ row: Record<ColumnName, unknown> & {
181
+ /**
182
+ * When the changes were applied in database time.
183
+ */
184
+ __ps_updated_at__: string | number | Date;
185
+ };
186
+ }
187
+ interface AdapterDeleteDetails {
188
+ /**
189
+ * The rows to delete.
190
+ */
191
+ rows: Record<ColumnName, unknown>[];
192
+ /**
193
+ * The table to delete from.
194
+ */
195
+ table: Table;
196
+ }
197
+ interface AdapterDeleteResult {
198
+ rows: Record<ColumnName, unknown>[];
199
+ }
200
+
201
+ export type { Adapter as A, BigIntString as B, Column as C, DataType as D, Either as E, Introspection as I, NumericString as N, Schema as S, Table as T, AdapterInsertDetails as a, AdapterQueryDetails as b, AdapterUpdateDetails as c, AdapterDeleteDetails as d, AdapterBaseOptions as e, AdapterIntrospectOptions as f, AdapterQueryOptions as g, AdapterInsertOptions as h, AdapterUpdateOptions as i, AdapterDeleteOptions as j, DataTypeGroup as k, SortOrderItem as l, SortDirection as m, AdapterQueryResult as n, AdapterInsertResult as o, AdapterUpdateResult as p, AdapterDeleteResult as q };
@@ -0,0 +1,201 @@
1
+ type Either<E, R> = [E] | [null, R];
2
+ type NumericString = `${number}`;
3
+ type BigIntString = `${bigint}`;
4
+
5
+ interface Adapter {
6
+ /**
7
+ * The schema studio will choose by default.
8
+ *
9
+ * e.g. `public` for PostgreSQL
10
+ */
11
+ readonly defaultSchema?: string;
12
+ /**
13
+ * Introspects the database and returns structured information about the schemas, tables, etc.
14
+ *
15
+ * @param options - Options for the introspection request.
16
+ */
17
+ introspect(options: AdapterIntrospectOptions): Promise<Either<Error, Introspection>>;
18
+ /**
19
+ * Executes a structured query against the database.
20
+ */
21
+ query(details: AdapterQueryDetails, options: AdapterQueryOptions): Promise<Either<Error, AdapterQueryResult>>;
22
+ /**
23
+ * Inserts a single row into the database.
24
+ */
25
+ insert(details: AdapterInsertDetails, options: AdapterInsertOptions): Promise<Either<Error, AdapterInsertResult>>;
26
+ /**
27
+ * Updates a given row in the database with given changes.
28
+ */
29
+ update(details: AdapterUpdateDetails, options: AdapterUpdateOptions): Promise<Either<Error, AdapterUpdateResult>>;
30
+ /**
31
+ * Deletes given rows from the database.
32
+ */
33
+ delete(details: AdapterDeleteDetails, options: AdapterDeleteOptions): Promise<Either<Error, AdapterDeleteResult>>;
34
+ }
35
+ interface AdapterBaseOptions {
36
+ }
37
+ interface AdapterIntrospectOptions extends AdapterBaseOptions {
38
+ }
39
+ interface AdapterQueryOptions extends AdapterBaseOptions {
40
+ abortSignal: AbortSignal;
41
+ }
42
+ interface AdapterInsertOptions extends AdapterBaseOptions {
43
+ }
44
+ interface AdapterUpdateOptions extends AdapterBaseOptions {
45
+ }
46
+ interface AdapterDeleteOptions extends AdapterBaseOptions {
47
+ }
48
+ type SchemaName = string;
49
+ interface Introspection {
50
+ schemas: Record<SchemaName, Schema>;
51
+ timezone: string;
52
+ }
53
+ type TableName = string;
54
+ interface Schema {
55
+ tables: Record<TableName, Table>;
56
+ }
57
+ type ColumnName = string;
58
+ interface Table {
59
+ columns: Record<ColumnName, Column>;
60
+ name: TableName;
61
+ schema: SchemaName;
62
+ }
63
+ interface Column {
64
+ datatype: DataType;
65
+ isComputed: boolean;
66
+ isInPrimaryKey: boolean;
67
+ name: ColumnName;
68
+ nullable: boolean;
69
+ schema: SchemaName;
70
+ table: TableName;
71
+ }
72
+ interface DataType {
73
+ /**
74
+ * A simplification/normalization for UI usage.
75
+ *
76
+ * e.g. varchar and char are strings.
77
+ */
78
+ group: DataTypeGroup;
79
+ /**
80
+ * Is this a native array type?
81
+ */
82
+ isArray: boolean;
83
+ /**
84
+ * Is a native database datatype or a user-defined datatype?
85
+ *
86
+ * e.g. PostgreSQL enums are user-defined datatypes, but `int4` is a native datatype.
87
+ */
88
+ isNative: boolean;
89
+ /**
90
+ * Will be displayed as-is.
91
+ */
92
+ name: string;
93
+ /**
94
+ * Enum values for enum types.
95
+ */
96
+ options: string[];
97
+ /**
98
+ * The schema the datatype belongs to.
99
+ */
100
+ schema: string;
101
+ }
102
+ type DataTypeGroup = "string" | "datetime" | "boolean" | "enum" | "time" | "raw" | "numeric" | "json";
103
+ interface AdapterQueryDetails {
104
+ /**
105
+ * Zero-based index of the page to fetch.
106
+ */
107
+ pageIndex: number;
108
+ /**
109
+ * Maximum number of rows to fetch from the database.
110
+ */
111
+ pageSize: number;
112
+ /**
113
+ * Sort order for the query.
114
+ */
115
+ sortOrder: SortOrderItem[];
116
+ /**
117
+ * The table to select from.
118
+ */
119
+ table: Table;
120
+ }
121
+ interface SortOrderItem {
122
+ /**
123
+ * The column to sort by.
124
+ */
125
+ column: ColumnName;
126
+ /**
127
+ * The direction to sort the column by.
128
+ */
129
+ direction: SortDirection;
130
+ }
131
+ type SortDirection = "asc" | "desc";
132
+ interface AdapterQueryResult {
133
+ /**
134
+ * The total number of rows the query would return if not limited.
135
+ *
136
+ * If the database does not support counting rows, this should be set to `Infinity`.
137
+ */
138
+ filteredRowCount: number | bigint | NumericString | BigIntString;
139
+ /**
140
+ * The rows returned by the query.
141
+ */
142
+ rows: Record<ColumnName, unknown>[];
143
+ }
144
+ interface AdapterInsertDetails {
145
+ /**
146
+ * The table to insert into.
147
+ */
148
+ table: Table;
149
+ /**
150
+ * The values to insert into the table.
151
+ * - The keys should match the column names in the table.
152
+ * - The values should be the values to insert into the table.
153
+ */
154
+ rows: Record<string, unknown>[];
155
+ }
156
+ interface AdapterInsertResult {
157
+ /**
158
+ * The freshly inserted row data.
159
+ */
160
+ rows: Record<string, unknown>[];
161
+ }
162
+ interface AdapterUpdateDetails {
163
+ /**
164
+ * Changes to apply to the row.
165
+ */
166
+ changes: Record<ColumnName, unknown>;
167
+ /**
168
+ * The row to update.
169
+ */
170
+ row: Record<ColumnName, unknown>;
171
+ /**
172
+ * The table to update in.
173
+ */
174
+ table: Table;
175
+ }
176
+ interface AdapterUpdateResult {
177
+ /**
178
+ * The updated row data.
179
+ */
180
+ row: Record<ColumnName, unknown> & {
181
+ /**
182
+ * When the changes were applied in database time.
183
+ */
184
+ __ps_updated_at__: string | number | Date;
185
+ };
186
+ }
187
+ interface AdapterDeleteDetails {
188
+ /**
189
+ * The rows to delete.
190
+ */
191
+ rows: Record<ColumnName, unknown>[];
192
+ /**
193
+ * The table to delete from.
194
+ */
195
+ table: Table;
196
+ }
197
+ interface AdapterDeleteResult {
198
+ rows: Record<ColumnName, unknown>[];
199
+ }
200
+
201
+ export type { Adapter as A, BigIntString as B, Column as C, DataType as D, Either as E, Introspection as I, NumericString as N, Schema as S, Table as T, AdapterInsertDetails as a, AdapterQueryDetails as b, AdapterUpdateDetails as c, AdapterDeleteDetails as d, AdapterBaseOptions as e, AdapterIntrospectOptions as f, AdapterQueryOptions as g, AdapterInsertOptions as h, AdapterUpdateOptions as i, AdapterDeleteOptions as j, DataTypeGroup as k, SortOrderItem as l, SortDirection as m, AdapterQueryResult as n, AdapterInsertResult as o, AdapterUpdateResult as p, AdapterDeleteResult as q };
File without changes