@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,154 @@
1
+ import { A as Adapter, T as Table, a as AdapterInsertDetails, b as AdapterQueryDetails, c as AdapterUpdateDetails, d as AdapterDeleteDetails } from '../../adapter-CKFCHq71.js';
2
+ import { E as Executor, B as BuilderRequirements, Q as Query } from '../../index-BDPv5Gnt.js';
3
+ import * as kysely from 'kysely';
4
+
5
+ interface PostgresAdapterRequirements {
6
+ executor: Executor;
7
+ noParameters?: boolean;
8
+ }
9
+ declare function createPostgresAdapter(requirements: PostgresAdapterRequirements): Adapter;
10
+ /**
11
+ * For testing purposes.
12
+ */
13
+ declare function mockIntrospect(): {
14
+ schemas: { [K in "public"]: {
15
+ tables: { [T in "users"]: Table; };
16
+ }; };
17
+ timezone: "UTC";
18
+ };
19
+
20
+ /**
21
+ * `ctid` is a system column that represents the physical location of a row in a table.
22
+ * It is a tuple of two integers: `(blockNumber, tupleIndex)`.
23
+ * It is used to uniquely identify a row in a table, even if the row has no primary key, or other unique constraints.
24
+ *
25
+ * Example: '(0,23)' represents the 24th row in the first block of the table.
26
+ */
27
+ type CTIDasText = `(${number},${number})`;
28
+ /**
29
+ * Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
30
+ */
31
+ declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
32
+ [x: string]: unknown;
33
+ } & {
34
+ ctid: `(${number},${number})`;
35
+ }>;
36
+ /**
37
+ * Returns a query that selects all columns from a table, along with the `ctid` column, and unbound row count as `oid` (reserved column name that cannot conflict with user columns).
38
+ */
39
+ declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
40
+ [x: string]: unknown;
41
+ oid: `${bigint}`;
42
+ ctid: `(${number},${number})`;
43
+ }>;
44
+ /**
45
+ * For testing purposes.
46
+ */
47
+ declare function mockSelectQuery(): [{
48
+ readonly created_at: Date;
49
+ readonly ctid: "(0,1)";
50
+ readonly deleted_at: null;
51
+ readonly id: 1;
52
+ readonly name: "John Doe";
53
+ readonly oid: "2";
54
+ readonly role: "admin";
55
+ }, {
56
+ readonly created_at: Date;
57
+ readonly ctid: "(0,2)";
58
+ readonly deleted_at: null;
59
+ readonly id: 2;
60
+ readonly name: "Jane Doe";
61
+ readonly oid: "2";
62
+ readonly role: "poweruser";
63
+ }];
64
+ /**
65
+ * Returns a query that updates a given row in a table with given changes.
66
+ */
67
+ declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
68
+ [x: string]: unknown;
69
+ ctid: `(${number},${number})`;
70
+ __ps_updated_at__: `${bigint}`;
71
+ }>;
72
+ /**
73
+ * Returns a query that deletes a given set of rows.
74
+ */
75
+ declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<kysely.DeleteResult>;
76
+
77
+ /**
78
+ * Returns a query that returns metadata for all user-defined tables and views in the database.
79
+ */
80
+ declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
81
+ schema: string;
82
+ name: string;
83
+ columns: {
84
+ name: string;
85
+ datatype: string;
86
+ datatype_schema: string;
87
+ pk: boolean;
88
+ computed: boolean;
89
+ nullable: boolean;
90
+ options: string[];
91
+ }[];
92
+ }>;
93
+ /**
94
+ * For testing purposes.
95
+ */
96
+ declare function mockTablesQuery(): [{
97
+ readonly schema: "public";
98
+ readonly name: "users";
99
+ readonly columns: [{
100
+ readonly name: "id";
101
+ readonly datatype: "bigint";
102
+ readonly datatype_schema: "public";
103
+ readonly pk: true;
104
+ readonly computed: false;
105
+ readonly options: [];
106
+ readonly nullable: true;
107
+ }, {
108
+ readonly name: "name";
109
+ readonly datatype: "varchar";
110
+ readonly datatype_schema: "public";
111
+ readonly pk: false;
112
+ readonly computed: false;
113
+ readonly options: [];
114
+ readonly nullable: true;
115
+ }, {
116
+ readonly name: "role";
117
+ readonly datatype: "role";
118
+ readonly datatype_schema: "public";
119
+ readonly pk: false;
120
+ readonly computed: false;
121
+ readonly options: ["admin", "maintainer", "member"];
122
+ readonly nullable: true;
123
+ }, {
124
+ readonly name: "created_at";
125
+ readonly datatype: "timestamptz";
126
+ readonly datatype_schema: "public";
127
+ readonly pk: false;
128
+ readonly computed: false;
129
+ readonly options: [];
130
+ readonly nullable: true;
131
+ }, {
132
+ readonly name: "deleted_at";
133
+ readonly datatype: "timestamptz";
134
+ readonly datatype_schema: "public";
135
+ readonly pk: false;
136
+ readonly computed: false;
137
+ readonly options: [];
138
+ readonly nullable: true;
139
+ }];
140
+ }];
141
+ /**
142
+ * Returns a query that returns the current timezone setting of the PostgreSQL database.
143
+ */
144
+ declare function getTimezoneQuery(): Query<{
145
+ timezone: string;
146
+ }>;
147
+ /**
148
+ * For testing purposes.
149
+ */
150
+ declare function mockTimezoneQuery(): [{
151
+ readonly timezone: "UTC";
152
+ }];
153
+
154
+ export { type CTIDasText, type PostgresAdapterRequirements, createPostgresAdapter, getDeleteQuery, getInsertQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"../../chunk-XS52QRY2.js";import"../../chunk-P72NBTYE.js";import"../../chunk-BMVJYUJW.js";export{j as createPostgresAdapter,e as getDeleteQuery,a as getInsertQuery,b as getSelectQuery,f as getTablesQuery,h as getTimezoneQuery,d as getUpdateQuery,k as mockIntrospect,c as mockSelectQuery,g as mockTablesQuery,i as mockTimezoneQuery};
@@ -0,0 +1,48 @@
1
+ import { T as Table, E as Either } from './adapter-CKFCHq71.js';
2
+ import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
3
+
4
+ interface BuilderRequirements {
5
+ Adapter: {
6
+ new (): DialectAdapter;
7
+ };
8
+ noParameters?: boolean;
9
+ QueryCompiler: {
10
+ new (): QueryCompiler;
11
+ };
12
+ }
13
+ declare const queryType: unique symbol;
14
+ interface Query<T = unknown> {
15
+ [queryType]?: T;
16
+ parameters: readonly unknown[];
17
+ sql: string;
18
+ }
19
+ type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
20
+ /**
21
+ * Applies a filter to the given rows based on the primary key columns of the table.
22
+ *
23
+ * @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
24
+ */
25
+ declare function applyInferredRowFilters(rows: Record<string, unknown>[], columns: Table["columns"]): <QB extends WhereInterface<any, any>>(qb: QB) => QB;
26
+ /**
27
+ * Part of a filter that predicts a match.
28
+ * ie. ... WHERE $ColumName = $Value ...
29
+ */
30
+ type RowFilterPredicate = [ColumnName: string, Value: unknown];
31
+ /**
32
+ * A row filter is comprised of one or more predicates.
33
+ */
34
+ type RowFilter = RowFilterPredicate[];
35
+ /**
36
+ * Infers the filter that is necessary to uniquely identify a given row
37
+ * individually.
38
+ */
39
+ declare function inferRowFilter(row: Record<string, unknown>, columns: Table["columns"]): RowFilter;
40
+
41
+ interface Executor {
42
+ execute<Q extends Query>(query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
43
+ }
44
+ interface ExecuteOptions {
45
+ abortSignal?: AbortSignal;
46
+ }
47
+
48
+ export { type BuilderRequirements as B, type Executor as E, type Query as Q, type ExecuteOptions as a, type QueryResult as b, applyInferredRowFilters as c, inferRowFilter as i };
@@ -0,0 +1,48 @@
1
+ import { T as Table, E as Either } from './adapter-CKFCHq71.cjs';
2
+ import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
3
+
4
+ interface BuilderRequirements {
5
+ Adapter: {
6
+ new (): DialectAdapter;
7
+ };
8
+ noParameters?: boolean;
9
+ QueryCompiler: {
10
+ new (): QueryCompiler;
11
+ };
12
+ }
13
+ declare const queryType: unique symbol;
14
+ interface Query<T = unknown> {
15
+ [queryType]?: T;
16
+ parameters: readonly unknown[];
17
+ sql: string;
18
+ }
19
+ type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
20
+ /**
21
+ * Applies a filter to the given rows based on the primary key columns of the table.
22
+ *
23
+ * @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
24
+ */
25
+ declare function applyInferredRowFilters(rows: Record<string, unknown>[], columns: Table["columns"]): <QB extends WhereInterface<any, any>>(qb: QB) => QB;
26
+ /**
27
+ * Part of a filter that predicts a match.
28
+ * ie. ... WHERE $ColumName = $Value ...
29
+ */
30
+ type RowFilterPredicate = [ColumnName: string, Value: unknown];
31
+ /**
32
+ * A row filter is comprised of one or more predicates.
33
+ */
34
+ type RowFilter = RowFilterPredicate[];
35
+ /**
36
+ * Infers the filter that is necessary to uniquely identify a given row
37
+ * individually.
38
+ */
39
+ declare function inferRowFilter(row: Record<string, unknown>, columns: Table["columns"]): RowFilter;
40
+
41
+ interface Executor {
42
+ execute<Q extends Query>(query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
43
+ }
44
+ interface ExecuteOptions {
45
+ abortSignal?: AbortSignal;
46
+ }
47
+
48
+ export { type BuilderRequirements as B, type Executor as E, type Query as Q, type ExecuteOptions as a, type QueryResult as b, applyInferredRowFilters as c, inferRowFilter as i };