@prisma/studio-core 0.1.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.
- package/dist/{CPIOZS5X-NALOZFPD.js → CPIOZS5X-V4BHP4CI.js} +1 -1
- package/dist/{OKF6E45R-6KC3BLVB.js → OKF6E45R-XYOIK2NY.js} +1 -1
- package/dist/{adapter-Co8KY8Hi.d.cts → adapter-CKFCHq71.d.cts} +40 -5
- package/dist/{adapter-Co8KY8Hi.d.ts → adapter-CKFCHq71.d.ts} +40 -5
- package/dist/chunk-2ZJZX5I7.js +0 -0
- package/dist/chunk-BMVJYUJW.js +1 -0
- package/dist/chunk-P72NBTYE.js +1 -0
- package/dist/chunk-XS52QRY2.js +1 -0
- package/dist/data/accelerate/index.d.cts +2 -2
- package/dist/data/accelerate/index.d.ts +2 -2
- package/dist/data/accelerate/index.js +1 -1
- package/dist/data/bff/index.d.cts +2 -2
- package/dist/data/bff/index.d.ts +2 -2
- package/dist/data/bff/index.js +1 -1
- package/dist/data/index.cjs +1 -1
- package/dist/data/index.d.cts +2 -2
- package/dist/data/index.d.ts +2 -2
- package/dist/data/index.js +1 -1
- package/dist/data/pglite/index.cjs +1 -1
- package/dist/data/pglite/index.d.cts +22 -5
- package/dist/data/pglite/index.d.ts +22 -5
- package/dist/data/pglite/index.js +1 -1
- package/dist/data/postgres-core/index.cjs +1 -1
- package/dist/data/postgres-core/index.d.cts +35 -10
- package/dist/data/postgres-core/index.d.ts +35 -10
- package/dist/data/postgres-core/index.js +1 -1
- package/dist/{index-M4EjPWNJ.d.ts → index-BDPv5Gnt.d.ts} +19 -6
- package/dist/{index-CnVNNyod.d.cts → index-BNAA6jKD.d.cts} +19 -6
- package/dist/ui/index.cjs +62 -54
- package/dist/ui/index.css +154 -41
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +14 -6
- package/package.json +5 -2
- package/dist/chunk-2FW6TKD6.js +0 -1
- package/dist/chunk-RGBMDID6.js +0 -1
- package/dist/chunk-ZCFLMQMM.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Adapter, T as Table, a as AdapterInsertDetails, b as AdapterQueryDetails, c as AdapterUpdateDetails } from '../../adapter-
|
|
2
|
-
import { E as Executor, B as BuilderRequirements, Q as Query } from '../../index-
|
|
3
|
-
import 'kysely';
|
|
1
|
+
import { A as Adapter, T as Table, a as AdapterInsertDetails, b as AdapterQueryDetails, c as AdapterUpdateDetails, d as AdapterDeleteDetails } from '../../adapter-CKFCHq71.cjs';
|
|
2
|
+
import { E as Executor, B as BuilderRequirements, Q as Query } from '../../index-BNAA6jKD.cjs';
|
|
3
|
+
import * as kysely from 'kysely';
|
|
4
4
|
|
|
5
5
|
interface PostgresAdapterRequirements {
|
|
6
6
|
executor: Executor;
|
|
@@ -26,10 +26,7 @@ declare function mockIntrospect(): {
|
|
|
26
26
|
*/
|
|
27
27
|
type CTIDasText = `(${number},${number})`;
|
|
28
28
|
/**
|
|
29
|
-
* Inserts
|
|
30
|
-
* The `ctid` is returned as a string in the format `(blockNumber, tupleIndex)`.
|
|
31
|
-
* This is useful for identifying the row in the table, even if it has no primary key or unique constraints.
|
|
32
|
-
* The `ctid` is a system column that represents the physical location of a row in a table.
|
|
29
|
+
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
|
|
33
30
|
*/
|
|
34
31
|
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
|
|
35
32
|
[x: string]: unknown;
|
|
@@ -41,8 +38,8 @@ declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Om
|
|
|
41
38
|
*/
|
|
42
39
|
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
|
|
43
40
|
[x: string]: unknown;
|
|
44
|
-
ctid: `(${number},${number})`;
|
|
45
41
|
oid: `${bigint}`;
|
|
42
|
+
ctid: `(${number},${number})`;
|
|
46
43
|
}>;
|
|
47
44
|
/**
|
|
48
45
|
* For testing purposes.
|
|
@@ -72,6 +69,10 @@ declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Om
|
|
|
72
69
|
ctid: `(${number},${number})`;
|
|
73
70
|
__ps_updated_at__: `${bigint}`;
|
|
74
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>;
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
78
|
* Returns a query that returns metadata for all user-defined tables and views in the database.
|
|
@@ -82,7 +83,11 @@ declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapte
|
|
|
82
83
|
columns: {
|
|
83
84
|
name: string;
|
|
84
85
|
datatype: string;
|
|
86
|
+
datatype_schema: string;
|
|
85
87
|
pk: boolean;
|
|
88
|
+
computed: boolean;
|
|
89
|
+
nullable: boolean;
|
|
90
|
+
options: string[];
|
|
86
91
|
}[];
|
|
87
92
|
}>;
|
|
88
93
|
/**
|
|
@@ -94,23 +99,43 @@ declare function mockTablesQuery(): [{
|
|
|
94
99
|
readonly columns: [{
|
|
95
100
|
readonly name: "id";
|
|
96
101
|
readonly datatype: "bigint";
|
|
102
|
+
readonly datatype_schema: "public";
|
|
97
103
|
readonly pk: true;
|
|
104
|
+
readonly computed: false;
|
|
105
|
+
readonly options: [];
|
|
106
|
+
readonly nullable: true;
|
|
98
107
|
}, {
|
|
99
108
|
readonly name: "name";
|
|
100
109
|
readonly datatype: "varchar";
|
|
110
|
+
readonly datatype_schema: "public";
|
|
101
111
|
readonly pk: false;
|
|
112
|
+
readonly computed: false;
|
|
113
|
+
readonly options: [];
|
|
114
|
+
readonly nullable: true;
|
|
102
115
|
}, {
|
|
103
116
|
readonly name: "role";
|
|
104
|
-
readonly datatype: "
|
|
117
|
+
readonly datatype: "role";
|
|
118
|
+
readonly datatype_schema: "public";
|
|
105
119
|
readonly pk: false;
|
|
120
|
+
readonly computed: false;
|
|
121
|
+
readonly options: ["admin", "maintainer", "member"];
|
|
122
|
+
readonly nullable: true;
|
|
106
123
|
}, {
|
|
107
124
|
readonly name: "created_at";
|
|
108
125
|
readonly datatype: "timestamptz";
|
|
126
|
+
readonly datatype_schema: "public";
|
|
109
127
|
readonly pk: false;
|
|
128
|
+
readonly computed: false;
|
|
129
|
+
readonly options: [];
|
|
130
|
+
readonly nullable: true;
|
|
110
131
|
}, {
|
|
111
132
|
readonly name: "deleted_at";
|
|
112
133
|
readonly datatype: "timestamptz";
|
|
134
|
+
readonly datatype_schema: "public";
|
|
113
135
|
readonly pk: false;
|
|
136
|
+
readonly computed: false;
|
|
137
|
+
readonly options: [];
|
|
138
|
+
readonly nullable: true;
|
|
114
139
|
}];
|
|
115
140
|
}];
|
|
116
141
|
/**
|
|
@@ -126,4 +151,4 @@ declare function mockTimezoneQuery(): [{
|
|
|
126
151
|
readonly timezone: "UTC";
|
|
127
152
|
}];
|
|
128
153
|
|
|
129
|
-
export { type CTIDasText, type PostgresAdapterRequirements, createPostgresAdapter, getInsertQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };
|
|
154
|
+
export { type CTIDasText, type PostgresAdapterRequirements, createPostgresAdapter, getDeleteQuery, getInsertQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Adapter, T as Table, a as AdapterInsertDetails, b as AdapterQueryDetails, c as AdapterUpdateDetails } from '../../adapter-
|
|
2
|
-
import { E as Executor, B as BuilderRequirements, Q as Query } from '../../index-
|
|
3
|
-
import 'kysely';
|
|
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
4
|
|
|
5
5
|
interface PostgresAdapterRequirements {
|
|
6
6
|
executor: Executor;
|
|
@@ -26,10 +26,7 @@ declare function mockIntrospect(): {
|
|
|
26
26
|
*/
|
|
27
27
|
type CTIDasText = `(${number},${number})`;
|
|
28
28
|
/**
|
|
29
|
-
* Inserts
|
|
30
|
-
* The `ctid` is returned as a string in the format `(blockNumber, tupleIndex)`.
|
|
31
|
-
* This is useful for identifying the row in the table, even if it has no primary key or unique constraints.
|
|
32
|
-
* The `ctid` is a system column that represents the physical location of a row in a table.
|
|
29
|
+
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
|
|
33
30
|
*/
|
|
34
31
|
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
|
|
35
32
|
[x: string]: unknown;
|
|
@@ -41,8 +38,8 @@ declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Om
|
|
|
41
38
|
*/
|
|
42
39
|
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
|
|
43
40
|
[x: string]: unknown;
|
|
44
|
-
ctid: `(${number},${number})`;
|
|
45
41
|
oid: `${bigint}`;
|
|
42
|
+
ctid: `(${number},${number})`;
|
|
46
43
|
}>;
|
|
47
44
|
/**
|
|
48
45
|
* For testing purposes.
|
|
@@ -72,6 +69,10 @@ declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Om
|
|
|
72
69
|
ctid: `(${number},${number})`;
|
|
73
70
|
__ps_updated_at__: `${bigint}`;
|
|
74
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>;
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
78
|
* Returns a query that returns metadata for all user-defined tables and views in the database.
|
|
@@ -82,7 +83,11 @@ declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapte
|
|
|
82
83
|
columns: {
|
|
83
84
|
name: string;
|
|
84
85
|
datatype: string;
|
|
86
|
+
datatype_schema: string;
|
|
85
87
|
pk: boolean;
|
|
88
|
+
computed: boolean;
|
|
89
|
+
nullable: boolean;
|
|
90
|
+
options: string[];
|
|
86
91
|
}[];
|
|
87
92
|
}>;
|
|
88
93
|
/**
|
|
@@ -94,23 +99,43 @@ declare function mockTablesQuery(): [{
|
|
|
94
99
|
readonly columns: [{
|
|
95
100
|
readonly name: "id";
|
|
96
101
|
readonly datatype: "bigint";
|
|
102
|
+
readonly datatype_schema: "public";
|
|
97
103
|
readonly pk: true;
|
|
104
|
+
readonly computed: false;
|
|
105
|
+
readonly options: [];
|
|
106
|
+
readonly nullable: true;
|
|
98
107
|
}, {
|
|
99
108
|
readonly name: "name";
|
|
100
109
|
readonly datatype: "varchar";
|
|
110
|
+
readonly datatype_schema: "public";
|
|
101
111
|
readonly pk: false;
|
|
112
|
+
readonly computed: false;
|
|
113
|
+
readonly options: [];
|
|
114
|
+
readonly nullable: true;
|
|
102
115
|
}, {
|
|
103
116
|
readonly name: "role";
|
|
104
|
-
readonly datatype: "
|
|
117
|
+
readonly datatype: "role";
|
|
118
|
+
readonly datatype_schema: "public";
|
|
105
119
|
readonly pk: false;
|
|
120
|
+
readonly computed: false;
|
|
121
|
+
readonly options: ["admin", "maintainer", "member"];
|
|
122
|
+
readonly nullable: true;
|
|
106
123
|
}, {
|
|
107
124
|
readonly name: "created_at";
|
|
108
125
|
readonly datatype: "timestamptz";
|
|
126
|
+
readonly datatype_schema: "public";
|
|
109
127
|
readonly pk: false;
|
|
128
|
+
readonly computed: false;
|
|
129
|
+
readonly options: [];
|
|
130
|
+
readonly nullable: true;
|
|
110
131
|
}, {
|
|
111
132
|
readonly name: "deleted_at";
|
|
112
133
|
readonly datatype: "timestamptz";
|
|
134
|
+
readonly datatype_schema: "public";
|
|
113
135
|
readonly pk: false;
|
|
136
|
+
readonly computed: false;
|
|
137
|
+
readonly options: [];
|
|
138
|
+
readonly nullable: true;
|
|
114
139
|
}];
|
|
115
140
|
}];
|
|
116
141
|
/**
|
|
@@ -126,4 +151,4 @@ declare function mockTimezoneQuery(): [{
|
|
|
126
151
|
readonly timezone: "UTC";
|
|
127
152
|
}];
|
|
128
153
|
|
|
129
|
-
export { type CTIDasText, type PostgresAdapterRequirements, createPostgresAdapter, getInsertQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };
|
|
154
|
+
export { type CTIDasText, type PostgresAdapterRequirements, createPostgresAdapter, getDeleteQuery, getInsertQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"../../chunk-
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Table, E as Either } from './adapter-
|
|
1
|
+
import { T as Table, E as Either } from './adapter-CKFCHq71.js';
|
|
2
2
|
import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
|
|
3
3
|
|
|
4
4
|
interface BuilderRequirements {
|
|
@@ -18,12 +18,25 @@ interface Query<T = unknown> {
|
|
|
18
18
|
}
|
|
19
19
|
type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
|
|
20
20
|
/**
|
|
21
|
-
* Applies a filter to the given
|
|
21
|
+
* Applies a filter to the given rows based on the primary key columns of the table.
|
|
22
22
|
*
|
|
23
|
-
* @example db.selectFrom("users").$call(
|
|
23
|
+
* @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
|
|
24
24
|
*/
|
|
25
|
-
declare function
|
|
26
|
-
|
|
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;
|
|
27
40
|
|
|
28
41
|
interface Executor {
|
|
29
42
|
execute<Q extends Query>(query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
@@ -32,4 +45,4 @@ interface ExecuteOptions {
|
|
|
32
45
|
abortSignal?: AbortSignal;
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
export { type BuilderRequirements as B, type Executor as E, type Query as Q, type ExecuteOptions as a, type QueryResult as b,
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Table, E as Either } from './adapter-
|
|
1
|
+
import { T as Table, E as Either } from './adapter-CKFCHq71.cjs';
|
|
2
2
|
import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
|
|
3
3
|
|
|
4
4
|
interface BuilderRequirements {
|
|
@@ -18,12 +18,25 @@ interface Query<T = unknown> {
|
|
|
18
18
|
}
|
|
19
19
|
type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
|
|
20
20
|
/**
|
|
21
|
-
* Applies a filter to the given
|
|
21
|
+
* Applies a filter to the given rows based on the primary key columns of the table.
|
|
22
22
|
*
|
|
23
|
-
* @example db.selectFrom("users").$call(
|
|
23
|
+
* @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
|
|
24
24
|
*/
|
|
25
|
-
declare function
|
|
26
|
-
|
|
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;
|
|
27
40
|
|
|
28
41
|
interface Executor {
|
|
29
42
|
execute<Q extends Query>(query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
@@ -32,4 +45,4 @@ interface ExecuteOptions {
|
|
|
32
45
|
abortSignal?: AbortSignal;
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
export { type BuilderRequirements as B, type Executor as E, type Query as Q, type ExecuteOptions as a, type QueryResult as b,
|
|
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 };
|