@google-cloud/pubsub 2.19.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/build/protos/google/pubsub/v1/pubsub.proto +75 -3
  3. package/build/protos/protos.d.ts +154 -0
  4. package/build/protos/protos.js +429 -0
  5. package/build/protos/protos.json +65 -0
  6. package/build/src/iam.d.ts +4 -1
  7. package/build/src/iam.js +1 -1
  8. package/build/src/iam.js.map +1 -1
  9. package/build/src/index.js +1 -1
  10. package/build/src/message-queues.js.map +1 -1
  11. package/build/src/message-stream.js +2 -2
  12. package/build/src/message-stream.js.map +1 -1
  13. package/build/src/publisher/flow-publisher.js +4 -4
  14. package/build/src/publisher/flow-publisher.js.map +1 -1
  15. package/build/src/publisher/index.js +5 -5
  16. package/build/src/publisher/index.js.map +1 -1
  17. package/build/src/publisher/message-batch.js +2 -2
  18. package/build/src/publisher/message-batch.js.map +1 -1
  19. package/build/src/publisher/message-queues.d.ts +1 -0
  20. package/build/src/pubsub.js +2 -2
  21. package/build/src/pubsub.js.map +1 -1
  22. package/build/src/snapshot.js +1 -1
  23. package/build/src/snapshot.js.map +1 -1
  24. package/build/src/subscriber.d.ts +1 -0
  25. package/build/src/subscriber.js +3 -3
  26. package/build/src/subscriber.js.map +1 -1
  27. package/build/src/subscription.js +1 -1
  28. package/build/src/subscription.js.map +1 -1
  29. package/build/src/topic.d.ts +1 -1
  30. package/build/src/topic.js +1 -1
  31. package/build/src/topic.js.map +1 -1
  32. package/build/src/util.js +1 -1
  33. package/build/src/util.js.map +1 -1
  34. package/build/src/v1/index.js +1 -0
  35. package/build/src/v1/index.js.map +1 -1
  36. package/build/src/v1/publisher_client.d.ts +45 -9
  37. package/build/src/v1/publisher_client.js +2 -1
  38. package/build/src/v1/publisher_client.js.map +1 -1
  39. package/build/src/v1/schema_service_client.d.ts +30 -6
  40. package/build/src/v1/schema_service_client.js.map +1 -1
  41. package/build/src/v1/subscriber_client.d.ts +86 -17
  42. package/build/src/v1/subscriber_client.js +1 -1
  43. package/build/src/v1/subscriber_client.js.map +1 -1
  44. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -4,6 +4,49 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/@google-cloud/pubsub?activeTab=versions
6
6
 
7
+ ## [3.0.0](https://github.com/googleapis/nodejs-pubsub/compare/v2.19.4...v3.0.0) (2022-05-26)
8
+
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+
12
+ * update library to use Node 12 (#1564)
13
+
14
+ ### Features
15
+
16
+ * add BigQuery configuration for subscriptions ([#1563](https://github.com/googleapis/nodejs-pubsub/issues/1563)) ([29d38a1](https://github.com/googleapis/nodejs-pubsub/commit/29d38a17663adcd02252a5b6c778d053208de12f))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **deps:** update dependency google-gax to v2.30.4 ([#1555](https://github.com/googleapis/nodejs-pubsub/issues/1555)) ([518fce1](https://github.com/googleapis/nodejs-pubsub/commit/518fce1adbdaae492a1d6db38daadb2be9c0a505))
22
+ * fixes for dynamic routing and streaming descriptors ([#1566](https://github.com/googleapis/nodejs-pubsub/issues/1566)) ([158c606](https://github.com/googleapis/nodejs-pubsub/commit/158c606a88077a59ac04d4abcce7c732120c4ebb))
23
+
24
+
25
+ ### Build System
26
+
27
+ * update library to use Node 12 ([#1564](https://github.com/googleapis/nodejs-pubsub/issues/1564)) ([adb4319](https://github.com/googleapis/nodejs-pubsub/commit/adb43190247a6282fc2abdcf75d7b07fe3fdc1dc))
28
+
29
+ ### [2.19.4](https://github.com/googleapis/nodejs-pubsub/compare/v2.19.3...v2.19.4) (2022-05-05)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **deps:** update dependency google-gax to v2.30.3 ([#1549](https://github.com/googleapis/nodejs-pubsub/issues/1549)) ([5810331](https://github.com/googleapis/nodejs-pubsub/commit/581033199dfe2a80a83b472bc77b1d7eab53b62d))
35
+
36
+ ### [2.19.3](https://github.com/googleapis/nodejs-pubsub/compare/v2.19.2...v2.19.3) (2022-04-26)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **deps:** update dependency google-gax to v2.30.2 ([#1502](https://github.com/googleapis/nodejs-pubsub/issues/1502)) ([37d075e](https://github.com/googleapis/nodejs-pubsub/commit/37d075e6ae4e588155a9f0c0506b9a497be6bf06))
42
+
43
+ ### [2.19.2](https://github.com/googleapis/nodejs-pubsub/compare/v2.19.1...v2.19.2) (2022-04-21)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * fix flaky schema and subscription tests ([#1518](https://github.com/googleapis/nodejs-pubsub/issues/1518)) ([5ff0105](https://github.com/googleapis/nodejs-pubsub/commit/5ff0105cf84751beb6f06343aaf5228157faae4d))
49
+
7
50
  ### [2.19.1](https://github.com/googleapis/nodejs-pubsub/compare/v2.19.0...v2.19.1) (2022-04-06)
8
51
 
9
52
 
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -642,6 +642,20 @@ message Subscription {
642
642
  pattern: "projects/{project}/subscriptions/{subscription}"
643
643
  };
644
644
 
645
+ // Possible states for a subscription.
646
+ enum State {
647
+ // Default value. This value is unused.
648
+ STATE_UNSPECIFIED = 0;
649
+
650
+ // The subscription can actively receive messages
651
+ ACTIVE = 1;
652
+
653
+ // The subscription cannot receive messages because of an error with the
654
+ // resource to which it pushes messages. See the more detailed error state
655
+ // in the corresponding configuration.
656
+ RESOURCE_ERROR = 2;
657
+ }
658
+
645
659
  // Required. The name of the subscription. It must have the format
646
660
  // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
647
661
  // start with a letter, and contain only letters (`[A-Za-z]`), numbers
@@ -659,10 +673,17 @@ message Subscription {
659
673
  ];
660
674
 
661
675
  // If push delivery is used with this subscription, this field is
662
- // used to configure it. An empty `pushConfig` signifies that the subscriber
663
- // will pull and ack messages using API methods.
676
+ // used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
677
+ // but not both. If both are empty, then the subscriber will pull and ack
678
+ // messages using API methods.
664
679
  PushConfig push_config = 4;
665
680
 
681
+ // If delivery to BigQuery is used with this subscription, this field is
682
+ // used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
683
+ // but not both. If both are empty, then the subscriber will pull and ack
684
+ // messages using API methods.
685
+ BigQueryConfig bigquery_config = 18;
686
+
666
687
  // The approximate amount of time (on a best-effort basis) Pub/Sub waits for
667
688
  // the subscriber to acknowledge receipt before resending the message. In the
668
689
  // interval after the message is delivered and before it is acknowledged, it
@@ -773,6 +794,10 @@ message Subscription {
773
794
  // in responses from the server; it is ignored if it is set in any requests.
774
795
  google.protobuf.Duration topic_message_retention_duration = 17
775
796
  [(google.api.field_behavior) = OUTPUT_ONLY];
797
+
798
+ // Output only. An output-only field indicating whether or not the subscription can receive
799
+ // messages.
800
+ State state = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
776
801
  }
777
802
 
778
803
  // A policy that specifies how Cloud Pub/Sub retries message delivery.
@@ -902,6 +927,53 @@ message PushConfig {
902
927
  }
903
928
  }
904
929
 
930
+ // Configuration for a BigQuery subscription.
931
+ message BigQueryConfig {
932
+ // Possible states for a BigQuery subscription.
933
+ enum State {
934
+ // Default value. This value is unused.
935
+ STATE_UNSPECIFIED = 0;
936
+
937
+ // The subscription can actively send messages to BigQuery
938
+ ACTIVE = 1;
939
+
940
+ // Cannot write to the BigQuery table because of permission denied errors.
941
+ PERMISSION_DENIED = 2;
942
+
943
+ // Cannot write to the BigQuery table because it does not exist.
944
+ NOT_FOUND = 3;
945
+
946
+ // Cannot write to the BigQuery table due to a schema mismatch.
947
+ SCHEMA_MISMATCH = 4;
948
+ }
949
+
950
+ // The name of the table to which to write data, of the form
951
+ // {projectId}:{datasetId}.{tableId}
952
+ string table = 1;
953
+
954
+ // When true, use the topic's schema as the columns to write to in BigQuery,
955
+ // if it exists.
956
+ bool use_topic_schema = 2;
957
+
958
+ // When true, write the subscription name, message_id, publish_time,
959
+ // attributes, and ordering_key to additional columns in the table. The
960
+ // subscription name, message_id, and publish_time fields are put in their own
961
+ // columns while all other message properties (other than data) are written to
962
+ // a JSON object in the attributes column.
963
+ bool write_metadata = 3;
964
+
965
+ // When true and use_topic_schema is true, any fields that are a part of the
966
+ // topic schema that are not part of the BigQuery table schema are dropped
967
+ // when writing to BigQuery. Otherwise, the schemas must be kept in sync and
968
+ // any messages with extra fields are not written and remain in the
969
+ // subscription's backlog.
970
+ bool drop_unknown_fields = 4;
971
+
972
+ // Output only. An output-only field that indicates whether or not the subscription can
973
+ // receive messages.
974
+ State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
975
+ }
976
+
905
977
  // A message and its corresponding acknowledgment ID.
906
978
  message ReceivedMessage {
907
979
  // This ID can be used to acknowledge the received message.
@@ -2264,6 +2264,9 @@ export namespace google {
2264
2264
  /** Subscription pushConfig */
2265
2265
  pushConfig?: (google.pubsub.v1.IPushConfig|null);
2266
2266
 
2267
+ /** Subscription bigqueryConfig */
2268
+ bigqueryConfig?: (google.pubsub.v1.IBigQueryConfig|null);
2269
+
2267
2270
  /** Subscription ackDeadlineSeconds */
2268
2271
  ackDeadlineSeconds?: (number|null);
2269
2272
 
@@ -2299,6 +2302,9 @@ export namespace google {
2299
2302
 
2300
2303
  /** Subscription topicMessageRetentionDuration */
2301
2304
  topicMessageRetentionDuration?: (google.protobuf.IDuration|null);
2305
+
2306
+ /** Subscription state */
2307
+ state?: (google.pubsub.v1.Subscription.State|keyof typeof google.pubsub.v1.Subscription.State|null);
2302
2308
  }
2303
2309
 
2304
2310
  /** Represents a Subscription. */
@@ -2319,6 +2325,9 @@ export namespace google {
2319
2325
  /** Subscription pushConfig. */
2320
2326
  public pushConfig?: (google.pubsub.v1.IPushConfig|null);
2321
2327
 
2328
+ /** Subscription bigqueryConfig. */
2329
+ public bigqueryConfig?: (google.pubsub.v1.IBigQueryConfig|null);
2330
+
2322
2331
  /** Subscription ackDeadlineSeconds. */
2323
2332
  public ackDeadlineSeconds: number;
2324
2333
 
@@ -2355,6 +2364,9 @@ export namespace google {
2355
2364
  /** Subscription topicMessageRetentionDuration. */
2356
2365
  public topicMessageRetentionDuration?: (google.protobuf.IDuration|null);
2357
2366
 
2367
+ /** Subscription state. */
2368
+ public state: (google.pubsub.v1.Subscription.State|keyof typeof google.pubsub.v1.Subscription.State);
2369
+
2358
2370
  /**
2359
2371
  * Creates a new Subscription instance using the specified properties.
2360
2372
  * @param [properties] Properties to set
@@ -2426,6 +2438,16 @@ export namespace google {
2426
2438
  public toJSON(): { [k: string]: any };
2427
2439
  }
2428
2440
 
2441
+ namespace Subscription {
2442
+
2443
+ /** State enum. */
2444
+ enum State {
2445
+ STATE_UNSPECIFIED = 0,
2446
+ ACTIVE = 1,
2447
+ RESOURCE_ERROR = 2
2448
+ }
2449
+ }
2450
+
2429
2451
  /** Properties of a RetryPolicy. */
2430
2452
  interface IRetryPolicy {
2431
2453
 
@@ -2912,6 +2934,132 @@ export namespace google {
2912
2934
  }
2913
2935
  }
2914
2936
 
2937
+ /** Properties of a BigQueryConfig. */
2938
+ interface IBigQueryConfig {
2939
+
2940
+ /** BigQueryConfig table */
2941
+ table?: (string|null);
2942
+
2943
+ /** BigQueryConfig useTopicSchema */
2944
+ useTopicSchema?: (boolean|null);
2945
+
2946
+ /** BigQueryConfig writeMetadata */
2947
+ writeMetadata?: (boolean|null);
2948
+
2949
+ /** BigQueryConfig dropUnknownFields */
2950
+ dropUnknownFields?: (boolean|null);
2951
+
2952
+ /** BigQueryConfig state */
2953
+ state?: (google.pubsub.v1.BigQueryConfig.State|keyof typeof google.pubsub.v1.BigQueryConfig.State|null);
2954
+ }
2955
+
2956
+ /** Represents a BigQueryConfig. */
2957
+ class BigQueryConfig implements IBigQueryConfig {
2958
+
2959
+ /**
2960
+ * Constructs a new BigQueryConfig.
2961
+ * @param [properties] Properties to set
2962
+ */
2963
+ constructor(properties?: google.pubsub.v1.IBigQueryConfig);
2964
+
2965
+ /** BigQueryConfig table. */
2966
+ public table: string;
2967
+
2968
+ /** BigQueryConfig useTopicSchema. */
2969
+ public useTopicSchema: boolean;
2970
+
2971
+ /** BigQueryConfig writeMetadata. */
2972
+ public writeMetadata: boolean;
2973
+
2974
+ /** BigQueryConfig dropUnknownFields. */
2975
+ public dropUnknownFields: boolean;
2976
+
2977
+ /** BigQueryConfig state. */
2978
+ public state: (google.pubsub.v1.BigQueryConfig.State|keyof typeof google.pubsub.v1.BigQueryConfig.State);
2979
+
2980
+ /**
2981
+ * Creates a new BigQueryConfig instance using the specified properties.
2982
+ * @param [properties] Properties to set
2983
+ * @returns BigQueryConfig instance
2984
+ */
2985
+ public static create(properties?: google.pubsub.v1.IBigQueryConfig): google.pubsub.v1.BigQueryConfig;
2986
+
2987
+ /**
2988
+ * Encodes the specified BigQueryConfig message. Does not implicitly {@link google.pubsub.v1.BigQueryConfig.verify|verify} messages.
2989
+ * @param message BigQueryConfig message or plain object to encode
2990
+ * @param [writer] Writer to encode to
2991
+ * @returns Writer
2992
+ */
2993
+ public static encode(message: google.pubsub.v1.IBigQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer;
2994
+
2995
+ /**
2996
+ * Encodes the specified BigQueryConfig message, length delimited. Does not implicitly {@link google.pubsub.v1.BigQueryConfig.verify|verify} messages.
2997
+ * @param message BigQueryConfig message or plain object to encode
2998
+ * @param [writer] Writer to encode to
2999
+ * @returns Writer
3000
+ */
3001
+ public static encodeDelimited(message: google.pubsub.v1.IBigQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer;
3002
+
3003
+ /**
3004
+ * Decodes a BigQueryConfig message from the specified reader or buffer.
3005
+ * @param reader Reader or buffer to decode from
3006
+ * @param [length] Message length if known beforehand
3007
+ * @returns BigQueryConfig
3008
+ * @throws {Error} If the payload is not a reader or valid buffer
3009
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3010
+ */
3011
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.pubsub.v1.BigQueryConfig;
3012
+
3013
+ /**
3014
+ * Decodes a BigQueryConfig message from the specified reader or buffer, length delimited.
3015
+ * @param reader Reader or buffer to decode from
3016
+ * @returns BigQueryConfig
3017
+ * @throws {Error} If the payload is not a reader or valid buffer
3018
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3019
+ */
3020
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.pubsub.v1.BigQueryConfig;
3021
+
3022
+ /**
3023
+ * Verifies a BigQueryConfig message.
3024
+ * @param message Plain object to verify
3025
+ * @returns `null` if valid, otherwise the reason why it is not
3026
+ */
3027
+ public static verify(message: { [k: string]: any }): (string|null);
3028
+
3029
+ /**
3030
+ * Creates a BigQueryConfig message from a plain object. Also converts values to their respective internal types.
3031
+ * @param object Plain object
3032
+ * @returns BigQueryConfig
3033
+ */
3034
+ public static fromObject(object: { [k: string]: any }): google.pubsub.v1.BigQueryConfig;
3035
+
3036
+ /**
3037
+ * Creates a plain object from a BigQueryConfig message. Also converts values to other types if specified.
3038
+ * @param message BigQueryConfig
3039
+ * @param [options] Conversion options
3040
+ * @returns Plain object
3041
+ */
3042
+ public static toObject(message: google.pubsub.v1.BigQueryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };
3043
+
3044
+ /**
3045
+ * Converts this BigQueryConfig to JSON.
3046
+ * @returns JSON object
3047
+ */
3048
+ public toJSON(): { [k: string]: any };
3049
+ }
3050
+
3051
+ namespace BigQueryConfig {
3052
+
3053
+ /** State enum. */
3054
+ enum State {
3055
+ STATE_UNSPECIFIED = 0,
3056
+ ACTIVE = 1,
3057
+ PERMISSION_DENIED = 2,
3058
+ NOT_FOUND = 3,
3059
+ SCHEMA_MISMATCH = 4
3060
+ }
3061
+ }
3062
+
2915
3063
  /** Properties of a ReceivedMessage. */
2916
3064
  interface IReceivedMessage {
2917
3065
 
@@ -8982,6 +9130,9 @@ export namespace google {
8982
9130
  /** FieldOptions lazy */
8983
9131
  lazy?: (boolean|null);
8984
9132
 
9133
+ /** FieldOptions unverifiedLazy */
9134
+ unverifiedLazy?: (boolean|null);
9135
+
8985
9136
  /** FieldOptions deprecated */
8986
9137
  deprecated?: (boolean|null);
8987
9138
 
@@ -9019,6 +9170,9 @@ export namespace google {
9019
9170
  /** FieldOptions lazy. */
9020
9171
  public lazy: boolean;
9021
9172
 
9173
+ /** FieldOptions unverifiedLazy. */
9174
+ public unverifiedLazy: boolean;
9175
+
9022
9176
  /** FieldOptions deprecated. */
9023
9177
  public deprecated: boolean;
9024
9178