@prisma/studio-core 0.0.0-dev.202504092118 → 0.0.0-dev.202504102204
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-CqrlY1Ga.d.ts +61 -0
- package/dist/adapter-D0mwGLmg.d.cts +61 -0
- package/dist/data/accelerate/index.cjs +1 -1
- package/dist/data/accelerate/index.d.cts +4 -3
- package/dist/data/accelerate/index.d.ts +4 -3
- package/dist/data/accelerate/index.js +1 -1
- package/dist/data/bff/index.cjs +1 -1
- package/dist/data/bff/index.d.cts +2 -3
- package/dist/data/bff/index.d.ts +2 -3
- package/dist/data/bff/index.js +1 -1
- package/dist/data/index.d.cts +2 -3
- package/dist/data/index.d.ts +2 -3
- package/dist/data/postgres-core/index.cjs +1 -1
- package/dist/data/postgres-core/index.d.cts +2 -3
- package/dist/data/postgres-core/index.d.ts +2 -3
- package/dist/data/postgres-core/index.js +1 -1
- package/dist/{query-L1_vLuFd.d.ts → executor-BLAClqkI.d.cts} +9 -1
- package/dist/{query-L1_vLuFd.d.cts → executor-CySfZPUK.d.ts} +9 -1
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/adapter-08vtHScw.d.ts +0 -40
- package/dist/adapter-CW2L6BRg.d.cts +0 -40
- package/dist/executor-BjkBF_Xv.d.ts +0 -8
- package/dist/executor-DVs9UVdS.d.cts +0 -8
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { E as Either } from './type-utils-rTHUvEmt.js';
|
|
2
|
+
|
|
3
|
+
interface Adapter {
|
|
4
|
+
/**
|
|
5
|
+
* The schema studio will choose by default.
|
|
6
|
+
*
|
|
7
|
+
* e.g. `public` for PostgreSQL
|
|
8
|
+
*/
|
|
9
|
+
readonly defaultSchema?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Introspects the database and returns structured information about the schemas, tables, etc.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Options for the introspection request.
|
|
14
|
+
*/
|
|
15
|
+
introspect(options: IntrospectOptions): Promise<Either<Error, Introspection>>;
|
|
16
|
+
/**
|
|
17
|
+
* Executes a structured query against the database.
|
|
18
|
+
*/
|
|
19
|
+
query(details: QueryDetails, options: QueryOptions): Promise<Either<Error, QueryResult>>;
|
|
20
|
+
}
|
|
21
|
+
interface BaseOptions {
|
|
22
|
+
abortSignal: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
interface IntrospectOptions extends BaseOptions {
|
|
25
|
+
}
|
|
26
|
+
interface QueryOptions extends BaseOptions {
|
|
27
|
+
}
|
|
28
|
+
type SchemaName = string;
|
|
29
|
+
interface Introspection {
|
|
30
|
+
schemas: Record<SchemaName, Schema>;
|
|
31
|
+
}
|
|
32
|
+
type TableName = string;
|
|
33
|
+
interface Schema {
|
|
34
|
+
tables: Record<TableName, Table>;
|
|
35
|
+
}
|
|
36
|
+
type ColumnName = string;
|
|
37
|
+
interface Table {
|
|
38
|
+
schema: SchemaName;
|
|
39
|
+
name: TableName;
|
|
40
|
+
columns: Record<ColumnName, Column>;
|
|
41
|
+
}
|
|
42
|
+
interface Column {
|
|
43
|
+
schema: SchemaName;
|
|
44
|
+
table: TableName;
|
|
45
|
+
name: ColumnName;
|
|
46
|
+
}
|
|
47
|
+
interface QueryDetails {
|
|
48
|
+
/**
|
|
49
|
+
* The database schema where the table is located. Defaults to "public".
|
|
50
|
+
*/
|
|
51
|
+
schema?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The name of the table to select from.
|
|
54
|
+
*/
|
|
55
|
+
table: string;
|
|
56
|
+
}
|
|
57
|
+
interface QueryResult {
|
|
58
|
+
rows: Record<ColumnName, unknown>[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { Adapter as A, BaseOptions as B, Column as C, IntrospectOptions as I, QueryOptions as Q, Schema as S, Table as T, Introspection as a, QueryDetails as b };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { E as Either } from './type-utils-rTHUvEmt.cjs';
|
|
2
|
+
|
|
3
|
+
interface Adapter {
|
|
4
|
+
/**
|
|
5
|
+
* The schema studio will choose by default.
|
|
6
|
+
*
|
|
7
|
+
* e.g. `public` for PostgreSQL
|
|
8
|
+
*/
|
|
9
|
+
readonly defaultSchema?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Introspects the database and returns structured information about the schemas, tables, etc.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Options for the introspection request.
|
|
14
|
+
*/
|
|
15
|
+
introspect(options: IntrospectOptions): Promise<Either<Error, Introspection>>;
|
|
16
|
+
/**
|
|
17
|
+
* Executes a structured query against the database.
|
|
18
|
+
*/
|
|
19
|
+
query(details: QueryDetails, options: QueryOptions): Promise<Either<Error, QueryResult>>;
|
|
20
|
+
}
|
|
21
|
+
interface BaseOptions {
|
|
22
|
+
abortSignal: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
interface IntrospectOptions extends BaseOptions {
|
|
25
|
+
}
|
|
26
|
+
interface QueryOptions extends BaseOptions {
|
|
27
|
+
}
|
|
28
|
+
type SchemaName = string;
|
|
29
|
+
interface Introspection {
|
|
30
|
+
schemas: Record<SchemaName, Schema>;
|
|
31
|
+
}
|
|
32
|
+
type TableName = string;
|
|
33
|
+
interface Schema {
|
|
34
|
+
tables: Record<TableName, Table>;
|
|
35
|
+
}
|
|
36
|
+
type ColumnName = string;
|
|
37
|
+
interface Table {
|
|
38
|
+
schema: SchemaName;
|
|
39
|
+
name: TableName;
|
|
40
|
+
columns: Record<ColumnName, Column>;
|
|
41
|
+
}
|
|
42
|
+
interface Column {
|
|
43
|
+
schema: SchemaName;
|
|
44
|
+
table: TableName;
|
|
45
|
+
name: ColumnName;
|
|
46
|
+
}
|
|
47
|
+
interface QueryDetails {
|
|
48
|
+
/**
|
|
49
|
+
* The database schema where the table is located. Defaults to "public".
|
|
50
|
+
*/
|
|
51
|
+
schema?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The name of the table to select from.
|
|
54
|
+
*/
|
|
55
|
+
table: string;
|
|
56
|
+
}
|
|
57
|
+
interface QueryResult {
|
|
58
|
+
rows: Record<ColumnName, unknown>[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type { Adapter as A, BaseOptions as B, Column as C, IntrospectOptions as I, QueryOptions as Q, Schema as S, Table as T, Introspection as a, QueryDetails as b };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.create;var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var m=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!h.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(n=E(t,o))||n.enumerable});return e};var A=(e,t,r)=>(r=e!=null?m(w(e)):{},p(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),P=e=>p(c({},"__esModule",{value:!0}),e);var D={};f(D,{createAccelerateHttpClient:()=>y});module.exports=P(D);var u={postgres:{encoded:"ZGF0YXNvdXJjZSBkYiB7CiAgICBwcm92aWRlciA9ICJwb3N0Z3JlcyIKICAgIHVybCAgICAgID0gZW52KCJEQVRBQkFTRV9VUkwiKQp9CiAgICAKZ2VuZXJhdG9yIGNsaWVudCB7CiAgICBwcm92aWRlciA9ICJwcmlzbWEtY2xpZW50LWpzIgp9",hash:"54195896aeafa3318ca33f5a8bb44c6b4d89c368cb15288f3bd5ace35a3f9227"}};var l=A(require("@prisma/client/package.json"),1),x=["postgres"],C="accelerate.prisma-data.net",q=l.default.devDependencies["@prisma/engines-version"],_=l.default.version,k=q.split("-")[1].split(".")[1],R=u;function y(e){let{provider:t}=e;if(t!=="postgresql"&&!x.includes(t))throw new Error(`Invalid provider: ${t}`);let r=O(e);return{execute:I(e,r)}}function O(e){let t=`https://${e.host||C}/${_}/${d(e.provider).hash}`,r=e.fetch||fetch,n={Authorization:`Bearer ${e.apiKey}`,"Prisma-Engine-Hash":k};return o=>r(`${t}/${o.path}`,{body:o.body,headers:n,method:o.method,signal:o.signal})}async function b(e,t,r){let n=await r({body:d(e.provider).encoded,method:"PUT",path:"schema",signal:t?.abortSignal});if(!n.ok){try{console.error(await n.text())}catch{}throw new Error(`Failed to upload schema to query engine: ${n.statusText}`)}}function d(e){return e==="postgresql"?R.postgres:R[e]}async function H(e,t,r){let n=await r({body:JSON.stringify(e),method:"POST",path:"graphql",signal:t?.abortSignal});if(!n.ok){try{console.error(await n.text())}catch{}throw new Error(`Failed to execute query: ${n.statusText}`)}return await n.json()}function I(e,t){let r=null;return async(n,o)=>{try{await(r||=b(e,o,t));let{data:i,errors:s}=await H({action:"queryRaw",query:{arguments:{parameters:n.parameters,query:n.sql},selection:{}}},o,t);return s?[new AggregateError(s,"Errors occurred while executing the query")]:[null,T(i.queryRaw)]}catch(i){return[i]}}}function T(e){let t=[],r=Q(e);for(let n=0;n<e.rows.length;n++){let o=e.rows[n],i={...r};for(let s=0;s<o.length;s++)i[e.columns[s]]=a(e.types[s],o[s]);t.push(i)}return t}function a(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bigint-array":return t.map(r=>a("bigint",r));case"bytes-array":return t.map(r=>a("bytes",r));case"decimal-array":return t.map(r=>a("decimal",r));case"datetime-array":return t.map(r=>a("datetime",r));case"date-array":return t.map(r=>a("date",r));case"time-array":return t.map(r=>a("time",r));default:return t}}function Q(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}0&&(module.exports={createAccelerateHttpClient});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Q as Query } from '../../
|
|
1
|
+
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-BLAClqkI.cjs';
|
|
2
|
+
import { E as Either } from '../../type-utils-rTHUvEmt.cjs';
|
|
2
3
|
import 'kysely';
|
|
3
4
|
|
|
4
5
|
declare const SUPPORTED_ACCELERATE_PROVIDERS: readonly ["postgres"];
|
|
@@ -23,8 +24,8 @@ interface AccelerateHttpClientParams {
|
|
|
23
24
|
*/
|
|
24
25
|
provider: SupportedAccelerateProvider | "postgresql";
|
|
25
26
|
}
|
|
26
|
-
interface AccelerateHttpClient {
|
|
27
|
-
|
|
27
|
+
interface AccelerateHttpClient extends Executor {
|
|
28
|
+
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
28
29
|
}
|
|
29
30
|
declare function createAccelerateHttpClient(props: AccelerateHttpClientParams): AccelerateHttpClient;
|
|
30
31
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Q as Query } from '../../
|
|
1
|
+
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-CySfZPUK.js';
|
|
2
|
+
import { E as Either } from '../../type-utils-rTHUvEmt.js';
|
|
2
3
|
import 'kysely';
|
|
3
4
|
|
|
4
5
|
declare const SUPPORTED_ACCELERATE_PROVIDERS: readonly ["postgres"];
|
|
@@ -23,8 +24,8 @@ interface AccelerateHttpClientParams {
|
|
|
23
24
|
*/
|
|
24
25
|
provider: SupportedAccelerateProvider | "postgresql";
|
|
25
26
|
}
|
|
26
|
-
interface AccelerateHttpClient {
|
|
27
|
-
|
|
27
|
+
interface AccelerateHttpClient extends Executor {
|
|
28
|
+
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
28
29
|
}
|
|
29
30
|
declare function createAccelerateHttpClient(props: AccelerateHttpClientParams): AccelerateHttpClient;
|
|
30
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-2FW6TKD6.js";import
|
|
1
|
+
import{a as c}from"../../chunk-2FW6TKD6.js";import l from"@prisma/client/package.json";var R=["postgres"],y="accelerate.prisma-data.net",d=l.devDependencies["@prisma/engines-version"],m=l.version,E=d.split("-")[1].split(".")[1],u=c;function g(t){let{provider:e}=t;if(e!=="postgresql"&&!R.includes(e))throw new Error(`Invalid provider: ${e}`);let r=w(t);return{execute:A(t,r)}}function w(t){let e=`https://${t.host||y}/${m}/${p(t.provider).hash}`,r=t.fetch||fetch,n={Authorization:`Bearer ${t.apiKey}`,"Prisma-Engine-Hash":E};return o=>r(`${e}/${o.path}`,{body:o.body,headers:n,method:o.method,signal:o.signal})}async function h(t,e,r){let n=await r({body:p(t.provider).encoded,method:"PUT",path:"schema",signal:e?.abortSignal});if(!n.ok){try{console.error(await n.text())}catch{}throw new Error(`Failed to upload schema to query engine: ${n.statusText}`)}}function p(t){return t==="postgresql"?u.postgres:u[t]}async function f(t,e,r){let n=await r({body:JSON.stringify(t),method:"POST",path:"graphql",signal:e?.abortSignal});if(!n.ok){try{console.error(await n.text())}catch{}throw new Error(`Failed to execute query: ${n.statusText}`)}return await n.json()}function A(t,e){let r=null;return async(n,o)=>{try{await(r||=h(t,o,e));let{data:i,errors:s}=await f({action:"queryRaw",query:{arguments:{parameters:n.parameters,query:n.sql},selection:{}}},o,e);return s?[new AggregateError(s,"Errors occurred while executing the query")]:[null,P(i.queryRaw)]}catch(i){return[i]}}}function P(t){let e=[],r=S(t);for(let n=0;n<t.rows.length;n++){let o=t.rows[n],i={...r};for(let s=0;s<o.length;s++)i[t.columns[s]]=a(t.types[s],o[s]);e.push(i)}return e}function a(t,e){if(e===null)return e;switch(t){case"bigint":return BigInt(e);case"bigint-array":return e.map(r=>a("bigint",r));case"bytes-array":return e.map(r=>a("bytes",r));case"decimal-array":return e.map(r=>a("decimal",r));case"datetime-array":return e.map(r=>a("datetime",r));case"date-array":return e.map(r=>a("date",r));case"time-array":return e.map(r=>a("time",r));default:return e}}function S(t){let e={};for(let r=0;r<t.columns.length;r++)e[t.columns[r]]=null;return e}export{g as createAccelerateHttpClient};
|
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 y=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},x=(t,e,o,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!p.call(t,r)&&r!==o&&i(t,r,{get:()=>e[r],enumerable:!(u=y(e,r))||u.enumerable});return t};var f=t=>x(i({},"__esModule",{value:!0}),t);var F={};d(F,{createStudioBFFClient:()=>m});module.exports=f(F);function m(t){let{customHeaders:e,customPayload:o,url:u}=t,r=t.fetch||fetch;return{async execute(c,a){try{let n=await r(u,{body:JSON.stringify({customPayload:o,procedure:"query",query:c}),headers:{Accept:"application/json","Content-Type":"application/json",...e},method:"POST",signal:a?.abortSignal});if(!n.ok){let s;try{s=await n.text()}catch{s="unknown error"}return[new Error(s)]}return[null,await n.json()]}catch(n){return[n]}}}}0&&(module.exports={createStudioBFFClient});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { E as Executor } from '../../executor-
|
|
2
|
-
import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.cjs';
|
|
1
|
+
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-BLAClqkI.cjs';
|
|
3
2
|
import { E as Either } from '../../type-utils-rTHUvEmt.cjs';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
@@ -35,7 +34,7 @@ interface StudioBFFClient extends Executor {
|
|
|
35
34
|
*
|
|
36
35
|
* The query is sent as `body.query`.
|
|
37
36
|
*/
|
|
38
|
-
execute<Q extends Query>(this: void, query: Q): Promise<Either<Error, QueryResult<Q>>>;
|
|
37
|
+
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
39
38
|
}
|
|
40
39
|
interface StudioBFFQueryRequest {
|
|
41
40
|
customPayload?: Record<string, unknown>;
|
package/dist/data/bff/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { E as Executor } from '../../executor-
|
|
2
|
-
import { Q as Query, a as QueryResult } from '../../query-L1_vLuFd.js';
|
|
1
|
+
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-CySfZPUK.js';
|
|
3
2
|
import { E as Either } from '../../type-utils-rTHUvEmt.js';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
@@ -35,7 +34,7 @@ interface StudioBFFClient extends Executor {
|
|
|
35
34
|
*
|
|
36
35
|
* The query is sent as `body.query`.
|
|
37
36
|
*/
|
|
38
|
-
execute<Q extends Query>(this: void, query: Q): Promise<Either<Error, QueryResult<Q>>>;
|
|
37
|
+
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
39
38
|
}
|
|
40
39
|
interface StudioBFFQueryRequest {
|
|
41
40
|
customPayload?: Record<string, unknown>;
|
package/dist/data/bff/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-2FW6TKD6.js";function
|
|
1
|
+
import"../../chunk-2FW6TKD6.js";function l(r){let{customHeaders:o,customPayload:n,url:u}=r,s=r.fetch||fetch;return{async execute(i,c){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",signal:c?.abortSignal});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{l as createStudioBFFClient};
|
package/dist/data/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { A as Adapter, C as Column, I as Introspection,
|
|
2
|
-
export { E as Executor } from '../executor-
|
|
3
|
-
export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.cjs';
|
|
1
|
+
export { A as Adapter, B as BaseOptions, C as Column, I as IntrospectOptions, a as Introspection, b as QueryDetails, Q as QueryOptions, S as Schema, T as Table } from '../adapter-D0mwGLmg.cjs';
|
|
2
|
+
export { b as ExecuteOptions, E as Executor, Q as Query, a as QueryResult } from '../executor-BLAClqkI.cjs';
|
|
4
3
|
export { E as Either } from '../type-utils-rTHUvEmt.cjs';
|
|
5
4
|
import 'kysely';
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { A as Adapter, C as Column, I as Introspection,
|
|
2
|
-
export { E as Executor } from '../executor-
|
|
3
|
-
export { Q as Query, a as QueryResult } from '../query-L1_vLuFd.js';
|
|
1
|
+
export { A as Adapter, B as BaseOptions, C as Column, I as IntrospectOptions, a as Introspection, b as QueryDetails, Q as QueryOptions, S as Schema, T as Table } from '../adapter-CqrlY1Ga.js';
|
|
2
|
+
export { b as ExecuteOptions, E as Executor, Q as Query, a as QueryResult } from '../executor-CySfZPUK.js';
|
|
4
3
|
export { E as Either } from '../type-utils-rTHUvEmt.js';
|
|
5
4
|
import 'kysely';
|