Registry / database / grpc-typeorm-infrastructure

grpc-typeorm-infrastructure

JSON →
library1.0.16jsnpmunverified

A lightweight wrapper around TypeORM repository and service patterns that integrates with gRPC Boom for consistent error handling. Current stable version is 1.0.16, released sporadically with minor updates. It provides base classes (BaseRepository and BaseService) to standardize CRUD operations with hooks like preSave, preUpdate, preDelete, and preResult. Compared to other TypeORM wrappers, this library specifically targets gRPC services and generates gRPC-friendly error objects using gRPC Boom. It requires TypeORM, gRPC, and gRPC Boom as peer dependencies.

npm install grpc-typeorm-infrastructure
INSTALL
IMPORT
SIG · GRPC-TYPEORM-INFRA
G
grpc-typeorm-infrastructure
databasejavascriptv1.0.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BaseRepository
import BaseRepository from 'grpc-typeorm-infrastructure'
import { BaseRepository } from 'grpc-typeorm-infrastructure'
Default export since v1.
BaseService
import { BaseService } from 'grpc-typeorm-infrastructure'
import BaseService from 'grpc-typeorm-infrastructure'
Named export.
ISearchQueryBuilderOptions
import { ISearchQueryBuilderOptions } from 'grpc-typeorm-infrastructure'
import ISearchQueryBuilderOptions from 'grpc-typeorm-infrastructure'
TypeScript type export.

Shows how to define a TypeORM entity, extend BaseRepository, and perform a save operation.

import BaseRepository from 'grpc-typeorm-infrastructure'; import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'; @Entity() class Hero { @PrimaryGeneratedColumn() id: number; @Column() name: string; } class HeroRepository extends BaseRepository<Hero> { constructor() { super(Hero.name); } } // Usage const repo = new HeroRepository(); const hero = new Hero(); hero.name = 'Superman'; repo.save(hero).then(console.log).catch(console.error);
Debug
Known issues
breakingBaseRepository constructors require calling super with entity class name (string). Passing the class itself will cause a runtime error.
fix
Use super(Hero.name) instead of super(Hero).
affects: >=1.0.0
gotchaThe save/update/delete methods use gRPC Boom for error formatting; errors thrown will be gRPC objects, not plain Error.
fix
Handle errors using gRPC error handling patterns.
affects: >=1.0.0
deprecatedThe deleteOneById method is marked for deprecation; prefer delete method with record.
fix
Use delete(record: T, options?) instead of deleteOneById.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Class extends value undefined is not a constructor or null
Missing or incorrect import of BaseRepository or BaseService.
fix
Ensure correct import statement: import BaseRepository from 'grpc-typeorm-infrastructure'
Cannot read property 'name' of undefined
Calling super() in repository constructor with undefined entity name.
fix
Pass the entity class name as string: super(Hero.name)
Upgrade
Version history
1.0.16latest on npm
Audit
Dependencies
typeormrequiredCore ORM used for entity definitions and database operations.
grpcrequiredRequired for gRPC transport layer; library assumes gRPC is used.
grpc-boomrequiredUsed to generate gRPC-friendly error objects.
Agent activity
6 hits · last 30 days
node
6
Resources
grpc-typeorm-infrastructure — npm install grpc-typeorm-infrastructure · libregistry