From d9d35330a6cd818cd29d14d559300ab0b4c2c3a7 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 6 Mar 2025 15:43:21 +0000 Subject: [PATCH 01/32] chore: fix owlbot configs, regenerate --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index f86616dca..d371550dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,8 +12,8 @@ // 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 v2 from './v2'; From 18d497869284551be4cee0ab85d3a0cb5c4fe413 Mon Sep 17 00:00:00 2001 From: "Leah E. Cole" <6719667+leahecole@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:13:06 -0500 Subject: [PATCH 02/32] Apply suggestions from code review --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d371550dc..f86616dca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// ** This file is automatically generated by synthtool. ** -// ** https://github.com/googleapis/synthtool ** +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** import * as v2 from './v2'; From c5c4dd36eb81d8241e6a7d38225a52e9ef78f42c Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 13 Mar 2025 17:02:48 -0400 Subject: [PATCH 03/32] WIP - two different ways --- scripts/gen_uber_class.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index cf7e12e9e..9120d4a0a 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,6 +14,7 @@ import * as ts from 'typescript'; import * as fs from 'fs'; +import {open} from 'node:fs/promises' import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From a409018bd06b6ccb7b239d8653598c3f88e8cbf3 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 14 Mar 2025 11:21:15 -0400 Subject: [PATCH 04/32] don't overwrite handwritten methods --- scripts/gen_uber_class.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index 9120d4a0a..45a013b89 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,7 +14,7 @@ import * as ts from 'typescript'; import * as fs from 'fs'; -import {open} from 'node:fs/promises' +import * as fsPromises from 'node:fs/promises'; import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From bf0ab0b188a97ff105fe3509c7078c54a6aa4bee Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 14 Mar 2025 12:04:56 -0400 Subject: [PATCH 05/32] change to sync file read --- scripts/gen_uber_class.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index 45a013b89..cf7e12e9e 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,7 +14,6 @@ import * as ts from 'typescript'; import * as fs from 'fs'; -import * as fsPromises from 'node:fs/promises'; import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From 7abe972b0b3cf6e6d75f59803143611ab72e853e Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 11 Apr 2025 20:51:31 +0000 Subject: [PATCH 06/32] chore: periodic regen --- .../generated/v2/snippet_metadata_google.cloud.bigquery.v2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json index fdbe23c7e..a23b1b66a 100644 --- a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json +++ b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json @@ -1940,4 +1940,4 @@ } } ] -} +} \ No newline at end of file From 46c760e3bee757be1fc5c56cb675f4a1cf5c313c Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 11 Apr 2025 20:57:18 +0000 Subject: [PATCH 07/32] run postprocessor --- protos/protos.d.ts | 8 ++++---- .../v2/snippet_metadata_google.cloud.bigquery.v2.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 74fef3916..892e13f18 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -36057,7 +36057,7 @@ export namespace google { doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|Buffer|string|null); + stringValue?: (Uint8Array|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -36088,7 +36088,7 @@ export namespace google { public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|Buffer|string); + public stringValue: (Uint8Array|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -38135,7 +38135,7 @@ export namespace google { interface IBytesValue { /** BytesValue value */ - value?: (Uint8Array|Buffer|string|null); + value?: (Uint8Array|string|null); } /** Represents a BytesValue. */ @@ -38148,7 +38148,7 @@ export namespace google { constructor(properties?: google.protobuf.IBytesValue); /** BytesValue value. */ - public value: (Uint8Array|Buffer|string); + public value: (Uint8Array|string); /** * Creates a new BytesValue instance using the specified properties. diff --git a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json index a23b1b66a..fdbe23c7e 100644 --- a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json +++ b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json @@ -1940,4 +1940,4 @@ } } ] -} \ No newline at end of file +} From 2ad938d3245014ada458eb110070945b0378a962 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 10:21:46 -0400 Subject: [PATCH 08/32] upgrade dependencies to node 18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d19694625..2c7b71689 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file From ba7faa600d3ab9f78aee6b6f859380ba7989863d Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 10:49:33 -0400 Subject: [PATCH 09/32] Revert "upgrade dependencies to node 18" This reverts commit b7ca3fc2a68c784cc79beb95289015a0a21ecf65. --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 2c7b71689..441bcb09a 100644 --- a/package.json +++ b/package.json @@ -48,24 +48,24 @@ "google-gax": "^5.0.0" }, "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.15.21", - "@types/sinon": "^17.0.4", + "@types/mocha": "^10.0.7", + "@types/node": "^20.16.4", + "@types/sinon": "^10.0.20", "c8": "^10.1.3", - "gapic-tools": "^1.0.2", - "gts": "^6.0.2", + "gapic-tools": "^1.0.1", + "gts": "5.3.1", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "mocha": "^11.4.0", - "nise": "^6.1.1", - "pack-n-play": "^3.0.1", - "path-to-regexp": "^8.2.0", - "prettier": "^3.5.3", - "sinon": "^20.0.0", - "typescript": "^5.8.3" + "mocha": "^10.7.3", + "nise": "6.0.0", + "pack-n-play": "^2.0.3", + "path-to-regexp": "6.3.0", + "prettier": "^3.0.0", + "sinon": "^18.0.0", + "typescript": "5.1.6" }, "engines": { - "node": ">=18" + "node": ">=v18" } -} \ No newline at end of file +} From 0e9e8fb8e0c2eeffa10d0d7e68906da2e2e7dfe2 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 19:25:05 +0000 Subject: [PATCH 10/32] periodic regeneration + update to node 18 on autogen branch --- package.json | 26 +++++++++++++------------- protos/protos.d.ts | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 441bcb09a..d19694625 100644 --- a/package.json +++ b/package.json @@ -48,24 +48,24 @@ "google-gax": "^5.0.0" }, "devDependencies": { - "@types/mocha": "^10.0.7", - "@types/node": "^20.16.4", - "@types/sinon": "^10.0.20", + "@types/mocha": "^10.0.10", + "@types/node": "^22.15.21", + "@types/sinon": "^17.0.4", "c8": "^10.1.3", - "gapic-tools": "^1.0.1", - "gts": "5.3.1", + "gapic-tools": "^1.0.2", + "gts": "^6.0.2", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "mocha": "^10.7.3", - "nise": "6.0.0", - "pack-n-play": "^2.0.3", - "path-to-regexp": "6.3.0", - "prettier": "^3.0.0", - "sinon": "^18.0.0", - "typescript": "5.1.6" + "mocha": "^11.4.0", + "nise": "^6.1.1", + "pack-n-play": "^3.0.1", + "path-to-regexp": "^8.2.0", + "prettier": "^3.5.3", + "sinon": "^20.0.0", + "typescript": "^5.8.3" }, "engines": { - "node": ">=v18" + "node": ">=18" } } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 892e13f18..74fef3916 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -36057,7 +36057,7 @@ export namespace google { doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); + stringValue?: (Uint8Array|Buffer|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -36088,7 +36088,7 @@ export namespace google { public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|string); + public stringValue: (Uint8Array|Buffer|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -38135,7 +38135,7 @@ export namespace google { interface IBytesValue { /** BytesValue value */ - value?: (Uint8Array|string|null); + value?: (Uint8Array|Buffer|string|null); } /** Represents a BytesValue. */ @@ -38148,7 +38148,7 @@ export namespace google { constructor(properties?: google.protobuf.IBytesValue); /** BytesValue value. */ - public value: (Uint8Array|string); + public value: (Uint8Array|Buffer|string); /** * Creates a new BytesValue instance using the specified properties. From 34f72a8fbfc064df8e762a48db6e74db638dff8a Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 20:11:19 +0000 Subject: [PATCH 11/32] fix lint errors --- src/bigquery.ts | 114 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/bigquery.ts b/src/bigquery.ts index dcba0e116..e77ed0422 100644 --- a/src/bigquery.ts +++ b/src/bigquery.ts @@ -101,43 +101,43 @@ export class BigQueryClient { */ constructor( options?: BigQueryClientOptions, - subClientOptions?: SubClientOptions, + subClientOptions?: SubClientOptions ) { this.datasetClient = options?.datasetClient ?? new DatasetServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.tableClient = options?.tableClient ?? new TableServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.jobClient = options?.jobClient ?? new JobServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.modelClient = options?.modelClient ?? new ModelServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.routineClient = options?.routineClient ?? new RoutineServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.rowAccessPolicyClient = options?.rowAccessPolicyClient ?? new RowAccessPolicyServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); } @@ -205,7 +205,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IGetDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -280,7 +280,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IInsertDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -369,7 +369,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -457,7 +457,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -519,7 +519,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -582,7 +582,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -653,7 +653,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListDatasetsRequest, protos.google.cloud.bigquery.v2.IDatasetList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatDataset - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatDataset[], @@ -710,7 +710,7 @@ export class BigQueryClient { */ listDatasetsStream( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.datasetClient.listDatasetsStream(request, options); } @@ -753,7 +753,7 @@ export class BigQueryClient { */ listDatasetsAsync( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.datasetClient.listDatasetsAsync(request, options); } @@ -807,7 +807,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IGetTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -864,7 +864,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IInsertTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -930,7 +930,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -995,7 +995,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -1053,7 +1053,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1116,7 +1116,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListTablesRequest, protos.google.cloud.bigquery.v2.ITableList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatTable - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatTable[], @@ -1165,7 +1165,7 @@ export class BigQueryClient { */ listTablesStream( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.tableClient.listTablesStream(request, options); } @@ -1200,7 +1200,7 @@ export class BigQueryClient { */ listTablesAsync( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.tableClient.listTablesAsync(request, options); } @@ -1251,7 +1251,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJobCancelResponse, protos.google.cloud.bigquery.v2.ICancelJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJobCancelResponse, @@ -1318,7 +1318,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IGetJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1381,7 +1381,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IInsertJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1444,7 +1444,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1523,7 +1523,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListJobsRequest, protos.google.cloud.bigquery.v2.IJobList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatJob - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatJob[], @@ -1585,7 +1585,7 @@ export class BigQueryClient { */ listJobsStream( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.jobClient.listJobsStream(request, options); } @@ -1633,7 +1633,7 @@ export class BigQueryClient { */ listJobsAsync( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.jobClient.listJobsAsync(request, options); } @@ -1674,7 +1674,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IGetModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1733,7 +1733,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IPatchModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1790,7 +1790,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1856,7 +1856,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListModelsRequest, protos.google.cloud.bigquery.v2.IListModelsResponse | null | undefined, protos.google.cloud.bigquery.v2.IModel - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel[], @@ -1905,7 +1905,7 @@ export class BigQueryClient { */ listModelsStream( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.modelClient.listModelsStream(request, options); } @@ -1940,7 +1940,7 @@ export class BigQueryClient { */ listModelsAsync( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.modelClient.listModelsAsync(request, options); } @@ -1981,7 +1981,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IGetRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2038,7 +2038,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IInsertRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2098,7 +2098,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IUpdateRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2163,7 +2163,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IPatchRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2220,7 +2220,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -2289,7 +2289,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListRoutinesRequest, protos.google.cloud.bigquery.v2.IListRoutinesResponse | null | undefined, protos.google.cloud.bigquery.v2.IRoutine - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine[], @@ -2342,7 +2342,7 @@ export class BigQueryClient { */ listRoutinesStream( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.routineClient.listRoutinesStream(request, options); } @@ -2381,7 +2381,7 @@ export class BigQueryClient { */ listRoutinesAsync( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.routineClient.listRoutinesAsync(request, options); } @@ -2428,7 +2428,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2450,7 +2450,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.getRowAccessPolicy( request, options, - callback, + callback ); } @@ -2495,7 +2495,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2517,7 +2517,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.updateRowAccessPolicy( request, options, - callback, + callback ); } @@ -2564,7 +2564,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -2586,7 +2586,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.deleteRowAccessPolicy( request, options, - callback, + callback ); } @@ -2636,7 +2636,7 @@ export class BigQueryClient { | null | undefined, protos.google.cloud.bigquery.v2.IRowAccessPolicy - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy[], @@ -2658,7 +2658,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.listRowAccessPolicies( request, options, - callback, + callback ); } @@ -2691,11 +2691,11 @@ export class BigQueryClient { */ listRowAccessPoliciesStream( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.rowAccessPolicyClient.listRowAccessPoliciesStream( request, - options, + options ); } @@ -2731,11 +2731,11 @@ export class BigQueryClient { */ listRowAccessPoliciesAsync( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.rowAccessPolicyClient.listRowAccessPoliciesAsync( request, - options, + options ); } From f73bb08f8026b8f2dba8496948c0c7621531e47a Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 20:17:46 +0000 Subject: [PATCH 12/32] more lint fixes --- src/bigquery.ts | 114 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/bigquery.ts b/src/bigquery.ts index e77ed0422..dcba0e116 100644 --- a/src/bigquery.ts +++ b/src/bigquery.ts @@ -101,43 +101,43 @@ export class BigQueryClient { */ constructor( options?: BigQueryClientOptions, - subClientOptions?: SubClientOptions + subClientOptions?: SubClientOptions, ) { this.datasetClient = options?.datasetClient ?? new DatasetServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.tableClient = options?.tableClient ?? new TableServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.jobClient = options?.jobClient ?? new JobServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.modelClient = options?.modelClient ?? new ModelServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.routineClient = options?.routineClient ?? new RoutineServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.rowAccessPolicyClient = options?.rowAccessPolicyClient ?? new RowAccessPolicyServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); } @@ -205,7 +205,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IGetDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -280,7 +280,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IInsertDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -369,7 +369,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -457,7 +457,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -519,7 +519,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -582,7 +582,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -653,7 +653,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListDatasetsRequest, protos.google.cloud.bigquery.v2.IDatasetList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatDataset - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatDataset[], @@ -710,7 +710,7 @@ export class BigQueryClient { */ listDatasetsStream( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.datasetClient.listDatasetsStream(request, options); } @@ -753,7 +753,7 @@ export class BigQueryClient { */ listDatasetsAsync( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.datasetClient.listDatasetsAsync(request, options); } @@ -807,7 +807,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IGetTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -864,7 +864,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IInsertTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -930,7 +930,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -995,7 +995,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -1053,7 +1053,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1116,7 +1116,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListTablesRequest, protos.google.cloud.bigquery.v2.ITableList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatTable - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatTable[], @@ -1165,7 +1165,7 @@ export class BigQueryClient { */ listTablesStream( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.tableClient.listTablesStream(request, options); } @@ -1200,7 +1200,7 @@ export class BigQueryClient { */ listTablesAsync( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.tableClient.listTablesAsync(request, options); } @@ -1251,7 +1251,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJobCancelResponse, protos.google.cloud.bigquery.v2.ICancelJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJobCancelResponse, @@ -1318,7 +1318,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IGetJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1381,7 +1381,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IInsertJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1444,7 +1444,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1523,7 +1523,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListJobsRequest, protos.google.cloud.bigquery.v2.IJobList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatJob - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatJob[], @@ -1585,7 +1585,7 @@ export class BigQueryClient { */ listJobsStream( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.jobClient.listJobsStream(request, options); } @@ -1633,7 +1633,7 @@ export class BigQueryClient { */ listJobsAsync( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.jobClient.listJobsAsync(request, options); } @@ -1674,7 +1674,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IGetModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1733,7 +1733,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IPatchModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1790,7 +1790,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1856,7 +1856,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListModelsRequest, protos.google.cloud.bigquery.v2.IListModelsResponse | null | undefined, protos.google.cloud.bigquery.v2.IModel - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel[], @@ -1905,7 +1905,7 @@ export class BigQueryClient { */ listModelsStream( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.modelClient.listModelsStream(request, options); } @@ -1940,7 +1940,7 @@ export class BigQueryClient { */ listModelsAsync( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.modelClient.listModelsAsync(request, options); } @@ -1981,7 +1981,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IGetRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2038,7 +2038,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IInsertRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2098,7 +2098,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IUpdateRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2163,7 +2163,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IPatchRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2220,7 +2220,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -2289,7 +2289,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListRoutinesRequest, protos.google.cloud.bigquery.v2.IListRoutinesResponse | null | undefined, protos.google.cloud.bigquery.v2.IRoutine - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine[], @@ -2342,7 +2342,7 @@ export class BigQueryClient { */ listRoutinesStream( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.routineClient.listRoutinesStream(request, options); } @@ -2381,7 +2381,7 @@ export class BigQueryClient { */ listRoutinesAsync( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.routineClient.listRoutinesAsync(request, options); } @@ -2428,7 +2428,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2450,7 +2450,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.getRowAccessPolicy( request, options, - callback + callback, ); } @@ -2495,7 +2495,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2517,7 +2517,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.updateRowAccessPolicy( request, options, - callback + callback, ); } @@ -2564,7 +2564,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -2586,7 +2586,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.deleteRowAccessPolicy( request, options, - callback + callback, ); } @@ -2636,7 +2636,7 @@ export class BigQueryClient { | null | undefined, protos.google.cloud.bigquery.v2.IRowAccessPolicy - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy[], @@ -2658,7 +2658,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.listRowAccessPolicies( request, options, - callback + callback, ); } @@ -2691,11 +2691,11 @@ export class BigQueryClient { */ listRowAccessPoliciesStream( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.rowAccessPolicyClient.listRowAccessPoliciesStream( request, - options + options, ); } @@ -2731,11 +2731,11 @@ export class BigQueryClient { */ listRowAccessPoliciesAsync( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.rowAccessPolicyClient.listRowAccessPoliciesAsync( request, - options + options, ); } From 2385d37c8fd20c7a5f0f1071738bdcf6caaf5f5d Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 2 Jul 2025 14:24:18 -0700 Subject: [PATCH 13/32] WIP: adding some integration tests --- system-test/datasets.ts | 136 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 system-test/datasets.ts diff --git a/system-test/datasets.ts b/system-test/datasets.ts new file mode 100644 index 000000000..fda42954f --- /dev/null +++ b/system-test/datasets.ts @@ -0,0 +1,136 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +import * as protos from '../protos/protos' +import {BigQueryClient} from '../src'; +import assert = require('assert') +const cp = require('child_process'); +const {randomUUID} = require('crypto'); + +const GCLOUD_TESTS_PREFIX = 'nodejs_samples_tests'; +const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( + /-/gi, + '_', +); + +//TODO(coleleah): remove fallback: false if needed +const bigquery = new BigQueryClient({}, {opts:{fallback: false}}); +// the GCLOUD_PROJECT environment variable is set as part of test harness setup +const projectId = process.env.GCLOUD_PROJECT; + +describe('Datasets', () => { + //TODO(coleleah): update + before(async () => { + // // Delete any stale datasets from samples tests + // await deleteDatasets(); + if (projectId===undefined){ + throw Error("GCLOUD_PROJECT must be defined as an environment variable before tests can be run") + + } + }); + + // beforeEach(async function () { + // this.currentTest.retries(2); + // }); + + // after(async () => { + // await bigquery.dataset(datasetId).delete({force: true}).catch(console.warn); + // }); + describe('dataset creation', () => { + const usCentral1Bigquery = new BigQueryClient({}, {opts: { + apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', + fallback: false + }}); + const usCentral1DatasetId = datasetId + '_uscentral1'; + + after('clean up dataset creation tests', async () => { + const usCentral1Request = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + await usCentral1Bigquery.deleteDataset(usCentral1Request) + + }) + + it('should create a dataset using a regional endpoint', async () => { + // Construct the dataset resource. + const dataset = { + datasetReference: { + datasetId: usCentral1DatasetId, + }, + location: 'us-central1' + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + await usCentral1Bigquery.insertDataset(request); + const getRequest = { + projectId: projectId, + datasetId: usCentral1DatasetId + } + + // we have to typecast this because response can be void when getDataset is called synchronously + // it is safe to typecast here because we are calling asynchronously + const response = await usCentral1Bigquery.getDataset(getRequest) as [ + protos.google.cloud.bigquery.v2.IDataset, + protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, + {} | undefined, + ] + assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); + }); + // //TODO(coleleah): fix + + it.only('should fail to create a dataset using a different region from the client endpoint', async () => { + const usEast4DatasetId = datasetId + '_us-east4'; + + // Construct the dataset resource + // with a location that does not match the client + // which uses us-central1 + const dataset = { + datasetReference: { + datasetId: usEast4DatasetId, + }, + location: 'us-east4' + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + let error; + try { + await usCentral1Bigquery.insertDataset(request); + } catch (err: unknown) { + console.log(err) + error = err; + } + assert.notStrictEqual(error, null); + //TODO(coleleah) fix typing + //@ts-ignore + assert.strictEqual(error.message, 'Invalid storage region'); + }); + + }) + + + + + +}); \ No newline at end of file From 893c64a56f233902b29271d4630f8aea28af62d5 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 3 Jul 2025 09:21:41 -0700 Subject: [PATCH 14/32] add some system tests, sync with autogen branch --- system-test/datasets.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index fda42954f..87ecd4a1d 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -52,7 +52,6 @@ describe('Datasets', () => { describe('dataset creation', () => { const usCentral1Bigquery = new BigQueryClient({}, {opts: { apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', - fallback: false }}); const usCentral1DatasetId = datasetId + '_uscentral1'; From d01155fb8c45e4f2c41695965e767d71b7c7c476 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Mon, 7 Jul 2025 09:24:50 -0400 Subject: [PATCH 15/32] add comment with buganizer bug --- system-test/datasets.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index 87ecd4a1d..99563ec28 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -93,9 +93,10 @@ describe('Datasets', () => { ] assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); }); - // //TODO(coleleah): fix - - it.only('should fail to create a dataset using a different region from the client endpoint', async () => { + + //TODO(coleleah): fix + //captured in b/429419330 + it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { const usEast4DatasetId = datasetId + '_us-east4'; // Construct the dataset resource From 7a840ab1dbdd8887f487e860ebf6d17f2276b588 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 31 Jul 2025 10:33:00 -0400 Subject: [PATCH 16/32] resolve lint errors, fix header, remove todos --- system-test/datasets.ts | 190 +++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 98 deletions(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index 99563ec28..74e3383fe 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -1,4 +1,4 @@ -// Copyright 2017 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ 'use strict'; -import * as protos from '../protos/protos' +import * as protos from '../protos/protos'; import {BigQueryClient} from '../src'; -import assert = require('assert') -const cp = require('child_process'); +import assert = require('assert'); const {randomUUID} = require('crypto'); +import {GoogleError} from 'google-gax'; const GCLOUD_TESTS_PREFIX = 'nodejs_samples_tests'; const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( @@ -26,111 +26,105 @@ const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( '_', ); -//TODO(coleleah): remove fallback: false if needed -const bigquery = new BigQueryClient({}, {opts:{fallback: false}}); // the GCLOUD_PROJECT environment variable is set as part of test harness setup const projectId = process.env.GCLOUD_PROJECT; describe('Datasets', () => { - //TODO(coleleah): update before(async () => { - // // Delete any stale datasets from samples tests - // await deleteDatasets(); - if (projectId===undefined){ - throw Error("GCLOUD_PROJECT must be defined as an environment variable before tests can be run") - + if (projectId === undefined) { + throw Error( + 'GCLOUD_PROJECT must be defined as an environment variable before tests can be run', + ); } }); - // beforeEach(async function () { - // this.currentTest.retries(2); - // }); + beforeEach(async function () { + this.currentTest.retries(2); + }); + - // after(async () => { - // await bigquery.dataset(datasetId).delete({force: true}).catch(console.warn); - // }); describe('dataset creation', () => { - const usCentral1Bigquery = new BigQueryClient({}, {opts: { - apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', - }}); - const usCentral1DatasetId = datasetId + '_uscentral1'; - - after('clean up dataset creation tests', async () => { - const usCentral1Request = { - projectId: projectId, - datasetId: usCentral1DatasetId, - }; - await usCentral1Bigquery.deleteDataset(usCentral1Request) - - }) - - it('should create a dataset using a regional endpoint', async () => { - // Construct the dataset resource. - const dataset = { - datasetReference: { - datasetId: usCentral1DatasetId, + const usCentral1Bigquery = new BigQueryClient( + {}, + { + opts: { + apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', + }, }, - location: 'us-central1' - }; - - // Construct the request object. - const request = { - projectId: projectId, - dataset: dataset, - }; - await usCentral1Bigquery.insertDataset(request); - const getRequest = { - projectId: projectId, - datasetId: usCentral1DatasetId - } + ); + const usCentral1DatasetId = datasetId + '_uscentral1'; - // we have to typecast this because response can be void when getDataset is called synchronously - // it is safe to typecast here because we are calling asynchronously - const response = await usCentral1Bigquery.getDataset(getRequest) as [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, - {} | undefined, - ] - assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); - }); - - //TODO(coleleah): fix - //captured in b/429419330 - it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { - const usEast4DatasetId = datasetId + '_us-east4'; - - // Construct the dataset resource - // with a location that does not match the client - // which uses us-central1 - const dataset = { - datasetReference: { - datasetId: usEast4DatasetId, - }, - location: 'us-east4' - }; - - // Construct the request object. - const request = { - projectId: projectId, - dataset: dataset, - }; - let error; - try { + after('clean up dataset creation tests', async () => { + const usCentral1Request = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + await usCentral1Bigquery.deleteDataset(usCentral1Request); + }); + + it('should create a dataset using a regional endpoint', async () => { + // Construct the dataset resource. + const dataset = { + datasetReference: { + datasetId: usCentral1DatasetId, + }, + location: 'us-central1', + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; await usCentral1Bigquery.insertDataset(request); - } catch (err: unknown) { - console.log(err) - error = err; - } - assert.notStrictEqual(error, null); - //TODO(coleleah) fix typing - //@ts-ignore - assert.strictEqual(error.message, 'Invalid storage region'); + const getRequest = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + + // we have to typecast this because response can be void when getDataset is called synchronously + // it is safe to typecast here because we are calling asynchronously + const response = (await usCentral1Bigquery.getDataset(getRequest)) as [ + protos.google.cloud.bigquery.v2.IDataset, + protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, + {} | undefined, + ]; + assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); + }); + + //TODO(coleleah): fix + //captured in b/429419330 + it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { + const usEast4DatasetId = datasetId + '_us-east4'; + + // Construct the dataset resource + // with a location that does not match the client + // which uses us-central1 + const dataset = { + datasetReference: { + datasetId: usEast4DatasetId, + }, + location: 'us-east4', + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + let error; + try { + await usCentral1Bigquery.insertDataset(request); + } catch (err: unknown) { + console.log(err); + error = err; + } + assert.notStrictEqual(error, null); + + assert.strictEqual( + (error as GoogleError).message, + 'Invalid storage region', + ); + }); }); - - }) - - - - - -}); \ No newline at end of file +}); From a667e1ae01735a8e871a4529922f5630b76a8290 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 6 Mar 2025 15:43:21 +0000 Subject: [PATCH 17/32] chore: fix owlbot configs, regenerate --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index f86616dca..d371550dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,8 +12,8 @@ // 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 v2 from './v2'; From 2f531ff929faad2a7c8e09f0cc62095514709f54 Mon Sep 17 00:00:00 2001 From: "Leah E. Cole" <6719667+leahecole@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:13:06 -0500 Subject: [PATCH 18/32] Apply suggestions from code review --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d371550dc..f86616dca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// ** This file is automatically generated by synthtool. ** -// ** https://github.com/googleapis/synthtool ** +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** import * as v2 from './v2'; From a02b40d4eec815a3a695386efaa07adbc3307c44 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 13 Mar 2025 17:02:48 -0400 Subject: [PATCH 19/32] WIP - two different ways --- scripts/gen_uber_class.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index cf7e12e9e..9120d4a0a 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,6 +14,7 @@ import * as ts from 'typescript'; import * as fs from 'fs'; +import {open} from 'node:fs/promises' import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From 1e37eef67755f02d2bb3a8df1cc1569ff249d9ae Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 14 Mar 2025 11:21:15 -0400 Subject: [PATCH 20/32] don't overwrite handwritten methods --- scripts/gen_uber_class.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index 9120d4a0a..45a013b89 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,7 +14,7 @@ import * as ts from 'typescript'; import * as fs from 'fs'; -import {open} from 'node:fs/promises' +import * as fsPromises from 'node:fs/promises'; import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From 6ddcbe0127909cde9ac77ca1423c7fa33cf77774 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 14 Mar 2025 12:04:56 -0400 Subject: [PATCH 21/32] change to sync file read --- scripts/gen_uber_class.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/gen_uber_class.ts b/scripts/gen_uber_class.ts index 45a013b89..cf7e12e9e 100644 --- a/scripts/gen_uber_class.ts +++ b/scripts/gen_uber_class.ts @@ -14,7 +14,6 @@ import * as ts from 'typescript'; import * as fs from 'fs'; -import * as fsPromises from 'node:fs/promises'; import * as prettier from 'prettier'; // TODO(maintainer) - if a new client is added, add it to this list From bddc1a3be87b39b4fbd2b8ed5d9d9d9a42e4b882 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 11 Apr 2025 20:51:31 +0000 Subject: [PATCH 22/32] chore: periodic regen --- .../generated/v2/snippet_metadata_google.cloud.bigquery.v2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json index fdbe23c7e..a23b1b66a 100644 --- a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json +++ b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json @@ -1940,4 +1940,4 @@ } } ] -} +} \ No newline at end of file From 339af43e8e1e992ca0d1739e19caf7c9534a6a70 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Fri, 11 Apr 2025 20:57:18 +0000 Subject: [PATCH 23/32] run postprocessor --- protos/protos.d.ts | 8 ++++---- .../v2/snippet_metadata_google.cloud.bigquery.v2.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 74fef3916..892e13f18 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -36057,7 +36057,7 @@ export namespace google { doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|Buffer|string|null); + stringValue?: (Uint8Array|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -36088,7 +36088,7 @@ export namespace google { public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|Buffer|string); + public stringValue: (Uint8Array|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -38135,7 +38135,7 @@ export namespace google { interface IBytesValue { /** BytesValue value */ - value?: (Uint8Array|Buffer|string|null); + value?: (Uint8Array|string|null); } /** Represents a BytesValue. */ @@ -38148,7 +38148,7 @@ export namespace google { constructor(properties?: google.protobuf.IBytesValue); /** BytesValue value. */ - public value: (Uint8Array|Buffer|string); + public value: (Uint8Array|string); /** * Creates a new BytesValue instance using the specified properties. diff --git a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json index a23b1b66a..fdbe23c7e 100644 --- a/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json +++ b/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json @@ -1940,4 +1940,4 @@ } } ] -} \ No newline at end of file +} From cc150ccec2e3b56ea81527d39e746fbad25613c5 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 10:21:46 -0400 Subject: [PATCH 24/32] upgrade dependencies to node 18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d19694625..2c7b71689 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file From f1a947510827f217bf4ee48f09e58877fa3c46e1 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 10:49:33 -0400 Subject: [PATCH 25/32] Revert "upgrade dependencies to node 18" This reverts commit b7ca3fc2a68c784cc79beb95289015a0a21ecf65. --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 2c7b71689..441bcb09a 100644 --- a/package.json +++ b/package.json @@ -48,24 +48,24 @@ "google-gax": "^5.0.0" }, "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.15.21", - "@types/sinon": "^17.0.4", + "@types/mocha": "^10.0.7", + "@types/node": "^20.16.4", + "@types/sinon": "^10.0.20", "c8": "^10.1.3", - "gapic-tools": "^1.0.2", - "gts": "^6.0.2", + "gapic-tools": "^1.0.1", + "gts": "5.3.1", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "mocha": "^11.4.0", - "nise": "^6.1.1", - "pack-n-play": "^3.0.1", - "path-to-regexp": "^8.2.0", - "prettier": "^3.5.3", - "sinon": "^20.0.0", - "typescript": "^5.8.3" + "mocha": "^10.7.3", + "nise": "6.0.0", + "pack-n-play": "^2.0.3", + "path-to-regexp": "6.3.0", + "prettier": "^3.0.0", + "sinon": "^18.0.0", + "typescript": "5.1.6" }, "engines": { - "node": ">=18" + "node": ">=v18" } -} \ No newline at end of file +} From fb0a2de642c1a1b62f1b5c54f1aa8787516687ef Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 19:25:05 +0000 Subject: [PATCH 26/32] periodic regeneration + update to node 18 on autogen branch --- package.json | 26 +++++++++++++------------- protos/protos.d.ts | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 441bcb09a..d19694625 100644 --- a/package.json +++ b/package.json @@ -48,24 +48,24 @@ "google-gax": "^5.0.0" }, "devDependencies": { - "@types/mocha": "^10.0.7", - "@types/node": "^20.16.4", - "@types/sinon": "^10.0.20", + "@types/mocha": "^10.0.10", + "@types/node": "^22.15.21", + "@types/sinon": "^17.0.4", "c8": "^10.1.3", - "gapic-tools": "^1.0.1", - "gts": "5.3.1", + "gapic-tools": "^1.0.2", + "gts": "^6.0.2", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "mocha": "^10.7.3", - "nise": "6.0.0", - "pack-n-play": "^2.0.3", - "path-to-regexp": "6.3.0", - "prettier": "^3.0.0", - "sinon": "^18.0.0", - "typescript": "5.1.6" + "mocha": "^11.4.0", + "nise": "^6.1.1", + "pack-n-play": "^3.0.1", + "path-to-regexp": "^8.2.0", + "prettier": "^3.5.3", + "sinon": "^20.0.0", + "typescript": "^5.8.3" }, "engines": { - "node": ">=v18" + "node": ">=18" } } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 892e13f18..74fef3916 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -36057,7 +36057,7 @@ export namespace google { doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); + stringValue?: (Uint8Array|Buffer|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -36088,7 +36088,7 @@ export namespace google { public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|string); + public stringValue: (Uint8Array|Buffer|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -38135,7 +38135,7 @@ export namespace google { interface IBytesValue { /** BytesValue value */ - value?: (Uint8Array|string|null); + value?: (Uint8Array|Buffer|string|null); } /** Represents a BytesValue. */ @@ -38148,7 +38148,7 @@ export namespace google { constructor(properties?: google.protobuf.IBytesValue); /** BytesValue value. */ - public value: (Uint8Array|string); + public value: (Uint8Array|Buffer|string); /** * Creates a new BytesValue instance using the specified properties. From 65f5340e37e21e4cbe593eaba6b1fda4a569b170 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 20:11:19 +0000 Subject: [PATCH 27/32] fix lint errors --- src/bigquery.ts | 114 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/bigquery.ts b/src/bigquery.ts index dcba0e116..e77ed0422 100644 --- a/src/bigquery.ts +++ b/src/bigquery.ts @@ -101,43 +101,43 @@ export class BigQueryClient { */ constructor( options?: BigQueryClientOptions, - subClientOptions?: SubClientOptions, + subClientOptions?: SubClientOptions ) { this.datasetClient = options?.datasetClient ?? new DatasetServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.tableClient = options?.tableClient ?? new TableServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.jobClient = options?.jobClient ?? new JobServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.modelClient = options?.modelClient ?? new ModelServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.routineClient = options?.routineClient ?? new RoutineServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); this.rowAccessPolicyClient = options?.rowAccessPolicyClient ?? new RowAccessPolicyServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance, + subClientOptions?.gaxInstance ); } @@ -205,7 +205,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IGetDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -280,7 +280,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IInsertDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -369,7 +369,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -457,7 +457,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -519,7 +519,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteDatasetRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -582,7 +582,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -653,7 +653,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListDatasetsRequest, protos.google.cloud.bigquery.v2.IDatasetList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatDataset - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatDataset[], @@ -710,7 +710,7 @@ export class BigQueryClient { */ listDatasetsStream( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.datasetClient.listDatasetsStream(request, options); } @@ -753,7 +753,7 @@ export class BigQueryClient { */ listDatasetsAsync( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.datasetClient.listDatasetsAsync(request, options); } @@ -807,7 +807,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IGetTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -864,7 +864,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IInsertTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -930,7 +930,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -995,7 +995,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -1053,7 +1053,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteTableRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1116,7 +1116,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListTablesRequest, protos.google.cloud.bigquery.v2.ITableList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatTable - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatTable[], @@ -1165,7 +1165,7 @@ export class BigQueryClient { */ listTablesStream( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.tableClient.listTablesStream(request, options); } @@ -1200,7 +1200,7 @@ export class BigQueryClient { */ listTablesAsync( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.tableClient.listTablesAsync(request, options); } @@ -1251,7 +1251,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJobCancelResponse, protos.google.cloud.bigquery.v2.ICancelJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJobCancelResponse, @@ -1318,7 +1318,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IGetJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1381,7 +1381,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IInsertJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1444,7 +1444,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteJobRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1523,7 +1523,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListJobsRequest, protos.google.cloud.bigquery.v2.IJobList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatJob - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatJob[], @@ -1585,7 +1585,7 @@ export class BigQueryClient { */ listJobsStream( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.jobClient.listJobsStream(request, options); } @@ -1633,7 +1633,7 @@ export class BigQueryClient { */ listJobsAsync( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.jobClient.listJobsAsync(request, options); } @@ -1674,7 +1674,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IGetModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1733,7 +1733,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IPatchModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1790,7 +1790,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteModelRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -1856,7 +1856,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListModelsRequest, protos.google.cloud.bigquery.v2.IListModelsResponse | null | undefined, protos.google.cloud.bigquery.v2.IModel - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IModel[], @@ -1905,7 +1905,7 @@ export class BigQueryClient { */ listModelsStream( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.modelClient.listModelsStream(request, options); } @@ -1940,7 +1940,7 @@ export class BigQueryClient { */ listModelsAsync( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.modelClient.listModelsAsync(request, options); } @@ -1981,7 +1981,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IGetRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2038,7 +2038,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IInsertRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2098,7 +2098,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IUpdateRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2163,7 +2163,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IPatchRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2220,7 +2220,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteRoutineRequest | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -2289,7 +2289,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListRoutinesRequest, protos.google.cloud.bigquery.v2.IListRoutinesResponse | null | undefined, protos.google.cloud.bigquery.v2.IRoutine - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine[], @@ -2342,7 +2342,7 @@ export class BigQueryClient { */ listRoutinesStream( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.routineClient.listRoutinesStream(request, options); } @@ -2381,7 +2381,7 @@ export class BigQueryClient { */ listRoutinesAsync( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.routineClient.listRoutinesAsync(request, options); } @@ -2428,7 +2428,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2450,7 +2450,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.getRowAccessPolicy( request, options, - callback, + callback ); } @@ -2495,7 +2495,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2517,7 +2517,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.updateRowAccessPolicy( request, options, - callback, + callback ); } @@ -2564,7 +2564,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - >, + > ): Promise< [ protos.google.protobuf.IEmpty, @@ -2586,7 +2586,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.deleteRowAccessPolicy( request, options, - callback, + callback ); } @@ -2636,7 +2636,7 @@ export class BigQueryClient { | null | undefined, protos.google.cloud.bigquery.v2.IRowAccessPolicy - >, + > ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy[], @@ -2658,7 +2658,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.listRowAccessPolicies( request, options, - callback, + callback ); } @@ -2691,11 +2691,11 @@ export class BigQueryClient { */ listRowAccessPoliciesStream( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions, + options?: CallOptions ): Transform { return this.rowAccessPolicyClient.listRowAccessPoliciesStream( request, - options, + options ); } @@ -2731,11 +2731,11 @@ export class BigQueryClient { */ listRowAccessPoliciesAsync( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions, + options?: CallOptions ): AsyncIterable { return this.rowAccessPolicyClient.listRowAccessPoliciesAsync( request, - options, + options ); } From 5133fb8a979f6bd19fb0841d01542b431fc2b5b0 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 21 May 2025 20:17:46 +0000 Subject: [PATCH 28/32] more lint fixes --- src/bigquery.ts | 114 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/bigquery.ts b/src/bigquery.ts index e77ed0422..dcba0e116 100644 --- a/src/bigquery.ts +++ b/src/bigquery.ts @@ -101,43 +101,43 @@ export class BigQueryClient { */ constructor( options?: BigQueryClientOptions, - subClientOptions?: SubClientOptions + subClientOptions?: SubClientOptions, ) { this.datasetClient = options?.datasetClient ?? new DatasetServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.tableClient = options?.tableClient ?? new TableServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.jobClient = options?.jobClient ?? new JobServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.modelClient = options?.modelClient ?? new ModelServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.routineClient = options?.routineClient ?? new RoutineServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); this.rowAccessPolicyClient = options?.rowAccessPolicyClient ?? new RowAccessPolicyServiceClient( subClientOptions?.opts, - subClientOptions?.gaxInstance + subClientOptions?.gaxInstance, ); } @@ -205,7 +205,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IGetDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -280,7 +280,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IDataset, protos.google.cloud.bigquery.v2.IInsertDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -369,7 +369,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -457,7 +457,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -519,7 +519,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteDatasetRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -582,7 +582,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IDataset, @@ -653,7 +653,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListDatasetsRequest, protos.google.cloud.bigquery.v2.IDatasetList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatDataset - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatDataset[], @@ -710,7 +710,7 @@ export class BigQueryClient { */ listDatasetsStream( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.datasetClient.listDatasetsStream(request, options); } @@ -753,7 +753,7 @@ export class BigQueryClient { */ listDatasetsAsync( request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.datasetClient.listDatasetsAsync(request, options); } @@ -807,7 +807,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IGetTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -864,7 +864,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.ITable, protos.google.cloud.bigquery.v2.IInsertTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -930,7 +930,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -995,7 +995,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.ITable, @@ -1053,7 +1053,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteTableRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1116,7 +1116,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListTablesRequest, protos.google.cloud.bigquery.v2.ITableList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatTable - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatTable[], @@ -1165,7 +1165,7 @@ export class BigQueryClient { */ listTablesStream( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.tableClient.listTablesStream(request, options); } @@ -1200,7 +1200,7 @@ export class BigQueryClient { */ listTablesAsync( request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.tableClient.listTablesAsync(request, options); } @@ -1251,7 +1251,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJobCancelResponse, protos.google.cloud.bigquery.v2.ICancelJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJobCancelResponse, @@ -1318,7 +1318,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IGetJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1381,7 +1381,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IJob, protos.google.cloud.bigquery.v2.IInsertJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IJob, @@ -1444,7 +1444,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteJobRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1523,7 +1523,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListJobsRequest, protos.google.cloud.bigquery.v2.IJobList | null | undefined, protos.google.cloud.bigquery.v2.IListFormatJob - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IListFormatJob[], @@ -1585,7 +1585,7 @@ export class BigQueryClient { */ listJobsStream( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.jobClient.listJobsStream(request, options); } @@ -1633,7 +1633,7 @@ export class BigQueryClient { */ listJobsAsync( request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.jobClient.listJobsAsync(request, options); } @@ -1674,7 +1674,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IGetModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1733,7 +1733,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IModel, protos.google.cloud.bigquery.v2.IPatchModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel, @@ -1790,7 +1790,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteModelRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -1856,7 +1856,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListModelsRequest, protos.google.cloud.bigquery.v2.IListModelsResponse | null | undefined, protos.google.cloud.bigquery.v2.IModel - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IModel[], @@ -1905,7 +1905,7 @@ export class BigQueryClient { */ listModelsStream( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.modelClient.listModelsStream(request, options); } @@ -1940,7 +1940,7 @@ export class BigQueryClient { */ listModelsAsync( request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.modelClient.listModelsAsync(request, options); } @@ -1981,7 +1981,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IGetRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2038,7 +2038,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IInsertRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2098,7 +2098,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IUpdateRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2163,7 +2163,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IRoutine, protos.google.cloud.bigquery.v2.IPatchRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine, @@ -2220,7 +2220,7 @@ export class BigQueryClient { protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.v2.IDeleteRoutineRequest | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -2289,7 +2289,7 @@ export class BigQueryClient { protos.google.cloud.bigquery.v2.IListRoutinesRequest, protos.google.cloud.bigquery.v2.IListRoutinesResponse | null | undefined, protos.google.cloud.bigquery.v2.IRoutine - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRoutine[], @@ -2342,7 +2342,7 @@ export class BigQueryClient { */ listRoutinesStream( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.routineClient.listRoutinesStream(request, options); } @@ -2381,7 +2381,7 @@ export class BigQueryClient { */ listRoutinesAsync( request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.routineClient.listRoutinesAsync(request, options); } @@ -2428,7 +2428,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2450,7 +2450,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.getRowAccessPolicy( request, options, - callback + callback, ); } @@ -2495,7 +2495,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy, @@ -2517,7 +2517,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.updateRowAccessPolicy( request, options, - callback + callback, ); } @@ -2564,7 +2564,7 @@ export class BigQueryClient { | null | undefined, {} | null | undefined - > + >, ): Promise< [ protos.google.protobuf.IEmpty, @@ -2586,7 +2586,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.deleteRowAccessPolicy( request, options, - callback + callback, ); } @@ -2636,7 +2636,7 @@ export class BigQueryClient { | null | undefined, protos.google.cloud.bigquery.v2.IRowAccessPolicy - > + >, ): Promise< [ protos.google.cloud.bigquery.v2.IRowAccessPolicy[], @@ -2658,7 +2658,7 @@ export class BigQueryClient { return this.rowAccessPolicyClient.listRowAccessPolicies( request, options, - callback + callback, ); } @@ -2691,11 +2691,11 @@ export class BigQueryClient { */ listRowAccessPoliciesStream( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions + options?: CallOptions, ): Transform { return this.rowAccessPolicyClient.listRowAccessPoliciesStream( request, - options + options, ); } @@ -2731,11 +2731,11 @@ export class BigQueryClient { */ listRowAccessPoliciesAsync( request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.rowAccessPolicyClient.listRowAccessPoliciesAsync( request, - options + options, ); } From a2523bc53517469f33a1a6f98393f06612fbd5bd Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Wed, 2 Jul 2025 14:24:18 -0700 Subject: [PATCH 29/32] WIP: adding some integration tests --- system-test/datasets.ts | 136 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 system-test/datasets.ts diff --git a/system-test/datasets.ts b/system-test/datasets.ts new file mode 100644 index 000000000..fda42954f --- /dev/null +++ b/system-test/datasets.ts @@ -0,0 +1,136 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +import * as protos from '../protos/protos' +import {BigQueryClient} from '../src'; +import assert = require('assert') +const cp = require('child_process'); +const {randomUUID} = require('crypto'); + +const GCLOUD_TESTS_PREFIX = 'nodejs_samples_tests'; +const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( + /-/gi, + '_', +); + +//TODO(coleleah): remove fallback: false if needed +const bigquery = new BigQueryClient({}, {opts:{fallback: false}}); +// the GCLOUD_PROJECT environment variable is set as part of test harness setup +const projectId = process.env.GCLOUD_PROJECT; + +describe('Datasets', () => { + //TODO(coleleah): update + before(async () => { + // // Delete any stale datasets from samples tests + // await deleteDatasets(); + if (projectId===undefined){ + throw Error("GCLOUD_PROJECT must be defined as an environment variable before tests can be run") + + } + }); + + // beforeEach(async function () { + // this.currentTest.retries(2); + // }); + + // after(async () => { + // await bigquery.dataset(datasetId).delete({force: true}).catch(console.warn); + // }); + describe('dataset creation', () => { + const usCentral1Bigquery = new BigQueryClient({}, {opts: { + apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', + fallback: false + }}); + const usCentral1DatasetId = datasetId + '_uscentral1'; + + after('clean up dataset creation tests', async () => { + const usCentral1Request = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + await usCentral1Bigquery.deleteDataset(usCentral1Request) + + }) + + it('should create a dataset using a regional endpoint', async () => { + // Construct the dataset resource. + const dataset = { + datasetReference: { + datasetId: usCentral1DatasetId, + }, + location: 'us-central1' + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + await usCentral1Bigquery.insertDataset(request); + const getRequest = { + projectId: projectId, + datasetId: usCentral1DatasetId + } + + // we have to typecast this because response can be void when getDataset is called synchronously + // it is safe to typecast here because we are calling asynchronously + const response = await usCentral1Bigquery.getDataset(getRequest) as [ + protos.google.cloud.bigquery.v2.IDataset, + protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, + {} | undefined, + ] + assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); + }); + // //TODO(coleleah): fix + + it.only('should fail to create a dataset using a different region from the client endpoint', async () => { + const usEast4DatasetId = datasetId + '_us-east4'; + + // Construct the dataset resource + // with a location that does not match the client + // which uses us-central1 + const dataset = { + datasetReference: { + datasetId: usEast4DatasetId, + }, + location: 'us-east4' + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + let error; + try { + await usCentral1Bigquery.insertDataset(request); + } catch (err: unknown) { + console.log(err) + error = err; + } + assert.notStrictEqual(error, null); + //TODO(coleleah) fix typing + //@ts-ignore + assert.strictEqual(error.message, 'Invalid storage region'); + }); + + }) + + + + + +}); \ No newline at end of file From bb19a14c621a6b9f7be083341e31c298ab32d37a Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 3 Jul 2025 09:21:41 -0700 Subject: [PATCH 30/32] add some system tests, sync with autogen branch --- system-test/datasets.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index fda42954f..87ecd4a1d 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -52,7 +52,6 @@ describe('Datasets', () => { describe('dataset creation', () => { const usCentral1Bigquery = new BigQueryClient({}, {opts: { apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', - fallback: false }}); const usCentral1DatasetId = datasetId + '_uscentral1'; From 93e7861d5105b6c83d624ce29cbc0a6e3a70c314 Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Mon, 7 Jul 2025 09:24:50 -0400 Subject: [PATCH 31/32] add comment with buganizer bug --- system-test/datasets.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index 87ecd4a1d..99563ec28 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -93,9 +93,10 @@ describe('Datasets', () => { ] assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); }); - // //TODO(coleleah): fix - - it.only('should fail to create a dataset using a different region from the client endpoint', async () => { + + //TODO(coleleah): fix + //captured in b/429419330 + it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { const usEast4DatasetId = datasetId + '_us-east4'; // Construct the dataset resource From b754e81708f82a2d43bf23f29363183271b1fd8c Mon Sep 17 00:00:00 2001 From: Leah Cole Date: Thu, 31 Jul 2025 10:33:00 -0400 Subject: [PATCH 32/32] resolve lint errors, fix header, remove todos --- system-test/datasets.ts | 190 +++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 98 deletions(-) diff --git a/system-test/datasets.ts b/system-test/datasets.ts index 99563ec28..74e3383fe 100644 --- a/system-test/datasets.ts +++ b/system-test/datasets.ts @@ -1,4 +1,4 @@ -// Copyright 2017 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ 'use strict'; -import * as protos from '../protos/protos' +import * as protos from '../protos/protos'; import {BigQueryClient} from '../src'; -import assert = require('assert') -const cp = require('child_process'); +import assert = require('assert'); const {randomUUID} = require('crypto'); +import {GoogleError} from 'google-gax'; const GCLOUD_TESTS_PREFIX = 'nodejs_samples_tests'; const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( @@ -26,111 +26,105 @@ const datasetId = `${GCLOUD_TESTS_PREFIX}_datasets_${randomUUID()}`.replace( '_', ); -//TODO(coleleah): remove fallback: false if needed -const bigquery = new BigQueryClient({}, {opts:{fallback: false}}); // the GCLOUD_PROJECT environment variable is set as part of test harness setup const projectId = process.env.GCLOUD_PROJECT; describe('Datasets', () => { - //TODO(coleleah): update before(async () => { - // // Delete any stale datasets from samples tests - // await deleteDatasets(); - if (projectId===undefined){ - throw Error("GCLOUD_PROJECT must be defined as an environment variable before tests can be run") - + if (projectId === undefined) { + throw Error( + 'GCLOUD_PROJECT must be defined as an environment variable before tests can be run', + ); } }); - // beforeEach(async function () { - // this.currentTest.retries(2); - // }); + beforeEach(async function () { + this.currentTest.retries(2); + }); + - // after(async () => { - // await bigquery.dataset(datasetId).delete({force: true}).catch(console.warn); - // }); describe('dataset creation', () => { - const usCentral1Bigquery = new BigQueryClient({}, {opts: { - apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', - }}); - const usCentral1DatasetId = datasetId + '_uscentral1'; - - after('clean up dataset creation tests', async () => { - const usCentral1Request = { - projectId: projectId, - datasetId: usCentral1DatasetId, - }; - await usCentral1Bigquery.deleteDataset(usCentral1Request) - - }) - - it('should create a dataset using a regional endpoint', async () => { - // Construct the dataset resource. - const dataset = { - datasetReference: { - datasetId: usCentral1DatasetId, + const usCentral1Bigquery = new BigQueryClient( + {}, + { + opts: { + apiEndpoint: 'bigquery.us-central1.rep.googleapis.com', + }, }, - location: 'us-central1' - }; - - // Construct the request object. - const request = { - projectId: projectId, - dataset: dataset, - }; - await usCentral1Bigquery.insertDataset(request); - const getRequest = { - projectId: projectId, - datasetId: usCentral1DatasetId - } + ); + const usCentral1DatasetId = datasetId + '_uscentral1'; - // we have to typecast this because response can be void when getDataset is called synchronously - // it is safe to typecast here because we are calling asynchronously - const response = await usCentral1Bigquery.getDataset(getRequest) as [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, - {} | undefined, - ] - assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); - }); - - //TODO(coleleah): fix - //captured in b/429419330 - it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { - const usEast4DatasetId = datasetId + '_us-east4'; - - // Construct the dataset resource - // with a location that does not match the client - // which uses us-central1 - const dataset = { - datasetReference: { - datasetId: usEast4DatasetId, - }, - location: 'us-east4' - }; - - // Construct the request object. - const request = { - projectId: projectId, - dataset: dataset, - }; - let error; - try { + after('clean up dataset creation tests', async () => { + const usCentral1Request = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + await usCentral1Bigquery.deleteDataset(usCentral1Request); + }); + + it('should create a dataset using a regional endpoint', async () => { + // Construct the dataset resource. + const dataset = { + datasetReference: { + datasetId: usCentral1DatasetId, + }, + location: 'us-central1', + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; await usCentral1Bigquery.insertDataset(request); - } catch (err: unknown) { - console.log(err) - error = err; - } - assert.notStrictEqual(error, null); - //TODO(coleleah) fix typing - //@ts-ignore - assert.strictEqual(error.message, 'Invalid storage region'); + const getRequest = { + projectId: projectId, + datasetId: usCentral1DatasetId, + }; + + // we have to typecast this because response can be void when getDataset is called synchronously + // it is safe to typecast here because we are calling asynchronously + const response = (await usCentral1Bigquery.getDataset(getRequest)) as [ + protos.google.cloud.bigquery.v2.IDataset, + protos.google.cloud.bigquery.v2.IGetDatasetRequest | undefined, + {} | undefined, + ]; + assert.strictEqual(response[0].id, `${projectId}:${usCentral1DatasetId}`); + }); + + //TODO(coleleah): fix + //captured in b/429419330 + it.skip('should fail to create a dataset using a different region from the client endpoint', async () => { + const usEast4DatasetId = datasetId + '_us-east4'; + + // Construct the dataset resource + // with a location that does not match the client + // which uses us-central1 + const dataset = { + datasetReference: { + datasetId: usEast4DatasetId, + }, + location: 'us-east4', + }; + + // Construct the request object. + const request = { + projectId: projectId, + dataset: dataset, + }; + let error; + try { + await usCentral1Bigquery.insertDataset(request); + } catch (err: unknown) { + console.log(err); + error = err; + } + assert.notStrictEqual(error, null); + + assert.strictEqual( + (error as GoogleError).message, + 'Invalid storage region', + ); + }); }); - - }) - - - - - -}); \ No newline at end of file +});