@crunchydeer30/protobuf-test
v1.0.6
Published
This package provides TypeScript/JavaScript generated code for Product service protobuf definitions.
Readme
Product Protobuf Definitions
This package provides TypeScript/JavaScript generated code for Product service protobuf definitions.
Installation
npm install @crunchydeer30/protobuf-testPeer Dependencies
This package requires the following peer dependencies:
@grpc/grpc-jsgoogle-protobuf
Make sure to install them in your project:
npm install @grpc/grpc-js google-protobufUsage
TypeScript/JavaScript
import { Product, ProductServiceClient } from '@crunchydeer30/protobuf-test';
// Create a client
const client = new ProductServiceClient('your-service-address:port');
// Example: Create a product
const createProduct = async () => {
const request = {
name: 'Example Product',
description: 'This is an example product',
image: 'https://example.com/product.jpg',
tags: ['example', 'test']
};
const response = await client.createProduct(request);
console.log('Created product:', response.product);
};Available Services and Messages
- ProductService
createProduct(CreateProductRequest): CreateProductResponsegetProduct(GetProductRequest): GetProductResponselistProducts(ListProductsRequest): ListProductsResponse
Development
Prerequisites
- Node.js (v14 or later)
- npm (v6 or later)
- Protocol Buffers compiler (protoc)
Building
Install dependencies:
npm installGenerate TypeScript code from .proto files:
npm run generateBuild the project:
npm run build
Publishing
- Update the version in
package.json - Commit and tag the changes
- Run
npm publish --access public
License
ISC
