adelsz / pgtyped

pgTyped - Typesafe SQL in TypeScript
https://pgtyped.dev
MIT License
2.91k stars 94 forks source link

feat!: Allow non-optional generation of params with optionalNullParams #582

Open pnappa opened 2 months ago

pnappa commented 2 months ago

This feature allows specifying whether nullable params should be generated as optional via the config.

The default behaviour stays the same, so this feature is backwards compatible.

Addresses https://github.com/adelsz/pgtyped/issues/556

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pgtyped ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 0:41am
pnappa commented 2 months ago

Note: I wasn't able to run the tests locally for some reason - npm install && npm run test failed with:

@pgtyped/runtime: > @pgtyped/runtime@2.3.0 test
@pgtyped/runtime: > NODE_OPTIONS='--experimental-vm-modules' jest
@pgtyped/runtime:  FAIL  src/preprocessor-ts.test.ts
@pgtyped/runtime:   ● Test suite failed to run
@pgtyped/runtime:     src/preprocessor-ts.test.ts:1:30 - error TS2307: Cannot find module '@pgtyped/parser' or its corresponding type declarations.
@pgtyped/runtime:     1 import { parseTSQuery } from '@pgtyped/parser';
@pgtyped/runtime:                                    ~~~~~~~~~~~~~~~~~
@pgtyped/runtime:  FAIL  src/preprocessor-sql.test.ts
@pgtyped/runtime:   ● Test suite failed to run
@pgtyped/runtime:     src/preprocessor-sql.test.ts:1:61 - error TS2307: Cannot find module '@pgtyped/parser' or its corresponding type declarations.
@pgtyped/runtime:     1 import { queryASTToIR, parseSQLFile as parseSQLQuery } from '@pgtyped/parser';
@pgtyped/runtime:                                                                   ~~~~~~~~~~~~~~~~~
@pgtyped/runtime: Test Suites: 2 failed, 2 total
@pgtyped/runtime: Tests:       0 total
@pgtyped/runtime: Snapshots:   0 total
@pgtyped/runtime: Time:        0.963 s
@pgtyped/runtime: Ran all test suites.
@pgtyped/runtime: npm ERR! Lifecycle script `test` failed with error:
@pgtyped/runtime: npm ERR! Error: command failed
@pgtyped/runtime: npm ERR!   in workspace: @pgtyped/runtime@2.3.0
@pgtyped/runtime: npm ERR!   at location: /Users/pnappa/github.com/pnappa/pgtyped/packages/runtime

Any ideas?

pnappa commented 1 week ago

Hi @adelsz - is there any chance of getting this merged into mainline? Is there anything you'd like me to do?

Cheers!