@prisma/studio-core 0.0.0-dev.202504222105 → 0.0.0-dev.202504222204
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var E=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},
|
|
1
|
+
"use strict";var E=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of h(t))!A.call(e,a)&&a!==r&&c(e,a,{get:()=>t[a],enumerable:!(n=g(t,a))||n.enumerable});return e};var x=(e,t,r)=>(r=e!=null?E(f(e)):{},d(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),S=e=>d(c({},"__esModule",{value:!0}),e);var B={};P(B,{createAccelerateHttpClient:()=>m,deserializeRawResult:()=>l,deserializeValue:()=>s});module.exports=S(B);var u={postgres:{encoded:"ZGF0YXNvdXJjZSBkYiB7CiAgICBwcm92aWRlciA9ICJwb3N0Z3JlcyIKICAgIHVybCAgICAgID0gZW52KCJEQVRBQkFTRV9VUkwiKQp9CiAgICAKZ2VuZXJhdG9yIGNsaWVudCB7CiAgICBwcm92aWRlciA9ICJwcmlzbWEtY2xpZW50LWpzIgp9",hash:"54195896aeafa3318ca33f5a8bb44c6b4d89c368cb15288f3bd5ace35a3f9227"}};function l(e){let t=[],r=C(e);for(let n=0;n<e.rows.length;n++){let a=e.rows[n],i={...r};for(let o=0;o<a.length;o++)i[e.columns[o]]=s(e.types[o],a[o]);t.push(i)}return t}function s(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bigint-array":return t.map(r=>s("bigint",r));case"bytes-array":return t.map(r=>s("bytes",r));case"decimal-array":return t.map(r=>s("decimal",r));case"datetime-array":return t.map(r=>s("datetime",r));case"date-array":return t.map(r=>s("date",r));case"time-array":return t.map(r=>s("time",r));default:return t}}function C(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var p=x(require("@prisma/client/package.json"),1);var q=["postgres"],k="accelerate.prisma-data.net",_=p.default.devDependencies["@prisma/engines-version"],I=p.default.version,O=_.split("-")[1].split(".")[1],R=u;function m(e){let{provider:t}=e;if(t!=="postgresql"&&!q.includes(t))throw new Error(`Invalid provider: ${t}`);let r=T(e);return{execute:D(e,r)}}function T(e){let t=`https://${e.host||k}/${I}/${w(e.provider).hash}`,r=e.fetch||fetch,n={Authorization:`Bearer ${e.apiKey}`,"Prisma-Engine-Hash":O};return a=>r(`${t}/${a.path}`,{body:a.body,headers:n,method:a.method,signal:a.signal})}async function H(e,t,r){let n=await r({body:w(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 w(e){return e==="postgresql"?R.postgres:R[e]}async function Q(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 D(e,t){let{resultDeserializerFn:r=l}=e,n=null;return async(a,i)=>{try{await(n||=H(e,i,t));let{data:o,errors:y}=await Q({action:"queryRaw",query:{arguments:{parameters:a.parameters,query:a.sql},selection:{}}},i,t);return y?[new AggregateError(y,"Errors occurred while executing the query")]:[null,r(o.queryRaw)]}catch(o){return[o]}}}0&&(module.exports={createAccelerateHttpClient,deserializeRawResult,deserializeValue});
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { deserializeRawResult as deserializeRawResult$1 } from '@prisma/client/runtime/library';
|
|
2
1
|
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-DbZM00RR.cjs';
|
|
3
2
|
import { E as Either } from '../../type-utils-u92OZz8n.cjs';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
5
|
+
declare function deserializeRawResult(response: RawResponse): DeserializedResponse;
|
|
6
|
+
declare function deserializeValue(type: QueryIntrospectionBuiltinType, value: unknown): unknown;
|
|
7
|
+
type DeserializedResponse = Array<Record<string, unknown>>;
|
|
8
|
+
interface RawResponse {
|
|
9
|
+
columns: string[];
|
|
10
|
+
types: QueryIntrospectionBuiltinType[];
|
|
11
|
+
rows: unknown[][];
|
|
12
|
+
}
|
|
13
|
+
type QueryIntrospectionBuiltinType = "int" | "bigint" | "float" | "double" | "string" | "enum" | "bytes" | "bool" | "char" | "decimal" | "json" | "xml" | "uuid" | "datetime" | "date" | "time" | "int-array" | "bigint-array" | "float-array" | "double-array" | "string-array" | "char-array" | "bytes-array" | "bool-array" | "decimal-array" | "json-array" | "xml-array" | "uuid-array" | "datetime-array" | "date-array" | "time-array" | "null" | "unknown";
|
|
14
|
+
|
|
6
15
|
declare const SUPPORTED_ACCELERATE_PROVIDERS: readonly ["postgres"];
|
|
7
16
|
type SupportedAccelerateProvider = (typeof SUPPORTED_ACCELERATE_PROVIDERS)[number];
|
|
8
|
-
type RawResponse = Parameters<typeof deserializeRawResult$1>[0];
|
|
9
17
|
interface AccelerateHttpClientParams {
|
|
10
18
|
/**
|
|
11
19
|
* Accelerate API key.
|
|
@@ -36,7 +44,5 @@ interface AccelerateHttpClient extends Executor {
|
|
|
36
44
|
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
37
45
|
}
|
|
38
46
|
declare function createAccelerateHttpClient(props: AccelerateHttpClientParams): AccelerateHttpClient;
|
|
39
|
-
declare function deserializeRawResult(response: RawResponse): DeserializedResponse;
|
|
40
|
-
type DeserializedResponse = Array<Record<string, unknown>>;
|
|
41
47
|
|
|
42
|
-
export { type AccelerateHttpClient, type AccelerateHttpClientParams, type RawResponse, type SupportedAccelerateProvider, createAccelerateHttpClient, deserializeRawResult };
|
|
48
|
+
export { type AccelerateHttpClient, type AccelerateHttpClientParams, type DeserializedResponse, type QueryIntrospectionBuiltinType, type RawResponse, type SupportedAccelerateProvider, createAccelerateHttpClient, deserializeRawResult, deserializeValue };
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { deserializeRawResult as deserializeRawResult$1 } from '@prisma/client/runtime/library';
|
|
2
1
|
import { E as Executor, Q as Query, b as ExecuteOptions, a as QueryResult } from '../../executor-DI7JTcqO.js';
|
|
3
2
|
import { E as Either } from '../../type-utils-u92OZz8n.js';
|
|
4
3
|
import 'kysely';
|
|
5
4
|
|
|
5
|
+
declare function deserializeRawResult(response: RawResponse): DeserializedResponse;
|
|
6
|
+
declare function deserializeValue(type: QueryIntrospectionBuiltinType, value: unknown): unknown;
|
|
7
|
+
type DeserializedResponse = Array<Record<string, unknown>>;
|
|
8
|
+
interface RawResponse {
|
|
9
|
+
columns: string[];
|
|
10
|
+
types: QueryIntrospectionBuiltinType[];
|
|
11
|
+
rows: unknown[][];
|
|
12
|
+
}
|
|
13
|
+
type QueryIntrospectionBuiltinType = "int" | "bigint" | "float" | "double" | "string" | "enum" | "bytes" | "bool" | "char" | "decimal" | "json" | "xml" | "uuid" | "datetime" | "date" | "time" | "int-array" | "bigint-array" | "float-array" | "double-array" | "string-array" | "char-array" | "bytes-array" | "bool-array" | "decimal-array" | "json-array" | "xml-array" | "uuid-array" | "datetime-array" | "date-array" | "time-array" | "null" | "unknown";
|
|
14
|
+
|
|
6
15
|
declare const SUPPORTED_ACCELERATE_PROVIDERS: readonly ["postgres"];
|
|
7
16
|
type SupportedAccelerateProvider = (typeof SUPPORTED_ACCELERATE_PROVIDERS)[number];
|
|
8
|
-
type RawResponse = Parameters<typeof deserializeRawResult$1>[0];
|
|
9
17
|
interface AccelerateHttpClientParams {
|
|
10
18
|
/**
|
|
11
19
|
* Accelerate API key.
|
|
@@ -36,7 +44,5 @@ interface AccelerateHttpClient extends Executor {
|
|
|
36
44
|
execute<Q extends Query>(this: void, query: Q, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Q>>>;
|
|
37
45
|
}
|
|
38
46
|
declare function createAccelerateHttpClient(props: AccelerateHttpClientParams): AccelerateHttpClient;
|
|
39
|
-
declare function deserializeRawResult(response: RawResponse): DeserializedResponse;
|
|
40
|
-
type DeserializedResponse = Array<Record<string, unknown>>;
|
|
41
47
|
|
|
42
|
-
export { type AccelerateHttpClient, type AccelerateHttpClientParams, type RawResponse, type SupportedAccelerateProvider, createAccelerateHttpClient, deserializeRawResult };
|
|
48
|
+
export { type AccelerateHttpClient, type AccelerateHttpClientParams, type DeserializedResponse, type QueryIntrospectionBuiltinType, type RawResponse, type SupportedAccelerateProvider, createAccelerateHttpClient, deserializeRawResult, deserializeValue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-2FW6TKD6.js";import
|
|
1
|
+
import{a as c}from"../../chunk-2FW6TKD6.js";function u(e){let t=[],r=R(e);for(let n=0;n<e.rows.length;n++){let a=e.rows[n],i={...r};for(let o=0;o<a.length;o++)i[e.columns[o]]=s(e.types[o],a[o]);t.push(i)}return t}function s(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bigint-array":return t.map(r=>s("bigint",r));case"bytes-array":return t.map(r=>s("bytes",r));case"decimal-array":return t.map(r=>s("decimal",r));case"datetime-array":return t.map(r=>s("datetime",r));case"date-array":return t.map(r=>s("date",r));case"time-array":return t.map(r=>s("time",r));default:return t}}function R(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}import y from"@prisma/client/package.json";var m=["postgres"],w="accelerate.prisma-data.net",E=y.devDependencies["@prisma/engines-version"],g=y.version,h=E.split("-")[1].split(".")[1],p=c;function f(e){let{provider:t}=e;if(t!=="postgresql"&&!m.includes(t))throw new Error(`Invalid provider: ${t}`);let r=A(e);return{execute:S(e,r)}}function A(e){let t=`https://${e.host||w}/${g}/${d(e.provider).hash}`,r=e.fetch||fetch,n={Authorization:`Bearer ${e.apiKey}`,"Prisma-Engine-Hash":h};return a=>r(`${t}/${a.path}`,{body:a.body,headers:n,method:a.method,signal:a.signal})}async function P(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"?p.postgres:p[e]}async function x(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 S(e,t){let{resultDeserializerFn:r=u}=e,n=null;return async(a,i)=>{try{await(n||=P(e,i,t));let{data:o,errors:l}=await x({action:"queryRaw",query:{arguments:{parameters:a.parameters,query:a.sql},selection:{}}},i,t);return l?[new AggregateError(l,"Errors occurred while executing the query")]:[null,r(o.queryRaw)]}catch(o){return[o]}}}export{f as createAccelerateHttpClient,u as deserializeRawResult,s as deserializeValue};
|