Registry / devops / res-saas-gl-library

res-saas-gl-library

JSON →
library1.0.131jsnpmunverified

A NestJS library for gRPC communication between microservices, version 1.0.131. It abstracts .proto file handling and provides ready-to-use modules for Auth, Documentation, Notification, and Storage microservices. Key differentiators: uses Infisical for secrets management, singleton pattern for gRPC clients, and dynamic module registration. Eschews direct .proto compilation in consumer code by providing pre-generated interfaces and services. Recommended for teams using NestJS microservices with gRPC and Infisical secrets.

npm install res-saas-gl-library
INSTALL
IMPORT
SIG · RES-SAAS-GL-LIBRAR
R
res-saas-gl-library
devopsjavascriptv1.0.131
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.

InfisicalClientService
import { InfisicalClientService } from 'res-saas-gl-library'
import InfisicalClientService from 'res-saas-gl-library'
Named export, not default. Use curly braces.
GRPCAuthModule
import { GRPCAuthModule } from 'res-saas-gl-library'
const GRPCAuthModule = require('res-saas-gl-library').GRPCAuthModule
ESM syntax required via import, not require. The module supports dynamic registration with .register()
AuthServiceClient
import { AuthServiceClient } from 'res-saas-gl-library'
import { AuthClient } from 'res-saas-gl-library'
Exact symbol name is AuthServiceClient, not AuthClient.

Shows how to set up a NestJS module with gRPC Auth client and use it in a service.

import { Module } from '@nestjs/common'; import { GRPCAuthModule, AuthServiceClient } from 'res-saas-gl-library'; @Module({ imports: [ GRPCAuthModule.register(process.env.GRPC_AUTH_DOMAIN ?? 'localhost:50051'), ], providers: [AuthServiceClient], exports: [AuthServiceClient], }) export class AuthGrpcModule {} // In a service: import { Injectable } from '@nestjs/common'; import { AuthServiceClient, GetPermissionsRequest } from 'res-saas-gl-library'; @Injectable() export class MyService { constructor(private readonly authClient: AuthServiceClient) {} async getPermissions(userId: string) { const req: GetPermissionsRequest = { userId }; return this.authClient.getPermissions(req).toPromise(); } }
Debug
Known issues
gotchaThe library version 1.0.131 only supports Auth, Documentation, Notification, and Storage microservices. Attempting to use other microservices will fail.
fix
Check the list of supported services in the documentation; or request a new service from the library maintainers.
affects: <=1.0.131
gotchaInfisicalClientService uses a singleton pattern via getInstance(). Creating multiple instances is not allowed and will throw.
fix
Use getInstance(env, projectId, token, url, path) as shown in the example; do not call new InfisicalClientService().
affects: >=0.0.0
deprecatedThe package name in npm is 'res-saas-gl-library', but some examples use 'saas-grpc-library' or 'saas-grpc-library'. Import from 'res-saas-gl-library' only.
fix
Always import from 'res-saas-gl-library'. Other package names are not published.
affects: >=0.0.0
breakingRequires Node.js version 20 or higher. Older Node versions may cause runtime errors.
fix
Upgrade Node.js to >=20.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'res-saas-gl-library'
Package not installed or wrong package name.
fix
Run: pnpm install res-saas-gl-library
GRPCAuthModule is not a function
Incorrect import: GRPCAuthModule is a class, not a function. You must call its static method .register().
fix
Use: GRPCAuthModule.register(domain) in the imports array.
AuthServiceClient is not a constructor
AuthServiceClient is not instantiated directly; it is provided by the module via dependency injection.
fix
Declare AuthServiceClient in providers of the module and inject via constructor.
TypeError: Cannot read properties of undefined (reading 'getSecrets')
InfisicalClientService.getInstance() returned undefined because token or environment variables are missing.
fix
Ensure INFISICAL_ENV, INFISICAL_PROJECT_ID, INFISICAL_TOKEN, INFISICAL_URL, and INFISICAL_SECRET_PATH are set correctly.
Upgrade
Version history
1.0.131latest on npm
Audit
Dependencies
@nestjs/commonrequiredPeer dependency for NestJS decorators and modules
@nestjs/microservicesrequiredPeer dependency for gRPC transport
@grpc/grpc-jsrequiredgRPC client library
Agent activity
8 hits · last 30 days
node
8
Resources
res-saas-gl-library — npm install res-saas-gl-library · libregistry