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

View file

@ -0,0 +1,419 @@
import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
interface BuilderRequirements {
Adapter: {
new (): DialectAdapter;
};
noParameters?: boolean;
QueryCompiler: {
new (): QueryCompiler;
};
}
declare const queryType: unique symbol;
interface Query<T = Record<string, unknown>> {
[queryType]?: T;
parameters: readonly unknown[];
sql: string;
transformations?: Partial<Record<keyof T, "json-parse">>;
}
type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
/**
* Applies a filter to the given rows based on the primary key columns of the table.
*
* @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
*/
declare function applyInferredRowFilters(rows: Record<string, unknown>[], columns: Table["columns"]): <QB extends WhereInterface<any, any>>(qb: QB) => QB;
type Either<E, R> = [E] | [null, R];
type NumericString = `${number}`;
type BigIntString = `${bigint}`;
interface Executor {
execute<T>(query: Query<T>, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<T>>>>;
/**
* Optional SQL lint transport for parse/plan diagnostics.
*
* Executors that do not implement this capability can still be used by
* adapters with fallback lint strategies.
*/
lintSql?(details: SqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, SqlLintResult>>;
}
interface SequenceExecutor extends Executor {
executeSequence<T, S>(sequence: readonly [Query<T>, Query<S>], options?: ExecuteOptions): Promise<[[Error]] | [[null, QueryResult<Query<T>>], Either<Error, QueryResult<Query<S>>>]>;
}
interface ExecuteOptions {
abortSignal?: AbortSignal;
}
interface SqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface SqlLintDiagnostic {
code?: string;
from: number;
message: string;
severity: "error" | "warning" | "info" | "hint";
source?: string;
to: number;
}
interface SqlLintResult {
diagnostics: SqlLintDiagnostic[];
schemaVersion?: string;
}
declare class AbortError extends Error {
constructor();
}
declare function getAbortResult(): [AbortError];
interface AdapterRequirements {
executor: Executor;
noParameters?: boolean;
}
interface AdapterCapabilities {
/**
* Whether full-table content search is supported by this adapter.
*/
fullTableSearch: boolean;
/**
* SQL dialect used by SQL editor highlighting/autocomplete.
*/
sqlDialect: SqlEditorDialect;
/**
* Whether SQL editor schema-aware autocomplete is supported.
*/
sqlEditorAutocomplete: boolean;
/**
* Whether SQL editor lint diagnostics are supported.
*/
sqlEditorLint: boolean;
}
interface Adapter {
/**
* The schema studio will choose by default.
*
* e.g. `public` for PostgreSQL
*/
readonly defaultSchema?: string;
/**
* Optional adapter feature flags used by the UI.
*/
readonly capabilities?: Partial<AdapterCapabilities>;
/**
* Introspects the database and returns structured information about the schemas, tables, etc.
*
* @param options - Options for the introspection request.
*/
introspect(options: AdapterIntrospectOptions): Promise<Either<AdapterError, AdapterIntrospectResult>>;
/**
* Executes a structured query against the database.
*/
query(details: AdapterQueryDetails, options: AdapterQueryOptions): Promise<Either<AdapterError, AdapterQueryResult>>;
/**
* Executes raw SQL against the database.
*/
raw(details: AdapterRawDetails, options: AdapterRawOptions): Promise<Either<AdapterError, AdapterRawResult>>;
/**
* Returns schema metadata for SQL editor autocomplete.
*/
sqlSchema?(details: AdapterSqlSchemaDetails, options: AdapterSqlSchemaOptions): Promise<Either<AdapterError, AdapterSqlSchemaResult>>;
/**
* Returns SQL editor diagnostics (syntax/schema linting).
*/
sqlLint?(details: AdapterSqlLintDetails, options: AdapterSqlLintOptions): Promise<Either<AdapterError, AdapterSqlLintResult>>;
/**
* Inserts a single row into the database.
*/
insert(details: AdapterInsertDetails, options: AdapterInsertOptions): Promise<Either<AdapterError, AdapterInsertResult>>;
/**
* Updates a given row in the database with given changes.
*/
update(details: AdapterUpdateDetails, options: AdapterUpdateOptions): Promise<Either<AdapterError, AdapterUpdateResult>>;
/**
* Deletes given rows from the database.
*/
delete(details: AdapterDeleteDetails, options: AdapterDeleteOptions): Promise<Either<AdapterError, AdapterDeleteResult>>;
}
interface AdapterBaseOptions {
}
interface AdapterIntrospectOptions extends AdapterBaseOptions {
}
interface AdapterQueryOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterRawOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterSqlSchemaOptions extends AdapterBaseOptions {
}
interface AdapterSqlLintOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterInsertOptions extends AdapterBaseOptions {
}
interface AdapterUpdateOptions extends AdapterBaseOptions {
}
interface AdapterDeleteOptions extends AdapterBaseOptions {
}
type SchemaName = string;
interface AdapterIntrospectResult {
schemas: Record<SchemaName, Schema>;
timezone: string;
filterOperators: FilterOperator[];
query: Query;
}
type TableName = string;
interface Schema {
name: string;
tables: Record<TableName, Table>;
}
type ColumnName = string;
interface Table {
columns: Record<ColumnName, Column>;
name: TableName;
schema: SchemaName;
}
interface Column {
datatype: DataType;
defaultValue: "CURRENT_DATE" | "CURRENT_TIME" | "CURRENT_TIMESTAMP" | "datetime('now')" | "gen_random_uuid()" | "json_array()" | `nextval(${string})` | `now()` | "uuid_to_bin(uuid())" | "uuid()" | (string & {}) | null;
fkColumn: ColumnName | null;
fkSchema: SchemaName | null;
fkTable: TableName | null;
isAutoincrement: boolean;
isComputed: boolean;
isRequired: boolean;
name: ColumnName;
nullable: boolean;
pkPosition: number | null;
schema: SchemaName;
table: TableName;
}
interface DataType {
/**
* The database-specific affinity/type.
*
* e.g. in SQLite, datatypes can be anything. They are reduced to affinity via string matching rules.
*
* {@link https://sqlite.org/datatype3.html#determination_of_column_affinity}
*/
affinity?: string;
/**
* The database-specific format for the datatype.
*/
format?: string;
/**
* A simplification/normalization for UI usage.
*
* e.g. varchar and char are strings.
*/
group: DataTypeGroup;
/**
* Is this a native array type?
*/
isArray: boolean;
/**
* Is a native database datatype or a user-defined datatype?
*
* e.g. PostgreSQL enums are user-defined datatypes, but `int4` is a native datatype.
*/
isNative: boolean;
/**
* Will be displayed as-is.
*/
name: string;
/**
* Enum values for enum types.
*/
options: string[];
/**
* The schema the datatype belongs to.
*/
schema: string;
}
type DataTypeGroup = "string" | "datetime" | "boolean" | "enum" | "time" | "raw" | "numeric" | "json";
interface AdapterQueryDetails {
/**
* Zero-based index of the page to fetch.
*/
pageIndex: number;
/**
* Maximum number of rows to fetch from the database.
*/
pageSize: number;
/**
* Sort order for the query.
*/
sortOrder: SortOrderItem[];
/**
* The table to select from.
*/
table: Table;
/**
* The filter to be applied.
*/
filter?: FilterGroup;
/**
* Optional full-table content search term.
*
* This is interpreted by database-specific adapters and composed into the
* generated SQL query.
*/
fullTableSearchTerm?: string;
}
type FilterOperator = "=" | "!=" | ">" | ">=" | "<" | "<=" | "is" | "is not" | "like" | "not like" | "ilike" | "not ilike";
interface ColumnFilter {
kind: "ColumnFilter";
column: string;
operator: FilterOperator;
value: unknown;
after: "and" | "or";
id: string;
}
interface SqlFilter {
kind: "SqlFilter";
sql: string;
after: "and" | "or";
id: string;
}
interface FilterGroup {
kind: "FilterGroup";
filters: (ColumnFilter | FilterGroup | SqlFilter)[];
after: "and" | "or";
id: string;
}
interface SortOrderItem {
/**
* The column to sort by.
*/
column: ColumnName;
/**
* The direction to sort the column by.
*/
direction: SortDirection;
}
type SortDirection = "asc" | "desc";
declare class AdapterError extends Error {
query?: Query<unknown>;
}
interface AdapterQueryResult {
/**
* The total number of rows the query would return if not limited.
*
* If the database does not support counting rows, this should be set to `Infinity`.
*/
filteredRowCount: number | bigint | NumericString | BigIntString;
/**
* The rows returned by the query.
*/
rows: Record<ColumnName, unknown>[];
/**
* The executed query string.
*/
query: Query;
}
interface AdapterRawDetails {
sql: string;
}
interface AdapterRawResult {
rowCount: number;
rows: Record<string, unknown>[];
query: Query;
}
interface AdapterSqlSchemaDetails {
}
interface AdapterSqlSchemaResult {
defaultSchema?: string;
dialect: SqlEditorDialect;
namespace: Record<string, Record<string, string[]>>;
version: string;
}
interface AdapterSqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface AdapterSqlLintDiagnostic {
code?: string;
from: number;
message: string;
severity: "error" | "warning" | "info" | "hint";
source?: string;
to: number;
}
interface AdapterSqlLintResult {
diagnostics: AdapterSqlLintDiagnostic[];
schemaVersion?: string;
}
type SqlEditorDialect = "postgresql" | "mysql" | "sqlite";
interface AdapterInsertDetails {
/**
* The table to insert into.
*/
table: Table;
/**
* The values to insert into the table.
* - The keys should match the column names in the table.
* - The values should be the values to insert into the table.
*/
rows: Record<string, unknown>[];
}
interface AdapterInsertResult {
/**
* The freshly inserted row data.
*/
rows: Record<string, unknown>[];
/**
* The executed query string.
*/
query: Query<unknown>;
}
interface AdapterUpdateDetails {
/**
* Changes to apply to the row.
*/
changes: Record<ColumnName, unknown>;
/**
* The row to update.
*/
row: Record<ColumnName, unknown>;
/**
* The table to update in.
*/
table: Table;
}
interface AdapterUpdateResult {
/**
* The updated row data.
*/
row: Record<ColumnName, unknown> & {
/**
* When the changes were applied in database time.
*/
__ps_updated_at__: string | number | Date;
};
/**
* The executed query string.
*/
query: Query<unknown>;
}
interface AdapterDeleteDetails {
/**
* The rows to delete.
*/
rows: Record<ColumnName, unknown>[];
/**
* The table to delete from.
*/
table: Table;
}
interface AdapterDeleteResult {
rows: Record<ColumnName, unknown>[];
/**
* The executed query string.
*/
query: Query<unknown>;
}
declare function createAdapterError(args: {
error: Error;
query?: Query<unknown>;
}): [AdapterError];
export { applyInferredRowFilters as $, type AdapterIntrospectResult as A, type AdapterUpdateDetails as B, type AdapterUpdateOptions as C, type AdapterUpdateResult as D, type BigIntString as E, type Column as F, type ColumnFilter as G, type DataType as H, type DataTypeGroup as I, type Either as J, type ExecuteOptions as K, type Executor as L, type FilterGroup as M, type FilterOperator as N, type NumericString as O, type QueryResult as P, type Query as Q, type Schema as R, type SqlEditorDialect as S, type SequenceExecutor as T, type SortDirection as U, type SortOrderItem as V, type SqlFilter as W, type SqlLintDetails as X, type SqlLintDiagnostic as Y, type SqlLintResult as Z, type Table as _, type AdapterSqlSchemaResult as a, createAdapterError as a0, getAbortResult as a1, type BuilderRequirements as a2, AbortError as b, type Adapter as c, type AdapterBaseOptions as d, type AdapterCapabilities as e, type AdapterDeleteDetails as f, type AdapterDeleteOptions as g, type AdapterDeleteResult as h, AdapterError as i, type AdapterInsertDetails as j, type AdapterInsertOptions as k, type AdapterInsertResult as l, type AdapterIntrospectOptions as m, type AdapterQueryDetails as n, type AdapterQueryOptions as o, type AdapterQueryResult as p, type AdapterRawDetails as q, type AdapterRawOptions as r, type AdapterRawResult as s, type AdapterRequirements as t, type AdapterSqlLintDetails as u, type AdapterSqlLintDiagnostic as v, type AdapterSqlLintOptions as w, type AdapterSqlLintResult as x, type AdapterSqlSchemaDetails as y, type AdapterSqlSchemaOptions as z };

View file

@ -0,0 +1,419 @@
import { WhereInterface, DialectAdapter, QueryCompiler } from 'kysely';
interface BuilderRequirements {
Adapter: {
new (): DialectAdapter;
};
noParameters?: boolean;
QueryCompiler: {
new (): QueryCompiler;
};
}
declare const queryType: unique symbol;
interface Query<T = Record<string, unknown>> {
[queryType]?: T;
parameters: readonly unknown[];
sql: string;
transformations?: Partial<Record<keyof T, "json-parse">>;
}
type QueryResult<T> = T extends Query<infer R> ? R[] : T extends (...args: any[]) => Query<infer R> ? R[] : never;
/**
* Applies a filter to the given rows based on the primary key columns of the table.
*
* @example db.selectFrom("users").$call(applyInferredRowFilters(rows, columns)).selectAll()
*/
declare function applyInferredRowFilters(rows: Record<string, unknown>[], columns: Table["columns"]): <QB extends WhereInterface<any, any>>(qb: QB) => QB;
type Either<E, R> = [E] | [null, R];
type NumericString = `${number}`;
type BigIntString = `${bigint}`;
interface Executor {
execute<T>(query: Query<T>, options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<T>>>>;
/**
* Optional SQL lint transport for parse/plan diagnostics.
*
* Executors that do not implement this capability can still be used by
* adapters with fallback lint strategies.
*/
lintSql?(details: SqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, SqlLintResult>>;
}
interface SequenceExecutor extends Executor {
executeSequence<T, S>(sequence: readonly [Query<T>, Query<S>], options?: ExecuteOptions): Promise<[[Error]] | [[null, QueryResult<Query<T>>], Either<Error, QueryResult<Query<S>>>]>;
}
interface ExecuteOptions {
abortSignal?: AbortSignal;
}
interface SqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface SqlLintDiagnostic {
code?: string;
from: number;
message: string;
severity: "error" | "warning" | "info" | "hint";
source?: string;
to: number;
}
interface SqlLintResult {
diagnostics: SqlLintDiagnostic[];
schemaVersion?: string;
}
declare class AbortError extends Error {
constructor();
}
declare function getAbortResult(): [AbortError];
interface AdapterRequirements {
executor: Executor;
noParameters?: boolean;
}
interface AdapterCapabilities {
/**
* Whether full-table content search is supported by this adapter.
*/
fullTableSearch: boolean;
/**
* SQL dialect used by SQL editor highlighting/autocomplete.
*/
sqlDialect: SqlEditorDialect;
/**
* Whether SQL editor schema-aware autocomplete is supported.
*/
sqlEditorAutocomplete: boolean;
/**
* Whether SQL editor lint diagnostics are supported.
*/
sqlEditorLint: boolean;
}
interface Adapter {
/**
* The schema studio will choose by default.
*
* e.g. `public` for PostgreSQL
*/
readonly defaultSchema?: string;
/**
* Optional adapter feature flags used by the UI.
*/
readonly capabilities?: Partial<AdapterCapabilities>;
/**
* Introspects the database and returns structured information about the schemas, tables, etc.
*
* @param options - Options for the introspection request.
*/
introspect(options: AdapterIntrospectOptions): Promise<Either<AdapterError, AdapterIntrospectResult>>;
/**
* Executes a structured query against the database.
*/
query(details: AdapterQueryDetails, options: AdapterQueryOptions): Promise<Either<AdapterError, AdapterQueryResult>>;
/**
* Executes raw SQL against the database.
*/
raw(details: AdapterRawDetails, options: AdapterRawOptions): Promise<Either<AdapterError, AdapterRawResult>>;
/**
* Returns schema metadata for SQL editor autocomplete.
*/
sqlSchema?(details: AdapterSqlSchemaDetails, options: AdapterSqlSchemaOptions): Promise<Either<AdapterError, AdapterSqlSchemaResult>>;
/**
* Returns SQL editor diagnostics (syntax/schema linting).
*/
sqlLint?(details: AdapterSqlLintDetails, options: AdapterSqlLintOptions): Promise<Either<AdapterError, AdapterSqlLintResult>>;
/**
* Inserts a single row into the database.
*/
insert(details: AdapterInsertDetails, options: AdapterInsertOptions): Promise<Either<AdapterError, AdapterInsertResult>>;
/**
* Updates a given row in the database with given changes.
*/
update(details: AdapterUpdateDetails, options: AdapterUpdateOptions): Promise<Either<AdapterError, AdapterUpdateResult>>;
/**
* Deletes given rows from the database.
*/
delete(details: AdapterDeleteDetails, options: AdapterDeleteOptions): Promise<Either<AdapterError, AdapterDeleteResult>>;
}
interface AdapterBaseOptions {
}
interface AdapterIntrospectOptions extends AdapterBaseOptions {
}
interface AdapterQueryOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterRawOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterSqlSchemaOptions extends AdapterBaseOptions {
}
interface AdapterSqlLintOptions extends AdapterBaseOptions {
abortSignal: AbortSignal;
}
interface AdapterInsertOptions extends AdapterBaseOptions {
}
interface AdapterUpdateOptions extends AdapterBaseOptions {
}
interface AdapterDeleteOptions extends AdapterBaseOptions {
}
type SchemaName = string;
interface AdapterIntrospectResult {
schemas: Record<SchemaName, Schema>;
timezone: string;
filterOperators: FilterOperator[];
query: Query;
}
type TableName = string;
interface Schema {
name: string;
tables: Record<TableName, Table>;
}
type ColumnName = string;
interface Table {
columns: Record<ColumnName, Column>;
name: TableName;
schema: SchemaName;
}
interface Column {
datatype: DataType;
defaultValue: "CURRENT_DATE" | "CURRENT_TIME" | "CURRENT_TIMESTAMP" | "datetime('now')" | "gen_random_uuid()" | "json_array()" | `nextval(${string})` | `now()` | "uuid_to_bin(uuid())" | "uuid()" | (string & {}) | null;
fkColumn: ColumnName | null;
fkSchema: SchemaName | null;
fkTable: TableName | null;
isAutoincrement: boolean;
isComputed: boolean;
isRequired: boolean;
name: ColumnName;
nullable: boolean;
pkPosition: number | null;
schema: SchemaName;
table: TableName;
}
interface DataType {
/**
* The database-specific affinity/type.
*
* e.g. in SQLite, datatypes can be anything. They are reduced to affinity via string matching rules.
*
* {@link https://sqlite.org/datatype3.html#determination_of_column_affinity}
*/
affinity?: string;
/**
* The database-specific format for the datatype.
*/
format?: string;
/**
* A simplification/normalization for UI usage.
*
* e.g. varchar and char are strings.
*/
group: DataTypeGroup;
/**
* Is this a native array type?
*/
isArray: boolean;
/**
* Is a native database datatype or a user-defined datatype?
*
* e.g. PostgreSQL enums are user-defined datatypes, but `int4` is a native datatype.
*/
isNative: boolean;
/**
* Will be displayed as-is.
*/
name: string;
/**
* Enum values for enum types.
*/
options: string[];
/**
* The schema the datatype belongs to.
*/
schema: string;
}
type DataTypeGroup = "string" | "datetime" | "boolean" | "enum" | "time" | "raw" | "numeric" | "json";
interface AdapterQueryDetails {
/**
* Zero-based index of the page to fetch.
*/
pageIndex: number;
/**
* Maximum number of rows to fetch from the database.
*/
pageSize: number;
/**
* Sort order for the query.
*/
sortOrder: SortOrderItem[];
/**
* The table to select from.
*/
table: Table;
/**
* The filter to be applied.
*/
filter?: FilterGroup;
/**
* Optional full-table content search term.
*
* This is interpreted by database-specific adapters and composed into the
* generated SQL query.
*/
fullTableSearchTerm?: string;
}
type FilterOperator = "=" | "!=" | ">" | ">=" | "<" | "<=" | "is" | "is not" | "like" | "not like" | "ilike" | "not ilike";
interface ColumnFilter {
kind: "ColumnFilter";
column: string;
operator: FilterOperator;
value: unknown;
after: "and" | "or";
id: string;
}
interface SqlFilter {
kind: "SqlFilter";
sql: string;
after: "and" | "or";
id: string;
}
interface FilterGroup {
kind: "FilterGroup";
filters: (ColumnFilter | FilterGroup | SqlFilter)[];
after: "and" | "or";
id: string;
}
interface SortOrderItem {
/**
* The column to sort by.
*/
column: ColumnName;
/**
* The direction to sort the column by.
*/
direction: SortDirection;
}
type SortDirection = "asc" | "desc";
declare class AdapterError extends Error {
query?: Query<unknown>;
}
interface AdapterQueryResult {
/**
* The total number of rows the query would return if not limited.
*
* If the database does not support counting rows, this should be set to `Infinity`.
*/
filteredRowCount: number | bigint | NumericString | BigIntString;
/**
* The rows returned by the query.
*/
rows: Record<ColumnName, unknown>[];
/**
* The executed query string.
*/
query: Query;
}
interface AdapterRawDetails {
sql: string;
}
interface AdapterRawResult {
rowCount: number;
rows: Record<string, unknown>[];
query: Query;
}
interface AdapterSqlSchemaDetails {
}
interface AdapterSqlSchemaResult {
defaultSchema?: string;
dialect: SqlEditorDialect;
namespace: Record<string, Record<string, string[]>>;
version: string;
}
interface AdapterSqlLintDetails {
schemaVersion?: string;
sql: string;
}
interface AdapterSqlLintDiagnostic {
code?: string;
from: number;
message: string;
severity: "error" | "warning" | "info" | "hint";
source?: string;
to: number;
}
interface AdapterSqlLintResult {
diagnostics: AdapterSqlLintDiagnostic[];
schemaVersion?: string;
}
type SqlEditorDialect = "postgresql" | "mysql" | "sqlite";
interface AdapterInsertDetails {
/**
* The table to insert into.
*/
table: Table;
/**
* The values to insert into the table.
* - The keys should match the column names in the table.
* - The values should be the values to insert into the table.
*/
rows: Record<string, unknown>[];
}
interface AdapterInsertResult {
/**
* The freshly inserted row data.
*/
rows: Record<string, unknown>[];
/**
* The executed query string.
*/
query: Query<unknown>;
}
interface AdapterUpdateDetails {
/**
* Changes to apply to the row.
*/
changes: Record<ColumnName, unknown>;
/**
* The row to update.
*/
row: Record<ColumnName, unknown>;
/**
* The table to update in.
*/
table: Table;
}
interface AdapterUpdateResult {
/**
* The updated row data.
*/
row: Record<ColumnName, unknown> & {
/**
* When the changes were applied in database time.
*/
__ps_updated_at__: string | number | Date;
};
/**
* The executed query string.
*/
query: Query<unknown>;
}
interface AdapterDeleteDetails {
/**
* The rows to delete.
*/
rows: Record<ColumnName, unknown>[];
/**
* The table to delete from.
*/
table: Table;
}
interface AdapterDeleteResult {
rows: Record<ColumnName, unknown>[];
/**
* The executed query string.
*/
query: Query<unknown>;
}
declare function createAdapterError(args: {
error: Error;
query?: Query<unknown>;
}): [AdapterError];
export { applyInferredRowFilters as $, type AdapterIntrospectResult as A, type AdapterUpdateDetails as B, type AdapterUpdateOptions as C, type AdapterUpdateResult as D, type BigIntString as E, type Column as F, type ColumnFilter as G, type DataType as H, type DataTypeGroup as I, type Either as J, type ExecuteOptions as K, type Executor as L, type FilterGroup as M, type FilterOperator as N, type NumericString as O, type QueryResult as P, type Query as Q, type Schema as R, type SqlEditorDialect as S, type SequenceExecutor as T, type SortDirection as U, type SortOrderItem as V, type SqlFilter as W, type SqlLintDetails as X, type SqlLintDiagnostic as Y, type SqlLintResult as Z, type Table as _, type AdapterSqlSchemaResult as a, createAdapterError as a0, getAbortResult as a1, type BuilderRequirements as a2, AbortError as b, type Adapter as c, type AdapterBaseOptions as d, type AdapterCapabilities as e, type AdapterDeleteDetails as f, type AdapterDeleteOptions as g, type AdapterDeleteResult as h, AdapterError as i, type AdapterInsertDetails as j, type AdapterInsertOptions as k, type AdapterInsertResult as l, type AdapterIntrospectOptions as m, type AdapterQueryDetails as n, type AdapterQueryOptions as o, type AdapterQueryResult as p, type AdapterRawDetails as q, type AdapterRawOptions as r, type AdapterRawResult as s, type AdapterRequirements as t, type AdapterSqlLintDetails as u, type AdapterSqlLintDiagnostic as v, type AdapterSqlLintOptions as w, type AdapterSqlLintResult as x, type AdapterSqlSchemaDetails as y, type AdapterSqlSchemaOptions as z };

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}`);
}
var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),o=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var p=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c,p as d};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K

File diff suppressed because one or more lines are too long

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{i as a,j as l,k as u,l as m,m as t,n as f,o as i}from"./chunk-LR52PZTP.js";function A(o,r){let n=[];for(let{selection:e}of o.selections??[])if(t.is(e)&&m.is(e.column))n.push(s(e.column.column.name),c(r,e.column.column.name));else if(m.is(e))n.push(s(e.column.name),c(r,e.column.name));else if(l.is(e)&&a.is(e.alias))n.push(s(e.alias.name),c(r,e.alias.name));else throw new Error("can't extract column names from the select query node");return n}function s(o){return new i(f.createImmediate(o))}function c(o,r){return new i(t.create(m.create(r),u.create(o)))}export{A as a};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vbm9kZV9tb2R1bGVzLy5wbnBtL2t5c2VseUAwLjI4LjEwL25vZGVfbW9kdWxlcy9reXNlbHkvZGlzdC9lc20vdXRpbC9qc29uLW9iamVjdC1hcmdzLmpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvLy8gPHJlZmVyZW5jZSB0eXBlcz1cIi4vanNvbi1vYmplY3QtYXJncy5kLnRzXCIgLz5cbmltcG9ydCB7IEV4cH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gsRUFBRSxPQUFPLE9BQU8sSUFBSSxFQUFHSSxFQUFPTixFQUFPRSxFQUFFLE9BQU8sT0FBTyxJQUFJLENBQUMsVUFFdkVFLEVBQVcsR0FBR0YsQ0FBQyxFQUNwQkQsRUFBSyxLQUFLSSxFQUFRSCxFQUFFLE9BQU8sSUFBSSxFQUFHSSxFQUFPTixFQUFPRSxFQUFFLE9BQU8sSUFBSSxDQUFDLFVBRXpESyxFQUFVLEdBQUdMLENBQUMsR0FBS00sRUFBZSxHQUFHTixFQUFFLEtBQUssRUFDakRELEVBQUssS0FBS0ksRUFBUUgsRUFBRSxNQUFNLElBQUksRUFBR0ksRUFBT04sRUFBT0UsRUFBRSxNQUFNLElBQUksQ0FBQyxNQUc1RCxPQUFNLElBQUksTUFBTSx1REFBdUQsRUFHL0UsT0FBT0QsQ0FDWCxDQUNBLFNBQVNJLEVBQVFJLEVBQUssQ0FDbEIsT0FBTyxJQUFJQyxFQUFrQkMsRUFBVSxnQkFBZ0JGLENBQUcsQ0FBQyxDQUMvRCxDQUNBLFNBQVNILEVBQU9OLEVBQU9TLEVBQUssQ0FDeEIsT0FBTyxJQUFJQyxFQUFrQlAsRUFBYyxPQUFPQyxFQUFXLE9BQU9LLENBQUcsRUFBR0csRUFBVSxPQUFPWixDQUFLLENBQUMsQ0FBQyxDQUN0RyIsCiAgIm5hbWVzIjogWyJnZXRKc29uT2JqZWN0QXJncyIsICJub2RlIiwgInRhYmxlIiwgImFyZ3MiLCAicyIsICJSZWZlcmVuY2VOb2RlIiwgIkNvbHVtbk5vZGUiLCAiY29sTmFtZSIsICJjb2xSZWYiLCAiQWxpYXNOb2RlIiwgIklkZW50aWZpZXJOb2RlIiwgImNvbCIsICJFeHByZXNzaW9uV3JhcHBlciIsICJWYWx1ZU5vZGUiLCAiVGFibGVOb2RlIl0KfQo=

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}`);
}
var e=class extends Error{constructor(){super("This operation was aborted"),this.name="AbortError"}};function t(){return[new e]}export{e as a,t as b};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vZGF0YS9leGVjdXRvci50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBRdWVyeSwgUXVlcnlSZXN1bHQgfSBmcm9tIFwiLi9xdWVyeVwiO1xuaW1wb3J0IHR5cGUgeyBFaXRoZXIgfSBmcm9tIFwiLi90eXBlLXV0aWxzXCI7XG5cbmV4cG9ydCBpbnRlcmZhY2UgRXhlY3V0b3Ige1xuICBleGVjdXRlPFQ+KFxuICAgIHF1ZXJ5OiBRdWVyeTxUPixcbiAgICBvcHRpb25zPzogRXhlY3V0ZU9wdGlvbnMsXG4gICk6IFByb21pc2U8RWl0aGVyPEVycm9yLCBRdWVyeVJlc3VsdDxRdWVyeTxUPj4+PjtcblxuICAvKipcbiAgICogT3B0aW9uYWwgU1FMIGxpbnQgdHJhbnNwb3J0IGZvciBwYXJzZS9wbGFuIGRpYWdub3N0aWNzLlxuICAgKlxuICAgKiBFeGVjdXRvcnMgdGhhdCBkbyBub3QgaW1wbGVtZW50IHRoaXMgY2FwYWJpbGl0eSBjYW4gc3RpbGwgYmUgdXNlZCBieVxuICAgKiBhZGFwdGVycyB3aXRoIGZhbGxiYWNrIGxpbnQgc3RyYXRlZ2llcy5cbiAgICovXG4gIGxpbnRTcWw/KFxuICAgIGRldGFpbHM6IFNxbExpbnREZXRhaWxzLFxuICAgIG9wdGlvbnM/OiBFeGVjdXRlT3B0aW9ucyxcbiAgKTogUHJvbWlzZTxFaXRoZXI8RXJyb3IsIFNxbExpbnRSZXN1bHQ+Pjtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBTZXF1ZW5jZUV4ZWN1dG9yIGV4dGVuZHMgRXhlY3V0b3Ige1x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IH1cbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEFib3J0UmVzdWx0KCk6IFtBYm9ydEVycm9yXSB7XG4gIHJldHVybiBbbmV3IEFib3J0RXJyb3IoKV07XG59XG4iXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7OztBQXNETyxJQUFNQSxFQUFOLGNBQXlCLEtBQU0sQ0FDcEMsYUFBYyxDQUNaLE1BQU0sNEJBQTRCLEVBQ2xDLEtBQUssS0FBTyxZQUNkLENBQ0YsRUFFTyxTQUFTQyxHQUErQixDQUM3QyxNQUFPLENBQUMsSUFBSUQsQ0FBWSxDQUMxQiIsCiAgIm5hbWVzIjogWyJBYm9ydEVycm9yIiwgImdldEFib3J0UmVzdWx0Il0KfQo=

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 e}from"./chunk-LR52PZTP.js";function t(){return e("select pg_backend_pid() as pid")}function u(n){return{parameters:[n],sql:"select pg_cancel_backend($1);"}}export{t as a,u as b};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vZGF0YS9wb3N0Z3Jlcy1jb3JlL3V0aWxpdHkudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IGFzUXVlcnksIHR5cGUgUXVlcnkgfSBmcm9tIFwiLi4vcXVlcnlcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGdldFBJRFF1ZXJ5KCk6IFF1ZXJ5PHsgcGlkOiB1bmtub3duIH0+IHtcbiAgcmV0dXJuIGFzUXVlcnkoXCJzZWxlY3QgcGdfYmFja2VuZF9waWQoKSBhcyBwaWRcIik7XG59XG5cbi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZW1wdHktb2JqZWN0LXR5cGVcbmV4cG9ydCBmdW5jdGlvbiBnZXRDYW5jZWxRdWVyeShwaWQ6IHt9KTogUXVlcnk8dW5rbm93bj4ge1xuICByZXR1cm4ge1xuICAgIHBhcmFtZXRlcnM6IFtwaWRdLFxuICAgIHNxbDogXCJzZWxlY3QgcGdfY2FuY2VsX2JhY2tlbmQoJDEpO1wiLFxuICB9O1xufVxuIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7d0NBRU8sU0FBU0EsR0FBdUMsQ0FDckQsT0FBT0MsRUFBUSxnQ0FBZ0MsQ0FDakQsQ0FHTyxTQUFTQyxFQUFlQyxFQUF5QixDQUN0RCxNQUFPLENBQ0wsV0FBWSxDQUFDQSxDQUFHLEVBQ2hCLElBQUssK0JBQ1AsQ0FDRiIsCiAgIm5hbWVzIjogWyJnZXRQSURRdWVyeSIsICJhc1F1ZXJ5IiwgImdldENhbmNlbFF1ZXJ5IiwgInBpZCJdCn0K

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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,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}`);
}
function r(e){return{parameters:[e],sql:"kill ?"}}export{r as a};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vZGF0YS9teXNxbC1jb3JlL3V0aWxpdHkudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB0eXBlIHsgUXVlcnkgfSBmcm9tIFwiLi4vcXVlcnlcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGdldENhbmNlbFF1ZXJ5KHRocmVhZElkOiB1bmtub3duKTogUXVlcnk8dW5rbm93bj4ge1xuICByZXR1cm4ge1xuICAgIHBhcmFtZXRlcnM6IFt0aHJlYWRJZF0sXG4gICAgc3FsOiBcImtpbGwgP1wiLFxuICB9O1xufVxuIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7QUFFTyxTQUFTQSxFQUFlQyxFQUFtQyxDQUNoRSxNQUFPLENBQ0wsV0FBWSxDQUFDQSxDQUFRLEVBQ3JCLElBQUssUUFDUCxDQUNGIiwKICAibmFtZXMiOiBbImdldENhbmNlbFF1ZXJ5IiwgInRocmVhZElkIl0KfQo=

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,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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1w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G4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgcm93W2NvbHVtbl0gPSBKU09OLnBhcnNlKHZhbHVlKSBhcyBuZXZlcjtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihcbiAgICAgICAgICAgICAgICAgICAgYEZhaWxlZCB0byBKU09OLnBhcnNlIGNvbHVtbiBcIiR7Y29sdW1ufVwiIHdpdGggdmFsdWU6ICR7dmFsdWV9YCxcbiAgICAgICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0cmFuc2Zvcm1hdGlvbiBzYXRpc2ZpZXMgdW5kZWZpbmVkO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW251bGwsIHJvd3NdKSBhcyBuZXZlcjtcbiAgICAgIH0gY2F0Y2ggKGVycm9yOiB1bmtub3duKSB7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW2Vycm9yIGFzIEVycm9yXSk7XG4gICAgICB9XG4gICAgfSxcbiAgfTtcbn1cbiJdLAogICJtYXBwaW5ncyI6ICJ5YUFBQSxJQUFBQSxFQUFBLEdBQUFDLEVBQUFELEVBQUEsOEJBQUFFLElBQUEsZUFBQUMsRUFBQUgsR0FJTyxTQUFTRSxFQUF5QkUsRUFBa0MsQ0FDekUsTUFBTyxDQUNMLFFBQVVDLEdBQVUsQ0FDbEIsR0FBTSxDQUFFLFdBQUFDLEVBQVksSUFBQUMsRUFBSyxnQkFBQUMsQ0FBZ0IsRUFBSUg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2YWx1ZSIsICJlcnJvciJdCn0K

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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZVN5bmMsIFNRTElucHV0VmFsdWUgfSBmcm9tIFwibm9kZTpzcWxpdGVcIjtcblxuaW1wb3J0IHR5cGUgeyBFeGVjdXRvciB9IGZyb20gXCIuLi9leGVjdXRvclwiO1xuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yKGRhdGFiYXNlOiBEYXRhYmFzZVN5bmMpOiBFeGVjdXRvciB7XG4gIHJldHVybiB7XG4gICAgZXhlY3V0ZTogKHF1ZXJ5KSA9PiB7XG4gICAgICBjb25zdCB7IHBhcmFtZXRlcnMsIHNxbCwgdHJhbnNmb3JtYXRpb25zIH0gPSBxdWVyeTtcblxuICAgICAgY29uc3Qgc3RhdGVtZW50ID0gZGF0YWJhc2UucHJlcGFyZShzcWwpO1xuXG4gICAgICB0cnkge1xuICAgICAgICBjb25zdCByb3dzID0gc3RhdGVtZW50LmFsbCguLi4ocGFyYW1ldGVycyBhcyBTUUxJbnB1dFZhbHVlW10pKTtcblxuICAgICAgICBpZiAoIXRyYW5zZm9ybWF0aW9ucyB8fCBPYmplY3Qua2V5cyh0cmFuc2Zvcm1hdGlvbnMpLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW251bGwsIHJvd3NdKSBhcyBuZXZlcjtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoY29uc3Qgcm93IG9mIHJvd3MpIHtcbiAgICAgICAgICBmb3IgKGNvbnN0IGNvbHVtbiBpbiB0cmFuc2Zvcm1hdGlvbnMpIHtcbiAgICAgICAgICAgIGNvbnN0IHRyYW5zZm9ybWF0aW9uID0gdHJhbnNmb3JtYXRpb25zW2NvbHVtbl07XG4gICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHJvd1tjb2x1bW5dO1xuXG4gICAgICAgICAgICBpZiAodHJhbnNmb3JtYXRpb24gPT09IFwianNvbi1wYXJzZVwiKSB7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgcm93W2NvbHVtbl0gPSBKU09OLnBhcnNlKHZhbHVlKSBhcyBuZXZlcjtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgY29uc29sZ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QU1LLEVBQWlCTCxFQUFnQkksQ0FBTSxFQUN2Q0UsRUFBUUgsRUFBSUMsQ0FBTSxFQUV4QixHQUFJQyxJQUFtQixhQUFjLENBQ25DLEdBQUksT0FBT0MsR0FBVSxTQUNuQixHQUFJLENBQ0ZILEVBQUlDLENBQU0sRUFBSSxLQUFLLE1BQU1FLENBQUssQ0FDaEMsT0FBU0MsRUFBTyxDQUNkLFFBQVEsTUFDTixnQ0FBZ0NILENBQU0saUJBQWlCRSxDQUFLLEdBQzVEQyxDQUNGLENBQ0YsQ0FHRixRQUNGLENBR0YsQ0FHRixPQUFPLFFBQVEsUUFBUSxDQUFDLEtBQU1MLENBQUksQ0FBQyxDQUNyQyxPQUFTSyxFQUFnQixDQUN2QixPQUFPLFFBQVEsUUFBUSxDQUFDQSxDQUFjLENBQUMsQ0FDekMsQ0FDRixDQUNGLENBQ0YiLAogICJuYW1lcyI6IFsiY3JlYXRlTm9kZVNRTGl0ZUV4ZWN1dG9yIiwgImRhdGFiYXNlIiwgInF1ZXJ5IiwgInBhcmFtZXRlcnMiLCAic3FsIiwgInRyYW5zZm9ybWF0aW9ucyIsICJzdGF0ZW1lbnQiLCAicm93cyIsICJyb3ciLCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIl0KfQo=

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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZSwgU3FsVmFsdWUgfSBmcm9tIFwic3FsLmpzXCI7XG5cbmltcG9ydCB0eXBlIHsgRXhlY3V0b3IgfSBmcm9tIFwiLi4vZXhlY3V0b3JcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGNyZWF0ZVNRTEpTRXhlY3V0b3IoZGF0YWJhc2U6IERhdGFiYXNlKTogRXhlY3V0b3Ige1xuICByZXR1cm4ge1xuICAgIGV4ZWN1dGU6IChxdWVyeSkgPT4ge1xuICAgICAgY29uc3QgeyBwYXJhbWV0ZXJzLCBzcWwsIHRyYW5zZm9ybWF0aW9ucyB9ID0gcXVlcnk7XG5cbiAgICAgIGNvbnN0IHN0YXRlbWVudCA9IGRhdGFiYXNlLnByZXBhcmUoc3FsKTtcbiAgICAgIHN0YXRlbWVudC5iaW5kKHBhcmFtZXRlcnMgYXMgU3FsVmFsdWVbXSk7XG5cbiAgICAgIGNvbnN0IHJvd3MgPSBbXTtcblxuICAgICAgdHJ5IHtcbiAgICAgICAgd2hpbGUgKHN0YXRlbWVudC5zdGVwKCkpIHtcbiAgICAgICAgICBjb25zdCByb3cgPSBzdGF0ZW1lbnQuZ2V0QXNPYmplY3QoKTtcblxuICAgICAgICAgIHJvd3MucHVzaChyb3cpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCF0cmFuc2Zvcm1hdGlvbnMgfHwgT2JqZWN0LmtleXModHJhbnNmb3JtYXRpb25zKS5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGNvbnN0IHJvdyBvZiByb3dzKSB7XG4gICAgICAgICAgZm9yIChjb25zdCBjb2x1bW4gaW4gdHJhbnNmb3JtYXRpb25zKSB7XG4gICAgICAgICAgICBjb25zdCB0cmFuc2Zvcm1hdGlvbiA9IHRyYW5zZm9ybWF0aW9uc1tjb2x1bW5dO1xuICAgICAgICAgICAgY29uc3QgdmFsdWUgPSByb3dbY29sdW1uXTtcblxuICAgICAgICAgICAgaWYgKHRyYW5zZm9ybWF0aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gc2F0aXNmaWVzIHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICB9IGNhdGNoIChlcnJvc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0FDNURDLENBQ0YsQ0FDRixDQUdGLFFBQ0YsQ0FHRixDQUdGLE9BQU8sUUFBUSxRQUFRLENBQUMsS0FBTUwsQ0FBSSxDQUFDLENBQ3JDLE9BQVNLLEVBQWdCLENBQ3ZCLE9BQU8sUUFBUSxRQUFRLENBQUNBLENBQWMsQ0FBQyxDQUN6QyxDQUNGLENBQ0YsQ0FDRiIsCiAgIm5hbWVzIjogWyJzcWxqc19leHBvcnRzIiwgIl9fZXhwb3J0IiwgImNyZWF0ZVNRTEpTRXhlY3V0b3IiLCAiX190b0NvbW1vbkpTIiwgImRhdGFiYXNlIiwgInF1ZXJ5IiwgInBhcmFtZXRlcnMiLCAic3FsIiwgInRyYW5zZm9ybWF0aW9ucyIsICJzdGF0ZW1lbnQiLCAicm93cyIsICJyb3ciLCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIl0KfQo=

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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZSwgU3FsVmFsdWUgfSBmcm9tIFwic3FsLmpzXCI7XG5cbmltcG9ydCB0eXBlIHsgRXhlY3V0b3IgfSBmcm9tIFwiLi4vZXhlY3V0b3JcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGNyZWF0ZVNRTEpTRXhlY3V0b3IoZGF0YWJhc2U6IERhdGFiYXNlKTogRXhlY3V0b3Ige1xuICByZXR1cm4ge1xuICAgIGV4ZWN1dGU6IChxdWVyeSkgPT4ge1xuICAgICAgY29uc3QgeyBwYXJhbWV0ZXJzLCBzcWwsIHRyYW5zZm9ybWF0aW9ucyB9ID0gcXVlcnk7XG5cbiAgICAgIGNvbnN0IHN0YXRlbWVudCA9IGRhdGFiYXNlLnByZXBhcmUoc3FsKTtcbiAgICAgIHN0YXRlbWVudC5iaW5kKHBhcmFtZXRlcnMgYXMgU3FsVmFsdWVbXSk7XG5cbiAgICAgIGNvbnN0IHJvd3MgPSBbXTtcblxuICAgICAgdHJ5IHtcbiAgICAgICAgd2hpbGUgKHN0YXRlbWVudC5zdGVwKCkpIHtcbiAgICAgICAgICBjb25zdCByb3cgPSBzdGF0ZW1lbnQuZ2V0QXNPYmplY3QoKTtcblxuICAgICAgICAgIHJvd3MucHVzaChyb3cpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCF0cmFuc2Zvcm1hdGlvbnMgfHwgT2JqZWN0LmtleXModHJhbnNmb3JtYXRpb25zKS5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGNvbnN0IHJvdyBvZiByb3dzKSB7XG4gICAgICAgICAgZm9yIChjb25zdCBjb2x1bW4gaW4gdHJhbnNmb3JtYXRpb25zKSB7XG4gICAgICAgICAgICBjb25zdCB0cmFuc2Zvcm1hdGlvbiA9IHRyYW5zZm9ybWF0aW9uc1tjb2x1bW5dO1xuICAgICAgICAgICAgY29uc3QgdmFsdWUgPSByb3dbY29sdW1uXTtcblxuICAgICAgICAgICAgaWYgKHRyYW5zZm9ybWF0aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gc2F0aXNmaWVzIHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKFtudWxsLCByb3dzXSkgYXMgbmV2ZXI7XG4gICAgICB9IGNhdGNoIChlcnJvcjogdW5rbm93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QyxLQUFNTCxDQUFJLENBQUMsQ0FDckMsT0FBU0ssRUFBZ0IsQ0FDdkIsT0FBTyxRQUFRLFFBQVEsQ0FBQ0EsQ0FBYyxDQUFDLENBQ3pDLENBQ0YsQ0FDRixDQUNGIiwKICAibmFtZXMiOiBbImNyZWF0ZVNRTEpTRXhlY3V0b3IiLCAiZGF0YWJhc2UiLCAicXVlcnkiLCAicGFyYW1ldGVycyIsICJzcWwiLCAidHJhbnNmb3JtYXRpb25zIiwgInN0YXRlbWVudCIsICJyb3dzIiwgInJvdyIsICJjb2x1bW4iLCAidHJhbnNmb3JtYXRpb24iLCAidmFsdWUiLCAiZXJyb3IiXQp9Cg==

View file

@ -0,0 +1,65 @@
import { ExpressionBuilder, Expression, SqlBool } from 'kysely';
import { _ as Table, t as AdapterRequirements, o as AdapterQueryOptions, Q as Query, J as Either, P as QueryResult } from './adapter-DYzAiJd4.js';
declare const FULL_TABLE_SEARCH_TIMEOUT_MS = 5000;
declare const FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS = 100;
declare const FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS = 1;
declare const FULL_TABLE_SEARCH_MIN_QUERY_LENGTH = 2;
declare const FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS = 64;
declare const FULL_TABLE_SEARCH_TIMEOUT_MESSAGE = "Search timed out after 5 seconds. This kind of search is expensive, and your table might be too large.";
declare class FullTableSearchTimeoutError extends Error {
constructor();
}
type FullTableSearchDialect = "postgres" | "mysql" | "sqlite";
type FullTableSearchPredicate = {
column: string;
kind: "text-like";
pattern: string;
} | {
column: string;
kind: "numeric-equals";
value: string;
} | {
column: string;
kind: "boolean-equals";
value: boolean;
} | {
column: string;
kind: "uuid-equals";
value: string;
} | {
column: string;
kind: "datetime-day-range";
endExclusive: string;
startInclusive: string;
} | {
column: string;
kind: "time-equals";
value: string;
};
interface FullTableSearchPlan {
normalizedSearchTerm: string;
predicates: FullTableSearchPredicate[];
}
interface FullTableSearchExecutionState {
activeController: AbortController | null;
latestRequestId: number;
}
declare function createFullTableSearchExecutionState(): FullTableSearchExecutionState;
declare function isFullTableSearchRequest(searchTerm: string | undefined): boolean;
declare function executeQueryWithFullTableSearchGuardrails<T>(args: {
executor: AdapterRequirements["executor"];
options: AdapterQueryOptions;
query: Query<T>;
searchTerm: string | undefined;
state: FullTableSearchExecutionState;
}): Promise<Either<Error, QueryResult<Query<T>>>>;
declare function buildFullTableSearchPlan(args: {
searchTerm: string | undefined;
table: Table;
}): FullTableSearchPlan;
declare function getFullTableSearchExpression(plan: FullTableSearchPlan, args: {
dialect: FullTableSearchDialect;
}): (eb: ExpressionBuilder<any, any>) => Expression<SqlBool>;
export { FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS as F, FULL_TABLE_SEARCH_MIN_QUERY_LENGTH as a, FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS as b, FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS as c, FULL_TABLE_SEARCH_TIMEOUT_MESSAGE as d, FULL_TABLE_SEARCH_TIMEOUT_MS as e, type FullTableSearchDialect as f, type FullTableSearchExecutionState as g, type FullTableSearchPlan as h, type FullTableSearchPredicate as i, FullTableSearchTimeoutError as j, buildFullTableSearchPlan as k, createFullTableSearchExecutionState as l, executeQueryWithFullTableSearchGuardrails as m, getFullTableSearchExpression as n, isFullTableSearchRequest as o };

View file

@ -0,0 +1,65 @@
import { ExpressionBuilder, Expression, SqlBool } from 'kysely';
import { _ as Table, t as AdapterRequirements, o as AdapterQueryOptions, Q as Query, J as Either, P as QueryResult } from './adapter-DYzAiJd4.cjs';
declare const FULL_TABLE_SEARCH_TIMEOUT_MS = 5000;
declare const FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS = 100;
declare const FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS = 1;
declare const FULL_TABLE_SEARCH_MIN_QUERY_LENGTH = 2;
declare const FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS = 64;
declare const FULL_TABLE_SEARCH_TIMEOUT_MESSAGE = "Search timed out after 5 seconds. This kind of search is expensive, and your table might be too large.";
declare class FullTableSearchTimeoutError extends Error {
constructor();
}
type FullTableSearchDialect = "postgres" | "mysql" | "sqlite";
type FullTableSearchPredicate = {
column: string;
kind: "text-like";
pattern: string;
} | {
column: string;
kind: "numeric-equals";
value: string;
} | {
column: string;
kind: "boolean-equals";
value: boolean;
} | {
column: string;
kind: "uuid-equals";
value: string;
} | {
column: string;
kind: "datetime-day-range";
endExclusive: string;
startInclusive: string;
} | {
column: string;
kind: "time-equals";
value: string;
};
interface FullTableSearchPlan {
normalizedSearchTerm: string;
predicates: FullTableSearchPredicate[];
}
interface FullTableSearchExecutionState {
activeController: AbortController | null;
latestRequestId: number;
}
declare function createFullTableSearchExecutionState(): FullTableSearchExecutionState;
declare function isFullTableSearchRequest(searchTerm: string | undefined): boolean;
declare function executeQueryWithFullTableSearchGuardrails<T>(args: {
executor: AdapterRequirements["executor"];
options: AdapterQueryOptions;
query: Query<T>;
searchTerm: string | undefined;
state: FullTableSearchExecutionState;
}): Promise<Either<Error, QueryResult<Query<T>>>>;
declare function buildFullTableSearchPlan(args: {
searchTerm: string | undefined;
table: Table;
}): FullTableSearchPlan;
declare function getFullTableSearchExpression(plan: FullTableSearchPlan, args: {
dialect: FullTableSearchDialect;
}): (eb: ExpressionBuilder<any, any>) => Expression<SqlBool>;
export { FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS as F, FULL_TABLE_SEARCH_MIN_QUERY_LENGTH as a, FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS as b, FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS as c, FULL_TABLE_SEARCH_TIMEOUT_MESSAGE as d, FULL_TABLE_SEARCH_TIMEOUT_MS as e, type FullTableSearchDialect as f, type FullTableSearchExecutionState as g, type FullTableSearchPlan as h, type FullTableSearchPredicate as i, FullTableSearchTimeoutError as j, buildFullTableSearchPlan as k, createFullTableSearchExecutionState as l, executeQueryWithFullTableSearchGuardrails as m, getFullTableSearchExpression as n, isFullTableSearchRequest as o };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

194
node_modules/@prisma/studio-core/dist/ui/index.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

3604
node_modules/@prisma/studio-core/dist/ui/index.css generated vendored Normal file

File diff suppressed because it is too large Load diff

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

@ -0,0 +1,102 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { c as Adapter, Q as Query, i as AdapterError } from '../adapter-DYzAiJd4.cjs';
import { UseQueryStateOptions, UseQueryStateReturn, Options, Parser, UseQueryStatesOptions, UseQueryStatesReturn } from 'nuqs';
export * from 'nuqs';
import 'kysely';
/**
* Theme variables type - matches shadcn format
*/
type ThemeVariables = Record<string, string>;
/**
* Custom theme configuration with light and dark variants
*/
interface CustomTheme {
light: ThemeVariables;
dark: ThemeVariables;
}
/**
* Parse CSS variables from shadcn format CSS string
* Handles both :root and .dark selectors
*/
declare function parseThemeFromCSS(cssString: string): CustomTheme | null;
type StudioLaunchedEventBase = {
name: "studio_launched";
payload: {
embeddingType?: string;
vendorId?: string;
tableCount: number;
};
};
type StudioOperationErrorEventBase = {
name: "studio_operation_error";
payload: {
operation: string;
query: Query<unknown> | undefined;
error: AdapterError;
};
};
type StudioOperationSuccessEventBase = {
name: "studio_operation_success";
payload: {
operation: string;
query: Query<unknown>;
error: undefined;
};
};
type StudioOperationEventBase = StudioOperationSuccessEventBase | StudioOperationErrorEventBase;
type StudioEventBase = StudioLaunchedEventBase | StudioOperationEventBase;
type StudioEvent = StudioEventBase & {
eventId: string;
timestamp: string;
};
interface StudioProps {
adapter: Adapter;
aiFilter?: (input: string) => Promise<string>;
onEvent?: (error: StudioEvent) => void;
/**
* Custom theme configuration or CSS string from shadcn
* Supports both parsed theme object and raw CSS string
*/
theme?: CustomTheme | string;
}
/**
* Main Studio component that provides database visualization and management
*/
declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
type StateKey = "pageIndex" | "pageSize" | "pin" | "table" | "sort" | "schema" | "test" | "filter" | "view" | "search" | "searchScope";
type Exact<A, W> = (A extends unknown ? W extends A ? {
[K in keyof A]: Exact<A[K], W[K]>;
} : W : never) | (A extends string | number | bigint | boolean | [] ? A : never);
declare function keyMap<const Map extends Partial<Record<StateKey, any>>>(keyMap: Exact<Map, Partial<Record<StateKey, any>>>): BrandedKeyMap<Map>;
declare function urlKeys<const Map extends Partial<Record<StateKey, string>>>(urlKeys: Exact<Map, Partial<Record<StateKey, string>>>): BrandedKeyMap<Map>;
declare const _BRAND_SYMBOL: unique symbol;
type BrandedKeyMap<Map> = Map & {
[K in typeof _BRAND_SYMBOL]: never;
};
/**
* @see {@link useQueryStateOriginal}
*/
declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T> & {
defaultValue: T;
}): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, typeof options.defaultValue>;
declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T>): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, undefined>;
declare function useQueryState(key: StateKey, options: Options & {
defaultValue: string;
}): UseQueryStateReturn<string, typeof options.defaultValue>;
declare function useQueryState(key: StateKey, options: Pick<UseQueryStateOptions<string>, keyof Options>): UseQueryStateReturn<string, undefined>;
declare function useQueryState(key: StateKey): UseQueryStateReturn<string, undefined>;
type UseQueryStatesKeysMap<Map extends Partial<Record<StateKey, any>> = Partial<Record<StateKey, any>>> = {
[Key in keyof Map]: KeyMapValue<Map[Key]>;
};
type KeyMapValue<Type> = Parser<Type> & Options & {
defaultValue?: Type;
};
/**
* @see {@link useQueryStatesOriginal}
*/
declare function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(keyMap: BrandedKeyMap<KeyMap>, options?: Partial<UseQueryStatesOptions<KeyMap>>): UseQueryStatesReturn<KeyMap>;
export { type CustomTheme, type StateKey, Studio, type StudioProps, type ThemeVariables, keyMap, parseThemeFromCSS, urlKeys, useQueryState, useQueryStates };

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

@ -0,0 +1,102 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { c as Adapter, Q as Query, i as AdapterError } from '../adapter-DYzAiJd4.js';
import { UseQueryStateOptions, UseQueryStateReturn, Options, Parser, UseQueryStatesOptions, UseQueryStatesReturn } from 'nuqs';
export * from 'nuqs';
import 'kysely';
/**
* Theme variables type - matches shadcn format
*/
type ThemeVariables = Record<string, string>;
/**
* Custom theme configuration with light and dark variants
*/
interface CustomTheme {
light: ThemeVariables;
dark: ThemeVariables;
}
/**
* Parse CSS variables from shadcn format CSS string
* Handles both :root and .dark selectors
*/
declare function parseThemeFromCSS(cssString: string): CustomTheme | null;
type StudioLaunchedEventBase = {
name: "studio_launched";
payload: {
embeddingType?: string;
vendorId?: string;
tableCount: number;
};
};
type StudioOperationErrorEventBase = {
name: "studio_operation_error";
payload: {
operation: string;
query: Query<unknown> | undefined;
error: AdapterError;
};
};
type StudioOperationSuccessEventBase = {
name: "studio_operation_success";
payload: {
operation: string;
query: Query<unknown>;
error: undefined;
};
};
type StudioOperationEventBase = StudioOperationSuccessEventBase | StudioOperationErrorEventBase;
type StudioEventBase = StudioLaunchedEventBase | StudioOperationEventBase;
type StudioEvent = StudioEventBase & {
eventId: string;
timestamp: string;
};
interface StudioProps {
adapter: Adapter;
aiFilter?: (input: string) => Promise<string>;
onEvent?: (error: StudioEvent) => void;
/**
* Custom theme configuration or CSS string from shadcn
* Supports both parsed theme object and raw CSS string
*/
theme?: CustomTheme | string;
}
/**
* Main Studio component that provides database visualization and management
*/
declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
type StateKey = "pageIndex" | "pageSize" | "pin" | "table" | "sort" | "schema" | "test" | "filter" | "view" | "search" | "searchScope";
type Exact<A, W> = (A extends unknown ? W extends A ? {
[K in keyof A]: Exact<A[K], W[K]>;
} : W : never) | (A extends string | number | bigint | boolean | [] ? A : never);
declare function keyMap<const Map extends Partial<Record<StateKey, any>>>(keyMap: Exact<Map, Partial<Record<StateKey, any>>>): BrandedKeyMap<Map>;
declare function urlKeys<const Map extends Partial<Record<StateKey, string>>>(urlKeys: Exact<Map, Partial<Record<StateKey, string>>>): BrandedKeyMap<Map>;
declare const _BRAND_SYMBOL: unique symbol;
type BrandedKeyMap<Map> = Map & {
[K in typeof _BRAND_SYMBOL]: never;
};
/**
* @see {@link useQueryStateOriginal}
*/
declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T> & {
defaultValue: T;
}): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, typeof options.defaultValue>;
declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T>): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, undefined>;
declare function useQueryState(key: StateKey, options: Options & {
defaultValue: string;
}): UseQueryStateReturn<string, typeof options.defaultValue>;
declare function useQueryState(key: StateKey, options: Pick<UseQueryStateOptions<string>, keyof Options>): UseQueryStateReturn<string, undefined>;
declare function useQueryState(key: StateKey): UseQueryStateReturn<string, undefined>;
type UseQueryStatesKeysMap<Map extends Partial<Record<StateKey, any>> = Partial<Record<StateKey, any>>> = {
[Key in keyof Map]: KeyMapValue<Map[Key]>;
};
type KeyMapValue<Type> = Parser<Type> & Options & {
defaultValue?: Type;
};
/**
* @see {@link useQueryStatesOriginal}
*/
declare function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(keyMap: BrandedKeyMap<KeyMap>, options?: Partial<UseQueryStatesOptions<KeyMap>>): UseQueryStatesReturn<KeyMap>;
export { type CustomTheme, type StateKey, Studio, type StudioProps, type ThemeVariables, keyMap, parseThemeFromCSS, urlKeys, useQueryState, useQueryStates };

201
node_modules/@prisma/studio-core/dist/ui/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long