Skip to content
This repository was archived by the owner on Jan 18, 2026. It is now read-only.

Commit a63f235

Browse files
feat(deps): update gts dependency for generate client library (#343)
* update package.json * add templates * lint * fix gts lint * prefer-spread * remove global rules * remove pagination import * template change for new gts * remove tslint no-any * test * use paginationCallback & response, remove empty-function check * update gts to latest * test * test * test * change back * test * test * test * test * test * test * try this * and finally * work! Co-authored-by: Alexander Fenster <fenster@google.com>
1 parent 26933fe commit a63f235

83 files changed

Lines changed: 343 additions & 551 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,37 @@ jobs:
2929
command: |
3030
npm run lint
3131
- run:
32-
name: copy protos to generated client library
32+
name: copy protos to generated client library & move .test-out-* to project/out/
3333
command: |
3434
for dir in .test-out-* ; do
3535
cp -r test-fixtures/protos $dir
3636
done
37+
- run:
38+
name: move test out folders to a separate folder
39+
command: |
40+
mkdir /home/circleci/project/baselines
41+
cp -r .test-out-* /home/circleci/project/baselines
3742
- persist_to_workspace:
3843
root: /home/circleci/project
3944
paths:
4045
- gapic-generator-typescript
46+
- baselines
4147
showcaseTestApplications:
4248
docker:
4349
- image: circleci/node:10-browsers
4450
steps:
4551
- checkout
4652
- attach_workspace:
47-
at: workspace
53+
at: /home/circleci/workspace
4854
- run:
4955
name: Run showcase test for Typescript users
50-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript
56+
working_directory: /home/circleci/workspace/gapic-generator-typescript
5157
command: npm run ts-test-application
5258
environment:
5359
NPM_CONFIG_PREFIX: /tmp/.npm-global
5460
- run:
5561
name: Run showcase test for JavaScript users
56-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript
62+
working_directory: /home/circleci/workspace/gapic-generator-typescript
5763
command: npm run js-test-application
5864
environment:
5965
NPM_CONFIG_PREFIX: /tmp/.npm-global
@@ -63,11 +69,12 @@ jobs:
6369
steps:
6470
- checkout
6571
- attach_workspace:
66-
at: workspace
72+
at: /home/circleci/workspace
6773
- run:
6874
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Showcase library
69-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-showcase
75+
working_directory: /home/circleci/workspace/baselines/.test-out-showcase
7076
command: &alltests |
77+
pwd
7178
npm install
7279
npm test
7380
npm run fix
@@ -80,54 +87,54 @@ jobs:
8087
steps:
8188
- checkout
8289
- attach_workspace:
83-
at: workspace
90+
at: /home/circleci/workspace
8491
- run:
8592
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated KMS library
86-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-kms
93+
working_directory: /home/circleci/workspace/baselines/.test-out-kms
8794
command: *alltests
8895
translateLibTest:
8996
docker:
9097
- image: circleci/node:10-browsers
9198
steps:
9299
- checkout
93100
- attach_workspace:
94-
at: workspace
101+
at: /home/circleci/workspace
95102
- run:
96103
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Translate library
97-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-translate
104+
working_directory: /home/circleci/workspace/baselines/.test-out-translate
98105
command: *alltests
99106
monitoringLibTest:
100107
docker:
101108
- image: circleci/node:10-browsers
102109
steps:
103110
- checkout
104111
- attach_workspace:
105-
at: workspace
112+
at: /home/circleci/workspace
106113
- run:
107114
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Monitoring library
108-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-monitoring
115+
working_directory: /home/circleci/workspace/baselines/.test-out-monitoring
109116
command: *alltests
110117
dlpLibTest:
111118
docker:
112119
- image: circleci/node:10-browsers
113120
steps:
114121
- checkout
115122
- attach_workspace:
116-
at: workspace
123+
at: /home/circleci/workspace
117124
- run:
118125
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated DLP library
119-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-dlp
126+
working_directory: /home/circleci/workspace/baselines/.test-out-dlp
120127
command: *alltests
121128
ttsLibTest:
122129
docker:
123130
- image: circleci/node:10-browsers
124131
steps:
125132
- checkout
126133
- attach_workspace:
127-
at: workspace
134+
at: /home/circleci/workspace
128135
- run:
129136
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Text-to-Speech library
130-
working_directory: /home/circleci/project/workspace/gapic-generator-typescript/.test-out-texttospeech
137+
working_directory: /home/circleci/workspace/baselines/.test-out-texttospeech
131138
command: *alltests
132139
workflows:
133140
version: 2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/node_modules
2+
**/.coverage
3+
build/
4+
docs/
5+
protos/
6+
system-test/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/gts"
3+
}

baselines/bigquery-storage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/mocha": "^5.2.7",
3131
"@types/node": "^12.12.30",
3232
"c8": "^7.1.0",
33-
"gts": "^1.1.2",
33+
"gts": "2.0.0-alpha.6",
3434
"jsdoc": "^3.6.3",
3535
"jsdoc-fresh": "^1.0.2",
3636
"jsdoc-region-tag": "^1.0.4",

baselines/bigquery-storage/src/v1beta1/big_query_storage_client.ts.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class BigQueryStorageClient {
185185
this.bigQueryStorageStub = this._gaxGrpc.createStub(
186186
this._opts.fallback ?
187187
(this._protos as protobuf.Root).lookupService('google.cloud.bigquery.storage.v1beta1.BigQueryStorage') :
188-
// tslint:disable-next-line no-any
188+
/* eslint-disable @typescript-eslint/no-explicit-any */
189189
(this._protos as any).google.cloud.bigquery.storage.v1beta1.BigQueryStorage,
190190
this._opts) as Promise<{[method: string]: Function}>;
191191

baselines/bigquery-storage/test/gapic-big_query_storage-v1beta1.ts.baseline

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import * as protosTypes from '../protos/protos';
2020
import * as assert from 'assert';
2121
import { describe, it } from 'mocha';
22+
/* eslint-disable @typescript-eslint/no-var-requires */
2223
const bigquerystorageModule = require('../src');
2324

2425
import {PassThrough} from 'stream';
@@ -155,8 +156,6 @@ describe('v1beta1.BigQueryStorageClient', () => {
155156
request.tableReference.projectId = '';
156157
request.tableReference = {};
157158
request.tableReference.datasetId = '';
158-
// Mock response
159-
const expectedResponse = {};
160159
// Mock gRPC layer
161160
client._innerApiCalls.createReadSession = mockSimpleGrpcMethod(
162161
request,
@@ -209,8 +208,6 @@ describe('v1beta1.BigQueryStorageClient', () => {
209208
const request: protosTypes.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest = {};
210209
request.session = {};
211210
request.session.name = '';
212-
// Mock response
213-
const expectedResponse = {};
214211
// Mock gRPC layer
215212
client._innerApiCalls.batchCreateReadSessionStreams = mockSimpleGrpcMethod(
216213
request,
@@ -263,8 +260,6 @@ describe('v1beta1.BigQueryStorageClient', () => {
263260
const request: protosTypes.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest = {};
264261
request.stream = {};
265262
request.stream.name = '';
266-
// Mock response
267-
const expectedResponse = {};
268263
// Mock gRPC layer
269264
client._innerApiCalls.finalizeStream = mockSimpleGrpcMethod(
270265
request,
@@ -317,8 +312,6 @@ describe('v1beta1.BigQueryStorageClient', () => {
317312
const request: protosTypes.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest = {};
318313
request.originalStream = {};
319314
request.originalStream.name = '';
320-
// Mock response
321-
const expectedResponse = {};
322315
// Mock gRPC layer
323316
client._innerApiCalls.splitReadStream = mockSimpleGrpcMethod(
324317
request,
@@ -372,8 +365,6 @@ describe('v1beta1.BigQueryStorageClient', () => {
372365
request.readPosition = {};
373366
request.readPosition.stream = {};
374367
request.readPosition.stream.name = '';
375-
// Mock response
376-
const expectedResponse = {};
377368
// Mock gRPC layer
378369
client._innerApiCalls.readRows = mockServerStreamingGrpcMethod(request, null, error);
379370
const stream = client.readRows(request);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/node_modules
2+
**/.coverage
3+
build/
4+
docs/
5+
protos/
6+
system-test/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/gts"
3+
}

baselines/disable-packing-test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/mocha": "^5.2.7",
3131
"@types/node": "^12.12.30",
3232
"c8": "^7.1.0",
33-
"gts": "^1.1.2",
33+
"gts": "2.0.0-alpha.6",
3434
"jsdoc": "^3.6.3",
3535
"jsdoc-fresh": "^1.0.2",
3636
"jsdoc-region-tag": "^1.0.4",

baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// ** All changes to this file may be overwritten. **
1818

1919
import * as gax from 'google-gax';
20-
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, PaginationResponse} from 'google-gax';
20+
import {APICallback, Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback} from 'google-gax';
2121
import * as path from 'path';
2222

2323
import { Transform } from 'stream';
@@ -185,6 +185,7 @@ export class EchoClient {
185185
// an Operation object that allows for tracking of the operation,
186186
// rather than holding a request open.
187187
const protoFilesRoot = opts.fallback?
188+
/* eslint-disable @typescript-eslint/no-var-requires */
188189
this._gaxModule.protobuf.Root.fromJSON(require("../../protos/protos.json")) :
189190
this._gaxModule.protobuf.loadSync(nodejsProtoPath);
190191

@@ -237,7 +238,7 @@ export class EchoClient {
237238
this.echoStub = this._gaxGrpc.createStub(
238239
this._opts.fallback ?
239240
(this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') :
240-
// tslint:disable-next-line no-any
241+
/* eslint-disable @typescript-eslint/no-explicit-any */
241242
(this._protos as any).google.showcase.v1beta1.Echo,
242243
this._opts) as Promise<{[method: string]: Function}>;
243244

@@ -596,7 +597,7 @@ export class EchoClient {
596597
pagedExpand(
597598
request: protosTypes.google.showcase.v1beta1.IPagedExpandRequest,
598599
options: gax.CallOptions,
599-
callback: Callback<
600+
callback: PaginationCallback<
600601
protosTypes.google.showcase.v1beta1.IEchoResponse[],
601602
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|null,
602603
protosTypes.google.showcase.v1beta1.IPagedExpandResponse>): void;
@@ -632,11 +633,11 @@ export class EchoClient {
632633
*/
633634
pagedExpand(
634635
request: protosTypes.google.showcase.v1beta1.IPagedExpandRequest,
635-
optionsOrCallback?: gax.CallOptions|Callback<
636+
optionsOrCallback?: gax.CallOptions|PaginationCallback<
636637
protosTypes.google.showcase.v1beta1.IEchoResponse[],
637638
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|null,
638639
protosTypes.google.showcase.v1beta1.IPagedExpandResponse>,
639-
callback?: Callback<
640+
callback?: PaginationCallback<
640641
protosTypes.google.showcase.v1beta1.IEchoResponse[],
641642
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|null,
642643
protosTypes.google.showcase.v1beta1.IPagedExpandResponse>):

0 commit comments

Comments
 (0)