[
  {
    "path": ".github/CODEOWNERS",
    "content": "* @badsyntax\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n- package-ecosystem: github-actions\n  directory: \"/\"\n  schedule:\n    interval: daily\n  open-pull-requests-limit: 10\n"
  },
  {
    "path": ".github/workflows/test.yml",
    "content": "name: Test\n\non:\n  push:\n    branches: [master]\n  pull_request:\n    branches: [master]\n\njobs:\n  test:\n    runs-on: ubuntu-20.04\n    name: Build examples\n    steps:\n      - uses: actions/checkout@v4.2.2\n      - uses: actions/setup-node@v3.4.1\n        with:\n          node-version: 16\n      - uses: actions/setup-java@v4.5.0\n        with:\n          java-version: 15\n          architecture: x64\n          distribution: zulu\n      - name: Build gradle-ts-protoc-gen\n        run: |\n          cd examples/gradle-ts-protoc-gen\n          npm i\n          npm run build\n      - name: Build grpc_tools_node_protoc_ts\n        run: |\n          cd examples/grpc_tools_node_protoc_ts\n          npm i\n          npm run build\n      - name: Build grpc-proto-loader\n        run: |\n          cd examples/grpc-proto-loader\n          npm i\n          npm run build\n      - name: Build grpc-web\n        run: |\n          cd examples/grpc-web\n          npm i\n          npm run build\n      - name: Build ts-protoc-gen\n        run: |\n          cd examples/ts-protoc-gen\n          npm i\n          npm run build\n"
  },
  {
    "path": "README.md",
    "content": "# gRPC TypeScript\n\n[![Test](https://github.com/badsyntax/grpc-js-typescript/actions/workflows/test.yml/badge.svg)](https://github.com/badsyntax/grpc-js-typescript/actions/workflows/test.yml)\n\nThis repo shows how to use gRPC with TypeScript & Node.js.\n\nIn all cases, [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) is used as [`grpc`](https://www.npmjs.com/package/grpc) is now [effectively deprecated](https://grpc.io/blog/grpc-js-1.0/).\n\nTypeScript types are generated at build time from the proto files using different tools as demonstrated in this repo.\n\n## Examples\n\nEach example is a separate application. Refer to the README in each project for more information.\n\n- [grpc-proto-loader](./examples/grpc-proto-loader)\n- [ts-protoc-gen](./examples/ts-protoc-gen)\n- [gradle-ts-protoc-gen](./examples/gradle-ts-protoc-gen)\n- [grpc_tools_node_protoc_ts](./examples/grpc_tools_node_protoc_ts)\n- [grpc-web](./examples/grpc-web)\n\n## Type Parity\n\nThanks to [this issue](https://github.com/agreatfool/grpc_tools_node_protoc_ts/issues/79) being fixed, we now have type parity across the different type generator packages. 🎉\n\n## Contributions\n\nContributions I made to help with gRPC & TypeScript support:\n\n- https://github.com/grpc/grpc-node/pull/1368\n- https://github.com/grpc/grpc-node/pull/1380\n- https://github.com/grpc/grpc-node/pull/1387\n- https://github.com/grpc/grpc-node/pull/1419\n- https://github.com/grpc/grpc-node/pull/1454\n- https://github.com/grpc/grpc-node/pull/1587\n- https://github.com/grpc/grpc-node/pull/1590\n- https://github.com/murgatroid99/grpc-node/pull/1\n- https://github.com/murgatroid99/grpc-node/pull/2\n- https://github.com/murgatroid99/grpc-node/pull/3\n- https://github.com/improbable-eng/ts-protoc-gen/pull/236\n- https://github.com/improbable-eng/ts-protoc-gen/pull/247\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.gitattributes",
    "content": "#\n# https://help.github.com/articles/dealing-with-line-endings/\n#\n# These are explicitly windows files and should use crlf\n*.bat           text eol=crlf\n\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.gitignore",
    "content": "node_modules\n**/*.js\n!proto/*.js\n\n# Ignore Gradle project-specific cache directory\n.gradle\n\n# Ignore Gradle build output directory\nbuild\n\n# Eclipse files\n.settings\n.classpath\n.project\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.npmrc",
    "content": "registry=https://registry.npmjs.org/"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.prettierignore",
    "content": "package-lock.json\nproto/*.ts\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"EditorConfig.EditorConfig\",\n    \"esbenp.prettier-vscode\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"zxh404.vscode-proto3\"\n  ]\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/.vscode/settings.json",
    "content": "{\n  \"typescript.tsc.autoDetect\": \"off\",\n  \"typescript.updateImportsOnFileMove.enabled\": \"always\",\n  \"files.insertFinalNewline\": true,\n  \"files.trimTrailingWhitespace\": true,\n  \"eslint.validate\": [\"javascript\", \"typescript\"],\n  \"editor.formatOnSave\": false,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true,\n    \"source.organizeImports\": false\n  },\n  \"[markdown]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[json]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[yaml]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"cSpell.language\": \"en-GB\",\n  \"cSpell.words\": [\n    \"grpc\"\n  ],\n  \"java.configuration.updateBuildConfiguration\": \"automatic\"\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/README.md",
    "content": "# gradle-ts-protoc-gen example\n\nThis examples shows how to uses [Gradle](https://gradle.org/), the [proto compiler](https://www.npmjs.com/package/grpc-tools),  [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) to build a fully typed gRPC application that runs on Node.js.\n\nThe [proto compiler](https://www.npmjs.com/package/grpc-tools) and [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) compiler plugin are used to generate JavaScript & TypeScript files from the proto definitions. The [`protobuf-gradle-plugin`](https://github.com/google/protobuf-gradle-plugin) Gradle plugin is used to run the compiler from Gradle.\n\n[`google-protobuf`](https://www.npmjs.com/package/google-protobuf) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) are used at runtime.\n\n## App layout\n\n- [package.json](./package.json) - Dependencies and node build scripts\n- [build.gradle](./build.gradle) - The Gradle build file\n- [proto/](./proto/) - Protobuf definitions and generated types\n- [server.ts](./server.ts) - The grpc server\n- [client.ts](./client.ts) - The grpc client\n\n## Generating the Types\n\nInstall dependencies:\n\n```sh\nnpm install\n\n# Apple M1 users should install for x64 due to grpc-tools not supporting arm64\nnpm i --target_arch=x64\n```\n\nUse Gradle & [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) to generate the TypeScript files:\n\n```sh\n./gradlew generateProto\n```\n\nThis is aliased as a npm script:\n\n```sh\nnpm run build:proto\n```\n\n### Running the App\n\nThis simple app demonstrates the different gRPC calls you can perform.\n\nFirst generated the types and build the application files:\n\n```sh\nnpm run build\n```\n\nStart the server:\n\n```sh\nnpm run start:server\n```\n\nNow run the client by specifying which example you want to run:\n\n```bash\nnpm run start:client -- --unary\nnpm run start:client -- --server-streaming\nnpm run start:client -- --client-streaming\nnpm run start:client -- --bidi-streaming\n```\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/build.gradle",
    "content": "\nplugins {\n  id 'java'\n  id 'com.google.protobuf' version '0.8.16'\n  id 'com.github.jlouns.cpe' version '0.5.0'\n}\n\nproject.ext.set('protobufVersion', '3.16.0')\nproject.ext.set('protocVersion', project.protobufVersion)\n\ndef isWindows = System.getProperty('os.name').toLowerCase().contains('windows')\n\nrepositories {\n  mavenCentral()\n}\n\nsourceSets {\n  main {\n    proto {\n      srcDir file('./proto')\n    }\n  }\n}\n\nprotobuf {\n  protoc {\n    if (osdetector.os == 'osx') {\n      // Required for arm64 support on MacOS\n      artifact = \"com.google.protobuf:protoc:${protocVersion}:osx-x86_64\"\n    } else {\n      artifact = \"com.google.protobuf:protoc:${protocVersion}\"\n    }\n  }\n  plugins {\n    grpc {\n      path = file(\n        './node_modules/.bin/grpc_tools_node_protoc_plugin' + (isWindows ? '.cmd' : '')\n      )\n    }\n    ts {\n      path = file(\n        './node_modules/.bin/protoc-gen-ts' + (isWindows ? '.cmd' : '')\n      )\n    }\n  }\n  generateProtoTasks {\n    generateProto.finalizedBy copyGeneratedProto\n    all().each { task ->\n      task.plugins {\n        grpc {\n          outputSubDir = 'js'\n          option 'grpc_js'\n        }\n        ts {\n          option 'service=grpc-node,mode=grpc-js'\n        }\n      }\n      task.builtins {\n        remove java\n        js {\n          option 'import_style=commonjs'\n        }\n      }\n      task.dependsOn npmInstall\n    }\n  }\n}\n\ntask copyGeneratedProto(type: Copy) {\n  from \"$protobuf.generatedFilesBaseDir/main/ts\", \"$protobuf.generatedFilesBaseDir/main/js\"\n  into 'proto'\n}\n\ntask npmInstall(type: CrossPlatformExec) {\n  description 'Installs node dependencies'\n  inputs.file('package-lock.json').withPathSensitivity(PathSensitivity.RELATIVE)\n  outputs.dir('node_modules')\n  outputs.cacheIf { true }\n  commandLine 'npm', 'install'\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/client.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleClient } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst client = new ExampleClient(host, grpc.credentials.createInsecure());\n\nconst deadline = new Date();\ndeadline.setSeconds(deadline.getSeconds() + 5);\nclient.waitForReady(deadline, (error?: Error) => {\n  if (error) {\n    console.log(`Client connect error: ${error.message}`);\n  } else {\n    onClientReady();\n  }\n});\n\nfunction onClientReady() {\n  switch (process.argv[process.argv.length - 1]) {\n    case '--unary':\n      doUnaryCall();\n      break;\n    case '--server-streaming':\n      doServerStreamingCall();\n      break;\n    case '--client-streaming':\n      doClientStreamingCall();\n      break;\n    case '--bidi-streaming':\n      doBidirectionalStreamingCall();\n      break;\n    default:\n      throw new Error('Example not specified');\n  }\n}\n\nfunction doUnaryCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  client.unaryCall(\n    clientMessage,\n    (error: grpc.ServiceError | null, serverMessage?: ServerMessage) => {\n      if (error) {\n        console.error(error.message);\n      } else if (serverMessage) {\n        console.log(\n          `(client) Got server message: ${serverMessage.getServerMessage()}`\n        );\n      }\n    }\n  );\n}\n\nfunction doServerStreamingCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  const stream = client.serverStreamingCall(clientMessage);\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n}\n\nfunction doClientStreamingCall() {\n  const stream = client.clientStreamingCall(\n    (error: grpc.ServiceError | null) => {\n      if (error) {\n        console.error(error.message);\n      }\n    }\n  );\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n\nfunction doBidirectionalStreamingCall() {\n  const stream = client.bidirectionalStreamingCall();\n\n  // Server stream\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n\n  // Client stream\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-7.0.1-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn () {\n    echo \"$*\"\n}\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=`expr $i + 1`\n    done\n    case $i in\n        0) set -- ;;\n        1) set -- \"$args0\" ;;\n        2) set -- \"$args0\" \"$args1\" ;;\n        3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/gradlew.bat",
    "content": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n\r\n@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/package.json",
    "content": "{\n  \"name\": \"gradle-ts-protoc-gen\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"build\": \"npm run build:typescript\",\n    \"build:typescript\": \"tsc -p .\",\n    \"build:proto\": \"./gradlew generateProto\",\n    \"watch\": \"npm run build:typescript -- -w\",\n    \"prewatch\": \"npm run build:proto\",\n    \"prebuild\": \"npm run build:proto\",\n    \"lint\": \"npm run lint:prettier && npm run lint:eslint\",\n    \"lint:prettier\": \"prettier --check \\\"**/*.{ts,js,json,svg,md,yml}\\\"\",\n    \"lint:eslint\": \"eslint . --ext .js,.ts\",\n    \"lint:fix\": \"npm run lint:fix:prettier && npm run lint:eslint -- --fix\",\n    \"lint:fix:prettier\": \"prettier --write '**/*.{ts,tsx,js,json,svg,md,yml}'\",\n    \"start:server\": \"node server\",\n    \"start:client\": \"node client\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@grpc/grpc-js\": \"^1.6.8\",\n    \"google-protobuf\": \"^3.21.0\"\n  },\n  \"devDependencies\": {\n    \"@tsconfig/node12\": \"^1.0.11\",\n    \"@types/google-protobuf\": \"^3.15.6\",\n    \"@types/node\": \"^15.0.3\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.31.0\",\n    \"@typescript-eslint/parser\": \"^5.31.0\",\n    \"eslint\": \"^8.20.0\",\n    \"eslint-config-prettier\": \"^8.5.0\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.2.1\",\n    \"grpc-tools\": \"^1.11.2\",\n    \"prettier\": \"^2.7.1\",\n    \"ts-protoc-gen\": \"^0.15.0\",\n    \"typescript\": \"^4.7.4\"\n  },\n  \"eslintConfig\": {\n    \"ignorePatterns\": [\n      \"**/*.js\",\n      \"proto/*.ts\"\n    ],\n    \"env\": {\n      \"browser\": false,\n      \"es6\": true,\n      \"node\": true\n    },\n    \"parserOptions\": {\n      \"project\": \"./tsconfig.json\",\n      \"ecmaVersion\": 2018,\n      \"sourceType\": \"module\"\n    },\n    \"extends\": [\n      \"plugin:@typescript-eslint/recommended\",\n      \"plugin:prettier/recommended\"\n    ]\n  },\n  \"prettier\": {\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"printWidth\": 80,\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/proto/example.proto",
    "content": "syntax = \"proto3\";\n\npackage example_package;\n\nmessage ServerMessage {\n  string server_message = 1;\n}\n\nmessage ClientMessage {\n  string client_message = 1;\n}\n\nservice Example {\n  rpc unaryCall(ClientMessage) returns (ServerMessage) {}\n  rpc serverStreamingCall(ClientMessage) returns (stream ServerMessage) {}\n  rpc clientStreamingCall(stream ClientMessage) returns (ServerMessage) {}\n  rpc bidirectionalStreamingCall(stream ClientMessage) returns (stream ServerMessage) {}\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/proto/example_grpc_pb.d.ts",
    "content": "// GENERATED CODE -- DO NOT EDIT!\n\n// package: example_package\n// file: example.proto\n\nimport * as example_pb from \"./example_pb\";\nimport * as grpc from \"@grpc/grpc-js\";\n\ninterface IExampleService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {\n  unaryCall: grpc.MethodDefinition<example_pb.ClientMessage, example_pb.ServerMessage>;\n  serverStreamingCall: grpc.MethodDefinition<example_pb.ClientMessage, example_pb.ServerMessage>;\n  clientStreamingCall: grpc.MethodDefinition<example_pb.ClientMessage, example_pb.ServerMessage>;\n  bidirectionalStreamingCall: grpc.MethodDefinition<example_pb.ClientMessage, example_pb.ServerMessage>;\n}\n\nexport const ExampleService: IExampleService;\n\nexport interface IExampleServer extends grpc.UntypedServiceImplementation {\n  unaryCall: grpc.handleUnaryCall<example_pb.ClientMessage, example_pb.ServerMessage>;\n  serverStreamingCall: grpc.handleServerStreamingCall<example_pb.ClientMessage, example_pb.ServerMessage>;\n  clientStreamingCall: grpc.handleClientStreamingCall<example_pb.ClientMessage, example_pb.ServerMessage>;\n  bidirectionalStreamingCall: grpc.handleBidiStreamingCall<example_pb.ClientMessage, example_pb.ServerMessage>;\n}\n\nexport class ExampleClient extends grpc.Client {\n  constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);\n  unaryCall(argument: example_pb.ClientMessage, callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  unaryCall(argument: example_pb.ClientMessage, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  unaryCall(argument: example_pb.ClientMessage, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  serverStreamingCall(argument: example_pb.ClientMessage, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream<example_pb.ServerMessage>;\n  serverStreamingCall(argument: example_pb.ClientMessage, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<example_pb.ServerMessage>;\n  clientStreamingCall(callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientWritableStream<example_pb.ClientMessage>;\n  clientStreamingCall(metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientWritableStream<example_pb.ClientMessage>;\n  clientStreamingCall(metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<example_pb.ServerMessage>): grpc.ClientWritableStream<example_pb.ClientMessage>;\n  bidirectionalStreamingCall(metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientDuplexStream<example_pb.ClientMessage, example_pb.ServerMessage>;\n  bidirectionalStreamingCall(metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientDuplexStream<example_pb.ClientMessage, example_pb.ServerMessage>;\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/proto/example_pb.d.ts",
    "content": "// package: example_package\n// file: example.proto\n\nimport * as jspb from \"google-protobuf\";\n\nexport class ServerMessage extends jspb.Message {\n  getServerMessage(): string;\n  setServerMessage(value: string): void;\n\n  serializeBinary(): Uint8Array;\n  toObject(includeInstance?: boolean): ServerMessage.AsObject;\n  static toObject(includeInstance: boolean, msg: ServerMessage): ServerMessage.AsObject;\n  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n  static serializeBinaryToWriter(message: ServerMessage, writer: jspb.BinaryWriter): void;\n  static deserializeBinary(bytes: Uint8Array): ServerMessage;\n  static deserializeBinaryFromReader(message: ServerMessage, reader: jspb.BinaryReader): ServerMessage;\n}\n\nexport namespace ServerMessage {\n  export type AsObject = {\n    serverMessage: string,\n  }\n}\n\nexport class ClientMessage extends jspb.Message {\n  getClientMessage(): string;\n  setClientMessage(value: string): void;\n\n  serializeBinary(): Uint8Array;\n  toObject(includeInstance?: boolean): ClientMessage.AsObject;\n  static toObject(includeInstance: boolean, msg: ClientMessage): ClientMessage.AsObject;\n  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n  static serializeBinaryToWriter(message: ClientMessage, writer: jspb.BinaryWriter): void;\n  static deserializeBinary(bytes: Uint8Array): ClientMessage;\n  static deserializeBinaryFromReader(message: ClientMessage, reader: jspb.BinaryReader): ClientMessage;\n}\n\nexport namespace ClientMessage {\n  export type AsObject = {\n    clientMessage: string,\n  }\n}\n\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/server.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleService, IExampleServer } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst exampleServer: IExampleServer = {\n  unaryCall(\n    call: grpc.ServerUnaryCall<ClientMessage, ServerMessage>,\n    callback: grpc.sendUnaryData<ServerMessage>\n  ) {\n    if (call.request) {\n      console.log(\n        `(server) Got client message: ${call.request.getClientMessage()}`\n      );\n    }\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    callback(null, serverMessage);\n  },\n\n  serverStreamingCall(\n    call: grpc.ServerWritableStream<ClientMessage, ServerMessage>\n  ) {\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n\n  clientStreamingCall(\n    call: grpc.ServerReadableStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n  },\n\n  bidirectionalStreamingCall(\n    call: grpc.ServerDuplexStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n};\n\nfunction getServer(): grpc.Server {\n  const server = new grpc.Server();\n  server.addService(ExampleService, exampleServer);\n  return server;\n}\n\nif (require.main === module) {\n  const server = getServer();\n  server.bindAsync(\n    host,\n    grpc.ServerCredentials.createInsecure(),\n    (err: Error | null, port: number) => {\n      if (err) {\n        console.error(`Server error: ${err.message}`);\n      } else {\n        console.log(`Server bound on port: ${port}`);\n        server.start();\n      }\n    }\n  );\n}\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/settings.gradle",
    "content": "/*\n * This file was generated by the Gradle 'init' task.\n *\n * The settings file is used to specify which projects to include in your build.\n *\n * Detailed information about configuring a multi-project build in Gradle can be found\n * in the user manual at https://docs.gradle.org/6.6.1/userguide/multi_project_builds.html\n */\n\nrootProject.name = 'gradle-ts-protoc-gen'\n"
  },
  {
    "path": "examples/gradle-ts-protoc-gen/tsconfig.json",
    "content": "{\n  \"extends\": \"@tsconfig/node12/tsconfig.json\",\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/.gitignore",
    "content": "node_modules\ngenerated\n*.js\n"
  },
  {
    "path": "examples/grpc-proto-loader/.npmrc",
    "content": "registry=https://registry.npmjs.org/"
  },
  {
    "path": "examples/grpc-proto-loader/.nvmrc",
    "content": "14\n"
  },
  {
    "path": "examples/grpc-proto-loader/.prettierignore",
    "content": "package-lock.json\ngenerated\n"
  },
  {
    "path": "examples/grpc-proto-loader/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"EditorConfig.EditorConfig\",\n    \"esbenp.prettier-vscode\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"zxh404.vscode-proto3\"\n  ]\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/.vscode/settings.json",
    "content": "{\n  \"typescript.tsc.autoDetect\": \"off\",\n  \"typescript.updateImportsOnFileMove.enabled\": \"always\",\n  \"files.insertFinalNewline\": true,\n  \"files.trimTrailingWhitespace\": true,\n  \"eslint.validate\": [\"javascript\", \"typescript\"],\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true\n  },\n  \"[markdown]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[json]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[yaml]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"cSpell.language\": \"en-GB\",\n  \"cSpell.words\": [\"grpc\", \"unary\", \"bidi\"]\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/README.md",
    "content": "# grpc-proto-loader example\n\nThis example shows how to use [`@grpc/proto-loader`](https://www.npmjs.com/package/@grpc/proto-loader) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) to build a fully typed CLI application that runs on Node.js.\n\n[`@grpc/proto-loader`](https://www.npmjs.com/package/@grpc/proto-loader) to used to [generate the types](https://github.com/grpc/grpc-node/pull/1474), as well as load the protobuf files at runtime using [`protobuf.js`](https://www.npmjs.com/package/protobufjs) instead of [`google-protobuf`](https://www.npmjs.com/package/google-protobuf).\n\n_No proto compiler is used. It's all JavaScript._\n\n## App layout\n\n- [package.json](./package.json) - Dependencies and build scripts\n- [proto/](./proto/) - Protobuf definitions and generated types\n- [server.ts](./server.ts) - The grpc server\n- [client.ts](./client.ts) - The grpc client\n\n## Generating the Types\n\nInstall dependencies:\n\n```sh\nnpm install\n```\n\nUse [`@grpc/proto-loader`](https://www.npmjs.com/package/@grpc/proto-loader) to generate the TypeScript files:\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\nThis is aliased as a npm script:\n\n```sh\nnpm run build:proto\n```\n\n### Running the App\n\nThis simple app demonstrates the different gRPC calls you can perform.\n\nFirst generated the types and build the application files:\n\n```sh\nnpm run build\n```\n\nStart the server:\n\n```sh\nnpm run start:server\n```\n\nNow run the client by specifying which example you want to run:\n\n```bash\nnpm run start:client -- --unary\nnpm run start:client -- --server-streaming\nnpm run start:client -- --client-streaming\nnpm run start:client -- --bidi-streaming\n```\n"
  },
  {
    "path": "examples/grpc-proto-loader/client.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport * as protoLoader from '@grpc/proto-loader';\nimport { ProtoGrpcType } from './proto/example';\nimport { ServerMessage } from './proto/example_package/ServerMessage';\n\nconst host = '0.0.0.0:9090';\nconst packageDefinition = protoLoader.loadSync('./proto/example.proto', {\n  longs: String,\n  enums: String,\n  defaults: true,\n  oneofs: true,\n});\nconst proto = grpc.loadPackageDefinition(\n  packageDefinition\n) as unknown as ProtoGrpcType;\n\nconst client = new proto.example_package.Example(\n  host,\n  grpc.credentials.createInsecure()\n);\n\nconst deadline = new Date();\ndeadline.setSeconds(deadline.getSeconds() + 5);\nclient.waitForReady(deadline, (error?: Error) => {\n  if (error) {\n    console.log(`Client connect error: ${error.message}`);\n  } else {\n    onClientReady();\n  }\n});\n\nfunction onClientReady() {\n  switch (process.argv[process.argv.length - 1]) {\n    case '--unary':\n      doUnaryCall();\n      break;\n    case '--server-streaming':\n      doServerStreamingCall();\n      break;\n    case '--client-streaming':\n      doClientStreamingCall();\n      break;\n    case '--bidi-streaming':\n      doBidirectionalStreamingCall();\n      break;\n    default:\n      throw new Error('Example not specified');\n  }\n}\n\nfunction doUnaryCall() {\n  client.unaryCall(\n    {\n      clientMessage: 'Message from client',\n    },\n    (error?: grpc.ServiceError | null, serverMessage?: ServerMessage) => {\n      if (error) {\n        console.error(error.message);\n      } else if (serverMessage) {\n        console.log(\n          `(client) Got server message: ${serverMessage.serverMessage}`\n        );\n      }\n    }\n  );\n}\n\nfunction doServerStreamingCall() {\n  const stream = client.serverStreamingCall({\n    clientMessage: 'Message from client',\n  });\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(`(client) Got server message: ${serverMessage.serverMessage}`);\n  });\n}\n\nfunction doClientStreamingCall() {\n  const stream = client.clientStreamingCall((error?: grpc.ServiceError | null) => {\n    if (error) {\n      console.error(error.message);\n    }\n  });\n  stream.write({\n    clientMessage: 'Message from client',\n  });\n}\n\nfunction doBidirectionalStreamingCall() {\n  const stream = client.bidirectionalStreamingCall();\n\n  // Server stream\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(`(client) Got server message: ${serverMessage.serverMessage}`);\n  });\n\n  // Client stream\n  stream.write({\n    clientMessage: 'Message from client',\n  });\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/package.json",
    "content": "{\n  \"name\": \"grpc-proto-loader-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"bugs\": {\n    \"url\": \"https://github.com/badsyntax/grpc-js-types/issues\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/badsyntax/grpc-js-types\"\n  },\n  \"scripts\": {\n    \"build\": \"npm run build:typescript\",\n    \"build:typescript\": \"tsc -p .\",\n    \"watch\": \"npm run build:typescript -- -w\",\n    \"build:proto\": \"proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=proto/ proto/*.proto\",\n    \"prewatch\": \"npm run build:proto\",\n    \"prebuild\": \"npm run build:proto\",\n    \"lint\": \"npm run lint:prettier && npm run lint:eslint\",\n    \"lint:prettier\": \"prettier --check \\\"**/*.{ts,js,json,svg,md,yml}\\\"\",\n    \"lint:eslint\": \"eslint . --ext .js,.ts\",\n    \"lint:fix\": \"npm run lint:fix:prettier && npm run lint:eslint -- --fix\",\n    \"lint:fix:prettier\": \"prettier --write '**/*.{ts,tsx,js,json,svg,md,yml}'\",\n    \"start:server\": \"node server\",\n    \"start:client\": \"node client\"\n  },\n  \"dependencies\": {\n    \"@grpc/grpc-js\": \"^1.6.8\",\n    \"@grpc/proto-loader\": \"^0.7.0\"\n  },\n  \"devDependencies\": {\n    \"@tsconfig/node12\": \"^1.0.11\",\n    \"@types/node\": \"^15.0.3\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.31.0\",\n    \"@typescript-eslint/parser\": \"^5.31.0\",\n    \"eslint\": \"^8.20.0\",\n    \"eslint-config-prettier\": \"^8.5.0\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.2.1\",\n    \"prettier\": \"^2.7.1\",\n    \"typescript\": \"^4.7.4\"\n  },\n  \"eslintConfig\": {\n    \"ignorePatterns\": [\n      \"**/*.js\",\n      \"proto/**/*.ts\"\n    ],\n    \"env\": {\n      \"browser\": false,\n      \"es6\": true,\n      \"node\": true\n    },\n    \"parserOptions\": {\n      \"project\": \"./tsconfig.json\",\n      \"ecmaVersion\": 2018,\n      \"sourceType\": \"module\"\n    },\n    \"extends\": [\n      \"plugin:@typescript-eslint/recommended\",\n      \"plugin:prettier/recommended\"\n    ]\n  },\n  \"prettier\": {\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"printWidth\": 80,\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/proto/example.proto",
    "content": "syntax = \"proto3\";\n\npackage example_package;\n\nmessage ServerMessage {\n  string server_message = 1;\n}\n\nmessage ClientMessage {\n  string client_message = 1;\n}\n\nservice Example {\n  rpc unaryCall(ClientMessage) returns (ServerMessage) {}\n  rpc serverStreamingCall(ClientMessage) returns (stream ServerMessage) {}\n  rpc clientStreamingCall(stream ClientMessage) returns (ServerMessage) {}\n  rpc bidirectionalStreamingCall(stream ClientMessage) returns (stream ServerMessage) {}\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/proto/example.ts",
    "content": "import type * as grpc from '@grpc/grpc-js';\nimport type { MessageTypeDefinition } from '@grpc/proto-loader';\n\nimport type { ExampleClient as _example_package_ExampleClient, ExampleDefinition as _example_package_ExampleDefinition } from './example_package/Example';\n\ntype SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {\n  new(...args: ConstructorParameters<Constructor>): Subtype;\n};\n\nexport interface ProtoGrpcType {\n  example_package: {\n    ClientMessage: MessageTypeDefinition\n    Example: SubtypeConstructor<typeof grpc.Client, _example_package_ExampleClient> & { service: _example_package_ExampleDefinition }\n    ServerMessage: MessageTypeDefinition\n  }\n}\n\n"
  },
  {
    "path": "examples/grpc-proto-loader/proto/example_package/ClientMessage.ts",
    "content": "// Original file: proto/example.proto\n\n\nexport interface ClientMessage {\n  'clientMessage'?: (string);\n}\n\nexport interface ClientMessage__Output {\n  'clientMessage': (string);\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/proto/example_package/Example.ts",
    "content": "// Original file: proto/example.proto\n\nimport type * as grpc from '@grpc/grpc-js'\nimport type { MethodDefinition } from '@grpc/proto-loader'\nimport type { ClientMessage as _example_package_ClientMessage, ClientMessage__Output as _example_package_ClientMessage__Output } from '../example_package/ClientMessage';\nimport type { ServerMessage as _example_package_ServerMessage, ServerMessage__Output as _example_package_ServerMessage__Output } from '../example_package/ServerMessage';\n\nexport interface ExampleClient extends grpc.Client {\n  bidirectionalStreamingCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_example_package_ClientMessage, _example_package_ServerMessage__Output>;\n  bidirectionalStreamingCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_example_package_ClientMessage, _example_package_ServerMessage__Output>;\n  bidirectionalStreamingCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_example_package_ClientMessage, _example_package_ServerMessage__Output>;\n  bidirectionalStreamingCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_example_package_ClientMessage, _example_package_ServerMessage__Output>;\n  \n  clientStreamingCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(metadata: grpc.Metadata, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(metadata: grpc.Metadata, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  clientStreamingCall(callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientWritableStream<_example_package_ClientMessage>;\n  \n  serverStreamingCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_example_package_ServerMessage__Output>;\n  serverStreamingCall(argument: _example_package_ClientMessage, options?: grpc.CallOptions): grpc.ClientReadableStream<_example_package_ServerMessage__Output>;\n  serverStreamingCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_example_package_ServerMessage__Output>;\n  serverStreamingCall(argument: _example_package_ClientMessage, options?: grpc.CallOptions): grpc.ClientReadableStream<_example_package_ServerMessage__Output>;\n  \n  unaryCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, metadata: grpc.Metadata, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, options: grpc.CallOptions, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  unaryCall(argument: _example_package_ClientMessage, callback: grpc.requestCallback<_example_package_ServerMessage__Output>): grpc.ClientUnaryCall;\n  \n}\n\nexport interface ExampleHandlers extends grpc.UntypedServiceImplementation {\n  bidirectionalStreamingCall: grpc.handleBidiStreamingCall<_example_package_ClientMessage__Output, _example_package_ServerMessage>;\n  \n  clientStreamingCall: grpc.handleClientStreamingCall<_example_package_ClientMessage__Output, _example_package_ServerMessage>;\n  \n  serverStreamingCall: grpc.handleServerStreamingCall<_example_package_ClientMessage__Output, _example_package_ServerMessage>;\n  \n  unaryCall: grpc.handleUnaryCall<_example_package_ClientMessage__Output, _example_package_ServerMessage>;\n  \n}\n\nexport interface ExampleDefinition extends grpc.ServiceDefinition {\n  bidirectionalStreamingCall: MethodDefinition<_example_package_ClientMessage, _example_package_ServerMessage, _example_package_ClientMessage__Output, _example_package_ServerMessage__Output>\n  clientStreamingCall: MethodDefinition<_example_package_ClientMessage, _example_package_ServerMessage, _example_package_ClientMessage__Output, _example_package_ServerMessage__Output>\n  serverStreamingCall: MethodDefinition<_example_package_ClientMessage, _example_package_ServerMessage, _example_package_ClientMessage__Output, _example_package_ServerMessage__Output>\n  unaryCall: MethodDefinition<_example_package_ClientMessage, _example_package_ServerMessage, _example_package_ClientMessage__Output, _example_package_ServerMessage__Output>\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/proto/example_package/ServerMessage.ts",
    "content": "// Original file: proto/example.proto\n\n\nexport interface ServerMessage {\n  'serverMessage'?: (string);\n}\n\nexport interface ServerMessage__Output {\n  'serverMessage': (string);\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/server.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport * as protoLoader from '@grpc/proto-loader';\nimport { ProtoGrpcType } from './proto/example';\nimport { ClientMessage } from './proto/example_package/ClientMessage';\nimport { ExampleHandlers } from './proto/example_package/Example';\nimport { ServerMessage } from './proto/example_package/ServerMessage';\n\nconst host = '0.0.0.0:9090';\n\nconst exampleServer: ExampleHandlers = {\n  unaryCall(\n    call: grpc.ServerUnaryCall<ClientMessage, ServerMessage>,\n    callback: grpc.sendUnaryData<ServerMessage>\n  ) {\n    if (call.request) {\n      console.log(`(server) Got client message: ${call.request.clientMessage}`);\n    }\n    callback(null, {\n      serverMessage: 'Message from server',\n    });\n  },\n\n  serverStreamingCall(\n    call: grpc.ServerWritableStream<ClientMessage, ServerMessage>\n  ) {\n    call.write({\n      serverMessage: 'Message from server',\n    });\n  },\n\n  clientStreamingCall(\n    call: grpc.ServerReadableStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.clientMessage}`\n      );\n    });\n  },\n\n  bidirectionalStreamingCall(\n    call: grpc.ServerDuplexStream<ClientMessage, ServerMessage>\n  ) {\n    call.write({\n      serverMessage: 'Message from server',\n    });\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.clientMessage}`\n      );\n    });\n  },\n};\n\nfunction getServer(): grpc.Server {\n  const packageDefinition = protoLoader.loadSync('./proto/example.proto', {\n    longs: String,\n    enums: String,\n    defaults: true,\n    oneofs: true,\n  });\n  const proto = grpc.loadPackageDefinition(\n    packageDefinition\n  ) as unknown as ProtoGrpcType;\n  const server = new grpc.Server();\n  server.addService(proto.example_package.Example.service, exampleServer);\n  return server;\n}\n\nif (require.main === module) {\n  const server = getServer();\n  server.bindAsync(\n    host,\n    grpc.ServerCredentials.createInsecure(),\n    (err: Error | null, port: number) => {\n      if (err) {\n        console.error(`Server error: ${err.message}`);\n      } else {\n        console.log(`Server bound on port: ${port}`);\n        server.start();\n      }\n    }\n  );\n}\n"
  },
  {
    "path": "examples/grpc-proto-loader/tsconfig.json",
    "content": "{\n  \"extends\": \"@tsconfig/node12/tsconfig.json\",\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "examples/grpc-web/.gitignore",
    "content": "node_modules\n*.js\nproto/*.ts\ndist/\n"
  },
  {
    "path": "examples/grpc-web/.npmrc",
    "content": "registry=https://registry.npmjs.org/"
  },
  {
    "path": "examples/grpc-web/.prettierignore",
    "content": "package-lock.json\ndist/\n"
  },
  {
    "path": "examples/grpc-web/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"EditorConfig.EditorConfig\",\n    \"esbenp.prettier-vscode\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"zxh404.vscode-proto3\"\n  ]\n}\n"
  },
  {
    "path": "examples/grpc-web/.vscode/settings.json",
    "content": "{\n  \"typescript.tsc.autoDetect\": \"off\",\n  \"typescript.updateImportsOnFileMove.enabled\": \"always\",\n  \"files.insertFinalNewline\": true,\n  \"files.trimTrailingWhitespace\": true,\n  \"eslint.validate\": [\"javascript\", \"typescript\"],\n  \"editor.formatOnSave\": false,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true,\n    \"source.organizeImports\": false\n  },\n  \"[markdown]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[json]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[yaml]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"cSpell.language\": \"en-GB\",\n  \"cSpell.words\": [\"grpc\"]\n}\n"
  },
  {
    "path": "examples/grpc-web/README.md",
    "content": "# grpc-web\n\nThis examples shows how to use the [proto compiler](https://www.npmjs.com/package/grpc-tools), [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen), [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js), [`protoc-gen-grpc-web`](https://www.npmjs.com/package/protoc-gen-grpc-web) & [`grpc-web`](https://www.npmjs.com/package/grpc-web) to build a fully typed gRPC CLI chat application that runs on Node.js and your browser.\n\nThe [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) compiler plugin is used to generate TypeScript files and the [`protoc-gen-grpc-web`](https://www.npmjs.com/package/protoc-gen-grpc-web) compiler plugin is used to generate the grpc-web files from the proto definitions. The generated code uses [`google-protobuf`](https://www.npmjs.com/package/google-protobuf) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) at runtime.\n\n## App layout\n\n- [package.json](./package.json) - Dependencies and node build scripts\n- [compile-proto.sh](./compile-proto.sh) - The proto compiler script\n- [proto/](./proto/) - Protobuf definitions and generated types\n- [server.ts](./server.ts) - The grpc server\n- [client.ts](./client.ts) - The grpc client\n\n## Generating the Types\n\n```sh\nnpm install\n\n# Apple M1 users should install for x64 due to grpc-tools not supporting arm64\nnpm install --target_arch=x64\n\n./compile-proto.sh\n```\n\n### Running the app\n\n(Note, docker is required to run the envoy proxy.)\n\nRun the demo:\n\n```bash\nnpm install\nnpm run build\nnpm run start:proxy\nnpm run start:server\npython3 -m http.server 8081\n```\n\nOpen http://localhost:8081/ in multiple browser windows and chat to yourself.\n\nDevelopment workflow:\n\n```bash\nnpm run watch:typescript\nnpm run watch:webpack\nnpm run start:proxy\nnpm run start:server\npython3 -m http.server 8081\n```\n\n## Credits\n\nThe chat application idea is inspired from https://techblog.fexcofts.com/2018/07/20/grpc-nodejs-chat-example/\n"
  },
  {
    "path": "examples/grpc-web/client.ts",
    "content": "/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { RpcError as GrpcWebError } from 'grpc-web';\nimport { ChatClient } from './proto/chat_grpc_web_pb';\nimport { ClientMessage, ServerMessage } from './proto/chat_pb';\n\nlet user: string;\n\nwindow.addEventListener('DOMContentLoaded', () => {\n  document.getElementById('submit-name')?.addEventListener(\n    'submit',\n    async (e) => {\n      e.preventDefault();\n      user = (document.getElementById('name') as HTMLFormElement)?.value;\n      if (user) {\n        document.getElementById('submit-message')!.style.display = 'block';\n        document.getElementById('submit-name')!.style.display = 'none';\n        initChat(user);\n      }\n    },\n    false\n  );\n});\n\nasync function initChat(user: string) {\n  const client = new ChatClient('http://' + window.location.hostname + ':8080');\n\n  const clientMessage = new ClientMessage();\n  clientMessage.setUser(user);\n\n  const stream = client.join(clientMessage);\n  stream.on('data', (message: ServerMessage) => {\n    const messageElement = document.createElement('div');\n    messageElement.innerText = `${message.getUser()}: ${message.getText()}`;\n    document.getElementById('messages')!.appendChild(messageElement);\n  });\n\n  function sendMessage(message: string) {\n    const clientMessage = new ClientMessage();\n    clientMessage.setUser(user);\n    clientMessage.setText(message);\n    client.send(\n      clientMessage,\n      undefined,\n      (err: GrpcWebError, response: ServerMessage) => {\n        if (err) {\n          console.error(err);\n        } else {\n          console.log('response', response.toObject());\n          (document.getElementById('message') as HTMLFormElement)!.value = '';\n        }\n      }\n    );\n  }\n\n  document.getElementById('submit-message')?.addEventListener(\n    'submit',\n    (e) => {\n      e.preventDefault();\n      const message = (document.getElementById('message') as HTMLFormElement)\n        ?.value;\n      sendMessage(message);\n    },\n    false\n  );\n}\n"
  },
  {
    "path": "examples/grpc-web/compile-proto.sh",
    "content": "#!/usr/bin/env bash\n\nOUT_DIR=\".\"\nTS_OUT_DIR=\".\"\nIN_DIR=\"./proto\"\nPROTOC=\"$(npm bin)/grpc_tools_node_protoc\"\nPROTOC_GEN_TS_PATH=\"$(npm bin)/protoc-gen-ts\"\nPROTOC_GEN_GRPC_PATH=\"$(npm bin)/grpc_tools_node_protoc_plugin\"\nPROTOC_GEN_GRPC_WEB_PATH=\"$(npm bin)/protoc-gen-grpc-web\"\n\n# generate grpc-web files & types\n$PROTOC \\\n    -I=\"./\" \\\n    --plugin=protoc-gen-grpc-web=${PROTOC_GEN_GRPC_WEB_PATH} \\\n    --js_out=import_style=commonjs:$OUT_DIR \\\n    --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:$OUT_DIR \\\n    \"$IN_DIR\"/*.proto\n\n# generate grpc-js files & types\n$PROTOC \\\n    -I=\"./\" \\\n    --plugin=protoc-gen-ts=$PROTOC_GEN_TS_PATH \\\n    --plugin=protoc-gen-grpc=${PROTOC_GEN_GRPC_PATH} \\\n    --js_out=import_style=commonjs:$OUT_DIR \\\n    --ts_out=service=grpc-node,mode=grpc-js:$TS_OUT_DIR \\\n    --grpc_out=grpc_js:$OUT_DIR \\\n    \"$IN_DIR\"/*.proto\n"
  },
  {
    "path": "examples/grpc-web/envoy.yaml",
    "content": "static_resources:\n  listeners:\n  - name: listener_0\n    address:\n      socket_address: { address: 0.0.0.0, port_value: 8080 }\n    filter_chains:\n    - filters:\n      - name: envoy.http_connection_manager\n        config:\n          codec_type: auto\n          stat_prefix: ingress_http\n          route_config:\n            name: local_route\n            virtual_hosts:\n            - name: local_service\n              domains: [\"*\"]\n              routes:\n              - match: { prefix: \"/\" }\n                route:\n                  cluster: greeter_service\n                  max_grpc_timeout: 0s\n              cors:\n                allow_origin_string_match:\n                - prefix: \"*\"\n                allow_methods: GET, PUT, DELETE, POST, OPTIONS\n                allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout\n                max_age: \"1728000\"\n                expose_headers: custom-header-1,grpc-status,grpc-message\n          http_filters:\n          - name: envoy.grpc_web\n          - name: envoy.cors\n          - name: envoy.router\n  clusters:\n  - name: greeter_service\n    connect_timeout: 0.25s\n    type: logical_dns\n    http2_protocol_options: {}\n    lb_policy: round_robin\n    hosts: [{ socket_address: { address: host.docker.internal, port_value: 9090 }}]\n"
  },
  {
    "path": "examples/grpc-web/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>gRPC-Web Example</title>\n    <script src=\"./dist/main.js\"></script>\n    <style type=\"text/css\">\n      #submit-message {\n        display: none;\n      }\n      #messages {\n        margin-bottom: 0.5rem;\n      }\n      .container {\n        display: flex;\n        flex-direction: column;\n        margin: 2rem;\n      }\n    </style>\n  </head>\n  <body>\n    <section class=\"container\">\n      <div id=\"messages\"></div>\n      <form id=\"submit-name\" action=\"#\">\n        <p>Enter your name to join the chat</p>\n        <input autofocus placeholder=\"Enter your name...\" type=\"text\" id=\"name\" />\n        <button type=\"submit\">Submit</button>\n      </form>\n      <form id=\"submit-message\" action=\"#\">\n        Chat\n        <input autofocus placeholder=\"Type a message...\" id=\"message\" type=\"text\" />\n        <button type=\"submit\">Submit</button>\n      </form>\n    </section>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/grpc-web/package.json",
    "content": "{\n  \"name\": \"grpc-web-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"npm run build:typescript && npm run build:webpack\",\n    \"build:typescript\": \"tsc -p .\",\n    \"build:proto\": \"./compile-proto.sh\",\n    \"build:webpack\": \"webpack ./client.js -c webpack.config.js\",\n    \"watch:typescript\": \"npm run build:typescript -- -w\",\n    \"watch:webpack\": \"npm run build:webpack -- -w\",\n    \"prebuild\": \"npm run build:proto\",\n    \"lint\": \"npm run lint:prettier && npm run lint:eslint\",\n    \"lint:prettier\": \"prettier --check \\\"**/*.{ts,js,json,svg,md,yml}\\\"\",\n    \"lint:eslint\": \"eslint . --ext .js,.ts\",\n    \"lint:fix\": \"npm run lint:fix:prettier && npm run lint:eslint -- --fix\",\n    \"lint:fix:prettier\": \"prettier --write '**/*.{ts,tsx,js,json,svg,md,yml}'\",\n    \"start:server\": \"node server\",\n    \"start:proxy\": \"docker run -d -p 8080:8080 -v \\\"$(pwd)\\\"/envoy.yaml:/etc/envoy/envoy.yaml:ro envoyproxy/envoy:v1.15.0\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"@grpc/grpc-js\": \"^1.6.8\",\n    \"@grpc/proto-loader\": \"^0.7.0\",\n    \"@tsconfig/node12\": \"^1.0.11\",\n    \"@types/google-protobuf\": \"^3.15.6\",\n    \"@types/node\": \"^14.14.14\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.31.0\",\n    \"@typescript-eslint/parser\": \"^5.31.0\",\n    \"eslint\": \"^8.20.0\",\n    \"eslint-config-prettier\": \"^8.5.0\",\n    \"eslint-plugin-import\": \"^2.26.0\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.2.1\",\n    \"google-protobuf\": \"^3.21.0\",\n    \"grpc-tools\": \"^1.11.2\",\n    \"grpc-web\": \"^1.3.1\",\n    \"prettier\": \"^2.7.1\",\n    \"prettier-plugin-organize-imports\": \"^3.0.0\",\n    \"protoc-gen-grpc-web\": \"^1.4.0\",\n    \"ts-protoc-gen\": \"^0.15.0\",\n    \"typescript\": \"^4.7.4\",\n    \"webpack\": \"^5.74.0\",\n    \"webpack-cli\": \"^4.10.0\"\n  },\n  \"eslintConfig\": {\n    \"ignorePatterns\": [\n      \"**/*.js\",\n      \"proto/*.ts\",\n      \"generated\"\n    ],\n    \"env\": {\n      \"browser\": false,\n      \"es6\": true,\n      \"node\": true\n    },\n    \"parserOptions\": {\n      \"project\": \"./tsconfig.json\",\n      \"ecmaVersion\": 2018,\n      \"sourceType\": \"module\"\n    },\n    \"extends\": [\n      \"plugin:@typescript-eslint/recommended\",\n      \"prettier/@typescript-eslint\",\n      \"plugin:prettier/recommended\",\n      \"plugin:import/errors\",\n      \"plugin:import/warnings\",\n      \"plugin:import/typescript\"\n    ]\n  },\n  \"prettier\": {\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"printWidth\": 80,\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "examples/grpc-web/proto/chat.proto",
    "content": "syntax = \"proto3\";\n\npackage chat_package;\n\nmessage ServerMessage {\n  string user = 1;\n  string text = 2;\n}\n\nmessage ClientMessage {\n  string user = 1;\n  string text = 2;\n}\n\nservice Chat {\n  rpc join(ClientMessage) returns (stream ServerMessage) {}\n  rpc send(ClientMessage) returns (ServerMessage) {}\n}\n"
  },
  {
    "path": "examples/grpc-web/server.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ChatService, IChatServer } from './proto/chat_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/chat_pb';\n\nconst users: grpc.ServerWritableStream<ClientMessage, ServerMessage>[] = [];\nconst messages: ClientMessage[] = [];\n\nfunction notifyChat(message: ServerMessage) {\n  messages.push(message);\n  users.forEach((user) => {\n    user.write(message);\n  });\n}\n\nconst chatServer: IChatServer = {\n  join(call: grpc.ServerWritableStream<ClientMessage, ServerMessage>): void {\n    users.push(call);\n    const serverMessage = new ServerMessage();\n    serverMessage.setUser('Server');\n    serverMessage.setText(`${call.request?.getUser()} joined`);\n    notifyChat(serverMessage);\n  },\n  send(\n    call: grpc.ServerUnaryCall<ClientMessage, ServerMessage>,\n    callback: grpc.sendUnaryData<ServerMessage>\n  ): void {\n    if (call.request) {\n      const serverMessage = new ServerMessage();\n      serverMessage.setUser(call.request.getUser());\n      serverMessage.setText(call.request.getText());\n      notifyChat(serverMessage);\n      callback(null, serverMessage);\n    }\n  },\n};\n\nexport function getServer(): grpc.Server {\n  const server = new grpc.Server();\n  server.addService(ChatService, chatServer);\n  return server;\n}\n\nif (require.main === module) {\n  const server = getServer();\n  server.bindAsync(\n    '0.0.0.0:9090',\n    grpc.ServerCredentials.createInsecure(),\n    (err: Error | null, port: number) => {\n      if (err) {\n        console.error(`Server error: ${err.message}`);\n      } else {\n        console.log(`Server bound on port: ${port}`);\n        server.start();\n      }\n    }\n  );\n}\n"
  },
  {
    "path": "examples/grpc-web/tsconfig.json",
    "content": "{\n  \"extends\": \"@tsconfig/node12/tsconfig.json\",\n  \"compilerOptions\": {\n    \"lib\": [\"DOM\"]\n  },\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "examples/grpc-web/webpack.config.ts",
    "content": "import * as path from 'path';\n\nexport default {\n  mode: 'production',\n  entry: {\n    index: './client.js',\n  },\n  output: {\n    filename: '[name].js',\n    chunkFilename: '[name].js',\n    path: path.resolve(__dirname, 'dist'),\n  },\n};\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/.gitignore",
    "content": "node_modules\n**/*.js\n!proto/*.js\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/.npmrc",
    "content": "registry=https://registry.npmjs.org/"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/.prettierignore",
    "content": "package-lock.json\nproto/*.ts\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"EditorConfig.EditorConfig\",\n    \"esbenp.prettier-vscode\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"zxh404.vscode-proto3\"\n  ]\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/.vscode/settings.json",
    "content": "{\n  \"typescript.tsc.autoDetect\": \"off\",\n  \"typescript.updateImportsOnFileMove.enabled\": \"always\",\n  \"files.insertFinalNewline\": true,\n  \"files.trimTrailingWhitespace\": true,\n  \"eslint.validate\": [\"javascript\", \"typescript\"],\n  \"editor.formatOnSave\": false,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true,\n    \"source.organizeImports\": false\n  },\n  \"[markdown]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[json]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[yaml]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"cSpell.language\": \"en-GB\",\n  \"cSpell.words\": [\n    \"Unary\",\n    \"grpc\"\n  ]\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/README.md",
    "content": "# grpc_tools_node_protoc_ts example\n\nThis example shows how to use the [proto compiler](https://www.npmjs.com/package/grpc-tools), [`grpc_tools_node_protoc_ts`](https://www.npmjs.com/package/grpc_tools_node_protoc_ts) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) to build a fully typed gRPC application that runs on Node.js.\n\nThe [proto compiler](https://www.npmjs.com/package/grpc-tools) and [`grpc_tools_node_protoc_ts`](https://www.npmjs.com/package/grpc_tools_node_protoc_ts) compiler plugin are used to generate JavaScript & TypeScript files from the proto definitions and [`google-protobuf`](https://www.npmjs.com/package/google-protobuf) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) is used at runtime.\n\n## App layout\n\n- [package.json](./package.json) - Dependencies and node build scripts\n- [compile-proto.sh](./compile-proto.sh) - The proto compiler script\n- [server.ts](./server.ts) - The grpc server\n- [client.ts](./client.ts) - The grpc client\n\n## Generating the Types\n\nInstall dependencies:\n\n```sh\nnpm install\n\n# Apple M1 users should install for x64 due to grpc-tools not supporting arm64\nnpm i --target_arch=x64\n```\n\nUse [`grpc_tools_node_protoc_ts`](https://www.npmjs.com/package/grpc_tools_node_protoc_ts) to generate the TypeScript files:\n\n```sh\n./compile-proto.sh\n```\n\nThis is aliased as a npm script:\n\n```sh\nnpm run build:proto\n```\n\n### Running the App\n\nThis simple app demonstrates the different gRPC calls you can perform.\n\nFirst generated the types and build the application files:\n\n```sh\nnpm run build\n```\n\nStart the server:\n\n```sh\nnpm run start:server\n```\n\nNow run the client by specifying which example you want to run:\n\n```bash\nnpm run start:client -- --unary\nnpm run start:client -- --server-streaming\nnpm run start:client -- --client-streaming\nnpm run start:client -- --bidi-streaming\n```\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/client.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleClient } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst client = new ExampleClient(host, grpc.credentials.createInsecure());\n\nconst deadline = new Date();\ndeadline.setSeconds(deadline.getSeconds() + 5);\nclient.waitForReady(deadline, (error?: Error) => {\n  if (error) {\n    console.log(`Client connect error: ${error.message}`);\n  } else {\n    onClientReady();\n  }\n});\n\nfunction onClientReady() {\n  switch (process.argv[process.argv.length - 1]) {\n    case '--unary':\n      doUnaryCall();\n      break;\n    case '--server-streaming':\n      doServerStreamingCall();\n      break;\n    case '--client-streaming':\n      doClientStreamingCall();\n      break;\n    case '--bidi-streaming':\n      doBidirectionalStreamingCall();\n      break;\n    default:\n      throw new Error('Example not specified');\n  }\n}\n\nfunction doUnaryCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  client.unaryCall(\n    clientMessage,\n    (error: grpc.ServiceError | null, serverMessage?: ServerMessage) => {\n      if (error) {\n        console.error(error.message);\n      } else if (serverMessage) {\n        console.log(\n          `(client) Got server message: ${serverMessage.getServerMessage()}`\n        );\n      }\n    }\n  );\n}\n\nfunction doServerStreamingCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  const stream = client.serverStreamingCall(clientMessage);\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n}\n\nfunction doClientStreamingCall() {\n  const stream = client.clientStreamingCall(\n    (error: grpc.ServiceError | null) => {\n      if (error) {\n        console.error(error.message);\n      }\n    }\n  );\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n\nfunction doBidirectionalStreamingCall() {\n  const stream = client.bidirectionalStreamingCall();\n\n  // Server stream\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n\n  // Client stream\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/compile-proto.sh",
    "content": "#!/usr/bin/env bash\n\nOUT_DIR=\".\"\nTS_OUT_DIR=\".\"\nIN_DIR=\"./proto\"\nPROTOC=\"$(npm bin)/grpc_tools_node_protoc\"\nPROTOC_GEN_TS_PATH=\"$(npm bin)/protoc-gen-ts\"\nPROTOC_GEN_GRPC_PATH=\"$(npm bin)/grpc_tools_node_protoc_plugin\"\n\n$PROTOC \\\n    -I=\"./\" \\\n    --plugin=protoc-gen-ts=$PROTOC_GEN_TS_PATH \\\n    --plugin=protoc-gen-grpc=${PROTOC_GEN_GRPC_PATH} \\\n    --js_out=import_style=commonjs:$OUT_DIR \\\n    --grpc_out=grpc_js:$OUT_DIR \\\n    --ts_out=grpc_js:$TS_OUT_DIR \\\n    \"$IN_DIR\"/*.proto\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/package.json",
    "content": "{\n  \"name\": \"grpc-js-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"build\": \"npm run build:typescript\",\n    \"build:typescript\": \"tsc -p .\",\n    \"build:proto\": \"./compile-proto.sh\",\n    \"watch\": \"npm run build:typescript -- -w\",\n    \"prewatch\": \"npm run build:proto\",\n    \"prebuild\": \"npm run build:proto\",\n    \"lint\": \"npm run lint:prettier && npm run lint:eslint\",\n    \"lint:prettier\": \"prettier --check \\\"**/*.{ts,js,json,svg,md,yml}\\\"\",\n    \"lint:eslint\": \"eslint . --ext .js,.ts\",\n    \"lint:fix\": \"npm run lint:fix:prettier && npm run lint:eslint -- --fix\",\n    \"lint:fix:prettier\": \"prettier --write '**/*.{ts,tsx,js,json,svg,md,yml}'\",\n    \"start:server\": \"node server\",\n    \"start:client\": \"node client\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@grpc/grpc-js\": \"^1.6.8\",\n    \"google-protobuf\": \"^3.21.0\"\n  },\n  \"devDependencies\": {\n    \"@tsconfig/node12\": \"^1.0.11\",\n    \"@types/google-protobuf\": \"^3.15.6\",\n    \"@types/node\": \"^15.0.3\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.31.0\",\n    \"@typescript-eslint/parser\": \"^5.31.0\",\n    \"eslint\": \"^8.20.0\",\n    \"eslint-config-prettier\": \"^8.5.0\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.2.1\",\n    \"grpc_tools_node_protoc_ts\": \"^5.3.2\",\n    \"grpc-tools\": \"^1.11.2\",\n    \"prettier\": \"^2.7.1\",\n    \"typescript\": \"^4.7.4\"\n  },\n  \"eslintConfig\": {\n    \"ignorePatterns\": [\n      \"**/*.js\",\n      \"proto/*.ts\"\n    ],\n    \"env\": {\n      \"browser\": false,\n      \"es6\": true,\n      \"node\": true\n    },\n    \"parserOptions\": {\n      \"project\": \"./tsconfig.json\",\n      \"ecmaVersion\": 2018,\n      \"sourceType\": \"module\"\n    },\n    \"extends\": [\n      \"plugin:@typescript-eslint/recommended\",\n      \"plugin:prettier/recommended\"\n    ]\n  },\n  \"prettier\": {\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"printWidth\": 80,\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/proto/example.proto",
    "content": "syntax = \"proto3\";\n\npackage example_package;\n\nmessage ServerMessage {\n  string server_message = 1;\n}\n\nmessage ClientMessage {\n  string client_message = 1;\n}\n\nservice Example {\n  rpc unaryCall(ClientMessage) returns (ServerMessage) {}\n  rpc serverStreamingCall(ClientMessage) returns (stream ServerMessage) {}\n  rpc clientStreamingCall(stream ClientMessage) returns (ServerMessage) {}\n  rpc bidirectionalStreamingCall(stream ClientMessage) returns (stream ServerMessage) {}\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/proto/example_grpc_pb.d.ts",
    "content": "// package: example_package\n// file: proto/example.proto\n\n/* tslint:disable */\n/* eslint-disable */\n\nimport * as grpc from \"@grpc/grpc-js\";\nimport * as proto_example_pb from \"../proto/example_pb\";\n\ninterface IExampleService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {\n    unaryCall: IExampleService_IunaryCall;\n    serverStreamingCall: IExampleService_IserverStreamingCall;\n    clientStreamingCall: IExampleService_IclientStreamingCall;\n    bidirectionalStreamingCall: IExampleService_IbidirectionalStreamingCall;\n}\n\ninterface IExampleService_IunaryCall extends grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage> {\n    path: \"/example_package.Example/unaryCall\";\n    requestStream: false;\n    responseStream: false;\n    requestSerialize: grpc.serialize<proto_example_pb.ClientMessage>;\n    requestDeserialize: grpc.deserialize<proto_example_pb.ClientMessage>;\n    responseSerialize: grpc.serialize<proto_example_pb.ServerMessage>;\n    responseDeserialize: grpc.deserialize<proto_example_pb.ServerMessage>;\n}\ninterface IExampleService_IserverStreamingCall extends grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage> {\n    path: \"/example_package.Example/serverStreamingCall\";\n    requestStream: false;\n    responseStream: true;\n    requestSerialize: grpc.serialize<proto_example_pb.ClientMessage>;\n    requestDeserialize: grpc.deserialize<proto_example_pb.ClientMessage>;\n    responseSerialize: grpc.serialize<proto_example_pb.ServerMessage>;\n    responseDeserialize: grpc.deserialize<proto_example_pb.ServerMessage>;\n}\ninterface IExampleService_IclientStreamingCall extends grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage> {\n    path: \"/example_package.Example/clientStreamingCall\";\n    requestStream: true;\n    responseStream: false;\n    requestSerialize: grpc.serialize<proto_example_pb.ClientMessage>;\n    requestDeserialize: grpc.deserialize<proto_example_pb.ClientMessage>;\n    responseSerialize: grpc.serialize<proto_example_pb.ServerMessage>;\n    responseDeserialize: grpc.deserialize<proto_example_pb.ServerMessage>;\n}\ninterface IExampleService_IbidirectionalStreamingCall extends grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage> {\n    path: \"/example_package.Example/bidirectionalStreamingCall\";\n    requestStream: true;\n    responseStream: true;\n    requestSerialize: grpc.serialize<proto_example_pb.ClientMessage>;\n    requestDeserialize: grpc.deserialize<proto_example_pb.ClientMessage>;\n    responseSerialize: grpc.serialize<proto_example_pb.ServerMessage>;\n    responseDeserialize: grpc.deserialize<proto_example_pb.ServerMessage>;\n}\n\nexport const ExampleService: IExampleService;\n\nexport interface IExampleServer extends grpc.UntypedServiceImplementation {\n    unaryCall: grpc.handleUnaryCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    serverStreamingCall: grpc.handleServerStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    clientStreamingCall: grpc.handleClientStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    bidirectionalStreamingCall: grpc.handleBidiStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n\nexport interface IExampleClient {\n    unaryCall(request: proto_example_pb.ClientMessage, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    unaryCall(request: proto_example_pb.ClientMessage, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    unaryCall(request: proto_example_pb.ClientMessage, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    serverStreamingCall(request: proto_example_pb.ClientMessage, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n    serverStreamingCall(request: proto_example_pb.ClientMessage, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n    clientStreamingCall(callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    clientStreamingCall(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    clientStreamingCall(options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    clientStreamingCall(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    bidirectionalStreamingCall(): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    bidirectionalStreamingCall(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    bidirectionalStreamingCall(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n\nexport class ExampleClient extends grpc.Client implements IExampleClient {\n    constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial<grpc.ClientOptions>);\n    public unaryCall(request: proto_example_pb.ClientMessage, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    public unaryCall(request: proto_example_pb.ClientMessage, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    public unaryCall(request: proto_example_pb.ClientMessage, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientUnaryCall;\n    public serverStreamingCall(request: proto_example_pb.ClientMessage, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n    public serverStreamingCall(request: proto_example_pb.ClientMessage, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n    public clientStreamingCall(callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    public clientStreamingCall(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    public clientStreamingCall(options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    public clientStreamingCall(metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: proto_example_pb.ServerMessage) => void): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n    public bidirectionalStreamingCall(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n    public bidirectionalStreamingCall(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/proto/example_pb.d.ts",
    "content": "// package: example_package\n// file: proto/example.proto\n\n/* tslint:disable */\n/* eslint-disable */\n\nimport * as jspb from \"google-protobuf\";\n\nexport class ServerMessage extends jspb.Message { \n    getServerMessage(): string;\n    setServerMessage(value: string): ServerMessage;\n\n    serializeBinary(): Uint8Array;\n    toObject(includeInstance?: boolean): ServerMessage.AsObject;\n    static toObject(includeInstance: boolean, msg: ServerMessage): ServerMessage.AsObject;\n    static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n    static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n    static serializeBinaryToWriter(message: ServerMessage, writer: jspb.BinaryWriter): void;\n    static deserializeBinary(bytes: Uint8Array): ServerMessage;\n    static deserializeBinaryFromReader(message: ServerMessage, reader: jspb.BinaryReader): ServerMessage;\n}\n\nexport namespace ServerMessage {\n    export type AsObject = {\n        serverMessage: string,\n    }\n}\n\nexport class ClientMessage extends jspb.Message { \n    getClientMessage(): string;\n    setClientMessage(value: string): ClientMessage;\n\n    serializeBinary(): Uint8Array;\n    toObject(includeInstance?: boolean): ClientMessage.AsObject;\n    static toObject(includeInstance: boolean, msg: ClientMessage): ClientMessage.AsObject;\n    static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n    static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n    static serializeBinaryToWriter(message: ClientMessage, writer: jspb.BinaryWriter): void;\n    static deserializeBinary(bytes: Uint8Array): ClientMessage;\n    static deserializeBinaryFromReader(message: ClientMessage, reader: jspb.BinaryReader): ClientMessage;\n}\n\nexport namespace ClientMessage {\n    export type AsObject = {\n        clientMessage: string,\n    }\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/server.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleService, IExampleServer } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst exampleServer: IExampleServer = {\n  unaryCall(\n    call: grpc.ServerUnaryCall<ClientMessage, ServerMessage>,\n    callback: grpc.sendUnaryData<ServerMessage>\n  ) {\n    if (call.request) {\n      console.log(\n        `(server) Got client message: ${call.request.getClientMessage()}`\n      );\n    }\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    callback(null, serverMessage);\n  },\n\n  serverStreamingCall(\n    call: grpc.ServerWritableStream<ClientMessage, ServerMessage>\n  ) {\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n\n  clientStreamingCall(\n    call: grpc.ServerReadableStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n  },\n\n  bidirectionalStreamingCall(\n    call: grpc.ServerDuplexStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n};\n\nfunction getServer(): grpc.Server {\n  const server = new grpc.Server();\n  server.addService(ExampleService, exampleServer);\n  return server;\n}\n\nif (require.main === module) {\n  const server = getServer();\n  server.bindAsync(\n    host,\n    grpc.ServerCredentials.createInsecure(),\n    (err: Error | null, port: number) => {\n      if (err) {\n        console.error(`Server error: ${err.message}`);\n      } else {\n        console.log(`Server bound on port: ${port}`);\n        server.start();\n      }\n    }\n  );\n}\n"
  },
  {
    "path": "examples/grpc_tools_node_protoc_ts/tsconfig.json",
    "content": "{\n  \"extends\": \"@tsconfig/node12/tsconfig.json\",\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/.gitignore",
    "content": "node_modules\n*.js\n!proto/*.js\n"
  },
  {
    "path": "examples/ts-protoc-gen/.npmrc",
    "content": "registry=https://registry.npmjs.org/"
  },
  {
    "path": "examples/ts-protoc-gen/.prettierignore",
    "content": "package-lock.json\nproto/*.ts\n"
  },
  {
    "path": "examples/ts-protoc-gen/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"EditorConfig.EditorConfig\",\n    \"esbenp.prettier-vscode\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"zxh404.vscode-proto3\"\n  ]\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/.vscode/settings.json",
    "content": "{\n  \"typescript.tsc.autoDetect\": \"off\",\n  \"typescript.updateImportsOnFileMove.enabled\": \"always\",\n  \"files.insertFinalNewline\": true,\n  \"files.trimTrailingWhitespace\": true,\n  \"eslint.validate\": [\"javascript\", \"typescript\"],\n  \"editor.formatOnSave\": false,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true,\n    \"source.organizeImports\": false\n  },\n  \"[markdown]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[json]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"[yaml]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  },\n  \"cSpell.language\": \"en-GB\",\n  \"cSpell.words\": [\"grpc\"]\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/README.md",
    "content": "# ts-protoc-gen\n\nThis examples shows how to use the [proto compiler](https://www.npmjs.com/package/grpc-tools), [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) to build a fully typed gRPC CLI application that runs on Node.js.\n\nThe [proto compiler](https://www.npmjs.com/package/grpc-tools) and [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) compiler plugin are used to generate JavaScript & TypeScript files from the proto definitions.\n\n[`google-protobuf`](https://www.npmjs.com/package/google-protobuf) & [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) are used at runtime.\n\n## App layout\n\n- [package.json](./package.json) - Dependencies and node build scripts\n- [compile-proto.sh](./compile-proto.sh) - The proto compiler script\n- [proto/](./proto/) - Protobuf definitions and generated types\n- [server.ts](./server.ts) - The grpc server\n- [client.ts](./client.ts) - The grpc client\n\n## Generating the Types\n\nInstall dependencies:\n\n```sh\nnpm install\n\n# Apple M1 users should install for x64 due to grpc-tools not supporting arm64\nnpm install --target_arch=x64\n```\n\nUse [proto compiler](https://www.npmjs.com/package/grpc-tools) and [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) to generate the TypeScript files:\n\n```sh\n./compile-proto.sh\n```\n\nThis is aliased as a npm script:\n\n```sh\nnpm run build:proto\n```\n\n### Running the App\n\nThis simple app demonstrates the different gRPC calls you can perform.\n\nFirst generate the types and build the application files:\n\n```sh\nnpm run build\n```\n\nStart the server:\n\n```sh\nnpm run start:server\n```\n\nNow run the client by specifying which example you want to run:\n\n```bash\nnpm run start:client -- --unary\nnpm run start:client -- --server-streaming\nnpm run start:client -- --client-streaming\nnpm run start:client -- --bidi-streaming\n```\n"
  },
  {
    "path": "examples/ts-protoc-gen/client.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleClient } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst client = new ExampleClient(host, grpc.credentials.createInsecure());\n\nconst deadline = new Date();\ndeadline.setSeconds(deadline.getSeconds() + 5);\nclient.waitForReady(deadline, (error?: Error) => {\n  if (error) {\n    console.log(`Client connect error: ${error.message}`);\n  } else {\n    onClientReady();\n  }\n});\n\nfunction onClientReady() {\n  switch (process.argv[process.argv.length - 1]) {\n    case '--unary':\n      doUnaryCall();\n      break;\n    case '--server-streaming':\n      doServerStreamingCall();\n      break;\n    case '--client-streaming':\n      doClientStreamingCall();\n      break;\n    case '--bidi-streaming':\n      doBidirectionalStreamingCall();\n      break;\n    default:\n      throw new Error('Example not specified');\n  }\n}\n\nfunction doUnaryCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  client.unaryCall(\n    clientMessage,\n    (error: grpc.ServiceError | null, serverMessage?: ServerMessage) => {\n      if (error) {\n        console.error(error.message);\n      } else if (serverMessage) {\n        console.log(\n          `(client) Got server message: ${serverMessage.getServerMessage()}`\n        );\n      }\n    }\n  );\n}\n\nfunction doServerStreamingCall() {\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  const stream = client.serverStreamingCall(clientMessage);\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n}\n\nfunction doClientStreamingCall() {\n  const stream = client.clientStreamingCall(\n    (error: grpc.ServiceError | null) => {\n      if (error) {\n        console.error(error.message);\n      }\n    }\n  );\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n\nfunction doBidirectionalStreamingCall() {\n  const stream = client.bidirectionalStreamingCall();\n\n  // Server stream\n  stream.on('data', (serverMessage: ServerMessage) => {\n    console.log(\n      `(client) Got server message: ${serverMessage.getServerMessage()}`\n    );\n  });\n\n  // Client stream\n  const clientMessage = new ClientMessage();\n  clientMessage.setClientMessage('Message from client');\n  stream.write(clientMessage);\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/compile-proto.sh",
    "content": "#!/usr/bin/env bash\n\nOUT_DIR=\".\"\nTS_OUT_DIR=\".\"\nIN_DIR=\"./proto\"\nPROTOC=\"$(npm bin)/grpc_tools_node_protoc\"\nPROTOC_GEN_TS_PATH=\"$(npm bin)/protoc-gen-ts\"\nPROTOC_GEN_GRPC_PATH=\"$(npm bin)/grpc_tools_node_protoc_plugin\"\n\n$PROTOC \\\n    -I=\"./\" \\\n    --plugin=protoc-gen-ts=$PROTOC_GEN_TS_PATH \\\n    --plugin=protoc-gen-grpc=$PROTOC_GEN_GRPC_PATH \\\n    --js_out=import_style=commonjs:$OUT_DIR \\\n    --grpc_out=grpc_js:$OUT_DIR \\\n    --ts_out=service=grpc-node,mode=grpc-js:$TS_OUT_DIR \\\n    \"$IN_DIR\"/*.proto\n"
  },
  {
    "path": "examples/ts-protoc-gen/package.json",
    "content": "{\n  \"name\": \"grpc-js-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"build\": \"npm run build:typescript\",\n    \"build:typescript\": \"tsc -p .\",\n    \"build:proto\": \"./compile-proto.sh\",\n    \"watch\": \"npm run build:typescript -- -w\",\n    \"prewatch\": \"npm run build:proto\",\n    \"prebuild\": \"npm run build:proto\",\n    \"lint\": \"npm run lint:prettier && npm run lint:eslint\",\n    \"lint:prettier\": \"prettier --check \\\"**/*.{ts,js,json,svg,md,yml}\\\"\",\n    \"lint:eslint\": \"eslint . --ext .js,.ts\",\n    \"lint:fix\": \"npm run lint:fix:prettier && npm run lint:eslint -- --fix\",\n    \"lint:fix:prettier\": \"prettier --write '**/*.{ts,tsx,js,json,svg,md,yml}'\",\n    \"start:server\": \"node server\",\n    \"start:client\": \"node client\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@grpc/grpc-js\": \"^1.6.8\",\n    \"google-protobuf\": \"^3.21.0\"\n  },\n  \"devDependencies\": {\n    \"@tsconfig/node12\": \"^1.0.11\",\n    \"@types/google-protobuf\": \"^3.15.6\",\n    \"@types/node\": \"^14.14.14\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.31.0\",\n    \"@typescript-eslint/parser\": \"^5.31.0\",\n    \"eslint\": \"^8.20.0\",\n    \"eslint-config-prettier\": \"^8.5.0\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.2.1\",\n    \"grpc-tools\": \"^1.11.2\",\n    \"prettier\": \"^2.7.1\",\n    \"ts-protoc-gen\": \"^0.15.0\",\n    \"typescript\": \"^4.7.4\"\n  },\n  \"eslintConfig\": {\n    \"ignorePatterns\": [\n      \"**/*.js\",\n      \"proto/*.ts\"\n    ],\n    \"env\": {\n      \"browser\": false,\n      \"es6\": true,\n      \"node\": true\n    },\n    \"parserOptions\": {\n      \"project\": \"./tsconfig.json\",\n      \"ecmaVersion\": 2018,\n      \"sourceType\": \"module\"\n    },\n    \"extends\": [\n      \"plugin:@typescript-eslint/recommended\",\n      \"prettier/@typescript-eslint\",\n      \"plugin:prettier/recommended\"\n    ]\n  },\n  \"prettier\": {\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"printWidth\": 80,\n    \"useTabs\": false\n  }\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/proto/example.proto",
    "content": "syntax = \"proto3\";\n\npackage example_package;\n\nmessage ServerMessage {\n  string server_message = 1;\n}\n\nmessage ClientMessage {\n  string client_message = 1;\n}\n\nservice Example {\n  rpc unaryCall(ClientMessage) returns (ServerMessage) {}\n  rpc serverStreamingCall(ClientMessage) returns (stream ServerMessage) {}\n  rpc clientStreamingCall(stream ClientMessage) returns (ServerMessage) {}\n  rpc bidirectionalStreamingCall(stream ClientMessage) returns (stream ServerMessage) {}\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/proto/example_grpc_pb.d.ts",
    "content": "// GENERATED CODE -- DO NOT EDIT!\n\n// package: example_package\n// file: proto/example.proto\n\nimport * as proto_example_pb from \"../proto/example_pb\";\nimport * as grpc from \"@grpc/grpc-js\";\n\ninterface IExampleService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {\n  unaryCall: grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  serverStreamingCall: grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  clientStreamingCall: grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  bidirectionalStreamingCall: grpc.MethodDefinition<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n\nexport const ExampleService: IExampleService;\n\nexport interface IExampleServer extends grpc.UntypedServiceImplementation {\n  unaryCall: grpc.handleUnaryCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  serverStreamingCall: grpc.handleServerStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  clientStreamingCall: grpc.handleClientStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  bidirectionalStreamingCall: grpc.handleBidiStreamingCall<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n\nexport class ExampleClient extends grpc.Client {\n  constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);\n  unaryCall(argument: proto_example_pb.ClientMessage, callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  unaryCall(argument: proto_example_pb.ClientMessage, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  unaryCall(argument: proto_example_pb.ClientMessage, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientUnaryCall;\n  serverStreamingCall(argument: proto_example_pb.ClientMessage, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n  serverStreamingCall(argument: proto_example_pb.ClientMessage, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<proto_example_pb.ServerMessage>;\n  clientStreamingCall(callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n  clientStreamingCall(metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n  clientStreamingCall(metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<proto_example_pb.ServerMessage>): grpc.ClientWritableStream<proto_example_pb.ClientMessage>;\n  bidirectionalStreamingCall(metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n  bidirectionalStreamingCall(metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientDuplexStream<proto_example_pb.ClientMessage, proto_example_pb.ServerMessage>;\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/proto/example_pb.d.ts",
    "content": "// package: example_package\n// file: proto/example.proto\n\nimport * as jspb from \"google-protobuf\";\n\nexport class ServerMessage extends jspb.Message {\n  getServerMessage(): string;\n  setServerMessage(value: string): void;\n\n  serializeBinary(): Uint8Array;\n  toObject(includeInstance?: boolean): ServerMessage.AsObject;\n  static toObject(includeInstance: boolean, msg: ServerMessage): ServerMessage.AsObject;\n  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n  static serializeBinaryToWriter(message: ServerMessage, writer: jspb.BinaryWriter): void;\n  static deserializeBinary(bytes: Uint8Array): ServerMessage;\n  static deserializeBinaryFromReader(message: ServerMessage, reader: jspb.BinaryReader): ServerMessage;\n}\n\nexport namespace ServerMessage {\n  export type AsObject = {\n    serverMessage: string,\n  }\n}\n\nexport class ClientMessage extends jspb.Message {\n  getClientMessage(): string;\n  setClientMessage(value: string): void;\n\n  serializeBinary(): Uint8Array;\n  toObject(includeInstance?: boolean): ClientMessage.AsObject;\n  static toObject(includeInstance: boolean, msg: ClientMessage): ClientMessage.AsObject;\n  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};\n  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};\n  static serializeBinaryToWriter(message: ClientMessage, writer: jspb.BinaryWriter): void;\n  static deserializeBinary(bytes: Uint8Array): ClientMessage;\n  static deserializeBinaryFromReader(message: ClientMessage, reader: jspb.BinaryReader): ClientMessage;\n}\n\nexport namespace ClientMessage {\n  export type AsObject = {\n    clientMessage: string,\n  }\n}\n\n"
  },
  {
    "path": "examples/ts-protoc-gen/server.ts",
    "content": "import * as grpc from '@grpc/grpc-js';\nimport { ExampleService, IExampleServer } from './proto/example_grpc_pb';\nimport { ClientMessage, ServerMessage } from './proto/example_pb';\n\nconst host = '0.0.0.0:9090';\n\nconst exampleServer: IExampleServer = {\n  unaryCall(\n    call: grpc.ServerUnaryCall<ClientMessage, ServerMessage>,\n    callback: grpc.sendUnaryData<ServerMessage>\n  ) {\n    if (call.request) {\n      console.log(\n        `(server) Got client message: ${call.request.getClientMessage()}`\n      );\n    }\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    callback(null, serverMessage);\n  },\n\n  serverStreamingCall(\n    call: grpc.ServerWritableStream<ClientMessage, ServerMessage>\n  ) {\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n\n  clientStreamingCall(\n    call: grpc.ServerReadableStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n  },\n\n  bidirectionalStreamingCall(\n    call: grpc.ServerDuplexStream<ClientMessage, ServerMessage>\n  ) {\n    call.on('data', (clientMessage: ClientMessage) => {\n      console.log(\n        `(server) Got client message: ${clientMessage.getClientMessage()}`\n      );\n    });\n\n    const serverMessage = new ServerMessage();\n    serverMessage.setServerMessage('Message from server');\n    call.write(serverMessage);\n  },\n};\n\nfunction getServer(): grpc.Server {\n  const server = new grpc.Server();\n  server.addService(ExampleService, exampleServer);\n  return server;\n}\n\nif (require.main === module) {\n  const server = getServer();\n  server.bindAsync(\n    host,\n    grpc.ServerCredentials.createInsecure(),\n    (err: Error | null, port: number) => {\n      if (err) {\n        console.error(`Server error: ${err.message}`);\n      } else {\n        console.log(`Server bound on port: ${port}`);\n        server.start();\n      }\n    }\n  );\n}\n"
  },
  {
    "path": "examples/ts-protoc-gen/tsconfig.json",
    "content": "{\n  \"extends\": \"@tsconfig/node12/tsconfig.json\",\n  \"exclude\": [\"node_modules\"]\n}\n"
  }
]