Initial commit

This commit is contained in:
Brian McGonagill 2026-03-18 09:02:21 -05:00
commit b3a51a4115
10336 changed files with 2381973 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,92 @@
import { T as SequenceExecutor, Q as Query, K as ExecuteOptions, J as Either, P as QueryResult, v as AdapterSqlLintDiagnostic } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
declare function consumeBffRequestDurationMsForSignal(abortSignal: AbortSignal): number | null;
interface StudioBFFClientProps {
/**
* Allows passing custom headers to the BFF.
*
* e.g. authorization token.
*/
customHeaders?: Record<string, string>;
/**
* Allows passing custom payload to the BFF via `body.customPayload`.
*
* e.g. tenant id.
*/
customPayload?: Record<string, unknown>;
/**
* Allows overriding the fetch function implementation.
*
* e.g. for testing, or older Node.js versions.
*/
fetch?: typeof globalThis.fetch;
/**
* Function used to deserialize the results of queries.
*
* By default, the results are returned as is without any additional processing.
*/
resultDeserializerFn?(this: void, results: unknown): unknown[];
/**
* BFF endpoint URL.
*
* e.g. `https://api.example.com/studio`
*/
url: string | URL;
}
interface StudioBFFClient extends SequenceExecutor {
/**
* Requests BFF to query the database.
*
* The query is sent as `body.query`.
*/
execute<T>(this: void, query: Query<T>, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<T>>>>;
/**
* Requests BFF to execute a sequence of queries.
*
* The sequence is sent as `body.sequence`.
*/
executeSequence<T, S>(this: void, sequence: readonly [Query<T>, Query<S>], options?: ExecuteOptions): Promise<[[Error]] | [[null, QueryResult<Query<T>>], Either<Error, QueryResult<Query<S>>>]>;
/**
* Requests BFF to lint SQL via parse/plan diagnostics.
*/
lintSql(this: void, details: StudioBFFSqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, StudioBFFSqlLintResult>>;
}
type StudioBFFRequest = StudioBFFQueryRequest | StudioBFFSequenceRequest | StudioBFFSqlLintRequest;
interface StudioBFFQueryRequest {
customPayload?: Record<string, unknown>;
procedure: "query";
query: Query<unknown>;
}
interface StudioBFFSequenceRequest {
customPayload?: Record<string, unknown>;
procedure: "sequence";
sequence: readonly [Query<unknown>, Query<unknown>];
}
interface StudioBFFSqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface StudioBFFSqlLintResult {
diagnostics: AdapterSqlLintDiagnostic[];
schemaVersion?: string;
}
interface StudioBFFSqlLintRequest {
customPayload?: Record<string, unknown>;
procedure: "sql-lint";
schemaVersion?: string;
sql: string;
}
/**
* Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
*/
declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
interface SerializedError {
message: string;
name: string;
errors?: SerializedError[];
}
declare function serializeError(error: unknown): SerializedError;
declare function deserializeError(error: SerializedError): Error;
export { type SerializedError, type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFRequest, type StudioBFFSequenceRequest, type StudioBFFSqlLintDetails, type StudioBFFSqlLintRequest, type StudioBFFSqlLintResult, consumeBffRequestDurationMsForSignal, createStudioBFFClient, deserializeError, serializeError };

View file

@ -0,0 +1,92 @@
import { T as SequenceExecutor, Q as Query, K as ExecuteOptions, J as Either, P as QueryResult, v as AdapterSqlLintDiagnostic } from '../../adapter-DYzAiJd4.js';
import 'kysely';
declare function consumeBffRequestDurationMsForSignal(abortSignal: AbortSignal): number | null;
interface StudioBFFClientProps {
/**
* Allows passing custom headers to the BFF.
*
* e.g. authorization token.
*/
customHeaders?: Record<string, string>;
/**
* Allows passing custom payload to the BFF via `body.customPayload`.
*
* e.g. tenant id.
*/
customPayload?: Record<string, unknown>;
/**
* Allows overriding the fetch function implementation.
*
* e.g. for testing, or older Node.js versions.
*/
fetch?: typeof globalThis.fetch;
/**
* Function used to deserialize the results of queries.
*
* By default, the results are returned as is without any additional processing.
*/
resultDeserializerFn?(this: void, results: unknown): unknown[];
/**
* BFF endpoint URL.
*
* e.g. `https://api.example.com/studio`
*/
url: string | URL;
}
interface StudioBFFClient extends SequenceExecutor {
/**
* Requests BFF to query the database.
*
* The query is sent as `body.query`.
*/
execute<T>(this: void, query: Query<T>, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<T>>>>;
/**
* Requests BFF to execute a sequence of queries.
*
* The sequence is sent as `body.sequence`.
*/
executeSequence<T, S>(this: void, sequence: readonly [Query<T>, Query<S>], options?: ExecuteOptions): Promise<[[Error]] | [[null, QueryResult<Query<T>>], Either<Error, QueryResult<Query<S>>>]>;
/**
* Requests BFF to lint SQL via parse/plan diagnostics.
*/
lintSql(this: void, details: StudioBFFSqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, StudioBFFSqlLintResult>>;
}
type StudioBFFRequest = StudioBFFQueryRequest | StudioBFFSequenceRequest | StudioBFFSqlLintRequest;
interface StudioBFFQueryRequest {
customPayload?: Record<string, unknown>;
procedure: "query";
query: Query<unknown>;
}
interface StudioBFFSequenceRequest {
customPayload?: Record<string, unknown>;
procedure: "sequence";
sequence: readonly [Query<unknown>, Query<unknown>];
}
interface StudioBFFSqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface StudioBFFSqlLintResult {
diagnostics: AdapterSqlLintDiagnostic[];
schemaVersion?: string;
}
interface StudioBFFSqlLintRequest {
customPayload?: Record<string, unknown>;
procedure: "sql-lint";
schemaVersion?: string;
sql: string;
}
/**
* Creates a Studio BFF client. BFF stands for "Backend For Frontend" btw.
*/
declare function createStudioBFFClient(props: StudioBFFClientProps): StudioBFFClient;
interface SerializedError {
message: string;
name: string;
errors?: SerializedError[];
}
declare function serializeError(error: unknown): SerializedError;
declare function deserializeError(error: SerializedError): Error;
export { type SerializedError, type StudioBFFClient, type StudioBFFClientProps, type StudioBFFQueryRequest, type StudioBFFRequest, type StudioBFFSequenceRequest, type StudioBFFSqlLintDetails, type StudioBFFSqlLintRequest, type StudioBFFSqlLintResult, consumeBffRequestDurationMsForSignal, createStudioBFFClient, deserializeError, serializeError };

View file

@ -0,0 +1,10 @@
import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(`Unknown module ${mod}`);
}
import{a,b,c,d}from"../../chunk-NTWQA463.js";import"../../chunk-6QJ7HVIC.js";export{a as consumeBffRequestDurationMsForSignal,b as createStudioBFFClient,d as deserializeError,c as serializeError};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K

3
node_modules/@prisma/studio-core/dist/data/index.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

33
node_modules/@prisma/studio-core/dist/data/index.d.cts generated vendored Normal file
View file

@ -0,0 +1,33 @@
import { A as AdapterIntrospectResult, S as SqlEditorDialect, a as AdapterSqlSchemaResult } from '../adapter-DYzAiJd4.cjs';
export { b as AbortError, c as Adapter, d as AdapterBaseOptions, e as AdapterCapabilities, f as AdapterDeleteDetails, g as AdapterDeleteOptions, h as AdapterDeleteResult, i as AdapterError, j as AdapterInsertDetails, k as AdapterInsertOptions, l as AdapterInsertResult, m as AdapterIntrospectOptions, n as AdapterQueryDetails, o as AdapterQueryOptions, p as AdapterQueryResult, q as AdapterRawDetails, r as AdapterRawOptions, s as AdapterRawResult, t as AdapterRequirements, u as AdapterSqlLintDetails, v as AdapterSqlLintDiagnostic, w as AdapterSqlLintOptions, x as AdapterSqlLintResult, y as AdapterSqlSchemaDetails, z as AdapterSqlSchemaOptions, B as AdapterUpdateDetails, C as AdapterUpdateOptions, D as AdapterUpdateResult, E as BigIntString, F as Column, G as ColumnFilter, H as DataType, I as DataTypeGroup, J as Either, K as ExecuteOptions, L as Executor, M as FilterGroup, N as FilterOperator, O as NumericString, Q as Query, P as QueryResult, R as Schema, T as SequenceExecutor, U as SortDirection, V as SortOrderItem, W as SqlFilter, X as SqlLintDetails, Y as SqlLintDiagnostic, Z as SqlLintResult, _ as Table, $ as applyInferredRowFilters, a0 as createAdapterError, a1 as getAbortResult } from '../adapter-DYzAiJd4.cjs';
export { F as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS, a as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH, b as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS, c as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS, d as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE, e as FULL_TABLE_SEARCH_TIMEOUT_MS, f as FullTableSearchDialect, g as FullTableSearchExecutionState, h as FullTableSearchPlan, i as FullTableSearchPredicate, j as FullTableSearchTimeoutError, k as buildFullTableSearchPlan, l as createFullTableSearchExecutionState, m as executeQueryWithFullTableSearchGuardrails, n as getFullTableSearchExpression, o as isFullTableSearchRequest } from '../full-table-search-lTj-t9ys.cjs';
import 'kysely';
declare function getDate0(format: string): string;
declare const DEFAULT_STRING = "";
declare const DEFAULT_NUMERIC = 0;
declare const DEFAULT_BOOLEAN = false;
declare const DEFAULT_ARRAY_DISPLAY = "[]";
declare const DEFAULT_JSON = "{}";
declare const DEFAULT_ARRAY_VALUE = "{}";
declare function createSqlEditorSchemaFromIntrospection(args: {
defaultSchema?: string;
dialect: SqlEditorDialect;
introspection: AdapterIntrospectResult;
}): AdapterSqlSchemaResult;
declare function createSqlEditorNamespace(introspection: AdapterIntrospectResult): Record<string, Record<string, string[]>>;
declare function createSqlEditorSchemaVersion(namespace: Record<string, Record<string, string[]>>): string;
interface SqlStatementSegment {
from: number;
statement: string;
to: number;
}
declare function splitTopLevelSqlStatements(sql: string): SqlStatementSegment[];
declare function getTopLevelSqlStatementAtCursor(args: {
cursorIndex: number;
sql: string;
}): SqlStatementSegment | null;
export { AdapterIntrospectResult, AdapterSqlSchemaResult, DEFAULT_ARRAY_DISPLAY, DEFAULT_ARRAY_VALUE, DEFAULT_BOOLEAN, DEFAULT_JSON, DEFAULT_NUMERIC, DEFAULT_STRING, SqlEditorDialect, type SqlStatementSegment, createSqlEditorNamespace, createSqlEditorSchemaFromIntrospection, createSqlEditorSchemaVersion, getDate0, getTopLevelSqlStatementAtCursor, splitTopLevelSqlStatements };

33
node_modules/@prisma/studio-core/dist/data/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,33 @@
import { A as AdapterIntrospectResult, S as SqlEditorDialect, a as AdapterSqlSchemaResult } from '../adapter-DYzAiJd4.js';
export { b as AbortError, c as Adapter, d as AdapterBaseOptions, e as AdapterCapabilities, f as AdapterDeleteDetails, g as AdapterDeleteOptions, h as AdapterDeleteResult, i as AdapterError, j as AdapterInsertDetails, k as AdapterInsertOptions, l as AdapterInsertResult, m as AdapterIntrospectOptions, n as AdapterQueryDetails, o as AdapterQueryOptions, p as AdapterQueryResult, q as AdapterRawDetails, r as AdapterRawOptions, s as AdapterRawResult, t as AdapterRequirements, u as AdapterSqlLintDetails, v as AdapterSqlLintDiagnostic, w as AdapterSqlLintOptions, x as AdapterSqlLintResult, y as AdapterSqlSchemaDetails, z as AdapterSqlSchemaOptions, B as AdapterUpdateDetails, C as AdapterUpdateOptions, D as AdapterUpdateResult, E as BigIntString, F as Column, G as ColumnFilter, H as DataType, I as DataTypeGroup, J as Either, K as ExecuteOptions, L as Executor, M as FilterGroup, N as FilterOperator, O as NumericString, Q as Query, P as QueryResult, R as Schema, T as SequenceExecutor, U as SortDirection, V as SortOrderItem, W as SqlFilter, X as SqlLintDetails, Y as SqlLintDiagnostic, Z as SqlLintResult, _ as Table, $ as applyInferredRowFilters, a0 as createAdapterError, a1 as getAbortResult } from '../adapter-DYzAiJd4.js';
export { F as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS, a as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH, b as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS, c as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS, d as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE, e as FULL_TABLE_SEARCH_TIMEOUT_MS, f as FullTableSearchDialect, g as FullTableSearchExecutionState, h as FullTableSearchPlan, i as FullTableSearchPredicate, j as FullTableSearchTimeoutError, k as buildFullTableSearchPlan, l as createFullTableSearchExecutionState, m as executeQueryWithFullTableSearchGuardrails, n as getFullTableSearchExpression, o as isFullTableSearchRequest } from '../full-table-search-DQB6lY-i.js';
import 'kysely';
declare function getDate0(format: string): string;
declare const DEFAULT_STRING = "";
declare const DEFAULT_NUMERIC = 0;
declare const DEFAULT_BOOLEAN = false;
declare const DEFAULT_ARRAY_DISPLAY = "[]";
declare const DEFAULT_JSON = "{}";
declare const DEFAULT_ARRAY_VALUE = "{}";
declare function createSqlEditorSchemaFromIntrospection(args: {
defaultSchema?: string;
dialect: SqlEditorDialect;
introspection: AdapterIntrospectResult;
}): AdapterSqlSchemaResult;
declare function createSqlEditorNamespace(introspection: AdapterIntrospectResult): Record<string, Record<string, string[]>>;
declare function createSqlEditorSchemaVersion(namespace: Record<string, Record<string, string[]>>): string;
interface SqlStatementSegment {
from: number;
statement: string;
to: number;
}
declare function splitTopLevelSqlStatements(sql: string): SqlStatementSegment[];
declare function getTopLevelSqlStatementAtCursor(args: {
cursorIndex: number;
sql: string;
}): SqlStatementSegment | null;
export { AdapterIntrospectResult, AdapterSqlSchemaResult, DEFAULT_ARRAY_DISPLAY, DEFAULT_ARRAY_VALUE, DEFAULT_BOOLEAN, DEFAULT_JSON, DEFAULT_NUMERIC, DEFAULT_STRING, SqlEditorDialect, type SqlStatementSegment, createSqlEditorNamespace, createSqlEditorSchemaFromIntrospection, createSqlEditorSchemaVersion, getDate0, getTopLevelSqlStatementAtCursor, splitTopLevelSqlStatements };

10
node_modules/@prisma/studio-core/dist/data/index.js generated vendored Normal file
View file

@ -0,0 +1,10 @@
import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(`Unknown module ${mod}`);
}
import{a as m,b as u,c as l,d as a,e as s,f as d,g as i,h as Q,i as R,j as c,k as n,l as w}from"../chunk-PI3N7ZW6.js";import{a as F,b as I,c as b}from"../chunk-N6ZIYSZ5.js";import{C as e,G as g,H as h,b as r,c as t,d as o,e as p,f,g as x,h as y}from"../chunk-LR52PZTP.js";import"../chunk-6QJ7HVIC.js";export{f as DEFAULT_ARRAY_DISPLAY,y as DEFAULT_ARRAY_VALUE,p as DEFAULT_BOOLEAN,x as DEFAULT_JSON,o as DEFAULT_NUMERIC,t as DEFAULT_STRING,s as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS,a as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH,l as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS,u as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS,d as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE,m as FULL_TABLE_SEARCH_TIMEOUT_MS,i as FullTableSearchTimeoutError,e as applyInferredRowFilters,n as buildFullTableSearchPlan,Q as createFullTableSearchExecutionState,I as createSqlEditorNamespace,F as createSqlEditorSchemaFromIntrospection,b as createSqlEditorSchemaVersion,c as executeQueryWithFullTableSearchGuardrails,r as getDate0,w as getFullTableSearchExpression,h as getTopLevelSqlStatementAtCursor,R as isFullTableSearchRequest,g as splitTopLevelSqlStatements};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,269 @@
import { t as AdapterRequirements, T as SequenceExecutor, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, L as Executor, u as AdapterSqlLintDetails, J as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-DYzAiJd4.cjs';
import { OkPacketParams } from 'mysql2';
import * as kysely from 'kysely';
type MySQLAdapterRequirements = Omit<AdapterRequirements, "executor"> & {
executor: SequenceExecutor;
};
declare function createMySQLAdapter(requirements: MySQLAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: { [K in "studio"]: {
name: K;
tables: { [T in "animals" | "composite_pk" | "users"]: Table; };
}; };
timezone: "UTC";
filterOperators: FilterOperator[];
query: Query;
};
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
affectedRows?: number | undefined;
insertId?: number | undefined;
serverStatus?: number | undefined;
warningCount?: number | undefined;
message?: string | undefined;
}>;
declare function getInsertQuery(details: {
rows: Record<string, unknown>[];
table: Table;
}, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<OkPacketParams>;
declare function getInsertRefetchQuery(details: {
criteria: Record<string, unknown>[];
table: Table;
}, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_inserted_at__: string | number;
}>;
declare function getUpdateRefetchQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: string | number;
}>;
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly id: 1;
readonly created_at: Date;
readonly deleted_at: null;
readonly role: "admin";
readonly name: "Alice";
readonly name_role: "Alice_admin";
readonly __ps_count__: "2";
}, {
readonly id: 2;
readonly created_at: Date;
readonly deleted_at: null;
readonly role: "member";
readonly name: "Bob";
readonly name_role: "Bob_member";
readonly __ps_count__: "2";
}];
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
affectedRows?: number | undefined;
insertId?: number | undefined;
serverStatus?: number | undefined;
warningCount?: number | undefined;
message?: string | undefined;
}>;
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
name: string;
schema: string;
type: "BASE TABLE" | "VIEW";
columns: Omit<{
TABLE_NAME: string;
default: string | null;
name: string;
datatype: string;
position: number;
fk_table: string | null;
fk_column: string | null;
pk: number | null;
autoincrement: kysely.SqlBool;
computed: kysely.SqlBool;
nullable: kysely.SqlBool;
}, "TABLE_NAME">[];
}>;
declare function mockTablesQuery(): [{
readonly columns: [{
readonly autoincrement: 1;
readonly computed: 0;
readonly datatype: "int";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "binary(16)";
readonly default: "uuid_to_bin(uuid())";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "uuid";
readonly nullable: 1;
readonly pk: null;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "varchar(255)";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}, {
readonly autoincrement: 0;
readonly computed: 1;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id_name";
readonly nullable: 1;
readonly pk: null;
readonly position: 4;
}];
readonly name: "animals";
readonly schema: "studio";
readonly type: "BASE TABLE";
}, {
readonly columns: [{
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "char(36)";
readonly default: "uuid()";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 0;
readonly pk: 2;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: "CURRENT_TIMESTAMP";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}];
readonly name: "composite_pk";
readonly schema: "studio";
readonly type: "BASE TABLE";
}, {
readonly columns: [{
readonly autoincrement: 1;
readonly computed: 0;
readonly datatype: "int";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: "current_timestamp";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "deleted_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "role";
readonly nullable: 1;
readonly pk: null;
readonly position: 4;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 1;
readonly pk: null;
readonly position: 5;
}, {
readonly autoincrement: 0;
readonly computed: 1;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name_role";
readonly nullable: 1;
readonly pk: null;
readonly position: 6;
}];
readonly name: "users";
readonly schema: "studio";
readonly type: "BASE TABLE";
}];
declare function getTimezoneQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
timezone: string;
}>;
declare function mockTimezoneQuery(): [{
readonly timezone: "UTC";
}];
declare function createLintDiagnosticsFromMySQLError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function lintMySQLWithExplainFallback(executor: Executor, details: AdapterSqlLintDetails, options: Parameters<NonNullable<Adapter["sqlLint"]>>[1]): Promise<Either<AdapterError, AdapterSqlLintResult>>;
declare function getCancelQuery(threadId: unknown): Query<unknown>;
export { type MySQLAdapterRequirements, createLintDiagnosticsFromMySQLError, createMySQLAdapter, getCancelQuery, getDeleteQuery, getInsertQuery, getInsertRefetchQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, getUpdateRefetchQuery, lintMySQLWithExplainFallback, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };

View file

@ -0,0 +1,269 @@
import { t as AdapterRequirements, T as SequenceExecutor, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, L as Executor, u as AdapterSqlLintDetails, J as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-DYzAiJd4.js';
import { OkPacketParams } from 'mysql2';
import * as kysely from 'kysely';
type MySQLAdapterRequirements = Omit<AdapterRequirements, "executor"> & {
executor: SequenceExecutor;
};
declare function createMySQLAdapter(requirements: MySQLAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: { [K in "studio"]: {
name: K;
tables: { [T in "animals" | "composite_pk" | "users"]: Table; };
}; };
timezone: "UTC";
filterOperators: FilterOperator[];
query: Query;
};
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
affectedRows?: number | undefined;
insertId?: number | undefined;
serverStatus?: number | undefined;
warningCount?: number | undefined;
message?: string | undefined;
}>;
declare function getInsertQuery(details: {
rows: Record<string, unknown>[];
table: Table;
}, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<OkPacketParams>;
declare function getInsertRefetchQuery(details: {
criteria: Record<string, unknown>[];
table: Table;
}, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_inserted_at__: string | number;
}>;
declare function getUpdateRefetchQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: string | number;
}>;
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly id: 1;
readonly created_at: Date;
readonly deleted_at: null;
readonly role: "admin";
readonly name: "Alice";
readonly name_role: "Alice_admin";
readonly __ps_count__: "2";
}, {
readonly id: 2;
readonly created_at: Date;
readonly deleted_at: null;
readonly role: "member";
readonly name: "Bob";
readonly name_role: "Bob_member";
readonly __ps_count__: "2";
}];
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
affectedRows?: number | undefined;
insertId?: number | undefined;
serverStatus?: number | undefined;
warningCount?: number | undefined;
message?: string | undefined;
}>;
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
name: string;
schema: string;
type: "BASE TABLE" | "VIEW";
columns: Omit<{
TABLE_NAME: string;
default: string | null;
name: string;
datatype: string;
position: number;
fk_table: string | null;
fk_column: string | null;
pk: number | null;
autoincrement: kysely.SqlBool;
computed: kysely.SqlBool;
nullable: kysely.SqlBool;
}, "TABLE_NAME">[];
}>;
declare function mockTablesQuery(): [{
readonly columns: [{
readonly autoincrement: 1;
readonly computed: 0;
readonly datatype: "int";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "binary(16)";
readonly default: "uuid_to_bin(uuid())";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "uuid";
readonly nullable: 1;
readonly pk: null;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "varchar(255)";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}, {
readonly autoincrement: 0;
readonly computed: 1;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id_name";
readonly nullable: 1;
readonly pk: null;
readonly position: 4;
}];
readonly name: "animals";
readonly schema: "studio";
readonly type: "BASE TABLE";
}, {
readonly columns: [{
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "char(36)";
readonly default: "uuid()";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 0;
readonly pk: 2;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: "CURRENT_TIMESTAMP";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}];
readonly name: "composite_pk";
readonly schema: "studio";
readonly type: "BASE TABLE";
}, {
readonly columns: [{
readonly autoincrement: 1;
readonly computed: 0;
readonly datatype: "int";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: 0;
readonly pk: 1;
readonly position: 1;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: "current_timestamp";
readonly fk_column: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 2;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "timestamp";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "deleted_at";
readonly nullable: 1;
readonly pk: null;
readonly position: 3;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "role";
readonly nullable: 1;
readonly pk: null;
readonly position: 4;
}, {
readonly autoincrement: 0;
readonly computed: 0;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: 1;
readonly pk: null;
readonly position: 5;
}, {
readonly autoincrement: 0;
readonly computed: 1;
readonly datatype: "text";
readonly default: null;
readonly fk_column: null;
readonly fk_table: null;
readonly name: "name_role";
readonly nullable: 1;
readonly pk: null;
readonly position: 6;
}];
readonly name: "users";
readonly schema: "studio";
readonly type: "BASE TABLE";
}];
declare function getTimezoneQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
timezone: string;
}>;
declare function mockTimezoneQuery(): [{
readonly timezone: "UTC";
}];
declare function createLintDiagnosticsFromMySQLError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function lintMySQLWithExplainFallback(executor: Executor, details: AdapterSqlLintDetails, options: Parameters<NonNullable<Adapter["sqlLint"]>>[1]): Promise<Either<AdapterError, AdapterSqlLintResult>>;
declare function getCancelQuery(threadId: unknown): Query<unknown>;
export { type MySQLAdapterRequirements, createLintDiagnosticsFromMySQLError, createMySQLAdapter, getCancelQuery, getDeleteQuery, getInsertQuery, getInsertRefetchQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, getUpdateRefetchQuery, lintMySQLWithExplainFallback, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
import { Pool } from 'mysql2/promise';
import { T as SequenceExecutor } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
declare function createMySQL2Executor(pool: Pool): SequenceExecutor;
export { createMySQL2Executor };

View file

@ -0,0 +1,7 @@
import { Pool } from 'mysql2/promise';
import { T as SequenceExecutor } from '../../adapter-DYzAiJd4.js';
import 'kysely';
declare function createMySQL2Executor(pool: Pool): SequenceExecutor;
export { createMySQL2Executor };

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
"use strict";var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var o in e)u(t,o,{get:e[o],enumerable:!0})},x=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!y.call(t,r)&&r!==o&&u(t,r,{get:()=>e[r],enumerable:!(s=m(e,r))||s.enumerable});return t};var d=t=>x(u({},"__esModule",{value:!0}),t);var w={};S(w,{createNodeSQLiteExecutor:()=>h});module.exports=d(w);function h(t){return{execute:e=>{let{parameters:o,sql:s,transformations:r}=e,f=t.prepare(s);try{let n=f.all(...o);if(!r||Object.keys(r).length===0)return Promise.resolve([null,n]);for(let i of n)for(let a in r){let l=r[a],c=i[a];if(l==="json-parse"){if(typeof c=="string")try{i[a]=JSON.parse(c)}catch(p){console.error(`Failed to JSON.parse column "${a}" with value: ${c}`,p)}continue}}return Promise.resolve([null,n])}catch(n){return Promise.resolve([n])}}}}
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZVN5bmMsIFNRTElucHV0VmFsdWUgfSBmcm9tIFwibm9kZTpzcWxpdGVcIjtcblxuaW1wb3J0IHR5cGUgeyBFeGVjdXRvciB9IGZyb20gXCIuLi9leGVjdXRvclwiO1xuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yKG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LEtBQU1FLENBQUksQ0FBQyxFQUdyQyxRQUFXQyxLQUFPRCxFQUNoQixRQUFXRSxLQUFVSixFQUFpQixDQUNwQyxJQUFNSyxFQUFpQkwsRUFBZ0JJLENBQU0sRUFDdkNFLEVBQVFILEVBQUlDLENBQU0sRUFFeEIsR0FBSUMsSUFBbUIsYUFBYyxDQUNuQyxHQUFJLE9BQU9DLEdBQVUsU0FDbkIsR0FBSSxDQUNGSCxFQUFJQyxDQUFNLEVBQUksS0FBSyxNQUFNRSxDQUFLLENBQ2hDLE9BQVNDLEVBQU8sQ0FDZCxRQUFRLE1BQ04sZ0NBQWdDSCxDQUFNLGlCQUFpQkUsQ0FBSyxHQUM1REMsQ0FDRixDQUNGLENBR0YsUUFDRixDQUdGLENBR0YsT0FBTyxRQUFRLFFBQVEsQ0FBQyxLQUFNTCxDQUFJLENBQUMsQ0FDckMsT0FBU0ssRUFBZ0IsQ0FDdkIsT0FBTyxRQUFRLFFBQVEsQ0FBQ0EsQ0FBYyxDQUFDLENBQ3pDLENBQ0YsQ0FDRixDQUNGIiwKICAibmFtZXMiOiBbIm5vZGVfc3FsaXRlX2V4cG9ydHMiLCAiX19leHBvcnQiLCAiY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yIiwgIl9fdG9Db21tb25KUyIsICJkYXRhYmFzZSIsICJxdWVyeSIsICJwYXJhbWV0ZXJzIiwgInNxbCIsICJ0cmFuc2Zvcm1hdGlvbnMiLCAic3RhdGVtZW50IiwgInJvd3MiLCAicm93IiwgImNvbHVtbiIsICJ0cmFuc2Zvcm1hdGlvbiIsICJ2YWx1ZSIsICJlcnJvciJdCn0K

View file

@ -0,0 +1,7 @@
import { DatabaseSync } from 'node:sqlite';
import { L as Executor } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
declare function createNodeSQLiteExecutor(database: DatabaseSync): Executor;
export { createNodeSQLiteExecutor };

View file

@ -0,0 +1,7 @@
import { DatabaseSync } from 'node:sqlite';
import { L as Executor } from '../../adapter-DYzAiJd4.js';
import 'kysely';
declare function createNodeSQLiteExecutor(database: DatabaseSync): Executor;
export { createNodeSQLiteExecutor };

View file

@ -0,0 +1,10 @@
import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(`Unknown module ${mod}`);
}
import"../../chunk-6QJ7HVIC.js";function p(a){return{execute:c=>{let{parameters:u,sql:i,transformations:r}=c,l=a.prepare(i);try{let e=l.all(...u);if(!r||Object.keys(r).length===0)return Promise.resolve([null,e]);for(let n of e)for(let t in r){let s=r[t],o=n[t];if(s==="json-parse"){if(typeof o=="string")try{n[t]=JSON.parse(o)}catch(f){console.error(`Failed to JSON.parse column "${t}" with value: ${o}`,f)}continue}}return Promise.resolve([null,e])}catch(e){return Promise.resolve([e])}}}}export{p as createNodeSQLiteExecutor};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZVN5bmMsIFNRTElucHV0VmFsdWUgfSBmcm9tIFwibm9kZTpzcWxpdGVcIjtcblxuaW1wb3J0IHR5cGUgeyBFeGVjdXRvciB9IGZyb20gXCIuLi9leGVjdXRvclwiO1xuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yKGRhdGFiYXNlOiBEYXRhYmFzZVN5bmMpOiBFeGVjdXRvciB7XG4gIHJldHVybiB7XG4gICAgZXhlY3V0ZTogKHF1ZXJ5KSA9PiB7XG4gICAgICBjb25zdCB7IHBhcmFtZXRlcnMsIHNxbCwgdHJhbnNmb3JtYXRpb25zIH0gPSBxdWVyeTtcblxuICAgICAgY29uc3Qgc3RhdGVtZW50ID0gZGF0YWJhc2UucHJlcGFyZShzcWwpO1xuXG4gICAgICB0cnkge1xuICAgICAgICBjb25zdCByb3dzID0gc3RhdGVtZW50LmFsbCguLi4ocGFyYW1ldGVycyBhcyBTUUxJbnB1dFZhbHVlW10pKTtcblxuICAgICAgICBpZiAoIXRyYW5zZm9ybWF0aW9ucyB8fCBPYmplY3Qua2V5cyh0cmFuc2Zvcm1hdGlvbnMpLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW251bGwsIHJvd3NdKSBhcyBuZXZlcjtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoY29uc3Qgcm93IG9mIHJvd3MpIHtcbiAgICAgICAgICBmb3IgKGNvbnN0IGNvbHVtbiBpbiB0cmFuc2Zvcm1hdGlvbnMpIHtcbiAgICAgICAgICAgIGNvbnN0IHRyYW5zZm9ybWF0aW9uID0gdHJhbnNmb3JtYXRpb25zW2NvbHVtbl07XG4gICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHJvd1tjb2x1bW5dO1xuXG4gICAgICAgICAgICBpZiAodHJhbnNmb3JtYXRpb24gPT09IFwianNvbi1wYXJzZVwiKSB7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgcm93W2NvbHVtbl0gPSBKU09OLnBhcnNlKHZhbHVlKSBhcyBuZXZlcjtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihcbiAgICAgICAgICAgICAgICAgICAgYEZhaWxlZCB0byBKU09OLnBhcnNlIGNvbHVtbiBcIiR7Y29sdW1ufVwiIHdpdGggdmFsdWU6ICR7dmFsdWV9YCxcbiAgICAgICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICA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TyxDQUNkLFFBQVEsTUFDTixnQ0FBZ0NILENBQU0saUJBQWlCRSxDQUFLLEdBQzVEQyxDQUNGLENBQ0YsQ0FHRixRQUNGLENBR0YsQ0FHRixPQUFPLFFBQVEsUUFBUSxDQUFDLEtBQU1MLENBQUksQ0FBQyxDQUNyQyxPQUFTSyxFQUFnQixDQUN2QixPQUFPLFFBQVEsUUFBUSxDQUFDQSxDQUFjLENBQUMsQ0FDekMsQ0FDRixDQUNGLENBQ0YiLAogICJuYW1lcyI6IFsiY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yIiwgImRhdGFiYXNlIiwgInF1ZXJ5IiwgInBhcmFtZXRlcnMiLCAic3FsIiwgInRyYW5zZm9ybWF0aW9ucyIsICJzdGF0ZW1lbnQiLCAicm93cyIsICJyb3ciLCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIl0KfQo=

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,25 @@
import { PGlite } from '@electric-sql/pglite';
import { Q as Query, c as Adapter, L as Executor } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
interface PGLiteExecutorOptions {
/**
* Delay in milliseconds to add before executing the query.
* This can be a static number or a function that takes the query as an argument and returns a number.
*
* This is useful for simulating network latency or for debugging purposes.
*/
addDelay?: number | ((query: Query<unknown>) => number);
/**
* Whether to log the query and its parameters.
*
* Defaults to `false`.
*/
logging?: boolean | ((query: Query<unknown>) => boolean);
}
declare function createPGLiteExecutor(pglite: PGlite, options?: PGLiteExecutorOptions): Executor;
interface PGLiteAdapterOptions extends PGLiteExecutorOptions {
}
declare function createPGLiteAdapter(pglite: PGlite, options?: PGLiteAdapterOptions): Adapter;
export { type PGLiteAdapterOptions, type PGLiteExecutorOptions, createPGLiteAdapter, createPGLiteExecutor };

View file

@ -0,0 +1,25 @@
import { PGlite } from '@electric-sql/pglite';
import { Q as Query, c as Adapter, L as Executor } from '../../adapter-DYzAiJd4.js';
import 'kysely';
interface PGLiteExecutorOptions {
/**
* Delay in milliseconds to add before executing the query.
* This can be a static number or a function that takes the query as an argument and returns a number.
*
* This is useful for simulating network latency or for debugging purposes.
*/
addDelay?: number | ((query: Query<unknown>) => number);
/**
* Whether to log the query and its parameters.
*
* Defaults to `false`.
*/
logging?: boolean | ((query: Query<unknown>) => boolean);
}
declare function createPGLiteExecutor(pglite: PGlite, options?: PGLiteExecutorOptions): Executor;
interface PGLiteAdapterOptions extends PGLiteExecutorOptions {
}
declare function createPGLiteAdapter(pglite: PGlite, options?: PGLiteAdapterOptions): Adapter;
export { type PGLiteAdapterOptions, type PGLiteExecutorOptions, createPGLiteAdapter, createPGLiteExecutor };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,295 @@
import { t as AdapterRequirements, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic } from '../../adapter-DYzAiJd4.cjs';
import { h as FullTableSearchPlan } from '../../full-table-search-lTj-t9ys.cjs';
export { F as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS, a as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH, b as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS, c as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS, d as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE, e as FULL_TABLE_SEARCH_TIMEOUT_MS, f as FullTableSearchDialect, g as FullTableSearchExecutionState, i as FullTableSearchPredicate, j as FullTableSearchTimeoutError, l as createFullTableSearchExecutionState, m as executeQueryWithFullTableSearchGuardrails, n as getFullTableSearchExpression, o as isFullTableSearchRequest } from '../../full-table-search-lTj-t9ys.cjs';
import 'kysely';
type PostgresAdapterRequirements = AdapterRequirements;
declare function createPostgresAdapter(requirements: PostgresAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: { [K in "zoo" | "public"]: {
name: K;
tables: { [T in "animals" | "users" | "composite_pk"]: Table; };
}; };
timezone: "UTC";
filterOperators: FilterOperator[];
query: Query;
};
/**
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
*/
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
} & {
__ps_inserted_at__: `${bigint}`;
}>;
/**
* Returns a query that selects all columns from a table, along with an unbound row count as `__ps_count__`.
*/
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 1;
readonly name: "John Doe";
readonly __ps_count__: "2";
readonly role: "admin";
readonly name_role: "Jonn Doe - admin";
}, {
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 2;
readonly name: "Jane Doe";
readonly __ps_count__: "2";
readonly role: "poweruser";
readonly name_role: "Jane Doe - poweruser";
}];
/**
* Returns a query that updates a given row in a table with given changes.
*/
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: `${bigint}`;
}>;
/**
* Returns a query that deletes a given set of rows.
*/
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_deleted_at__: `${bigint}`;
}>;
declare function buildFullTableSearchPlan(args: {
searchTerm: string | undefined;
table: Table;
}): FullTableSearchPlan;
/**
* Returns a query that returns metadata for all user-defined tables and views in the database.
*/
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
schema: string;
name: string;
columns: {
name: string;
fk_column: string | null;
fk_table: string | null;
fk_schema: string | null;
datatype_schema: string;
datatype: string;
autoinc: boolean;
computed: boolean;
default: string | null;
nullable: boolean;
options: string[];
pk: number | null;
}[];
}>;
/**
* For testing purposes.
*/
declare function mockTablesQuery(): [{
readonly schema: "zoo";
readonly name: "animals";
readonly columns: [{
readonly autoinc: true;
readonly computed: false;
readonly datatype: "int4";
readonly datatype_schema: "pg_catalog";
readonly default: "nextval('zoo.animals_id_seq'::regclass)";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}];
}, {
readonly schema: "public";
readonly name: "users";
readonly columns: [{
readonly autoinc: true;
readonly computed: false;
readonly datatype: "int4";
readonly datatype_schema: "pg_catalog";
readonly default: "nextval('users_id_seq'::regclass)";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: "CURRENT_TIMESTAMP";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "deleted_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "varchar";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "role";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "varchar";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: true;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name_role";
readonly nullable: false;
readonly options: [];
readonly pk: null;
}];
}, {
readonly schema: "public";
readonly name: "composite_pk";
readonly columns: [{
readonly autoinc: false;
readonly computed: false;
readonly datatype: "uuid";
readonly datatype_schema: "pg_catalog";
readonly default: "gen_random_uuid()";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: 2;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: "now()";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}];
}];
/**
* Returns a query that returns the current timezone setting of the PostgreSQL database.
*/
declare function getTimezoneQuery(): Query<{
timezone: string;
}>;
/**
* For testing purposes.
*/
declare function mockTimezoneQuery(): [{
readonly timezone: "UTC";
}];
declare const SQL_LINT_MAX_LENGTH: number;
declare const SQL_LINT_ALLOWED_STATEMENT_KEYWORDS: Set<string>;
interface SqlLintValidatedStatement {
from: number;
statement: string;
to: number;
}
type SqlLintValidationResult = {
ok: true;
statements: SqlLintValidatedStatement[];
} | {
diagnostic: AdapterSqlLintDiagnostic;
ok: false;
};
declare function validateSqlForLint(sql: string): SqlLintValidationResult;
declare function createLintDiagnosticsFromPostgresError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function getPIDQuery(): Query<{
pid: unknown;
}>;
declare function getCancelQuery(pid: {}): Query<unknown>;
export { type PostgresAdapterRequirements, SQL_LINT_ALLOWED_STATEMENT_KEYWORDS, SQL_LINT_MAX_LENGTH, type SqlLintValidatedStatement, type SqlLintValidationResult, buildFullTableSearchPlan, createLintDiagnosticsFromPostgresError, createPostgresAdapter, getCancelQuery, getDeleteQuery, getInsertQuery, getPIDQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery, validateSqlForLint };

View file

@ -0,0 +1,295 @@
import { t as AdapterRequirements, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic } from '../../adapter-DYzAiJd4.js';
import { h as FullTableSearchPlan } from '../../full-table-search-DQB6lY-i.js';
export { F as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS, a as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH, b as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS, c as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS, d as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE, e as FULL_TABLE_SEARCH_TIMEOUT_MS, f as FullTableSearchDialect, g as FullTableSearchExecutionState, i as FullTableSearchPredicate, j as FullTableSearchTimeoutError, l as createFullTableSearchExecutionState, m as executeQueryWithFullTableSearchGuardrails, n as getFullTableSearchExpression, o as isFullTableSearchRequest } from '../../full-table-search-DQB6lY-i.js';
import 'kysely';
type PostgresAdapterRequirements = AdapterRequirements;
declare function createPostgresAdapter(requirements: PostgresAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: { [K in "zoo" | "public"]: {
name: K;
tables: { [T in "animals" | "users" | "composite_pk"]: Table; };
}; };
timezone: "UTC";
filterOperators: FilterOperator[];
query: Query;
};
/**
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
*/
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
} & {
__ps_inserted_at__: `${bigint}`;
}>;
/**
* Returns a query that selects all columns from a table, along with an unbound row count as `__ps_count__`.
*/
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 1;
readonly name: "John Doe";
readonly __ps_count__: "2";
readonly role: "admin";
readonly name_role: "Jonn Doe - admin";
}, {
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 2;
readonly name: "Jane Doe";
readonly __ps_count__: "2";
readonly role: "poweruser";
readonly name_role: "Jane Doe - poweruser";
}];
/**
* Returns a query that updates a given row in a table with given changes.
*/
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: `${bigint}`;
}>;
/**
* Returns a query that deletes a given set of rows.
*/
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_deleted_at__: `${bigint}`;
}>;
declare function buildFullTableSearchPlan(args: {
searchTerm: string | undefined;
table: Table;
}): FullTableSearchPlan;
/**
* Returns a query that returns metadata for all user-defined tables and views in the database.
*/
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
schema: string;
name: string;
columns: {
name: string;
fk_column: string | null;
fk_table: string | null;
fk_schema: string | null;
datatype_schema: string;
datatype: string;
autoinc: boolean;
computed: boolean;
default: string | null;
nullable: boolean;
options: string[];
pk: number | null;
}[];
}>;
/**
* For testing purposes.
*/
declare function mockTablesQuery(): [{
readonly schema: "zoo";
readonly name: "animals";
readonly columns: [{
readonly autoinc: true;
readonly computed: false;
readonly datatype: "int4";
readonly datatype_schema: "pg_catalog";
readonly default: "nextval('zoo.animals_id_seq'::regclass)";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}];
}, {
readonly schema: "public";
readonly name: "users";
readonly columns: [{
readonly autoinc: true;
readonly computed: false;
readonly datatype: "int4";
readonly datatype_schema: "pg_catalog";
readonly default: "nextval('users_id_seq'::regclass)";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: "CURRENT_TIMESTAMP";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "deleted_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "varchar";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "role";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "varchar";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}, {
readonly autoinc: false;
readonly computed: true;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name_role";
readonly nullable: false;
readonly options: [];
readonly pk: null;
}];
}, {
readonly schema: "public";
readonly name: "composite_pk";
readonly columns: [{
readonly autoinc: false;
readonly computed: false;
readonly datatype: "uuid";
readonly datatype_schema: "pg_catalog";
readonly default: "gen_random_uuid()";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "id";
readonly nullable: false;
readonly options: [];
readonly pk: 1;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "text";
readonly datatype_schema: "pg_catalog";
readonly default: null;
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "name";
readonly nullable: true;
readonly options: [];
readonly pk: 2;
}, {
readonly autoinc: false;
readonly computed: false;
readonly datatype: "timestamp";
readonly datatype_schema: "pg_catalog";
readonly default: "now()";
readonly fk_column: null;
readonly fk_schema: null;
readonly fk_table: null;
readonly name: "created_at";
readonly nullable: true;
readonly options: [];
readonly pk: null;
}];
}];
/**
* Returns a query that returns the current timezone setting of the PostgreSQL database.
*/
declare function getTimezoneQuery(): Query<{
timezone: string;
}>;
/**
* For testing purposes.
*/
declare function mockTimezoneQuery(): [{
readonly timezone: "UTC";
}];
declare const SQL_LINT_MAX_LENGTH: number;
declare const SQL_LINT_ALLOWED_STATEMENT_KEYWORDS: Set<string>;
interface SqlLintValidatedStatement {
from: number;
statement: string;
to: number;
}
type SqlLintValidationResult = {
ok: true;
statements: SqlLintValidatedStatement[];
} | {
diagnostic: AdapterSqlLintDiagnostic;
ok: false;
};
declare function validateSqlForLint(sql: string): SqlLintValidationResult;
declare function createLintDiagnosticsFromPostgresError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function getPIDQuery(): Query<{
pid: unknown;
}>;
declare function getCancelQuery(pid: {}): Query<unknown>;
export { type PostgresAdapterRequirements, SQL_LINT_ALLOWED_STATEMENT_KEYWORDS, SQL_LINT_MAX_LENGTH, type SqlLintValidatedStatement, type SqlLintValidationResult, buildFullTableSearchPlan, createLintDiagnosticsFromPostgresError, createPostgresAdapter, getCancelQuery, getDeleteQuery, getInsertQuery, getPIDQuery, getSelectQuery, getTablesQuery, getTimezoneQuery, getUpdateQuery, mockIntrospect, mockSelectQuery, mockTablesQuery, mockTimezoneQuery, validateSqlForLint };

View file

@ -0,0 +1,10 @@
import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(`Unknown module ${mod}`);
}
import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A}from"../../chunk-N7Y4WNYT.js";import{a as B,b as C}from"../../chunk-LR4WIE5H.js";import"../../chunk-Y2CNJZK5.js";import{a as l,b as m,c as n,d as o}from"../../chunk-GKER6YAU.js";import{a,b,c,d,e,f,g,h,i,j,l as k}from"../../chunk-PI3N7ZW6.js";import"../../chunk-N6ZIYSZ5.js";import"../../chunk-LR52PZTP.js";import"../../chunk-6QJ7HVIC.js";export{e as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS,d as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH,c as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS,b as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS,f as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE,a as FULL_TABLE_SEARCH_TIMEOUT_MS,g as FullTableSearchTimeoutError,m as SQL_LINT_ALLOWED_STATEMENT_KEYWORDS,l as SQL_LINT_MAX_LENGTH,p as buildFullTableSearchPlan,h as createFullTableSearchExecutionState,o as createLintDiagnosticsFromPostgresError,z as createPostgresAdapter,j as executeQueryWithFullTableSearchGuardrails,C as getCancelQuery,u as getDeleteQuery,k as getFullTableSearchExpression,q as getInsertQuery,B as getPIDQuery,r as getSelectQuery,v as getTablesQuery,x as getTimezoneQuery,t as getUpdateQuery,i as isFullTableSearchRequest,A as mockIntrospect,s as mockSelectQuery,w as mockTablesQuery,y as mockTimezoneQuery,n as validateSqlForLint};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
import { Sql } from 'postgres';
import { L as Executor } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
declare function createPostgresJSExecutor(postgresjs: Sql): Executor;
export { createPostgresJSExecutor };

View file

@ -0,0 +1,7 @@
import { Sql } from 'postgres';
import { L as Executor } from '../../adapter-DYzAiJd4.js';
import 'kysely';
declare function createPostgresJSExecutor(postgresjs: Sql): Executor;
export { createPostgresJSExecutor };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,208 @@
import { t as AdapterRequirements, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, L as Executor, u as AdapterSqlLintDetails, J as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-DYzAiJd4.cjs';
import * as kysely from 'kysely';
type SQLIteAdapterRequirements = AdapterRequirements;
declare function createSQLiteAdapter(requirements: SQLIteAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: {
main: {
name: "main";
tables: { [T in "animals" | "users" | "composite_pk"]: Table; };
};
};
timezone: string;
filterOperators: FilterOperator[];
query: Query;
};
/**
* Returns a query that selects all columns from a table with an unbound row count as `__ps_count__`.
*/
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 1;
readonly name: "John Doe";
readonly __ps_count__: "2";
readonly role: "admin";
readonly name_role: "Jonn Doe - admin";
}, {
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 2;
readonly name: "Jane Doe";
readonly __ps_count__: "2";
readonly role: "poweruser";
readonly name_role: "Jane Doe - poweruser";
}];
/**
* Returns a query that deletes a given set of rows.
*/
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_deleted_at__: `${bigint}`;
}>;
/**
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
*/
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
} & {
__ps_inserted_at__: `${bigint}`;
}>;
/**
* Returns a query that updates a given row in a table with given changes.
*/
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: `${bigint}`;
}>;
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
name: string;
sql: string;
columns: {
name: string;
pk: number;
default: string | null;
datatype: string;
fk_table: string | null;
fk_column: string | null;
computed: kysely.SqlBool;
nullable: kysely.SqlBool;
}[];
}>;
/**
* For testing purposes.
*/
declare function mockTablesQuery(): [{
readonly name: "animals";
readonly sql: "CREATE TABLE animals (id INTEGER PRIMARY KEY, name TEXT);";
readonly columns: [{
readonly name: "id";
readonly datatype: "INTEGER";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "TEXT";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}];
}, {
readonly name: "users";
readonly sql: "CREATE TABLE users (id UUID PRIMARY KEY, created_at TIMESTAMP, deleted_at TIMESTAMP, role varchar, name varchar, name_role text);";
readonly columns: [{
readonly name: "id";
readonly datatype: "INTEGER";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "created_at";
readonly datatype: "TIMESTAMP";
readonly default: "1970-01-01 00:00:00.000";
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "deleted_at";
readonly datatype: "TIMESTAMP";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "role";
readonly datatype: "varchar";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "varchar";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name_role";
readonly datatype: "text";
readonly default: null;
readonly pk: 0;
readonly computed: 1;
readonly nullable: 0;
readonly fk_table: null;
readonly fk_column: null;
}];
}, {
readonly name: "composite_pk";
readonly sql: "CREATE TABLE composite_pk (id UUID, name TEXT, created_at timestamp, PRIMARY KEY (id, name));";
readonly columns: [{
readonly name: "id";
readonly datatype: "text";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "TEXT";
readonly default: null;
readonly pk: 2;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "created_at";
readonly datatype: "timestamp";
readonly default: "1970-01-01 00:00:00.000";
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}];
}];
declare function createLintDiagnosticsFromSQLiteError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function lintSQLiteWithExplainFallback(executor: Executor, details: AdapterSqlLintDetails, options: Parameters<NonNullable<Adapter["sqlLint"]>>[1]): Promise<Either<AdapterError, AdapterSqlLintResult>>;
export { type SQLIteAdapterRequirements, createLintDiagnosticsFromSQLiteError, createSQLiteAdapter, getDeleteQuery, getInsertQuery, getSelectQuery, getTablesQuery, getUpdateQuery, lintSQLiteWithExplainFallback, mockIntrospect, mockSelectQuery, mockTablesQuery };

View file

@ -0,0 +1,208 @@
import { t as AdapterRequirements, c as Adapter, _ as Table, N as FilterOperator, Q as Query, f as AdapterDeleteDetails, a2 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, L as Executor, u as AdapterSqlLintDetails, J as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-DYzAiJd4.js';
import * as kysely from 'kysely';
type SQLIteAdapterRequirements = AdapterRequirements;
declare function createSQLiteAdapter(requirements: SQLIteAdapterRequirements): Adapter;
/**
* For testing purposes.
*/
declare function mockIntrospect(): {
schemas: {
main: {
name: "main";
tables: { [T in "animals" | "users" | "composite_pk"]: Table; };
};
};
timezone: string;
filterOperators: FilterOperator[];
query: Query;
};
/**
* Returns a query that selects all columns from a table with an unbound row count as `__ps_count__`.
*/
declare function getSelectQuery(details: AdapterQueryDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_count__: `${bigint}`;
}>;
/**
* For testing purposes.
*/
declare function mockSelectQuery(): [{
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 1;
readonly name: "John Doe";
readonly __ps_count__: "2";
readonly role: "admin";
readonly name_role: "Jonn Doe - admin";
}, {
readonly created_at: Date;
readonly deleted_at: null;
readonly id: 2;
readonly name: "Jane Doe";
readonly __ps_count__: "2";
readonly role: "poweruser";
readonly name_role: "Jane Doe - poweruser";
}];
/**
* Returns a query that deletes a given set of rows.
*/
declare function getDeleteQuery(details: AdapterDeleteDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_deleted_at__: `${bigint}`;
}>;
/**
* Inserts one or more rows into a table and returns the inserted rows along with their `ctid`.
*/
declare function getInsertQuery(details: AdapterInsertDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
} & {
__ps_inserted_at__: `${bigint}`;
}>;
/**
* Returns a query that updates a given row in a table with given changes.
*/
declare function getUpdateQuery(details: AdapterUpdateDetails, requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
[x: string]: unknown;
__ps_updated_at__: `${bigint}`;
}>;
declare function getTablesQuery(requirements?: Omit<BuilderRequirements, "Adapter" | "QueryCompiler">): Query<{
name: string;
sql: string;
columns: {
name: string;
pk: number;
default: string | null;
datatype: string;
fk_table: string | null;
fk_column: string | null;
computed: kysely.SqlBool;
nullable: kysely.SqlBool;
}[];
}>;
/**
* For testing purposes.
*/
declare function mockTablesQuery(): [{
readonly name: "animals";
readonly sql: "CREATE TABLE animals (id INTEGER PRIMARY KEY, name TEXT);";
readonly columns: [{
readonly name: "id";
readonly datatype: "INTEGER";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "TEXT";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}];
}, {
readonly name: "users";
readonly sql: "CREATE TABLE users (id UUID PRIMARY KEY, created_at TIMESTAMP, deleted_at TIMESTAMP, role varchar, name varchar, name_role text);";
readonly columns: [{
readonly name: "id";
readonly datatype: "INTEGER";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "created_at";
readonly datatype: "TIMESTAMP";
readonly default: "1970-01-01 00:00:00.000";
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "deleted_at";
readonly datatype: "TIMESTAMP";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "role";
readonly datatype: "varchar";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "varchar";
readonly default: null;
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name_role";
readonly datatype: "text";
readonly default: null;
readonly pk: 0;
readonly computed: 1;
readonly nullable: 0;
readonly fk_table: null;
readonly fk_column: null;
}];
}, {
readonly name: "composite_pk";
readonly sql: "CREATE TABLE composite_pk (id UUID, name TEXT, created_at timestamp, PRIMARY KEY (id, name));";
readonly columns: [{
readonly name: "id";
readonly datatype: "text";
readonly default: null;
readonly pk: 1;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "name";
readonly datatype: "TEXT";
readonly default: null;
readonly pk: 2;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}, {
readonly name: "created_at";
readonly datatype: "timestamp";
readonly default: "1970-01-01 00:00:00.000";
readonly pk: 0;
readonly computed: 0;
readonly nullable: 1;
readonly fk_table: null;
readonly fk_column: null;
}];
}];
declare function createLintDiagnosticsFromSQLiteError(args: {
error: unknown;
positionOffset?: number;
sql: string;
}): AdapterSqlLintDiagnostic[];
declare function lintSQLiteWithExplainFallback(executor: Executor, details: AdapterSqlLintDetails, options: Parameters<NonNullable<Adapter["sqlLint"]>>[1]): Promise<Either<AdapterError, AdapterSqlLintResult>>;
export { type SQLIteAdapterRequirements, createLintDiagnosticsFromSQLiteError, createSQLiteAdapter, getDeleteQuery, getInsertQuery, getSelectQuery, getTablesQuery, getUpdateQuery, lintSQLiteWithExplainFallback, mockIntrospect, mockSelectQuery, mockTablesQuery };

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
"use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},x=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!h.call(t,r)&&r!==o&&l(t,r,{get:()=>e[r],enumerable:!(n=m(e,r))||n.enumerable});return t};var y=t=>x(l({},"__esModule",{value:!0}),t);var b={};w(b,{createSQLJSExecutor:()=>S});module.exports=y(b);function S(t){return{execute:e=>{let{parameters:o,sql:n,transformations:r}=e,u=t.prepare(n);u.bind(o);let a=[];try{for(;u.step();){let s=u.getAsObject();a.push(s)}if(!r||Object.keys(r).length===0)return Promise.resolve([null,a]);for(let s of a)for(let c in r){let f=r[c],i=s[c];if(f==="json-parse"){if(typeof i=="string")try{s[c]=JSON.parse(i)}catch(p){console.error(`Failed to JSON.parse column "${c}" with value: ${i}`,p)}continue}}return Promise.resolve([null,a])}catch(s){return Promise.resolve([s])}}}}
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2VzQ29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9IHRyYW5zZm9ybWF0aW9uc1tjb2x1bW5dO1xuICAgICAgICAgICAgY29uc3QgdmFsdWUgPSByb3dbY29sdW1uXTtcblxuICAgICAgICAgICAgaWYgKHRyYW5zZm9ybWF0aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gc2F0aXNmaWVzIHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICB9IGNhdGNoIChlcnJvcjogdW5rbm93bikge1xuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtlcnJvciBhcyBFcnJvcl0pO1xuICAgICAgfVxuICAgIH0sXG4gIH07XG59XG4iXSwKICAibWFwcGluZ3MiOiAieWFBQUEsSUFBQUEsRUFBQSxHQUFBQyxFQUFBRCxFQUFBLHlCQUFBRSxJQUFBLGVBQUFDLEVBQ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gIm5hbWVzIjogWyJzcWxqc19leHBvcnRzIiwgIl9fZXhwb3J0IiwgImNyZWF0ZVNRTEpTRXhlY3V0b3IiLCAiX190b0NvbW1vbkpTIiwgImRhdGFiYXNlIiwgInF1ZXJ5IiwgInBhcmFtZXRlcnMiLCAic3FsIiwgInRyYW5zZm9ybWF0aW9ucyIsICJzdGF0ZW1lbnQiLCAicm93cyIsICJyb3ciLCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIl0KfQo=

View file

@ -0,0 +1,7 @@
import { Database } from 'sql.js';
import { L as Executor } from '../../adapter-DYzAiJd4.cjs';
import 'kysely';
declare function createSQLJSExecutor(database: Database): Executor;
export { createSQLJSExecutor };

View file

@ -0,0 +1,7 @@
import { Database } from 'sql.js';
import { L as Executor } from '../../adapter-DYzAiJd4.js';
import 'kysely';
declare function createSQLJSExecutor(database: Database): Executor;
export { createSQLJSExecutor };

View file

@ -0,0 +1,10 @@
import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(`Unknown module ${mod}`);
}
import"../../chunk-6QJ7HVIC.js";function p(c){return{execute:u=>{let{parameters:i,sql:l,transformations:r}=u,s=c.prepare(l);s.bind(i);let t=[];try{for(;s.step();){let e=s.getAsObject();t.push(e)}if(!r||Object.keys(r).length===0)return Promise.resolve([null,t]);for(let e of t)for(let o in r){let a=r[o],n=e[o];if(a==="json-parse"){if(typeof n=="string")try{e[o]=JSON.parse(n)}catch(f){console.error(`Failed to JSON.parse column "${o}" with value: ${n}`,f)}continue}}return Promise.resolve([null,t])}catch(e){return Promise.resolve([e])}}}}export{p as createSQLJSExecutor};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IF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Zm9ybWF0aW9uc1tjb2x1bW5dO1xuICAgICAgICAgICAgY29uc3QgdmFsdWUgPSByb3dbY29sdW1uXTtcblxuICAgICAgICAgICAgaWYgKHRyYW5zZm9ybWF0aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gc2F0aXNmaWVzIHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICB9IGNhdGNoIChlcnJvcjogdW5rbm93bikge1xuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtlcnJvciBhcyBFcnJvcl0pO1xuICAgICAgfVxuICAgIH0sXG4gIH07XG59XG4iXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7OztnQ0FJTyxTQUFTQSxFQUFvQkMsRUFBOEIsQ0FDaEUsTUFBTyxDQUNMLFFBQVVDLEdBQVU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