From f08fc01cb7fc5fceadb6cebf28dc713d613a1192 Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Mon, 10 May 2021 16:08:06 -0400 Subject: [PATCH 1/6] fix: the return type from IAM method promises should be an array --- baselines/kms/src/v1/key_management_service_client.ts.baseline | 2 +- templates/typescript_gapic/_iam.njk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/baselines/kms/src/v1/key_management_service_client.ts.baseline b/baselines/kms/src/v1/key_management_service_client.ts.baseline index ac9d86afd..155e4e8ed 100644 --- a/baselines/kms/src/v1/key_management_service_client.ts.baseline +++ b/baselines/kms/src/v1/key_management_service_client.ts.baseline @@ -2761,7 +2761,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } diff --git a/templates/typescript_gapic/_iam.njk b/templates/typescript_gapic/_iam.njk index cdc249dda..118f050de 100644 --- a/templates/typescript_gapic/_iam.njk +++ b/templates/typescript_gapic/_iam.njk @@ -142,7 +142,7 @@ IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } {%- endmacro -%} From 8382208cfd755a4f4a25649ebc8b4d2c14f7c759 Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Mon, 10 May 2021 16:14:58 -0400 Subject: [PATCH 2/6] fix: update the other methods to return arrays as well --- .../kms/src/v1/key_management_service_client.ts.baseline | 4 ++-- templates/typescript_gapic/_iam.njk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/baselines/kms/src/v1/key_management_service_client.ts.baseline b/baselines/kms/src/v1/key_management_service_client.ts.baseline index 155e4e8ed..f686c818c 100644 --- a/baselines/kms/src/v1/key_management_service_client.ts.baseline +++ b/baselines/kms/src/v1/key_management_service_client.ts.baseline @@ -2664,7 +2664,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } @@ -2712,7 +2712,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } diff --git a/templates/typescript_gapic/_iam.njk b/templates/typescript_gapic/_iam.njk index 118f050de..73fd1a605 100644 --- a/templates/typescript_gapic/_iam.njk +++ b/templates/typescript_gapic/_iam.njk @@ -45,7 +45,7 @@ IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } @@ -93,7 +93,7 @@ IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise { + ):Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } From 7a62aa88e7a1bc25be49dd0185ff01fe04da659c Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Mon, 10 May 2021 16:22:21 -0400 Subject: [PATCH 3/6] chore: gts doesn't like [] in types --- .../kms/src/v1/key_management_service_client.ts.baseline | 6 +++--- templates/typescript_gapic/_iam.njk | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/baselines/kms/src/v1/key_management_service_client.ts.baseline b/baselines/kms/src/v1/key_management_service_client.ts.baseline index f686c818c..ac4d316c1 100644 --- a/baselines/kms/src/v1/key_management_service_client.ts.baseline +++ b/baselines/kms/src/v1/key_management_service_client.ts.baseline @@ -2664,7 +2664,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + ):Promise> { return this.iamClient.getIamPolicy(request, options, callback); } @@ -2712,7 +2712,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + ):Promise> { return this.iamClient.setIamPolicy(request, options, callback); } @@ -2761,7 +2761,7 @@ export class KeyManagementServiceClient { IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + ):Promise> { return this.iamClient.testIamPermissions(request, options, callback); } diff --git a/templates/typescript_gapic/_iam.njk b/templates/typescript_gapic/_iam.njk index 73fd1a605..baba9bfc6 100644 --- a/templates/typescript_gapic/_iam.njk +++ b/templates/typescript_gapic/_iam.njk @@ -45,7 +45,7 @@ IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + ):Promise> { return this.iamClient.getIamPolicy(request, options, callback); } @@ -93,7 +93,7 @@ IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + ):Promise> { return this.iamClient.setIamPolicy(request, options, callback); } @@ -142,7 +142,7 @@ IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + ):Promise> { return this.iamClient.testIamPermissions(request, options, callback); } {%- endmacro -%} From b9bafee829fd675d780ce4767c5033031126fdbd Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Mon, 10 May 2021 16:22:37 -0400 Subject: [PATCH 4/6] docs: this needs underscores, not dashes, in the sample command line --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab62811af..493f0959f 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ $ npm run compile # build project with Bazel To run the generator: ```sh -bazel run //:gapic-generator-typescript -- --help +bazel run //:gapic_generator_typescript -- --help ``` **Note:** this section will be updated soon. After updating Bazel rules in `googleapis`, From df9cd6b2940198291f794ca66280f5c0abdfd4ae Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Fri, 18 Jun 2021 13:26:03 -0400 Subject: [PATCH 5/6] docs: fix underscores in the root README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 493f0959f..9dbd7aa8b 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Pick some API, how about `translate` `v3`? ```sh $ mkdir -p /tmp/translate-v3-typescript # where to put the result # from gapic-generator-typescript folder: -$ bazel run //:gapic-generator-typescript -- \ +$ bazel run //:gapic_generator_typescript -- \ --output-dir /tmp/translate-v3-typescript \ -I "$GOOGLEAPIS" \ --grpc-service-config "$GOOGLEAPIS/google/cloud/translate/v3/translate_grpc_service_config.json" \ From bbba12062ead5cf8d823c161f786d08e6e3578a5 Mon Sep 17 00:00:00 2001 From: Megan Potter Date: Fri, 18 Jun 2021 13:50:58 -0400 Subject: [PATCH 6/6] build: use typescript 4.2.x for the moment, to avoid conflicts with @bazel/typescript --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c8a92426..dded4fbf0 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "gts": "^3.1.0", "mocha": "^8.4.0", "sinon": "^11.1.1", - "typescript": "~4.3.4" + "typescript": "~4.2.0" }, "engines": { "node": ">=v10.24.0"