How to use the google-proto-files.getProtoPath function in google-proto-files

To help you get started, we’ve selected a few google-proto-files examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actions-on-google / actions-on-google-testing-nodejs / src / actions-on-google.ts View on Github external
const DEFAULT_LOCALE = SUPPORTED_LOCALES[0]

i18n.configure({
    locales: SUPPORTED_LOCALES,
    fallbacks: FALLBACK_LOCALES,
    directory: __dirname + '/locales',
    defaultLocale: DEFAULT_LOCALE,
})

const INTENT_NAMES = {
  NEW_SURFACE: 'actions.intent.NEW_SURFACE',
  SIGN_IN: 'actions.intent.SIGN_IN',
}

const PROTO_ROOT_DIR = protoFiles.getProtoPath('..')
const embeddedAssistantPb = grpc.load({
    root: PROTO_ROOT_DIR,
    file: path.relative(PROTO_ROOT_DIR, protoFiles['embeddedAssistant'].v1alpha2),
}).google.assistant.embedded.v1alpha2

const latlngPb = grpc.load({
    root: PROTO_ROOT_DIR,
    file: path.relative(PROTO_ROOT_DIR, protoFiles['embeddedAssistant'].v1alpha2),
}).google.type.LatLng

/* Unexported AoG types */
interface AogSuggestion {
    title: string
}

interface AogOptionInfo {
github googleapis / nodejs-proto-files / samples / quickstart.js View on Github external
async function quickstart() {
  // Get a directory path by executing as a function
  const files = protos.getProtoPath('logging', 'v2');
  console.log(files);
  // node_modules/google-proto-files/google/logging/v2

  // Get a path to the entry proto file for a specific API version
  console.log(protos.pubsub.v1);
  // node_modules/google-proto-files/google/pubsub/v1/pubsub.proto

  // Load a proto which depends on google common protos.
  const root1 = await protos.load('./cloudcats.proto');
  const service1 = root1.lookup('example.MyService');
  console.log(service1);

  // Load protos synchronously
  const root2 = protos.loadSync('./cloudcats.proto');
  const service2 = root2.lookup('example.MyService');
  console.log(service2);