first commit

This commit is contained in:
Ichitux
2026-04-05 03:08:53 +02:00
commit 1082d36c12
28015 changed files with 3767672 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
Note: Use of this software in production is permitted under Apache 2.0.
Prisma branding (logos, attribution, etc.) must remain visible and unaltered.
See https://www.prisma.io/terms for details.
+8
View File
@@ -0,0 +1,8 @@
This software includes brand elements owned by Prisma Data, Inc.
Use in production is permitted under the Apache 2.0 license, provided that Prisma branding is preserved.
You may not remove or obscure logos, UI marks, or references to Prisma unless you have purchased a commercial license.
See: https://www.prisma.io/terms
+352
View File
@@ -0,0 +1,352 @@
# @prisma/studio-core
`@prisma/studio-core` is the embeddable Prisma Studio package.
It provides the same core experience as Prisma Studio: a visual way to explore schema, browse table data, edit rows, filter/sort/paginate records, inspect relation data, and run SQL queries with an operation log.
This package is published to npm and consumed by Prisma surfaces such as Console and CLI integrations.
## Embedding Studio
Import the UI entrypoint, include the packaged CSS once, and pass a configured adapter into `Studio`:
```tsx
import {
Studio,
type StudioLlmRequest,
type StudioLlmResponse,
} from "@prisma/studio-core/ui";
import "@prisma/studio-core/ui/index.css";
import { createStudioBFFClient } from "@prisma/studio-core/data/bff";
import { createPostgresAdapter } from "@prisma/studio-core/data/postgres-core";
import { isStudioLlmResponse } from "@prisma/studio-core/data";
const adapter = createPostgresAdapter({
executor: createStudioBFFClient({
url: "/api/query",
}),
});
export function EmbeddedStudio() {
return (
<Studio
adapter={adapter}
llm={async (
request: StudioLlmRequest,
): Promise<StudioLlmResponse> => {
const response = await fetch("/api/ai", {
body: JSON.stringify(request),
headers: { "content-type": "application/json" },
method: "POST",
});
const payload = (await response.json()) as unknown;
if (isStudioLlmResponse(payload)) {
return payload;
}
return {
code: "request-failed",
message: response.ok
? "AI response did not match the Studio LLM contract."
: `AI request failed (${response.status} ${response.statusText})`,
ok: false,
};
}}
/>
);
}
```
`adapter` is required. `llm` is optional and is the single supported AI transport hook for all Studio AI features. Studio sends the fully constructed prompt plus a task label, and the host returns either `{ ok: true, text }` or `{ ok: false, code, message }`. When `llm` is omitted, Studio hides the AI filter, AI SQL generation, and AI visualization affordances entirely.
There are no per-feature AI integration props to wire separately.
Studio no longer renders a built-in fullscreen header button. If your host needs fullscreen behavior, render that control at the host container level, as the local demo does.
Studio handles prompt construction, type-aware validation, correction retries, SQL execution retries, and conversion into the normal filter, SQL, and visualization surfaces. The host transport only needs to forward the prepared request to an LLM provider and return the typed result.
## AI Contract
```ts
type StudioLlmRequest = {
task: "table-filter" | "sql-generation" | "sql-visualization";
prompt: string;
};
type StudioLlmResponse =
| { ok: true; text: string }
| {
ok: false;
code:
| "cancelled"
| "not-configured"
| "output-limit-exceeded"
| "request-failed";
message: string;
};
```
Studio treats `output-limit-exceeded` as a first-class retry signal for SQL generation and visualization correction loops. All prompting and retry behavior live in Studio itself, so host implementations should stay transport-only.
## Integration Checklist
Studio is an embeddable React surface, not a standalone app shell. A production integration should:
- render `<Studio />` inside the host product's route, panel, or page
- import `@prisma/studio-core/ui/index.css` exactly once
- create one database adapter per connection using `createPostgresAdapter`, `createMySQLAdapter`, or `createSQLiteAdapter`
- back that adapter with an authenticated executor, typically `createStudioBFFClient({ url: "/api/query" })`
- expose a JSON BFF endpoint that accepts Studio requests and executes them against the database
- pass any tenant or auth context through `customHeaders` and/or `customPayload`
- optionally provide `llm` for AI-assisted filtering, SQL generation, and SQL result visualization
- own surrounding product chrome such as routing, auth, tenancy, and fullscreen controls
The simplest supported shape is: host React app -> `<Studio />` -> adapter -> `createStudioBFFClient(...)` -> host BFF route -> database executor.
## BFF Contract
Studio's packaged adapters speak one JSON-over-HTTP contract. The host application is expected to implement a POST endpoint, usually `/api/query`, that accepts `StudioBFFRequest` payloads and returns JSON results with serialized errors.
Yes: we did change this contract to support staged multi-cell saves. The current contract includes `procedure: "transaction"`, which is used to commit multiple staged row updates in one database transaction when the backend supports it.
### Transport Rules
- method: `POST`
- content type: `application/json`
- request authentication: whatever the host app requires; `createStudioBFFClient` forwards `customHeaders` as HTTP headers
- request body context: `customPayload` is forwarded in the JSON body unchanged
- error encoding: return serialized errors, not thrown JS objects
### Shared Types
```ts
type Query = {
sql: string;
parameters: readonly unknown[];
transformations?: Partial<Record<string, "json-parse">>;
};
type SerializedError = {
name: string;
message: string;
errors?: SerializedError[];
};
type SqlLintDiagnostic = {
code?: string;
from: number;
message: string;
severity: "error" | "warning" | "info" | "hint";
source?: string;
to: number;
};
```
### Request Shapes
```ts
type StudioBFFRequest =
| {
procedure: "query";
query: Query;
customPayload?: Record<string, unknown>;
}
| {
procedure: "sequence";
sequence: readonly [Query, Query];
customPayload?: Record<string, unknown>;
}
| {
procedure: "transaction";
queries: readonly Query[];
customPayload?: Record<string, unknown>;
}
| {
procedure: "sql-lint";
sql: string;
schemaVersion?: string;
customPayload?: Record<string, unknown>;
};
```
### Response Shapes
```ts
type QueryResponse = [SerializedError, undefined?] | [null, unknown[]];
type SequenceStepResponse = [SerializedError] | [null, unknown[]];
type SequenceResponse =
| [SequenceStepResponse]
| [[null, unknown[]], SequenceStepResponse];
type TransactionResponse = [SerializedError, undefined?] | [null, unknown[][]];
type SqlLintResponse =
| [SerializedError, undefined?]
| [
null,
{
diagnostics: SqlLintDiagnostic[];
schemaVersion?: string;
},
];
```
### Procedure Semantics
- `query`: execute one SQL statement. This is required for every Studio adapter.
- `sequence`: execute exactly two queries in order. This is used by MySQL write flows that update first and refetch second.
- `transaction`: execute an ordered list of queries inside one database transaction. This is the contract addition that enables atomic staged multi-row saves from the table editor.
- `sql-lint`: return parse/plan diagnostics for the SQL editor and SQL-backed filter pills.
For `sequence`, the second query should only run if the first one succeeds. For `transaction`, the response result array must stay in the same order as `body.queries`.
`sql-lint` is optional because adapters can fall back to adapter-local `EXPLAIN` strategies. `transaction` is strongly recommended because it gives staged multi-row saves atomic behavior; without it, adapters may fall back to sequential writes.
## Example BFF Handler
The demo server in this repo is the reference implementation. A host route can mirror it closely:
```ts
import { serializeError, type StudioBFFRequest } from "@prisma/studio-core/data/bff";
export async function handleStudioBff(request: Request): Promise<Response> {
if (request.method !== "POST") {
return new Response("Method Not Allowed", {
headers: { Allow: "POST,OPTIONS" },
status: 405,
});
}
const payload = (await request.json()) as StudioBFFRequest;
if (payload.procedure === "query") {
const [error, result] = await executor.execute(payload.query);
return Response.json([error ? serializeError(error) : null, result]);
}
if (payload.procedure === "sequence") {
const [firstQuery, secondQuery] = payload.sequence;
const [firstError, firstResult] = await executor.execute(firstQuery);
if (firstError) {
return Response.json([[serializeError(firstError)]]);
}
const [secondError, secondResult] = await executor.execute(secondQuery);
if (secondError) {
return Response.json([
[null, firstResult],
[serializeError(secondError)],
]);
}
return Response.json([
[null, firstResult],
[null, secondResult],
]);
}
if (payload.procedure === "transaction") {
if (typeof executor.executeTransaction !== "function") {
return new Response("Transaction execution is not supported", {
status: 501,
});
}
const [error, result] = await executor.executeTransaction(payload.queries);
return Response.json([error ? serializeError(error) : null, result]);
}
if (payload.procedure === "sql-lint") {
if (typeof executor.lintSql !== "function") {
return new Response("SQL lint is not supported", { status: 501 });
}
const [error, result] = await executor.lintSql({
schemaVersion: payload.schemaVersion,
sql: payload.sql,
});
return Response.json([error ? serializeError(error) : null, result]);
}
return new Response("Invalid procedure", { status: 400 });
}
```
## Integration Notes
- If your host app changes auth or tenant context at runtime, recreate the BFF client or adapter so new `customHeaders` and `customPayload` are used for later requests.
- If you are embedding MySQL Studio, keep `sequence` support enabled because the adapter depends on ordered write-plus-refetch flows.
- If you want fully atomic staged table saves, implement `transaction` on the BFF and forward it to a real database transaction on the server.
- If you omit `llm`, Studio still supports the full manual filtering UI and the standard SQL editor, just without any AI affordances.
## Telemetry
This package includes anonymized telemetry to help us improve Prisma Studio.
Set `CHECKPOINT_DISABLE=1` to opt out of usage-data collection, following Prisma's documented CLI telemetry opt-out contract. Learn more in our [Privacy Policy](https://www.prisma.io/privacy) and the [Prisma CLI telemetry docs](https://www.prisma.io/docs/v6/orm/tools/prisma-cli#how-to-opt-out-of-data-collection).
## Run Studio Locally
Requirements:
- Node.js `^20.19 || ^22.12 || >=24.0`
- `pnpm` `8`
- `bun`
Install dependencies and start the demo:
```sh
pnpm install
pnpm demo:ppg
```
Then open [http://localhost:4310](http://localhost:4310).
To enable the demo's AI flows, copy `.env.example` to `.env` and set `ANTHROPIC_API_KEY`.
The demo reads that key server-side and calls Anthropic Haiku 4.5 directly over HTTP through one shared `llm` hook used by table filtering, SQL generation, and SQL result visualization. Set `STUDIO_DEMO_AI_ENABLED=false` to hide all AI affordances without removing the key. `.env` and `.env.local` are gitignored.
The demo:
- starts Prisma Postgres dev (`ppg-dev`) programmatically via `@prisma/dev`
- uses direct TCP for query execution
- seeds sample relational data on startup
- auto-rebuilds and reloads the UI when source files change
The demo database is intentionally ephemeral: it is pre-seeded when the demo starts and reset when the demo process stops.
## Useful Commands
- `pnpm demo:ppg` - run local Studio demo with seeded Prisma Postgres dev
- `pnpm typecheck` - run TypeScript checks
- `pnpm lint` - run ESLint (`--fix`)
- `pnpm test` - run default vitest suite
- `pnpm test:checkpoint` - run checkpoint tests
- `pnpm test:data` - run data-layer tests
- `pnpm test:demo` - run demo/server tests
- `pnpm test:ui` - run UI tests
- `pnpm test:e2e` - run e2e tests
- `pnpm demo:ppg:build` - bundle the demo server with `bun build`
- `pnpm demo:ppg:bundle` - build and run the bundled demo server
- `pnpm build` - build distributable package with `tsup`
- `pnpm check:exports` - validate package export map/types
When bundling the demo with `bun build`, we use `--packages external` so
`@prisma/dev` can resolve its PGlite runtime assets (WASM/data/extensions)
directly from `node_modules` at runtime.
## Development Workflow
For day-to-day development, run the demo locally and verify both terminal logs and browser behavior as you make changes.
Recommended flow:
1. Run `pnpm demo:ppg`.
2. Keep the demo process attached so rebuilds and runtime logs stay visible.
3. Validate UI behavior at `http://localhost:4310`, using Playwright when you want an automated browser check.
Because the demo is pre-seeded and resets between runs, update seed data whenever needed to reproduce richer scenarios.
Seed data lives in `demo/ppg-dev/seed-database.ts` (`seedDatabase`).
+447
View File
@@ -0,0 +1,447 @@
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>>>>;
executeTransaction?(queries: readonly Query<unknown>[], options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<unknown>>[]>>;
/**
* 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>>;
/**
* Updates multiple rows in the database inside one adapter-level transaction
* when supported by the executor.
*/
updateMany?(details: AdapterUpdateManyDetails, options: AdapterUpdateOptions): Promise<Either<AdapterError, AdapterUpdateManyResult>>;
/**
* 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 {
adapterSource?: string;
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 AdapterUpdateManyDetails {
/**
* The updates to apply to existing rows.
*/
updates: AdapterUpdateDetails[];
/**
* 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 AdapterUpdateManyResult {
/**
* The updated row data in the same order as the requested updates.
*/
rows: AdapterUpdateResult["row"][];
/**
* The executed queries that were run inside the transaction.
*/
queries: 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: {
adapterSource?: string;
error: Error;
query?: Query<unknown>;
}): [AdapterError];
export { type SqlLintResult as $, type AdapterIntrospectResult as A, type AdapterUpdateDetails as B, type AdapterUpdateManyDetails as C, type AdapterUpdateManyResult as D, type AdapterUpdateOptions as E, type AdapterUpdateResult as F, type BigIntString as G, type Column as H, type ColumnFilter as I, type DataType as J, type DataTypeGroup as K, type Either as L, type ExecuteOptions as M, type Executor as N, type FilterGroup as O, type FilterOperator as P, type NumericString as Q, type Query as R, type SqlEditorDialect as S, type QueryResult as T, type Schema as U, type SequenceExecutor as V, type SortDirection as W, type SortOrderItem as X, type SqlFilter as Y, type SqlLintDetails as Z, type SqlLintDiagnostic as _, type AdapterSqlSchemaResult as a, type Table as a0, applyInferredRowFilters as a1, createAdapterError as a2, getAbortResult as a3, type BuilderRequirements as a4, 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 };
+447
View File
@@ -0,0 +1,447 @@
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>>>>;
executeTransaction?(queries: readonly Query<unknown>[], options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<unknown>>[]>>;
/**
* 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>>;
/**
* Updates multiple rows in the database inside one adapter-level transaction
* when supported by the executor.
*/
updateMany?(details: AdapterUpdateManyDetails, options: AdapterUpdateOptions): Promise<Either<AdapterError, AdapterUpdateManyResult>>;
/**
* 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 {
adapterSource?: string;
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 AdapterUpdateManyDetails {
/**
* The updates to apply to existing rows.
*/
updates: AdapterUpdateDetails[];
/**
* 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 AdapterUpdateManyResult {
/**
* The updated row data in the same order as the requested updates.
*/
rows: AdapterUpdateResult["row"][];
/**
* The executed queries that were run inside the transaction.
*/
queries: 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: {
adapterSource?: string;
error: Error;
query?: Query<unknown>;
}): [AdapterError];
export { type SqlLintResult as $, type AdapterIntrospectResult as A, type AdapterUpdateDetails as B, type AdapterUpdateManyDetails as C, type AdapterUpdateManyResult as D, type AdapterUpdateOptions as E, type AdapterUpdateResult as F, type BigIntString as G, type Column as H, type ColumnFilter as I, type DataType as J, type DataTypeGroup as K, type Either as L, type ExecuteOptions as M, type Executor as N, type FilterGroup as O, type FilterOperator as P, type NumericString as Q, type Query as R, type SqlEditorDialect as S, type QueryResult as T, type Schema as U, type SequenceExecutor as V, type SortDirection as W, type SortOrderItem as X, type SqlFilter as Y, type SqlLintDetails as Z, type SqlLintDiagnostic as _, type AdapterSqlSchemaResult as a, type Table as a0, applyInferredRowFilters as a1, createAdapterError as a2, getAbortResult as a3, type BuilderRequirements as a4, 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 };
+10
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
File diff suppressed because one or more lines are too long
+10
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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vbm9kZV9tb2R1bGVzLy5wbnBtL2t5c2VseUAwLjI4LjEwL25vZGVfbW9kdWxlcy9reXNlbHkvZGlzdC9lc20vdXRpbC9qc29uLW9iamVjdC1hcmdzLmpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvLy8gPHJlZmVyZW5jZSB0eXBlcz1cIi4vanNvbi1vYmplY3QtYXJncy5kLnRzXCIgLz5cbmltcG9ydCB7IEV4cHJlc3Npb25XcmFwcGVyIH0gZnJvbSAnLi4vZXhwcmVzc2lvbi9leHByZXNzaW9uLXdyYXBwZXIuanMnO1xuaW1wb3J0IHsgQWxpYXNOb2RlIH0gZnJvbSAnLi4vb3BlcmF0aW9uLW5vZGUvYWxpYXMtbm9kZS5qcyc7XG5pbXBvcnQgeyBDb2x1bW5Ob2RlIH0gZnJvbSAnLi4vb3BlcmF0aW9uLW5vZGUvY29sdW1uLW5vZGUuanMnO1xuaW1wb3J0IHsgSWRlbnRpZmllck5vZGUgfSBmcm9tICcuLi9vcGVyYXRp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ksRUFBUUgsRUFBRSxNQUFNLElBQUksRUFBR0ksRUFBT04sRUFBT0UsRUFBRSxNQUFNLElBQUksQ0FBQyxNQUc1RCxPQUFNLElBQUksTUFBTSx1REFBdUQsRUFHL0UsT0FBT0QsQ0FDWCxDQUNBLFNBQVNJLEVBQVFJLEVBQUssQ0FDbEIsT0FBTyxJQUFJQyxFQUFrQkMsRUFBVSxnQkFBZ0JGLENBQUcsQ0FBQyxDQUMvRCxDQUNBLFNBQVNILEVBQU9OLEVBQU9TLEVBQUssQ0FDeEIsT0FBTyxJQUFJQyxFQUFrQlAsRUFBYyxPQUFPQyxFQUFXLE9BQU9LLENBQUcsRUFBR0csRUFBVSxPQUFPWixDQUFLLENBQUMsQ0FBQyxDQUN0RyIsCiAgIm5hbWVzIjogWyJnZXRKc29uT2JqZWN0QXJncyIsICJub2RlIiwgInRhYmxlIiwgImFyZ3MiLCAicyIsICJSZWZlcmVuY2VOb2RlIiwgIkNvbHVtbk5vZGUiLCAiY29sTmFtZSIsICJjb2xSZWYiLCAiQWxpYXNOb2RlIiwgIklkZW50aWZpZXJOb2RlIiwgImNvbCIsICJFeHByZXNzaW9uV3JhcHBlciIsICJWYWx1ZU5vZGUiLCAiVGFibGVOb2RlIl0KfQo=
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
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
+10
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+PjtcblxuICBleGVjdXRlVHJhbnNhY3Rpb24/KFxuICAgIHF1ZXJpZXM6IHJlYWRvbmx5IFF1ZXJ5PHVua25vd24+W10sXG4gICAgb3B0aW9ucz86IEV4ZWN1dGVPcHRpb25zLFxuICApOiBQcm9taXNlPEVpdGhlcjxFcnJvciwgUXVlcnlSZXN1bHQ8UXVlcnk8dW5rbm93bj4+W10+PjtcblxuICAvKipcbiAgICogT3B0aW9uYWwgU1FMIGxpbnQgdHJhbnNwb3J0IGZvciBwYXJzZS9wbGFuIGRpYWdub3N0aWNzLlxuICAgKlxuICAgKiBFeGVjdXRvcnMgdGhhdCBkbyBub3QgaW1wbGVtZW50IHRoaXMgY2FwYWJpbGl0eSBjYW4gc3RpbGwgYmUgdXNlZCBieVxuICAgKiBhZGFwdGVycyB3aXRoIGZhbGxiYWNrIGxpbnQgc3RyYXRlZ2llcy5cbiAgICovXG4gIGxpbnRTcWw/KFxuICAgIGRldGFpbHM6IFNxbExpbnREZXRhaWxzLFxuICAgIG9wdGlvbnM/OiBFeGVjdXRlT3B0aW9ucyxcbiAgKTogUHJvbWlz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4gIGNvbnN0cnVjdG9yKCkge1xuICAgIHN1cGVyKFwiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWRcIik7XG4gICAgdGhpcy5uYW1lID0gXCJBYm9ydEVycm9yXCI7XG4gIH1cbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEFib3J0UmVzdWx0KCk6IFtBYm9ydEVycm9yXSB7XG4gIHJldHVybiBbbmV3IEFib3J0RXJyb3IoKV07XG59XG4iXSwKICAibWFwcGluZ3MiOiAiOzs7Ozs7OztBQTJETyxJQUFNQSxFQUFOLGNBQXlCLEtBQU0sQ0FDcEMsYUFBYyxDQUNaLE1BQU0sNEJBQTRCLEVBQ2xDLEtBQUssS0FBTyxZQUNkLENBQ0YsRUFFTyxTQUFTQyxHQUErQixDQUM3QyxNQUFPLENBQUMsSUFBSUQsQ0FBWSxDQUMxQiIsCiAgIm5hbWVzIjogWyJBYm9ydEVycm9yIiwgImdldEFib3J0UmVzdWx0Il0KfQo=
+10
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
+103
View File
@@ -0,0 +1,103 @@
import { V as SequenceExecutor, R as Query, M as ExecuteOptions, L as Either, T as QueryResult, v as AdapterSqlLintDiagnostic } from '../../adapter-BUw-ZngT.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 execute a transactional batch of queries.
*
* The queries are sent as `body.queries`.
*/
executeTransaction(this: void, queries: readonly Query<unknown>[], options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<unknown>>[]>>;
/**
* Requests BFF to lint SQL via parse/plan diagnostics.
*/
lintSql(this: void, details: StudioBFFSqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, StudioBFFSqlLintResult>>;
}
type StudioBFFRequest = StudioBFFQueryRequest | StudioBFFSequenceRequest | StudioBFFTransactionRequest | 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 StudioBFFTransactionRequest {
customPayload?: Record<string, unknown>;
procedure: "transaction";
queries: readonly 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, type StudioBFFTransactionRequest, consumeBffRequestDurationMsForSignal, createStudioBFFClient, deserializeError, serializeError };
+103
View File
@@ -0,0 +1,103 @@
import { V as SequenceExecutor, R as Query, M as ExecuteOptions, L as Either, T as QueryResult, v as AdapterSqlLintDiagnostic } from '../../adapter-BUw-ZngT.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 execute a transactional batch of queries.
*
* The queries are sent as `body.queries`.
*/
executeTransaction(this: void, queries: readonly Query<unknown>[], options?: ExecuteOptions): Promise<Either<Error, QueryResult<Query<unknown>>[]>>;
/**
* Requests BFF to lint SQL via parse/plan diagnostics.
*/
lintSql(this: void, details: StudioBFFSqlLintDetails, options?: ExecuteOptions): Promise<Either<Error, StudioBFFSqlLintResult>>;
}
type StudioBFFRequest = StudioBFFQueryRequest | StudioBFFSequenceRequest | StudioBFFTransactionRequest | 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 StudioBFFTransactionRequest {
customPayload?: Record<string, unknown>;
procedure: "transaction";
queries: readonly 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, type StudioBFFTransactionRequest, consumeBffRequestDurationMsForSignal, createStudioBFFClient, deserializeError, serializeError };
+10
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-IH6NMUYT.js";import"../../chunk-6QJ7HVIC.js";export{a as consumeBffRequestDurationMsForSignal,b as createStudioBFFClient,d as deserializeError,c as serializeError};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
File diff suppressed because one or more lines are too long
+34
View File
@@ -0,0 +1,34 @@
import { A as AdapterIntrospectResult, S as SqlEditorDialect, a as AdapterSqlSchemaResult } from '../adapter-BUw-ZngT.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 AdapterUpdateManyDetails, D as AdapterUpdateManyResult, E as AdapterUpdateOptions, F as AdapterUpdateResult, G as BigIntString, H as Column, I as ColumnFilter, J as DataType, K as DataTypeGroup, L as Either, M as ExecuteOptions, N as Executor, O as FilterGroup, P as FilterOperator, Q as NumericString, R as Query, T as QueryResult, U as Schema, V as SequenceExecutor, W as SortDirection, X as SortOrderItem, Y as SqlFilter, Z as SqlLintDetails, _ as SqlLintDiagnostic, $ as SqlLintResult, a0 as Table, a1 as applyInferredRowFilters, a2 as createAdapterError, a3 as getAbortResult } from '../adapter-BUw-ZngT.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-DVOqqqSg.cjs';
export { S as STUDIO_LLM_ERROR_CODES, a as STUDIO_LLM_TASKS, b as StudioLlm, c as StudioLlmError, d as StudioLlmErrorCode, e as StudioLlmErrorResponse, f as StudioLlmRequest, g as StudioLlmResponse, h as StudioLlmSuccessResponse, i as StudioLlmTask, j as buildStudioLlmOutputLimitExceededMessage, k as isStudioLlmResponse, r as readStudioLlmOutputLimitExceededMessage } from '../llm-BfRpcVV1.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 };
+34
View File
@@ -0,0 +1,34 @@
import { A as AdapterIntrospectResult, S as SqlEditorDialect, a as AdapterSqlSchemaResult } from '../adapter-BUw-ZngT.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 AdapterUpdateManyDetails, D as AdapterUpdateManyResult, E as AdapterUpdateOptions, F as AdapterUpdateResult, G as BigIntString, H as Column, I as ColumnFilter, J as DataType, K as DataTypeGroup, L as Either, M as ExecuteOptions, N as Executor, O as FilterGroup, P as FilterOperator, Q as NumericString, R as Query, T as QueryResult, U as Schema, V as SequenceExecutor, W as SortDirection, X as SortOrderItem, Y as SqlFilter, Z as SqlLintDetails, _ as SqlLintDiagnostic, $ as SqlLintResult, a0 as Table, a1 as applyInferredRowFilters, a2 as createAdapterError, a3 as getAbortResult } from '../adapter-BUw-ZngT.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-CBIeucRq.js';
export { S as STUDIO_LLM_ERROR_CODES, a as STUDIO_LLM_TASKS, b as StudioLlm, c as StudioLlmError, d as StudioLlmErrorCode, e as StudioLlmErrorResponse, f as StudioLlmRequest, g as StudioLlmResponse, h as StudioLlmSuccessResponse, i as StudioLlmTask, j as buildStudioLlmOutputLimitExceededMessage, k as isStudioLlmResponse, r as readStudioLlmOutputLimitExceededMessage } from '../llm-BfRpcVV1.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
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 s,b as y,c as a,d as L,e as S,f as c,g as E,h as R,i as g,j as n,k as M,l as O}from"../chunk-PI3N7ZW6.js";import{a as e,b as t,c as r,d as o}from"../chunk-HSOPNDGG.js";import{a as Q,b,c as w}from"../chunk-N6ZIYSZ5.js";import{C as p,G as F,H as I,b as m,c as u,d as x,e as d,f as i,g as f,h as l}from"../chunk-LR52PZTP.js";import"../chunk-6QJ7HVIC.js";export{i as DEFAULT_ARRAY_DISPLAY,l as DEFAULT_ARRAY_VALUE,d as DEFAULT_BOOLEAN,f as DEFAULT_JSON,x as DEFAULT_NUMERIC,u as DEFAULT_STRING,S as FULL_TABLE_SEARCH_MAX_TEXT_COLUMNS,L as FULL_TABLE_SEARCH_MIN_QUERY_LENGTH,a as FULL_TABLE_SEARCH_MYSQL_LOCK_WAIT_TIMEOUT_SECONDS,y as FULL_TABLE_SEARCH_POSTGRES_LOCK_TIMEOUT_MS,c as FULL_TABLE_SEARCH_TIMEOUT_MESSAGE,s as FULL_TABLE_SEARCH_TIMEOUT_MS,E as FullTableSearchTimeoutError,e as StudioLlmError,p as applyInferredRowFilters,M as buildFullTableSearchPlan,t as buildStudioLlmOutputLimitExceededMessage,R as createFullTableSearchExecutionState,b as createSqlEditorNamespace,Q as createSqlEditorSchemaFromIntrospection,w as createSqlEditorSchemaVersion,n as executeQueryWithFullTableSearchGuardrails,m as getDate0,O as getFullTableSearchExpression,I as getTopLevelSqlStatementAtCursor,g as isFullTableSearchRequest,r as isStudioLlmResponse,o as readStudioLlmOutputLimitExceededMessage,F as splitTopLevelSqlStatements};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
File diff suppressed because one or more lines are too long
+269
View File
@@ -0,0 +1,269 @@
import { t as AdapterRequirements, V as SequenceExecutor, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, N as Executor, u as AdapterSqlLintDetails, L as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-BUw-ZngT.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 };
+269
View File
@@ -0,0 +1,269 @@
import { t as AdapterRequirements, V as SequenceExecutor, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, N as Executor, u as AdapterSqlLintDetails, L as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-BUw-ZngT.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
+7
View File
@@ -0,0 +1,7 @@
import { Pool } from 'mysql2/promise';
import { V as SequenceExecutor } from '../../adapter-BUw-ZngT.cjs';
import 'kysely';
declare function createMySQL2Executor(pool: Pool): SequenceExecutor;
export { createMySQL2Executor };
+7
View File
@@ -0,0 +1,7 @@
import { Pool } from 'mysql2/promise';
import { V as SequenceExecutor } from '../../adapter-BUw-ZngT.js';
import 'kysely';
declare function createMySQL2Executor(pool: Pool): SequenceExecutor;
export { createMySQL2Executor };
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
"use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var S=(e,r)=>{for(var t in r)i(e,t,{get:r[t],enumerable:!0})},d=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of x(r))!v.call(e,o)&&o!==t&&i(e,o,{get:()=>r[o],enumerable:!(n=y(r,o))||n.enumerable});return e};var h=e=>d(i({},"__esModule",{value:!0}),e);var E={};S(E,{createNodeSQLiteExecutor:()=>w});module.exports=h(E);function w(e){function r(t){let{parameters:n,sql:o,transformations:c}=t,u=e.prepare(o).all(...n);if(!c||Object.keys(c).length===0)return u;let l=c;for(let m of u)for(let s in l){let p=l[s],a=m[s];if(p==="json-parse"){if(typeof a=="string")try{m[s]=JSON.parse(a)}catch(f){console.error(`Failed to JSON.parse column "${s}" with value: ${a}`,f)}continue}}return u}return{execute:t=>{try{return Promise.resolve([null,r(t)])}catch(n){return Promise.resolve([n])}},executeTransaction:t=>{try{e.exec("BEGIN");let n=t.map(o=>r(o));return e.exec("COMMIT"),Promise.resolve([null,n])}catch(n){try{e.exec("ROLLBACK")}catch{}return Promise.resolve([n])}}}}
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZVN5bmMsIFNRTElucHV0VmFsdWUgfSBmcm9tIFwibm9kZTpzcWxpdGVcIjtcblxuaW1wb3J0IHR5cGU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aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH1cblxuICAgICAgICB0cmFuc2Zvcm1hdGlvbiBzYXRpc2ZpZXMgdW5kZWZpbmVkO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiByb3dzO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICBleGVjdXRlOiAocXVlcnkpID0+IHtcbiAgICAgIHRyeSB7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW251bGwsIGV4ZWN1dGVRdWVyeShxdWVyeSldKSBhcyBuZXZlcjtcbiAgICAgIH0gY2F0Y2ggKGVycm9yOiB1bmtub3duKSB7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW2Vycm9yIGFzIEVycm9yXSk7XG4gICAgICB9XG4gICAgfSxcblxuICAgIGV4ZWN1dGVUcmFuc2FjdGlvbjogKHF1ZXJpZXMpID0+IHtcbiAgICAgIHRyeSB7XG4gICAgICAgIGRhdGFiYXNlLmV4ZWMoXCJCRUdJTlwiKTtcbiAgICAgICAgY29uc3QgcmVzdWx0cyA9IHF1ZXJpZXMubWFwKChxdWVyeSkgPT4gZX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LCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIiwgInF1ZXJpZXMiLCAicmVzdWx0cyJdCn0K
+7
View File
@@ -0,0 +1,7 @@
import { DatabaseSync } from 'node:sqlite';
import { N as Executor } from '../../adapter-BUw-ZngT.cjs';
import 'kysely';
declare function createNodeSQLiteExecutor(database: DatabaseSync): Executor;
export { createNodeSQLiteExecutor };
+7
View File
@@ -0,0 +1,7 @@
import { DatabaseSync } from 'node:sqlite';
import { N as Executor } from '../../adapter-BUw-ZngT.js';
import 'kysely';
declare function createNodeSQLiteExecutor(database: DatabaseSync): Executor;
export { createNodeSQLiteExecutor };
+10
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 y(t){function a(r){let{parameters:e,sql:o,transformations:s}=r,c=t.prepare(o).all(...e);if(!s||Object.keys(s).length===0)return c;let i=s;for(let l of c)for(let n in i){let m=i[n],u=l[n];if(m==="json-parse"){if(typeof u=="string")try{l[n]=JSON.parse(u)}catch(p){console.error(`Failed to JSON.parse column "${n}" with value: ${u}`,p)}continue}}return c}return{execute:r=>{try{return Promise.resolve([null,a(r)])}catch(e){return Promise.resolve([e])}},executeTransaction:r=>{try{t.exec("BEGIN");let e=r.map(o=>a(o));return t.exec("COMMIT"),Promise.resolve([null,e])}catch(e){try{t.exec("ROLLBACK")}catch{}return Promise.resolve([e])}}}}export{y as createNodeSQLiteExecutor};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9ub2RlLXNxbGl0ZS9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZVN5bmMsIFNRTElucHV0V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hbHVlID0gcm93W2NvbHVtbl07XG5cbiAgICAgICAgaWYgKHRyYW5zZm9ybWF0aW9uID09PSBcImpzb24tcGFyc2VcIikge1xuICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgIHJvd1tjb2x1bW5dID0gSlNPTi5wYXJzZSh2YWx1ZSkgYXMgbmV2ZXI7XG4gICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAgICAgICAgIGBGYWlsZWQgdG8gSlNPTi5wYXJzZSBjb2x1bW4gXCIke2NvbHVtbn1cIiB3aXRoIHZhbHVlOiAke3ZhbHVlfWAsXG4gICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29udGludWU7XG4gICAgICAgIH1cblxuICAgICAgICB0cmFuc2Zvcm1hdGlvbiBzYXRpc2ZpZXMgdW5kZWZpbmVkO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiByb3dzO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICBleGVjdXRlOiAocXVlcnkpID0+IHtcbiAgICAgIHRyeSB7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW251bGwsIGV4ZWN1dGVRdWVyeShxdWVyeSldKSBhcyBuZXZlcjtcbiAgICAgIH0gY2F0Y2ggKGVycm9yOiB1bmtub3duKSB7XG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoW2Vycm9yIGFzIEVycm9yXSk7XG4gICAgICB9XG4gICAgfSxcblxuICAgIGV4ZWN1dGVUcmFuc2FjdGlvbjogKHF1ZXJpZXMpID0+IHtcbiAgICAgIHRyeSB7XG4gICAgICAgIGRhdGFiYXNlLmV4ZWMoXCJCRUdJTlwiKTtcbiAgICA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3IiLCAicXVlcmllcyIsICJyZXN1bHRzIl0KfQo=
File diff suppressed because one or more lines are too long
+25
View File
@@ -0,0 +1,25 @@
import { PGlite } from '@electric-sql/pglite';
import { R as Query, c as Adapter, N as Executor } from '../../adapter-BUw-ZngT.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 };
+25
View File
@@ -0,0 +1,25 @@
import { PGlite } from '@electric-sql/pglite';
import { R as Query, c as Adapter, N as Executor } from '../../adapter-BUw-ZngT.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
+295
View File
@@ -0,0 +1,295 @@
import { t as AdapterRequirements, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic } from '../../adapter-BUw-ZngT.cjs';
import { h as FullTableSearchPlan } from '../../full-table-search-DVOqqqSg.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-DVOqqqSg.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 };
+295
View File
@@ -0,0 +1,295 @@
import { t as AdapterRequirements, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic } from '../../adapter-BUw-ZngT.js';
import { h as FullTableSearchPlan } from '../../full-table-search-CBIeucRq.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-CBIeucRq.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 };
+10
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-OOLWUTBP.js";import{a as B,b as C}from"../../chunk-LR4WIE5H.js";import"../../chunk-IZGN5R76.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
+7
View File
@@ -0,0 +1,7 @@
import { Sql } from 'postgres';
import { N as Executor } from '../../adapter-BUw-ZngT.cjs';
import 'kysely';
declare function createPostgresJSExecutor(postgresjs: Sql): Executor;
export { createPostgresJSExecutor };
+7
View File
@@ -0,0 +1,7 @@
import { Sql } from 'postgres';
import { N as Executor } from '../../adapter-BUw-ZngT.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
+208
View File
@@ -0,0 +1,208 @@
import { t as AdapterRequirements, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, N as Executor, u as AdapterSqlLintDetails, L as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-BUw-ZngT.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 };
+208
View File
@@ -0,0 +1,208 @@
import { t as AdapterRequirements, c as Adapter, a0 as Table, P as FilterOperator, R as Query, f as AdapterDeleteDetails, a4 as BuilderRequirements, j as AdapterInsertDetails, n as AdapterQueryDetails, B as AdapterUpdateDetails, v as AdapterSqlLintDiagnostic, N as Executor, u as AdapterSqlLintDetails, L as Either, i as AdapterError, x as AdapterSqlLintResult } from '../../adapter-BUw-ZngT.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
+2
View File
@@ -0,0 +1,2 @@
"use strict";var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var x=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},E=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!w.call(r,o)&&o!==t&&p(r,o,{get:()=>e[o],enumerable:!(n=v(e,o))||n.enumerable});return r};var O=r=>E(p({},"__esModule",{value:!0}),r);var d={};x(d,{createSQLJSExecutor:()=>S});module.exports=O(d);function S(r){function e(t){let{parameters:n,sql:o,transformations:a}=t,i=r.prepare(o);i.bind(n);let s=[];for(;i.step();){let u=i.getAsObject();s.push(u)}if(!a||Object.keys(a).length===0)return s;let f=a;for(let u of s)for(let c in f){let m=f[c],l=u[c];if(m==="json-parse"){if(typeof l=="string")try{u[c]=JSON.parse(l)}catch(y){console.error(`Failed to JSON.parse column "${c}" with value: ${l}`,y)}continue}}return s}return{execute:t=>{try{return Promise.resolve([null,e(t)])}catch(n){return Promise.resolve([n])}},executeTransaction:t=>{try{r.run("BEGIN");let n=t.map(o=>e(o));return r.run("COMMIT"),Promise.resolve([null,n])}catch(n){try{r.run("ROLLBACK")}catch{}return Promise.resolve([n])}}}}
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHR5cGUgeyBEYXRhYmFzZSwgU3FsVmFsdWUgfSBmcm9tIFwic3FsLmpzXCI7XG5cbmltcG9ydCB0eXBlIHsgRXhlY3V0b3IgfSBmcm9tIFwiLi4vZXhlY3V0b3JcIjtcbmltcG9ydCB0eXBlIHsgUXVlcnkgfSBmcm9tIFwiLi4vcXVlcnlcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGNyZWF0ZVNRTEpTRXhlY3V0b3IoZGF0YWJhc2U6IERhdGFiYXNlKTogRXhlY3V0b3Ige1xuICBmdW5jdGl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vcm1hdGlvbnMiLCAic3RhdGVtZW50IiwgInJvd3MiLCAicm93IiwgInR5cGVkVHJhbnNmb3JtYXRpb25zIiwgImNvbHVtbiIsICJ0cmFuc2Zvcm1hdGlvbiIsICJ2YWx1ZSIsICJlcnJvciIsICJxdWVyaWVzIiwgInJlc3VsdHMiXQp9Cg==
+7
View File
@@ -0,0 +1,7 @@
import { Database } from 'sql.js';
import { N as Executor } from '../../adapter-BUw-ZngT.cjs';
import 'kysely';
declare function createSQLJSExecutor(database: Database): Executor;
export { createSQLJSExecutor };
+7
View File
@@ -0,0 +1,7 @@
import { Database } from 'sql.js';
import { N as Executor } from '../../adapter-BUw-ZngT.js';
import 'kysely';
declare function createSQLJSExecutor(database: Database): Executor;
export { createSQLJSExecutor };
+10
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 y(t){function l(e){let{parameters:r,sql:u,transformations:c}=e,a=t.prepare(u);a.bind(r);let n=[];for(;a.step();){let o=a.getAsObject();n.push(o)}if(!c||Object.keys(c).length===0)return n;let p=c;for(let o of n)for(let s in p){let f=p[s],i=o[s];if(f==="json-parse"){if(typeof i=="string")try{o[s]=JSON.parse(i)}catch(m){console.error(`Failed to JSON.parse column "${s}" with value: ${i}`,m)}continue}}return n}return{execute:e=>{try{return Promise.resolve([null,l(e)])}catch(r){return Promise.resolve([r])}},executeTransaction:e=>{try{t.run("BEGIN");let r=e.map(u=>l(u));return t.run("COMMIT"),Promise.resolve([null,r])}catch(r){try{t.run("ROLLBACK")}catch{}return Promise.resolve([r])}}}}export{y as createSQLJSExecutor};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vZGF0YS9zcWxqcy9pbmRleC50cyJdLAogICJzb3VyY2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RUEsT0FBTyxRQUFRLFFBQVEsQ0FBQ2EsQ0FBYyxDQUFDLENBQ3pDLENBQ0YsQ0FDRixDQUNGIiwKICAibmFtZXMiOiBbImNyZWF0ZVNRTEpTRXhlY3V0b3IiLCAiZGF0YWJhc2UiLCAiZXhlY3V0ZVF1ZXJ5IiwgInF1ZXJ5IiwgInBhcmFtZXRlcnMiLCAic3FsIiwgInRyYW5zZm9ybWF0aW9ucyIsICJzdGF0ZW1lbnQiLCAicm93cyIsICJyb3ciLCAidHlwZWRUcmFuc2Zvcm1hdGlvbnMiLCAiY29sdW1uIiwgInRyYW5zZm9ybWF0aW9uIiwgInZhbHVlIiwgImVycm9yIiwgInF1ZXJpZXMiLCAicmVzdWx0cyJdCn0K
+65
View File
@@ -0,0 +1,65 @@
import { ExpressionBuilder, Expression, SqlBool } from 'kysely';
import { a0 as Table, t as AdapterRequirements, o as AdapterQueryOptions, R as Query, L as Either, T as QueryResult } from './adapter-BUw-ZngT.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 };
+65
View File
@@ -0,0 +1,65 @@
import { ExpressionBuilder, Expression, SqlBool } from 'kysely';
import { a0 as Table, t as AdapterRequirements, o as AdapterQueryOptions, R as Query, L as Either, T as QueryResult } from './adapter-BUw-ZngT.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 };
+34
View File
@@ -0,0 +1,34 @@
declare const STUDIO_LLM_TASKS: readonly ["table-filter", "sql-generation", "sql-visualization"];
type StudioLlmTask = (typeof STUDIO_LLM_TASKS)[number];
declare const STUDIO_LLM_ERROR_CODES: readonly ["cancelled", "not-configured", "output-limit-exceeded", "request-failed"];
type StudioLlmErrorCode = (typeof STUDIO_LLM_ERROR_CODES)[number];
interface StudioLlmRequest {
prompt: string;
task: StudioLlmTask;
}
interface StudioLlmSuccessResponse {
ok: true;
text: string;
}
interface StudioLlmErrorResponse {
code: StudioLlmErrorCode;
message: string;
ok: false;
}
type StudioLlmResponse = StudioLlmSuccessResponse | StudioLlmErrorResponse;
type StudioLlm = (request: StudioLlmRequest) => Promise<StudioLlmResponse>;
declare class StudioLlmError extends Error {
code: StudioLlmErrorCode;
constructor(args: {
code: StudioLlmErrorCode;
message: string;
});
}
declare function buildStudioLlmOutputLimitExceededMessage(args: {
maxTokens: number;
provider: string;
}): string;
declare function isStudioLlmResponse(value: unknown): value is StudioLlmResponse;
declare function readStudioLlmOutputLimitExceededMessage(value: unknown): string | null;
export { STUDIO_LLM_ERROR_CODES as S, STUDIO_LLM_TASKS as a, type StudioLlm as b, StudioLlmError as c, type StudioLlmErrorCode as d, type StudioLlmErrorResponse as e, type StudioLlmRequest as f, type StudioLlmResponse as g, type StudioLlmSuccessResponse as h, type StudioLlmTask as i, buildStudioLlmOutputLimitExceededMessage as j, isStudioLlmResponse as k, readStudioLlmOutputLimitExceededMessage as r };
+34
View File
@@ -0,0 +1,34 @@
declare const STUDIO_LLM_TASKS: readonly ["table-filter", "sql-generation", "sql-visualization"];
type StudioLlmTask = (typeof STUDIO_LLM_TASKS)[number];
declare const STUDIO_LLM_ERROR_CODES: readonly ["cancelled", "not-configured", "output-limit-exceeded", "request-failed"];
type StudioLlmErrorCode = (typeof STUDIO_LLM_ERROR_CODES)[number];
interface StudioLlmRequest {
prompt: string;
task: StudioLlmTask;
}
interface StudioLlmSuccessResponse {
ok: true;
text: string;
}
interface StudioLlmErrorResponse {
code: StudioLlmErrorCode;
message: string;
ok: false;
}
type StudioLlmResponse = StudioLlmSuccessResponse | StudioLlmErrorResponse;
type StudioLlm = (request: StudioLlmRequest) => Promise<StudioLlmResponse>;
declare class StudioLlmError extends Error {
code: StudioLlmErrorCode;
constructor(args: {
code: StudioLlmErrorCode;
message: string;
});
}
declare function buildStudioLlmOutputLimitExceededMessage(args: {
maxTokens: number;
provider: string;
}): string;
declare function isStudioLlmResponse(value: unknown): value is StudioLlmResponse;
declare function readStudioLlmOutputLimitExceededMessage(value: unknown): string | null;
export { STUDIO_LLM_ERROR_CODES as S, STUDIO_LLM_TASKS as a, type StudioLlm as b, StudioLlmError as c, type StudioLlmErrorCode as d, type StudioLlmErrorResponse as e, type StudioLlmRequest as f, type StudioLlmResponse as g, type StudioLlmSuccessResponse as h, type StudioLlmTask as i, buildStudioLlmOutputLimitExceededMessage as j, isStudioLlmResponse as k, readStudioLlmOutputLimitExceededMessage as r };
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 it is too large Load Diff
+104
View File
@@ -0,0 +1,104 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { c as Adapter, R as Query, i as AdapterError } from '../adapter-BUw-ZngT.cjs';
import { b as StudioLlm } from '../llm-BfRpcVV1.cjs';
export { d as StudioLlmErrorCode, f as StudioLlmRequest, g as StudioLlmResponse, i as StudioLlmTask } from '../llm-BfRpcVV1.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;
llm?: StudioLlm;
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, StudioLlm, type StudioProps, type ThemeVariables, keyMap, parseThemeFromCSS, urlKeys, useQueryState, useQueryStates };
+104
View File
@@ -0,0 +1,104 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { c as Adapter, R as Query, i as AdapterError } from '../adapter-BUw-ZngT.js';
import { b as StudioLlm } from '../llm-BfRpcVV1.js';
export { d as StudioLlmErrorCode, f as StudioLlmRequest, g as StudioLlmResponse, i as StudioLlmTask } from '../llm-BfRpcVV1.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;
llm?: StudioLlm;
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, StudioLlm, type StudioProps, type ThemeVariables, keyMap, parseThemeFromCSS, urlKeys, useQueryState, useQueryStates };
File diff suppressed because one or more lines are too long
+260
View File
@@ -0,0 +1,260 @@
{
"name": "@prisma/studio-core",
"version": "0.27.3",
"description": "Modular Prisma Studio components",
"type": "module",
"sideEffects": false,
"exports": {
"./data": {
"import": {
"types": "./dist/data/index.d.ts",
"default": "./dist/data/index.js"
},
"require": {
"types": "./dist/data/index.d.cts",
"default": "./dist/data/index.cjs"
}
},
"./data/mysql-core": {
"import": {
"types": "./dist/data/mysql-core/index.d.ts",
"default": "./dist/data/mysql-core/index.js"
},
"require": {
"types": "./dist/data/mysql-core/index.d.cts",
"default": "./dist/data/mysql-core/index.cjs"
}
},
"./data/mysql2": {
"import": {
"types": "./dist/data/mysql2/index.d.ts",
"default": "./dist/data/mysql2/index.js"
},
"require": {
"types": "./dist/data/mysql2/index.d.cts",
"default": "./dist/data/mysql2/index.cjs"
}
},
"./data/bff": {
"import": {
"types": "./dist/data/bff/index.d.ts",
"default": "./dist/data/bff/index.js"
},
"require": {
"types": "./dist/data/bff/index.d.cts",
"default": "./dist/data/bff/index.cjs"
}
},
"./data/node-sqlite": {
"import": {
"types": "./dist/data/node-sqlite/index.d.ts",
"default": "./dist/data/node-sqlite/index.js"
},
"require": {
"types": "./dist/data/node-sqlite/index.d.cts",
"default": "./dist/data/node-sqlite/index.cjs"
}
},
"./data/pglite": {
"import": {
"types": "./dist/data/pglite/index.d.ts",
"default": "./dist/data/pglite/index.js"
},
"require": {
"types": "./dist/data/pglite/index.d.cts",
"default": "./dist/data/pglite/index.cjs"
}
},
"./data/postgres-core": {
"import": {
"types": "./dist/data/postgres-core/index.d.ts",
"default": "./dist/data/postgres-core/index.js"
},
"require": {
"types": "./dist/data/postgres-core/index.d.cts",
"default": "./dist/data/postgres-core/index.cjs"
}
},
"./data/postgresjs": {
"import": {
"types": "./dist/data/postgresjs/index.d.ts",
"default": "./dist/data/postgresjs/index.js"
},
"require": {
"types": "./dist/data/postgresjs/index.d.cts",
"default": "./dist/data/postgresjs/index.cjs"
}
},
"./data/sqlite-core": {
"import": {
"types": "./dist/data/sqlite-core/index.d.ts",
"default": "./dist/data/sqlite-core/index.js"
},
"require": {
"types": "./dist/data/sqlite-core/index.d.cts",
"default": "./dist/data/sqlite-core/index.cjs"
}
},
"./data/sqljs": {
"import": {
"types": "./dist/data/sqljs/index.d.ts",
"default": "./dist/data/sqljs/index.js"
},
"require": {
"types": "./dist/data/sqljs/index.d.cts",
"default": "./dist/data/sqljs/index.cjs"
}
},
"./ui": {
"import": {
"types": "./dist/ui/index.d.ts",
"default": "./dist/ui/index.js"
},
"require": {
"types": "./dist/ui/index.d.cts",
"default": "./dist/ui/index.cjs"
}
},
"./ui/index.css": "./dist/ui/index.css"
},
"keywords": [],
"author": {
"name": "Igal Klebanov",
"url": "https://github.com/igalklebanov",
"email": "igalklebanov@gmail.com"
},
"contributors": [
{
"name": "Igal Klebanov",
"url": "https://github.com/igalklebanov",
"email": "igalklebanov@gmail.com"
},
{
"name": "Pierre-Antoine Mills",
"url": "https://github.com/millsp"
},
{
"name": "Matt Litherland",
"url": "https://github.com/uixmat"
}
],
"license": "Apache-2.0",
"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@codemirror/autocomplete": "6.20.1",
"@codemirror/lang-sql": "6.10.0",
"@codemirror/lint": "6.9.5",
"@codemirror/state": "6.5.4",
"@codemirror/view": "6.39.16",
"@dnd-kit/core": "6.3.1",
"@dnd-kit/sortable": "10.0.0",
"@dnd-kit/utilities": "3.2.2",
"@electric-sql/pglite": "0.3.15",
"@eslint/eslintrc": "2.1.4",
"@eslint/js": "8.57.0",
"@prisma/dev": "0.20.0",
"@radix-ui/react-alert-dialog": "1.1.15",
"@radix-ui/react-checkbox": "1.3.3",
"@radix-ui/react-context-menu": "2.2.16",
"@radix-ui/react-dialog": "1.1.15",
"@radix-ui/react-dropdown-menu": "2.1.16",
"@radix-ui/react-label": "2.1.8",
"@radix-ui/react-popover": "1.1.15",
"@radix-ui/react-select": "2.2.6",
"@radix-ui/react-slot": "1.2.4",
"@radix-ui/react-switch": "1.2.6",
"@radix-ui/react-toggle-group": "1.1.11",
"@radix-ui/react-tooltip": "1.2.8",
"@tailwindcss/postcss": "4.1.18",
"@tanstack/db": "0.5.30",
"@tanstack/query-db-collection": "1.0.27",
"@tanstack/react-db": "0.1.74",
"@tanstack/react-query": "5.90.19",
"@tanstack/react-query-devtools": "5.91.2",
"@tanstack/react-table": "8.21.3",
"@tanstack/react-table-devtools": "8.21.3",
"@types/eslint-config-prettier": "6.11.3",
"@types/eslint__js": "8.42.3",
"@types/node": "25.0.9",
"@types/react-dom": "^19.2.3",
"@types/sql.js": "^1.4.9",
"@uiw/react-codemirror": "4.25.7",
"class-variance-authority": "0.7.1",
"clsx": "2.1.1",
"cmdk": "1.1.1",
"dayjs": "1.11.19",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-unicorn": "55.0.0",
"eslint-plugin-vitest": "0.5.4",
"globals": "15.9.0",
"happy-dom": "20.7.0",
"kysely": "0.28.10",
"lucide-react": "0.562.0",
"motion": "12.27.1",
"motion-plus": "0.1.6",
"mysql2": "^3.16.1",
"nuqs": "2.8.6",
"pathe": "2.0.3",
"postcss": "8.5.6",
"postcss-nested": "7.0.2",
"postcss-prefix-selector": "2.1.1",
"postcss-value-parser": "4.2.0",
"postgres": "3.4.8",
"react-day-picker": "9.13.0",
"reactflow": "11.11.4",
"remeda": "2.33.4",
"short-uuid": "6.0.3",
"sonner": "2.0.7",
"std-env": "3.10.0",
"tailwind-merge": "3.4.0",
"tailwindcss": "4.1.18",
"tsup": "8.5.1",
"tw-animate-css": "1.4.0",
"typescript": "5.9.3",
"typescript-eslint": "8.1.0",
"uuidv7": "1.1.0",
"vitest": "4.0.17",
"vitest-canvas-mock": "1.1.3"
},
"files": [
"dist",
"NOTICE"
],
"peerDependencies": {
"@types/react": "^18.0.0 || ^19.0.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": "^20.19 || ^22.12 || >=24.0",
"pnpm": "8"
},
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81",
"dependencies": {
"@radix-ui/react-toggle": "1.1.10",
"chart.js": "4.5.1"
},
"scripts": {
"build": "NODE_OPTIONS=--max-old-space-size=8192 tsup",
"check:exports": "attw --pack . --profile node16 --exclude-entrypoints ui/index.css",
"dev": "NODE_OPTIONS=--max-old-space-size=8192 tsup --watch",
"demo:ppg": "bun demo/ppg-dev/server.ts",
"demo:ppg:build": "bun build demo/ppg-dev/server.ts --target bun --packages external --outfile demo/ppg-dev/server.bundle.js",
"demo:ppg:bundle": "pnpm demo:ppg:build && bun demo/ppg-dev/server.bundle.js",
"lint": "eslint --fix --cache --cache-location ./node_modules/.cache/eslint .",
"test": "vitest --passWithNoTests",
"test:checkpoint": "vitest --project checkpoint",
"test:data": "vitest --project data",
"test:demo": "vitest --project demo",
"test:e2e": "vitest --passWithNoTests --project e2e",
"test:ui": "vitest --passWithNoTests --project ui",
"typecheck": "tsc --noEmit"
}
}