Vincit / Vincit/objection.js

A few Typescript and Knex issues

Open
#2,189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

typings
Dominant language
JavaScript
Stars
7.3k
Forks
637
PR merge metrics
No merged PRs in 30d

Description

Here are some misc things that I think could be changed. I've never written an open source PR before, I think it's easier if an existing contributor changed it:

  1. Knex supports objects for joins and aggregates. It's especially useful for multi-column joins:
.join(
  'foo',
  {
    'foo.col1': 'bar.col1',
    'foo.col2': 'bar.col2',
  },
)

Something like this ((table: TableRef<QB>, columns: Record<string, ColumnRef>): QB;) could be added to JoinMethod.

  1. Knex's limit now supports an additional param "skipBinding" (https://github.com/knex/knex/issues/4805). Objection's FirstOperation calls limit without skipBinding, which triggers an error in some databases (Materialize).

  2. Objection's type exports UniqueViolationError, but this actually needs to be imported from db-errors.

  3. Objection's Model type doesn't include "propertyNameToColumnName".

  4. (not a real issue) addOperation and KnexOperation aren't documented or exposed through types, but they're useful for new or custom Knex operations.

Thanks for building and maintaining this awesome library!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the type definitions for JoinMethod and Model, the FirstOperation implementation, and the exports for UniqueViolationError, addOperation, and KnexOperation. Compare each requested change with the referenced Knex behavior and existing Objection types, then verify that the affected exports and type signatures cover all five listed cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.