From d751378a5531f725f47f69f53384bfdf08476bd1 Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:18:38 -0400 Subject: [PATCH 1/5] fix: type widening to match gapic, and two typing fixes --- src/publisher/index.ts | 6 ++++-- test/publisher/index.ts | 2 +- test/pubsub.ts | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/publisher/index.ts b/src/publisher/index.ts index a4ab81fa6..01692a5a1 100644 --- a/src/publisher/index.ts +++ b/src/publisher/index.ts @@ -191,8 +191,10 @@ export class Publisher { // We must have at least one of: // - `data` as a Buffer // - `attributes` that are not empty - if (data && !(data instanceof Buffer)) { - throw new TypeError('Data must be in the form of a Buffer.'); + if (data && !(data instanceof Uint8Array)) { + throw new TypeError( + 'Data must be in the form of a Buffer or Uint8Array.' + ); } const keys = Object.keys(attributes!); diff --git a/test/publisher/index.ts b/test/publisher/index.ts index a4e6f28fb..9393b470f 100644 --- a/test/publisher/index.ts +++ b/test/publisher/index.ts @@ -237,7 +237,7 @@ describe('Publisher', () => { const badData = {} as Buffer; assert.throws( () => publisher.publishMessage({data: badData}, spy), - /Data must be in the form of a Buffer\./ + /Data must be in the form of a Buffer or Uint8Array\./ ); }); diff --git a/test/pubsub.ts b/test/pubsub.ts index d4ceef18b..d0dd97bcf 100644 --- a/test/pubsub.ts +++ b/test/pubsub.ts @@ -689,7 +689,10 @@ describe('PubSub', () => { const apiResponse = { name: 'new-topic', }; - let requestStub: sinon.SinonStub; + + // Types changed, so this is needed instead of `unknown`. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let requestStub: sinon.SinonStub; beforeEach(() => { requestStub = sandbox From 5e3b62686cca3fa689901a006a1fa9bf16fea470 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 26 Mar 2025 20:25:35 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- protos/protos.d.ts | 2 +- protos/protos.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 1c673e0fe..b7911f785 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2024 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. diff --git a/protos/protos.js b/protos/protos.js index 590cfac5b..1234c0003 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2024 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. From 0d96771633a6d112bdebeb0ba744cbb708dd3881 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 26 Mar 2025 20:26:31 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 3 +++ samples/README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/README.md b/README.md index db9c9ef33..1db6a6e2e 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,10 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree | Create Subscription with ordering enabled | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithOrdering.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithOrdering.js,samples/README.md) | | Create Subscription With Retry Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithRetryPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithRetryPolicy.js,samples/README.md) | | Create Topic | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopic.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopic.js,samples/README.md) | +| Create Topic With AWS MSK Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAwsMskIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAwsMskIngestion.js,samples/README.md) | +| Create Topic With Azure Event Hubs Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAzureEventHubsIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAzureEventHubsIngestion.js,samples/README.md) | | Create Topic With Cloud Storage Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithCloudStorageIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithCloudStorageIngestion.js,samples/README.md) | +| Create Topic With Confluent Cloud Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithConfluentCloudIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithConfluentCloudIngestion.js,samples/README.md) | | Create Topic With Kinesis Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithKinesisIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithKinesisIngestion.js,samples/README.md) | | Create Topic With Schema | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchema.js,samples/README.md) | | Create Topic With Schema Revisions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchemaRevisions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchemaRevisions.js,samples/README.md) | diff --git a/samples/README.md b/samples/README.md index dc6caf537..7635d0758 100644 --- a/samples/README.md +++ b/samples/README.md @@ -35,7 +35,10 @@ guides. * [Create Subscription with ordering enabled](#create-subscription-with-ordering-enabled) * [Create Subscription With Retry Policy](#create-subscription-with-retry-policy) * [Create Topic](#create-topic) + * [Create Topic With AWS MSK Ingestion](#create-topic-with-aws-msk-ingestion) + * [Create Topic With Azure Event Hubs Ingestion](#create-topic-with-azure-event-hubs-ingestion) * [Create Topic With Cloud Storage Ingestion](#create-topic-with-cloud-storage-ingestion) + * [Create Topic With Confluent Cloud Ingestion](#create-topic-with-confluent-cloud-ingestion) * [Create Topic With Kinesis Ingestion](#create-topic-with-kinesis-ingestion) * [Create Topic With Schema](#create-topic-with-schema) * [Create Topic With Schema Revisions](#create-topic-with-schema-revisions) @@ -390,6 +393,44 @@ __Usage:__ +### Create Topic With AWS MSK Ingestion + +Creates a new topic, with AWS MSK ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAwsMskIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAwsMskIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithAwsMskIngestion.js ` + + +----- + + + + +### Create Topic With Azure Event Hubs Ingestion + +Creates a new topic, with Azure Event Hubs ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAzureEventHubsIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAzureEventHubsIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithAzureEventHubsIngestion.js ` + + +----- + + + + ### Create Topic With Cloud Storage Ingestion Creates a new topic, with Cloud Storage ingestion enabled. @@ -409,6 +450,25 @@ __Usage:__ +### Create Topic With Confluent Cloud Ingestion + +Creates a new topic, with Confluent Cloud ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithConfluentCloudIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithConfluentCloudIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithConfluentCloudIngestion.js ` + + +----- + + + + ### Create Topic With Kinesis Ingestion Creates a new topic, with Kinesis ingestion enabled. From 1f02e56632a35c6a30542e4988b2f9f84091fad3 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 26 Mar 2025 20:32:04 +0000 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 3 +++ samples/README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/README.md b/README.md index db9c9ef33..1db6a6e2e 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,10 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree | Create Subscription with ordering enabled | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithOrdering.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithOrdering.js,samples/README.md) | | Create Subscription With Retry Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithRetryPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithRetryPolicy.js,samples/README.md) | | Create Topic | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopic.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopic.js,samples/README.md) | +| Create Topic With AWS MSK Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAwsMskIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAwsMskIngestion.js,samples/README.md) | +| Create Topic With Azure Event Hubs Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAzureEventHubsIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAzureEventHubsIngestion.js,samples/README.md) | | Create Topic With Cloud Storage Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithCloudStorageIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithCloudStorageIngestion.js,samples/README.md) | +| Create Topic With Confluent Cloud Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithConfluentCloudIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithConfluentCloudIngestion.js,samples/README.md) | | Create Topic With Kinesis Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithKinesisIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithKinesisIngestion.js,samples/README.md) | | Create Topic With Schema | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchema.js,samples/README.md) | | Create Topic With Schema Revisions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchemaRevisions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchemaRevisions.js,samples/README.md) | diff --git a/samples/README.md b/samples/README.md index dc6caf537..7635d0758 100644 --- a/samples/README.md +++ b/samples/README.md @@ -35,7 +35,10 @@ guides. * [Create Subscription with ordering enabled](#create-subscription-with-ordering-enabled) * [Create Subscription With Retry Policy](#create-subscription-with-retry-policy) * [Create Topic](#create-topic) + * [Create Topic With AWS MSK Ingestion](#create-topic-with-aws-msk-ingestion) + * [Create Topic With Azure Event Hubs Ingestion](#create-topic-with-azure-event-hubs-ingestion) * [Create Topic With Cloud Storage Ingestion](#create-topic-with-cloud-storage-ingestion) + * [Create Topic With Confluent Cloud Ingestion](#create-topic-with-confluent-cloud-ingestion) * [Create Topic With Kinesis Ingestion](#create-topic-with-kinesis-ingestion) * [Create Topic With Schema](#create-topic-with-schema) * [Create Topic With Schema Revisions](#create-topic-with-schema-revisions) @@ -390,6 +393,44 @@ __Usage:__ +### Create Topic With AWS MSK Ingestion + +Creates a new topic, with AWS MSK ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAwsMskIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAwsMskIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithAwsMskIngestion.js ` + + +----- + + + + +### Create Topic With Azure Event Hubs Ingestion + +Creates a new topic, with Azure Event Hubs ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithAzureEventHubsIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithAzureEventHubsIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithAzureEventHubsIngestion.js ` + + +----- + + + + ### Create Topic With Cloud Storage Ingestion Creates a new topic, with Cloud Storage ingestion enabled. @@ -409,6 +450,25 @@ __Usage:__ +### Create Topic With Confluent Cloud Ingestion + +Creates a new topic, with Confluent Cloud ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithConfluentCloudIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithConfluentCloudIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithConfluentCloudIngestion.js ` + + +----- + + + + ### Create Topic With Kinesis Ingestion Creates a new topic, with Kinesis ingestion enabled. From 6d64086d5bf15aeadc42c269c6237aa35cedd487 Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Thu, 27 Mar 2025 15:03:36 -0400 Subject: [PATCH 5/5] build: dodge broken version of promisify --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 279df9e5c..7dce94c0e 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@google-cloud/paginator": "^5.0.0", "@google-cloud/precise-date": "^4.0.0", "@google-cloud/projectify": "^4.0.0", - "@google-cloud/promisify": "^4.0.0", + "@google-cloud/promisify": "~4.0.0", "@opentelemetry/api": "~1.9.0", "@opentelemetry/semantic-conventions": "~1.26.0", "arrify": "^2.0.0",