@prisma-next/sql-lane 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @prisma-next/sql-lane
2
+
3
+ Relational DSL and raw SQL helpers for Prisma Next.
4
+
5
+ ## Overview
6
+
7
+ This package provides the relational query DSL and raw SQL helpers for building SQL queries. It is part of the SQL lanes ring and depends on `@prisma-next/sql-relational-core` for schema and column builders.
8
+
9
+ ## Responsibilities
10
+
11
+ - **Relational DSL**: Fluent query builder for SELECT, INSERT, UPDATE, DELETE queries
12
+ - **Raw SQL helpers**: Template literal and function-based raw SQL query builders
13
+ - **Query building**: AST construction and plan generation for SQL queries
14
+ - **Join support**: Inner, left, right, and full joins
15
+ - **Include support**: `includeMany` for nested queries using lateral joins and JSON aggregation
16
+
17
+ ## Dependencies
18
+
19
+ - `@prisma-next/contract` - Contract types and plan metadata
20
+ - `@prisma-next/plan` - Plan helpers and error utilities
21
+ - `@prisma-next/sql-relational-core` - Schema and column builders, AST factories
22
+ - `@prisma-next/sql-target` - SQL contract types and AST definitions
23
+
24
+ ## Exports
25
+
26
+ - `.` - Main package export (exports `sql`, `SelectBuilder`, `rawOptions`, and types)
27
+ - `./sql` - Relational DSL entry point (`sql()`, `SelectBuilder`, `InsertBuilder`, `UpdateBuilder`, `DeleteBuilder`)
28
+
29
+ ## Architecture
30
+
31
+ This package compiles relational DSL queries to SQL AST nodes using factories from `@prisma-next/sql-relational-core/ast`. Dialect-specific lowering to SQL strings happens in adapters (per ADR 015 and ADR 016).
32
+
33
+ ### Module Structure
34
+
35
+ The package is organized into focused modules:
36
+
37
+ - **`sql/`** - Core builder modules:
38
+ - `builder.ts` - Thin public facade (main entry point)
39
+ - `select-builder.ts` - SelectBuilderImpl class
40
+ - `mutation-builder.ts` - Insert/Update/Delete builders
41
+ - `include-builder.ts` - IncludeMany child builder and AST building
42
+ - `join-builder.ts` - Join DSL logic
43
+ - `predicate-builder.ts` - Where clause building
44
+ - `projection.ts` - Projection building logic
45
+ - `plan.ts` - Plan assembly and meta building
46
+ - `context.ts` - Context wiring logic
47
+ - **`utils/`** - Shared utilities:
48
+ - `errors.ts` - Centralized error constructors
49
+ - `capabilities.ts` - Capability checking logic
50
+ - `guards.ts` - Type guards and column info helpers
51
+ - `state.ts` - Immutable builder state types
52
+ - **`types/`** - Type definitions:
53
+ - `internal.ts` - Internal helper types
54
+ - `public.ts` - Public type re-exports
55
+
56
+ All AST construction flows through factories from `@prisma-next/sql-relational-core/ast`, ensuring consistency and reducing duplication.
57
+
58
+ ## Related Packages
59
+
60
+ - `@prisma-next/sql-relational-core` - Provides schema and column builders, AST factories used by this package
61
+ - `@prisma-next/sql-orm-lane` - ORM builder that compiles to this package's DSL primitives
62
+ - `@prisma-next/sql-target` - Defines SQL contract types and AST structures