{"name":"@grpc/proto-loader","version":"0.6.0-pre18","author":{"name":"Google Inc."},"contributors":[{"name":"Michael Lumish","email":"mlumish@google.com"}],"description":"gRPC utility library for loading .proto files","homepage":"https://grpc.io/","main":"build/src/index.js","typings":"build/src/index.d.ts","scripts":{"build":"npm run compile","clean":"node -e 'require(\"rimraf\")(\"./build\", () => {})'","compile":"tsc -p .","format":"clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts","lint":"tslint -c node_modules/google-ts-style/tslint.json -p . -t codeFrame --type-check","prepare":"npm run compile","test":"gulp test","check":"gts check","fix":"gts fix","pretest":"npm run compile","posttest":"npm run check","generate-golden":"node ./build/bin/proto-loader-gen-types.js --keepCase --longs=String --enums=String --defaults --oneofs --json --includeComments -I deps/gapic-showcase/schema/ deps/googleapis/ -O ./golden-generated --grpcLib @grpc/grpc-js google/showcase/v1beta1/echo.proto","validate-golden":"rm -rf ./golden-generated-old && mv ./golden-generated/ ./golden-generated-old && npm run generate-golden && diff -r ./golden-generated ./golden-generated-old"},"repository":{"type":"git","url":"git+https://github.com/grpc/grpc-node.git"},"license":"Apache-2.0","bugs":{"url":"https://github.com/grpc/grpc-node/issues"},"bin":{"proto-loader-gen-types":"build/bin/proto-loader-gen-types.js"},"dependencies":{"@types/long":"^4.0.1","lodash.camelcase":"^4.3.0","long":"^4.0.0","protobufjs":"^6.10.0","yargs":"^16.1.1"},"devDependencies":{"@types/lodash.camelcase":"^4.3.4","@types/mkdirp":"^1.0.1","@types/mocha":"^5.2.7","@types/node":"^10.17.26","@types/yargs":"^15.0.5","clang-format":"^1.2.2","gts":"^1.1.0","rimraf":"^3.0.2","typescript":"~3.8.3"},"engines":{"node":">=6"},"readme":"# gRPC Protobuf Loader\n\nA utility package for loading `.proto` files for use with gRPC, using the latest Protobuf.js package.\nPlease refer to [protobuf.js' documentation](https://github.com/dcodeIO/protobuf.js/blob/master/README.md)\nto understands its features and limitations.\n\n## Installation\n\n```sh\nnpm install @grpc/proto-loader\n```\n\n## Usage\n\n```js\nconst protoLoader = require('@grpc/proto-loader');\nconst grpcLibrary = require('grpc');\n// OR\nconst grpcLibrary = require('@grpc/grpc-js');\n\nprotoLoader.load(protoFileName, options).then(packageDefinition => {\n  const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);\n});\n// OR\nconst packageDefinition = protoLoader.loadSync(protoFileName, options);\nconst packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);\n```\n\nThe options parameter is an object that can have the following optional properties:\n\n| Field name | Valid values | Description\n|------------|--------------|------------\n| `keepCase` | `true` or `false` | Preserve field names. The default is to change them to camel case.\n| `longs` | `String` or `Number` | The type to use to represent `long` values. Defaults to a `Long` object type.\n| `enums` | `String` | The type to use to represent `enum` values. Defaults to the numeric value.\n| `bytes` | `Array` or `String` | The type to use to represent `bytes` values. Defaults to `Buffer`.\n| `defaults` | `true` or `false` | Set default values on output objects. Defaults to `false`.\n| `arrays` | `true` or `false` | Set empty arrays for missing array values even if `defaults` is `false` Defaults to `false`.\n| `objects` | `true` or `false` | Set empty objects for missing object values even if `defaults` is `false` Defaults to `false`.\n| `oneofs` | `true` or `false` | Set virtual oneof properties to the present field's name. Defaults to `false`.\n| `json` | `true` or `false` | Represent `Infinity` and `NaN` as strings in `float` fields, and automatically decode `google.protobuf.Any` values. Defaults to `false`\n| `includeDirs` | An array of strings | A list of search paths for imported `.proto` files.\n\nThe following options object closely approximates the existing behavior of `grpc.load`:\n\n```js\nconst options = {\n  keepCase: true,\n  longs: String,\n  enums: String,\n  defaults: true,\n  oneofs: true\n}\n```\n\n## Generating TypeScript types\n\nThe `proto-loader-gen-types` script distributed with this package can be used to generate TypeScript type information for the objects loaded at runtime. More information about how to use it can be found in [the *@grpc/proto-loader TypeScript Type Generator CLI Tool* proposal document](https://github.com/grpc/proposal/blob/master/L70-node-proto-loader-type-generator.md). The arguments mostly match the `load` function's options; the full usage information is as follows:\n\n```console\nproto-loader-gen-types.js [options] filenames...\n\nOptions:\n  --help             Show help                                         [boolean]\n  --version          Show version number                               [boolean]\n  --keepCase         Preserve the case of field names                  [boolean]\n  --longs            The type that should be used to output 64 bit integer\n                     values. Can be String, Number                      [string]\n  --enums            The type that should be used to output enum fields. Can be\n                     String                                             [string]\n  --bytes            The type that should be used to output bytes fields. Can be\n                     String, Array                                      [string]\n  --defaults         Output default values for omitted fields          [boolean]\n  --arrays           Output default values for omitted repeated fields even if\n                     --defaults is not set                             [boolean]\n  --objects          Output default values for omitted message fields even if\n                     --defaults is not set                             [boolean]\n  --oneofs           Output virtual oneof fields set to the present field's name\n                                                                       [boolean]\n  --json             Represent Infinity and NaN as strings in float fields. Also\n                     decode google.protobuf.Any automatically          [boolean]\n  --includeComments  Generate doc comments from comments in the original files\n                                                                       [boolean]\n  --includeDirs, -I  Directories to search for included files            [array]\n  --outDir, -O       Directory in which to output files      [string] [required]\n  --grpcLib          The gRPC implementation library that these types will be\n                     used with                               [string] [required]\n```\n\n### Example Usage\n\nGenerate the types:\n\n```sh\n$(npm bin)/proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=proto/ proto/*.proto\n```\n\nConsume the types:\n\n```ts\nimport * as grpc from '@grpc/grpc-js';\nimport * as protoLoader from '@grpc/proto-loader';\nimport { ProtoGrpcType } from './proto/example';\nimport { ExampleHandlers } from './proto/example_package/Example';\n\nconst exampleServer: ExampleHandlers = {\n  // server handlers implementation...\n};\n\nconst packageDefinition = protoLoader.loadSync('./proto/example.proto');\nconst proto = (grpc.loadPackageDefinition(\n  packageDefinition\n) as unknown) as ProtoGrpcType;\n\nconst server = new grpc.Server();\nserver.addService(proto.example_package.Example.service, exampleServer);\n```\n","readmeFilename":"README.md","_id":"@grpc/proto-loader@0.6.0-pre18","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-MjRTKVOI0AIhlfL7urIxJQwSTmte04rEEq1wLTyWTneY4eOBwQjJ/wS+37kFVRO5PuEl24DXwhUiVmlWbPtPPQ==","shasum":"1862442ecc7f6f7b4ce4be48d0144c03bea45a9f","tarball":"http://registry-npm.ywwl.com/@grpc/proto-loader/download/@grpc/proto-loader-0.6.0-pre18.tgz","fileCount":8,"unpackedSize":68272,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZNpkCRA9TVsSAnZWagAAo2YP/AmDfuFWT7v2IbxyPW1L\ne4f9J1tiK2BJjxu+O1aeEUEd8hnXg2v5SZa2xoPlUxkUT/wNQZMtMAwweZUi\n/wdfcC/2X/0RkwitNZDwdboiJ96WELtYKTAnN1UtGnWpJX4wb1urObMPk79+\nDd2y1l+F0Z/Bb72qAbSz4quvA9Rvkl0spvocaDbmI6VoAy1TUH7Qd7t//OUB\nF9RKZsdhvm9UhBrUNAk81WDe7zwZR4610QNZNvqC8NX847YB6kWOfB+4K/nk\nI7N1uML83/iNygl9B86L2Cw8yVTsri3I+Ax5BYuEyprUxHL4vXAVhAeAPhbt\n8MXN25SFtxREa6w5o0ELAgl1+psg3hOtfwbEoSYViEQxkWO9CAuR0SFfusIG\n+WWa2X2iBXP6BEt3gmVCORr4J6xTTLi9Q5wjAKn5ZztTeNaq7MM1EyRAepT1\nt6ilINmIFxJ75VWiEY51E8MiQG1m1OW4j05nWzQlabQbbdzyMXem3vHtjSvl\nmRyMaU4qgjXpf86VFa0/M76HuO1zsndZqTkcIMzKhPOWpOPb83p4Q55Jncp4\nSeEX4VObuuQCDD4ie9BbQnpF3rqK/KjdLXz3KVr3SM62aq0xtqKx3UygTaBn\nkYIa+kfGUYg3TmT8/K7m6luN7GpWPPKrX7mkSIyCbAgMIwSzRa3aA0RgBPe1\n409z\r\n=6G7L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIRGY+iBuHJSV4qQ07TTZJxt6JLC081ATYzA1qbC+g8wIhAMvA70D8WcJ4KQ1BPGyEc6bqgTqQ3qiuo6SWLIdXeQ/p"}],"size":15525,"noattachment":false,"key":"/@grpc/proto-loader/-/@grpc/proto-loader-0.6.0-pre18.tgz"},"_npmUser":{"name":"murgatroid99","email":"mlumish@google.com"},"directories":{},"maintainers":[{"name":"murgatroid99","email":"mlumish@google.com"},{"name":"grpc-packages","email":"grpc-packages@google.com"},{"name":"nicolasnoble","email":"nicolas@nobis-crew.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/proto-loader_0.6.0-pre18_1617222244349_0.07276423734809678"},"_hasShrinkwrap":false,"publish_time":1617222244503,"_cnpm_publish_time":1617222244503,"dist-tags":{"generator-draft":"0.6.0-pre18","latest":"0.8.1","prerelease":"0.7.9-pre.1"}}