From b295684c626a2172c5459040ef3a51f5fee96c4c Mon Sep 17 00:00:00 2001 From: summerji Date: Mon, 11 May 2020 17:31:02 -0700 Subject: [PATCH 1/2] fix: synth.py clean up for multiple version --- src/index.ts | 28 ++++++++-------------------- synth.metadata | 10 +++++----- synth.py | 23 ++++++++++++----------- 3 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/index.ts b/src/index.ts index c250e37..f093420 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,28 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1beta1 from './v1beta1'; import * as v1 from './v1'; -const RecaptchaEnterpriseServiceV1Beta1Client = - v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import * as v1beta1 from './v1beta1'; + const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; -export { - v1, - v1beta1, - RecaptchaEnterpriseServiceV1Beta1Client, - RecaptchaEnterpriseServiceClient, -}; -// For compatibility with JavaScript libraries we need to provide this default export: -// tslint:disable-next-line no-default-export -export default { - v1, - v1beta1, - RecaptchaEnterpriseServiceV1Beta1Client, - RecaptchaEnterpriseServiceClient, -}; + +export {v1, v1beta1, RecaptchaEnterpriseServiceClient}; +export default {v1, v1beta1, RecaptchaEnterpriseServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/synth.metadata b/synth.metadata index 0307317..80fefb6 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-recaptcha-enterprise.git", - "sha": "42cd9f66c60fb4b989a3f6ea60510ca1e5a5080e" + "remote": "git@github.com:googleapis/nodejs-recaptcha-enterprise.git", + "sha": "05f1acabb9834dd291475598f343ecf7ae62b128" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "a3a0bf0f6291d69f2ff3df7fcd63d28ee20ac727", - "internalRef": "310060413" + "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7", + "internalRef": "310660461" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" + "sha": "98c50772ec23295c64cf0d2ddf199ea52961fd4c" } } ], diff --git a/synth.py b/synth.py index 3b87a2b..d425c12 100644 --- a/synth.py +++ b/synth.py @@ -27,20 +27,21 @@ gapic = gcp.GAPICMicrogenerator() versions = ['v1', 'v1beta1'] for version in versions: - library = gapic.typescript_library( - 'recaptchaenterprise', version, - generator_args={ - "grpc-service-config": f"google/cloud/recaptchaenterprise/{version}/recaptchaenterprise_grpc_service_config.json", - "package-name": f"@google-cloud/recaptcha-enterprise", - }, - proto_path=f'/google/cloud/recaptchaenterprise/{version}', - extra_proto_files=['google/cloud/common_resources.proto'] - ) - s.copy(library, excludes=['package.json', 'src/index.ts']) + library = gapic.typescript_library( + 'recaptchaenterprise', version, + generator_args={ + "grpc-service-config": f"google/cloud/recaptchaenterprise/{version}/recaptchaenterprise_grpc_service_config.json", + "package-name": f"@google-cloud/recaptcha-enterprise", + }, + proto_path=f'/google/cloud/recaptchaenterprise/{version}', + extra_proto_files=['google/cloud/common_resources.proto'] + ) + s.copy(library, excludes=['package.json']) # Copy common templates common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src') +templates = common_templates.node_library( + source_location='build/src', versions=versions, default_version='v1') s.copy(templates) node.postprocess_gapic_library() From 32ef20d909d1f64a23f69bc5c98fffa944917f98 Mon Sep 17 00:00:00 2001 From: summerji Date: Mon, 11 May 2020 22:44:59 -0700 Subject: [PATCH 2/2] modify beta client --- system-test/fixtures/sample/src/index.js | 2 +- system-test/fixtures/sample/src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system-test/fixtures/sample/src/index.js b/system-test/fixtures/sample/src/index.js index cb2d9ca..3299314 100644 --- a/system-test/fixtures/sample/src/index.js +++ b/system-test/fixtures/sample/src/index.js @@ -20,7 +20,7 @@ const recaptchaenterprise = require('@google-cloud/recaptcha-enterprise'); function main() { - const recaptchaEnterpriseServiceV1Beta1Client = new recaptchaenterprise.RecaptchaEnterpriseServiceV1Beta1Client(); + const recaptchaEnterpriseServiceV1Beta1Client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client(); } main(); diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts index c457bf5..dd718e4 100644 --- a/system-test/fixtures/sample/src/index.ts +++ b/system-test/fixtures/sample/src/index.ts @@ -16,10 +16,10 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {RecaptchaEnterpriseServiceV1Beta1Client} from '@google-cloud/recaptcha-enterprise'; +import * as recaptchaenterprise from '@google-cloud/recaptcha-enterprise'; function main() { - new RecaptchaEnterpriseServiceV1Beta1Client(); + new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client(); } main();