Giter Site home page Giter Site logo

tony133 / nestjs-knexjs Goto Github PK

View Code? Open in Web Editor NEW
79.0 4.0 8.0 4.24 MB

Knexjs module for Nest framework (node.js) ๐Ÿ˜ป

License: MIT License

JavaScript 11.84% TypeScript 87.79% Shell 0.38%
nodejs javascript typescript nestjs knexjs nest nestjs-knexjs knex mysql postgresql

nestjs-knexjs's Introduction

Hi there ๐Ÿ‘‹

nestjs-knexjs's People

Contributors

dependabot[bot] avatar phuvo avatar renovate-bot avatar renovate[bot] avatar sergeyampo avatar tony133 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nestjs-knexjs's Issues

TypeError: Cannot read properties of undefined

When an application loses its connection to the database, the application crashes with the error
TypeError: Cannot read properties of undefined (reading '__knexUid')
Fix \knex\lib\client.js:344:58 connection.__knexUid to connection?.__knexUid

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/nodejs-environment.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/setup-node v4
npm
package.json
  • @commitlint/cli 19.2.2
  • @commitlint/config-angular 19.2.2
  • @nestjs/common 10.3.8
  • @nestjs/core 10.3.8
  • @nestjs/platform-fastify ^10.3.7
  • @nestjs/testing 10.3.8
  • @types/jest 29.5.12
  • @types/node 20.12.7
  • @types/supertest 6.0.2
  • @typescript-eslint/eslint-plugin 7.7.0
  • @typescript-eslint/parser 7.7.0
  • eslint 8.57.0
  • eslint-config-prettier 9.1.0
  • eslint-plugin-import 2.29.1
  • husky 9.0.11
  • jest 29.7.0
  • knex 3.1.0
  • mysql 2.18.1
  • prettier 3.2.5
  • reflect-metadata 0.2.2
  • release-it 17.2.0
  • rxjs 7.8.1
  • supertest 6.3.4
  • ts-jest 29.1.2
  • ts-node 10.9.2
  • tsconfig-paths 4.2.0
  • typescript 5.4.5
  • @nestjs/common ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0
  • @nestjs/core ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0
  • knex ^0.21.17 || ^0.95.0 || ^1.0.0 || ^2.0.0 || ^3.0.0
  • reflect-metadata ^0.1.13 || ^0.2.0
  • rxjs ^6.6.3 || ^7.2.0

  • Check this box to trigger a request for Renovate to run again on this repository

Centralized KnexJS configuration

Is it possible to avoid the declaration of a knexfile.js and make the migrations and seeds work?

I would like to keep the Knex configuration in the AppModule's imports only.

Is NPM Package updated?

Is NPM Package updated?

I will use this package in a commercial application, but I don't know if this package is updated in the NPM registry, because the last commit was in a few days, but NPM was updated 2 years old. I'm installing directly from GitHub and not from NPM because of this.

Jest testing (Nest can't resolve dependencies of the UsersService (?). Please make sure that the argument default at index [0] is available in the RootTestModule context.)

Hello, I have users.service.ts

import { Injectable } from '@nestjs/common';

import { Knex } from 'knex';
import { InjectConnection } from 'nest-knexjs';

import type { UserEntity } from './entities/user.entity';
@Injectable()
export class UsersService {
  constructor(@InjectConnection() private readonly knex: Knex) {}

  async findOne(email: UserEntity['email']): Promise<UserEntity | undefined> {
    return await this.knex
      .select()
      .from('users')
      .where({ email: email })
      .first();
  }
}

and test like

import { Test, TestingModule } from '@nestjs/testing';
import { UsersService } from './users.service';

describe('UsersService', () => {
  let service: UsersService;

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [UsersService],
    }).compile();

    service = module.get<UsersService>(UsersService);
  });

  it('should be defined', () => {
    expect(service).toBeDefined();
  });
});

I'm getting error

UsersService โ€บ should be defined

    Nest can't resolve dependencies of the UsersService (?). Please make sure that the argument default at index [0] is available in the RootTestModule context.

    Potential solutions:
    - Is RootTestModule a valid NestJS module?
    - If default is a provider, is it part of the current RootTestModule?
    - If default is exported from a separate @Module, is that module imported within RootTestModule?
      @Module({
        imports: [ /* the Module containing default */ ]
      })
      ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.