{"id":13740922,"url":"https://github.com/bojand/grpc-inspect","last_synced_at":"2025-03-25T02:31:09.645Z","repository":{"id":57254508,"uuid":"76818615","full_name":"bojand/grpc-inspect","owner":"bojand","description":"gRPC protocol buffer inspection utility","archived":false,"fork":false,"pushed_at":"2019-02-05T12:32:40.000Z","size":631,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T07:03:30.240Z","etag":null,"topics":["grpc"],"latest_commit_sha":null,"homepage":"https://bojand.github.io/grpc-inspect","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bojand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-19T01:45:39.000Z","updated_at":"2023-01-03T02:02:37.000Z","dependencies_parsed_at":"2022-08-31T08:21:13.425Z","dependency_job_id":null,"html_url":"https://github.com/bojand/grpc-inspect","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgrpc-inspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgrpc-inspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgrpc-inspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgrpc-inspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bojand","download_url":"https://codeload.github.com/bojand/grpc-inspect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245385332,"owners_count":20606648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc"],"created_at":"2024-08-03T04:00:53.610Z","updated_at":"2025-03-25T02:31:09.096Z","avatar_url":"https://github.com/bojand.png","language":"JavaScript","funding_links":[],"categories":["Language-Specific"],"sub_categories":["Node.js"],"readme":"# grpc-inspect\n\n[![npm version](https://img.shields.io/npm/v/grpc-inspect.svg?style=flat-square)](https://www.npmjs.com/package/grpc-inspect)\n[![build status](https://img.shields.io/travis/bojand/grpc-inspect/master.svg?style=flat-square)](https://travis-ci.org/bojand/grpc-inspect)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)\n[![License](https://img.shields.io/github/license/bojand/grpc-inspect.svg?style=flat-square)](https://raw.githubusercontent.com/bojand/grpc-inspect/master/LICENSE)\n[![Greenkeeper badge](https://badges.greenkeeper.io/bojand/grpc-inspect.svg)](https://greenkeeper.io/)\n\ngRPC Protocol Buffer utility module that generates a descriptor object representing a\nfriendlier descriptor object with utility methods for protocol buffer inspection.\n\n## Installation\n\n`npm install grpc-inspect`\n\n## Overview\n\n`helloworld.proto`\n\n\n```\nsyntax = \"proto3\";\n\noption java_multiple_files = true;\noption java_package = \"io.grpc.examples.helloworld\";\noption java_outer_classname = \"HelloWorldProto\";\noption objc_class_prefix = \"HLW\";\n\npackage helloworld;\n\nservice Greeter {\n  // Sends a greeting\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\n}\n\nmessage HelloRequest {\n  string name = 1;\n}\n\nmessage HelloReply {\n  string message = 1;\n}\n```\n\n\nSample usage:\n\n\n```js\nconst gi = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = gi(proto)\nconsole.dir(d)\n```\n\n\nReturned utility descriptor:\n\n\n```js\n{ namespaces:\n   { helloworld:\n      { name: 'helloworld',\n        messages:\n         { HelloRequest:\n            { name: 'HelloRequest',\n              fields:\n               [ { name: 'name',\n                   type: 'string',\n                   id: 1,\n                   required: false,\n                   repeated: false,\n                   map: false,\n                   defaultValue: '' } ] },\n           HelloReply:\n            { name: 'HelloReply',\n              fields:\n               [ { name: 'message',\n                   type: 'string',\n                   id: 1,\n                   required: false,\n                   repeated: false,\n                   map: false,\n                   defaultValue: '' } ] } },\n        services:\n         { Greeter:\n            { name: 'Greeter',\n              package: 'helloworld',\n              methods:\n               [ { name: 'SayHello',\n                   requestStream: false,\n                   responseStream: false,\n                   requestName: 'HelloRequest',\n                   responseName: 'HelloReply' } ] } } } },\n  file: '/Users/me/protos/helloworld.proto',\n  options:\n   { java_multiple_files: true,\n     java_package: 'io.grpc.examples.helloworld',\n     java_outer_classname: 'HelloWorldProto',\n     objc_class_prefix: 'HLW' } }\n```\n\n\n**NOTE** If no package name is specified in the protocol buffer definition an empty `''` string is used for the package / namespace name.\n\n## API Reference\n\n\u003ca name=\"descriptor\"\u003e\u003c/a\u003e\n\n### descriptor : \u003ccode\u003eObject\u003c/code\u003e\nProtocol Buffer utility descriptor represents friendlier descriptor object with utility methods for\nprotocol buffer inspection.\n\n**Kind**: global class  \n**Access**: public  \n\n* [descriptor](#descriptor) : \u003ccode\u003eObject\u003c/code\u003e\n    * [.namespaceNames()](#descriptor.namespaceNames) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n    * [.serviceNames(namespace)](#descriptor.serviceNames) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n    * [.service(service)](#descriptor.service) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n    * [.methodNames(service)](#descriptor.methodNames) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n    * [.methods(service)](#descriptor.methods) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n    * [.proto()](#descriptor.proto) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n    * [.client(serviceName)](#descriptor.client) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n\n\u003ca name=\"descriptor.namespaceNames\"\u003e\u003c/a\u003e\n\n#### descriptor.namespaceNames() ⇒ \u003ccode\u003eArray\u003c/code\u003e\nReturns an array of namespace names within the protocol buffer definition\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - array of names  \n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.log(d.namespaceNames()) // ['routeguide']\n```\n\n\u003ca name=\"descriptor.serviceNames\"\u003e\u003c/a\u003e\n\n#### descriptor.serviceNames(namespace) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nReturns an array of service names\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - array of names  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| namespace | \u003ccode\u003eString\u003c/code\u003e | Optional name of namespace to get services.                           If not present returns service names of all services within the definition. |\n\n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = const grpcinspect(proto)\nconsole.log(d.serviceNames()) // ['RouteGuide']\n```\n\n\u003ca name=\"descriptor.service\"\u003e\u003c/a\u003e\n\n#### descriptor.service(service) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns the utility descriptor for the service given a servie name.\nAssumes there are no duplicate service names within the definition.\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - service utility descriptor  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| service | \u003ccode\u003eString\u003c/code\u003e | name of the service |\n\n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.dir(d.service('RouteGuide'))\n```\n\n\u003ca name=\"descriptor.methodNames\"\u003e\u003c/a\u003e\n\n#### descriptor.methodNames(service) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nReturns an array of method names for a service\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - array of names  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| service | \u003ccode\u003eString\u003c/code\u003e | name of the service |\n\n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.log(d.methodNames('RouteGuide')) // [ 'GetFeature', 'ListFeatures', 'RecordRoute', 'RouteChat' ]\n```\n\n\u003ca name=\"descriptor.methods\"\u003e\u003c/a\u003e\n\n#### descriptor.methods(service) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nReturns an array the utility descriptors for the methods of a service.\nAssumes there are no duplicate service names within the definition.\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - array of method utility descriptors  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| service | \u003ccode\u003eString\u003c/code\u003e | name of the service |\n\n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.dir(d.methods('RouteGuide'))\n```\n\n\u003ca name=\"descriptor.proto\"\u003e\u003c/a\u003e\n\n#### descriptor.proto() ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns the internal proto object\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - the internal proto object  \n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.dir(d.proto())\n```\n\n\u003ca name=\"descriptor.client\"\u003e\u003c/a\u003e\n\n#### descriptor.client(serviceName) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nGets the gRPC service / client object / function\n\n**Kind**: static method of [\u003ccode\u003edescriptor\u003c/code\u003e](#descriptor)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - the Client object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| serviceName | \u003ccode\u003eserviceName\u003c/code\u003e | The service name. Can and should include package. |\n\n**Example**  \n\n```js\nconst grpcinspect = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = grpcinspect(proto)\nconsole.dir(d.client('RouteGuide'))\nconsole.dir(d.client('routeguide.RouteGuide'))\n```\n\n\u003ca name=\"grpcinspect\"\u003e\u003c/a\u003e\n\n### grpcinspect(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns protocol buffer utility descriptor.\nTakes a loaded grpc / protocol buffer object and returns a friendlier descriptor object\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - the utility descriptor  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | loaded proto object |\n\n**Example**  \n\n```js\nconst gi = require('grpc-inspect')\nconst grpc = require('grpc')\nconst pbpath = path.resolve(__dirname, './route_guide.proto')\nconst proto = grpc.load(pbpath)\nconst d = gi(proto)\nconsole.dir(d)\n```\n\n## License\n\n  Apache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbojand%2Fgrpc-inspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbojand%2Fgrpc-inspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbojand%2Fgrpc-inspect/lists"}