Skip to content

Commit

Permalink
fix: do not modify options object, use defaultScopes (#593)
Browse files Browse the repository at this point in the history
Regenerated the library using
[gapic-generator-typescript](https://github.com/googleapis/gapic-generator-typescript)
v1.2.1.
  • Loading branch information
alexander-fenster authored Nov 7, 2020
1 parent b2ac959 commit 90c4a65
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 210 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-translate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@google-cloud/promisify": "^2.0.0",
"arrify": "^2.0.0",
"extend": "^3.0.2",
"google-gax": "^2.1.0",
"google-gax": "^2.9.2",
"is-html": "^2.0.0",
"protobufjs": "^6.8.8"
},
Expand Down
1 change: 1 addition & 0 deletions packages/google-cloud-translate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import * as v3 from './v3';
export * from './v3';

const TranslationServiceClient = v3.TranslationServiceClient;
type TranslationServiceClient = v3.TranslationServiceClient;
export {TranslationServiceClient, v2, v3beta1, v3};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
Expand Down
231 changes: 137 additions & 94 deletions packages/google-cloud-translate/src/v3/translation_service_client.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions packages/google-cloud-translate/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/nodejs-translate.git",
"sha": "77a873f5854fb1ad5065e332e144ecc2a4b398b7"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "7e1a21195ede14f97f7da30efcff4c6bac599bb5",
"internalRef": "330665887"
"remote": "git@github.com:googleapis/nodejs-translate.git",
"sha": "205c645cdf08fbf94a583b06ff921b54e5b56f7b"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "ba9918cd22874245b55734f57470c719b577e591"
"sha": "1f1148d3c7a7a52f0c98077f976bd9b3c948ee2b"
}
}
],
Expand Down Expand Up @@ -96,13 +88,15 @@
"README.md",
"api-extractor.json",
"linkinator.config.json",
"package-lock.json.515292936",
"protos/google/cloud/translate/v3/translation_service.proto",
"protos/google/cloud/translate/v3beta1/translation_service.proto",
"protos/protos.d.ts",
"protos/protos.js",
"protos/protos.json",
"renovate.json",
"samples/README.md",
"samples/package-lock.json.3537124090",
"src/v3/index.ts",
"src/v3/translation_service_client.ts",
"src/v3/translation_service_client_config.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@

import {TranslationServiceClient} from '@google-cloud/translate';

// check that the client class type name can be used
function doStuffWithTranslationServiceClient(client: TranslationServiceClient) {
client.close();
}

function main() {
new TranslationServiceClient();
// check that the client instance can be created
const translationServiceClient = new TranslationServiceClient();
doStuffWithTranslationServiceClient(translationServiceClient);
}

main();
18 changes: 9 additions & 9 deletions packages/google-cloud-translate/system-test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play';
import {readFileSync} from 'fs';
import {describe, it} from 'mocha';

describe('typescript consumer tests', () => {
it('should have correct type signature for typescript users', async function () {
describe('📦 pack-n-play test', () => {
it('TypeScript code', async function () {
this.timeout(300000);
const options = {
packageDir: process.cwd(), // path to your module.
packageDir: process.cwd(),
sample: {
description: 'typescript based user can use the type definitions',
description: 'TypeScript user can use the type definitions',
ts: readFileSync(
'./system-test/fixtures/sample/src/index.ts'
).toString(),
},
};
await packNTest(options); // will throw upon error.
await packNTest(options);
});

it('should have correct type signature for javascript users', async function () {
it('JavaScript code', async function () {
this.timeout(300000);
const options = {
packageDir: process.cwd(), // path to your module.
packageDir: process.cwd(),
sample: {
description: 'typescript based user can use the type definitions',
description: 'JavaScript user can use the library',
ts: readFileSync(
'./system-test/fixtures/sample/src/index.js'
).toString(),
},
};
await packNTest(options); // will throw upon error.
await packNTest(options);
});
});

0 comments on commit 90c4a65

Please sign in to comment.