@prisma/studio-core 0.0.0-dev.202503280212 → 0.0.0-dev.202503281209
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/Adapter-C2FVF4Hg.d.cts +119 -0
- package/dist/Adapter-C2FVF4Hg.d.ts +119 -0
- package/dist/data/bff/index.cjs +1 -1
- package/dist/data/bff/index.d.cts +7 -4
- package/dist/data/bff/index.d.ts +7 -4
- package/dist/data/bff/index.js +1 -1
- package/dist/data/index.cjs +1 -1
- package/dist/data/index.d.cts +2 -121
- package/dist/data/index.d.ts +2 -121
- package/dist/data/postgres-core/index.cjs +1 -1
- package/dist/data/postgres-core/index.d.cts +11 -9
- package/dist/data/postgres-core/index.d.ts +11 -9
- package/dist/data/postgres-core/index.js +1 -1
- package/dist/index-KSZNOSSS.css +1728 -0
- package/dist/ui/index.cjs +163 -1
- package/dist/ui/index.d.cts +19 -2
- package/dist/ui/index.d.ts +19 -2
- package/dist/ui/index.js +163 -1
- package/package.json +34 -8
- package/dist/adapter-DKF2h1wc.d.cts +0 -40
- package/dist/adapter-sE-cnGiV.d.ts +0 -40
- package/dist/executor-8ESroQWQ.d.ts +0 -9
- package/dist/executor-D1R5ZdYr.d.cts +0 -9
- package/dist/ui/index.css +0 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
type Either<E, R> = [E] | [null, R];
|
|
2
|
+
interface Adapter {
|
|
3
|
+
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
4
|
+
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
5
|
+
mutate(inputs: MutateInput[]): Promise<Either<Error, MutateResult>>;
|
|
6
|
+
alter(inputs: AlterInput[]): Promise<Either<Error, AlterResult>>;
|
|
7
|
+
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
8
|
+
}
|
|
9
|
+
type EnumName = string;
|
|
10
|
+
type TableName = string;
|
|
11
|
+
type ColumnName = string;
|
|
12
|
+
type SchemaName = string;
|
|
13
|
+
type InstrospectResult = {
|
|
14
|
+
schemas: Record<SchemaName, InstrospectSchemaMeta>;
|
|
15
|
+
filters: Record<QueryFilterOperator, boolean>;
|
|
16
|
+
};
|
|
17
|
+
type InstrospectSchemaMeta = {
|
|
18
|
+
tables: Record<TableName, InstrospectTableMeta>;
|
|
19
|
+
enums: Record<EnumName, EnumMeta>;
|
|
20
|
+
};
|
|
21
|
+
type InstrospectTableMeta = {
|
|
22
|
+
schema: SchemaName;
|
|
23
|
+
name: TableName;
|
|
24
|
+
columns: Record<ColumnName, InstrospectColumnMeta>;
|
|
25
|
+
};
|
|
26
|
+
type InstrospectColumnMeta = {
|
|
27
|
+
schema: SchemaName;
|
|
28
|
+
table: TableName;
|
|
29
|
+
name: ColumnName;
|
|
30
|
+
dataType: IntrospectDataType;
|
|
31
|
+
uiType: IntrospectUiType;
|
|
32
|
+
defaults: unknown;
|
|
33
|
+
nullable: boolean;
|
|
34
|
+
partOfPk: boolean;
|
|
35
|
+
reference: InstrospectTableMeta | null;
|
|
36
|
+
};
|
|
37
|
+
type IntrospectDataType = {
|
|
38
|
+
name: string;
|
|
39
|
+
args: (string | number)[];
|
|
40
|
+
};
|
|
41
|
+
type IntrospectUiType = {
|
|
42
|
+
kind: "string";
|
|
43
|
+
isList: boolean;
|
|
44
|
+
max: number;
|
|
45
|
+
min: number;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "number";
|
|
48
|
+
isList: boolean;
|
|
49
|
+
max: number;
|
|
50
|
+
min: number;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "decimal";
|
|
53
|
+
isList: boolean;
|
|
54
|
+
max: number;
|
|
55
|
+
min: number;
|
|
56
|
+
decimalPlaces: number;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "boolean";
|
|
59
|
+
isList: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "datetime";
|
|
62
|
+
isList: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
kind: "json";
|
|
65
|
+
isList: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
kind: "blob";
|
|
68
|
+
isList: boolean;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "enum";
|
|
71
|
+
isList: boolean;
|
|
72
|
+
name: EnumName;
|
|
73
|
+
values: string[];
|
|
74
|
+
};
|
|
75
|
+
type EnumMeta = {
|
|
76
|
+
name: EnumName;
|
|
77
|
+
values: string[];
|
|
78
|
+
};
|
|
79
|
+
type QueryInput = {
|
|
80
|
+
schema: SchemaName;
|
|
81
|
+
table: TableName;
|
|
82
|
+
filters: QueryFilter[][];
|
|
83
|
+
sortings: QuerySorting[];
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
};
|
|
87
|
+
type QueryFilter = {
|
|
88
|
+
column: ColumnName;
|
|
89
|
+
operator: QueryFilterOperator;
|
|
90
|
+
value: unknown[] | InstrospectColumnMeta[];
|
|
91
|
+
not?: boolean;
|
|
92
|
+
};
|
|
93
|
+
type QuerySorting = {
|
|
94
|
+
column: ColumnName;
|
|
95
|
+
order: "asc" | "desc";
|
|
96
|
+
};
|
|
97
|
+
type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {});
|
|
98
|
+
type QueryResult = {
|
|
99
|
+
schema: SchemaName;
|
|
100
|
+
table: TableName;
|
|
101
|
+
fetchedAt: number;
|
|
102
|
+
duration: number;
|
|
103
|
+
rows: Record<ColumnName, QueryResultColumn>[];
|
|
104
|
+
count: number;
|
|
105
|
+
};
|
|
106
|
+
type QueryResultColumn = {
|
|
107
|
+
column: ColumnName;
|
|
108
|
+
value: unknown;
|
|
109
|
+
dataType?: IntrospectDataType;
|
|
110
|
+
uiType?: IntrospectUiType;
|
|
111
|
+
};
|
|
112
|
+
type MutateInput = {};
|
|
113
|
+
type MutateResult = {};
|
|
114
|
+
type AlterInput = {};
|
|
115
|
+
type AlterResult = {};
|
|
116
|
+
type RawQueryInput = {};
|
|
117
|
+
type RawQueryResult = {};
|
|
118
|
+
|
|
119
|
+
export type { Adapter as A, Either as E, InstrospectResult as I, MutateInput as M, QueryInput as Q, RawQueryInput as R, QueryResult as a, MutateResult as b, AlterInput as c, AlterResult as d, RawQueryResult as e };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
type Either<E, R> = [E] | [null, R];
|
|
2
|
+
interface Adapter {
|
|
3
|
+
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
4
|
+
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
5
|
+
mutate(inputs: MutateInput[]): Promise<Either<Error, MutateResult>>;
|
|
6
|
+
alter(inputs: AlterInput[]): Promise<Either<Error, AlterResult>>;
|
|
7
|
+
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
8
|
+
}
|
|
9
|
+
type EnumName = string;
|
|
10
|
+
type TableName = string;
|
|
11
|
+
type ColumnName = string;
|
|
12
|
+
type SchemaName = string;
|
|
13
|
+
type InstrospectResult = {
|
|
14
|
+
schemas: Record<SchemaName, InstrospectSchemaMeta>;
|
|
15
|
+
filters: Record<QueryFilterOperator, boolean>;
|
|
16
|
+
};
|
|
17
|
+
type InstrospectSchemaMeta = {
|
|
18
|
+
tables: Record<TableName, InstrospectTableMeta>;
|
|
19
|
+
enums: Record<EnumName, EnumMeta>;
|
|
20
|
+
};
|
|
21
|
+
type InstrospectTableMeta = {
|
|
22
|
+
schema: SchemaName;
|
|
23
|
+
name: TableName;
|
|
24
|
+
columns: Record<ColumnName, InstrospectColumnMeta>;
|
|
25
|
+
};
|
|
26
|
+
type InstrospectColumnMeta = {
|
|
27
|
+
schema: SchemaName;
|
|
28
|
+
table: TableName;
|
|
29
|
+
name: ColumnName;
|
|
30
|
+
dataType: IntrospectDataType;
|
|
31
|
+
uiType: IntrospectUiType;
|
|
32
|
+
defaults: unknown;
|
|
33
|
+
nullable: boolean;
|
|
34
|
+
partOfPk: boolean;
|
|
35
|
+
reference: InstrospectTableMeta | null;
|
|
36
|
+
};
|
|
37
|
+
type IntrospectDataType = {
|
|
38
|
+
name: string;
|
|
39
|
+
args: (string | number)[];
|
|
40
|
+
};
|
|
41
|
+
type IntrospectUiType = {
|
|
42
|
+
kind: "string";
|
|
43
|
+
isList: boolean;
|
|
44
|
+
max: number;
|
|
45
|
+
min: number;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "number";
|
|
48
|
+
isList: boolean;
|
|
49
|
+
max: number;
|
|
50
|
+
min: number;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "decimal";
|
|
53
|
+
isList: boolean;
|
|
54
|
+
max: number;
|
|
55
|
+
min: number;
|
|
56
|
+
decimalPlaces: number;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "boolean";
|
|
59
|
+
isList: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "datetime";
|
|
62
|
+
isList: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
kind: "json";
|
|
65
|
+
isList: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
kind: "blob";
|
|
68
|
+
isList: boolean;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "enum";
|
|
71
|
+
isList: boolean;
|
|
72
|
+
name: EnumName;
|
|
73
|
+
values: string[];
|
|
74
|
+
};
|
|
75
|
+
type EnumMeta = {
|
|
76
|
+
name: EnumName;
|
|
77
|
+
values: string[];
|
|
78
|
+
};
|
|
79
|
+
type QueryInput = {
|
|
80
|
+
schema: SchemaName;
|
|
81
|
+
table: TableName;
|
|
82
|
+
filters: QueryFilter[][];
|
|
83
|
+
sortings: QuerySorting[];
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
};
|
|
87
|
+
type QueryFilter = {
|
|
88
|
+
column: ColumnName;
|
|
89
|
+
operator: QueryFilterOperator;
|
|
90
|
+
value: unknown[] | InstrospectColumnMeta[];
|
|
91
|
+
not?: boolean;
|
|
92
|
+
};
|
|
93
|
+
type QuerySorting = {
|
|
94
|
+
column: ColumnName;
|
|
95
|
+
order: "asc" | "desc";
|
|
96
|
+
};
|
|
97
|
+
type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {});
|
|
98
|
+
type QueryResult = {
|
|
99
|
+
schema: SchemaName;
|
|
100
|
+
table: TableName;
|
|
101
|
+
fetchedAt: number;
|
|
102
|
+
duration: number;
|
|
103
|
+
rows: Record<ColumnName, QueryResultColumn>[];
|
|
104
|
+
count: number;
|
|
105
|
+
};
|
|
106
|
+
type QueryResultColumn = {
|
|
107
|
+
column: ColumnName;
|
|
108
|
+
value: unknown;
|
|
109
|
+
dataType?: IntrospectDataType;
|
|
110
|
+
uiType?: IntrospectUiType;
|
|
111
|
+
};
|
|
112
|
+
type MutateInput = {};
|
|
113
|
+
type MutateResult = {};
|
|
114
|
+
type AlterInput = {};
|
|
115
|
+
type AlterResult = {};
|
|
116
|
+
type RawQueryInput = {};
|
|
117
|
+
type RawQueryResult = {};
|
|
118
|
+
|
|
119
|
+
export type { Adapter as A, Either as E, InstrospectResult as I, MutateInput as M, QueryInput as Q, RawQueryInput as R, QueryResult as a, MutateResult as b, AlterInput as c, AlterResult as d, RawQueryResult as e };
|
package/dist/data/bff/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var o in e)i(r,o,{get:e[o],enumerable:!0})},Q=(r,e,o,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of y(e))!d.call(r,t)&&t!==o&&i(r,t,{get:()=>e[t],enumerable:!(u=c(e,t))||u.enumerable});return r};var p=r=>Q(i({},"__esModule",{value:!0}),r);var R={};l(R,{createStudioBFFClient:()=>f});module.exports=p(R);function f(r){let{customHeaders:e,customPayload:o,url:u}=r,t=r.fetch||fetch;return{async query(a){try{let n=await t(u,{body:JSON.stringify({customPayload:o,procedure:"query",query:a}),headers:{Accept:"application/json","Content-Type":"application/json",...e},method:"POST"});if(!n.ok){let s;try{s=await n.text()}catch{s="unknown error"}return{error:new Error(s),results:[]}}return{error:null,results:await n.json()}}catch(n){return{error:n,results:[]}}}}}0&&(module.exports={createStudioBFFClient});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { E as Executor, a as Either } from '../../executor-D1R5ZdYr.cjs';
|
|
2
1
|
import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.cjs';
|
|
3
2
|
import 'kysely';
|
|
4
3
|
|
|
@@ -28,22 +27,26 @@ interface StudioBFFClientProps {
|
|
|
28
27
|
*/
|
|
29
28
|
url: string | URL;
|
|
30
29
|
}
|
|
31
|
-
interface StudioBFFClient
|
|
30
|
+
interface StudioBFFClient {
|
|
32
31
|
/**
|
|
33
32
|
* Requests BFF to query the database.
|
|
34
33
|
*
|
|
35
34
|
* The query is sent as `body.query`.
|
|
36
35
|
*/
|
|
37
|
-
|
|
36
|
+
query<Q extends Query>(this: void, query: Q): Promise<StudioBFFQueryResponse<Q>>;
|
|
38
37
|
}
|
|
39
38
|
interface StudioBFFQueryRequest {
|
|
40
39
|
customPayload?: Record<string, unknown>;
|
|
41
40
|
procedure: "query";
|
|
42
41
|
query: Query<unknown>;
|
|
43
42
|
}
|
|
43
|
+
interface StudioBFFQueryResponse<Q extends Query> {
|
|
44
|
+
error: unknown;
|
|
45
|
+
results: QueryResult<Q>;
|
|
46
|
+
}
|
|
44
47
|
/**
|
|
45
48
|
* Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
|
|
46
49
|
*/
|
|
47
50
|
declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
|
|
48
51
|
|
|
49
|
-
export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, createStudioBFFClient };
|
|
52
|
+
export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFQueryResponse, createStudioBFFClient };
|
package/dist/data/bff/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { E as Executor, a as Either } from '../../executor-8ESroQWQ.js';
|
|
2
1
|
import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.js';
|
|
3
2
|
import 'kysely';
|
|
4
3
|
|
|
@@ -28,22 +27,26 @@ interface StudioBFFClientProps {
|
|
|
28
27
|
*/
|
|
29
28
|
url: string | URL;
|
|
30
29
|
}
|
|
31
|
-
interface StudioBFFClient
|
|
30
|
+
interface StudioBFFClient {
|
|
32
31
|
/**
|
|
33
32
|
* Requests BFF to query the database.
|
|
34
33
|
*
|
|
35
34
|
* The query is sent as `body.query`.
|
|
36
35
|
*/
|
|
37
|
-
|
|
36
|
+
query<Q extends Query>(this: void, query: Q): Promise<StudioBFFQueryResponse<Q>>;
|
|
38
37
|
}
|
|
39
38
|
interface StudioBFFQueryRequest {
|
|
40
39
|
customPayload?: Record<string, unknown>;
|
|
41
40
|
procedure: "query";
|
|
42
41
|
query: Query<unknown>;
|
|
43
42
|
}
|
|
43
|
+
interface StudioBFFQueryResponse<Q extends Query> {
|
|
44
|
+
error: unknown;
|
|
45
|
+
results: QueryResult<Q>;
|
|
46
|
+
}
|
|
44
47
|
/**
|
|
45
48
|
* Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
|
|
46
49
|
*/
|
|
47
50
|
declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
|
|
48
51
|
|
|
49
|
-
export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, createStudioBFFClient };
|
|
52
|
+
export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFQueryResponse, createStudioBFFClient };
|
package/dist/data/bff/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-2FW6TKD6.js";function y(
|
|
1
|
+
import"../../chunk-2FW6TKD6.js";function y(t){let{customHeaders:o,customPayload:n,url:u}=t,s=t.fetch||fetch;return{async query(i){try{let e=await s(u,{body:JSON.stringify({customPayload:n,procedure:"query",query:i}),headers:{Accept:"application/json","Content-Type":"application/json",...o},method:"POST"});if(!e.ok){let r;try{r=await e.text()}catch{r="unknown error"}return{error:new Error(r),results:[]}}return{error:null,results:await e.json()}}catch(e){return{error:e,results:[]}}}}}export{y as createStudioBFFClient};
|
package/dist/data/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var r in e)l(a,r,{get:e[r],enumerable:!0})},o=(a,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of i(e))!m.call(a,s)&&s!==r&&l(a,s,{get:()=>e[s],enumerable:!(n=u(e,s))||n.enumerable});return a};var d=a=>o(l({},"__esModule",{value:!0}),a);var f={};p(f,{AdapterMock:()=>t});module.exports=d(f);var t=class{async introspect(){return[null,{schemas:{public:{tables:{users:{schema:"public",name:"users",columns:{id:{schema:"public",table:"users",name:"id",dataType:{name:"integer",args:[]},uiType:{kind:"number",isList:!1,max:1e4,min:0},defaults:null,nullable:!1,partOfPk:!0,reference:null},name:{schema:"public",table:"users",name:"name",dataType:{name:"varchar",args:[255]},uiType:{kind:"string",isList:!1,max:255,min:0},defaults:null,nullable:!1,partOfPk:!1,reference:null},role:{schema:"public",table:"users",name:"role",dataType:{name:"enum",args:[]},uiType:{kind:"enum",isList:!1,name:"UserRole",values:["admin","user","guest"]},defaults:"user",nullable:!1,partOfPk:!1,reference:null}}},posts:{schema:"public",name:"posts",columns:{id:{schema:"public",table:"posts",name:"id",dataType:{name:"integer",args:[]},uiType:{kind:"number",isList:!1,max:1e4,min:0},defaults:null,nullable:!1,partOfPk:!0,reference:null},title:{schema:"public",table:"posts",name:"title",dataType:{name:"varchar",args:[255]},uiType:{kind:"string",isList:!1,max:255,min:0},defaults:null,nullable:!1,partOfPk:!1,reference:null},content:{schema:"public",table:"posts",name:"content",dataType:{name:"text",args:[]},uiType:{kind:"string",isList:!1,max:1e4,min:0},defaults:null,nullable:!0,partOfPk:!1,reference:null},userId:{schema:"public",table:"posts",name:"userId",dataType:{name:"integer",args:[]},uiType:{kind:"number",isList:!1,max:1e4,min:0},defaults:null,nullable:!1,partOfPk:!1,reference:{schema:"public",name:"users",columns:{}}}}}},enums:{UserRole:{name:"UserRole",values:["admin","user","guest"]}}}},filters:{"=":!0,">=":!0,">":!0,"<=":!0,"<":!0,like:!0,ilike:!1,"is null":!0}}]}async query(e){return[null,{schema:"public",table:"users",fetchedAt:Date.now(),duration:35,count:2,rows:[{id:{column:"id",value:1,dataType:{name:"integer",args:[]},uiType:{kind:"number",isList:!1,max:1e4,min:0}},name:{column:"name",value:"Alice",dataType:{name:"varchar",args:[255]},uiType:{kind:"string",isList:!1,max:255,min:0}},role:{column:"role",value:"admin",dataType:{name:"enum",args:[]},uiType:{kind:"enum",isList:!1,name:"UserRole",values:["admin","user","guest"]}}},{id:{column:"id",value:2,dataType:{name:"integer",args:[]},uiType:{kind:"number",isList:!1,max:1e4,min:0}},name:{column:"name",value:"Bob",dataType:{name:"varchar",args:[255]},uiType:{kind:"string",isList:!1,max:255,min:0}},role:{column:"role",value:"user",dataType:{name:"enum",args:[]},uiType:{kind:"enum",isList:!1,name:"UserRole",values:["admin","user","guest"]}}}]}]}async mutate(e){throw new Error("Method not implemented.")}async alter(e){throw new Error("Method not implemented.")}async rawQuery(e){throw new Error("Method not implemented.")}};0&&(module.exports={AdapterMock});
|
package/dist/data/index.d.cts
CHANGED
|
@@ -1,126 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export { a as Either, E as Executor } from '../executor-D1R5ZdYr.cjs';
|
|
1
|
+
import { A as Adapter, E as Either, I as InstrospectResult, Q as QueryInput, a as QueryResult, M as MutateInput, b as MutateResult, c as AlterInput, d as AlterResult, R as RawQueryInput, e as RawQueryResult } from '../Adapter-C2FVF4Hg.cjs';
|
|
3
2
|
export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.cjs';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
6
|
-
type Either<E, R> = [E] | [null, R];
|
|
7
|
-
interface Adapter {
|
|
8
|
-
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
9
|
-
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
10
|
-
mutate(inputs: MutateInput[]): Promise<Either<Error, MutateResult>>;
|
|
11
|
-
alter(inputs: AlterInput[]): Promise<Either<Error, AlterResult>>;
|
|
12
|
-
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
13
|
-
}
|
|
14
|
-
type EnumName = string;
|
|
15
|
-
type TableName = string;
|
|
16
|
-
type ColumnName = string;
|
|
17
|
-
type SchemaName = string;
|
|
18
|
-
type InstrospectResult = {
|
|
19
|
-
schemas: Record<SchemaName, InstrospectSchemaMeta>;
|
|
20
|
-
filters: Record<QueryFilterOperator, boolean>;
|
|
21
|
-
};
|
|
22
|
-
type InstrospectSchemaMeta = {
|
|
23
|
-
tables: Record<TableName, InstrospectTableMeta>;
|
|
24
|
-
enums: Record<EnumName, EnumMeta>;
|
|
25
|
-
};
|
|
26
|
-
type InstrospectTableMeta = {
|
|
27
|
-
schema: SchemaName;
|
|
28
|
-
name: TableName;
|
|
29
|
-
columns: Record<ColumnName, InstrospectColumnMeta>;
|
|
30
|
-
};
|
|
31
|
-
type InstrospectColumnMeta = {
|
|
32
|
-
schema: SchemaName;
|
|
33
|
-
table: TableName;
|
|
34
|
-
name: ColumnName;
|
|
35
|
-
dataType: IntrospectDataType;
|
|
36
|
-
uiType: IntrospectUiType;
|
|
37
|
-
defaults: unknown;
|
|
38
|
-
nullable: boolean;
|
|
39
|
-
partOfPk: boolean;
|
|
40
|
-
reference: InstrospectTableMeta | null;
|
|
41
|
-
};
|
|
42
|
-
type IntrospectDataType = {
|
|
43
|
-
name: string;
|
|
44
|
-
args: (string | number)[];
|
|
45
|
-
};
|
|
46
|
-
type IntrospectUiType = {
|
|
47
|
-
kind: "string";
|
|
48
|
-
isList: boolean;
|
|
49
|
-
max: number;
|
|
50
|
-
min: number;
|
|
51
|
-
} | {
|
|
52
|
-
kind: "number";
|
|
53
|
-
isList: boolean;
|
|
54
|
-
max: number;
|
|
55
|
-
min: number;
|
|
56
|
-
} | {
|
|
57
|
-
kind: "decimal";
|
|
58
|
-
isList: boolean;
|
|
59
|
-
max: number;
|
|
60
|
-
min: number;
|
|
61
|
-
decimalPlaces: number;
|
|
62
|
-
} | {
|
|
63
|
-
kind: "boolean";
|
|
64
|
-
isList: boolean;
|
|
65
|
-
} | {
|
|
66
|
-
kind: "datetime";
|
|
67
|
-
isList: boolean;
|
|
68
|
-
} | {
|
|
69
|
-
kind: "json";
|
|
70
|
-
isList: boolean;
|
|
71
|
-
} | {
|
|
72
|
-
kind: "blob";
|
|
73
|
-
isList: boolean;
|
|
74
|
-
} | {
|
|
75
|
-
kind: "enum";
|
|
76
|
-
isList: boolean;
|
|
77
|
-
name: EnumName;
|
|
78
|
-
values: string[];
|
|
79
|
-
};
|
|
80
|
-
type EnumMeta = {
|
|
81
|
-
name: EnumName;
|
|
82
|
-
values: string[];
|
|
83
|
-
};
|
|
84
|
-
type QueryInput = {
|
|
85
|
-
schema: SchemaName;
|
|
86
|
-
table: TableName;
|
|
87
|
-
filters: QueryFilter[][];
|
|
88
|
-
sortings: QuerySorting[];
|
|
89
|
-
limit?: number;
|
|
90
|
-
offset?: number;
|
|
91
|
-
};
|
|
92
|
-
type QueryFilter = {
|
|
93
|
-
column: ColumnName;
|
|
94
|
-
operator: QueryFilterOperator;
|
|
95
|
-
value: unknown[] | InstrospectColumnMeta[];
|
|
96
|
-
not?: boolean;
|
|
97
|
-
};
|
|
98
|
-
type QuerySorting = {
|
|
99
|
-
column: ColumnName;
|
|
100
|
-
order: "asc" | "desc";
|
|
101
|
-
};
|
|
102
|
-
type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {});
|
|
103
|
-
type QueryResult = {
|
|
104
|
-
schema: SchemaName;
|
|
105
|
-
table: TableName;
|
|
106
|
-
fetchedAt: number;
|
|
107
|
-
duration: number;
|
|
108
|
-
rows: Record<ColumnName, QueryResultColumn>[];
|
|
109
|
-
count: number;
|
|
110
|
-
};
|
|
111
|
-
type QueryResultColumn = {
|
|
112
|
-
column: ColumnName;
|
|
113
|
-
value: unknown;
|
|
114
|
-
dataType?: IntrospectDataType;
|
|
115
|
-
uiType?: IntrospectUiType;
|
|
116
|
-
};
|
|
117
|
-
type MutateInput = {};
|
|
118
|
-
type MutateResult = {};
|
|
119
|
-
type AlterInput = {};
|
|
120
|
-
type AlterResult = {};
|
|
121
|
-
type RawQueryInput = {};
|
|
122
|
-
type RawQueryResult = {};
|
|
123
|
-
|
|
124
5
|
declare class AdapterMock implements Adapter {
|
|
125
6
|
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
126
7
|
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
@@ -129,4 +10,4 @@ declare class AdapterMock implements Adapter {
|
|
|
129
10
|
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
130
11
|
}
|
|
131
12
|
|
|
132
|
-
export { AdapterMock };
|
|
13
|
+
export { Adapter, AdapterMock };
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,126 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export { a as Either, E as Executor } from '../executor-8ESroQWQ.js';
|
|
1
|
+
import { A as Adapter, E as Either, I as InstrospectResult, Q as QueryInput, a as QueryResult, M as MutateInput, b as MutateResult, c as AlterInput, d as AlterResult, R as RawQueryInput, e as RawQueryResult } from '../Adapter-C2FVF4Hg.js';
|
|
3
2
|
export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.js';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
6
|
-
type Either<E, R> = [E] | [null, R];
|
|
7
|
-
interface Adapter {
|
|
8
|
-
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
9
|
-
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
10
|
-
mutate(inputs: MutateInput[]): Promise<Either<Error, MutateResult>>;
|
|
11
|
-
alter(inputs: AlterInput[]): Promise<Either<Error, AlterResult>>;
|
|
12
|
-
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
13
|
-
}
|
|
14
|
-
type EnumName = string;
|
|
15
|
-
type TableName = string;
|
|
16
|
-
type ColumnName = string;
|
|
17
|
-
type SchemaName = string;
|
|
18
|
-
type InstrospectResult = {
|
|
19
|
-
schemas: Record<SchemaName, InstrospectSchemaMeta>;
|
|
20
|
-
filters: Record<QueryFilterOperator, boolean>;
|
|
21
|
-
};
|
|
22
|
-
type InstrospectSchemaMeta = {
|
|
23
|
-
tables: Record<TableName, InstrospectTableMeta>;
|
|
24
|
-
enums: Record<EnumName, EnumMeta>;
|
|
25
|
-
};
|
|
26
|
-
type InstrospectTableMeta = {
|
|
27
|
-
schema: SchemaName;
|
|
28
|
-
name: TableName;
|
|
29
|
-
columns: Record<ColumnName, InstrospectColumnMeta>;
|
|
30
|
-
};
|
|
31
|
-
type InstrospectColumnMeta = {
|
|
32
|
-
schema: SchemaName;
|
|
33
|
-
table: TableName;
|
|
34
|
-
name: ColumnName;
|
|
35
|
-
dataType: IntrospectDataType;
|
|
36
|
-
uiType: IntrospectUiType;
|
|
37
|
-
defaults: unknown;
|
|
38
|
-
nullable: boolean;
|
|
39
|
-
partOfPk: boolean;
|
|
40
|
-
reference: InstrospectTableMeta | null;
|
|
41
|
-
};
|
|
42
|
-
type IntrospectDataType = {
|
|
43
|
-
name: string;
|
|
44
|
-
args: (string | number)[];
|
|
45
|
-
};
|
|
46
|
-
type IntrospectUiType = {
|
|
47
|
-
kind: "string";
|
|
48
|
-
isList: boolean;
|
|
49
|
-
max: number;
|
|
50
|
-
min: number;
|
|
51
|
-
} | {
|
|
52
|
-
kind: "number";
|
|
53
|
-
isList: boolean;
|
|
54
|
-
max: number;
|
|
55
|
-
min: number;
|
|
56
|
-
} | {
|
|
57
|
-
kind: "decimal";
|
|
58
|
-
isList: boolean;
|
|
59
|
-
max: number;
|
|
60
|
-
min: number;
|
|
61
|
-
decimalPlaces: number;
|
|
62
|
-
} | {
|
|
63
|
-
kind: "boolean";
|
|
64
|
-
isList: boolean;
|
|
65
|
-
} | {
|
|
66
|
-
kind: "datetime";
|
|
67
|
-
isList: boolean;
|
|
68
|
-
} | {
|
|
69
|
-
kind: "json";
|
|
70
|
-
isList: boolean;
|
|
71
|
-
} | {
|
|
72
|
-
kind: "blob";
|
|
73
|
-
isList: boolean;
|
|
74
|
-
} | {
|
|
75
|
-
kind: "enum";
|
|
76
|
-
isList: boolean;
|
|
77
|
-
name: EnumName;
|
|
78
|
-
values: string[];
|
|
79
|
-
};
|
|
80
|
-
type EnumMeta = {
|
|
81
|
-
name: EnumName;
|
|
82
|
-
values: string[];
|
|
83
|
-
};
|
|
84
|
-
type QueryInput = {
|
|
85
|
-
schema: SchemaName;
|
|
86
|
-
table: TableName;
|
|
87
|
-
filters: QueryFilter[][];
|
|
88
|
-
sortings: QuerySorting[];
|
|
89
|
-
limit?: number;
|
|
90
|
-
offset?: number;
|
|
91
|
-
};
|
|
92
|
-
type QueryFilter = {
|
|
93
|
-
column: ColumnName;
|
|
94
|
-
operator: QueryFilterOperator;
|
|
95
|
-
value: unknown[] | InstrospectColumnMeta[];
|
|
96
|
-
not?: boolean;
|
|
97
|
-
};
|
|
98
|
-
type QuerySorting = {
|
|
99
|
-
column: ColumnName;
|
|
100
|
-
order: "asc" | "desc";
|
|
101
|
-
};
|
|
102
|
-
type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {});
|
|
103
|
-
type QueryResult = {
|
|
104
|
-
schema: SchemaName;
|
|
105
|
-
table: TableName;
|
|
106
|
-
fetchedAt: number;
|
|
107
|
-
duration: number;
|
|
108
|
-
rows: Record<ColumnName, QueryResultColumn>[];
|
|
109
|
-
count: number;
|
|
110
|
-
};
|
|
111
|
-
type QueryResultColumn = {
|
|
112
|
-
column: ColumnName;
|
|
113
|
-
value: unknown;
|
|
114
|
-
dataType?: IntrospectDataType;
|
|
115
|
-
uiType?: IntrospectUiType;
|
|
116
|
-
};
|
|
117
|
-
type MutateInput = {};
|
|
118
|
-
type MutateResult = {};
|
|
119
|
-
type AlterInput = {};
|
|
120
|
-
type AlterResult = {};
|
|
121
|
-
type RawQueryInput = {};
|
|
122
|
-
type RawQueryResult = {};
|
|
123
|
-
|
|
124
5
|
declare class AdapterMock implements Adapter {
|
|
125
6
|
introspect(): Promise<Either<Error, InstrospectResult>>;
|
|
126
7
|
query(input: QueryInput): Promise<Either<Error, QueryResult>>;
|
|
@@ -129,4 +10,4 @@ declare class AdapterMock implements Adapter {
|
|
|
129
10
|
rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
|
|
130
11
|
}
|
|
131
12
|
|
|
132
|
-
export { AdapterMock };
|
|
13
|
+
export { Adapter, AdapterMock };
|