Feat/implementation phase 1#67
Open
codewizdave wants to merge 20 commits into
Open
Conversation
- Add @deessejs/fp integration with Result, Maybe, Try, and error() patterns - Refactor CRUD operations to return Result/Maybe instead of throwing - Add structured errors (RecordNotFoundError, InsertFailedError) - Add PostgreSQL and SQLite schema builders (createPostgresSchema, createSqliteSchema) - Add full CRUD operations (create, findOne, findMany, update, remove, count, exists) - Add collection validators using Result<Unit, Error> pattern - Update CLAUDE.md with @deessejs/fp integration guidelines - Add examples (basic-blog, blog-with-relations, all-field-types, etc.) Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
- Add $push() method to createCollections() to allow pushing schema changes and creating tables before running CRUD operations - Fix SQLite UUID column not having $defaultFn for auto-generated IDs (NOT NULL constraint failed: posts.id) - Fix predicate SQL conversion in dbAccess (RangeError: Too few parameter values) - Update examples to call db.$push() before CRUD operations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The issue was that drizzleDb.execute(sql`${stmt}`) treated the SQL statement
as a parameter ($1) instead of executing it directly. Using rawDb.query()
passes the SQL string directly to PostgreSQL.
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
BREAKING CHANGE: postgres() now only accepts connection strings, not Pool instances
Changes:
- postgres(connectionString) creates Pool internally with default settings
- Added PostgresOptions interface for pool configuration (max, idleTimeoutMillis)
- Removed db.$push() - schema push is now CLI only via npx @deessejs/collections push
- Removed PushContext and related code
- Updated postgres-demo example to use new simplified API
- Updated to use DATABASE_URL env var (industry standard)
Before:
const pool = new Pool({ connectionString: process.env.POSTGRES_URL })
createCollections({ db: postgres(pool), collections })
After:
createCollections({ db: postgres(process.env.DATABASE_URL!), collections })
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Fixes: - SQLite: detect Database instance vs file path for :memory: support - MySQL: detect Pool instance vs connection string - postgres-demo: works correctly with Neon, incremental IDs Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Added: - reports/dx-improvement/createCollections-simplification.md - reports/payload/database/columns/columns-and-types.md - reports/payload/database/migrations/migrations-system.md Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Removed: - examples/all-field-types.ts - examples/basic-blog.ts - examples/blog-with-relations.ts - examples/error-cases.ts - examples/features/hooks/* - examples/features/pagination/* - examples/indexes-constraints.ts - examples/postgresql-vs-sqlite.ts - examples/snippets/02-field-types.ts through 04-order-by.ts - examples/snippets/08-hooks-basic.ts through validation-hooks.ts - examples/validation-hooks.ts Updated (to new API): - examples/snippets/01-basic-collection.ts - examples/snippets/05-select.ts - examples/snippets/10-relations.ts - examples/snippets/11-auth-setup.ts - examples/apps/todos-basic/* Added (new demos): - examples/apps/postgres-demo/ (PostgreSQL with Neon) - examples/apps/mysql-demo/ (MySQL) - examples/lib/ (shared db utilities) Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
…ration Phase 1 - Core Type Inference: - Update createDbAccess to accept TCollections instead of RawTable - Add explicit casts using GetCollectionType<T> for proper type inference - DbAccess<TCollections> now properly typed through createCollections() Phase 2 - CLI Type Generation: - Add generate:types command for generating collections-types.ts - Supports --config and --output options - Generates TypeScript interfaces from collection config Type safety now works: - db.users.create() validates input types - db.users.findMany() returns properly typed records - generate:types outputs explicit interfaces for external packages Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Inline tests (in source files): - InferCreateType, InferUpdateType in operations/database/types.ts - GetCollectionType in collections/types.ts - InferFieldType in collections/hooks/types.ts Tests/types/ directory structure: - infer-field-types.test.ts - InferFieldTypes tests - infer-create-type.test.ts - InferCreateType tests - get-collection-type.test.ts - GetCollectionType tests - db-access-types.test.ts - DbAccess type construction - field-requirement.test.ts - required vs optional handling - select-field-types.test.ts - select field union types - index.test.ts - entry point - README.md - documentation Also fix ZodEnum type assertion in generate-types.ts. Uses @deessejs/type-testing with check<Equal<>> pattern. Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
After tsx --eval + JSON.stringify, Zod schemas become plain objects with def instead of _def (underscore prefix lost). Also handle double-default wrapping from config serialization. Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
- Add next-basic example showing collections integration with Next.js App Router - Include users and posts collections with full CRUD API routes - Add interactive CreateUserForm and CreatePostForm components - Add DeleteButton component with confirmation - Update main page to display and manage collections data - Configure PostgreSQL connection via .env - Add collection.config.ts for CLI schema management Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
8c89773 to
46e4c9c
Compare
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
- Add init, push, and generate CLI commands - Add MySQL adapter with buildDrizzleTable and createMysqlSchema - Add runtime module with createCollections factory - Add sqlBuilder for database operations - Add comprehensive tests for new modules Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
- Move public docs to docs/internal for internal reference - Add DEP (Design Enhancement Proposal) documents for architectural decisions - Add implementation reports for adapter system and DX improvements - Add deesse-fp skill for functional programming patterns - Add commit and push skills for CI workflow - Add skills-lock.json for skill version management Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
|
Deployment failed with the following error: Learn More: https://vercel.com/aliiibenns-projects?upgradeToPro=build-rate-limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.