Registry / devops / nice-grpc-common

nice-grpc-common

JSON →
library2.0.3jsnpmunverified

Shared utilities and types for the nice-grpc and nice-grpc-web packages. Version 2.0.3 is the current stable release, with a focus on type-safe gRPC client and server implementations for Node.js and the browser. It provides common abstractions such as middleware interfaces, status codes, and metadata handling that are shared across both the gRPC and gRPC-Web implementations. This package is released as part of the nice-grpc monorepo, with a regular release cadence aligned with the main packages. Key differentiators from raw gRPC libraries: provides TypeScript-first middleware composition and type-safe service definitions.

npm install nice-grpc-common
INSTALL
IMPORT
SIG · NICE-GRPC-COMMON
N
nice-grpc-common
devopsjavascriptv2.0.3
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.

ClientMiddleware
import { ClientMiddleware } from 'nice-grpc-common'
import ClientMiddleware from 'nice-grpc-common'
Exported as a named export, not default.
ServiceDefinition
import { ServiceDefinition } from 'nice-grpc-common'
const ServiceDefinition = require('nice-grpc-common')
Use ESM imports for TypeScript projects.
StatusValue
import { StatusValue } from 'nice-grpc-common'
TypeScript type exported for status codes.

Demonstrates importing ClientMiddleware and ServiceDefinition for type-safe middleware composition.

import { ClientMiddleware, ServiceDefinition } from 'nice-grpc-common'; // Define a type-safe middleware const loggingMiddleware: ClientMiddleware = async (call, context) => { console.log(`Calling ${call.method.path}`); return call.next(call.request, context); }; // Use with a service definition const serviceDef: ServiceDefinition = { // ... service definition from .proto }; export { loggingMiddleware, serviceDef };
Debug
Known issues
breakingIn version 2.0.0, the package was renamed from 'nice-grpc-common-middleware' to 'nice-grpc-common'. Imports from the old package name will fail.
fix
Update imports to use 'nice-grpc-common'.
affects: <2.0.0
deprecatedThe type 'Middleware' is deprecated in favor of 'ClientMiddleware' and 'ServerMiddleware'.
fix
Replace any usage of 'Middleware' with 'ClientMiddleware' or 'ServerMiddleware'.
affects: >=2.0.0
gotchaThis package is not standalone; it must be used with either 'nice-grpc' or 'nice-grpc-web'. Importing types alone may cause confusion if missing peer dependency.
fix
Install the corresponding main package: 'npm install nice-grpc' or 'npm install nice-grpc-web'.
affects: *
Errors
Common errors & fixes
Cannot find module 'nice-grpc-common'
Package not installed or misspelled.
fix
Run 'npm install nice-grpc-common' and ensure correct spelling.
Module '"node_modules/nice-grpc-common/index"' has no exported member 'ClientMiddleware'.
Using an older version (<2.0.0) where the type had a different name or was not exported.
fix
Upgrade to at least version 2.0.0, or check the actual exported names for your version.
TypeError: (0 , nice_grpc_common__WEBPACK_IMPORTED_MODULE_0__.ClientMiddleware) is not a function
Treating a type as a runtime value.
fix
Ensure you are not trying to instantiate or call 'ClientMiddleware'; it is a TypeScript type, not a class.
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies
abort-controlleroptionalProvides AbortController polyfill for Node.js < 14
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
nice-grpc-common — npm install nice-grpc-common · libregistry