@prisma/studio-core 0.0.0-dev.202503272054 → 0.0.0-dev.202503280212

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.
@@ -0,0 +1,40 @@
1
+ import { a as Either } from './executor-D1R5ZdYr.cjs';
2
+
3
+ interface Adapter {
4
+ introspect(): Promise<Either<Error, Introspection>>;
5
+ query(details: QueryDetails): Promise<Either<Error, QueryResult>>;
6
+ }
7
+ type SchemaName = string;
8
+ interface Introspection {
9
+ schemas: Record<SchemaName, Schema>;
10
+ }
11
+ type TableName = string;
12
+ interface Schema {
13
+ tables: Record<TableName, Table>;
14
+ }
15
+ type ColumnName = string;
16
+ interface Table {
17
+ schema: SchemaName;
18
+ name: TableName;
19
+ columns: Record<ColumnName, Column>;
20
+ }
21
+ interface Column {
22
+ schema: SchemaName;
23
+ table: TableName;
24
+ name: ColumnName;
25
+ }
26
+ interface QueryDetails {
27
+ /**
28
+ * The database schema where the table is located. Defaults to "public".
29
+ */
30
+ schema?: string;
31
+ /**
32
+ * The name of the table to select from.
33
+ */
34
+ table: string;
35
+ }
36
+ interface QueryResult {
37
+ rows: Record<ColumnName, unknown>[];
38
+ }
39
+
40
+ export type { Adapter as A, Column as C, Introspection as I, QueryDetails as Q, Schema as S, Table as T };
@@ -0,0 +1,40 @@
1
+ import { a as Either } from './executor-8ESroQWQ.js';
2
+
3
+ interface Adapter {
4
+ introspect(): Promise<Either<Error, Introspection>>;
5
+ query(details: QueryDetails): Promise<Either<Error, QueryResult>>;
6
+ }
7
+ type SchemaName = string;
8
+ interface Introspection {
9
+ schemas: Record<SchemaName, Schema>;
10
+ }
11
+ type TableName = string;
12
+ interface Schema {
13
+ tables: Record<TableName, Table>;
14
+ }
15
+ type ColumnName = string;
16
+ interface Table {
17
+ schema: SchemaName;
18
+ name: TableName;
19
+ columns: Record<ColumnName, Column>;
20
+ }
21
+ interface Column {
22
+ schema: SchemaName;
23
+ table: TableName;
24
+ name: ColumnName;
25
+ }
26
+ interface QueryDetails {
27
+ /**
28
+ * The database schema where the table is located. Defaults to "public".
29
+ */
30
+ schema?: string;
31
+ /**
32
+ * The name of the table to select from.
33
+ */
34
+ table: string;
35
+ }
36
+ interface QueryResult {
37
+ rows: Record<ColumnName, unknown>[];
38
+ }
39
+
40
+ export type { Adapter as A, Column as C, Introspection as I, QueryDetails as Q, Schema as S, Table as T };
@@ -1 +1 @@
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
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!d.call(t,r)&&r!==o&&i(t,r,{get:()=>e[r],enumerable:!(n=a(e,r))||n.enumerable});return t};var f=t=>p(i({},"__esModule",{value:!0}),t);var x={};l(x,{createStudioBFFClient:()=>m});module.exports=f(x);function m(t){let{customHeaders:e,customPayload:o,url:n}=t,r=t.fetch||fetch;return{async execute(c){try{let u=await r(n,{body:JSON.stringify({customPayload:o,procedure:"query",query:c}),headers:{Accept:"application/json","Content-Type":"application/json",...e},method:"POST"});if(!u.ok){let s;try{s=await u.text()}catch{s="unknown error"}return[new Error(s)]}return[null,await u.json()]}catch(u){return[u]}}}}0&&(module.exports={createStudioBFFClient});
@@ -1,3 +1,4 @@
1
+ import { E as Executor, a as Either } from '../../executor-D1R5ZdYr.cjs';
1
2
  import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.cjs';
2
3
  import 'kysely';
3
4
 
@@ -27,26 +28,22 @@ interface StudioBFFClientProps {
27
28
  */
28
29
  url: string | URL;
29
30
  }
30
- interface StudioBFFClient {
31
+ interface StudioBFFClient extends Executor {
31
32
  /**
32
33
  * Requests BFF to query the database.
33
34
  *
34
35
  * The query is sent as `body.query`.
35
36
  */
36
- query<Q extends Query>(this: void, query: Q): Promise<StudioBFFQueryResponse<Q>>;
37
+ execute<Q extends Query>(this: void, query: Q): Promise<Either<Error, QueryResult<Q>>>;
37
38
  }
38
39
  interface StudioBFFQueryRequest {
39
40
  customPayload?: Record<string, unknown>;
40
41
  procedure: "query";
41
42
  query: Query<unknown>;
42
43
  }
43
- interface StudioBFFQueryResponse<Q extends Query> {
44
- error: unknown;
45
- results: QueryResult<Q>;
46
- }
47
44
  /**
48
45
  * Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
49
46
  */
50
47
  declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
51
48
 
52
- export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFQueryResponse, createStudioBFFClient };
49
+ export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, createStudioBFFClient };
@@ -1,3 +1,4 @@
1
+ import { E as Executor, a as Either } from '../../executor-8ESroQWQ.js';
1
2
  import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.js';
2
3
  import 'kysely';
3
4
 
@@ -27,26 +28,22 @@ interface StudioBFFClientProps {
27
28
  */
28
29
  url: string | URL;
29
30
  }
30
- interface StudioBFFClient {
31
+ interface StudioBFFClient extends Executor {
31
32
  /**
32
33
  * Requests BFF to query the database.
33
34
  *
34
35
  * The query is sent as `body.query`.
35
36
  */
36
- query<Q extends Query>(this: void, query: Q): Promise<StudioBFFQueryResponse<Q>>;
37
+ execute<Q extends Query>(this: void, query: Q): Promise<Either<Error, QueryResult<Q>>>;
37
38
  }
38
39
  interface StudioBFFQueryRequest {
39
40
  customPayload?: Record<string, unknown>;
40
41
  procedure: "query";
41
42
  query: Query<unknown>;
42
43
  }
43
- interface StudioBFFQueryResponse<Q extends Query> {
44
- error: unknown;
45
- results: QueryResult<Q>;
46
- }
47
44
  /**
48
45
  * Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
49
46
  */
50
47
  declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
51
48
 
52
- export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFQueryResponse, createStudioBFFClient };
49
+ export { type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, createStudioBFFClient };
@@ -1 +1 @@
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};
1
+ import"../../chunk-2FW6TKD6.js";function y(r){let{customHeaders:o,customPayload:u,url:n}=r,s=r.fetch||fetch;return{async execute(i){try{let e=await s(n,{body:JSON.stringify({customPayload:u,procedure:"query",query:i}),headers:{Accept:"application/json","Content-Type":"application/json",...o},method:"POST"});if(!e.ok){let t;try{t=await e.text()}catch{t="unknown error"}return[new Error(t)]}return[null,await e.json()]}catch(e){return[e]}}}}export{y as createStudioBFFClient};
@@ -1 +1 @@
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});
1
+ "use strict";var l=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},o=(a,e,t,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of i(e))!m.call(a,r)&&r!==t&&l(a,r,{get:()=>e[r],enumerable:!(u=n(e,r))||u.enumerable});return a};var c=a=>o(l({},"__esModule",{value:!0}),a);var f={};p(f,{AdapterMock:()=>s});module.exports=c(f);var s=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});
@@ -1,7 +1,126 @@
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';
1
+ export { A as Adapter, C as Column, I as Introspection, Q as QueryDetails, S as Schema, T as Table } from '../adapter-DKF2h1wc.cjs';
2
+ export { a as Either, E as Executor } from '../executor-D1R5ZdYr.cjs';
2
3
  export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.cjs';
3
4
  import 'kysely';
4
5
 
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
+
5
124
  declare class AdapterMock implements Adapter {
6
125
  introspect(): Promise<Either<Error, InstrospectResult>>;
7
126
  query(input: QueryInput): Promise<Either<Error, QueryResult>>;
@@ -10,4 +129,4 @@ declare class AdapterMock implements Adapter {
10
129
  rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
11
130
  }
12
131
 
13
- export { Adapter, AdapterMock };
132
+ export { AdapterMock };
@@ -1,7 +1,126 @@
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';
1
+ export { A as Adapter, C as Column, I as Introspection, Q as QueryDetails, S as Schema, T as Table } from '../adapter-sE-cnGiV.js';
2
+ export { a as Either, E as Executor } from '../executor-8ESroQWQ.js';
2
3
  export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.js';
3
4
  import 'kysely';
4
5
 
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
+
5
124
  declare class AdapterMock implements Adapter {
6
125
  introspect(): Promise<Either<Error, InstrospectResult>>;
7
126
  query(input: QueryInput): Promise<Either<Error, QueryResult>>;
@@ -10,4 +129,4 @@ declare class AdapterMock implements Adapter {
10
129
  rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>>;
11
130
  }
12
131
 
13
- export { Adapter, AdapterMock };
132
+ export { AdapterMock };