@kuindji/sql-type-parser
Advanced tools
+1
-1
| { | ||
| "name": "@kuindji/sql-type-parser", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "Type-level SQL SELECT parser for TypeScript", | ||
@@ -5,0 +5,0 @@ "author": "Ivan Kuindzhi", |
| /** | ||
| * Examples Index | ||
| * | ||
| * Re-exports all example types for easy importing | ||
| */ | ||
| export type { ECommerceSchema, BlogSchema, JsonSchema, CamelCaseSchema, UUID, Timestamp, JSONObject, } from "./schema.js"; | ||
| export type { TestsPass } from "./tests.js"; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,IAAI,EACJ,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAA;AAGpB,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"} |
| /** | ||
| * Examples Index | ||
| * | ||
| * Re-exports all example types for easy importing | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"} |
| /** | ||
| * Matcher Examples | ||
| * | ||
| * Comprehensive examples demonstrating schema matching and type inference. | ||
| * Shows how parsed SQL queries are matched against database schemas to | ||
| * produce result types. | ||
| */ | ||
| import type { QueryResult } from "../matcher.js"; | ||
| import type { BlogSchema, ECommerceSchema } from "./schema.js"; | ||
| /** Select all columns with * */ | ||
| type SelectAllUsers = QueryResult<"SELECT * FROM users", BlogSchema>; | ||
| /** Select specific columns */ | ||
| type SelectSpecificColumns = QueryResult<"SELECT id, name, email FROM users", BlogSchema>; | ||
| /** Columns with aliases */ | ||
| type ColumnsWithAliases = QueryResult<"SELECT id AS user_id, name AS display_name FROM users", BlogSchema>; | ||
| /** INNER JOIN - columns from both tables */ | ||
| type InnerJoinResult = QueryResult<"SELECT u.name, p.title FROM users AS u INNER JOIN posts AS p ON u.id = p.author_id", BlogSchema>; | ||
| /** COUNT returns number */ | ||
| type CountResult = QueryResult<"SELECT COUNT ( * ) AS total FROM users", BlogSchema>; | ||
| /** Simple CTE */ | ||
| type SimpleCTE = QueryResult<` | ||
| WITH active_users AS ( | ||
| SELECT id, name FROM users WHERE is_active = TRUE | ||
| ) | ||
| SELECT * FROM active_users | ||
| `, BlogSchema>; | ||
| /** Order with customer info */ | ||
| type OrderWithCustomer = QueryResult<` | ||
| SELECT | ||
| o.order_number, | ||
| o.total_amount, | ||
| u.email AS customer_email, | ||
| u.first_name, | ||
| u.last_name | ||
| FROM orders AS o | ||
| INNER JOIN users AS u ON o.user_id = u.id | ||
| `, ECommerceSchema>; | ||
| /** Customer order history */ | ||
| type CustomerOrderHistory = QueryResult<` | ||
| WITH customer_orders AS ( | ||
| SELECT | ||
| user_id, | ||
| COUNT ( * ) AS total_orders, | ||
| SUM ( total_amount ) AS lifetime_value, | ||
| MAX ( created_at ) AS last_order_date | ||
| FROM orders | ||
| WHERE status != 'cancelled' | ||
| GROUP BY user_id | ||
| ) | ||
| SELECT | ||
| u.email, | ||
| u.first_name, | ||
| u.last_name, | ||
| u.status AS account_status, | ||
| co.total_orders, | ||
| co.lifetime_value, | ||
| co.last_order_date | ||
| FROM users AS u | ||
| LEFT JOIN customer_orders AS co ON u.id = co.user_id | ||
| WHERE u.role = 'customer' | ||
| ORDER BY co.lifetime_value DESC | ||
| LIMIT 100 | ||
| `, ECommerceSchema>; | ||
| export type { SelectAllUsers, SelectSpecificColumns, ColumnsWithAliases, InnerJoinResult, CountResult, SimpleCTE, OrderWithCustomer, CustomerOrderHistory, }; | ||
| //# sourceMappingURL=matcher-examples.d.ts.map |
| {"version":3,"file":"matcher-examples.d.ts","sourceRoot":"","sources":["../../src/examples/matcher-examples.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,eAAe,CAAA;AAErG,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAc,MAAM,aAAa,CAAA;AAM1E,gCAAgC;AAChC,KAAK,cAAc,GAAG,WAAW,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAA;AAGpE,8BAA8B;AAC9B,KAAK,qBAAqB,GAAG,WAAW,CAAC,mCAAmC,EAAE,UAAU,CAAC,CAAA;AAWzF,2BAA2B;AAC3B,KAAK,kBAAkB,GAAG,WAAW,CACnC,uDAAuD,EACvD,UAAU,CACX,CAAA;AAkDD,4CAA4C;AAC5C,KAAK,eAAe,GAAG,WAAW,CAChC,oFAAoF,EACpF,UAAU,CACX,CAAA;AAuBD,2BAA2B;AAC3B,KAAK,WAAW,GAAG,WAAW,CAC5B,wCAAwC,EACxC,UAAU,CACX,CAAA;AAgID,iBAAiB;AACjB,KAAK,SAAS,GAAG,WAAW,CAAC;;;;;CAK5B,EAAE,UAAU,CAAC,CAAA;AA8Dd,+BAA+B;AAC/B,KAAK,iBAAiB,GAAG,WAAW,CAAC;;;;;;;;;CASpC,EAAE,eAAe,CAAC,CAAA;AAgGnB,6BAA6B;AAC7B,KAAK,oBAAoB,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAwBvC,EAAE,eAAe,CAAC,CAAA;AAmMnB,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,oBAAoB,GACrB,CAAA"} |
| /** | ||
| * Matcher Examples | ||
| * | ||
| * Comprehensive examples demonstrating schema matching and type inference. | ||
| * Shows how parsed SQL queries are matched against database schemas to | ||
| * produce result types. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=matcher-examples.js.map |
| {"version":3,"file":"matcher-examples.js","sourceRoot":"","sources":["../../src/examples/matcher-examples.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Parser Examples | ||
| * | ||
| * Comprehensive examples demonstrating all features supported by the SQL parser. | ||
| * Each example shows the SQL query and the expected AST type. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=parser-examples.d.ts.map |
| {"version":3,"file":"parser-examples.d.ts","sourceRoot":"","sources":["../../src/examples/parser-examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} |
| /** | ||
| * Parser Examples | ||
| * | ||
| * Comprehensive examples demonstrating all features supported by the SQL parser. | ||
| * Each example shows the SQL query and the expected AST type. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=parser-examples.js.map |
| {"version":3,"file":"parser-examples.js","sourceRoot":"","sources":["../../src/examples/parser-examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} |
| /** | ||
| * Example Database Schema | ||
| * | ||
| * Comprehensive schema covering various data types, relationships, | ||
| * and use cases for demonstrating the type-parser capabilities. | ||
| */ | ||
| /** UUID type alias */ | ||
| type UUID = string; | ||
| /** Timestamp type alias */ | ||
| type Timestamp = string; | ||
| /** JSON object type */ | ||
| type JSONObject = Record<string, unknown>; | ||
| /** | ||
| * E-commerce database schema with users, products, orders, etc. | ||
| */ | ||
| export type ECommerceSchema = { | ||
| tables: { | ||
| /** User accounts */ | ||
| users: { | ||
| id: number; | ||
| uuid: UUID; | ||
| email: string; | ||
| username: string; | ||
| password_hash: string; | ||
| first_name: string | null; | ||
| last_name: string | null; | ||
| role: "admin" | "moderator" | "customer"; | ||
| status: "active" | "suspended" | "deleted"; | ||
| created_at: Timestamp; | ||
| updated_at: Timestamp; | ||
| last_login_at: Timestamp | null; | ||
| email_verified: boolean; | ||
| preferences: JSONObject | null; | ||
| }; | ||
| /** User profile information */ | ||
| user_profiles: { | ||
| id: number; | ||
| user_id: number; | ||
| avatar_url: string | null; | ||
| bio: string | null; | ||
| phone: string | null; | ||
| birth_date: string | null; | ||
| country: string | null; | ||
| city: string | null; | ||
| timezone: string; | ||
| }; | ||
| /** User addresses */ | ||
| addresses: { | ||
| id: number; | ||
| user_id: number; | ||
| type: "billing" | "shipping"; | ||
| is_default: boolean; | ||
| line1: string; | ||
| line2: string | null; | ||
| city: string; | ||
| state: string | null; | ||
| postal_code: string; | ||
| country: string; | ||
| created_at: Timestamp; | ||
| }; | ||
| /** Product categories (hierarchical) */ | ||
| categories: { | ||
| id: number; | ||
| parent_id: number | null; | ||
| name: string; | ||
| slug: string; | ||
| description: string | null; | ||
| image_url: string | null; | ||
| sort_order: number; | ||
| is_active: boolean; | ||
| }; | ||
| /** Products */ | ||
| products: { | ||
| id: number; | ||
| sku: string; | ||
| name: string; | ||
| slug: string; | ||
| description: string | null; | ||
| short_description: string | null; | ||
| price: number; | ||
| compare_at_price: number | null; | ||
| cost_price: number | null; | ||
| category_id: number; | ||
| brand_id: number | null; | ||
| status: "draft" | "active" | "archived"; | ||
| is_featured: boolean; | ||
| weight: number | null; | ||
| dimensions: JSONObject | null; | ||
| attributes: JSONObject | null; | ||
| metadata: JSONObject | null; | ||
| created_at: Timestamp; | ||
| updated_at: Timestamp; | ||
| published_at: Timestamp | null; | ||
| }; | ||
| /** Product brands */ | ||
| brands: { | ||
| id: number; | ||
| name: string; | ||
| slug: string; | ||
| logo_url: string | null; | ||
| website: string | null; | ||
| description: string | null; | ||
| is_active: boolean; | ||
| }; | ||
| /** Product images */ | ||
| product_images: { | ||
| id: number; | ||
| product_id: number; | ||
| url: string; | ||
| alt_text: string | null; | ||
| sort_order: number; | ||
| is_primary: boolean; | ||
| }; | ||
| /** Product inventory */ | ||
| inventory: { | ||
| id: number; | ||
| product_id: number; | ||
| warehouse_id: number; | ||
| quantity: number; | ||
| reserved_quantity: number; | ||
| reorder_level: number | null; | ||
| last_counted_at: Timestamp | null; | ||
| }; | ||
| /** Warehouses */ | ||
| warehouses: { | ||
| id: number; | ||
| name: string; | ||
| code: string; | ||
| address_line1: string; | ||
| city: string; | ||
| country: string; | ||
| is_active: boolean; | ||
| }; | ||
| /** Product tags (many-to-many junction) */ | ||
| product_tags: { | ||
| product_id: number; | ||
| tag_id: number; | ||
| }; | ||
| /** Tags */ | ||
| tags: { | ||
| id: number; | ||
| name: string; | ||
| slug: string; | ||
| }; | ||
| /** Orders */ | ||
| orders: { | ||
| id: number; | ||
| order_number: string; | ||
| user_id: number; | ||
| status: "pending" | "processing" | "shipped" | "delivered" | "cancelled" | "refunded"; | ||
| payment_status: "pending" | "paid" | "failed" | "refunded"; | ||
| subtotal: number; | ||
| tax_amount: number; | ||
| shipping_amount: number; | ||
| discount_amount: number; | ||
| total_amount: number; | ||
| currency: string; | ||
| shipping_address_id: number; | ||
| billing_address_id: number; | ||
| notes: string | null; | ||
| created_at: Timestamp; | ||
| updated_at: Timestamp; | ||
| shipped_at: Timestamp | null; | ||
| delivered_at: Timestamp | null; | ||
| }; | ||
| /** Order line items */ | ||
| order_items: { | ||
| id: number; | ||
| order_id: number; | ||
| product_id: number; | ||
| quantity: number; | ||
| unit_price: number; | ||
| total_price: number; | ||
| discount_amount: number; | ||
| }; | ||
| /** Payments */ | ||
| payments: { | ||
| id: number; | ||
| order_id: number; | ||
| amount: number; | ||
| currency: string; | ||
| method: "credit_card" | "paypal" | "bank_transfer" | "crypto"; | ||
| status: "pending" | "completed" | "failed" | "refunded"; | ||
| provider_transaction_id: string | null; | ||
| metadata: JSONObject | null; | ||
| created_at: Timestamp; | ||
| }; | ||
| /** Product reviews */ | ||
| reviews: { | ||
| id: number; | ||
| product_id: number; | ||
| user_id: number; | ||
| rating: number; | ||
| title: string | null; | ||
| content: string | null; | ||
| is_verified_purchase: boolean; | ||
| is_approved: boolean; | ||
| helpful_count: number; | ||
| created_at: Timestamp; | ||
| updated_at: Timestamp; | ||
| }; | ||
| /** Shopping cart items */ | ||
| cart_items: { | ||
| id: number; | ||
| user_id: number; | ||
| product_id: number; | ||
| quantity: number; | ||
| added_at: Timestamp; | ||
| }; | ||
| /** Wishlist items */ | ||
| wishlist_items: { | ||
| id: number; | ||
| user_id: number; | ||
| product_id: number; | ||
| added_at: Timestamp; | ||
| }; | ||
| /** Discount coupons */ | ||
| coupons: { | ||
| id: number; | ||
| code: string; | ||
| type: "percentage" | "fixed" | "free_shipping"; | ||
| value: number; | ||
| min_purchase: number | null; | ||
| max_uses: number | null; | ||
| used_count: number; | ||
| starts_at: Timestamp; | ||
| expires_at: Timestamp | null; | ||
| is_active: boolean; | ||
| }; | ||
| /** Audit logs */ | ||
| audit_logs: { | ||
| id: number; | ||
| user_id: number | null; | ||
| action: string; | ||
| entity_type: string; | ||
| entity_id: number; | ||
| old_values: JSONObject | null; | ||
| new_values: JSONObject | null; | ||
| ip_address: string | null; | ||
| user_agent: string | null; | ||
| created_at: Timestamp; | ||
| }; | ||
| }; | ||
| }; | ||
| /** | ||
| * Simple blog schema for basic examples | ||
| */ | ||
| export type BlogSchema = { | ||
| tables: { | ||
| users: { | ||
| id: number; | ||
| name: string; | ||
| email: string; | ||
| role: "admin" | "author" | "reader"; | ||
| is_active: boolean; | ||
| created_at: string; | ||
| }; | ||
| posts: { | ||
| id: number; | ||
| author_id: number; | ||
| title: string; | ||
| slug: string; | ||
| content: string; | ||
| status: "draft" | "published" | "archived"; | ||
| views: number; | ||
| created_at: string; | ||
| published_at: string | null; | ||
| }; | ||
| comments: { | ||
| id: number; | ||
| post_id: number; | ||
| user_id: number; | ||
| content: string; | ||
| is_approved: boolean; | ||
| created_at: string; | ||
| }; | ||
| categories: { | ||
| id: number; | ||
| name: string; | ||
| parent_id: number | null; | ||
| }; | ||
| post_categories: { | ||
| post_id: number; | ||
| category_id: number; | ||
| }; | ||
| }; | ||
| }; | ||
| /** | ||
| * Schema with JSON/JSONB columns for testing complex expressions | ||
| */ | ||
| export type JsonSchema = { | ||
| tables: { | ||
| documents: { | ||
| id: number; | ||
| data: JSONObject; | ||
| metadata: JSONObject | null; | ||
| tags: string[]; | ||
| created_at: string; | ||
| }; | ||
| events: { | ||
| id: number; | ||
| type: string; | ||
| payload: JSONObject; | ||
| context: JSONObject | null; | ||
| occurred_at: string; | ||
| }; | ||
| settings: { | ||
| id: number; | ||
| user_id: number; | ||
| preferences: JSONObject; | ||
| notifications: JSONObject; | ||
| }; | ||
| }; | ||
| }; | ||
| /** | ||
| * Schema with camelCased and Mixed_Case column/table names | ||
| * Tests identifier case preservation | ||
| */ | ||
| export type CamelCaseSchema = { | ||
| tables: { | ||
| userAccounts: { | ||
| id: number; | ||
| firstName: string; | ||
| lastName: string; | ||
| emailAddress: string; | ||
| phoneNumber: string | null; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| isActive: boolean; | ||
| Account_Status: "active" | "suspended" | "deleted"; | ||
| Last_Login_Date: string | null; | ||
| }; | ||
| OrderItems: { | ||
| id: number; | ||
| orderId: number; | ||
| productId: number; | ||
| unitPrice: number; | ||
| totalPrice: number; | ||
| discountAmount: number; | ||
| Item_Status: "pending" | "shipped" | "delivered"; | ||
| Created_At: string; | ||
| }; | ||
| Product_Categories: { | ||
| id: number; | ||
| categoryName: string; | ||
| parentId: number | null; | ||
| sortOrder: number; | ||
| Is_Active: boolean; | ||
| Display_Name: string; | ||
| }; | ||
| "user-sessions": { | ||
| id: number; | ||
| userId: number; | ||
| sessionToken: string; | ||
| expiresAt: string; | ||
| "ip-address": string; | ||
| "user-agent": string | null; | ||
| }; | ||
| "audit_logs": { | ||
| id: number; | ||
| "user_id": number | null; | ||
| action: string; | ||
| "entity_type": string; | ||
| "created_at": string; | ||
| }; | ||
| }; | ||
| }; | ||
| export type { UUID, Timestamp, JSONObject }; | ||
| //# sourceMappingURL=schema.d.ts.map |
| {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/examples/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,sBAAsB;AACtB,KAAK,IAAI,GAAG,MAAM,CAAA;AAElB,2BAA2B;AAC3B,KAAK,SAAS,GAAG,MAAM,CAAA;AAEvB,uBAAuB;AACvB,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAMzC;;GAEG;AACH,MAAM,MA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;AASD,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA"} |
| /** | ||
| * Example Database Schema | ||
| * | ||
| * Comprehensive schema covering various data types, relationships, | ||
| * and use cases for demonstrating the type-parser capabilities. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=schema.js.map |
| {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/examples/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} |
| /** | ||
| * Type-Level Tests | ||
| * | ||
| * Type assertions that verify the parser and matcher work correctly. | ||
| * These tests run at compile time - if they compile without errors, | ||
| * all tests pass. | ||
| */ | ||
| /** | ||
| * If this file compiles without errors, all tests pass! | ||
| * | ||
| * Test coverage: | ||
| * - Parser: SELECT, FROM, WHERE, JOIN, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET, DISTINCT, CTEs | ||
| * - Matcher: Column resolution, type inference, union types, nullable types, aggregates, errors | ||
| * - Validation: ValidateSQL for compile-time query checking | ||
| * - camelCase: camelCased and Mixed_Case table/column names | ||
| * - Quoted: Quoted identifiers with spaces and special characters | ||
| */ | ||
| export type TestsPass = true; | ||
| //# sourceMappingURL=tests.d.ts.map |
| {"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/examples/tests.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0kBH;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAAA"} |
| /** | ||
| * Type-Level Tests | ||
| * | ||
| * Type assertions that verify the parser and matcher work correctly. | ||
| * These tests run at compile time - if they compile without errors, | ||
| * all tests pass. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=tests.js.map |
| {"version":3,"file":"tests.js","sourceRoot":"","sources":["../../src/examples/tests.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
218502
-10.79%35
-36.36%1947
-20.43%